@oyasmi/pipiclaw 0.9.4-beta.2 → 0.9.5-beta.2

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 (405) hide show
  1. package/README.en.md +28 -22
  2. package/README.md +27 -21
  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 +13 -13
  6. package/dist/agent/channel-runner.js +93 -76
  7. package/dist/agent/maintenance-context.d.ts +6 -5
  8. package/dist/agent/maintenance-context.js +15 -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 +4 -4
  13. package/dist/agent/runner-factory.d.ts +6 -6
  14. package/dist/agent/runner-factory.js +6 -7
  15. package/dist/agent/session/compaction-input.d.ts +6 -0
  16. package/dist/agent/session/compaction-input.js +75 -0
  17. package/dist/agent/session/compaction-snapshot.d.ts +30 -0
  18. package/dist/agent/session/compaction-snapshot.js +154 -0
  19. package/dist/agent/session/compaction-summary.d.ts +39 -0
  20. package/dist/agent/session/compaction-summary.js +158 -0
  21. package/dist/agent/session/compaction.d.ts +35 -0
  22. package/dist/agent/session/compaction.js +294 -0
  23. package/dist/agent/session/context-input.d.ts +15 -0
  24. package/dist/agent/session/context-input.js +82 -0
  25. package/dist/agent/session/context-snapshot.d.ts +11 -0
  26. package/dist/agent/session/context-snapshot.js +72 -0
  27. package/dist/agent/session/event-guards.d.ts +2 -0
  28. package/dist/agent/session/event-guards.js +4 -0
  29. package/dist/agent/session/request-tools.d.ts +3 -0
  30. package/dist/agent/session/request-tools.js +20 -0
  31. package/dist/agent/session/session-adapter.d.ts +2 -1
  32. package/dist/agent/session/session-adapter.js +6 -3
  33. package/dist/agent/session/session-events.d.ts +5 -4
  34. package/dist/agent/session/session-events.js +46 -59
  35. package/dist/agent/session/session-host.d.ts +29 -41
  36. package/dist/agent/session/session-host.js +86 -69
  37. package/dist/agent/session/settings-diagnostics.d.ts +5 -0
  38. package/dist/agent/session/settings-diagnostics.js +21 -0
  39. package/dist/agent/status-render.js +5 -2
  40. package/dist/{runtime → agent}/stop-watchdog.d.ts +3 -1
  41. package/dist/{runtime → agent}/stop-watchdog.js +7 -3
  42. package/dist/agent/turn/progress-formatter.d.ts +1 -3
  43. package/dist/agent/turn/progress-formatter.js +3 -22
  44. package/dist/agent/turn/task-digest.d.ts +4 -2
  45. package/dist/agent/turn/task-digest.js +7 -4
  46. package/dist/agent/turn/turn-context.d.ts +11 -7
  47. package/dist/agent/turn/turn-context.js +26 -18
  48. package/dist/agent/turn/turn-finish.d.ts +17 -5
  49. package/dist/agent/turn/turn-finish.js +51 -77
  50. package/dist/agent/turn/turn-input.d.ts +2 -2
  51. package/dist/agent/turn/turn-input.js +4 -3
  52. package/dist/agent/turn/turn-output.d.ts +19 -0
  53. package/dist/agent/turn/turn-output.js +41 -0
  54. package/dist/agent/turn/turn-pipeline.d.ts +11 -8
  55. package/dist/agent/turn/turn-pipeline.js +54 -55
  56. package/dist/agent/turn/turn-prompt.d.ts +1 -1
  57. package/dist/agent/turn/turn-recovery.d.ts +11 -10
  58. package/dist/agent/turn/turn-recovery.js +14 -29
  59. package/dist/agent/types.d.ts +31 -12
  60. package/dist/agent/types.js +2 -1
  61. package/dist/app/auth-command.js +1 -1
  62. package/dist/app/home.js +31 -15
  63. package/dist/channel/active-session-store.d.ts +14 -12
  64. package/dist/channel/active-session-store.js +29 -25
  65. package/dist/channel/attachments.d.ts +25 -0
  66. package/dist/channel/attachments.js +56 -0
  67. package/dist/channel/channel-context.d.ts +87 -96
  68. package/dist/channel/channel-context.js +1 -66
  69. package/dist/channel/channel-event.d.ts +51 -41
  70. package/dist/channel/channel-event.js +6 -11
  71. package/dist/channel/channel-id.d.ts +22 -0
  72. package/dist/channel/channel-id.js +13 -0
  73. package/dist/channel/channel-index.d.ts +17 -34
  74. package/dist/channel/channel-index.js +41 -80
  75. package/dist/channel/config.d.ts +10 -0
  76. package/dist/channel/config.js +55 -0
  77. package/dist/channel/ingress.d.ts +101 -0
  78. package/dist/channel/ingress.js +5 -0
  79. package/dist/channel/store.d.ts +13 -15
  80. package/dist/channel/store.js +21 -25
  81. package/dist/channel/transport.d.ts +99 -0
  82. package/dist/channel/turn-context.d.ts +23 -0
  83. package/dist/channel/turn-context.js +1 -0
  84. package/dist/commands/catalog.d.ts +4 -7
  85. package/dist/commands/catalog.js +24 -31
  86. package/dist/commands/router.d.ts +23 -12
  87. package/dist/commands/router.js +22 -24
  88. package/dist/config/settings.d.ts +5 -4
  89. package/dist/desk/bindings.d.ts +6 -0
  90. package/dist/desk/bindings.js +105 -0
  91. package/dist/desk/commands.d.ts +81 -0
  92. package/dist/desk/commands.js +145 -0
  93. package/dist/desk/default.d.ts +4 -0
  94. package/dist/desk/default.js +11 -0
  95. package/dist/desk/paths.d.ts +41 -0
  96. package/dist/desk/paths.js +81 -0
  97. package/dist/desk/registry.d.ts +17 -0
  98. package/dist/desk/registry.js +191 -0
  99. package/dist/desk/startup-error.d.ts +4 -0
  100. package/dist/desk/startup-error.js +7 -0
  101. package/dist/desk/types.d.ts +72 -0
  102. package/dist/desk/types.js +7 -0
  103. package/dist/dingtalk/bot.d.ts +18 -35
  104. package/dist/dingtalk/bot.js +21 -204
  105. package/dist/dingtalk/channel-ids.d.ts +15 -0
  106. package/dist/dingtalk/channel-ids.js +39 -0
  107. package/dist/dingtalk/config.d.ts +6 -3
  108. package/dist/dingtalk/config.js +13 -25
  109. package/dist/dingtalk/connection.d.ts +1 -0
  110. package/dist/dingtalk/connection.js +5 -4
  111. package/dist/dingtalk/conversation-meta.d.ts +10 -5
  112. package/dist/dingtalk/conversation-meta.js +72 -50
  113. package/dist/dingtalk/delivery.d.ts +30 -14
  114. package/dist/dingtalk/delivery.js +189 -62
  115. package/dist/dingtalk/inbound-media.d.ts +2 -18
  116. package/dist/dingtalk/inbound-media.js +0 -53
  117. package/dist/dingtalk/inbound.d.ts +10 -11
  118. package/dist/dingtalk/inbound.js +12 -19
  119. package/dist/dingtalk/media.d.ts +9 -11
  120. package/dist/dingtalk/media.js +18 -31
  121. package/dist/dingtalk/progress.d.ts +8 -0
  122. package/dist/dingtalk/progress.js +20 -0
  123. package/dist/dingtalk/response-mode.d.ts +13 -0
  124. package/dist/dingtalk/response-mode.js +31 -0
  125. package/dist/dingtalk/transport.d.ts +47 -0
  126. package/dist/dingtalk/transport.js +71 -0
  127. package/dist/events/commands.d.ts +7 -2
  128. package/dist/events/commands.js +40 -22
  129. package/dist/events/pre-action-error.d.ts +10 -0
  130. package/dist/events/pre-action-error.js +10 -0
  131. package/dist/events/types.d.ts +20 -2
  132. package/dist/events/watcher.d.ts +14 -7
  133. package/dist/events/watcher.js +49 -26
  134. package/dist/index.d.ts +4 -2
  135. package/dist/jobs/completion-wake.d.ts +14 -0
  136. package/dist/jobs/completion-wake.js +36 -0
  137. package/dist/jobs/manager.d.ts +27 -22
  138. package/dist/jobs/manager.js +58 -91
  139. package/dist/jobs/record.d.ts +2 -0
  140. package/dist/jobs/record.js +2 -0
  141. package/dist/log.d.ts +0 -1
  142. package/dist/log.js +1 -1
  143. package/dist/main.js +10 -3
  144. package/dist/memory/boundary-work.d.ts +17 -0
  145. package/dist/memory/boundary-work.js +162 -0
  146. package/dist/memory/commands.d.ts +4 -3
  147. package/dist/memory/commands.js +16 -16
  148. package/dist/memory/desk-memory-queue.d.ts +18 -0
  149. package/dist/memory/desk-memory-queue.js +33 -0
  150. package/dist/memory/index-budget.d.ts +3 -3
  151. package/dist/memory/index-budget.js +3 -3
  152. package/dist/memory/journal.d.ts +6 -6
  153. package/dist/memory/journal.js +14 -14
  154. package/dist/memory/lifecycle.d.ts +14 -21
  155. package/dist/memory/lifecycle.js +73 -103
  156. package/dist/memory/maintenance-state.d.ts +14 -15
  157. package/dist/memory/maintenance-state.js +43 -42
  158. package/dist/memory/reflect-job.d.ts +5 -4
  159. package/dist/memory/reflect-job.js +21 -15
  160. package/dist/memory/reflect.d.ts +2 -1
  161. package/dist/memory/reflect.js +13 -12
  162. package/dist/memory/render.d.ts +1 -1
  163. package/dist/memory/render.js +2 -2
  164. package/dist/memory/review-log.d.ts +4 -4
  165. package/dist/memory/review-log.js +5 -5
  166. package/dist/memory/scheduler.d.ts +12 -19
  167. package/dist/memory/scheduler.js +28 -64
  168. package/dist/memory/session-corpus.d.ts +4 -1
  169. package/dist/memory/session-corpus.js +70 -29
  170. package/dist/memory/session-search.d.ts +11 -3
  171. package/dist/memory/session-search.js +14 -11
  172. package/dist/memory/sidecar-worker.d.ts +1 -0
  173. package/dist/memory/sidecar-worker.js +57 -76
  174. package/dist/memory/source-window.d.ts +0 -6
  175. package/dist/memory/source-window.js +0 -20
  176. package/dist/memory/store.d.ts +12 -12
  177. package/dist/memory/store.js +44 -44
  178. package/dist/paths.d.ts +2 -0
  179. package/dist/paths.js +2 -0
  180. package/dist/playbooks/agent-delegation.md +16 -16
  181. package/dist/playbooks/background-jobs.md +5 -3
  182. package/dist/playbooks/event-scheduling.md +7 -5
  183. package/dist/playbooks/memory-and-learning.md +16 -12
  184. package/dist/playbooks/outbound-media.md +1 -1
  185. package/dist/playbooks/runtime-orientation.md +35 -23
  186. package/dist/playbooks/task-lead.md +13 -11
  187. package/dist/runtime/bootstrap.d.ts +36 -13
  188. package/dist/runtime/bootstrap.js +310 -138
  189. package/dist/runtime/channel-queue.d.ts +23 -0
  190. package/dist/{dingtalk → runtime}/channel-queue.js +20 -9
  191. package/dist/runtime/daemon-lock.d.ts +12 -0
  192. package/dist/runtime/daemon-lock.js +28 -0
  193. package/dist/runtime/desk-runtime.d.ts +131 -0
  194. package/dist/runtime/desk-runtime.js +402 -0
  195. package/dist/runtime/durable-dispatch.d.ts +11 -5
  196. package/dist/runtime/durable-dispatch.js +20 -8
  197. package/dist/runtime/inbound-images.d.ts +32 -10
  198. package/dist/runtime/inbound-images.js +95 -21
  199. package/dist/runtime/ingress-busy.d.ts +26 -0
  200. package/dist/runtime/ingress-busy.js +211 -0
  201. package/dist/runtime/ingress-commands.d.ts +7 -0
  202. package/dist/runtime/ingress-commands.js +162 -0
  203. package/dist/runtime/ingress-deps.d.ts +62 -0
  204. package/dist/runtime/ingress-deps.js +1 -0
  205. package/dist/runtime/ingress.d.ts +22 -0
  206. package/dist/runtime/ingress.js +376 -0
  207. package/dist/runtime/request-execution.d.ts +19 -0
  208. package/dist/runtime/request-execution.js +88 -0
  209. package/dist/runtime/shutdown.d.ts +13 -5
  210. package/dist/runtime/shutdown.js +10 -4
  211. package/dist/runtime/task-driver.d.ts +38 -22
  212. package/dist/runtime/task-driver.js +142 -116
  213. package/dist/runtime/task-spawn.d.ts +4 -4
  214. package/dist/runtime/task-spawn.js +6 -5
  215. package/dist/runtime/task-wake.d.ts +6 -4
  216. package/dist/runtime/task-wake.js +7 -7
  217. package/dist/runtime/transports.d.ts +32 -0
  218. package/dist/runtime/transports.js +101 -0
  219. package/dist/runtime/turn-run.d.ts +18 -9
  220. package/dist/runtime/turn-run.js +302 -71
  221. package/dist/runtime/wake-coalescing.d.ts +11 -3
  222. package/dist/runtime/wake-coalescing.js +10 -0
  223. package/dist/security/config.js +5 -10
  224. package/dist/security/logger.js +1 -1
  225. package/dist/security/path-guard.js +7 -63
  226. package/dist/security/types.d.ts +27 -30
  227. package/dist/security/types.js +0 -1
  228. package/dist/shared/atomic-file.d.ts +2 -0
  229. package/dist/shared/atomic-file.js +14 -1
  230. package/dist/shared/file-lock.d.ts +35 -0
  231. package/dist/shared/file-lock.js +195 -0
  232. package/dist/shared/with-timeout.d.ts +2 -0
  233. package/dist/shared/with-timeout.js +21 -0
  234. package/dist/skills/loader.d.ts +1 -1
  235. package/dist/skills/loader.js +2 -2
  236. package/dist/skills/workspace.js +2 -2
  237. package/dist/subagents/completion-wake.d.ts +11 -2
  238. package/dist/subagents/completion-wake.js +22 -9
  239. package/dist/subagents/discovery.js +1 -1
  240. package/dist/subagents/dispatch.d.ts +0 -10
  241. package/dist/subagents/dispatch.js +10 -28
  242. package/dist/subagents/external/dispatch.js +1 -1
  243. package/dist/subagents/external/run.d.ts +1 -1
  244. package/dist/subagents/external/run.js +3 -3
  245. package/dist/subagents/internal/run.js +1 -1
  246. package/dist/subagents/internal/worker.js +6 -14
  247. package/dist/subagents/run-archive.d.ts +11 -0
  248. package/dist/subagents/run-archive.js +49 -0
  249. package/dist/subagents/run-record.d.ts +9 -8
  250. package/dist/subagents/run-record.js +3 -3
  251. package/dist/subagents/run-registry.d.ts +5 -3
  252. package/dist/subagents/run-registry.js +22 -45
  253. package/dist/subagents/runs.d.ts +23 -13
  254. package/dist/subagents/runs.js +75 -82
  255. package/dist/subagents/task-envelope.js +9 -11
  256. package/dist/subagents/types.d.ts +6 -5
  257. package/dist/tasks/board.d.ts +1 -1
  258. package/dist/tasks/board.js +2 -2
  259. package/dist/tasks/bound-work.d.ts +2 -2
  260. package/dist/tasks/bound-work.js +7 -7
  261. package/dist/tasks/brief.d.ts +1 -1
  262. package/dist/tasks/brief.js +9 -9
  263. package/dist/tasks/commands.d.ts +11 -2
  264. package/dist/tasks/commands.js +66 -41
  265. package/dist/tasks/contract.d.ts +0 -2
  266. package/dist/tasks/contract.js +1 -3
  267. package/dist/tasks/create.d.ts +3 -1
  268. package/dist/tasks/create.js +10 -4
  269. package/dist/tasks/frontmatter.d.ts +6 -2
  270. package/dist/tasks/frontmatter.js +10 -10
  271. package/dist/tasks/loop-log.d.ts +7 -13
  272. package/dist/tasks/loop-log.js +14 -17
  273. package/dist/tasks/mutation-lock.d.ts +7 -5
  274. package/dist/tasks/mutation-lock.js +32 -9
  275. package/dist/tasks/session-path.d.ts +3 -3
  276. package/dist/tasks/session-path.js +5 -5
  277. package/dist/tasks/steer.d.ts +5 -5
  278. package/dist/tasks/steer.js +42 -40
  279. package/dist/tasks/store.d.ts +11 -11
  280. package/dist/tasks/store.js +32 -29
  281. package/dist/tools/bash.d.ts +5 -5
  282. package/dist/tools/bash.js +19 -18
  283. package/dist/tools/contract/names.d.ts +7 -0
  284. package/dist/tools/contract/names.js +22 -0
  285. package/dist/tools/edit.js +1 -1
  286. package/dist/tools/event-manage.d.ts +3 -1
  287. package/dist/tools/event-manage.js +34 -33
  288. package/dist/tools/glob.js +5 -5
  289. package/dist/tools/grep.js +2 -2
  290. package/dist/tools/index.d.ts +9 -8
  291. package/dist/tools/index.js +12 -16
  292. package/dist/tools/job.d.ts +4 -2
  293. package/dist/tools/job.js +11 -8
  294. package/dist/tools/memory-manage.d.ts +5 -3
  295. package/dist/tools/memory-manage.js +24 -24
  296. package/dist/tools/read.js +1 -1
  297. package/dist/tools/registry.d.ts +12 -8
  298. package/dist/tools/registry.js +13 -9
  299. package/dist/tools/send-media.d.ts +2 -2
  300. package/dist/tools/send-media.js +3 -3
  301. package/dist/tools/session-search.d.ts +3 -1
  302. package/dist/tools/session-search.js +8 -6
  303. package/dist/tools/subagent-manage.d.ts +2 -8
  304. package/dist/tools/subagent-manage.js +19 -15
  305. package/dist/tools/subagent.js +1 -1
  306. package/dist/tools/task-manage/create.js +1 -1
  307. package/dist/tools/task-manage/factory.js +2 -2
  308. package/dist/tools/task-manage/lifecycle.js +3 -1
  309. package/dist/tools/task-manage/log-view.js +2 -2
  310. package/dist/tools/task-manage/shared.js +3 -3
  311. package/dist/tools/task-manage/step-end.js +3 -3
  312. package/dist/tools/task-manage/types.d.ts +8 -3
  313. package/dist/tools/web-cache.d.ts +3 -3
  314. package/dist/tools/web-cache.js +12 -12
  315. package/dist/tools/web-fetch.d.ts +2 -2
  316. package/dist/tools/web-fetch.js +7 -7
  317. package/dist/tools/write-content.js +1 -1
  318. package/dist/tui/cli.d.ts +17 -5
  319. package/dist/tui/cli.js +90 -27
  320. package/dist/tui/client.d.ts +26 -0
  321. package/dist/tui/client.js +157 -0
  322. package/dist/tui/colors.d.ts +0 -1
  323. package/dist/tui/colors.js +0 -1
  324. package/dist/tui/commands.d.ts +10 -51
  325. package/dist/tui/commands.js +16 -39
  326. package/dist/tui/frontend.d.ts +2 -2
  327. package/dist/tui/frontend.js +2 -2
  328. package/dist/tui/pitui-frontend.d.ts +0 -2
  329. package/dist/tui/pitui-frontend.js +1 -6
  330. package/dist/tui/render.d.ts +62 -0
  331. package/dist/tui/render.js +123 -0
  332. package/dist/tui/session.d.ts +92 -0
  333. package/dist/tui/session.js +317 -0
  334. package/dist/usage/ledger.d.ts +5 -0
  335. package/dist/usage/ledger.js +2 -0
  336. package/dist/usage/render.d.ts +6 -1
  337. package/dist/usage/render.js +18 -13
  338. package/dist/webapi/auth.d.ts +13 -0
  339. package/dist/webapi/auth.js +29 -0
  340. package/dist/webapi/config.d.ts +29 -0
  341. package/dist/webapi/config.js +100 -0
  342. package/dist/webapi/errors.d.ts +39 -0
  343. package/dist/webapi/errors.js +32 -0
  344. package/dist/webapi/http.d.ts +25 -0
  345. package/dist/webapi/http.js +4 -0
  346. package/dist/webapi/ids.d.ts +9 -0
  347. package/dist/webapi/ids.js +20 -0
  348. package/dist/webapi/input.d.ts +17 -0
  349. package/dist/webapi/input.js +229 -0
  350. package/dist/webapi/items.d.ts +37 -0
  351. package/dist/webapi/items.js +48 -0
  352. package/dist/webapi/key-command.d.ts +2 -0
  353. package/dist/webapi/key-command.js +110 -0
  354. package/dist/webapi/limits.d.ts +47 -0
  355. package/dist/webapi/limits.js +48 -0
  356. package/dist/webapi/request-policy.d.ts +17 -0
  357. package/dist/webapi/request-policy.js +160 -0
  358. package/dist/webapi/response-record.d.ts +68 -0
  359. package/dist/webapi/response-record.js +58 -0
  360. package/dist/webapi/response-state.d.ts +90 -0
  361. package/dist/webapi/response-state.js +347 -0
  362. package/dist/webapi/routes/conversations.d.ts +8 -0
  363. package/dist/webapi/routes/conversations.js +80 -0
  364. package/dist/webapi/routes/models.d.ts +3 -0
  365. package/dist/webapi/routes/models.js +12 -0
  366. package/dist/webapi/routes/responses.d.ts +8 -0
  367. package/dist/webapi/routes/responses.js +118 -0
  368. package/dist/webapi/routes/websocket.d.ts +9 -0
  369. package/dist/webapi/routes/websocket.js +328 -0
  370. package/dist/webapi/server.d.ts +24 -0
  371. package/dist/webapi/server.js +229 -0
  372. package/dist/webapi/service.d.ts +130 -0
  373. package/dist/webapi/service.js +588 -0
  374. package/dist/webapi/store.d.ts +46 -0
  375. package/dist/webapi/store.js +245 -0
  376. package/dist/webapi/stream.d.ts +13 -0
  377. package/dist/webapi/stream.js +76 -0
  378. package/dist/webapi/transport.d.ts +43 -0
  379. package/dist/webapi/transport.js +100 -0
  380. package/package.json +9 -2
  381. package/dist/channel/channel-paths.d.ts +0 -16
  382. package/dist/channel/channel-paths.js +0 -53
  383. package/dist/channel/commands.d.ts +0 -32
  384. package/dist/channel/commands.js +0 -109
  385. package/dist/channel/project-scope-store.d.ts +0 -51
  386. package/dist/channel/project-scope-store.js +0 -112
  387. package/dist/dingtalk/channel-queue.d.ts +0 -19
  388. package/dist/dingtalk/handler.d.ts +0 -90
  389. package/dist/memory/channel-maintenance-queue.d.ts +0 -5
  390. package/dist/memory/channel-maintenance-queue.js +0 -8
  391. package/dist/runtime/task-migration.d.ts +0 -30
  392. package/dist/runtime/task-migration.js +0 -465
  393. package/dist/runtime/turn-handler.d.ts +0 -47
  394. package/dist/runtime/turn-handler.js +0 -318
  395. package/dist/security/project-scope.d.ts +0 -45
  396. package/dist/security/project-scope.js +0 -105
  397. package/dist/tui/app.d.ts +0 -16
  398. package/dist/tui/app.js +0 -166
  399. package/dist/tui/terminal-context.d.ts +0 -27
  400. package/dist/tui/terminal-context.js +0 -84
  401. package/dist/tui/terminal-media-sender.d.ts +0 -9
  402. package/dist/tui/terminal-media-sender.js +0 -15
  403. package/dist/tui/turn-controller.d.ts +0 -64
  404. package/dist/tui/turn-controller.js +0 -311
  405. /package/dist/{dingtalk/handler.js → channel/transport.js} +0 -0
