@oyasmi/pipiclaw 0.9.3-beta.4 → 0.9.3-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.en.md +12 -12
  2. package/README.md +12 -12
  3. package/dist/agent/channel-runner.d.ts +4 -8
  4. package/dist/agent/channel-runner.js +15 -35
  5. package/dist/agent/job-manager.d.ts +12 -0
  6. package/dist/agent/job-manager.js +43 -3
  7. package/dist/agent/prompt/sections.js +2 -2
  8. package/dist/agent/runner-factory.d.ts +2 -2
  9. package/dist/agent/types.d.ts +11 -7
  10. package/dist/channel/channel-context.d.ts +2 -2
  11. package/dist/channel/channel-context.js +2 -2
  12. package/dist/channel/channel-event.d.ts +3 -3
  13. package/dist/channel/project-scope-store.d.ts +20 -0
  14. package/dist/channel/project-scope-store.js +22 -7
  15. package/dist/commands/catalog.js +6 -12
  16. package/dist/events/event-commands.js +2 -2
  17. package/dist/events/events.d.ts +51 -30
  18. package/dist/events/events.js +70 -98
  19. package/dist/memory/journal.d.ts +2 -3
  20. package/dist/memory/journal.js +2 -3
  21. package/dist/memory/maintenance-tuning.d.ts +0 -1
  22. package/dist/memory/maintenance-tuning.js +0 -1
  23. package/dist/memory/scheduler.js +8 -16
  24. package/dist/memory/search.js +2 -3
  25. package/dist/memory/session-search.js +3 -9
  26. package/dist/memory/store.d.ts +1 -1
  27. package/dist/memory/store.js +9 -1
  28. package/dist/memory/task-digest.js +10 -11
  29. package/dist/memory/tombstones.js +2 -4
  30. package/dist/models/provider-login.d.ts +1 -1
  31. package/dist/models/provider-login.js +1 -1
  32. package/dist/playbooks/agent-delegation.md +18 -14
  33. package/dist/playbooks/background-jobs.md +2 -2
  34. package/dist/playbooks/event-scheduling.md +22 -13
  35. package/dist/playbooks/memory-and-learning.md +2 -2
  36. package/dist/playbooks/outbound-media.md +1 -1
  37. package/dist/playbooks/runtime-orientation.md +5 -3
  38. package/dist/playbooks/task-lead.md +82 -0
  39. package/dist/runtime/bootstrap.js +107 -196
  40. package/dist/runtime/delivery.d.ts +1 -2
  41. package/dist/runtime/delivery.js +57 -62
  42. package/dist/runtime/dingtalk.d.ts +15 -8
  43. package/dist/runtime/dingtalk.js +101 -35
  44. package/dist/runtime/durable-dispatch.js +30 -3
  45. package/dist/runtime/report-commands.d.ts +30 -0
  46. package/dist/runtime/report-commands.js +71 -0
  47. package/dist/runtime/subagent-commands.js +1 -1
  48. package/dist/runtime/task-commands.d.ts +0 -8
  49. package/dist/runtime/task-commands.js +48 -85
  50. package/dist/runtime/task-driver.d.ts +13 -9
  51. package/dist/runtime/task-driver.js +34 -39
  52. package/dist/runtime/task-migration.d.ts +18 -29
  53. package/dist/runtime/task-migration.js +195 -183
  54. package/dist/runtime/task-spawn.d.ts +24 -0
  55. package/dist/runtime/task-spawn.js +49 -0
  56. package/dist/runtime/task-wake.d.ts +33 -46
  57. package/dist/runtime/task-wake.js +15 -90
  58. package/dist/security/network.js +44 -9
  59. package/dist/settings.d.ts +1 -8
  60. package/dist/settings.js +1 -8
  61. package/dist/subagents/discovery.js +7 -17
  62. package/dist/subagents/external/claude-code.js +3 -1
  63. package/dist/subagents/external/harness.d.ts +4 -2
  64. package/dist/subagents/external/run.d.ts +3 -1
  65. package/dist/subagents/external/run.js +14 -23
  66. package/dist/subagents/external/settlement.d.ts +4 -16
  67. package/dist/subagents/external/settlement.js +16 -67
  68. package/dist/subagents/runs.d.ts +15 -29
  69. package/dist/subagents/runs.js +71 -160
  70. package/dist/subagents/tool.d.ts +20 -4
  71. package/dist/subagents/tool.js +63 -87
  72. package/dist/subagents/verification-outcome.d.ts +13 -19
  73. package/dist/subagents/verification-outcome.js +8 -22
  74. package/dist/subagents/workspace-summary.d.ts +8 -0
  75. package/dist/subagents/workspace-summary.js +29 -0
  76. package/dist/tasks/board.d.ts +43 -0
  77. package/dist/tasks/board.js +134 -0
  78. package/dist/tasks/brief.d.ts +10 -5
  79. package/dist/tasks/brief.js +78 -26
  80. package/dist/tasks/budget.d.ts +13 -14
  81. package/dist/tasks/budget.js +21 -40
  82. package/dist/tasks/contract-input.d.ts +19 -0
  83. package/dist/tasks/contract-input.js +55 -0
  84. package/dist/tasks/create.d.ts +17 -0
  85. package/dist/tasks/create.js +36 -0
  86. package/dist/tasks/frontmatter.d.ts +20 -27
  87. package/dist/tasks/frontmatter.js +18 -31
  88. package/dist/tasks/ledger.d.ts +61 -117
  89. package/dist/tasks/ledger.js +78 -223
  90. package/dist/tasks/log.d.ts +62 -35
  91. package/dist/tasks/log.js +51 -29
  92. package/dist/tasks/session-path.d.ts +3 -3
  93. package/dist/tasks/session-path.js +4 -5
  94. package/dist/tasks/store.d.ts +11 -29
  95. package/dist/tasks/store.js +39 -83
  96. package/dist/tasks/ticket.d.ts +33 -66
  97. package/dist/tasks/ticket.js +31 -120
  98. package/dist/tasks/work-log.d.ts +20 -0
  99. package/dist/tasks/work-log.js +42 -0
  100. package/dist/tools/bash.d.ts +1 -1
  101. package/dist/tools/bash.js +1 -1
  102. package/dist/tools/event-manage.d.ts +16 -2
  103. package/dist/tools/event-manage.js +30 -12
  104. package/dist/tools/index.d.ts +5 -3
  105. package/dist/tools/index.js +5 -5
  106. package/dist/tools/registry.d.ts +6 -4
  107. package/dist/tools/registry.js +1 -4
  108. package/dist/tools/subagent-manage.js +4 -2
  109. package/dist/tools/task-manage/create.js +11 -27
  110. package/dist/tools/task-manage/lifecycle.d.ts +6 -7
  111. package/dist/tools/task-manage/lifecycle.js +23 -106
  112. package/dist/tools/task-manage/log-view.d.ts +3 -2
  113. package/dist/tools/task-manage/log-view.js +6 -6
  114. package/dist/tools/task-manage/schema.d.ts +10 -30
  115. package/dist/tools/task-manage/schema.js +33 -49
  116. package/dist/tools/task-manage/shared.d.ts +35 -42
  117. package/dist/tools/task-manage/shared.js +53 -192
  118. package/dist/tools/task-manage/step-end.d.ts +6 -6
  119. package/dist/tools/task-manage/step-end.js +61 -98
  120. package/dist/tools/task-manage/types.d.ts +8 -9
  121. package/dist/tools/task-manage.js +5 -5
  122. package/dist/tui/app.js +11 -38
  123. package/dist/tui/commands.d.ts +18 -8
  124. package/dist/tui/commands.js +2 -9
  125. package/dist/tui/turn-controller.d.ts +2 -14
  126. package/dist/tui/turn-controller.js +1 -17
  127. package/dist/web/client.js +9 -1
  128. package/examples/sub-agents/README.md +67 -80
  129. package/examples/sub-agents/agents/claude-high.md +23 -0
  130. package/examples/sub-agents/agents/claude-main.md +23 -0
  131. package/examples/sub-agents/agents/codex-flash.md +23 -0
  132. package/examples/sub-agents/agents/codex-high.md +23 -0
  133. package/examples/sub-agents/agents/codex-main.md +23 -0
  134. package/examples/sub-agents/agents/codex-review.md +23 -0
  135. package/examples/sub-agents/agents/glm-flash.md +23 -0
  136. package/examples/sub-agents/agents/glm-high.md +23 -0
  137. package/examples/sub-agents/{verifier.md → roles/verifier.md} +1 -1
  138. package/package.json +1 -1
  139. package/dist/memory/maintenance-migration.d.ts +0 -5
  140. package/dist/memory/maintenance-migration.js +0 -91
  141. package/dist/memory/migrate.d.ts +0 -15
  142. package/dist/memory/migrate.js +0 -364
  143. package/dist/playbooks/task-loop.md +0 -90
  144. package/dist/tasks/artifact-subject.d.ts +0 -40
  145. package/dist/tasks/artifact-subject.js +0 -334
  146. package/dist/tasks/cycle.d.ts +0 -48
  147. package/dist/tasks/cycle.js +0 -94
  148. package/dist/tasks/rounds.d.ts +0 -41
  149. package/dist/tasks/rounds.js +0 -53
  150. package/dist/tasks/task-events.d.ts +0 -6
  151. package/dist/tasks/task-events.js +0 -14
  152. package/dist/tasks/task-schedule.d.ts +0 -18
  153. package/dist/tasks/task-schedule.js +0 -50
  154. package/dist/tasks/verification.d.ts +0 -114
  155. package/dist/tasks/verification.js +0 -226
  156. /package/examples/sub-agents/{builder-hard.md → roles/builder-hard.md} +0 -0
  157. /package/examples/sub-agents/{builder.md → roles/builder.md} +0 -0
  158. /package/examples/sub-agents/{explorer.md → roles/explorer.md} +0 -0
  159. /package/examples/sub-agents/{git-committer.md → roles/git-committer.md} +0 -0
  160. /package/examples/sub-agents/{planner.md → roles/planner.md} +0 -0
  161. /package/examples/sub-agents/{reviewer.md → roles/reviewer.md} +0 -0
  162. /package/examples/sub-agents/{worker.md → roles/worker.md} +0 -0
