@aexhq/sdk 0.33.0 → 0.34.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 (76) hide show
  1. package/README.md +19 -27
  2. package/dist/_contracts/operations.d.ts +2 -54
  3. package/dist/_contracts/operations.js +2 -87
  4. package/dist/_contracts/run-config.d.ts +19 -13
  5. package/dist/_contracts/run-config.js +6 -33
  6. package/dist/_contracts/run-unit.d.ts +1 -33
  7. package/dist/_contracts/run-unit.js +2 -21
  8. package/dist/_contracts/runtime-sizes.d.ts +2 -2
  9. package/dist/_contracts/runtime-sizes.js +2 -2
  10. package/dist/_contracts/status.d.ts +2 -2
  11. package/dist/_contracts/status.js +3 -0
  12. package/dist/_contracts/submission.d.ts +22 -18
  13. package/dist/_contracts/submission.js +60 -42
  14. package/dist/agents-md.d.ts +5 -5
  15. package/dist/agents-md.js +7 -7
  16. package/dist/agents-md.js.map +1 -1
  17. package/dist/asset-upload.d.ts +4 -4
  18. package/dist/asset-upload.js +4 -4
  19. package/dist/bundle.d.ts +2 -2
  20. package/dist/bundle.js +2 -2
  21. package/dist/cli.mjs +354 -12982
  22. package/dist/cli.mjs.sha256 +1 -1
  23. package/dist/client.d.ts +218 -386
  24. package/dist/client.js +375 -645
  25. package/dist/client.js.map +1 -1
  26. package/dist/data-tools.d.ts +25 -22
  27. package/dist/data-tools.js +75 -62
  28. package/dist/data-tools.js.map +1 -1
  29. package/dist/fetch-archive.js +16 -16
  30. package/dist/fetch-archive.js.map +1 -1
  31. package/dist/file.d.ts +5 -5
  32. package/dist/file.js +7 -7
  33. package/dist/file.js.map +1 -1
  34. package/dist/index.d.ts +9 -9
  35. package/dist/index.js +14 -13
  36. package/dist/index.js.map +1 -1
  37. package/dist/mcp-server.d.ts +4 -4
  38. package/dist/mcp-server.js +4 -4
  39. package/dist/proxy-endpoint.d.ts +4 -4
  40. package/dist/proxy-endpoint.js +1 -1
  41. package/dist/secret.d.ts +8 -8
  42. package/dist/secret.js +8 -8
  43. package/dist/secret.js.map +1 -1
  44. package/dist/skill-tool.d.ts +102 -0
  45. package/dist/skill-tool.js +190 -0
  46. package/dist/skill-tool.js.map +1 -0
  47. package/dist/tool.d.ts +1 -1
  48. package/dist/tool.js +3 -3
  49. package/dist/tool.js.map +1 -1
  50. package/dist/version.d.ts +1 -1
  51. package/dist/version.js +1 -1
  52. package/docs/cleanup.md +3 -3
  53. package/docs/concepts/agent-tools.md +6 -25
  54. package/docs/concepts/composition.md +15 -12
  55. package/docs/concepts/providers-and-runtimes.md +3 -3
  56. package/docs/concepts/runs.md +27 -22
  57. package/docs/credentials.md +52 -84
  58. package/docs/defaults.md +6 -6
  59. package/docs/events.md +65 -44
  60. package/docs/limits-and-quotas.md +3 -4
  61. package/docs/mcp.md +3 -3
  62. package/docs/networking.md +8 -8
  63. package/docs/outputs.md +44 -40
  64. package/docs/provider-runtime-capabilities.md +1 -1
  65. package/docs/public-surface.json +2 -2
  66. package/docs/quickstart.md +20 -10
  67. package/docs/run-config.md +12 -14
  68. package/docs/run-record.md +8 -8
  69. package/docs/secrets.md +16 -26
  70. package/docs/skills.md +55 -110
  71. package/docs/vision-skills.md +29 -40
  72. package/examples/chat-corpus.ts +8 -9
  73. package/package.json +1 -1
  74. package/dist/skill.d.ts +0 -149
  75. package/dist/skill.js +0 -198
  76. package/dist/skill.js.map +0 -1
