@opentiny/next-sdk 0.2.4 → 0.2.5

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.
@@ -11321,17 +11321,14 @@ var GatewayVideoModel = class {
11321
11321
  var _a92;
11322
11322
  const resolvedHeaders = await resolve$1(this.config.headers());
11323
11323
  try {
11324
- const {
11325
- responseHeaders,
11326
- value: responseBody,
11327
- rawValue
11328
- } = await postJsonToApi$1({
11324
+ const { responseHeaders, value: responseBody } = await postJsonToApi$1({
11329
11325
  url: this.getUrl(),
11330
11326
  headers: combineHeaders$1(
11331
11327
  resolvedHeaders,
11332
11328
  headers != null ? headers : {},
11333
11329
  this.getModelConfigHeaders(),
11334
- await resolve$1(this.config.o11yHeaders)
11330
+ await resolve$1(this.config.o11yHeaders),
11331
+ { accept: "text/event-stream" }
11335
11332
  ),
11336
11333
  body: {
11337
11334
  prompt,
@@ -11344,9 +11341,70 @@ var GatewayVideoModel = class {
11344
11341
  ...providerOptions && { providerOptions },
11345
11342
  ...image && { image: maybeEncodeVideoFile(image) }
11346
11343
  },
11347
- successfulResponseHandler: createJsonResponseHandler$1(
11348
- gatewayVideoResponseSchema
11349
- ),
11344
+ successfulResponseHandler: async ({
11345
+ response,
11346
+ url: url2,
11347
+ requestBodyValues
11348
+ }) => {
11349
+ if (response.body == null) {
11350
+ throw new APICallError$1({
11351
+ message: "SSE response body is empty",
11352
+ url: url2,
11353
+ requestBodyValues,
11354
+ statusCode: response.status
11355
+ });
11356
+ }
11357
+ const eventStream = parseJsonEventStream$1({
11358
+ stream: response.body,
11359
+ schema: gatewayVideoEventSchema
11360
+ });
11361
+ const reader = eventStream.getReader();
11362
+ const { done, value: parseResult } = await reader.read();
11363
+ reader.releaseLock();
11364
+ if (done || !parseResult) {
11365
+ throw new APICallError$1({
11366
+ message: "SSE stream ended without a data event",
11367
+ url: url2,
11368
+ requestBodyValues,
11369
+ statusCode: response.status
11370
+ });
11371
+ }
11372
+ if (!parseResult.success) {
11373
+ throw new APICallError$1({
11374
+ message: "Failed to parse video SSE event",
11375
+ cause: parseResult.error,
11376
+ url: url2,
11377
+ requestBodyValues,
11378
+ statusCode: response.status
11379
+ });
11380
+ }
11381
+ const event = parseResult.value;
11382
+ if (event.type === "error") {
11383
+ throw new APICallError$1({
11384
+ message: event.message,
11385
+ statusCode: event.statusCode,
11386
+ url: url2,
11387
+ requestBodyValues,
11388
+ responseHeaders: Object.fromEntries([...response.headers]),
11389
+ responseBody: JSON.stringify(event),
11390
+ data: {
11391
+ error: {
11392
+ message: event.message,
11393
+ type: event.errorType,
11394
+ param: event.param
11395
+ }
11396
+ }
11397
+ });
11398
+ }
11399
+ return {
11400
+ value: {
11401
+ videos: event.videos,
11402
+ warnings: event.warnings,
11403
+ providerMetadata: event.providerMetadata
11404
+ },
11405
+ responseHeaders: Object.fromEntries([...response.headers])
11406
+ };
11407
+ },
11350
11408
  failedResponseHandler: createJsonErrorResponseHandler$1({
11351
11409
  errorSchema: any(),
11352
11410
  errorToMessage: (data) => data
@@ -11418,11 +11476,21 @@ var gatewayVideoWarningSchema = discriminatedUnion("type", [
11418
11476
  message: string()
11419
11477
  })
11420
11478
  ]);
11421
- var gatewayVideoResponseSchema = object$1({
11422
- videos: array$1(gatewayVideoDataSchema),
11423
- warnings: array$1(gatewayVideoWarningSchema).optional(),
11424
- providerMetadata: record(string(), providerMetadataEntrySchema2).optional()
11425
- });
11479
+ var gatewayVideoEventSchema = discriminatedUnion("type", [
11480
+ object$1({
11481
+ type: literal("result"),
11482
+ videos: array$1(gatewayVideoDataSchema),
11483
+ warnings: array$1(gatewayVideoWarningSchema).optional(),
11484
+ providerMetadata: record(string(), providerMetadataEntrySchema2).optional()
11485
+ }),
11486
+ object$1({
11487
+ type: literal("error"),
11488
+ message: string(),
11489
+ errorType: string(),
11490
+ statusCode: number$1(),
11491
+ param: unknown().nullable()
11492
+ })
11493
+ ]);
11426
11494
  var parallelSearchInputSchema = lazySchema(
11427
11495
  () => zodSchema(
11428
11496
  objectType({
@@ -11599,7 +11667,7 @@ async function getVercelRequestId() {
11599
11667
  var _a92;
11600
11668
  return (_a92 = indexBrowserExports.getContext().headers) == null ? void 0 : _a92["x-vercel-id"];
11601
11669
  }
11602
- var VERSION$6 = "3.0.45";
11670
+ var VERSION$6 = "3.0.55";
11603
11671
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
11604
11672
  function createGatewayProvider(options = {}) {
11605
11673
  var _a92, _b9;
@@ -11642,13 +11710,18 @@ function createGatewayProvider(options = {}) {
11642
11710
  settingValue: void 0,
11643
11711
  environmentVariableName: "VERCEL_REGION"
11644
11712
  });
11713
+ const projectId = loadOptionalSetting({
11714
+ settingValue: void 0,
11715
+ environmentVariableName: "VERCEL_PROJECT_ID"
11716
+ });
11645
11717
  return async () => {
11646
11718
  const requestId = await getVercelRequestId();
11647
11719
  return {
11648
11720
  ...deploymentId && { "ai-o11y-deployment-id": deploymentId },
11649
11721
  ...environment && { "ai-o11y-environment": environment },
11650
11722
  ...region && { "ai-o11y-region": region },
11651
- ...requestId && { "ai-o11y-request-id": requestId }
11723
+ ...requestId && { "ai-o11y-request-id": requestId },
11724
+ ...projectId && { "ai-o11y-project-id": projectId }
11652
11725
  };
11653
11726
  };
11654
11727
  };
@@ -13027,7 +13100,7 @@ function detectMediaType({
13027
13100
  }
13028
13101
  return void 0;
13029
13102
  }
13030
- var VERSION$4 = "6.0.85";
13103
+ var VERSION$4 = "6.0.99";
13031
13104
  var download = async ({
13032
13105
  url: url2,
13033
13106
  maxBytes,
@@ -14452,6 +14525,10 @@ function collectToolApprovals({
14452
14525
  }
14453
14526
  return { approvedToolApprovals, deniedToolApprovals };
14454
14527
  }
14528
+ function now() {
14529
+ var _a21, _b9;
14530
+ return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
14531
+ }
14455
14532
  async function executeToolCall({
14456
14533
  toolCall,
14457
14534
  tools,
@@ -14460,13 +14537,27 @@ async function executeToolCall({
14460
14537
  messages,
14461
14538
  abortSignal,
14462
14539
  experimental_context,
14463
- onPreliminaryToolResult
14540
+ stepNumber,
14541
+ model,
14542
+ onPreliminaryToolResult,
14543
+ onToolCallStart,
14544
+ onToolCallFinish
14464
14545
  }) {
14465
14546
  const { toolName, toolCallId, input } = toolCall;
14466
14547
  const tool2 = tools == null ? void 0 : tools[toolName];
14467
14548
  if ((tool2 == null ? void 0 : tool2.execute) == null) {
14468
14549
  return void 0;
14469
14550
  }
14551
+ const baseCallbackEvent = {
14552
+ stepNumber,
14553
+ model,
14554
+ toolCall,
14555
+ messages,
14556
+ abortSignal,
14557
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
14558
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
14559
+ experimental_context
14560
+ };
14470
14561
  return recordSpan({
14471
14562
  name: "ai.toolCall",
14472
14563
  attributes: selectTelemetryAttributes({
@@ -14486,6 +14577,11 @@ async function executeToolCall({
14486
14577
  tracer,
14487
14578
  fn: async (span) => {
14488
14579
  let output;
14580
+ try {
14581
+ await (onToolCallStart == null ? void 0 : onToolCallStart(baseCallbackEvent));
14582
+ } catch (_ignored) {
14583
+ }
14584
+ const startTime = now();
14489
14585
  try {
14490
14586
  const stream = executeTool({
14491
14587
  execute: tool2.execute.bind(tool2),
@@ -14510,6 +14606,16 @@ async function executeToolCall({
14510
14606
  }
14511
14607
  }
14512
14608
  } catch (error) {
14609
+ const durationMs2 = now() - startTime;
14610
+ try {
14611
+ await (onToolCallFinish == null ? void 0 : onToolCallFinish({
14612
+ ...baseCallbackEvent,
14613
+ success: false,
14614
+ error,
14615
+ durationMs: durationMs2
14616
+ }));
14617
+ } catch (_ignored) {
14618
+ }
14513
14619
  recordErrorOnSpan(span, error);
14514
14620
  return {
14515
14621
  type: "tool-error",
@@ -14521,6 +14627,16 @@ async function executeToolCall({
14521
14627
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
14522
14628
  };
14523
14629
  }
14630
+ const durationMs = now() - startTime;
14631
+ try {
14632
+ await (onToolCallFinish == null ? void 0 : onToolCallFinish({
14633
+ ...baseCallbackEvent,
14634
+ success: true,
14635
+ output,
14636
+ durationMs
14637
+ }));
14638
+ } catch (_ignored) {
14639
+ }
14524
14640
  try {
14525
14641
  span.setAttributes(
14526
14642
  await selectTelemetryAttributes({
@@ -15384,6 +15500,11 @@ async function doParseToolCall({
15384
15500
  }
15385
15501
  var DefaultStepResult = class {
15386
15502
  constructor({
15503
+ stepNumber,
15504
+ model,
15505
+ functionId,
15506
+ metadata: metadata2,
15507
+ experimental_context,
15387
15508
  content,
15388
15509
  finishReason,
15389
15510
  rawFinishReason,
@@ -15393,6 +15514,11 @@ var DefaultStepResult = class {
15393
15514
  response,
15394
15515
  providerMetadata
15395
15516
  }) {
15517
+ this.stepNumber = stepNumber;
15518
+ this.model = model;
15519
+ this.functionId = functionId;
15520
+ this.metadata = metadata2;
15521
+ this.experimental_context = experimental_context;
15396
15522
  this.content = content;
15397
15523
  this.finishReason = finishReason;
15398
15524
  this.rawFinishReason = rawFinishReason;
@@ -15634,6 +15760,10 @@ async function generateText({
15634
15760
  experimental_context,
15635
15761
  experimental_include: include,
15636
15762
  _internal: { generateId: generateId2 = originalGenerateId } = {},
15763
+ experimental_onStart: onStart,
15764
+ experimental_onStepStart: onStepStart,
15765
+ experimental_onToolCallStart: onToolCallStart,
15766
+ experimental_onToolCallFinish: onToolCallFinish,
15637
15767
  onStepFinish,
15638
15768
  onFinish,
15639
15769
  ...settings
@@ -15663,11 +15793,43 @@ async function generateText({
15663
15793
  headers: headersWithUserAgent,
15664
15794
  settings: { ...callSettings, maxRetries }
15665
15795
  });
15796
+ const modelInfo = { provider: model.provider, modelId: model.modelId };
15666
15797
  const initialPrompt = await standardizePrompt({
15667
15798
  system,
15668
15799
  prompt,
15669
15800
  messages
15670
15801
  });
15802
+ try {
15803
+ await (onStart == null ? void 0 : onStart({
15804
+ model: modelInfo,
15805
+ system,
15806
+ prompt,
15807
+ messages,
15808
+ tools,
15809
+ toolChoice,
15810
+ activeTools,
15811
+ maxOutputTokens: callSettings.maxOutputTokens,
15812
+ temperature: callSettings.temperature,
15813
+ topP: callSettings.topP,
15814
+ topK: callSettings.topK,
15815
+ presencePenalty: callSettings.presencePenalty,
15816
+ frequencyPenalty: callSettings.frequencyPenalty,
15817
+ stopSequences: callSettings.stopSequences,
15818
+ seed: callSettings.seed,
15819
+ maxRetries,
15820
+ timeout,
15821
+ headers,
15822
+ providerOptions,
15823
+ stopWhen,
15824
+ output,
15825
+ abortSignal,
15826
+ include,
15827
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
15828
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
15829
+ experimental_context
15830
+ }));
15831
+ } catch (_ignored) {
15832
+ }
15671
15833
  const tracer = getTracer(telemetry);
15672
15834
  try {
15673
15835
  return await recordSpan({
@@ -15691,7 +15853,7 @@ async function generateText({
15691
15853
  }),
15692
15854
  tracer,
15693
15855
  fn: async (span) => {
15694
- var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k;
15856
+ var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
15695
15857
  const initialMessages = initialPrompt.messages;
15696
15858
  const responseMessages = [];
15697
15859
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -15708,7 +15870,11 @@ async function generateText({
15708
15870
  telemetry,
15709
15871
  messages: initialMessages,
15710
15872
  abortSignal: mergedAbortSignal,
15711
- experimental_context
15873
+ experimental_context,
15874
+ stepNumber: 0,
15875
+ model: modelInfo,
15876
+ onToolCallStart,
15877
+ onToolCallFinish
15712
15878
  });
15713
15879
  const toolContent = [];
15714
15880
  for (const output2 of toolOutputs) {
@@ -15788,6 +15954,10 @@ async function generateText({
15788
15954
  const stepModel = resolveLanguageModel(
15789
15955
  (_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
15790
15956
  );
15957
+ const stepModelInfo = {
15958
+ provider: stepModel.provider,
15959
+ modelId: stepModel.modelId
15960
+ };
15791
15961
  const promptMessages = await convertToLanguageModelPrompt({
15792
15962
  prompt: {
15793
15963
  system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
@@ -15797,11 +15967,41 @@ async function generateText({
15797
15967
  download: download2
15798
15968
  });
15799
15969
  experimental_context = (_d = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _d : experimental_context;
15970
+ const stepActiveTools = (_e = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _e : activeTools;
15800
15971
  const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
15801
15972
  tools,
15802
- toolChoice: (_e = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _e : toolChoice,
15803
- activeTools: (_f = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _f : activeTools
15973
+ toolChoice: (_f = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _f : toolChoice,
15974
+ activeTools: stepActiveTools
15804
15975
  });
15976
+ const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
15977
+ const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
15978
+ const stepProviderOptions = mergeObjects(
15979
+ providerOptions,
15980
+ prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
15981
+ );
15982
+ try {
15983
+ await (onStepStart == null ? void 0 : onStepStart({
15984
+ stepNumber: steps.length,
15985
+ model: stepModelInfo,
15986
+ system: stepSystem,
15987
+ messages: stepMessages,
15988
+ tools,
15989
+ toolChoice: stepToolChoice,
15990
+ activeTools: stepActiveTools,
15991
+ steps: [...steps],
15992
+ providerOptions: stepProviderOptions,
15993
+ timeout,
15994
+ headers,
15995
+ stopWhen,
15996
+ output,
15997
+ abortSignal,
15998
+ include,
15999
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
16000
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
16001
+ experimental_context
16002
+ }));
16003
+ } catch (_ignored) {
16004
+ }
15805
16005
  currentModelResponse = await retry(
15806
16006
  () => {
15807
16007
  var _a22;
@@ -15844,10 +16044,6 @@ async function generateText({
15844
16044
  tracer,
15845
16045
  fn: async (span2) => {
15846
16046
  var _a23, _b22, _c2, _d2, _e2, _f2, _g2, _h2;
15847
- const stepProviderOptions = mergeObjects(
15848
- providerOptions,
15849
- prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
15850
- );
15851
16047
  const result = await stepModel.doGenerate({
15852
16048
  ...callSettings2,
15853
16049
  tools: stepTools,
@@ -15979,7 +16175,11 @@ async function generateText({
15979
16175
  telemetry,
15980
16176
  messages: stepInputMessages,
15981
16177
  abortSignal: mergedAbortSignal,
15982
- experimental_context
16178
+ experimental_context,
16179
+ stepNumber: steps.length,
16180
+ model: stepModelInfo,
16181
+ onToolCallStart,
16182
+ onToolCallFinish
15983
16183
  })
15984
16184
  );
15985
16185
  }
@@ -16016,15 +16216,21 @@ async function generateText({
16016
16216
  tools
16017
16217
  })
16018
16218
  );
16019
- const stepRequest = ((_g = include == null ? void 0 : include.requestBody) != null ? _g : true) ? (_h = currentModelResponse.request) != null ? _h : {} : { ...currentModelResponse.request, body: void 0 };
16219
+ const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? (_j = currentModelResponse.request) != null ? _j : {} : { ...currentModelResponse.request, body: void 0 };
16020
16220
  const stepResponse = {
16021
16221
  ...currentModelResponse.response,
16022
16222
  // deep clone msgs to avoid mutating past messages in multi-step:
16023
16223
  messages: structuredClone(responseMessages),
16024
16224
  // Conditionally include response body:
16025
- body: ((_i = include == null ? void 0 : include.responseBody) != null ? _i : true) ? (_j = currentModelResponse.response) == null ? void 0 : _j.body : void 0
16225
+ body: ((_k = include == null ? void 0 : include.responseBody) != null ? _k : true) ? (_l = currentModelResponse.response) == null ? void 0 : _l.body : void 0
16026
16226
  };
16227
+ const stepNumber = steps.length;
16027
16228
  const currentStepResult = new DefaultStepResult({
16229
+ stepNumber,
16230
+ model: stepModelInfo,
16231
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
16232
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
16233
+ experimental_context,
16028
16234
  content: stepContent,
16029
16235
  finishReason: currentModelResponse.finishReason.unified,
16030
16236
  rawFinishReason: currentModelResponse.finishReason.raw,
@@ -16035,9 +16241,9 @@ async function generateText({
16035
16241
  response: stepResponse
16036
16242
  });
16037
16243
  logWarnings({
16038
- warnings: (_k = currentModelResponse.warnings) != null ? _k : [],
16039
- provider: stepModel.provider,
16040
- model: stepModel.modelId
16244
+ warnings: (_m = currentModelResponse.warnings) != null ? _m : [],
16245
+ provider: stepModelInfo.provider,
16246
+ model: stepModelInfo.modelId
16041
16247
  });
16042
16248
  steps.push(currentStepResult);
16043
16249
  await (onStepFinish == null ? void 0 : onStepFinish(currentStepResult));
@@ -16093,6 +16299,11 @@ async function generateText({
16093
16299
  }
16094
16300
  );
16095
16301
  await (onFinish == null ? void 0 : onFinish({
16302
+ stepNumber: lastStep.stepNumber,
16303
+ model: lastStep.model,
16304
+ functionId: lastStep.functionId,
16305
+ metadata: lastStep.metadata,
16306
+ experimental_context: lastStep.experimental_context,
16096
16307
  finishReason: lastStep.finishReason,
16097
16308
  rawFinishReason: lastStep.rawFinishReason,
16098
16309
  usage: lastStep.usage,
@@ -16113,8 +16324,7 @@ async function generateText({
16113
16324
  warnings: lastStep.warnings,
16114
16325
  providerMetadata: lastStep.providerMetadata,
16115
16326
  steps,
16116
- totalUsage,
16117
- experimental_context
16327
+ totalUsage
16118
16328
  }));
16119
16329
  let resolvedOutput;
16120
16330
  if (lastStep.finishReason === "stop") {
@@ -16146,7 +16356,11 @@ async function executeTools({
16146
16356
  telemetry,
16147
16357
  messages,
16148
16358
  abortSignal,
16149
- experimental_context
16359
+ experimental_context,
16360
+ stepNumber,
16361
+ model,
16362
+ onToolCallStart,
16363
+ onToolCallFinish
16150
16364
  }) {
16151
16365
  const toolOutputs = await Promise.all(
16152
16366
  toolCalls.map(
@@ -16157,7 +16371,11 @@ async function executeTools({
16157
16371
  telemetry,
16158
16372
  messages,
16159
16373
  abortSignal,
16160
- experimental_context
16374
+ experimental_context,
16375
+ stepNumber,
16376
+ model,
16377
+ onToolCallStart,
16378
+ onToolCallFinish
16161
16379
  })
16162
16380
  )
16163
16381
  );
@@ -17318,10 +17536,6 @@ function createStitchableStream() {
17318
17536
  terminate
17319
17537
  };
17320
17538
  }
17321
- function now() {
17322
- var _a21, _b9;
17323
- return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
17324
- }
17325
17539
  function runToolsTransformation({
17326
17540
  tools,
17327
17541
  generatorStream,
@@ -17332,7 +17546,11 @@ function runToolsTransformation({
17332
17546
  abortSignal,
17333
17547
  repairToolCall,
17334
17548
  experimental_context,
17335
- generateId: generateId2
17549
+ generateId: generateId2,
17550
+ stepNumber,
17551
+ model,
17552
+ onToolCallStart,
17553
+ onToolCallFinish
17336
17554
  }) {
17337
17555
  let toolResultsStreamController = null;
17338
17556
  const toolResultsStream = new ReadableStream({
@@ -17474,6 +17692,10 @@ function runToolsTransformation({
17474
17692
  messages,
17475
17693
  abortSignal,
17476
17694
  experimental_context,
17695
+ stepNumber,
17696
+ model,
17697
+ onToolCallStart,
17698
+ onToolCallFinish,
17477
17699
  onPreliminaryToolResult: (result) => {
17478
17700
  toolResultsStreamController.enqueue(result);
17479
17701
  }
@@ -17590,6 +17812,10 @@ function streamText({
17590
17812
  onFinish,
17591
17813
  onAbort,
17592
17814
  onStepFinish,
17815
+ experimental_onStart: onStart,
17816
+ experimental_onStepStart: onStepStart,
17817
+ experimental_onToolCallStart: onToolCallStart,
17818
+ experimental_onToolCallFinish: onToolCallFinish,
17593
17819
  experimental_context,
17594
17820
  experimental_include: include,
17595
17821
  _internal: { now: now2 = now, generateId: generateId2 = originalGenerateId2 } = {},
@@ -17629,11 +17855,18 @@ function streamText({
17629
17855
  providerOptions,
17630
17856
  prepareStep,
17631
17857
  includeRawChunks,
17858
+ timeout,
17859
+ stopWhen,
17860
+ originalAbortSignal: abortSignal,
17632
17861
  onChunk,
17633
17862
  onError,
17634
17863
  onFinish,
17635
17864
  onAbort,
17636
17865
  onStepFinish,
17866
+ onStart,
17867
+ onStepStart,
17868
+ onToolCallStart,
17869
+ onToolCallFinish,
17637
17870
  now: now2,
17638
17871
  generateId: generateId2,
17639
17872
  experimental_context,
@@ -17730,11 +17963,18 @@ var DefaultStreamTextResult = class {
17730
17963
  includeRawChunks,
17731
17964
  now: now2,
17732
17965
  generateId: generateId2,
17966
+ timeout,
17967
+ stopWhen,
17968
+ originalAbortSignal,
17733
17969
  onChunk,
17734
17970
  onError,
17735
17971
  onFinish,
17736
17972
  onAbort,
17737
17973
  onStepFinish,
17974
+ onStart,
17975
+ onStepStart,
17976
+ onToolCallStart,
17977
+ onToolCallFinish,
17738
17978
  experimental_context,
17739
17979
  download: download2,
17740
17980
  include
@@ -17877,6 +18117,10 @@ var DefaultStreamTextResult = class {
17877
18117
  tools
17878
18118
  });
17879
18119
  const currentStepResult = new DefaultStepResult({
18120
+ stepNumber: recordedSteps.length,
18121
+ model: modelInfo,
18122
+ ...callbackTelemetryProps,
18123
+ experimental_context,
17880
18124
  content: recordedContent,
17881
18125
  finishReason: part.finishReason,
17882
18126
  rawFinishReason: part.rawFinishReason,
@@ -17892,8 +18136,8 @@ var DefaultStreamTextResult = class {
17892
18136
  await (onStepFinish == null ? void 0 : onStepFinish(currentStepResult));
17893
18137
  logWarnings({
17894
18138
  warnings: recordedWarnings,
17895
- provider: model.provider,
17896
- model: model.modelId
18139
+ provider: modelInfo.provider,
18140
+ model: modelInfo.modelId
17897
18141
  });
17898
18142
  recordedSteps.push(currentStepResult);
17899
18143
  recordedResponseMessages.push(...stepMessages);
@@ -17925,6 +18169,11 @@ var DefaultStreamTextResult = class {
17925
18169
  self2._steps.resolve(recordedSteps);
17926
18170
  const finalStep = recordedSteps[recordedSteps.length - 1];
17927
18171
  await (onFinish == null ? void 0 : onFinish({
18172
+ stepNumber: finalStep.stepNumber,
18173
+ model: finalStep.model,
18174
+ functionId: finalStep.functionId,
18175
+ metadata: finalStep.metadata,
18176
+ experimental_context: finalStep.experimental_context,
17928
18177
  finishReason: finalStep.finishReason,
17929
18178
  rawFinishReason: finalStep.rawFinishReason,
17930
18179
  totalUsage,
@@ -17945,8 +18194,7 @@ var DefaultStreamTextResult = class {
17945
18194
  response: finalStep.response,
17946
18195
  warnings: finalStep.warnings,
17947
18196
  providerMetadata: finalStep.providerMetadata,
17948
- steps: recordedSteps,
17949
- experimental_context
18197
+ steps: recordedSteps
17950
18198
  }));
17951
18199
  rootSpan.setAttributes(
17952
18200
  await selectTelemetryAttributes({
@@ -18048,6 +18296,11 @@ var DefaultStreamTextResult = class {
18048
18296
  settings: { ...callSettings, maxRetries }
18049
18297
  });
18050
18298
  const self2 = this;
18299
+ const modelInfo = { provider: model.provider, modelId: model.modelId };
18300
+ const callbackTelemetryProps = {
18301
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
18302
+ metadata: telemetry == null ? void 0 : telemetry.metadata
18303
+ };
18051
18304
  recordSpan({
18052
18305
  name: "ai.streamText",
18053
18306
  attributes: selectTelemetryAttributes({
@@ -18070,6 +18323,36 @@ var DefaultStreamTextResult = class {
18070
18323
  prompt,
18071
18324
  messages
18072
18325
  });
18326
+ try {
18327
+ await (onStart == null ? void 0 : onStart({
18328
+ model: modelInfo,
18329
+ system,
18330
+ prompt,
18331
+ messages,
18332
+ tools,
18333
+ toolChoice,
18334
+ activeTools,
18335
+ maxOutputTokens: callSettings.maxOutputTokens,
18336
+ temperature: callSettings.temperature,
18337
+ topP: callSettings.topP,
18338
+ topK: callSettings.topK,
18339
+ presencePenalty: callSettings.presencePenalty,
18340
+ frequencyPenalty: callSettings.frequencyPenalty,
18341
+ stopSequences: callSettings.stopSequences,
18342
+ seed: callSettings.seed,
18343
+ maxRetries,
18344
+ timeout,
18345
+ headers,
18346
+ providerOptions,
18347
+ stopWhen,
18348
+ output,
18349
+ abortSignal: originalAbortSignal,
18350
+ include,
18351
+ ...callbackTelemetryProps,
18352
+ experimental_context
18353
+ }));
18354
+ } catch (_ignored) {
18355
+ }
18073
18356
  const initialMessages = initialPrompt.messages;
18074
18357
  const initialResponseMessages = [];
18075
18358
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -18116,6 +18399,10 @@ var DefaultStreamTextResult = class {
18116
18399
  messages: initialMessages,
18117
18400
  abortSignal,
18118
18401
  experimental_context,
18402
+ stepNumber: recordedSteps.length,
18403
+ model: modelInfo,
18404
+ onToolCallStart,
18405
+ onToolCallFinish,
18119
18406
  onPreliminaryToolResult: (result2) => {
18120
18407
  toolExecutionStepStreamController == null ? void 0 : toolExecutionStepStreamController.enqueue(result2);
18121
18408
  }
@@ -18182,7 +18469,7 @@ var DefaultStreamTextResult = class {
18182
18469
  responseMessages,
18183
18470
  usage
18184
18471
  }) {
18185
- var _a21, _b9, _c, _d, _e, _f, _g;
18472
+ var _a21, _b9, _c, _d, _e, _f, _g, _h, _i;
18186
18473
  const includeRawChunks2 = self2.includeRawChunks;
18187
18474
  const stepTimeoutId = stepTimeoutMs != null ? setTimeout(() => stepAbortController.abort(), stepTimeoutMs) : void 0;
18188
18475
  let chunkTimeoutId = void 0;
@@ -18221,6 +18508,10 @@ var DefaultStreamTextResult = class {
18221
18508
  const stepModel = resolveLanguageModel(
18222
18509
  (_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
18223
18510
  );
18511
+ const stepModelInfo = {
18512
+ provider: stepModel.provider,
18513
+ modelId: stepModel.modelId
18514
+ };
18224
18515
  const promptMessages = await convertToLanguageModelPrompt({
18225
18516
  prompt: {
18226
18517
  system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
@@ -18229,16 +18520,41 @@ var DefaultStreamTextResult = class {
18229
18520
  supportedUrls: await stepModel.supportedUrls,
18230
18521
  download: download2
18231
18522
  });
18523
+ const stepActiveTools = (_d = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _d : activeTools;
18232
18524
  const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
18233
18525
  tools,
18234
- toolChoice: (_d = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _d : toolChoice,
18235
- activeTools: (_e = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _e : activeTools
18526
+ toolChoice: (_e = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _e : toolChoice,
18527
+ activeTools: stepActiveTools
18236
18528
  });
18237
18529
  experimental_context = (_f = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _f : experimental_context;
18530
+ const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
18531
+ const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
18238
18532
  const stepProviderOptions = mergeObjects(
18239
18533
  providerOptions,
18240
18534
  prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
18241
18535
  );
18536
+ try {
18537
+ await (onStepStart == null ? void 0 : onStepStart({
18538
+ stepNumber: recordedSteps.length,
18539
+ model: stepModelInfo,
18540
+ system: stepSystem,
18541
+ messages: stepMessages,
18542
+ tools,
18543
+ toolChoice: stepToolChoice,
18544
+ activeTools: stepActiveTools,
18545
+ steps: [...recordedSteps],
18546
+ providerOptions: stepProviderOptions,
18547
+ timeout,
18548
+ headers,
18549
+ stopWhen,
18550
+ output,
18551
+ abortSignal: originalAbortSignal,
18552
+ include,
18553
+ ...callbackTelemetryProps,
18554
+ experimental_context
18555
+ }));
18556
+ } catch (_ignored) {
18557
+ }
18242
18558
  const {
18243
18559
  result: { stream: stream2, response, request },
18244
18560
  doStreamSpan,
@@ -18310,9 +18626,13 @@ var DefaultStreamTextResult = class {
18310
18626
  repairToolCall,
18311
18627
  abortSignal,
18312
18628
  experimental_context,
18313
- generateId: generateId2
18629
+ generateId: generateId2,
18630
+ stepNumber: recordedSteps.length,
18631
+ model: stepModelInfo,
18632
+ onToolCallStart,
18633
+ onToolCallFinish
18314
18634
  });
18315
- const stepRequest = ((_g = include == null ? void 0 : include.requestBody) != null ? _g : true) ? request != null ? request : {} : { ...request, body: void 0 };
18635
+ const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? request != null ? request : {} : { ...request, body: void 0 };
18316
18636
  const stepToolCalls = [];
18317
18637
  const stepToolOutputs = [];
18318
18638
  let warnings;
@@ -18325,7 +18645,7 @@ var DefaultStreamTextResult = class {
18325
18645
  let stepResponse = {
18326
18646
  id: generateId2(),
18327
18647
  timestamp: /* @__PURE__ */ new Date(),
18328
- modelId: model.modelId
18648
+ modelId: modelInfo.modelId
18329
18649
  };
18330
18650
  let activeText = "";
18331
18651
  self2.addStream(
@@ -25587,7 +25907,8 @@ var modelMaxImagesPerCall = {
25587
25907
  "dall-e-2": 10,
25588
25908
  "gpt-image-1": 10,
25589
25909
  "gpt-image-1-mini": 10,
25590
- "gpt-image-1.5": 10
25910
+ "gpt-image-1.5": 10,
25911
+ "chatgpt-image-latest": 10
25591
25912
  };
25592
25913
  var defaultResponseFormatPrefixes = [
25593
25914
  "gpt-image-1-mini",
@@ -25688,15 +26009,20 @@ var OpenAIImageModel = class {
25688
26009
  },
25689
26010
  providerMetadata: {
25690
26011
  openai: {
25691
- images: response2.data.map((item) => {
25692
- var _a22, _b22, _c2, _d2, _e2;
26012
+ images: response2.data.map((item, index) => {
26013
+ var _a22, _b22, _c2, _d2, _e2, _f2;
25693
26014
  return {
25694
26015
  ...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
25695
26016
  created: (_a22 = response2.created) != null ? _a22 : void 0,
25696
26017
  size: (_b22 = response2.size) != null ? _b22 : void 0,
25697
26018
  quality: (_c2 = response2.quality) != null ? _c2 : void 0,
25698
26019
  background: (_d2 = response2.background) != null ? _d2 : void 0,
25699
- outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0
26020
+ outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0,
26021
+ ...distributeTokenDetails(
26022
+ (_f2 = response2.usage) == null ? void 0 : _f2.input_tokens_details,
26023
+ index,
26024
+ response2.data.length
26025
+ )
25700
26026
  };
25701
26027
  })
25702
26028
  }
@@ -25739,15 +26065,20 @@ var OpenAIImageModel = class {
25739
26065
  },
25740
26066
  providerMetadata: {
25741
26067
  openai: {
25742
- images: response.data.map((item) => {
25743
- var _a22, _b22, _c2, _d2, _e2;
26068
+ images: response.data.map((item, index) => {
26069
+ var _a22, _b22, _c2, _d2, _e2, _f2;
25744
26070
  return {
25745
26071
  ...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
25746
26072
  created: (_a22 = response.created) != null ? _a22 : void 0,
25747
26073
  size: (_b22 = response.size) != null ? _b22 : void 0,
25748
26074
  quality: (_c2 = response.quality) != null ? _c2 : void 0,
25749
26075
  background: (_d2 = response.background) != null ? _d2 : void 0,
25750
- outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0
26076
+ outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0,
26077
+ ...distributeTokenDetails(
26078
+ (_f2 = response.usage) == null ? void 0 : _f2.input_tokens_details,
26079
+ index,
26080
+ response.data.length
26081
+ )
25751
26082
  };
25752
26083
  })
25753
26084
  }
@@ -25755,6 +26086,23 @@ var OpenAIImageModel = class {
25755
26086
  };
25756
26087
  }
25757
26088
  };
26089
+ function distributeTokenDetails(details, index, total) {
26090
+ if (details == null) {
26091
+ return {};
26092
+ }
26093
+ const result = {};
26094
+ if (details.image_tokens != null) {
26095
+ const base = Math.floor(details.image_tokens / total);
26096
+ const remainder = details.image_tokens - base * (total - 1);
26097
+ result.imageTokens = index === total - 1 ? remainder : base;
26098
+ }
26099
+ if (details.text_tokens != null) {
26100
+ const base = Math.floor(details.text_tokens / total);
26101
+ const remainder = details.text_tokens - base * (total - 1);
26102
+ result.textTokens = index === total - 1 ? remainder : base;
26103
+ }
26104
+ return result;
26105
+ }
25758
26106
  async function fileToBlob(file) {
25759
26107
  if (!file) return void 0;
25760
26108
  if (file.type === "url") {
@@ -25965,6 +26313,67 @@ var shellOutputSchema = lazySchema(
25965
26313
  })
25966
26314
  )
25967
26315
  );
26316
+ var shellSkillsSchema = array$1(
26317
+ discriminatedUnion("type", [
26318
+ object$1({
26319
+ type: literal("skillReference"),
26320
+ skillId: string(),
26321
+ version: string().optional()
26322
+ }),
26323
+ object$1({
26324
+ type: literal("inline"),
26325
+ name: string(),
26326
+ description: string(),
26327
+ source: object$1({
26328
+ type: literal("base64"),
26329
+ mediaType: literal("application/zip"),
26330
+ data: string()
26331
+ })
26332
+ })
26333
+ ])
26334
+ ).optional();
26335
+ var shellArgsSchema = lazySchema(
26336
+ () => zodSchema(
26337
+ object$1({
26338
+ environment: union([
26339
+ object$1({
26340
+ type: literal("containerAuto"),
26341
+ fileIds: array$1(string()).optional(),
26342
+ memoryLimit: _enum$1(["1g", "4g", "16g", "64g"]).optional(),
26343
+ networkPolicy: discriminatedUnion("type", [
26344
+ object$1({ type: literal("disabled") }),
26345
+ object$1({
26346
+ type: literal("allowlist"),
26347
+ allowedDomains: array$1(string()),
26348
+ domainSecrets: array$1(
26349
+ object$1({
26350
+ domain: string(),
26351
+ name: string(),
26352
+ value: string()
26353
+ })
26354
+ ).optional()
26355
+ })
26356
+ ]).optional(),
26357
+ skills: shellSkillsSchema
26358
+ }),
26359
+ object$1({
26360
+ type: literal("containerReference"),
26361
+ containerId: string()
26362
+ }),
26363
+ object$1({
26364
+ type: literal("local").optional(),
26365
+ skills: array$1(
26366
+ object$1({
26367
+ name: string(),
26368
+ description: string(),
26369
+ path: string()
26370
+ })
26371
+ ).optional()
26372
+ })
26373
+ ]).optional()
26374
+ })
26375
+ )
26376
+ );
25968
26377
  var shell = createProviderToolFactoryWithOutputSchema({
25969
26378
  id: "openai.shell",
25970
26379
  inputSchema: shellInputSchema,
@@ -26004,7 +26413,7 @@ var webSearchOutputSchema = lazySchema(
26004
26413
  url: string().nullish(),
26005
26414
  pattern: string().nullish()
26006
26415
  })
26007
- ]),
26416
+ ]).optional(),
26008
26417
  sources: array$1(
26009
26418
  discriminatedUnion("type", [
26010
26419
  object$1({ type: literal("url"), url: string() }),
@@ -26054,7 +26463,7 @@ var webSearchPreviewOutputSchema = lazySchema(
26054
26463
  url: string().nullish(),
26055
26464
  pattern: string().nullish()
26056
26465
  })
26057
- ])
26466
+ ]).optional()
26058
26467
  })
26059
26468
  )
26060
26469
  );
@@ -26454,8 +26863,32 @@ async function convertToOpenAIResponsesInput({
26454
26863
  if (hasConversation) {
26455
26864
  break;
26456
26865
  }
26866
+ const resolvedResultToolName = toolNameMapping.toProviderToolName(
26867
+ part.toolName
26868
+ );
26869
+ if (hasShellTool && resolvedResultToolName === "shell") {
26870
+ if (part.output.type === "json") {
26871
+ const parsedOutput = await validateTypes$1({
26872
+ value: part.output.value,
26873
+ schema: shellOutputSchema
26874
+ });
26875
+ input.push({
26876
+ type: "shell_call_output",
26877
+ call_id: part.toolCallId,
26878
+ output: parsedOutput.output.map((item) => ({
26879
+ stdout: item.stdout,
26880
+ stderr: item.stderr,
26881
+ outcome: item.outcome.type === "timeout" ? { type: "timeout" } : {
26882
+ type: "exit",
26883
+ exit_code: item.outcome.exitCode
26884
+ }
26885
+ }))
26886
+ });
26887
+ }
26888
+ break;
26889
+ }
26457
26890
  if (store) {
26458
- const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
26891
+ const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
26459
26892
  input.push({ type: "item_reference", id: itemId });
26460
26893
  } else {
26461
26894
  warnings.push({
@@ -26824,6 +27257,25 @@ var openaiResponsesChunkSchema = lazySchema(
26824
27257
  action: object$1({
26825
27258
  commands: array$1(string())
26826
27259
  })
27260
+ }),
27261
+ object$1({
27262
+ type: literal("shell_call_output"),
27263
+ id: string(),
27264
+ call_id: string(),
27265
+ status: _enum$1(["in_progress", "completed", "incomplete"]),
27266
+ output: array$1(
27267
+ object$1({
27268
+ stdout: string(),
27269
+ stderr: string(),
27270
+ outcome: discriminatedUnion("type", [
27271
+ object$1({ type: literal("timeout") }),
27272
+ object$1({
27273
+ type: literal("exit"),
27274
+ exit_code: number$1()
27275
+ })
27276
+ ])
27277
+ })
27278
+ )
26827
27279
  })
26828
27280
  ])
26829
27281
  }),
@@ -26889,7 +27341,7 @@ var openaiResponsesChunkSchema = lazySchema(
26889
27341
  url: string().nullish(),
26890
27342
  pattern: string().nullish()
26891
27343
  })
26892
- ])
27344
+ ]).nullish()
26893
27345
  }),
26894
27346
  object$1({
26895
27347
  type: literal("file_search_call"),
@@ -27003,6 +27455,25 @@ var openaiResponsesChunkSchema = lazySchema(
27003
27455
  action: object$1({
27004
27456
  commands: array$1(string())
27005
27457
  })
27458
+ }),
27459
+ object$1({
27460
+ type: literal("shell_call_output"),
27461
+ id: string(),
27462
+ call_id: string(),
27463
+ status: _enum$1(["in_progress", "completed", "incomplete"]),
27464
+ output: array$1(
27465
+ object$1({
27466
+ stdout: string(),
27467
+ stderr: string(),
27468
+ outcome: discriminatedUnion("type", [
27469
+ object$1({ type: literal("timeout") }),
27470
+ object$1({
27471
+ type: literal("exit"),
27472
+ exit_code: number$1()
27473
+ })
27474
+ ])
27475
+ })
27476
+ )
27006
27477
  })
27007
27478
  ])
27008
27479
  }),
@@ -27186,7 +27657,10 @@ var openaiResponsesResponseSchema = lazySchema(
27186
27657
  sources: array$1(
27187
27658
  discriminatedUnion("type", [
27188
27659
  object$1({ type: literal("url"), url: string() }),
27189
- object$1({ type: literal("api"), name: string() })
27660
+ object$1({
27661
+ type: literal("api"),
27662
+ name: string()
27663
+ })
27190
27664
  ])
27191
27665
  ).nullish()
27192
27666
  }),
@@ -27199,7 +27673,7 @@ var openaiResponsesResponseSchema = lazySchema(
27199
27673
  url: string().nullish(),
27200
27674
  pattern: string().nullish()
27201
27675
  })
27202
- ])
27676
+ ]).nullish()
27203
27677
  }),
27204
27678
  object$1({
27205
27679
  type: literal("file_search_call"),
@@ -27348,6 +27822,25 @@ var openaiResponsesResponseSchema = lazySchema(
27348
27822
  action: object$1({
27349
27823
  commands: array$1(string())
27350
27824
  })
27825
+ }),
27826
+ object$1({
27827
+ type: literal("shell_call_output"),
27828
+ id: string(),
27829
+ call_id: string(),
27830
+ status: _enum$1(["in_progress", "completed", "incomplete"]),
27831
+ output: array$1(
27832
+ object$1({
27833
+ stdout: string(),
27834
+ stderr: string(),
27835
+ outcome: discriminatedUnion("type", [
27836
+ object$1({ type: literal("timeout") }),
27837
+ object$1({
27838
+ type: literal("exit"),
27839
+ exit_code: number$1()
27840
+ })
27841
+ ])
27842
+ })
27843
+ )
27351
27844
  })
27352
27845
  ])
27353
27846
  ).optional(),
@@ -27564,8 +28057,15 @@ async function prepareResponsesTools({
27564
28057
  break;
27565
28058
  }
27566
28059
  case "openai.shell": {
28060
+ const args = await validateTypes$1({
28061
+ value: tool2.args,
28062
+ schema: shellArgsSchema
28063
+ });
27567
28064
  openaiTools2.push({
27568
- type: "shell"
28065
+ type: "shell",
28066
+ ...args.environment && {
28067
+ environment: mapShellEnvironment(args.environment)
28068
+ }
27569
28069
  });
27570
28070
  break;
27571
28071
  }
@@ -27695,6 +28195,52 @@ async function prepareResponsesTools({
27695
28195
  }
27696
28196
  }
27697
28197
  }
28198
+ function mapShellEnvironment(environment) {
28199
+ if (environment.type === "containerReference") {
28200
+ const env2 = environment;
28201
+ return {
28202
+ type: "container_reference",
28203
+ container_id: env2.containerId
28204
+ };
28205
+ }
28206
+ if (environment.type === "containerAuto") {
28207
+ const env2 = environment;
28208
+ return {
28209
+ type: "container_auto",
28210
+ file_ids: env2.fileIds,
28211
+ memory_limit: env2.memoryLimit,
28212
+ network_policy: env2.networkPolicy == null ? void 0 : env2.networkPolicy.type === "disabled" ? { type: "disabled" } : {
28213
+ type: "allowlist",
28214
+ allowed_domains: env2.networkPolicy.allowedDomains,
28215
+ domain_secrets: env2.networkPolicy.domainSecrets
28216
+ },
28217
+ skills: mapShellSkills(env2.skills)
28218
+ };
28219
+ }
28220
+ const env = environment;
28221
+ return {
28222
+ type: "local",
28223
+ skills: env.skills
28224
+ };
28225
+ }
28226
+ function mapShellSkills(skills) {
28227
+ return skills == null ? void 0 : skills.map(
28228
+ (skill) => skill.type === "skillReference" ? {
28229
+ type: "skill_reference",
28230
+ skill_id: skill.skillId,
28231
+ version: skill.version
28232
+ } : {
28233
+ type: "inline",
28234
+ name: skill.name,
28235
+ description: skill.description,
28236
+ source: {
28237
+ type: "base64",
28238
+ media_type: skill.source.mediaType,
28239
+ data: skill.source.data
28240
+ }
28241
+ }
28242
+ );
28243
+ }
27698
28244
  function extractApprovalRequestIdToToolCallIdMapping(prompt) {
27699
28245
  var _a10, _b9;
27700
28246
  const mapping = {};
@@ -27738,7 +28284,7 @@ var OpenAIResponsesLanguageModel = class {
27738
28284
  toolChoice,
27739
28285
  responseFormat
27740
28286
  }) {
27741
- var _a10, _b9, _c, _d, _e, _f;
28287
+ var _a10, _b9, _c, _d, _e, _f, _g, _h, _i;
27742
28288
  const warnings = [];
27743
28289
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
27744
28290
  if (topK != null) {
@@ -27942,6 +28488,10 @@ var OpenAIResponsesLanguageModel = class {
27942
28488
  tools,
27943
28489
  toolChoice
27944
28490
  });
28491
+ const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
28492
+ (tool2) => tool2.type === "provider" && tool2.id === "openai.shell"
28493
+ )) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
28494
+ const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
27945
28495
  return {
27946
28496
  webSearchToolName,
27947
28497
  args: {
@@ -27952,7 +28502,8 @@ var OpenAIResponsesLanguageModel = class {
27952
28502
  warnings: [...warnings, ...toolWarnings],
27953
28503
  store,
27954
28504
  toolNameMapping,
27955
- providerOptionsName
28505
+ providerOptionsName,
28506
+ isShellProviderExecuted
27956
28507
  };
27957
28508
  }
27958
28509
  async doGenerate(options) {
@@ -27962,7 +28513,8 @@ var OpenAIResponsesLanguageModel = class {
27962
28513
  warnings,
27963
28514
  webSearchToolName,
27964
28515
  toolNameMapping,
27965
- providerOptionsName
28516
+ providerOptionsName,
28517
+ isShellProviderExecuted
27966
28518
  } = await this.getArgs(options);
27967
28519
  const url2 = this.config.url({
27968
28520
  path: "/responses",
@@ -28062,6 +28614,7 @@ var OpenAIResponsesLanguageModel = class {
28062
28614
  commands: part.action.commands
28063
28615
  }
28064
28616
  }),
28617
+ ...isShellProviderExecuted && { providerExecuted: true },
28065
28618
  providerMetadata: {
28066
28619
  [providerOptionsName]: {
28067
28620
  itemId: part.id
@@ -28070,6 +28623,24 @@ var OpenAIResponsesLanguageModel = class {
28070
28623
  });
28071
28624
  break;
28072
28625
  }
28626
+ case "shell_call_output": {
28627
+ content.push({
28628
+ type: "tool-result",
28629
+ toolCallId: part.call_id,
28630
+ toolName: toolNameMapping.toCustomToolName("shell"),
28631
+ result: {
28632
+ output: part.output.map((item) => ({
28633
+ stdout: item.stdout,
28634
+ stderr: item.stderr,
28635
+ outcome: item.outcome.type === "exit" ? {
28636
+ type: "exit",
28637
+ exitCode: item.outcome.exit_code
28638
+ } : { type: "timeout" }
28639
+ }))
28640
+ }
28641
+ });
28642
+ break;
28643
+ }
28073
28644
  case "message": {
28074
28645
  for (const contentPart of part.content) {
28075
28646
  if (((_c = (_b9 = options.providerOptions) == null ? void 0 : _b9[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
@@ -28359,7 +28930,8 @@ var OpenAIResponsesLanguageModel = class {
28359
28930
  webSearchToolName,
28360
28931
  toolNameMapping,
28361
28932
  store,
28362
- providerOptionsName
28933
+ providerOptionsName,
28934
+ isShellProviderExecuted
28363
28935
  } = await this.getArgs(options);
28364
28936
  const { responseHeaders, value: response } = await postJsonToApi$1({
28365
28937
  url: this.config.url({
@@ -28538,7 +29110,8 @@ var OpenAIResponsesLanguageModel = class {
28538
29110
  toolName: toolNameMapping.toCustomToolName("shell"),
28539
29111
  toolCallId: value.item.call_id
28540
29112
  };
28541
- } else if (value.item.type === "message") {
29113
+ } else if (value.item.type === "shell_call_output") ;
29114
+ else if (value.item.type === "message") {
28542
29115
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
28543
29116
  controller.enqueue({
28544
29117
  type: "text-start",
@@ -28791,10 +29364,31 @@ var OpenAIResponsesLanguageModel = class {
28791
29364
  commands: value.item.action.commands
28792
29365
  }
28793
29366
  }),
29367
+ ...isShellProviderExecuted && {
29368
+ providerExecuted: true
29369
+ },
28794
29370
  providerMetadata: {
28795
29371
  [providerOptionsName]: { itemId: value.item.id }
28796
29372
  }
28797
29373
  });
29374
+ } else if (value.item.type === "shell_call_output") {
29375
+ controller.enqueue({
29376
+ type: "tool-result",
29377
+ toolCallId: value.item.call_id,
29378
+ toolName: toolNameMapping.toCustomToolName("shell"),
29379
+ result: {
29380
+ output: value.item.output.map(
29381
+ (item) => ({
29382
+ stdout: item.stdout,
29383
+ stderr: item.stderr,
29384
+ outcome: item.outcome.type === "exit" ? {
29385
+ type: "exit",
29386
+ exitCode: item.outcome.exit_code
29387
+ } : { type: "timeout" }
29388
+ })
29389
+ )
29390
+ }
29391
+ });
28798
29392
  } else if (value.item.type === "reasoning") {
28799
29393
  const activeReasoningPart = activeReasoning[value.item.id];
28800
29394
  const summaryPartIndices = Object.entries(
@@ -29111,6 +29705,9 @@ function isErrorChunk(chunk) {
29111
29705
  }
29112
29706
  function mapWebSearchOutput(action) {
29113
29707
  var _a10;
29708
+ if (action == null) {
29709
+ return {};
29710
+ }
29114
29711
  switch (action.type) {
29115
29712
  case "search":
29116
29713
  return {
@@ -29463,7 +30060,7 @@ var OpenAITranscriptionModel = class {
29463
30060
  };
29464
30061
  }
29465
30062
  };
29466
- var VERSION$2 = "3.0.28";
30063
+ var VERSION$2 = "3.0.33";
29467
30064
  function createOpenAI(options = {}) {
29468
30065
  var _a10, _b9;
29469
30066
  const baseURL = (_a10 = withoutTrailingSlash$1(
@@ -32528,7 +33125,7 @@ function requireScope() {
32528
33125
  (function(exports) {
32529
33126
  Object.defineProperty(exports, "__esModule", { value: true });
32530
33127
  exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
32531
- const code_1 = requireCode$1();
33128
+ const code_1 = /* @__PURE__ */ requireCode$1();
32532
33129
  class ValueError extends Error {
32533
33130
  constructor(name16) {
32534
33131
  super(`CodeGen: "code" for ${name16} not defined`);
@@ -32674,9 +33271,9 @@ function requireCodegen() {
32674
33271
  (function(exports) {
32675
33272
  Object.defineProperty(exports, "__esModule", { value: true });
32676
33273
  exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
32677
- const code_1 = requireCode$1();
32678
- const scope_1 = requireScope();
32679
- var code_2 = requireCode$1();
33274
+ const code_1 = /* @__PURE__ */ requireCode$1();
33275
+ const scope_1 = /* @__PURE__ */ requireScope();
33276
+ var code_2 = /* @__PURE__ */ requireCode$1();
32680
33277
  Object.defineProperty(exports, "_", { enumerable: true, get: function() {
32681
33278
  return code_2._;
32682
33279
  } });
@@ -32701,7 +33298,7 @@ function requireCodegen() {
32701
33298
  Object.defineProperty(exports, "Name", { enumerable: true, get: function() {
32702
33299
  return code_2.Name;
32703
33300
  } });
32704
- var scope_2 = requireScope();
33301
+ var scope_2 = /* @__PURE__ */ requireScope();
32705
33302
  Object.defineProperty(exports, "Scope", { enumerable: true, get: function() {
32706
33303
  return scope_2.Scope;
32707
33304
  } });
@@ -33395,8 +33992,8 @@ function requireUtil() {
33395
33992
  hasRequiredUtil = 1;
33396
33993
  Object.defineProperty(util, "__esModule", { value: true });
33397
33994
  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;
33398
- const codegen_1 = requireCodegen();
33399
- const code_1 = requireCode$1();
33995
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
33996
+ const code_1 = /* @__PURE__ */ requireCode$1();
33400
33997
  function toHash(arr) {
33401
33998
  const hash = {};
33402
33999
  for (const item of arr)
@@ -33561,7 +34158,7 @@ function requireNames() {
33561
34158
  if (hasRequiredNames) return names;
33562
34159
  hasRequiredNames = 1;
33563
34160
  Object.defineProperty(names, "__esModule", { value: true });
33564
- const codegen_1 = requireCodegen();
34161
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
33565
34162
  const names$1 = {
33566
34163
  // validation function arguments
33567
34164
  data: new codegen_1.Name("data"),
@@ -33601,9 +34198,9 @@ function requireErrors() {
33601
34198
  (function(exports) {
33602
34199
  Object.defineProperty(exports, "__esModule", { value: true });
33603
34200
  exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
33604
- const codegen_1 = requireCodegen();
33605
- const util_1 = requireUtil();
33606
- const names_1 = requireNames();
34201
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34202
+ const util_1 = /* @__PURE__ */ requireUtil();
34203
+ const names_1 = /* @__PURE__ */ requireNames();
33607
34204
  exports.keywordError = {
33608
34205
  message: ({ keyword: keyword2 }) => (0, codegen_1.str)`must pass "${keyword2}" keyword validation`
33609
34206
  };
@@ -33723,9 +34320,9 @@ function requireBoolSchema() {
33723
34320
  hasRequiredBoolSchema = 1;
33724
34321
  Object.defineProperty(boolSchema, "__esModule", { value: true });
33725
34322
  boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
33726
- const errors_1 = requireErrors();
33727
- const codegen_1 = requireCodegen();
33728
- const names_1 = requireNames();
34323
+ const errors_1 = /* @__PURE__ */ requireErrors();
34324
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34325
+ const names_1 = /* @__PURE__ */ requireNames();
33729
34326
  const boolError = {
33730
34327
  message: "boolean schema is false"
33731
34328
  };
@@ -33828,11 +34425,11 @@ function requireDataType() {
33828
34425
  hasRequiredDataType = 1;
33829
34426
  Object.defineProperty(dataType, "__esModule", { value: true });
33830
34427
  dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
33831
- const rules_1 = requireRules();
33832
- const applicability_1 = requireApplicability();
33833
- const errors_1 = requireErrors();
33834
- const codegen_1 = requireCodegen();
33835
- const util_1 = requireUtil();
34428
+ const rules_1 = /* @__PURE__ */ requireRules();
34429
+ const applicability_1 = /* @__PURE__ */ requireApplicability();
34430
+ const errors_1 = /* @__PURE__ */ requireErrors();
34431
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34432
+ const util_1 = /* @__PURE__ */ requireUtil();
33836
34433
  var DataType;
33837
34434
  (function(DataType2) {
33838
34435
  DataType2[DataType2["Correct"] = 0] = "Correct";
@@ -34012,8 +34609,8 @@ function requireDefaults() {
34012
34609
  hasRequiredDefaults = 1;
34013
34610
  Object.defineProperty(defaults, "__esModule", { value: true });
34014
34611
  defaults.assignDefaults = void 0;
34015
- const codegen_1 = requireCodegen();
34016
- const util_1 = requireUtil();
34612
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34613
+ const util_1 = /* @__PURE__ */ requireUtil();
34017
34614
  function assignDefaults(it, ty) {
34018
34615
  const { properties: properties2, items: items2 } = it.schema;
34019
34616
  if (ty === "object" && properties2) {
@@ -34050,10 +34647,10 @@ function requireCode() {
34050
34647
  hasRequiredCode = 1;
34051
34648
  Object.defineProperty(code, "__esModule", { value: true });
34052
34649
  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;
34053
- const codegen_1 = requireCodegen();
34054
- const util_1 = requireUtil();
34055
- const names_1 = requireNames();
34056
- const util_2 = requireUtil();
34650
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34651
+ const util_1 = /* @__PURE__ */ requireUtil();
34652
+ const names_1 = /* @__PURE__ */ requireNames();
34653
+ const util_2 = /* @__PURE__ */ requireUtil();
34057
34654
  function checkReportMissingProp(cxt, prop) {
34058
34655
  const { gen, data, it } = cxt;
34059
34656
  gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
@@ -34182,10 +34779,10 @@ function requireKeyword() {
34182
34779
  hasRequiredKeyword = 1;
34183
34780
  Object.defineProperty(keyword, "__esModule", { value: true });
34184
34781
  keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
34185
- const codegen_1 = requireCodegen();
34186
- const names_1 = requireNames();
34187
- const code_1 = requireCode();
34188
- const errors_1 = requireErrors();
34782
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34783
+ const names_1 = /* @__PURE__ */ requireNames();
34784
+ const code_1 = /* @__PURE__ */ requireCode();
34785
+ const errors_1 = /* @__PURE__ */ requireErrors();
34189
34786
  function macroKeywordCode(cxt, def) {
34190
34787
  const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
34191
34788
  const macroSchema = def.macro.call(it.self, schema, parentSchema, it);
@@ -34300,8 +34897,8 @@ function requireSubschema() {
34300
34897
  hasRequiredSubschema = 1;
34301
34898
  Object.defineProperty(subschema, "__esModule", { value: true });
34302
34899
  subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
34303
- const codegen_1 = requireCodegen();
34304
- const util_1 = requireUtil();
34900
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
34901
+ const util_1 = /* @__PURE__ */ requireUtil();
34305
34902
  function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
34306
34903
  if (keyword2 !== void 0 && schema !== void 0) {
34307
34904
  throw new Error('both "keyword" and "schema" passed, only one allowed');
@@ -34506,7 +35103,7 @@ function requireResolve() {
34506
35103
  hasRequiredResolve = 1;
34507
35104
  Object.defineProperty(resolve, "__esModule", { value: true });
34508
35105
  resolve.getSchemaRefs = resolve.resolveUrl = resolve.normalizeId = resolve._getFullPath = resolve.getFullPath = resolve.inlineRef = void 0;
34509
- const util_1 = requireUtil();
35106
+ const util_1 = /* @__PURE__ */ requireUtil();
34510
35107
  const equal2 = requireFastDeepEqual();
34511
35108
  const traverse = requireJsonSchemaTraverse();
34512
35109
  const SIMPLE_INLINED = /* @__PURE__ */ new Set([
@@ -34661,18 +35258,18 @@ function requireValidate() {
34661
35258
  hasRequiredValidate = 1;
34662
35259
  Object.defineProperty(validate, "__esModule", { value: true });
34663
35260
  validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
34664
- const boolSchema_1 = requireBoolSchema();
34665
- const dataType_1 = requireDataType();
34666
- const applicability_1 = requireApplicability();
34667
- const dataType_2 = requireDataType();
34668
- const defaults_1 = requireDefaults();
34669
- const keyword_1 = requireKeyword();
34670
- const subschema_1 = requireSubschema();
34671
- const codegen_1 = requireCodegen();
34672
- const names_1 = requireNames();
34673
- const resolve_1 = requireResolve();
34674
- const util_1 = requireUtil();
34675
- const errors_1 = requireErrors();
35261
+ const boolSchema_1 = /* @__PURE__ */ requireBoolSchema();
35262
+ const dataType_1 = /* @__PURE__ */ requireDataType();
35263
+ const applicability_1 = /* @__PURE__ */ requireApplicability();
35264
+ const dataType_2 = /* @__PURE__ */ requireDataType();
35265
+ const defaults_1 = /* @__PURE__ */ requireDefaults();
35266
+ const keyword_1 = /* @__PURE__ */ requireKeyword();
35267
+ const subschema_1 = /* @__PURE__ */ requireSubschema();
35268
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
35269
+ const names_1 = /* @__PURE__ */ requireNames();
35270
+ const resolve_1 = /* @__PURE__ */ requireResolve();
35271
+ const util_1 = /* @__PURE__ */ requireUtil();
35272
+ const errors_1 = /* @__PURE__ */ requireErrors();
34676
35273
  function validateFunctionCode(it) {
34677
35274
  if (isSchemaObj(it)) {
34678
35275
  checkKeywords(it);
@@ -35183,7 +35780,7 @@ function requireRef_error() {
35183
35780
  if (hasRequiredRef_error) return ref_error;
35184
35781
  hasRequiredRef_error = 1;
35185
35782
  Object.defineProperty(ref_error, "__esModule", { value: true });
35186
- const resolve_1 = requireResolve();
35783
+ const resolve_1 = /* @__PURE__ */ requireResolve();
35187
35784
  class MissingRefError extends Error {
35188
35785
  constructor(resolver, baseId, ref2, msg) {
35189
35786
  super(msg || `can't resolve reference ${ref2} from id ${baseId}`);
@@ -35201,12 +35798,12 @@ function requireCompile() {
35201
35798
  hasRequiredCompile = 1;
35202
35799
  Object.defineProperty(compile, "__esModule", { value: true });
35203
35800
  compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
35204
- const codegen_1 = requireCodegen();
35205
- const validation_error_1 = requireValidation_error();
35206
- const names_1 = requireNames();
35207
- const resolve_1 = requireResolve();
35208
- const util_1 = requireUtil();
35209
- const validate_1 = requireValidate();
35801
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
35802
+ const validation_error_1 = /* @__PURE__ */ requireValidation_error();
35803
+ const names_1 = /* @__PURE__ */ requireNames();
35804
+ const resolve_1 = /* @__PURE__ */ requireResolve();
35805
+ const util_1 = /* @__PURE__ */ requireUtil();
35806
+ const validate_1 = /* @__PURE__ */ requireValidate();
35210
35807
  class SchemaEnv {
35211
35808
  constructor(env) {
35212
35809
  var _a10;
@@ -36172,11 +36769,11 @@ function requireCore$1() {
36172
36769
  (function(exports) {
36173
36770
  Object.defineProperty(exports, "__esModule", { value: true });
36174
36771
  exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
36175
- var validate_1 = requireValidate();
36772
+ var validate_1 = /* @__PURE__ */ requireValidate();
36176
36773
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
36177
36774
  return validate_1.KeywordCxt;
36178
36775
  } });
36179
- var codegen_1 = requireCodegen();
36776
+ var codegen_1 = /* @__PURE__ */ requireCodegen();
36180
36777
  Object.defineProperty(exports, "_", { enumerable: true, get: function() {
36181
36778
  return codegen_1._;
36182
36779
  } });
@@ -36195,16 +36792,16 @@ function requireCore$1() {
36195
36792
  Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
36196
36793
  return codegen_1.CodeGen;
36197
36794
  } });
36198
- const validation_error_1 = requireValidation_error();
36199
- const ref_error_1 = requireRef_error();
36200
- const rules_1 = requireRules();
36201
- const compile_1 = requireCompile();
36202
- const codegen_2 = requireCodegen();
36203
- const resolve_1 = requireResolve();
36204
- const dataType_1 = requireDataType();
36205
- const util_1 = requireUtil();
36795
+ const validation_error_1 = /* @__PURE__ */ requireValidation_error();
36796
+ const ref_error_1 = /* @__PURE__ */ requireRef_error();
36797
+ const rules_1 = /* @__PURE__ */ requireRules();
36798
+ const compile_1 = /* @__PURE__ */ requireCompile();
36799
+ const codegen_2 = /* @__PURE__ */ requireCodegen();
36800
+ const resolve_1 = /* @__PURE__ */ requireResolve();
36801
+ const dataType_1 = /* @__PURE__ */ requireDataType();
36802
+ const util_1 = /* @__PURE__ */ requireUtil();
36206
36803
  const $dataRefSchema = require$$9;
36207
- const uri_1 = requireUri();
36804
+ const uri_1 = /* @__PURE__ */ requireUri();
36208
36805
  const defaultRegExp = (str, flags) => new RegExp(str, flags);
36209
36806
  defaultRegExp.code = "new RegExp";
36210
36807
  const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
@@ -36801,12 +37398,12 @@ function requireRef() {
36801
37398
  hasRequiredRef = 1;
36802
37399
  Object.defineProperty(ref, "__esModule", { value: true });
36803
37400
  ref.callRef = ref.getValidate = void 0;
36804
- const ref_error_1 = requireRef_error();
36805
- const code_1 = requireCode();
36806
- const codegen_1 = requireCodegen();
36807
- const names_1 = requireNames();
36808
- const compile_1 = requireCompile();
36809
- const util_1 = requireUtil();
37401
+ const ref_error_1 = /* @__PURE__ */ requireRef_error();
37402
+ const code_1 = /* @__PURE__ */ requireCode();
37403
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37404
+ const names_1 = /* @__PURE__ */ requireNames();
37405
+ const compile_1 = /* @__PURE__ */ requireCompile();
37406
+ const util_1 = /* @__PURE__ */ requireUtil();
36810
37407
  const def = {
36811
37408
  keyword: "$ref",
36812
37409
  schemaType: "string",
@@ -36921,8 +37518,8 @@ function requireCore() {
36921
37518
  if (hasRequiredCore) return core;
36922
37519
  hasRequiredCore = 1;
36923
37520
  Object.defineProperty(core, "__esModule", { value: true });
36924
- const id_1 = requireId();
36925
- const ref_1 = requireRef();
37521
+ const id_1 = /* @__PURE__ */ requireId();
37522
+ const ref_1 = /* @__PURE__ */ requireRef();
36926
37523
  const core$12 = [
36927
37524
  "$schema",
36928
37525
  "$id",
@@ -36943,7 +37540,7 @@ function requireLimitNumber() {
36943
37540
  if (hasRequiredLimitNumber) return limitNumber;
36944
37541
  hasRequiredLimitNumber = 1;
36945
37542
  Object.defineProperty(limitNumber, "__esModule", { value: true });
36946
- const codegen_1 = requireCodegen();
37543
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
36947
37544
  const ops = codegen_1.operators;
36948
37545
  const KWDs = {
36949
37546
  maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
@@ -36975,7 +37572,7 @@ function requireMultipleOf() {
36975
37572
  if (hasRequiredMultipleOf) return multipleOf;
36976
37573
  hasRequiredMultipleOf = 1;
36977
37574
  Object.defineProperty(multipleOf, "__esModule", { value: true });
36978
- const codegen_1 = requireCodegen();
37575
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
36979
37576
  const error = {
36980
37577
  message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
36981
37578
  params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
@@ -37029,9 +37626,9 @@ function requireLimitLength() {
37029
37626
  if (hasRequiredLimitLength) return limitLength;
37030
37627
  hasRequiredLimitLength = 1;
37031
37628
  Object.defineProperty(limitLength, "__esModule", { value: true });
37032
- const codegen_1 = requireCodegen();
37033
- const util_1 = requireUtil();
37034
- const ucs2length_1 = requireUcs2length();
37629
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37630
+ const util_1 = /* @__PURE__ */ requireUtil();
37631
+ const ucs2length_1 = /* @__PURE__ */ requireUcs2length();
37035
37632
  const error = {
37036
37633
  message({ keyword: keyword2, schemaCode }) {
37037
37634
  const comp = keyword2 === "maxLength" ? "more" : "fewer";
@@ -37061,8 +37658,9 @@ function requirePattern() {
37061
37658
  if (hasRequiredPattern) return pattern;
37062
37659
  hasRequiredPattern = 1;
37063
37660
  Object.defineProperty(pattern, "__esModule", { value: true });
37064
- const code_1 = requireCode();
37065
- const codegen_1 = requireCodegen();
37661
+ const code_1 = /* @__PURE__ */ requireCode();
37662
+ const util_1 = /* @__PURE__ */ requireUtil();
37663
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37066
37664
  const error = {
37067
37665
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
37068
37666
  params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
@@ -37074,10 +37672,18 @@ function requirePattern() {
37074
37672
  $data: true,
37075
37673
  error,
37076
37674
  code(cxt) {
37077
- const { data, $data, schema, schemaCode, it } = cxt;
37675
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
37078
37676
  const u = it.opts.unicodeRegExp ? "u" : "";
37079
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
37080
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
37677
+ if ($data) {
37678
+ const { regExp } = it.opts.code;
37679
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
37680
+ const valid = gen.let("valid");
37681
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
37682
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
37683
+ } else {
37684
+ const regExp = (0, code_1.usePattern)(cxt, schema);
37685
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
37686
+ }
37081
37687
  }
37082
37688
  };
37083
37689
  pattern.default = def;
@@ -37089,7 +37695,7 @@ function requireLimitProperties() {
37089
37695
  if (hasRequiredLimitProperties) return limitProperties;
37090
37696
  hasRequiredLimitProperties = 1;
37091
37697
  Object.defineProperty(limitProperties, "__esModule", { value: true });
37092
- const codegen_1 = requireCodegen();
37698
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37093
37699
  const error = {
37094
37700
  message({ keyword: keyword2, schemaCode }) {
37095
37701
  const comp = keyword2 === "maxProperties" ? "more" : "fewer";
@@ -37118,9 +37724,9 @@ function requireRequired() {
37118
37724
  if (hasRequiredRequired) return required;
37119
37725
  hasRequiredRequired = 1;
37120
37726
  Object.defineProperty(required, "__esModule", { value: true });
37121
- const code_1 = requireCode();
37122
- const codegen_1 = requireCodegen();
37123
- const util_1 = requireUtil();
37727
+ const code_1 = /* @__PURE__ */ requireCode();
37728
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37729
+ const util_1 = /* @__PURE__ */ requireUtil();
37124
37730
  const error = {
37125
37731
  message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
37126
37732
  params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
@@ -37200,7 +37806,7 @@ function requireLimitItems() {
37200
37806
  if (hasRequiredLimitItems) return limitItems;
37201
37807
  hasRequiredLimitItems = 1;
37202
37808
  Object.defineProperty(limitItems, "__esModule", { value: true });
37203
- const codegen_1 = requireCodegen();
37809
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37204
37810
  const error = {
37205
37811
  message({ keyword: keyword2, schemaCode }) {
37206
37812
  const comp = keyword2 === "maxItems" ? "more" : "fewer";
@@ -37240,10 +37846,10 @@ function requireUniqueItems() {
37240
37846
  if (hasRequiredUniqueItems) return uniqueItems;
37241
37847
  hasRequiredUniqueItems = 1;
37242
37848
  Object.defineProperty(uniqueItems, "__esModule", { value: true });
37243
- const dataType_1 = requireDataType();
37244
- const codegen_1 = requireCodegen();
37245
- const util_1 = requireUtil();
37246
- const equal_1 = requireEqual();
37849
+ const dataType_1 = /* @__PURE__ */ requireDataType();
37850
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37851
+ const util_1 = /* @__PURE__ */ requireUtil();
37852
+ const equal_1 = /* @__PURE__ */ requireEqual();
37247
37853
  const error = {
37248
37854
  message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
37249
37855
  params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
@@ -37307,9 +37913,9 @@ function require_const() {
37307
37913
  if (hasRequired_const) return _const;
37308
37914
  hasRequired_const = 1;
37309
37915
  Object.defineProperty(_const, "__esModule", { value: true });
37310
- const codegen_1 = requireCodegen();
37311
- const util_1 = requireUtil();
37312
- const equal_1 = requireEqual();
37916
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37917
+ const util_1 = /* @__PURE__ */ requireUtil();
37918
+ const equal_1 = /* @__PURE__ */ requireEqual();
37313
37919
  const error = {
37314
37920
  message: "must be equal to constant",
37315
37921
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
@@ -37336,9 +37942,9 @@ function require_enum() {
37336
37942
  if (hasRequired_enum) return _enum;
37337
37943
  hasRequired_enum = 1;
37338
37944
  Object.defineProperty(_enum, "__esModule", { value: true });
37339
- const codegen_1 = requireCodegen();
37340
- const util_1 = requireUtil();
37341
- const equal_1 = requireEqual();
37945
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
37946
+ const util_1 = /* @__PURE__ */ requireUtil();
37947
+ const equal_1 = /* @__PURE__ */ requireEqual();
37342
37948
  const error = {
37343
37949
  message: "must be equal to one of the allowed values",
37344
37950
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
@@ -37384,16 +37990,16 @@ function requireValidation() {
37384
37990
  if (hasRequiredValidation) return validation;
37385
37991
  hasRequiredValidation = 1;
37386
37992
  Object.defineProperty(validation, "__esModule", { value: true });
37387
- const limitNumber_1 = requireLimitNumber();
37388
- const multipleOf_1 = requireMultipleOf();
37389
- const limitLength_1 = requireLimitLength();
37390
- const pattern_1 = requirePattern();
37391
- const limitProperties_1 = requireLimitProperties();
37392
- const required_1 = requireRequired();
37393
- const limitItems_1 = requireLimitItems();
37394
- const uniqueItems_1 = requireUniqueItems();
37395
- const const_1 = require_const();
37396
- const enum_1 = require_enum();
37993
+ const limitNumber_1 = /* @__PURE__ */ requireLimitNumber();
37994
+ const multipleOf_1 = /* @__PURE__ */ requireMultipleOf();
37995
+ const limitLength_1 = /* @__PURE__ */ requireLimitLength();
37996
+ const pattern_1 = /* @__PURE__ */ requirePattern();
37997
+ const limitProperties_1 = /* @__PURE__ */ requireLimitProperties();
37998
+ const required_1 = /* @__PURE__ */ requireRequired();
37999
+ const limitItems_1 = /* @__PURE__ */ requireLimitItems();
38000
+ const uniqueItems_1 = /* @__PURE__ */ requireUniqueItems();
38001
+ const const_1 = /* @__PURE__ */ require_const();
38002
+ const enum_1 = /* @__PURE__ */ require_enum();
37397
38003
  const validation$1 = [
37398
38004
  // number
37399
38005
  limitNumber_1.default,
@@ -37424,8 +38030,8 @@ function requireAdditionalItems() {
37424
38030
  hasRequiredAdditionalItems = 1;
37425
38031
  Object.defineProperty(additionalItems, "__esModule", { value: true });
37426
38032
  additionalItems.validateAdditionalItems = void 0;
37427
- const codegen_1 = requireCodegen();
37428
- const util_1 = requireUtil();
38033
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38034
+ const util_1 = /* @__PURE__ */ requireUtil();
37429
38035
  const error = {
37430
38036
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
37431
38037
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
@@ -37478,9 +38084,9 @@ function requireItems() {
37478
38084
  hasRequiredItems = 1;
37479
38085
  Object.defineProperty(items, "__esModule", { value: true });
37480
38086
  items.validateTuple = void 0;
37481
- const codegen_1 = requireCodegen();
37482
- const util_1 = requireUtil();
37483
- const code_1 = requireCode();
38087
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38088
+ const util_1 = /* @__PURE__ */ requireUtil();
38089
+ const code_1 = /* @__PURE__ */ requireCode();
37484
38090
  const def = {
37485
38091
  keyword: "items",
37486
38092
  type: "array",
@@ -37533,7 +38139,7 @@ function requirePrefixItems() {
37533
38139
  if (hasRequiredPrefixItems) return prefixItems;
37534
38140
  hasRequiredPrefixItems = 1;
37535
38141
  Object.defineProperty(prefixItems, "__esModule", { value: true });
37536
- const items_1 = requireItems();
38142
+ const items_1 = /* @__PURE__ */ requireItems();
37537
38143
  const def = {
37538
38144
  keyword: "prefixItems",
37539
38145
  type: "array",
@@ -37550,10 +38156,10 @@ function requireItems2020() {
37550
38156
  if (hasRequiredItems2020) return items2020;
37551
38157
  hasRequiredItems2020 = 1;
37552
38158
  Object.defineProperty(items2020, "__esModule", { value: true });
37553
- const codegen_1 = requireCodegen();
37554
- const util_1 = requireUtil();
37555
- const code_1 = requireCode();
37556
- const additionalItems_1 = requireAdditionalItems();
38159
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38160
+ const util_1 = /* @__PURE__ */ requireUtil();
38161
+ const code_1 = /* @__PURE__ */ requireCode();
38162
+ const additionalItems_1 = /* @__PURE__ */ requireAdditionalItems();
37557
38163
  const error = {
37558
38164
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
37559
38165
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
@@ -37585,8 +38191,8 @@ function requireContains() {
37585
38191
  if (hasRequiredContains) return contains;
37586
38192
  hasRequiredContains = 1;
37587
38193
  Object.defineProperty(contains, "__esModule", { value: true });
37588
- const codegen_1 = requireCodegen();
37589
- const util_1 = requireUtil();
38194
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38195
+ const util_1 = /* @__PURE__ */ requireUtil();
37590
38196
  const error = {
37591
38197
  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)`,
37592
38198
  params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
@@ -37681,9 +38287,9 @@ function requireDependencies() {
37681
38287
  (function(exports) {
37682
38288
  Object.defineProperty(exports, "__esModule", { value: true });
37683
38289
  exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
37684
- const codegen_1 = requireCodegen();
37685
- const util_1 = requireUtil();
37686
- const code_1 = requireCode();
38290
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38291
+ const util_1 = /* @__PURE__ */ requireUtil();
38292
+ const code_1 = /* @__PURE__ */ requireCode();
37687
38293
  exports.error = {
37688
38294
  message: ({ params: { property, depsCount, deps } }) => {
37689
38295
  const property_ies = depsCount === 1 ? "property" : "properties";
@@ -37775,8 +38381,8 @@ function requirePropertyNames() {
37775
38381
  if (hasRequiredPropertyNames) return propertyNames;
37776
38382
  hasRequiredPropertyNames = 1;
37777
38383
  Object.defineProperty(propertyNames, "__esModule", { value: true });
37778
- const codegen_1 = requireCodegen();
37779
- const util_1 = requireUtil();
38384
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38385
+ const util_1 = /* @__PURE__ */ requireUtil();
37780
38386
  const error = {
37781
38387
  message: "property name must be valid",
37782
38388
  params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
@@ -37818,10 +38424,10 @@ function requireAdditionalProperties() {
37818
38424
  if (hasRequiredAdditionalProperties) return additionalProperties;
37819
38425
  hasRequiredAdditionalProperties = 1;
37820
38426
  Object.defineProperty(additionalProperties, "__esModule", { value: true });
37821
- const code_1 = requireCode();
37822
- const codegen_1 = requireCodegen();
37823
- const names_1 = requireNames();
37824
- const util_1 = requireUtil();
38427
+ const code_1 = /* @__PURE__ */ requireCode();
38428
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38429
+ const names_1 = /* @__PURE__ */ requireNames();
38430
+ const util_1 = /* @__PURE__ */ requireUtil();
37825
38431
  const error = {
37826
38432
  message: "must NOT have additional properties",
37827
38433
  params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
@@ -37924,10 +38530,10 @@ function requireProperties() {
37924
38530
  if (hasRequiredProperties) return properties$1;
37925
38531
  hasRequiredProperties = 1;
37926
38532
  Object.defineProperty(properties$1, "__esModule", { value: true });
37927
- const validate_1 = requireValidate();
37928
- const code_1 = requireCode();
37929
- const util_1 = requireUtil();
37930
- const additionalProperties_1 = requireAdditionalProperties();
38533
+ const validate_1 = /* @__PURE__ */ requireValidate();
38534
+ const code_1 = /* @__PURE__ */ requireCode();
38535
+ const util_1 = /* @__PURE__ */ requireUtil();
38536
+ const additionalProperties_1 = /* @__PURE__ */ requireAdditionalProperties();
37931
38537
  const def = {
37932
38538
  keyword: "properties",
37933
38539
  type: "object",
@@ -37982,10 +38588,10 @@ function requirePatternProperties() {
37982
38588
  if (hasRequiredPatternProperties) return patternProperties;
37983
38589
  hasRequiredPatternProperties = 1;
37984
38590
  Object.defineProperty(patternProperties, "__esModule", { value: true });
37985
- const code_1 = requireCode();
37986
- const codegen_1 = requireCodegen();
37987
- const util_1 = requireUtil();
37988
- const util_2 = requireUtil();
38591
+ const code_1 = /* @__PURE__ */ requireCode();
38592
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38593
+ const util_1 = /* @__PURE__ */ requireUtil();
38594
+ const util_2 = /* @__PURE__ */ requireUtil();
37989
38595
  const def = {
37990
38596
  keyword: "patternProperties",
37991
38597
  type: "object",
@@ -38056,7 +38662,7 @@ function requireNot() {
38056
38662
  if (hasRequiredNot) return not;
38057
38663
  hasRequiredNot = 1;
38058
38664
  Object.defineProperty(not, "__esModule", { value: true });
38059
- const util_1 = requireUtil();
38665
+ const util_1 = /* @__PURE__ */ requireUtil();
38060
38666
  const def = {
38061
38667
  keyword: "not",
38062
38668
  schemaType: ["object", "boolean"],
@@ -38087,7 +38693,7 @@ function requireAnyOf() {
38087
38693
  if (hasRequiredAnyOf) return anyOf;
38088
38694
  hasRequiredAnyOf = 1;
38089
38695
  Object.defineProperty(anyOf, "__esModule", { value: true });
38090
- const code_1 = requireCode();
38696
+ const code_1 = /* @__PURE__ */ requireCode();
38091
38697
  const def = {
38092
38698
  keyword: "anyOf",
38093
38699
  schemaType: "array",
@@ -38104,8 +38710,8 @@ function requireOneOf() {
38104
38710
  if (hasRequiredOneOf) return oneOf;
38105
38711
  hasRequiredOneOf = 1;
38106
38712
  Object.defineProperty(oneOf, "__esModule", { value: true });
38107
- const codegen_1 = requireCodegen();
38108
- const util_1 = requireUtil();
38713
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38714
+ const util_1 = /* @__PURE__ */ requireUtil();
38109
38715
  const error = {
38110
38716
  message: "must match exactly one schema in oneOf",
38111
38717
  params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
@@ -38162,7 +38768,7 @@ function requireAllOf() {
38162
38768
  if (hasRequiredAllOf) return allOf;
38163
38769
  hasRequiredAllOf = 1;
38164
38770
  Object.defineProperty(allOf, "__esModule", { value: true });
38165
- const util_1 = requireUtil();
38771
+ const util_1 = /* @__PURE__ */ requireUtil();
38166
38772
  const def = {
38167
38773
  keyword: "allOf",
38168
38774
  schemaType: "array",
@@ -38189,8 +38795,8 @@ function require_if() {
38189
38795
  if (hasRequired_if) return _if;
38190
38796
  hasRequired_if = 1;
38191
38797
  Object.defineProperty(_if, "__esModule", { value: true });
38192
- const codegen_1 = requireCodegen();
38193
- const util_1 = requireUtil();
38798
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38799
+ const util_1 = /* @__PURE__ */ requireUtil();
38194
38800
  const error = {
38195
38801
  message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
38196
38802
  params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
@@ -38258,7 +38864,7 @@ function requireThenElse() {
38258
38864
  if (hasRequiredThenElse) return thenElse;
38259
38865
  hasRequiredThenElse = 1;
38260
38866
  Object.defineProperty(thenElse, "__esModule", { value: true });
38261
- const util_1 = requireUtil();
38867
+ const util_1 = /* @__PURE__ */ requireUtil();
38262
38868
  const def = {
38263
38869
  keyword: ["then", "else"],
38264
38870
  schemaType: ["object", "boolean"],
@@ -38275,22 +38881,22 @@ function requireApplicator() {
38275
38881
  if (hasRequiredApplicator) return applicator;
38276
38882
  hasRequiredApplicator = 1;
38277
38883
  Object.defineProperty(applicator, "__esModule", { value: true });
38278
- const additionalItems_1 = requireAdditionalItems();
38279
- const prefixItems_1 = requirePrefixItems();
38280
- const items_1 = requireItems();
38281
- const items2020_1 = requireItems2020();
38282
- const contains_1 = requireContains();
38283
- const dependencies_1 = requireDependencies();
38284
- const propertyNames_1 = requirePropertyNames();
38285
- const additionalProperties_1 = requireAdditionalProperties();
38286
- const properties_1 = requireProperties();
38287
- const patternProperties_1 = requirePatternProperties();
38288
- const not_1 = requireNot();
38289
- const anyOf_1 = requireAnyOf();
38290
- const oneOf_1 = requireOneOf();
38291
- const allOf_1 = requireAllOf();
38292
- const if_1 = require_if();
38293
- const thenElse_1 = requireThenElse();
38884
+ const additionalItems_1 = /* @__PURE__ */ requireAdditionalItems();
38885
+ const prefixItems_1 = /* @__PURE__ */ requirePrefixItems();
38886
+ const items_1 = /* @__PURE__ */ requireItems();
38887
+ const items2020_1 = /* @__PURE__ */ requireItems2020();
38888
+ const contains_1 = /* @__PURE__ */ requireContains();
38889
+ const dependencies_1 = /* @__PURE__ */ requireDependencies();
38890
+ const propertyNames_1 = /* @__PURE__ */ requirePropertyNames();
38891
+ const additionalProperties_1 = /* @__PURE__ */ requireAdditionalProperties();
38892
+ const properties_1 = /* @__PURE__ */ requireProperties();
38893
+ const patternProperties_1 = /* @__PURE__ */ requirePatternProperties();
38894
+ const not_1 = /* @__PURE__ */ requireNot();
38895
+ const anyOf_1 = /* @__PURE__ */ requireAnyOf();
38896
+ const oneOf_1 = /* @__PURE__ */ requireOneOf();
38897
+ const allOf_1 = /* @__PURE__ */ requireAllOf();
38898
+ const if_1 = /* @__PURE__ */ require_if();
38899
+ const thenElse_1 = /* @__PURE__ */ requireThenElse();
38294
38900
  function getApplicator(draft2020 = false) {
38295
38901
  const applicator2 = [
38296
38902
  // any
@@ -38324,7 +38930,7 @@ function requireFormat$1() {
38324
38930
  if (hasRequiredFormat$1) return format;
38325
38931
  hasRequiredFormat$1 = 1;
38326
38932
  Object.defineProperty(format, "__esModule", { value: true });
38327
- const codegen_1 = requireCodegen();
38933
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38328
38934
  const error = {
38329
38935
  message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
38330
38936
  params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
@@ -38413,7 +39019,7 @@ function requireFormat() {
38413
39019
  if (hasRequiredFormat) return format$1;
38414
39020
  hasRequiredFormat = 1;
38415
39021
  Object.defineProperty(format$1, "__esModule", { value: true });
38416
- const format_1 = requireFormat$1();
39022
+ const format_1 = /* @__PURE__ */ requireFormat$1();
38417
39023
  const format2 = [format_1.default];
38418
39024
  format$1.default = format2;
38419
39025
  return format$1;
@@ -38446,11 +39052,11 @@ function requireDraft7() {
38446
39052
  if (hasRequiredDraft7) return draft7;
38447
39053
  hasRequiredDraft7 = 1;
38448
39054
  Object.defineProperty(draft7, "__esModule", { value: true });
38449
- const core_1 = requireCore();
38450
- const validation_1 = requireValidation();
38451
- const applicator_1 = requireApplicator();
38452
- const format_1 = requireFormat();
38453
- const metadata_1 = requireMetadata();
39055
+ const core_1 = /* @__PURE__ */ requireCore();
39056
+ const validation_1 = /* @__PURE__ */ requireValidation();
39057
+ const applicator_1 = /* @__PURE__ */ requireApplicator();
39058
+ const format_1 = /* @__PURE__ */ requireFormat();
39059
+ const metadata_1 = /* @__PURE__ */ requireMetadata();
38454
39060
  const draft7Vocabularies = [
38455
39061
  core_1.default,
38456
39062
  validation_1.default,
@@ -38482,11 +39088,11 @@ function requireDiscriminator() {
38482
39088
  if (hasRequiredDiscriminator) return discriminator;
38483
39089
  hasRequiredDiscriminator = 1;
38484
39090
  Object.defineProperty(discriminator, "__esModule", { value: true });
38485
- const codegen_1 = requireCodegen();
38486
- const types_1 = requireTypes();
38487
- const compile_1 = requireCompile();
38488
- const ref_error_1 = requireRef_error();
38489
- const util_1 = requireUtil();
39091
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
39092
+ const types_1 = /* @__PURE__ */ requireTypes();
39093
+ const compile_1 = /* @__PURE__ */ requireCompile();
39094
+ const ref_error_1 = /* @__PURE__ */ requireRef_error();
39095
+ const util_1 = /* @__PURE__ */ requireUtil();
38490
39096
  const error = {
38491
39097
  message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
38492
39098
  params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
@@ -38603,9 +39209,9 @@ function requireAjv() {
38603
39209
  (function(module, exports) {
38604
39210
  Object.defineProperty(exports, "__esModule", { value: true });
38605
39211
  exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;
38606
- const core_1 = requireCore$1();
38607
- const draft7_1 = requireDraft7();
38608
- const discriminator_1 = requireDiscriminator();
39212
+ const core_1 = /* @__PURE__ */ requireCore$1();
39213
+ const draft7_1 = /* @__PURE__ */ requireDraft7();
39214
+ const discriminator_1 = /* @__PURE__ */ requireDiscriminator();
38609
39215
  const draft7MetaSchema = require$$3;
38610
39216
  const META_SUPPORT_DATA = ["/properties"];
38611
39217
  const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
@@ -38633,11 +39239,11 @@ function requireAjv() {
38633
39239
  module.exports.Ajv = Ajv2;
38634
39240
  Object.defineProperty(exports, "__esModule", { value: true });
38635
39241
  exports.default = Ajv2;
38636
- var validate_1 = requireValidate();
39242
+ var validate_1 = /* @__PURE__ */ requireValidate();
38637
39243
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
38638
39244
  return validate_1.KeywordCxt;
38639
39245
  } });
38640
- var codegen_1 = requireCodegen();
39246
+ var codegen_1 = /* @__PURE__ */ requireCodegen();
38641
39247
  Object.defineProperty(exports, "_", { enumerable: true, get: function() {
38642
39248
  return codegen_1._;
38643
39249
  } });
@@ -38656,18 +39262,18 @@ function requireAjv() {
38656
39262
  Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
38657
39263
  return codegen_1.CodeGen;
38658
39264
  } });
38659
- var validation_error_1 = requireValidation_error();
39265
+ var validation_error_1 = /* @__PURE__ */ requireValidation_error();
38660
39266
  Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() {
38661
39267
  return validation_error_1.default;
38662
39268
  } });
38663
- var ref_error_1 = requireRef_error();
39269
+ var ref_error_1 = /* @__PURE__ */ requireRef_error();
38664
39270
  Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function() {
38665
39271
  return ref_error_1.default;
38666
39272
  } });
38667
39273
  })(ajv, ajv.exports);
38668
39274
  return ajv.exports;
38669
39275
  }
38670
- var ajvExports = requireAjv();
39276
+ var ajvExports = /* @__PURE__ */ requireAjv();
38671
39277
  const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports);
38672
39278
  var dist = { exports: {} };
38673
39279
  var formats = {};
@@ -38883,8 +39489,8 @@ function requireLimit() {
38883
39489
  (function(exports) {
38884
39490
  Object.defineProperty(exports, "__esModule", { value: true });
38885
39491
  exports.formatLimitDefinition = void 0;
38886
- const ajv_1 = requireAjv();
38887
- const codegen_1 = requireCodegen();
39492
+ const ajv_1 = /* @__PURE__ */ requireAjv();
39493
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38888
39494
  const ops = codegen_1.operators;
38889
39495
  const KWDs = {
38890
39496
  formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
@@ -38957,7 +39563,7 @@ function requireDist() {
38957
39563
  Object.defineProperty(exports, "__esModule", { value: true });
38958
39564
  const formats_1 = requireFormats();
38959
39565
  const limit_1 = requireLimit();
38960
- const codegen_1 = requireCodegen();
39566
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
38961
39567
  const fullName = new codegen_1.Name("fullFormats");
38962
39568
  const fastName = new codegen_1.Name("fastFormats");
38963
39569
  const formatsPlugin = (ajv2, opts = { keywords: true }) => {