package/README.en.md CHANGED
@@ -18,17 +18,17 @@ 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 recommended capability-and-cost entries plus earlier job-style role templates for reference.
21
+ 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
22
 
23
23
  ### Work does not end when a conversation ends
24
24
 
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.
25
+ 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 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.
26
26
 
27
27
  ### Natively at home in DingTalk
28
28
 
29
29
  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
30
 
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.
31
+ 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
32
 
33
33
  ### Autonomous, and always interruptible
34
34
 
@@ -43,7 +43,7 @@ Models support built-in providers, OpenAI-compatible gateways, API keys, and sub
43
43
  - Providing an always-online dev assistant, internal tech support, or ops collaboration entry point in DingTalk
44
44
  - Handing requirement analysis, implementation, review, verification, and documentation to different AI agents working together
45
45
  - 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
46
+ - Keeping a separate conversation per group and direct chat, sharing one body of memory by default and splitting it with desks when needed
47
47
  - Reusing existing model gateways, Claude Code / Codex CLI accounts, and team working conventions
48
48
 
49
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.
@@ -63,13 +63,13 @@ The first real start of `pipiclaw` or `pipiclaw tui` creates:
63
63
 
64
64
  ```text
65
65
  ~/.pipiclaw/
66
- ├── channel.json # DingTalk app
66
+ ├── channel.json # Channel switches: DingTalk app, Web API
67
67
  ├── auth.json # model credentials
68
68
  ├── models.json # custom model providers
69
69
  ├── settings.json # default model and runtime settings
70
70
  ├── tools.json # capability switches for web tools, tasks, etc.
71
71
  ├── security.json # command, path, and network guards
72
- └── workspace/ # memory, tasks, events, skills, agent roles, and channel data
72
+ └── workspace/ # shared config and extensions; the default desk's data is in desk-default/
73
73
  ```
