@modelrelay/sdk 2.1.0 → 4.0.0

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.
Files changed (42) hide show
  1. package/dist/api-Bitsm1tl.d.cts +5290 -0
  2. package/dist/api-Bitsm1tl.d.ts +5290 -0
  3. package/dist/{api-Ct5bpI3U.d.cts → api-CzFaWgs_.d.cts} +2636 -2113
  4. package/dist/{api-Ct5bpI3U.d.ts → api-CzFaWgs_.d.ts} +2636 -2113
  5. package/dist/{api-Bb7sw9L4.d.cts → api-D0wnVpwn.d.cts} +2598 -2148
  6. package/dist/{api-Bb7sw9L4.d.ts → api-D0wnVpwn.d.ts} +2598 -2148
  7. package/dist/billing/index.d.cts +1 -1
  8. package/dist/billing/index.d.ts +1 -1
  9. package/dist/{chunk-AZD5EKLV.js → chunk-5O4NJXLJ.js} +1 -1
  10. package/dist/{chunk-4FXUTSRZ.js → chunk-ADQ74R7T.js} +1 -1
  11. package/dist/{chunk-CXJZB6MA.js → chunk-CV3DTA6P.js} +1 -1
  12. package/dist/{chunk-VOFLESGQ.js → chunk-EMQKOEF3.js} +10 -8
  13. package/dist/{chunk-R6O6UQYM.js → chunk-JZRSCFQH.js} +1 -1
  14. package/dist/{chunk-MXXJDLGU.js → chunk-LW6SC7NQ.js} +2 -63
  15. package/dist/index.cjs +58 -51
  16. package/dist/index.d.cts +27 -21
  17. package/dist/index.d.ts +27 -21
  18. package/dist/index.js +58 -51
  19. package/dist/node.cjs +1 -1
  20. package/dist/node.js +1 -1
  21. package/dist/{tools-B7444ZtV.d.cts → tools-DAqAFZ8F.d.cts} +11 -13
  22. package/dist/{tools-B7444ZtV.d.ts → tools-DAqAFZ8F.d.ts} +11 -13
  23. package/package.json +1 -1
  24. package/dist/api-DWUVls-S.d.cts +0 -4762
  25. package/dist/api-DWUVls-S.d.ts +0 -4762
  26. package/dist/api-DZpC1zuz.d.cts +0 -4691
  27. package/dist/api-DZpC1zuz.d.ts +0 -4691
  28. package/dist/api-D_hE36Ps.d.cts +0 -4535
  29. package/dist/api-D_hE36Ps.d.ts +0 -4535
  30. package/dist/api-Dz9HcUTt.d.cts +0 -4522
  31. package/dist/api-Dz9HcUTt.d.ts +0 -4522
  32. package/dist/chunk-BP5HUQ4M.js +0 -1194
  33. package/dist/chunk-CYGWZYYJ.js +0 -1194
  34. package/dist/chunk-PLZWDUOP.js +0 -1194
  35. package/dist/chunk-SCOP57J4.js +0 -1194
  36. package/dist/chunk-SXNP5Y5L.js +0 -1194
  37. package/dist/tools-CWEBFsql.d.cts +0 -1192
  38. package/dist/tools-CWEBFsql.d.ts +0 -1192
  39. package/dist/tools-CvfwPjC5.d.cts +0 -1098
  40. package/dist/tools-CvfwPjC5.d.ts +0 -1098
  41. package/dist/tools-DUYHZdZP.d.cts +0 -982
  42. package/dist/tools-DUYHZdZP.d.ts +0 -982
@@ -1,4 +1,4 @@
1
- import { c as components } from '../api-D_hE36Ps.cjs';
1
+ import { c as components } from '../api-Bitsm1tl.cjs';
2
2
 
