@rucher/carnet 0.2.0-beta.7 → 0.2.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.
@@ -24,10 +24,7 @@ const EVENT_TYPES = [
24
24
  "applied",
25
25
  "tested",
26
26
  "committed",
27
- "dropped",
28
- "injected",
29
- "promoted",
30
- "triaged"
27
+ "dropped"
31
28
  ];
32
29
  const SESSION_EVENT_TYPES = [
33
30
  "session.started",
@@ -56,10 +53,9 @@ function logEvent(ctx, session, input) {
56
53
  const result = ctx.db.prepare("INSERT INTO events (session, at, type, agent, commit_sha, link, note) VALUES (?, ?, ?, ?, ?, ?, ?)").run(session, nowIso(ctx), input.type, input.agent ?? null, input.commit ?? null, input.link ?? null, input.note ?? null);
57
54
  return toEvent(ctx.db.prepare("SELECT * FROM events WHERE id = ?").get(result.lastInsertRowid));
58
55
  }
59
- function readEvents(ctx, { session, limit = 20, agentOnly = false, kind }) {
60
- const filters = [agentOnly ? "AND type NOT LIKE 'session.%'" : "", kind ? "AND agent IN (SELECT name FROM agents WHERE session = events.session AND kind = ?)" : ""].join(" ");
61
- const parameters = kind ? [session, kind] : [session];
62
- return ctx.db.prepare(`SELECT * FROM (SELECT * FROM events WHERE session = ? ${filters} ORDER BY at DESC, id DESC LIMIT ?) ORDER BY at, id`).all(...parameters, limit).map(toEvent);
56
+ function readEvents(ctx, { session, limit = 20, agentOnly = false }) {
57
+ const filter = agentOnly ? "AND type NOT LIKE 'session.%'" : "";
58
+ return ctx.db.prepare(`SELECT * FROM (SELECT * FROM events WHERE session = ? ${filter} ORDER BY at DESC, id DESC LIMIT ?) ORDER BY at, id`).all(session, limit).map(toEvent);
63
59
  }
64
60
  // src/status/model.ts
65
61
  const AGENT_STATUSES = [
@@ -93,16 +89,7 @@ const EMOJI = {
93
89
  branch: "🌿"
94
90
  };
95
91
  const MAIN_WORKING_EMOJI = "⚙️";
96
- const MAIN_WAITING_EMOJI = "⏸";
97
- const MAIN_FAILED_EMOJI = "⚠";
98
- const LEGEND = "⚙️ main working · ⏸ waiting on you · ⚠ turn failed · 💬 discussing · ❓ answer · 👀 review · 📥 apply · 🧪 test · ✅ commit · 🌿 branch · ⏳ running";
99
- const KIND_ABBREVIATIONS = {
100
- research: "rs",
101
- analyze: "an",
102
- implement: "im",
103
- review: "rv"
104
- };
105
- const KIND_LEGEND = "rs research · an analyze · im implement · rv review";
92
+ const LEGEND = "⚙️ main working · 💬 discussing · ❓ answer · 👀 review · 📥 apply · 🧪 test · ✅ commit · 🌿 branch · ⏳ running";
106
93
  function isAgentStatus(value) {
107
94
  return typeof value === "string" && AGENT_STATUSES.includes(value);
108
95
  }
@@ -125,34 +112,10 @@ function sanitizeNote(text) {
125
112
  return `${cleaned.slice(0, 59).trimEnd()}…`;
126
113
  }
127
114
  // src/agents.ts
128
- const AGENT_KINDS = [
129
- "research",
130
- "analyze",
131
- "implement",
132
- "review"
133
- ];
134
- const DEFAULT_AGENT_KIND = "analyze";
135
- const FINAL_ACTIONS = {
136
- research: "inject",
137
- analyze: "validate",
138
- implement: "apply",
139
- review: "triage"
140
- };
141
- function isAgentKind(value) {
142
- return typeof value === "string" && AGENT_KINDS.includes(value);
143
- }
144
- const MAIN_TARGET = /^main(?::(.+))?$/;
145
- function mainTargetRange(target) {
146
- const match = MAIN_TARGET.exec(target);
147
- return match ? match[1]?.trim() ?? null : void 0;
148
- }
149
115
  function toAgent(row) {
150
116
  return {
151
117
  session: row.session,
152
118
  name: row.name,
153
- kind: row.kind,
154
- promotedFrom: row.promoted_from,
155
- target: row.target,
156
119
  task: row.task,
157
120
  status: row.status,
158
121
  note: row.note,
@@ -194,27 +157,14 @@ function requireAgent(ctx, session, name) {
194
157
  if (!agent) throw new CarnetError("AGENT_NOT_FOUND", `No agent "${name}" in this session`);
195
158
  return agent;
196
159
  }
197
- function checkReviewTarget(ctx, session, target) {
198
- if (mainTargetRange(target) !== void 0) return;
199
- const agent = getAgent(ctx, session, target);
200
- if (!agent || agent.kind !== "implement") throw new CarnetError("INVALID_TARGET", `Target "${target}" is not an implement agent of this session; use its name, or main[:<range>]`);
201
- if (agent.status === "running") throw new CarnetError("INVALID_TARGET", `Target "${target}" is still running`);
202
- if (agent.status === "closed") throw new CarnetError("INVALID_TARGET", `Target "${target}" is closed; review main[:<range>] instead`);
203
- }
204
160
  function startAgent(ctx, session, input) {
205
161
  const name = sanitizeNote(input.name);
206
- const kind = input.kind ?? "analyze";
207
- const target = input.target?.trim() || null;
208
- if (kind === "review" && !target) throw new CarnetError("INVALID_TARGET", "A review needs a target: an implement agent name, or main[:<range>]");
209
- if (kind !== "review" && target) throw new CarnetError("INVALID_TARGET", "Only a review agent takes a target");
210
- if (target) checkReviewTarget(ctx, session, target);
211
162
  const existing = getAgent(ctx, session, name);
212
163
  if (existing && existing.status !== "closed") throw new CarnetError("AGENT_EXISTS", `Agent "${name}" is already open in this session`);
213
164
  if (existing) ctx.db.prepare("DELETE FROM agents WHERE session = ? AND name = ?").run(session, name);
214
165
  const at = nowIso(ctx);
215
- ctx.db.prepare(`INSERT INTO agents (session, name, kind, target, task, status, base_commit, worktree,
216
- started_at, updated_at)
217
- VALUES (?, ?, ?, ?, ?, 'running', ?, ?, ?, ?)`).run(session, name, kind, target, input.task, input.baseCommit ?? null, input.worktree ?? null, at, at);
166
+ ctx.db.prepare(`INSERT INTO agents (session, name, task, status, base_commit, worktree, started_at, updated_at)
167
+ VALUES (?, ?, ?, 'running', ?, ?, ?, ?)`).run(session, name, input.task, input.baseCommit ?? null, input.worktree ?? null, at, at);
218
168
  logEvent(ctx, session, {
219
169
  type: "started",
220
170
  agent: name,
@@ -225,54 +175,26 @@ function startAgent(ctx, session, input) {
225
175
  function updateAgent(ctx, session, name, input) {
226
176
  const current = requireAgent(ctx, session, name);
227
177
  if (!isAgentStatus(input.status) || input.status === "closed") throw new CarnetError("INVALID_STATUS", `Invalid agent status "${input.status}"; use agent_drop to close`);
228
- let note;
229
- if (input.note !== void 0) note = input.note === null ? null : sanitizeNote(input.note);
230
- else note = current.status === "running" && input.status !== "running" ? null : current.note;
178
+ const note = input.note === void 0 ? null : sanitizeNote(input.note);
231
179
  if (current.pendingStatus) publishPending(ctx, session, name);
232
- ctx.db.prepare("UPDATE agents SET note = ?, status = ?, report_path = COALESCE(?, report_path), updated_at = ? WHERE session = ? AND name = ?").run(note, input.status, input.reportPath ?? null, nowIso(ctx), session, name);
180
+ ctx.db.prepare("UPDATE agents SET note = COALESCE(?, CASE WHEN status = 'running' AND ? <> 'running' THEN NULL ELSE note END), status = ?, report_path = COALESCE(?, report_path), updated_at = ? WHERE session = ? AND name = ?").run(note, input.status, input.status, input.reportPath ?? null, nowIso(ctx), session, name);
233
181
  return requireAgent(ctx, session, name);
234
182
  }
235
- function statusWhenDone(kind, hasQuestions) {
236
- if (hasQuestions) return "answer";
237
- return kind === "implement" ? "apply" : "review";
238
- }
239
183
  function finishAgent(ctx, session, name, input) {
240
184
  const agent = requireAgent(ctx, session, name);
241
- const status = statusWhenDone(agent.kind, input.hasQuestions);
185
+ const status = input.hasQuestions ? "answer" : "review";
242
186
  const at = nowIso(ctx);
243
187
  ctx.db.prepare("UPDATE agents SET pending_status = ?, note = ?, report_path = ?, done_at = ?, updated_at = ? WHERE session = ? AND name = ?").run(status, REPORTING_NOTE, input.reportPath, at, at, session, name);
244
188
  if (!agent.hostAgentId) publishPending(ctx, session, name);
245
189
  return requireAgent(ctx, session, name);
246
190
  }
247
- function statusAfterAnswers(kind) {
248
- return kind === "implement" ? "apply" : "review";
249
- }
250
- function closeAgent(ctx, session, name, event) {
191
+ function dropAgent(ctx, session, name, reason) {
251
192
  requireAgent(ctx, session, name);
252
- ctx.db.prepare("UPDATE agents SET status = 'closed', pending_status = NULL, queue_order = NULL, updated_at = ? WHERE session = ? AND name = ?").run(nowIso(ctx), session, name);
193
+ ctx.db.prepare("UPDATE agents SET status = 'closed', queue_order = NULL, updated_at = ? WHERE session = ? AND name = ?").run(nowIso(ctx), session, name);
253
194
  logEvent(ctx, session, {
254
- ...event,
255
- agent: name
256
- });
257
- return requireAgent(ctx, session, name);
258
- }
259
- function dropAgent(ctx, session, name, reason) {
260
- return closeAgent(ctx, session, name, {
261
195
  type: "dropped",
262
- note: reason
263
- });
264
- }
265
- function promoteAgent(ctx, session, name, input) {
266
- const agent = requireAgent(ctx, session, name);
267
- if (agent.kind !== "analyze") throw new CarnetError("INVALID_KIND", `Only an analyze agent is promoted; ${name} is ${agent.kind}`);
268
- ctx.db.prepare(`UPDATE agents SET kind = 'implement', promoted_from = 'analyze', status = 'running',
269
- pending_status = NULL, note = NULL, worktree = COALESCE(?, worktree),
270
- base_commit = COALESCE(?, base_commit), updated_at = ?
271
- WHERE session = ? AND name = ?`).run(input.worktree ?? null, input.baseCommit ?? null, nowIso(ctx), session, name);
272
- logEvent(ctx, session, {
273
- type: "promoted",
274
196
  agent: name,
275
- note: "analyze to implement"
197
+ note: reason
276
198
  });
277
199
  return requireAgent(ctx, session, name);
278
200
  }
@@ -291,14 +213,6 @@ function reorderQueue(ctx, session, names) {
291
213
  return listAgents(ctx, session);
292
214
  }
293
215
  // src/db/schema.ts
294
- const DISPOSABLE_SESSION = `workspace IS NULL
295
- AND NOT EXISTS (SELECT 1 FROM agents WHERE agents.session = sessions.id)
296
- AND NOT EXISTS (
297
- SELECT 1 FROM events WHERE events.session = sessions.id AND events.type NOT LIKE 'session.%'
298
- )
299
- AND NOT EXISTS (SELECT 1 FROM notes WHERE notes.session = sessions.id OR notes.dropped_session = sessions.id)
300
- AND NOT EXISTS (SELECT 1 FROM note_citations WHERE note_citations.session = sessions.id)
301
- AND NOT EXISTS (SELECT 1 FROM sessions AS child WHERE child.parent_id = sessions.id)`;
302
216
  const migrations = [
303
217
  `
304
218
  CREATE TABLE sessions (
@@ -535,111 +449,8 @@ CREATE INDEX sessions_workspace_status ON sessions(workspace, status, last_activ
535
449
  CREATE UNIQUE INDEX sessions_workspace_name ON sessions(workspace, name)
536
450
  WHERE workspace IS NOT NULL AND name IS NOT NULL;
537
451
  CREATE UNIQUE INDEX notes_workspace_number ON notes(workspace, number);
538
- `,
539
- `
540
- DELETE FROM events WHERE session IN (SELECT id FROM sessions WHERE ${DISPOSABLE_SESSION});
541
- DELETE FROM table_items WHERE session IN (SELECT id FROM sessions WHERE ${DISPOSABLE_SESSION});
542
- DELETE FROM session_repos WHERE session IN (SELECT id FROM sessions WHERE ${DISPOSABLE_SESSION});
543
- DELETE FROM sessions WHERE ${DISPOSABLE_SESSION};
544
-
545
- CREATE TABLE sessions_new (
546
- id TEXT PRIMARY KEY,
547
- workspace TEXT NOT NULL,
548
- name TEXT,
549
- purpose TEXT,
550
- kind TEXT NOT NULL DEFAULT 'temp' CHECK (kind IN ('active', 'temp')),
551
- status TEXT NOT NULL DEFAULT 'idle' CHECK (status IN ('running', 'idle', 'archived')),
552
- cwd TEXT,
553
- repo TEXT,
554
- host TEXT NOT NULL DEFAULT 'claude-code',
555
- host_pid INTEGER,
556
- hooked_at TEXT,
557
- last_title TEXT,
558
- parent_id TEXT REFERENCES sessions(id),
559
- prompt_version TEXT,
560
- created_at TEXT NOT NULL,
561
- last_active_at TEXT NOT NULL,
562
- ended_at TEXT,
563
- turn TEXT CHECK (turn IN ('working', 'waiting', 'failed')),
564
- turn_started_at TEXT,
565
- CHECK (kind = 'temp' OR name IS NOT NULL)
566
- );
567
- INSERT INTO sessions_new (id, workspace, name, purpose, kind, status, cwd, repo, host, host_pid,
568
- hooked_at, last_title, parent_id, prompt_version, created_at, last_active_at, ended_at)
569
- SELECT id, workspace, name, purpose, kind, status, cwd, repo, host, host_pid,
570
- hooked_at, last_title, parent_id, prompt_version, created_at, last_active_at, ended_at
571
- FROM sessions;
572
- DROP TABLE sessions;
573
- ALTER TABLE sessions_new RENAME TO sessions;
574
- CREATE INDEX sessions_host_pid ON sessions(host, host_pid, hooked_at);
575
- CREATE INDEX sessions_workspace_status ON sessions(workspace, status, last_active_at);
576
- CREATE UNIQUE INDEX sessions_workspace_name ON sessions(workspace, name) WHERE name IS NOT NULL;
577
-
578
- ALTER TABLE table_items DROP COLUMN main_working;
579
-
580
- ALTER TABLE agents ADD COLUMN kind TEXT NOT NULL DEFAULT 'analyze'
581
- CHECK (kind IN ('research', 'analyze', 'implement', 'review'));
582
- ALTER TABLE agents ADD COLUMN promoted_from TEXT
583
- CHECK (promoted_from IN ('research', 'analyze', 'implement', 'review'));
584
- ALTER TABLE agents ADD COLUMN target TEXT;
585
- -- Older agents waiting on code steps, or given a worktree, wrote code.
586
- UPDATE agents SET kind = 'implement'
587
- WHERE (status IN ('apply', 'test', 'commit')) OR worktree IS NOT NULL;
588
-
589
- CREATE TABLE agent_questions (
590
- session TEXT NOT NULL,
591
- agent TEXT NOT NULL,
592
- n INTEGER NOT NULL CHECK (n >= 1),
593
- text TEXT NOT NULL,
594
- context TEXT,
595
- recommendation TEXT NOT NULL,
596
- alternatives TEXT NOT NULL DEFAULT '[]',
597
- answer TEXT,
598
- answered_at TEXT,
599
- PRIMARY KEY (session, agent, n),
600
- FOREIGN KEY (session, agent) REFERENCES agents(session, name) ON UPDATE CASCADE ON DELETE CASCADE
601
- );
602
-
603
- CREATE TABLE review_findings (
604
- session TEXT NOT NULL,
605
- agent TEXT NOT NULL,
606
- n INTEGER NOT NULL CHECK (n >= 1),
607
- severity TEXT NOT NULL CHECK (severity IN ('blocking', 'to_fix', 'suggestion')),
608
- location TEXT,
609
- text TEXT NOT NULL,
610
- fix TEXT,
611
- decision TEXT CHECK (decision IN ('sent', 'fixed', 'ignored')),
612
- reason TEXT,
613
- decided_at TEXT,
614
- PRIMARY KEY (session, agent, n),
615
- FOREIGN KEY (session, agent) REFERENCES agents(session, name) ON UPDATE CASCADE ON DELETE CASCADE
616
- );
617
-
618
- CREATE TABLE events_new (
619
- id INTEGER PRIMARY KEY,
620
- session TEXT NOT NULL REFERENCES sessions(id),
621
- at TEXT NOT NULL,
622
- type TEXT NOT NULL
623
- CHECK (type IN ('started', 'finished', 'answered', 'applied', 'tested', 'committed', 'dropped',
624
- 'injected', 'promoted', 'triaged',
625
- 'session.started', 'session.resumed', 'session.ended', 'session.forked')),
626
- agent TEXT,
627
- commit_sha TEXT,
628
- link TEXT,
629
- note TEXT
630
- );
631
- INSERT INTO events_new SELECT id, session, at, type, agent, commit_sha, link, note FROM events;
632
- DROP TABLE events;
633
- ALTER TABLE events_new RENAME TO events;
634
- CREATE INDEX events_session_at ON events(session, at);
635
452
  `
636
453
  ];
637
- const preconditions = { 11: (db) => {
638
- const kept = db.prepare(`SELECT id, name FROM sessions WHERE workspace IS NULL AND NOT (${DISPOSABLE_SESSION})`).all();
639
- if (kept.length === 0) return;
640
- const list = kept.map((row) => row.name ?? row.id).join(", ");
641
- throw new Error(`Every session now needs a workspace, and these sessions without one hold agents, notes or forks: ${list}. Give each one a workspace with the previous rucher (rucher sessions move), or in SQL: UPDATE sessions SET workspace = '<name>' WHERE id = '<id>'`);
642
- } };
643
454
  function schemaVersion(db) {
644
455
  return db.prepare("PRAGMA user_version").get().user_version;
645
456
  }
@@ -656,7 +467,6 @@ function migrate(db) {
656
467
  if (version < current) continue;
657
468
  db.exec("BEGIN");
658
469
  try {
659
- preconditions[version + 1]?.(db);
660
470
  db.exec(migration);
661
471
  if (foreignKeyViolations(db) > 0) throw new Error(`Migration ${version + 1} broke foreign keys`);
662
472
  db.exec(`PRAGMA user_version = ${version + 1}`);
@@ -727,101 +537,6 @@ function reportsDirectory(workspace) {
727
537
  function reportPath(workspace, agentName) {
728
538
  return join(reportsDirectory(workspace), `${agentName}.md`);
729
539
  }
730
- // src/findings.ts
731
- const FINDING_SEVERITIES = [
732
- "blocking",
733
- "to_fix",
734
- "suggestion"
735
- ];
736
- const FINDING_DECISIONS = [
737
- "sent",
738
- "fixed",
739
- "ignored"
740
- ];
741
- function listFindings(ctx, session, agent, pendingOnly = false) {
742
- const rows = ctx.db.prepare("SELECT * FROM review_findings WHERE session = ? AND agent = ? ORDER BY n").all(session, agent);
743
- const total = rows.length;
744
- return rows.filter((row) => !pendingOnly || row.decision === null).map((row) => ({
745
- ...row,
746
- total
747
- }));
748
- }
749
- function replaceFindings(ctx, session, agent, inputs) {
750
- const sorted = [...inputs].sort((a, b) => FINDING_SEVERITIES.indexOf(a.severity) - FINDING_SEVERITIES.indexOf(b.severity));
751
- ctx.db.prepare("DELETE FROM review_findings WHERE session = ? AND agent = ?").run(session, agent);
752
- const insert = ctx.db.prepare(`INSERT INTO review_findings (session, agent, n, severity, location, text, fix)
753
- VALUES (?, ?, ?, ?, ?, ?, ?)`);
754
- sorted.forEach((input, index) => {
755
- insert.run(session, agent, index + 1, input.severity, input.location?.trim() || null, input.text.trim(), input.fix?.trim() || null);
756
- });
757
- return listFindings(ctx, session, agent);
758
- }
759
- function decideFindings(ctx, session, agent, decisions) {
760
- const known = new Set(listFindings(ctx, session, agent).map((finding) => finding.n));
761
- const missing = decisions.filter((item) => !known.has(item.n)).map((item) => item.n);
762
- if (missing.length) throw new CarnetError("FINDING_NOT_FOUND", `No finding ${missing.join(", ")} for ${agent}; review_findings lists them`);
763
- const unexplained = decisions.filter((item) => item.decision === "ignored" && !item.reason?.trim());
764
- if (unexplained.length) throw new CarnetError("REASON_REQUIRED", `Ignoring finding ${unexplained.map((item) => item.n).join(", ")} needs a short reason`);
765
- const at = nowIso(ctx);
766
- const update = ctx.db.prepare("UPDATE review_findings SET decision = ?, reason = ?, decided_at = ? WHERE session = ? AND agent = ? AND n = ?");
767
- for (const item of decisions) update.run(item.decision, item.reason?.trim() || null, at, session, agent, item.n);
768
- return listFindings(ctx, session, agent);
769
- }
770
- function formatFinding(finding) {
771
- const location = finding.location ? ` ${finding.location}` : "";
772
- const fix = finding.fix ? ` (fix: ${finding.fix})` : "";
773
- return `${finding.n}/${finding.total} [${finding.severity}]${location} — ${finding.text}${fix}`;
774
- }
775
- function renderFindings(findings) {
776
- return `## Findings\n\n${findings.map((finding) => {
777
- const location = finding.location ? ` \`${finding.location}\`` : "";
778
- const fix = finding.fix ? `\n Fix: ${finding.fix}` : "";
779
- return `${finding.n}. **${finding.severity}**${location}: ${finding.text}${fix}`;
780
- }).join("\n")}`;
781
- }
782
- function listQuestions(ctx, session, agent, openOnly = false) {
783
- const rows = ctx.db.prepare("SELECT * FROM agent_questions WHERE session = ? AND agent = ? ORDER BY n").all(session, agent);
784
- const total = rows.length;
785
- return rows.filter((row) => !openOnly || row.answer === null).map((row) => ({
786
- n: row.n,
787
- total,
788
- text: row.text,
789
- context: row.context,
790
- recommendation: row.recommendation,
791
- alternatives: JSON.parse(row.alternatives),
792
- answer: row.answer,
793
- answeredAt: row.answered_at
794
- }));
795
- }
796
- function addQuestions(ctx, session, agent, inputs) {
797
- for (const input of inputs) if ((input.alternatives?.length ?? 0) > 3) throw new CarnetError("INVALID_QUESTIONS", `A question takes at most 3 alternatives; list more in its text`);
798
- ctx.db.prepare("DELETE FROM agent_questions WHERE session = ? AND agent = ? AND answer IS NULL").run(session, agent);
799
- const last = ctx.db.prepare("SELECT COALESCE(MAX(n), 0) AS n FROM agent_questions WHERE session = ? AND agent = ?").get(session, agent);
800
- const insert = ctx.db.prepare(`INSERT INTO agent_questions (session, agent, n, text, context, recommendation, alternatives)
801
- VALUES (?, ?, ?, ?, ?, ?, ?)`);
802
- inputs.forEach((input, index) => {
803
- insert.run(session, agent, last.n + index + 1, input.text.trim(), input.context?.trim() || null, input.recommendation.trim(), JSON.stringify(input.alternatives ?? []));
804
- });
805
- return listQuestions(ctx, session, agent);
806
- }
807
- function answerQuestions(ctx, session, agent, answers) {
808
- const known = new Set(listQuestions(ctx, session, agent).map((question) => question.n));
809
- const missing = answers.filter((answer) => !known.has(answer.n)).map((answer) => answer.n);
810
- if (missing.length) throw new CarnetError("QUESTION_NOT_FOUND", `No question ${missing.join(", ")} for ${agent}; agent_questions lists them`);
811
- const at = nowIso(ctx);
812
- const update = ctx.db.prepare("UPDATE agent_questions SET answer = ?, answered_at = ? WHERE session = ? AND agent = ? AND n = ?");
813
- for (const answer of answers) update.run(answer.answer.trim(), at, session, agent, answer.n);
814
- return listQuestions(ctx, session, agent);
815
- }
816
- function renderQuestions(questions) {
817
- return `## Questions\n\n${questions.map((question) => {
818
- const lines = [`${question.n}. ${question.text}`];
819
- if (question.context) lines.push(` Context: ${question.context}`);
820
- lines.push(` Recommendation: ${question.recommendation}`);
821
- if (question.alternatives.length) lines.push(` Alternatives: ${question.alternatives.join(" · ")}`);
822
- return lines.join("\n");
823
- }).join("\n")}`;
824
- }
825
540
  // src/workspace/workspace.ts
826
541
  const WORKSPACE_FILE = "workspace.json";
827
542
  const INSTRUCTIONS_FILE = "CLAUDE.md";
@@ -978,10 +693,6 @@ function toSession(row) {
978
693
  endedAt: row.ended_at
979
694
  };
980
695
  }
981
- function workspaceOf(ctx) {
982
- if (ctx.workspace !== null) return ctx.workspace;
983
- throw new CarnetError("NO_WORKSPACE", "A session belongs to a workspace: there is none here");
984
- }
985
696
  function getSession(ctx, id) {
986
697
  const row = ctx.db.prepare(`SELECT ${COLUMNS} FROM sessions WHERE id = ?`).get(id);
987
698
  return row && toSession(row);
@@ -995,7 +706,7 @@ function ensureSession(ctx, id, cwd, workspace) {
995
706
  const existing = getSession(ctx, id);
996
707
  if (existing) return existing;
997
708
  const at = nowIso(ctx);
998
- ctx.db.prepare("INSERT INTO sessions (id, workspace, cwd, repo, created_at, last_active_at) VALUES (?, ?, ?, ?, ?, ?)").run(id, workspaceOf(ctx), cwd ?? null, workspace ? repoNameFor(workspace, cwd) : null, at, at);
709
+ ctx.db.prepare("INSERT INTO sessions (id, workspace, cwd, repo, created_at, last_active_at) VALUES (?, ?, ?, ?, ?, ?)").run(id, ctx.workspace, cwd ?? null, workspace ? repoNameFor(workspace, cwd) : null, at, at);
999
710
  return requireSession(ctx, id);
1000
711
  }
1001
712
  function nameTaken(error, name) {
@@ -1008,7 +719,7 @@ function createSession(ctx, input) {
1008
719
  try {
1009
720
  ctx.db.prepare(`INSERT INTO sessions (id, workspace, name, kind, status, cwd, repo, host, last_title,
1010
721
  created_at, last_active_at)
1011
- VALUES (?, ?, ?, ?, 'running', ?, ?, ?, ?, ?, ?)`).run(input.id, workspaceOf(ctx), input.name ?? null, input.kind, input.cwd, input.repo ?? null, input.host ?? "claude-code", input.name ?? null, at, at);
722
+ VALUES (?, ?, ?, ?, 'running', ?, ?, ?, ?, ?, ?)`).run(input.id, ctx.workspace, input.name ?? null, input.kind, input.cwd, input.repo ?? null, input.host ?? "claude-code", input.name ?? null, at, at);
1012
723
  } catch (error) {
1013
724
  nameTaken(error, input.name);
1014
725
  }
@@ -1055,7 +766,7 @@ function upsertFromHook(ctx, workspace, payload, env = {}) {
1055
766
  const existing = getSession(ctx, payload.session_id);
1056
767
  if (!existing) ctx.db.prepare(`INSERT INTO sessions (id, workspace, cwd, repo, host, host_pid, hooked_at, created_at,
1057
768
  last_active_at)
1058
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(payload.session_id, workspaceOf(ctx), payload.cwd ?? null, repo, host, hostPid, at, at, at);
769
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(payload.session_id, ctx.workspace, payload.cwd ?? null, repo, host, hostPid, at, at, at);
1059
770
  else ctx.db.prepare(`UPDATE sessions
1060
771
  SET last_active_at = ?, hooked_at = ?, cwd = ?, repo = ?, host = ?, host_pid = ?
1061
772
  WHERE id = ?`).run(at, at, existing.cwd ?? payload.cwd ?? null, existing.cwd ? existing.repo : repo ?? existing.repo, host, hostPid ?? existing.hostPid, payload.session_id);
@@ -1078,7 +789,7 @@ function nameSession(ctx, id, name, purpose) {
1078
789
  return requireSession(ctx, id);
1079
790
  }
1080
791
  function listSessions(ctx, options = {}) {
1081
- const conditions = ["workspace = ?"];
792
+ const conditions = ["workspace IS ?"];
1082
793
  if (!options.includeTemp) conditions.push("kind != 'temp'");
1083
794
  if (!options.includeArchived) conditions.push("status != 'archived'");
1084
795
  return ctx.db.prepare(`SELECT ${COLUMNS} FROM sessions WHERE ${conditions.join(" AND ")} ORDER BY last_active_at DESC`).all(ctx.workspace).map(toSession);
@@ -1091,12 +802,12 @@ function dropSession(ctx, id) {
1091
802
  return requireSession(ctx, id);
1092
803
  }
1093
804
  function defaultSession(ctx) {
1094
- const row = ctx.db.prepare(`SELECT ${COLUMNS} FROM sessions WHERE workspace = ? AND status != 'archived'
805
+ const row = ctx.db.prepare(`SELECT ${COLUMNS} FROM sessions WHERE workspace IS ? AND status != 'archived'
1095
806
  ORDER BY last_active_at DESC LIMIT 1`).get(ctx.workspace);
1096
807
  return row && toSession(row);
1097
808
  }
1098
809
  function sessionByName(ctx, name) {
1099
- const row = ctx.db.prepare(`SELECT ${COLUMNS} FROM sessions WHERE workspace = ? AND name = ?`).get(ctx.workspace, name);
810
+ const row = ctx.db.prepare(`SELECT ${COLUMNS} FROM sessions WHERE workspace IS ? AND name = ?`).get(ctx.workspace, name);
1100
811
  return row && toSession(row);
1101
812
  }
1102
813
  const MINIMUM_ID_PREFIX = 4;
@@ -1110,7 +821,7 @@ function findSession(ctx, reference) {
1110
821
  if (byId) return byId;
1111
822
  const isIdPrefix = /^[0-9a-f-]+$/i.test(reference);
1112
823
  if (isIdPrefix && reference.length >= 4) {
1113
- const rows = ctx.db.prepare(`SELECT ${COLUMNS} FROM sessions WHERE workspace = ? AND id LIKE ?
824
+ const rows = ctx.db.prepare(`SELECT ${COLUMNS} FROM sessions WHERE workspace IS ? AND id LIKE ?
1114
825
  ORDER BY last_active_at DESC`).all(ctx.workspace, `${reference.toLowerCase()}%`);
1115
826
  const [only, ...others] = rows;
1116
827
  if (only && others.length === 0) return toSession(only);
@@ -1178,7 +889,7 @@ function demoteSession(ctx, id) {
1178
889
  function staleTempSessions(ctx, olderThanMilliseconds) {
1179
890
  const before = new Date(ctx.now().getTime() - olderThanMilliseconds).toISOString();
1180
891
  return ctx.db.prepare(`SELECT ${COLUMNS} FROM sessions
1181
- WHERE workspace = ? AND kind = 'temp' AND status = 'idle' AND last_active_at < ?
892
+ WHERE workspace IS ? AND kind = 'temp' AND status = 'idle' AND last_active_at < ?
1182
893
  ORDER BY last_active_at ASC`).all(ctx.workspace, before).map(toSession);
1183
894
  }
1184
895
  function resetDeadSessions(ctx, isAlive) {
@@ -1186,11 +897,11 @@ function resetDeadSessions(ctx, isAlive) {
1186
897
  }
1187
898
  // src/prompt/core-rules.ts
1188
899
  const CORE_RULES = `- Work can be parallel, review stays sequential: forks work at the same time, the human handles their results one at a time.
1189
- - The human keeps the hand: only the human launches agents, triggers their final action (inject, validate, apply, triage), applies, tests and commits. Agents propose, they never push.
1190
- - Status lives in Carnet: agent statuses, the Main line and the journal go through the Carnet tools, never into status files nor chat updates. Update before and after each piece of work.
1191
- - When an agent finishes, say only "<name> finished, report ready". Never summarise, quote or act on its report or final message until the human asks for that report or its final action, even when answering about something else.
1192
- - Agents never commit, push, stash or record notes. An agent follows its kind's contract, writes its report to a file ending with a Learnings section, calls agent_done as its last tool action, then replies with one line that carries no results, such as "<name> done, report written". Only the main agent records notes, at the end of a step.
1193
- - To launch agents or handle their results, load the rucher skill: it holds the full workflow.`;
900
+ - The human keeps the hand: only the human launches forks, applies, tests and commits. Agents propose, they never push.
901
+ - Status lives in Carnet: agent statuses, the "On the table" line and the journal go through the Carnet tools, never into status files nor chat updates. Update before and after each piece of work.
902
+ - When a fork finishes, say only "<name> finished, report ready". Never summarise, quote or act on its report or final message until the human asks for that fork's report, even when answering about something else.
903
+ - Forks never commit, push, stash or record notes. A fork writes its report to a file, ending with a Learnings section, calls agent_done as its last tool action, then replies with one line that carries no results, such as "<name> done, report written". Only the main agent records notes, at the end of a step.
904
+ - To dispatch, apply or review forks, load the rucher skill: it holds the full workflow.`;
1194
905
  // src/prompt/prompt.ts
1195
906
  const PROMPT_FILE = "prompt.md";
1196
907
  function readIfPresent(path) {
@@ -1198,7 +909,7 @@ function readIfPresent(path) {
1198
909
  return readFileSync(path, "utf8").trim() || void 0;
1199
910
  }
1200
911
  function baseRules(env = process.env) {
1201
- return readIfPresent(corePromptPath(env)) ?? "- Work can be parallel, review stays sequential: forks work at the same time, the human handles their results one at a time.\n- The human keeps the hand: only the human launches agents, triggers their final action (inject, validate, apply, triage), applies, tests and commits. Agents propose, they never push.\n- Status lives in Carnet: agent statuses, the Main line and the journal go through the Carnet tools, never into status files nor chat updates. Update before and after each piece of work.\n- When an agent finishes, say only \"<name> finished, report ready\". Never summarise, quote or act on its report or final message until the human asks for that report or its final action, even when answering about something else.\n- Agents never commit, push, stash or record notes. An agent follows its kind's contract, writes its report to a file ending with a Learnings section, calls agent_done as its last tool action, then replies with one line that carries no results, such as \"<name> done, report written\". Only the main agent records notes, at the end of a step.\n- To launch agents or handle their results, load the rucher skill: it holds the full workflow.";
912
+ return readIfPresent(corePromptPath(env)) ?? "- Work can be parallel, review stays sequential: forks work at the same time, the human handles their results one at a time.\n- The human keeps the hand: only the human launches forks, applies, tests and commits. Agents propose, they never push.\n- Status lives in Carnet: agent statuses, the \"On the table\" line and the journal go through the Carnet tools, never into status files nor chat updates. Update before and after each piece of work.\n- When a fork finishes, say only \"<name> finished, report ready\". Never summarise, quote or act on its report or final message until the human asks for that fork's report, even when answering about something else.\n- Forks never commit, push, stash or record notes. A fork writes its report to a file, ending with a Learnings section, calls agent_done as its last tool action, then replies with one line that carries no results, such as \"<name> done, report written\". Only the main agent records notes, at the end of a step.\n- To dispatch, apply or review forks, load the rucher skill: it holds the full workflow.";
1202
913
  }
1203
914
  function workspaceRules(workspace) {
1204
915
  return workspace ? readIfPresent(join(workspace.definition, PROMPT_FILE)) : void 0;
@@ -1238,7 +949,7 @@ function outsideRucherContext(workspace, env = process.env) {
1238
949
  }
1239
950
  const OUTSIDE_RUCHER_NOTICE = "rucher: session started without rucher, the Rucher rules are not in its system prompt (use rucher new, tmp or resume)";
1240
951
  const RULES_UPDATED_NOTICE = "rucher: rules updated, will apply after the next compaction or in a new session";
1241
- const SUBAGENT_RULES = "Rucher rules for sub-agents: never commit, push or stash. When your task asks for a report, write it to the file it names. If your prompt names you as a Carnet agent, follow the contract of its kind, call agent_update at meaningful progress and agent_done as your last tool action, then reply with one line.";
952
+ const SUBAGENT_RULES = "Rucher rules for sub-agents: never commit, push or stash. When your task asks for a report, write it to the file it names. If your prompt names you as a Carnet agent, call agent_update at meaningful progress and agent_done as your last tool action, then reply with one line.";
1242
953
  // src/run-directory-files.ts
1243
954
  const GENERATED_MARKER = "generated by rucher, do not edit";
1244
955
  function refuse(path) {
@@ -1301,7 +1012,7 @@ function mergeSettings(base, extra) {
1301
1012
  // src/hosts/claude-code.ts
1302
1013
  const TRANSCRIPT_TAIL_BYTES = 262144;
1303
1014
  const TITLE_PATTERN = /"type":"custom-title","customTitle":("(?:[^"\\]|\\.)*")/g;
1304
- const FORK_NAME_PATTERN = /You are (?:agent|fork) `([^`]+)`/;
1015
+ const FORK_NAME_PATTERN = /You are fork `([^`]+)`/;
1305
1016
  function payloadObject(json) {
1306
1017
  const data = JSON.parse(json);
1307
1018
  if (typeof data.session_id !== "string" || !data.session_id) throw new TypeError("Hook payload has no session_id");
@@ -1445,14 +1156,6 @@ const claudeCode = {
1445
1156
  session_title: text(data, "session_title")
1446
1157
  };
1447
1158
  },
1448
- parseStopPayload(json) {
1449
- const data = payloadObject(json);
1450
- return {
1451
- session_id: data.session_id,
1452
- cwd: text(data, "cwd"),
1453
- failed: data.hook_event_name === "StopFailure"
1454
- };
1455
- },
1456
1159
  parsePromptPayload(json) {
1457
1160
  const data = payloadObject(json);
1458
1161
  return {
@@ -1487,16 +1190,12 @@ const claudeCode = {
1487
1190
  const data = payloadObject(json);
1488
1191
  const toolName = text(data, "tool_name");
1489
1192
  const cwd = text(data, "cwd");
1490
- const toolInput = typeof data.tool_input === "object" && data.tool_input !== null ? data.tool_input : {};
1491
1193
  return {
1492
1194
  session_id: data.session_id,
1493
1195
  cwd,
1494
1196
  tool_name: toolName,
1495
1197
  agent_id: text(data, "agent_id"),
1496
- agent_type: text(data, "agent_type"),
1497
- path: touchedPath(toolName, data.tool_input, cwd),
1498
- file_path: text(toolInput, "file_path") ?? text(toolInput, "notebook_path"),
1499
- command: text(toolInput, "command")
1198
+ path: touchedPath(toolName, data.tool_input, cwd)
1500
1199
  };
1501
1200
  },
1502
1201
  subagentInheritsContext(payload) {
@@ -1590,7 +1289,8 @@ function inTransaction(db, run) {
1590
1289
  }
1591
1290
  }
1592
1291
  function sessionWorkspaceName(db, sessionId) {
1593
- return db.prepare("SELECT workspace FROM sessions WHERE id = ?").get(sessionId)?.workspace;
1292
+ const row = db.prepare("SELECT workspace FROM sessions WHERE id = ?").get(sessionId);
1293
+ return row ? row.workspace : void 0;
1594
1294
  }
1595
1295
  function archiveWorkspaceSessions(db, name, at) {
1596
1296
  return inTransaction(db, () => {
@@ -1605,13 +1305,9 @@ function deleteWorkspaceNotes(db, name) {
1605
1305
  }
1606
1306
  function workspaceSessionCounts(db) {
1607
1307
  const rows = db.prepare(`SELECT workspace, COUNT(*) AS count FROM sessions
1608
- WHERE status != 'archived' GROUP BY workspace`).all();
1308
+ WHERE workspace IS NOT NULL AND status != 'archived' GROUP BY workspace`).all();
1609
1309
  return new Map(rows.map((row) => [row.workspace, Number(row.count)]));
1610
1310
  }
1611
- function workspaceLastActive(db) {
1612
- const rows = db.prepare("SELECT workspace, MAX(last_active_at) AS at FROM sessions GROUP BY workspace").all();
1613
- return new Map(rows.map((row) => [row.workspace, row.at]));
1614
- }
1615
1311
  // src/workspace/locate.ts
1616
1312
  function isInside(directory, path) {
1617
1313
  const relativePath = relative(directory, path);
@@ -1638,9 +1334,31 @@ function namedWorkspace(name, env) {
1638
1334
  function byRunDirectory(workspaces, directories) {
1639
1335
  return workspaces.find((workspace) => directories.some((directory) => isInside(workspace.runDirectory, directory)));
1640
1336
  }
1337
+ function byRepo(workspaces, directory) {
1338
+ let best = [];
1339
+ for (const workspace of workspaces) for (const repo of workspace.repos) {
1340
+ if (!isInside(repo.path, directory)) continue;
1341
+ const length = best[0]?.repo.path.length ?? -1;
1342
+ if (repo.path.length > length) best = [{
1343
+ workspace,
1344
+ repo
1345
+ }];
1346
+ else if (repo.path.length === length) best.push({
1347
+ workspace,
1348
+ repo
1349
+ });
1350
+ }
1351
+ const names = [...new Set(best.map((match) => match.workspace.name))];
1352
+ if (names.length > 1) throw new CarnetError("WORKSPACE_AMBIGUOUS", `${directory} is in repos of several workspaces (${names.join(", ")}): pass --ws`);
1353
+ return best[0];
1354
+ }
1641
1355
  function resolveWorkspace({ db, sessionId, workspace, cwd = process.cwd(), env = process.env } = {}) {
1642
1356
  if (db && sessionId) {
1643
1357
  const name = sessionWorkspaceName(db, sessionId);
1358
+ if (name === null) return {
1359
+ workspace: null,
1360
+ origin: "session"
1361
+ };
1644
1362
  if (name !== void 0 && workspaceExists(name, env)) return {
1645
1363
  workspace: loadWorkspace(name, env),
1646
1364
  origin: "session"
@@ -1656,11 +1374,20 @@ function resolveWorkspace({ db, sessionId, workspace, cwd = process.cwd(), env =
1656
1374
  };
1657
1375
  const projectDirectories = allHosts().map((host) => host.projectDirectory(env)).filter((directory) => directory !== void 0);
1658
1376
  const directories = [resolve(cwd), ...projectDirectories.map((directory) => resolve(directory))];
1659
- const runDirectoryWorkspace = byRunDirectory(listWorkspaces(env), directories);
1377
+ const workspaces = listWorkspaces(env);
1378
+ const runDirectoryWorkspace = byRunDirectory(workspaces, directories);
1660
1379
  if (runDirectoryWorkspace) return {
1661
1380
  workspace: runDirectoryWorkspace,
1662
1381
  origin: "run-directory"
1663
1382
  };
1383
+ for (const directory of directories) {
1384
+ const match = byRepo(workspaces, directory);
1385
+ if (match) return {
1386
+ workspace: match.workspace,
1387
+ origin: "repo",
1388
+ repo: match.repo
1389
+ };
1390
+ }
1664
1391
  return {
1665
1392
  workspace: null,
1666
1393
  origin: "none"
@@ -1671,7 +1398,10 @@ function workspaceLabel(workspace) {
1671
1398
  }
1672
1399
  function requireWorkspace(workspace) {
1673
1400
  if (workspace) return workspace;
1674
- throw new CarnetError("NO_WORKSPACE", "No Rucher workspace here: pass --ws <name>, or run this from a workspace's run directory");
1401
+ throw new CarnetError("NO_WORKSPACE", "No Rucher workspace here: pass --ws, or run this from a repo or run directory of a workspace");
1402
+ }
1403
+ function ambiguousWorkspaceContext(reason) {
1404
+ return `Rucher could not tell which workspace this session belongs to, so Carnet records nothing for it: ${reason}.`;
1675
1405
  }
1676
1406
  // src/notes.ts
1677
1407
  const NOTE_KINDS = [
@@ -2099,7 +1829,7 @@ function purgeDays(value) {
2099
1829
  return Number.isFinite(days) && days > 0 ? days : 3;
2100
1830
  }
2101
1831
  const PURGEABLE = `
2102
- workspace = ? AND id != ? AND last_active_at < ?
1832
+ workspace IS ? AND id != ? AND last_active_at < ?
2103
1833
  AND NOT EXISTS (
2104
1834
  SELECT 1 FROM events WHERE events.session = sessions.id AND events.type NOT LIKE 'session.%'
2105
1835
  )
@@ -2130,42 +1860,13 @@ function purgeSessions(ctx, keepId, days) {
2130
1860
  }
2131
1861
  }
2132
1862
  // src/status/render.ts
2133
- const MAIN_HEADER = "Main";
2134
- const MAIN_WORKING_SUFFIX = "(main working)";
2135
- const MAIN_WAITING_SUFFIX = "(waiting on you)";
2136
- const MAIN_FAILED_SUFFIX = "(turn failed)";
1863
+ const MAIN_WORKING_SUFFIX = "(main working, not ready)";
2137
1864
  function renderTableLine(item) {
1865
+ if (item.mainWorking) return `${MAIN_WORKING_EMOJI} ${item.text} ${MAIN_WORKING_SUFFIX}`;
2138
1866
  return `${EMOJI[item.status ?? "discussing"]} ${item.text}`;
2139
1867
  }
2140
- const TURN_MARKS = {
2141
- working: {
2142
- emoji: MAIN_WORKING_EMOJI,
2143
- suffix: MAIN_WORKING_SUFFIX,
2144
- alone: "main working"
2145
- },
2146
- waiting: {
2147
- emoji: "⏸",
2148
- suffix: MAIN_WAITING_SUFFIX,
2149
- alone: "waiting on you"
2150
- },
2151
- failed: {
2152
- emoji: "⚠",
2153
- suffix: MAIN_FAILED_SUFFIX,
2154
- alone: "turn failed"
2155
- }
2156
- };
2157
- function renderMainLine(item, turn) {
2158
- if (!turn) return item ? renderTableLine(item) : null;
2159
- const mark = TURN_MARKS[turn];
2160
- return item ? `${mark.emoji} ${item.text} ${mark.suffix}` : `${mark.emoji} ${mark.alone}`;
2161
- }
2162
- function renderAgentLine(line, nameWidth = 0) {
2163
- const head = `${line.emoji} ${KIND_ABBREVIATIONS[line.kind]} ${line.name}`;
2164
- const action = line.action ? ` ${" ".repeat(Math.max(nameWidth - line.name.length, 0))} ${line.action}` : "";
2165
- return line.note ? `${head}${action} — ${line.note}` : `${head}${action}`;
2166
- }
2167
- function nameWidth(lines) {
2168
- return Math.max(0, ...lines.map((line) => line.name.length));
1868
+ function renderAgentLine(line) {
1869
+ return line.note ? `${line.emoji} ${line.name} — ${line.note}` : `${line.emoji} ${line.name}`;
2169
1870
  }
2170
1871
  const NOTES_HEADER = "Notes";
2171
1872
  const NOTES_FOLD_LINES = 5;
@@ -2176,7 +1877,7 @@ const ACTIVITY_MARK = {
2176
1877
  };
2177
1878
  const LABEL_WIDTH = 8;
2178
1879
  const SIMILAR_PREFIX = "similar to ";
2179
- function plural$1(count, word) {
1880
+ function plural(count, word) {
2180
1881
  return `${count} ${word}${count > 1 ? "s" : ""}`;
2181
1882
  }
2182
1883
  function renderNotesSummary(notes) {
@@ -2186,7 +1887,7 @@ function renderNotesSummary(notes) {
2186
1887
  count("added") && `${count("added")} added`,
2187
1888
  count("cited") && `${count("cited")} cited`,
2188
1889
  count("dropped") && `${count("dropped")} dropped`,
2189
- duplicates && plural$1(duplicates, "possible duplicate")
1890
+ duplicates && plural(duplicates, "possible duplicate")
2190
1891
  ].filter(Boolean);
2191
1892
  return `${NOTES_HEADER} ${parts.join(" · ")}`;
2192
1893
  }
@@ -2206,18 +1907,15 @@ function renderNotes(notes, mode = "full") {
2206
1907
  }
2207
1908
  function renderSections(view, options = {}) {
2208
1909
  const out = [];
2209
- const main = renderMainLine(view.table, view.turn);
2210
- if (main) out.push(MAIN_HEADER, ` ${main}`, "");
1910
+ if (view.table) out.push("On the table", ` ${renderTableLine(view.table)}`, "");
2211
1911
  out.push("Waiting on you");
2212
1912
  if (view.waiting.length === 0) out.push(" nothing");
2213
- const waitingWidth = nameWidth(view.waiting);
2214
1913
  view.waiting.forEach((line, index) => {
2215
- out.push(` ${index + 1}. ${renderAgentLine(line, waitingWidth)}`);
1914
+ out.push(` ${index + 1}. ${renderAgentLine(line)}`);
2216
1915
  });
2217
1916
  out.push("", "Running");
2218
1917
  if (view.running.length === 0) out.push(" nothing");
2219
- const runningWidth = nameWidth(view.running);
2220
- for (const line of view.running) out.push(` ${renderAgentLine(line, runningWidth)}`);
1918
+ for (const line of view.running) out.push(` ${renderAgentLine(line)}`);
2221
1919
  const notes = renderNotes(view.notes, options.notes);
2222
1920
  if (notes.length > 0) out.push("", ...notes);
2223
1921
  return out.join("\n");
@@ -2228,7 +1926,6 @@ function renderStatus(view, options) {
2228
1926
  "",
2229
1927
  renderSections(view, options),
2230
1928
  "",
2231
- KIND_LEGEND,
2232
1929
  LEGEND
2233
1930
  ].join("\n");
2234
1931
  }
@@ -2238,106 +1935,33 @@ function toItem(row) {
2238
1935
  session: row.session,
2239
1936
  text: row.text,
2240
1937
  status: row.status,
1938
+ mainWorking: row.main_working === 1,
2241
1939
  updatedAt: row.updated_at
2242
1940
  };
2243
1941
  }
2244
- function tableIsAbout(item, name) {
2245
- const text = item?.text;
2246
- return text?.startsWith(name) === true && !/[\w-]/.test(text.charAt(name.length));
2247
- }
2248
1942
  function getTable(ctx, session) {
2249
1943
  const row = ctx.db.prepare("SELECT * FROM table_items WHERE session = ?").get(session);
2250
1944
  return row && toItem(row);
2251
1945
  }
2252
1946
  function setTable(ctx, session, input) {
1947
+ const mainWorking = input.mainWorking ?? (input.status ? false : getTable(ctx, session)?.mainWorking ?? false);
1948
+ if (mainWorking && input.status) throw new CarnetError("TABLE_STATUS_WITH_MAIN_WORKING", "A user-action status cannot be set while main is working");
2253
1949
  if (input.status !== void 0 && !isUserActionStatus(input.status)) throw new CarnetError("INVALID_STATUS", `Invalid table status "${String(input.status)}"`);
2254
- ctx.db.prepare(`INSERT INTO table_items (session, text, status, updated_at) VALUES (?, ?, ?, ?)
1950
+ ctx.db.prepare(`INSERT INTO table_items (session, text, status, main_working, updated_at) VALUES (?, ?, ?, ?, ?)
2255
1951
  ON CONFLICT(session) DO UPDATE SET text = excluded.text, status = excluded.status,
2256
- updated_at = excluded.updated_at`).run(session, sanitizeNote(input.text), input.status ?? null, nowIso(ctx));
1952
+ main_working = excluded.main_working, updated_at = excluded.updated_at`).run(session, sanitizeNote(input.text), input.status ?? null, mainWorking ? 1 : 0, nowIso(ctx));
2257
1953
  return getTable(ctx, session);
2258
1954
  }
2259
1955
  function clearTable(ctx, session) {
2260
1956
  ctx.db.prepare("DELETE FROM table_items WHERE session = ?").run(session);
2261
1957
  }
2262
- // src/turn.ts
2263
- const TURNS = [
2264
- "working",
2265
- "waiting",
2266
- "failed"
2267
- ];
2268
- function getTurn(ctx, session) {
2269
- return ctx.db.prepare("SELECT turn FROM sessions WHERE id = ?").get(session)?.turn ?? null;
2270
- }
2271
- function setTurn(ctx, session, turn) {
2272
- ctx.db.prepare(`UPDATE sessions SET turn = ?1,
2273
- turn_started_at = CASE
2274
- WHEN ?1 IS NULL THEN NULL
2275
- WHEN ?1 <> 'failed' AND turn IN ('working', 'waiting') THEN turn_started_at
2276
- ELSE ?2 END
2277
- WHERE id = ?3 AND turn IS NOT ?1`).run(turn, nowIso(ctx), session);
2278
- }
2279
- function startTurn(ctx, session) {
2280
- setTurn(ctx, session, "working");
2281
- }
2282
- function waitTurn(ctx, session) {
2283
- setTurn(ctx, session, "waiting");
2284
- }
2285
- function failTurn(ctx, session) {
2286
- setTurn(ctx, session, "failed");
2287
- }
2288
- function endTurn(ctx, session) {
2289
- setTurn(ctx, session, null);
2290
- }
2291
1958
  // src/status/view.ts
2292
- const ACTION_RANK = {
2293
- validate: 1,
2294
- triage: 2,
2295
- inject: 3,
2296
- apply: 4,
2297
- test: 5,
2298
- commit: 6
1959
+ const BUCKET = {
1960
+ answer: 0,
1961
+ review: 1
2299
1962
  };
2300
- function plural(count, word) {
2301
- return `${count} ${word}${count === 1 ? "" : "s"}`;
2302
- }
2303
- function actionWord(agent) {
2304
- const { kind, status } = agent;
2305
- if (status === "answer") return kind === "analyze" ? "validate" : "answer";
2306
- if (status === "review" && kind !== "implement") return FINAL_ACTIONS[kind];
2307
- if (status === "apply" && kind === "implement") return "apply";
2308
- if (status === "test" || status === "commit" || status === "branch") return status;
2309
- return status === "discussing" ? "discuss" : status;
2310
- }
2311
- function actionDetail(ctx, agent, word) {
2312
- if (word === "validate" || word === "answer") {
2313
- const open = listQuestions(ctx, agent.session, agent.name, true).length;
2314
- if (open > 0) return plural(open, "question");
2315
- if (agent.status === "answer") return "questions";
2316
- return "plan";
2317
- }
2318
- if (word === "triage") {
2319
- const pending = listFindings(ctx, agent.session, agent.name, true);
2320
- const blocking = pending.filter((finding) => finding.severity === "blocking").length;
2321
- const parts = [
2322
- pending.length > 0 ? plural(pending.length, "finding") : null,
2323
- blocking > 0 ? `(${blocking} blocking)` : null,
2324
- agent.target ? `→ ${agent.target}` : null
2325
- ].filter(Boolean);
2326
- return parts.length > 0 ? parts.join(" ") : null;
2327
- }
2328
- return null;
2329
- }
2330
- function waitingAction(ctx, agent) {
2331
- const word = actionWord(agent);
2332
- const detail = actionDetail(ctx, agent, word);
2333
- return detail ? `${word} · ${detail}` : word;
2334
- }
2335
- function runningAction(agent) {
2336
- return agent.promotedFrom ? `promoted from ${agent.promotedFrom}` : null;
2337
- }
2338
- function rankOf(agent) {
2339
- if (agent.status === "answer") return 0;
2340
- return ACTION_RANK[actionWord(agent)] ?? Object.keys(ACTION_RANK).length + 1;
1963
+ function bucketOf(status) {
1964
+ return BUCKET[status] ?? 2;
2341
1965
  }
2342
1966
  function compareWaiting(left, right) {
2343
1967
  if (left.queueOrder !== null || right.queueOrder !== null) {
@@ -2345,31 +1969,27 @@ function compareWaiting(left, right) {
2345
1969
  if (right.queueOrder === null) return -1;
2346
1970
  return left.queueOrder - right.queueOrder;
2347
1971
  }
2348
- return rankOf(left) - rankOf(right) || left.startedAt.localeCompare(right.startedAt);
1972
+ return bucketOf(left.status) - bucketOf(right.status) || left.startedAt.localeCompare(right.startedAt);
2349
1973
  }
2350
- function toLine(agent, action) {
1974
+ function toLine(agent) {
2351
1975
  return {
2352
1976
  name: agent.name,
2353
- kind: agent.kind,
2354
1977
  status: agent.status,
2355
1978
  emoji: agent.status === "closed" ? "" : EMOJI[agent.status],
2356
- action,
2357
1979
  note: agent.note
2358
1980
  };
2359
1981
  }
2360
1982
  function formatClock(date) {
2361
1983
  return `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
2362
1984
  }
2363
- function buildStatusView(ctx, session, options = {}) {
2364
- const agents = listAgents(ctx, session.id).filter((agent) => !options.kind || agent.kind === options.kind);
2365
- const table = getTable(ctx, session.id) ?? null;
2366
- const waiting = agents.filter((agent) => isUserActionStatus(agent.status) && !tableIsAbout(table, agent.name)).sort(compareWaiting).map((agent) => toLine(agent, waitingAction(ctx, agent)));
2367
- const running = agents.filter((agent) => agent.status === "running").map((agent) => toLine(agent, runningAction(agent)));
1985
+ function buildStatusView(ctx, session) {
1986
+ const agents = listAgents(ctx, session.id);
1987
+ const waiting = agents.filter((agent) => isUserActionStatus(agent.status)).sort(compareWaiting).map(toLine);
1988
+ const running = agents.filter((agent) => agent.status === "running").map(toLine);
2368
1989
  return {
2369
1990
  time: formatClock(ctx.now()),
2370
1991
  sessionName: session.name,
2371
- table,
2372
- turn: getTurn(ctx, session.id),
1992
+ table: getTable(ctx, session.id) ?? null,
2373
1993
  waiting,
2374
1994
  running,
2375
1995
  notes: sessionNoteActivity(ctx, session.id)
@@ -2437,9 +2057,6 @@ var Carnet = class {
2437
2057
  workspace: workspace?.name ?? null
2438
2058
  };
2439
2059
  }
2440
- now() {
2441
- return this.ctx.now();
2442
- }
2443
2060
  requireWorkspace() {
2444
2061
  return requireWorkspace(this.workspace);
2445
2062
  }
@@ -2477,43 +2094,22 @@ var Carnet = class {
2477
2094
  update: (session, name, input) => updateAgent(this.ctx, session, name, input),
2478
2095
  finish: (session, name, input) => finishAgent(this.ctx, session, name, input),
2479
2096
  drop: (session, name, reason) => dropAgent(this.ctx, session, name, reason),
2480
- close: (session, name, event) => closeAgent(this.ctx, session, name, event),
2481
- promote: (session, name, input) => promoteAgent(this.ctx, session, name, input),
2482
2097
  list: (session, options) => listAgents(this.ctx, session, options),
2483
2098
  reorderQueue: (session, names) => reorderQueue(this.ctx, session, names),
2484
- byHostAgentId: (session, hostAgentId) => byHostAgentId(this.ctx, session, hostAgentId),
2485
2099
  pairSubagent: (session, hostAgentId) => pairSubagent(this.ctx, session, hostAgentId),
2486
2100
  stopSubagent: (session, hostAgentId, names) => stopSubagent(this.ctx, session, hostAgentId, names)
2487
2101
  };
2488
- questions = {
2489
- list: (session, agent, openOnly) => listQuestions(this.ctx, session, agent, openOnly),
2490
- add: (session, agent, inputs) => addQuestions(this.ctx, session, agent, inputs),
2491
- answer: (session, agent, answers) => answerQuestions(this.ctx, session, agent, answers)
2492
- };
2493
- findings = {
2494
- list: (session, agent, pendingOnly) => listFindings(this.ctx, session, agent, pendingOnly),
2495
- replace: (session, agent, inputs) => replaceFindings(this.ctx, session, agent, inputs),
2496
- decide: (session, agent, decisions) => decideFindings(this.ctx, session, agent, decisions)
2497
- };
2498
2102
  table = {
2499
2103
  get: (session) => getTable(this.ctx, session),
2500
2104
  set: (session, input) => setTable(this.ctx, session, input),
2501
2105
  clear: (session) => clearTable(this.ctx, session)
2502
2106
  };
2503
- turn = {
2504
- get: (session) => getTurn(this.ctx, session),
2505
- start: (session) => startTurn(this.ctx, session),
2506
- wait: (session) => waitTurn(this.ctx, session),
2507
- fail: (session) => failTurn(this.ctx, session),
2508
- end: (session) => endTurn(this.ctx, session)
2509
- };
2510
2107
  events = {
2511
2108
  log: (session, input) => logEvent(this.ctx, session, input),
2512
- read: (session, limit, agentOnly, kind) => readEvents(this.ctx, {
2109
+ read: (session, limit, agentOnly) => readEvents(this.ctx, {
2513
2110
  session,
2514
2111
  limit,
2515
- agentOnly,
2516
- kind
2112
+ agentOnly
2517
2113
  })
2518
2114
  };
2519
2115
  notes = {
@@ -2534,8 +2130,8 @@ var Carnet = class {
2534
2130
  copyRepos: (from, into) => copyInjectedRepos(this.ctx, from, into)
2535
2131
  };
2536
2132
  status = {
2537
- view: (session, options) => buildStatusView(this.ctx, session, options),
2538
- render: (session, options) => renderStatus(buildStatusView(this.ctx, session, options), options),
2133
+ view: (session) => buildStatusView(this.ctx, session),
2134
+ render: (session, options) => renderStatus(buildStatusView(this.ctx, session), options),
2539
2135
  sections: (session) => renderSections(buildStatusView(this.ctx, session))
2540
2136
  };
2541
2137
  close() {
@@ -2606,27 +2202,27 @@ const AGENT_STEPS = [
2606
2202
  "dropped"
2607
2203
  ];
2608
2204
  const DEFAULT_NEXT = {
2205
+ answered: "apply",
2609
2206
  applied: "test",
2610
2207
  tested: "commit"
2611
2208
  };
2209
+ function tableIsAbout(carnet, session, name) {
2210
+ const text = carnet.table.get(session)?.text;
2211
+ return text?.startsWith(name) === true && !/[\w-]/.test(text.charAt(name.length));
2212
+ }
2612
2213
  function clearTableOf(carnet, session, name) {
2613
- if (tableIsAbout(carnet.table.get(session), name)) carnet.table.clear(session);
2214
+ if (tableIsAbout(carnet, session, name)) carnet.table.clear(session);
2614
2215
  }
2615
2216
  function stepAgent(carnet, session, input) {
2616
2217
  const { name, step, commit, note } = input;
2617
- const agent = carnet.agents.get(session, name);
2618
- if (!agent) throw new CarnetError("AGENT_NOT_FOUND", `No agent "${name}" in this session`);
2218
+ if (!carnet.agents.get(session, name)) throw new CarnetError("AGENT_NOT_FOUND", `No agent "${name}" in this session`);
2619
2219
  switch (step) {
2620
- case "applying": {
2621
- if (agent.kind !== "implement") throw new CarnetError("INVALID_KIND", `${name} is ${agent.kind}: only an implement agent is applied`);
2622
- carnet.table.set(session, { text: `${name} applying` });
2623
- carnet.agents.update(session, name, {
2624
- status: agent.status,
2625
- note: note ?? null
2220
+ case "applying":
2221
+ carnet.table.set(session, {
2222
+ text: `${name} applying`,
2223
+ mainWorking: true
2626
2224
  });
2627
- const reviews = carnet.agents.list(session).filter((other) => other.kind === "review" && other.target === name);
2628
- return `⚙️ ${name} applying${reviews.length ? `\nwarning: review ${reviews.map((review) => review.name).join(", ")} not triaged yet` : ""}`;
2629
- }
2225
+ return `⚙️ ${name} applying`;
2630
2226
  case "committed":
2631
2227
  if (!commit) throw new CarnetError("COMMIT_REQUIRED", "The committed step needs the commit");
2632
2228
  carnet.events.log(session, {
@@ -2643,16 +2239,13 @@ function stepAgent(carnet, session, input) {
2643
2239
  clearTableOf(carnet, session, name);
2644
2240
  return `${name} dropped, closed`;
2645
2241
  default: {
2646
- const next = input.next ?? (step === "answered" ? statusAfterAnswers(agent.kind) : DEFAULT_NEXT[step]);
2242
+ const next = input.next ?? DEFAULT_NEXT[step];
2647
2243
  carnet.events.log(session, {
2648
2244
  type: step,
2649
2245
  agent: name,
2650
2246
  note
2651
2247
  });
2652
- carnet.agents.update(session, name, {
2653
- status: next,
2654
- note: note ?? null
2655
- });
2248
+ carnet.agents.update(session, name, { status: next });
2656
2249
  if (next === "running") clearTableOf(carnet, session, name);
2657
2250
  else if (step !== "answered") carnet.table.set(session, {
2658
2251
  text: `${name} ${step}, ${next} next`,
@@ -2662,6 +2255,6 @@ function stepAgent(carnet, session, input) {
2662
2255
  }
2663
2256
  }
2664
2257
  }
2665
- export { workspaceLabel as $, defaultRunDirectory as $t, renderStatus as A, OPEN_AGENT_STATUSES as An, MINIMUM_ID_PREFIX as At, NOTE_TEXT_LIMIT as B, isWorkspaceName as Bt, SIMILAR_PREFIX as C, EMOJI as Cn, baseRules as Ct, renderNotes as D, MAIN_FAILED_EMOJI as Dn, rulesVersion as Dt, renderNoteLine as E, LEGEND as En, rulesText as Et, memoryMaxCharacters as F, SESSION_EVENT_TYPES as Fn, addWorkspaceRepo as Ft, sessionNoteActivity as G, workspaceHosts as Gt, isNoteKind as H, loadWorkspace as Ht, renderMemory as I, isEventType as In, createWorkspace as It, isInside as J, FINDING_SEVERITIES as Jt, similarity as K, renderQuestions as Kt, DEFAULT_HALF_LIFE_DAYS as L, CarnetError as Ln, definitionInstructions as Lt, DEFAULT_PURGE_DAYS as M, isAgentStatus as Mn, AGENTS_FILE as Mt, purgeDays as N, isUserActionStatus as Nn, INSTRUCTIONS_FILE as Nt, renderNotesSummary as O, MAIN_WAITING_EMOJI as On, workspaceRules as Ot, MEMORY_MAX_CHARACTERS as P, EVENT_TYPES as Pn, WORKSPACE_FILE as Pt, resolveWorkspace as Q, databasePath as Qt, DUPLICATE_SIMILARITY as R, dropWorkspace as Rt, NOTES_HEADER as S, AGENT_STATUSES as Sn, assemblePrompt as St, renderMainLine as T, KIND_LEGEND as Tn, outsideRucherContext as Tt, localDay as U, removeWorkspaceRepo as Ut, STALE_AFTER_ACTIVE_DAYS as V, listWorkspaces as Vt, memoryHalfLife as W, workspaceExists as Wt, repoPathFor as X, renderFindings as Xt, repoNameFor as Y, formatFinding as Yt, requireWorkspace as Z, corePromptPath as Zt, MAIN_FAILED_SUFFIX as _, mainTargetRange as _n, OUTSIDE_RUCHER_NOTICE as _t, formatEventLine as a, workspacesDirectory as an, DEFAULT_HOST as at, MAIN_WORKING_SUFFIX as b, NOTE_MAX as bn, SUBAGENT_RULES as bt, Carnet as c, migrate as cn, claudeCode as ct, openWorkspaceCarnet as d, AGENT_KINDS as dn, GENERATED_MARKER as dt, promptsDirectory as en, archiveWorkspaceSessions as et, PAIRING_WINDOW_MILLISECONDS as f, DEFAULT_AGENT_KIND as fn, MARKDOWN_MARKER as ft, TURNS as g, isAgentKind as gn, writeGenerated as gt, formatClock as h, REPORTING_NOTE as hn, removeStaleCopies as ht, RESUME_MAX_CHARACTERS as i, workspaceDefinition as in, workspaceSessionCounts as it, renderTableLine as j, USER_ACTION_STATUSES as jn, shortId as jt, renderSections as k, MAIN_WORKING_EMOJI as kn, CORE_RULES as kt, openCarnet as l, migrations as ln, transcriptTitle as lt, buildStatusView as m, PUBLISH_FALLBACK_MILLISECONDS as mn, mergeSettings as mt, stepAgent as n, reportsDirectory as nn, sessionWorkspaceName as nt, resumeContext as o, MEMORY_DB as on, allHosts as ot, STOPPED_NOTE as p, FINAL_ACTIONS as pn, markdownCopy as pt, workspaceRepoNames as q, FINDING_DECISIONS as qt, RESUME_EVENTS as r, rucherPaths as rn, workspaceLastActive as rt, sessionLabel as s, openDatabase as sn, hostById as st, AGENT_STEPS as t, reportPath as tn, deleteWorkspaceNotes as tt, openResolvedCarnet as u, schemaVersion as un, workspaceSettings as ut, MAIN_HEADER as v, statusAfterAnswers as vn, PROMPT_FILE as vt, renderAgentLine as w, KIND_ABBREVIATIONS as wn, compactReminder as wt, NOTES_FOLD_LINES as x, sanitizeNote as xn, appendPromptFile as xt, MAIN_WAITING_SUFFIX as y, statusWhenDone as yn, RULES_UPDATED_NOTICE as yt, NOTE_KINDS as z, expandHome as zt };
2258
+ export { workspaceSessionCounts as $, migrations as $t, memoryMaxCharacters as A, addWorkspaceRepo as At, sessionNoteActivity as B, workspaceHosts as Bt, renderNotesSummary as C, workspaceRules as Ct, DEFAULT_PURGE_DAYS as D, AGENTS_FILE as Dt, renderTableLine as E, shortId as Et, NOTE_TEXT_LIMIT as F, isWorkspaceName as Ft, repoNameFor as G, reportPath as Gt, workspaceRepoNames as H, databasePath as Ht, STALE_AFTER_ACTIVE_DAYS as I, listWorkspaces as It, resolveWorkspace as J, workspaceDefinition as Jt, repoPathFor as K, reportsDirectory as Kt, isNoteKind as L, loadWorkspace as Lt, DEFAULT_HALF_LIFE_DAYS as M, definitionInstructions as Mt, DUPLICATE_SIMILARITY as N, dropWorkspace as Nt, purgeDays as O, INSTRUCTIONS_FILE as Ot, NOTE_KINDS as P, expandHome as Pt, sessionWorkspaceName as Q, migrate as Qt, localDay as R, removeWorkspaceRepo as Rt, renderNotes as S, rulesVersion as St, renderStatus as T, MINIMUM_ID_PREFIX as Tt, ambiguousWorkspaceContext as U, defaultRunDirectory as Ut, similarity as V, corePromptPath as Vt, isInside as W, promptsDirectory as Wt, archiveWorkspaceSessions as X, MEMORY_DB as Xt, workspaceLabel as Y, workspacesDirectory as Yt, deleteWorkspaceNotes as Z, openDatabase as Zt, NOTES_FOLD_LINES as _, assemblePrompt as _t, formatEventLine as a, AGENT_STATUSES as an, workspaceSettings as at, renderAgentLine as b, outsideRucherContext as bt, Carnet as c, MAIN_WORKING_EMOJI as cn, markdownCopy as ct, openWorkspaceCarnet as d, isAgentStatus as dn, writeGenerated as dt, schemaVersion as en, DEFAULT_HOST as et, PAIRING_WINDOW_MILLISECONDS as f, isUserActionStatus as fn, OUTSIDE_RUCHER_NOTICE as ft, MAIN_WORKING_SUFFIX as g, CarnetError as gn, appendPromptFile as gt, formatClock as h, isEventType as hn, SUBAGENT_RULES as ht, RESUME_MAX_CHARACTERS as i, sanitizeNote as in, transcriptTitle as it, renderMemory as j, createWorkspace as jt, MEMORY_MAX_CHARACTERS as k, WORKSPACE_FILE as kt, openCarnet as l, OPEN_AGENT_STATUSES as ln, mergeSettings as lt, buildStatusView as m, SESSION_EVENT_TYPES as mn, RULES_UPDATED_NOTICE as mt, stepAgent as n, REPORTING_NOTE as nn, hostById as nt, resumeContext as o, EMOJI as on, GENERATED_MARKER as ot, STOPPED_NOTE as p, EVENT_TYPES as pn, PROMPT_FILE as pt, requireWorkspace as q, rucherPaths as qt, RESUME_EVENTS as r, NOTE_MAX as rn, claudeCode as rt, sessionLabel as s, LEGEND as sn, MARKDOWN_MARKER as st, AGENT_STEPS as t, PUBLISH_FALLBACK_MILLISECONDS as tn, allHosts as tt, openResolvedCarnet as u, USER_ACTION_STATUSES as un, removeStaleCopies as ut, NOTES_HEADER as v, baseRules as vt, renderSections as w, CORE_RULES as wt, renderNoteLine as x, rulesText as xt, SIMILAR_PREFIX as y, compactReminder as yt, memoryHalfLife as z, workspaceExists as zt };
2666
2259
 
2667
- //# sourceMappingURL=steps-Bd8FlgLs.mjs.map
2260
+ //# sourceMappingURL=steps-4ZTrBzcd.mjs.map