74
74
 
75
75
  Set `PIPICLAW_HOME=/your/path` to relocate this directory as a whole.
@@ -86,7 +86,7 @@ export ANTHROPIC_API_KEY=sk-ant-...
86
86
  pipiclaw auth login
87
87
  ```
88
88
 
89
- Then start:
89
+ Then chat right in the terminal (the first run initializes the default desk):
90
90
 
91
91
  ```bash
92
92
  pipiclaw tui
@@ -98,7 +98,7 @@ It can also be used for scripted one-shot requests:
98
98
  pipiclaw tui --print "Reply with only: Pipiclaw model call succeeded"
99
99
  ```
100
100
 
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).
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. 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
 
@@ -113,16 +113,21 @@ Edit `~/.pipiclaw/channel.json`:
113
113
 
114
114
  ```json
115
115
  {
116
- "clientId": "your-dingtalk-client-id",
117
- "clientSecret": "your-dingtalk-client-secret",
118
- "robotCode": "",
119
- "cardTemplateId": "",
120
- "cardTemplateKey": "content",
121
- "allowFrom": []
116
+ "dingtalk": {
117
+ "enabled": true,
118
+ "clientId": "your-dingtalk-client-id",
119
+ "clientSecret": "your-dingtalk-client-secret",
120
+ "robotCode": "",
121
+ "cardTemplateId": "",
122
+ "cardTemplateKey": "content",
123
+ "allowFrom": []
124
+ },
125
+ "webapi": { "enabled": false, "socket": true }
122
126
  }
