@aexhq/sdk 0.24.0 → 0.25.1

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 (64) hide show
  1. package/README.md +36 -125
  2. package/dist/_contracts/index.d.ts +0 -1
  3. package/dist/_contracts/index.js +0 -1
  4. package/dist/_contracts/models.js +1 -2
  5. package/dist/_contracts/operations.d.ts +13 -5
  6. package/dist/_contracts/operations.js +220 -10
  7. package/dist/_contracts/provider-support.d.ts +18 -29
  8. package/dist/_contracts/provider-support.js +3 -22
  9. package/dist/_contracts/proxy-protocol.d.ts +4 -2
  10. package/dist/_contracts/proxy-protocol.js +10 -3
  11. package/dist/_contracts/run-config.d.ts +28 -4
  12. package/dist/_contracts/run-config.js +10 -5
  13. package/dist/_contracts/run-cost.d.ts +3 -11
  14. package/dist/_contracts/run-cost.js +2 -57
  15. package/dist/_contracts/run-custody.d.ts +1 -52
  16. package/dist/_contracts/run-custody.js +3 -87
  17. package/dist/_contracts/run-retention.d.ts +1 -5
  18. package/dist/_contracts/run-retention.js +2 -14
  19. package/dist/_contracts/run-unit.d.ts +2 -2
  20. package/dist/_contracts/run-unit.js +3 -1
  21. package/dist/_contracts/runtime-security-profile.js +1 -1
  22. package/dist/_contracts/runtime-types.d.ts +38 -12
  23. package/dist/_contracts/side-effect-audit.d.ts +4 -5
  24. package/dist/_contracts/side-effect-audit.js +1 -4
  25. package/dist/_contracts/status.d.ts +3 -4
  26. package/dist/_contracts/status.js +3 -8
  27. package/dist/_contracts/submission.d.ts +68 -42
  28. package/dist/_contracts/submission.js +144 -30
  29. package/dist/bundle.d.ts +13 -0
  30. package/dist/bundle.js +51 -0
  31. package/dist/bundle.js.map +1 -1
  32. package/dist/cli.mjs +232 -58
  33. package/dist/cli.mjs.sha256 +1 -1
  34. package/dist/client.d.ts +25 -21
  35. package/dist/client.js +59 -15
  36. package/dist/client.js.map +1 -1
  37. package/dist/index.d.ts +6 -5
  38. package/dist/index.js +4 -3
  39. package/dist/index.js.map +1 -1
  40. package/dist/tool.d.ts +41 -0
  41. package/dist/tool.js +138 -0
  42. package/dist/tool.js.map +1 -0
  43. package/dist/version.d.ts +1 -1
  44. package/dist/version.js +1 -1
  45. package/docs/concepts/agent-tools.md +53 -0
  46. package/docs/concepts/composition.md +43 -0
  47. package/docs/concepts/providers-and-runtimes.md +53 -0
  48. package/docs/concepts/runs.md +40 -0
  49. package/docs/credentials.md +8 -4
  50. package/docs/events.md +12 -0
  51. package/docs/limits.md +53 -0
  52. package/docs/outputs.md +58 -0
  53. package/docs/provider-runtime-capabilities.md +53 -55
  54. package/docs/public-surface.json +81 -0
  55. package/docs/quickstart.md +28 -105
  56. package/docs/release.md +1 -1
  57. package/docs/run-config.md +2 -2
  58. package/docs/secrets.md +123 -0
  59. package/docs/skills.md +3 -3
  60. package/docs/vision-skills.md +14 -19
  61. package/package.json +2 -2
  62. package/dist/_contracts/managed-key.d.ts +0 -101
  63. package/dist/_contracts/managed-key.js +0 -181
  64. package/docs/product-boundaries.md +0 -57
@@ -1,11 +1,10 @@
1
1
  import { PROXY_ENDPOINT_DEFAULTS, type ProxyAuthShape, type ProxyMethod, type ProxyRetryPolicy, type ProxyResponseMode } from "./proxy-protocol.js";
2
2
  export { PROXY_ENDPOINT_DEFAULTS };
3
- import type { AgentsMdRef, FileRef, McpServerRef, SkillRef } from "./run-config.js";
3
+ import type { AgentsMdRef, FileRef, McpServerRef, SkillRef, ToolRef } from "./run-config.js";
4
4
  import { type RuntimeSize } from "./runtime-sizes.js";
