@dadado/agent-kit-cli 5.16.0 → 5.18.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 (40) hide show
  1. package/dashboard/README.md +10 -1
  2. package/dashboard/dashboard-data.mjs +12 -2
  3. package/dashboard/dashboard.html +58 -0
  4. package/dashboard/lib/run-logs.d.mts +34 -0
  5. package/dashboard/lib/run-logs.mjs +218 -0
  6. package/dist/{add-7UMSGVWC.js → add-KQJE3ZTG.js} +3 -3
  7. package/dist/{chunk-KD2MYBB6.js → chunk-3J3I2W22.js} +1 -1
  8. package/dist/{chunk-YGBBHKBE.js → chunk-6FXQINND.js} +2 -2
  9. package/dist/{chunk-OUQZC744.js → chunk-B5CH47OS.js} +852 -74
  10. package/dist/chunk-C26I6HTO.js +39 -0
  11. package/dist/{chunk-6QV2BFGA.js → chunk-GSCXFJB7.js} +1 -1
  12. package/dist/{chunk-KI6ZHBPV.js → chunk-HRILMD5N.js} +312 -11
  13. package/dist/{chunk-OZ4QV6LM.js → chunk-KIXK7KOW.js} +42 -148
  14. package/dist/chunk-P6PMKYWU.js +50 -0
  15. package/dist/{chunk-WW3YZKHW.js → chunk-RZ5TNBHU.js} +25 -4
  16. package/dist/{chunk-TFZ2JUXH.js → chunk-TOWH3XCJ.js} +520 -70
  17. package/dist/{chunk-CGTE7DHN.js → chunk-TZYKLR5J.js} +135 -20
  18. package/dist/{chunk-5OXPNVCF.js → chunk-UEKWZ7BN.js} +2 -2
  19. package/dist/chunk-WGLPZXNU.js +45 -0
  20. package/dist/{chunk-VS2JD2XC.js → chunk-WSJ77EHO.js} +5 -2
  21. package/dist/{chunk-VGZBARQC.js → chunk-YJMZ6UM2.js} +2 -2
  22. package/dist/{chunk-XZZAVHH4.js → chunk-YMYLO5LG.js} +2 -2
  23. package/dist/{chunk-XWPO3VYQ.js → chunk-ZDCEAGD4.js} +1 -1
  24. package/dist/{contribute-YKK6YCSI.js → contribute-LFT762Y4.js} +4 -4
  25. package/dist/{diff-YTR7VOAN.js → diff-56KMRCER.js} +5 -5
  26. package/dist/doctor-AA64XVEY.js +237 -0
  27. package/dist/{handoff-3UI6VKVG.js → handoff-34SDU4FF.js} +2 -2
  28. package/dist/{hook-MUV6Y7UW.js → hook-KRIXBLNW.js} +7 -7
  29. package/dist/index.js +19 -17
  30. package/dist/{init-TTTKGC4C.js → init-XP5EAUSJ.js} +12 -11
  31. package/dist/{install-ZMFJBPOI.js → install-SHDEX54F.js} +12 -11
  32. package/dist/{plan-index-JMC7Z4DW.js → plan-index-O3545OA7.js} +2 -2
  33. package/dist/{run-I3BFGULT.js → run-FADX6QCP.js} +6 -5
  34. package/dist/{run-plan-FO7CL4M3.js → run-plan-MO4IFAKV.js} +36 -5
  35. package/dist/{setup-global-JUVMJXJ5.js → setup-global-CBWLXOQG.js} +6 -6
  36. package/dist/{status-MVCUNCWX.js → status-BSIXWZMY.js} +19 -7
  37. package/dist/{update-Q4EBIRUB.js → update-FJX3DA6X.js} +33 -10
  38. package/package.json +3 -3
  39. package/dist/chunk-5VCOWTTP.js +0 -6
  40. package/dist/doctor-TA2FWREU.js +0 -497
