tangled
alpha
login
or
join now
socksthewolf.com
/
skyscheduler
2
fork
atom
Schedule posts to Bluesky with Cloudflare workers.
skyscheduler.work
cf
tool
bsky-tool
cloudflare
bluesky
schedule
bsky
service
social-media
cloudflare-workers
2
fork
atom
overview
issues
pulls
pipelines
remove old env
SocksTheWolf
2 weeks ago
56fc7ba5
4eaabf71
+405
-60
2 changed files
expand all
collapse all
unified
split
src
wrangler.d.ts
wrangler.toml
+405
-53
src/wrangler.d.ts
···
1
/* eslint-disable */
2
-
// Generated by Wrangler by running `wrangler types src/wrangler.d.ts` (hash: e61299d82a442548930515b080c6af93)
3
-
// Runtime types generated with workerd@1.20260219.0 2025-11-18 disable_ctx_exports,disable_nodejs_http_server_modules,nodejs_compat,nodejs_compat_do_not_populate_process_env
4
declare namespace Cloudflare {
5
interface GlobalProps {
6
mainModule: typeof import("./index");
7
}
8
-
interface StagingEnv {
9
KV: KVNamespace;
0
10
R2: R2Bucket;
0
11
DB: D1Database;
0
0
12
IMAGES: ImagesBinding;
13
-
IMAGE_SETTINGS: {"enabled":false};
14
-
SIGNUP_SETTINGS: {"use_captcha":false,"invite_only":false,"invite_thread":"","invite_uses":10};
15
-
QUEUE_SETTINGS: {"enabled":false,"repostsEnabled":false,"postNowEnabled":false,"threadEnabled":true,"delay_val":10,"post_queues":["POST_QUEUE"],"repost_queues":[]};
0
16
REDIRECTS: {"contact":"https://bsky.app/profile/skyscheduler.work","tip":"https://ko-fi.com/socksthewolf/tip"};
17
-
R2_SETTINGS: {"auto_prune":false,"prune_days":3};
18
TASK_SETTINGS: {"use_posts":true,"use_reposts":true};
19
BETTER_AUTH_SECRET: string;
20
BETTER_AUTH_URL: string;
···
27
RESET_BOT_APP_PASS: string;
28
RESIZE_SECRET_HEADER: string;
29
IN_DEV: string;
30
-
}
31
-
interface Env {
32
-
BETTER_AUTH_SECRET: string;
33
-
BETTER_AUTH_URL: string;
34
-
DEFAULT_ADMIN_USER: string;
35
-
DEFAULT_ADMIN_PASS: string;
36
-
DEFAULT_ADMIN_BSKY_PASS: string;
37
-
TURNSTILE_PUBLIC_KEY: string;
38
-
TURNSTILE_SECRET_KEY: string;
39
-
RESET_BOT_USERNAME: string;
40
-
RESET_BOT_APP_PASS: string;
41
-
RESIZE_SECRET_HEADER: string;
42
-
IN_DEV: string;
43
-
KV: KVNamespace;
44
-
R2: R2Bucket;
45
-
DB: D1Database;
46
-
IMAGES: ImagesBinding;
47
-
IMAGE_SETTINGS: {"enabled":false} | {"enabled":true,"steps":[95,85,75],"bucket_url":"https://resize.skyscheduler.work/","max_width":3000};
48
-
SIGNUP_SETTINGS: {"use_captcha":false,"invite_only":false,"invite_thread":"","invite_uses":10} | {"use_captcha":true,"invite_only":false,"invite_thread":"","invite_uses":10};
49
-
QUEUE_SETTINGS: {"enabled":false,"repostsEnabled":false,"postNowEnabled":false,"threadEnabled":true,"delay_val":10,"post_queues":["POST_QUEUE"],"repost_queues":[]} | {"enabled":true,"repostsEnabled":true,"postNowEnabled":false,"threadEnabled":true,"pressure_retries":true,"delay_val":100,"max_retries":3,"post_queues":["POST_QUEUE"],"repost_queues":["REPOST_QUEUE"]};
50
-
REDIRECTS: {"contact":"https://bsky.app/profile/skyscheduler.work","tip":"https://ko-fi.com/socksthewolf/tip"};
51
-
R2_SETTINGS: {"auto_prune":false,"prune_days":3} | {"auto_prune":true,"prune_days":3};
52
-
TASK_SETTINGS: {"use_posts":true,"use_reposts":true};
53
-
INVITE_POOL?: KVNamespace;
54
-
R2RESIZE?: R2Bucket;
55
-
DBStaging?: D1Database;
56
-
POST_QUEUE?: Queue;
57
-
REPOST_QUEUE?: Queue;
58
-
ASSETS?: Fetcher;
59
}
60
}
61
interface Env extends Cloudflare.Env {}
···
3374
get timeOrigin(): number;
3375
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3376
now(): number;
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3377
}
3378
type AiImageClassificationInput = {
3379
image: number[];
···
8562
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
8563
aiGatewayLogId: string | null;
8564
gateway(gatewayId: string): AiGateway;
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8565
autorag(autoragId: string): AutoRAG;
8566
run<Name extends keyof AiModelList, Options extends AiOptions, InputOptions extends AiModelList[Name]["inputs"]>(model: Name, inputs: InputOptions, options?: Options): Promise<Options extends {
8567
returnRawResponse: true;
···
8670
}): Promise<Response>;
8671
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
8672
}
0
0
0
0
8673
interface AutoRAGInternalError extends Error {
8674
}
0
0
0
0
8675
interface AutoRAGNotFoundError extends Error {
8676
}
0
0
0
8677
interface AutoRAGUnauthorizedError extends Error {
8678
}
0
0
0
0
8679
interface AutoRAGNameNotSetError extends Error {
8680
}
8681
-
type ComparisonFilter = {
8682
-
key: string;
8683
-
type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
8684
-
value: string | number | boolean;
8685
-
};
8686
-
type CompoundFilter = {
8687
-
type: 'and' | 'or';
8688
-
filters: ComparisonFilter[];
8689
-
};
8690
type AutoRagSearchRequest = {
8691
query: string;
8692
filters?: CompoundFilter | ComparisonFilter;
···
8701
};
8702
rewrite_query?: boolean;
8703
};
0
0
0
0
0
8704
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
8705
stream?: boolean;
8706
system_prompt?: string;
8707
};
0
0
0
0
0
8708
type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {
8709
stream: true;
8710
};
0
0
0
0
0
8711
type AutoRagSearchResponse = {
8712
object: 'vector_store.search_results.page';
8713
search_query: string;
···
8724
has_more: boolean;
8725
next_page: string | null;
8726
};
0
0
0
0
0
8727
type AutoRagListResponse = {
8728
id: string;
8729
enable: boolean;
···
8733
paused: boolean;
8734
status: string;
8735
}[];
0
0
0
0
8736
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
8737
response: string;
8738
};
0
0
0
0
0
0
0
0
0
0
0
0
8739
declare abstract class AutoRAG {
0
0
0
0
8740
list(): Promise<AutoRagListResponse>;
0
0
0
0
0
8741
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
0
0
0
0
8742
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
0
0
0
0
8743
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
0
0
0
0
8744
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;
8745
}
8746
interface BasicImageTransformations {
···
9822
background?: string;
9823
anim?: boolean;
9824
};
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
9825
interface ImagesBinding {
9826
/**
9827
* Get image metadata (type, width and height)
···
9835
* @returns A transform handle
9836
*/
9837
input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;
0
0
0
0
9838
}
9839
interface ImageTransformer {
9840
/**
···
9901
* @param transform - Configuration for how the media should be transformed
9902
* @returns A generator for producing the transformed media output
9903
*/
9904
-
transform(transform: MediaTransformationInputOptions): MediaTransformationGenerator;
0
0
0
0
0
0
9905
}
9906
/**
9907
* Generator for producing media transformation results.
···
9913
* @param output - Configuration for the output format and parameters
9914
* @returns The final transformation result containing the transformed media
9915
*/
9916
-
output(output: MediaTransformationOutputOptions): MediaTransformationResult;
9917
}
9918
/**
9919
* Result of a media transformation operation.
···
9922
interface MediaTransformationResult {
9923
/**
9924
* Returns the transformed media as a readable stream of bytes.
9925
-
* @returns A stream containing the transformed media data
9926
*/
9927
-
media(): ReadableStream<Uint8Array>;
9928
/**
9929
* Returns the transformed media as an HTTP response object.
9930
-
* @returns The transformed media as a Response, ready to store in cache or return to users
9931
*/
9932
-
response(): Response;
9933
/**
9934
* Returns the MIME type of the transformed media.
9935
-
* @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
9936
*/
9937
-
contentType(): string;
9938
}
9939
/**
9940
* Configuration options for transforming media input.
···
1
/* eslint-disable */
2
+
// Generated by Wrangler by running `wrangler types src/wrangler.d.ts` (hash: 8550579ced1c27a295d15876d569afef)
3
+
// Runtime types generated with workerd@1.20260305.0 2025-11-18 disable_ctx_exports,disable_nodejs_http_server_modules,nodejs_compat,nodejs_compat_do_not_populate_process_env
4
declare namespace Cloudflare {
5
interface GlobalProps {
6
mainModule: typeof import("./index");
7
}
8
+
interface Env {
9
KV: KVNamespace;
10
+
INVITE_POOL: KVNamespace;
11
R2: R2Bucket;
12
+
R2RESIZE: R2Bucket;
13
DB: D1Database;
14
+
POST_QUEUE: Queue;
15
+
REPOST_QUEUE: Queue;
16
IMAGES: ImagesBinding;
17
+
ASSETS: Fetcher;
18
+
IMAGE_SETTINGS: {"enabled":true,"steps":[95,85,75],"bucket_url":"https://resize.skyscheduler.work/","max_width":3000};
19
+
SIGNUP_SETTINGS: {"use_captcha":true,"invite_only":false,"invite_thread":"","invite_uses":10};
20
+
QUEUE_SETTINGS: {"enabled":true,"repostsEnabled":true,"postNowEnabled":false,"threadEnabled":true,"pressure_retries":true,"delay_val":100,"max_retries":3,"post_queues":["POST_QUEUE"],"repost_queues":["REPOST_QUEUE"]};
21
REDIRECTS: {"contact":"https://bsky.app/profile/skyscheduler.work","tip":"https://ko-fi.com/socksthewolf/tip"};
22
+
R2_SETTINGS: {"auto_prune":true,"prune_days":3};
23
TASK_SETTINGS: {"use_posts":true,"use_reposts":true};
24
BETTER_AUTH_SECRET: string;
25
BETTER_AUTH_URL: string;
···
32
RESET_BOT_APP_PASS: string;
33
RESIZE_SECRET_HEADER: string;
34
IN_DEV: string;
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
35
}
36
}
37
interface Env extends Cloudflare.Env {}
···
3350
get timeOrigin(): number;
3351
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3352
now(): number;
3353
+
}
3354
+
// AI Search V2 API Error Interfaces
3355
+
interface AiSearchInternalError extends Error {
3356
+
}
3357
+
interface AiSearchNotFoundError extends Error {
3358
+
}
3359
+
interface AiSearchNameNotSetError extends Error {
3360
+
}
3361
+
// Filter types (shared with AutoRAG for compatibility)
3362
+
type ComparisonFilter = {
3363
+
key: string;
3364
+
type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
3365
+
value: string | number | boolean;
3366
+
};
3367
+
type CompoundFilter = {
3368
+
type: 'and' | 'or';
3369
+
filters: ComparisonFilter[];
3370
+
};
3371
+
// AI Search V2 Request Types
3372
+
type AiSearchSearchRequest = {
3373
+
messages: Array<{
3374
+
role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
3375
+
content: string | null;
3376
+
}>;
3377
+
ai_search_options?: {
3378
+
retrieval?: {
3379
+
retrieval_type?: 'vector' | 'keyword' | 'hybrid';
3380
+
/** Match threshold (0-1, default 0.4) */
3381
+
match_threshold?: number;
3382
+
/** Maximum number of results (1-50, default 10) */
3383
+
max_num_results?: number;
3384
+
filters?: CompoundFilter | ComparisonFilter;
3385
+
/** Context expansion (0-3, default 0) */
3386
+
context_expansion?: number;
3387
+
[key: string]: unknown;
3388
+
};
3389
+
query_rewrite?: {
3390
+
enabled?: boolean;
3391
+
model?: string;
3392
+
rewrite_prompt?: string;
3393
+
[key: string]: unknown;
3394
+
};
3395
+
reranking?: {
3396
+
/** Enable reranking (default false) */
3397
+
enabled?: boolean;
3398
+
model?: '@cf/baai/bge-reranker-base' | '';
3399
+
/** Match threshold (0-1, default 0.4) */
3400
+
match_threshold?: number;
3401
+
[key: string]: unknown;
3402
+
};
3403
+
[key: string]: unknown;
3404
+
};
3405
+
};
3406
+
type AiSearchChatCompletionsRequest = {
3407
+
messages: Array<{
3408
+
role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
3409
+
content: string | null;
3410
+
}>;
3411
+
model?: string;
3412
+
stream?: boolean;
3413
+
ai_search_options?: {
3414
+
retrieval?: {
3415
+
retrieval_type?: 'vector' | 'keyword' | 'hybrid';
3416
+
match_threshold?: number;
3417
+
max_num_results?: number;
3418
+
filters?: CompoundFilter | ComparisonFilter;
3419
+
context_expansion?: number;
3420
+
[key: string]: unknown;
3421
+
};
3422
+
query_rewrite?: {
3423
+
enabled?: boolean;
3424
+
model?: string;
3425
+
rewrite_prompt?: string;
3426
+
[key: string]: unknown;
3427
+
};
3428
+
reranking?: {
3429
+
enabled?: boolean;
3430
+
model?: '@cf/baai/bge-reranker-base' | '';
3431
+
match_threshold?: number;
3432
+
[key: string]: unknown;
3433
+
};
3434
+
[key: string]: unknown;
3435
+
};
3436
+
[key: string]: unknown;
3437
+
};
3438
+
// AI Search V2 Response Types
3439
+
type AiSearchSearchResponse = {
3440
+
search_query: string;
3441
+
chunks: Array<{
3442
+
id: string;
3443
+
type: string;
3444
+
/** Match score (0-1) */
3445
+
score: number;
3446
+
text: string;
3447
+
item: {
3448
+
timestamp?: number;
3449
+
key: string;
3450
+
metadata?: Record<string, unknown>;
3451
+
};
3452
+
scoring_details?: {
3453
+
/** Keyword match score (0-1) */
3454
+
keyword_score?: number;
3455
+
/** Vector similarity score (0-1) */
3456
+
vector_score?: number;
3457
+
};
3458
+
}>;
3459
+
};
3460
+
type AiSearchListResponse = Array<{
3461
+
id: string;
3462
+
internal_id?: string;
3463
+
account_id?: string;
3464
+
account_tag?: string;
3465
+
/** Whether the instance is enabled (default true) */
3466
+
enable?: boolean;
3467
+
type?: 'r2' | 'web-crawler';
3468
+
source?: string;
3469
+
[key: string]: unknown;
3470
+
}>;
3471
+
type AiSearchConfig = {
3472
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
3473
+
id: string;
3474
+
type: 'r2' | 'web-crawler';
3475
+
source: string;
3476
+
source_params?: object;
3477
+
/** Token ID (UUID format) */
3478
+
token_id?: string;
3479
+
ai_gateway_id?: string;
3480
+
/** Enable query rewriting (default false) */
3481
+
rewrite_query?: boolean;
3482
+
/** Enable reranking (default false) */
3483
+
reranking?: boolean;
3484
+
embedding_model?: string;
3485
+
ai_search_model?: string;
3486
+
};
3487
+
type AiSearchInstance = {
3488
+
id: string;
3489
+
enable?: boolean;
3490
+
type?: 'r2' | 'web-crawler';
3491
+
source?: string;
3492
+
[key: string]: unknown;
3493
+
};
3494
+
// AI Search Instance Service - Instance-level operations
3495
+
declare abstract class AiSearchInstanceService {
3496
+
/**
3497
+
* Search the AI Search instance for relevant chunks.
3498
+
* @param params Search request with messages and AI search options
3499
+
* @returns Search response with matching chunks
3500
+
*/
3501
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
3502
+
/**
3503
+
* Generate chat completions with AI Search context.
3504
+
* @param params Chat completions request with optional streaming
3505
+
* @returns Response object (if streaming) or chat completion result
3506
+
*/
3507
+
chatCompletions(params: AiSearchChatCompletionsRequest): Promise<Response | object>;
3508
+
/**
3509
+
* Delete this AI Search instance.
3510
+
*/
3511
+
delete(): Promise<void>;
3512
+
}
3513
+
// AI Search Account Service - Account-level operations
3514
+
declare abstract class AiSearchAccountService {
3515
+
/**
3516
+
* List all AI Search instances in the account.
3517
+
* @returns Array of AI Search instances
3518
+
*/
3519
+
list(): Promise<AiSearchListResponse>;
3520
+
/**
3521
+
* Get an AI Search instance by ID.
3522
+
* @param name Instance ID
3523
+
* @returns Instance service for performing operations
3524
+
*/
3525
+
get(name: string): AiSearchInstanceService;
3526
+
/**
3527
+
* Create a new AI Search instance.
3528
+
* @param config Instance configuration
3529
+
* @returns Instance service for performing operations
3530
+
*/
3531
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
3532
}
3533
type AiImageClassificationInput = {
3534
image: number[];
···
8717
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
8718
aiGatewayLogId: string | null;
8719
gateway(gatewayId: string): AiGateway;
8720
+
/**
8721
+
* Access the AI Search API for managing AI-powered search instances.
8722
+
*
8723
+
* This is the new API that replaces AutoRAG with better namespace separation:
8724
+
* - Account-level operations: `list()`, `create()`
8725
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
8726
+
*
8727
+
* @example
8728
+
* ```typescript
8729
+
* // List all AI Search instances
8730
+
* const instances = await env.AI.aiSearch.list();
8731
+
*
8732
+
* // Search an instance
8733
+
* const results = await env.AI.aiSearch.get('my-search').search({
8734
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
8735
+
* ai_search_options: {
8736
+
* retrieval: { max_num_results: 10 }
8737
+
* }
8738
+
* });
8739
+
*
8740
+
* // Generate chat completions with AI Search context
8741
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
8742
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
8743
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
8744
+
* });
8745
+
* ```
8746
+
*/
8747
+
aiSearch(): AiSearchAccountService;
8748
+
/**
8749
+
* @deprecated AutoRAG has been replaced by AI Search.
8750
+
* Use `env.AI.aiSearch` instead for better API design and new features.
8751
+
*
8752
+
* Migration guide:
8753
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
8754
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
8755
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
8756
+
*
8757
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
8758
+
*
8759
+
* @see AiSearchAccountService
8760
+
* @param autoragId Optional instance ID (omit for account-level operations)
8761
+
*/
8762
autorag(autoragId: string): AutoRAG;
8763
run<Name extends keyof AiModelList, Options extends AiOptions, InputOptions extends AiModelList[Name]["inputs"]>(model: Name, inputs: InputOptions, options?: Options): Promise<Options extends {
8764
returnRawResponse: true;
···
8867
}): Promise<Response>;
8868
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
8869
}
8870
+
/**
8871
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
8872
+
* @see AiSearchInternalError
8873
+
*/
8874
interface AutoRAGInternalError extends Error {
8875
}
8876
+
/**
8877
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
8878
+
* @see AiSearchNotFoundError
8879
+
*/
8880
interface AutoRAGNotFoundError extends Error {
8881
}
8882
+
/**
8883
+
* @deprecated This error type is no longer used in the AI Search API.
8884
+
*/
8885
interface AutoRAGUnauthorizedError extends Error {
8886
}
8887
+
/**
8888
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
8889
+
* @see AiSearchNameNotSetError
8890
+
*/
8891
interface AutoRAGNameNotSetError extends Error {
8892
}
8893
+
/**
8894
+
* @deprecated AutoRAG has been replaced by AI Search.
8895
+
* Use AiSearchSearchRequest with the new API instead.
8896
+
* @see AiSearchSearchRequest
8897
+
*/
0
0
0
0
8898
type AutoRagSearchRequest = {
8899
query: string;
8900
filters?: CompoundFilter | ComparisonFilter;
···
8909
};
8910
rewrite_query?: boolean;
8911
};
8912
+
/**
8913
+
* @deprecated AutoRAG has been replaced by AI Search.
8914
+
* Use AiSearchChatCompletionsRequest with the new API instead.
8915
+
* @see AiSearchChatCompletionsRequest
8916
+
*/
8917
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
8918
stream?: boolean;
8919
system_prompt?: string;
8920
};
8921
+
/**
8922
+
* @deprecated AutoRAG has been replaced by AI Search.
8923
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
8924
+
* @see AiSearchChatCompletionsRequest
8925
+
*/
8926
type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {
8927
stream: true;
8928
};
8929
+
/**
8930
+
* @deprecated AutoRAG has been replaced by AI Search.
8931
+
* Use AiSearchSearchResponse with the new API instead.
8932
+
* @see AiSearchSearchResponse
8933
+
*/
8934
type AutoRagSearchResponse = {
8935
object: 'vector_store.search_results.page';
8936
search_query: string;
···
8947
has_more: boolean;
8948
next_page: string | null;
8949
};
8950
+
/**
8951
+
* @deprecated AutoRAG has been replaced by AI Search.
8952
+
* Use AiSearchListResponse with the new API instead.
8953
+
* @see AiSearchListResponse
8954
+
*/
8955
type AutoRagListResponse = {
8956
id: string;
8957
enable: boolean;
···
8961
paused: boolean;
8962
status: string;
8963
}[];
8964
+
/**
8965
+
* @deprecated AutoRAG has been replaced by AI Search.
8966
+
* The new API returns different response formats for chat completions.
8967
+
*/
8968
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
8969
response: string;
8970
};
8971
+
/**
8972
+
* @deprecated AutoRAG has been replaced by AI Search.
8973
+
* Use the new AI Search API instead: `env.AI.aiSearch`
8974
+
*
8975
+
* Migration guide:
8976
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
8977
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
8978
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
8979
+
*
8980
+
* @see AiSearchAccountService
8981
+
* @see AiSearchInstanceService
8982
+
*/
8983
declare abstract class AutoRAG {
8984
+
/**
8985
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
8986
+
* @see AiSearchAccountService.list
8987
+
*/
8988
list(): Promise<AutoRagListResponse>;
8989
+
/**
8990
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
8991
+
* Note: The new API uses a messages array instead of a query string.
8992
+
* @see AiSearchInstanceService.search
8993
+
*/
8994
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
8995
+
/**
8996
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
8997
+
* @see AiSearchInstanceService.chatCompletions
8998
+
*/
8999
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
9000
+
/**
9001
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9002
+
* @see AiSearchInstanceService.chatCompletions
9003
+
*/
9004
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
9005
+
/**
9006
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
9007
+
* @see AiSearchInstanceService.chatCompletions
9008
+
*/
9009
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;
9010
}
9011
interface BasicImageTransformations {
···
10087
background?: string;
10088
anim?: boolean;
10089
};
10090
+
interface ImageMetadata {
10091
+
id: string;
10092
+
filename?: string;
10093
+
uploaded?: string;
10094
+
requireSignedURLs: boolean;
10095
+
meta?: Record<string, unknown>;
10096
+
variants: string[];
10097
+
draft?: boolean;
10098
+
creator?: string;
10099
+
}
10100
+
interface ImageUploadOptions {
10101
+
id?: string;
10102
+
filename?: string;
10103
+
requireSignedURLs?: boolean;
10104
+
metadata?: Record<string, unknown>;
10105
+
creator?: string;
10106
+
encoding?: 'base64';
10107
+
}
10108
+
interface ImageUpdateOptions {
10109
+
requireSignedURLs?: boolean;
10110
+
metadata?: Record<string, unknown>;
10111
+
creator?: string;
10112
+
}
10113
+
interface ImageListOptions {
10114
+
limit?: number;
10115
+
cursor?: string;
10116
+
sortOrder?: 'asc' | 'desc';
10117
+
creator?: string;
10118
+
}
10119
+
interface ImageList {
10120
+
images: ImageMetadata[];
10121
+
cursor?: string;
10122
+
listComplete: boolean;
10123
+
}
10124
+
interface HostedImagesBinding {
10125
+
/**
10126
+
* Get detailed metadata for a hosted image
10127
+
* @param imageId The ID of the image (UUID or custom ID)
10128
+
* @returns Image metadata, or null if not found
10129
+
*/
10130
+
details(imageId: string): Promise<ImageMetadata | null>;
10131
+
/**
10132
+
* Get the raw image data for a hosted image
10133
+
* @param imageId The ID of the image (UUID or custom ID)
10134
+
* @returns ReadableStream of image bytes, or null if not found
10135
+
*/
10136
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
10137
+
/**
10138
+
* Upload a new hosted image
10139
+
* @param image The image file to upload
10140
+
* @param options Upload configuration
10141
+
* @returns Metadata for the uploaded image
10142
+
* @throws {@link ImagesError} if upload fails
10143
+
*/
10144
+
upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;
10145
+
/**
10146
+
* Update hosted image metadata
10147
+
* @param imageId The ID of the image
10148
+
* @param options Properties to update
10149
+
* @returns Updated image metadata
10150
+
* @throws {@link ImagesError} if update fails
10151
+
*/
10152
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
10153
+
/**
10154
+
* Delete a hosted image
10155
+
* @param imageId The ID of the image
10156
+
* @returns True if deleted, false if not found
10157
+
*/
10158
+
delete(imageId: string): Promise<boolean>;
10159
+
/**
10160
+
* List hosted images with pagination
10161
+
* @param options List configuration
10162
+
* @returns List of images with pagination info
10163
+
* @throws {@link ImagesError} if list fails
10164
+
*/
10165
+
list(options?: ImageListOptions): Promise<ImageList>;
10166
+
}
10167
interface ImagesBinding {
10168
/**
10169
* Get image metadata (type, width and height)
···
10177
* @returns A transform handle
10178
*/
10179
input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;
10180
+
/**
10181
+
* Access hosted images CRUD operations
10182
+
*/
10183
+
readonly hosted: HostedImagesBinding;
10184
}
10185
interface ImageTransformer {
10186
/**
···
10247
* @param transform - Configuration for how the media should be transformed
10248
* @returns A generator for producing the transformed media output
10249
*/
10250
+
transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;
10251
+
/**
10252
+
* Generates the final media output with specified options.
10253
+
* @param output - Configuration for the output format and parameters
10254
+
* @returns The final transformation result containing the transformed media
10255
+
*/
10256
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
10257
}
10258
/**
10259
* Generator for producing media transformation results.
···
10265
* @param output - Configuration for the output format and parameters
10266
* @returns The final transformation result containing the transformed media
10267
*/
10268
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
10269
}
10270
/**
10271
* Result of a media transformation operation.
···
10274
interface MediaTransformationResult {
10275
/**
10276
* Returns the transformed media as a readable stream of bytes.
10277
+
* @returns A promise containing a readable stream with the transformed media
10278
*/
10279
+
media(): Promise<ReadableStream<Uint8Array>>;
10280
/**
10281
* Returns the transformed media as an HTTP response object.
10282
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
10283
*/
10284
+
response(): Promise<Response>;
10285
/**
10286
* Returns the MIME type of the transformed media.
10287
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
10288
*/
10289
+
contentType(): Promise<string>;
10290
}
10291
/**
10292
* Configuration options for transforming media input.
-7
wrangler.toml
···
28
migrations_table = "migrations"
29
migrations_dir = "migrations"
30
31
-
[[d1_databases]]
32
-
binding = "DBStaging"
33
-
database_name = "skyposts-dev"
34
-
database_id = "9e9e3275-c12e-4209-9b8c-a1ee57f7bb8d"
35
-
migrations_table = "migrations"
36
-
migrations_dir = "migrations"
37
-
38
# media storage
39
[[r2_buckets]]
40
binding = "R2"
···
28
migrations_table = "migrations"
29
migrations_dir = "migrations"
30
0
0
0
0
0
0
0
31
# media storage
32
[[r2_buckets]]
33
binding = "R2"