@wular/coder 0.3.18 → 0.4.1
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.
- package/README.md +18 -16
- package/bin/coder.mjs +3 -1
- package/dist/actions-Mk3FSlpJ.js +20 -0
- package/dist/adapter-B0oYCI0S.js +1 -0
- package/dist/adapter-BKVzTDnn.js +1 -0
- package/dist/adapter-DPInwbJG.js +1 -0
- package/dist/adapter-DaiJMOYo.js +1 -0
- package/dist/adapter-PeKziOUg.js +1 -0
- package/dist/add-BxpLHnvD.js +1 -0
- package/dist/add-CE-70LFs.js +1 -0
- package/dist/add-U-pty9qJ.js +6 -0
- package/dist/add-ej0X9e3a.js +1 -0
- package/dist/add-json-CEa-6luW.js +1 -0
- package/dist/agent-BsYx3Odz.js +3 -0
- package/dist/agent-JdtZozvP.js +1 -0
- package/dist/alias-DX-Bm86x.js +2 -0
- package/dist/app-BT5f7zL5.js +1 -0
- package/dist/approvals-C-AvFt6s.js +2 -0
- package/dist/approve-DOmpQRNd.js +2 -0
- package/dist/apps-CjfrZyM5.js +1 -0
- package/dist/archive-BUB8gFKD.js +4 -0
- package/dist/archive-BziJ1rQ-.js +3 -0
- package/dist/archive-sweep-CtBcARgN.js +1 -0
- package/dist/args-BOEEdpWk.js +1 -0
- package/dist/ask-dE3U3ss2.js +4 -0
- package/dist/auth-BFny--17.js +1 -0
- package/dist/auth-DWHIzqbA.js +1 -0
- package/dist/builtin/coder/agent.json +24 -0
- package/dist/builtin/coder/system.md +17 -0
- package/dist/chat-3Znsevah.js +1 -0
- package/dist/chat-B_yhNTo0.js +13 -0
- package/dist/chat-bridge-BS9WtP3X.js +2 -0
- package/dist/cli-BilSDkvE.js +9 -0
- package/dist/cli.d.ts +71 -1
- package/dist/cli.js +1 -91
- package/dist/client-D9IoAuDD.js +1 -0
- package/dist/config-Da_cwoxI.js +3 -0
- package/dist/create-C_iMJV4Y.js +1 -0
- package/dist/credentials-B1jv6dkg.js +1 -0
- package/dist/dash/manifest.json +3427 -0
- package/dist/dash/public/assets/apple-touch-icon.png +0 -0
- package/dist/dash/public/assets/chunks/agent-pills-c9c4ac4d4a10df83.js +1 -0
- package/dist/dash/public/assets/chunks/agent-settings-form-8be2ddab074aba6d.js +1 -0
- package/dist/dash/public/assets/chunks/agents-grid-951584b6f4c4314e.js +1 -0
- package/dist/dash/public/assets/chunks/badge-676b01e0c615bf7b.js +1 -0
- package/dist/dash/public/assets/chunks/card-e0901d68b79dfa93.js +1 -0
- package/dist/dash/public/assets/chunks/combo-41234c24668b1db1.js +1 -0
- package/dist/dash/public/assets/chunks/composer-5534be50bc12385e.js +1 -0
- package/dist/dash/public/assets/chunks/composer-d10d4b1d54c4f751.js +1 -0
- package/dist/dash/public/assets/chunks/composer-data-6f7608fed13f3dd7.js +1 -0
- package/dist/dash/public/assets/chunks/confirm-f2fe4ba9905a89c6.js +1 -0
- package/dist/dash/public/assets/chunks/connect-apps-aa2a3d82e48ed8c3.js +1 -0
- package/dist/dash/public/assets/chunks/connect-repositories-5389ec8701a3deac.js +1 -0
- package/dist/dash/public/assets/chunks/credentials-list-bc5bfcab058176c5.js +2 -0
- package/dist/dash/public/assets/chunks/custom-range-4761ab14f05149df.js +1 -0
- package/dist/dash/public/assets/chunks/editor-bfe8cd854f8001be.js +7 -0
- package/dist/dash/public/assets/chunks/engines-list-f1191390f5715b39.js +1 -0
- package/dist/dash/public/assets/chunks/field-901f1f35c18c39c9.js +1 -0
- package/dist/dash/public/assets/chunks/format-eb03fc9d9744d960.js +1 -0
- package/dist/dash/public/assets/chunks/heads-f3bcd289663d48fa.js +1 -0
- package/dist/dash/public/assets/chunks/instructions-052fa45a9daf6db6.js +2 -0
- package/dist/dash/public/assets/chunks/instructions-d0a4b0d95009c262.js +1 -0
- package/dist/dash/public/assets/chunks/list-1d259660d7612c5f.js +1 -0
- package/dist/dash/public/assets/chunks/mcp-list-e3bebbbe831393b8.js +1 -0
- package/dist/dash/public/assets/chunks/model-options-15c53331a2f28a4f.js +1 -0
- package/dist/dash/public/assets/chunks/models-list-44f857a469ca04d5.js +1 -0
- package/dist/dash/public/assets/chunks/paged-bc6fa0c2b9d52ed7.js +1 -0
- package/dist/dash/public/assets/chunks/platform-actions-d1426602049926d2.js +1 -0
- package/dist/dash/public/assets/chunks/runners-list-1901af8a5dea1f09.js +1 -0
- package/dist/dash/public/assets/chunks/runtime-246221e985d863e5-1.js +2 -0
- package/dist/dash/public/assets/chunks/segmented-358ff2b4992b8384.js +1 -0
- package/dist/dash/public/assets/chunks/select-7ae25fd8a7d6c338.js +1 -0
- package/dist/dash/public/assets/chunks/sentinel-c972a33dc69a5135.js +1 -0
- package/dist/dash/public/assets/chunks/shared-init-246221e985d863e5-2.js +1 -0
- package/dist/dash/public/assets/chunks/shared-init-88cce66bb3cfe1e5.js +5 -0
- package/dist/dash/public/assets/chunks/shared-init-8f2ac936c95a7f7b.js +1 -0
- package/dist/dash/public/assets/chunks/shared-init-ffb3397e494137c9.js +2 -0
- package/dist/dash/public/assets/chunks/tail-7c27aab8ba268bd9.js +1 -0
- package/dist/dash/public/assets/chunks/task-actions-8e1d93c788d001df.js +1 -0
- package/dist/dash/public/assets/chunks/task-fa8b82e95e771c4a.js +1 -0
- package/dist/dash/public/assets/chunks/task-view-6d7618d2820a5cb4.js +3 -0
- package/dist/dash/public/assets/chunks/tasks-list-f4784e5cbd0ed785.js +1 -0
- package/dist/dash/public/assets/chunks/toolbar-a75d2570f07cbb70.js +1 -0
- package/dist/dash/public/assets/chunks/versions-list-fc2e0d2a7382e049.js +1 -0
- package/dist/dash/public/assets/chunks/wular-pnext-246221e985d863e5-0.js +1 -0
- package/dist/dash/public/assets/connect-382b1729a7ae7808.css +1 -0
- package/dist/dash/public/assets/dash-9e02d5d1a6d42ee3.css +1 -0
- package/dist/dash/public/assets/dash-account-04859899c1838ada.css +1 -0
- package/dist/dash/public/assets/dash-agents-9e678137267dec07.css +1 -0
- package/dist/dash/public/assets/dash-agents-new-26fa27b17ef9b8d8.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-b975c48f8abf3444.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-edit-e13fda599bb04843.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-platforms-70292932cb27bc96.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-settings-71f9a86251723fcc.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-tasks-fb8eb2ed71006601.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-usage-7c8740f1cdd52c71.css +1 -0
- package/dist/dash/public/assets/dash-settings-8eb818da462227e8.css +1 -0
- package/dist/dash/public/assets/dash-settings-param-tab-849a1a9542e273f5.css +1 -0
- package/dist/dash/public/assets/dash-tasks-81e510e0b6931b42.css +1 -0
- package/dist/dash/public/assets/dash-tasks-param-id-bbd2a83342f2ec10.css +1 -0
- package/dist/dash/public/assets/dash-usage-8e0259e03eaed1bd.css +1 -0
- package/dist/dash/public/assets/favicon.ico +0 -0
- package/dist/dash/public/assets/favicon.svg +1 -0
- package/dist/dash/public/assets/fonts/LICENSE-fira-code +93 -0
- package/dist/dash/public/assets/fonts/fira-code-latin-400-normal-717ee080.woff2 +0 -0
- package/dist/dash/public/assets/fonts/fira-code-latin-500-normal-530b6706.woff2 +0 -0
- package/dist/dash/public/assets/fonts/fira-code-latin-700-normal-98730669.woff2 +0 -0
- package/dist/dash/public/assets/global-d2adbf01910d9df5.css +1 -0
- package/dist/dash/public/assets/login-c129b1ce237be260.css +1 -0
- package/dist/dash/public/assets/pnext-client-03b03b254e525e82.js +1 -0
- package/dist/dash/public/assets/pnext-client-1b9ab0963a8ff77b.js +1 -0
- package/dist/dash/public/assets/pnext-client-1c7859bb888f4ef0.js +1 -0
- package/dist/dash/public/assets/pnext-client-3c748afe963fb05d.js +1 -0
- package/dist/dash/public/assets/pnext-client-4f47c2cae220f107.js +1 -0
- package/dist/dash/public/assets/pnext-client-6ab9fd9b53b794d2.js +1 -0
- package/dist/dash/public/assets/pnext-client-6c241786342498e4.js +1 -0
- package/dist/dash/public/assets/pnext-client-80b56d420f02b808.js +1 -0
- package/dist/dash/public/assets/pnext-client-83135c17bae850a3.js +1 -0
- package/dist/dash/public/assets/pnext-client-8e6fa4302ae0396f.js +1 -0
- package/dist/dash/public/assets/pnext-client-932c9d8cc0717fc8.js +1 -0
- package/dist/dash/public/assets/pnext-client-a42ae63d4de113f9.js +1 -0
- package/dist/dash/public/assets/pnext-client-d2ee6f8c1e337032.js +1 -0
- package/dist/dash/public/assets/pnext-client-d513f65ec23b7f20.js +1 -0
- package/dist/dash/public/assets/pnext-client-ecb88e2a8a109954.js +1 -0
- package/dist/dash/public/assets/pnext-client-f1545ee6270bbf9a.js +1 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/boot-B2MFTRO2.js +30 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/build-tier-XJJSL5FR.js +2704 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2HFY3DQT.js +208 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2ICEVELW.js +834 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-3UPROT2C.js +35 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4P5CMIYT.js +1582 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4TKZKZ3Q.js +131 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-5RDEILQB.js +437 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-62KEQM43.js +25 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-6KQSWT6D.js +831 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-7DCNCW6O.js +724 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-B4THCTQP.js +22 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-C2LIV2MM.js +172 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-CCATPVTW.js +378 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-COXJAPTU.js +89 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-E6IXL2NJ.js +6270 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FLGRBFAH.js +1198 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FTJVHFWD.js +61 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-H523KSIH.js +5151 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-HT6KKX6A.js +20 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JESFYECC.js +438 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JRPJM2XY.js +17 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L2IWDUXG.js +107 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L5P4Y4UC.js +183 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-NQE46AZN.js +647 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PA4QEARJ.js +129 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PZ5AXOLW.js +7146 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-SNVPTULL.js +2397 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-T3QZT3PG.js +220 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-VC5O2SDP.js +72 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-WZX4V6CM.js +231 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-XUUIDXY5.js +627 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-ZHFDO3PR.js +265 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/compile-CE2DN7ZA.js +18 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-UREY7XJT.js +16 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-loader-UI2XE3PZ.js +17 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/entry.js +219 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/generate-I2PPTDFD.js +16 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/modules-UVOCE4C2.js +48 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/pipeline-UW47K537.js +963 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/proxy-ITGOVJBW.js +26 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/register-4SA55SWT.js +12579 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/router-JNKHLBCZ.js +505 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/routes-PD6J2NXW.js +54 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/tsconfig-defaults-ZXEH7RQK.js +15 -0
- package/dist/default-Bobztoxf.js +1 -0
- package/dist/default-vYPT26DR.js +1 -0
- package/dist/delete-D8gEwoOj.js +4 -0
- package/dist/delete-z1_86nf6.js +2 -0
- package/dist/disable-DVKd-0Xb.js +1 -0
- package/dist/discover-Df-a8K4R.js +3 -0
- package/dist/discover-Dvr_3_Xr.js +1 -0
- package/dist/dispatch-BKeAch9E.js +14 -0
- package/dist/docs-BX65z2Iu.js +2 -0
- package/dist/docs-DKJnqZqt.js +2 -0
- package/dist/enable-C8Zf_wpN.js +1 -0
- package/dist/env-CRf6wkM2.js +1 -0
- package/dist/exec-RZFLclKX.js +11 -0
- package/dist/executor-BvAA7Cgw.js +10 -0
- package/dist/flow/builtin/review.d.ts +157 -0
- package/dist/flow/builtin/review.js +19 -0
- package/dist/flow/index.d.ts +1 -1
- package/dist/flow/index.js +1 -1
- package/dist/flow-17k25MHt.js +1 -0
- package/dist/github-actions-DwUzm4hC.js +24 -0
- package/dist/http-Bkg_OQ6r.js +1 -0
- package/dist/{index-BQ-b77or.d.ts → index-CZjFX5zV.d.ts} +116 -238
- package/dist/init-CoMfFxbG.js +1 -0
- package/dist/integrations-5xCaXSd-.js +1 -0
- package/dist/integrations-BAgdVDhj.js +5 -0
- package/dist/lib/broker.js +3 -3
- package/dist/list-BAKvxSbh.js +4 -0
- package/dist/list-BYiG8Zav.js +2 -0
- package/dist/list-BxEywhHU.js +1 -0
- package/dist/list-C5w01-8q.js +1 -0
- package/dist/list-CIW2joV1.js +1 -0
- package/dist/list-DX-z3SBp.js +3 -0
- package/dist/list-DpCf4G-H.js +4 -0
- package/dist/list-VToARh3C.js +1 -0
- package/dist/load-BpEsAn51.js +2 -0
- package/dist/local-H3uvqEbq.js +1 -0
- package/dist/log-view-dg0TlKLA.js +1 -0
- package/dist/login-BFxX4jJy.js +1 -0
- package/dist/login-DkkslfBx.js +1 -0
- package/dist/logout-BHAtw4Z8.js +1 -0
- package/dist/maintenance-C5FklUw3.js +1 -0
- package/dist/match-CXAjDhg7.js +1 -0
- package/dist/mcp-BgKb2Cdk.js +1 -0
- package/dist/mcp-CCZOAo06.js +1 -0
- package/dist/mcp-server-DGzme0YX.js +1 -0
- package/dist/migrate-C4vM7DQN.js +2 -0
- package/dist/migrate-N-85_N7J.js +1 -0
- package/dist/model-Bs1StDo3.js +1 -0
- package/dist/models-_5LVGC3m.js +1 -0
- package/dist/output-BKeyLbvt.js +5 -0
- package/dist/prompt-CEuBMNhk.js +7 -0
- package/dist/push-CUC55Bqd.js +1 -0
- package/dist/queue-6io_NOP3.js +116 -0
- package/dist/refresh-BIrmrWYq.js +1 -0
- package/dist/remote-miQNTVRa.js +1 -0
- package/dist/remove-B93LNkZI.js +1 -0
- package/dist/remove-C5_xggx7.js +1 -0
- package/dist/remove-CuH8a3L9.js +1 -0
- package/dist/remove-eQ8y5C5p.js +1 -0
- package/dist/rename-CYfy03FE.js +1 -0
- package/dist/result-BEtQZHaY.js +5 -0
- package/dist/result-BzaM3inj.js +15 -0
- package/dist/resume-DYzKvyEw.js +3 -0
- package/dist/review-oIBeECZE.js +7 -0
- package/dist/rolldown-runtime-DT7IzrpZ.js +1 -0
- package/dist/rotate-key-IdMYH7gg.js +1 -0
- package/dist/run-BDYl0CKl.js +2 -0
- package/dist/run-CTtd0Znc.js +5 -0
- package/dist/run-CawRGnOg.js +2 -0
- package/dist/runner-D7ScbIHJ.js +1 -0
- package/dist/runner-sUpWJ_k0.js +1 -0
- package/dist/schema-CU2iFkp8.js +1 -0
- package/dist/sdk.d.ts +1166 -191
- package/dist/sdk.js +1 -1
- package/dist/serve-BTeomYxW.js +1 -0
- package/dist/serve-CE8YV2e9.js +1 -0
- package/dist/serve-CPnmrKyf.js +2 -0
- package/dist/serve-CQKZxzFE.js +4 -0
- package/dist/serve-GmRO89s5.js +12 -0
- package/dist/server-Kb22cWfF.js +1 -0
- package/dist/setup-host-GFTUzzZJ.js +6 -0
- package/dist/shared-DVtzWhUT.js +1 -0
- package/dist/show-CMUg8SJu.js +1 -0
- package/dist/show-COTZEYgc.js +1 -0
- package/dist/status-D26U--p8.js +1 -0
- package/dist/steer-C6uARLp5.js +4 -0
- package/dist/stop-BrGI3hSS.js +1 -0
- package/dist/stop-ByCAlbmN.js +3 -0
- package/dist/store-B94tSate.js +42 -0
- package/dist/store-DzqXS2wT.js +8 -0
- package/dist/task-C6VAg5WU.js +1 -0
- package/dist/task-CgOKgkEG.js +1 -0
- package/dist/task-DeglY79z.js +5 -0
- package/dist/test-NEbhlxvo.js +1 -0
- package/dist/tools-D0Zfs8Hx.js +1 -0
- package/dist/types-D0q15RJa.js +1 -0
- package/dist/types-I5Cwtl_K.d.ts +389 -0
- package/dist/unalias-C9NqmSDq.js +1 -0
- package/dist/update-BTxYQj7Z.js +2 -0
- package/dist/upgrade-hA0yWBvx.js +2 -0
- package/dist/usage-BhqoCjvE.js +1 -0
- package/dist/usage-C4d9X2Uq.js +1 -0
- package/dist/watch-CSdj24ct.js +5 -0
- package/dist/watch-DtRuC0Wc.js +8 -0
- package/dist/wire-BeT1Axeo.js +1 -0
- package/dist/worker-CXndxmGF.js +9 -0
- package/dist/worker-DX7P9kWl.js +1 -0
- package/dist/workflow-Dcmdooi8.js +1 -0
- package/docs/agents/coder.md +26 -0
- package/docs/agents/index.md +120 -0
- package/docs/config.md +51 -30
- package/docs/dash.md +64 -0
- package/docs/flows.md +20 -15
- package/docs/mcp.md +62 -0
- package/docs/models.md +41 -23
- package/docs/review.md +41 -0
- package/docs/sdk.md +57 -38
- package/docs/self-host.md +188 -0
- package/migrations/0000_initial.sql +252 -0
- package/migrations/meta/0000_snapshot.json +1787 -0
- package/migrations/meta/_journal.json +13 -0
- package/package.json +37 -7
- package/plugins/agents/skills/coder/SKILL.md +14 -60
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/commands/setup.md +2 -2
- package/plugins/claude/skills/dispatch/SKILL.md +14 -58
- package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
- package/plugins/cursor/README.md +5 -5
- package/plugins/cursor/assets/logo.png +0 -0
- package/plugins/cursor/skills/coder/SKILL.md +14 -59
- package/src/client/index.ts +573 -0
- package/src/client/types.ts +506 -0
- package/src/core/errors.ts +72 -0
- package/src/core/task/log-view.ts +173 -0
- package/src/server/auth/sign-in.ts +14 -0
- package/src/server/dash/api/load.ts +62 -0
- package/src/server/dash/api/types.ts +11 -0
- package/src/server/dash/app/connect/page.tsx +42 -0
- package/src/server/dash/app/dash/account/loading.tsx +11 -0
- package/src/server/dash/app/dash/account/notify.tsx +42 -0
- package/src/server/dash/app/dash/account/page.css +81 -0
- package/src/server/dash/app/dash/account/page.tsx +126 -0
- package/src/server/dash/app/dash/account/sign-out.tsx +24 -0
- package/src/server/dash/app/dash/agents/(list)/agent-menu.tsx +10 -0
- package/src/server/dash/app/dash/agents/(list)/agents-grid.tsx +143 -0
- package/src/server/dash/app/dash/agents/(list)/connect-apps.tsx +46 -0
- package/src/server/dash/app/dash/agents/(list)/loading.tsx +14 -0
- package/src/server/dash/app/dash/agents/(list)/page.css +72 -0
- package/src/server/dash/app/dash/agents/(list)/page.tsx +89 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/layout.tsx +135 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/loading.tsx +5 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/page.css +21 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/page.tsx +173 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/loading.tsx +18 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/page.css +87 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/page.tsx +258 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/platform-actions.tsx +111 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/agent-settings-form.css +114 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/agent-settings-form.tsx +294 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/loading.tsx +5 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/page.tsx +54 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/tasks/loading.tsx +5 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/tasks/page.tsx +14 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/loading.tsx +31 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/page.css +12 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/page.tsx +163 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/versions-list.tsx +53 -0
- package/src/server/dash/app/dash/agents/[slug]/edit/loading.tsx +31 -0
- package/src/server/dash/app/dash/agents/[slug]/edit/page.tsx +91 -0
- package/src/server/dash/app/dash/agents/agent/agent-pills.css +27 -0
- package/src/server/dash/app/dash/agents/agent/agent-pills.tsx +133 -0
- package/src/server/dash/app/dash/agents/agent/hero.css +40 -0
- package/src/server/dash/app/dash/agents/agent/hero.tsx +60 -0
- package/src/server/dash/app/dash/agents/agent/instructions.css +29 -0
- package/src/server/dash/app/dash/agents/agent/instructions.tsx +82 -0
- package/src/server/dash/app/dash/agents/editor/connect-repositories.ts +16 -0
- package/src/server/dash/app/dash/agents/editor/editor.css +263 -0
- package/src/server/dash/app/dash/agents/editor/editor.tsx +774 -0
- package/src/server/dash/app/dash/agents/editor/import-picker.css +48 -0
- package/src/server/dash/app/dash/agents/editor/import-picker.tsx +253 -0
- package/src/server/dash/app/dash/agents/editor/names.ts +35 -0
- package/src/server/dash/app/dash/agents/new/loading.tsx +25 -0
- package/src/server/dash/app/dash/agents/new/page.tsx +72 -0
- package/src/server/dash/app/dash/layout.css +265 -0
- package/src/server/dash/app/dash/layout.tsx +332 -0
- package/src/server/dash/app/dash/page.tsx +14 -0
- package/src/server/dash/app/dash/settings/[tab]/credentials-list.css +94 -0
- package/src/server/dash/app/dash/settings/[tab]/credentials-list.tsx +619 -0
- package/src/server/dash/app/dash/settings/[tab]/credentials.tsx +36 -0
- package/src/server/dash/app/dash/settings/[tab]/engines-list.css +16 -0
- package/src/server/dash/app/dash/settings/[tab]/engines-list.tsx +135 -0
- package/src/server/dash/app/dash/settings/[tab]/list.css +98 -0
- package/src/server/dash/app/dash/settings/[tab]/list.tsx +215 -0
- package/src/server/dash/app/dash/settings/[tab]/loading.tsx +6 -0
- package/src/server/dash/app/dash/settings/[tab]/mcp-list.css +43 -0
- package/src/server/dash/app/dash/settings/[tab]/mcp-list.tsx +290 -0
- package/src/server/dash/app/dash/settings/[tab]/models-list.tsx +513 -0
- package/src/server/dash/app/dash/settings/[tab]/page.tsx +89 -0
- package/src/server/dash/app/dash/settings/[tab]/runners-list.css +153 -0
- package/src/server/dash/app/dash/settings/[tab]/runners-list.tsx +457 -0
- package/src/server/dash/app/dash/settings/layout.tsx +50 -0
- package/src/server/dash/app/dash/settings/model-options.ts +117 -0
- package/src/server/dash/app/dash/settings/page.tsx +7 -0
- package/src/server/dash/app/dash/settings/settings-head.tsx +24 -0
- package/src/server/dash/app/dash/settings/tunnel-guide.tsx +28 -0
- package/src/server/dash/app/dash/tasks/[id]/activity.tsx +202 -0
- package/src/server/dash/app/dash/tasks/[id]/loading.tsx +31 -0
- package/src/server/dash/app/dash/tasks/[id]/page.tsx +30 -0
- package/src/server/dash/app/dash/tasks/[id]/task-actions.tsx +164 -0
- package/src/server/dash/app/dash/tasks/[id]/task-view.css +407 -0
- package/src/server/dash/app/dash/tasks/[id]/task-view.tsx +513 -0
- package/src/server/dash/app/dash/tasks/composer-data.ts +96 -0
- package/src/server/dash/app/dash/tasks/composer.css +316 -0
- package/src/server/dash/app/dash/tasks/composer.tsx +890 -0
- package/src/server/dash/app/dash/tasks/list/status.css +50 -0
- package/src/server/dash/app/dash/tasks/list/status.tsx +20 -0
- package/src/server/dash/app/dash/tasks/list/task.ts +45 -0
- package/src/server/dash/app/dash/tasks/list/tasks-list.css +85 -0
- package/src/server/dash/app/dash/tasks/list/tasks-list.tsx +402 -0
- package/src/server/dash/app/dash/tasks/list/tasks-section.tsx +96 -0
- package/src/server/dash/app/dash/tasks/page.tsx +53 -0
- package/src/server/dash/app/dash/token-from-hash.tsx +17 -0
- package/src/server/dash/app/dash/usage/custom-range.tsx +63 -0
- package/src/server/dash/app/dash/usage/day-chart.css +109 -0
- package/src/server/dash/app/dash/usage/day-chart.tsx +110 -0
- package/src/server/dash/app/dash/usage/loading.tsx +17 -0
- package/src/server/dash/app/dash/usage/metric.ts +13 -0
- package/src/server/dash/app/dash/usage/page.tsx +117 -0
- package/src/server/dash/app/dash/usage/range-bar.css +13 -0
- package/src/server/dash/app/dash/usage/range-bar.tsx +69 -0
- package/src/server/dash/app/dash/usage/stats.css +52 -0
- package/src/server/dash/app/dash/usage/stats.tsx +19 -0
- package/src/server/dash/app/dash/usage/top-agents.css +40 -0
- package/src/server/dash/app/dash/usage/top-agents.tsx +138 -0
- package/src/server/dash/app/dash/usage/usage.css +0 -0
- package/src/server/dash/app/globals.css +692 -0
- package/src/server/dash/app/layout.tsx +52 -0
- package/src/server/dash/app/login/page.css +26 -0
- package/src/server/dash/app/login/page.tsx +57 -0
- package/src/server/dash/app/page.tsx +5 -0
- package/src/server/dash/app/responsive.css +49 -0
- package/src/server/dash/app/zone.tsx +13 -0
- package/src/server/dash/comps/frame/auth-panel.css +60 -0
- package/src/server/dash/comps/frame/auth-panel.tsx +44 -0
- package/src/server/dash/comps/frame/drawer.css +28 -0
- package/src/server/dash/comps/frame/drawer.tsx +39 -0
- package/src/server/dash/comps/frame/heads.ts +41 -0
- package/src/server/dash/comps/frame/loading-card.tsx +65 -0
- package/src/server/dash/comps/frame/page-head.css +83 -0
- package/src/server/dash/comps/frame/page-head.tsx +71 -0
- package/src/server/dash/comps/frame/stream.tsx +50 -0
- package/src/server/dash/comps/frame/task-toasts.tsx +214 -0
- package/src/server/dash/comps/frame/theme-choices.tsx +46 -0
- package/src/server/dash/comps/nav/current-link.tsx +53 -0
- package/src/server/dash/comps/nav/side-toggle.tsx +30 -0
- package/src/server/dash/comps/nav/to.ts +22 -0
- package/src/server/dash/comps/ui/badge.css +64 -0
- package/src/server/dash/comps/ui/badge.tsx +41 -0
- package/src/server/dash/comps/ui/card.css +93 -0
- package/src/server/dash/comps/ui/card.tsx +77 -0
- package/src/server/dash/comps/ui/collapse.css +32 -0
- package/src/server/dash/comps/ui/collapse.tsx +49 -0
- package/src/server/dash/comps/ui/combo.tsx +154 -0
- package/src/server/dash/comps/ui/confirm.css +36 -0
- package/src/server/dash/comps/ui/confirm.tsx +67 -0
- package/src/server/dash/comps/ui/field.css +25 -0
- package/src/server/dash/comps/ui/field.tsx +34 -0
- package/src/server/dash/comps/ui/icon.css +22 -0
- package/src/server/dash/comps/ui/icon.tsx +17 -0
- package/src/server/dash/comps/ui/icons.ts +44 -0
- package/src/server/dash/comps/ui/menu.css +178 -0
- package/src/server/dash/comps/ui/menu.tsx +152 -0
- package/src/server/dash/comps/ui/segmented.css +44 -0
- package/src/server/dash/comps/ui/segmented.tsx +58 -0
- package/src/server/dash/comps/ui/select.css +103 -0
- package/src/server/dash/comps/ui/select.tsx +250 -0
- package/src/server/dash/comps/ui/sentinel.css +58 -0
- package/src/server/dash/comps/ui/sentinel.tsx +67 -0
- package/src/server/dash/comps/ui/tabs.css +81 -0
- package/src/server/dash/comps/ui/tabs.tsx +32 -0
- package/src/server/dash/comps/ui/tail.css +12 -0
- package/src/server/dash/comps/ui/tail.tsx +37 -0
- package/src/server/dash/comps/ui/toast.css +72 -0
- package/src/server/dash/comps/ui/toolbar.css +143 -0
- package/src/server/dash/comps/ui/toolbar.tsx +93 -0
- package/src/server/dash/package.json +5 -0
- package/src/server/dash/pnext-env.d.ts +4 -0
- package/src/server/dash/pnext.config.ts +5 -0
- package/src/server/dash/public/assets/apple-touch-icon.png +0 -0
- package/src/server/dash/public/assets/favicon.ico +0 -0
- package/src/server/dash/public/assets/favicon.svg +1 -0
- package/src/server/dash/public/assets/fonts/LICENSE-fira-code +93 -0
- package/src/server/dash/public/assets/fonts/fira-code-latin-400-normal-717ee080.woff2 +0 -0
- package/src/server/dash/public/assets/fonts/fira-code-latin-500-normal-530b6706.woff2 +0 -0
- package/src/server/dash/public/assets/fonts/fira-code-latin-700-normal-98730669.woff2 +0 -0
- package/src/server/dash/tsconfig.json +10 -0
- package/src/server/dash/utils/client.ts +19 -0
- package/src/server/dash/utils/format.ts +75 -0
- package/src/server/dash/utils/paged.ts +184 -0
- package/src/server/dash/utils/range.ts +117 -0
- package/dist/app-server-CW93J9zJ.js +0 -3
- package/dist/runtime-D-U1DNkI.js +0 -26
- package/dist/upgrade-DOj06r5b.js +0 -37
|
@@ -0,0 +1,890 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './composer.css';
|
|
4
|
+
|
|
5
|
+
import { Fragment } from 'preact';
|
|
6
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState } from 'preact/hooks';
|
|
7
|
+
|
|
8
|
+
import type { LocalFolder, LocalFolders } from '@coder/client/types';
|
|
9
|
+
import { client } from '@/utils/client';
|
|
10
|
+
import { formatDate } from '@/utils/format';
|
|
11
|
+
import { iAlert, iCheck, iDown, iPlus, iRight, iSliders, iSteer, iX } from '@/comps/ui/icons';
|
|
12
|
+
import { Link } from '@wular/pnext/link';
|
|
13
|
+
import { useRouter } from '@wular/pnext/navigation/client';
|
|
14
|
+
import { Loading } from '@/comps/ui/card';
|
|
15
|
+
import { reasonText } from '@/utils/format';
|
|
16
|
+
import { ErrorText } from '@/comps/ui/field';
|
|
17
|
+
import { Icon } from '@/comps/ui/icon';
|
|
18
|
+
import { Select, type Option } from '@/comps/ui/select';
|
|
19
|
+
import { MenuRadio } from '@/comps/ui/menu';
|
|
20
|
+
import { connectRepositories } from '@/app/dash/agents/editor/connect-repositories';
|
|
21
|
+
import {
|
|
22
|
+
ENGINES,
|
|
23
|
+
ENGINE_NAMES,
|
|
24
|
+
defaultLabel,
|
|
25
|
+
modelValue,
|
|
26
|
+
splitModel,
|
|
27
|
+
} from '@/app/dash/settings/model-options';
|
|
28
|
+
import { folderName } from '@/app/dash/tasks/list/task';
|
|
29
|
+
import { watchTask } from '@/comps/frame/task-toasts';
|
|
30
|
+
import { CHOICE, PLACEHOLDER, loadComposer, savedChoice } from './composer-data';
|
|
31
|
+
|
|
32
|
+
/** What the composer runs with; the last one used comes back through the `compose` cookie. */
|
|
33
|
+
export interface Choice {
|
|
34
|
+
repo: string;
|
|
35
|
+
/** A folder on the local server's machine; unset is the server's own. */
|
|
36
|
+
cwd: string;
|
|
37
|
+
agent: string;
|
|
38
|
+
engine: string;
|
|
39
|
+
model: string;
|
|
40
|
+
effort: string;
|
|
41
|
+
permissions: string;
|
|
42
|
+
runner: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The workspace's defaults, per engine, for settings left unset. */
|
|
46
|
+
export interface Defaults {
|
|
47
|
+
engine: string;
|
|
48
|
+
engines: Record<string, { model?: string; effort?: string; permissions?: string } | undefined>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type Pull = { number: number; title: string; author?: string; createdAt?: string };
|
|
52
|
+
export type Lists = {
|
|
53
|
+
agents: [string, string][];
|
|
54
|
+
repos: string[];
|
|
55
|
+
models: Record<string, string[]>;
|
|
56
|
+
runners: Option[];
|
|
57
|
+
flows: string[];
|
|
58
|
+
/** Only on a local server. */
|
|
59
|
+
folders?: LocalFolders;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const EFFORTS: Option[] = [
|
|
63
|
+
['', 'Default'],
|
|
64
|
+
['low', 'Low'],
|
|
65
|
+
['medium', 'Medium'],
|
|
66
|
+
['high', 'High'],
|
|
67
|
+
];
|
|
68
|
+
const PERMISSIONS: Option[] = [
|
|
69
|
+
['', 'Default'],
|
|
70
|
+
['read-only', 'Read-only'],
|
|
71
|
+
['workspace-write', 'Write'],
|
|
72
|
+
['auto', 'Auto'],
|
|
73
|
+
];
|
|
74
|
+
const DRAFT = 'coder:draft';
|
|
75
|
+
const CONNECT = '+connect';
|
|
76
|
+
const OTHER = '+other';
|
|
77
|
+
const PICK = '+pick';
|
|
78
|
+
const CLONE = '+clone';
|
|
79
|
+
/** `/review 40` or `/flow release pr=12`: the command, its first word, and the rest. */
|
|
80
|
+
const COMMAND = /^\/(review|flow)(?:\s+(\S+))?\s*([\s\S]*)$/;
|
|
81
|
+
|
|
82
|
+
/** A select's options: its unset value, then the picked value, then the rest, so it shows its label before the list loads. */
|
|
83
|
+
const optionsOf = (fallback: string, value: string, values: string[]): Option[] => [
|
|
84
|
+
['', fallback],
|
|
85
|
+
...[...new Set([value, ...values])].filter(Boolean).map((each): Option => [each, each]),
|
|
86
|
+
];
|
|
87
|
+
// Named choices; a value the list lacks still shows, as itself.
|
|
88
|
+
const named = (fallback: string, value: string, values: Option[]): Option[] => [
|
|
89
|
+
['', fallback],
|
|
90
|
+
...(value && !values.some(([id]) => id === value) ? [[value, value] as Option] : []),
|
|
91
|
+
...values,
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
/** Unset runs in the server's own folder; then recent and chosen ones, then the machine's dialog or a path box, then a repository URL box. A saved folder the list lacks still shows. */
|
|
95
|
+
const folderOptions = (folders: LocalFolders, added: LocalFolder[], value: string): Option[] => {
|
|
96
|
+
const paths = [...folders.recent, ...added].map(each => each.path);
|
|
97
|
+
return [
|
|
98
|
+
['', 'No folder'],
|
|
99
|
+
...[...new Set([...paths, value])]
|
|
100
|
+
.filter(path => path && path !== folders.current.path)
|
|
101
|
+
.map((path): Option => [path, folderName(path)]),
|
|
102
|
+
folders.picker ? [PICK, 'Choose…'] : [OTHER, 'Type a path…'],
|
|
103
|
+
[CLONE, 'Repository…'],
|
|
104
|
+
];
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/** Segments whose unset first one names the value it resolves to. */
|
|
108
|
+
/** The chain.s default first, then one section per engine: its own default and its models. */
|
|
109
|
+
function modelSections(
|
|
110
|
+
groups: Record<string, string[]>,
|
|
111
|
+
defaults: Defaults,
|
|
112
|
+
): Array<[string, Option[]]> {
|
|
113
|
+
const sections: Array<[string, Option[]]> = [
|
|
114
|
+
[
|
|
115
|
+
'',
|
|
116
|
+
[
|
|
117
|
+
[
|
|
118
|
+
'',
|
|
119
|
+
`Default · ${[ENGINE_NAMES[defaults.engine] ?? defaults.engine, defaults.engines[defaults.engine]?.model].filter(Boolean).join(' ')}`,
|
|
120
|
+
],
|
|
121
|
+
],
|
|
122
|
+
],
|
|
123
|
+
];
|
|
124
|
+
for (const engine of ENGINES) {
|
|
125
|
+
if (!groups[engine]?.length) continue;
|
|
126
|
+
sections.push([
|
|
127
|
+
ENGINE_NAMES[engine] ?? engine,
|
|
128
|
+
[
|
|
129
|
+
[modelValue(engine, ''), defaultLabel(defaults.engines[engine]?.model)],
|
|
130
|
+
...groups[engine]!.map((model): Option => [modelValue(engine, model), model]),
|
|
131
|
+
],
|
|
132
|
+
]);
|
|
133
|
+
}
|
|
134
|
+
return sections;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const resolved = (options: Option[], value?: string): Option[] => {
|
|
138
|
+
const label = options.find(([key]) => key && key === value)?.[1];
|
|
139
|
+
return [['', defaultLabel(label?.toLowerCase())], ...options.slice(1)];
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/** Places an opening popover under its button, right-aligned to it. */
|
|
143
|
+
function place(event: ToggleEvent) {
|
|
144
|
+
const pop = event.currentTarget as HTMLElement;
|
|
145
|
+
const box = document.querySelector(`[popovertarget="${pop.id}"]`)?.getBoundingClientRect();
|
|
146
|
+
if (event.newState !== 'open' || !box) return;
|
|
147
|
+
const top = Math.round(box.bottom + 6);
|
|
148
|
+
pop.style.top = `${top}px`;
|
|
149
|
+
pop.style.right = `${Math.round(document.documentElement.clientWidth - box.right)}px`;
|
|
150
|
+
// The menu scrolls inside the viewport instead of running off it.
|
|
151
|
+
pop.style.maxHeight = `${Math.max(160, window.innerHeight - top - 16)}px`;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** `key=value` pairs; a value that reads as JSON keeps its type, a bare key is true. */
|
|
155
|
+
function argsOf(text: string): Record<string, unknown> {
|
|
156
|
+
return Object.fromEntries(
|
|
157
|
+
text
|
|
158
|
+
.split(/\s+/)
|
|
159
|
+
.filter(Boolean)
|
|
160
|
+
.map(pair => {
|
|
161
|
+
const at = pair.indexOf('=');
|
|
162
|
+
const raw = at < 0 ? 'true' : pair.slice(at + 1);
|
|
163
|
+
try {
|
|
164
|
+
return [at < 0 ? pair : pair.slice(0, at), JSON.parse(raw)];
|
|
165
|
+
} catch {
|
|
166
|
+
return [pair.slice(0, at), raw];
|
|
167
|
+
}
|
|
168
|
+
}),
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** One row of a picker list; `head` starts a group. */
|
|
173
|
+
type Entry = { key: string; label: string; hint?: string; head?: string; pick: () => void };
|
|
174
|
+
|
|
175
|
+
/** Rows under a combobox; the field keeps focus, so the mouse never takes it. */
|
|
176
|
+
function Entries({
|
|
177
|
+
id,
|
|
178
|
+
entries,
|
|
179
|
+
active,
|
|
180
|
+
selected,
|
|
181
|
+
onActive,
|
|
182
|
+
}: {
|
|
183
|
+
id: string;
|
|
184
|
+
entries: Entry[];
|
|
185
|
+
active: number;
|
|
186
|
+
selected?: string;
|
|
187
|
+
onActive: (index: number) => void;
|
|
188
|
+
}) {
|
|
189
|
+
return (
|
|
190
|
+
<>
|
|
191
|
+
{entries.flatMap((entry, index) => [
|
|
192
|
+
entry.head ? (
|
|
193
|
+
<div key={`h:${entry.key}`} class="pop-label" role="presentation">
|
|
194
|
+
{entry.head}
|
|
195
|
+
</div>
|
|
196
|
+
) : null,
|
|
197
|
+
<div
|
|
198
|
+
key={entry.key}
|
|
199
|
+
id={`${id}-${index}`}
|
|
200
|
+
role="option"
|
|
201
|
+
aria-selected={selected === undefined ? index === active : entry.key === selected}
|
|
202
|
+
class={index === active ? 'pop-item on' : 'pop-item'}
|
|
203
|
+
onMouseDown={event => event.preventDefault()}
|
|
204
|
+
onPointerMove={() => index !== active && onActive(index)}
|
|
205
|
+
onClick={entry.pick}
|
|
206
|
+
>
|
|
207
|
+
<span class="grow">{entry.label}</span>
|
|
208
|
+
{entry.hint ? <small>{entry.hint}</small> : null}
|
|
209
|
+
{selected === undefined ? null : <Icon d={iCheck} />}
|
|
210
|
+
</div>,
|
|
211
|
+
])}
|
|
212
|
+
</>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** Arrows move through `count` rows and wrap; returns whether the key was one of them. */
|
|
217
|
+
const stepped = (
|
|
218
|
+
event: KeyboardEvent,
|
|
219
|
+
at: number,
|
|
220
|
+
count: number,
|
|
221
|
+
move: (index: number) => void,
|
|
222
|
+
) => {
|
|
223
|
+
const step = { ArrowDown: 1, ArrowUp: -1 }[event.key];
|
|
224
|
+
if (!step || !count) return false;
|
|
225
|
+
event.preventDefault();
|
|
226
|
+
move((at + step + count) % count);
|
|
227
|
+
return true;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
/** A credential link that comes back here with the draft kept. */
|
|
231
|
+
export function NeedsCredential({
|
|
232
|
+
reason,
|
|
233
|
+
back = '/dash/tasks',
|
|
234
|
+
}: {
|
|
235
|
+
reason?: string;
|
|
236
|
+
back?: string;
|
|
237
|
+
}) {
|
|
238
|
+
return (
|
|
239
|
+
<div class="notice slim" role="status">
|
|
240
|
+
<Icon d={iAlert} />
|
|
241
|
+
<span class="grow">{reason || 'Tasks need a model credential to run.'}</span>
|
|
242
|
+
<Link
|
|
243
|
+
class="btn outline sm"
|
|
244
|
+
href="/dash/settings/[tab]"
|
|
245
|
+
params={{ tab: 'credentials' }}
|
|
246
|
+
search={{ return: back }}
|
|
247
|
+
>
|
|
248
|
+
Add credential
|
|
249
|
+
</Link>
|
|
250
|
+
</div>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** The dashboard's one box: type and press Enter to start a task, or `/` for reviews and flows. */
|
|
255
|
+
export function Composer({
|
|
256
|
+
initial,
|
|
257
|
+
data,
|
|
258
|
+
defaults,
|
|
259
|
+
missing,
|
|
260
|
+
connectLabel,
|
|
261
|
+
tz,
|
|
262
|
+
}: {
|
|
263
|
+
initial: Partial<Choice>;
|
|
264
|
+
data: Lists;
|
|
265
|
+
defaults: Defaults;
|
|
266
|
+
/** No credential can run a task yet; the page says so already. */
|
|
267
|
+
missing?: boolean;
|
|
268
|
+
/** The repository chip's last item, from the platform that reaches repositories. */
|
|
269
|
+
connectLabel: string;
|
|
270
|
+
tz: string;
|
|
271
|
+
}) {
|
|
272
|
+
const nav = useRouter();
|
|
273
|
+
const [choice, setChoice] = useState({ ...CHOICE, ...initial });
|
|
274
|
+
const [lists, setLists] = useState(data);
|
|
275
|
+
const [pulls, setPulls] = useState<{ repo: string; items?: Pull[] }>();
|
|
276
|
+
const [busy, setBusy] = useState(false);
|
|
277
|
+
const [error, setError] = useState('');
|
|
278
|
+
// Why no credential can run it, once a start says so.
|
|
279
|
+
const [needs, setNeeds] = useState<string>();
|
|
280
|
+
// The model row whose effort choices are open.
|
|
281
|
+
const [expanded, setExpanded] = useState<string>();
|
|
282
|
+
const [text, setText] = useState('');
|
|
283
|
+
const [dismissed, setDismissed] = useState(false);
|
|
284
|
+
const [at, setAt] = useState(0);
|
|
285
|
+
// Folders checked this session; `typing` swaps the Folder select for a path or repository URL box.
|
|
286
|
+
const [added, setAdded] = useState<LocalFolder[]>([]);
|
|
287
|
+
const [typing, setTyping] = useState<'' | 'path' | 'url'>('');
|
|
288
|
+
const [cloning, setCloning] = useState(false);
|
|
289
|
+
const form = useRef<HTMLFormElement>(null);
|
|
290
|
+
const box = useRef<HTMLTextAreaElement>(null);
|
|
291
|
+
const slash = useRef<HTMLDivElement>(null);
|
|
292
|
+
const path = useRef<HTMLInputElement>(null);
|
|
293
|
+
const id = useId();
|
|
294
|
+
|
|
295
|
+
useEffect(() => void (typing && path.current?.focus()), [typing]);
|
|
296
|
+
|
|
297
|
+
useEffect(() => {
|
|
298
|
+
const draft = localStorage.getItem(DRAFT);
|
|
299
|
+
if (draft && box.current && !box.current.value) box.current.value = draft;
|
|
300
|
+
setText(box.current?.value ?? '');
|
|
301
|
+
box.current?.focus();
|
|
302
|
+
// A restored draft waits for typing before its slash menu opens.
|
|
303
|
+
setDismissed(true);
|
|
304
|
+
}, []);
|
|
305
|
+
|
|
306
|
+
// The repository's open pull requests and its own flows, once a command is being typed.
|
|
307
|
+
const commanding = text.startsWith('/');
|
|
308
|
+
useEffect(() => {
|
|
309
|
+
const repo = choice.repo;
|
|
310
|
+
if (!commanding || !repo || pulls?.repo === repo) return;
|
|
311
|
+
setPulls({ repo });
|
|
312
|
+
void client.pulls
|
|
313
|
+
.list(repo)
|
|
314
|
+
.then(items => setPulls({ repo, items }))
|
|
315
|
+
.catch(reason => {
|
|
316
|
+
setPulls({ repo, items: [] });
|
|
317
|
+
setError(reasonText(reason));
|
|
318
|
+
});
|
|
319
|
+
void client.flows
|
|
320
|
+
.list(repo)
|
|
321
|
+
.then(flows => setLists(current => ({ ...current, flows: flows.map(flow => flow.name) })))
|
|
322
|
+
.catch(() => {});
|
|
323
|
+
}, [commanding, choice.repo]);
|
|
324
|
+
|
|
325
|
+
const pick = (key: keyof Choice, value: string) => {
|
|
326
|
+
if (value === OTHER) return setTyping('path');
|
|
327
|
+
if (value === CLONE) return setTyping('url');
|
|
328
|
+
if (value === PICK) return void pickFolder();
|
|
329
|
+
if (value === CONNECT)
|
|
330
|
+
return void connectRepositories('/dash/tasks').catch(reason => setError(reasonText(reason)));
|
|
331
|
+
apply({ [key]: value });
|
|
332
|
+
if (key === 'repo' || key === 'cwd') box.current?.focus({ preventScroll: true });
|
|
333
|
+
};
|
|
334
|
+
const apply = (change: Partial<Choice>) => {
|
|
335
|
+
const next = { ...choice, ...change };
|
|
336
|
+
setChoice(next);
|
|
337
|
+
document.cookie = `compose=${encodeURIComponent(JSON.stringify(next))}; path=/; max-age=31536000; samesite=lax`;
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
const chose = (checked: Awaited<ReturnType<typeof client.folders.check>>) => {
|
|
341
|
+
if (!checked.ok) return setError(checked.detail);
|
|
342
|
+
setError('');
|
|
343
|
+
setTyping('');
|
|
344
|
+
setAdded(current => [
|
|
345
|
+
...current.filter(each => each.path !== checked.folder.path),
|
|
346
|
+
checked.folder,
|
|
347
|
+
]);
|
|
348
|
+
pick('cwd', checked.folder.path === lists.folders?.current.path ? '' : checked.folder.path);
|
|
349
|
+
};
|
|
350
|
+
const checkFolder = async (path: string) => {
|
|
351
|
+
if (!path.trim()) return;
|
|
352
|
+
chose(
|
|
353
|
+
await client.folders
|
|
354
|
+
.check(path.trim())
|
|
355
|
+
.catch(reason => ({ ok: false as const, detail: reasonText(reason) })),
|
|
356
|
+
);
|
|
357
|
+
};
|
|
358
|
+
// The dialog opens on the server's machine; the cursor waits for it, and closing it changes nothing here.
|
|
359
|
+
const pickFolder = async () => {
|
|
360
|
+
document.body.style.cursor = 'progress';
|
|
361
|
+
const picked = await client.folders
|
|
362
|
+
.pick()
|
|
363
|
+
.catch(reason => ({ ok: false as const, detail: reasonText(reason) }));
|
|
364
|
+
document.body.style.cursor = '';
|
|
365
|
+
if (picked.ok || picked.detail) chose(picked);
|
|
366
|
+
};
|
|
367
|
+
const cloneFolder = async (url: string) => {
|
|
368
|
+
if (!url.trim()) return;
|
|
369
|
+
setCloning(true);
|
|
370
|
+
document.body.style.cursor = 'progress';
|
|
371
|
+
const cloned = await client.folders
|
|
372
|
+
.clone(url.trim())
|
|
373
|
+
.catch(reason => ({ ok: false as const, detail: reasonText(reason) }));
|
|
374
|
+
document.body.style.cursor = '';
|
|
375
|
+
setCloning(false);
|
|
376
|
+
chose(cloned);
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
const draft = (value: string) => {
|
|
380
|
+
const field = box.current!;
|
|
381
|
+
field.value = value;
|
|
382
|
+
localStorage.setItem(DRAFT, value);
|
|
383
|
+
setText(value);
|
|
384
|
+
setAt(0);
|
|
385
|
+
setDismissed(false);
|
|
386
|
+
field.focus();
|
|
387
|
+
field.setSelectionRange(value.length, value.length);
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
const start = async (pr?: number) => {
|
|
391
|
+
const text = box.current?.value.trim() ?? '';
|
|
392
|
+
if (busy || cloning || !(text || pr)) return;
|
|
393
|
+
const [, command, name = '', args = ''] = COMMAND.exec(text) ?? [];
|
|
394
|
+
if (!pr && command && !(command === 'flow' ? name : /^#?\d+$/.test(name)))
|
|
395
|
+
return void setDismissed(false);
|
|
396
|
+
const review = pr ?? (command === 'review' ? Number(name.replace('#', '')) : undefined);
|
|
397
|
+
if (review && !choice.repo) return setError('Pick a repository first.');
|
|
398
|
+
const { agent, engine, model, effort, permissions, runner } = choice;
|
|
399
|
+
const [repo, cwd] = lists.folders ? ['', choice.cwd] : [choice.repo, ''];
|
|
400
|
+
const fields = Object.fromEntries(
|
|
401
|
+
Object.entries({ repo, cwd, engine, model, effort, permissions, runner }).filter(
|
|
402
|
+
([, value]) => value,
|
|
403
|
+
),
|
|
404
|
+
);
|
|
405
|
+
setBusy(true);
|
|
406
|
+
setError('');
|
|
407
|
+
try {
|
|
408
|
+
const created = review
|
|
409
|
+
? await client.review({ ...fields, repo: choice.repo, pr: review })
|
|
410
|
+
: command === 'flow'
|
|
411
|
+
? await client.flows.run(name, { ...fields, agent, args: argsOf(args) })
|
|
412
|
+
: await client.tasks.create({ ...fields, agent, prompt: text });
|
|
413
|
+
if (!pr || command) localStorage.removeItem(DRAFT);
|
|
414
|
+
watchTask(created.task.id, 'queued', text || `Review of #${review}`);
|
|
415
|
+
nav.push('/dash/tasks/[id]', { params: { id: created.task.id } });
|
|
416
|
+
} catch (reason) {
|
|
417
|
+
setBusy(false);
|
|
418
|
+
if ((reason as { status?: number }).status === 409) setNeeds(reasonText(reason));
|
|
419
|
+
else setError(reasonText(reason));
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
// The slash menu for what is typed so far: commands, then a flow, a repository or a pull request.
|
|
424
|
+
const menu = ((): { label: string; entries: Entry[]; note?: string } | undefined => {
|
|
425
|
+
const word = /^\/(\S*)$/.exec(text)?.[1]?.toLowerCase();
|
|
426
|
+
if (word !== undefined)
|
|
427
|
+
return {
|
|
428
|
+
label: 'Commands',
|
|
429
|
+
entries: [
|
|
430
|
+
{
|
|
431
|
+
key: 'review',
|
|
432
|
+
label: '/review',
|
|
433
|
+
hint: 'Review a pull request',
|
|
434
|
+
pick: () => draft('/review '),
|
|
435
|
+
},
|
|
436
|
+
...lists.flows.map(flow => ({
|
|
437
|
+
key: `flow ${flow}`,
|
|
438
|
+
label: `/flow ${flow}`,
|
|
439
|
+
hint: `Run the ${flow} flow`,
|
|
440
|
+
pick: () => draft(`/flow ${flow} `),
|
|
441
|
+
})),
|
|
442
|
+
].filter(entry => entry.key.includes(word)),
|
|
443
|
+
note: 'No command matches.',
|
|
444
|
+
};
|
|
445
|
+
const flow = /^\/flow\s+(\S*)$/.exec(text)?.[1];
|
|
446
|
+
if (flow !== undefined)
|
|
447
|
+
return {
|
|
448
|
+
label: 'Flows',
|
|
449
|
+
entries: lists.flows
|
|
450
|
+
.filter(name => name.includes(flow))
|
|
451
|
+
.map(name => ({
|
|
452
|
+
key: name,
|
|
453
|
+
label: name,
|
|
454
|
+
hint: `Run the ${name} flow`,
|
|
455
|
+
pick: () => (name === flow ? void start() : draft(`/flow ${name} `)),
|
|
456
|
+
})),
|
|
457
|
+
note: 'No flow matches.',
|
|
458
|
+
};
|
|
459
|
+
const number = /^\/review\s+#?(\S*)$/.exec(text)?.[1];
|
|
460
|
+
if (number === undefined) return undefined;
|
|
461
|
+
if (!choice.repo)
|
|
462
|
+
return {
|
|
463
|
+
label: 'Pick a repository',
|
|
464
|
+
entries: [
|
|
465
|
+
...lists.repos
|
|
466
|
+
.filter(repo => repo.includes(number))
|
|
467
|
+
.map(repo => ({ key: repo, label: repo, pick: () => pick('repo', repo) })),
|
|
468
|
+
{ key: CONNECT, label: connectLabel, pick: () => pick('repo', CONNECT) },
|
|
469
|
+
],
|
|
470
|
+
};
|
|
471
|
+
if (!pulls?.items)
|
|
472
|
+
return { label: `Pull requests in ${choice.repo}`, entries: [], note: 'loading' };
|
|
473
|
+
return {
|
|
474
|
+
label: `Pull requests in ${choice.repo}`,
|
|
475
|
+
entries: [
|
|
476
|
+
...pulls.items
|
|
477
|
+
.filter(
|
|
478
|
+
pull =>
|
|
479
|
+
String(pull.number).startsWith(number) ||
|
|
480
|
+
pull.title.toLowerCase().includes(number.toLowerCase()),
|
|
481
|
+
)
|
|
482
|
+
// The exact number first, so `/review 39` picks #39 over #390.
|
|
483
|
+
.sort((a, b) => Number(String(b.number) === number) - Number(String(a.number) === number))
|
|
484
|
+
.map(pull => ({
|
|
485
|
+
key: `#${pull.number}`,
|
|
486
|
+
label: `#${pull.number} ${pull.title}`,
|
|
487
|
+
hint: [pull.author, pull.createdAt ? formatDate(Date.parse(pull.createdAt), tz) : '']
|
|
488
|
+
.filter(Boolean)
|
|
489
|
+
.join(' · '),
|
|
490
|
+
pick: () => void start(pull.number),
|
|
491
|
+
})),
|
|
492
|
+
...(number
|
|
493
|
+
? []
|
|
494
|
+
: [
|
|
495
|
+
{
|
|
496
|
+
key: '',
|
|
497
|
+
label: choice.repo,
|
|
498
|
+
hint: 'Pick another repository',
|
|
499
|
+
pick: () => apply({ repo: '' }),
|
|
500
|
+
},
|
|
501
|
+
]),
|
|
502
|
+
],
|
|
503
|
+
note: pulls.items.length ? 'No open pull request matches.' : 'No open pull requests.',
|
|
504
|
+
};
|
|
505
|
+
})();
|
|
506
|
+
const open = Boolean(menu && !dismissed);
|
|
507
|
+
const active = menu ? Math.min(at, Math.max(0, menu.entries.length - 1)) : 0;
|
|
508
|
+
|
|
509
|
+
// The slash menu hangs under the box in the top layer, so a dialog never clips it.
|
|
510
|
+
useLayoutEffect(() => {
|
|
511
|
+
const pop = slash.current;
|
|
512
|
+
if (!pop) return;
|
|
513
|
+
if (!open) return void (pop.matches(':popover-open') && pop.hidePopover());
|
|
514
|
+
const position = () => {
|
|
515
|
+
const rect = form.current!.getBoundingClientRect();
|
|
516
|
+
pop.style.top = `${Math.round(rect.bottom + 6)}px`;
|
|
517
|
+
pop.style.left = `${Math.round(rect.left)}px`;
|
|
518
|
+
pop.style.width = `${Math.round(Math.min(rect.width, 460))}px`;
|
|
519
|
+
};
|
|
520
|
+
position();
|
|
521
|
+
if (!pop.matches(':popover-open')) pop.showPopover();
|
|
522
|
+
addEventListener('scroll', position, true);
|
|
523
|
+
addEventListener('resize', position);
|
|
524
|
+
return () => {
|
|
525
|
+
removeEventListener('scroll', position, true);
|
|
526
|
+
removeEventListener('resize', position);
|
|
527
|
+
};
|
|
528
|
+
}, [open, text]);
|
|
529
|
+
|
|
530
|
+
const engine = choice.engine || defaults.engine;
|
|
531
|
+
const own = defaults.engines[engine] ?? {};
|
|
532
|
+
const agents = lists.agents.filter(([id]) => id !== 'coder');
|
|
533
|
+
// Only the settings that differ from the workspace's defaults.
|
|
534
|
+
const changed = [
|
|
535
|
+
choice.agent !== 'coder' && choice.agent,
|
|
536
|
+
choice.engine !== defaults.engine && choice.engine,
|
|
537
|
+
...(['model', 'effort', 'permissions'] as const).map(
|
|
538
|
+
key => choice[key] !== own[key] && choice[key],
|
|
539
|
+
),
|
|
540
|
+
choice.runner && (lists.runners.find(([id]) => id === choice.runner)?.[1] ?? choice.runner),
|
|
541
|
+
]
|
|
542
|
+
.filter(Boolean)
|
|
543
|
+
.join(' · ');
|
|
544
|
+
return (
|
|
545
|
+
<>
|
|
546
|
+
<form
|
|
547
|
+
ref={form}
|
|
548
|
+
class="composer"
|
|
549
|
+
onSubmit={event => {
|
|
550
|
+
event.preventDefault();
|
|
551
|
+
void start();
|
|
552
|
+
}}
|
|
553
|
+
>
|
|
554
|
+
<textarea
|
|
555
|
+
ref={box}
|
|
556
|
+
name="prompt"
|
|
557
|
+
rows={1}
|
|
558
|
+
role="combobox"
|
|
559
|
+
aria-label="What should the agent do?"
|
|
560
|
+
aria-autocomplete="list"
|
|
561
|
+
aria-expanded={open}
|
|
562
|
+
aria-controls={`${id}-slash`}
|
|
563
|
+
aria-activedescendant={open && menu?.entries.length ? `${id}-slash-${active}` : undefined}
|
|
564
|
+
placeholder={PLACEHOLDER}
|
|
565
|
+
autofocus
|
|
566
|
+
onFocus={() => setDismissed(false)}
|
|
567
|
+
onBlur={() => setDismissed(true)}
|
|
568
|
+
onInput={event => {
|
|
569
|
+
const value = event.currentTarget.value;
|
|
570
|
+
localStorage.setItem(DRAFT, value);
|
|
571
|
+
setText(value);
|
|
572
|
+
setAt(0);
|
|
573
|
+
setDismissed(false);
|
|
574
|
+
}}
|
|
575
|
+
onKeyDown={event => {
|
|
576
|
+
if (event.isComposing) return;
|
|
577
|
+
if (open && menu) {
|
|
578
|
+
if (stepped(event, active, menu.entries.length, setAt)) return;
|
|
579
|
+
if (event.key === 'Escape') {
|
|
580
|
+
event.preventDefault();
|
|
581
|
+
return setDismissed(true);
|
|
582
|
+
}
|
|
583
|
+
if (
|
|
584
|
+
menu.entries.length &&
|
|
585
|
+
((event.key === 'Enter' && !event.shiftKey) || event.key === 'Tab')
|
|
586
|
+
) {
|
|
587
|
+
event.preventDefault();
|
|
588
|
+
return menu.entries[active]!.pick();
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (event.key !== 'Enter' || event.shiftKey) return;
|
|
592
|
+
event.preventDefault();
|
|
593
|
+
void start();
|
|
594
|
+
}}
|
|
595
|
+
/>
|
|
596
|
+
<div class="composer-line">
|
|
597
|
+
{!lists.folders ? (
|
|
598
|
+
<Select
|
|
599
|
+
label="Repository"
|
|
600
|
+
value={choice.repo}
|
|
601
|
+
options={[
|
|
602
|
+
...optionsOf('No repository', choice.repo, lists.repos),
|
|
603
|
+
[CONNECT, connectLabel],
|
|
604
|
+
]}
|
|
605
|
+
onChange={value => pick('repo', value)}
|
|
606
|
+
/>
|
|
607
|
+
) : typing ? (
|
|
608
|
+
<>
|
|
609
|
+
<input
|
|
610
|
+
class="folder-path"
|
|
611
|
+
aria-label={typing === 'url' ? 'Repository URL' : 'Folder path'}
|
|
612
|
+
ref={path}
|
|
613
|
+
placeholder={
|
|
614
|
+
typing === 'url' ? 'https://github.com/owner/repo' : 'Absolute path or ~/…'
|
|
615
|
+
}
|
|
616
|
+
readOnly={cloning}
|
|
617
|
+
aria-busy={cloning}
|
|
618
|
+
onKeyDown={event => {
|
|
619
|
+
if (cloning) return event.preventDefault();
|
|
620
|
+
if (event.key === 'Escape') {
|
|
621
|
+
event.preventDefault();
|
|
622
|
+
setError('');
|
|
623
|
+
return setTyping('');
|
|
624
|
+
}
|
|
625
|
+
if (event.key !== 'Enter' || event.isComposing) return;
|
|
626
|
+
event.preventDefault();
|
|
627
|
+
void (typing === 'url' ? cloneFolder : checkFolder)(event.currentTarget.value);
|
|
628
|
+
}}
|
|
629
|
+
onBlur={event => !cloning && !event.currentTarget.value.trim() && setTyping('')}
|
|
630
|
+
/>
|
|
631
|
+
{cloning ? <span class="folder-busy">Cloning…</span> : null}
|
|
632
|
+
</>
|
|
633
|
+
) : (
|
|
634
|
+
<span class="folder" title={choice.cwd || lists.folders.current.path}>
|
|
635
|
+
<Select
|
|
636
|
+
label="Folder"
|
|
637
|
+
value={choice.cwd}
|
|
638
|
+
options={folderOptions(lists.folders, added, choice.cwd)}
|
|
639
|
+
subs={Object.fromEntries(
|
|
640
|
+
folderOptions(lists.folders, added, choice.cwd).flatMap(([path]) =>
|
|
641
|
+
path && path !== OTHER && path !== PICK && path !== CLONE
|
|
642
|
+
? [[path, added.find(each => each.path === path)?.url ?? path]]
|
|
643
|
+
: [],
|
|
644
|
+
),
|
|
645
|
+
)}
|
|
646
|
+
onChange={value => pick('cwd', value)}
|
|
647
|
+
/>
|
|
648
|
+
</span>
|
|
649
|
+
)}
|
|
650
|
+
<button
|
|
651
|
+
type="button"
|
|
652
|
+
class="quiet"
|
|
653
|
+
popovertarget={`${id}-settings`}
|
|
654
|
+
aria-label="Run options"
|
|
655
|
+
title="Model, effort, permissions and more"
|
|
656
|
+
>
|
|
657
|
+
<Icon d={iSliders} />
|
|
658
|
+
{changed ? <span>{changed}</span> : null}
|
|
659
|
+
</button>
|
|
660
|
+
<button
|
|
661
|
+
class="btn sm send"
|
|
662
|
+
disabled={busy || !text.trim()}
|
|
663
|
+
aria-busy={busy}
|
|
664
|
+
aria-label={busy ? 'Starting task' : 'Start task'}
|
|
665
|
+
title="Start task (Enter)"
|
|
666
|
+
>
|
|
667
|
+
<Icon d={iSteer} />
|
|
668
|
+
</button>
|
|
669
|
+
</div>
|
|
670
|
+
{typing === 'url' ? (
|
|
671
|
+
<small class="folder-hint">Uses this machine's git logins</small>
|
|
672
|
+
) : null}
|
|
673
|
+
<ErrorText value={error} />
|
|
674
|
+
<div
|
|
675
|
+
id={`${id}-settings`}
|
|
676
|
+
class="pop composer-settings"
|
|
677
|
+
popover="auto"
|
|
678
|
+
onBeforeToggle={place}
|
|
679
|
+
>
|
|
680
|
+
<p class="pop-label">Model</p>
|
|
681
|
+
<div role="group" aria-label="Model" class="pop-radios">
|
|
682
|
+
{modelSections(lists.models, defaults).map(([engine, items]) => (
|
|
683
|
+
<Fragment key={engine}>
|
|
684
|
+
{engine ? <p class="pop-group">{engine}</p> : null}
|
|
685
|
+
{items.map(([value, label]) => {
|
|
686
|
+
const on = value === modelValue(choice.engine, choice.model);
|
|
687
|
+
const picked = splitModel(value);
|
|
688
|
+
const efforts = resolved(
|
|
689
|
+
EFFORTS,
|
|
690
|
+
defaults.engines[picked.engine || defaults.engine]?.effort,
|
|
691
|
+
);
|
|
692
|
+
const effortLabel =
|
|
693
|
+
on && choice.effort
|
|
694
|
+
? efforts.find(([key]) => key === choice.effort)?.[1]
|
|
695
|
+
: undefined;
|
|
696
|
+
const showing = expanded === value;
|
|
697
|
+
return (
|
|
698
|
+
<Fragment key={value}>
|
|
699
|
+
<div class="pop-row">
|
|
700
|
+
<button
|
|
701
|
+
type="button"
|
|
702
|
+
role="menuitemradio"
|
|
703
|
+
aria-checked={on}
|
|
704
|
+
class={on ? 'pop-item on' : 'pop-item'}
|
|
705
|
+
onClick={event => {
|
|
706
|
+
apply({ ...picked, effort: '' });
|
|
707
|
+
event.currentTarget.closest<HTMLElement>('[popover]')?.hidePopover();
|
|
708
|
+
}}
|
|
709
|
+
>
|
|
710
|
+
<span class="grow">{label}</span>
|
|
711
|
+
{effortLabel ? <small>{effortLabel.toLowerCase()}</small> : null}
|
|
712
|
+
{on ? <Icon d={iCheck} /> : null}
|
|
713
|
+
</button>
|
|
714
|
+
<button
|
|
715
|
+
type="button"
|
|
716
|
+
class="pop-chev"
|
|
717
|
+
data-keep
|
|
718
|
+
aria-label={`Effort for ${label}`}
|
|
719
|
+
aria-expanded={showing}
|
|
720
|
+
onClick={() => setExpanded(showing ? undefined : value)}
|
|
721
|
+
>
|
|
722
|
+
<Icon d={iRight} />
|
|
723
|
+
</button>
|
|
724
|
+
</div>
|
|
725
|
+
{showing ? (
|
|
726
|
+
<div role="group" aria-label={`Effort for ${label}`} class="pop-sub">
|
|
727
|
+
{efforts.map(([effort, text]) => (
|
|
728
|
+
<MenuRadio
|
|
729
|
+
key={effort}
|
|
730
|
+
on={on && choice.effort === effort}
|
|
731
|
+
onPick={() => {
|
|
732
|
+
apply({ ...picked, effort });
|
|
733
|
+
document.getElementById(`${id}-settings`)?.hidePopover();
|
|
734
|
+
}}
|
|
735
|
+
>
|
|
736
|
+
{text}
|
|
737
|
+
</MenuRadio>
|
|
738
|
+
))}
|
|
739
|
+
</div>
|
|
740
|
+
) : null}
|
|
741
|
+
</Fragment>
|
|
742
|
+
);
|
|
743
|
+
})}
|
|
744
|
+
</Fragment>
|
|
745
|
+
))}
|
|
746
|
+
<Link
|
|
747
|
+
class="pop-item add-models"
|
|
748
|
+
href="/dash/settings/[tab]"
|
|
749
|
+
params={{ tab: 'models' }}
|
|
750
|
+
>
|
|
751
|
+
<Icon d={iPlus} />
|
|
752
|
+
<span class="grow">Add models</span>
|
|
753
|
+
</Link>
|
|
754
|
+
</div>
|
|
755
|
+
<p class="pop-label">Permissions</p>
|
|
756
|
+
<div role="group" aria-label="Permissions">
|
|
757
|
+
{resolved(PERMISSIONS, own.permissions ?? 'auto').map(([value, label]) => (
|
|
758
|
+
<MenuRadio
|
|
759
|
+
key={value}
|
|
760
|
+
on={choice.permissions === value}
|
|
761
|
+
onPick={() => apply({ permissions: value })}
|
|
762
|
+
>
|
|
763
|
+
{label}
|
|
764
|
+
</MenuRadio>
|
|
765
|
+
))}
|
|
766
|
+
</div>
|
|
767
|
+
{agents.length || choice.agent !== 'coder' ? (
|
|
768
|
+
<>
|
|
769
|
+
<p class="pop-label">Agent</p>
|
|
770
|
+
<Select
|
|
771
|
+
label="Agent"
|
|
772
|
+
value={choice.agent}
|
|
773
|
+
options={named('coder', choice.agent, agents)}
|
|
774
|
+
onChange={value => apply({ agent: value })}
|
|
775
|
+
/>
|
|
776
|
+
</>
|
|
777
|
+
) : null}
|
|
778
|
+
{lists.runners.length > 1 ? (
|
|
779
|
+
<>
|
|
780
|
+
<p class="pop-label">Runs on</p>
|
|
781
|
+
<Select
|
|
782
|
+
label="Runs on"
|
|
783
|
+
options={lists.runners}
|
|
784
|
+
value={choice.runner}
|
|
785
|
+
onChange={value => apply({ runner: value })}
|
|
786
|
+
/>
|
|
787
|
+
</>
|
|
788
|
+
) : null}
|
|
789
|
+
</div>
|
|
790
|
+
<div
|
|
791
|
+
ref={slash}
|
|
792
|
+
id={`${id}-slash`}
|
|
793
|
+
class="pop composer-slash"
|
|
794
|
+
popover="manual"
|
|
795
|
+
role="listbox"
|
|
796
|
+
aria-label={menu?.label ?? 'Commands'}
|
|
797
|
+
>
|
|
798
|
+
{menu ? (
|
|
799
|
+
<>
|
|
800
|
+
<div class="pop-label">{menu.label}</div>
|
|
801
|
+
<Entries id={`${id}-slash`} entries={menu.entries} active={active} onActive={setAt} />
|
|
802
|
+
{menu.note === 'loading' ? (
|
|
803
|
+
<Loading label="Loading pull requests" inline />
|
|
804
|
+
) : menu.note && !menu.entries.length ? (
|
|
805
|
+
<p class="pop-note">{menu.note}</p>
|
|
806
|
+
) : null}
|
|
807
|
+
</>
|
|
808
|
+
) : null}
|
|
809
|
+
</div>
|
|
810
|
+
</form>
|
|
811
|
+
{needs === undefined || missing ? null : <NeedsCredential reason={needs} />}
|
|
812
|
+
</>
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/** The composer before it arrives: the same box and prompt, inert. */
|
|
817
|
+
export function LoadingComposer() {
|
|
818
|
+
return (
|
|
819
|
+
<div class="composer" aria-hidden="true">
|
|
820
|
+
<textarea rows={1} disabled tabIndex={-1} placeholder={PLACEHOLDER} />
|
|
821
|
+
<div class="composer-line" />
|
|
822
|
+
</div>
|
|
823
|
+
);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/** Opens the composer in a dialog with `agent` picked; starting a task opens it. */
|
|
827
|
+
export function NewTaskButton({ agent }: { agent: string }) {
|
|
828
|
+
const dialog = useRef<HTMLDialogElement>(null);
|
|
829
|
+
const [setup, setSetup] = useState<Awaited<ReturnType<typeof loadComposer>>>();
|
|
830
|
+
const [error, setError] = useState('');
|
|
831
|
+
const [shown, setShown] = useState(false);
|
|
832
|
+
|
|
833
|
+
const loading = useRef<Promise<unknown>>();
|
|
834
|
+
|
|
835
|
+
// Hovering the button already loads what the composer needs.
|
|
836
|
+
const prepare = () =>
|
|
837
|
+
(loading.current ??= loadComposer(client).then(setSetup, reason =>
|
|
838
|
+
setError(reasonText(reason)),
|
|
839
|
+
));
|
|
840
|
+
const open = () => {
|
|
841
|
+
setShown(true);
|
|
842
|
+
dialog.current?.showModal();
|
|
843
|
+
void prepare();
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
return (
|
|
847
|
+
<>
|
|
848
|
+
<button
|
|
849
|
+
type="button"
|
|
850
|
+
class="btn new-task"
|
|
851
|
+
onClick={open}
|
|
852
|
+
onPointerEnter={prepare}
|
|
853
|
+
onFocus={prepare}
|
|
854
|
+
>
|
|
855
|
+
New task
|
|
856
|
+
</button>
|
|
857
|
+
<dialog
|
|
858
|
+
ref={dialog}
|
|
859
|
+
class="compose-dialog"
|
|
860
|
+
aria-label={`New task for ${agent}`}
|
|
861
|
+
onClose={() => setShown(false)}
|
|
862
|
+
onClick={event => event.target === event.currentTarget && dialog.current?.close()}
|
|
863
|
+
>
|
|
864
|
+
<header>
|
|
865
|
+
<h2>New task</h2>
|
|
866
|
+
<span class="sub">{agent}</span>
|
|
867
|
+
<button
|
|
868
|
+
type="button"
|
|
869
|
+
class="icon-btn"
|
|
870
|
+
aria-label="Close"
|
|
871
|
+
onClick={() => dialog.current?.close()}
|
|
872
|
+
>
|
|
873
|
+
<Icon d={iX} />
|
|
874
|
+
</button>
|
|
875
|
+
</header>
|
|
876
|
+
{!shown ? null : setup ? (
|
|
877
|
+
<Composer
|
|
878
|
+
{...setup}
|
|
879
|
+
initial={{ ...savedChoice(document.cookie), agent }}
|
|
880
|
+
tz={Intl.DateTimeFormat().resolvedOptions().timeZone}
|
|
881
|
+
/>
|
|
882
|
+
) : error ? (
|
|
883
|
+
<ErrorText value={error} />
|
|
884
|
+
) : (
|
|
885
|
+
<LoadingComposer />
|
|
886
|
+
)}
|
|
887
|
+
</dialog>
|
|
888
|
+
</>
|
|
889
|
+
);
|
|
890
|
+
}
|