123
127
  ```
124
128
 
125
- - The only hard-required fields are `clientId` and `clientSecret`.
129
+ - The `dingtalk` and `webapi` sections each have an `enabled` switch; turn on at least one. `webapi` lets scripts and other services use Pipiclaw through the official OpenAI SDK (see [Web API](https://github.com/oyasmi/pipiclaw/blob/main/docs/webapi.md)).
130
+ - The only hard-required DingTalk fields are `clientId` and `clientSecret`.
126
131
  - When `robotCode` is empty it falls back to `clientId`.
127
132
  - `cardTemplateId` can be left empty for now; configuring an AI Card is recommended for real use.
128
133
  - `allowFrom: []` means all senders are allowed; during a limited rollout, fill in tester staff IDs.
@@ -134,7 +139,7 @@ Start the daemon:
134
139
  pipiclaw
135
140
  ```
136
141
 
137
- In DingTalk, send `/model` to inspect the model reference, then send a normal message to verify a real call:
142
+ 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
143
 
139
144
  ```text
140
145
  Please introduce yourself and explain what you can do right now
@@ -177,7 +182,7 @@ Common control entry points:
177
182
 
178
183
  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
184
 
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.
185
+ 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
186
 
182
187
  ### 5. Optional: enable web tools
183
188
 
@@ -195,8 +200,8 @@ Please install and initialize Pipiclaw for me:
195
200
  2. Run npm install -g @oyasmi/pipiclaw; on a permission failure do not sudo on your own.
196
201
  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
202
  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.
203
+ 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.
204
+ 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
205
  7. Honestly list the operations performed, files changed, verification results, and information still missing; do not pretend it succeeded.
201
206
  ```