package/README.en.md CHANGED
@@ -18,11 +18,11 @@ What you see is one assistant, but behind it can be a well-divided AI engineerin
18
18
 
19
19
  Pipiclaw supports two kinds of delegation at once: built-in sub-agents do lightweight work in-process such as retrieval and log triage; external agents launch real Claude Code, Codex CLI, or any script to handle heavy tasks that need long runs, many files, and repeated self-testing.
20
20
 
21
- In DingTalk daemon mode, external tasks keep running in the background after dispatch and automatically wake the originating channel on completion. You can use `/subagents` at any time to check run status, the actual command, and outputs, use `/subagents cancel` to terminate directly, and let the main agent keep asking follow-up questions on a finished Claude Code / Codex session. The repo ships explorer, builder, reviewer, verifier, and git-committer role templates that are ready to adapt.
21
+ In DingTalk daemon mode, external tasks keep running in the background after dispatch and automatically wake the originating channel on completion. You can use `/subagents` at any time to check run status, the actual command, and outputs, use `/subagents cancel` to terminate directly, and let the main agent keep asking follow-up questions on a finished Claude Code / Codex session. The repo ships recommended capability-and-cost entries plus earlier job-style role templates for reference.
22
22
 
23
23
  ### Work does not end when a conversation ends
24
24
 
25
- Every session has its own current state, long-term memory, and history summary. The task ledger persists goals, done criteria, progress, next steps, and verification records to Markdown files; the built-in task driver resumes work at the right time — continuing when there is progress, backing off when stalled, and stopping and telling you when a boundary is crossed.
25
+ Every channel has its own persistent conversation, long-term memory index, and daily journal. The task ledger stores goals, done criteria, and plans in Markdown contracts, with steps and verification records in JSONL loop logs; the built-in task driver resumes work from waiting tickets and schedules, and stops with a notice when a budget, idle-loop, or repeated-expiry boundary is reached.
26
26
 
27
27
  ### Natively at home in DingTalk
28
28
 
@@ -50,7 +50,7 @@ Pipiclaw today targets individuals and small teams, self-hosted, single-instance
50
50
 
51
51
  ## Quick start
52
52
 
53
- Below are three progressive paths: verify a model in the terminal first, then connect DingTalk, then enable external agents. If you already have a clear goal, jump straight to the relevant part.
53
+ The steps below cover local verification, DingTalk setup, and external-agent configuration in order. If you already have a clear goal, jump straight to the relevant part.
54
54
 