@@ -10,7 +10,7 @@ directly, and `packages/cli/dashboard/` is a generated copy (gitignored, produce
10
10
  | `start.mjs` / `start-broadcast.mjs` | loopback and LAN entry points, per-workspace port allocation |
11
11
  | `dashboard-data.mjs` | snapshot builder for the panel |
12
12
  | `dashboard.html`, `open.html` | panel and share shell |
13
- | `lib/*.mjs` | guards, semantic model, live refresh, browser open, terminal snapshot |
13
+ | `lib/*.mjs` | guards, semantic model, live refresh, browser open, terminal snapshot, headless run feed (`run-logs.mjs`) |
14
14
  | `lib/guards.d.mts` | hand-written types consumed by the CLI package (parity is pinned by a test) |
15
15
 
16
16
  ## Where the tests live
@@ -24,6 +24,15 @@ before it fans out to the workspace packages).
24
24
  `dashboard.html` is outside Biome's scope; CSS/HTML-only changes are covered by
25
25
  `packages/cli/src/dashboard/plugin-ux-validation.test.ts` instead.
26
26
 
27
+ ## Embedding (action seam, CSP readiness)
28
+
29
+ A host page can replace the copy-to-clipboard default by defining
30
+ `window.__MISSION_CONTROL_ACTIONS__ = { perform(action) }` before the panel's script runs;
31
+ every action is one `{ kind: "copy", text, subject, destination, toastMessage }` record. The web
32
+ dashboard keeps the copy-only default. Contract, CSP readiness counts and the innerHTML sink
33
+ audit: `docs/mission-control-embedding.md`. The snapshot shape is versioned by `dashboardDataVersion`
34
+ and published as `docs/contracts/mission-control-snapshot.schema.json`.
35
+
27
36
  ## Git tab and DevOps tab
28
37
 
29
38
  The Git tab (`#git`) keeps the pre-rendered `git log --graph` markdown block and adds a
