@cloudflare/workers-types 5.20260923.1 → 5.20260925.1

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.
@@ -532,7 +532,10 @@ type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
532
532
  event: TailStream.TailEvent<TailStream.Onset>,
533
533
  env: Env,
534
534
  ctx: ExecutionContext<Props>,
535
- ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
535
+ ) =>
536
+ | TailStream.TailEventHandlerType
537
+ | undefined
538
+ | Promise<TailStream.TailEventHandlerType | undefined>;
536
539
  type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
537
540
  controller: ScheduledController,
538
541
  env: Env,
@@ -1752,7 +1755,7 @@ interface MessageEventInit {
1752
1755
  data?: any;
1753
1756
  origin?: string;
1754
1757
  lastEventId?: string;
1755
- source?: MessagePort;
1758
+ source?: MessagePort | null;
1756
1759
  ports?: MessagePort[];
1757
1760
  }
1758
1761
  /**
@@ -4886,8 +4889,15 @@ declare abstract class Span {
4886
4889
  stack?: string;
4887
4890
  },
4888
4891
  ): void;
4892
+ updateName(name: string): this;
4893
+ setStatus(status: TracingSpanStatus): this;
4889
4894
  end(): void;
4890
4895
  }
4896
+ type TracingSpanStatusCode = "unset" | "ok" | "error";
4897
+ interface TracingSpanStatus {
4898
+ code: TracingSpanStatusCode;
4899
+ message?: string;
4900
+ }
4891
4901
  /**
4892
4902
  * Represents the identity of a user authenticated via Cloudflare Access.
4893
4903
  * This matches the result of calling /cdn-cgi/access/get-identity.
@@ -12135,9 +12145,22 @@ type AiModelListType = Record<string, any>;
12135
12145
  type AiAsyncBatchResponse = {
12136
12146
  request_id: string;
12137
12147
  };
12148
+ type AiWebSearchRequest = {
12149
+ /** AI Gateway configuration used for this request. */
12150
+ gatewayId: string;
12151
+ /** Search query. */
12152
+ query: string;
12153
+ /** Maximum number of results. Defaults to 10 and is capped at 20. */
12154
+ limit?: number;
12155
+ /** Optional BYOK web-search provider configured on the gateway. */
12156
+ provider?: string;
12157
+ /** Optional BYOK key alias. Defaults to `default`. */
12158
+ byokAlias?: string;
12159
+ };
12138
12160
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
12139
12161
  aiGatewayLogId: string | null;
12140
12162
  gateway(gatewayId: string): AiGateway;
