@oyasmi/pipiclaw 0.9.4 → 0.9.5-beta.3

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 (531) hide show
  1. package/README.en.md +35 -31
  2. package/README.md +34 -30
  3. package/dist/agent/builtin-commands.d.ts +7 -2
  4. package/dist/agent/builtin-commands.js +19 -23
  5. package/dist/agent/channel-runner.d.ts +23 -35
  6. package/dist/agent/channel-runner.js +150 -89
  7. package/dist/agent/maintenance-context.d.ts +8 -5
  8. package/dist/agent/maintenance-context.js +30 -15
  9. package/dist/agent/prompt/manifest.js +1 -1
  10. package/dist/agent/prompt/resources.d.ts +1 -1
  11. package/dist/agent/prompt/resources.js +1 -1
  12. package/dist/agent/prompt/sections.js +11 -9
  13. package/dist/agent/prompt/types.d.ts +1 -1
  14. package/dist/agent/runner-factory.d.ts +6 -6
  15. package/dist/agent/runner-factory.js +7 -8
  16. package/dist/agent/session/command-extension.js +11 -0
  17. package/dist/agent/session/compaction-input.d.ts +6 -0
  18. package/dist/agent/session/compaction-input.js +75 -0
  19. package/dist/agent/session/compaction-snapshot.d.ts +30 -0
  20. package/dist/agent/session/compaction-snapshot.js +154 -0
  21. package/dist/agent/session/compaction-summary.d.ts +39 -0
  22. package/dist/agent/session/compaction-summary.js +162 -0
  23. package/dist/agent/session/compaction.d.ts +35 -0
  24. package/dist/agent/session/compaction.js +294 -0
  25. package/dist/agent/session/context-input.d.ts +15 -0
  26. package/dist/agent/session/context-input.js +82 -0
  27. package/dist/agent/session/context-snapshot.d.ts +11 -0
  28. package/dist/agent/session/context-snapshot.js +72 -0
  29. package/dist/agent/session/event-guards.d.ts +2 -0
  30. package/dist/agent/session/event-guards.js +4 -0
  31. package/dist/agent/session/execution-trace.d.ts +14 -0
  32. package/dist/agent/session/execution-trace.js +57 -0
  33. package/dist/agent/session/request-tools.d.ts +3 -0
  34. package/dist/agent/session/request-tools.js +20 -0
  35. package/dist/agent/session/session-adapter.d.ts +2 -1
  36. package/dist/agent/session/session-adapter.js +6 -3
  37. package/dist/agent/session/session-events.d.ts +4 -8
  38. package/dist/agent/session/session-events.js +80 -70
  39. package/dist/agent/session/session-host.d.ts +39 -61
  40. package/dist/agent/session/session-host.js +122 -124
  41. package/dist/agent/session/settings-diagnostics.d.ts +5 -0
  42. package/dist/agent/session/settings-diagnostics.js +21 -0
  43. package/dist/agent/status-render.js +5 -2
  44. package/dist/{runtime → agent}/stop-watchdog.d.ts +3 -1
  45. package/dist/{runtime → agent}/stop-watchdog.js +7 -3
  46. package/dist/agent/turn/progress-formatter.d.ts +1 -3
  47. package/dist/agent/turn/progress-formatter.js +3 -22
  48. package/dist/agent/turn/task-digest.d.ts +5 -4
  49. package/dist/agent/turn/task-digest.js +37 -34
  50. package/dist/agent/turn/turn-context.d.ts +12 -8
  51. package/dist/agent/turn/turn-context.js +27 -19
  52. package/dist/agent/turn/turn-finish.d.ts +18 -6
  53. package/dist/agent/turn/turn-finish.js +52 -77
  54. package/dist/agent/turn/turn-input.d.ts +2 -2
  55. package/dist/agent/turn/turn-input.js +4 -3
  56. package/dist/agent/turn/turn-output.d.ts +19 -0
  57. package/dist/agent/turn/turn-output.js +41 -0
  58. package/dist/agent/turn/turn-pipeline.d.ts +15 -10
  59. package/dist/agent/turn/turn-pipeline.js +86 -59
  60. package/dist/agent/turn/turn-prompt.d.ts +1 -1
  61. package/dist/agent/turn/turn-recovery.d.ts +11 -10
  62. package/dist/agent/turn/turn-recovery.js +14 -29
  63. package/dist/agent/types.d.ts +93 -24
  64. package/dist/agent/types.js +5 -1
  65. package/dist/app/auth-command.js +1 -1
  66. package/dist/app/home.js +34 -19
  67. package/dist/channel/active-session-store.d.ts +14 -12
  68. package/dist/channel/active-session-store.js +29 -25
  69. package/dist/channel/attachments.d.ts +25 -0
  70. package/dist/channel/attachments.js +56 -0
  71. package/dist/channel/channel-context.d.ts +87 -96
  72. package/dist/channel/channel-context.js +1 -66
  73. package/dist/channel/channel-event.d.ts +49 -47
  74. package/dist/channel/channel-event.js +6 -11
  75. package/dist/channel/channel-id.d.ts +22 -0
  76. package/dist/channel/channel-id.js +13 -0
  77. package/dist/channel/channel-index.d.ts +17 -34
  78. package/dist/channel/channel-index.js +41 -80
  79. package/dist/channel/config.d.ts +10 -0
  80. package/dist/channel/config.js +55 -0
  81. package/dist/channel/ingress.d.ts +93 -0
  82. package/dist/channel/ingress.js +5 -0
  83. package/dist/channel/store.d.ts +14 -16
  84. package/dist/channel/store.js +21 -25
  85. package/dist/channel/transport.d.ts +99 -0
  86. package/dist/channel/turn-context.d.ts +23 -0
  87. package/dist/channel/turn-context.js +1 -0
  88. package/dist/commands/catalog.d.ts +4 -7
  89. package/dist/commands/catalog.js +48 -49
  90. package/dist/commands/router.d.ts +28 -14
  91. package/dist/commands/router.js +30 -27
  92. package/dist/config/settings.d.ts +8 -14
  93. package/dist/config/settings.js +0 -7
  94. package/dist/config/tools.d.ts +2 -2
  95. package/dist/config/tools.js +2 -2
  96. package/dist/desk/bindings.d.ts +6 -0
  97. package/dist/desk/bindings.js +105 -0
  98. package/dist/desk/commands.d.ts +81 -0
  99. package/dist/desk/commands.js +145 -0
  100. package/dist/desk/default.d.ts +4 -0
  101. package/dist/desk/default.js +11 -0
  102. package/dist/desk/paths.d.ts +41 -0
  103. package/dist/desk/paths.js +81 -0
  104. package/dist/desk/registry.d.ts +17 -0
  105. package/dist/desk/registry.js +191 -0
  106. package/dist/desk/startup-error.d.ts +4 -0
  107. package/dist/desk/startup-error.js +7 -0
  108. package/dist/desk/types.d.ts +72 -0
  109. package/dist/desk/types.js +7 -0
  110. package/dist/dingtalk/bot.d.ts +20 -35
  111. package/dist/dingtalk/bot.js +25 -204
  112. package/dist/dingtalk/cards.d.ts +7 -0
  113. package/dist/dingtalk/cards.js +32 -2
  114. package/dist/dingtalk/channel-ids.d.ts +15 -0
  115. package/dist/dingtalk/channel-ids.js +39 -0
  116. package/dist/dingtalk/config.d.ts +6 -3
  117. package/dist/dingtalk/config.js +13 -25
  118. package/dist/dingtalk/connection.d.ts +1 -0
  119. package/dist/dingtalk/connection.js +5 -4
  120. package/dist/dingtalk/conversation-meta.d.ts +10 -5
  121. package/dist/dingtalk/conversation-meta.js +72 -50
  122. package/dist/dingtalk/delivery.d.ts +34 -14
  123. package/dist/dingtalk/delivery.js +332 -190
  124. package/dist/dingtalk/inbound-media.d.ts +2 -18
  125. package/dist/dingtalk/inbound-media.js +0 -53
  126. package/dist/dingtalk/inbound.d.ts +10 -11
  127. package/dist/dingtalk/inbound.js +12 -19
  128. package/dist/dingtalk/media.d.ts +9 -11
  129. package/dist/dingtalk/media.js +18 -31
  130. package/dist/dingtalk/progress.d.ts +57 -0
  131. package/dist/dingtalk/progress.js +199 -0
  132. package/dist/dingtalk/response-mode.d.ts +13 -0
  133. package/dist/dingtalk/response-mode.js +31 -0
  134. package/dist/dingtalk/transport.d.ts +47 -0
  135. package/dist/dingtalk/transport.js +71 -0
  136. package/dist/events/commands.d.ts +7 -2
  137. package/dist/events/commands.js +40 -22
  138. package/dist/events/pre-action-error.d.ts +10 -0
  139. package/dist/events/pre-action-error.js +10 -0
  140. package/dist/events/types.d.ts +20 -2
  141. package/dist/events/watcher.d.ts +14 -7
  142. package/dist/events/watcher.js +49 -26
  143. package/dist/file-store.d.ts +4 -0
  144. package/dist/file-store.js +6 -1
  145. package/dist/index.d.ts +4 -2
  146. package/dist/jobs/completion-observer.d.ts +20 -0
  147. package/dist/jobs/completion-observer.js +107 -0
  148. package/dist/jobs/completion-signal.d.ts +9 -0
  149. package/dist/jobs/completion-signal.js +32 -0
  150. package/dist/jobs/completion-wake.d.ts +14 -0
  151. package/dist/jobs/completion-wake.js +25 -0
  152. package/dist/jobs/manager.d.ts +29 -42
  153. package/dist/jobs/manager.js +130 -236
  154. package/dist/jobs/probe.d.ts +3 -0
  155. package/dist/jobs/probe.js +42 -0
  156. package/dist/jobs/record.d.ts +5 -6
  157. package/dist/jobs/record.js +2 -0
  158. package/dist/jobs/runtime.d.ts +28 -0
  159. package/dist/jobs/runtime.js +69 -0
  160. package/dist/log.d.ts +0 -1
  161. package/dist/log.js +1 -1
  162. package/dist/main.js +10 -3
  163. package/dist/memory/boundary-work.d.ts +19 -0
  164. package/dist/memory/boundary-work.js +204 -0
  165. package/dist/memory/commands.d.ts +4 -3
  166. package/dist/memory/commands.js +20 -17
  167. package/dist/memory/desk-memory-queue.d.ts +18 -0
  168. package/dist/memory/desk-memory-queue.js +33 -0
  169. package/dist/memory/index-budget.d.ts +3 -3
  170. package/dist/memory/index-budget.js +21 -18
  171. package/dist/memory/journal.d.ts +6 -6
  172. package/dist/memory/journal.js +16 -15
  173. package/dist/memory/lifecycle.d.ts +17 -28
  174. package/dist/memory/lifecycle.js +87 -147
  175. package/dist/memory/maintenance-state.d.ts +14 -15
  176. package/dist/memory/maintenance-state.js +43 -42
  177. package/dist/memory/reflect-job.d.ts +5 -10
  178. package/dist/memory/reflect-job.js +29 -44
  179. package/dist/memory/reflect.d.ts +6 -1
  180. package/dist/memory/reflect.js +44 -16
  181. package/dist/memory/render.d.ts +1 -1
  182. package/dist/memory/render.js +2 -2
  183. package/dist/memory/review-log.d.ts +17 -4
  184. package/dist/memory/review-log.js +54 -5
  185. package/dist/memory/scheduler.d.ts +12 -19
  186. package/dist/memory/scheduler.js +28 -64
  187. package/dist/memory/search.js +7 -4
  188. package/dist/memory/session-corpus.d.ts +4 -1
  189. package/dist/memory/session-corpus.js +70 -29
  190. package/dist/memory/session-search.d.ts +11 -3
  191. package/dist/memory/session-search.js +14 -11
  192. package/dist/memory/sidecar-worker.d.ts +1 -0
  193. package/dist/memory/sidecar-worker.js +57 -76
  194. package/dist/memory/source-window.d.ts +18 -7
  195. package/dist/memory/source-window.js +59 -29
  196. package/dist/memory/store.d.ts +14 -12
  197. package/dist/memory/store.js +89 -57
  198. package/dist/paths.d.ts +2 -0
  199. package/dist/paths.js +2 -0
  200. package/dist/playbooks/agent-delegation.md +23 -17
  201. package/dist/playbooks/background-jobs.md +7 -5
  202. package/dist/playbooks/event-scheduling.md +9 -7
  203. package/dist/playbooks/memory-and-learning.md +18 -14
  204. package/dist/playbooks/outbound-media.md +3 -3
  205. package/dist/playbooks/runtime-orientation.md +39 -23
  206. package/dist/playbooks/task-lead.md +57 -34
  207. package/dist/runtime/bootstrap.d.ts +45 -35
  208. package/dist/runtime/bootstrap.js +372 -167
  209. package/dist/runtime/channel-queue.d.ts +25 -0
  210. package/dist/{dingtalk → runtime}/channel-queue.js +25 -10
  211. package/dist/runtime/daemon-lock.d.ts +12 -0
  212. package/dist/runtime/daemon-lock.js +28 -0
  213. package/dist/runtime/desk-runtime.d.ts +131 -0
  214. package/dist/runtime/desk-runtime.js +402 -0
  215. package/dist/runtime/durable-dispatch.d.ts +18 -5
  216. package/dist/runtime/durable-dispatch.js +85 -14
  217. package/dist/runtime/inbound-images.d.ts +32 -10
  218. package/dist/runtime/inbound-images.js +95 -21
  219. package/dist/runtime/ingress-busy.d.ts +25 -0
  220. package/dist/runtime/ingress-busy.js +178 -0
  221. package/dist/runtime/ingress-commands.d.ts +7 -0
  222. package/dist/runtime/ingress-commands.js +170 -0
  223. package/dist/runtime/ingress-deps.d.ts +59 -0
  224. package/dist/runtime/ingress-deps.js +1 -0
  225. package/dist/runtime/ingress.d.ts +22 -0
  226. package/dist/runtime/ingress.js +386 -0
  227. package/dist/runtime/request-execution.d.ts +19 -0
  228. package/dist/runtime/request-execution.js +88 -0
  229. package/dist/runtime/shutdown.d.ts +14 -6
  230. package/dist/runtime/shutdown.js +11 -5
  231. package/dist/runtime/task-close.d.ts +4 -0
  232. package/dist/runtime/task-close.js +102 -0
  233. package/dist/runtime/task-control.d.ts +34 -0
  234. package/dist/runtime/task-control.js +225 -0
  235. package/dist/runtime/task-input.d.ts +13 -0
  236. package/dist/runtime/task-input.js +129 -0
  237. package/dist/runtime/task-lane-types.d.ts +123 -0
  238. package/dist/runtime/task-lane-types.js +14 -0
  239. package/dist/runtime/task-lane.d.ts +99 -0
  240. package/dist/runtime/task-lane.js +703 -0
  241. package/dist/runtime/task-pending.d.ts +8 -0
  242. package/dist/runtime/task-pending.js +40 -0
  243. package/dist/runtime/task-spawn.d.ts +8 -8
  244. package/dist/runtime/task-spawn.js +10 -9
  245. package/dist/runtime/task-step.d.ts +32 -0
  246. package/dist/runtime/task-step.js +276 -0
  247. package/dist/runtime/transports.d.ts +32 -0
  248. package/dist/runtime/transports.js +101 -0
  249. package/dist/runtime/turn-run.d.ts +20 -23
  250. package/dist/runtime/turn-run.js +252 -159
  251. package/dist/runtime/wake-coalescing.d.ts +12 -6
  252. package/dist/runtime/wake-coalescing.js +12 -4
  253. package/dist/security/config.js +5 -10
  254. package/dist/security/logger.js +1 -1
  255. package/dist/security/path-guard.js +7 -63
  256. package/dist/security/types.d.ts +27 -30
  257. package/dist/security/types.js +0 -1
  258. package/dist/shared/atomic-file.d.ts +2 -0
  259. package/dist/shared/atomic-file.js +14 -1
  260. package/dist/shared/file-lock.d.ts +35 -0
  261. package/dist/shared/file-lock.js +195 -0
  262. package/dist/shared/format.d.ts +0 -6
  263. package/dist/shared/format.js +0 -17
  264. package/dist/shared/host-process.d.ts +2 -0
  265. package/dist/shared/host-process.js +16 -1
  266. package/dist/shared/jsonl-appender.d.ts +5 -0
  267. package/dist/shared/jsonl-appender.js +25 -2
  268. package/dist/shared/with-timeout.d.ts +2 -0
  269. package/dist/shared/with-timeout.js +21 -0
  270. package/dist/skills/catalog.d.ts +9 -0
  271. package/dist/skills/catalog.js +34 -0
  272. package/dist/skills/commands.d.ts +3 -12
  273. package/dist/skills/commands.js +36 -22
  274. package/dist/skills/loader.d.ts +2 -31
  275. package/dist/skills/loader.js +101 -68
  276. package/dist/skills/roots.d.ts +12 -0
  277. package/dist/skills/roots.js +18 -0
  278. package/dist/skills/types.d.ts +24 -0
  279. package/dist/skills/types.js +1 -0
  280. package/dist/subagents/completion-wake.d.ts +11 -2
  281. package/dist/subagents/completion-wake.js +21 -18
  282. package/dist/subagents/discovery.d.ts +1 -1
  283. package/dist/subagents/discovery.js +10 -16
  284. package/dist/subagents/dispatch.d.ts +0 -10
  285. package/dist/subagents/dispatch.js +18 -44
  286. package/dist/subagents/external/cursor-cli.d.ts +2 -0
  287. package/dist/subagents/external/cursor-cli.js +256 -0
  288. package/dist/subagents/external/dispatch.js +1 -1
  289. package/dist/subagents/external/harness.d.ts +5 -5
  290. package/dist/subagents/external/reconciliation.d.ts +7 -0
  291. package/dist/subagents/external/reconciliation.js +105 -0
  292. package/dist/subagents/external/recovery.d.ts +20 -0
  293. package/dist/subagents/external/recovery.js +71 -0
  294. package/dist/subagents/external/registry.js +2 -0
  295. package/dist/subagents/external/role-warnings.d.ts +17 -0
  296. package/dist/subagents/external/role-warnings.js +42 -0
  297. package/dist/subagents/external/run.d.ts +1 -1
  298. package/dist/subagents/external/run.js +21 -25
  299. package/dist/subagents/format.d.ts +1 -1
  300. package/dist/subagents/format.js +1 -1
  301. package/dist/subagents/grace.d.ts +2 -2
  302. package/dist/subagents/grace.js +3 -3
  303. package/dist/subagents/internal/run.js +8 -6
  304. package/dist/subagents/internal/worker.js +37 -16
  305. package/dist/subagents/result.js +2 -3
  306. package/dist/subagents/run-archive.d.ts +11 -0
  307. package/dist/subagents/run-archive.js +49 -0
  308. package/dist/subagents/run-record.d.ts +13 -15
  309. package/dist/subagents/run-record.js +5 -5
  310. package/dist/subagents/run-registry.d.ts +5 -3
  311. package/dist/subagents/run-registry.js +22 -45
  312. package/dist/subagents/runs.d.ts +51 -54
  313. package/dist/subagents/runs.js +178 -304
  314. package/dist/subagents/task-envelope.js +9 -11
  315. package/dist/subagents/task-settlement.d.ts +3 -0
  316. package/dist/subagents/task-settlement.js +20 -0
  317. package/dist/subagents/types.d.ts +7 -7
  318. package/dist/subagents/workspace-summary.js +5 -1
  319. package/dist/tasks/archive.d.ts +11 -0
  320. package/dist/tasks/archive.js +141 -0
  321. package/dist/tasks/board.d.ts +5 -12
  322. package/dist/tasks/board.js +4 -30
  323. package/dist/tasks/bound-work.d.ts +13 -7
  324. package/dist/tasks/bound-work.js +41 -28
  325. package/dist/tasks/brief.d.ts +39 -15
  326. package/dist/tasks/brief.js +131 -73
  327. package/dist/tasks/budget.d.ts +3 -3
  328. package/dist/tasks/budget.js +9 -4
  329. package/dist/tasks/commands.d.ts +24 -10
  330. package/dist/tasks/commands.js +225 -131
  331. package/dist/tasks/completion.d.ts +12 -0
  332. package/dist/tasks/completion.js +35 -0
  333. package/dist/tasks/contract.d.ts +8 -19
  334. package/dist/tasks/contract.js +41 -45
  335. package/dist/tasks/control.d.ts +138 -0
  336. package/dist/tasks/control.js +1 -0
  337. package/dist/tasks/create.d.ts +4 -2
  338. package/dist/tasks/create.js +13 -7
  339. package/dist/tasks/delivery.d.ts +24 -0
  340. package/dist/tasks/delivery.js +221 -0
  341. package/dist/tasks/file-mutation.d.ts +5 -0
  342. package/dist/tasks/file-mutation.js +38 -0
  343. package/dist/tasks/frontmatter.d.ts +46 -27
  344. package/dist/tasks/frontmatter.js +90 -47
  345. package/dist/tasks/input-receipts.d.ts +7 -0
  346. package/dist/tasks/input-receipts.js +60 -0
  347. package/dist/tasks/loop-log.d.ts +150 -37
  348. package/dist/tasks/loop-log.js +250 -42
  349. package/dist/tasks/mutation-lock.d.ts +7 -5
  350. package/dist/tasks/mutation-lock.js +32 -9
  351. package/dist/tasks/receipts.d.ts +19 -0
  352. package/dist/tasks/receipts.js +48 -0
  353. package/dist/tasks/session-path.d.ts +3 -3
  354. package/dist/tasks/session-path.js +5 -5
  355. package/dist/tasks/state.d.ts +93 -0
  356. package/dist/tasks/state.js +156 -0
  357. package/dist/tasks/store.d.ts +86 -54
  358. package/dist/tasks/store.js +256 -156
  359. package/dist/tools/bash.d.ts +8 -10
  360. package/dist/tools/bash.js +27 -40
  361. package/dist/tools/contract/details.d.ts +6 -6
  362. package/dist/tools/contract/details.js +6 -6
  363. package/dist/tools/contract/execution-trace.d.ts +4 -0
  364. package/dist/tools/contract/execution-trace.js +23 -0
  365. package/dist/tools/contract/names.d.ts +7 -0
  366. package/dist/tools/contract/names.js +22 -0
  367. package/dist/tools/contract/presentation.js +6 -2
  368. package/dist/tools/edit.d.ts +1 -0
  369. package/dist/tools/edit.js +46 -43
  370. package/dist/tools/event-manage.d.ts +3 -1
  371. package/dist/tools/event-manage.js +34 -33
  372. package/dist/tools/glob.js +5 -5
  373. package/dist/tools/grep.js +2 -2
  374. package/dist/tools/index.d.ts +17 -20
  375. package/dist/tools/index.js +28 -22
  376. package/dist/tools/job.d.ts +4 -2
  377. package/dist/tools/job.js +11 -8
  378. package/dist/tools/memory-manage.d.ts +5 -3
  379. package/dist/tools/memory-manage.js +32 -25
  380. package/dist/tools/read.js +1 -1
  381. package/dist/tools/registry.d.ts +19 -19
  382. package/dist/tools/registry.js +65 -34
  383. package/dist/tools/send-media.d.ts +2 -2
  384. package/dist/tools/send-media.js +3 -3
  385. package/dist/tools/session-search.d.ts +3 -1
  386. package/dist/tools/session-search.js +8 -6
  387. package/dist/tools/skill.d.ts +2 -2
  388. package/dist/tools/skill.js +24 -10
  389. package/dist/tools/subagent-manage.d.ts +2 -8
  390. package/dist/tools/subagent-manage.js +26 -19
  391. package/dist/tools/subagent.d.ts +0 -2
  392. package/dist/tools/subagent.js +3 -8
  393. package/dist/tools/task-manage/control-tools.d.ts +4 -0
  394. package/dist/tools/task-manage/control-tools.js +65 -0
  395. package/dist/tools/task-manage/create.js +3 -2
  396. package/dist/tools/task-manage/factory.d.ts +12 -6
  397. package/dist/tools/task-manage/factory.js +73 -58
  398. package/dist/tools/task-manage/lifecycle.d.ts +7 -12
  399. package/dist/tools/task-manage/lifecycle.js +119 -65
  400. package/dist/tools/task-manage/log-view.js +10 -7
  401. package/dist/tools/task-manage/schema.d.ts +21 -26
  402. package/dist/tools/task-manage/schema.js +29 -35
  403. package/dist/tools/task-manage/shared.d.ts +8 -39
  404. package/dist/tools/task-manage/shared.js +20 -69
  405. package/dist/tools/task-manage/step-tools.d.ts +5 -0
  406. package/dist/tools/task-manage/step-tools.js +103 -0
  407. package/dist/tools/task-manage/types.d.ts +33 -21
  408. package/dist/tools/web-cache.d.ts +3 -3
  409. package/dist/tools/web-cache.js +12 -12
  410. package/dist/tools/web-fetch.d.ts +2 -2
  411. package/dist/tools/web-fetch.js +7 -7
  412. package/dist/tools/write-content.d.ts +1 -0
  413. package/dist/tools/write-content.js +7 -2
  414. package/dist/tools/write.d.ts +1 -0
  415. package/dist/tools/write.js +1 -0
  416. package/dist/tui/cli.d.ts +17 -5
  417. package/dist/tui/cli.js +90 -27
  418. package/dist/tui/client.d.ts +26 -0
  419. package/dist/tui/client.js +157 -0
  420. package/dist/tui/colors.d.ts +0 -1
  421. package/dist/tui/colors.js +0 -1
  422. package/dist/tui/commands.d.ts +10 -51
  423. package/dist/tui/commands.js +16 -39
  424. package/dist/tui/frontend.d.ts +2 -2
  425. package/dist/tui/frontend.js +2 -2
  426. package/dist/tui/pitui-frontend.d.ts +0 -2
  427. package/dist/tui/pitui-frontend.js +1 -6
  428. package/dist/tui/render.d.ts +62 -0
  429. package/dist/tui/render.js +123 -0
  430. package/dist/tui/session.d.ts +92 -0
  431. package/dist/tui/session.js +317 -0
  432. package/dist/usage/ledger.d.ts +9 -4
  433. package/dist/usage/ledger.js +2 -0
  434. package/dist/usage/render.d.ts +6 -1
  435. package/dist/usage/render.js +20 -15
  436. package/dist/web/search-providers.js +0 -33
  437. package/dist/webapi/auth.d.ts +13 -0
  438. package/dist/webapi/auth.js +29 -0
  439. package/dist/webapi/config.d.ts +29 -0
  440. package/dist/webapi/config.js +100 -0
  441. package/dist/webapi/errors.d.ts +39 -0
  442. package/dist/webapi/errors.js +32 -0
  443. package/dist/webapi/http.d.ts +25 -0
  444. package/dist/webapi/http.js +4 -0
  445. package/dist/webapi/ids.d.ts +9 -0
  446. package/dist/webapi/ids.js +20 -0
  447. package/dist/webapi/input.d.ts +17 -0
  448. package/dist/webapi/input.js +229 -0
  449. package/dist/webapi/items.d.ts +37 -0
  450. package/dist/webapi/items.js +48 -0
  451. package/dist/webapi/key-command.d.ts +2 -0
  452. package/dist/webapi/key-command.js +110 -0
  453. package/dist/webapi/limits.d.ts +47 -0
  454. package/dist/webapi/limits.js +48 -0
  455. package/dist/webapi/request-policy.d.ts +17 -0
  456. package/dist/webapi/request-policy.js +160 -0
  457. package/dist/webapi/response-record.d.ts +68 -0
  458. package/dist/webapi/response-record.js +58 -0
  459. package/dist/webapi/response-state.d.ts +90 -0
  460. package/dist/webapi/response-state.js +347 -0
  461. package/dist/webapi/routes/conversations.d.ts +8 -0
  462. package/dist/webapi/routes/conversations.js +80 -0
  463. package/dist/webapi/routes/models.d.ts +3 -0
  464. package/dist/webapi/routes/models.js +12 -0
  465. package/dist/webapi/routes/responses.d.ts +8 -0
  466. package/dist/webapi/routes/responses.js +118 -0
  467. package/dist/webapi/routes/websocket.d.ts +9 -0
  468. package/dist/webapi/routes/websocket.js +328 -0
  469. package/dist/webapi/server.d.ts +24 -0
  470. package/dist/webapi/server.js +229 -0
  471. package/dist/webapi/service.d.ts +130 -0
  472. package/dist/webapi/service.js +588 -0
  473. package/dist/webapi/store.d.ts +46 -0
  474. package/dist/webapi/store.js +245 -0
  475. package/dist/webapi/stream.d.ts +13 -0
  476. package/dist/webapi/stream.js +76 -0
  477. package/dist/webapi/transport.d.ts +43 -0
  478. package/dist/webapi/transport.js +100 -0
  479. package/examples/sub-agents/README.md +23 -16
  480. package/examples/sub-agents/agents/claude-high.md +1 -1
  481. package/examples/sub-agents/agents/claude-main.md +1 -1
  482. package/examples/sub-agents/agents/codex-flash.md +1 -1
  483. package/examples/sub-agents/agents/codex-high.md +1 -1
  484. package/examples/sub-agents/agents/codex-main.md +4 -4
  485. package/examples/sub-agents/agents/cursor-high.md +22 -0
  486. package/examples/sub-agents/agents/cursor-main.md +22 -0
  487. package/examples/sub-agents/agents/glm-flash.md +1 -1
  488. package/examples/sub-agents/agents/glm-high.md +2 -2
  489. package/examples/sub-agents/agents/scout.md +30 -0
  490. package/package.json +13 -7
  491. package/dist/channel/channel-paths.d.ts +0 -16
  492. package/dist/channel/channel-paths.js +0 -53
  493. package/dist/channel/commands.d.ts +0 -32
  494. package/dist/channel/commands.js +0 -109
  495. package/dist/channel/project-scope-store.d.ts +0 -51
  496. package/dist/channel/project-scope-store.js +0 -112
  497. package/dist/dingtalk/channel-queue.d.ts +0 -19
  498. package/dist/dingtalk/handler.d.ts +0 -90
  499. package/dist/memory/channel-maintenance-queue.d.ts +0 -5
  500. package/dist/memory/channel-maintenance-queue.js +0 -8
  501. package/dist/runtime/task-driver.d.ts +0 -100
  502. package/dist/runtime/task-driver.js +0 -417
  503. package/dist/runtime/task-migration.d.ts +0 -30
  504. package/dist/runtime/task-migration.js +0 -465
  505. package/dist/runtime/task-wake.d.ts +0 -46
  506. package/dist/runtime/task-wake.js +0 -32
  507. package/dist/runtime/turn-handler.d.ts +0 -47
  508. package/dist/runtime/turn-handler.js +0 -318
  509. package/dist/security/project-scope.d.ts +0 -45
  510. package/dist/security/project-scope.js +0 -105
  511. package/dist/shared/wake-claim.d.ts +0 -23
  512. package/dist/shared/wake-claim.js +0 -26
  513. package/dist/skills/validation.d.ts +0 -8
  514. package/dist/skills/validation.js +0 -91
  515. package/dist/skills/workspace.d.ts +0 -33
  516. package/dist/skills/workspace.js +0 -116
  517. package/dist/tasks/steer.d.ts +0 -8
  518. package/dist/tasks/steer.js +0 -79
  519. package/dist/tasks/ticket.d.ts +0 -71
  520. package/dist/tasks/ticket.js +0 -138
  521. package/dist/tools/task-manage/step-end.d.ts +0 -11
  522. package/dist/tools/task-manage/step-end.js +0 -117
  523. package/dist/tui/app.d.ts +0 -16
  524. package/dist/tui/app.js +0 -166
  525. package/dist/tui/terminal-context.d.ts +0 -27
  526. package/dist/tui/terminal-context.js +0 -84
  527. package/dist/tui/terminal-media-sender.d.ts +0 -9
  528. package/dist/tui/terminal-media-sender.js +0 -15
  529. package/dist/tui/turn-controller.d.ts +0 -64
  530. package/dist/tui/turn-controller.js +0 -311
  531. /package/dist/{dingtalk/handler.js → channel/transport.js} +0 -0