3
3
  /**
4
4
  * Billing client for customer self-service operations.
@@ -1,4 +1,4 @@
1
- import { c as components } from '../api-D_hE36Ps.js';
1
+ import { c as components } from '../api-Bitsm1tl.js';
2
2
 
3
3
  /**
4
4
  * Billing client for customer self-service operations.
@@ -220,7 +220,7 @@ async function parseErrorResponse(response, retries) {
220
220
  // package.json
221
221
  var package_default = {
222
222
  name: "@modelrelay/sdk",
223
- version: "2.1.0",
223
+ version: "4.0.0",
224
224
  description: "TypeScript SDK for the ModelRelay API",
225
225
  type: "module",
226
226
  main: "dist/index.cjs",
@@ -276,7 +276,7 @@ async function parseErrorResponse(response, retries) {
276
276
  // package.json
277
277
  var package_default = {
278
278
  name: "@modelrelay/sdk",
279
- version: "2.0.0",
279
+ version: "1.36.0",
280
280
  description: "TypeScript SDK for the ModelRelay API",
281
281
  type: "module",
282
282
  main: "dist/index.cjs",
@@ -282,7 +282,7 @@ async function parseErrorResponse(response, retries) {
282
282
  // package.json
283
283
  var package_default = {
284
284
  name: "@modelrelay/sdk",
285
- version: "1.34.0",
285
+ version: "1.29.0",
286
286
  description: "TypeScript SDK for the ModelRelay API",
287
287
  type: "module",
288
288
  main: "dist/index.cjs",
@@ -1,3 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
1
7
  // src/errors.ts
2
8
  var ErrorCodes = {
3
9
  NOT_FOUND: "NOT_FOUND",
@@ -276,7 +282,7 @@ async function parseErrorResponse(response, retries) {
276
282
  // package.json
277
283
  var package_default = {
278
284
  name: "@modelrelay/sdk",
279
- version: "1.35.0",
285
+ version: "1.30.0",
280
286
  description: "TypeScript SDK for the ModelRelay API",
281
287
  type: "module",
282
288
  main: "dist/index.cjs",
@@ -288,11 +294,6 @@ var package_default = {
288
294
  import: "./dist/index.js",
289
295
  require: "./dist/index.cjs"
290
296
  },
291
- "./billing": {
292
- types: "./dist/billing/index.d.ts",
293
- import: "./dist/billing/index.js",
294
- require: "./dist/billing/index.cjs"
295
- },
296
297
  "./node": {
297
298
  types: "./dist/node.d.ts",
298
299
  import: "./dist/node.js",
@@ -306,8 +307,8 @@ var package_default = {
306
307
  "dist"
307
308
  ],
308
309
  scripts: {
309
- build: "tsup src/index.ts src/node.ts src/billing/index.ts --format esm,cjs --dts --external playwright",
310
- dev: "tsup src/index.ts src/node.ts src/billing/index.ts --format esm,cjs --dts --watch",
310
+ build: "tsup src/index.ts src/node.ts --format esm,cjs --dts --external playwright",
311
+ dev: "tsup src/index.ts src/node.ts --format esm,cjs --dts --watch",
311
312
  lint: "tsc --noEmit --project tsconfig.lint.json",
312
313
  test: "vitest run",
313
314
  "generate:types": "openapi-typescript ../../api/openapi/api.json -o src/generated/api.ts"
@@ -1121,6 +1122,7 @@ async function executeWithRetry(registry, toolCalls, options = {}) {
1121
1122
  }
1122
1123
 
1123
1124
  export {
1125
+ __export,
1124
1126
  ErrorCodes,
1125
1127
  ModelRelayError,
1126
1128
  ConfigError,
@@ -220,7 +220,7 @@ async function parseErrorResponse(response, retries) {
220
220
  // package.json
221
221
  var package_default = {
222
222
  name: "@modelrelay/sdk",
223
- version: "2.0.0",
223
+ version: "2.2.0",
224
224
  description: "TypeScript SDK for the ModelRelay API",
225
225
  type: "module",
226
226
  main: "dist/index.cjs",
@@ -10,15 +10,7 @@ var ErrorCodes = {
10
10
  SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE",
11
11
  INVALID_INPUT: "INVALID_INPUT",
12
12
  PAYMENT_REQUIRED: "PAYMENT_REQUIRED",
13
- METHOD_NOT_ALLOWED: "METHOD_NOT_ALLOWED",
14
- /** Identity provider + subject required for identity-based auth. */
15
- IDENTITY_REQUIRED: "IDENTITY_REQUIRED",
16
- /** Auto-provision disabled for the project. */
17
- AUTO_PROVISION_DISABLED: "AUTO_PROVISION_DISABLED",
18
- /** Auto-provision tier misconfigured for the project. */
19
- AUTO_PROVISION_MISCONFIGURED: "AUTO_PROVISION_MISCONFIGURED",
20
- /** Email required for auto-provisioning a new customer. */
21
- EMAIL_REQUIRED: "EMAIL_REQUIRED"
13
+ METHOD_NOT_ALLOWED: "METHOD_NOT_ALLOWED"
22
14
  };
