@opentiny/next-sdk 0.2.4 → 0.2.6

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.
@@ -11325,17 +11325,14 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
11325
11325
  var _a92;
11326
11326
  const resolvedHeaders = await resolve$1(this.config.headers());
11327
11327
  try {
11328
- const {
11329
- responseHeaders,
11330
- value: responseBody,
11331
- rawValue
11332
- } = await postJsonToApi$1({
11328
+ const { responseHeaders, value: responseBody } = await postJsonToApi$1({
11333
11329
  url: this.getUrl(),
11334
11330
  headers: combineHeaders$1(
11335
11331
  resolvedHeaders,
11336
11332
  headers != null ? headers : {},
11337
11333
  this.getModelConfigHeaders(),
11338
- await resolve$1(this.config.o11yHeaders)
11334
+ await resolve$1(this.config.o11yHeaders),
11335
+ { accept: "text/event-stream" }
11339
11336
  ),
11340
11337
  body: {
11341
11338
  prompt,
@@ -11348,9 +11345,70 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
11348
11345
  ...providerOptions && { providerOptions },
11349
11346
  ...image && { image: maybeEncodeVideoFile(image) }
11350
11347
  },
11351
- successfulResponseHandler: createJsonResponseHandler$1(
11352
- gatewayVideoResponseSchema
11353
- ),
11348
+ successfulResponseHandler: async ({
11349
+ response,
11350
+ url: url2,
11351
+ requestBodyValues
11352
+ }) => {
11353
+ if (response.body == null) {
11354
+ throw new APICallError$1({
11355
+ message: "SSE response body is empty",
11356
+ url: url2,
11357
+ requestBodyValues,
11358
+ statusCode: response.status
11359
+ });
11360
+ }
11361
+ const eventStream = parseJsonEventStream$1({
11362
+ stream: response.body,
11363
+ schema: gatewayVideoEventSchema
11364
+ });
11365
+ const reader = eventStream.getReader();
11366
+ const { done, value: parseResult } = await reader.read();
11367
+ reader.releaseLock();
11368
+ if (done || !parseResult) {
11369
+ throw new APICallError$1({
11370
+ message: "SSE stream ended without a data event",
11371
+ url: url2,
11372
+ requestBodyValues,
11373
+ statusCode: response.status
11374
+ });
11375
+ }
11376
+ if (!parseResult.success) {
11377
+ throw new APICallError$1({
11378
+ message: "Failed to parse video SSE event",
11379
+ cause: parseResult.error,
11380
+ url: url2,
11381
+ requestBodyValues,
11382
+ statusCode: response.status
11383
+ });
11384
+ }
11385
+ const event = parseResult.value;
11386
+ if (event.type === "error") {
11387
+ throw new APICallError$1({
11388
+ message: event.message,
11389
+ statusCode: event.statusCode,
11390
+ url: url2,
11391
+ requestBodyValues,
11392
+ responseHeaders: Object.fromEntries([...response.headers]),
11393
+ responseBody: JSON.stringify(event),
11394
+ data: {
11395
+ error: {
11396
+ message: event.message,
11397
+ type: event.errorType,
11398
+ param: event.param
11399
+ }
11400
+ }
11401
+ });
11402
+ }
11403
+ return {
11404
+ value: {
11405
+ videos: event.videos,
11406
+ warnings: event.warnings,
11407
+ providerMetadata: event.providerMetadata
11408
+ },
11409
+ responseHeaders: Object.fromEntries([...response.headers])
11410
+ };
11411
+ },
11354
11412
  failedResponseHandler: createJsonErrorResponseHandler$1({
11355
11413
  errorSchema: any(),
11356
11414
  errorToMessage: (data) => data
@@ -11422,11 +11480,21 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
11422
11480
  message: string()
11423
11481
  })
11424
11482
  ]);
11425
- var gatewayVideoResponseSchema = object$1({
11426
- videos: array$1(gatewayVideoDataSchema),
11427
- warnings: array$1(gatewayVideoWarningSchema).optional(),
11428
- providerMetadata: record(string(), providerMetadataEntrySchema2).optional()
11429
- });
11483
+ var gatewayVideoEventSchema = discriminatedUnion("type", [
11484
+ object$1({
11485
+ type: literal("result"),
11486
+ videos: array$1(gatewayVideoDataSchema),
11487
+ warnings: array$1(gatewayVideoWarningSchema).optional(),
11488
+ providerMetadata: record(string(), providerMetadataEntrySchema2).optional()
11489
+ }),
11490
+ object$1({
11491
+ type: literal("error"),
11492
+ message: string(),
11493
+ errorType: string(),
11494
+ statusCode: number$1(),
11495
+ param: unknown().nullable()
11496
+ })
11497
+ ]);
11430
11498
  var parallelSearchInputSchema = lazySchema(
11431
11499
  () => zodSchema(
11432
11500
  objectType({
@@ -11603,7 +11671,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
11603
11671
  var _a92;
11604
11672
  return (_a92 = indexBrowserExports.getContext().headers) == null ? void 0 : _a92["x-vercel-id"];
11605
11673
  }
11606
- var VERSION$6 = "3.0.45";
11674
+ var VERSION$6 = "3.0.58";
11607
11675
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
11608
11676
  function createGatewayProvider(options = {}) {
11609
11677
  var _a92, _b9;
@@ -11646,13 +11714,18 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
11646
11714
  settingValue: void 0,
11647
11715
  environmentVariableName: "VERCEL_REGION"
11648
11716
  });
11717
+ const projectId = loadOptionalSetting({
11718
+ settingValue: void 0,
11719
+ environmentVariableName: "VERCEL_PROJECT_ID"
11720
+ });
11649
11721
  return async () => {
11650
11722
  const requestId = await getVercelRequestId();
11651
11723
  return {
11652
11724
  ...deploymentId && { "ai-o11y-deployment-id": deploymentId },
11653
11725
  ...environment && { "ai-o11y-environment": environment },
11654
11726
  ...region && { "ai-o11y-region": region },
11655
- ...requestId && { "ai-o11y-request-id": requestId }
11727
+ ...requestId && { "ai-o11y-request-id": requestId },
11728
+ ...projectId && { "ai-o11y-project-id": projectId }
11656
11729
  };
11657
11730
  };
11658
11731
  };
@@ -13120,6 +13193,17 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
13120
13193
  }
13121
13194
  };
13122
13195
  _a19 = symbol19;
13196
+ function asArray(value) {
13197
+ return value === void 0 ? [] : Array.isArray(value) ? value : [value];
13198
+ }
13199
+ async function notify(options) {
13200
+ for (const callback of asArray(options.callbacks)) {
13201
+ try {
13202
+ await callback(options.event);
13203
+ } catch (_ignored) {
13204
+ }
13205
+ }
13206
+ }
13123
13207
  function formatWarning({
13124
13208
  warning,
13125
13209
  provider,
@@ -13420,7 +13504,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
13420
13504
  }
13421
13505
  return void 0;
13422
13506
  }
13423
- var VERSION$4 = "6.0.85";
13507
+ var VERSION$4 = "6.0.104";
13424
13508
  var download = async ({
13425
13509
  url: url2,
13426
13510
  maxBytes,
@@ -13528,9 +13612,6 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
13528
13612
  }
13529
13613
  return convertUint8ArrayToBase64$1(content);
13530
13614
  }
13531
- function asArray(value) {
13532
- return value === void 0 ? [] : Array.isArray(value) ? value : [value];
13533
- }
13534
13615
  async function convertToLanguageModelPrompt({
13535
13616
  prompt,
13536
13617
  supportedUrls,
@@ -14845,6 +14926,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
14845
14926
  }
14846
14927
  return { approvedToolApprovals, deniedToolApprovals };
14847
14928
  }
14929
+ function now() {
14930
+ var _a21, _b9;
14931
+ return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
14932
+ }
14848
14933
  async function executeToolCall({
14849
14934
  toolCall,
14850
14935
  tools,
@@ -14853,13 +14938,27 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
14853
14938
  messages,
14854
14939
  abortSignal,
14855
14940
  experimental_context,
14856
- onPreliminaryToolResult
14941
+ stepNumber,
14942
+ model,
14943
+ onPreliminaryToolResult,
14944
+ onToolCallStart,
14945
+ onToolCallFinish
14857
14946
  }) {
14858
14947
  const { toolName, toolCallId, input } = toolCall;
14859
14948
  const tool2 = tools == null ? void 0 : tools[toolName];
14860
14949
  if ((tool2 == null ? void 0 : tool2.execute) == null) {
14861
14950
  return void 0;
14862
14951
  }
14952
+ const baseCallbackEvent = {
14953
+ stepNumber,
14954
+ model,
14955
+ toolCall,
14956
+ messages,
14957
+ abortSignal,
14958
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
14959
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
14960
+ experimental_context
14961
+ };
14863
14962
  return recordSpan({
14864
14963
  name: "ai.toolCall",
14865
14964
  attributes: selectTelemetryAttributes({
@@ -14879,6 +14978,8 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
14879
14978
  tracer,
14880
14979
  fn: async (span) => {
14881
14980
  let output;
14981
+ await notify({ event: baseCallbackEvent, callbacks: onToolCallStart });
14982
+ const startTime = now();
14882
14983
  try {
14883
14984
  const stream = executeTool({
14884
14985
  execute: tool2.execute.bind(tool2),
@@ -14903,6 +15004,16 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
14903
15004
  }
14904
15005
  }
14905
15006
  } catch (error) {
15007
+ const durationMs2 = now() - startTime;
15008
+ await notify({
15009
+ event: {
15010
+ ...baseCallbackEvent,
15011
+ success: false,
15012
+ error,
15013
+ durationMs: durationMs2
15014
+ },
15015
+ callbacks: onToolCallFinish
15016
+ });
14906
15017
  recordErrorOnSpan(span, error);
14907
15018
  return {
14908
15019
  type: "tool-error",
@@ -14914,6 +15025,16 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
14914
15025
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
14915
15026
  };
14916
15027
  }
15028
+ const durationMs = now() - startTime;
15029
+ await notify({
15030
+ event: {
15031
+ ...baseCallbackEvent,
15032
+ success: true,
15033
+ output,
15034
+ durationMs
15035
+ },
15036
+ callbacks: onToolCallFinish
15037
+ });
14917
15038
  try {
14918
15039
  span.setAttributes(
14919
15040
  await selectTelemetryAttributes({
@@ -15777,6 +15898,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
15777
15898
  }
15778
15899
  var DefaultStepResult = class {
15779
15900
  constructor({
15901
+ stepNumber,
15902
+ model,
15903
+ functionId,
15904
+ metadata: metadata2,
15905
+ experimental_context,
15780
15906
  content,
15781
15907
  finishReason,
15782
15908
  rawFinishReason,
@@ -15786,6 +15912,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
15786
15912
  response,
15787
15913
  providerMetadata
15788
15914
  }) {
15915
+ this.stepNumber = stepNumber;
15916
+ this.model = model;
15917
+ this.functionId = functionId;
15918
+ this.metadata = metadata2;
15919
+ this.experimental_context = experimental_context;
15789
15920
  this.content = content;
15790
15921
  this.finishReason = finishReason;
15791
15922
  this.rawFinishReason = rawFinishReason;
@@ -16027,6 +16158,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16027
16158
  experimental_context,
16028
16159
  experimental_include: include,
16029
16160
  _internal: { generateId: generateId2 = originalGenerateId } = {},
16161
+ experimental_onStart: onStart,
16162
+ experimental_onStepStart: onStepStart,
16163
+ experimental_onToolCallStart: onToolCallStart,
16164
+ experimental_onToolCallFinish: onToolCallFinish,
16030
16165
  onStepFinish,
16031
16166
  onFinish,
16032
16167
  ...settings
@@ -16056,11 +16191,43 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16056
16191
  headers: headersWithUserAgent,
16057
16192
  settings: { ...callSettings, maxRetries }
16058
16193
  });
16194
+ const modelInfo = { provider: model.provider, modelId: model.modelId };
16059
16195
  const initialPrompt = await standardizePrompt({
16060
16196
  system,
16061
16197
  prompt,
16062
16198
  messages
16063
16199
  });
16200
+ await notify({
16201
+ event: {
16202
+ model: modelInfo,
16203
+ system,
16204
+ prompt,
16205
+ messages,
16206
+ tools,
16207
+ toolChoice,
16208
+ activeTools,
16209
+ maxOutputTokens: callSettings.maxOutputTokens,
16210
+ temperature: callSettings.temperature,
16211
+ topP: callSettings.topP,
16212
+ topK: callSettings.topK,
16213
+ presencePenalty: callSettings.presencePenalty,
16214
+ frequencyPenalty: callSettings.frequencyPenalty,
16215
+ stopSequences: callSettings.stopSequences,
16216
+ seed: callSettings.seed,
16217
+ maxRetries,
16218
+ timeout,
16219
+ headers,
16220
+ providerOptions,
16221
+ stopWhen,
16222
+ output,
16223
+ abortSignal,
16224
+ include,
16225
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
16226
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
16227
+ experimental_context
16228
+ },
16229
+ callbacks: onStart
16230
+ });
16064
16231
  const tracer = getTracer(telemetry);
16065
16232
  try {
16066
16233
  return await recordSpan({
@@ -16084,7 +16251,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16084
16251
  }),
16085
16252
  tracer,
16086
16253
  fn: async (span) => {
16087
- var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k;
16254
+ var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
16088
16255
  const initialMessages = initialPrompt.messages;
16089
16256
  const responseMessages = [];
16090
16257
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -16101,7 +16268,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16101
16268
  telemetry,
16102
16269
  messages: initialMessages,
16103
16270
  abortSignal: mergedAbortSignal,
16104
- experimental_context
16271
+ experimental_context,
16272
+ stepNumber: 0,
16273
+ model: modelInfo,
16274
+ onToolCallStart,
16275
+ onToolCallFinish
16105
16276
  });
16106
16277
  const toolContent = [];
16107
16278
  for (const output2 of toolOutputs) {
@@ -16181,6 +16352,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16181
16352
  const stepModel = resolveLanguageModel(
16182
16353
  (_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
16183
16354
  );
16355
+ const stepModelInfo = {
16356
+ provider: stepModel.provider,
16357
+ modelId: stepModel.modelId
16358
+ };
16184
16359
  const promptMessages = await convertToLanguageModelPrompt({
16185
16360
  prompt: {
16186
16361
  system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
@@ -16190,10 +16365,40 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16190
16365
  download: download2
16191
16366
  });
16192
16367
  experimental_context = (_d = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _d : experimental_context;
16368
+ const stepActiveTools = (_e = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _e : activeTools;
16193
16369
  const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
16194
16370
  tools,
16195
- toolChoice: (_e = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _e : toolChoice,
16196
- activeTools: (_f = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _f : activeTools
16371
+ toolChoice: (_f = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _f : toolChoice,
16372
+ activeTools: stepActiveTools
16373
+ });
16374
+ const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
16375
+ const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
16376
+ const stepProviderOptions = mergeObjects(
16377
+ providerOptions,
16378
+ prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
16379
+ );
16380
+ await notify({
16381
+ event: {
16382
+ stepNumber: steps.length,
16383
+ model: stepModelInfo,
16384
+ system: stepSystem,
16385
+ messages: stepMessages,
16386
+ tools,
16387
+ toolChoice: stepToolChoice,
16388
+ activeTools: stepActiveTools,
16389
+ steps: [...steps],
16390
+ providerOptions: stepProviderOptions,
16391
+ timeout,
16392
+ headers,
16393
+ stopWhen,
16394
+ output,
16395
+ abortSignal,
16396
+ include,
16397
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
16398
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
16399
+ experimental_context
16400
+ },
16401
+ callbacks: onStepStart
16197
16402
  });
16198
16403
  currentModelResponse = await retry(
16199
16404
  () => {
@@ -16237,10 +16442,6 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16237
16442
  tracer,
16238
16443
  fn: async (span2) => {
16239
16444
  var _a23, _b22, _c2, _d2, _e2, _f2, _g2, _h2;
16240
- const stepProviderOptions = mergeObjects(
16241
- providerOptions,
16242
- prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
16243
- );
16244
16445
  const result = await stepModel.doGenerate({
16245
16446
  ...callSettings2,
16246
16447
  tools: stepTools,
@@ -16372,7 +16573,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16372
16573
  telemetry,
16373
16574
  messages: stepInputMessages,
16374
16575
  abortSignal: mergedAbortSignal,
16375
- experimental_context
16576
+ experimental_context,
16577
+ stepNumber: steps.length,
16578
+ model: stepModelInfo,
16579
+ onToolCallStart,
16580
+ onToolCallFinish
16376
16581
  })
16377
16582
  );
16378
16583
  }
@@ -16409,15 +16614,21 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16409
16614
  tools
16410
16615
  })
16411
16616
  );
16412
- const stepRequest = ((_g = include == null ? void 0 : include.requestBody) != null ? _g : true) ? (_h = currentModelResponse.request) != null ? _h : {} : { ...currentModelResponse.request, body: void 0 };
16617
+ const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? (_j = currentModelResponse.request) != null ? _j : {} : { ...currentModelResponse.request, body: void 0 };
16413
16618
  const stepResponse = {
16414
16619
  ...currentModelResponse.response,
16415
16620
  // deep clone msgs to avoid mutating past messages in multi-step:
16416
16621
  messages: structuredClone(responseMessages),
16417
16622
  // Conditionally include response body:
16418
- body: ((_i = include == null ? void 0 : include.responseBody) != null ? _i : true) ? (_j = currentModelResponse.response) == null ? void 0 : _j.body : void 0
16623
+ body: ((_k = include == null ? void 0 : include.responseBody) != null ? _k : true) ? (_l = currentModelResponse.response) == null ? void 0 : _l.body : void 0
16419
16624
  };
16625
+ const stepNumber = steps.length;
16420
16626
  const currentStepResult = new DefaultStepResult({
16627
+ stepNumber,
16628
+ model: stepModelInfo,
16629
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
16630
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
16631
+ experimental_context,
16421
16632
  content: stepContent,
16422
16633
  finishReason: currentModelResponse.finishReason.unified,
16423
16634
  rawFinishReason: currentModelResponse.finishReason.raw,
@@ -16428,12 +16639,12 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16428
16639
  response: stepResponse
16429
16640
  });
16430
16641
  logWarnings({
16431
- warnings: (_k = currentModelResponse.warnings) != null ? _k : [],
16432
- provider: stepModel.provider,
16433
- model: stepModel.modelId
16642
+ warnings: (_m = currentModelResponse.warnings) != null ? _m : [],
16643
+ provider: stepModelInfo.provider,
16644
+ model: stepModelInfo.modelId
16434
16645
  });
16435
16646
  steps.push(currentStepResult);
16436
- await (onStepFinish == null ? void 0 : onStepFinish(currentStepResult));
16647
+ await notify({ event: currentStepResult, callbacks: onStepFinish });
16437
16648
  } finally {
16438
16649
  if (stepTimeoutId != null) {
16439
16650
  clearTimeout(stepTimeoutId);
@@ -16485,30 +16696,37 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16485
16696
  cachedInputTokens: void 0
16486
16697
  }
16487
16698
  );
16488
- await (onFinish == null ? void 0 : onFinish({
16489
- finishReason: lastStep.finishReason,
16490
- rawFinishReason: lastStep.rawFinishReason,
16491
- usage: lastStep.usage,
16492
- content: lastStep.content,
16493
- text: lastStep.text,
16494
- reasoningText: lastStep.reasoningText,
16495
- reasoning: lastStep.reasoning,
16496
- files: lastStep.files,
16497
- sources: lastStep.sources,
16498
- toolCalls: lastStep.toolCalls,
16499
- staticToolCalls: lastStep.staticToolCalls,
16500
- dynamicToolCalls: lastStep.dynamicToolCalls,
16501
- toolResults: lastStep.toolResults,
16502
- staticToolResults: lastStep.staticToolResults,
16503
- dynamicToolResults: lastStep.dynamicToolResults,
16504
- request: lastStep.request,
16505
- response: lastStep.response,
16506
- warnings: lastStep.warnings,
16507
- providerMetadata: lastStep.providerMetadata,
16508
- steps,
16509
- totalUsage,
16510
- experimental_context
16511
- }));
16699
+ await notify({
16700
+ event: {
16701
+ stepNumber: lastStep.stepNumber,
16702
+ model: lastStep.model,
16703
+ functionId: lastStep.functionId,
16704
+ metadata: lastStep.metadata,
16705
+ experimental_context: lastStep.experimental_context,
16706
+ finishReason: lastStep.finishReason,
16707
+ rawFinishReason: lastStep.rawFinishReason,
16708
+ usage: lastStep.usage,
16709
+ content: lastStep.content,
16710
+ text: lastStep.text,
16711
+ reasoningText: lastStep.reasoningText,
16712
+ reasoning: lastStep.reasoning,
16713
+ files: lastStep.files,
16714
+ sources: lastStep.sources,
16715
+ toolCalls: lastStep.toolCalls,
16716
+ staticToolCalls: lastStep.staticToolCalls,
16717
+ dynamicToolCalls: lastStep.dynamicToolCalls,
16718
+ toolResults: lastStep.toolResults,
16719
+ staticToolResults: lastStep.staticToolResults,
16720
+ dynamicToolResults: lastStep.dynamicToolResults,
16721
+ request: lastStep.request,
16722
+ response: lastStep.response,
16723
+ warnings: lastStep.warnings,
16724
+ providerMetadata: lastStep.providerMetadata,
16725
+ steps,
16726
+ totalUsage
16727
+ },
16728
+ callbacks: onFinish
16729
+ });
16512
16730
  let resolvedOutput;
16513
16731
  if (lastStep.finishReason === "stop") {
16514
16732
  const outputSpecification = output != null ? output : text();
@@ -16539,7 +16757,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16539
16757
  telemetry,
16540
16758
  messages,
16541
16759
  abortSignal,
16542
- experimental_context
16760
+ experimental_context,
16761
+ stepNumber,
16762
+ model,
16763
+ onToolCallStart,
16764
+ onToolCallFinish
16543
16765
  }) {
16544
16766
  const toolOutputs = await Promise.all(
16545
16767
  toolCalls.map(
@@ -16550,7 +16772,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
16550
16772
  telemetry,
16551
16773
  messages,
16552
16774
  abortSignal,
16553
- experimental_context
16775
+ experimental_context,
16776
+ stepNumber,
16777
+ model,
16778
+ onToolCallStart,
16779
+ onToolCallFinish
16554
16780
  })
16555
16781
  )
16556
16782
  );
@@ -17243,7 +17469,9 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
17243
17469
  break;
17244
17470
  }
17245
17471
  case "tool-input-error": {
17246
- if (chunk.dynamic) {
17472
+ const existingPart = state.message.parts.filter(isToolUIPart).find((p) => p.toolCallId === chunk.toolCallId);
17473
+ const isDynamic = existingPart != null ? existingPart.type === "dynamic-tool" : !!chunk.dynamic;
17474
+ if (isDynamic) {
17247
17475
  updateDynamicToolPart({
17248
17476
  toolCallId: chunk.toolCallId,
17249
17477
  toolName: chunk.toolName,
@@ -17711,10 +17939,6 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
17711
17939
  terminate
17712
17940
  };
17713
17941
  }
17714
- function now() {
17715
- var _a21, _b9;
17716
- return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
17717
- }
17718
17942
  function runToolsTransformation({
17719
17943
  tools,
17720
17944
  generatorStream,
@@ -17725,7 +17949,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
17725
17949
  abortSignal,
17726
17950
  repairToolCall,
17727
17951
  experimental_context,
17728
- generateId: generateId2
17952
+ generateId: generateId2,
17953
+ stepNumber,
17954
+ model,
17955
+ onToolCallStart,
17956
+ onToolCallFinish
17729
17957
  }) {
17730
17958
  let toolResultsStreamController = null;
17731
17959
  const toolResultsStream = new ReadableStream({
@@ -17867,6 +18095,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
17867
18095
  messages,
17868
18096
  abortSignal,
17869
18097
  experimental_context,
18098
+ stepNumber,
18099
+ model,
18100
+ onToolCallStart,
18101
+ onToolCallFinish,
17870
18102
  onPreliminaryToolResult: (result) => {
17871
18103
  toolResultsStreamController.enqueue(result);
17872
18104
  }
@@ -17983,6 +18215,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
17983
18215
  onFinish,
17984
18216
  onAbort,
17985
18217
  onStepFinish,
18218
+ experimental_onStart: onStart,
18219
+ experimental_onStepStart: onStepStart,
18220
+ experimental_onToolCallStart: onToolCallStart,
18221
+ experimental_onToolCallFinish: onToolCallFinish,
17986
18222
  experimental_context,
17987
18223
  experimental_include: include,
17988
18224
  _internal: { now: now2 = now, generateId: generateId2 = originalGenerateId2 } = {},
@@ -18022,11 +18258,18 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18022
18258
  providerOptions,
18023
18259
  prepareStep,
18024
18260
  includeRawChunks,
18261
+ timeout,
18262
+ stopWhen,
18263
+ originalAbortSignal: abortSignal,
18025
18264
  onChunk,
18026
18265
  onError,
18027
18266
  onFinish,
18028
18267
  onAbort,
18029
18268
  onStepFinish,
18269
+ onStart,
18270
+ onStepStart,
18271
+ onToolCallStart,
18272
+ onToolCallFinish,
18030
18273
  now: now2,
18031
18274
  generateId: generateId2,
18032
18275
  experimental_context,
@@ -18123,11 +18366,18 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18123
18366
  includeRawChunks,
18124
18367
  now: now2,
18125
18368
  generateId: generateId2,
18369
+ timeout,
18370
+ stopWhen,
18371
+ originalAbortSignal,
18126
18372
  onChunk,
18127
18373
  onError,
18128
18374
  onFinish,
18129
18375
  onAbort,
18130
18376
  onStepFinish,
18377
+ onStart,
18378
+ onStepStart,
18379
+ onToolCallStart,
18380
+ onToolCallFinish,
18131
18381
  experimental_context,
18132
18382
  download: download2,
18133
18383
  include
@@ -18270,6 +18520,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18270
18520
  tools
18271
18521
  });
18272
18522
  const currentStepResult = new DefaultStepResult({
18523
+ stepNumber: recordedSteps.length,
18524
+ model: modelInfo,
18525
+ ...callbackTelemetryProps,
18526
+ experimental_context,
18273
18527
  content: recordedContent,
18274
18528
  finishReason: part.finishReason,
18275
18529
  rawFinishReason: part.rawFinishReason,
@@ -18282,11 +18536,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18282
18536
  },
18283
18537
  providerMetadata: part.providerMetadata
18284
18538
  });
18285
- await (onStepFinish == null ? void 0 : onStepFinish(currentStepResult));
18539
+ await notify({ event: currentStepResult, callbacks: onStepFinish });
18286
18540
  logWarnings({
18287
18541
  warnings: recordedWarnings,
18288
- provider: model.provider,
18289
- model: model.modelId
18542
+ provider: modelInfo.provider,
18543
+ model: modelInfo.modelId
18290
18544
  });
18291
18545
  recordedSteps.push(currentStepResult);
18292
18546
  recordedResponseMessages.push(...stepMessages);
@@ -18317,30 +18571,37 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18317
18571
  self2._totalUsage.resolve(totalUsage);
18318
18572
  self2._steps.resolve(recordedSteps);
18319
18573
  const finalStep = recordedSteps[recordedSteps.length - 1];
18320
- await (onFinish == null ? void 0 : onFinish({
18321
- finishReason: finalStep.finishReason,
18322
- rawFinishReason: finalStep.rawFinishReason,
18323
- totalUsage,
18324
- usage: finalStep.usage,
18325
- content: finalStep.content,
18326
- text: finalStep.text,
18327
- reasoningText: finalStep.reasoningText,
18328
- reasoning: finalStep.reasoning,
18329
- files: finalStep.files,
18330
- sources: finalStep.sources,
18331
- toolCalls: finalStep.toolCalls,
18332
- staticToolCalls: finalStep.staticToolCalls,
18333
- dynamicToolCalls: finalStep.dynamicToolCalls,
18334
- toolResults: finalStep.toolResults,
18335
- staticToolResults: finalStep.staticToolResults,
18336
- dynamicToolResults: finalStep.dynamicToolResults,
18337
- request: finalStep.request,
18338
- response: finalStep.response,
18339
- warnings: finalStep.warnings,
18340
- providerMetadata: finalStep.providerMetadata,
18341
- steps: recordedSteps,
18342
- experimental_context
18343
- }));
18574
+ await notify({
18575
+ event: {
18576
+ stepNumber: finalStep.stepNumber,
18577
+ model: finalStep.model,
18578
+ functionId: finalStep.functionId,
18579
+ metadata: finalStep.metadata,
18580
+ experimental_context: finalStep.experimental_context,
18581
+ finishReason: finalStep.finishReason,
18582
+ rawFinishReason: finalStep.rawFinishReason,
18583
+ totalUsage,
18584
+ usage: finalStep.usage,
18585
+ content: finalStep.content,
18586
+ text: finalStep.text,
18587
+ reasoningText: finalStep.reasoningText,
18588
+ reasoning: finalStep.reasoning,
18589
+ files: finalStep.files,
18590
+ sources: finalStep.sources,
18591
+ toolCalls: finalStep.toolCalls,
18592
+ staticToolCalls: finalStep.staticToolCalls,
18593
+ dynamicToolCalls: finalStep.dynamicToolCalls,
18594
+ toolResults: finalStep.toolResults,
18595
+ staticToolResults: finalStep.staticToolResults,
18596
+ dynamicToolResults: finalStep.dynamicToolResults,
18597
+ request: finalStep.request,
18598
+ response: finalStep.response,
18599
+ warnings: finalStep.warnings,
18600
+ providerMetadata: finalStep.providerMetadata,
18601
+ steps: recordedSteps
18602
+ },
18603
+ callbacks: onFinish
18604
+ });
18344
18605
  rootSpan.setAttributes(
18345
18606
  await selectTelemetryAttributes({
18346
18607
  telemetry,
@@ -18441,6 +18702,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18441
18702
  settings: { ...callSettings, maxRetries }
18442
18703
  });
18443
18704
  const self2 = this;
18705
+ const modelInfo = { provider: model.provider, modelId: model.modelId };
18706
+ const callbackTelemetryProps = {
18707
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
18708
+ metadata: telemetry == null ? void 0 : telemetry.metadata
18709
+ };
18444
18710
  recordSpan({
18445
18711
  name: "ai.streamText",
18446
18712
  attributes: selectTelemetryAttributes({
@@ -18463,6 +18729,36 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18463
18729
  prompt,
18464
18730
  messages
18465
18731
  });
18732
+ await notify({
18733
+ event: {
18734
+ model: modelInfo,
18735
+ system,
18736
+ prompt,
18737
+ messages,
18738
+ tools,
18739
+ toolChoice,
18740
+ activeTools,
18741
+ maxOutputTokens: callSettings.maxOutputTokens,
18742
+ temperature: callSettings.temperature,
18743
+ topP: callSettings.topP,
18744
+ topK: callSettings.topK,
18745
+ presencePenalty: callSettings.presencePenalty,
18746
+ frequencyPenalty: callSettings.frequencyPenalty,
18747
+ stopSequences: callSettings.stopSequences,
18748
+ seed: callSettings.seed,
18749
+ maxRetries,
18750
+ timeout,
18751
+ headers,
18752
+ providerOptions,
18753
+ stopWhen,
18754
+ output,
18755
+ abortSignal: originalAbortSignal,
18756
+ include,
18757
+ ...callbackTelemetryProps,
18758
+ experimental_context
18759
+ },
18760
+ callbacks: onStart
18761
+ });
18466
18762
  const initialMessages = initialPrompt.messages;
18467
18763
  const initialResponseMessages = [];
18468
18764
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -18509,6 +18805,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18509
18805
  messages: initialMessages,
18510
18806
  abortSignal,
18511
18807
  experimental_context,
18808
+ stepNumber: recordedSteps.length,
18809
+ model: modelInfo,
18810
+ onToolCallStart,
18811
+ onToolCallFinish,
18512
18812
  onPreliminaryToolResult: (result2) => {
18513
18813
  toolExecutionStepStreamController == null ? void 0 : toolExecutionStepStreamController.enqueue(result2);
18514
18814
  }
@@ -18575,7 +18875,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18575
18875
  responseMessages,
18576
18876
  usage
18577
18877
  }) {
18578
- var _a21, _b9, _c, _d, _e, _f, _g;
18878
+ var _a21, _b9, _c, _d, _e, _f, _g, _h, _i;
18579
18879
  const includeRawChunks2 = self2.includeRawChunks;
18580
18880
  const stepTimeoutId = stepTimeoutMs != null ? setTimeout(() => stepAbortController.abort(), stepTimeoutMs) : void 0;
18581
18881
  let chunkTimeoutId = void 0;
@@ -18614,6 +18914,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18614
18914
  const stepModel = resolveLanguageModel(
18615
18915
  (_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
18616
18916
  );
18917
+ const stepModelInfo = {
18918
+ provider: stepModel.provider,
18919
+ modelId: stepModel.modelId
18920
+ };
18617
18921
  const promptMessages = await convertToLanguageModelPrompt({
18618
18922
  prompt: {
18619
18923
  system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
@@ -18622,16 +18926,41 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18622
18926
  supportedUrls: await stepModel.supportedUrls,
18623
18927
  download: download2
18624
18928
  });
18929
+ const stepActiveTools = (_d = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _d : activeTools;
18625
18930
  const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
18626
18931
  tools,
18627
- toolChoice: (_d = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _d : toolChoice,
18628
- activeTools: (_e = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _e : activeTools
18932
+ toolChoice: (_e = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _e : toolChoice,
18933
+ activeTools: stepActiveTools
18629
18934
  });
18630
18935
  experimental_context = (_f = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _f : experimental_context;
18936
+ const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
18937
+ const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
18631
18938
  const stepProviderOptions = mergeObjects(
18632
18939
  providerOptions,
18633
18940
  prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
18634
18941
  );
18942
+ await notify({
18943
+ event: {
18944
+ stepNumber: recordedSteps.length,
18945
+ model: stepModelInfo,
18946
+ system: stepSystem,
18947
+ messages: stepMessages,
18948
+ tools,
18949
+ toolChoice: stepToolChoice,
18950
+ activeTools: stepActiveTools,
18951
+ steps: [...recordedSteps],
18952
+ providerOptions: stepProviderOptions,
18953
+ timeout,
18954
+ headers,
18955
+ stopWhen,
18956
+ output,
18957
+ abortSignal: originalAbortSignal,
18958
+ include,
18959
+ ...callbackTelemetryProps,
18960
+ experimental_context
18961
+ },
18962
+ callbacks: onStepStart
18963
+ });
18635
18964
  const {
18636
18965
  result: { stream: stream2, response, request },
18637
18966
  doStreamSpan,
@@ -18703,9 +19032,13 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18703
19032
  repairToolCall,
18704
19033
  abortSignal,
18705
19034
  experimental_context,
18706
- generateId: generateId2
19035
+ generateId: generateId2,
19036
+ stepNumber: recordedSteps.length,
19037
+ model: stepModelInfo,
19038
+ onToolCallStart,
19039
+ onToolCallFinish
18707
19040
  });
18708
- const stepRequest = ((_g = include == null ? void 0 : include.requestBody) != null ? _g : true) ? request != null ? request : {} : { ...request, body: void 0 };
19041
+ const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? request != null ? request : {} : { ...request, body: void 0 };
18709
19042
  const stepToolCalls = [];
18710
19043
  const stepToolOutputs = [];
18711
19044
  let warnings;
@@ -18718,7 +19051,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
18718
19051
  let stepResponse = {
18719
19052
  id: generateId2(),
18720
19053
  timestamp: /* @__PURE__ */ new Date(),
18721
- modelId: model.modelId
19054
+ modelId: modelInfo.modelId
18722
19055
  };
18723
19056
  let activeText = "";
18724
19057
  self2.addStream(
@@ -25290,7 +25623,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
25290
25623
  for (const toolCallDelta of delta.tool_calls) {
25291
25624
  const index = toolCallDelta.index;
25292
25625
  if (toolCalls[index] == null) {
25293
- if (toolCallDelta.type !== "function") {
25626
+ if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
25294
25627
  throw new InvalidResponseDataError$1({
25295
25628
  data: toolCallDelta,
25296
25629
  message: `Expected 'function' type.`
@@ -25980,9 +26313,11 @@ ${user}:`]
25980
26313
  "dall-e-2": 10,
25981
26314
  "gpt-image-1": 10,
25982
26315
  "gpt-image-1-mini": 10,
25983
- "gpt-image-1.5": 10
26316
+ "gpt-image-1.5": 10,
26317
+ "chatgpt-image-latest": 10
25984
26318
  };
25985
26319
  var defaultResponseFormatPrefixes = [
26320
+ "chatgpt-image-",
25986
26321
  "gpt-image-1-mini",
25987
26322
  "gpt-image-1.5",
25988
26323
  "gpt-image-1"
@@ -26081,15 +26416,20 @@ ${user}:`]
26081
26416
  },
26082
26417
  providerMetadata: {
26083
26418
  openai: {
26084
- images: response2.data.map((item) => {
26085
- var _a22, _b22, _c2, _d2, _e2;
26419
+ images: response2.data.map((item, index) => {
26420
+ var _a22, _b22, _c2, _d2, _e2, _f2;
26086
26421
  return {
26087
26422
  ...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
26088
26423
  created: (_a22 = response2.created) != null ? _a22 : void 0,
26089
26424
  size: (_b22 = response2.size) != null ? _b22 : void 0,
26090
26425
  quality: (_c2 = response2.quality) != null ? _c2 : void 0,
26091
26426
  background: (_d2 = response2.background) != null ? _d2 : void 0,
26092
- outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0
26427
+ outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0,
26428
+ ...distributeTokenDetails(
26429
+ (_f2 = response2.usage) == null ? void 0 : _f2.input_tokens_details,
26430
+ index,
26431
+ response2.data.length
26432
+ )
26093
26433
  };
26094
26434
  })
26095
26435
  }
@@ -26132,15 +26472,20 @@ ${user}:`]
26132
26472
  },
26133
26473
  providerMetadata: {
26134
26474
  openai: {
26135
- images: response.data.map((item) => {
26136
- var _a22, _b22, _c2, _d2, _e2;
26475
+ images: response.data.map((item, index) => {
26476
+ var _a22, _b22, _c2, _d2, _e2, _f2;
26137
26477
  return {
26138
26478
  ...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
26139
26479
  created: (_a22 = response.created) != null ? _a22 : void 0,
26140
26480
  size: (_b22 = response.size) != null ? _b22 : void 0,
26141
26481
  quality: (_c2 = response.quality) != null ? _c2 : void 0,
26142
26482
  background: (_d2 = response.background) != null ? _d2 : void 0,
26143
- outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0
26483
+ outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0,
26484
+ ...distributeTokenDetails(
26485
+ (_f2 = response.usage) == null ? void 0 : _f2.input_tokens_details,
26486
+ index,
26487
+ response.data.length
26488
+ )
26144
26489
  };
26145
26490
  })
26146
26491
  }
@@ -26148,6 +26493,23 @@ ${user}:`]
26148
26493
  };
26149
26494
  }
26150
26495
  };
26496
+ function distributeTokenDetails(details, index, total) {
26497
+ if (details == null) {
26498
+ return {};
26499
+ }
26500
+ const result = {};
26501
+ if (details.image_tokens != null) {
26502
+ const base = Math.floor(details.image_tokens / total);
26503
+ const remainder = details.image_tokens - base * (total - 1);
26504
+ result.imageTokens = index === total - 1 ? remainder : base;
26505
+ }
26506
+ if (details.text_tokens != null) {
26507
+ const base = Math.floor(details.text_tokens / total);
26508
+ const remainder = details.text_tokens - base * (total - 1);
26509
+ result.textTokens = index === total - 1 ? remainder : base;
26510
+ }
26511
+ return result;
26512
+ }
26151
26513
  async function fileToBlob(file) {
26152
26514
  if (!file) return void 0;
26153
26515
  if (file.type === "url") {
@@ -26358,6 +26720,67 @@ ${user}:`]
26358
26720
  })
26359
26721
  )
26360
26722
  );
26723
+ var shellSkillsSchema = array$1(
26724
+ discriminatedUnion("type", [
26725
+ object$1({
26726
+ type: literal("skillReference"),
26727
+ skillId: string(),
26728
+ version: string().optional()
26729
+ }),
26730
+ object$1({
26731
+ type: literal("inline"),
26732
+ name: string(),
26733
+ description: string(),
26734
+ source: object$1({
26735
+ type: literal("base64"),
26736
+ mediaType: literal("application/zip"),
26737
+ data: string()
26738
+ })
26739
+ })
26740
+ ])
26741
+ ).optional();
26742
+ var shellArgsSchema = lazySchema(
26743
+ () => zodSchema(
26744
+ object$1({
26745
+ environment: union([
26746
+ object$1({
26747
+ type: literal("containerAuto"),
26748
+ fileIds: array$1(string()).optional(),
26749
+ memoryLimit: _enum$1(["1g", "4g", "16g", "64g"]).optional(),
26750
+ networkPolicy: discriminatedUnion("type", [
26751
+ object$1({ type: literal("disabled") }),
26752
+ object$1({
26753
+ type: literal("allowlist"),
26754
+ allowedDomains: array$1(string()),
26755
+ domainSecrets: array$1(
26756
+ object$1({
26757
+ domain: string(),
26758
+ name: string(),
26759
+ value: string()
26760
+ })
26761
+ ).optional()
26762
+ })
26763
+ ]).optional(),
26764
+ skills: shellSkillsSchema
26765
+ }),
26766
+ object$1({
26767
+ type: literal("containerReference"),
26768
+ containerId: string()
26769
+ }),
26770
+ object$1({
26771
+ type: literal("local").optional(),
26772
+ skills: array$1(
26773
+ object$1({
26774
+ name: string(),
26775
+ description: string(),
26776
+ path: string()
26777
+ })
26778
+ ).optional()
26779
+ })
26780
+ ]).optional()
26781
+ })
26782
+ )
26783
+ );
26361
26784
  var shell = createProviderToolFactoryWithOutputSchema({
26362
26785
  id: "openai.shell",
26363
26786
  inputSchema: shellInputSchema,
@@ -26397,7 +26820,7 @@ ${user}:`]
26397
26820
  url: string().nullish(),
26398
26821
  pattern: string().nullish()
26399
26822
  })
26400
- ]),
26823
+ ]).optional(),
26401
26824
  sources: array$1(
26402
26825
  discriminatedUnion("type", [
26403
26826
  object$1({ type: literal("url"), url: string() }),
@@ -26447,7 +26870,7 @@ ${user}:`]
26447
26870
  url: string().nullish(),
26448
26871
  pattern: string().nullish()
26449
26872
  })
26450
- ])
26873
+ ]).optional()
26451
26874
  })
26452
26875
  )
26453
26876
  );
@@ -26664,7 +27087,7 @@ ${user}:`]
26664
27087
  hasShellTool = false,
26665
27088
  hasApplyPatchTool = false
26666
27089
  }) {
26667
- var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
27090
+ var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
26668
27091
  const input = [];
26669
27092
  const warnings = [];
26670
27093
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -26745,7 +27168,9 @@ ${user}:`]
26745
27168
  for (const part of content) {
26746
27169
  switch (part.type) {
26747
27170
  case "text": {
26748
- const id2 = (_b9 = (_a10 = part.providerOptions) == null ? void 0 : _a10[providerOptionsName]) == null ? void 0 : _b9.itemId;
27171
+ const providerOpts = (_a10 = part.providerOptions) == null ? void 0 : _a10[providerOptionsName];
27172
+ const id2 = providerOpts == null ? void 0 : providerOpts.itemId;
27173
+ const phase = providerOpts == null ? void 0 : providerOpts.phase;
26749
27174
  if (hasConversation && id2 != null) {
26750
27175
  break;
26751
27176
  }
@@ -26756,12 +27181,13 @@ ${user}:`]
26756
27181
  input.push({
26757
27182
  role: "assistant",
26758
27183
  content: [{ type: "output_text", text: part.text }],
26759
- id: id2
27184
+ id: id2,
27185
+ ...phase != null && { phase }
26760
27186
  });
26761
27187
  break;
26762
27188
  }
26763
27189
  case "tool-call": {
26764
- const id2 = (_g = (_d = (_c = part.providerOptions) == null ? void 0 : _c[providerOptionsName]) == null ? void 0 : _d.itemId) != null ? _g : (_f = (_e = part.providerMetadata) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.itemId;
27190
+ const id2 = (_f = (_c = (_b9 = part.providerOptions) == null ? void 0 : _b9[providerOptionsName]) == null ? void 0 : _c.itemId) != null ? _f : (_e = (_d = part.providerMetadata) == null ? void 0 : _d[providerOptionsName]) == null ? void 0 : _e.itemId;
26765
27191
  if (hasConversation && id2 != null) {
26766
27192
  break;
26767
27193
  }
@@ -26847,8 +27273,32 @@ ${user}:`]
26847
27273
  if (hasConversation) {
26848
27274
  break;
26849
27275
  }
27276
+ const resolvedResultToolName = toolNameMapping.toProviderToolName(
27277
+ part.toolName
27278
+ );
27279
+ if (hasShellTool && resolvedResultToolName === "shell") {
27280
+ if (part.output.type === "json") {
27281
+ const parsedOutput = await validateTypes$1({
27282
+ value: part.output.value,
27283
+ schema: shellOutputSchema
27284
+ });
27285
+ input.push({
27286
+ type: "shell_call_output",
27287
+ call_id: part.toolCallId,
27288
+ output: parsedOutput.output.map((item) => ({
27289
+ stdout: item.stdout,
27290
+ stderr: item.stderr,
27291
+ outcome: item.outcome.type === "timeout" ? { type: "timeout" } : {
27292
+ type: "exit",
27293
+ exit_code: item.outcome.exitCode
27294
+ }
27295
+ }))
27296
+ });
27297
+ }
27298
+ break;
27299
+ }
26850
27300
  if (store) {
26851
- const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
27301
+ const itemId = (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.itemId) != null ? _i : part.toolCallId;
26852
27302
  input.push({ type: "item_reference", id: itemId });
26853
27303
  } else {
26854
27304
  warnings.push({
@@ -26908,10 +27358,26 @@ ${user}:`]
26908
27358
  }
26909
27359
  }
26910
27360
  } else {
26911
- warnings.push({
26912
- type: "other",
26913
- message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(part)}.`
26914
- });
27361
+ const encryptedContent = providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent;
27362
+ if (encryptedContent != null) {
27363
+ const summaryParts = [];
27364
+ if (part.text.length > 0) {
27365
+ summaryParts.push({
27366
+ type: "summary_text",
27367
+ text: part.text
27368
+ });
27369
+ }
27370
+ input.push({
27371
+ type: "reasoning",
27372
+ encrypted_content: encryptedContent,
27373
+ summary: summaryParts
27374
+ });
27375
+ } else {
27376
+ warnings.push({
27377
+ type: "other",
27378
+ message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(part)}.`
27379
+ });
27380
+ }
26915
27381
  }
26916
27382
  break;
26917
27383
  }
@@ -26942,7 +27408,7 @@ ${user}:`]
26942
27408
  }
26943
27409
  const output = part.output;
26944
27410
  if (output.type === "execution-denied") {
26945
- const approvalId = (_l = (_k = output.providerOptions) == null ? void 0 : _k.openai) == null ? void 0 : _l.approvalId;
27411
+ const approvalId = (_k = (_j = output.providerOptions) == null ? void 0 : _j.openai) == null ? void 0 : _k.approvalId;
26946
27412
  if (approvalId) {
26947
27413
  continue;
26948
27414
  }
@@ -27001,7 +27467,7 @@ ${user}:`]
27001
27467
  contentValue = output.value;
27002
27468
  break;
27003
27469
  case "execution-denied":
27004
- contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
27470
+ contentValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
27005
27471
  break;
27006
27472
  case "json":
27007
27473
  case "error-json":
@@ -27128,7 +27594,8 @@ ${user}:`]
27128
27594
  item: discriminatedUnion("type", [
27129
27595
  object$1({
27130
27596
  type: literal("message"),
27131
- id: string()
27597
+ id: string(),
27598
+ phase: _enum$1(["commentary", "final_answer"]).nullish()
27132
27599
  }),
27133
27600
  object$1({
27134
27601
  type: literal("reasoning"),
@@ -27217,6 +27684,25 @@ ${user}:`]
27217
27684
  action: object$1({
27218
27685
  commands: array$1(string())
27219
27686
  })
27687
+ }),
27688
+ object$1({
27689
+ type: literal("shell_call_output"),
27690
+ id: string(),
27691
+ call_id: string(),
27692
+ status: _enum$1(["in_progress", "completed", "incomplete"]),
27693
+ output: array$1(
27694
+ object$1({
27695
+ stdout: string(),
27696
+ stderr: string(),
27697
+ outcome: discriminatedUnion("type", [
27698
+ object$1({ type: literal("timeout") }),
27699
+ object$1({
27700
+ type: literal("exit"),
27701
+ exit_code: number$1()
27702
+ })
27703
+ ])
27704
+ })
27705
+ )
27220
27706
  })
27221
27707
  ])
27222
27708
  }),
@@ -27226,7 +27712,8 @@ ${user}:`]
27226
27712
  item: discriminatedUnion("type", [
27227
27713
  object$1({
27228
27714
  type: literal("message"),
27229
- id: string()
27715
+ id: string(),
27716
+ phase: _enum$1(["commentary", "final_answer"]).nullish()
27230
27717
  }),
27231
27718
  object$1({
27232
27719
  type: literal("reasoning"),
@@ -27282,7 +27769,7 @@ ${user}:`]
27282
27769
  url: string().nullish(),
27283
27770
  pattern: string().nullish()
27284
27771
  })
27285
- ])
27772
+ ]).nullish()
27286
27773
  }),
