@humain/humain-code 0.4.15 → 0.4.17

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 (309) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +1 -1
  3. package/dist/bundle/agent-monitor.js +1 -1
  4. package/dist/bundle/chunks/anthropic-messages-TSNY5MWH.js +67 -0
  5. package/dist/bundle/chunks/azure-openai-responses-Z4DCXO2G.js +15 -0
  6. package/dist/bundle/chunks/bedrock-converse-stream.js +59 -42
  7. package/dist/bundle/chunks/{chunk-JRX7GYW3.js → chunk-4NFYTS4C.js} +8 -8
  8. package/dist/bundle/chunks/{chunk-MF2NEHP4.js → chunk-4XU7TDAL.js} +939 -560
  9. package/dist/bundle/chunks/{chunk-LUL775V7.js → chunk-5K5RFXXO.js} +4 -4
  10. package/dist/bundle/chunks/chunk-65U7MPF4.js +1790 -0
  11. package/dist/bundle/chunks/{chunk-AIXI6RIE.js → chunk-7PRU6YW3.js} +114 -82
  12. package/dist/bundle/chunks/{chunk-W5YJZKPF.js → chunk-AOL6QG6L.js} +2231 -2399
  13. package/dist/bundle/chunks/chunk-AWCJWXGD.js +212 -0
  14. package/dist/bundle/chunks/{chunk-NNKA2PAP.js → chunk-FHVNUUBF.js} +1 -1
  15. package/dist/bundle/chunks/chunk-FZUJXM6D.js +816 -0
  16. package/dist/bundle/chunks/chunk-IJYVMOB4.js +6 -0
  17. package/dist/bundle/chunks/chunk-LG2PJ6JN.js +131 -0
  18. package/dist/bundle/chunks/chunk-NCQ6WAQK.js +125 -0
  19. package/dist/bundle/chunks/{chunk-Z74ZYQPX.js → chunk-OKALNPTJ.js} +80 -210
  20. package/dist/bundle/chunks/{chunk-OX2IBCCA.js → chunk-PTP2ZHFQ.js} +88 -82
  21. package/dist/bundle/chunks/chunk-PY7SOXCA.js +10 -0
  22. package/dist/bundle/chunks/chunk-Q7VXYXY3.js +7 -0
  23. package/dist/bundle/chunks/{chunk-COF5P635.js → chunk-QEF72EIZ.js} +13 -13
  24. package/dist/bundle/chunks/{chunk-EYIYBQAR.js → chunk-RXOCQRBG.js} +1 -1
  25. package/dist/bundle/chunks/{chunk-BVHXWQLD.js → chunk-SCBU5WOP.js} +1 -1
  26. package/dist/bundle/chunks/{chunk-UDVC7A5S.js → chunk-TIFFHHW6.js} +16 -14
  27. package/dist/bundle/chunks/{chunk-L3J4P5JR.js → chunk-UGJAAWNC.js} +1 -1
  28. package/dist/bundle/chunks/chunk-V76YPIMT.js +48 -0
  29. package/dist/bundle/chunks/{chunk-Y3RFGBG2.js → chunk-X3O5MCKJ.js} +1 -1
  30. package/dist/bundle/chunks/{chunk-KK3KUUMM.js → chunk-X6OTEVGA.js} +71 -66
  31. package/dist/bundle/chunks/chunk-Y26OS23T.js +80 -0
  32. package/dist/bundle/chunks/chunk-YDBNMIA3.js +34 -0
  33. package/dist/bundle/chunks/{chunk-UHLW4KJ7.js → chunk-ZRGFX6T6.js} +92 -89
  34. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-JGN7NZCV.js → cloudflare-workers-ai-system-one-MUJQ6LT2.js} +1 -1
  35. package/dist/bundle/chunks/{compat-2S3PCPEI.js → compat-ARQPWKBQ.js} +8 -8
  36. package/dist/bundle/chunks/{dist-SGQMXO45.js → dist-D7M52E3X.js} +1416 -866
  37. package/dist/bundle/chunks/dist-LKDZAEUQ.js +7 -0
  38. package/dist/bundle/chunks/{dist-JXEXN6S2.js → dist-XVXV2CL4.js} +1 -1
  39. package/dist/bundle/chunks/dist-cjs-AXBW3N4F.js +182 -0
  40. package/dist/bundle/chunks/{easter-egg-3d-ZJ2JUFOA.js → easter-egg-3d-4SUPLBUF.js} +1 -1
  41. package/dist/bundle/chunks/{execute-LRTXH4YJ.js → execute-NTO3U76E.js} +10 -9
  42. package/dist/bundle/chunks/{extract-OZW5JHG6.js → extract-BKBHK4AK.js} +14 -13
  43. package/dist/bundle/chunks/github-copilot.js +34 -47
  44. package/dist/bundle/chunks/{google-generative-ai-YXXFSTX7.js → google-generative-ai-SJ4JO2MY.js} +2 -2
  45. package/dist/bundle/chunks/{google-vertex-3IVWLYJ5.js → google-vertex-KNLNNDET.js} +2 -2
  46. package/dist/bundle/chunks/host-63SNKK5Y.js +2 -0
  47. package/dist/bundle/chunks/jiti-static-loader-7OZNBOCI.js +2 -0
  48. package/dist/bundle/chunks/{mistral-conversations-Y7GWO3QB.js → mistral-conversations-G3GN6CMT.js} +20 -20
  49. package/dist/bundle/chunks/{node-SPBTZUUS.js → node-DZCAT4Q6.js} +1 -1
  50. package/dist/bundle/chunks/{openai-codex-responses-NSXWHIDT.js → openai-codex-responses-FJFDAWHI.js} +17 -17
  51. package/dist/bundle/chunks/openai-completions-IC7WRLTI.js +82 -0
  52. package/dist/bundle/chunks/{openai-decisions-QWEISDVO.js → openai-decisions-HESOHYZB.js} +1 -1
  53. package/dist/bundle/chunks/openai-responses-XXCYDFSM.js +24 -0
  54. package/dist/bundle/chunks/{openrouter-images-BMVMAROU.js → openrouter-images-DT2HMZNO.js} +1 -1
  55. package/dist/bundle/chunks/pdfjs-EK6K7CXX.js +3593 -0
  56. package/dist/bundle/chunks/{pi-messages-XNEG23NU.js → pi-messages-SAOV3JNW.js} +1 -1
  57. package/dist/bundle/chunks/{typesafe-system-one-62YHYXZV.js → typesafe-system-one-HCMGHK6A.js} +1 -1
  58. package/dist/bundle/chunks/{undici-7EW63V4X.js → undici-N4LWJ3S3.js} +1 -1
  59. package/dist/bundle/chunks/virtual-modules-LP2ULVLW.js +5 -0
  60. package/dist/bundle/cli-runtime.js +3 -3
  61. package/dist/bundle/cli.js +2 -2
  62. package/dist/bundle/flow/package.json +6 -5
  63. package/dist/bundle/index.js +8 -8
  64. package/dist/bundle/rpc-entry.js +3 -3
  65. package/dist/cli/credential-print.d.ts.map +1 -1
  66. package/dist/cli/credential-print.js +4 -4
  67. package/dist/cli/credential-print.js.map +1 -1
  68. package/dist/coordination/adapter/index.d.ts.map +1 -1
  69. package/dist/coordination/adapter/index.js +1 -1
  70. package/dist/coordination/adapter/index.js.map +1 -1
  71. package/dist/coordination/adapter/integration-notices.d.ts +1 -1
  72. package/dist/coordination/adapter/integration-notices.d.ts.map +1 -1
  73. package/dist/coordination/adapter/integration-notices.js +5 -2
  74. package/dist/coordination/adapter/integration-notices.js.map +1 -1
  75. package/dist/coordination/broker/extension-state.js +3 -3
  76. package/dist/coordination/broker/extension-state.js.map +1 -1
  77. package/dist/coordination/transport/framing.d.ts.map +1 -1
  78. package/dist/coordination/transport/framing.js +2 -1
  79. package/dist/coordination/transport/framing.js.map +1 -1
  80. package/dist/core/account-reporting.d.ts +3 -1
  81. package/dist/core/account-reporting.d.ts.map +1 -1
  82. package/dist/core/account-reporting.js +12 -2
  83. package/dist/core/account-reporting.js.map +1 -1
  84. package/dist/core/agent-session-services.d.ts.map +1 -1
  85. package/dist/core/agent-session-services.js +39 -36
  86. package/dist/core/agent-session-services.js.map +1 -1
  87. package/dist/core/agent-session.d.ts +4 -2
  88. package/dist/core/agent-session.d.ts.map +1 -1
  89. package/dist/core/agent-session.js +5 -4
  90. package/dist/core/agent-session.js.map +1 -1
  91. package/dist/core/codex-usage.d.ts +11 -2
  92. package/dist/core/codex-usage.d.ts.map +1 -1
  93. package/dist/core/codex-usage.js +74 -2
  94. package/dist/core/codex-usage.js.map +1 -1
  95. package/dist/core/export-html/template.js +21 -16
  96. package/dist/core/model-config.d.ts +33 -8
  97. package/dist/core/model-config.d.ts.map +1 -1
  98. package/dist/core/model-config.js +22 -4
  99. package/dist/core/model-config.js.map +1 -1
  100. package/dist/core/model-resolver.d.ts +56 -43
  101. package/dist/core/model-resolver.d.ts.map +1 -1
  102. package/dist/core/model-resolver.js +256 -361
  103. package/dist/core/model-resolver.js.map +1 -1
  104. package/dist/core/model-runtime.d.ts +6 -3
  105. package/dist/core/model-runtime.d.ts.map +1 -1
  106. package/dist/core/model-runtime.js +19 -5
  107. package/dist/core/model-runtime.js.map +1 -1
  108. package/dist/core/models-store.d.ts.map +1 -1
  109. package/dist/core/models-store.js +7 -2
  110. package/dist/core/models-store.js.map +1 -1
  111. package/dist/core/oauth-account-pool.d.ts +9 -1
  112. package/dist/core/oauth-account-pool.d.ts.map +1 -1
  113. package/dist/core/oauth-account-pool.js +63 -12
  114. package/dist/core/oauth-account-pool.js.map +1 -1
  115. package/dist/core/prompt-templates.d.ts.map +1 -1
  116. package/dist/core/prompt-templates.js +7 -2
  117. package/dist/core/prompt-templates.js.map +1 -1
  118. package/dist/core/settings-defaults.d.ts +2 -0
  119. package/dist/core/settings-defaults.d.ts.map +1 -1
  120. package/dist/core/settings-defaults.js +2 -0
  121. package/dist/core/settings-defaults.js.map +1 -1
  122. package/dist/core/settings-manager.d.ts +4 -2
  123. package/dist/core/settings-manager.d.ts.map +1 -1
  124. package/dist/core/settings-manager.js +11 -0
  125. package/dist/core/settings-manager.js.map +1 -1
  126. package/dist/core/settings-schema.d.ts +4 -0
  127. package/dist/core/settings-schema.d.ts.map +1 -1
  128. package/dist/core/settings-schema.js +8 -0
  129. package/dist/core/settings-schema.js.map +1 -1
  130. package/dist/core/slash-commands.js +1 -1
  131. package/dist/core/slash-commands.js.map +1 -1
  132. package/dist/core/tools/render-utils.d.ts +2 -0
  133. package/dist/core/tools/render-utils.d.ts.map +1 -1
  134. package/dist/core/tools/render-utils.js +21 -0
  135. package/dist/core/tools/render-utils.js.map +1 -1
  136. package/dist/core/tools/renderers/read.d.ts.map +1 -1
  137. package/dist/core/tools/renderers/read.js +7 -10
  138. package/dist/core/tools/renderers/read.js.map +1 -1
  139. package/dist/core/tools/subagent.d.ts.map +1 -1
  140. package/dist/core/tools/subagent.js +4 -7
  141. package/dist/core/tools/subagent.js.map +1 -1
  142. package/dist/core/trace/redaction.d.ts.map +1 -1
  143. package/dist/core/trace/redaction.js +3 -1
  144. package/dist/core/trace/redaction.js.map +1 -1
  145. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  146. package/dist/extensions/codemode/execute.js +12 -0
  147. package/dist/extensions/codemode/execute.js.map +1 -1
  148. package/dist/extensions/codemode/index.d.ts.map +1 -1
  149. package/dist/extensions/codemode/index.js +5 -0
  150. package/dist/extensions/codemode/index.js.map +1 -1
  151. package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +74 -20
  152. package/dist/humain/flow-accounts-host.d.ts.map +1 -1
  153. package/dist/humain/flow-accounts-host.js +3 -0
  154. package/dist/humain/flow-accounts-host.js.map +1 -1
  155. package/dist/humain/node-provider.d.ts.map +1 -1
  156. package/dist/humain/node-provider.js +2 -0
  157. package/dist/humain/node-provider.js.map +1 -1
  158. package/dist/humain/trace-capture/index.js +3 -3
  159. package/dist/humain/trace-capture/index.js.map +1 -1
  160. package/dist/humain/web-access/vendor/credential-source.d.ts +2 -0
  161. package/dist/humain/web-access/vendor/credential-source.d.ts.map +1 -1
  162. package/dist/humain/web-access/vendor/credential-source.js +50 -4
  163. package/dist/humain/web-access/vendor/credential-source.js.map +1 -1
  164. package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
  165. package/dist/humain/web-access/vendor/curator-page.js +3 -1
  166. package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
  167. package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
  168. package/dist/humain/web-access/vendor/curator-server.js +2 -0
  169. package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
  170. package/dist/humain/web-access/vendor/deepseek.d.ts +4 -0
  171. package/dist/humain/web-access/vendor/deepseek.d.ts.map +1 -0
  172. package/dist/humain/web-access/vendor/deepseek.js +201 -0
  173. package/dist/humain/web-access/vendor/deepseek.js.map +1 -0
  174. package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
  175. package/dist/humain/web-access/vendor/extract.js +4 -2
  176. package/dist/humain/web-access/vendor/extract.js.map +1 -1
  177. package/dist/humain/web-access/vendor/gemini-adc.d.ts.map +1 -1
  178. package/dist/humain/web-access/vendor/gemini-adc.js +49 -5
  179. package/dist/humain/web-access/vendor/gemini-adc.js.map +1 -1
  180. package/dist/humain/web-access/vendor/gemini-search.d.ts +3 -3
  181. package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
  182. package/dist/humain/web-access/vendor/gemini-search.js +11 -4
  183. package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
  184. package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
  185. package/dist/humain/web-access/vendor/index.js +16 -1
  186. package/dist/humain/web-access/vendor/index.js.map +1 -1
  187. package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
  188. package/dist/humain/web-access/vendor/page-query.js +12 -6
  189. package/dist/humain/web-access/vendor/page-query.js.map +1 -1
  190. package/dist/humain/web-access/vendor/query-rewrite.d.ts.map +1 -1
  191. package/dist/humain/web-access/vendor/query-rewrite.js +11 -4
  192. package/dist/humain/web-access/vendor/query-rewrite.js.map +1 -1
  193. package/dist/humain/web-access/vendor/searxng.d.ts.map +1 -1
  194. package/dist/humain/web-access/vendor/searxng.js +2 -1
  195. package/dist/humain/web-access/vendor/searxng.js.map +1 -1
  196. package/dist/humain/web-access/vendor/ssrf-protection.d.ts +1 -0
  197. package/dist/humain/web-access/vendor/ssrf-protection.d.ts.map +1 -1
  198. package/dist/humain/web-access/vendor/ssrf-protection.js +10 -0
  199. package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
  200. package/dist/humain/web-access/vendor/summary-review.d.ts.map +1 -1
  201. package/dist/humain/web-access/vendor/summary-review.js +17 -6
  202. package/dist/humain/web-access/vendor/summary-review.js.map +1 -1
  203. package/dist/humain/web-access/vendor/utils.d.ts +2 -0
  204. package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
  205. package/dist/humain/web-access/vendor/utils.js +18 -0
  206. package/dist/humain/web-access/vendor/utils.js.map +1 -1
  207. package/dist/humain/web-access/vendor/web-tool-core.d.ts +2 -0
  208. package/dist/humain/web-access/vendor/web-tool-core.d.ts.map +1 -1
  209. package/dist/humain/web-access/vendor/web-tool-core.js.map +1 -1
  210. package/dist/index.d.ts +1 -0
  211. package/dist/index.d.ts.map +1 -1
  212. package/dist/index.js.map +1 -1
  213. package/dist/main.d.ts.map +1 -1
  214. package/dist/main.js +1 -0
  215. package/dist/main.js.map +1 -1
  216. package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  217. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  218. package/dist/modes/interactive/components/settings-selector.js +10 -0
  219. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  220. package/dist/modes/interactive/components/status-indicator.d.ts +5 -0
  221. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  222. package/dist/modes/interactive/components/status-indicator.js +27 -2
  223. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  224. package/dist/modes/interactive/components/tool-execution.d.ts +2 -1
  225. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  226. package/dist/modes/interactive/components/tool-execution.js +4 -2
  227. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  228. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  229. package/dist/modes/interactive/components/tree-selector.js +2 -9
  230. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  231. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  232. package/dist/modes/interactive/interactive-mode.js +28 -14
  233. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  234. package/dist/modes/interactive/oauth-account-format.d.ts +4 -4
  235. package/dist/modes/interactive/oauth-account-format.d.ts.map +1 -1
  236. package/dist/modes/interactive/oauth-account-format.js +5 -2
  237. package/dist/modes/interactive/oauth-account-format.js.map +1 -1
  238. package/dist/modes/interactive/session-share.d.ts.map +1 -1
  239. package/dist/modes/interactive/session-share.js +9 -2
  240. package/dist/modes/interactive/session-share.js.map +1 -1
  241. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  242. package/dist/modes/rpc/rpc-mode.js +8 -3
  243. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  244. package/dist/utils/tools-manager.d.ts.map +1 -1
  245. package/dist/utils/tools-manager.js +2 -1
  246. package/dist/utils/tools-manager.js.map +1 -1
  247. package/docs/cli.md +3 -3
  248. package/docs/codemode.md +3 -1
  249. package/docs/coordination.md +6 -0
  250. package/docs/docs.json +4 -0
  251. package/docs/environment-variables.md +4 -0
  252. package/docs/flow.md +6 -0
  253. package/docs/humain-code-forge-flow-walkthrough.md +1 -1
  254. package/docs/humain-code.md +2 -4
  255. package/docs/json.md +2 -2
  256. package/docs/llama-cpp.md +1 -1
  257. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  258. package/docs/rpc-commands.md +1 -1
  259. package/docs/rpc.md +9 -1
  260. package/docs/sessions.md +1 -1
  261. package/docs/settings.md +2 -0
  262. package/docs/trace.md +4 -0
  263. package/docs/usage.md +1 -1
  264. package/examples/extensions/custom-provider-anthropic/package-lock.json +16 -6
  265. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  266. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  267. package/examples/extensions/gondolin/package-lock.json +16 -16
  268. package/examples/extensions/gondolin/package.json +1 -1
  269. package/examples/extensions/minimal-mode.ts +4 -4
  270. package/examples/extensions/sandbox/package-lock.json +6 -6
  271. package/examples/extensions/sandbox/package.json +2 -2
  272. package/examples/extensions/with-deps/package-lock.json +2 -2
  273. package/examples/extensions/with-deps/package.json +1 -1
  274. package/examples/plugins/pi-example-plugin/package.json +2 -2
  275. package/examples/rpc-subagent-progress-host.ts +6 -2
  276. package/npm-shrinkwrap.json +129 -171
  277. package/package.json +19 -19
  278. package/schemas/models.schema.json +9 -5
  279. package/schemas/settings.schema.json +32 -0
  280. package/src/coordination/UPSTREAM.md +31 -1
  281. package/src/coordination/upstream.json +3 -3
  282. package/src/humain/adhd/UPSTREAM.md +8 -0
  283. package/src/humain/caveman/UPSTREAM.md +19 -3
  284. package/src/humain/caveman/upstream.json +2 -2
  285. package/src/humain/ponytail/UPSTREAM.md +23 -2
  286. package/src/humain/ponytail/upstream.json +8 -8
  287. package/src/humain/ponytail/vendor/skills/ponytail/SKILL.md +1 -1
  288. package/src/humain/ponytail/vendor/skills/ponytail-debt/SKILL.md +1 -2
  289. package/src/humain/ponytail/vendor/skills/ponytail-gain/SKILL.md +0 -1
  290. package/src/humain/web-access/UPSTREAM.md +45 -1
  291. package/src/humain/web-access/upstream.json +4 -4
  292. package/dist/bundle/chunks/anthropic-messages-YSAHA7QM.js +0 -67
  293. package/dist/bundle/chunks/azure-openai-responses-Z5XYDPHS.js +0 -15
  294. package/dist/bundle/chunks/chunk-2TTB6GIB.js +0 -47
  295. package/dist/bundle/chunks/chunk-5JHUWRJN.js +0 -1790
  296. package/dist/bundle/chunks/chunk-A7QKOI62.js +0 -572
  297. package/dist/bundle/chunks/chunk-FRUFMISJ.js +0 -505
  298. package/dist/bundle/chunks/chunk-MG5PX4KU.js +0 -31
  299. package/dist/bundle/chunks/chunk-OEOXBLWI.js +0 -540
  300. package/dist/bundle/chunks/chunk-RYC5BYVE.js +0 -5
  301. package/dist/bundle/chunks/chunk-YJ3NQWES.js +0 -9
  302. package/dist/bundle/chunks/dist-MNSGVI4C.js +0 -7
  303. package/dist/bundle/chunks/dist-cjs-4BMVQ74V.js +0 -179
  304. package/dist/bundle/chunks/host-2RMBOGA7.js +0 -2
  305. package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +0 -2
  306. package/dist/bundle/chunks/openai-completions-WGBQHTYA.js +0 -79
  307. package/dist/bundle/chunks/openai-responses-OKGCSIEY.js +0 -23
  308. package/dist/bundle/chunks/pdfjs-6UVU6XFX.js +0 -3564
  309. package/dist/bundle/chunks/virtual-modules-7HDINPIK.js +0 -5
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{createRequestObserver,headersToRecord,providerHeadersToRecord}from"./chunk-5CDES42D.js";import{getProviderEnvValue}from"./chunk-FACBDLFU.js";import{parseStreamingJson,parseStreamingJsonWhileStreaming}from"./chunk-MG5PX4KU.js";import{AssistantMessageEventStream}from"./chunk-RYC5BYVE.js";import{appendAssistantMessageDiagnostic,createAssistantMessageDiagnostic}from"./chunk-VEYTRNQC.js";import"./chunk-JXWJOIH4.js";var PiMessagesResponseError=class extends Error{code;diagnosticDetails;constructor(message,code,diagnosticDetails){super(message),this.name="PiMessagesResponseError",this.code=code,this.diagnosticDetails=diagnosticDetails}};function parsePiMessagesErrorBody(body){try{let parsed=JSON.parse(body),error=parsed?.error;return parsed&&typeof error=="object"&&error!==null&&!Array.isArray(error)?parsed:void 0}catch{return}}function truncateDiagnosticString(value){return value.length>8192?`${value.slice(
2
+ import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{createRequestObserver,headersToRecord,providerHeadersToRecord}from"./chunk-5CDES42D.js";import{getProviderEnvValue}from"./chunk-FACBDLFU.js";import{parseStreamingJson,parseStreamingJsonWhileStreaming}from"./chunk-YDBNMIA3.js";import{AssistantMessageEventStream}from"./chunk-IJYVMOB4.js";import{appendAssistantMessageDiagnostic,createAssistantMessageDiagnostic}from"./chunk-VEYTRNQC.js";import"./chunk-JXWJOIH4.js";var PiMessagesResponseError=class extends Error{code;diagnosticDetails;constructor(message,code,diagnosticDetails){super(message),this.name="PiMessagesResponseError",this.code=code,this.diagnosticDetails=diagnosticDetails}};function parsePiMessagesErrorBody(body){try{let parsed=JSON.parse(body),error=parsed?.error;return parsed&&typeof error=="object"&&error!==null&&!Array.isArray(error)?parsed:void 0}catch{return}}function truncateDiagnosticString(value){return value.length>8192?`${value.slice(
3
3
  0,8192)}\u2026`:value}function formatPiMessagesResponseError(response,body,errorBody){let message=typeof errorBody?.error?.message=="string"?errorBody.error.message:void 0,code=typeof errorBody?.error?.code=="string"?errorBody.error.code:void 0,suffix=message??body,codeSuffix=code?` (${code})`:"";return`${response.status} ${response.statusText}: ${suffix}${codeSuffix}`}function createPiMessagesResponseError(model,url,response,body){let errorBody=parsePiMessagesErrorBody(body),code=typeof errorBody?.
4
4
  error?.code=="string"?errorBody.error.code:void 0;return new PiMessagesResponseError(formatPiMessagesResponseError(response,body,errorBody),code,{version:1,provider:model.provider,model:model.id,url:url.toString(),status:response.status,statusText:response.statusText,...errorBody?.error===void 0?{}:{error:errorBody.error},...errorBody?{}:{body:truncateDiagnosticString(body)},timestampMs:Date.now()})}function createEmptyUsage(){return{usageIncomplete:!0,input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,
5
5
  cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}function appendRewriteDiagnostic(message,rewrite){rewrite&&appendAssistantMessageDiagnostic(message,{type:"pi_messages_rewrite",timestamp:Date.now(),details:{...rewrite}})}function createEventConverter(model){let partial={role:"assistant",content:[],api:model.api,provider:model.provider,model:model.id,usage:createEmptyUsage(),stopReason:"pending",timestamp:Date.now()},toolJson=new Map;return event=>{let terminalUsage;switch((event.type===
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{classifySystemOne}from"./chunk-L3J4P5JR.js";import{isRecord}from"./chunk-Y3RFGBG2.js";import"./chunk-Z33NNMNB.js";import"./chunk-MVYV6MJY.js";import"./chunk-5CDES42D.js";import"./chunk-LUL775V7.js";import"./chunk-RYC5BYVE.js";import"./chunk-VEYTRNQC.js";import"./chunk-JXWJOIH4.js";var transport={api:"typesafe-system-one",label:"System One API",url:model=>new URL("systemone",`${model.baseUrl.replace(/\/+$/u,"")}/`),payload:(model,request)=>({model:model.id,...request}),output:body=>{if(!isRecord(body))throw new Error("System One API returned an unexpected response");return body}},classify=(model,context,options)=>classifySystemOne(transport,model,context,options);export{classify};
2
+ import{classifySystemOne}from"./chunk-UGJAAWNC.js";import{isRecord}from"./chunk-X3O5MCKJ.js";import"./chunk-Z33NNMNB.js";import"./chunk-MVYV6MJY.js";import"./chunk-5CDES42D.js";import"./chunk-5K5RFXXO.js";import"./chunk-IJYVMOB4.js";import"./chunk-VEYTRNQC.js";import"./chunk-JXWJOIH4.js";var transport={api:"typesafe-system-one",label:"System One API",url:model=>new URL("systemone",`${model.baseUrl.replace(/\/+$/u,"")}/`),payload:(model,request)=>({model:model.id,...request}),output:body=>{if(!isRecord(body))throw new Error("System One API returned an unexpected response");return body}},classify=(model,context,options)=>classifySystemOne(transport,model,context,options);export{classify};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{require_undici}from"./chunk-MF2NEHP4.js";import"./chunk-JXWJOIH4.js";export default require_undici();
2
+ import{require_undici}from"./chunk-4XU7TDAL.js";import"./chunk-JXWJOIH4.js";export default require_undici();
@@ -0,0 +1,5 @@
1
+ import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
+ import{dist_exports as dist_exports3}from"./chunk-4NFYTS4C.js";import{dist_exports as dist_exports2}from"./chunk-AOL6QG6L.js";import"./chunk-PTP2ZHFQ.js";import"./chunk-QEF72EIZ.js";import"./chunk-FHVNUUBF.js";import"./chunk-TJG52LZB.js";import"./chunk-SCBU5WOP.js";import{all_exports,compat_exports}from"./chunk-65U7MPF4.js";import"./chunk-LG2PJ6JN.js";import{dist_exports}from"./chunk-ZRGFX6T6.js";import"./chunk-XQRYOCHA.js";import"./chunk-DNGJMRJW.js";
3
+ import"./chunk-36Q5UVQL.js";import"./chunk-UGXYG7HN.js";import"./chunk-QYCOHSI7.js";import"./chunk-H2FY3PEV.js";import"./chunk-KQM7ZGL6.js";import"./chunk-CIA6V3BP.js";import"./chunk-XQZG5HPT.js";import"./chunk-FACBDLFU.js";import"./chunk-NCQ6WAQK.js";import"./chunk-YRCLNWFV.js";import"./chunk-4XU7TDAL.js";import"./chunk-Y26OS23T.js";import"./chunk-PY7SOXCA.js";import"./chunk-DBL35X7L.js";import"./chunk-YDBNMIA3.js";
4
+ import"./chunk-5K5RFXXO.js";import"./chunk-IJYVMOB4.js";import"./chunk-VEYTRNQC.js";import{compile_exports,value_exports2 as value_exports}from"./chunk-AWCJWXGD.js";import{build_exports}from"./chunk-OKALNPTJ.js";import"./chunk-JXWJOIH4.js";var oauth_exports={};var VIRTUAL_MODULES={typebox:build_exports,"typebox/compile":compile_exports,"typebox/value":value_exports,"@sinclair/typebox":build_exports,"@sinclair/typebox/compile":compile_exports,"@sinclair/typebox/value":value_exports,"@earendil-works/pi-agent-core":dist_exports2,"@earendil-works/pi-tui":dist_exports,"@earendil-works/pi-ai":compat_exports,"@earendil-works/pi-ai/compat":compat_exports,"@earendil-works/pi-ai/oauth":oauth_exports,"@earendil-works/pi-ai/providers/all":all_exports,"@earendil-w\
5
+ orks/pi-coding-agent":dist_exports3,"@mariozechner/pi-agent-core":dist_exports2,"@mariozechner/pi-tui":dist_exports,"@mariozechner/pi-ai":compat_exports,"@mariozechner/pi-ai/compat":compat_exports,"@mariozechner/pi-ai/oauth":oauth_exports,"@mariozechner/pi-ai/providers/all":all_exports,"@mariozechner/pi-coding-agent":dist_exports3};export{VIRTUAL_MODULES};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
3
- import{configureHttpDispatcher,main,warnIfDeprecatedCommand}from"./chunks/chunk-W5YJZKPF.js";import"./chunks/chunk-OX2IBCCA.js";import"./chunks/chunk-COF5P635.js";import"./chunks/chunk-NNKA2PAP.js";import"./chunks/chunk-TJG52LZB.js";import"./chunks/chunk-BVHXWQLD.js";import"./chunks/chunk-5JHUWRJN.js";import"./chunks/chunk-Z74ZYQPX.js";import"./chunks/chunk-UHLW4KJ7.js";import"./chunks/chunk-XQRYOCHA.js";import"./chunks/chunk-DNGJMRJW.js";import"./chunks/chunk-36Q5UVQL.js";import"./chunks/chunk-UGXYG7HN.js";
4
- import"./chunks/chunk-QYCOHSI7.js";import"./chunks/chunk-H2FY3PEV.js";import"./chunks/chunk-KQM7ZGL6.js";import"./chunks/chunk-CIA6V3BP.js";import"./chunks/chunk-XQZG5HPT.js";import"./chunks/chunk-FACBDLFU.js";import"./chunks/chunk-OEOXBLWI.js";import{APP_COMMAND,ENV_PREFIX}from"./chunks/chunk-YRCLNWFV.js";import"./chunks/chunk-MF2NEHP4.js";import"./chunks/chunk-FRUFMISJ.js";import"./chunks/chunk-YJ3NQWES.js";import"./chunks/chunk-DBL35X7L.js";import"./chunks/chunk-MG5PX4KU.js";import"./chunks/chunk-LUL775V7.js";
5
- import"./chunks/chunk-RYC5BYVE.js";import"./chunks/chunk-VEYTRNQC.js";import"./chunks/chunk-JXWJOIH4.js";function setupCli(){process.title=APP_COMMAND,process.env.PI_CODING_AGENT="true",process.env[`${ENV_PREFIX}_CODING_AGENT`]="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),configureHttpDispatcher()}setupCli();warnIfDeprecatedCommand(process.argv.slice(2));main(process.argv.slice(2));
3
+ import{configureHttpDispatcher,main,warnIfDeprecatedCommand}from"./chunks/chunk-AOL6QG6L.js";import"./chunks/chunk-PTP2ZHFQ.js";import"./chunks/chunk-QEF72EIZ.js";import"./chunks/chunk-FHVNUUBF.js";import"./chunks/chunk-TJG52LZB.js";import"./chunks/chunk-SCBU5WOP.js";import"./chunks/chunk-65U7MPF4.js";import"./chunks/chunk-LG2PJ6JN.js";import"./chunks/chunk-ZRGFX6T6.js";import"./chunks/chunk-XQRYOCHA.js";import"./chunks/chunk-DNGJMRJW.js";import"./chunks/chunk-36Q5UVQL.js";import"./chunks/chunk-UGXYG7HN.js";
4
+ import"./chunks/chunk-QYCOHSI7.js";import"./chunks/chunk-H2FY3PEV.js";import"./chunks/chunk-KQM7ZGL6.js";import"./chunks/chunk-CIA6V3BP.js";import"./chunks/chunk-XQZG5HPT.js";import"./chunks/chunk-FACBDLFU.js";import"./chunks/chunk-NCQ6WAQK.js";import{APP_COMMAND,ENV_PREFIX}from"./chunks/chunk-YRCLNWFV.js";import"./chunks/chunk-4XU7TDAL.js";import"./chunks/chunk-Y26OS23T.js";import"./chunks/chunk-PY7SOXCA.js";import"./chunks/chunk-DBL35X7L.js";import"./chunks/chunk-YDBNMIA3.js";import"./chunks/chunk-5K5RFXXO.js";
5
+ import"./chunks/chunk-IJYVMOB4.js";import"./chunks/chunk-VEYTRNQC.js";import"./chunks/chunk-AWCJWXGD.js";import"./chunks/chunk-OKALNPTJ.js";import"./chunks/chunk-JXWJOIH4.js";function setupCli(){process.title=APP_COMMAND,process.env.PI_CODING_AGENT="true",process.env[`${ENV_PREFIX}_CODING_AGENT`]="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),configureHttpDispatcher()}setupCli();warnIfDeprecatedCommand(process.argv.slice(2));main(process.argv.slice(2));
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire, enableCompileCache } from "node:module";
2
+ import { enableCompileCache } from "node:module";
3
3
 
4
4
  enableCompileCache();
5
- createRequire(import.meta.url)("./cli-runtime.js");
5
+ await import("./cli-runtime.js");
@@ -27,12 +27,13 @@
27
27
  "test": "vitest --run"
28
28
  },
29
29
  "dependencies": {
30
- "@earendil-works/pi-tui": "1.2.0",
31
- "@humain/humain-code-contracts": "0.4.15",
32
- "typebox": "1.3.37"
30
+ "@babel/parser": "8.0.7",
31
+ "@earendil-works/pi-tui": "1.3.0",
32
+ "@humain/humain-code-contracts": "0.4.17",
33
+ "typebox": "1.4.1"
33
34
  },
34
35
  "devDependencies": {
35
- "vitest": "5.0.4"
36
+ "vitest": "5.0.5"
36
37
  },
37
38
  "author": "HUMAIN",
38
39
  "license": "MIT",
@@ -42,6 +43,6 @@
42
43
  "directory": "packages/flow"
43
44
  },
44
45
  "engines": {
45
- "node": ">=22.22.2"
46
+ "node": "^22.22.2 || ^24.15.0 || >=26.0.0"
46
47
  }
47
48
  }
@@ -1,18 +1,18 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{ShowImagesSelectorComponent,ThemeSelectorComponent}from"./chunks/chunk-JRX7GYW3.js";import{ACCOUNT_RETURN_COOLDOWN_MS,ACCOUNT_RETURN_MAX_COOLDOWN_MS,AgentExecInputError,AgentSession,AgentSessionRuntime,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,
2
+ import{ShowImagesSelectorComponent,ThemeSelectorComponent}from"./chunks/chunk-4NFYTS4C.js";import{ACCOUNT_RETURN_COOLDOWN_MS,ACCOUNT_RETURN_MAX_COOLDOWN_MS,AgentExecInputError,AgentSession,AgentSessionRuntime,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,
3
3
  ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FLOW_ACCOUNT_PERSISTENCE_NOTICE,FLOW_SETUP_TERMINAL_ONLY,FLOW_SUBCOMMANDS,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthAccountPool,OAuthSelectorComponent,RpcClient,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,SkillInvocationMessageComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,
4
4
  VIRTUAL_MODEL_STATE_ENTRY,assessNodeFallback,calculateContextTokens,collectEntriesForBranchSummary,compact,completeFlowArguments,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,
5
5
  createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPiAgentExecutionHost,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSubagentTool,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAgents,discoverAndLoadExtensions,estimateTokens,executeHumainAgentRequest,findCutPoint,
6
6
  findTurnStartIndex,flowBuildUnavailable,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getFlowAccountsHost,getFlowChildLaunchHost,getFlowControlHost,getFlowTraceProducer,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,parseArgs,parseFlowCommand,
7
- parseFrontmatter,parseSkillBlock,prepareBranchEntries,prepareChildLaunch,renderDiff,renderFlowHelp,renderTaskWithContext,resolveCliModel,resolveModelScopeWithDiagnostics,runAgentExecMode,runPrintMode,runRpcMode,serializeConversation,shouldCompact,stripFrontmatter,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-W5YJZKPF.js";import"./chunks/chunk-OX2IBCCA.js";import"./chunks/chunk-COF5P635.js";import{ArminComponent}from"./chunks/chunk-NNKA2PAP.js";import{ProjectTrustStore,
8
- hasTrustRequiringProjectResources}from"./chunks/chunk-TJG52LZB.js";import{CURRENT_SESSION_VERSION,SessionManager,buildContextEntries,buildSessionContext,buildSessionProjection,convertToLlm,formatDimensionNote,getLatestCompactionEntry,migrateSessionEntries,parseSessionEntries,resizeImage,sessionEntryToContextMessages}from"./chunks/chunk-BVHXWQLD.js";import"./chunks/chunk-5JHUWRJN.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatSize,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunks/chunk-Z74ZYQPX.js";
9
- import{Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,keyHint,keyText,rawKeyHint}from"./chunks/chunk-UHLW4KJ7.js";import"./chunks/chunk-XQRYOCHA.js";import"./chunks/chunk-DNGJMRJW.js";import{readStoredCredential}from"./chunks/chunk-36Q5UVQL.js";import{getPowerShellConfig,getShellConfig}from"./chunks/chunk-UGXYG7HN.js";import"./chunks/chunk-QYCOHSI7.js";import"./chunks/chunk-H2FY3PEV.js";import"./chunks/chunk-KQM7ZGL6.js";import"./chunks/chunk-CIA6V3BP.js";
10
- import"./chunks/chunk-XQZG5HPT.js";import"./chunks/chunk-FACBDLFU.js";import{HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema,HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema,HumainAgentUsageSchema,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse}from"./chunks/chunk-OEOXBLWI.js";import{
11
- CONFIG_DIR_NAME,UPSTREAM_PI_VERSION,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-YRCLNWFV.js";import"./chunks/chunk-MF2NEHP4.js";import"./chunks/chunk-FRUFMISJ.js";import"./chunks/chunk-YJ3NQWES.js";import"./chunks/chunk-DBL35X7L.js";import"./chunks/chunk-MG5PX4KU.js";import"./chunks/chunk-LUL775V7.js";import"./chunks/chunk-RYC5BYVE.js";import"./chunks/chunk-VEYTRNQC.js";import"./chunks/chunk-JXWJOIH4.js";export{ACCOUNT_RETURN_COOLDOWN_MS,ACCOUNT_RETURN_MAX_COOLDOWN_MS,AgentExecInputError,AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,
7
+ parseFrontmatter,parseSkillBlock,prepareBranchEntries,prepareChildLaunch,renderDiff,renderFlowHelp,renderTaskWithContext,resolveCliModel,resolveModelScopeWithDiagnostics,runAgentExecMode,runPrintMode,runRpcMode,serializeConversation,shouldCompact,stripFrontmatter,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-AOL6QG6L.js";import"./chunks/chunk-PTP2ZHFQ.js";import"./chunks/chunk-QEF72EIZ.js";import{ArminComponent}from"./chunks/chunk-FHVNUUBF.js";import{ProjectTrustStore,
8
+ hasTrustRequiringProjectResources}from"./chunks/chunk-TJG52LZB.js";import{CURRENT_SESSION_VERSION,SessionManager,buildContextEntries,buildSessionContext,buildSessionProjection,convertToLlm,formatDimensionNote,getLatestCompactionEntry,migrateSessionEntries,parseSessionEntries,resizeImage,sessionEntryToContextMessages}from"./chunks/chunk-SCBU5WOP.js";import"./chunks/chunk-65U7MPF4.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatReadLineRange,formatSize,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunks/chunk-LG2PJ6JN.js";
9
+ import{Theme,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,keyHint,keyText,rawKeyHint}from"./chunks/chunk-ZRGFX6T6.js";import"./chunks/chunk-XQRYOCHA.js";import"./chunks/chunk-DNGJMRJW.js";import{readStoredCredential}from"./chunks/chunk-36Q5UVQL.js";import{getPowerShellConfig,getShellConfig}from"./chunks/chunk-UGXYG7HN.js";import"./chunks/chunk-QYCOHSI7.js";import"./chunks/chunk-H2FY3PEV.js";import"./chunks/chunk-KQM7ZGL6.js";import"./chunks/chunk-CIA6V3BP.js";
10
+ import"./chunks/chunk-XQZG5HPT.js";import"./chunks/chunk-FACBDLFU.js";import{HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema,HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema,HumainAgentUsageSchema,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse}from"./chunks/chunk-NCQ6WAQK.js";import{
11
+ CONFIG_DIR_NAME,UPSTREAM_PI_VERSION,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-YRCLNWFV.js";import"./chunks/chunk-4XU7TDAL.js";import"./chunks/chunk-Y26OS23T.js";import"./chunks/chunk-PY7SOXCA.js";import"./chunks/chunk-DBL35X7L.js";import"./chunks/chunk-YDBNMIA3.js";import"./chunks/chunk-5K5RFXXO.js";import"./chunks/chunk-IJYVMOB4.js";import"./chunks/chunk-VEYTRNQC.js";import"./chunks/chunk-AWCJWXGD.js";import"./chunks/chunk-OKALNPTJ.js";import"./chunks/chunk-JXWJOIH4.js";export{ACCOUNT_RETURN_COOLDOWN_MS,ACCOUNT_RETURN_MAX_COOLDOWN_MS,AgentExecInputError,AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,
12
12
  ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FLOW_ACCOUNT_PERSISTENCE_NOTICE,FLOW_SETUP_TERMINAL_ONLY,FLOW_SUBCOMMANDS,FooterComponent,HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema,HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema,HumainAgentUsageSchema,InteractiveMode,LoginDialogComponent,
13
13
  ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthAccountPool,OAuthSelectorComponent,ProjectTrustStore,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UPSTREAM_PI_VERSION,UserMessageComponent,UserMessageSelectorComponent,VERSION,VIRTUAL_MODEL_STATE_ENTRY,assessNodeFallback,buildContextEntries,
14
14
  buildSessionContext,buildSessionProjection,calculateContextTokens,collectEntriesForBranchSummary,compact,completeFlowArguments,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodemodeExtension,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,
15
15
  createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createMcpExtension,createPiAgentExecutionHost,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSubagentTool,createSyntheticSourceInfo,createToolSearchExtension,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAgents,discoverAndLoadExtensions,estimateTokens,executeHumainAgentRequest,findCutPoint,
16
- findTurnStartIndex,flowBuildUnavailable,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getFlowAccountsHost,getFlowChildLaunchHost,getFlowControlHost,getFlowTraceProducer,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,
17
- hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,keyHint,keyText,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFlowCommand,parseFrontmatter,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse,parseSessionEntries,parseSkillBlock,prepareBranchEntries,prepareChildLaunch,
16
+ findTurnStartIndex,flowBuildUnavailable,formatDimensionNote,formatReadLineRange,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getFlowAccountsHost,getFlowChildLaunchHost,getFlowControlHost,getFlowTraceProducer,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,
17
+ getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,keyHint,keyText,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFlowCommand,parseFrontmatter,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse,parseSessionEntries,parseSkillBlock,prepareBranchEntries,prepareChildLaunch,
18
18
  rawKeyHint,readStoredCredential,renderDiff,renderFlowHelp,renderTaskWithContext,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runAgentExecMode,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
3
- import{configureHttpDispatcher,main}from"./chunks/chunk-W5YJZKPF.js";import"./chunks/chunk-OX2IBCCA.js";import"./chunks/chunk-COF5P635.js";import"./chunks/chunk-NNKA2PAP.js";import"./chunks/chunk-TJG52LZB.js";import"./chunks/chunk-BVHXWQLD.js";import"./chunks/chunk-5JHUWRJN.js";import"./chunks/chunk-Z74ZYQPX.js";import"./chunks/chunk-UHLW4KJ7.js";import"./chunks/chunk-XQRYOCHA.js";import"./chunks/chunk-DNGJMRJW.js";import"./chunks/chunk-36Q5UVQL.js";import"./chunks/chunk-UGXYG7HN.js";import"./chunks/chunk-QYCOHSI7.js";
4
- import"./chunks/chunk-H2FY3PEV.js";import"./chunks/chunk-KQM7ZGL6.js";import"./chunks/chunk-CIA6V3BP.js";import"./chunks/chunk-XQZG5HPT.js";import"./chunks/chunk-FACBDLFU.js";import"./chunks/chunk-OEOXBLWI.js";import{APP_COMMAND}from"./chunks/chunk-YRCLNWFV.js";import"./chunks/chunk-MF2NEHP4.js";import"./chunks/chunk-FRUFMISJ.js";import"./chunks/chunk-YJ3NQWES.js";import"./chunks/chunk-DBL35X7L.js";import"./chunks/chunk-MG5PX4KU.js";import"./chunks/chunk-LUL775V7.js";import"./chunks/chunk-RYC5BYVE.js";import"./chunks/chunk-VEYTRNQC.js";
5
- import"./chunks/chunk-JXWJOIH4.js";process.title=`${APP_COMMAND}-rpc`;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT="pi";process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
3
+ import{configureHttpDispatcher,main}from"./chunks/chunk-AOL6QG6L.js";import"./chunks/chunk-PTP2ZHFQ.js";import"./chunks/chunk-QEF72EIZ.js";import"./chunks/chunk-FHVNUUBF.js";import"./chunks/chunk-TJG52LZB.js";import"./chunks/chunk-SCBU5WOP.js";import"./chunks/chunk-65U7MPF4.js";import"./chunks/chunk-LG2PJ6JN.js";import"./chunks/chunk-ZRGFX6T6.js";import"./chunks/chunk-XQRYOCHA.js";import"./chunks/chunk-DNGJMRJW.js";import"./chunks/chunk-36Q5UVQL.js";import"./chunks/chunk-UGXYG7HN.js";import"./chunks/chunk-QYCOHSI7.js";
4
+ import"./chunks/chunk-H2FY3PEV.js";import"./chunks/chunk-KQM7ZGL6.js";import"./chunks/chunk-CIA6V3BP.js";import"./chunks/chunk-XQZG5HPT.js";import"./chunks/chunk-FACBDLFU.js";import"./chunks/chunk-NCQ6WAQK.js";import{APP_COMMAND}from"./chunks/chunk-YRCLNWFV.js";import"./chunks/chunk-4XU7TDAL.js";import"./chunks/chunk-Y26OS23T.js";import"./chunks/chunk-PY7SOXCA.js";import"./chunks/chunk-DBL35X7L.js";import"./chunks/chunk-YDBNMIA3.js";import"./chunks/chunk-5K5RFXXO.js";import"./chunks/chunk-IJYVMOB4.js";import"./chunks/chunk-VEYTRNQC.js";
5
+ import"./chunks/chunk-AWCJWXGD.js";import"./chunks/chunk-OKALNPTJ.js";import"./chunks/chunk-JXWJOIH4.js";process.title=`${APP_COMMAND}-rpc`;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT="pi";process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
@@ -1 +1 @@
1
- {"version":3,"file":"credential-print.d.ts","sourceRoot":"","sources":["../../src/cli/credential-print.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAoB,KAAK,eAAe,EAA8C,MAAM,mBAAmB,CAAC;AAIvH,KAAK,mBAAmB,GAAG,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC9C,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,mBAAmB,EACzB,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,CAgEjB"}
1
+ {"version":3,"file":"credential-print.d.ts","sourceRoot":"","sources":["../../src/cli/credential-print.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAoB,KAAK,eAAe,EAA8C,MAAM,mBAAmB,CAAC;AAIvH,KAAK,mBAAmB,GAAG,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC9C,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,mBAAmB,EACzB,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,CAmEjB"}
@@ -1,4 +1,4 @@
1
- import { resolveCliModel } from "../core/model-resolver.js";
1
+ import { resolveCliModel, resolveModelReference } from "../core/model-resolver.js";
2
2
  import { AuthCommandError, getAuthCredential, validateAuthCommandArgs } from "./auth-command.js";
3
3
  const DEFAULT_BEARER_TOKEN_MIN_EXPIRY_MS = 30 * 60_000;
4
4
  /**
@@ -28,13 +28,13 @@ export async function resolveCredentialForPrint(args, modelRuntime, kind, minExp
28
28
  }
29
29
  }
30
30
  else {
31
+ const models = modelRuntime.getModels();
31
32
  for (const provider of modelRuntime.getProviders()) {
32
33
  if (!credentialTypes.has(provider.id))
33
34
  continue;
34
- const resolved = resolveCliModel({ cliProvider: provider.id, cliModel: cliModel, modelRuntime });
35
- if (resolved.model && !resolved.error && !resolved.warning?.includes("Using custom model id")) {
35
+ const resolved = resolveModelReference({ text: cliModel, provider: provider.id, thinkingSuffix: "strict", fuzzy: true }, models, () => true);
36
+ if (resolved.status === "resolved")
36
37
  providers.push({ id: provider.id, model: resolved.model });
37
- }
38
38
  }
39
39
  if (providers.length === 0) {
40
40
  throw new AuthCommandError(`Model "${cliModel}" not found. Use --list-models to see available models.`);
@@ -1 +1 @@
1
- {"version":3,"file":"credential-print.js","sourceRoot":"","sources":["../../src/cli/credential-print.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAwB,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEvH,MAAM,kCAAkC,GAAG,EAAE,GAAG,MAAM,CAAC;AAIvD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC9C,IAAU,EACV,YAA0B,EAC1B,IAAyB,EACzB,WAAoB,EACpB,MAAoB;IAEpB,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,uBAAuB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvF,MAAM,eAAe,GAAG,IAAI,GAAG,CAC9B,CAAC,MAAM,YAAY,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAC9G,CAAC;IACF,MAAM,SAAS,GAA8C,EAAE,CAAC;IAChE,IAAI,WAAW,EAAE,CAAC;QACjB,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AC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtE,IAAI,WAAW,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YAC3D,MAAM,IAAI,gBAAgB,CAAC,aAAa,UAAU,4CAA4C,CAAC,CAAC;QACjG,CAAC;QACD,IAAI,WAAW,IAAI,IAAI,KAAK,cAAc,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YAChE,MAAM,IAAI,gBAAgB,CAAC,aAAa,UAAU,gDAAgD,CAAC,CAAC;QACrG,CAAC;QACD,MAAM,IAAI,gBAAgB,CAAC,aAAa,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,gBAAgB,CAAC,CAAC;IAChH,CAAC;IACD,MAAM,IAAI,gBAAgB,CACzB,0CAA0C,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAC5H,CAAC;AACH,CAAC","sourcesContent":["import type { Api, CredentialInfo, Model } from \"@earendil-works/pi-ai\";\nimport { resolveCliModel } from \"../core/model-resolver.ts\";\nimport type { ModelRuntime } from \"../core/model-runtime.ts\";\nimport type { Args } from \"./args.ts\";\nimport { AuthCommandError, type AuthCommandKind, getAuthCredential, validateAuthCommandArgs } from \"./auth-command.ts\";\n\nconst DEFAULT_BEARER_TOKEN_MIN_EXPIRY_MS = 30 * 60_000;\n\ntype CredentialPrintKind = Exclude<AuthCommandKind, \"check\">;\n\n/**\n * Resolve one configured provider credential.\n *\n * This intentionally calls ModelRuntime.getAuth(), which refreshes and persists\n * OAuth credentials with less than five minutes remaining through the normal request-auth path.\n */\nexport async function resolveCredentialForPrint(\n\targs: Args,\n\tmodelRuntime: ModelRuntime,\n\tkind: CredentialPrintKind,\n\tminExpiryMs?: number,\n\tsignal?: AbortSignal,\n): Promise<string> {\n\tconst { provider: cliProvider, model: cliModel } = validateAuthCommandArgs(args, kind);\n\tconst credentialTypes = new Map<string, CredentialInfo[\"type\"]>(\n\t\t(await modelRuntime.listCredentials({ signal })).map((credential) => [credential.providerId, credential.type]),\n\t);\n\tconst providers: Array<{ id: string; model?: Model<Api> }> = [];\n\tif (cliProvider) {\n\t\tconst provider = modelRuntime.getProvider(cliProvider);\n\t\tif (!provider) {\n\t\t\tthrow new AuthCommandError(`Unknown provider \"${cliProvider}\". Use --list-models to see available providers.`);\n\t\t}\n\t\tif (cliModel) {\n\t\t\tconst resolved = resolveCliModel({ cliProvider: provider.id, cliModel, modelRuntime });\n\t\t\tif (resolved.error || !resolved.model) {\n\t\t\t\tthrow new AuthCommandError(resolved.error ?? \"Unable to resolve the requested provider/model\");\n\t\t\t}\n\t\t\tproviders.push({ id: provider.id, model: resolved.model });\n\t\t} else {\n\t\t\tproviders.push({ id: provider.id });\n\t\t}\n\t} else {\n\t\tfor (const provider of modelRuntime.getProviders()) {\n\t\t\tif (!credentialTypes.has(provider.id)) continue;\n\t\t\tconst resolved = resolveCliModel({ cliProvider: provider.id, cliModel: cliModel!, modelRuntime });\n\t\t\tif (resolved.model && !resolved.error && !resolved.warning?.includes(\"Using custom model id\")) {\n\t\t\t\tproviders.push({ id: provider.id, model: resolved.model });\n\t\t\t}\n\t\t}\n\t\tif (providers.length === 0) {\n\t\t\tthrow new AuthCommandError(`Model \"${cliModel}\" not found. Use --list-models to see available models.`);\n\t\t}\n\t}\n\n\tconst credentials: Array<{ providerId: string; value: string }> = [];\n\tfor (const provider of providers) {\n\t\tconst type = credentialTypes.get(provider.id);\n\t\tif (kind === \"api_key\" && type === \"oauth\") continue;\n\t\tif (kind === \"bearer_token\" && type !== \"oauth\") continue;\n\t\tconst authOptions = {\n\t\t\t...(kind === \"bearer_token\" ? { minOAuthValidityMs: minExpiryMs ?? DEFAULT_BEARER_TOKEN_MIN_EXPIRY_MS } : {}),\n\t\t\tsignal,\n\t\t};\n\t\tconst auth = provider.model\n\t\t\t? await modelRuntime.getAuth(provider.model, authOptions)\n\t\t\t: await modelRuntime.getAuth(provider.id, authOptions);\n\t\tconst value = getAuthCredential(auth);\n\t\tif (value) credentials.push({ providerId: provider.id, value });\n\t}\n\n\tif (credentials.length === 1) return credentials[0].value;\n\tif (credentials.length === 0) {\n\t\tconst providerId = providers[0]?.id;\n\t\tconst type = providerId ? credentialTypes.get(providerId) : undefined;\n\t\tif (cliProvider && kind === \"api_key\" && type === \"oauth\") {\n\t\t\tthrow new AuthCommandError(`Provider \"${providerId}\" is configured with OAuth, not an API key`);\n\t\t}\n\t\tif (cliProvider && kind === \"bearer_token\" && type !== \"oauth\") {\n\t\t\tthrow new AuthCommandError(`Provider \"${providerId}\" is not configured with an OAuth bearer token`);\n\t\t}\n\t\tthrow new AuthCommandError(`No usable ${kind === \"api_key\" ? \"API key\" : \"OAuth bearer token\"} is configured`);\n\t}\n\tthrow new AuthCommandError(\n\t\t`Multiple configured providers matched (${credentials.map(({ providerId }) => providerId).join(\", \")}). Specify --provider.`,\n\t);\n}\n"]}
1
+ {"version":3,"file":"credential-print.js","sourceRoot":"","sources":["../../src/cli/credential-print.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGnF,OAAO,EAAE,gBAAgB,EAAwB,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEvH,MAAM,kCAAkC,GAAG,EAAE,GAAG,MAAM,CAAC;AAIvD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC9C,IAAU,EACV,YAA0B,EAC1B,IAAyB,EACzB,WAAoB,EACpB,MAAoB;IAEpB,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,CAAC,IAAI,CAAC,wBAAwB,CAC5H,CAAC;AACH,CAAC","sourcesContent":["import type { Api, CredentialInfo, Model } from \"@earendil-works/pi-ai\";\nimport { resolveCliModel, resolveModelReference } from \"../core/model-resolver.ts\";\nimport type { ModelRuntime } from \"../core/model-runtime.ts\";\nimport type { Args } from \"./args.ts\";\nimport { AuthCommandError, type AuthCommandKind, getAuthCredential, validateAuthCommandArgs } from \"./auth-command.ts\";\n\nconst DEFAULT_BEARER_TOKEN_MIN_EXPIRY_MS = 30 * 60_000;\n\ntype CredentialPrintKind = Exclude<AuthCommandKind, \"check\">;\n\n/**\n * Resolve one configured provider credential.\n *\n * This intentionally calls ModelRuntime.getAuth(), which refreshes and persists\n * OAuth credentials with less than five minutes remaining through the normal request-auth path.\n */\nexport async function resolveCredentialForPrint(\n\targs: Args,\n\tmodelRuntime: ModelRuntime,\n\tkind: CredentialPrintKind,\n\tminExpiryMs?: number,\n\tsignal?: AbortSignal,\n): Promise<string> {\n\tconst { provider: cliProvider, model: cliModel } = validateAuthCommandArgs(args, kind);\n\tconst credentialTypes = new Map<string, CredentialInfo[\"type\"]>(\n\t\t(await modelRuntime.listCredentials({ signal })).map((credential) => [credential.providerId, credential.type]),\n\t);\n\tconst providers: Array<{ id: string; model?: Model<Api> }> = [];\n\tif (cliProvider) {\n\t\tconst provider = modelRuntime.getProvider(cliProvider);\n\t\tif (!provider) {\n\t\t\tthrow new AuthCommandError(`Unknown provider \"${cliProvider}\". Use --list-models to see available providers.`);\n\t\t}\n\t\tif (cliModel) {\n\t\t\tconst resolved = resolveCliModel({ cliProvider: provider.id, cliModel, modelRuntime });\n\t\t\tif (resolved.error || !resolved.model) {\n\t\t\t\tthrow new AuthCommandError(resolved.error ?? \"Unable to resolve the requested provider/model\");\n\t\t\t}\n\t\t\tproviders.push({ id: provider.id, model: resolved.model });\n\t\t} else {\n\t\t\tproviders.push({ id: provider.id });\n\t\t}\n\t} else {\n\t\tconst models = modelRuntime.getModels();\n\t\tfor (const provider of modelRuntime.getProviders()) {\n\t\t\tif (!credentialTypes.has(provider.id)) continue;\n\t\t\tconst resolved = resolveModelReference(\n\t\t\t\t{ text: cliModel!, provider: provider.id, thinkingSuffix: \"strict\", fuzzy: true },\n\t\t\t\tmodels,\n\t\t\t\t() => true,\n\t\t\t);\n\t\t\tif (resolved.status === \"resolved\") providers.push({ id: provider.id, model: resolved.model });\n\t\t}\n\t\tif (providers.length === 0) {\n\t\t\tthrow new AuthCommandError(`Model \"${cliModel}\" not found. Use --list-models to see available models.`);\n\t\t}\n\t}\n\n\tconst credentials: Array<{ providerId: string; value: string }> = [];\n\tfor (const provider of providers) {\n\t\tconst type = credentialTypes.get(provider.id);\n\t\tif (kind === \"api_key\" && type === \"oauth\") continue;\n\t\tif (kind === \"bearer_token\" && type !== \"oauth\") continue;\n\t\tconst authOptions = {\n\t\t\t...(kind === \"bearer_token\" ? { minOAuthValidityMs: minExpiryMs ?? DEFAULT_BEARER_TOKEN_MIN_EXPIRY_MS } : {}),\n\t\t\tsignal,\n\t\t};\n\t\tconst auth = provider.model\n\t\t\t? await modelRuntime.getAuth(provider.model, authOptions)\n\t\t\t: await modelRuntime.getAuth(provider.id, authOptions);\n\t\tconst value = getAuthCredential(auth);\n\t\tif (value) credentials.push({ providerId: provider.id, value });\n\t}\n\n\tif (credentials.length === 1) return credentials[0].value;\n\tif (credentials.length === 0) {\n\t\tconst providerId = providers[0]?.id;\n\t\tconst type = providerId ? credentialTypes.get(providerId) : undefined;\n\t\tif (cliProvider && kind === \"api_key\" && type === \"oauth\") {\n\t\t\tthrow new AuthCommandError(`Provider \"${providerId}\" is configured with OAuth, not an API key`);\n\t\t}\n\t\tif (cliProvider && kind === \"bearer_token\" && type !== \"oauth\") {\n\t\t\tthrow new AuthCommandError(`Provider \"${providerId}\" is not configured with an OAuth bearer token`);\n\t\t}\n\t\tthrow new AuthCommandError(`No usable ${kind === \"api_key\" ? \"API key\" : \"OAuth bearer token\"} is configured`);\n\t}\n\tthrow new AuthCommandError(\n\t\t`Multiple configured providers matched (${credentials.map(({ providerId }) => providerId).join(\", \")}). Specify --provider.`,\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/coordination/adapter/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoB,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,KAAK,qBAAqB,EAA+C,MAAM,+BAA+B,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,KAAK,wBAAwB,EAAmC,MAAM,uBAAuB,CAAC;AACvG,OAAO,KAAK,EAGX,aAAa,EAIb,MAAM,uBAAuB,CAAC;AAa/B,MAAM,WAAW,4BAA4B;IAC5C,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,4GAA4G;IAC5G,MAAM,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,yEAAyE;IACzE,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC;IAC9E,8GAA8G;IAC9G,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK;QACjD,KAAK,EAAE,wBAAwB,CAAC;QAChC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,YAAY,EAAE,MAAM,kBAAkB,CAAC;KACvC,CAAC;CACF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE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,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,YAAY,EAAE,MAAM,kBAAkB,CAAC;KACvC,CAAC;CACF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,qBAAqB,EAC/B,QAAQ,GAAE,MAAsB,GAC9B;IACF,KAAK,EAAE,wBAAwB,CAAC;IAChC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,YAAY,EAAE,MAAM,kBAAkB,CAAC;CACvC,CAeA;AAYD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,4BAA4B,GAAG,gBAAgB,CAmYnG"}
@@ -246,7 +246,7 @@ export function createCoordinationExtension(options) {
246
246
  // Shared worktree, ownership and lease changes the broker pushes; each is announced once per change.
247
247
  let integrationNoticeState = INITIAL_INTEGRATION_NOTICES;
248
248
  const notifyIntegration = (status, sessionId) => {
249
- const { notices, next } = integrationNotices(integrationNoticeState, status, sessionId);
249
+ const { notices, next } = integrationNotices(integrationNoticeState, status, sessionId, env.HUMAIN_TERMINAL_COORDINATION_WORKTREE_HINT === "1");
250
250
  integrationNoticeState = next;
251
251
  try {
252
252
  if (!liveCtx?.hasUI)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/coordination/adapter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAA8B,aAAa,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAiC,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AASvG,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,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AE;wBAC7D,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;oBAC7C,CAAC,CAAC,CAAC;oBACH,YAAY,GAAG,MAAM,CAAC;oBACtB,OAAO,MAAM,CAAC;gBACf,CAAC;gBACD,YAAY;gBACZ,SAAS,EAAE,GAAG,CAAC,cAAc,CAAC,YAAY,EAAE;gBAC5C,aAAa,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE;oBACtC,KAAK,GAAG,IAAI,CAAC;oBACb,MAAM,GAAG,aAAa,CAAC;gBACxB,CAAC;gBACD,WAAW,EAAE,GAAG,EAAE;oBACjB,OAAO,CAAC,KAAK,EAAE,CAAC;oBAChB,cAAc,CAAC,SAAS,EAAE,CAAC;gBAC5B,CAAC;aACD,CAAC,CAAC;YACH,UAAU,GAAG,gBAAgB,CAAC;YAC9B,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,EAAE,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;YACpC,MAAM,QAAQ,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { dirname } from \"node:path\";\nimport { getAgentDir } from \"../../config.ts\";\nimport type { ExtensionContext, ExtensionFactory } from \"../../core/extensions/types.ts\";\nimport type { SettingsManager } from \"../../core/settings-manager.ts\";\nimport { type GitRepositoryIdentity, readGitBranch, resolveGitRepositoryIdentity } from \"../../utils/git-repository.ts\";\nimport { CoordinationClient } from \"../client/client.ts\";\nimport { ensureBroker } from \"../client/spawn.ts\";\nimport { type CoordinationRuntimePaths, resolveCoordinationRuntimePaths } from \"../transport/paths.ts\";\nimport type {\n\tIntegrationStatus,\n\tMessage,\n\tOwnershipMode,\n\tPolicyStatus,\n\tSessionInfo,\n\tSessionRegistration,\n} from \"../transport/types.ts\";\nimport { createArtifactBackend } from \"./artifact-files.ts\";\nimport { createCoordinateCommand, formatPolicyNotice } from \"./commands.ts\";\nimport { COORDINATION_MESSAGE_TYPE, InboundDelivery, type PeerMessageDetails, WakeBudget } from \"./delivery.ts\";\nimport { inspectAttempt as inspectAttemptCheckout } from \"./git-inspect.ts\";\nimport { createIntegrationBackend } from \"./integration.ts\";\nimport { INITIAL_INTEGRATION_NOTICES, type IntegrationNoticeState, integrationNotices } from \"./integration-notices.ts\";\nimport { decideParticipation } from \"./participation.ts\";\nimport { readRepositoryLabel, SessionPresence, worktreeRelativePath } from \"./presence.ts\";\nimport { ID_IN_USE_DETAIL, ReceiptTracker } from \"./receipts.ts\";\nimport { ConnectionSupervisor } from \"./supervisor.ts\";\nimport { createClientBackend, createCoordinationToolDefinition } from \"./tool.ts\";\n\nexport interface CoordinationExtensionOptions {\n\tnoCoordinate: boolean;\n\tagentExec: boolean;\n\tsettingsManager: SettingsManager;\n\tenv?: NodeJS.ProcessEnv;\n\t/** The environment the integration Git commands are derived from (sanitized first). Default process.env. */\n\tgitEnv?: NodeJS.ProcessEnv;\n\tplatform?: NodeJS.Platform;\n\t/** The --coordinate-ownership flag. Unset accepts the current policy. */\n\townership?: OwnershipMode;\n\tresolveIdentity?: (cwd: string) => Promise<GitRepositoryIdentity | undefined>;\n\t/** May throw (for example when the runtime directory is unsafe); the extension then reports `unavailable`. */\n\tconnection?: (identity: GitRepositoryIdentity) => {\n\t\tpaths: CoordinationRuntimePaths;\n\t\tensureBroker: () => Promise<void>;\n\t\tcreateClient: () => CoordinationClient;\n\t};\n}\n\n/**\n * Resolves the runtime paths once with resolveCoordinationRuntimePaths (the same derivation the broker entry\n * uses) and shares them between ensureBroker and the client, so both act on the canonical path that\n * ensureBroker requires. Throws when the agent directory cannot be made safe to use.\n */\nexport function defaultConnection(\n\tidentity: GitRepositoryIdentity,\n\tagentDir: string = getAgentDir(),\n): {\n\tpaths: CoordinationRuntimePaths;\n\tensureBroker: () => Promise<void>;\n\tcreateClient: () => CoordinationClient;\n} {\n\tconst repositoryPaths = resolveCoordinationRuntimePaths(agentDir, identity.repositoryKey);\n\tconst devicePaths = resolveCoordinationRuntimePaths(agentDir, \"device\");\n\tconst paths = {\n\t\t...devicePaths,\n\t\tartifactsDir: repositoryPaths.artifactsDir,\n\t\tpendingAsksDir: repositoryPaths.pendingAsksDir,\n\t};\n\treturn {\n\t\tpaths,\n\t\tensureBroker: () =>\n\t\t\t// The broker is told the canonical agent directory, so it cannot resolve a different one than the paths used here.\n\t\t\tensureBroker({ paths, repositoryKey: identity.repositoryKey, agentDir: dirname(dirname(paths.runtimeDir)) }),\n\t\tcreateClient: () => new CoordinationClient({ socketPath: paths.socketPath, scopeId: identity.repositoryKey }),\n\t};\n}\n\nfunction isPeerDetails(value: unknown): value is PeerMessageDetails {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"messageId\" in value &&\n\t\ttypeof value.messageId === \"string\" &&\n\t\tvalue.messageId.length > 0\n\t);\n}\n\nexport function createCoordinationExtension(options: CoordinationExtensionOptions): ExtensionFactory {\n\treturn (pi) => {\n\t\tconst env = options.env ?? process.env;\n\t\tconst decision = decideParticipation({\n\t\t\tenv,\n\t\t\tplatform: options.platform ?? process.platform,\n\t\t\tnoCoordinate: options.noCoordinate,\n\t\t\tagentExec: options.agentExec,\n\t\t\tsettingEnabled: options.settingsManager.getCoordinationEnabled(),\n\t\t});\n\t\tif (!decision.participate) {\n\t\t\tif (decision.notify) {\n\t\t\t\tpi.on(\"session_start\", (_event, ctx) => {\n\t\t\t\t\tif (ctx.hasUI) ctx.ui.notify(decision.reason, \"info\");\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tlet state: \"connecting\" | \"connected\" | \"degraded\" | \"unavailable\" = \"connecting\";\n\t\tlet reason: string | undefined;\n\t\tlet supervisor: ConnectionSupervisor | undefined;\n\t\tlet delivery: InboundDelivery | undefined;\n\t\tlet identity: GitRepositoryIdentity | undefined;\n\t\t// The runtime paths of the current connection; artifacts are staged under paths.artifactsDir.\n\t\tlet runtimePaths: CoordinationRuntimePaths | undefined;\n\t\t// The most recently created client. The supervisor runs one attempt at a time, so this is the live\n\t\t// client once connected. Message listeners attach at creation so mail delivered in the same frame\n\t\t// batch as the registration is never missed.\n\t\tlet latestClient: CoordinationClient | undefined;\n\t\tlet branch = \"HEAD\";\n\t\tlet repo = \"\";\n\t\tlet presence = new SessionPresence();\n\t\t// The --coordinate-ownership flag. Cleared by /coordinate policy accept so reconnects stop requesting it.\n\t\tlet requestedOwnership: OwnershipMode | undefined = options.ownership;\n\t\tlet streaming = false;\n\t\tlet generation = 0;\n\t\tlet liveCtx: ExtensionContext | undefined;\n\t\tconst startedAt = Date.now();\n\t\t// Agent runs started so far. A message handed to the host during run N can only be judged lost once a run\n\t\t// after N has settled.\n\t\tlet runSeq = 0;\n\n\t\tconst connectedClient = (): CoordinationClient | undefined =>\n\t\t\tlatestClient?.isConnected() ? latestClient : undefined;\n\n\t\tconst registration = (): SessionRegistration => ({\n\t\t\tcwd: liveCtx?.cwd ?? process.cwd(),\n\t\t\tmodel: liveCtx?.model?.id ?? \"unknown\",\n\t\t\tpid: process.pid,\n\t\t\tstartedAt,\n\t\t\tlastActivity: Date.now(),\n\t\t\tname: liveCtx?.sessionManager.getSessionName(),\n\t\t\tworktreeRoot: identity?.worktreeRoot,\n\t\t\tbranch,\n\t\t\tstatus: streaming ? \"working\" : \"idle\",\n\t\t\tacknowledgesReceipts: true,\n\t\t\townership: requestedOwnership,\n\t\t\trepo,\n\t\t\tfocus: presence.focus(liveCtx?.sessionManager.getSessionName()),\n\t\t\tsubpath: identity\n\t\t\t\t? (worktreeRelativePath(liveCtx?.cwd ?? identity.worktreeRoot, identity.worktreeRoot) ?? \"\")\n\t\t\t\t: \"\",\n\t\t\ttouchedPaths: presence.touchedPaths,\n\t\t});\n\n\t\t// Every message handed to the host is tracked until its injection is observed (message_end or a session\n\t\t// branch scan), so each received id ends in exactly one terminal receipt. Receipts written while the\n\t\t// connection is down are queued and flushed on reconnect.\n\t\tconst tracker = new ReceiptTracker({\n\t\t\tsend: (receipt) => {\n\t\t\t\tconst client = connectedClient();\n\t\t\t\tif (!client) return false;\n\t\t\t\tclient.sendMessageReceipt(receipt);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\n\t\t// One pass over the branch yields every coordination message in the session, keyed by sender and id.\n\t\tconst peerKey = (fromId: string | undefined, messageId: string): string => `${fromId}\\u0000${messageId}`;\n\t\tconst branchMessageKeys = (): Set<string> => {\n\t\t\tconst ids = new Set<string>();\n\t\t\tfor (const entry of liveCtx?.sessionManager.getBranch() ?? []) {\n\t\t\t\tif (\n\t\t\t\t\tentry.type === \"custom_message\" &&\n\t\t\t\t\tentry.customType === COORDINATION_MESSAGE_TYPE &&\n\t\t\t\t\tisPeerDetails(entry.details)\n\t\t\t\t) {\n\t\t\t\t\tids.add(peerKey(entry.details.fromId, entry.details.messageId));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ids;\n\t\t};\n\n\t\t// The host emits message_end for messages it appends outside a run (and for deferred ones) only to its own\n\t\t// subscribers, so injection is also confirmed by scanning the session. `settled` additionally resolves\n\t\t// messages handed over before the run that just settled and still absent from the session as not_injected.\n\t\tconst reconcile = (settled: boolean): void => {\n\t\t\tif (tracker.outstandingCount === 0) return;\n\t\t\tconst present = branchMessageKeys();\n\t\t\tfor (const messageId of tracker.outstandingIds()) {\n\t\t\t\tif (present.has(peerKey(tracker.outstandingFrom(messageId), messageId)))\n\t\t\t\t\ttracker.resolve(messageId, \"injected\");\n\t\t\t}\n\t\t\tif (!settled) return;\n\t\t\tfor (const messageId of tracker.outstandingBefore(runSeq)) {\n\t\t\t\ttracker.resolve(messageId, \"not_injected\", \"message was not added to the session\");\n\t\t\t}\n\t\t};\n\n\t\tconst shutdown = async (): Promise<void> => {\n\t\t\tgeneration++;\n\t\t\tconst activeDelivery = delivery;\n\t\t\tconst activeSupervisor = supervisor;\n\t\t\tdelivery = undefined;\n\t\t\tsupervisor = undefined;\n\t\t\t// Held messages are deferred first, then everything handed to the host but never observed. The broker keeps\n\t\t\t// deferred mail for this session's next start. Send what the live connection still accepts; whatever cannot\n\t\t\t// be written is dropped with the tracker, and the broker redelivers those messages anyway.\n\t\t\tactiveDelivery?.shutdown();\n\t\t\ttracker.close(\"session ended before delivery\");\n\t\t\tawait activeSupervisor?.stop();\n\t\t\tlatestClient = undefined;\n\t\t\ttracker.clear();\n\t\t};\n\n\t\tconst artifactsBackend = createArtifactBackend({\n\t\t\tclient: connectedClient,\n\t\t\tlocation: () =>\n\t\t\t\tidentity && runtimePaths\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcwd: liveCtx?.cwd ?? process.cwd(),\n\t\t\t\t\t\t\tworktreeRoot: identity.worktreeRoot,\n\t\t\t\t\t\t\tartifactsDir: runtimePaths.artifactsDir,\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\tagentDir: getAgentDir,\n\t\t\t// An in-memory session reports \"\", which means no directory. A throwing stale ctx fails the tool call closed.\n\t\t\tsessionDir: () => liveCtx?.sessionManager.getSessionDir() || undefined,\n\t\t});\n\n\t\t// The pre-integration HEADs this session's own preflights read from Git (D8); the reconcile inspector shares them.\n\t\tconst preflightHeads = new Map<string, string>();\n\t\tconst integrationBackend = createIntegrationBackend({\n\t\t\tclient: connectedClient,\n\t\t\tlocation: () =>\n\t\t\t\tidentity\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcwd: liveCtx?.cwd ?? process.cwd(),\n\t\t\t\t\t\t\tworktreeRoot: identity.worktreeRoot,\n\t\t\t\t\t\t\tcommonDir: identity.commonDir,\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\tenv: () => options.gitEnv ?? process.env,\n\t\t\tpreflightHeads,\n\t\t});\n\n\t\tpi.registerTool(\n\t\t\tcreateCoordinationToolDefinition(\n\t\t\t\tcreateClientBackend({\n\t\t\t\t\tstatus: () => ({ state, reason }),\n\t\t\t\t\tclient: connectedClient,\n\t\t\t\t\tartifacts: artifactsBackend,\n\t\t\t\t\tintegration: integrationBackend,\n\t\t\t\t\tpresenceSet: (focus) => {\n\t\t\t\t\t\tpresence.setFocus(focus);\n\t\t\t\t\t\tconnectedClient()?.updatePresence({\n\t\t\t\t\t\t\tfocus: presence.focus(liveCtx?.sessionManager.getSessionName()),\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\n\t\tpi.registerCommand(\n\t\t\t\"coordinate\",\n\t\t\tcreateCoordinateCommand({\n\t\t\t\tclient: connectedClient,\n\t\t\t\tonPolicyAccepted: () => {\n\t\t\t\t\trequestedOwnership = undefined;\n\t\t\t\t},\n\t\t\t\tinspectAttempt: (attempt, handoff) => {\n\t\t\t\t\tconst repository = identity;\n\t\t\t\t\tif (!repository) {\n\t\t\t\t\t\treturn Promise.resolve({\n\t\t\t\t\t\t\tclassification: \"unavailable\",\n\t\t\t\t\t\t\tlines: [\"This session has no repository identity.\"],\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tconst env = options.gitEnv ?? process.env;\n\t\t\t\t\tconst preIntegrationHead = preflightHeads.get(attempt.id);\n\t\t\t\t\treturn inspectAttemptCheckout({\n\t\t\t\t\t\ttrusted: { cwd: repository.worktreeRoot, env },\n\t\t\t\t\t\tidentity: repository,\n\t\t\t\t\t\tattempt,\n\t\t\t\t\t\thandoff,\n\t\t\t\t\t\tenv,\n\t\t\t\t\t\t...(preIntegrationHead !== undefined ? { preIntegrationHead } : {}),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\n\t\t// One warning per (requested, current) pair for the life of the extension.\n\t\tconst warnedConflicts = new Set<string>();\n\t\tconst notifyPolicyConflict = (status: PolicyStatus): void => {\n\t\t\tconst notice = status.notice;\n\t\t\ttry {\n\t\t\t\tif (!notice || !liveCtx?.hasUI) return;\n\t\t\t\tconst pair = `${notice.requested}>${notice.current}`;\n\t\t\t\tif (warnedConflicts.has(pair)) return;\n\t\t\t\twarnedConflicts.add(pair);\n\t\t\t\tliveCtx.ui.notify(formatPolicyNotice(notice), \"warning\");\n\t\t\t} catch {\n\t\t\t\t// A stale ctx after session replacement must not drop the connection.\n\t\t\t}\n\t\t};\n\n\t\t// Shared worktree, ownership and lease changes the broker pushes; each is announced once per change.\n\t\tlet integrationNoticeState: IntegrationNoticeState = INITIAL_INTEGRATION_NOTICES;\n\t\tconst notifyIntegration = (status: IntegrationStatus, sessionId: string | null): void => {\n\t\t\tconst { notices, next } = integrationNotices(integrationNoticeState, status, sessionId);\n\t\t\tintegrationNoticeState = next;\n\t\t\ttry {\n\t\t\t\tif (!liveCtx?.hasUI) return;\n\t\t\t\tfor (const notice of notices) liveCtx.ui.notify(notice.message, notice.level);\n\t\t\t} catch {\n\t\t\t\t// A stale ctx after session replacement must not drop the connection.\n\t\t\t}\n\t\t};\n\n\t\tpi.on(\"before_agent_start\", (event, ctx) => {\n\t\t\tliveCtx = ctx;\n\t\t\tif (event.messageType === \"user\") presence.setPrompt(event.prompt);\n\t\t\tconnectedClient()?.updatePresence({\n\t\t\t\tname: ctx.sessionManager.getSessionName(),\n\t\t\t\tfocus: presence.focus(ctx.sessionManager.getSessionName()),\n\t\t\t});\n\t\t});\n\n\t\tpi.on(\"tool_result\", (event, ctx) => {\n\t\t\tif (event.isError || !identity || (event.toolName !== \"edit\" && event.toolName !== \"write\")) return;\n\t\t\tif (typeof event.input.path !== \"string\") return;\n\t\t\tpresence.track(event.input.path, ctx.cwd, identity.worktreeRoot);\n\t\t\tconnectedClient()?.updatePresence({ touchedPaths: presence.touchedPaths });\n\t\t});\n\n\t\tpi.on(\"agent_start\", () => {\n\t\t\trunSeq++;\n\t\t\tstreaming = true;\n\t\t\tconnectedClient()?.updatePresence({ status: \"working\" });\n\t\t});\n\n\t\tpi.on(\"agent_end\", async () => {\n\t\t\tstreaming = false;\n\t\t\tif (identity) branch = await readGitBranch(identity.worktreeRoot, env);\n\t\t\tconnectedClient()?.updatePresence({\n\t\t\t\tstatus: \"idle\",\n\t\t\t\tbranch,\n\t\t\t\tname: liveCtx?.sessionManager.getSessionName(),\n\t\t\t\tfocus: presence.focus(liveCtx?.sessionManager.getSessionName()),\n\t\t\t});\n\t\t\tdelivery?.drainHeld();\n\t\t});\n\n\t\tpi.on(\"message_end\", (event) => {\n\t\t\tconst message = event.message;\n\t\t\tif (message.role !== \"custom\" || message.customType !== COORDINATION_MESSAGE_TYPE) return;\n\t\t\tif (!isPeerDetails(message.details)) return;\n\t\t\ttracker.resolve(message.details.messageId, \"injected\");\n\t\t});\n\n\t\tpi.on(\"turn_start\", () => {\n\t\t\treconcile(false);\n\t\t});\n\n\t\tpi.on(\"agent_settled\", () => {\n\t\t\treconcile(true);\n\t\t});\n\n\t\tpi.on(\"session_start\", async (_event, ctx) => {\n\t\t\tawait shutdown();\n\t\t\tintegrationNoticeState = INITIAL_INTEGRATION_NOTICES;\n\t\t\tconst mine = generation;\n\t\t\tliveCtx = ctx;\n\t\t\tpresence = new SessionPresence();\n\t\t\tconst resolved = await (options.resolveIdentity ?? ((cwd) => resolveGitRepositoryIdentity(cwd, env)))(ctx.cwd);\n\t\t\tif (mine !== generation) return;\n\t\t\tidentity = resolved;\n\t\t\tif (!resolved) {\n\t\t\t\tstate = \"unavailable\";\n\t\t\t\treason = \"this directory is not inside a Git work tree\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tbranch = await readGitBranch(resolved.worktreeRoot, env);\n\t\t\trepo = await readRepositoryLabel(resolved.worktreeRoot, options.gitEnv ?? env);\n\t\t\tif (mine !== generation) return;\n\t\t\tstate = \"connecting\";\n\t\t\treason = undefined;\n\t\t\tlet connection: ReturnType<NonNullable<CoordinationExtensionOptions[\"connection\"]>>;\n\t\t\ttry {\n\t\t\t\tconnection = (options.connection ?? ((repository) => defaultConnection(repository)))(resolved);\n\t\t\t} catch (error) {\n\t\t\t\t// An unusable runtime location will not fix itself, so do not start the retrying supervisor.\n\t\t\t\tstate = \"unavailable\";\n\t\t\t\treason = error instanceof Error ? error.message : String(error);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\truntimePaths = connection.paths;\n\t\t\tconst activeDelivery = new InboundDelivery({\n\t\t\t\ttarget: {\n\t\t\t\t\tmode: ctx.mode,\n\t\t\t\t\tisStreaming: () => streaming,\n\t\t\t\t\tisIdle: () => ctx.isIdle(),\n\t\t\t\t\tsend: (content, details, deliveryOptions) => {\n\t\t\t\t\t\tconst message = { customType: COORDINATION_MESSAGE_TYPE, content, display: true, details };\n\t\t\t\t\t\t// An id still outstanding from a different sender is answered `deferred` and not handed to the host.\n\t\t\t\t\t\tif (tracker.deferIfHeldByOther(details.messageId, details.fromId, ID_IN_USE_DETAIL)) return;\n\t\t\t\t\t\t// A full tracking table resolves the id as not_injected without handing it to the host.\n\t\t\t\t\t\tif (!tracker.track(details.messageId, runSeq, details.fromId)) return;\n\t\t\t\t\t\t// A steer must not pass triggerTurn:false: the session would defer the message to the end of the turn.\n\t\t\t\t\t\tif (deliveryOptions.deliverAs === \"steer\") pi.sendMessage(message, { deliverAs: \"steer\" });\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tpi.sendMessage(message, { triggerTurn: deliveryOptions.triggerTurn });\n\t\t\t\t\t\t\t// Without a turn the host appends synchronously (or defers to the end of the running turn), so\n\t\t\t\t\t\t\t// check the session now. A turn-triggering send is confirmed at message_end or agent_settled.\n\t\t\t\t\t\t\tif (!deliveryOptions.triggerTurn) reconcile(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\treceipts: (messageId, status, detail) => {\n\t\t\t\t\tif (status === \"not_injected\" || status === \"injected\") tracker.resolve(messageId, status, detail);\n\t\t\t\t\telse if (status === \"deferred\") tracker.defer(messageId, detail);\n\t\t\t\t\telse tracker.note(messageId, status, detail);\n\t\t\t\t},\n\t\t\t\tonDuplicate: (messageId) => {\n\t\t\t\t\ttracker.replayTerminal(messageId);\n\t\t\t\t},\n\t\t\t\tonIdReused: (messageId) => {\n\t\t\t\t\ttracker.forget(messageId);\n\t\t\t\t},\n\t\t\t\tdeferIfIdHeld: (messageId, fromId) => tracker.deferIfHeldByOther(messageId, fromId, ID_IN_USE_DETAIL),\n\t\t\t\talreadyInjected: (messageId, fromId) => branchMessageKeys().has(peerKey(fromId, messageId)),\n\t\t\t\tbudget: new WakeBudget(options.settingsManager.getCoordinationPeerWakeLimit()),\n\t\t\t});\n\t\t\tdelivery = activeDelivery;\n\t\t\tconst activeSupervisor = new ConnectionSupervisor({\n\t\t\t\tensureBroker: connection.ensureBroker,\n\t\t\t\tcreateClient: () => {\n\t\t\t\t\tconst client = connection.createClient();\n\t\t\t\t\tclient.on(\"message\", (from: SessionInfo, message: Message) => activeDelivery.accept(from, message));\n\t\t\t\t\t// An unhandled \"error\" event would crash the process; the supervisor reacts to \"disconnected\".\n\t\t\t\t\tclient.on(\"error\", () => {});\n\t\t\t\t\tclient.on(\"policy_status\", (status: PolicyStatus) => {\n\t\t\t\t\t\tif (status.requestedOwnership === undefined) requestedOwnership = undefined;\n\t\t\t\t\t\tnotifyPolicyConflict(status);\n\t\t\t\t\t});\n\t\t\t\t\tclient.on(\"integration_status\", (status: IntegrationStatus) => {\n\t\t\t\t\t\tnotifyIntegration(status, client.sessionId);\n\t\t\t\t\t});\n\t\t\t\t\tlatestClient = client;\n\t\t\t\t\treturn client;\n\t\t\t\t},\n\t\t\t\tregistration,\n\t\t\t\tsessionId: ctx.sessionManager.getSessionId(),\n\t\t\t\tonStateChange: (next, failureReason) => {\n\t\t\t\t\tstate = next;\n\t\t\t\t\treason = failureReason;\n\t\t\t\t},\n\t\t\t\tonConnected: () => {\n\t\t\t\t\ttracker.flush();\n\t\t\t\t\tactiveDelivery.drainHeld();\n\t\t\t\t},\n\t\t\t});\n\t\t\tsupervisor = activeSupervisor;\n\t\t\tactiveSupervisor.start();\n\t\t});\n\n\t\tpi.on(\"session_shutdown\", async () => {\n\t\t\tawait shutdown();\n\t\t});\n\t};\n}\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C,CAAC;AACH,CAAC","sourcesContent":["import { dirname } from \"node:path\";\nimport { getAgentDir } from \"../../config.ts\";\nimport type { ExtensionContext, ExtensionFactory } from \"../../core/extensions/types.ts\";\nimport type { SettingsManager } from \"../../core/settings-manager.ts\";\nimport { type GitRepositoryIdentity, readGitBranch, resolveGitRepositoryIdentity } from \"../../utils/git-repository.ts\";\nimport { CoordinationClient } from \"../client/client.ts\";\nimport { ensureBroker } from \"../client/spawn.ts\";\nimport { type CoordinationRuntimePaths, resolveCoordinationRuntimePaths } from \"../transport/paths.ts\";\nimport type {\n\tIntegrationStatus,\n\tMessage,\n\tOwnershipMode,\n\tPolicyStatus,\n\tSessionInfo,\n\tSessionRegistration,\n} from \"../transport/types.ts\";\nimport { createArtifactBackend } from \"./artifact-files.ts\";\nimport { createCoordinateCommand, formatPolicyNotice } from \"./commands.ts\";\nimport { COORDINATION_MESSAGE_TYPE, InboundDelivery, type PeerMessageDetails, WakeBudget } from \"./delivery.ts\";\nimport { inspectAttempt as inspectAttemptCheckout } from \"./git-inspect.ts\";\nimport { createIntegrationBackend } from \"./integration.ts\";\nimport { INITIAL_INTEGRATION_NOTICES, type IntegrationNoticeState, integrationNotices } from \"./integration-notices.ts\";\nimport { decideParticipation } from \"./participation.ts\";\nimport { readRepositoryLabel, SessionPresence, worktreeRelativePath } from \"./presence.ts\";\nimport { ID_IN_USE_DETAIL, ReceiptTracker } from \"./receipts.ts\";\nimport { ConnectionSupervisor } from \"./supervisor.ts\";\nimport { createClientBackend, createCoordinationToolDefinition } from \"./tool.ts\";\n\nexport interface CoordinationExtensionOptions {\n\tnoCoordinate: boolean;\n\tagentExec: boolean;\n\tsettingsManager: SettingsManager;\n\tenv?: NodeJS.ProcessEnv;\n\t/** The environment the integration Git commands are derived from (sanitized first). Default process.env. */\n\tgitEnv?: NodeJS.ProcessEnv;\n\tplatform?: NodeJS.Platform;\n\t/** The --coordinate-ownership flag. Unset accepts the current policy. */\n\townership?: OwnershipMode;\n\tresolveIdentity?: (cwd: string) => Promise<GitRepositoryIdentity | undefined>;\n\t/** May throw (for example when the runtime directory is unsafe); the extension then reports `unavailable`. */\n\tconnection?: (identity: GitRepositoryIdentity) => {\n\t\tpaths: CoordinationRuntimePaths;\n\t\tensureBroker: () => Promise<void>;\n\t\tcreateClient: () => CoordinationClient;\n\t};\n}\n\n/**\n * Resolves the runtime paths once with resolveCoordinationRuntimePaths (the same derivation the broker entry\n * uses) and shares them between ensureBroker and the client, so both act on the canonical path that\n * ensureBroker requires. Throws when the agent directory cannot be made safe to use.\n */\nexport function defaultConnection(\n\tidentity: GitRepositoryIdentity,\n\tagentDir: string = getAgentDir(),\n): {\n\tpaths: CoordinationRuntimePaths;\n\tensureBroker: () => Promise<void>;\n\tcreateClient: () => CoordinationClient;\n} {\n\tconst repositoryPaths = resolveCoordinationRuntimePaths(agentDir, identity.repositoryKey);\n\tconst devicePaths = resolveCoordinationRuntimePaths(agentDir, \"device\");\n\tconst paths = {\n\t\t...devicePaths,\n\t\tartifactsDir: repositoryPaths.artifactsDir,\n\t\tpendingAsksDir: repositoryPaths.pendingAsksDir,\n\t};\n\treturn {\n\t\tpaths,\n\t\tensureBroker: () =>\n\t\t\t// The broker is told the canonical agent directory, so it cannot resolve a different one than the paths used here.\n\t\t\tensureBroker({ paths, repositoryKey: identity.repositoryKey, agentDir: dirname(dirname(paths.runtimeDir)) }),\n\t\tcreateClient: () => new CoordinationClient({ socketPath: paths.socketPath, scopeId: identity.repositoryKey }),\n\t};\n}\n\nfunction isPeerDetails(value: unknown): value is PeerMessageDetails {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"messageId\" in value &&\n\t\ttypeof value.messageId === \"string\" &&\n\t\tvalue.messageId.length > 0\n\t);\n}\n\nexport function createCoordinationExtension(options: CoordinationExtensionOptions): ExtensionFactory {\n\treturn (pi) => {\n\t\tconst env = options.env ?? process.env;\n\t\tconst decision = decideParticipation({\n\t\t\tenv,\n\t\t\tplatform: options.platform ?? process.platform,\n\t\t\tnoCoordinate: options.noCoordinate,\n\t\t\tagentExec: options.agentExec,\n\t\t\tsettingEnabled: options.settingsManager.getCoordinationEnabled(),\n\t\t});\n\t\tif (!decision.participate) {\n\t\t\tif (decision.notify) {\n\t\t\t\tpi.on(\"session_start\", (_event, ctx) => {\n\t\t\t\t\tif (ctx.hasUI) ctx.ui.notify(decision.reason, \"info\");\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tlet state: \"connecting\" | \"connected\" | \"degraded\" | \"unavailable\" = \"connecting\";\n\t\tlet reason: string | undefined;\n\t\tlet supervisor: ConnectionSupervisor | undefined;\n\t\tlet delivery: InboundDelivery | undefined;\n\t\tlet identity: GitRepositoryIdentity | undefined;\n\t\t// The runtime paths of the current connection; artifacts are staged under paths.artifactsDir.\n\t\tlet runtimePaths: CoordinationRuntimePaths | undefined;\n\t\t// The most recently created client. The supervisor runs one attempt at a time, so this is the live\n\t\t// client once connected. Message listeners attach at creation so mail delivered in the same frame\n\t\t// batch as the registration is never missed.\n\t\tlet latestClient: CoordinationClient | undefined;\n\t\tlet branch = \"HEAD\";\n\t\tlet repo = \"\";\n\t\tlet presence = new SessionPresence();\n\t\t// The --coordinate-ownership flag. Cleared by /coordinate policy accept so reconnects stop requesting it.\n\t\tlet requestedOwnership: OwnershipMode | undefined = options.ownership;\n\t\tlet streaming = false;\n\t\tlet generation = 0;\n\t\tlet liveCtx: ExtensionContext | undefined;\n\t\tconst startedAt = Date.now();\n\t\t// Agent runs started so far. A message handed to the host during run N can only be judged lost once a run\n\t\t// after N has settled.\n\t\tlet runSeq = 0;\n\n\t\tconst connectedClient = (): CoordinationClient | undefined =>\n\t\t\tlatestClient?.isConnected() ? latestClient : undefined;\n\n\t\tconst registration = (): SessionRegistration => ({\n\t\t\tcwd: liveCtx?.cwd ?? process.cwd(),\n\t\t\tmodel: liveCtx?.model?.id ?? \"unknown\",\n\t\t\tpid: process.pid,\n\t\t\tstartedAt,\n\t\t\tlastActivity: Date.now(),\n\t\t\tname: liveCtx?.sessionManager.getSessionName(),\n\t\t\tworktreeRoot: identity?.worktreeRoot,\n\t\t\tbranch,\n\t\t\tstatus: streaming ? \"working\" : \"idle\",\n\t\t\tacknowledgesReceipts: true,\n\t\t\townership: requestedOwnership,\n\t\t\trepo,\n\t\t\tfocus: presence.focus(liveCtx?.sessionManager.getSessionName()),\n\t\t\tsubpath: identity\n\t\t\t\t? (worktreeRelativePath(liveCtx?.cwd ?? identity.worktreeRoot, identity.worktreeRoot) ?? \"\")\n\t\t\t\t: \"\",\n\t\t\ttouchedPaths: presence.touchedPaths,\n\t\t});\n\n\t\t// Every message handed to the host is tracked until its injection is observed (message_end or a session\n\t\t// branch scan), so each received id ends in exactly one terminal receipt. Receipts written while the\n\t\t// connection is down are queued and flushed on reconnect.\n\t\tconst tracker = new ReceiptTracker({\n\t\t\tsend: (receipt) => {\n\t\t\t\tconst client = connectedClient();\n\t\t\t\tif (!client) return false;\n\t\t\t\tclient.sendMessageReceipt(receipt);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\n\t\t// One pass over the branch yields every coordination message in the session, keyed by sender and id.\n\t\tconst peerKey = (fromId: string | undefined, messageId: string): string => `${fromId}\\u0000${messageId}`;\n\t\tconst branchMessageKeys = (): Set<string> => {\n\t\t\tconst ids = new Set<string>();\n\t\t\tfor (const entry of liveCtx?.sessionManager.getBranch() ?? []) {\n\t\t\t\tif (\n\t\t\t\t\tentry.type === \"custom_message\" &&\n\t\t\t\t\tentry.customType === COORDINATION_MESSAGE_TYPE &&\n\t\t\t\t\tisPeerDetails(entry.details)\n\t\t\t\t) {\n\t\t\t\t\tids.add(peerKey(entry.details.fromId, entry.details.messageId));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ids;\n\t\t};\n\n\t\t// The host emits message_end for messages it appends outside a run (and for deferred ones) only to its own\n\t\t// subscribers, so injection is also confirmed by scanning the session. `settled` additionally resolves\n\t\t// messages handed over before the run that just settled and still absent from the session as not_injected.\n\t\tconst reconcile = (settled: boolean): void => {\n\t\t\tif (tracker.outstandingCount === 0) return;\n\t\t\tconst present = branchMessageKeys();\n\t\t\tfor (const messageId of tracker.outstandingIds()) {\n\t\t\t\tif (present.has(peerKey(tracker.outstandingFrom(messageId), messageId)))\n\t\t\t\t\ttracker.resolve(messageId, \"injected\");\n\t\t\t}\n\t\t\tif (!settled) return;\n\t\t\tfor (const messageId of tracker.outstandingBefore(runSeq)) {\n\t\t\t\ttracker.resolve(messageId, \"not_injected\", \"message was not added to the session\");\n\t\t\t}\n\t\t};\n\n\t\tconst shutdown = async (): Promise<void> => {\n\t\t\tgeneration++;\n\t\t\tconst activeDelivery = delivery;\n\t\t\tconst activeSupervisor = supervisor;\n\t\t\tdelivery = undefined;\n\t\t\tsupervisor = undefined;\n\t\t\t// Held messages are deferred first, then everything handed to the host but never observed. The broker keeps\n\t\t\t// deferred mail for this session's next start. Send what the live connection still accepts; whatever cannot\n\t\t\t// be written is dropped with the tracker, and the broker redelivers those messages anyway.\n\t\t\tactiveDelivery?.shutdown();\n\t\t\ttracker.close(\"session ended before delivery\");\n\t\t\tawait activeSupervisor?.stop();\n\t\t\tlatestClient = undefined;\n\t\t\ttracker.clear();\n\t\t};\n\n\t\tconst artifactsBackend = createArtifactBackend({\n\t\t\tclient: connectedClient,\n\t\t\tlocation: () =>\n\t\t\t\tidentity && runtimePaths\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcwd: liveCtx?.cwd ?? process.cwd(),\n\t\t\t\t\t\t\tworktreeRoot: identity.worktreeRoot,\n\t\t\t\t\t\t\tartifactsDir: runtimePaths.artifactsDir,\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\tagentDir: getAgentDir,\n\t\t\t// An in-memory session reports \"\", which means no directory. A throwing stale ctx fails the tool call closed.\n\t\t\tsessionDir: () => liveCtx?.sessionManager.getSessionDir() || undefined,\n\t\t});\n\n\t\t// The pre-integration HEADs this session's own preflights read from Git (D8); the reconcile inspector shares them.\n\t\tconst preflightHeads = new Map<string, string>();\n\t\tconst integrationBackend = createIntegrationBackend({\n\t\t\tclient: connectedClient,\n\t\t\tlocation: () =>\n\t\t\t\tidentity\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcwd: liveCtx?.cwd ?? process.cwd(),\n\t\t\t\t\t\t\tworktreeRoot: identity.worktreeRoot,\n\t\t\t\t\t\t\tcommonDir: identity.commonDir,\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\tenv: () => options.gitEnv ?? process.env,\n\t\t\tpreflightHeads,\n\t\t});\n\n\t\tpi.registerTool(\n\t\t\tcreateCoordinationToolDefinition(\n\t\t\t\tcreateClientBackend({\n\t\t\t\t\tstatus: () => ({ state, reason }),\n\t\t\t\t\tclient: connectedClient,\n\t\t\t\t\tartifacts: artifactsBackend,\n\t\t\t\t\tintegration: integrationBackend,\n\t\t\t\t\tpresenceSet: (focus) => {\n\t\t\t\t\t\tpresence.setFocus(focus);\n\t\t\t\t\t\tconnectedClient()?.updatePresence({\n\t\t\t\t\t\t\tfocus: presence.focus(liveCtx?.sessionManager.getSessionName()),\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\n\t\tpi.registerCommand(\n\t\t\t\"coordinate\",\n\t\t\tcreateCoordinateCommand({\n\t\t\t\tclient: connectedClient,\n\t\t\t\tonPolicyAccepted: () => {\n\t\t\t\t\trequestedOwnership = undefined;\n\t\t\t\t},\n\t\t\t\tinspectAttempt: (attempt, handoff) => {\n\t\t\t\t\tconst repository = identity;\n\t\t\t\t\tif (!repository) {\n\t\t\t\t\t\treturn Promise.resolve({\n\t\t\t\t\t\t\tclassification: \"unavailable\",\n\t\t\t\t\t\t\tlines: [\"This session has no repository identity.\"],\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tconst env = options.gitEnv ?? process.env;\n\t\t\t\t\tconst preIntegrationHead = preflightHeads.get(attempt.id);\n\t\t\t\t\treturn inspectAttemptCheckout({\n\t\t\t\t\t\ttrusted: { cwd: repository.worktreeRoot, env },\n\t\t\t\t\t\tidentity: repository,\n\t\t\t\t\t\tattempt,\n\t\t\t\t\t\thandoff,\n\t\t\t\t\t\tenv,\n\t\t\t\t\t\t...(preIntegrationHead !== undefined ? { preIntegrationHead } : {}),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\n\t\t// One warning per (requested, current) pair for the life of the extension.\n\t\tconst warnedConflicts = new Set<string>();\n\t\tconst notifyPolicyConflict = (status: PolicyStatus): void => {\n\t\t\tconst notice = status.notice;\n\t\t\ttry {\n\t\t\t\tif (!notice || !liveCtx?.hasUI) return;\n\t\t\t\tconst pair = `${notice.requested}>${notice.current}`;\n\t\t\t\tif (warnedConflicts.has(pair)) return;\n\t\t\t\twarnedConflicts.add(pair);\n\t\t\t\tliveCtx.ui.notify(formatPolicyNotice(notice), \"warning\");\n\t\t\t} catch {\n\t\t\t\t// A stale ctx after session replacement must not drop the connection.\n\t\t\t}\n\t\t};\n\n\t\t// Shared worktree, ownership and lease changes the broker pushes; each is announced once per change.\n\t\tlet integrationNoticeState: IntegrationNoticeState = INITIAL_INTEGRATION_NOTICES;\n\t\tconst notifyIntegration = (status: IntegrationStatus, sessionId: string | null): void => {\n\t\t\tconst { notices, next } = integrationNotices(\n\t\t\t\tintegrationNoticeState,\n\t\t\t\tstatus,\n\t\t\t\tsessionId,\n\t\t\t\tenv.HUMAIN_TERMINAL_COORDINATION_WORKTREE_HINT === \"1\",\n\t\t\t);\n\t\t\tintegrationNoticeState = next;\n\t\t\ttry {\n\t\t\t\tif (!liveCtx?.hasUI) return;\n\t\t\t\tfor (const notice of notices) liveCtx.ui.notify(notice.message, notice.level);\n\t\t\t} catch {\n\t\t\t\t// A stale ctx after session replacement must not drop the connection.\n\t\t\t}\n\t\t};\n\n\t\tpi.on(\"before_agent_start\", (event, ctx) => {\n\t\t\tliveCtx = ctx;\n\t\t\tif (event.messageType === \"user\") presence.setPrompt(event.prompt);\n\t\t\tconnectedClient()?.updatePresence({\n\t\t\t\tname: ctx.sessionManager.getSessionName(),\n\t\t\t\tfocus: presence.focus(ctx.sessionManager.getSessionName()),\n\t\t\t});\n\t\t});\n\n\t\tpi.on(\"tool_result\", (event, ctx) => {\n\t\t\tif (event.isError || !identity || (event.toolName !== \"edit\" && event.toolName !== \"write\")) return;\n\t\t\tif (typeof event.input.path !== \"string\") return;\n\t\t\tpresence.track(event.input.path, ctx.cwd, identity.worktreeRoot);\n\t\t\tconnectedClient()?.updatePresence({ touchedPaths: presence.touchedPaths });\n\t\t});\n\n\t\tpi.on(\"agent_start\", () => {\n\t\t\trunSeq++;\n\t\t\tstreaming = true;\n\t\t\tconnectedClient()?.updatePresence({ status: \"working\" });\n\t\t});\n\n\t\tpi.on(\"agent_end\", async () => {\n\t\t\tstreaming = false;\n\t\t\tif (identity) branch = await readGitBranch(identity.worktreeRoot, env);\n\t\t\tconnectedClient()?.updatePresence({\n\t\t\t\tstatus: \"idle\",\n\t\t\t\tbranch,\n\t\t\t\tname: liveCtx?.sessionManager.getSessionName(),\n\t\t\t\tfocus: presence.focus(liveCtx?.sessionManager.getSessionName()),\n\t\t\t});\n\t\t\tdelivery?.drainHeld();\n\t\t});\n\n\t\tpi.on(\"message_end\", (event) => {\n\t\t\tconst message = event.message;\n\t\t\tif (message.role !== \"custom\" || message.customType !== COORDINATION_MESSAGE_TYPE) return;\n\t\t\tif (!isPeerDetails(message.details)) return;\n\t\t\ttracker.resolve(message.details.messageId, \"injected\");\n\t\t});\n\n\t\tpi.on(\"turn_start\", () => {\n\t\t\treconcile(false);\n\t\t});\n\n\t\tpi.on(\"agent_settled\", () => {\n\t\t\treconcile(true);\n\t\t});\n\n\t\tpi.on(\"session_start\", async (_event, ctx) => {\n\t\t\tawait shutdown();\n\t\t\tintegrationNoticeState = INITIAL_INTEGRATION_NOTICES;\n\t\t\tconst mine = generation;\n\t\t\tliveCtx = ctx;\n\t\t\tpresence = new SessionPresence();\n\t\t\tconst resolved = await (options.resolveIdentity ?? ((cwd) => resolveGitRepositoryIdentity(cwd, env)))(ctx.cwd);\n\t\t\tif (mine !== generation) return;\n\t\t\tidentity = resolved;\n\t\t\tif (!resolved) {\n\t\t\t\tstate = \"unavailable\";\n\t\t\t\treason = \"this directory is not inside a Git work tree\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tbranch = await readGitBranch(resolved.worktreeRoot, env);\n\t\t\trepo = await readRepositoryLabel(resolved.worktreeRoot, options.gitEnv ?? env);\n\t\t\tif (mine !== generation) return;\n\t\t\tstate = \"connecting\";\n\t\t\treason = undefined;\n\t\t\tlet connection: ReturnType<NonNullable<CoordinationExtensionOptions[\"connection\"]>>;\n\t\t\ttry {\n\t\t\t\tconnection = (options.connection ?? ((repository) => defaultConnection(repository)))(resolved);\n\t\t\t} catch (error) {\n\t\t\t\t// An unusable runtime location will not fix itself, so do not start the retrying supervisor.\n\t\t\t\tstate = \"unavailable\";\n\t\t\t\treason = error instanceof Error ? error.message : String(error);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\truntimePaths = connection.paths;\n\t\t\tconst activeDelivery = new InboundDelivery({\n\t\t\t\ttarget: {\n\t\t\t\t\tmode: ctx.mode,\n\t\t\t\t\tisStreaming: () => streaming,\n\t\t\t\t\tisIdle: () => ctx.isIdle(),\n\t\t\t\t\tsend: (content, details, deliveryOptions) => {\n\t\t\t\t\t\tconst message = { customType: COORDINATION_MESSAGE_TYPE, content, display: true, details };\n\t\t\t\t\t\t// An id still outstanding from a different sender is answered `deferred` and not handed to the host.\n\t\t\t\t\t\tif (tracker.deferIfHeldByOther(details.messageId, details.fromId, ID_IN_USE_DETAIL)) return;\n\t\t\t\t\t\t// A full tracking table resolves the id as not_injected without handing it to the host.\n\t\t\t\t\t\tif (!tracker.track(details.messageId, runSeq, details.fromId)) return;\n\t\t\t\t\t\t// A steer must not pass triggerTurn:false: the session would defer the message to the end of the turn.\n\t\t\t\t\t\tif (deliveryOptions.deliverAs === \"steer\") pi.sendMessage(message, { deliverAs: \"steer\" });\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tpi.sendMessage(message, { triggerTurn: deliveryOptions.triggerTurn });\n\t\t\t\t\t\t\t// Without a turn the host appends synchronously (or defers to the end of the running turn), so\n\t\t\t\t\t\t\t// check the session now. A turn-triggering send is confirmed at message_end or agent_settled.\n\t\t\t\t\t\t\tif (!deliveryOptions.triggerTurn) reconcile(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\treceipts: (messageId, status, detail) => {\n\t\t\t\t\tif (status === \"not_injected\" || status === \"injected\") tracker.resolve(messageId, status, detail);\n\t\t\t\t\telse if (status === \"deferred\") tracker.defer(messageId, detail);\n\t\t\t\t\telse tracker.note(messageId, status, detail);\n\t\t\t\t},\n\t\t\t\tonDuplicate: (messageId) => {\n\t\t\t\t\ttracker.replayTerminal(messageId);\n\t\t\t\t},\n\t\t\t\tonIdReused: (messageId) => {\n\t\t\t\t\ttracker.forget(messageId);\n\t\t\t\t},\n\t\t\t\tdeferIfIdHeld: (messageId, fromId) => tracker.deferIfHeldByOther(messageId, fromId, ID_IN_USE_DETAIL),\n\t\t\t\talreadyInjected: (messageId, fromId) => branchMessageKeys().has(peerKey(fromId, messageId)),\n\t\t\t\tbudget: new WakeBudget(options.settingsManager.getCoordinationPeerWakeLimit()),\n\t\t\t});\n\t\t\tdelivery = activeDelivery;\n\t\t\tconst activeSupervisor = new ConnectionSupervisor({\n\t\t\t\tensureBroker: connection.ensureBroker,\n\t\t\t\tcreateClient: () => {\n\t\t\t\t\tconst client = connection.createClient();\n\t\t\t\t\tclient.on(\"message\", (from: SessionInfo, message: Message) => activeDelivery.accept(from, message));\n\t\t\t\t\t// An unhandled \"error\" event would crash the process; the supervisor reacts to \"disconnected\".\n\t\t\t\t\tclient.on(\"error\", () => {});\n\t\t\t\t\tclient.on(\"policy_status\", (status: PolicyStatus) => {\n\t\t\t\t\t\tif (status.requestedOwnership === undefined) requestedOwnership = undefined;\n\t\t\t\t\t\tnotifyPolicyConflict(status);\n\t\t\t\t\t});\n\t\t\t\t\tclient.on(\"integration_status\", (status: IntegrationStatus) => {\n\t\t\t\t\t\tnotifyIntegration(status, client.sessionId);\n\t\t\t\t\t});\n\t\t\t\t\tlatestClient = client;\n\t\t\t\t\treturn client;\n\t\t\t\t},\n\t\t\t\tregistration,\n\t\t\t\tsessionId: ctx.sessionManager.getSessionId(),\n\t\t\t\tonStateChange: (next, failureReason) => {\n\t\t\t\t\tstate = next;\n\t\t\t\t\treason = failureReason;\n\t\t\t\t},\n\t\t\t\tonConnected: () => {\n\t\t\t\t\ttracker.flush();\n\t\t\t\t\tactiveDelivery.drainHeld();\n\t\t\t\t},\n\t\t\t});\n\t\t\tsupervisor = activeSupervisor;\n\t\t\tactiveSupervisor.start();\n\t\t});\n\n\t\tpi.on(\"session_shutdown\", async () => {\n\t\t\tawait shutdown();\n\t\t});\n\t};\n}\n"]}
@@ -26,7 +26,7 @@ export interface IntegrationNotice {
26
26
  * an attempt that has no outcome, attempts that stopped on a conflict, and an invalid stored state.
27
27
  * Each is announced once per change.
28
28
  */
29
- export declare function integrationNotices(previous: IntegrationNoticeState, status: IntegrationStatus, sessionId: string | null): {
29
+ export declare function integrationNotices(previous: IntegrationNoticeState, status: IntegrationStatus, sessionId: string | null, suggestWorktree?: boolean): {
30
30
  notices: IntegrationNotice[];
31
31
  next: IntegrationNoticeState;
32
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"integration-notices.d.ts","sourceRoot":"","sources":["../../../src/coordination/adapter/integration-notices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,WAAW,sBAAsB;IACtC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,2BAA2B,EAAE,sBAQzC,CAAC;AAEF,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,sBAAsB,EAChC,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,MAAM,GAAG,IAAI,GACtB;IAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAAC,IAAI,EAAE,sBAAsB,CAAA;CAAE,CAmEhE"}
1
+ {"version":3,"file":"integration-notices.d.ts","sourceRoot":"","sources":["../../../src/coordination/adapter/integration-notices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,WAAW,sBAAsB;IACtC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,2BAA2B,EAAE,sBAQzC,CAAC;AAEF,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,sBAAsB,EAChC,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,eAAe,UAAQ,GACrB;IAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAAC,IAAI,EAAE,sBAAsB,CAAA;CAAE,CAsEhE"}
@@ -13,7 +13,7 @@ export const INITIAL_INTEGRATION_NOTICES = {
13
13
  * an attempt that has no outcome, attempts that stopped on a conflict, and an invalid stored state.
14
14
  * Each is announced once per change.
15
15
  */
16
- export function integrationNotices(previous, status, sessionId) {
16
+ export function integrationNotices(previous, status, sessionId, suggestWorktree = false) {
17
17
  const notices = [];
18
18
  if (status.stateInvalid && !previous.invalid) {
19
19
  notices.push({
@@ -24,8 +24,11 @@ export function integrationNotices(previous, status, sessionId) {
24
24
  const shared = [...status.sharedWith].sort().join(",");
25
25
  if (shared !== "" && previous.shared === "" && !status.callerIsWriter) {
26
26
  const n = status.sharedWith.length;
27
+ const hint = suggestWorktree
28
+ ? " The writer gate does not protect edits or Git commands run through bash. Prefer a separate checkout: replace the placeholders in git worktree add ../<repo>-<name>, then restart this session in that worktree."
29
+ : "";
27
30
  notices.push({
28
- message: `Coordination: this worktree is shared with ${n} other session${n === 1 ? "" : "s"}. Coordinated Git actions (handoff_publish, integrate) are refused until a human assigns a single writer: /coordinate writer assign <session>. /coordinate owner lists the sessions.`,
31
+ message: `Coordination: this worktree is shared with ${n} other session${n === 1 ? "" : "s"}. Coordinated Git actions (handoff_publish, integrate) are refused until a human assigns a single writer: /coordinate writer assign <session>. /coordinate owner lists the sessions.${hint}`,
29
32
  level: "warning",
30
33
  });
31
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"integration-notices.js","sourceRoot":"","sources":["../../../src/coordination/adapter/integration-notices.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,2BAA2B,GAA2B;IAClE,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,KAAK;IACZ,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,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ACN,OAAO;QACP,IAAI,EAAE;YACL,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;YAC3C,KAAK,EAAE,MAAM,CAAC,aAAa;YAC3B,aAAa;YACb,SAAS;YACT,OAAO;YACP,SAAS;YACT,OAAO,EAAE,MAAM,CAAC,YAAY;SAC5B;KACD,CAAC;AACH,CAAC","sourcesContent":["import type { IntegrationStatus } from \"../transport/types.ts\";\n\nexport interface IntegrationNoticeState {\n\t/**\n\t * Sorted ids of the sessions sharing this worktree, as of the last status;\n\t * empty when not shared or when this session is the writer.\n\t */\n\tshared: string;\n\towner: boolean;\n\townerAssigned: boolean;\n\tleaseLost: boolean;\n\t/** Id of the attempt last announced as lacking an outcome. */\n\tattempt: string;\n\t/** Sorted ids of the unresolved conflict attempts, last announced. */\n\tconflicts: string;\n\t/** The invalid stored state was announced. */\n\tinvalid: boolean;\n}\n\nexport const INITIAL_INTEGRATION_NOTICES: IntegrationNoticeState = {\n\tshared: \"\",\n\towner: false,\n\townerAssigned: false,\n\tleaseLost: false,\n\tattempt: \"\",\n\tconflicts: \"\",\n\tinvalid: false,\n};\n\nexport interface IntegrationNotice {\n\tmessage: string;\n\tlevel: \"info\" | \"warning\";\n}\n\n/**\n * The messages a session's user should see when the integration status pushed by the broker changes:\n * a shared worktree (announced once each time the worktree becomes shared), becoming the owner, losing the lease,\n * an attempt that has no outcome, attempts that stopped on a conflict, and an invalid stored state.\n * Each is announced once per change.\n */\nexport function integrationNotices(\n\tprevious: IntegrationNoticeState,\n\tstatus: IntegrationStatus,\n\tsessionId: string | null,\n): { notices: IntegrationNotice[]; next: IntegrationNoticeState } {\n\tconst notices: IntegrationNotice[] = [];\n\tif (status.stateInvalid && !previous.invalid) {\n\t\tnotices.push({\n\t\t\tmessage:\n\t\t\t\t\"Coordination: the stored integration state is invalid, so integration is disabled and nothing was changed. A human has to repair or move it; see docs/coordination.md (Invalid integration state).\",\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\tconst shared = [...status.sharedWith].sort().join(\",\");\n\tif (shared !== \"\" && previous.shared === \"\" && !status.callerIsWriter) {\n\t\tconst n = status.sharedWith.length;\n\t\tnotices.push({\n\t\t\tmessage: `Coordination: this worktree is shared with ${n} other session${n === 1 ? \"\" : \"s\"}. Coordinated Git actions (handoff_publish, integrate) are refused until a human assigns a single writer: /coordinate writer assign <session>. /coordinate owner lists the sessions.`,\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\tconst ownerAssigned = status.owner !== null;\n\tif (!ownerAssigned && previous.ownerAssigned && status.queuedHandoffs > 0) {\n\t\tnotices.push({\n\t\t\tmessage: `Coordination: there is no integration owner and ${status.queuedHandoffs} handoffs are queued. A human can assign an owner with /coordinate owner assign <session>.`,\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\tif (status.callerIsOwner && !previous.owner) {\n\t\tnotices.push({\n\t\t\tmessage: `Coordination: this session is now the integration owner (generation ${status.generation}); ${status.queuedHandoffs} handoffs are queued. Integration still needs your approval of each Git command.`,\n\t\t\tlevel: \"info\",\n\t\t});\n\t}\n\tconst leaseLost = status.owner?.lease === \"lost\" && status.owner.sessionId === sessionId;\n\tif (leaseLost && !previous.leaseLost) {\n\t\tnotices.push({\n\t\t\tmessage:\n\t\t\t\t\"Coordination: this session lost the integration lease. Coordinated Git steps are blocked until a human runs /coordinate owner assign <session>.\",\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\tconst attempt = status.openAttempt !== null && status.owner?.lease !== \"held\" ? status.openAttempt.id : \"\";\n\tif (attempt !== \"\" && attempt !== previous.attempt) {\n\t\tnotices.push({\n\t\t\tmessage: `Coordination: integration attempt ${attempt} has no recorded outcome. Inspect it with /coordinate owner reconcile before assigning an owner again.`,\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\tconst conflicts = status.conflictAttempts\n\t\t.map((item) => item.id)\n\t\t.sort()\n\t\t.join(\",\");\n\tif (conflicts !== \"\" && conflicts !== previous.conflicts) {\n\t\tnotices.push({\n\t\t\tmessage: `Coordination: integration attempt ${conflicts.replaceAll(\",\", \", \")} stopped on a conflict that is not resolved; it blocks new attempts on its target. Resolve or abort the merge yourself; /coordinate owner reconcile shows the real state.`,\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\treturn {\n\t\tnotices,\n\t\tnext: {\n\t\t\tshared: status.callerIsWriter ? \"\" : shared,\n\t\t\towner: status.callerIsOwner,\n\t\t\townerAssigned,\n\t\t\tleaseLost,\n\t\t\tattempt,\n\t\t\tconflicts,\n\t\t\tinvalid: status.stateInvalid,\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"integration-notices.js","sourceRoot":"","sources":["../../../src/coordination/adapter/integration-notices.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,2BAA2B,GAA2B;IAClE,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,KAAK;IACZ,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,KAAK;CACd,CAAC;AAOF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CACjC,QAAgC,EAChC,MAAyB,EACzB,SAAwB,EACxB,eAAe,GAAG,KAAK;IAEvB,MAAM,OAAO,GAAwB,EAAE,CAAC;IACxC,IAAI,MAAM,CAAC,YAAY,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC;YACZ,OAAO,EACN,oMAAoM;YACrM,KAAK,EAAE,SAAS;SAChB,CAAC,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvD,IAAI,MAAM,KAAK,EAAE,IAAI,QAAQ,CAAC,MAAM,KAAK,EAAE,IAAI,CAAC,MAAM,C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M,CAAC,WAAW,KAAK,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3G,IAAI,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC;YACZ,OAAO,EAAE,qCAAqC,OAAO,wGAAwG;YAC7J,KAAK,EAAE,SAAS;SAChB,CAAC,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB;SACvC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;SACtB,IAAI,EAAE;SACN,IAAI,CAAC,GAAG,CAAC,CAAC;IACZ,IAAI,SAAS,KAAK,EAAE,IAAI,SAAS,KAAK,QAAQ,CAAC,SAAS,EAAE,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC;YACZ,OAAO,EAAE,qCAAqC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,2KAA2K;YACxP,KAAK,EAAE,SAAS;SAChB,CAAC,CAAC;IACJ,CAAC;IACD,OAAO;QACN,OAAO;QACP,IAAI,EAAE;YACL,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;YAC3C,KAAK,EAAE,MAAM,CAAC,aAAa;YAC3B,aAAa;YACb,SAAS;YACT,OAAO;YACP,SAAS;YACT,OAAO,EAAE,MAAM,CAAC,YAAY;SAC5B;KACD,CAAC;AACH,CAAC","sourcesContent":["import type { IntegrationStatus } from \"../transport/types.ts\";\n\nexport interface IntegrationNoticeState {\n\t/**\n\t * Sorted ids of the sessions sharing this worktree, as of the last status;\n\t * empty when not shared or when this session is the writer.\n\t */\n\tshared: string;\n\towner: boolean;\n\townerAssigned: boolean;\n\tleaseLost: boolean;\n\t/** Id of the attempt last announced as lacking an outcome. */\n\tattempt: string;\n\t/** Sorted ids of the unresolved conflict attempts, last announced. */\n\tconflicts: string;\n\t/** The invalid stored state was announced. */\n\tinvalid: boolean;\n}\n\nexport const INITIAL_INTEGRATION_NOTICES: IntegrationNoticeState = {\n\tshared: \"\",\n\towner: false,\n\townerAssigned: false,\n\tleaseLost: false,\n\tattempt: \"\",\n\tconflicts: \"\",\n\tinvalid: false,\n};\n\nexport interface IntegrationNotice {\n\tmessage: string;\n\tlevel: \"info\" | \"warning\";\n}\n\n/**\n * The messages a session's user should see when the integration status pushed by the broker changes:\n * a shared worktree (announced once each time the worktree becomes shared), becoming the owner, losing the lease,\n * an attempt that has no outcome, attempts that stopped on a conflict, and an invalid stored state.\n * Each is announced once per change.\n */\nexport function integrationNotices(\n\tprevious: IntegrationNoticeState,\n\tstatus: IntegrationStatus,\n\tsessionId: string | null,\n\tsuggestWorktree = false,\n): { notices: IntegrationNotice[]; next: IntegrationNoticeState } {\n\tconst notices: IntegrationNotice[] = [];\n\tif (status.stateInvalid && !previous.invalid) {\n\t\tnotices.push({\n\t\t\tmessage:\n\t\t\t\t\"Coordination: the stored integration state is invalid, so integration is disabled and nothing was changed. A human has to repair or move it; see docs/coordination.md (Invalid integration state).\",\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\tconst shared = [...status.sharedWith].sort().join(\",\");\n\tif (shared !== \"\" && previous.shared === \"\" && !status.callerIsWriter) {\n\t\tconst n = status.sharedWith.length;\n\t\tconst hint = suggestWorktree\n\t\t\t? \" The writer gate does not protect edits or Git commands run through bash. Prefer a separate checkout: replace the placeholders in git worktree add ../<repo>-<name>, then restart this session in that worktree.\"\n\t\t\t: \"\";\n\t\tnotices.push({\n\t\t\tmessage: `Coordination: this worktree is shared with ${n} other session${n === 1 ? \"\" : \"s\"}. Coordinated Git actions (handoff_publish, integrate) are refused until a human assigns a single writer: /coordinate writer assign <session>. /coordinate owner lists the sessions.${hint}`,\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\tconst ownerAssigned = status.owner !== null;\n\tif (!ownerAssigned && previous.ownerAssigned && status.queuedHandoffs > 0) {\n\t\tnotices.push({\n\t\t\tmessage: `Coordination: there is no integration owner and ${status.queuedHandoffs} handoffs are queued. A human can assign an owner with /coordinate owner assign <session>.`,\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\tif (status.callerIsOwner && !previous.owner) {\n\t\tnotices.push({\n\t\t\tmessage: `Coordination: this session is now the integration owner (generation ${status.generation}); ${status.queuedHandoffs} handoffs are queued. Integration still needs your approval of each Git command.`,\n\t\t\tlevel: \"info\",\n\t\t});\n\t}\n\tconst leaseLost = status.owner?.lease === \"lost\" && status.owner.sessionId === sessionId;\n\tif (leaseLost && !previous.leaseLost) {\n\t\tnotices.push({\n\t\t\tmessage:\n\t\t\t\t\"Coordination: this session lost the integration lease. Coordinated Git steps are blocked until a human runs /coordinate owner assign <session>.\",\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\tconst attempt = status.openAttempt !== null && status.owner?.lease !== \"held\" ? status.openAttempt.id : \"\";\n\tif (attempt !== \"\" && attempt !== previous.attempt) {\n\t\tnotices.push({\n\t\t\tmessage: `Coordination: integration attempt ${attempt} has no recorded outcome. Inspect it with /coordinate owner reconcile before assigning an owner again.`,\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\tconst conflicts = status.conflictAttempts\n\t\t.map((item) => item.id)\n\t\t.sort()\n\t\t.join(\",\");\n\tif (conflicts !== \"\" && conflicts !== previous.conflicts) {\n\t\tnotices.push({\n\t\t\tmessage: `Coordination: integration attempt ${conflicts.replaceAll(\",\", \", \")} stopped on a conflict that is not resolved; it blocks new attempts on its target. Resolve or abort the merge yourself; /coordinate owner reconcile shows the real state.`,\n\t\t\tlevel: \"warning\",\n\t\t});\n\t}\n\treturn {\n\t\tnotices,\n\t\tnext: {\n\t\t\tshared: status.callerIsWriter ? \"\" : shared,\n\t\t\towner: status.callerIsOwner,\n\t\t\townerAssigned,\n\t\t\tleaseLost,\n\t\t\tattempt,\n\t\t\tconflicts,\n\t\t\tinvalid: status.stateInvalid,\n\t\t},\n\t};\n}\n"]}
@@ -1,4 +1,4 @@
1
- // Derived from pi-intercom (MIT, Copyright (c) 2026 Nico Bailon), commit a5fad4df; modified for HUMAIN Code CLI.
1
+ // Derived from pi-intercom (MIT, Copyright (c) 2026 Nico Bailon), commit ddf28818; modified for HUMAIN Code CLI.
2
2
  import { createHash } from "node:crypto";
3
3
  import { lstatSync, readdirSync, unlinkSync } from "node:fs";
4
4
  import { join } from "node:path";
@@ -177,11 +177,11 @@ export class ExtensionStateManager {
177
177
  this.states.set(namespace, state);
178
178
  return { committed: true, revision: envelope.revision };
179
179
  }
180
- catch {
180
+ catch (error) {
181
181
  return {
182
182
  committed: false,
183
183
  revision: currentRevision,
184
- reason: "Failed to persist extension state",
184
+ reason: `Failed to persist extension state: ${error instanceof Error ? error.message : String(error)}`,
185
185
  persistFailed: true,
186
186
  };
187
187
  }