@aui.io/apollo 0.1.91 → 0.1.93

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 (47) hide show
  1. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js +2 -2
  2. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js.map +1 -1
  3. package/node_modules/@aui.io/apollo-cli/dist/src/commands/confirm.d.ts +5 -5
  4. package/node_modules/@aui.io/apollo-cli/dist/src/commands/confirm.js +8 -8
  5. package/node_modules/@aui.io/apollo-cli/dist/src/commands/confirm.js.map +1 -1
  6. package/node_modules/@aui.io/apollo-cli/dist/src/commands/operate.d.ts +2 -0
  7. package/node_modules/@aui.io/apollo-cli/dist/src/commands/operate.js +460 -40
  8. package/node_modules/@aui.io/apollo-cli/dist/src/commands/operate.js.map +1 -1
  9. package/node_modules/@aui.io/apollo-cli/dist/src/index.js +3 -0
  10. package/node_modules/@aui.io/apollo-cli/dist/src/index.js.map +1 -1
  11. package/node_modules/@aui.io/apollo-cli/dist/src/output/broken-pipe.d.ts +8 -0
  12. package/node_modules/@aui.io/apollo-cli/dist/src/output/broken-pipe.js +20 -0
  13. package/node_modules/@aui.io/apollo-cli/dist/src/output/broken-pipe.js.map +1 -0
  14. package/node_modules/@aui.io/apollo-cli/dist/src/output/live-chat.d.ts +57 -0
  15. package/node_modules/@aui.io/apollo-cli/dist/src/output/live-chat.js +178 -0
  16. package/node_modules/@aui.io/apollo-cli/dist/src/output/live-chat.js.map +1 -0
  17. package/node_modules/@aui.io/apollo-cli/package.json +3 -3
  18. package/node_modules/@aui.io/apollo-core/dist/src/api/client-types.d.ts +15 -1
  19. package/node_modules/@aui.io/apollo-core/dist/src/api/jwt.d.ts +6 -0
  20. package/node_modules/@aui.io/apollo-core/dist/src/api/jwt.js +18 -0
  21. package/node_modules/@aui.io/apollo-core/dist/src/api/jwt.js.map +1 -0
  22. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.d.ts +116 -10
  23. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js +47 -4
  24. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js.map +1 -1
  25. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.d.ts +33 -1
  26. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js +246 -22
  27. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js.map +1 -1
  28. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.d.ts +4 -0
  29. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.js +4 -0
  30. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.js.map +1 -1
  31. package/node_modules/@aui.io/apollo-core/dist/src/output/index.d.ts +11 -2
  32. package/node_modules/@aui.io/apollo-core/dist/src/output/index.js +8 -4
  33. package/node_modules/@aui.io/apollo-core/dist/src/output/index.js.map +1 -1
  34. package/node_modules/@aui.io/apollo-core/dist/src/output/trace-lines.d.ts +28 -0
  35. package/node_modules/@aui.io/apollo-core/dist/src/output/trace-lines.js +140 -0
  36. package/node_modules/@aui.io/apollo-core/dist/src/output/trace-lines.js.map +1 -0
  37. package/node_modules/@aui.io/apollo-core/dist/src/services/chat-script.d.ts +39 -0
  38. package/node_modules/@aui.io/apollo-core/dist/src/services/chat-script.js +150 -0
  39. package/node_modules/@aui.io/apollo-core/dist/src/services/chat-script.js.map +1 -0
  40. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +3 -10
  41. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -1
  42. package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.d.ts +39 -3
  43. package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.js +159 -23
  44. package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.js.map +1 -1
  45. package/node_modules/@aui.io/apollo-core/package.json +1 -1
  46. package/node_modules/@aui.io/apollo-tui/package.json +2 -2
  47. package/package.json +4 -4
@@ -22,6 +22,7 @@ import { resolveContext, } from "@aui.io/apollo-core/config/index.js";
22
22
  import { ConfigError, toCliError } from "@aui.io/apollo-core/errors/index.js";