27287
27774
  object$1({
27288
27775
  type: literal("file_search_call"),
@@ -27396,6 +27883,25 @@ ${user}:`]
27396
27883
  action: object$1({
27397
27884
  commands: array$1(string())
27398
27885
  })
27886
+ }),
27887
+ object$1({
27888
+ type: literal("shell_call_output"),
27889
+ id: string(),
27890
+ call_id: string(),
27891
+ status: _enum$1(["in_progress", "completed", "incomplete"]),
27892
+ output: array$1(
27893
+ object$1({
27894
+ stdout: string(),
27895
+ stderr: string(),
27896
+ outcome: discriminatedUnion("type", [
27897
+ object$1({ type: literal("timeout") }),
27898
+ object$1({
27899
+ type: literal("exit"),
27900
+ exit_code: number$1()
27901
+ })
27902
+ ])
27903
+ })
27904
+ )
27399
27905
  })
27400
27906
  ])
27401
27907
  }),
@@ -27519,6 +28025,7 @@ ${user}:`]
27519
28025
  type: literal("message"),
27520
28026
  role: literal("assistant"),
27521
28027
  id: string(),
28028
+ phase: _enum$1(["commentary", "final_answer"]).nullish(),
27522
28029
  content: array$1(
27523
28030
  object$1({
27524
28031
  type: literal("output_text"),
@@ -27579,7 +28086,10 @@ ${user}:`]
27579
28086
  sources: array$1(
27580
28087
  discriminatedUnion("type", [
27581
28088
  object$1({ type: literal("url"), url: string() }),
27582
- object$1({ type: literal("api"), name: string() })
28089
+ object$1({
28090
+ type: literal("api"),
28091
+ name: string()
28092
+ })
27583
28093
  ])
27584
28094
  ).nullish()
27585
28095
  }),
@@ -27592,7 +28102,7 @@ ${user}:`]
27592
28102
  url: string().nullish(),
27593
28103
  pattern: string().nullish()
27594
28104
  })
27595
- ])
28105
+ ]).nullish()
27596
28106
  }),
