@wular/coder 0.3.18 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/README.md +18 -16
  2. package/bin/coder.mjs +3 -1
  3. package/dist/actions-Mk3FSlpJ.js +20 -0
  4. package/dist/adapter-B0oYCI0S.js +1 -0
  5. package/dist/adapter-BKVzTDnn.js +1 -0
  6. package/dist/adapter-DPInwbJG.js +1 -0
  7. package/dist/adapter-DaiJMOYo.js +1 -0
  8. package/dist/adapter-PeKziOUg.js +1 -0
  9. package/dist/add-BxpLHnvD.js +1 -0
  10. package/dist/add-CE-70LFs.js +1 -0
  11. package/dist/add-U-pty9qJ.js +6 -0
  12. package/dist/add-ej0X9e3a.js +1 -0
  13. package/dist/add-json-CEa-6luW.js +1 -0
  14. package/dist/agent-BsYx3Odz.js +3 -0
  15. package/dist/agent-JdtZozvP.js +1 -0
  16. package/dist/alias-DX-Bm86x.js +2 -0
  17. package/dist/app-BT5f7zL5.js +1 -0
  18. package/dist/approvals-C-AvFt6s.js +2 -0
  19. package/dist/approve-DOmpQRNd.js +2 -0
  20. package/dist/apps-CjfrZyM5.js +1 -0
  21. package/dist/archive-BUB8gFKD.js +4 -0
  22. package/dist/archive-BziJ1rQ-.js +3 -0
  23. package/dist/archive-sweep-CtBcARgN.js +1 -0
  24. package/dist/args-BOEEdpWk.js +1 -0
  25. package/dist/ask-dE3U3ss2.js +4 -0
  26. package/dist/auth-BFny--17.js +1 -0
  27. package/dist/auth-DWHIzqbA.js +1 -0
  28. package/dist/builtin/coder/agent.json +24 -0
  29. package/dist/builtin/coder/system.md +17 -0
  30. package/dist/chat-3Znsevah.js +1 -0
  31. package/dist/chat-B_yhNTo0.js +13 -0
  32. package/dist/chat-bridge-BS9WtP3X.js +2 -0
  33. package/dist/cli-BilSDkvE.js +9 -0
  34. package/dist/cli.d.ts +71 -1
  35. package/dist/cli.js +1 -91
  36. package/dist/client-D9IoAuDD.js +1 -0
  37. package/dist/config-Da_cwoxI.js +3 -0
  38. package/dist/create-C_iMJV4Y.js +1 -0
  39. package/dist/credentials-B1jv6dkg.js +1 -0
  40. package/dist/dash/manifest.json +3427 -0
  41. package/dist/dash/public/assets/apple-touch-icon.png +0 -0
  42. package/dist/dash/public/assets/chunks/agent-pills-69c965aae1737cef.js +1 -0
  43. package/dist/dash/public/assets/chunks/agent-settings-form-a1ce70812eea3f20.js +1 -0
  44. package/dist/dash/public/assets/chunks/agents-grid-f62180478e43c192.js +1 -0
  45. package/dist/dash/public/assets/chunks/badge-d07f35e9abc80e14.js +1 -0
  46. package/dist/dash/public/assets/chunks/card-be04148b64223a52.js +1 -0
  47. package/dist/dash/public/assets/chunks/combo-32c321a7a84fa902.js +1 -0
  48. package/dist/dash/public/assets/chunks/composer-aec9c3c691f1f79a.js +1 -0
  49. package/dist/dash/public/assets/chunks/composer-data-6f7608fed13f3dd7.js +1 -0
  50. package/dist/dash/public/assets/chunks/composer-e56860d72742379e.js +1 -0
  51. package/dist/dash/public/assets/chunks/confirm-b4e2c16aef4b3431.js +1 -0
  52. package/dist/dash/public/assets/chunks/connect-apps-a5a63941e287c33f.js +1 -0
  53. package/dist/dash/public/assets/chunks/connect-repositories-e4c049b5b4384623.js +1 -0
  54. package/dist/dash/public/assets/chunks/credentials-list-2b7d0c771b89f9c5.js +2 -0
  55. package/dist/dash/public/assets/chunks/custom-range-53b70e0d9eeae84e.js +1 -0
  56. package/dist/dash/public/assets/chunks/editor-691d2bcecb1ecb87.js +7 -0
  57. package/dist/dash/public/assets/chunks/engines-list-a5fe1671601ce3b0.js +1 -0
  58. package/dist/dash/public/assets/chunks/field-9e12e5fc8774b6e5.js +1 -0
  59. package/dist/dash/public/assets/chunks/format-eb03fc9d9744d960.js +1 -0
  60. package/dist/dash/public/assets/chunks/heads-4041a925d63ab116.js +1 -0
  61. package/dist/dash/public/assets/chunks/instructions-4e0d18b9b40edbd7.js +2 -0
  62. package/dist/dash/public/assets/chunks/instructions-b00959bd4bb70502.js +1 -0
  63. package/dist/dash/public/assets/chunks/list-d7eb9e02cf261fbe.js +1 -0
  64. package/dist/dash/public/assets/chunks/mcp-list-a450533109045ef5.js +1 -0
  65. package/dist/dash/public/assets/chunks/model-options-15c53331a2f28a4f.js +1 -0
  66. package/dist/dash/public/assets/chunks/models-list-1e273c6843858148.js +1 -0
  67. package/dist/dash/public/assets/chunks/paged-bc6fa0c2b9d52ed7.js +1 -0
  68. package/dist/dash/public/assets/chunks/platform-actions-87f3f76ec1b840cb.js +1 -0
  69. package/dist/dash/public/assets/chunks/runners-list-fc7cdae4fa93e78b.js +1 -0
  70. package/dist/dash/public/assets/chunks/runtime-246221e985d863e5-1.js +2 -0
  71. package/dist/dash/public/assets/chunks/segmented-6091dfb2f954799f.js +1 -0
  72. package/dist/dash/public/assets/chunks/select-dd09a6b9544cfde2.js +1 -0
  73. package/dist/dash/public/assets/chunks/sentinel-ff7143a47fd22835.js +1 -0
  74. package/dist/dash/public/assets/chunks/shared-init-246221e985d863e5-2.js +1 -0
  75. package/dist/dash/public/assets/chunks/shared-init-8f2ac936c95a7f7b.js +1 -0
  76. package/dist/dash/public/assets/chunks/shared-init-986901c810947c12.js +5 -0
  77. package/dist/dash/public/assets/chunks/shared-init-baceed9fd2d43661.js +2 -0
  78. package/dist/dash/public/assets/chunks/tail-5a5bfcd308535d70.js +1 -0
  79. package/dist/dash/public/assets/chunks/task-actions-7919ca0e901131f4.js +1 -0
  80. package/dist/dash/public/assets/chunks/task-fa8b82e95e771c4a.js +1 -0
  81. package/dist/dash/public/assets/chunks/task-view-e8a0f99c992fa11e.js +3 -0
  82. package/dist/dash/public/assets/chunks/tasks-list-7b72f5b295349532.js +1 -0
  83. package/dist/dash/public/assets/chunks/toolbar-9b18a5d26dee37c3.js +1 -0
  84. package/dist/dash/public/assets/chunks/versions-list-8cdf3a41c56b2152.js +1 -0
  85. package/dist/dash/public/assets/chunks/wular-pnext-246221e985d863e5-0.js +1 -0
  86. package/dist/dash/public/assets/connect-382b1729a7ae7808.css +1 -0
  87. package/dist/dash/public/assets/dash-9e02d5d1a6d42ee3.css +1 -0
  88. package/dist/dash/public/assets/dash-account-04859899c1838ada.css +1 -0
  89. package/dist/dash/public/assets/dash-agents-9e678137267dec07.css +1 -0
  90. package/dist/dash/public/assets/dash-agents-new-26fa27b17ef9b8d8.css +1 -0
  91. package/dist/dash/public/assets/dash-agents-param-slug-b975c48f8abf3444.css +1 -0
  92. package/dist/dash/public/assets/dash-agents-param-slug-edit-e13fda599bb04843.css +1 -0
  93. package/dist/dash/public/assets/dash-agents-param-slug-platforms-70292932cb27bc96.css +1 -0
  94. package/dist/dash/public/assets/dash-agents-param-slug-settings-71f9a86251723fcc.css +1 -0
  95. package/dist/dash/public/assets/dash-agents-param-slug-tasks-fb8eb2ed71006601.css +1 -0
  96. package/dist/dash/public/assets/dash-agents-param-slug-usage-7c8740f1cdd52c71.css +1 -0
  97. package/dist/dash/public/assets/dash-settings-8eb818da462227e8.css +1 -0
  98. package/dist/dash/public/assets/dash-settings-param-tab-849a1a9542e273f5.css +1 -0
  99. package/dist/dash/public/assets/dash-tasks-81e510e0b6931b42.css +1 -0
  100. package/dist/dash/public/assets/dash-tasks-param-id-bbd2a83342f2ec10.css +1 -0
  101. package/dist/dash/public/assets/dash-usage-8e0259e03eaed1bd.css +1 -0
  102. package/dist/dash/public/assets/favicon.ico +0 -0
  103. package/dist/dash/public/assets/favicon.svg +1 -0
  104. package/dist/dash/public/assets/fonts/LICENSE-fira-code +93 -0
  105. package/dist/dash/public/assets/fonts/fira-code-latin-400-normal-717ee080.woff2 +0 -0
  106. package/dist/dash/public/assets/fonts/fira-code-latin-500-normal-530b6706.woff2 +0 -0
  107. package/dist/dash/public/assets/fonts/fira-code-latin-700-normal-98730669.woff2 +0 -0
  108. package/dist/dash/public/assets/global-d2adbf01910d9df5.css +1 -0
  109. package/dist/dash/public/assets/login-c129b1ce237be260.css +1 -0
  110. package/dist/dash/public/assets/pnext-client-073464b8f422ef57.js +1 -0
  111. package/dist/dash/public/assets/pnext-client-0b6720fdec66eeb0.js +1 -0
  112. package/dist/dash/public/assets/pnext-client-1e9cb2f4f6387a87.js +1 -0
  113. package/dist/dash/public/assets/pnext-client-2f0e78dd006fed0f.js +1 -0
  114. package/dist/dash/public/assets/pnext-client-3c62e2aa2cbe9fe1.js +1 -0
  115. package/dist/dash/public/assets/pnext-client-43a88896ed42dd39.js +1 -0
  116. package/dist/dash/public/assets/pnext-client-4cf2e27d0b9c0365.js +1 -0
  117. package/dist/dash/public/assets/pnext-client-587008fa987d3073.js +1 -0
  118. package/dist/dash/public/assets/pnext-client-676360cc86f31573.js +1 -0
  119. package/dist/dash/public/assets/pnext-client-813427605f424145.js +1 -0
  120. package/dist/dash/public/assets/pnext-client-82de7cf6dfc35b98.js +1 -0
  121. package/dist/dash/public/assets/pnext-client-831e8004c09f0b5b.js +1 -0
  122. package/dist/dash/public/assets/pnext-client-9b557fe468a45ca3.js +1 -0
  123. package/dist/dash/public/assets/pnext-client-ab7c900c802fe827.js +1 -0
  124. package/dist/dash/public/assets/pnext-client-d87d00e402811f0c.js +1 -0
  125. package/dist/dash/public/assets/pnext-client-fbdb7c1da7eda7e5.js +1 -0
  126. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/boot-B2MFTRO2.js +28 -0
  127. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/build-tier-XJJSL5FR.js +2702 -0
  128. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2HFY3DQT.js +206 -0
  129. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2ICEVELW.js +832 -0
  130. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-3UPROT2C.js +33 -0
  131. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4P5CMIYT.js +1580 -0
  132. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4TKZKZ3Q.js +129 -0
  133. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-5RDEILQB.js +435 -0
  134. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-62KEQM43.js +23 -0
  135. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-6KQSWT6D.js +829 -0
  136. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-7DCNCW6O.js +722 -0
  137. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-B4THCTQP.js +20 -0
  138. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-C2LIV2MM.js +170 -0
  139. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-CCATPVTW.js +376 -0
  140. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-COXJAPTU.js +87 -0
  141. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-E6IXL2NJ.js +6268 -0
  142. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FLGRBFAH.js +1196 -0
  143. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FTJVHFWD.js +59 -0
  144. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-H523KSIH.js +5149 -0
  145. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-HT6KKX6A.js +18 -0
  146. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JESFYECC.js +436 -0
  147. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JRPJM2XY.js +15 -0
  148. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L2IWDUXG.js +105 -0
  149. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L5P4Y4UC.js +181 -0
  150. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-NQE46AZN.js +645 -0
  151. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PA4QEARJ.js +127 -0
  152. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PZ5AXOLW.js +7144 -0
  153. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-SNVPTULL.js +2395 -0
  154. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-T3QZT3PG.js +218 -0
  155. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-VC5O2SDP.js +70 -0
  156. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-WZX4V6CM.js +229 -0
  157. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-XUUIDXY5.js +625 -0
  158. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-ZHFDO3PR.js +263 -0
  159. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/compile-CE2DN7ZA.js +16 -0
  160. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-UREY7XJT.js +14 -0
  161. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-loader-UI2XE3PZ.js +15 -0
  162. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/entry.js +217 -0
  163. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/generate-I2PPTDFD.js +14 -0
  164. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/modules-UVOCE4C2.js +46 -0
  165. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/pipeline-UW47K537.js +961 -0
  166. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/proxy-ITGOVJBW.js +24 -0
  167. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/register-4SA55SWT.js +12577 -0
  168. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/router-JNKHLBCZ.js +503 -0
  169. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/routes-PD6J2NXW.js +52 -0
  170. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/tsconfig-defaults-ZXEH7RQK.js +13 -0
  171. package/dist/default-Bobztoxf.js +1 -0
  172. package/dist/default-vYPT26DR.js +1 -0
  173. package/dist/delete-D8gEwoOj.js +4 -0
  174. package/dist/delete-z1_86nf6.js +2 -0
  175. package/dist/disable-DVKd-0Xb.js +1 -0
  176. package/dist/discover-Df-a8K4R.js +3 -0
  177. package/dist/discover-Dvr_3_Xr.js +1 -0
  178. package/dist/dispatch-BKeAch9E.js +14 -0
  179. package/dist/docs-BX65z2Iu.js +2 -0
  180. package/dist/docs-DKJnqZqt.js +2 -0
  181. package/dist/enable-C8Zf_wpN.js +1 -0
  182. package/dist/env-CRf6wkM2.js +1 -0
  183. package/dist/exec-RZFLclKX.js +11 -0
  184. package/dist/executor-BvAA7Cgw.js +10 -0
  185. package/dist/flow/builtin/review.d.ts +157 -0
  186. package/dist/flow/builtin/review.js +19 -0
  187. package/dist/flow/index.d.ts +1 -1
  188. package/dist/flow/index.js +1 -1
  189. package/dist/flow-17k25MHt.js +1 -0
  190. package/dist/github-actions-DwUzm4hC.js +24 -0
  191. package/dist/http-Bkg_OQ6r.js +1 -0
  192. package/dist/{index-BQ-b77or.d.ts → index-DT7EST00.d.ts} +116 -238
  193. package/dist/init-CoMfFxbG.js +1 -0
  194. package/dist/integrations-5xCaXSd-.js +1 -0
  195. package/dist/integrations-BAgdVDhj.js +5 -0
  196. package/dist/lib/broker.js +3 -3
  197. package/dist/list-BAKvxSbh.js +4 -0
  198. package/dist/list-BYiG8Zav.js +2 -0
  199. package/dist/list-BxEywhHU.js +1 -0
  200. package/dist/list-C5w01-8q.js +1 -0
  201. package/dist/list-CIW2joV1.js +1 -0
  202. package/dist/list-DX-z3SBp.js +3 -0
  203. package/dist/list-DpCf4G-H.js +4 -0
  204. package/dist/list-VToARh3C.js +1 -0
  205. package/dist/load-BpEsAn51.js +2 -0
  206. package/dist/local-H3uvqEbq.js +1 -0
  207. package/dist/log-view-dg0TlKLA.js +1 -0
  208. package/dist/login-BFxX4jJy.js +1 -0
  209. package/dist/login-DkkslfBx.js +1 -0
  210. package/dist/logout-BHAtw4Z8.js +1 -0
  211. package/dist/maintenance-C5FklUw3.js +1 -0
  212. package/dist/match-CXAjDhg7.js +1 -0
  213. package/dist/mcp-BgKb2Cdk.js +1 -0
  214. package/dist/mcp-CCZOAo06.js +1 -0
  215. package/dist/mcp-server-DGzme0YX.js +1 -0
  216. package/dist/migrate-C4vM7DQN.js +2 -0
  217. package/dist/migrate-N-85_N7J.js +1 -0
  218. package/dist/model-Bs1StDo3.js +1 -0
  219. package/dist/models-_5LVGC3m.js +1 -0
  220. package/dist/output-BKeyLbvt.js +5 -0
  221. package/dist/prompt-CEuBMNhk.js +7 -0
  222. package/dist/push-CUC55Bqd.js +1 -0
  223. package/dist/queue-6io_NOP3.js +116 -0
  224. package/dist/refresh-BIrmrWYq.js +1 -0
  225. package/dist/remote-miQNTVRa.js +1 -0
  226. package/dist/remove-B93LNkZI.js +1 -0
  227. package/dist/remove-C5_xggx7.js +1 -0
  228. package/dist/remove-CuH8a3L9.js +1 -0
  229. package/dist/remove-eQ8y5C5p.js +1 -0
  230. package/dist/rename-CYfy03FE.js +1 -0
  231. package/dist/result-BEtQZHaY.js +5 -0
  232. package/dist/result-BzaM3inj.js +15 -0
  233. package/dist/resume-DYzKvyEw.js +3 -0
  234. package/dist/review-oIBeECZE.js +7 -0
  235. package/dist/rolldown-runtime-DT7IzrpZ.js +1 -0
  236. package/dist/rotate-key-IdMYH7gg.js +1 -0
  237. package/dist/run-BDYl0CKl.js +2 -0
  238. package/dist/run-CTtd0Znc.js +5 -0
  239. package/dist/run-CawRGnOg.js +2 -0
  240. package/dist/runner-D7ScbIHJ.js +1 -0
  241. package/dist/runner-sUpWJ_k0.js +1 -0
  242. package/dist/schema-CU2iFkp8.js +1 -0
  243. package/dist/sdk.d.ts +1166 -191
  244. package/dist/sdk.js +1 -1
  245. package/dist/serve-BTeomYxW.js +1 -0
  246. package/dist/serve-CE8YV2e9.js +1 -0
  247. package/dist/serve-CPnmrKyf.js +2 -0
  248. package/dist/serve-CQKZxzFE.js +4 -0
  249. package/dist/serve-GmRO89s5.js +12 -0
  250. package/dist/server-Kb22cWfF.js +1 -0
  251. package/dist/setup-host-GFTUzzZJ.js +6 -0
  252. package/dist/shared-DVtzWhUT.js +1 -0
  253. package/dist/show-CMUg8SJu.js +1 -0
  254. package/dist/show-COTZEYgc.js +1 -0
  255. package/dist/status-D26U--p8.js +1 -0
  256. package/dist/steer-C6uARLp5.js +4 -0
  257. package/dist/stop-BrGI3hSS.js +1 -0
  258. package/dist/stop-ByCAlbmN.js +3 -0
  259. package/dist/store-B94tSate.js +42 -0
  260. package/dist/store-DzqXS2wT.js +8 -0
  261. package/dist/task-C6VAg5WU.js +1 -0
  262. package/dist/task-CgOKgkEG.js +1 -0
  263. package/dist/task-DeglY79z.js +5 -0
  264. package/dist/test-NEbhlxvo.js +1 -0
  265. package/dist/tools-D0Zfs8Hx.js +1 -0
  266. package/dist/types-D0q15RJa.js +1 -0
  267. package/dist/types-Dve7Z0ZP.d.ts +389 -0
  268. package/dist/unalias-C9NqmSDq.js +1 -0
  269. package/dist/update-BTxYQj7Z.js +2 -0
  270. package/dist/upgrade-hA0yWBvx.js +2 -0
  271. package/dist/usage-BhqoCjvE.js +1 -0
  272. package/dist/usage-C4d9X2Uq.js +1 -0
  273. package/dist/watch-CSdj24ct.js +5 -0
  274. package/dist/watch-DtRuC0Wc.js +8 -0
  275. package/dist/wire-BeT1Axeo.js +1 -0
  276. package/dist/worker-CXndxmGF.js +9 -0
  277. package/dist/worker-DX7P9kWl.js +1 -0
  278. package/dist/workflow-Dcmdooi8.js +1 -0
  279. package/docs/agents/coder.md +26 -0
  280. package/docs/agents/index.md +120 -0
  281. package/docs/config.md +51 -30
  282. package/docs/dash.md +64 -0
  283. package/docs/flows.md +20 -15
  284. package/docs/mcp.md +62 -0
  285. package/docs/models.md +41 -23
  286. package/docs/review.md +41 -0
  287. package/docs/sdk.md +57 -38
  288. package/docs/self-host.md +188 -0
  289. package/migrations/0000_initial.sql +252 -0
  290. package/migrations/meta/0000_snapshot.json +1787 -0
  291. package/migrations/meta/_journal.json +13 -0
  292. package/package.json +37 -7
  293. package/plugins/agents/skills/coder/SKILL.md +14 -60
  294. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  295. package/plugins/claude/commands/setup.md +2 -2
  296. package/plugins/claude/skills/dispatch/SKILL.md +14 -58
  297. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  298. package/plugins/cursor/README.md +5 -5
  299. package/plugins/cursor/assets/logo.png +0 -0
  300. package/plugins/cursor/skills/coder/SKILL.md +14 -59
  301. package/src/client/index.ts +573 -0
  302. package/src/client/types.ts +506 -0
  303. package/src/core/errors.ts +72 -0
  304. package/src/core/task/log-view.ts +173 -0
  305. package/src/server/auth/sign-in.ts +14 -0
  306. package/src/server/dash/api/load.ts +62 -0
  307. package/src/server/dash/api/types.ts +11 -0
  308. package/src/server/dash/app/connect/page.tsx +42 -0
  309. package/src/server/dash/app/dash/account/loading.tsx +11 -0
  310. package/src/server/dash/app/dash/account/notify.tsx +42 -0
  311. package/src/server/dash/app/dash/account/page.css +81 -0
  312. package/src/server/dash/app/dash/account/page.tsx +126 -0
  313. package/src/server/dash/app/dash/account/sign-out.tsx +24 -0
  314. package/src/server/dash/app/dash/agents/(list)/agent-menu.tsx +10 -0
  315. package/src/server/dash/app/dash/agents/(list)/agents-grid.tsx +143 -0
  316. package/src/server/dash/app/dash/agents/(list)/connect-apps.tsx +46 -0
  317. package/src/server/dash/app/dash/agents/(list)/loading.tsx +14 -0
  318. package/src/server/dash/app/dash/agents/(list)/page.css +72 -0
  319. package/src/server/dash/app/dash/agents/(list)/page.tsx +89 -0
  320. package/src/server/dash/app/dash/agents/[slug]/(tabs)/layout.tsx +135 -0
  321. package/src/server/dash/app/dash/agents/[slug]/(tabs)/loading.tsx +5 -0
  322. package/src/server/dash/app/dash/agents/[slug]/(tabs)/page.css +21 -0
  323. package/src/server/dash/app/dash/agents/[slug]/(tabs)/page.tsx +173 -0
  324. package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/loading.tsx +18 -0
  325. package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/page.css +87 -0
  326. package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/page.tsx +258 -0
  327. package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/platform-actions.tsx +111 -0
  328. package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/agent-settings-form.css +114 -0
  329. package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/agent-settings-form.tsx +294 -0
  330. package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/loading.tsx +5 -0
  331. package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/page.tsx +54 -0
  332. package/src/server/dash/app/dash/agents/[slug]/(tabs)/tasks/loading.tsx +5 -0
  333. package/src/server/dash/app/dash/agents/[slug]/(tabs)/tasks/page.tsx +14 -0
  334. package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/loading.tsx +31 -0
  335. package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/page.css +12 -0
  336. package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/page.tsx +163 -0
  337. package/src/server/dash/app/dash/agents/[slug]/(tabs)/versions-list.tsx +53 -0
  338. package/src/server/dash/app/dash/agents/[slug]/edit/loading.tsx +31 -0
  339. package/src/server/dash/app/dash/agents/[slug]/edit/page.tsx +91 -0
  340. package/src/server/dash/app/dash/agents/agent/agent-pills.css +27 -0
  341. package/src/server/dash/app/dash/agents/agent/agent-pills.tsx +133 -0
  342. package/src/server/dash/app/dash/agents/agent/hero.css +40 -0
  343. package/src/server/dash/app/dash/agents/agent/hero.tsx +60 -0
  344. package/src/server/dash/app/dash/agents/agent/instructions.css +29 -0
  345. package/src/server/dash/app/dash/agents/agent/instructions.tsx +82 -0
  346. package/src/server/dash/app/dash/agents/editor/connect-repositories.ts +16 -0
  347. package/src/server/dash/app/dash/agents/editor/editor.css +263 -0
  348. package/src/server/dash/app/dash/agents/editor/editor.tsx +774 -0
  349. package/src/server/dash/app/dash/agents/editor/import-picker.css +48 -0
  350. package/src/server/dash/app/dash/agents/editor/import-picker.tsx +253 -0
  351. package/src/server/dash/app/dash/agents/editor/names.ts +35 -0
  352. package/src/server/dash/app/dash/agents/new/loading.tsx +25 -0
  353. package/src/server/dash/app/dash/agents/new/page.tsx +72 -0
  354. package/src/server/dash/app/dash/layout.css +265 -0
  355. package/src/server/dash/app/dash/layout.tsx +332 -0
  356. package/src/server/dash/app/dash/page.tsx +14 -0
  357. package/src/server/dash/app/dash/settings/[tab]/credentials-list.css +94 -0
  358. package/src/server/dash/app/dash/settings/[tab]/credentials-list.tsx +619 -0
  359. package/src/server/dash/app/dash/settings/[tab]/credentials.tsx +36 -0
  360. package/src/server/dash/app/dash/settings/[tab]/engines-list.css +16 -0
  361. package/src/server/dash/app/dash/settings/[tab]/engines-list.tsx +135 -0
  362. package/src/server/dash/app/dash/settings/[tab]/list.css +98 -0
  363. package/src/server/dash/app/dash/settings/[tab]/list.tsx +215 -0
  364. package/src/server/dash/app/dash/settings/[tab]/loading.tsx +6 -0
  365. package/src/server/dash/app/dash/settings/[tab]/mcp-list.css +43 -0
  366. package/src/server/dash/app/dash/settings/[tab]/mcp-list.tsx +290 -0
  367. package/src/server/dash/app/dash/settings/[tab]/models-list.tsx +513 -0
  368. package/src/server/dash/app/dash/settings/[tab]/page.tsx +89 -0
  369. package/src/server/dash/app/dash/settings/[tab]/runners-list.css +153 -0
  370. package/src/server/dash/app/dash/settings/[tab]/runners-list.tsx +457 -0
  371. package/src/server/dash/app/dash/settings/layout.tsx +50 -0
  372. package/src/server/dash/app/dash/settings/model-options.ts +117 -0
  373. package/src/server/dash/app/dash/settings/page.tsx +7 -0
  374. package/src/server/dash/app/dash/settings/settings-head.tsx +24 -0
  375. package/src/server/dash/app/dash/settings/tunnel-guide.tsx +28 -0
  376. package/src/server/dash/app/dash/tasks/[id]/activity.tsx +202 -0
  377. package/src/server/dash/app/dash/tasks/[id]/loading.tsx +31 -0
  378. package/src/server/dash/app/dash/tasks/[id]/page.tsx +30 -0
  379. package/src/server/dash/app/dash/tasks/[id]/task-actions.tsx +164 -0
  380. package/src/server/dash/app/dash/tasks/[id]/task-view.css +407 -0
  381. package/src/server/dash/app/dash/tasks/[id]/task-view.tsx +513 -0
  382. package/src/server/dash/app/dash/tasks/composer-data.ts +96 -0
  383. package/src/server/dash/app/dash/tasks/composer.css +316 -0
  384. package/src/server/dash/app/dash/tasks/composer.tsx +890 -0
  385. package/src/server/dash/app/dash/tasks/list/status.css +50 -0
  386. package/src/server/dash/app/dash/tasks/list/status.tsx +20 -0
  387. package/src/server/dash/app/dash/tasks/list/task.ts +45 -0
  388. package/src/server/dash/app/dash/tasks/list/tasks-list.css +85 -0
  389. package/src/server/dash/app/dash/tasks/list/tasks-list.tsx +402 -0
  390. package/src/server/dash/app/dash/tasks/list/tasks-section.tsx +96 -0
  391. package/src/server/dash/app/dash/tasks/page.tsx +53 -0
  392. package/src/server/dash/app/dash/token-from-hash.tsx +17 -0
  393. package/src/server/dash/app/dash/usage/custom-range.tsx +63 -0
  394. package/src/server/dash/app/dash/usage/day-chart.css +109 -0
  395. package/src/server/dash/app/dash/usage/day-chart.tsx +110 -0
  396. package/src/server/dash/app/dash/usage/loading.tsx +17 -0
  397. package/src/server/dash/app/dash/usage/metric.ts +13 -0
  398. package/src/server/dash/app/dash/usage/page.tsx +117 -0
  399. package/src/server/dash/app/dash/usage/range-bar.css +13 -0
  400. package/src/server/dash/app/dash/usage/range-bar.tsx +69 -0
  401. package/src/server/dash/app/dash/usage/stats.css +52 -0
  402. package/src/server/dash/app/dash/usage/stats.tsx +19 -0
  403. package/src/server/dash/app/dash/usage/top-agents.css +40 -0
  404. package/src/server/dash/app/dash/usage/top-agents.tsx +138 -0
  405. package/src/server/dash/app/dash/usage/usage.css +0 -0
  406. package/src/server/dash/app/globals.css +692 -0
  407. package/src/server/dash/app/layout.tsx +52 -0
  408. package/src/server/dash/app/login/page.css +26 -0
  409. package/src/server/dash/app/login/page.tsx +57 -0
  410. package/src/server/dash/app/page.tsx +5 -0
  411. package/src/server/dash/app/responsive.css +49 -0
  412. package/src/server/dash/app/zone.tsx +13 -0
  413. package/src/server/dash/comps/frame/auth-panel.css +60 -0
  414. package/src/server/dash/comps/frame/auth-panel.tsx +44 -0
  415. package/src/server/dash/comps/frame/drawer.css +28 -0
  416. package/src/server/dash/comps/frame/drawer.tsx +39 -0
  417. package/src/server/dash/comps/frame/heads.ts +41 -0
  418. package/src/server/dash/comps/frame/loading-card.tsx +65 -0
  419. package/src/server/dash/comps/frame/page-head.css +83 -0
  420. package/src/server/dash/comps/frame/page-head.tsx +71 -0
  421. package/src/server/dash/comps/frame/stream.tsx +50 -0
  422. package/src/server/dash/comps/frame/task-toasts.tsx +214 -0
  423. package/src/server/dash/comps/frame/theme-choices.tsx +46 -0
  424. package/src/server/dash/comps/nav/current-link.tsx +53 -0
  425. package/src/server/dash/comps/nav/side-toggle.tsx +30 -0
  426. package/src/server/dash/comps/nav/to.ts +22 -0
  427. package/src/server/dash/comps/ui/badge.css +64 -0
  428. package/src/server/dash/comps/ui/badge.tsx +41 -0
  429. package/src/server/dash/comps/ui/card.css +93 -0
  430. package/src/server/dash/comps/ui/card.tsx +77 -0
  431. package/src/server/dash/comps/ui/collapse.css +32 -0
  432. package/src/server/dash/comps/ui/collapse.tsx +49 -0
  433. package/src/server/dash/comps/ui/combo.tsx +154 -0
  434. package/src/server/dash/comps/ui/confirm.css +36 -0
  435. package/src/server/dash/comps/ui/confirm.tsx +67 -0
  436. package/src/server/dash/comps/ui/field.css +25 -0
  437. package/src/server/dash/comps/ui/field.tsx +34 -0
  438. package/src/server/dash/comps/ui/icon.css +22 -0
  439. package/src/server/dash/comps/ui/icon.tsx +17 -0
  440. package/src/server/dash/comps/ui/icons.ts +44 -0
  441. package/src/server/dash/comps/ui/menu.css +178 -0
  442. package/src/server/dash/comps/ui/menu.tsx +152 -0
  443. package/src/server/dash/comps/ui/segmented.css +44 -0
  444. package/src/server/dash/comps/ui/segmented.tsx +58 -0
  445. package/src/server/dash/comps/ui/select.css +103 -0
  446. package/src/server/dash/comps/ui/select.tsx +250 -0
  447. package/src/server/dash/comps/ui/sentinel.css +58 -0
  448. package/src/server/dash/comps/ui/sentinel.tsx +67 -0
  449. package/src/server/dash/comps/ui/tabs.css +81 -0
  450. package/src/server/dash/comps/ui/tabs.tsx +32 -0
  451. package/src/server/dash/comps/ui/tail.css +12 -0
  452. package/src/server/dash/comps/ui/tail.tsx +37 -0
  453. package/src/server/dash/comps/ui/toast.css +72 -0
  454. package/src/server/dash/comps/ui/toolbar.css +143 -0
  455. package/src/server/dash/comps/ui/toolbar.tsx +93 -0
  456. package/src/server/dash/package.json +5 -0
  457. package/src/server/dash/pnext-env.d.ts +4 -0
  458. package/src/server/dash/pnext.config.ts +5 -0
  459. package/src/server/dash/public/assets/apple-touch-icon.png +0 -0
  460. package/src/server/dash/public/assets/favicon.ico +0 -0
  461. package/src/server/dash/public/assets/favicon.svg +1 -0
  462. package/src/server/dash/public/assets/fonts/LICENSE-fira-code +93 -0
  463. package/src/server/dash/public/assets/fonts/fira-code-latin-400-normal-717ee080.woff2 +0 -0
  464. package/src/server/dash/public/assets/fonts/fira-code-latin-500-normal-530b6706.woff2 +0 -0
  465. package/src/server/dash/public/assets/fonts/fira-code-latin-700-normal-98730669.woff2 +0 -0
  466. package/src/server/dash/tsconfig.json +10 -0
  467. package/src/server/dash/utils/client.ts +19 -0
  468. package/src/server/dash/utils/format.ts +75 -0
  469. package/src/server/dash/utils/paged.ts +184 -0
  470. package/src/server/dash/utils/range.ts +117 -0
  471. package/dist/app-server-CW93J9zJ.js +0 -3
  472. package/dist/runtime-D-U1DNkI.js +0 -26
  473. package/dist/upgrade-DOj06r5b.js +0 -37
