commandmate 0.24.0 → 0.26.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/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +266 -266
- package/.next/app-path-routes-manifest.json +15 -15
- package/.next/build-manifest.json +5 -5
- package/.next/prerender-manifest.json +3 -3
- package/.next/react-loadable-manifest.json +3 -3
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/app/update-check/route.js +1 -1
- package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/conversation/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/current-output/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/tools/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/hooks/agent-event/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/hooks/permission-request/route.js +1 -1
- package/.next/server/app/api/hooks/permission-request/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/metrics/vibe/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/validate-path/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/start-polling/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tasks/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
- package/.next/server/app/chat/page.js +2 -2
- package/.next/server/app/chat/page.js.nft.json +1 -1
- package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login/page.js +2 -2
- package/.next/server/app/login/page.js.nft.json +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
- package/.next/server/app/more/page.js +2 -2
- package/.next/server/app/more/page.js.nft.json +1 -1
- package/.next/server/app/more/page_client-reference-manifest.js +1 -1
- package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/repositories/page.js +2 -2
- package/.next/server/app/repositories/page.js.nft.json +1 -1
- package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
- package/.next/server/app/review/page.js +1 -1
- package/.next/server/app/review/page.js.nft.json +1 -1
- package/.next/server/app/review/page_client-reference-manifest.js +1 -1
- package/.next/server/app/sessions/page.js +1 -1
- package/.next/server/app/sessions/page.js.nft.json +1 -1
- package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/[skillId]/page.js +2 -2
- package/.next/server/app/skills/[skillId]/page.js.nft.json +1 -1
- package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/installed/page.js +2 -2
- package/.next/server/app/skills/installed/page.js.nft.json +1 -1
- package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/page.js +2 -2
- package/.next/server/app/skills/page.js.nft.json +1 -1
- package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/files/[...path]/page.js +2 -2
- package/.next/server/app/worktrees/[id]/files/[...path]/page.js.nft.json +1 -1
- package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/page.js +6 -6
- package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
- package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +15 -15
- package/.next/server/chunks/2119.js +1 -1
- package/.next/server/chunks/2404.js +1 -1
- package/.next/server/chunks/2445.js +1 -1
- package/.next/server/chunks/3241.js +1 -1
- package/.next/server/chunks/3346.js +1 -1
- package/.next/server/chunks/4455.js +1 -1
- package/.next/server/chunks/5164.js +1 -1
- package/.next/server/chunks/5571.js +1 -1
- package/.next/server/chunks/5959.js +4 -4
- package/.next/server/chunks/6130.js +1 -1
- package/.next/server/chunks/6274.js +12 -9
- package/.next/server/chunks/6285.js +1 -1
- package/.next/server/chunks/7458.js +6 -6
- package/.next/server/chunks/848.js +1 -1
- package/.next/server/chunks/8730.js +1 -0
- package/.next/server/chunks/880.js +1 -1
- package/.next/server/chunks/9328.js +1 -1
- package/.next/server/chunks/9373.js +4 -3
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-manifest.json +5 -5
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/2053-dfac2d49227cc942.js +1 -0
- package/.next/static/chunks/3898-ef488bfa804507d9.js +1 -0
- package/.next/static/chunks/5229-35f9acab97a553c5.js +1 -0
- package/.next/static/chunks/{6381-18a6a02a94d00d76.js → 6381-9303430933084b56.js} +1 -1
- package/.next/static/chunks/{9599-d29d2f8eeaf7c249.js → 8649-f551b0010dba4986.js} +1 -1
- package/.next/static/chunks/9263.f2034ec525abcf72.js +1 -0
- package/.next/static/chunks/app/chat/page-439b35c9cb90dbe0.js +1 -0
- package/.next/static/chunks/app/login/page-eefd515d8c37e5ee.js +1 -0
- package/.next/static/chunks/app/more/page-889b7546a8a553dc.js +1 -0
- package/.next/static/chunks/app/page-a8d04ac0e3e4c9fc.js +1 -0
- package/.next/static/chunks/app/repositories/page-f3c4d8839b1ca203.js +1 -0
- package/.next/static/chunks/app/review/page-6dc88649fe88ac16.js +1 -0
- package/.next/static/chunks/app/sessions/page-2c9ed9e969097688.js +1 -0
- package/.next/static/chunks/app/skills/[skillId]/page-19beef6121c4c982.js +1 -0
- package/.next/static/chunks/app/skills/installed/page-d5b9cef6d21fabda.js +1 -0
- package/.next/static/chunks/app/skills/page-06ef637e07dd9377.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/files/[...path]/{page-9ddcb224594f620f.js → page-5fed3984fafcd910.js} +1 -1
- package/.next/static/chunks/app/worktrees/[id]/page-fbdf4621a2911ac1.js +1 -0
- package/.next/static/chunks/{webpack-3534d858912a6c92.js → webpack-9d892a9ff07c289d.js} +1 -1
- package/.next/static/css/e865c4979a41aa03.css +1 -0
- package/.next/trace +12 -12
- package/README.md +96 -45
- package/dist/cli/commands/task.d.ts.map +1 -1
- package/dist/cli/commands/task.js +2 -1
- package/dist/cli/commands/verify.d.ts +14 -0
- package/dist/cli/commands/verify.d.ts.map +1 -1
- package/dist/cli/commands/verify.js +109 -3
- package/dist/cli/commands/wait.d.ts +2 -0
- package/dist/cli/commands/wait.d.ts.map +1 -1
- package/dist/cli/commands/wait.js +184 -4
- package/dist/cli/types/api-responses.d.ts +172 -0
- package/dist/cli/types/api-responses.d.ts.map +1 -1
- package/dist/cli/types/index.d.ts +31 -0
- package/dist/cli/types/index.d.ts.map +1 -1
- package/dist/cli/types/index.js +26 -0
- package/dist/cli/utils/verify-runner.d.ts +36 -1
- package/dist/cli/utils/verify-runner.d.ts.map +1 -1
- package/dist/cli/utils/verify-runner.js +114 -6
- package/dist/server/src/config/activity-bar-config.js +5 -1
- package/dist/server/src/lib/auto-yes-poller.js +40 -4
- package/dist/server/src/lib/auto-yes-state.js +108 -3
- package/dist/server/src/lib/cli-tools/antigravity.js +8 -4
- package/dist/server/src/lib/cli-tools/codex.js +63 -30
- package/dist/server/src/lib/cli-tools/copilot.js +5 -1
- package/dist/server/src/lib/cli-tools/gemini.js +15 -15
- package/dist/server/src/lib/cli-tools/opencode.js +9 -3
- package/dist/server/src/lib/detection/cli-patterns.js +148 -6
- package/dist/server/src/lib/detection/status-detector.js +28 -0
- package/dist/server/src/lib/detection/upstream-faults.js +120 -0
- package/dist/server/src/lib/hooks/permission-decision-service.js +13 -5
- package/dist/server/src/lib/hooks/sources/antigravity/hooks-config.js +18 -11
- package/dist/server/src/lib/hooks/sources/antigravity/source.js +10 -9
- package/dist/server/src/lib/hooks/sources/claude/source.js +5 -2
- package/dist/server/src/lib/hooks/sources/codex/hooks-config.js +26 -18
- package/dist/server/src/lib/hooks/sources/codex/source.js +6 -9
- package/dist/server/src/lib/hooks/sources/copilot/hook-settings.js +22 -12
- package/dist/server/src/lib/hooks/sources/copilot/source.js +1 -1
- package/dist/server/src/lib/hooks/sources/define-source.js +6 -4
- package/dist/server/src/lib/hooks/sources/gemini/settings-generator.js +14 -8
- package/dist/server/src/lib/hooks/sources/gemini/source.js +29 -29
- package/dist/server/src/lib/hooks/sources/index.js +4 -1
- package/dist/server/src/lib/hooks/sources/launch-command.js +61 -0
- package/dist/server/src/lib/hooks/sources/legacy-relay.js +2 -1
- package/dist/server/src/lib/hooks/sources/opencode/source.js +10 -7
- package/dist/server/src/lib/polling/prompt-dedup-state.js +95 -0
- package/dist/server/src/lib/polling/response-checker.js +12 -0
- package/dist/server/src/lib/polling/response-poller-core.js +11 -1
- package/dist/server/src/lib/session/agent-session-lifecycle.js +28 -7
- package/dist/server/src/lib/session/claude-session.js +5 -1
- package/dist/server/src/lib/session/current-output-builder.js +34 -0
- package/dist/server/src/lib/verification/env-snapshot.js +21 -3
- package/dist/server/src/lib/verification/gate-runner.js +258 -7
- package/dist/server/src/lib/verification/machine-lock.js +204 -0
- package/dist/server/src/lib/verification/scope-gate.js +126 -13
- package/dist/server/src/lib/verification/verify-config.js +85 -3
- package/dist/server/src/lib/verification/worktree-index.js +140 -0
- package/package.json +1 -1
- package/.next/server/chunks/3451.js +0 -1
- package/.next/static/chunks/2053-52d3c82014e1cd54.js +0 -1
- package/.next/static/chunks/5229-0610b4e3288e777d.js +0 -1
- package/.next/static/chunks/744-3ad06d8c8ca482fc.js +0 -1
- package/.next/static/chunks/9263.5259f73f89220d64.js +0 -1
- package/.next/static/chunks/app/chat/page-15d13fc024d78f5d.js +0 -1
- package/.next/static/chunks/app/login/page-0247a3fb569bb22b.js +0 -1
- package/.next/static/chunks/app/more/page-b8ba537baeac8d5b.js +0 -1
- package/.next/static/chunks/app/page-afc64708362f31e5.js +0 -1
- package/.next/static/chunks/app/repositories/page-3469dacb6be7842f.js +0 -1
- package/.next/static/chunks/app/review/page-2d9cb7e068f8f35a.js +0 -1
- package/.next/static/chunks/app/sessions/page-7470c2bfd89e0df9.js +0 -1
- package/.next/static/chunks/app/skills/[skillId]/page-5e24481162f7ea78.js +0 -1
- package/.next/static/chunks/app/skills/installed/page-efd2d710a27f9735.js +0 -1
- package/.next/static/chunks/app/skills/page-0498adfc6e48684b.js +0 -1
- package/.next/static/chunks/app/worktrees/[id]/page-e611d30e47989e5d.js +0 -1
- package/.next/static/css/3ac44cfc082d02ad.css +0 -1
- /package/.next/static/{smu4mnL7qMf8w38n9dQJE → hNdNiFes2xLls68SWhAU9}/_buildManifest.js +0 -0
- /package/.next/static/{smu4mnL7qMf8w38n9dQJE → hNdNiFes2xLls68SWhAU9}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9263],{55924:(e,t,r)=>{r.d(t,{K:()=>a});var n=r(95155),l=r(12115);function a(e){let{entries:t,title:r,headerOffset:a=64,root:o=null,className:s=""}=e,[i,d]=(0,l.useState)(null);return((0,l.useRef)(null).current=i,(0,l.useEffect)(()=>{if("undefined"==typeof IntersectionObserver||0===t.length)return;let e=new IntersectionObserver(e=>{let t=function(e){let t=e.filter(e=>e.isIntersecting).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top);return t.length>0?t[0].target.id:null}(e);t&&d(t)},{root:o,rootMargin:"-".concat(a,"px 0px -70% 0px"),threshold:0}),r=[];for(let n of t){let t=document.getElementById(n.id);t&&(e.observe(t),r.push(t))}return()=>{e.disconnect(),r.length=0}},[t,a,o]),0===t.length)?null:(0,n.jsxs)("nav",{"aria-label":r,className:s,children:[(0,n.jsx)("p",{className:"px-3 pb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:r}),(0,n.jsx)("ul",{className:"space-y-0.5 text-sm",children:t.map((e,t)=>{let r=e.id===i;return(0,n.jsx)("li",{children:(0,n.jsx)("a",{href:"#".concat(e.id),onClick:t=>((e,t)=>{e.preventDefault();let r="undefined"!=typeof document?document.getElementById(t):null;r&&r.scrollIntoView({behavior:"smooth",block:"start"}),d(t)})(t,e.id),"aria-current":r?"location":void 0,"data-depth":e.depth,style:{paddingLeft:"".concat((e.depth-1)*12+12,"px")},className:["block truncate rounded py-1 pr-2 transition-colors",r?"bg-accent-50 font-medium text-accent-700":"text-muted-foreground hover:bg-muted hover:text-foreground"].join(" "),title:e.text,children:e.text})},"".concat(e.id,"-").concat(t))})})]})}},79263:(e,t,r)=>{r.r(t),r.d(t,{MarkdownEditor:()=>ee});var n=r(95155),l=r(12115),a=r(47650),o=r(18955),s=r(80003),i=r(52056),d=r(64269),c=r(60322),u=r(94442),f=r(36402),m=r(3005),h=r(72115),v=r(89715),x=r(71847);let p=(0,x.A)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);var g=r(57828);let w=(0,x.A)("list-indent-increase",[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]),b=(0,x.A)("list-indent-decrease",[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]);var k=r(76482),y=r(5917),j=r(75426),E=r(97624),N=r(37354);let C=(0,x.A)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var S=r(65229),M=r(13898);let F=(0,l.memo)(function(e){let{filePath:t,isDirty:r,viewMode:l,onViewModeChange:a,showMobileTabs:s,copied:i,onCopy:d,isMaximized:c,onToggleFullscreen:u,isAutoSaveEnabled:f,onAutoSaveToggle:m,isAutoSaving:h,isSaving:x,onSave:F,onClose:R,hideViewModeToggle:T,hideMaximizeButton:A,onIndent:P,onOutdent:V,tabMovesFocus:z,onToggleTabMovesFocus:I}=e,D=(0,o.c)("worktree"),O=e=>e.preventDefault();return(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,n.jsx)(v.A,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,n.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:t}),r&&(0,n.jsx)("span",{"data-testid":"dirty-indicator",className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-warning-subtle text-warning-foreground flex-shrink-0",children:D("editor.unsaved")})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!s&&!T&&(0,n.jsxs)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1",children:[(0,n.jsx)("button",{"data-testid":"view-mode-split","aria-pressed":"split"===l,onClick:()=>a("split"),className:"p-1.5 rounded ".concat("split"===l?"bg-white dark:bg-input shadow-sm text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:D("editor.splitView"),children:(0,n.jsx)(p,{className:"h-4 w-4"})}),(0,n.jsx)("button",{"data-testid":"view-mode-editor","aria-pressed":"editor"===l,onClick:()=>a("editor"),className:"p-1.5 rounded ".concat("editor"===l?"bg-white dark:bg-input shadow-sm text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:D("editor.editorOnly"),children:(0,n.jsx)(v.A,{className:"h-4 w-4"})}),(0,n.jsx)("button",{"data-testid":"view-mode-preview","aria-pressed":"preview"===l,onClick:()=>a("preview"),className:"p-1.5 rounded ".concat("preview"===l?"bg-white dark:bg-input shadow-sm text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:D("editor.previewOnly"),children:(0,n.jsx)(g.A,{className:"h-4 w-4"})})]}),(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"editor-indent-button",onMouseDown:O,onClick:P,className:"flex min-h-[44px] min-w-[44px] items-center justify-center p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded",title:D("editor.indent"),"aria-label":D("editor.indent"),children:(0,n.jsx)(w,{className:"h-4 w-4"})}),(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"editor-outdent-button",onMouseDown:O,onClick:V,className:"flex min-h-[44px] min-w-[44px] items-center justify-center p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded",title:D("editor.outdent"),"aria-label":D("editor.outdent"),children:(0,n.jsx)(b,{className:"h-4 w-4"})}),(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"editor-tab-focus-toggle",onMouseDown:O,onClick:I,"aria-pressed":z,className:"flex min-h-[44px] min-w-[44px] items-center justify-center p-1.5 hover:bg-muted rounded ".concat(z?"text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),title:D(z?"editor.tabMovesFocusOn":"editor.tabMovesFocusOff"),"aria-label":D(z?"editor.tabMovesFocusOn":"editor.tabMovesFocusOff"),children:(0,n.jsx)(k.A,{className:"h-4 w-4"})}),(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"copy-content-button",onClick:d,className:"p-1.5 hover:bg-muted rounded ".concat(i?"text-success":"text-muted-foreground hover:text-foreground"),title:D("actions.copyContent"),children:i?(0,n.jsx)(y.A,{className:"h-4 w-4"}):(0,n.jsx)(j.A,{className:"h-4 w-4"})}),!A&&(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"maximize-button",onClick:u,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded",title:D(c?"editor.exitFullscreen":"editor.enterFullscreen"),"aria-pressed":c,children:c?(0,n.jsx)(E.A,{className:"h-4 w-4"}):(0,n.jsx)(N.A,{className:"h-4 w-4"})}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:D("editor.auto")}),(0,n.jsx)("button",{"data-testid":"auto-save-toggle",role:"switch","aria-checked":f,onClick:()=>m(!f),className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors ".concat(f?"bg-accent-600":"bg-input"),children:(0,n.jsx)("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ".concat(f?"translate-x-4":"translate-x-0.5")})})]}),f?(0,n.jsx)("span",{"data-testid":"auto-save-indicator",className:"text-sm text-muted-foreground",children:h?D("actions.saving"):r?"":D("actions.saved")}):(0,n.jsxs)(M.$n,{variant:"ghost","data-testid":"save-button",onClick:F,disabled:!r||x,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ".concat(r&&!x?"bg-accent-600 text-white hover:bg-accent-700":"bg-muted text-muted-foreground cursor-not-allowed"),children:[(0,n.jsx)(C,{className:"h-4 w-4"}),D(x?"actions.saving":"actions.save")]}),R&&(0,n.jsx)(M.$n,{variant:"ghost","data-testid":"close-button",onClick:R,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded",title:D("actions.close"),children:(0,n.jsx)(S.A,{className:"h-4 w-4"})})]})]})});var R=r(24027),T=r(55924),A=r(79962),P=r(38218);let V=l.useLayoutEffect;function z(){if("undefined"==typeof document)return null;let e=document;return e.fullscreenElement||e.webkitFullscreenElement||e.mozFullScreenElement||e.msFullscreenElement||null}var I=r(2317),D=r(60850),O=r(8269),L=r(51434),K=r(59854),$=r(9900);function H(e,t){return e.lastIndexOf("\n",t-1)+1}function W(e,t,r){let n=r>t&&r>0&&"\n"===e[r-1]?r-1:r;return{start:H(e,t),end:function(e,t){let r=e.indexOf("\n",t);return -1===r?e.length:r}(e,n)}}function _(e,t,r,n,l,a){return{replaceStart:t,replaceEnd:r,replacement:n,selectionStart:l,selectionEnd:a,value:e.slice(0,t)+n+e.slice(r)}}function q(e,t,r,n){if(!(r>t&&e.slice(t,r).includes("\n"))){let l=t-H(e,t),a=n.length-l%n.length,o=" ".repeat(a),s=t+o.length;return _(e,t,r,o,s,s)}let{start:l,end:a}=W(e,t,r),o=e.slice(l,a).split("\n").map(e=>""===e||"\r"===e?e:n+e).join("\n");return _(e,l,a,o,l,l+o.length)}function B(e,t,r,n){let{start:l,end:a}=W(e,t,r),o=e.slice(l,a),s=o.split("\n").map(e=>(function(e,t){if(e.startsWith(" "))return e.slice(1);let r=0;for(;r<t.length&&" "===e[r];)r+=1;return e.slice(r)})(e,n)).join("\n");if(s===o)return t===r?null:_(e,l,a,s,t,r);if(t===r){let r=Math.min(o.length-s.length,Math.max(0,t-l)),n=t-r;return _(e,l,a,s,n,n)}return _(e,l,a,s,l,l+s.length)}let G={split:{showEditor:!0,showPreview:!0,editorWidth:"w-1/2",previewWidth:"w-1/2"},editor:{showEditor:!0,showPreview:!1,editorWidth:"w-full",previewWidth:"w-0"},preview:{showEditor:!1,showPreview:!0,editorWidth:"w-0",previewWidth:"w-full"}},U="commandmate:md-editor-view-mode",J={WARNING_THRESHOLD:512e3};function X(e){return"number"==typeof e&&e>=.1&&e<=.9}function Y(e){return"boolean"==typeof e}function Z(e){return"split"===e||"editor"===e||"preview"===e}let Q=(0,l.memo)(function(e){let{previewContent:t,onOpenFile:r,filePath:a,worktreeId:o,tocVisible:i,onToggleTocVisible:d,tocTitle:c,tocShowLabel:u,tocHideLabel:f}=e,m=(0,l.useRef)(null),h=(0,l.useRef)(null),[v,x]=(0,l.useState)(null),[p,g]=(0,l.useState)(!1);(0,l.useEffect)(()=>{x(h.current)},[]),(0,l.useEffect)(()=>{let e=m.current;if(!e||"undefined"==typeof ResizeObserver)return;let t=new ResizeObserver(e=>{var t,r;g((null!=(r=null==(t=e[0])?void 0:t.contentRect.width)?r:0)>=480)});return t.observe(e),()=>t.disconnect()},[]);let w=(0,l.useMemo)(()=>(0,A.K)(t),[t]),b=w.length>=2&&p,k=b&&i;return(0,n.jsxs)("div",{ref:m,className:"relative flex flex-1 overflow-hidden",children:[(0,n.jsx)("div",{ref:h,"data-testid":"markdown-preview",className:"flex-1 min-w-0 p-4 overflow-y-auto prose prose-sm dark:prose-invert max-w-none prose-headings:scroll-mt-2",children:(0,n.jsx)(R.G8,{content:t,onOpenFile:r,currentFilePath:a,worktreeId:o})}),k&&(0,n.jsx)("aside",{"data-testid":"markdown-preview-toc",className:"w-48 flex-shrink-0 overflow-y-auto border-l border-border py-4",children:(0,n.jsx)("div",{className:"sticky top-0",children:(0,n.jsx)(T.K,{entries:w,title:c,headerOffset:0,root:v})})}),b&&(0,n.jsx)("button",{"data-testid":"markdown-preview-toc-toggle",onClick:d,"aria-pressed":i,"aria-label":i?f:u,title:i?f:u,className:"absolute top-2 right-2 z-10 flex items-center justify-center rounded-md border border-border bg-surface/90 p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted shadow-sm",children:(0,n.jsx)(s.A,{className:"h-4 w-4"})})]})}),ee=(0,l.memo)(function(e){let{worktreeId:t,filePath:r,fileType:s,onClose:v,onSave:x,initialViewMode:p,onMaximizedChange:g,onDirtyChange:w,onOpenFile:b,initialContent:k,embedded:y=!1,onContentChange:j}=e,E="text"===(null!=s?s:r.toLowerCase().endsWith(".md")?"markdown":"text"),N=(0,o.c)("worktree"),C=(0,f.SC)(),S=void 0!==k,M=null!=k?k:"",[T,H]=(0,l.useState)(M),[W,_]=(0,l.useState)(M),[ee,et]=(0,l.useState)(M),[er,en]=(0,l.useState)(()=>E||y?"editor":function(e){if(e&&Z(e))return e;{let e=localStorage.getItem(U);if(e&&Z(e))return e}return"split"}(p)),[el,ea]=(0,l.useState)(!S),[eo,es]=(0,l.useState)(!1),[ei,ed]=(0,l.useState)(null),[ec,eu]=(0,l.useState)(()=>S&&new Blob([M]).size>J.WARNING_THRESHOLD),[ef,em]=(0,l.useState)(!1),[eh,ev]=(0,l.useState)("editor"),[ex,ep]=(0,l.useState)(null),{showToast:eg}=(0,u.dj)(),ew=(0,l.useRef)(null),eb=(0,l.useRef)(null),ek=(0,l.useRef)(null),ey=(0,l.useRef)(null),ej=(0,l.useRef)(null),eE=(0,l.useRef)(null),eN=(0,P.a)(),eC=function(){let[e,t]=(0,l.useState)(!1);return V(()=>{let e=window.matchMedia("(orientation: portrait)");t(e.matches);let r=e=>{t(e.matches)};return e.addEventListener("change",r),()=>e.removeEventListener("change",r)},[]),e}();(0,l.useEffect)(()=>{eN&&ev("preview")},[eN]);let{isKeyboardVisible:eS,keyboardHeight:eM}=(0,L.C)(),{value:eF,setValue:eR}=(0,I.V)({key:"commandmate:md-editor-maximized",defaultValue:!1,validate:Y}),{isFullscreen:eT,isFallbackMode:eA,enterFullscreen:eP,exitFullscreen:eV,toggleFullscreen:ez}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elementRef:t,onEnter:r,onExit:n,onError:a}=e,[o,s]=(0,l.useState)(!1),[i,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),f=(0,l.useCallback)(()=>{let e=null!=z();s(e),!e&&i&&d(!1)},[i]),m=(0,l.useCallback)(async()=>{if(u(null),"undefined"!=typeof navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1||0)){s(!0),d(!0),null==r||r();return}if(function(){if("undefined"==typeof document)return!1;let e=document;return!!(e.fullscreenEnabled||e.webkitFullscreenEnabled||e.mozFullScreenEnabled||e.msFullscreenEnabled)}()&&(null==t?void 0:t.current))try{var e;await ((e=t.current).requestFullscreen?Promise.resolve(e.requestFullscreen()):e.webkitRequestFullscreen?Promise.resolve(e.webkitRequestFullscreen()):e.mozRequestFullScreen?Promise.resolve(e.mozRequestFullScreen()):e.msRequestFullscreen?Promise.resolve(e.msRequestFullscreen()):Promise.reject(Error("Fullscreen API not supported"))),s(!0),d(!1),null==r||r()}catch(t){let e=t instanceof Error?t.message:"Failed to enter fullscreen";u(e),null==a||a(t instanceof Error?t:Error(e)),s(!0),d(!0),null==r||r()}else s(!0),d(!0),null==r||r()},[t,r,a]),h=(0,l.useCallback)(async()=>{if(u(null),i){s(!1),d(!1),null==n||n();return}if(z())try{await function(){if("undefined"==typeof document)return Promise.resolve();let e=document;return e.exitFullscreen?Promise.resolve(e.exitFullscreen()):e.webkitExitFullscreen?Promise.resolve(e.webkitExitFullscreen()):e.mozCancelFullScreen?Promise.resolve(e.mozCancelFullScreen()):e.msExitFullscreen?Promise.resolve(e.msExitFullscreen()):Promise.resolve()}(),s(!1),null==n||n()}catch(t){let e=t instanceof Error?t.message:"Failed to exit fullscreen";u(e),null==a||a(t instanceof Error?t:Error(e)),s(!1),d(!1),null==n||n()}else s(!1),d(!1),null==n||n()},[i,n,a]),v=(0,l.useCallback)(async()=>{o?await h():await m()},[o,m,h]);return(0,l.useEffect)(()=>(function(e){if("undefined"==typeof document)return()=>{};let t=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];for(let r of t)document.addEventListener(r,e);return()=>{for(let r of t)document.removeEventListener(r,e)}})(f),[f]),{isFullscreen:o,isFallbackMode:i,enterFullscreen:m,exitFullscreen:h,toggleFullscreen:v,error:c}}({elementRef:ey,onEnter:()=>eR(!0),onExit:()=>eR(!1)}),{value:eI,setValue:eD}=(0,I.V)({key:"commandmate:md-editor-split-ratio",defaultValue:.5,validate:X}),{value:eO,setValue:eL}=(0,I.V)({key:"commandmate:md-editor-auto-save",defaultValue:!1,validate:Y}),{value:eK,setValue:e$}=(0,I.V)({key:"commandmate:md-editor-tab-moves-focus",defaultValue:!1,validate:Y}),{value:eH,setValue:eW}=(0,I.V)({key:A.Y,defaultValue:!0,validate:Y}),e_=(0,l.useCallback)(()=>{eW(e=>!e)},[eW]),{ref:eq}=(0,O.hU)({onSwipeDown:()=>{eT&&eV()},threshold:150,enabled:eT&&eN}),eB=T!==W,eG=E?G.editor:G[er];(0,l.useEffect)(()=>{null==w||w(eB)},[eB,w]);let eU=!E&&eN&&eC&&"split"===er,eJ=(0,l.useMemo)(()=>(0,d.sg)(e=>{et(e)},300),[]),eX=(0,l.useCallback)(async()=>{ea(!0),ed(null);try{let n=await fetch("/api/worktrees/".concat(t,"/files/").concat(r)),l=await n.json();if(!n.ok||!l.success){var e;throw Error((null==(e=l.error)?void 0:e.message)||N("editor.loadError"))}let a=l.content||"";H(a),_(a),et(a),new Blob([a]).size>J.WARNING_THRESHOLD&&eu(!0)}catch(e){ed(e instanceof Error?e.message:N("editor.loadError"))}finally{ea(!1)}},[t,r]),eY=(0,l.useCallback)(async e=>{let n=await fetch("/api/worktrees/".concat(t,"/files/").concat(r),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})});if(401===n.status||n.redirected)throw Error(N("editor.sessionExpired"));let l=await n.json();if(!n.ok||!l.success){var a;throw Error((null==(a=l.error)?void 0:a.message)||N("editor.saveError"))}_(e)},[t,r,N]),{isSaving:eZ,error:eQ,saveNow:e0}=(0,D.U)({value:T,saveFn:eY,debounceMs:3e3,disabled:!eO}),e1=(0,l.useCallback)(e=>{eL(e),e&&eB&&eY(T)},[eL,eB,eY,T]),e2=(0,l.useCallback)(async()=>{if(eB&&!eo){es(!0);try{await eY(T),eg(N("editor.saveSuccess"),"success"),x&&x(r,T)}catch(e){eg(e instanceof Error?e.message:N("editor.saveError"),"error")}finally{es(!1)}}},[eY,T,eB,eo,x,r,eg,N]),e4=T.split("\n").length,e5=(0,l.useCallback)(()=>{ew.current&&eb.current&&(eb.current.scrollTop=ew.current.scrollTop)},[]),e3=(0,l.useCallback)(e=>{let t=e.target.value;H(t),eJ(t),null==j||j(t)},[eJ,j]),e8=(0,l.useCallback)(e=>{en(e),localStorage.setItem(U,e)},[]),e7=(0,l.useCallback)(async()=>{if(eO){if((eB||eZ)&&(await e0(),eQ)&&!await C({description:N("editor.saveFailedCloseConfirm"),variant:"danger"}))return}else if(eB&&!await C({description:N("editor.unsavedCloseConfirm"),variant:"danger"}))return;null==v||v()},[eO,eB,eZ,e0,eQ,v,C,N]),e9=(0,l.useCallback)(async()=>{try{await (0,c.l)(T),em(!0),setTimeout(()=>em(!1),$.pX)}catch(e){}},[T]),e6=(0,l.useCallback)(e=>{if(!ej.current)return;let t=ej.current.offsetWidth;if(0===t)return;let r=e/t;eD(e=>Math.max(.1,Math.min(.9,e+r)))},[eD]),te=(0,l.useCallback)(()=>{eD(.5)},[eD]),tt=(0,l.useCallback)(e=>{if(e.target!==ew.current||e.currentTarget===e.target){if((e.ctrlKey||e.metaKey)&&"s"===e.key){e.preventDefault(),eO?(async()=>{await e0(),null==x||x(r,T)})():e2();return}if((e.ctrlKey||e.metaKey)&&e.shiftKey&&"F"===e.key){e.preventDefault(),ez();return}if("Escape"===e.key&&eT){e.preventDefault(),eV();return}}},[e2,eO,e0,x,r,T,ez,eV,eT]),tr=(0,l.useCallback)(e=>{let t=ew.current;if(!t)return;if(e.value===t.value)return void t.setSelectionRange(e.selectionStart,e.selectionEnd);t.focus(),t.setSelectionRange(e.replaceStart,e.replaceEnd);let r=!1;try{r="function"==typeof document.execCommand&&document.execCommand("insertText",!1,e.replacement)}catch(e){r=!1}if(r)return void t.setSelectionRange(e.selectionStart,e.selectionEnd);eE.current={start:e.selectionStart,end:e.selectionEnd},H(e.value),eJ(e.value),null==j||j(e.value)},[eJ,j]),tn=(0,l.useCallback)(()=>{let e=ew.current;e&&tr(q(e.value,e.selectionStart,e.selectionEnd," "))},[tr]),tl=(0,l.useCallback)(()=>{let e=ew.current;if(!e)return;let t=B(e.value,e.selectionStart,e.selectionEnd," ");t&&tr(t)},[tr]),ta=(0,l.useCallback)(()=>{e$(e=>!e)},[e$]),to=(0,l.useCallback)(e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&("m"===e.key||"M"===e.key)){e.preventDefault(),ta();return}if("Tab"===e.key&&!eK&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=e.currentTarget,r=e.shiftKey?B(t.value,t.selectionStart,t.selectionEnd," "):q(t.value,t.selectionStart,t.selectionEnd," ");r&&(e.preventDefault(),tr(r));return}tt(e)},[eK,ta,tr,tt]);(0,l.useEffect)(()=>{let e=eE.current;if(!e)return;eE.current=null;let t=ew.current;t&&(t.focus(),t.setSelectionRange(e.start,e.end))},[T]);let ts=(0,l.useCallback)(e=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{ref:eb,className:"flex-shrink-0 py-4 pl-2 pr-2 text-right select-none text-muted-foreground font-mono text-sm bg-muted dark:bg-muted/50 border-r border-border overflow-hidden","aria-hidden":"true",children:Array.from({length:e4},(e,t)=>(0,n.jsx)("div",{className:"leading-[1.5rem]",children:t+1},t+1))}),(0,n.jsx)("textarea",{ref:ew,"data-testid":"markdown-editor-textarea",value:T,onChange:e3,onKeyDown:to,onScroll:e5,className:"flex-1 py-4 pr-4 pl-3 font-mono text-sm resize-none bg-surface text-foreground focus:outline-none leading-[1.5rem]".concat(e?" focus:ring-2 focus:ring-ring focus:ring-inset":""),placeholder:E?N("editor.placeholder"):N("editor.placeholderMarkdown"),spellCheck:!1})]}),[e4,T,e3,to,e5,E,N]);(0,l.useEffect)(()=>{let e=e=>{"Escape"===e.key&&eT&&(e.preventDefault(),eV())};return eT&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[eT,eV]),(0,l.useEffect)(()=>{y||eF&&!eT&&eP()},[]),(0,l.useEffect)(()=>{if("undefined"==typeof document)return;let e=document.getElementById("markdown-editor-portal");return e||((e=document.createElement("div")).id="markdown-editor-portal",document.body.appendChild(e)),ep(e),()=>{let e=document.getElementById("markdown-editor-portal");e&&0===e.childNodes.length&&e.remove()}},[]),(0,l.useEffect)(()=>{null==g||g(eT)},[eT,g]),(0,l.useEffect)(()=>{S||eX()},[eX,S]),(0,l.useEffect)(()=>{let e=eO?eB||eZ:eB,t=t=>{e&&(t.preventDefault(),t.returnValue="")};return e?(ek.current=t,window.addEventListener("beforeunload",t)):ek.current&&(window.removeEventListener("beforeunload",ek.current),ek.current=null),()=>{ek.current&&window.removeEventListener("beforeunload",ek.current)}},[eB,eZ,eO]),(0,l.useEffect)(()=>{eQ&&eO&&(eL(!1),eg(N("editor.autoSaveFailed"),"error"))},[eQ,eO,eL,eg,N]);let ti=(0,l.useMemo)(()=>{let e="flex flex-col bg-surface";return eT&&eA?"".concat(e," fixed inset-0"):"".concat(e," h-full")},[eT,eA]),td=(0,l.useMemo)(()=>{if(eT)return{zIndex:K.M.MAXIMIZED_EDITOR}},[eT]),tc=(0,l.useMemo)(()=>{if("split"===er&&!eU)return{width:"".concat(100*eI,"%"),flexShrink:0}},[er,eI,eU]),tu=(0,l.useMemo)(()=>{if("split"===er&&!eU)return{width:"".concat((1-eI)*100,"%"),flexShrink:0}},[er,eI,eU]),tf=(0,l.useMemo)(()=>{if(eS&&eM>0)return{paddingBottom:eM}},[eS,eM]);if(el)return(0,n.jsx)("div",{"data-testid":"markdown-editor",className:"flex items-center justify-center h-full bg-surface",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)(m.y,{size:"xl",variant:"accent",className:"inline-block"}),(0,n.jsx)("p",{className:"mt-4 text-muted-foreground",children:N("editor.loading")})]})});if(ei)return(0,n.jsx)("div",{"data-testid":"markdown-editor-error",className:"flex items-center justify-center h-full bg-surface",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)(i.A,{className:"h-12 w-12 text-danger mx-auto mb-4"}),(0,n.jsx)("p",{className:"text-danger-foreground",children:ei}),v&&(0,n.jsx)("button",{onClick:v,className:"mt-4 px-4 py-2 bg-muted hover:bg-muted/80 rounded-lg text-foreground",children:N("actions.close")})]})});let tm=(0,n.jsxs)("div",{ref:e=>{ey.current=e,eq.current=e},"data-testid":"markdown-editor",className:ti,style:td,onKeyDown:tt,role:eT&&eA?"dialog":void 0,"aria-modal":eT&&eA?"true":void 0,children:[(0,n.jsx)(F,{filePath:r,isDirty:eB,viewMode:er,onViewModeChange:e8,showMobileTabs:eU,copied:ef,onCopy:e9,isMaximized:eT,onToggleFullscreen:ez,isAutoSaveEnabled:eO,onAutoSaveToggle:e1,isAutoSaving:eZ,isSaving:eo,onSave:e2,onClose:v?e7:void 0,hideViewModeToggle:E||y,hideMaximizeButton:y,onIndent:tn,onOutdent:tl,tabMovesFocus:eK,onToggleTabMovesFocus:ta}),eT&&(0,n.jsx)(R.OJ,{isMobile:eN}),ec&&(0,n.jsx)(R.Uc,{onDismiss:()=>eu(!1)}),eU&&(0,n.jsx)(R.RF,{mobileTab:eh,onTabChange:ev}),(0,n.jsxs)("div",{ref:ej,className:"flex flex-1 overflow-hidden",style:tf,children:[eU?"editor"===eh&&(0,n.jsx)("div",{"data-testid":"markdown-editor-container",className:"flex overflow-hidden w-full flex-1",children:ts(!1)}):(0,n.jsx)("div",{"data-testid":"markdown-editor-container",className:"flex overflow-hidden transition-all duration-200 ".concat(eG.showEditor?"":"hidden"),style:"split"===er?tc:{width:eG.showEditor?"100%":"0%"},children:ts(!0)}),"split"===er&&eG.showEditor&&eG.showPreview&&!eU&&(0,n.jsx)(h.f,{onResize:e6,onDoubleClick:te,orientation:"horizontal",ariaValueNow:Math.round(100*eI),minRatio:.1}),eU?"preview"===eh&&(0,n.jsx)("div",{"data-testid":"markdown-preview-container",className:"flex flex-col overflow-hidden w-full",children:(0,n.jsx)(Q,{previewContent:ee,onOpenFile:b,filePath:r,worktreeId:t,tocVisible:eH,onToggleTocVisible:e_,tocTitle:N("toc.title"),tocShowLabel:N("toc.show"),tocHideLabel:N("toc.hide")})}):(0,n.jsx)("div",{"data-testid":"markdown-preview-container",className:"flex flex-col overflow-hidden transition-all duration-200 ".concat(eG.showPreview?"":"hidden"),style:"split"===er?tu:{width:eG.showPreview?"100%":"0%"},children:(0,n.jsx)(Q,{previewContent:ee,onOpenFile:b,filePath:r,worktreeId:t,tocVisible:eH,onToggleTocVisible:e_,tocTitle:N("toc.title"),tocShowLabel:N("toc.show"),tocHideLabel:N("toc.hide")})})]})]});return eT&&eA&&ex?(0,a.createPortal)(tm,ex):tm})},79962:(e,t,r)=>{r.d(t,{K:()=>s,Y:()=>l});var n=r(21286);let l="commandmate:md-toc-visible",a=/^ {0,3}(#{1,6})(?:[ \t]+(.*?))?[ \t]*$/,o=/^( {0,3})(`{3,}|~{3,})(.*)$/;function s(e){if(!e)return[];let t=new n.A,r=[],l=null,s=0;for(let n of e.split("\n")){var i;let e=o.exec(n);if(l){if(e){let t=e[2];t[0]===l&&t.length>=s&&""===e[3].trim()&&(l=null,s=0)}continue}if(e){let t=e[2],r=t[0];if("`"===r&&e[3].includes("`"));else{l=r,s=t.length;continue}}let d=a.exec(n);if(!d)continue;let c=d[1].length,u=function(e){let t=e;return(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/!\[[^\]]*\]\([^)]*\)/g,"")).replace(/!\[[^\]]*\]\[[^\]]*\]/g,"")).replace(/\[([^\]]*)\]\([^)]*\)/g,"$1")).replace(/\[([^\]]*)\]\[[^\]]*\]/g,"$1")).replace(/\[([^\]]*)\]/g,"$1")).replace(/(`+)([\s\S]*?)\1/g,"$2")).replace(/(\*\*|__)(.*?)\1/g,"$2")).replace(/(\*|_)(.*?)\1/g,"$2")).replace(/~~(.*?)~~/g,"$1")).replace(/\\([\\`*_{}[\]()#+\-.!~])/g,"$1")).trim()}((null!=(i=d[2])?i:"").replace(/([ \t]|^)#+[ \t]*$/,"")),f=t.slug(u);r.push({depth:c,text:u,id:f})}return r}},80003:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(71847).A)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]])}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[838],{38038:(e,t,s)=>{Promise.resolve().then(s.bind(s,60675))},53482:(e,t,s)=>{"use strict";s.d(t,{i:()=>c});var a=s(95155),n=s(12115),r=s(60322),i=s(9900);function o(){return(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}function l(){return(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function c(e){let{text:t,className:s="",label:c="Copy"}=e,[d,u]=(0,n.useState)(!1),m=(0,n.useRef)(null);(0,n.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let p=(0,n.useCallback)(async()=>{try{await (0,r.l)(t),u(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>u(!1),i.s7)}catch(e){}},[t]);return(0,a.jsxs)("button",{type:"button",onClick:p,className:"inline-flex items-center gap-1 rounded border border-border bg-surface px-2 py-0.5 text-[11px] font-medium text-foreground transition-colors hover:bg-muted ".concat(s),"aria-label":d?"Copied":c,title:d?"Copied!":c,children:[d?(0,a.jsx)(l,{}):(0,a.jsx)(o,{}),(0,a.jsx)("span",{children:d?"Copied":c})]})}},60322:(e,t,s)=>{"use strict";s.d(t,{l:()=>n});let a=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;async function n(e){var t;if(!e||0===e.trim().length)return;let s=e.replace(a,"");if(null==(t=navigator.clipboard)?void 0:t.writeText)try{await navigator.clipboard.writeText(s);return}catch(e){}let n=document.createElement("textarea");n.value=s,n.style.position="fixed",n.style.left="-9999px",n.style.top="-9999px",n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{document.execCommand("copy")}finally{document.body.removeChild(n)}}},60675:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>I});var a=s(95155),n=s(15229),r=s(12115),i=s(18955),o=s(71360),l=s(13898),c=s(36402);let d=(0,r.memo)(function(e){let{onSend:t,disabled:s=!1,placeholder:n}=e,o=(0,i.c)("home"),[c,d]=(0,r.useState)(""),[u,m]=(0,r.useState)(!1),[p,h]=(0,r.useState)(!1),x=(0,r.useRef)(null),f=(0,r.useRef)(null),g=(0,r.useRef)(!1);(0,r.useEffect)(()=>{let e=x.current;e&&(c?(e.style.height="auto",e.style.height="".concat(Math.min(e.scrollHeight,120),"px")):e.style.height="24px")},[c]);let b=(0,r.useCallback)(async()=>{if(!p&&c.trim()&&!u&&!s)try{m(!0),await t(c.trim()),d("")}catch(e){}finally{m(!1)}},[p,c,u,s,t]),v=(0,r.useCallback)(async e=>{e.preventDefault(),await b()},[b]),y=(0,r.useCallback)(()=>{h(!0),g.current=!1,f.current&&clearTimeout(f.current)},[]),w=(0,r.useCallback)(()=>{h(!1),g.current=!0,f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{g.current=!1},300)},[]),j=(0,r.useCallback)(e=>{let{keyCode:t}=e.nativeEvent;if(229!==t){if(g.current&&"Enter"===e.key){g.current=!1;return}"Enter"!==e.key||p||e.shiftKey||(e.preventDefault(),b())}},[p,b]);return(0,a.jsxs)("form",{onSubmit:v,className:"flex shrink-0 items-center gap-2 rounded-lg border border-input bg-surface dark:bg-surface-2 px-3 py-1.5 focus-within:border-accent-500 focus-within:ring-1 focus-within:ring-accent-500","data-testid":"assistant-message-input",children:[(0,a.jsx)("textarea",{ref:x,value:c,onChange:e=>d(e.target.value),onKeyDown:j,onCompositionStart:y,onCompositionEnd:w,placeholder:null!=n?n:o("assistant.input.defaultPlaceholder"),disabled:u||s,rows:1,className:"flex-1 outline-none bg-transparent resize-none overflow-y-auto scrollbar-thin text-sm",style:{minHeight:"24px",maxHeight:"120px",paddingTop:"4px",paddingBottom:"4px",lineHeight:"18px"},"data-testid":"assistant-message-textarea"}),(0,a.jsx)(l.$n,{type:"submit",variant:"ghost",disabled:!c.trim()||u||s,className:"flex-shrink-0 rounded-full p-1.5 text-accent-600 hover:bg-accent-50 dark:text-accent-400 dark:hover:bg-accent-900/30 disabled:text-muted-foreground disabled:hover:bg-transparent","aria-label":o("assistant.input.send"),"data-testid":"assistant-send-button",children:u?(0,a.jsx)(l.y$,{size:"sm"}):(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]})});var u=s(51238),m=s(22133),p=s(10934),h=s(5225);s(1226);var x=s(53482),f=s(3005);function g(e){return e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function b(){return(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}function v(e){let{message:t}=e;return(0,a.jsx)("div",{className:"text-center text-xs font-medium uppercase tracking-[0.14em] text-muted-foreground",children:(0,a.jsx)("span",{className:"rounded-full border border-border bg-surface-2 px-3 py-1",children:t.content})})}function y(e){let{message:t,canEdit:s,onEdit:n}=e,o=(0,i.c)("home"),[l,c]=(0,r.useState)(!1),[d,u]=(0,r.useState)(t.content),[m,p]=(0,r.useState)(!1),[h,f]=(0,r.useState)(null),v=t.deliveryStatus?"pending"===t.deliveryStatus?o("assistant.message.sending"):"failed"===t.deliveryStatus?o("assistant.message.failed"):o("assistant.message.sent"):null,y=(0,r.useCallback)(()=>{u(t.content),f(null),c(!0)},[t.content]),w=(0,r.useCallback)(()=>{c(!1),f(null)},[]),j=(0,r.useCallback)(async()=>{if(!n||m)return;let e=d.trim();if(!e||e===t.content.trim())return void c(!1);p(!0),f(null);try{await n(t,e),c(!1)}catch(e){f(e instanceof Error?e.message:o("assistant.errors.resubmitMessage"))}finally{p(!1)}},[d,t,n,m,o]);return(0,a.jsxs)("div",{className:"group ml-auto max-w-[88%] rounded-2xl border border-accent-500/40 bg-accent-500/10 px-4 py-3 text-foreground shadow-sm",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.12em] text-muted-foreground",children:[(0,a.jsx)("span",{children:o("assistant.message.you")}),(0,a.jsx)("span",{children:g(t.timestamp)})]}),l?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("textarea",{className:"w-full resize-y rounded border border-input bg-surface p-2 text-sm text-foreground focus:border-accent-500 focus:outline-none focus:ring-1 focus:ring-ring",value:d,onChange:e=>u(e.target.value),rows:Math.max(3,Math.min(12,d.split("\n").length+1)),disabled:m,"data-testid":"assistant-edit-textarea"}),h&&(0,a.jsx)("p",{className:"text-[11px] text-danger-foreground",children:h}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:w,disabled:m,className:"rounded border border-border bg-surface px-3 py-1 text-[11px] text-foreground transition-colors hover:bg-muted disabled:opacity-50",children:o("assistant.message.cancel")}),(0,a.jsx)("button",{type:"button",onClick:j,disabled:m||!d.trim(),className:"rounded bg-accent-600 px-3 py-1 text-[11px] font-medium text-white transition-colors hover:bg-accent-700 disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground","data-testid":"assistant-edit-save",children:m?o("assistant.message.resending"):o("assistant.message.saveAndResend")})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"whitespace-pre-wrap break-words text-sm leading-6",children:t.content}),(0,a.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-3",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium ".concat("failed"===t.deliveryStatus?"text-danger-foreground":"text-muted-foreground"),children:null!=v?v:""}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 opacity-60 transition-opacity group-hover:opacity-100",children:[(0,a.jsx)(x.i,{text:t.content}),s&&n&&(0,a.jsxs)("button",{type:"button",onClick:y,className:"inline-flex items-center gap-1 rounded border border-border bg-surface px-2 py-0.5 text-[11px] font-medium text-foreground transition-colors hover:bg-muted","aria-label":o("assistant.message.editMessage"),"data-testid":"assistant-edit-button",title:o("assistant.message.editAndResend"),children:[(0,a.jsx)(b,{}),(0,a.jsx)("span",{children:o("assistant.message.edit")})]})]})]})]})]})}function w(e){let{message:t,assistantLabel:s}=e;return(0,a.jsxs)("div",{className:"group mr-auto max-w-[88%] rounded-2xl border border-border bg-surface px-4 py-3 text-foreground shadow-sm",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.12em] text-muted-foreground",children:[(0,a.jsx)("span",{children:s}),(0,a.jsx)("span",{children:g(t.timestamp)})]}),(0,a.jsx)("div",{className:"assistant-md text-sm leading-6",children:(0,a.jsx)(u.oz,{remarkPlugins:[m.A],rehypePlugins:[p.A,h.A],children:t.content})}),(0,a.jsx)("div",{className:"mt-2 flex justify-end opacity-60 transition-opacity group-hover:opacity-100",children:(0,a.jsx)(x.i,{text:t.content})})]})}function j(e){let{messages:t,assistantLabel:s,sessionActive:n,waitingForResponse:o=!1,canEdit:l=!1,onEditMessage:c}=e,d=(0,i.c)("home"),u=(0,r.useRef)(null),m=(0,r.useRef)(!0),p=(0,r.useMemo)(()=>{var e;let s=t[t.length-1];return s?"".concat(t.length,":").concat(s.id,":").concat(null!=(e=s.deliveryStatus)?e:"",":").concat(s.content.length,":").concat(o?"waiting":"idle"):"empty:".concat(o?"waiting":"idle")},[t,o]);(0,r.useEffect)(()=>{u.current&&m.current&&(u.current.scrollTop=u.current.scrollHeight)},[p]);let h=(0,r.useMemo)(()=>{let e=t[t.length-1];return n&&e&&"user"===e.role&&"failed"!==e.deliveryStatus?d("assistant.working"):d("assistant.emptyState")},[t,n,d]);return(0,a.jsx)("div",{ref:u,className:"h-full min-h-0 overflow-y-scroll rounded-xl border border-border bg-surface-2 p-3",style:{scrollbarGutter:"stable"},onScroll:e=>{let t=e.currentTarget;m.current=t.scrollHeight-t.scrollTop-t.clientHeight<48},"data-testid":"assistant-message-list",children:0!==t.length||o?(0,a.jsxs)("div",{className:"space-y-3",children:[t.map(e=>"system"===e.role&&"session_boundary"===e.messageType?(0,a.jsx)(v,{message:e},e.id):"user"===e.role?(0,a.jsx)(y,{message:e,canEdit:l,onEdit:c},e.id):(0,a.jsx)(w,{message:e,assistantLabel:s},e.id)),o&&(0,a.jsxs)("div",{className:"mr-auto flex max-w-[88%] items-center gap-3 rounded-2xl border border-border bg-surface px-4 py-3 shadow-sm","data-testid":"assistant-waiting-indicator","aria-live":"polite",children:[(0,a.jsx)(f.y,{size:"sm",variant:"accent"}),(0,a.jsx)("span",{className:"text-sm text-foreground",children:d("assistant.thinking",{label:s})})]})]}):(0,a.jsx)("div",{className:"flex h-full min-h-[160px] items-center justify-center text-sm text-muted-foreground",children:h})})}function k(e){return e?{...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt),lastStartedAt:e.lastStartedAt?new Date(e.lastStartedAt):void 0,lastStoppedAt:e.lastStoppedAt?new Date(e.lastStoppedAt):void 0,contextSentAt:e.contextSentAt?new Date(e.contextSentAt):void 0}:null}function N(e){return{...e,timestamp:new Date(e.timestamp)}}let C={async getConversation(e,t){let s=await fetch("/api/assistant/conversation?repositoryId=".concat(encodeURIComponent(e),"&cliToolId=").concat(encodeURIComponent(t)));if(!s.ok)throw Error((await s.json().catch(()=>({}))).error||"Failed to get conversation (".concat(s.status,")"));return k((await s.json()).conversation)},async getMessages(e){let t=await fetch("/api/assistant/messages?conversationId=".concat(encodeURIComponent(e)));if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to get messages (".concat(t.status,")"));return(await t.json()).messages.map(N)},async clearMessages(e,t){var s;let a=new URLSearchParams({conversationId:e});(null==t?void 0:t.fromMessageId)&&a.set("fromMessageId",t.fromMessageId);let n=await fetch("/api/assistant/messages?".concat(a.toString()),{method:"DELETE"});if(!n.ok)throw Error((await n.json().catch(()=>({}))).error||"Failed to clear messages (".concat(n.status,")"));return{archivedCount:null!=(s=(await n.json()).archivedCount)?s:0}},async startSession(e,t){let s=await fetch("/api/assistant/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:e,repositoryId:t})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error||"Failed to start session (".concat(s.status,")"));let a=await s.json();return{...a,conversation:k(a.conversation)}},async sendCommand(e,t,s){let a=await fetch("/api/assistant/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:e,conversationId:t,command:s})});if(!a.ok)throw Error((await a.json().catch(()=>({}))).error||"Failed to send command (".concat(a.status,")"))},async getCurrentOutput(e,t){let s=await fetch("/api/assistant/current-output?cliToolId=".concat(encodeURIComponent(e),"&conversationId=").concat(encodeURIComponent(t)));if(!s.ok)throw Error((await s.json().catch(()=>({}))).error||"Failed to get output (".concat(s.status,")"));return s.json()},async stopSession(e,t){let s=await fetch("/api/assistant/session?cliToolId=".concat(encodeURIComponent(e),"&conversationId=").concat(encodeURIComponent(t)),{method:"DELETE"});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error||"Failed to stop session (".concat(s.status,")"));return s.json()},async getInstalledTools(){var e;let t=await fetch("/api/assistant/tools");return t.ok&&null!=(e=(await t.json()).tools)?e:[]}},S="commandmate-assistant-cli-tool",E=["claude","codex","antigravity"];function M(e){return E.includes(e)}function A(){var e;let t=(0,i.c)("home"),s=(0,c.SC)(),[n,u]=(0,r.useState)([]),[m,p]=(0,r.useState)([]),[h,x]=(0,r.useState)(""),[f,g]=(0,r.useState)("claude"),[b,v]=(0,r.useState)(null),[y,w]=(0,r.useState)([]),[k,N]=(0,r.useState)(null),[E,A]=(0,r.useState)(!1),[I,T]=(0,r.useState)(!1),[R,L]=(0,r.useState)(!1),[H,D]=(0,r.useState)(!1),[P,_]=(0,r.useState)(null),z="".concat(h,":").concat(f),F=!H||""!==h&&P!==z,U=(0,r.useRef)(null),O=(null==b?void 0:b.status)==="ready"||(null==b?void 0:b.status)==="running",B=(null==b?void 0:b.status)==="running",W=(null==b?void 0:b.status)==="ready",$=n.find(e=>e.id===h),V=(0,r.useMemo)(()=>m.filter(e=>M(e.id)),[m]),G=V.find(e=>e.id===f),J=null!=(e=null==G?void 0:G.name)?e:f,K=(0,r.useCallback)(async e=>{w(await C.getMessages(e))},[]),Z=(0,r.useCallback)(async()=>{if(!h){v(null),w([]);return}let e=await C.getConversation(h,f);v(e),e?await K(e.id):w([])},[K,h,f]);(0,r.useEffect)(()=>{{let e=localStorage.getItem(S);e&&M(e)&&g(e)}},[]),(0,r.useEffect)(()=>{async function e(){let e=await C.getInstalledTools();p(e);let t=e.filter(e=>M(e.id)),s=t.find(e=>e.installed);s&&g(e=>{let a=t.find(t=>t.id===e);return(null==a?void 0:a.installed)?e:s.id})}(async function(){try{var e;let t=await fetch("/api/worktrees");if(!t.ok)return;let s=(null!=(e=(await t.json()).repositories)?e:[]).map(e=>({id:e.id,path:e.path,name:e.name,displayName:e.displayName}));u(s),s.length>0&&x(e=>e||s[0].id)}catch(e){}finally{D(!0)}})(),e()},[]),(0,r.useEffect)(()=>{if(!h)return;let e=!1;return(async()=>{try{let t=await C.getConversation(h,f);if(e)return;if(v(t),t){let s=await C.getMessages(t.id);e||w(s)}else w([])}catch(s){e||N(s instanceof Error?s.message:t("assistant.errors.loadConversation"))}finally{e||_("".concat(h,":").concat(f))}})(),()=>{e=!0}},[h,f,t]),(0,r.useEffect)(()=>{if(U.current&&(clearInterval(U.current),U.current=null),!b)return;let e=async()=>{try{await Z()}catch(e){}};return e(),U.current=setInterval(e,2e3),()=>{U.current&&(clearInterval(U.current),U.current=null)}},[null==b?void 0:b.id,Z,b]);let q=(0,r.useCallback)(e=>{M(e)&&(g(e),localStorage.setItem(S,e))},[]),Q=(0,r.useCallback)(async()=>{if(h&&!E){A(!0),N(null);try{let e=await C.startSession(f,h);v(e.conversation),await K(e.conversation.id)}catch(e){N(e instanceof Error?e.message:t("assistant.errors.startSession"))}finally{A(!1)}}},[K,h,f,E,t]),X=(0,r.useCallback)(async()=>{if(b&&!I){T(!0),N(null);try{await C.stopSession(f,b.id),await Z()}catch(e){N(e instanceof Error?e.message:t("assistant.errors.stopSession"))}finally{T(!1)}}},[b,Z,f,I,t]),Y=(0,r.useCallback)(async()=>{if(b&&!R&&!B&&await s({description:t("assistant.clearHistoryConfirm"),variant:"danger"})){L(!0),N(null);try{await C.clearMessages(b.id),await Z()}catch(e){N(e instanceof Error?e.message:t("assistant.errors.clearHistory"))}finally{L(!1)}}},[R,b,B,Z,s,t]),ee=(0,r.useCallback)(async e=>{if(b&&W){N(null);try{await C.sendCommand(f,b.id,e),v(e=>e?{...e,status:"running"}:e),await Promise.all([K(b.id),Z()])}catch(e){throw N(e instanceof Error?e.message:t("assistant.errors.sendMessage")),e}}},[W,b,Z,K,f,t]),et=(0,r.useCallback)(async(e,s)=>{if(!b||!W)throw Error(t("assistant.errors.notReadyToResend"));N(null),await C.clearMessages(b.id,{fromMessageId:e.id}),await C.sendCommand(f,b.id,s),v(e=>e?{...e,status:"running"}:e),await Promise.all([K(b.id),Z()])},[W,b,Z,K,f,t]),es=(0,r.useCallback)(async e=>{if(O){if(!await s({description:t("assistant.changeRepoConfirm")}))return;try{await C.stopSession(f,b.id)}catch(e){N(e instanceof Error?e.message:t("assistant.errors.stopSession"));return}}x(e),N(null)},[b,O,f,s,t]);return(0,a.jsx)(l.Zp,{variant:"elevated",padding:"none",className:"overflow-hidden rounded-xl shadow-lg","data-testid":"assistant-chat-panel",children:(0,a.jsxs)("div",{className:"flex h-[78vh] min-h-[34rem] max-h-[48rem] flex-col gap-4 overflow-hidden bg-gradient-to-br from-transparent to-accent-500/5 p-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)_auto]",children:[(0,a.jsx)("span",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:t("assistant.repositoryLabel")}),(0,a.jsx)("span",{className:"text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground",children:t("assistant.cliLabel")}),(0,a.jsx)("span",{className:"hidden md:block"})]}),(0,a.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)_auto] md:items-center",children:[(0,a.jsxs)("select",{value:h,onChange:e=>void es(e.target.value),disabled:0===n.length,className:"w-full rounded-lg border border-input bg-surface px-3 py-2 text-sm text-foreground shadow-sm transition-colors focus:border-accent-500 focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground","data-testid":"assistant-repo-select",children:[0===n.length&&(0,a.jsx)("option",{value:"",children:t("assistant.noRepositories")}),n.map(e=>(0,a.jsx)("option",{value:e.id,children:e.displayName||e.name},e.id))]}),(0,a.jsx)("select",{value:f,onChange:e=>q(e.target.value),disabled:O,className:"w-full rounded-lg border border-input bg-surface px-3 py-2 text-sm text-foreground shadow-sm transition-colors focus:border-accent-500 focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground","data-testid":"assistant-tool-select",children:V.map(e=>(0,a.jsx)("option",{value:e.id,disabled:!e.installed,children:e.installed?e.name:t("assistant.toolNotInstalled",{name:e.name})},e.id))}),(0,a.jsx)("div",{children:O?(0,a.jsx)(l.$n,{variant:"danger",onClick:X,disabled:I,className:"w-full md:w-auto","data-testid":"assistant-stop-button",children:I?t("assistant.stopping"):t("assistant.stop")}):(0,a.jsx)(l.$n,{variant:"primary",onClick:Q,disabled:!h||E,className:"w-full md:w-auto","data-testid":"assistant-start-button",children:E?t("assistant.starting"):t("assistant.start")})})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:$?t("assistant.startDirectory",{repository:$.displayName||$.name,path:$.path}):t("assistant.startDirectoryHint")})]}),k&&(0,a.jsx)("div",{className:"rounded border border-danger/40 bg-danger/10 p-2 text-sm text-danger-foreground",children:k}),(0,a.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs font-medium uppercase tracking-[0.14em] text-muted-foreground",children:t("assistant.history")}),(0,a.jsxs)(l.$n,{type:"button",variant:"ghost",size:"sm",onClick:Y,disabled:!b||R||B||0===y.length,className:"gap-1","data-testid":"assistant-clear-button",children:[(0,a.jsx)(o.A,{className:"h-3.5 w-3.5","aria-hidden":"true"}),R?t("assistant.clearing"):t("assistant.clearHistory")]})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:F&&0===y.length?(0,a.jsx)("div",{className:"h-full min-h-0 overflow-hidden rounded-xl border border-border bg-surface-2 p-3","data-testid":"assistant-chat-loading",role:"status","aria-label":t("assistant.loadingConversation"),children:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(l.EA,{className:"ml-auto h-10 w-3/5 rounded-2xl"}),(0,a.jsx)(l.EA,{className:"mr-auto h-16 w-4/5 rounded-2xl"}),(0,a.jsx)(l.EA,{className:"ml-auto h-10 w-2/5 rounded-2xl"})]})}):(0,a.jsx)(j,{messages:y,assistantLabel:J,sessionActive:O,waitingForResponse:B,canEdit:W,onEditMessage:et})}),(0,a.jsx)("div",{className:"shrink-0",children:(0,a.jsx)(d,{onSend:ee,disabled:!W,placeholder:W?t("assistant.inputPlaceholder"):O?t("assistant.inputPlaceholderWaiting"):t("assistant.inputPlaceholderNoSession")})})]})]})})}function I(){return(0,a.jsx)(n.GV,{children:(0,a.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Assistant Chat"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Converse with a local CLI assistant (Claude or Codex) scoped to a selected repository."})]}),(0,a.jsx)(A,{})]})})}},71360:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(71847).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])}},e=>{e.O(0,[6481,6809,4909,2770,790,4974,8566,1191,6402,3898,6381,5229,8441,1255,7358],()=>e(e.s=38038)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{1150:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let r=n(95155),l=n(12115),o=n(24437);function a(e){return{default:e&&"default"in e?e.default:e}}n(36552);let u={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},i=function(e){let t={...u,...e},n=(0,l.lazy)(()=>t.loader().then(a)),i=t.loading;function s(e){let a=i?(0,r.jsx)(i,{isLoading:!0,pastDelay:!0,error:null}):null,u=!t.ssr||!!t.loading,s=u?l.Suspense:l.Fragment,c=t.ssr?(0,r.jsxs)(r.Fragment,{children:[null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(o.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(s,{...u?{fallback:a}:{},children:c})}return s.displayName="LoadableComponent",s}},8567:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return r.workAsyncStorageInstance}});let r=n(17828)},17828:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return r}});let r=(0,n(64054).createAsyncLocalStorage)()},24437:(e,t,n)=>{"use strict";function r(e){let{reason:t,children:n}=e;return n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return r}}),n(24553)},36552:(e,t,n)=>{"use strict";function r(e){let{moduleIds:t}=e;return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return r}}),n(95155),n(47650),n(8567),n(77278)},48935:(e,t,n)=>{Promise.resolve().then(n.bind(n,70462))},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{bindSnapshot:function(){return a},createAsyncLocalStorage:function(){return o},createSnapshot:function(){return u}});let n=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class r{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}static bind(e){return e}}let l="undefined"!=typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return l?new l:new r}function a(e){return l?l.bind(e):r.bind(e)}function u(){return l?l.snapshot():function(e,...t){return e(...t)}}},65380:(e,t,n)=>{"use strict";n.d(t,{H:()=>u,O:()=>a});var r=n(95155),l=n(12115);let o=(0,l.createContext)(!1);function a(e){let{children:t,authEnabled:n}=e;return(0,r.jsx)(o.Provider,{value:n,children:t})}function u(){return(0,l.useContext)(o)}},67909:(e,t,n)=>{"use strict";n.d(t,{default:()=>l.a});var r=n(86278),l=n.n(r)},70462:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var r=n(95155),l=n(12115),o=n(67909),a=n(18955),u=n(65380);let i=/(?:^|&)token=([^&]*)/;var s=n(13898);let c=(0,o.default)(()=>n.e(6271).then(n.bind(n,6271)).then(e=>({default:e.QrCodeGenerator})),{loadableGenerated:{webpack:()=>[6271]},ssr:!1});function d(){var e;let t=(0,a.c)("auth"),n=(0,u.H)(),[o,d]=(0,l.useState)(""),[f,h]=(0,l.useState)(null),[b,m]=(0,l.useState)(!1),[g,p]=(0,l.useState)(null),{autoLoginErrorKey:y,retryAfterSeconds:v,clearError:_}=function(e){let[t,n]=(0,l.useState)(null),[r,o]=(0,l.useState)(null),a=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{let t;if(!e||a.current)return;a.current=!0;let r=window.location.hash;if(!r)return;let l=(r.startsWith("#")?r.substring(1):r).match(i);if(l){history.replaceState(null,"","".concat(window.location.pathname).concat(window.location.search));try{t=decodeURIComponent(l[1])}catch(e){n("token_invalid");return}if(t=t.trim()){if(t.length>256)return void n("token_invalid");(async()=>{try{let e=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t})});e.ok?window.location.href="/":401===e.status?n("token_invalid"):429===e.status?(o(function(e){if(!e)return null;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}(e.headers.get("Retry-After"))),n("rate_limited")):n("auto_login_failed")}catch(e){n("auto_login_failed")}})()}}},[e]),{autoLoginErrorKey:t,retryAfterSeconds:r,clearError:()=>{n(null),o(null)}}}(n),j={token_invalid:t("login.qr.tokenExpiredOrInvalid"),rate_limited:t("login.qr.rateLimited"),auto_login_failed:t("login.qr.autoLoginError")},x=y&&null!=(e=j[y])?e:null;async function w(e){e.preventDefault(),h(null),_(),m(!0);try{let e=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:o})});if(e.ok){window.location.href="/";return}if(429===e.status){let n=e.headers.get("Retry-After"),r=n?parseInt(n,10):900;p(r),h(t("error.lockedOut"));return}if(401===e.status)return void h(t("error.invalidToken"));h(t("error.unknownError"))}catch(e){h(t("error.unknownError"))}finally{m(!1)}}if((0,l.useEffect)(()=>{n||(window.location.href="/")},[n]),(0,l.useEffect)(()=>{null!==v&&p(v)},[v]),(0,l.useEffect)(()=>{if(null===g||g<=0)return;let e=setInterval(()=>{p(t=>null===t||t<=1?(clearInterval(e),null):t-1)},1e3);return()=>clearInterval(e)},[g]),!n)return null;let k=x||f;return(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-background",children:(0,r.jsxs)("div",{className:"bg-surface p-8 rounded-lg shadow-md w-full max-w-md",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold mb-6 text-center text-foreground",children:t("login.title")}),(0,r.jsxs)("form",{onSubmit:w,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"token",className:"block text-sm font-medium text-foreground mb-1",children:t("login.tokenLabel")}),(0,r.jsx)(s.pd,{id:"token",type:"password",value:o,onChange:e=>d(e.target.value),placeholder:t("login.tokenPlaceholder"),autoFocus:!0,autoComplete:"off",disabled:null!==g&&g>0})]}),k&&(0,r.jsxs)("div",{className:"text-danger-foreground text-sm",children:[k,null!==g&&g>0&&(0,r.jsx)("div",{className:"mt-1",children:t("error.retryAfter",{minutes:Math.ceil(g/60)})})]}),(0,r.jsx)(s.$n,{type:"submit",fullWidth:!0,loading:b,disabled:!o||null!==g&&g>0,children:t("login.submitButton")})]}),(0,r.jsx)("div",{className:"hidden md:block",children:(0,r.jsx)(c,{})})]})})}},86278:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return l}});let r=n(28140)._(n(1150));function l(e,t){var n;let l={};"function"==typeof e&&(l.loader=e);let o={...l,...t};return(0,r.default)({...o,modules:null==(n=o.loadableGenerated)?void 0:n.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},e=>{e.O(0,[6809,4909,2770,6402,3898,8441,1255,7358],()=>e(e.s=48935)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3310],{80867:(e,t,a)=>{Promise.resolve().then(a.bind(a,95775))},95775:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>T});var s=a(95155),r=a(52619),n=a.n(r),i=a(18955),l=a(15229),o=a(13898),d=a(12115);function c(e){var t;let{appId:a,pollInterval:r=3e4,showResponseTime:n=!1,compact:l=!1}=e,o=(0,i.c)("externalApps"),[c,m]=(0,d.useState)(null),[x,p]=(0,d.useState)(!0),u=(0,d.useCallback)(async()=>{try{let e=await fetch("/api/external-apps/".concat(a,"/health"));if(e.ok){let t=await e.json();m(t)}else m({id:a,healthy:!1,lastChecked:Date.now(),error:"Failed to check health"})}catch(e){m({id:a,healthy:!1,lastChecked:Date.now(),error:"Network error"})}finally{p(!1)}},[a]);if((0,d.useEffect)(()=>{u();let e=setInterval(u,r);return()=>clearInterval(e)},[u,r]),x)return(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-muted-foreground animate-pulse"}),!l&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:o("status.checking")})]});let h=null!=(t=null==c?void 0:c.healthy)&&t,f=h?"bg-success":"bg-muted-foreground",g=o(h?"status.running":"status.stopped");return l?(0,s.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(f),title:g}):(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(f)}),(0,s.jsx)("span",{className:"text-xs ".concat(h?"text-success-foreground":"text-muted-foreground"),children:g}),n&&(null==c?void 0:c.responseTime)!==void 0&&(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",c.responseTime,"ms)"]})]})}function m(e){var t;let{app:a,onEdit:r,onDelete:n}=e,l=(0,i.c)("externalApps"),m=(0,i.c)("common"),[x,p]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1),f=async()=>{h(!0);try{await n(a.id)}finally{h(!1),p(!1)}},g="/proxy/".concat(a.pathPrefix,"/");return(0,s.jsxs)(o.Zp,{padding:"md",className:"relative",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h4",{className:"text-base font-semibold text-foreground truncate",children:a.displayName}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 font-mono truncate",children:a.name})]}),(0,s.jsx)(o.Ex,{variant:{sveltekit:"warning",streamlit:"error",nextjs:"info",other:"gray"}[a.appType]||"gray",children:{sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"}[t=a.appType]||t})]}),(0,s.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-muted-foreground",children:l("card.status")}),(0,s.jsx)(c,{appId:a.id,pollInterval:3e4})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-muted-foreground",children:l("card.port")}),(0,s.jsxs)("span",{className:"text-sm font-mono text-foreground",children:[":",a.targetPort]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-muted-foreground",children:l("card.path")}),(0,s.jsxs)("span",{className:"text-sm font-mono text-foreground truncate max-w-[150px]",children:["/proxy/",a.pathPrefix,"/"]})]}),a.websocketEnabled&&(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-muted-foreground",children:l("card.websocket")}),(0,s.jsx)(o.Ex,{variant:"info",children:l("card.enabled")})]}),!a.enabled&&(0,s.jsx)("div",{className:"mt-2 py-1 px-2 bg-warning-subtle border border-warning-border rounded text-xs text-warning-foreground",children:l("card.disabledNotice")})]}),x?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:l("card.deleteConfirm",{name:a.displayName})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(o.$n,{variant:"danger",size:"sm",onClick:f,disabled:u,loading:u,children:l("card.delete")}),(0,s.jsx)(o.$n,{variant:"ghost",size:"sm",onClick:()=>p(!1),disabled:u,children:m("cancel")})]})]}):(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,s.jsx)(o.$n,{variant:"primary",size:"sm",onClick:()=>window.open(g,"_blank"),disabled:!a.enabled,children:l("card.open")}),(0,s.jsx)(o.$n,{variant:"secondary",size:"sm",onClick:()=>r(a),children:l("card.settings")}),(0,s.jsx)(o.$n,{variant:"ghost",size:"sm",onClick:()=>p(!0),className:"text-danger-foreground hover:bg-danger-subtle",children:l("card.delete")})]})]})}var x=a(87531);let p={MIN:1024,MAX:65535},u=/^[a-zA-Z0-9-]+$/,h={sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"},f=["sveltekit","streamlit","nextjs","other"].map(e=>({value:e,label:h[e]}));function g(e){let{isOpen:t,onClose:a,editApp:r,onSave:n}=e,l=(0,i.c)("externalApps"),c=(0,i.c)("common"),m=!!r,[h,g]=(0,d.useState)(""),[b,j]=(0,d.useState)(""),[N,v]=(0,d.useState)(""),[y,k]=(0,d.useState)(""),[w,C]=(0,d.useState)(""),[S,P]=(0,d.useState)(!1),[T,A]=(0,d.useState)(""),[E,O]=(0,d.useState)(!0),[M,I]=(0,d.useState)({}),[F,$]=(0,d.useState)(!1),[D,z]=(0,d.useState)(null);(0,d.useEffect)(()=>{t&&(r?(g(r.displayName),j(r.name),v(r.pathPrefix),k(r.targetPort),C(r.appType),P(r.websocketEnabled),A(r.description||""),O(r.enabled)):(g(""),j(""),v(""),k(""),C(""),P(!1),A(""),O(!0)),I({}),z(null))},[t,r]);let Z=async e=>{e.preventDefault(),z(null);let t=function(e,t){var a,s,r,n;let i={};return((null==(a=e.displayName)?void 0:a.trim())||(i.displayName="Display name is required"),!t&&((null==(s=e.name)?void 0:s.trim())?u.test(e.name)||(i.name="Only alphanumeric characters and hyphens are allowed"):i.name="Identifier name is required",(null==(r=e.pathPrefix)?void 0:r.trim())?u.test(e.pathPrefix)||(i.pathPrefix="Only alphanumeric characters and hyphens are allowed"):i.pathPrefix="Path prefix is required"),e.targetPort)?"number"!=typeof e.targetPort||Number.isInteger(n=e.targetPort)&&n>=p.MIN&&n<=p.MAX||(i.targetPort="Port must be between ".concat(p.MIN," and ").concat(p.MAX)):i.targetPort="Port number is required",t||e.appType||(i.appType="App type is required"),i}({displayName:h,name:b,pathPrefix:N,targetPort:y,appType:w},m);if(Object.keys(t).length>0)return void I(t);I({}),$(!0);try{if(m&&r){let e=await fetch("/api/external-apps/".concat(r.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:h,description:T||void 0,targetPort:y||void 0,websocketEnabled:S,enabled:E})});if(!e.ok){let t=await e.json();throw Error(t.error||l("form.updateFailed"))}}else{let e=await fetch("/api/external-apps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:h,name:b,pathPrefix:N,targetPort:y,appType:w,websocketEnabled:S,description:T||void 0})});if(!e.ok){let t=await e.json();throw Error(t.error||l("form.createFailed"))}}n(),a()}catch(e){z(e instanceof Error?e.message:l("form.genericError"))}finally{$(!1)}};return(0,s.jsx)(o.Jh,{isOpen:t,onClose:a,title:m?l("form.editTitle"):l("form.addTitle"),size:"md",children:(0,s.jsxs)("form",{onSubmit:Z,className:"space-y-4",children:[(0,s.jsx)("div",{className:"rounded-md bg-warning-subtle p-3 mb-4 border border-warning-border",children:(0,s.jsx)("p",{className:"text-sm text-warning-foreground",children:l("form.securityWarning")})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"displayName",className:"block text-sm font-medium text-foreground mb-1",children:[l("form.displayName")," ",(0,s.jsx)("span",{className:"text-danger",children:"*"})]}),(0,s.jsx)(o.pd,{id:"displayName",type:"text",value:h,onChange:e=>g(e.target.value),className:M.displayName?"border-danger":"",placeholder:l("form.displayNamePlaceholder"),disabled:F}),M.displayName&&(0,s.jsx)("p",{className:"mt-1 text-xs text-danger",children:M.displayName})]}),!m&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground mb-1",children:[l("form.identifierName")," ",(0,s.jsx)("span",{className:"text-danger",children:"*"})]}),(0,s.jsx)(o.pd,{id:"name",type:"text",value:b,onChange:e=>j(e.target.value),className:"font-mono ".concat(M.name?"border-danger":""),placeholder:l("form.identifierNamePlaceholder"),disabled:F}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l("form.identifierNameHelp")}),M.name&&(0,s.jsx)("p",{className:"mt-1 text-xs text-danger",children:M.name})]}),!m&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"pathPrefix",className:"block text-sm font-medium text-foreground mb-1",children:[l("form.pathPrefix")," ",(0,s.jsx)("span",{className:"text-danger",children:"*"})]}),(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("span",{className:"text-sm text-muted-foreground mr-1",children:"/proxy/"}),(0,s.jsx)(o.pd,{id:"pathPrefix",type:"text",value:N,onChange:e=>v(e.target.value),className:"w-auto flex-1 font-mono ".concat(M.pathPrefix?"border-danger":""),placeholder:l("form.pathPrefixPlaceholder"),disabled:F}),(0,s.jsx)("span",{className:"text-sm text-muted-foreground ml-1",children:"/"})]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l("form.pathPrefixHelp")}),M.pathPrefix&&(0,s.jsx)("p",{className:"mt-1 text-xs text-danger",children:M.pathPrefix})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"targetPort",className:"block text-sm font-medium text-foreground mb-1",children:[l("form.portNumber")," ",(0,s.jsx)("span",{className:"text-danger",children:"*"})]}),(0,s.jsx)(o.pd,{id:"targetPort",type:"number",value:y,onChange:e=>k(e.target.value?parseInt(e.target.value,10):""),className:"font-mono ".concat(M.targetPort?"border-danger":""),placeholder:l("form.portNumberPlaceholder"),min:p.MIN,max:p.MAX,disabled:F}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:l("form.portNumberHelp",{min:p.MIN,max:p.MAX})}),M.targetPort&&(0,s.jsx)("p",{className:"mt-1 text-xs text-danger",children:M.targetPort})]}),!m&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"appType",className:"block text-sm font-medium text-foreground mb-1",children:[l("form.appType")," ",(0,s.jsx)("span",{className:"text-danger",children:"*"})]}),(0,s.jsxs)("select",{id:"appType",value:w,onChange:e=>C(e.target.value),className:(0,x.cn)((0,o.j1)(),M.appType&&"border-danger"),disabled:F,children:[(0,s.jsx)("option",{value:"",children:l("form.appTypePlaceholder")}),f.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))]}),M.appType&&(0,s.jsx)("p",{className:"mt-1 text-xs text-danger",children:M.appType})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"description",className:"block text-sm font-medium text-foreground mb-1",children:l("form.description")}),(0,s.jsx)(o.k_,{id:"description",value:T,onChange:e=>A(e.target.value),placeholder:l("form.descriptionPlaceholder"),rows:2,disabled:F})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(o.dO,{id:"websocketEnabled",checked:S,onCheckedChange:P,disabled:F}),(0,s.jsx)("label",{htmlFor:"websocketEnabled",className:"text-sm text-foreground",children:l("form.websocketLabel")})]}),m&&(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(o.dO,{id:"enabled",checked:E,onCheckedChange:O,disabled:F}),(0,s.jsx)("label",{htmlFor:"enabled",className:"text-sm text-foreground",children:l("form.enabledLabel")})]}),D&&(0,s.jsx)("div",{className:"p-3 bg-danger-subtle border border-danger-border rounded text-sm text-danger-foreground",children:D}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t border-border",children:[(0,s.jsx)(o.$n,{type:"button",variant:"ghost",onClick:a,disabled:F,children:c("cancel")}),(0,s.jsx)(o.$n,{type:"submit",variant:"primary",loading:F,children:m?l("form.save"):l("form.add")})]})]})})}function b(){let e=(0,i.c)("externalApps"),t=(0,i.c)("common"),[a,r]=(0,d.useState)([]),[n,l]=(0,d.useState)(!0),[c,x]=(0,d.useState)(null),[p,u]=(0,d.useState)(!1),[h,f]=(0,d.useState)(null),b=(0,d.useCallback)(async()=>{try{x(null);let e=await fetch("/api/external-apps");if(!e.ok)throw Error("Failed to fetch external apps");let t=await e.json();r(t.apps||[])}catch(e){x(e instanceof Error?e.message:"An error occurred")}finally{l(!1)}},[]);(0,d.useEffect)(()=>{b();let e=setInterval(b,6e4);return()=>clearInterval(e)},[b]);let j=(0,d.useCallback)(e=>{f(e),u(!0)},[]),N=(0,d.useCallback)(()=>{f(null),u(!0)},[]),v=(0,d.useCallback)(async e=>{try{let t=await fetch("/api/external-apps/".concat(e),{method:"DELETE"});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to delete app")}b()}catch(e){console.error("Failed to delete app:",e)}},[b]),y=(0,d.useCallback)(()=>{b()},[b]),k=(0,d.useCallback)(()=>{u(!1),f(null)},[]);return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"flex items-center justify-end",children:(0,s.jsx)(o.$n,{variant:"primary",size:"sm",onClick:N,children:e("manager.addApp")})}),n?(0,s.jsx)(o.Zp,{padding:"lg",children:(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(o.y$,{size:"xl",variant:"accent"}),(0,s.jsx)("span",{className:"ml-3 text-muted-foreground",children:e("manager.loading")})]})}):c?(0,s.jsx)(o.Zp,{padding:"lg",children:(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("p",{className:"text-danger-foreground mb-4",children:e("manager.loadError")}),(0,s.jsx)(o.$n,{variant:"secondary",size:"sm",onClick:b,children:t("retry")})]})}):0===a.length?(0,s.jsx)(o.Zp,{padding:"lg",children:(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("p",{className:"text-muted-foreground mb-4",children:e("manager.empty")}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:e("manager.emptyHelp")}),(0,s.jsx)(o.$n,{variant:"primary",size:"sm",onClick:N,children:e("manager.addFirst")})]})}):(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:a.map(e=>(0,s.jsx)(m,{app:e,onEdit:j,onDelete:v},e.id))}),(0,s.jsx)(g,{isOpen:p,onClose:k,editApp:h,onSave:y})]})}let j=(0,a(71847).A)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);var N=a(94442),v=a(81978);function y(){return"undefined"!=typeof navigator&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}let k={enabled:!0,thresholdMinutes:10},w=[5,10,30,60];function C(){let e=(0,i.c)("notifications"),{showToast:t}=(0,N.dj)(),[a,r]=(0,d.useState)(!0),[n,l]=(0,d.useState)(!1),[c,m]=(0,d.useState)(!0),[x,p]=(0,d.useState)(!1),[u,h]=(0,d.useState)(null),[f,g]=(0,d.useState)(null),[b,v]=(0,d.useState)(!1),[k,w]=(0,d.useState)(null),[C,T]=(0,d.useState)({prompt:!0,completion:!0}),A=null!==k;(0,d.useEffect)(()=>{let e=!1;return(async()=>{let t=function(){var e,t;let a=y(),s="undefined"!=typeof navigator&&(!!/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!(null!=(e=(t=window).matchMedia)&&e.call(t,"(display-mode: standalone)").matches||!0===navigator.standalone);return{supported:a&&!s,iosNeedsInstall:s}}();e||(m(y()),p(t.iosNeedsInstall),"undefined"!=typeof Notification&&"denied"===Notification.permission&&v(!0));try{let t=await fetch("/api/push/vapid"),a=await t.json();e||(h(a.configured),g(a.publicKey))}catch(t){e||h(!1)}if(y())try{let t=await navigator.serviceWorker.getRegistration(),a=t?await t.pushManager.getSubscription():null;if(a&&!e){w(a.endpoint);let t=await fetch("/api/push/subscriptions?endpoint=".concat(encodeURIComponent(a.endpoint))),s=await t.json();s.subscribed&&s.subscription&&!e&&T(s.subscription.preferences)}}catch(e){}e||r(!1)})(),()=>{e=!0}},[]);let E=(0,d.useCallback)(async()=>{if(f){l(!0);try{var a;let s=await Notification.requestPermission();if("granted"!==s){v("denied"===s),t(e("toast.error"),"error");return}if(!await navigator.serviceWorker.getRegistration())return void t(e("toast.error"),"error");let r=await navigator.serviceWorker.ready,n=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t="=".repeat((4-e.length%4)%4),a=atob((e+t).replace(/-/g,"+").replace(/_/g,"/")),s=new Uint8Array(new ArrayBuffer(a.length));for(let e=0;e<a.length;e++)s[e]=a.charCodeAt(e);return s}(f)}),i=await fetch("/api/push/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription:n.toJSON(),deviceLabel:navigator.userAgent.slice(0,120)})});if(!i.ok)throw Error("subscribe request failed");let l=await i.json();w(n.endpoint),(null==(a=l.subscription)?void 0:a.preferences)&&T(l.subscription.preferences),v(!1),t(e("toast.enabled"),"success")}catch(a){t(e("toast.error"),"error")}finally{l(!1)}}},[f,t,e]),O=(0,d.useCallback)(async()=>{l(!0);try{var a;let s=await navigator.serviceWorker.getRegistration(),r=s?await s.pushManager.getSubscription():null,n=null!=(a=null==r?void 0:r.endpoint)?a:k;r&&await r.unsubscribe(),n&&await fetch("/api/push/subscriptions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:n})}),w(null),t(e("toast.disabled"),"info")}catch(a){t(e("toast.error"),"error")}finally{l(!1)}},[k,t,e]),M=(0,d.useCallback)(async(a,s)=>{if(!k)return;let r={...C,[a]:s};T(r);try{if(!(await fetch("/api/push/subscriptions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:k,preferences:r})})).ok)throw Error("update failed");t(e("toast.updated"),"success")}catch(a){T(C),t(e("toast.error"),"error")}},[k,C,t,e]);return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(o.Zp,{children:(0,s.jsx)(P,{})}),(0,s.jsx)(o.Zp,{children:a?(0,s.jsx)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:(0,s.jsx)(o.y$,{size:"sm"})}):c?x?(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"notifications-ios-guidance",children:e("ios.guidance")}):!1===u?(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:e("notConfigured")}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:e("description")}),b&&(0,s.jsx)("p",{className:"text-sm text-danger-foreground","data-testid":"notifications-permission-denied",children:e("permission.denied")}),A?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-foreground",children:e("enabledOnThisDevice")}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("types.heading")}),(0,s.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("types.promptWaiting")}),(0,s.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("types.promptWaitingDesc")})]}),(0,s.jsx)(o.dO,{checked:C.prompt,onCheckedChange:e=>M("prompt",e),disabled:n,"aria-label":e("types.promptWaiting"),"data-testid":"notifications-toggle-prompt"})]}),(0,s.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("types.completion")}),(0,s.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("types.completionDesc")})]}),(0,s.jsx)(o.dO,{checked:C.completion,onCheckedChange:e=>M("completion",e),disabled:n,"aria-label":e("types.completion"),"data-testid":"notifications-toggle-completion"})]})]}),(0,s.jsx)(o.$n,{variant:"secondary",onClick:O,disabled:n,"data-testid":"notifications-unsubscribe",children:e("unsubscribe")})]}):(0,s.jsxs)(o.$n,{variant:"primary",onClick:E,disabled:n||b||!f,"data-testid":"notifications-enable",children:[(0,s.jsx)(j,{className:"h-4 w-4"}),n?e("enabling"):e("enable")]})]}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:e("unsupported")})}),(0,s.jsx)(o.Zp,{children:(0,s.jsx)(S,{})})]})}function S(){let e=(0,i.c)("notifications"),{showToast:t}=(0,N.dj)(),[a,r]=(0,d.useState)(!0),[n,l]=(0,d.useState)(!1),[c,m]=(0,d.useState)(k),[x,p]=(0,d.useState)([...w]);(0,d.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/push/escalation"),a=await t.json();!e&&(a.settings&&m(a.settings),Array.isArray(a.choices)&&a.choices.length>0&&p(a.choices))}catch(e){}finally{e||r(!1)}})(),()=>{e=!0}},[]);let u=(0,d.useCallback)(async a=>{m(a),l(!0);try{if(!(await fetch("/api/push/escalation",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:a})})).ok)throw Error("update failed");t(e("toast.updated"),"success")}catch(a){m(c),t(e("toast.error"),"error")}finally{l(!1)}},[c,t,e]);return(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("escalation.heading")}),(0,s.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("escalation.toggle")}),(0,s.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("escalation.toggleDesc")})]}),(0,s.jsx)(o.dO,{checked:c.enabled,onCheckedChange:e=>u({...c,enabled:e}),disabled:a||n,"aria-label":e("escalation.toggle"),"data-testid":"notifications-toggle-escalation"})]}),(0,s.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,s.jsx)("span",{className:"text-sm text-foreground",children:e("escalation.threshold")}),(0,s.jsx)("select",{className:"rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground",value:String(c.thresholdMinutes),disabled:a||n||!c.enabled,"aria-label":e("escalation.threshold"),"data-testid":"notifications-escalation-threshold",onChange:e=>u({...c,thresholdMinutes:Number(e.target.value)}),children:x.map(t=>(0,s.jsx)("option",{value:String(t),children:e("escalation.minutes",{count:t})},t))})]})]})}function P(){let e=(0,i.c)("notifications"),{enabled:t,setEnabled:a}=(0,v.qG)(),{enabled:r,setEnabled:n}=(0,v.Ql)();return(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("inApp.heading")}),(0,s.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("inApp.waitingToggle")}),(0,s.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("inApp.waitingToggleDesc")})]}),(0,s.jsx)(o.dO,{checked:t,onCheckedChange:a,"aria-label":e("inApp.waitingToggle"),"data-testid":"notifications-toggle-inapp-waiting"})]}),(0,s.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("inApp.soundToggle")}),(0,s.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("inApp.soundToggleDesc")})]}),(0,s.jsx)(o.dO,{checked:r,onCheckedChange:n,"aria-label":e("inApp.soundToggle"),"data-testid":"notifications-toggle-inapp-sound"})]})]})}function T(){let e=(0,i.c)("notifications"),t=(0,i.c)("common"),a=(0,i.c)("skills");return(0,s.jsx)(l.GV,{children:(0,s.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"More"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Settings, external apps, and more."})]}),(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:"Quick Links"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,s.jsx)(n(),{href:"/repositories",className:"block","data-testid":"more-link-repositories",children:(0,s.jsxs)(o.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Repositories"}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:"Manage repositories and worktrees"})]})}),(0,s.jsx)(n(),{href:"/skills",className:"block","data-testid":"more-link-skills",children:(0,s.jsxs)(o.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-foreground",children:t("nav.skills")}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:a("page.description")})]})}),(0,s.jsx)(n(),{href:"/skills/installed",className:"block","data-testid":"more-link-skills-installed",children:(0,s.jsxs)(o.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-foreground",children:a("dashboard.title")}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:a("dashboard.description")})]})})]})]}),(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:e("title")}),(0,s.jsx)(C,{})]}),(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:"External Apps"}),(0,s.jsx)(b,{})]}),(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:"About"}),(0,s.jsx)(o.Zp,{children:(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:"CommandMate - A local control plane for agent CLIs."})})]})]})})}a(72604),a(95275),a(79832)}},e=>{e.O(0,[6809,4909,2770,790,4974,6402,3898,6381,5229,4322,8441,1255,7358],()=>e(e.s=80867)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{6473:(e,t,s)=>{"use strict";s.d(t,{Lc:()=>a,qz:()=>n});let n="animate-in fade-in-0 slide-in-from-bottom-2 fill-mode-backwards duration-300";function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(Number.isFinite(e)&&!(e<=0)&&!(e>=s))return"".concat(e*t,"ms")}},53292:(e,t,s)=>{"use strict";s.d(t,{Ll:()=>n,bu:()=>a});let n=2e3,a=4e3},54799:(e,t,s)=>{Promise.resolve().then(s.bind(s,75590))},75590:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>K});var n=s(95155),a=s(15229),o=s(66966),i=s(12115),r=s(18955);function d(e){let{worktrees:t}=e,s=(0,r.c)("home"),{runningCount:a,waitingCount:o}=(0,i.useMemo)(()=>{let e=0,s=0;for(let n of t)n.isSessionRunning&&(e++,n.isWaitingForResponse&&s++);return{runningCount:e,waitingCount:s}},[t]);return(0,n.jsxs)("div",{className:"mb-8",children:[(0,n.jsx)("h1",{className:"text-2xl font-semibold text-foreground",children:s("title")}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":"home-subline",children:[(0,n.jsx)("span",{className:"tabular-nums","data-testid":"subline-running",children:a})," ",s("running"),(0,n.jsx)("span",{"aria-hidden":"true",children:" \xb7 "}),(0,n.jsx)("span",{className:"tabular-nums","data-testid":"subline-waiting",children:o})," ",s("waiting")]})]})}var l=s(52619),c=s.n(l),m=s(65229),u=s(61362),h=s(99051),x=s(13898),g=s(2317);function f(e){return"boolean"==typeof e}let p=[{key:"registerRepository",href:"/repositories"},{key:"sendFirstMessage",href:"/sessions"}];function j(e){let{worktrees:t,repositories:s,isLoading:a=!1,error:o=null}=e,d=(0,r.c)("home"),{value:l,setValue:j}=(0,g.V)({key:"commandmate:onboarding-dismissed",defaultValue:!1,validate:f}),[b,v]=(0,i.useState)(!1);(0,i.useEffect)(()=>v(!0),[]);let y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{hasRepository:(null!=t?t:[]).length>0,hasSentMessage:(null!=e?e:[]).some(e=>!!e.lastUserMessageAt)}}(t,s),w=y.hasRepository&&y.hasSentMessage,N=b&&!a&&null===o;return((0,i.useEffect)(()=>{N&&w&&!l&&j(!0)},[N,w,l,j]),!N||w||l)?null:(0,n.jsx)("div",{className:"mb-8",children:(0,n.jsxs)(x.Zp,{variant:"elevated","data-testid":"onboarding-checklist",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:d("onboarding.title")}),(0,n.jsx)(x.$n,{variant:"ghost",size:"sm","aria-label":d("onboarding.dismiss"),"data-testid":"onboarding-dismiss",onClick:()=>j(!0),children:(0,n.jsx)(m.A,{size:16,"aria-hidden":"true"})})]}),(0,n.jsx)("ol",{className:"mt-3 space-y-3",children:p.map(e=>{let{key:t,href:s}=e,a="registerRepository"===t?y.hasRepository:y.hasSentMessage;return(0,n.jsxs)("li",{className:"flex items-center gap-3","data-testid":"onboarding-step-".concat(t),"data-complete":a,children:[a?(0,n.jsx)(u.A,{size:20,className:"shrink-0 text-success-foreground","aria-hidden":"true"}):(0,n.jsx)(h.A,{size:20,className:"shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 text-sm ".concat(a?"text-muted-foreground line-through":"text-foreground"),children:d("onboarding.steps.".concat(t))}),!a&&(0,n.jsx)(c(),{href:s,"data-testid":"onboarding-action-".concat(t),className:"shrink-0 rounded-md bg-accent-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:bg-accent-500 dark:hover:bg-accent-600",children:d("onboarding.actions.".concat(t))})]},t)})})]})})}var b=s(87531),v=s(44308),y=s(24373);function w(e){let{worktrees:t,isLoading:s=!1}=e,a=(0,r.c)("home"),o=(0,i.useMemo)(()=>t.filter(e=>e.isSessionRunning).length,[t]),d=(0,i.useMemo)(()=>(0,y.Kg)(t),[t]);return s?(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3","data-testid":"home-session-summary-loading",role:"status","aria-label":a("sessionSummary.loading"),children:[0,1].map(e=>(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,n.jsx)("div",{className:"flex h-4 items-center",children:(0,n.jsx)(x.EA,{className:"h-3 w-16"})}),(0,n.jsx)("div",{className:"flex h-9 items-center",children:(0,n.jsx)(x.EA,{className:"h-7 w-10"})})]},e))}):(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3","data-testid":"home-session-summary",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,n.jsx)(x.md,{status:o>0?"running":"idle",size:"sm",label:a("sessionSummary.running")}),a("sessionSummary.running")]}),(0,n.jsx)("div",{className:(0,b.cn)("text-3xl font-bold tabular-nums",o>0?"text-foreground":"text-muted-foreground"),"data-testid":"running-count",children:o})]}),(0,n.jsxs)(c(),{href:v.ks,"data-testid":"waiting-count-link","aria-label":a("sessionSummary.waitingLinkLabel",{count:d}),className:"block rounded-lg border border-border bg-surface-2 px-3 py-2 transition-colors hover:border-warning-border hover:bg-warning-subtle focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,n.jsx)(x.md,{status:d>0?"waiting":"idle",size:"sm",label:a("sessionSummary.waiting")}),a("sessionSummary.waiting")]}),(0,n.jsx)("div",{className:(0,b.cn)("text-3xl font-bold tabular-nums",d>0?"text-foreground":"text-muted-foreground"),"data-testid":"waiting-count",children:d})]})]})}var N=s(48481),k=s(7636),C=s(83012),S=s(38606);function A(e){var t;return null!=(t=e.lastUserMessageAt)?t:e.updatedAt}function E(e){let{worktrees:t,limit:s=5,isLoading:a=!1}=e,o=(0,r.c)("home"),d=(0,i.useMemo)(()=>[...t].sort((e,t)=>(0,k.nO)(A(e),A(t))).slice(0,s),[t,s]);return a?(0,n.jsx)("ul",{className:"space-y-1","data-testid":"recent-sessions-loading",role:"status","aria-label":o("recentSessions.loading"),children:Array.from({length:s},(e,t)=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-2 py-1.5",children:[(0,n.jsx)(x.EA,{className:"h-2 w-2 shrink-0 rounded-full"}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,n.jsx)(x.EA,{className:"h-4 w-2/5"}),(0,n.jsx)(x.EA,{className:"h-3 w-3/5"})]}),(0,n.jsx)(x.EA,{className:"h-3 w-8 shrink-0"})]},t))}):0===d.length?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"recent-sessions-empty",children:o("recentSessions.empty")}),(0,n.jsx)(c(),{href:"/repositories","data-testid":"recent-sessions-cta",className:"inline-block text-sm font-medium text-accent-600 transition-colors hover:text-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:text-accent-400 dark:hover:text-accent-300",children:o("recentSessions.cta")})]}):(0,n.jsx)("ul",{className:"space-y-1","data-testid":"recent-sessions",children:d.map(e=>{var t,s,a,o;let i=A(e),r=i?(0,C.Fx)(String(i)):"";return(0,n.jsx)("li",{children:(0,n.jsxs)(c(),{href:"/worktrees/".concat(e.id),"data-testid":"recent-session-".concat(e.id),className:"flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,n.jsx)(N.m,{"data-testid":"recent-status-dot-".concat(e.id),status:(0,S.kA)({isRunning:null!=(s=e.isSessionRunning)&&s,isWaitingForResponse:null!=(a=e.isWaitingForResponse)&&a,isProcessing:null!=(o=e.isProcessing)&&o}),waitingKind:(0,S.f_)(e).waitingKind,size:"sm"}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block truncate text-sm font-medium text-foreground",children:null!=(t=e.repositoryDisplayName)?t:e.repositoryName}),(0,n.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.name})]}),r&&(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:r})]})},e.id)})})}function R(e){let{worktrees:t,isLoading:s=!1}=e,a=(0,r.c)("home");return(0,n.jsxs)(x.Zp,{variant:"elevated",className:"h-full","data-testid":"session-overview-tile",children:[(0,n.jsx)("h2",{className:"mb-3 text-lg font-semibold text-foreground",children:a("sessionOverview.title")}),(0,n.jsx)(w,{worktrees:t,isLoading:s}),(0,n.jsxs)("div",{className:"mt-4 flex items-center justify-between",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:a("sessionOverview.recentSessions")}),(0,n.jsx)(c(),{href:"/sessions",className:"text-xs text-accent-600 hover:underline dark:text-accent-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","data-testid":"session-overview-view-all",children:a("sessionOverview.viewAll")})]}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)(E,{worktrees:t,isLoading:s})})]})}var M=s(36402),F=s(85872),I=s(53292);let L="commandmate-home-todo-repo";function T(e){var t;return(null==(t=e.repositoryDisplayName)?void 0:t.trim())||e.repositoryName||""}function z(){let e=(0,r.c)("home"),t=(0,r.c)("common"),s=(0,M.SC)(),[a,o]=(0,i.useState)([]),[d,l]=(0,i.useState)(""),[c,m]=(0,i.useState)([]),[u,h]=(0,i.useState)(""),[g,f]=(0,i.useState)(!1),[p,j]=(0,i.useState)(!1),[b,v]=(0,i.useState)(null),y=(0,i.useRef)(!1),w=(0,i.useMemo)(()=>c.filter(e=>!e.done).length,[c]);(0,i.useEffect)(()=>{!async function(){try{var e;let t=await fetch("/api/worktrees");if(!t.ok)return;let s=(null!=(e=(await t.json()).repositories)?e:[]).map(e=>({id:e.id,path:e.path,name:e.name,displayName:e.displayName}));if(o(s),s.length>0){let e=localStorage.getItem(L),t=e&&s.some(t=>t.id===e)?e:s[0].id;l(t)}}catch(e){}finally{y.current=!0}}()},[]);let N=(0,i.useCallback)(async()=>{f(!0),v(null);try{let e=await F.$C.listAll();m(e)}catch(t){v(t instanceof Error?t.message:e("todo.errors.load")),m([])}finally{f(!1)}},[e]);(0,i.useEffect)(()=>{N()},[N]),(0,i.useEffect)(()=>{d&&localStorage.setItem(L,d)},[d]);let k=(0,i.useCallback)(async()=>{let t=u.trim();if(t&&d&&!p){j(!0),v(null);try{await F.$C.create(d,t),h(""),await N()}catch(t){v(t instanceof Error?t.message:e("todo.errors.add"))}finally{j(!1)}}},[u,d,p,N,e]),C=(0,i.useCallback)(async t=>{m(e=>e.map(e=>e.id===t.id?{...e,done:!e.done}:e)),v(null);try{await F.$C.update(t.repositoryId,t.id,{done:!t.done})}catch(t){v(t instanceof Error?t.message:e("todo.errors.update")),N()}},[N,e]),S=(0,i.useCallback)(async n=>{if(await s({description:t("confirmDelete",{name:n.content}),variant:"danger"})){v(null);try{await F.$C.remove(n.repositoryId,n.id),m(e=>e.filter(e=>e.id!==n.id))}catch(t){v(t instanceof Error?t.message:e("todo.errors.delete"))}}},[e,s,t]),A=(0,i.useCallback)(e=>{"Enter"!==e.key||e.nativeEvent.isComposing||(e.preventDefault(),k())},[k]),E=a.length>0;return(0,n.jsxs)(x.Zp,{className:"h-full","data-testid":"home-todo-widget",children:[(0,n.jsx)("h2",{className:"mb-3 text-lg font-semibold text-foreground",children:e("todo.title")}),(0,n.jsxs)("div",{className:"flex flex-col gap-2 mb-3 sm:flex-row sm:items-center sm:justify-between sm:gap-3","data-testid":"todo-selector-row",children:[(0,n.jsxs)("label",{className:"flex items-center gap-2 text-sm text-muted-foreground min-w-0",children:[(0,n.jsx)("span",{className:"shrink-0",children:e("todo.repository")}),(0,n.jsx)("select",{value:d,onChange:e=>l(e.target.value),disabled:!E,"data-testid":"todo-repo-select",className:"min-w-0 flex-1 truncate rounded-md border border-input bg-surface dark:bg-surface-2 px-2 py-1 text-sm text-surface-foreground disabled:opacity-50 sm:flex-initial sm:max-w-[16rem]",children:a.map(e=>{var t;return(0,n.jsx)("option",{value:e.id,children:(null==(t=e.displayName)?void 0:t.trim())||e.name},e.id)})})]}),E&&(0,n.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground","data-testid":"todo-remaining",children:e("todo.open",{count:w})})]}),E?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,n.jsx)(x.pd,{type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:A,maxLength:I.Ll,placeholder:e("todo.inputPlaceholder"),"data-testid":"todo-input",className:"w-auto flex-1 min-w-0"}),(0,n.jsx)(x.$n,{type:"button",variant:"primary",size:"sm",onClick:k,disabled:p||0===u.trim().length,"data-testid":"todo-add-button",className:"shrink-0",children:e("todo.add")})]}),b&&(0,n.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"todo-error",children:b}),g&&0===c.length?(0,n.jsx)("ul",{className:"space-y-1","data-testid":"todo-loading",role:"status","aria-label":e("todo.loading"),children:[0,1,2].map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-1 py-1",children:[(0,n.jsx)(x.EA,{className:"h-4 w-4 shrink-0 rounded"}),(0,n.jsx)(x.EA,{className:"h-4 ".concat(1===e?"w-2/3":"w-5/6")})]},e))}):0===c.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"todo-empty",children:e("todo.empty")}):(0,n.jsx)("ul",{className:"space-y-1","data-testid":"todo-list",children:c.map(t=>(0,n.jsxs)("li",{className:"flex flex-col gap-1 rounded-md px-1 py-1 hover:bg-muted group sm:flex-row sm:items-center sm:gap-2","data-testid":"todo-item",children:[(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,n.jsx)("label",{className:"shrink-0 inline-flex min-h-[44px] min-w-[44px] cursor-pointer items-center justify-center sm:min-h-0 sm:min-w-0",children:(0,n.jsx)(x.Sc,{checked:t.done,onCheckedChange:()=>C(t),"data-testid":"todo-checkbox","aria-label":t.done?e("todo.markAsNotDone"):e("todo.markAsDone")})}),(0,n.jsx)("span",{className:"min-w-0 flex-1 break-words text-sm ".concat(t.done?"line-through text-muted-foreground":"text-foreground"),children:t.content})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[T(t)&&(0,n.jsx)("span",{className:"shrink-0 max-w-[8rem] truncate rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground","data-testid":"todo-repo-badge",title:T(t),children:T(t)}),(0,n.jsx)("button",{type:"button",onClick:()=>S(t),"aria-label":e("todo.delete"),"data-testid":"todo-delete",className:"inline-flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center text-muted-foreground opacity-100 transition-opacity hover:text-danger-foreground sm:min-h-0 sm:min-w-0 sm:opacity-0 sm:group-hover:opacity-100",children:(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},t.id))})]}):(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("todo.noRepositories")})]})}var U=s(37586),D=s(66685),O=s(24533),P=s(37772),$=s(6473);let _=[{key:"chat",href:"/chat",icon:(0,n.jsx)(U.A,{size:20,"aria-hidden":"true"})},{key:"sessions",href:"/sessions",icon:(0,n.jsx)(D.A,{size:20,"aria-hidden":"true"})},{key:"repositories",href:"/repositories",icon:(0,n.jsx)(O.A,{size:20,"aria-hidden":"true"})},{key:"review",href:"/review",icon:(0,n.jsx)(u.A,{size:20,"aria-hidden":"true"})},{key:"more",href:"/more",icon:(0,n.jsx)(P.A,{size:20,"aria-hidden":"true"})}];function J(){let e=(0,r.c)("common");return(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-5","data-testid":"home-quick-actions",children:_.map((t,s)=>{let a=e("nav.".concat(t.key));return(0,n.jsx)(c(),{href:t.href,"aria-label":a,className:"group block rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","data-testid":"quick-action-".concat(t.key),children:(0,n.jsxs)(x.Zp,{interactive:!0,padding:"sm",style:{animationDelay:(0,$.Lc)(s)},className:"flex h-full flex-col items-center justify-center gap-1.5 py-3 text-center hover:border-accent-300 dark:hover:border-accent-700 ".concat($.qz),children:[(0,n.jsx)("span",{className:"text-muted-foreground group-hover:text-accent-600 dark:group-hover:text-accent-400 transition-colors",children:t.icon}),(0,n.jsx)("span",{className:"text-xs font-medium text-foreground",children:a})]})},t.href)})})}function K(){let{worktrees:e,repositories:t,isLoading:s,error:i}=(0,o.Fn)(),r=s&&0===e.length;return(0,n.jsx)(a.GV,{children:(0,n.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,n.jsx)(d,{worktrees:e}),(0,n.jsx)(j,{worktrees:e,repositories:t,isLoading:r,error:i}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-12","data-testid":"home-bento-grid",children:[(0,n.jsx)("div",{className:"md:col-span-8",children:(0,n.jsx)(R,{worktrees:e,isLoading:r})}),(0,n.jsx)("div",{className:"md:col-span-4",children:(0,n.jsx)(z,{})}),(0,n.jsx)("div",{className:"md:col-span-12",children:(0,n.jsx)(J,{})})]})]})})}},83012:(e,t,s)=>{"use strict";s.d(t,{Fx:()=>i,bg:()=>r,fw:()=>o});var n=s(53298),a=s(73683);function o(e,t){let s=new Date(e);return isNaN(s.getTime())?"":(0,n.m)(s,{addSuffix:!0,...t?{locale:t}:{}})}function i(e){let t=new Date(e);if(isNaN(t.getTime()))return"";let s=Math.round((Date.now()-t.getTime())/1e3);if(s<45)return"now";let n=Math.round(s/60);if(n<60)return"".concat(n,"m ago");let a=Math.round(n/60);if(a<24)return"".concat(a,"h ago");let o=Math.round(a/24);return o<7?"".concat(o,"d ago"):o<30?"".concat(Math.round(o/7),"w ago"):o<365?"".concat(Math.round(o/30),"mo ago"):"".concat(Math.round(o/365),"y ago")}function r(e,t){return!(e instanceof Date)||isNaN(e.getTime())?"":(0,a.GP)(e,"PPp",t?{locale:t}:void 0)}},85872:(e,t,s)=>{"use strict";async function n(e,t){throw Error((await e.json().catch(()=>({}))).error||"".concat(t," (").concat(e.status,")"))}s.d(t,{$C:()=>a,Ar:()=>i,KG:()=>o});let a={async list(e){var t;let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos"));return s.ok?null!=(t=(await s.json()).todos)?t:[]:n(s,"Failed to load todos")},async listAll(){var e;let t=await fetch("/api/todos");return t.ok?null!=(e=(await t.json()).todos)?e:[]:n(t,"Failed to load todos")},async create(e,t){let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});return s.ok?(await s.json()).todo:n(s,"Failed to create todo")},async update(e,t,s){let a=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return a.ok?(await a.json()).todo:n(a,"Failed to update todo")},async remove(e,t){let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"DELETE"});s.ok||await n(s,"Failed to delete todo")}},o=["todo","doing","done"],i={async list(e){var t;let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"));return s.ok?null!=(t=(await s.json()).todos)?t:[]:n(s,"Failed to load todos")},async create(e,t,s){let a=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(void 0!==s?{content:t,detail:s}:{content:t})});return a.ok?(await a.json()).todo:n(a,"Failed to create todo")},async update(e,t,s){let a=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return a.ok?(await a.json()).todo:n(a,"Failed to update todo")},async remove(e,t){let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"DELETE"});s.ok||await n(s,"Failed to delete todo")},async reorder(e,t){let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({todoIds:t})});s.ok||await n(s,"Failed to reorder todos")}}}},e=>{e.O(0,[6809,4909,2770,790,4974,9948,6402,3898,6381,5229,8441,1255,7358],()=>e(e.s=54799)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3135],{540:(e,t,s)=>{Promise.resolve().then(s.bind(s,24502))},9219:(e,t,s)=>{"use strict";s.d(t,{k:()=>i});var r=s(95155),a=s(12115),l=s(13898),n=s(87531);function i(e){let{onRefresh:t,enabled:s=!0,className:i,children:o}=e,{containerRef:c,pullDistance:d,isRefreshing:u,isPulling:p}=function(e){let{onRefresh:t,enabled:s=!0,threshold:r=64,maxPull:l=96,resistance:n=.5}=e,i=(0,a.useRef)(null),[o,c]=(0,a.useState)(0),[d,u]=(0,a.useState)(!1),[p,m]=(0,a.useState)(!1),h=(0,a.useRef)(null),x=(0,a.useRef)(0),f=(0,a.useRef)(!1);f.current=d;let g=(0,a.useCallback)(()=>{h.current=null,x.current=0,c(0),m(!1)},[]),b=(0,a.useCallback)(e=>{if(!s||f.current)return;let t=i.current;t&&!(t.scrollTop>0)&&(h.current=e.touches[0].clientY,x.current=0)},[s]),v=(0,a.useCallback)(e=>{if(null===h.current)return;let t=i.current;if(!t)return;if(t.scrollTop>0)return void g();let s=e.touches[0].clientY-h.current;if(s<=0){0!==x.current&&(x.current=0,c(0),m(!1));return}e.cancelable&&e.preventDefault();let r=Math.min(s*n,l);x.current=r,c(r),m(!0)},[n,l,g]),y=(0,a.useCallback)(async()=>{u(!0),m(!1),c(r);try{await Promise.resolve(t())}finally{u(!1),c(0)}},[t,r]),j=(0,a.useCallback)(()=>{if(null===h.current)return;let e=x.current>=r&&!f.current;h.current=null,x.current=0,e?y():(c(0),m(!1))},[r,y]);return(0,a.useEffect)(()=>{let e=i.current;if(e)return e.addEventListener("touchstart",b,{passive:!0}),e.addEventListener("touchmove",v,{passive:!1}),e.addEventListener("touchend",j,{passive:!0}),e.addEventListener("touchcancel",j,{passive:!0}),()=>{e.removeEventListener("touchstart",b),e.removeEventListener("touchmove",v),e.removeEventListener("touchend",j),e.removeEventListener("touchcancel",j)}},[b,v,j]),{containerRef:i,pullDistance:o,isRefreshing:d,isPulling:p}}({onRefresh:t,enabled:s,threshold:64}),m=u||d>0,h=u?1:Math.min(d/64,1);return(0,r.jsxs)("div",{ref:c,className:(0,n.cn)("relative overflow-auto",i),style:{overscrollBehaviorY:"contain"},"data-testid":"pull-to-refresh",children:[(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex justify-center",style:{transform:"translateY(".concat(m?Math.max(d-24,8):-32,"px)"),opacity:h,transition:p?"none":"transform 0.2s ease-out, opacity 0.2s ease-out"},"data-testid":"pull-to-refresh-indicator",role:"status","aria-hidden":!u,children:(0,r.jsx)(l.y$,{size:"sm",variant:"accent"})}),(0,r.jsx)("div",{style:{transform:m?"translateY(".concat(d,"px)"):void 0,transition:p?"none":"transform 0.2s ease-out"},children:o})]})}},18514:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},24502:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>A});var r=s(95155),a=s(12115),l=s(15229),n=s(9219),i=s(38218),o=s(18955),c=s(58734),d=s(13898),u=s(80344);class p{static getInstance(){return p.instance||(p.instance=new p),p.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return"https://".concat(t[1],"/").concat(t[3]).toLowerCase().replace(/\/$/,"");let s=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return s?"https://".concat(s[1],"/").concat(s[2]).toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let s=e.match(/:(.+?)(\.git)?$/);if(s&&e.startsWith("git@")){let e=s[1].split("/");return e[e.length-1]}let r=e.match(/\/([^\/]+?)(\.git)?$/);return r?r[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")?/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:{valid:!1,error:"INVALID_URL_FORMAT"}}constructor(){}}var m=s(27937),h=s(59847);let x=(0,s(71847).A)("corner-left-up",[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]);var f=s(39332);let g="w-full min-h-[44px] flex items-center gap-2 px-3 py-2 rounded-md text-left text-sm text-foreground hover:bg-muted transition-colors touch-manipulation";function b(e){var t,s;let{isOpen:l,onClose:n,onSelect:i,initialPath:c}=e,p=(0,o.c)("common"),[b,v]=(0,a.useState)(null),[y,j]=(0,a.useState)(!1),[N,k]=(0,a.useState)(null),w=(0,a.useCallback)(async e=>{j(!0),k(null);try{v(await u.gC.browse(e))}catch(e){k((0,u.hS)(e))}finally{j(!1)}},[]);(0,a.useEffect)(()=>{if(!l)return;let e=!1;return(async()=>{j(!0),k(null);try{let t=await u.gC.browse(c);if(e)return;let s=c?void 0:t.recentPaths[0];if(s)try{let t=await u.gC.browse(s);e||v(t);return}catch(t){if(e)return}v(t)}catch(t){e||k((0,u.hS)(t))}finally{e||j(!1)}})(),()=>{e=!0}},[l,c]);let C=(0,a.useCallback)(async()=>{let e=null==b?void 0:b.path;e&&(await u.gC.addRecentPath(e).catch(()=>void 0),i(e),n())},[null==b?void 0:b.path,i,n]),S=function(e,t){let s=[{label:"/",path:null}];if(!e)return s;let r=t.filter(t=>e===t||e.startsWith("".concat(t,"/"))).sort((e,t)=>t.length-e.length)[0];if(!r)return s.push({label:e,path:e}),s;s.push({label:r,path:r});let a=e.slice(r.length).split("/").filter(Boolean),l=r;for(let e of a)l="".concat(l,"/").concat(e),s.push({label:e,path:l});return s}(null!=(t=null==b?void 0:b.path)?t:null,null!=(s=null==b?void 0:b.roots)?s:[]),R=null!==b&&null===b.path;return(0,r.jsx)(d.Jh,{isOpen:l,onClose:n,title:p("repositories.pickerTitle"),size:"full",children:(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-12rem)] md:h-[26rem]",children:[(0,r.jsx)("nav",{"aria-label":p("repositories.pickerTitle"),className:"flex items-center flex-wrap gap-1 pb-2 border-b border-border text-xs",children:S.map((e,t)=>{var s;return(0,r.jsxs)(a.Fragment,{children:[t>0&&(0,r.jsx)(m.A,{className:"w-3 h-3 text-muted-foreground flex-shrink-0","aria-hidden":!0}),(0,r.jsx)("button",{type:"button",onClick:()=>{var t;w(null!=(t=e.path)?t:void 0)},disabled:t===S.length-1,className:"min-h-[32px] px-1.5 rounded font-mono text-muted-foreground hover:text-foreground hover:bg-muted disabled:text-foreground disabled:font-semibold disabled:hover:bg-transparent touch-manipulation",children:e.label})]},null!=(s=e.path)?s:"roots")})}),(0,r.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto py-2",children:[y&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground",children:[(0,r.jsx)(d.y$,{size:"sm"}),p("repositories.pickerLoading")]}),!y&&N&&(0,r.jsx)("p",{className:"px-3 py-2 text-sm text-danger-foreground",children:N}),!y&&!N&&b&&(0,r.jsxs)(r.Fragment,{children:[R&&b.recentPaths.length>0&&(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsx)("p",{className:"px-3 pb-1 text-xs font-medium text-muted-foreground",children:p("repositories.pickerRecentLabel")}),b.recentPaths.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>void w(e),className:g,children:[(0,r.jsx)(h.A,{className:"w-4 h-4 text-muted-foreground flex-shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"font-mono truncate",children:e})]},e))]}),R&&(0,r.jsx)("p",{className:"px-3 pb-1 text-xs font-medium text-muted-foreground",children:p("repositories.pickerRootsLabel")}),b.parent&&(0,r.jsxs)("button",{type:"button",onClick:()=>{var e;w(null!=(e=b.parent)?e:void 0)},className:g,children:[(0,r.jsx)(x,{className:"w-4 h-4 text-muted-foreground flex-shrink-0","aria-hidden":!0}),p("repositories.pickerUp")]}),b.entries.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>void w(e.path),className:g,children:[(0,r.jsx)(h.A,{className:"w-4 h-4 text-muted-foreground flex-shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"font-mono truncate flex-1",children:e.name}),e.isGitRepo&&(0,r.jsxs)(d.Ex,{variant:"info",className:"flex-shrink-0",children:[(0,r.jsx)(f.A,{className:"w-3 h-3 mr-1","aria-hidden":!0}),null===e.worktreeCount?"git":p("repositories.pickerWorktreeCount",{count:e.worktreeCount})]})]},e.path)),0===b.entries.length&&(0,r.jsx)("p",{className:"px-3 py-2 text-sm text-muted-foreground",children:p("repositories.pickerEmpty")}),b.truncated&&(0,r.jsx)("p",{className:"px-3 py-2 text-xs text-warning-foreground",children:p("repositories.pickerTruncated",{limit:b.entryLimit})})]})]}),(0,r.jsxs)("div",{className:"flex gap-2 pt-2 border-t border-border",children:[(0,r.jsx)(d.$n,{type:"button",variant:"primary",onClick:()=>void C(),disabled:!(null==b?void 0:b.path),className:"min-h-[44px]",children:p("repositories.pickerSelectHere")}),(0,r.jsx)(d.$n,{type:"button",variant:"ghost",onClick:n,className:"min-h-[44px]",children:p("cancel")})]})]})})}let v={ok:"text-success-foreground",warn:"text-warning-foreground",error:"text-danger-foreground"};function y(e){var t,s,l,n,i,m;let{onRepositoryAdded:h}=e,x=(0,o.c)("common"),[f,g]=(0,a.useState)(!1),[y,j]=(0,a.useState)("local"),[N,k]=(0,a.useState)(""),[w,C]=(0,a.useState)(""),[S,R]=(0,a.useState)(!1),[E,A]=(0,a.useState)(!1),[L,T]=(0,a.useState)(!1),[$,D]=(0,a.useState)(!1),[P,z]=(0,a.useState)(null),[M,O]=(0,a.useState)(null),[U,_]=(0,a.useState)(null),[I,F]=(0,a.useState)(!1),[V,W]=(0,a.useState)([]),[H,B]=(0,a.useState)(null),[Y,G]=(0,a.useState)(null),[q,Z]=(0,a.useState)(null),K=p.getInstance(),X=(0,a.useCallback)(async e=>{try{let s=await u.Rx.getCloneStatus(e);if("completed"===s.status)_(x("repositories.cloneSuccess")),D(!1),z(null),C(""),R(!1),g(!1),h&&h();else if("failed"===s.status){var t;O((null==(t=s.error)?void 0:t.message)||x("repositories.cloneFailed")),D(!1),z(null)}else("running"===s.status||"pending"===s.status)&&setTimeout(()=>X(e),2e3)}catch(e){O((0,u.hS)(e)),D(!1),z(null)}},[h,x]);(0,a.useEffect)(()=>{P&&$&&X(P)},[P,$]),(0,a.useEffect)(()=>{if(!f)return;let e=!1;return u.gC.browse().then(t=>{e||W(t.roots)}).catch(()=>void 0),()=>{e=!0}},[f]),(0,a.useEffect)(()=>{let e=N.trim();if(!e){B(null),G(null);return}let t=!1,s=setTimeout(()=>{u.Rx.validatePath(e).then(s=>{t||(B(s),G(e))}).catch(()=>{t||(B(null),G(null))})},400);return()=>{t=!0,clearTimeout(s)}},[N]);let J=(0,a.useCallback)(async e=>{var t,s;let r;if(Y===e&&H)return null!=(t=H.duplicateScanRoots)?t:[];try{let t=await Promise.race([u.Rx.validatePath(e).then(t=>(B(t),G(e),t)),new Promise(e=>{r=setTimeout(()=>e(null),400)})]);return null!=(s=null==t?void 0:t.duplicateScanRoots)?s:[]}catch(e){return[]}finally{void 0!==r&&clearTimeout(r)}},[H,Y]),Q=(0,a.useCallback)(async e=>{try{let t=await u.Rx.scan(e);_(t.message),k(""),g(!1),h&&h()}catch(e){O((0,u.hS)(e))}},[h]),ee=async e=>{e.preventDefault();let t=N.trim();if(!t)return void O(x("repositories.pathRequired"));O(null),_(null),A(!0);try{let e=await J(t);if(e.length>0)return void Z({path:t,duplicates:e});await Q(t)}finally{A(!1)}},et=(0,a.useCallback)(()=>{Z(null),q&&(A(!0),Q(q.path).finally(()=>A(!1)))},[q,Q]),es=async e=>{if(e.preventDefault(),!w.trim())return void O(x("repositories.urlRequired"));let t=K.validate(w.trim());if(!t.valid)return void("EMPTY_URL"===t.error?O(x("repositories.urlRequired")):O(x("repositories.urlInvalid")));O(null),_(null),D(!0);try{let e=await u.Rx.clone(w.trim(),{fork:S});z(e.jobId)}catch(e){O((0,u.hS)(e)),D(!1)}},er=async()=>{O(null),_(null),T(!0);try{let e=await u.Rx.sync();_(e.message),h&&h()}catch(e){O((0,u.hS)(e))}finally{T(!1)}},ea=()=>{g(!1),k(""),C(""),R(!1),O(null),j("local"),Z(null)},el=H?(n=x,(i=H).valid?i.isGitRepo?{message:n("repositories.validationGitRepo",{count:null!=(m=i.worktreeCount)?m:1}),intent:"ok"}:{message:n("repositories.validationNotGitRepo"),intent:"warn"}:"not-found"===i.reason?{message:n("repositories.validationNotFound"),intent:"error"}:{message:n("repositories.validationOutsideRoots",{roots:i.allowedRootsLabel}),intent:"error"}):null,en=null!=(t=null==H?void 0:H.duplicateScanRoots)?t:[];return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[!f&&(0,r.jsxs)(d.$n,{"data-testid":"add-repository-button",variant:"primary",size:"sm",onClick:()=>g(!0),children:["+ ",x("repositories.add")]}),(0,r.jsx)(d.$n,{"data-testid":"sync-all-button",variant:"secondary",size:"sm",onClick:er,disabled:L,children:L?x("repositories.syncing"):x("repositories.syncAll")})]}),f&&(0,r.jsx)(d.Zp,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{children:(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2 text-foreground",children:x("repositories.addNewTitle")})}),(0,r.jsxs)(d.tU,{value:y,onValueChange:e=>j(e),children:[(0,r.jsxs)(d.j7,{className:"w-full",children:[(0,r.jsx)(d.Xi,{value:"local",children:x("repositories.localPathTab")}),(0,r.jsx)(d.Xi,{value:"url",children:x("repositories.cloneUrlTab")})]}),(0,r.jsx)(d.av,{value:"local",children:(0,r.jsxs)("form",{onSubmit:ee,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:x("repositories.localPathDescription")}),(0,r.jsx)("label",{htmlFor:"repositoryPath",className:"block text-sm font-medium text-foreground mb-2",children:x("repositories.localPathLabel")}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.pd,{id:"repositoryPath","data-testid":"repository-path-input",type:"text",value:N,onChange:e=>k(e.target.value),placeholder:"/absolute/path/to/repository",className:"font-mono flex-1",disabled:E}),(0,r.jsxs)(d.$n,{type:"button",variant:"secondary",onClick:()=>F(!0),disabled:E,className:"min-h-[44px] flex-shrink-0",children:[(0,r.jsx)(c.A,{className:"w-4 h-4 mr-1","aria-hidden":!0}),x("repositories.browse")]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:x("repositories.localPathExample",{example:V[0]?"".concat(V[0],"/my-repo"):"/Users/username/projects/my-repo"})}),V.length>0&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:x("repositories.localPathAllowedRoots",{roots:V.join(", ")})}),el&&(0,r.jsx)("p",{className:"text-xs mt-1 ".concat(v[el.intent]),children:el.message}),en.length>0&&(0,r.jsx)("p",{className:"text-xs mt-1 text-warning-foreground break-all","data-testid":"duplicate-scan-root-warning",children:x("repositories.duplicateScanRootWarning",{paths:en.join(", ")})})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.$n,{"data-testid":"repository-scan-submit",type:"submit",variant:"primary",disabled:E||!N.trim(),children:E?x("repositories.scanning"):x("repositories.scan")}),(0,r.jsx)(d.$n,{type:"button",variant:"ghost",onClick:ea,disabled:E,children:x("cancel")})]})]})}),(0,r.jsx)(d.av,{value:"url",children:(0,r.jsxs)("form",{onSubmit:es,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:x("repositories.cloneUrlDescription")}),(0,r.jsx)("label",{htmlFor:"cloneUrl",className:"block text-sm font-medium text-foreground mb-2",children:x("repositories.cloneUrlLabel")}),(0,r.jsx)(d.pd,{id:"cloneUrl",type:"text",value:w,onChange:e=>C(e.target.value),placeholder:"https://github.com/user/repo.git",className:"font-mono",disabled:$}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:x("repositories.cloneUrlHelp")})]}),(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("input",{id:"forkBeforeClone",type:"checkbox",checked:S,onChange:e=>R(e.target.checked),disabled:$,className:"mt-1"}),(0,r.jsxs)("label",{htmlFor:"forkBeforeClone",className:"text-sm text-foreground",children:[x("repositories.forkOptionLabel"),(0,r.jsx)("span",{className:"block text-xs text-muted-foreground",children:x("repositories.forkOptionHelp")})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.$n,{type:"submit",variant:"primary",disabled:$||!w.trim(),children:$?x("repositories.cloning"):S?x("repositories.forkAndClone"):x("repositories.clone")}),(0,r.jsx)(d.$n,{type:"button",variant:"ghost",onClick:ea,disabled:$,children:x("cancel")})]})]})})]})]})}),U&&(0,r.jsx)("div",{className:"p-4 bg-success-subtle border border-success-border rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-success-foreground",children:U})}),M&&(0,r.jsx)("div",{className:"p-4 bg-danger-subtle border border-danger-border rounded-lg",children:(0,r.jsx)("p",{className:"text-sm text-danger-foreground",children:M})}),(0,r.jsx)(b,{isOpen:I,onClose:()=>F(!1),onSelect:e=>{k(e),O(null)}}),(0,r.jsx)(d.TM,{isOpen:null!==q,title:x("repositories.duplicateConfirmTitle"),description:x("repositories.duplicateConfirmBody",{path:null!=(s=null==q?void 0:q.path)?s:"",paths:(null!=(l=null==q?void 0:q.duplicates)?l:[]).join("\n")}),confirmLabel:x("repositories.duplicateConfirmAction"),variant:"default",onConfirm:et,onCancel:()=>Z(null)})]})}var j=s(18514),N=s(87531);let k={id:null,value:"",error:null,saving:!1};function w(){return(0,r.jsx)("thead",{className:"bg-muted border-b border-border",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Name"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Display name"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Visibility"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Path"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Worktrees"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Scan"}),(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium text-foreground",children:"Actions"})]})})}function C(e){let{repo:t,pending:s,onToggle:a}=e,l=t.visible;return(0,r.jsxs)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":l?"Hide ".concat(t.name," from sidebar"):"Show ".concat(t.name," in sidebar"),"data-testid":"visibility-toggle-".concat(t.id),onClick:()=>a(t),disabled:s,className:(0,N.cn)("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-60 disabled:cursor-not-allowed"),children:[(0,r.jsx)(d.md,{status:l?"ready":"idle",size:"sm",label:l?"Visible":"Hidden","aria-hidden":"true"}),l?"Visible":"Hidden"]})}function S(e){let{repo:t,pending:s,onToggle:a,registerRef:l}=e,n=t.enabled;return(0,r.jsxs)("button",{ref:e=>l(t.id,e),type:"button",role:"switch","aria-checked":n,"aria-label":n?"Exclude ".concat(t.name," from repository scans"):"Include ".concat(t.name," in repository scans"),"data-testid":"scan-toggle-".concat(t.id),onClick:()=>a(t),disabled:s,className:(0,N.cn)("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-60 disabled:cursor-not-allowed"),children:[(0,r.jsx)(d.md,{status:n?"ready":"idle",size:"sm",label:n?"Enabled":"Disabled","aria-hidden":"true"}),n?"Enabled":"Disabled"]})}function R(e){var t;let{repo:s,onNavigateToScanToggle:a}=e,l=(0,o.c)("common"),n=null!=(t=s.duplicateOf)?t:[];if(0===n.length)return null;let i=l("repositories.duplicateRowDetail",{paths:n.join(", ")});return(0,r.jsx)("button",{type:"button","data-testid":"duplicate-scan-root-".concat(s.id),onClick:()=>a(s.id),title:i,"aria-label":i,className:(0,N.cn)("rounded-full","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:(0,r.jsx)(d.Ex,{variant:"warning",children:l("repositories.duplicateRowBadge")})})}let E=(0,a.memo)(function(e){var t,s;let{refreshKey:l,onChanged:n}=e,i=(0,o.c)("common"),[c,p]=(0,a.useState)([]),[m,h]=(0,a.useState)(!0),[x,f]=(0,a.useState)(null),[g,b]=(0,a.useState)(k),[v,y]=(0,a.useState)(null),[E,A]=(0,a.useState)(new Set),[L,T]=(0,a.useState)(new Set),[$,D]=(0,a.useState)("all"),[P,z]=(0,a.useState)(null),M=(0,a.useRef)(new Map),O=(0,a.useCallback)((e,t)=>{t?M.current.set(e,t):M.current.delete(e)},[]),U=(0,a.useCallback)(e=>{var t;null==(t=M.current.get(e))||t.focus()},[]),_=(0,a.useCallback)(async()=>{h(!0),f(null);try{let e=await u.Rx.list();p(e.repositories)}catch(e){f((0,u.hS)(e))}finally{h(!1)}},[]);(0,a.useEffect)(()=>{_()},[_,l]);let I=(0,a.useCallback)(e=>{var t;b({id:e.id,value:null!=(t=e.displayName)?t:"",error:null,saving:!1}),y(null)},[]),F=(0,a.useCallback)(()=>{b(k)},[]),V=(0,a.useCallback)(e=>{b(t=>{if(null===t.id)return t;let s=e.length>100?"Display name must be ".concat(100," characters or less"):null;return{...t,value:e,error:s}})},[]),W=(0,a.useCallback)(async e=>{let t=g.value.trim();if(t.length>100)return void b(e=>({...e,error:"Display name must be ".concat(100," characters or less")}));b(e=>({...e,saving:!0,error:null}));try{let s=0===t.length?null:t,r=await u.Rx.updateDisplayName(e.id,s);p(t=>t.map(t=>t.id===e.id?{...t,...r.repository}:t)),b(k),y({type:"success",message:"Display name updated"}),n&&n()}catch(t){let e=(0,u.hS)(t);b(t=>({...t,saving:!1,error:e})),y({type:"error",message:e})}},[g.value,n]),H=(0,a.useCallback)((e,t)=>{"Enter"===e.key?(e.preventDefault(),W(t)):"Escape"===e.key&&(e.preventDefault(),F())},[F,W]),B=(0,a.useCallback)(async e=>{if(E.has(e.id))return;let t=!e.visible;A(t=>{let s=new Set(t);return s.add(e.id),s}),p(s=>s.map(s=>s.id===e.id?{...s,visible:t}:s)),y(null);try{let s=await u.Rx.updateVisibility(e.id,t);p(t=>t.map(t=>t.id===e.id?{...t,...s.repository}:t)),n&&n()}catch(t){p(t=>t.map(t=>t.id===e.id?{...e}:t)),y({type:"error",message:(0,u.hS)(t)})}finally{A(t=>{let s=new Set(t);return s.delete(e.id),s})}},[n,E]),Y=(0,a.useCallback)((e,t)=>{T(s=>{let r=new Set(s);return t?r.add(e):r.delete(e),r})},[]),G=(0,a.useCallback)(async e=>{Y(e.id,!0),y(null);try{let t=await u.Rx.updateEnabled(e.id,!1);p(s=>s.map(s=>{var r,a;if(s.id===e.id)return{...s,...t.repository,duplicateOf:[]};let l=(null!=(r=s.duplicateOf)?r:[]).filter(t=>t!==e.path);return l.length===(null!=(a=s.duplicateOf)?a:[]).length?s:{...s,duplicateOf:l}})),y({type:"success",message:i("repositories.disableSuccess",{name:e.name})}),n&&n()}catch(e){y({type:"error",message:(0,u.hS)(e)})}finally{Y(e.id,!1)}},[n,Y,i]),q=(0,a.useCallback)(async e=>{Y(e.id,!0),y(null);try{var t;let s=await u.Rx.restore(e.path);await _(),y({type:s.warning?"error":"success",message:null!=(t=s.warning)?t:i("repositories.enableSuccess",{name:e.name,count:s.worktreeCount})}),n&&n()}catch(e){y({type:"error",message:(0,u.hS)(e)})}finally{Y(e.id,!1)}},[_,n,Y,i]),Z=(0,a.useCallback)(e=>{if(!L.has(e.id)){if(e.enabled)return void z(e);q(e)}},[q,L]),K=(0,a.useCallback)(()=>{z(null),P&&G(P)},[G,P]),X=(0,a.useMemo)(()=>c.filter(e=>!e.enabled).length,[c]),J=(0,a.useMemo)(()=>"disabled"===$?c.filter(e=>!e.enabled):c,[$,c]);return m&&0===c.length?(0,r.jsx)(d.Zp,{padding:"none",children:(0,r.jsx)("div",{className:"overflow-x-auto","data-testid":"repository-list-loading",role:"status","aria-label":i("repositories.loading"),children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)(w,{}),(0,r.jsx)("tbody",{children:[0,1,2].map(e=>(0,r.jsxs)("tr",{className:"border-b border-border",children:[(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-24"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-20"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-16"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-48"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-10"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-14"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(d.EA,{className:"h-4 w-20"})})]},e))})]})})}):x?(0,r.jsx)(d.Zp,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("p",{className:"text-sm text-danger-foreground",children:["Failed to load repositories: ",x]}),(0,r.jsx)(d.$n,{variant:"secondary",size:"sm",onClick:()=>void _(),children:"Retry"})]})}):(0,r.jsxs)("div",{className:"space-y-3",children:[v&&(0,r.jsx)("div",{role:"status",className:"p-3 rounded-lg text-sm ".concat("success"===v.type?"bg-success-subtle border border-success-border text-success-foreground":"bg-danger-subtle border border-danger-border text-danger-foreground"),children:v.message}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(d.$n,{variant:"all"===$?"secondary":"ghost",size:"sm","aria-pressed":"all"===$,"data-testid":"repository-filter-all",onClick:()=>D("all"),children:i("repositories.filterAll",{count:c.length})}),(0,r.jsx)(d.$n,{variant:"disabled"===$?"secondary":"ghost",size:"sm","aria-pressed":"disabled"===$,"data-testid":"repository-filter-disabled",onClick:()=>D("disabled"),children:i("repositories.filterDisabled",{count:X})})]}),(0,r.jsx)(d.Zp,{padding:"none",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)(w,{}),(0,r.jsxs)("tbody",{children:[0===J.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:7,className:"px-4 py-6 text-center text-muted-foreground",children:"disabled"===$?i("repositories.emptyDisabled"):i("repositories.empty")})}),J.map(e=>{let t=g.id===e.id;return(0,r.jsxs)("tr",{className:(0,N.cn)("border-b border-border",!e.enabled&&"bg-muted/40"),"data-testid":"repository-row-".concat(e.id),children:[(0,r.jsx)("td",{className:"px-4 py-3 align-top text-foreground",children:(0,r.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[e.name,(0,r.jsx)(R,{repo:e,onNavigateToScanToggle:U})]})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:t?(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(d.pd,{"aria-label":"Edit display name for ".concat(e.name),type:"text",value:g.value,disabled:g.saving,maxLength:101,onChange:e=>V(e.target.value),onKeyDown:t=>H(t,e)}),g.error&&(0,r.jsx)("p",{className:"text-xs text-danger-foreground",children:g.error})]}):e.displayName?(0,r.jsx)("span",{className:"text-foreground",children:e.displayName}):(0,r.jsx)("span",{className:"text-muted-foreground","aria-hidden":"true",children:"—"})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(C,{repo:e,pending:E.has(e.id),onToggle:B})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)("span",{className:"block max-w-[240px] truncate font-mono text-xs text-muted-foreground",title:e.path,children:e.path})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top text-foreground",children:e.worktreeCount}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:(0,r.jsx)(S,{repo:e,pending:L.has(e.id),onToggle:Z,registerRef:O})}),(0,r.jsx)("td",{className:"px-4 py-3 align-top",children:t?(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(d.$n,{variant:"primary",size:"sm",onClick:()=>void W(e),disabled:g.saving||null!==g.error,children:g.saving?"Saving...":"Save"}),(0,r.jsx)(d.$n,{variant:"ghost",size:"sm",onClick:F,disabled:g.saving,children:"Cancel"})]}):(0,r.jsx)(d.$n,{variant:"ghost",size:"sm",className:"px-2",onClick:()=>I(e),"aria-label":"Edit display name for ".concat(e.name),children:(0,r.jsx)(j.A,{className:"h-4 w-4","aria-hidden":"true"})})})]},e.id)})]})]})})}),(0,r.jsx)(d.TM,{isOpen:null!==P,title:i("repositories.disableConfirmTitle"),description:i("repositories.disableConfirmBody",{name:null!=(t=null==P?void 0:P.name)?t:"",count:null!=(s=null==P?void 0:P.worktreeCount)?s:0}),confirmLabel:i("repositories.disableConfirmAction"),variant:"default",onConfirm:K,onCancel:()=>z(null)})]})});function A(){let e=(0,i.a)(),[t,s]=(0,a.useState)(0),o=(0,a.useCallback)(()=>{s(e=>e+1)},[]),c=(0,a.useCallback)(async()=>{s(e=>e+1),await new Promise(e=>setTimeout(e,500))},[]);return(0,r.jsx)(l.GV,{children:(0,r.jsxs)(n.k,{onRefresh:c,enabled:e,className:"container-custom py-8 h-full",children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Repositories"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage repositories and worktrees."})]}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(y,{onRepositoryAdded:o}),(0,r.jsx)(E,{refreshKey:t,onChanged:o})]})]})})}},27937:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},58734:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(71847).A)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]])}},e=>{e.O(0,[6809,4909,2770,790,4974,6402,3898,6381,5229,8441,1255,7358],()=>e(e.s=540)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8975],{17442:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>D});var r=a(95155),s=a(12115),n=a(18955),l=a(15229),i=a(13898),d=a(52619),o=a.n(d),c=a(20063),u=a(87531),m=a(44308),p=a(63001),x=a(38606),g=a(54014),h=a(46892);let f={in_review:"status.inReview",approval:"status.approval",stalled:"status.stalled"},v=m.DR,b={in_review:e=>"in_review"===e.status,approval:e=>!0===e.isWaitingForResponse,stalled:e=>!0===e.isStalled};function y(e){let{status:t,label:a}=e,s=(0,n.c)("common"),l=h.PL[t],i="".concat(a,": ").concat(s(l.labelKey)),d="w-2.5 h-2.5 rounded-full flex-shrink-0";return"spinner"===l.type?(0,r.jsx)("span",{className:"".concat(d," border-2 border-t-transparent animate-spin ").concat(l.className),title:i}):(0,r.jsx)("span",{className:"".concat(d," ").concat(l.className),title:i})}function j(){var e;let t=(0,n.c)("review"),[a,l]=(0,s.useState)([]),[d,h]=(0,s.useState)(!0),j=(0,c.useSearchParams)(),[w,N]=(0,s.useState)(()=>{var e;return null!=(e=(0,m._d)(null==j?void 0:j.get(m.z7)))?e:m.SD}),S=(0,s.useRef)(null),k=null!=(e=null==j?void 0:j.get(m.z7))?e:null;(0,s.useEffect)(()=>{let e=(0,m._d)(k);e&&N(e)},[k]);let C=(0,s.useCallback)(async()=>{try{let t=await fetch("/api/worktrees?include=review");if(t.ok){var e;let a=await t.json();l(null!=(e=a.worktrees)?e:[])}}catch(e){}finally{h(!1)}},[]);(0,s.useEffect)(()=>(C(),S.current=setInterval(C,m.Iu),()=>{S.current&&clearInterval(S.current)}),[C]);let E=(0,s.useMemo)(()=>a.filter(b[w]),[a,w]),T=(0,s.useMemo)(()=>({in_review:a.filter(b.in_review).length,approval:a.filter(b.approval).length,stalled:a.filter(b.stalled).length}),[a]),_=(0,s.useMemo)(()=>{switch(w){case"in_review":return t("empty.inReview");case"approval":return t("empty.approval");case"stalled":return t("empty.stalled")}},[w,t]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-6 inline-flex items-center gap-1 rounded-lg bg-muted p-1",role:"group","aria-label":t("filters.ariaLabel"),"data-testid":"review-filters",children:v.map(e=>{let a=w===e;return(0,r.jsxs)("button",{type:"button","aria-pressed":a,onClick:()=>N(e),"data-testid":"review-filter-".concat(e),className:(0,u.cn)("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",a?"bg-accent-500/15 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:text-foreground"),children:[t(f[e]),(0,r.jsx)("span",{className:(0,u.cn)("text-xs font-semibold tabular-nums",a?"text-accent-700 dark:text-accent-300":"text-muted-foreground"),children:T[e]})]},e)})}),d&&(0,r.jsx)("div",{className:"space-y-2","data-testid":"review-loading",role:"status","aria-label":t("filters.loading"),children:[0,1,2].map(e=>(0,r.jsx)(i.Zp,{padding:"md",children:(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,r.jsx)(i.EA,{className:"h-4 w-40 max-w-full"}),(0,r.jsx)(i.EA,{className:"h-3 w-24 max-w-full"})]}),(0,r.jsx)(i.EA,{className:"ml-4 h-5 w-16 flex-shrink-0"})]})},e))}),!d&&(0,r.jsx)("div",{className:"space-y-2","data-testid":"review-list",children:0===E.length?(0,r.jsx)("div",{className:"text-muted-foreground py-8 text-center","data-testid":"review-empty",children:_}):E.map(e=>{var a;let s=null!=(a=e.selectedAgents)?a:p.fJ;return(0,r.jsx)(o(),{href:"/worktrees/".concat(e.id),className:"block","data-testid":"review-item-".concat(e.id),children:(0,r.jsxs)(i.Zp,{padding:"md",className:"transition-colors ".concat(function(e){switch(e){case"in_review":return"border-info-border hover:border-info-border";case"approval":return"border-warning-border hover:border-warning-border";case"stalled":return"border-danger-border hover:border-danger-border"}}(w)),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:e.name}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.repositoryName})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-4 flex-shrink-0",children:[(0,r.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium rounded ".concat(function(e){switch(e){case"in_review":return"bg-info-subtle text-info-foreground";case"approval":return"bg-warning-subtle text-warning-foreground";case"stalled":return"bg-danger-subtle text-danger-foreground"}}(w)),children:t(f[w])}),s.map(t=>{var a;let s=(0,x.kA)(null==(a=e.sessionStatusByCli)?void 0:a[t]);return(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(y,{status:s,label:(0,g.oo)(t)}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,g.oo)(t)})]},t)})]})]}),e.description&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 whitespace-pre-wrap",children:e.description})})]})},e.id)})})]})}function w(e){let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(a,"-").concat(r)}function N(e){let{value:t,onChange:a}=e,s=(0,n.c)("review"),l=w(new Date),d=t===l;return(0,r.jsxs)("div",{className:"flex items-center gap-2","data-testid":"report-date-picker",children:[(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{let e=new Date(t+"T00:00:00");e.setDate(e.getDate()-1),a(w(e))},"data-testid":"date-prev","aria-label":s("datePicker.previousDay"),children:"<"}),(0,r.jsx)(i.pd,{type:"date",inputSize:"sm",value:t,max:l,onChange:e=>a(e.target.value),className:"w-auto","data-testid":"date-input"}),(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{if(d)return;let e=new Date(t+"T00:00:00");e.setDate(e.getDate()+1);let r=w(e);r>l||a(r)},disabled:d,"data-testid":"date-next","aria-label":s("datePicker.nextDay"),children:">"})]})}var S=a(36402),k=a(60322),C=a(9900);let E=[{value:"none",labelKey:"report.modes.none"},{value:"template",labelKey:"report.modes.template"},{value:"custom",labelKey:"report.modes.custom"}];function T(){let e=(0,n.c)("review"),t=(0,S.SC)(),[a,l]=(0,s.useState)(function(){let e=new Date,t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(a,"-").concat(r)}()),[d,o]=(0,s.useState)("claude"),[c,u]=(0,s.useState)(""),[p,x]=(0,s.useState)(null),[g,h]=(0,s.useState)(0),[f,v]=(0,s.useState)(""),[b,y]=(0,s.useState)(!1),[j,w]=(0,s.useState)(!1),[T,_]=(0,s.useState)(!1),[z,D]=(0,s.useState)(!1),[P,A]=(0,s.useState)(!1),[K,$]=(0,s.useState)(null),{mode:L,setMode:O,userInstruction:R,setUserInstruction:I,isUserInstructionReadOnly:M,templates:Z,selectedTemplateId:F,selectTemplate:J,isLoadingTemplates:U}=function(){let[e,t]=(0,s.useState)("none"),[a,r]=(0,s.useState)(""),[n,l]=(0,s.useState)([]),[i,d]=(0,s.useState)(null),[o,c]=(0,s.useState)(!1),u=(0,s.useCallback)(async()=>{c(!0);try{let e=await fetch("/api/templates");if(e.ok){let t=await e.json();l(t.templates||[])}}catch(e){}finally{c(!1)}},[]);(0,s.useEffect)(()=>{u()},[u]);let m=(0,s.useCallback)(e=>{t(e),r(""),d(null)},[]),p=(0,s.useCallback)(t=>{"custom"===e&&r(t)},[e]),x=(0,s.useCallback)(t=>{let a=n.find(e=>e.id===t);a&&"template"===e&&(d(t),r(a.content))},[n,e]);return{mode:e,setMode:m,userInstruction:a,setUserInstruction:p,isUserInstructionReadOnly:"template"===e,templates:n,selectedTemplateId:i,selectTemplate:x,isLoadingTemplates:o,refreshTemplates:u}}(),B=function(e){let[t,a]=(0,s.useState)({generating:!1}),r=(0,s.useRef)(null),n=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/daily-summary/status");if(e.ok){let t=await e.json();a(t)}}catch(e){}},[]);return(0,s.useEffect)(()=>e?(n(),r.current=setInterval(n,5e3),()=>{r.current&&(clearInterval(r.current),r.current=null)}):void a({generating:!1}),[e,n]),t}(!T),V=B.generating&&!T,q=(0,s.useCallback)(async t=>{w(!0),$(null);try{let a=await fetch("/api/daily-summary?date=".concat(t));if(!a.ok){let t=await a.json();$(t.error||e("report.errors.fetch"));return}let r=await a.json();x(r.report),h(r.messageCount),r.report?v(r.report.content):v(""),y(!1)}catch(t){$(e("report.errors.fetch"))}finally{w(!1)}},[e]);(0,s.useEffect)(()=>{q(a)},[a,q]);let[H,W]=(0,s.useState)(!1);(0,s.useEffect)(()=>{B.generating?W(!0):H&&(W(!1),q(a))},[B.generating,H,q,a]);let X=async()=>{if(!p||await t({description:e("report.regenerateConfirm")})){_(!0),$(null);try{let t={date:a,tool:d};"copilot"===d&&c.trim()&&(t.model=c.trim()),"none"!==L&&R.trim()&&(t.userInstruction=R.trim());let r=await fetch("/api/daily-summary",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(429===r.status)return void $(e("report.errors.rateLimited"));if(!r.ok){let t=await r.json();$(t.error||e("report.errors.generate"));return}let s=await r.json();x(s.report),v(s.report.content),y(!1)}catch(t){$(e("report.errors.generate"))}finally{_(!1)}}},Y=async()=>{if(!f.trim())return void $(e("report.errors.emptyContent"));D(!0),$(null);try{let t=await fetch("/api/daily-summary",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({date:a,content:f})});if(!t.ok){let a=await t.json();$(a.error||e("report.errors.save"));return}let r=await t.json();x(r.report),y(!1)}catch(t){$(e("report.errors.save"))}finally{D(!1)}};return(0,r.jsxs)("div",{"data-testid":"report-tab",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4 mb-6",children:[(0,r.jsx)(N,{value:a,onChange:e=>{l(e)}}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("label",{className:"text-sm text-muted-foreground",children:e("report.toolLabel")}),(0,r.jsx)("select",{value:d,onChange:e=>o(e.target.value),className:"px-3 py-1 text-sm rounded border border-input bg-surface dark:bg-surface-2 text-surface-foreground","data-testid":"tool-selector",children:m.IH.map(e=>(0,r.jsx)("option",{value:e,children:e},e))}),"copilot"===d&&(0,r.jsx)(i.pd,{type:"text",inputSize:"sm",placeholder:e("report.modelPlaceholder"),value:c,onChange:e=>u(e.target.value),className:"w-auto","data-testid":"model-input"})]})]}),(0,r.jsxs)("div",{className:"mb-4","data-testid":"generation-mode-selector",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-foreground mb-2 block",children:e("report.generationMode")}),(0,r.jsx)(i.z6,{value:L,onValueChange:e=>O(e),name:"generation-mode",className:"flex flex-row gap-4",children:E.map(t=>(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,r.jsx)(i.CU,{value:t.value,"data-testid":"mode-radio-".concat(t.value)}),(0,r.jsx)("span",{className:"text-foreground",children:e(t.labelKey)})]},t.value))})]}),"template"===L&&(0,r.jsxs)("div",{className:"mb-4","data-testid":"template-selector",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-foreground mb-2 block",children:e("report.selectTemplate")}),U?(0,r.jsx)(i.EA,{className:"h-9 w-full","data-testid":"report-template-loading",role:"status","aria-label":e("report.loadingTemplates"),"aria-hidden":void 0}):0===Z.length?(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:e("report.noTemplates")}):(0,r.jsxs)("select",{value:F||"",onChange:e=>J(e.target.value),className:"px-3 py-1 text-sm rounded border border-input bg-surface dark:bg-surface-2 text-surface-foreground","data-testid":"template-select",children:[(0,r.jsx)("option",{value:"",children:e("report.templatePlaceholderOption")}),Z.map(e=>(0,r.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),"none"!==L&&(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(i.k_,{value:R,onChange:e=>I(e.target.value),rows:3,maxLength:m.t7,readOnly:M,placeholder:"template"===L?e("report.instructionPlaceholderTemplate"):e("report.instructionPlaceholderCustom"),className:"resize-y ".concat(M?"bg-muted cursor-not-allowed":""),"data-testid":"user-instruction-input"})}),(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsx)(i.$n,{variant:"primary",onClick:X,disabled:T||V||0===g,"data-testid":"generate-button",children:T||V?e("report.generating"):e("report.generate")})}),(0,r.jsx)("div",{className:"mb-4 text-sm text-muted-foreground","data-testid":"message-count",children:j?(0,r.jsx)(i.EA,{className:"h-4 w-48"}):0===g?e("report.noMessages"):e("report.messagesFound",{count:g})}),K&&(0,r.jsx)("div",{className:"mb-4 p-3 bg-danger-subtle text-danger-foreground rounded-lg text-sm","data-testid":"report-error",children:K}),(T||V)&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4 text-sm text-muted-foreground","data-testid":"generating-spinner",children:[(0,r.jsx)(i.y$,{size:"sm",variant:"muted"}),V&&B.tool?B.startedAt?e("report.generatingRemoteWithTime",{tool:B.tool,seconds:Math.round((Date.now()-new Date(B.startedAt).getTime())/1e3)}):e("report.generatingRemote",{tool:B.tool}):e("report.generatingSummary")]}),!j&&p&&(0,r.jsxs)(i.Zp,{"data-testid":"report-content",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e("report.generatedBy",{tool:p.generatedByTool}),p.model&&" (".concat(p.model,")")]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:async()=>{await (0,k.l)(p.content),A(!0),setTimeout(()=>A(!1),C.pX)},"data-testid":"copy-report-button",children:P?e("report.copied"):e("report.copy")}),(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{b?Y():y(!0)},disabled:z,"data-testid":"edit-save-button",children:z?e("report.saving"):b?e("report.save"):e("report.edit")})]})]}),b?(0,r.jsx)(i.k_,{value:f,onChange:e=>v(e.target.value),className:"h-64 p-3 font-mono","data-testid":"report-editor"}):(0,r.jsx)("div",{className:"prose dark:prose-invert max-w-none text-sm whitespace-pre-wrap","data-testid":"report-preview",children:p.content})]})]})}function _(){let e=(0,n.c)("review"),t=(0,S.SC)(),[a,l]=(0,s.useState)([]),[d,o]=(0,s.useState)(!1),[c,u]=(0,s.useState)(null),[p,x]=(0,s.useState)(""),[g,h]=(0,s.useState)(""),[f,v]=(0,s.useState)(!1),[b,y]=(0,s.useState)(null),[j,w]=(0,s.useState)(""),[N,k]=(0,s.useState)(""),[C,E]=(0,s.useState)(!1),T=(0,s.useCallback)(async()=>{o(!0),u(null);try{let t=await fetch("/api/templates");if(!t.ok){let a=await t.json();u(a.error||e("template.errors.fetch"));return}let a=await t.json();l(a.templates||[])}catch(t){u(e("template.errors.fetch"))}finally{o(!1)}},[e]);(0,s.useEffect)(()=>{T()},[T]);let _=async()=>{if(!p.trim()||!g.trim())return void u(e("template.errors.nameAndContentRequired"));v(!0),u(null);try{let t=await fetch("/api/templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),content:g.trim()})});if(!t.ok){let a=await t.json();u(a.error||e("template.errors.create"));return}x(""),h(""),await T()}catch(t){u(e("template.errors.create"))}finally{v(!1)}},z=async()=>{if(!b||!j.trim()||!N.trim())return void u(e("template.errors.nameAndContentRequired"));E(!0),u(null);try{let t=await fetch("/api/templates/".concat(b),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:j.trim(),content:N.trim()})});if(!t.ok){let a=await t.json();u(a.error||e("template.errors.update"));return}y(null),await T()}catch(t){u(e("template.errors.update"))}finally{E(!1)}},D=async a=>{if(await t({description:e("template.deleteConfirm"),variant:"danger"})){u(null);try{let t=await fetch("/api/templates/".concat(a),{method:"DELETE"});if(!t.ok){let a=await t.json();u(a.error||e("template.errors.delete"));return}await T()}catch(t){u(e("template.errors.delete"))}}},P=()=>{y(null),w(""),k("")};return(0,r.jsxs)("div",{"data-testid":"template-tab",children:[c&&(0,r.jsx)("div",{className:"mb-4 p-3 bg-danger-subtle text-danger-foreground rounded-lg text-sm","data-testid":"template-error",children:c}),(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-foreground mb-3",children:e("template.heading",{count:a.length,max:m.$h})}),d?(0,r.jsx)("div",{className:"space-y-3","data-testid":"template-loading",role:"status","aria-label":e("template.loading"),children:[0,1].map(e=>(0,r.jsx)(i.Zp,{padding:"md",children:(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(i.EA,{className:"h-4 w-32"}),(0,r.jsx)(i.EA,{className:"h-3 w-full"}),(0,r.jsx)(i.EA,{className:"h-3 w-2/3"})]})},e))}):0===a.length?(0,r.jsx)("div",{className:"text-sm text-muted-foreground","data-testid":"template-empty",children:e("template.empty")}):(0,r.jsx)("div",{className:"space-y-3","data-testid":"template-list",children:a.map(t=>(0,r.jsx)(i.Zp,{padding:"sm","data-testid":"template-item-".concat(t.id),children:b===t.id?(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(i.pd,{type:"text",inputSize:"sm",value:j,onChange:e=>w(e.target.value),maxLength:m.Nb,"data-testid":"edit-name-input"}),(0,r.jsx)(i.k_,{value:N,onChange:e=>k(e.target.value),maxLength:m.bm,rows:3,className:"resize-y","data-testid":"edit-content-input"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{variant:"primary",size:"sm",onClick:z,disabled:C,"data-testid":"edit-save-button",children:C?e("template.saving"):e("template.save")}),(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:P,"data-testid":"edit-cancel-button",children:e("template.cancel")})]})]}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,r.jsx)("span",{className:"font-medium text-sm text-foreground","data-testid":"template-name",children:t.name}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$n,{variant:"secondary",size:"sm",onClick:()=>{y(t.id),w(t.name),k(t.content)},"data-testid":"edit-button-".concat(t.id),children:e("template.edit")}),(0,r.jsx)(i.$n,{variant:"danger",size:"sm",onClick:()=>D(t.id),"data-testid":"delete-button-".concat(t.id),children:e("template.delete")})]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap","data-testid":"template-content",children:t.content})]})},t.id))})]}),a.length<m.$h&&(0,r.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg shadow-sm","data-testid":"create-form",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-foreground mb-3",children:e("template.newHeading")}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)(i.pd,{type:"text",value:p,onChange:e=>x(e.target.value),maxLength:m.Nb,placeholder:e("template.namePlaceholder"),"data-testid":"new-name-input"}),(0,r.jsx)(i.k_,{value:g,onChange:e=>h(e.target.value),maxLength:m.bm,rows:3,placeholder:e("template.contentPlaceholder"),className:"resize-y","data-testid":"new-content-input"}),(0,r.jsx)(i.$n,{variant:"primary",onClick:_,disabled:f||!p.trim()||!g.trim(),"data-testid":"create-button",children:f?e("template.creating"):e("template.create")})]})]})]})}let z=[{value:"review",labelKey:"tabs.review"},{value:"report",labelKey:"tabs.report"},{value:"template",labelKey:"tabs.template"}];function D(){let e=(0,n.c)("review"),[t,a]=(0,s.useState)("review");return(0,r.jsx)(l.GV,{children:(0,r.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:e("page.title")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("page.description")})]}),(0,r.jsxs)(i.tU,{value:t,onValueChange:e=>a(e),children:[(0,r.jsx)(i.j7,{className:"mb-6 w-full justify-start","data-testid":"page-tabs",children:z.map(t=>(0,r.jsx)(i.Xi,{value:t.value,"data-testid":"page-tab-".concat(t.value),children:e(t.labelKey)},t.value))}),(0,r.jsx)(i.av,{value:"review",children:(0,r.jsx)(s.Suspense,{fallback:null,children:(0,r.jsx)(j,{})})}),(0,r.jsx)(i.av,{value:"report",children:(0,r.jsx)(T,{})}),(0,r.jsx)(i.av,{value:"template",children:(0,r.jsx)(_,{})})]})]})})}},46892:(e,t,a)=>{"use strict";a.d(t,{PL:()=>s,sb:()=>n});let r={idle:"bg-muted-foreground",ready:"bg-success",spinner:"border-info",waiting:"bg-warning"},s={idle:{className:r.idle,labelKey:"status.idle",type:"dot"},ready:{className:r.ready,labelKey:"status.ready",type:"dot"},running:{className:r.spinner,labelKey:"status.running",type:"spinner"},waiting:{className:r.waiting,labelKey:"status.waiting",type:"dot"},generating:{className:r.spinner,labelKey:"status.generating",type:"spinner"}},n={idle:"detailStatus.idle",ready:"detailStatus.ready",running:"detailStatus.running",waiting:"detailStatus.waiting"}},60322:(e,t,a)=>{"use strict";a.d(t,{l:()=>s});let r=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;async function s(e){var t;if(!e||0===e.trim().length)return;let a=e.replace(r,"");if(null==(t=navigator.clipboard)?void 0:t.writeText)try{await navigator.clipboard.writeText(a);return}catch(e){}let s=document.createElement("textarea");s.value=a,s.style.position="fixed",s.style.left="-9999px",s.style.top="-9999px",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();try{document.execCommand("copy")}finally{document.body.removeChild(s)}}},80488:(e,t,a)=>{Promise.resolve().then(a.bind(a,17442))}},e=>{e.O(0,[6809,4909,2770,790,4974,6402,3898,6381,5229,8441,1255,7358],()=>e(e.s=80488)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8898],{6473:(e,s,t)=>{"use strict";t.d(s,{Lc:()=>a,qz:()=>r});let r="animate-in fade-in-0 slide-in-from-bottom-2 fill-mode-backwards duration-300";function a(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(Number.isFinite(e)&&!(e<=0)&&!(e>=t))return"".concat(e*s,"ms")}},8803:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(0,t(71847).A)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},9219:(e,s,t)=>{"use strict";t.d(s,{k:()=>l});var r=t(95155),a=t(12115),n=t(13898),i=t(87531);function l(e){let{onRefresh:s,enabled:t=!0,className:l,children:o}=e,{containerRef:c,pullDistance:d,isRefreshing:u,isPulling:m}=function(e){let{onRefresh:s,enabled:t=!0,threshold:r=64,maxPull:n=96,resistance:i=.5}=e,l=(0,a.useRef)(null),[o,c]=(0,a.useState)(0),[d,u]=(0,a.useState)(!1),[m,x]=(0,a.useState)(!1),h=(0,a.useRef)(null),f=(0,a.useRef)(0),g=(0,a.useRef)(!1);g.current=d;let p=(0,a.useCallback)(()=>{h.current=null,f.current=0,c(0),x(!1)},[]),v=(0,a.useCallback)(e=>{if(!t||g.current)return;let s=l.current;s&&!(s.scrollTop>0)&&(h.current=e.touches[0].clientY,f.current=0)},[t]),b=(0,a.useCallback)(e=>{if(null===h.current)return;let s=l.current;if(!s)return;if(s.scrollTop>0)return void p();let t=e.touches[0].clientY-h.current;if(t<=0){0!==f.current&&(f.current=0,c(0),x(!1));return}e.cancelable&&e.preventDefault();let r=Math.min(t*i,n);f.current=r,c(r),x(!0)},[i,n,p]),y=(0,a.useCallback)(async()=>{u(!0),x(!1),c(r);try{await Promise.resolve(s())}finally{u(!1),c(0)}},[s,r]),N=(0,a.useCallback)(()=>{if(null===h.current)return;let e=f.current>=r&&!g.current;h.current=null,f.current=0,e?y():(c(0),x(!1))},[r,y]);return(0,a.useEffect)(()=>{let e=l.current;if(e)return e.addEventListener("touchstart",v,{passive:!0}),e.addEventListener("touchmove",b,{passive:!1}),e.addEventListener("touchend",N,{passive:!0}),e.addEventListener("touchcancel",N,{passive:!0}),()=>{e.removeEventListener("touchstart",v),e.removeEventListener("touchmove",b),e.removeEventListener("touchend",N),e.removeEventListener("touchcancel",N)}},[v,b,N]),{containerRef:l,pullDistance:o,isRefreshing:d,isPulling:m}}({onRefresh:s,enabled:t,threshold:64}),x=u||d>0,h=u?1:Math.min(d/64,1);return(0,r.jsxs)("div",{ref:c,className:(0,i.cn)("relative overflow-auto",l),style:{overscrollBehaviorY:"contain"},"data-testid":"pull-to-refresh",children:[(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex justify-center",style:{transform:"translateY(".concat(x?Math.max(d-24,8):-32,"px)"),opacity:h,transition:m?"none":"transform 0.2s ease-out, opacity 0.2s ease-out"},"data-testid":"pull-to-refresh-indicator",role:"status","aria-hidden":!u,children:(0,r.jsx)(n.y$,{size:"sm",variant:"accent"})}),(0,r.jsx)("div",{style:{transform:x?"translateY(".concat(d,"px)"):void 0,transition:m?"none":"transform 0.2s ease-out"},children:o})]})}},20562:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(0,t(71847).A)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]])},50857:(e,s,t)=>{"use strict";function r(e){return"running"===e||"generating"===e||"waiting"===e}function a(e){return e.isActive||r(e.status)}function n(e,s){let t=e.map((e,s)=>({it:e,index:s})).filter(e=>{let{it:s}=e;return a(s)}),r=new Set;return s>0&&t.length>0&&[...t].sort((e,s)=>Number(s.it.isActive)-Number(e.it.isActive)||e.index-s.index).slice(0,s).forEach(e=>{let{index:s}=e;return r.add(s)}),e.map((e,s)=>a(e)?{...e,slot:r.has(s)?"pill":"overflow"}:{...e,slot:"dot"})}t.d(s,{Qo:()=>r,Uw:()=>n})},74500:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>L});var r=t(95155),a=t(12115),n=t(52619),i=t.n(n),l=t(18955),o=t(20562),c=t(8803),d=t(15229),u=t(9219),m=t(38218),x=t(66966),h=t(38606),f=t(50857),g=t(54014),p=t(63001),v=t(13898),b=t(7636),y=t(83012),N=t(6473);let j=[{key:"repositoryName",labelKey:"sort.repositoryName"},{key:"status",labelKey:"sort.status"},{key:"lastSent",labelKey:"sort.lastSent"}],w={lastSent:"desc",updatedAt:"desc"},k={ready:0,in_progress:1,in_review:2,done:3};function A(e){let{status:s,label:t}=e,a=(0,l.c)("common"),n="".concat(t,": ").concat(a("status.".concat(s)));return(0,r.jsx)(v.md,{status:s,size:"md",label:n})}let C={ready:"worktreeStatus.ready",in_progress:"worktreeStatus.inProgress",in_review:"worktreeStatus.inReview",done:"worktreeStatus.done"},M={done:"bg-success-subtle text-success-foreground",in_review:"bg-info-subtle text-info-foreground",in_progress:"bg-accent-100 dark:bg-accent-900/30 text-accent-700 dark:text-accent-400"};function L(){let e=(0,l.c)("common"),s=(0,l.c)("worktree"),t=(0,m.a)(),{worktrees:n,isLoading:L,error:E,refresh:S}=(0,x.Fn)(),_=n.length>0,[F,D]=(0,a.useState)(""),[U,z]=(0,a.useState)("lastSent"),[P,B]=(0,a.useState)("desc"),R=(0,a.useMemo)(()=>{let e=n;if(F){let s=F.toLowerCase();e=e.filter(e=>{var t,r;return e.name.toLowerCase().includes(s)||e.repositoryName.toLowerCase().includes(s)||null!=(r=null==(t=e.repositoryDisplayName)?void 0:t.toLowerCase().includes(s))&&r})}let s=[...e];return s.sort((e,s)=>{var t,r,a,n,i,l,o,c;let d=0;switch(U){case"lastSent":{let t=(0,b.nO)(e.lastUserMessageAt,s.lastUserMessageAt);if(!e.lastUserMessageAt&&!s.lastUserMessageAt)return 0;if(!e.lastUserMessageAt)return 1;if(!s.lastUserMessageAt)return -1;d=t;break}case"repositoryName":{let a=(null!=(t=e.repositoryDisplayName)?t:e.repositoryName).toLowerCase(),n=(null!=(r=s.repositoryDisplayName)?r:s.repositoryName).toLowerCase();0===(d=a.localeCompare(n))&&(d=e.name.toLowerCase().localeCompare(s.name.toLowerCase()));break}case"status":if(0==(d=(null!=(n=k[null!=(a=e.status)?a:""])?n:4)-(null!=(l=k[null!=(i=s.status)?i:""])?l:4))){let t=(null!=(o=e.repositoryDisplayName)?o:e.repositoryName).toLowerCase(),r=(null!=(c=s.repositoryDisplayName)?c:s.repositoryName).toLowerCase();d=t.localeCompare(r)}break;default:d=0}return("lastSent"===U?"desc"===P:"asc"===P)?d:-d}),s},[n,F,U,P]),T=(0,a.useCallback)(e=>{D(e.target.value)},[]),q=(0,a.useCallback)(e=>{var s;z(e),B(null!=(s=w[e])?s:"asc")},[]),K=(0,a.useCallback)(()=>{B(e=>"asc"===e?"desc":"asc")},[]);return(0,r.jsx)(d.GV,{children:(0,r.jsxs)(u.k,{onRefresh:S,enabled:t,className:"container-custom py-8 h-full",children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:e("sessions.title")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:e("sessions.description")})]}),(0,r.jsxs)("div",{className:"mb-6 flex items-center gap-3",children:[(0,r.jsx)(v.pd,{type:"text",placeholder:e("sessions.filterPlaceholder"),value:F,onChange:T,className:"max-w-md flex-1","data-testid":"sessions-filter","aria-label":e("sessions.filterAriaLabel"),inputMode:"search",enterKeyHint:"search"}),(0,r.jsxs)(v.l6,{value:U,onValueChange:q,children:[(0,r.jsx)(v.bq,{className:"w-40","data-testid":"sessions-sort-select","aria-label":e("sessions.sortByAriaLabel"),children:(0,r.jsx)(v.yv,{})}),(0,r.jsx)(v.gC,{children:j.map(s=>(0,r.jsx)(v.eb,{value:s.key,children:e(s.labelKey)},s.key))})]}),(0,r.jsx)("button",{type:"button",onClick:K,"data-testid":"sessions-sort-direction","aria-label":"asc"===P?e("sessions.sortAscending"):e("sessions.sortDescending"),className:"rounded-md border border-input bg-surface p-2 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"asc"===P?(0,r.jsx)(o.A,{size:16,"aria-hidden":"true"}):(0,r.jsx)(c.A,{size:16,"aria-hidden":"true"})})]}),_?(0,r.jsxs)(r.Fragment,{children:[E&&(0,r.jsx)("div",{className:"mb-4 rounded-md border border-danger-border bg-danger-subtle px-3 py-2 text-sm text-danger-foreground",role:"status","data-testid":"sessions-error-banner",children:e("sessions.refreshError",{message:E.message})}),(0,r.jsx)("div",{className:"space-y-2","data-testid":"sessions-list",children:0===R.length?(0,r.jsx)("div",{className:"text-muted-foreground py-8 text-center","data-testid":"sessions-empty",children:e("sessions.noMatching")}):R.map((t,a)=>{var n,l,o,c;let d=null!=(n=t.selectedAgents)?n:p.fJ,u=t.lastUserMessage?t.lastUserMessage.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g,"").replace(/[\u200B-\u200F\u2028-\u202F\uFEFF\u061C]/g,"").replace(/[\r\n\t]/g," ").replace(/\s+/g," ").trim():null,m=t.lastUserMessageAt?(0,y.Fx)(String(t.lastUserMessageAt)):null,x=d.map(e=>{var s;return{agent:e,status:(0,h.kA)(null==(s=t.sessionStatusByCli)?void 0:s[e])}}),b=x.filter(e=>(0,f.Qo)(e.status)),j=x.length-b.length,w=d.some(e=>{var s;let r=(0,h.kA)(null==(s=t.sessionStatusByCli)?void 0:s[e]);return"running"===r||"generating"===r});return(0,r.jsxs)(i(),{href:"/worktrees/".concat(t.id),style:{animationDelay:(0,N.Lc)(a)},className:"block bg-surface rounded-lg p-4 border transition-colors ".concat(w?"border-accent-500/40 shadow-[0_0_16px_-4px_rgb(var(--accent-500)/0.45)] hover:border-accent-400":"border-border shadow-sm hover:border-accent-300 dark:hover:border-accent-700"," ").concat(N.qz),"data-testid":"session-item-".concat(t.id),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:null!=(l=t.repositoryDisplayName)?l:t.repositoryName}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:t.name})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-4 flex-shrink-0","data-testid":"session-agents-".concat(t.id),children:[b.map(e=>{let{agent:s,status:t}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-1","data-testid":"session-agent-".concat(s),children:[(0,r.jsx)(A,{status:t,label:(0,g.oo)(s)}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,g.oo)(s)})]},s)}),j>0&&(0,r.jsxs)("div",{className:"flex items-center gap-1","data-testid":"session-idle-cluster-".concat(t.id),"aria-label":e("sessions.idleAgents",{count:j}),children:[(0,r.jsx)(v.md,{status:"idle",size:"sm","aria-hidden":!0,title:void 0}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:["+",j]})]})]})]}),t.description&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 whitespace-pre-wrap",children:t.description})}),t.status&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium rounded ".concat(null!=(c=M[null!=(o=t.status)?o:""])?c:"bg-muted text-muted-foreground"),children:function(e,s){if(!e)return"";let t=C[e];return t?s(t):e}(t.status,s)})}),u&&(0,r.jsxs)("div",{className:"mt-2 flex items-center gap-2","data-testid":"session-message-".concat(t.id),children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground truncate min-w-0 flex-1","data-testid":"session-message-text-".concat(t.id),title:u,children:u}),m&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0 whitespace-nowrap tabular-nums","data-testid":"session-time-".concat(t.id),children:m})]})]},t.id)})})]}):(0,r.jsxs)(r.Fragment,{children:[L&&(0,r.jsx)("div",{className:"space-y-2","data-testid":"sessions-loading",role:"status","aria-label":e("sessions.loadingAriaLabel"),children:[0,1,2].map(e=>(0,r.jsxs)("div",{className:"block bg-surface rounded-lg p-4 border border-border shadow-sm",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,r.jsx)(v.EA,{className:"h-4 w-40 max-w-full"}),(0,r.jsx)(v.EA,{className:"h-3 w-56 max-w-full"})]}),(0,r.jsx)(v.EA,{className:"ml-4 h-3 w-16 flex-shrink-0"})]}),(0,r.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,r.jsx)(v.EA,{className:"h-3 min-w-0 flex-1"}),(0,r.jsx)(v.EA,{className:"h-3 w-10 flex-shrink-0"})]})]},e))}),!L&&E&&(0,r.jsx)("div",{className:"text-danger-foreground","data-testid":"sessions-error",children:e("sessions.loadError",{message:E.message})}),!L&&!E&&(0,r.jsx)("div",{className:"text-muted-foreground py-8 text-center","data-testid":"sessions-empty",children:F?e("sessions.noMatching"):e("sessions.empty")})]})]})})}},83012:(e,s,t)=>{"use strict";t.d(s,{Fx:()=>i,bg:()=>l,fw:()=>n});var r=t(53298),a=t(73683);function n(e,s){let t=new Date(e);return isNaN(t.getTime())?"":(0,r.m)(t,{addSuffix:!0,...s?{locale:s}:{}})}function i(e){let s=new Date(e);if(isNaN(s.getTime()))return"";let t=Math.round((Date.now()-s.getTime())/1e3);if(t<45)return"now";let r=Math.round(t/60);if(r<60)return"".concat(r,"m ago");let a=Math.round(r/60);if(a<24)return"".concat(a,"h ago");let n=Math.round(a/24);return n<7?"".concat(n,"d ago"):n<30?"".concat(Math.round(n/7),"w ago"):n<365?"".concat(Math.round(n/30),"mo ago"):"".concat(Math.round(n/365),"y ago")}function l(e,s){return!(e instanceof Date)||isNaN(e.getTime())?"":(0,a.GP)(e,"PPp",s?{locale:s}:void 0)}},87047:(e,s,t)=>{Promise.resolve().then(t.bind(t,74500))}},e=>{e.O(0,[6809,4909,2770,790,4974,9948,6402,3898,6381,5229,8441,1255,7358],()=>e(e.s=87047)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9404],{68331:(e,s,t)=>{"use strict";t.d(s,{y:()=>n});var a=t(95155);t(12115);var l=t(18955),i=t(37381),r=t(95584);function n(e){let{catalog:s}=e,t=(0,l.c)("skills");return s.stale||s.offline?(0,a.jsx)(i.u,{tone:"warning","data-testid":"skill-catalog-stale",className:"flex-col sm:flex-row",children:(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{className:"font-medium",children:t("catalog.staleHeading")}),(0,a.jsx)("p",{children:t("catalog.staleNotice")}),s.offline&&(0,a.jsx)("p",{children:t("catalog.offlineNotice")}),(0,a.jsx)("p",{children:t((0,r.pk)(s.staleReason))}),(0,a.jsxs)("p",{className:"break-words",children:[t("catalog.fetchedAt",{timestamp:s.fetchedAt})," \xb7"," ",t("catalog.revalidatedAt",{timestamp:s.revalidatedAt})]}),(0,a.jsx)("p",{className:"break-words",children:t("catalog.sourceLabel",{repository:s.source.repository,ref:s.source.ref})})]})}):(0,a.jsxs)("p",{"data-testid":"skill-catalog-fresh",className:"text-xs text-muted-foreground break-words",children:[t("catalog.freshLabel")," \xb7"," ",t("catalog.revalidatedAt",{timestamp:s.revalidatedAt})," \xb7"," ",t("catalog.sourceLabel",{repository:s.source.repository,ref:s.source.ref})]})}},89675:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>q});var a=t(95155),l=t(20063),i=t(15229),r=t(12115),n=t(52619),d=t.n(n),o=t(18955),c=t(35626),m=t(13898),x=t(99648),u=t(75333),h=t(68331),g=t(50825),p=t(24027),j=t(95584);function f(e){let{changelog:s}=e,t=(0,o.c)("skills"),l=(0,j.RG)(s).trim();return 0===l.length?(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"skill-changelog-empty",children:t("detail.changelogEmpty")}):(0,a.jsxs)("div",{"data-testid":"skill-changelog",children:[(0,a.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert break-words",children:(0,a.jsx)(p.G8,{content:l})}),(0,a.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:t("detail.mediaStripped")})]})}var k=t(34380),b=t(37381),v=t(80130);let N={status:"loading",catalog:null,skill:null,failure:null};function y(e){let{label:s,children:t,mono:l=!1}=e;return(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:s}),(0,a.jsx)("dd",{className:"mt-0.5 text-sm text-foreground ".concat(l?"break-all font-mono text-xs":"break-words"),children:t})]})}function w(e){let{title:s,children:t,testId:l}=e;return(0,a.jsxs)(m.Zp,{"data-testid":l,className:"space-y-3",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-foreground",children:s}),t]})}function V(e){var s;let{compatibility:t}=e,l=(0,o.c)("skills");return(0,a.jsx)("p",{className:"text-sm text-foreground","data-testid":"skill-compatibility-reason",children:l((0,j.e5)(t.messageKey),{range:t.requiredRange,currentVersion:null!=(s=t.currentVersion)?s:""})})}function I(e){let{version:s}=e,t=(0,o.c)("skills");return(0,a.jsxs)(m.Zp,{"data-testid":"skill-version-".concat(s.version),className:"space-y-3",padding:"sm",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-sm font-semibold text-foreground",children:s.version}),s.prerelease&&(0,a.jsx)(m.Ex,{variant:"warning",children:t("detail.prerelease")}),(0,a.jsx)(u.Xz,{status:s.compatibility.commandmate.status}),(0,a.jsx)(u.qW,{risk:s.declaredRisk})]}),(0,a.jsxs)("dl",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,a.jsx)(y,{label:t("detail.publishedAt"),children:s.publishedAt}),(0,a.jsx)(y,{label:t("detail.requiredRangeLabel"),children:s.compatibility.commandmate.requiredRange}),(0,a.jsx)(y,{label:t("detail.sourceRepository"),children:s.source.repository}),(0,a.jsx)(y,{label:t("detail.sourceRef"),children:s.source.ref}),(0,a.jsx)(y,{label:t("detail.sourceCommit"),mono:!0,children:s.source.commit}),(0,a.jsx)(y,{label:t("detail.packageAsset"),mono:!0,children:s.artifact.assetName}),(0,a.jsx)(y,{label:t("detail.packageDigest"),mono:!0,children:s.artifact.sha256}),(0,a.jsx)(y,{label:t("detail.packageSize"),children:t("detail.packageBytes",{bytes:s.artifact.size})})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.compatibility.agents.length>0?s.compatibility.agents.map(e=>(0,a.jsx)(u.uE,{agent:e},e.agent)):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:t("compatibility.agentsUnknown")})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:t("detail.changelogHeading")}),(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsx)(f,{changelog:s.changelog})})]})]})}function R(e){var s,t,l,i,n,p,f,R,q;let{skillId:A}=e,E=(0,o.c)("skills"),[C,H]=(0,r.useState)(N),[_,z]=(0,r.useState)(0);(0,r.useEffect)(()=>{let e=new AbortController;return H(N),(0,v.Db)(A,e.signal).then(s=>{e.signal.aborted||H(s.ok?{status:"loaded",catalog:s.data.catalog,skill:s.data.skill,failure:null}:{status:"error",catalog:null,skill:null,failure:s.failure})}).catch(()=>{}),()=>e.abort()},[A,_]);let U=(0,r.useCallback)(()=>z(e=>e+1),[]),F=(0,a.jsxs)(d(),{href:"/skills",className:"inline-flex items-center gap-1 text-sm text-accent-600 hover:underline dark:text-accent-400","data-testid":"skill-detail-back",children:[(0,a.jsx)(c.A,{size:14,"aria-hidden":"true"}),E("page.backToCatalog")]});if("loading"===C.status)return(0,a.jsxs)("div",{className:"space-y-4","data-testid":"skill-detail-loading",children:[F,(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:E("state.loading")}),(0,a.jsx)(m.EA,{className:"h-40 w-full rounded-lg"})]});if("error"===C.status||!C.skill){let e=(null==(t=C.failure)?void 0:t.status)===404;return(0,a.jsxs)("div",{className:"space-y-4",children:[F,(0,a.jsxs)(m.Zp,{"data-testid":e?"skill-detail-not-found":"skill-detail-error",className:"space-y-3",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-foreground",children:E(e?"state.notFoundHeading":"state.errorHeading")}),(0,a.jsxs)(b.u,{tone:"danger",children:[(0,a.jsx)("p",{children:E(e?"state.notFoundNotice":"state.errorNotice")}),(0,a.jsx)("p",{className:"mt-1 break-words",children:E("state.errorCode",{code:null!=(i=null==(l=C.failure)?void 0:l.code)?i:""})})]}),!e&&(0,a.jsx)(m.$n,{variant:"secondary",size:"sm",onClick:U,"data-testid":"skill-detail-retry",children:E("state.retry")})]})]})}let L=C.skill,S=L.compatibility,W=null!=(n=L.versions.find(e=>e.version===L.recommendedVersion))?n:null,Z=null!=(p=null==(s=null!=W?W:L.versions[0])?void 0:s.declaredRisk)?p:null,G=L.recommendedVersion?S&&"compatible"!==S.status?E("detail.install.blockedIncompatible",{reason:E((0,j.e5)(S.messageKey),{range:S.requiredRange,currentVersion:null!=(f=S.currentVersion)?f:""})}):null:E("detail.install.blockedNoVersion");return(0,a.jsxs)("div",{className:"space-y-4",children:[F,C.catalog&&(0,a.jsx)(h.y,{catalog:C.catalog}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-foreground break-words",children:L.name}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground break-words",children:L.summary}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[S&&(0,a.jsx)(u.Xz,{status:S.status}),Z&&(0,a.jsx)(u.qW,{risk:Z})]})]}),(0,a.jsx)(w,{title:E("detail.install.action"),testId:"skill-install-section",children:(0,a.jsx)(k.B,{skillId:L.id,version:L.recommendedVersion,blockedReason:G,agents:null!=(R=null==W?void 0:W.compatibility.agents)?R:[]})}),(0,a.jsxs)(w,{title:E("capabilities.heading"),testId:"skill-capabilities-section",children:[(0,a.jsx)("p",{className:"text-sm text-foreground break-words",children:L.summary}),(0,a.jsx)(b.u,{tone:"neutral",children:E("capabilities.unavailable")})]}),(0,a.jsxs)(w,{title:E("detail.overview"),testId:"skill-overview-section",children:[(0,a.jsxs)("dl",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,a.jsx)(y,{label:E("detail.skillId"),mono:!0,children:L.id}),(0,a.jsx)(y,{label:E("detail.provider"),children:L.provider.url?(0,a.jsx)("a",{href:L.provider.url,target:"_blank",rel:"noopener noreferrer",className:"text-accent-600 hover:underline dark:text-accent-400",children:L.provider.name}):L.provider.name}),L.provider.contact&&(0,a.jsx)(y,{label:E("detail.providerContact"),children:L.provider.contact}),(0,a.jsx)(y,{label:E("detail.license"),children:L.license}),L.homepage&&(0,a.jsx)(y,{label:E("detail.homepage"),children:(0,a.jsx)("a",{href:L.homepage,target:"_blank",rel:"noopener noreferrer",className:"break-all text-accent-600 hover:underline dark:text-accent-400",children:L.homepage})}),(0,a.jsx)(y,{label:E("detail.latestVersion"),mono:!0,children:L.latest}),(0,a.jsx)(y,{label:E("detail.recommendedVersion"),mono:!0,children:null!=(q=L.recommendedVersion)?q:E("detail.recommendedVersionNone")})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"skill-recommendation-reason",children:E(j.TE[L.recommendedReason])}),L.keywords.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:E("detail.keywords")}),(0,a.jsx)("div",{className:"mt-1 flex flex-wrap gap-1.5",children:L.keywords.map(e=>(0,a.jsx)(m.Ex,{variant:"gray",children:e},e))})]})]}),(0,a.jsxs)(w,{title:E("compatibility.label"),testId:"skill-compatibility-section",children:[S?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(u.Xz,{status:S.status}),(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:E("compatibility.requiredRange",{range:S.requiredRange})})]}),(0,a.jsx)(V,{compatibility:S}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:S.currentVersion?E("compatibility.currentVersion",{version:S.currentVersion}):E("compatibility.currentVersionUnknown")}),"unknown"===S.status&&(0,a.jsx)(b.u,{tone:"warning","data-testid":"skill-compatibility-unknown-notice",children:E("compatibility.unverifiedNotice")})]}):(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:E("compatibility.currentVersionUnknown")}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-foreground",children:E("compatibility.agentsHeading")}),W&&W.compatibility.agents.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:W.compatibility.agents.map(e=>(0,a.jsx)(u.uE,{agent:e},e.agent))}),(0,a.jsx)("div",{className:"space-y-3",children:W.compatibility.agents.map(e=>(0,a.jsx)(g.m,{agent:e},e.agent))})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:E("compatibility.agentsUnknown")}),(0,a.jsx)(b.u,{tone:"neutral",children:E("compatibility.agentsNotice")})]})]}),(0,a.jsxs)(w,{title:E("risk.declaredHeading"),testId:"skill-risk-section",children:[Z?(0,a.jsx)(u.qW,{risk:Z}):null,(0,a.jsx)(b.u,{tone:"neutral",children:E("risk.declaredNotice")}),"high"===Z&&(0,a.jsx)(b.u,{tone:"danger","data-testid":"skill-high-risk-warning",children:E("risk.highWarning")}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-foreground",children:E("risk.computedHeading")}),(0,a.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":"skill-computed-risk-unavailable",children:E("risk.computedUnavailable")})]})]}),(0,a.jsxs)(w,{title:E("permissions.heading"),testId:"skill-permissions-section",children:[(0,a.jsx)(b.u,{tone:"warning","data-testid":"skill-permission-declaration-notice",children:E((0,j.e5)(x.Ms))}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:E("permissions.unavailable")})]}),(0,a.jsx)(w,{title:E("requirements.heading"),testId:"skill-requirements-section",children:(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:E("requirements.unavailable")})}),(0,a.jsx)(w,{title:E("contents.heading"),testId:"skill-contents-section",children:(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:E("contents.unavailable")})}),(0,a.jsxs)("section",{className:"space-y-3","data-testid":"skill-versions-section",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-foreground",children:E("detail.versionsHeading")}),0===L.versions.length?(0,a.jsx)(m.Zp,{children:(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:E("detail.versionsEmpty")})}):L.versions.map(e=>(0,a.jsx)(I,{version:e},e.version))]})]})}function q(){let e=(0,l.useParams)(),s="string"==typeof e.skillId?e.skillId:"";return(0,a.jsx)(i.GV,{children:(0,a.jsx)("div",{className:"container-custom py-8 overflow-auto h-full",children:(0,a.jsx)(R,{skillId:s})})})}},99027:(e,s,t)=>{Promise.resolve().then(t.bind(t,89675))}},e=>{e.O(0,[6481,6809,4909,2770,790,4974,8566,1191,5542,6402,3898,6381,5229,2751,2053,8441,1255,7358],()=>e(e.s=99027)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9336],{7727:(e,s,t)=>{Promise.resolve().then(t.bind(t,72754))},72754:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>C});var a=t(95155),r=t(52619),l=t.n(r),d=t(18955),n=t(15229),i=t(12115),o=t(13898),c=t(37381),u=t(80130),m=t(95584);let x="w-full rounded-md border border-input bg-surface px-3 py-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",h=["install","uninstall","update"],g=["succeeded","failed","reconciled"],f={status:"loading",operations:[],nextCursor:null,failure:null};function p(e){return null===e?null:e.slice(0,12)}function b(e){var s,t;let{worktreeId:r,skillId:n}=e,b=(0,d.c)("skills"),[k,j]=(0,i.useState)(f),[N,v]=(0,i.useState)(""),[y,C]=(0,i.useState)(""),[w,I]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=new AbortController;return j(f),(0,u.mf)({worktreeId:r,skillId:n,operation:N,result:y,limit:20},e.signal).then(s=>{e.signal.aborted||j(s.ok?{status:"loaded",operations:s.data.operations,nextCursor:s.data.nextCursor,failure:null}:{status:"error",operations:[],nextCursor:null,failure:s.failure})}).catch(()=>{}),()=>e.abort()},[r,n,N,y]);let S=(0,i.useCallback)(()=>{null!==k.nextCursor&&(I(!0),(0,u.mf)({worktreeId:r,skillId:n,operation:N,result:y,limit:20,cursor:k.nextCursor}).then(e=>{e.ok&&j(s=>({...s,operations:[...s.operations,...e.data.operations],nextCursor:e.data.nextCursor}))}).catch(()=>{}).finally(()=>I(!1)))},[k.nextCursor,r,n,N,y]);return(0,a.jsxs)(o.Zp,{className:"space-y-3","data-testid":"skill-operation-history",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-foreground",children:b("history.heading")}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,a.jsxs)("label",{className:"block text-xs font-medium text-muted-foreground",children:[b("history.filterOperation"),(0,a.jsxs)("select",{className:"".concat(x," mt-1"),value:N,onChange:e=>v(e.target.value),"data-testid":"skill-history-filter-operation",children:[(0,a.jsx)("option",{value:"",children:b("dashboard.all")}),h.map(e=>(0,a.jsx)("option",{value:e,children:b(m.u0[e])},e))]})]}),(0,a.jsxs)("label",{className:"block text-xs font-medium text-muted-foreground",children:[b("history.filterResult"),(0,a.jsxs)("select",{className:"".concat(x," mt-1"),value:y,onChange:e=>C(e.target.value),"data-testid":"skill-history-filter-result",children:[(0,a.jsx)("option",{value:"",children:b("dashboard.all")}),g.map(e=>(0,a.jsx)("option",{value:e,children:b(m.xX[e])},e))]})]})]}),"loading"===k.status&&(0,a.jsxs)("div",{className:"space-y-2","data-testid":"skill-history-loading",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:b("history.loading")}),[0,1].map(e=>(0,a.jsx)(o.EA,{className:"h-16 w-full rounded-lg"},e))]}),"error"===k.status&&(0,a.jsxs)(c.u,{tone:"danger","data-testid":"skill-history-error",children:[(0,a.jsx)("p",{children:b("history.errorNotice")}),(0,a.jsx)("p",{className:"mt-1 break-words",children:b("state.errorCode",{code:null!=(t=null==(s=k.failure)?void 0:s.code)?t:""})})]}),"loaded"===k.status&&0===k.operations.length&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"skill-history-empty",children:b("history.empty")}),"loaded"===k.status&&k.operations.length>0&&(0,a.jsx)("ul",{className:"space-y-2","data-testid":"skill-history-list",children:k.operations.map(e=>{var s,t,r,d,n,i;return(0,a.jsxs)("li",{className:"rounded-lg border border-border p-3 text-xs","data-testid":"skill-history-item",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(o.Ex,{variant:null!=(s=m.R1[e.result])?s:"gray",children:b(null!=(t=m.xX[e.result])?t:"history.result.succeeded")}),(0,a.jsx)("span",{className:"font-medium text-foreground",children:b(null!=(r=m.u0[e.operation])?r:"history.operation.install")}),(0,a.jsx)("span",{className:"font-medium text-foreground",children:e.skillId}),(0,a.jsx)("span",{className:"text-muted-foreground",children:e.worktreeId}),(0,a.jsx)("span",{className:"ml-auto text-muted-foreground",children:b("history.recordedAt",{timestamp:new Date(e.recordedAt).toISOString().replace("T"," ").slice(0,19)})})]}),(0,a.jsxs)("dl",{className:"mt-2 grid grid-cols-1 gap-x-4 gap-y-1 sm:grid-cols-2",children:[(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:b("history.transitionLabel")}),(0,a.jsx)("dd",{className:"text-foreground",children:b("history.transition",{from:null!=(d=e.fromVersion)?d:b("history.none"),to:null!=(n=e.toVersion)?n:b("history.none")})})]}),(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:b("history.actorLabel")}),(0,a.jsx)("dd",{className:"text-foreground",children:b(null!=(i=m.bD[e.actorType])?i:"history.actor.system")})]}),null!==e.sourceOrigin&&(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:b("history.origin")}),(0,a.jsx)("dd",{className:"text-foreground",children:e.sourceOrigin})]}),null!==e.sourceCommit&&(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:b("history.sourceCommit")}),(0,a.jsx)("dd",{className:"break-all font-mono text-foreground",children:p(e.sourceCommit)})]}),null!==e.artifactSha256&&(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:b("history.artifactDigest")}),(0,a.jsx)("dd",{className:"break-all font-mono text-foreground",children:p(e.artifactSha256)})]})]}),null!==e.errorCode&&(0,a.jsxs)("div",{className:"mt-2 space-y-1","data-testid":"skill-history-failure",children:[(0,a.jsxs)(c.u,{tone:"danger",children:[(0,a.jsx)("p",{className:"break-words",children:b("state.errorCode",{code:e.errorCode})}),null!==e.errorMessage&&(0,a.jsx)("p",{className:"mt-1 break-words",children:e.errorMessage})]}),(0,a.jsx)(l(),{href:"/skills/".concat(encodeURIComponent(e.skillId)),className:"inline-flex text-accent-600 hover:underline dark:text-accent-400","data-testid":"skill-history-retry",children:b("history.retry")})]})]},e.id)})}),null!==k.nextCursor&&(0,a.jsx)(o.$n,{variant:"secondary",size:"sm",onClick:S,disabled:w,"data-testid":"skill-history-load-more",children:b("history.loadMore")})]})}let k="w-full rounded-md border border-input bg-surface px-3 py-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",j=["missing","modified","unmanaged","update_available","installed"],N={missing:0,modified:1,unmanaged:2,update_available:3,installed:4},v={status:"loading",scannedAt:null,worktreeCount:0,truncated:!1,unreadableWorktreeIds:[],catalogAvailable:!1,installations:[],failure:null};function y(){let e=(0,d.c)("skills"),[s,t]=(0,i.useState)(v),[r,n]=(0,i.useState)({running:!1,outcome:null,failure:null}),[x,h]=(0,i.useState)(""),[g,f]=(0,i.useState)(""),[p,y]=(0,i.useState)(""),[C,w]=(0,i.useState)(0);(0,i.useEffect)(()=>{let e=new AbortController;return t(v),(0,u.V_)({refresh:C>0},e.signal).then(s=>{e.signal.aborted||t(s.ok?{status:"loaded",scannedAt:s.data.scannedAt,worktreeCount:s.data.worktreeCount,truncated:s.data.truncated,unreadableWorktreeIds:s.data.unreadableWorktreeIds,catalogAvailable:s.data.catalogAvailable,installations:s.data.installations,failure:null}:{...v,status:"error",failure:s.failure})}).catch(()=>{}),()=>e.abort()},[C]);let I=(0,i.useCallback)(()=>w(e=>e+1),[]),S=(0,i.useCallback)(()=>{n({running:!0,outcome:null,failure:null}),(0,u.vg)().then(e=>{if(e.ok){n({running:!1,outcome:{indexed:e.data.indexed,removed:e.data.removed,skipped:e.data.skipped.length},failure:null}),I();return}n({running:!1,outcome:null,failure:e.failure})}).catch(()=>{n({running:!1,outcome:null,failure:null})})},[I]),A=(0,i.useMemo)(()=>{let e=new Map;for(let t of s.installations)e.set(t.worktreeId,t.worktreeName);return[...e].sort((e,s)=>{let[t]=e,[a]=s;return t<a?-1:1})},[s.installations]),E=(0,i.useMemo)(()=>{let e=p.trim().toLowerCase();return s.installations.filter(e=>""===x||e.worktreeId===x).filter(e=>""===g||e.status===g).filter(s=>""===e||s.skillId.toLowerCase().includes(e)).slice().sort((e,s)=>{var t,a;let r=(null!=(t=N[e.status])?t:9)-(null!=(a=N[s.status])?a:9);return 0!==r?r:e.skillId!==s.skillId?e.skillId<s.skillId?-1:1:e.worktreeId<s.worktreeId?-1:1})},[s.installations,x,g,p]);if("loading"===s.status)return(0,a.jsxs)("div",{"data-testid":"skill-dashboard-loading",className:"space-y-3",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:e("state.loading")}),[0,1,2].map(e=>(0,a.jsx)(o.EA,{className:"h-24 w-full rounded-lg"},e))]});if("error"===s.status){var M,_;return(0,a.jsxs)(o.Zp,{"data-testid":"skill-dashboard-error",className:"space-y-3",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-foreground",children:e("state.errorHeading")}),(0,a.jsxs)(c.u,{tone:"danger",children:[(0,a.jsx)("p",{children:e("dashboard.errorNotice")}),(0,a.jsx)("p",{className:"mt-1 break-words",children:e("state.errorCode",{code:null!=(_=null==(M=s.failure)?void 0:M.code)?_:""})})]}),(0,a.jsx)(o.$n,{variant:"secondary",size:"sm",onClick:I,"data-testid":"skill-dashboard-retry",children:e("state.retry")})]})}return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"skill-dashboard-scanned-at",children:e("dashboard.scannedAt",{timestamp:null===s.scannedAt?"":new Date(s.scannedAt).toISOString().replace("T"," ").slice(0,19)})}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:e("dashboard.worktreeCount",{count:s.worktreeCount})}),(0,a.jsxs)("div",{className:"ml-auto flex gap-2",children:[(0,a.jsx)(o.$n,{variant:"secondary",size:"sm",onClick:I,"data-testid":"skill-dashboard-rescan",children:e("dashboard.rescan")}),(0,a.jsx)(o.$n,{variant:"secondary",size:"sm",onClick:S,disabled:r.running,"data-testid":"skill-dashboard-reindex",children:r.running?e("dashboard.reindexRunning"):e("dashboard.reindex")})]})]}),!s.catalogAvailable&&(0,a.jsx)(c.u,{tone:"warning","data-testid":"skill-dashboard-catalog-unavailable",children:e("dashboard.catalogUnavailable")}),s.truncated&&(0,a.jsx)(c.u,{tone:"warning","data-testid":"skill-dashboard-truncated",children:e("dashboard.truncated")}),s.unreadableWorktreeIds.length>0&&(0,a.jsx)(c.u,{tone:"warning","data-testid":"skill-dashboard-unreadable",children:e("dashboard.unreadableWorktrees",{worktrees:s.unreadableWorktreeIds.join(", ")})}),null!==r.outcome&&(0,a.jsx)(c.u,{tone:"info","data-testid":"skill-dashboard-reindex-result",children:e("dashboard.reindexDone",{indexed:r.outcome.indexed,removed:r.outcome.removed,skipped:r.outcome.skipped})}),null!==r.failure&&(0,a.jsxs)(c.u,{tone:"danger","data-testid":"skill-dashboard-reindex-error",children:[(0,a.jsx)("p",{children:e("dashboard.reindexFailed")}),(0,a.jsx)("p",{className:"mt-1 break-words",children:e("state.errorCode",{code:r.failure.code})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[(0,a.jsxs)("label",{className:"block text-xs font-medium text-muted-foreground sm:col-span-1",children:[e("dashboard.filterSkill"),(0,a.jsx)(o.pd,{type:"search",className:"mt-1",value:p,onChange:e=>y(e.target.value),"aria-label":e("dashboard.filterSkill"),"data-testid":"skill-dashboard-search"})]}),(0,a.jsxs)("label",{className:"block text-xs font-medium text-muted-foreground",children:[e("dashboard.filterWorktree"),(0,a.jsxs)("select",{className:"".concat(k," mt-1"),value:x,onChange:e=>h(e.target.value),"data-testid":"skill-dashboard-filter-worktree",children:[(0,a.jsx)("option",{value:"",children:e("dashboard.all")}),A.map(e=>{let[s,t]=e;return(0,a.jsx)("option",{value:s,children:t},s)})]})]}),(0,a.jsxs)("label",{className:"block text-xs font-medium text-muted-foreground",children:[e("dashboard.filterStatus"),(0,a.jsxs)("select",{className:"".concat(k," mt-1"),value:g,onChange:e=>f(e.target.value),"data-testid":"skill-dashboard-filter-status",children:[(0,a.jsx)("option",{value:"",children:e("dashboard.all")}),j.map(s=>(0,a.jsx)("option",{value:s,children:e(m.DN[s])},s))]})]})]}),0===s.installations.length?(0,a.jsx)(o.Zp,{"data-testid":"skill-dashboard-empty",children:(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:e("dashboard.empty")})}):0===E.length?(0,a.jsxs)(o.Zp,{"data-testid":"skill-dashboard-no-results",children:[(0,a.jsx)("p",{className:"text-sm text-foreground",children:e("state.noResults")}),(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e("state.noResultsHint")})]}):(0,a.jsx)("ul",{className:"space-y-2","data-testid":"skill-dashboard-list",children:E.map(s=>{var t,r,d,n;return(0,a.jsxs)("li",{className:"rounded-lg border border-border p-3","data-testid":"skill-dashboard-item",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(o.Ex,{variant:null!=(t=m.J[s.status])?t:"gray",children:e(null!=(r=m.DN[s.status])?r:"dashboard.status.installed")}),(0,a.jsx)(l(),{href:"/skills/".concat(encodeURIComponent(s.skillId)),className:"text-sm font-semibold text-accent-600 hover:underline dark:text-accent-400","data-testid":"skill-dashboard-item-link",children:s.skillId}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:[s.repositoryName," / ",s.worktreeName]}),(0,a.jsxs)("span",{className:"ml-auto text-xs text-foreground",children:[null!=(d=s.version)?d:e("history.none"),"update_available"===s.status&&null!==s.latestVersion?" → ".concat(s.latestVersion):""]})]}),(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":"skill-dashboard-hint",children:e(null!=(n=m.SC[s.status])?n:"dashboard.statusHint.installed")}),(0,a.jsx)("ul",{className:"mt-2 space-y-1","data-testid":"skill-dashboard-roots",children:s.installRoots.map(s=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"skill-dashboard-root",children:[(0,a.jsx)(o.Ex,{variant:s.present?"gray":"error",children:s.present?e("dashboard.rootPresent"):e("dashboard.rootMissing")}),(0,a.jsx)("span",{className:"break-all font-mono text-muted-foreground",children:s.root}),s.modifiedFiles+s.missingFiles+s.unmanagedFiles+s.irregularPaths>0&&(0,a.jsx)("span",{className:"text-warning-foreground","data-testid":"skill-dashboard-drift",children:e("dashboard.driftSummary",{modified:s.modifiedFiles,missing:s.missingFiles,unmanaged:s.unmanagedFiles,irregular:s.irregularPaths})}),s.truncated&&(0,a.jsx)("span",{className:"text-warning-foreground",children:e("dashboard.rootTruncated")})]},s.root))})]},"".concat(s.worktreeId,":").concat(s.skillId))})}),(0,a.jsx)(b,{})]})}function C(){let e=(0,d.c)("skills");return(0,a.jsx)(n.GV,{children:(0,a.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-foreground mb-2",children:e("dashboard.title")}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:e("dashboard.description")}),(0,a.jsx)(l(),{href:"/skills",className:"mt-2 inline-flex text-sm text-accent-600 hover:underline dark:text-accent-400",children:e("page.backToCatalog")})]}),(0,a.jsx)(y,{})]})})}},77801:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(71847).A)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]])}},e=>{e.O(0,[6809,4909,2770,790,4974,6402,3898,6381,5229,2751,8441,1255,7358],()=>e(e.s=7727)),_N_E=e.O()}]);
|