@wular/coder 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/dist/actions-FzDNxMFf.js +20 -0
  2. package/dist/{adapter-BKVzTDnn.js → adapter-7SEiVsmp.js} +1 -1
  3. package/dist/{adapter-B0oYCI0S.js → adapter-BLEfUqoQ.js} +1 -1
  4. package/dist/{adapter-DPInwbJG.js → adapter-H4GlcKQz.js} +1 -1
  5. package/dist/{add-DRsPpQFl.js → add-B50dIJGd.js} +1 -1
  6. package/dist/{add-DkpUwhtO.js → add-D7X3gxap.js} +1 -1
  7. package/dist/{add-C2y-mVzl.js → add-DOEUHIe7.js} +1 -1
  8. package/dist/{add-CLYTF_up.js → add-QExQhTzi.js} +1 -1
  9. package/dist/{add-json-5uPnWPoD.js → add-json-Ck4KIZrT.js} +1 -1
  10. package/dist/{agent-r5mMcehf.js → agent-BPtnEf1q.js} +1 -1
  11. package/dist/{agent-hw3zKw8y.js → agent-BlQ_dNNm.js} +2 -2
  12. package/dist/{alias-_0Rwf2cA.js → alias-BwQBovke.js} +1 -1
  13. package/dist/{app-oE8G1-bi.js → app-y6BYm2eH.js} +1 -1
  14. package/dist/{approvals-DbVrsxec.js → approvals-Cc9cq5T1.js} +2 -2
  15. package/dist/{approve-DeAhFL-m.js → approve-oO9k2fnK.js} +2 -2
  16. package/dist/{apps-eujHiNca.js → apps-CU2YalX8.js} +1 -1
  17. package/dist/{archive-BCUfymIB.js → archive-C5c_HQS1.js} +2 -2
  18. package/dist/{archive-DZ6vpMHb.js → archive-CemlWlVY.js} +2 -2
  19. package/dist/archive-sweep-ehg-fWIt.js +1 -0
  20. package/dist/{args-BOEEdpWk.js → args-DcBCtXhz.js} +1 -1
  21. package/dist/{ask-BU2WVxVM.js → ask-Chu7Twu_.js} +2 -2
  22. package/dist/auth-BOyXPOtu.js +1 -0
  23. package/dist/auth-XbqKSbcD.js +1 -0
  24. package/dist/{chat-bridge-BS9WtP3X.js → chat-bridge-DXgZItGP.js} +1 -1
  25. package/dist/{chat-B_yhNTo0.js → chat-cknlIhVh.js} +1 -1
  26. package/dist/{cli-DWCR7iqa.js → cli-B1ObVrL4.js} +5 -5
  27. package/dist/cli.d.ts +1 -1
  28. package/dist/cli.js +1 -1
  29. package/dist/{client-D9IoAuDD.js → client-31YzOj-i.js} +1 -1
  30. package/dist/{config-12pK4qW7.js → config-DAE_qHYA.js} +1 -1
  31. package/dist/{create-D3f6q0Yq.js → create-CM8B8JxD.js} +1 -1
  32. package/dist/credentials-BXD4Qptk.js +1 -0
  33. package/dist/dash/manifest.json +949 -915
  34. package/dist/dash/public/assets/chunks/{agent-pills-dd0b7643e125bbf1.js → agent-pills-b6a6da91c9559d9f.js} +1 -1
  35. package/dist/dash/public/assets/chunks/{agent-settings-form-45ae6aeaaed2b568.js → agent-settings-form-b615c677046cd6f2.js} +1 -1
  36. package/dist/dash/public/assets/chunks/agents-grid-f2e7b4ff9e11b6e3.js +1 -0
  37. package/dist/dash/public/assets/chunks/{badge-676b01e0c615bf7b.js → badge-215c7b2631dafc69.js} +1 -1
  38. package/dist/dash/public/assets/chunks/{card-e0901d68b79dfa93.js → card-e86dcc81326d2b14.js} +1 -1
  39. package/dist/dash/public/assets/chunks/{combo-952a457d52360d88.js → combo-09e246dc9a517fa8.js} +1 -1
  40. package/dist/dash/public/assets/chunks/composer-417166b029f48c47.js +1 -0
  41. package/dist/dash/public/assets/chunks/composer-645ae8fa97a35280.js +1 -0
  42. package/dist/dash/public/assets/chunks/{confirm-f2fe4ba9905a89c6.js → confirm-5ae484241ad888fd.js} +1 -1
  43. package/dist/dash/public/assets/chunks/{connect-apps-661f3b3a85f1776a.js → connect-apps-4147c45f45fde2b1.js} +1 -1
  44. package/dist/dash/public/assets/chunks/{connect-repositories-5389ec8701a3deac.js → connect-repositories-77591110836bdf03.js} +1 -1
  45. package/dist/dash/public/assets/chunks/credentials-list-e005a0783ec93465.js +2 -0
  46. package/dist/dash/public/assets/chunks/{custom-range-03ba6fb2ade7d282.js → custom-range-463e119af4681c61.js} +1 -1
  47. package/dist/dash/public/assets/chunks/{editor-34cb529d6d8a4b09.js → editor-804b84f4fe6539cd.js} +4 -4
  48. package/dist/dash/public/assets/chunks/{engines-list-2f1acee3ecc8461a.js → engines-list-ceab51f13c690e8c.js} +1 -1
  49. package/dist/dash/public/assets/chunks/{field-901f1f35c18c39c9.js → field-aa0a4b98a976781e.js} +1 -1
  50. package/dist/dash/public/assets/chunks/filter-91144ac2eec6297f.js +1 -0
  51. package/dist/dash/public/assets/chunks/format-105c706345987fb2.js +1 -0
  52. package/dist/dash/public/assets/chunks/heads-a42817b32d2d7f08.js +1 -0
  53. package/dist/dash/public/assets/chunks/{instructions-052fa45a9daf6db6.js → instructions-3a1dcaff2d868aa5.js} +1 -1
  54. package/dist/dash/public/assets/chunks/instructions-6c6f981fffaa31e4.js +1 -0
  55. package/dist/dash/public/assets/chunks/{list-87b359bebd26986a.js → list-7270361464fc3c04.js} +1 -1
  56. package/dist/dash/public/assets/chunks/{mcp-list-b42f0d2ee463b37d.js → mcp-list-2e715d48666b54ad.js} +1 -1
  57. package/dist/dash/public/assets/chunks/{models-list-0669d26fd662aec3.js → models-list-d3c40f94c761a6e5.js} +1 -1
  58. package/dist/dash/public/assets/chunks/paged-3ddb6077bef42752.js +1 -0
  59. package/dist/dash/public/assets/chunks/{platform-actions-c92ca3c6198a9387.js → platform-actions-271ec3b99a64280b.js} +1 -1
  60. package/dist/dash/public/assets/chunks/runners-list-767e49c7d0ec833a.js +1 -0
  61. package/dist/dash/public/assets/chunks/{segmented-358ff2b4992b8384.js → segmented-de4386ccaac7304d.js} +1 -1
  62. package/dist/dash/public/assets/chunks/{select-1013702bdfb1ade4.js → select-a90307706cffa6e0.js} +1 -1
  63. package/dist/dash/public/assets/chunks/{sentinel-c972a33dc69a5135.js → sentinel-b5e032b38604dfd3.js} +1 -1
  64. package/dist/dash/public/assets/chunks/shared-init-7f81ae7bc8c82438.js +2 -0
  65. package/dist/dash/public/assets/chunks/shared-init-933c7f9ee85be766.js +5 -0
  66. package/dist/dash/public/assets/chunks/{tail-7c27aab8ba268bd9.js → tail-4891e727ee526792.js} +1 -1
  67. package/dist/dash/public/assets/chunks/task-actions-ce854925a2dc78fd.js +1 -0
  68. package/dist/dash/public/assets/chunks/task-ddfddeaf07fb684c.js +1 -0
  69. package/dist/dash/public/assets/chunks/task-view-c37dcee08f21a279.js +5 -0
  70. package/dist/dash/public/assets/chunks/tasks-list-baef587999f322d8.js +1 -0
  71. package/dist/dash/public/assets/chunks/{toolbar-f964fa864699f095.js → toolbar-8d98313606ad8a2d.js} +1 -1
  72. package/dist/dash/public/assets/chunks/{versions-list-fc2e0d2a7382e049.js → versions-list-532690efd9f1b0ea.js} +1 -1
  73. package/dist/dash/public/assets/{dash-account-96fc41be318839fa.css → dash-account-edc56e85dbaaabe0.css} +1 -1
  74. package/dist/dash/public/assets/dash-agents-edba57b67e4005d0.css +1 -0
  75. package/dist/dash/public/assets/dash-agents-new-fe22253fbada2fbf.css +1 -0
  76. package/dist/dash/public/assets/dash-agents-param-slug-adf52e9dacb2d825.css +1 -0
  77. package/dist/dash/public/assets/dash-agents-param-slug-edit-a2937a347689ef29.css +1 -0
  78. package/dist/dash/public/assets/dash-agents-param-slug-platforms-265ba13db32a460d.css +1 -0
  79. package/dist/dash/public/assets/dash-agents-param-slug-settings-8afc52eb0372bc4b.css +1 -0
  80. package/dist/dash/public/assets/dash-agents-param-slug-tasks-6193e646be68dbd2.css +1 -0
  81. package/dist/dash/public/assets/dash-agents-param-slug-usage-ceadb3a1c911c402.css +1 -0
  82. package/dist/dash/public/assets/{dash-settings-53b8e6a8f656fa1a.css → dash-settings-cf1997cd7f72e518.css} +1 -1
  83. package/dist/dash/public/assets/dash-settings-param-tab-b44dac8e79a560e6.css +1 -0
  84. package/dist/dash/public/assets/dash-tasks-916c7100a8058aa3.css +1 -0
  85. package/dist/dash/public/assets/dash-tasks-param-id-194a6ffc20e872f2.css +1 -0
  86. package/dist/dash/public/assets/{dash-usage-884943221f76ad93.css → dash-usage-40940b289f85e0b6.css} +1 -1
  87. package/dist/dash/public/assets/pnext-client-13aee92bef5c9e3f.js +1 -0
  88. package/dist/dash/public/assets/pnext-client-1f2686b2044f0df6.js +1 -0
  89. package/dist/dash/public/assets/pnext-client-26130234ebad7067.js +1 -0
  90. package/dist/dash/public/assets/pnext-client-311e35b0076bf406.js +1 -0
  91. package/dist/dash/public/assets/pnext-client-4ade1bf75c9c3d87.js +1 -0
  92. package/dist/dash/public/assets/pnext-client-61cd31b687ede1da.js +1 -0
  93. package/dist/dash/public/assets/{pnext-client-2693db10b197ade1.js → pnext-client-61db65dc4223217a.js} +1 -1
  94. package/dist/dash/public/assets/pnext-client-6ea656e7705e3f2a.js +1 -0
  95. package/dist/dash/public/assets/pnext-client-7fd0f793f0322cb9.js +1 -0
  96. package/dist/dash/public/assets/pnext-client-88159c0840fcfa4a.js +1 -0
  97. package/dist/dash/public/assets/pnext-client-b03f0c47c066b4f3.js +1 -0
  98. package/dist/dash/public/assets/{pnext-client-1afa4148bea69ad2.js → pnext-client-d6478835f543f901.js} +1 -1
  99. package/dist/dash/public/assets/pnext-client-dadb8359021ed590.js +1 -0
  100. package/dist/dash/public/assets/pnext-client-de07532d6aaebf2c.js +1 -0
  101. package/dist/dash/public/assets/pnext-client-f87a31890c8ff224.js +1 -0
  102. package/dist/dash/public/assets/pnext-client-ffe1c123a8e2a350.js +1 -0
  103. package/dist/{default-CwQXCtoB.js → default-BMvUMTFp.js} +1 -1
  104. package/dist/default-B_nKaX0-.js +1 -0
  105. package/dist/{delete-cS01oOIb.js → delete-Bjteibld.js} +2 -2
  106. package/dist/{delete-BD6AnCLg.js → delete-riCIKZwj.js} +2 -2
  107. package/dist/{disable-BMWWeYFQ.js → disable-DQC56YFy.js} +1 -1
  108. package/dist/{discover-Dvr_3_Xr.js → discover-Qanr5TEO.js} +1 -1
  109. package/dist/{discover-Cfx5RPU7.js → discover-lgTYwoQp.js} +2 -2
  110. package/dist/dispatch-BsW_1m7e.js +14 -0
  111. package/dist/{docs-DWegDRiu.js → docs-DFs7lOJp.js} +1 -1
  112. package/dist/{docs-BX65z2Iu.js → docs-DKROso-4.js} +2 -2
  113. package/dist/{enable-Cfzeau2x.js → enable-D2DqZvcU.js} +1 -1
  114. package/dist/{env-CRf6wkM2.js → env-YRY3I60r.js} +1 -1
  115. package/dist/exec-DuUkLMqg.js +11 -0
  116. package/dist/executor-vMppVLB6.js +10 -0
  117. package/dist/flow/builtin/review.js +1 -1
  118. package/dist/flow/index.d.ts +1 -1
  119. package/dist/flow/index.js +1 -1
  120. package/dist/{flow-kAxxVOiR.js → flow-DmERAnR8.js} +1 -1
  121. package/dist/{github-actions-DwUzm4hC.js → github-actions-C_NkHVJq.js} +1 -1
  122. package/dist/http-D01Udu4u.js +1 -0
  123. package/dist/{index-CZjFX5zV.d.ts → index-B1L4zXZH.d.ts} +2 -1
  124. package/dist/{init-C4tDFH4G.js → init-Bd6JHzBc.js} +1 -1
  125. package/dist/integrations-B2CavXR1.js +5 -0
  126. package/dist/integrations-D1Dwy1kt.js +1 -0
  127. package/dist/lib/broker.js +2 -2
  128. package/dist/{list-DuPqU3fk.js → list-4Uo-0v9s.js} +1 -1
  129. package/dist/{list-COAo7eZd.js → list-B0ujEZhd.js} +3 -3
  130. package/dist/{list-5Ljf9TxF.js → list-B5oa1Bhy.js} +2 -2
  131. package/dist/{list-vOvIpbOH.js → list-BjE_l6la.js} +1 -1
  132. package/dist/{list-J8d_zh-o.js → list-Ck9ibCs1.js} +1 -1
  133. package/dist/{list-vpyS-hv8.js → list-DhgK4Zc4.js} +1 -1
  134. package/dist/{list-way5oLO0.js → list-KvL7AUhD.js} +2 -2
  135. package/dist/{list-DzGuMkQy.js → list-byYLBl1U.js} +1 -1
  136. package/dist/{load-BpEsAn51.js → load-SnZd7xG1.js} +1 -1
  137. package/dist/{local-H3uvqEbq.js → local-BRy1EUq2.js} +1 -1
  138. package/dist/log-view-DeJstSkw.js +3 -0
  139. package/dist/{login-BBw95-S3.js → login-C-ahtDKV.js} +1 -1
  140. package/dist/{login-CNmeRAL7.js → login-zpwke8g1.js} +1 -1
  141. package/dist/{logout-j0dTo_Ib.js → logout-CI6Kf-T6.js} +1 -1
  142. package/dist/{maintenance-DkLVtqM7.js → maintenance-BAzr9Jlr.js} +1 -1
  143. package/dist/{match-CXAjDhg7.js → match-DxV1d49D.js} +1 -1
  144. package/dist/{mcp-BgKb2Cdk.js → mcp-CmcL1MCG.js} +1 -1
  145. package/dist/{mcp-CsmBtlW9.js → mcp-mhXwtGQT.js} +1 -1
  146. package/dist/{migrate-N-85_N7J.js → migrate-Czh3TEK5.js} +1 -1
  147. package/dist/{migrate-D4nzYhk8.js → migrate-w7KfzUAR.js} +1 -1
  148. package/dist/{model-B79MFtRV.js → model-JRoTH9QK.js} +1 -1
  149. package/dist/models-C-S7HqSb.js +1 -0
  150. package/dist/{prompt-CEuBMNhk.js → prompt-CMXmt2l9.js} +4 -4
  151. package/dist/{push-DbdnbZYt.js → push-B8BhTyZs.js} +1 -1
  152. package/dist/queue-CirjEskI.js +117 -0
  153. package/dist/refresh-Bmy2r1Ee.js +1 -0
  154. package/dist/{remote-miQNTVRa.js → remote-CxFnEjZl.js} +1 -1
  155. package/dist/{remove-BNzbUhaK.js → remove-C15WLaXT.js} +1 -1
  156. package/dist/{remove-D-QeeZQL.js → remove-CTZYjjSr.js} +1 -1
  157. package/dist/{remove-CLpL12Ya.js → remove-CTl-H0f0.js} +1 -1
  158. package/dist/{remove-CaYH9Cna.js → remove-DX2FVo5b.js} +1 -1
  159. package/dist/rename-D1g4TnHQ.js +1 -0
  160. package/dist/{result-BfTfJayl.js → result-D49VN8PM.js} +3 -3
  161. package/dist/result-DGWyUHYU.js +18 -0
  162. package/dist/{resume-aZ8yWDBh.js → resume-ywzc7z6A.js} +2 -2
  163. package/dist/{review-BEhDcX4b.js → review-ZC0xG8XY.js} +2 -2
  164. package/dist/{rotate-key-BqnKhTK8.js → rotate-key-Bf8_99ck.js} +1 -1
  165. package/dist/{run-BWbabvub.js → run-D7SJ-ieT.js} +2 -2
  166. package/dist/run-DoRQSC_K.js +2 -0
  167. package/dist/{run-BdPjxaZU.js → run-ukCf2Mdy.js} +1 -1
  168. package/dist/runner-D-REfOUe.js +1 -0
  169. package/dist/{runner-sUpWJ_k0.js → runner-wDYhkVsM.js} +1 -1
  170. package/dist/schema-DoNO0dPh.js +1 -0
  171. package/dist/sdk.d.ts +4 -2
  172. package/dist/sdk.js +1 -1
  173. package/dist/serve-BJ_Mbm2m.js +8 -0
  174. package/dist/{serve-C0WC-QrV.js → serve-C1MMhM1F.js} +2 -2
  175. package/dist/{serve-CcObDKKQ.js → serve-DtrOHaoS.js} +2 -2
  176. package/dist/{serve-Ck95047c.js → serve-P9pFkEnE.js} +1 -1
  177. package/dist/{serve-BTeomYxW.js → serve-yjSw0B1a.js} +1 -1
  178. package/dist/{server-BxLFZL80.js → server-DDWTnmbx.js} +1 -1
  179. package/dist/{setup-host-DLd_j2Uw.js → setup-host-L6Rnn5Cz.js} +1 -1
  180. package/dist/{shared-BLkGRKty.js → shared-XsUX_ZZb.js} +1 -1
  181. package/dist/{show-DzoQIs75.js → show-CU-jqJ90.js} +1 -1
  182. package/dist/{show-FC3dJcD-.js → show-DVJmB2u-.js} +1 -1
  183. package/dist/{status-BU3DR1XU.js → status-CBydR7LE.js} +1 -1
  184. package/dist/{steer-P_38hRRD.js → steer-Cm_sHZqs.js} +2 -2
  185. package/dist/{stop-BJGDRPsp.js → stop-DJS7DAPJ.js} +1 -1
  186. package/dist/{stop-BWY6k6v5.js → stop-TrebIIuv.js} +2 -2
  187. package/dist/store-BrNMqJgk.js +42 -0
  188. package/dist/store-j8icrG0v.js +19 -0
  189. package/dist/task-C8lmcNsf.js +1 -0
  190. package/dist/{task-DeglY79z.js → task-CpUI19o2.js} +4 -4
  191. package/dist/task-CvSqiwxo.js +1 -0
  192. package/dist/{test-BrSrhop9.js → test-CDKz4jY_.js} +1 -1
  193. package/dist/{tools-CgswhJzh.js → tools-DBFeoosk.js} +1 -1
  194. package/dist/{types-I5Cwtl_K.d.ts → types-DMGBYB_K.d.ts} +3 -1
  195. package/dist/{unalias-mMHXqok7.js → unalias-BfQFBnuK.js} +1 -1
  196. package/dist/{update-DbOWToPy.js → update-C4FFOie8.js} +1 -1
  197. package/dist/{upgrade-D6oC9HQI.js → upgrade-DLJqMnUQ.js} +2 -2
  198. package/dist/{usage-Cb8Dtv9V.js → usage-CSh-xwQ2.js} +1 -1
  199. package/dist/{usage-DMs-IIJC.js → usage-D8mc4qXK.js} +1 -1
  200. package/dist/{watch-BcMQXGYO.js → watch-CQu-tJKZ.js} +2 -2
  201. package/dist/{watch-eE2XiwsC.js → watch-DmwaEvoi.js} +2 -2
  202. package/dist/{wire-BeT1Axeo.js → wire-DzGLZ3-O.js} +1 -1
  203. package/dist/worker-BLKTMLqa.js +1 -0
  204. package/dist/worker-nHemduM_.js +9 -0
  205. package/dist/{workflow-Cshghoas.js → workflow-IrouAus_.js} +1 -1
  206. package/docs/mcp.md +1 -1
  207. package/migrations/0000_initial.sql +8 -0
  208. package/migrations/meta/0000_snapshot.json +75 -1
  209. package/migrations/meta/_journal.json +1 -1
  210. package/package.json +1 -1
  211. package/plugins/agents/skills/coder/SKILL.md +1 -0
  212. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  213. package/plugins/claude/skills/dispatch/SKILL.md +1 -1
  214. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  215. package/plugins/cursor/skills/coder/SKILL.md +1 -0
  216. package/src/client/index.ts +10 -2
  217. package/src/client/types.ts +18 -0
  218. package/src/core/defaults.ts +11 -0
  219. package/src/core/task/log-view.ts +120 -6
  220. package/src/server/dash/app/dash/agents/(list)/agent-menu.tsx +4 -0
  221. package/src/server/dash/app/dash/agents/(list)/agents-grid.tsx +18 -35
  222. package/src/server/dash/app/dash/agents/(list)/loading.tsx +7 -1
  223. package/src/server/dash/app/dash/agents/[slug]/(tabs)/layout.tsx +2 -1
  224. package/src/server/dash/app/dash/layout.tsx +13 -3
  225. package/src/server/dash/app/dash/settings/[tab]/credentials-list.tsx +20 -13
  226. package/src/server/dash/app/dash/settings/[tab]/runners-list.tsx +13 -12
  227. package/src/server/dash/app/dash/tasks/[id]/activity.tsx +49 -4
  228. package/src/server/dash/app/dash/tasks/[id]/task-actions.tsx +43 -6
  229. package/src/server/dash/app/dash/tasks/[id]/task-view.css +52 -31
  230. package/src/server/dash/app/dash/tasks/[id]/task-view.tsx +143 -51
  231. package/src/server/dash/app/dash/tasks/composer.css +4 -0
  232. package/src/server/dash/app/dash/tasks/composer.tsx +6 -5
  233. package/src/server/dash/app/dash/tasks/list/task.ts +29 -1
  234. package/src/server/dash/app/dash/tasks/list/tasks-list.css +20 -7
  235. package/src/server/dash/app/dash/tasks/list/tasks-list.tsx +256 -109
  236. package/src/server/dash/app/dash/tasks/list/tasks-section.tsx +9 -13
  237. package/src/server/dash/app/dash/tasks/page.tsx +3 -35
  238. package/src/server/dash/comps/frame/loading-card.tsx +4 -3
  239. package/src/server/dash/comps/frame/page-head.css +10 -0
  240. package/src/server/dash/comps/frame/page-head.tsx +3 -2
  241. package/src/server/dash/comps/frame/task-toasts.tsx +196 -50
  242. package/src/server/dash/comps/nav/side-toggle.tsx +15 -4
  243. package/src/server/dash/comps/ui/card.css +1 -0
  244. package/src/server/dash/comps/ui/filter.css +64 -0
  245. package/src/server/dash/comps/ui/filter.tsx +336 -0
  246. package/src/server/dash/comps/ui/icons.ts +2 -0
  247. package/src/server/dash/comps/ui/menu.tsx +4 -0
  248. package/src/server/dash/comps/ui/select.tsx +2 -2
  249. package/src/server/dash/comps/ui/toolbar.css +14 -0
  250. package/src/server/dash/utils/client.ts +21 -0
  251. package/src/server/dash/utils/format.ts +12 -4
  252. package/src/server/dash/utils/paged.ts +14 -6
  253. package/dist/actions-Mk3FSlpJ.js +0 -20
  254. package/dist/archive-sweep-Cxbh8yAI.js +0 -1
  255. package/dist/auth-CBWTmAPA.js +0 -1
  256. package/dist/auth-Dmn2U7rr.js +0 -1
  257. package/dist/credentials-l6dsrZLL.js +0 -1
  258. package/dist/dash/public/assets/chunks/agents-grid-b906da80c31fc035.js +0 -1
  259. package/dist/dash/public/assets/chunks/composer-49f9e7c5c4dfda3b.js +0 -1
  260. package/dist/dash/public/assets/chunks/composer-f331d00837143aee.js +0 -1
  261. package/dist/dash/public/assets/chunks/credentials-list-e6177d0943517929.js +0 -2
  262. package/dist/dash/public/assets/chunks/format-eb03fc9d9744d960.js +0 -1
  263. package/dist/dash/public/assets/chunks/heads-1570a3a6db331979.js +0 -1
  264. package/dist/dash/public/assets/chunks/instructions-d0a4b0d95009c262.js +0 -1
  265. package/dist/dash/public/assets/chunks/paged-bc6fa0c2b9d52ed7.js +0 -1
  266. package/dist/dash/public/assets/chunks/runners-list-9fffa50432c470c9.js +0 -1
  267. package/dist/dash/public/assets/chunks/shared-init-20e199043ff5d00f.js +0 -2
  268. package/dist/dash/public/assets/chunks/shared-init-88cce66bb3cfe1e5.js +0 -5
  269. package/dist/dash/public/assets/chunks/task-actions-a9603d520434baab.js +0 -1
  270. package/dist/dash/public/assets/chunks/task-fa8b82e95e771c4a.js +0 -1
  271. package/dist/dash/public/assets/chunks/task-view-f7039cb330bcb0b5.js +0 -3
  272. package/dist/dash/public/assets/chunks/tasks-list-2a905b4a0c3a9042.js +0 -1
  273. package/dist/dash/public/assets/dash-agents-290a7b21c7dc0c92.css +0 -1
  274. package/dist/dash/public/assets/dash-agents-new-a7a07bf4ebda24c2.css +0 -1
  275. package/dist/dash/public/assets/dash-agents-param-slug-69a72fb0bbd14cc2.css +0 -1
  276. package/dist/dash/public/assets/dash-agents-param-slug-edit-397bdfb2f0ca328c.css +0 -1
  277. package/dist/dash/public/assets/dash-agents-param-slug-platforms-a7b3b7247c27f1d2.css +0 -1
  278. package/dist/dash/public/assets/dash-agents-param-slug-settings-8389b7d0555e8ccf.css +0 -1
  279. package/dist/dash/public/assets/dash-agents-param-slug-tasks-5987b8aea5e8f30d.css +0 -1
  280. package/dist/dash/public/assets/dash-agents-param-slug-usage-19abc69e1d4e6b0a.css +0 -1
  281. package/dist/dash/public/assets/dash-settings-param-tab-ac61fdfdd6fd533f.css +0 -1
  282. package/dist/dash/public/assets/dash-tasks-cc0b1d32874b731c.css +0 -1
  283. package/dist/dash/public/assets/dash-tasks-param-id-02b8c7bd99cc1090.css +0 -1
  284. package/dist/dash/public/assets/pnext-client-17ba55bb57a1f4da.js +0 -1
  285. package/dist/dash/public/assets/pnext-client-43f52a07f8067b1b.js +0 -1
  286. package/dist/dash/public/assets/pnext-client-4594b693fe612835.js +0 -1
  287. package/dist/dash/public/assets/pnext-client-73f73e24f8141fb6.js +0 -1
  288. package/dist/dash/public/assets/pnext-client-7574da4651b40eae.js +0 -1
  289. package/dist/dash/public/assets/pnext-client-7b3a2c1092cbbb02.js +0 -1
  290. package/dist/dash/public/assets/pnext-client-816fe5fc96d3f768.js +0 -1
  291. package/dist/dash/public/assets/pnext-client-86cb956b448b0887.js +0 -1
  292. package/dist/dash/public/assets/pnext-client-8b64e3c030164288.js +0 -1
  293. package/dist/dash/public/assets/pnext-client-8f6161084c595a22.js +0 -1
  294. package/dist/dash/public/assets/pnext-client-9203ec11926e5d04.js +0 -1
  295. package/dist/dash/public/assets/pnext-client-a38b446f941d44df.js +0 -1
  296. package/dist/dash/public/assets/pnext-client-bd8d51aaa095e8a4.js +0 -1
  297. package/dist/dash/public/assets/pnext-client-e9821d1f1bdb281d.js +0 -1
  298. package/dist/default-De8FXiWz.js +0 -1
  299. package/dist/dispatch-BKeAch9E.js +0 -14
  300. package/dist/exec-RZFLclKX.js +0 -11
  301. package/dist/executor-BvAA7Cgw.js +0 -10
  302. package/dist/http-Bkg_OQ6r.js +0 -1
  303. package/dist/integrations-BAgdVDhj.js +0 -5
  304. package/dist/integrations-D-L3uQRj.js +0 -1
  305. package/dist/log-view-dg0TlKLA.js +0 -1
  306. package/dist/models-_5LVGC3m.js +0 -1
  307. package/dist/queue-C9fSdE_X.js +0 -116
  308. package/dist/refresh-BDmap1RA.js +0 -1
  309. package/dist/rename-Bhcb4t9F.js +0 -1
  310. package/dist/result-D8DsvJDu.js +0 -15
  311. package/dist/run-Dqe38jX8.js +0 -2
  312. package/dist/runner-BPpiJvHx.js +0 -1
  313. package/dist/schema-CU2iFkp8.js +0 -1
  314. package/dist/serve-DA5I2qXj.js +0 -4
  315. package/dist/store-B3ZHoBJY.js +0 -8
  316. package/dist/store-BLi19UDE.js +0 -42
  317. package/dist/task-C6VAg5WU.js +0 -1
  318. package/dist/task-b2BK481M.js +0 -1
  319. package/dist/worker-CXndxmGF.js +0 -9
  320. package/dist/worker-DrucI22w.js +0 -1
