@aexhq/sdk 0.29.0 → 0.31.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 (90) hide show
  1. package/README.md +95 -8
  2. package/dist/_contracts/connection-ticket.d.ts +1 -1
  3. package/dist/_contracts/connection-ticket.js +1 -1
  4. package/dist/_contracts/event-envelope.d.ts +5 -8
  5. package/dist/_contracts/event-envelope.js +5 -6
  6. package/dist/_contracts/event-guards.d.ts +67 -0
  7. package/dist/_contracts/event-guards.js +36 -0
  8. package/dist/_contracts/event-stream-client.d.ts +1 -1
  9. package/dist/_contracts/http.js +1 -1
  10. package/dist/_contracts/index.d.ts +2 -0
  11. package/dist/_contracts/index.js +6 -0
  12. package/dist/_contracts/operations.d.ts +2 -47
  13. package/dist/_contracts/operations.js +7 -112
  14. package/dist/_contracts/provider-support.d.ts +48 -138
  15. package/dist/_contracts/provider-support.js +10 -41
  16. package/dist/_contracts/proxy-protocol.d.ts +7 -7
  17. package/dist/_contracts/proxy-protocol.js +8 -8
  18. package/dist/_contracts/run-config.d.ts +7 -20
  19. package/dist/_contracts/run-config.js +8 -46
  20. package/dist/_contracts/run-cost.d.ts +1 -5
  21. package/dist/_contracts/run-cost.js +0 -8
  22. package/dist/_contracts/run-custody.d.ts +4 -6
  23. package/dist/_contracts/run-custody.js +0 -8
  24. package/dist/_contracts/run-trace.d.ts +7 -0
  25. package/dist/_contracts/run-trace.js +9 -0
  26. package/dist/_contracts/run-unit.d.ts +1 -1
  27. package/dist/_contracts/run-unit.js +2 -2
  28. package/dist/_contracts/runner-event.d.ts +1 -1
  29. package/dist/_contracts/runner-event.js +1 -1
  30. package/dist/_contracts/runtime-manifest.d.ts +13 -26
  31. package/dist/_contracts/runtime-manifest.js +6 -35
  32. package/dist/_contracts/runtime-types.d.ts +32 -1
  33. package/dist/_contracts/sdk-secrets.js +4 -4
  34. package/dist/_contracts/side-effect-audit.d.ts +2 -4
  35. package/dist/_contracts/side-effect-audit.js +2 -4
  36. package/dist/_contracts/status.d.ts +1 -1
  37. package/dist/_contracts/status.js +1 -1
  38. package/dist/_contracts/submission.d.ts +19 -126
  39. package/dist/_contracts/submission.js +31 -185
  40. package/dist/_contracts/webhook-verify.d.ts +1 -1
  41. package/dist/_contracts/webhook-verify.js +1 -1
  42. package/dist/agents-md.d.ts +4 -1
  43. package/dist/agents-md.js +10 -9
  44. package/dist/agents-md.js.map +1 -1
  45. package/dist/asset-upload.d.ts +4 -10
  46. package/dist/asset-upload.js +4 -47
  47. package/dist/asset-upload.js.map +1 -1
  48. package/dist/cli.mjs +17647 -3950
  49. package/dist/cli.mjs.sha256 +1 -1
  50. package/dist/client.d.ts +79 -61
  51. package/dist/client.js +207 -125
  52. package/dist/client.js.map +1 -1
  53. package/dist/data-tools.d.ts +23 -0
  54. package/dist/data-tools.js +102 -13
  55. package/dist/data-tools.js.map +1 -1
  56. package/dist/file.d.ts +4 -1
  57. package/dist/file.js +10 -9
  58. package/dist/file.js.map +1 -1
  59. package/dist/index.d.ts +9 -8
  60. package/dist/index.js +10 -8
  61. package/dist/index.js.map +1 -1
  62. package/dist/skill.d.ts +9 -7
  63. package/dist/skill.js +15 -15
  64. package/dist/skill.js.map +1 -1
  65. package/dist/tool.d.ts +4 -1
  66. package/dist/tool.js +10 -8
  67. package/dist/tool.js.map +1 -1
  68. package/dist/version.d.ts +1 -1
  69. package/dist/version.js +1 -1
  70. package/docs/cleanup.md +2 -2
  71. package/docs/concepts/agent-tools.md +9 -5
  72. package/docs/concepts/composition.md +1 -1
  73. package/docs/concepts/providers-and-runtimes.md +2 -4
  74. package/docs/concepts/runs.md +3 -6
  75. package/docs/credentials.md +2 -5
  76. package/docs/defaults.md +22 -22
  77. package/docs/events.md +32 -9
  78. package/docs/limits-and-quotas.md +40 -40
  79. package/docs/limits.md +1 -1
  80. package/docs/networking.md +141 -0
  81. package/docs/outputs.md +1 -1
  82. package/docs/provider-runtime-capabilities.md +36 -64
  83. package/docs/public-surface.json +2 -3
  84. package/docs/quickstart.md +32 -11
  85. package/docs/run-config.md +3 -4
  86. package/docs/secrets.md +7 -5
  87. package/docs/skills.md +4 -12
  88. package/docs/vision-skills.md +1 -1
  89. package/examples/chat-corpus.ts +85 -0
  90. package/package.json +2 -2