12163
+ websearch(request: AiWebSearchRequest): Promise<Response>;
12141
12164
  /**
12142
12165
  * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
12143
12166
  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
@@ -16196,7 +16219,8 @@ declare namespace CloudflareWorkersModule {
16196
16219
  event: TailStream.TailEvent<TailStream.Onset>,
16197
16220
  ):
16198
16221
  | TailStream.TailEventHandlerType
16199
- | Promise<TailStream.TailEventHandlerType>;
16222
+ | undefined
16223
+ | Promise<TailStream.TailEventHandlerType | undefined>;
16200
16224
  test?(controller: TestController): void | Promise<void>;
16201
16225
  trace?(traces: TraceItem[]): void | Promise<void>;
16202
16226
  }
@@ -17377,6 +17401,12 @@ declare namespace TailStream {
17377
17401
  readonly cpuTime: number;
17378
17402
  readonly wallTime: number;
17379
17403
  }
17404
+ type SpanStatusCode = "unset" | "ok" | "error";
17405
+ interface SpanStatus {
17406
+ readonly code: SpanStatusCode;
17407
+ /** A developer-facing error message, present only when code is "error". */
17408
+ readonly message?: string;
17409
+ }
17380
17410
  interface SpanOpen {
17381
17411
  readonly type: "spanOpen";
17382
17412
  readonly name: string;
@@ -17388,6 +17418,19 @@ declare namespace TailStream {
17388
17418
  readonly type: "spanClose";
17389
17419
  readonly outcome: EventOutcome;
17390
17420
  }
17421
+ type SpanUpdateInfo =
17422
+ | {
17423
+ readonly type: "name";
17424
+ readonly name: string;
17425
+ }
17426
+ | {
17427
+ readonly type: "status";
17428
+ readonly status: SpanStatus;
17429
+ };
17430
+ interface SpanUpdate {
17431
+ readonly type: "spanUpdate";
17432
+ readonly info: SpanUpdateInfo;
17433
+ }
17391
17434
  interface DiagnosticChannelEvent {
17392
17435
  readonly type: "diagnosticChannel";
17393
17436
  readonly channel: string;
@@ -17457,6 +17500,7 @@ declare namespace TailStream {
17457
17500
  | Outcome
17458
17501
  | SpanOpen
17459
17502
  | SpanClose
17503
+ | SpanUpdate
17460
17504
  | DiagnosticChannelEvent
17461
17505
  | Exception
17462
17506
  | Log
@@ -17499,6 +17543,7 @@ declare namespace TailStream {
17499
17543
  outcome?: TailEventHandler<Outcome>;
17500
17544
  spanOpen?: TailEventHandler<SpanOpen>;
17501
17545
  spanClose?: TailEventHandler<SpanClose>;
17546
+ spanUpdate?: TailEventHandler<SpanUpdate>;
17502
17547
  diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;
17503
17548
  exception?: TailEventHandler<Exception>;
17504
17549
  log?: TailEventHandler<Log>;
@@ -534,7 +534,10 @@ export type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
534
534
  event: TailStream.TailEvent<TailStream.Onset>,
535
535
  env: Env,
536
536
  ctx: ExecutionContext<Props>,
537
- ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
537
+ ) =>
538
+ | TailStream.TailEventHandlerType
539
+ | undefined
540
+ | Promise<TailStream.TailEventHandlerType | undefined>;
538
541
  export type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
539
542
  controller: ScheduledController,
540
543
  env: Env,
@@ -1756,7 +1759,7 @@ export interface MessageEventInit {
1756
1759
  data?: any;
1757
1760
  origin?: string;
1758
1761
  lastEventId?: string;
1759
- source?: MessagePort;
1762
+ source?: MessagePort | null;
1760
1763
  ports?: MessagePort[];
1761
1764
  }
1762
1765
  /**
@@ -4895,8 +4898,15 @@ export declare abstract class Span {
4895
4898
  stack?: string;
4896
4899
  },
4897
4900
  ): void;
4901
+ updateName(name: string): this;
4902
+ setStatus(status: TracingSpanStatus): this;
4898
4903
  end(): void;
4899
4904
  }
4905
+ export type TracingSpanStatusCode = "unset" | "ok" | "error";
4906
+ export interface TracingSpanStatus {
4907
+ code: TracingSpanStatusCode;
4908
+ message?: string;
4909
+ }
4900
4910
  /**
4901
4911
  * Represents the identity of a user authenticated via Cloudflare Access.
4902
4912
  * This matches the result of calling /cdn-cgi/access/get-identity.
@@ -12147,11 +12157,24 @@ export type AiModelListType = Record<string, any>;
12147
12157
  export type AiAsyncBatchResponse = {
12148
12158
  request_id: string;
12149
12159
  };
12160
+ export type AiWebSearchRequest = {
12161
+ /** AI Gateway configuration used for this request. */
12162
+ gatewayId: string;
12163
+ /** Search query. */
12164
+ query: string;
12165
+ /** Maximum number of results. Defaults to 10 and is capped at 20. */
12166
+ limit?: number;
12167
+ /** Optional BYOK web-search provider configured on the gateway. */
12168
+ provider?: string;
12169
+ /** Optional BYOK key alias. Defaults to `default`. */
12170
+ byokAlias?: string;
12171
+ };
12150
12172
  export declare abstract class Ai<
12151
12173
  AiModelList extends AiModelListType = AiModels,
12152
12174
  > {
12153
12175
  aiGatewayLogId: string | null;
12154
12176
  gateway(gatewayId: string): AiGateway;
12177
+ websearch(request: AiWebSearchRequest): Promise<Response>;
12155
12178
  /**
12156
12179
  * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
12157
12180
  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
@@ -16137,7 +16160,8 @@ export declare namespace CloudflareWorkersModule {
16137
16160
  event: TailStream.TailEvent<TailStream.Onset>,
16138
16161
  ):
16139
16162
  | TailStream.TailEventHandlerType
16140
- | Promise<TailStream.TailEventHandlerType>;
16163
+ | undefined
16164
+ | Promise<TailStream.TailEventHandlerType | undefined>;
16141
16165
  test?(controller: TestController): void | Promise<void>;
16142
16166
  trace?(traces: TraceItem[]): void | Promise<void>;
16143
16167
  }
@@ -17308,6 +17332,12 @@ export declare namespace TailStream {
17308
17332
  readonly cpuTime: number;
17309
17333
  readonly wallTime: number;
17310
17334
  }
17335
+ type SpanStatusCode = "unset" | "ok" | "error";
17336
+ interface SpanStatus {
17337
+ readonly code: SpanStatusCode;
17338
+ /** A developer-facing error message, present only when code is "error". */
17339
+ readonly message?: string;
17340
+ }
17311
17341
  interface SpanOpen {
17312
17342
  readonly type: "spanOpen";
17313
17343
  readonly name: string;
@@ -17319,6 +17349,19 @@ export declare namespace TailStream {
17319
17349
  readonly type: "spanClose";
17320
17350
  readonly outcome: EventOutcome;
17321
17351
  }
17352
+ type SpanUpdateInfo =
17353
+ | {
17354
+ readonly type: "name";
17355
+ readonly name: string;
17356
+ }
17357
+ | {
17358
+ readonly type: "status";
17359
+ readonly status: SpanStatus;
17360
+ };
17361
+ interface SpanUpdate {
17362
+ readonly type: "spanUpdate";
17363
+ readonly info: SpanUpdateInfo;
17364
+ }
17322
17365
  interface DiagnosticChannelEvent {
17323
17366
  readonly type: "diagnosticChannel";
17324
17367
  readonly channel: string;
@@ -17388,6 +17431,7 @@ export declare namespace TailStream {
17388
17431
  | Outcome
17389
17432
  | SpanOpen
17390
17433
  | SpanClose
17434
+ | SpanUpdate
17391
17435
  | DiagnosticChannelEvent
17392
17436
  | Exception
17393
17437
  | Log
@@ -17430,6 +17474,7 @@ export declare namespace TailStream {
17430
17474
  outcome?: TailEventHandler<Outcome>;
17431
17475
  spanOpen?: TailEventHandler<SpanOpen>;
17432
17476
  spanClose?: TailEventHandler<SpanClose>;
17477
+ spanUpdate?: TailEventHandler<SpanUpdate>;
17433
17478
  diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;
17434
17479
  exception?: TailEventHandler<Exception>;
17435
17480
  log?: TailEventHandler<Log>;
package/index.d.ts CHANGED
@@ -531,7 +531,10 @@ type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
531
531
  event: TailStream.TailEvent<TailStream.Onset>,
532
532
  env: Env,
533
533
  ctx: ExecutionContext<Props>,
534
- ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
534
+ ) =>
535
+ | TailStream.TailEventHandlerType
536
+ | undefined
537
+ | Promise<TailStream.TailEventHandlerType | undefined>;
535
538
  type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
536
539
  controller: ScheduledController,
537
540
  env: Env,
@@ -1726,7 +1729,7 @@ interface MessageEventInit {
1726
1729
  data?: any;
1727
1730
  origin?: string;
1728
1731
  lastEventId?: string;
1729
- source?: MessagePort;
1732
+ source?: MessagePort | null;
1730
1733
  ports?: MessagePort[];
1731
1734
  }
1732
1735
  /**
@@ -4603,8 +4606,15 @@ declare abstract class Span {
4603
4606
  stack?: string;
4604
4607
  },
4605
4608
  ): void;
4609
+ updateName(name: string): this;
4610
+ setStatus(status: TracingSpanStatus): this;
4606
4611
  end(): void;
4607
4612
  }
4613
+ type TracingSpanStatusCode = "unset" | "ok" | "error";
4614
+ interface TracingSpanStatus {
4615
+ code: TracingSpanStatusCode;
4616
+ message?: string;
4617
+ }
4608
4618
  /**
4609
4619
  * Represents the identity of a user authenticated via Cloudflare Access.
4610
4620
  * This matches the result of calling /cdn-cgi/access/get-identity.
@@ -11852,9 +11862,22 @@ type AiModelListType = Record<string, any>;
11852
11862
  type AiAsyncBatchResponse = {
11853
11863
  request_id: string;
11854
11864
  };
11865
+ type AiWebSearchRequest = {
11866
+ /** AI Gateway configuration used for this request. */
11867
+ gatewayId: string;
11868
+ /** Search query. */
11869
+ query: string;
11870
+ /** Maximum number of results. Defaults to 10 and is capped at 20. */
11871
+ limit?: number;
11872
+ /** Optional BYOK web-search provider configured on the gateway. */
11873
+ provider?: string;
11874
+ /** Optional BYOK key alias. Defaults to `default`. */
11875
+ byokAlias?: string;
11876
+ };
11855
11877
  declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
11856
11878
  aiGatewayLogId: string | null;
11857
11879
  gateway(gatewayId: string): AiGateway;
11880
+ websearch(request: AiWebSearchRequest): Promise<Response>;
11858
11881
  /**
11859
11882
  * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
11860
11883
  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
@@ -15913,7 +15936,8 @@ declare namespace CloudflareWorkersModule {
15913
15936
  event: TailStream.TailEvent<TailStream.Onset>,
15914
15937
  ):
15915
15938
  | TailStream.TailEventHandlerType
15916
- | Promise<TailStream.TailEventHandlerType>;
15939
+ | undefined
15940
+ | Promise<TailStream.TailEventHandlerType | undefined>;
15917
15941
  test?(controller: TestController): void | Promise<void>;
15918
15942
  trace?(traces: TraceItem[]): void | Promise<void>;
15919
15943
  }
@@ -17094,6 +17118,12 @@ declare namespace TailStream {
17094
17118
  readonly cpuTime: number;
17095
17119
  readonly wallTime: number;
17096
17120
  }
17121
+ type SpanStatusCode = "unset" | "ok" | "error";
17122
+ interface SpanStatus {
17123
+ readonly code: SpanStatusCode;
17124
+ /** A developer-facing error message, present only when code is "error". */
17125
+ readonly message?: string;
17126
+ }
17097
17127
  interface SpanOpen {
17098
17128
  readonly type: "spanOpen";
17099
17129
  readonly name: string;
@@ -17105,6 +17135,19 @@ declare namespace TailStream {
17105
17135
  readonly type: "spanClose";
17106
17136
  readonly outcome: EventOutcome;
17107
17137
  }
17138
+ type SpanUpdateInfo =
17139
+ | {
17140
+ readonly type: "name";
17141
+ readonly name: string;
17142
+ }
17143
+ | {
17144
+ readonly type: "status";
17145
+ readonly status: SpanStatus;
17146
+ };
17147
+ interface SpanUpdate {
17148
+ readonly type: "spanUpdate";
17149
+ readonly info: SpanUpdateInfo;
17150
+ }
17108
17151
  interface DiagnosticChannelEvent {
17109
17152
  readonly type: "diagnosticChannel";
17110
17153
  readonly channel: string;
@@ -17174,6 +17217,7 @@ declare namespace TailStream {
17174
17217
  | Outcome
17175
17218
  | SpanOpen
17176
17219
  | SpanClose
17220
+ | SpanUpdate
17177
17221
  | DiagnosticChannelEvent
17178
17222
  | Exception
17179
17223
  | Log
@@ -17216,6 +17260,7 @@ declare namespace TailStream {
17216
17260
  outcome?: TailEventHandler<Outcome>;
17217
17261
  spanOpen?: TailEventHandler<SpanOpen>;
17218
17262
  spanClose?: TailEventHandler<SpanClose>;
17263
+ spanUpdate?: TailEventHandler<SpanUpdate>;
17219
17264
  diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;
17220
17265
  exception?: TailEventHandler<Exception>;
17221
17266
  log?: TailEventHandler<Log>;
package/index.ts CHANGED
@@ -533,7 +533,10 @@ export type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
533
533
  event: TailStream.TailEvent<TailStream.Onset>,
534
534
  env: Env,
535
535
  ctx: ExecutionContext<Props>,
536
- ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
536
+ ) =>
537
+ | TailStream.TailEventHandlerType
538
+ | undefined
539
+ | Promise<TailStream.TailEventHandlerType | undefined>;
537
540
  export type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
538
541
  controller: ScheduledController,
539
542
  env: Env,
@@ -1730,7 +1733,7 @@ export interface MessageEventInit {
1730
1733
  data?: any;
1731
1734
  origin?: string;
1732
1735
  lastEventId?: string;
1733
- source?: MessagePort;
1736
+ source?: MessagePort | null;
1734
1737
  ports?: MessagePort[];
1735
1738
  }
1736
1739
  /**
@@ -4612,8 +4615,15 @@ export declare abstract class Span {
4612
4615
  stack?: string;
4613
4616
  },
4614
4617
  ): void;
4618
+ updateName(name: string): this;
4619
+ setStatus(status: TracingSpanStatus): this;
4615
4620
  end(): void;
4616
4621
  }
4622
+ export type TracingSpanStatusCode = "unset" | "ok" | "error";
4623
+ export interface TracingSpanStatus {
4624
+ code: TracingSpanStatusCode;
4625
+ message?: string;
4626
+ }
4617
4627
  /**
4618
4628
  * Represents the identity of a user authenticated via Cloudflare Access.
4619
4629
  * This matches the result of calling /cdn-cgi/access/get-identity.
@@ -11864,11 +11874,24 @@ export type AiModelListType = Record<string, any>;
11864
11874
  export type AiAsyncBatchResponse = {
11865
11875
  request_id: string;
11866
11876
  };
11877
+ export type AiWebSearchRequest = {
11878
+ /** AI Gateway configuration used for this request. */
11879
+ gatewayId: string;
11880
+ /** Search query. */
11881
+ query: string;
11882
+ /** Maximum number of results. Defaults to 10 and is capped at 20. */
11883
+ limit?: number;
11884
+ /** Optional BYOK web-search provider configured on the gateway. */
11885
+ provider?: string;
11886
+ /** Optional BYOK key alias. Defaults to `default`. */
11887
+ byokAlias?: string;
11888
+ };
11867
11889
  export declare abstract class Ai<
11868
11890
  AiModelList extends AiModelListType = AiModels,
11869
11891
  > {
11870
11892
  aiGatewayLogId: string | null;
11871
11893
  gateway(gatewayId: string): AiGateway;
11894
+ websearch(request: AiWebSearchRequest): Promise<Response>;
11872
11895
  /**
11873
11896
  * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
11874
11897
  * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
@@ -15854,7 +15877,8 @@ export declare namespace CloudflareWorkersModule {
15854
15877
  event: TailStream.TailEvent<TailStream.Onset>,
15855
15878
  ):
15856
15879
  | TailStream.TailEventHandlerType
15857
- | Promise<TailStream.TailEventHandlerType>;
15880
+ | undefined
15881
+ | Promise<TailStream.TailEventHandlerType | undefined>;
15858
15882
  test?(controller: TestController): void | Promise<void>;
15859
15883
  trace?(traces: TraceItem[]): void | Promise<void>;
15860
15884
  }
@@ -17025,6 +17049,12 @@ export declare namespace TailStream {
17025
17049
  readonly cpuTime: number;
17026
17050
  readonly wallTime: number;
17027
17051
  }
17052
+ type SpanStatusCode = "unset" | "ok" | "error";
17053
+ interface SpanStatus {
17054
+ readonly code: SpanStatusCode;
17055
+ /** A developer-facing error message, present only when code is "error". */
17056
+ readonly message?: string;
17057
+ }
17028
17058
  interface SpanOpen {
17029
17059
  readonly type: "spanOpen";
17030
17060
  readonly name: string;
@@ -17036,6 +17066,19 @@ export declare namespace TailStream {
17036
17066
  readonly type: "spanClose";
17037
17067
  readonly outcome: EventOutcome;
17038
17068
  }
17069
+ type SpanUpdateInfo =
17070
+ | {
17071
+ readonly type: "name";
17072
+ readonly name: string;
17073
+ }
17074
+ | {
17075
+ readonly type: "status";
17076
+ readonly status: SpanStatus;
17077
+ };
17078
+ interface SpanUpdate {
17079
+ readonly type: "spanUpdate";
17080
+ readonly info: SpanUpdateInfo;
17081
+ }
17039
17082
  interface DiagnosticChannelEvent {
17040
17083
  readonly type: "diagnosticChannel";
17041
17084
  readonly channel: string;
@@ -17105,6 +17148,7 @@ export declare namespace TailStream {
17105
17148
  | Outcome
17106
17149
  | SpanOpen
17107
17150
  | SpanClose
17151
+ | SpanUpdate
17108
17152
  | DiagnosticChannelEvent
17109
17153
  | Exception
17110
17154
  | Log
@@ -17147,6 +17191,7 @@ export declare namespace TailStream {
17147
17191
  outcome?: TailEventHandler<Outcome>;
17148
17192
  spanOpen?: TailEventHandler<SpanOpen>;
17149
17193
  spanClose?: TailEventHandler<SpanClose>;
17194
+ spanUpdate?: TailEventHandler<SpanUpdate>;
17150
17195
  diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;
17151
17196
  exception?: TailEventHandler<Exception>;
17152
17197
  log?: TailEventHandler<Log>;
package/package.json CHANGED
@@ -7,5 +7,5 @@
7
7
  },
8
8
  "author": "Cloudflare Workers DevProd Team <workers-devprod@cloudflare.com> (https://workers.cloudflare.com)",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "5.20260923.1"
10
+ "version": "5.20260925.1"
11
11
  }