23
15
  var ModelRelayError = class extends Error {
24
16
  constructor(message, opts) {
@@ -106,39 +98,6 @@ var APIError = class extends ModelRelayError {
106
98
  isUnavailable() {
107
99
  return this.code === ErrorCodes.SERVICE_UNAVAILABLE;
108
100
  }
109
- /**
110
- * Returns true if the error indicates identity is missing/invalid for identity-based auth.
111
- */
112
- isIdentityRequired() {
113
- return this.code === ErrorCodes.IDENTITY_REQUIRED;
114
- }
115
- /**
116
- * Returns true if auto-provisioning is disabled for the project.
117
- * To resolve: configure customer auto-provisioning on the project (select a default tier).
118
- */
119
- isAutoProvisionDisabled() {
120
- return this.code === ErrorCodes.AUTO_PROVISION_DISABLED;
121
- }
122
- /**
123
- * Returns true if email is required for auto-provisioning a new customer.
124
- * To resolve: provide the 'email' field in your frontend token request.
125
- */
126
- isEmailRequired() {
127
- return this.code === ErrorCodes.EMAIL_REQUIRED;
128
- }
129
- /**
130
- * Returns true if auto-provisioning is misconfigured for the project.
131
- * To resolve: ensure the configured auto-provision tier exists and belongs to the project.
132
- */
133
- isAutoProvisionMisconfigured() {
134
- return this.code === ErrorCodes.AUTO_PROVISION_MISCONFIGURED;
135
- }
136
- /**
137
- * Returns true if this is a customer provisioning error (identity not found + auto-provision disabled/misconfigured, or email required).
138
- */
139
- isProvisioningError() {
140
- return this.isAutoProvisionDisabled() || this.isAutoProvisionMisconfigured() || this.isEmailRequired();
141
- }
142
101
  };
143
102
  var WorkflowValidationError = class extends ModelRelayError {
144
103
  constructor(opts) {
@@ -175,21 +134,6 @@ var PathEscapeError = class extends ModelRelayError {
175
134
  this.resolvedPath = opts.resolvedPath;
176
135
  }
177
136
  };
178
- function isEmailRequired(err) {
179
- return err instanceof APIError && err.isEmailRequired();
180
- }
181
- function isIdentityRequired(err) {
182
- return err instanceof APIError && err.isIdentityRequired();
183
- }
184
- function isAutoProvisionDisabled(err) {
185
- return err instanceof APIError && err.isAutoProvisionDisabled();
186
- }
187
- function isAutoProvisionMisconfigured(err) {
188
- return err instanceof APIError && err.isAutoProvisionMisconfigured();
189
- }
190
- function isProvisioningError(err) {
191
- return err instanceof APIError && err.isProvisioningError();
192
- }
193
137
  async function parseErrorResponse(response, retries) {
194
138
  const requestId = response.headers.get("X-ModelRelay-Request-Id") || response.headers.get("X-Request-Id") || void 0;
195
139
  const fallbackMessage = response.statusText || "Request failed";
@@ -276,7 +220,7 @@ async function parseErrorResponse(response, retries) {
276
220
  // package.json
277
221
  var package_default = {
278
222
  name: "@modelrelay/sdk",
279
- version: "1.5.0",
223
+ version: "3.0.0",
280
224
  description: "TypeScript SDK for the ModelRelay API",
281
225
  type: "module",
282
226
  main: "dist/index.cjs",
@@ -1131,11 +1075,6 @@ export {
1131
1075
  WorkflowValidationError,
1132
1076
  ToolArgumentError,
1133
1077
  PathEscapeError,
1134
- isEmailRequired,
1135
- isIdentityRequired,
1136
- isAutoProvisionDisabled,
1137
- isAutoProvisionMisconfigured,
1138
- isProvisioningError,
1139
1078
  parseErrorResponse,
1140
1079
  SDK_VERSION,
1141
1080
  DEFAULT_BASE_URL,
package/dist/index.cjs CHANGED
@@ -416,7 +416,7 @@ function isSecretKey(key) {
416
416
  // package.json
417
417
  var package_default = {
418
418
  name: "@modelrelay/sdk",
419
- version: "2.1.0",
419
+ version: "4.0.0",
420
420
  description: "TypeScript SDK for the ModelRelay API",
421
421
  type: "module",
422
422
  main: "dist/index.cjs",
@@ -2911,7 +2911,7 @@ var ResponsesClient = class {
2911
2911
 
2912
2912
  // src/runs_request.ts
2913
2913
  var RUNS_PATH = "/runs";
2914
- var RUN_EVENT_V0_SCHEMA_PATH = "/schemas/run_event_v0.schema.json";
2914
+ var RUN_EVENT_V0_SCHEMA_PATH = "/schemas/run_event.schema.json";
2915
2915
  function runByIdPath(runId) {
2916
2916
  return `${RUNS_PATH}/${encodeURIComponent(runId)}`;
2917
2917
  }
@@ -2988,6 +2988,10 @@ var payloadInfoSchema = import_zod.default.object({
2988
2988
  sha256: import_zod.default.string().min(1),
2989
2989
  included: import_zod.default.boolean()
2990
2990
  }).strict();
2991
+ var payloadArtifactSchema = import_zod.default.object({
2992
+ artifact_key: import_zod.default.string().min(1),
2993
+ info: payloadInfoSchema
2994
+ }).strict();
2991
2995
  var nodeOutputDeltaSchema = import_zod.default.object({
2992
2996
  kind: import_zod.default.string().min(1),
2993
2997
  text_delta: import_zod.default.string().optional(),
@@ -3008,27 +3012,28 @@ var nodeLLMCallSchema = import_zod.default.object({
3008
3012
  stop_reason: import_zod.default.string().optional(),
3009
3013
  usage: tokenUsageSchema.optional()
3010
3014
  }).strict();
3011
- var functionToolCallSchema = import_zod.default.object({
3015
+ var toolCallSchema = import_zod.default.object({
3012
3016
  id: import_zod.default.string().min(1),
3013
3017
  name: import_zod.default.string().min(1),
3014
- arguments: import_zod.default.string()
3018
+ arguments: import_zod.default.string().optional()
3015
3019
  }).strict();
3020
+ var toolCallWithArgumentsSchema = toolCallSchema.extend({
3021
+ arguments: import_zod.default.string()
3022
+ });
3016
3023
  var nodeToolCallSchema = import_zod.default.object({
3017
3024
  step: import_zod.default.number().int().nonnegative(),
3018
3025
  request_id: import_zod.default.string().min(1),
3019
- tool_call: functionToolCallSchema
3026
+ tool_call: toolCallWithArgumentsSchema
3020
3027
  }).strict();
3021
3028
  var nodeToolResultSchema = import_zod.default.object({
3022
3029
  step: import_zod.default.number().int().nonnegative(),
3023
3030
  request_id: import_zod.default.string().min(1),
3024
- tool_call_id: import_zod.default.string().min(1),
3025
- name: import_zod.default.string().min(1),
3026
- output: import_zod.default.string()
3031
+ tool_call: toolCallSchema,
3032
+ output: import_zod.default.string(),
3033
+ error: import_zod.default.string().optional()
3027
3034
  }).strict();
3028
3035
  var pendingToolCallSchema = import_zod.default.object({
3029
- tool_call_id: import_zod.default.string().min(1),
3030
- name: import_zod.default.string().min(1),
3031
- arguments: import_zod.default.string()
3036
+ tool_call: toolCallWithArgumentsSchema
3032
3037
  }).strict();
3033
3038
  var nodeWaitingSchema = import_zod.default.object({
3034
3039
  step: import_zod.default.number().int().nonnegative(),
@@ -3037,7 +3042,7 @@ var nodeWaitingSchema = import_zod.default.object({
3037
3042
  reason: import_zod.default.string().min(1)
3038
3043
  }).strict();
3039
3044
  var baseSchema = {
3040
- envelope_version: import_zod.default.literal("v0").optional().default("v0"),
3045
+ envelope_version: import_zod.default.literal("v2").optional().default("v2"),
3041
3046
  run_id: import_zod.default.string().min(1),
3042
3047
  seq: import_zod.default.number().int().min(1),
3043
3048
  ts: import_zod.default.string().min(1)
@@ -3049,8 +3054,7 @@ var runEventWireSchema = import_zod.default.discriminatedUnion("type", [
3049
3054
  ...baseSchema,
3050
3055
  type: import_zod.default.literal("run_completed"),
3051
3056
  plan_hash: import_zod.default.string().min(1),
3052
- outputs_artifact_key: import_zod.default.string().min(1),
3053
- outputs_info: payloadInfoSchema
3057
+ outputs: payloadArtifactSchema
3054
3058
  }).strict(),
3055
3059
  import_zod.default.object({
3056
3060
  ...baseSchema,
@@ -3106,23 +3110,22 @@ var runEventWireSchema = import_zod.default.discriminatedUnion("type", [
3106
3110
  ...baseSchema,
3107
3111
  type: import_zod.default.literal("node_output"),
3108
3112
  node_id: import_zod.default.string().min(1),
3109
- artifact_key: import_zod.default.string().min(1),
3110
- output_info: payloadInfoSchema
3113
+ output: payloadArtifactSchema
3111
3114
  }).strict()
3112
3115
  ]).superRefine((v, ctx) => {
3113
3116
  if (v.type === "node_output") {
3114
- if (v.output_info.included !== false) {
3117
+ if (v.output.info.included !== false) {
3115
3118
  ctx.addIssue({
3116
3119
  code: import_zod.default.ZodIssueCode.custom,
3117
- message: "node_output output_info.included must be false"
3120
+ message: "node_output output.info.included must be false"
3118
3121
  });
3119
3122
  }
3120
3123
  }
3121
3124
  if (v.type === "run_completed") {
3122
- if (v.outputs_info.included !== false) {
3125
+ if (v.outputs.info.included !== false) {
3123
3126
  ctx.addIssue({
3124
3127
  code: import_zod.default.ZodIssueCode.custom,
3125
- message: "run_completed outputs_info.included must be false"
3128
+ message: "run_completed outputs.info.included must be false"
3126
3129
  });
3127
3130
  }
3128
3131
  }
@@ -3141,7 +3144,7 @@ function parseRunEventV0(line) {
3141
3144
  );
3142
3145
  }
3143
3146
  const base = {
3144
- envelope_version: "v0",
3147
+ envelope_version: "v2",
3145
3148
  run_id: parseRunId(res.data.run_id),
3146
3149
  seq: res.data.seq,
3147
3150
  ts: res.data.ts
@@ -3156,8 +3159,7 @@ function parseRunEventV0(line) {
3156
3159
  ...base,
3157
3160
  type: "run_completed",
3158
3161
  plan_hash: parsePlanHash(res.data.plan_hash),
3159
- outputs_artifact_key: res.data.outputs_artifact_key,
3160
- outputs_info: res.data.outputs_info
3162
+ outputs: res.data.outputs
3161
3163
  };
3162
3164
  case "run_failed":
3163
3165
  return {
@@ -3204,8 +3206,7 @@ function parseRunEventV0(line) {
3204
3206
  ...base,
3205
3207
  type: "node_output",
3206
3208
  node_id: parseNodeId(res.data.node_id),
3207
- artifact_key: res.data.artifact_key,
3208
- output_info: res.data.output_info
3209
+ output: res.data.output
3209
3210
  };
3210
3211
  default:
3211
3212
  throw new TransportError(`Unknown run event type: ${res.data.type}`, { kind: "request" });
@@ -4081,8 +4082,10 @@ var LocalSession = class _LocalSession {
4081
4082
  step: this.currentWaiting.step,
4082
4083
  request_id: this.currentWaiting.request_id,
4083
4084
  results: results.map((r) => ({
4084
- tool_call_id: r.toolCallId,
4085
- name: r.toolName,
4085
+ tool_call: {
4086
+ id: r.toolCallId,
4087
+ name: r.toolName
4088
+ },
4086
4089
  output: r.error ? `Error: ${r.error}` : typeof r.result === "string" ? r.result : JSON.stringify(r.result)
4087
4090
  }))
4088
4091
  });
@@ -4223,9 +4226,9 @@ var LocalSession = class _LocalSession {
4223
4226
  return {
4224
4227
  status: "waiting_for_tools",
4225
4228
  pendingTools: event.waiting.pending_tool_calls.map((tc) => ({
4226
- toolCallId: tc.tool_call_id,
4227
- name: tc.name,
4228
- arguments: tc.arguments
4229
+ toolCallId: tc.tool_call.id,
4230
+ name: tc.tool_call.name,
4231
+ arguments: tc.tool_call.arguments
4229
4232
  })),
4230
4233
  runId: this.currentRunId,
4231
4234
  usage: this.currentUsage,
@@ -4286,19 +4289,19 @@ var LocalSession = class _LocalSession {
4286
4289
  for (const pending of pendingTools) {
4287
4290
  try {
4288
4291
  const result = await this.toolRegistry.execute({
4289
- id: pending.tool_call_id,
4292
+ id: pending.tool_call.id,
4290
4293
  type: "function",
4291
4294
  function: {
4292
- name: pending.name,
4293
- arguments: pending.arguments
4295
+ name: pending.tool_call.name,
4296
+ arguments: pending.tool_call.arguments
4294
4297
  }
4295
4298
  });
4296
4299
  results.push(result);
4297
4300
  } catch (err) {
4298
4301
  const error = err instanceof Error ? err : new Error(String(err));
4299
4302
  results.push({
4300
- toolCallId: pending.tool_call_id,
4301
- toolName: pending.name,
4303
+ toolCallId: pending.tool_call.id,
4304
+ toolName: pending.tool_call.name,
4302
4305
  result: null,
4303
4306
  error: error.message
4304
4307
  });
@@ -4578,8 +4581,10 @@ var RemoteSession = class _RemoteSession {
4578
4581
  step: this.currentWaiting.step,
4579
4582
  request_id: this.currentWaiting.request_id,
4580
4583
  results: results.map((r) => ({
4581
- tool_call_id: r.toolCallId,
4582
- name: r.toolName,
4584
+ tool_call: {
4585
+ id: r.toolCallId,
4586
+ name: r.toolName
4587
+ },
4583
4588
  output: r.error ? `Error: ${r.error}` : typeof r.result === "string" ? r.result : JSON.stringify(r.result)
4584
4589
  }))
4585
4590
  });
@@ -4706,9 +4711,9 @@ var RemoteSession = class _RemoteSession {
4706
4711
  status: "waiting_for_tools",
4707
4712
  pendingTools: event.waiting.pending_tool_calls.map(
4708
4713
  (tc) => ({
4709
- toolCallId: tc.tool_call_id,
4710
- name: tc.name,
4711
- arguments: tc.arguments
4714
+ toolCallId: tc.tool_call.id,
4715
+ name: tc.tool_call.name,
4716
+ arguments: tc.tool_call.arguments
4712
4717
  })
4713
4718
  ),
4714
4719
  runId: this.currentRunId,
@@ -4782,18 +4787,18 @@ var RemoteSession = class _RemoteSession {
4782
4787
  async executeToolsLocally(toolCalls) {
4783
4788
  if (!this.toolRegistry) return null;
4784
4789
  for (const tc of toolCalls) {
4785
- if (!this.toolRegistry.has(tc.name)) {
4790
+ if (!this.toolRegistry.has(tc.tool_call.name)) {
4786
4791
  return null;
4787
4792
  }
4788
4793
  }
4789
4794
  const results = [];
4790
4795
  for (const tc of toolCalls) {
4791
4796
  const toolCall = {
4792
- id: tc.tool_call_id,
4797
+ id: tc.tool_call.id,
4793
4798
  type: "function",
4794
4799
  function: {
4795
- name: tc.name,
4796
- arguments: tc.arguments
4800
+ name: tc.tool_call.name,
4801
+ arguments: tc.tool_call.arguments
4797
4802
  }
4798
4803
  };
4799
4804
  const result = await this.toolRegistry.execute(toolCall);
@@ -6052,9 +6057,9 @@ var ToolRunner = class {
6052
6057
  try {
6053
6058
  await this.onBeforeExecute?.(pending);
6054
6059
  const toolCall = createToolCall(
6055
- pending.tool_call_id,
6056
- pending.name,
6057
- pending.arguments
6060
+ pending.tool_call.id,
6061
+ pending.tool_call.name,
6062
+ pending.tool_call.arguments
6058
6063
  );
6059
6064
  const result = await this.registry.execute(toolCall);
6060
6065
  results.push(result);
@@ -6063,8 +6068,8 @@ var ToolRunner = class {
6063
6068
  const error = err instanceof Error ? err : new Error(String(err));
6064
6069
  await this.onError?.(error, pending);
6065
6070
  results.push({
6066
- toolCallId: pending.tool_call_id,
6067
- toolName: pending.name,
6071
+ toolCallId: pending.tool_call.id,
6072
+ toolName: pending.tool_call.name,
6068
6073
  result: null,
6069
6074
  error: error.message
6070
6075
  });
@@ -6077,8 +6082,10 @@ var ToolRunner = class {
6077
6082
  step: waiting.step,
6078
6083
  request_id: waiting.request_id,
6079
6084
  results: results.map((r) => ({
6080
- tool_call_id: r.toolCallId,
6081
- name: r.toolName,
6085
+ tool_call: {
6086
+ id: r.toolCallId,
6087
+ name: r.toolName
6088
+ },
6082
6089
  output: r.error ? `Error: ${r.error}` : typeof r.result === "string" ? r.result : JSON.stringify(r.result)
6083
6090
  }))
6084
6091
  },
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { A as ApiKey, R as RetryConfig, M as MetricsCallbacks, T as TraceCallbacks, a as RequestContext, b as TokenProvider, C as CustomerTokenRequest, c as CustomerToken, G as GetOrCreateCustomerTokenRequest, P as ProviderId, d as ModelId, I as InputItem, O as OutputFormat, e as Tool, f as ToolChoice, Z as ZodLikeSchema, g as ResponseEvent, h as Response$1, S as StructuredJSONEvent, F as FieldError, i as RetryMetadata, j as TransportErrorKind, k as ToolRegistry, l as ToolExecutionResult, m as TierCode, n as SecretKey, o as ModelRelayKeyOptions, p as ModelRelayOptions } from './tools-bCt1QwNk.cjs';
2
2
  export { ba as APICheckoutSession, b9 as APICustomerRef, bd as APIKey, bc as APIResponsesResponse, bb as APIUsage, ak as BillingProvider, aj as BillingProviders, aT as Citation, aL as CodeExecConfig, ay as ContentPart, ax as ContentPartType, aw as ContentPartTypes, al as CustomerMetadata, D as DEFAULT_BASE_URL, a7 as DEFAULT_CLIENT_HEADER, a8 as DEFAULT_CONNECT_TIMEOUT_MS, a9 as DEFAULT_REQUEST_TIMEOUT_MS, b8 as DeepPartial, aO as FunctionCall, b6 as FunctionCallDelta, aI as FunctionTool, aU as HttpRequestMetrics, aA as InputItemType, az as InputItemTypes, aS as JSONSchemaFormat, a2 as JsonSchemaOptions, ac as KnownStopReason, b3 as MessageDeltaData, av as MessageRole, au as MessageRoles, b2 as MessageStartData, b4 as MessageStopData, am as ModelRelayBaseOptions, an as ModelRelayTokenOptions, ao as ModelRelayTokenProviderOptions, aa as NonEmptyArray, aR as OutputFormatType, aQ as OutputFormatTypes, aD as OutputItem, aC as OutputItemType, aB as OutputItemTypes, at as Project, b1 as ResponseEventType, a5 as RetryOptions, a6 as SDK_VERSION, a3 as Schema, ad as StopReason, ab as StopReasons, aV as StreamFirstTokenMetrics, b7 as StructuredJSONRecordType, ai as SubscriptionStatusKind, ah as SubscriptionStatuses, ap as TokenType, aW as TokenUsageMetrics, X as ToolArgsError, aP as ToolCall, N as ToolCallAccumulator, b5 as ToolCallDelta, aN as ToolChoiceType, aM as ToolChoiceTypes, a4 as ToolHandler, aF as ToolType, aE as ToolTypes, aq as Usage, as as UsageSummary, aJ as WebSearchConfig, aH as WebToolIntent, aG as WebToolIntents, aK as XSearchConfig, af as asModelId, ae as asProviderId, ag as asTierCode, J as assistantMessageWithToolCalls, z as createAssistantMessage, L as createFunctionCall, q as createFunctionTool, r as createFunctionToolFromSchema, a0 as createRetryMessages, B as createSystemMessage, K as createToolCall, ar as createUsage, y as createUserMessage, s as createWebTool, a1 as executeWithRetry, x as firstToolCall, Y as formatToolErrorForModel, $ as getRetryableErrors, _ as hasRetryableErrors, w as hasToolCalls, aX as mergeMetrics, aY as mergeTrace, b0 as modelToString, a$ as normalizeModelId, aZ as normalizeStopReason, U as parseToolArgs, W as parseToolArgsRaw, H as respondToToolCall, a_ as stopReasonToString, t as toolChoiceAuto, v as toolChoiceNone, u as toolChoiceRequired, E as toolResultMessage, V as tryParseToolArgs, Q as zodToJsonSchema } from './tools-bCt1QwNk.cjs';
3
- import { c as components, $ as $defs, o as operations, p as paths, w as webhooks } from './api-D_hE36Ps.cjs';
3
+ import { c as components, $ as $defs, o as operations, p as paths, w as webhooks } from './api-Bitsm1tl.cjs';
4
4
 
5
5
  interface RequestOptions {
6
6
  method?: string;
@@ -819,6 +819,10 @@ type TokenUsageV0$1 = {
819
819
  output_tokens?: number;
820
820
  total_tokens?: number;
821
821
  };
822
+ type PayloadArtifactV0$1 = {
823
+ artifact_key: string;
824
+ info: PayloadInfoV0$1;
825
+ };
822
826
  type NodeLLMCallV0$1 = {
823
827
  step: number;
824
828
  request_id: string;
@@ -828,7 +832,12 @@ type NodeLLMCallV0$1 = {
828
832
  stop_reason?: string;
829
833
  usage?: TokenUsageV0$1;
830
834
  };
831
- type FunctionToolCallV0$1 = {
835
+ type ToolCallV0$1 = {
836
+ id: string;
837
+ name: string;
838
+ arguments?: string;
839
+ };
840
+ type ToolCallWithArgumentsV0$1 = {
832
841
  id: string;
833
842
  name: string;
834
843
  arguments: string;
@@ -836,19 +845,17 @@ type FunctionToolCallV0$1 = {
836
845
  type NodeToolCallV0$1 = {
837
846
  step: number;
838
847
  request_id: string;
839
- tool_call: FunctionToolCallV0$1;
848
+ tool_call: ToolCallWithArgumentsV0$1;
840
849
  };
841
850
  type NodeToolResultV0$1 = {
842
851
  step: number;
843
852
  request_id: string;
844
- tool_call_id: string;
845
- name: string;
853
+ tool_call: ToolCallV0$1;
846
854
  output: string;
855
+ error?: string;
847
856
  };
848
857
  type PendingToolCallV0$1 = {
849
- tool_call_id: string;
850
- name: string;
851
- arguments: string;
858
+ tool_call: ToolCallWithArgumentsV0$1;
852
859
  };
853
860
  type NodeWaitingV0$1 = {
854
861
  step: number;
@@ -857,7 +864,7 @@ type NodeWaitingV0$1 = {
857
864
  reason: string;
858
865
  };
859
866
  type RunEventBaseV0 = {
860
- envelope_version: "v0";
867
+ envelope_version: "v2";
861
868
  run_id: RunId$1;
862
869
  seq: number;
863
870
  ts: string;
@@ -873,8 +880,7 @@ type RunEventRunStartedV0 = RunEventBaseV0 & {
873
880
  type RunEventRunCompletedV0 = RunEventBaseV0 & {
874
881
  type: "run_completed";
875
882
  plan_hash: PlanHash$1;
876
- outputs_artifact_key: string;
877
- outputs_info: PayloadInfoV0$1;
883
+ outputs: PayloadArtifactV0$1;
878
884
  };
879
885
  type RunEventRunFailedV0 = RunEventBaseV0 & {
880
886
  type: "run_failed";
@@ -927,8 +933,7 @@ type RunEventNodeOutputDeltaV0 = RunEventBaseV0 & {
927
933
  type RunEventNodeOutputV0 = RunEventBaseV0 & {
928
934
  type: "node_output";
929
935
  node_id: NodeId$1;
930
- artifact_key: string;
931
- output_info: PayloadInfoV0$1;
936
+ output: PayloadArtifactV0$1;
932
937
  };
933
938
  type RunEventV0 = RunEventRunCompiledV0 | RunEventRunStartedV0 | RunEventRunCompletedV0 | RunEventRunFailedV0 | RunEventRunCanceledV0 | RunEventNodeLLMCallV0 | RunEventNodeToolCallV0 | RunEventNodeToolResultV0 | RunEventNodeWaitingV0 | RunEventNodeStartedV0 | RunEventNodeSucceededV0 | RunEventNodeFailedV0 | RunEventNodeOutputDeltaV0 | RunEventNodeOutputV0;
934
939
 
@@ -938,8 +943,7 @@ type RunsToolResultsRequest = {
938
943
  step: number;
939
944
  request_id: string;
940
945
  results: Array<{
941
- tool_call_id: string;
942
- name: string;
946
+ tool_call: ToolCallV0$1;
943
947
  output: string;
944
948
  }>;
945
949
  };
@@ -954,9 +958,7 @@ type RunsPendingToolsResponse = {
954
958
  step: number;
955
959
  request_id: string;
956
960
  tool_calls: Array<{
957
- tool_call_id: string;
958
- name: string;
959
- arguments: string;
961
+ tool_call: ToolCallWithArgumentsV0$1;
960
962
  }>;
961
963
  }>;
962
964
  };
@@ -2996,9 +2998,11 @@ type NodeToolCallV0 = NodeToolCallV0$1;
2996
2998
  type NodeToolResultV0 = NodeToolResultV0$1;
2997
2999
  type NodeWaitingV0 = NodeWaitingV0$1;
2998
3000
  type PendingToolCallV0 = PendingToolCallV0$1;
2999
- type FunctionToolCallV0 = FunctionToolCallV0$1;
3001
+ type ToolCallV0 = ToolCallV0$1;
3002
+ type ToolCallWithArgumentsV0 = ToolCallWithArgumentsV0$1;
3000
3003
  type TokenUsageV0 = TokenUsageV0$1;
3001
3004
  type PayloadInfoV0 = PayloadInfoV0$1;
3005
+ type PayloadArtifactV0 = PayloadArtifactV0$1;
3002
3006
  type StreamEventKind = StreamEventKind$1;
3003
3007
  declare const KindV1: "workflow.v1";
3004
3008
  declare const NodeTypesV1: {
@@ -3050,7 +3054,6 @@ type index_EventV0 = EventV0;
3050
3054
  type index_FanoutReduceConfigV1 = FanoutReduceConfigV1;
3051
3055
  type index_FanoutReduceV1 = FanoutReduceV1;
3052
3056
  declare const index_FanoutReduceV1: typeof FanoutReduceV1;
3053
- type index_FunctionToolCallV0 = FunctionToolCallV0;
3054
3057
  type index_Kind = Kind;
3055
3058
  declare const index_KindV1: typeof KindV1;
3056
3059
  declare const index_LLM_TEXT_OUTPUT: typeof LLM_TEXT_OUTPUT;
@@ -3067,6 +3070,7 @@ type index_NodeV1 = NodeV1;
3067
3070
  type index_NodeWaitingV0 = NodeWaitingV0;
3068
3071
  type index_OutputName = OutputName;
3069
3072
  type index_OutputRefV1 = OutputRefV1;
3073
+ type index_PayloadArtifactV0 = PayloadArtifactV0;
3070
3074
  type index_PayloadInfoV0 = PayloadInfoV0;
3071
3075
  type index_PendingToolCallV0 = PendingToolCallV0;
3072
3076
  type index_PlanHash = PlanHash;
@@ -3079,6 +3083,8 @@ type index_SpecV1 = SpecV1;
3079
3083
  type index_StatusV0 = StatusV0;
3080
3084
  type index_StreamEventKind = StreamEventKind;
3081
3085
  type index_TokenUsageV0 = TokenUsageV0;
3086
+ type index_ToolCallV0 = ToolCallV0;
3087
+ type index_ToolCallWithArgumentsV0 = ToolCallWithArgumentsV0;
3082
3088
  type index_ToolExecutionModeV1 = ToolExecutionModeV1;
3083
3089
  declare const index_ToolExecutionModes: typeof ToolExecutionModes;
3084
3090
  type index_ToolExecutionV1 = ToolExecutionV1;
@@ -3100,7 +3106,7 @@ declare const index_whenStatusExists: typeof whenStatusExists;
3100
3106
  declare const index_whenStatusMatches: typeof whenStatusMatches;
3101
3107
  declare const index_workflowV1: typeof workflowV1;
3102
3108
  declare namespace index {
3103
- export { index_BindingBuilder as BindingBuilder, type index_BindingEncodingV1 as BindingEncodingV1, index_BindingEncodings as BindingEncodings, type index_BindingOptions as BindingOptions, type index_BindingV1 as BindingV1, type index_ConditionOpV1 as ConditionOpV1, type index_ConditionSourceV1 as ConditionSourceV1, type index_ConditionV1 as ConditionV1, type index_EdgeV1 as EdgeV1, type index_EventBaseV0 as EventBaseV0, type index_EventNodeFailedV0 as EventNodeFailedV0, type index_EventNodeLLMCallV0 as EventNodeLLMCallV0, type index_EventNodeOutputDeltaV0 as EventNodeOutputDeltaV0, type index_EventNodeOutputV0 as EventNodeOutputV0, type index_EventNodeStartedV0 as EventNodeStartedV0, type index_EventNodeSucceededV0 as EventNodeSucceededV0, type index_EventNodeToolCallV0 as EventNodeToolCallV0, type index_EventNodeToolResultV0 as EventNodeToolResultV0, type index_EventNodeWaitingV0 as EventNodeWaitingV0, type index_EventRunCanceledV0 as EventRunCanceledV0, type index_EventRunCompiledV0 as EventRunCompiledV0, type index_EventRunCompletedV0 as EventRunCompletedV0, type index_EventRunFailedV0 as EventRunFailedV0, type index_EventRunStartedV0 as EventRunStartedV0, type index_EventTypeV0 as EventTypeV0, type index_EventV0 as EventV0, type index_FanoutReduceConfigV1 as FanoutReduceConfigV1, index_FanoutReduceV1 as FanoutReduceV1, type index_FunctionToolCallV0 as FunctionToolCallV0, type index_Kind as Kind, index_KindV1 as KindV1, index_LLM_TEXT_OUTPUT as LLM_TEXT_OUTPUT, index_LLM_USER_MESSAGE_TEXT as LLM_USER_MESSAGE_TEXT, type index_NodeErrorV0 as NodeErrorV0, type index_NodeId as NodeId, type index_NodeLLMCallV0 as NodeLLMCallV0, type index_NodeOutputDeltaV0 as NodeOutputDeltaV0, type index_NodeToolCallV0 as NodeToolCallV0, type index_NodeToolResultV0 as NodeToolResultV0, type index_NodeTypeV1 as NodeTypeV1, index_NodeTypesV1 as NodeTypesV1, type index_NodeV1 as NodeV1, type index_NodeWaitingV0 as NodeWaitingV0, type index_OutputName as OutputName, type index_OutputRefV1 as OutputRefV1, type index_PayloadInfoV0 as PayloadInfoV0, type index_PendingToolCallV0 as PendingToolCallV0, type index_PlanHash as PlanHash, type index_RouterConfigV1 as RouterConfigV1, type index_RouterRouteV1 as RouterRouteV1, index_RouterV1 as RouterV1, type index_RunId as RunId, type index_SpecV1 as SpecV1, type index_StatusV0 as StatusV0, type index_StreamEventKind as StreamEventKind, type index_TokenUsageV0 as TokenUsageV0, type index_ToolExecutionModeV1 as ToolExecutionModeV1, index_ToolExecutionModes as ToolExecutionModes, type index_ToolExecutionV1 as ToolExecutionV1, type index_ToolLimitsV1 as ToolLimitsV1, index_WorkflowBuilderV1 as WorkflowBuilderV1, index_bindFrom as bindFrom, index_bindToPlaceholder as bindToPlaceholder, index_bindToPointer as bindToPointer, index_parseNodeId as parseNodeId, index_parseOutputName as parseOutputName, index_parsePlanHash as parsePlanHash, index_parseRunId as parseRunId, index_whenOutputEquals as whenOutputEquals, index_whenOutputExists as whenOutputExists, index_whenOutputMatches as whenOutputMatches, index_whenStatusEquals as whenStatusEquals, index_whenStatusExists as whenStatusExists, index_whenStatusMatches as whenStatusMatches, index_workflowV1 as workflowV1 };
3109
+ export { index_BindingBuilder as BindingBuilder, type index_BindingEncodingV1 as BindingEncodingV1, index_BindingEncodings as BindingEncodings, type index_BindingOptions as BindingOptions, type index_BindingV1 as BindingV1, type index_ConditionOpV1 as ConditionOpV1, type index_ConditionSourceV1 as ConditionSourceV1, type index_ConditionV1 as ConditionV1, type index_EdgeV1 as EdgeV1, type index_EventBaseV0 as EventBaseV0, type index_EventNodeFailedV0 as EventNodeFailedV0, type index_EventNodeLLMCallV0 as EventNodeLLMCallV0, type index_EventNodeOutputDeltaV0 as EventNodeOutputDeltaV0, type index_EventNodeOutputV0 as EventNodeOutputV0, type index_EventNodeStartedV0 as EventNodeStartedV0, type index_EventNodeSucceededV0 as EventNodeSucceededV0, type index_EventNodeToolCallV0 as EventNodeToolCallV0, type index_EventNodeToolResultV0 as EventNodeToolResultV0, type index_EventNodeWaitingV0 as EventNodeWaitingV0, type index_EventRunCanceledV0 as EventRunCanceledV0, type index_EventRunCompiledV0 as EventRunCompiledV0, type index_EventRunCompletedV0 as EventRunCompletedV0, type index_EventRunFailedV0 as EventRunFailedV0, type index_EventRunStartedV0 as EventRunStartedV0, type index_EventTypeV0 as EventTypeV0, type index_EventV0 as EventV0, type index_FanoutReduceConfigV1 as FanoutReduceConfigV1, index_FanoutReduceV1 as FanoutReduceV1, type index_Kind as Kind, index_KindV1 as KindV1, index_LLM_TEXT_OUTPUT as LLM_TEXT_OUTPUT, index_LLM_USER_MESSAGE_TEXT as LLM_USER_MESSAGE_TEXT, type index_NodeErrorV0 as NodeErrorV0, type index_NodeId as NodeId, type index_NodeLLMCallV0 as NodeLLMCallV0, type index_NodeOutputDeltaV0 as NodeOutputDeltaV0, type index_NodeToolCallV0 as NodeToolCallV0, type index_NodeToolResultV0 as NodeToolResultV0, type index_NodeTypeV1 as NodeTypeV1, index_NodeTypesV1 as NodeTypesV1, type index_NodeV1 as NodeV1, type index_NodeWaitingV0 as NodeWaitingV0, type index_OutputName as OutputName, type index_OutputRefV1 as OutputRefV1, type index_PayloadArtifactV0 as PayloadArtifactV0, type index_PayloadInfoV0 as PayloadInfoV0, type index_PendingToolCallV0 as PendingToolCallV0, type index_PlanHash as PlanHash, type index_RouterConfigV1 as RouterConfigV1, type index_RouterRouteV1 as RouterRouteV1, index_RouterV1 as RouterV1, type index_RunId as RunId, type index_SpecV1 as SpecV1, type index_StatusV0 as StatusV0, type index_StreamEventKind as StreamEventKind, type index_TokenUsageV0 as TokenUsageV0, type index_ToolCallV0 as ToolCallV0, type index_ToolCallWithArgumentsV0 as ToolCallWithArgumentsV0, type index_ToolExecutionModeV1 as ToolExecutionModeV1, index_ToolExecutionModes as ToolExecutionModes, type index_ToolExecutionV1 as ToolExecutionV1, type index_ToolLimitsV1 as ToolLimitsV1, index_WorkflowBuilderV1 as WorkflowBuilderV1, index_bindFrom as bindFrom, index_bindToPlaceholder as bindToPlaceholder, index_bindToPointer as bindToPointer, index_parseNodeId as parseNodeId, index_parseOutputName as parseOutputName, index_parsePlanHash as parsePlanHash, index_parseRunId as parseRunId, index_whenOutputEquals as whenOutputEquals, index_whenOutputExists as whenOutputExists, index_whenOutputMatches as whenOutputMatches, index_whenStatusEquals as whenStatusEquals, index_whenStatusExists as whenStatusExists, index_whenStatusMatches as whenStatusMatches, index_workflowV1 as workflowV1 };
3104
3110
  }
3105
3111
 
3106
3112
  /**