package/docs/secrets.md CHANGED
@@ -8,20 +8,22 @@ aex supports BYOK provider keys, per-run credentials, and reusable workspace
8
8
  secrets. Secret values are excluded from the idempotency fingerprint and do not
9
9
  belong in run config.
10
10
 
11
+ Runnable examples need both `AEX_API_TOKEN` for aex and the matching BYOK
12
+ provider key, such as `ANTHROPIC_API_KEY` for Claude.
13
+
11
14
  ## Use A Provider Key For One Run
12
15
 
13
16
  ### TypeScript
14
17
 
15
18
  ```ts
16
- import { AgentExecutor, Models, Providers } from "@aexhq/sdk";
19
+ import { AgentExecutor, Models } from "@aexhq/sdk";
17
20
 
18
21
  const aex = new AgentExecutor({ apiToken: process.env.AEX_API_TOKEN! });
19
22
 
20
23
  await aex.submit({
21
- provider: Providers.ANTHROPIC,
22
24
  model: Models.CLAUDE_HAIKU_4_5,
23
25
  prompt: "Write the report and save outputs.",
24
- secrets: { apiKey: process.env.ANTHROPIC_API_KEY! }
26
+ secrets: { apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! } }
25
27
  });
26
28
  ```
27
29
 
@@ -54,7 +56,7 @@ await aex.submit({
54
56
  model: Models.CLAUDE_HAIKU_4_5,
55
57
  prompt: "Inspect the repository issues.",
56
58
  secretEnv: { GITHUB_TOKEN: githubToken },
57
- secrets: { apiKey: process.env.ANTHROPIC_API_KEY! }
59
+ secrets: { apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! } }
58
60
  });
59
61
  ```
60
62
 
@@ -109,7 +111,7 @@ await aex.submit({
109
111
  secretEnv: {
110
112
  SERPER_API_KEY: Secret.ref("serper-api-key")
111
113
  },
112
- secrets: { apiKey: process.env.ANTHROPIC_API_KEY! }
114
+ secrets: { apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! } }
113
115
  });
114
116
  ```
115
117
 
package/docs/skills.md CHANGED
@@ -24,12 +24,6 @@ All three sources normalize to the same content-addressed asset. Identical bytes
24
24
  dedup by hash, so repeated submissions of the same bundle are no-op uploads.
25
25
  There is no per-run auto-suffixed `skl_*` row for inline skills.
26
26
 
27
- Provider-hosted skill refs (`kind:"provider"`, e.g. Anthropic prebuilt Agent
28
- Skills or custom provider skill IDs) are not supported on the managed runtime.
29
- Every new submission dispatches to managed, so a `kind:"provider"` ref is
30
- rejected at submission time with `feature_runtime_mismatch`. Supply the bytes as
31
- an aex asset instead.
32
-
33
27
  ## Materialization
34
28
 
35
29
  For each run, the platform copies referenced skill assets into durable run asset
@@ -68,7 +62,7 @@ await aex.submit({
68
62
  model: RunModels.CLAUDE_HAIKU_4_5,
69
63
  prompt,
70
64
  skills: [await Skill.fromPath("./skills/rules", { name: "rules" })],
71
- secrets: { apiKey }
65
+ secrets: { apiKeys: { anthropic: apiKey } }
72
66
  });
73
67
  ```
74
68
 
@@ -80,9 +74,7 @@ flow:
80
74
  2. The SDK PUTs bytes directly to object storage with the signed checksum headers.
81
75
  3. `POST /assets/finalize` confirms the object exists.
82
76
 
83
- When direct upload credentials are not configured, small bundles fall back to
84
- the buffered `/assets` upload path. The runner re-verifies the content hash when
85
- it downloads the asset.
77
+ The runner re-verifies the content hash when it downloads the asset.
86
78
 
87
79
  ## Pre-Upload For Reuse
88
80
 
@@ -97,7 +89,7 @@ await aex.submit({
97
89
  model: RunModels.CLAUDE_HAIKU_4_5,
98
90
  prompt,
99
91
  skills: [uploaded],
100
- secrets: { apiKey }
92
+ secrets: { apiKeys: { anthropic: apiKey } }
101
93
  });
102
94
  ```
103
95
 
@@ -134,7 +126,7 @@ await aex.submit({
134
126
  model: RunModels.CLAUDE_HAIKU_4_5,
135
127
  prompt,
136
128
  skills: [Skill.fromCatalog(record)],
137
- secrets: { apiKey }
129
+ secrets: { apiKeys: { anthropic: apiKey } }
138
130
  });