23
23
  import { CLI_VERSION } from "./meta.js";
24
24
  import { Output } from "@aui.io/apollo-core/output/index.js";
25
+ import { exitOnBrokenPipe } from "./output/broken-pipe.js";
25
26
  import { renderWelcome, welcomeData } from "./output/welcome.js";
26
27
  export function createProgram(state = {}, extensions = []) {
27
28
  const program = new Command()
@@ -106,6 +107,8 @@ export function createProgram(state = {}, extensions = []) {
106
107
  return program;
107
108
  }
108
109
  export async function main(argv = process.argv, extensions = [], hooks = {}) {
110
+ exitOnBrokenPipe(process.stdout);
111
+ exitOnBrokenPipe(process.stderr);
109
112
  const state = {};
110
113
  const program = createProgram(state, extensions);
111
114
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,GAEb,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,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B;IAC7C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9E,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE;YAC3D,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QACH,kEAAkE;QAClE,kEAAkE;QAClE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACnC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,oBAAoB;IACtB,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A reader that goes away (`apollo … | head`) ends the run the way it ends a
3
+ * Unix tool: quietly, with the status SIGPIPE leaves. Node ignores SIGPIPE,
4
+ * so without this the next write to the closed pipe dies on an unhandled
5
+ * EPIPE, stack trace and all — what an agent trimming output with `head` saw
6
+ * once `chat` began writing as the turn ran. Any other write error still throws.
7
+ */
8
+ export declare function exitOnBrokenPipe(stream: NodeJS.WritableStream, exit?: (code: number) => void): void;
@@ -0,0 +1,20 @@
1
+ import { ExitCode } from "@aui.io/apollo-core/errors/index.js";
2
+ const guarded = new WeakSet();
3
+ /**
4
+ * A reader that goes away (`apollo … | head`) ends the run the way it ends a
5
+ * Unix tool: quietly, with the status SIGPIPE leaves. Node ignores SIGPIPE,
6
+ * so without this the next write to the closed pipe dies on an unhandled
7
+ * EPIPE, stack trace and all — what an agent trimming output with `head` saw
8
+ * once `chat` began writing as the turn ran. Any other write error still throws.
9
+ */
10
+ export function exitOnBrokenPipe(stream, exit = (code) => process.exit(code)) {
11
+ if (guarded.has(stream))
12
+ return;
13
+ guarded.add(stream);
14
+ stream.on("error", (error) => {
15
+ if (error.code !== "EPIPE")
16
+ throw error;
17
+ exit(ExitCode.brokenPipe);
18
+ });
19
+ }
20
+ //# sourceMappingURL=broken-pipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broken-pipe.js","sourceRoot":"","sources":["../../../src/output/broken-pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAE/D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAyB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAA6B,EAC7B,OAA+B,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IAE3D,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;QAAE,OAAO;IAChC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAA4B,EAAE,EAAE;QAClD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;YAAE,MAAM,KAAK,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { ChatStreamEvent } from "@aui.io/apollo-core/api/runtime-api.js";
2
+ export interface LiveTurnOptions {
3
+ /** Where the live view goes — stderr, so stdout stays the reply. */
4
+ out: NodeJS.WritableStream;
5
+ /** A terminal: colors and a status line redrawn in place. Otherwise
6
+ * (a pipe, a coding agent, a CI log) plain lines, one per step. */
7
+ tty: boolean;
8
+ /** Draw nothing at all (`--quiet`, `--json`). */
9
+ enabled: boolean;
10
+ now?: () => number;
11
+ }
12
+ /**
13
+ * What the agent did on a turn, one line per step: as the turn streams,
14
+ * stamped with the seconds since it started, or — for a turn sent as one
15
+ * request — read off its sealed trace once the reply is in, with no clock,
16
+ * since every step arrived together. A step the engine sends again
17
+ * (`replace`) prints once.
18
+ *
19
+ * After the steps come the turn's outcome lines — a refusal, a block, a
20
+ * change waiting on the caller's go-ahead, an engine error — printed only
21
+ * when the sealed trace sets them.
22
+ *
23
+ * Checks wait for the reply. The engine streams a check the moment it runs,
24
+ * and a failure can be one it then recovers from (a reworded draft it
25
+ * rejects, then answers in the program's own words) — so the verdict comes
26
+ * from the sealed trace on the reply, and the live tally only stands in
27
+ * when the reply carries none. An intent is shown by name: its outcome
28
+ * settles after it is streamed.
29
+ */
30
+ export declare class LiveTurnView {
31
+ private readonly options;
32
+ private readonly now;
33
+ private readonly colors;
34
+ private started;
35
+ private clock;
36
+ private readonly printed;
37
+ private readonly checksSeen;
38
+ private passed;
39
+ private readonly failed;
40
+ private spinner;
41
+ private frame;
42
+ private statusShown;
43
+ constructor(options: LiveTurnOptions);
44
+ /** The turn is being sent. */
45
+ begin(): void;
46
+ readonly onEvent: (event: ChatStreamEvent) => void;
47
+ /** A turn sent as one request: its steps read off the sealed trace, then the checks verdict. */
48
+ summarize(sealed: Record<string, unknown> | null | undefined): void;
49
+ /** Stop drawing: the reply is in, the turn failed, or it was cancelled. */
50
+ end(): void;
51
+ private step;
52
+ private finish;
53
+ private stop;
54
+ private line;
55
+ private drawStatus;
56
+ private clearStatus;
57
+ }
@@ -0,0 +1,178 @@
1
+ import pc from "picocolors";
2
+ import { TRACE_SECTION_LABELS, describeTraceEntry, describeTurnOutcome, traceSectionLabel, } from "@aui.io/apollo-core/output/trace-lines.js";
3
+ const SPINNER = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
4
+ const LABEL_WIDTH = 11;
5
+ /** The sections a turn's steps are read from, in reading order. Checks are a verdict, not a step. */
6
+ const STEP_SECTIONS = Object.keys(TRACE_SECTION_LABELS).filter((section) => section !== "checks");
7
+ /**
8
+ * What the agent did on a turn, one line per step: as the turn streams,
9
+ * stamped with the seconds since it started, or — for a turn sent as one
10
+ * request — read off its sealed trace once the reply is in, with no clock,
11
+ * since every step arrived together. A step the engine sends again
12
+ * (`replace`) prints once.
13
+ *
14
+ * After the steps come the turn's outcome lines — a refusal, a block, a
15
+ * change waiting on the caller's go-ahead, an engine error — printed only
16
+ * when the sealed trace sets them.
17
+ *
18
+ * Checks wait for the reply. The engine streams a check the moment it runs,
19
+ * and a failure can be one it then recovers from (a reworded draft it
20
+ * rejects, then answers in the program's own words) — so the verdict comes
21
+ * from the sealed trace on the reply, and the live tally only stands in
22
+ * when the reply carries none. An intent is shown by name: its outcome
23
+ * settles after it is streamed.
24
+ */
25
+ export class LiveTurnView {
26
+ options;
27
+ now;
28
+ colors;
29
+ started = 0;
30
+ clock = true;
31
+ printed = new Map();
32
+ checksSeen = new Set();
33
+ passed = 0;
34
+ failed = [];
35
+ spinner;
36
+ frame = 0;
37
+ statusShown = false;
38
+ constructor(options) {
39
+ this.options = options;
40
+ this.now = options.now ?? (() => performance.now());
41
+ this.colors = pc.createColors(options.tty && pc.isColorSupported);
42
+ }
43
+ /** The turn is being sent. */
44
+ begin() {
45
+ this.started = this.now();
46
+ this.clock = true;
47
+ this.printed.clear();
48
+ this.checksSeen.clear();
49
+ this.passed = 0;
50
+ this.failed.length = 0;
51
+ if (!this.options.enabled || !this.options.tty)
52
+ return;
53
+ this.spinner = setInterval(() => this.drawStatus(), 120);
54
+ this.spinner.unref();
55
+ this.drawStatus();
56
+ }
57
+ onEvent = (event) => {
58
+ if (!this.options.enabled)
59
+ return;
60
+ if (event.type === "trace") {
61
+ for (const entry of event.data.entries ?? [])
62
+ this.step(event.data.section, entry);
63
+ }
64
+ else if (event.type === "cards") {
65
+ const count = event.data.cards?.length ?? 0;
66
+ if (count)
67
+ this.line("cards", `${count} card${count === 1 ? "" : "s"} for the reply`);
68
+ }
69
+ else if (event.type === "message") {
70
+ this.finish(event.data.trace_info ?? undefined);
71
+ }
72
+ else if (event.type === "error") {
73
+ this.finish();
74
+ }
75
+ };
76
+ /** A turn sent as one request: its steps read off the sealed trace, then the checks verdict. */
77
+ summarize(sealed) {
78
+ this.stop();
79
+ if (!this.options.enabled || !sealed)
80
+ return;
81
+ this.clock = false;
82
+ for (const section of STEP_SECTIONS) {
83
+ const entries = sealed[section];
84
+ if (Array.isArray(entries))
85
+ for (const entry of entries)
86
+ this.step(section, entry);
87
+ }
88
+ this.finish(sealed);
89
+ }
90
+ /** Stop drawing: the reply is in, the turn failed, or it was cancelled. */
91
+ end() {
92
+ this.finish();
93
+ }
94
+ step(section, entry) {
95
+ if (section === "checks") {
96
+ const key = JSON.stringify(entry);
97
+ if (this.checksSeen.has(key))
98
+ return;
99
+ this.checksSeen.add(key);
100
+ if (failedCheck(entry))
101
+ this.failed.push(entry);
102
+ else
103
+ this.passed += 1;
104
+ return;
105
+ }
106
+ const capability = section === "intents" ? entry?.capability : undefined;
107
+ const text = typeof capability === "string" ? capability : describeTraceEntry(section, entry);
108
+ const seen = this.printed.get(section) ?? new Set();
109
+ this.printed.set(section, seen);
110
+ if (seen.has(text))
111
+ return;
112
+ seen.add(text);
113
+ this.line(section, text);
114
+ }
115
+ finish(sealed) {
116
+ this.stop();
117
+ if (!this.options.enabled)
118
+ return;
119
+ // What the turn came to, when it refused, blocked, waited or failed — then the checks.
120
+ if (sealed)
121
+ for (const outcome of describeTurnOutcome(sealed))
122
+ this.line(outcome.field, outcome.text, outcome.failed ? "bad" : undefined);
123
+ // The sealed trace is the verdict; the live tally only when there is none.
124
+ const sealedChecks = Array.isArray(sealed?.checks) ? sealed.checks : undefined;
125
+ const failed = sealedChecks ? sealedChecks.filter(failedCheck) : [...this.failed];
126
+ const total = sealedChecks ? sealedChecks.length : this.passed + this.failed.length;
127
+ for (const check of failed)
128
+ this.line("checks", describeTraceEntry("checks", check), "bad");
129
+ if (total > 0) {
130
+ this.line("checks", failed.length ? `${failed.length} of ${total} checks failed` : `all ${total} checks passed`, failed.length ? "bad" : "good");
131
+ }
132
+ const rejected = sealed?.revoicing_rejected;
133
+ if (Array.isArray(rejected) && rejected.length > 0) {
134
+ this.line("checks", "a reworded draft was rejected; the program's own words were used");
135
+ }
136
+ this.passed = 0;
137
+ this.failed.length = 0;
138
+ }
139
+ stop() {
140
+ if (this.spinner !== undefined) {
141
+ clearInterval(this.spinner);
142
+ this.spinner = undefined;
143
+ }
144
+ this.clearStatus();
145
+ }
146
+ line(section, text, tone) {
147
+ const c = this.colors;
148
+ const seconds = `${((this.now() - this.started) / 1000).toFixed(1)}s`;
149
+ const label = traceSectionLabel(section).padEnd(LABEL_WIDTH);
150
+ const body = tone === "bad" ? c.red(text) : tone === "good" ? c.green(text) : text;
151
+ this.clearStatus();
152
+ let row;
153
+ if (this.options.tty)
154
+ row = ` ${this.clock ? `${c.dim(seconds.padStart(6))} ` : ""}${c.cyan(label)} ${body}`;
155
+ else
156
+ row = ` ${this.clock ? `[${seconds}] ` : ""}${label} ${text}`;
157
+ this.options.out.write(`${row}\n`);
158
+ if (this.spinner !== undefined)
159
+ this.drawStatus();
160
+ }
161
+ drawStatus() {
162
+ const c = this.colors;
163
+ const seconds = ((this.now() - this.started) / 1000).toFixed(1);
164
+ const glyph = SPINNER[this.frame++ % SPINNER.length] ?? "·";
165
+ this.options.out.write(`\r\x1b[2K ${c.magenta(glyph)} ${c.dim(`working · ${seconds}s`)}`);
166
+ this.statusShown = true;
167
+ }
168
+ clearStatus() {
169
+ if (!this.statusShown)
170
+ return;
171
+ this.options.out.write("\r\x1b[2K");
172
+ this.statusShown = false;
173
+ }
174
+ }
175
+ function failedCheck(entry) {
176
+ return entry?.passed === false;
177
+ }
178
+ //# sourceMappingURL=live-chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-chat.js","sourceRoot":"","sources":["../../../src/output/live-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,OAAO,GAAG,CAAC,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CAAC,CAAC;QAChE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC;QAC5D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,aAAa,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3F,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,OAAO;QAC9B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;CACF;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAQ,KAAqC,EAAE,MAAM,KAAK,KAAK,CAAC;AAClE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aui.io/apollo-cli",
3
- "version": "0.1.91",
3
+ "version": "0.1.93",
4
4
  "description": "Command-line client for the Apollo runtime",
5
5
  "type": "module",
6
6
  "engines": {
@@ -33,12 +33,12 @@
33
33
  "test": "vitest run"
34
34
  },
35
35
  "dependencies": {
36
- "@aui.io/apollo-core": "0.1.91",
36
+ "@aui.io/apollo-core": "0.1.93",
37
37
  "commander": "^14.0.3",
38
38
  "picocolors": "^1.1.1"
39
39
  },
40
40
  "optionalDependencies": {
41
- "@aui.io/apollo-tui": "0.1.91"
41
+ "@aui.io/apollo-tui": "0.1.93"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@eslint/js": "^9.39.5",
@@ -1,7 +1,8 @@
1
1
  import type { FormBody } from "./transport.js";
2
2
  export interface RequestOptions {
3
3
  method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
4
- query?: Record<string, string | number | boolean | undefined>;
4
+ /** A list repeats the parameter (`?origin_type=cli&origin_type=playground`). */
5
+ query?: Record<string, string | number | boolean | readonly string[] | undefined>;
5
6
  headers?: Record<string, string>;
6
7
  body?: unknown;
7
8
  /** Multipart form body — mutually exclusive with `body`. */
@@ -11,8 +12,21 @@ export interface RequestOptions {
11
12
  /** Floor for slow-by-design endpoints; an explicit `--timeout` wins. */
12
13
  timeoutMs?: number;
13
14
  }
15
+ /** One server-sent event as the wire framed it: `data:` lines joined by newlines. */
16
+ export interface SseEvent {
17
+ event?: string;
18
+ id?: string;
19
+ data: string;
20
+ }
21
+ export interface StreamRequestOptions extends Omit<RequestOptions, "form"> {
22
+ /** Ends the stream early (Ctrl+C): the request is aborted and never retried. */
23
+ signal?: AbortSignal;
24
+ }
14
25
  export interface HttpClient {
15
26
  request<T>(path: string, options?: RequestOptions): Promise<T>;
27
+ /** Server-sent events, as they arrive. Optional: a client that cannot
28
+ * stream leaves it out, and callers fall back to `request`. */
29
+ stream?(path: string, options?: StreamRequestOptions): AsyncGenerator<SseEvent>;
16
30
  }
17
31
  export interface Page<T> {
18
32
  results: T[];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * When a JWT expires, in epoch seconds — read from its payload, never
3
+ * verified: the server verifies, this only decides when to refresh. Anything
4
+ * that is not a JWT carrying a numeric `exp` reads as undefined.
5
+ */
6
+ export declare function jwtExpiresAt(token: string | undefined): number | undefined;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * When a JWT expires, in epoch seconds — read from its payload, never
3
+ * verified: the server verifies, this only decides when to refresh. Anything
4
+ * that is not a JWT carrying a numeric `exp` reads as undefined.
5
+ */
6
+ export function jwtExpiresAt(token) {
7
+ const payload = token?.split(".")[1];
8
+ if (!payload)
9
+ return undefined;
10
+ try {
11
+ const claims = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
12
+ return typeof claims.exp === "number" && Number.isFinite(claims.exp) ? claims.exp : undefined;
13
+ }
14
+ catch {
15
+ return undefined;
16
+ }
17
+ }
18
+ //# sourceMappingURL=jwt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../../src/api/jwt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAyB;IACpD,MAAM,OAAO,GAAG,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAsB,CAAC;QACnG,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IAChG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -19,6 +19,21 @@ export interface SendMessageRequest {
19
19
  project_id?: string;
20
20
  }
21
21
  export type RuntimeTrace = Record<string, unknown>;
22
+ /** Why a turn sent no words: the intake rule that disposed of the message. */
23
+ export interface MessageDisposition {
24
+ kind?: string | null;
25
+ rule?: string | null;
26
+ reason?: string | null;
27
+ }
28
+ /** One card on a reply. A runtime v2 card is data: a title and the record's fields. */
29
+ export interface MessageCard {
30
+ title?: string | null;
31
+ capability?: string | null;
32
+ instance?: string | null;
33
+ json_data?: {
34
+ entity?: Record<string, unknown> | null;
35
+ } | null;
36
+ }
22
37
  export interface Message {
23
38
  id: string;
24
39
  created_at?: string | null;
@@ -31,7 +46,9 @@ export interface Message {
31
46
  id?: string | null;
32
47
  type?: string | null;
33
48
  } | null;
34
- cards?: unknown[];
49
+ /** Set when the turn was disposed of without words (the text is then null). */
50
+ disposition?: MessageDisposition | null;
51
+ cards?: MessageCard[];
35
52
  followup_suggestions?: string[];
36
53
  input_tokens?: number;
37
54
  output_tokens?: number;
@@ -50,6 +67,85 @@ export interface Thread {
50
67
  updated_at: string;
51
68
  [key: string]: unknown;
52
69
  }
70
+ /**
71
+ * The runtime's keyset envelope for a thread listing. NOT `client-types.ts`'s
72
+ * `Page<T>` — that is the management API's `{results, meta}` shape, and the two
73
+ * are not interchangeable. Pass `next_cursor` back as `after` for the page past
74
+ * this one.
75
+ */
76
+ export interface ThreadPage {
77
+ items: Thread[];
78
+ has_next?: boolean;
79
+ has_previous?: boolean;
80
+ next_cursor?: string | null;
81
+ previous_cursor?: string | null;
82
+ }
83
+ /**
84
+ * One frame of a streamed turn (`POST /messaging/v1/messages/stream`), in the
85
+ * order the runtime sends them: the thread, progress `event`s, live `trace`
86
+ * slices and `cards` while the engine works, the terminal `message`, then —
87
+ * after the reply, never instead of it — late `suggestions`. An `error` frame
88
+ * ends a turn that failed.
89
+ */
90
+ export type ChatStreamEvent = {
91
+ type: "thread";
92
+ data: {
93
+ thread_id: string;
94
+ };
95
+ } | {
96
+ type: "event";
97
+ seq?: number;
98
+ data: Record<string, unknown>;
99
+ } | {
100
+ type: "trace";
101
+ seq?: number;
102
+ data: {
103
+ section: string;
104
+ entries?: unknown[];
105
+ replace?: boolean;
106
+ };
107
+ } | {
108
+ type: "cards";
109
+ seq?: number;
110
+ data: {
111
+ cards?: unknown[];
112
+ };
113
+ } | {
114
+ type: "message";
115
+ seq?: number;
116
+ data: Message;
117
+ } | {
118
+ type: "suggestions";
119
+ seq?: number;
120
+ data: {
121
+ followup_suggestions?: string[];
122
+ };
123
+ } | {
124
+ type: "error";
125
+ seq?: number;
126
+ data: {
127
+ message?: string;
128
+ status_code?: number;
129
+ error?: string;
130
+ };
131
+ };
132
+ /** The agent listing's filters; they compose (AND). */
133
+ export interface AgentThreadFilters {
134
+ /** Only threads this AUI user opened (`created_by`). */
135
+ userId?: string;
136
+ versionTag?: string;
137
+ /** A case-insensitive fragment of the title. */
138
+ title?: string;
139
+ startTime?: string;
140
+ endTime?: string;
141
+ /** Where the conversation started (`cli`, `playground`, `web-widget`, …); several OR together. */
142
+ origins?: readonly string[];
143
+ /** Only simulated conversations (true) or only real ones (false); both when unset. */
144
+ simulated?: boolean;
145
+ size?: number;
146
+ after?: string;
147
+ before?: string;
148
+ }
53
149
  export interface SkillIndexItem {
54
150
  id: string;
55
151
  description: string;
@@ -84,6 +180,16 @@ export declare class RuntimeApiClient {
84
180
  status: string;
85
181
  }>;
86
182
  sendMessage(agentId: string | undefined, input: SendMessageRequest): Promise<SendMessageResponse>;
183
+ /** Whether this client can stream a turn (the shared transport can; a bare test double may not). */
184
+ get canStream(): boolean;
185
+ /**
186
+ * The same turn as `sendMessage`, streamed: each frame as the runtime sends
187
+ * it, until `[DONE]`. Frames of a type this build does not know are skipped,
188
+ * so a newer runtime never breaks an older console.
189
+ */
190
+ streamMessage(agentId: string | undefined, input: SendMessageRequest, options?: {
191
+ signal?: AbortSignal;
192
+ }): AsyncGenerator<ChatStreamEvent>;
87
193
  createThread(input: {
88
194
  agentId?: string;
89
195
  versionId?: string;
@@ -99,20 +205,20 @@ export declare class RuntimeApiClient {
99
205
  after?: string;
100
206
  before?: string;
101
207
  }): Promise<Thread[]>;
208
+ /** The user's threads across every agent, one keyset page. */
209
+ userThreadPage(userId: string, options?: {
210
+ size?: number;
211
+ after?: string;
212
+ before?: string;
213
+ }): Promise<ThreadPage>;
102
214
  /**
103
215
  * Threads bound to an agent, newest first — the listing the runtime intends
104
216
  * UIs to use (the per-user route above stays for tooling). Filters compose:
105
217
  * owner, version tag, creation window. Keyset: `after`/`before` + `size`.
106
218
  */
107
- listAgentThreads(agentId: string, filters?: {
108
- userId?: string;
109
- versionTag?: string;
110
- startTime?: string;
111
- endTime?: string;
112
- size?: number;
113
- after?: string;
114
- before?: string;
115
- }): Promise<Thread[]>;
219
+ listAgentThreads(agentId: string, filters?: AgentThreadFilters): Promise<Thread[]>;
220
+ /** An agent's threads, newest first, one keyset page. */
221
+ agentThreadPage(agentId: string, filters?: AgentThreadFilters): Promise<ThreadPage>;
116
222
  listMessages(threadId: string): Promise<Message[]>;
117
223
  threadTrace(threadId: string): Promise<RuntimeTrace[]>;
118
224
  /** Thread-scoped, like the served route: a branch copies the parent's