@@ -17,6 +17,7 @@ import {
17
17
  import { projectSlugFromRoot } from "./lib/live-refresh.mjs";
18
18
  import { PIPELINE_CACHE_ENV, readCachedPipeline } from "./lib/pipeline-cache.mjs";
19
19
  import { selectWorkspaceProcesses } from "./lib/processes.mjs";
20
+ import { collectRunLogs } from "./lib/run-logs.mjs";
20
21
  import {
21
22
  EXTERNAL_REPORT_FILE_RE,
22
23
  FIELD_REPORT_CADENCE_LEDGER_REL,
@@ -131,7 +132,7 @@ function redactTerminalOutput(text) {
131
132
 
132
133
  const SNAPSHOT = {
133
134
  _schema: {
134
- version: "1.3.0",
135
+ version: "1.5.0",
135
136
  description: "Mission Control dashboard data model",
136
137
  fields: {
137
138
  generatedAt: "ISO-8601 timestamp of snapshot generation",
@@ -148,6 +149,8 @@ const SNAPSHOT = {
148
149
  "Best-effort DevOps signal: pipeline ({available, runs[], reason?} recent gh run list rows; reason is 'budget' when the shared snapshot budget ran out before gh was attempted, or 'call-failed' when gh was attempted and missing/unauthenticated/timed out/errored; reason is only present when available is false; fetchedAt is the ISO time gh was last attempted, reused from serve.mjs for up to 60s) and deploy ({tags[], changelog} v* git tags + latest CHANGELOG release entry as a 'what shipped recently' proxy, not a live infra poll)",
149
150
  terminals:
150
151
  "Active Cursor terminal sessions with metadata, output line count, and capped lastOutput",
152
+ runLogs:
153
+ "Newest headless agent-kit run / tick logs from <state root>/loop-logs (AGENT_KIT_STATE_ROOT: .cursor by default, or .agent-kit; no ~/.cursor dependency): format, session id, capped last agent text, result, LOOP_TICK_RESULT line, HITL gate ids and reply stamps (1.5.0)",
151
154
  processes:
152
155
  "Running process snapshots (node, serve.mjs, git operations) with elapsed time and a generated narration per process",
153
156
  skills: "Available skills discovered in .cursor/skills/",
@@ -156,7 +159,7 @@ const SNAPSHOT = {
156
159
  },
157
160
  },
158
161
  generatedAt: new Date().toISOString(),
159
- dashboardDataVersion: "1.4.0",
162
+ dashboardDataVersion: "1.5.0",
160
163
  plans: [],
161
164
  system: {
162
165
  repoRoot: ROOT,
@@ -167,6 +170,7 @@ const SNAPSHOT = {
167
170
  memory: {},
168
171
  git: {},
169
172
  terminals: [],
173
+ runLogs: [],
170
174
  processes: [],
171
175
  skills: [],
172
176
  health: { status: "ok", checks: [] },
@@ -769,6 +773,12 @@ if (existsSync(terminalProjectPath)) {
769
773
  }
770
774
  }
771
775
 
776
+ // 7b. Headless run feed (<state root>/loop-logs, AGENT_KIT_STATE_ROOT): the kit's own transcript source,
777
+ // independent of ~/.cursor/projects (embeddable contract, 1.5.0).
778
+ if (withinSnapshotBudget(200)) {
779
+ SNAPSHOT.runLogs = collectRunLogs(ROOT, { redact: redactTerminalOutput });
780
+ }
781
+
772
782
  // 8. Config
773
783
  const configPath = join(ROOT, ".cursor", "context", "config.json");
774
784
  if (existsSync(configPath)) {
@@ -4874,6 +4874,8 @@ function copyActionTitle(subject, destination, text) {
4874
4874
  function copyForPaste(text, subject, destination) {
4875
4875
  return copyToClipboard(text, {
4876
4876
  toastMessage: copyToastMessage(subject || text, destination, text),
4877
+ subject: subject || '',
4878
+ destination: destination || '',
4877
4879
  });
4878
4880
  }
4879
4881
 
@@ -5185,6 +5187,8 @@ async function copyRepoPath(relPath) {
5185
5187
  if (!relPath) return;
5186
5188
  await copyToClipboard(relPath, {
5187
5189
  toastMessage: pathCopyToastMessage(relPath),
5190
+ subject: `path ${relPath}`,
5191
+ destination: 'filePicker',
5188
5192
  });
5189
5193
  }
5190
5194
 
@@ -5683,6 +5687,42 @@ function renderGitHygieneHint(git) {
5683
5687
  `;
5684
5688
  }
5685
5689
 
5690
+ // ===== Action seam (contract: docs/mission-control-embedding.md) =====
5691
+ /**
5692
+ * One action interface, two implementations. Every dashboard action is a typed
5693
+ * `{ kind: 'copy', text, subject, destination, toastMessage }` record. The open
5694
+ * web dashboard keeps the default implementation: copy to the clipboard and
5695
+ * name the paste destination (copy-only, ADR 2026-07-25). A host page (an
5696
+ * embedding app) may define `window.__MISSION_CONTROL_ACTIONS__ = { perform(action) }`
5697
+ * before this script runs; it then receives the frozen record instead and
5698
+ * validates it host-side against its own allowlist. The dashboard never names
5699
+ * a command for a host to run and adds no other action kind.
5700
+ * Contract: docs/mission-control-embedding.md.
5701
+ */
5702
+ const MISSION_CONTROL_ACTION_KINDS = Object.freeze(['copy']);
5703
+
5704
+ /** Host action implementation injected by an embedding page, or null (web default). */
5705
+ function missionControlActionHost() {
5706
+ const host = typeof window !== 'undefined' ? window.__MISSION_CONTROL_ACTIONS__ : null;
5707
+ return host && typeof host.perform === 'function' ? host : null;
5708
+ }
5709
+
5710
+ /**
5711
+ * Hand one action record to the injected host. The host's `{ message }` (or
5712
+ * the copy-vocabulary label) is confirmed in the toast; a rejection is shown
5713
+ * as an error and never retried here.
5714
+ */
5715
+ async function performHostAction(host, action, opts) {
5716
+ try {
5717
+ const result = await host.perform(Object.freeze({ ...action }));
5718
+ const message = result && typeof result.message === 'string' ? result.message : action.toastMessage;
5719
+ if (!opts.silent) showToast(message, !!(result && result.ok === false));
5720
+ } catch (err) {
5721
+ const reason = err && err.message ? err.message : String(err);
5722
+ showToast(`Action failed: ${reason}`, true);
5723
+ }
5724
+ }
5725
+
5686
5726
  // ===== Copy to clipboard + toast (Phase 1) =====
5687
5727
  /** Fallback confirmation. Callers should pass a destination-aware message. */
5688
5728
  function copyToastLabel(text) {
@@ -5692,6 +5732,20 @@ function copyToastLabel(text) {
5692
5732
  async function copyToClipboard(text, options) {
5693
5733
  const opts = options || {};
5694
5734
  const label = opts.toastMessage || copyToastLabel(text);
5735
+ const host = missionControlActionHost();
5736
+ if (host) {
5737
+ return performHostAction(
5738
+ host,
5739
+ {
5740
+ kind: MISSION_CONTROL_ACTION_KINDS[0],
5741
+ text: String(text ?? ''),
5742
+ subject: String(opts.subject || ''),
5743
+ destination: String(opts.destination || ''),
5744
+ toastMessage: label,
5745
+ },
5746
+ opts,
5747
+ );
5748
+ }
5695
5749
  try {
5696
5750
  if (navigator.clipboard && navigator.clipboard.writeText) {
5697
5751
  await navigator.clipboard.writeText(text);
@@ -5999,6 +6053,8 @@ function copyConfigSnippet(group) {
5999
6053
  for (const key of keys) snippet[key] = payload[key];
6000
6054
  void copyToClipboard(JSON.stringify(snippet, null, 2), {
6001
6055
  toastMessage: 'Copied config snippet - paste into .cursor/context/config.json',
6056
+ subject: 'config snippet',
6057
+ destination: '.cursor/context/config.json',
6002
6058
  });
6003
6059
  return false;
6004
6060
  }
@@ -6014,6 +6070,8 @@ function copyStaticConfigSnippet(id) {
6014
6070
  if (!snippet) return false;
6015
6071
  void copyToClipboard(JSON.stringify(snippet, null, 2), {
6016
6072
  toastMessage: 'Copied config snippet - paste into .cursor/context/config.json (not writable via tab)',
6073
+ subject: 'config snippet',
6074
+ destination: '.cursor/context/config.json',
6017
6075
  });
6018
6076
  return false;
6019
6077
  }
@@ -0,0 +1,34 @@
1
+ /** Ambient types for dashboard/lib/run-logs.mjs (consumed by CLI TypeScript). */
2
+
3
+ export const MAX_RUN_LOGS: 10;
4
+ export const MAX_RUN_LOG_BYTES: number;
5
+ export const MAX_RUN_LOG_TEXT: 600;
6
+
7
+ export interface RunLogSummary {
8
+ format: "stream-json" | "codex" | "acp" | null;
9
+ sessionId: string | null;
10
+ events: number;
11
+ lastText: string;
12
+ result: { isError: boolean; subtype: string | null; text: string } | null;
13
+ sentinel: string | null;
14
+ gates: string[];
15
+ replies: string[];
16
+ }
17
+
18
+ export interface RunLogRow extends RunLogSummary {
19
+ id: string;
20
+ kind: "tick" | "run";
21
+ path: string;
22
+ updatedAt: string;
23
+ bytes: number;
24
+ source: "loop-logs";
25
+ }
26
+
27
+ export function resolveRunnerStateDir(
28
+ env?: Record<string, string | undefined>,
29
+ ): ".cursor" | ".agent-kit";
30
+ export function summarizeRunLog(text: string, redact?: (s: string) => string): RunLogSummary;
31
+ export function collectRunLogs(
32
+ root: string,
33
+ opts?: { stateDir?: string; redact?: (s: string) => string; max?: number },
34
+ ): RunLogRow[];
@@ -0,0 +1,218 @@
1
+ /**
2
+ * Headless run feed for Mission Control: the kit's own `.cursor/loop-logs/`
3
+ * (`tick-*.log` from `agent-kit run-plan`, `run-*.log` from `agent-kit run`),
4
+ * so the panel and an embedding host can show agent output, gates and tick
5
+ * results without reading `~/.cursor/projects` (ADR 2026-10-08
6
+ * mission-control-embeddable-contract).
7
+ *
8
+ * The logs are already redacted when the CLI writes them; a caller-supplied
9
+ * `redact` runs again over every string this module returns. Read-only and
10
+ * bounded: newest MAX_RUN_LOGS files, the last MAX_RUN_LOG_BYTES of each.
11
+ * Understands the three shapes the backends write: claude / cursor-agent
12
+ * stream-json, codex `exec --json`, and the cursor-acp JSON-RPC transcript.
13
+ */
14
+ import { readFileSync, readdirSync, statSync } from "node:fs";
15
+ import { join } from "node:path";
16
+
17
+ export const MAX_RUN_LOGS = 10;
18
+ export const MAX_RUN_LOG_BYTES = 256 * 1024;
19
+ export const MAX_RUN_LOG_TEXT = 600;
20
+ const MAX_LIST = 10;
21
+
22
+ const LOG_NAME_RE = /^(tick|run)-[0-9-]+\.log$/;
23
+ const GATE_RE = /^HITL_GATE:\s*([a-z0-9-]+)\s*\|/m;
24
+ const SENTINEL_RE = /LOOP_TICK_RESULT:\s*(continue|stop(?:\s*[—-].*)?)/i;
25
+ const REPLY_RE = /HITL_REPLY:\s*[a-z0-9-]+\s*\|[^\n]*/;
26
+
27
+ const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
28
+
29
+ function cap(text, max = MAX_RUN_LOG_TEXT) {
30
+ const s = String(text ?? "").trim();
31
+ return s.length > max ? `${s.slice(0, max - 1)}…` : s;
32
+ }
33
+
34
+ function textOf(content) {
35
+ if (typeof content === "string") return content;
36
+ if (!Array.isArray(content)) return "";
37
+ return content
38
+ .map((part) => (isRecord(part) && typeof part.text === "string" ? part.text : ""))
39
+ .join("");
40
+ }
41
+
42
+ /**
43
+ * Summary of one log's text: backend shape, session id, last agent text,
44
+ * the final result, the `LOOP_TICK_RESULT` line, gate ids and reply stamps.
45
+ * Never throws; unknown lines are skipped.
46
+ */
47
+ export function summarizeRunLog(text, redact = (s) => s) {
48
+ const out = {
49
+ format: null,
50
+ sessionId: null,
51
+ events: 0,
52
+ lastText: "",
53
+ result: null,
54
+ sentinel: null,
55
+ gates: [],
56
+ replies: [],
57
+ };
58
+ let acpTurn = "";
59
+ const noteText = (t) => {
60
+ if (!t) return;
61
+ out.lastText = t;
62
+ const gate = GATE_RE.exec(t);
63
+ if (gate?.[1] && out.gates.length < MAX_LIST) out.gates.push(gate[1]);
64
+ };
65
+ const noteReply = (t) => {
66
+ const m = REPLY_RE.exec(t);
67
+ if (m && out.replies.length < MAX_LIST) out.replies.push(m[0].trim());
68
+ };
69
+ for (const raw of String(text ?? "").split("\n")) {
70
+ const line = raw.trim();
71
+ if (!line.startsWith("{")) continue;
72
+ let ev;
73
+ try {
74
+ ev = JSON.parse(line);
75
+ } catch {
76
+ continue;
77
+ }
78
+ if (!isRecord(ev)) continue;
79
+ out.events += 1;
80
+ // cursor-acp: JSON-RPC 2.0 transcript (both directions).
81
+ if (ev.jsonrpc === "2.0") {
82
+ out.format ??= "acp";
83
+ const params = isRecord(ev.params) ? ev.params : null;
84
+ if (ev.method === "session/update" && isRecord(params?.update)) {
85
+ const u = params.update;
86
+ if (u.sessionUpdate === "agent_message_chunk" && isRecord(u.content)) {
87
+ acpTurn += typeof u.content.text === "string" ? u.content.text : "";
88
+ }
89
+ } else if (ev.method === "session/prompt" && params) {
90
+ noteReply(textOf(params.prompt));
91
+ } else if (isRecord(ev.result) && typeof ev.result.sessionId === "string") {
92
+ out.sessionId = ev.result.sessionId;
93
+ } else if (isRecord(ev.result) && typeof ev.result.stopReason === "string") {
94
+ noteText(acpTurn);
95
+ out.result = { isError: false, subtype: ev.result.stopReason, text: cap(acpTurn) };
96
+ acpTurn = "";
97
+ } else if (isRecord(ev.error) && ev.id !== undefined && !ev.method) {
98
+ const message = typeof ev.error.message === "string" ? ev.error.message : "error";
99
+ out.result = { isError: true, subtype: "error", text: cap(message) };
100
+ }
101
+ continue;
102
+ }
103
+ const type = ev.type;
104
+ // codex exec --json
105
+ if (type === "thread.started" || type === "turn.completed" || type === "turn.failed") {
106
+ out.format ??= "codex";
107
+ }
108
+ if (type === "thread.started" && typeof ev.thread_id === "string") out.sessionId = ev.thread_id;
109
+ else if (type === "item.completed" && isRecord(ev.item)) {
110
+ const kind = ev.item.type ?? ev.item.item_type;
111
+ if (
112
+ (kind === "agent_message" || kind === "assistant_message") &&
113
+ typeof ev.item.text === "string"
114
+ ) {
115
+ noteText(ev.item.text);
116
+ }
117
+ } else if (type === "turn.completed") {
118
+ out.result = { isError: false, subtype: "success", text: cap(out.lastText) };
119
+ } else if (type === "turn.failed") {
120
+ const message =
121
+ isRecord(ev.error) && typeof ev.error.message === "string" ? ev.error.message : "failed";
122
+ out.result = { isError: true, subtype: "error", text: cap(message) };
123
+ }
124
+ // claude / cursor-agent stream-json
125
+ else if (type === "system" && ev.subtype === "init") {
126
+ out.format ??= "stream-json";
127
+ if (typeof ev.session_id === "string") out.sessionId = ev.session_id;
128
+ } else if (type === "assistant" && isRecord(ev.message)) {
129
+ noteText(textOf(ev.message.content));
130
+ } else if (type === "user" && ev.isReplay === true && isRecord(ev.message)) {
131
+ noteReply(textOf(ev.message.content));
132
+ } else if (type === "result") {
133
+ out.format ??= "stream-json";
134
+ const resultText = typeof ev.result === "string" ? ev.result : "";
135
+ if (resultText) noteText(resultText);
136
+ out.result = {
137
+ isError: ev.is_error === true,
138
+ subtype: typeof ev.subtype === "string" ? ev.subtype : null,
139
+ text: cap(resultText),
140
+ };
141
+ }
142
+ }
143
+ const sentinel = SENTINEL_RE.exec(out.result?.text || out.lastText);
144
+ out.sentinel = sentinel ? `LOOP_TICK_RESULT: ${sentinel[1].trim()}` : null;
145
+ out.lastText = cap(out.lastText);
146
+ out.gates = [...new Set(out.gates)];
147
+ out.lastText = redact(out.lastText);
148
+ if (out.result) out.result.text = redact(out.result.text);
149
+ out.replies = out.replies.map((r) => redact(r));
150
+ return out;
151
+ }
152
+
153
+ /**
154
+ * Runner state dir for the loop logs: mirrors `resolveStateDir` in
155
+ * packages/cli/src/utils/kit-paths.ts (`AGENT_KIT_STATE_ROOT`, `.cursor` or
156
+ * `.agent-kit`, anything else falls back to `.cursor`). HTML/ESM cannot import
157
+ * the TS module; a parity test keeps the two in step.
158
+ */
159
+ export function resolveRunnerStateDir(env = process.env) {
160
+ const raw = String(env?.AGENT_KIT_STATE_ROOT ?? "")
161
+ .trim()
162
+ .replace(/\/+$/, "");
163
+ return raw === ".agent-kit" ? ".agent-kit" : ".cursor";
164
+ }
165
+
166
+ /** Read the tail of a file (the newest events matter; the head may be a long prompt echo). */
167
+ function readTail(file, size) {
168
+ const text = readFileSync(file, "utf8");
169
+ if (size <= MAX_RUN_LOG_BYTES) return text;
170
+ const tail = text.slice(-MAX_RUN_LOG_BYTES);
171
+ const cut = tail.indexOf("\n");
172
+ return cut === -1 ? tail : tail.slice(cut + 1);
173
+ }
174
+
175
+ /**
176
+ * Rows for the newest headless logs under `<root>/<stateDir>/loop-logs/`.
177
+ * A missing directory or unreadable file yields fewer rows, never an error.
178
+ */
179
+ export function collectRunLogs(root, opts = {}) {
180
+ const stateDir = opts.stateDir ?? resolveRunnerStateDir();
181
+ const redact = typeof opts.redact === "function" ? opts.redact : (s) => s;
182
+ const max = opts.max ?? MAX_RUN_LOGS;
183
+ const dir = join(root, stateDir, "loop-logs");
184
+ let names;
185
+ try {
186
+ names = readdirSync(dir).filter((f) => LOG_NAME_RE.test(f));
187
+ } catch {
188
+ return [];
189
+ }
190
+ const files = [];
191
+ for (const name of names) {
192
+ try {
193
+ const st = statSync(join(dir, name));
194
+ if (st.isFile()) files.push({ name, mtimeMs: st.mtimeMs, size: st.size });
195
+ } catch {
196
+ // vanished between readdir and stat
197
+ }
198
+ }
199
+ files.sort((a, b) => b.mtimeMs - a.mtimeMs || (a.name < b.name ? 1 : -1));
200
+ const rows = [];
201
+ for (const f of files.slice(0, max)) {
202
+ try {
203
+ const summary = summarizeRunLog(readTail(join(dir, f.name), f.size), redact);
204
+ rows.push({
205
+ id: f.name,
206
+ kind: f.name.startsWith("tick-") ? "tick" : "run",
207
+ path: `${stateDir}/loop-logs/${f.name}`,
208
+ updatedAt: new Date(f.mtimeMs).toISOString(),
209
+ bytes: f.size,
210
+ source: "loop-logs",
211
+ ...summary,
212
+ });
213
+ } catch {
214
+ // unreadable log: skipped
215
+ }
216
+ }
217
+ return rows;
218
+ }
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  REGISTRY_CLI_ARGS,
7
7
  resolveRegistryFromCli
8
- } from "./chunk-XWPO3VYQ.js";
8
+ } from "./chunk-ZDCEAGD4.js";
9
9
  import {
10
10
  logger
11
11
  } from "./chunk-ZB43YMHW.js";
@@ -22,11 +22,11 @@ import {
22
22
  resolveProtectedGlobs,
23
23
  saveManifest,
24
24
  upsertIdList
25
- } from "./chunk-VS2JD2XC.js";
26
- import "./chunk-5VCOWTTP.js";
25
+ } from "./chunk-WSJ77EHO.js";
27
26
  import {
28
27
  KIT_VERSION
29
28
  } from "./chunk-7HDQEK6T.js";
29
+ import "./chunk-C26I6HTO.js";
30
30
  import "./chunk-77V75A7O.js";
31
31
 
32
32
  // src/commands/add.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HANDOFF_REL
3
- } from "./chunk-5VCOWTTP.js";
3
+ } from "./chunk-C26I6HTO.js";
4
4
  import {
5
5
  ensureDir
6
6
  } from "./chunk-77V75A7O.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  managedPairs
3
- } from "./chunk-6QV2BFGA.js";
3
+ } from "./chunk-GSCXFJB7.js";
4
4
  import {
5
5
  isProtectedPath,
6
6
  resolveContained,
7
7
  resolveProtectedGlobs
8
- } from "./chunk-VS2JD2XC.js";
8
+ } from "./chunk-WSJ77EHO.js";
9
9
 
10
10
  // src/lifecycle/diff.ts
11
11
  import { readFile } from "fs/promises";