@@ -1,2 +1,2 @@
1
- import{i as e}from"./cli-DWCR7iqa.js";import{s as t}from"./models-_5LVGC3m.js";import{a as n,i as r,n as i,r as a}from"./add-CLYTF_up.js";const o=e({name:`model update`,help:{usage:`coder model update <name> [--base-url <url>] [--model <id>] [--env-key VAR]`,summary:`Update a configured custom model. Only the flags you pass change; the endpoint
1
+ import{i as e}from"./cli-B1ObVrL4.js";import{s as t}from"./models-C-S7HqSb.js";import{a as n,i as r,n as i,r as a}from"./add-QExQhTzi.js";const o=e({name:`model update`,help:{usage:`coder model update <name> [--base-url <url>] [--model <id>] [--env-key VAR]`,summary:`Update a configured custom model. Only the flags you pass change; the endpoint
2
2
  is re-probed and the wire protocol re-detected.`,flags:[[`--base-url <url>`,`new API base`],[`--model <id>`,`new provider model id`],[`--env-key <VAR>`,`new API-key env var`],[`--workspace`,`write to <repo>/.coder/config.json instead of the user file`]]},options:i,args:1,run:({options:e,args:[r],cwd:i})=>t(i,r,n(e)),json:a,print:e=>r(e,`updated`)});export{o as commandModelUpdate};
@@ -1,2 +1,2 @@
1
- import{T as e}from"./dispatch-BKeAch9E.js";import{i as t}from"./cli-DWCR7iqa.js";import{f as n,p as r,t as i}from"./output-BKeyLbvt.js";import{n as a,s as o}from"./args-BOEEdpWk.js";import s from"node:process";const c=t({name:`upgrade`,globalFlags:{json:!1,cwd:!1},help:{usage:`coder upgrade [--cli-only] [--plugins-only] [--codex] [--claude] [--pm <mgr>]`,summary:`Update the coder CLI through whichever package manager installed it, then refresh
2
- the host plugins to match. Alias: update.`,flags:[[`--cli-only`,`update just the CLI`],[`--plugins-only`,`refresh just the host plugins`],[`--codex`,`limit the refresh to the Agent Skills copy (Codex, Pi, ...)`],[`--claude`,`limit the refresh to the Claude Code plugin`],[`--pm <npm|pnpm|yarn|bun>`,`force a package manager instead of auto-detecting`]]},options:{pm:o,"cli-only":a,"plugins-only":a,codex:a,claude:a},run:({options:t})=>e({...t,cliOnly:t[`cli-only`],pluginsOnly:t[`plugins-only`]},l),print:u});function l(e){s.stdout.write(`${r.bold(`Updating coder CLI`)} ${r.dim(`${e}...`)}\n`)}function u(e){let t=r.bold,a=r.dim,o=(e,n)=>n&&e&&n!==e?`${e} ${a(`->`)} ${t(n)}`:`${n??e??`?`} ${a(`(unchanged)`)}`,c=(e,t)=>`${t.installed?n(`${e} ${o(t.from,t.to)} ${a(`- ${t.note}`)}`):i(`${e} ${t.note}`)}\n`;e.cli&&s.stdout.write(e.cli.changed?`${n(`coder CLI ${o(e.cli.from,e.cli.to)}`)}\n`:`${n(`coder CLI ${e.cli.from} ${a(`(already latest)`)}`)}\n`),e.claudePlugin&&s.stdout.write(c(`claude plugin`,e.claudePlugin)),e.agentsSkill&&s.stdout.write(c(`agents skill `,e.agentsSkill))}const d=async()=>(await import(`./refresh-BDmap1RA.js`)).commandRefreshUpdate,f=Object.assign(async e=>e[0]===`refresh`?(await d())(e.slice(1)):c(e),c,{subcommands:{refresh:d}});export{f as commandUpgrade};
1
+ import{T as e}from"./dispatch-BsW_1m7e.js";import{i as t}from"./cli-B1ObVrL4.js";import{f as n,p as r,t as i}from"./output-BKeyLbvt.js";import{n as a,s as o}from"./args-DcBCtXhz.js";import s from"node:process";const c=t({name:`upgrade`,globalFlags:{json:!1,cwd:!1},help:{usage:`coder upgrade [--cli-only] [--plugins-only] [--codex] [--claude] [--pm <mgr>]`,summary:`Update the coder CLI through whichever package manager installed it, then refresh
2
+ the host plugins to match. Alias: update.`,flags:[[`--cli-only`,`update just the CLI`],[`--plugins-only`,`refresh just the host plugins`],[`--codex`,`limit the refresh to the Agent Skills copy (Codex, Pi, ...)`],[`--claude`,`limit the refresh to the Claude Code plugin`],[`--pm <npm|pnpm|yarn|bun>`,`force a package manager instead of auto-detecting`]]},options:{pm:o,"cli-only":a,"plugins-only":a,codex:a,claude:a},run:({options:t})=>e({...t,cliOnly:t[`cli-only`],pluginsOnly:t[`plugins-only`]},l),print:u});function l(e){s.stdout.write(`${r.bold(`Updating coder CLI`)} ${r.dim(`${e}...`)}\n`)}function u(e){let t=r.bold,a=r.dim,o=(e,n)=>n&&e&&n!==e?`${e} ${a(`->`)} ${t(n)}`:`${n??e??`?`} ${a(`(unchanged)`)}`,c=(e,t)=>`${t.installed?n(`${e} ${o(t.from,t.to)} ${a(`- ${t.note}`)}`):i(`${e} ${t.note}`)}\n`;e.cli&&s.stdout.write(e.cli.changed?`${n(`coder CLI ${o(e.cli.from,e.cli.to)}`)}\n`:`${n(`coder CLI ${e.cli.from} ${a(`(already latest)`)}`)}\n`),e.claudePlugin&&s.stdout.write(c(`claude plugin`,e.claudePlugin)),e.agentsSkill&&s.stdout.write(c(`agents skill `,e.agentsSkill))}const d=async()=>(await import(`./refresh-Bmy2r1Ee.js`)).commandRefreshUpdate,f=Object.assign(async e=>e[0]===`refresh`?(await d())(e.slice(1)):c(e),c,{subcommands:{refresh:d}});export{f as commandUpgrade};
@@ -1 +1 @@
1
- import{t as e}from"./rolldown-runtime-DT7IzrpZ.js";import{a as t,i as n}from"./load-BpEsAn51.js";import{a as r,d as i,f as a,n as o,u as s}from"./http-Bkg_OQ6r.js";import{g as c}from"./store-B3ZHoBJY.js";var l=e({addUsage:()=>f,leaders:()=>m,readUsage:()=>x,readUsageTotals:()=>S,timeZone:()=>d,usageReport:()=>b,usageSummary:()=>_,usageTotals:()=>p});function u(e){return typeof e==`number`?e:!e||typeof e!=`object`||Array.isArray(e)?0:`total`in e&&typeof e.total==`number`?e.total:Object.values(e).reduce((e,t)=>e+u(t),0)}function d(e){if(!e)return`UTC`;try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),e}catch{return`UTC`}}const f=(e,t)=>{e.tasks+=t.tasks,e.runnerMs+=t.runnerMs,e.tokenCount+=t.tokenCount};async function p(e,t){if(e.usageTotals)return e.usageTotals(t);if(t.top){let{top:n,...r}=t,i=(await p(e,{...r,by:`agent`,parts:void 0})).sort((e,t)=>t[n.by]-e[n.by]||e.key.localeCompare(t.key)).slice(0,n.count).map(e=>e.key);return p(e,{...r,parts:i})}let n=d(t.tz),r=new Intl.DateTimeFormat(`en-CA`,{timeZone:n,year:`numeric`,month:`2-digit`,day:`2-digit`}),i=new Set(t.parts),a=new Map;for(let{value:n}of await e.list(`usage`)){if(n.at<t.since||t.until!==void 0&&n.at>=t.until||t.agent&&n.agent!==t.agent)continue;let e=t.by===`agent`?n.agent:t.by===`installation`?n.installationId??`none`:t.by===`engine`?n.engine??`unknown`:r.format(n.at),o={tasks:1,runnerMs:n.runnerElapsedMs,tokenCount:u(n.tokens)},s=a.get(e)??{key:e,tasks:0,runnerMs:0,tokenCount:0};f(s,o),i.has(n.agent)&&(s.parts??={},f(s.parts[n.agent]??={tasks:0,runnerMs:0,tokenCount:0},o)),a.set(e,s)}return[...a.values()].sort((e,t)=>e.key.localeCompare(t.key))}function m(e,t){let n=new Map;for(let r of e)for(let[e,i]of Object.entries(r.parts??{}))n.set(e,(n.get(e)??0)+i[t]);return[...n].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e])=>e)}function h(e,t){if(typeof t==`number`)return(typeof e==`number`?e:0)+t;if(!t||typeof t!=`object`||Array.isArray(t))return e;let n=e&&typeof e==`object`&&!Array.isArray(e)?{...e}:{};for(let[e,r]of Object.entries(t))n[e]=h(n[e],r);return n}function g(e,t){let n=new Map;for(let r of e){let e=t===`agent`?r.agent:t===`installation`?r.installationId??`none`:r.engine??`unknown`,i=n.get(e)??{key:e,tasks:0,runnerMs:0};i.tasks++,i.runnerMs+=r.runnerElapsedMs,r.tokens!==void 0&&(i.tokens=h(i.tokens,r.tokens)),n.set(e,i)}return[...n.values()].sort((e,t)=>e.key.localeCompare(t.key))}function _(e,t,n){let r=e.filter(e=>e.at>=t);return{since:t,totals:n?g(r,n):{agent:g(r,`agent`),installation:g(r,`installation`),engine:g(r,`engine`)}}}const v={tasks:`tasks`,runner:`runnerMs`,tokens:`tokenCount`},y={tokens:e=>e.tokenCount,tasks:e=>e.tasks,runner:e=>e.runnerMs,name:e=>e.key};async function b(e,c){let l=e=>c.searchParams.get(e),u=Number(l(`since`)??0),f=l(`until`)===null?void 0:Number(l(`until`)),h=l(`by`)??`agent`;if(!Number.isFinite(u)||f!==void 0&&!Number.isFinite(f)||![`agent`,`installation`,`engine`,`day`].includes(h))return r({error:`Invalid usage query`},400);let g=l(`parts`)?.split(`,`).filter(Boolean),_=Math.min(Number(l(`top`)??0),8),b=v[l(`sort`)??`tokens`]??`tokenCount`,x=await p(e.store,{by:h,since:u,...f===void 0?{}:{until:f},...l(`agent`)?{agent:l(`agent`)}:{},...h===`day`?{tz:d(l(`tz`))}:{},...g?.length?{parts:g.slice(0,20)}:{},..._>0?{top:{count:_,by:b}}:{}}),S={since:u,...f===void 0?{}:{until:f}};if(h===`agent`){let r=new Set(e.local?(await t(e.local.cwd,e.integrations)).map(e=>e.id):(await e.store.list(`agent`)).map(e=>e.id));for(let e of Object.keys(n()))r.add(e);for(let e of x)r.has(e.key)||(e.deleted=!0)}if(_>0)return r({...S,totals:x,top:m(x,b)});if(!a(c)||h!==`agent`)return r({...S,totals:x});let C=y[l(`sort`)??`tokens`]??y.tokens,w=l(`sort`)===`name`,T=l(`q`)?.trim().toLowerCase(),E=([e,t],[n,r])=>(e<n?-1:+(e>n))*(w?1:-1)||t.localeCompare(r),D=e=>[C(e),e.key],O=o(c),k=x.filter(e=>!T||e.key.toLowerCase().includes(T)).filter(e=>!O||E(D(e),O)>0).sort((e,t)=>E(D(e),D(t))),A=i(c),j=e=>x.reduce((t,n)=>t+e(n),0);return r({...S,...s(k.slice(0,A+1),A,D),summary:{agents:x.length,tasks:j(e=>e.tasks),runnerMs:j(e=>e.runnerMs),tokenCount:j(e=>e.tokenCount)}})}async function x(e,t,n,i){t.local&&await c(t);let a=i.searchParams.get(`installation`),o=await t.store.list(`usage`);return r(a?o.filter(e=>e.value.installationId===a):o)}async function S(e,t,n,i){t.local&&await c(t);let a=Number(i.searchParams.get(`since`)??0),o=i.searchParams.get(`by`);if([`until`,`agent`,`tz`,`parts`,`top`,`cursor`].some(e=>i.searchParams.has(e))||o===`day`)return b(t,i);if(!Number.isFinite(a)||o&&![`agent`,`installation`,`engine`].includes(o))return r({error:`Invalid usage query`},400);let s=(await t.store.list(`usage`)).map(e=>e.value);return r(_(s,a,o))}export{l as a,d as i,x as n,S as r,f as t};
1
+ import{t as e}from"./rolldown-runtime-DT7IzrpZ.js";import{a as t,i as n}from"./load-SnZd7xG1.js";import{a as r,d as i,f as a,n as o,u as s}from"./http-D01Udu4u.js";import{y as c}from"./store-j8icrG0v.js";var l=e({addUsage:()=>f,leaders:()=>m,readUsage:()=>x,readUsageTotals:()=>S,timeZone:()=>d,usageReport:()=>b,usageSummary:()=>_,usageTotals:()=>p});function u(e){return typeof e==`number`?e:!e||typeof e!=`object`||Array.isArray(e)?0:`total`in e&&typeof e.total==`number`?e.total:Object.values(e).reduce((e,t)=>e+u(t),0)}function d(e){if(!e)return`UTC`;try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),e}catch{return`UTC`}}const f=(e,t)=>{e.tasks+=t.tasks,e.runnerMs+=t.runnerMs,e.tokenCount+=t.tokenCount};async function p(e,t){if(e.usageTotals)return e.usageTotals(t);if(t.top){let{top:n,...r}=t,i=(await p(e,{...r,by:`agent`,parts:void 0})).sort((e,t)=>t[n.by]-e[n.by]||e.key.localeCompare(t.key)).slice(0,n.count).map(e=>e.key);return p(e,{...r,parts:i})}let n=d(t.tz),r=new Intl.DateTimeFormat(`en-CA`,{timeZone:n,year:`numeric`,month:`2-digit`,day:`2-digit`}),i=new Set(t.parts),a=new Map;for(let{value:n}of await e.list(`usage`)){if(n.at<t.since||t.until!==void 0&&n.at>=t.until||t.agent&&n.agent!==t.agent)continue;let e=t.by===`agent`?n.agent:t.by===`installation`?n.installationId??`none`:t.by===`engine`?n.engine??`unknown`:r.format(n.at),o={tasks:1,runnerMs:n.runnerElapsedMs,tokenCount:u(n.tokens)},s=a.get(e)??{key:e,tasks:0,runnerMs:0,tokenCount:0};f(s,o),i.has(n.agent)&&(s.parts??={},f(s.parts[n.agent]??={tasks:0,runnerMs:0,tokenCount:0},o)),a.set(e,s)}return[...a.values()].sort((e,t)=>e.key.localeCompare(t.key))}function m(e,t){let n=new Map;for(let r of e)for(let[e,i]of Object.entries(r.parts??{}))n.set(e,(n.get(e)??0)+i[t]);return[...n].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e])=>e)}function h(e,t){if(typeof t==`number`)return(typeof e==`number`?e:0)+t;if(!t||typeof t!=`object`||Array.isArray(t))return e;let n=e&&typeof e==`object`&&!Array.isArray(e)?{...e}:{};for(let[e,r]of Object.entries(t))n[e]=h(n[e],r);return n}function g(e,t){let n=new Map;for(let r of e){let e=t===`agent`?r.agent:t===`installation`?r.installationId??`none`:r.engine??`unknown`,i=n.get(e)??{key:e,tasks:0,runnerMs:0};i.tasks++,i.runnerMs+=r.runnerElapsedMs,r.tokens!==void 0&&(i.tokens=h(i.tokens,r.tokens)),n.set(e,i)}return[...n.values()].sort((e,t)=>e.key.localeCompare(t.key))}function _(e,t,n){let r=e.filter(e=>e.at>=t);return{since:t,totals:n?g(r,n):{agent:g(r,`agent`),installation:g(r,`installation`),engine:g(r,`engine`)}}}const v={tasks:`tasks`,runner:`runnerMs`,tokens:`tokenCount`},y={tokens:e=>e.tokenCount,tasks:e=>e.tasks,runner:e=>e.runnerMs,name:e=>e.key};async function b(e,c){let l=e=>c.searchParams.get(e),u=Number(l(`since`)??0),f=l(`until`)===null?void 0:Number(l(`until`)),h=l(`by`)??`agent`;if(!Number.isFinite(u)||f!==void 0&&!Number.isFinite(f)||![`agent`,`installation`,`engine`,`day`].includes(h))return r({error:`Invalid usage query`},400);let g=l(`parts`)?.split(`,`).filter(Boolean),_=Math.min(Number(l(`top`)??0),8),b=v[l(`sort`)??`tokens`]??`tokenCount`,x=await p(e.store,{by:h,since:u,...f===void 0?{}:{until:f},...l(`agent`)?{agent:l(`agent`)}:{},...h===`day`?{tz:d(l(`tz`))}:{},...g?.length?{parts:g.slice(0,20)}:{},..._>0?{top:{count:_,by:b}}:{}}),S={since:u,...f===void 0?{}:{until:f}};if(h===`agent`){let r=new Set(e.local?(await t(e.local.cwd,e.integrations)).map(e=>e.id):(await e.store.list(`agent`)).map(e=>e.id));for(let e of Object.keys(n()))r.add(e);for(let e of x)r.has(e.key)||(e.deleted=!0)}if(_>0)return r({...S,totals:x,top:m(x,b)});if(!a(c)||h!==`agent`)return r({...S,totals:x});let C=y[l(`sort`)??`tokens`]??y.tokens,w=l(`sort`)===`name`,T=l(`q`)?.trim().toLowerCase(),E=([e,t],[n,r])=>(e<n?-1:+(e>n))*(w?1:-1)||t.localeCompare(r),D=e=>[C(e),e.key],O=o(c),k=x.filter(e=>!T||e.key.toLowerCase().includes(T)).filter(e=>!O||E(D(e),O)>0).sort((e,t)=>E(D(e),D(t))),A=i(c),j=e=>x.reduce((t,n)=>t+e(n),0);return r({...S,...s(k.slice(0,A+1),A,D),summary:{agents:x.length,tasks:j(e=>e.tasks),runnerMs:j(e=>e.runnerMs),tokenCount:j(e=>e.tokenCount)}})}async function x(e,t,n,i){t.local&&await c(t);let a=i.searchParams.get(`installation`),o=await t.store.list(`usage`);return r(a?o.filter(e=>e.value.installationId===a):o)}async function S(e,t,n,i){t.local&&await c(t);let a=Number(i.searchParams.get(`since`)??0),o=i.searchParams.get(`by`);if([`until`,`agent`,`tz`,`parts`,`top`,`cursor`].some(e=>i.searchParams.has(e))||o===`day`)return b(t,i);if(!Number.isFinite(a)||o&&![`agent`,`installation`,`engine`].includes(o))return r({error:`Invalid usage query`},400);let s=(await t.store.list(`usage`)).map(e=>e.value);return r(_(s,a,o))}export{l as a,d as i,x as n,S as r,f as t};
@@ -1 +1 @@
1
- import{i as e,r as t}from"./cli-DWCR7iqa.js";import{g as n,p as r}from"./output-BKeyLbvt.js";import{i,n as a,s as o,t as s}from"./args-BOEEdpWk.js";import c from"node:process";const l={server:i,workspace:o,yes:a};function u(e,t){let i=Array.isArray(e.totals)?e.totals.map(e=>({group:t??``,...e})):Object.entries(e.totals).flatMap(([e,t])=>t.map(t=>({group:e,...t})));if(!i.length)return void c.stdout.write(`${r.dim(`No usage in this period.`)}\n`);c.stdout.write(`${n([{header:`by`,value:e=>e.group},{header:`key`,value:e=>e.key,paint:e=>r.cyan(e)},{header:`tasks`,value:e=>String(e.tasks)},{header:`runner ms`,value:e=>String(e.runnerMs)},{header:`tokens`,value:e=>e.tokens===void 0?``:JSON.stringify(e.tokens)}],i,r)}\n`)}const d=e({name:`agent usage`,help:{usage:`coder agent usage [--since 7d|24h|<ms>] [--by agent|installation|engine] [--server [url]] [--json] [--cwd <dir>]`,flags:[[`--since <period|ms>`,`period such as 7d or 24h, or milliseconds since epoch`],[`--by <group>`,`agent, installation, or engine`],t]},options:{...s,...l,since:o,by:o},run:async({options:e,cwd:t})=>{let{agents:n}=await import(`./agent-hw3zKw8y.js`).then(e=>e.t);return n.usage({...e,cwd:t,organization:e.workspace,since:e.since??`7d`})},print:(e,{options:t})=>u(e,t.by)});export{d as commandAgentUsage};
1
+ import{i as e,r as t}from"./cli-B1ObVrL4.js";import{g as n,p as r}from"./output-BKeyLbvt.js";import{i,n as a,s as o,t as s}from"./args-DcBCtXhz.js";import c from"node:process";const l={server:i,workspace:o,yes:a};function u(e,t){let i=Array.isArray(e.totals)?e.totals.map(e=>({group:t??``,...e})):Object.entries(e.totals).flatMap(([e,t])=>t.map(t=>({group:e,...t})));if(!i.length)return void c.stdout.write(`${r.dim(`No usage in this period.`)}\n`);c.stdout.write(`${n([{header:`by`,value:e=>e.group},{header:`key`,value:e=>e.key,paint:e=>r.cyan(e)},{header:`tasks`,value:e=>String(e.tasks)},{header:`runner ms`,value:e=>String(e.runnerMs)},{header:`tokens`,value:e=>e.tokens===void 0?``:JSON.stringify(e.tokens)}],i,r)}\n`)}const d=e({name:`agent usage`,help:{usage:`coder agent usage [--since 7d|24h|<ms>] [--by agent|installation|engine] [--server [url]] [--json] [--cwd <dir>]`,flags:[[`--since <period|ms>`,`period such as 7d or 24h, or milliseconds since epoch`],[`--by <group>`,`agent, installation, or engine`],t]},options:{...s,...l,since:o,by:o},run:async({options:e,cwd:t})=>{let{agents:n}=await import(`./agent-BlQ_dNNm.js`).then(e=>e.t);return n.usage({...e,cwd:t,organization:e.workspace,since:e.since??`7d`})},print:(e,{options:t})=>u(e,t.by)});export{d as commandAgentUsage};
@@ -1,8 +1,8 @@
1
- import{Dn as e,cn as t}from"./dispatch-BKeAch9E.js";import{i as n,r}from"./cli-DWCR7iqa.js";import{p as i,y as a}from"./output-BKeyLbvt.js";import{i as o,l as s,n as c,s as l,t as u}from"./args-BOEEdpWk.js";import{LogRenderer as d,finalMessageLine as f,printOutcome as p,promptBlock as m,taskHeaderLines as h,taskSummaryLines as g,trimStep as _}from"./result-D8DsvJDu.js";import v from"node:process";import*as y from"zod/mini";const b={server:o,workspace:l,yes:c};function x(e,t){let n=e.level===`sys`?t.dim(`· ${e.line}`):e.level===`err`?t.light(e.line):e.line;v.stdout.write(`${n}\n`)}async function S(n,r,o){if(`attempts`in n.task){for await(let e of n.events)o.json?v.stdout.write(`${JSON.stringify(e,null,2)}\n`):x(e,i);let e=await n.final();o.json||p(e,i),v.exit(0)}let s=n.task,c=o.trim===void 0?500:o.trim===`none`?1/0:o.trim,l=await d.create({cwd:s.cwd??r,startedAt:Date.parse(s.createdAt??``)||void 0,trim:c,explicitTrim:o.trim!==void 0,width:a()});if(!o.json){let e=[...h(s,{status:s.status}),...t.includes(s.status)?[i.dim(`Watching. Press Ctrl-C to stop.`)]:[],...s.prompt?m(s.prompt,i,{truncate:!1}):[],``];v.stdout.write(`${e.join(`
1
+ import{Mn as e,pn as t}from"./dispatch-BsW_1m7e.js";import{i as n,r}from"./cli-B1ObVrL4.js";import{p as i,y as a}from"./output-BKeyLbvt.js";import{i as o,l as s,n as c,s as l,t as u}from"./args-DcBCtXhz.js";import{LogRenderer as d,finalMessageLine as f,printOutcome as p,promptBlock as m,taskHeaderLines as h,taskSummaryLines as g,trimStep as _}from"./result-DGWyUHYU.js";import v from"node:process";import*as y from"zod/mini";const b={server:o,workspace:l,yes:c};function x(e,t){let n=e.level===`sys`?t.dim(`· ${e.line}`):e.level===`err`?t.light(e.line):e.line;v.stdout.write(`${n}\n`)}async function S(n,r,o){if(`attempts`in n.task){for await(let e of n.events)o.json?v.stdout.write(`${JSON.stringify(e,null,2)}\n`):x(e,i);let e=await n.final();o.json||p(e,i),v.exit(0)}let s=n.task,c=o.trim===void 0?500:o.trim===`none`?1/0:o.trim,l=await d.create({cwd:s.cwd??r,startedAt:Date.parse(s.createdAt??``)||void 0,trim:c,explicitTrim:o.trim!==void 0,width:a()});if(!o.json){let e=[...h(s,{status:s.status}),...t.includes(s.status)?[i.dim(`Watching. Press Ctrl-C to stop.`)]:[],...s.prompt?m(s.prompt,i,{truncate:!1}):[],``];v.stdout.write(`${e.join(`
2
2
  `)}\n`)}let u=null,y=null,b=e=>{let t=l.render(e);t.length&&v.stdout.write(`${t.join(`
3
3
  `)}\n`)};for await(let e of n.events){let t=e;if(t.kind===`usage`&&t.tokens&&(u=t.tokens),o.json){let e=t.kind===`steer`?1/0:c,n=t.message?{...t,message:_(t.message,e,{plain:!0})}:t;v.stdout.write(`${JSON.stringify(n)}\n`);continue}t.kind!==`usage`&&(y&&=(b(y),null),t.kind===`assistant`?y=t:b(t))}let{status:S,result:C,task:w}=await n.final();if(o.json)v.stdout.write(`${JSON.stringify({taskId:s.id,status:S,result:C},null,2)}\n`);else{let t=S===`completed`?`(no final message)`:`(task ${S})`,n=g(w,{tokens:C?.tokens??u,tokenModel:C?.model,files:C?.touchedFiles?.map(t=>e(s.cwd??r,t)),statusChanged:S!==s.status});n.length&&v.stderr.write(`\n${n.join(`
4
4
  `)}\n`);let i=f(C,w.error,t),a=y?String(y.message??``):``;v.stdout.write(`\n${i.trim()?i:a}\n`)}v.exit(S===`completed`?0:1)}const C=n({name:`task watch`,help:{usage:`coder task watch [task-id] [--server [url]]`,summary:`Stream a running task's transcript live (for you/debugging), then print its
5
5
  final answer. Replays the last line first so the current step is visible;
6
6
  --tail <n> replays the last n lines (--tail all for the whole transcript).
7
7
  Blocks until it finishes; exits 0 on success, 1 otherwise. For the answer
8
- alone, prefer \`coder result\`. Alias: stream.`,flags:[[`--tail <n|all>`,`replay the last n log lines first (default: 1)`],[`--trim <n|none>`,`budget for tool output and thinking (default: 1200 chars, 12 lines)`],r],examples:[[`coder task watch`,`follow the most recent task to completion`]]},options:{...u,tail:s,trim:y.optional(y.union([y.literal(`none`),y.coerce.number().check(y.int(),y.positive())],{error:`expected a positive integer or "none"`})),...b},args:1,async run({options:e,args:[t],cwd:n}){let{tasks:r}=await import(`./task-C6VAg5WU.js`).then(e=>e.t);await S(await r.watch(t,{...e,organization:e.workspace}),n,e)}});export{C as commandWatch,x as printLine};
8
+ alone, prefer \`coder result\`. Alias: stream.`,flags:[[`--tail <n|all>`,`replay the last n log lines first (default: 1)`],[`--trim <n|none>`,`budget for tool output and thinking (default: 1200 chars, 12 lines)`],r],examples:[[`coder task watch`,`follow the most recent task to completion`]]},options:{...u,tail:s,trim:y.optional(y.union([y.literal(`none`),y.coerce.number().check(y.int(),y.positive())],{error:`expected a positive integer or "none"`})),...b},args:1,async run({options:e,args:[t],cwd:n}){let{tasks:r}=await import(`./task-CvSqiwxo.js`).then(e=>e.t);await S(await r.watch(t,{...e,organization:e.workspace}),n,e)}});export{C as commandWatch,x as printLine};
@@ -1,5 +1,5 @@
1
- import{Ht as e}from"./dispatch-BKeAch9E.js";import{i as t}from"./cli-DWCR7iqa.js";import{_ as n,a as r,b as i,c as a,h as o,l as s,n as c,p as l,s as u,u as d,v as f,y as p}from"./output-BKeyLbvt.js";import{l as m,t as h}from"./args-BOEEdpWk.js";import g from"node:process";const _=t({name:`flow watch`,help:{usage:`coder flow watch [run-id] [--tail <n|all>] [--json]`,summary:`Watch a flow run live: replay its progress lines from the start, then keep
1
+ import{qt as e}from"./dispatch-BsW_1m7e.js";import{i as t}from"./cli-B1ObVrL4.js";import{_ as n,a as r,b as i,c as a,h as o,l as s,n as c,p as l,s as u,u as d,v as f,y as p}from"./output-BKeyLbvt.js";import{l as m,t as h}from"./args-DcBCtXhz.js";import g from"node:process";const _=t({name:`flow watch`,help:{usage:`coder flow watch [run-id] [--tail <n|all>] [--json]`,summary:`Watch a flow run live: replay its progress lines from the start, then keep
2
2
  following while it runs (Ctrl-C detaches; it keeps running). Blocks until it
3
3
  finishes; exits 0 on success, 1 otherwise. Defaults to the most recent run.
4
- For the result alone, prefer \`coder flow result\`. Alias: stream.`,flags:[[`--tail <n|all>`,`replay only the last n events first (default: all)`]],examples:[[`coder flow watch`,`follow the most recent run to completion`]]},options:{...h,tail:m},args:1,run:async({options:e,args:[t]})=>{let{watchRun:n}=await import(`./executor-BvAA7Cgw.js`).then(e=>e.y);return N(n(t,{tail:e.tail}),{json:e.json,stream:!0})}}),v=[`⣾`,`⣽`,`⣻`,`⢿`,`⡿`,`⣟`,`⣯`,`⣷`];function y(e,t=!1){let n=l;return t?c(`[${x(e)}]`,10):e===`completed`?n.bold(n.green(`✔`)):e===`failed`||e===`cancelled`||e===`stopped`?n.bold(n.red(`✘`)):e===`running`?n.bold(n.cyan(`●`)):n.dim(`○`)}function b(){return c(`[start]`,10)}function x(e){return e===`completed`?`done`:e===`cancelled`?`failed`:e}function S(e,t){return e??t.replace(/\s+/g,` `).trim().slice(0,60)}function C(e,t,n,r,i,a){let o=l,u=c(t??n,32);return[`${e} ${a?o.bold(u):u}`,o.dim(c(n,24)),o.light(c(i??``,20)),r?o.light(`${s(r.total)} tok`):``].join(` `).trimEnd()}function w(e,t=!1){let n=l;return`${y(e.ok?`completed`:`failed`,t)} ${n.dim(`gate`)} ${n.light(e.cmd)}${e.ok?``:n.dim(` · exit ${e.code}`)}`}function T(e,t,n){let i=l,a=n!==void 0&&n>=1e3?i.dim(` · ${r(n)}`):``;return`${t} ${i.dim(`gate`)} ${i.light(e)}${a}`}function E(e,t=!1){return l.dim(`${`│ `.repeat(e)}${t?`└─`:`├─`}`)}function D(e){return l.dim(`${`│ `.repeat(e)}│ `)}function O(e){return`${` `.repeat(e.depth)}${e.log?`${c(`[log]`,10)} `:``}${e.body}`}function k(e,t,n=!1){return n?O(e):`${e.log?D(e.depth):E(e.depth,t)} ${e.body}`}function A(e){return l.dim(`${`│ `.repeat(Math.max(0,e))}│`)}var j=class{stream;names=new Map;active=new Map;activeGates=new Map;pending;previews=new Map;frame=0;hasCommitted=!1;timer;tty;region;constructor(e=g.stdout){this.stream=e,this.tty=!!e.isTTY,this.region=new n(e)}emit(e){let t=l;switch(e.kind){case`task-start`:{let t={name:S(e.name,e.prompt),engine:e.engine,depth:e.depth??0};if(this.names.set(e.taskId,t),!this.tty){this.final(t.depth,C(b(),t.name,e.taskId,null,t.engine));return}this.active.set(e.taskId,t),this.spin(!0),this.repaint();return}case`task-end`:{this.active.delete(e.taskId),this.previews.delete(e.taskId),this.idle();let t=this.names.get(e.taskId);this.final(t?.depth??0,C(y(e.status,!this.tty),t?.name??null,e.taskId,e.tokens,t?.engine));return}case`gate-start`:{let t={cmd:e.cmd,depth:e.depth??0,startedAt:Date.now()};if(!this.tty){this.final(t.depth,T(t.cmd,b()));return}this.activeGates.set(e.gateId,t),this.spin(!0),this.repaint();return}case`gate`:e.gateId&&this.activeGates.delete(e.gateId),this.idle(),this.final(e.depth??0,w(e,!this.tty));return;case`log`:for(let n of e.message.split(`
4
+ For the result alone, prefer \`coder flow result\`. Alias: stream.`,flags:[[`--tail <n|all>`,`replay only the last n events first (default: all)`]],examples:[[`coder flow watch`,`follow the most recent run to completion`]]},options:{...h,tail:m},args:1,run:async({options:e,args:[t]})=>{let{watchRun:n}=await import(`./executor-vMppVLB6.js`).then(e=>e.y);return N(n(t,{tail:e.tail}),{json:e.json,stream:!0})}}),v=[`⣾`,`⣽`,`⣻`,`⢿`,`⡿`,`⣟`,`⣯`,`⣷`];function y(e,t=!1){let n=l;return t?c(`[${x(e)}]`,10):e===`completed`?n.bold(n.green(`✔`)):e===`failed`||e===`cancelled`||e===`stopped`?n.bold(n.red(`✘`)):e===`running`?n.bold(n.cyan(`●`)):n.dim(`○`)}function b(){return c(`[start]`,10)}function x(e){return e===`completed`?`done`:e===`cancelled`?`failed`:e}function S(e,t){return e??t.replace(/\s+/g,` `).trim().slice(0,60)}function C(e,t,n,r,i,a){let o=l,u=c(t??n,32);return[`${e} ${a?o.bold(u):u}`,o.dim(c(n,24)),o.light(c(i??``,20)),r?o.light(`${s(r.total)} tok`):``].join(` `).trimEnd()}function w(e,t=!1){let n=l;return`${y(e.ok?`completed`:`failed`,t)} ${n.dim(`gate`)} ${n.light(e.cmd)}${e.ok?``:n.dim(` · exit ${e.code}`)}`}function T(e,t,n){let i=l,a=n!==void 0&&n>=1e3?i.dim(` · ${r(n)}`):``;return`${t} ${i.dim(`gate`)} ${i.light(e)}${a}`}function E(e,t=!1){return l.dim(`${`│ `.repeat(e)}${t?`└─`:`├─`}`)}function D(e){return l.dim(`${`│ `.repeat(e)}│ `)}function O(e){return`${` `.repeat(e.depth)}${e.log?`${c(`[log]`,10)} `:``}${e.body}`}function k(e,t,n=!1){return n?O(e):`${e.log?D(e.depth):E(e.depth,t)} ${e.body}`}function A(e){return l.dim(`${`│ `.repeat(Math.max(0,e))}│`)}var j=class{stream;names=new Map;active=new Map;activeGates=new Map;pending;previews=new Map;frame=0;hasCommitted=!1;timer;tty;region;constructor(e=g.stdout){this.stream=e,this.tty=!!e.isTTY,this.region=new n(e)}emit(e){let t=l;switch(e.kind){case`task-start`:{let t={name:S(e.name,e.prompt),engine:e.engine,depth:e.depth??0};if(this.names.set(e.taskId,t),!this.tty){this.final(t.depth,C(b(),t.name,e.taskId,null,t.engine));return}this.active.set(e.taskId,t),this.spin(!0),this.repaint();return}case`task-end`:{this.active.delete(e.taskId),this.previews.delete(e.taskId),this.idle();let t=this.names.get(e.taskId);this.final(t?.depth??0,C(y(e.status,!this.tty),t?.name??null,e.taskId,e.tokens,t?.engine));return}case`gate-start`:{let t={cmd:e.cmd,depth:e.depth??0,startedAt:Date.now()};if(!this.tty){this.final(t.depth,T(t.cmd,b()));return}this.activeGates.set(e.gateId,t),this.spin(!0),this.repaint();return}case`gate`:e.gateId&&this.activeGates.delete(e.gateId),this.idle(),this.final(e.depth??0,w(e,!this.tty));return;case`log`:for(let n of e.message.split(`
5
5
  `))this.final(e.depth??0,t.light(n),!0);return;case`flow-start`:this.final(e.depth-1,t.bold(`flow ${e.name}`));return;case`replay`:this.final(0,t.dim(`replayed ${e.count} steps from journal`),!0)}}done(){this.spin(!1),this.flush(0),this.tty&&this.repaint(),this.region.done()}flush(e){this.pending&&=(this.region.commit(`${k(this.pending,e<this.pending.depth,!this.tty)}\n`),this.hasCommitted=!0,void 0)}final(e,t,n=!1){if(!this.tty){this.region.commit(`${O({depth:e,body:t,log:n})}\n`),this.hasCommitted=!0;return}this.flush(e),this.pending={depth:e,body:t,log:n},this.tty&&this.repaint()}repaint(){let e=[],t=[];if(this.pending){let n=k(this.pending,!1);e.push(n),t.push(n)}let n=this.timer?l.bold(l.cyan(v[this.frame%v.length])):y(`running`);for(let[r,i]of this.active){let a=`${E(i.depth??0)} ${C(n,i.name,r,null,i.engine,!0)}`;(e.length||this.hasCommitted)&&e.push(A(i.depth??0)),e.push(a),t.push(a);let o=this.previews.get(r);o&&e.push(`${D(i.depth??0)} ${l.dim(o)}`)}for(let r of this.activeGates.values()){let i=`${E(r.depth)} ${T(r.cmd,n,Date.now()-r.startedAt)}`;(e.length||this.hasCommitted)&&e.push(A(r.depth)),e.push(i),t.push(i)}let r=(i(this.stream)??1/0)-1,a=e.length<=r?e:t;if(a.length>r){let e=Math.max(0,r-1);a=[l.dim(`… +${a.length-e} more running`),...a.slice(-e)]}this.region.set(a)}refreshPreviews(){for(let t of this.active.keys())try{let n=e(g.cwd(),t,1)[0]?.message?.replace(/\s+/g,` `).trim();if(!n)continue;let r=(p(this.stream)??120)-8;this.previews.set(t,n.length>r?`${n.slice(0,r-1)}…`:n)}catch{}}idle(){!this.active.size&&!this.activeGates.size&&this.spin(!1)}spin(e){e&&!this.timer?this.timer=setInterval(()=>{this.frame++,this.frame%4==0&&this.refreshPreviews(),this.repaint()},120).unref():!e&&this.timer&&(clearInterval(this.timer),this.timer=void 0)}};function M(e,t){if(t){o(e);return}let n=!g.stdout.isTTY,r=n?``:`${l.dim(`└─`)} `;g.stdout.write(`${r}${y(`completed`,n)} run ${l.cyan(e.runId)} completed ${l.dim(`(${e.taskCount} tasks)`)}\n`),g.stdout.write(`\n${a(e.result)}\n`),P(e.tokens)}async function N(e,t){let{runId:n}=e.record,r=!!(t.stream&&t.json);!t.json&&e.record.status===`running`&&g.stderr.write(`${l.dim(`[flow]`)} Run ${l.cyan(n)} started and is waiting to finish. Press Ctrl-C to detach. It keeps running.\n\n`);let i=t.json?()=>{}:f(),a=()=>{i(),r||(g.stderr.write(`\n${l.dim(`[flow] Detached. The run is still going.`)}\n`),g.stderr.write(`\n${u([`Result: coder flow result ${n}`,`Stop it: coder flow stop ${n}`],l)}\n`)),g.exit(130)};g.on(`SIGINT`,a);let s=new j;for await(let n of e.events)r?g.stdout.write(`${JSON.stringify(n)}\n`):t.json||s.emit(n);s.done(),i(),g.off(`SIGINT`,a);let c=e.final();r&&(g.stdout.write(`${JSON.stringify(F(c))}\n`),g.exit(c.status===`completed`?0:1)),c.status===`completed`&&(M({runId:n,name:c.name,status:`completed`,result:c.result,tokens:c.ledger,taskCount:c.taskCount},t.json),g.exit(0)),c.status===`stopped`&&(t.json?o({runId:n,name:c.name,status:`stopped`,taskCount:c.taskCount}):g.stdout.write(`\n${l.dim(`[flow] Run ${n} stopped.`)}\n\n${u([`Resume: coder flow resume ${n}`],l)}\n`),g.exit(1)),g.stdout.write(`\n${l.red(`error:`)} ${c.error??`unknown error`}\n`),g.stdout.write(`\n${u([`Resume: coder flow resume ${n}`],l)}\n`),g.exit(1)}function P(e){let t=Object.keys(e);if(t.length){g.stdout.write(`\n${l.bold(`Tokens:`)}\n`);for(let n of t)g.stdout.write(` ${l.dim(d(e[n],n))}\n`)}}function F(e){let{steps:t,events:n,...r}=e;return r}export{j as FlowStepRenderer,_ as commandWatch,w as gateLine,T as gateRunningLine,O as paintPlain,N as printFollow,P as printLedger,M as printRunSummary,F as resultJson,y as stepSymbol,S as taskLabel,C as taskLine};
@@ -1 +1 @@
1
- import{Q as e}from"./dispatch-BKeAch9E.js";import t from"node:process";async function n(n,r,i){let a=n.envKey?t.env[n.envKey]:void 0,o=!1;for(let t of e(n.baseUrl,r))try{let e=await fetch(t,{method:`POST`,headers:{"content-type":`application/json`,...a?{Authorization:`Bearer ${a}`}:{}},body:JSON.stringify(i),signal:AbortSignal.timeout(5e3)});if(o=!0,e.status!==404&&e.status!==405&&e.status!==501)return{baseUrl:t.slice(0,-(r.length+1))}}catch{}return{reachable:o}}async function r(e){let t=await n(e,`responses`,{model:e.model,input:[],stream:!1});if(`baseUrl`in t)return{wireApi:`responses`,baseUrl:t.baseUrl};let r=await n(e,`chat/completions`,{model:e.model,messages:[],stream:!1});return`baseUrl`in r?{wireApi:`chat`,baseUrl:r.baseUrl}:t.reachable||r.reachable?{wireApi:`chat`}:null}export{r as t};
1
+ import{Q as e}from"./dispatch-BsW_1m7e.js";import t from"node:process";async function n(n,r,i){let a=n.envKey?t.env[n.envKey]:void 0,o=!1;for(let t of e(n.baseUrl,r))try{let e=await fetch(t,{method:`POST`,headers:{"content-type":`application/json`,...a?{Authorization:`Bearer ${a}`}:{}},body:JSON.stringify(i),signal:AbortSignal.timeout(5e3)});if(o=!0,e.status!==404&&e.status!==405&&e.status!==501)return{baseUrl:t.slice(0,-(r.length+1))}}catch{}return{reachable:o}}async function r(e){let t=await n(e,`responses`,{model:e.model,input:[],stream:!1});if(`baseUrl`in t)return{wireApi:`responses`,baseUrl:t.baseUrl};let r=await n(e,`chat/completions`,{model:e.model,messages:[],stream:!1});return`baseUrl`in r?{wireApi:`chat`,baseUrl:r.baseUrl}:t.reachable||r.reachable?{wireApi:`chat`}:null}export{r as t};
@@ -0,0 +1 @@
1
+ import{Ht as e}from"./dispatch-BsW_1m7e.js";import{i as t}from"./cli-B1ObVrL4.js";import{i as n}from"./output-BKeyLbvt.js";import{s as r}from"./args-DcBCtXhz.js";import i from"node:process";const a=t({name:`task worker`,options:{cwd:r},args:1,async run({args:[t],cwd:r}){let{startAgentMailbox:a}=await import(`./exec-DuUkLMqg.js`).then(e=>e.i),{runWorker:o}=await import(`./worker-nHemduM_.js`),s=e(r,t);s||n(`Worker: task ${t} not found.`),await o(r,s,a).catch(()=>i.exit(1))}});export{a as commandWorker};
@@ -0,0 +1,9 @@
1
+ import{Dt as e,F as t,Ht as n,I as r,J as i,M as a,Nn as o,O as s,S as c,_ as l,c as u,fn as d,ft as f,jt as p,ln as m,mt as h,nt as g,on as _,pt as v,rn as y,tt as b,ut as x}from"./dispatch-BsW_1m7e.js";import{t as S}from"./chat-bridge-DXgZItGP.js";import{t as C}from"./wire-DzGLZ3-O.js";import w from"node:path";import T from"node:process";import E from"node:fs";function D(e){if(e.resumeThreadId)return e.currentPrompt??e.prompt??``;let t=e.system?`\n-------\n${e.system}`:``;return`<system>
2
+ You are running inside a coder task: do the work yourself, directly.
3
+ Do not load the coder skill (recursive), and never dispatch through the \`coder\` CLI - nested dispatch is disabled.
4
+ When finished, provide a concise implementation result summary.
5
+ Your turn is one-shot: background processes will not re-invoke you after it ends, so verify synchronously before finishing.
6
+ Never run git write operations (commit, checkout, stash, reset, rebase, merge, push, etc.); leave changes uncommitted for the caller to review.${e.agentId?"\nFlows are the exception: run one from your shell with `coder flow run <name> --wait --json --args '<json>'`; it runs as a script in your sandbox.":``}${t}
7
+ </system>
8
+
9
+ ${e.prompt??``}`}function O(e,t){let n=0;return()=>{Date.now()-n>=1e4&&(n=Date.now(),m(e,t))}}function k(t,n,{echo:r}){return i=>{let a=typeof i==`string`?{message:i}:i;e(t,n,a),r&&a.message&&T.stderr.write(`[coder] ${a.message}\n`)}}async function A(n,o,{echo:s}){let c=_(n),p=y(n,o.id),m=g(n),w=k(n,o.id,{echo:s}),E=i[o.permissions??`auto`]??i.auto,A=E.approvalPolicy===`never`?void 0:l({workspaceRoot:c,taskDir:p,mode:E.approvalMode,escalationTimeoutMs:m.approvals.escalationTimeoutMs,allowedNetworkHosts:m.approvals.allowedNetworkHosts,onEvent:t=>{e(n,o.id,t),s&&t.message&&T.stderr.write(`[coder] ${t.message}\n`)}}),j=o.model?m.models?.[o.model]:void 0,N=j&&b(j)?j:void 0;if(N&&!N.wireApi&&o.model){let t=await C(N);t&&(N={...N,...t},m.models[o.model]=N,x(n,o.model,t),e(n,o.id,{kind:`info`,message:`detected wire api for ${o.model}: ${t.wireApi} @ ${N.baseUrl}`}))}if(N?.envKey&&!T.env[N.envKey])throw Error(`Missing environment variable: \`${N.envKey}\`.`);let P=N?await S(N,N.wireApi??`chat`):null,F=h(m,o.model,P??void 0),I=r(n,o);try{let e=await a(n,{prompt:D(o),outputSchema:o.outputSchema,model:F?.model??f(o.model),modelProvider:F?.modelProvider??null,configOverrides:I?{...F?.configOverrides,"shell_environment_policy.set":{[t]:I}}:F?.configOverrides??null,effort:o.effort,sandbox:E.sandbox,approvalPolicy:E.approvalPolicy,networkAccess:v(o.permissions??`auto`,m.engines.codex?.network),approvalsReviewer:E.approvalMode===`auto`?`auto_review`:null,mcpServers:u(o.mcp),nativeMcp:o.nativeMcp??!1,writableRoots:[...E.sandbox===`read-only`?[]:o.addDirs??[],...I?[I]:[]],onApprovalRequest:A,onHeartbeat:O(n,o.id),resumeThreadId:o.resumeThreadId??null,onControlReady:(e,t,r)=>{d(n,o.id,{status:`running`,steerEndpoint:e,threadId:t,turnId:r})},onProgress:e=>{w(e);let t=typeof e==`object`?e.threadId:null,r=typeof e==`object`?e.turnId:null;(t||r)&&d(n,o.id,{status:`running`,...t?{threadId:t}:{},...r?{turnId:r}:{}})}});return d(n,o.id,{status:e.status===0?`completed`:`failed`,threadId:e.threadId,turnId:e.turnId,steerEndpoint:null,completedAt:new Date().toISOString()}),M(n,o,p,e),e}finally{d(n,o.id,{steerEndpoint:null}),await P?.close()}}async function j(e,n,{echo:a}){let o=y(e,n.id),c=g(e),l=k(e,n.id,{echo:a}),f=i[n.permissions??`auto`]??i.auto,p=r(e,n);try{let r=await s(e,{prompt:D(n),outputSchema:n.outputSchema,model:n.model,effort:n.effort,permissions:n.permissions,approvalTaskId:f.approvalMode===`auto`?n.id:null,allowedNetworkHosts:c.approvals.allowedNetworkHosts,additionalDirectories:n.addDirs,...p?{writableDirectories:[p],env:{[t]:p}}:{},mcpServers:u(n.mcp),nativeMcp:n.nativeMcp??!1,taskRoot:o,resumeSessionId:n.resumeThreadId??null,onHeartbeat:O(e,n.id),onSteerReady:t=>{d(e,n.id,{status:`running`,steerEndpoint:t})},onProgress:t=>{l(t),t.threadId&&d(e,n.id,{status:`running`,threadId:t.threadId})}});return d(e,n.id,{status:r.status===0?`completed`:`failed`,threadId:r.threadId,steerEndpoint:null,completedAt:new Date().toISOString()}),M(e,n,o,r),r}finally{d(e,n.id,{steerEndpoint:null})}}function M(e,t,n,r){o(w.join(n,`result.json`),r);let i={at:new Date().toISOString(),prompt:t.currentPrompt??t.prompt??null,...r};E.appendFileSync(w.join(n,`results.jsonl`),`${JSON.stringify(i)}\n`,`utf8`)}function N(e){return e.engine===`claude`?j:A}async function P(t,r){for(let i=0;i<2;){let a=n(t,r);if(!a||a.status===`failed`||a.status===`cancelled`)return;let o=p(t,r);if(o.length===0){i+=1,await new Promise(e=>setTimeout(e,300));continue}i=0;for(let n of o){let i=d(t,r,{status:`running`,currentPrompt:n,resumeThreadId:a.threadId??null});e(t,r,{message:`Running steered follow-up.`});try{await N(i)(t,i,{echo:!1})}catch(n){let i=n instanceof Error?n.message:String(n);d(t,r,{status:`failed`,error:i}),e(t,r,{kind:`error`,message:i});return}}}}async function F(t,r,i){if(r.dispatchId&&!r.resumedAt)try{E.writeFileSync(w.join(y(t,r.id),`start-${r.dispatchId}`),``,{flag:`wx`})}catch(e){if(e.code===`EEXIST`)return;throw e}d(t,r.id,{status:`running`,pid:T.pid});let a=()=>{},o;try{if(a=i(t,r),r.name?.startsWith(`agent:`)){let{startInboxControl:e,applyTaskMessage:i}=await import(`./task-CpUI19o2.js`).then(e=>e.d);o=e(y(t,r.id),r.name.slice(6),e=>i(t,n(t,r.id)??r,e))}if(r.simulateApproval){let n=await c(y(t,r.id),{onEvent:n=>e(t,r.id,n)});if(e(t,r.id,{message:`simulated approval: ${n}`}),n===`decline`){d(t,r.id,{status:`cancelled`,completedAt:new Date().toISOString(),error:`simulated approval denied`});return}}await N(r)(t,r,{echo:!1}),await P(t,r.id)}catch(n){let i=n instanceof Error?n.message:String(n);throw d(t,r.id,{status:`failed`,error:i}),e(t,r.id,{kind:`error`,message:i}),n}finally{a(),await o?.close()}}export{F as runWorker};
@@ -1 +1 @@
1
- import{i as e}from"./cli-DWCR7iqa.js";import t from"node:process";const n=e({name:`server workflow`,globalFlags:{json:!1,cwd:!1},help:{usage:`coder server workflow`,summary:`Print the workflow the github-actions runner dispatches. Save it as .github/workflows/coder-agent.yml in every repo the agent runs on, and set RUNNER=github-actions on the server.`,examples:[[`coder server workflow > .github/workflows/coder-agent.yml`,`add it to a repo`]]},options:{},run:async()=>{let{ACTIONS_WORKFLOW_YAML:e}=await import(`./github-actions-DwUzm4hC.js`).then(e=>e.r);return e},print:e=>t.stdout.write(e)});export{n as commandServerWorkflow};
1
+ import{i as e}from"./cli-B1ObVrL4.js";import t from"node:process";const n=e({name:`server workflow`,globalFlags:{json:!1,cwd:!1},help:{usage:`coder server workflow`,summary:`Print the workflow the github-actions runner dispatches. Save it as .github/workflows/coder-agent.yml in every repo the agent runs on, and set RUNNER=github-actions on the server.`,examples:[[`coder server workflow > .github/workflows/coder-agent.yml`,`add it to a repo`]]},options:{},run:async()=>{let{ACTIONS_WORKFLOW_YAML:e}=await import(`./github-actions-C_NkHVJq.js`).then(e=>e.r);return e},print:e=>t.stdout.write(e)});export{n as commandServerWorkflow};
package/docs/mcp.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MCP
2
2
 
3
- Give tasks tools of your own: an MCP server is saved once under `mcp` in `.coder/config.json`, then attached to a task by name. Nothing attaches unless asked, so the default run stays lean.
3
+ Give tasks tools of your own: an MCP server is saved once under `mcp` in `.coder/config.json`, then attached to a task by name. Nothing attaches unless asked, so the default run stays lean. `--mcp all` also loads your engine's own MCP servers and connectors.
4
4
 
5
5
  ```sh
6
6
  coder mcp add docs -- npx -y docs-mcp # stdio server: the command after --
@@ -209,6 +209,12 @@ CREATE TABLE "coder"."task_log" (
209
209
  CONSTRAINT "task_log_taskId_seq_unique" UNIQUE("task_id","seq")
210
210
  );
211
211
  --> statement-breakpoint
212
+ CREATE TABLE "coder"."task_tombstone" (
213
+ "organization_id" text NOT NULL,
214
+ "public_id" text NOT NULL,
215
+ "deleted_at" timestamp with time zone NOT NULL
216
+ );
217
+ --> statement-breakpoint
212
218
  CREATE TABLE "coder"."usage" (
213
219
  "id" bigserial PRIMARY KEY NOT NULL,
214
220
  "organization_id" text NOT NULL,
@@ -246,7 +252,9 @@ CREATE INDEX "platform_link_user_id_index" ON "coder"."platform_link" USING btre
246
252
  CREATE INDEX "secret_organization_id_kind_index" ON "coder"."secret" USING btree ("organization_id","kind");--> statement-breakpoint
247
253
  CREATE INDEX "task_public_id_index" ON "coder"."task" USING btree ("public_id");--> statement-breakpoint
248
254
  CREATE INDEX "task_organization_id_created_at_public_id_index" ON "coder"."task" USING btree ("organization_id","created_at" DESC NULLS LAST,"public_id" DESC NULLS LAST);--> statement-breakpoint
255
+ CREATE INDEX "task_organization_id_updated_at_index" ON "coder"."task" USING btree ("organization_id","updated_at");--> statement-breakpoint
249
256
  CREATE INDEX "task_organization_id_index" ON "coder"."task" USING btree ("organization_id") WHERE "coder"."task"."status" = 'queued';--> statement-breakpoint
250
257
  CREATE INDEX "task_status_created_at_index" ON "coder"."task" USING btree ("status","created_at");--> statement-breakpoint
251
258
  CREATE INDEX "task_inbox_task_id_generation_seq_index" ON "coder"."task_inbox" USING btree ("task_id","generation","seq");--> statement-breakpoint
259
+ CREATE INDEX "task_tombstone_organization_id_deleted_at_index" ON "coder"."task_tombstone" USING btree ("organization_id","deleted_at");--> statement-breakpoint
252
260
  CREATE INDEX "usage_organization_id_at_index" ON "coder"."usage" USING btree ("organization_id","at");
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "2e1b3c0d-b7bb-4f29-a390-80eb06881eab",
2
+ "id": "457fd83b-7007-422f-a78d-04d4303e33ba",
3
3
  "prevId": "00000000-0000-0000-0000-000000000000",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
@@ -1336,6 +1336,27 @@
1336
1336
  "method": "btree",
1337
1337
  "with": {}
1338
1338
  },
1339
+ "task_organization_id_updated_at_index": {
1340
+ "name": "task_organization_id_updated_at_index",
1341
+ "columns": [
1342
+ {
1343
+ "expression": "organization_id",
1344
+ "isExpression": false,
1345
+ "asc": true,
1346
+ "nulls": "last"
1347
+ },
1348
+ {
1349
+ "expression": "updated_at",
1350
+ "isExpression": false,
1351
+ "asc": true,
1352
+ "nulls": "last"
1353
+ }
1354
+ ],
1355
+ "isUnique": false,
1356
+ "concurrently": false,
1357
+ "method": "btree",
1358
+ "with": {}
1359
+ },
1339
1360
  "task_organization_id_index": {
1340
1361
  "name": "task_organization_id_index",
1341
1362
  "columns": [
@@ -1612,6 +1633,59 @@
1612
1633
  "checkConstraints": {},
1613
1634
  "isRLSEnabled": false
1614
1635
  },
1636
+ "coder.task_tombstone": {
1637
+ "name": "task_tombstone",
1638
+ "schema": "coder",
1639
+ "columns": {
1640
+ "organization_id": {
1641
+ "name": "organization_id",
1642
+ "type": "text",
1643
+ "primaryKey": false,
1644
+ "notNull": true
1645
+ },
1646
+ "public_id": {
1647
+ "name": "public_id",
1648
+ "type": "text",
1649
+ "primaryKey": false,
1650
+ "notNull": true
1651
+ },
1652
+ "deleted_at": {
1653
+ "name": "deleted_at",
1654
+ "type": "timestamp with time zone",
1655
+ "primaryKey": false,
1656
+ "notNull": true
1657
+ }
1658
+ },
1659
+ "indexes": {
1660
+ "task_tombstone_organization_id_deleted_at_index": {
1661
+ "name": "task_tombstone_organization_id_deleted_at_index",
1662
+ "columns": [
1663
+ {
1664
+ "expression": "organization_id",
1665
+ "isExpression": false,
1666
+ "asc": true,
1667
+ "nulls": "last"
1668
+ },
1669
+ {
1670
+ "expression": "deleted_at",
1671
+ "isExpression": false,
1672
+ "asc": true,
1673
+ "nulls": "last"
1674
+ }
1675
+ ],
1676
+ "isUnique": false,
1677
+ "concurrently": false,
1678
+ "method": "btree",
1679
+ "with": {}
1680
+ }
1681
+ },
1682
+ "foreignKeys": {},
1683
+ "compositePrimaryKeys": {},
1684
+ "uniqueConstraints": {},
1685
+ "policies": {},
1686
+ "checkConstraints": {},
1687
+ "isRLSEnabled": false
1688
+ },
1615
1689
  "coder.usage": {
1616
1690
  "name": "usage",
1617
1691
  "schema": "coder",
@@ -5,7 +5,7 @@
5
5
  {
6
6
  "idx": 0,
7
7
  "version": "7",
8
- "when": 1791302072514,
8
+ "when": 1791495285718,
9
9
  "tag": "0000_initial",
10
10
  "breakpoints": true
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wular/coder",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Delegating coding-agent runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/sdk.js",
@@ -21,6 +21,7 @@ If `coder` is not on PATH, install it yourself without asking: `npm install -g @
21
21
 
22
22
  - The CLI is the reference. `coder --help` and every subcommand's `--help` list the flags and exit codes, and each command prints the recommended next step when it returns. Follow it.
23
23
  - `coder docs` lists the deeper guides; `coder docs <topic>` prints one.
24
+ - Wait on each task with `coder task result <task-id> --wait` in its own background shell, one per task, never several tasks in one call, so each approval and answer reaches you.
24
25
  - If your harness sandboxes or gates terminal commands (Codex does both), run every `coder` command with escalated permissions; the runtime is a supervisor with its own sandbox and approval policy.
25
26
 
26
27
  ## Running tasks
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Delegate coding tasks to supervised Coder subagents running on Codex, Claude, or any OpenAI-compatible model. Your main context stays clean.",
5
5
  "author": {
6
6
  "name": "muzam1l"
@@ -21,7 +21,7 @@ If `coder` is not on PATH, install it yourself without asking: `npm install -g @
21
21
 
22
22
  - The CLI is the reference. `coder --help` and every subcommand's `--help` list the flags and exit codes, and each command prints the recommended next step when it returns. Follow it.
23
23
  - `coder docs` lists the deeper guides; `coder docs <topic>` prints one.
24
- - Run each `coder task result <task-id> --wait` as a background Bash call (run_in_background) so you are re-invoked when it returns.
24
+ - Run each `coder task result <task-id> --wait` as its own background Bash call (run_in_background), one per task, never several tasks in one call, so each approval and answer re-invokes you.
25
25
 
26
26
  ## Running tasks
27
27
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "coder",
3
3
  "displayName": "Coder",
4
- "version": "0.4.2",
4
+ "version": "0.4.3",
5
5
  "description": "Delegate coding tasks to supervised Coder subagents running on Codex, Claude, or any OpenAI-compatible model. Your main context stays clean.",
6
6
  "author": {
7
7
  "name": "muzam1l"
@@ -21,6 +21,7 @@ If `coder` is not on PATH, install it yourself without asking: `npm install -g @
21
21
 
22
22
  - The CLI is the reference. `coder --help` and every subcommand's `--help` list the flags and exit codes, and each command prints the recommended next step when it returns. Follow it.
23
23
  - `coder docs` lists the deeper guides; `coder docs <topic>` prints one.
24
+ - Wait on each task with `coder task result <task-id> --wait` in its own background shell, one per task, never several tasks in one call, so each approval and answer reaches you.
24
25
  - If Cursor asks before running `coder` commands, approve or allowlist `coder`; the runtime is a supervisor with its own sandbox and approval policy.
25
26
 
26
27
  ## Running tasks
@@ -327,6 +327,12 @@ export class ServerClient<D extends ClientTypes = ClientTypes> {
327
327
  headers: { accept: 'text/event-stream' },
328
328
  signal,
329
329
  }),
330
+ /** One stream of the named tasks' changes and every list change in the workspace; `last` resumes after an event id. */
331
+ events: (ids: string[], last?: string, signal?: AbortSignal): Promise<Response> =>
332
+ this.send(queryPath('/admin/events', { tasks: ids }), {
333
+ headers: { accept: 'text/event-stream', ...(last ? { 'last-event-id': last } : {}) },
334
+ signal,
335
+ }),
330
336
  cancel: (id: string): Promise<{ ok: true }> =>
331
337
  this.post(`/admin/tasks/${encodeURIComponent(id)}/cancel`),
332
338
  steer: (id: string, text: string) =>
@@ -552,7 +558,7 @@ export class ServerClient<D extends ClientTypes = ClientTypes> {
552
558
  /** Server-Sent Events from a response body, one `{ event, data }` per message. */
553
559
  export async function* serverEvents(
554
560
  body: ReadableStream<Uint8Array>,
555
- ): AsyncGenerator<{ event: string; data: string }> {
561
+ ): AsyncGenerator<{ event: string; data: string; id?: string }> {
556
562
  const decoder = new TextDecoder();
557
563
  let buffer = '';
558
564
  for await (const chunk of body as unknown as AsyncIterable<Uint8Array>) {
@@ -562,12 +568,14 @@ export async function* serverEvents(
562
568
  const block = buffer.slice(0, end);
563
569
  buffer = buffer.slice(end + 2);
564
570
  let event = 'message';
571
+ let id: string | undefined;
565
572
  const data: string[] = [];
566
573
  for (const line of block.split('\n')) {
567
574
  if (line.startsWith('event: ')) event = line.slice(7);
568
575
  else if (line.startsWith('data: ')) data.push(line.slice(6));
576
+ else if (line.startsWith('id: ')) id = line.slice(4);
569
577
  }
570
- if (data.length) yield { event, data: data.join('\n') };
578
+ if (data.length || id) yield { event, data: data.join('\n'), ...(id ? { id } : {}) };
571
579
  }
572
580
  }
573
581
  }
@@ -18,6 +18,9 @@ export interface TaskRow {
18
18
  text?: string;
19
19
  thread?: { number?: number };
20
20
  };
21
+ /** The agent's engine settings, and what this task ran with over them. */
22
+ definition?: { engine?: string; model?: string; effort?: string };
23
+ usage?: { engine?: string; model?: string; effort?: string };
21
24
  };
22
25
  status: TaskState;
23
26
  statusReason?: string;
@@ -145,6 +148,21 @@ export interface UsagePage {
145
148
  summary: UsageAmount & { agents: number };
146
149
  }
147
150
 
151
+ /** One task change on `/admin/events`; `result`, `error` and `answer` come, maybe null, for asked tasks only. */
152
+ export type TaskEvent =
153
+ | (Pick<
154
+ TaskRow,
155
+ 'status' | 'approval' | 'archivedAt' | 'createdAt' | 'startedAt' | 'finishedAt'
156
+ > & {
157
+ id: string;
158
+ agent: string;
159
+ result?: TaskRow['result'] | null;
160
+ error?: string | null;
161
+ answer?: unknown[] | null;
162
+ deleted?: never;
163
+ })
164
+ | { id: string; deleted: true };
165
+
148
166
  export interface TaskCounts {
149
167
  all: number;
150
168
  active: number;
@@ -23,3 +23,14 @@ export const DEFAULT_CONFIG: CoderConfig = {
23
23
  allowedNetworkHosts: [],
24
24
  },
25
25
  };
26
+
27
+ /** The default task list's groups: failed first, then active, then other stopped, then completed. */
28
+ export const listRank = (status: string) =>
29
+ status === 'failed' ? 0 : status === 'completed' ? 3 : status === 'cancelled' ? 2 : 1;
30
+
31
+ /** A row's place in the task list, which keyset cursors carry. */
32
+ export type ListKey = { rank: number; createdAt: number; id: string };
33
+
34
+ /** The task list order: `listRank` groups, newest start first, ties broken by id. */
35
+ export const byListKey = (a: ListKey, b: ListKey) =>
36
+ a.rank - b.rank || b.createdAt - a.createdAt || (b.id < a.id ? -1 : b.id > a.id ? 1 : 0);
@@ -37,12 +37,16 @@ export interface TaskDisplayRow {
37
37
  tool?: string;
38
38
  exitCode?: number;
39
39
  tokens?: TokenUsage;
40
+ result?: { ok: boolean; exitCode?: number; durationMs: number; detail: string };
41
+ state?: string;
40
42
  }
41
43
 
42
44
  export const isApproval = (kind: string) =>
43
45
  kind.includes('approval') || kind === 'sidecar-decision' || kind === 'auto-review';
44
46
 
45
- function stripCwd(text: string, cwd?: string): string {
47
+ const ANSI = /\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g;
48
+
49
+ export function stripCwd(text: string, cwd?: string): string {
46
50
  return cwd ? text.split(`${cwd}/`).join('').split(cwd).join('.') : text;
47
51
  }
48
52
 
@@ -70,19 +74,38 @@ export function logEntry(line: string): TaskLogEntry | undefined {
70
74
  export class LogView {
71
75
  private prevKind: string | null = null;
72
76
  private lastAssistant = '';
73
- private lastTool: string | null = null;
74
77
  private lastToolText = '';
78
+ private openCalls: TaskDisplayRow[] = [];
79
+ // Engine invocation ids, so concurrent calls of one tool close with their own results.
80
+ private callIds = new WeakMap<TaskDisplayRow, string>();
81
+ private approval: TaskDisplayRow | undefined;
82
+ private approvals = new Map<string, TaskDisplayRow>();
75
83
  private lastUsageTotal = 0;
76
84
 
77
- constructor(private readonly cwd?: string) {}
85
+ constructor(
86
+ private readonly cwd?: string,
87
+ private readonly opts: { keepAnsi?: boolean } = {},
88
+ ) {}
78
89
 
79
90
  get lastAssistantMessage(): string {
80
91
  return this.lastAssistant;
81
92
  }
82
93
 
94
+ /** A result or verdict that completes an earlier call or approval returns that row again, keyed by its seq. */
83
95
  reduce(record: TaskLog): TaskDisplayRow[] {
84
96
  const entry = record.entry;
85
97
  const sourceKind = entry ? String(entry.kind ?? 'status') : 'line';
98
+ const earlier = !entry
99
+ ? undefined
100
+ : sourceKind === 'tool-result'
101
+ ? this.close(record, entry)
102
+ : isApproval(sourceKind)
103
+ ? this.decide(record, entry, sourceKind)
104
+ : undefined;
105
+ if (earlier) {
106
+ this.prevKind = sourceKind;
107
+ return [earlier];
108
+ }
86
109
  const row: TaskDisplayRow = {
87
110
  seq: record.seq,
88
111
  at: record.at,
@@ -109,6 +132,25 @@ export class LogView {
109
132
  row.kind = 'usage';
110
133
  row.tokens = tokens;
111
134
  row.title = `ctx ${tokenCount(tokens.input + tokens.cachedInput)} · out ${tokenCount(tokens.output)}`;
135
+ } else if (
136
+ (sourceKind === 'approval-decision' && entry.decision === 'escalate') ||
137
+ sourceKind === 'approval-escalated'
138
+ ) {
139
+ const summary = stripCwd(entry.summary ? String(entry.summary) : '', this.cwd);
140
+ const target =
141
+ /^(?:run command: |Run command\. |Apply file changes\. |\w+: )?([\s\S]*)$/.exec(
142
+ summary,
143
+ )![1]!;
144
+ const method = String(entry.method ?? '');
145
+ const name = method && !method.includes('/') ? method : this.openCalls.at(-1)?.tool;
146
+ const word = target.startsWith('{') ? '' : target.split(/\s+/)[0];
147
+ const reason = stripCwd(entry.reason ? String(entry.reason) : '', this.cwd);
148
+ row.kind = 'approval';
149
+ row.title = ['Approval', [name, word].filter(Boolean).join(' ')].filter(Boolean).join(' · ');
150
+ row.detail = [target, reason && `Policy · ${reason}`].filter(Boolean).join('\n');
151
+ row.state = sourceKind === 'approval-escalated' ? 'waiting' : 'escalated';
152
+ if (sourceKind === 'approval-escalated') this.approvals.set(String(entry.approvalId), row);
153
+ else this.approval = row;
112
154
  } else if (isApproval(sourceKind) && (entry.decision || !entry.message)) {
113
155
  row.kind = 'approval';
114
156
  const label =
@@ -141,18 +183,20 @@ export class LogView {
141
183
  row.durationMs = typeof entry.durationMs === 'number' ? entry.durationMs : 0;
142
184
  } else if (sourceKind === 'tool') {
143
185
  row.kind = 'tool';
144
- this.lastTool = entry.tool ? String(entry.tool) : null;
186
+ if (entry.tool) row.tool = String(entry.tool);
145
187
  this.lastToolText = row.title;
188
+ if (entry.callId) this.callIds.set(row, String(entry.callId));
189
+ this.openCalls.push(row);
146
190
  } else if (sourceKind === 'tool-result') {
147
191
  row.kind = 'tool-result';
192
+ row.title = this.output(raw);
148
193
  row.exitCode = typeof entry.exitCode === 'number' ? entry.exitCode : undefined;
149
194
  row.tone =
150
195
  (row.exitCode !== undefined && row.exitCode !== 0) || entry.isError === true
151
196
  ? 'error'
152
197
  : 'muted';
153
198
  row.durationMs = typeof entry.durationMs === 'number' ? entry.durationMs : 0;
154
- const tool = entry.tool ? String(entry.tool) : null;
155
- if (tool && tool !== this.lastTool) row.tool = tool;
199
+ if (entry.tool) row.tool = String(entry.tool);
156
200
  }
157
201
  }
158
202
  if (this.prevKind !== null) {
@@ -164,6 +208,76 @@ export class LogView {
164
208
  this.prevKind = sourceKind;
165
209
  return [row];
166
210
  }
211
+
212
+ // A result closes the call with its invocation id; without one, the oldest open call of its tool, or the latest call.
213
+ private close(record: TaskLog, entry: TaskLogEntry): TaskDisplayRow | undefined {
214
+ const tool = entry.tool ? String(entry.tool) : undefined;
215
+ const byId = entry.callId
216
+ ? this.openCalls.findIndex(call => this.callIds.get(call) === String(entry.callId))
217
+ : -1;
218
+ const index =
219
+ byId >= 0
220
+ ? byId
221
+ : tool
222
+ ? this.openCalls.findIndex(call => call.tool === tool)
223
+ : this.openCalls.length - 1;
224
+ if (index < 0) return undefined;
225
+
226
+ const [call] = this.openCalls.splice(index, 1);
227
+ const exitCode = typeof entry.exitCode === 'number' ? entry.exitCode : undefined;
228
+ const durationMs =
229
+ typeof entry.durationMs === 'number' ? entry.durationMs : record.at - call!.at || 0;
230
+ return {
231
+ ...call!,
232
+ result: {
233
+ ok: !exitCode && entry.isError !== true,
234
+ exitCode,
235
+ durationMs: Math.max(0, durationMs),
236
+ detail: this.output(entry.message ? String(entry.message) : ''),
237
+ },
238
+ };
239
+ }
240
+
241
+ // Sidecar verdicts and escalations follow the policy verdict before them; answers carry the approval id.
242
+ private decide(record: TaskLog, entry: TaskLogEntry, kind: string): TaskDisplayRow | undefined {
243
+ const id = String(entry.approvalId ?? '');
244
+ const accepted = entry.decision === 'accept';
245
+ if (kind === 'sidecar-decision' && this.approval) {
246
+ const reason = stripCwd(entry.reason ? String(entry.reason) : '', this.cwd);
247
+ const row = {
248
+ ...this.approval,
249
+ detail: [this.approval.detail, reason && `Sidecar · ${reason}`].filter(Boolean).join('\n'),
250
+ };
251
+ if (entry.decision === 'escalate') return (this.approval = row);
252
+ this.approval = undefined;
253
+ return settle(row, record, `${accepted ? 'accepted' : 'denied'} by sidecar`, accepted);
254
+ }
255
+ if (kind === 'approval-escalated' && this.approval) {
256
+ const row = { ...this.approval, state: 'waiting' };
257
+ this.approval = undefined;
258
+ this.approvals.set(id, row);
259
+ return row;
260
+ }
261
+ const open = this.approvals.get(id);
262
+ if (!open || (kind !== 'approval-answered' && kind !== 'approval-timeout')) return undefined;
263
+
264
+ this.approvals.delete(id);
265
+ return kind === 'approval-timeout'
266
+ ? settle(open, record, 'timed out', false)
267
+ : settle(open, record, `${accepted ? 'accepted' : 'denied'} by reviewer`, accepted);
268
+ }
269
+
270
+ private output(text: string): string {
271
+ return stripCwd(this.opts.keepAnsi ? text : text.replace(ANSI, ''), this.cwd);
272
+ }
273
+ }
274
+
275
+ function settle(row: TaskDisplayRow, record: TaskLog, state: string, ok: boolean): TaskDisplayRow {
276
+ return {
277
+ ...row,
278
+ state,
279
+ result: { ok, durationMs: Math.max(0, record.at - row.at || 0), detail: '' },
280
+ };
167
281
  }
168
282
 
169
283
  function tokenCount(n: number): string {
@@ -1,9 +1,13 @@
1
1
  import { Link } from '@wular/pnext/link';
2
2
 
3
+ import { iAgent } from '@/comps/ui/icons';
4
+ import { Icon } from '@/comps/ui/icon';
5
+
3
6
  /** Make a dashboard agent; importing from a repository starts from the same page. */
4
7
  export function NewAgentMenu() {
5
8
  return (
6
9
  <Link class="btn" href="/dash/agents/new">
10
+ <Icon d={iAgent} />
7
11
  New agent
8
12
  </Link>
9
13
  );