@@ -1,6 +1,6 @@
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, ToolRef } from "./run-config.js";
3
+ import type { AgentsMdRef, FileRef, McpServerRef, SkillToolRef, ToolRef } from "./run-config.js";
4
4
  import { type RuntimeSize } from "./runtime-sizes.js";
5
5
  import { type RunModel } from "./models.js";
6
6
  import { type RuntimeSecurityProfileName } from "./runtime-security-profile.js";
@@ -274,16 +274,24 @@ export declare function optionalPositiveNumber(input: unknown, field: string): n
274
274
  * only the non-secret half; bearer headers travel in
275
275
  * `secrets.mcpServers` keyed by `name`.
276
276
  *
277
- * `skills` is a list of `SkillRef`s. Launch workspace skills use
278
- * content-addressed asset refs; run submission snapshots the bytes into the
279
- * run-owned prefix before dispatch.
277
+ * `tools` is the union of builtin tool names, custom `ToolRef` bundles, and
278
+ * skill-tools (`{ kind:"skill", }`); parsing splits them into `tools`,
279
+ * `builtinTools`, and `skillTools`. Skill bundles are content-addressed asset
280
+ * refs snapshotted into the run-owned prefix before dispatch.
280
281
  */
281
282
  export interface PlatformSubmission {
282
283
  readonly model: RunModel;
283
284
  readonly system?: string;
284
285
  readonly prompt: readonly string[];
285
- readonly skills: readonly SkillRef[];
286
286
  readonly tools?: readonly ToolRef[];
287
+ /**
288
+ * Skill-tools: skills re-expressed as synthetic no-arg load-tools. Derived
289
+ * from the `tools` union at parse time (the `{ kind:"skill", … }` members),
290
+ * like {@link builtinTools}. Each becomes a model-visible tool whose call
291
+ * returns the skill's `SKILL.md` body; the bundle is eagerly staged to
292
+ * `/workspace/skills/<name>/`.
293
+ */
294
+ readonly skillTools?: readonly SkillToolRef[];
287
295
  readonly agentsMd: readonly AgentsMdRef[];
288
296
  readonly files: readonly FileRef[];
289
297
  readonly mcpServers: readonly McpServerRef[];
@@ -311,9 +319,9 @@ export interface PlatformSubmission {
311
319
  * - omitted / `true` (default): inject the standard builtins.
312
320
  * - `false`: inject NO builtins — useful for a pure-MCP / pure-custom run.
313
321
  *
314
- * Cherry-pick individual builtins (e.g. opt the notebook in, or pick a narrow
315
- * subset alongside `includeBuiltinTools: false`) by listing their names in
316
- * `tools` (a bare-string builtin reference, prefer `BuiltinTools.<name>`).
322
+ * Pick a narrow subset alongside `includeBuiltinTools: false` by listing
323
+ * builtin names in `tools` (a bare-string builtin reference; prefer
324
+ * `BuiltinTools.<name>`).
317
325
  */
318
326
  readonly includeBuiltinTools?: boolean;
319
327
  /**
@@ -524,12 +532,12 @@ export declare const DEFAULT_OUTPUT_MODE: OutputMode;
524
532
  * Order mirrors `HANDS_TOOLS`. A builtin tool reference (a bare string in
525
533
  * `submission.tools`) must be a member of this set.
526
534
  */
527
- export declare const BUILTIN_TOOL_NAMES: readonly ["bash", "read_file", "write_file", "edit_file", "grep", "glob", "head", "tail", "todo_write", "subagent", "subagent_result", "web_fetch", "web_search", "notebook_edit", "bash_output", "bash_kill", "code_execution", "wait", "git"];
535
+ export declare const BUILTIN_TOOL_NAMES: readonly ["bash", "read_file", "write_file", "edit_file", "grep", "glob", "head", "tail", "todo_write", "subagent", "subagent_result", "web_fetch", "web_search", "bash_output", "bash_kill", "code_execution", "wait", "git"];
528
536
  export type BuiltinToolName = (typeof BUILTIN_TOOL_NAMES)[number];
529
537
  /**
530
538
  * Typo-safe accessors for the closed builtin tool set: each key maps to the
531
539
  * real tool NAME string. Reference a builtin in `submission.tools` via
532
- * `BuiltinTools.notebook_edit` rather than the bare string so a rename is a
540
+ * `BuiltinTools.web_search` rather than the bare string so a rename is a
533
541
  * compile error, not a runtime 400.
534
542
  *
535
543
  * Keys are the real tool names; a unit test asserts `Object.values(BuiltinTools)`
@@ -549,7 +557,6 @@ export declare const BuiltinTools: {
549
557
  readonly subagent_result: "subagent_result";
550
558
  readonly web_fetch: "web_fetch";
551
559
  readonly web_search: "web_search";
552
- readonly notebook_edit: "notebook_edit";
553
560
  readonly bash_output: "bash_output";
554
561
  readonly bash_kill: "bash_kill";
555
562
  readonly code_execution: "code_execution";
@@ -557,11 +564,8 @@ export declare const BuiltinTools: {
557
564
  readonly git: "git";
558
565
  };
559
566
  /**
560
- * The default builtin tool set injected when `includeBuiltinTools !== false`:
561
- * every builtin tool EXCEPT `notebook_edit` (notebook editing stays opt-in —
562
- * add `BuiltinTools.notebook_edit` to `tools` to enable it). Derived by
563
- * filtering {@link BUILTIN_TOOL_NAMES} so it can never drift from the closed
564
- * set.
567
+ * The default builtin tool set injected when `includeBuiltinTools !== false`.
568
+ * It is the complete closed builtin set.
565
569
  */
566
570
  export declare const DEFAULT_BUILTIN_TOOLS: readonly BuiltinToolName[];
567
571
  /**
@@ -570,8 +574,8 @@ export declare const DEFAULT_BUILTIN_TOOLS: readonly BuiltinToolName[];
570
574
  *
571
575
  * - `includeBuiltinTools !== false` ⇒ start from {@link DEFAULT_BUILTIN_TOOLS}
572
576
  * (the standard set); `false` ⇒ start from none (pure-MCP / pure-custom).
573
- * - union in every builtin-name string the caller listed in `tools` (a
574
- * cherry-pick, e.g. `BuiltinTools.notebook_edit` to opt the notebook in).
577
+ * - union in every builtin-name string the caller listed in `tools` (used to
578
+ * cherry-pick a narrow subset when `includeBuiltinTools` is false).
575
579
  *
576
580
  * Every `toolRefs` string MUST be a member of {@link BUILTIN_TOOL_NAMES}; the
577
581
  * union is validated ⊆ the closed set so an invalid name can never leak through.
@@ -4,7 +4,7 @@ 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 { TOOL_NAME_PATTERN, normaliseSkillBundlePath, parseAssetRefFields, parseMcpServerRef, parseSkillRef } from "./run-config.js";
7
+ import { TOOL_NAME_PATTERN, normaliseSkillBundlePath, parseAssetRefFields, parseMcpServerRef } from "./run-config.js";
8
8
  import { parseRunTimeout, parseRuntimeSize } from "./runtime-sizes.js";
9
9
  import { assertRunModelMatchesProvider, parseRunModel } from "./models.js";
10
10
  import { parseRuntimeSecurityProfile } from "./runtime-security-profile.js";
@@ -1175,7 +1175,6 @@ export function parseSubmission(input) {
1175
1175
  "model",
1176
1176
  "system",
1177
1177
  "prompt",
1178
- "skills",
1179
1178
  "tools",
1180
1179
  "agentsMd",
1181
1180
  "files",
@@ -1197,8 +1196,7 @@ export function parseSubmission(input) {
1197
1196
  const model = parseRunModel(value.model, "submission.model");
1198
1197
  const system = optionalString(value.system, "submission.system");
1199
1198
  const prompt = parsePrompt(value.prompt);
1200
- const skills = parseSkills(value.skills);
1201
- const { tools, builtinTools } = parseTools(value.tools);
1199
+ const { tools, skillTools, builtinTools } = parseTools(value.tools);
1202
1200
  const agentsMd = parseAgentsMd(value.agentsMd);
1203
1201
  const files = parseFiles(value.files);
1204
1202
  const mcpServers = parseMcpServers(value.mcpServers);
@@ -1214,8 +1212,8 @@ export function parseSubmission(input) {
1214
1212
  model,
1215
1213
  ...(system ? { system } : {}),
1216
1214
  prompt,
1217
- skills,
1218
1215
  tools,
1216
+ ...(skillTools.length > 0 ? { skillTools } : {}),
1219
1217
  agentsMd,
1220
1218
  files,
1221
1219
  mcpServers,
@@ -1313,7 +1311,6 @@ export const BUILTIN_TOOL_NAMES = [
1313
1311
  "subagent_result",
1314
1312
  "web_fetch",
1315
1313
  "web_search",
1316
- "notebook_edit",
1317
1314
  "bash_output",
1318
1315
  "bash_kill",
1319
1316
  "code_execution",
@@ -1323,7 +1320,7 @@ export const BUILTIN_TOOL_NAMES = [
1323
1320
  /**
1324
1321
  * Typo-safe accessors for the closed builtin tool set: each key maps to the
1325
1322
  * real tool NAME string. Reference a builtin in `submission.tools` via
1326
- * `BuiltinTools.notebook_edit` rather than the bare string so a rename is a
1323
+ * `BuiltinTools.web_search` rather than the bare string so a rename is a
1327
1324
  * compile error, not a runtime 400.
1328
1325
  *
1329
1326
  * Keys are the real tool names; a unit test asserts `Object.values(BuiltinTools)`
@@ -1343,7 +1340,6 @@ export const BuiltinTools = {
1343
1340
  subagent_result: "subagent_result",
1344
1341
  web_fetch: "web_fetch",
1345
1342
  web_search: "web_search",
1346
- notebook_edit: "notebook_edit",
1347
1343
  bash_output: "bash_output",
1348
1344
  bash_kill: "bash_kill",
1349
1345
  code_execution: "code_execution",
@@ -1351,21 +1347,18 @@ export const BuiltinTools = {
1351
1347
  git: "git"
1352
1348
  };
1353
1349
  /**
1354
- * The default builtin tool set injected when `includeBuiltinTools !== false`:
1355
- * every builtin tool EXCEPT `notebook_edit` (notebook editing stays opt-in —
1356
- * add `BuiltinTools.notebook_edit` to `tools` to enable it). Derived by
1357
- * filtering {@link BUILTIN_TOOL_NAMES} so it can never drift from the closed
1358
- * set.
1350
+ * The default builtin tool set injected when `includeBuiltinTools !== false`.
1351
+ * It is the complete closed builtin set.
1359
1352
  */
1360
- export const DEFAULT_BUILTIN_TOOLS = BUILTIN_TOOL_NAMES.filter((name) => name !== "notebook_edit");
1353
+ export const DEFAULT_BUILTIN_TOOLS = BUILTIN_TOOL_NAMES;
1361
1354
  /**
1362
1355
  * Resolve the set of builtin tool NAMES a submission injects, deduplicated and
1363
1356
  * in {@link BUILTIN_TOOL_NAMES} order.
1364
1357
  *
1365
1358
  * - `includeBuiltinTools !== false` ⇒ start from {@link DEFAULT_BUILTIN_TOOLS}
1366
1359
  * (the standard set); `false` ⇒ start from none (pure-MCP / pure-custom).
1367
- * - union in every builtin-name string the caller listed in `tools` (a
1368
- * cherry-pick, e.g. `BuiltinTools.notebook_edit` to opt the notebook in).
1360
+ * - union in every builtin-name string the caller listed in `tools` (used to
1361
+ * cherry-pick a narrow subset when `includeBuiltinTools` is false).
1369
1362
  *
1370
1363
  * Every `toolRefs` string MUST be a member of {@link BUILTIN_TOOL_NAMES}; the
1371
1364
  * union is validated ⊆ the closed set so an invalid name can never leak through.
@@ -1588,33 +1581,21 @@ function parsePrompt(input) {
1588
1581
  }
1589
1582
  return parts;
1590
1583
  }
1591
- function parseSkills(input) {
1592
- if (input === undefined) {
1593
- return [];
1594
- }
1595
- if (!Array.isArray(input)) {
1596
- throw new Error("submission.skills must be an array of SkillRef objects");
1597
- }
1598
- const seenAssetId = new Set();
1599
- return input.map((item, index) => {
1600
- const ref = parseSkillRef(item, `submission.skills[${index}]`);
1601
- if (seenAssetId.has(ref.assetId)) {
1602
- throw new Error(`submission.skills duplicate assetId: ${ref.assetId}`);
1603
- }
1604
- seenAssetId.add(ref.assetId);
1605
- return ref;
1606
- });
1607
- }
1608
1584
  /**
1609
- * Parse the `submission.tools` union: each entry is either a BARE STRING (a
1610
- * builtin tool reference, validated against {@link BUILTIN_TOOL_NAMES}) or a
1611
- * custom tool bundle OBJECT ({@link ToolRef}). Returns the two groups split:
1612
- * `tools` (custom bundles, the existing downstream shape) and `builtinTools`
1613
- * (the deduped builtin-name references, in {@link BUILTIN_TOOL_NAMES} order).
1585
+ * Parse the `submission.tools` union: each entry is one of THREE shapes
1586
+ * (a) a BARE STRING: a builtin tool reference (validated against
1587
+ * {@link BUILTIN_TOOL_NAMES}).
1588
+ * (b) `{ kind:"asset", }`: a custom tool bundle ({@link ToolRef}).
1589
+ * (c) `{ kind:"skill", assetId, name, description }`: a skill re-expressed as
1590
+ * a synthetic no-arg load-tool ({@link SkillToolRef}).
1591
+ * Returns the three groups split: `tools` (custom bundles), `skillTools`
1592
+ * (skill-tools), and `builtinTools` (the deduped builtin-name references, in
1593
+ * {@link BUILTIN_TOOL_NAMES} order). Tool `name`s and `assetId`s are deduped
1594
+ * across ALL object kinds so a name/asset names at most one tool.
1614
1595
  */
1615
1596
  function parseTools(input) {
1616
1597
  if (input === undefined) {
1617
- return { tools: [], builtinTools: [] };
1598
+ return { tools: [], skillTools: [], builtinTools: [] };
1618
1599
  }
1619
1600
  if (!Array.isArray(input)) {
1620
1601
  throw new Error("submission.tools must be an array of builtin tool names or ToolRef objects");
@@ -1623,9 +1604,10 @@ function parseTools(input) {
1623
1604
  const seenAssetIds = new Set();
1624
1605
  const seenBuiltins = new Set();
1625
1606
  const tools = [];
1607
+ const skillTools = [];
1626
1608
  input.forEach((item, index) => {
1627
1609
  const path = `submission.tools[${index}]`;
1628
- // A bare string is a builtin tool reference (e.g. BuiltinTools.notebook_edit).
1610
+ // A bare string is a builtin tool reference (e.g. BuiltinTools.web_search).
1629
1611
  if (typeof item === "string") {
1630
1612
  if (!BUILTIN_TOOL_NAMES.includes(item)) {
1631
1613
  throw new Error(`${path} (${JSON.stringify(item)}) is not a builtin tool name; ` +
@@ -1635,6 +1617,42 @@ function parseTools(input) {
1635
1617
  return;
1636
1618
  }
1637
1619
  const raw = requireRecord(item, path);
1620
+ // A skill-tool is a synthetic no-arg load-tool: { kind:"skill", assetId,
1621
+ // name, description }. Its call returns the skill's SKILL.md body; it carries
1622
+ // no input_schema / entry (unlike a custom ToolRef).
1623
+ if (raw.kind === "skill") {
1624
+ for (const key of Object.keys(raw)) {
1625
+ if (key !== "kind" && key !== "assetId" && key !== "name" && key !== "description") {
1626
+ throw new Error(`${path}.${key} is not an allowed field for a skill tool; permitted: kind, assetId, name, description`);
1627
+ }
1628
+ }
1629
+ const skillFields = parseAssetRefFields({ kind: "asset", assetId: raw.assetId, name: raw.name }, path);
1630
+ if (!TOOL_NAME_PATTERN.test(skillFields.name)) {
1631
+ throw new Error(`${path}.name must match ${TOOL_NAME_PATTERN.source}`);
1632
+ }
1633
+ if (skillFields.name.includes("__")) {
1634
+ throw new Error(`${path}.name must not contain "__"; that separator is reserved for MCP tools`);
1635
+ }
1636
+ if (seenNames.has(skillFields.name)) {
1637
+ throw new Error(`submission.tools duplicate name: ${skillFields.name}`);
1638
+ }
1639
+ seenNames.add(skillFields.name);
1640
+ if (seenAssetIds.has(skillFields.assetId)) {
1641
+ throw new Error(`submission.tools duplicate assetId: ${skillFields.assetId}`);
1642
+ }
1643
+ seenAssetIds.add(skillFields.assetId);
1644
+ const skillDescription = requireString(raw.description, `${path}.description`);
1645
+ if (skillDescription.trim().length === 0 || skillDescription.length > 2048) {
1646
+ throw new Error(`${path}.description must be non-empty and <= 2048 chars`);
1647
+ }
1648
+ skillTools.push({
1649
+ kind: "skill",
1650
+ assetId: skillFields.assetId,
1651
+ name: skillFields.name,
1652
+ description: skillDescription
1653
+ });
1654
+ return;
1655
+ }
1638
1656
  for (const key of Object.keys(raw)) {
1639
1657
  if (key !== "kind" &&
1640
1658
  key !== "assetId" &&
@@ -1646,7 +1664,7 @@ function parseTools(input) {
1646
1664
  }
1647
1665
  }
1648
1666
  if (raw.kind !== "asset") {
1649
- throw new Error(`${path}.kind must be 'asset' (got ${JSON.stringify(raw.kind)})`);
1667
+ throw new Error(`${path}.kind must be 'asset' or 'skill' (got ${JSON.stringify(raw.kind)})`);
1650
1668
  }
1651
1669
  const fields = parseAssetRefFields({ kind: raw.kind, assetId: raw.assetId, name: raw.name }, path);
1652
1670
  if (!TOOL_NAME_PATTERN.test(fields.name)) {
@@ -1685,7 +1703,7 @@ function parseTools(input) {
1685
1703
  });
1686
1704
  });
1687
1705
  const builtinTools = BUILTIN_TOOL_NAMES.filter((name) => seenBuiltins.has(name));
1688
- return { tools, builtinTools };
1706
+ return { tools, skillTools, builtinTools };
1689
1707
  }
1690
1708
  function parseAgentsMd(input) {
1691
1709
  if (input === undefined)
@@ -5,17 +5,17 @@ import type { AgentsMdRef } from "./_contracts/index.js";
5
5
  * behaviour).
6
6
  *
7
7
  * const rules = await AgentsMd.fromContent("# Be helpful", { name: "rules" });
8
- * await client.submit({ agentsMd: [rules], ... });
8
+ * await client.run({ agentsMd: [rules], message: "..." });
9
9
  *
10
- * `client.submit` materializes the bytes to the hosted asset store before
11
- * the run lands. Asset deduplication handles repeated uploads automatically.
10
+ * `client.run` / `openSession` materializes the bytes to the hosted asset store
11
+ * before the run lands. Asset deduplication handles repeated uploads automatically.
12
12
  */
13
13
  export declare class AgentsMd {
14
14
  #private;
15
15
  constructor(ref: AgentsMdRef | DraftAgentsMdRef, zipBytes?: Uint8Array);
16
16
  get ref(): AgentsMdRef | DraftAgentsMdRef;
17
17
  get isDraft(): boolean;
18
- /** Internal: the asset id resolved on a prior submit, or undefined. */
18
+ /** Internal: the asset id resolved on a prior use, or undefined. */
19
19
  get _cachedAssetId(): string | undefined;
20
20
  /** Internal: remember the asset id resolved for this draft's bytes. */
21
21
  _rememberAsset(assetId: string): void;
@@ -33,7 +33,7 @@ export declare class AgentsMd {
33
33
  }): Promise<AgentsMd>;
34
34
  /**
35
35
  * Internal: yield the draft's zipped bytes + metadata so
36
- * `client.submit` can upload it as an asset.
36
+ * `client.run` / `openSession` can upload it as an asset.
37
37
  */
38
38
  _takeDraftBundle(): {
39
39
  name: string;
package/dist/agents-md.js CHANGED
@@ -7,15 +7,15 @@ import { strToU8, zipSync } from "fflate";
7
7
  * behaviour).
8
8
  *
9
9
  * const rules = await AgentsMd.fromContent("# Be helpful", { name: "rules" });
10
- * await client.submit({ agentsMd: [rules], ... });
10
+ * await client.run({ agentsMd: [rules], message: "..." });
11
11
  *
12
- * `client.submit` materializes the bytes to the hosted asset store before
13
- * the run lands. Asset deduplication handles repeated uploads automatically.
12
+ * `client.run` / `openSession` materializes the bytes to the hosted asset store
13
+ * before the run lands. Asset deduplication handles repeated uploads automatically.
14
14
  */
15
15
  export class AgentsMd {
16
16
  #ref;
17
17
  #zipBytes;
18
- /** Asset id cached after the first submit, so reuse skips a re-upload. */
18
+ /** Asset id cached after the first use, so reuse skips a re-upload. */
19
19
  #assetId;
20
20
  constructor(ref, zipBytes) {
21
21
  this.#ref = ref;
@@ -27,7 +27,7 @@ export class AgentsMd {
27
27
  get isDraft() {
28
28
  return this.#ref.kind === "draft";
29
29
  }
30
- /** Internal: the asset id resolved on a prior submit, or undefined. */
30
+ /** Internal: the asset id resolved on a prior use, or undefined. */
31
31
  get _cachedAssetId() {
32
32
  return this.#assetId;
33
33
  }
@@ -59,7 +59,7 @@ export class AgentsMd {
59
59
  }
60
60
  /**
61
61
  * Internal: yield the draft's zipped bytes + metadata so
62
- * `client.submit` can upload it as an asset.
62
+ * `client.run` / `openSession` can upload it as an asset.
63
63
  */
64
64
  _takeDraftBundle() {
65
65
  if (this.#ref.kind !== "draft" || !this.#zipBytes) {
@@ -74,7 +74,7 @@ export class AgentsMd {
74
74
  toJSON() {
75
75
  if (this.#ref.kind === "draft") {
76
76
  throw new Error("AgentsMd: draft AgentsMd cannot be JSON-serialised — it only becomes a wire " +
77
- "ref when client.submit uploads the bytes as an asset.");
77
+ "ref when aex.run / openSession uploads the bytes as an asset.");
78
78
  }
79
79
  return this.#ref;
80
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../src/agents-md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,OAAO,QAAQ;IACV,IAAI,CAAiC;IACrC,SAAS,CAAyB;IAC3C,0EAA0E;IAC1E,QAAQ,CAAqB;IAE7B,YAAY,GAAmC,EAAE,QAAqB;QACpE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC;IACpC,CAAC;IAED,uEAAuE;IACvE,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,uEAAuE;IACvE,cAAc,CAAC,OAAe;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,IAA+B;QACvE,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC9E,CAAC;QACD,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,E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IAED,MAAM;QACJ,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CACb,8EAA8E;gBAC5E,+DAA+D,CAClE,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAQD,MAAM,iBAAiB,GAAG,mCAAmC,CAAC;AAC9D,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC"}
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Asset materialization for the SDK submit path.
2
+ * Asset materialization for the SDK run / session path.
3
3
  *
4
- * Every inline `Skill` / `AgentsMd` / `File` draft is materialized to the
5
- * hosted API's content-addressable asset store before the submit round-trip,
6
- * so the wire submission carries only storage-neutral `kind:"asset"` refs.
4
+ * Every inline skill-tool / `Tool` / `AgentsMd` / `File` draft is materialized
5
+ * to the hosted API's content-addressable asset store before the session
6
+ * starts, so the wire submission carries only storage-neutral refs.
7
7
  *
8
8
  * Upload is direct-to-storage (no bytes through the hosted API, so bundle size
9
9
  * is bounded by the object store rather than by the API's memory /
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Asset materialization for the SDK submit path.
2
+ * Asset materialization for the SDK run / session path.
3
3
  *
4
- * Every inline `Skill` / `AgentsMd` / `File` draft is materialized to the
5
- * hosted API's content-addressable asset store before the submit round-trip,
6
- * so the wire submission carries only storage-neutral `kind:"asset"` refs.
4
+ * Every inline skill-tool / `Tool` / `AgentsMd` / `File` draft is materialized
5
+ * to the hosted API's content-addressable asset store before the session
6
+ * starts, so the wire submission carries only storage-neutral refs.
7
7
  *
8
8
  * Upload is direct-to-storage (no bytes through the hosted API, so bundle size
9
9
  * is bounded by the object store rather than by the API's memory /
package/dist/bundle.d.ts CHANGED
@@ -37,8 +37,8 @@ export interface ToolBundleManifest {
37
37
  export declare function bundleToolFiles(files: SkillFiles, manifest: ToolBundleManifest): BundledTool;
38
38
  /**
39
39
  * Compute `sha256:<hex>` of the given canonicalised zip bytes. Used by
40
- * `Skill.fromFiles` / `Skill.fromPath` to populate the
41
- * `InlineSkillRef.contentHash` field. The hash is advisory — the BFF
40
+ * `Tools.fromSkillDir` / `Tools.fromSkillUrl` to populate the draft
41
+ * skill-tool's `contentHash` field. The hash is advisory — the BFF
42
42
  * recomputes server-side after re-canonicalising the zip; a mismatch is
43
43
  * rejected. Web-Crypto-only so the SDK works in Bun, Node, edge runtimes,
44
44
  * and browsers without polyfills.
package/dist/bundle.js CHANGED
@@ -107,8 +107,8 @@ export function bundleToolFiles(files, manifest) {
107
107
  const ZIP_EPOCH = new Date(Date.UTC(1980, 0, 1));
108
108
  /**
109
109
  * Compute `sha256:<hex>` of the given canonicalised zip bytes. Used by
110
- * `Skill.fromFiles` / `Skill.fromPath` to populate the
111
- * `InlineSkillRef.contentHash` field. The hash is advisory — the BFF
110
+ * `Tools.fromSkillDir` / `Tools.fromSkillUrl` to populate the draft
111
+ * skill-tool's `contentHash` field. The hash is advisory — the BFF
112
112
  * recomputes server-side after re-canonicalising the zip; a mismatch is
113
113
  * rejected. Web-Crypto-only so the SDK works in Bun, Node, edge runtimes,
114
114
  * and browsers without polyfills.