@open-mercato/cezar 0.13.0 → 0.14.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.
- package/README.md +3 -2
- package/dist/agent-config/catalog.d.ts +4 -0
- package/dist/agent-config/catalog.js +85 -3
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/model-settings/copilot.d.ts +15 -0
- package/dist/agent-config/model-settings/copilot.js +25 -0
- package/dist/agent-config/model-settings/copilot.js.map +1 -0
- package/dist/agent-config/model-settings/junie.d.ts +12 -0
- package/dist/agent-config/model-settings/junie.js +18 -0
- package/dist/agent-config/model-settings/junie.js.map +1 -0
- package/dist/agent-config/models.js +4 -0
- package/dist/agent-config/models.js.map +1 -1
- package/dist/automations/prompts.d.ts +2 -2
- package/dist/automations/prompts.js +1 -1
- package/dist/automations/types.d.ts +12 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/agent-config.d.ts +4 -0
- package/dist/contract/agent-profiles.d.ts +30 -0
- package/dist/contract/automations.d.ts +32 -0
- package/dist/contract/dashboard-insights.d.ts +186 -0
- package/dist/contract/dashboard.d.ts +88 -0
- package/dist/contract/dispatch.d.ts +6 -0
- package/dist/contract/health.d.ts +8 -0
- package/dist/contract/index.d.ts +2 -0
- package/dist/contract/index.js +249 -72
- package/dist/contract/runs.d.ts +144 -0
- package/dist/contract/self-update.d.ts +111 -2
- package/dist/contract/skills.d.ts +19 -0
- package/dist/contract/star-count.d.ts +18 -0
- package/dist/contract/workflows.d.ts +12 -0
- package/dist/contract/workspace.d.ts +42 -2
- package/dist/core/acp-client.d.ts +99 -0
- package/dist/core/acp-client.js +198 -0
- package/dist/core/acp-client.js.map +1 -0
- package/dist/core/acp-ui-mapper.d.ts +95 -0
- package/dist/core/acp-ui-mapper.js +444 -0
- package/dist/core/acp-ui-mapper.js.map +1 -0
- package/dist/core/agent-env.js +10 -0
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-profiles.d.ts +10 -0
- package/dist/core/agent-profiles.js +16 -0
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-runner.d.ts +5 -3
- package/dist/core/agent-runner.js +5 -3
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +3 -3
- package/dist/core/backend-detect.js +61 -2
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +5 -2
- package/dist/core/claude-cli-runner.js +11 -6
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/claude-ui-mapper.d.ts +14 -0
- package/dist/core/claude-ui-mapper.js +102 -11
- package/dist/core/claude-ui-mapper.js.map +1 -1
- package/dist/core/codex-app-server-transport.js +8 -4
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/copilot-acp-runner.d.ts +60 -0
- package/dist/core/copilot-acp-runner.js +528 -0
- package/dist/core/copilot-acp-runner.js.map +1 -0
- package/dist/core/copilot-ui-mapper.d.ts +47 -0
- package/dist/core/copilot-ui-mapper.js +111 -0
- package/dist/core/copilot-ui-mapper.js.map +1 -0
- package/dist/core/cursor-agent-runner.js +4 -4
- package/dist/core/cursor-agent-runner.js.map +1 -1
- package/dist/core/disclaim-spawn.d.ts +9 -0
- package/dist/core/disclaim-spawn.js +53 -0
- package/dist/core/disclaim-spawn.js.map +1 -0
- package/dist/core/junie-acp-transport.d.ts +58 -0
- package/dist/core/junie-acp-transport.js +179 -0
- package/dist/core/junie-acp-transport.js.map +1 -0
- package/dist/core/junie-auth-probe.d.ts +12 -0
- package/dist/core/junie-auth-probe.js +30 -0
- package/dist/core/junie-auth-probe.js.map +1 -0
- package/dist/core/junie-model-catalog.d.ts +10 -0
- package/dist/core/junie-model-catalog.js +104 -0
- package/dist/core/junie-model-catalog.js.map +1 -0
- package/dist/core/junie-runner.d.ts +45 -0
- package/dist/core/junie-runner.js +533 -0
- package/dist/core/junie-runner.js.map +1 -0
- package/dist/core/junie-ui-mapper.d.ts +132 -0
- package/dist/core/junie-ui-mapper.js +459 -0
- package/dist/core/junie-ui-mapper.js.map +1 -0
- package/dist/core/model-identity.js +17 -0
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.js +10 -0
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/opencode-server-runner.js +4 -4
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.js +4 -4
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/provider-auth.d.ts +16 -2
- package/dist/core/provider-auth.js +113 -7
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/runner-factory.js +6 -0
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-model-catalog.js +12 -8
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/core/tool-display.js +6 -1
- package/dist/core/tool-display.js.map +1 -1
- package/dist/core/ui-events.d.ts +6 -2
- package/dist/git-diff-base.js +23 -2
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-worktree.d.ts +21 -2
- package/dist/git-worktree.js +68 -5
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/paths.js +2 -0
- package/dist/paths.js.map +1 -1
- package/dist/runs/event-history.js +3 -0
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/store.d.ts +42 -3
- package/dist/runs/store.js +112 -6
- package/dist/runs/store.js.map +1 -1
- package/dist/self-update/checkouts.d.ts +53 -0
- package/dist/self-update/checkouts.js +268 -0
- package/dist/self-update/checkouts.js.map +1 -0
- package/dist/self-update/cli.d.ts +5 -3
- package/dist/self-update/cli.js +75 -8
- package/dist/self-update/cli.js.map +1 -1
- package/dist/self-update/layout.d.ts +33 -1
- package/dist/self-update/layout.js +102 -3
- package/dist/self-update/layout.js.map +1 -1
- package/dist/self-update/pulls.d.ts +40 -0
- package/dist/self-update/pulls.js +127 -0
- package/dist/self-update/pulls.js.map +1 -0
- package/dist/self-update/service.d.ts +26 -3
- package/dist/self-update/service.js +85 -9
- package/dist/self-update/service.js.map +1 -1
- package/dist/server/dashboard.d.ts +107 -0
- package/dist/server/dashboard.js +2 -1
- package/dist/server/dashboard.js.map +1 -1
- package/dist/server/forge/github.js +4 -1
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/fs-browse.d.ts +3 -1
- package/dist/server/fs-browse.js +27 -5
- package/dist/server/fs-browse.js.map +1 -1
- package/dist/server/open-in-app.js +2 -0
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/provider-action-gate.js +5 -1
- package/dist/server/provider-action-gate.js.map +1 -1
- package/dist/server/server.d.ts +880 -511
- package/dist/server/server.js +40 -5
- package/dist/server/server.js.map +1 -1
- package/dist/server/star-count.d.ts +67 -0
- package/dist/server/star-count.js +186 -0
- package/dist/server/star-count.js.map +1 -0
- package/dist/skills-banner.d.ts +19 -0
- package/dist/skills-banner.js +24 -0
- package/dist/skills-banner.js.map +1 -1
- package/dist/workflows/run.d.ts +0 -2
- package/dist/workflows/run.js +45 -29
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +6 -0
- package/dist/workspace/agent-accounts.d.ts +9 -1
- package/dist/workspace/agent-accounts.js +2 -0
- package/dist/workspace/agent-accounts.js.map +1 -1
- package/dist/workspace/agent-profiles.d.ts +2 -2
- package/dist/workspace/agent-profiles.js +25 -6
- package/dist/workspace/agent-profiles.js.map +1 -1
- package/dist/workspace/config.d.ts +9 -1
- package/dist/workspace/config.js +10 -3
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/dashboard-insights.d.ts +42 -0
- package/dist/workspace/dashboard-insights.js +220 -0
- package/dist/workspace/dashboard-insights.js.map +1 -0
- package/dist/workspace/dashboard.d.ts +71 -1
- package/dist/workspace/dashboard.js +14 -1
- package/dist/workspace/dashboard.js.map +1 -1
- package/dist/workspace/semaphore.d.ts +3 -0
- package/dist/workspace/semaphore.js +8 -1
- package/dist/workspace/semaphore.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +34 -1
- package/scripts/mock-copilot-acp.mjs +190 -0
- package/scripts/mock-junie-acp.mjs +208 -0
- package/web/dist/assets/agent-task-pickers-BeQi-UTm.js +1 -0
- package/web/dist/assets/alert-dialog-CnRAuqwb.js +1 -0
- package/web/dist/assets/arrow-down-Da0kNRNH.js +1 -0
- package/web/dist/assets/arrow-left-BIZHhBIP.js +1 -0
- package/web/dist/assets/automation-format-CfPmkcsg.js +1 -0
- package/web/dist/assets/automations-route-AMJbFP53.js +1 -0
- package/web/dist/assets/centered-state-3r2Kaar_.js +1 -0
- package/web/dist/assets/chevron-left-DLAUPC66.js +1 -0
- package/web/dist/assets/chevron-right-KVZcXiPL.js +1 -0
- package/web/dist/assets/{circle-x-C9UoMP1V.js → circle-x-C0Jm5Ppb.js} +1 -1
- package/web/dist/assets/collapsible-DG_SIWqU.js +1 -0
- package/web/dist/assets/command-Dfln3D4A.js +1 -0
- package/web/dist/assets/{commit-list-BSfPsVsu.js → commit-list-_RA72yB_.js} +1 -1
- package/web/dist/assets/compare-variants-D6Ji6od4.js +1 -0
- package/web/dist/assets/dashboard-B3-tPimG.js +44 -0
- package/web/dist/assets/dialog-CiDREdUK.js +1 -0
- package/web/dist/assets/{diff-I0xowULh.js → diff-CxdyRumG.js} +2 -2
- package/web/dist/assets/diff-controls-DqJMMV4z.js +1 -0
- package/web/dist/assets/{diff-stat-yKn7joEr.js → diff-stat-Hupj4hxh.js} +1 -1
- package/web/dist/assets/{diff-view-DjvMeW1M.js → diff-view-BBYT5k6c.js} +1 -1
- package/web/dist/assets/dist-BqMwqJFX.js +1 -0
- package/web/dist/assets/dist-DpiX6WjA.js +1 -0
- package/web/dist/assets/{download-BcgZ2yk4.js → download-BR7EN9gW.js} +1 -1
- package/web/dist/assets/dropdown-menu-Ci4HFML0.js +1 -0
- package/web/dist/assets/editable-title-DDtUgRKZ.js +1 -0
- package/web/dist/assets/{ellipsis-vertical-g4O4NlLV.js → ellipsis-vertical-DBklom4U.js} +1 -1
- package/web/dist/assets/facet-filter-CfI4QvOd.js +1 -0
- package/web/dist/assets/{file-wXNeZwi7.js → file-CZb7cKNH.js} +1 -1
- package/web/dist/assets/{file-text-DV1gE2L6.js → file-text-Dm6CrEGW.js} +1 -1
- package/web/dist/assets/{folder-wjVId5un.js → folder-zQj-FYOo.js} +1 -1
- package/web/dist/assets/{git-pull-request-BBEDdTLK.js → git-pull-request-AhwzJc7s.js} +1 -1
- package/web/dist/assets/git-toolbar-j7gKkhGL.js +1 -0
- package/web/dist/assets/github-De-DFy8s.js +1 -0
- package/web/dist/assets/{image-preview-u1f-wzxC.js → image-preview-Dd3NVB7N.js} +1 -1
- package/web/dist/assets/index-HS1hr5Sz.js +12 -0
- package/web/dist/assets/index-YwgrLyBj.css +2 -0
- package/web/dist/assets/loader-circle-sk4vKJKp.js +1 -0
- package/web/dist/assets/{markdown-Bnm47qUl.js → markdown-DjNR-1p8.js} +2 -2
- package/web/dist/assets/new-task-form-vLs2G1_z.js +1 -0
- package/web/dist/assets/picker-pill-VW-M1ZiV.js +1 -0
- package/web/dist/assets/{pill-7dm3vWF7.js → pill-CPl6sysj.js} +1 -1
- package/web/dist/assets/popover-CNGONAql.js +1 -0
- package/web/dist/assets/project-router-dCZQu1wQ.js +1 -0
- package/web/dist/assets/{prompt-templates-BMZ5q5H_.js → prompt-templates-jNjVTAws.js} +1 -1
- package/web/dist/assets/{refresh-cw-C69euZ2H.js → refresh-cw-BfkEydKA.js} +1 -1
- package/web/dist/assets/repo-git-BZWZ6_pR.js +1 -0
- package/web/dist/assets/{run-diff-CoNVGn23.js → run-diff-u_roDsAJ.js} +2 -2
- package/web/dist/assets/run-header-Br1yJR0m.js +1 -0
- package/web/dist/assets/{search-x-BNLFOxI6.js → search-x-CT0NTqK1.js} +1 -1
- package/web/dist/assets/segmented-IDD4ucht.js +1 -0
- package/web/dist/assets/skills-Dsi5YdLG.js +1 -0
- package/web/dist/assets/{sparkles-ChorK-gZ.js → sparkles-CvOeAoyJ.js} +1 -1
- package/web/dist/assets/{square-terminal-C7KCPznz.js → square-terminal-eSs8YYZe.js} +1 -1
- package/web/dist/assets/{tab-link-E5O2Cesc.js → tab-link-CPF6ORha.js} +1 -1
- package/web/dist/assets/task-changes-DIT9Y1rh.js +1 -0
- package/web/dist/assets/task-commits-B4VvdiHH.js +1 -0
- package/web/dist/assets/task-files-BMm9C0DW.js +2 -0
- package/web/dist/assets/task-thread-RXabJAt0.js +9 -0
- package/web/dist/assets/{textarea-DLAfWPb0.js → textarea-DtBqPhIs.js} +1 -1
- package/web/dist/assets/thread-loading-Dnxb6Ar-.js +1 -0
- package/web/dist/assets/toaster-CfRVb8vH.js +43 -0
- package/web/dist/assets/token-metrics-DldVlr6m.js +1 -0
- package/web/dist/assets/tooltip-_O50N3pt.js +1 -0
- package/web/dist/assets/tracker-J0fdcH1G.js +4 -0
- package/web/dist/assets/{trash-2-_vwSMdPG.js → trash-2-CUH7GOVh.js} +1 -1
- package/web/dist/assets/{triangle-alert-fBRUkB46.js → triangle-alert-D5K_zyD3.js} +1 -1
- package/web/dist/assets/{upload-B4OIpdyq.js → upload-D7_n-9cl.js} +1 -1
- package/web/dist/assets/{use-now-sqAvRMna.js → use-now-3lElDuTi.js} +1 -1
- package/web/dist/assets/utils-BXvEm7Ve.js +64 -0
- package/web/dist/assets/workflows-D-dx9c_0.js +7 -0
- package/web/dist/assets/x-kLybIvX4.js +1 -0
- package/web/dist/assets/{zoomable-image-X81SApIg.js → zoomable-image-CnyQ9wyw.js} +1 -1
- package/web/dist/index.html +38 -36
- package/web/dist/assets/agent-task-pickers-DQ1qvgrD.js +0 -1
- package/web/dist/assets/alert-dialog-B_2uU4Bg.js +0 -1
- package/web/dist/assets/arrow-down-DieVZxSE.js +0 -1
- package/web/dist/assets/arrow-left-C8M0efjn.js +0 -1
- package/web/dist/assets/automation-format-CzinzpHK.js +0 -1
- package/web/dist/assets/automations-route-DYHUjV9R.js +0 -1
- package/web/dist/assets/centered-state-DJLgwvA4.js +0 -43
- package/web/dist/assets/chevron-left-BhXrOEE3.js +0 -1
- package/web/dist/assets/chevron-right-B3Ta8VKK.js +0 -1
- package/web/dist/assets/collapsible-BcKvItwg.js +0 -1
- package/web/dist/assets/command-BvGGv2_u.js +0 -1
- package/web/dist/assets/compare-variants-DBvMYMs3.js +0 -1
- package/web/dist/assets/dashboard-CGaFh4RV.js +0 -44
- package/web/dist/assets/dialog-B6NgKh0-.js +0 -1
- package/web/dist/assets/diff-controls-DskkZqmD.js +0 -1
- package/web/dist/assets/dist-BvXEdcbG.js +0 -1
- package/web/dist/assets/dist-CTksUkKh.js +0 -1
- package/web/dist/assets/dropdown-menu-B7HeKCfN.js +0 -1
- package/web/dist/assets/editable-title-BHbHmSIK.js +0 -1
- package/web/dist/assets/facet-filter-DZ3wfvN9.js +0 -1
- package/web/dist/assets/git-toolbar-EZuX4Cuz.js +0 -1
- package/web/dist/assets/github-zcLRxv77.js +0 -1
- package/web/dist/assets/index-BrZhA4_u.css +0 -2
- package/web/dist/assets/index-CSNFuBvj.js +0 -12
- package/web/dist/assets/loader-circle-Cwgo6onL.js +0 -1
- package/web/dist/assets/new-task-form-CQODCzBP.js +0 -1
- package/web/dist/assets/picker-pill-DNB9ETjS.js +0 -1
- package/web/dist/assets/popover-BRq6QnwI.js +0 -1
- package/web/dist/assets/project-router-I8Pbsrxy.js +0 -1
- package/web/dist/assets/repo-git-G436Abni.js +0 -1
- package/web/dist/assets/run-header-CxdaA86t.js +0 -1
- package/web/dist/assets/skills-C_kBDesq.js +0 -1
- package/web/dist/assets/task-changes-Bhw4Ysvg.js +0 -1
- package/web/dist/assets/task-commits-DBuGXuGm.js +0 -1
- package/web/dist/assets/task-files-CYDbeffM.js +0 -2
- package/web/dist/assets/task-thread-RuxHMJgN.js +0 -9
- package/web/dist/assets/thread-loading-BAuVAbcA.js +0 -1
- package/web/dist/assets/token-metrics-rVl4kXe_.js +0 -1
- package/web/dist/assets/tooltip-Bdl8mQG8.js +0 -1
- package/web/dist/assets/tracker-DJ8JW59-.js +0 -4
- package/web/dist/assets/utils-DoBmOlX3.js +0 -64
- package/web/dist/assets/workflows-C54D7mlm.js +0 -7
- package/web/dist/assets/x-HXr9KZBr.js +0 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Mock `junie --acp=true` for CEZ_DRY_RUN=1 — speaks just enough real ACP
|
|
3
|
+
// JSON-RPC 2.0 JSONL (confirmed live against @jetbrains/junie 26.9.22, see
|
|
4
|
+
// junie-ui-mapper.ts's module doc) for the engine / store / GUI to be
|
|
5
|
+
// exercised without a logged-in Junie or burning tokens, and doubles as the
|
|
6
|
+
// fixture for the runner wiring tests in junie-runner.test.ts:
|
|
7
|
+
// initialize/authenticate/session/new/set_config_option handshake, one
|
|
8
|
+
// scripted turn (a message + a command tool call), a turn failure, a
|
|
9
|
+
// session/request_permission round-trip (`mock:permission`, which echoes the
|
|
10
|
+
// chosen optionId back as the turn's text), and a session/cancel →
|
|
11
|
+
// cancelled-response flow.
|
|
12
|
+
//
|
|
13
|
+
// `MOCK_JUNIE_IGNORE_EOF=1` switches to the #703 teardown shape instead: the
|
|
14
|
+
// process stays deaf to stdin EOF and handles SIGTERM itself, exiting 143
|
|
15
|
+
// rather than dying from the signal — same contract every other backend's
|
|
16
|
+
// mock proves against (see mock-codex-app-server.mjs).
|
|
17
|
+
import { createInterface } from 'node:readline';
|
|
18
|
+
|
|
19
|
+
const emit = (obj) => process.stdout.write(`${JSON.stringify(obj)}\n`);
|
|
20
|
+
const rl = createInterface({ input: process.stdin });
|
|
21
|
+
|
|
22
|
+
let pendingPromptId = null;
|
|
23
|
+
let pendingPermission = null;
|
|
24
|
+
|
|
25
|
+
const ignoreEof = process.env.MOCK_JUNIE_IGNORE_EOF === '1';
|
|
26
|
+
if (ignoreEof) {
|
|
27
|
+
process.on('SIGTERM', () => process.exit(143));
|
|
28
|
+
setInterval(() => {}, 60_000);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function promptText(params) {
|
|
32
|
+
return (params?.prompt ?? []).map((block) => block.text ?? '').join('\n');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
rl.on('line', (line) => {
|
|
36
|
+
let msg;
|
|
37
|
+
try {
|
|
38
|
+
msg = JSON.parse(line);
|
|
39
|
+
} catch {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (pendingPermission && msg.id === 'perm-1' && msg.method === undefined) {
|
|
44
|
+
const { promptId, sessionId } = pendingPermission;
|
|
45
|
+
pendingPermission = null;
|
|
46
|
+
const chosen = msg.result?.outcome?.optionId ?? `error: ${msg.error?.message ?? 'none'}`;
|
|
47
|
+
emit({ method: 'session/update', params: { sessionId, update: {
|
|
48
|
+
sessionUpdate: 'agent_message_chunk',
|
|
49
|
+
messageId: 'msg-perm',
|
|
50
|
+
content: { type: 'text', text: `permission: ${chosen}` },
|
|
51
|
+
} } });
|
|
52
|
+
emit({ id: promptId, result: { stopReason: 'end_turn', usage: { inputTokens: 5, outputTokens: 1, totalTokens: 6, cachedReadTokens: 0, cachedWriteTokens: 0 } } });
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (msg.method === 'session/cancel') {
|
|
57
|
+
// Real junie resolves the in-flight session/prompt with `cancelled` after
|
|
58
|
+
// a session/cancel notification (confirmed live) — unless the process is
|
|
59
|
+
// about to be SIGTERM'd anyway (the #703 scenario), in which case it never
|
|
60
|
+
// gets the chance and `rejectPending` on the runner side owns settlement.
|
|
61
|
+
if (pendingPromptId !== null && !ignoreEof) {
|
|
62
|
+
emit({
|
|
63
|
+
id: pendingPromptId,
|
|
64
|
+
result: { stopReason: 'cancelled', usage: { inputTokens: 5, outputTokens: 1, totalTokens: 6, cachedReadTokens: 0, cachedWriteTokens: 0 } },
|
|
65
|
+
});
|
|
66
|
+
pendingPromptId = null;
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (msg.method === 'initialize') {
|
|
71
|
+
emit({
|
|
72
|
+
id: msg.id,
|
|
73
|
+
result: {
|
|
74
|
+
protocolVersion: 1,
|
|
75
|
+
agentCapabilities: {},
|
|
76
|
+
authMethods: [{ type: 'agent', id: 'mock-account', name: 'Mock Account' }],
|
|
77
|
+
agentInfo: { name: 'mock-junie', version: '0.0.0' },
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (msg.method === 'authenticate') {
|
|
83
|
+
if (process.env.CEZ_MOCK_JUNIE_AUTH_ERROR) {
|
|
84
|
+
emit({ id: msg.id, error: { code: -32000, message: process.env.CEZ_MOCK_JUNIE_AUTH_ERROR } });
|
|
85
|
+
} else {
|
|
86
|
+
emit({ id: msg.id, result: {} });
|
|
87
|
+
}
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (msg.method === 'session/new') {
|
|
91
|
+
emit({ id: msg.id, result: {
|
|
92
|
+
sessionId: 'mock-session-1',
|
|
93
|
+
configOptions: [{
|
|
94
|
+
type: 'select',
|
|
95
|
+
id: 'model',
|
|
96
|
+
options: [
|
|
97
|
+
{
|
|
98
|
+
group: 'jetbrains-ai',
|
|
99
|
+
name: 'JetBrains AI',
|
|
100
|
+
options: [
|
|
101
|
+
{ value: 'v1:model:junie:sonnet', name: 'Sonnet', description: 'Balanced' },
|
|
102
|
+
{ value: 'v1:model:junie:opus', name: 'Opus', description: 'Reasoning' },
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
}],
|
|
107
|
+
} });
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (msg.method === 'session/load') {
|
|
111
|
+
emit({ id: msg.id, result: { sessionId: msg.params?.sessionId ?? 'mock-session-1', configOptions: [] } });
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (msg.method === 'session/set_config_option') {
|
|
115
|
+
if (msg.params?.configId === 'model' && msg.params?.value === 'mock:bad-model') {
|
|
116
|
+
emit({ id: msg.id, error: { code: -32602, message: `unknown model ${msg.params.value}` } });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
emit({ id: msg.id, result: { configOptions: [] } });
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (msg.method === 'session/prompt') {
|
|
123
|
+
const text = promptText(msg.params);
|
|
124
|
+
const sessionId = msg.params?.sessionId;
|
|
125
|
+
|
|
126
|
+
if (text.includes('mock:turn-failed')) {
|
|
127
|
+
emit({ id: msg.id, error: { code: -32000, message: 'model unavailable' } });
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (text.includes('mock:permission')) {
|
|
131
|
+
// ACP leaves option order to the agent — list the persistent grant FIRST so the
|
|
132
|
+
// runner's preference for `allow_once` is proven, not an accident of ordering.
|
|
133
|
+
pendingPermission = { promptId: msg.id, sessionId };
|
|
134
|
+
emit({ id: 'perm-1', method: 'session/request_permission', params: {
|
|
135
|
+
sessionId,
|
|
136
|
+
toolCall: { toolCallId: 'call-perm', title: 'rm -rf build', kind: 'execute' },
|
|
137
|
+
options: [
|
|
138
|
+
{ optionId: 'always', name: 'Always allow', kind: 'allow_always' },
|
|
139
|
+
{ optionId: 'once', name: 'Allow once', kind: 'allow_once' },
|
|
140
|
+
{ optionId: 'reject', name: 'Reject', kind: 'reject_once' },
|
|
141
|
+
],
|
|
142
|
+
} });
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (text.includes('mock:hang')) {
|
|
146
|
+
// Stream some text, then start a tool call that never finishes (closing
|
|
147
|
+
// the message the same way a real subsequent frame would) so a test can
|
|
148
|
+
// observe the turn is genuinely live before tearing it down — then never
|
|
149
|
+
// respond to the prompt itself: the caller is expected to session/cancel
|
|
150
|
+
// or tear down.
|
|
151
|
+
pendingPromptId = msg.id;
|
|
152
|
+
emit({ method: 'session/update', params: { sessionId, update: {
|
|
153
|
+
sessionUpdate: 'agent_message_chunk',
|
|
154
|
+
messageId: 'msg-hang',
|
|
155
|
+
content: { type: 'text', text: 'Working on it.' },
|
|
156
|
+
} } });
|
|
157
|
+
emit({ method: 'session/update', params: { sessionId, update: {
|
|
158
|
+
sessionUpdate: 'tool_call',
|
|
159
|
+
toolCallId: 'call-hang',
|
|
160
|
+
title: 'sleep 999',
|
|
161
|
+
kind: 'execute',
|
|
162
|
+
status: 'in_progress',
|
|
163
|
+
content: [],
|
|
164
|
+
locations: [],
|
|
165
|
+
rawInput: { command: 'sleep 999', cwd: process.cwd() },
|
|
166
|
+
} } });
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
emit({ method: 'session/update', params: { sessionId, update: {
|
|
171
|
+
sessionUpdate: 'agent_message_chunk',
|
|
172
|
+
messageId: 'msg-1',
|
|
173
|
+
content: { type: 'text', text: 'Checking the working tree.' },
|
|
174
|
+
_meta: { junie: { phase: 'commentary' } },
|
|
175
|
+
} } });
|
|
176
|
+
emit({ method: 'session/update', params: { sessionId, update: {
|
|
177
|
+
sessionUpdate: 'tool_call',
|
|
178
|
+
toolCallId: 'call-1',
|
|
179
|
+
title: 'git status --short',
|
|
180
|
+
kind: 'execute',
|
|
181
|
+
status: 'in_progress',
|
|
182
|
+
content: [],
|
|
183
|
+
locations: [],
|
|
184
|
+
rawInput: { command: 'git status --short', cwd: process.cwd() },
|
|
185
|
+
} } });
|
|
186
|
+
emit({ method: 'session/update', params: { sessionId, update: {
|
|
187
|
+
sessionUpdate: 'tool_call_update',
|
|
188
|
+
toolCallId: 'call-1',
|
|
189
|
+
title: 'git status --short',
|
|
190
|
+
kind: 'execute',
|
|
191
|
+
status: 'completed',
|
|
192
|
+
content: [{ type: 'content', content: { type: 'text', text: ' M src/example.ts' } }],
|
|
193
|
+
locations: [],
|
|
194
|
+
rawOutput: { output: ' M src/example.ts', exitCode: 0 },
|
|
195
|
+
} } });
|
|
196
|
+
emit({
|
|
197
|
+
id: msg.id,
|
|
198
|
+
result: {
|
|
199
|
+
stopReason: 'end_turn',
|
|
200
|
+
usage: { inputTokens: 1200, outputTokens: 300, totalTokens: 1500, cachedReadTokens: 0, cachedWriteTokens: 0 },
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
rl.on('close', () => {
|
|
207
|
+
if (!ignoreEof) process.exit(0);
|
|
208
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r}from"./toaster-CfRVb8vH.js";import{r as i,t as a}from"./utils-BXvEm7Ve.js";import{i as o,r as s,s as c,t as l}from"./popover-CNGONAql.js";import{a as u,c as d}from"./picker-pill-VW-M1ZiV.js";import{a as f,i as p,o as m,r as h,s as g,t as _}from"./command-Dfln3D4A.js";import{t as v}from"./sparkles-CvOeAoyJ.js";import{t as y}from"./project-router-dCZQu1wQ.js";import{c as b,d as x,f as S,i as C,u as w}from"./skills-9oR_oHse.js";import{W as T,u as E}from"./index-HS1hr5Sz.js";var D=i(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),O=n();function k({name:e,route:t,selected:n,list:r,detail:i}){return(0,O.jsxs)(`div`,{"data-route":t,className:`flex h-full min-h-0 items-stretch`,children:[(0,O.jsx)(`section`,{"data-slot":`${e}-list`,className:a(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,n?`hidden`:`flex`),children:r}),(0,O.jsx)(`section`,{"data-slot":`${e}-detail`,className:a(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,n?`flex`:`hidden md:flex`),children:i})]})}function A(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function j(e,t=[]){let n=A(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=M(t)),n}function M(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function N(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function P(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function F(e,t,n){let r=(n??``).trim();if(!r)return j(e,t);let i=A(e),a=r.startsWith(i)?i+N(r.slice(i.length),e):N(r,e),o=P(a,e)?a:`${i}\n\n${a}`;return t.length?o+M(t):o}function I(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function L(e,t,n,r,i={}){return t?{...i,workflow:t,task:F(e,n,r)}:n.length?{...i,steps:I(n),task:F(e,[],r)}:{...i,workflow:`quick-task`,task:F(e,[],r)}}function R({resolved:e,dataSlot:t}){return e.providerPending||e.canRun?null:(0,O.jsxs)(`span`,{"data-slot":t,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[e.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,O.jsx)(y,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]})}var z=e(t(),1);function B({workflows:e,value:t,onChange:n,slotPrefix:i=`gh`}){let[d,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(``),C=(0,z.useRef)(null),w=x(e,y);return(0,O.jsxs)(l,{open:d,onOpenChange:e=>{v(e),e||b(``)},children:[(0,O.jsx)(o,{asChild:!0,children:(0,O.jsxs)(`button`,{type:`button`,"data-slot":`${i}-workflow-trigger`,"aria-label":`Choose a workflow`,className:a(u,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,O.jsx)(T,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,O.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,O.jsx)(c,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,O.jsx)(s,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,O.jsxs)(_,{label:`Choose a workflow`,shouldFilter:!1,children:[(0,O.jsx)(f,{placeholder:`search workflows…`,value:y,onValueChange:b,onInput:()=>C.current?.scrollTo(0,0)}),(0,O.jsxs)(g,{ref:C,"data-slot":`${i}-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[w.length===0?(0,O.jsx)(h,{children:`Nothing matches.`}):null,(0,O.jsx)(p,{children:w.map(e=>{let a=t===e.name;return(0,O.jsxs)(m,{value:`workflow ${e.name}`,keywords:S(e.name,e.description),"data-slot":`${i}-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(a?null:e.name),v(!1)},children:[(0,O.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,O.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,a?(0,O.jsx)(r,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function V({skills:e,skillUsage:t,selected:n,onToggle:i,maxSelections:y,slotPrefix:x=`gh`}){let[T,D]=(0,z.useState)(!1),[k,A]=(0,z.useState)(``),[j,M]=(0,z.useState)(null),N=(0,z.useRef)(null),{mostUsed:P,project:F,global:I}=b(w(e,k,t),t),L=(e,t)=>{let o=n.includes(e.name);return(0,O.jsxs)(m,{value:`skill ${e.name} ${e.path}`,keywords:S(e.name,e.description),"data-slot":`${x}-skill-option`,"data-skill":e.name,"data-selected":o?`true`:void 0,disabled:!o&&y!==void 0&&n.length>=y,onSelect:()=>i(e.name),children:[(0,O.jsx)(`span`,{className:a(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,O.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,O.jsx)(`button`,{type:`button`,"data-slot":`${x}-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),M(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,O.jsx)(d,{"aria-hidden":`true`,className:`size-3.5`})}),o?(0,O.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(E,{skill:j,onClose:()=>M(null)}),(0,O.jsxs)(l,{open:T,onOpenChange:e=>{D(e),e||A(``)},children:[(0,O.jsx)(o,{asChild:!0,children:(0,O.jsxs)(`button`,{type:`button`,"data-slot":`${x}-skills-trigger`,"aria-label":`Choose skills`,className:a(u,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,O.jsx)(v,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,O.jsx)(c,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,O.jsx)(s,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,O.jsxs)(_,{label:`Choose skills`,shouldFilter:!1,children:[(0,O.jsx)(f,{placeholder:`search skills…`,value:k,onValueChange:A,onInput:()=>N.current?.scrollTo(0,0)}),(0,O.jsxs)(g,{ref:N,"data-slot":`${x}-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[P.length===0&&F.length===0&&I.length===0?(0,O.jsx)(h,{children:`Nothing matches.`}):null,P.length>0?(0,O.jsx)(p,{heading:`Most used`,children:P.map(e=>L(e,C(e)))}):null,F.length>0?(0,O.jsx)(p,{heading:`Project skills`,children:F.map(e=>L(e,!0))}):null,I.length>0?(0,O.jsx)(p,{heading:`Global`,children:I.map(e=>L(e,!1))}):null]})]})})]})]})}export{j as a,k as c,L as i,D as l,B as n,A as o,R as r,I as s,V as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{T as r,_ as i,i as a,v as o}from"./toaster-CfRVb8vH.js";import{t as s}from"./utils-BXvEm7Ve.js";import{a as c,c as l,i as u,l as d,n as f,o as p,r as m,s as h,t as g}from"./dist-DpiX6WjA.js";var _=e(t(),1),v=n(),y=`AlertDialog`,[b,ee]=o(y,[d]),x=d(),S=e=>{let{__scopeAlertDialog:t,...n}=e,r=x(t);return(0,v.jsx)(g,{...r,...n,modal:!0})};S.displayName=y;var C=`AlertDialogTrigger`,w=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=x(n);return(0,v.jsx)(l,{...i,...r,ref:t})});w.displayName=C;var T=`AlertDialogPortal`,E=e=>{let{__scopeAlertDialog:t,...n}=e,r=x(t);return(0,v.jsx)(p,{...r,...n})};E.displayName=T;var D=`AlertDialogOverlay`,O=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=x(n);return(0,v.jsx)(c,{...i,...r,ref:t})});O.displayName=D;var k=`AlertDialogContent`,[A,j]=b(k),M=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:a,...o}=e,s=x(n),c=r(t,_.useRef(null)),l=_.useRef(null);return(0,v.jsx)(A,{scope:n,cancelRef:l,children:(0,v.jsx)(m,{role:`alertdialog`,...s,...o,ref:c,onOpenAutoFocus:i(o.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:a})})});M.displayName=k;var N=`AlertDialogTitle`,P=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=x(n);return(0,v.jsx)(h,{...i,...r,ref:t})});P.displayName=N;var F=`AlertDialogDescription`,I=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=x(n);return(0,v.jsx)(u,{...i,...r,ref:t})});I.displayName=F;var L=`AlertDialogAction`,R=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=x(n);return(0,v.jsx)(f,{...i,...r,ref:t})});R.displayName=L;var z=`AlertDialogCancel`,B=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...i}=e,{cancelRef:a}=j(z,n),o=x(n),s=r(t,a);return(0,v.jsx)(f,{...o,...i,ref:s})});B.displayName=z;var V=S,te=E,H=O,U=M,W=R,G=B,K=P,q=I;function J({...e}){return(0,v.jsx)(V,{"data-slot":`alert-dialog`,...e})}function Y({...e}){return(0,v.jsx)(te,{"data-slot":`alert-dialog-portal`,...e})}function X({className:e,...t}){return(0,v.jsx)(H,{"data-slot":`alert-dialog-overlay`,className:s(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Z({className:e,...t}){return(0,v.jsxs)(Y,{children:[(0,v.jsx)(X,{}),(0,v.jsx)(U,{"data-slot":`alert-dialog-content`,className:s(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-md`,e),...t})]})}function Q({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:s(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function $({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:s(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function ne({className:e,...t}){return(0,v.jsx)(K,{"data-slot":`alert-dialog-title`,className:s(`text-lg leading-none font-semibold`,e),...t})}function re({className:e,...t}){return(0,v.jsx)(q,{"data-slot":`alert-dialog-description`,className:s(`text-sm text-muted-foreground`,e),...t})}function ie({className:e,...t}){return(0,v.jsx)(W,{"data-slot":`alert-dialog-action`,className:s(a({variant:`contrast`}),e),...t})}function ae({className:e,...t}){return(0,v.jsx)(G,{"data-slot":`alert-dialog-cancel`,className:s(a({variant:`outline`}),e),...t})}export{re as a,ne as c,Z as i,ie as n,$ as o,ae as r,Q as s,J as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./utils-BXvEm7Ve.js";var t=e(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./utils-BXvEm7Ve.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Bi as r,Li as i,Q as a,Ri as o,Yn as s,n as c,ni as l,oi as u,or as d,pr as f,tr as p}from"./toaster-CfRVb8vH.js";import{A as m,C as h,T as g,c as _,k as v,r as y,t as b,w as x}from"./utils-BXvEm7Ve.js";import{l as S}from"./facet-filter-CfI4QvOd.js";import{s as C}from"./project-router-dCZQu1wQ.js";var w=y(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),T=e(t(),1),E=n();function D({className:e,flush:t=!1,...n}){return(0,E.jsx)(`div`,{"data-slot":`card`,"data-flush":t?`true`:void 0,className:b(`flex flex-col rounded-lg border bg-card text-card-foreground shadow-xs`,t?`gap-0 overflow-hidden py-0`:`gap-6 py-6`,e),...n})}var O=e=>`"${e.replace(/(["\\$`!])/g,`\\$1`)}"`;function k(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function A(e){if(e.kind===`tracker`)return!1;if(e.kind===`schedule`)return!!e.schedule;if(!e.events?.length)return!1;let t=e.filters??{};return!([`assignees`,`allLabels`,`excludeLabels`,`changedLabels`].some(e=>(t[e]?.length??0)>0)||t.lookbackDays!==void 0&&t.lookbackDays!==7||t.maxRecords!==void 0&&t.maxRecords!==25)}function j(e){let t=[`cez automation add`,`--name ${O(e.name||`untitled`)}`];if(e.kind===`schedule`&&e.schedule)t.push(`--cron ${O(x(e.schedule))}`);else{t.push(`--on ${(e.events??[]).join(`,`)}`),t.push(`--every ${k(e.intervalSeconds??300)}`);for(let n of e.filters?.anyLabels??[])t.push(`--label ${O(n)}`);for(let n of e.filters?.authors??[])t.push(`--author ${O(n)}`)}let{task:n}=e;return n.workflow&&t.push(`--workflow ${O(n.workflow)}`),n.runner&&t.push(`--runner ${O(n.runner)}`),n.model&&t.push(`--model ${O(n.model)}`),n.autonomous===!1?t.push(`--no-autonomous`):n.autonomous&&t.push(`--autonomous`),n.dispatch&&(t.push(`--dispatch`),n.dispatch.maxSubtasks!==void 0&&t.push(`--max-subtasks ${n.dispatch.maxSubtasks}`),n.dispatch.reviewChild&&t.push(`--review-child`)),e.enable&&t.push(`--enable`),t.push(`--prompt ${O(n.prompt||`…`)}`),t.join(` `)}function M(e){let t={name:e.name||`untitled`,kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds??1800,filters:{lookbackDays:7,maxRecords:25,...e.filters}}:{events:e.events,intervalSeconds:e.intervalSeconds??300,filters:{lookbackDays:7,maxRecords:25,...e.filters}},task:e.task,...e.enable?{enable:!0}:{}};return`cez automation create --json '${JSON.stringify(t).replace(/'/g,`'\\''`)}'`}function N(e){return A(e)?j(e):M(e)}var P=()=>[_(),`automations`];function F(){let e=a(),t=e.data!==void 0;return{known:t,off:t&&e.data?.capabilities?.automations!==!0}}function I(e){let t=r(),n=C(),i=o({queryKey:P(),queryFn:({signal:e})=>f({signal:e}),enabled:e});return(0,T.useEffect)(()=>S((e,r)=>{if(e!==`automation-change`)return;let i=r;typeof i.project==`string`&&(n===null||i.project===n)&&t.invalidateQueries({queryKey:P()})}),[n,t]),i}function L(e){let t=r(),n=()=>t.invalidateQueries({queryKey:P()}),a=e=>c(e instanceof Error?e.message:String(e),{tone:`danger`}),o=i({mutationFn:async e=>{e.kind===`schedule`?(await l(e.id),c(`Started "${e.name}" — the task is queued.`)):(await s(e.id,`execute`),c(`Checking events for "${e.name}" now.`))},onSuccess:()=>void n(),onError:a}),f=i({mutationFn:async e=>{await s(e.id,`preview`),c(`Preview queued for "${e.name}" — no tasks will launch. See the execution log for results.`)},onSuccess:()=>void n(),onError:a}),m=i({mutationFn:e=>u(e.id,!e.enabled),onSuccess:()=>void n(),onError:a}),h=i({mutationFn:e=>p({name:`${e.name} (copy)`,...e.description?{description:e.description}:{},kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds,filters:e.filters}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:e.task}),onSuccess:e=>{c(`Duplicated as "${e.automation.name}", paused.`),n()},onError:a}),g=i({mutationFn:e=>d(e.id),onSuccess:()=>void n(),onError:a});return{preview:e=>f.mutateAsync(e).then(()=>void 0,()=>void 0),runNow:e=>o.mutateAsync(e).then(()=>void 0,()=>void 0),toggleEnabled:e=>m.mutateAsync(e).then(()=>void 0,()=>void 0),duplicate:e=>h.mutateAsync(e).then(()=>void 0,()=>void 0),remove:e=>g.mutateAsync(e).then(()=>void 0,()=>void 0),copyCli:async e=>{await R(N({name:e.name,kind:e.kind,trackerTrigger:e.trackerTrigger,schedule:e.schedule,events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters,task:e.task}))},busy:f.isPending||o.isPending||m.isPending||h.isPending||g.isPending}}async function R(e){try{await navigator.clipboard.writeText(e),c(`Copied to the clipboard.`)}catch{c(`Copy failed — select the text to copy it.`,{tone:`danger`})}}function z(e){return h[((e-1)%7+7)%7]??``}function B(e,t){let n=m(typeof e==`number`?e:Date.parse(e),t);return n?`${z(n.weekday)} ${g(n.hour,n.minute)}`:``}function V(e,t){let n=m(typeof e==`number`?e:Date.parse(e),t);return n?g(n.hour,n.minute):``}function H(e,t,n=Date.now()){let r=Date.parse(e),i=m(r,t);if(!i)return``;if(n-r<6*864e5)return`${z(i.weekday)} ${g(i.hour,i.minute)}`;let a=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][i.month-1];return`${i.day} ${a} ${g(i.hour,i.minute)}`}function U(e,t=Date.now()){let n=Math.max(0,Math.round((e-t)/6e4));return n<60?`in ${n}m`:n<1440?`in ${Math.round(n/60)}h`:`in ${Math.round(n/1440)}d`}function W(e){let t=Math.round(e/60),n=Math.floor(t/60);return n>0?`${n}h ${String(t%60).padStart(2,`0`)}m`:`${t}m`}function G(e){return e>=10?`$${e.toFixed(1)}`:`$${e.toFixed(2)}`}function K(e){switch(e){case`done`:return`success`;case`running`:case`queued`:case`waiting`:return`pending`;case`failed`:case`cancelled`:return`danger`;case`review`:return`violet`}}function q(e){switch(e){case`review`:return`needs review`;case`waiting`:return`needs you`;default:return e}}function J(e){if(e.kind===`schedule`&&e.schedule)return v(e.schedule);if(e.kind===`tracker`){let t=e.trackerTrigger,n=t?.association.kind===`jira`?`Jira`:t?.association.kind===`linear`?`Linear`:`Tracker`;return t?`${n} · ${t.events.join(`, `)}${t.targetStatusIds?.length?` → ${t.targetStatusIds.join(`, `)}`:``}${t.changedLabelIds?.length?` · labels ${t.changedLabelIds.join(`, `)}`:``} · every ${Math.round((e.intervalSeconds??1800)/60)} min`:`${n} · select an event to complete setup`}let t=(e.events??[]).join(`, `),n=Math.round((e.intervalSeconds??300)/60);return`on ${t||`github`} · every ${n} min`}function Y(e){switch(e){case`launched`:case`manual`:case`catch-up`:return`success`;case`failed`:case`error`:case`rate-limited`:return`danger`;default:return`neutral`}}export{N as _,U as a,K as c,G as d,P as f,I as g,F as h,H as i,V as l,L as m,z as n,Y as o,R as p,B as r,q as s,W as t,J as u,D as v,w as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Bi as r,Dr as i,Fi as a,Ii as o,Kt as s,Li as c,Pi as l,Q as u,Ri as d,Tr as f,Vn as p,di as m,dr as h,fr as g,in as _,n as ee,r as v,ti as y,tn as te,tr as b,wt as ne}from"./toaster-CfRVb8vH.js";import{A as x,C as S,D as re,E as ie,O as ae,S as oe,T as C,c as w,j as se,r as T,t as E,w as ce}from"./utils-BXvEm7Ve.js";import{l as D}from"./facet-filter-CfI4QvOd.js";import{a as le,i as O,n as ue,o as de,s as fe,t as pe}from"./use-now-3lElDuTi.js";import{E as me}from"./editable-title-DDtUgRKZ.js";import{t as he}from"./arrow-left-BIZHhBIP.js";import{f as ge}from"./tooltip-_O50N3pt.js";import{_ as _e,a as ve,c as k,d as ye,f as be,g as xe,h as Se,i as Ce,l as we,m as Te,n as Ee,o as De,p as Oe,r as ke,s as Ae,t as je,u as Me,v as A,y as Ne}from"./automation-format-CfPmkcsg.js";import{t as Pe}from"./chevron-left-DLAUPC66.js";import{s as Fe}from"./popover-CNGONAql.js";import{t as Ie}from"./chevron-right-KVZcXiPL.js";import{c as Le,n as Re,r as j,s as ze,t as Be}from"./dropdown-menu-Ci4HFML0.js";import{n as Ve,t as He}from"./trash-2-CUH7GOVh.js";import{c as Ue,r as M,t as We}from"./picker-pill-VW-M1ZiV.js";import{t as Ge}from"./file-text-Dm6CrEGW.js";import{f as Ke,m as qe,p as Je}from"./new-task-form-vLs2G1_z.js";import{n as Ye,r as Xe,t as Ze}from"./collapsible-DG_SIWqU.js";import{a as Qe,c as $e,i as et,n as tt,o as nt,r as rt,s as it,t as at}from"./alert-dialog-CnRAuqwb.js";import{c as N,s as ot,t as P}from"./project-router-dCZQu1wQ.js";import{a as F}from"./token-metrics-DldVlr6m.js";import{n as st}from"./format-DHK74MwW.js";import{s as ct}from"./skills-9oR_oHse.js";import{t as I}from"./pill-CPl6sysj.js";import{t as lt}from"./centered-state-3r2Kaar_.js";import{t as ut}from"./textarea-DtBqPhIs.js";import{i as dt,o as ft,r as pt}from"./prompt-templates-jNjVTAws.js";import{t as mt}from"./segmented-IDD4ucht.js";import{B as ht,C as L,H as R,J as gt,Q as _t,S as z,V as B,b as V,c as vt,f as yt,m as bt,n as xt,x as H,y as U}from"./index-HS1hr5Sz.js";var St=T(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Ct=T(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),wt=T(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),Tt=T(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Et=T(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Dt=T(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Ot=T(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),kt=T(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),At=T(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),W=e(t(),1),G=n();function jt({association:e,selected:t,onSelect:n,onRemove:r}){let a=o({queryKey:[`tracker`,w(),`label-suggestions`,e],initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>i({association:e,state:`all`,limit:50,cursor:t},{signal:n}),getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,retry:!1,staleTime:6e4}),s=a.data?.pages??[],c=s.at(-1),l=s.find(e=>!e.available),u=a.isError||!!l,d=[...new Set([...t,...u?[]:s.flatMap(e=>e.available?e.items.flatMap(e=>e.labels):[])])].filter(e=>t.includes(e)||e.length>0&&e.length<=200).sort((e,t)=>e.localeCompare(t));return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,"aria-label":`Project label suggestions`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Required labels`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`All selected labels must match. Leave unselected to allow any label.`}),(0,G.jsx)(`div`,{role:`group`,"aria-label":`Required labels`,className:`flex flex-wrap gap-1.5`,children:d.map(e=>(0,G.jsx)(M,{active:t.includes(e),"aria-pressed":t.includes(e),disabled:!t.includes(e)&&t.length>=100,onClick:()=>t.includes(e)?r(e):n(e),children:e},e))}),a.isFetching?(0,G.jsx)(`p`,{role:`status`,children:`Loading labels…`}):null,u?(0,G.jsxs)(`div`,{role:`alert`,children:[(0,G.jsx)(`p`,{children:`Could not load labels. Your selection is preserved.`}),(0,G.jsx)(v,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void a.refetch(),children:`Retry label suggestions`})]}):(0,G.jsxs)(G.Fragment,{children:[!a.isPending&&!a.isFetching&&d.length===0?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No labels found in the loaded tasks.`}):null,a.hasNextPage?(0,G.jsx)(v,{type:`button`,variant:`outline`,size:`sm`,disabled:a.isFetching,onClick:()=>void a.fetchNextPage(),children:`Load labels from more tasks`}):null,!a.hasNextPage&&c?.available&&c.truncated?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The provider returned a limited task list.`}):null]})]})}var Mt=[`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`,`pull_request.reviewed`,`pull_request.review_requested`,`pull_request.rereview_requested`];function Nt(e){return[{id:`task`,name:e,skill:e,prompt:`{{task}}`}]}function Pt(e){let[t,...n]=e??[];return t&&n.length===0&&t.skill&&t.prompt===`{{task}}`?t.skill:null}function Ft(e){return e.skill?{source:`skill`,ref:e.skill}:e.workflow&&e.workflow!==`quick-task`?{source:`workflow`,ref:e.workflow}:null}function It(e){return e?.source===`skill`?{skill:e.ref,workflow:Ke,customSteps:null}:{skill:null,workflow:e?.ref??`quick-task`,customSteps:null}}var Lt=[2,5,10,15,30,60],Rt=[1,2,4,6,8],zt={authors:``,assignees:``,anyLabels:``,allLabels:``,excludeLabels:``,changedLabels:``,reviewers:``,lookbackDays:7,maxRecords:25},Bt={type:`daily`,hour:4,minute:0};function Vt(){return{name:``,kind:`schedule`,schedule:{...Bt},events:[`issue.opened`],intervalSeconds:300,filters:{...zt},prompt:``,workflow:Ke,skill:null,customSteps:null,runner:null,account:null,model:null,autonomous:!0,dispatch:!1,maxSubtasks:4,reviewChild:!0,enabled:!1}}var K=e=>(e??[]).join(`, `);function Ht(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function Ut(e){let t=Vt(),{task:n,filters:r}=e,i=Pt(n.steps);return{...t,name:e.name,kind:e.kind,trackerTrigger:e.trackerTrigger,schedule:e.schedule?{...e.schedule}:t.schedule,events:e.events?.length?[...e.events]:t.events,intervalSeconds:e.intervalSeconds??t.intervalSeconds,filters:r?{authors:K(r.authors),assignees:K(r.assignees),anyLabels:K(r.anyLabels),allLabels:K(r.allLabels),excludeLabels:K(r.excludeLabels),changedLabels:K(r.changedLabels),reviewers:K(r.reviewers),lookbackDays:r.lookbackDays,maxRecords:r.maxRecords}:t.filters,prompt:n.prompt,workflow:n.workflow??t.workflow,skill:i,customSteps:n.steps&&!i?n.steps:null,runner:n.runner??null,account:n.agentProfile??null,model:n.model??null,autonomous:n.autonomous??!1,dispatch:n.dispatch!==void 0,maxSubtasks:n.dispatch?.maxSubtasks??t.maxSubtasks,reviewChild:n.dispatch?.reviewChild??t.reviewChild,enabled:e.enabled}}function Wt(e){return{name:e.name,kind:e.kind,...e.schedule?{schedule:e.schedule}:{},...e.events?{events:e.events}:{},...e.intervalSeconds===void 0?{}:{intervalSeconds:e.intervalSeconds},prompt:e.task.prompt,...e.task.workflow?{workflow:e.task.workflow}:{},...e.task.runner?{runner:e.task.runner}:{},...e.task.model===void 0?{}:{model:e.task.model},...e.task.autonomous===void 0?{}:{autonomous:e.task.autonomous},...e.task.dispatch?{dispatch:e.task.dispatch}:{}}}var Gt=e=>e===`claude`||e===`codex`||e===`junie`||e===`opencode`||e===`cursor`||e===`pi`||e===`copilot`;function Kt(e,t){return{...e,name:t.name,kind:t.kind,schedule:t.schedule?{...t.schedule}:e.schedule,events:t.events?.length?[...t.events]:e.events,intervalSeconds:t.intervalSeconds??e.intervalSeconds,prompt:t.prompt,...t.workflow?It({source:`workflow`,ref:t.workflow}):{},runner:t.runner!==void 0&&Gt(t.runner)?t.runner:e.runner,account:t.runner!==void 0&&Gt(t.runner)?null:e.account,model:t.model??e.model,autonomous:t.autonomous??e.autonomous,dispatch:t.dispatch!==void 0,maxSubtasks:t.dispatch?.maxSubtasks??e.maxSubtasks,reviewChild:t.dispatch?.reviewChild??e.reviewChild}}function qt(e){let t=re(e);switch(t.type){case`hours`:return{type:`hours`,every:t.every};case`weekly`:return{type:`weekly`,hour:t.hour,minute:t.minute,day:t.day};default:return{type:t.type,hour:t.hour,minute:t.minute}}}function Jt(e){let t={prompt:e.prompt,...e.skill?{steps:Nt(e.skill)}:e.customSteps?{steps:e.customSteps}:e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.account?{agentProfile:e.account}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.dispatch?{dispatch:{maxSubtasks:e.maxSubtasks,reviewChild:e.reviewChild}}:{}};if(e.kind===`schedule`)return{name:e.name.trim(),kind:`schedule`,schedule:qt(e.schedule),task:t};if(e.kind===`tracker`)return{name:e.name.trim(),kind:`tracker`,trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds,filters:{lookbackDays:q(e.filters.lookbackDays,1,90),maxRecords:q(e.filters.maxRecords,1,100)},task:t};let n=e.filters,r=(e,t)=>{let n=Ht(e);return n.length>0?{[t]:n}:{}};return{name:e.name.trim(),kind:`github`,events:[...e.events],intervalSeconds:e.intervalSeconds,filters:{...r(n.authors,`authors`),...r(n.assignees,`assignees`),...r(n.anyLabels,`anyLabels`),...r(n.allLabels,`allLabels`),...r(n.excludeLabels,`excludeLabels`),...r(n.changedLabels,`changedLabels`),...r(n.reviewers,`reviewers`),lookbackDays:q(n.lookbackDays,1,90),maxRecords:q(n.maxRecords,1,100)},task:t}}function q(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,Math.round(e))):t}function Yt(e){let t=Jt(e);return{name:t.name,kind:e.kind,...t.trackerTrigger?{trackerTrigger:t.trackerTrigger}:{},...t.schedule?{schedule:t.schedule}:{},...t.events?{events:t.events}:{},...t.intervalSeconds===void 0?{}:{intervalSeconds:t.intervalSeconds},...t.filters?{filters:t.filters}:{},task:t.task,...e.enabled?{enable:!0}:{}}}function Xt(e){return e.includes(`issue.labeled`)||e.includes(`issue.unlabeled`)}var Zt=e=>[1,2,3,4,6,8,12].includes(e);function Qt({trigger:e,intervalSeconds:t,onChange:n,onValid:r}){let[i,a]=(0,W.useState)(``),s=w(),c=o({queryKey:[`tracker`,s,`automation-options`,``],initialPageParam:void 0,queryFn:({signal:e,pageParam:t})=>f({...t?{cursor:t}:{}},{signal:e}),getNextPageParam:e=>e.available?e.nextCursor:void 0,retry:!1}),l=o({queryKey:[`tracker`,s,`automation-options`,i],enabled:!!i&&c.data?.pages[0]?.available===!0,initialPageParam:void 0,queryFn:({signal:e,pageParam:t})=>f({...i?{search:i}:{},...t?{cursor:t}:{}},{signal:e}),getNextPageParam:e=>e.available?e.nextCursor:void 0,retry:!1}),u=i?l:c,d=c.data?.pages[0],p=d?.available?d:void 0,m=!!p&&!!e&&JSON.stringify(p.association)===JSON.stringify(e.association),h=m&&!!e?.events.length&&e.events.every(e=>p?.events.includes(e))&&(e.requiredLabels?.length??0)<=100&&(e.requiredLabels??[]).every(e=>e.length>0&&e.length<=200)&&(!e.events.includes(`issue.status_changed`)||!!e.targetStatusIds?.length)&&(!(e.events.includes(`issue.labeled`)||e.events.includes(`issue.unlabeled`))||!!e.changedLabelIds?.length);(0,W.useEffect)(()=>(r(h),()=>r(!1)),[h,r]);let g=u.data?.pages.flatMap(e=>e.available?[e]:[])??[],_=[...new Map(g.flatMap(e=>e.statuses).map(e=>[e.id,e])).values()],ee=new Map((c.data?.pages.flatMap(e=>e.available?e.statuses:[])??[]).map(e=>[e.id,e.name])),y=(e?.targetStatusIds??[]).filter(e=>!_.some(t=>t.id===e)),te=[...new Map(g.flatMap(e=>e.labels).map(e=>[e.id,e])).values()],b=e?.events.includes(`issue.status_changed`),ne=e?.events.some(e=>e===`issue.labeled`||e===`issue.unlabeled`),x=b&&ne?`Search tracker statuses and labels`:ne?`Search tracker labels`:`Search tracker statuses`;return(0,G.jsxs)(`div`,{"data-slot":`editor-tracker`,className:`flex flex-col gap-3 text-sm`,children:[c.isPending?(0,G.jsx)(`p`,{children:`Loading tracker events…`}):null,c.isError||d&&!d.available?(0,G.jsxs)(`div`,{role:`alert`,children:[(0,G.jsxs)(`p`,{children:[d&&!d.available?d.reason:`Could not load tracker events.`,` Check the project’s Issue tracker settings.`]}),(0,G.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>void c.refetch(),children:`Retry`})]}):null,p?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{children:[p.association.kind===`jira`?`Jira`:`Linear`,` · `,p.association.externalName]}),e&&!m?(0,G.jsx)(`p`,{role:`alert`,children:`The tracker connection changed. Select an event again before saving.`}):null,e?null:(0,G.jsx)(`p`,{children:`Select an event to complete this automation.`}),(0,G.jsx)(`div`,{role:`group`,"aria-label":`Tracker events`,className:`flex flex-wrap gap-1.5`,children:p.events.map(t=>(0,G.jsx)(M,{active:m&&e?.events.includes(t),"aria-pressed":m&&e?.events.includes(t),onClick:()=>{let r=m?e.events:[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],a={...m?e:{},association:p.association,events:i};t===`issue.status_changed`&&!i.includes(t)&&delete a.targetStatusIds,n({trackerTrigger:a,...m?{}:{enabled:!1}})},children:t},t))}),m&&e?(0,G.jsx)(jt,{association:p.association,selected:e.requiredLabels??[],onRemove:t=>n({trackerTrigger:{...e,requiredLabels:(e.requiredLabels??[]).filter(e=>e!==t)}}),onSelect:t=>n({trackerTrigger:{...e,requiredLabels:[...new Set([...e.requiredLabels??[],t])]}})},JSON.stringify(p.association)):null,(0,G.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer`,children:`Integration details`}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,G.jsx)(`p`,{children:`Label choices come from loaded tasks in this project, including closed tasks. Saved selections remain available.`}),p.limitations.map(e=>(0,G.jsx)(`p`,{children:e},e))]})]}),e?.events.some(e=>e!==`issue.opened`)?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(R,{"aria-label":x,placeholder:x,value:i,onChange:e=>a(e.target.value)}),u.isFetching?(0,G.jsx)(`p`,{role:`status`,children:`Searching…`}):null,u.isError||u.data?.pages[0]&&!u.data.pages[0].available?(0,G.jsxs)(`div`,{role:`alert`,children:[`Could not load search results. `,(0,G.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>void u.refetch(),children:`Retry search`})]}):null,!u.isFetching&&u.data?.pages[0]?.available&&b&&_.length===0?(0,G.jsx)(`p`,{children:`No matching statuses.`}):null,!u.isFetching&&u.data?.pages[0]?.available&&ne&&te.length===0?(0,G.jsx)(`p`,{children:`No matching labels.`}):null,e.events.includes(`issue.status_changed`)?(0,G.jsxs)(`div`,{role:`group`,"aria-label":`Target statuses`,className:`flex flex-wrap gap-1.5`,children:[_.map(t=>(0,G.jsx)(M,{active:e.targetStatusIds?.includes(t.id),"aria-pressed":e.targetStatusIds?.includes(t.id),onClick:()=>{let r=e.targetStatusIds??[];n({trackerTrigger:{...e,targetStatusIds:r.includes(t.id)?r.filter(e=>e!==t.id):[...r,t.id]}})},children:t.name},t.id)),y.map(t=>(0,G.jsxs)(M,{active:!0,"aria-pressed":!0,onClick:()=>{n({trackerTrigger:{...e,targetStatusIds:(e.targetStatusIds??[]).filter(e=>e!==t)}})},children:[ee.get(t)??t,` (not in current results)`]},t))]}):null,e.events.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)?(0,G.jsx)(`div`,{role:`group`,"aria-label":`Changed labels`,className:`flex flex-wrap gap-1.5`,children:te.map(t=>(0,G.jsx)(M,{active:e.changedLabelIds?.includes(t.id),"aria-pressed":e.changedLabelIds?.includes(t.id),onClick:()=>{let r=e.changedLabelIds??[];n({trackerTrigger:{...e,changedLabelIds:r.includes(t.id)?r.filter(e=>e!==t.id):[...r,t.id]}})},children:t.name},t.id))}):null,u.hasNextPage?(0,G.jsx)(v,{variant:`outline`,size:`sm`,disabled:u.isFetchingNextPage,onClick:()=>void u.fetchNextPage(),children:`Load more`}):null]}):null]}):null,(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[`Check every`,(0,G.jsxs)(U,{value:String(t/60),onValueChange:e=>n({intervalSeconds:Number(e)*60}),children:[(0,G.jsx)(z,{"aria-label":`Tracker poll interval`,className:`w-28`,children:(0,G.jsx)(L,{})}),(0,G.jsx)(V,{children:Lt.map(e=>(0,G.jsxs)(H,{value:String(e),children:[e,` min`]},e))})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Only events after enabling are eligible. Existing backlog is not launched. The workflow agent receives this project’s tracker credentials to carry out your instructions; status updates are not guaranteed by the scheduler.`})]})}function $t({definition:e}){let t=(0,W.useMemo)(()=>_e(e),[e]);return(0,G.jsxs)(A,{flush:!0,"data-slot":`copy-as-cli`,className:`px-3.5 py-3`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[.05em] uppercase text-soft-foreground`,children:`Copy as CLI`}),(0,G.jsxs)(v,{variant:`ghost`,size:`sm`,className:`ml-auto h-6`,onClick:()=>void Oe(t),children:[(0,G.jsx)(Ve,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})]}),(0,G.jsx)(`pre`,{className:`m-0 rounded-lg border border-border bg-card-2 px-2.5 py-2 font-mono text-[11.5px] leading-[1.6] break-words whitespace-pre-wrap text-muted-foreground`,children:t}),(0,G.jsxs)(`p`,{className:`mt-2 mb-0 text-[11.5px] leading-[1.5] text-soft-foreground`,children:[`The same definition the cockpit saves — `,(0,G.jsx)(`code`,{className:`text-[11px]`,children:`cez automation schema`}),` prints its shape.`]})]})}function en({available:e,enabled:t,maxSubtasks:n,reviewChild:r,onChange:i}){if(!e)return null;let a=Rt.includes(n)?Rt:[...Rt,n].sort((e,t)=>e-t);return(0,G.jsxs)(`div`,{"data-slot":`editor-dispatch`,"data-enabled":t?`true`:void 0,title:`Let this run start its own subtasks with cez task create — each in a worktree forked off its branch, reporting back into the parent session.`,className:`flex flex-wrap items-center gap-2.5 border-t border-border pt-3 text-[13px] text-muted-foreground`,children:[(0,G.jsxs)(B,{className:`text-[13px] font-medium text-foreground`,children:[(0,G.jsx)(Ct,{"aria-hidden":`true`,className:E(`size-3.5`,t?`text-violet`:`text-soft-foreground`)}),`Dispatch`,(0,G.jsx)(yt,{"aria-label":`Dispatch`,checked:t,onCheckedChange:e=>i({dispatch:e})})]}),t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`up to`,(0,G.jsxs)(U,{value:String(n),onValueChange:e=>i({maxSubtasks:Number(e)}),children:[(0,G.jsx)(z,{size:`sm`,"aria-label":`Max subtasks`,className:`h-7 px-2 text-[12.5px]`,children:(0,G.jsx)(L,{})}),(0,G.jsx)(V,{children:a.map(e=>(0,G.jsx)(H,{value:String(e),children:e},e))})]}),`subtasks`]}),(0,G.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}),(0,G.jsxs)(B,{className:`text-[13px] font-normal text-muted-foreground`,children:[(0,G.jsx)(yt,{size:`sm`,"aria-label":`Review child`,checked:r,onCheckedChange:e=>i({reviewChild:e})}),`review child`]}),(0,G.jsxs)(`span`,{"data-slot":`editor-dispatch-hint`,className:`ml-auto text-[11.5px] whitespace-nowrap text-soft-foreground`,children:[`≤ `,n+1,` agents`]})]}):null]})}function tn({events:e,intervalSeconds:t,filters:n,onChange:r}){let[i,a]=(0,W.useState)([`authors`,`assignees`,`anyLabels`,`allLabels`,`excludeLabels`,`changedLabels`,`reviewers`].some(e=>n[e].trim().length>0)||n.lookbackDays!==7||n.maxRecords!==25),o=(e,t)=>r({filters:{...n,[e]:t}}),s=t=>{let n=e.includes(t)?e.filter(e=>e!==t):[...e,t];r({events:Mt.filter(e=>n.includes(e))})},c=Xt(e),l=c&&n.changedLabels.trim().length===0;return(0,G.jsxs)(`div`,{"data-slot":`editor-github`,className:`flex flex-col gap-3.5`,children:[(0,G.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-1.5`,children:Mt.map(t=>(0,G.jsx)(M,{active:e.includes(t),"aria-pressed":e.includes(t),className:`font-mono`,onClick:()=>s(t),children:t},t))}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted-foreground`,children:[`poll every`,(0,G.jsxs)(U,{value:String(Math.round(t/60)),onValueChange:e=>r({intervalSeconds:Number(e)*60}),children:[(0,G.jsx)(z,{size:`sm`,"aria-label":`Poll interval`,className:`text-[13px]`,children:(0,G.jsx)(L,{})}),(0,G.jsx)(V,{children:Lt.map(e=>(0,G.jsxs)(H,{value:String(e),children:[e,` min`]},e))})]}),(0,G.jsxs)(`span`,{children:[`· last `,n.lookbackDays,` days · maximum `,n.maxRecords,` records`]})]}),(0,G.jsxs)(Ze,{open:i,onOpenChange:a,children:[(0,G.jsx)(Xe,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex h-6 items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,G.jsx)(Fe,{"aria-hidden":`true`,className:E(`size-3 transition-transform`,i?``:`-rotate-90`)}),`Filters`,l?(0,G.jsx)(`span`,{className:`text-danger`,children:`· changed labels required`}):null]})}),(0,G.jsx)(Ye,{children:(0,G.jsxs)(`div`,{"data-slot":`editor-github-filters`,className:`grid grid-cols-1 gap-3 pt-2 sm:grid-cols-2`,children:[(0,G.jsx)(J,{id:`filter-authors`,label:`Authors`,value:n.authors,onChange:e=>o(`authors`,e)}),(0,G.jsx)(J,{id:`filter-assignees`,label:`Assignees`,value:n.assignees,onChange:e=>o(`assignees`,e)}),(0,G.jsx)(J,{id:`filter-any-labels`,label:`Any of labels`,value:n.anyLabels,onChange:e=>o(`anyLabels`,e)}),(0,G.jsx)(J,{id:`filter-all-labels`,label:`All of labels`,value:n.allLabels,onChange:e=>o(`allLabels`,e)}),(0,G.jsx)(J,{id:`filter-exclude-labels`,label:`Exclude labels`,value:n.excludeLabels,onChange:e=>o(`excludeLabels`,e)}),(0,G.jsx)(J,{id:`filter-changed-labels`,label:c?`Changed labels (required)`:`Changed labels`,value:n.changedLabels,invalid:l,onChange:e=>o(`changedLabels`,e)}),(0,G.jsx)(J,{id:`filter-reviewers`,label:`Reviewers`,value:n.reviewers,onChange:e=>o(`reviewers`,e)}),(0,G.jsx)(nn,{id:`filter-lookback`,label:`Lookback days (1–90)`,value:n.lookbackDays,min:1,max:90,onChange:e=>o(`lookbackDays`,e)}),(0,G.jsx)(nn,{id:`filter-max-records`,label:`Max records (1–100)`,value:n.maxRecords,min:1,max:100,onChange:e=>o(`maxRecords`,e)})]})})]})]})}function J({id:e,label:t,value:n,invalid:r=!1,onChange:i}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(B,{htmlFor:e,className:`text-xs text-muted-foreground`,children:t}),(0,G.jsx)(R,{id:e,value:n,placeholder:`comma-separated`,"aria-invalid":r||void 0,onChange:e=>i(e.target.value),className:`h-8 text-[13px]`})]})}function nn({id:e,label:t,value:n,min:r,max:i,onChange:a}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(B,{htmlFor:e,className:`text-xs text-muted-foreground`,children:t}),(0,G.jsx)(R,{id:e,type:`number`,min:r,max:i,value:n,onChange:e=>a(q(Number(e.target.value),r,i)),className:`h-8 w-28 font-mono text-[13px] tabular-nums`})]})}function rn({source:e,sourcesReady:t,skills:n,skillUsage:r,workflows:i,onSource:a,pick:o,onPick:s,baseBranch:c,autonomous:l,onAutonomous:u}){return(0,G.jsxs)(`div`,{"data-slot":`editor-run-as`,className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(vt,{source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}),(0,G.jsx)(bt,{pick:o,onChange:s,accounts:!0}),(0,G.jsx)(We,{slot:`editor-base-pill`,ariaLabel:`Base branch`,readOnly:!0,hint:`Every run branches off the project's base branch.`,label:(0,G.jsxs)(`span`,{className:`font-mono text-[11.5px]`,children:[`base: `,c??`…`]}),value:c??``,options:[],onPick:()=>void 0}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsxs)(B,{className:`text-[13px] font-medium`,children:[`Autonomous`,(0,G.jsx)(yt,{"aria-label":`Autonomous`,checked:l,onCheckedChange:u})]})]})}function an({className:e,...t}){return(0,G.jsx)(`span`,{"data-slot":`branch-chip`,className:E(`inline-block rounded-md bg-muted px-1.5 py-0.5 font-mono text-[11.5px] leading-[1.3] font-medium whitespace-nowrap text-muted-foreground`,e),...t})}var on=[[`daily`,`Every day`],[`weekdays`,`Weekdays`],[`weekly`,`Weekly`],[`hours`,`Every N hours`]],sn=e=>String(e).padStart(2,`0`);function cn({schedule:e,timeZone:t,onChange:n}){let r=re(e),i=e=>n({...r,...e});return(0,G.jsxs)(`div`,{"data-slot":`editor-schedule`,className:`flex flex-col gap-3.5`,children:[(0,G.jsx)(`div`,{role:`group`,"aria-label":`Schedule type`,className:`flex flex-wrap gap-1.5`,children:on.map(([e,t])=>(0,G.jsx)(M,{active:r.type===e,"aria-pressed":r.type===e,onClick:()=>i({type:e}),children:t},e))}),r.type===`weekly`?(0,G.jsx)(`div`,{role:`group`,"aria-label":`Weekday`,className:`flex flex-wrap gap-1.5`,children:S.map((e,t)=>(0,G.jsx)(M,{active:r.day===t+1,"aria-pressed":r.day===t+1,className:`px-[9px]`,onClick:()=>i({day:t+1}),children:e},e))}):null,r.type===`hours`?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] text-muted-foreground`,children:[`every`,(0,G.jsxs)(U,{value:String(r.every),onValueChange:e=>{let t=Number(e);Zt(t)&&i({every:t})},children:[(0,G.jsx)(z,{size:`sm`,"aria-label":`Every N hours`,className:`text-[13px]`,children:(0,G.jsx)(L,{})}),(0,G.jsx)(V,{children:oe.map(e=>(0,G.jsxs)(H,{value:String(e),children:[e,` h`]},e))})]}),`starting at 00:00`]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] text-muted-foreground`,children:[`at`,(0,G.jsx)(R,{"aria-label":`Hour`,inputMode:`numeric`,value:sn(r.hour),onChange:e=>i({hour:Math.min(23,Math.max(0,Number(e.target.value)||0))}),className:`w-14 text-center font-mono`}),`:`,(0,G.jsx)(R,{"aria-label":`Minute`,inputMode:`numeric`,value:sn(r.minute),onChange:e=>i({minute:Math.min(59,Math.max(0,Number(e.target.value)||0))}),className:`w-14 text-center font-mono`}),(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:t})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 font-mono text-xs text-soft-foreground`,children:[(0,G.jsx)(`span`,{children:`cron`}),(0,G.jsx)(an,{"data-slot":`editor-cron`,children:ce(r)})]})]})}function ln({lastRun:e,onRunNow:t,onLog:n,busy:r=!1,now:i}){return(0,G.jsxs)(A,{flush:!0,"data-slot":`last-run-card`,className:`px-3.5 py-3`,children:[(0,G.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold tracking-[.05em] uppercase text-soft-foreground`,children:`Last run`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,G.jsx)(F,{tone:k(e.status)}),Ae(e.status),(0,G.jsx)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:st(e.ts,i)}),null]}),(0,G.jsxs)(`div`,{className:`mt-2.5 flex gap-1.5`,children:[(0,G.jsxs)(v,{variant:`outline`,size:`sm`,disabled:r,onClick:t,children:[(0,G.jsx)(qe,{"aria-hidden":`true`,className:`size-3`}),`Run now`]}),n?(0,G.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:n,children:[(0,G.jsx)(Ot,{"aria-hidden":`true`,className:`size-3`}),`View log`]}):null]})]})}var un=864e5;function dn({kind:e,schedule:t,intervalSeconds:n,timeZone:r,now:i}){let[a,o]=(0,W.useState)(()=>Date.now());(0,W.useEffect)(()=>{if(i!==void 0)return;let e=setInterval(()=>o(Date.now()),6e4);return()=>clearInterval(e)},[i]);let s=i??a,c=(0,W.useMemo)(()=>e===`schedule`?ae(t,s,s+9*un,r,5):[],[e,t,s,r]);return(0,G.jsxs)(A,{flush:!0,"data-slot":`next-runs-preview`,className:`pt-3 pb-2`,children:[(0,G.jsx)(`div`,{className:`px-3.5 pb-2 text-[11px] font-semibold tracking-[.05em] uppercase text-soft-foreground`,children:e===`schedule`?`Next 5 runs`:`How it polls`}),e===`schedule`?c.length===0?(0,G.jsx)(`p`,{className:`m-0 px-3.5 pb-1.5 text-[12.5px] leading-[1.5] text-muted-foreground`,children:`Nothing in the next nine days.`}):c.map(e=>(0,G.jsxs)(`div`,{"data-slot":`next-run`,className:`flex gap-2.5 px-3.5 py-[5px] text-[13px]`,children:[(0,G.jsx)(`span`,{className:`w-[82px] shrink-0 font-mono text-xs font-medium whitespace-nowrap text-foreground tabular-nums`,children:ke(e,r)}),(0,G.jsx)(`span`,{className:`text-[11.5px] whitespace-nowrap text-soft-foreground`,children:ve(e,s)})]},e)):(0,G.jsx)(`p`,{className:`m-0 px-3.5 pb-1.5 text-[12.5px] leading-[1.5] text-muted-foreground`,children:e===`tracker`?(0,G.jsxs)(G.Fragment,{children:[`Checks the project tracker every `,Math.round(n/60),` min while cezar is open. No webhook or public URL required.`]}):(0,G.jsxs)(G.Fragment,{children:[`Checks GitHub every `,Math.round(n/60),` min while cezar is open, through your `,(0,G.jsx)(`code`,{className:`text-xs`,children:`gh`}),`. No webhook or public URL required.`]})})]})}var fn=[{name:`Nightly dependency bump`,when:`Every day at 04:00`,kind:`schedule`,schedule:{type:`daily`,hour:4,minute:0},prompt:`Run npm outdated, bump patch and minor versions, run the test suite, open a draft PR if anything changed.`},{name:`Triage new issues`,when:`On issue.opened · every 5 min`,kind:`github`,events:[`issue.opened`],intervalSeconds:300,prompt:`Read {{github.url}}. Label it, add a repro or a clarification request. Never close it.`},{name:`Weekly changelog draft`,when:`Fridays at 16:00`,kind:`schedule`,schedule:{type:`weekly`,day:5,hour:16,minute:0},prompt:`Collect merged PRs since last week, write CHANGELOG entries, open a draft PR.`},{name:`Stale PR nudge`,when:`Every 6 hours`,kind:`schedule`,schedule:{type:`hours`,every:6},prompt:`Comment on PRs idle for 48h with what is blocking them.`},{name:`Flaky test hunt`,when:`Tuesdays at 02:00`,kind:`schedule`,schedule:{type:`weekly`,day:2,hour:2,minute:0},prompt:`Run the suite 5×, quarantine intermittent tests, open an issue per test.`,dispatch:{maxSubtasks:8,reviewChild:!0}},{name:`Security advisories`,when:`Every day at 06:00`,kind:`schedule`,schedule:{type:`daily`,hour:6,minute:0},prompt:`Run npm audit; for each high/critical advisory open a task with the upgrade path.`}],pn=e=>[w(),`automation-templates`,e??``];function mn({onPick:e}){let[t,n]=(0,W.useState)(`builtin`),r=ot(),i=d({queryKey:pn(r),queryFn:({signal:e})=>g(r,{signal:e}),enabled:t===`mine`}),a=t===`builtin`?fn.map(e=>({...e,key:e.name})):(i.data?.templates??[]).map(e=>({...Wt(e),key:`${e.project.id}:${e.id}`,when:Me(e),project:e.project.name}));return(0,G.jsxs)(A,{flush:!0,"data-slot":`template-palette`,className:`pb-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-end gap-3 border-b border-border px-4 pt-2.5`,children:[(0,G.jsxs)(`div`,{role:`tablist`,"aria-label":`Template source`,className:`flex shrink-0`,children:[(0,G.jsx)(hn,{active:t===`builtin`,onClick:()=>n(`builtin`),children:`Built-in`}),(0,G.jsx)(hn,{active:t===`mine`,onClick:()=>n(`mine`),children:`From your other projects`})]}),(0,G.jsx)(`span`,{className:`ml-auto min-w-0 overflow-hidden pb-2 text-xs text-ellipsis whitespace-nowrap text-soft-foreground`,children:t===`builtin`?`Ship with cezar`:`Registered in ~/.cezar/config.json`})]}),t===`mine`&&i.isPending?(0,G.jsx)(`p`,{className:`px-4 pt-3 text-xs text-soft-foreground`,children:`Loading…`}):t===`mine`&&i.isError?(0,G.jsx)(`p`,{role:`alert`,className:`px-4 pt-3 text-xs text-danger`,children:i.error.message}):a.length===0?(0,G.jsx)(`p`,{className:`px-4 pt-3 text-xs text-soft-foreground`,children:`No automations in your other projects yet.`}):(0,G.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2.5 px-4 pt-3`,children:a.map(t=>(0,G.jsxs)(`div`,{"data-slot":`template-card`,className:`flex flex-col gap-1.5 rounded-[10px] border border-border bg-card-2 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-semibold`,children:[t.kind===`github`?(0,G.jsx)(ht,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`}):(0,G.jsx)(_t,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,children:t.name}),t.project?(0,G.jsx)(an,{className:`ml-auto`,children:t.project}):null]}),(0,G.jsx)(`div`,{className:`font-mono text-[11.5px] text-muted-foreground`,children:t.when}),(0,G.jsx)(`div`,{className:`line-clamp-2 text-xs leading-[1.45] text-soft-foreground`,children:t.prompt}),(0,G.jsx)(v,{variant:`outline`,size:`sm`,className:`mt-0.5 self-start`,"aria-label":`Use this: ${t.name}`,onClick:()=>e(t),children:`Use this`})]},t.key))})]})}function hn({active:e,onClick:t,children:n}){return(0,G.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e,onClick:t,className:E(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,e?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`),children:n})}function gn(e){let t=e.toLowerCase();return/\b(events?|filters?|schedule|interval|changedlabels|changed labels|lookback|maxrecords)\b/.test(t)?`when`:/\b(prompt|workflow|runner|model|dispatch)\b/.test(t)?`what`:`top`}var _n={tracker:`Implement {{tracker.key}} and prepare a pull request.`,schedule:`Describe the task the agent should do each time. Placeholders: {{date}}, {{project}}`,github:`Describe the task the agent should do for each match. Placeholders: {{github.url}}, {{github.title}}, {{github.number}}, {{github.labels}}`};function vn({data:e,automation:t,actions:n,onBack:i,onSaved:a,onLog:o}){let c=r(),l=N(),d=u(),f=te(),h=_(),g=s(),ee=ne(),[y,x]=(0,W.useState)(()=>t?Ut(t):Vt()),[S,re]=(0,W.useState)(!t),[ie,ae]=(0,W.useState)(!1),[oe,C]=(0,W.useState)(!1),[w,se]=(0,W.useState)(null),[T,E]=(0,W.useState)(!1),ce=(0,W.useRef)(null),D=t?.revision,le=(0,W.useRef)(D);(0,W.useEffect)(()=>{!t||D===le.current||(le.current=D,x(Ut(t)),E(!1),se(null))},[t,D]);let O=e=>x(t=>({...t,...e})),ue=e?.timeZone??`UTC`,de=e?.available!==!1,fe=d.data?.capabilities.dispatch===!0,pe=(0,W.useMemo)(()=>pt(ft(f.data?.promptTemplates),d.data?.capabilities),[f.data?.promptTemplates,d.data?.capabilities]),me=h.data?.workflows??[],ge=me.map(e=>e.name),_e=g.data,ve=f.data?.skillUsage,k=(0,W.useMemo)(()=>ct(_e??[],ve),[_e,ve]),ye=g.data!==void 0&&h.data!==void 0&&!f.isPending,xe=ee.data?.baseBranch??ee.data?.info?.branch??void 0,Se=(0,W.useMemo)(()=>Yt(y),[y]),Ce=y.name.trim().length>0&&y.prompt.trim().length>0&&!oe&&(y.kind!==`tracker`||ie),we=e=>{let t=ce.current,n=t?.selectionStart??y.prompt.length,r=dt(y.prompt,n,e);O({prompt:r.text}),requestAnimationFrame(()=>{t&&(t.focus(),t.setSelectionRange(r.caret,r.caret))})},Te=async()=>{C(!0),se(null),E(!1);try{let e=Jt(y);t?await m(t.id,{...e,enabled:y.enabled,expectedRevision:t.revision}):await b({...e,enable:y.enabled}),await c.invalidateQueries({queryKey:be()}),a()}catch(e){if(t&&e instanceof p&&e.status===409)E(!0);else{let t=e instanceof Error?e.message:String(e);se({message:t,section:e instanceof p&&e.status===400?gn(t):`top`})}}finally{C(!1)}},Ee=()=>void c.invalidateQueries({queryKey:be()}),De=t?`Save changes`:y.enabled?`Save and enable`:`Save paused`;return(0,G.jsxs)(`div`,{"data-route":`automations`,"data-slot":`automation-editor`,className:`flex min-h-full flex-col`,children:[(0,G.jsxs)(`header`,{className:`sticky top-0 z-10 flex min-h-14 shrink-0 flex-wrap items-center gap-3 border-b border-border bg-background px-5 max-md:py-2 md:h-14 md:flex-nowrap`,children:[(0,G.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":`Back`,onClick:i,children:(0,G.jsx)(he,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,G.jsx)(`h1`,{className:`truncate text-base font-semibold`,children:t?`Edit automation`:`New automation`}),t?(0,G.jsx)(I,{dot:t.enabled?`success`:`neutral`,children:t.enabled?`enabled`:`paused`}):null,(0,G.jsx)(`span`,{className:`flex-1`}),t?null:(0,G.jsxs)(v,{variant:`ghost`,size:`sm`,"aria-expanded":S,"aria-label":S?`Hide templates`:`Start from a template`,onClick:()=>re(e=>!e),children:[(0,G.jsx)(wt,{"aria-hidden":`true`,className:`size-3.5`}),(0,G.jsx)(`span`,{className:`max-md:hidden`,children:S?`Hide templates`:`Start from a template`})]}),(0,G.jsx)(v,{variant:`outline`,onClick:i,children:`Cancel`}),(0,G.jsx)(v,{disabled:!Ce,onClick:()=>void Te(),children:De})]}),(0,G.jsx)(`div`,{className:`flex justify-center p-5`,children:(0,G.jsxs)(`div`,{className:`grid w-full max-w-[1080px] grid-cols-1 items-start gap-4 lg:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[T?(0,G.jsxs)(`div`,{role:`alert`,"data-slot":`editor-conflict`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-danger/40 bg-danger/10 px-3.5 py-2.5 text-[13px] text-foreground`,children:[`Edited elsewhere — reload to see the latest version`,(0,G.jsx)(v,{variant:`outline`,size:`sm`,className:`ml-auto`,onClick:Ee,children:`Reload`})]}):null,w?.section===`top`?(0,G.jsx)(bn,{children:w.message}):null,S&&!t?(0,G.jsx)(mn,{onPick:e=>{let t=e.workflow&&ge.includes(e.workflow)?e.workflow:void 0;x(n=>Kt(n,{...e,workflow:t})),re(!1)}}):null,(0,G.jsx)(yn,{title:`Name`,children:(0,G.jsx)(R,{"aria-label":`Name`,placeholder:`Nightly dependency bump`,value:y.name,onChange:e=>O({name:e.target.value}),className:`max-w-[420px] text-[15px] md:text-[15px]`})}),(0,G.jsxs)(yn,{title:`When`,children:[(0,G.jsx)(xn,{value:y.kind,editing:!!t,githubAvailable:de,githubReason:e?.reason,onChange:e=>O({kind:e,...e===`tracker`?{intervalSeconds:1800,enabled:!1}:{}})}),y.kind===`schedule`?(0,G.jsx)(cn,{schedule:y.schedule,timeZone:ue,onChange:e=>O({schedule:e})}):y.kind===`tracker`?(0,G.jsx)(Qt,{trigger:y.trackerTrigger,intervalSeconds:y.intervalSeconds,onChange:O,onValid:ae}):(0,G.jsx)(tn,{events:y.events,intervalSeconds:y.intervalSeconds,filters:y.filters,onChange:e=>O(e)}),w?.section===`when`?(0,G.jsx)(bn,{children:w.message}):null]}),(0,G.jsxs)(yn,{title:`What to run`,children:[(0,G.jsxs)(`div`,{"data-slot":`editor-prompt-templates`,className:`flex flex-wrap items-center gap-1.5 text-xs text-soft-foreground`,children:[(0,G.jsx)(Ge,{"aria-hidden":`true`,className:`size-3`}),`Prompt templates`,pe.map(e=>(0,G.jsx)(M,{className:`h-6 text-[11.5px]`,title:e.text,onClick:()=>we(e.text),children:e.label},e.id)),(0,G.jsx)(M,{dashed:!0,className:`h-6 text-[11.5px]`,icon:(0,G.jsx)(kt,{"aria-hidden":`true`,className:`size-3`}),onClick:()=>l(xt(`project`,`prompt-templates`)),children:`Manage…`})]}),(0,G.jsx)(ut,{ref:ce,"aria-label":`Prompt`,rows:5,placeholder:_n[y.kind],value:y.prompt,onChange:e=>O({prompt:e.target.value}),className:`min-h-[104px] text-sm leading-[1.55] md:text-sm`}),(0,G.jsx)(rn,{source:Ft(y),sourcesReady:ye,skills:k,skillUsage:ve,workflows:me,onSource:e=>O(It(e)),pick:{runner:y.runner,model:y.model,account:y.account},onPick:e=>O({runner:e.runner,model:e.model,account:e.account}),baseBranch:xe,autonomous:y.autonomous,onAutonomous:e=>O({autonomous:e})}),(0,G.jsx)(`p`,{className:`m-0 text-xs leading-[1.5] text-soft-foreground`,children:`Each run is an ordinary cezar task in its own worktree — it queues behind the parallel cap like anything else and never auto-merges.`}),(0,G.jsx)(en,{available:fe,enabled:y.dispatch,maxSubtasks:y.maxSubtasks,reviewChild:y.reviewChild,onChange:e=>O(e)}),w?.section===`what`?(0,G.jsx)(bn,{children:w.message}):null]}),(0,G.jsx)(yn,{title:`Enable`,children:(0,G.jsxs)(B,{className:`text-[13px] font-medium`,children:[(0,G.jsx)(yt,{"aria-label":`Enabled`,checked:y.enabled,onCheckedChange:e=>O({enabled:e})}),`Enabled`,y.kind===`schedule`?null:(0,G.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:`— from a current-time baseline; existing matches will not launch`})]})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 lg:sticky lg:top-[76px]`,children:[(0,G.jsx)(dn,{kind:y.kind,schedule:y.schedule,intervalSeconds:y.intervalSeconds,timeZone:ue}),(0,G.jsx)($t,{definition:Se}),t&&t.kind!==`schedule`&&n?(0,G.jsx)(v,{variant:`outline`,disabled:n.busy,onClick:()=>void n.preview(t),children:`Preview saved matches`}):null,t?.lastRun?(0,G.jsx)(ln,{lastRun:t.lastRun,busy:n?.busy,onRunNow:()=>void n?.runNow(t),onLog:o}):null]})]})})]})}function yn({title:e,children:t}){return(0,G.jsxs)(A,{"data-slot":`editor-section`,className:`gap-0 px-6 py-0`,children:[(0,G.jsx)(`div`,{className:`pt-4 pb-1 text-sm font-semibold`,children:e}),(0,G.jsx)(`div`,{className:`flex flex-col gap-3.5 pt-2.5 pb-5`,children:t})]})}function bn({children:e}){return(0,G.jsx)(`p`,{role:`alert`,className:`m-0 rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-[12.5px] text-danger`,children:e})}function xn({value:e,editing:t,githubAvailable:n,githubReason:r,onChange:i}){let a=`Change the kind by creating a new automation`;return(0,G.jsx)(`div`,{"data-slot":`editor-kind`,role:`group`,"aria-label":`Trigger`,className:`inline-flex flex-wrap gap-0.5 self-start rounded-md bg-muted p-[3px]`,children:[{value:`schedule`,label:`On a schedule`,disabled:t&&e!==`schedule`,...t&&e!==`schedule`?{title:a}:{}},{value:`github`,label:`When GitHub changes`,disabled:!n||t&&e!==`github`,...n?t&&e!==`github`?{title:a}:{}:{title:r??`GitHub is unavailable`}},{value:`tracker`,label:`When Jira / Linear changes`,disabled:t&&e!==`tracker`,...t&&e!==`tracker`?{title:a}:{}}].map(t=>(0,G.jsx)(`button`,{type:`button`,"data-value":t.value,"aria-pressed":t.value===e,disabled:t.disabled,title:t.title,onClick:()=>{t.value!==e&&i(t.value)},className:E(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-[12.5px] font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,t.value===e&&`bg-card font-semibold text-foreground shadow-xs`),children:t.label},t.value))})}function Sn({automationId:e,automation:t,timeZone:n,onBack:i}){let a=N(),o=r(),s=w(),l=(0,W.useMemo)(()=>[s,`automation-log`,e],[s,e]),u=d({queryKey:l,queryFn:({signal:t})=>h(e,{signal:t})}),[f,p]=(0,W.useState)(`all`),[m,g]=(0,W.useState)(`all`);(0,W.useEffect)(()=>D((t,n)=>{t===`automation-change`&&n.automationId===e&&o.invalidateQueries({queryKey:l})}),[e,o,l]);let _=c({mutationFn:e=>y(e),onSuccess:()=>o.invalidateQueries({queryKey:l}),onError:e=>ee(e instanceof Error?e.message:String(e),{tone:`danger`})}),te=n??`UTC`,b=u.data?.records.filter(e=>(f===`all`||e.result===f)&&(m===`all`||e.event===m));return(0,G.jsxs)(`div`,{"data-route":`automations`,"data-slot":`automation-log`,className:`flex min-h-full flex-col`,children:[(0,G.jsxs)(`header`,{className:`sticky top-0 z-10 flex h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5`,children:[(0,G.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":`Back`,onClick:i,children:(0,G.jsx)(he,{className:`size-[15px]`})}),(0,G.jsx)(`h1`,{className:`m-0 text-base font-semibold`,children:t?t.name:`Automation`}),(0,G.jsx)(`span`,{className:`text-[13px] text-muted-foreground`,children:`· execution log`}),(0,G.jsxs)(`div`,{className:`flex flex-1 items-center justify-end gap-2`,children:[(0,G.jsxs)(U,{value:f,onValueChange:e=>p(e),children:[(0,G.jsx)(z,{size:`sm`,"aria-label":`Filter by result`,className:`text-[12.5px]`,children:(0,G.jsx)(L,{placeholder:`All results`})}),(0,G.jsxs)(V,{children:[(0,G.jsx)(H,{value:`all`,children:`All results`}),Cn.map(e=>(0,G.jsx)(H,{value:e,children:e},e))]})]}),(0,G.jsxs)(U,{value:m,onValueChange:e=>g(e),children:[(0,G.jsx)(z,{size:`sm`,"aria-label":`Filter by event`,className:`text-[12.5px]`,children:(0,G.jsx)(L,{placeholder:`All events`})}),(0,G.jsxs)(V,{children:[(0,G.jsx)(H,{value:`all`,children:`All events`}),wn.map(e=>(0,G.jsx)(H,{value:e,children:e},e))]})]})]}),(0,G.jsxs)(v,{variant:`outline`,size:`sm`,onClick:()=>a(`/automations/${encodeURIComponent(e)}`),children:[(0,G.jsx)(me,{className:`size-[13px]`}),`Edit`]})]}),(0,G.jsx)(`div`,{className:`flex justify-center p-5`,children:u.isError?(0,G.jsx)(`div`,{className:`w-full max-w-[820px]`,children:(0,G.jsx)($,{text:u.error instanceof Error?u.error.message:String(u.error)})}):b===void 0?(0,G.jsx)(`div`,{className:`w-full max-w-[820px]`,children:(0,G.jsx)($,{text:`Loading execution log…`})}):b.length===0?(0,G.jsx)(`div`,{className:`w-full max-w-[820px]`,children:(0,G.jsx)($,{text:`No checks have run yet.`})}):(0,G.jsx)(A,{flush:!0,className:`w-full max-w-[820px]`,children:b.map((e,t)=>(0,G.jsx)(En,{record:e,run:e.runId===void 0?void 0:u.data?.runs[e.runId],last:t===b.length-1,timeZone:te,retrying:_.isPending&&_.variables===e.receiptId,onRetry:e=>_.mutate(e)},e.seq))})})]})}var Cn=[`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`manual`,`catch-up`,`skipped`,`failed`],wn=[`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`,`pull_request.reviewed`,`pull_request.review_requested`,`pull_request.rereview_requested`];function Tn(e){return e.result===`failed`&&e.runId===void 0?e.receiptId:void 0}function En({record:e,run:t,last:n,timeZone:r,retrying:i,onRetry:a}){let o=De(e.result),s=t?.children??[],c=Tn(e);return(0,G.jsxs)(`div`,{"data-slot":`log-row`,"data-result":e.result,className:`grid grid-cols-[90px_110px_1fr_auto] items-center gap-x-3 gap-y-2 px-4 py-3 text-[13px] ${n?``:`border-b border-border`}`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs font-medium text-muted-foreground tabular-nums`,children:Ce(e.ts,r)}),(0,G.jsx)(I,{dot:o,className:`w-fit`,children:e.result}),(0,G.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap ${o===`danger`?`text-danger`:`text-muted-foreground`}`,title:e.reason,children:e.reason??``}),null,e.runId===void 0?c===void 0?(0,G.jsx)(`span`,{}):(0,G.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>a(c),children:[(0,G.jsx)(Dt,{className:`size-3`}),`Retry task`]}):(0,G.jsx)(v,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,G.jsxs)(P,{to:`/tasks/${encodeURIComponent(e.runId)}`,children:[`Open task`,(0,G.jsx)(ge,{className:`size-3`})]})}),s.length>0?(0,G.jsx)(`div`,{className:`col-span-full flex flex-col gap-1 pl-3.5`,children:s.map(e=>(0,G.jsxs)(`div`,{"data-slot":`log-child`,className:`grid grid-cols-[14px_70px_1fr_auto] items-center gap-2.5 text-[12.5px]`,children:[(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-soft-foreground`,children:`└`}),(0,G.jsx)(`span`,{className:`w-fit rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:e.kind??`implement`}),(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(F,{tone:k(e.status)}),(0,G.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:e.title})]}),null,(0,G.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-6`,asChild:!0,children:(0,G.jsxs)(P,{to:`/tasks/${encodeURIComponent(e.runId)}`,children:[`Open`,(0,G.jsx)(ge,{className:`size-[11px]`})]})})]},e.runId))}):null]})}function Dn({automation:e,actions:t}){let n=N(),[r,i]=(0,W.useState)(!1),a=e=>e.stopPropagation(),o=`/automations/${encodeURIComponent(e.id)}`;return(0,G.jsxs)(`span`,{"data-slot":`row-actions`,className:`inline-flex gap-0.5`,onClick:a,children:[e.kind===`schedule`?null:(0,G.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:`Preview matches`,"aria-label":`Preview matches`,disabled:t.busy,onClick:()=>void t.preview(e),children:(0,G.jsx)(Ue,{className:`size-[13px]`})}),(0,G.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:`Run now`,"aria-label":`Run now`,disabled:t.busy,onClick:()=>void t.runNow(e),children:(0,G.jsx)(qe,{className:`size-[13px]`})}),(0,G.jsx)(v,{variant:`ghost`,size:`icon-sm`,title:e.enabled?`Pause`:`Enable`,"aria-label":e.enabled?`Pause`:`Enable`,disabled:t.busy,onClick:()=>void t.toggleEnabled(e),children:e.enabled?(0,G.jsx)(Tt,{className:`size-[13px]`}):(0,G.jsx)(Et,{className:`size-[13px]`})}),(0,G.jsxs)(Be,{children:[(0,G.jsx)(Le,{asChild:!0,children:(0,G.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":`More`,children:(0,G.jsx)(St,{className:`size-3.5`})})}),(0,G.jsxs)(Re,{align:`end`,className:`w-[200px]`,onClick:a,children:[(0,G.jsxs)(j,{onSelect:()=>n(o),children:[(0,G.jsx)(me,{}),`Edit`]}),(0,G.jsxs)(j,{onSelect:()=>n(`${o}/log`),children:[(0,G.jsx)(Ot,{}),`View log`]}),(0,G.jsxs)(j,{onSelect:()=>void t.duplicate(e),children:[(0,G.jsx)(Ve,{}),`Duplicate`]}),(0,G.jsxs)(j,{onSelect:()=>void t.copyCli(e),children:[(0,G.jsx)(At,{}),`Copy as CLI`]}),(0,G.jsx)(ze,{}),(0,G.jsxs)(j,{variant:`destructive`,onSelect:()=>i(!0),children:[(0,G.jsx)(He,{}),`Delete`]})]})]}),(0,G.jsx)(at,{open:r,onOpenChange:i,children:(0,G.jsxs)(et,{onClick:a,children:[(0,G.jsxs)(it,{children:[(0,G.jsxs)($e,{children:[`Delete “`,e.name,`”?`]}),(0,G.jsx)(Qe,{children:`The automation is removed for good. Tasks it already launched and its execution log stay.`})]}),(0,G.jsxs)(nt,{children:[(0,G.jsx)(rt,{children:`Cancel`}),(0,G.jsx)(tt,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>void t.remove(e),children:`Delete`})]})]})})]})}var Y=`h-[38px] border-b border-border px-[10px] text-left text-[11px] leading-none font-semibold tracking-[.05em] whitespace-nowrap text-soft-foreground uppercase`,X=`h-12 border-b border-border px-[10px] text-[13px] leading-none whitespace-nowrap`,Z=`cz-auto-wide max-[1280px]:hidden`,On=(0,G.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`});function kn({data:e,actions:t,now:n=Date.now()}){return(0,G.jsx)(A,{flush:!0,"data-slot":`automations-table`,className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full border-collapse [&_tbody_tr:last-child>td]:border-b-0`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:E(Y,`pl-4`),children:`State`}),(0,G.jsx)(`th`,{className:Y,children:`Automation`}),(0,G.jsx)(`th`,{className:Y,children:`Trigger`}),(0,G.jsx)(`th`,{className:E(Y,Z),children:`Runs as`}),(0,G.jsx)(`th`,{className:Y,children:`Next run`}),(0,G.jsx)(`th`,{className:Y,children:`Last run`}),(0,G.jsx)(`th`,{className:E(Y,Z,`text-right`),children:`Runs 7d`}),null,(0,G.jsx)(`th`,{className:E(Y,`pr-4`)})]})}),(0,G.jsx)(`tbody`,{children:e.automations.map(r=>(0,G.jsx)(An,{automation:r,actions:t,timeZone:e.timeZone,available:e.available,showCost:!1,now:n},r.id))})]})})}function An({automation:e,actions:t,timeZone:n,available:r,showCost:i,now:a}){let o=N(),s=e.kind===`github`,c=s&&!r,l=e.task.dispatch,u=Me(e),d=[e.task.workflow,e.task.runner].filter(Boolean);return(0,G.jsxs)(`tr`,{"data-slot":`automation-row`,"data-automation":e.id,"data-enabled":e.enabled?`true`:`false`,className:E(`cursor-pointer hover:bg-muted`,!e.enabled&&`opacity-60`),onClick:()=>o(`/automations/${encodeURIComponent(e.id)}`),children:[(0,G.jsx)(`td`,{className:E(X,`pl-4`),children:c?(0,G.jsx)(I,{dot:`neutral`,children:`paused by capability`}):(0,G.jsx)(I,{dot:e.enabled?`success`:`neutral`,pulse:e.enabled&&s,children:e.enabled?`enabled`:`paused`})}),(0,G.jsx)(`td`,{className:E(X,`max-w-0 min-w-[200px]`),children:(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[s?(0,G.jsx)(ht,{className:`size-3.5 shrink-0 text-soft-foreground`}):e.kind===`tracker`?(0,G.jsx)(Je,{className:`size-3.5 shrink-0 text-soft-foreground`}):(0,G.jsx)(_t,{className:`size-3.5 shrink-0 text-soft-foreground`}),(0,G.jsx)(`span`,{className:`overflow-hidden text-[13px] font-medium text-ellipsis whitespace-nowrap`,children:e.name}),l?(0,G.jsxs)(`span`,{"data-slot":`dispatch-badge`,title:`dispatch · up to ${l.maxSubtasks??1} subtasks`,className:`inline-flex shrink-0 items-center gap-[3px] rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:[(0,G.jsx)(Ct,{className:`size-2.5`}),`×`,l.maxSubtasks??1]}):null]})}),(0,G.jsx)(`td`,{className:E(X,`max-w-[260px] overflow-hidden font-mono text-xs text-ellipsis text-muted-foreground`),title:u,children:u}),(0,G.jsx)(`td`,{className:E(X,Z,`text-xs text-muted-foreground`),children:d.length?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[d.map((e,t)=>(0,G.jsxs)(`span`,{className:`contents`,children:[t>0?(0,G.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}):null,e]},e)),e.task.autonomous?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}),(0,G.jsx)(`span`,{title:`autonomous`,"data-slot":`autonomous-mark`,className:`inline-flex`,children:(0,G.jsx)(Je,{"aria-hidden":`true`,className:`size-[11px] text-soft-foreground`})})]}):null]}):On}),(0,G.jsx)(`td`,{"data-slot":`next-run`,className:E(X,`font-mono text-xs tabular-nums`,e.enabled?`text-foreground`:`text-soft-foreground`),children:jn(e,n,a)}),(0,G.jsx)(`td`,{className:X,children:e.lastRun?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(F,{tone:k(e.lastRun.status)}),(0,G.jsx)(`span`,{className:`text-[12.5px] text-muted-foreground`,children:Ae(e.lastRun.status)}),(0,G.jsx)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:st(e.lastRun.ts,a)}),(0,G.jsxs)(P,{to:`/tasks/${encodeURIComponent(e.lastRun.runId)}`,"data-slot":`task-link`,onClick:e=>e.stopPropagation(),className:`inline-flex items-center gap-0.5 rounded-full border border-violet/40 px-1.5 py-px font-mono text-[10.5px] font-semibold text-violet`,children:[`task`,(0,G.jsx)(ge,{className:`size-[9px]`})]})]}):On}),(0,G.jsx)(`td`,{className:E(X,Z,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:e.runs7d}),i?(0,G.jsx)(`td`,{className:E(X,Z,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:e.costUsd7d===void 0?On:ye(e.costUsd7d)}):null,(0,G.jsx)(`td`,{className:E(X,`pr-3 text-right`),children:(0,G.jsx)(Dn,{automation:e,actions:t})})]})}function jn(e,t,n){if(!e.enabled)return`—`;if(e.kind!==`schedule`)return`continuous`;if(e.nextRunAt)return ke(e.nextRunAt,t)||`—`;let r=e.schedule?ie(e.schedule,n,t):null;return r===null?`—`:ke(r,t)||`—`}function Q(e){return e.hour*60+e.minute}function Mn(e,t,n=0){let r=x(e,t);if(!r)return null;let i=new Date(Date.UTC(r.year,r.month-1,r.day+n));return se(i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate(),0,0,t)}function Nn(e,t,n,r){let i=[];for(let a of e)if(!(a.kind!==`schedule`||!a.schedule))for(let e of ae(a.schedule,t,n,r)){let t=x(e,r);t&&i.push({automation:a,at:e,parts:t})}return i.sort((e,t)=>e.at-t.at)}function Pn(e){let t=new Map;return e.map(e=>{let n=Q(e.parts),r=t.get(n)??0;return t.set(n,r+1),{occurrence:e,stack:r}})}function Fn({automation:e,minute:t,stack:n=0,wide:r=!1}){let i=N(),a=C(Math.floor(t/60),t%60),o=[e.task.workflow,e.task.runner].filter(Boolean).join(` · `);return(0,G.jsxs)(`button`,{type:`button`,"data-slot":`event-block`,"data-automation":e.id,"data-enabled":e.enabled?`true`:`false`,title:`${e.name} · ${a}`,onClick:()=>i(`/automations/${encodeURIComponent(e.id)}`),className:E(`absolute right-[3px] left-[3px] flex cursor-pointer overflow-hidden rounded-[6px] border border-border bg-card text-left text-[11.5px] leading-[1.3] font-medium text-foreground shadow-xs`,r?`h-12 flex-col items-start gap-[3px] px-2 py-[5px]`:`h-6 flex-row items-center gap-1.5 px-1.5`,!e.enabled&&`opacity-50`),style:{top:t/60*34+1+26*n},children:[(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(F,{tone:e.task.runner===`codex`?`violet`:`success`}),(0,G.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:e.name})]}),r?(0,G.jsxs)(`span`,{className:`max-w-full overflow-hidden font-mono text-[10.5px] leading-[1.3] font-normal text-ellipsis whitespace-nowrap text-muted-foreground`,children:[a,o?` · ${o}`:``]}):null]})}function In(){return(0,G.jsx)(`div`,{"data-slot":`hour-gutter`,className:`w-12 shrink-0`,children:Array.from({length:24},(e,t)=>(0,G.jsx)(`div`,{className:`-translate-y-[6px] pr-2 text-right font-mono text-[10.5px] text-soft-foreground`,style:{height:34},children:t?C(t):``},t))})}function Ln({minute:e}){return(0,G.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`now-line`,className:`absolute inset-x-0 z-[2] h-[2px] bg-primary`,style:{top:e/60*34},children:(0,G.jsx)(`span`,{className:`absolute -top-[3px] -left-[3px] size-[8px] rounded-full bg-primary`})})}function Rn(){return(0,G.jsx)(G.Fragment,{children:Array.from({length:24},(e,t)=>(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-x-0 h-px bg-border`,style:{top:t*34}},t))})}function zn({automations:e}){let t=e.filter(e=>e.kind===`github`&&e.enabled);return t.length?(0,G.jsxs)(`div`,{"data-slot":`poll-band`,className:`grid grid-cols-[48px_minmax(0,1fr)] border-b border-border`,children:[(0,G.jsx)(`div`,{className:`py-2 pr-2 text-right font-mono text-[10.5px] text-soft-foreground`,children:`poll`}),(0,G.jsx)(`div`,{className:`flex flex-col gap-1 border-l border-border px-2 py-1.5`,children:t.map(e=>(0,G.jsxs)(`div`,{"data-slot":`poll-row`,className:`flex h-[22px] min-w-0 items-center gap-2 overflow-hidden rounded-[6px] border border-violet/25 bg-violet/8 px-2 text-[11.5px] font-medium`,children:[(0,G.jsx)(ht,{className:`size-3 shrink-0 text-violet`}),(0,G.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:e.name}),(0,G.jsx)(`span`,{className:`overflow-hidden font-mono text-[10.5px] font-normal text-ellipsis whitespace-nowrap text-muted-foreground`,children:Me(e)}),(0,G.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[10.5px] font-normal whitespace-nowrap text-soft-foreground`,children:[e.runs7d,` runs`]})]},e.id))})]}):null}var Bn=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function Vn({data:e}){let t=pe(6e4),n=N(),[r,i]=(0,W.useState)(0),a=e.timeZone,o=Mn(t,a,r),s=Mn(t,a,r+1),c=o===null?null:x(o,a),l=x(t,a);if(o===null||s===null||!c||!l)return(0,G.jsx)(`div`,{"data-slot":`day-view`,className:`p-5`,children:(0,G.jsxs)(`p`,{className:`rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground`,children:[`Cannot draw the day: unknown time zone “`,a,`”.`]})});let u=r===0,d=Pn(Nn(e.automations,o,s,a)),f=e.automations.filter(e=>e.kind===`github`&&e.enabled),p=`${Ee(c.weekday)} ${c.day} ${Bn[c.month-1]??``}`;return(0,G.jsxs)(`div`,{"data-slot":`day-view`,className:`grid grid-cols-[minmax(0,1fr)_320px] items-start gap-4 p-5 max-md:grid-cols-1`,children:[(0,G.jsxs)(A,{flush:!0,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3.5 py-2.5`,children:[(0,G.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":`Previous day`,onClick:()=>i(e=>e-1),children:(0,G.jsx)(Pe,{className:`size-3.5`})}),(0,G.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":`Next day`,onClick:()=>i(e=>e+1),children:(0,G.jsx)(Ie,{className:`size-3.5`})}),(0,G.jsx)(`span`,{"data-slot":`day-title`,className:`text-sm font-semibold whitespace-nowrap`,children:p}),u?(0,G.jsx)(I,{dot:`success`,children:`today`}):null,(0,G.jsxs)(`span`,{className:`ml-auto text-xs whitespace-nowrap text-muted-foreground`,children:[d.length,` scheduled runs`,f.length?` · ${f.length} GitHub poll${f.length===1?``:`s`}`:``]})]}),(0,G.jsx)(zn,{automations:e.automations}),(0,G.jsxs)(`div`,{className:`flex max-h-[600px] overflow-y-auto`,children:[(0,G.jsx)(In,{}),(0,G.jsxs)(`div`,{"data-slot":`day-column`,"data-today":u?`true`:void 0,className:`relative flex-1 border-l border-border`,style:{height:816},children:[(0,G.jsx)(Rn,{}),u?(0,G.jsx)(Ln,{minute:Q(l)}):null,d.map(({occurrence:e,stack:t})=>(0,G.jsx)(Fn,{automation:e.automation,minute:Q(e.parts),stack:t,wide:!0},`${e.automation.id}-${e.at}`))]})]})]}),(0,G.jsxs)(A,{flush:!0,"data-slot":`agenda`,className:`py-3`,children:[(0,G.jsx)(`div`,{className:`px-3.5 pb-2 text-[11px] font-semibold tracking-[.05em] text-soft-foreground uppercase`,children:`Agenda`}),f.map(e=>(0,G.jsxs)(`button`,{type:`button`,"data-slot":`agenda-poll`,onClick:()=>n(`/automations/${encodeURIComponent(e.id)}`),className:`grid w-full cursor-pointer grid-cols-[48px_1fr] gap-2.5 px-3.5 py-2 text-left hover:bg-muted`,children:[(0,G.jsx)(`span`,{className:`font-mono text-[10.5px] font-medium text-soft-foreground`,children:`poll`}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px] font-medium`,children:[(0,G.jsx)(ht,{className:`size-3 shrink-0 text-violet`}),(0,G.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:e.name})]}),(0,G.jsxs)(`span`,{className:`mt-0.5 block overflow-hidden font-mono text-[11.5px] leading-[1.4] text-ellipsis whitespace-nowrap text-soft-foreground`,children:[Me(e),` · continuous`]})]})]},e.id)),d.map(({occurrence:e})=>{let r=e.at<t,{automation:i}=e;return(0,G.jsxs)(`button`,{type:`button`,"data-slot":`agenda-row`,"data-past":r?`true`:`false`,onClick:()=>n(`/automations/${encodeURIComponent(i.id)}`),className:`grid w-full cursor-pointer grid-cols-[48px_1fr] gap-2.5 px-3.5 py-2 text-left hover:bg-muted`,children:[(0,G.jsx)(`span`,{className:E(`font-mono text-xs font-medium tabular-nums`,r?`text-soft-foreground`:`text-foreground`),children:C(e.parts.hour,e.parts.minute)}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsxs)(`span`,{className:E(`flex items-center gap-2 text-[13px] font-medium`,r&&`text-muted-foreground`),children:[(0,G.jsx)(F,{tone:r&&i.lastRun?k(i.lastRun.status):`neutral`}),(0,G.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:i.name})]}),(0,G.jsx)(`span`,{className:`mt-0.5 block overflow-hidden text-[11.5px] leading-[1.4] text-ellipsis whitespace-nowrap text-soft-foreground`,children:i.task.prompt})]})]},`${i.id}-${e.at}`)}),d.length===0?(0,G.jsx)(`p`,{className:`px-3.5 py-2 text-[12.5px] text-soft-foreground`,children:f.length?`Nothing scheduled — the GitHub polls above still run.`:`Nothing scheduled.`}):null]})]})}function Hn(e,t,n,r=12){let i=[];for(let a of e)if(!(!a.enabled||a.kind!==`schedule`||!a.schedule))for(let e of ae(a.schedule,t,t+14*864e5,n,r))i.push({automation:a,at:e});return i.sort((e,t)=>e.at-t.at).slice(0,r)}function Un({open:e,onOpenChange:t,upcoming:n,pollCount:r,timeZone:i,now:a}){let o=N(),s=x(a,i);return(0,G.jsx)(ue,{open:e,onOpenChange:t,children:(0,G.jsxs)(O,{side:`right`,"data-slot":`next-runs-rail`,"aria-describedby":void 0,className:`w-[360px] gap-0 sm:max-w-[360px]`,children:[(0,G.jsxs)(de,{className:`px-4 pt-4 pb-2`,children:[(0,G.jsxs)(fe,{className:`inline-flex items-center gap-2 text-sm`,children:[(0,G.jsx)(Ne,{className:`size-4`}),`Next runs`]}),(0,G.jsx)(le,{className:`sr-only`,children:`Upcoming scheduled runs, soonest first.`})]}),(0,G.jsxs)(`div`,{className:`overflow-y-auto`,children:[n.map((e,n)=>{let r=x(e.at,i),c=r!==null&&s!==null&&r.year===s.year&&r.month===s.month&&r.day===s.day,l=r?`${c?``:`${Ee(r.weekday)} `}${C(r.hour,r.minute)}`:``;return(0,G.jsxs)(`button`,{type:`button`,"data-slot":`next-run-row`,"data-automation":e.automation.id,onClick:()=>{t(!1),o(`/automations/${encodeURIComponent(e.automation.id)}`)},className:`grid w-full cursor-pointer grid-cols-[76px_1fr_auto] items-center gap-2 px-4 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs font-medium whitespace-nowrap text-muted-foreground tabular-nums`,children:l}),(0,G.jsx)(`span`,{className:`overflow-hidden text-[13px] font-medium text-ellipsis whitespace-nowrap`,children:e.automation.name}),(0,G.jsx)(`span`,{className:`text-[11px] whitespace-nowrap text-soft-foreground`,children:ve(e.at,a)})]},`${e.automation.id}-${n}`)}),n.length===0?(0,G.jsx)(`p`,{className:`px-4 py-2 text-[12.5px] text-soft-foreground`,children:`No scheduled runs in the next two weeks.`}):null,(0,G.jsxs)(`div`,{"data-slot":`next-runs-footer`,className:`mt-1.5 flex items-center gap-2 border-t border-border px-3.5 pt-2.5 pb-1 text-xs text-muted-foreground`,children:[(0,G.jsx)(F,{tone:`pending`,pulse:!0}),r,` GitHub polls running continuously`]})]})]})})}function Wn({stats:e,pollCount:t,upcoming:n,timeZone:r,railOpen:i,onOpenRail:a}){let o=n[0];return(0,G.jsxs)(`div`,{"data-slot":`stats-strip`,className:`flex flex-wrap items-center gap-4 text-[12.5px] text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[.05em] text-soft-foreground uppercase`,children:`This week`}),(0,G.jsx)(Gn,{label:`runs`,value:String(e.runs)}),null,(0,G.jsx)(Gn,{label:`failed`,value:String(e.failed),danger:e.failed>0}),(0,G.jsx)(Gn,{label:`agent time`,value:je(e.agentSeconds)}),(0,G.jsxs)(`span`,{"data-slot":`stats-polls`,className:`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(F,{tone:`pending`,pulse:!0}),t,` GitHub polls continuous`]}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsxs)(`span`,{"data-slot":`stats-next`,className:`inline-flex min-w-0 shrink-0 items-center gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_t,{className:`size-[13px] text-soft-foreground`}),`next`,` `,(0,G.jsx)(`b`,{className:`font-mono text-[12.5px] font-medium text-foreground`,children:o?we(o.at,r):`—`}),` `,(0,G.jsx)(`span`,{className:`max-w-[180px] overflow-hidden text-ellipsis`,children:o?.automation.name??``})]}),(0,G.jsxs)(v,{variant:`outline`,size:`sm`,"aria-expanded":i,className:`shrink-0`,onClick:a,children:[(0,G.jsx)(Ne,{className:`size-3.5`}),`Next runs`,(0,G.jsx)(`span`,{className:`font-mono text-[11px] font-medium text-muted-foreground`,children:n.length})]})]})}function Gn({label:e,value:t,danger:n=!1}){return(0,G.jsxs)(`span`,{"data-slot":`stat`,"data-label":e,className:`inline-flex shrink-0 items-baseline gap-[5px] whitespace-nowrap`,children:[(0,G.jsx)(`b`,{className:E(`font-mono text-sm font-semibold tabular-nums`,n?`text-danger`:`text-foreground`),children:t}),e]})}var Kn=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`];function qn({data:e}){let t=pe(6e4),n=e.timeZone,r=x(t,n),i=r?Array.from({length:8},(e,i)=>Mn(t,n,i-(r.weekday-1))):[],a=i[0],o=i[7];if(!r||a==null||o==null)return(0,G.jsx)(`div`,{"data-slot":`week-view`,className:`p-5`,children:(0,G.jsxs)(`p`,{className:`rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground`,children:[`Cannot draw the week: unknown time zone “`,n,`”.`]})});let s=r.weekday-1,c=Nn(e.automations,a,o,n),l=Kn.map((e,t)=>{let r=i[t];return{label:e,dayOfMonth:r==null?null:x(r,n)?.day??null,isToday:t===s,blocks:Pn(c.filter(e=>e.parts.weekday-1===t))}});return(0,G.jsx)(`div`,{"data-slot":`week-view`,className:`p-5`,children:(0,G.jsxs)(A,{flush:!0,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-[48px_repeat(7,minmax(0,1fr))] border-b border-border`,children:[(0,G.jsx)(`div`,{}),l.map(e=>(0,G.jsxs)(`div`,{"data-slot":`week-day-header`,"data-today":e.isToday?`true`:void 0,className:E(`flex items-center gap-2 border-l border-border px-2 py-2.5 text-[11px] font-semibold tracking-[.05em] uppercase`,e.isToday?`text-foreground`:`text-soft-foreground`),children:[e.label,(0,G.jsx)(`span`,{className:E(`rounded-full px-[7px] py-px text-[13px] font-medium tracking-normal normal-case`,e.isToday?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e.dayOfMonth??``})]},e.label))]}),(0,G.jsx)(zn,{automations:e.automations}),(0,G.jsxs)(`div`,{className:`flex max-h-[560px] overflow-y-auto`,children:[(0,G.jsx)(In,{}),l.map(e=>(0,G.jsxs)(`div`,{"data-slot":`week-column`,"data-today":e.isToday?`true`:void 0,className:E(`relative min-w-0 flex-1 border-l border-border`,e.isToday&&`bg-muted/35`),style:{height:816},children:[(0,G.jsx)(Rn,{}),e.isToday?(0,G.jsx)(Ln,{minute:Q(r)}):null,e.blocks.map(({occurrence:e,stack:t})=>(0,G.jsx)(Fn,{automation:e.automation,minute:Q(e.parts),stack:t},`${e.automation.id}-${e.at}`))]},e.label))]})]})})}function Jn(e){return[{value:`list`,label:`List`,...e===void 0?{}:{count:e}},{value:`week`,label:`Week`},{value:`day`,label:`Day`}]}function Yn({data:e,error:t,actions:n,view:r,onViewChange:i}){let[a,o]=(0,W.useState)(!1),s=Date.now(),c=e?Hn(e.automations,s,e.timeZone,12):[],l=e?e.automations.filter(e=>e.kind===`github`&&e.enabled).length:0;return(0,G.jsxs)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col`,children:[(0,G.jsxs)(`header`,{className:`sticky top-0 z-10 flex h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5`,children:[(0,G.jsx)(`h1`,{className:`text-base font-semibold`,children:`Automations`}),(0,G.jsx)(mt,{slot:`automations-view`,label:`View`,value:r,options:Jn(e?.automations.length),onChange:i}),(0,G.jsx)(`div`,{className:`flex-1`}),e?(0,G.jsxs)(`span`,{"data-slot":`automations-status`,className:`inline-flex min-w-0 items-center gap-2 overflow-hidden text-[12.5px] text-ellipsis whitespace-nowrap text-muted-foreground max-[1280px]:hidden`,children:[(0,G.jsx)(F,{tone:e.scheduler.state===`scheduled`?`success`:`neutral`}),e.scheduler.state===`scheduled`?`Scheduler running`:`Scheduler idle`,(0,G.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}),e.available?`GitHub available`:`GitHub unavailable${e.reason?` · ${e.reason}`:``}`,(0,G.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}),(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:e.timeZone})]}):null,(0,G.jsx)(v,{asChild:!0,className:`shrink-0`,children:(0,G.jsxs)(P,{to:`/automations/new`,children:[(0,G.jsx)(gt,{className:`size-[15px]`}),`New automation`]})})]}),t===void 0?e?e.automations.length===0?(0,G.jsx)(lt,{icon:(0,G.jsx)(Je,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,G.jsx)(v,{asChild:!0,children:(0,G.jsxs)(P,{to:`/automations/new`,children:[(0,G.jsx)(gt,{className:`size-[15px]`}),`New automation`]})})}):r===`week`?(0,G.jsx)(qn,{data:e}):r===`day`?(0,G.jsx)(Vn,{data:e}):(0,G.jsxs)(`div`,{"data-slot":`automations-list`,className:`flex flex-col gap-3 p-5`,children:[(0,G.jsx)(Wn,{stats:e.stats,pollCount:l,upcoming:c,timeZone:e.timeZone,railOpen:a,onOpenRail:()=>o(!0)}),(0,G.jsx)(kn,{data:e,actions:n,now:s}),(0,G.jsx)(Un,{open:a,onOpenChange:o,upcoming:c,pollCount:l,timeZone:e.timeZone,now:s})]}):(0,G.jsx)(`div`,{className:`p-5`,children:(0,G.jsx)($,{text:`Loading automations…`})}):(0,G.jsx)(`div`,{className:`p-5`,children:(0,G.jsx)($,{text:t})})]})}function Xn({mode:e=`list`}){let{automationId:t}=l(),n=N(),r=Se(),i=xe(r.known&&!r.off),o=Te(i.data),[s,c]=a(),u=Zn(s.get(`view`));if(!r.known)return(0,G.jsx)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col p-3 md:p-5`,children:(0,G.jsx)($,{text:`Loading automations…`})});if(r.off)return(0,G.jsx)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col p-3 md:p-5`,children:(0,G.jsx)(lt,{icon:(0,G.jsx)(Je,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This cockpit was started with CEZ_AUTOMATIONS=0. Unset it and restart cezar to turn automations on.`,heading:`h2`})});let d=()=>n(`/automations`);if(e===`new`)return(0,G.jsx)(vn,{data:i.data,onBack:d,onSaved:d});if(e===`edit`){let e=i.data?.automations.find(e=>e.id===t);return i.data&&!e?(0,G.jsx)(`div`,{"data-route":`automations`,className:`p-5`,children:(0,G.jsx)($,{text:`Automation not found.`})}):e?(0,G.jsx)(vn,{data:i.data,automation:e,actions:o,onBack:d,onSaved:d,onLog:()=>n(`/automations/${encodeURIComponent(e.id)}/log`)}):(0,G.jsx)(`div`,{"data-route":`automations`,className:`p-5`,children:(0,G.jsx)($,{text:`Loading automation…`})})}if(e===`log`){let e=i.data?.automations.find(e=>e.id===t);return t?(0,G.jsx)(Sn,{automationId:t,automation:e,timeZone:i.data?.timeZone,onBack:d}):(0,G.jsx)(`div`,{"data-route":`automations`,className:`p-5`,children:(0,G.jsx)($,{text:`Automation not found.`})})}return(0,G.jsx)(Yn,{data:i.data,error:i.error?String(i.error instanceof Error?i.error.message:i.error):void 0,actions:o,view:u,onViewChange:e=>c(t=>{let n=new URLSearchParams(t);return e===`list`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})})}function Zn(e){return e===`week`||e===`day`?e:`list`}function $({text:e}){return(0,G.jsx)(`div`,{className:`rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground`,children:e})}export{Xn as AutomationsRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-BXvEm7Ve.js";var n=e(),r={primary:`border-primary/25 bg-primary/15 text-primary`,neutral:`border-border bg-card text-foreground shadow-xs`,danger:`border-danger/20 bg-danger/15 text-danger`};function i({icon:e,tone:i=`neutral`,title:a,subtitle:o,children:c,actions:l,backdrop:u=!1,heading:d=`h1`,className:f}){return(0,n.jsxs)(`div`,{"data-slot":`centered-state`,"data-tone":i,className:t(`relative isolate flex min-h-full flex-1 flex-col items-center justify-center px-6 py-12 text-center`,f),children:[u?(0,n.jsx)(s,{}):null,(0,n.jsxs)(`div`,{className:`flex w-full max-w-md flex-col items-center gap-4`,children:[(0,n.jsx)(`div`,{"data-slot":`centered-state-tile`,className:t(`flex size-[72px] items-center justify-center rounded-[18px] border [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-7`,r[i]),children:e}),(0,n.jsx)(d,{className:`text-2xl font-semibold text-balance text-foreground`,children:a}),o?(0,n.jsx)(`p`,{className:`text-sm text-pretty text-muted-foreground`,children:o}):null,c?(0,n.jsx)(`div`,{className:`w-full pt-2`,children:c}):null,l?(0,n.jsx)(`div`,{className:`flex items-center justify-center gap-3 pt-2`,children:l}):null]})]})}var a=[{top:`6%`,left:`14%`,size:2,tone:`violet`,opacity:.5},{top:`11%`,left:`31%`,size:3,tone:`violet`,opacity:.45},{top:`8%`,left:`52%`,size:2,tone:`pending`,opacity:.4},{top:`15%`,left:`71%`,size:2,tone:`violet`,opacity:.5},{top:`9%`,left:`86%`,size:3,tone:`primary`,opacity:.4},{top:`22%`,left:`8%`,size:2,tone:`pending`,opacity:.4},{top:`27%`,left:`24%`,size:2,tone:`primary`,opacity:.35},{top:`20%`,left:`44%`,size:3,tone:`violet`,opacity:.35},{top:`25%`,left:`62%`,size:2,tone:`violet`,opacity:.4},{top:`30%`,left:`79%`,size:2,tone:`primary`,opacity:.35},{top:`36%`,left:`12%`,size:3,tone:`violet`,opacity:.3},{top:`42%`,left:`35%`,size:2,tone:`pending`,opacity:.28},{top:`47%`,left:`58%`,size:2,tone:`primary`,opacity:.28},{top:`52%`,left:`88%`,size:2,tone:`violet`,opacity:.25},{top:`60%`,left:`29%`,size:3,tone:`violet`,opacity:.22}],o={violet:`bg-violet`,primary:`bg-primary`,pending:`bg-pending`};function s({className:e}){return(0,n.jsx)(`div`,{"data-slot":`twinkle-backdrop`,"aria-hidden":`true`,className:t(`pointer-events-none absolute inset-0 -z-10 overflow-hidden [mask-image:linear-gradient(to_bottom,black_25%,transparent_88%)]`,e),children:a.map((e,r)=>(0,n.jsx)(`span`,{className:t(`absolute rounded-[1px] motion-safe:animate-pulse`,e.size===3?`size-[3px]`:`size-0.5`,o[e.tone]),style:{top:e.top,left:e.left,opacity:e.opacity,animationDuration:`3.5s`,animationDelay:`${r%5*700}ms`}},r))})}export{s as n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./utils-BXvEm7Ve.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./utils-BXvEm7Ve.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./utils-
|
|
1
|
+
import{r as e}from"./utils-BXvEm7Ve.js";var t=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),n=e(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]);export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{T as r,_ as i,g as a,h as o,m as s,p as c,v as l,y as u}from"./toaster-CfRVb8vH.js";var d=e(t(),1),f=n(),p=`Collapsible`,[m,h]=l(p),[g,_]=m(p),v=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:s,...l}=e,[m,h]=o({prop:r,defaultProp:i??!1,onChange:s,caller:p});return(0,f.jsx)(g,{scope:n,disabled:a,contentId:c(),open:m,onOpenToggle:d.useCallback(()=>h(e=>!e),[h]),children:(0,f.jsx)(u.div,{"data-state":w(m),"data-disabled":a?``:void 0,...l,ref:t})})});v.displayName=p;var y=`CollapsibleTrigger`,b=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,a=_(y,n);return(0,f.jsx)(u.button,{type:`button`,"aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open||!1,"data-state":w(a.open),"data-disabled":a.disabled?``:void 0,disabled:a.disabled,...r,ref:t,onClick:i(e.onClick,a.onOpenToggle)})});b.displayName=y;var x=`CollapsibleContent`,S=d.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=_(x,e.__scopeCollapsible);return(0,f.jsx)(s,{present:n||i.open,children:({present:e})=>(0,f.jsx)(C,{...r,ref:t,present:e})})});S.displayName=x;var C=d.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:i,children:o,...s}=e,c=_(x,n),[l,p]=d.useState(i),m=d.useRef(null),h=r(t,m),g=d.useRef(0),v=g.current,y=d.useRef(0),b=y.current,S=c.open||l,C=d.useRef(S),T=d.useRef(void 0);return d.useEffect(()=>{let e=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(e)},[]),a(()=>{let e=m.current;if(e){T.current=T.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();g.current=t.height,y.current=t.width,C.current||(e.style.transitionDuration=T.current.transitionDuration,e.style.animationName=T.current.animationName),p(i)}},[c.open,i]),(0,f.jsx)(u.div,{"data-state":w(c.open),"data-disabled":c.disabled?``:void 0,id:c.contentId,hidden:!S,...s,ref:h,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:S&&o})});function w(e){return e?`open`:`closed`}var T=v;function E({...e}){return(0,f.jsx)(T,{"data-slot":`collapsible`,...e})}function D({...e}){return(0,f.jsx)(b,{"data-slot":`collapsible-trigger`,...e})}function O({...e}){return(0,f.jsx)(S,{"data-slot":`collapsible-content`,...e})}export{O as n,D as r,E as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{p as r,w as i,y as a}from"./toaster-CfRVb8vH.js";import{r as o,t as s}from"./utils-BXvEm7Ve.js";import{a as c,o as l,r as u,t as d}from"./dist-DpiX6WjA.js";import{i as f,o as p,r as m,s as h,t as g}from"./dialog-CiDREdUK.js";var _=o(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),v=e(t(),1),y=1,b=.9,x=.8,ee=.17,S=.1,C=.999,w=.9999,T=.99,E=/[\\\/_+.#"@\[\(\{&]/,D=/[\\\/_+.#"@\[\(\{&]/g,O=/[\s-]/,k=/[\s-]/g;function A(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?y:T;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=A(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=y:E.test(e.charAt(l-1))?(d*=x,p=e.slice(i,l-1).match(D),p&&i>0&&(d*=C**+p.length)):O.test(e.charAt(l-1))?(d*=b,m=e.slice(i,l-1).match(k),m&&i>0&&(d*=C**+m.length)):(d*=ee,i>0&&(d*=C**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=w)),(d<S&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=A(e,t,n,r,l+1,a+2,o),f*S>d&&(d=f*S)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function j(e){return e.toLowerCase().replace(k,` `)}function M(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,A(e,t,j(e),j(t),0,0,{})}var N=`[cmdk-group=""]`,P=`[cmdk-group-items=""]`,te=`[cmdk-group-heading=""]`,F=`[cmdk-item=""]`,I=`${F}:not([aria-disabled="true"])`,L=`cmdk-item-select`,R=`data-value`,ne=(e,t,n)=>M(e,t,n),z=v.createContext(void 0),B=()=>v.useContext(z),V=v.createContext(void 0),H=()=>v.useContext(V),U=v.createContext(void 0),W=v.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),i=X(()=>new Set),o=X(()=>new Map),s=X(()=>new Map),c=X(()=>new Set),l=ue(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:y=!0,...b}=e,x=r(),ee=r(),S=r(),C=v.useRef(null),w=fe();Y(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,T.emit()}},[f]),Y(()=>{w(6,j)},[]);let T=v.useMemo(()=>({subscribe:e=>(c.current.add(e),()=>c.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),O(),w(1,k);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(x))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=M()?.id,T.emit()}),r||w(5,j),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{c.current.forEach(e=>e())}}),[]),E=v.useMemo(()=>({value:(e,t,r)=>{t!==s.current.get(e)?.value&&(s.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{O(),T.emit()}))},item:(e,t)=>(i.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),w(3,()=>{A(),O(),n.current.value||k(),T.emit()}),()=>{s.current.delete(e),i.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{A(),t?.getAttribute(`id`)===e&&k(),T.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{s.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:x,inputId:S,labelId:ee,listInnerRef:C}),[]);function D(e,t){let r=l.current?.filter??ne;return e?r(e,n.current.search,t):0}function O(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=o.current.get(n),i=0;r.forEach(t=>{let n=e.get(t);i=Math.max(n,i)}),t.push([n,i])});let r=C.current;B().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(P);t?t.appendChild(e.parentElement===t?e:e.closest(`${P} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${P} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${N}[${R}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=B().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(R);T.setState(`value`,e||void 0)}function A(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=i.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of i.current){let r=D(s.current.get(t)?.value??``,s.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of o.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(N)?.querySelector(te))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${F}[aria-selected="true"]`)}function B(){return Array.from(C.current?.querySelectorAll(I)||[])}function H(e){let t=B()[e];t&&T.setState(`value`,t.getAttribute(R))}function U(e){var t;let n=M(),r=B(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(R))}function W(e){let t=M()?.closest(N),n;for(;t&&!n;)t=e>0?ce(t,N):le(t,N),n=t?.querySelector(I);n?T.setState(`value`,n.getAttribute(R)):U(e)}let G=()=>H(B().length-1),K=e=>{e.preventDefault(),e.metaKey?G():e.altKey?W(1):U(1)},q=e=>{e.preventDefault(),e.metaKey?H(0):e.altKey?W(-1):U(-1)};return v.createElement(a.div,{ref:t,tabIndex:-1,...b,"cmdk-root":``,onKeyDown:e=>{var t;(t=b.onKeyDown)==null||t.call(b,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:y&&e.ctrlKey&&K(e);break;case`ArrowDown`:K(e);break;case`p`:case`k`:y&&e.ctrlKey&&q(e);break;case`ArrowUp`:q(e);break;case`Home`:e.preventDefault(),H(0);break;case`End`:e.preventDefault(),G();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(L);t.dispatchEvent(e)}}}}},v.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:me},u),Q(e,e=>v.createElement(V.Provider,{value:T},v.createElement(z.Provider,{value:E},e))))}),G=v.forwardRef((e,t)=>{let n=r(),o=v.useRef(null),s=v.useContext(U),c=B(),l=ue(e),u=l.current?.forceMount??s?.forceMount;Y(()=>{if(!u)return c.item(n,s?.id)},[u]);let d=de(n,o,[e.value,e.children,o],e.keywords),f=H(),p=Z(e=>e.value&&e.value===d.current),m=Z(e=>u||c.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);v.useEffect(()=>{let t=o.current;if(!(!t||e.disabled))return t.addEventListener(L,h),()=>t.removeEventListener(L,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:y,onSelect:b,forceMount:x,keywords:ee,...S}=e;return v.createElement(a.div,{ref:i(o,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||c.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),K=v.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:s,...c}=e,l=r(),u=v.useRef(null),d=v.useRef(null),f=r(),p=B(),m=Z(e=>s||p.filter()===!1?!0:!e.search||e.filtered.groups.has(l));Y(()=>p.group(l),[]),de(l,u,[e.value,e.heading,d]);let h=v.useMemo(()=>({id:l,forceMount:s}),[s]);return v.createElement(a.div,{ref:i(u,t),...c,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&v.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),Q(e,e=>v.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},v.createElement(U.Provider,{value:h},e))))}),q=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=v.useRef(null),s=Z(e=>!e.search);return!n&&!s?null:v.createElement(a.div,{ref:i(o,t),...r,"cmdk-separator":``,role:`separator`})}),re=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,o=H(),s=Z(e=>e.search),c=Z(e=>e.selectedItemId),l=B();return v.useEffect(()=>{e.value!=null&&o.setState(`search`,e.value)},[e.value]),v.createElement(a.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:i?e.value:s,onChange:e=>{i||o.setState(`search`,e.target.value),n?.(e.target.value)}})}),ie=v.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...o}=e,s=v.useRef(null),c=v.useRef(null),l=Z(e=>e.selectedItemId),u=B();return v.useEffect(()=>{if(c.current&&s.current){let e=c.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),v.createElement(a.div,{ref:i(s,t),...o,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},Q(e,e=>v.createElement(`div`,{ref:i(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),ae=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return v.createElement(d,{open:n,onOpenChange:r},v.createElement(l,{container:o},v.createElement(c,{"cmdk-overlay":``,className:i}),v.createElement(u,{"aria-label":e.label,"cmdk-dialog":``,className:a},v.createElement(W,{ref:t,...s}))))}),oe=v.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?v.createElement(a.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),se=v.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...o}=e;return v.createElement(a.div,{ref:t,...o,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>v.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(W,{List:ie,Item:G,Input:re,Group:K,Separator:q,Dialog:ae,Empty:oe,Loading:se});function ce(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function le(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ue(e){let t=v.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?v.useEffect:v.useLayoutEffect;function X(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=H(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function de(e,t,n,r=[]){let i=v.useRef(),a=B();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(R,s),i.current=s}),i}var fe=()=>{let[e,t]=v.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function pe(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(pe(t),{ref:t.ref},n(t.props.children)):n(t)}var me={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},$=n();function he({className:e,...t}){return(0,$.jsx)(J,{"data-slot":`command`,className:s(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function ge({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,filter:a,...o}){return(0,$.jsxs)(g,{...o,children:[(0,$.jsxs)(p,{className:`sr-only`,children:[(0,$.jsx)(h,{children:e}),(0,$.jsx)(f,{children:t})]}),(0,$.jsx)(m,{className:s(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,$.jsx)(he,{filter:a,className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function _e({className:e,...t}){return(0,$.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,$.jsx)(_,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(J.Input,{"data-slot":`command-input`,className:s(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function ve({className:e,...t}){return(0,$.jsx)(J.List,{"data-slot":`command-list`,className:s(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function ye({...e}){return(0,$.jsx)(J.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function be({className:e,...t}){return(0,$.jsx)(J.Group,{"data-slot":`command-group`,className:s(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function xe({className:e,...t}){return(0,$.jsx)(J.Separator,{"data-slot":`command-separator`,className:s(`-mx-1 h-px bg-border`,e),...t})}function Se({className:e,...t}){return(0,$.jsx)(J.Item,{"data-slot":`command-item`,className:s(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function Ce({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:s(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}export{_e as a,xe as c,be as i,Ce as l,ge as n,Se as o,ye as r,ve as s,he as t,_ as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-BXvEm7Ve.js";import{t as i}from"./project-router-dCZQu1wQ.js";import{t as a}from"./lib-BQXq3kEf.js";var o=e(t(),1),s=n(),c=41;function l({slot:e,commits:t,className:n}){let i=t.length>150,l=(0,o.useRef)(null),d=(0,o.useRef)(null),[f,p]=(0,o.useState)(0);(0,o.useLayoutEffect)(()=>{if(!i)return;let e=()=>{let e=l.current,t=d.current;!e||!t||p(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[i]);let m=t.map(e=>(0,s.jsx)(u,{commit:e},e.sha));return(0,s.jsx)(`div`,{ref:e=>{l.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":i,className:r(`flex flex-col divide-y divide-border px-2 py-1 md:px-4`,n),children:i?(0,s.jsx)(a,{scrollRef:d,startMargin:f,itemSize:c,children:m}):m})}function u({commit:e}){return(0,s.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_41px] [content-visibility:auto]`,children:(0,s.jsxs)(i,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:`flex min-w-0 items-baseline gap-3 rounded-sm px-2 py-2.5 hover:bg-muted`,children:[(0,s.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),(0,s.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.subject}),(0,s.jsxs)(`span`,{className:`hidden shrink-0 text-[11px] text-soft-foreground sm:inline`,children:[e.author,` · `,e.when]})]})})}export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,An as i,Bi as a,D as o,Li as s,Pi as c,Q as l,Rt as u,Vn as d,Z as f,_n as p,n as m,pn as h,r as g,zr as _}from"./toaster-CfRVb8vH.js";import{t as v}from"./utils-BXvEm7Ve.js";import{t as y}from"./chevron-right-KVZcXiPL.js";import{t as b}from"./search-x-CT0NTqK1.js";import{n as x,r as S,t as C}from"./collapsible-DG_SIWqU.js";import{a as w,c as T,i as E,n as D,o as O,r as k,s as A,t as j}from"./alert-dialog-CnRAuqwb.js";import{c as M,t as N}from"./project-router-dCZQu1wQ.js";import{r as P,t as F}from"./token-metrics-DldVlr6m.js";import{n as I,t as L}from"./pill-CPl6sysj.js";import{t as R}from"./centered-state-3r2Kaar_.js";import{t as z}from"./markdown-DjNR-1p8.js";import{q as B,v as V}from"./index-HS1hr5Sz.js";import{t as H}from"./run-diff-u_roDsAJ.js";var U=e(t(),1),W=n();function G(){let{groupId:e}=c(),t=f(e),n=F(l().data),i=a();if((0,U.useEffect)(()=>{e&&i.invalidateQueries({queryKey:r.groups.detail(e)})},[i,e,(u().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,W.jsx)(V,{});if(t.isError){let e=t.error instanceof d&&t.error.status===404;return(0,W.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(R,{icon:e?(0,W.jsx)(b,{}):(0,W.jsx)(B,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load the variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,W.jsx)(g,{asChild:!0,variant:`outline`,children:(0,W.jsx)(N,{to:`/`,children:`Back to tasks`})})})})}return(0,W.jsx)(K,{groupId:e,variants:t.data.runs,showTokens:n.tokens,showCost:n.cost})}function K({groupId:e,variants:t,showTokens:n,showCost:c}){let l=M(),u=a(),[d,f]=(0,U.useState)(null),p=t.every(e=>h.has(e.status)),g=t[0]?i(t[0]):``,y=s({mutationFn:t=>_(e,t),onSuccess:(t,n)=>{u.invalidateQueries({queryKey:r.runs.all}),u.invalidateQueries({queryKey:r.groups.detail(e)}),l(`/tasks/${t.winner?.id??n}`)},onError:e=>m(e.message,{tone:`danger`})});return(0,W.jsxs)(`div`,{"data-route":`compare`,className:`mx-auto flex w-full max-w-6xl flex-col gap-4 px-4 py-5 md:px-6`,children:[(0,W.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,W.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,W.jsx)(B,{className:`size-5 shrink-0 text-violet`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,title:g,children:g})]}),(0,W.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[t.length,` variants of the same task, each in its own worktree — pick the diff you want to keep. The others are cancelled and archived, their worktrees and branches removed.`]})]}),(0,W.jsx)(`div`,{"data-slot":`compare-columns`,className:v(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,W.jsx)(q,{variant:e,allTerminal:p,pickPending:y.isPending,onPick:()=>f(e),showTokens:n,showCost:c},e.id))}),(0,W.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-2`,children:t.map(e=>(0,W.jsx)(J,{variant:e},e.id))}),(0,W.jsx)(j,{open:d!==null,onOpenChange:e=>!e&&f(null),children:(0,W.jsxs)(E,{children:[(0,W.jsxs)(A,{children:[(0,W.jsxs)(T,{children:[`Pick variant `,d?.variant,`?`]}),(0,W.jsxs)(w,{children:[`Variant `,d?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(k,{children:`Keep comparing`}),(0,W.jsxs)(D,{"data-slot":`confirm-pick`,onClick:()=>{d&&y.mutate(d.id),f(null)},children:[(0,W.jsx)(o,{"aria-hidden":`true`}),`Pick variant `,d?.variant]})]})]})})]})}function q({variant:e,allTerminal:t,pickPending:n,onPick:r,showTokens:i,showCost:a}){let s=P(e),c=p(e.costUsd),l=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,W.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-xs font-semibold text-violet`,children:e.variant}),(0,W.jsx)(L,{dot:s.tone,pulse:s.pulse,children:s.label}),i&&l||a&&c?(0,W.jsxs)(`span`,{"data-slot":`variant-token-metrics`,className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-soft-foreground`,children:[i?(0,W.jsx)(I,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):null,i&&l&&a&&c?(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,a&&c?(0,W.jsx)(`span`,{className:`font-mono tabular-nums`,children:c}):null]}):null]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,W.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,W.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[12.5px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,W.jsx)(z,{children:e.handoffExcerpt})}):(0,W.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,W.jsxs)(g,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:r,children:[(0,W.jsx)(o,{"aria-hidden":`true`}),`Pick this one`]})]})}function J({variant:e}){let[t,n]=(0,U.useState)(!1);return(0,W.jsxs)(C,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,W.jsxs)(S,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,W.jsx)(y,{className:v(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,W.jsx)(x,{children:(0,W.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,W.jsx)(H,{runId:e.id})})})]})}export{G as CompareVariantsRoute};
|