sanoma 0.11.21 → 0.11.22

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 (417) hide show
  1. package/README.md +2 -0
  2. package/app/README.md +2 -2
  3. package/app/dist/api.d.ts +16 -2
  4. package/app/dist/api.js +1 -1
  5. package/app/dist/client/assets/ArrowDown.es-BOfBLlTP.js +1 -0
  6. package/app/dist/client/assets/CaretDown.es-D12mWb2j.js +1 -0
  7. package/app/dist/client/assets/CatchBoundary-Cb__yx-s.js +1 -0
  8. package/app/dist/client/assets/Copy.es-CvUujKw7.js +1 -0
  9. package/app/dist/client/assets/DialogTitle-Dz3loDe5.js +1 -0
  10. package/app/dist/client/assets/FloppyDisk.es-CDyDob8p.js +1 -0
  11. package/app/dist/client/assets/Globe.es-C1pgZCGM.js +1 -0
  12. package/app/dist/client/assets/MagnifyingGlass.es-CZ3i6pz0.js +1 -0
  13. package/app/dist/client/assets/Play.es-DGJ1CGhp.js +1 -0
  14. package/app/dist/client/assets/Plug.es-BPhGL8MK.js +1 -0
  15. package/app/dist/client/assets/Plus.es-i3Vaa2WW.js +1 -0
  16. package/app/dist/client/assets/Separator-Cu9cQDBN.js +1 -0
  17. package/app/dist/client/assets/X.es-B7rq0E_-.js +1 -0
  18. package/app/dist/client/assets/_id-C4bMZ73g.js +1 -0
  19. package/app/dist/client/assets/_id-CUaJYD_3.js +1 -0
  20. package/app/dist/client/assets/_id-DRetx-BJ.js +1 -0
  21. package/app/dist/client/assets/_id-mm7bTIIl.js +2 -0
  22. package/app/dist/client/assets/_id-tN6nFEpD.js +1 -0
  23. package/app/dist/client/assets/_name-BOi2qVWk.js +1 -0
  24. package/app/dist/client/assets/_name-CBI1waPs.js +4 -0
  25. package/app/dist/client/assets/_name-CrsiaFT6.js +1 -0
  26. package/app/dist/client/assets/_name-TzQfjXo8.js +1 -0
  27. package/app/dist/client/assets/_vendor-C3TGvx4w.js +1 -0
  28. package/app/dist/client/assets/_vendor-sHwAlFSF.js +1 -0
  29. package/app/dist/client/assets/app-chrome-_ahvxx73.js +5 -0
  30. package/app/dist/client/assets/app-scope-Bht7PIkQ.js +1 -0
  31. package/app/dist/client/assets/approval-BFFM_yEl.js +1 -0
  32. package/app/dist/client/assets/apps-CpdXjc1j.js +1 -0
  33. package/app/dist/client/assets/button-D5kdANef.js +1 -0
  34. package/app/dist/client/assets/change-glance-CdkbSGxZ.js +1 -0
  35. package/app/dist/client/assets/changes-C_K2tazO.js +1 -0
  36. package/app/dist/client/assets/changes-DFcdyDL_.js +1 -0
  37. package/app/dist/client/assets/chat-Djbdaxw8.js +14 -0
  38. package/app/dist/client/assets/chat-button-DNusaP5n.js +1 -0
  39. package/app/dist/client/assets/chat-prompt-z0XJPDtH.js +1 -0
  40. package/app/dist/client/assets/{code-BVYaiQEr.js → code-CT4-YDKq.js} +2 -2
  41. package/app/dist/client/assets/common-DHOhx6Zn.js +3 -0
  42. package/app/dist/client/assets/composite-9cNA7N0P.js +1 -0
  43. package/app/dist/client/assets/connect-DHUdrwwW.js +1 -0
  44. package/app/dist/client/assets/connections-fGNKJl3J.js +5 -0
  45. package/app/dist/client/assets/connectors-CuS1paNm.js +1 -0
  46. package/app/dist/client/assets/credentials-Cb7Lnfxk.js +1 -0
  47. package/app/dist/client/assets/css-BGIxQoYs.js +1 -0
  48. package/app/dist/client/assets/css-DgaLhXQH.js +1 -0
  49. package/app/dist/client/assets/data-DZ-ufRXn.js +1 -0
  50. package/app/dist/client/assets/decidable-OFQBEcco.js +1 -0
  51. package/app/dist/client/assets/declaration-form-D2ZMEVC6.js +1 -0
  52. package/app/dist/client/assets/dialog-B5pmfCdJ.js +1 -0
  53. package/app/dist/client/assets/diff-woXpYk--.js +1 -0
  54. package/app/dist/client/assets/engine-CBuzy-Ik.js +1 -0
  55. package/app/dist/client/assets/existing-BaPrTDs8.js +1 -0
  56. package/app/dist/client/assets/fence-CMhOJv7H.js +157 -0
  57. package/app/dist/client/assets/github-dark-C-LZuMrd.js +1 -0
  58. package/app/dist/client/assets/github-light-EUqPIrTm.js +1 -0
  59. package/app/dist/client/assets/graph-B5TYhcqD.js +7 -0
  60. package/app/dist/client/assets/grid-diff-wo26YSgM.js +1 -0
  61. package/app/dist/client/assets/held-card-HrJ6QpRY.js +1 -0
  62. package/app/dist/client/assets/highlighted-body-JLMTFACH-CjeaSnZq.js +1 -0
  63. package/app/dist/client/assets/hosting-Beoi95m6.js +1 -0
  64. package/app/dist/client/assets/html-BHZv6uqE.js +1 -0
  65. package/app/dist/client/assets/import-8WDFPfe6.js +1 -0
  66. package/app/dist/client/assets/inbox-B9hsZPsC.js +1 -0
  67. package/app/dist/client/assets/inbox-DM2npRZI.js +1 -0
  68. package/app/dist/client/assets/index-CHKfukjt.js +10 -0
  69. package/app/dist/client/assets/item-B4QRpXse.js +1 -0
  70. package/app/dist/client/assets/javascript-BzbQS41l.js +1 -0
  71. package/app/dist/client/assets/javascript-CpIGwZ_Y.js +1 -0
  72. package/app/dist/client/assets/json-qhed-kSA.js +1 -0
  73. package/app/dist/client/assets/jsx-Bz0zcwM4.js +1 -0
  74. package/app/dist/client/assets/kit-n8CE0xEs.js +1 -0
  75. package/app/dist/client/assets/lazyRouteComponent-DezoGNoN.js +1 -0
  76. package/app/dist/client/assets/markdown-BYOwaDjH.js +1 -0
  77. package/app/dist/client/assets/markdown-DS_nKu0s.js +164 -0
  78. package/app/dist/client/assets/mermaid-WFAXDIZX-DQBKIf0O.js +1 -0
  79. package/app/dist/client/assets/motion-D6e1hqz4.js +1 -0
  80. package/app/dist/client/assets/people-BiiQfYJ8.js +1 -0
  81. package/app/dist/client/assets/permissions-BmKxEfBi.js +2 -0
  82. package/app/dist/client/assets/permissions-grid-B755bq5J.js +1 -0
  83. package/app/dist/client/assets/preload-helper-BLdHbfdN.js +1 -0
  84. package/app/dist/client/assets/python-gzcpVVnB.js +1 -0
  85. package/app/dist/client/assets/queries-DGlVu9wp.js +57 -0
  86. package/app/dist/client/assets/react-dom-D6fTz1bt.js +1 -0
  87. package/app/dist/client/assets/route-BSe5L2p4.js +1 -0
  88. package/app/dist/client/assets/route-Ds87ixtB.js +1 -0
  89. package/app/dist/client/assets/runs-table-DMiD4HeY.js +1 -0
  90. package/app/dist/client/assets/scenario-DrgmfuFx.js +1 -0
  91. package/app/dist/client/assets/scenario-graph-Blv2e1PV.js +1 -0
  92. package/app/dist/client/assets/separator-Bdtc7rou.js +1 -0
  93. package/app/dist/client/assets/{sheet-BYL9XU5s.js → sheet-BKUFUA1l.js} +1 -1
  94. package/app/dist/client/assets/shellscript-CLZ0U2zV.js +1 -0
  95. package/app/dist/client/assets/site-icon-1Mcc1UIb.js +1 -0
  96. package/app/dist/client/assets/sites.index-K4mrFsLr.js +1 -0
  97. package/app/dist/client/assets/spinner-XaRXIj9W.js +1 -0
  98. package/app/dist/client/assets/sql-CEbI0hMM.js +1 -0
  99. package/app/dist/client/assets/start-form-CJ6VmNPY.js +1 -0
  100. package/app/dist/client/assets/store-BT988jIX.js +1 -0
  101. package/app/dist/client/assets/style-CTcG_5y0.css +2 -0
  102. package/app/dist/client/assets/table-B81tv0LG.js +1 -0
  103. package/app/dist/client/assets/textarea-CRpYU-qx.js +1 -0
  104. package/app/dist/client/assets/tsx-udAQXfEw.js +1 -0
  105. package/app/dist/client/assets/typescript-bsJCZSQ-.js +1 -0
  106. package/app/dist/client/assets/{useLoaderData-BQd5yMlA.js → useLoaderData-BsksXf-p.js} +1 -1
  107. package/app/dist/client/assets/useOpenInteractionType-UhakpAXY.js +1 -0
  108. package/app/dist/client/assets/useRegisterFieldControl-DIkKUJkh.js +1 -0
  109. package/app/dist/client/assets/useValueChanged-DBqn456b.js +1 -0
  110. package/app/dist/client/assets/utils-BRvE9-Fo.js +1 -0
  111. package/app/dist/client/assets/who-are-you-DUoVqvfP.js +1 -0
  112. package/app/dist/client/assets/workflow-lQtyyxKx.js +1 -0
  113. package/app/dist/client/assets/workflow-view-hk_RU9WF.js +1 -0
  114. package/app/dist/client/assets/workflows-DFB7lzzN.js +1 -0
  115. package/app/dist/client/assets/yaml-rwi0_p6S.js +1 -0
  116. package/app/dist/index.d.ts +4 -4
  117. package/app/dist/lib/chat.d.ts +64 -19
  118. package/app/dist/lib/chat.js +54 -18
  119. package/app/dist/lib/chat.js.map +1 -1
  120. package/app/dist/server/assets/{_id-wuJIq2ZZ.js → _id--MWJXj9R.js} +2 -2
  121. package/app/dist/server/assets/{_id-ce1EGp7Y.js → _id-BEGe86NW.js} +2 -2
  122. package/app/dist/server/assets/{_id-BViXAagq.js → _id-CbO7Ok0w.js} +12 -10
  123. package/app/dist/server/assets/{_id-Dt9tTylX.js → _id-DwdpIYKk.js} +2 -2
  124. package/app/dist/server/assets/{_id-wB8khGTz.js → _id-fK_nPFHK.js} +6 -6
  125. package/app/dist/server/assets/{_name-D_-MhjNf.js → _name-BzD9TxVC.js} +17 -17
  126. package/app/dist/server/assets/{_name-BqFwnyf7.js → _name-ClgMsl5m.js} +2 -2
  127. package/app/dist/server/assets/{_name-BGagGBjX.js → _name-DdFVsjcj.js} +7 -7
  128. package/app/dist/server/assets/{_name-DntbHE-b.js → _name-Dyh4G9Oy.js} +10 -11
  129. package/app/dist/server/assets/{_tanstack-start-manifest_v-BljuBM-G.js → _tanstack-start-manifest_v-DUtnBg7y.js} +101 -91
  130. package/app/dist/server/assets/{_vendor-CNB03LWX.js → _vendor-DyeUY8kH.js} +8 -8
  131. package/app/dist/server/assets/{_vendor-CcEviOki.js → _vendor-W3KKSusM.js} +2 -2
  132. package/app/dist/server/assets/{actor-D6iA0pDg.js → actor-BlaOwG6A.js} +1 -1
  133. package/app/dist/server/assets/app-chrome-BJlxsc9y.js +2116 -0
  134. package/app/dist/server/assets/{app-scope-CXIgOFmi.js → app-scope-ASuhE3xI.js} +2 -2
  135. package/app/dist/server/assets/{apply-plan-ybBda6vQ.js → apply-plan-Djw1tNPD.js} +8 -7
  136. package/app/dist/server/assets/{approval-Su315ikC.js → approval-BjTnfr1U.js} +15 -13
  137. package/app/dist/server/assets/{apps-xwQAehch.js → apps-C28F9Y5C.js} +7 -7
  138. package/app/dist/server/assets/button-Xwx3rpQ0.js +43 -0
  139. package/app/dist/server/assets/change-glance-Bc4htVPy.js +54 -0
  140. package/app/dist/server/assets/{change-glance-CpArIbGS.js → changes-B5P8BJSf.js} +2 -54
  141. package/app/dist/server/assets/{changes-Bc_OiDBD.js → changes-tbeMKxjY.js} +8 -7
  142. package/app/dist/server/assets/{chat-DMN_hoKm.js → chat-BNMeLc9V.js} +108 -30
  143. package/app/dist/server/assets/{chat-button-LtA80MoR.js → chat-button-SluTWK8R.js} +2 -2
  144. package/app/dist/server/assets/{code-COyt8L-n.js → code-hVpCkmAZ.js} +1 -1
  145. package/app/dist/server/assets/{common-CWHLj7KV.js → common-DpZcJvCy.js} +26 -24
  146. package/app/dist/server/assets/{connect-BpPiu5s6.js → connect-Cljunav2.js} +11 -10
  147. package/app/dist/server/assets/{connections-DBgb1bvX.js → connections-Cfz5LMy5.js} +12 -11
  148. package/app/dist/server/assets/{connectors-5a5_SlHO.js → connectors-tt9BF9L1.js} +8 -8
  149. package/app/dist/server/assets/{credentials-ud_Y68hx.js → credentials-CYUFAVU8.js} +10 -9
  150. package/app/dist/server/assets/{data-aEdhwcqy.js → data-D91ZZ5St.js} +7 -7
  151. package/app/dist/server/assets/{declaration-form-Dfg1yNuY.js → declaration-form-BzISD6gw.js} +7 -6
  152. package/app/dist/server/assets/{dialog-BGjiw3Dx.js → dialog-T0bzlKzs.js} +2 -2
  153. package/app/dist/server/assets/{dropdown-menu-DAC3LWas.js → dropdown-menu-RGvPORm4.js} +1 -1
  154. package/app/dist/server/assets/{existing-B4d4NrC8.js → existing-BZym0xE2.js} +8 -7
  155. package/app/dist/server/assets/fence-Br7MPP41.js +130 -0
  156. package/app/dist/server/assets/{field-C0Xx_90s.js → field-DFpkT1id.js} +1 -1
  157. package/app/dist/server/assets/{functions-BvFYzabD.js → functions-sf07C1qn.js} +2 -2
  158. package/app/dist/server/assets/{graph-qYOdoz2s.js → graph-C1Cl7owl.js} +5 -5
  159. package/app/dist/server/assets/{grid-diff-jTvp-8wS.js → grid-diff-D5bQDKl2.js} +1 -1
  160. package/app/dist/server/assets/held-card-CDewk4rs.js +75 -0
  161. package/app/dist/server/assets/{hosting-bbn9UvDc.js → hosting-O-l2L0ec.js} +16 -14
  162. package/app/dist/server/assets/{import-DIwvzHb6.js → import-qvpEIYFx.js} +8 -8
  163. package/app/dist/server/assets/{inbox-D6R6sWBB.js → inbox-BcJxCIPm.js} +8 -8
  164. package/app/dist/server/assets/{inbox-Dj-5FleF.js → inbox-BvpSeC3M.js} +2 -2
  165. package/app/dist/server/assets/{input-D63gF3G2.js → input-CF-vX8Xp.js} +1 -1
  166. package/app/dist/server/assets/{item-BDSXoEr_.js → item-LBDNja5f.js} +1 -1
  167. package/app/dist/server/assets/{kit-D6EulwBe.js → kit-DlT_THim.js} +2 -2
  168. package/app/dist/server/assets/markdown-BExKjghi.js +116 -0
  169. package/app/dist/server/assets/{middleware-B8JRLyxx.js → middleware-B6RPW0fH.js} +1 -1
  170. package/app/dist/server/assets/{people-CkU_AxrV.js → people-C8VXQrKg.js} +13 -12
  171. package/app/dist/server/assets/{permissions-BfMcQqQb.js → permissions-COAiOoCB.js} +9 -8
  172. package/app/dist/server/assets/{permissions-grid-DWP9FAAS.js → permissions-grid-CcYUiqhD.js} +4 -4
  173. package/app/dist/server/assets/{button-f9Lc8qLl.js → queries-DJcZ4mzA.js} +3 -45
  174. package/app/dist/server/assets/{route-BTT7nMJq.js → route-DOqitvxL.js} +2 -2
  175. package/app/dist/server/assets/{route-CF_8jQYY.js → route-aa9MThMA.js} +2 -2
  176. package/app/dist/server/assets/{router-BvYtxrVN.js → router-Co6gRNI1.js} +80 -46
  177. package/app/dist/server/assets/{runs-table-BBudn12Y.js → runs-table-BtGm2KOO.js} +6 -6
  178. package/app/dist/server/assets/{scenario-BXGTSTiP.js → scenario-DidUafqw.js} +5 -5
  179. package/app/dist/server/assets/{separator-8MZ7vR3f.js → separator-Cf98V8ie.js} +1 -1
  180. package/app/dist/server/assets/{sheet-5Cyp-4UW.js → sheet-DTOG7OHQ.js} +2 -2
  181. package/app/dist/server/assets/{sites.index-1l0BtgVf.js → sites.index-4TK8c0QC.js} +4 -4
  182. package/app/dist/server/assets/{spinner-C1ZW08lp.js → spinner-016IPVi-.js} +1 -1
  183. package/app/dist/server/assets/{start-CSU4irVK.js → start-VfVsXenI.js} +2 -2
  184. package/app/dist/server/assets/{start-form-DI60UOrc.js → start-form-CUeEdeP7.js} +10 -9
  185. package/app/dist/server/assets/{table-DtPk_h_5.js → table-y-dGlLx6.js} +1 -1
  186. package/app/dist/server/assets/{textarea-f0Ip5ed1.js → textarea-B02joDnr.js} +1 -1
  187. package/app/dist/server/assets/utils-CHesvfjo.js +138 -0
  188. package/app/dist/server/assets/{who-are-you-ZGyMnpVi.js → who-are-you-DW5qmIzp.js} +8 -7
  189. package/app/dist/server/assets/{workflow-Z99QWO42.js → workflow-BRu7ljgU.js} +5 -5
  190. package/app/dist/server/assets/{workflow-view-C8X8U11S.js → workflow-view-yF48p1lu.js} +14 -13
  191. package/app/dist/server/assets/{workflows-C0kJoGf1.js → workflows-DL-TJFLt.js} +13 -14
  192. package/app/dist/server/chat.d.ts +6 -1
  193. package/app/dist/server/chat.js +39 -20
  194. package/app/dist/server/chat.js.map +1 -1
  195. package/app/dist/server/server.js +48 -48
  196. package/app/dist/steps/agent/acp.d.ts +3 -97
  197. package/app/dist/steps/agent/acp.js +19 -49
  198. package/app/dist/steps/agent/acp.js.map +1 -1
  199. package/app/dist/steps/agent/checkout.d.ts +18 -1
  200. package/app/dist/steps/agent/checkout.js +17 -0
  201. package/app/dist/steps/agent/checkout.js.map +1 -1
  202. package/app/dist/steps/agent/harness.d.ts +2 -4
  203. package/app/dist/steps/agent/harness.js +45 -61
  204. package/app/dist/steps/agent/harness.js.map +1 -1
  205. package/app/dist/steps/agent/prompt.d.ts +1 -1
  206. package/app/dist/steps/agent/prompt.js +35 -14
  207. package/app/dist/steps/agent/prompt.js.map +1 -1
  208. package/app/dist/steps/agent/transcript.d.ts +10 -1
  209. package/app/dist/steps/agent/transcript.js +75 -2
  210. package/app/dist/steps/agent/transcript.js.map +1 -1
  211. package/app/dist/steps/agent/turn.d.ts +4 -6
  212. package/app/dist/steps/agent/turn.js +14 -16
  213. package/app/dist/steps/agent/turn.js.map +1 -1
  214. package/app/dist/stylesheet.json +1 -1
  215. package/app/src/api.ts +1 -1
  216. package/app/src/components/app-chrome.tsx +28 -13
  217. package/app/src/components/common.tsx +1 -24
  218. package/app/src/components/logo.tsx +25 -0
  219. package/app/src/components/shell/chat-parts.tsx +185 -126
  220. package/app/src/components/shell/chat-prompt.ts +6 -2
  221. package/app/src/components/shell/chat.tsx +154 -220
  222. package/app/src/components/shell/composer.tsx +140 -0
  223. package/app/src/components/shell/connect-agent.tsx +157 -0
  224. package/app/src/components/shell/engine-mark.tsx +9 -0
  225. package/app/src/components/shell/fence.tsx +25 -0
  226. package/app/src/components/shell/held-card.tsx +58 -0
  227. package/app/src/components/shell/markdown.tsx +152 -0
  228. package/app/src/components/shell/nav-user.tsx +11 -1
  229. package/app/src/components/shell/prefs.ts +9 -1
  230. package/app/src/components/shell/thread.tsx +174 -0
  231. package/app/src/components/ui/bubble.tsx +117 -0
  232. package/app/src/components/ui/code-block.tsx +235 -0
  233. package/app/src/components/ui/input-group.tsx +136 -0
  234. package/app/src/components/ui/marker.tsx +67 -0
  235. package/app/src/components/ui/message-scroller.tsx +117 -0
  236. package/app/src/components/ui/message.tsx +74 -0
  237. package/app/src/components/ui/trace.tsx +133 -0
  238. package/app/src/hooks/use-highlighted-code.ts +72 -0
  239. package/app/src/index.ts +4 -4
  240. package/app/src/lib/chat.ts +110 -22
  241. package/app/src/lib/cn-tables.ts +23 -23
  242. package/app/src/lib/highlighter.tsx +114 -0
  243. package/app/src/routes/__root.tsx +7 -4
  244. package/app/src/routes/connectors/index.tsx +1 -1
  245. package/app/src/routes/hosting/index.tsx +6 -9
  246. package/app/src/server/chat.ts +41 -19
  247. package/app/src/steps/agent/acp.ts +10 -80
  248. package/app/src/steps/agent/checkout.ts +30 -0
  249. package/app/src/steps/agent/harness.ts +53 -78
  250. package/app/src/steps/agent/prompt.ts +42 -14
  251. package/app/src/steps/agent/transcript.ts +90 -3
  252. package/app/src/steps/agent/turn.ts +18 -16
  253. package/app/src/worker/app.ts +6 -5
  254. package/dist/cli.js +18 -6
  255. package/dist/cli.js.map +1 -1
  256. package/dist/serve.js +1 -1
  257. package/dist/serve.js.map +1 -1
  258. package/dist/worker-port.d.ts +16 -2
  259. package/dist/worker-port.js +44 -5
  260. package/dist/worker-port.js.map +1 -1
  261. package/package.json +7 -3
  262. package/testing/README.md +3 -3
  263. package/testing/dist/build.d.ts +3 -3
  264. package/testing/dist/build.js +4 -4
  265. package/testing/dist/build.js.map +1 -1
  266. package/testing/dist/host.d.ts +34 -21
  267. package/testing/dist/host.js +135 -75
  268. package/testing/dist/host.js.map +1 -1
  269. package/workflows/CLOUD-IDENTITY.md +15 -20
  270. package/workflows/README.md +9 -7
  271. package/workflows/dist/client.d.ts +5 -3
  272. package/workflows/dist/client.js +4 -3
  273. package/workflows/dist/client.js.map +1 -1
  274. package/workflows/dist/cloud-identity.d.ts +5 -2
  275. package/workflows/dist/cloud-identity.js +7 -4
  276. package/workflows/dist/cloud-identity.js.map +1 -1
  277. package/workflows/dist/config.d.ts +7 -1
  278. package/workflows/dist/config.js +24 -1
  279. package/workflows/dist/config.js.map +1 -1
  280. package/workflows/dist/db/company.d.ts +1 -1
  281. package/workflows/dist/db/company.js +1 -1
  282. package/workflows/dist/db/identity.d.ts +2 -2
  283. package/workflows/dist/db/identity.js +2 -2
  284. package/workflows/dist/db/identity.js.map +1 -1
  285. package/workflows/dist/deadlines.d.ts +7 -2
  286. package/workflows/dist/deadlines.js +14 -5
  287. package/workflows/dist/deadlines.js.map +1 -1
  288. package/workflows/dist/describe.js +15 -3
  289. package/workflows/dist/describe.js.map +1 -1
  290. package/workflows/dist/description.d.ts +37 -2
  291. package/workflows/dist/description.js +22 -1
  292. package/workflows/dist/description.js.map +1 -1
  293. package/workflows/dist/host.d.ts +7 -6
  294. package/workflows/dist/host.js +1 -1
  295. package/workflows/dist/host.js.map +1 -1
  296. package/workflows/dist/identity-provisioning.d.ts +2 -5
  297. package/workflows/dist/identity-provisioning.js +16 -20
  298. package/workflows/dist/identity-provisioning.js.map +1 -1
  299. package/workflows/dist/index.d.ts +3 -3
  300. package/workflows/dist/index.js +1 -1
  301. package/workflows/dist/index.js.map +1 -1
  302. package/workflows/dist/op.d.ts +92 -1
  303. package/workflows/dist/op.js +19 -6
  304. package/workflows/dist/op.js.map +1 -1
  305. package/workflows/dist/renewal.d.ts +1 -1
  306. package/workflows/dist/renewal.js +1 -1
  307. package/workflows/dist/runtime-ops.d.ts +3 -4
  308. package/workflows/dist/runtime-ops.js +4 -4
  309. package/workflows/dist/runtime-ops.js.map +1 -1
  310. package/workflows/dist/schedules.d.ts +1 -1
  311. package/workflows/dist/schedules.js +1 -1
  312. package/workflows/dist/supervisor.d.ts +21 -18
  313. package/workflows/dist/supervisor.js +20 -22
  314. package/workflows/dist/supervisor.js.map +1 -1
  315. package/workflows/dist/vendor-info.d.ts +12 -3
  316. package/workflows/dist/vendor-info.js +20 -4
  317. package/workflows/dist/vendor-info.js.map +1 -1
  318. package/workflows/dist/worker.d.ts +11 -1
  319. package/workflows/dist/worker.js +9 -3
  320. package/workflows/dist/worker.js.map +1 -1
  321. package/workflows/src/client.ts +9 -6
  322. package/workflows/src/cloud-identity.ts +7 -4
  323. package/workflows/src/config.ts +36 -1
  324. package/workflows/src/db/company.ts +1 -1
  325. package/workflows/src/db/identity.ts +2 -2
  326. package/workflows/src/deadlines.ts +18 -8
  327. package/workflows/src/describe.ts +16 -3
  328. package/workflows/src/description.ts +25 -1
  329. package/workflows/src/host.ts +7 -6
  330. package/workflows/src/identity-provisioning.ts +19 -30
  331. package/workflows/src/index.ts +7 -1
  332. package/workflows/src/op.ts +104 -10
  333. package/workflows/src/renewal.ts +1 -1
  334. package/workflows/src/runtime-ops.ts +5 -5
  335. package/workflows/src/schedules.ts +1 -1
  336. package/workflows/src/supervisor.ts +40 -38
  337. package/workflows/src/vendor-info.ts +20 -5
  338. package/workflows/src/worker.ts +22 -5
  339. package/app/dist/client/assets/ArrowUp.es-DOgvoS0P.js +0 -1
  340. package/app/dist/client/assets/Copy.es-B0D5SwiQ.js +0 -1
  341. package/app/dist/client/assets/DialogTitle-BgjYK22C.js +0 -1
  342. package/app/dist/client/assets/FloppyDisk.es-DnuNe_a8.js +0 -1
  343. package/app/dist/client/assets/Globe.es-B6x2e4-a.js +0 -1
  344. package/app/dist/client/assets/MagnifyingGlass.es-DoNoHEhT.js +0 -1
  345. package/app/dist/client/assets/Play.es-BwXalGBh.js +0 -1
  346. package/app/dist/client/assets/Plug.es-CaZsN5P-.js +0 -1
  347. package/app/dist/client/assets/Plus.es-w9VPpTJB.js +0 -1
  348. package/app/dist/client/assets/Separator-BAhKFgSd.js +0 -1
  349. package/app/dist/client/assets/X.es-DKMYClf-.js +0 -1
  350. package/app/dist/client/assets/_id-BSRAaWtO.js +0 -1
  351. package/app/dist/client/assets/_id-BjDP-cPH.js +0 -1
  352. package/app/dist/client/assets/_id-BudM76zX.js +0 -1
  353. package/app/dist/client/assets/_id-C37U5bBa.js +0 -1
  354. package/app/dist/client/assets/_id-lmg24JVh.js +0 -2
  355. package/app/dist/client/assets/_name-CylqFo_t.js +0 -1
  356. package/app/dist/client/assets/_name-D8Gl8iwy.js +0 -4
  357. package/app/dist/client/assets/_name-DdPCU8pt.js +0 -1
  358. package/app/dist/client/assets/_name-TteWQXe0.js +0 -1
  359. package/app/dist/client/assets/_vendor-BLxW83yk.js +0 -1
  360. package/app/dist/client/assets/_vendor-Bq3uZU4-.js +0 -1
  361. package/app/dist/client/assets/app-chrome-H8uZ4dHI.js +0 -16
  362. package/app/dist/client/assets/app-scope-BeUW_8Qh.js +0 -1
  363. package/app/dist/client/assets/approval-DpgmTc63.js +0 -1
  364. package/app/dist/client/assets/apps-CoWzNm8M.js +0 -1
  365. package/app/dist/client/assets/change-glance-DbYcBT7H.js +0 -1
  366. package/app/dist/client/assets/changes-DIJvP7wQ.js +0 -1
  367. package/app/dist/client/assets/chat-button-BgpOfYh1.js +0 -1
  368. package/app/dist/client/assets/chat-prompt-hiawXcK0.js +0 -1
  369. package/app/dist/client/assets/common-Dw2i6XKZ.js +0 -3
  370. package/app/dist/client/assets/composite-D9GNDzFj.js +0 -1
  371. package/app/dist/client/assets/connect-CIq2KJTz.js +0 -1
  372. package/app/dist/client/assets/connections-iqd2XbWQ.js +0 -5
  373. package/app/dist/client/assets/connectors-rI8_D1n1.js +0 -1
  374. package/app/dist/client/assets/credentials-26vu6Fv5.js +0 -1
  375. package/app/dist/client/assets/data-sDMlKaLV.js +0 -1
  376. package/app/dist/client/assets/decidable-zcYI7bY8.js +0 -1
  377. package/app/dist/client/assets/declaration-form-BtSVvxhq.js +0 -1
  378. package/app/dist/client/assets/dialog-DskpUgkl.js +0 -1
  379. package/app/dist/client/assets/existing-BD3VgJ_8.js +0 -1
  380. package/app/dist/client/assets/graph-Prxl3c55.js +0 -7
  381. package/app/dist/client/assets/grid-diff-SMsvea6t.js +0 -1
  382. package/app/dist/client/assets/hosting-BBHUppH-.js +0 -1
  383. package/app/dist/client/assets/import-B92fd4Tl.js +0 -1
  384. package/app/dist/client/assets/inbox-57oGZtxE.js +0 -1
  385. package/app/dist/client/assets/inbox-B2AMNtk5.js +0 -1
  386. package/app/dist/client/assets/index-Bn3XeKy8.js +0 -10
  387. package/app/dist/client/assets/kit-BsK6VZTQ.js +0 -1
  388. package/app/dist/client/assets/lazyRouteComponent-Uri98HNq.js +0 -1
  389. package/app/dist/client/assets/motion-C8lNeYvK.js +0 -1
  390. package/app/dist/client/assets/people-ISOMYCTu.js +0 -1
  391. package/app/dist/client/assets/permissions-Cenat84K.js +0 -2
  392. package/app/dist/client/assets/permissions-grid-B2GtGwzv.js +0 -1
  393. package/app/dist/client/assets/route-BP1XwaTB.js +0 -1
  394. package/app/dist/client/assets/route-KVU6QgwJ.js +0 -1
  395. package/app/dist/client/assets/runs-table-35lNzKLn.js +0 -1
  396. package/app/dist/client/assets/scenario-DSwsavxS.js +0 -1
  397. package/app/dist/client/assets/scenario-graph-CAzWOtqV.js +0 -1
  398. package/app/dist/client/assets/separator-BlwkzEY0.js +0 -1
  399. package/app/dist/client/assets/site-icon-DZvOfBvU.js +0 -1
  400. package/app/dist/client/assets/sites.index-CcNo6N8u.js +0 -1
  401. package/app/dist/client/assets/spinner-BGy6LWIW.js +0 -1
  402. package/app/dist/client/assets/start-form-Bgo9I63s.js +0 -1
  403. package/app/dist/client/assets/store-BGu0d2Ld.js +0 -57
  404. package/app/dist/client/assets/style-CCDLLPgG.css +0 -2
  405. package/app/dist/client/assets/table-DjbI5VTn.js +0 -1
  406. package/app/dist/client/assets/textarea-DXO0eUdp.js +0 -1
  407. package/app/dist/client/assets/useOpenInteractionType-Bin8RjM5.js +0 -1
  408. package/app/dist/client/assets/useRegisterFieldControl-CQPTOU7Z.js +0 -1
  409. package/app/dist/client/assets/useValueChanged-DMkuvFZG.js +0 -1
  410. package/app/dist/client/assets/utils-CMsCvwYQ.js +0 -1
  411. package/app/dist/client/assets/who-are-you-Bt1WI3Cz.js +0 -1
  412. package/app/dist/client/assets/workflow-BJpO61A-.js +0 -1
  413. package/app/dist/client/assets/workflow-view-DP-UlRiH.js +0 -1
  414. package/app/dist/client/assets/workflows-BLCBgxbx.js +0 -1
  415. package/app/dist/server/assets/app-chrome-BYS81Vnx.js +0 -1410
  416. package/app/dist/server/assets/native-select-DLa-He0n.js +0 -37
  417. package/app/dist/server/assets/utils-wksS9pYh.js +0 -138