@@ -0,0 +1,53 @@
1
+ import { dynamic } from '@wular/pnext/dynamic';
2
+
3
+ import { zoneOf } from '@/utils/format';
4
+ import { load } from '@/api/load';
5
+ import { HEADS } from '@/comps/frame/heads';
6
+ import { Page } from '@/comps/frame/page-head';
7
+ import { Stream } from '@/comps/frame/stream';
8
+ import { TasksSection, loadTasks } from '@/app/dash/tasks/list/tasks-section';
9
+ import {
10
+ agentChoices,
11
+ credentialMissing,
12
+ loadComposer,
13
+ savedChoice,
14
+ } from '@/app/dash/tasks/composer-data';
15
+ import { LoadingComposer } from '@/app/dash/tasks/composer';
16
+
17
+ // Hydrates with the page, so typing and Enter work at once.
18
+ const Composer = dynamic(() => import('@/app/dash/tasks/composer').then(m => m.Composer));
19
+
20
+ /** One box to start anything, then every task; each streams in on its own. */
21
+ export default function TasksPage({ request }: { request?: Request }) {
22
+ if (!request) return null;
23
+ const client = load(request);
24
+ const agent = new URL(request.url).searchParams.get('agent');
25
+
26
+ return (
27
+ <Page>
28
+ <Stream
29
+ fallback={<LoadingComposer />}
30
+ load={() =>
31
+ Promise.all([loadComposer(client), credentialMissing(client)]).then(
32
+ ([setup, missing]) => (
33
+ <Composer
34
+ {...setup}
35
+ initial={{
36
+ ...savedChoice(request.headers.get('cookie') ?? ''),
37
+ ...(agent ? { agent } : {}),
38
+ }}
39
+ missing={missing}
40
+ tz={zoneOf(request)}
41
+ />
42
+ ),
43
+ )
44
+ }
45
+ />
46
+ <TasksSection
47
+ tasks={loadTasks(request, undefined, agentChoices(client))}
48
+ head={HEADS.tasks}
49
+ missing={credentialMissing(client)}
50
+ />
51
+ </Page>
52
+ );
53
+ }
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+
3
+ import { useEffect } from 'preact/hooks';
4
+
5
+ /** `serve` opens /dash#token=…: the fragment never reaches the server, and it leaves history before the form posts it. */
6
+ export function TokenFromHash() {
7
+ useEffect(() => {
8
+ const token = /(?:^|&)token=([^&]+)/.exec(location.hash.slice(1))?.[1];
9
+ if (!token) return;
10
+ history.replaceState(null, '', location.pathname + location.search);
11
+ const form = document.getElementById('token-form') as HTMLFormElement | null;
12
+ if (!form) return;
13
+ (form.elements.namedItem('token') as HTMLInputElement).value = decodeURIComponent(token);
14
+ form.submit();
15
+ }, []);
16
+ return null;
17
+ }
@@ -0,0 +1,63 @@
1
+ 'use client';
2
+
3
+ import { iDown } from '@/comps/ui/icons';
4
+ import { useRouter } from '@wular/pnext/navigation/client';
5
+ import { withSearch, type To } from '@/comps/nav/to';
6
+ import { Icon } from '@/comps/ui/icon';
7
+ import { useId } from 'preact/hooks';
8
+
9
+ /** Custom from and to dates; applying them moves the page to that range. */
10
+ export function CustomRange({
11
+ page,
12
+ from,
13
+ to,
14
+ today,
15
+ on,
16
+ }: {
17
+ /** The page's path and query, without range parameters. */
18
+ /** The page the range applies to. */
19
+ page: To;
20
+ from: string;
21
+ to: string;
22
+ today: string;
23
+ on: boolean;
24
+ }) {
25
+ const nav = useRouter();
26
+ const id = useId();
27
+
28
+ return (
29
+ <span class={on ? 'menu custom on' : 'menu custom'}>
30
+ <button popovertarget={id} type="button">
31
+ Custom
32
+ <Icon d={iDown} />
33
+ </button>
34
+ <form
35
+ id={id}
36
+ class="pop date-pop"
37
+ popover="auto"
38
+ onSubmit={event => {
39
+ event.preventDefault();
40
+ const values = new FormData(event.currentTarget);
41
+ const [start, end] = [String(values.get('from')), String(values.get('to'))].sort();
42
+
43
+ event.currentTarget.hidePopover();
44
+ nav.push(page.href, {
45
+ params: page.params,
46
+ search: withSearch(page.search, { from: String(start), to: String(end) }),
47
+ scroll: false,
48
+ });
49
+ }}
50
+ >
51
+ <label class="field">
52
+ <span>From</span>
53
+ <input type="date" name="from" defaultValue={from} max={today} required />
54
+ </label>
55
+ <label class="field">
56
+ <span>To</span>
57
+ <input type="date" name="to" defaultValue={to} max={today} required />
58
+ </label>
59
+ <button class="btn sm">Apply</button>
60
+ </form>
61
+ </span>
62
+ );
63
+ }
@@ -0,0 +1,109 @@
1
+ /* charts */
2
+ .chart {
3
+ display: flex;
4
+ align-items: flex-end;
5
+ gap: 4px;
6
+ height: 200px;
7
+ }
8
+ .empty-chart {
9
+ align-items: center;
10
+ justify-content: center;
11
+ }
12
+ .chart li {
13
+ position: relative;
14
+ flex: 1;
15
+ min-width: 0;
16
+ height: 100%;
17
+ display: flex;
18
+ flex-direction: column;
19
+ justify-content: flex-end;
20
+ align-items: center;
21
+ gap: 6px;
22
+ }
23
+ .chart .col {
24
+ display: flex;
25
+ flex-direction: column-reverse;
26
+ gap: 2px;
27
+ width: 100%;
28
+ max-width: 48px;
29
+ height: var(--h);
30
+ min-height: 1px;
31
+ }
32
+ .chart .col i {
33
+ display: block;
34
+ flex: var(--f) 0 0;
35
+ min-height: 1px;
36
+ background: var(--c, var(--s1));
37
+ }
38
+ .chart .col i:last-child {
39
+ border-radius: 4px 4px 0 0;
40
+ }
41
+ .chart li > small {
42
+ font-size: 10.5px;
43
+ color: var(--dim);
44
+ height: 16px;
45
+ white-space: nowrap;
46
+ }
47
+ .chart li:hover .col {
48
+ filter: brightness(1.15);
49
+ }
50
+ .chart .tip {
51
+ display: none;
52
+ position: absolute;
53
+ bottom: calc(var(--h) + 30px);
54
+ left: 50%;
55
+ transform: translateX(-50%);
56
+ z-index: 5;
57
+ width: max-content;
58
+ max-width: 240px;
59
+ padding: 8px 10px;
60
+ border: 1px solid var(--line2);
61
+ background: var(--tile);
62
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
63
+ font-size: 11.5px;
64
+ line-height: 1.5;
65
+ }
66
+ .chart li:hover .tip {
67
+ display: grid;
68
+ }
69
+ .chart li:first-child .tip,
70
+ .chart li:nth-child(2) .tip {
71
+ left: 0;
72
+ transform: none;
73
+ }
74
+ .chart li:last-child .tip,
75
+ .chart li:nth-last-child(2) .tip {
76
+ left: auto;
77
+ right: 0;
78
+ transform: none;
79
+ }
80
+ .tip b {
81
+ font-weight: 500;
82
+ }
83
+ .legend {
84
+ display: flex;
85
+ flex-wrap: wrap;
86
+ gap: 6px 16px;
87
+ font-size: 12px;
88
+ color: var(--muted);
89
+ }
90
+ .legend span,
91
+ .tip span {
92
+ display: inline-flex;
93
+ align-items: center;
94
+ gap: 6px;
95
+ }
96
+ .legend i,
97
+ .tip i {
98
+ width: 10px;
99
+ height: 10px;
100
+ border-radius: 2px;
101
+ background: var(--c);
102
+ }
103
+
104
+ @media (max-width: 760px) {
105
+ .chart {
106
+ gap: 2px;
107
+ height: 160px;
108
+ }
109
+ }
@@ -0,0 +1,110 @@
1
+ import './day-chart.css';
2
+ import type { UsageTotal } from '@coder/client/types';
3
+ import { Empty } from '@/comps/ui/card';
4
+ import { type Metric, formatMetric } from './metric';
5
+
6
+ export type Series = { key: string; label: string; color: string };
7
+
8
+ const OTHER: Series = { key: '', label: 'Other agents', color: 'var(--s0)' };
9
+
10
+ /** Bars per day; with `series`, those agents are stacked and the rest sit on top as one. */
11
+ export function DayChart({
12
+ days,
13
+ totals,
14
+ metric,
15
+ series = [],
16
+ label,
17
+ }: {
18
+ days: string[];
19
+ totals: UsageTotal[];
20
+ metric: Metric;
21
+ series?: Series[];
22
+ label: string;
23
+ }) {
24
+ const byDay = new Map(totals.map(row => [row.key, row]));
25
+ const max = Math.max(1, ...totals.map(row => row[metric]));
26
+ const step = Math.ceil(days.length / 16);
27
+ const text = (value: number) => formatMetric(metric, value);
28
+ if (!totals.some(row => row[metric] > 0))
29
+ return (
30
+ <div class="chart empty-chart" aria-label={label}>
31
+ <Empty title="Nothing ran in this range" />
32
+ </div>
33
+ );
34
+ return (
35
+ <>
36
+ {series.length ? (
37
+ <div class="legend">
38
+ {[...series, OTHER].map(entry => (
39
+ <span key={entry.key}>
40
+ <i style={`--c:${entry.color}`} />
41
+ {entry.label}
42
+ </span>
43
+ ))}
44
+ </div>
45
+ ) : null}
46
+ <ol class="chart" aria-label={label}>
47
+ {days.map((day, index) => {
48
+ const row = byDay.get(day);
49
+ const total = row?.[metric] ?? 0;
50
+ const parts = series.map(entry => ({
51
+ ...entry,
52
+ value: row?.parts?.[entry.key]?.[metric] ?? 0,
53
+ }));
54
+ const rest = total - parts.reduce((sum, part) => sum + part.value, 0);
55
+ const name = new Date(`${day}T12:00:00Z`).toLocaleDateString('en-US', {
56
+ month: 'short',
57
+ day: 'numeric',
58
+ timeZone: 'UTC',
59
+ });
60
+ return (
61
+ <li
62
+ key={day}
63
+ style={`--h:${(total / max) * 100}%`}
64
+ aria-label={`${name}, ${text(total)}`}
65
+ >
66
+ {total ? (
67
+ <span class="col">
68
+ {series.length ? (
69
+ <>
70
+ {parts.map(part =>
71
+ part.value ? (
72
+ <i key={part.key} style={`--f:${part.value};--c:${part.color}`} />
73
+ ) : null,
74
+ )}
75
+ {rest > 0 ? <i style={`--f:${rest};--c:${OTHER.color}`} /> : null}
76
+ </>
77
+ ) : (
78
+ <i style="--f:1" />
79
+ )}
80
+ </span>
81
+ ) : null}
82
+ <small>
83
+ {index % step
84
+ ? ''
85
+ : index && days[index - step]!.slice(0, 7) === day.slice(0, 7)
86
+ ? Number(day.slice(8))
87
+ : name}
88
+ </small>
89
+ <span class="tip" role="tooltip">
90
+ <b>
91
+ {name}, {text(total)}
92
+ </b>
93
+ {series.length
94
+ ? [...parts, { ...OTHER, value: rest }]
95
+ .filter(part => part.value > 0)
96
+ .map(part => (
97
+ <span key={part.key}>
98
+ <i style={`--c:${part.color}`} />
99
+ {part.label} {text(part.value)}
100
+ </span>
101
+ ))
102
+ : null}
103
+ </span>
104
+ </li>
105
+ );
106
+ })}
107
+ </ol>
108
+ </>
109
+ );
110
+ }
@@ -0,0 +1,17 @@
1
+ import '@/comps/ui/segmented.css';
2
+ import '@/app/dash/usage/range-bar.css';
3
+ import './usage.css';
4
+ import { HEADS } from '@/comps/frame/heads';
5
+ import { LoadingRange } from '@/app/dash/usage/range-bar';
6
+ import { Loading } from '@/comps/ui/card';
7
+ import { Page, PageHead } from '@/comps/frame/page-head';
8
+
9
+ export default function UsageLoading() {
10
+ return (
11
+ <Page>
12
+ <PageHead {...HEADS.usage} />
13
+ <LoadingRange />
14
+ <Loading label="Loading usage" />
15
+ </Page>
16
+ );
17
+ }
@@ -0,0 +1,13 @@
1
+ import { formatCount, formatDuration } from '@/utils/format';
2
+
3
+ export type Metric = 'tasks' | 'runnerMs' | 'tokenCount';
4
+
5
+ export const METRIC_LABEL: Record<Metric, string> = {
6
+ tasks: 'Tasks',
7
+ runnerMs: 'Runner time',
8
+ tokenCount: 'Tokens',
9
+ };
10
+
11
+ export function formatMetric(metric: Metric, value: number) {
12
+ return metric === 'runnerMs' ? formatDuration(value) : formatCount(value);
13
+ }
@@ -0,0 +1,117 @@
1
+ import '@/comps/ui/segmented.css';
2
+ import '@/app/dash/usage/range-bar.css';
3
+ import './usage.css';
4
+ import { formatCount, formatDuration, zoneOf } from '@/utils/format';
5
+ import { daysIn, rangeFor } from '@/utils/range';
6
+ import { load } from '@/api/load';
7
+ import type { UsageAmount, UsagePage } from '@coder/client/types';
8
+ import { Card } from '@/comps/ui/card';
9
+ import { Page, PageHead } from '@/comps/frame/page-head';
10
+ import { Stat, Stats } from '@/app/dash/usage/stats';
11
+ import { Settle } from '@/comps/frame/stream';
12
+ import { HEADS } from '@/comps/frame/heads';
13
+ import { TopAgents } from './top-agents';
14
+ import { DayChart, type Series } from '@/app/dash/usage/day-chart';
15
+ import { RangeBar } from '@/app/dash/usage/range-bar';
16
+ import { METRIC_LABEL, type Metric } from '@/app/dash/usage/metric';
17
+
18
+ const SORT_METRIC: Record<string, Metric> = {
19
+ tasks: 'tasks',
20
+ runner: 'runnerMs',
21
+ tokens: 'tokenCount',
22
+ name: 'tokenCount',
23
+ };
24
+ const COLORS = ['var(--s1)', 'var(--s2)', 'var(--s3)', 'var(--s4)'];
25
+ const TOP_AGENTS = 10;
26
+
27
+ export default function UsagePage({ request }: { request?: Request }) {
28
+ if (!request) return null;
29
+ const url = new URL(request.url);
30
+ const tz = zoneOf(request);
31
+ const range = rangeFor(request, tz);
32
+ const asked = url.searchParams.get('sort') ?? '';
33
+ const sort = Object.hasOwn(SORT_METRIC, asked) ? asked : 'tokens';
34
+ const metric = SORT_METRIC[sort]!;
35
+
36
+ const first = load(request).usage({
37
+ by: 'agent',
38
+ cursor: '',
39
+ since: range.since,
40
+ until: range.until,
41
+ limit: TOP_AGENTS,
42
+ sort,
43
+ });
44
+ const agents = load(request).agents.list();
45
+ const days = load(request).usage({
46
+ by: 'day',
47
+ since: range.since,
48
+ until: range.until,
49
+ tz,
50
+ top: 4,
51
+ sort: sort === 'name' ? 'tokens' : sort,
52
+ });
53
+
54
+ return (
55
+ <Page>
56
+ <PageHead {...HEADS.usage} />
57
+ <RangeBar
58
+ range={range}
59
+ to={{ href: '/dash/usage', params: {}, search: sort === 'tokens' ? undefined : { sort } }}
60
+ tz={tz}
61
+ />
62
+ <Settle
63
+ load={() =>
64
+ Promise.all([first, days, agents]).then(([page, chart, known]) => {
65
+ const { summary, items } = page;
66
+ const series = (chart.top ?? []).map((key, index): Series => ({
67
+ key,
68
+ label: key,
69
+ color: COLORS[index]!,
70
+ }));
71
+ const shown = (key: keyof UsageAmount) => items.reduce((sum, row) => sum + row[key], 0);
72
+ return (
73
+ <>
74
+ <Stats label="Totals">
75
+ <Stat label="Agents" value={formatCount(summary.agents)} />
76
+ <Stat label="Tasks" value={formatCount(summary.tasks)} />
77
+ <Stat label="Runner time" value={formatDuration(summary.runnerMs)} />
78
+ <Stat label="Tokens" value={formatCount(summary.tokenCount)} />
79
+ </Stats>
80
+ {summary.tasks ? (
81
+ <Card title={`${METRIC_LABEL[metric]} per day`}>
82
+ <div class="body">
83
+ <DayChart
84
+ days={daysIn(range, tz)}
85
+ totals={chart.totals}
86
+ metric={metric}
87
+ series={series}
88
+ label={`${METRIC_LABEL[metric]} per day, top agents stacked`}
89
+ />
90
+ </div>
91
+ </Card>
92
+ ) : null}
93
+ <TopAgents
94
+ rows={items}
95
+ known={new Set(known.map(agent => agent.id))}
96
+ other={
97
+ summary.agents > items.length
98
+ ? {
99
+ tasks: summary.tasks - shown('tasks'),
100
+ runnerMs: summary.runnerMs - shown('runnerMs'),
101
+ tokenCount: summary.tokenCount - shown('tokenCount'),
102
+ }
103
+ : undefined
104
+ }
105
+ sort={sort}
106
+ range={range.query}
107
+ tops={Object.fromEntries(series.map(entry => [entry.key, entry.color]))}
108
+ metric={metric}
109
+ />
110
+ </>
111
+ );
112
+ })
113
+ }
114
+ />
115
+ </Page>
116
+ );
117
+ }
@@ -0,0 +1,13 @@
1
+ /* the range presets, a custom span and the label, on one line where they fit */
2
+ .range-line {
3
+ display: flex;
4
+ align-items: center;
5
+ gap: 12px;
6
+ flex-wrap: wrap;
7
+ }
8
+ .date-pop:popover-open {
9
+ display: grid;
10
+ gap: 12px;
11
+ min-width: 240px;
12
+ padding: 14px;
13
+ }
@@ -0,0 +1,69 @@
1
+ import '@/comps/ui/segmented.css';
2
+ import './range-bar.css';
3
+
4
+ import { Link } from '@wular/pnext/link';
5
+ import { PRESETS, dayOf, type Range } from '@/utils/range';
6
+ import { CustomRange } from './custom-range';
7
+ import { withSearch, type To } from '@/comps/nav/to';
8
+ import { iDown } from '@/comps/ui/icons';
9
+ import { Icon } from '@/comps/ui/icon';
10
+ import { BLANK } from '@/comps/frame/loading-card';
11
+
12
+ /** Presets and a custom span, for the usage pages. */
13
+ export function RangeBar({
14
+ range,
15
+ to,
16
+ tz,
17
+ }: {
18
+ range: Range;
19
+ /** The page the range applies to, with its own query. */
20
+ to: To;
21
+ tz: string;
22
+ }) {
23
+ const today = dayOf(Date.now(), tz);
24
+ return (
25
+ <div class="range-line">
26
+ <div class="seg-btns" role="group" aria-label="Range">
27
+ {Object.entries(PRESETS).map(([key, preset]) => (
28
+ <Link
29
+ key={key}
30
+ {...to}
31
+ search={withSearch(to.search, { range: key })}
32
+ scroll={false}
33
+ aria-current={range.key === key ? 'page' : undefined}
34
+ >
35
+ {preset.short}
36
+ </Link>
37
+ ))}
38
+ <CustomRange
39
+ page={to}
40
+ from={range.from ?? dayOf(range.since, tz)}
41
+ to={range.to ?? today}
42
+ today={today}
43
+ on={range.key === 'custom'}
44
+ />
45
+ </div>
46
+ <span class="muted">{range.label}</span>
47
+ </div>
48
+ );
49
+ }
50
+
51
+ /** A usage range bar before its page arrives; the range it shows comes with the page. */
52
+ export function LoadingRange() {
53
+ return (
54
+ <div class="range-line" aria-hidden="true">
55
+ <div class="seg-btns">
56
+ {Object.values(PRESETS).map(preset => (
57
+ <a key={preset.short}>{preset.short}</a>
58
+ ))}
59
+ <span class="menu custom">
60
+ <button type="button" disabled tabIndex={-1}>
61
+ Custom
62
+ <Icon d={iDown} />
63
+ </button>
64
+ </span>
65
+ </div>
66
+ <span class="muted">{BLANK}</span>
67
+ </div>
68
+ );
69
+ }
@@ -0,0 +1,52 @@
1
+ /* stats */
2
+ .stats {
3
+ display: grid;
4
+ grid-template-columns: repeat(4, minmax(0, 1fr));
5
+ gap: 12px;
6
+ }
7
+ .stats > div {
8
+ position: relative;
9
+ display: grid;
10
+ align-content: start;
11
+ gap: 8px;
12
+ min-width: 0;
13
+ padding: 14px 16px;
14
+ border: 1px solid var(--line);
15
+ background: var(--panel);
16
+ }
17
+ .stats > div::before {
18
+ content: "";
19
+ position: absolute;
20
+ left: 0;
21
+ right: 0;
22
+ top: 0;
23
+ height: 1px;
24
+ background: var(--acc);
25
+ opacity: 0.7;
26
+ }
27
+ .stats small {
28
+ font-size: 10px;
29
+ color: var(--muted);
30
+ }
31
+ .stats strong {
32
+ font-size: 20px;
33
+ font-weight: 500;
34
+ font-variant-numeric: tabular-nums;
35
+ overflow-wrap: anywhere;
36
+ line-height: 1.25;
37
+ }
38
+
39
+ @media (max-width: 1000px) {
40
+ .stats {
41
+ grid-template-columns: repeat(2, minmax(0, 1fr));
42
+ }
43
+ }
44
+
45
+ @media (max-width: 760px) {
46
+ .stats {
47
+ gap: 8px;
48
+ }
49
+ .stats strong {
50
+ font-size: 16px;
51
+ }
52
+ }
@@ -0,0 +1,19 @@
1
+ import './stats.css';
2
+ import type { ComponentChildren } from 'preact';
3
+
4
+ export function Stats({ label, children }: { label: string; children: ComponentChildren }) {
5
+ return (
6
+ <section class="stats" aria-label={label}>
7
+ {children}
8
+ </section>
9
+ );
10
+ }
11
+
12
+ export function Stat({ label, value }: { label: string; value: ComponentChildren }) {
13
+ return (
14
+ <div>
15
+ <small>{label}</small>
16
+ {typeof value === 'object' ? value : <strong>{value}</strong>}
17
+ </div>
18
+ );
19
+ }