aui-agent-builder 0.4.10 → 0.4.12
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.
- package/dist/commands/apollo.d.ts +2 -0
- package/dist/commands/apollo.d.ts.map +1 -1
- package/dist/commands/apollo.js +54 -25
- package/dist/commands/apollo.js.map +1 -1
- package/dist/commands/import-agent.js +1 -1
- package/dist/commands/import-agent.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +17 -7
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.js +4 -4
- package/dist/commands/login.js.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/format-trace-summary.d.ts +20 -0
- package/dist/utils/format-trace-summary.d.ts.map +1 -0
- package/dist/utils/format-trace-summary.js +79 -0
- package/dist/utils/format-trace-summary.js.map +1 -0
- package/dist/utils/trace-store.d.ts +26 -0
- package/dist/utils/trace-store.d.ts.map +1 -0
- package/dist/utils/trace-store.js +54 -0
- package/dist/utils/trace-store.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trace store — persist interaction traces under the agent project.
|
|
3
|
+
*
|
|
4
|
+
* `aui apollo trace` saves each fetched trace to
|
|
5
|
+
* `traces/trace_{sequence}.json` inside the agent folder so callers can
|
|
6
|
+
* inspect the full payload without bloating stdout. Sequence numbers are
|
|
7
|
+
* monotonic per agent folder (1, 2, 3, …).
|
|
8
|
+
*/
|
|
9
|
+
export interface SavedTrace {
|
|
10
|
+
/** Absolute path to the written trace file. */
|
|
11
|
+
path: string;
|
|
12
|
+
/** Path relative to the current working directory, for display. */
|
|
13
|
+
relativePath: string;
|
|
14
|
+
sequence: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function traceFileName(sequence: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Return the next unused numeric sequence for `traces/trace_{sequence}.json`.
|
|
19
|
+
* Scans existing trace files and returns max + 1 (or 1 when empty).
|
|
20
|
+
*/
|
|
21
|
+
export declare function nextTraceSequence(projectRoot: string | undefined): number;
|
|
22
|
+
/**
|
|
23
|
+
* Persist a trace to `traces/trace_{sequence}.json` inside the agent project.
|
|
24
|
+
*/
|
|
25
|
+
export declare function saveTraceToAgentFolder(projectRoot: string | undefined, sequence: number, payload: unknown): SavedTrace;
|
|
26
|
+
//# sourceMappingURL=trace-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-store.d.ts","sourceRoot":"","sources":["../../src/utils/trace-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAID,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAczE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,GACf,UAAU,CAeZ"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trace store — persist interaction traces under the agent project.
|
|
3
|
+
*
|
|
4
|
+
* `aui apollo trace` saves each fetched trace to
|
|
5
|
+
* `traces/trace_{sequence}.json` inside the agent folder so callers can
|
|
6
|
+
* inspect the full payload without bloating stdout. Sequence numbers are
|
|
7
|
+
* monotonic per agent folder (1, 2, 3, …).
|
|
8
|
+
*/
|
|
9
|
+
import * as fs from "fs";
|
|
10
|
+
import * as path from "path";
|
|
11
|
+
const TRACE_FILE_RE = /^trace_(\d+)\.json$/;
|
|
12
|
+
export function traceFileName(sequence) {
|
|
13
|
+
return `trace_${sequence}.json`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Return the next unused numeric sequence for `traces/trace_{sequence}.json`.
|
|
17
|
+
* Scans existing trace files and returns max + 1 (or 1 when empty).
|
|
18
|
+
*/
|
|
19
|
+
export function nextTraceSequence(projectRoot) {
|
|
20
|
+
const root = projectRoot || process.cwd();
|
|
21
|
+
const tracesDir = path.join(root, "traces");
|
|
22
|
+
if (!fs.existsSync(tracesDir))
|
|
23
|
+
return 1;
|
|
24
|
+
let max = 0;
|
|
25
|
+
for (const entry of fs.readdirSync(tracesDir, { withFileTypes: true })) {
|
|
26
|
+
if (!entry.isFile())
|
|
27
|
+
continue;
|
|
28
|
+
const match = entry.name.match(TRACE_FILE_RE);
|
|
29
|
+
if (!match)
|
|
30
|
+
continue;
|
|
31
|
+
const n = Number(match[1]);
|
|
32
|
+
if (Number.isInteger(n) && n > 0 && n > max)
|
|
33
|
+
max = n;
|
|
34
|
+
}
|
|
35
|
+
return max + 1;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Persist a trace to `traces/trace_{sequence}.json` inside the agent project.
|
|
39
|
+
*/
|
|
40
|
+
export function saveTraceToAgentFolder(projectRoot, sequence, payload) {
|
|
41
|
+
const root = projectRoot || process.cwd();
|
|
42
|
+
const tracesDir = path.join(root, "traces");
|
|
43
|
+
fs.mkdirSync(tracesDir, { recursive: true });
|
|
44
|
+
const fileName = traceFileName(sequence);
|
|
45
|
+
const abs = path.join(tracesDir, fileName);
|
|
46
|
+
const serialized = JSON.stringify(payload, null, 2);
|
|
47
|
+
fs.writeFileSync(abs, serialized + "\n", "utf8");
|
|
48
|
+
return {
|
|
49
|
+
path: abs,
|
|
50
|
+
relativePath: path.relative(process.cwd(), abs) || fileName,
|
|
51
|
+
sequence,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=trace-store.js.map
|
|
@@ -0,0 +1 @@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