27597
28107
  object$1({
27598
28108
  type: literal("file_search_call"),
@@ -27741,6 +28251,25 @@ ${user}:`]
27741
28251
  action: object$1({
27742
28252
  commands: array$1(string())
27743
28253
  })
28254
+ }),
28255
+ object$1({
28256
+ type: literal("shell_call_output"),
28257
+ id: string(),
28258
+ call_id: string(),
28259
+ status: _enum$1(["in_progress", "completed", "incomplete"]),
28260
+ output: array$1(
28261
+ object$1({
28262
+ stdout: string(),
28263
+ stderr: string(),
28264
+ outcome: discriminatedUnion("type", [
28265
+ object$1({ type: literal("timeout") }),
28266
+ object$1({
28267
+ type: literal("exit"),
28268
+ exit_code: number$1()
28269
+ })
28270
+ ])
28271
+ })
28272
+ )
27744
28273
  })
27745
28274
  ])
27746
28275
  ).optional(),
@@ -27957,8 +28486,15 @@ ${user}:`]
27957
28486
  break;
27958
28487
  }
27959
28488
  case "openai.shell": {
28489
+ const args = await validateTypes$1({
28490
+ value: tool2.args,
28491
+ schema: shellArgsSchema
28492
+ });
27960
28493
  openaiTools2.push({
27961
- type: "shell"
28494
+ type: "shell",
28495
+ ...args.environment && {
28496
+ environment: mapShellEnvironment(args.environment)
28497
+ }
27962
28498
  });
27963
28499
  break;
27964
28500
  }
