aui-agent-builder 0.3.149 → 0.3.151

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 (52) hide show
  1. package/README.md +60 -15
  2. package/dist/commands/agents.d.ts.map +1 -1
  3. package/dist/commands/agents.js +47 -2
  4. package/dist/commands/agents.js.map +1 -1
  5. package/dist/commands/apollo.d.ts.map +1 -1
  6. package/dist/commands/apollo.js +73 -5
  7. package/dist/commands/apollo.js.map +1 -1
  8. package/dist/commands/import-agent.js +1 -1
  9. package/dist/commands/import-agent.js.map +1 -1
  10. package/dist/commands/index.d.ts +1 -0
  11. package/dist/commands/index.d.ts.map +1 -1
  12. package/dist/commands/index.js +1 -0
  13. package/dist/commands/index.js.map +1 -1
  14. package/dist/commands/init.d.ts.map +1 -1
  15. package/dist/commands/init.js +18 -6
  16. package/dist/commands/init.js.map +1 -1
  17. package/dist/commands/push.d.ts.map +1 -1
  18. package/dist/commands/push.js +9 -84
  19. package/dist/commands/push.js.map +1 -1
  20. package/dist/commands/report.d.ts +119 -0
  21. package/dist/commands/report.d.ts.map +1 -0
  22. package/dist/commands/report.js +169 -0
  23. package/dist/commands/report.js.map +1 -0
  24. package/dist/commands/util/agent-resolve.d.ts +102 -0
  25. package/dist/commands/util/agent-resolve.d.ts.map +1 -0
  26. package/dist/commands/util/agent-resolve.js +148 -0
  27. package/dist/commands/util/agent-resolve.js.map +1 -0
  28. package/dist/commands/version.d.ts.map +1 -1
  29. package/dist/commands/version.js +61 -108
  30. package/dist/commands/version.js.map +1 -1
  31. package/dist/errors/index.d.ts.map +1 -1
  32. package/dist/errors/index.js +50 -2
  33. package/dist/errors/index.js.map +1 -1
  34. package/dist/index.js +28 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/services/pull-schema.service.d.ts +19 -0
  37. package/dist/services/pull-schema.service.d.ts.map +1 -1
  38. package/dist/services/pull-schema.service.js +83 -0
  39. package/dist/services/pull-schema.service.js.map +1 -1
  40. package/dist/utils/agent-injection.d.ts +32 -0
  41. package/dist/utils/agent-injection.d.ts.map +1 -0
  42. package/dist/utils/agent-injection.js +52 -0
  43. package/dist/utils/agent-injection.js.map +1 -0
  44. package/dist/utils/json-output.d.ts +10 -0
  45. package/dist/utils/json-output.d.ts.map +1 -1
  46. package/dist/utils/json-output.js +14 -0
  47. package/dist/utils/json-output.js.map +1 -1
  48. package/dist/utils/payload-store.d.ts +40 -0
  49. package/dist/utils/payload-store.d.ts.map +1 -0
  50. package/dist/utils/payload-store.js +82 -0
  51. package/dist/utils/payload-store.js.map +1 -0
  52. package/package.json +1 -1
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Payload store — offload very large runtime payloads to disk.
3
+ *
4
+ * Coding agents (Claude Code, agent-builder-bff, …) call `aui` non-interactively
5
+ * and read the JSON it prints into their context window. Some runtime payloads —
6
+ * notably `aui apollo trace` and a `send-message`/`rerun` response with
7
+ * `trace_info` attached — are huge (tens to hundreds of KB) and blow up that
8
+ * context window, making the agent slow or unable to use the result.
9
+ *
10
+ * Instead of inlining those payloads, we write the full object to a `metadata/`
11
+ * folder inside the relevant agent project and return a small pointer telling
12
+ * the caller where to read it (with grep / cat / their editor). The folder is
13
+ * created on demand — no setup required.
14
+ */
15
+ import * as fs from "fs";
16
+ import * as path from "path";
17
+ /**
18
+ * Serialized-JSON byte size at/under which a payload is small enough to inline
19
+ * directly in the command's JSON output. Larger payloads are written to disk.
20
+ * Override with `AUI_PAYLOAD_INLINE_MAX_BYTES` (e.g. `0` to always offload).
21
+ */
22
+ const DEFAULT_INLINE_MAX_BYTES = 10_000;
23
+ /** Resolve the inline-size ceiling, honoring the env override when valid. */
24
+ export function inlineMaxBytes() {
25
+ const raw = process.env.AUI_PAYLOAD_INLINE_MAX_BYTES;
26
+ if (raw !== undefined) {
27
+ const n = Number(raw);
28
+ if (Number.isFinite(n) && n >= 0)
29
+ return n;
30
+ }
31
+ return DEFAULT_INLINE_MAX_BYTES;
32
+ }
33
+ /** Byte length of a payload once serialized to JSON. */
34
+ export function serializedBytes(payload) {
35
+ return Buffer.byteLength(JSON.stringify(payload) ?? "", "utf8");
36
+ }
37
+ /** Slugify an arbitrary string into a filesystem-safe file-name base. */
38
+ function safeBaseName(input) {
39
+ return (input
40
+ .toLowerCase()
41
+ .replace(/[\/\\:*?"<>|]/g, "-")
42
+ .replace(/\s+/g, "-")
43
+ .replace(/-+/g, "-")
44
+ .replace(/^-|-$/g, "") || "payload");
45
+ }
46
+ /**
47
+ * Persist a (potentially huge) payload to the `metadata/` folder inside the
48
+ * relevant agent project so it never has to travel through a coding agent's
49
+ * context window. Creates the folder if it doesn't exist.
50
+ *
51
+ * @param projectRoot The agent project root (`.auirc` dir). Falls back to the
52
+ * current working directory when undefined.
53
+ * @param baseName A descriptive base for the file name (e.g. `trace-<taskId>`).
54
+ * @param payload The complete object to write (serialized as pretty JSON).
55
+ */
56
+ export function savePayloadToMetadata(projectRoot, baseName, payload) {
57
+ const root = projectRoot || process.cwd();
58
+ const dir = path.join(root, "metadata");
59
+ fs.mkdirSync(dir, { recursive: true });
60
+ // Colons are illegal in file names on some platforms, so flatten the ISO
61
+ // timestamp. This keeps each saved payload distinct and chronologically
62
+ // sortable without clobbering earlier ones.
63
+ const stamp = new Date().toISOString().replace(/[:.]/g, "-");
64
+ const fileName = `${safeBaseName(baseName)}-${stamp}.json`;
65
+ const abs = path.join(dir, fileName);
66
+ const serialized = JSON.stringify(payload, null, 2);
67
+ fs.writeFileSync(abs, serialized + "\n", "utf8");
68
+ return {
69
+ path: abs,
70
+ relativePath: path.relative(process.cwd(), abs) || fileName,
71
+ bytes: Buffer.byteLength(serialized, "utf8"),
72
+ };
73
+ }
74
+ /** Human-readable byte size (e.g. "42.7 KB"). */
75
+ export function formatBytes(bytes) {
76
+ if (bytes < 1024)
77
+ return `${bytes} B`;
78
+ if (bytes < 1024 * 1024)
79
+ return `${(bytes / 1024).toFixed(1)} KB`;
80
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
81
+ }
82
+ //# sourceMappingURL=payload-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload-store.js","sourceRoot":"","sources":["../../src/utils/payload-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAExC,6EAA6E;AAC7E,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;IACrD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACtB,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,wBAAwB,CAAC;AAClC,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;AAClE,CAAC;AAWD,yEAAyE;AACzE,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,CACL,KAAK;SACF,WAAW,EAAE;SACb,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;SAC9B,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,SAAS,CACtC,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAA+B,EAC/B,QAAgB,EAChB,OAAgB;IAEhB,MAAM,IAAI,GAAG,WAAW,IAAI,OA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C,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACpD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aui-agent-builder",
3
- "version": "0.3.149",
3
+ "version": "0.3.151",
4
4
  "description": "CLI for building, managing, and deploying AUI AI agent configurations",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",