chatroom-cli 1.146.0 → 1.148.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.
package/dist/index.js CHANGED
@@ -15042,6 +15042,7 @@ __export(exports_stdin_heredoc, {
15042
15042
  validateStdinHeredocBody: () => validateStdinHeredocBody,
15043
15043
  formatStdinHeredocCommand: () => formatStdinHeredocCommand,
15044
15044
  findReservedDelimiterLines: () => findReservedDelimiterLines,
15045
+ PLAN_STDIN_DELIMITER: () => PLAN_STDIN_DELIMITER,
15045
15046
  NOTIFY_USER_STDIN_DELIMITER: () => NOTIFY_USER_STDIN_DELIMITER,
15046
15047
  HANDOFF_STDIN_DELIMITER: () => HANDOFF_STDIN_DELIMITER,
15047
15048
  HANDOFF_MESSAGE_MARKER: () => HANDOFF_MESSAGE_MARKER,
@@ -15084,7 +15085,7 @@ function findReservedDelimiterLines(content) {
15084
15085
  }
15085
15086
  return hits;
15086
15087
  }
15087
- 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", ENHANCER_STDIN_DELIMITER = "CHATROOM_ENHANCER_END", CLASSIFY_STDIN_DELIMITER = "CHATROOM_CLASSIFY_END", HANDOFF_MESSAGE_MARKER = "---MESSAGE---", RESERVED_STDIN_HEREDOC_DELIMITERS, RESERVED_STRUCTURED_PARAM_MARKERS;
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;
15088
15089
  var init_stdin_heredoc = __esm(() => {
15089
15090
  RESERVED_STDIN_HEREDOC_DELIMITERS = [
15090
15091
  HANDOFF_STDIN_DELIMITER,
@@ -15092,6 +15093,7 @@ var init_stdin_heredoc = __esm(() => {
15092
15093
  BACKLOG_STDIN_DELIMITER,
15093
15094
  AGENTIC_QUERY_STDIN_DELIMITER,
15094
15095
  NOTIFY_USER_STDIN_DELIMITER,
15096
+ PLAN_STDIN_DELIMITER,
15095
15097
  ENHANCER_STDIN_DELIMITER,
15096
15098
  CLASSIFY_STDIN_DELIMITER
15097
15099
  ];
@@ -48722,6 +48724,9 @@ var init_errorCodes = __esm(() => {
48722
48724
  TOO_MANY_ATTACHMENTS: "TOO_MANY_ATTACHMENTS",
48723
48725
  INVALID_ANCHOR: "INVALID_ANCHOR",
48724
48726
  NO_ACTIVE_TASK: "NO_ACTIVE_TASK",
48727
+ INVALID_PLAN: "INVALID_PLAN",
48728
+ INVALID_SUPERSEDES: "INVALID_SUPERSEDES",
48729
+ PLAN_NOT_FOUND: "PLAN_NOT_FOUND",
48725
48730
  CONTENT_TOO_LONG: "CONTENT_TOO_LONG",
48726
48731
  EMPTY_PROMPT: "EMPTY_PROMPT",
48727
48732
  INVALID_SCHEDULE: "INVALID_SCHEDULE",
@@ -48858,6 +48863,9 @@ var init_errorCodes = __esm(() => {
48858
48863
  BACKEND_ERROR_CODES.TOO_MANY_ATTACHMENTS,
48859
48864
  BACKEND_ERROR_CODES.INVALID_ANCHOR,
48860
48865
  BACKEND_ERROR_CODES.NO_ACTIVE_TASK,
48866
+ BACKEND_ERROR_CODES.INVALID_PLAN,
48867
+ BACKEND_ERROR_CODES.INVALID_SUPERSEDES,
48868
+ BACKEND_ERROR_CODES.PLAN_NOT_FOUND,
48861
48869
  BACKEND_ERROR_CODES.CONTENT_TOO_LONG,
48862
48870
  BACKEND_ERROR_CODES.EMPTY_PROMPT,
48863
48871
  BACKEND_ERROR_CODES.INVALID_SCHEDULE,
@@ -48957,16 +48965,15 @@ function getErrorMessage(error51) {
48957
48965
  return formatServerError(error51);
48958
48966
  return String(error51);
48959
48967
  }
48960
- function getConvexErrorCode(error51) {
48968
+ function getConvexErrorData(error51) {
48961
48969
  if (!(error51 instanceof ConvexError))
48962
48970
  return;
48963
48971
  const data = error51.data;
48964
- if (data !== null && typeof data === "object" && "code" in data) {
48965
- const code2 = data.code;
48966
- if (typeof code2 === "string")
48967
- return code2;
48968
- }
48969
- return;
48972
+ return data !== null && typeof data === "object" ? data : undefined;
48973
+ }
48974
+ function getConvexErrorCode(error51) {
48975
+ const code2 = getConvexErrorData(error51)?.code;
48976
+ return typeof code2 === "string" ? code2 : undefined;
48970
48977
  }
48971
48978
  function isFileTreeSyncDisabledError(error51) {
48972
48979
  return getConvexErrorCode(error51) === FILE_TREE_SYNC_DISABLED_CODE;
@@ -73431,9 +73438,45 @@ var init_coordinator_reviewer_chat = __esm(() => {
73431
73438
  init_coordinator_reviewer_code();
73432
73439
  });
73433
73440
 
73441
+ // ../../services/backend/prompts/cli/plan/command.ts
73442
+ function valueOrDefault(value2, fallback) {
73443
+ return value2 ?? fallback;
73444
+ }
73445
+ function commandDefaults(params) {
73446
+ return {
73447
+ prefix: valueOrDefault(params.cliEnvPrefix, ""),
73448
+ chatroomId: valueOrDefault(params.chatroomId, "<chatroom-id>"),
73449
+ role: valueOrDefault(params.role, "<role>")
73450
+ };
73451
+ }
73452
+ function planPublishCommand(params) {
73453
+ const { prefix, chatroomId, role } = commandDefaults(params);
73454
+ const commandPrefix = `${prefix}chatroom plan publish --chatroom-id="${chatroomId}" --role="${role}"`;
73455
+ return formatStdinHeredocCommand(commandPrefix, PLAN_STDIN_DELIMITER, PLAN_BODY_PLACEHOLDER, {
73456
+ messageMarker: HANDOFF_MESSAGE_MARKER
73457
+ });
73458
+ }
73459
+ function planReadCommand(params) {
73460
+ const { prefix, chatroomId, role } = commandDefaults(params);
73461
+ const planId = valueOrDefault(params.planId, "<plan-id>");
73462
+ const phase = params.phase ? ` --phase="${params.phase}"` : "";
73463
+ return `${prefix}chatroom plan read --chatroom-id="${chatroomId}" --role="${role}" --plan-id="${planId}"${phase}`;
73464
+ }
73465
+ var PLAN_BODY_PLACEHOLDER = "[Your plan markdown here — paste the filled template from `chatroom plan view-template`]";
73466
+ var init_command3 = __esm(() => {
73467
+ init_stdin_heredoc();
73468
+ });
73469
+
73434
73470
  // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-specifier-code.ts
73435
- function getCoordinatorSpecifierCodeTemplate(_query) {
73436
- return `Instructions (not part of the message): Delegate ONE work package to the \`specifier\`. The specifier plans the package as file-level builder slices, drives the builder through ONE slice, and hands a slice report back to you that names the slices still to do. Send each remaining slice as a new work package that names the slice to build. Clear every required gate first (researcher, triage, architect, uiux-engineer, game-asset-designer) and include the decisions from their briefs, citing message ids — the specifier cannot contact those roles. Do not write file-level code instructions yourself; state outcomes, constraints, and acceptance criteria. Each package starts the specifier in a fresh session: include everything it needs, or name the message ids it must read with \`chatroom messages download\`.
73471
+ function getCoordinatorSpecifierCodeTemplate(query) {
73472
+ const readPhaseCommand = planReadCommand({
73473
+ cliEnvPrefix: query.cliEnvPrefix ?? "",
73474
+ chatroomId: query.chatroomId,
73475
+ role: "specifier",
73476
+ planId: "<planId>",
73477
+ phase: "<Pn>"
73478
+ });
73479
+ return `Instructions (not part of the message): Delegate ONE work package to the \`specifier\`. The specifier plans the package as file-level builder slices, drives the builder through ONE slice, and hands a slice report back to you that names the slices still to do. The first package for a request carries \`Plan ID: None — first pass: publish the plan\`; the specifier publishes the phased plan and builds its first phase. Every later package names the phase to build under \`## Plan reference\` instead of restating the plan. Clear every required gate first (researcher, triage, architect, uiux-engineer, game-asset-designer) and include the decisions from their briefs, citing message ids — the specifier cannot contact those roles. Do not write file-level code instructions yourself; state outcomes, constraints, and acceptance criteria. Each package starts the specifier in a fresh session: include everything it needs, or name the message ids it must read with \`chatroom messages download\`.
73437
73480
 
73438
73481
  ${getDelegationBriefIntro()}
73439
73482
 
@@ -73455,6 +73498,11 @@ ${getFileReferenceGuidanceComment()}
73455
73498
  - In scope: <surfaces and behaviors>
73456
73499
  - Out of scope: <surfaces the specifier and builder must not touch>
73457
73500
 
73501
+ ## Plan reference
73502
+ Plan ID: <planId>, or \`None — first pass: publish the plan\`
73503
+ Phase: <Pn>, or \`None — first pass: publish the plan\`
73504
+ When \`Phase\` names a phase, read it before you brief the builder: \`${readPhaseCommand}\`
73505
+
73458
73506
  ## Rework findings (prior round)
73459
73507
  <message id of the specifier, reviewer, or verifier report and the blocking findings to fix (paste each with file and line where known); or \`None.\`>
73460
73508
 
@@ -73468,7 +73516,9 @@ ${getFileReferenceGuidanceComment()}
73468
73516
  <message ids or a \`--since-message-id\` anchor the specifier should download for context, including the prior slice report when this package continues a slice plan; or \`None.\`>
73469
73517
  \`\`\``;
73470
73518
  }
73471
- var init_coordinator_specifier_code = () => {};
73519
+ var init_coordinator_specifier_code = __esm(() => {
73520
+ init_command3();
73521
+ });
73472
73522
 
73473
73523
  // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-specifier-chat.ts
73474
73524
  var init_coordinator_specifier_chat = __esm(() => {
@@ -73773,6 +73823,11 @@ function getSpecifierCoordinatorChatTemplate(_query) {
73773
73823
  return `Instructions (not part of the message): chat response for the coordinator —
73774
73824
  \`\`\`markdown
73775
73825
  <write only the concise status the coordinator needs: what this slice delivered, the slices still to do, blockers, and decisions it must make; do not add handoff XML sections, proofs, or report headings>
73826
+
73827
+ Plan reference:
73828
+ Plan ID: <planId> (newly published | unchanged | superseded by <planId>)
73829
+ Phases delivered: <P1, …, Pn>
73830
+ Next phase: <Pn, or None — plan complete>
73776
73831
  \`\`\``;
73777
73832
  }
73778
73833
 
@@ -73802,6 +73857,11 @@ ${getHandoffNotApplicableSectionComment("Describe current state after this slice
73802
73857
  ## Slices still to do
73803
73858
  <the remaining slices of this work package, in build order, each with its goal and the files it touches; or \`None — the package is complete.\`>
73804
73859
 
73860
+ ## Plan reference
73861
+ Plan ID: <planId> (newly published | unchanged | superseded by <planId>)
73862
+ Phases delivered: <P1, …, Pn>
73863
+ Next phase: <Pn, or None — plan complete>
73864
+
73805
73865
  ${getHandoffQualityPrinciplesSectionBlock("work")}
73806
73866
 
73807
73867
  ## Proof of Completion
@@ -74352,13 +74412,13 @@ function getHandoffTurnEndGuidance(nextRole, nativeIntegration = false) {
74352
74412
  var init_activated_skills = () => {};
74353
74413
 
74354
74414
  // ../../services/backend/prompts/cli/backlog/command.ts
74355
- var init_command3 = __esm(() => {
74415
+ var init_command4 = __esm(() => {
74356
74416
  init_stdin_heredoc();
74357
74417
  });
74358
74418
 
74359
74419
  // ../../services/backend/src/domain/usecase/skills/modules/backlog/index.ts
74360
74420
  var init_backlog = __esm(() => {
74361
- init_command3();
74421
+ init_command4();
74362
74422
  });
74363
74423
 
74364
74424
  // ../../services/backend/src/domain/usecase/skills/modules/code-review/index.ts
@@ -74475,7 +74535,7 @@ var init_general_knowledge = __esm(() => {
74475
74535
  });
74476
74536
 
74477
74537
  // ../../services/backend/prompts/cli/notify-user/command.ts
74478
- var init_command4 = __esm(() => {
74538
+ var init_command5 = __esm(() => {
74479
74539
  init_stdin_heredoc();
74480
74540
  });
74481
74541
 
@@ -74485,7 +74545,7 @@ var init_commands_reference = __esm(() => {
74485
74545
  init_command();
74486
74546
  init_reminder();
74487
74547
  init_command2();
74488
- init_command4();
74548
+ init_command5();
74489
74549
  init_utils();
74490
74550
  });
74491
74551
 
@@ -74834,6 +74894,14 @@ var init_fromContext2 = __esm(() => {
74834
74894
  init_handoff_templates4();
74835
74895
  });
74836
74896
 
74897
+ // ../../services/backend/prompts/role-identity-fallback.ts
74898
+ var init_role_identity_fallback = __esm(() => {
74899
+ init_agent_role();
74900
+ });
74901
+
74902
+ // ../../services/backend/prompts/teams/custom/prompts/role-identity.ts
74903
+ var init_role_identity = () => {};
74904
+
74837
74905
  // ../../services/backend/prompts/teams/duo/prompts/builder.ts
74838
74906
  var init_builder4 = __esm(() => {
74839
74907
  init_builder3();
@@ -74851,6 +74919,11 @@ var init_fromContext3 = __esm(() => {
74851
74919
  init_builder4();
74852
74920
  init_planner3();
74853
74921
  });
74922
+
74923
+ // ../../services/backend/prompts/teams/duo/prompts/role-identity.ts
74924
+ var init_role_identity2 = () => {};
74925
+ // ../../services/backend/prompts/teams/solo/prompts/role-identity.ts
74926
+ var init_role_identity3 = () => {};
74854
74927
  // ../../services/backend/prompts/teams/trio/prompts/builder.ts
74855
74928
  var init_builder5 = __esm(() => {
74856
74929
  init_builder3();
@@ -74867,6 +74940,7 @@ var init_coordinator2 = __esm(() => {
74867
74940
 
74868
74941
  // ../../services/backend/prompts/teams/trio/prompts/specifier.ts
74869
74942
  var init_specifier2 = __esm(() => {
74943
+ init_command3();
74870
74944
  init_planner_guidance_context();
74871
74945
  init_sections();
74872
74946
  });
@@ -74877,13 +74951,25 @@ var init_fromContext4 = __esm(() => {
74877
74951
  init_coordinator2();
74878
74952
  init_specifier2();
74879
74953
  });
74954
+
74955
+ // ../../services/backend/prompts/teams/trio/prompts/role-identity.ts
74956
+ var init_role_identity4 = () => {};
74957
+ // ../../services/backend/prompts/teams/registry.ts
74958
+ var init_registry4 = __esm(() => {
74959
+ init_role_identity_fallback();
74960
+ init_role_identity();
74961
+ init_fromContext3();
74962
+ init_role_identity2();
74963
+ init_fromContext();
74964
+ init_role_identity3();
74965
+ init_fromContext4();
74966
+ init_role_identity4();
74967
+ });
74880
74968
  // ../../services/backend/prompts/selector-context.ts
74881
74969
  var init_selector_context = __esm(() => {
74882
74970
  init_team_presets();
74883
74971
  init_fromContext2();
74884
- init_fromContext3();
74885
- init_fromContext();
74886
- init_fromContext4();
74972
+ init_registry4();
74887
74973
  });
74888
74974
 
74889
74975
  // ../../services/backend/prompts/sections/role-guidance.ts
@@ -74891,211 +74977,9 @@ var init_role_guidance = __esm(() => {
74891
74977
  init_selector_context();
74892
74978
  });
74893
74979
 
74894
- // ../../services/backend/prompts/templates.ts
74895
- var BUILTIN_ROLE_TEMPLATES, CUSTOM_ROLE_TEMPLATES, ROLE_TEMPLATES;
74896
- var init_templates = __esm(() => {
74897
- init_agent_role();
74898
- BUILTIN_ROLE_TEMPLATES = {
74899
- builder: {
74900
- role: "builder",
74901
- title: "Builder",
74902
- description: "You are the implementer responsible for writing code and building solutions.",
74903
- responsibilities: [
74904
- "Implement solutions based on requirements",
74905
- "Write clean, maintainable, well-documented code",
74906
- "Follow established patterns and best practices",
74907
- "Handle edge cases and error scenarios",
74908
- "Provide clear summaries of what was built"
74909
- ],
74910
- defaultHandoffTarget: "planner"
74911
- },
74912
- planner: {
74913
- role: "planner",
74914
- title: "Planner",
74915
- description: "You are the team coordinator responsible for user communication, task decomposition, and team management.",
74916
- responsibilities: [
74917
- "Communicate with the user as the single point of contact",
74918
- "Decompose complex tasks into actionable work items",
74919
- "Delegate work to available team members",
74920
- "Review completed work against user requirements",
74921
- "Manage the backlog and prioritize tasks",
74922
- "Hand back work for rework if requirements are not met"
74923
- ],
74924
- defaultHandoffTarget: "builder"
74925
- },
74926
- coordinator: {
74927
- role: "coordinator",
74928
- title: "Coordinator",
74929
- description: "You are the team coordinator responsible for understanding what the user wants, owning the plan for the whole task, and routing all work between team roles.",
74930
- responsibilities: [
74931
- "Communicate with the user as the single point of contact",
74932
- "Keep the plan and decisions across the whole task",
74933
- "Clear research, triage, architecture, UI/UX, and asset gates with the specialists",
74934
- "Delegate implementation to the specifier as work packages",
74935
- "Review returned work against the user request",
74936
- "Deliver the final result to the user"
74937
- ],
74938
- defaultHandoffTarget: "specifier"
74939
- },
74940
- specifier: {
74941
- role: "specifier",
74942
- title: "Specifier",
74943
- description: "You are the specifier responsible for turning the coordinator's work package into a slice plan and code-level builder briefs, and for driving the builder through one slice per session; you do not implement code.",
74944
- responsibilities: [
74945
- "Inspect the repository to ground the work package",
74946
- "Split the package into file-level builder slices",
74947
- "Review each builder slice against the brief and acceptance criteria",
74948
- "Send rework to the builder with specific feedback",
74949
- "Report each reviewed slice, with the slices still to do, or blockers to the coordinator"
74950
- ],
74951
- defaultHandoffTarget: "builder"
74952
- },
74953
- architect: {
74954
- role: "architect",
74955
- title: "Architect",
74956
- description: "You are the architect responsible for producing one complete implementation design for the request; you are not an implementer.",
74957
- responsibilities: [
74958
- "Recover the authoritative user request and relevant history",
74959
- "Inspect repository patterns and identify the coding change surface",
74960
- "Design module boundaries, APIs, schemas, queries, invariants, and failure handling",
74961
- "Specify the implementation and verification sequence at code granularity",
74962
- "Hand one evidence-backed design to the planner for implementation"
74963
- ],
74964
- defaultHandoffTarget: "planner"
74965
- },
74966
- researcher: {
74967
- role: "researcher",
74968
- title: "Researcher",
74969
- description: "You are the researcher responsible for producing one evidence-backed research brief that grounds the request for planning; you are not an implementer.",
74970
- responsibilities: [
74971
- "Recover the authoritative user request and the decisions the planner must make",
74972
- "Inspect the repository for existing code, patterns, and constraints that bear on the request",
74973
- "Consult official documentation and primary sources for external facts, APIs, versions, and behavior",
74974
- "Label every finding as confirmed, inferred, or unknown, with citations",
74975
- "Hand one grounded research brief to the planner, including the remaining ambiguity and a recommended default"
74976
- ],
74977
- defaultHandoffTarget: "planner"
74978
- },
74979
- "product-manager": {
74980
- role: "product-manager",
74981
- title: "Product Manager",
74982
- description: "You are the product manager responsible for producing one product specification (user stories with acceptance criteria and an explicit in-scope and out-of-scope decision) that is feature complete and consistent with existing app behavior; you are not an implementer.",
74983
- responsibilities: [
74984
- "Recover the authoritative feature request and the problem it solves",
74985
- "Inspect the existing app behavior, docs, and decision records the feature touches",
74986
- "Write user stories with testable acceptance criteria",
74987
- "Decide scope explicitly: in scope, out of scope, and the gaps an incomplete scope would leave",
74988
- "Flag conflicts with existing behavior, decide each development-scope product decision with a recommended default and rationale, and list to the user only items that meet the escalation criteria",
74989
- "Hand one product specification back to the role that activated you"
74990
- ],
74991
- defaultHandoffTarget: "planner"
74992
- },
74993
- reviewer: {
74994
- role: "reviewer",
74995
- title: "Reviewer",
74996
- description: "You are the reviewer responsible for inspecting the code artifacts the planner names and reporting the issues you observe; you are advisory only and do not implement fixes.",
74997
- responsibilities: [
74998
- "Recover the review target and focus from the planner brief",
74999
- "Inspect the diff or commits and the surrounding code they depend on",
75000
- "Look for correctness, security, test quality, ownership, dead code, duplication, and type drift",
75001
- "Label each issue with a severity and cite the file and line",
75002
- "Hand one review report to the planner, separating reviewed scope from what was not reviewed"
75003
- ],
75004
- defaultHandoffTarget: "planner"
75005
- },
75006
- "game-asset-designer": {
75007
- role: "game-asset-designer",
75008
- title: "Game Asset Designer",
75009
- description: "You are the game asset designer responsible for specifying and generating production-quality game and UI assets (generation is the default unless the brief says `spec only`); you do not implement application code.",
75010
- responsibilities: [
75011
- "Recover the target, asset request, style reference, and budgets from the planner brief",
75012
- "Inspect the repository for existing assets, naming and folder conventions, and engine import configuration",
75013
- "Write one manifest entry per asset covering format, units, pivot, LODs, textures, atlases, and audio",
75014
- "Self-check each asset against the quality checklist and label every claim with its evidence label",
75015
- "Hand one asset delivery report to the planner, separating assumptions and unverified properties from established results"
75016
- ],
75017
- defaultHandoffTarget: "planner"
75018
- },
75019
- verifier: {
75020
- role: "verifier",
75021
- title: "Verifier",
75022
- description: "You are the verifier responsible for judging, from chatroom logs only, whether the user's last message was achieved; you do not implement, build, or edit code, and you run only the tests the user explicitly asked for.",
75023
- responsibilities: [
75024
- "Recover the user's last message and the pinned context from the chatroom logs",
75025
- "Break the objective into numbered requirements",
75026
- "Check each requirement against concrete evidence in the logs, treating the planner claim as unverified",
75027
- "Return one verdict (ACHIEVED, NOT_ACHIEVED, or INCONCLUSIVE) with evidence and the missing items",
75028
- "Execute nothing except the tests the user explicitly asked for: no builds, lints, or edits"
75029
- ],
75030
- defaultHandoffTarget: "planner"
75031
- },
75032
- triage: {
75033
- role: "triage",
75034
- title: "Triage Agent",
75035
- description: "You are the triage agent responsible for thoroughly investigating reported bugs and returning an evidence-backed diagnosis; you do not implement fixes.",
75036
- responsibilities: [
75037
- "Recover the reported symptoms and expected behavior from the authoritative request and relevant history",
75038
- "Trace the relevant code and state flow to identify a root cause, citing concrete repository evidence",
75039
- "Attempt to reproduce the issue with the smallest focused automated test and report the result honestly",
75040
- "Recommend the smallest immediate fix without implementing it",
75041
- "Report systemic design risks separately from the immediate fix",
75042
- "Hand the complete investigation report to the planner"
75043
- ],
75044
- defaultHandoffTarget: "planner"
75045
- },
75046
- "uiux-engineer": {
75047
- role: "uiux-engineer",
75048
- title: "UI/UX Engineer",
75049
- description: "You are the UI/UX engineer responsible for producing one complete interface and experience design for the request; you are not an implementer.",
75050
- responsibilities: [
75051
- "Recover the authoritative user request and relevant history",
75052
- "Inspect existing UI patterns, components, tokens, and interaction conventions",
75053
- "Design complete user flows including loading, empty, error, and success states",
75054
- "Specify responsive layout, state ownership, and UI tests; include web accessibility implementation only when explicitly requested by the user",
75055
- "Hand one evidence-backed design to the planner for implementation"
75056
- ],
75057
- defaultHandoffTarget: "planner"
75058
- },
75059
- solo: {
75060
- role: "solo",
75061
- title: "Solo",
75062
- description: "You are the autonomous agent responsible for both planning and executing tasks independently.",
75063
- responsibilities: [
75064
- "Communicate directly with the user as the single point of contact",
75065
- "Decompose complex tasks into actionable work items",
75066
- "Implement solutions: write clean, maintainable code",
75067
- "Follow established patterns and best practices",
75068
- "Handle edge cases and error scenarios",
75069
- "Review and validate your own work for quality",
75070
- "Deliver completed results to the user"
75071
- ],
75072
- defaultHandoffTarget: "user"
75073
- }
75074
- };
75075
- CUSTOM_ROLE_TEMPLATES = {
75076
- tester: {
75077
- role: "tester",
75078
- title: "Tester",
75079
- description: "You are the QA role responsible for testing and validation.",
75080
- responsibilities: [
75081
- "Write and execute test cases",
75082
- "Verify functionality works as expected",
75083
- "Test edge cases and error handling",
75084
- "Report bugs and issues clearly",
75085
- "Confirm quality standards are met"
75086
- ],
75087
- defaultHandoffTarget: "user"
75088
- }
75089
- };
75090
- ROLE_TEMPLATES = {
75091
- ...BUILTIN_ROLE_TEMPLATES,
75092
- ...CUSTOM_ROLE_TEMPLATES
75093
- };
75094
- });
75095
-
75096
74980
  // ../../services/backend/prompts/sections/role-identity.ts
75097
- var init_role_identity = __esm(() => {
75098
- init_templates();
74981
+ var init_role_identity5 = __esm(() => {
74982
+ init_registry4();
75099
74983
  });
75100
74984
 
75101
74985
  // ../../services/backend/prompts/native/system-prompt.ts
@@ -75103,7 +74987,7 @@ var init_system_prompt = __esm(() => {
75103
74987
  init_commands_reference();
75104
74988
  init_general_knowledge();
75105
74989
  init_role_guidance();
75106
- init_role_identity();
74990
+ init_role_identity5();
75107
74991
  init_selector_context();
75108
74992
  });
75109
74993
 
@@ -75166,7 +75050,7 @@ var init_generator = __esm(() => {
75166
75050
  init_handoff_options();
75167
75051
  init_next_step();
75168
75052
  init_role_guidance();
75169
- init_role_identity();
75053
+ init_role_identity5();
75170
75054
  init_session_vs_chatroom_task();
75171
75055
  init_selector_context();
75172
75056
  init_utils();
@@ -75845,6 +75729,1074 @@ var init_notify_user = __esm(() => {
75845
75729
  init_error_formatting();
75846
75730
  });
75847
75731
 
75732
+ // ../../services/backend/src/domain/plan/plan-template-spec.ts
75733
+ function planSectionHeading(name) {
75734
+ return `${PLAN_HEADINGS.section}${PLAN_SECTION_NAMES[name]}`;
75735
+ }
75736
+ function planPhaseSectionHeading(name) {
75737
+ return `${PLAN_HEADINGS.phaseSection}${PLAN_PHASE_SECTION_NAMES[name]}`;
75738
+ }
75739
+ function planPhaseHeading(id, title) {
75740
+ return `${PLAN_HEADINGS.phase}${id} ${PLAN_PHASE_SEPARATOR} ${title}`;
75741
+ }
75742
+ var PLAN_MAX_CHARS = 40000, PLAN_MAX_PHASES = 20, PLAN_NONE_TOKEN = "None.", PLAN_PHASE_ID_PATTERN, PLAN_PHASE_SEPARATOR = "—", PLAN_HEADINGS, PLAN_SECTION_NAMES, PLAN_SECTION_ORDER, PLAN_REQUIRED_SECTIONS, PLAN_NONE_ALLOWED_SECTIONS, PLAN_PHASE_SECTION_NAMES, PLAN_PHASE_SECTION_ORDER, PLAN_REQUIRED_PHASE_SECTIONS, PLAN_NONE_ALLOWED_PHASE_SECTIONS;
75743
+ var init_plan_template_spec = __esm(() => {
75744
+ PLAN_PHASE_ID_PATTERN = /^P([1-9]\d*)$/;
75745
+ PLAN_HEADINGS = {
75746
+ title: "# ",
75747
+ section: "## ",
75748
+ phase: "### ",
75749
+ phaseSection: "#### "
75750
+ };
75751
+ PLAN_SECTION_NAMES = {
75752
+ sources: "Sources",
75753
+ requirements: "Requirements",
75754
+ constraints: "Constraints",
75755
+ phases: "Phases",
75756
+ phaseDetails: "Phase details",
75757
+ remarks: "Remarks"
75758
+ };
75759
+ PLAN_SECTION_ORDER = [
75760
+ "sources",
75761
+ "requirements",
75762
+ "constraints",
75763
+ "phases",
75764
+ "phaseDetails",
75765
+ "remarks"
75766
+ ];
75767
+ PLAN_REQUIRED_SECTIONS = [
75768
+ "sources",
75769
+ "requirements",
75770
+ "constraints",
75771
+ "phases",
75772
+ "phaseDetails"
75773
+ ];
75774
+ PLAN_NONE_ALLOWED_SECTIONS = ["sources", "constraints"];
75775
+ PLAN_PHASE_SECTION_NAMES = {
75776
+ dependsOn: "Depends on",
75777
+ requirements: "Requirements",
75778
+ constraints: "Constraints",
75779
+ acceptance: "Acceptance criteria"
75780
+ };
75781
+ PLAN_PHASE_SECTION_ORDER = [
75782
+ "dependsOn",
75783
+ "requirements",
75784
+ "constraints",
75785
+ "acceptance"
75786
+ ];
75787
+ PLAN_REQUIRED_PHASE_SECTIONS = [
75788
+ "requirements",
75789
+ "constraints",
75790
+ "acceptance"
75791
+ ];
75792
+ PLAN_NONE_ALLOWED_PHASE_SECTIONS = [
75793
+ "dependsOn",
75794
+ "constraints"
75795
+ ];
75796
+ });
75797
+
75798
+ // ../../services/backend/prompts/cli/plan/plan-template.ts
75799
+ function phaseListEntry(id, title) {
75800
+ return `- ${id} ${PLAN_PHASE_SEPARATOR} ${title}`;
75801
+ }
75802
+ function planConstraintsLine() {
75803
+ return PLAN_NONE_ALLOWED_SECTIONS.includes("constraints") ? `- ${PLAN_NONE_TOKEN}` : "- <constraint>";
75804
+ }
75805
+ function skeletonLines() {
75806
+ const none3 = `- ${PLAN_NONE_TOKEN}`;
75807
+ return [
75808
+ `${PLAN_HEADINGS.title}<plan title>`,
75809
+ "",
75810
+ planSectionHeading("sources"),
75811
+ "- <user request message id, specialist design ids, and the work package id>",
75812
+ "",
75813
+ planSectionHeading("requirements"),
75814
+ "- <requirement>",
75815
+ "",
75816
+ planSectionHeading("constraints"),
75817
+ planConstraintsLine(),
75818
+ "",
75819
+ planSectionHeading("phases"),
75820
+ phaseListEntry("P1", "<phase 1 title>"),
75821
+ phaseListEntry("P2", "<phase 2 title>"),
75822
+ "",
75823
+ planSectionHeading("phaseDetails"),
75824
+ "",
75825
+ planPhaseHeading("P1", "<phase 1 title>"),
75826
+ "",
75827
+ planPhaseSectionHeading("dependsOn"),
75828
+ none3,
75829
+ "",
75830
+ planPhaseSectionHeading("requirements"),
75831
+ "- <what this phase delivers>",
75832
+ "",
75833
+ planPhaseSectionHeading("constraints"),
75834
+ none3,
75835
+ "",
75836
+ planPhaseSectionHeading("acceptance"),
75837
+ "- <observable done-condition, including one end-to-end check>",
75838
+ "",
75839
+ planPhaseHeading("P2", "<phase 2 title>"),
75840
+ "",
75841
+ planPhaseSectionHeading("dependsOn"),
75842
+ "- P1",
75843
+ "",
75844
+ planPhaseSectionHeading("requirements"),
75845
+ "- <what this phase delivers>",
75846
+ "",
75847
+ planPhaseSectionHeading("constraints"),
75848
+ "- <phase 2 constraint>",
75849
+ "",
75850
+ planPhaseSectionHeading("acceptance"),
75851
+ "- <observable done-condition, including one end-to-end check>",
75852
+ "",
75853
+ planSectionHeading("remarks"),
75854
+ "<optional: revisions and which delegated phases are unchanged, replaced, or dropped — omit this section when empty>"
75855
+ ];
75856
+ }
75857
+ function noneAllowedSummary() {
75858
+ return [
75859
+ ...PLAN_NONE_ALLOWED_SECTIONS.map((name) => PLAN_SECTION_NAMES[name]),
75860
+ ...PLAN_NONE_ALLOWED_PHASE_SECTIONS.map((name) => `phase ${PLAN_PHASE_SECTION_NAMES[name]}`)
75861
+ ].join(", ");
75862
+ }
75863
+ function requiredPhaseSectionsSummary() {
75864
+ return PLAN_REQUIRED_PHASE_SECTIONS.map((name) => PLAN_PHASE_SECTION_NAMES[name]).join(", ");
75865
+ }
75866
+ function getPlanTemplate(params = {}) {
75867
+ const cliEnvPrefix = params.cliEnvPrefix ?? "";
75868
+ return [
75869
+ "Instructions (not part of the message): fill in every <placeholder> and keep the heading order below.",
75870
+ "Publish the fenced markdown as the plan body with:",
75871
+ "",
75872
+ planPublishCommand({ cliEnvPrefix }),
75873
+ "",
75874
+ "Read the whole plan back with:",
75875
+ planReadCommand({ cliEnvPrefix }),
75876
+ "",
75877
+ "Read one phase back with:",
75878
+ planReadCommand({ cliEnvPrefix, phase: "P2" }),
75879
+ "",
75880
+ `Every phase needs ${requiredPhaseSectionsSummary()}. "${PLAN_NONE_TOKEN}" is allowed only for: ${noneAllowedSummary()}.`,
75881
+ "Phases are referenced as <planId>#Pn — report the plan id the publish command returns.",
75882
+ "",
75883
+ "```markdown",
75884
+ ...skeletonLines(),
75885
+ "```"
75886
+ ].join(`
75887
+ `);
75888
+ }
75889
+ var init_plan_template = __esm(() => {
75890
+ init_command3();
75891
+ init_plan_template_spec();
75892
+ });
75893
+
75894
+ // ../../services/backend/prompts/cli/plan/view-template.ts
75895
+ function viewPlanTemplate(params = {}) {
75896
+ return getPlanTemplate(params);
75897
+ }
75898
+ var init_view_template4 = __esm(() => {
75899
+ init_plan_template();
75900
+ });
75901
+
75902
+ // src/commands/plan/view-template.ts
75903
+ var exports_view_template2 = {};
75904
+ __export(exports_view_template2, {
75905
+ printPlanViewTemplate: () => printPlanViewTemplate
75906
+ });
75907
+ function printPlanViewTemplate(options = {}) {
75908
+ console.log(viewPlanTemplate({ nativeIntegration: true, cliEnvPrefix: options.cliEnvPrefix }));
75909
+ }
75910
+ var init_view_template5 = __esm(() => {
75911
+ init_view_template4();
75912
+ });
75913
+
75914
+ // ../../services/backend/src/domain/plan/parse-plan.ts
75915
+ function trimItem(text) {
75916
+ return text.replace(/\s+$/, "");
75917
+ }
75918
+ function isNoneToken(text) {
75919
+ return text.trim().toLowerCase() === PLAN_NONE_TOKEN.toLowerCase();
75920
+ }
75921
+ function parsePhaseEntry(text) {
75922
+ const match5 = PHASE_ENTRY_PATTERN.exec(text.trim());
75923
+ if (!match5)
75924
+ return null;
75925
+ const title = match5[2].trim();
75926
+ return title.length > 0 ? { id: `P${match5[1]}`, title } : null;
75927
+ }
75928
+ function lookupSectionName(raw) {
75929
+ const needle = raw.trim().toLowerCase();
75930
+ for (const key of Object.keys(PLAN_SECTION_NAMES)) {
75931
+ if (PLAN_SECTION_NAMES[key].toLowerCase() === needle)
75932
+ return key;
75933
+ }
75934
+ return null;
75935
+ }
75936
+ function lookupPhaseSectionName(raw) {
75937
+ const needle = raw.trim().toLowerCase();
75938
+ for (const key of Object.keys(PLAN_PHASE_SECTION_NAMES)) {
75939
+ if (PLAN_PHASE_SECTION_NAMES[key].toLowerCase() === needle)
75940
+ return key;
75941
+ }
75942
+ return null;
75943
+ }
75944
+ function phaseNumber(id) {
75945
+ return Number.parseInt(id.slice(1), 10);
75946
+ }
75947
+ function createState(errors4) {
75948
+ return {
75949
+ errors: errors4,
75950
+ title: null,
75951
+ firstContentSeen: false,
75952
+ lastSectionRank: -1,
75953
+ currentSection: null,
75954
+ currentPhase: null,
75955
+ currentPhaseSection: null,
75956
+ currentBullet: null,
75957
+ orphanReported: false,
75958
+ sectionHeadings: new Map,
75959
+ sectionBullets: new Map,
75960
+ remarksLines: [],
75961
+ phaseListBullets: [],
75962
+ phaseBlocks: [],
75963
+ blankBefore: false,
75964
+ insideFence: false
75965
+ };
75966
+ }
75967
+ function record2(state, code2, line, message) {
75968
+ state.errors.push({ code: code2, line, message });
75969
+ }
75970
+ function misplacedPhaseContentMessage(state) {
75971
+ if (state.currentSection !== "phaseDetails")
75972
+ return null;
75973
+ if (state.currentPhase === null)
75974
+ return PHASE_BLOCK_MESSAGE;
75975
+ if (state.currentPhaseSection === null)
75976
+ return PHASE_SUBSECTION_MESSAGE;
75977
+ return null;
75978
+ }
75979
+ function reportOrphan(state, line) {
75980
+ if (state.orphanReported)
75981
+ return;
75982
+ state.orphanReported = true;
75983
+ const phaseMessage = misplacedPhaseContentMessage(state);
75984
+ if (phaseMessage !== null) {
75985
+ record2(state, "PLAN_SECTION_ORDER", line, phaseMessage);
75986
+ return;
75987
+ }
75988
+ if (state.currentSection !== null) {
75989
+ record2(state, "PLAN_STRAY_CONTENT", line, STRAY_CONTENT_MESSAGE);
75990
+ return;
75991
+ }
75992
+ record2(state, "PLAN_SECTION_ORDER", line, "Content appears outside any recognised plan section");
75993
+ }
75994
+ function listedPhaseIds(state) {
75995
+ return new Set(state.phaseListBullets.map((bullet) => parsePhaseEntry(trimItem(bullet.text))).filter((parsed) => parsed !== null).map((parsed) => parsed.id));
75996
+ }
75997
+ function appendBullet(state, target, raw, line) {
75998
+ const bullet = { text: raw.slice(2), line };
75999
+ target.push(bullet);
76000
+ state.currentBullet = bullet;
76001
+ }
76002
+ function handlePlanSectionHeading(state, text, line) {
76003
+ state.currentBullet = null;
76004
+ state.currentPhase = null;
76005
+ state.currentPhaseSection = null;
76006
+ state.orphanReported = false;
76007
+ const name = lookupSectionName(text);
76008
+ if (!name) {
76009
+ record2(state, "PLAN_SECTION_ORDER", line, `Unrecognised section heading "## ${text.trim()}"`);
76010
+ state.currentSection = null;
76011
+ return;
76012
+ }
76013
+ if (state.sectionHeadings.has(name)) {
76014
+ record2(state, "PLAN_SECTION_ORDER", line, `Duplicate section heading "## ${PLAN_SECTION_NAMES[name]}"`);
76015
+ state.currentSection = null;
76016
+ return;
76017
+ }
76018
+ const rank = PLAN_SECTION_ORDER.indexOf(name);
76019
+ if (rank <= state.lastSectionRank) {
76020
+ record2(state, "PLAN_SECTION_ORDER", line, `Section heading "## ${PLAN_SECTION_NAMES[name]}" is out of order`);
76021
+ state.currentSection = null;
76022
+ return;
76023
+ }
76024
+ state.sectionHeadings.set(name, line);
76025
+ state.lastSectionRank = rank;
76026
+ state.currentSection = name;
76027
+ }
76028
+ function checkPhaseEntryListed(state, entry, line) {
76029
+ if (state.phaseBlocks.some((block) => block.id === entry.id)) {
76030
+ record2(state, "PLAN_PHASE_DETAIL_UNLISTED", line, `Duplicate phase detail block "${entry.id}"`);
76031
+ return false;
76032
+ }
76033
+ if (!listedPhaseIds(state).has(entry.id)) {
76034
+ record2(state, "PLAN_PHASE_DETAIL_UNLISTED", line, `Phase detail "${entry.id}" is not listed in "## Phases"`);
76035
+ return false;
76036
+ }
76037
+ return true;
76038
+ }
76039
+ function resolvePhaseHeadingEntry(state, heading, line) {
76040
+ if (state.currentSection !== "phaseDetails") {
76041
+ record2(state, "PLAN_SECTION_ORDER", line, 'Phase detail headings are only valid inside "## Phase details"');
76042
+ return null;
76043
+ }
76044
+ const entry = parsePhaseEntry(heading);
76045
+ if (!entry) {
76046
+ record2(state, "PLAN_PHASE_DETAIL_UNLISTED", line, `Phase detail heading "${heading}" must look like "P1 — <title>"`);
76047
+ return null;
76048
+ }
76049
+ return checkPhaseEntryListed(state, entry, line) ? entry : null;
76050
+ }
76051
+ function pushPhaseBlock(state, entry, line) {
76052
+ const block = {
76053
+ id: entry.id,
76054
+ title: entry.title,
76055
+ line,
76056
+ lastSectionRank: -1,
76057
+ sections: new Map
76058
+ };
76059
+ state.phaseBlocks.push(block);
76060
+ return block;
76061
+ }
76062
+ function handlePhaseHeading(state, heading, line) {
76063
+ state.currentBullet = null;
76064
+ state.currentPhaseSection = null;
76065
+ state.orphanReported = false;
76066
+ const entry = resolvePhaseHeadingEntry(state, heading, line);
76067
+ if (entry === null) {
76068
+ state.currentPhase = null;
76069
+ state.orphanReported = true;
76070
+ return;
76071
+ }
76072
+ state.currentPhase = pushPhaseBlock(state, entry, line);
76073
+ }
76074
+ function isInsidePhaseBlock(state, phase) {
76075
+ return state.currentSection === "phaseDetails" && phase !== null;
76076
+ }
76077
+ function openPhaseSection(state, phase, name, line) {
76078
+ if (phase.sections.has(name)) {
76079
+ record2(state, "PLAN_SECTION_ORDER", line, `Duplicate phase sub-section "${PLAN_PHASE_SECTION_NAMES[name]}"`);
76080
+ return null;
76081
+ }
76082
+ const rank = PLAN_PHASE_SECTION_ORDER.indexOf(name);
76083
+ if (rank <= phase.lastSectionRank) {
76084
+ record2(state, "PLAN_SECTION_ORDER", line, `Phase sub-section "${PLAN_PHASE_SECTION_NAMES[name]}" is out of order`);
76085
+ return null;
76086
+ }
76087
+ phase.lastSectionRank = rank;
76088
+ phase.sections.set(name, []);
76089
+ return name;
76090
+ }
76091
+ function handlePhaseSectionHeading(state, text, line) {
76092
+ state.currentBullet = null;
76093
+ const phase = state.currentPhase;
76094
+ if (!isInsidePhaseBlock(state, phase)) {
76095
+ record2(state, "PLAN_SECTION_ORDER", line, 'Phase sub-section headings are only valid inside a "### Pn" block');
76096
+ state.orphanReported = true;
76097
+ return;
76098
+ }
76099
+ const name = lookupPhaseSectionName(text);
76100
+ if (name === null) {
76101
+ record2(state, "PLAN_SECTION_ORDER", line, `Unrecognised phase sub-section "#### ${text.trim()}"`);
76102
+ state.orphanReported = true;
76103
+ return;
76104
+ }
76105
+ state.currentPhaseSection = openPhaseSection(state, phase, name, line);
76106
+ state.orphanReported = state.currentPhaseSection === null;
76107
+ }
76108
+ function isTopLevelListSection(section) {
76109
+ return section === "sources" || section === "requirements" || section === "constraints";
76110
+ }
76111
+ function currentBulletList(state) {
76112
+ if (isTopLevelListSection(state.currentSection)) {
76113
+ return sectionBulletList(state, state.currentSection);
76114
+ }
76115
+ const phase = state.currentPhase;
76116
+ const name = state.currentPhaseSection;
76117
+ if (phase === null)
76118
+ return null;
76119
+ if (name === null)
76120
+ return null;
76121
+ return phaseBulletList(phase, name);
76122
+ }
76123
+ function sectionBulletList(state, name) {
76124
+ const list = state.sectionBullets.get(name) ?? [];
76125
+ state.sectionBullets.set(name, list);
76126
+ return list;
76127
+ }
76128
+ function phaseBulletList(phase, name) {
76129
+ const list = phase.sections.get(name) ?? [];
76130
+ phase.sections.set(name, list);
76131
+ return list;
76132
+ }
76133
+ function handleBulletLine(state, raw, line) {
76134
+ if (state.currentSection === "remarks") {
76135
+ state.remarksLines.push(raw);
76136
+ return;
76137
+ }
76138
+ if (state.currentSection === "phases") {
76139
+ state.phaseListBullets.push({ text: raw.slice(2), line });
76140
+ state.currentBullet = null;
76141
+ return;
76142
+ }
76143
+ const list = currentBulletList(state);
76144
+ if (list === null) {
76145
+ reportOrphan(state, line);
76146
+ return;
76147
+ }
76148
+ appendBullet(state, list, raw, line);
76149
+ }
76150
+ function appendContinuation(state, raw) {
76151
+ if (state.currentBullet === null)
76152
+ return false;
76153
+ state.currentBullet.text += `
76154
+ ${raw}`;
76155
+ return true;
76156
+ }
76157
+ function handleContentLine2(state, raw, trimmed, line) {
76158
+ if (state.currentSection === "remarks")
76159
+ return pushRemarkLine(state, raw);
76160
+ if (state.currentSection === "phases")
76161
+ return recordPhaseListContentError(state, line);
76162
+ handleContentFallback(state, raw, trimmed, line);
76163
+ }
76164
+ function pushRemarkLine(state, raw) {
76165
+ state.remarksLines.push(raw);
76166
+ }
76167
+ function recordPhaseListContentError(state, line) {
76168
+ record2(state, "PLAN_PHASE_ID_INVALID", line, 'Phase list entries must be a single line of the form "- P1 — <title>"');
76169
+ }
76170
+ function isBulletOpenAfterBlank(state) {
76171
+ return state.currentBullet !== null && state.blankBefore && !state.insideFence;
76172
+ }
76173
+ function isUnindentedLine(raw, trimmed) {
76174
+ return trimmed.length > 0 && startsInColumnOne(raw);
76175
+ }
76176
+ function startsInColumnOne(raw) {
76177
+ return !/^\s/.test(raw);
76178
+ }
76179
+ function isStrayParagraph(state, raw, trimmed) {
76180
+ return isBulletOpenAfterBlank(state) && isUnindentedLine(raw, trimmed);
76181
+ }
76182
+ function recordStrayParagraph(state, line) {
76183
+ record2(state, "PLAN_STRAY_CONTENT", line, STRAY_CONTENT_MESSAGE);
76184
+ state.currentBullet = { text: "", line };
76185
+ }
76186
+ function handleContentFallback(state, raw, trimmed, line) {
76187
+ if (isStrayParagraph(state, raw, trimmed))
76188
+ return recordStrayParagraph(state, line);
76189
+ if (appendContinuation(state, raw))
76190
+ return;
76191
+ if (trimmed.length > 0)
76192
+ reportOrphan(state, line);
76193
+ }
76194
+ function isFenceCloser(fence, trimmed) {
76195
+ const closer = FENCE_CLOSER_PATTERN.exec(trimmed);
76196
+ return closer !== null && closer[1][0] === fence.fenceChar && closer[1].length >= fence.fenceLength;
76197
+ }
76198
+ function isFenceLine(fence, trimmed, line) {
76199
+ if (!fence.inFence) {
76200
+ const opener = FENCE_OPENER_PATTERN.exec(trimmed);
76201
+ if (opener === null)
76202
+ return false;
76203
+ fence.inFence = true;
76204
+ fence.fenceChar = opener[1][0];
76205
+ fence.fenceLength = opener[1].length;
76206
+ fence.openedAt = line;
76207
+ return true;
76208
+ }
76209
+ if (isFenceCloser(fence, trimmed)) {
76210
+ fence.inFence = false;
76211
+ fence.fenceChar = null;
76212
+ }
76213
+ return true;
76214
+ }
76215
+ function handleBlankLine(state, raw, trimmed) {
76216
+ if (trimmed.length > 0)
76217
+ return false;
76218
+ if (state.currentSection === "remarks")
76219
+ state.remarksLines.push(raw);
76220
+ return true;
76221
+ }
76222
+ function consumeTitleLine(state, trimmed, line) {
76223
+ if (state.firstContentSeen)
76224
+ return false;
76225
+ state.firstContentSeen = true;
76226
+ const titleMatch = TITLE_PATTERN.exec(trimmed);
76227
+ if (titleMatch) {
76228
+ state.title = titleMatch[1].trim();
76229
+ return true;
76230
+ }
76231
+ record2(state, "PLAN_TITLE_MISSING", line, "The plan title must be an H1 on the first line");
76232
+ return false;
76233
+ }
76234
+ function handleExtraTitle(state, _text, line) {
76235
+ record2(state, "PLAN_SECTION_ORDER", line, "Only one H1 (the plan title) is allowed");
76236
+ }
76237
+ function handleStructuredLine(state, raw, trimmed, line) {
76238
+ const heading = startsInColumnOne(raw) ? HEADING_HANDLERS.find((entry) => trimmed.startsWith(entry.prefix)) : undefined;
76239
+ if (heading) {
76240
+ heading.handle(state, trimmed.slice(heading.prefix.length), line);
76241
+ return;
76242
+ }
76243
+ if (raw.startsWith("- ")) {
76244
+ handleBulletLine(state, raw, line);
76245
+ return;
76246
+ }
76247
+ handleContentLine2(state, raw, trimmed, line);
76248
+ }
76249
+ function scanLine(state, fence, raw, line) {
76250
+ const trimmed = raw.trim();
76251
+ state.insideFence = fence.inFence;
76252
+ if (isFenceLine(fence, trimmed, line)) {
76253
+ handleContentLine2(state, raw, trimmed, line);
76254
+ return;
76255
+ }
76256
+ if (handleBlankLine(state, raw, trimmed))
76257
+ return;
76258
+ if (consumeTitleLine(state, trimmed, line))
76259
+ return;
76260
+ handleStructuredLine(state, raw, trimmed, line);
76261
+ }
76262
+ function scanDocument(lines, state) {
76263
+ const fence = { inFence: false, fenceChar: null, fenceLength: 0, openedAt: 0 };
76264
+ for (let index = 0;index < lines.length; index++) {
76265
+ state.blankBefore = index > 0 && lines[index - 1].trim().length === 0;
76266
+ scanLine(state, fence, lines[index], index + 1);
76267
+ }
76268
+ if (fence.inFence) {
76269
+ record2(state, "PLAN_FENCE_UNCLOSED", fence.openedAt, `Code fence opened on line ${fence.openedAt} is never closed`);
76270
+ }
76271
+ }
76272
+ function missingSectionLine(state, name, fallback) {
76273
+ const rank = PLAN_SECTION_ORDER.indexOf(name);
76274
+ for (let next2 = rank + 1;next2 < PLAN_SECTION_ORDER.length; next2++) {
76275
+ const line = state.sectionHeadings.get(PLAN_SECTION_ORDER[next2]);
76276
+ if (line !== undefined)
76277
+ return line;
76278
+ }
76279
+ return fallback;
76280
+ }
76281
+ function validateMissingSections(state, lastLineNumber) {
76282
+ for (const name of PLAN_REQUIRED_SECTIONS) {
76283
+ if (state.sectionHeadings.has(name))
76284
+ continue;
76285
+ record2(state, "PLAN_SECTION_MISSING", missingSectionLine(state, name, lastLineNumber), `Missing required section "## ${PLAN_SECTION_NAMES[name]}"`);
76286
+ }
76287
+ }
76288
+ function finaliseBullets(bullets) {
76289
+ return bullets.map((bullet) => ({ ...bullet, text: trimItem(bullet.text) })).filter((bullet) => bullet.text.trim().length > 0);
76290
+ }
76291
+ function finaliseBulletsInState(state) {
76292
+ for (const [name, bullets] of state.sectionBullets) {
76293
+ state.sectionBullets.set(name, finaliseBullets(bullets));
76294
+ }
76295
+ state.phaseListBullets = finaliseBullets(state.phaseListBullets);
76296
+ for (const block of state.phaseBlocks) {
76297
+ for (const [name, bullets] of block.sections) {
76298
+ block.sections.set(name, finaliseBullets(bullets));
76299
+ }
76300
+ }
76301
+ }
76302
+ function collectPhaseList(state) {
76303
+ const phasesHeading = state.sectionHeadings.get("phases");
76304
+ const phaseList = state.phaseListBullets.map((bullet) => ({
76305
+ bullet,
76306
+ entry: parsePhaseEntry(bullet.text)
76307
+ }));
76308
+ if (phasesHeading !== undefined && phaseList.length === 0) {
76309
+ record2(state, "PLAN_PHASE_LIST_EMPTY", phasesHeading, 'The "## Phases" section must list at least one phase');
76310
+ }
76311
+ if (phaseList.length > PLAN_MAX_PHASES) {
76312
+ record2(state, "PLAN_TOO_MANY_PHASES", phaseList[PLAN_MAX_PHASES].bullet.line, `A plan may declare at most ${PLAN_MAX_PHASES} phases`);
76313
+ }
76314
+ const listedEntries = [];
76315
+ phaseList.forEach(({ bullet, entry }, index) => {
76316
+ const expectedId = `P${index + 1}`;
76317
+ if (!entry) {
76318
+ record2(state, "PLAN_PHASE_ID_INVALID", bullet.line, `Phase entry "${bullet.text.trim()}" must look like "- Pn — <title>"`);
76319
+ return;
76320
+ }
76321
+ if (entry.id !== expectedId) {
76322
+ record2(state, "PLAN_PHASE_ID_INVALID", bullet.line, `Phase ids must be sequential: expected "${expectedId}", got "${entry.id}"`);
76323
+ return;
76324
+ }
76325
+ listedEntries.push({ id: entry.id, title: entry.title, line: bullet.line });
76326
+ });
76327
+ return { listedEntries, listedIds: new Set(listedEntries.map((entry) => entry.id)) };
76328
+ }
76329
+ function readRemarks(state) {
76330
+ const heading = state.sectionHeadings.get("remarks");
76331
+ if (heading === undefined)
76332
+ return null;
76333
+ const raw = state.remarksLines.join(`
76334
+ `).trim();
76335
+ if (raw.length === 0) {
76336
+ record2(state, "PLAN_SECTION_EMPTY", heading, 'The "## Remarks" section must not be empty');
76337
+ return null;
76338
+ }
76339
+ return raw;
76340
+ }
76341
+ function planListContext(name) {
76342
+ return {
76343
+ label: `"${PLAN_SECTION_NAMES[name]}"`,
76344
+ noneCode: "PLAN_SECTION_EMPTY",
76345
+ noneAllowed: PLAN_NONE_ALLOWED_SECTIONS.includes(name)
76346
+ };
76347
+ }
76348
+ function phaseListContext(block, name) {
76349
+ return {
76350
+ label: `"${block.id}" ${PLAN_PHASE_SECTION_NAMES[name]}`,
76351
+ noneCode: "PLAN_PHASE_SECTION_MISSING",
76352
+ noneAllowed: PLAN_NONE_ALLOWED_PHASE_SECTIONS.includes(name)
76353
+ };
76354
+ }
76355
+ function firstNoneLine(bullets) {
76356
+ const none3 = bullets.find((bullet) => isNoneToken(bullet.text));
76357
+ return none3 === undefined ? null : none3.line;
76358
+ }
76359
+ function reportNoneNotAllowed(state, context3, bullets, line) {
76360
+ record2(state, context3.noneCode, line, `"${PLAN_NONE_TOKEN}" is not allowed in ${context3.label}`);
76361
+ return bullets.filter((bullet) => !isNoneToken(bullet.text));
76362
+ }
76363
+ function reportNoneMixed(state, context3, bullets, line) {
76364
+ record2(state, "PLAN_SECTION_ORDER", line, `"${PLAN_NONE_TOKEN}" must be the only item in ${context3.label}`);
76365
+ return bullets.filter((bullet) => !isNoneToken(bullet.text));
76366
+ }
76367
+ function readListItems(state, bullets, context3) {
76368
+ const noneLine = firstNoneLine(bullets);
76369
+ if (noneLine === null)
76370
+ return bullets;
76371
+ if (!context3.noneAllowed)
76372
+ return reportNoneNotAllowed(state, context3, bullets, noneLine);
76373
+ if (bullets.length > 1)
76374
+ return reportNoneMixed(state, context3, bullets, noneLine);
76375
+ return [];
76376
+ }
76377
+ function readPlanListSection(state, name) {
76378
+ const heading = state.sectionHeadings.get(name);
76379
+ if (heading === undefined)
76380
+ return [];
76381
+ const bullets = state.sectionBullets.get(name) ?? [];
76382
+ if (bullets.length === 0) {
76383
+ record2(state, "PLAN_SECTION_EMPTY", heading, `The "## ${PLAN_SECTION_NAMES[name]}" section must not be empty`);
76384
+ return [];
76385
+ }
76386
+ return readListItems(state, bullets, planListContext(name)).map((bullet) => bullet.text);
76387
+ }
76388
+ function readPhaseSection(state, block, name) {
76389
+ const bullets = block.sections.get(name) ?? [];
76390
+ if (bullets.length === 0) {
76391
+ record2(state, "PLAN_PHASE_SECTION_MISSING", block.line, `Phase "${block.id}" is missing its "${PLAN_PHASE_SECTION_NAMES[name]}" sub-section`);
76392
+ return [];
76393
+ }
76394
+ return readListItems(state, bullets, phaseListContext(block, name)).map((bullet) => bullet.text);
76395
+ }
76396
+ function isValidDependsOn(referenced, current, listedIds) {
76397
+ return referenced !== null && phaseNumber(referenced) < current && listedIds.has(referenced);
76398
+ }
76399
+ function validateDependsOnEntry(state, block, listedIds, bullet) {
76400
+ const text = bullet.text.trim();
76401
+ const match5 = PLAN_PHASE_ID_PATTERN.exec(text);
76402
+ const referenced = match5 ? `P${match5[1]}` : null;
76403
+ if (isValidDependsOn(referenced, phaseNumber(block.id), listedIds))
76404
+ return referenced;
76405
+ record2(state, "PLAN_DEPENDS_ON_INVALID", bullet.line, `"${text}" must reference an earlier phase listed in "## Phases"`);
76406
+ return null;
76407
+ }
76408
+ function validateDependsOn(state, block, listedIds) {
76409
+ const bullets = block.sections.get("dependsOn") ?? [];
76410
+ const candidates = readListItems(state, bullets, phaseListContext(block, "dependsOn"));
76411
+ const validated = [];
76412
+ for (const bullet of candidates) {
76413
+ const referenced = validateDependsOnEntry(state, block, listedIds, bullet);
76414
+ if (referenced !== null)
76415
+ validated.push(referenced);
76416
+ }
76417
+ return validated;
76418
+ }
76419
+ function validatePhaseDetail(state, entry, blocksById, phaseDetailsHeading) {
76420
+ const block = blocksById.get(entry.id);
76421
+ if (!block) {
76422
+ record2(state, "PLAN_PHASE_DETAIL_MISSING", phaseDetailsHeading, `Missing "### ${entry.id} — ${entry.title}" block in "## Phase details"`);
76423
+ return;
76424
+ }
76425
+ if (block.title !== entry.title) {
76426
+ record2(state, "PLAN_PHASE_TITLE_MISMATCH", block.line, `Phase "${entry.id}" title must match the list: expected "${entry.title}", got "${block.title}"`);
76427
+ }
76428
+ }
76429
+ function validatePhaseDetails(state, listedEntries) {
76430
+ const heading = state.sectionHeadings.get("phaseDetails");
76431
+ if (heading === undefined)
76432
+ return;
76433
+ const blocksById = new Map(state.phaseBlocks.map((block) => [block.id, block]));
76434
+ for (const entry of listedEntries)
76435
+ validatePhaseDetail(state, entry, blocksById, heading);
76436
+ }
76437
+ function buildParsedPhases(state, listedEntries, listedIds) {
76438
+ const blocksById = new Map(state.phaseBlocks.map((block) => [block.id, block]));
76439
+ return listedEntries.map((entry) => {
76440
+ const block = blocksById.get(entry.id);
76441
+ if (!block) {
76442
+ return {
76443
+ id: entry.id,
76444
+ title: entry.title,
76445
+ dependsOn: [],
76446
+ requirements: [],
76447
+ constraints: [],
76448
+ acceptance: []
76449
+ };
76450
+ }
76451
+ return {
76452
+ id: block.id,
76453
+ title: block.title,
76454
+ dependsOn: validateDependsOn(state, block, listedIds),
76455
+ requirements: readPhaseSection(state, block, "requirements"),
76456
+ constraints: readPhaseSection(state, block, "constraints"),
76457
+ acceptance: readPhaseSection(state, block, "acceptance")
76458
+ };
76459
+ });
76460
+ }
76461
+ function lengthError(markdown) {
76462
+ const code2 = "PLAN_TOO_LONG";
76463
+ return {
76464
+ code: code2,
76465
+ line: 1,
76466
+ message: `Plan must be ${PLAN_MAX_CHARS} characters or less (got ${markdown.length})`
76467
+ };
76468
+ }
76469
+ function recordEmptyDocumentError(state) {
76470
+ if (state.firstContentSeen)
76471
+ return;
76472
+ record2(state, "PLAN_TITLE_MISSING", 1, "The plan title must be an H1 on the first line");
76473
+ }
76474
+ function buildParsedPlan(state, listedEntries, listedIds) {
76475
+ validatePhaseDetails(state, listedEntries);
76476
+ return {
76477
+ title: state.title ?? "",
76478
+ sources: readPlanListSection(state, "sources"),
76479
+ requirements: readPlanListSection(state, "requirements"),
76480
+ constraints: readPlanListSection(state, "constraints"),
76481
+ remarks: readRemarks(state),
76482
+ phases: buildParsedPhases(state, listedEntries, listedIds)
76483
+ };
76484
+ }
76485
+ function parsePlan(markdown) {
76486
+ if (markdown.length > PLAN_MAX_CHARS)
76487
+ return { ok: false, errors: [lengthError(markdown)] };
76488
+ const lines = markdown.split(/\r?\n/);
76489
+ const errors4 = [];
76490
+ const state = createState(errors4);
76491
+ scanDocument(lines, state);
76492
+ recordEmptyDocumentError(state);
76493
+ finaliseBulletsInState(state);
76494
+ validateMissingSections(state, lines.length);
76495
+ const { listedEntries, listedIds } = collectPhaseList(state);
76496
+ const plan = buildParsedPlan(state, listedEntries, listedIds);
76497
+ if (errors4.length === 0)
76498
+ return { ok: true, plan };
76499
+ errors4.sort((a, b) => a.line === b.line ? a.code.localeCompare(b.code) : a.line - b.line);
76500
+ return { ok: false, errors: errors4 };
76501
+ }
76502
+ var PHASE_ENTRY_PATTERN, TITLE_PATTERN, STRAY_CONTENT_MESSAGE = 'Unindented text after a blank line is not part of the bullet above; indent it under the bullet or start a new "- " item', PHASE_BLOCK_MESSAGE = 'Content under "## Phase details" must sit inside a "### Pn — <title>" block', PHASE_SUBSECTION_MESSAGE = 'Content under a phase must sit inside a "#### Depends on", "#### Requirements", "#### Constraints", or "#### Acceptance criteria" sub-section', FENCE_OPENER_PATTERN, FENCE_CLOSER_PATTERN, HEADING_HANDLERS;
76503
+ var init_parse_plan = __esm(() => {
76504
+ init_plan_template_spec();
76505
+ PHASE_ENTRY_PATTERN = /^P([1-9]\d*)\s+[—–-]\s+(.+)$/;
76506
+ TITLE_PATTERN = /^#\s+(.+)$/;
76507
+ FENCE_OPENER_PATTERN = /^(`{3,}|~{3,})/;
76508
+ FENCE_CLOSER_PATTERN = /^(`{3,}|~{3,})$/;
76509
+ HEADING_HANDLERS = [
76510
+ { prefix: PLAN_HEADINGS.phaseSection, handle: handlePhaseSectionHeading },
76511
+ { prefix: PLAN_HEADINGS.phase, handle: handlePhaseHeading },
76512
+ { prefix: PLAN_HEADINGS.section, handle: handlePlanSectionHeading },
76513
+ { prefix: PLAN_HEADINGS.title, handle: handleExtraTitle }
76514
+ ];
76515
+ });
76516
+
76517
+ // src/commands/plan/shared.ts
76518
+ function isSessionFailure(err2) {
76519
+ return err2._tag === "NotAuthenticated" || err2._tag === "InvalidChatroomId";
76520
+ }
76521
+ function printSessionFailure(err2) {
76522
+ if (err2._tag === "NotAuthenticated")
76523
+ return formatAuthError(err2.convexUrl, err2.otherUrls);
76524
+ formatChatroomIdError(err2.id);
76525
+ }
76526
+ async function runPlanCommand(deps, program2, handleError) {
76527
+ const resolved = deps ?? await createConvexCommandDeps();
76528
+ await exports_Effect.runPromise(program2.pipe(exports_Effect.catch((err2) => handleError(err2)), exports_Effect.provide(commandServicesLayerFromDeps(resolved))));
76529
+ }
76530
+ var init_shared = __esm(() => {
76531
+ init_dist();
76532
+ init_create_convex_command_deps();
76533
+ init_services();
76534
+ init_error_formatting();
76535
+ });
76536
+
76537
+ // src/commands/plan/publish.ts
76538
+ var exports_publish = {};
76539
+ __export(exports_publish, {
76540
+ publishPlan: () => publishPlan
76541
+ });
76542
+ function toPublishFailure(cause) {
76543
+ return {
76544
+ _tag: "PlanPublishFailed",
76545
+ cause,
76546
+ errorData: getConvexErrorData(cause)
76547
+ };
76548
+ }
76549
+ function printPlanErrors(errors4) {
76550
+ for (const error51 of errors4) {
76551
+ console.error(` line ${error51.line}: ${error51.code} — ${error51.message}`);
76552
+ }
76553
+ }
76554
+ function printTemplateHint() {
76555
+ console.error("\n\uD83D\uDCA1 Run `chatroom plan view-template` to see the expected structure.");
76556
+ }
76557
+ function printInvalidPlan(errors4) {
76558
+ console.error(`
76559
+ ❌ Plan not published`);
76560
+ printPlanErrors(errors4);
76561
+ printTemplateHint();
76562
+ }
76563
+ function publishFailureMessage(err2) {
76564
+ if (!err2.errorData)
76565
+ return getErrorMessage(err2.cause);
76566
+ return err2.errorData.message ?? getErrorMessage(err2.cause);
76567
+ }
76568
+ function publishFailureErrors(err2) {
76569
+ if (!err2.errorData)
76570
+ return [];
76571
+ return err2.errorData.errors ?? [];
76572
+ }
76573
+ function printPublishFailure(err2) {
76574
+ const code2 = err2.errorData?.code;
76575
+ if (code2 === "INVALID_PLAN")
76576
+ return printInvalidPlan(publishFailureErrors(err2));
76577
+ console.error(`
76578
+ ❌ Plan not published`);
76579
+ console.error(`
76580
+ ${publishFailureMessage(err2)}`);
76581
+ if (code2 === "NO_ACTIVE_TASK") {
76582
+ console.error("\n\uD83D\uDCA1 `plan publish` only works while you are working on a task.");
76583
+ }
76584
+ }
76585
+ function printPublishError(err2) {
76586
+ if (isSessionFailure(err2))
76587
+ return printSessionFailure(err2);
76588
+ if (err2._tag === "InvalidPlan")
76589
+ return printInvalidPlan(err2.errors);
76590
+ printPublishFailure(err2);
76591
+ }
76592
+ function handlePublishError(err2) {
76593
+ return exports_Effect.sync(() => {
76594
+ printPublishError(err2);
76595
+ process.exit(1);
76596
+ });
76597
+ }
76598
+ async function publishPlan(chatroomId, options, deps) {
76599
+ await runPlanCommand(deps, publishPlanEffect(chatroomId, options), handlePublishError);
76600
+ }
76601
+ var publishPlanEffect = (chatroomId, options) => exports_Effect.gen(function* () {
76602
+ const parsed = parsePlan(options.content);
76603
+ if (!parsed.ok) {
76604
+ return yield* exports_Effect.fail({ _tag: "InvalidPlan", errors: parsed.errors });
76605
+ }
76606
+ const sessionId = yield* requireSessionForChatroomEffect({ chatroomId });
76607
+ const backend2 = yield* BackendService;
76608
+ const result3 = yield* backend2.mutation(api.plans.publish, {
76609
+ sessionId,
76610
+ chatroomId,
76611
+ senderRole: options.role,
76612
+ content: options.content,
76613
+ ...options.supersedesPlanId ? { supersedesPlanId: options.supersedesPlanId } : {}
76614
+ }).pipe(exports_Effect.mapError(toPublishFailure));
76615
+ yield* exports_Effect.sync(() => {
76616
+ console.log("✅ Plan published");
76617
+ console.log(` Plan ID: ${result3.planId}`);
76618
+ console.log(` Phases: ${result3.phaseIds.join(", ")}`);
76619
+ console.log(` Cite phases as <planId>#Pn (e.g. ${result3.planId}#${result3.phaseIds[0] ?? "P1"}).`);
76620
+ console.log("Pass this plan ID to the coordinator in your slice report.");
76621
+ });
76622
+ });
76623
+ var init_publish = __esm(() => {
76624
+ init_parse_plan();
76625
+ init_dist();
76626
+ init_shared();
76627
+ init_api3();
76628
+ init_services();
76629
+ init_convex_error();
76630
+ });
76631
+
76632
+ // ../../services/backend/src/domain/plan/render-plan-phase.ts
76633
+ function appendBullets(lines, items) {
76634
+ if (items.length === 0) {
76635
+ lines.push(`- ${PLAN_NONE_TOKEN}`);
76636
+ return;
76637
+ }
76638
+ for (const item of items) {
76639
+ const [firstLine, ...rest] = item.split(`
76640
+ `);
76641
+ lines.push(`- ${firstLine}`);
76642
+ for (const line of rest)
76643
+ lines.push(` ${line}`);
76644
+ }
76645
+ }
76646
+ function renderPhaseListEntry(phase, targetId) {
76647
+ if (phase.id === targetId) {
76648
+ return `- **${phase.id} ${PLAN_PHASE_SEPARATOR} ${phase.title}** (selected phase)`;
76649
+ }
76650
+ return `- ${phase.id} ${PLAN_PHASE_SEPARATOR} ${phase.title}`;
76651
+ }
76652
+ function appendPhaseList(lines, plan, targetId) {
76653
+ for (const phase of plan.phases)
76654
+ lines.push(renderPhaseListEntry(phase, targetId));
76655
+ }
76656
+ function appendPhaseBlock(lines, target) {
76657
+ lines.push(planPhaseHeading(target.id, target.title), "");
76658
+ if (target.dependsOn.length > 0) {
76659
+ lines.push(planPhaseSectionHeading("dependsOn"));
76660
+ appendBullets(lines, target.dependsOn);
76661
+ lines.push("");
76662
+ }
76663
+ lines.push(planPhaseSectionHeading("requirements"));
76664
+ appendBullets(lines, target.requirements);
76665
+ lines.push("");
76666
+ lines.push(planPhaseSectionHeading("constraints"));
76667
+ appendBullets(lines, target.constraints);
76668
+ lines.push("");
76669
+ lines.push(planPhaseSectionHeading("acceptance"));
76670
+ appendBullets(lines, target.acceptance);
76671
+ }
76672
+ function renderPlanPhase(plan, phaseId) {
76673
+ const target = plan.phases.find((phase) => phase.id === phaseId);
76674
+ if (!target)
76675
+ return null;
76676
+ const lines = [];
76677
+ lines.push(`${PLAN_HEADINGS.title}${plan.title}`, "");
76678
+ lines.push(planSectionHeading("requirements"));
76679
+ appendBullets(lines, plan.requirements);
76680
+ lines.push("", planSectionHeading("constraints"));
76681
+ appendBullets(lines, plan.constraints);
76682
+ lines.push("", planSectionHeading("phases"));
76683
+ appendPhaseList(lines, plan, target.id);
76684
+ lines.push("", planSectionHeading("phaseDetails"), "");
76685
+ appendPhaseBlock(lines, target);
76686
+ return lines.join(`
76687
+ `);
76688
+ }
76689
+ var init_render_plan_phase = __esm(() => {
76690
+ init_plan_template_spec();
76691
+ });
76692
+
76693
+ // src/commands/plan/read.ts
76694
+ var exports_read = {};
76695
+ __export(exports_read, {
76696
+ readPlan: () => readPlan
76697
+ });
76698
+ function toReadFailure(cause) {
76699
+ return { _tag: "PlanReadFailed", cause, errorData: getConvexErrorData(cause) };
76700
+ }
76701
+ function normalizePhaseId(phase) {
76702
+ return phase.trim().toUpperCase();
76703
+ }
76704
+ function resolvePlanOutput(plan, phaseId) {
76705
+ if (phaseId === null)
76706
+ return exports_Effect.succeed(plan.content);
76707
+ const parsed = parsePlan(plan.content);
76708
+ if (!parsed.ok)
76709
+ return exports_Effect.fail({ _tag: "UnparsablePlan", content: plan.content });
76710
+ const rendered = renderPlanPhase(parsed.plan, phaseId);
76711
+ if (rendered === null) {
76712
+ return exports_Effect.fail({
76713
+ _tag: "PhaseNotFound",
76714
+ phaseId,
76715
+ available: parsed.plan.phases.map((phase) => phase.id)
76716
+ });
76717
+ }
76718
+ return exports_Effect.succeed(rendered);
76719
+ }
76720
+ function printPlanHeader(plan) {
76721
+ console.log(`Plan ID: ${plan.planId}`);
76722
+ console.log(`Author: ${plan.senderRole}`);
76723
+ console.log(`Created: ${new Date(plan.createdAt).toISOString()}`);
76724
+ if (plan.supersedes)
76725
+ console.log(`Supersedes: ${plan.supersedes}`);
76726
+ if (plan.supersededBy)
76727
+ console.log(`⚠ Superseded by ${plan.supersededBy}`);
76728
+ }
76729
+ function printPhaseNotFound(err2) {
76730
+ console.error(`
76731
+ ❌ Phase not found: ${err2.phaseId}`);
76732
+ console.error(` Available phases: ${err2.available.join(", ")}`);
76733
+ }
76734
+ function printUnparsablePlan(content) {
76735
+ console.error(`
76736
+ ❌ Cannot read a phase: the stored plan does not match the current template.`);
76737
+ console.error(` Showing the raw content:
76738
+ `);
76739
+ console.error(content);
76740
+ }
76741
+ function printPlanReadFailure(err2) {
76742
+ if (err2.errorData?.code === "PLAN_NOT_FOUND") {
76743
+ console.error(`
76744
+ ❌ ${getErrorMessage(err2.cause)}`);
76745
+ console.error(" Check the plan id reported by the plan author.");
76746
+ return;
76747
+ }
76748
+ console.error(`
76749
+ ❌ Could not read plan`);
76750
+ console.error(`
76751
+ ${getErrorMessage(err2.cause)}`);
76752
+ }
76753
+ function printPlanReadError(err2) {
76754
+ if (err2._tag === "PhaseNotFound")
76755
+ return printPhaseNotFound(err2);
76756
+ if (err2._tag === "UnparsablePlan")
76757
+ return printUnparsablePlan(err2.content);
76758
+ printPlanReadFailure(err2);
76759
+ }
76760
+ function printReadError(err2) {
76761
+ if (isSessionFailure(err2))
76762
+ return printSessionFailure(err2);
76763
+ printPlanReadError(err2);
76764
+ }
76765
+ function handleReadError(err2) {
76766
+ return exports_Effect.sync(() => {
76767
+ printReadError(err2);
76768
+ process.exit(1);
76769
+ });
76770
+ }
76771
+ async function readPlan(chatroomId, options, deps) {
76772
+ await runPlanCommand(deps, readPlanEffect(chatroomId, options), handleReadError);
76773
+ }
76774
+ var readPlanEffect = (chatroomId, options) => exports_Effect.gen(function* () {
76775
+ const sessionId = yield* requireSessionForChatroomEffect({ chatroomId });
76776
+ const backend2 = yield* BackendService;
76777
+ const plan = yield* backend2.query(api.plans.get, {
76778
+ sessionId,
76779
+ chatroomId,
76780
+ planId: options.planId
76781
+ }).pipe(exports_Effect.mapError(toReadFailure));
76782
+ const phaseId = options.phase === undefined ? null : normalizePhaseId(options.phase);
76783
+ const output = yield* resolvePlanOutput(plan, phaseId);
76784
+ yield* exports_Effect.sync(() => {
76785
+ printPlanHeader(plan);
76786
+ console.log("");
76787
+ console.log(output);
76788
+ });
76789
+ });
76790
+ var init_read = __esm(() => {
76791
+ init_parse_plan();
76792
+ init_render_plan_phase();
76793
+ init_dist();
76794
+ init_shared();
76795
+ init_api3();
76796
+ init_services();
76797
+ init_convex_error();
76798
+ });
76799
+
75848
76800
  // src/commands/agentic-query/complete.ts
75849
76801
  var exports_complete = {};
75850
76802
  __export(exports_complete, {
@@ -76937,8 +77889,8 @@ var init_render = __esm(() => {
76937
77889
  });
76938
77890
 
76939
77891
  // src/commands/task/read/index.ts
76940
- var exports_read = {};
76941
- __export(exports_read, {
77892
+ var exports_read2 = {};
77893
+ __export(exports_read2, {
76942
77894
  taskReadEffect: () => taskReadEffect,
76943
77895
  taskRead: () => taskRead
76944
77896
  });
@@ -77011,7 +77963,7 @@ var taskReadEffect = (chatroomId, options) => exports_Effect.gen(function* () {
77011
77963
  console.log(buildTaskPromptFromReadResult(result3, chatroomId, role));
77012
77964
  });
77013
77965
  }), taskReadErrorHandlers;
77014
- var init_read = __esm(() => {
77966
+ var init_read2 = __esm(() => {
77015
77967
  init_dist();
77016
77968
  init_render();
77017
77969
  init_api3();
@@ -84603,13 +85555,26 @@ var init_send = __esm(() => {
84603
85555
  function attachmentContext(options) {
84604
85556
  return { chatroomId: options.chatroomId ?? "", role: options.role ?? "" };
84605
85557
  }
85558
+ function linearSenderAgentSuffix(senderAgent) {
85559
+ if (!senderAgent)
85560
+ return "";
85561
+ const model = senderAgent.model ? ` model=${senderAgent.model}` : "";
85562
+ return ` | harness=${senderAgent.harness}${model}`;
85563
+ }
85564
+ function linearAttachments(message, options) {
85565
+ if (!message.attachments)
85566
+ return "";
85567
+ const block = renderDeliveryAttachmentsBlock(message.attachments, attachmentContext(options)).join(`
85568
+ `);
85569
+ return block ? `${block}
85570
+ ` : "";
85571
+ }
84606
85572
  function serializeLinearMessage(message, options) {
84607
85573
  const target = message.targetRole ? ` → ${message.targetRole}` : "";
84608
- const attachments = message.attachments ? renderDeliveryAttachmentsBlock(message.attachments, attachmentContext(options)).join(`
84609
- `) : "";
84610
- return `${new Date(message._creationTime).toISOString()} | ${message.senderRole}${target}
84611
- ${attachments ? `${attachments}
84612
- ` : ""}
85574
+ const typeTag = message.type === "plan" ? " | type=plan" : "";
85575
+ const header = `${new Date(message._creationTime).toISOString()} | ${message.senderRole}${target}${typeTag}${linearSenderAgentSuffix(message.senderAgent)}`;
85576
+ return `${header}
85577
+ ${linearAttachments(message, options)}
84613
85578
  ${message.content}`;
84614
85579
  }
84615
85580
  function serializeTaskOriginMessage(message) {
@@ -84698,7 +85663,8 @@ function toSerializableMessage(input) {
84698
85663
  type: input.type,
84699
85664
  content: input.content,
84700
85665
  ...attachments ? { attachments } : {},
84701
- ...normalizeTask(input) ? { task: normalizeTask(input) } : {}
85666
+ ...normalizeTask(input) ? { task: normalizeTask(input) } : {},
85667
+ ...input.senderAgent ? { senderAgent: input.senderAgent } : {}
84702
85668
  };
84703
85669
  }
84704
85670
 
@@ -84894,7 +85860,8 @@ var PAGE_SIZE = 50, SINCE_PAGE_SIZE = 500, ABSOLUTE_MAX = 5000, DEFAULT_LIMIT =
84894
85860
  file: file2,
84895
85861
  createdAt: new Date(msg._creationTime).toISOString(),
84896
85862
  senderRole: msg.senderRole,
84897
- targetRole: msg.targetRole
85863
+ targetRole: msg.targetRole,
85864
+ senderAgent: msg.senderAgent
84898
85865
  });
84899
85866
  }
84900
85867
  const manifest = {
@@ -85868,7 +86835,7 @@ async function runPromptFetchEffect(effect2, resourceLabel, deps) {
85868
86835
  const layer = promptFetchLayerFromDeps(d);
85869
86836
  await exports_Effect.runPromise(effect2.pipe(exports_Effect.catch((err2) => handlePromptFetchError(err2, resourceLabel)), exports_Effect.provide(layer)));
85870
86837
  }
85871
- var init_shared = __esm(() => {
86838
+ var init_shared2 = __esm(() => {
85872
86839
  init_dist();
85873
86840
  init_api3();
85874
86841
  init_storage();
@@ -85906,7 +86873,7 @@ var init_get_system_prompt = __esm(() => {
85906
86873
  init_dist();
85907
86874
  init_api3();
85908
86875
  init_services();
85909
- init_shared();
86876
+ init_shared2();
85910
86877
  });
85911
86878
 
85912
86879
  // src/commands/get-role-guidance/index.ts
@@ -85939,7 +86906,7 @@ var init_get_role_guidance = __esm(() => {
85939
86906
  init_dist();
85940
86907
  init_api3();
85941
86908
  init_services();
85942
- init_shared();
86909
+ init_shared2();
85943
86910
  });
85944
86911
 
85945
86912
  // src/commands/integrations/index.ts
@@ -88907,32 +89874,32 @@ function parseGitPorcelainZ(stdout) {
88907
89874
  }
88908
89875
  return entries;
88909
89876
  }
88910
- function splitV2Record(record2, fieldsBeforePath) {
89877
+ function splitV2Record(record3, fieldsBeforePath) {
88911
89878
  const fields = [];
88912
89879
  let cursor = 0;
88913
89880
  for (let n = 0;n < fieldsBeforePath; n++) {
88914
- const space = record2.indexOf(" ", cursor);
89881
+ const space = record3.indexOf(" ", cursor);
88915
89882
  if (space === -1)
88916
89883
  return { fields, path: "" };
88917
- fields.push(record2.slice(cursor, space));
89884
+ fields.push(record3.slice(cursor, space));
88918
89885
  cursor = space + 1;
88919
89886
  }
88920
- return { fields, path: record2.slice(cursor).replace(/\\/g, "/") };
89887
+ return { fields, path: record3.slice(cursor).replace(/\\/g, "/") };
88921
89888
  }
88922
- function parseV2Entry(record2) {
88923
- const type = record2.charAt(0);
89889
+ function parseV2Entry(record3) {
89890
+ const type = record3.charAt(0);
88924
89891
  if (type === "?") {
88925
- const { path: path5 } = splitV2Record(record2, 1);
89892
+ const { path: path5 } = splitV2Record(record3, 1);
88926
89893
  return path5 ? { xy: "??", path: path5 } : null;
88927
89894
  }
88928
89895
  const fieldsBeforePath = V2_FIELDS_BEFORE_PATH[type];
88929
89896
  if (fieldsBeforePath === undefined)
88930
89897
  return null;
88931
- const { fields, path: path4 } = splitV2Record(record2, fieldsBeforePath);
89898
+ const { fields, path: path4 } = splitV2Record(record3, fieldsBeforePath);
88932
89899
  return path4 ? { xy: (fields[1] ?? "").replace(/\./g, " "), path: path4 } : null;
88933
89900
  }
88934
- function applyBranchHeader(branch, record2) {
88935
- const [key = "", ...valueParts] = record2.slice(2).split(" ");
89901
+ function applyBranchHeader(branch, record3) {
89902
+ const [key = "", ...valueParts] = record3.slice(2).split(" ");
88936
89903
  const value2 = valueParts.join(" ");
88937
89904
  switch (key) {
88938
89905
  case "branch.oid":
@@ -88959,18 +89926,18 @@ function parseGitPorcelainV2Z(stdout) {
88959
89926
  const entries = [];
88960
89927
  const records = stdout.split("\x00");
88961
89928
  for (let i3 = 0;i3 < records.length; i3++) {
88962
- const record2 = records[i3] ?? "";
88963
- if (record2.startsWith("# ")) {
88964
- applyBranchHeader(branch, record2);
88965
- } else if (record2.startsWith("2 ")) {
89929
+ const record3 = records[i3] ?? "";
89930
+ if (record3.startsWith("# ")) {
89931
+ applyBranchHeader(branch, record3);
89932
+ } else if (record3.startsWith("2 ")) {
88966
89933
  const origin = records[i3 + 1] ?? "";
88967
89934
  i3++;
88968
- const renamed = parseV2Entry(record2);
89935
+ const renamed = parseV2Entry(record3);
88969
89936
  if (renamed) {
88970
89937
  entries.push({ xy: renamed.xy, path: renamed.path, fromPath: origin.replace(/\\/g, "/") });
88971
89938
  }
88972
89939
  } else {
88973
- const entry = parseV2Entry(record2);
89940
+ const entry = parseV2Entry(record3);
88974
89941
  if (entry)
88975
89942
  entries.push(entry);
88976
89943
  }
@@ -91672,7 +92639,7 @@ var init_select_strategy = __esm(() => {
91672
92639
  });
91673
92640
 
91674
92641
  // ../../services/backend/src/domain/workspace-file-tree/registry.ts
91675
- var init_registry4 = __esm(() => {
92642
+ var init_registry5 = __esm(() => {
91676
92643
  init_select_strategy();
91677
92644
  });
91678
92645
  // ../../services/backend/src/domain/workspace-file-tree/transport/blob-snapshot.ts
@@ -91694,7 +92661,7 @@ var init_transport2 = () => {};
91694
92661
  var init_workspace_file_tree = __esm(() => {
91695
92662
  init_types2();
91696
92663
  init_select_strategy();
91697
- init_registry4();
92664
+ init_registry5();
91698
92665
  init_transport2();
91699
92666
  });
91700
92667
 
@@ -94182,8 +95149,8 @@ async function getRecentCommits(workingDir, count = 20, skip = 0) {
94182
95149
  if (!output)
94183
95150
  return [];
94184
95151
  const commits = [];
94185
- for (const record2 of output.split("\x1E")) {
94186
- const trimmed = record2.trim();
95152
+ for (const record3 of output.split("\x1E")) {
95153
+ const trimmed = record3.trim();
94187
95154
  if (!trimmed)
94188
95155
  continue;
94189
95156
  const parts3 = trimmed.split("\x1F");
@@ -119693,8 +120660,9 @@ function createCliGatewayService(deps) {
119693
120660
  return {
119694
120661
  handoff: async (args2) => {
119695
120662
  writeLog(`request handoff chatroom=${args2.chatroomId} role=${args2.senderRole}`);
120663
+ const senderAgent = captureSenderAgent(deps, args2, writeLog);
119696
120664
  const taskIdsBeforeCommit = getActiveTaskIdsForRole(deps, args2);
119697
- const result3 = await commitHandoffMutation(deps, args2, writeLog);
120665
+ const result3 = await commitHandoffMutation(deps, withDaemonSenderAgent(args2, senderAgent), writeLog);
119698
120666
  writeLog(`backend result success=${result3.success}`);
119699
120667
  if (result3.success) {
119700
120668
  await syncTaskServiceAfterHandoff(deps, args2, result3, taskIdsBeforeCommit, writeLog);
@@ -119704,15 +120672,55 @@ function createCliGatewayService(deps) {
119704
120672
  debugState: () => ({ port: deps.port, logs: [...logs2] })
119705
120673
  };
119706
120674
  }
120675
+ function snapshotSenderAgent(slot) {
120676
+ if (!slot?.harness)
120677
+ return;
120678
+ return slot.model ? { harness: slot.harness, model: slot.model } : { harness: slot.harness };
120679
+ }
120680
+ function captureSenderAgent(deps, args2, writeLog) {
120681
+ try {
120682
+ return deps.resolveSenderAgent(args2.chatroomId, args2.senderRole);
120683
+ } catch (error51) {
120684
+ writeLog(`sender-agent unavailable chatroom=${args2.chatroomId} role=${args2.senderRole} error=${error51 instanceof Error ? error51.message : String(error51)}`);
120685
+ return;
120686
+ }
120687
+ }
120688
+ function withDaemonSenderAgent(args2, senderAgent) {
120689
+ const { senderAgent: _clientSupplied, ...trusted } = args2;
120690
+ return senderAgent ? { ...trusted, senderAgent } : trusted;
120691
+ }
119707
120692
  function getActiveTaskIdsForRole(deps, args2) {
119708
120693
  return deps.taskService.listTasksForRole?.(args2.chatroomId, args2.senderRole).filter((task) => task.status === "acknowledged" || task.status === "in_progress").map((task) => task.taskId) ?? [];
119709
120694
  }
120695
+ function errorMessage4(error51) {
120696
+ return error51 instanceof Error ? error51.message : String(error51);
120697
+ }
120698
+ function isUnknownSenderAgentArgError(error51) {
120699
+ const message = errorMessage4(error51);
120700
+ return message.includes("senderAgent") && /extra field|not in the validator|ArgumentValidationError/.test(message);
120701
+ }
120702
+ function shouldRetryWithoutSnapshot(args2, error51) {
120703
+ return Boolean(args2.senderAgent) && isUnknownSenderAgentArgError(error51);
120704
+ }
120705
+ async function retryHandoffWithoutSnapshot(deps, args2, firstError, writeLog) {
120706
+ writeLog(`sender-agent fallback chatroom=${args2.chatroomId} role=${args2.senderRole} error=${errorMessage4(firstError)}`);
120707
+ const { senderAgent: _snapshot, ...withoutSnapshot } = args2;
120708
+ try {
120709
+ return await deps.backend.mutation(api.messages.handoff, withoutSnapshot);
120710
+ } catch (retryError) {
120711
+ writeLog(`backend failure=${errorMessage4(retryError)}`);
120712
+ throw retryError;
120713
+ }
120714
+ }
119710
120715
  async function commitHandoffMutation(deps, args2, writeLog) {
119711
120716
  try {
119712
120717
  return await deps.backend.mutation(api.messages.handoff, args2);
119713
120718
  } catch (error51) {
119714
- writeLog(`backend failure=${error51 instanceof Error ? error51.message : String(error51)}`);
119715
- throw error51;
120719
+ if (!shouldRetryWithoutSnapshot(args2, error51)) {
120720
+ writeLog(`backend failure=${errorMessage4(error51)}`);
120721
+ throw error51;
120722
+ }
120723
+ return await retryHandoffWithoutSnapshot(deps, args2, error51, writeLog);
119716
120724
  }
119717
120725
  }
119718
120726
  async function syncTaskServiceAfterHandoff(deps, args2, result3, taskIdsBeforeCommit, writeLog) {
@@ -119793,7 +120801,8 @@ async function startDaemon() {
119793
120801
  const cliGateway = createCliGatewayService({
119794
120802
  backend: init2.backend,
119795
120803
  port: localWebPort,
119796
- taskService: init2.taskService
120804
+ taskService: init2.taskService,
120805
+ resolveSenderAgent: (chatroomId, role) => snapshotSenderAgent(init2.agentProcessManager.getSlot(chatroomId, role))
119797
120806
  });
119798
120807
  const debugState = async (chatroomId) => {
119799
120808
  const persisted = await loadDaemonState(init2.machineId);
@@ -122214,6 +123223,46 @@ program2.command("notify-user").description("Send the user an update while you k
122214
123223
  message
122215
123224
  });
122216
123225
  });
123226
+ var planCommand = program2.command("plan").description("Publish and read agent-authored phased plans");
123227
+ 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 () => {
123228
+ const { printPlanViewTemplate: printPlanViewTemplate2 } = await Promise.resolve().then(() => (init_view_template5(), exports_view_template2));
123229
+ printPlanViewTemplate2();
123230
+ });
123231
+ 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) => {
123232
+ await maybeRequireAuth();
123233
+ const { decode: decode5 } = await Promise.resolve().then(() => exports_decode);
123234
+ const stdinContent = await readStdin();
123235
+ let message;
123236
+ try {
123237
+ const { PLAN_STDIN_DELIMITER: PLAN_STDIN_DELIMITER2, validateStdinHeredocBody: validateStdinHeredocBody2 } = await Promise.resolve().then(() => (init_stdin_heredoc(), exports_stdin_heredoc));
123238
+ const decoded = decode5(stdinContent, { singleParam: "message" });
123239
+ message = decoded.message;
123240
+ validateStdinHeredocBody2(message, PLAN_STDIN_DELIMITER2);
123241
+ } catch (err2) {
123242
+ console.error(`❌ Failed to decode stdin: ${err2.message}`);
123243
+ process.exit(1);
123244
+ }
123245
+ if (!message || message.trim().length === 0) {
123246
+ console.error("❌ Plan is empty");
123247
+ console.error(` Usage: chatroom plan publish --chatroom-id=<id> --role=<role> << 'CHATROOM_PLAN_END'`);
123248
+ process.exit(1);
123249
+ }
123250
+ const { publishPlan: publishPlan2 } = await Promise.resolve().then(() => (init_publish(), exports_publish));
123251
+ await publishPlan2(options.chatroomId, {
123252
+ role: options.role,
123253
+ content: message,
123254
+ ...options.supersedes ? { supersedesPlanId: options.supersedes } : {}
123255
+ });
123256
+ });
123257
+ planCommand.command("read").description("Read a published plan, or one phase of it").requiredOption("--chatroom-id <id>", "Chatroom identifier").option("--role <role>", "Accepted for compatibility; reading a plan does not need it").requiredOption("--plan-id <id>", "Plan message id (from plan publish)").option("--phase <id>", "Phase id to project (e.g. P2)").action(async (options) => {
123258
+ await maybeRequireAuth();
123259
+ const { readPlan: readPlan2 } = await Promise.resolve().then(() => (init_read(), exports_read));
123260
+ await readPlan2(options.chatroomId, {
123261
+ role: options.role,
123262
+ planId: options.planId,
123263
+ ...options.phase ? { phase: options.phase } : {}
123264
+ });
123265
+ });
122217
123266
  var agenticQueryCommand = program2.command("agentic-query").description("Agentic search/ask query commands");
122218
123267
  agenticQueryCommand.command("complete").description("Submit the structured agentic query result markdown").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--query-id <id>", "Agentic query identifier").action(async (options) => {
122219
123268
  await maybeRequireAuth();
@@ -122343,7 +123392,7 @@ backlogCommand.command("import").description("Import backlog items from a JSON e
122343
123392
  var taskCommand = program2.command("task").description("Manage tasks");
122344
123393
  taskCommand.command("read").description("Read task details (optional recovery; harness output marks tasks in_progress)").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role in the chatroom").requiredOption("--task-id <taskId>", "Task ID to read").action(async (options) => {
122345
123394
  await maybeRequireAuth();
122346
- const { taskRead: taskRead2 } = await Promise.resolve().then(() => (init_read(), exports_read));
123395
+ const { taskRead: taskRead2 } = await Promise.resolve().then(() => (init_read2(), exports_read2));
122347
123396
  await taskRead2(options.chatroomId, { role: options.role, taskId: options.taskId });
122348
123397
  });
122349
123398
  var skillCommand = program2.command("skill").description("Manage and activate chatroom skills");
@@ -122601,4 +123650,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
122601
123650
  });
122602
123651
  program2.parse();
122603
123652
 
122604
- //# debugId=8C1E044B14005E3964756E2164756E21
123653
+ //# debugId=31A28C453A0672B464756E2164756E21