@@ -28088,6 +28624,52 @@ ${user}:`]
28088
28624
  }
28089
28625
  }
28090
28626
  }
28627
+ function mapShellEnvironment(environment) {
28628
+ if (environment.type === "containerReference") {
28629
+ const env2 = environment;
28630
+ return {
28631
+ type: "container_reference",
28632
+ container_id: env2.containerId
28633
+ };
28634
+ }
28635
+ if (environment.type === "containerAuto") {
28636
+ const env2 = environment;
28637
+ return {
28638
+ type: "container_auto",
28639
+ file_ids: env2.fileIds,
28640
+ memory_limit: env2.memoryLimit,
28641
+ network_policy: env2.networkPolicy == null ? void 0 : env2.networkPolicy.type === "disabled" ? { type: "disabled" } : {
28642
+ type: "allowlist",
28643
+ allowed_domains: env2.networkPolicy.allowedDomains,
28644
+ domain_secrets: env2.networkPolicy.domainSecrets
28645
+ },
28646
+ skills: mapShellSkills(env2.skills)
28647
+ };
28648
+ }
28649
+ const env = environment;
28650
+ return {
28651
+ type: "local",
28652
+ skills: env.skills
28653
+ };
28654
+ }
28655
+ function mapShellSkills(skills) {
28656
+ return skills == null ? void 0 : skills.map(
28657
+ (skill) => skill.type === "skillReference" ? {
28658
+ type: "skill_reference",
28659
+ skill_id: skill.skillId,
28660
+ version: skill.version
28661
+ } : {
28662
+ type: "inline",
28663
+ name: skill.name,
28664
+ description: skill.description,
28665
+ source: {
28666
+ type: "base64",
28667
+ media_type: skill.source.mediaType,
28668
+ data: skill.source.data
28669
+ }
28670
+ }
28671
+ );
28672
+ }
28091
28673
  function extractApprovalRequestIdToToolCallIdMapping(prompt) {
28092
28674
  var _a10, _b9;
28093
28675
  const mapping = {};
@@ -28131,7 +28713,7 @@ ${user}:`]
28131
28713
  toolChoice,
28132
28714
  responseFormat
28133
28715
  }) {
28134
- var _a10, _b9, _c, _d, _e, _f;
28716
+ var _a10, _b9, _c, _d, _e, _f, _g, _h, _i;
28135
28717
  const warnings = [];
28136
28718
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
28137
28719
  if (topK != null) {
@@ -28335,6 +28917,10 @@ ${user}:`]
28335
28917
  tools,
28336
28918
  toolChoice
28337
28919
  });
28920
+ const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
28921
+ (tool2) => tool2.type === "provider" && tool2.id === "openai.shell"
28922
+ )) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
28923
+ const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
28338
28924
  return {
28339
28925
  webSearchToolName,
28340
28926
  args: {
@@ -28345,7 +28931,8 @@ ${user}:`]
28345
28931
  warnings: [...warnings, ...toolWarnings],
28346
28932
  store,
28347
28933
  toolNameMapping,
28348
- providerOptionsName
28934
+ providerOptionsName,
28935
+ isShellProviderExecuted
28349
28936
  };
28350
28937
  }
28351
28938
  async doGenerate(options) {
@@ -28355,7 +28942,8 @@ ${user}:`]
28355
28942
  warnings,
28356
28943
  webSearchToolName,
28357
28944
  toolNameMapping,
28358
- providerOptionsName
28945
+ providerOptionsName,
28946
+ isShellProviderExecuted
28359
28947
  } = await this.getArgs(options);
28360
28948
  const url2 = this.config.url({
28361
28949
  path: "/responses",
@@ -28455,6 +29043,7 @@ ${user}:`]
28455
29043
  commands: part.action.commands
28456
29044
  }
28457
29045
  }),
29046
+ ...isShellProviderExecuted && { providerExecuted: true },
28458
29047
  providerMetadata: {
28459
29048
  [providerOptionsName]: {
28460
29049
  itemId: part.id
@@ -28463,6 +29052,24 @@ ${user}:`]
28463
29052
  });
28464
29053
  break;
28465
29054
  }
29055
+ case "shell_call_output": {
29056
+ content.push({
29057
+ type: "tool-result",
29058
+ toolCallId: part.call_id,
29059
+ toolName: toolNameMapping.toCustomToolName("shell"),
29060
+ result: {
29061
+ output: part.output.map((item) => ({
29062
+ stdout: item.stdout,
29063
+ stderr: item.stderr,
29064
+ outcome: item.outcome.type === "exit" ? {
29065
+ type: "exit",
29066
+ exitCode: item.outcome.exit_code
29067
+ } : { type: "timeout" }
29068
+ }))
29069
+ }
29070
+ });
29071
+ break;
29072
+ }
28466
29073
  case "message": {
28467
29074
  for (const contentPart of part.content) {
28468
29075
  if (((_c = (_b9 = options.providerOptions) == null ? void 0 : _b9[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
@@ -28470,6 +29077,7 @@ ${user}:`]
28470
29077
  }
