workerd 1.20260415.1 → 1.20260416.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/workerd CHANGED
@@ -122,7 +122,7 @@ by workerd to install the correct binary executable for your current platform.`)
122
122
  "node_modules",
123
123
  ".cache",
124
124
  "workerd",
125
- `pnpapi-${pkg.replace("/", "-")}-${"1.20260415.1"}-${import_path.default.basename(subpath)}`
125
+ `pnpapi-${pkg.replace("/", "-")}-${"1.20260416.2"}-${import_path.default.basename(subpath)}`
126
126
  );
127
127
  if (!import_fs.default.existsSync(binTargetPath)) {
128
128
  import_fs.default.mkdirSync(import_path.default.dirname(binTargetPath), { recursive: true });
package/install.js CHANGED
@@ -94,10 +94,10 @@ operating system, or missing some shared libraries.`;
94
94
  console.error(msg);
95
95
  return;
96
96
  }
97
- if (stdout !== `workerd ${"2026-04-15"}`) {
97
+ if (stdout !== `workerd ${"2026-04-16"}`) {
98
98
  throw new Error(
99
99
  `Expected ${JSON.stringify(
100
- "2026-04-15"
100
+ "2026-04-16"
101
101
  )} but got ${JSON.stringify(stdout)}`
102
102
  );
103
103
  }
@@ -152,7 +152,7 @@ function installUsingNPM(pkg, subpath, binPath) {
152
152
  try {
153
153
  import_fs.default.writeFileSync(import_path2.default.join(installDir, "package.json"), "{}");
154
154
  import_child_process.default.execSync(
155
- `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"1.20260415.1"}`,
155
+ `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"1.20260416.2"}`,
156
156
  { cwd: installDir, stdio: "pipe", env }
157
157
  );
158
158
  const installedBinPath = import_path2.default.join(
@@ -197,7 +197,7 @@ function maybeOptimizePackage(binPath) {
197
197
  }
198
198
  async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
199
199
  const unscopedPkg = pkg.substring(pkg.indexOf("/") + 1);
200
- const url = `https://registry.npmjs.org/${pkg}/-/${unscopedPkg}-${"1.20260415.1"}.tgz`;
200
+ const url = `https://registry.npmjs.org/${pkg}/-/${unscopedPkg}-${"1.20260416.2"}.tgz`;
201
201
  console.error(`[workerd] Trying to download ${JSON.stringify(url)}`);
202
202
  try {
203
203
  import_fs.default.writeFileSync(
package/lib/main.js CHANGED
@@ -136,7 +136,7 @@ by workerd to install the correct binary executable for your current platform.`)
136
136
  "node_modules",
137
137
  ".cache",
138
138
  "workerd",
139
- `pnpapi-${pkg.replace("/", "-")}-${"1.20260415.1"}-${import_path.default.basename(subpath)}`
139
+ `pnpapi-${pkg.replace("/", "-")}-${"1.20260416.2"}-${import_path.default.basename(subpath)}`
140
140
  );
141
141
  if (!import_fs.default.existsSync(binTargetPath)) {
142
142
  import_fs.default.mkdirSync(import_path.default.dirname(binTargetPath), { recursive: true });
@@ -151,8 +151,8 @@ by workerd to install the correct binary executable for your current platform.`)
151
151
  // npm/lib/node-path.ts
152
152
  var { binPath } = generateBinPath();
153
153
  var node_path_default = binPath;
154
- var compatibilityDate = "2026-04-15";
155
- var version = "1.20260415.1";
154
+ var compatibilityDate = "2026-04-16";
155
+ var version = "1.20260416.2";
156
156
  // Annotate the CommonJS export names for ESM import in node:
157
157
  0 && (module.exports = {
158
158
  compatibilityDate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workerd",
3
- "version": "1.20260415.1",
3
+ "version": "1.20260416.2",
4
4
  "description": "👷 workerd, Cloudflare's JavaScript/Wasm Runtime",
5
5
  "repository": "https://github.com/cloudflare/workerd",
6
6
  "scripts": {
@@ -14,11 +14,11 @@
14
14
  "workerd": "bin/workerd"
15
15
  },
16
16
  "optionalDependencies": {
17
- "@cloudflare/workerd-darwin-arm64": "1.20260415.1",
18
- "@cloudflare/workerd-darwin-64": "1.20260415.1",
19
- "@cloudflare/workerd-linux-arm64": "1.20260415.1",
20
- "@cloudflare/workerd-linux-64": "1.20260415.1",
21
- "@cloudflare/workerd-windows-64": "1.20260415.1"
17
+ "@cloudflare/workerd-darwin-arm64": "1.20260416.2",
18
+ "@cloudflare/workerd-darwin-64": "1.20260416.2",
19
+ "@cloudflare/workerd-linux-arm64": "1.20260416.2",
20
+ "@cloudflare/workerd-linux-64": "1.20260416.2",
21
+ "@cloudflare/workerd-windows-64": "1.20260416.2"
22
22
  },
23
23
  "license": "Apache-2.0"
24
24
  }
package/worker.mjs CHANGED
@@ -445,76 +445,159 @@ Segment #${me}
445
445
  export interface AiSearchInternalError extends Error {}
446
446
  export interface AiSearchNotFoundError extends Error {}
447
447
 
448
- // ============ AI Search Request Types ============
448
+ // ============ AI Search Common Types ============
449
449
 
450
- export type AiSearchSearchRequest = {
451
- messages: Array<{
452
- role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
453
- content: string | null;
454
- }>;
455
- ai_search_options?: {
456
- retrieval?: {
457
- retrieval_type?: 'vector' | 'keyword' | 'hybrid';
458
- /** Match threshold (0-1, default 0.4) */
459
- match_threshold?: number;
460
- /** Maximum number of results (1-50, default 10) */
461
- max_num_results?: number;
462
- filters?: VectorizeVectorMetadataFilter;
463
- /** Context expansion (0-3, default 0) */
464
- context_expansion?: number;
465
- [key: string]: unknown;
466
- };
467
- query_rewrite?: {
468
- enabled?: boolean;
469
- model?: string;
470
- rewrite_prompt?: string;
471
- [key: string]: unknown;
472
- };
473
- reranking?: {
474
- enabled?: boolean;
475
- model?: '@cf/baai/bge-reranker-base' | string;
476
- /** Match threshold (0-1, default 0.4) */
477
- match_threshold?: number;
478
- [key: string]: unknown;
479
- };
450
+ /** A single message in a conversation-style search or chat request. */
451
+ export type AiSearchMessage = {
452
+ role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
453
+ content: string | null;
454
+ };
455
+
456
+ /**
457
+ * Common shape for \`ai_search_options\` used by both single-instance and multi-instance requests.
458
+ * Contains retrieval, query rewrite, reranking, and cache sub-options.
459
+ */
460
+ export type AiSearchOptions = {
461
+ retrieval?: {
462
+ /** Which retrieval backend to use. Defaults to the instance's configured index_method. */
463
+ retrieval_type?: 'vector' | 'keyword' | 'hybrid';
464
+ /** Fusion method for combining vector + keyword results. */
465
+ fusion_method?: 'max' | 'rrf';
466
+ /** How keyword terms are combined: "and" = all terms must match, "or" = any term matches. */
467
+ keyword_match_mode?: 'and' | 'or';
468
+ /** Minimum similarity score (0-1) for a result to be included. Default 0.4. */
469
+ match_threshold?: number;
470
+ /** Maximum number of results to return (1-50). Default 10. */
471
+ max_num_results?: number;
472
+ /** Vectorize metadata filters applied to the search. */
473
+ filters?: VectorizeVectorMetadataFilter;
474
+ /** Number of surrounding chunks to include for context (0-3). Default 0. */
475
+ context_expansion?: number;
476
+ /** If true, return only item metadata without chunk text. */
477
+ metadata_only?: boolean;
478
+ /** If true (default), return empty results on retrieval failure instead of throwing. */
479
+ return_on_failure?: boolean;
480
+ /** Boost results by metadata field values. Max 3 entries. */
481
+ boost_by?: Array<{
482
+ field: string;
483
+ direction?: 'asc' | 'desc' | 'exists' | 'not_exists';
484
+ }>;
485
+ [key: string]: unknown;
486
+ };
487
+ query_rewrite?: {
488
+ enabled?: boolean;
489
+ model?: string;
490
+ rewrite_prompt?: string;
491
+ [key: string]: unknown;
492
+ };
493
+ reranking?: {
494
+ enabled?: boolean;
495
+ model?: string;
496
+ /** Match threshold (0-1, default 0.4) */
497
+ match_threshold?: number;
480
498
  [key: string]: unknown;
481
499
  };
500
+ cache?: {
501
+ enabled?: boolean;
502
+ cache_threshold?:
503
+ | 'super_strict_match'
504
+ | 'close_enough'
505
+ | 'flexible_friend'
506
+ | 'anything_goes';
507
+ };
508
+ [key: string]: unknown;
482
509
  };
483
510
 
511
+ // ============ AI Search Request Types ============
512
+
513
+ /**
514
+ * Request body for single-instance search.
515
+ * Exactly one of \`query\` or \`messages\` must be provided.
516
+ */
517
+ export type AiSearchSearchRequest =
518
+ | {
519
+ /** Simple query string. */
520
+ query: string;
521
+ messages?: never;
522
+ ai_search_options?: AiSearchOptions;
523
+ }
524
+ | {
525
+ query?: never;
526
+ /** Conversation-style input. At least one user message with non-empty content is required. */
527
+ messages: AiSearchMessage[];
528
+ ai_search_options?: AiSearchOptions;
529
+ };
530
+
484
531
  export type AiSearchChatCompletionsRequest = {
485
- messages: Array<{
486
- role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
487
- content: string | null;
488
- [key: string]: unknown;
489
- }>;
532
+ messages: AiSearchMessage[];
490
533
  model?: string;
491
534
  stream?: boolean;
492
- ai_search_options?: {
493
- retrieval?: {
494
- retrieval_type?: 'vector' | 'keyword' | 'hybrid';
495
- match_threshold?: number;
496
- max_num_results?: number;
497
- filters?: VectorizeVectorMetadataFilter;
498
- context_expansion?: number;
499
- [key: string]: unknown;
500
- };
501
- query_rewrite?: {
502
- enabled?: boolean;
503
- model?: string;
504
- rewrite_prompt?: string;
505
- [key: string]: unknown;
506
- };
507
- reranking?: {
508
- enabled?: boolean;
509
- model?: '@cf/baai/bge-reranker-base' | string;
510
- match_threshold?: number;
511
- [key: string]: unknown;
535
+ ai_search_options?: AiSearchOptions;
536
+ [key: string]: unknown;
537
+ };
538
+
539
+ // ============ AI Search Multi-Instance Types (Namespace-Scoped) ============
540
+
541
+ /** \`ai_search_options\` shape for multi-instance requests \u2014 requires \`instance_ids\`. */
542
+ export type AiSearchMultiSearchOptions = AiSearchOptions & {
543
+ /** Instance IDs to search across (1-10). */
544
+ instance_ids: string[];
545
+ };
546
+
547
+ /**
548
+ * Request for searching across multiple instances within a namespace.
549
+ * \`ai_search_options\` is required and must include \`instance_ids\`.
550
+ * Exactly one of \`query\` or \`messages\` must be provided.
551
+ */
552
+ export type AiSearchMultiSearchRequest =
553
+ | {
554
+ /** Simple query string. */
555
+ query: string;
556
+ messages?: never;
557
+ ai_search_options: AiSearchMultiSearchOptions;
558
+ }
559
+ | {
560
+ query?: never;
561
+ /** Conversation-style input. */
562
+ messages: AiSearchMessage[];
563
+ ai_search_options: AiSearchMultiSearchOptions;
512
564
  };
513
- [key: string]: unknown;
565
+
566
+ /** A search result chunk tagged with the instance it originated from. */
567
+ export type AiSearchMultiSearchChunk =
568
+ AiSearchSearchResponse['chunks'][number] & {
569
+ instance_id: string;
514
570
  };
515
- [key: string]: unknown;
571
+
572
+ /** Describes a per-instance error during a multi-instance operation. */
573
+ export type AiSearchMultiSearchError = {
574
+ instance_id: string;
575
+ message: string;
576
+ };
577
+
578
+ /** Response from a multi-instance search, with chunks tagged by instance and optional partial-failure errors. */
579
+ export type AiSearchMultiSearchResponse = {
580
+ search_query: string;
581
+ chunks: AiSearchMultiSearchChunk[];
582
+ errors?: AiSearchMultiSearchError[];
516
583
  };
517
584
 
585
+ /** Request for chat completions across multiple instances within a namespace. \`ai_search_options\` is required and must include \`instance_ids\`. */
586
+ export type AiSearchMultiChatCompletionsRequest = Omit<
587
+ AiSearchChatCompletionsRequest,
588
+ 'ai_search_options'
589
+ > & {
590
+ ai_search_options: AiSearchMultiSearchOptions;
591
+ };
592
+
593
+ /** Response from multi-instance chat completions, with chunks tagged by instance and optional partial-failure errors. */
594
+ export type AiSearchMultiChatCompletionsResponse = Omit<
595
+ AiSearchChatCompletionsResponse,
596
+ 'chunks'
597
+ > & {
598
+ chunks: AiSearchMultiSearchChunk[];
599
+ errors?: AiSearchMultiSearchError[];
600
+ };
518
601
 
519
602
  // ============ AI Search Response Types ============
520
603
 
@@ -536,6 +619,14 @@ export type AiSearchSearchResponse = {
536
619
  keyword_score?: number;
537
620
  /** Vector similarity score (0-1) */
538
621
  vector_score?: number;
622
+ /** Keyword rank position */
623
+ keyword_rank?: number;
624
+ /** Vector rank position */
625
+ vector_rank?: number;
626
+ /** Reranking model score */
627
+ reranking_score?: number;
628
+ /** Fusion method used to combine results */
629
+ fusion_method?: 'rrf' | 'max';
539
630
  [key: string]: unknown;
540
631
  };
541
632
  }>;
@@ -566,6 +657,18 @@ export type AiSearchStatsResponse = {
566
657
  skipped?: number;
567
658
  outdated?: number;
568
659
  last_activity?: string;
660
+ /** Storage engine statistics. */
661
+ engine?: {
662
+ vectorize?: {
663
+ vectorsCount: number;
664
+ dimensions: number;
665
+ };
666
+ r2?: {
667
+ payloadSizeBytes: number;
668
+ metadataSizeBytes: number;
669
+ objectCount: number;
670
+ };
671
+ };
569
672
  };
570
673
 
571
674
  // ============ AI Search Instance Info Types ============
@@ -574,14 +677,67 @@ export type AiSearchInstanceInfo = {
574
677
  id: string;
575
678
  type?: 'r2' | 'web-crawler' | string;
576
679
  source?: string;
680
+ source_params?: unknown;
577
681
  paused?: boolean;
578
682
  status?: string;
579
683
  namespace?: string;
580
684
  created_at?: string;
581
685
  modified_at?: string;
686
+ token_id?: string;
687
+ ai_gateway_id?: string;
688
+ rewrite_query?: boolean;
689
+ reranking?: boolean;
690
+ embedding_model?: string;
691
+ ai_search_model?: string;
692
+ rewrite_model?: string;
693
+ reranking_model?: string;
694
+ /** @deprecated Use index_method instead. */
695
+ hybrid_search_enabled?: boolean;
696
+ /** Controls which storage backends are active. */
697
+ index_method?: { vector?: boolean; keyword?: boolean };
698
+ /** Fusion method for combining vector and keyword results. */
699
+ fusion_method?: 'max' | 'rrf';
700
+ indexing_options?: { keyword_tokenizer?: 'porter' | 'trigram' } | null;
701
+ retrieval_options?: {
702
+ keyword_match_mode?: 'and' | 'or';
703
+ boost_by?: Array<{
704
+ field: string;
705
+ direction?: 'asc' | 'desc' | 'exists' | 'not_exists';
706
+ }>;
707
+ } | null;
708
+ chunk?: boolean;
709
+ chunk_size?: number;
710
+ chunk_overlap?: number;
711
+ score_threshold?: number;
712
+ max_num_results?: number;
713
+ cache?: boolean;
714
+ cache_threshold?:
715
+ | 'super_strict_match'
716
+ | 'close_enough'
717
+ | 'flexible_friend'
718
+ | 'anything_goes';
719
+ custom_metadata?: Array<{
720
+ field_name: string;
721
+ data_type: 'text' | 'number' | 'boolean' | 'datetime';
722
+ }>;
723
+ /** Sync interval in seconds. */
724
+ sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400;
725
+ metadata?: Record<string, unknown>;
582
726
  [key: string]: unknown;
583
727
  };
584
728
 
729
+ /** Pagination, search, and ordering parameters for listing instances within a namespace. */
730
+ export type AiSearchListInstancesParams = {
731
+ page?: number;
732
+ per_page?: number;
733
+ /** Search instances by ID. */
734
+ search?: string;
735
+ /** Field to sort by. */
736
+ order_by?: 'created_at';
737
+ /** Sort direction. */
738
+ order_by_direction?: 'asc' | 'desc';
739
+ };
740
+
585
741
  export type AiSearchListResponse = {
586
742
  result: AiSearchInstanceInfo[];
587
743
  result_info?: {
@@ -611,6 +767,43 @@ export type AiSearchConfig = {
611
767
  reranking?: boolean;
612
768
  embedding_model?: string;
613
769
  ai_search_model?: string;
770
+ rewrite_model?: string;
771
+ reranking_model?: string;
772
+ /** @deprecated Use index_method instead. */
773
+ hybrid_search_enabled?: boolean;
774
+ /** Controls which storage backends are used during indexing. Defaults to vector-only. */
775
+ index_method?: { vector?: boolean; keyword?: boolean };
776
+ /** Fusion method for combining vector and keyword results. "rrf" = reciprocal rank fusion (default), "max" = maximum score. */
777
+ fusion_method?: 'max' | 'rrf';
778
+ indexing_options?: { keyword_tokenizer?: 'porter' | 'trigram' } | null;
779
+ retrieval_options?: {
780
+ keyword_match_mode?: 'and' | 'or';
781
+ boost_by?: Array<{
782
+ field: string;
783
+ direction?: 'asc' | 'desc' | 'exists' | 'not_exists';
784
+ }>;
785
+ } | null;
786
+ chunk?: boolean;
787
+ chunk_size?: number;
788
+ chunk_overlap?: number;
789
+ /** Minimum similarity score (0-1) for a result to be included. */
790
+ score_threshold?: number;
791
+ max_num_results?: number;
792
+ cache?: boolean;
793
+ /** Similarity threshold for cache hits. Stricter = fewer cache hits but higher relevance. */
794
+ cache_threshold?:
795
+ | 'super_strict_match'
796
+ | 'close_enough'
797
+ | 'flexible_friend'
798
+ | 'anything_goes';
799
+ custom_metadata?: Array<{
800
+ field_name: string;
801
+ data_type: 'text' | 'number' | 'boolean' | 'datetime';
802
+ }>;
803
+ namespace?: string;
804
+ /** Sync interval in seconds. 3600=1h, 7200=2h, 14400=4h, 21600=6h, 43200=12h, 86400=24h. */
805
+ sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400;
806
+ metadata?: Record<string, unknown>;
614
807
  [key: string]: unknown;
615
808
  };
616
809
 
@@ -619,7 +812,16 @@ export type AiSearchConfig = {
619
812
  export type AiSearchItemInfo = {
620
813
  id: string;
621
814
  key: string;
622
- status: 'completed' | 'error' | 'skipped' | 'queued' | 'processing' | 'outdated';
815
+ status: 'completed' | 'error' | 'skipped' | 'queued' | 'running' | 'outdated';
816
+ next_action?: 'INDEX' | 'DELETE' | null;
817
+ error?: string;
818
+ checksum?: string;
819
+ namespace?: string;
820
+ chunks_count?: number | null;
821
+ file_size?: number | null;
822
+ source_id?: string | null;
823
+ last_seen_at?: string;
824
+ created_at?: string;
623
825
  metadata?: Record<string, unknown>;
624
826
  [key: string]: unknown;
625
827
  };
@@ -638,6 +840,22 @@ export type AiSearchUploadItemOptions = {
638
840
  export type AiSearchListItemsParams = {
639
841
  page?: number;
640
842
  per_page?: number;
843
+ /** Search items by key name. */
844
+ search?: string;
845
+ /** Sort order for results. */
846
+ sort_by?: 'status' | 'modified_at';
847
+ /** Filter items by processing status. */
848
+ status?:
849
+ | 'queued'
850
+ | 'running'
851
+ | 'completed'
852
+ | 'error'
853
+ | 'skipped'
854
+ | 'outdated';
855
+ /** Filter items by source (e.g. "builtin" or "web-crawler:https://example.com"). */
856
+ source?: string;
857
+ /** JSON-encoded Vectorize filter for metadata filtering. */
858
+ metadata_filter?: string;
641
859
  };
642
860
 
643
861
  export type AiSearchListItemsResponse = {
@@ -650,6 +868,69 @@ export type AiSearchListItemsResponse = {
650
868
  };
651
869
  };
652
870
 
871
+ // ============ AI Search Item Logs Types ============
872
+
873
+ export type AiSearchItemLogsParams = {
874
+ /** Maximum number of log entries to return (1-100, default 50). */
875
+ limit?: number;
876
+ /** Opaque cursor for pagination. Pass the \`cursor\` value from a previous response. */
877
+ cursor?: string;
878
+ };
879
+
880
+ export type AiSearchItemLog = {
881
+ timestamp: string;
882
+ action: string;
883
+ message: string;
884
+ fileKey?: string;
885
+ chunkCount?: number;
886
+ processingTimeMs?: number;
887
+ errorType?: string;
888
+ };
889
+
890
+ /** Paginated response for item processing logs (cursor-based). */
891
+ export type AiSearchItemLogsResponse = {
892
+ result: AiSearchItemLog[];
893
+ result_info: {
894
+ count: number;
895
+ per_page: number;
896
+ cursor: string | null;
897
+ truncated: boolean;
898
+ };
899
+ };
900
+
901
+ // ============ AI Search Item Chunks Types ============
902
+
903
+ export type AiSearchItemChunksParams = {
904
+ /** Maximum number of chunks to return (1-100, default 20). */
905
+ limit?: number;
906
+ /** Offset into the chunks list (default 0). */
907
+ offset?: number;
908
+ };
909
+
910
+ /** A single indexed chunk belonging to an item, including its text content and byte range. */
911
+ export type AiSearchItemChunk = {
912
+ id: string;
913
+ text: string;
914
+ start_byte: number;
915
+ end_byte: number;
916
+ item?: {
917
+ timestamp?: number;
918
+ key: string;
919
+ metadata?: Record<string, unknown>;
920
+ };
921
+ };
922
+
923
+ /** Paginated response for item chunks (offset-based). */
924
+ export type AiSearchItemChunksResponse = {
925
+ result: AiSearchItemChunk[];
926
+ result_info: {
927
+ count: number;
928
+ total: number;
929
+ limit: number;
930
+ offset: number;
931
+ };
932
+ };
933
+
653
934
  // ============ AI Search Job Types ============
654
935
 
655
936
  export type AiSearchJobInfo = {
@@ -707,7 +988,7 @@ export type AiSearchJobLogsResponse = {
707
988
 
708
989
  /**
709
990
  * Single item service for an AI Search instance.
710
- * Provides info, delete, and download operations on a specific item.
991
+ * Provides info, download, sync, logs, and chunks operations on a specific item.
711
992
  */
712
993
  export declare abstract class AiSearchItem {
713
994
  /** Get metadata about this item. */
@@ -718,6 +999,28 @@ export declare abstract class AiSearchItem {
718
999
  * @returns Object with body stream, content type, filename, and size.
719
1000
  */
720
1001
  download(): Promise<AiSearchItemContentResult>;
1002
+
1003
+ /**
1004
+ * Trigger re-indexing of this item.
1005
+ * @returns The updated item info.
1006
+ */
1007
+ sync(): Promise<AiSearchItemInfo>;
1008
+
1009
+ /**
1010
+ * Retrieve processing logs for this item (cursor-based pagination).
1011
+ * @param params Optional pagination parameters (limit, cursor).
1012
+ * @returns Paginated log entries for this item.
1013
+ */
1014
+ logs(params?: AiSearchItemLogsParams): Promise<AiSearchItemLogsResponse>;
1015
+
1016
+ /**
1017
+ * List indexed chunks for this item (offset-based pagination).
1018
+ * @param params Optional pagination parameters (limit, offset).
1019
+ * @returns Paginated chunk entries for this item.
1020
+ */
1021
+ chunks(
1022
+ params?: AiSearchItemChunksParams
1023
+ ): Promise<AiSearchItemChunksResponse>;
721
1024
  }
722
1025
 
723
1026
  /**
@@ -729,39 +1032,48 @@ export declare abstract class AiSearchItems {
729
1032
  list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
730
1033
 
731
1034
  /**
732
- * Upload a file as an item.
1035
+ * Upload a file as an item. Behaves as an upsert: if an item with the same
1036
+ * filename already exists, it is overwritten and re-indexed.
733
1037
  * @param name Filename for the uploaded item.
734
- * @param content File content as a ReadableStream, ArrayBuffer, or string.
1038
+ * @param content File content as a ReadableStream, Blob, or string.
735
1039
  * @param options Optional metadata to attach to the item.
736
1040
  * @returns The created item info.
737
1041
  */
738
1042
  upload(
739
1043
  name: string,
740
- content: ReadableStream | ArrayBuffer | string,
1044
+ content: ReadableStream | Blob | string,
741
1045
  options?: AiSearchUploadItemOptions
742
1046
  ): Promise<AiSearchItemInfo>;
743
1047
 
744
1048
  /**
745
1049
  * Upload a file and poll until processing completes.
1050
+ * Behaves as an upsert: if an item with the same filename already exists,
1051
+ * it is overwritten and re-indexed.
746
1052
  * @param name Filename for the uploaded item.
747
- * @param content File content as a ReadableStream, ArrayBuffer, or string.
748
- * @param options Optional metadata to attach to the item.
1053
+ * @param content File content as a ReadableStream, Blob, or string.
1054
+ * @param options Optional metadata and polling configuration.
749
1055
  * @returns The item info after processing completes (or timeout).
750
1056
  */
751
1057
  uploadAndPoll(
752
1058
  name: string,
753
- content: ReadableStream | ArrayBuffer | string,
754
- options?: AiSearchUploadItemOptions
1059
+ content: ReadableStream | Blob | string,
1060
+ options?: AiSearchUploadItemOptions & {
1061
+ /** Polling interval in milliseconds (default 1000). */
1062
+ pollIntervalMs?: number;
1063
+ /** Maximum time to wait in milliseconds (default 30000). */
1064
+ timeoutMs?: number;
1065
+ }
755
1066
  ): Promise<AiSearchItemInfo>;
756
1067
 
757
1068
  /**
758
1069
  * Get an item by ID.
759
1070
  * @param itemId The item identifier.
760
- * @returns Item service for info, delete, and download operations.
1071
+ * @returns Item service for info, download, sync, logs, and chunks operations.
761
1072
  */
762
1073
  get(itemId: string): AiSearchItem;
763
1074
 
764
- /** Delete this item from the instance.
1075
+ /**
1076
+ * Delete an item from the instance.
765
1077
  * @param itemId The item identifier.
766
1078
  */
767
1079
  delete(itemId: string): Promise<void>;
@@ -769,7 +1081,7 @@ export declare abstract class AiSearchItems {
769
1081
 
770
1082
  /**
771
1083
  * Single job service for an AI Search instance.
772
- * Provides info and logs for a specific job.
1084
+ * Provides info, logs, and cancel operations for a specific job.
773
1085
  */
774
1086
  export declare abstract class AiSearchJob {
775
1087
  /** Get metadata about this job. */
@@ -777,6 +1089,13 @@ export declare abstract class AiSearchJob {
777
1089
 
778
1090
  /** Get logs for this job. */
779
1091
  logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
1092
+
1093
+ /**
1094
+ * Cancel a running job.
1095
+ * @returns The updated job info.
1096
+ * @throws AiSearchNotFoundError if the job does not exist.
1097
+ */
1098
+ cancel(): Promise<AiSearchJobInfo>;
780
1099
  }
781
1100
 
782
1101
  /**
@@ -797,7 +1116,7 @@ export declare abstract class AiSearchJobs {
797
1116
  /**
798
1117
  * Get a job by ID.
799
1118
  * @param jobId The job identifier.
800
- * @returns Job service for info and logs operations.
1119
+ * @returns Job service for info, logs, and cancel operations.
801
1120
  */
802
1121
  get(jobId: string): AiSearchJob;
803
1122
  }
@@ -818,7 +1137,7 @@ export declare abstract class AiSearchJobs {
818
1137
  * // Via namespace binding
819
1138
  * const instance = env.AI_SEARCH.get("blog");
820
1139
  * const results = await instance.search({
821
- * messages: [{ role: "user", content: "How does caching work?" }],
1140
+ * query: "How does caching work?",
822
1141
  * });
823
1142
  *
824
1143
  * // Via single instance binding
@@ -830,7 +1149,7 @@ export declare abstract class AiSearchJobs {
830
1149
  export declare abstract class AiSearchInstance {
831
1150
  /**
832
1151
  * Search the AI Search instance for relevant chunks.
833
- * @param params Search request with messages and optional AI search options.
1152
+ * @param params Search request with query or messages and optional AI search options.
834
1153
  * @returns Search response with matching chunks and search query.
835
1154
  */
836
1155
  search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
@@ -865,7 +1184,7 @@ export declare abstract class AiSearchInstance {
865
1184
 
866
1185
  /**
867
1186
  * Get instance statistics (item count, indexing status, etc.).
868
- * @returns Statistics with counts per status and last activity time.
1187
+ * @returns Statistics with counts per status, last activity time, and engine details.
869
1188
  */
870
1189
  stats(): Promise<AiSearchStatsResponse>;
871
1190
 
@@ -880,27 +1199,30 @@ export declare abstract class AiSearchInstance {
880
1199
  * Namespace-level AI Search service.
881
1200
  *
882
1201
  * Used as the type of \`env.AI_SEARCH\` (namespace binding via \`ai_search_namespaces\`).
883
- * Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
1202
+ * Scoped to a single namespace. Provides dynamic instance access, creation, deletion,
1203
+ * and multi-instance search/chat operations.
884
1204
  *
885
1205
  * @example
886
1206
  * \`\`\`ts
887
1207
  * // Access an instance within the namespace
888
1208
  * const blog = env.AI_SEARCH.get("blog");
889
- * const results = await blog.search({
890
- * messages: [{ role: "user", content: "How does caching work?" }],
891
- * });
1209
+ * const results = await blog.search({ query: "How does caching work?" });
892
1210
  *
893
1211
  * // List all instances in the namespace
894
1212
  * const instances = await env.AI_SEARCH.list();
895
1213
  *
896
1214
  * // Create a new instance with built-in storage
897
- * const tenant = await env.AI_SEARCH.create({
898
- * id: "tenant-123",
899
- * });
1215
+ * const tenant = await env.AI_SEARCH.create({ id: "tenant-123" });
900
1216
  *
901
1217
  * // Upload items into the instance
902
1218
  * await tenant.items.upload("doc.pdf", fileContent);
903
1219
  *
1220
+ * // Search across multiple instances
1221
+ * const multi = await env.AI_SEARCH.search({
1222
+ * query: "caching",
1223
+ * ai_search_options: { instance_ids: ["blog", "docs"] },
1224
+ * });
1225
+ *
904
1226
  * // Delete an instance
905
1227
  * await env.AI_SEARCH.delete("tenant-123");
906
1228
  * \`\`\`
@@ -914,10 +1236,11 @@ export declare abstract class AiSearchNamespace {
914
1236
  get(name: string): AiSearchInstance;
915
1237
 
916
1238
  /**
917
- * List all instances in the bound namespace.
918
- * @returns Array of instance metadata.
1239
+ * List instances in the bound namespace.
1240
+ * @param params Optional pagination, search, and ordering parameters.
1241
+ * @returns Array of instance metadata with pagination info.
919
1242
  */
920
- list(): Promise<AiSearchListResponse>;
1243
+ list(params?: AiSearchListInstancesParams): Promise<AiSearchListResponse>;
921
1244
 
922
1245
  /**
923
1246
  * Create a new instance within the bound namespace.
@@ -944,6 +1267,36 @@ export declare abstract class AiSearchNamespace {
944
1267
  * @param name Instance name to delete.
945
1268
  */
946
1269
  delete(name: string): Promise<void>;
1270
+
1271
+ /**
1272
+ * Search across multiple instances within the bound namespace.
1273
+ * Fans out to the specified instance_ids and merges results.
1274
+ * @param params Search request with required \`ai_search_options.instance_ids\`.
1275
+ * @returns Search response with chunks tagged by instance_id and optional partial-failure errors.
1276
+ */
1277
+ search(
1278
+ params: AiSearchMultiSearchRequest
1279
+ ): Promise<AiSearchMultiSearchResponse>;
1280
+
1281
+ /**
1282
+ * Generate chat completions across multiple instances within the bound namespace (streaming).
1283
+ * Fans out to the specified instance_ids, merges context, and generates a response.
1284
+ * @param params Chat completions request with stream: true and required \`ai_search_options.instance_ids\`.
1285
+ * @returns ReadableStream of server-sent events.
1286
+ */
1287
+ chatCompletions(
1288
+ params: AiSearchMultiChatCompletionsRequest & { stream: true }
1289
+ ): Promise<ReadableStream>;
1290
+
1291
+ /**
1292
+ * Generate chat completions across multiple instances within the bound namespace.
1293
+ * Fans out to the specified instance_ids, merges context, and generates a response.
1294
+ * @param params Chat completions request with required \`ai_search_options.instance_ids\`.
1295
+ * @returns Chat completion response with choices, chunks tagged by instance_id, and optional partial-failure errors.
1296
+ */
1297
+ chatCompletions(
1298
+ params: AiSearchMultiChatCompletionsRequest
1299
+ ): Promise<AiSearchMultiChatCompletionsResponse>;
947
1300
  }
948
1301
 
949
1302
  export type AiImageClassificationInput = {
@@ -8594,9 +8947,12 @@ declare module "cloudflare:email" {
8594
8947
  * Evaluation context for targeting rules.
8595
8948
  * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
8596
8949
  */
8597
- export type EvaluationContext = Record<string, string | number | boolean>;
8950
+ export type FlagshipEvaluationContext = Record<
8951
+ string,
8952
+ string | number | boolean
8953
+ >;
8598
8954
 
8599
- export interface EvaluationDetails<T> {
8955
+ export interface FlagshipEvaluationDetails<T> {
8600
8956
  flagKey: string;
8601
8957
  value: T;
8602
8958
  variant?: string | undefined;
@@ -8605,7 +8961,7 @@ export interface EvaluationDetails<T> {
8605
8961
  errorMessage?: string | undefined;
8606
8962
  }
8607
8963
 
8608
- export interface FlagEvaluationError extends Error {}
8964
+ export interface FlagshipEvaluationError extends Error {}
8609
8965
 
8610
8966
  /**
8611
8967
  * Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
@@ -8626,7 +8982,7 @@ export interface FlagEvaluationError extends Error {}
8626
8982
  * console.log(details.variant, details.reason);
8627
8983
  * \`\`\`
8628
8984
  */
8629
- export declare abstract class Flags {
8985
+ export declare abstract class Flagship {
8630
8986
  /**
8631
8987
  * Get a flag value without type checking.
8632
8988
  * @param flagKey The key of the flag to evaluate.
@@ -8636,7 +8992,7 @@ export declare abstract class Flags {
8636
8992
  get(
8637
8993
  flagKey: string,
8638
8994
  defaultValue?: unknown,
8639
- context?: EvaluationContext
8995
+ context?: FlagshipEvaluationContext
8640
8996
  ): Promise<unknown>;
8641
8997
 
8642
8998
  /**
@@ -8648,7 +9004,7 @@ export declare abstract class Flags {
8648
9004
  getBooleanValue(
8649
9005
  flagKey: string,
8650
9006
  defaultValue: boolean,
8651
- context?: EvaluationContext
9007
+ context?: FlagshipEvaluationContext
8652
9008
  ): Promise<boolean>;
8653
9009
 
8654
9010
  /**
@@ -8660,7 +9016,7 @@ export declare abstract class Flags {
8660
9016
  getStringValue(
8661
9017
  flagKey: string,
8662
9018
  defaultValue: string,
8663
- context?: EvaluationContext
9019
+ context?: FlagshipEvaluationContext
8664
9020
  ): Promise<string>;
8665
9021
 
8666
9022
  /**
@@ -8672,7 +9028,7 @@ export declare abstract class Flags {
8672
9028
  getNumberValue(
8673
9029
  flagKey: string,
8674
9030
  defaultValue: number,
8675
- context?: EvaluationContext
9031
+ context?: FlagshipEvaluationContext
8676
9032
  ): Promise<number>;
8677
9033
 
8678
9034
  /**
@@ -8684,7 +9040,7 @@ export declare abstract class Flags {
8684
9040
  getObjectValue<T extends object>(
8685
9041
  flagKey: string,
8686
9042
  defaultValue: T,
8687
- context?: EvaluationContext
9043
+ context?: FlagshipEvaluationContext
8688
9044
  ): Promise<T>;
8689
9045
 
8690
9046
  /**
@@ -8696,8 +9052,8 @@ export declare abstract class Flags {
8696
9052
  getBooleanDetails(
8697
9053
  flagKey: string,
8698
9054
  defaultValue: boolean,
8699
- context?: EvaluationContext
8700
- ): Promise<EvaluationDetails<boolean>>;
9055
+ context?: FlagshipEvaluationContext
9056
+ ): Promise<FlagshipEvaluationDetails<boolean>>;
8701
9057
 
8702
9058
  /**
8703
9059
  * Get a string flag value with full evaluation details.
@@ -8708,8 +9064,8 @@ export declare abstract class Flags {
8708
9064
  getStringDetails(
8709
9065
  flagKey: string,
8710
9066
  defaultValue: string,
8711
- context?: EvaluationContext
8712
- ): Promise<EvaluationDetails<string>>;
9067
+ context?: FlagshipEvaluationContext
9068
+ ): Promise<FlagshipEvaluationDetails<string>>;
8713
9069
 
8714
9070
  /**
8715
9071
  * Get a number flag value with full evaluation details.
@@ -8720,8 +9076,8 @@ export declare abstract class Flags {
8720
9076
  getNumberDetails(
8721
9077
  flagKey: string,
8722
9078
  defaultValue: number,
8723
- context?: EvaluationContext
8724
- ): Promise<EvaluationDetails<number>>;
9079
+ context?: FlagshipEvaluationContext
9080
+ ): Promise<FlagshipEvaluationDetails<number>>;
8725
9081
 
8726
9082
  /**
8727
9083
  * Get an object flag value with full evaluation details.
@@ -8732,8 +9088,8 @@ export declare abstract class Flags {
8732
9088
  getObjectDetails<T extends object>(
8733
9089
  flagKey: string,
8734
9090
  defaultValue: T,
8735
- context?: EvaluationContext
8736
- ): Promise<EvaluationDetails<T>>;
9091
+ context?: FlagshipEvaluationContext
9092
+ ): Promise<FlagshipEvaluationDetails<T>>;
8737
9093
  }
8738
9094
 
8739
9095
  /**