aicodeman 1.50.0 → 1.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/README.md +17 -10
  2. package/dist/config/attachment-guard.d.ts +5 -1
  3. package/dist/config/attachment-guard.d.ts.map +1 -1
  4. package/dist/config/attachment-guard.js +4 -2
  5. package/dist/config/attachment-guard.js.map +1 -1
  6. package/dist/config/cli-registry/schema.d.ts +2 -0
  7. package/dist/config/cli-registry/schema.d.ts.map +1 -1
  8. package/dist/config/cli-registry/schema.js +11 -0
  9. package/dist/config/cli-registry/schema.js.map +1 -1
  10. package/dist/config/cli-registry/stock.d.ts.map +1 -1
  11. package/dist/config/cli-registry/stock.js +155 -4
  12. package/dist/config/cli-registry/stock.js.map +1 -1
  13. package/dist/config/cli-registry/types.d.ts +33 -2
  14. package/dist/config/cli-registry/types.d.ts.map +1 -1
  15. package/dist/config/file-editing.d.ts +7 -3
  16. package/dist/config/file-editing.d.ts.map +1 -1
  17. package/dist/config/file-editing.js +12 -3
  18. package/dist/config/file-editing.js.map +1 -1
  19. package/dist/config/local-model-catalog.d.ts +95 -20
  20. package/dist/config/local-model-catalog.d.ts.map +1 -1
  21. package/dist/config/local-model-catalog.js +172 -37
  22. package/dist/config/local-model-catalog.js.map +1 -1
  23. package/dist/config-backup.js +1 -1
  24. package/dist/config-backup.js.map +1 -1
  25. package/dist/custom-model-injection.d.ts.map +1 -1
  26. package/dist/custom-model-injection.js +22 -14
  27. package/dist/custom-model-injection.js.map +1 -1
  28. package/dist/hooks-config.d.ts +62 -0
  29. package/dist/hooks-config.d.ts.map +1 -1
  30. package/dist/hooks-config.js +156 -0
  31. package/dist/hooks-config.js.map +1 -1
  32. package/dist/local-model/connect.d.ts +16 -2
  33. package/dist/local-model/connect.d.ts.map +1 -1
  34. package/dist/local-model/connect.js +17 -3
  35. package/dist/local-model/connect.js.map +1 -1
  36. package/dist/local-model/harness-facts.d.ts +8 -4
  37. package/dist/local-model/harness-facts.d.ts.map +1 -1
  38. package/dist/local-model/harness-facts.js +13 -5
  39. package/dist/local-model/harness-facts.js.map +1 -1
  40. package/dist/local-model/install-job.d.ts +208 -28
  41. package/dist/local-model/install-job.d.ts.map +1 -1
  42. package/dist/local-model/install-job.js +856 -94
  43. package/dist/local-model/install-job.js.map +1 -1
  44. package/dist/local-model/recommend.d.ts +11 -5
  45. package/dist/local-model/recommend.d.ts.map +1 -1
  46. package/dist/local-model/recommend.js +11 -5
  47. package/dist/local-model/recommend.js.map +1 -1
  48. package/dist/local-model/runtime.d.ts +12 -0
  49. package/dist/local-model/runtime.d.ts.map +1 -1
  50. package/dist/local-model/runtime.js +42 -0
  51. package/dist/local-model/runtime.js.map +1 -1
  52. package/dist/local-model/state-store.d.ts.map +1 -1
  53. package/dist/local-model/state-store.js +40 -0
  54. package/dist/local-model/state-store.js.map +1 -1
  55. package/dist/mux-interface.d.ts +3 -1
  56. package/dist/mux-interface.d.ts.map +1 -1
  57. package/dist/proc-tree.d.ts +23 -0
  58. package/dist/proc-tree.d.ts.map +1 -1
  59. package/dist/proc-tree.js +28 -0
  60. package/dist/proc-tree.js.map +1 -1
  61. package/dist/session-auto-ops.d.ts +95 -8
  62. package/dist/session-auto-ops.d.ts.map +1 -1
  63. package/dist/session-auto-ops.js +146 -32
  64. package/dist/session-auto-ops.js.map +1 -1
  65. package/dist/session-cli-registry-bridge.d.ts +2 -1
  66. package/dist/session-cli-registry-bridge.d.ts.map +1 -1
  67. package/dist/session-cli-registry-bridge.js.map +1 -1
  68. package/dist/session.d.ts +16 -1
  69. package/dist/session.d.ts.map +1 -1
  70. package/dist/session.js +29 -5
  71. package/dist/session.js.map +1 -1
  72. package/dist/tmux-manager.d.ts +10 -1
  73. package/dist/tmux-manager.d.ts.map +1 -1
  74. package/dist/tmux-manager.js +45 -6
  75. package/dist/tmux-manager.js.map +1 -1
  76. package/dist/tui/tui-app.d.ts.map +1 -1
  77. package/dist/tui/tui-app.js +1 -0
  78. package/dist/tui/tui-app.js.map +1 -1
  79. package/dist/tui/tui-client.d.ts +1 -1
  80. package/dist/tui/tui-client.d.ts.map +1 -1
  81. package/dist/types/common.d.ts +5 -0
  82. package/dist/types/common.d.ts.map +1 -1
  83. package/dist/types/local-model-install.d.ts +202 -15
  84. package/dist/types/local-model-install.d.ts.map +1 -1
  85. package/dist/types/local-model-install.js +21 -4
  86. package/dist/types/local-model-install.js.map +1 -1
  87. package/dist/types/local-model.d.ts +32 -6
  88. package/dist/types/local-model.d.ts.map +1 -1
  89. package/dist/types/local-model.js.map +1 -1
  90. package/dist/types/session.d.ts +26 -4
  91. package/dist/types/session.d.ts.map +1 -1
  92. package/dist/types/session.js +2 -1
  93. package/dist/types/session.js.map +1 -1
  94. package/dist/usage-telemetry.d.ts +3 -0
  95. package/dist/usage-telemetry.d.ts.map +1 -1
  96. package/dist/usage-telemetry.js +4 -0
  97. package/dist/usage-telemetry.js.map +1 -1
  98. package/dist/utils/token-validation.d.ts +3 -3
  99. package/dist/utils/token-validation.d.ts.map +1 -1
  100. package/dist/utils/token-validation.js +3 -3
  101. package/dist/utils/token-validation.js.map +1 -1
  102. package/dist/web/case-state-sync.d.ts +28 -0
  103. package/dist/web/case-state-sync.d.ts.map +1 -0
  104. package/dist/web/case-state-sync.js +41 -0
  105. package/dist/web/case-state-sync.js.map +1 -0
  106. package/dist/web/public/admin-ui.js.gz +0 -0
  107. package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
  108. package/dist/web/public/{app.8719143d.js → app.bddc2382.js} +9 -7
  109. package/dist/web/public/app.bddc2382.js.br +0 -0
  110. package/dist/web/public/app.bddc2382.js.gz +0 -0
  111. package/dist/web/public/approvals-ui.js.gz +0 -0
  112. package/dist/web/public/constants.782170e1.js.gz +0 -0
  113. package/dist/web/public/cron-ui.js.gz +0 -0
  114. package/dist/web/public/edit-history-ui.js.gz +0 -0
  115. package/dist/web/public/entrance-animations.js.gz +0 -0
  116. package/dist/web/public/foreign-sessions.js.gz +0 -0
  117. package/dist/web/public/git-status-ui.js.gz +0 -0
  118. package/dist/web/public/header-divider.eb2d2463.js.gz +0 -0
  119. package/dist/web/public/home-sessions.js +38 -18
  120. package/dist/web/public/home-sessions.js.br +0 -0
  121. package/dist/web/public/home-sessions.js.gz +0 -0
  122. package/dist/web/public/host-wake-ui.js.gz +0 -0
  123. package/dist/web/public/i18n.2e0cdcee.js +2 -0
  124. package/dist/web/public/i18n.2e0cdcee.js.br +0 -0
  125. package/dist/web/public/i18n.2e0cdcee.js.gz +0 -0
  126. package/dist/web/public/{image-input.a5d0f8f3.js → image-input.b75c41ca.js} +17 -1
  127. package/dist/web/public/image-input.b75c41ca.js.br +0 -0
  128. package/dist/web/public/image-input.b75c41ca.js.gz +0 -0
  129. package/dist/web/public/index.html +39 -15
  130. package/dist/web/public/index.html.br +0 -0
  131. package/dist/web/public/index.html.gz +0 -0
  132. package/dist/web/public/input-cjk.8bc46081.js.gz +0 -0
  133. package/dist/web/public/{keyboard-accessory.b941676c.js → keyboard-accessory.0800fc44.js} +160 -2
  134. package/dist/web/public/keyboard-accessory.0800fc44.js.br +0 -0
  135. package/dist/web/public/keyboard-accessory.0800fc44.js.gz +0 -0
  136. package/dist/web/public/local-model-ui.js +618 -32
  137. package/dist/web/public/local-model-ui.js.br +0 -0
  138. package/dist/web/public/local-model-ui.js.gz +0 -0
  139. package/dist/web/public/mobile-handlers.f7c3f692.js.gz +0 -0
  140. package/dist/web/public/mobile-ime-preview.2dbaf262.js.gz +0 -0
  141. package/dist/web/public/mobile-overview.js +31 -14
  142. package/dist/web/public/mobile-overview.js.br +0 -0
  143. package/dist/web/public/mobile-overview.js.gz +0 -0
  144. package/dist/web/public/mobile.984e9058.css +1 -0
  145. package/dist/web/public/mobile.984e9058.css.br +0 -0
  146. package/dist/web/public/mobile.984e9058.css.gz +0 -0
  147. package/dist/web/public/notification-manager.feb82c04.js.gz +0 -0
  148. package/dist/web/public/orchestrator-panel.js.gz +0 -0
  149. package/dist/web/public/{panels-ui.d3f4f1c4.js → panels-ui.ee2330a4.js} +99 -97
  150. package/dist/web/public/panels-ui.ee2330a4.js.br +0 -0
  151. package/dist/web/public/panels-ui.ee2330a4.js.gz +0 -0
  152. package/dist/web/public/ralph-panel.b350e2ef.js.gz +0 -0
  153. package/dist/web/public/ralph-wizard.b6c0dd19.js.gz +0 -0
  154. package/dist/web/public/readmymind-ui.js.gz +0 -0
  155. package/dist/web/public/reboot-restore-ui.js.gz +0 -0
  156. package/dist/web/public/respawn-ui.304ba0d4.js.gz +0 -0
  157. package/dist/web/public/sanitize-html.e7147e76.js.gz +0 -0
  158. package/dist/web/public/session-lineage.js.gz +0 -0
  159. package/dist/web/public/session-ui.4273cbc5.js +106 -0
  160. package/dist/web/public/session-ui.4273cbc5.js.br +0 -0
  161. package/dist/web/public/session-ui.4273cbc5.js.gz +0 -0
  162. package/dist/web/public/{settings-ui.11da6f15.js → settings-ui.8b37cf07.js} +14 -14
  163. package/dist/web/public/settings-ui.8b37cf07.js.br +0 -0
  164. package/dist/web/public/settings-ui.8b37cf07.js.gz +0 -0
  165. package/dist/web/public/spreadsheet-preview-worker.js.gz +0 -0
  166. package/dist/web/public/spreadsheet-preview.75c751de.js.gz +0 -0
  167. package/dist/web/public/spreadsheet-xlsx-core.js.gz +0 -0
  168. package/dist/web/public/styles.81d95f50.css +1 -0
  169. package/dist/web/public/styles.81d95f50.css.br +0 -0
  170. package/dist/web/public/styles.81d95f50.css.gz +0 -0
  171. package/dist/web/public/subagent-windows.07277a58.js.gz +0 -0
  172. package/dist/web/public/sw.js +2 -2
  173. package/dist/web/public/sw.js.br +0 -0
  174. package/dist/web/public/sw.js.gz +0 -0
  175. package/dist/web/public/tab-layout-browser.2d6189f7.js.gz +0 -0
  176. package/dist/web/public/tab-rail-resize.b5cdceaf.js.gz +0 -0
  177. package/dist/web/public/terminal-keycode229-recovery.98843069.js.gz +0 -0
  178. package/dist/web/public/terminal-split.js.gz +0 -0
  179. package/dist/web/public/terminal-tile.js +1 -1
  180. package/dist/web/public/terminal-tile.js.br +0 -0
  181. package/dist/web/public/terminal-tile.js.gz +0 -0
  182. package/dist/web/public/{terminal-ui.f92eae28.js → terminal-ui.8e4c2017.js} +1 -1
  183. package/dist/web/public/terminal-ui.8e4c2017.js.br +0 -0
  184. package/dist/web/public/terminal-ui.8e4c2017.js.gz +0 -0
  185. package/dist/web/public/tile-grid.js.gz +0 -0
  186. package/dist/web/public/ultracode-panel.js.gz +0 -0
  187. package/dist/web/public/ultracode-windows.js.gz +0 -0
  188. package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
  189. package/dist/web/public/vendor/exceljs.min.js.gz +0 -0
  190. package/dist/web/public/vendor/fflate.min.js.gz +0 -0
  191. package/dist/web/public/vendor/marked.min.js.gz +0 -0
  192. package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
  193. package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
  194. package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
  195. package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
  196. package/dist/web/public/vendor/xterm-predictive-echo.276b11d9.js.gz +0 -0
  197. package/dist/web/public/vendor/xterm-zerolag-input.1be42307.js.gz +0 -0
  198. package/dist/web/public/vendor/xterm.css.gz +0 -0
  199. package/dist/web/public/vendor/xterm.min.js.gz +0 -0
  200. package/dist/web/public/{voice-input.2342c37b.js → voice-input.d0580528.js} +232 -137
  201. package/dist/web/public/voice-input.d0580528.js.br +0 -0
  202. package/dist/web/public/voice-input.d0580528.js.gz +0 -0
  203. package/dist/web/public/voice-pcm-worklet.js.gz +0 -0
  204. package/dist/web/public/webview-tabs.js.gz +0 -0
  205. package/dist/web/public/whats-new.json +9 -9
  206. package/dist/web/routes/case-routes.d.ts.map +1 -1
  207. package/dist/web/routes/case-routes.js +31 -5
  208. package/dist/web/routes/case-routes.js.map +1 -1
  209. package/dist/web/routes/file-routes.d.ts +4 -2
  210. package/dist/web/routes/file-routes.d.ts.map +1 -1
  211. package/dist/web/routes/file-routes.js +112 -6
  212. package/dist/web/routes/file-routes.js.map +1 -1
  213. package/dist/web/routes/hook-event-routes.d.ts.map +1 -1
  214. package/dist/web/routes/hook-event-routes.js +45 -16
  215. package/dist/web/routes/hook-event-routes.js.map +1 -1
  216. package/dist/web/routes/local-model-routes.d.ts +18 -6
  217. package/dist/web/routes/local-model-routes.d.ts.map +1 -1
  218. package/dist/web/routes/local-model-routes.js +47 -10
  219. package/dist/web/routes/local-model-routes.js.map +1 -1
  220. package/dist/web/routes/session-routes.d.ts.map +1 -1
  221. package/dist/web/routes/session-routes.js +52 -4
  222. package/dist/web/routes/session-routes.js.map +1 -1
  223. package/dist/web/routes/status-telemetry-routes.d.ts.map +1 -1
  224. package/dist/web/routes/status-telemetry-routes.js +6 -0
  225. package/dist/web/routes/status-telemetry-routes.js.map +1 -1
  226. package/dist/web/routes/system-routes.d.ts +2 -2
  227. package/dist/web/routes/system-routes.d.ts.map +1 -1
  228. package/dist/web/routes/system-routes.js +35 -4
  229. package/dist/web/routes/system-routes.js.map +1 -1
  230. package/dist/web/schemas.d.ts +30 -0
  231. package/dist/web/schemas.d.ts.map +1 -1
  232. package/dist/web/schemas.js +56 -4
  233. package/dist/web/schemas.js.map +1 -1
  234. package/dist/web/sensitive-path.d.ts +8 -1
  235. package/dist/web/sensitive-path.d.ts.map +1 -1
  236. package/dist/web/sensitive-path.js +23 -4
  237. package/dist/web/sensitive-path.js.map +1 -1
  238. package/dist/web/server.d.ts.map +1 -1
  239. package/dist/web/server.js +1 -0
  240. package/dist/web/server.js.map +1 -1
  241. package/dist/web/session-wait-registry.d.ts +19 -4
  242. package/dist/web/session-wait-registry.d.ts.map +1 -1
  243. package/dist/web/session-wait-registry.js +26 -5
  244. package/dist/web/session-wait-registry.js.map +1 -1
  245. package/dist/web/voice-stream.d.ts +4 -3
  246. package/dist/web/voice-stream.d.ts.map +1 -1
  247. package/dist/web/voice-stream.js +5 -4
  248. package/dist/web/voice-stream.js.map +1 -1
  249. package/package.json +1 -1
  250. package/skills/codeman/SKILL.md +147 -42
  251. package/skills/codeman/preamble.sh +102 -26
  252. package/skills/codeman/reference/endpoints.md +13 -9
  253. package/skills/codeman/reference/messaging.md +2 -2
  254. package/skills/codeman/reference/recipes.md +2 -2
  255. package/skills/codeman/reference/verbs.md +46 -15
  256. package/dist/web/public/app.8719143d.js.br +0 -0
  257. package/dist/web/public/app.8719143d.js.gz +0 -0
  258. package/dist/web/public/i18n.1e96a258.js +0 -2
  259. package/dist/web/public/i18n.1e96a258.js.br +0 -0
  260. package/dist/web/public/i18n.1e96a258.js.gz +0 -0
  261. package/dist/web/public/image-input.a5d0f8f3.js.br +0 -0
  262. package/dist/web/public/image-input.a5d0f8f3.js.gz +0 -0
  263. package/dist/web/public/keyboard-accessory.b941676c.js.br +0 -0
  264. package/dist/web/public/keyboard-accessory.b941676c.js.gz +0 -0
  265. package/dist/web/public/mobile.4dfd5c55.css +0 -1
  266. package/dist/web/public/mobile.4dfd5c55.css.br +0 -0
  267. package/dist/web/public/mobile.4dfd5c55.css.gz +0 -0
  268. package/dist/web/public/panels-ui.d3f4f1c4.js.br +0 -0
  269. package/dist/web/public/panels-ui.d3f4f1c4.js.gz +0 -0
  270. package/dist/web/public/session-ui.a7c8c095.js +0 -106
  271. package/dist/web/public/session-ui.a7c8c095.js.br +0 -0
  272. package/dist/web/public/session-ui.a7c8c095.js.gz +0 -0
  273. package/dist/web/public/settings-ui.11da6f15.js.br +0 -0
  274. package/dist/web/public/settings-ui.11da6f15.js.gz +0 -0
  275. package/dist/web/public/styles.63382d6e.css +0 -1
  276. package/dist/web/public/styles.63382d6e.css.br +0 -0
  277. package/dist/web/public/styles.63382d6e.css.gz +0 -0
  278. package/dist/web/public/terminal-ui.f92eae28.js.br +0 -0
  279. package/dist/web/public/terminal-ui.f92eae28.js.gz +0 -0
  280. package/dist/web/public/voice-input.2342c37b.js.br +0 -0
  281. package/dist/web/public/voice-input.2342c37b.js.gz +0 -0
