@runtypelabs/sdk 10.5.3 → 10.7.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
@@ -2352,12 +2352,13 @@ const DEFAULT_BLOCKED_CODE_PATTERNS = [
2352
2352
  /\bsubprocess\b/i,
2353
2353
  /\bos\.system\s*\(/i
2354
2354
  ];
2355
- const DEFAULT_ALLOWED_SANDBOX_PROVIDERS = [
2355
+ const CUSTOM_TOOL_SANDBOX_PROVIDERS = [
2356
2356
  "quickjs",
2357
2357
  "daytona",
2358
2358
  "cloudflare-worker",
2359
- "cloudflare-sandbox"
2359
+ "runtype-sandbox"
2360
2360
  ];
2361
+ const DEFAULT_ALLOWED_SANDBOX_PROVIDERS = [...CUSTOM_TOOL_SANDBOX_PROVIDERS, "cloudflare-sandbox"];
2361
2362
  const DEFAULT_ALLOWED_LANGUAGES = [
2362
2363
  "javascript",
2363
2364
  "typescript",
@@ -2379,7 +2380,21 @@ function isLanguage(value) {
2379
2380
  return value === "javascript" || value === "typescript" || value === "python";
2380
2381
  }
2381
2382
  function isSandboxProvider(value) {
2382
- return value === "quickjs" || value === "daytona" || value === "cloudflare-worker";
2383
+ return CUSTOM_TOOL_SANDBOX_PROVIDERS.includes(value);
2384
+ }
2385
+ function isNetworkAccess(value) {
2386
+ if (value === "off" || value === "on") return true;
2387
+ if (!isObject(value) || !Array.isArray(value.allowedHostnames)) return false;
2388
+ const hosts = value.allowedHostnames;
2389
+ return hosts.length > 0 && hosts.every((host) => typeof host === "string" && host.length > 0);
2390
+ }
2391
+ /** Why the requested posture exceeds what the caller allowed, or null when it fits. */
2392
+ function networkAccessViolation(requested, allowed) {
2393
+ if (requested === void 0 || requested === "off" || allowed === true) return null;
2394
+ if (!allowed) return "Generated tool requests network access, which this gate does not allow";
2395
+ if (requested === "on") return "Generated tool requests unrestricted network access; only an allowedHostnames list is allowed";
2396
+ const outside = requested.allowedHostnames.filter((host) => !allowed.allowedHostnames.includes(host));
2397
+ return outside.length > 0 ? `Generated tool requests hosts outside the allowed list: ${outside.join(", ")}` : null;
2383
2398
  }
2384
2399
  function isJSONSchema(value) {
2385
2400
  if (!isObject(value)) return false;
@@ -2426,6 +2441,12 @@ function normalizeGeneratedProposal(proposal, violations) {
2426
2441
  const sandboxProviderRaw = config.sandboxProvider;
2427
2442
  const languageRaw = config.language;
2428
2443
  const timeoutRaw = config.timeout;
2444
+ const sandboxProvider = isSandboxProvider(sandboxProviderRaw) ? sandboxProviderRaw : "cloudflare-worker";
2445
+ const language = isLanguage(languageRaw) ? languageRaw : "javascript";
2446
+ const timeout = asNumber(timeoutRaw);
2447
+ if (Array.isArray(config.secrets) && config.secrets.length > 0) violations.push("Generated tools cannot declare config.secrets (managed credentials)");
2448
+ const networkAccess = config.networkAccess;
2449
+ if (networkAccess !== void 0 && !isNetworkAccess(networkAccess)) violations.push("config.networkAccess must be 'off', 'on', or { allowedHostnames: string[] }");
2429
2450
  return {
2430
2451
  name,
2431
2452
  description,
@@ -2433,9 +2454,10 @@ function normalizeGeneratedProposal(proposal, violations) {
2433
2454
  parametersSchema,
2434
2455
  config: {
2435
2456
  code,
2436
- sandboxProvider: isSandboxProvider(sandboxProviderRaw) ? sandboxProviderRaw : "cloudflare-worker",
2437
- language: isLanguage(languageRaw) ? languageRaw : "javascript",
2438
- timeout: asNumber(timeoutRaw)
2457
+ sandboxProvider,
2458
+ language,
2459
+ timeout,
2460
+ ...isNetworkAccess(networkAccess) ? { networkAccess } : {}
2439
2461
  }
2440
2462
  };
2441
2463
  }
@@ -2488,6 +2510,8 @@ function evaluateGeneratedRuntimeToolProposal(proposal, options = {}) {
2488
2510
  violations.push(`Generated code matched blocked pattern: ${pattern}`);
2489
2511
  break;
2490
2512
  }
2513
+ const networkViolation = networkAccessViolation(normalized.config.networkAccess, options.allowNetworkAccess);
2514
+ if (networkViolation) violations.push(networkViolation);
2491
2515
  }
2492
2516
  const tool = {
2493
2517
  name: normalized.name,
@@ -5760,10 +5784,12 @@ var AgentsEndpoint = class AgentsEndpoint {
5760
5784
  return this.client.delete(`/agents/${id}`);
5761
5785
  }
5762
5786
  /**
5763
- * Export an agent as a self-contained runtime definition for @runtypelabs/runtime
5787
+ * Export an agent as a self-contained runtime definition for @runtypelabs/runtime.
5788
+ * Pass `versionId` or `alias` (at most one) to export a published version or the
5789
+ * version a release alias points at; the result's `release` records which one.
5764
5790
  */
5765
- async exportRuntime(id) {
5766
- return this.client.get(`/agents/${id}/export-runtime`);
5791
+ async exportRuntime(id, selector) {
5792
+ return this.client.get(`/agents/${id}/export-runtime`, selector);
5767
5793
  }
5768
5794
  /**
5769
5795
  * Roll up the agent's most recent runs: per-version and per-tool counts,
@@ -13457,7 +13483,7 @@ function transformQueryParams(params) {
13457
13483
  }
13458
13484
  //#endregion
13459
13485
  //#region src/version.ts
13460
- const SDK_VERSION = "10.5.3";
13486
+ const SDK_VERSION = "10.7.0";
13461
13487
  /**
13462
13488
  * Canonical client identity the API uses for attribution
13463
13489
  * (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
package/dist/index.d.cts CHANGED
@@ -117,6 +117,45 @@ interface ContextErrorHandling {
117
117
  * Do not make direct changes to the file.
118
118
  */
119
119
  interface paths {
120
+ "/.well-known/jwks.json": {
121
+ parameters: {
122
+ query?: never;
123
+ header?: never;
124
+ path?: never;
125
+ cookie?: never;
126
+ };
127
+ /**
128
+ * Identity assertion signing keys (JWKS)
129
+ * @description Public keys that verify the Runtype-signed `{{_identity.token}}` a tool call carries. Verify offline: check the ES256 signature against the key whose `kid` matches the token header, then `iss` (pin it to the one Runtype organization you trust: `<API origin>/orgs/<organizationId>`), `aud` (your host), `exp`, and the per-scope assurance in the `runtype` claim. Cache the response for up to five minutes; re-fetch when a token names an unknown `kid`.
130
+ */
131
+ get: {
132
+ parameters: {
133
+ query?: never;
134
+ header?: never;
135
+ path?: never;
136
+ cookie?: never;
137
+ };
138
+ requestBody?: never;
139
+ responses: {
140
+ /** @description The published key set. Empty when this environment has no signing key configured. */
141
+ 200: {
142
+ headers: {
143
+ [name: string]: unknown;
144
+ };
145
+ content: {
146
+ "application/json": components["schemas"]["IdentityAssertionJwks"];
147
+ };
148
+ };
149
+ };
150
+ };
151
+ put?: never;
152
+ post?: never;
153
+ delete?: never;
154
+ options?: never;
155
+ head?: never;
156
+ patch?: never;
157
+ trace?: never;
158
+ };
120
159
  "/v1/agent-aliases": {
121
160
  parameters: {
122
161
  query?: never;
@@ -5218,13 +5257,20 @@ interface paths {
5218
5257
  };
5219
5258
  /**
5220
5259
  * Export agent for runtime
5221
- * @description Export a fully-resolved, self-contained agent definition that the @runtypelabs/runtime package can consume directly at boot. Capabilities, flows, and nested sub-agents are inlined recursively (up to 3 levels). MCP credential values and external-agent auth credentials are replaced with secret-name references. Requires the `RUNTIME:EXPORT` scope and an Enterprise plan (the `byoc` entitlement); an unentitled account receives `403` with code `BYOC_PLAN_REQUIRED` in every environment.
5260
+ * @description Export a fully-resolved, self-contained agent definition that the @runtypelabs/runtime package can consume directly at boot. Capabilities, flows, and nested sub-agents are inlined recursively (up to 3 levels). Skills bound to the agent are snapshotted into `skills`, each with the skill version it resolved to, and the runtime loads them with no host wiring. MCP credential values and external-agent auth credentials are replaced with secret-name references. Requires the `RUNTIME:EXPORT` scope and an Enterprise plan (the `byoc` entitlement); an unentitled account receives `403` with code `BYOC_PLAN_REQUIRED` in every environment.
5222
5261
  *
5223
5262
  * The response carries `hostDependencies`: the runtime seams the exported artifact needs a host to wire before it can run everything it describes. A durable-class step (`wait-until` or `crawl`) anywhere in the agent's executable closure declares a `durable-pause-host` dependency; a detached-capable dynamic subagent pool or a detached inline subagent tool declares a `background-run-coordinator` dependency. The array is empty when nothing needs wiring.
5263
+ *
5264
+ * Pass at most one release selector. `versionId` exports that published version; `alias` exports the version a release alias (for example `staging`, `live` or `pr-42`) currently points at, resolved exactly as the execution selector `agent: { agentId, alias }` resolves it. With neither, the export follows the agent's default target: the version its `live` alias names when the org runs on release aliases, otherwise the agent's current definition. A version-backed export carries `release` with the resolved `versionId`, plus `alias` and `aliasRevision` when an alias selected it. An unknown version or alias, or an archived or expired alias, answers `404`.
5224
5265
  */
5225
5266
  get: {
5226
5267
  parameters: {
5227
- query?: never;
5268
+ query?: {
5269
+ /** @description Export this published agent version. Mutually exclusive with `alias`. */
5270
+ versionId?: string;
5271
+ /** @description Export the version this release alias currently points at. Mutually exclusive with `versionId`. */
5272
+ alias?: string;
5273
+ };
5228
5274
  header?: never;
5229
5275
  path: {
5230
5276
  id: string;
@@ -5255,10 +5301,18 @@ interface paths {
5255
5301
  hostDependencies: components["schemas"]["RuntimeHostDependency"][];
5256
5302
  id: string;
5257
5303
  name: string;
5304
+ /** @description The published version this export contains. `alias` and `aliasRevision` are present when a release alias selected it. Absent when the export read the agent's current definition. */
5305
+ release?: {
5306
+ alias?: string;
5307
+ aliasRevision?: number;
5308
+ versionId: string;
5309
+ };
5310
+ /** @description Skills bound to the agent, snapshotted with the skill version each resolved to. `executeAgent` loads them with no host wiring. Absent when the agent has no bound skills. */
5311
+ skills?: components["schemas"]["RuntimeExportedSkill"][];
5258
5312
  };
5259
5313
  };
5260
5314
  };
5261
- /** @description Invalid agent ID */
5315
+ /** @description Invalid agent ID, or both `versionId` and `alias` were supplied */
5262
5316
  400: {
5263
5317
  headers: {
5264
5318
  [name: string]: unknown;
@@ -5285,7 +5339,7 @@ interface paths {
5285
5339
  "application/json": components["schemas"]["Error"];
5286
5340
  };
5287
5341
  };
5288
- /** @description Agent not found */
5342
+ /** @description Agent not found, or the selected version or alias does not exist, is archived, or has expired */
5289
5343
  404: {
5290
5344
  headers: {
5291
5345
  [name: string]: unknown;
@@ -5294,6 +5348,15 @@ interface paths {
5294
5348
  "application/json": components["schemas"]["Error"];
5295
5349
  };
5296
5350
  };
5351
+ /** @description The agent type cannot export a selected version */
5352
+ 422: {
5353
+ headers: {
5354
+ [name: string]: unknown;
5355
+ };
5356
+ content: {
5357
+ "application/json": components["schemas"]["Error"];
5358
+ };
5359
+ };
5297
5360
  /** @description Internal server error */
5298
5361
  500: {
5299
5362
  headers: {
@@ -30181,7 +30244,9 @@ interface paths {
30181
30244
  data: {
30182
30245
  canvas?: unknown;
30183
30246
  capabilities: {
30247
+ agentId: string | null;
30184
30248
  capabilityName: string;
30249
+ flowId: string | null;
30185
30250
  }[];
30186
30251
  capabilityCount: number;
30187
30252
  createdAt: string;
@@ -40582,6 +40647,15 @@ interface paths {
40582
40647
  "application/json": components["schemas"]["Error"];
40583
40648
  };
40584
40649
  };
40650
+ /** @description A target record changed while the edit was applied (`record_conflict`); nothing was written, retry the edit */
40651
+ 409: {
40652
+ headers: {
40653
+ [name: string]: unknown;
40654
+ };
40655
+ content: {
40656
+ "application/json": components["schemas"]["Error"];
40657
+ };
40658
+ };
40585
40659
  /** @description A record's post-merge metadata violates its type's collection schema (enforce mode); the whole edit is rejected */
40586
40660
  422: {
40587
40661
  headers: {
@@ -41215,7 +41289,7 @@ interface paths {
41215
41289
  /** @enum {string} */
41216
41290
  role: "user" | "assistant";
41217
41291
  }[] | null;
41218
- /** @default {} */
41292
+ /** @description Replaces the whole metadata object. Omit to leave metadata unchanged. */
41219
41293
  metadata?: {
41220
41294
  [key: string]: unknown;
41221
41295
  };
@@ -41306,7 +41380,7 @@ interface paths {
41306
41380
  "application/json": components["schemas"]["Error"];
41307
41381
  };
41308
41382
  };
41309
- /** @description Duplicate record */
41383
+ /** @description Duplicate record (`duplicate_record`), or the record changed while this update was applied (`record_conflict`; re-read and retry) */
41310
41384
  409: {
41311
41385
  headers: {
41312
41386
  [name: string]: unknown;
@@ -51833,6 +51907,10 @@ interface components {
51833
51907
  };
51834
51908
  DispatchAgentJsonResponse: {
51835
51909
  agentExecutionId?: string;
51910
+ /** @description The published agent version the run executed. Absent when no stored version ran. */
51911
+ agentVersionId?: string;
51912
+ /** @description The release alias (for example `live`) the version was resolved through, when one was. */
51913
+ alias?: string;
51836
51914
  blockReason?: string;
51837
51915
  claudeManagedAgentId?: string;
51838
51916
  code?: string;
@@ -53230,6 +53308,24 @@ interface components {
53230
53308
  valid: boolean;
53231
53309
  warnings: components["schemas"]["FlowValidationIssue"][];
53232
53310
  };
53311
+ IdentityAssertionJwks: {
53312
+ /** @description Every key that may have signed a live assertion: the active key first, then verify-only keys kept for rotation. */
53313
+ keys: components["schemas"]["IdentityAssertionPublicJwk"][];
53314
+ };
53315
+ IdentityAssertionPublicJwk: {
53316
+ /** @description Always `ES256`. */
53317
+ alg: string;
53318
+ /** @description Curve; always `P-256`. */
53319
+ crv: string;
53320
+ /** @description Key id, matched against the token header `kid`. */
53321
+ kid: string;
53322
+ /** @description Key type; always `EC`. */
53323
+ kty: string;
53324
+ /** @description Always `sig`. */
53325
+ use: string;
53326
+ x: string;
53327
+ y: string;
53328
+ };
53233
53329
  InputDeliveryReceipt: {
53234
53330
  deliveryId: string;
53235
53331
  executionId: string;
@@ -53820,6 +53916,19 @@ interface components {
53820
53916
  error: string;
53821
53917
  message?: string;
53822
53918
  };
53919
+ RuntimeExportedSkill: {
53920
+ approvalDelta: string[];
53921
+ body: string;
53922
+ description: string;
53923
+ resolvedTools: {
53924
+ [key: string]: unknown;
53925
+ }[];
53926
+ skillId?: string;
53927
+ /** @description The skill version this snapshot was resolved from. */
53928
+ skillVersionId?: string;
53929
+ /** @description Skill slug; the agent loads it as `skill:<slug>`. */
53930
+ slug: string;
53931
+ };
53823
53932
  RuntimeHostDependency: {
53824
53933
  interface: string;
53825
53934
  /** @enum {string} */
@@ -56763,8 +56872,23 @@ export interface RuntimeFlowToolConfig {
56763
56872
  export interface RuntimeCustomToolConfig {
56764
56873
  code: string;
56765
56874
  language?: 'javascript' | 'typescript' | 'python';
56766
- sandboxProvider?: 'quickjs' | 'daytona' | 'cloudflare-worker';
56875
+ sandboxProvider?: 'quickjs' | 'daytona' | 'cloudflare-worker' | 'runtype-sandbox';
56767
56876
  timeout?: number;
56877
+ /** Egress posture for the code. Omitted means `'off'`; prefer an `allowedHostnames` list. */
56878
+ networkAccess?: 'off' | 'on' | {
56879
+ allowedHostnames: string[];
56880
+ };
56881
+ /** Managed secrets the code may send, read as phantom tokens from `secrets.<key>`. Requires SECRETS:READ. */
56882
+ secrets?: RuntimeCustomToolSecret[];
56883
+ }
56884
+ /** One managed secret a custom tool may send; the egress proxy injects it only for the matching host and path. */
56885
+ export interface RuntimeCustomToolSecret {
56886
+ /** Bare managed secret name, e.g. `GITHUB_TOKEN`. */
56887
+ key: string;
56888
+ hostnamePattern: string;
56889
+ pathPattern?: string;
56890
+ injectionMode: 'bearer_header' | 'api_key_header' | 'query_param' | 'basic_auth';
56891
+ injectionConfig?: Record<string, JsonValue>;
56768
56892
  }
56769
56893
  export interface RuntimeExternalToolConfig {
56770
56894
  url: string;
@@ -62538,14 +62662,16 @@ interface ApiKeyRequestListParams {
62538
62662
  }
62539
62663
  //#endregion
62540
62664
  //#region src/generated-tool-gate.d.ts
62665
+ declare const CUSTOM_TOOL_SANDBOX_PROVIDERS: readonly ["quickjs", "daytona", "cloudflare-worker", "runtype-sandbox"];
62666
+ type GateSandboxProvider = (typeof CUSTOM_TOOL_SANDBOX_PROVIDERS)[number] | 'cloudflare-sandbox';
62541
62667
  interface GeneratedRuntimeToolGateOptions {
62542
62668
  /**
62543
62669
  * Allowed runtime tool types.
62544
62670
  * Defaults to ['custom'] because this gate is intended for generated code tools.
62545
62671
  */
62546
62672
  allowedToolTypes?: Array<'custom' | 'external' | 'flow' | 'local'>;
62547
- /** Allowed sandbox providers for generated custom tools. Defaults to ['quickjs', 'daytona', 'cloudflare-worker', 'cloudflare-sandbox']. */
62548
- allowedSandboxProviders?: Array<'quickjs' | 'daytona' | 'cloudflare-worker' | 'cloudflare-sandbox'>;
62673
+ /** Allowed sandbox providers for generated custom tools. Defaults to every provider, including runtype-sandbox and its cloudflare-sandbox alias. */
62674
+ allowedSandboxProviders?: GateSandboxProvider[];
62549
62675
  /** Allowed languages for generated custom tools. Defaults to JS/TS/Python. */
62550
62676
  allowedLanguages?: Array<'javascript' | 'typescript' | 'python'>;
62551
62677
  /** Maximum allowed code size in characters (default 12000). */
@@ -62561,6 +62687,15 @@ interface GeneratedRuntimeToolGateOptions {
62561
62687
  blockedCodePatterns?: RegExp[];
62562
62688
  /** Optional custom validator for additional policy checks. Return a violation message to reject. */
62563
62689
  customValidator?: (tool: RuntimeTool) => string | null;
62690
+ /**
62691
+ * Network egress a generated custom tool may request via `config.networkAccess`. Off by default:
62692
+ * a proposal asking for anything but `'off'` is rejected. `true` passes the requested posture
62693
+ * through; `{ allowedHostnames }` accepts only an allowlist within those hosts. A generated tool
62694
+ * can never declare `config.secrets`: managed credentials are always rejected by this gate.
62695
+ */
62696
+ allowNetworkAccess?: boolean | {
62697
+ allowedHostnames: string[];
62698
+ };
62564
62699
  }
62565
62700
  interface GeneratedRuntimeToolGateDecision {
62566
62701
  approved: boolean;
@@ -65056,9 +65191,14 @@ export declare class AgentsEndpoint {
65056
65191
  */
65057
65192
  delete(id: string): Promise<void>;
65058
65193
  /**
65059
- * Export an agent as a self-contained runtime definition for @runtypelabs/runtime
65194
+ * Export an agent as a self-contained runtime definition for @runtypelabs/runtime.
65195
+ * Pass `versionId` or `alias` (at most one) to export a published version or the
65196
+ * version a release alias points at; the result's `release` records which one.
65060
65197
  */
65061
- exportRuntime(id: string): Promise<any>;
65198
+ exportRuntime(id: string, selector?: {
65199
+ versionId?: string;
65200
+ alias?: string;
65201
+ }): Promise<any>;
65062
65202
  /**
65063
65203
  * Roll up the agent's most recent runs: per-version and per-tool counts,
65064
65204
  * average tokens and cost, and which attached tools were never called.
package/dist/index.d.ts CHANGED
@@ -117,6 +117,45 @@ interface ContextErrorHandling {
117
117
  * Do not make direct changes to the file.
118
118
  */
119
119
  interface paths {
120
+ "/.well-known/jwks.json": {
121
+ parameters: {
122
+ query?: never;
123
+ header?: never;
124
+ path?: never;
125
+ cookie?: never;
126
+ };
127
+ /**
128
+ * Identity assertion signing keys (JWKS)
129
+ * @description Public keys that verify the Runtype-signed `{{_identity.token}}` a tool call carries. Verify offline: check the ES256 signature against the key whose `kid` matches the token header, then `iss` (pin it to the one Runtype organization you trust: `<API origin>/orgs/<organizationId>`), `aud` (your host), `exp`, and the per-scope assurance in the `runtype` claim. Cache the response for up to five minutes; re-fetch when a token names an unknown `kid`.
130
+ */
131
+ get: {
132
+ parameters: {
133
+ query?: never;
134
+ header?: never;
135
+ path?: never;
136
+ cookie?: never;
137
+ };
138
+ requestBody?: never;
139
+ responses: {
140
+ /** @description The published key set. Empty when this environment has no signing key configured. */
141
+ 200: {
142
+ headers: {
143
+ [name: string]: unknown;
144
+ };
145
+ content: {
146
+ "application/json": components["schemas"]["IdentityAssertionJwks"];
147
+ };
148
+ };
149
+ };
150
+ };
151
+ put?: never;
152
+ post?: never;
153
+ delete?: never;
154
+ options?: never;
155
+ head?: never;
156
+ patch?: never;
157
+ trace?: never;
158
+ };
120
159
  "/v1/agent-aliases": {
121
160
  parameters: {
122
161
  query?: never;
@@ -5218,13 +5257,20 @@ interface paths {
5218
5257
  };
5219
5258
  /**
5220
5259
  * Export agent for runtime
5221
- * @description Export a fully-resolved, self-contained agent definition that the @runtypelabs/runtime package can consume directly at boot. Capabilities, flows, and nested sub-agents are inlined recursively (up to 3 levels). MCP credential values and external-agent auth credentials are replaced with secret-name references. Requires the `RUNTIME:EXPORT` scope and an Enterprise plan (the `byoc` entitlement); an unentitled account receives `403` with code `BYOC_PLAN_REQUIRED` in every environment.
5260
+ * @description Export a fully-resolved, self-contained agent definition that the @runtypelabs/runtime package can consume directly at boot. Capabilities, flows, and nested sub-agents are inlined recursively (up to 3 levels). Skills bound to the agent are snapshotted into `skills`, each with the skill version it resolved to, and the runtime loads them with no host wiring. MCP credential values and external-agent auth credentials are replaced with secret-name references. Requires the `RUNTIME:EXPORT` scope and an Enterprise plan (the `byoc` entitlement); an unentitled account receives `403` with code `BYOC_PLAN_REQUIRED` in every environment.
5222
5261
  *
5223
5262
  * The response carries `hostDependencies`: the runtime seams the exported artifact needs a host to wire before it can run everything it describes. A durable-class step (`wait-until` or `crawl`) anywhere in the agent's executable closure declares a `durable-pause-host` dependency; a detached-capable dynamic subagent pool or a detached inline subagent tool declares a `background-run-coordinator` dependency. The array is empty when nothing needs wiring.
5263
+ *
5264
+ * Pass at most one release selector. `versionId` exports that published version; `alias` exports the version a release alias (for example `staging`, `live` or `pr-42`) currently points at, resolved exactly as the execution selector `agent: { agentId, alias }` resolves it. With neither, the export follows the agent's default target: the version its `live` alias names when the org runs on release aliases, otherwise the agent's current definition. A version-backed export carries `release` with the resolved `versionId`, plus `alias` and `aliasRevision` when an alias selected it. An unknown version or alias, or an archived or expired alias, answers `404`.
5224
5265
  */
5225
5266
  get: {
5226
5267
  parameters: {
5227
- query?: never;
5268
+ query?: {
5269
+ /** @description Export this published agent version. Mutually exclusive with `alias`. */
5270
+ versionId?: string;
5271
+ /** @description Export the version this release alias currently points at. Mutually exclusive with `versionId`. */
5272
+ alias?: string;
5273
+ };
5228
5274
  header?: never;
5229
5275
  path: {
5230
5276
  id: string;
@@ -5255,10 +5301,18 @@ interface paths {
5255
5301
  hostDependencies: components["schemas"]["RuntimeHostDependency"][];
5256
5302
  id: string;
5257
5303
  name: string;
5304
+ /** @description The published version this export contains. `alias` and `aliasRevision` are present when a release alias selected it. Absent when the export read the agent's current definition. */
5305
+ release?: {
5306
+ alias?: string;
5307
+ aliasRevision?: number;
5308
+ versionId: string;
5309
+ };
5310
+ /** @description Skills bound to the agent, snapshotted with the skill version each resolved to. `executeAgent` loads them with no host wiring. Absent when the agent has no bound skills. */
5311
+ skills?: components["schemas"]["RuntimeExportedSkill"][];
5258
5312
  };
5259
5313
  };
5260
5314
  };
5261
- /** @description Invalid agent ID */
5315
+ /** @description Invalid agent ID, or both `versionId` and `alias` were supplied */
5262
5316
  400: {
5263
5317
  headers: {
5264
5318
  [name: string]: unknown;
@@ -5285,7 +5339,7 @@ interface paths {
5285
5339
  "application/json": components["schemas"]["Error"];
5286
5340
  };
5287
5341
  };
5288
- /** @description Agent not found */
5342
+ /** @description Agent not found, or the selected version or alias does not exist, is archived, or has expired */
5289
5343
  404: {
5290
5344
  headers: {
5291
5345
  [name: string]: unknown;
@@ -5294,6 +5348,15 @@ interface paths {
5294
5348
  "application/json": components["schemas"]["Error"];
5295
5349
  };
5296
5350
  };
5351
+ /** @description The agent type cannot export a selected version */
5352
+ 422: {
5353
+ headers: {
5354
+ [name: string]: unknown;
5355
+ };
5356
+ content: {
5357
+ "application/json": components["schemas"]["Error"];
5358
+ };
5359
+ };
5297
5360
  /** @description Internal server error */
5298
5361
  500: {
5299
5362
  headers: {
@@ -30181,7 +30244,9 @@ interface paths {
30181
30244
  data: {
30182
30245
  canvas?: unknown;
30183
30246
  capabilities: {
30247
+ agentId: string | null;
30184
30248
  capabilityName: string;
30249
+ flowId: string | null;
30185
30250
  }[];
30186
30251
  capabilityCount: number;
30187
30252
  createdAt: string;
@@ -40582,6 +40647,15 @@ interface paths {
40582
40647
  "application/json": components["schemas"]["Error"];
40583
40648
  };
40584
40649
  };
40650
+ /** @description A target record changed while the edit was applied (`record_conflict`); nothing was written, retry the edit */
40651
+ 409: {
40652
+ headers: {
40653
+ [name: string]: unknown;
40654
+ };
40655
+ content: {
40656
+ "application/json": components["schemas"]["Error"];
40657
+ };
40658
+ };
40585
40659
  /** @description A record's post-merge metadata violates its type's collection schema (enforce mode); the whole edit is rejected */
40586
40660
  422: {
40587
40661
  headers: {
@@ -41215,7 +41289,7 @@ interface paths {
41215
41289
  /** @enum {string} */
41216
41290
  role: "user" | "assistant";
41217
41291
  }[] | null;
41218
- /** @default {} */
41292
+ /** @description Replaces the whole metadata object. Omit to leave metadata unchanged. */
41219
41293
  metadata?: {
41220
41294
  [key: string]: unknown;
41221
41295
  };
@@ -41306,7 +41380,7 @@ interface paths {
41306
41380
  "application/json": components["schemas"]["Error"];
41307
41381
  };
41308
41382
  };
41309
- /** @description Duplicate record */
41383
+ /** @description Duplicate record (`duplicate_record`), or the record changed while this update was applied (`record_conflict`; re-read and retry) */
41310
41384
  409: {
41311
41385
  headers: {
41312
41386
  [name: string]: unknown;
@@ -51833,6 +51907,10 @@ interface components {
51833
51907
  };
51834
51908
  DispatchAgentJsonResponse: {
51835
51909
  agentExecutionId?: string;
51910
+ /** @description The published agent version the run executed. Absent when no stored version ran. */
51911
+ agentVersionId?: string;
51912
+ /** @description The release alias (for example `live`) the version was resolved through, when one was. */
51913
+ alias?: string;
51836
51914
  blockReason?: string;
51837
51915
  claudeManagedAgentId?: string;
51838
51916
  code?: string;
@@ -53230,6 +53308,24 @@ interface components {
53230
53308
  valid: boolean;
53231
53309
  warnings: components["schemas"]["FlowValidationIssue"][];
53232
53310
  };
53311
+ IdentityAssertionJwks: {
53312
+ /** @description Every key that may have signed a live assertion: the active key first, then verify-only keys kept for rotation. */
53313
+ keys: components["schemas"]["IdentityAssertionPublicJwk"][];
53314
+ };
53315
+ IdentityAssertionPublicJwk: {
53316
+ /** @description Always `ES256`. */
53317
+ alg: string;
53318
+ /** @description Curve; always `P-256`. */
53319
+ crv: string;
53320
+ /** @description Key id, matched against the token header `kid`. */
53321
+ kid: string;
53322
+ /** @description Key type; always `EC`. */
53323
+ kty: string;
53324
+ /** @description Always `sig`. */
53325
+ use: string;
53326
+ x: string;
53327
+ y: string;
53328
+ };
53233
53329
  InputDeliveryReceipt: {
53234
53330
  deliveryId: string;
53235
53331
  executionId: string;
@@ -53820,6 +53916,19 @@ interface components {
53820
53916
  error: string;
53821
53917
  message?: string;
53822
53918
  };
53919
+ RuntimeExportedSkill: {
53920
+ approvalDelta: string[];
53921
+ body: string;
53922
+ description: string;
53923
+ resolvedTools: {
53924
+ [key: string]: unknown;
53925
+ }[];
53926
+ skillId?: string;
53927
+ /** @description The skill version this snapshot was resolved from. */
53928
+ skillVersionId?: string;
53929
+ /** @description Skill slug; the agent loads it as `skill:<slug>`. */
53930
+ slug: string;
53931
+ };
53823
53932
  RuntimeHostDependency: {
53824
53933
  interface: string;
53825
53934
  /** @enum {string} */
@@ -56763,8 +56872,23 @@ export interface RuntimeFlowToolConfig {
56763
56872
  export interface RuntimeCustomToolConfig {
56764
56873
  code: string;
56765
56874
  language?: 'javascript' | 'typescript' | 'python';
56766
- sandboxProvider?: 'quickjs' | 'daytona' | 'cloudflare-worker';
56875
+ sandboxProvider?: 'quickjs' | 'daytona' | 'cloudflare-worker' | 'runtype-sandbox';
56767
56876
  timeout?: number;
56877
+ /** Egress posture for the code. Omitted means `'off'`; prefer an `allowedHostnames` list. */
56878
+ networkAccess?: 'off' | 'on' | {
56879
+ allowedHostnames: string[];
56880
+ };
56881
+ /** Managed secrets the code may send, read as phantom tokens from `secrets.<key>`. Requires SECRETS:READ. */
56882
+ secrets?: RuntimeCustomToolSecret[];
56883
+ }
56884
+ /** One managed secret a custom tool may send; the egress proxy injects it only for the matching host and path. */
56885
+ export interface RuntimeCustomToolSecret {
56886
+ /** Bare managed secret name, e.g. `GITHUB_TOKEN`. */
56887
+ key: string;
56888
+ hostnamePattern: string;
56889
+ pathPattern?: string;
56890
+ injectionMode: 'bearer_header' | 'api_key_header' | 'query_param' | 'basic_auth';
56891
+ injectionConfig?: Record<string, JsonValue>;
56768
56892
  }
56769
56893
  export interface RuntimeExternalToolConfig {
56770
56894
  url: string;
@@ -62538,14 +62662,16 @@ interface ApiKeyRequestListParams {
62538
62662
  }
62539
62663
  //#endregion
62540
62664
  //#region src/generated-tool-gate.d.ts
62665
+ declare const CUSTOM_TOOL_SANDBOX_PROVIDERS: readonly ["quickjs", "daytona", "cloudflare-worker", "runtype-sandbox"];
62666
+ type GateSandboxProvider = (typeof CUSTOM_TOOL_SANDBOX_PROVIDERS)[number] | 'cloudflare-sandbox';
62541
62667
  interface GeneratedRuntimeToolGateOptions {
62542
62668
  /**
62543
62669
  * Allowed runtime tool types.
62544
62670
  * Defaults to ['custom'] because this gate is intended for generated code tools.
62545
62671
  */
62546
62672
  allowedToolTypes?: Array<'custom' | 'external' | 'flow' | 'local'>;
62547
- /** Allowed sandbox providers for generated custom tools. Defaults to ['quickjs', 'daytona', 'cloudflare-worker', 'cloudflare-sandbox']. */
62548
- allowedSandboxProviders?: Array<'quickjs' | 'daytona' | 'cloudflare-worker' | 'cloudflare-sandbox'>;
62673
+ /** Allowed sandbox providers for generated custom tools. Defaults to every provider, including runtype-sandbox and its cloudflare-sandbox alias. */
62674
+ allowedSandboxProviders?: GateSandboxProvider[];
62549
62675
  /** Allowed languages for generated custom tools. Defaults to JS/TS/Python. */
62550
62676
  allowedLanguages?: Array<'javascript' | 'typescript' | 'python'>;
62551
62677
  /** Maximum allowed code size in characters (default 12000). */
@@ -62561,6 +62687,15 @@ interface GeneratedRuntimeToolGateOptions {
62561
62687
  blockedCodePatterns?: RegExp[];
62562
62688
  /** Optional custom validator for additional policy checks. Return a violation message to reject. */
62563
62689
  customValidator?: (tool: RuntimeTool) => string | null;
62690
+ /**
62691
+ * Network egress a generated custom tool may request via `config.networkAccess`. Off by default:
62692
+ * a proposal asking for anything but `'off'` is rejected. `true` passes the requested posture
62693
+ * through; `{ allowedHostnames }` accepts only an allowlist within those hosts. A generated tool
62694
+ * can never declare `config.secrets`: managed credentials are always rejected by this gate.
62695
+ */
62696
+ allowNetworkAccess?: boolean | {
62697
+ allowedHostnames: string[];
62698
+ };
62564
62699
  }
62565
62700
  interface GeneratedRuntimeToolGateDecision {
62566
62701
  approved: boolean;
@@ -65056,9 +65191,14 @@ export declare class AgentsEndpoint {
65056
65191
  */
65057
65192
  delete(id: string): Promise<void>;
65058
65193
  /**
65059
- * Export an agent as a self-contained runtime definition for @runtypelabs/runtime
65194
+ * Export an agent as a self-contained runtime definition for @runtypelabs/runtime.
65195
+ * Pass `versionId` or `alias` (at most one) to export a published version or the
65196
+ * version a release alias points at; the result's `release` records which one.
65060
65197
  */
65061
- exportRuntime(id: string): Promise<any>;
65198
+ exportRuntime(id: string, selector?: {
65199
+ versionId?: string;
65200
+ alias?: string;
65201
+ }): Promise<any>;
65062
65202
  /**
65063
65203
  * Roll up the agent's most recent runs: per-version and per-tool counts,
65064
65204
  * average tokens and cost, and which attached tools were never called.
package/dist/index.mjs CHANGED
@@ -2351,12 +2351,13 @@ const DEFAULT_BLOCKED_CODE_PATTERNS = [
2351
2351
  /\bsubprocess\b/i,
2352
2352
  /\bos\.system\s*\(/i
2353
2353
  ];
2354
- const DEFAULT_ALLOWED_SANDBOX_PROVIDERS = [
2354
+ const CUSTOM_TOOL_SANDBOX_PROVIDERS = [
2355
2355
  "quickjs",
2356
2356
  "daytona",
2357
2357
  "cloudflare-worker",
2358
- "cloudflare-sandbox"
2358
+ "runtype-sandbox"
2359
2359
  ];
2360
+ const DEFAULT_ALLOWED_SANDBOX_PROVIDERS = [...CUSTOM_TOOL_SANDBOX_PROVIDERS, "cloudflare-sandbox"];
2360
2361
  const DEFAULT_ALLOWED_LANGUAGES = [
2361
2362
  "javascript",
2362
2363
  "typescript",
@@ -2378,7 +2379,21 @@ function isLanguage(value) {
2378
2379
  return value === "javascript" || value === "typescript" || value === "python";
2379
2380
  }
2380
2381
  function isSandboxProvider(value) {
2381
- return value === "quickjs" || value === "daytona" || value === "cloudflare-worker";
2382
+ return CUSTOM_TOOL_SANDBOX_PROVIDERS.includes(value);
2383
+ }
2384
+ function isNetworkAccess(value) {
2385
+ if (value === "off" || value === "on") return true;
2386
+ if (!isObject(value) || !Array.isArray(value.allowedHostnames)) return false;
2387
+ const hosts = value.allowedHostnames;
2388
+ return hosts.length > 0 && hosts.every((host) => typeof host === "string" && host.length > 0);
2389
+ }
2390
+ /** Why the requested posture exceeds what the caller allowed, or null when it fits. */
2391
+ function networkAccessViolation(requested, allowed) {
2392
+ if (requested === void 0 || requested === "off" || allowed === true) return null;
2393
+ if (!allowed) return "Generated tool requests network access, which this gate does not allow";
2394
+ if (requested === "on") return "Generated tool requests unrestricted network access; only an allowedHostnames list is allowed";
2395
+ const outside = requested.allowedHostnames.filter((host) => !allowed.allowedHostnames.includes(host));
2396
+ return outside.length > 0 ? `Generated tool requests hosts outside the allowed list: ${outside.join(", ")}` : null;
2382
2397
  }
2383
2398
  function isJSONSchema(value) {
2384
2399
  if (!isObject(value)) return false;
@@ -2425,6 +2440,12 @@ function normalizeGeneratedProposal(proposal, violations) {
2425
2440
  const sandboxProviderRaw = config.sandboxProvider;
2426
2441
  const languageRaw = config.language;
2427
2442
  const timeoutRaw = config.timeout;
2443
+ const sandboxProvider = isSandboxProvider(sandboxProviderRaw) ? sandboxProviderRaw : "cloudflare-worker";
2444
+ const language = isLanguage(languageRaw) ? languageRaw : "javascript";
2445
+ const timeout = asNumber(timeoutRaw);
2446
+ if (Array.isArray(config.secrets) && config.secrets.length > 0) violations.push("Generated tools cannot declare config.secrets (managed credentials)");
2447
+ const networkAccess = config.networkAccess;
2448
+ if (networkAccess !== void 0 && !isNetworkAccess(networkAccess)) violations.push("config.networkAccess must be 'off', 'on', or { allowedHostnames: string[] }");
2428
2449
  return {
2429
2450
  name,
2430
2451
  description,
@@ -2432,9 +2453,10 @@ function normalizeGeneratedProposal(proposal, violations) {
2432
2453
  parametersSchema,
2433
2454
  config: {
2434
2455
  code,
2435
- sandboxProvider: isSandboxProvider(sandboxProviderRaw) ? sandboxProviderRaw : "cloudflare-worker",
2436
- language: isLanguage(languageRaw) ? languageRaw : "javascript",
2437
- timeout: asNumber(timeoutRaw)
2456
+ sandboxProvider,
2457
+ language,
2458
+ timeout,
2459
+ ...isNetworkAccess(networkAccess) ? { networkAccess } : {}
2438
2460
  }
2439
2461
  };
2440
2462
  }
@@ -2487,6 +2509,8 @@ function evaluateGeneratedRuntimeToolProposal(proposal, options = {}) {
2487
2509
  violations.push(`Generated code matched blocked pattern: ${pattern}`);
2488
2510
  break;
2489
2511
  }
2512
+ const networkViolation = networkAccessViolation(normalized.config.networkAccess, options.allowNetworkAccess);
2513
+ if (networkViolation) violations.push(networkViolation);
2490
2514
  }
2491
2515
  const tool = {
2492
2516
  name: normalized.name,
@@ -5759,10 +5783,12 @@ var AgentsEndpoint = class AgentsEndpoint {
5759
5783
  return this.client.delete(`/agents/${id}`);
5760
5784
  }
5761
5785
  /**
5762
- * Export an agent as a self-contained runtime definition for @runtypelabs/runtime
5786
+ * Export an agent as a self-contained runtime definition for @runtypelabs/runtime.
5787
+ * Pass `versionId` or `alias` (at most one) to export a published version or the
5788
+ * version a release alias points at; the result's `release` records which one.
5763
5789
  */
5764
- async exportRuntime(id) {
5765
- return this.client.get(`/agents/${id}/export-runtime`);
5790
+ async exportRuntime(id, selector) {
5791
+ return this.client.get(`/agents/${id}/export-runtime`, selector);
5766
5792
  }
5767
5793
  /**
5768
5794
  * Roll up the agent's most recent runs: per-version and per-tool counts,
@@ -13456,7 +13482,7 @@ function transformQueryParams(params) {
13456
13482
  }
13457
13483
  //#endregion
13458
13484
  //#region src/version.ts
13459
- const SDK_VERSION = "10.5.3";
13485
+ const SDK_VERSION = "10.7.0";
13460
13486
  /**
13461
13487
  * Canonical client identity the API uses for attribution
13462
13488
  * (`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": "10.5.3",
3
+ "version": "10.7.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,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {},
26
26
  "devDependencies": {
27
- "@runtypelabs/shared": "3.66.0",
27
+ "@runtypelabs/shared": "3.68.0",
28
28
  "openapi-typescript": "^7.13.0",
29
29
  "tsdown": "^0.23.0",
30
30
  "typescript": "^6.0.3",