@runtypelabs/sdk 11.24.4 → 11.25.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.
package/dist/index.cjs CHANGED
@@ -481,6 +481,7 @@ function createAgentEventTranslator() {
481
481
  success: false,
482
482
  stopReason: data.stopReason ?? "error",
483
483
  error: errorMessage(data.error),
484
+ errorCode: data.code,
484
485
  completedAt: data.completedAt,
485
486
  outcome: data.outcome
486
487
  })];
@@ -7710,6 +7711,7 @@ var AgentsEndpoint = class AgentsEndpoint {
7710
7711
  offloadRecorder: options.offloadRecorder
7711
7712
  }, queuedSteeringMessages);
7712
7713
  let sessionResult;
7714
+ let sessionErrorCode;
7713
7715
  const sessionData = {
7714
7716
  messages,
7715
7717
  debugMode: options.debugMode,
@@ -7735,6 +7737,7 @@ var AgentsEndpoint = class AgentsEndpoint {
7735
7737
  if (!localToolResult) throw new Error("Agent stream ended without a complete event");
7736
7738
  const { completeEvent, toolMessages: captured } = localToolResult;
7737
7739
  sessionToolMessages = captured;
7740
+ sessionErrorCode = completeEvent.errorCode;
7738
7741
  sessionResult = {
7739
7742
  success: completeEvent.success,
7740
7743
  result: completeEvent.finalOutput || "",
@@ -7747,6 +7750,7 @@ var AgentsEndpoint = class AgentsEndpoint {
7747
7750
  } else if (useStream && options.streamCallbacks) {
7748
7751
  const completeEvent = await this.executeWithCallbacks(id, sessionData, sessionCallbacks || options.streamCallbacks);
7749
7752
  if (!completeEvent) throw new Error("Agent stream ended without a complete event");
7753
+ sessionErrorCode = completeEvent.errorCode;
7750
7754
  sessionResult = {
7751
7755
  success: completeEvent.success,
7752
7756
  result: completeEvent.finalOutput || "",
@@ -7775,6 +7779,7 @@ var AgentsEndpoint = class AgentsEndpoint {
7775
7779
  };
7776
7780
  state.lastOutput = effectiveSessionOutput;
7777
7781
  state.lastError = sessionResult.stopReason === "error" ? sessionResult.error || "Agent session ended with an error." : void 0;
7782
+ state.lastErrorCode = sessionResult.stopReason === "error" ? sessionErrorCode : void 0;
7778
7783
  state.lastStopReason = sessionResult.stopReason;
7779
7784
  state.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
7780
7785
  state.sessions.push({
@@ -9575,6 +9580,7 @@ function defineEval(input) {
9575
9580
  const identityDefaults = input.identityDefaults !== void 0 ? normalizeIdentityDefaults(input.identityDefaults) : void 0;
9576
9581
  if (input.name !== void 0 && (typeof input.name !== "string" || input.name.length === 0)) throw new Error("defineEval \"name\" must be a non-empty string when provided");
9577
9582
  const name = input.name ?? ("flow" in target ? `flow:${target.flow}` : `agent:${target.agent}`);
9583
+ if (input.graders !== void 0 && input.graders !== null && !Array.isArray(input.graders)) throw new Error("defineEval \"graders\" must be an array");
9578
9584
  const suiteGraders = (input.graders ?? []).map((g, i) => validateGrader(g, `graders[${i}]`));
9579
9585
  if (!Array.isArray(input.cases) || input.cases.length === 0) throw new Error("defineEval requires a non-empty \"cases\" array");
9580
9586
  const seenNames = /* @__PURE__ */ new Set();
@@ -9588,6 +9594,7 @@ function defineEval(input) {
9588
9594
  seenNames.add(c.name);
9589
9595
  const unknownCaseKeys = Object.keys(c).filter((k) => !DEFINE_EVAL_CASE_KEYS.has(k));
9590
9596
  if (unknownCaseKeys.length > 0) throw new Error(`defineEval: cases[${index}] ("${c.name}") has unknown field(s): ${unknownCaseKeys.join(", ")}. Allowed case fields are name, input, expected, expect.`);
9597
+ if (c.expect !== void 0 && c.expect !== null && !Array.isArray(c.expect)) throw new Error(`defineEval: cases[${index}] ("${c.name}") "expect" must be an array`);
9591
9598
  const caseGraders = (c.expect ?? []).map((g, i) => validateGrader(g, `cases[${index}].expect[${i}]`));
9592
9599
  const expect = [...suiteGraders, ...caseGraders];
9593
9600
  if (expect.length === 0) throw new Error(`defineEval: cases[${index}] ("${c.name}") has no graders. Add suite-level "graders" or case-level "expect" so there is something to score.`);
@@ -14837,7 +14844,7 @@ function transformQueryParams(params) {
14837
14844
  return result;
14838
14845
  }
14839
14846
  // src/version.ts
14840
- const SDK_VERSION = "11.24.4";
14847
+ const SDK_VERSION = "11.25.0";
14841
14848
  /**
14842
14849
  * Canonical client identity the API uses for attribution
14843
14850
  * (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
package/dist/index.d.cts CHANGED
@@ -885,6 +885,8 @@ interface paths {
885
885
  "application/json": {
886
886
  data: {
887
887
  agentType: string;
888
+ /** @description On an external agent only: whether the agent has an endpoint Runtype can call. Absent on every other agent type. */
889
+ callable?: boolean;
888
890
  capabilityCount: number;
889
891
  config: {
890
892
  [key: string]: unknown;
@@ -892,6 +894,8 @@ interface paths {
892
894
  createdAt: string;
893
895
  description: string | null;
894
896
  draftVersionId: string | null;
897
+ /** @description On an external agent only: the framework the agent is built with, when it is set on the agent's external configuration. */
898
+ framework?: string;
895
899
  icon: string | null;
896
900
  id: string;
897
901
  /** @description Which surface last wrote this agent (`sdk`, `terraform`, `dashboard`, `api`, `mcp`). `sdk` and `terraform` mean the agent is managed in code. `null` on an agent last written before provenance was recorded. */
@@ -1019,6 +1023,13 @@ interface paths {
1019
1023
  url: string;
1020
1024
  }[];
1021
1025
  model?: string;
1026
+ networking?: {
1027
+ allowMcpServers?: boolean;
1028
+ allowPackageManagers?: boolean;
1029
+ allowedHosts?: string[];
1030
+ /** @enum {string} */
1031
+ type: "limited" | "unrestricted";
1032
+ } | null;
1022
1033
  /** @description Scheduled and batch runs only. When true, files the agent writes to /mnt/session/outputs/ are stored as runtype-asset:// handles and the session is resumed for one delivery turn that lists them (for example, to attach them with send_email). */
1023
1034
  outputHandoff?: boolean;
1024
1035
  /** @enum {string} */
@@ -2479,6 +2490,13 @@ interface paths {
2479
2490
  url: string;
2480
2491
  }[];
2481
2492
  model?: string;
2493
+ networking?: {
2494
+ allowMcpServers?: boolean;
2495
+ allowPackageManagers?: boolean;
2496
+ allowedHosts?: string[];
2497
+ /** @enum {string} */
2498
+ type: "limited" | "unrestricted";
2499
+ } | null;
2482
2500
  /** @description Scheduled and batch runs only. When true, files the agent writes to /mnt/session/outputs/ are stored as runtype-asset:// handles and the session is resumed for one delivery turn that lists them (for example, to attach them with send_email). */
2483
2501
  outputHandoff?: boolean;
2484
2502
  /** @enum {string} */
@@ -42376,9 +42394,11 @@ interface paths {
42376
42394
  model: string;
42377
42395
  name: string;
42378
42396
  responseFormat: string;
42397
+ systemPrompt?: string | null;
42379
42398
  text: string;
42380
42399
  updatedAt: string;
42381
42400
  userId: string;
42401
+ userPrompt?: string | null;
42382
42402
  };
42383
42403
  };
42384
42404
  };
@@ -60501,6 +60521,7 @@ interface paths {
60501
60521
  enableRuntown: boolean;
60502
60522
  enableRuntypeApps: boolean;
60503
60523
  enableSelfServeOauthClients: boolean;
60524
+ enableSimulationLocalTargets?: boolean;
60504
60525
  enableVoice: boolean;
60505
60526
  enableWorkbench: boolean;
60506
60527
  enableWorkspaceModel: boolean;
@@ -73090,6 +73111,8 @@ export interface AgentCompleteEvent extends BaseAgentEvent {
73090
73111
  finalOutput?: string;
73091
73112
  duration?: number;
73092
73113
  error?: string;
73114
+ /** Machine-readable code for `error`, when the server gave one (for example `SPEND_LIMIT_EXCEEDED`). */
73115
+ errorCode?: string;
73093
73116
  /**
73094
73117
  * Populated only by external-mode (`agentType: 'external'`) executions
73095
73118
  * when the upstream A2A 0.3.0 server returns a conversation handle.
@@ -73581,6 +73604,8 @@ export interface RunTaskState {
73581
73604
  lastOutput: string;
73582
73605
  /** Last terminal error captured from agent execution */
73583
73606
  lastError?: string;
73607
+ /** Machine-readable code of the last terminal error, when the server gave one (for example `SPEND_LIMIT_EXCEEDED`) */
73608
+ lastErrorCode?: string;
73584
73609
  /** Last stop reason */
73585
73610
  lastStopReason: AgentExecuteResponse['stopReason'];
73586
73611
  /** Per-session summaries (kept trimmed to last N) */
package/dist/index.d.ts CHANGED
@@ -885,6 +885,8 @@ interface paths {
885
885
  "application/json": {
886
886
  data: {
887
887
  agentType: string;
888
+ /** @description On an external agent only: whether the agent has an endpoint Runtype can call. Absent on every other agent type. */
889
+ callable?: boolean;
888
890
  capabilityCount: number;
889
891
  config: {
890
892
  [key: string]: unknown;
@@ -892,6 +894,8 @@ interface paths {
892
894
  createdAt: string;
893
895
  description: string | null;
894
896
  draftVersionId: string | null;
897
+ /** @description On an external agent only: the framework the agent is built with, when it is set on the agent's external configuration. */
898
+ framework?: string;
895
899
  icon: string | null;
896
900
  id: string;
897
901
  /** @description Which surface last wrote this agent (`sdk`, `terraform`, `dashboard`, `api`, `mcp`). `sdk` and `terraform` mean the agent is managed in code. `null` on an agent last written before provenance was recorded. */
@@ -1019,6 +1023,13 @@ interface paths {
1019
1023
  url: string;
1020
1024
  }[];
1021
1025
  model?: string;
1026
+ networking?: {
1027
+ allowMcpServers?: boolean;
1028
+ allowPackageManagers?: boolean;
1029
+ allowedHosts?: string[];
1030
+ /** @enum {string} */
1031
+ type: "limited" | "unrestricted";
1032
+ } | null;
1022
1033
  /** @description Scheduled and batch runs only. When true, files the agent writes to /mnt/session/outputs/ are stored as runtype-asset:// handles and the session is resumed for one delivery turn that lists them (for example, to attach them with send_email). */
1023
1034
  outputHandoff?: boolean;
1024
1035
  /** @enum {string} */
@@ -2479,6 +2490,13 @@ interface paths {
2479
2490
  url: string;
2480
2491
  }[];
2481
2492
  model?: string;
2493
+ networking?: {
2494
+ allowMcpServers?: boolean;
2495
+ allowPackageManagers?: boolean;
2496
+ allowedHosts?: string[];
2497
+ /** @enum {string} */
2498
+ type: "limited" | "unrestricted";
2499
+ } | null;
2482
2500
  /** @description Scheduled and batch runs only. When true, files the agent writes to /mnt/session/outputs/ are stored as runtype-asset:// handles and the session is resumed for one delivery turn that lists them (for example, to attach them with send_email). */
2483
2501
  outputHandoff?: boolean;
2484
2502
  /** @enum {string} */
@@ -42376,9 +42394,11 @@ interface paths {
42376
42394
  model: string;
42377
42395
  name: string;
42378
42396
  responseFormat: string;
42397
+ systemPrompt?: string | null;
42379
42398
  text: string;
42380
42399
  updatedAt: string;
42381
42400
  userId: string;
42401
+ userPrompt?: string | null;
42382
42402
  };
42383
42403
  };
42384
42404
  };
@@ -60501,6 +60521,7 @@ interface paths {
60501
60521
  enableRuntown: boolean;
60502
60522
  enableRuntypeApps: boolean;
60503
60523
  enableSelfServeOauthClients: boolean;
60524
+ enableSimulationLocalTargets?: boolean;
60504
60525
  enableVoice: boolean;
60505
60526
  enableWorkbench: boolean;
60506
60527
  enableWorkspaceModel: boolean;
@@ -73090,6 +73111,8 @@ export interface AgentCompleteEvent extends BaseAgentEvent {
73090
73111
  finalOutput?: string;
73091
73112
  duration?: number;
73092
73113
  error?: string;
73114
+ /** Machine-readable code for `error`, when the server gave one (for example `SPEND_LIMIT_EXCEEDED`). */
73115
+ errorCode?: string;
73093
73116
  /**
73094
73117
  * Populated only by external-mode (`agentType: 'external'`) executions
73095
73118
  * when the upstream A2A 0.3.0 server returns a conversation handle.
@@ -73581,6 +73604,8 @@ export interface RunTaskState {
73581
73604
  lastOutput: string;
73582
73605
  /** Last terminal error captured from agent execution */
73583
73606
  lastError?: string;
73607
+ /** Machine-readable code of the last terminal error, when the server gave one (for example `SPEND_LIMIT_EXCEEDED`) */
73608
+ lastErrorCode?: string;
73584
73609
  /** Last stop reason */
73585
73610
  lastStopReason: AgentExecuteResponse['stopReason'];
73586
73611
  /** Per-session summaries (kept trimmed to last N) */
package/dist/index.mjs CHANGED
@@ -480,6 +480,7 @@ function createAgentEventTranslator() {
480
480
  success: false,
481
481
  stopReason: data.stopReason ?? "error",
482
482
  error: errorMessage(data.error),
483
+ errorCode: data.code,
483
484
  completedAt: data.completedAt,
484
485
  outcome: data.outcome
485
486
  })];
@@ -7709,6 +7710,7 @@ var AgentsEndpoint = class AgentsEndpoint {
7709
7710
  offloadRecorder: options.offloadRecorder
7710
7711
  }, queuedSteeringMessages);
7711
7712
  let sessionResult;
7713
+ let sessionErrorCode;
7712
7714
  const sessionData = {
7713
7715
  messages,
7714
7716
  debugMode: options.debugMode,
@@ -7734,6 +7736,7 @@ var AgentsEndpoint = class AgentsEndpoint {
7734
7736
  if (!localToolResult) throw new Error("Agent stream ended without a complete event");
7735
7737
  const { completeEvent, toolMessages: captured } = localToolResult;
7736
7738
  sessionToolMessages = captured;
7739
+ sessionErrorCode = completeEvent.errorCode;
7737
7740
  sessionResult = {
7738
7741
  success: completeEvent.success,
7739
7742
  result: completeEvent.finalOutput || "",
@@ -7746,6 +7749,7 @@ var AgentsEndpoint = class AgentsEndpoint {
7746
7749
  } else if (useStream && options.streamCallbacks) {
7747
7750
  const completeEvent = await this.executeWithCallbacks(id, sessionData, sessionCallbacks || options.streamCallbacks);
7748
7751
  if (!completeEvent) throw new Error("Agent stream ended without a complete event");
7752
+ sessionErrorCode = completeEvent.errorCode;
7749
7753
  sessionResult = {
7750
7754
  success: completeEvent.success,
7751
7755
  result: completeEvent.finalOutput || "",
@@ -7774,6 +7778,7 @@ var AgentsEndpoint = class AgentsEndpoint {
7774
7778
  };
7775
7779
  state.lastOutput = effectiveSessionOutput;
7776
7780
  state.lastError = sessionResult.stopReason === "error" ? sessionResult.error || "Agent session ended with an error." : void 0;
7781
+ state.lastErrorCode = sessionResult.stopReason === "error" ? sessionErrorCode : void 0;
7777
7782
  state.lastStopReason = sessionResult.stopReason;
7778
7783
  state.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
7779
7784
  state.sessions.push({
@@ -9574,6 +9579,7 @@ function defineEval(input) {
9574
9579
  const identityDefaults = input.identityDefaults !== void 0 ? normalizeIdentityDefaults(input.identityDefaults) : void 0;
9575
9580
  if (input.name !== void 0 && (typeof input.name !== "string" || input.name.length === 0)) throw new Error("defineEval \"name\" must be a non-empty string when provided");
9576
9581
  const name = input.name ?? ("flow" in target ? `flow:${target.flow}` : `agent:${target.agent}`);
9582
+ if (input.graders !== void 0 && input.graders !== null && !Array.isArray(input.graders)) throw new Error("defineEval \"graders\" must be an array");
9577
9583
  const suiteGraders = (input.graders ?? []).map((g, i) => validateGrader(g, `graders[${i}]`));
9578
9584
  if (!Array.isArray(input.cases) || input.cases.length === 0) throw new Error("defineEval requires a non-empty \"cases\" array");
9579
9585
  const seenNames = /* @__PURE__ */ new Set();
@@ -9587,6 +9593,7 @@ function defineEval(input) {
9587
9593
  seenNames.add(c.name);
9588
9594
  const unknownCaseKeys = Object.keys(c).filter((k) => !DEFINE_EVAL_CASE_KEYS.has(k));
9589
9595
  if (unknownCaseKeys.length > 0) throw new Error(`defineEval: cases[${index}] ("${c.name}") has unknown field(s): ${unknownCaseKeys.join(", ")}. Allowed case fields are name, input, expected, expect.`);
9596
+ if (c.expect !== void 0 && c.expect !== null && !Array.isArray(c.expect)) throw new Error(`defineEval: cases[${index}] ("${c.name}") "expect" must be an array`);
9590
9597
  const caseGraders = (c.expect ?? []).map((g, i) => validateGrader(g, `cases[${index}].expect[${i}]`));
9591
9598
  const expect = [...suiteGraders, ...caseGraders];
9592
9599
  if (expect.length === 0) throw new Error(`defineEval: cases[${index}] ("${c.name}") has no graders. Add suite-level "graders" or case-level "expect" so there is something to score.`);
@@ -14836,7 +14843,7 @@ function transformQueryParams(params) {
14836
14843
  return result;
14837
14844
  }
14838
14845
  // src/version.ts
14839
- const SDK_VERSION = "11.24.4";
14846
+ const SDK_VERSION = "11.25.0";
14840
14847
  /**
14841
14848
  * Canonical client identity the API uses for attribution
14842
14849
  * (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/sdk",
3
- "version": "11.24.4",
3
+ "version": "11.25.0",
4
4
  "type": "module",
5
5
  "description": "TypeScript SDK for the Runtype API with fluent methods. Use it to quickly realize AI products, agents, and workflows.",
6
6
  "main": "dist/index.cjs",
@@ -24,11 +24,11 @@
24
24
  ],
25
25
  "dependencies": {},
26
26
  "devDependencies": {
27
- "@runtypelabs/shared": "3.125.2",
27
+ "@runtypelabs/shared": "3.126.1",
28
28
  "openapi-typescript": "^7.13.0",
29
- "tsdown": "^0.23.2",
29
+ "tsdown": "^0.23.7",
30
30
  "typescript": "^6.0.3",
31
- "vitest": "^5.0.5"
31
+ "vitest": "^5.1.0"
32
32
  },
33
33
  "keywords": [
34
34
  "runtype",