202
207
 
@@ -210,14 +215,15 @@ Please install and initialize Pipiclaw for me:
210
215
  | `/stop` | Stop the current turn; a task-driven turn also pauses its task |
211
216
  | `/steer <message>` | Adjust the running turn |
212
217
  | `/followup <message>` | Queue the next request |
218
+ | `/desk [list\|new <name>\|bind <name>]` | Advanced: create a desk, or switch the current channel to another desk |
213
219
  | `/status` | Execution status, model, context, uptime, and version |
214
- | `/usage [7d\|month]` | Model usage and cost for this channel and globally |
220
+ | `/usage [7d\|month]` | Model usage and cost for the current desk and globally |
215
221
  | `/tasks ...` | View, diagnose, and control long-running tasks |
216
222
  | `/subagents ...` | View and control delegation runs and the role directory |
217
- | `/memory ...` | View this channel's long-term memory |
223
+ | `/memory ...` | View the current desk's long-term memory |
218
224
  | `/model [ref]` | View or switch the model |
219
225
 
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`.
226
+ `/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
227
 
222
228
  See [Interaction and commands](https://github.com/oyasmi/pipiclaw/blob/main/docs/interaction-and-commands.md) for full interaction details.
223
229
 
package/README.md CHANGED
@@ -18,17 +18,17 @@ Pipiclaw 是一个面向个人和团队的 AI coding assistant runtime。它让
18
18
 
19
19
  Pipiclaw 同时支持两类委派:内置子智能体在进程内完成检索、日志筛查等轻量工作;外部智能体则启动真实的 Claude Code、Codex CLI 或任意脚本,处理需要长时间运行、跨多个文件和反复自测的重型任务。
20
20
 
21
- 在钉钉常驻模式中,外部任务派发后在后台继续执行,完成时自动唤醒原频道。你可以随时用 `/subagents` 查看运行状态、实际命令和产出,用 `/subagents cancel` 直接终止,也可以让主智能体在已结束的 Claude Code / Codex 会话上继续追问。仓库附带按能力与成本组织的推荐条目,以及可参考的早期岗位角色模板。
21
+ 在钉钉常驻模式中,外部任务派发后在后台继续执行,完成时自动唤醒发起委派的频道。你可以随时用 `/subagents` 查看运行状态、实际命令和产出,用 `/subagents cancel` 直接终止,也可以让主智能体在已结束的 Claude Code / Codex 会话上继续追问。仓库附带按能力与成本组织的推荐条目,以及可参考的早期岗位角色模板。
22
22
 
23
23
  ### 工作不会随着一次对话结束
24
24
 
25
- 每个频道都有独立的持久会话、长期记忆索引和按天日志。任务是一次性项目,用 Markdown 保存目标、完成标准和工作项,用 JSONL 循环日志记录步骤、派发与结算;内建 task driver 推进可运行任务、兑现到期等待票并处理兜底超时,周期与定时工作由事件模板每次生成独立任务实例,预算耗尽、空转或连续无法兑现等待时会停止并告诉你。
25
+ Pipiclaw 是你的同一个个人助手:终端、钉钉私聊和多个群聊默认共享长期记忆、按天日志、任务、定时事件和工作文件(都记在默认工位 `default` 里),各自保留独立对话,直接聊天即可。共享也意味着私聊里告诉助手的事,可能在群里被想起;需要把项目或用途分开时,再使用进阶的 [工位机制](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md#按需分开工位):每个工位有独立的记忆、任务和文件。任务是一次性项目,用 Markdown 保存目标、完成标准和工作项,用 JSONL 循环日志记录步骤、派发与结算;内建 task driver 推进可运行任务、兑现到期等待票并处理兜底超时,周期与定时工作由事件模板每次生成独立任务实例,预算耗尽、空转或连续无法兑现等待时会停止并告诉你。
26
26
 
27
27
  ### 原生工作在钉钉里
28
28
 
29
29
  Pipiclaw 使用钉钉 Stream Mode,不需要自建消息中转服务或公网 IP。AI Card 可以持续显示思考、工具执行和状态更新;任务进行中仍可用 `/steer` 调整方向、`/followup` 排队下一件事、`/stop` 中止当前回合。生成的报表、截图和导出文件可以作为钉钉原生附件直接交付。
30
30
 
31
- 同一个机器人实例可以同时服务多个私聊和群聊:私聊按用户、群聊按群分别建立 channel,不同 channel 的模型回合可以并行推进;同一 channel 内则串行执行,避免一段对话的上下文被多个回合同时修改。需要注意的是,会话隔离不等于代码目录隔离;如果多个 channel 指向同一个项目目录,仍应避免让主智能体同时修改同一批文件,或为并行实现准备独立的 Git worktree。完整边界见[并发与容量](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md)。
31
+ 同一个机器人实例可以同时服务多个私聊和群聊:每个私聊、每个群都是一个频道,不同频道的模型回合可以并行推进;同一频道内则串行执行,避免一段对话的上下文被多个回合同时修改。需要注意的是,工位之间的隔离不等于代码目录隔离;如果多个频道指向同一个项目目录,仍应避免让主智能体同时修改同一批文件,或为并行实现准备独立的 Git worktree。完整边界见[并发与容量](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md)。
32
32
 
33
33
  ### 能自主,也能随时接管
34
34
 
@@ -43,7 +43,7 @@ Pipiclaw 使用钉钉 Stream Mode,不需要自建消息中转服务或公网 I
43
43
  - 在钉钉中提供长期在线的研发助手、内部技术支持或运维协作入口
44
44
  - 把需求分析、实现、评审、验证、文档整理交给不同 AI 智能体协作完成
45
45
  - 跟进跨小时或跨天的编码、调查、迁移、报告和周期性工作
46
- - 在多个群和私聊中保留彼此隔离的上下文与记忆
46
+ - 在多个群和私聊中保留各自独立的对话;默认共享同一份积累,需要分开时再用工位
47
47
  - 复用现有模型网关、Claude Code / Codex CLI 账号和团队工作规范
48
48
 
49
49
  Pipiclaw 当前定位是个人与小团队、自托管、单实例运行。它不是强多租户 SaaS,也不提供 OS 级沙箱;外部智能体拥有的真实权限由目标 CLI 的 sandbox 参数、运行账号和宿主环境共同决定。
@@ -63,13 +63,13 @@ pipiclaw tui --help
63
63
 
64
64
  ```text
65
65
  ~/.pipiclaw/
66
- ├── channel.json # 钉钉应用
66
+ ├── channel.json # 渠道开关:钉钉应用、Web API
67
67
  ├── auth.json # 模型凭据
68
68
  ├── models.json # 自定义模型提供方
69
69
  ├── settings.json # 默认模型与运行设置
70
70
  ├── tools.json # Web 工具、任务等能力开关
71
71
  ├── security.json # 命令、路径与网络守卫
72
- └── workspace/ # 记忆、任务、事件、skills、智能体角色和频道数据
72
+ └── workspace/ # 共享配置与扩展;默认工位的数据在 desk-default/
73
73
  ```
74
74
 
75
75
  设置 `PIPICLAW_HOME=/your/path` 可以整体迁移这个目录。
@@ -86,7 +86,7 @@ export ANTHROPIC_API_KEY=sk-ant-...
86
86
  pipiclaw auth login
87
87
  ```
88
88
 
89
- 然后启动:
89
+ 然后直接在终端里聊天(首次运行自动初始化默认工位):
90
90
 
91
91
  ```bash
92
92
  pipiclaw tui
@@ -98,7 +98,7 @@ pipiclaw tui
98
98
  pipiclaw tui --print "只回复:Pipiclaw 模型调用成功"
99
99
  ```
100
100
 
101
- 看到模型实际回复才表示调用链路已经跑通;`pipiclaw tui --help` 或 `/model` 只能证明 CLI 或模型目录可见。正式工作前可用 `/project` 确认当前项目目录。如需接入企业网关、本地模型或指定默认模型,请看[配置速查](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md)。
101
+ 看到模型实际回复才表示调用链路已经跑通;`pipiclaw tui --help` 或 `/model` 只能证明 CLI 或模型目录可见。如需接入企业网关、本地模型或指定默认模型,请看[配置速查](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md)。
102
102
 
103
103
  ### 3. 接入钉钉
104
104
 
@@ -113,15 +113,20 @@ pipiclaw tui --print "只回复:Pipiclaw 模型调用成功"
113
113
 
114
114
  ```json
115
115
  {
116
- "clientId": "your-dingtalk-client-id",
117
- "clientSecret": "your-dingtalk-client-secret",
118
- "robotCode": "",
119
- "cardTemplateId": "",
120
- "cardTemplateKey": "content",
121
- "allowFrom": []
116
+ "dingtalk": {
117
+ "enabled": true,
118
+ "clientId": "your-dingtalk-client-id",
119
+ "clientSecret": "your-dingtalk-client-secret",
120
+ "robotCode": "",
121
+ "cardTemplateId": "",
122
+ "cardTemplateKey": "content",
123
+ "allowFrom": []
124
+ },
125
+ "webapi": { "enabled": false, "socket": true }
122
126
  }
123
127
  ```
124
128
 
129
+ - `dingtalk` 和 `webapi` 两段各有 `enabled` 开关,至少打开一个;`webapi` 让脚本和其他服务用官方 OpenAI SDK 使用 Pipiclaw(见 [Web API](https://github.com/oyasmi/pipiclaw/blob/main/docs/webapi.md))。
125
130
  - 硬性必填只有 `clientId` 和 `clientSecret`。
126
131
  - `robotCode` 留空时回退到 `clientId`。
127
132
  - `cardTemplateId` 可暂时留空;正式使用建议配置 AI Card。
@@ -134,7 +139,7 @@ pipiclaw tui --print "只回复:Pipiclaw 模型调用成功"
134
139
  pipiclaw
135
140
  ```
136
141
 
137
- 先在钉钉里发送 `/model` 检查模型引用,再发送一条普通消息验证真实调用:
142
+ 在钉钉中直接私聊,或把机器人拉进群后 @它,无需创建或绑定工位。新私聊和新群默认接入默认工位;`allowFrom` 仍控制哪些发送者可以使用。发送 `/model` 检查模型引用,再发送一条普通消息验证真实调用:
138
143
 
139
144
  ```text
140
145
  请介绍一下你自己,并说明你现在能做什么
@@ -177,7 +182,7 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.m
177
182
 
178
183
  外部智能体不会经过 Pipiclaw 的命令和路径守卫。上述推荐条目使用放开权限的 CLI 参数;使用前必须阅读[智能体委派指南](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md)中的授权、安全边界和 sandbox 说明。
179
184
 
180
- 长时间外部委派应运行在钉钉 daemon 中;TUI 当前不提供外部 run 的完成通知和退出后的重新认领。
185
+ 长时间外部委派应运行在常驻 daemon 中;没有 daemon 时终端内嵌的运行时只在终端打开期间处理外部 run 的完成通知。
181
186
 
182
187
  ### 5. 可选:启用 Web 工具
183
188
 
@@ -195,8 +200,8 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.m
195
200
  2. 执行 npm install -g @oyasmi/pipiclaw;权限失败时不要自行 sudo。
196
201
  3. 运行一次 pipiclaw 初始化 ~/.pipiclaw/;它因 channel.json 仍是模板而提示补全并退出是正常现象。
197
202
  4. 询问我要使用 API key、自定义 provider,还是 pipiclaw auth login 支持的订阅登录;不要编造缺失值。
198
- 5. 如果我要接入钉钉,逐项收集 clientId、clientSecret、可选的 cardTemplateId 和 allowFrom,写入 channel.json,并清除所有 your-* 占位值。
199
- 6. 配置完成后先询问是否启动。终端模式用 pipiclaw tui;钉钉模式用 pipiclaw。
203
+ 5. 如果我要接入钉钉,逐项收集 clientId、clientSecret、可选的 cardTemplateId 和 allowFrom,写入 channel.json 的 dingtalk 段,并清除所有 your-* 占位值。
204
+ 6. 配置完成后先询问是否启动。终端模式用 pipiclaw tui;钉钉模式用 pipiclaw,启动后直接私聊或在群里 @机器人,无需创建或绑定工位。
200
205
  7. 如实列出做过的操作、修改的文件、验证结果和仍缺少的信息,不要假装成功。
201
206
  ```
202
207
 
@@ -210,14 +215,15 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.m
210
215
  | `/stop` | 停止当前回合;任务驱动的回合会同时暂停对应任务 |
211
216
  | `/steer <消息>` | 调整正在执行的回合 |
212
217
  | `/followup <消息>` | 排队下一条请求 |
218
+ | `/desk [list\|new <名字>\|bind <名字>]` | 进阶:创建工位,或把当前频道切换到另一个工位 |
213
219
  | `/status` | 查看执行状态、模型、上下文、运行时长和版本 |
214
- | `/usage [7d\|month]` | 查看本频道与全局的模型用量和成本 |
220
+ | `/usage [7d\|month]` | 查看当前工位与全局的模型用量和成本 |
215
221
  | `/tasks ...` | 查看、诊断和控制长期任务 |
216
222
  | `/subagents ...` | 查看、控制委派 run 和角色目录 |
217
- | `/memory ...` | 查看当前频道的长期记忆 |
223
+ | `/memory ...` | 查看当前工位的长期记忆 |
218
224
  | `/model [引用]` | 查看或切换模型 |
219
225
 
220
- `/help`、`/stop`、`/steer`、`/followup`、`/events`、`/tasks`、`/status`、`/usage`、`/context` 和 `/subagents` 由运行时直接处理,回合进行中也能使用。`/stop` 不会取消已经派发的委派 run;请使用 `/subagents cancel`。
226
+ `/help`、`/stop`、`/steer`、`/followup`、`/desk`、`/events`、`/tasks`、`/status`、`/usage`、`/context` 和 `/subagents` 由运行时直接处理,回合进行中也能使用。`/stop` 不会取消已经派发的委派 run;请使用 `/subagents cancel`。
221
227
 
222
228
  完整交互说明见[交互与命令](https://github.com/oyasmi/pipiclaw/blob/main/docs/interaction-and-commands.md)。
223
229
 
@@ -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,7 +1,9 @@
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
9
  import type { UsageTotals } from "../usage/totals.js";
@@ -12,21 +14,16 @@ export declare class ChannelRunner implements AgentRunner {
12
14
  private readonly jobManager;
13
15
  private readonly runManager;
14
16
  private readonly fileStore;
17
+ readonly conversation: DeskConversation;
15
18
  private readonly channelId;
16
- private readonly channelDir;
19
+ /** This channel's conversation directory inside the desk: sessions, active pointer, archive. */
20
+ private readonly conversationDir;
17
21
  private readonly appHomeDir;
18
22
  private readonly authConfigPath;
19
23
  private readonly modelsConfigPath;
20
24
  private readonly onSessionEvent?;
21
- private readonly mediaSender?;
25
+ private readonly sendMedia?;
22
26
  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
27
  /** Re-read per use, not captured once: an edited security.json takes effect without a restart. */
31
28
  private readonly loadSecurityConfig;
32
29
  private readonly settingsManager;
@@ -34,6 +31,7 @@ export declare class ChannelRunner implements AgentRunner {
34
31
  private readonly turnFinisher;
35
32
  private readonly pipeline;
36
33
  private readonly memoryLifecycle;
34
+ private readonly requestScoped;
37
35
  private readonly ledger;
38
36
  private readonly memoryActivityRecorder;
39
37
  private readonly models;
@@ -43,7 +41,7 @@ export declare class ChannelRunner implements AgentRunner {
43
41
  /** Set once transport-level `/new` replaces this generation. A retired runner is never reused. */
44
42
  private retired;
45
43
  private runState;
46
- constructor(channelId: string, channelDir: string, paths: RunnerFactoryPaths, deps: RunnerDeps);
44
+ constructor(conversation: DeskConversation, paths: RunnerFactoryPaths, deps: RunnerDeps);
47
45
  private get session();
48
46
  private get sessionManager();
49
47
  beginTurn(taskText: string): void;
@@ -52,7 +50,7 @@ export declare class ChannelRunner implements AgentRunner {
52
50
  isBusy(): boolean;
53
51
  requestStop(): void;
54
52
  getTurnStatus(): TurnStatus;
55
- run(ctx: ChannelContext, store: ChannelStore): Promise<{
53
+ run(info: TurnInfo, channel: ChannelContext, store: ChannelStore): Promise<{
56
54
  stopReason: string;
57
55
  errorMessage?: string;
58
56
  usage: UsageTotals;
@@ -60,7 +58,7 @@ export declare class ChannelRunner implements AgentRunner {
60
58
  durationMs: number;
61
59
  silent: boolean;
62
60
  }>;
63
- handleBuiltinCommand(ctx: ChannelContext, command: RunnerBuiltInCommand): Promise<void>;
61
+ handleBuiltinCommand(command: RunnerBuiltInCommand): Promise<string>;
64
62
  /**
65
63
  * True if `text` is a slash command the runtime or session layer can handle:
66
64
  * a built-in, a session command (`/model` …), a skill (`/skill:name`), or a
@@ -73,11 +71,12 @@ export declare class ChannelRunner implements AgentRunner {
73
71
  flushMemoryForShutdown(): Promise<void>;
74
72
  dispose(): Promise<void>;
75
73
  getMemoryMaintenanceContext(): Promise<MemoryMaintenanceRuntimeContext>;
76
- getStatusSnapshot(): RunnerStatusSnapshot;
74
+ getStatusSnapshot(): RunnerStatusSnapshot | undefined;
77
75
  abort(): Promise<void>;
78
76
  isCompacting(): boolean;
79
77
  interruptCompaction(): boolean;
80
78
  retireForNewSession(): void;
79
+ retireForRecovery(): void;
81
80
  /**
82
81
  * `/context` — read-only prompt accounting, no LLM cost. Reports the section
83
82
  * breakdown of the system prompt, the tool schemas (billed on top of it, and
@@ -106,5 +105,6 @@ export declare class ChannelRunner implements AgentRunner {
106
105
  private recordMemoryActivity;
107
106
  /** Best-effort: a lost activity counter delays maintenance, it never breaks a turn. */
108
107
  private flushMemoryActivity;
108
+ private cancelOutput;
109
109
  private resetRunState;
110
110
  }