@@ -107,7 +107,7 @@ later call opens with, and your first REAL call performs them anyway:
107
107
 
108
108
  ```bash
109
109
  . "${XDG_CACHE_HOME:-$HOME/.cache}/codeman-agent-$CODEMAN_SESSION_ID.sh" 2>/dev/null
110
- [ "${CODEMAN_PREAMBLE:-}" = 1.50.0 ] || { echo "preamble missing or stale; run the full §0 block"; exit 1; }
110
+ [ "${CODEMAN_PREAMBLE:-}" = 1.51.0 ] || { echo "preamble missing or stale; run the full §0 block"; exit 1; }
111
111
  ```
112
112
 
113
113
  ⚠️ **Never spend a Bash call on this check alone.** §1's block opens with this same
@@ -135,8 +135,8 @@ PRE="${XDG_CACHE_HOME:-$HOME/.cache}/codeman-agent-$CODEMAN_SESSION_ID.sh"
135
135
  mkdir -p "$(dirname "$PRE")"
136
136
  # Rewrite unless the file already ends with THIS version's stamp, so a stale or a
137
137
  # half-written file self-heals here instead of costing you a round trip to rm it.
138
- grep -qs '^CODEMAN_PREAMBLE=1.50.0$' "$PRE" || (umask 077; cat > "$PRE" <<'PREAMBLE'
139
- # ---- Codeman agent preamble 1.50.0 (seeded by Codeman at session spawn; the SKILL.md §0 bootstrap rewrites it when missing or stale) ----
138
+ grep -qs '^CODEMAN_PREAMBLE=1.51.0$' "$PRE" || (umask 077; cat > "$PRE" <<'PREAMBLE'
139
+ # ---- Codeman agent preamble 1.51.0 (seeded by Codeman at session spawn; the SKILL.md §0 bootstrap rewrites it when missing or stale) ----
140
140
  # Positional parameters are always written with braces, ${1} and never a bare dollar-digit: Claude Code
141
141
  # replaces a bare one in a skill body with the matching word of the skill's arguments, and §0 is pasted
142
142
  # from that body (test/agent-skill.test.ts pins it).
@@ -197,6 +197,17 @@ _dsh_up() { # <sid> <timeoutMs> -> "true"/"false". The DeepSeek Harness T
197
197
  # composer glyph. Override with DSH_READY_MARK for a profile that draws another one.
198
198
  _mark_up "${1}" "${DSH_READY_MARK:-❯}" "${2}"
199
199
  }
200
+ _dsh_guide() { # <sid> -> 0 when the pane shows dsh-TUI's first-run SETUP GUIDE, not a composer.
201
+ # dsh-TUI 0.19.0 opens a guide ("Welcome to dsh-TUI Step 1 of 4") in every session until a
202
+ # person has finished it once, and the guide's own cursor is `❯`: the readiness mark matches
203
+ # on it (measured, 2 of 2 launches), and an Enter there acts on the highlighted step, which
204
+ # is a sign-in. So a worker whose mark matched is still checked for the guide, on the
205
+ # RENDERED pane with its whitespace removed, and never handed back while it shows.
206
+ "${CURL[@]}" -G "$API/api/v1/sessions/${1}/terminal" --data-urlencode 'full=1' \
207
+ | jq -r '.data.terminalBuffer // empty' \
208
+ | sed -e "s/$(printf '\033')\[[0-9;?]*[a-zA-Z]//g" -e "s/$(printf '\033')[()][AB0]//g" \
209
+ | tr -d ' \t' | grep -qi 'Step[0-9]of[0-9]'
210
+ }
200
211
  # ---- the workspace-trust dialog: READ the screen, never press Enter blind ----
201
212
  # Claude Code 2.1.252 dropped the option numbers, REVERSED them, and highlights
202
213
  # "No, exit" by default:
@@ -259,9 +270,18 @@ _accept_trust() { # <sid> -> 0 once it has answered the dialog, 1 if it could n
259
270
  # local_model -> ONE compact JSON object on stdout. rc 0 only when a `local` worker can be
260
271
  # spawned now (`running:true`) or once spawn_worker has started the runtime (`running:false`):
261
272
  # {"spawnable":true,"state":"installed","running":true,"cli":"opencode","cliLabel":"OpenCode",
262
- # "endpointId":"local-ollama","modelId":"<id>","modelLabel":"<label>"}
273
+ # "endpointId":"local-ollama","modelId":"<id>","modelLabel":"<label>",
274
+ # "agents":[{"cli":"opencode","cliLabel":"OpenCode","status":"ready","default":true,"readyMark":"┃"},
275
+ # {"cli":"pi","cliLabel":"Pi","status":"installable","default":false}],
276
+ # "models":[{"id":"<id>","label":"<label>","active":true,"status":"ready","sizeGb":"23.1"}]}
277
+ # `cli` is the DEFAULT coding agent, the one `spawn_worker <name> local` starts. `agents` is
278
+ # every agent the model can be run with: `local:<cli>` starts one whose status is `ready`
279
+ # (`installable`, `installing` and `setup-needed` are a person's to resolve in the window).
280
+ # `models` is what is on this Mac; only the `active` one runs, and switching is a person's
281
+ # decision too. A Codeman older than 1.51 sends neither list: only `local` works there.
263
282
  # Otherwise rc 1 and {"spawnable":false,"reason":"<reason>","message":"<why>",...}, the reason
264
- # one of: not-mac, not-installed, install-unfinished, blocked (installed, but the server
283
+ # one of: not-mac, not-installed, install-unfinished, no-agent (installed, but no coding agent
284
+ # that can run the model is on this Mac), blocked (installed, but the server
265
285
  # refuses a session now: the model changed on disk, another program holds the port, the
266
286
  # runtime does not start), admin-only (multi-user mode, 403), unsupported (a Codeman without
267
287
  # local models, 404), unauthorized (401, §6), unreachable, error.
@@ -277,12 +297,23 @@ local_model() {
277
297
  | reduce ((.vars // {}) | to_entries[]) as $e ($t; gsub("\\{" + $e.key + "\\}"; $e.value));
278
298
  .data as $d | ($d.install // {}) as $i | ($i.actions // []) as $a
279
299
  | {state:$i.state, running:($i.running == true), cli:$i.cli, cliLabel:$i.cliLabel,
280
- endpointId:$i.endpointId, modelId:$i.model.id, modelLabel:$i.model.label} as $base
300
+ endpointId:$i.endpointId, modelId:$i.model.id, modelLabel:$i.model.label,
301
+ agents:(if ($i.harnesses | type) == "array"
302
+ then [$i.harnesses[] | {cli, cliLabel, status, default, readyMark} | with_entries(select(.value != null))]
303
+ else null end),
304
+ models:(if ($i.library | type) == "array" and ($i.library | length) > 0
305
+ then [$i.library[] | {id, label, active, status, sizeGb} | with_entries(select(.value != null))]
306
+ else null end)} as $base
281
307
  | if ($d | type) != "object" then {spawnable:false, reason:"error", message:"no data in the answer"}
282
308
  elif $i.state == "installed" then
309
+ # With the agents listed and none of them startable there is nothing to spawn,
310
+ # running or not: say that, not "blocked".
311
+ if $i.error == null and $base.agents != null and ([$base.agents[] | select(.status == "ready")] | length) == 0
312
+ then {spawnable:false, reason:"no-agent",
313
+ message:"The model is installed, but no coding agent that can run it is on this Mac. A person installs one in the Run a local model window."} + $base
283
314
  # `start` alone over-promises: it is offered too while another program holds the
284
315
  # port. Only an error-free start is a runtime spawn_worker can bring up.
285
- if ($i.cli and $i.endpointId and $i.model.id)
316
+ elif ($i.cli and $i.endpointId and $i.model.id)
286
317
  and (($a | index("start-session")) != null or (($a | index("start")) != null and $i.error == null))
287
318
  then {spawnable:true} + $base
288
319
  else {spawnable:false, reason:"blocked", errorCode:$i.error.code,
@@ -345,31 +376,55 @@ _local_ready_model() {
345
376
  # rather than handed back, because a worker that never drew its composer would eat the
346
377
  # task prompt with its trust dialog. There is deliberately no pid poll: wait-output
347
378
  # already blocks until the composer draws, and pid!=null proved startup, never readiness.
348
- # mode `local` is the model Codeman installed on this Mac (local_model), run by the coding
349
- # agent it was installed with. The worker's mode becomes that agent, and the endpoint and
350
- # model ride the quick-start as `customModel`: the launch the window's "Start a session"
351
- # makes. A stopped runtime is started first. Any answer that wants a person to confirm
352
- # something (a context below the agent's safe floor, a model swap) fails the spawn: this
353
- # never confirms on anyone's behalf.
379
+ # mode `local` is the model Codeman installed on this Mac (local_model), run by its default
380
+ # coding agent; `local:<cli>` (`local:pi`, `local:deepseek`, `local:opencode`, `local:claude`)
381
+ # picks another one of local_model's `agents`, which must be `ready`. The worker's mode
382
+ # becomes that agent, and the endpoint and model ride the quick-start as `customModel`: the
383
+ # launch the window's "Start a session" makes. A stopped runtime is started first. Any answer
384
+ # that wants a person to confirm something (a context below the agent's safe floor, a model
385
+ # swap) fails the spawn: this never confirms on anyone's behalf, and it never installs an
386
+ # agent. All local workers share ONE model that answers one request at a time.
354
387
  # CODEMAN_WORKER_ADVISOR=opus (or fable / sonnet) gives every CLAUDE worker spawned while
355
388
  # it is set Claude Code's advisor tool: a stronger model the worker consults before
356
389
  # committing to an approach, on a recurring error and before declaring the task done.
357
390
  # Other modes ignore it. A value the server refuses fails the spawn (INVALID_INPUT); an
358
391
  # advisor that ranks below the worker's model is accepted but never attached by claude.
359
392
  spawn_worker() {
360
- local name="${1:?spawn_worker needs a case name}" mode="${2:-claude}" q sid cp r lm cm='' mark=''
393
+ local name="${1:?spawn_worker needs a case name}" mode="${2:-claude}" q sid cp r lm cm='' mark='' want=''
394
+ case "$mode" in local:*) want=${mode#local:}; mode=local ;; esac
361
395
  if [ "$mode" = local ]; then
362
396
  lm=$(_local_ready_model) || return 1
363
- mode=$(jq -r .cli <<<"$lm")
397
+ if [ -n "$want" ]; then
398
+ # Only an agent the server lists as startable. A Codeman that lists none (older than
399
+ # 1.51) knows one agent, its `cli`: naming that one is fine, any other is not.
400
+ r=$(jq -r --arg w "$want" 'if (.agents | type) == "array" then ([.agents[] | select(.cli == $w) | .status][0] // "absent")
401
+ elif .cli == $w then "ready" else "unlisted" end' <<<"$lm")
402
+ case "$r" in
403
+ ready) ;;
404
+ unlisted) echo "this Codeman lists one coding agent for the local model, $(jq -r .cli <<<"$lm"): use plain \`local\`, or update Codeman to choose another" >&2; return 1 ;;
405
+ absent) echo "the local model cannot be run with '$want' here. Startable: $(jq -r '[.agents[] | select(.status == "ready") | .cli] | join(", ")' <<<"$lm")" >&2; return 1 ;;
406
+ *) echo "the coding agent '$want' is not startable on this Mac ($r): a person installs or sets it up in the Run a local model window. Startable now: $(jq -r '[.agents[] | select(.status == "ready") | .cli] | join(", ")' <<<"$lm")" >&2; return 1 ;;
407
+ esac
408
+ mode=$want
409
+ else
410
+ mode=$(jq -r .cli <<<"$lm")
411
+ fi
364
412
  cm=$(jq -c '{endpointId, modelId}' <<<"$lm")
365
- # Readiness is a token the agent's composer draws. The registry's composer data never
366
- # reaches the API, so it is named per agent here. opencode: `┃`, its `workDetect.promptGlyph`.
367
- # That field is no readiness mark in general (the registry keeps `composerReadyMark` for
368
- # that, and declares none for opencode), but at boot only the composer draws it: measured
369
- # on opencode 1.3.0 on Linux, fresh home, custom provider, the first `┃` came with the composer,
370
- # and a prompt pasted with its Enter at that moment was submitted. claude takes the claude
371
- # path below. Any other agent needs LOCAL_READY_MARK rather than a worker handed back on a guess.
372
- [ "$mode" = opencode ] && mark='┃'
413
+ # Readiness is a token the agent's composer draws once it takes input. The server names
414
+ # the measured one per agent (`readyMark`: opencode `┃`, deepseek `❯`, claude `shift+tab`).
415
+ # For a server that sends none, the two this skill measured itself:
416
+ # - opencode `┃`: at boot only the composer draws it (1.3.0 and 1.19.5, a prompt pasted
417
+ # at the mark was submitted every time).
418
+ # - pi `extended-keys`: pi paints its composer rules in its FIRST frame and ignores Enter
419
+ # until startup has finished, so its rule is no mark (a prompt sent at it stayed
420
+ # unsent, 2 of 2). The last line of its startup is a warning that tmux's
421
+ # `extended-keys` option is off, which it is on Codeman's socket: a prompt sent once
422
+ # that word showed was submitted, 4 of 4 on pi 1.5.2. It is a side effect, not a
423
+ # contract, so a pi that stops printing it fails the spawn (the worker is deleted, never
424
+ # handed back on a guess) until LOCAL_READY_MARK names what it draws instead.
425
+ # claude takes the claude path below.
426
+ mark=$(jq -r --arg m "$mode" '[(.agents // [])[] | select(.cli == $m) | .readyMark // empty][0] // empty' <<<"$lm")
427
+ [ -n "$mark" ] || case "$mode" in opencode) mark='┃' ;; pi) mark='extended-keys' ;; esac
373
428
  mark=${LOCAL_READY_MARK:-$mark}
374
429
  [ "$mode" = claude ] || [ -n "$mark" ] || {
375
430
  echo "the local model runs through $mode, and this skill knows no composer mark for it: set LOCAL_READY_MARK to a space-free token its composer draws" >&2
@@ -384,11 +439,16 @@ spawn_worker() {
384
439
  # server clamps this back to `workspace-write` for an owner without the grant.
385
440
  # Spawn by hand (§5.1) when you want a worker that asks. The advisor is a cloud model,
386
441
  # so a claude worker on the local model never gets one.
442
+ # pi on the local model: a custom model session gives pi a home of its own, so it would
443
+ # ask "Trust project folder?" in EVERY session whose parent folders hold agent skills, with
444
+ # Trust preselected, and the task prompt's Enter would answer it. `approveProjectTrust:
445
+ # false` starts it with --no-approve: no dialog, and no project code is trusted for anyone.
387
446
  q=$("${CURL[@]}" -X POST "$API/api/v1/quick-start" -H 'Content-Type: application/json' \
388
447
  -d "$(jq -nc --arg n "$name" --arg m "$mode" --arg p "$SELF" --arg a "${CODEMAN_WORKER_ADVISOR:-}" --arg cm "$cm" \
389
448
  '{caseName:$n,mode:$m,parentSessionId:$p}
390
449
  + (if $m == "deepseek" then {deepSeekConfig:{permissionMode:"danger-full-access"}} else {} end)
391
450
  + (if $m == "claude" and $a != "" and $cm == "" then {advisorModel:$a} else {} end)
451
+ + (if $m == "pi" and $cm != "" then {piConfig:{approveProjectTrust:false}} else {} end)
392
452
  + (if $cm != "" then {customModel:($cm | fromjson)} else {} end)')")
393
453
  # The answers that want a PERSON to decide come back as success with no session id.
394
454
  if jq -e '(.data // .) | (.requiresContextWarning or .requiresConfirmation)' <<<"$q" >/dev/null 2>&1; then
@@ -405,11 +465,18 @@ spawn_worker() {
405
465
  echo "worker $sid: this Codeman server ignored CODEMAN_WORKER_ADVISOR (no advisor support); it runs without one" >&2
406
466
  fi
407
467
  if [ -n "$cm" ] && [ "$mode" != claude ]; then
408
- # No trust dialog and no hook file to vet: the agent has no hooks, which is exactly
409
- # why sendwait refuses it (400) and sendmark drives it.
468
+ # No trust dialog and no hook file to vet. opencode and pi have no end-of-turn signal,
469
+ # which is exactly why sendwait refuses them (400) and sendmark drives them. A deepseek
470
+ # worker reports the end of a turn on the local model too, but sendmark is still the way
471
+ # to get its ANSWER: dsh 0.2.2 renamed its transcript file, and until Codeman reads the
472
+ # new one `last-response` comes back empty for it.
410
473
  r=$(_mark_up "$sid" "$mark" 45000)
411
474
  [ "$r" = true ] || { echo "local worker $sid ($mode) never drew '$mark' within 45 s; deleted it. Look at GET /api/v1/local-model and the pane of a hand-made session before retrying" >&2
412
475
  delete_session "$sid" >/dev/null; return 1; }
476
+ if [ "$mode" = deepseek ] && _dsh_guide "$sid"; then
477
+ echo "dsh worker $sid opened DeepSeek Harness's setup guide instead of a composer; deleted it. A person finishes that guide once (start a DeepSeek session from the Run menu), then spawn again" >&2
478
+ delete_session "$sid" >/dev/null; return 1
479
+ fi
413
480
  printf '%s\n' "$sid"; return 0
414
481
  fi
415
482
  if [ "$mode" = deepseek ]; then
@@ -425,6 +492,10 @@ spawn_worker() {
425
492
  r=$(_dsh_up "$sid" 45000)
426
493
  [ "$r" = true ] || { echo "dsh worker $sid never drew a composer: no pane-capable profile, a profile whose composer is not '${DSH_READY_MARK:-❯}' (set DSH_READY_MARK), or a harness that failed to boot -- check GET /api/v1/deepseek/status. Deleted it" >&2
427
494
  delete_session "$sid" >/dev/null; return 1; }
495
+ if _dsh_guide "$sid"; then
496
+ echo "dsh worker $sid opened DeepSeek Harness's setup guide instead of a composer; deleted it. A person finishes that guide once (start a DeepSeek session from the Run menu), then spawn again" >&2
497
+ delete_session "$sid" >/dev/null; return 1
498
+ fi
428
499
  printf '%s\n' "$sid"; return 0
429
500
  fi
430
501
  [ "$mode" = claude ] || { printf '%s\n' "$sid"; return 0; } # no other mode draws a composer to wait on
@@ -572,7 +643,7 @@ sendwait() {
572
643
  # complete answer to codeman-answer-<token>.md in the working directory, and only then end
573
644
  # the reply with the word DONE immediately followed by _<token>. The marker is split in what
574
645
  # is typed, so the prompt echoing into the pane never matches it, and the token is new for
575
- # every call (§5.5). The send is sendwait's exactly-once body (per-worker clientId,
646
+ # every call and every worker (§5.5). The send is sendwait's exactly-once body (per-worker clientId,
576
647
  # epoch-second seq) with a one-second `exit` wait, so `delivered` says the pane took it.
577
648
  # ⚠️ A marker proves that the model printed the token. Not that it did the work, not that
578
649
  # it did it right, not even that the turn is over: a reasoning model can restate the
@@ -596,7 +667,12 @@ sendmark() {
596
667
  p=$(printf '%s\n' "$p" | tr '\r' '\n' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e '/^$/d' | paste -sd ' ' -) ;;
597
668
  esac
598
669
  [ -n "$p" ] || { echo "sendmark: empty prompt" >&2; return 1; }
599
- tok=$(printf 'm%x%04x' "$(date +%s)" "$RANDOM"); mark="DONE_$tok"
670
+ # The token carries six characters of the WORKER's id on top of the second and $RANDOM.
671
+ # Those two repeat: in zsh (the shell Claude Code runs on a Mac) every subshell draws the
672
+ # SAME $RANDOM until the parent shell reads it, and this line is a subshell. Two sendmark
673
+ # calls started in one second for two workers in ONE folder shared a token, and one
674
+ # worker's answer file replaced the other's (seen on a Mac, 2026-11-12).
675
+ tok=$(printf 'm%x%04x%s' "$(date +%s)" "$RANDOM" "$(printf '%s' "$sid" | tr -cd 'a-f0-9' | cut -c1-6)"); mark="DONE_$tok"
600
676
  if [ "${SENDMARK_ANSWER_FILE:-1}" != 0 ]; then
601
677
  wd=$("${CURL[@]}" "$API/api/v1/sessions/$sid" | jq -r '.data.workingDir // empty' 2>/dev/null)
602
678
  [ -n "$wd" ] || { echo "sendmark: could not read the working directory of worker $sid" >&2; return 1; }
@@ -683,10 +759,10 @@ last_text() {
683
759
  # The stamp is the LAST line on purpose (a truncated write leaves it unset) and is kept
684
760
  # bare on purpose: the write condition above anchors on it with $, so an inline comment
685
761
  # here would fail that match and rewrite this file on every single bootstrap.
686
- CODEMAN_PREAMBLE=1.50.0
762
+ CODEMAN_PREAMBLE=1.51.0
687
763
  PREAMBLE
688
764
  )
689
- . "$PRE"; [ "${CODEMAN_PREAMBLE:-}" = 1.50.0 ] || { echo "preamble at $PRE is stale or truncated: rm it and re-run this block"; exit 1; }
765
+ . "$PRE"; [ "${CODEMAN_PREAMBLE:-}" = 1.51.0 ] || { echo "preamble at $PRE is stale or truncated: rm it and re-run this block"; exit 1; }
690
766
  ```
691
767
 
692
768
  Every later Bash call that touches the API starts with the same two loader lines from
@@ -737,7 +813,7 @@ and no per-call body to hand-build.
737
813
 
738
814
  ```bash
739
815
  . "${XDG_CACHE_HOME:-$HOME/.cache}/codeman-agent-$CODEMAN_SESSION_ID.sh" 2>/dev/null # §0 loader
740
- [ "${CODEMAN_PREAMBLE:-}" = 1.50.0 ] || { echo "preamble missing or stale; run the full §0 block"; exit 1; }
816
+ [ "${CODEMAN_PREAMBLE:-}" = 1.51.0 ] || { echo "preamble missing or stale; run the full §0 block"; exit 1; }
741
817
  N=(alpha beta) # INVENT one fresh case name per worker; never list cases first
742
818
  # (a name may carry a mode: `beta:deepseek`, see below)
743
819
  T=('reply with one line: the absolute path of your working directory'
@@ -826,7 +902,8 @@ Harness TUI reports `idle`/`working`/`blocked` to Codeman over the supervisor co
826
902
  implements, so dsh is the one external CLI with definitive `stop`/`blocked` signals
827
903
  instead of guessed-from-silence ones — and it writes a structured transcript, which is
828
904
  what `last-response` reads for it. `shell`, `opencode`, `gemini`, `antigravity`, `pi`,
829
- `grok`, `omp` and `copilot` have neither, and `codex` has a transcript and a screen-read `blocked` but
905
+ `grok`, `omp`, `copilot` and `jcode` have neither (one exception: a local `omp` session reports
906
+ `blocked` for its tool approval dialogs, and still no `stop`), and `codex` has a transcript and a screen-read `blocked` but
830
907
  no `stop`, so all of them still need markers ([§5.5](reference/verbs.md#55-markers-for-hook-less-workers)).
831
908
 
832
909
  Three things to know before you spawn one:
@@ -850,9 +927,25 @@ Three things to know before you spawn one:
850
927
  When Codeman has installed a model on the Mac it runs on (the **Run a local model** button
851
928
  on its welcome screen), you can hand work to that model from here. You stay the planner and
852
929
  the reviewer in the cloud; the Mac does the bulk. `spawn_worker <name> local` starts a worker
853
- on the installed model, run by the coding agent it was installed with (OpenCode on the Mac
854
- it was tested on), and from then on it is the same verbs. It mixes into one fleet like any
855
- other mode: `spawn_workers plan review:deepseek summ:local`.
930
+ on the installed model, run by its default coding agent (OpenCode on the Mac it was tested
931
+ on), and from then on it is the same verbs. It mixes into one fleet like any other mode:
932
+ `spawn_workers plan review:deepseek summ:local`.
933
+
934
+ **Which coding agent runs the worker is yours to choose.** `local_model` lists them as
935
+ `agents`, each with a `status`; `spawn_worker <name> local:<cli>` starts one that is `ready`:
936
+
937
+ | Worker kind | Agent | Why you would pick it | Drive it with |
938
+ | --- | --- | --- | --- |
939
+ | `local` | the default one (`cli` of `local_model`) | you have no reason to choose | `sendmark` (`sendwait` when it is claude) |
940
+ | `local:opencode` | OpenCode | the tested pair; a full tool set | `sendmark` |
941
+ | `local:pi` | Pi | the smallest fixed prompt (about 2,100 tokens against 8,000 and more), so the first answer comes soonest and the most context is left for the work | `sendmark` |
942
+ | `local:deepseek` | DeepSeek Harness | the user already works with it | `sendmark` (it reports the end of a turn, but on dsh 0.2.2 its answer cannot be read back through `sendwait` yet) |
943
+ | `local:claude` | Claude Code | hooks and `sendwait`, at the price of a first answer that takes minutes | `sendwait` |
944
+
945
+ An agent whose status is `installable`, `installing` or `setup-needed` is not startable, and
946
+ the spawn says so with the ones that are. Installing an agent is a person's click in the
947
+ **Run a local model** window, like installing a model: tell the user, do not work around it.
948
+ A Codeman older than 1.51 lists no agents, and only plain `local` works there.
856
949
 
857
950
  Reach for it when:
858
951
 
@@ -866,9 +959,9 @@ Reach for it when:
866
959
 
867
960
  ```bash
868
961
  . "${XDG_CACHE_HOME:-$HOME/.cache}/codeman-agent-$CODEMAN_SESSION_ID.sh" 2>/dev/null # §0 loader
869
- [ "${CODEMAN_PREAMBLE:-}" = 1.50.0 ] || { echo "preamble missing or stale; run the full §0 block"; exit 1; }
870
- local_model || exit 1 # one JSON line: model, agent, endpoint; or the reason there is none
871
- SID=$(spawn_worker summ local) || exit 1 # starts a stopped runtime first; empty = failed
962
+ [ "${CODEMAN_PREAMBLE:-}" = 1.51.0 ] || { echo "preamble missing or stale; run the full §0 block"; exit 1; }
963
+ local_model || exit 1 # one JSON line: model, agents, endpoint; or the reason there is none
964
+ SID=$(spawn_worker summ local) || exit 1 # or local:pi, local:deepseek; starts a stopped runtime first; empty = failed
872
965
  WD=$("${CURL[@]}" "$API/api/v1/sessions/$SID" | jq -r .data.workingDir)
873
966
  mkdir -p "$WD/input" && cp ./docs/*.md "$WD/input/" # inside its own folder (§5.9), apart from its CLAUDE.md
874
967
  R=$(sendmark "$SID" 'Summarize each .md file in the folder input, two lines each' 900); RC=$?
@@ -891,8 +984,9 @@ The limits, before you promise the user anything:
891
984
  - **A Mac with Apple silicon, and a model a person installed** in Codeman's local model
892
985
  window. This skill never installs one: that is a download of many gigabytes the person
893
986
  confirms there. `local_model` says what is missing (`not-mac`, `not-installed`,
894
- `install-unfinished`, `blocked`, `admin-only`, `unsupported`), so tell the user that
895
- instead of guessing.
987
+ `install-unfinished`, `no-agent`, `blocked`, `admin-only`, `unsupported`), so tell the
988
+ user that instead of guessing. It also lists the models on this Mac (`models`); only the
989
+ `active` one runs, and switching to another is a person's decision in the window.
896
990
  - **One model, one request at a time.** The runtime loads one model and answers one request
897
991
  at a time, so two local workers take turns rather than work side by side. Fan out to the
898
992
  cloud; give the Mac a queue.
@@ -900,9 +994,20 @@ The limits, before you promise the user anything:
900
994
  M5 Pro with 48 GB, ran at about 68 tokens a second, and the first request after a start
901
995
  loads the model first. A local worker run by claude spends minutes on its first answer
902
996
  (its fixed prompt is about 36,000 tokens).
903
- - **Markers, not hooks.** OpenCode reports no end of turn, so `sendwait` answers 400 for
904
- that worker; `sendmark` is the way through. If the installed agent is claude, the worker
905
- has hooks and `sendwait` works as for any claude worker.
997
+ - **Markers, not hooks.** OpenCode and Pi report no end of turn, so `sendwait` answers 400
998
+ for those workers; `sendmark` is the way through. A claude worker has hooks, so
999
+ `sendwait` works for it. A DeepSeek Harness worker reports its turns too, but drive it
1000
+ with `sendmark` on the local model: dsh 0.2.2 renamed its transcript file, and Codeman
1001
+ reads an empty answer from it for now.
1002
+ - **DeepSeek Harness has a setup guide a person finishes once.** Until then every dsh
1003
+ session opens on it, and the spawn refuses the worker (and deletes it) instead of typing
1004
+ a task into a sign-in screen. Tell the user to start one DeepSeek session from the Run
1005
+ menu and finish the guide.
1006
+ - **Pi starts without trusting the folder.** A `local:pi` worker is started with
1007
+ `--no-approve`, so it loads no project extensions or skills from the case folder: on the
1008
+ local model Pi would otherwise ask to trust the folder in every session, and a task
1009
+ prompt must never answer that question. Pi also fetches its two search tools at each such
1010
+ start, which needs the network for a moment.
906
1011
  - **Spawning can change what the person set.** A stopped runtime is started, which also
907
1012
  undoes the person's Stop: it then starts with Codeman again. And while a local worker is
908
1013
  open, the window refuses Stop and Remove and names your workers, so delete them as soon
@@ -1,4 +1,4 @@
1
- # ---- Codeman agent preamble 1.50.0 (seeded by Codeman at session spawn; the SKILL.md §0 bootstrap rewrites it when missing or stale) ----
1
+ # ---- Codeman agent preamble 1.51.0 (seeded by Codeman at session spawn; the SKILL.md §0 bootstrap rewrites it when missing or stale) ----
2
2
  # Positional parameters are always written with braces, ${1} and never a bare dollar-digit: Claude Code
3
3
  # replaces a bare one in a skill body with the matching word of the skill's arguments, and §0 is pasted
4
4
  # from that body (test/agent-skill.test.ts pins it).
@@ -59,6 +59,17 @@ _dsh_up() { # <sid> <timeoutMs> -> "true"/"false". The DeepSeek Harness T
59
59
  # composer glyph. Override with DSH_READY_MARK for a profile that draws another one.
60
60
  _mark_up "${1}" "${DSH_READY_MARK:-❯}" "${2}"
61
61
  }
62
+ _dsh_guide() { # <sid> -> 0 when the pane shows dsh-TUI's first-run SETUP GUIDE, not a composer.
63
+ # dsh-TUI 0.19.0 opens a guide ("Welcome to dsh-TUI Step 1 of 4") in every session until a
64
+ # person has finished it once, and the guide's own cursor is `❯`: the readiness mark matches
65
+ # on it (measured, 2 of 2 launches), and an Enter there acts on the highlighted step, which
66
+ # is a sign-in. So a worker whose mark matched is still checked for the guide, on the
67
+ # RENDERED pane with its whitespace removed, and never handed back while it shows.
68
+ "${CURL[@]}" -G "$API/api/v1/sessions/${1}/terminal" --data-urlencode 'full=1' \
69
+ | jq -r '.data.terminalBuffer // empty' \
70
+ | sed -e "s/$(printf '\033')\[[0-9;?]*[a-zA-Z]//g" -e "s/$(printf '\033')[()][AB0]//g" \
71
+ | tr -d ' \t' | grep -qi 'Step[0-9]of[0-9]'
72
+ }
62
73
  # ---- the workspace-trust dialog: READ the screen, never press Enter blind ----
63
74
  # Claude Code 2.1.252 dropped the option numbers, REVERSED them, and highlights
64
75
  # "No, exit" by default:
@@ -121,9 +132,18 @@ _accept_trust() { # <sid> -> 0 once it has answered the dialog, 1 if it could n
121
132
  # local_model -> ONE compact JSON object on stdout. rc 0 only when a `local` worker can be
122
133
  # spawned now (`running:true`) or once spawn_worker has started the runtime (`running:false`):
123
134
  # {"spawnable":true,"state":"installed","running":true,"cli":"opencode","cliLabel":"OpenCode",
124
- # "endpointId":"local-ollama","modelId":"<id>","modelLabel":"<label>"}
135
+ # "endpointId":"local-ollama","modelId":"<id>","modelLabel":"<label>",
136
+ # "agents":[{"cli":"opencode","cliLabel":"OpenCode","status":"ready","default":true,"readyMark":"┃"},
137
+ # {"cli":"pi","cliLabel":"Pi","status":"installable","default":false}],
138
+ # "models":[{"id":"<id>","label":"<label>","active":true,"status":"ready","sizeGb":"23.1"}]}
139
+ # `cli` is the DEFAULT coding agent, the one `spawn_worker <name> local` starts. `agents` is
140
+ # every agent the model can be run with: `local:<cli>` starts one whose status is `ready`
141
+ # (`installable`, `installing` and `setup-needed` are a person's to resolve in the window).
142
+ # `models` is what is on this Mac; only the `active` one runs, and switching is a person's
143
+ # decision too. A Codeman older than 1.51 sends neither list: only `local` works there.
125
144
  # Otherwise rc 1 and {"spawnable":false,"reason":"<reason>","message":"<why>",...}, the reason
126
- # one of: not-mac, not-installed, install-unfinished, blocked (installed, but the server
145
+ # one of: not-mac, not-installed, install-unfinished, no-agent (installed, but no coding agent
146
+ # that can run the model is on this Mac), blocked (installed, but the server
127
147
  # refuses a session now: the model changed on disk, another program holds the port, the
128
148
  # runtime does not start), admin-only (multi-user mode, 403), unsupported (a Codeman without
129
149
  # local models, 404), unauthorized (401, §6), unreachable, error.
@@ -139,12 +159,23 @@ local_model() {
139
159
  | reduce ((.vars // {}) | to_entries[]) as $e ($t; gsub("\\{" + $e.key + "\\}"; $e.value));
140
160
  .data as $d | ($d.install // {}) as $i | ($i.actions // []) as $a
141
161
  | {state:$i.state, running:($i.running == true), cli:$i.cli, cliLabel:$i.cliLabel,
142
- endpointId:$i.endpointId, modelId:$i.model.id, modelLabel:$i.model.label} as $base
162
+ endpointId:$i.endpointId, modelId:$i.model.id, modelLabel:$i.model.label,
163
+ agents:(if ($i.harnesses | type) == "array"
164
+ then [$i.harnesses[] | {cli, cliLabel, status, default, readyMark} | with_entries(select(.value != null))]
165
+ else null end),
166
+ models:(if ($i.library | type) == "array" and ($i.library | length) > 0
167
+ then [$i.library[] | {id, label, active, status, sizeGb} | with_entries(select(.value != null))]
168
+ else null end)} as $base
143
169
  | if ($d | type) != "object" then {spawnable:false, reason:"error", message:"no data in the answer"}
144
170
  elif $i.state == "installed" then
171
+ # With the agents listed and none of them startable there is nothing to spawn,
172
+ # running or not: say that, not "blocked".
173
+ if $i.error == null and $base.agents != null and ([$base.agents[] | select(.status == "ready")] | length) == 0
174
+ then {spawnable:false, reason:"no-agent",
175
+ message:"The model is installed, but no coding agent that can run it is on this Mac. A person installs one in the Run a local model window."} + $base
145
176
  # `start` alone over-promises: it is offered too while another program holds the
146
177
  # port. Only an error-free start is a runtime spawn_worker can bring up.
147
- if ($i.cli and $i.endpointId and $i.model.id)
178
+ elif ($i.cli and $i.endpointId and $i.model.id)
148
179
  and (($a | index("start-session")) != null or (($a | index("start")) != null and $i.error == null))
149
180
  then {spawnable:true} + $base
150
181
  else {spawnable:false, reason:"blocked", errorCode:$i.error.code,
@@ -207,31 +238,55 @@ _local_ready_model() {
207
238
  # rather than handed back, because a worker that never drew its composer would eat the
208
239
  # task prompt with its trust dialog. There is deliberately no pid poll: wait-output
209
240
  # already blocks until the composer draws, and pid!=null proved startup, never readiness.
210
- # mode `local` is the model Codeman installed on this Mac (local_model), run by the coding
211
- # agent it was installed with. The worker's mode becomes that agent, and the endpoint and
212
- # model ride the quick-start as `customModel`: the launch the window's "Start a session"
213
- # makes. A stopped runtime is started first. Any answer that wants a person to confirm
214
- # something (a context below the agent's safe floor, a model swap) fails the spawn: this
215
- # never confirms on anyone's behalf.
241
+ # mode `local` is the model Codeman installed on this Mac (local_model), run by its default
242
+ # coding agent; `local:<cli>` (`local:pi`, `local:deepseek`, `local:opencode`, `local:claude`)
243
+ # picks another one of local_model's `agents`, which must be `ready`. The worker's mode
244
+ # becomes that agent, and the endpoint and model ride the quick-start as `customModel`: the
245
+ # launch the window's "Start a session" makes. A stopped runtime is started first. Any answer
246
+ # that wants a person to confirm something (a context below the agent's safe floor, a model
247
+ # swap) fails the spawn: this never confirms on anyone's behalf, and it never installs an
248
+ # agent. All local workers share ONE model that answers one request at a time.
216
249
  # CODEMAN_WORKER_ADVISOR=opus (or fable / sonnet) gives every CLAUDE worker spawned while
217
250
  # it is set Claude Code's advisor tool: a stronger model the worker consults before
218
251
  # committing to an approach, on a recurring error and before declaring the task done.
219
252
  # Other modes ignore it. A value the server refuses fails the spawn (INVALID_INPUT); an
220
253
  # advisor that ranks below the worker's model is accepted but never attached by claude.
221
254
  spawn_worker() {
222
- local name="${1:?spawn_worker needs a case name}" mode="${2:-claude}" q sid cp r lm cm='' mark=''
255
+ local name="${1:?spawn_worker needs a case name}" mode="${2:-claude}" q sid cp r lm cm='' mark='' want=''
256
+ case "$mode" in local:*) want=${mode#local:}; mode=local ;; esac
223
257
  if [ "$mode" = local ]; then
224
258
  lm=$(_local_ready_model) || return 1
225
- mode=$(jq -r .cli <<<"$lm")
259
+ if [ -n "$want" ]; then
260
+ # Only an agent the server lists as startable. A Codeman that lists none (older than
261
+ # 1.51) knows one agent, its `cli`: naming that one is fine, any other is not.
262
+ r=$(jq -r --arg w "$want" 'if (.agents | type) == "array" then ([.agents[] | select(.cli == $w) | .status][0] // "absent")
263
+ elif .cli == $w then "ready" else "unlisted" end' <<<"$lm")
264
+ case "$r" in
265
+ ready) ;;
266
+ unlisted) echo "this Codeman lists one coding agent for the local model, $(jq -r .cli <<<"$lm"): use plain \`local\`, or update Codeman to choose another" >&2; return 1 ;;
267
+ absent) echo "the local model cannot be run with '$want' here. Startable: $(jq -r '[.agents[] | select(.status == "ready") | .cli] | join(", ")' <<<"$lm")" >&2; return 1 ;;
268
+ *) echo "the coding agent '$want' is not startable on this Mac ($r): a person installs or sets it up in the Run a local model window. Startable now: $(jq -r '[.agents[] | select(.status == "ready") | .cli] | join(", ")' <<<"$lm")" >&2; return 1 ;;
269
+ esac
270
+ mode=$want
271
+ else
272
+ mode=$(jq -r .cli <<<"$lm")
273
+ fi
226
274
  cm=$(jq -c '{endpointId, modelId}' <<<"$lm")
227
- # Readiness is a token the agent's composer draws. The registry's composer data never
228
- # reaches the API, so it is named per agent here. opencode: `┃`, its `workDetect.promptGlyph`.
229
- # That field is no readiness mark in general (the registry keeps `composerReadyMark` for
230
- # that, and declares none for opencode), but at boot only the composer draws it: measured
231
- # on opencode 1.3.0 on Linux, fresh home, custom provider, the first `┃` came with the composer,
232
- # and a prompt pasted with its Enter at that moment was submitted. claude takes the claude
233
- # path below. Any other agent needs LOCAL_READY_MARK rather than a worker handed back on a guess.
234
- [ "$mode" = opencode ] && mark='┃'
275
+ # Readiness is a token the agent's composer draws once it takes input. The server names
276
+ # the measured one per agent (`readyMark`: opencode `┃`, deepseek `❯`, claude `shift+tab`).
277
+ # For a server that sends none, the two this skill measured itself:
278
+ # - opencode `┃`: at boot only the composer draws it (1.3.0 and 1.19.5, a prompt pasted
279
+ # at the mark was submitted every time).
280
+ # - pi `extended-keys`: pi paints its composer rules in its FIRST frame and ignores Enter
281
+ # until startup has finished, so its rule is no mark (a prompt sent at it stayed
282
+ # unsent, 2 of 2). The last line of its startup is a warning that tmux's
283
+ # `extended-keys` option is off, which it is on Codeman's socket: a prompt sent once
284
+ # that word showed was submitted, 4 of 4 on pi 1.5.2. It is a side effect, not a
285
+ # contract, so a pi that stops printing it fails the spawn (the worker is deleted, never
286
+ # handed back on a guess) until LOCAL_READY_MARK names what it draws instead.
287
+ # claude takes the claude path below.
288
+ mark=$(jq -r --arg m "$mode" '[(.agents // [])[] | select(.cli == $m) | .readyMark // empty][0] // empty' <<<"$lm")
289
+ [ -n "$mark" ] || case "$mode" in opencode) mark='┃' ;; pi) mark='extended-keys' ;; esac
235
290
  mark=${LOCAL_READY_MARK:-$mark}
236
291
  [ "$mode" = claude ] || [ -n "$mark" ] || {
237
292
  echo "the local model runs through $mode, and this skill knows no composer mark for it: set LOCAL_READY_MARK to a space-free token its composer draws" >&2
@@ -246,11 +301,16 @@ spawn_worker() {
246
301
  # server clamps this back to `workspace-write` for an owner without the grant.
247
302
  # Spawn by hand (§5.1) when you want a worker that asks. The advisor is a cloud model,
248
303
  # so a claude worker on the local model never gets one.
304
+ # pi on the local model: a custom model session gives pi a home of its own, so it would
305
+ # ask "Trust project folder?" in EVERY session whose parent folders hold agent skills, with
306
+ # Trust preselected, and the task prompt's Enter would answer it. `approveProjectTrust:
307
+ # false` starts it with --no-approve: no dialog, and no project code is trusted for anyone.
249
308
  q=$("${CURL[@]}" -X POST "$API/api/v1/quick-start" -H 'Content-Type: application/json' \
250
309
  -d "$(jq -nc --arg n "$name" --arg m "$mode" --arg p "$SELF" --arg a "${CODEMAN_WORKER_ADVISOR:-}" --arg cm "$cm" \
251
310
  '{caseName:$n,mode:$m,parentSessionId:$p}
252
311
  + (if $m == "deepseek" then {deepSeekConfig:{permissionMode:"danger-full-access"}} else {} end)
253
312
  + (if $m == "claude" and $a != "" and $cm == "" then {advisorModel:$a} else {} end)
313
+ + (if $m == "pi" and $cm != "" then {piConfig:{approveProjectTrust:false}} else {} end)
254
314
  + (if $cm != "" then {customModel:($cm | fromjson)} else {} end)')")
255
315
  # The answers that want a PERSON to decide come back as success with no session id.
256
316
  if jq -e '(.data // .) | (.requiresContextWarning or .requiresConfirmation)' <<<"$q" >/dev/null 2>&1; then
@@ -267,11 +327,18 @@ spawn_worker() {
267
327
  echo "worker $sid: this Codeman server ignored CODEMAN_WORKER_ADVISOR (no advisor support); it runs without one" >&2
268
328
  fi
269
329
  if [ -n "$cm" ] && [ "$mode" != claude ]; then
270
- # No trust dialog and no hook file to vet: the agent has no hooks, which is exactly
271
- # why sendwait refuses it (400) and sendmark drives it.
330
+ # No trust dialog and no hook file to vet. opencode and pi have no end-of-turn signal,
331
+ # which is exactly why sendwait refuses them (400) and sendmark drives them. A deepseek
332
+ # worker reports the end of a turn on the local model too, but sendmark is still the way
333
+ # to get its ANSWER: dsh 0.2.2 renamed its transcript file, and until Codeman reads the
334
+ # new one `last-response` comes back empty for it.
272
335
  r=$(_mark_up "$sid" "$mark" 45000)
273
336
  [ "$r" = true ] || { echo "local worker $sid ($mode) never drew '$mark' within 45 s; deleted it. Look at GET /api/v1/local-model and the pane of a hand-made session before retrying" >&2
274
337
  delete_session "$sid" >/dev/null; return 1; }
338
+ if [ "$mode" = deepseek ] && _dsh_guide "$sid"; then
339
+ echo "dsh worker $sid opened DeepSeek Harness's setup guide instead of a composer; deleted it. A person finishes that guide once (start a DeepSeek session from the Run menu), then spawn again" >&2
340
+ delete_session "$sid" >/dev/null; return 1
341
+ fi
275
342
  printf '%s\n' "$sid"; return 0
276
343
  fi
277
344
  if [ "$mode" = deepseek ]; then
@@ -287,6 +354,10 @@ spawn_worker() {
287
354
  r=$(_dsh_up "$sid" 45000)
288
355
  [ "$r" = true ] || { echo "dsh worker $sid never drew a composer: no pane-capable profile, a profile whose composer is not '${DSH_READY_MARK:-❯}' (set DSH_READY_MARK), or a harness that failed to boot -- check GET /api/v1/deepseek/status. Deleted it" >&2
289
356
  delete_session "$sid" >/dev/null; return 1; }
357
+ if _dsh_guide "$sid"; then
358
+ echo "dsh worker $sid opened DeepSeek Harness's setup guide instead of a composer; deleted it. A person finishes that guide once (start a DeepSeek session from the Run menu), then spawn again" >&2
359
+ delete_session "$sid" >/dev/null; return 1
360
+ fi
290
361
  printf '%s\n' "$sid"; return 0
291
362
  fi
292
363
  [ "$mode" = claude ] || { printf '%s\n' "$sid"; return 0; } # no other mode draws a composer to wait on
@@ -434,7 +505,7 @@ sendwait() {
434
505
  # complete answer to codeman-answer-<token>.md in the working directory, and only then end
435
506
  # the reply with the word DONE immediately followed by _<token>. The marker is split in what
436
507
  # is typed, so the prompt echoing into the pane never matches it, and the token is new for
437
- # every call (§5.5). The send is sendwait's exactly-once body (per-worker clientId,
508
+ # every call and every worker (§5.5). The send is sendwait's exactly-once body (per-worker clientId,
438
509
  # epoch-second seq) with a one-second `exit` wait, so `delivered` says the pane took it.
439
510
  # ⚠️ A marker proves that the model printed the token. Not that it did the work, not that
440
511
  # it did it right, not even that the turn is over: a reasoning model can restate the
@@ -458,7 +529,12 @@ sendmark() {
458
529
  p=$(printf '%s\n' "$p" | tr '\r' '\n' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e '/^$/d' | paste -sd ' ' -) ;;
459
530
  esac
460
531
  [ -n "$p" ] || { echo "sendmark: empty prompt" >&2; return 1; }
461
- tok=$(printf 'm%x%04x' "$(date +%s)" "$RANDOM"); mark="DONE_$tok"
532
+ # The token carries six characters of the WORKER's id on top of the second and $RANDOM.
533
+ # Those two repeat: in zsh (the shell Claude Code runs on a Mac) every subshell draws the
534
+ # SAME $RANDOM until the parent shell reads it, and this line is a subshell. Two sendmark
535
+ # calls started in one second for two workers in ONE folder shared a token, and one
536
+ # worker's answer file replaced the other's (seen on a Mac, 2026-11-12).
537
+ tok=$(printf 'm%x%04x%s' "$(date +%s)" "$RANDOM" "$(printf '%s' "$sid" | tr -cd 'a-f0-9' | cut -c1-6)"); mark="DONE_$tok"
462
538
  if [ "${SENDMARK_ANSWER_FILE:-1}" != 0 ]; then
463
539
  wd=$("${CURL[@]}" "$API/api/v1/sessions/$sid" | jq -r '.data.workingDir // empty' 2>/dev/null)
464
540
  [ -n "$wd" ] || { echo "sendmark: could not read the working directory of worker $sid" >&2; return 1; }
@@ -545,4 +621,4 @@ last_text() {
545
621
  # The stamp is the LAST line on purpose (a truncated write leaves it unset) and is kept
546
622
  # bare on purpose: the write condition above anchors on it with $, so an inline comment
547
623
  # here would fail that match and rewrite this file on every single bootstrap.
548
- CODEMAN_PREAMBLE=1.50.0
624
+ CODEMAN_PREAMBLE=1.51.0