chatroom-cli 1.149.2 → 1.149.4

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.
package/dist/index.js CHANGED
@@ -15047,7 +15047,6 @@ __export(exports_stdin_heredoc, {
15047
15047
  HANDOFF_STDIN_DELIMITER: () => HANDOFF_STDIN_DELIMITER,
15048
15048
  HANDOFF_MESSAGE_MARKER: () => HANDOFF_MESSAGE_MARKER,
15049
15049
  ENHANCER_STDIN_DELIMITER: () => ENHANCER_STDIN_DELIMITER,
15050
- CONTEXT_STDIN_DELIMITER: () => CONTEXT_STDIN_DELIMITER,
15051
15050
  BACKLOG_STDIN_DELIMITER: () => BACKLOG_STDIN_DELIMITER,
15052
15051
  AGENTIC_QUERY_STDIN_DELIMITER: () => AGENTIC_QUERY_STDIN_DELIMITER
15053
15052
  });
@@ -15085,11 +15084,10 @@ function findReservedDelimiterLines(content) {
15085
15084
  }
15086
15085
  return hits;
15087
15086
  }
15088
- var HANDOFF_STDIN_DELIMITER = "CHATROOM_HANDOFF_END", CONTEXT_STDIN_DELIMITER = "CHATROOM_CONTEXT_END", BACKLOG_STDIN_DELIMITER = "CHATROOM_BACKLOG_END", AGENTIC_QUERY_STDIN_DELIMITER = "CHATROOM_AGENTIC_QUERY_END", NOTIFY_USER_STDIN_DELIMITER = "CHATROOM_NOTIFY_END", PLAN_STDIN_DELIMITER = "CHATROOM_PLAN_END", ENHANCER_STDIN_DELIMITER = "CHATROOM_ENHANCER_END", CLASSIFY_STDIN_DELIMITER = "CHATROOM_CLASSIFY_END", HANDOFF_MESSAGE_MARKER = "---MESSAGE---", RESERVED_STDIN_HEREDOC_DELIMITERS, RESERVED_STRUCTURED_PARAM_MARKERS;
15087
+ var HANDOFF_STDIN_DELIMITER = "CHATROOM_HANDOFF_END", BACKLOG_STDIN_DELIMITER = "CHATROOM_BACKLOG_END", AGENTIC_QUERY_STDIN_DELIMITER = "CHATROOM_AGENTIC_QUERY_END", NOTIFY_USER_STDIN_DELIMITER = "CHATROOM_NOTIFY_END", PLAN_STDIN_DELIMITER = "CHATROOM_PLAN_END", ENHANCER_STDIN_DELIMITER = "CHATROOM_ENHANCER_END", CLASSIFY_STDIN_DELIMITER = "CHATROOM_CLASSIFY_END", HANDOFF_MESSAGE_MARKER = "---MESSAGE---", RESERVED_STDIN_HEREDOC_DELIMITERS, RESERVED_STRUCTURED_PARAM_MARKERS;
15089
15088
  var init_stdin_heredoc = __esm(() => {
15090
15089
  RESERVED_STDIN_HEREDOC_DELIMITERS = [
15091
15090
  HANDOFF_STDIN_DELIMITER,
15092
- CONTEXT_STDIN_DELIMITER,
15093
15091
  BACKLOG_STDIN_DELIMITER,
15094
15092
  AGENTIC_QUERY_STDIN_DELIMITER,
15095
15093
  NOTIFY_USER_STDIN_DELIMITER,
@@ -70139,50 +70137,167 @@ var init_register_agent = __esm(() => {
70139
70137
  init_services();
70140
70138
  init_convex_error();
70141
70139
  });
70142
- // ../../services/backend/prompts/cli/context/context-template.ts
70143
- function getContextViewTemplate() {
70144
- return CONTEXT_VIEW_TEMPLATE;
70140
+ // ../../services/backend/prompts/cli/task-started/main-prompt.ts
70141
+ var init_main_prompt = () => {};
70142
+
70143
+ // ../../services/backend/prompts/cli/task-started/index.ts
70144
+ var init_task_started = __esm(() => {
70145
+ init_main_prompt();
70146
+ });
70147
+
70148
+ // ../../services/backend/prompts/cli/handoff/command.ts
70149
+ function handoffCommand(params) {
70150
+ const prefix = params.cliEnvPrefix || "";
70151
+ const chatroomId = params.chatroomId || "<chatroom-id>";
70152
+ const role = params.role || "<role>";
70153
+ const nextRole = params.nextRole || "<target>";
70154
+ const placeholder = params.messagePlaceholder ?? "[Your message here]";
70155
+ const commandPrefix = `${prefix}chatroom handoff --chatroom-id="${chatroomId}" --role="${role}" --next-role="${nextRole}"`;
70156
+ return formatStdinHeredocCommand(commandPrefix, HANDOFF_STDIN_DELIMITER, placeholder, {
70157
+ messageMarker: HANDOFF_MESSAGE_MARKER
70158
+ });
70159
+ }
70160
+ var init_command = __esm(() => {
70161
+ init_stdin_heredoc();
70162
+ });
70163
+
70164
+ // ../../services/backend/prompts/teams/verifier-handoff-templates.ts
70165
+ function getEntryPointToVerifierHandoffTemplate(query) {
70166
+ const entryPoint = query.fromRole;
70167
+ return `Instructions (not part of the message): The verifier judges, from chatroom logs only, whether the user's last message was achieved. It ${VERIFIER_TEST_RULE}; list any user-requested tests under Requested test runs. Treat the claimed outcome as a claim, not as evidence: the verifier does not trust it and checks every requirement against the logs themselves. List every message id that carries the claimed work under Log message ids, so the verifier can read those messages from the logs. Request this review only when the task involved code changes, in any conversation mode. The verdict returns to \`${entryPoint}\`.
70168
+
70169
+ ## Round
70170
+ <1 or 2; for 2, cite the round-1 verdict message id>
70171
+
70172
+ ## Mode
70173
+ <chat | code>
70174
+
70175
+ ## User message id
70176
+ <id of the user's last message: the origin message id of the user task, or from \`chatroom messages anchor\`>
70177
+
70178
+ ## Log message ids
70179
+ <one per line as \`<message id> — <sender role> — <what it shows>\`: every message that carries the claimed work, in order: builder and specialist handoff reports, the reviewer report, and commit or PR evidence messages; or exactly \`None beyond the user message.\`>
70180
+
70181
+ ## Requested test runs
70182
+ <the test commands the user explicitly asked for, one per line, or exactly \`None requested.\`>
70183
+
70184
+ ## Claimed outcome
70185
+ <requirement-by-requirement what you believe is complete>
70186
+
70187
+ ## Evidence pointers
70188
+ <commit hashes, PR URLs, and test results the claimed outcome relies on, as quoted in the messages listed under Log message ids>
70189
+
70190
+ ## Known gaps
70191
+ <anything incomplete, or exactly \`None.\`>
70192
+
70193
+ Instructions after the body (not part of the message): run the normal handoff command to \`${entryPoint}\` with the complete body above, then stop.
70194
+
70195
+ \`\`\`bash
70196
+ ${handoffCommand({
70197
+ chatroomId: "<chatroom-id>",
70198
+ role: entryPoint,
70199
+ nextRole: "verifier",
70200
+ cliEnvPrefix: ""
70201
+ })}
70202
+ \`\`\``;
70145
70203
  }
70146
- var CONTEXT_VIEW_TEMPLATE = `## Goal
70147
- - **User-centric:** _Describe what the user wants in plain language._
70148
- - **Development-centric:** _Describe what we are building or changing._
70204
+ function getVerifierToEntryPointHandoffTemplate(query) {
70205
+ const entryPoint = query.toRole;
70206
+ return `Instructions (not part of the message): Return one advisory verdict for the authoritative request. This review is non-binding: it uses chatroom logs, plus the requested test runs listed in the request, if any, deciding every requirement from the evidence those logs and runs actually contain. It also checks the work against the user's expectations (\`## User Expectations\`) under the same logs-only, claim-is-not-evidence rule. It ${VERIFIER_TEST_RULE}. Never accept the claimed outcome as proof. Use the exact sections below, in this order.
70207
+
70208
+ ## Verdict
70209
+ <exactly one of ${VERIFIER_VERDICTS.join(", ")} as the value; ${ACHIEVED} only if every requirement and user expectation is met; ${NOT_ACHIEVED} if any requirement or user expectation is unmet (logs show it was not done, or contradict it); ${INCONCLUSIVE} if none is unmet but any is unverified (logs are silent)>
70210
+
70211
+ ## Objective
70212
+ <user message id, any prior user messages used, objective in 1-2 sentences>
70149
70213
 
70150
70214
  ## Requirements
70151
- - _One concrete outcome or requirement per bullet._
70215
+ <numbered \`R1 — <requirement> — met | unmet | unverified — <evidence ref>\`>
70152
70216
 
70153
- ## Structure
70154
- - _Key files, folders, or architecture decisions (e.g. module boundaries, SSOT locations)._
70217
+ ## User Expectations
70218
+ <numbered \`U1 — <expectation from the user's handoff template> — met | unmet | unverified — <evidence ref>\`; exactly \`None applicable.\` in chat mode or when no expectation applies>
70155
70219
 
70156
- ## Avoid
70157
- - _Out-of-scope work or anti-patterns to skip._`;
70220
+ ## Evidence
70221
+ <bullets: \`<message id or handoff> — "<short quote>" — supports R#\`; for a requested test run, \`<command> — exit <result> — supports R#\`>
70158
70222
 
70159
- // ../../services/backend/prompts/cli/context/view-template.ts
70160
- var init_view_template = () => {};
70223
+ ## Missing or unmet
70224
+ <per unmet or unverified requirement or user expectation: what is missing and what evidence would resolve it; exactly \`None.\` if ${ACHIEVED}>
70161
70225
 
70162
- // ../../services/backend/prompts/cli/context/new.ts
70163
- var init_new = __esm(() => {
70164
- init_stdin_heredoc();
70165
- init_view_template();
70226
+ ## Scope and limits
70227
+ <state the test runs the verifier executed (command and exit result), or "No tests were run; none were requested."; the log range read (first and last message id, and the message count); whether the download was truncated; which Log message ids were found in that range and which were not>
70228
+
70229
+ Instructions after the body (not part of the message): run the normal handoff command to \`${entryPoint}\` with the complete body above, then stop.
70230
+
70231
+ \`\`\`bash
70232
+ ${handoffCommand({
70233
+ chatroomId: "<chatroom-id>",
70234
+ role: "verifier",
70235
+ nextRole: entryPoint,
70236
+ cliEnvPrefix: ""
70237
+ })}
70238
+ \`\`\``;
70239
+ }
70240
+ var VERIFIER_VERDICTS, VERIFIER_TEST_RULE = "runs no test the user did not ask for, and never builds, lints, or edits", ACHIEVED, NOT_ACHIEVED, INCONCLUSIVE;
70241
+ var init_verifier_handoff_templates = __esm(() => {
70242
+ init_command();
70243
+ VERIFIER_VERDICTS = ["ACHIEVED", "NOT_ACHIEVED", "INCONCLUSIVE"];
70244
+ [ACHIEVED, NOT_ACHIEVED, INCONCLUSIVE] = VERIFIER_VERDICTS;
70166
70245
  });
70167
70246
 
70168
- // ../../services/backend/prompts/cli/context/read.ts
70169
- function contextReadCommand(params = {}) {
70247
+ // ../../services/backend/prompts/utils/proof-of-verification.ts
70248
+ function messagesAnchorCommand(params = {}) {
70170
70249
  const prefix = params.cliEnvPrefix ?? "";
70171
70250
  const chatroomId = params.chatroomId ?? "<chatroom-id>";
70172
70251
  const role = params.role ?? "<role>";
70173
- return `${prefix}chatroom context read --chatroom-id="${chatroomId}" --role="${role}"`;
70252
+ return `${prefix}chatroom messages anchor --chatroom-id="${chatroomId}" --role="${role}"`;
70174
70253
  }
70175
-
70176
- // ../../services/backend/prompts/cli/task-started/main-prompt.ts
70177
- var init_main_prompt = __esm(() => {
70178
- init_new();
70179
- });
70180
-
70181
- // ../../services/backend/prompts/cli/task-started/index.ts
70182
- var init_task_started = __esm(() => {
70183
- init_main_prompt();
70254
+ function messagesDownloadSinceCommand(params = {}) {
70255
+ const prefix = params.cliEnvPrefix ?? "";
70256
+ const chatroomId = params.chatroomId ?? "<chatroom-id>";
70257
+ const role = params.role ?? "<role>";
70258
+ const sinceMessageId = params.sinceMessageId ?? "<id>";
70259
+ const limit = params.limit ?? 100;
70260
+ return `${prefix}chatroom messages download --chatroom-id="${chatroomId}" --role="${role}" --since-message-id="${sinceMessageId}" --limit=${limit}`;
70261
+ }
70262
+ function verifierRequestCommand(params = {}) {
70263
+ const prefix = params.cliEnvPrefix ?? "";
70264
+ const chatroomId = params.chatroomId ?? "<chatroom-id>";
70265
+ const role = params.role ?? "<role>";
70266
+ return `${prefix}chatroom handoff --chatroom-id="${chatroomId}" --role="${role}" --next-role="verifier"`;
70267
+ }
70268
+ function getVerifierReviewDisclosureBlock(params = {}) {
70269
+ return `**Proof of verification (verifier review):**
70270
+ ${VERIFIER_REVIEW_CHECKBOX}
70271
+ - Verifier review: <${VERIFIER_REVIEW_VALUES}>
70272
+ - Verifier request command (disclose the command you sent): \`${verifierRequestCommand(params)}\`
70273
+ - Verifier request message id: <id of your verifier handoff> · Round: <1 | 2>
70274
+ - Verdict message id: <id of the verifier's verdict handoff> · Verdict user message id: <id> (must equal the current last user message)
70275
+ - Verdict gaps (only if not ACHIEVED): <each unmet item, or \`None.\`>`;
70276
+ }
70277
+ function getProofOfVerificationComment(params = {}) {
70278
+ const anchorCmd = messagesAnchorCommand(params);
70279
+ const downloadCmd = messagesDownloadSinceCommand({
70280
+ ...params,
70281
+ sinceMessageId: "<from-anchor>",
70282
+ limit: 100
70283
+ });
70284
+ return `<!-- Entry-point proof-of-completion workflow — run before filling this section:
70285
+ 1. \`${anchorCmd}\` — locate the user's last message (and prior user messages for context)
70286
+ 2. \`${downloadCmd}\` — download grep-friendly history since anchor; read handoffs and goals
70287
+ 3. If the user's last message was terse (e.g. "do it", "raise a PR"), review prior user messages from anchor output and widen --limit before validating
70288
+ 4. Validate commits/PRs against ALL requirements — not just the last slice. Incomplete → rework; do NOT hand off to user.
70289
+ Then: \`${anchorCmd}\` → \`${downloadCmd}\` (use the message ID from anchor output as --since-message-id) -->`;
70290
+ }
70291
+ function getEntryPointProofOfCompletionVerificationBlock(params = {}) {
70292
+ return `${getProofOfVerificationComment(params)}
70293
+ ${PROOF_OF_VERIFICATION_CHECKBOX}
70294
+ ${getVerifierReviewDisclosureBlock(params)}`;
70295
+ }
70296
+ var PROOF_OF_VERIFICATION_CHECKBOX = "- [ ] I confirm I verified the user's full request: anchored on the last user message, downloaded history since that anchor, reviewed handoffs/goals (including prior user messages when the latest was a terse follow-up), and validated every requirement below before this handoff", VERIFIER_REVIEW_CHECKBOX = "- [ ] I checked the verifier verdict for this task: its user message id is the user's current last message, it is round 1 or 2 (maximum 2), and the verdict is `ACHIEVED` — or every unmet item is listed under Unresolved / action required", VERIFIER_REVIEW_VALUES;
70297
+ var init_proof_of_verification = __esm(() => {
70298
+ init_verifier_handoff_templates();
70299
+ VERIFIER_REVIEW_VALUES = `${VERIFIER_VERDICTS.join(" | ")} | UNAVAILABLE (<reason>) | not required (no code changes)`;
70184
70300
  });
70185
-
70186
70301
  // ../../services/backend/prompts/cli/get-next-task/reminder.ts
70187
70302
  function getNextTaskReminder() {
70188
70303
  return "A foreground `get-next-task` blocks until the user or team message is ready, then resolves with that message as a chatroom task—treat the message content as the source of truth for what to do. Message availability requires exactly one such blocking tool call; the harness delivers chatroom tasks only while it blocks. Duplicate or backgrounded listeners can acknowledge tasks early and trigger grace-period cooldowns where your active session receives nothing.";
@@ -70200,7 +70315,9 @@ Exactly one active waiter should own task delivery at a time. Additional or back
70200
70315
 
70201
70316
  After interruption or restart: complete any in-progress work, then restore a single foreground blocking \`get-next-task\` so chatroom tasks can arrive again.`;
70202
70317
  }
70203
- var init_reminder = () => {};
70318
+ var init_reminder = __esm(() => {
70319
+ init_proof_of_verification();
70320
+ });
70204
70321
  // ../../services/backend/prompts/utils/index.ts
70205
70322
  var init_utils = __esm(() => {
70206
70323
  init_env();
@@ -70234,7 +70351,7 @@ function getNextTaskCommand(params) {
70234
70351
  const role = params.role || "<role>";
70235
70352
  return `${prefix}chatroom get-next-task --chatroom-id="${chatroomId}" --role="${role}"`;
70236
70353
  }
70237
- var init_command = () => {};
70354
+ var init_command2 = () => {};
70238
70355
 
70239
70356
  // src/commands/get-next-task/session.ts
70240
70357
  class GetNextTaskSession {
@@ -70476,9 +70593,9 @@ To reconnect, run:`);
70476
70593
  } catch (deliveryError) {
70477
70594
  this.logAndExit(1, "task_delivery_failed", `⚠️ TASK CLAIMED BUT DELIVERY FAILED — ${sanitizeUnknownForTerminal(deliveryError.message)}`, `Task ID: ${task._id}
70478
70595
  ` + `The task has been claimed for your role.
70479
- ` + `Use context read to see your current task:
70596
+ ` + `Use messages download to see your current task:
70480
70597
 
70481
- ` + ` ${this.cliEnvPrefix} chatroom context read --chatroom-id=${this.chatroomId} --role=${this.role}`);
70598
+ ` + ` ${this.cliEnvPrefix} chatroom messages download --chatroom-id=${this.chatroomId} --role=${this.role} --format=linear --limit=10`);
70482
70599
  }
70483
70600
  }
70484
70601
  registerSignalHandlers() {
@@ -70493,7 +70610,7 @@ To reconnect, run:`);
70493
70610
  }
70494
70611
  var init_session2 = __esm(() => {
70495
70612
  init_errorCodes();
70496
- init_command();
70613
+ init_command2();
70497
70614
  init_values();
70498
70615
  init_api3();
70499
70616
  init_client2();
@@ -71050,22 +71167,6 @@ function getHandoffRecipientVisibilityCallout(toRole) {
71050
71167
  > Recipient visibility: the ${recipient} receives only the text inside your ${sendCommand} command${toRole.toLowerCase() === "user" ? ", plus any `notify-user` notices you sent earlier in this task" : ""}. It cannot see anything you write in this agent session${toRole.toLowerCase() === "user" ? " (including direct replies)" : ""}, or tool output. Put your complete deliverable in the handoff message.`;
71051
71168
  }
71052
71169
 
71053
- // ../../services/backend/prompts/cli/handoff/command.ts
71054
- function handoffCommand(params) {
71055
- const prefix = params.cliEnvPrefix || "";
71056
- const chatroomId = params.chatroomId || "<chatroom-id>";
71057
- const role = params.role || "<role>";
71058
- const nextRole = params.nextRole || "<target>";
71059
- const placeholder = params.messagePlaceholder ?? "[Your message here]";
71060
- const commandPrefix = `${prefix}chatroom handoff --chatroom-id="${chatroomId}" --role="${role}" --next-role="${nextRole}"`;
71061
- return formatStdinHeredocCommand(commandPrefix, HANDOFF_STDIN_DELIMITER, placeholder, {
71062
- messageMarker: HANDOFF_MESSAGE_MARKER
71063
- });
71064
- }
71065
- var init_command2 = __esm(() => {
71066
- init_stdin_heredoc();
71067
- });
71068
-
71069
71170
  // ../../services/backend/prompts/utils/file-reference-guidance.ts
71070
71171
  function getFileReferenceGuidanceComment() {
71071
71172
  return `<!-- File references (clickable in workspace UI): use repo-relative paths with a file extension — e.g. \`apps/webapp/src/modules/chatroom/foo.ts\` or [apps/webapp/src/foo.ts](apps/webapp/src/foo.ts). Avoid absolute paths, file:// prefixes, and paths without / or extension. -->`;
@@ -71192,7 +71293,7 @@ ${handoffCommand({
71192
71293
  \`\`\``;
71193
71294
  }
71194
71295
  var init_architect_handoff_templates = __esm(() => {
71195
- init_command2();
71296
+ init_command();
71196
71297
  });
71197
71298
 
71198
71299
  // ../../services/backend/prompts/teams/duo/handoff-templates/architect-planner-code.ts
@@ -71816,7 +71917,7 @@ var PROOF_OF_PRINCIPLES_REPORT;
71816
71917
  var init_game_asset_designer_handoff_templates = __esm(() => {
71817
71918
  init_game_asset_designer_evidence();
71818
71919
  init_game_asset_designer_workflow();
71819
- init_command2();
71920
+ init_command();
71820
71921
  PROOF_OF_PRINCIPLES_REPORT = GAME_ASSET_RULES.map((rule) => `- [ ] ${rule} — <evidence: command lines and output values; grid values when a sheet was generated; naming map reference when names came from a mapping>`).join(`
71821
71922
  `);
71822
71923
  });
@@ -72085,7 +72186,7 @@ ${handoffCommand({
72085
72186
  \`\`\``;
72086
72187
  }
72087
72188
  var init_product_manager_handoff_templates = __esm(() => {
72088
- init_command2();
72189
+ init_command();
72089
72190
  });
72090
72191
 
72091
72192
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-product-manager-code.ts
@@ -72170,7 +72271,7 @@ ${handoffCommand({
72170
72271
  \`\`\``;
72171
72272
  }
72172
72273
  var init_researcher_handoff_templates = __esm(() => {
72173
- init_command2();
72274
+ init_command();
72174
72275
  });
72175
72276
 
72176
72277
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-researcher-code.ts
@@ -72258,7 +72359,7 @@ ${handoffCommand({
72258
72359
  \`\`\``;
72259
72360
  }
72260
72361
  var init_reviewer_handoff_templates = __esm(() => {
72261
- init_command2();
72362
+ init_command();
72262
72363
  });
72263
72364
 
72264
72365
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-reviewer-code.ts
@@ -72329,7 +72430,7 @@ ${handoffCommand({
72329
72430
  \`\`\``;
72330
72431
  }
72331
72432
  var init_triage_handoff_templates = __esm(() => {
72332
- init_command2();
72433
+ init_command();
72333
72434
  });
72334
72435
 
72335
72436
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-triage-code.ts
@@ -72473,7 +72574,7 @@ ${handoffCommand({
72473
72574
  \`\`\``;
72474
72575
  }
72475
72576
  var init_uiux_engineer_handoff_templates = __esm(() => {
72476
- init_command2();
72577
+ init_command();
72477
72578
  });
72478
72579
 
72479
72580
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-uiux-engineer-code.ts
@@ -72500,18 +72601,6 @@ function getChatToUserHandoffTemplate() {
72500
72601
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-user-chat.ts
72501
72602
  var init_planner_user_chat = () => {};
72502
72603
 
72503
- // ../../services/backend/prompts/utils/context-disclosure.ts
72504
- function getContextReadDisclosureComment(params = {}) {
72505
- const command = contextReadCommand(params);
72506
- return `<!-- Read context before handoff if not already done this task: \`${command}\`. State the context goal and confirm it was achieved. -->`;
72507
- }
72508
- function getContextReadDisclosureBlock(params = {}) {
72509
- return `${CONTEXT_READ_DISCLOSURE_CHECKBOX}
72510
- ${getContextReadDisclosureComment(params)}`;
72511
- }
72512
- var CONTEXT_READ_DISCLOSURE_CHECKBOX = "- [ ] I confirm that I read the current chatroom task context using the command below and that the goal stated in that context has been met";
72513
- var init_context_disclosure = () => {};
72514
-
72515
72604
  // ../../services/backend/prompts/utils/handoff-severity-guidance.ts
72516
72605
  function getHandoffSeverityGuidanceBlock() {
72517
72606
  return `<!-- Severity: prefix each Tech Debt and Unresolved Decision bullet with [high], [medium], or [low] -->
@@ -72520,144 +72609,6 @@ function getHandoffSeverityGuidanceBlock() {
72520
72609
  - [low] <minor cleanup — nice to have>`;
72521
72610
  }
72522
72611
 
72523
- // ../../services/backend/prompts/teams/verifier-handoff-templates.ts
72524
- function getEntryPointToVerifierHandoffTemplate(query) {
72525
- const entryPoint = query.fromRole;
72526
- return `Instructions (not part of the message): The verifier judges, from chatroom logs only, whether the user's last message was achieved. It ${VERIFIER_TEST_RULE}; list any user-requested tests under Requested test runs. Treat the claimed outcome as a claim, not as evidence: the verifier does not trust it and checks every requirement against the logs themselves. Request this review only when the task involved code changes, in any conversation mode. The verdict returns to \`${entryPoint}\`.
72527
-
72528
- ## Round
72529
- <1 or 2; for 2, cite the round-1 verdict message id>
72530
-
72531
- ## Mode
72532
- <chat | code>
72533
-
72534
- ## User message id
72535
- <id of the user's last message: the origin message id of the user task, or from \`chatroom messages anchor\`>
72536
-
72537
- ## Context id
72538
- <id from \`chatroom context read\`, or \`none\` if no context was read for this task>
72539
-
72540
- ## Requested test runs
72541
- <the test commands the user explicitly asked for, one per line, or exactly \`None requested.\`>
72542
-
72543
- ## Claimed outcome
72544
- <requirement-by-requirement what you believe is complete>
72545
-
72546
- ## Evidence pointers
72547
- <builder handoff message ids, commits, PRs, and test results as quoted in those handoffs>
72548
-
72549
- ## Known gaps
72550
- <anything incomplete, or exactly \`None.\`>
72551
-
72552
- Instructions after the body (not part of the message): run the normal handoff command to \`${entryPoint}\` with the complete body above, then stop.
72553
-
72554
- \`\`\`bash
72555
- ${handoffCommand({
72556
- chatroomId: "<chatroom-id>",
72557
- role: entryPoint,
72558
- nextRole: "verifier",
72559
- cliEnvPrefix: ""
72560
- })}
72561
- \`\`\``;
72562
- }
72563
- function getVerifierToEntryPointHandoffTemplate(query) {
72564
- const entryPoint = query.toRole;
72565
- return `Instructions (not part of the message): Return one advisory verdict for the authoritative request. This review is non-binding: it uses chatroom logs, plus the requested test runs listed in the request, if any, deciding every requirement from the evidence those logs and runs actually contain. It also checks the work against the user's expectations (\`## User Expectations\`) under the same logs-only, claim-is-not-evidence rule. It ${VERIFIER_TEST_RULE}. Never accept the claimed outcome as proof. Use the exact sections below, in this order.
72566
-
72567
- ## Verdict
72568
- <exactly one of ${VERIFIER_VERDICTS.join(", ")} as the value; ${ACHIEVED} only if every requirement and user expectation is met; ${NOT_ACHIEVED} if any requirement or user expectation is unmet (logs show it was not done, or contradict it); ${INCONCLUSIVE} if none is unmet but any is unverified (logs are silent)>
72569
-
72570
- ## Objective
72571
- <user message id, any prior user messages used, objective in 1-2 sentences>
72572
-
72573
- ## Requirements
72574
- <numbered \`R1 — <requirement> — met | unmet | unverified — <evidence ref>\`>
72575
-
72576
- ## User Expectations
72577
- <numbered \`U1 — <expectation from the user's handoff template> — met | unmet | unverified — <evidence ref>\`; exactly \`None applicable.\` in chat mode or when no expectation applies>
72578
-
72579
- ## Evidence
72580
- <bullets: \`<message id or handoff> — "<short quote>" — supports R#\`; for a requested test run, \`<command> — exit <result> — supports R#\`>
72581
-
72582
- ## Missing or unmet
72583
- <per unmet or unverified requirement or user expectation: what is missing and what evidence would resolve it; exactly \`None.\` if ${ACHIEVED}>
72584
-
72585
- ## Scope and limits
72586
- <state the test runs the verifier executed (command and exit result), or "No tests were run; none were requested."; log range read; whether the download was truncated; context id read and whether it matched the request>
72587
-
72588
- Instructions after the body (not part of the message): run the normal handoff command to \`${entryPoint}\` with the complete body above, then stop.
72589
-
72590
- \`\`\`bash
72591
- ${handoffCommand({
72592
- chatroomId: "<chatroom-id>",
72593
- role: "verifier",
72594
- nextRole: entryPoint,
72595
- cliEnvPrefix: ""
72596
- })}
72597
- \`\`\``;
72598
- }
72599
- var VERIFIER_VERDICTS, VERIFIER_TEST_RULE = "runs no test the user did not ask for, and never builds, lints, or edits", ACHIEVED, NOT_ACHIEVED, INCONCLUSIVE;
72600
- var init_verifier_handoff_templates = __esm(() => {
72601
- init_command2();
72602
- VERIFIER_VERDICTS = ["ACHIEVED", "NOT_ACHIEVED", "INCONCLUSIVE"];
72603
- [ACHIEVED, NOT_ACHIEVED, INCONCLUSIVE] = VERIFIER_VERDICTS;
72604
- });
72605
-
72606
- // ../../services/backend/prompts/utils/proof-of-verification.ts
72607
- function messagesAnchorCommand(params = {}) {
72608
- const prefix = params.cliEnvPrefix ?? "";
72609
- const chatroomId = params.chatroomId ?? "<chatroom-id>";
72610
- const role = params.role ?? "<role>";
72611
- return `${prefix}chatroom messages anchor --chatroom-id="${chatroomId}" --role="${role}"`;
72612
- }
72613
- function messagesDownloadSinceCommand(params = {}) {
72614
- const prefix = params.cliEnvPrefix ?? "";
72615
- const chatroomId = params.chatroomId ?? "<chatroom-id>";
72616
- const role = params.role ?? "<role>";
72617
- const sinceMessageId = params.sinceMessageId ?? "<id>";
72618
- const limit = params.limit ?? 100;
72619
- return `${prefix}chatroom messages download --chatroom-id="${chatroomId}" --role="${role}" --since-message-id="${sinceMessageId}" --limit=${limit}`;
72620
- }
72621
- function verifierRequestCommand(params = {}) {
72622
- const prefix = params.cliEnvPrefix ?? "";
72623
- const chatroomId = params.chatroomId ?? "<chatroom-id>";
72624
- const role = params.role ?? "<role>";
72625
- return `${prefix}chatroom handoff --chatroom-id="${chatroomId}" --role="${role}" --next-role="verifier"`;
72626
- }
72627
- function getVerifierReviewDisclosureBlock(params = {}) {
72628
- return `**Proof of verification (verifier review):**
72629
- ${VERIFIER_REVIEW_CHECKBOX}
72630
- - Verifier review: <${VERIFIER_REVIEW_VALUES}>
72631
- - Verifier request command (disclose the command you sent): \`${verifierRequestCommand(params)}\`
72632
- - Verifier request message id: <id of your verifier handoff> · Round: <1 | 2>
72633
- - Verdict message id: <id of the verifier's verdict handoff> · Verdict user message id: <id> (must equal the current last user message)
72634
- - Verdict gaps (only if not ACHIEVED): <each unmet item, or \`None.\`>`;
72635
- }
72636
- function getProofOfVerificationComment(params = {}) {
72637
- const anchorCmd = messagesAnchorCommand(params);
72638
- const downloadCmd = messagesDownloadSinceCommand({
72639
- ...params,
72640
- sinceMessageId: "<from-anchor>",
72641
- limit: 100
72642
- });
72643
- return `<!-- Entry-point proof-of-completion workflow — run before filling this section:
72644
- 1. \`${anchorCmd}\` — locate the user's last message (and prior user messages for context)
72645
- 2. \`${downloadCmd}\` — download grep-friendly history since anchor; read handoffs and goals
72646
- 3. If the user's last message was terse (e.g. "do it", "raise a PR"), review prior user messages from anchor output and widen --limit before validating
72647
- 4. Validate commits/PRs against ALL requirements — not just the last slice. Incomplete → rework; do NOT hand off to user.
72648
- Then: \`${anchorCmd}\` → \`${downloadCmd}\` (use the message ID from anchor output as --since-message-id) -->`;
72649
- }
72650
- function getEntryPointProofOfCompletionVerificationBlock(params = {}) {
72651
- return `${getProofOfVerificationComment(params)}
72652
- ${PROOF_OF_VERIFICATION_CHECKBOX}
72653
- ${getVerifierReviewDisclosureBlock(params)}`;
72654
- }
72655
- var PROOF_OF_VERIFICATION_CHECKBOX = "- [ ] I confirm I verified the user's full request: anchored on the last user message, downloaded history since that anchor, reviewed handoffs/goals (including prior user messages when the latest was a terse follow-up), and validated every requirement below before this handoff", VERIFIER_REVIEW_CHECKBOX = "- [ ] I checked the verifier verdict for this task: its user message id is the user's current last message, it is round 1 or 2 (maximum 2), and the verdict is `ACHIEVED` — or every unmet item is listed under Unresolved / action required", VERIFIER_REVIEW_VALUES;
72656
- var init_proof_of_verification = __esm(() => {
72657
- init_verifier_handoff_templates();
72658
- VERIFIER_REVIEW_VALUES = `${VERIFIER_VERDICTS.join(" | ")} | UNAVAILABLE (<reason>) | not required (no code changes)`;
72659
- });
72660
-
72661
72612
  // ../../services/backend/prompts/utils/unresolved-decisions.ts
72662
72613
  function getUnresolvedDecisionsSectionBlock() {
72663
72614
  return `## Unresolved Decisions
@@ -72669,7 +72620,7 @@ ${getHandoffSeverityGuidanceBlock()}
72669
72620
  var init_unresolved_decisions = () => {};
72670
72621
 
72671
72622
  // ../../services/backend/prompts/utils/handoff-report-template-body.ts
72672
- function getHandoffReportTemplateBody(roleGuidanceContext, options = {}) {
72623
+ function getHandoffReportTemplateBody(roleGuidanceContext) {
72673
72624
  return `<handoff-overview>
72674
72625
  <!-- When the task is informational (summaries, feedback, Q&amp;A with no code changes): put the complete primary answer in Summary and What changed. Do not rely on earlier \`notify-user\` notices or session text. -->
72675
72626
  ## Summary
@@ -72694,16 +72645,12 @@ ${getHandoffNotApplicableSectionComment("List planning steps for trivial single-
72694
72645
  ${getHandoffQualityPrinciplesSectionBlock()}
72695
72646
 
72696
72647
  ## Proof of Completion
72697
- ${options.includeProofOfVerification ? `${getEntryPointProofOfCompletionVerificationBlock(roleGuidanceContext)}
72698
- ${getContextReadDisclosureBlock(roleGuidanceContext)}
72699
- - Context goal: <state the context goal and confirm it was achieved>
72648
+ ${getEntryPointProofOfCompletionVerificationBlock(roleGuidanceContext)}
72700
72649
  - Requirements (one bullet per user requirement from the user's message — met/not met + evidence):
72701
72650
  - <requirement> — <PR URL, commit hash, or file evidence>
72702
72651
  - Files changed (code tasks — list every file modified):
72703
72652
  ${getFileReferenceProofOfCompletionExample()}
72704
- - <additional files as needed>` : `${getContextReadDisclosureBlock(roleGuidanceContext)}
72705
- ${getFileReferenceProofOfCompletionExample()}
72706
- <evidence the goal was met — list every file you (or the builder) modified>`}
72653
+ - <additional files as needed>
72707
72654
  ## Backlog Tasks Implemented
72708
72655
  ${getHandoffNotApplicableSectionComment("List backlog items addressed if none were in scope")}
72709
72656
  - \`backlog-item-id\` — <backlog item title/summary and how this work addresses it>
@@ -72755,7 +72702,6 @@ ${getHandoffNotApplicableSectionComment("List manual steps outside the system")}
72755
72702
  }
72756
72703
  var init_handoff_report_template_body = __esm(() => {
72757
72704
  init_code_change_verification();
72758
- init_context_disclosure();
72759
72705
  init_handoff_quality_principles();
72760
72706
  init_proof_of_verification();
72761
72707
  init_role_guidance_disclosure();
@@ -72767,7 +72713,7 @@ function getPlannerUserCodeTemplate(roleGuidanceContext) {
72767
72713
  return `${getHandoffReportTemplateIntro()}
72768
72714
 
72769
72715
  \`\`\`markdown
72770
- ${getHandoffReportTemplateBody(roleGuidanceContext, { includeProofOfVerification: true })}
72716
+ ${getHandoffReportTemplateBody(roleGuidanceContext)}
72771
72717
  \`\`\``;
72772
72718
  }
72773
72719
  var init_planner_user_code = __esm(() => {
@@ -73234,7 +73180,7 @@ function getSoloUserCodeTemplate(roleGuidanceContext) {
73234
73180
  return `${getHandoffReportTemplateIntro()}
73235
73181
 
73236
73182
  \`\`\`markdown
73237
- ${getHandoffReportTemplateBody(roleGuidanceContext, { includeProofOfVerification: true })}
73183
+ ${getHandoffReportTemplateBody(roleGuidanceContext)}
73238
73184
  \`\`\``;
73239
73185
  }
73240
73186
  var init_solo_user_code = __esm(() => {
@@ -73676,7 +73622,7 @@ function getCoordinatorUserCodeTemplate(roleGuidanceContext) {
73676
73622
  return `${getHandoffReportTemplateIntro()}
73677
73623
 
73678
73624
  \`\`\`markdown
73679
- ${getHandoffReportTemplateBody(roleGuidanceContext, { includeProofOfVerification: true })}
73625
+ ${getHandoffReportTemplateBody(roleGuidanceContext)}
73680
73626
  \`\`\``;
73681
73627
  }
73682
73628
  var init_coordinator_user_code = __esm(() => {
@@ -74297,7 +74243,7 @@ function viewHandoffTemplate(params) {
74297
74243
  }
74298
74244
  return template;
74299
74245
  }
74300
- var init_view_template2 = __esm(() => {
74246
+ var init_view_template = __esm(() => {
74301
74247
  init_handoff_templates4();
74302
74248
  init_pair();
74303
74249
  });
@@ -74315,8 +74261,8 @@ function printHandoffViewTemplate(options) {
74315
74261
  process.exit(1);
74316
74262
  }
74317
74263
  }
74318
- var init_view_template3 = __esm(() => {
74319
- init_view_template2();
74264
+ var init_view_template2 = __esm(() => {
74265
+ init_view_template();
74320
74266
  });
74321
74267
 
74322
74268
  // ../../services/backend/prompts/cli/handoff-templates/list-templates.ts
@@ -74350,7 +74296,7 @@ function listHandoffTemplatesCommand(params) {
74350
74296
  var init_list_templates = __esm(() => {
74351
74297
  init_handoff_templates4();
74352
74298
  init_pair();
74353
- init_command2();
74299
+ init_command();
74354
74300
  });
74355
74301
 
74356
74302
  // src/commands/handoff/list-templates.ts
@@ -74664,9 +74610,9 @@ var init_command5 = __esm(() => {
74664
74610
  // ../../services/backend/prompts/sections/commands-reference.ts
74665
74611
  var init_commands_reference = __esm(() => {
74666
74612
  init_general_knowledge();
74667
- init_command();
74668
- init_reminder();
74669
74613
  init_command2();
74614
+ init_reminder();
74615
+ init_command();
74670
74616
  init_command5();
74671
74617
  init_utils();
74672
74618
  });
@@ -74959,16 +74905,16 @@ var init_verifier4 = __esm(() => {
74959
74905
  [ACHIEVED2, NOT_ACHIEVED2, INCONCLUSIVE2] = VERIFIER_VERDICTS;
74960
74906
  VERIFIER_GUIDANCE = `## Verifier Operating Model
74961
74907
 
74962
- You are the verifier. Your main job is to check whether the user's goal was accomplished, judged from chatroom logs. You are advisory and read-only: do not edit files, implement code, run builds or linters, run \`chatroom context new\`, or act as the planner or builder. The one exception is test execution: it ${VERIFIER_TEST_RULE}.
74908
+ You are the verifier. Your main job is to check whether the user's goal was accomplished, judged from chatroom logs. You are advisory and read-only: do not edit files, implement code, run builds or linters, or act as the planner or builder. The one exception is test execution: it ${VERIFIER_TEST_RULE}.
74963
74909
 
74964
74910
  ${"{SESSION_CONTINUITY}"}
74965
74911
 
74966
74912
  ${getInterRoleHandoffRule()}
74967
74913
 
74968
- 1. Read the injected verification request: round, mode, user message id, context id, requested test runs, claimed outcome, evidence pointers, and known gaps. The claimed outcome is a claim to be checked, never evidence.
74969
- 2. Recover the objective from the logs. Run \`chatroom messages anchor --chatroom-id="<chatroom-id>" --role="verifier"\`, then \`chatroom messages download --chatroom-id="<chatroom-id>" --role="verifier" --since-message-id=<user message id> --limit=100\`. If the download is truncated, raise \`--limit\` and download again until the range is complete. If the anchor id differs from the request's user message id, use the request's id and report the mismatch. For terse follow-ups, recover intent from the prior user messages the anchor lists.
74914
+ 1. Read the injected verification request: round, mode, user message id, Log message ids, requested test runs, claimed outcome, evidence pointers, and known gaps. The claimed outcome is a claim to be checked, never evidence.
74915
+ 2. Recover the objective from the logs. Run \`chatroom messages anchor --chatroom-id="<chatroom-id>" --role="verifier"\`, then \`chatroom messages download --chatroom-id="<chatroom-id>" --role="verifier" --since-message-id=<user message id> --limit=100\`. If an id under Log message ids falls before the user message id, download from that id instead. If the download is truncated, raise \`--limit\` and download again until the range is complete. If the anchor id differs from the request's user message id, use the request's id and report the mismatch. For terse follow-ups, recover intent from the prior user messages the anchor lists.
74970
74916
  2a. Requested test runs: if the user's last message (or prior user messages for this objective) explicitly asks for tests to be run, run exactly those commands from the repository root, record the command and exit result, and count the output as evidence. Run no test the user did not ask for. If the request is absent, run nothing.
74971
- 3. Run \`chatroom context read --chatroom-id="<chatroom-id>" --role="verifier"\` and note any mismatch with the request's context id.
74917
+ 3. Read every message listed under the request's Log message ids from the downloaded range, and confirm each one is present. If a listed id is missing, the log is incomplete: download again from that id, then name any id still missing under Scope and limits. A claim that rests only on a missing message is \`unverified\`, never \`met\`.
74972
74918
  4. Decompose the objective into numbered requirements R1..Rn. Split compound requests and ignore anything the user did not actually ask for.
74973
74919
  4a. User expectations: the user's handoff template defines what the user expects from the work. In a code mode, turn each applicable item that concerns the work into a user expectation: each requirement's evidence (PR, commit, or file), files changed, Code Change Verification, backlog items moved to \`pending_user_review\` after a verified end-to-end feature with a PR, and any manual steps or unresolved decisions the user must act on. Skip presentation-only items: template disclosure checkboxes, section order, collapsing, diagram format, and Proof of Planning. In \`chat\` mode the template asks only for a direct, concise answer, so add no expectations beyond the requirements.
74974
74920
  5. Find evidence for every requirement in the logs alone: builder handoff reports, planner delegations, quoted test output, commits, and PRs. \`met\` requires concrete evidence in the logs. The planner's claimed outcome is a claim, not evidence. Silence means \`unverified\`. A contradiction, or a log showing the requirement was not done, means \`unmet\`. Never state that tests passed unless a log reports it, or you ran the requested tests yourself.
@@ -75114,15 +75060,12 @@ var init_system_prompt = __esm(() => {
75114
75060
  });
75115
75061
 
75116
75062
  // ../../services/backend/prompts/native/task-started-content.ts
75117
- var init_task_started_content = __esm(() => {
75118
- init_new();
75119
- });
75063
+ var init_task_started_content = () => {};
75120
75064
 
75121
75065
  // ../../services/backend/prompts/sections/classification-guide.ts
75122
75066
  var init_classification_guide = __esm(() => {
75123
75067
  init_cli();
75124
75068
  init_task_started_content();
75125
- init_utils();
75126
75069
  });
75127
75070
 
75128
75071
  // ../../services/backend/prompts/sections/getting-started.ts
@@ -75135,7 +75078,7 @@ var init_handoff_options = () => {};
75135
75078
 
75136
75079
  // ../../services/backend/prompts/sections/next-step.ts
75137
75080
  var init_next_step = __esm(() => {
75138
- init_command();
75081
+ init_command2();
75139
75082
  init_utils();
75140
75083
  });
75141
75084
 
@@ -75161,7 +75104,7 @@ function generateHandoffOutput(params) {
75161
75104
  `);
75162
75105
  }
75163
75106
  var init_generator = __esm(() => {
75164
- init_command();
75107
+ init_command2();
75165
75108
  init_reminder();
75166
75109
  init_handoff_templates4();
75167
75110
  init_system_prompt();
@@ -76017,7 +75960,7 @@ var init_plan_template = __esm(() => {
76017
75960
  function viewPlanTemplate(params = {}) {
76018
75961
  return getPlanTemplate(params);
76019
75962
  }
76020
- var init_view_template4 = __esm(() => {
75963
+ var init_view_template3 = __esm(() => {
76021
75964
  init_plan_template();
76022
75965
  });
76023
75966
 
@@ -76029,8 +75972,8 @@ __export(exports_view_template2, {
76029
75972
  function printPlanViewTemplate(options = {}) {
76030
75973
  console.log(viewPlanTemplate({ nativeIntegration: true, cliEnvPrefix: options.cliEnvPrefix }));
76031
75974
  }
76032
- var init_view_template5 = __esm(() => {
76033
- init_view_template4();
75975
+ var init_view_template4 = __esm(() => {
75976
+ init_view_template3();
76034
75977
  });
76035
75978
 
76036
75979
  // ../../services/backend/src/domain/plan/parse-plan.ts
@@ -77939,12 +77882,6 @@ var init_render_delivery_attachments = __esm(() => {
77939
77882
  });
77940
77883
 
77941
77884
  // src/commands/task/read/render.ts
77942
- function detectBacklogDivergence(contextContent, attachedIds) {
77943
- if (!contextContent || attachedIds.length === 0) {
77944
- return [];
77945
- }
77946
- return attachedIds.filter((id) => !contextContent.includes(id));
77947
- }
77948
77885
  function renderAttachments(input, chatroomId, role) {
77949
77886
  return renderDeliveryAttachmentsBlock({
77950
77887
  attachedBacklogItems: input.attachedBacklogItems,
@@ -77953,56 +77890,15 @@ function renderAttachments(input, chatroomId, role) {
77953
77890
  attachedMessages: input.attachedMessages
77954
77891
  }, { chatroomId, role, mode: "task-read" });
77955
77892
  }
77956
- function renderDivergenceWarnings(input) {
77957
- const ctx = input.context;
77958
- if (!ctx || !input.attachedBacklogItems || input.attachedBacklogItems.length === 0)
77959
- return [];
77960
- const attachedIds = input.attachedBacklogItems.map((i3) => i3._id);
77961
- const divergentIds = detectBacklogDivergence(ctx.content, attachedIds);
77962
- return divergentIds.map((id) => `⚠ Backlog ${id} diverges from context — confirm scope.`);
77963
- }
77964
- function renderStalenessNotice(elapsedHours) {
77965
- if (elapsedHours < 4)
77966
- return [];
77967
- const ageLabel = elapsedHours >= 48 ? `${Math.round(elapsedHours / 24)}d old` : `${elapsedHours}h old`;
77968
- return [
77969
- `<system-notice>`,
77970
- `⚠️ Context is ${ageLabel}.`,
77971
- ` Entry point role will update when needed.`,
77972
- `</system-notice>`
77973
- ];
77974
- }
77975
- function renderContextSection(input, chatroomId, role) {
77976
- const ctx = input.context;
77977
- if (!ctx)
77978
- return [];
77979
- const lines = [
77980
- "",
77981
- "Background context (may be stale)",
77982
- "<context>",
77983
- ctx.content,
77984
- "</context>"
77985
- ];
77986
- if (ctx.triggerMessageContent) {
77987
- lines.push(`(Trigger: chatroom context read --chatroom-id="${chatroomId}" --role="${role}")`);
77988
- }
77989
- lines.push(...renderStalenessNotice(ctx.elapsedHours));
77990
- return lines;
77991
- }
77992
77893
  function renderTaskPrompt(input) {
77993
77894
  const { taskId, status, content, chatroomId, role } = input;
77994
77895
  const lines = [];
77995
77896
  lines.push(`✅ Task content:`);
77996
77897
  lines.push(` Task ID: ${taskId}`);
77997
77898
  lines.push(` Status: ${status}`);
77998
- if (input.context) {
77999
- lines.push("On conflict, message wins over background context.");
78000
- }
78001
- lines.push(...renderDivergenceWarnings(input));
78002
77899
  lines.push(`
78003
77900
  ${content}`);
78004
77901
  lines.push(...renderAttachments(input, chatroomId, role));
78005
- lines.push(...renderContextSection(input, chatroomId, role));
78006
77902
  return lines.join(`
78007
77903
  `);
78008
77904
  }
@@ -78043,7 +77939,6 @@ function buildTaskPromptFromReadResult(result3, chatroomId, role) {
78043
77939
  content: result3.content,
78044
77940
  chatroomId,
78045
77941
  role,
78046
- context: result3.context && typeof result3.context === "object" ? result3.context : undefined,
78047
77942
  attachedBacklogItems: Array.isArray(result3.attachedBacklogItems) ? result3.attachedBacklogItems : undefined,
78048
77943
  attachedSnippets: Array.isArray(result3.attachedSnippets) ? result3.attachedSnippets : undefined,
78049
77944
  attachedTasks: Array.isArray(result3.attachedTasks) ? result3.attachedTasks : undefined,
@@ -86292,28 +86187,11 @@ var init_messages = __esm(() => {
86292
86187
  init_anchor();
86293
86188
  });
86294
86189
 
86295
- // src/commands/context/format-new-context-error.ts
86296
- function formatNewContextError(cause) {
86297
- const message = getErrorMessage(cause);
86298
- if (message.includes("triggerMessageId") && message.includes("chatroom_messages")) {
86299
- return `${message}
86300
- ${TRIGGER_MESSAGE_ID_HINT}`;
86301
- }
86302
- return message;
86303
- }
86304
- var TRIGGER_MESSAGE_ID_HINT = " hint: --trigger-message-id must be the origin-message-id attribute on the <task> tag, not task-id. Use the pre-filled value from the task intake command when provided.";
86305
- var init_format_new_context_error = __esm(() => {
86306
- init_convex_error();
86307
- });
86308
-
86309
86190
  // src/commands/context/index.ts
86310
86191
  var exports_context = {};
86311
86192
  __export(exports_context, {
86312
- viewTemplate: () => viewTemplate,
86313
86193
  readContextEffect: () => readContextEffect,
86314
86194
  readContext: () => readContext,
86315
- newContextEffect: () => newContextEffect,
86316
- newContext: () => newContext,
86317
86195
  listContextsEffect: () => listContextsEffect,
86318
86196
  listContexts: () => listContexts,
86319
86197
  inspectContextEffect: () => inspectContextEffect,
@@ -86342,15 +86220,9 @@ function handleContextError(err2) {
86342
86220
  } else if (err2._tag === "InvalidChatroomId") {
86343
86221
  console.error(`❌ Invalid chatroom ID format: ID must be 20-40 characters (got ${err2.id?.length || 0})`);
86344
86222
  process.exit(1);
86345
- } else if (err2._tag === "EmptyContent") {
86346
- console.error(`❌ Context content cannot be empty`);
86347
- process.exit(1);
86348
86223
  } else if (err2._tag === "ReadContextFailed") {
86349
86224
  console.error(`❌ Failed to read context: ${sanitizeUnknownForTerminal(err2.cause.message)}`);
86350
86225
  process.exit(1);
86351
- } else if (err2._tag === "NewContextFailed") {
86352
- console.error(`❌ Failed to create context: ${formatNewContextError(err2.cause)}`);
86353
- process.exit(1);
86354
86226
  } else if (err2._tag === "ListContextsFailed") {
86355
86227
  console.error(`❌ Failed to list contexts: ${sanitizeUnknownForTerminal(err2.cause.message)}`);
86356
86228
  process.exit(1);
@@ -86365,19 +86237,11 @@ async function readContext(chatroomId, options, deps) {
86365
86237
  const layer = commandServicesLayerFromDeps(d);
86366
86238
  await exports_Effect.runPromise(readContextEffect(chatroomId, options).pipe(exports_Effect.catch((err2) => handleContextError(err2)), exports_Effect.provide(layer)));
86367
86239
  }
86368
- async function newContext(chatroomId, options, deps) {
86369
- const d = deps ?? await createDefaultDeps18();
86370
- const layer = commandServicesLayerFromDeps(d);
86371
- await exports_Effect.runPromise(newContextEffect(chatroomId, options).pipe(exports_Effect.catch((err2) => handleContextError(err2)), exports_Effect.provide(layer)));
86372
- }
86373
86240
  async function listContexts(chatroomId, options, deps) {
86374
86241
  const d = deps ?? await createDefaultDeps18();
86375
86242
  const layer = commandServicesLayerFromDeps(d);
86376
86243
  await exports_Effect.runPromise(listContextsEffect(chatroomId, options).pipe(exports_Effect.catch((err2) => handleContextError(err2)), exports_Effect.provide(layer)));
86377
86244
  }
86378
- function viewTemplate() {
86379
- return getContextViewTemplate();
86380
- }
86381
86245
  async function inspectContext(chatroomId, options, deps) {
86382
86246
  const d = deps ?? await createDefaultDeps18();
86383
86247
  const layer = commandServicesLayerFromDeps(d);
@@ -86443,29 +86307,6 @@ var readContextEffect = (chatroomId, options) => exports_Effect.gen(function* ()
86443
86307
  ` + "═".repeat(60));
86444
86308
  console.log("</context>");
86445
86309
  });
86446
- }), newContextEffect = (chatroomId, options) => exports_Effect.gen(function* () {
86447
- const backend2 = yield* BackendService;
86448
- const sessionId = yield* requireAuthenticatedChatroom(chatroomId);
86449
- if (!options.content || options.content.trim().length === 0) {
86450
- return yield* exports_Effect.fail({ _tag: "EmptyContent" });
86451
- }
86452
- const contextId = yield* backend2.mutation(api.contexts.createContext, {
86453
- sessionId,
86454
- chatroomId,
86455
- content: options.content,
86456
- role: options.role,
86457
- triggerMessageId: options.triggerMessageId
86458
- }).pipe(exports_Effect.catch((cause) => exports_Effect.fail({
86459
- _tag: "NewContextFailed",
86460
- cause
86461
- })));
86462
- yield* exports_Effect.sync(() => {
86463
- console.log(`✅ Context created successfully`);
86464
- console.log(` Context ID: ${contextId}`);
86465
- console.log(` Created by: ${options.role}`);
86466
- console.log(`
86467
- \uD83D\uDCCC This context is now pinned for all agents in this chatroom.`);
86468
- });
86469
86310
  }), listContextsEffect = (chatroomId, options) => exports_Effect.gen(function* () {
86470
86311
  const backend2 = yield* BackendService;
86471
86312
  const sessionId = yield* requireSessionIdEffect(() => ({
@@ -86487,9 +86328,6 @@ var readContextEffect = (chatroomId, options) => exports_Effect.gen(function* ()
86487
86328
  if (contexts.length === 0) {
86488
86329
  console.log(`
86489
86330
  \uD83D\uDCED No contexts found for this chatroom`);
86490
- console.log(`
86491
- \uD83D\uDCA1 Create a context with:`);
86492
- console.log(` chatroom context new --chatroom-id=${chatroomId} --role=${options.role} --content="Your context summary"`);
86493
86331
  return;
86494
86332
  }
86495
86333
  console.log(`
@@ -86534,31 +86372,18 @@ var readContextEffect = (chatroomId, options) => exports_Effect.gen(function* ()
86534
86372
  console.log(`
86535
86373
  \uD83D\uDCCA Staleness:`);
86536
86374
  console.log(` Time elapsed: ${context3.elapsedHours.toFixed(1)} hours`);
86537
- if (context3.elapsedHours >= 24) {
86538
- console.log(`
86539
- ⚠️ This context is over 24 hours old.`);
86540
- console.log(` Consider creating a new context with an updated summary.`);
86541
- } else if (context3.elapsedHours >= 4) {
86542
- console.log(`
86543
- ⚠️ This context is over 4 hours old.`);
86544
- console.log(` Consider refreshing if the focus has shifted.`);
86545
- }
86546
86375
  console.log(`
86547
86376
  \uD83D\uDCDD Content:`);
86548
86377
  console.log("─".repeat(60));
86549
86378
  console.log(sanitizeForTerminal(context3.content));
86550
86379
  console.log("─".repeat(60));
86551
86380
  console.log(`
86552
- \uD83D\uDCA1 To create a new context:`);
86553
- console.log(` chatroom context new --chatroom-id=${chatroomId} --role=${options.role} --content="Your updated summary"`);
86554
- console.log(`
86555
86381
  ` + "═".repeat(60));
86556
86382
  });
86557
86383
  });
86558
86384
  var init_context = __esm(() => {
86559
86385
  init_serialize_message();
86560
86386
  init_dist();
86561
- init_format_new_context_error();
86562
86387
  init_api3();
86563
86388
  init_create_convex_command_deps();
86564
86389
  init_services();
@@ -123261,7 +123086,7 @@ teamCommand.command("set").description("Set the team preset for a chatroom").req
123261
123086
  });
123262
123087
  handoffCommandGroup.command("view-template").description("Print the handoff template for one sender → recipient pair in one conversation mode (requires --from, --to, and --mode)").option("--from <role>", "Sending role (the role that runs the handoff)").option("--to <role>", "Receiving role (the --next-role of the handoff)").option("--mode <mode>", "Conversation mode: chat | code (required)").option("--team-id <teamId>", "Team id (solo, duo, trio); defaults to duo").action(async function(options) {
123263
123088
  const parentOpts = this.parent?.opts() ?? {};
123264
- const { printHandoffViewTemplate: printHandoffViewTemplate2 } = await Promise.resolve().then(() => (init_view_template3(), exports_view_template));
123089
+ const { printHandoffViewTemplate: printHandoffViewTemplate2 } = await Promise.resolve().then(() => (init_view_template2(), exports_view_template));
123265
123090
  printHandoffViewTemplate2({
123266
123091
  from: options.from,
123267
123092
  to: options.to,
@@ -123347,7 +123172,7 @@ program2.command("notify-user").description("Send the user an update while you k
123347
123172
  });
123348
123173
  var planCommand = program2.command("plan").description("Publish and read agent-authored phased plans");
123349
123174
  planCommand.command("view-template").description("Print the plan template (static; no chatroom required)").option("--chatroom-id <id>", "Ignored (accepted for copy-paste compatibility)").option("--role <role>", "Ignored (accepted for copy-paste compatibility)").action(async () => {
123350
- const { printPlanViewTemplate: printPlanViewTemplate2 } = await Promise.resolve().then(() => (init_view_template5(), exports_view_template2));
123175
+ const { printPlanViewTemplate: printPlanViewTemplate2 } = await Promise.resolve().then(() => (init_view_template4(), exports_view_template2));
123351
123176
  printPlanViewTemplate2();
123352
123177
  });
123353
123178
  planCommand.command("publish").description("Publish a phased plan message (reads markdown from stdin)").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").option("--supersedes <planId>", "Plan message id this plan replaces").action(async (options) => {
@@ -123619,39 +123444,12 @@ messagesCommand.command("download").description("Download chatroom message histo
123619
123444
  sinceMessageId: options.sinceMessageId
123620
123445
  });
123621
123446
  });
123622
- var contextCommand = program2.command("context").description("Manage chatroom context and state (explicit context management)");
123447
+ var contextCommand = program2.command("context").description("Read and inspect chatroom context (read-only)");
123623
123448
  contextCommand.command("read").description("Read context for your role (conversation history, tasks, status)").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").action(async (options) => {
123624
123449
  await maybeRequireAuth();
123625
123450
  const { readContext: readContext2 } = await Promise.resolve().then(() => (init_context(), exports_context));
123626
123451
  await readContext2(options.chatroomId, options);
123627
123452
  });
123628
- contextCommand.command("new").description("Create a new context and pin it for all agents").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role (creator of the context)").option("--content <content>", "Context summary/description (alternative: provide via stdin/heredoc)").option("--trigger-message-id <messageId>", "Message ID that triggered this context (anchors the context window)").action(async (options) => {
123629
- await maybeRequireAuth();
123630
- let content;
123631
- if (options.content && options.content.trim().length > 0) {
123632
- content = options.content.trim();
123633
- } else {
123634
- const stdinContent = await readStdin();
123635
- const { CONTEXT_STDIN_DELIMITER: CONTEXT_STDIN_DELIMITER2, validateStdinHeredocBody: validateStdinHeredocBody2 } = await Promise.resolve().then(() => (init_stdin_heredoc(), exports_stdin_heredoc));
123636
- if (!stdinContent.trim()) {
123637
- console.error("❌ Context content cannot be empty.");
123638
- console.error(' Provide content via --content="..." or stdin (heredoc):');
123639
- console.error(" chatroom context new --chatroom-id=<id> --role=<role> << 'CHATROOM_CONTEXT_END'");
123640
- console.error(" Your context summary here");
123641
- console.error(" CHATROOM_CONTEXT_END");
123642
- process.exit(1);
123643
- }
123644
- try {
123645
- validateStdinHeredocBody2(stdinContent, CONTEXT_STDIN_DELIMITER2, "Context");
123646
- } catch (err2) {
123647
- console.error(`❌ ${err2.message}`);
123648
- process.exit(1);
123649
- }
123650
- content = stdinContent.trim();
123651
- }
123652
- const { newContext: newContext2 } = await Promise.resolve().then(() => (init_context(), exports_context));
123653
- await newContext2(options.chatroomId, { ...options, content });
123654
- });
123655
123453
  contextCommand.command("list").description("List recent contexts for a chatroom").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").option("--limit <n>", "Maximum number of contexts to show (default: 10)").action(async (options) => {
123656
123454
  await maybeRequireAuth();
123657
123455
  const { listContexts: listContexts2 } = await Promise.resolve().then(() => (init_context(), exports_context));
@@ -123665,10 +123463,6 @@ contextCommand.command("inspect").description("View a specific context with stal
123665
123463
  const { inspectContext: inspectContext2 } = await Promise.resolve().then(() => (init_context(), exports_context));
123666
123464
  await inspectContext2(options.chatroomId, options);
123667
123465
  });
123668
- contextCommand.command("view-template").description("Print a template for `chatroom context new` content.").option("--chatroom-id <id>", "Ignored (accepted for copy-paste compatibility)").option("--role <role>", "Ignored (accepted for copy-paste compatibility)").action(async () => {
123669
- const { viewTemplate: viewTemplate2 } = await Promise.resolve().then(() => (init_context(), exports_context));
123670
- console.log(viewTemplate2());
123671
- });
123672
123466
  var guidelinesCommand = program2.command("guidelines").description("View review guidelines by type");
123673
123467
  guidelinesCommand.command("view").description("View guidelines for a specific review type").requiredOption("--type <type>", "Guideline type (coding|security|design|performance|all)").action(async (options) => {
123674
123468
  await maybeRequireAuth();
@@ -123772,4 +123566,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
123772
123566
  });
123773
123567
  program2.parse();
123774
123568
 
123775
- //# debugId=0FE2B8362AD6B80B64756E2164756E21
123569
+ //# debugId=410059F0D2D328F464756E2164756E21