@a-t-h-i/bot-lobby 0.6.80 → 0.7.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 (58) hide show
  1. package/THIRD_PARTY_NOTICES.md +0 -1
  2. package/package.json +1 -1
  3. package/prompts/lobby-chat.md +1 -1
  4. package/prompts/master.md +15 -2
  5. package/prompts/panel.md +4 -4
  6. package/prompts/planner.md +2 -2
  7. package/prompts/worker.md +6 -1
  8. package/src/ask/tool.ts +1 -1
  9. package/src/classifier/effort.ts +5 -0
  10. package/src/classifier/files.ts +7 -0
  11. package/src/classifier/knowledge.ts +88 -0
  12. package/src/classifier/lobby.ts +1 -1
  13. package/src/desk/board-client.ts +1 -1
  14. package/src/desk/board.ts +1 -1
  15. package/src/execution/assignment.ts +77 -1
  16. package/src/execution/delegation.ts +80 -27
  17. package/src/execution/verification.ts +216 -0
  18. package/src/knowledge/catalog-tools.ts +1 -1
  19. package/src/knowledge/catalogue.ts +21 -6
  20. package/src/knowledge/compactor.ts +212 -5
  21. package/src/knowledge/oracle-digest.ts +2 -2
  22. package/src/knowledge/paths.ts +9 -0
  23. package/src/knowledge/repo-map.ts +1 -0
  24. package/src/knowledge/retrieval.ts +8 -2
  25. package/src/knowledge/store.ts +68 -14
  26. package/src/lobby/chat-agents.ts +57 -8
  27. package/src/lobby/feed.ts +2 -2
  28. package/src/lobby/knowledge.ts +3 -3
  29. package/src/lobby/pi-commands.ts +1 -1
  30. package/src/lobby/planner.ts +6 -6
  31. package/src/lobby/prompts.ts +2 -2
  32. package/src/lobby/runtime.ts +4 -4
  33. package/src/lobby/service.ts +88 -51
  34. package/src/master/master.ts +87 -14
  35. package/src/master/scout-prefetch.ts +14 -1
  36. package/src/pi/commands.ts +28 -10
  37. package/src/pi/events.ts +21 -10
  38. package/src/pi/owner.ts +21 -3
  39. package/src/pi/start-task.ts +9 -6
  40. package/src/pi/switch-pending.ts +24 -0
  41. package/src/pi/tools.ts +14 -0
  42. package/src/roles/worker.ts +33 -3
  43. package/src/schemas/configuration.ts +9 -0
  44. package/src/schemas/task.ts +18 -0
  45. package/src/schemas/verification.ts +38 -0
  46. package/src/state/metrics.ts +32 -2
  47. package/src/webui/api/knowledge.ts +1 -1
  48. package/src/webui/api/tasks.ts +1 -1
  49. package/src/webui/dev/fake-service.ts +7 -7
  50. package/src/workflow/track.ts +65 -3
  51. package/src/workflow/workflow.ts +142 -17
  52. package/webui/dist/assets/{CodeSurface-v19_sKLO.js → CodeSurface-FHm02AXI.js} +1 -1
  53. package/webui/dist/assets/{TerminalView-BW7Ik8CM.js → TerminalView-Be3q2ej_.js} +1 -1
  54. package/webui/dist/assets/{index-QvpDedq6.js → index-B_7Iioqo.js} +45 -45
  55. package/webui/dist/assets/index-DPP8sEwW.css +2 -0
  56. package/webui/dist/build.json +58 -58
  57. package/webui/dist/index.html +2 -2
  58. package/webui/dist/assets/index-BKF36jpt.css +0 -2
@@ -1,11 +1,13 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
1
+ import { chmodSync, chownSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync, type Stats } from "node:fs";
2
+ import { randomUUID } from "node:crypto";
2
3
  import { basename, dirname, join } from "node:path";
4
+ import { withFileLock } from "../desk/lock.ts";
3
5
  import { knowledgeDir, STANDARDS_FILE, type KnowledgeAgent } from "./paths.ts";
4
6
  import { annotate, readNotes } from "./notes.ts";
5
7
  import { pinnedEntries, recordEvent, settleProposals } from "./ledger.ts";
6
8
 
7
9
  /** The agent's name as the Knowledge page shows it. */
