@aexhq/sdk 0.35.0 → 0.37.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 (72) hide show
  1. package/README.md +17 -16
  2. package/dist/_contracts/event-envelope.d.ts +22 -1
  3. package/dist/_contracts/event-envelope.js +26 -2
  4. package/dist/_contracts/event-stream-client.js +7 -1
  5. package/dist/_contracts/index.d.ts +3 -4
  6. package/dist/_contracts/index.js +1 -4
  7. package/dist/_contracts/operations.d.ts +31 -1
  8. package/dist/_contracts/operations.js +64 -1
  9. package/dist/_contracts/run-config.d.ts +2 -4
  10. package/dist/_contracts/run-config.js +2 -7
  11. package/dist/_contracts/run-trace.d.ts +0 -86
  12. package/dist/_contracts/run-trace.js +1 -184
  13. package/dist/_contracts/run-unit.d.ts +14 -25
  14. package/dist/_contracts/run-unit.js +56 -2
  15. package/dist/_contracts/runtime-manifest.d.ts +1 -1
  16. package/dist/_contracts/runtime-security-profile.d.ts +0 -2
  17. package/dist/_contracts/runtime-security-profile.js +0 -9
  18. package/dist/_contracts/runtime-sizes.d.ts +2 -2
  19. package/dist/_contracts/runtime-sizes.js +5 -5
  20. package/dist/_contracts/runtime-types.d.ts +123 -4
  21. package/dist/_contracts/stable.d.ts +1 -1
  22. package/dist/_contracts/stable.js +1 -1
  23. package/dist/_contracts/submission.d.ts +8 -76
  24. package/dist/_contracts/submission.js +5 -472
  25. package/dist/cli.mjs +574 -511
  26. package/dist/cli.mjs.sha256 +1 -1
  27. package/dist/client.d.ts +69 -25
  28. package/dist/client.js +338 -68
  29. package/dist/client.js.map +1 -1
  30. package/dist/index.d.ts +8 -16
  31. package/dist/index.js +5 -17
  32. package/dist/index.js.map +1 -1
  33. package/dist/secret.d.ts +2 -2
  34. package/dist/secret.js +1 -1
  35. package/dist/version.d.ts +1 -1
  36. package/dist/version.js +1 -1
  37. package/docs/authentication.md +92 -0
  38. package/docs/billing.md +112 -0
  39. package/docs/concepts/agent-tools.md +4 -4
  40. package/docs/concepts/composition.md +8 -14
  41. package/docs/concepts/providers-and-runtimes.md +4 -1
  42. package/docs/concepts/runs.md +2 -1
  43. package/docs/concepts/subagents.md +85 -0
  44. package/docs/credentials.md +78 -96
  45. package/docs/defaults.md +9 -15
  46. package/docs/errors.md +132 -0
  47. package/docs/events.md +44 -32
  48. package/docs/limits-and-quotas.md +30 -17
  49. package/docs/limits.md +4 -8
  50. package/docs/mcp.md +5 -6
  51. package/docs/networking.md +75 -59
  52. package/docs/outputs.md +4 -7
  53. package/docs/public-surface.json +4 -4
  54. package/docs/quickstart.md +12 -13
  55. package/docs/run-config.md +7 -4
  56. package/docs/secrets.md +6 -1
  57. package/docs/skills.md +3 -3
  58. package/docs/vision-skills.md +52 -101
  59. package/docs/webhooks.md +132 -0
  60. package/examples/feature-tour.ts +4 -21
  61. package/package.json +1 -1
  62. package/dist/_contracts/proxy-protocol.d.ts +0 -305
  63. package/dist/_contracts/proxy-protocol.js +0 -297
  64. package/dist/_contracts/proxy-validation.d.ts +0 -19
  65. package/dist/_contracts/proxy-validation.js +0 -51
  66. package/dist/data-tools.d.ts +0 -82
  67. package/dist/data-tools.js +0 -251
  68. package/dist/data-tools.js.map +0 -1
  69. package/dist/proxy-endpoint.d.ts +0 -131
  70. package/dist/proxy-endpoint.js +0 -144
  71. package/dist/proxy-endpoint.js.map +0 -1
  72. package/examples/chat-corpus.ts +0 -84
