@songsid/agend 2.2.0-beta.7 → 2.2.0-beta.9

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 (87) hide show
  1. package/dist/agent-whats-new.js +9 -3
  2. package/dist/agent-whats-new.js.map +1 -1
  3. package/dist/backend/grok.d.ts +1 -0
  4. package/dist/backend/grok.js +5 -0
  5. package/dist/backend/grok.js.map +1 -1
  6. package/dist/backend/kiro.d.ts +24 -0
  7. package/dist/backend/kiro.js +51 -5
  8. package/dist/backend/kiro.js.map +1 -1
  9. package/dist/backend/muse.d.ts +17 -0
  10. package/dist/backend/muse.js +86 -16
  11. package/dist/backend/muse.js.map +1 -1
  12. package/dist/backend/types.d.ts +16 -1
  13. package/dist/backend/types.js.map +1 -1
  14. package/dist/channel/mcp-tools.js +1 -1
  15. package/dist/channel/mcp-tools.js.map +1 -1
  16. package/dist/config-validator.js +3 -0
  17. package/dist/config-validator.js.map +1 -1
  18. package/dist/daemon.d.ts +6 -1
  19. package/dist/daemon.js +12 -4
  20. package/dist/daemon.js.map +1 -1
  21. package/dist/fleet-manager.d.ts +13 -0
  22. package/dist/fleet-manager.js +52 -0
  23. package/dist/fleet-manager.js.map +1 -1
  24. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +2 -0
  25. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
  26. package/dist/instance-config-impact.js +1 -0
  27. package/dist/instance-config-impact.js.map +1 -1
  28. package/dist/instance-lifecycle.js +3 -1
  29. package/dist/instance-lifecycle.js.map +1 -1
  30. package/dist/kiro-log-gate.d.ts +42 -0
  31. package/dist/kiro-log-gate.js +39 -0
  32. package/dist/kiro-log-gate.js.map +1 -0
  33. package/dist/log-service.d.ts +99 -0
  34. package/dist/log-service.js +235 -0
  35. package/dist/log-service.js.map +1 -0
  36. package/dist/log-steps.d.ts +169 -0
  37. package/dist/log-steps.js +858 -0
  38. package/dist/log-steps.js.map +1 -0
  39. package/dist/public-web-gateway.js +1 -1
  40. package/dist/public-web-gateway.js.map +1 -1
  41. package/dist/public-web-link.js +15 -3
  42. package/dist/public-web-link.js.map +1 -1
  43. package/dist/settings-api.js +4 -0
  44. package/dist/settings-api.js.map +1 -1
  45. package/dist/settings-change.js +2 -0
  46. package/dist/settings-change.js.map +1 -1
  47. package/dist/settings-effect.js +2 -0
  48. package/dist/settings-effect.js.map +1 -1
  49. package/dist/tool-progress.js +3 -2
  50. package/dist/tool-progress.js.map +1 -1
  51. package/dist/transcript-jsonl.d.ts +80 -3
  52. package/dist/transcript-jsonl.js +147 -10
  53. package/dist/transcript-jsonl.js.map +1 -1
  54. package/dist/transcript-monitor.d.ts +11 -0
  55. package/dist/transcript-monitor.js +61 -13
  56. package/dist/transcript-monitor.js.map +1 -1
  57. package/dist/transcript-sources.d.ts +24 -0
  58. package/dist/transcript-sources.js +205 -55
  59. package/dist/transcript-sources.js.map +1 -1
  60. package/dist/types.d.ts +6 -0
  61. package/dist/ui/panel-log.js +428 -0
  62. package/dist/ui/panel-settings.js +6 -1
  63. package/dist/ui/settings-strings.js +2 -0
  64. package/dist/ui/shared/app-i18n.js +2 -2
  65. package/dist/ui/shared/app-route.js +6 -1
  66. package/dist/ui/shared/app-shell.js +3 -3
  67. package/dist/ui/shared/app-stream.js +2 -1
  68. package/dist/ui/shared/app.css +40 -5
  69. package/dist/ui/shared/app.js +5 -0
  70. package/dist/ui/shared/fonts/README.md +1 -1
  71. package/dist/ui/shared/instance-nav.js +9 -6
  72. package/dist/ui/shared/instance-switch.js +4 -4
  73. package/dist/ui/shared/tokens.css +1 -1
  74. package/dist/unrecognised-prompt.js +2 -2
  75. package/dist/unrecognised-prompt.js.map +1 -1
  76. package/dist/web-api.d.ts +3 -0
  77. package/dist/web-api.js +41 -0
  78. package/dist/web-api.js.map +1 -1
  79. package/dist/web-auth.js +2 -1
  80. package/dist/web-auth.js.map +1 -1
  81. package/dist/web-settings-patch.d.ts +3 -1
  82. package/dist/web-settings-patch.js +4 -1
  83. package/dist/web-settings-patch.js.map +1 -1
  84. package/dist/web-shell-routes.d.ts +4 -0
  85. package/dist/web-shell-routes.js +9 -0
  86. package/dist/web-shell-routes.js.map +1 -1
  87. package/package.json +1 -1