package/README.en.md CHANGED
@@ -4,9 +4,7 @@
4
4
 
5
5
  **Turn DingTalk into an AI engineering entry point that keeps working.**
6
6
 
7
- Pipiclaw is an AI coding assistant runtime for individuals and teams. It lets an AI assistant do more than answer a single question: it stays in your DingTalk, understands context, operates your workspace, remembers long-term conventions, keeps tasks moving on a plan, and delegates the heavy lifting to Claude Code, Codex CLI, or your own executor.
8
-
9
- What you see is one assistant, but behind it can be a well-divided AI engineering team: the main agent owns understanding goals and delivering results, lightweight sub-agents handle retrieval and triage, and external agents handle cross-file implementation, independent review, and verification runs. All work has state, artifacts, and control entry points, instead of being scattered across a few terminal windows as throwaway conversations.
7
+ Pipiclaw is a DingTalk-first AI coding assistant runtime for individual developers. Assign a goal from DingTalk or the terminal, keep its working context, and let it progress in the background using your existing models, Claude Code, Codex CLI, or custom executors. Follow progress, add instructions, pause or cancel work, and retrieve the result with its verification evidence.
10
8
 
11
9
  - npm: [`@oyasmi/pipiclaw`](https://www.npmjs.com/package/@oyasmi/pipiclaw)
12
10
  - Runtime: Node.js `>= 22.19.0`, Linux / macOS; on Windows use WSL2
@@ -14,21 +12,21 @@ What you see is one assistant, but behind it can be a well-divided AI engineerin
14
12
 
15
13
  ## Why Pipiclaw
16
14
 
17
- ### One entry point, coordinating multiple agents
15
+ ### Use your existing executors as needed
18
16
 
19
17
  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
18
 
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.
19
+ In DingTalk daemon mode, external tasks keep running in the background after dispatch and automatically wake the channel that dispatched them 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
20
 
23
21
  ### Work does not end when a conversation ends
24
22
 
25
- Every channel has its own persistent conversation, long-term memory index, and daily journal. Each task is a one-off project with goals, done criteria, and work items in a Markdown contract, and steps, dispatches, and settlements in a JSONL loop log; the built-in task driver advances runnable tasks, redeems due time tickets, and handles ticket expiry. Scheduled and recurring work uses event templates to create an independent task instance per occurrence. The runtime stops with a notice when a budget, idle-loop, or repeated-expiry boundary is reached.
23
+ Pipiclaw is one personal assistant: by default the terminal, DingTalk DMs and group chats all share long-term memory, a daily journal, tasks, scheduled events and working files (kept in the default desk, `default`), while each keeps its own conversation — just start chatting. Sharing also means that something you tell the assistant in a DM may be recalled in a group; when you want to keep a project or purpose apart, use the advanced [desk mechanism](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md#按需分开工位): each desk has its own memory, tasks and files. Each task is a one-off project with goals, done criteria, and work items in a Markdown contract, and steps, dispatches, and settlements in a JSONL task log; tasks run in a background task lane, independent of chat, and you can check progress, add instructions, pause or cancel them with `/tasks` at any time. Scheduled and recurring work uses event templates to create an independent task instance per occurrence. The runtime pauses a task with a notice when a budget, idle-loop, step-timeout or repeated-error boundary is reached.
26
24
 
27
25
  ### Natively at home in DingTalk
28
26
 
29
27
  Pipiclaw uses DingTalk Stream Mode, so no self-hosted message relay or public IP is needed. AI Cards can continuously show thinking, tool execution, and status updates; while a task runs you can still use `/steer` to adjust direction, `/followup` to queue the next thing, and `/stop` to abort the current turn. Generated reports, screenshots, and exported files can be delivered as native DingTalk attachments.
30
28
 
31
- A single bot instance can serve many direct and group chats at once: DMs get a channel per user, groups get a channel per group, and model turns in different channels can progress in parallel; within one channel turns run serially so one conversation's context is not modified by multiple turns at once. Note that session isolation is not code-directory isolation; if several channels point at the same project directory, you should still avoid having the main agent edit the same set of files concurrently, or prepare separate Git worktrees for parallel implementation. See [Scaling and concurrency](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md) for the full boundaries.
29
+ A single bot instance can serve many direct and group chats at once: every DM and every group is a channel, and model turns in different channels can progress in parallel; within one channel turns run serially so one conversation's context is not modified by multiple turns at once. Note that isolation between desks is not code-directory isolation; if several channels point at the same project directory, you should still avoid having the main agent edit the same set of files concurrently, or prepare separate Git worktrees for parallel implementation. See [Scaling and concurrency](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md) for the full boundaries.
32
30
 
33
31
  ### Autonomous, and always interruptible
34
32
 
@@ -36,17 +34,17 @@ Scheduled events are good for reminders, periodic checks, and zero-token conditi
36
34
 
37
35
  ### Your config, data, and way of working
38
36
 
39
- Models support built-in providers, OpenAI-compatible gateways, API keys, and subscription login. Memory, tasks, roles, events, and team rules are all stored in human-readable files on your machine. Pipiclaw provides command, path, and network guards plus an audit log; when you need stronger isolation, you can put the whole process in its own account or container.
37
+ Models support built-in providers, OpenAI-compatible gateways, API keys, and subscription login. Memory, tasks, roles, events, and working rules are all stored in human-readable files on your machine. Pipiclaw provides command, path, and network guards plus an audit log; when you need stronger isolation, you can put the whole process in its own account or container.
40
38
 
41
39
  ## What it's good for
42
40
 
43
41
  - Providing an always-online dev assistant, internal tech support, or ops collaboration entry point in DingTalk
44
- - Handing requirement analysis, implementation, review, verification, and documentation to different AI agents working together
42
+ - Delivering complete changes with code, tests, documentation, and appropriate checks, with independent review based on risk
45
43
  - Following up on coding, investigation, migration, reporting, and periodic work that spans hours or days
46
- - Keeping mutually isolated context and memory across many group and direct chats
47
- - Reusing existing model gateways, Claude Code / Codex CLI accounts, and team working conventions
44
+ - Keeping a separate conversation per group and direct chat, sharing one body of memory by default and splitting it with desks when needed
45
+ - Reusing existing model gateways, Claude Code / Codex CLI accounts, and personal or project conventions
48
46
 
49
- Pipiclaw today targets individuals and small teams, self-hosted, single-instance. It is not a hard multi-tenant SaaS, and it does not provide an OS-level sandbox; the real permissions an external agent holds are determined together by the target CLI's sandbox parameters, the run account, and the host environment.
47
+ Pipiclaw targets individual developers and supports self-hosted, single-instance operation. It is not a hard multi-tenant SaaS, and it does not provide an OS-level sandbox; the real permissions an external agent holds are determined together by the target CLI's sandbox parameters, the run account, and the host environment.
50
48
 
51
49
  ## Quick start
52
50
 
@@ -63,13 +61,13 @@ The first real start of `pipiclaw` or `pipiclaw tui` creates:
63
61
 
64
62
  ```text
65
63
  ~/.pipiclaw/
66
- ├── channel.json # DingTalk app
64
+ ├── channel.json # Channel switches: DingTalk app, Web API
67
65
  ├── auth.json # model credentials
68
66
  ├── models.json # custom model providers
69
67
  ├── settings.json # default model and runtime settings
70
68
  ├── tools.json # capability switches for web tools, tasks, etc.
71
69
  ├── security.json # command, path, and network guards
72
- └── workspace/ # memory, tasks, events, skills, agent roles, and channel data
70
+ └── workspace/ # shared config and extensions; the default desk's data is in desk-default/
73
71
  ```
74
72
 
75
73
  Set `PIPICLAW_HOME=/your/path` to relocate this directory as a whole.
@@ -86,7 +84,7 @@ export ANTHROPIC_API_KEY=sk-ant-...
86
84
  pipiclaw auth login
87
85
  ```
88
86
 
89
- Then start:
87
+ Then chat right in the terminal (the first run initializes the default desk):
90
88
 
91
89
  ```bash
92
90
  pipiclaw tui
@@ -98,7 +96,7 @@ It can also be used for scripted one-shot requests:
98
96
  pipiclaw tui --print "Reply with only: Pipiclaw model call succeeded"
99
97
  ```
100
98
 
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).
99
+ 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. 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
100
 
103
101
  ### 3. Connect DingTalk
104
102
 
@@ -113,16 +111,21 @@ Edit `~/.pipiclaw/channel.json`:
113
111
 
114
112
  ```json
115
113
  {
116
- "clientId": "your-dingtalk-client-id",
117
- "clientSecret": "your-dingtalk-client-secret",
118
- "robotCode": "",
119
- "cardTemplateId": "",
120
- "cardTemplateKey": "content",
121
- "allowFrom": []
114
+ "dingtalk": {
115
+ "enabled": true,
116
+ "clientId": "your-dingtalk-client-id",
117
+ "clientSecret": "your-dingtalk-client-secret",
118
+ "robotCode": "",
119
+ "cardTemplateId": "",
120
+ "cardTemplateKey": "content",
121
+ "allowFrom": []
122
+ },
123
+ "webapi": { "enabled": false, "socket": true }
122
124
  }
123
125
  ```
124
126
 
125
- - The only hard-required fields are `clientId` and `clientSecret`.
127
+ - The `dingtalk` and `webapi` sections each have an `enabled` switch; turn on at least one. `webapi` lets scripts and other clients connect to your assistant through the official OpenAI SDK using the implemented Responses subset (see [Web API](https://github.com/oyasmi/pipiclaw/blob/main/docs/webapi.md)).
128
+ - The only hard-required DingTalk fields are `clientId` and `clientSecret`.
126
129
  - When `robotCode` is empty it falls back to `clientId`.
127
130
  - `cardTemplateId` can be left empty for now; configuring an AI Card is recommended for real use.
128
131
  - `allowFrom: []` means all senders are allowed; during a limited rollout, fill in tester staff IDs.
@@ -134,7 +137,7 @@ Start the daemon:
134
137
  pipiclaw
135
138
  ```
136
139
 
137
- In DingTalk, send `/model` to inspect the model reference, then send a normal message to verify a real call:
140
+ In DingTalk, message the bot directly or @ it in a group — there is no desk to create or bind. New DMs and groups join the default desk on their first authorized message; `allowFrom` still controls who may use it. Send `/model` to inspect the model reference, and a normal message to verify a real call:
138
141
 
139
142
  ```text
140
143
  Please introduce yourself and explain what you can do right now
@@ -177,11 +180,11 @@ Common control entry points:
177
180
 
178
181
  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
182
 
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.
183
+ Long-running external delegations should run in the long-lived daemon; without one, the runtime embedded in `pipiclaw tui` handles external-run completions only while the terminal is open.
181
184
 
182
185
  ### 5. Optional: enable web tools
183
186
 
184
- `web_search` / `web_fetch` are off by default. Edit `~/.pipiclaw/tools.json`, set `tools.web.enable: true`, and configure a search provider. DuckDuckGo, Brave, Tavily, Jina, and SearXNG are supported; see [Configuration reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md) for the full fields.
187
+ `web_search` / `web_fetch` are off by default. Edit `~/.pipiclaw/tools.json`, set `tools.web.enable: true`, and configure a search provider. DuckDuckGo, Tavily, Jina, and SearXNG are supported; DuckDuckGo is the default. See [Configuration reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md) for the full fields.
185
188
 
186
189
  <details>
187
190
  <summary>Let your favorite AI agent install it for you</summary>
@@ -195,8 +198,8 @@ Please install and initialize Pipiclaw for me:
195
198
  2. Run npm install -g @oyasmi/pipiclaw; on a permission failure do not sudo on your own.
196
199
  3. Run pipiclaw once to initialize ~/.pipiclaw/; it prompting you to complete channel.json and exiting because it is still a template is normal.
197
200
  4. Ask me whether I want to use an API key, a custom provider, or a subscription login supported by pipiclaw auth login; do not invent missing values.
198
- 5. If I want to connect DingTalk, collect clientId, clientSecret, optional cardTemplateId, and allowFrom item by item, write them into channel.json, and remove all your-* placeholder values.
199
- 6. When configuration is done, ask first whether to start. Terminal mode uses pipiclaw tui; DingTalk mode uses pipiclaw.
201
+ 5. If I want to connect DingTalk, collect clientId, clientSecret, optional cardTemplateId, and allowFrom item by item, write them into the `dingtalk` section of channel.json, and remove all your-* placeholder values.
202
+ 6. When configuration is done, ask first whether to start. Terminal mode uses pipiclaw tui; DingTalk mode uses pipiclaw, and after it starts message the bot directly or @ it in a group — no desk needs to be created or bound.
200
203
  7. Honestly list the operations performed, files changed, verification results, and information still missing; do not pretend it succeeded.
201
204
  ```
202
205
 
@@ -210,14 +213,15 @@ Please install and initialize Pipiclaw for me:
210
213
  | `/stop` | Stop the current turn; a task-driven turn also pauses its task |
211
214
  | `/steer <message>` | Adjust the running turn |
212
215
  | `/followup <message>` | Queue the next request |
216
+ | `/desk [list\|new <name>\|bind <name>]` | Advanced: create a desk, or switch the current channel to another desk |
213
217
  | `/status` | Execution status, model, context, uptime, and version |
214
- | `/usage [7d\|month]` | Model usage and cost for this channel and globally |
218
+ | `/usage [7d\|month]` | Model usage and cost for the current desk and globally |
215
219
  | `/tasks ...` | View, diagnose, and control long-running tasks |
216
220
  | `/subagents ...` | View and control delegation runs and the role directory |
217
- | `/memory ...` | View this channel's long-term memory |
221
+ | `/memory ...` | View the current desk's long-term memory |
218
222
  | `/model [ref]` | View or switch the model |
219
223
 
220
- `/help`, `/stop`, `/steer`, `/followup`, `/events`, `/tasks`, `/status`, `/usage`, `/context`, and `/subagents` are handled directly by the runtime and work mid-turn. `/stop` does not cancel an already dispatched delegation run; use `/subagents cancel`.
224
+ `/help`, `/stop`, `/steer`, `/followup`, `/desk`, `/events`, `/tasks`, `/status`, `/usage`, `/context`, and `/subagents` are handled directly by the runtime and work mid-turn. `/stop` does not cancel an already dispatched delegation run; use `/subagents cancel`.
221
225
 
222
226
  See [Interaction and commands](https://github.com/oyasmi/pipiclaw/blob/main/docs/interaction-and-commands.md) for full interaction details.
223
227
 
package/README.md CHANGED
@@ -4,9 +4,7 @@
4
4
 
5
5
  **把钉钉变成一个能持续工作的 AI 工程入口。**
6
6
 
7
- Pipiclaw 是一个面向个人和团队的 AI coding assistant runtime。它让 AI 助手不只回答一轮问题,而是能留在你的钉钉里理解上下文、操作工作区、记住长期约定、按计划继续任务,还能把重活委派给 Claude Code、Codex CLI 或你自己的执行器。
8
-
9
- 你看到的是一个助手,背后可以是一支分工明确的 AI 工程团队:主智能体负责理解目标和交付结果,轻量子智能体负责检索与整理,外部智能体负责跨文件实现、独立评审和运行验收。所有工作都有状态、有产物、有控制入口,而不是散落在几个终端窗口里的临时对话。
7
+ Pipiclaw 是面向个人开发者、以钉钉为主要入口的 AI 编程助手运行时。你可以在钉钉或终端交办目标,让它保留工作上下文、在后台持续推进,并按需要调用你已有的模型、Claude Code、Codex CLI 或自定义执行器;过程中可查看进展、补充要求、暂停或取消,最终取得成果和检查依据。
10
8
 
11
9
  - npm:[`@oyasmi/pipiclaw`](https://www.npmjs.com/package/@oyasmi/pipiclaw)
12
10
  - 运行环境:Node.js `>= 22.19.0`,Linux / macOS;Windows 请使用 WSL2
@@ -14,21 +12,21 @@ Pipiclaw 是一个面向个人和团队的 AI coding assistant runtime。它让
14
12
 
15
13
  ## 为什么用 Pipiclaw
16
14
 
17
- ### 一个入口,协调多个智能体
15
+ ### 按需使用已有执行器
18
16
 
19
17
  Pipiclaw 同时支持两类委派:内置子智能体在进程内完成检索、日志筛查等轻量工作;外部智能体则启动真实的 Claude Code、Codex CLI 或任意脚本,处理需要长时间运行、跨多个文件和反复自测的重型任务。
20
18
 
21
- 在钉钉常驻模式中,外部任务派发后在后台继续执行,完成时自动唤醒原频道。你可以随时用 `/subagents` 查看运行状态、实际命令和产出,用 `/subagents cancel` 直接终止,也可以让主智能体在已结束的 Claude Code / Codex 会话上继续追问。仓库附带按能力与成本组织的推荐条目,以及可参考的早期岗位角色模板。
19
+ 在钉钉常驻模式中,外部任务派发后在后台继续执行,完成时自动唤醒发起委派的频道。你可以随时用 `/subagents` 查看运行状态、实际命令和产出,用 `/subagents cancel` 直接终止,也可以让主智能体在已结束的 Claude Code / Codex 会话上继续追问。仓库附带按能力与成本组织的推荐条目,以及可参考的早期岗位角色模板。
22
20
 
23
21
  ### 工作不会随着一次对话结束
24
22
 
25
- 每个频道都有独立的持久会话、长期记忆索引和按天日志。任务是一次性项目,用 Markdown 保存目标、完成标准和工作项,用 JSONL 循环日志记录步骤、派发与结算;内建 task driver 推进可运行任务、兑现到期等待票并处理兜底超时,周期与定时工作由事件模板每次生成独立任务实例,预算耗尽、空转或连续无法兑现等待时会停止并告诉你。
23
+ Pipiclaw 是你的同一个个人助手:终端、钉钉私聊和多个群聊默认共享长期记忆、按天日志、任务、定时事件和工作文件(都记在默认工位 `default` 里),各自保留独立对话,直接聊天即可。共享也意味着私聊里告诉助手的事,可能在群里被想起;需要把项目或用途分开时,再使用进阶的 [工位机制](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md#按需分开工位):每个工位有独立的记忆、任务和文件。任务是一次性项目,用 Markdown 保存目标、完成标准和工作项,用 JSONL 任务记录步骤、派发与结算;任务在后台的任务车道里独立执行,不占用聊天,你可以随时用 `/tasks` 查看进度、补充指示、暂停或取消,周期与定时工作由事件模板每次生成独立任务实例,预算耗尽、空转、单步超时或连续出错时会停止并告诉你。
26
24
 
27
25
  ### 原生工作在钉钉里
28
26
 
29
27
  Pipiclaw 使用钉钉 Stream Mode,不需要自建消息中转服务或公网 IP。AI Card 可以持续显示思考、工具执行和状态更新;任务进行中仍可用 `/steer` 调整方向、`/followup` 排队下一件事、`/stop` 中止当前回合。生成的报表、截图和导出文件可以作为钉钉原生附件直接交付。
30
28
 
31
- 同一个机器人实例可以同时服务多个私聊和群聊:私聊按用户、群聊按群分别建立 channel,不同 channel 的模型回合可以并行推进;同一 channel 内则串行执行,避免一段对话的上下文被多个回合同时修改。需要注意的是,会话隔离不等于代码目录隔离;如果多个 channel 指向同一个项目目录,仍应避免让主智能体同时修改同一批文件,或为并行实现准备独立的 Git worktree。完整边界见[并发与容量](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md)。
29
+ 同一个机器人实例可以同时服务多个私聊和群聊:每个私聊、每个群都是一个频道,不同频道的模型回合可以并行推进;同一频道内则串行执行,避免一段对话的上下文被多个回合同时修改。需要注意的是,工位之间的隔离不等于代码目录隔离;如果多个频道指向同一个项目目录,仍应避免让主智能体同时修改同一批文件,或为并行实现准备独立的 Git worktree。完整边界见[并发与容量](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md)。
32
30
 
33
31
  ### 能自主,也能随时接管
34
32
 
@@ -36,17 +34,17 @@ Pipiclaw 使用钉钉 Stream Mode,不需要自建消息中转服务或公网 I
36
34
 
37
35
  ### 配置、数据和工作方式归你所有
38
36
 
39
- 模型支持内置 provider、OpenAI-compatible 网关、API key 和订阅登录。记忆、任务、角色、事件与团队规则都保存在本机可阅读文件中。Pipiclaw 提供命令、路径和网络守卫以及审计记录;需要更强隔离时,可把整个进程放进独立账号或容器。
37
+ 模型支持内置 provider、OpenAI-compatible 网关、API key 和订阅登录。记忆、任务、角色、事件与工作规则都保存在本机可阅读文件中。Pipiclaw 提供命令、路径和网络守卫以及审计记录;需要更强隔离时,可把整个进程放进独立账号或容器。
40
38
 
41
39
  ## 适合做什么
42
40
 
43
41
  - 在钉钉中提供长期在线的研发助手、内部技术支持或运维协作入口
44
- - 把需求分析、实现、评审、验证、文档整理交给不同 AI 智能体协作完成
42
+ - 交付包含实现、测试、文档和必要检查的完整改动,按风险安排独立检查
45
43
  - 跟进跨小时或跨天的编码、调查、迁移、报告和周期性工作
46
- - 在多个群和私聊中保留彼此隔离的上下文与记忆
47
- - 复用现有模型网关、Claude Code / Codex CLI 账号和团队工作规范
44
+ - 在多个群和私聊中保留各自独立的对话;默认共享同一份积累,需要分开时再用工位
45
+ - 复用现有模型网关、Claude Code / Codex CLI 账号和个人或项目工作规范
48
46
 
49
- Pipiclaw 当前定位是个人与小团队、自托管、单实例运行。它不是强多租户 SaaS,也不提供 OS 级沙箱;外部智能体拥有的真实权限由目标 CLI 的 sandbox 参数、运行账号和宿主环境共同决定。
47
+ Pipiclaw 面向个人开发者,支持自托管和单实例运行。它不是强多租户 SaaS,也不提供 OS 级沙箱;外部智能体拥有的真实权限由目标 CLI 的 sandbox 参数、运行账号和宿主环境共同决定。
50
48
 
51
49
  ## 快速开始
52
50
 
@@ -63,13 +61,13 @@ pipiclaw tui --help
63
61
 
64
62
  ```text
65
63
  ~/.pipiclaw/
66
- ├── channel.json # 钉钉应用
64
+ ├── channel.json # 渠道开关:钉钉应用、Web API
67
65
  ├── auth.json # 模型凭据
68
66
  ├── models.json # 自定义模型提供方
69
67
  ├── settings.json # 默认模型与运行设置
70
68
  ├── tools.json # Web 工具、任务等能力开关
71
69
  ├── security.json # 命令、路径与网络守卫
72
- └── workspace/ # 记忆、任务、事件、skills、智能体角色和频道数据
70
+ └── workspace/ # 共享配置与扩展;默认工位的数据在 desk-default/
73
71
  ```
74
72
 
75
73
  设置 `PIPICLAW_HOME=/your/path` 可以整体迁移这个目录。
@@ -86,7 +84,7 @@ export ANTHROPIC_API_KEY=sk-ant-...
86
84
  pipiclaw auth login
87
85
  ```
88
86
 
89
- 然后启动:
87
+ 然后直接在终端里聊天(首次运行自动初始化默认工位):
90
88
 
91
89
  ```bash
92
90
  pipiclaw tui
@@ -98,7 +96,7 @@ pipiclaw tui
98
96
  pipiclaw tui --print "只回复:Pipiclaw 模型调用成功"
99
97
  ```
100
98
 
101
- 看到模型实际回复才表示调用链路已经跑通;`pipiclaw tui --help` 或 `/model` 只能证明 CLI 或模型目录可见。正式工作前可用 `/project` 确认当前项目目录。如需接入企业网关、本地模型或指定默认模型,请看[配置速查](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md)。
99
+ 看到模型实际回复才表示调用链路已经跑通;`pipiclaw tui --help` 或 `/model` 只能证明 CLI 或模型目录可见。如需接入企业网关、本地模型或指定默认模型,请看[配置速查](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md)。
102
100
 
103
101
  ### 3. 接入钉钉
104
102
 
@@ -113,15 +111,20 @@ pipiclaw tui --print "只回复:Pipiclaw 模型调用成功"
113
111
 
114
112
  ```json
115
113
  {
116
- "clientId": "your-dingtalk-client-id",
117
- "clientSecret": "your-dingtalk-client-secret",
118
- "robotCode": "",
119
- "cardTemplateId": "",
120
- "cardTemplateKey": "content",
121
- "allowFrom": []
114
+ "dingtalk": {
115
+ "enabled": true,
116
+ "clientId": "your-dingtalk-client-id",
117
+ "clientSecret": "your-dingtalk-client-secret",
118
+ "robotCode": "",
119
+ "cardTemplateId": "",
120
+ "cardTemplateKey": "content",
121
+ "allowFrom": []
122
+ },
123
+ "webapi": { "enabled": false, "socket": true }
122
124
  }
123
125
  ```
124
126
 
127
+ - `dingtalk` 和 `webapi` 两段各有 `enabled` 开关,至少打开一个;`webapi` 让脚本和其他客户端通过官方 OpenAI SDK 连接自己的助手(支持已实现的 Responses 子集)(见 [Web API](https://github.com/oyasmi/pipiclaw/blob/main/docs/webapi.md))。
125
128
  - 硬性必填只有 `clientId` 和 `clientSecret`。
126
129
  - `robotCode` 留空时回退到 `clientId`。
127
130
  - `cardTemplateId` 可暂时留空;正式使用建议配置 AI Card。
@@ -134,7 +137,7 @@ pipiclaw tui --print "只回复:Pipiclaw 模型调用成功"
134
137
  pipiclaw
135
138
  ```
136
139
 
137
- 先在钉钉里发送 `/model` 检查模型引用,再发送一条普通消息验证真实调用:
140
+ 在钉钉中直接私聊,或把机器人拉进群后 @它,无需创建或绑定工位。新私聊和新群默认接入默认工位;`allowFrom` 仍控制哪些发送者可以使用。发送 `/model` 检查模型引用,再发送一条普通消息验证真实调用:
138
141
 
139
142
  ```text
140
143
  请介绍一下你自己,并说明你现在能做什么
@@ -177,11 +180,11 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.m
177
180
 
178
181
  外部智能体不会经过 Pipiclaw 的命令和路径守卫。上述推荐条目使用放开权限的 CLI 参数;使用前必须阅读[智能体委派指南](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md)中的授权、安全边界和 sandbox 说明。
179
182
 
180
- 长时间外部委派应运行在钉钉 daemon 中;TUI 当前不提供外部 run 的完成通知和退出后的重新认领。
183
+ 长时间外部委派应运行在常驻 daemon 中;没有 daemon 时终端内嵌的运行时只在终端打开期间处理外部 run 的完成通知。
181
184
 
182
185
  ### 5. 可选:启用 Web 工具
183
186
 
184
- `web_search` / `web_fetch` 默认关闭。编辑 `~/.pipiclaw/tools.json`,设置 `tools.web.enable: true` 并配置搜索 provider。支持 DuckDuckGo、Brave、Tavily、Jina 和 SearXNG;完整字段见[配置速查](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md)。
187
+ `web_search` / `web_fetch` 默认关闭。编辑 `~/.pipiclaw/tools.json`,设置 `tools.web.enable: true` 并配置搜索 provider。支持 DuckDuckGo、Tavily、Jina 和 SearXNG,默认使用 DuckDuckGo;完整字段见[配置速查](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md)。
185
188
 
186
189
  <details>
187
190
  <summary>让你常用的 AI Agent 帮忙安装</summary>
@@ -195,8 +198,8 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.m
195
198
  2. 执行 npm install -g @oyasmi/pipiclaw;权限失败时不要自行 sudo。
196
199
  3. 运行一次 pipiclaw 初始化 ~/.pipiclaw/;它因 channel.json 仍是模板而提示补全并退出是正常现象。
197
200
  4. 询问我要使用 API key、自定义 provider,还是 pipiclaw auth login 支持的订阅登录;不要编造缺失值。
198
- 5. 如果我要接入钉钉,逐项收集 clientId、clientSecret、可选的 cardTemplateId 和 allowFrom,写入 channel.json,并清除所有 your-* 占位值。
199
- 6. 配置完成后先询问是否启动。终端模式用 pipiclaw tui;钉钉模式用 pipiclaw。
201
+ 5. 如果我要接入钉钉,逐项收集 clientId、clientSecret、可选的 cardTemplateId 和 allowFrom,写入 channel.json 的 dingtalk 段,并清除所有 your-* 占位值。
202
+ 6. 配置完成后先询问是否启动。终端模式用 pipiclaw tui;钉钉模式用 pipiclaw,启动后直接私聊或在群里 @机器人,无需创建或绑定工位。
200
203
  7. 如实列出做过的操作、修改的文件、验证结果和仍缺少的信息,不要假装成功。
201
204
  ```
202
205
 
@@ -210,14 +213,15 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.m
210
213
  | `/stop` | 停止当前回合;任务驱动的回合会同时暂停对应任务 |
211
214
  | `/steer <消息>` | 调整正在执行的回合 |
212
215
  | `/followup <消息>` | 排队下一条请求 |
216
+ | `/desk [list\|new <名字>\|bind <名字>]` | 进阶:创建工位,或把当前频道切换到另一个工位 |
213
217
  | `/status` | 查看执行状态、模型、上下文、运行时长和版本 |
214
- | `/usage [7d\|month]` | 查看本频道与全局的模型用量和成本 |
218
+ | `/usage [7d\|month]` | 查看当前工位与全局的模型用量和成本 |
215
219
  | `/tasks ...` | 查看、诊断和控制长期任务 |
216
220
  | `/subagents ...` | 查看、控制委派 run 和角色目录 |
217
- | `/memory ...` | 查看当前频道的长期记忆 |
221
+ | `/memory ...` | 查看当前工位的长期记忆 |
218
222
  | `/model [引用]` | 查看或切换模型 |
219
223
 
220
- `/help`、`/stop`、`/steer`、`/followup`、`/events`、`/tasks`、`/status`、`/usage`、`/context` 和 `/subagents` 由运行时直接处理,回合进行中也能使用。`/stop` 不会取消已经派发的委派 run;请使用 `/subagents cancel`。
224
+ `/help`、`/stop`、`/steer`、`/followup`、`/desk`、`/events`、`/tasks`、`/status`、`/usage`、`/context` 和 `/subagents` 由运行时直接处理,回合进行中也能使用。`/stop` 不会取消已经派发的委派 run;请使用 `/subagents cancel`。
221
225
 
222
226
  完整交互说明见[交互与命令](https://github.com/oyasmi/pipiclaw/blob/main/docs/interaction-and-commands.md)。
223
227
 
@@ -3,7 +3,6 @@
3
3
  * "nothing to stop/steer" replies). The stateless report commands (`/tasks`, `/events`, …) never
4
4
  * reach here — they go through `commands/router.ts`.
5
5
  */
6
- import type { ChannelContext } from "../channel/channel-context.js";
7
6
  import { type RunnerBuiltInCommand } from "../commands/catalog.js";
8
7
  /** The slice of the runner a built-in command reads; everything else it needs is the command itself. */
9
8
  export interface BuiltinCommandHost {
@@ -16,4 +15,10 @@ export interface BuiltinCommandHost {
16
15
  }
17
16
  /** A `/steer` or `/followup` needs a message: the trimmed text, or an error telling the user how. */
18
17
  export declare function requireQueuedMessage(text: string, commandName: "steer" | "followup"): string;
19
- export declare function handleBuiltinCommand(host: BuiltinCommandHost, ctx: ChannelContext, command: RunnerBuiltInCommand): Promise<void>;
18
+ /**
19
+ * The reply to a runner-handled built-in command. It is returned, not delivered: the caller sends
20
+ * it as a command reply (titled, never archived — command echoes are ephemeral control-plane
21
+ * traffic, not conversation, and must not be re-consumed as memory-extraction input; review
22
+ * 2026-08-24 §1.2).
23
+ */
24
+ export declare function handleBuiltinCommand(host: BuiltinCommandHost, command: RunnerBuiltInCommand): Promise<string>;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * The runner-handled built-in slash commands typed on an idle channel (`/help`, `/context`, and the
3
+ * "nothing to stop/steer" replies). The stateless report commands (`/tasks`, `/events`, …) never
4
+ * reach here — they go through `commands/router.ts`.
5
+ */
1
6
  import { formatMissingQueueMessage, formatNoRunningTurn, renderBuiltInHelp, } from "../commands/catalog.js";
2
7
  import * as log from "../log.js";
3
8
  import { errorMessage } from "../shared/text-utils.js";
@@ -28,17 +33,13 @@ function renderHelpWithDiscovery(host, args) {
28
33
  }
29
34
  return sections.join("\n\n");
30
35
  }
31
- async function sendCommandReply(ctx, text, commandName) {
32
- // Command echoes are ephemeral control-plane traffic, not conversation: keep them out of
33
- // log.jsonl so they are never re-consumed as memory-extraction input (review 2026-08-24 §1.2).
34
- const title = commandName ? `/${commandName}` : undefined;
35
- const delivered = await ctx.respondPlain(text, false, title);
36
- if (!delivered) {
37
- await ctx.replaceMessage(text);
38
- await ctx.flush();
39
- }
40
- }
41
- export async function handleBuiltinCommand(host, ctx, command) {
36
+ /**
37
+ * The reply to a runner-handled built-in command. It is returned, not delivered: the caller sends
38
+ * it as a command reply (titled, never archived — command echoes are ephemeral control-plane
39
+ * traffic, not conversation, and must not be re-consumed as memory-extraction input; review
40
+ * 2026-08-24 §1.2).
41
+ */
42
+ export async function handleBuiltinCommand(host, command) {
42
43
  try {
43
44
  // `/help` and `/context` read the session (prompt templates, active model).
44
45
  // The session runtime is built asynchronously after construction, so a command
@@ -46,24 +47,19 @@ export async function handleBuiltinCommand(host, ctx, command) {
46
47
  await host.ensureSessionReady();
47
48
  switch (command.name) {
48
49
  case "help":
49
- await sendCommandReply(ctx, renderHelpWithDiscovery(host, command.args), "help");
50
- return;
50
+ return renderHelpWithDiscovery(host, command.args);
51
51
  case "context":
52
- await sendCommandReply(ctx, host.renderContextReport(command.args), "context");
53
- return;
52
+ return host.renderContextReport(command.args);
54
53
  case "stop":
55
- await sendCommandReply(ctx, formatNoRunningTurn("stop"), "stop");
56
- return;
54
+ return formatNoRunningTurn("stop");
57
55
  case "steer":
58
56
  requireQueuedMessage(command.args, "steer");
59
- await sendCommandReply(ctx, formatNoRunningTurn("steer"), "steer");
60
- return;
57
+ return formatNoRunningTurn("steer");
61
58
  case "followup":
62
59
  requireQueuedMessage(command.args, "followup");
63
- await sendCommandReply(ctx, formatNoRunningTurn("followup"), "followup");
64
- return;
60
+ return formatNoRunningTurn("followup");
65
61
  default: {
66
- // The stateless report commands (events/tasks/status/usage/subagents/project — see
62
+ // The stateless report commands (events/tasks/status/usage/subagents/skills — see
67
63
  // `BUILT_IN_COMMANDS`'s `runnerHandled: false` entries) are routed to their own
68
64
  // handlers upstream and never reach here; the narrowed parameter type makes that a
69
65
  // compile-time guarantee.
@@ -75,6 +71,6 @@ export async function handleBuiltinCommand(host, ctx, command) {
75
71
  catch (err) {
76
72
  const errMsg = errorMessage(err);
77
73
  log.logWarn("agent.command.failed", "Built-in command failed", { channelId: host.channelId, reason: errMsg });
78
- await sendCommandReply(ctx, `命令执行失败:${errMsg}`, command.name);
74
+ return `命令执行失败:${errMsg}`;
79
75
  }
80
76
  }
@@ -1,32 +1,28 @@
1
1
  import type { ChannelContext } from "../channel/channel-context.js";
2
2
  import type { InboundImage } from "../channel/channel-event.js";
3
3
  import type { ChannelStore } from "../channel/store.js";
4
+ import type { TurnInfo } from "../channel/transport.js";
4
5
  import { type RunnerBuiltInCommand } from "../commands/catalog.js";
6
+ import type { DeskConversation } from "../desk/types.js";
5
7
  import type { MemoryMaintenanceRuntimeContext } from "../memory/scheduler.js";
6
8
  import type { SubAgentDiscoveryResult } from "../subagents/discovery.js";
7
- import type { UsageTotals } from "../usage/totals.js";
8
9
  import type { RunnerDeps, RunnerFactoryPaths } from "./types.js";
9
- import { type AgentRunner, type RunnerStatusSnapshot, type TurnStatus } from "./types.js";
10
+ import { type AgentRunner, type RunnerActivity, type RunnerStatusSnapshot, type TurnStatus } from "./types.js";
10
11
  export declare class ChannelRunner implements AgentRunner {
11
12
  private readonly executor;
12
13
  private readonly jobManager;
13
14
  private readonly runManager;
14
15
  private readonly fileStore;
16
+ readonly conversation: DeskConversation;
15
17
  private readonly channelId;
16
- private readonly channelDir;
18
+ /** This channel's conversation directory inside the desk: sessions, active pointer, archive. */
19
+ private readonly conversationDir;
17
20
  private readonly appHomeDir;
18
21
  private readonly authConfigPath;
19
22
  private readonly modelsConfigPath;
20
23
  private readonly onSessionEvent?;
21
- private readonly mediaSender?;
24
+ private readonly sendMedia?;
22
25
  private readonly workspaceDir;
23
- /**
24
- * Frozen for the lifetime of this runner generation (spec 043, D4.2): AgentSession, the
25
- * ResourceLoader, and every tool closure built in this constructor and in `createSessionRuntime`
26
- * (session-topology rebuilds only rebind the session, never the scope) all read this same value.
27
- * Changing project is a dispose-and-rebuild of the whole runner, not a field mutation.
28
- */
29
- private readonly projectScope;
30
26
  /** Re-read per use, not captured once: an edited security.json takes effect without a restart. */
31
27
  private readonly loadSecurityConfig;
32
28
  private readonly settingsManager;
@@ -34,6 +30,7 @@ export declare class ChannelRunner implements AgentRunner {
34
30
  private readonly turnFinisher;
35
31
  private readonly pipeline;
36
32
  private readonly memoryLifecycle;
33
+ private readonly profile;
37
34
  private readonly ledger;
38
35
  private readonly memoryActivityRecorder;
39
36
  private readonly models;
@@ -43,7 +40,7 @@ export declare class ChannelRunner implements AgentRunner {
43
40
  /** Set once transport-level `/new` replaces this generation. A retired runner is never reused. */
44
41
  private retired;
45
42
  private runState;
46
- constructor(channelId: string, channelDir: string, paths: RunnerFactoryPaths, deps: RunnerDeps);
43
+ constructor(conversation: DeskConversation, paths: RunnerFactoryPaths, deps: RunnerDeps);
47
44
  private get session();
48
45
  private get sessionManager();
49
46
  beginTurn(taskText: string): void;
@@ -52,15 +49,8 @@ export declare class ChannelRunner implements AgentRunner {
52
49
  isBusy(): boolean;
53
50
  requestStop(): void;
54
51
  getTurnStatus(): TurnStatus;
55
- run(ctx: ChannelContext, store: ChannelStore): Promise<{
56
- stopReason: string;
57
- errorMessage?: string;
58
- usage: UsageTotals;
59
- costKnown: boolean;
60
- durationMs: number;
61
- silent: boolean;
62
- }>;
63
- handleBuiltinCommand(ctx: ChannelContext, command: RunnerBuiltInCommand): Promise<void>;
52
+ run(info: TurnInfo, channel: ChannelContext, store: ChannelStore): ReturnType<AgentRunner["run"]>;
53
+ handleBuiltinCommand(command: RunnerBuiltInCommand): Promise<string>;
64
54
  /**
65
55
  * True if `text` is a slash command the runtime or session layer can handle:
66
56
  * a built-in, a session command (`/model` …), a skill (`/skill:name`), or a
@@ -69,15 +59,19 @@ export declare class ChannelRunner implements AgentRunner {
69
59
  * full LLM turn.
70
60
  */
71
61
  isKnownSlashCommand(text: string): boolean;
72
- queueSteer(text: string, userName?: string, images?: InboundImage[]): Promise<void>;
62
+ private taskQueueSeq?;
63
+ get generation(): string;
64
+ queueSteer(text: string, userName?: string, images?: InboundImage[], scope?: import("./types.js").TaskSteerScope): Promise<"queued" | "stale">;
65
+ clearTaskStepQueue(seq: number): void;
73
66
  flushMemoryForShutdown(): Promise<void>;
74
67
  dispose(): Promise<void>;
75
68
  getMemoryMaintenanceContext(): Promise<MemoryMaintenanceRuntimeContext>;
76
- getStatusSnapshot(): RunnerStatusSnapshot;
69
+ getStatusSnapshot(): RunnerStatusSnapshot | undefined;
77
70
  abort(): Promise<void>;
78
71
  isCompacting(): boolean;
79
72
  interruptCompaction(): boolean;
80
73
  retireForNewSession(): void;
74
+ retireForRecovery(): void;
81
75
  /**
82
76
  * `/context` — read-only prompt accounting, no LLM cost. Reports the section
83
77
  * breakdown of the system prompt, the tool schemas (billed on top of it, and
@@ -86,18 +80,11 @@ export declare class ChannelRunner implements AgentRunner {
86
80
  renderContextReport(args?: string): string;
87
81
  /** `/subagents list`'s role-directory health tail — whatever this runner already discovered. */
88
82
  getSubAgentDiscoverySnapshot(): SubAgentDiscoveryResult;
89
- /**
90
- * Bind this runner to a task cycle's own session (spec 051, D3/INV-5): task work must not
91
- * accumulate in the channel's chat transcript, so each task turn runs in its own bounded session
92
- * while turn state, `/stop` and delivery stay exactly where they already are.
93
- */
94
- bindTaskSession(taskId: string): Promise<void>;
95
- /** Return to the channel's chat session after a task step. Safe to call when already bound. */
96
- bindChatSession(): Promise<void>;
97
- /** Which task loop this runner is currently bound to, if any. */
98
- getTaskLoop(): {
99
- taskId: string;
100
- } | undefined;
83
+ getActivity(): RunnerActivity;
84
+ contextIncludes(needle: string): Promise<boolean>;
85
+ /** The session file this profile opens: the channel's active chat session, a task's own, or none (a request lives in memory). */
86
+ private openSessionFile;
87
+ private openSessionManager;
101
88
  /**
102
89
  * Buffer one activity event. The write itself is batched by the recorder (see
103
90
  * `createMemoryActivityRecorder`); `run()` flushes at the end of every turn, which is the
@@ -106,5 +93,6 @@ export declare class ChannelRunner implements AgentRunner {
106
93
  private recordMemoryActivity;
107
94
  /** Best-effort: a lost activity counter delays maintenance, it never breaks a turn. */
108
95
  private flushMemoryActivity;
96
+ private cancelOutput;
109
97
  private resetRunState;
110
98
  }