@@ -1,84 +0,0 @@
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.
7
- *
8
- * Run (Bun): ANTHROPIC_API_KEY=… AEX_API_TOKEN=… bun examples/chat-corpus.ts <sessionId> [sessionId…]
9
- *
10
- * The model answers ONLY from the named runs' outputs (read via the corpus
11
- * tools); a run outside the corpus is refused by the tool layer.
12
- */
13
- import Anthropic from "@anthropic-ai/sdk";
14
- import { AgentExecutor, createCorpusTools, DataToolError } from "@aexhq/sdk";
15
-
16
- const sessionIds = process.argv.slice(2);
17
- if (sessionIds.length === 0) {
18
- console.error("usage: bun examples/chat-corpus.ts <sessionId> [sessionId…]");
19
- process.exit(2);
20
- }
21
-
22
- const aex = new AgentExecutor({
23
- apiToken: process.env.AEX_API_TOKEN!,
24
- ...(process.env.AEX_API_URL ? { baseUrl: process.env.AEX_API_URL } : {})
25
- });
26
- const tools = createCorpusTools(aex, { sessionIds });
27
- const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY! });
28
-
29
- const SYSTEM =
30
- "You answer questions about a fixed set of aex agent runs using the provided tools. " +
31
- tools.instructions;
32
-
33
- // Anthropic wire-shape tool defs: { name, description, input_schema }. The corpus
34
- // tool defs are already in that exact shape. Put one cache_control breakpoint on
35
- // the LAST tool so the (deterministic) tool list + system prefix cache together.
36
- const wireTools = tools.tools.map((t, i) => ({
37
- name: t.name,
38
- description: t.description,
39
- input_schema: t.input_schema,
40
- ...(i === tools.tools.length - 1 ? { cache_control: { type: "ephemeral" as const } } : {})
41
- }));
42
-
43
- const messages: Anthropic.MessageParam[] = [
44
- {
45
- role: "user",
46
- content: "Across these runs, what did they produce and what are the headline findings?"
47
- }
48
- ];
49
-
50
- for (let turn = 0; turn < 12; turn++) {
51
- const stream = anthropic.messages.stream({
52
- model: process.env.AEX_CHAT_MODEL ?? "claude-opus-4-8",
53
- max_tokens: 8192,
54
- thinking: { type: "adaptive" },
55
- system: [{ type: "text", text: SYSTEM }],
56
- tools: wireTools,
57
- messages
58
- });
59
- stream.on("text", (delta) => process.stdout.write(delta));
60
- const response = await stream.finalMessage();
61
- messages.push({ role: "assistant", content: response.content });
62
-
63
- if (response.stop_reason === "refusal") {
64
- console.error("\n[refused]", response.stop_details?.category ?? "");
65
- break;
66
- }
67
- if (response.stop_reason === "end_turn" || response.stop_reason === "max_tokens") break;
68
- if (response.stop_reason === "pause_turn") continue;
69
- if (response.stop_reason !== "tool_use") break;
70
-
71
- const toolResults: Anthropic.ToolResultBlockParam[] = [];
72
- for (const block of response.content) {
73
- if (block.type !== "tool_use") continue;
74
- try {
75
- const result = await tools.execute(block.name, block.input as Record<string, unknown>);
76
- toolResults.push({ type: "tool_result", tool_use_id: block.id, content: JSON.stringify(result) });
77
- } catch (err) {
78
- const message = err instanceof DataToolError ? err.message : String(err);
79
- toolResults.push({ type: "tool_result", tool_use_id: block.id, content: message, is_error: true });
80
- }
81
- }
82
- messages.push({ role: "user", content: toolResults });
83
- }
84
- console.log();