28471
29078
  const providerMetadata2 = {
28472
29079
  itemId: part.id,
29080
+ ...part.phase != null && { phase: part.phase },
28473
29081
  ...contentPart.annotations.length > 0 && {
28474
29082
  annotations: contentPart.annotations
28475
29083
  }
@@ -28752,7 +29360,8 @@ ${user}:`]
28752
29360
  webSearchToolName,
28753
29361
  toolNameMapping,
28754
29362
  store,
28755
- providerOptionsName
29363
+ providerOptionsName,
29364
+ isShellProviderExecuted
28756
29365
  } = await this.getArgs(options);
28757
29366
  const { responseHeaders, value: response } = await postJsonToApi$1({
28758
29367
  url: this.config.url({
@@ -28783,6 +29392,7 @@ ${user}:`]
28783
29392
  let responseId = null;
28784
29393
  const ongoingToolCalls = {};
28785
29394
  const ongoingAnnotations = [];
29395
+ let activeMessagePhase;
28786
29396
  let hasFunctionCall = false;
28787
29397
  const activeReasoning = {};
28788
29398
  let serviceTier;
@@ -28793,7 +29403,7 @@ ${user}:`]
28793
29403
  controller.enqueue({ type: "stream-start", warnings });
28794
29404
  },
28795
29405
  transform(chunk, controller) {
28796
- var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
29406
+ var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
28797
29407
  if (options.includeRawChunks) {
28798
29408
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
28799
29409
  }
@@ -28931,14 +29541,19 @@ ${user}:`]
28931
29541
  toolName: toolNameMapping.toCustomToolName("shell"),
28932
29542
  toolCallId: value.item.call_id
28933
29543
  };
28934
- } else if (value.item.type === "message") {
29544
+ } else if (value.item.type === "shell_call_output") ;
29545
+ else if (value.item.type === "message") {
28935
29546
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
29547
+ activeMessagePhase = (_a10 = value.item.phase) != null ? _a10 : void 0;
28936
29548
  controller.enqueue({
28937
29549
  type: "text-start",
28938
29550
  id: value.item.id,
28939
29551
  providerMetadata: {
28940
29552
  [providerOptionsName]: {
28941
- itemId: value.item.id
29553
+ itemId: value.item.id,
29554
+ ...value.item.phase != null && {
29555
+ phase: value.item.phase
29556
+ }
28942
29557
  }
28943
29558
  }
28944
29559
  });
@@ -28953,19 +29568,22 @@ ${user}:`]
28953
29568
  providerMetadata: {
28954
29569
  [providerOptionsName]: {
28955
29570
  itemId: value.item.id,
28956
- reasoningEncryptedContent: (_a10 = value.item.encrypted_content) != null ? _a10 : null
29571
+ reasoningEncryptedContent: (_b9 = value.item.encrypted_content) != null ? _b9 : null
28957
29572
  }
28958
29573
  }
28959
29574
  });
28960
29575
  }
28961
29576
  } else if (isResponseOutputItemDoneChunk(value)) {
28962
29577
  if (value.item.type === "message") {
29578
+ const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
29579
+ activeMessagePhase = void 0;
28963
29580
  controller.enqueue({
28964
29581
  type: "text-end",
28965
29582
  id: value.item.id,
28966
29583
  providerMetadata: {
28967
29584
  [providerOptionsName]: {
28968
29585
  itemId: value.item.id,
29586
+ ...phase != null && { phase },
28969
29587
  ...ongoingAnnotations.length > 0 && {
28970
29588
  annotations: ongoingAnnotations
28971
29589
  }
@@ -29030,13 +29648,13 @@ ${user}:`]
29030
29648
  toolName: toolNameMapping.toCustomToolName("file_search"),
29031
29649
  result: {
29032
29650
  queries: value.item.queries,
29033
- results: (_c = (_b9 = value.item.results) == null ? void 0 : _b9.map((result) => ({
29651
+ results: (_e = (_d = value.item.results) == null ? void 0 : _d.map((result) => ({
29034
29652
  attributes: result.attributes,
29035
29653
  fileId: result.file_id,
29036
29654
  filename: result.filename,
29037
29655
  score: result.score,
29038
29656
  text: result.text
29039
- }))) != null ? _c : null
29657
+ }))) != null ? _e : null
29040
29658
  }
29041
29659
  });
29042
29660
  } else if (value.item.type === "code_interpreter_call") {
@@ -29060,10 +29678,10 @@ ${user}:`]
29060
29678
  });
29061
29679
  } else if (value.item.type === "mcp_call") {
29062
29680
  ongoingToolCalls[value.output_index] = void 0;
29063
- const approvalRequestId = (_d = value.item.approval_request_id) != null ? _d : void 0;
29064
- const aliasedToolCallId = approvalRequestId != null ? (_f = (_e = approvalRequestIdToDummyToolCallIdFromStream.get(
29681
+ const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : void 0;
29682
+ const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(
29065
29683
  approvalRequestId
29066
- )) != null ? _e : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _f : value.item.id : value.item.id;
29684
+ )) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
29067
29685
  const toolName = `mcp.${value.item.name}`;
29068
29686
  controller.enqueue({
29069
29687
  type: "tool-call",
@@ -29133,8 +29751,8 @@ ${user}:`]
29133
29751
  ongoingToolCalls[value.output_index] = void 0;