@@ -0,0 +1,99 @@
1
+ import { type LogStep } from "./log-steps.js";
2
+ export declare const LOG_STEPS_LIMIT = 200;
3
+ export declare const LOG_OLDER_LIMIT = 100;
4
+ export declare const LOG_RESPONSE_MAX_BYTES: number;
5
+ export declare const WATCH_LEASE_MS = 45000;
6
+ export declare const WATCH_POLL_MS = 2000;
7
+ export declare const LOG_EVENTS_LIMIT = 50;
8
+ /** Where an instance's steps come from, as the fleet resolves it (only when the Log asks). */
9
+ export interface LogSource {
10
+ backend: string;
11
+ /** The transcript to read, or null: none known now. */
12
+ path: string | null;
13
+ /** The parser for it: claude / codex (kiro: its own reader, later in phase 1); null: this backend has none. */
14
+ format: "claude" | "codex" | null;
15
+ /** Why there is nothing to read: "not_running" (its transcript is found while it runs), "no_transcript", "unsupported". */
16
+ reason?: string;
17
+ }
18
+ export interface LogEventRow {
19
+ id: number;
20
+ event_type: string;
21
+ payload: unknown;
22
+ created_at: string;
23
+ }
24
+ export interface LogServiceDeps {
25
+ enabled(): boolean;
26
+ /** An instance the Log may show (a fleet instance or a ClassicBot room). */
27
+ known(name: string): boolean;
28
+ source(name: string): LogSource;
29
+ /** The instance's newest event-log rows (newest first), at most `limit`. */
30
+ events(name: string, limit: number): LogEventRow[];
31
+ /** Broadcast to the web stream. */
32
+ emit(event: string, data: unknown): void;
33
+ now?(): number;
34
+ setInterval?(fn: () => void, ms: number): unknown;
35
+ clearInterval?(handle: unknown): void;
36
+ }
37
+ export interface LogQuery {
38
+ after?: number;
39
+ before?: number;
40
+ key?: string;
41
+ skip?: boolean;
42
+ limit?: number;
43
+ watch?: boolean;
44
+ ev?: number;
45
+ }
46
+ /** A fleet event as the page shows it: its type (the page words it) and its details, masked. */
47
+ export interface LogEvent {
48
+ id: number;
49
+ ts: number;
50
+ type: string;
51
+ detail?: string;
52
+ }
53
+ /** The event types a Log shows: what changed for the instance itself, not bookkeeping (tips, cost snapshots). */
54
+ export declare const LOG_EVENT_TYPES: ReadonlySet<string>;
55
+ export type LogAnswer = {
56
+ enabled: false;
57
+ } | {
58
+ enabled: true;
59
+ instance: string;
60
+ backend: string;
61
+ supported: boolean;
62
+ reason?: string;
63
+ /** The transcript's identity (device-inode): a cursor of another one is reset. */
64
+ key?: string;
65
+ steps: LogStep[];
66
+ events: LogEvent[];
67
+ /** Offset to ask `before=` for older steps; null: nothing older. */
68
+ before: number | null;
69
+ /** Offset to ask `after=` for newer steps (with `skip` when it is inside a long record). */
70
+ after: number | null;
71
+ skip?: boolean;
72
+ /** More is already waiting after `after`. */
73
+ more?: boolean;
74
+ /** The page's cursor was for another transcript (a new session) or past its end: start again from this answer. */
75
+ reset?: boolean;
76
+ /** The newest event id this answer saw (for `ev=`). */
77
+ ev: number;
78
+ };
79
+ export declare class LogService {
80
+ private readonly deps;
81
+ private readonly watches;
82
+ constructor(deps: LogServiceDeps);
83
+ private now;
84
+ /** GET /ui/steps — null: no such instance. */
85
+ steps(name: string, q: LogQuery): Promise<LogAnswer | null>;
86
+ /** The steps before `end` (the newest when undefined), at most `limit`, and where older ones start. */
87
+ private backward;
88
+ /** The steps after `from` (≤ LOOKS_PER_POLL looks), and the cursor after them. */
89
+ private forward;
90
+ private eventsFor;
91
+ /** Hold (or renew) the watch on `name`: its transcript's size is looked at while the lease lasts. */
92
+ private watch;
93
+ private look;
94
+ private unwatch;
95
+ /** Every watch ends (the Log was turned off, the fleet stops). */
96
+ unwatchAll(): void;
97
+ /** How many instances are watched now (for tests and diagnostics). */
98
+ watched(): number;
99
+ }
@@ -0,0 +1,235 @@
1
+ /**
2
+ * #1218 phase 1: the Log tab's server side — on demand only (the user's decision on load, 2026-10-13). Off by default
3
+ * (`web.log_tab`); off, it answers `{ enabled: false }` and does no work at all. On:
4
+ *
5
+ * - **Nothing runs in the background.** No collector, no step log on disk: each GET /ui/steps reads a bounded range of
6
+ * the instance's own transcript (async, ≤ 8 MiB back or ≤ 4 MiB forward) and parses it with the backend's parser
7
+ * (log-steps.ts). Step ids depend on the bytes, not on the range, so the page merges ranges.
8
+ * - **Live only under a watch.** A request with `watch` holds a lease (WATCH_LEASE_MS, renewed by every request); while
9
+ * one is held the fleet looks at the transcript's size every WATCH_POLL_MS and, when it moved, broadcasts a tiny
10
+ * `steps_tick { instance }` — the page then fetches `after=` its cursor. No lease: no timer, no read.
11
+ * - **Fleet events** (crash, restart, hang, a prompt waiting, a pause) come from the existing event log, by id.
12
+ *
13
+ * Nothing here runs in the daemon, and nothing reads a CLI's file on a tool call.
14
+ */
15
+ import { stat } from "node:fs/promises";
16
+ import { ClaudeStepParser, CodexStepParser, bounded, readTailRecords } from "./log-steps.js";
17
+ import { LOOKS_PER_POLL, isClaudeAssistantHead, readNewLines, readWholeLine } from "./transcript-jsonl.js";
18
+ export const LOG_STEPS_LIMIT = 200;
19
+ export const LOG_OLDER_LIMIT = 100;
20
+ export const LOG_RESPONSE_MAX_BYTES = 512 * 1024;
21
+ export const WATCH_LEASE_MS = 45_000;
22
+ export const WATCH_POLL_MS = 2_000;
23
+ export const LOG_EVENTS_LIMIT = 50;
24
+ /** The event types a Log shows: what changed for the instance itself, not bookkeeping (tips, cost snapshots). */
25
+ export const LOG_EVENT_TYPES = new Set([
26
+ "crash_respawn", "crash_loop", "hang_detected", "hang_action", "instance_paused", "instance_resumed",
27
+ "interactive_prompt", "interactive_prompt_assist", "dialog_parked", "model_failover", "model_recovered",
28
+ "mcp_died", "mcp_recovered", "mcp_auto_restart", "message_failed", "pty_error", "pty_recovered",
29
+ "backend_unreachable", "startup_backend_unreachable", "backend_launch_warning", "clear_action", "normal_exit_action",
30
+ "reply_drop_detected", "reply_drop_recovered", "reply_drop_unrecovered", "supervision_ended", "tmux_server_crash",
31
+ "malformed_tool_call", "health_check_error",
32
+ ]);
33
+ const parserFor = (format) => (format === "claude" ? new ClaudeStepParser() : new CodexStepParser());
34
+ /** The long records worth reading whole for a Log (a reply, a turn record); every other long one by its head. */
35
+ const wholeFor = (format) => (head) => (format === "claude"
36
+ ? isClaudeAssistantHead(head)
37
+ : head.includes('"type":"event_msg"') || (head.includes('"type":"response_item"') && /"payload":\{"type":"message"/.test(head)));
38
+ const dbTime = (s) => { const t = Date.parse(s.replace(" ", "T") + "Z"); return Number.isFinite(t) ? t : 0; };
39
+ export class LogService {
40
+ deps;
41
+ watches = new Map();
42
+ constructor(deps) {
43
+ this.deps = deps;
44
+ }
45
+ now() { return this.deps.now ? this.deps.now() : performance.now(); }
46
+ /** GET /ui/steps — null: no such instance. */
47
+ async steps(name, q) {
48
+ if (!this.deps.enabled()) {
49
+ this.unwatchAll();
50
+ return { enabled: false };
51
+ }
52
+ if (!this.deps.known(name))
53
+ return null;
54
+ const src = this.deps.source(name);
55
+ const evs = this.eventsFor(name, q.ev);
56
+ const base = { enabled: true, instance: name, backend: src.backend, events: evs.events, ev: evs.ev };
57
+ if (!src.format || !src.path) {
58
+ return { ...base, supported: !!src.format, reason: src.reason ?? (src.format ? "no_transcript" : "unsupported"), steps: [], before: null, after: null };
59
+ }
60
+ let st;
61
+ try {
62
+ st = await stat(src.path);
63
+ }
64
+ catch {
65
+ return { ...base, supported: true, reason: "no_transcript", steps: [], before: null, after: null };
66
+ }
67
+ const key = `${st.dev}-${st.ino}`;
68
+ if (q.watch)
69
+ this.watch(name, src.path, st.size, st.ino);
70
+ const answer = { ...base, supported: true, key };
71
+ const fresh = q.key !== undefined && q.key !== key;
72
+ const past = q.after !== undefined && q.after > st.size;
73
+ if (q.after !== undefined && !fresh && !past)
74
+ return { ...answer, ...(await this.forward(src.path, src.format, q.after, !!q.skip)) };
75
+ if (q.before !== undefined && !fresh)
76
+ return { ...answer, ...(await this.backward(src.path, src.format, q.before, Math.min(q.limit ?? LOG_OLDER_LIMIT, LOG_OLDER_LIMIT))), after: null };
77
+ const back = await this.backward(src.path, src.format, undefined, Math.min(q.limit ?? LOG_STEPS_LIMIT, LOG_STEPS_LIMIT));
78
+ return { ...answer, ...back, ...((fresh || past) && (q.after !== undefined || q.before !== undefined) ? { reset: true } : {}) };
79
+ }
80
+ /** The steps before `end` (the newest when undefined), at most `limit`, and where older ones start. */
81
+ async backward(path, format, end, limit) {
82
+ const tail = await readTailRecords(path, { maxLines: 4000, ...(end !== undefined ? { end } : {}) });
83
+ const parser = parserFor(format);
84
+ const whole = wholeFor(format);
85
+ const firstAt = new Map();
86
+ for (const r of tail.records) {
87
+ let record = r.record;
88
+ // #1788 review P3: a long reply or turn record is read whole here too, as the live read does.
89
+ if (typeof record !== "string" && whole(record.head)) {
90
+ const text = await readWholeLine(path, r.at, record.bytes).catch(() => null);
91
+ if (text !== null)
92
+ record = text;
93
+ }
94
+ for (const s of parser.push(record, r.at))
95
+ if (!firstAt.has(s.id))
96
+ firstAt.set(s.id, r.at);
97
+ }
98
+ let steps = fitBytes(parser.steps.slice(-limit));
99
+ // #1788 review P3: cut only at a record's boundary — one record can make several steps (a reply's text and its
100
+ // call): the oldest kept record comes whole, so `before` (its start) never leaves one of its steps out for good.
101
+ let from = parser.steps.length - steps.length;
102
+ const recordOf = (i) => firstAt.get(parser.steps[i].id);
103
+ while (from > 0 && steps.length && recordOf(from - 1) === recordOf(from))
104
+ from--;
105
+ steps = parser.steps.slice(from);
106
+ // Older steps exist when the read stopped before the file's start, or when steps it parsed were left out (the limit,
107
+ // the answer's size): they start at the record of the oldest step shown. Otherwise nothing is older.
108
+ const all = !tail.truncated && steps.length === parser.steps.length;
109
+ const first = steps.length ? Math.min(...steps.map(s => firstAt.get(s.id) ?? Infinity)) : (tail.records[0]?.at ?? 0);
110
+ const before = !all && Number.isFinite(first) && first > 0 ? first : null;
111
+ return { steps, before, after: tail.end };
112
+ }
113
+ /** The steps after `from` (≤ LOOKS_PER_POLL looks), and the cursor after them. */
114
+ async forward(path, format, from, skip) {
115
+ const parser = parserFor(format);
116
+ const whole = wholeFor(format);
117
+ let offset = from, skipping = skip, more = false;
118
+ for (let look = 0; look < LOOKS_PER_POLL; look++) {
119
+ const read = await readNewLines(path, offset, { skipping });
120
+ const moved = read.newOffset !== offset;
121
+ offset = read.newOffset;
122
+ skipping = read.skipping;
123
+ more = read.more;
124
+ // In file order: complete lines with their offsets, long lines by their head — or whole, for a reply or turn record.
125
+ let li = 0;
126
+ const pushLong = async (l) => {
127
+ if (l.complete && whole(l.head)) {
128
+ const text = await readWholeLine(path, l.offset, l.bytes).catch(() => null);
129
+ if (text !== null) {
130
+ parser.push(text, l.offset);
131
+ return;
132
+ }
133
+ }
134
+ parser.push(l, l.offset);
135
+ };
136
+ for (const l of read.long) {
137
+ while (li < l.at) {
138
+ parser.push(read.lines[li], read.offsets[li]);
139
+ li++;
140
+ }
141
+ await pushLong(l);
142
+ }
143
+ while (li < read.lines.length) {
144
+ parser.push(read.lines[li], read.offsets[li]);
145
+ li++;
146
+ }
147
+ if (!moved || !read.more)
148
+ break;
149
+ }
150
+ const steps = fitBytes(parser.steps);
151
+ return { steps, before: null, after: offset, ...(skipping ? { skip: true } : {}), ...(more || skipping ? { more: true } : {}) };
152
+ }
153
+ eventsFor(name, after) {
154
+ let rows = [];
155
+ try {
156
+ rows = this.deps.events(name, LOG_EVENTS_LIMIT);
157
+ }
158
+ catch {
159
+ rows = [];
160
+ }
161
+ const ev = rows.reduce((m, r) => Math.max(m, r.id), after ?? 0);
162
+ const events = rows
163
+ .filter(r => (after === undefined || r.id > after) && LOG_EVENT_TYPES.has(r.event_type))
164
+ .map(r => {
165
+ const detail = r.payload && typeof r.payload === "object" && Object.keys(r.payload).length
166
+ ? bounded(JSON.stringify(r.payload), 300).text : undefined;
167
+ return { id: r.id, ts: dbTime(r.created_at), type: r.event_type, ...(detail ? { detail } : {}) };
168
+ })
169
+ .reverse();
170
+ return { events, ev };
171
+ }
172
+ /** Hold (or renew) the watch on `name`: its transcript's size is looked at while the lease lasts. */
173
+ watch(name, path, size, ino) {
174
+ const until = this.now() + WATCH_LEASE_MS;
175
+ const held = this.watches.get(name);
176
+ if (held && held.path === path) {
177
+ held.until = until;
178
+ return;
179
+ }
180
+ if (held)
181
+ this.unwatch(name);
182
+ const setI = this.deps.setInterval ?? ((fn, ms) => { const t = setInterval(fn, ms); t.unref?.(); return t; });
183
+ const w = { until, path, size, ino, timer: null };
184
+ w.timer = setI(() => { void this.look(name); }, WATCH_POLL_MS);
185
+ this.watches.set(name, w);
186
+ }
187
+ async look(name) {
188
+ const w = this.watches.get(name);
189
+ if (!w)
190
+ return;
191
+ if (this.now() > w.until || !this.deps.enabled()) {
192
+ this.unwatch(name);
193
+ return;
194
+ }
195
+ let st;
196
+ try {
197
+ st = await stat(w.path);
198
+ }
199
+ catch {
200
+ return;
201
+ }
202
+ if (this.watches.get(name) !== w)
203
+ return;
204
+ if (st.size !== w.size || st.ino !== w.ino) {
205
+ w.size = st.size;
206
+ w.ino = st.ino;
207
+ this.deps.emit("steps_tick", { instance: name });
208
+ }
209
+ }
210
+ unwatch(name) {
211
+ const w = this.watches.get(name);
212
+ if (!w)
213
+ return;
214
+ (this.deps.clearInterval ?? ((h) => clearInterval(h)))(w.timer);
215
+ this.watches.delete(name);
216
+ }
217
+ /** Every watch ends (the Log was turned off, the fleet stops). */
218
+ unwatchAll() { for (const name of [...this.watches.keys()])
219
+ this.unwatch(name); }
220
+ /** How many instances are watched now (for tests and diagnostics). */
221
+ watched() { return this.watches.size; }
222
+ }
223
+ /** The newest steps whose JSON fits LOG_RESPONSE_MAX_BYTES (each step is already bounded; this bounds their number). */
224
+ function fitBytes(steps) {
225
+ let total = 0, i = steps.length;
226
+ while (i > 0) {
227
+ const size = JSON.stringify(steps[i - 1]).length + 1;
228
+ if (total + size > LOG_RESPONSE_MAX_BYTES)
229
+ break;
230
+ total += size;
231
+ i--;
232
+ }
233
+ return steps.slice(i);
234
+ }
235
+ //# sourceMappingURL=log-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-service.js","sourceR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C5B,CAAC;IAED,kEAAkE;IAClE,UAAU,KAAW,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEvF,sEAAsE;IACtE,OAAO,KAAa,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CAChD;AAED,wHAAwH;AACxH,SAAS,QAAQ,CAAC,KAAgB;IAChC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QACrD,IAAI,KAAK,GAAG,IAAI,GAAG,sBAAsB;YAAE,MAAM;QACjD,KAAK,IAAI,IAAI,CAAC;QAAC,CAAC,EAAE,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,169 @@
1
+ import { type LongLine } from "./transcript-jsonl.js";
2
+ export type StepKind = "user" | "assistant" | "tool" | "error" | "turn_end" | "state";
3
+ /** What a tool call does, for its icon and words on the page. */
4
+ export type StepCat = "read" | "edit" | "search" | "run" | "web" | "mcp" | "agent" | "plan" | "message" | "other";
5
+ export type StepStatus = "running" | "done" | "failed" | "interrupted";
6
+ export interface LogStep {
7
+ /**
8
+ * Stable for the step's life, and the same whichever range of the transcript is parsed: a tool call's own id, or
9
+ * `o<byte offset of its record>.<n>`. A later emission with the same id updates it (a call, then its result) — the
10
+ * page merges it into what it shows.
11
+ */
12
+ id: string;
13
+ /** The turn it belongs to: the transcript's own id for it (claude: the prompt record's uuid; codex: turn_id); "" before the first. */
14
+ turn: string;
15
+ /** When the record was written (ms), or 0 when the record has no time. */
16
+ ts: number;
17
+ kind: StepKind;
18
+ /** tool: the CLI's tool name ("Bash", "exec_command", "fs_read"). */
19
+ tool?: string;
20
+ cat?: StepCat;
21
+ /** tool: what it acts on — a path, a command, a pattern, `server:tool` — masked, ≤ SUBJECT_MAX. */
22
+ subject?: string;
23
+ /** tool: its arguments as text (JSON or the command), masked, ≤ INPUT_MAX — the page shows it on demand. */
24
+ input?: string;
25
+ inputCut?: number;
26
+ status?: StepStatus;
27
+ durationMs?: number;
28
+ exitCode?: number;
29
+ /** user / assistant / error text, or a tool's result, masked and cut (≤ TEXT_MAX / RESULT_MAX). */
30
+ body?: string;
31
+ /** Characters cut from `body` (0 or absent: nothing), or the bytes of a result too long to read (`bodyBytes`). */
32
+ bodyCut?: number;
33
+ bodyBytes?: number;
34
+ /** state: what happened ("compacted"); error: a status code. */
35
+ note?: string;
36
+ }
37
+ export declare const SUBJECT_MAX = 300;
38
+ export declare const INPUT_MAX = 2000;
39
+ export declare const TEXT_MAX = 4000;
40
+ export declare const RESULT_MAX = 4000;
41
+ /**
42
+ * Mask secret values in `text` (#1788 review P1: every common way a secret is written, since arguments and results are
43
+ * shown): a private key block; a secret-named JSON field, flag or assignment (any identifier containing password,
44
+ * secret, token, api/access/private key, credential — DB_PASSWORD, "api_key", --password); then the bubble's redactor
45
+ * (known key shapes, Bearer, URL userinfo); then long mixed-case opaque tokens. Numbers, booleans and null are kept.
46
+ */
47
+ export declare function maskSecrets(text: string): string;
48
+ /**
49
+ * `text` masked and cut to `max` characters (never inside a surrogate pair), with how many were cut. Only the part that
50
+ * can be shown (plus MASK_MARGIN) is masked: a tool result can be megabytes.
51
+ */
52
+ export declare function bounded(text: string, max: number): {
53
+ text: string;
54
+ cut: number;
55
+ };
56
+ /** A "tool" that is the model's thinking (kiro's `thinking`): never a step (the user's decision: thinking is never shown). */
57
+ export declare const THINKING_TOOLS: ReadonlySet<string>;
58
+ /** The category and subject of a tool call, from its name and input. An unknown tool: "other", its name. */
59
+ export declare function describeTool(name: string, input: unknown): {
60
+ cat: StepCat;
61
+ subject?: string;
62
+ };
63
+ /** What a parser gives back for one record: the steps it created or changed (each a complete, latest copy). */
64
+ export type Emission = LogStep[];
65
+ declare abstract class StepParser {
66
+ protected turn: string;
67
+ private open;
68
+ private n;
69
+ /** The byte offset of the record being parsed (-1: unknown), for ids that do not depend on where parsing began. */
70
+ protected at: number;
71
+ private k;
72
+ /** Steps in the order they were first seen (updated in place). */
73
+ readonly steps: LogStep[];
74
+ protected abstract record(entry: Record<string, unknown>): Emission;
75
+ /** A record too long to parse: what its head still says (by default nothing). */
76
+ protected long(_head: string, _bytes: number): Emission;
77
+ /** One transcript line (JSON text) or a long line's head: the steps it created or changed. Malformed: none. */
78
+ push(item: string | LongLine, at?: number): Emission;
79
+ protected add(step: Omit<LogStep, "id" | "turn"> & {
80
+ id?: string;
81
+ }): LogStep;
82
+ protected openTool(id: string): LogStep | undefined;
83
+ protected close(id: string): LogStep | undefined;
84
+ /** A new turn (`key`: the transcript's id for it): every tool still running in the last one is interrupted. */
85
+ protected newTurn(key: string): Emission;
86
+ protected endOpen(status: StepStatus): Emission;
87
+ }
88
+ /**
89
+ * claude-code: the JSONL at statusline.json's transcript_path. user: a prompt (string content; `isMeta` records and
90
+ * tool results are not prompts); assistant: `text` (thinking never), `tool_use` (running); a `tool_result` (by
91
+ * `tool_use_id`, `is_error`) completes its call; an API error is an assistant record with `isApiErrorMessage`;
92
+ * `system` `turn_duration` ends a turn, `compact_boundary` is a state.
93
+ */
94
+ export declare class ClaudeStepParser extends StepParser {
95
+ private started;
96
+ protected record(e: Record<string, unknown>): Emission;
97
+ private result;
98
+ /** A tool result too long to parse (most long claude lines are): its call completes, with the start of its text. */
99
+ protected long(head: string, bytes: number): Emission;
100
+ }
101
+ /**
102
+ * codex: the rollout JSONL. `response_item`: `message` (user / assistant), `function_call` / `custom_tool_call` /
103
+ * `local_shell_call` (running, by `call_id`) and their `*_output` (exec_command's output says its exit code and wall
104
+ * time); `event_msg`: `task_started` (a turn), `task_complete` / `turn_aborted` (its end), and — on versions that
105
+ * write them — `item_completed` items: CommandExecution (a command, with exit code and duration), McpToolCall,
106
+ * FileChange. Their AgentMessage / UserMessage duplicate the response items and are not shown twice; reasoning never.
107
+ */
108
+ export declare class CodexStepParser extends StepParser {
109
+ private started;
110
+ protected record(e: Record<string, unknown>): Emission;
111
+ private item;
112
+ /** A long rollout line: an output completes its call with the start of its text; a call starts by its name. */
113
+ protected long(head: string, bytes: number): Emission;
114
+ }
115
+ /**
116
+ * kiro TUI (v2): the session's message log `<KIRO_HOME>/sessions/cli/<id>.jsonl` — `Prompt` (a turn: its text),
117
+ * `AssistantMessage` (`text`; `toolUse` running, by `toolUseId`; `thinking` never), `ToolResults` (`toolResult`
118
+ * completes its call: status, stdout/stderr, exit status). Only a Prompt carries a time.
119
+ */
120
+ export declare class KiroV2StepParser extends StepParser {
121
+ private skipped;
122
+ protected record(e: Record<string, unknown>): Emission;
123
+ /**
124
+ * A tool result too long to parse (a command's whole output): its first call completes with the start of its output
125
+ * and the exit code the head shows. A long reply or prompt is read whole by the Log instead (log-service.ts).
126
+ */
127
+ protected long(head: string, bytes: number): Emission;
128
+ }
129
+ /**
130
+ * kiro classic (v1): one conversation row's `history` — each entry a user side (`Prompt`, `ToolUseResults`,
131
+ * `CancelledToolUses`) and an assistant side (`ToolUse` with its text and calls, or `Response`). The row is rewritten
132
+ * as the conversation goes on, so its steps are the whole history's; ids are by entry (`h<i>.<n>`) and calls by their
133
+ * own id. Read in the kiro worker (never on the fleet loop); `max` bounds what comes back.
134
+ */
135
+ export declare function kiroClassicSteps(value: unknown, max?: number): {
136
+ steps: LogStep[];
137
+ entries: number;
138
+ };
139
+ export declare const BACKFILL_MAX_BYTES: number;
140
+ /**
141
+ * The last records of a JSONL transcript, in file order, each with its byte offset — complete lines, and long lines (over LINE_MAX_BYTES) by
142
+ * their head and size — read backwards in BACKFILL_CHUNK chunks, at most `maxBytes`, stopping once `maxLines` records
143
+ * are held. A record still being written (after the last line end) is not included. `truncated`: older records exist
144
+ * that were not read. Async and bounded — for an on-demand backfill when a Log is opened, never a whole-file read.
145
+ * `end` (a record start from an earlier read) reads the records before it instead: the older page.
146
+ *
147
+ * Of the record that crosses a chunk's left edge only its first LINE_MAX_BYTES + LONG_HEAD_BYTES are kept (with its
148
+ * exact length): enough for a short record whole, or for a long one's head.
149
+ */
150
+ /** A record and where it starts in the file (its byte offset). */
151
+ export interface TailRecord {
152
+ record: string | LongLine;
153
+ at: number;
154
+ }
155
+ export declare function readTailRecords(path: string, opts?: {
156
+ maxBytes?: number;
157
+ maxLines?: number;
158
+ end?: number;
159
+ }): Promise<{
160
+ records: TailRecord[];
161
+ truncated: boolean;
162
+ end: number;
163
+ }>;
164
+ /** Parse `records` (file order) with `parser` and return its last `max` steps. */
165
+ export declare function stepsOf(parser: {
166
+ push(item: string | LongLine, at?: number): Emission;
167
+ steps: LogStep[];
168
+ }, records: readonly TailRecord[], max?: number): LogStep[];
169
+ export {};