55
55
  ### 1. Install and confirm the CLI
56
56
 
@@ -95,10 +95,10 @@ pipiclaw tui
95
95
  It can also be used for scripted one-shot requests:
96
96
 
97
97
  ```bash
98
- pipiclaw tui --print "Review the current project and give me the three highest-priority risks"
98
+ pipiclaw tui --print "Reply with only: Pipiclaw model call succeeded"
99
99
  ```
100
100
 
101
- To connect an enterprise gateway, a local model, or set a default model, see [Configuration reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md).
101
+ Only an actual model reply proves that the request path works; `pipiclaw tui --help` and `/model` only prove that the CLI or model catalog is visible. Before real work, use `/project` to confirm the current project directory. To connect an enterprise gateway, a local model, or set a default model, see [Configuration reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md).
102
102
 
103
103
  ### 3. Connect DingTalk
104
104
 
@@ -134,7 +134,7 @@ Start the daemon:
134
134
  pipiclaw
135
135
  ```
136
136
 
137
- In DingTalk, send `/model` first to confirm the model is available, then send:
137
+ In DingTalk, send `/model` to inspect the model reference, then send a normal message to verify a real call:
138
138
 
139
139
  ```text
140
140
  Please introduce yourself and explain what you can do right now
@@ -144,12 +144,12 @@ If the first message does not succeed, start from [Deployment and operations](ht
144
144
 
145
145
  ### 4. Enable external agent delegation
146
146
 
147
- First install and log in to the target CLI under the same account that runs Pipiclaw, then copy the roles you need. The example below enables both a Claude Code builder and a Codex reviewer:
147
+ First install and log in to the target CLI under the same account that runs Pipiclaw, then copy the capability entries you need. This enables the main Claude Code and Codex entries:
148
148
 
149
149
  ```bash
150
150
  mkdir -p ~/.pipiclaw/workspace/sub-agents
151
151
  PIPICLAW_PACKAGE_DIR="$(npm root -g)/@oyasmi/pipiclaw"
152
- cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/{builder,reviewer}.md \
152
+ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.md \
153
153
  ~/.pipiclaw/workspace/sub-agents/
154
154
  ```
155
155
 
@@ -159,10 +159,10 @@ Role file changes are rediscovered at runtime. Send:
159
159
  /subagents roles
160
160
  ```
161
161
 
162
- Once the roles show as available, you can describe a goal and name a role directly:
162
+ Once the entries show as available, describe the goal and acceptance criteria and let the main agent select an executor:
163
163
 
164
164
  ```text
165
- Please hand this cross-module implementation to the builder, and once it's done have the reviewer check it independently.
165
+ Please hand this cross-module implementation to a suitable executor, then independently check the final changes.
166
166
  ```
167
167
 
168
168
  Common control entry points:
@@ -175,7 +175,7 @@ Common control entry points:
175
175
  /subagents roles [name] # view the role directory and a single role's config
176
176
  ```
177
177
 
178
- External agents do not go through Pipiclaw's command and path guards. Before using the example roles, read the authorization, security boundary, and sandbox notes in the [Agent delegation guide](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md).
178
+ External agents do not go through Pipiclaw's command and path guards. The recommended entries above use permissive CLI flags; before using them, read the authorization, security boundary, and sandbox notes in the [Agent delegation guide](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md).
179
179
 
180
180
  Long-running external delegations should run in the DingTalk daemon; the TUI currently does not provide completion notifications for external runs or re-adoption after exit.
181
181
 
@@ -243,7 +243,7 @@ npm run build
243
243
  npm run check # lint + typecheck + deadcode + test
244
244
  ```
245
245
 
246
- Minimal verification: `npm run typecheck` and `npm run test`. Real-model E2E uses `npm run test:e2e` and is not part of the daily unit tests.
246
+ Minimal verification: `npm run typecheck` and `npm run test`. `npm run test:e2e` is deterministic, offline, and credential-free; the small real-model smoke suite uses `npm run test:e2e:live`.
247
247
 
248
248
  ## License
249
249
 
package/README.md CHANGED
@@ -18,11 +18,11 @@ Pipiclaw 是一个面向个人和团队的 AI coding assistant runtime。它让
18
18
 
19
19
  Pipiclaw 同时支持两类委派:内置子智能体在进程内完成检索、日志筛查等轻量工作;外部智能体则启动真实的 Claude Code、Codex CLI 或任意脚本,处理需要长时间运行、跨多个文件和反复自测的重型任务。
20
20
 
21
- 在钉钉常驻模式中,外部任务派发后在后台继续执行,完成时自动唤醒原频道。你可以随时用 `/subagents` 查看运行状态、实际命令和产出,用 `/subagents cancel` 直接终止,也可以让主智能体在已结束的 Claude Code / Codex 会话上继续追问。仓库附带 explorer、builder、reviewer、verifier、git-committer 等可直接改造的角色模板。
21
+ 在钉钉常驻模式中,外部任务派发后在后台继续执行,完成时自动唤醒原频道。你可以随时用 `/subagents` 查看运行状态、实际命令和产出,用 `/subagents cancel` 直接终止,也可以让主智能体在已结束的 Claude Code / Codex 会话上继续追问。仓库附带按能力与成本组织的推荐条目,以及可参考的早期岗位角色模板。
22
22
 
23
23
  ### 工作不会随着一次对话结束
24
24
 
25
- 每个会话都有独立的当前状态、长期记忆和历史摘要。任务台账把目标、完成标准、进度、下一步和验收记录持久化到 Markdown 文件;内建 task driver 会在合适的时间恢复工作,有进展就继续,停滞则退避,超过边界就停止并告诉你。
25
+ 每个频道都有独立的持久会话、长期记忆索引和按天日志。任务台账用 Markdown 保存目标、完成标准和计划,用 JSONL 循环日志记录步骤与验收;内建 task driver 根据等待票和周期调度恢复工作,预算耗尽、空转或连续无法兑现等待时会停止并告诉你。
26
26
 
27
27
  ### 原生工作在钉钉里
28
28
 
@@ -50,7 +50,7 @@ Pipiclaw 当前定位是个人与小团队、自托管、单实例运行。它
50
50
 
51
51
  ## 快速开始
52
52
 
53
- 下面提供三条递进路径:先在终端验证模型,再接入钉钉,最后启用外部智能体。已经有明确目标时可以直接跳到对应部分。
53
+ 下面按顺序完成本地验证、钉钉接入和外部智能体配置;已经有明确目标时可以直接跳到对应部分。
54
54
 
55
55
  ### 1. 安装并确认 CLI
56
56
 
@@ -95,10 +95,10 @@ pipiclaw tui
95
95
  也可以用于脚本化的一次性请求:
96
96
 
97
97
  ```bash
98
- pipiclaw tui --print "检查当前项目并给出三个最高优先级风险"
98
+ pipiclaw tui --print "只回复:Pipiclaw 模型调用成功"
99
99
  ```
100
100
 
101
- 如需接入企业网关、本地模型或指定默认模型,请看[配置速查](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md)。
101
+ 看到模型实际回复才表示调用链路已经跑通;`pipiclaw tui --help` 或 `/model` 只能证明 CLI 或模型目录可见。正式工作前可用 `/project` 确认当前项目目录。如需接入企业网关、本地模型或指定默认模型,请看[配置速查](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md)。
102
102
 
103
103
  ### 3. 接入钉钉
104
104
 
@@ -134,7 +134,7 @@ pipiclaw tui --print "检查当前项目并给出三个最高优先级风险"
134
134
  pipiclaw
135
135
  ```
136
136
 
137
- 先在钉钉里发送 `/model`,确认模型可用,再发送:
137
+ 先在钉钉里发送 `/model` 检查模型引用,再发送一条普通消息验证真实调用:
138
138
 
139
139
  ```text
140
140
  请介绍一下你自己,并说明你现在能做什么
@@ -144,12 +144,12 @@ pipiclaw
144
144
 
145
145
  ### 4. 启用外部智能体委派
146
146
 
147
- 先在运行 Pipiclaw 的同一账号下安装并登录目标 CLI,然后复制需要的角色。下面的示例同时启用 Claude Code builder 和 Codex reviewer:
147
+ 先在运行 Pipiclaw 的同一账号下安装并登录目标 CLI,然后复制需要的能力条目。下面启用 Claude Code 与 Codex 的两个主力条目:
148
148
 
149
149
  ```bash
150
150
  mkdir -p ~/.pipiclaw/workspace/sub-agents
151
151
  PIPICLAW_PACKAGE_DIR="$(npm root -g)/@oyasmi/pipiclaw"
152
- cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/{builder,reviewer}.md \
152
+ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.md \
153
153
  ~/.pipiclaw/workspace/sub-agents/
154
154
  ```
155
155
 
@@ -159,10 +159,10 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/{builder,reviewer}.md \
159
159
  /subagents roles
160
160
  ```
161
161
 
162
- 确认角色显示为可用后,可以直接描述目标并指定角色:
162
+ 确认条目显示为可用后,直接描述目标和验收要求,由主智能体选择执行器:
163
163
 
164
164
  ```text
165
- 请把这个跨模块实现交给 builder 完成,完成后再让 reviewer 独立检查。
165
+ 请把这个跨模块实现交给合适的执行器,完成后独立检查最终改动。
166
166
  ```
167
167
 
168
168
  常用控制入口:
@@ -175,7 +175,7 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/{builder,reviewer}.md \
175
175
  /subagents roles [name] # 查看角色目录和单个角色配置
176
176
  ```
177
177
 
178
- 外部智能体不会经过 Pipiclaw 的命令和路径守卫。使用示例角色前,请阅读[智能体委派指南](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md)中的授权、安全边界和 sandbox 说明。
178
+ 外部智能体不会经过 Pipiclaw 的命令和路径守卫。上述推荐条目使用放开权限的 CLI 参数;使用前必须阅读[智能体委派指南](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md)中的授权、安全边界和 sandbox 说明。
179
179
 
180
180
  长时间外部委派应运行在钉钉 daemon 中;TUI 当前不提供外部 run 的完成通知和退出后的重新认领。
181
181
 
@@ -243,7 +243,7 @@ npm run build
243
243
  npm run check # lint + typecheck + deadcode + test
244
244
  ```
245
245
 
246
- 最小验证:`npm run typecheck` 和 `npm run test`。真实模型 E2E 使用 `npm run test:e2e`,不包含在日常单元测试中。
246
+ 最小验证:`npm run typecheck` 和 `npm run test`。`npm run test:e2e` 是离线、无凭据的确定性全栈测试;少量真实模型 smoke 使用 `npm run test:e2e:live`。
247
247
 
248
248
  ## 许可证
249
249
 
@@ -217,9 +217,6 @@ export declare class ChannelRunner implements AgentRunner {
217
217
  private reloadSessionResources;
218
218
  private bindSessionExtensions;
219
219
  private ensureSessionReady;
220
- /** Spec 050 §5: migrate this channel's memory to v2 on first use, before any turn reads it. */
221
- private memoryMigrationChecked;
222
- private ensureMemoryMigrated;
223
220
  private maybeRunPreventiveCompactionForIncomingText;
224
221
  private refreshSubAgentDiscovery;
225
222
  private reportSettingsDiagnostics;
@@ -261,10 +258,10 @@ export declare class ChannelRunner implements AgentRunner {
261
258
  * Task work must not accumulate in the channel's chat transcript: the one real channel on the
262
259
  * author's machine had grown to 7.4 MB and been compacted six times because chat and two daily
263
260
  * tasks shared it, so every compaction damaged all three at once. Swapping the bound session
264
- * per turn gives each cycle its own bounded context while leaving turn state, `/stop`, and
261
+ * per turn gives each task its own bounded context while leaving turn state, `/stop`, and
265
262
  * delivery exactly where they already are.
266
263
  */
267
- bindTaskSession(taskId: string, cycleId: string): Promise<void>;
264
+ bindTaskSession(taskId: string): Promise<void>;
268
265
  /** Return to the channel's chat session after a task step. Safe to call when already bound. */
269
266
  bindChatSession(): Promise<void>;
270
267
  /**
@@ -286,7 +283,6 @@ export declare class ChannelRunner implements AgentRunner {
286
283
  /** Which task loop this runner is currently bound to, if any. */
287
284
  getTaskLoop(): {
288
285
  taskId: string;
289
- cycleId: string;
290
286
  } | undefined;
291
287
  private buildRuntimeTools;
292
288
  private rebuildSessionTools;
@@ -295,8 +291,8 @@ export declare class ChannelRunner implements AgentRunner {
295
291
  private buildTaskDigestForTurn;
296
292
  /**
297
293
  * Spec 050, D1: assemble `<memory_bootstrap>` for the first turn of a session — workspace
298
- * MEMORY.md (whole H2 sections, budgeted) + the channel index (full, or budget-tiered). The
299
- * journal subsection is added in P2.
294
+ * MEMORY.md (whole H2 sections, budgeted) + the channel index (full, or budget-tiered) +
295
+ * today's journal tail.
300
296
  */
301
297
  private buildFirstTurnMemoryBootstrap;
302
298
  }
@@ -13,7 +13,6 @@ import { buildChannelIndexForBootstrap, clipJournalTailForBootstrap, clipWorkspa
13
13
  import { readJournalDay } from "../memory/journal.js";
14
14
  import { MemoryLifecycle } from "../memory/lifecycle.js";
15
15
  import { createMemoryActivityRecorder, } from "../memory/maintenance-state.js";
16
- import { isChannelMigratedToV2, migrateChannelMemoryToV2 } from "../memory/migrate.js";
17
16
  import { hasMemoryBootstrapBlock, renderMemoryBootstrap } from "../memory/render.js";
18
17
  import { listMemoryEntries } from "../memory/store.js";
19
18
  import { buildTaskDigest, TASK_AGENDA_MAX_UNITS } from "../memory/task-digest.js";
@@ -28,7 +27,6 @@ import { errorMessage } from "../shared/text-utils.js";
28
27
  import { isRecord } from "../shared/type-guards.js";
29
28
  import { withTimeout } from "../shared/with-timeout.js";
30
29
  import { discoverSubAgents } from "../subagents/discovery.js";
31
- import { SubAgentRunManager } from "../subagents/runs.js";
32
30
  import { TASK_SESSIONS_DIRNAME, taskSessionPath } from "../tasks/session-path.js";
33
31
  import { loadToolsConfigWithDiagnostics } from "../tools/config.js";
34
32
  import { createPipiclawTools } from "../tools/index.js";
@@ -36,7 +34,6 @@ import { formatSize } from "../tools/truncate.js";
36
34
  import { getUsageLedger } from "../usage/ledger.js";
37
35
  import { createCommandExtension } from "./command-extension.js";
38
36
  import { estimateIncomingMessageTokens, getPreventiveCompactionDecision } from "./context-budget.js";
39
- import { ChannelJobManager } from "./job-manager.js";
40
37
  import { PRIMARY_COOLDOWN_MS, runPromptWithFallback, shouldRestorePrimary, } from "./model-fallback.js";
41
38
  import { clipUserInput, formatProgressEntry } from "./progress-formatter.js";
42
39
  import { buildPipiclawSystemPrompt } from "./prompt/builder.js";
@@ -113,8 +110,6 @@ export class ChannelRunner {
113
110
  this.primaryFailedAt = null;
114
111
  // --- Per run ---
115
112
  this.runState = createEmptyRunState();
116
- /** Spec 050 §5: migrate this channel's memory to v2 on first use, before any turn reads it. */
117
- this.memoryMigrationChecked = false;
118
113
  this.channelId = channelId;
119
114
  this.channelDir = channelDir;
120
115
  this.appHomeDir = paths.appHomeDir;
@@ -123,8 +118,8 @@ export class ChannelRunner {
123
118
  this.onSessionEvent = paths.onSessionEvent;
124
119
  this.mediaSender = paths.mediaSender;
125
120
  this.executor = deps.executor;
126
- this.jobManager = paths.jobManager ?? new ChannelJobManager(channelId, deps.executor);
127
- this.runManager = paths.runManager ?? new SubAgentRunManager(channelId, {});
121
+ this.jobManager = paths.jobManager;
122
+ this.runManager = paths.runManager;
128
123
  this.fileStore = deps.fileStore;
129
124
  this.loadSecurityConfig = deps.loadSecurityConfig;
130
125
  this.workspaceDir = resolve(dirname(channelDir));
@@ -235,7 +230,6 @@ export class ChannelRunner {
235
230
  let bootstrapPrepared = false;
236
231
  try {
237
232
  await this.ensureSessionReady();
238
- await this.ensureMemoryMigrated();
239
233
  await this.maybeRestorePrimaryModel();
240
234
  this.memoryLifecycle.noteUserTurnStarted();
241
235
  const normalizedInputLength = ctx.message.text.replace(/\r/g, "").trim().length;
@@ -260,8 +254,9 @@ export class ChannelRunner {
260
254
  // Settled into a result object rather than left as a bare promise: if the bootstrap
261
255
  // throws first we would otherwise leave a rejection unobserved, which Node's default
262
256
  // policy turns into a process exit. Rethrown at the await, so a digest failure still
263
- // fails the turn exactly as it did when this ran inline.
264
- const taskDigestPromise = (this.tasksEnabled ? this.buildTaskDigestForTurn() : Promise.resolve("")).then((text) => ({ text }), (error) => ({ error }));
257
+ // fails the turn exactly as it did when this ran inline. A task step gets none: its brief
258
+ // already carries its own task, and the channel's other tasks are noise there.
259
+ const taskDigestPromise = (this.tasksEnabled && !this.taskLoop ? this.buildTaskDigestForTurn() : Promise.resolve("")).then((text) => ({ text }), (error) => ({ error }));
265
260
  // Spec 050, D1: the memory index is injected in full on the first turn of a session
266
261
  // (and the first turn after compaction — see `subscribeToSessionEvents`), never per
267
262
  // turn. Mid-session, the model uses `memory_search` to look things up.
@@ -462,7 +457,7 @@ export class ChannelRunner {
462
457
  else if (isSilentOutcome(finalOutcome)) {
463
458
  try {
464
459
  await ctx.deleteMessage();
465
- log.logInfo("Silent response - deleted message");
460
+ log.logInfo("Silent response - ended progress delivery");
466
461
  }
467
462
  catch (err) {
468
463
  const errMsg = errorMessage(err);
@@ -1084,24 +1079,6 @@ export class ChannelRunner {
1084
1079
  async ensureSessionReady() {
1085
1080
  await this.sessionReady;
1086
1081
  }
1087
- async ensureMemoryMigrated() {
1088
- if (this.memoryMigrationChecked) {
1089
- return;
1090
- }
1091
- this.memoryMigrationChecked = true;
1092
- if (isChannelMigratedToV2(this.channelDir)) {
1093
- return;
1094
- }
1095
- try {
1096
- const result = await migrateChannelMemoryToV2(this.channelDir);
1097
- if (result.migrated) {
1098
- log.logInfo(`[${this.channelId}] Migrated channel memory to v2 (${result.entries} entries, ${result.journalDays} journal days)`);
1099
- }
1100
- }
1101
- catch (error) {
1102
- log.logWarning(`[${this.channelId}] Channel memory v2 migration failed`, errorMessage(error));
1103
- }
1104
- }
1105
1082
  async maybeRunPreventiveCompactionForIncomingText(incomingText, imageCount = 0) {
1106
1083
  const currentModel = this.session.model ?? this.activeModel;
1107
1084
  const contextUsage = this.session.getContextUsage();
@@ -1328,14 +1305,14 @@ export class ChannelRunner {
1328
1305
  * Task work must not accumulate in the channel's chat transcript: the one real channel on the
1329
1306
  * author's machine had grown to 7.4 MB and been compacted six times because chat and two daily
1330
1307
  * tasks shared it, so every compaction damaged all three at once. Swapping the bound session
1331
- * per turn gives each cycle its own bounded context while leaving turn state, `/stop`, and
1308
+ * per turn gives each task its own bounded context while leaving turn state, `/stop`, and
1332
1309
  * delivery exactly where they already are.
1333
1310
  */
1334
- async bindTaskSession(taskId, cycleId) {
1311
+ async bindTaskSession(taskId) {
1335
1312
  await this.sessionReady;
1336
- const path = taskSessionPath(this.channelDir, taskId, cycleId);
1313
+ const path = taskSessionPath(this.channelDir, taskId);
1337
1314
  await mkdir(dirname(path), { recursive: true });
1338
- this.taskLoop = { taskId, cycleId };
1315
+ this.taskLoop = { taskId };
1339
1316
  await this.sessionRuntime.switchSession(path);
1340
1317
  this.syncMemoryBootstrapPendingFromSession();
1341
1318
  }
@@ -1401,6 +1378,9 @@ export class ChannelRunner {
1401
1378
  mediaSender: this.mediaSender,
1402
1379
  taskLoop: this.taskLoop,
1403
1380
  getToolsUsed: () => this.runState.toolsUsed,
1381
+ // Assistant usage only: an internal sub-agent's cost is also in `totalUsage`, and a bound
1382
+ // one is already credited to the task when it settles.
1383
+ getStepCost: () => ({ usd: this.runState.assistantUsage.cost.total, estimated: !this.runState.costKnown }),
1404
1384
  });
1405
1385
  this.currentTools = tools;
1406
1386
  // Tool schemas are billed with the system prompt and, unlike it, nothing trims them.
@@ -1477,8 +1457,8 @@ export class ChannelRunner {
1477
1457
  }
1478
1458
  /**
1479
1459
  * Spec 050, D1: assemble `<memory_bootstrap>` for the first turn of a session — workspace
1480
- * MEMORY.md (whole H2 sections, budgeted) + the channel index (full, or budget-tiered). The
1481
- * journal subsection is added in P2.
1460
+ * MEMORY.md (whole H2 sections, budgeted) + the channel index (full, or budget-tiered) +
1461
+ * today's journal tail.
1482
1462
  */
1483
1463
  async buildFirstTurnMemoryBootstrap() {
1484
1464
  const readOptionalFile = async (path) => {
@@ -26,6 +26,8 @@ export interface JobSnapshot {
26
26
  startedAt: number;
27
27
  durationMs: number;
28
28
  exitCode?: number;
29
+ /** The job's own wall-clock limit; a task's `work` ticket derives its backstop from it. */
30
+ timeoutSeconds: number;
29
31
  /** The task this job's completion wake belongs to, if any — lets a caller verify that a
30
32
  * `[JOB:<id>] ... belongs to task <taskId>.` wake actually names the job it claims to (T9). */
31
33
  taskId?: string;
@@ -55,6 +57,8 @@ interface JobRecord extends JobSnapshot {
55
57
  finishedAt?: number;
56
58
  /** Set once the completion wake has been dispatched, so a restart cannot re-announce it. */
57
59
  notified?: boolean;
60
+ /** Set once the owning task's log has this job's settlement (spec 052, D4); guards against a second record. */
61
+ taskLogged?: boolean;
58
62
  /**
59
63
  * A cancel or timeout whose kill could not be *confirmed* yet: the job stays `running` and
60
64
  * manageable, and every sweep re-attempts the kill until the process is proven gone, at which
@@ -80,6 +84,8 @@ export interface JobManagerOptions {
80
84
  /** Directory the full-output spill (and its `.exit`/`.ready`/`.meta` siblings) is written to.
81
85
  * Defaults to the OS temp dir; the runtime passes `<channelDir>/logs` so the model can read it. */
82
86
  spillDir?: string;
87
+ /** This channel's directory, where a task-bound job logs its dispatch and settlement (spec 052, D4). */
88
+ channelDir?: string;
83
89
  }
84
90
  /** Cap on concurrently running jobs per channel, so a runaway model can't spawn unbounded processes. */
85
91
  export declare const MAX_RUNNING_JOBS = 5;
@@ -198,6 +204,12 @@ export declare class ChannelJobManager {
198
204
  private applyProbe;
199
205
  /** Move a job to a terminal status: record it, persist it, and wake the channel once. */
200
206
  private finish;
207
+ /**
208
+ * Tell the owning task this job settled (spec 052, D4). Runs before the completion wake is
209
+ * dispatched, so the step the wake starts already finds the result on its board. Best-effort and
210
+ * once-only: a task that no longer exists, or a replayed finish, writes nothing.
211
+ */
212
+ private logSettlementToTask;
201
213
  /**
202
214
  * Wake the channel for a finished job. `dispatch()` durably persists its own pending record
203
215
  * (and is idempotent on dispatch id) before this call can be interrupted, so it is safe to call
@@ -11,6 +11,7 @@ import { createSerialQueue } from "../shared/serial-queue.js";
11
11
  import { errorMessage } from "../shared/text-utils.js";
12
12
  import { isRecord } from "../shared/type-guards.js";
13
13
  import { beginWakeClaim, finishWakeClaim } from "../shared/wake-claim.js";
14
+ import { logTaskDispatch, logTaskSettlement } from "../tasks/work-log.js";
14
15
  function jobArtifacts(spillFile) {
15
16
  return {
16
17
  spillFile,
@@ -193,6 +194,7 @@ function toSnapshot(record) {
193
194
  startedAt: record.startedAt,
194
195
  durationMs: record.status === "running" ? Date.now() - record.startedAt : record.durationMs,
195
196
  exitCode: record.exitCode,
197
+ timeoutSeconds: record.timeoutSeconds,
196
198
  taskId: record.contract.taskId,
197
199
  };
198
200
  }
@@ -408,6 +410,15 @@ export class ChannelJobManager {
408
410
  });
409
411
  throw failure;
410
412
  }
413
+ if (options.taskId && this.options.channelDir) {
414
+ await logTaskDispatch(this.options.channelDir, options.taskId, {
415
+ ref: id,
416
+ agent: "job",
417
+ label,
418
+ }).catch((error) => {
419
+ log.logWarning(`Failed to log dispatch of job ${id} to task ${options.taskId}`, errorMessage(error));
420
+ });
421
+ }
411
422
  this.ensureSweeper();
412
423
  return toSnapshot(record);
413
424
  }
@@ -678,9 +689,34 @@ export class ChannelJobManager {
678
689
  record.notified = true;
679
690
  }
680
691
  await this.persist(record);
692
+ await this.logSettlementToTask(record);
681
693
  await this.announce(record, signal);
682
694
  this.scheduleGarbageCollection();
683
695
  }
696
+ /**
697
+ * Tell the owning task this job settled (spec 052, D4). Runs before the completion wake is
698
+ * dispatched, so the step the wake starts already finds the result on its board. Best-effort and
699
+ * once-only: a task that no longer exists, or a replayed finish, writes nothing.
700
+ */
701
+ async logSettlementToTask(record) {
702
+ const taskId = record.contract.taskId;
703
+ const channelDir = this.options.channelDir;
704
+ if (!taskId || !channelDir || record.taskLogged)
705
+ return;
706
+ record.taskLogged = true;
707
+ const output = await this.readOutput(record.id).catch(() => undefined);
708
+ await logTaskSettlement(channelDir, taskId, {
709
+ ref: record.id,
710
+ status: record.status,
711
+ exitCode: record.exitCode,
712
+ output: record.spillFile,
713
+ tail: output?.text.slice(-WAKE_OUTPUT_TAIL_BYTES).trim() || undefined,
714
+ durationMs: record.durationMs,
715
+ }).catch((error) => {
716
+ log.logWarning(`Failed to log settlement of job ${record.id} to task ${taskId}`, errorMessage(error));
717
+ });
718
+ await this.persist(record);
719
+ }
684
720
  /**
685
721
  * Wake the channel for a finished job. `dispatch()` durably persists its own pending record
686
722
  * (and is idempotent on dispatch id) before this call can be interrupted, so it is safe to call
@@ -710,8 +746,7 @@ export class ChannelJobManager {
710
746
  ts: String(Date.now()),
711
747
  conversationType: this.channelId.startsWith("group_") ? "2" : "1",
712
748
  dispatchId: `job:${this.channelId}:${record.id}:done`,
713
- // P0-2: a user is waiting on this job's result — render the resulting turn's progress
714
- // instead of the "none" style autonomous check-ins get.
749
+ // The result is awaited; the wake itself still runs without a progress card.
715
750
  presentation: "awaited",
716
751
  ...(record.contract.taskId
717
752
  ? {
@@ -991,7 +1026,12 @@ export function createJobRuntime(executor, options = {}) {
991
1026
  if (!manager) {
992
1027
  manager = new ChannelJobManager(channelId, executor, {
993
1028
  ...(config.jobsStateDir ? { stateDir: join(config.jobsStateDir, channelId) } : {}),
994
- ...(config.workspaceDir ? { spillDir: join(getChannelDir(config.workspaceDir, channelId), "logs") } : {}),
1029
+ ...(config.workspaceDir
1030
+ ? {
1031
+ spillDir: join(getChannelDir(config.workspaceDir, channelId), "logs"),
1032
+ channelDir: getChannelDir(config.workspaceDir, channelId),
1033
+ }
1034
+ : {}),
995
1035
  ...(config.dispatch ? { dispatch: config.dispatch } : {}),
996
1036
  ...(config.sweepIntervalMs ? { sweepIntervalMs: config.sweepIntervalMs } : {}),
997
1037
  });
@@ -91,7 +91,7 @@ export const TASK_CORE_SECTION = {
91
91
  overflow: "error",
92
92
  render: () => [
93
93
  "## Persistent Work",
94
- "Use a task only when work must survive this turn. Chat creates or manages tasks; the runtime drives them in task sessions. Follow the task's contract and runtime guide without expanding its scope or bypassing verification.",
94
+ "Use a task when work must survive this turn, has several pieces to delegate, or needs to wait on results; you lead it — split, delegate, check, report. Recurring or scheduled work is an event with a task template. Chat creates or manages tasks; the runtime drives them in task sessions. Follow the task's contract and runtime guide without expanding its scope.",
95
95
  ].join("\n"),
96
96
  };
97
97
  export const PLAYBOOKS_SECTION = {
@@ -178,7 +178,7 @@ function renderSubAgentDirectory(subAgents) {
178
178
  lines.push(`- ${agent.name} — ${agent.description}${suffix}`);
179
179
  }
180
180
  }
181
- lines.push("", "Read agent-delegation.md before non-trivial delegation, and task-loop.md before independent verification.");
181
+ lines.push("", "Read agent-delegation.md before non-trivial delegation, and task-lead.md before leading a multi-item task.");
182
182
  return lines.join("\n");
183
183
  }
184
184
  const WORKSPACE_PREAMBLE = "The files below are workspace policy chosen by the user or the team. They direct how you work; they do not override the runtime facts and hard invariants above.";
@@ -7,8 +7,8 @@ import type { SubAgentRunManager } from "../subagents/runs.js";
7
7
  import type { ChannelJobManager } from "./job-manager.js";
8
8
  import type { AgentRunner } from "./types.js";
9
9
  export interface RunnerFactoryPaths {
10
- jobManager?: ChannelJobManager;
11
- runManager?: SubAgentRunManager;
10
+ jobManager: ChannelJobManager;
11
+ runManager: SubAgentRunManager;
12
12
  appHomeDir: string;
13
13
  authConfigPath: string;
14
14
  modelsConfigPath: string;
@@ -58,17 +58,21 @@ export interface AgentRunner {
58
58
  getSubAgentDiscoverySnapshot(): SubAgentDiscoveryResult;
59
59
  abort(): Promise<void>;
60
60
  /** True when the SDK is currently summarizing context. */
61
- isCompacting?(): boolean;
61
+ isCompacting(): boolean;
62
62
  /** Cancel context summarization synchronously; returns whether one was active. */
63
- interruptCompaction?(): boolean;
63
+ interruptCompaction(): boolean;
64
64
  /**
65
- * Bind this runner to a task cycle's own session for the next turn, and back afterwards
66
- * (spec 051, D3). Optional: the TUI runs one session per process and never routes task steps.
65
+ * Bind this runner to a task's own session for the next turn, and back afterwards
66
+ * (spec 051, D3).
67
67
  */
68
- bindTaskSession?(taskId: string, cycleId: string): Promise<void>;
69
- bindChatSession?(): Promise<void>;
68
+ bindTaskSession(taskId: string): Promise<void>;
69
+ bindChatSession(): Promise<void>;
70
+ /** The task whose session this runner is bound to right now, if a task step is running. */
71
+ getTaskLoop(): {
72
+ taskId: string;
73
+ } | undefined;
70
74
  /** Permanently retire this runner generation after an out-of-band `/new`. */
71
- retireForNewSession?(): void;
75
+ retireForNewSession(): void;
72
76
  /**
73
77
  * Synchronously reserve the turn for a message. Transports MUST call this in
74
78
  * the same tick they dequeue the message, before any await, so a concurrent
@@ -77,6 +77,7 @@ export interface ChannelContext {
77
77
  respondInThread: (text: string) => Promise<void>;
78
78
  setTyping: (isTyping: boolean) => Promise<void>;
79
79
  setWorking: (working: boolean) => Promise<void>;
80
+ /** End without a final answer. Transports may preserve already-visible progress. */
80
81
  deleteMessage: () => Promise<void>;
81
82
  primeCard: (delayMs: number) => void;
82
83
  flush: () => Promise<void>;
@@ -93,7 +94,6 @@ export interface ChannelContext {
93
94
  * something to say routes it through `task_step_end`'s `notify` — which the runtime delivers on
94
95
  * the real context after the step ends.
95
96
  *
96
- * Card/typing/lifecycle calls pass through: they affect no transcript and keep the transport's
97
- * own state machine consistent.
97
+ * Lifecycle calls pass through for cleanup; card priming is a visible write and is muted too.
98
98
  */
99
99
  export declare function muteChannelContext(ctx: ChannelContext): ChannelContext;
@@ -25,8 +25,7 @@
25
25
  * something to say routes it through `task_step_end`'s `notify` — which the runtime delivers on
26
26
  * the real context after the step ends.
27
27
  *
28
- * Card/typing/lifecycle calls pass through: they affect no transcript and keep the transport's
29
- * own state machine consistent.
28
+ * Lifecycle calls pass through for cleanup; card priming is a visible write and is muted too.
30
29
  */
31
30
  export function muteChannelContext(ctx) {
32
31
  return {
@@ -35,5 +34,6 @@ export function muteChannelContext(ctx) {
35
34
  respondPlain: async () => true,
36
35
  replaceMessage: async () => undefined,
37
36
  respondInThread: async () => undefined,
37
+ primeCard: () => undefined,
38
38
  };
39
39
  }
@@ -74,9 +74,9 @@ export interface ChannelEvent {
74
74
  /**
75
75
  * Purely a display hint: `"awaited"` marks a synthetic wake a human is actually waiting on (a
76
76
  * delegation or background job finishing), as opposed to an autonomous check-in (task-driver
77
- * polling, a scheduled event) that normally has nothing to say. The runtime uses it to decide
78
- * whether the resulting turn renders progress or stays silent until a final answer — it must
79
- * never gate task activation or any other trust decision; that stays on `internalWake` alone.
77
+ * polling, a scheduled event) that normally has nothing to say. All synthetic wakes now
78
+ * deliver only their result; this metadata does not enable progress cards or gate task
79
+ * activation. Trust decisions stay on `internalWake` alone.
80
80
  */
81
81
  presentation?: "awaited";
82
82
  }
@@ -8,6 +8,26 @@ export interface PersistedProjectSelectionV1 {
8
8
  updatedBy: "migration" | "dingtalk-command" | "tui-command";
9
9
  }
10
10
  export declare function getProjectSelectionPath(channelDir: string): string;
11
+ /**
12
+ * `missing` (never selected — a plain default) and `corrupt` (a selection existed but the file
13
+ * cannot be read back) must not collapse into the same "nothing here" signal (R7a):
14
+ * `resolveProjectScope` used to treat both as "never selected" and silently overwrite a corrupt
15
+ * file with the app default, which moved a channel to a different project root without the user
16
+ * ever choosing that.
17
+ */
18
+ export type ReadProjectSelectionResult = {
19
+ kind: "missing";
20
+ } | {
21
+ kind: "corrupt";
22
+ } | {
23
+ kind: "valid";
24
+ selection: PersistedProjectSelectionV1;
25
+ };
26
+ export declare function readProjectSelectionResult(channelDir: string): ReadProjectSelectionResult;
27
+ /** Collapses `corrupt` into `undefined` alongside `missing`, for display-only callers (`/project
28
+ * show`) that already have their own "not chosen yet" wording and do not make a resolution
29
+ * decision. `resolveProjectScope` uses {@link readProjectSelectionResult} directly instead,
30
+ * because it must not conflate the two. */
11
31
  export declare function readProjectSelection(channelDir: string): PersistedProjectSelectionV1 | undefined;
12
32
  export declare function commitProjectSelection(channelDir: string, projectRoot: string, updatedBy: PersistedProjectSelectionV1["updatedBy"]): Promise<PersistedProjectSelectionV1>;
13
33
  export type ProjectScopeOutcome = {