29134
29752
  } else if (value.item.type === "mcp_approval_request") {
29135
29753
  ongoingToolCalls[value.output_index] = void 0;
29136
- const dummyToolCallId = (_i = (_h = (_g = self2.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId$1();
29137
- const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : value.item.id;
29754
+ const dummyToolCallId = (_k = (_j = (_i = self2.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : generateId$1();
29755
+ const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
29138
29756
  approvalRequestIdToDummyToolCallIdFromStream.set(
29139
29757
  approvalRequestId,
29140
29758
  dummyToolCallId
@@ -29184,10 +29802,31 @@ ${user}:`]
29184
29802
  commands: value.item.action.commands
29185
29803
  }
29186
29804
  }),
29805
+ ...isShellProviderExecuted && {
29806
+ providerExecuted: true
29807
+ },
29187
29808
  providerMetadata: {
29188
29809
  [providerOptionsName]: { itemId: value.item.id }
29189
29810
  }
29190
29811
  });
29812
+ } else if (value.item.type === "shell_call_output") {
29813
+ controller.enqueue({
29814
+ type: "tool-result",
29815
+ toolCallId: value.item.call_id,
29816
+ toolName: toolNameMapping.toCustomToolName("shell"),
29817
+ result: {
29818
+ output: value.item.output.map(
29819
+ (item) => ({
29820
+ stdout: item.stdout,
29821
+ stderr: item.stderr,
29822
+ outcome: item.outcome.type === "exit" ? {
29823
+ type: "exit",
29824
+ exitCode: item.outcome.exit_code
29825
+ } : { type: "timeout" }
29826
+ })
29827
+ )
29828
+ }
29829
+ });
29191
29830
  } else if (value.item.type === "reasoning") {
29192
29831
  const activeReasoningPart = activeReasoning[value.item.id];
29193
29832
  const summaryPartIndices = Object.entries(
@@ -29202,7 +29841,7 @@ ${user}:`]
29202
29841
  providerMetadata: {
29203
29842
  [providerOptionsName]: {
29204
29843
  itemId: value.item.id,
29205
- reasoningEncryptedContent: (_k = value.item.encrypted_content) != null ? _k : null
29844
+ reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
29206
29845
  }
29207
29846
  }
29208
29847
  });
@@ -29306,7 +29945,7 @@ ${user}:`]
29306
29945
  id: value.item_id,
29307
29946
  delta: value.delta
29308
29947
  });
29309
- if (((_m = (_l = options.providerOptions) == null ? void 0 : _l[providerOptionsName]) == null ? void 0 : _m.logprobs) && value.logprobs) {
29948
+ if (((_o = (_n = options.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.logprobs) && value.logprobs) {
29310
29949
  logprobs.push(value.logprobs);
29311
29950
  }
29312
29951
  } else if (value.type === "response.reasoning_summary_part.added") {
@@ -29335,7 +29974,7 @@ ${user}:`]
29335
29974
  providerMetadata: {
29336
29975
  [providerOptionsName]: {
29337
29976
  itemId: value.item_id,
29338
- reasoningEncryptedContent: (_o = (_n = activeReasoning[value.item_id]) == null ? void 0 : _n.encryptedContent) != null ? _o : null
29977
+ reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? void 0 : _p.encryptedContent) != null ? _q : null
29339
29978
  }
29340
29979
  }
29341
29980
  });
@@ -29369,10 +30008,10 @@ ${user}:`]
29369
30008
  } else if (isResponseFinishedChunk(value)) {
29370
30009
  finishReason = {
29371
30010
  unified: mapOpenAIResponseFinishReason({
29372
- finishReason: (_p = value.response.incomplete_details) == null ? void 0 : _p.reason,
30011
+ finishReason: (_r = value.response.incomplete_details) == null ? void 0 : _r.reason,
29373
30012
  hasFunctionCall
29374
30013
  }),
29375
- raw: (_r = (_q = value.response.incomplete_details) == null ? void 0 : _q.reason) != null ? _r : void 0
30014
+ raw: (_t = (_s = value.response.incomplete_details) == null ? void 0 : _s.reason) != null ? _t : void 0
29376
30015
  };
29377
30016
  usage = value.response.usage;
29378
30017
  if (typeof value.response.service_tier === "string") {
@@ -29384,7 +30023,7 @@ ${user}:`]
29384
30023
  controller.enqueue({
29385
30024
  type: "source",
29386
30025
  sourceType: "url",
29387
- id: (_u = (_t = (_s = self2.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : generateId$1(),
30026
+ id: (_w = (_v = (_u = self2.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId$1(),
29388
30027
  url: value.annotation.url,
29389
30028
  title: value.annotation.title
29390
30029
  });
@@ -29392,7 +30031,7 @@ ${user}:`]
29392
30031
  controller.enqueue({
29393
30032
  type: "source",
29394
30033
  sourceType: "document",
29395
- id: (_x = (_w = (_v = self2.config).generateId) == null ? void 0 : _w.call(_v)) != null ? _x : generateId$1(),
30034
+ id: (_z = (_y = (_x = self2.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : generateId$1(),
29396
30035
  mediaType: "text/plain",
29397
30036
  title: value.annotation.filename,
29398
30037
  filename: value.annotation.filename,
@@ -29408,7 +30047,7 @@ ${user}:`]
29408
30047
  controller.enqueue({
29409
30048
  type: "source",
29410
30049
  sourceType: "document",
29411
- id: (_A = (_z = (_y = self2.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : generateId$1(),
30050
+ id: (_C = (_B = (_A = self2.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId$1(),
29412
30051
  mediaType: "text/plain",
29413
30052
  title: value.annotation.filename,
29414
30053
  filename: value.annotation.filename,
@@ -29424,7 +30063,7 @@ ${user}:`]
29424
30063
  controller.enqueue({
29425
30064
  type: "source",
29426
30065
  sourceType: "document",
29427
- id: (_D = (_C = (_B = self2.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId$1(),
30066
+ id: (_F = (_E = (_D = self2.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : generateId$1(),
29428
30067
  mediaType: "application/octet-stream",
29429
30068
  title: value.annotation.file_id,
29430
30069
  filename: value.annotation.file_id,
@@ -29504,6 +30143,9 @@ ${user}:`]
29504
30143
  }
29505
30144
  function mapWebSearchOutput(action) {
29506
30145
  var _a10;
30146
+ if (action == null) {
30147
+ return {};
30148
+ }
29507
30149
  switch (action.type) {
29508
30150
  case "search":
29509
30151
  return {
@@ -29856,7 +30498,7 @@ ${user}:`]
29856
30498
  };
29857
30499
  }
29858
30500
  };
29859
- var VERSION$2 = "3.0.28";
30501
+ var VERSION$2 = "3.0.36";
29860
30502
  function createOpenAI(options = {}) {
29861
30503
  var _a10, _b9;
29862
30504
  const baseURL = (_a10 = withoutTrailingSlash$1(
@@ -32921,7 +33563,7 @@ Error message: ${getErrorMessage(cause)}`,
32921
33563
  (function(exports3) {
32922
33564
  Object.defineProperty(exports3, "__esModule", { value: true });
32923
33565
  exports3.ValueScope = exports3.ValueScopeName = exports3.Scope = exports3.varKinds = exports3.UsedValueState = void 0;
32924
- const code_1 = requireCode$1();
33566
+ const code_1 = /* @__PURE__ */ requireCode$1();
32925
33567
  class ValueError extends Error {
32926
33568
  constructor(name16) {
32927
33569
  super(`CodeGen: "code" for ${name16} not defined`);
@@ -33067,9 +33709,9 @@ Error message: ${getErrorMessage(cause)}`,
33067
33709
  (function(exports3) {
33068
33710
  Object.defineProperty(exports3, "__esModule", { value: true });
33069
33711
  exports3.or = exports3.and = exports3.not = exports3.CodeGen = exports3.operators = exports3.varKinds = exports3.ValueScopeName = exports3.ValueScope = exports3.Scope = exports3.Name = exports3.regexpCode = exports3.stringify = exports3.getProperty = exports3.nil = exports3.strConcat = exports3.str = exports3._ = void 0;
33070
- const code_1 = requireCode$1();
33071
- const scope_1 = requireScope();
33072
- var code_2 = requireCode$1();
33712
+ const code_1 = /* @__PURE__ */ requireCode$1();
33713
+ const scope_1 = /* @__PURE__ */ requireScope();
33714
+ var code_2 = /* @__PURE__ */ requireCode$1();
33073
33715
  Object.defineProperty(exports3, "_", { enumerable: true, get: function() {
33074
33716
  return code_2._;
33075
33717
  } });
@@ -33094,7 +33736,7 @@ Error message: ${getErrorMessage(cause)}`,
33094
33736
  Object.defineProperty(exports3, "Name", { enumerable: true, get: function() {
33095
33737
  return code_2.Name;
33096
33738
  } });
33097
- var scope_2 = requireScope();
33739
+ var scope_2 = /* @__PURE__ */ requireScope();
33098
33740
  Object.defineProperty(exports3, "Scope", { enumerable: true, get: function() {
33099
33741
  return scope_2.Scope;
33100
33742
  } });
@@ -33788,8 +34430,8 @@ Error message: ${getErrorMessage(cause)}`,
33788
34430
  hasRequiredUtil = 1;
33789
34431
  Object.defineProperty(util, "__esModule", { value: true });
33790
34432
  util.checkStrictMode = util.getErrorPath = util.Type = util.useFunc = util.setEvaluated = util.evaluatedPropsToName = util.mergeEvaluated = util.eachItem = util.unescapeJsonPointer = util.escapeJsonPointer = util.escapeFragment = util.unescapeFragment = util.schemaRefOrVal = util.schemaHasRulesButRef = util.schemaHasRules = util.checkUnknownRules = util.alwaysValidSchema = util.toHash = void 0;
33791
- const codegen_1 = requireCodegen();
33792
- const code_1 = requireCode$1();
34433
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34434
+ const code_1 = /* @__PURE__ */ requireCode$1();
33793
34435
  function toHash(arr) {
33794
34436
  const hash = {};
33795
34437
  for (const item of arr)
@@ -33954,7 +34596,7 @@ Error message: ${getErrorMessage(cause)}`,
33954
34596
  if (hasRequiredNames) return names;
33955
34597
  hasRequiredNames = 1;
33956
34598
  Object.defineProperty(names, "__esModule", { value: true });
33957
- const codegen_1 = requireCodegen();
34599
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
33958
34600
  const names$1 = {
33959
34601
  // validation function arguments
33960
34602
  data: new codegen_1.Name("data"),
@@ -33994,9 +34636,9 @@ Error message: ${getErrorMessage(cause)}`,
33994
34636
  (function(exports3) {
33995
34637
  Object.defineProperty(exports3, "__esModule", { value: true });
33996
34638
  exports3.extendErrors = exports3.resetErrorsCount = exports3.reportExtraError = exports3.reportError = exports3.keyword$DataError = exports3.keywordError = void 0;
33997
- const codegen_1 = requireCodegen();
33998
- const util_1 = requireUtil();
33999
- const names_1 = requireNames();
34639
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34640
+ const util_1 = /* @__PURE__ */ requireUtil();
34641
+ const names_1 = /* @__PURE__ */ requireNames();
34000
34642
  exports3.keywordError = {
34001
34643
  message: ({ keyword: keyword2 }) => (0, codegen_1.str)`must pass "${keyword2}" keyword validation`
34002
34644
  };
@@ -34116,9 +34758,9 @@ Error message: ${getErrorMessage(cause)}`,
34116
34758
  hasRequiredBoolSchema = 1;
34117
34759
  Object.defineProperty(boolSchema, "__esModule", { value: true });
34118
34760
  boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
34119
- const errors_1 = requireErrors();
34120
- const codegen_1 = requireCodegen();
34121
- const names_1 = requireNames();
34761
+ const errors_1 = /* @__PURE__ */ requireErrors();
34762
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34763
+ const names_1 = /* @__PURE__ */ requireNames();
34122
34764
  const boolError = {
34123
34765
  message: "boolean schema is false"
34124
34766
  };
@@ -34221,11 +34863,11 @@ Error message: ${getErrorMessage(cause)}`,
34221
34863
  hasRequiredDataType = 1;
34222
34864
  Object.defineProperty(dataType, "__esModule", { value: true });
34223
34865
  dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
34224
- const rules_1 = requireRules();
34225
- const applicability_1 = requireApplicability();
34226
- const errors_1 = requireErrors();
34227
- const codegen_1 = requireCodegen();
34228
- const util_1 = requireUtil();
34866
+ const rules_1 = /* @__PURE__ */ requireRules();
34867
+ const applicability_1 = /* @__PURE__ */ requireApplicability();
34868
+ const errors_1 = /* @__PURE__ */ requireErrors();
34869
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34870
+ const util_1 = /* @__PURE__ */ requireUtil();
34229
34871
  var DataType;
34230
34872
  (function(DataType2) {
34231
34873
  DataType2[DataType2["Correct"] = 0] = "Correct";
@@ -34405,8 +35047,8 @@ Error message: ${getErrorMessage(cause)}`,
34405
35047
  hasRequiredDefaults = 1;
34406
35048
  Object.defineProperty(defaults, "__esModule", { value: true });
34407
35049
  defaults.assignDefaults = void 0;
34408
- const codegen_1 = requireCodegen();
34409
- const util_1 = requireUtil();
35050
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
35051
+ const util_1 = /* @__PURE__ */ requireUtil();
34410
35052
  function assignDefaults(it, ty) {
34411
35053
  const { properties: properties2, items: items2 } = it.schema;
34412
35054
  if (ty === "object" && properties2) {
@@ -34443,10 +35085,10 @@ Error message: ${getErrorMessage(cause)}`,
34443
35085
  hasRequiredCode = 1;
34444
35086
  Object.defineProperty(code, "__esModule", { value: true });
34445
35087
  code.validateUnion = code.validateArray = code.usePattern = code.callValidateCode = code.schemaProperties = code.allSchemaProperties = code.noPropertyInData = code.propertyInData = code.isOwnProperty = code.hasPropFunc = code.reportMissingProp = code.checkMissingProp = code.checkReportMissingProp = void 0;
34446
- const codegen_1 = requireCodegen();
34447
- const util_1 = requireUtil();
34448
- const names_1 = requireNames();
34449
- const util_2 = requireUtil();
35088
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
35089
+ const util_1 = /* @__PURE__ */ requireUtil();
35090
+ const names_1 = /* @__PURE__ */ requireNames();
35091
+ const util_2 = /* @__PURE__ */ requireUtil();
34450
35092
  function checkReportMissingProp(cxt, prop) {
34451
35093
  const { gen, data, it } = cxt;
34452
35094
  gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
@@ -34575,10 +35217,10 @@ Error message: ${getErrorMessage(cause)}`,
34575
35217
  hasRequiredKeyword = 1;
34576
35218
  Object.defineProperty(keyword, "__esModule", { value: true });
34577
35219
  keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
34578
- const codegen_1 = requireCodegen();
34579
- const names_1 = requireNames();
34580
- const code_1 = requireCode();
34581
- const errors_1 = requireErrors();
35220
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
35221
+ const names_1 = /* @__PURE__ */ requireNames();
35222
+ const code_1 = /* @__PURE__ */ requireCode();
35223
+ const errors_1 = /* @__PURE__ */ requireErrors();
34582
35224
  function macroKeywordCode(cxt, def) {
34583
35225
  const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
34584
35226
  const macroSchema = def.macro.call(it.self, schema, parentSchema, it);
@@ -34693,8 +35335,8 @@ Error message: ${getErrorMessage(cause)}`,
34693
35335
  hasRequiredSubschema = 1;
34694
35336
  Object.defineProperty(subschema, "__esModule", { value: true });
34695
35337
  subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
34696
- const codegen_1 = requireCodegen();
34697
- const util_1 = requireUtil();
35338
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
35339
+ const util_1 = /* @__PURE__ */ requireUtil();
34698
35340
  function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
34699
35341
  if (keyword2 !== void 0 && schema !== void 0) {
34700
35342
  throw new Error('both "keyword" and "schema" passed, only one allowed');
@@ -34899,7 +35541,7 @@ Error message: ${getErrorMessage(cause)}`,
34899
35541
  hasRequiredResolve = 1;
34900
35542
  Object.defineProperty(resolve, "__esModule", { value: true });
34901
35543
  resolve.getSchemaRefs = resolve.resolveUrl = resolve.normalizeId = resolve._getFullPath = resolve.getFullPath = resolve.inlineRef = void 0;
34902
- const util_1 = requireUtil();
35544
+ const util_1 = /* @__PURE__ */ requireUtil();
34903
35545
  const equal2 = requireFastDeepEqual();
34904
35546
  const traverse = requireJsonSchemaTraverse();
34905
35547
  const SIMPLE_INLINED = /* @__PURE__ */ new Set([
@@ -35054,18 +35696,18 @@ Error message: ${getErrorMessage(cause)}`,
35054
35696
  hasRequiredValidate = 1;
35055
35697
  Object.defineProperty(validate, "__esModule", { value: true });
35056
35698
  validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
35057
- const boolSchema_1 = requireBoolSchema();
35058
- const dataType_1 = requireDataType();
35059
- const applicability_1 = requireApplicability();
35060
- const dataType_2 = requireDataType();
35061
- const defaults_1 = requireDefaults();
35062
- const keyword_1 = requireKeyword();
35063
- const subschema_1 = requireSubschema();
35064
- const codegen_1 = requireCodegen();
35065
- const names_1 = requireNames();
35066
- const resolve_1 = requireResolve();
35067
- const util_1 = requireUtil();
35068
- const errors_1 = requireErrors();
35699
+ const boolSchema_1 = /* @__PURE__ */ requireBoolSchema();
35700
+ const dataType_1 = /* @__PURE__ */ requireDataType();
35701
+ const applicability_1 = /* @__PURE__ */ requireApplicability();
35702
+ const dataType_2 = /* @__PURE__ */ requireDataType();
35703
+ const defaults_1 = /* @__PURE__ */ requireDefaults();
35704
+ const keyword_1 = /* @__PURE__ */ requireKeyword();
35705
+ const subschema_1 = /* @__PURE__ */ requireSubschema();
35706
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
35707
+ const names_1 = /* @__PURE__ */ requireNames();
35708
+ const resolve_1 = /* @__PURE__ */ requireResolve();
35709
+ const util_1 = /* @__PURE__ */ requireUtil();
35710
+ const errors_1 = /* @__PURE__ */ requireErrors();
35069
35711
  function validateFunctionCode(it) {
35070
35712
  if (isSchemaObj(it)) {
35071
35713
  checkKeywords(it);
@@ -35576,7 +36218,7 @@ Error message: ${getErrorMessage(cause)}`,
35576
36218
  if (hasRequiredRef_error) return ref_error;
35577
36219
  hasRequiredRef_error = 1;
35578
36220
  Object.defineProperty(ref_error, "__esModule", { value: true });
35579
- const resolve_1 = requireResolve();
36221
+ const resolve_1 = /* @__PURE__ */ requireResolve();
35580
36222
  class MissingRefError extends Error {
35581
36223
  constructor(resolver, baseId, ref2, msg) {
35582
36224
  super(msg || `can't resolve reference ${ref2} from id ${baseId}`);
@@ -35594,12 +36236,12 @@ Error message: ${getErrorMessage(cause)}`,
35594
36236
  hasRequiredCompile = 1;
35595
36237
  Object.defineProperty(compile, "__esModule", { value: true });
35596
36238
  compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
35597
- const codegen_1 = requireCodegen();
35598
- const validation_error_1 = requireValidation_error();
35599
- const names_1 = requireNames();
35600
- const resolve_1 = requireResolve();
35601
- const util_1 = requireUtil();
35602
- const validate_1 = requireValidate();
36239
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
36240
+ const validation_error_1 = /* @__PURE__ */ requireValidation_error();
36241
+ const names_1 = /* @__PURE__ */ requireNames();
36242
+ const resolve_1 = /* @__PURE__ */ requireResolve();
36243
+ const util_1 = /* @__PURE__ */ requireUtil();
36244
+ const validate_1 = /* @__PURE__ */ requireValidate();
35603
36245
  class SchemaEnv {
35604
36246
  constructor(env) {
35605
36247
  var _a10;
@@ -36565,11 +37207,11 @@ Error message: ${getErrorMessage(cause)}`,
36565
37207
  (function(exports3) {
36566
37208
  Object.defineProperty(exports3, "__esModule", { value: true });
36567
37209
  exports3.CodeGen = exports3.Name = exports3.nil = exports3.stringify = exports3.str = exports3._ = exports3.KeywordCxt = void 0;
36568
- var validate_1 = requireValidate();
37210
+ var validate_1 = /* @__PURE__ */ requireValidate();
36569
37211
  Object.defineProperty(exports3, "KeywordCxt", { enumerable: true, get: function() {
36570
37212
  return validate_1.KeywordCxt;
36571
37213
  } });
36572
- var codegen_1 = requireCodegen();
37214
+ var codegen_1 = /* @__PURE__ */ requireCodegen();
36573
37215
  Object.defineProperty(exports3, "_", { enumerable: true, get: function() {
36574
37216
  return codegen_1._;
36575
37217
  } });
@@ -36588,16 +37230,16 @@ Error message: ${getErrorMessage(cause)}`,
36588
37230
  Object.defineProperty(exports3, "CodeGen", { enumerable: true, get: function() {
36589
37231
  return codegen_1.CodeGen;
36590
37232
  } });
36591
- const validation_error_1 = requireValidation_error();
36592
- const ref_error_1 = requireRef_error();
36593
- const rules_1 = requireRules();
36594
- const compile_1 = requireCompile();
36595
- const codegen_2 = requireCodegen();
36596
- const resolve_1 = requireResolve();
36597
- const dataType_1 = requireDataType();
36598
- const util_1 = requireUtil();
37233
+ const validation_error_1 = /* @__PURE__ */ requireValidation_error();
37234
+ const ref_error_1 = /* @__PURE__ */ requireRef_error();
37235
+ const rules_1 = /* @__PURE__ */ requireRules();
37236
+ const compile_1 = /* @__PURE__ */ requireCompile();
37237
+ const codegen_2 = /* @__PURE__ */ requireCodegen();
37238
+ const resolve_1 = /* @__PURE__ */ requireResolve();
37239
+ const dataType_1 = /* @__PURE__ */ requireDataType();
37240
+ const util_1 = /* @__PURE__ */ requireUtil();
36599
37241
  const $dataRefSchema = require$$9;
36600
- const uri_1 = requireUri();
37242
+ const uri_1 = /* @__PURE__ */ requireUri();
36601
37243
  const defaultRegExp = (str, flags) => new RegExp(str, flags);
36602
37244
  defaultRegExp.code = "new RegExp";
36603
37245
  const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
@@ -37194,12 +37836,12 @@ Error message: ${getErrorMessage(cause)}`,
37194
37836
  hasRequiredRef = 1;
37195
37837
  Object.defineProperty(ref, "__esModule", { value: true });
37196
37838
  ref.callRef = ref.getValidate = void 0;
37197
- const ref_error_1 = requireRef_error();
37198
- const code_1 = requireCode();
37199
- const codegen_1 = requireCodegen();
37200
- const names_1 = requireNames();
37201
- const compile_1 = requireCompile();
37202
- const util_1 = requireUtil();
37839
+ const ref_error_1 = /* @__PURE__ */ requireRef_error();
37840
+ const code_1 = /* @__PURE__ */ requireCode();
37841
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37842
+ const names_1 = /* @__PURE__ */ requireNames();
37843
+ const compile_1 = /* @__PURE__ */ requireCompile();
37844
+ const util_1 = /* @__PURE__ */ requireUtil();
37203
37845
  const def = {
37204
37846
  keyword: "$ref",
37205
37847
  schemaType: "string",
@@ -37314,8 +37956,8 @@ Error message: ${getErrorMessage(cause)}`,
37314
37956
  if (hasRequiredCore) return core;
37315
37957
  hasRequiredCore = 1;
37316
37958
  Object.defineProperty(core, "__esModule", { value: true });
37317
- const id_1 = requireId();
37318
- const ref_1 = requireRef();
37959
+ const id_1 = /* @__PURE__ */ requireId();
37960
+ const ref_1 = /* @__PURE__ */ requireRef();
37319
37961
  const core$12 = [
37320
37962
  "$schema",
37321
37963
  "$id",
@@ -37336,7 +37978,7 @@ Error message: ${getErrorMessage(cause)}`,
37336
37978
  if (hasRequiredLimitNumber) return limitNumber;
37337
37979
  hasRequiredLimitNumber = 1;
37338
37980
  Object.defineProperty(limitNumber, "__esModule", { value: true });
37339
- const codegen_1 = requireCodegen();
37981
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37340
37982
  const ops = codegen_1.operators;
37341
37983
  const KWDs = {
37342
37984
  maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
@@ -37368,7 +38010,7 @@ Error message: ${getErrorMessage(cause)}`,
37368
38010
  if (hasRequiredMultipleOf) return multipleOf;
37369
38011
  hasRequiredMultipleOf = 1;
37370
38012
  Object.defineProperty(multipleOf, "__esModule", { value: true });
37371
- const codegen_1 = requireCodegen();
38013
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37372
38014
  const error = {
37373
38015
  message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
37374
38016
  params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
@@ -37422,9 +38064,9 @@ Error message: ${getErrorMessage(cause)}`,
37422
38064
  if (hasRequiredLimitLength) return limitLength;
37423
38065
  hasRequiredLimitLength = 1;
37424
38066
  Object.defineProperty(limitLength, "__esModule", { value: true });
37425
- const codegen_1 = requireCodegen();
37426
- const util_1 = requireUtil();
37427
- const ucs2length_1 = requireUcs2length();
38067
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38068
+ const util_1 = /* @__PURE__ */ requireUtil();
38069
+ const ucs2length_1 = /* @__PURE__ */ requireUcs2length();
37428
38070
  const error = {
37429
38071
  message({ keyword: keyword2, schemaCode }) {
37430
38072
  const comp = keyword2 === "maxLength" ? "more" : "fewer";
@@ -37454,8 +38096,9 @@ Error message: ${getErrorMessage(cause)}`,
37454
38096
  if (hasRequiredPattern) return pattern;
37455
38097
  hasRequiredPattern = 1;
37456
38098
  Object.defineProperty(pattern, "__esModule", { value: true });
37457
- const code_1 = requireCode();
37458
- const codegen_1 = requireCodegen();
38099
+ const code_1 = /* @__PURE__ */ requireCode();
38100
+ const util_1 = /* @__PURE__ */ requireUtil();
38101
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37459
38102
  const error = {
37460
38103
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
37461
38104
  params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
@@ -37467,10 +38110,18 @@ Error message: ${getErrorMessage(cause)}`,
37467
38110
  $data: true,
37468
38111
  error,
37469
38112
  code(cxt) {
37470
- const { data, $data, schema, schemaCode, it } = cxt;
38113
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
37471
38114
  const u = it.opts.unicodeRegExp ? "u" : "";
37472
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
37473
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
38115
+ if ($data) {
38116
+ const { regExp } = it.opts.code;
38117
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
38118
+ const valid = gen.let("valid");
38119
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
38120
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
38121
+ } else {
38122
+ const regExp = (0, code_1.usePattern)(cxt, schema);
38123
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
38124
+ }
37474
38125
  }
37475
38126
  };
37476
38127
  pattern.default = def;
@@ -37482,7 +38133,7 @@ Error message: ${getErrorMessage(cause)}`,
37482
38133
  if (hasRequiredLimitProperties) return limitProperties;
37483
38134
  hasRequiredLimitProperties = 1;
37484
38135
  Object.defineProperty(limitProperties, "__esModule", { value: true });
37485
- const codegen_1 = requireCodegen();
38136
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37486
38137
  const error = {
37487
38138
  message({ keyword: keyword2, schemaCode }) {
37488
38139
  const comp = keyword2 === "maxProperties" ? "more" : "fewer";
@@ -37511,9 +38162,9 @@ Error message: ${getErrorMessage(cause)}`,
37511
38162
  if (hasRequiredRequired) return required;
37512
38163
  hasRequiredRequired = 1;
37513
38164
  Object.defineProperty(required, "__esModule", { value: true });
37514
- const code_1 = requireCode();
37515
- const codegen_1 = requireCodegen();
37516
- const util_1 = requireUtil();
38165
+ const code_1 = /* @__PURE__ */ requireCode();
38166
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38167
+ const util_1 = /* @__PURE__ */ requireUtil();
37517
38168
  const error = {
37518
38169
  message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
37519
38170
  params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
@@ -37593,7 +38244,7 @@ Error message: ${getErrorMessage(cause)}`,
37593
38244
  if (hasRequiredLimitItems) return limitItems;
37594
38245
  hasRequiredLimitItems = 1;
37595
38246
  Object.defineProperty(limitItems, "__esModule", { value: true });
37596
- const codegen_1 = requireCodegen();
38247
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37597
38248
  const error = {
37598
38249
  message({ keyword: keyword2, schemaCode }) {
37599
38250
  const comp = keyword2 === "maxItems" ? "more" : "fewer";
@@ -37633,10 +38284,10 @@ Error message: ${getErrorMessage(cause)}`,
37633
38284
  if (hasRequiredUniqueItems) return uniqueItems;
37634
38285
  hasRequiredUniqueItems = 1;
37635
38286
  Object.defineProperty(uniqueItems, "__esModule", { value: true });
37636
- const dataType_1 = requireDataType();
37637
- const codegen_1 = requireCodegen();
37638
- const util_1 = requireUtil();
37639
- const equal_1 = requireEqual();
38287
+ const dataType_1 = /* @__PURE__ */ requireDataType();
38288
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38289
+ const util_1 = /* @__PURE__ */ requireUtil();
38290
+ const equal_1 = /* @__PURE__ */ requireEqual();
37640
38291
  const error = {
37641
38292
  message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
37642
38293
  params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
@@ -37700,9 +38351,9 @@ Error message: ${getErrorMessage(cause)}`,
37700
38351
  if (hasRequired_const) return _const;
37701
38352
  hasRequired_const = 1;
37702
38353
  Object.defineProperty(_const, "__esModule", { value: true });
37703
- const codegen_1 = requireCodegen();
37704
- const util_1 = requireUtil();
37705
- const equal_1 = requireEqual();
38354
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38355
+ const util_1 = /* @__PURE__ */ requireUtil();
38356
+ const equal_1 = /* @__PURE__ */ requireEqual();
37706
38357
  const error = {
37707
38358
  message: "must be equal to constant",
37708
38359
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
@@ -37729,9 +38380,9 @@ Error message: ${getErrorMessage(cause)}`,
37729
38380
  if (hasRequired_enum) return _enum;
37730
38381
  hasRequired_enum = 1;
37731
38382
  Object.defineProperty(_enum, "__esModule", { value: true });
37732
- const codegen_1 = requireCodegen();
37733
- const util_1 = requireUtil();
37734
- const equal_1 = requireEqual();
38383
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38384
+ const util_1 = /* @__PURE__ */ requireUtil();
38385
+ const equal_1 = /* @__PURE__ */ requireEqual();
37735
38386
  const error = {
37736
38387
  message: "must be equal to one of the allowed values",
37737
38388
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
@@ -37777,16 +38428,16 @@ Error message: ${getErrorMessage(cause)}`,
37777
38428
  if (hasRequiredValidation) return validation;
37778
38429
  hasRequiredValidation = 1;
37779
38430
  Object.defineProperty(validation, "__esModule", { value: true });
37780
- const limitNumber_1 = requireLimitNumber();
37781
- const multipleOf_1 = requireMultipleOf();
37782
- const limitLength_1 = requireLimitLength();
37783
- const pattern_1 = requirePattern();
37784
- const limitProperties_1 = requireLimitProperties();
37785
- const required_1 = requireRequired();
37786
- const limitItems_1 = requireLimitItems();
37787
- const uniqueItems_1 = requireUniqueItems();
37788
- const const_1 = require_const();
37789
- const enum_1 = require_enum();
38431
+ const limitNumber_1 = /* @__PURE__ */ requireLimitNumber();
38432
+ const multipleOf_1 = /* @__PURE__ */ requireMultipleOf();
38433
+ const limitLength_1 = /* @__PURE__ */ requireLimitLength();
38434
+ const pattern_1 = /* @__PURE__ */ requirePattern();
38435
+ const limitProperties_1 = /* @__PURE__ */ requireLimitProperties();
38436
+ const required_1 = /* @__PURE__ */ requireRequired();
38437
+ const limitItems_1 = /* @__PURE__ */ requireLimitItems();
38438
+ const uniqueItems_1 = /* @__PURE__ */ requireUniqueItems();
38439
+ const const_1 = /* @__PURE__ */ require_const();
38440
+ const enum_1 = /* @__PURE__ */ require_enum();
37790
38441
  const validation$1 = [
37791
38442
  // number
37792
38443
  limitNumber_1.default,
@@ -37817,8 +38468,8 @@ Error message: ${getErrorMessage(cause)}`,
37817
38468
  hasRequiredAdditionalItems = 1;
37818
38469
  Object.defineProperty(additionalItems, "__esModule", { value: true });
37819
38470
  additionalItems.validateAdditionalItems = void 0;
37820
- const codegen_1 = requireCodegen();
37821
- const util_1 = requireUtil();
38471
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38472
+ const util_1 = /* @__PURE__ */ requireUtil();
37822
38473
  const error = {
37823
38474
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
37824
38475
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
@@ -37871,9 +38522,9 @@ Error message: ${getErrorMessage(cause)}`,
37871
38522
  hasRequiredItems = 1;
37872
38523
  Object.defineProperty(items, "__esModule", { value: true });
37873
38524
  items.validateTuple = void 0;
37874
- const codegen_1 = requireCodegen();
37875
- const util_1 = requireUtil();
37876
- const code_1 = requireCode();
38525
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38526
+ const util_1 = /* @__PURE__ */ requireUtil();
38527
+ const code_1 = /* @__PURE__ */ requireCode();
37877
38528
  const def = {
37878
38529
  keyword: "items",
37879
38530
  type: "array",
@@ -37926,7 +38577,7 @@ Error message: ${getErrorMessage(cause)}`,
37926
38577
  if (hasRequiredPrefixItems) return prefixItems;
37927
38578
  hasRequiredPrefixItems = 1;
37928
38579
  Object.defineProperty(prefixItems, "__esModule", { value: true });
37929
- const items_1 = requireItems();
38580
+ const items_1 = /* @__PURE__ */ requireItems();
37930
38581
  const def = {
37931
38582
  keyword: "prefixItems",
37932
38583
  type: "array",
@@ -37943,10 +38594,10 @@ Error message: ${getErrorMessage(cause)}`,
37943
38594
  if (hasRequiredItems2020) return items2020;
37944
38595
  hasRequiredItems2020 = 1;
37945
38596
  Object.defineProperty(items2020, "__esModule", { value: true });
37946
- const codegen_1 = requireCodegen();
37947
- const util_1 = requireUtil();
37948
- const code_1 = requireCode();
37949
- const additionalItems_1 = requireAdditionalItems();
38597
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38598
+ const util_1 = /* @__PURE__ */ requireUtil();
38599
+ const code_1 = /* @__PURE__ */ requireCode();
38600
+ const additionalItems_1 = /* @__PURE__ */ requireAdditionalItems();
37950
38601
  const error = {
37951
38602
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
37952
38603
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
@@ -37978,8 +38629,8 @@ Error message: ${getErrorMessage(cause)}`,
37978
38629
  if (hasRequiredContains) return contains;
37979
38630
  hasRequiredContains = 1;
37980
38631
  Object.defineProperty(contains, "__esModule", { value: true });
37981
- const codegen_1 = requireCodegen();
37982
- const util_1 = requireUtil();
38632
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38633
+ const util_1 = /* @__PURE__ */ requireUtil();
37983
38634
  const error = {
37984
38635
  message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
37985
38636
  params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
@@ -38074,9 +38725,9 @@ Error message: ${getErrorMessage(cause)}`,
38074
38725
  (function(exports3) {
38075
38726
  Object.defineProperty(exports3, "__esModule", { value: true });
38076
38727
  exports3.validateSchemaDeps = exports3.validatePropertyDeps = exports3.error = void 0;
38077
- const codegen_1 = requireCodegen();
38078
- const util_1 = requireUtil();
38079
- const code_1 = requireCode();
38728
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38729
+ const util_1 = /* @__PURE__ */ requireUtil();
38730
+ const code_1 = /* @__PURE__ */ requireCode();
38080
38731
  exports3.error = {
38081
38732
  message: ({ params: { property, depsCount, deps } }) => {
38082
38733
  const property_ies = depsCount === 1 ? "property" : "properties";
@@ -38168,8 +38819,8 @@ Error message: ${getErrorMessage(cause)}`,
38168
38819
  if (hasRequiredPropertyNames) return propertyNames;
38169
38820
  hasRequiredPropertyNames = 1;
38170
38821
  Object.defineProperty(propertyNames, "__esModule", { value: true });
38171
- const codegen_1 = requireCodegen();
38172
- const util_1 = requireUtil();
38822
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38823
+ const util_1 = /* @__PURE__ */ requireUtil();
38173
38824
  const error = {
38174
38825
  message: "property name must be valid",
38175
38826
  params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
@@ -38211,10 +38862,10 @@ Error message: ${getErrorMessage(cause)}`,
38211
38862
  if (hasRequiredAdditionalProperties) return additionalProperties;
38212
38863
  hasRequiredAdditionalProperties = 1;
38213
38864
  Object.defineProperty(additionalProperties, "__esModule", { value: true });
38214
- const code_1 = requireCode();
38215
- const codegen_1 = requireCodegen();
38216
- const names_1 = requireNames();
38217
- const util_1 = requireUtil();
38865
+ const code_1 = /* @__PURE__ */ requireCode();
38866
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38867
+ const names_1 = /* @__PURE__ */ requireNames();
38868
+ const util_1 = /* @__PURE__ */ requireUtil();
38218
38869
  const error = {
38219
38870
  message: "must NOT have additional properties",
38220
38871
  params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
@@ -38317,10 +38968,10 @@ Error message: ${getErrorMessage(cause)}`,
38317
38968
  if (hasRequiredProperties) return properties$1;
38318
38969
  hasRequiredProperties = 1;
38319
38970
  Object.defineProperty(properties$1, "__esModule", { value: true });
38320
- const validate_1 = requireValidate();
38321
- const code_1 = requireCode();
38322
- const util_1 = requireUtil();
38323
- const additionalProperties_1 = requireAdditionalProperties();
38971
+ const validate_1 = /* @__PURE__ */ requireValidate();
38972
+ const code_1 = /* @__PURE__ */ requireCode();
38973
+ const util_1 = /* @__PURE__ */ requireUtil();
38974
+ const additionalProperties_1 = /* @__PURE__ */ requireAdditionalProperties();
38324
38975
  const def = {
38325
38976
  keyword: "properties",
38326
38977
  type: "object",
@@ -38375,10 +39026,10 @@ Error message: ${getErrorMessage(cause)}`,
38375
39026
  if (hasRequiredPatternProperties) return patternProperties;
38376
39027
  hasRequiredPatternProperties = 1;
38377
39028
  Object.defineProperty(patternProperties, "__esModule", { value: true });
38378
- const code_1 = requireCode();
38379
- const codegen_1 = requireCodegen();
38380
- const util_1 = requireUtil();
38381
- const util_2 = requireUtil();
39029
+ const code_1 = /* @__PURE__ */ requireCode();
39030
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
39031
+ const util_1 = /* @__PURE__ */ requireUtil();
39032
+ const util_2 = /* @__PURE__ */ requireUtil();
38382
39033
  const def = {
38383
39034
  keyword: "patternProperties",
38384
39035
  type: "object",
@@ -38449,7 +39100,7 @@ Error message: ${getErrorMessage(cause)}`,
38449
39100
  if (hasRequiredNot) return not;
38450
39101
  hasRequiredNot = 1;
38451
39102
  Object.defineProperty(not, "__esModule", { value: true });
38452
- const util_1 = requireUtil();
39103
+ const util_1 = /* @__PURE__ */ requireUtil();
38453
39104
  const def = {
38454
39105
  keyword: "not",
38455
39106
  schemaType: ["object", "boolean"],
@@ -38480,7 +39131,7 @@ Error message: ${getErrorMessage(cause)}`,
38480
39131
  if (hasRequiredAnyOf) return anyOf;
38481
39132
  hasRequiredAnyOf = 1;
38482
39133
  Object.defineProperty(anyOf, "__esModule", { value: true });
38483
- const code_1 = requireCode();
39134
+ const code_1 = /* @__PURE__ */ requireCode();
38484
39135
  const def = {
38485
39136
  keyword: "anyOf",
38486
39137
  schemaType: "array",
@@ -38497,8 +39148,8 @@ Error message: ${getErrorMessage(cause)}`,
38497
39148
  if (hasRequiredOneOf) return oneOf;
38498
39149
  hasRequiredOneOf = 1;
38499
39150
  Object.defineProperty(oneOf, "__esModule", { value: true });
38500
- const codegen_1 = requireCodegen();
38501
- const util_1 = requireUtil();
39151
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
39152
+ const util_1 = /* @__PURE__ */ requireUtil();
38502
39153
  const error = {
38503
39154
  message: "must match exactly one schema in oneOf",
38504
39155
  params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
@@ -38555,7 +39206,7 @@ Error message: ${getErrorMessage(cause)}`,
38555
39206
  if (hasRequiredAllOf) return allOf;
38556
39207
  hasRequiredAllOf = 1;
38557
39208
  Object.defineProperty(allOf, "__esModule", { value: true });
38558
- const util_1 = requireUtil();
39209
+ const util_1 = /* @__PURE__ */ requireUtil();
38559
39210
  const def = {
38560
39211
  keyword: "allOf",
38561
39212
  schemaType: "array",
@@ -38582,8 +39233,8 @@ Error message: ${getErrorMessage(cause)}`,
38582
39233
  if (hasRequired_if) return _if;
38583
39234
  hasRequired_if = 1;
38584
39235
  Object.defineProperty(_if, "__esModule", { value: true });
38585
- const codegen_1 = requireCodegen();
38586
- const util_1 = requireUtil();
39236
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
39237
+ const util_1 = /* @__PURE__ */ requireUtil();
38587
39238
  const error = {
38588
39239
  message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
38589
39240
  params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
@@ -38651,7 +39302,7 @@ Error message: ${getErrorMessage(cause)}`,
38651
39302
  if (hasRequiredThenElse) return thenElse;
38652
39303
  hasRequiredThenElse = 1;
38653
39304
  Object.defineProperty(thenElse, "__esModule", { value: true });
38654
- const util_1 = requireUtil();
39305
+ const util_1 = /* @__PURE__ */ requireUtil();
38655
39306
  const def = {
38656
39307
  keyword: ["then", "else"],
38657
39308
  schemaType: ["object", "boolean"],
@@ -38668,22 +39319,22 @@ Error message: ${getErrorMessage(cause)}`,
38668
39319
  if (hasRequiredApplicator) return applicator;
38669
39320
  hasRequiredApplicator = 1;
38670
39321
  Object.defineProperty(applicator, "__esModule", { value: true });
38671
- const additionalItems_1 = requireAdditionalItems();
38672
- const prefixItems_1 = requirePrefixItems();
38673
- const items_1 = requireItems();
38674
- const items2020_1 = requireItems2020();
38675
- const contains_1 = requireContains();
38676
- const dependencies_1 = requireDependencies();
38677
- const propertyNames_1 = requirePropertyNames();
38678
- const additionalProperties_1 = requireAdditionalProperties();
38679
- const properties_1 = requireProperties();
38680
- const patternProperties_1 = requirePatternProperties();
38681
- const not_1 = requireNot();
38682
- const anyOf_1 = requireAnyOf();
38683
- const oneOf_1 = requireOneOf();
38684
- const allOf_1 = requireAllOf();
38685
- const if_1 = require_if();
38686
- const thenElse_1 = requireThenElse();
39322
+ const additionalItems_1 = /* @__PURE__ */ requireAdditionalItems();
39323
+ const prefixItems_1 = /* @__PURE__ */ requirePrefixItems();
39324
+ const items_1 = /* @__PURE__ */ requireItems();
39325
+ const items2020_1 = /* @__PURE__ */ requireItems2020();
39326
+ const contains_1 = /* @__PURE__ */ requireContains();
39327
+ const dependencies_1 = /* @__PURE__ */ requireDependencies();
39328
+ const propertyNames_1 = /* @__PURE__ */ requirePropertyNames();
39329
+ const additionalProperties_1 = /* @__PURE__ */ requireAdditionalProperties();
39330
+ const properties_1 = /* @__PURE__ */ requireProperties();
39331
+ const patternProperties_1 = /* @__PURE__ */ requirePatternProperties();
39332
+ const not_1 = /* @__PURE__ */ requireNot();
39333
+ const anyOf_1 = /* @__PURE__ */ requireAnyOf();
39334
+ const oneOf_1 = /* @__PURE__ */ requireOneOf();
39335
+ const allOf_1 = /* @__PURE__ */ requireAllOf();
39336
+ const if_1 = /* @__PURE__ */ require_if();
39337
+ const thenElse_1 = /* @__PURE__ */ requireThenElse();
38687
39338
  function getApplicator(draft2020 = false) {
38688
39339
  const applicator2 = [
38689
39340
  // any
@@ -38717,7 +39368,7 @@ Error message: ${getErrorMessage(cause)}`,
38717
39368
  if (hasRequiredFormat$1) return format;
38718
39369
  hasRequiredFormat$1 = 1;
38719
39370
  Object.defineProperty(format, "__esModule", { value: true });
38720
- const codegen_1 = requireCodegen();
39371
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38721
39372
  const error = {
38722
39373
  message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
38723
39374
  params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
@@ -38806,7 +39457,7 @@ Error message: ${getErrorMessage(cause)}`,
38806
39457
  if (hasRequiredFormat) return format$1;
38807
39458
  hasRequiredFormat = 1;
38808
39459
  Object.defineProperty(format$1, "__esModule", { value: true });
38809
- const format_1 = requireFormat$1();
39460
+ const format_1 = /* @__PURE__ */ requireFormat$1();
38810
39461
  const format2 = [format_1.default];
38811
39462
  format$1.default = format2;
38812
39463
  return format$1;
@@ -38839,11 +39490,11 @@ Error message: ${getErrorMessage(cause)}`,
38839
39490
  if (hasRequiredDraft7) return draft7;
38840
39491
  hasRequiredDraft7 = 1;
38841
39492
  Object.defineProperty(draft7, "__esModule", { value: true });
38842
- const core_1 = requireCore();
38843
- const validation_1 = requireValidation();
38844
- const applicator_1 = requireApplicator();
38845
- const format_1 = requireFormat();
38846
- const metadata_1 = requireMetadata();
39493
+ const core_1 = /* @__PURE__ */ requireCore();
39494
+ const validation_1 = /* @__PURE__ */ requireValidation();
39495
+ const applicator_1 = /* @__PURE__ */ requireApplicator();
39496
+ const format_1 = /* @__PURE__ */ requireFormat();
39497
+ const metadata_1 = /* @__PURE__ */ requireMetadata();
38847
39498
  const draft7Vocabularies = [
38848
39499
  core_1.default,
38849
39500
  validation_1.default,
@@ -38875,11 +39526,11 @@ Error message: ${getErrorMessage(cause)}`,
38875
39526
  if (hasRequiredDiscriminator) return discriminator;
38876
39527
  hasRequiredDiscriminator = 1;
38877
39528
  Object.defineProperty(discriminator, "__esModule", { value: true });
38878
- const codegen_1 = requireCodegen();
38879
- const types_1 = requireTypes();
38880
- const compile_1 = requireCompile();
38881
- const ref_error_1 = requireRef_error();
38882
- const util_1 = requireUtil();
39529
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
39530
+ const types_1 = /* @__PURE__ */ requireTypes();
39531
+ const compile_1 = /* @__PURE__ */ requireCompile();
39532
+ const ref_error_1 = /* @__PURE__ */ requireRef_error();
39533
+ const util_1 = /* @__PURE__ */ requireUtil();
38883
39534
  const error = {
38884
39535
  message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
38885
39536
  params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
@@ -38996,9 +39647,9 @@ Error message: ${getErrorMessage(cause)}`,
38996
39647
  (function(module2, exports3) {
38997
39648
  Object.defineProperty(exports3, "__esModule", { value: true });
38998
39649
  exports3.MissingRefError = exports3.ValidationError = exports3.CodeGen = exports3.Name = exports3.nil = exports3.stringify = exports3.str = exports3._ = exports3.KeywordCxt = exports3.Ajv = void 0;
38999
- const core_1 = requireCore$1();
39000
- const draft7_1 = requireDraft7();
39001
- const discriminator_1 = requireDiscriminator();
39650
+ const core_1 = /* @__PURE__ */ requireCore$1();
39651
+ const draft7_1 = /* @__PURE__ */ requireDraft7();
39652
+ const discriminator_1 = /* @__PURE__ */ requireDiscriminator();
39002
39653
  const draft7MetaSchema = require$$3;
39003
39654
  const META_SUPPORT_DATA = ["/properties"];
39004
39655
  const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
@@ -39026,11 +39677,11 @@ Error message: ${getErrorMessage(cause)}`,
39026
39677
  module2.exports.Ajv = Ajv2;
39027
39678
  Object.defineProperty(exports3, "__esModule", { value: true });
39028
39679
  exports3.default = Ajv2;
39029
- var validate_1 = requireValidate();
39680
+ var validate_1 = /* @__PURE__ */ requireValidate();
39030
39681
  Object.defineProperty(exports3, "KeywordCxt", { enumerable: true, get: function() {
39031
39682
  return validate_1.KeywordCxt;
39032
39683
  } });
39033
- var codegen_1 = requireCodegen();
39684
+ var codegen_1 = /* @__PURE__ */ requireCodegen();
39034
39685
  Object.defineProperty(exports3, "_", { enumerable: true, get: function() {
39035
39686
  return codegen_1._;
39036
39687
  } });
@@ -39049,18 +39700,18 @@ Error message: ${getErrorMessage(cause)}`,
39049
39700
  Object.defineProperty(exports3, "CodeGen", { enumerable: true, get: function() {
39050
39701
  return codegen_1.CodeGen;
39051
39702
  } });
39052
- var validation_error_1 = requireValidation_error();
39703
+ var validation_error_1 = /* @__PURE__ */ requireValidation_error();
39053
39704
  Object.defineProperty(exports3, "ValidationError", { enumerable: true, get: function() {
39054
39705
  return validation_error_1.default;
39055
39706
  } });
39056
- var ref_error_1 = requireRef_error();
39707
+ var ref_error_1 = /* @__PURE__ */ requireRef_error();
39057
39708
  Object.defineProperty(exports3, "MissingRefError", { enumerable: true, get: function() {
39058
39709
  return ref_error_1.default;
39059
39710
  } });
39060
39711
  })(ajv, ajv.exports);
39061
39712
  return ajv.exports;
39062
39713
  }
39063
- var ajvExports = requireAjv();
39714
+ var ajvExports = /* @__PURE__ */ requireAjv();
39064
39715
  const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports);
39065
39716
  var dist = { exports: {} };
39066
39717
  var formats = {};
@@ -39276,8 +39927,8 @@ Error message: ${getErrorMessage(cause)}`,
39276
39927
  (function(exports3) {
39277
39928
  Object.defineProperty(exports3, "__esModule", { value: true });
39278
39929
  exports3.formatLimitDefinition = void 0;
39279
- const ajv_1 = requireAjv();
39280
- const codegen_1 = requireCodegen();
39930
+ const ajv_1 = /* @__PURE__ */ requireAjv();
39931
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
39281
39932
  const ops = codegen_1.operators;
39282
39933
  const KWDs = {
39283
39934
  formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
@@ -39350,7 +40001,7 @@ Error message: ${getErrorMessage(cause)}`,
39350
40001
  Object.defineProperty(exports3, "__esModule", { value: true });
39351
40002
  const formats_1 = requireFormats();
39352
40003
  const limit_1 = requireLimit();
39353
- const codegen_1 = requireCodegen();
40004
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
39354
40005
  const fullName = new codegen_1.Name("fullFormats");
39355
40006
  const fastName = new codegen_1.Name("fastFormats");
39356
40007
  const formatsPlugin = (ajv2, opts = { keywords: true }) => {