@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
@@ -0,0 +1,102 @@
1
+ import { type FetchLike, type SkillToolRef } from "./_contracts/index.js";
2
+ import { type SkillFiles } from "./bundle.js";
3
+ /**
4
+ * A skill re-expressed as a TOOL. `Tools.fromSkillDir` / `Tools.fromSkillUrl`
5
+ * read a skill folder/zip, lift the tool `name` + `description` from the
6
+ * `SKILL.md` YAML frontmatter, and canonically bundle+hash the bytes. The
7
+ * result rides in the session's `tools` array (next to builtin names and custom
8
+ * {@link Tool} bundles); `client.run` / `openSession` uploads the bundle as an
9
+ * asset before the run lands, and the wire ref becomes a
10
+ * `{ kind:"skill", assetId, name, description }` {@link SkillToolRef}.
11
+ *
12
+ * At run time the model calls the no-arg load-tool to pull the skill's
13
+ * `SKILL.md` body into context; the bundle's files are eagerly staged to
14
+ * `/workspace/skills/<name>/`.
15
+ *
16
+ * Asset deduplication makes the same bytes a no-op upload on subsequent runs.
17
+ * A URL is an ingestion source, not a persistent reference.
18
+ */
19
+ export declare class SkillTool {
20
+ #private;
21
+ /** Internal constructor. Use the `Tools.fromSkill*` factories. */
22
+ private constructor();
23
+ /**
24
+ * The wire-level reference. Returns the SDK-private draft shape for
25
+ * un-uploaded skill-tools (kind:"draft", with name + description +
26
+ * contentHash). `client.run` / `openSession` walks these and uploads them
27
+ * before the run lands.
28
+ */
29
+ get ref(): SkillToolRef | DraftSkillToolRef;
30
+ /** True for local-bytes skill-tools that haven't been uploaded yet. */
31
+ get isDraft(): boolean;
32
+ /** Internal: the asset id resolved on a prior use, or undefined. */
33
+ get _cachedAssetId(): string | undefined;
34
+ /** Internal: remember the asset id resolved for this draft's bytes. */
35
+ _rememberAsset(assetId: string): void;
36
+ /** Internal: build a draft from an already-loaded skill files map. */
37
+ static _fromFiles(source: string, files: SkillFiles, nameOverride: string | undefined): Promise<SkillTool>;
38
+ /**
39
+ * Internal: yield the draft's bytes + metadata so `client.run` / `openSession`
40
+ * can upload the asset. Idempotent (non-consuming): a SkillTool is reusable
41
+ * across sessions — the first use caches the resolved asset id (see
42
+ * `_rememberAsset`) so later uses reuse it instead of re-uploading.
43
+ *
44
+ * Returns undefined for already-uploaded skill-tools.
45
+ */
46
+ _takeDraftBundle(): {
47
+ name: string;
48
+ description: string;
49
+ contentHash: string;
50
+ bytes: Uint8Array;
51
+ } | undefined;
52
+ toJSON(): SkillToolRef;
53
+ }
54
+ /**
55
+ * SDK-internal draft skill-tool marker. Never reaches the wire; the
56
+ * materialize step inside `client.run` / `openSession` converts these to
57
+ * `kind:"skill"` refs once the bundle is uploaded.
58
+ */
59
+ export interface DraftSkillToolRef {
60
+ readonly kind: "draft";
61
+ readonly name: string;
62
+ readonly description: string;
63
+ readonly contentHash: string;
64
+ }
65
+ /**
66
+ * Factory namespace for skill-tools. Each factory reads a skill bundle, lifts
67
+ * `name` + `description` from the `SKILL.md` frontmatter (an explicit `name`
68
+ * argument overrides the frontmatter), and produces a {@link SkillTool} to pass
69
+ * in the session's `tools` array.
70
+ */
71
+ export declare const Tools: {
72
+ /**
73
+ * Read a local skill directory and build a skill-tool. The directory must
74
+ * contain `SKILL.md` at its root, whose YAML frontmatter provides the tool
75
+ * `name` (unless overridden via `args.name`) and `description`. Symlinks and
76
+ * non-regular files are skipped. Bun/Node filesystem runtimes only.
77
+ */
78
+ readonly fromSkillDir: (rootDir: string, args?: {
79
+ readonly name?: string;
80
+ }) => Promise<SkillTool>;
81
+ /**
82
+ * Fetch a zip-archived skill from a URL and build a skill-tool. The archive is
83
+ * downloaded in the SDK process, so the URL is caller-controlled — host the
84
+ * skill yourself and pass a temporary signed URL (e.g. an S3 presigned URL).
85
+ * Its bytes are optionally integrity-checked against `sha256`, unzipped, and
86
+ * reduced to the same files map as `Tools.fromSkillDir`, so a URL-sourced
87
+ * skill and the identical local skill produce the same canonical asset and
88
+ * dedup against each other.
89
+ *
90
+ * The archive must contain `SKILL.md` at its root, or inside a single
91
+ * top-level folder (which is stripped). The signed URL only needs to be valid
92
+ * for this call; `client.run` / `openSession` snapshots the bytes into the run.
93
+ *
94
+ * Universal (Bun / Node 18+ / browser): requires a global `fetch`, or pass one.
95
+ */
96
+ readonly fromSkillUrl: (url: string, args?: {
97
+ readonly name?: string;
98
+ readonly sha256?: string;
99
+ readonly timeoutMs?: number;
100
+ readonly fetch?: FetchLike;
101
+ }) => Promise<SkillTool>;
102
+ };
@@ -0,0 +1,190 @@
1
+ import { TOOL_NAME_PATTERN } from "./_contracts/index.js";
2
+ import { bundleSkillFiles, hashSkillBundle } from "./bundle.js";
3
+ import { fetchSkillArchive } from "./fetch-archive.js";
4
+ import { readDirectoryAsFiles } from "./node-fs.js";
5
+ /**
6
+ * A skill re-expressed as a TOOL. `Tools.fromSkillDir` / `Tools.fromSkillUrl`
7
+ * read a skill folder/zip, lift the tool `name` + `description` from the
8
+ * `SKILL.md` YAML frontmatter, and canonically bundle+hash the bytes. The
9
+ * result rides in the session's `tools` array (next to builtin names and custom
10
+ * {@link Tool} bundles); `client.run` / `openSession` uploads the bundle as an
11
+ * asset before the run lands, and the wire ref becomes a
12
+ * `{ kind:"skill", assetId, name, description }` {@link SkillToolRef}.
13
+ *
14
+ * At run time the model calls the no-arg load-tool to pull the skill's
15
+ * `SKILL.md` body into context; the bundle's files are eagerly staged to
16
+ * `/workspace/skills/<name>/`.
17
+ *
18
+ * Asset deduplication makes the same bytes a no-op upload on subsequent runs.
19
+ * A URL is an ingestion source, not a persistent reference.
20
+ */
21
+ export class SkillTool {
22
+ #ref;
23
+ #inlineBytes;
24
+ /** Asset id cached after the first use, so reuse skips a re-upload. */
25
+ #assetId;
26
+ /** Internal constructor. Use the `Tools.fromSkill*` factories. */
27
+ constructor(ref, inlineBytes) {
28
+ this.#ref = ref;
29
+ this.#inlineBytes = inlineBytes;
30
+ }
31
+ /**
32
+ * The wire-level reference. Returns the SDK-private draft shape for
33
+ * un-uploaded skill-tools (kind:"draft", with name + description +
34
+ * contentHash). `client.run` / `openSession` walks these and uploads them
35
+ * before the run lands.
36
+ */
37
+ get ref() {
38
+ return this.#ref;
39
+ }
40
+ /** True for local-bytes skill-tools that haven't been uploaded yet. */
41
+ get isDraft() {
42
+ return this.#ref.kind === "draft";
43
+ }
44
+ /** Internal: the asset id resolved on a prior use, or undefined. */
45
+ get _cachedAssetId() {
46
+ return this.#assetId;
47
+ }
48
+ /** Internal: remember the asset id resolved for this draft's bytes. */
49
+ _rememberAsset(assetId) {
50
+ this.#assetId = assetId;
51
+ }
52
+ /** Internal: build a draft from an already-loaded skill files map. */
53
+ static async _fromFiles(source, files, nameOverride) {
54
+ const front = extractSkillFrontmatter(source, files);
55
+ const name = nameOverride ?? front.name;
56
+ if (typeof name !== "string" || name.length === 0) {
57
+ throw new Error(`${source}: a skill name is required — pass { name } or add a \`name:\` field to the SKILL.md YAML frontmatter`);
58
+ }
59
+ if (!TOOL_NAME_PATTERN.test(name)) {
60
+ throw new Error(`${source}: name must match ${TOOL_NAME_PATTERN.source}`);
61
+ }
62
+ if (name.includes("__")) {
63
+ throw new Error(`${source}: name must not contain "__"; that separator is reserved for MCP tools`);
64
+ }
65
+ const description = front.description;
66
+ if (typeof description !== "string" || description.trim().length === 0) {
67
+ throw new Error(`${source}: a skill description is required — add a \`description:\` field to the SKILL.md YAML frontmatter`);
68
+ }
69
+ if (description.length > 2048) {
70
+ throw new Error(`${source}: description must be <= 2048 chars`);
71
+ }
72
+ const bundled = bundleSkillFiles(files);
73
+ const contentHash = await hashSkillBundle(bundled.zip);
74
+ const ref = { kind: "draft", name, description, contentHash };
75
+ return new SkillTool(ref, bundled.zip);
76
+ }
77
+ /**
78
+ * Internal: yield the draft's bytes + metadata so `client.run` / `openSession`
79
+ * can upload the asset. Idempotent (non-consuming): a SkillTool is reusable
80
+ * across sessions — the first use caches the resolved asset id (see
81
+ * `_rememberAsset`) so later uses reuse it instead of re-uploading.
82
+ *
83
+ * Returns undefined for already-uploaded skill-tools.
84
+ */
85
+ _takeDraftBundle() {
86
+ if (this.#ref.kind !== "draft" || !this.#inlineBytes) {
87
+ return undefined;
88
+ }
89
+ return {
90
+ name: this.#ref.name,
91
+ description: this.#ref.description,
92
+ contentHash: this.#ref.contentHash,
93
+ bytes: this.#inlineBytes
94
+ };
95
+ }
96
+ toJSON() {
97
+ if (this.#ref.kind === "draft") {
98
+ throw new Error("SkillTool: draft skill-tools cannot be JSON-serialised — they only become wire refs when " +
99
+ "aex.run / openSession uploads the bytes as an asset.");
100
+ }
101
+ return this.#ref;
102
+ }
103
+ }
104
+ /**
105
+ * Factory namespace for skill-tools. Each factory reads a skill bundle, lifts
106
+ * `name` + `description` from the `SKILL.md` frontmatter (an explicit `name`
107
+ * argument overrides the frontmatter), and produces a {@link SkillTool} to pass
108
+ * in the session's `tools` array.
109
+ */
110
+ export const Tools = {
111
+ /**
112
+ * Read a local skill directory and build a skill-tool. The directory must
113
+ * contain `SKILL.md` at its root, whose YAML frontmatter provides the tool
114
+ * `name` (unless overridden via `args.name`) and `description`. Symlinks and
115
+ * non-regular files are skipped. Bun/Node filesystem runtimes only.
116
+ */
117
+ async fromSkillDir(rootDir, args = {}) {
118
+ const files = await readDirectoryAsFiles(rootDir);
119
+ return SkillTool._fromFiles("Tools.fromSkillDir", files, args.name);
120
+ },
121
+ /**
122
+ * Fetch a zip-archived skill from a URL and build a skill-tool. The archive is
123
+ * downloaded in the SDK process, so the URL is caller-controlled — host the
124
+ * skill yourself and pass a temporary signed URL (e.g. an S3 presigned URL).
125
+ * Its bytes are optionally integrity-checked against `sha256`, unzipped, and
126
+ * reduced to the same files map as `Tools.fromSkillDir`, so a URL-sourced
127
+ * skill and the identical local skill produce the same canonical asset and
128
+ * dedup against each other.
129
+ *
130
+ * The archive must contain `SKILL.md` at its root, or inside a single
131
+ * top-level folder (which is stripped). The signed URL only needs to be valid
132
+ * for this call; `client.run` / `openSession` snapshots the bytes into the run.
133
+ *
134
+ * Universal (Bun / Node 18+ / browser): requires a global `fetch`, or pass one.
135
+ */
136
+ async fromSkillUrl(url, args = {}) {
137
+ const files = await fetchSkillArchive(url, {
138
+ ...(args.sha256 !== undefined ? { sha256: args.sha256 } : {}),
139
+ ...(args.timeoutMs !== undefined ? { timeoutMs: args.timeoutMs } : {}),
140
+ ...(args.fetch !== undefined ? { fetch: args.fetch } : {})
141
+ });
142
+ return SkillTool._fromFiles("Tools.fromSkillUrl", files, args.name);
143
+ }
144
+ };
145
+ /**
146
+ * Read `SKILL.md` from a bundle files map and parse its YAML frontmatter for
147
+ * the `name` + `description` fields. Throws when the bundle has no root
148
+ * `SKILL.md` (that is what makes a bundle a skill).
149
+ */
150
+ function extractSkillFrontmatter(source, files) {
151
+ const raw = files["SKILL.md"];
152
+ if (raw === undefined) {
153
+ throw new Error(`${source}: the skill bundle must contain a SKILL.md at its root`);
154
+ }
155
+ const text = typeof raw === "string" ? raw : new TextDecoder().decode(raw);
156
+ return parseSkillFrontmatter(text);
157
+ }
158
+ /**
159
+ * Minimal YAML-frontmatter reader: pulls the `name` and `description` scalar
160
+ * values out of the leading `--- … ---` block. Only simple single-line
161
+ * `key: value` entries are supported (surrounding single/double quotes are
162
+ * stripped); anything else is ignored. A skill with no frontmatter yields an
163
+ * empty result and the caller reports the missing field.
164
+ */
165
+ function parseSkillFrontmatter(text) {
166
+ const src = text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;
167
+ const match = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(src);
168
+ if (!match) {
169
+ return {};
170
+ }
171
+ const out = {};
172
+ for (const line of match[1].split(/\r?\n/)) {
173
+ const kv = /^([A-Za-z0-9_-]+)[ \t]*:[ \t]*(.*)$/.exec(line);
174
+ if (!kv)
175
+ continue;
176
+ const key = kv[1].toLowerCase();
177
+ if (key !== "name" && key !== "description")
178
+ continue;
179
+ let value = kv[2].trim();
180
+ if (value.length >= 2 &&
181
+ ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'")))) {
182
+ value = value.slice(1, -1);
183
+ }
184
+ if (value.length > 0) {
185
+ out[key] = value;
186
+ }
187
+ }
188
+ return out;
189
+ }
190
+ //# sourceMappingURL=skill-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-tool.js","sourceRoot":"","sources":["../src/skill-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAGlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAmB,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;;;;;;;;;;;GAeG;AAC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KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAClG,CAAC;YACD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/tool.d.ts CHANGED
@@ -12,7 +12,7 @@ export declare class Tool {
12
12
  private constructor();
13
13
  get ref(): ToolRef | DraftToolRef;
14
14
  get isDraft(): boolean;
15
- /** Internal: the asset id resolved on a prior submit, or undefined. */
15
+ /** Internal: the asset id resolved on a prior use, or undefined. */
16
16
  get _cachedAssetId(): string | undefined;
17
17
  /** Internal: remember the asset id resolved for this draft's bytes. */
18
18
  _rememberAsset(assetId: string): void;
package/dist/tool.js CHANGED
@@ -4,7 +4,7 @@ import { readDirectoryAsFiles } from "./node-fs.js";
4
4
  export class Tool {
5
5
  #ref;
6
6
  #inlineBytes;
7
- /** Asset id cached after the first submit, so reuse skips a re-upload. */
7
+ /** Asset id cached after the first use, so reuse skips a re-upload. */
8
8
  #assetId;
9
9
  constructor(ref, inlineBytes) {
10
10
  this.#ref = ref;
@@ -16,7 +16,7 @@ export class Tool {
16
16
  get isDraft() {
17
17
  return this.#ref.kind === "draft";
18
18
  }
19
- /** Internal: the asset id resolved on a prior submit, or undefined. */
19
+ /** Internal: the asset id resolved on a prior use, or undefined. */
20
20
  get _cachedAssetId() {
21
21
  return this.#assetId;
22
22
  }
@@ -90,7 +90,7 @@ export class Tool {
90
90
  }
91
91
  toJSON() {
92
92
  if (this.#ref.kind === "draft") {
93
- throw new Error("Tool: draft Tools cannot be JSON-serialised — they only become wire refs when client.submit uploads the bytes as an asset.");
93
+ throw new Error("Tool: draft Tools cannot be JSON-serialised — they only become wire refs when aex.run / openSession uploads the bytes as an asset.");
94
94
  }
95
95
  return this.#ref;
96
96
  }
package/dist/tool.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EAIzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,eAAe,EACf,eAAe,EAGhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAUpD,MAAM,OAAO,IAAI;IACN,IAAI,CAAyB;IAC7B,YAAY,CAAyB;IAC9C,0EAA0E;IAC1E,QAAQ,CAAqB;IAE7B,YAAoB,GAA2B,EAAE,WAAwB;QACvE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,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,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAwD;QAC7E,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,CAAC;QACD,MAAM,QAAQ,GAAG,qBAAqB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACtD,MAAM,WAAW,GAA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CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACzF,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,mCAAmC,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC;AAC9D,CAAC"}
package/dist/version.d.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * Used by the (future) User-Agent header on outbound SDK requests.
8
8
  */
9
- export declare const SDK_VERSION = "0.33.0";
9
+ export declare const SDK_VERSION = "0.34.0";
package/dist/version.js CHANGED
@@ -6,5 +6,5 @@
6
6
  *
7
7
  * Used by the (future) User-Agent header on outbound SDK requests.
8
8
  */
9
- export const SDK_VERSION = "0.33.0";
9
+ export const SDK_VERSION = "0.34.0";
10
10
  //# sourceMappingURL=version.js.map
package/docs/cleanup.md CHANGED
@@ -17,10 +17,10 @@ retention field is rejected if supplied.
17
17
  ```ts
18
18
  import { Models } from "@aexhq/sdk";
19
19
 
20
- const runId = await aex.submit({
20
+ await aex.run({
21
21
  model: Models.CLAUDE_HAIKU_4_5,
22
- prompt: "...",
23
- secrets: { apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! } }
22
+ message: "...",
23
+ apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! }
24
24
  });
25
25
  ```
26
26
 
@@ -4,9 +4,7 @@ description: The default builtin tools available inside managed runs.
4
4
  icon: TerminalSquare
5
5
  ---
6
6
 
7
- Managed runs inject a DX-first set of builtin tools to the agent by default. The
8
- default set is every builtin tool EXCEPT `notebook_edit` (notebook editing is
9
- opt-in). It includes:
7
+ Managed runs inject the complete builtin tool set into the agent by default:
10
8
 
11
9
  - `bash`, `code_execution` — run shell commands / model-written snippets
12
10
  - `read_file`, `write_file`, `edit_file` — file read/create/patch
@@ -28,29 +26,12 @@ or pure-custom run where every tool comes from `mcpServers` or `tools`.
28
26
  ## Cherry-picking builtins
29
27
 
30
28
  The `tools` list accepts both custom tool bundles and BUILTIN tool references
31
- (bare name strings, preferably `BuiltinTools.<name>`). Use a builtin reference
32
- to add a tool the default set omits (notebook editing), or to pick a narrow
33
- subset alongside `includeBuiltinTools: false`.
29
+ (bare name strings, preferably `BuiltinTools.<name>`). Use builtin references
30
+ to pick a narrow subset alongside `includeBuiltinTools: false`.
34
31
 
35
32
  The final tool list is ordered: resolved builtin tools, then custom tools, then
36
33
  MCP tools.
37
34
 
38
- ## Optional notebook support
39
-
40
- `notebook_edit` edits Jupyter `.ipynb` cells as JSON. It is NOT in the default
41
- builtin set; add it via `tools`:
42
-
43
- ```ts
44
- import { BuiltinTools, Models } from "@aexhq/sdk";
45
-
46
- await aex.submit({
47
- model: Models.CLAUDE_HAIKU_4_5,
48
- prompt: "Edit the analysis notebook.",
49
- tools: [BuiltinTools.notebook_edit],
50
- secrets: { apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! } }
51
- });
52
- ```
53
-
54
35
  Networking is open by default: the agent may reach any public host, subject to a
55
36
  fixed SSRF deny-list. `web_fetch` and `web_search` reach the network over a
56
37
  managed, SSRF-guarded path that is **not** governed by `environment.networking`,
@@ -64,11 +45,11 @@ See [Networking](../networking.md).
64
45
  ```ts
65
46
  import { Models } from "@aexhq/sdk";
66
47
 
67
- await aex.submit({
48
+ await aex.run({
68
49
  model: Models.CLAUDE_HAIKU_4_5,
69
- prompt: "Use only the declared MCP tools.",
50
+ message: "Use only the declared MCP tools.",
70
51
  mcpServers,
71
52
  includeBuiltinTools: false,
72
- secrets: { apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! } }
53
+ apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! }
73
54
  });
74
55
  ```
@@ -4,40 +4,43 @@ description: The primitives used to assemble each run.
4
4
  icon: Blocks
5
5
  ---
6
6
 
7
- aex composes an agent from explicit per-run inputs. The SDK materializes local
8
- bytes before submission and the platform mounts them into the managed runtime
9
- before the first agent turn.
7
+ aex composes an agent from explicit per-session inputs. The SDK materializes local
8
+ bytes before the session lands and the platform mounts them into the managed
9
+ runtime before the first agent turn.
10
10
 
11
11
  | Need | Primitive |
12
12
  | --- | --- |
13
- | Executable or instructional bundles | `Skill.fromPath`, `Skill.fromFiles`, `Skill.fromUrl`, `Skill.fromCatalog` |
13
+ | Executable or instructional skill bundles (load-tools) | `Tools.fromSkillDir`, `Tools.fromSkillUrl` |
14
14
  | Agent instructions | `AgentsMd.fromPath`, `AgentsMd.fromContent` |
15
15
  | Reference files and folders | `File.fromPath`, `File.fromBytes` |
16
16
  | Remote tools | `McpServer.remote`, `McpServer.fromId` |
17
17
  | Credentialed HTTP APIs | `ProxyEndpoint.none`, `bearer`, `basic`, `header`, `query` |
18
- | Non-secret runtime settings | `environment.envVars`, `environment.packages`, `environment.networking` |
18
+ | Non-secret runtime settings | `environment.variables`, `environment.packages`, `environment.networking` |
19
19
 
20
20
  ```ts
21
- import { AgentsMd, File, McpServer, Models, ProxyEndpoint, Skill } from "@aexhq/sdk";
21
+ import { AgentsMd, File, McpServer, Models, ProxyEndpoint, Tools } from "@aexhq/sdk";
22
22
 
23
- await aex.submit({
23
+ await aex.run({
24
24
  model: Models.CLAUDE_HAIKU_4_5,
25
- prompt: "Use the attached docs and tools to produce a report.",
25
+ message: "Use the attached docs and tools to produce a report.",
26
26
  agentsMd: [AgentsMd.fromContent("Follow the repo conventions.")],
27
27
  files: [await File.fromPath("./input")],
28
- skills: [await Skill.fromPath("./skills/report-writer", { name: "report-writer" })],
28
+ tools: [await Tools.fromSkillDir("./skills/report-writer", { name: "report-writer" })],
29
29
  mcpServers: [McpServer.remote({ name: "github", url: "https://example.com/mcp" })],
30
30
  proxyEndpoints: [
31
31
  ProxyEndpoint.bearer({
32
32
  name: "internal-api",
33
33
  baseUrl: "https://api.example.com",
34
+ token: process.env.INTERNAL_API_TOKEN!,
34
35
  allowMethods: ["GET"],
35
36
  allowPathPrefixes: ["/v1/"]
36
37
  })
37
38
  ],
38
- secrets: { apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! } }
39
+ apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! }
39
40
  });
40
41
  ```
41
42
 
42
- Secrets stay out of reusable configs. Put provider keys, MCP auth, and proxy
43
- auth in the `secrets` bundle on the concrete submit call.
43
+ Secrets stay out of reusable configs. Provider keys go in the top-level `apiKeys`
44
+ map; MCP auth rides on each `McpServer` instance and proxy auth on each
45
+ `ProxyEndpoint` instance — the SDK splits them into the vaulted secrets channel
46
+ server-side, so they never live in a shareable config object.
@@ -26,11 +26,11 @@ All submissions run on the managed runtime. There is no public runtime selector;
26
26
  ```ts
27
27
  import { Models, Providers } from "@aexhq/sdk";
28
28
 
29
- await aex.submit({
29
+ await aex.run({
30
30
  provider: Providers.OPENAI,
31
31
  model: Models.GPT_4_1,
32
- prompt: "Summarise the attached files.",
33
- secrets: { apiKeys: { openai: process.env.OPENAI_API_KEY! } }
32
+ message: "Summarise the attached files.",
33
+ apiKeys: { openai: process.env.OPENAI_API_KEY! }
34
34
  });
35
35
  ```
36
36
 
@@ -4,40 +4,45 @@ description: The durable unit aex submits, observes, and archives.
4
4
  icon: Play
5
5
  ---
6
6
 
7
- A run is an immutable request to execute an autonomous agent task. The caller
8
- submits the model, prompt, optional system message, composition primitives,
9
- output policy, and one inline secrets bundle. aex snapshots the non-secret
10
- inputs, holds secrets for the run lifecycle, dispatches through the managed
11
- runtime, and records status, typed events, and outputs.
7
+ A run is a durable, resumable **session**: the model, system message, composition
8
+ primitives, output policy, and per-provider keys you open it with, plus every
9
+ turn you send to it. aex snapshots the non-secret inputs, holds secrets for the
10
+ session lifecycle, dispatches each turn through the managed runtime, and records
11
+ status, typed events, and outputs. Sessions are the low-level API; `run()` is the
12
+ one-shot convenience wrapper over them.
12
13
 
13
14
  ```ts
14
- import { AgentExecutor, Models } from "@aexhq/sdk";
15
+ import { Aex, Models } from "@aexhq/sdk";
15
16
 
16
- const aex = new AgentExecutor({ apiToken: process.env.AEX_API_TOKEN! });
17
+ const aex = new Aex({ apiToken: process.env.AEX_API_TOKEN! });
17
18
 
18
- const runId = await aex.submit({
19
+ const session = await aex.openSession({
19
20
  provider: "anthropic",
20
21
  model: Models.CLAUDE_HAIKU_4_5,
21
- prompt: "Write the report and save it as a file.",
22
- secrets: { apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! } }
22
+ apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! }
23
23
  });
24
24
 
25
- for await (const event of aex.stream(runId)) {
25
+ const turn = session.send("Write the report and save it as a file.");
26
+ for await (const event of turn) {
26
27
  console.log(event.type);
27
28
  }
29
+ await turn.done();
28
30
 
29
- await aex.wait(runId);
30
- await aex.download(runId, { to: "./run.zip" });
31
+ await session.wait();
32
+ await session.download({ to: "./session.zip" });
31
33
  ```
32
34
 
33
- The same durable record backs SDK and CLI reads. Use `getRun`/`get`, `events`,
34
- `stream`, `streamEnvelopes`, `wait`, `outputs`, and `download` to inspect the
35
- run live or after completion.
35
+ The same durable record backs SDK and CLI reads. From the handle use `refresh`,
36
+ `unit`, `wait`, and `download` for lifecycle, plus the grouped read accessors —
37
+ `messages()`, `events()`, and `outputs()` (each with `list()`/`last()`/`first()`,
38
+ and `events().stream()` / `events().streamEnvelopes()` / `outputs().read(...)` for
39
+ streaming and byte-capped reads) — to inspect the session live or after it parks;
40
+ from the client, `aex.sessions.list()` / `aex.sessions.get(id)` read across the
41
+ workspace.
36
42
 
37
- Use `idempotencyKey` when retrying a submit from your own workflow. aex hashes
38
- the normalized non-secret submission, so a retry with the same key and same body
39
- returns the existing run while a mismatched body fails with an idempotency
40
- conflict.
43
+ Use `idempotencyKey` when retrying `openSession` or `send` from your own
44
+ workflow. aex hashes the normalized non-secret submission, so a retry with the
45
+ same key and same body returns the existing session while a mismatched body fails
46
+ with an idempotency conflict.
41
47
 
42
- aex selects product placement server-side. There is no submit-time region
43
- selector.
48
+ aex selects product placement server-side. There is no region selector.