8
- const AGENT_NAMES: Record<KnowledgeAgent, string> = { master: "Oracle", designer: "Designer", backend: "Backend", qa: "QA" };
10
+ const AGENT_NAMES: Record<KnowledgeAgent, string> = { master: "Orchestrator", designer: "Designer", backend: "Backend", qa: "QA" };
9
11
 
10
12
  export function readFileOr(path: string, fallback = ""): string {
11
13
  try {
@@ -22,8 +24,45 @@ export function readFirstExisting(paths: readonly string[], fallback = ""): stri
22
24
  }
23
25
 
24
26
  export function writeFileEnsured(path: string, content: string): void {
27
+ writeFileAtomic(path, content);
28
+ }
29
+
30
+ /**
31
+ * Atomic replacement: the content lands in a temp file beside the target,
32
+ * then one rename swaps it in. A crash mid-write leaves the original file
33
+ * intact and a harmless temp file behind — never a half-written active file.
34
+ */
35
+ export function writeFileAtomic(path: string, content: string, expected?: string): boolean {
36
+ return withFileLock(path, () => {
37
+ if (expected !== undefined && readFileOr(path) !== expected) return false;
38
+ writeFileAtomicUnlocked(path, content);
39
+ return true;
40
+ });
41
+ }
42
+
43
+ function existingStat(path: string): Stats | undefined {
44
+ try {
45
+ return statSync(path);
46
+ } catch (error) {
47
+ if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
48
+ return undefined;
49
+ }
50
+ }
51
+
52
+ /** Only called while the target path's lock is held; metadata failures leave it intact. */
53
+ function writeFileAtomicUnlocked(path: string, content: string): void {
25
54
  mkdirSync(dirname(path), { recursive: true });
26
- writeFileSync(path, content, "utf8");
55
+ const original = existingStat(path);
56
+ const temp = `${path}.tmp-${process.pid}-${randomUUID()}`;
57
+ try {
58
+ writeFileSync(temp, content, { encoding: "utf8", flag: "wx", mode: 0o600 });
59
+ const created = statSync(temp);
60
+ if (original && (original.uid !== created.uid || original.gid !== created.gid)) chownSync(temp, original.uid, original.gid);
61
+ chmodSync(temp, original ? original.mode & 0o7777 : 0o666 & ~process.umask());
62
+ renameSync(temp, path);
63
+ } finally {
64
+ rmSync(temp, { force: true });
65
+ }
27
66
  }
28
67
 
29
68
  /** Seed content for freshly created knowledge files (§21). */
@@ -38,16 +77,21 @@ export const DEFAULT_KNOWLEDGE_CONTENT: Record<string, string> = {
38
77
  };
39
78
 
40
79
  export function ensureFile(path: string, content: string): void {
41
- if (!existsSync(path)) writeFileEnsured(path, content);
80
+ withFileLock(path, () => {
81
+ if (!existsSync(path)) writeFileAtomicUnlocked(path, content);
82
+ });
42
83
  }
43
84
 
44
85
  /** Append a line under a date heading, creating the heading when needed. */
45
86
  function appendDatedEntry(path: string, line: string, now: Date): void {
46
- const date = now.toISOString().slice(0, 10);
47
- const header = `# ${date}`;
48
- const body = readFileOr(path, "").trimEnd();
87
+ withFileLock(path, () => writeFileAtomicUnlocked(path, datedContent(readFileOr(path), line, now)));
88
+ }
89
+
90
+ function datedContent(content: string, line: string, now: Date): string {
91
+ const header = `# ${now.toISOString().slice(0, 10)}`;
92
+ const body = content.trimEnd();
49
93
  const updated = body.includes(header) ? `${body}\n${line}` : `${body}\n\n${header}\n\n${line}`;
50
- writeFileEnsured(path, `${updated.trimStart()}\n`);
94
+ return `${updated.trimStart()}\n`;
51
95
  }
52
96
 
53
97
  /** Append one operational-history line to an agent's completed-tasks log. */
@@ -91,12 +135,23 @@ export function applyKnowledge(entry: KnowledgeEntry): { path: string; result: "
91
135
  const text = entry.text.trim();
92
136
  if (!text) return { path: "", result: "empty" };
93
137
  const path = knowledgeFilePath(entry.dataRoot, entry.agent, entry.kind);
94
- const existing = readFileOr(path);
95
- if (existing.toLowerCase().includes(text.toLowerCase())) return { path, result: "duplicate" };
96
138
  const now = entry.now ?? new Date();
97
- if (entry.kind === "decision") appendDecision(dirname(path), text, now);
98
- else if (entry.kind === "completed") appendCompletedTask(dirname(path), text, now);
99
- else writeFileEnsured(path, `${existing.trimEnd()}\n\n${text}\n`);
139
+ const added = withFileLock(path, () => addKnowledgeUnlocked(path, text, entry.kind, now));
140
+ if (!added) return { path, result: "duplicate" };
141
+ auditKnowledge(entry, path, text, now);
142
+ return { path, result: "added" };
143
+ }
144
+
145
+ function addKnowledgeUnlocked(path: string, text: string, kind: KnowledgeKind, now: Date): boolean {
146
+ const existing = readFileOr(path);
147
+ if (existing.toLowerCase().includes(text.toLowerCase())) return false;
148
+ const dated = kind === "decision" || kind === "completed";
149
+ const line = kind === "completed" ? `- [x] ${text}` : `- ${text}`;
150
+ writeFileAtomicUnlocked(path, dated ? datedContent(existing, line, now) : `${existing.trimEnd()}\n\n${text}\n`);
151
+ return true;
152
+ }
153
+
154
+ function auditKnowledge(entry: KnowledgeEntry, path: string, text: string, now: Date): void {
100
155
  if (entry.kind !== "completed") {
101
156
  const file = basename(path);
102
157
  const by = entry.by ?? AGENT_NAMES[entry.agent];
@@ -107,7 +162,6 @@ export function applyKnowledge(entry: KnowledgeEntry): { path: string; result: "
107
162
  // The history is a nicety; the knowledge itself is saved.
108
163
  }
109
164
  }
110
- return { path, result: "added" };
111
165
  }
112
166
 
113
167
  /** Read an agent's knowledge slices for prompt context selection (§23). */
@@ -9,10 +9,16 @@
9
9
  * finished reply lands in the metrics log. The Master's own replies are pi's
10
10
  * turns, not this queue's.
11
11
  */
12
+ import { readFile } from "node:fs/promises";
12
13
  import { loadPrompt } from "../prompts/loader.ts";
13
14
  import { compilePrompt } from "../prompts/compiler.ts";
14
15
  import { runPiAgent, spawnPiProcess, type PiStreamEvent, type ProcessRunner } from "../execution/pi-runner.ts";
15
16
  import { MAX_CHILDREN } from "../execution/delegation.ts";
17
+ import { finalChecks, runVerification, verificationSummary, type VerifyExec } from "../execution/verification.ts";
18
+ import { refreshContextPack, packFingerprint } from "../master/master.ts";
19
+ import { contextPackBlock } from "../roles/worker.ts";
20
+ import type { VerificationReport } from "../schemas/verification.ts";
21
+ import type { ContextPack, ContextPackFile } from "../execution/assignment.ts";
16
22
  import { describeToolCall } from "../pi/activity.ts";
17
23
  import { appendMetrics, type MetricRecord, type MetricStatus } from "../state/metrics.ts";
18
24
  import { appendChange, EditLog } from "../state/changes.ts";
@@ -51,6 +57,10 @@ const ROLE_OF: Record<ChatWorker, Role> = { designer: "worker", backend: "worker
51
57
 
52
58
  /** Lines of conversation an agent is given, newest last. */
53
59
  export const CHAT_CONTEXT_LINES = 12;
60
+ /** Likely files packed into a chat reply's context, at most. */
61
+ export const CHAT_PACK_FILES = 8;
62
+ /** Lines of each packed file the pack carries, at most. */
63
+ const CHAT_PACK_LINES = 60;
54
64
  /** Longest line of earlier conversation it is given. */
55
65
  const CONTEXT_LINE_CHARS = 1200;
56
66
  export const MAX_CHAT_JOBS = 30;
@@ -95,6 +105,7 @@ export interface ChatAgentsDeps {
95
105
  stallTimeoutMs?: number;
96
106
  toolStallTimeoutMs?: number;
97
107
  runProcess?: ProcessRunner;
108
+ verificationExec?: VerifyExec;
98
109
  }
99
110
 
100
111
  /** An agent's system prompt: its domain's layers (the global one for RESEARCH and scouts), the lobby chat role and its seat. */
@@ -126,6 +137,9 @@ export class ChatAgents {
126
137
  private readonly controllers = new Map<string, AbortController>();
127
138
  private readonly edits = new Map<string, EditLog>();
128
139
  private counter = 0;
140
+ private previousVerification?: VerificationReport;
141
+ private verificationChain: Promise<void> = Promise.resolve();
142
+ private readonly verificationControllers = new Set<AbortController>();
129
143
 
130
144
  constructor(deps: ChatAgentsDeps) {
131
145
  this.deps = deps;
@@ -160,6 +174,7 @@ export class ChatAgents {
160
174
  job.finishedAt = now;
161
175
  }
162
176
  for (const controller of this.controllers.values()) controller.abort();
177
+ for (const controller of this.verificationControllers) controller.abort();
163
178
  this.changed();
164
179
  }
165
180
 
@@ -201,7 +216,7 @@ export class ChatAgents {
201
216
  const history = this.deps.history();
202
217
  const earlier = history.at(-1)?.endsWith(job.text) ? history.slice(0, -1) : history;
203
218
  try {
204
- const likely = await this.likely(job.text, controller.signal);
219
+ const likely = await this.pack(job.text, controller.signal);
205
220
  const result = await runPiAgent(
206
221
  {
207
222
  cwd: this.deps.cwd,
@@ -238,13 +253,14 @@ export class ChatAgents {
238
253
  }
239
254
  }
240
255
 
241
- /** The Likely files block for a message, or "" (no hints, nothing stands out, out of time). */
242
- private async likely(text: string, signal: AbortSignal): Promise<string> {
243
- try {
244
- return (await this.deps.hints?.block(text, signal)) ?? "";
245
- } catch {
246
- return "";
247
- }
256
+ /** The message's likely files as a fingerprinted, refreshed context pack — the same primitive task workers get — or "". */
257
+ private async pack(text: string, signal: AbortSignal): Promise<string> {
258
+ const paths = await this.deps.hints?.paths?.(text, signal).catch(() => undefined);
259
+ if (!paths?.length) return "";
260
+ const files = await Promise.all(paths.slice(0, CHAT_PACK_FILES).map((path) => packEntry(path, this.deps.cwd)));
261
+ const pack: ContextPack = { version: 1, files: files.filter((entry): entry is ContextPackFile => entry !== undefined), verification: [] };
262
+ const notes = await refreshContextPack(pack, this.deps.cwd);
263
+ return contextPackBlock(pack, notes);
248
264
  }
249
265
 
250
266
  private finish(job: ChatJob): void {
@@ -263,6 +279,7 @@ export class ChatAgents {
263
279
  finishedAt: new Date(job.finishedAt).toISOString(),
264
280
  status: job.status,
265
281
  });
282
+ if (job.status !== "cancelled") this.verify(edited);
266
283
  }
267
284
  this.deps.feed?.end(job.id, job.status !== "success");
268
285
  this.deps.feed?.settleThought(job.id);
@@ -272,6 +289,38 @@ export class ChatAgents {
272
289
  this.changed();
273
290
  this.pump();
274
291
  }
292
+
293
+ /** A chat reply that changed files gets the final checks in the background: single-flight, fingerprint-reused, reported to the feed. */
294
+ private verify(edited: readonly string[]): void {
295
+ const controller = new AbortController();
296
+ this.verificationControllers.add(controller);
297
+ this.verificationChain = this.verificationChain
298
+ .then(() => this.runChecks(edited, controller))
299
+ .catch((error: unknown) => {
300
+ this.deps.feed?.log("LOBBY", `chat checks could not run: ${error instanceof Error ? error.message : String(error)}`, "warning");
301
+ this.changed();
302
+ })
303
+ .finally(() => { this.verificationControllers.delete(controller); });
304
+ }
305
+
306
+ private async runChecks(edited: readonly string[], controller: AbortController): Promise<void> {
307
+ if (controller.signal.aborted) return;
308
+ const top = this.deps.cwd;
309
+ const report = await runVerification({ top, checks: finalChecks(top), signal: controller.signal, previous: this.previousVerification, exec: this.deps.verificationExec });
310
+ if (controller.signal.aborted) return;
311
+ this.previousVerification = report;
312
+ const passed = report.results.length > 0 && report.results.every((result) => result.state === "pass");
313
+ this.deps.feed?.log("LOBBY", `chat checks for ${edited.length} edited file${edited.length === 1 ? "" : "s"}: ${verificationSummary(report)}`, passed ? "success" : "warning");
314
+ this.changed();
315
+ }
316
+ }
317
+
318
+ /** One likely file's pack entry: fingerprint plus a bounded head snippet, or undefined when it cannot be read. */
319
+ async function packEntry(path: string, root: string): Promise<ContextPackFile | undefined> {
320
+ const content = await readFile(`${root}/${path}`, "utf8").catch(() => undefined);
321
+ if (content === undefined) return undefined;
322
+ const snippet = content.split("\n").slice(0, CHAT_PACK_LINES).join("\n").slice(0, 2_000);
323
+ return { path, ranges: [[1, Math.min(CHAT_PACK_LINES, content.split("\n").length)]], fingerprint: packFingerprint(content), snippet };
275
324
  }
276
325
 
277
326
  export function chatMetric(job: ChatJob): MetricRecord {
package/src/lobby/feed.ts CHANGED
@@ -373,7 +373,7 @@ export function chatText(role: "user" | "assistant", text: string): Array<{ role
373
373
  // Auto mode's nudge to keep going (pi/owner.ts autoNudge) shows as one short line.
374
374
  if (/^Auto mode: \S+ is \S+\. Keep driving it to completion/.test(body)) return [{ role: "note", text: AUTO_NOTE }];
375
375
  const comment = /^The user left (?:a comment|\d+ comments) on (the approved plan|the proposal) of (\S+) from the lobby:/.exec(body);
376
- if (comment) return [{ role: "note", text: `your comment on ${comment[1]} went to the oracle` }];
376
+ if (comment) return [{ role: "note", text: `your comment on ${comment[1]} went to the orchestrator` }];
377
377
  return [{ role: "you", text: body }];
378
378
  }
379
379
 
@@ -480,7 +480,7 @@ export function narrateEvent(feed: LobbyFeed, event: AgentEventLike, describe: (
480
480
  feed.thinkEnd("MASTER");
481
481
  if (message.stopReason === "error") {
482
482
  const error = (message.errorMessage ?? "the model call failed").split("\n")[0]!;
483
- feed.say("note", `✗ the oracle's turn failed: ${error}`);
483
+ feed.say("note", `✗ the orchestrator's turn failed: ${error}`);
484
484
  feed.log("MASTER", `turn failed — ${error}`, "error");
485
485
  }
486
486
  }
@@ -29,7 +29,7 @@ export const FILE_LABELS: Record<string, string> = {
29
29
  };
30
30
 
31
31
  /** Who the agents are, as the lobby names them. */
32
- export const AGENT_LABELS: Record<KnowledgeAgent, string> = { master: "Master (oracle)", designer: "Designer", backend: "Backend", qa: "QA" };
32
+ export const AGENT_LABELS: Record<KnowledgeAgent, string> = { master: "Orchestrator", designer: "Designer", backend: "Backend", qa: "QA" };
33
33
 
34
34
  /** A question for the oracle, outside task routing and the implementation workflow. */
35
35
  export function knowledgeQuestion(text: string, roots: readonly string[]): string {
@@ -104,7 +104,7 @@ export interface KnowledgeLedgerView {
104
104
  /** The metrics' agent names (`DEV`, `DESIGN`, `MASTER`, …) as knowledge agents. */
105
105
  function runAgent(name: string): KnowledgeAgent | undefined {
106
106
  const key = name.toUpperCase();
107
- if (key === "MASTER" || key === "ORACLE") return "master";
107
+ if (key === "MASTER" || key === "ORACLE" || key === "ORCHESTRATOR") return "master";
108
108
  if (key === "DEV" || key === "BACKEND") return "backend";
109
109
  if (key === "DESIGN" || key === "DESIGNER" || key === "FRONTEND") return "designer";
110
110
  if (key === "QA") return "qa";
@@ -112,7 +112,7 @@ function runAgent(name: string): KnowledgeAgent | undefined {
112
112
  }
113
113
 
114
114
  /** Short names, as the page's history lines use them. */
115
- const SHORT_NAMES: Record<KnowledgeAgent, string> = { master: "Oracle", designer: "Designer", backend: "Backend", qa: "QA" };
115
+ const SHORT_NAMES: Record<KnowledgeAgent, string> = { master: "Orchestrator", designer: "Designer", backend: "Backend", qa: "QA" };
116
116
 
117
117
  export class KnowledgeBook {
118
118
  private readonly deps: KnowledgeDeps;
@@ -54,7 +54,7 @@ export function piCommands(pi?: ExtensionAPI): LobbySlashCommand[] {
54
54
  }
55
55
 
56
56
  function compact(ctx: ExtensionContext, instructions: string): string {
57
- if (!ctx.isIdle()) return "the oracle is working — stop it before compacting";
57
+ if (!ctx.isIdle()) return "the orchestrator is working — stop it before compacting";
58
58
  ctx.compact({
59
59
  ...(instructions ? { customInstructions: instructions } : {}),
60
60
  onComplete: () => pushNotice("Session context compacted", "success"),
@@ -45,7 +45,7 @@ export const PLANNER_TOOLS: readonly string[] = ["read", "grep", "find", "ls"];
45
45
  export const RESEARCH_PANEL_TOOLS: readonly string[] = [...PLANNER_TOOLS, "web_search", "fetch_content", "source_check", "get_search_content"];
46
46
 
47
47
  /** The chair of the panel, as the Plan tab, the feed and the metrics name it. */
48
- export const ORACLE_LABEL = "ORACLE";
48
+ export const ORACLE_LABEL = "ORCHESTRATOR";
49
49
 
50
50
  export const MEMBER_LABELS: Record<PanelMember, string> = { backend: "DEV", designer: "DESIGN", qa: "QA", researcher: "RESEARCH" };
51
51
 
@@ -255,7 +255,7 @@ export function appendAssumptions(plan: string, questions: readonly PanelQuestio
255
255
  if (questions.length === 0) return plan;
256
256
  const lines = questions.map((question) => {
257
257
  const pick = recommendedOption(question);
258
- return `- [${question.from}] ${question.text} → ${pick ? optionLabel(pick) : "the oracle's call"} (${why})`;
258
+ return `- [${question.from}] ${question.text} → ${pick ? optionLabel(pick) : "the orchestrator's call"} (${why})`;
259
259
  });
260
260
  const rows = plan.split("\n");
261
261
  const heading = rows.findIndex((row) => /^#{2,3}\s+assumptions\s*$/i.test(row.trim()));
@@ -356,7 +356,7 @@ export function roundQuestions(reply: PlannerReply | undefined, seatQuestions: r
356
356
 
357
357
  /** A leading `[SEAT]` tag names who asked; the oracle uses it when it relays a seat. */
358
358
  function tagged(question: AskedQuestion, fallback: string): PanelQuestion {
359
- const tag = /^\[(DEV|DESIGN|QA|RESEARCH|ORACLE)\]\s*/i.exec(question.text);
359
+ const tag = /^\[(DEV|DESIGN|QA|RESEARCH|ORACLE|ORCHESTRATOR)\]\s*/i.exec(question.text);
360
360
  return tag ? { ...question, from: tag[1]!.toUpperCase(), text: question.text.slice(tag[0].length) } : { ...question, from: fallback };
361
361
  }
362
362
 
@@ -415,7 +415,7 @@ export function plannerTranscript(messages: readonly PlannerMessage[], seed?: Pl
415
415
  }
416
416
  const settled = messages.flatMap((message) => message.settled ?? []);
417
417
  if (settled.length > 0) lines.push(settledBlock(settled), "");
418
- if (draft) lines.push("## The oracle's current draft plan", "", truncate(draft, 8000), "");
418
+ if (draft) lines.push("## The orchestrator's current draft plan", "", truncate(draft, 8000), "");
419
419
  lines.push(closing);
420
420
  return lines.join("\n");
421
421
  }
@@ -516,8 +516,8 @@ export function commentBlock(comments: readonly LineComment[]): string {
516
516
  export function plannerSays(ready: boolean, questions: readonly PanelQuestion[], mode: RoundMode = "normal"): string {
517
517
  if (mode !== "normal") {
518
518
  return ready
519
- ? "The round limit is reached: the oracle decided what was still open (see Assumptions). Save the plan, or comment on a line to revise it."
520
- : "The round limit is reached, but there is no draft yet. Reply or retry to let the oracle write one.";
519
+ ? "The round limit is reached: the orchestrator decided what was still open (see Assumptions). Save the plan, or comment on a line to revise it."
520
+ : "The round limit is reached, but there is no draft yet. Reply or retry to let the orchestrator write one.";
521
521
  }
522
522
  if (ready) return "The panel agrees the plan is clear. Save it as a pending task, or keep refining.";
523
523
  if (questions.length === 0) return "No open questions this round. Save the draft, or add detail.";
@@ -39,7 +39,7 @@ export const CHAT_AGENT_SOURCES: Record<ChatAgent, string> = {
39
39
 
40
40
  /** The @ names the composer offers, in its menu's order, with what each one is for. */
41
41
  export const CHAT_MENTIONS: ReadonlyArray<{ name: string; agent: ChatAgent; hint: string }> = [
42
- { name: "master", agent: "master", hint: "The oracle: anything, and changes across the project" },
42
+ { name: "master", agent: "master", hint: "The orchestrator: anything, and changes across the project" },
43
43
  { name: "design", agent: "designer", hint: "Frontend: pages, components, styling and UX" },
44
44
  { name: "dev", agent: "backend", hint: "Backend: APIs, data and server code" },
45
45
  { name: "qa", agent: "qa", hint: "Tests, and how to check a change" },
@@ -48,7 +48,7 @@ export const CHAT_MENTIONS: ReadonlyArray<{ name: string; agent: ChatAgent; hint
48
48
  ];
49
49
 
50
50
  /** Other spellings an @ mention may use. */
51
- const MENTION_ALIASES: Record<string, ChatAgent> = { oracle: "master", designer: "designer", frontend: "designer", backend: "backend", researcher: "researcher" };
51
+ const MENTION_ALIASES: Record<string, ChatAgent> = { orchestrator: "master", oracle: "master", designer: "designer", frontend: "designer", backend: "backend", researcher: "researcher" };
52
52
 
53
53
  /** A message that opens with `@name`: who it is for and the rest of it; undefined for any other message. */
54
54
  export function parseMention(text: string): { agent: ChatAgent; rest: string } | undefined {
@@ -168,11 +168,11 @@ export function startLobbyService(pi: ExtensionAPI, ctx: ExtensionContext, confi
168
168
  // The owner's clock (pi/owner.ts) delivers comments and messages and drives auto mode; the lobby logs what it did.
169
169
  onOwnerEvent((event) => {
170
170
  lobbyTopics.bump("notices");
171
- if (event.kind === "comments") lobbyFeed.log("LOBBY", `passed ${event.count} plan comment${event.count === 1 ? "" : "s"} on ${event.taskId} to the oracle`, "info");
172
- else if (event.kind === "inbox" || event.kind === "messages") lobbyFeed.log("LOBBY", `passed ${event.count} message${event.count === 1 ? "" : "s"} from another session to the oracle`, "info");
171
+ if (event.kind === "comments") lobbyFeed.log("LOBBY", `passed ${event.count} plan comment${event.count === 1 ? "" : "s"} on ${event.taskId} to the orchestrator`, "info");
172
+ else if (event.kind === "inbox" || event.kind === "messages") lobbyFeed.log("LOBBY", `passed ${event.count} message${event.count === 1 ? "" : "s"} from another session to the orchestrator`, "info");
173
173
  else if (event.kind === "auto") lobbyFeed.log("LOBBY", `auto mode ${event.on ? "on" : "off"} for ${event.taskId}`, event.on ? "success" : "info");
174
- else if (event.kind === "held") lobbyFeed.log("LOBBY", `auto mode: you stopped the oracle on ${event.taskId}; it waits for your next message`, "info");
175
- else if (event.kind === "nudge") lobbyFeed.log("LOBBY", `auto mode: keeping the oracle going on ${event.taskId}`, "info");
174
+ else if (event.kind === "held") lobbyFeed.log("LOBBY", `auto mode: you stopped the orchestrator on ${event.taskId}; it waits for your next message`, "info");
175
+ else if (event.kind === "nudge") lobbyFeed.log("LOBBY", `auto mode: keeping the orchestrator going on ${event.taskId}`, "info");
176
176
  else lobbyFeed.log("LOBBY", `auto mode: no progress on ${event.taskId} — it needs you`, "warning");
177
177
  });
178
178
  return state;