139
131
  ```
140
132
 
@@ -58,7 +58,7 @@ const runId = await aex.submit({
58
58
  skills: [await Skill.fromPath("./vision-skill", { name: "frame-vision-gate" })],
59
59
  proxyEndpoints,
60
60
  secrets: {
61
- apiKey: process.env.ANTHROPIC_API_KEY!,
61
+ apiKeys: { anthropic: process.env.ANTHROPIC_API_KEY! },
62
62
  proxyEndpointAuth
63
63
  }
64
64
  });
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Reference: a read-only, multi-run chat over a CORPUS of aex runs.
3
+ *
4
+ * Combines the public `@aexhq/sdk` corpus read-tools (`createCorpusTools`) with a
5
+ * direct Claude chat loop (`@anthropic-ai/sdk`). The importable `@aexhq/sdk` stays
6
+ * LLM-vendor-free; the vendor dependency lives only here in the example (and in
7
+ * the bundled `aex chat` CLI command).
8
+ *
9
+ * Run (Bun): ANTHROPIC_API_KEY=… AEX_TOKEN=… bun examples/chat-corpus.ts <runId> [runId…]
10
+ *
11
+ * The model answers ONLY from the named runs' outputs (read via the corpus
12
+ * tools); a run outside the corpus is refused by the tool layer.
13
+ */
14
+ import Anthropic from "@anthropic-ai/sdk";
15
+ import { AgentExecutor, createCorpusTools, DataToolError } from "@aexhq/sdk";
16
+
17
+ const runIds = process.argv.slice(2);
18
+ if (runIds.length === 0) {
19
+ console.error("usage: bun examples/chat-corpus.ts <runId> [runId…]");
20
+ process.exit(2);
21
+ }
22
+
23
+ const aex = new AgentExecutor({
24
+ apiToken: process.env.AEX_TOKEN!,
25
+ ...(process.env.AEX_URL ? { baseUrl: process.env.AEX_URL } : {})
26
+ });
27
+ const tools = createCorpusTools(aex, { runIds });
28
+ const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY! });
29
+
30
+ const SYSTEM =
31
+ "You answer questions about a fixed set of aex agent runs using the provided tools. " +
32
+ tools.instructions;
33
+
34
+ // Anthropic wire-shape tool defs: { name, description, input_schema }. The corpus
35
+ // tool defs are already in that exact shape. Put one cache_control breakpoint on
36
+ // the LAST tool so the (deterministic) tool list + system prefix cache together.
37
+ const wireTools = tools.tools.map((t, i) => ({
38
+ name: t.name,
39
+ description: t.description,
40
+ input_schema: t.input_schema,
41
+ ...(i === tools.tools.length - 1 ? { cache_control: { type: "ephemeral" as const } } : {})
42
+ }));
43
+
44
+ const messages: Anthropic.MessageParam[] = [
45
+ {
46
+ role: "user",
47
+ content: "Across these runs, what did they produce and what are the headline findings?"
48
+ }
49
+ ];
50
+
51
+ for (let turn = 0; turn < 12; turn++) {
52
+ const stream = anthropic.messages.stream({
53
+ model: process.env.AEX_CHAT_MODEL ?? "claude-opus-4-8",
54
+ max_tokens: 8192,
55
+ thinking: { type: "adaptive" },
56
+ system: [{ type: "text", text: SYSTEM }],
57
+ tools: wireTools,
58
+ messages
59
+ });
60
+ stream.on("text", (delta) => process.stdout.write(delta));
61
+ const response = await stream.finalMessage();
62
+ messages.push({ role: "assistant", content: response.content });
63
+
64
+ if (response.stop_reason === "refusal") {
65
+ console.error("\n[refused]", response.stop_details?.category ?? "");
66
+ break;
67
+ }
68
+ if (response.stop_reason === "end_turn" || response.stop_reason === "max_tokens") break;
69
+ if (response.stop_reason === "pause_turn") continue;
70
+ if (response.stop_reason !== "tool_use") break;
71
+
72
+ const toolResults: Anthropic.ToolResultBlockParam[] = [];
73
+ for (const block of response.content) {
74
+ if (block.type !== "tool_use") continue;
75
+ try {
76
+ const result = await tools.execute(block.name, block.input as Record<string, unknown>);
77
+ toolResults.push({ type: "tool_result", tool_use_id: block.id, content: JSON.stringify(result) });
78
+ } catch (err) {
79
+ const message = err instanceof DataToolError ? err.message : String(err);
80
+ toolResults.push({ type: "tool_result", tool_use_id: block.id, content: message, is_error: true });
81
+ }
82
+ }
83
+ messages.push({ role: "user", content: toolResults });
84
+ }
85
+ console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/sdk",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "description": "TypeScript SDK for running autonomous agent sessions across providers (Anthropic, OpenAI, DeepSeek, Gemini, Mistral) behind one interface.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -41,7 +41,7 @@
41
41
  "pack:dry-run": "bun ../../scripts/with-generated-dist-lock.mjs bun pm pack --dry-run --ignore-scripts"
42
42
  },
43
43
  "devDependencies": {
44
- "@aexhq/contracts": "0.26.0"
44
+ "@aexhq/contracts": "0.31.0"
45
45
  },
46
46
  "engines": {
47
47
  "bun": ">=1.3.14"