@@ -7,9 +7,9 @@ import { isSecret, type Secret } from "./secret.ts";
7
7
  import type { SecretAccess } from "./secret-store.ts";
8
8
 
9
9
  export type DeploymentIdentity = Omit<IdentityEnrollment, "generation">;
10
+ /** A generation holds until it is retired or its deployment revoked: enrollment sets no expiry. */
10
11
  export interface EnrollIdentity extends IdentityEnrollment {
11
12
  hash: string;
12
- validUntil: string;
13
13
  }
14
14
 
15
15
  /** Provisioning authority only. The serving broker receives the separate read-only interface. */
@@ -25,7 +25,6 @@ export interface IdentityProvisioning {
25
25
  */
26
26
  export interface IdentityProvisioningDatabase {
27
27
  databaseUrl: string | Secret;
28
- maxValidityMs: number;
29
28
  }
30
29
 
31
30
  /** A restricted writer's connection string, TLS verified beyond this machine; refused sanitized. */
@@ -105,7 +104,7 @@ export function configuredIdentityProvisioning(
105
104
  AND NOT has_table_privilege('sanoma_identity.credentials','DELETE,TRUNCATE,REFERENCES,TRIGGER') AS allowed`);
106
105
  if (!rows[0]?.allowed) fail("invalid");
107
106
  return db;
108
- }, config);
107
+ });
109
108
  return {
110
109
  store,
111
110
  close() {
@@ -171,16 +170,11 @@ const deadlineOf = (value: string) => {
171
170
  };
172
171
 
173
172
  /** Caller owns a dedicated writer pool; never give this pool to the broker or company code. */
174
- export function postgresIdentityProvisioning(
175
- database: () => Promise<Db>,
176
- options: { maxValidityMs: number },
177
- ): IdentityProvisioning {
178
- const maximum = options.maxValidityMs;
179
- if (!Number.isSafeInteger(maximum) || maximum <= 0) fail("invalid");
173
+ export function postgresIdentityProvisioning(database: () => Promise<Db>): IdentityProvisioning {
180
174
  async function transaction(
181
175
  input: DeploymentIdentity,
182
176
  create: boolean,
183
- run: (tx: Db, enabled: boolean, now: number) => Promise<void>,
177
+ run: (tx: Db, enabled: boolean) => Promise<void>,
184
178
  ) {
185
179
  checkIdentity(input);
186
180
  try {
@@ -210,26 +204,24 @@ export function postgresIdentityProvisioning(
210
204
  .where(eq(identityDeployments.id, input.deployment))
211
205
  .for("update");
212
206
  if (!row || !sameIdentity(row, input)) fail("conflict");
213
- const clock = await tx.execute<{ now: number }>(
214
- sql`SELECT (extract(epoch FROM clock_timestamp()) * 1000)::float8 AS now`,
215
- );
216
- await run(tx, row.enabled, clock.rows[0]!.now);
207
+ await run(tx, row.enabled);
217
208
  });
218
209
  } catch (error) {
219
210
  const code = identityProvisioningCode(error);
220
211
  if (code) throw new IdentityProvisioningError(code);
221
- if (pgCode(error) === "23505") throw new IdentityProvisioningError("conflict");
212
+ const sqlState = pgCode(error);
213
+ if (sqlState === "23505") throw new IdentityProvisioningError("conflict");
214
+ // Any other constraint violation is the schema refusing the row: permanent, never retried.
215
+ if (sqlState.startsWith("23")) throw new IdentityProvisioningError("invalid");
222
216
  throw new IdentityProvisioningError("unavailable");
223
217
  }
224
218
  }
225
219
  return {
226
220
  async enroll(input) {
227
221
  generationOf(input.generation);
228
- const until = deadlineOf(input.validUntil);
229
222
  if (!/^[0-9a-f]{64}$/.test(input.hash)) fail("invalid");
230
- await transaction(input, true, async (tx, enabled, now) => {
223
+ await transaction(input, true, async (tx, enabled) => {
231
224
  if (!enabled) fail("conflict");
232
- if (until <= now || until - now > maximum) fail("invalid");
233
225
  const rows = await tx
234
226
  .select({
235
227
  generation: identityCredentials.generation,
@@ -243,8 +235,7 @@ export function postgresIdentityProvisioning(
243
235
  const existing = rows.find((r) => r.generation === input.generation);
244
236
  if (existing) {
245
237
  // An exact retry is safe. Never extend a retired generation or revive a revoked one.
246
- if (existing.hash !== input.hash || existing.revoked || existing.validUntil.getTime() !== until)
247
- fail("conflict");
238
+ if (existing.hash !== input.hash || existing.revoked || existing.validUntil) fail("conflict");
248
239
  return;
249
240
  }
250
241
  if (rows[0] && rows[0].generation >= input.generation) fail("conflict");
@@ -252,7 +243,6 @@ export function postgresIdentityProvisioning(
252
243
  hash: input.hash,
253
244
  deployment: input.deployment,
254
245
  generation: input.generation,
255
- validUntil: new Date(until),
256
246
  });
257
247
  });
258
248
  },
@@ -260,7 +250,7 @@ export function postgresIdentityProvisioning(
260
250
  generationOf(input.generation);
261
251
  const until = deadlineOf(input.validUntil);
262
252
  await transaction(input, false, async (tx) => {
263
- // Retirement only shortens access. The predicate protects the schema's finite interval.
253
+ // Retirement only shortens access: LEAST ignores a NULL (no expiry). The predicate keeps the interval nonempty.
264
254
  const deadline = sql`${new Date(until).toISOString()}::timestamptz`;
265
255
  const updated = await tx
266
256
  .update(identityCredentials)
@@ -294,7 +284,7 @@ export function postgresIdentityProvisioning(
294
284
  export function memoryIdentityProvisioning(): IdentityProvisioning {
295
285
  const deployments = new Map<
296
286
  string,
297
- { identity: DeploymentIdentity; enabled: boolean; credentials: Map<number, EnrollIdentity> }
287
+ { identity: DeploymentIdentity; enabled: boolean; credentials: Map<number, { hash: string; retired?: true }> }
298
288
  >();
299
289
  const hashes = new Set<string>();
300
290
  const find = (input: DeploymentIdentity) => {
@@ -307,28 +297,27 @@ export function memoryIdentityProvisioning(): IdentityProvisioning {
307
297
  async enroll(input) {
308
298
  checkIdentity(input);
309
299
  generationOf(input.generation);
310
- if (deadlineOf(input.validUntil) <= Date.now() || !/^[0-9a-f]{64}$/.test(input.hash)) fail("invalid");
300
+ if (!/^[0-9a-f]{64}$/.test(input.hash)) fail("invalid");
311
301
  const found = deployments.get(input.deployment);
312
302
  if (found && (!sameIdentity(found.identity, input) || !found.enabled)) fail("conflict");
313
303
  const current = found?.credentials.get(input.generation);
314
304
  if (current) {
315
- if (current.hash !== input.hash || deadlineOf(current.validUntil) !== deadlineOf(input.validUntil))
316
- fail("conflict");
305
+ if (current.hash !== input.hash || current.retired) fail("conflict");
317
306
  return;
318
307
  }
319
308
  if (hashes.has(input.hash) || (found && [...found.credentials.keys()].some((g) => g >= input.generation)))
320
309
  fail("conflict");
321
- const row = found ?? { identity: { ...input }, enabled: true, credentials: new Map<number, EnrollIdentity>() };
322
- row.credentials.set(input.generation, { ...input });
310
+ const row = found ?? { identity: { ...input }, enabled: true, credentials: new Map() };
311
+ row.credentials.set(input.generation, { hash: input.hash });
323
312
  hashes.add(input.hash);
324
313
  deployments.set(input.deployment, row);
325
314
  },
326
315
  async retire(input) {
327
316
  generationOf(input.generation);
328
- const deadline = deadlineOf(input.validUntil);
317
+ deadlineOf(input.validUntil);
329
318
  const current = find(input).credentials.get(input.generation);
330
319
  if (!current) return fail("conflict");
331
- current.validUntil = new Date(Math.min(deadlineOf(current.validUntil), deadline)).toISOString();
320
+ current.retired = true;
332
321
  },
333
322
  async revoke(input) {
334
323
  find(input).enabled = false;
@@ -1,6 +1,9 @@
1
1
  export {
2
+ type AgentInfo,
3
+ type AgentSignIn,
2
4
  type CallContext,
3
5
  CLIENT_IP_HEADER,
6
+ type CodingAgent,
4
7
  requestOrigin,
5
8
  sameOrigin,
6
9
  type Connector,
@@ -16,6 +19,7 @@ export {
16
19
  isOp,
17
20
  isSvgElement,
18
21
  INVITE_SECONDS,
22
+ type KeyAgent,
19
23
  type LoginContext,
20
24
  type LoginHalf,
21
25
  type LoginIdentity,
@@ -23,6 +27,7 @@ export {
23
27
  type ModelContext,
24
28
  type Op,
25
29
  type OpSpec,
30
+ type OwnAgent,
26
31
  type ResourceGroup,
27
32
  retryableStatus,
28
33
  type SignInMethod,
@@ -69,6 +74,7 @@ export {
69
74
  declaredWakeup,
70
75
  defineConfig,
71
76
  envWakeup,
77
+ type InstalledAgent,
72
78
  joinDeclarations,
73
79
  type Login,
74
80
  readRootSnapshot,
@@ -84,7 +90,7 @@ export { appFolders, APPS_DIR, declarationFiles, filesUnder, kindDirs } from "./
84
90
  // `sanoma` itself (the people types' constructors) is at `sanoma/resources`, for data files.
85
91
  // `collection()` itself is at `sanoma/data`, for `resources/data.ts`; this tells one apart, as the launcher does.
86
92
  export { isCollection } from "./collection.ts";
87
- export { type CredentialStatus, credentialsOf } from "./env.ts";
93
+ export { type CredentialStatus, credentialsOf, statusesOf, unconfigured } from "./env.ts";
88
94
  export {
89
95
  APPLY_WORKFLOW,
90
96
  ApplyInput,
@@ -2,6 +2,7 @@ import type { Pool } from "pg";
2
2
  import type { Principal } from "./define.ts";
3
3
  import type { Authentication, CallAuthentication } from "./authentication.ts";
4
4
  import type { ConnectionSnapshot } from "./connection.ts";
5
+ import type { HarnessV1 } from "@ai-sdk/harness";
5
6
  import type { ProviderV4 } from "@ai-sdk/provider";
6
7
  import type { z } from "zod";
7
8
  import type { Fake } from "./fake.ts";
@@ -147,11 +148,27 @@ export interface VendorInfo {
147
148
  package?: string;
148
149
  /** The connector package's `homepage` from its package.json: where its code and README are, as an https URL. */
149
150
  homepage?: string;
151
+ /** Who its coding agent is, when it attaches one (`ConnectorSetup.agent`). */
152
+ agent?: AgentInfo;
153
+ }
154
+
155
+ /**
156
+ * Who a connector's coding agent is: its `id` (lowercase letters, digits and dashes, neither `loop`
157
+ * nor `acp-…`), which the chat's engines are named by, its name as its maker writes it, and its
158
+ * mark as `VendorInfo.logo` is.
159
+ */
160
+ export interface AgentInfo {
161
+ id: string;
162
+ title: string;
163
+ mark?: { svg: string; dark?: string };
150
164
  }
151
165
 
152
166
  /** One `<svg>` element, with nothing but whitespace around it: what a logo must be. */
153
167
  const SVG_ELEMENT = /^\s*<svg[\s>][\s\S]*<\/svg>\s*$/;
154
168
 
169
+ /** What an agent's id may be (`AgentInfo.id`): not `loop`, our own engine's name, nor `acp-…`, a person's plan's. */
170
+ export const AGENT_ID = /^(?!loop$)(?!acp-)[a-z0-9]+(-[a-z0-9]+)*$/;
171
+
155
172
  /** Whether `svg` is a logo as `VendorInfo` takes it: one `<svg>…</svg>` element. */
156
173
  export const isSvgElement = (svg: unknown): svg is string => typeof svg === "string" && SVG_ELEMENT.test(svg);
157
174
 
@@ -174,17 +191,29 @@ export function defineConnector<const V extends string, const S extends Specs>(
174
191
  specs: S,
175
192
  info?: VendorInfo,
176
193
  ): Connector<V, S> {
177
- // A copy, frozen once checked: changing the caller's object later cannot slip a logo past the check.
178
- const logo =
179
- info?.logo && Object.freeze(Object.fromEntries(Object.entries(info.logo).filter(([, v]) => v !== undefined)));
180
- for (const [variant, svg] of Object.entries(logo ?? {})) {
181
- if (!isSvgElement(svg)) {
182
- throw new Error(
183
- `defineConnector("${vendor}"): logo.${variant} must be inline SVG markup, one <svg>…</svg> element`,
184
- );
194
+ // Copies, frozen once checked: changing the caller's object later cannot slip a logo past the check.
195
+ const svgs = (what: string, given: VendorInfo["logo"]) => {
196
+ if (!given) return undefined;
197
+ const kept = Object.freeze(Object.fromEntries(Object.entries(given).filter(([, v]) => v !== undefined)));
198
+ for (const [variant, svg] of Object.entries(kept)) {
199
+ if (!isSvgElement(svg)) {
200
+ throw new Error(
201
+ `defineConnector("${vendor}"): ${what}.${variant} must be inline SVG markup, one <svg>…</svg> element`,
202
+ );
203
+ }
185
204
  }
205
+ return kept as VendorInfo["logo"];
206
+ };
207
+ const logo = svgs("logo", info?.logo);
208
+ const agent = info?.agent && { ...info.agent, ...(info.agent.mark && { mark: svgs("agent.mark", info.agent.mark) }) };
209
+ // The chat's engines are named by it: `acp-<id>`, `<id>`.
210
+ if (agent && !AGENT_ID.test(agent.id)) {
211
+ throw new Error(
212
+ `defineConnector("${vendor}"): agent.id must be lowercase letters, digits and dashes, neither loop nor acp-…`,
213
+ );
186
214
  }
187
- const vendorInfo = info && Object.freeze({ ...info, ...(logo && { logo: logo as VendorInfo["logo"] }) });
215
+ const vendorInfo =
216
+ info && Object.freeze({ ...info, ...(logo && { logo }), ...(agent && { agent: Object.freeze(agent) }) });
188
217
  // It becomes a link's href: a whole https URL, so never a `javascript:` one. Checked on the copy kept.
189
218
  const homepage: unknown = vendorInfo?.homepage;
190
219
  if (homepage !== undefined && (typeof homepage !== "string" || URL.parse(homepage)?.protocol !== "https:"))
@@ -327,7 +356,8 @@ export interface Driver {
327
356
  * login. Any may be missing: a workflow using an operation of a connector with no driver is
328
357
  * refused, a connector with no fake has none for sandbox runs, one with no login half signs no
329
358
  * visitor in, one with no model half gives the app no models, one with no remote half hosts
330
- * no repository a change is reviewed on, and one with no sandbox half opens no box.
359
+ * no repository a change is reviewed on, one with no sandbox half opens no box, and one with no
360
+ * agent gives the chat no coding agent.
331
361
  */
332
362
  export interface ConnectorSetup {
333
363
  /** Auth methods available to named connections; login identity is separate. */
@@ -370,6 +400,70 @@ export interface ConnectorSetup {
370
400
  * resource's fields from `context.declared`.
371
401
  */
372
402
  sandbox?: (context: SandboxContext) => SandboxBackend | Promise<SandboxBackend>;
403
+ /**
404
+ * The connector's coding agent, which the app's chat can run: how a person's own plan runs it
405
+ * and, where it can, how it runs on the company's key. Who it is (its id, title and mark) is
406
+ * its package.json's, as the vendor's is (`VendorInfo.agent`), which a connector with this part
407
+ * must say.
408
+ */
409
+ agent?: CodingAgent;
410
+ }
411
+
412
+ /**
413
+ * A connector's coding agent (`ConnectorSetup.agent`): on a person's own plan (`own`), on the
414
+ * company's key (`onKey`), or both. The app's chat names it `acp-<id>` on the person's plan and
415
+ * `<id>` on the company's key, `id` being `VendorInfo.agent`'s.
416
+ */
417
+ export interface CodingAgent {
418
+ own?: OwnAgent;
419
+ onKey?: KeyAgent;
420
+ }
421
+
422
+ /**
423
+ * A coding agent on a person's own plan, by its Agent Client Protocol (ACP) entry: installed on
424
+ * first use in the person's box, without install scripts, signed in by the person.
425
+ */
426
+ export interface OwnAgent {
427
+ /** What is installed for it, each at the version it was tried with. */
428
+ packages: readonly string[];
429
+ /** The install's script to run once installed, relative to the install: the vendor's own `postinstall`, which the install skips. */
430
+ setup?: string;
431
+ /** Its ACP entry: a bin of the install (`node_modules/.bin`), and its arguments. */
432
+ bin: string;
433
+ args: readonly string[];
434
+ signIn: AgentSignIn;
435
+ }
436
+
437
+ /** How a person signs in to their own coding agent from the chat (`OwnAgent.signIn`). */
438
+ export type AgentSignIn =
439
+ /** Its own bin with these arguments, run with piped stdio, what it prints relayed into the chat's card. */
440
+ | { run: readonly string[] }
441
+ /** The agent's terminal sign-in method of this id (ACP's `authMethods`, `type: "terminal"`): its own bin with the method's arguments, run as `run` is. */
442
+ | { method: string }
443
+ /** ACP's `authenticate` with this method: the agent sends the vendor's link and code as a URL elicitation. */
444
+ | { authenticate: string }
445
+ /** No sign-in through the chat (the vendor's needs a real terminal): the person runs this bin of the install once on this computer. */
446
+ | { once: { bin: string; args: readonly string[]; after?: string } };
447
+
448
+ /**
449
+ * A coding agent on the company's key, through the AI SDK's `HarnessAgent`. The model it runs on
450
+ * is another connector's, named by its vendor (`model`) and never imported: the app passes that
451
+ * connector's key, the variables its driver declares, as the adapter's `auth`.
452
+ */
453
+ export interface KeyAgent {
454
+ /** The vendor of the model connector whose `<vendor>/default` and key it runs on, such as `anthropic`. */
455
+ model: string;
456
+ /** The variable naming that model's API endpoint, passed on from the app's environment when it sets one (a stand-in's, in tests). */
457
+ baseUrl?: string;
458
+ /** Whether it takes the model as `<vendor>/<model-id>` (Pi), or the bare id (a bridge's). */
459
+ qualified: boolean;
460
+ /** Whether it runs through a bridge, a child of the session: its first start in a box installs it under the box's home. */
461
+ bridge: boolean;
462
+ /**
463
+ * Its adapter, loaded when first used, on the key as an explicit `auth` record (never the app's
464
+ * environment or keychain), keeping its own state under `home`, the session's home.
465
+ */
466
+ harness(auth: Readonly<Record<string, string>>, home: string): Promise<HarnessV1>;
373
467
  }
374
468
 
375
469
  /** What the app gives a connector's model half (`ConnectorSetup.model`): the secrets, as a login half reads them. */
@@ -229,7 +229,7 @@ export interface RenewWhenDue {
229
229
 
230
230
  /**
231
231
  * The worker's renewals: the earliest due one is a deadline source (`addSource`), so a worker that
232
- * stops when quiet registers it with its wakeup and the next worker renews it; while the worker
232
+ * stops when idle registers it with its wakeup and the next worker renews it; while the worker
233
233
  * runs, an unref'd timer looks again at that time (at least every minute, for a grant another
234
234
  * process stored), renews what is due, counted busy while it does. `close` ends the looks, once
235
235
  * the one under way is done: a refresh token sent is never cut off from its write.
@@ -106,8 +106,8 @@ export const sanoma = defineConnector("sanoma", {
106
106
  effect: "access",
107
107
  idempotent: true,
108
108
  description:
109
- "Enroll a deployment identity, keeping its bootstrap credential in the secret store. A higher generation rotates it; mappings are immutable",
110
- input: DeploymentIdentity.extend({ generation: Generation, validUntil: z.iso.datetime(), store: SecretName }),
109
+ "Enroll a deployment identity, keeping its bootstrap credential in the secret store. It holds until retired or revoked, also beside a higher generation; mappings are immutable",
110
+ input: DeploymentIdentity.extend({ generation: Generation, store: SecretName }),
111
111
  output: z.object({ deployment: z.string(), generation: Generation, store: z.string() }),
112
112
  target: IdentityTarget,
113
113
  createsSecrets: ({ store }: { store: string }) => [store],
@@ -115,8 +115,7 @@ export const sanoma = defineConnector("sanoma", {
115
115
  retire: {
116
116
  effect: "access",
117
117
  idempotent: true,
118
- description:
119
- "Shorten an old identity generation's validity after delivering its replacement; never extend access",
118
+ description: "End an old identity generation at a deadline after delivering its replacement; never extend access",
120
119
  input: DeploymentIdentity.extend({ generation: Generation, validUntil: z.iso.datetime() }),
121
120
  output: z.object({}),
122
121
  target: IdentityTarget,
@@ -124,7 +123,8 @@ export const sanoma = defineConnector("sanoma", {
124
123
  revoke: {
125
124
  effect: "access",
126
125
  idempotent: true,
127
- description: "Disable all token renewal for a deployment. This deployment id cannot be re-enrolled",
126
+ description:
127
+ "Refuse every further token for a deployment, in every generation. This deployment id cannot be re-enrolled",
128
128
  input: DeploymentIdentity,
129
129
  output: z.object({}),
130
130
  target: IdentityTarget,
@@ -207,7 +207,7 @@ export function checkSchedule({ name, trigger }: Pick<WorkflowDefinition, "name"
207
207
 
208
208
  /**
209
209
  * The earliest next fire, strictly after `from`, of the config's scheduled workflows; undefined
210
- * when none is on a schedule: the deadline a schedule sets for a worker that stops when quiet.
210
+ * when none is on a schedule: the deadline a schedule sets for a worker that stops when idle.
211
211
  */
212
212
  export function nextScheduledFire(resolved: Pick<ResolvedConfig, "workflows">, from: Date): Date | undefined {
213
213
  let earliest: Date | undefined;
@@ -2,31 +2,29 @@ import type { SanomaConfig } from "./config.ts";
2
2
  import type { SelfStop } from "./deadlines.ts";
3
3
  import { warn } from "./log.ts";
4
4
  import { errorMessage } from "./shared.ts";
5
- import { startWorker, type Worker, type WorkerOptions } from "./worker.ts";
5
+ import { startWorker, type Worker, type WorkerOptions, type WorkerStop } from "./worker.ts";
6
6
 
7
7
  // One worker at a time in a process that outlives it. A worker that stops itself when idle (a
8
8
  // wakeup declared) cannot launch again, so the next write that needs one, or the wakeup's wake,
9
- // starts a fresh worker. `sanoma serve` runs its worker through it, and so does the testing
10
- // kit's host in this process.
9
+ // starts a fresh worker. `sanoma serve` and `sanoma worker` run their worker through it, and so
10
+ // does the testing kit's host in this process.
11
11
 
12
12
  /** A worker under a supervisor (`superviseWorker`). */
13
13
  export interface Supervisor {
14
- /** True from the moment the worker stopped itself until a fresh one starts. */
14
+ /** True from the moment the worker stopped itself, or a fresh one failed to start, until a fresh one starts. */
15
15
  readonly stopped: boolean;
16
16
  /**
17
- * Starts a fresh worker when the last one stopped itself, for a write that needs one (a run's
18
- * start, an approval's decision); while one starts or runs, it is heard (below). Resolves once it runs, or
19
- * once its failure to start is logged: the next call tries again. Never rejects.
20
- */
21
- resume(): Promise<void>;
22
- /**
23
- * A wakeup's `GET /wake`: `resume` when the worker stopped itself; a no-op while one starts or
24
- * runs. A wake that arrives late, twice or for a replaced registration starts a worker that
25
- * finds nothing to do and stops again on its own check.
17
+ * Asks for a worker that looks at the database after this moment: for a write that needs one
18
+ * (a run's start, an approval's decision, asked once it committed) or a wakeup's `GET /wake`,
19
+ * in whatever order the two come. With the last worker stopped, a fresh one starts. While one
20
+ * starts or runs, it is heard: once that one stops itself (its checks may have run before the
21
+ * write committed), a fresh one starts, whose checks all come after this call, and stops again
22
+ * on its own when nothing came of it. Resolves once a worker runs, or once its failure to start
23
+ * is logged and told (`onEnded`): the next call tries again. Never rejects.
26
24
  */
27
25
  wake(): Promise<void>;
28
- /** Stops the worker running or starting, and starts none again. */
29
- stop(): Promise<void>;
26
+ /** Stops the worker running or starting, and starts none again; `register` as `Worker.stop` takes it. */
27
+ stop(options?: WorkerStop): Promise<void>;
30
28
  }
31
29
 
32
30
  export interface SupervisorOptions extends Omit<WorkerOptions, "onStopped"> {
@@ -35,23 +33,26 @@ export interface SupervisorOptions extends Omit<WorkerOptions, "onStopped"> {
35
33
  * would wake the instance the host runs. Default true.
36
34
  */
37
35
  selfStop?: boolean;
38
- /** Told each time the worker stops itself, once a fresh one is starting for a write it heard, or `stopped` is true. */
36
+ /** Told each time the worker stops itself, once a fresh one is starting for a wake it heard, or `stopped` is true. */
39
37
  onStopped?: (stopped: SelfStop) => void;
38
+ /**
39
+ * Told each time the supervisor is left with no worker and none starting: the worker stopped
40
+ * itself and heard no wake, or a fresh one failed to start (`failure`, why). Not after `stop`.
41
+ */
42
+ onEnded?: (failure?: { error: unknown }) => void;
40
43
  }
41
44
 
42
45
  /**
43
46
  * Starts a worker on `config` that stops itself when idle with a wakeup declared (`onStopped`
44
- * in `WorkerOptions`), and a fresh one each time `resume` or `wake` asks after it did. Throws
45
- * when the first does not start. A write heard while a worker starts or runs may land after its last check
46
- * for being idle, so a worker that stops itself after one is started again at once: it stops
47
- * again on its own when nothing came of it.
47
+ * in `WorkerOptions`), and a fresh one each time `wake` asks after it did, or asked while it ran.
48
+ * Throws when the first does not start.
48
49
  */
49
50
  export async function superviseWorker(config: SanomaConfig, options: SupervisorOptions = {}): Promise<Supervisor> {
50
- const { onStopped, selfStop = true, ...workerOptions } = options;
51
+ const { onStopped, onEnded, selfStop = true, ...workerOptions } = options;
51
52
  let worker: Worker | undefined;
52
53
  let starting: Promise<void> | undefined;
53
54
  let closed = false;
54
- // A write while the worker starts or runs, since it began starting.
55
+ // A wake while the worker starts or runs, since it began starting.
55
56
  let heard = false;
56
57
 
57
58
  const launch = async () => {
@@ -63,38 +64,39 @@ export async function superviseWorker(config: SanomaConfig, options: SupervisorO
63
64
  const selfStopped = (stopped: SelfStop) => {
64
65
  worker = undefined;
65
66
  if (closed) return;
66
- // Resumed first, so `stopped` is false when `onStopped` looks.
67
- if (heard) void supervisor.resume();
67
+ // Read before the wake, whose launch clears it.
68
+ const again = heard;
69
+ // Woken first, so `stopped` is false when `onStopped` looks.
70
+ if (again) void supervisor.wake();
68
71
  onStopped?.(stopped);
72
+ if (!again) onEnded?.();
69
73
  };
70
74
 
71
75
  const supervisor: Supervisor = {
72
76
  get stopped() {
73
77
  return !closed && !worker && !starting;
74
78
  },
75
- resume() {
79
+ wake() {
76
80
  if (closed) return Promise.resolve();
77
- if (worker) {
78
- heard = true;
79
- return Promise.resolve();
80
- }
81
- if (starting) {
81
+ if (worker || starting) {
82
82
  heard = true;
83
- return starting;
83
+ return starting ?? Promise.resolve();
84
84
  }
85
- return (starting = launch()
86
- .catch((err: unknown) => warn(`the worker could not start again: ${errorMessage(err)}`))
87
- .finally(() => {
85
+ return (starting = launch().then(
86
+ () => void (starting = undefined),
87
+ (error: unknown) => {
88
88
  starting = undefined;
89
- }));
89
+ warn(`the worker could not start again: ${errorMessage(error)}`);
90
+ if (!closed) onEnded?.({ error });
91
+ },
92
+ ));
90
93
  },
91
- wake: () => (supervisor.stopped ? supervisor.resume() : Promise.resolve()),
92
- async stop() {
94
+ async stop(how) {
93
95
  closed = true;
94
96
  await starting;
95
97
  const running = worker;
96
98
  worker = undefined;
97
- await running?.stop();
99
+ await running?.stop(how);
98
100
  },
99
101
  };
100
102
  await launch();
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { z } from "zod";
5
- import type { VendorInfo } from "./op.ts";
5
+ import { AGENT_ID, type VendorInfo } from "./op.ts";
6
6
  import { upFrom } from "./paths.ts";
7
7
 
8
8
  /** A logo file's path in the package: relative, never out of it (`..`), an SVG. */
@@ -10,18 +10,29 @@ const LogoFile = z.string().regex(/^(?!\/)(?!.*\.\.)[\w./-]+\.svg$/, "a relative
10
10
 
11
11
  /**
12
12
  * The `sanoma` field of a connector's package.json: the vendor's name and its logo files, beside
13
- * package.json. The app reads the same field from npm to list connectors not installed.
13
+ * package.json, and its coding agent's id, name and mark files (the logo's when it gives none) when
14
+ * it has one. The app reads the same field from npm to list connectors not installed.
14
15
  */
15
16
  export const SanomaPackageField = z.object({
16
17
  title: z.string().min(1),
17
18
  logo: LogoFile.optional(),
18
19
  logoDark: LogoFile.optional(),
20
+ agent: z
21
+ .object({
22
+ id: z.string().regex(AGENT_ID, "lowercase letters, digits and dashes, neither loop nor acp-…"),
23
+ title: z.string().min(1),
24
+ mark: LogoFile.optional(),
25
+ markDark: LogoFile.optional(),
26
+ })
27
+ .optional(),
19
28
  });
20
29
 
21
30
  /**
22
31
  * A connector's `VendorInfo`, read from its own package.json, the one place it is written: the
23
32
  * package's `name` and `homepage`, and the `sanoma` field's `title` and logo files, such as
24
- * `"sanoma": { "title": "Ghost", "logo": "logo.svg", "logoDark": "logo-dark.svg" }`. The app
33
+ * `"sanoma": { "title": "Ghost", "logo": "logo.svg", "logoDark": "logo-dark.svg" }`, with
34
+ * `"agent": { "id", "title", "mark", "markDark" }` for a connector with a coding agent, whose
35
+ * mark is the logo when it names none. The app
25
36
  * lists connectors not installed from the same field on npm. `moduleUrl` is any module of the
26
37
  * package, whose nearest package.json is read: `vendorInfo(import.meta.url)`.
27
38
  */
@@ -36,7 +47,7 @@ export function vendorInfo(moduleUrl: string | URL): VendorInfo {
36
47
  `${pkg.name}: package.json needs a "sanoma" field with a title, and logos as .svg paths in the package: ${z.prettifyError(field.error)}`,
37
48
  );
38
49
  }
39
- const { title, logo, logoDark } = field.data;
50
+ const { title, logo, logoDark, agent } = field.data;
40
51
  const svg = (path: string) => {
41
52
  try {
42
53
  return read(path);
@@ -44,10 +55,14 @@ export function vendorInfo(moduleUrl: string | URL): VendorInfo {
44
55
  throw new Error(`${pkg.name}: the "sanoma" field's logo ${path} is not in the package`);
45
56
  }
46
57
  };