5
5
  import { type PlatformPostHook, type PlatformPostHookInput } from "./post-hook.js";
6
6
  import { type RunModel } from "./models.js";
7
7
  import { type RuntimeSecurityProfileName } from "./runtime-security-profile.js";
8
- import { type CredentialMode, type ManagedKeyPolicyV1 } from "./managed-key.js";
9
8
  export type JsonPrimitive = string | number | boolean | null;
10
9
  export type JsonValue = JsonPrimitive | JsonValue[] | {
11
10
  readonly [key: string]: JsonValue;
@@ -145,6 +144,17 @@ export declare const Providers: {
145
144
  */
146
145
  export declare const RUNTIME_KINDS: readonly ["managed"];
147
146
  export type RuntimeKind = (typeof RUNTIME_KINDS)[number];
147
+ /**
148
+ * Credential source for upstream provider access. Launch accepts only BYOK:
149
+ * callers may omit `credentialMode` or pass `"byok"`. Other strings, including
150
+ * `"managed"`, are invalid submission values rather than reserved product
151
+ * promises.
152
+ */
153
+ export declare const CREDENTIAL_MODES: readonly ["byok"];
154
+ export type CredentialMode = (typeof CREDENTIAL_MODES)[number];
155
+ export declare const DEFAULT_CREDENTIAL_MODE: CredentialMode;
156
+ export declare function parseCredentialMode(input: unknown): CredentialMode;
157
+ export declare function credentialModeOrDefault(input: CredentialMode | undefined): CredentialMode;
148
158
  /** Outcome of the centralized runtime-support check. */
149
159
  export interface RuntimeSupportCheck {
150
160
  readonly ok: boolean;
@@ -188,11 +198,10 @@ export type PlatformProxyAuthValue = {
188
198
  };
189
199
  /**
190
200
  * Per-run inline secrets bundle. `apiKey` is the BYOK provider key for the
191
- * run's selected `provider` (required in `"byok"` credential mode, rejected
192
- * in `"managed"` mode). A run targets exactly one provider, so the key is a
193
- * single flat field rather than a per-provider block. `mcpServers` and
194
- * `proxyEndpointAuth` are cross-provider (an MCP credential is the same
195
- * secret whichever model is driving the MCP client).
201
+ * run's selected `provider`. A run targets exactly one provider, so the key is
202
+ * a single flat field rather than a per-provider block. `mcpServers` and
203
+ * `proxyEndpointAuth` are cross-provider (an MCP credential is the same secret
204
+ * whichever model is driving the MCP client).
196
205
  */
197
206
  export interface PlatformInlineSecrets {
198
207
  readonly apiKey?: string;
@@ -289,15 +298,16 @@ export declare function optionalPositiveInt(input: unknown, field: string): numb
289
298
  * only the non-secret half; bearer headers travel in
290
299
  * `secrets.mcpServers` keyed by `name`.
291
300
  *
292
- * `skills` is a list of `SkillRef`s workspace refs point at
293
- * `skill_bundles.id` (validated by the BFF before acceptance and pinned
294
- * into `run_skill_snapshots`), provider refs pass through unchanged.
301
+ * `skills` is a list of `SkillRef`s. Launch workspace skills use
302
+ * content-addressed asset refs; run submission snapshots the bytes into the
303
+ * run-owned prefix before dispatch.
295
304
  */
296
305
  export interface PlatformSubmission {
297
306
  readonly model: RunModel;
298
307
  readonly system?: string;
299
308
  readonly prompt: readonly string[];
300
309
  readonly skills: readonly SkillRef[];
310
+ readonly tools?: readonly ToolRef[];
301
311
  readonly agentsMd: readonly AgentsMdRef[];
302
312
  readonly files: readonly FileRef[];
303
313
  readonly mcpServers: readonly McpServerRef[];
@@ -320,14 +330,14 @@ export interface PlatformSubmission {
320
330
  */
321
331
  readonly outputs?: PlatformOutputCaptureConfig;
322
332
  /**
323
- * Optional override for the managed-runtime builtin extensions enabled
324
- * inside the runner container. Each entry is one of the closed
325
- * {@link BUILTINS} set (prefer the {@link Builtins} symbol
326
- * const). The platform default is `["developer"]` which gives the agent
327
- * shell + write + edit + tree tools (bash, grep via shell, file read via
328
- * shell or editor, file edit). To opt in to more tools (e.g. web fetch via
329
- * the `computercontroller` extension), pass the full list. To opt out of
330
- * all builtins (pure-MCP setup), pass an empty array.
333
+ * Optional override for the managed-runtime builtins enabled inside the
334
+ * runner container. Each entry is one of the closed {@link BUILTINS} set
335
+ * (prefer the {@link Builtins} symbol const).
336
+ *
337
+ * Omit the field for {@link DEFAULT_BUILTINS}: web search, web fetch,
338
+ * file read/edit, glob, grep, head, and tail. Pass an empty array to opt out
339
+ * of all builtins for pure-MCP runs. Pass a custom list to narrow or extend
340
+ * the tool surface, for example `[Builtins.WEB_SEARCH, Builtins.NOTEBOOK]`.
331
341
  *
332
342
  * Validation:
333
343
  * - Each entry must be a member of {@link BUILTINS}.
@@ -388,9 +398,7 @@ export interface PlatformRunSubmissionRequest {
388
398
  readonly idempotencyKey: string;
389
399
  /**
390
400
  * Credential source for upstream provider access. Omitted means
391
- * `"byok"` for compatibility with the current production path.
392
- * `"managed"` is a public contract value but remains fail-closed until
393
- * credential resolution and billing admission are available.
401
+ * `"byok"`; launch does not accept managed provider credentials.
394
402
  */
395
403
  readonly credentialMode: CredentialMode;
396
404
  /**
@@ -469,20 +477,14 @@ export type PlatformRunSubmissionInput = Omit<PlatformRunSubmissionRequest, "wor
469
477
  readonly postHook?: PlatformPostHookInput;
470
478
  };
471
479
  export interface ParseRunSubmissionOptions {
472
- readonly managedKeyPolicy?: ManagedKeyPolicyV1;
473
480
  }
474
481
  export declare function parseRunSubmissionRequest(input: unknown, options?: ParseRunSubmissionOptions): PlatformRunSubmissionRequest;
475
482
  export declare function parseRuntimeKind(input: unknown): RuntimeKind | undefined;
476
483
  export declare function parseRunProvider(input: unknown): RunProvider;
477
484
  /**
478
- * Cross-check the supplied secrets bundle against the credential mode.
479
- *
480
- * - `"byok"`: `secrets.apiKey` (the provider key for the run's `provider`)
481
- * MUST be present.
482
- * - `"managed"`: `secrets.apiKey` MUST be absent — provider access is
483
- * resolved by the managed-key policy, not a caller-supplied key.
484
- * - MCP / proxy endpoint auth carry across providers and are not
485
- * checked here.
485
+ * Cross-check the supplied secrets bundle against the credential mode. BYOK
486
+ * requires `secrets.apiKey` (the provider key for the run's `provider`). MCP /
487
+ * proxy endpoint auth carry across providers and are not checked here.
486
488
  */
487
489
  export declare function enforceCredentialSecretPolicy(credentialMode: CredentialMode, secrets: PlatformInlineSecrets): void;
488
490
  export declare function parseSubmission(input: unknown): PlatformSubmission;
@@ -491,28 +493,52 @@ export declare const OUTPUT_MODES: readonly ["buffered", "stream"];
491
493
  export type OutputMode = (typeof OUTPUT_MODES)[number];
492
494
  export declare const DEFAULT_OUTPUT_MODE: OutputMode;
493
495
  /**
494
- * Managed-runtime builtin extensions — the closed set the managed runtime
495
- * accepts. Closed so an invalid name is a compile error via {@link Builtins},
496
- * not a silent runtime no-op. `developer` is the platform default when
497
- * `builtins` is omitted; pass an empty array to disable all builtins
498
- * (pure-MCP setup).
496
+ * Managed-runtime builtins — the closed set the managed runtime accepts.
497
+ * Closed so an invalid name is a compile error via {@link Builtins}, not a
498
+ * silent runtime no-op.
499
+ *
500
+ * The first entries are the recommended concrete builtins. The legacy aggregate
501
+ * extension names remain accepted for existing callers, but are not the default.
499
502
  */
500
- export declare const BUILTINS: readonly ["developer", "computercontroller", "memory", "autovisualiser", "tutorial"];
503
+ export declare const BUILTINS: readonly ["web_search", "web_fetch", "read", "edit", "glob", "grep", "head", "tail", "notebook", "developer", "computercontroller", "memory", "autovisualiser", "tutorial"];
501
504
  export type Builtin = (typeof BUILTINS)[number];
505
+ /**
506
+ * DX-first managed-runtime defaults. Omitted `builtins` resolves to this list.
507
+ * Notebook support remains opt-in through {@link Builtins.NOTEBOOK}.
508
+ */
509
+ export declare const DEFAULT_BUILTINS: readonly ["web_search", "web_fetch", "read", "edit", "glob", "grep", "head", "tail"];
502
510
  /**
503
511
  * Symbol-style accessors for the closed builtin set, e.g.
504
- * `Builtins.COMPUTER_CONTROLLER`.
512
+ * `Builtins.WEB_SEARCH`.
505
513
  */
506
514
  export declare const Builtins: {
507
- /** Shell (bash + UNIX tools incl. grep), write, edit, tree. The default. */
515
+ /** Managed web search. Included in {@link DEFAULT_BUILTINS}. */
516
+ readonly WEB_SEARCH: "web_search";
517
+ /** Fetch a URL and return readable text. Included in {@link DEFAULT_BUILTINS}. */
518
+ readonly WEB_FETCH: "web_fetch";
519
+ /** Read files. Included in {@link DEFAULT_BUILTINS}. */
520
+ readonly READ: "read";
521
+ /** Create/modify files. Included in {@link DEFAULT_BUILTINS}. */
522
+ readonly EDIT: "edit";
523
+ /** Search paths by glob. Included in {@link DEFAULT_BUILTINS}. */
524
+ readonly GLOB: "glob";
525
+ /** Search file contents. Included in {@link DEFAULT_BUILTINS}. */
526
+ readonly GREP: "grep";
527
+ /** Read the first lines of a file. Included in {@link DEFAULT_BUILTINS}. */
528
+ readonly HEAD: "head";
529
+ /** Read the last lines of a file. Included in {@link DEFAULT_BUILTINS}. */
530
+ readonly TAIL: "tail";
531
+ /** Jupyter notebook editing. Optional; not in {@link DEFAULT_BUILTINS}. */
532
+ readonly NOTEBOOK: "notebook";
533
+ /** Legacy aggregate: shell/filesystem/navigation/web/notebook tools. */
508
534
  readonly DEVELOPER: "developer";
509
- /** Web fetch/scrape, scripting, general computer-control tools. */
535
+ /** Legacy aggregate alias retained for existing callers. */
510
536
  readonly COMPUTER_CONTROLLER: "computercontroller";
511
- /** Cross-session preference memory. */
537
+ /** Legacy aggregate alias retained for existing callers. */
512
538
  readonly MEMORY: "memory";
513
- /** Inline data-visualisation rendering. */
539
+ /** Legacy aggregate alias retained for existing callers. */
514
540
  readonly AUTOVISUALISER: "autovisualiser";
515
- /** Interactive guided tutorials. */
541
+ /** Legacy aggregate alias retained for existing callers. */
516
542
  readonly TUTORIAL: "tutorial";
517
543
  };
518
544
  /**
@@ -4,12 +4,11 @@ import { authShapeHeaderName, PROXY_ALLOWED_METHODS, PROXY_ENDPOINT_DEFAULTS, PR
4
4
  // existing `@aexhq/contracts` consumers of `PROXY_ENDPOINT_DEFAULTS` are
5
5
  // unaffected by the move.
6
6
  export { PROXY_ENDPOINT_DEFAULTS };
7
- import { parseAssetRefFields, parseMcpServerRef, parseSkillRef } from "./run-config.js";
7
+ import { TOOL_NAME_PATTERN, normaliseSkillBundlePath, parseAssetRefFields, parseMcpServerRef, parseSkillRef } from "./run-config.js";
8
8
  import { parseRunTimeout, parseRuntimeSize } from "./runtime-sizes.js";
9
9
  import { parsePostHook } from "./post-hook.js";
10
10
  import { assertRunModelMatchesProvider, parseRunModel } from "./models.js";
11
11
  import { parseRuntimeSecurityProfile } from "./runtime-security-profile.js";
12
- import { assertManagedKeyAdmissionAllowed, parseCredentialMode } from "./managed-key.js";
13
12
  /**
14
13
  * Reserved prefix for aex-set runtime env vars (`AEX_CLI`,
15
14
  * `AEX_RUNTIME_JSON`, …). Customer `environment.envVars` keys carrying this
@@ -121,6 +120,26 @@ export const Providers = {
121
120
  * accepted submission value and fails schema validation.
122
121
  */
123
122
  export const RUNTIME_KINDS = ["managed"];
123
+ /**
124
+ * Credential source for upstream provider access. Launch accepts only BYOK:
125
+ * callers may omit `credentialMode` or pass `"byok"`. Other strings, including
126
+ * `"managed"`, are invalid submission values rather than reserved product
127
+ * promises.
128
+ */
129
+ export const CREDENTIAL_MODES = ["byok"];
130
+ export const DEFAULT_CREDENTIAL_MODE = "byok";
131
+ export function parseCredentialMode(input) {
132
+ if (input === undefined) {
133
+ return DEFAULT_CREDENTIAL_MODE;
134
+ }
135
+ if (typeof input !== "string" || !CREDENTIAL_MODES.includes(input)) {
136
+ throw new Error(`credentialMode must be one of: ${CREDENTIAL_MODES.join(", ")} (got ${JSON.stringify(input)})`);
137
+ }
138
+ return input;
139
+ }
140
+ export function credentialModeOrDefault(input) {
141
+ return input ?? DEFAULT_CREDENTIAL_MODE;
142
+ }
124
143
  /**
125
144
  * Centralized runtime-support validator. Native is removed from the public
126
145
  * runtime enum, so an absent runtime and `"managed"` are the only supported
@@ -999,9 +1018,7 @@ export function parseRunSubmissionRequest(input, options = {}) {
999
1018
  const provider = parseRunProvider(value.provider);
1000
1019
  const runtime = parseRuntimeKind(value.runtime);
1001
1020
  const credentialMode = parseCredentialMode(value.credentialMode);
1002
- if (credentialMode === "managed") {
1003
- assertManagedKeyAdmissionAllowed(options.managedKeyPolicy);
1004
- }
1021
+ void options;
1005
1022
  // Cross-field validation via the centralized runtime-support validator.
1006
1023
  const runtimeSupport = checkRuntimeSupported(provider, runtime);
1007
1024
  if (!runtimeSupport.ok) {
@@ -1086,22 +1103,12 @@ export function parseRunProvider(input) {
1086
1103
  return input;
1087
1104
  }
1088
1105
  /**
1089
- * Cross-check the supplied secrets bundle against the credential mode.
1090
- *
1091
- * - `"byok"`: `secrets.apiKey` (the provider key for the run's `provider`)
1092
- * MUST be present.
1093
- * - `"managed"`: `secrets.apiKey` MUST be absent — provider access is
1094
- * resolved by the managed-key policy, not a caller-supplied key.
1095
- * - MCP / proxy endpoint auth carry across providers and are not
1096
- * checked here.
1106
+ * Cross-check the supplied secrets bundle against the credential mode. BYOK
1107
+ * requires `secrets.apiKey` (the provider key for the run's `provider`). MCP /
1108
+ * proxy endpoint auth carry across providers and are not checked here.
1097
1109
  */
1098
1110
  export function enforceCredentialSecretPolicy(credentialMode, secrets) {
1099
- if (credentialMode === "managed") {
1100
- if (secrets.apiKey !== undefined) {
1101
- throw new Error(`secrets.apiKey is not allowed when credentialMode is managed; provider access is resolved by the managed-key policy`);
1102
- }
1103
- return;
1104
- }
1111
+ void credentialMode;
1105
1112
  if (!secrets.apiKey) {
1106
1113
  throw new Error(`secrets.apiKey is required when credentialMode is byok`);
1107
1114
  }
@@ -1113,6 +1120,7 @@ export function parseSubmission(input) {
1113
1120
  "system",
1114
1121
  "prompt",
1115
1122
  "skills",
1123
+ "tools",
1116
1124
  "agentsMd",
1117
1125
  "files",
1118
1126
  "mcpServers",
@@ -1134,6 +1142,7 @@ export function parseSubmission(input) {
1134
1142
  const system = optionalString(value.system, "submission.system");
1135
1143
  const prompt = parsePrompt(value.prompt);
1136
1144
  const skills = parseSkills(value.skills);
1145
+ const tools = parseTools(value.tools);
1137
1146
  const agentsMd = parseAgentsMd(value.agentsMd);
1138
1147
  const files = parseFiles(value.files);
1139
1148
  const mcpServers = parseMcpServers(value.mcpServers);
@@ -1150,6 +1159,7 @@ export function parseSubmission(input) {
1150
1159
  ...(system ? { system } : {}),
1151
1160
  prompt,
1152
1161
  skills,
1162
+ tools,
1153
1163
  agentsMd,
1154
1164
  files,
1155
1165
  mcpServers,
@@ -1222,33 +1232,75 @@ function parseOutputMode(input) {
1222
1232
  return input;
1223
1233
  }
1224
1234
  /**
1225
- * Managed-runtime builtin extensions — the closed set the managed runtime
1226
- * accepts. Closed so an invalid name is a compile error via {@link Builtins},
1227
- * not a silent runtime no-op. `developer` is the platform default when
1228
- * `builtins` is omitted; pass an empty array to disable all builtins
1229
- * (pure-MCP setup).
1235
+ * Managed-runtime builtins — the closed set the managed runtime accepts.
1236
+ * Closed so an invalid name is a compile error via {@link Builtins}, not a
1237
+ * silent runtime no-op.
1238
+ *
1239
+ * The first entries are the recommended concrete builtins. The legacy aggregate
1240
+ * extension names remain accepted for existing callers, but are not the default.
1230
1241
  */
1231
1242
  export const BUILTINS = [
1243
+ "web_search",
1244
+ "web_fetch",
1245
+ "read",
1246
+ "edit",
1247
+ "glob",
1248
+ "grep",
1249
+ "head",
1250
+ "tail",
1251
+ "notebook",
1232
1252
  "developer",
1233
1253
  "computercontroller",
1234
1254
  "memory",
1235
1255
  "autovisualiser",
1236
1256
  "tutorial"
1237
1257
  ];
1258
+ /**
1259
+ * DX-first managed-runtime defaults. Omitted `builtins` resolves to this list.
1260
+ * Notebook support remains opt-in through {@link Builtins.NOTEBOOK}.
1261
+ */
1262
+ export const DEFAULT_BUILTINS = [
1263
+ "web_search",
1264
+ "web_fetch",
1265
+ "read",
1266
+ "edit",
1267
+ "glob",
1268
+ "grep",
1269
+ "head",
1270
+ "tail"
1271
+ ];
1238
1272
  /**
1239
1273
  * Symbol-style accessors for the closed builtin set, e.g.
1240
- * `Builtins.COMPUTER_CONTROLLER`.
1274
+ * `Builtins.WEB_SEARCH`.
1241
1275
  */
1242
1276
  export const Builtins = {
1243
- /** Shell (bash + UNIX tools incl. grep), write, edit, tree. The default. */
1277
+ /** Managed web search. Included in {@link DEFAULT_BUILTINS}. */
1278
+ WEB_SEARCH: "web_search",
1279
+ /** Fetch a URL and return readable text. Included in {@link DEFAULT_BUILTINS}. */
1280
+ WEB_FETCH: "web_fetch",
1281
+ /** Read files. Included in {@link DEFAULT_BUILTINS}. */
1282
+ READ: "read",
1283
+ /** Create/modify files. Included in {@link DEFAULT_BUILTINS}. */
1284
+ EDIT: "edit",
1285
+ /** Search paths by glob. Included in {@link DEFAULT_BUILTINS}. */
1286
+ GLOB: "glob",
1287
+ /** Search file contents. Included in {@link DEFAULT_BUILTINS}. */
1288
+ GREP: "grep",
1289
+ /** Read the first lines of a file. Included in {@link DEFAULT_BUILTINS}. */
1290
+ HEAD: "head",
1291
+ /** Read the last lines of a file. Included in {@link DEFAULT_BUILTINS}. */
1292
+ TAIL: "tail",
1293
+ /** Jupyter notebook editing. Optional; not in {@link DEFAULT_BUILTINS}. */
1294
+ NOTEBOOK: "notebook",
1295
+ /** Legacy aggregate: shell/filesystem/navigation/web/notebook tools. */
1244
1296
  DEVELOPER: "developer",
1245
- /** Web fetch/scrape, scripting, general computer-control tools. */
1297
+ /** Legacy aggregate alias retained for existing callers. */
1246
1298
  COMPUTER_CONTROLLER: "computercontroller",
1247
- /** Cross-session preference memory. */
1299
+ /** Legacy aggregate alias retained for existing callers. */
1248
1300
  MEMORY: "memory",
1249
- /** Inline data-visualisation rendering. */
1301
+ /** Legacy aggregate alias retained for existing callers. */
1250
1302
  AUTOVISUALISER: "autovisualiser",
1251
- /** Interactive guided tutorials. */
1303
+ /** Legacy aggregate alias retained for existing callers. */
1252
1304
  TUTORIAL: "tutorial"
1253
1305
  };
1254
1306
  const MAX_BUILTINS = 16;
@@ -1505,6 +1557,68 @@ function parseSkills(input) {
1505
1557
  return ref;
1506
1558
  });
1507
1559
  }
1560
+ function parseTools(input) {
1561
+ if (input === undefined) {
1562
+ return [];
1563
+ }
1564
+ if (!Array.isArray(input)) {
1565
+ throw new Error("submission.tools must be an array of ToolRef objects");
1566
+ }
1567
+ const seenNames = new Set();
1568
+ const seenAssetIds = new Set();
1569
+ return input.map((item, index) => {
1570
+ const path = `submission.tools[${index}]`;
1571
+ const raw = requireRecord(item, path);
1572
+ for (const key of Object.keys(raw)) {
1573
+ if (key !== "kind" &&
1574
+ key !== "assetId" &&
1575
+ key !== "name" &&
1576
+ key !== "description" &&
1577
+ key !== "input_schema" &&
1578
+ key !== "entry") {
1579
+ throw new Error(`${path}.${key} is not an allowed field for ToolRef; permitted: kind, assetId, name, description, input_schema, entry`);
1580
+ }
1581
+ }
1582
+ if (raw.kind !== "asset") {
1583
+ throw new Error(`${path}.kind must be 'asset' (got ${JSON.stringify(raw.kind)})`);
1584
+ }
1585
+ const fields = parseAssetRefFields({ kind: raw.kind, assetId: raw.assetId, name: raw.name }, path);
1586
+ if (!TOOL_NAME_PATTERN.test(fields.name)) {
1587
+ throw new Error(`${path}.name must match ${TOOL_NAME_PATTERN.source}`);
1588
+ }
1589
+ if (fields.name.includes("__")) {
1590
+ throw new Error(`${path}.name must not contain "__"; that separator is reserved for MCP tools`);
1591
+ }
1592
+ if (seenNames.has(fields.name)) {
1593
+ throw new Error(`submission.tools duplicate name: ${fields.name}`);
1594
+ }
1595
+ seenNames.add(fields.name);
1596
+ if (seenAssetIds.has(fields.assetId)) {
1597
+ throw new Error(`submission.tools duplicate assetId: ${fields.assetId}`);
1598
+ }
1599
+ seenAssetIds.add(fields.assetId);
1600
+ const description = requireString(raw.description, `${path}.description`);
1601
+ if (description.trim().length === 0 || description.length > 2048) {
1602
+ throw new Error(`${path}.description must be non-empty and <= 2048 chars`);
1603
+ }
1604
+ const inputSchema = requireRecord(raw.input_schema, `${path}.input_schema`);
1605
+ if (!isJsonValue(inputSchema)) {
1606
+ throw new Error(`${path}.input_schema must be JSON-serializable`);
1607
+ }
1608
+ if (inputSchema.type !== "object") {
1609
+ throw new Error(`${path}.input_schema.type must be "object"`);
1610
+ }
1611
+ const entry = normaliseSkillBundlePath(requireString(raw.entry, `${path}.entry`));
1612
+ return {
1613
+ kind: "asset",
1614
+ assetId: fields.assetId,
1615
+ name: fields.name,
1616
+ description,
1617
+ input_schema: inputSchema,
1618
+ entry
1619
+ };
1620
+ });
1621
+ }
1508
1622
  function parseAgentsMd(input) {
1509
1623
  if (input === undefined)
1510
1624
  return [];
package/dist/bundle.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type ToolInputSchema } from "./_contracts/index.js";
1
2
  /**
2
3
  * In-memory skill bundle: a flat path -> bytes map and the
3
4
  * deterministically-zipped representation.
@@ -22,6 +23,18 @@ export interface BundledSkill {
22
23
  /** Inline files map: path -> contents (UTF-8 string or raw bytes). */
23
24
  export type SkillFiles = Readonly<Record<string, string | Uint8Array>>;
24
25
  export declare function bundleSkillFiles(files: SkillFiles): BundledSkill;
26
+ export interface BundledTool {
27
+ readonly zip: Uint8Array;
28
+ readonly fileCount: number;
29
+ readonly compressedSize: number;
30
+ }
31
+ export interface ToolBundleManifest {
32
+ readonly name: string;
33
+ readonly description: string;
34
+ readonly input_schema: ToolInputSchema;
35
+ readonly entry: string;
36
+ }
37
+ export declare function bundleToolFiles(files: SkillFiles, manifest: ToolBundleManifest): BundledTool;
25
38
  /**
26
39
  * Compute `sha256:<hex>` of the given canonicalised zip bytes. Used by
27
40
  * `Skill.fromFiles` / `Skill.fromPath` to populate the
package/dist/bundle.js CHANGED
@@ -53,6 +53,57 @@ export function bundleSkillFiles(files) {
53
53
  }
54
54
  return { zip, fileCount: entries.length, compressedSize: zip.byteLength };
55
55
  }
56
+ export function bundleToolFiles(files, manifest) {
57
+ if (!files || typeof files !== "object") {
58
+ throw new Error("Tool files map is required");
59
+ }
60
+ const entries = Object.entries(files);
61
+ if (entries.length === 0) {
62
+ throw new Error("Tool files map cannot be empty");
63
+ }
64
+ if (entries.length > SKILL_BUNDLE_LIMITS.maxFiles) {
65
+ throw new Error(`Tool bundle exceeds ${SKILL_BUNDLE_LIMITS.maxFiles} file limit (got ${entries.length})`);
66
+ }
67
+ const collected = new Map();
68
+ let totalDecompressed = 0;
69
+ let hasEntry = false;
70
+ const entryPath = validateSkillBundleEntry({ path: manifest.entry, size: 0 }).path;
71
+ for (const [rawPath, contents] of entries) {
72
+ const bytes = typeof contents === "string" ? TEXT.encode(contents) : contents;
73
+ if (!(bytes instanceof Uint8Array)) {
74
+ throw new Error(`Tool file "${rawPath}" must be a string or Uint8Array`);
75
+ }
76
+ const entry = validateSkillBundleEntry({ path: rawPath, size: bytes.byteLength });
77
+ totalDecompressed += bytes.byteLength;
78
+ if (totalDecompressed > SKILL_BUNDLE_LIMITS.maxDecompressedBytes) {
79
+ throw new Error(`Tool bundle exceeds decompressed cap of ${SKILL_BUNDLE_LIMITS.maxDecompressedBytes} bytes`);
80
+ }
81
+ if (collected.has(entry.path)) {
82
+ throw new Error(`Tool bundle contains duplicate path: ${entry.path}`);
83
+ }
84
+ if (entry.path === entryPath)
85
+ hasEntry = true;
86
+ collected.set(entry.path, bytes);
87
+ }
88
+ if (!hasEntry) {
89
+ throw new Error(`Tool bundle entry "${entryPath}" must exist in files`);
90
+ }
91
+ const manifestBytes = TEXT.encode(`${JSON.stringify(manifest, null, 2)}\n`);
92
+ if (collected.has("tool.json")) {
93
+ throw new Error('Tool bundle files must not include reserved "tool.json"; pass manifest fields to Tool.fromFiles instead');
94
+ }
95
+ collected.set("tool.json", manifestBytes);
96
+ const sorted = [...collected.entries()].sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0));
97
+ const zippable = {};
98
+ for (const [path, bytes] of sorted) {
99
+ zippable[path] = [bytes, { mtime: ZIP_EPOCH }];
100
+ }
101
+ const zip = zipSync(zippable, { level: 6 });
102
+ if (zip.byteLength > SKILL_BUNDLE_LIMITS.maxCompressedBytes) {
103
+ throw new Error(`Tool bundle exceeds compressed cap of ${SKILL_BUNDLE_LIMITS.maxCompressedBytes} bytes (got ${zip.byteLength})`);
104
+ }
105
+ return { zip, fileCount: collected.size, compressedSize: zip.byteLength };
106
+ }
56
107
  const ZIP_EPOCH = new Date(Date.UTC(1980, 0, 1));
57
108
  /**
58
109
  * Compute `sha256:<hex>` of the given canonicalised zip bytes. Used by
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAwBjF,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;AAK/B,MAAM,UAAU,gBAAgB,CAAC,KAAiB;IAChD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC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