58
+ const svgs = (light: string, dark?: string) => ({ svg: svg(light), ...(dark && { dark: svg(dark) }) });
59
+ const logos = logo && svgs(logo, logoDark);
60
+ const mark = agent?.mark ? svgs(agent.mark, agent.markDark) : logos;
47
61
  return {
48
62
  title,
49
- ...(logo && { logo: { svg: svg(logo), ...(logoDark && { dark: svg(logoDark) }) } }),
63
+ ...(logos && { logo: logos }),
50
64
  package: pkg.name,
51
65
  ...(pkg.homepage && { homepage: pkg.homepage }),
66
+ ...(agent && { agent: { id: agent.id, title: agent.title, ...(mark && { mark }) } }),
52
67
  };
53
68
  }
@@ -67,7 +67,18 @@ export interface Worker {
67
67
  */
68
68
  idle(): Promise<boolean>;
69
69
  /** Stops the worker; a second call waits for the first. */
70
- stop(): Promise<void>;
70
+ stop(options?: WorkerStop): Promise<void>;
71
+ }
72
+
73
+ /** How `Worker.stop` stops. */
74
+ export interface WorkerStop {
75
+ /**
76
+ * For a stop that is not the worker's own (a signal from the host): first registers with its
77
+ * wakeup what the next worker must do, as its own stop would (`StopRule.handOff`), so a run it
78
+ * cut short or a deadline it held is not left until something else wakes the instance. A
79
+ * worker that stops itself never registers this way, nor one that registers with no wakeup.
80
+ */
81
+ register?: boolean;
71
82
  }
72
83
 
73
84
  /**
@@ -165,7 +176,7 @@ export async function startWorker(config: SanomaConfig, options: WorkerOptions =
165
176
  const ledger = ownedLedger(resolved);
166
177
  const secrets = lazyDb(resolved.databaseUrl, "secrets");
167
178
  const storedSecrets = configuredSecrets(resolved.secrets, () => secrets.db());
168
- let stopRule: { close(): void } | undefined;
179
+ let stopRule: ReturnType<typeof stopWhenIdle> | undefined;
169
180
  let renewing: { close(): Promise<void> } | undefined;
170
181
  let stopping: Promise<void> | undefined;
171
182
  const horizonMs = options.idleHorizonMs ?? 60_000;
@@ -244,11 +255,17 @@ export async function startWorker(config: SanomaConfig, options: WorkerOptions =
244
255
  async idle() {
245
256
  return !state.stopped && idle(state.deadlines, resolved, horizonMs);
246
257
  },
247
- stop() {
258
+ stop(how = {}) {
248
259
  // A stop that failed may be tried again.
249
260
  return (stopping ??= (async () => {
250
- state.stopped = true;
251
261
  stopRule?.close();
262
+ // Before anything closes: it asks whether the worker is idle, as a check does.
263
+ if (how.register) {
264
+ await stopRule
265
+ ?.handOff()
266
+ .catch((err: unknown) => warn(`could not register the wakeup before stopping: ${errorMessage(err)}`));
267
+ }
268
+ state.stopped = true;
252
269
  // Each is closed whatever the one before did; the first failure is what stop throws.
253
270
  let failed: { error: unknown } | undefined;
254
271
  for (const close of [
@@ -328,7 +345,7 @@ export async function startWorker(config: SanomaConfig, options: WorkerOptions =
328
345
  // The schedules are the latest version's: an older worker leaves them as the newer set them.
329
346
  if (isLatest && options.schedules !== false) {
330
347
  await applyScheduled(resolved, registered, () => secrets.db());
331
- // A schedule's next tick is a deadline: a worker that stops when quiet registers it with its wakeup.
348
+ // A schedule's next tick is a deadline: a worker that stops when idle registers it with its wakeup.
332
349
  state.deadlines.addSource(() => nextScheduledFire(resolved, new Date()));
333
350
  }
334
351
  // An OAuth grant due for renewal is a deadline, and the renewal agent's call when it comes.