commandmate 0.22.2 → 0.24.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 +383 -374
- package/.next/app-path-routes-manifest.json +16 -15
- package/.next/build-manifest.json +5 -5
- package/.next/prerender-manifest.json +9 -9
- package/.next/react-loadable-manifest.json +1 -1
- 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.js +1 -1
- package/.next/server/app/api/assistant/conversation/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/assistant/current-output/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/assistant/messages/route.js.nft.json +1 -1
- package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/session/route.js +1 -1
- package/.next/server/app/api/assistant/session/route.js.nft.json +1 -1
- package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/start/route.js +1 -1
- package/.next/server/app/api/assistant/start/route.js.nft.json +1 -1
- package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/terminal/route.js +3 -3
- package/.next/server/app/api/assistant/terminal/route.js.nft.json +1 -1
- package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/tools/route.js +1 -1
- package/.next/server/app/api/assistant/tools/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/daily-summary/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/daily-summary/status/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/external-apps/[id]/health/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/external-apps/[id]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/external-apps/route.js.nft.json +1 -1
- package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/browse/route.js +1 -1
- package/.next/server/app/api/fs/browse/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/fs/recent-paths/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/hooks/agent-event/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/hooks/claude-done/route.js.nft.json +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.js.nft.json +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.js +1 -1
- package/.next/server/app/api/metrics/vibe/route.js.nft.json +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.js +1 -0
- package/.next/server/app/api/push/escalation/route.js.nft.json +1 -0
- package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/push/subscriptions/route.js +1 -1
- package/.next/server/app/api/push/subscriptions/route.js.nft.json +1 -1
- package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/vapid/route.js +1 -1
- package/.next/server/app/api/push/vapid/route.js.nft.json +1 -1
- package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/route.js +1 -1
- package/.next/server/app/api/repositories/[id]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/repositories/[id]/todos/[todoId]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/repositories/[id]/todos/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/excluded/route.js +1 -1
- package/.next/server/app/api/repositories/excluded/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/restore/route.js +1 -1
- package/.next/server/app/api/repositories/restore/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/route.js +1 -1
- package/.next/server/app/api/repositories/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/scan/route.js +1 -1
- package/.next/server/app/api/repositories/scan/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/sync/route.js +1 -1
- package/.next/server/app/api/repositories/sync/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/repositories/validate-path/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/sidebar/group-order/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/skills/installations/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/operations/route.js +1 -1
- package/.next/server/app/api/skills/operations/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/reindex/route.js +1 -1
- package/.next/server/app/api/skills/reindex/route.js.nft.json +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.js +1 -4
- package/.next/server/app/api/tasks/[taskId]/cancel/route.js.nft.json +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.js +1 -4
- package/.next/server/app/api/tasks/[taskId]/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/templates/[id]/route.js +1 -1
- package/.next/server/app/api/templates/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/templates/route.js +1 -1
- package/.next/server/app/api/templates/route.js.nft.json +1 -1
- package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/todos/route.js +1 -1
- package/.next/server/app/api/todos/route.js.nft.json +1 -1
- package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/verification/runs/[runId]/route.js +1 -1
- package/.next/server/app/api/verification/runs/[runId]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/verification/runs/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cli-tool/route.js.nft.json +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.js +2 -2
- package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js.nft.json +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.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route.js.nft.json +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.js +2 -2
- package/.next/server/app/api/worktrees/[id]/execution-logs/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/files/[...path]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branch/create/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branch/delete/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branches/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/checkout/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/commit/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/diff/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/fetch/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/log/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/pull/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/push/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/reset/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/revert/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stage/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/staged/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/apply/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/pop/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/push/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/status/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/unstage/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/working-diff/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/[filename]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/route.js.nft.json +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.js +6 -6
- package/.next/server/app/api/worktrees/[id]/marp-render/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/memos/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/messages/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/route.js.nft.json +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.js +2 -2
- package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/active/route.js.nft.json +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.js +3 -3
- package/.next/server/app/api/worktrees/[id]/schedules/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/search/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/slash-commands/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/special-keys/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/start-polling/route.js.nft.json +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.js +2 -2
- package/.next/server/app/api/worktrees/[id]/tasks/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/timers/history/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/timers/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/todos/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tree/[...path]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tree/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/upload/[...path]/route.js.nft.json +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.js +1 -4
- package/.next/server/app/api/worktrees/[id]/verify/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/viewed/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/route.js +1 -1
- package/.next/server/app/api/worktrees/route.js.nft.json +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_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.js +1 -1
- package/.next/server/app/proxy/[...path]/route.js.nft.json +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 +1 -1
- 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 +1 -1
- 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.js +1 -1
- package/.next/server/app/worktrees/[id]/terminal/page.js.nft.json +1 -1
- package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +16 -15
- package/.next/server/chunks/1029.js +1 -1
- package/.next/server/chunks/1068.js +1 -1
- package/.next/server/chunks/1296.js +1 -1
- package/.next/server/chunks/1366.js +1 -1
- package/.next/server/chunks/1601.js +7 -0
- package/.next/server/chunks/1825.js +1 -1
- 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/2546.js +1 -1
- package/.next/server/chunks/3241.js +1 -0
- package/.next/server/chunks/3417.js +1 -1
- package/.next/server/chunks/3451.js +1 -1
- package/.next/server/chunks/3480.js +1 -1
- package/.next/server/chunks/3543.js +1 -1
- package/.next/server/chunks/3945.js +1 -1
- package/.next/server/chunks/406.js +10 -6
- package/.next/server/chunks/4393.js +1 -0
- package/.next/server/chunks/4444.js +1 -1
- package/.next/server/chunks/4455.js +1 -0
- package/.next/server/chunks/5164.js +1 -0
- package/.next/server/chunks/5959.js +5 -6
- package/.next/server/chunks/5998.js +2 -13
- package/.next/server/chunks/6130.js +1 -1
- package/.next/server/chunks/6159.js +1 -1
- package/.next/server/chunks/6274.js +3 -3
- package/.next/server/chunks/6401.js +1 -1
- package/.next/server/chunks/6781.js +1 -0
- package/.next/server/chunks/7458.js +6 -0
- package/.next/server/chunks/{3753.js → 7970.js} +57 -32
- package/.next/server/chunks/8536.js +1 -1
- package/.next/server/chunks/880.js +21 -0
- package/.next/server/chunks/8807.js +250 -192
- package/.next/server/chunks/9058.js +1 -1
- package/.next/server/chunks/9067.js +1 -1
- package/.next/server/chunks/9123.js +8 -8
- package/.next/server/chunks/9358.js +1 -1
- package/.next/server/chunks/9360.js +1 -1
- package/.next/server/chunks/9373.js +3 -3
- package/.next/server/chunks/9687.js +2 -2
- 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/server/src/middleware.js.map +1 -1
- package/.next/static/chunks/4322-dfd5a7119b5ba4fc.js +1 -0
- package/.next/static/chunks/{4974-eaf66770bfa9dea0.js → 4974-35592ec312322124.js} +1 -1
- package/.next/static/chunks/5229-0610b4e3288e777d.js +1 -0
- package/.next/static/chunks/6381-18a6a02a94d00d76.js +1 -0
- package/.next/static/chunks/7229.7f0f5a7032b612b4.js +1 -0
- package/.next/static/chunks/{744-fa8c0ae444c8338c.js → 744-3ad06d8c8ca482fc.js} +1 -1
- package/.next/static/chunks/app/api/app/update/{route-973ec48531555712.js → route-fae89f8d4cc3ff97.js} +1 -1
- package/.next/static/chunks/app/api/app/update-check/{route-973ec48531555712.js → route-fae89f8d4cc3ff97.js} +1 -1
- package/.next/static/chunks/app/api/assistant/conversation/{route-973ec48531555712.js → route-fae89f8d4cc3ff97.js} +1 -1
- package/.next/static/chunks/app/api/assistant/current-output/{route-973ec48531555712.js → route-fae89f8d4cc3ff97.js} +1 -1
- package/.next/static/chunks/app/api/assistant/messages/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/assistant/session/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/assistant/start/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/assistant/terminal/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/assistant/tools/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/auth/login/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/auth/status/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/daily-summary/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/daily-summary/status/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/external-apps/[id]/health/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/external-apps/[id]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/external-apps/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/fs/browse/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/fs/recent-paths/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/hooks/agent-event/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/hooks/claude-done/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/hooks/permission-request/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/metrics/vibe/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/ollama/models/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/push/escalation/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/push/subscriptions/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/push/vapid/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/[id]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/[id]/todos/[todoId]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/[id]/todos/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/clone/[jobId]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/clone/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/excluded/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/restore/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/scan/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/sync/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/repositories/validate-path/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/sidebar/group-order/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/skills/[id]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/skills/installations/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/skills/operations/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/skills/reindex/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/skills/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/slash-commands/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/tasks/[taskId]/cancel/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/tasks/[taskId]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/templates/[id]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/templates/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/todos/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/verification/runs/[runId]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/verification/runs/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/auto-yes/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/capture/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/cli-tool/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/cmate/schedules/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/current-output/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/[logId]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/files/[...path]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/branch/create/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/branch/delete/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/branches/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/checkout/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/commit/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/diff/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/fetch/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/log/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/pull/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/push/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/reset/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/revert/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/show/[commitHash]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/stage/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/staged/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/stash/[index]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/stash/apply/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/stash/pop/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/stash/push/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/stash/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/status/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/unstage/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/git/working-diff/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/interrupt/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/kill-session/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/logs/[filename]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/logs/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/marp-render/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/memos/[memoId]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/memos/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/messages/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/respond/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/schedules/[scheduleId]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/schedules/active/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/schedules/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/search/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/send/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/install/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/plan/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update-plan/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/skills/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/slash-commands/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/special-keys/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/start-polling/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/tasks/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/terminal/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/timers/history/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/timers/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/todos/[todoId]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/todos/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/tree/[...path]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/tree/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/upload/[...path]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/verify/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/[id]/viewed/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/api/worktrees/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/chat/page-15d13fc024d78f5d.js +1 -0
- package/.next/static/chunks/app/layout-6a26ea22d5cf03dc.js +1 -0
- package/.next/static/chunks/app/manifest.webmanifest/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/more/page-b8ba537baeac8d5b.js +1 -0
- package/.next/static/chunks/app/page-afc64708362f31e5.js +1 -0
- package/.next/static/chunks/app/proxy/[...path]/route-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/repositories/page-3469dacb6be7842f.js +1 -0
- package/.next/static/chunks/app/review/page-2d9cb7e068f8f35a.js +1 -0
- package/.next/static/chunks/app/sessions/page-7470c2bfd89e0df9.js +1 -0
- package/.next/static/chunks/app/skills/[skillId]/page-5e24481162f7ea78.js +1 -0
- package/.next/static/chunks/app/skills/installed/page-efd2d710a27f9735.js +1 -0
- package/.next/static/chunks/app/skills/page-0498adfc6e48684b.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/files/[...path]/page-9ddcb224594f620f.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/layout-fae89f8d4cc3ff97.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/page-e611d30e47989e5d.js +1 -0
- package/.next/static/chunks/{webpack-180bebdee221b6f4.js → webpack-3534d858912a6c92.js} +1 -1
- package/.next/static/css/3ac44cfc082d02ad.css +1 -0
- package/.next/static/smu4mnL7qMf8w38n9dQJE/_buildManifest.js +1 -0
- package/.next/trace +12 -12
- package/.next/types/app/api/push/escalation/route.ts +347 -0
- package/.next/types/routes.d.ts +2 -1
- package/.next/types/validator.ts +9 -0
- package/dist/cli/commands/capture.d.ts.map +1 -1
- package/dist/cli/commands/capture.js +6 -0
- package/dist/cli/commands/instances.d.ts.map +1 -1
- package/dist/cli/commands/instances.js +19 -1
- package/dist/cli/commands/task.d.ts.map +1 -1
- package/dist/cli/commands/task.js +6 -0
- package/dist/cli/commands/verify.js +6 -1
- package/dist/cli/types/api-responses.d.ts +46 -0
- package/dist/cli/types/api-responses.d.ts.map +1 -1
- package/dist/cli/utils/verify-runner.d.ts.map +1 -1
- package/dist/cli/utils/verify-runner.js +17 -1
- package/dist/server/locales/en/notifications.json +20 -1
- package/dist/server/locales/ja/notifications.json +20 -1
- package/dist/server/server.js +23 -0
- package/dist/server/src/config/log-config.js +10 -1
- package/dist/server/src/config/safe-directory.js +103 -0
- package/dist/server/src/config/system-directories.js +74 -9
- package/dist/server/src/lib/cli-tools/antigravity.js +19 -2
- package/dist/server/src/lib/cli-tools/codex.js +95 -1
- package/dist/server/src/lib/cli-tools/copilot.js +30 -1
- package/dist/server/src/lib/cli-tools/gemini.js +28 -2
- package/dist/server/src/lib/cli-tools/opencode.js +51 -2
- package/dist/server/src/lib/db/db.js +2 -1
- package/dist/server/src/lib/db/migrations/index.js +2 -0
- package/dist/server/src/lib/db/migrations/runner.js +1 -1
- package/dist/server/src/lib/db/migrations/v56-gate-result-source.js +58 -0
- package/dist/server/src/lib/db/verification-db.js +26 -6
- package/dist/server/src/lib/detection/model-info-extractor.js +384 -0
- package/dist/server/src/lib/git/git-default-branch.js +59 -0
- package/dist/server/src/lib/hooks/agent-event-service.js +205 -0
- package/dist/server/src/lib/hooks/agent-event-types.js +7 -86
- package/dist/server/src/lib/hooks/hook-settings-generator.js +26 -11
- package/dist/server/src/lib/hooks/permission-decision-service.js +269 -0
- package/dist/server/src/lib/hooks/sources/abstain.js +78 -0
- package/dist/server/src/lib/hooks/sources/antigravity/hooks-config.js +372 -0
- package/dist/server/src/lib/hooks/sources/antigravity/source.js +229 -0
- package/dist/server/src/lib/hooks/sources/antigravity/tool-id.js +16 -0
- package/dist/server/src/lib/hooks/sources/claude/source.js +150 -0
- package/dist/server/src/lib/hooks/sources/claude/tool-id.js +18 -0
- package/dist/server/src/lib/hooks/sources/codex/hooks-config.js +465 -0
- package/dist/server/src/lib/hooks/sources/codex/source.js +143 -0
- package/dist/server/src/lib/hooks/sources/codex/tool-id.js +15 -0
- package/dist/server/src/lib/hooks/sources/copilot/hook-settings.js +473 -0
- package/dist/server/src/lib/hooks/sources/copilot/source.js +210 -0
- package/dist/server/src/lib/hooks/sources/copilot/tool-id.js +15 -0
- package/dist/server/src/lib/hooks/sources/define-source.js +177 -0
- package/dist/server/src/lib/hooks/sources/event-mapper.js +177 -0
- package/dist/server/src/lib/hooks/sources/gemini/event-vocabulary.js +102 -0
- package/dist/server/src/lib/hooks/sources/gemini/settings-generator.js +315 -0
- package/dist/server/src/lib/hooks/sources/gemini/shared-config-tree.js +103 -0
- package/dist/server/src/lib/hooks/sources/gemini/source.js +151 -0
- package/dist/server/src/lib/hooks/sources/gemini/tool-id.js +17 -0
- package/dist/server/src/lib/hooks/sources/hook-event-vocabulary.js +111 -0
- package/dist/server/src/lib/hooks/sources/index.js +62 -0
- package/dist/server/src/lib/hooks/sources/legacy-relay.js +84 -0
- package/dist/server/src/lib/hooks/sources/opencode/client.js +299 -0
- package/dist/server/src/lib/hooks/sources/opencode/ingest.js +267 -0
- package/dist/server/src/lib/hooks/sources/opencode/mappers.js +176 -0
- package/dist/server/src/lib/hooks/sources/opencode/payloads.js +189 -0
- package/dist/server/src/lib/hooks/sources/opencode/ports.js +295 -0
- package/dist/server/src/lib/hooks/sources/opencode/runtime.js +159 -0
- package/dist/server/src/lib/hooks/sources/opencode/source.js +253 -0
- package/dist/server/src/lib/hooks/sources/opencode/subscription.js +422 -0
- package/dist/server/src/lib/hooks/sources/opencode/tool-id.js +14 -0
- package/dist/server/src/lib/hooks/sources/opencode/turn-gate.js +193 -0
- package/dist/server/src/lib/hooks/sources/pending-decisions.js +127 -0
- package/dist/server/src/lib/hooks/sources/registry.js +111 -0
- package/dist/server/src/lib/hooks/sources/types.js +46 -0
- package/dist/server/src/lib/polling/response-checker.js +47 -0
- package/dist/server/src/lib/push/escalation-settings.js +114 -0
- package/dist/server/src/lib/push/index.js +21 -1
- package/dist/server/src/lib/push/notification-dedup.js +35 -0
- package/dist/server/src/lib/push/push-sender.js +66 -7
- package/dist/server/src/lib/push/waiting-push-notifier.js +231 -0
- package/dist/server/src/lib/realtime/waiting-broadcast.js +93 -0
- package/dist/server/src/lib/session/agent-event-state.js +260 -0
- package/dist/server/src/lib/session/agent-session-lifecycle.js +82 -0
- package/dist/server/src/lib/session/claude-session.js +10 -3
- package/dist/server/src/lib/session/current-output-builder.js +24 -0
- package/dist/server/src/lib/session/next-action-helper.js +93 -0
- package/dist/server/src/lib/session/prompt-waiting-composition.js +38 -0
- package/dist/server/src/lib/session/waiting-episode-state.js +136 -0
- package/dist/server/src/lib/session/waiting-kind.js +59 -0
- package/dist/server/src/lib/tasks/contract-message.js +218 -0
- package/dist/server/src/lib/tasks/contract-parser.js +58 -12
- package/dist/server/src/lib/verification/env-clean-gate.js +320 -0
- package/dist/server/src/lib/verification/env-snapshot.js +474 -0
- package/dist/server/src/lib/verification/gate-runner.js +844 -0
- package/dist/server/src/lib/verification/scope-gate.js +402 -0
- package/dist/server/src/lib/verification/verify-config.js +314 -0
- package/dist/server/src/lib/ws-server.js +9 -0
- package/dist/server/src/types/sidebar.js +68 -0
- package/package.json +1 -1
- package/scripts/hooks/cmate-agent-event.sh +73 -3
- package/.next/server/chunks/6283.js +0 -1
- package/.next/server/chunks/646.js +0 -21
- package/.next/server/chunks/8856.js +0 -4
- package/.next/static/XpKfn5x6H-mtTaXI9yNmb/_buildManifest.js +0 -1
- package/.next/static/chunks/4560-0917ae2e6a0e5400.js +0 -1
- package/.next/static/chunks/6488-53a3e1d78e4fe8f7.js +0 -1
- package/.next/static/chunks/7229.edb331fb9fbafa27.js +0 -1
- package/.next/static/chunks/app/api/assistant/messages/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/assistant/session/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/assistant/start/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/assistant/terminal/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/assistant/tools/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/auth/login/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/auth/logout/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/auth/status/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/daily-summary/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/daily-summary/status/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/external-apps/[id]/health/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/external-apps/[id]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/external-apps/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/fs/browse/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/fs/recent-paths/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/hooks/agent-event/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/hooks/claude-done/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/hooks/permission-request/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/metrics/vibe/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/ollama/models/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/push/subscriptions/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/push/vapid/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/[id]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/[id]/todos/[todoId]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/[id]/todos/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/clone/[jobId]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/clone/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/excluded/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/restore/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/scan/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/sync/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/repositories/validate-path/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/sidebar/group-order/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/skills/[id]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/skills/installations/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/skills/operations/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/skills/reindex/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/skills/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/slash-commands/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/tasks/[taskId]/cancel/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/tasks/[taskId]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/templates/[id]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/templates/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/todos/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/verification/runs/[runId]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/verification/runs/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/auto-yes/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/capture/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/cli-tool/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/cmate/schedules/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/current-output/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/[logId]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/execution-logs/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/files/[...path]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/branch/create/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/branch/delete/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/branches/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/checkout/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/commit/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/diff/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/fetch/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/log/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/pull/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/push/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/reset/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/revert/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/show/[commitHash]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/stage/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/staged/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/stash/[index]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/stash/apply/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/stash/pop/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/stash/push/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/stash/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/status/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/unstage/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/git/working-diff/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/interrupt/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/kill-session/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/logs/[filename]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/logs/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/marp-render/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/memos/[memoId]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/memos/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/messages/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/prompt-response/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/respond/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/schedules/[scheduleId]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/schedules/active/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/schedules/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/search/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/send/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/install/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/plan/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/skills/[skillId]/update-plan/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/skills/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/slash-commands/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/special-keys/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/start-polling/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/tasks/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/terminal/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/timers/history/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/timers/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/todos/[todoId]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/todos/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/tree/[...path]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/tree/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/upload/[...path]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/verify/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/[runId]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/verify/runs/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/[id]/viewed/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/api/worktrees/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/chat/page-83a2238ab453afaa.js +0 -1
- package/.next/static/chunks/app/layout-86574192bd3c0e6b.js +0 -1
- package/.next/static/chunks/app/manifest.webmanifest/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/more/page-1619018cac999bbc.js +0 -1
- package/.next/static/chunks/app/page-a34d26812f085b6c.js +0 -1
- package/.next/static/chunks/app/proxy/[...path]/route-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/repositories/page-202680fe6ec169c8.js +0 -1
- package/.next/static/chunks/app/review/page-b559bfb11c46931b.js +0 -1
- package/.next/static/chunks/app/sessions/page-3fa7e767d0ab3889.js +0 -1
- package/.next/static/chunks/app/skills/[skillId]/page-10d6f983e5f06ffb.js +0 -1
- package/.next/static/chunks/app/skills/installed/page-6641f95e6a6e5f9d.js +0 -1
- package/.next/static/chunks/app/skills/page-184f8e23e31a3667.js +0 -1
- package/.next/static/chunks/app/worktrees/[id]/files/[...path]/page-6041d3c3db326317.js +0 -1
- package/.next/static/chunks/app/worktrees/[id]/layout-973ec48531555712.js +0 -1
- package/.next/static/chunks/app/worktrees/[id]/page-6dc0b8c4e808ea3e.js +0 -1
- package/.next/static/css/d3453a6876553d32.css +0 -1
- /package/.next/static/{XpKfn5x6H-mtTaXI9yNmb → smu4mnL7qMf8w38n9dQJE}/_ssgManifest.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
exports.id=5959,exports.ids=[1296,5959,9358],exports.modules={60:(a,b,c)=>{"use strict";c.d(b,{Q:()=>f,b:()=>e});var d=c(26283);function e(a){return d.Md.test(a)&&!d.kD.test(a)}function f(a,b,c,d,e,g=!1){if(a=Math.max(0,a),"opencode"===d||"copilot"===d||g){let a=e(b);return a>=0?a+1:0}if("antigravity"===d){let c=e(b);return c>=0?c+1:Math.max(0,a)}if(a>=b||c){let a=e(40);return a>=0?a+1:0}if("codex"===d)return Math.max(0,a);if(a>=b-5){let a=e(50);return a>=0?a+1:Math.max(0,b-40)}return Math.max(0,a)}},2669:(a,b,c)=>{"use strict";c.d(b,{M7:()=>d,Sr:()=>g,mR:()=>h,su:()=>j,wQ:()=>i});let d="SESSION_STARTING",e="SESSION_START_FAILED",f=[d,e];class g extends Error{constructor(a,b,c){super(`${a} did not reach its input prompt within ${Math.round(c/1e3)}s (initialization timeout). The tmux session '${b}' and its process are still running, so this is a slow start, not a failed one — the message was not delivered, but nothing needs repairing. Retry the send in a few seconds, or run \`commandmate capture <worktree-id>\` to see what it is waiting on.`),this.toolName=a,this.sessionName=b,this.timeoutMs=c,this.code=d,this.name="SessionStartTimeoutError"}}class h extends Error{constructor(a,b,c){super(`${a} reported an error while starting in tmux session '${b}': "${c}". Retrying will not help until that is resolved; run \`commandmate capture <worktree-id>\` to see the session output.`),this.toolName=a,this.sessionName=b,this.detectedPattern=c,this.code=e,this.name="SessionStartFailedError"}}function i(a){return k(a)===d}function j(a){let b=k(a);return void 0!==b&&f.includes(b)}function k(a){if("object"!=typeof a||null===a)return;let b=a.code;return"string"==typeof b?b:void 0}},3523:(a,b,c)=>{"use strict";c.d(b,{z$:()=>C,zX:()=>D});var d=c(31766),e=c(88807),f=c(56791),g=c(69297),h=c(25129),i=c(18778),j=c(15194),k=c(8988),l=c(26283),m=c(72626),n=c(46423),o=c(93997),p=c(60),q=c(82450),r=c(56263),s=c(13033),t=c(72457),u=c(71080),v=c(45146),w=c(63865),x=c(2924);let y=(0,m.h)("response-poller");function z(a){return{response:"",isComplete:!1,lineCount:a}}function A(a,b,c,d,e,f,g,h=!1){let i=(0,p.Q)(b,c,d,e,f,h),j=a.slice(i);return{response:(0,l.aJ)(j.join("\n")),isComplete:!0,lineCount:c,promptDetection:g,bufferReset:d,captureWindowSaturated:h}}function B(a,b){let c=(0,l.KO)(b);return(0,h.gF)((0,l._A)((0,l.aJ)(a)),c)}function C(a,b,c,d=o.xE){let e=a.split("\n"),f=e.length;for(;f>0&&""===e[f-1].trim();)f--;let g=e.slice(0,f),h=g.length,i=(0,o.sl)(e.length,d),j="claude"===c?(0,l.GT)(g):-1,k=j>=0?j:h,m=h>0&&b>25&&h+25<b,q=h>0&&b>50&&h<50,r=m||q;if(!r&&h<b-5)return null;let s=Math.max(0,h-20),t=g.slice(s),u="opencode"===c?(0,l.aJ)(g.join("\n")):t.join("\n"),{promptPattern:w,separatorPattern:x,thinkingPattern:y,skipPatterns:D}=(0,l._X)(c),E=(a=60)=>{let b;if("codex"===c)b=/^›\s+(?!Implement|Find and fix|Type|Summarize)/;else if("opencode"===c){let b=0;for(let c=h-1;c>=Math.max(0,h-a);c--){let a=(0,l.aJ)(g[c]);if(l.Md.test(a)&&2==++b)return c}return -1}else b=/^[>❯]\s+\S/;for(let c=k-1;c>=Math.max(0,k-a);c--){let a=(0,l.aJ)(g[c]);if(b.test(a))return c}return -1};if("claude"===c||"codex"===c||"copilot"===c){let a=B(g.join("\n"),c);if(a.isPrompt)return A(g,b,h,r,c,E,a,i)}let F=(0,l.aJ)(u),G=w.test(F),H=x.test(F),I="codex"===c?(0,l.DR)(g,20):y.test(F),J=("codex"===c||"gemini"===c||"vibe-local"===c||"copilot"===c||"antigravity"===c)&&G&&!I,K="claude"===c&&G&&H&&!I,L="opencode"===c&&(0,p.b)(F);if(J||K||L){let a=[],d=(0,p.Q)(b,h,r,c,E,i),e=h;for(let b=d;b<k;b++){let d=g[b],f=(0,l.aJ)(d);if("codex"===c&&/^›\s+/.test(f)||"gemini"===c&&/^(%|\$|.*@.*[%$#])\s*$/.test(f)||"antigravity"===c&&/^>\s*$/.test(f)||"opencode"===c&&(l.sy.test(f)||l.uA.test(f))){e=b;break}D.some(a=>a.test(f))||a.push(d)}let f=a.join("\n").trim(),j=f.split("\n").slice(-n.$).join("\n");if(y.test(j))return z(h);if("claude"===c){let a=(0,l.aJ)(f),b=/[╭╮╰╯│]/.test(a)||/░{3,}/.test(a)||/▓{3,}/.test(a),c=/Claude Code|claude\/|v\d+\.\d+/.test(a),d=/Tip:|for shortcuts|\?\s*for help/.test(a),e=/^\s*\/Users\/.*$/m.test(a)&&a.split("\n").length<30,g=a.match(/^[>❯]\s+(\S.*)$/m);if(g){let b=a.indexOf(g[0]);if(0===a.substring(b+g[0].length).trim().split("\n").filter(a=>{let b=a.trim();return b&&!D.some(a=>a.test(b))&&!/^─+$/.test(b)}).length)return z(h)}else if((b||c||d||e)&&f.length<2e3)return z(h)}if("gemini"===c&&((f.match(/[░███]/g)||[]).length>.3*f.length||v.SI.some(a=>f.includes(a))||!f.includes("✦")&&f.length<10))return z(h);if("opencode"===c){let a=(0,l.aJ)(f);if((a.length<50||!l.Md.test(F))&&0===a.split("\n").filter(a=>{let b=a.trim();return b&&!l.sx.some(a=>a.test(b))}).length)return z(h)}return{response:f,isComplete:!0,lineCount:e,bufferReset:r,captureWindowSaturated:i}}if("opencode"!==c){let a=B(g.join("\n"),c);if(a.isPrompt)return A(g,b,h,r,c,E,a,i)}let M=[],N=r||i||b>=h-5,O=N?E(80):-1,P=N?O>=0?O+1:Math.max(0,h-80):Math.max(0,b);for(let a=P;a<Math.min(h,k);a++){let b=g[a],c=(0,l.aJ)(b);D.some(a=>a.test(c))||M.push(b)}let Q=M.join("\n").trim();return Q?{response:Q,isComplete:!1,lineCount:h}:z(h)}async function D(a,b,c){let h=(0,e.getDbInstance)(),m=c??b;try{let e=(0,f.Uim)(h,a);if(!e)return y.error("worktree-worktreeid-not"),(0,v.Et)(a,b,c),!1;if(!await (0,d.K1)(a,b,c))return y.info("session-not-running"),(0,v.Et)(a,b,c),!1;let p=(0,f.y1O)(h,a,m),z=p?.lastCapturedLine||0,A=await (0,d.Wh)(a,b,o.xE,c);if("opencode"===b||"copilot"===b){let d=(0,v.MN)(a,b,c);(0,s.IZ)(d,A,b)}let D=C(A,z,b,o.xE);if(!D||!D.isComplete){let{thinkingPattern:c}=(0,l._X)(b),d=(0,l.aJ)(A).split("\n").slice(-n.$).join("\n");return c.test(d)&&(0,f.PLg)(h,a,b,m)>0&&y.info("marked-answeredcount-pending"),!1}let E="opencode"===b||"copilot"===b,F=!(0,j.VA)(b)&&!D.captureWindowSaturated;if(F&&!D.bufferReset&&D.lineCount===z&&!p?.inProgressMessageId)return!1;if(F&&!D.bufferReset&&D.lineCount<=z)return y.info("already-saved-up-to-line-lastcapturedlin"),!1;let G=D.promptDetection??B(D.response,b);if(G.isPrompt){let d=G.rawContent||G.cleanContent,i=(0,v.MN)(a,b,c),j=(0,t.zm)(d,b);if((0,t.gv)(i,j))return y.info("duplicate-prompt-skipped",{worktreeId:a,cliToolId:b}),!1;let k=d;"copilot"===b&&(k=(0,q.LH)(d),k=(0,q.Sj)(k,r.Rf,r.ky)),(0,f.YXK)(h,a,b,m);let l=(0,f.oHS)(h,{worktreeId:a,role:"assistant",content:k,messageType:"prompt",promptData:G.promptData,timestamp:new Date,cliToolId:b,instanceId:m});return(0,f.PPx)(h,a,b,D.lineCount,m),(0,g.broadcastMessage)("message",{worktreeId:a,message:l}),(0,x.r)(h,a,b,m,"prompt_detected",{promptType:G.promptData?.type}),(0,w.J$)({worktreeId:a,worktreeName:e.name,kind:"prompt",agentName:m,excerpt:G.promptData?.question??k}).catch(()=>{}),E||(0,v.Et)(a,b,c),!0}if(!D.response||""===D.response.trim())return(0,f.PPx)(h,a,b,D.lineCount,m),!1;let H="claude"===b?(0,k.R)(D.response):void 0,I=D.response;if("gemini"===b)I=(0,q.IS)(D.response);else if("claude"===b)I=(0,q.NN)(D.response);else if("copilot"===b){let d=(0,v.MN)(a,b,c),e=(0,s.Uz)(d)||D.response;I=(0,q.LH)(e),I=(0,q.Sj)(I,r.Rf,r.ky),(0,s.q1)(d)}else if("opencode"===b){I=(0,q.aW)(D.response);let d=(0,v.MN)(a,b,c);(0,s.q1)(d)}if(!I||""===I.trim()||"[No content]"===I)return(0,f.PPx)(h,a,b,D.lineCount,m),(0,f.YXK)(h,a,b,m),!1;if(!F){let d=(0,v.MN)(a,b,c);if((0,u.j7)(d,I))return(0,f.PPx)(h,a,b,D.lineCount,m),!1}I&&await (0,i.T)(h,a,I,b),(0,f.PLg)(h,a,b,m)>0&&y.info("marked-answeredcount-pending");let J=(0,f.y1O)(h,a,m);if(F&&J&&D.lineCount<=J.lastCapturedLine)return y.info("race-condition-detected-skipping-save-re"),!1;let K=(0,f.oHS)(h,{worktreeId:a,role:"assistant",content:I,messageType:"normal",timestamp:new Date,cliToolId:b,instanceId:m,summary:H?.summary,logFileName:H?.logFileName,requestId:H?.requestId});return(0,g.broadcastMessage)("message",{worktreeId:a,message:K}),(0,w.J$)({worktreeId:a,worktreeName:e.name,kind:"completion",agentName:m,excerpt:I}).catch(()=>{}),(0,f.PPx)(h,a,b,D.lineCount,m),E&&(0,v.Et)(a,b,c),!0}catch(a){return y.error("response:check-failed",{error:a instanceof Error?a.message:String(a)}),!1}}},5363:(a,b,c)=>{"use strict";c.d(b,{v7:()=>d.v7,LP:()=>d.LP,pL:()=>d.pL,GE:()=>d.GE,aq:()=>d.aq,kC:()=>d.kC,xU:()=>x,bZ:()=>y,W8:()=>d.W8,W5:()=>E,_i:()=>F,_C:()=>G});var d=c(24455),e=c(31766),f=c(25129),g=c(75498),h=c(91318),i=c(52277),j=c(2924),k=c(88807),l=c(52660),m=c(63869),n=c(31268),o=c(26283),p=c(77093),q=c(93997),r=c(68901),s=c(72626),t=c(66007);let u=(0,s.h)("auto-yes-poller"),v=globalThis.__autoYesPollerStates??(globalThis.__autoYesPollerStates=new Map);function w(a){return v.get(a)}function x(a){let b=w(a);return b?.lastServerResponseTimestamp??null}function y(a){return v.has(a)}function z(a){let b=w(a);if(b&&(b.consecutiveErrors++,b.currentInterval=(0,d.G)(b.consecutiveErrors),b.consecutiveErrors>=r.ul)){let b=(0,d.Ue)(a),c=(0,d.pL)(a);c&&(0,d.XK)(b,c,"consecutive_errors",(0,d.GE)(a)??void 0),F(a)}}async function A(a,b,c,d){let f=c??r.FW,g=await (0,e.Wh)(a,b,f,d);return(0,o._A)((0,o.aJ)(g))}async function B(a,b,e,r,s,t){let v=(0,d.v7)(a,e,t);try{let z=(0,o.KO)(e),A=(0,f.gF)(r,{...z,...s&&{precomputedLines:s}});if(!A.isPrompt||!A.promptData)return b.lastAnsweredPromptKey=null,b.lastAnsweredAt=null,"no_prompt";let B=(x=A.promptData,`${x.type}:${x.question}`);if(b.lastAnsweredPromptKey===B&&null!==b.lastAnsweredAt&&Date.now()-b.lastAnsweredAt<d.UL)return"duplicate";let C=(0,h.n)(a,e,t),D=(0,g.sD)(A.promptData,C);D.suppressedBy&&((0,i.ZS)(a,e,t,{reason:D.suppressedBy,mode:C?.mode??null,promptType:A.promptData.type,pattern:D.pattern}),u.warn("poller:auto-yes-suppressed-by-policy",{worktreeId:a,cliToolId:e,instanceId:t,reason:D.suppressedBy,mode:C?.mode??null,pattern:D.pattern,promptType:A.promptData.type}));let E=D.answer;if(null===E)return"no_answer";let F=n.s.getInstance().getTool(e).getSessionName(a,t);try{await (0,m.t)({sessionName:F,answer:E,cliToolId:e,promptData:A.promptData})}finally{(0,q.gm)(F)}var x,y=Date.now();let G=w(v);G&&(G.lastServerResponseTimestamp=y);let H=w(v);H&&(H.consecutiveErrors=0,H.currentInterval=d.ps),b.lastAnsweredPromptKey=B,b.lastAnsweredAt=Date.now(),u.info("poller:response-sent",{worktreeId:a,cliToolId:e,instanceId:t}),(0,j.r)((0,k.getDbInstance)(),a,e,t??e,"prompt_answered_auto",{promptType:A.promptData.type});let I=null;try{I=(0,l.pG)((0,k.getDbInstance)(),{worktreeId:a,cliToolId:e,instanceId:t??e,promptData:A.promptData,answer:E,answeredBy:"auto",content:A.rawContent||A.cleanContent})}catch(b){u.warn("poller:prompt-audit-record-failed",{worktreeId:a,cliToolId:e,instanceId:t,error:(0,p.u1)(b)})}if(I){let b=I;Promise.resolve().then(c.bind(c,69297)).then(({broadcastMessage:c})=>{c(b.created?"message":"message_updated",{worktreeId:a,message:b.message})}).catch(()=>{})}let[{startPolling:J},{broadcastTerminalSnapshotAfterInteraction:K}]=await Promise.all([Promise.resolve().then(c.bind(c,95220)),Promise.resolve().then(c.bind(c,99508))]);return J(a,e,t),K(a,e,t),"responded"}catch{return z(v),u.warn("poller:detect-respond-error",{worktreeId:a,cliToolId:e,instanceId:t}),"error"}}async function C(a,b,c){let e=(0,d.v7)(a,b,c),f=w(e);if("valid"===function(a,b){if(!b)return"stopped";let c=(0,d.Ue)(a),e=(0,d.pL)(a);if(!e)return F(a),"expired";let f=(0,d.GE)(a)??void 0,g=(0,d.aq)(c,e,f);return g?.enabled?"valid":(F(a),"expired")}(e,f)){try{let g=(0,d.aq)(a,b,c),h=g?.stopPattern?r.FW:r.Ke,i=await A(a,b,h,c),j=i.split("\n");if(function(a,b,c){if(b.stopCheckBaselineLength<0)return b.stopCheckBaselineLength=c.length,!1;let e=b.stopCheckBaselineLength;if(c.length>e){let f=c.substring(e);return b.stopCheckBaselineLength=c.length,(0,d.Cs)(a,f,F)}return c.length<e&&(b.stopCheckBaselineLength=c.length),!1}(e,f,i))return;let k=await B(a,f,b,i,j,c);if("responded"===k)return void D(a,b,c,d.ZO);if("no_prompt"===k){let e=j.slice(-d.Re).join("\n");if((0,o.ut)(b,e))return void D(a,b,c,r.QN)}}catch(d){z(e),u.warn("poller:poll-error",{worktreeId:a,cliToolId:b,instanceId:c,error:(0,p.u1)(d)})}D(a,b,c)}}function D(a,b,c,e){let f=w((0,d.v7)(a,b,c));if(!f)return;let g=Math.max(e??f.currentInterval,d.ps);f.timerId=setTimeout(()=>{C(a,b,c)},g)}function E(a,b,c){if(!(0,t.h6)(a))return{started:!1,reason:"invalid worktree ID"};let e=c??b,f=(0,d.aq)(a,b,e);if(!f?.enabled)return{started:!1,reason:"auto-yes not enabled"};let g=(0,d.v7)(a,b,e),i=w(g);if(!i&&v.size>=d.fC)return{started:!1,reason:"max concurrent pollers reached"};if(i&&i.cliToolId===b)return{started:!0,reason:"already_running"};i&&F(g);let j={timerId:null,cliToolId:b,instanceId:e,consecutiveErrors:0,currentInterval:d.ps,lastServerResponseTimestamp:null,lastAnsweredPromptKey:null,lastAnsweredAt:null,stopCheckBaselineLength:-1};return v.set(g,j),(0,h.ie)(g),j.timerId=setTimeout(()=>{C(a,b,e)},d.ps),u.info("poller:started",{worktreeId:a,cliToolId:b,instanceId:e}),{started:!0}}function F(a){let b=w(a);b&&(b.timerId&&clearTimeout(b.timerId),v.delete(a),(0,h.ie)(a),u.info("poller:stopped",{compositeKey:a}))}function G(a){(0,d._9)(Array.from(v.keys()),a).forEach(a=>F(a))}},7015:(a,b,c)=>{"use strict";c.d(b,{Ds:()=>g});var d=c(81719);class e{constructor(a,b=3e4){this.cache=new Map,this.allAppsCache=null,this.lastRefresh=0,this.db=a,this.ttl=b}getTTL(){return this.ttl}isStale(){return Date.now()-this.lastRefresh>this.ttl}async refresh(){let a=(0,d.$i)(this.db);for(let b of(this.cache.clear(),a))this.cache.set(b.pathPrefix,b);this.allAppsCache=a,this.lastRefresh=Date.now()}async getByPathPrefix(a){return this.isStale()&&await this.refresh(),this.cache.get(a)??null}async getAll(){return this.isStale()&&await this.refresh(),this.allAppsCache??[]}invalidate(){this.cache.clear(),this.allAppsCache=null,this.lastRefresh=0}invalidateByIssueNo(a){this.invalidate()}}let f=null;function g(a){if(!f){if(!a)throw Error("Database instance required to initialize cache");f=new e(a)}return f}},8988:(a,b,c)=>{"use strict";c.d(b,{R:()=>g});let d=/📄 Session log: (.+?\/([^\/\s]+\.jsonl))/,e=/Request ID: ([^\s\n]+)/,f=/Summary: (.+?)(?:\n─|$)/s;function g(a){let b={content:a},c=d.exec(a);c&&(b.logFileName=c[2]);let g=e.exec(a);g&&(b.requestId=g[1]);let h=f.exec(a);return h&&(b.summary=h[1].trim()),b}},9516:(a,b,c)=>{"use strict";c.d(b,{Hu:()=>i,Ll:()=>j});let d=["type something","chat about this"],e=/^\s*\[[ xX]\]\s*/,f=/(?:…|\.\.\.)\s*$/,g=new Set(["yes","y","no","n"]);function h(a){return a.replace(e,"").replace(f,"").replace(/\s+/g," ").trim().toLowerCase()}function i(a,b){if("multiple_choice"!==a.type)return null;let c=function(a,b){let c=h(b);if(""===c)return null;let d=a.questions.map((a,b)=>({entry:a,index:b})).filter(({entry:a})=>(function(a,b){let[c,d]=a.length<=b.length?[a,b]:[b,a];return c.length<8?c===d:d.includes(c)})(h(a.question),c));return 1===d.length?d[0]:null}(b,a.question);if(null===c)return null;let{entry:f,index:g}=c,i=new Map(a.options.map(a=>[a.number,a])),j=[];for(let[a,b]of f.choices.entries()){var k;let c=a+1,d=i.get(c);if(!d||!function(a,b){if(""===a||""===b)return!1;if(a===b)return!0;let[c,d]=a.length<=b.length?[a,b]:[b,a];return!(c.length<8)&&d.startsWith(c)}(h(d.label),h(b.label)))return null;j.push({...d,label:`${(k=d.label,e.exec(k)?.[0]??"")}${b.label}`,...b.description?{description:b.description}:{}})}let l=[];for(let b of a.options)!(b.number<=f.choices.length)&&function(a){let b=h(a);return d.some(a=>b===a||b.startsWith(a))}(b.label)&&(j.push(b),l.push(b.number));return j.sort((a,b)=>a.number-b.number),{...a,question:f.question,options:j,isAskUserQuestion:!0,askUserQuestion:{...f.header?{header:f.header}:{},multiSelect:f.multiSelect,questionIndex:g,questionCount:b.questions.length,metaOptionNumbers:l}}}function j(a,b){let c=b.trim();if(/^\d+$/.test(c)){let b=Number.parseInt(c,10);return a.options.some(a=>a.number===b)?{ok:!0,input:String(b)}:{ok:!1,reason:"answer_out_of_range",message:"The option number is outside the range this prompt offers. Use `commandmate capture <worktree-id> --json` to list the current options."}}let d=function(a,b){let c=h(b);if(""===c)return[];let d=a.filter(a=>h(a.label)===c);return d.length>0?d:c.length<2?[]:a.filter(a=>h(a.label).startsWith(c))}(a.options,c);if(1===d.length){let[a]=d;return{ok:!0,input:String(a.number),resolved:{via:"semantic",optionNumber:a.number,optionLabel:a.label}}}return d.length>1?{ok:!1,reason:"unresolvable_answer",message:"The answer matches more than one option label. Answer with an option number."}:a.options.some(a=>!0===a.requiresTextInput)&&!g.has(c.toLowerCase())?{ok:!0,input:b}:{ok:!1,reason:"unresolvable_answer",message:"No option label matches the answer. Answer with an option number (yes/no is not resolved on a numbered picker — Issue #1681)."}}},11508:(a,b,c)=>{"use strict";c.d(b,{H:()=>m,m:()=>n});var d=c(44265),e=c(11665),f=c(40236),g=c(93997),h=c(26283),i=c(72626),j=c(20610);let k=(0,i.h)("cli-tools/gemini");function l(a){return a instanceof Error?a.message:String(a)}let m=200;class n extends d.M{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,e.N)(c)}async startSession(a,b,c){if(!await this.isInstalled())throw Error("Gemini CLI is not installed or not in PATH");let d=this.getSessionName(a,c);if(await (0,e.N)(d)){await this.reconcileExistingSession(d),k.info("gemini-session-sessionname");return}try{await (0,e.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,j.Uc)),await (0,e.V1)(d,"gemini",!0),await new Promise(a=>setTimeout(a,6e3)),await this.waitForReady(d),k.info("started-gemini-session:sessionname")}catch(b){let a=l(b);throw Error(`Failed to start Gemini session: ${a}`)}}async waitForReady(a){let b=!1;for(let c=0;c<30;c++){try{let c=await (0,e.Xg)(a,m),d=(0,h.aJ)(c);if(h.wN.test(d))return void k.info("gemini-prompt-detected");!b&&d.includes("Do you trust this folder?")&&(await (0,e.ds)(a,"Enter"),b=!0,k.info("auto-trusted-folder-for"))}catch{}await new Promise(a=>setTimeout(a,1e3))}k.info("gemini-prompt-detection")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,e.Xg)(a,m),c=(0,h.aJ)(b);if(h.wN.test(c))return}catch{}await new Promise(a=>setTimeout(a,500))}k.info("gemini-prompt-not")}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,e.N)(d))throw Error(`Gemini session ${d} does not exist. Start the session first.`);try{await this.waitForPrompt(d),await (0,f.FW)({sessionName:d,message:b,cliToolId:"gemini"}),(0,g.gm)(d),k.info("sent-message-to-gemini-session:sessionna")}catch(b){let a=l(b);throw Error(`Failed to send message to Gemini: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,e.N)(c)&&(await (0,e.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,j.Is)),await (0,e.V1)(c,"/quit",!0),await new Promise(a=>setTimeout(a,j.Zf))),await (0,e.fY)(c)&&k.info("stopped-gemini-session:sessionname")}catch(a){throw k.error("session:stop-failed",{error:l(a)}),a}}constructor(...a){super(...a),this.id="gemini",this.name="Gemini CLI",this.command="gemini"}}},11665:(a,b,c)=>{"use strict";c.d(b,{Ce:()=>w,GW:()=>n,KB:()=>r,N:()=>m,N6:()=>y,Sb:()=>z,V1:()=>p,Xg:()=>s,ds:()=>v,fY:()=>t,jw:()=>o,lA:()=>k,zT:()=>l});var d=c(79646),e=c(28354),f=c(93997),g=c(16983),h=c(72626);let i=(0,e.promisify)(d.execFile),j=(0,h.h)("tmux");function k(a){return`=${a}:`}async function l(a,b={}){let c,d,e,f=b.windowWidth??g.Jn,h=b.windowHeight??g.sO,m=k(a);try{c=(await i("tmux",["show-window-options","-v","-t",m,"window-size"],{timeout:5e3})).stdout.trim();let[a,b]=(await i("tmux",["display-message","-p","-t",m,"#{window_width}|#{window_height}"],{timeout:5e3})).stdout.trim().split("|").map(Number);Number.isFinite(a)&&(d=a),Number.isFinite(b)&&(e=b)}catch{}let n="manual"===c,o=d===f&&e===h;if(n&&o)return!1;try{return n||await i("tmux",["set-window-option","-t",m,"window-size","manual"],{timeout:5e3}),o||await i("tmux",["resize-window","-t",m,"-x",String(f),"-y",String(h)],{timeout:5e3}),!0}catch(b){return j.warn("session-geometry:reconcile-failed",{sessionName:a,error:b instanceof Error?b.message:String(b)}),!1}}async function m(a){try{return await i("tmux",["has-session","-t",k(a)],{timeout:5e3}),!0}catch{return!1}}async function n(){try{let{stdout:a}=await i("tmux",["list-sessions","-F","#{session_name}|#{session_windows}|#{session_attached}"],{timeout:5e3});if(!a||""===a.trim())return[];return a.trim().split("\n").map(a=>{let[b,c,d]=a.split("|");return{name:b,windows:parseInt(c,10)||0,attached:"1"===d}})}catch{return[]}}async function o(a,b){let c,d,e,f,h;"string"==typeof a?(c=a,d=b,e=g.eu,f=g.Jn,h=g.sO):(c=a.sessionName,d=a.workingDirectory,e=a.historyLimit||g.eu,f=a.windowWidth||g.Jn,h=a.windowHeight||g.sO);try{await i("tmux",["new-session","-d","-s",c,"-c",d,"-x",String(f),"-y",String(h)],{timeout:5e3}),await i("tmux",["set-option","-t",k(c),"history-limit",String(e)],{timeout:5e3});try{await i("tmux",["new-window","-k","-t",`${k(c)}0`,"-c",d],{timeout:5e3})}catch(a){j.warn("session-history-limit:window-rebuild-failed",{sessionName:c,historyLimit:e,error:a instanceof Error?a.message:String(a)})}await l(c,{windowWidth:f,windowHeight:h})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to create tmux session: ${a}`)}}async function p(a,b,c=!0){let d=c?["send-keys","-t",k(a),b,"C-m"]:["send-keys","-t",k(a),b];try{await i("tmux",d,{timeout:5e3})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to send keys to tmux session: ${a}`)}}let q=new Set(["Up","Down","Left","Right","Enter","Space","Tab","Escape","BSpace","DC","PageUp","PageDown","Home","End","q"]);async function r(a,b){if(0!==b.length){for(let a of b)if(!q.has(a))throw Error(`Invalid special key: ${a}`);try{for(let c=0;c<b.length;c++)await i("tmux",["send-keys","-t",k(a),b[c]],{timeout:5e3}),c<b.length-1&&await new Promise(a=>setTimeout(a,100))}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to send special keys to tmux session: ${a}`)}}}async function s(a,b){let c,d;"number"==typeof b?(c=-b,d="-"):b?(c=b.startLine??-1e4,d=b.endLine??"-"):(c=-1e3,d="-");try{let{stdout:b}=await i("tmux",["capture-pane","-t",k(a),"-p","-e","-S",String(c),"-E",String(d)],{timeout:5e3,maxBuffer:0xa00000});return b}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to capture pane: ${a}`)}}async function t(a){try{return await i("tmux",["kill-session","-t",k(a)],{timeout:5e3}),!0}catch(b){let a=b instanceof Error?b.message:String(b);if(a?.includes("no server running")||a?.includes("can't find session"))return!1;throw Error(`Failed to kill tmux session: ${a}`)}}let u=new Set(["Escape","C-c","C-d","C-m","Enter"]);async function v(a,b){if(!u.has(b))throw Error(`Invalid special key: ${b}`);try{await i("tmux",["send-keys","-t",k(a),b],{timeout:5e3})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to send special key: ${a}`)}}async function w(a){try{await i("tmux",["send-keys","-t",k(a),"C-u"],{timeout:5e3})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to clear tmux input line: ${a}`)}}let x=["Up","Down","Left","Right","Enter","Escape","Tab","BTab","PageUp","PageDown","Home","End","q"];function y(a){return x.includes(a)}async function z(a,b){await r(a,b),(0,f.gm)(a)}},13033:(a,b,c)=>{"use strict";c.d(b,{IW:()=>h,IZ:()=>l,K0:()=>g,Uz:()=>m,l1:()=>f,o0:()=>i,q1:()=>n,tb:()=>k,vQ:()=>j});var d=c(26283);let e=new Map;function f(a){return(0,d._A)((0,d.aJ)(a)).replace(/^\u2503\s?/,"").replace(/\s*\u2503$/,"").trim()}function g(a){let b=a.split("\n"),c=[];for(let a of b){let b=f(a);!(!b||d.sx.some(a=>a.test(b)))&&(d.Md.test(b)||c.push(b))}return c}function h(a){return a.replace(/[\u2500-\u257F]/g,"").replace(/\s{2,}/g," ").trim()}function i(a){let b=(0,d.aJ)(a).split("\n"),c=[];for(let a of b){let b=h(a);b&&(d.J7.some(a=>a.test(b))||c.push(b))}return c}function j(a,b){if(0===a.length||0===b.length)return 0;let c=Math.min(a.length,b.length);for(let d=c;d>=1;d--){let c=a.slice(-d),e=b.slice(0,d),f=!0;for(let a=0;a<d;a++)if(c[a]!==e[a]){f=!1;break}if(f)return d}return 0}function k(a){e.set(a,{lines:[],lastFingerprint:[],pollCount:0})}function l(a,b,c="opencode"){let d=e.get(a);if(!d)return;let f="copilot"===c?i(b):g(b);if(0!==f.length){if(d.pollCount++,0===d.lines.length)d.lines=[...f];else{let a=j(d.lastFingerprint,f);if(a>0){let b=f.slice(a);d.lines.push(...b)}else d.lines.push(...f)}d.lastFingerprint=f.slice(-10)}}function m(a){let b=e.get(a);return b&&0!==b.lines.length?b.lines.join("\n"):""}function n(a){e.delete(a)}},18778:(a,b,c)=>{"use strict";c.d(b,{T:()=>g});var d=c(56791),e=c(41364);let f=(0,c(72626).h)("conversation-logger");async function g(a,b,c,h="claude"){let i=(0,d.r8U)(a,b);if(i)try{await (0,e.hM)(b,i.content,c,h)}catch(a){f.error("conversation:log-failed",{error:a instanceof Error?a.message:String(a)})}}},20610:(a,b,c)=>{"use strict";c.d(b,{CV:()=>i,Em:()=>l,Is:()=>g,KI:()=>j,PY:()=>k,Uc:()=>d,Zf:()=>h,pL:()=>e,x9:()=>f});let d=100,e=100,f=200,g=300,h=500,i=500,j=2e3,k=200,l=100},21684:(a,b,c)=>{"use strict";c.d(b,{U:()=>g});var d=c(33873),e=c.n(d),f=c(87447);function g(){return(0,f._p)("CM_LOG_DIR")||e().join(process.cwd(),"data","logs")}},25129:(a,b,c)=>{"use strict";c.d(b,{gF:()=>H,xn:()=>A});var d=c(72626),e=c(68652),f=c(26283);let g=/^\s*[\u276F\u25CF\u203A][^\d]*(\d+)(?:\.(?!\d)|\s{2,})\s*(.+)$/,h=/^\s*[^\d]{0,3}(\d+)(?:\.(?!\d)|\s+)\s*(.+)$/,i=/^\s*\d{1,3}\s+tasks?\s+\(\d+\s+done\b/i,j=/^\s*[◼◻]\s/,k=/^[-─]+$/,l=/^\s*\[[^\]]*\d+\s+lines?\]/i,m=/^\s*[…]?\s*[+\-↑↓⏵⏷]?\s*\d+\s+(?:pending|more|completed)\b/i,n=/Esc\s+to\s+cancel\s*[·•]\s*Tab\s+to\s+amend/i,o=/Enter\s+to\s+select\b.*\bnavigate\b/i,p=/press\s+(?:enter|number)\s+to\s+confirm/i,q=/press\s+number\s+to\s+confirm/i,r=/(?:select|choose|pick|which|what|how|where|enter|type|specify|confirm|approve|accept|reject|decide|preference|option)/i,s=[/type\s+here/i,/tell\s+(me|claude)/i,/enter\s+/i,/custom/i,/differently/i];function t(a,b){if(0===b.length)return!0;let c=b[0].number;return a<c&&a>=c-2}function u(a){return{isPrompt:!1,cleanContent:a.trim()}}function v(a){return 0!==a.length&&!!(a.includes("?")||a.includes("?")||r.test(a))}function w(a,b){let c=b.endsWith("?")||b.endsWith("?");return!!(!c&&/^\s{2,}[^\d]/.test(a)&&!/^\s*\d+\./.test(a)||!c&&/^\s{4,}/.test(a)&&!/^\s*\d+\.\s/.test(a)||b.length<5&&!c||/^[\/~]/.test(b)||b.length>=2&&/^[a-zA-Z0-9_-]+$/.test(b))}let x=/^[⏺⎿●○•✔✓✖✗✘›»❯└├>]/;function y(a,b){let c=Math.max(0,b-12);for(let d=b-1;d>=c;d--)if(function(a){if(void 0===a)return!1;let b=a.trim();return""!==b&&(x.test(b)||k.test(b))}(a[d]))return d+1;return c}function z(a,b,c){let d=a.slice(b,c).map(a=>a.trimEnd()).join("\n").trim();return d.length>0?d:void 0}function A(a,b="yes_no"){let c=a.toLowerCase().trim();if("multiple_choice"===b){if(/^\d+$/.test(c))return c;throw Error("Invalid answer for multiple choice prompt. Expected a number.")}if("yes"===c||"y"===c)return"y";if("no"===c||"n"===c)return"n";throw Error("Invalid answer for yes/no prompt. Expected 'yes', 'no', 'y', or 'n'.")}let B=(0,d.h)("prompt-detector"),C=null;function D(a){let b=a.split("\n"),c=(b.length>200?b.slice(-200):b).join("\n");return c.length>5e3&&(c=c.slice(-5e3)),c}let E=[{regex:/^(.+)\s+\(y\/n\)\s*$/m},{regex:/^(.+)\s+\[y\/N\]\s*$/m,defaultOption:"no"},{regex:/^(.+)\s+\[Y\/n\]\s*$/m,defaultOption:"yes"},{regex:/^(.+)\s+\(yes\/no\)\s*$/m}];function F(a,b,c,d){let{startLine:e,endLine:f}=function(a,b,c){let d=c.index??0,e=a=>a.split("\n").length-1,f=b+e(a.slice(0,d));return{startLine:f,endLine:f+e(c[0])}}(b,c,d);return z(a,y(a,e),f+1)}function G(a,b,c,d,e){return{isPrompt:!0,promptData:{type:"yes_no",question:a,options:["yes","no"],status:"pending",...void 0!==e&&{defaultOption:e},instructionText:c,...void 0!==d&&{approvalTarget:d}},cleanContent:b,rawContent:c}}function H(a,b){let c=(0,e.N)(a),d=c===a&&b?.precomputedLines?b.precomputedLines:c.split("\n"),r=d.slice(-50).join("\n"),x=r===C;x||B.debug("detectPrompt:start",{outputLength:c.length}),C=r;let A=d.slice(-20).join("\n"),H=Math.max(0,d.length-20),I=function(a,b,c){a=(0,e.N)(a);let d=b?.requireDefaultIndicator??!0,r=a.split("\n"),x=r.length;for(;x>0&&""===r[x-1].trim();)x--;let A=Math.max(0,x-50),B=!1;for(let a=x-1;a>=A;a--){let b=o.test(r[a]);if(n.test(r[a])||b){x=a,B=b;break}}let C=r.slice(A,x);for(let b of C)if(f.l8.test(b))return u(a);let D=!1,E=!1;for(let a of C){let b=a.trim();if(!D&&p.test(b)){D=!0,q.test(b)&&(E=!0);break}}if(d){let b=!1;for(let a of C){let c=a.trim();if(g.test(c)){b=!0;break}}if(!b&&!D)return u(a)}let F=[],G=-1,H=0,I=function(a,b,c){let d=new Set;for(let e=Math.max(0,b);e<Math.min(c,a.length);e++)if(i.test(a[e])){d.add(e);for(let b=e+1;b<Math.min(c,a.length);b++){let c=a[b];if(!j.test(c)&&!m.test(c))break;d.add(b)}}return d}(r,A,x);for(let b=x-1;b>=A;b--){let c=r[b].trim();if(I.has(b)||l.test(c)||m.test(c)){H++;continue}let d=c.match(g);if(d){let a=parseInt(d[1],10);if(a<=20&&t(a,F)){let b=d[2].trim();F.unshift({number:a,label:b,isDefault:!0}),H=0;continue}}let e=c.match(h);if(e){let a=parseInt(e[1],10);if(a>20);else if(t(a,F)){let b=e[2].trim();F.unshift({number:a,label:b,isDefault:!1}),H=0;continue}}if(0===F.length&&(c.startsWith("❯")||c.startsWith("●")||c.startsWith("›")))return u(a);if(F.length>0&&c&&!k.test(c)){let a=r[b];if(/^\s{4,}/.test(a)&&w(a,c)){if(++H>25){G=b;break}continue}if(v(c)){G=b;break}if(w(a,c)){if(++H>(/^\s{4,}/.test(a)?25:5)){G=b;break}continue}G=b;break}}if(!function(a){if(0===a.length||1!==a[0])return!1;let b=0;for(let c=1;c<a.length;c++){let d=a[c]-a[c-1];if(d<1||d>2||(2===d&&b++,b>1))return!1}return!0}(F.map(a=>a.number)))return u(a);let J=F.some(a=>a.isDefault),K=d&&D;if(F.length<2||d&&!J&&!K||!d&&!J&&(-1===G||!v(r[G]?.trim()??"")&&!function(a,b,c,d){let e=Math.max(d,b-3);for(let c=b-1;c>=e;c--){let b=a[c]?.trim()??"";if(!(!b||k.test(b))&&v(b))return!0}return!1}(r,G,0,A)))return u(a);let L=function(a,b){if(b<0)return"Please select an option:";let c=[];for(let d=Math.max(0,b-5);d<=b;d++){let b=a[d].trim();b&&!k.test(b)&&c.push(b)}return c.join(" ")}(r,G),M=function(a,b,c){if(b<0)return;let d=Math.max(0,b-19),e=a.slice(d,c).map(a=>a.trimEnd()).join("\n").trim();return e.length>0?e:void 0}(r,G,x),N=function(a,b,c){if(!(b<0))return z(a,y(a,b),c)}(r,G,x);var O=a,P=D?E?"answer_only":"answer_then_enter":void 0,Q=B;let{instructionText:R,approvalTarget:S}={instructionText:M,approvalTarget:N}??{};return{isPrompt:!0,promptData:{type:"multiple_choice",question:L.trim(),options:F.map(a=>{let b=s.some(b=>b.test(a.label));return{number:a.number,label:a.label,isDefault:a.isDefault,requiresTextInput:b}}),status:"pending",instructionText:R,...void 0!==S?{approvalTarget:S}:{},...P?{submitMode:P}:{},...Q?{isAskUserQuestion:!0}:{}},cleanContent:L.trim(),rawContent:c(O.trim())}}(c,b,D);if(I.isPrompt)return x||B.info("detectPrompt:multipleChoice",{isPrompt:!0,question:I.promptData?.question,optionsCount:I.promptData?.options?.length}),I;let J=A.trim();for(let a of E){let b=A.match(a.regex);if(b){let c=b[1].trim();return G(c,c,J,F(d,A,H,b),a.defaultOption)}}let K=A.match(/^(.*?)Approve\?\s*$/m);if(K){let a=K[1].trim();return G(a?`${a} Approve?`:"Approve?",a||"Approve?",J,F(d,A,H,K))}return x||B.debug("detectPrompt:complete",{isPrompt:!1}),{isPrompt:!1,cleanContent:c.trim()}}},25754:(a,b,c)=>{"use strict";c.d(b,{Xn:()=>e,d9:()=>g,gB:()=>f,rv:()=>h});let d=["en","ja"],e="en",f="locale";function g(a){return"string"==typeof a&&d.includes(a)}function h(a,b){return g(a)?a:d.find(a=>(b??"").includes(a))??e}},26838:(a,b,c)=>{"use strict";c.d(b,{Mj:()=>k,Sw:()=>j,lX:()=>l});var d=c(29021),e=c(33873),f=c(90164);let g=/^v?\d+\.\d+\.\d+$/,h=/^[a-zA-Z0-9.\-\s_v]+$/,i=globalThis.__versionCheckCache??(globalThis.__versionCheckCache={result:null,fetchedAt:0,rateLimitResetAt:null});function j(){return function(){try{let a=(0,d.readFileSync)((0,e.join)(process.cwd(),"package.json"),"utf-8"),b=JSON.parse(a);if("commandmate"===b.name&&"string"==typeof b.version&&b.version.length>0)return b.version;return null}catch{return null}}()??"0.22.2"}function k(){return j()}async function l(){try{var a,b,c;if(null!==i.result&&Date.now()-i.fetchedAt<36e5||i.rateLimitResetAt&&(!(Date.now()>=i.rateLimitResetAt)||(i.rateLimitResetAt=null,0)))return i.result;let d=await fetch("https://api.github.com/repos/Kewton/CommandMate/releases/latest",{headers:{Accept:"application/vnd.github+json","User-Agent":`CommandMate/${k()}`},cache:"no-store",signal:AbortSignal.timeout(5e3)});if(403===d.status)return function(a){let b=a.headers.get("X-RateLimit-Reset");b?i.rateLimitResetAt=1e3*parseInt(b,10):i.rateLimitResetAt=Date.now()+36e5}(d),i.result;if(!d.ok)return i.result;let e=await d.json(),j=k(),l=e.tag_name.replace(/^v/,""),m={hasUpdate:function(a,b){if(!g.test(a)||!g.test(b))return!1;let c=a=>a.replace(/^v/,"").split(".").map(Number),[d,e,f]=c(a),[h,i,j]=c(b);return h!==d?h>d:i!==e?i>e:j>f}(j,e.tag_name),currentVersion:j,latestVersion:l,releaseUrl:(a=e.html_url).startsWith(f.Dk)?a:null,releaseName:(b=e.name,c=e.tag_name,h.test(b)&&b.length<=128?b:c),publishedAt:e.published_at};return i.result=m,i.fetchedAt=Date.now(),m}catch{return i.result}}},30008:(a,b,c)=>{"use strict";c.d(b,{F1:()=>g,_G:()=>i,j0:()=>f,rB:()=>h});var d=c(48083),e=c(67882);let f=3e5,g="CM_STRUCTURED_SEND_GUARD";function h(a){return"notification"===a.source?e.Oh.PERMISSION_PROMPT:e.Oh.PERMISSION_REQUEST}function i({worktreeId:a,cliToolId:b,instanceId:c,scraper:e,ignoreStructured:i=!1,now:j=Date.now()}){var k,l,m;let n=(0,d.P5)(a,b,c,j);null!==n&&("waiting"===e.status?(0,d.zA)(a,b,c,j):n.scraperCorroborated&&((0,d.m5)(a,b,c),n=null));let o=e.hasActivePrompt||null!==n;if(e.hasActivePrompt)return{waiting:o,scraperWaiting:!0,structured:n,blocksSend:!0,blockedBy:"scraper",blockReason:e.reason,structuredSendBlockSuppressed:null};if(null===n)return{waiting:o,scraperWaiting:!1,structured:null,blocksSend:!1,blockedBy:null,blockReason:null,structuredSendBlockSuppressed:null};let p=(k=n,l=i,m=j,l?"caller_opt_out":!function(){let a=process.env[g]?.trim().toLowerCase();return"off"===a||"0"===a||"false"===a}()?m-k.at>=f?"expired":null:"disabled");return{waiting:o,scraperWaiting:!1,structured:n,blocksSend:null===p,blockedBy:null===p?"structured":null,blockReason:null===p?h(n):null,structuredSendBlockSuppressed:p}}},30618:(a,b,c)=>{"use strict";c.d(b,{xT:()=>w,Ui:()=>x});var d=c(44265),e=c(11665),f=c(40236),g=c(93997),h=c(29021),i=c(33873),j=c(72626);let k=(0,j.h)("cli-tools/opencode-config"),l=/^[a-zA-Z0-9._:/-]{1,100}$/,m=/^[a-zA-Z0-9._:/@-]{1,200}$/;async function n(){let a={};try{let b=new AbortController,c=setTimeout(()=>b.abort(),3e3),d=await fetch("http://localhost:11434/api/tags",{signal:b.signal}).finally(()=>{clearTimeout(c)});if(!d.ok)return k.warn("ollama-api-returned"),{};let e=await d.text();if(e.length>1048576)return k.warn("ollama-api-response"),{};let f=JSON.parse(e);if(!f||!Array.isArray(f.models))return k.warn("invalid-ollama-api"),{};for(let b of f.models.slice(0,100))"string"==typeof b?.name&&l.test(b.name)&&(a[b.name]={name:function(a){let b=String(a.name),c=a.details;if(!c)return b;let d=[b];return"string"==typeof c.parameter_size&&/^[\d.]+[BKMGT]?B?$/i.test(c.parameter_size)&&d.push(c.parameter_size),"string"==typeof c.quantization_level&&/^[A-Z0-9_]{1,20}$/i.test(c.quantization_level)&&d.push(c.quantization_level),d.length>1?`${b} (${d.slice(1).join(", ")})`:b}(b)})}catch(a){a instanceof Error&&"AbortError"===a.name?k.warn("ollama-api-timeout"):k.warn("failed-to-fetch")}return a}async function o(){let a={};try{let b=new AbortController,c=setTimeout(()=>b.abort(),3e3),d=await fetch("http://localhost:1234/v1/models",{signal:b.signal}).finally(()=>{clearTimeout(c)});if(!d.ok)return k.warn("lm-studio-api"),{};let e=await d.text();if(e.length>1048576)return k.warn("lm-studio-api"),{};let f=JSON.parse(e);if(!f||!Array.isArray(f.data))return k.warn("invalid-lm-studio"),{};for(let b of f.data.slice(0,100))"string"==typeof b?.id&&m.test(b.id)&&(a[b.id]={name:b.id})}catch(a){a instanceof Error&&"AbortError"===a.name?k.warn("lm-studio-api"):k.warn("failed-to-fetch")}return a}async function p(a){let b=function(a){let b=i.resolve(a);try{if(!h.lstatSync(b).isDirectory())throw Error(`Path is not a directory: ${b}`)}catch(a){if("ENOENT"===a.code)throw Error(`Path does not exist: ${b}`);throw a}return h.realpathSync(b)}(a),c=i.join(b,"opencode.json");if(h.existsSync(c))return;let[d,e]=await Promise.all([n(),o()]),f={};if(Object.keys(d).length>0&&(f.ollama={npm:"@ai-sdk/openai-compatible",name:"Ollama (local)",options:{baseURL:"http://localhost:11434/v1"},models:d}),Object.keys(e).length>0&&(f.lmstudio={npm:"@ai-sdk/openai-compatible",name:"LM Studio (local)",options:{baseURL:"http://localhost:1234/v1"},models:e}),0!==Object.keys(f).length)try{h.writeFileSync(c,JSON.stringify({$schema:"https://opencode.ai/config.json",provider:f},null,2),{encoding:"utf-8",flag:"wx"})}catch(a){if("EEXIST"===a.code)return;k.warn("failed-to-write-opencodejson:error-insta")}}var q=c(79646),r=c(28354),s=c(20610);let t=(0,j.h)("cli-tools/opencode"),u=(0,r.promisify)(q.execFile);function v(a){return a instanceof Error?a.message:String(a)}let w=200;class x extends d.M{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,e.N)(c)}async startSession(a,b,c){if(!await this.isInstalled())throw Error("OpenCode is not installed or not in PATH");let d=this.getSessionName(a,c);if(await (0,e.N)(d)){await this.reconcileExistingSession(d,{windowWidth:80,windowHeight:w}),t.info("opencode-session-sessionname");return}try{await p(b),await (0,e.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,s.Uc));try{await u("tmux",["resize-window","-t",(0,e.lA)(d),"-x","80","-y",String(w)])}catch{}await (0,e.V1)(d,"opencode",!0),await new Promise(a=>setTimeout(a,15e3)),t.info("started-opencode-session:sessionname")}catch(b){let a=v(b);throw Error(`Failed to start OpenCode session: ${a}`)}}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,e.N)(d))throw Error(`OpenCode session ${d} does not exist. Start the session first.`);try{await (0,f.FW)({sessionName:d,message:b,cliToolId:"opencode"}),(0,g.gm)(d),t.info("sent-message-to-opencode-session:session")}catch(b){let a=v(b);throw Error(`Failed to send message to OpenCode: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,e.N)(c)?(await (0,e.V1)(c,"/exit",!0),await new Promise(a=>setTimeout(a,s.KI)),await (0,e.N)(c)&&await (0,e.fY)(c)):await (0,e.fY)(c),(0,g.gm)(c),t.info("stopped-opencode-session:sessionname")}catch(a){throw t.error("session:stop-failed",{error:v(a)}),a}}constructor(...a){super(...a),this.id="opencode",this.name="OpenCode",this.command="opencode"}}},31268:(a,b,c)=>{"use strict";c.d(b,{s:()=>K});var d=c(44265),e=c(90736);class f extends d.M{async isInstalled(){return await (0,e.zw)()}async isRunning(a,b){return await (0,e.Yq)(a,b)}async startSession(a,b,c){await (0,e.R7)({worktreeId:a,worktreePath:b,instanceId:c})}async sendMessage(a,b,c){await (0,e.pU)(a,b,c)}supportsImage(){return!0}async sendMessageWithImage(a,b,c,d){let e=`
|
|
2
|
-
`,f=b?`${b}${e}`:e;await this.sendMessage(a,f,d)}async killSession(a,b){await (0,e.VU)(a,b)}constructor(...a){super(...a),this.id="claude",this.name="Claude Code",this.command="claude"}}var g=c(11665),h=c(40236),i=c(93997),j=c(26283),k=c(72626),l=c(20610);let m=(0,k.h)("cli-tools/codex");function n(a){return a instanceof Error?a.message:String(a)}class o extends d.M{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,g.N)(c)}async startSession(a,b,c){if(!await this.isInstalled())throw Error("Codex CLI is not installed or not in PATH");let d=this.getSessionName(a,c);if(await (0,g.N)(d)){await this.reconcileExistingSession(d),m.info("codex-session-sessionname");return}try{await (0,g.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,l.Uc)),await (0,g.V1)(d,"codex",!0),await new Promise(a=>setTimeout(a,3e3)),await this.waitForReady(d),m.info("started-codex-session:sessionname")}catch(b){let a=n(b);throw Error(`Failed to start Codex session: ${a}`)}}async waitForReady(a){let b=!1,c=!1;for(let d=0;d<30;d++){try{let d=await (0,g.Xg)(a,50),e=(0,j.aJ)(d);if((0,j.zZ)(e))return void m.info("codex-prompt-detected");let f=(0,j.Qh)(e);if("update"===f&&!b){await (0,g.V1)(a,"2",!1),b=!0,m.info("skipped-codex-update"),await new Promise(a=>setTimeout(a,l.CV));continue}if("press-enter"===f){await (0,g.ds)(a,"Enter"),m.info("dismissed-codex-notification"),await new Promise(a=>setTimeout(a,l.CV));continue}if("trust"===f&&!c){await (0,g.V1)(a,"1",!1),c=!0,m.info("auto-trusted-folder-for"),await new Promise(a=>setTimeout(a,l.CV));continue}}catch{}await new Promise(a=>setTimeout(a,1e3))}m.info("codex-prompt-detection")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,g.Xg)(a,50),c=(0,j.aJ)(b);if((0,j.zZ)(c))return}catch{}await new Promise(a=>setTimeout(a,500))}throw m.info("codex-prompt-not"),Error("Codex prompt not ready: timed out waiting for the input prompt before sending")}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,g.N)(d))throw Error(`Codex session ${d} does not exist. Start the session first.`);try{await this.waitForPrompt(d),await (0,h.FW)({sessionName:d,message:b,cliToolId:"codex"}),(0,i.gm)(d),m.info("sent-message-to-codex-session:sessionnam")}catch(b){let a=n(b);throw Error(`Failed to send message to Codex: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,g.N)(c)&&(await (0,g.ds)(c,"C-d"),await new Promise(a=>setTimeout(a,l.Zf))),await (0,g.fY)(c)&&m.info("stopped-codex-session:sessionname")}catch(a){throw m.error("session:stop-failed",{error:n(a)}),a}}constructor(...a){super(...a),this.id="codex",this.name="Codex CLI",this.command="codex"}}var p=c(11508),q=c(15194),r=c(88807),s=c(56791);let t=(0,k.h)("cli-tools/vibe-local");function u(a){return a instanceof Error?a.message:String(a)}class v extends d.M{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,g.N)(c)}async startSession(a,b,c){if(!await this.isInstalled())throw Error("vibe-local is not installed or not in PATH");let d=this.getSessionName(a,c);if(await (0,g.N)(d)){await this.reconcileExistingSession(d),t.info("vibe-local-session");return}try{await (0,g.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,l.Uc));let c="vibe-local -y";try{let b=(0,r.getDbInstance)(),d=(0,s.Uim)(b,a);d?.vibeLocalModel&&q.QP.test(d.vibeLocalModel)&&(c+=` -m ${d.vibeLocalModel}`);let e=d?.vibeLocalContextWindow;(0,q.FV)(e)&&(c+=` --context-window ${Number(e)}`)}catch{}await (0,g.V1)(d,c,!0),await new Promise(a=>setTimeout(a,5e3)),t.info("started-vibe-local-session:sessionname")}catch(b){let a=u(b);throw Error(`Failed to start Vibe Local session: ${a}`)}}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,g.N)(d))throw Error(`Vibe Local session ${d} does not exist. Start the session first.`);try{await (0,h.FW)({sessionName:d,message:b,cliToolId:"vibe-local",submitEnterCount:2,interEnterWaitMs:l.PY}),(0,i.gm)(d),t.info("sent-message-to-vibe-local-session:sessi")}catch(b){let a=u(b);throw Error(`Failed to send message to Vibe Local: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,g.N)(c)&&(await (0,g.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,l.Is)),await (0,g.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,l.Zf))),await (0,g.fY)(c)&&t.info("stopped-vibe-local-session:sessionname")}catch(a){throw t.error("session:stop-failed",{error:u(a)}),a}}constructor(...a){super(...a),this.id="vibe-local",this.name="Vibe Local",this.command="vibe-local"}}var w=c(30618),x=c(79646),y=c(56263),z=c(77093);let A=(0,k.h)("cli-tools/copilot"),B=new Set(["model","agent","theme"]);class C extends d.M{async isInstalled(){try{return await new Promise((a,b)=>{(0,x.execFile)("gh",["--version"],{timeout:5e3},c=>{c?b(c):a()})}),await new Promise((a,b)=>{(0,x.execFile)("gh",["copilot","--help"],{timeout:5e3},c=>{c?b(c):a()})}),!0}catch{return!1}}async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,g.N)(c)}async startSession(a,b,c){if(!await this.isInstalled())throw Error("GitHub Copilot CLI is not installed. Install with: gh extension install github/gh-copilot");let d=this.getSessionName(a,c);if(await (0,g.N)(d)){await this.reconcileExistingSession(d),A.info("copilot-session-exists");return}try{await (0,g.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,l.Uc)),await (0,g.V1)(d,"gh copilot",!0),await new Promise(a=>setTimeout(a,4e3)),await this.waitForReady(d),A.info("started-copilot-session")}catch(b){let a=(0,z.u1)(b);throw Error(`Failed to start Copilot session: ${a}`)}}async waitForReady(a){for(let b=0;b<30;b++){try{let b=await (0,g.Xg)(a,50),c=(0,j.aJ)(b);if(j.Du.test(c))return void A.info("copilot-prompt-detected")}catch{}await new Promise(a=>setTimeout(a,1e3))}A.info("copilot-prompt-detection-timeout")}async waitForPrompt(a,b=15e3){let c=Date.now();for(;Date.now()-c<b;){try{let b=await (0,g.Xg)(a,50),c=(0,j.aJ)(b);if(j.Du.test(c))return}catch{}await new Promise(a=>setTimeout(a,500))}A.info("copilot-prompt-not-detected")}extractSlashCommand(a){let b=a.trim();if(!b.startsWith("/"))return null;let c=b.match(/^\/(\S+)/);return c?c[1]:null}async waitForSelectionList(a){let b=Date.now();for(;Date.now()-b<5e3;){await new Promise(a=>setTimeout(a,300));try{let b=await (0,g.Xg)(a,50),c=(0,j.aJ)(b);if(j.Mi.test(c))return A.info("copilot-selection-list-detected"),!0}catch{}}return A.info("copilot-selection-list-not-detected-timeout"),!1}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,g.N)(d))throw Error(`Copilot session ${d} does not exist. Start the session first.`);try{await this.waitForPrompt(d);let a=this.extractSlashCommand(b);if(a&&B.has(a)){await (0,g.V1)(d,b,!0),await this.waitForSelectionList(d),(0,i.gm)(d),A.info("sent-selection-list-command-to-copilot",{command:a});return}await (0,h.FW)({sessionName:d,message:b,cliToolId:"copilot",textInputWaitMs:y.L1,verifyDelayMs:y.wp}),(0,i.gm)(d),A.info("sent-message-to-copilot-session")}catch(b){let a=(0,z.u1)(b);throw Error(`Failed to send message to Copilot: ${a}`)}}async sendModelCommand(a,b,c){let d=this.getSessionName(a,c);if(!await (0,g.N)(d))throw Error(`Copilot session ${d} does not exist. Start the session first.`);try{await (0,g.V1)(d,`/model ${b}`,!0),await this.waitForSelectionList(d)&&await (0,g.ds)(d,"C-m"),await this.waitForPrompt(d,y.pL),(0,i.gm)(d),A.info("copilot-model-switched",{model:b})}catch(c){let a=(0,z.u1)(c);throw Error(`Failed to switch Copilot model to ${b}: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,g.N)(c)&&(await (0,g.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,l.Is)),await (0,g.V1)(c,"exit",!0),await new Promise(a=>setTimeout(a,l.Zf))),await (0,g.fY)(c)&&A.info("stopped-copilot-session")}catch(a){throw A.error("session:stop-failed",{error:(0,z.u1)(a)}),a}}constructor(...a){super(...a),this.id="copilot",this.name="Copilot",this.command="gh"}}let D=(0,k.h)("cli-tools/antigravity");function E(a){return a instanceof Error?a.message:String(a)}let F=/\?\s+for\s+shortcuts/,G=/Do you trust the contents of this project\?/;function H(a){return F.test(a)&&!G.test(a)}class I extends d.M{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,g.N)(c)}async startSession(a,b,c,d){if(!await this.isInstalled())throw Error("Antigravity CLI (agy) is not installed or not in PATH");let e=this.getSessionName(a,c);if(await (0,g.N)(e)){await this.reconcileExistingSession(e),D.info("antigravity-session-exists");return}try{await (0,g.jw)({sessionName:e,workingDirectory:b}),await new Promise(a=>setTimeout(a,l.Uc));let a=d?`agy --model '${d.replace(/'/g,"'\\''")}'`:"agy";await (0,g.V1)(e,a,!0),await new Promise(a=>setTimeout(a,3e3)),await this.waitForReady(e),D.info("started-antigravity-session")}catch(b){let a=E(b);throw Error(`Failed to start Antigravity session: ${a}`)}}async waitForReady(a){let b=!1;for(let c=0;c<30;c++){try{let c=await (0,g.Xg)(a,50),d=(0,j.aJ)(c);if(H(d))return void D.info("antigravity-prompt-detected");if(!b&&G.test(d)){await (0,g.ds)(a,"Enter"),b=!0,D.info("auto-trusted-folder-for-antigravity"),await new Promise(a=>setTimeout(a,500));continue}}catch{}await new Promise(a=>setTimeout(a,1e3))}D.info("antigravity-prompt-detection-timeout")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,g.Xg)(a,50),c=(0,j.aJ)(b);if(H(c))return}catch{}await new Promise(a=>setTimeout(a,500))}throw D.info("antigravity-prompt-not-ready"),Error("Antigravity prompt not ready: timed out waiting for the input prompt before sending")}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,g.N)(d))throw Error(`Antigravity session ${d} does not exist. Start the session first.`);try{await this.waitForPrompt(d),await (0,h.FW)({sessionName:d,message:b,cliToolId:"antigravity"}),(0,i.gm)(d),D.info("sent-message-to-antigravity-session")}catch(b){let a=E(b);throw Error(`Failed to send message to Antigravity: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,g.N)(c)&&(await (0,g.ds)(c,"C-d"),await new Promise(a=>setTimeout(a,l.Zf)));let a=await (0,g.fY)(c);(0,i.gm)(c),a&&D.info("stopped-antigravity-session")}catch(a){throw D.error("session:stop-failed",{error:E(a)}),a}}constructor(...a){super(...a),this.id="antigravity",this.name="Antigravity CLI",this.command="agy"}}var J=c(95220);class K{constructor(){this.tools=new Map,this.tools.set("claude",new f),this.tools.set("codex",new o),this.tools.set("gemini",new p.m),this.tools.set("vibe-local",new v),this.tools.set("opencode",new w.Ui),this.tools.set("copilot",new C),this.tools.set("antigravity",new I)}static getInstance(){return K.instance||(K.instance=new K),K.instance}getTool(a){let b=this.tools.get(a);if(!b)throw Error(`CLI tool '${a}' not found`);return b}getAllTools(){return Array.from(this.tools.values())}async getToolInfo(a){let b=this.getTool(a),c=await b.isInstalled();return{id:b.id,name:b.name,command:b.command,installed:c}}async getAllToolsInfo(){return Promise.all(this.getAllTools().map(async a=>{let b=await a.isInstalled();return{id:a.id,name:a.name,command:a.command,installed:b}}))}async getInstalledTools(){return(await this.getAllToolsInfo()).filter(a=>a.installed)}stopPollers(a,b,c){(0,J.stopPolling)(a,b,c)}}},31766:(a,b,c)=>{"use strict";c.d(b,{Wh:()=>p,WD:()=>q,K1:()=>o});var d=c(31268),e=c(72626),f=c(11665);let g={streamingOutput:!1,explicitResize:!1,snapshotFallback:!0};class h{async unsubscribe(){}}class i{async ensureSession(a,b){await (0,f.N)(a)||await (0,f.jw)(a,b)}async sessionExists(a){return(0,f.N)(a)}async sendInput(a,b){await (0,f.V1)(a,b)}async sendSpecialKey(a,b){if("Escape"!==b&&"C-c"!==b&&"C-d"!==b&&"C-m"!==b&&"Enter"!==b)throw Error(`Unsupported special key for PollingTmuxTransport: ${b}`);await (0,f.ds)(a,b)}async resize(){throw Error("PollingTmuxTransport does not support explicit resize")}async captureSnapshot(a,b){return(0,f.Xg)(a,b)}async subscribe(){return new h}getCapabilities(){return g}async killSession(a){return(0,f.fY)(a)}}let j=null;var k=c(93997);let l=(0,e.h)("cli-session");function m(){return j||(j=new i),j}function n(a,b,c){let e=d.s.getInstance().getTool(b),f=e.getSessionName(a,c);return{cliTool:e,sessionName:f}}async function o(a,b,c){let{sessionName:d}=n(a,b,c);return m().sessionExists(d)}async function p(a,b,c=1e3,d){let e=l.withContext({worktreeId:a,cliToolId:b});e.debug("captureSessionOutput:start",{requestedLines:c});let{cliTool:f,sessionName:g}=n(a,b,d),h=m();try{let a=await (0,k.aq)(g,c,async()=>{if(!await h.sessionExists(g))throw Error(`${f.name} session ${g} does not exist`);return await h.captureSnapshot(g,{startLine:-k.xE})});return e.debug("captureSessionOutput:success",{actualLines:a.split("\n").length,lastFewLines:a.split("\n").slice(-3).join(" | ")}),a}catch(b){let a=b instanceof Error?b.message:String(b);if(a.includes("does not exist"))throw e.debug("captureSessionOutput:sessionNotFound",{sessionName:g}),b;throw e.error("captureSessionOutput:failed",{error:a}),Error(`Failed to capture ${f.name} output: ${a}`)}}async function q(a,b,c=5e3,d){let e=l.withContext({worktreeId:a,cliToolId:b});e.debug("captureSessionOutputFresh:start",{requestedLines:c});let{cliTool:f,sessionName:g}=n(a,b,d),h=m();try{let a=await h.captureSnapshot(g,{startLine:-c});return a.length>0?(0,k.vF)(g,a,c):(0,k.gm)(g),(0,k.wd)(a,c)}catch(b){(0,k.gm)(g);let a=b instanceof Error?b.message:String(b);throw e.error("captureSessionOutputFresh:failed",{error:a}),Error(`Failed to capture ${f.name} output: ${a}`)}}},34405:(a,b,c)=>{"use strict";c.d(b,{G:()=>e,_:()=>d});let d=1e4,e=1e3},39727:()=>{},40236:(a,b,c)=>{"use strict";c.d(b,{FW:()=>l});var d=c(11665),e=c(93997),f=c(26283),g=c(20610);let h=(0,c(72626).h)("cli-tools/submit-verified-sender"),i=/\[Pasted text[\s#]/,j=/^\/[A-Za-z]/,k=/^\s*(?:ctx:\d+%\s*)?[>❯›]/;async function l(a){let{sessionName:b,message:c,cliToolId:l,textInputWaitMs:m=g.pL,submitEnterCount:n=1,interEnterWaitMs:o=g.pL,verifyAttempts:p=4,verifyDelayMs:q=g.x9}=a;await (0,d.V1)(b,c,!1),await new Promise(a=>setTimeout(a,m));for(let a=0;a<Math.max(1,n);a++)await (0,d.KB)(b,["Enter"]),a<n-1&&await new Promise(a=>setTimeout(a,o));let r=Math.max(1,p);for(let a=0;a<r;a++){await new Promise(a=>setTimeout(a,q));let g=function(a,b,c){let d=(0,f.aJ)(a).split("\n").slice(-12),e=d.join("\n");if((0,f.ut)(b,e))return"submitted";let g=function(a){for(let b=a.length-1;b>=0;b--)if(k.test(a[b]))return a[b];return null}(d);if(!g)return"submitted";let h=g.replace(k,"").trim();return 0===h.length?"submitted":i.test(g)||function(a,b){let c=b.split("\n").map(a=>a.trim()).find(a=>a.length>0)??"";return 0!==c.length&&c.startsWith(a)}(h,c)?"pending":j.test(h)?"replaced":"submitted"}(await (0,d.Xg)(b,{startLine:-12}),l,c);if("submitted"===g)return void(0,e.gm)(b);if("replaced"===g){try{await (0,d.Ce)(b)}catch(a){h.error("submit-clear-input-failed",{sessionName:b,cliToolId:l,error:a instanceof Error?a.message:String(a)})}throw(0,e.gm)(b),h.error("submit-replaced-by-tui-completion",{sessionName:b,cliToolId:l,attempt:a}),Error(`Message was replaced by a TUI autocompletion for session ${b}; the input no longer matches the sent text. Cleared the input line without submitting to avoid executing a different command.`)}h.warn("submit-not-confirmed:resending-enter",{sessionName:b,cliToolId:l,attempt:a}),await (0,d.KB)(b,["Enter"])}throw(0,e.gm)(b),h.error("submit-verification-failed",{sessionName:b,cliToolId:l,attempts:r}),Error(`Message submit could not be confirmed for session ${b} after ${r} attempts (typed but unsent)`)}},40467:(a,b,c)=>{"use strict";c.d(b,{$:()=>t});var d=c(56791);let e=globalThis.__unclassifiedFrameRuns??(globalThis.__unclassifiedFrameRuns=new Map);var f=c(81254),g=c(72626),h=c(31268),i=c(31766),j=c(95595),k=c(5363),l=c(52277),m=c(34405),n=c(93997),o=c(48083),p=c(30008),q=c(9516),r=c(36051);let s=(0,g.h)("current-output-builder");async function t(a,b,c,g){let t=g??c,u=h.s.getInstance().getTool(c),v=(0,o.CE)(b,c,g),w=(0,o.ak)(b,c,g),x={lastEventType:w?.event??null,lastEventAt:w?.at??null,lastEventDetail:w?.detail??null,promptWaitingSince:null,promptWaitingSource:null};if(!await u.isRunning(b,g))return{isRunning:!1,content:"",lineCount:0,cliToolId:c,sessionStatus:"idle",sessionStatusReason:"session_not_running",lastStopEventAt:v,structuredEvents:x};let y=(0,d.y1O)(a,b,t),z=y?.lastCapturedLine||0,A=await (0,i.Wh)(b,c,m._,g),B=A.split("\n"),C=B.length,D=((0,n.sl)(C,Math.min(m._,n.xE))?B:B.slice(Math.max(0,z))).join("\n"),E=(0,k.v7)(b,c,g),F=(0,k.xU)(E),G=F?new Date(F):void 0,H=(0,j.WC)(A,c,G),I="running"===H.status&&H.reason===j.gv.THINKING_INDICATOR,J=H.hasActivePrompt,K="waiting"===H.status&&j.ug.has(H.reason),L=H.reason===j.gv.CODEX_PAGER,M="running"===H.status&&H.reason===j.gv.DEFAULT||"ready"===H.status&&H.reason===j.gv.NO_RECENT_OUTPUT,N=(0,o.R4)(b,c,g),O=(0,p._G)({worktreeId:b,cliToolId:c,instanceId:g,scraper:{status:H.status,reason:H.reason,hasActivePrompt:J}}),P=O.structured;null!==P&&(x.promptWaitingSince=P.at,x.promptWaitingSource=P.source);let Q=function(a,b,c=null){if("waiting"===a.status)return{...a,structuredApplied:!1};if(null!==c)return{status:"waiting",reason:(0,p.rB)(c),thinking:!1,isUnclassifiedActive:a.isUnclassifiedActive,structuredApplied:!0};if(null===b||"waiting"===b.status)return{...a,structuredApplied:!1};let d="running"===b.status;return{status:b.status,reason:b.reason,thinking:d,isUnclassifiedActive:("ready"!==b.status||"running"!==a.status)&&a.isUnclassifiedActive,structuredApplied:!0}}({status:H.status,reason:H.reason,thinking:I,isUnclassifiedActive:M},N,P),R=O.waiting,S=(0,o.BJ)(b,c,g),T=H.promptDetection.promptData,U=T&&S?(0,q.Hu)(T,S.spec):null,V=null===P?null:{...P,askUserQuestion:function(a){let b=a?.spec.questions[0];return b?{question:b.question,labels:b.choices.map(a=>a.label),questionCount:a.spec.questions.length}:null}(S)},W=J?U??T??(V?(0,r.Yo)(b,V):null):V?(0,r.Yo)(b,V):null;null!==N&&N.status!==H.status&&s.info("detection-divergence",{worktreeId:b,cliToolId:c,instanceId:t,scraperStatus:H.status,scraperReason:H.reason,structuredStatus:N.status,structuredReason:N.reason,structuredEvent:N.event,structuredEventAt:N.at,applied:Q.structuredApplied});let X=function(a,b,c=Date.now()){for(let[a,b]of e)c-b.lastSeen>36e5&&e.delete(a);if(!b)return e.delete(a),{dwellMs:0,shouldRecord:!1};let d=e.get(a);if(!d)return e.set(a,{since:c,lastSeen:c,recorded:!1}),{dwellMs:0,shouldRecord:!1};d.lastSeen=c;let f=Math.max(0,c-d.since);return d.recorded||f<6e4?{dwellMs:f,shouldRecord:!1}:(d.recorded=!0,{dwellMs:f,shouldRecord:!0})}(E,Q.isUnclassifiedActive);if(X.shouldRecord&&function(a,b){let c=Math.round(b.dwellMs/1e3),e=`${b.sessionStatus}/${b.sessionStatusReason}`,g=`Unclassified interactive frame (${e}) held for ${c}s. The detection layer could not parse it, so no prompt was published and nothing could answer it. Inspect the raw pane with \`commandmate capture ${b.worktreeId} --pane\`.`,h={type:f.LT,status:"unclassified",question:g,options:[],dwellSeconds:c,sessionStatusReason:e};try{(0,d.oHS)(a,{worktreeId:b.worktreeId,role:"assistant",content:g,messageType:"prompt",promptData:h,timestamp:new Date,cliToolId:b.cliToolId,instanceId:b.instanceId}),s.info("unclassified-frame-recorded",{worktreeId:b.worktreeId,cliToolId:b.cliToolId,dwellSeconds:c,statusReason:e})}catch(a){s.warn("unclassified-frame-record-failed",{worktreeId:b.worktreeId,error:a instanceof Error?a.message:String(a)})}}(a,{worktreeId:b,cliToolId:c,instanceId:t,dwellMs:X.dwellMs,sessionStatus:Q.status,sessionStatusReason:Q.reason}),null!==P&&null!==V&&!J&&!P.recorded){(0,o.HR)(b,c,g);var Y=b,Z=c,$=t,_=P,aa=V;let e=(0,r.fO)(Y,aa);try{(0,d.oHS)(a,{worktreeId:Y,role:"assistant",content:e.question,summary:`structured prompt \xb7 source=${_.source}${_.toolName?` \xb7 tool=${_.toolName}`:""}`,messageType:"prompt",promptData:e,timestamp:new Date,cliToolId:Z,instanceId:$}),s.info("structured-prompt-recorded",{worktreeId:Y,cliToolId:Z,instanceId:$,source:_.source,toolName:_.toolName})}catch(a){s.warn("structured-prompt-record-failed",{worktreeId:Y,error:a instanceof Error?a.message:String(a)})}}let ab=B.slice(-100).join("\n"),ac=(0,k.aq)(b,c,g);return{isRunning:!0,cliToolId:c,sessionStatus:Q.status,sessionStatusReason:Q.reason,content:D,fullOutput:A,realtimeSnippet:ab,lineCount:C,lastCapturedLine:z,isComplete:R,isGenerating:Q.thinking,thinking:Q.thinking,thinkingMessage:Q.thinking?"Claude is thinking...":null,isPromptWaiting:R,promptData:W,autoYes:{enabled:ac?.enabled??!1,expiresAt:ac?.enabled?ac.expiresAt:null,stopReason:ac?.stopReason,lastSuppression:(0,l.gb)(b,c,g)},isSelectionListActive:K,isPagerActive:L,isUnclassifiedActive:Q.isUnclassifiedActive,lastServerResponseTimestamp:F,serverPollerActive:(0,k.bZ)(E),lastStopEventAt:v,structuredEvents:x}}},41364:(a,b,c)=>{"use strict";c.d(b,{Gv:()=>o,hM:()=>n});var d=c(79748),e=c.n(d),f=c(33873),g=c.n(f),h=c(1634),i=c(21684),j=c(72626),k=c(15194);function l(a="claude"){return g().join((0,i.U)(),a)}async function m(a="claude"){let b=l(a);try{await e().access(b)}catch{await e().mkdir(b,{recursive:!0})}}async function n(a,b,c,d="claude"){await m(d);let f=function(a,b="claude"){let c=(0,h.GP)(new Date,"yyyy-MM-dd"),d=`${a}-${c}.md`,e=l(b);return g().join(e,d)}(a,d),i=(0,h.GP)(new Date,"yyyy-MM-dd HH:mm:ss"),j="";try{j=await e().readFile(f,"utf-8")}catch{let b=(0,k.hR)(d)?k.ef[d]:d;j=`# ${b} Conversation Log: ${a}
|
|
1
|
+
exports.id=5959,exports.ids=[5959],exports.modules={60:(a,b,c)=>{"use strict";c.d(b,{Q:()=>f,b:()=>e});var d=c(85164);function e(a){return d.Md.test(a)&&!d.kD.test(a)}function f(a,b,c,d,e,g=!1){if(a=Math.max(0,a),"opencode"===d||"copilot"===d||g){let a=e(b);return a>=0?a+1:0}if("antigravity"===d){let c=e(b);return c>=0?c+1:Math.max(0,a)}if(a>=b||c){let a=e(40);return a>=0?a+1:0}if("codex"===d)return Math.max(0,a);if(a>=b-5){let a=e(50);return a>=0?a+1:Math.max(0,b-40)}return Math.max(0,a)}},2669:(a,b,c)=>{"use strict";c.d(b,{M7:()=>d,Sr:()=>g,mR:()=>h,su:()=>j,wQ:()=>i});let d="SESSION_STARTING",e="SESSION_START_FAILED",f=[d,e];class g extends Error{constructor(a,b,c){super(`${a} did not reach its input prompt within ${Math.round(c/1e3)}s (initialization timeout). The tmux session '${b}' and its process are still running, so this is a slow start, not a failed one — the message was not delivered, but nothing needs repairing. Retry the send in a few seconds, or run \`commandmate capture <worktree-id>\` to see what it is waiting on.`),this.toolName=a,this.sessionName=b,this.timeoutMs=c,this.code=d,this.name="SessionStartTimeoutError"}}class h extends Error{constructor(a,b,c){super(`${a} reported an error while starting in tmux session '${b}': "${c}". Retrying will not help until that is resolved; run \`commandmate capture <worktree-id>\` to see the session output.`),this.toolName=a,this.sessionName=b,this.detectedPattern=c,this.code=e,this.name="SessionStartFailedError"}}function i(a){return k(a)===d}function j(a){let b=k(a);return void 0!==b&&f.includes(b)}function k(a){if("object"!=typeof a||null===a)return;let b=a.code;return"string"==typeof b?b:void 0}},3523:(a,b,c)=>{"use strict";c.d(b,{z$:()=>E,zX:()=>F});var d=c(31766),e=c(88807),f=c(56791),g=c(95620),h=c(25129),i=c(18778),j=c(15194),k=c(8988),l=c(85164),m=c(72626),n=c(46423),o=c(93997),p=c(60),q=c(82450),r=c(56263),s=c(13033),t=c(72457),u=c(71080),v=c(45146),w=c(91601),x=c(73478),y=c(57836),z=c(52767);let A=(0,m.h)("response-poller");function B(a){return{response:"",isComplete:!1,lineCount:a}}function C(a,b,c,d,e,f,g,h=!1){let i=(0,p.Q)(b,c,d,e,f,h),j=a.slice(i);return{response:(0,l.aJ)(j.join("\n")),isComplete:!0,lineCount:c,promptDetection:g,bufferReset:d,captureWindowSaturated:h}}function D(a,b){let c=(0,l.KO)(b);return(0,h.gF)((0,l._A)((0,l.aJ)(a)),c)}function E(a,b,c,d=o.xE){let e=a.split("\n"),f=e.length;for(;f>0&&""===e[f-1].trim();)f--;let g=e.slice(0,f),h=g.length,i=(0,o.sl)(e.length,d),j="claude"===c?(0,l.GT)(g):-1,k=j>=0?j:h,m=h>0&&b>25&&h+25<b,q=h>0&&b>50&&h<50,r=m||q;if(!r&&h<b-5)return null;let s=Math.max(0,h-20),t=g.slice(s),u="opencode"===c?(0,l.aJ)(g.join("\n")):t.join("\n"),{promptPattern:w,separatorPattern:x,thinkingPattern:y,skipPatterns:z}=(0,l._X)(c),A=(a=60)=>{let b;if("codex"===c)b=/^›\s+(?!Implement|Find and fix|Type|Summarize)/;else if("opencode"===c){let b=0;for(let c=h-1;c>=Math.max(0,h-a);c--){let a=(0,l.aJ)(g[c]);if(l.Md.test(a)&&2==++b)return c}return -1}else b=/^[>❯]\s+\S/;for(let c=k-1;c>=Math.max(0,k-a);c--){let a=(0,l.aJ)(g[c]);if(b.test(a))return c}return -1};if("claude"===c||"codex"===c||"copilot"===c){let a=D(g.join("\n"),c);if(a.isPrompt)return C(g,b,h,r,c,A,a,i)}let F=(0,l.aJ)(u),G=w.test(F),H=x.test(F),I="codex"===c?(0,l.DR)(g,20):y.test(F),J=("codex"===c||"gemini"===c||"vibe-local"===c||"copilot"===c||"antigravity"===c)&&G&&!I,K="claude"===c&&G&&H&&!I,L="opencode"===c&&(0,p.b)(F);if(J||K||L){let a=[],d=(0,p.Q)(b,h,r,c,A,i),e=h;for(let b=d;b<k;b++){let d=g[b],f=(0,l.aJ)(d);if("codex"===c&&/^›\s+/.test(f)||"gemini"===c&&/^(%|\$|.*@.*[%$#])\s*$/.test(f)||"antigravity"===c&&/^>\s*$/.test(f)||"opencode"===c&&(l.sy.test(f)||l.uA.test(f))){e=b;break}z.some(a=>a.test(f))||a.push(d)}let f=a.join("\n").trim(),j=f.split("\n").slice(-n.$).join("\n");if(y.test(j))return B(h);if("claude"===c){let a=(0,l.aJ)(f),b=/[╭╮╰╯│]/.test(a)||/░{3,}/.test(a)||/▓{3,}/.test(a),c=/Claude Code|claude\/|v\d+\.\d+/.test(a),d=/Tip:|for shortcuts|\?\s*for help/.test(a),e=/^\s*\/Users\/.*$/m.test(a)&&a.split("\n").length<30,g=a.match(/^[>❯]\s+(\S.*)$/m);if(g){let b=a.indexOf(g[0]);if(0===a.substring(b+g[0].length).trim().split("\n").filter(a=>{let b=a.trim();return b&&!z.some(a=>a.test(b))&&!/^─+$/.test(b)}).length)return B(h)}else if((b||c||d||e)&&f.length<2e3)return B(h)}if("gemini"===c&&((f.match(/[░███]/g)||[]).length>.3*f.length||v.SI.some(a=>f.includes(a))||!f.includes("✦")&&f.length<10))return B(h);if("opencode"===c){let a=(0,l.aJ)(f);if((a.length<50||!l.Md.test(F))&&0===a.split("\n").filter(a=>{let b=a.trim();return b&&!l.sx.some(a=>a.test(b))}).length)return B(h)}return{response:f,isComplete:!0,lineCount:e,bufferReset:r,captureWindowSaturated:i}}if("opencode"!==c){let a=D(g.join("\n"),c);if(a.isPrompt)return C(g,b,h,r,c,A,a,i)}let M=[],N=r||i||b>=h-5,O=N?A(80):-1,P=N?O>=0?O+1:Math.max(0,h-80):Math.max(0,b);for(let a=P;a<Math.min(h,k);a++){let b=g[a],c=(0,l.aJ)(b);z.some(a=>a.test(c))||M.push(b)}let Q=M.join("\n").trim();return Q?{response:Q,isComplete:!1,lineCount:h}:B(h)}async function F(a,b,c){let h=(0,e.getDbInstance)(),m=c??b;try{let e=(0,f.getWorktreeById)(h,a);if(!e)return A.error("worktree-worktreeid-not"),(0,v.Et)(a,b,c),!1;if(!await (0,d.K1)(a,b,c))return A.info("session-not-running"),(0,v.Et)(a,b,c),!1;let p=(0,f.getSessionState)(h,a,m),x=p?.lastCapturedLine||0,B=await (0,d.Wh)(a,b,o.xE,c);if("opencode"===b||"copilot"===b){let d=(0,v.MN)(a,b,c);(0,s.IZ)(d,B,b)}let C=E(B,x,b,o.xE);if(!C||!C.isComplete){let{thinkingPattern:c}=(0,l._X)(b),d=(0,l.aJ)(B).split("\n").slice(-n.$).join("\n");return c.test(d)&&(0,f.markPendingPromptsAsAnswered)(h,a,b,m)>0&&A.info("marked-answeredcount-pending"),!1}let F="opencode"===b||"copilot"===b,G=!(0,j.VA)(b)&&!C.captureWindowSaturated;if(G&&!C.bufferReset&&C.lineCount===x&&!p?.inProgressMessageId)return!1;if(G&&!C.bufferReset&&C.lineCount<=x)return A.info("already-saved-up-to-line-lastcapturedlin"),!1;let H=C.promptDetection??D(C.response,b);if(H.isPrompt){let d=H.rawContent||H.cleanContent,i=(0,v.MN)(a,b,c),j=(0,t.zm)(d,b);if((0,t.gv)(i,j))return A.info("duplicate-prompt-skipped",{worktreeId:a,cliToolId:b}),!1;let k=d;"copilot"===b&&(k=(0,q.LH)(d),k=(0,q.Sj)(k,r.Rf,r.ky)),(0,f.clearInProgressMessageId)(h,a,b,m);let l=(0,f.createMessage)(h,{worktreeId:a,role:"assistant",content:k,messageType:"prompt",promptData:H.promptData,timestamp:new Date,cliToolId:b,instanceId:m});(0,f.updateSessionState)(h,a,b,C.lineCount,m),(0,g.broadcastMessage)("message",{worktreeId:a,message:l}),(0,z.r)(h,a,b,m,"prompt_detected",{promptType:H.promptData?.type});let n=Date.now(),o=(0,y.Jp)(a,b,c)?.since??n;return(0,w.J$)({worktreeId:a,worktreeName:e.name,kind:"prompt",agentName:m,instanceId:m,waitingKind:"prompt",waitingSince:o,excerpt:H.promptData?.question??k}).catch(()=>{}),(0,y.hd)({worktreeId:a,cliToolId:b,instanceId:c,waiting:!0,kind:"prompt",now:n}),F||(0,v.Et)(a,b,c),!0}if(!C.response||""===C.response.trim())return(0,f.updateSessionState)(h,a,b,C.lineCount,m),!1;let I="claude"===b?(0,k.R)(C.response):void 0,J=C.response;if("gemini"===b)J=(0,q.IS)(C.response);else if("claude"===b)J=(0,q.NN)(C.response);else if("copilot"===b){let d=(0,v.MN)(a,b,c),e=(0,s.Uz)(d)||C.response;J=(0,q.LH)(e),J=(0,q.Sj)(J,r.Rf,r.ky),(0,s.q1)(d)}else if("opencode"===b){J=(0,q.aW)(C.response);let d=(0,v.MN)(a,b,c);(0,s.q1)(d)}if(!J||""===J.trim()||"[No content]"===J)return(0,f.updateSessionState)(h,a,b,C.lineCount,m),(0,f.clearInProgressMessageId)(h,a,b,m),!1;if(!G){let d=(0,v.MN)(a,b,c);if((0,u.j7)(d,J))return(0,f.updateSessionState)(h,a,b,C.lineCount,m),!1}J&&await (0,i.T)(h,a,J,b),(0,f.markPendingPromptsAsAnswered)(h,a,b,m)>0&&A.info("marked-answeredcount-pending");let K=(0,f.getSessionState)(h,a,m);if(G&&K&&C.lineCount<=K.lastCapturedLine)return A.info("race-condition-detected-skipping-save-re"),!1;let L=(0,f.createMessage)(h,{worktreeId:a,role:"assistant",content:J,messageType:"normal",timestamp:new Date,cliToolId:b,instanceId:m,summary:I?.summary,logFileName:I?.logFileName,requestId:I?.requestId});return(0,g.broadcastMessage)("message",{worktreeId:a,message:L}),(0,y.hd)({worktreeId:a,cliToolId:b,instanceId:c,waiting:!1}),(0,w.J$)({worktreeId:a,worktreeName:e.name,kind:"completion",agentName:m,excerpt:J}).catch(()=>{}),(0,f.updateSessionState)(h,a,b,C.lineCount,m),F&&(0,v.Et)(a,b,c),!0}catch(a){return A.error("response:check-failed",{error:a instanceof Error?a.message:String(a)}),!1}}(0,x.I7)()},4970:(a,b,c)=>{"use strict";c.d(b,{F:()=>g,c:()=>h});var d=c(22354),e=c(48083);let f=(0,c(72626).h)("lib/session/agent-session-lifecycle");function g(a,b=Date.now()){(0,e.dj)(a.worktreeId,a.cliToolId,a.instanceId,b);let c=(0,d.VM)(a.cliToolId);f.info("agent-session-generation-begun",{worktreeId:a.worktreeId,cliToolId:a.cliToolId,instanceId:a.instanceId??a.cliToolId,transport:c.transport})}function h(a,b){return(0,d.VM)(a.cliToolId).prepareLaunch(a,b)}},5363:(a,b,c)=>{"use strict";c.d(b,{v7:()=>d.v7,LP:()=>d.LP,pL:()=>d.pL,GE:()=>d.GE,aq:()=>d.aq,kC:()=>d.kC,xU:()=>x,bZ:()=>y,W8:()=>d.W8,W5:()=>E,_i:()=>F,_C:()=>G});var d=c(24455),e=c(31766),f=c(25129),g=c(75498),h=c(91318),i=c(52277),j=c(52767),k=c(88807),l=c(52660),m=c(63869),n=c(31268),o=c(85164),p=c(77093),q=c(93997),r=c(68901),s=c(72626),t=c(66007);let u=(0,s.h)("auto-yes-poller"),v=globalThis.__autoYesPollerStates??(globalThis.__autoYesPollerStates=new Map);function w(a){return v.get(a)}function x(a){let b=w(a);return b?.lastServerResponseTimestamp??null}function y(a){return v.has(a)}function z(a){let b=w(a);if(b&&(b.consecutiveErrors++,b.currentInterval=(0,d.G)(b.consecutiveErrors),b.consecutiveErrors>=r.ul)){let b=(0,d.Ue)(a),c=(0,d.pL)(a);c&&(0,d.XK)(b,c,"consecutive_errors",(0,d.GE)(a)??void 0),F(a)}}async function A(a,b,c,d){let f=c??r.FW,g=await (0,e.Wh)(a,b,f,d);return(0,o._A)((0,o.aJ)(g))}async function B(a,b,e,r,s,t){let v=(0,d.v7)(a,e,t);try{let z=(0,o.KO)(e),A=(0,f.gF)(r,{...z,...s&&{precomputedLines:s}});if(!A.isPrompt||!A.promptData)return b.lastAnsweredPromptKey=null,b.lastAnsweredAt=null,"no_prompt";let B=(x=A.promptData,`${x.type}:${x.question}`);if(b.lastAnsweredPromptKey===B&&null!==b.lastAnsweredAt&&Date.now()-b.lastAnsweredAt<d.UL)return"duplicate";let C=(0,h.n)(a,e,t),D=(0,g.sD)(A.promptData,C);D.suppressedBy&&((0,i.ZS)(a,e,t,{reason:D.suppressedBy,mode:C?.mode??null,promptType:A.promptData.type,pattern:D.pattern}),u.warn("poller:auto-yes-suppressed-by-policy",{worktreeId:a,cliToolId:e,instanceId:t,reason:D.suppressedBy,mode:C?.mode??null,pattern:D.pattern,promptType:A.promptData.type}));let E=D.answer;if(null===E)return"no_answer";let F=n.s.getInstance().getTool(e).getSessionName(a,t);try{await (0,m.t)({sessionName:F,answer:E,cliToolId:e,promptData:A.promptData})}finally{(0,q.gm)(F)}var x,y=Date.now();let G=w(v);G&&(G.lastServerResponseTimestamp=y);let H=w(v);H&&(H.consecutiveErrors=0,H.currentInterval=d.ps),b.lastAnsweredPromptKey=B,b.lastAnsweredAt=Date.now(),u.info("poller:response-sent",{worktreeId:a,cliToolId:e,instanceId:t}),(0,j.r)((0,k.getDbInstance)(),a,e,t??e,"prompt_answered_auto",{promptType:A.promptData.type});let I=null;try{I=(0,l.pG)((0,k.getDbInstance)(),{worktreeId:a,cliToolId:e,instanceId:t??e,promptData:A.promptData,answer:E,answeredBy:"auto",content:A.rawContent||A.cleanContent})}catch(b){u.warn("poller:prompt-audit-record-failed",{worktreeId:a,cliToolId:e,instanceId:t,error:(0,p.u1)(b)})}if(I){let b=I;Promise.resolve().then(c.bind(c,95620)).then(({broadcastMessage:c})=>{c(b.created?"message":"message_updated",{worktreeId:a,message:b.message})}).catch(()=>{})}let[{startPolling:J},{broadcastTerminalSnapshotAfterInteraction:K}]=await Promise.all([Promise.resolve().then(c.bind(c,95220)),Promise.resolve().then(c.bind(c,99508))]);return J(a,e,t),K(a,e,t),"responded"}catch{return z(v),u.warn("poller:detect-respond-error",{worktreeId:a,cliToolId:e,instanceId:t}),"error"}}async function C(a,b,c){let e=(0,d.v7)(a,b,c),f=w(e);if("valid"===function(a,b){if(!b)return"stopped";let c=(0,d.Ue)(a),e=(0,d.pL)(a);if(!e)return F(a),"expired";let f=(0,d.GE)(a)??void 0,g=(0,d.aq)(c,e,f);return g?.enabled?"valid":(F(a),"expired")}(e,f)){try{let g=(0,d.aq)(a,b,c),h=g?.stopPattern?r.FW:r.Ke,i=await A(a,b,h,c),j=i.split("\n");if(function(a,b,c){if(b.stopCheckBaselineLength<0)return b.stopCheckBaselineLength=c.length,!1;let e=b.stopCheckBaselineLength;if(c.length>e){let f=c.substring(e);return b.stopCheckBaselineLength=c.length,(0,d.Cs)(a,f,F)}return c.length<e&&(b.stopCheckBaselineLength=c.length),!1}(e,f,i))return;let k=await B(a,f,b,i,j,c);if("responded"===k)return void D(a,b,c,d.ZO);if("no_prompt"===k){let e=j.slice(-d.Re).join("\n");if((0,o.ut)(b,e))return void D(a,b,c,r.QN)}}catch(d){z(e),u.warn("poller:poll-error",{worktreeId:a,cliToolId:b,instanceId:c,error:(0,p.u1)(d)})}D(a,b,c)}}function D(a,b,c,e){let f=w((0,d.v7)(a,b,c));if(!f)return;let g=Math.max(e??f.currentInterval,d.ps);f.timerId=setTimeout(()=>{C(a,b,c)},g)}function E(a,b,c){if(!(0,t.h6)(a))return{started:!1,reason:"invalid worktree ID"};let e=c??b,f=(0,d.aq)(a,b,e);if(!f?.enabled)return{started:!1,reason:"auto-yes not enabled"};let g=(0,d.v7)(a,b,e),i=w(g);if(!i&&v.size>=d.fC)return{started:!1,reason:"max concurrent pollers reached"};if(i&&i.cliToolId===b)return{started:!0,reason:"already_running"};i&&F(g);let j={timerId:null,cliToolId:b,instanceId:e,consecutiveErrors:0,currentInterval:d.ps,lastServerResponseTimestamp:null,lastAnsweredPromptKey:null,lastAnsweredAt:null,stopCheckBaselineLength:-1};return v.set(g,j),(0,h.ie)(g),j.timerId=setTimeout(()=>{C(a,b,e)},d.ps),u.info("poller:started",{worktreeId:a,cliToolId:b,instanceId:e}),{started:!0}}function F(a){let b=w(a);b&&(b.timerId&&clearTimeout(b.timerId),v.delete(a),(0,h.ie)(a),u.info("poller:stopped",{compositeKey:a}))}function G(a){(0,d._9)(Array.from(v.keys()),a).forEach(a=>F(a))}},7015:(a,b,c)=>{"use strict";c.d(b,{Ds:()=>g});var d=c(81719);class e{constructor(a,b=3e4){this.cache=new Map,this.allAppsCache=null,this.lastRefresh=0,this.db=a,this.ttl=b}getTTL(){return this.ttl}isStale(){return Date.now()-this.lastRefresh>this.ttl}async refresh(){let a=(0,d.$i)(this.db);for(let b of(this.cache.clear(),a))this.cache.set(b.pathPrefix,b);this.allAppsCache=a,this.lastRefresh=Date.now()}async getByPathPrefix(a){return this.isStale()&&await this.refresh(),this.cache.get(a)??null}async getAll(){return this.isStale()&&await this.refresh(),this.allAppsCache??[]}invalidate(){this.cache.clear(),this.allAppsCache=null,this.lastRefresh=0}invalidateByIssueNo(a){this.invalidate()}}let f=null;function g(a){if(!f){if(!a)throw Error("Database instance required to initialize cache");f=new e(a)}return f}},8988:(a,b,c)=>{"use strict";c.d(b,{R:()=>g});let d=/📄 Session log: (.+?\/([^\/\s]+\.jsonl))/,e=/Request ID: ([^\s\n]+)/,f=/Summary: (.+?)(?:\n─|$)/s;function g(a){let b={content:a},c=d.exec(a);c&&(b.logFileName=c[2]);let g=e.exec(a);g&&(b.requestId=g[1]);let h=f.exec(a);return h&&(b.summary=h[1].trim()),b}},9516:(a,b,c)=>{"use strict";c.d(b,{Hu:()=>i,Ll:()=>j});let d=["type something","chat about this"],e=/^\s*\[[ xX]\]\s*/,f=/(?:…|\.\.\.)\s*$/,g=new Set(["yes","y","no","n"]);function h(a){return a.replace(e,"").replace(f,"").replace(/\s+/g," ").trim().toLowerCase()}function i(a,b){if("multiple_choice"!==a.type)return null;let c=function(a,b){let c=h(b);if(""===c)return null;let d=a.questions.map((a,b)=>({entry:a,index:b})).filter(({entry:a})=>(function(a,b){let[c,d]=a.length<=b.length?[a,b]:[b,a];return c.length<8?c===d:d.includes(c)})(h(a.question),c));return 1===d.length?d[0]:null}(b,a.question);if(null===c)return null;let{entry:f,index:g}=c,i=new Map(a.options.map(a=>[a.number,a])),j=[];for(let[a,b]of f.choices.entries()){var k;let c=a+1,d=i.get(c);if(!d||!function(a,b){if(""===a||""===b)return!1;if(a===b)return!0;let[c,d]=a.length<=b.length?[a,b]:[b,a];return!(c.length<8)&&d.startsWith(c)}(h(d.label),h(b.label)))return null;j.push({...d,label:`${(k=d.label,e.exec(k)?.[0]??"")}${b.label}`,...b.description?{description:b.description}:{}})}let l=[];for(let b of a.options)!(b.number<=f.choices.length)&&function(a){let b=h(a);return d.some(a=>b===a||b.startsWith(a))}(b.label)&&(j.push(b),l.push(b.number));return j.sort((a,b)=>a.number-b.number),{...a,question:f.question,options:j,isAskUserQuestion:!0,askUserQuestion:{...f.header?{header:f.header}:{},multiSelect:f.multiSelect,questionIndex:g,questionCount:b.questions.length,metaOptionNumbers:l}}}function j(a,b){let c=b.trim();if(/^\d+$/.test(c)){let b=Number.parseInt(c,10);return a.options.some(a=>a.number===b)?{ok:!0,input:String(b)}:{ok:!1,reason:"answer_out_of_range",message:"The option number is outside the range this prompt offers. Use `commandmate capture <worktree-id> --json` to list the current options."}}let d=function(a,b){let c=h(b);if(""===c)return[];let d=a.filter(a=>h(a.label)===c);return d.length>0?d:c.length<2?[]:a.filter(a=>h(a.label).startsWith(c))}(a.options,c);if(1===d.length){let[a]=d;return{ok:!0,input:String(a.number),resolved:{via:"semantic",optionNumber:a.number,optionLabel:a.label}}}return d.length>1?{ok:!1,reason:"unresolvable_answer",message:"The answer matches more than one option label. Answer with an option number."}:a.options.some(a=>!0===a.requiresTextInput)&&!g.has(c.toLowerCase())?{ok:!0,input:b}:{ok:!1,reason:"unresolvable_answer",message:"No option label matches the answer. Answer with an option number (yes/no is not resolved on a numbered picker — Issue #1681)."}}},11508:(a,b,c)=>{"use strict";c.d(b,{H:()=>p,m:()=>q});var d=c(44265),e=c(11665),f=c(40236),g=c(93997),h=c(85164),i=c(22354),j=c(69935),k=c(4970),l=c(72626),m=c(20610);let n=(0,l.h)("cli-tools/gemini");function o(a){return a instanceof Error?a.message:String(a)}let p=200;class q extends d.M{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,e.N)(c)}async startSession(a,b,c){if(!await this.isInstalled())throw Error("Gemini CLI is not installed or not in PATH");let d=this.getSessionName(a,c);if(await (0,e.N)(d)){await this.reconcileExistingSession(d),n.info("gemini-session-sessionname");return}(0,k.F)({worktreeId:a,cliToolId:i.o,instanceId:c});try{await (0,e.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,m.Uc)),(0,j.B)(b,{worktreeId:a,cliToolId:i.o,instanceId:c});let f=(0,k.c)({worktreeId:a,cliToolId:i.o,instanceId:c},this.command).command;await (0,e.V1)(d,f,!0),await new Promise(a=>setTimeout(a,6e3)),await this.waitForReady(d),n.info("started-gemini-session:sessionname")}catch(b){let a=o(b);throw Error(`Failed to start Gemini session: ${a}`)}}async waitForReady(a){let b=!1;for(let c=0;c<30;c++){try{let c=await (0,e.Xg)(a,p),d=(0,h.aJ)(c);if(h.wN.test(d))return void n.info("gemini-prompt-detected");!b&&d.includes("Do you trust this folder?")&&(await (0,e.ds)(a,"Enter"),b=!0,n.info("auto-trusted-folder-for"))}catch{}await new Promise(a=>setTimeout(a,1e3))}n.info("gemini-prompt-detection")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,e.Xg)(a,p),c=(0,h.aJ)(b);if(h.wN.test(c))return}catch{}await new Promise(a=>setTimeout(a,500))}n.info("gemini-prompt-not")}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,e.N)(d))throw Error(`Gemini session ${d} does not exist. Start the session first.`);try{await this.waitForPrompt(d),await (0,f.FW)({sessionName:d,message:b,cliToolId:"gemini"}),(0,g.gm)(d),n.info("sent-message-to-gemini-session:sessionna")}catch(b){let a=o(b);throw Error(`Failed to send message to Gemini: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,e.N)(c)&&(await (0,e.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,m.Is)),await (0,e.V1)(c,"/quit",!0),await new Promise(a=>setTimeout(a,m.Zf))),await (0,e.fY)(c)&&n.info("stopped-gemini-session:sessionname")}catch(a){throw n.error("session:stop-failed",{error:o(a)}),a}}constructor(...a){super(...a),this.id="gemini",this.name="Gemini CLI",this.command="gemini"}}},11665:(a,b,c)=>{"use strict";c.d(b,{Ce:()=>w,GW:()=>n,KB:()=>r,N:()=>m,N6:()=>y,Sb:()=>z,V1:()=>p,Xg:()=>s,ds:()=>v,fY:()=>t,jw:()=>o,lA:()=>k,zT:()=>l});var d=c(79646),e=c(28354),f=c(93997),g=c(16983),h=c(72626);let i=(0,e.promisify)(d.execFile),j=(0,h.h)("tmux");function k(a){return`=${a}:`}async function l(a,b={}){let c,d,e,f=b.windowWidth??g.Jn,h=b.windowHeight??g.sO,m=k(a);try{c=(await i("tmux",["show-window-options","-v","-t",m,"window-size"],{timeout:5e3})).stdout.trim();let[a,b]=(await i("tmux",["display-message","-p","-t",m,"#{window_width}|#{window_height}"],{timeout:5e3})).stdout.trim().split("|").map(Number);Number.isFinite(a)&&(d=a),Number.isFinite(b)&&(e=b)}catch{}let n="manual"===c,o=d===f&&e===h;if(n&&o)return!1;try{return n||await i("tmux",["set-window-option","-t",m,"window-size","manual"],{timeout:5e3}),o||await i("tmux",["resize-window","-t",m,"-x",String(f),"-y",String(h)],{timeout:5e3}),!0}catch(b){return j.warn("session-geometry:reconcile-failed",{sessionName:a,error:b instanceof Error?b.message:String(b)}),!1}}async function m(a){try{return await i("tmux",["has-session","-t",k(a)],{timeout:5e3}),!0}catch{return!1}}async function n(){try{let{stdout:a}=await i("tmux",["list-sessions","-F","#{session_name}|#{session_windows}|#{session_attached}"],{timeout:5e3});if(!a||""===a.trim())return[];return a.trim().split("\n").map(a=>{let[b,c,d]=a.split("|");return{name:b,windows:parseInt(c,10)||0,attached:"1"===d}})}catch{return[]}}async function o(a,b){let c,d,e,f,h;"string"==typeof a?(c=a,d=b,e=g.eu,f=g.Jn,h=g.sO):(c=a.sessionName,d=a.workingDirectory,e=a.historyLimit||g.eu,f=a.windowWidth||g.Jn,h=a.windowHeight||g.sO);try{await i("tmux",["new-session","-d","-s",c,"-c",d,"-x",String(f),"-y",String(h)],{timeout:5e3}),await i("tmux",["set-option","-t",k(c),"history-limit",String(e)],{timeout:5e3});try{await i("tmux",["new-window","-k","-t",`${k(c)}0`,"-c",d],{timeout:5e3})}catch(a){j.warn("session-history-limit:window-rebuild-failed",{sessionName:c,historyLimit:e,error:a instanceof Error?a.message:String(a)})}await l(c,{windowWidth:f,windowHeight:h})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to create tmux session: ${a}`)}}async function p(a,b,c=!0){let d=c?["send-keys","-t",k(a),b,"C-m"]:["send-keys","-t",k(a),b];try{await i("tmux",d,{timeout:5e3})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to send keys to tmux session: ${a}`)}}let q=new Set(["Up","Down","Left","Right","Enter","Space","Tab","Escape","BSpace","DC","PageUp","PageDown","Home","End","q"]);async function r(a,b){if(0!==b.length){for(let a of b)if(!q.has(a))throw Error(`Invalid special key: ${a}`);try{for(let c=0;c<b.length;c++)await i("tmux",["send-keys","-t",k(a),b[c]],{timeout:5e3}),c<b.length-1&&await new Promise(a=>setTimeout(a,100))}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to send special keys to tmux session: ${a}`)}}}async function s(a,b){let c,d;"number"==typeof b?(c=-b,d="-"):b?(c=b.startLine??-1e4,d=b.endLine??"-"):(c=-1e3,d="-");try{let{stdout:b}=await i("tmux",["capture-pane","-t",k(a),"-p","-e","-S",String(c),"-E",String(d)],{timeout:5e3,maxBuffer:0xa00000});return b}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to capture pane: ${a}`)}}async function t(a){try{return await i("tmux",["kill-session","-t",k(a)],{timeout:5e3}),!0}catch(b){let a=b instanceof Error?b.message:String(b);if(a?.includes("no server running")||a?.includes("can't find session"))return!1;throw Error(`Failed to kill tmux session: ${a}`)}}let u=new Set(["Escape","C-c","C-d","C-m","Enter"]);async function v(a,b){if(!u.has(b))throw Error(`Invalid special key: ${b}`);try{await i("tmux",["send-keys","-t",k(a),b],{timeout:5e3})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to send special key: ${a}`)}}async function w(a){try{await i("tmux",["send-keys","-t",k(a),"C-u"],{timeout:5e3})}catch(b){let a=b instanceof Error?b.message:String(b);throw Error(`Failed to clear tmux input line: ${a}`)}}let x=["Up","Down","Left","Right","Enter","Escape","Tab","BTab","PageUp","PageDown","Home","End","q"];function y(a){return x.includes(a)}async function z(a,b){await r(a,b),(0,f.gm)(a)}},13033:(a,b,c)=>{"use strict";c.d(b,{IW:()=>h,IZ:()=>l,K0:()=>g,Uz:()=>m,l1:()=>f,o0:()=>i,q1:()=>n,tb:()=>k,vQ:()=>j});var d=c(85164);let e=new Map;function f(a){return(0,d._A)((0,d.aJ)(a)).replace(/^\u2503\s?/,"").replace(/\s*\u2503$/,"").trim()}function g(a){let b=a.split("\n"),c=[];for(let a of b){let b=f(a);!(!b||d.sx.some(a=>a.test(b)))&&(d.Md.test(b)||c.push(b))}return c}function h(a){return a.replace(/[\u2500-\u257F]/g,"").replace(/\s{2,}/g," ").trim()}function i(a){let b=(0,d.aJ)(a).split("\n"),c=[];for(let a of b){let b=h(a);b&&(d.J7.some(a=>a.test(b))||c.push(b))}return c}function j(a,b){if(0===a.length||0===b.length)return 0;let c=Math.min(a.length,b.length);for(let d=c;d>=1;d--){let c=a.slice(-d),e=b.slice(0,d),f=!0;for(let a=0;a<d;a++)if(c[a]!==e[a]){f=!1;break}if(f)return d}return 0}function k(a){e.set(a,{lines:[],lastFingerprint:[],pollCount:0})}function l(a,b,c="opencode"){let d=e.get(a);if(!d)return;let f="copilot"===c?i(b):g(b);if(0!==f.length){if(d.pollCount++,0===d.lines.length)d.lines=[...f];else{let a=j(d.lastFingerprint,f);if(a>0){let b=f.slice(a);d.lines.push(...b)}else d.lines.push(...f)}d.lastFingerprint=f.slice(-10)}}function m(a){let b=e.get(a);return b&&0!==b.lines.length?b.lines.join("\n"):""}function n(a){e.delete(a)}},18778:(a,b,c)=>{"use strict";c.d(b,{T:()=>g});var d=c(56791),e=c(41364);let f=(0,c(72626).h)("conversation-logger");async function g(a,b,c,h="claude"){let i=(0,d.getLastUserMessage)(a,b);if(i)try{await (0,e.hM)(b,i.content,c,h)}catch(a){f.error("conversation:log-failed",{error:a instanceof Error?a.message:String(a)})}}},20610:(a,b,c)=>{"use strict";c.d(b,{CV:()=>i,Em:()=>l,Is:()=>g,KI:()=>j,PY:()=>k,Uc:()=>d,Zf:()=>h,pL:()=>e,x9:()=>f});let d=100,e=100,f=200,g=300,h=500,i=500,j=2e3,k=200,l=100},21684:(a,b,c)=>{"use strict";c.d(b,{U:()=>h});var d=c(33873),e=c.n(d),f=c(87447),g=c(8004);function h(){let a=e().join(process.cwd(),"data","logs");return(0,g.T)((0,f._p)("CM_LOG_DIR"),a,"CM_LOG_DIR")}},25129:(a,b,c)=>{"use strict";c.d(b,{gF:()=>H,xn:()=>A});var d=c(72626),e=c(68652),f=c(85164);let g=/^\s*[\u276F\u25CF\u203A][^\d]*(\d+)(?:\.(?!\d)|\s{2,})\s*(.+)$/,h=/^\s*[^\d]{0,3}(\d+)(?:\.(?!\d)|\s+)\s*(.+)$/,i=/^\s*\d{1,3}\s+tasks?\s+\(\d+\s+done\b/i,j=/^\s*[◼◻]\s/,k=/^[-─]+$/,l=/^\s*\[[^\]]*\d+\s+lines?\]/i,m=/^\s*[…]?\s*[+\-↑↓⏵⏷]?\s*\d+\s+(?:pending|more|completed)\b/i,n=/Esc\s+to\s+cancel\s*[·•]\s*Tab\s+to\s+amend/i,o=/Enter\s+to\s+select\b.*\bnavigate\b/i,p=/press\s+(?:enter|number)\s+to\s+confirm/i,q=/press\s+number\s+to\s+confirm/i,r=/(?:select|choose|pick|which|what|how|where|enter|type|specify|confirm|approve|accept|reject|decide|preference|option)/i,s=[/type\s+here/i,/tell\s+(me|claude)/i,/enter\s+/i,/custom/i,/differently/i];function t(a,b){if(0===b.length)return!0;let c=b[0].number;return a<c&&a>=c-2}function u(a){return{isPrompt:!1,cleanContent:a.trim()}}function v(a){return 0!==a.length&&!!(a.includes("?")||a.includes("?")||r.test(a))}function w(a,b){let c=b.endsWith("?")||b.endsWith("?");return!!(!c&&/^\s{2,}[^\d]/.test(a)&&!/^\s*\d+\./.test(a)||!c&&/^\s{4,}/.test(a)&&!/^\s*\d+\.\s/.test(a)||b.length<5&&!c||/^[\/~]/.test(b)||b.length>=2&&/^[a-zA-Z0-9_-]+$/.test(b))}let x=/^[⏺⎿●○•✔✓✖✗✘›»❯└├>]/;function y(a,b){let c=Math.max(0,b-12);for(let d=b-1;d>=c;d--)if(function(a){if(void 0===a)return!1;let b=a.trim();return""!==b&&(x.test(b)||k.test(b))}(a[d]))return d+1;return c}function z(a,b,c){let d=a.slice(b,c).map(a=>a.trimEnd()).join("\n").trim();return d.length>0?d:void 0}function A(a,b="yes_no"){let c=a.toLowerCase().trim();if("multiple_choice"===b){if(/^\d+$/.test(c))return c;throw Error("Invalid answer for multiple choice prompt. Expected a number.")}if("yes"===c||"y"===c)return"y";if("no"===c||"n"===c)return"n";throw Error("Invalid answer for yes/no prompt. Expected 'yes', 'no', 'y', or 'n'.")}let B=(0,d.h)("prompt-detector"),C=null;function D(a){let b=a.split("\n"),c=(b.length>200?b.slice(-200):b).join("\n");return c.length>5e3&&(c=c.slice(-5e3)),c}let E=[{regex:/^(.+)\s+\(y\/n\)\s*$/m},{regex:/^(.+)\s+\[y\/N\]\s*$/m,defaultOption:"no"},{regex:/^(.+)\s+\[Y\/n\]\s*$/m,defaultOption:"yes"},{regex:/^(.+)\s+\(yes\/no\)\s*$/m}];function F(a,b,c,d){let{startLine:e,endLine:f}=function(a,b,c){let d=c.index??0,e=a=>a.split("\n").length-1,f=b+e(a.slice(0,d));return{startLine:f,endLine:f+e(c[0])}}(b,c,d);return z(a,y(a,e),f+1)}function G(a,b,c,d,e){return{isPrompt:!0,promptData:{type:"yes_no",question:a,options:["yes","no"],status:"pending",...void 0!==e&&{defaultOption:e},instructionText:c,...void 0!==d&&{approvalTarget:d}},cleanContent:b,rawContent:c}}function H(a,b){let c=(0,e.N)(a),d=c===a&&b?.precomputedLines?b.precomputedLines:c.split("\n"),r=d.slice(-50).join("\n"),x=r===C;x||B.debug("detectPrompt:start",{outputLength:c.length}),C=r;let A=d.slice(-20).join("\n"),H=Math.max(0,d.length-20),I=function(a,b,c){a=(0,e.N)(a);let d=b?.requireDefaultIndicator??!0,r=a.split("\n"),x=r.length;for(;x>0&&""===r[x-1].trim();)x--;let A=Math.max(0,x-50),B=!1;for(let a=x-1;a>=A;a--){let b=o.test(r[a]);if(n.test(r[a])||b){x=a,B=b;break}}let C=r.slice(A,x);for(let b of C)if(f.l8.test(b))return u(a);let D=!1,E=!1;for(let a of C){let b=a.trim();if(!D&&p.test(b)){D=!0,q.test(b)&&(E=!0);break}}if(d){let b=!1;for(let a of C){let c=a.trim();if(g.test(c)){b=!0;break}}if(!b&&!D)return u(a)}let F=[],G=-1,H=0,I=function(a,b,c){let d=new Set;for(let e=Math.max(0,b);e<Math.min(c,a.length);e++)if(i.test(a[e])){d.add(e);for(let b=e+1;b<Math.min(c,a.length);b++){let c=a[b];if(!j.test(c)&&!m.test(c))break;d.add(b)}}return d}(r,A,x);for(let b=x-1;b>=A;b--){let c=r[b].trim();if(I.has(b)||l.test(c)||m.test(c)){H++;continue}let d=c.match(g);if(d){let a=parseInt(d[1],10);if(a<=20&&t(a,F)){let b=d[2].trim();F.unshift({number:a,label:b,isDefault:!0}),H=0;continue}}let e=c.match(h);if(e){let a=parseInt(e[1],10);if(a>20);else if(t(a,F)){let b=e[2].trim();F.unshift({number:a,label:b,isDefault:!1}),H=0;continue}}if(0===F.length&&(c.startsWith("❯")||c.startsWith("●")||c.startsWith("›")))return u(a);if(F.length>0&&c&&!k.test(c)){let a=r[b];if(/^\s{4,}/.test(a)&&w(a,c)){if(++H>25){G=b;break}continue}if(v(c)){G=b;break}if(w(a,c)){if(++H>(/^\s{4,}/.test(a)?25:5)){G=b;break}continue}G=b;break}}if(!function(a){if(0===a.length||1!==a[0])return!1;let b=0;for(let c=1;c<a.length;c++){let d=a[c]-a[c-1];if(d<1||d>2||(2===d&&b++,b>1))return!1}return!0}(F.map(a=>a.number)))return u(a);let J=F.some(a=>a.isDefault),K=d&&D;if(F.length<2||d&&!J&&!K||!d&&!J&&(-1===G||!v(r[G]?.trim()??"")&&!function(a,b,c,d){let e=Math.max(d,b-3);for(let c=b-1;c>=e;c--){let b=a[c]?.trim()??"";if(!(!b||k.test(b))&&v(b))return!0}return!1}(r,G,0,A)))return u(a);let L=function(a,b){if(b<0)return"Please select an option:";let c=[];for(let d=Math.max(0,b-5);d<=b;d++){let b=a[d].trim();b&&!k.test(b)&&c.push(b)}return c.join(" ")}(r,G),M=function(a,b,c){if(b<0)return;let d=Math.max(0,b-19),e=a.slice(d,c).map(a=>a.trimEnd()).join("\n").trim();return e.length>0?e:void 0}(r,G,x),N=function(a,b,c){if(!(b<0))return z(a,y(a,b),c)}(r,G,x);var O=a,P=D?E?"answer_only":"answer_then_enter":void 0,Q=B;let{instructionText:R,approvalTarget:S}={instructionText:M,approvalTarget:N}??{};return{isPrompt:!0,promptData:{type:"multiple_choice",question:L.trim(),options:F.map(a=>{let b=s.some(b=>b.test(a.label));return{number:a.number,label:a.label,isDefault:a.isDefault,requiresTextInput:b}}),status:"pending",instructionText:R,...void 0!==S?{approvalTarget:S}:{},...P?{submitMode:P}:{},...Q?{isAskUserQuestion:!0}:{}},cleanContent:L.trim(),rawContent:c(O.trim())}}(c,b,D);if(I.isPrompt)return x||B.info("detectPrompt:multipleChoice",{isPrompt:!0,question:I.promptData?.question,optionsCount:I.promptData?.options?.length}),I;let J=A.trim();for(let a of E){let b=A.match(a.regex);if(b){let c=b[1].trim();return G(c,c,J,F(d,A,H,b),a.defaultOption)}}let K=A.match(/^(.*?)Approve\?\s*$/m);if(K){let a=K[1].trim();return G(a?`${a} Approve?`:"Approve?",a||"Approve?",J,F(d,A,H,K))}return x||B.debug("detectPrompt:complete",{isPrompt:!1}),{isPrompt:!1,cleanContent:c.trim()}}},26838:(a,b,c)=>{"use strict";c.d(b,{Mj:()=>k,Sw:()=>j,lX:()=>l});var d=c(29021),e=c(33873),f=c(90164);let g=/^v?\d+\.\d+\.\d+$/,h=/^[a-zA-Z0-9.\-\s_v]+$/,i=globalThis.__versionCheckCache??(globalThis.__versionCheckCache={result:null,fetchedAt:0,rateLimitResetAt:null});function j(){return function(){try{let a=(0,d.readFileSync)((0,e.join)(process.cwd(),"package.json"),"utf-8"),b=JSON.parse(a);if("commandmate"===b.name&&"string"==typeof b.version&&b.version.length>0)return b.version;return null}catch{return null}}()??"0.24.0"}function k(){return j()}async function l(){try{var a,b,c;if(null!==i.result&&Date.now()-i.fetchedAt<36e5||i.rateLimitResetAt&&(!(Date.now()>=i.rateLimitResetAt)||(i.rateLimitResetAt=null,0)))return i.result;let d=await fetch("https://api.github.com/repos/Kewton/CommandMate/releases/latest",{headers:{Accept:"application/vnd.github+json","User-Agent":`CommandMate/${k()}`},cache:"no-store",signal:AbortSignal.timeout(5e3)});if(403===d.status)return function(a){let b=a.headers.get("X-RateLimit-Reset");b?i.rateLimitResetAt=1e3*parseInt(b,10):i.rateLimitResetAt=Date.now()+36e5}(d),i.result;if(!d.ok)return i.result;let e=await d.json(),j=k(),l=e.tag_name.replace(/^v/,""),m={hasUpdate:function(a,b){if(!g.test(a)||!g.test(b))return!1;let c=a=>a.replace(/^v/,"").split(".").map(Number),[d,e,f]=c(a),[h,i,j]=c(b);return h!==d?h>d:i!==e?i>e:j>f}(j,e.tag_name),currentVersion:j,latestVersion:l,releaseUrl:(a=e.html_url).startsWith(f.Dk)?a:null,releaseName:(b=e.name,c=e.tag_name,h.test(b)&&b.length<=128?b:c),publishedAt:e.published_at};return i.result=m,i.fetchedAt=Date.now(),m}catch{return i.result}}},30008:(a,b,c)=>{"use strict";c.d(b,{F1:()=>g,_G:()=>i,j0:()=>f,rB:()=>h,xF:()=>j});var d=c(48083),e=c(67882);let f=3e5,g="CM_STRUCTURED_SEND_GUARD";function h(a){return"notification"===a.source?e.Oh.PERMISSION_PROMPT:e.Oh.PERMISSION_REQUEST}function i({worktreeId:a,cliToolId:b,instanceId:c,scraper:e,ignoreStructured:i=!1,now:j=Date.now()}){var k,l,m;let n=(0,d.P5)(a,b,c,j);null!==n&&("waiting"===e.status?(0,d.zA)(a,b,c,j):n.scraperCorroborated&&((0,d.m5)(a,b,c),n=null));let o=e.hasActivePrompt||null!==n;if(e.hasActivePrompt)return{waiting:o,scraperWaiting:!0,structured:n,blocksSend:!0,blockedBy:"scraper",blockReason:e.reason,structuredSendBlockSuppressed:null};if(null===n)return{waiting:o,scraperWaiting:!1,structured:null,blocksSend:!1,blockedBy:null,blockReason:null,structuredSendBlockSuppressed:null};let p=(k=n,l=i,m=j,l?"caller_opt_out":!function(){let a=process.env[g]?.trim().toLowerCase();return"off"===a||"0"===a||"false"===a}()?m-k.at>=f?"expired":null:"disabled");return{waiting:o,scraperWaiting:!1,structured:n,blocksSend:null===p,blockedBy:null===p?"structured":null,blockReason:null===p?h(n):null,structuredSendBlockSuppressed:p}}function j({worktreeId:a,cliToolId:b,instanceId:c,scraper:e,now:f=Date.now()}){let g=(0,d.P5)(a,b,c,f);return{waiting:e.hasActivePrompt||null!==g,scraperWaiting:e.hasActivePrompt,structured:g}}},31268:(a,b,c)=>{"use strict";c.d(b,{s:()=>P});var d=c(44265),e=c(57905);class f extends d.M{async isInstalled(){return await (0,e.zw)()}async isRunning(a,b){return await (0,e.Yq)(a,b)}async startSession(a,b,c){await (0,e.R7)({worktreeId:a,worktreePath:b,instanceId:c})}async sendMessage(a,b,c){await (0,e.pU)(a,b,c)}supportsImage(){return!0}async sendMessageWithImage(a,b,c,d){let e=`
|
|
2
|
+
`,f=b?`${b}${e}`:e;await this.sendMessage(a,f,d)}async killSession(a,b){await (0,e.VU)(a,b)}constructor(...a){super(...a),this.id="claude",this.name="Claude Code",this.command="claude"}}var g=c(11665),h=c(40236),i=c(93997),j=c(85164),k=c(72626),l=c(22354),m=c(4970),n=c(20610);let o=(0,k.h)("cli-tools/codex");function p(a){return a instanceof Error?a.message:String(a)}let q=["Hooks need review","Continue without trusting"];class r extends d.M{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,g.N)(c)}async startSession(a,b,c){if(!await this.isInstalled())throw Error("Codex CLI is not installed or not in PATH");let d=this.getSessionName(a,c);if(await (0,g.N)(d)){await this.reconcileExistingSession(d),o.info("codex-session-sessionname");return}(0,m.F)({worktreeId:a,cliToolId:l.c1,instanceId:c});try{await (0,g.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,n.Uc));let e=(0,m.c)({worktreeId:a,cliToolId:l.c1,instanceId:c},this.command).command;await (0,g.V1)(d,e,!0),await new Promise(a=>setTimeout(a,3e3)),await this.waitForReady(d),o.info("started-codex-session:sessionname")}catch(b){let a=p(b);throw Error(`Failed to start Codex session: ${a}`)}}async waitForReady(a){let b=!1,c=!1,d=!1;for(let e=0;e<30;e++){try{let e=await (0,g.Xg)(a,50),f=(0,j.aJ)(e);if((0,j.zZ)(f))return void o.info("codex-prompt-detected");if(!d&&function(a){return q.every(b=>a.includes(b))}(f)){await (0,g.V1)(a,"3",!1),d=!0,o.info("codex-hooks-review-declined"),await new Promise(a=>setTimeout(a,n.CV));continue}let h=(0,j.Qh)(f);if("update"===h&&!b){await (0,g.V1)(a,"2",!1),b=!0,o.info("skipped-codex-update"),await new Promise(a=>setTimeout(a,n.CV));continue}if("press-enter"===h){await (0,g.ds)(a,"Enter"),o.info("dismissed-codex-notification"),await new Promise(a=>setTimeout(a,n.CV));continue}if("trust"===h&&!c){await (0,g.V1)(a,"1",!1),c=!0,o.info("auto-trusted-folder-for"),await new Promise(a=>setTimeout(a,n.CV));continue}}catch{}await new Promise(a=>setTimeout(a,1e3))}o.info("codex-prompt-detection")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,g.Xg)(a,50),c=(0,j.aJ)(b);if((0,j.zZ)(c))return}catch{}await new Promise(a=>setTimeout(a,500))}throw o.info("codex-prompt-not"),Error("Codex prompt not ready: timed out waiting for the input prompt before sending")}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,g.N)(d))throw Error(`Codex session ${d} does not exist. Start the session first.`);try{await this.waitForPrompt(d),await (0,h.FW)({sessionName:d,message:b,cliToolId:"codex"}),(0,i.gm)(d),o.info("sent-message-to-codex-session:sessionnam")}catch(b){let a=p(b);throw Error(`Failed to send message to Codex: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,g.N)(c)&&(await (0,g.ds)(c,"C-d"),await new Promise(a=>setTimeout(a,n.Zf))),await (0,g.fY)(c)&&o.info("stopped-codex-session:sessionname")}catch(a){throw o.error("session:stop-failed",{error:p(a)}),a}}constructor(...a){super(...a),this.id="codex",this.name="Codex CLI",this.command="codex"}}var s=c(11508),t=c(15194),u=c(88807),v=c(56791);let w=(0,k.h)("cli-tools/vibe-local");function x(a){return a instanceof Error?a.message:String(a)}class y extends d.M{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,g.N)(c)}async startSession(a,b,c){if(!await this.isInstalled())throw Error("vibe-local is not installed or not in PATH");let d=this.getSessionName(a,c);if(await (0,g.N)(d)){await this.reconcileExistingSession(d),w.info("vibe-local-session");return}try{await (0,g.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,n.Uc));let c="vibe-local -y";try{let b=(0,u.getDbInstance)(),d=(0,v.getWorktreeById)(b,a);d?.vibeLocalModel&&t.QP.test(d.vibeLocalModel)&&(c+=` -m ${d.vibeLocalModel}`);let e=d?.vibeLocalContextWindow;(0,t.FV)(e)&&(c+=` --context-window ${Number(e)}`)}catch{}await (0,g.V1)(d,c,!0),await new Promise(a=>setTimeout(a,5e3)),w.info("started-vibe-local-session:sessionname")}catch(b){let a=x(b);throw Error(`Failed to start Vibe Local session: ${a}`)}}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,g.N)(d))throw Error(`Vibe Local session ${d} does not exist. Start the session first.`);try{await (0,h.FW)({sessionName:d,message:b,cliToolId:"vibe-local",submitEnterCount:2,interEnterWaitMs:n.PY}),(0,i.gm)(d),w.info("sent-message-to-vibe-local-session:sessi")}catch(b){let a=x(b);throw Error(`Failed to send message to Vibe Local: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,g.N)(c)&&(await (0,g.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,n.Is)),await (0,g.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,n.Zf))),await (0,g.fY)(c)&&w.info("stopped-vibe-local-session:sessionname")}catch(a){throw w.error("session:stop-failed",{error:x(a)}),a}}constructor(...a){super(...a),this.id="vibe-local",this.name="Vibe Local",this.command="vibe-local"}}var z=c(41466),A=c(79646),B=c(56263),C=c(21758),D=c(54633),E=c(77093);let F=(0,k.h)("cli-tools/copilot"),G=new Set(["model","agent","theme"]);class H extends d.M{async isInstalled(){try{return await new Promise((a,b)=>{(0,A.execFile)("gh",["--version"],{timeout:5e3},c=>{c?b(c):a()})}),await new Promise((a,b)=>{(0,A.execFile)("gh",["copilot","--help"],{timeout:5e3},c=>{c?b(c):a()})}),!0}catch{return!1}}async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,g.N)(c)}async startSession(a,b,c){if(!await this.isInstalled())throw Error("GitHub Copilot CLI is not installed. Install with: gh extension install github/gh-copilot");let d=this.getSessionName(a,c);if(await (0,g.N)(d)){await this.reconcileExistingSession(d),F.info("copilot-session-exists");return}(0,m.F)({worktreeId:a,cliToolId:D.V,instanceId:c});try{await (0,g.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,n.Uc));let e=(0,m.c)({worktreeId:a,cliToolId:D.V,instanceId:c},C.nL).command;await (0,g.V1)(d,e,!0),await new Promise(a=>setTimeout(a,4e3)),await this.waitForReady(d),F.info("started-copilot-session")}catch(b){let a=(0,E.u1)(b);throw Error(`Failed to start Copilot session: ${a}`)}}async waitForReady(a){for(let b=0;b<30;b++){try{let b=await (0,g.Xg)(a,50),c=(0,j.aJ)(b);if(j.Du.test(c))return void F.info("copilot-prompt-detected")}catch{}await new Promise(a=>setTimeout(a,1e3))}F.info("copilot-prompt-detection-timeout")}async waitForPrompt(a,b=15e3){let c=Date.now();for(;Date.now()-c<b;){try{let b=await (0,g.Xg)(a,50),c=(0,j.aJ)(b);if(j.Du.test(c))return}catch{}await new Promise(a=>setTimeout(a,500))}F.info("copilot-prompt-not-detected")}extractSlashCommand(a){let b=a.trim();if(!b.startsWith("/"))return null;let c=b.match(/^\/(\S+)/);return c?c[1]:null}async waitForSelectionList(a){let b=Date.now();for(;Date.now()-b<5e3;){await new Promise(a=>setTimeout(a,300));try{let b=await (0,g.Xg)(a,50),c=(0,j.aJ)(b);if(j.Mi.test(c))return F.info("copilot-selection-list-detected"),!0}catch{}}return F.info("copilot-selection-list-not-detected-timeout"),!1}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,g.N)(d))throw Error(`Copilot session ${d} does not exist. Start the session first.`);try{await this.waitForPrompt(d);let a=this.extractSlashCommand(b);if(a&&G.has(a)){await (0,g.V1)(d,b,!0),await this.waitForSelectionList(d),(0,i.gm)(d),F.info("sent-selection-list-command-to-copilot",{command:a});return}await (0,h.FW)({sessionName:d,message:b,cliToolId:"copilot",textInputWaitMs:B.L1,verifyDelayMs:B.wp}),(0,i.gm)(d),F.info("sent-message-to-copilot-session")}catch(b){let a=(0,E.u1)(b);throw Error(`Failed to send message to Copilot: ${a}`)}}async sendModelCommand(a,b,c){let d=this.getSessionName(a,c);if(!await (0,g.N)(d))throw Error(`Copilot session ${d} does not exist. Start the session first.`);try{await (0,g.V1)(d,`/model ${b}`,!0),await this.waitForSelectionList(d)&&await (0,g.ds)(d,"C-m"),await this.waitForPrompt(d,B.pL),(0,i.gm)(d),F.info("copilot-model-switched",{model:b})}catch(c){let a=(0,E.u1)(c);throw Error(`Failed to switch Copilot model to ${b}: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,g.N)(c)&&(await (0,g.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,n.Is)),await (0,g.V1)(c,"exit",!0),await new Promise(a=>setTimeout(a,n.Zf))),await (0,g.fY)(c)&&F.info("stopped-copilot-session")}catch(a){throw F.error("session:stop-failed",{error:(0,E.u1)(a)}),a}}constructor(...a){super(...a),this.id="copilot",this.name="Copilot",this.command="gh"}}let I=(0,k.h)("cli-tools/antigravity");function J(a){return a instanceof Error?a.message:String(a)}let K=/\?\s+for\s+shortcuts/,L=/Do you trust the contents of this project\?/;function M(a){return K.test(a)&&!L.test(a)}class N extends d.M{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,g.N)(c)}async startSession(a,b,c,d){if(!await this.isInstalled())throw Error("Antigravity CLI (agy) is not installed or not in PATH");let e=this.getSessionName(a,c);if(await (0,g.N)(e)){await this.reconcileExistingSession(e),I.info("antigravity-session-exists");return}(0,m.F)({worktreeId:a,cliToolId:l.F0,instanceId:c});try{await (0,g.jw)({sessionName:e,workingDirectory:b}),await new Promise(a=>setTimeout(a,n.Uc));let f=(0,m.c)({worktreeId:a,cliToolId:l.F0,instanceId:c},this.command).command,h=d?`${f} --model '${d.replace(/'/g,"'\\''")}'`:f;await (0,g.V1)(e,h,!0),await new Promise(a=>setTimeout(a,3e3)),await this.waitForReady(e),I.info("started-antigravity-session")}catch(b){let a=J(b);throw Error(`Failed to start Antigravity session: ${a}`)}}async waitForReady(a){let b=!1;for(let c=0;c<30;c++){try{let c=await (0,g.Xg)(a,50),d=(0,j.aJ)(c);if(M(d))return void I.info("antigravity-prompt-detected");if(!b&&L.test(d)){await (0,g.ds)(a,"Enter"),b=!0,I.info("auto-trusted-folder-for-antigravity"),await new Promise(a=>setTimeout(a,500));continue}}catch{}await new Promise(a=>setTimeout(a,1e3))}I.info("antigravity-prompt-detection-timeout")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,g.Xg)(a,50),c=(0,j.aJ)(b);if(M(c))return}catch{}await new Promise(a=>setTimeout(a,500))}throw I.info("antigravity-prompt-not-ready"),Error("Antigravity prompt not ready: timed out waiting for the input prompt before sending")}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,g.N)(d))throw Error(`Antigravity session ${d} does not exist. Start the session first.`);try{await this.waitForPrompt(d),await (0,h.FW)({sessionName:d,message:b,cliToolId:"antigravity"}),(0,i.gm)(d),I.info("sent-message-to-antigravity-session")}catch(b){let a=J(b);throw Error(`Failed to send message to Antigravity: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,g.N)(c)&&(await (0,g.ds)(c,"C-d"),await new Promise(a=>setTimeout(a,n.Zf)));let a=await (0,g.fY)(c);(0,i.gm)(c),a&&I.info("stopped-antigravity-session")}catch(a){throw I.error("session:stop-failed",{error:J(a)}),a}}constructor(...a){super(...a),this.id="antigravity",this.name="Antigravity CLI",this.command="agy"}}var O=c(95220);class P{constructor(){this.tools=new Map,this.tools.set("claude",new f),this.tools.set("codex",new r),this.tools.set("gemini",new s.m),this.tools.set("vibe-local",new y),this.tools.set("opencode",new z.Ui),this.tools.set("copilot",new H),this.tools.set("antigravity",new N)}static getInstance(){return P.instance||(P.instance=new P),P.instance}getTool(a){let b=this.tools.get(a);if(!b)throw Error(`CLI tool '${a}' not found`);return b}getAllTools(){return Array.from(this.tools.values())}async getToolInfo(a){let b=this.getTool(a),c=await b.isInstalled();return{id:b.id,name:b.name,command:b.command,installed:c}}async getAllToolsInfo(){return Promise.all(this.getAllTools().map(async a=>{let b=await a.isInstalled();return{id:a.id,name:a.name,command:a.command,installed:b}}))}async getInstalledTools(){return(await this.getAllToolsInfo()).filter(a=>a.installed)}stopPollers(a,b,c){(0,O.stopPolling)(a,b,c)}}},31766:(a,b,c)=>{"use strict";c.d(b,{Wh:()=>p,WD:()=>q,K1:()=>o});var d=c(31268),e=c(72626),f=c(11665);let g={streamingOutput:!1,explicitResize:!1,snapshotFallback:!0};class h{async unsubscribe(){}}class i{async ensureSession(a,b){await (0,f.N)(a)||await (0,f.jw)(a,b)}async sessionExists(a){return(0,f.N)(a)}async sendInput(a,b){await (0,f.V1)(a,b)}async sendSpecialKey(a,b){if("Escape"!==b&&"C-c"!==b&&"C-d"!==b&&"C-m"!==b&&"Enter"!==b)throw Error(`Unsupported special key for PollingTmuxTransport: ${b}`);await (0,f.ds)(a,b)}async resize(){throw Error("PollingTmuxTransport does not support explicit resize")}async captureSnapshot(a,b){return(0,f.Xg)(a,b)}async subscribe(){return new h}getCapabilities(){return g}async killSession(a){return(0,f.fY)(a)}}let j=null;var k=c(93997);let l=(0,e.h)("cli-session");function m(){return j||(j=new i),j}function n(a,b,c){let e=d.s.getInstance().getTool(b),f=e.getSessionName(a,c);return{cliTool:e,sessionName:f}}async function o(a,b,c){let{sessionName:d}=n(a,b,c);return m().sessionExists(d)}async function p(a,b,c=1e3,d){let e=l.withContext({worktreeId:a,cliToolId:b});e.debug("captureSessionOutput:start",{requestedLines:c});let{cliTool:f,sessionName:g}=n(a,b,d),h=m();try{let a=await (0,k.aq)(g,c,async()=>{if(!await h.sessionExists(g))throw Error(`${f.name} session ${g} does not exist`);return await h.captureSnapshot(g,{startLine:-k.xE})});return e.debug("captureSessionOutput:success",{actualLines:a.split("\n").length,lastFewLines:a.split("\n").slice(-3).join(" | ")}),a}catch(b){let a=b instanceof Error?b.message:String(b);if(a.includes("does not exist"))throw e.debug("captureSessionOutput:sessionNotFound",{sessionName:g}),b;throw e.error("captureSessionOutput:failed",{error:a}),Error(`Failed to capture ${f.name} output: ${a}`)}}async function q(a,b,c=5e3,d){let e=l.withContext({worktreeId:a,cliToolId:b});e.debug("captureSessionOutputFresh:start",{requestedLines:c});let{cliTool:f,sessionName:g}=n(a,b,d),h=m();try{let a=await h.captureSnapshot(g,{startLine:-c});return a.length>0?(0,k.vF)(g,a,c):(0,k.gm)(g),(0,k.wd)(a,c)}catch(b){(0,k.gm)(g);let a=b instanceof Error?b.message:String(b);throw e.error("captureSessionOutputFresh:failed",{error:a}),Error(`Failed to capture ${f.name} output: ${a}`)}}},34405:(a,b,c)=>{"use strict";c.d(b,{G:()=>e,_:()=>d});let d=1e4,e=1e3},39727:()=>{},40236:(a,b,c)=>{"use strict";c.d(b,{FW:()=>l});var d=c(11665),e=c(93997),f=c(85164),g=c(20610);let h=(0,c(72626).h)("cli-tools/submit-verified-sender"),i=/\[Pasted text[\s#]/,j=/^\/[A-Za-z]/,k=/^\s*(?:ctx:\d+%\s*)?[>❯›]/;async function l(a){let{sessionName:b,message:c,cliToolId:l,textInputWaitMs:m=g.pL,submitEnterCount:n=1,interEnterWaitMs:o=g.pL,verifyAttempts:p=4,verifyDelayMs:q=g.x9}=a;await (0,d.V1)(b,c,!1),await new Promise(a=>setTimeout(a,m));for(let a=0;a<Math.max(1,n);a++)await (0,d.KB)(b,["Enter"]),a<n-1&&await new Promise(a=>setTimeout(a,o));let r=Math.max(1,p);for(let a=0;a<r;a++){await new Promise(a=>setTimeout(a,q));let g=function(a,b,c){let d=(0,f.aJ)(a).split("\n").slice(-12),e=d.join("\n");if((0,f.ut)(b,e))return"submitted";let g=function(a){for(let b=a.length-1;b>=0;b--)if(k.test(a[b]))return a[b];return null}(d);if(!g)return"submitted";let h=g.replace(k,"").trim();return 0===h.length?"submitted":i.test(g)||function(a,b){let c=b.split("\n").map(a=>a.trim()).find(a=>a.length>0)??"";return 0!==c.length&&c.startsWith(a)}(h,c)?"pending":j.test(h)?"replaced":"submitted"}(await (0,d.Xg)(b,{startLine:-12}),l,c);if("submitted"===g)return void(0,e.gm)(b);if("replaced"===g){try{await (0,d.Ce)(b)}catch(a){h.error("submit-clear-input-failed",{sessionName:b,cliToolId:l,error:a instanceof Error?a.message:String(a)})}throw(0,e.gm)(b),h.error("submit-replaced-by-tui-completion",{sessionName:b,cliToolId:l,attempt:a}),Error(`Message was replaced by a TUI autocompletion for session ${b}; the input no longer matches the sent text. Cleared the input line without submitting to avoid executing a different command.`)}h.warn("submit-not-confirmed:resending-enter",{sessionName:b,cliToolId:l,attempt:a}),await (0,d.KB)(b,["Enter"])}throw(0,e.gm)(b),h.error("submit-verification-failed",{sessionName:b,cliToolId:l,attempts:r}),Error(`Message submit could not be confirmed for session ${b} after ${r} attempts (typed but unsent)`)}},40467:(a,b,c)=>{"use strict";c.d(b,{$:()=>t});var d=c(56791);let e=globalThis.__unclassifiedFrameRuns??(globalThis.__unclassifiedFrameRuns=new Map);var f=c(81254),g=c(72626),h=c(31268),i=c(31766),j=c(95595),k=c(5363),l=c(52277),m=c(34405),n=c(93997),o=c(48083),p=c(30008),q=c(9516),r=c(36051);let s=(0,g.h)("current-output-builder");async function t(a,b,c,g){let t=g??c,u=h.s.getInstance().getTool(c),v=(0,o.CE)(b,c,g),w=(0,o.ak)(b,c,g),x={lastEventType:w?.event??null,lastEventAt:w?.at??null,lastEventDetail:w?.detail??null,promptWaitingSince:null,promptWaitingSource:null};if(!await u.isRunning(b,g))return{isRunning:!1,content:"",lineCount:0,cliToolId:c,sessionStatus:"idle",sessionStatusReason:"session_not_running",lastStopEventAt:v,structuredEvents:x,model:null,reasoningEffort:null};let y=(0,d.getSessionState)(a,b,t),z=y?.lastCapturedLine||0,A=await (0,i.Wh)(b,c,m._,g),B=A.split("\n"),C=B.length,D=((0,n.sl)(C,Math.min(m._,n.xE))?B:B.slice(Math.max(0,z))).join("\n"),E=(0,k.v7)(b,c,g),F=(0,k.xU)(E),G=F?new Date(F):void 0,H=(0,j.WC)(A,c,G),I="running"===H.status&&H.reason===j.gv.THINKING_INDICATOR,J=H.hasActivePrompt,K="waiting"===H.status&&j.ug.has(H.reason),L=H.reason===j.gv.CODEX_PAGER,M="running"===H.status&&H.reason===j.gv.DEFAULT||"ready"===H.status&&H.reason===j.gv.NO_RECENT_OUTPUT,N=(0,o.R4)(b,c,g),O=(0,p._G)({worktreeId:b,cliToolId:c,instanceId:g,scraper:{status:H.status,reason:H.reason,hasActivePrompt:J}}),P=O.structured;null!==P&&(x.promptWaitingSince=P.at,x.promptWaitingSource=P.source);let Q=function(a,b,c=null){if("waiting"===a.status)return{...a,structuredApplied:!1};if(null!==c)return{status:"waiting",reason:(0,p.rB)(c),thinking:!1,isUnclassifiedActive:a.isUnclassifiedActive,structuredApplied:!0};if(null===b||"waiting"===b.status)return{...a,structuredApplied:!1};let d="running"===b.status;return{status:b.status,reason:b.reason,thinking:d,isUnclassifiedActive:("ready"!==b.status||"running"!==a.status)&&a.isUnclassifiedActive,structuredApplied:!0}}({status:H.status,reason:H.reason,thinking:I,isUnclassifiedActive:M},N,P),R=O.waiting,S=(0,o.BJ)(b,c,g),T=H.promptDetection.promptData,U=T&&S?(0,q.Hu)(T,S.spec):null,V=null===P?null:{...P,askUserQuestion:function(a){let b=a?.spec.questions[0];return b?{question:b.question,labels:b.choices.map(a=>a.label),questionCount:a.spec.questions.length}:null}(S)},W=J?U??T??(V?(0,r.Yo)(b,V):null):V?(0,r.Yo)(b,V):null;null!==N&&N.status!==H.status&&s.info("detection-divergence",{worktreeId:b,cliToolId:c,instanceId:t,scraperStatus:H.status,scraperReason:H.reason,structuredStatus:N.status,structuredReason:N.reason,structuredEvent:N.event,structuredEventAt:N.at,applied:Q.structuredApplied});let X=function(a,b,c=Date.now()){for(let[a,b]of e)c-b.lastSeen>36e5&&e.delete(a);if(!b)return e.delete(a),{dwellMs:0,shouldRecord:!1};let d=e.get(a);if(!d)return e.set(a,{since:c,lastSeen:c,recorded:!1}),{dwellMs:0,shouldRecord:!1};d.lastSeen=c;let f=Math.max(0,c-d.since);return d.recorded||f<6e4?{dwellMs:f,shouldRecord:!1}:(d.recorded=!0,{dwellMs:f,shouldRecord:!0})}(E,Q.isUnclassifiedActive);if(X.shouldRecord&&function(a,b){let c=Math.round(b.dwellMs/1e3),e=`${b.sessionStatus}/${b.sessionStatusReason}`,g=`Unclassified interactive frame (${e}) held for ${c}s. The detection layer could not parse it, so no prompt was published and nothing could answer it. Inspect the raw pane with \`commandmate capture ${b.worktreeId} --pane\`.`,h={type:f.LT,status:"unclassified",question:g,options:[],dwellSeconds:c,sessionStatusReason:e};try{(0,d.createMessage)(a,{worktreeId:b.worktreeId,role:"assistant",content:g,messageType:"prompt",promptData:h,timestamp:new Date,cliToolId:b.cliToolId,instanceId:b.instanceId}),s.info("unclassified-frame-recorded",{worktreeId:b.worktreeId,cliToolId:b.cliToolId,dwellSeconds:c,statusReason:e})}catch(a){s.warn("unclassified-frame-record-failed",{worktreeId:b.worktreeId,error:a instanceof Error?a.message:String(a)})}}(a,{worktreeId:b,cliToolId:c,instanceId:t,dwellMs:X.dwellMs,sessionStatus:Q.status,sessionStatusReason:Q.reason}),null!==P&&null!==V&&!J&&!P.recorded){(0,o.HR)(b,c,g);var Y=b,Z=c,$=t,_=P,aa=V;let e=(0,r.fO)(Y,aa);try{(0,d.createMessage)(a,{worktreeId:Y,role:"assistant",content:e.question,summary:`structured prompt \xb7 source=${_.source}${_.toolName?` \xb7 tool=${_.toolName}`:""}`,messageType:"prompt",promptData:e,timestamp:new Date,cliToolId:Z,instanceId:$}),s.info("structured-prompt-recorded",{worktreeId:Y,cliToolId:Z,instanceId:$,source:_.source,toolName:_.toolName})}catch(a){s.warn("structured-prompt-record-failed",{worktreeId:Y,error:a instanceof Error?a.message:String(a)})}}let ab=B.slice(-100).join("\n"),ac=(0,k.aq)(b,c,g),{model:ad,effort:ae}=(0,o.jl)(b,c,g);return{isRunning:!0,cliToolId:c,sessionStatus:Q.status,sessionStatusReason:Q.reason,content:D,fullOutput:A,realtimeSnippet:ab,lineCount:C,lastCapturedLine:z,isComplete:R,isGenerating:Q.thinking,thinking:Q.thinking,thinkingMessage:Q.thinking?"Claude is thinking...":null,isPromptWaiting:R,promptData:W,autoYes:{enabled:ac?.enabled??!1,expiresAt:ac?.enabled?ac.expiresAt:null,stopReason:ac?.stopReason,lastSuppression:(0,l.gb)(b,c,g)},isSelectionListActive:K,isPagerActive:L,isUnclassifiedActive:Q.isUnclassifiedActive,lastServerResponseTimestamp:F,serverPollerActive:(0,k.bZ)(E),lastStopEventAt:v,structuredEvents:x,model:ad,reasoningEffort:ae}}},41364:(a,b,c)=>{"use strict";c.d(b,{Gv:()=>o,hM:()=>n});var d=c(79748),e=c.n(d),f=c(33873),g=c.n(f),h=c(1634),i=c(21684),j=c(72626),k=c(15194);function l(a="claude"){return g().join((0,i.U)(),a)}async function m(a="claude"){let b=l(a);try{await e().access(b)}catch{await e().mkdir(b,{recursive:!0})}}async function n(a,b,c,d="claude"){await m(d);let f=function(a,b="claude"){let c=(0,h.GP)(new Date,"yyyy-MM-dd"),d=`${a}-${c}.md`,e=l(b);return g().join(e,d)}(a,d),i=(0,h.GP)(new Date,"yyyy-MM-dd HH:mm:ss"),j="";try{j=await e().readFile(f,"utf-8")}catch{let b=(0,k.hR)(d)?k.ef[d]:d;j=`# ${b} Conversation Log: ${a}
|
|
3
3
|
|
|
4
4
|
Created: ${i}
|
|
5
5
|
|
|
@@ -17,12 +17,11 @@ Created: ${i}
|
|
|
17
17
|
|
|
18
18
|
`,j+=`---
|
|
19
19
|
|
|
20
|
-
`,await e().writeFile(f,j,"utf-8"),f}async function o(a,b="all"){let c="all"===b?[...k.XH]:[b],d=[];for(let b of c){await m(b);let c=l(b);try{let b=(await e().readdir(c)).filter(b=>b.startsWith(`${a}-`)&&b.endsWith(".md")).map(a=>g().join(c,a));d.push(...b)}catch{}}return d.sort().reverse()}(0,j.h)("log-manager")},44265:(a,b,c)=>{"use strict";c.d(b,{M:()=>k});var d=c(79646),e=c(28354),f=c(15194);let g=/^[a-zA-Z0-9_-]+$/;function h(a){if(!g.test(a))throw Error(`Invalid session name format: ${a}`)}var i=c(11665);let j=(0,e.promisify)(d.exec);class k{async isInstalled(){try{return await j(`which ${this.command}`,{timeout:5e3}),!0}catch{return!1}}getSessionName(a,b){let c=`mcbd-${this.id}-${a}`;if(!b||b===this.id)return h(c),c;let d=(0,f.pL)(b,this.id),e=d?`${c}-${d}`:c;return h(e),e}async reconcileExistingSession(a,b){await (0,i.zT)(a,b)}async interrupt(a,b){let c=this.getSessionName(a,b);await (0,i.ds)(c,"Escape")}}},45146:(a,b,c)=>{"use strict";c.d(b,{Et:()=>r,KQ:()=>t,MN:()=>n,SI:()=>k,fq:()=>s,g8:()=>o,sR:()=>u});var d=c(72626),e=c(13033),f=c(72457),g=c(71080),h=c(3523),i=c(99508);let j=(0,d.h)("response-poller"),k=["Waiting for auth","⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],l=new Map,m=new Map;function n(a,b,c){return`${a}:${c??b}`}function o(a,b,c){let d=n(a,b,c);r(a,b,c),m.set(d,Date.now()),("opencode"===b||"copilot"===b)&&(0,e.tb)(d),p(a,b,c)}function p(a,b,c){let d=n(a,b,c),e=setTimeout(async()=>{let e=m.get(d);if(e&&Date.now()-e>18e5)return void r(a,b,c);try{await (0,h.zX)(a,b,c)}catch(a){j.error("error:",{error:a instanceof Error?a.message:String(a)})}(0,i.broadcastTerminalSnapshot)(a,b,c),l.has(d)&&p(a,b,c)},2e3);l.set(d,e)}function q(a){let b=l.get(a);b&&(clearTimeout(b),l.delete(a),m.delete(a)),(0,e.q1)(a),(0,f.iX)(a),(0,g.L1)(a)}function r(a,b,c){q(n(a,b,c))}function s(){for(let a of Array.from(l.keys()))q(a)}function t(){return Array.from(l.keys())}function u(a,b){let c=new Map;for(let{oldId:b,newId:d}of a)b&&d&&b!==d&&c.set(b,d);if(0===c.size)return[];let d=[],h=[];for(let a of Array.from(l.keys())){let e=function(a){let b=a.indexOf(":");return b<=0||b===a.length-1?null:{worktreeId:a.slice(0,b),instanceId:a.slice(b+1)}}(a);if(!e)continue;let f=c.get(e.worktreeId);if(!f)continue;let g=b(e.worktreeId,e.instanceId);if(!g){h.push(a);continue}d.push({oldKey:a,newKey:n(f,g,e.instanceId),newWorktreeId:f,cliToolId:g,instanceId:e.instanceId})}let i=new Map;for(let a of d){let b=l.get(a.oldKey);b&&clearTimeout(b),l.delete(a.oldKey),i.set(a.newKey,{startedAt:m.get(a.oldKey)}),m.delete(a.oldKey),(0,f.i2)(a.oldKey,a.newKey),(0,g.Re)(a.oldKey,a.newKey),(0,e.q1)(a.oldKey)}for(let a of h)q(a),j.warn("poller:migrate-abandoned",{pollerKey:a});for(let a of d){let b=i.get(a.newKey)?.startedAt;m.set(a.newKey,b??Date.now()),("opencode"===a.cliToolId||"copilot"===a.cliToolId)&&(0,e.tb)(a.newKey),p(a.newWorktreeId,a.cliToolId,a.instanceId)}return d}},47990:()=>{},49358:a=>{"use strict";a.exports=JSON.parse('{"title":"Notifications","description":"Get a push notification when an agent is waiting for you or finishes a session — even when the app is closed.","enable":"Enable notifications","enabling":"Enabling…","enabledOnThisDevice":"Notifications are enabled on this device.","unsubscribe":"Unsubscribe this device","types":{"heading":"Notify me about","promptWaiting":"Prompt waiting","promptWaitingDesc":"When an agent is waiting for your reply","completion":"Session complete","completionDesc":"When an agent finishes a session"},"permission":{"denied":"Notifications are blocked in your browser settings. Allow them for this site to receive push notifications."},"unsupported":"This browser does not support push notifications.","notConfigured":"Push notifications are not configured on this server. Set the VAPID keys to enable them.","ios":{"guidance":"On iPhone/iPad, add this app to your Home Screen and open it from there to enable notifications."},"toast":{"enabled":"Notifications enabled on this device","disabled":"Notifications turned off on this device","error":"Could not enable notifications","updated":"Notification settings updated"},"push":{"promptWaitingWithExcerpt":"Waiting for reply: {excerpt}","promptWaiting":"Waiting for your reply","completionWithExcerpt":"Done: {excerpt}","completion":"Session complete"}}')},52277:(a,b,c)=>{"use strict";c.d(b,{ZS:()=>f,gb:()=>g});var d=c(24455);let e=globalThis.__autoYesPolicySuppressions??(globalThis.__autoYesPolicySuppressions=new Map);function f(a,b,c,g,h=Date.now()){e.set((0,d.v7)(a,b,c),{...g,at:h})}function g(a,b,c){return e.get((0,d.v7)(a,b,c))??null}},56263:(a,b,c)=>{"use strict";c.d(b,{L1:()=>e,MJ:()=>j,Rf:()=>f,ky:()=>g,lM:()=>i,pL:()=>h,wp:()=>d});let d=200,e=100,f=1e5,g="[... truncated ...]",h=3e4,i=/^[a-zA-Z0-9][a-zA-Z0-9\-._/:]*$/,j=128},61296:a=>{"use strict";a.exports=JSON.parse('{"title":"通知","description":"エージェントが応答待ちになったり、セッションが完了したときに、アプリを開いていなくてもプッシュ通知を受け取れます。","enable":"通知を有効にする","enabling":"有効化中…","enabledOnThisDevice":"この端末で通知が有効です。","unsubscribe":"この端末の通知を解除","types":{"heading":"通知する種別","promptWaiting":"応答待ち","promptWaitingDesc":"エージェントがあなたの応答を待っているとき","completion":"セッション完了","completionDesc":"エージェントがセッションを完了したとき"},"permission":{"denied":"ブラウザの設定で通知がブロックされています。このサイトの通知を許可してください。"},"unsupported":"このブラウザはプッシュ通知に対応していません。","notConfigured":"このサーバーではプッシュ通知が設定されていません。VAPID鍵を設定すると有効になります。","ios":{"guidance":"iPhone/iPadでは、このアプリをホーム画面に追加し、そこから開くと通知を有効にできます。"},"toast":{"enabled":"この端末で通知を有効にしました","disabled":"この端末の通知をオフにしました","error":"通知を有効にできませんでした","updated":"通知設定を更新しました"},"push":{"promptWaitingWithExcerpt":"応答待ち: {excerpt}","promptWaiting":"応答待ちです","completionWithExcerpt":"完了: {excerpt}","completion":"セッションが完了しました"}}')},63865:(a,b,c)=>{"use strict";function d(){let a=process.env.CM_VAPID_PUBLIC_KEY?.trim(),b=process.env.CM_VAPID_PRIVATE_KEY?.trim();return a&&b?{publicKey:a,privateKey:b,subject:process.env.CM_VAPID_SUBJECT?.trim()||"mailto:commandmate@localhost"}:null}function e(){return d()?.publicKey??null}c.d(b,{HR:()=>e,J$:()=>t});var f=c(48975),g=c.n(f),h=c(88807),i=c(43167),j=c(72626),k=c(25754),l=c(49358),m=c(61296),n=c(55511);let o=new Map,p=(0,j.h)("push/sender"),q={en:l.push,ja:m.push};function r(a){return(0,k.d9)(a)?a:k.Xn}async function s(a,b){try{await g().sendNotification({endpoint:a.endpoint,keys:a.keys},b)}catch(c){let b=c.statusCode;if(404===b||410===b){(0,i.th)((0,h.getDbInstance)(),a.endpoint),p.info("push-subscription-removed",{statusCode:b});return}p.warn("push-send-failed",{statusCode:b??"unknown"})}}async function t(a){try{let b=d();if(!b||!function(a,b=Date.now(),c=3e4){var d;let e=`${a.worktreeId}:${a.kind}`,f=(d=a.content??"",(0,n.createHash)("sha256").update(d).digest("hex")),g=o.get(e);return(!g||g.hash!==f||!(b-g.at<c))&&(o.set(e,{hash:f,at:b}),!0)}({worktreeId:a.worktreeId,kind:a.kind,content:a.excerpt}))return;let c=(0,h.getDbInstance)(),e=(0,i.gn)(c,a.kind);if(0===e.length)return;g().setVapidDetails(b.subject,b.publicKey,b.privateKey);let f=new Map;for(let a of e){let b=r(a.locale),c=f.get(b);c?c.push(a):f.set(b,[a])}await Promise.all(Array.from(f,([b,c])=>{let d=JSON.stringify(function(a,b=k.Xn,c=Date.now()){let d=function(a,b=120){if(!a)return"";let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:c.slice(0,b-1).trimEnd()+"…"}(a.excerpt),e=a.agentName?` (${a.agentName})`:"",f=`${a.worktreeName}${e}`,g=q[r(b)],h="prompt"===a.kind?d?g.promptWaitingWithExcerpt.replace("{excerpt}",d):g.promptWaiting:d?g.completionWithExcerpt.replace("{excerpt}",d):g.completion;return{kind:a.kind,title:f,body:h,worktreeId:a.worktreeId,url:`/worktrees/${a.worktreeId}`,tag:`${a.worktreeId}:${a.kind}`,timestamp:c}}(a,b));return Promise.all(c.map(a=>s(a,d)))}))}catch(a){p.warn("push-fanout-error",{error:a instanceof Error?a.message:String(a)})}}},63869:(a,b,c)=>{"use strict";c.d(b,{t:()=>j});var d=c(11665),e=c(81254),f=c(93997),g=c(20610);let h=/^\[[ x]\] /;function i(a){if(0===a)return[];let b=a>0?"Down":"Up";return Array.from({length:Math.abs(a)},()=>b)}async function j(a){let{sessionName:b,answer:c,cliToolId:j,promptData:k,fallbackPromptType:l,fallbackDefaultOptionNumber:m}=a;if(("claude"===j||"antigravity"===j)&&(k?.type==="multiple_choice"||"multiple_choice"===l)&&/^\d+$/.test(c)){let a,e=parseInt(c,10),f=null;if(k?.type==="multiple_choice"){let b=(f=k.options).find(a=>a.isDefault);a=b?.number??1}else a=m??1;let g=e-a;if(null!==f&&f.some(a=>h.test(a.label))&&null!==f){let a=f.filter(a=>h.test(a.label)).length,c=[...i(g),"Space"];c.push(...i(a-e+1)),c.push("Enter"),await (0,d.KB)(b,c)}else{let a=i(g),c=k?.type==="multiple_choice"&&!0===k.isAskUserQuestion&&0===g?["Down","Up","Enter"]:[...a,"Enter"];await (0,d.KB)(b,c)}}else{await (0,d.V1)(b,c,!1);let f=function(a){let b=(a.promptData?.type==="multiple_choice"?a.promptData.submitMode:void 0)??a.fallbackSubmitMode??"answer_then_enter";return(0,e.MI)(b)?b:"answer_then_enter"}(a);"answer_only"===f&&(a.promptData?.type==="multiple_choice"||"multiple_choice"===a.fallbackPromptType)&&/^\d+$/.test(a.answer)||(await new Promise(a=>setTimeout(a,g.pL)),await (0,d.V1)(b,"",!0))}(0,f.gm)(b)}},68652:(a,b,c)=>{"use strict";c.d(b,{N:()=>g});let d=/Esc\s+to\s+cancel\s*[·•]\s*Tab\s+to\s+amend/i,e=/Enter\s+to\s+select\b.*\bnavigate\b/i,f=/^\s*[>❯]\s*(?:\d{1,2}[.)])?|esc\s+to\s+interrupt|[✻✽✶✢✳⦿◉●⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]\s+.+…/i;function g(a){if(""===a)return"";let b=a.split("\n"),c=-1;for(let a=b.length-1;a>=0;a--){var g;if(g=b[a],d.test(g)||e.test(g)){c=a;break}}let h=b;return c>=0&&(h=b.slice(c+1).some(a=>f.test(a))?b.slice(c+1):b.slice(0,c+1)),(function(a){let b=[],c=!1;for(let d of a){let a=""===d.trim();a&&c||(b.push(d),c=a)}for(;b.length>0&&""===b[b.length-1].trim();)b.pop();return b})(h).join("\n")}},69297:(a,b,c)=>{"use strict";c.r(b),c.d(b,{WORKTREE_RENAMED_EVENT_TYPE:()=>V,__internal:()=>Z,broadcast:()=>S,broadcastMessage:()=>U,cleanupRooms:()=>X,closeWebSocket:()=>Y,handleProxyUpgrade:()=>H,hasRoomSubscribers:()=>T,migrateWorktreeRooms:()=>W,setupWebSocket:()=>I});var d=c(81503),e=c(91645),f=c(93390),g=c(3453),h=c(15194),i=c(31268),j=c(88807),k=c(56791);let l={capturePaneCalls:0,activeControlSessions:0,subscriberCount:0,cleanupCount:0,firstOutputLatencyCount:0,firstOutputLatencyTotalMs:0,firstOutputLatencyLastMs:null,firstOutputLatencyMinMs:null,firstOutputLatencyMaxMs:null};var m=c(11665),n=c(72626),o=c(79646);class p{push(a){if(0===a.length)return[];let b=(this.remainder+a).split("\n");this.remainder=b.pop()??"";let c=[];for(let a of b){let b=a.endsWith("\r")?a.slice(0,-1):a,d=this.parseLine(b);d&&c.push(d)}return c}flush(){if(0===this.remainder.length)return[];let a=this.parseLine(this.remainder);return this.remainder="",a?[a]:[]}parseLine(a){return 0===a.length?{type:"output",data:"\n"}:a.startsWith("%output ")?{type:"output",data:`${a.slice(8)}
|
|
20
|
+
`,await e().writeFile(f,j,"utf-8"),f}async function o(a,b="all"){let c="all"===b?[...k.XH]:[b],d=[];for(let b of c){await m(b);let c=l(b);try{let b=(await e().readdir(c)).filter(b=>b.startsWith(`${a}-`)&&b.endsWith(".md")).map(a=>g().join(c,a));d.push(...b)}catch{}}return d.sort().reverse()}(0,j.h)("log-manager")},41466:(a,b,c)=>{"use strict";c.d(b,{xT:()=>V,Ui:()=>W});var d=c(44265),e=c(11665),f=c(40236),g=c(93997),h=c(29021),i=c(33873),j=c(72626);let k=(0,j.h)("cli-tools/opencode-config"),l=/^[a-zA-Z0-9._:/-]{1,100}$/,m=/^[a-zA-Z0-9._:/@-]{1,200}$/;async function n(){let a={};try{let b=new AbortController,c=setTimeout(()=>b.abort(),3e3),d=await fetch("http://localhost:11434/api/tags",{signal:b.signal}).finally(()=>{clearTimeout(c)});if(!d.ok)return k.warn("ollama-api-returned"),{};let e=await d.text();if(e.length>1048576)return k.warn("ollama-api-response"),{};let f=JSON.parse(e);if(!f||!Array.isArray(f.models))return k.warn("invalid-ollama-api"),{};for(let b of f.models.slice(0,100))"string"==typeof b?.name&&l.test(b.name)&&(a[b.name]={name:function(a){let b=String(a.name),c=a.details;if(!c)return b;let d=[b];return"string"==typeof c.parameter_size&&/^[\d.]+[BKMGT]?B?$/i.test(c.parameter_size)&&d.push(c.parameter_size),"string"==typeof c.quantization_level&&/^[A-Z0-9_]{1,20}$/i.test(c.quantization_level)&&d.push(c.quantization_level),d.length>1?`${b} (${d.slice(1).join(", ")})`:b}(b)})}catch(a){a instanceof Error&&"AbortError"===a.name?k.warn("ollama-api-timeout"):k.warn("failed-to-fetch")}return a}async function o(){let a={};try{let b=new AbortController,c=setTimeout(()=>b.abort(),3e3),d=await fetch("http://localhost:1234/v1/models",{signal:b.signal}).finally(()=>{clearTimeout(c)});if(!d.ok)return k.warn("lm-studio-api"),{};let e=await d.text();if(e.length>1048576)return k.warn("lm-studio-api"),{};let f=JSON.parse(e);if(!f||!Array.isArray(f.data))return k.warn("invalid-lm-studio"),{};for(let b of f.data.slice(0,100))"string"==typeof b?.id&&m.test(b.id)&&(a[b.id]={name:b.id})}catch(a){a instanceof Error&&"AbortError"===a.name?k.warn("lm-studio-api"):k.warn("failed-to-fetch")}return a}async function p(a){let b=function(a){let b=i.resolve(a);try{if(!h.lstatSync(b).isDirectory())throw Error(`Path is not a directory: ${b}`)}catch(a){if("ENOENT"===a.code)throw Error(`Path does not exist: ${b}`);throw a}return h.realpathSync(b)}(a),c=i.join(b,"opencode.json");if(h.existsSync(c))return;let[d,e]=await Promise.all([n(),o()]),f={};if(Object.keys(d).length>0&&(f.ollama={npm:"@ai-sdk/openai-compatible",name:"Ollama (local)",options:{baseURL:"http://localhost:11434/v1"},models:d}),Object.keys(e).length>0&&(f.lmstudio={npm:"@ai-sdk/openai-compatible",name:"LM Studio (local)",options:{baseURL:"http://localhost:1234/v1"},models:e}),0!==Object.keys(f).length)try{h.writeFileSync(c,JSON.stringify({$schema:"https://opencode.ai/config.json",provider:f},null,2),{encoding:"utf-8",flag:"wx"})}catch(a){if("EEXIST"===a.code)return;k.warn("failed-to-write-opencodejson:error-insta")}}var q=c(79646),r=c(28354),s=c(4970),t=c(49791),u=c(62887),v=c(48083),w=c(36051),x=c(50474),y=c(57510),z=c(25071),A=c(1367),B=c(75356),C=c(98211),D=c(85322);let E=(0,j.h)("lib/hooks/sources/opencode/ingest");async function F(a,b,d){let e=(0,A.VM)(D.k),f=(0,C.Lu)(b.raw,b.receivedAt);if(!f)return void E.info("opencode-permission-unparsed",{worktreeId:a.worktreeId,instanceId:d});let{resolvePermissionRequest:g}=await c.e(3241).then(c.bind(c,43241)),h=e.parsePermissionRequest(b.raw),i=g({worktreeId:a.worktreeId,cliToolId:D.k,instanceId:d},h),j="allow"===i.behavior?{kind:"allowOnce"}:{kind:"abstain"};if("abstain"===j.kind){let b=(0,x.y_)(e);b.safe||E.warn("permission-request-abstain-blocks-agent",{worktreeId:a.worktreeId,cliToolId:D.k,instanceId:d,toolName:h?.toolName??null,decisionId:f.id,reason:i.reason,consequence:b.summary,blocksForMs:b.blocksForMs})}await (0,z._0)(e,{worktreeId:a.worktreeId,cliToolId:D.k,instanceId:d},f,j),E.info("opencode-permission-decided",{worktreeId:a.worktreeId,instanceId:d,decisionId:f.id,toolName:h?.toolName??null,behavior:i.behavior,reason:i.reason,suppressedBy:i.suppressedBy})}async function G(a,b){let[{getDbInstance:d},{getWorktreeById:e},{applyAgentStopEvent:f}]=await Promise.all([Promise.resolve().then(c.bind(c,88807)),Promise.resolve().then(c.bind(c,56791)),Promise.all([c.e(4689),c.e(6065),c.e(9373),c.e(6274),c.e(6781)]).then(c.bind(c,16781))]),g=d(),h=e(g,a.worktreeId)??null;if(!h)return void E.info("opencode-stop-unresolved-target",{worktreeId:a.worktreeId});let i=await f(g,h,D.k,b);E.info("opencode-stop-applied",{worktreeId:a.worktreeId,instanceId:b,taskId:i.taskId,taskEventApplied:i.taskEventApplied,verificationRunId:i.verificationRunId})}async function H(a,b){let c=a.instanceId??D.k;try{if((0,v.Fw)(a.worktreeId,D.k,c,b.event,b.conversationId,b.receivedAt,b.detail))return void E.info("opencode-event-duplicate-dropped",{worktreeId:a.worktreeId,instanceId:c,event:b.event,detail:b.detail});if((0,v.n4)(a.worktreeId,D.k,c,{event:b.event,at:b.receivedAt,detail:b.detail?.slice(0,u.h9)??null,sessionId:b.conversationId,message:(function(a){let b=(0,y.Qd)(a.raw.properties)?a.raw.properties:{};if(a.detail===B.aF)return(0,y.NZ)(b,["metadata","command"])??(0,y.O2)(b,"permission");if(a.detail===B.Tm){let a=b.questions;return Array.isArray(a)&&(0,y.Qd)(a[0])?(0,y.O2)(a[0],"question"):null}return a.detail===B.vE?(0,y.NZ)(b,["error","data","message"])??(0,y.NZ)(b,["error","name"]):null})(b)?.slice(0,w.lY)??null,model:b.model}),"notification"===b.event&&b.detail===B.aF)return void await F(a,b,c);if("notification"===b.event&&b.detail===B.Tm)return void function(a,b,c){let d=(0,A.VM)(D.k).parseQuestion(b.raw);d&&((0,v._N)(a.worktreeId,D.k,c,d,b.receivedAt),(0,v.ik)(a.worktreeId,D.k,c,"question",b.receivedAt),E.info("opencode-question-recorded",{worktreeId:a.worktreeId,instanceId:c,questionCount:d.questions.length,optionCounts:d.questions.map(a=>a.choices.length)}))}(a,b,c);if("stop"===b.event)return void await G(a,c);E.info("opencode-event-received",{worktreeId:a.worktreeId,instanceId:c,event:b.event,detail:b.detail})}catch(d){E.error("opencode-event-ingest-failed",{worktreeId:a.worktreeId,instanceId:c,event:b.event,error:d instanceof Error?d.message:String(d)})}}var I=c(84574),J=c(85965),K=c(42545);let L=(0,j.h)("lib/hooks/sources/opencode/runtime");function M(a,b){return{worktreeId:a,cliToolId:"opencode",instanceId:b}}async function N(a,b){try{return await (0,I.CU)(a,b)}catch(b){return L.warn("opencode-port-reserve-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)}),null}}async function O(a){try{let b=(0,I.hC)(a);if(null===b)return!1;if((0,K.wb)(a))return!0;let c=await (0,t.Ok)(b);if(!c)return L.info("opencode-server-not-reachable",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b}),!1;return await J.cC.subscribe(a,b=>{H(a,b)}),L.info("opencode-event-stream-attached",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,version:c.version}),!0}catch(b){return L.warn("opencode-event-stream-attach-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)}),!1}}async function P(a,b){try{if((0,K.wb)(a))return!0;let c=await (0,I.jp)(a,b);if(null===c)return!1;return await O(a)}catch(b){return L.warn("opencode-event-stream-resume-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)}),!1}}async function Q(a){try{await (0,K.FN)(a),(0,I.kE)(a)}catch(b){L.warn("opencode-event-stream-release-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)})}}var R=c(20610);let S=(0,j.h)("cli-tools/opencode"),T=(0,r.promisify)(q.execFile);function U(a){return a instanceof Error?a.message:String(a)}let V=200;class W extends d.M{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,e.N)(c)}async startSession(a,b,c){if(!await this.isInstalled())throw Error("OpenCode is not installed or not in PATH");let d=this.getSessionName(a,c),f=M(a,c);if(await (0,e.N)(d)){await this.reconcileExistingSession(d,{windowWidth:80,windowHeight:V}),await P(f,b),S.info("opencode-session-sessionname");return}(0,s.F)(f);try{await p(b),await (0,e.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,R.Uc));try{await T("tmux",["resize-window","-t",(0,e.lA)(d),"-x","80","-y",String(V)])}catch{}await N(f,b);let a=(0,s.c)(f,this.command).command;await (0,e.V1)(d,a,!0),await new Promise(a=>setTimeout(a,15e3)),await O(f),S.info("started-opencode-session:sessionname")}catch(b){let a=U(b);throw Error(`Failed to start OpenCode session: ${a}`)}}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,e.N)(d))throw Error(`OpenCode session ${d} does not exist. Start the session first.`);try{await (0,f.FW)({sessionName:d,message:b,cliToolId:"opencode"}),(0,g.gm)(d),S.info("sent-message-to-opencode-session:session")}catch(b){let a=U(b);throw Error(`Failed to send message to OpenCode: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);await Q(M(a,b));try{await (0,e.N)(c)?(await (0,e.V1)(c,"/exit",!0),await new Promise(a=>setTimeout(a,R.KI)),await (0,e.N)(c)&&await (0,e.fY)(c)):await (0,e.fY)(c),(0,g.gm)(c),S.info("stopped-opencode-session:sessionname")}catch(a){throw S.error("session:stop-failed",{error:U(a)}),a}}constructor(...a){super(...a),this.id="opencode",this.name="OpenCode",this.command="opencode"}}},44265:(a,b,c)=>{"use strict";c.d(b,{M:()=>k});var d=c(79646),e=c(28354),f=c(15194);let g=/^[a-zA-Z0-9_-]+$/;function h(a){if(!g.test(a))throw Error(`Invalid session name format: ${a}`)}var i=c(11665);let j=(0,e.promisify)(d.exec);class k{async isInstalled(){try{return await j(`which ${this.command}`,{timeout:5e3}),!0}catch{return!1}}getSessionName(a,b){let c=`mcbd-${this.id}-${a}`;if(!b||b===this.id)return h(c),c;let d=(0,f.pL)(b,this.id),e=d?`${c}-${d}`:c;return h(e),e}async reconcileExistingSession(a,b){await (0,i.zT)(a,b)}async interrupt(a,b){let c=this.getSessionName(a,b);await (0,i.ds)(c,"Escape")}}},45146:(a,b,c)=>{"use strict";c.d(b,{Et:()=>r,KQ:()=>t,MN:()=>n,SI:()=>k,fq:()=>s,g8:()=>o,sR:()=>u});var d=c(72626),e=c(13033),f=c(72457),g=c(71080),h=c(3523),i=c(99508);let j=(0,d.h)("response-poller"),k=["Waiting for auth","⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],l=new Map,m=new Map;function n(a,b,c){return`${a}:${c??b}`}function o(a,b,c){let d=n(a,b,c);r(a,b,c),m.set(d,Date.now()),("opencode"===b||"copilot"===b)&&(0,e.tb)(d),p(a,b,c)}function p(a,b,c){let d=n(a,b,c),e=setTimeout(async()=>{let e=m.get(d);if(e&&Date.now()-e>18e5)return void r(a,b,c);try{await (0,h.zX)(a,b,c)}catch(a){j.error("error:",{error:a instanceof Error?a.message:String(a)})}(0,i.broadcastTerminalSnapshot)(a,b,c),l.has(d)&&p(a,b,c)},2e3);l.set(d,e)}function q(a){let b=l.get(a);b&&(clearTimeout(b),l.delete(a),m.delete(a)),(0,e.q1)(a),(0,f.iX)(a),(0,g.L1)(a)}function r(a,b,c){q(n(a,b,c))}function s(){for(let a of Array.from(l.keys()))q(a)}function t(){return Array.from(l.keys())}function u(a,b){let c=new Map;for(let{oldId:b,newId:d}of a)b&&d&&b!==d&&c.set(b,d);if(0===c.size)return[];let d=[],h=[];for(let a of Array.from(l.keys())){let e=function(a){let b=a.indexOf(":");return b<=0||b===a.length-1?null:{worktreeId:a.slice(0,b),instanceId:a.slice(b+1)}}(a);if(!e)continue;let f=c.get(e.worktreeId);if(!f)continue;let g=b(e.worktreeId,e.instanceId);if(!g){h.push(a);continue}d.push({oldKey:a,newKey:n(f,g,e.instanceId),newWorktreeId:f,cliToolId:g,instanceId:e.instanceId})}let i=new Map;for(let a of d){let b=l.get(a.oldKey);b&&clearTimeout(b),l.delete(a.oldKey),i.set(a.newKey,{startedAt:m.get(a.oldKey)}),m.delete(a.oldKey),(0,f.i2)(a.oldKey,a.newKey),(0,g.Re)(a.oldKey,a.newKey),(0,e.q1)(a.oldKey)}for(let a of h)q(a),j.warn("poller:migrate-abandoned",{pollerKey:a});for(let a of d){let b=i.get(a.newKey)?.startedAt;m.set(a.newKey,b??Date.now()),("opencode"===a.cliToolId||"copilot"===a.cliToolId)&&(0,e.tb)(a.newKey),p(a.newWorktreeId,a.cliToolId,a.instanceId)}return d}},47990:()=>{},52277:(a,b,c)=>{"use strict";c.d(b,{ZS:()=>f,gb:()=>g});var d=c(24455);let e=globalThis.__autoYesPolicySuppressions??(globalThis.__autoYesPolicySuppressions=new Map);function f(a,b,c,g,h=Date.now()){e.set((0,d.v7)(a,b,c),{...g,at:h})}function g(a,b,c){return e.get((0,d.v7)(a,b,c))??null}},56263:(a,b,c)=>{"use strict";c.d(b,{L1:()=>e,MJ:()=>j,Rf:()=>f,ky:()=>g,lM:()=>i,pL:()=>h,wp:()=>d});let d=200,e=100,f=1e5,g="[... truncated ...]",h=3e4,i=/^[a-zA-Z0-9][a-zA-Z0-9\-._/:]*$/,j=128},57905:(a,b,c)=>{"use strict";c.d(b,{c0:()=>N,zw:()=>J,Yq:()=>K,oV:()=>G,pU:()=>M,R7:()=>L,VU:()=>O});var d=c(11665),e=c(85164),f=c(40236),g=c(93997),h=c(77093),i=c(20610),j=c(79646),k=c(28354),l=c(72626);let m=(0,l.h)("session-key-sender"),n=(0,k.promisify)(j.exec);async function o(a,b=50){let c=await (0,d.Xg)(a,{startLine:-b});return(0,e.aJ)(c)}async function p(a){await n("tmux set-environment -g -u CLAUDECODE 2>/dev/null || true"),await (0,d.V1)(a,"unset CLAUDECODE",!0),await new Promise(a=>setTimeout(a,i.Em))}async function q(a,b){let c=Date.now();for(;Date.now()-c<b;){let b=await o(a);if(e.hx.test(b))return;await new Promise(a=>setTimeout(a,200))}throw Error(`Prompt detection timeout (${b}ms)`)}async function r(a,b,c,h){if(!await (0,d.N)(a))throw Error(`Claude session ${a} does not exist. Start the session first.`);let i=await o(a);e.hx.test(i)||await q(a,h),await new Promise(a=>setTimeout(a,c)),await (0,f.FW)({sessionName:a,message:b,cliToolId:"claude"}),(0,g.gm)(a),m.info("sent-message-to-session",{sessionName:a})}async function s(a){try{await (0,d.N)(a)&&(await (0,d.V1)(a,"",!1),await (0,d.ds)(a,"C-d"),(0,g.gm)(a),await new Promise(a=>setTimeout(a,i.Zf)));let b=await (0,d.fY)(a);return b&&m.info("stopped-session",{sessionName:a}),b}catch(a){return m.error("session:stop-failed",{error:(0,h.u1)(a)}),!1}}var t=c(79748),u=c(15194),v=c(22354),w=c(4970),x=c(48083),y=c(2669);let z=(0,l.h)("claude-session"),A=(0,k.promisify)(j.exec),B=["$","%","#"],C=null;async function D(){if(C)return C;let a=process.env.CLAUDE_PATH;if(a&&(/^[/a-zA-Z0-9._-]+$/.test(a)?!a.includes("..")||(z.info("claudepath-contains-path"),!1):(z.info("claudepath-contains-invalid-characters-i"),!1)))try{return await (0,t.access)(a,t.constants.X_OK),C=a}catch{z.info("claudepath-is-not-executable:envclaudepa")}try{let{stdout:a}=await A("which claude",{timeout:5e3});return C=a.trim()}catch{for(let a of["/opt/homebrew/bin/claude","/usr/local/bin/claude","/usr/bin/claude"])try{return await A(`test -x "${a}"`,{timeout:1e3}),C=a}catch{}throw Error("Claude CLI not found. Set CLAUDE_PATH environment variable or install Claude CLI.")}}async function E(a,b=50){let c=await (0,d.Xg)(a,{startLine:-b});return(0,e.aJ)(c)}function F(a){let b=a.trim().split("\n").filter(a=>""!==a.trim()).slice(-10).join("\n");for(let a of e.F0)if(b.includes(a))return a;for(let a of e.Fw)if(a.test(b))return a.source;return null}async function G(a){try{let b=(await E(a)).trim();if(""===b)return{healthy:!1,reason:"empty output"};if(e.hx.test(b))return{healthy:!0};let c=b.split("\n").filter(a=>""!==a.trim()),d=F(b);if(null!==d)return{healthy:!1,reason:`error pattern: ${d}`};let f=c[c.length-1]?.trim()??"";if(f.length>=40)return{healthy:!0};if(B.some(a=>!(!f.endsWith(a)||"%"===a&&/\d+%$/.test(f))))return{healthy:!1,reason:`shell prompt ending detected: ${f}`};return{healthy:!0}}catch{return{healthy:!1,reason:"capture error"}}}async function H(a){return!!(await G(a)).healthy||(z.warn("session-sessionname-unhealthy:resultreas"),await (0,d.fY)(a),!1)}function I(a,b){let c=`mcbd-claude-${a}`;if(!b||"claude"===b)return c;let d=(0,u.pL)(b,"claude");return d?`${c}-${d}`:c}async function J(){try{return await A("which claude",{timeout:5e3}),!0}catch{return!1}}async function K(a,b){let c=I(a,b);return!!await (0,d.N)(c)&&(!!(await G(c)).healthy||(z.warn("session-sessionname-unhealthy:resultreas"),!1))}async function L(a){let{worktreeId:b,worktreePath:c,instanceId:f}=a;if(!await J())throw Error("Claude CLI is not installed or not in PATH");let g=I(b,f);if(await (0,d.N)(g)&&await H(g)){await (0,d.zT)(g),z.info("claude-session-sessionname");return}(0,w.F)({worktreeId:b,cliToolId:v.vm,instanceId:f});try{await (0,d.jw)({sessionName:g,workingDirectory:c}),await p(g);let a=await D(),h=(0,w.c)({worktreeId:b,cliToolId:v.vm,instanceId:f},a).command;await (0,d.V1)(g,h,!0);let i=Date.now(),j=!1,k=!1;for(;Date.now()-i<6e4;){await new Promise(a=>setTimeout(a,300));let a=null;try{a=await E(g)}catch{}if(null===a)continue;if(e.hx.test(a)){await new Promise(a=>setTimeout(a,500)),z.info("claude-initialized-in"),j=!0;break}if(!k&&e.CX.test(a))try{await (0,d.V1)(g,"",!0),k=!0,z.info("trust-dialog-detected")}catch{}let b=F(a);if(null!==b)throw new y.mR("Claude Code",g,b)}if(!j)throw new y.Sr("Claude Code",g,6e4);z.info("started-claude-session:sessionname")}catch(a){if(C=null,z.error("session:start-failed",{error:a instanceof Error?a.message:String(a)}),(0,y.su)(a))throw a;throw Error("Failed to start Claude session")}}async function M(a,b,c){let d=I(a,c);await r(d,b,500,1e4)}async function N(a,b=1e3,c){let e=I(a,c);if(!await (0,d.N)(e))throw Error(`Claude session ${e} does not exist`);try{return await (0,d.Xg)(e,{startLine:-b})}catch(a){throw Error(`Failed to capture Claude output: ${a instanceof Error?a.message:String(a)}`)}}async function O(a,b){let c=I(a,b),d=await s(c);return(0,x.je)(a,"claude",b),d}},63869:(a,b,c)=>{"use strict";c.d(b,{t:()=>j});var d=c(11665),e=c(81254),f=c(93997),g=c(20610);let h=/^\[[ x]\] /;function i(a){if(0===a)return[];let b=a>0?"Down":"Up";return Array.from({length:Math.abs(a)},()=>b)}async function j(a){let{sessionName:b,answer:c,cliToolId:j,promptData:k,fallbackPromptType:l,fallbackDefaultOptionNumber:m}=a;if(("claude"===j||"antigravity"===j)&&(k?.type==="multiple_choice"||"multiple_choice"===l)&&/^\d+$/.test(c)){let a,e=parseInt(c,10),f=null;if(k?.type==="multiple_choice"){let b=(f=k.options).find(a=>a.isDefault);a=b?.number??1}else a=m??1;let g=e-a;if(null!==f&&f.some(a=>h.test(a.label))&&null!==f){let a=f.filter(a=>h.test(a.label)).length,c=[...i(g),"Space"];c.push(...i(a-e+1)),c.push("Enter"),await (0,d.KB)(b,c)}else{let a=i(g),c=k?.type==="multiple_choice"&&!0===k.isAskUserQuestion&&0===g?["Down","Up","Enter"]:[...a,"Enter"];await (0,d.KB)(b,c)}}else{await (0,d.V1)(b,c,!1);let f=function(a){let b=(a.promptData?.type==="multiple_choice"?a.promptData.submitMode:void 0)??a.fallbackSubmitMode??"answer_then_enter";return(0,e.MI)(b)?b:"answer_then_enter"}(a);"answer_only"===f&&(a.promptData?.type==="multiple_choice"||"multiple_choice"===a.fallbackPromptType)&&/^\d+$/.test(a.answer)||(await new Promise(a=>setTimeout(a,g.pL)),await (0,d.V1)(b,"",!0))}(0,f.gm)(b)}},68652:(a,b,c)=>{"use strict";c.d(b,{N:()=>g});let d=/Esc\s+to\s+cancel\s*[·•]\s*Tab\s+to\s+amend/i,e=/Enter\s+to\s+select\b.*\bnavigate\b/i,f=/^\s*[>❯]\s*(?:\d{1,2}[.)])?|esc\s+to\s+interrupt|[✻✽✶✢✳⦿◉●⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]\s+.+…/i;function g(a){if(""===a)return"";let b=a.split("\n"),c=-1;for(let a=b.length-1;a>=0;a--){var g;if(g=b[a],d.test(g)||e.test(g)){c=a;break}}let h=b;return c>=0&&(h=b.slice(c+1).some(a=>f.test(a))?b.slice(c+1):b.slice(0,c+1)),(function(a){let b=[],c=!1;for(let d of a){let a=""===d.trim();a&&c||(b.push(d),c=a)}for(;b.length>0&&""===b[b.length-1].trim();)b.pop();return b})(h).join("\n")}},71080:(a,b,c)=>{"use strict";c.d(b,{L1:()=>g,Re:()=>h,j7:()=>f});var d=c(55511);let e=new Map;function f(a,b){let c=(0,d.createHash)("sha256").update(b).digest("hex");return e.get(a)===c||(e.set(a,c),!1)}function g(a){e.delete(a)}function h(a,b){if(a===b)return;let c=e.get(a);e.delete(a),void 0!==c&&e.set(b,c)}},72457:(a,b,c)=>{"use strict";c.d(b,{gv:()=>f,i2:()=>h,iX:()=>g,zm:()=>i});var d=c(55511);let e=new Map;function f(a,b){let c=(0,d.createHash)("sha256").update(b).digest("hex");return e.get(a)===c||(e.set(a,c),!1)}function g(a){e.delete(a)}function h(a,b){if(a===b)return;let c=e.get(a);e.delete(a),void 0!==c&&e.set(b,c)}function i(a,b){return"copilot"!==b?a:a.replace(/^[❯>]\s/gm," ")}},75498:(a,b,c)=>{"use strict";c.d(b,{Lj:()=>f,Tb:()=>e,sD:()=>g});var d=c(68901);let e=2e4;function f(a,b,c){if(!c)return null;if("off"===c.mode)return{reason:"mode-off"};let f=function(a,b){if(0===b.length)return{outcome:"no-match"};let c=a.map(a=>a.length>e?a.slice(0,e):a);for(let a of b){if(a.length>200||!(0,d.P0)(a).valid)return{outcome:"unusable",pattern:a};let b=new RegExp(a);for(let e of c){let c=(0,d.eJ)(b,e);if(null===c)return{outcome:"unusable",pattern:a};if(c)return{outcome:"match",pattern:a}}}return{outcome:"no-match"}}(b,c.denyPatterns);return"match"===f.outcome?{reason:"deny-pattern",pattern:f.pattern}:"unusable"===f.outcome?{reason:"deny-pattern-unusable",pattern:f.pattern}:"safe"===c.mode?"yes_no"===a?null:{reason:"type-not-allowed"}:"allow-listed"===c.mode?c.allowPromptTypes.includes(a)?null:{reason:"type-not-allowed"}:null}function g(a,b){let c=function(a){if("yes_no"===a.type)return"y";if("multiple_choice"===a.type){let b=a.options.find(a=>a.isDefault)??a.options[0];return!b||b.requiresTextInput?null:b.number.toString()}return null}(a);if(null===c)return{answer:null,suppressedBy:null};let d=f(a.type,function(a){let b=[a.question];if(a.approvalTarget&&b.push(a.approvalTarget),"multiple_choice"===a.type)for(let c of a.options)b.push(c.label);else b.push(...a.options);return b}(a),b);return d?{answer:null,suppressedBy:d.reason,pattern:d.pattern}:{answer:c,suppressedBy:null}}},77093:(a,b,c)=>{"use strict";function d(a){return a instanceof Error?a.message:String(a)}c.d(b,{u1:()=>d})},82450:(a,b,c)=>{"use strict";c.d(b,{IS:()=>h,LH:()=>m,NN:()=>g,Sj:()=>o,aW:()=>n});var d=c(85164),e=c(13033),f=c(56263);function g(a){let b=(0,d.aJ)(a).split("\n"),c=(0,d.GT)(b),e=c>=0?b.slice(0,c):b,f=-1;for(let a=e.length-1;a>=0;a--)if(/^❯\s+\S/.test(e[a])){f=a;break}let g=f>=0?f+1:0,h=e.slice(g),i=[/CLAUDE_HOOKS_/,/\/bin\/claude/,/^claude\s*$/,/@.*\s+%\s*$/,/^[^⏺]*curl.*POST/,/^[^⏺]*Content-Type/,/^[^⏺]*export\s+CLAUDE_/,/^\s*$/,/^[╭╮╰╯│─\s]+$/,/^[│╭╮╰╯].*[│╭╮╰╯]$/,/Claude Code v[\d.]+/,/^Tips for getting started/,/^Welcome back/,/Run \/init to create/,/^Recent activity/,/^No recent activity/,/▐▛███▜▌|▝▜█████▛▘|▘▘ ▝▝/,/^\s*Opus \d+\.\d+\s*·\s*Claude Max/,/\.com's Organization/,/\?\s*for shortcuts\s*$/,/^─{10,}$/,/^❯\s*$/,d.fW],j=[];for(let a of h)!i.some(b=>b.test(a))&&a.trim()&&j.push(a);return j.join("\n").trim()}function h(a){let b=(0,d.aJ)(a).split("\n"),c=[],e=[/^maenokota@.*%/,/^zsh:/,/^feature-issue-\d+/,/^\s*$/],f=!1,g=[];for(let a of b){if(a.includes("✦")){f=!0;let b=a.indexOf("✦"),c=a.substring(b+1).trim();c&&g.push(c);continue}if(f){if(e.some(b=>b.test(a)))continue;g.push(a)}}if(g.length>0)return g.join("\n").trim();for(let a of b)e.some(b=>b.test(a))||c.push(a);return c.join("\n").trim()}let i=/^●\s+(?:Get |Read |Run |Search |Write |Delete |Edit |List |Create |Check |Fetch |Map |Explore |Execute |Find |Install |Update |Open |Close |Copy |Move |Rename |Set |Test |Build |Deploy |Start |Stop |Restart |Kill |Call |Send |Upload |Download |Compile |Analyze |Scan |Apply |Revert |Reset |Push |Pull |Clone |Merge |Commit |Checkout |Branch |Tag |Diff |Log |Show |Status |Init |Config |Add |Remove |Index |Query |Connect |Disconnect |Ping |Trace |Debug |Validate |Verify |Inspect |Monitor |Watch |Clean |Purge |Flush |Load |Save |Export |Import |Format |Lint |Parse |Generate |Transform |Convert |Migrate |Upgrade |Patch |Enable |Disable |Grant |Revoke |Approve |Deny |Lock |Unlock |Mount |Unmount |Attach |Detach |Register |Unregister |Subscribe |Unsubscribe |Publish |Unpublish |Encrypt |Decrypt |Sign |Hash |Encode |Decode |Compress |Decompress |Archive |Extract |Backup |Restore |Dump |Model changed to:)/,j=/^\d+\s+lines\.\.\.$/,k=/^[◐◑◒◓]/,l=/^(?:git\s+--no-pager|git\s+(?:log|diff|show|status|branch|remote|fetch|pull|push|merge|rebase|checkout|reset|stash|tag|config|clone|init|add|commit|rm|mv|bisect|grep|ls-files|rev-parse|describe|shortlog|blame|reflog|cherry-pick|revert|submodule|worktree)\b|npm\s+|npx\s+|node\s+|yarn\s+|pnpm\s+|cargo\s+|pip\s+|python\s+|ruby\s+|go\s+|rustc\s+|make\s+|cmake\s+|docker\s+|kubectl\s+|aws\s+|gcloud\s+|az\s+|terraform\s+|ansible\s+|curl\s+|wget\s+|ssh\s+|scp\s+|rsync\s+|find\s+|grep\s+|sed\s+|awk\s+|cat\s+|ls\s+|cd\s+|mkdir\s+|rm\s+|cp\s+|mv\s+|chmod\s+|chown\s+|echo\s+)/;function m(a){let b=(0,d.aJ)(a).split("\n"),c=-1;for(let a=b.length-1;a>=0;a--){let d=(0,e.IW)(b[a]);if(d&&/^❯\s+\S/.test(d)){c=a;break}}let f=c>=0?c+1:0,g=b.slice(f),h=[],m=!1,n=!1;for(let a of g){let b=(0,e.IW)(a);if(!(!b||d.J7.some(a=>a.test(b)))){if(i.test(b)){n=!0,m=!1;continue}if(k.test(b)){m=!0,n=!1;continue}if(!(j.test(b)||l.test(b)||/^❯\s*/.test(b)||/^[│└]/.test(b))){if(/^●/.test(b)){m=!1,n=!1,h.push(b.replace(/^●\s*/,""));continue}m||n||h.push(b)}}}return h.join("\n").trim()}function n(a){let b=a.split("\n"),c=[];for(let a=0;a<b.length;a++){let f=(0,e.l1)(b[a]);f&&d.Md.test(f)&&c.push(a)}let f=0;c.length>=2&&(f=c[c.length-2]+1);let g=[];for(let a=f;a<b.length;a++){let c=(0,e.l1)(b[a]);!(!c||d.sx.some(a=>a.test(c)))&&(d.Md.test(c)||g.push(c))}return g.join("\n").trim()}function o(a,b=f.Rf,c=f.ky){if(!a||a.length<=b)return a;let d=c+"\n",e=b-d.length;if(e<=0)return c.slice(0,b);let g=a.length-e;if(g>0&&g<a.length){let b=a.charCodeAt(g);b>=56320&&b<=57343&&(g+=1)}return d+a.slice(g)}},90164:(a,b,c)=>{"use strict";c.d(b,{Dk:()=>e,kD:()=>f});let d="https://github.com/Kewton/CommandMate",e=`${d}/releases/`,f=`${d}/blob/main/docs/security-guide.md`},91318:(a,b,c)=>{"use strict";c.d(b,{ie:()=>j,n:()=>i});var d=c(56791),e=c(88807),f=c(24455);let g=(0,c(72626).h)("auto-yes-policy"),h=new Map;function i(a,b,c){let i=c??b,j=(0,f.v7)(a,b,i),k=Date.now(),l=h.get(j);if(l&&l.expiresAt>k)return l.policy;let m=function(a,b,c){try{let f=(0,d.getActiveTaskForInstance)((0,e.getDbInstance)(),a,b,c);if(!f)return null;return f.contract.autoYes}catch(d){return g.warn("policy-lookup-failed",{worktreeId:a,cliToolId:b,instanceId:c,error:d instanceof Error?d.message:String(d)}),null}}(a,b,i);return h.size>=200&&function(a){for(let[b,c]of h.entries())c.expiresAt<=a&&h.delete(b)}(k),h.set(j,{policy:m,expiresAt:k+5e3}),m}function j(a){h.delete(a)}},93997:(a,b,c)=>{"use strict";c.d(b,{aq:()=>m,gm:()=>k,pc:()=>l,sl:()=>f,vF:()=>j,wd:()=>i,xE:()=>e});let d=(0,c(72626).h)("tmux-capture-cache"),e=1e4;function f(a,b=e){return b>0&&a>=b}function g(){return globalThis.__tmuxCaptureCache??=new Map}function h(){return globalThis.__tmuxCaptureCacheInflight??=new Map}function i(a,b){if(""===a)return"";let c=a.split("\n");return b>=c.length?a:c.slice(-b).join("\n")}function j(a,b,c){let d=g(),e=Date.now();for(let[a,b]of d)e-b.timestamp>5e3&&d.delete(a);if(d.size>=100&&!d.has(a)){let a=null,b=1/0;for(let[c,e]of d)e.timestamp<b&&(b=e.timestamp,a=c);a&&d.delete(a)}d.set(a,{output:b,capturedLines:c,timestamp:e})}function k(a){g().delete(a),d.debug("cache:invalidate",{sessionName:a})}function l(){g().clear(),h().clear()}async function m(a,b,c){let d=function(a,b){let c=g(),d=c.get(a);return d?Date.now()-d.timestamp>5e3?(c.delete(a),null):b>d.capturedLines?null:i(d.output,b):null}(a,b);if(null!==d)return d;let f=h(),k=f.get(a);if(k)return i(await k,b);let l=c();f.set(a,l);try{let c=await l;return c.length>0&&j(a,c,e),i(c,b)}finally{f.delete(a)}}},95220:(a,b,c)=>{"use strict";c.r(b),c.d(b,{accumulateTuiContent:()=>g.IZ,cleanClaudeResponse:()=>f.NN,cleanCopilotResponse:()=>f.LH,cleanGeminiResponse:()=>f.IS,cleanOpenCodeResponse:()=>f.aW,clearPromptHashCache:()=>h.iX,clearTuiAccumulator:()=>g.q1,extractCopilotContentLines:()=>g.o0,extractTuiContentLines:()=>g.K0,findOverlapIndex:()=>g.vQ,getAccumulatedContent:()=>g.Uz,getActivePollers:()=>d.KQ,initTuiAccumulator:()=>g.tb,isDuplicatePrompt:()=>h.gv,isOpenCodeComplete:()=>e.b,migrateResponsePollerWorktreeIds:()=>d.sR,normalizeCopilotLine:()=>g.IW,normalizePromptForDedup:()=>h.zm,renamePromptHashCacheKey:()=>h.i2,resolveExtractionStartIndex:()=>e.Q,startPolling:()=>d.g8,stopAllPolling:()=>d.fq,stopPolling:()=>d.Et,truncateMessage:()=>f.Sj});var d=c(45146),e=c(60),f=c(82450),g=c(13033),h=c(72457)},95595:(a,b,c)=>{"use strict";c.d(b,{WC:()=>m,gv:()=>h,ug:()=>i});var d=c(85164),e=c(25129),f=c(68652),g=c(46423);let h={PROMPT_DETECTED:"prompt_detected",THINKING_INDICATOR:"thinking_indicator",OPENCODE_PROCESSING_INDICATOR:"opencode_processing_indicator",OPENCODE_SELECTION_LIST:"opencode_selection_list",CLAUDE_SELECTION_LIST:"claude_selection_list",COPILOT_SELECTION_LIST:"copilot_selection_list",CODEX_SELECTION_LIST:"codex_selection_list",CODEX_PAGER:"codex_pager",ANTIGRAVITY_SELECTION_LIST:"antigravity_selection_list",OPENCODE_RESPONSE_COMPLETE:"opencode_response_complete",INPUT_PROMPT:"input_prompt",NO_RECENT_OUTPUT:"no_recent_output",DEFAULT:"default"},i=new Set([h.OPENCODE_SELECTION_LIST,h.CLAUDE_SELECTION_LIST,h.COPILOT_SELECTION_LIST,h.CODEX_SELECTION_LIST,h.CODEX_PAGER,h.ANTIGRAVITY_SELECTION_LIST]),j=/press\s+(?:number|enter)\s+to\s+confirm/i,k=/^\s*[❯›●]?\s*\d{1,2}[.)]\s/;function l(a){let b=-1;for(let c=a.length-1;c>=Math.max(0,a.length-10);c--)if(d.aW.test(a[c])){b=c;break}let c=b>=0?b:a.length,e=-1,f=-1;for(let b=0;b<c;b++){let c=a[b],g=c.trim();""!==g&&((j.test(g)||k.test(g))&&(e=b),(0,d.ut)("codex",c)&&(f=b))}return e>=0&&f>e}function m(a,b,c){let i=(0,f.N)((0,d.aJ)(a)),j=i.split("\n"),k=j.length-1;for(;k>=0&&""===j[k].trim();)k--;let m=j.slice(0,k+1),n=m.slice(-15).join("\n"),o=m.slice(-g.$).join("\n"),p=m.slice(-30).join("\n");if("copilot"===b&&d.Mi.test(p)){let a=(0,d.KO)(b),c=(0,e.gF)((0,d._A)(i),a);return c.isPrompt&&(c.promptData?.options?.length??0)<=3?{status:"waiting",confidence:"high",reason:"prompt_detected",hasActivePrompt:!0,promptDetection:c}:{status:"waiting",confidence:"high",reason:h.COPILOT_SELECTION_LIST,hasActivePrompt:!1,promptDetection:c}}let q=m.slice(-15).join("\n");if("copilot"===b&&(0,d.ut)(b,q)){let a=(0,d.KO)(b);return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:(0,e.gF)((0,d._A)(i),a)}}if("codex"===b&&d.pn.test(n)){let a=(0,d.KO)(b),c=(0,e.gF)((0,d._A)(i),a);return{status:"waiting",confidence:"high",reason:h.CODEX_PAGER,hasActivePrompt:!1,promptDetection:c}}if("codex"===b){let a=-1;for(let b=m.length-1;b>=Math.max(0,m.length-10);b--)if(d.aW.test(m[b])){a=b;break}let c=a>=0?a-1:m.length-1;for(;c>=0&&""===m[c].trim();)c--;if(c>=0){let a=m.slice(Math.max(0,c-15+1),c+1).join("\n");if(d.Jn.test(a)){let c=(0,d.KO)(b),f=(0,e.gF)((0,d._A)(i),c);return f.isPrompt&&((f.promptData?.question?.trim()??"").endsWith("?")||d.Dd.test(a))&&!l(m)?{status:"waiting",confidence:"high",reason:h.PROMPT_DETECTED,hasActivePrompt:!0,promptDetection:f}:{status:"waiting",confidence:"high",reason:h.CODEX_SELECTION_LIST,hasActivePrompt:!1,promptDetection:f}}}}if("antigravity"===b&&d.kT.test(n)){let a=(0,d.KO)(b),c=(0,e.gF)((0,d._A)(i),a);return{status:"waiting",confidence:"high",reason:h.ANTIGRAVITY_SELECTION_LIST,hasActivePrompt:!1,promptDetection:c}}let r=(0,d.KO)(b),s="opencode"===b||"codex"===b||"claude"===b||"copilot"===b?(0,d._A)(i):(0,d._A)(n),t=(0,e.gF)(s,r);if(t.isPrompt)if(!("codex"===b&&l(m)))return{status:"waiting",confidence:"high",reason:"prompt_detected",hasActivePrompt:!0,promptDetection:t};else t={...t,isPrompt:!1,promptData:void 0};if("claude"===b&&d.XY.test(n))return{status:"waiting",confidence:"high",reason:h.CLAUDE_SELECTION_LIST,hasActivePrompt:!1,promptDetection:t};if((0,d.ut)(b,o))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:t};if("claude"===b&&d.aU.test(n))return{status:"running",confidence:"high",reason:h.THINKING_INDICATOR,hasActivePrompt:!1,promptDetection:t};if("opencode"===b){if(d.kD.test(n))return{status:"running",confidence:"high",reason:"opencode_processing_indicator",hasActivePrompt:!1,promptDetection:t};let a=(0,d._A)(i).split("\n"),b=Math.max(0,a.length-7);for(let c=a.length-1;c>=Math.max(0,a.length-10);c--)if(/ctrl\+[tp]/.test(a[c])){b=Math.max(0,c-2);break}let c=a.slice(0,b),e=c.length-1;for(;e>=0&&""===c[e].trim();)e--;if(e>=0){let a=c.slice(Math.max(0,e-g.$+1),e+1).join("\n");if((0,d.ut)("opencode",a))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:t};let b=c.slice(Math.max(0,e-15+1),e+1).join("\n"),f=c.join("\n");if(d.LO.test(f))return{status:"waiting",confidence:"high",reason:h.OPENCODE_SELECTION_LIST,hasActivePrompt:!1,promptDetection:t};if(d.Md.test(b))return{status:"ready",confidence:"high",reason:h.OPENCODE_RESPONSE_COMPLETE,hasActivePrompt:!1,promptDetection:t};let{promptPattern:i}=(0,d._X)("opencode");if(i.test(b))return{status:"ready",confidence:"high",reason:h.PROMPT_DETECTED,hasActivePrompt:!0,promptDetection:t}}}if("codex"===b){let a=-1;for(let b=m.length-1;b>=Math.max(0,m.length-10);b--)if(d.aW.test(m[b])){a=b;break}if(a>=0){let b=a-1;for(;b>=0&&""===m[b].trim();)b--;if(b>=0){let a=m.slice(Math.max(0,b-g.$+1),b+1).join("\n");if((0,d.ut)("codex",a))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:t};let c=m[b].trim();return d.gm.test(c)?{status:"ready",confidence:"high",reason:"input_prompt",hasActivePrompt:!1,promptDetection:t}:{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:t}}}else{let a=m.length-1;for(;a>=0&&""===m[a].trim();)a--;if(!(a>=0&&d.gm.test(m[a].trim()))&&(0,d.ut)("codex",n))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:t}}}if("antigravity"===b){if((0,d.ut)("antigravity",n))return{status:"running",confidence:"high",reason:h.THINKING_INDICATOR,hasActivePrompt:!1,promptDetection:t};let{promptPattern:a}=(0,d._X)("antigravity");if(a.test(n))return{status:"ready",confidence:"high",reason:h.INPUT_PROMPT,hasActivePrompt:!1,promptDetection:t}}let{promptPattern:u}=(0,d._X)(b);return u.test(n)?{status:"ready",confidence:"high",reason:"input_prompt",hasActivePrompt:!1,promptDetection:t}:c&&Date.now()-c.getTime()>5e3?{status:"ready",confidence:"low",reason:"no_recent_output",hasActivePrompt:!1,promptDetection:t}:{status:"running",confidence:"low",reason:"default",hasActivePrompt:!1,promptDetection:t}}},95620:(a,b,c)=>{"use strict";c.r(b),c.d(b,{WORKTREE_RENAMED_EVENT_TYPE:()=>X,__internal:()=>_,broadcast:()=>U,broadcastMessage:()=>W,cleanupRooms:()=>Z,closeWebSocket:()=>$,handleProxyUpgrade:()=>J,hasRoomSubscribers:()=>V,migrateWorktreeRooms:()=>Y,setupWebSocket:()=>K});var d=c(81503),e=c(91645),f=c(93390),g=c(3453),h=c(15194),i=c(31268),j=c(88807),k=c(56791);let l={capturePaneCalls:0,activeControlSessions:0,subscriberCount:0,cleanupCount:0,firstOutputLatencyCount:0,firstOutputLatencyTotalMs:0,firstOutputLatencyLastMs:null,firstOutputLatencyMinMs:null,firstOutputLatencyMaxMs:null};var m=c(11665),n=c(72626),o=c(79646);class p{push(a){if(0===a.length)return[];let b=(this.remainder+a).split("\n");this.remainder=b.pop()??"";let c=[];for(let a of b){let b=a.endsWith("\r")?a.slice(0,-1):a,d=this.parseLine(b);d&&c.push(d)}return c}flush(){if(0===this.remainder.length)return[];let a=this.parseLine(this.remainder);return this.remainder="",a?[a]:[]}parseLine(a){return 0===a.length?{type:"output",data:"\n"}:a.startsWith("%output ")?{type:"output",data:`${a.slice(8)}
|
|
21
21
|
`}:"%exit"===a||a.startsWith("%exit ")?{type:"exit",exitCode:null}:a.startsWith("%error ")?{type:"error",error:Error(a.slice(7))}:a.startsWith("%")?null:{type:"output",data:`${a}
|
|
22
22
|
`}}constructor(){this.remainder=""}}let q=(0,n.h)("tmux-control-client");class r{constructor(a={}){this.parser=new p,this.handlers=new Set,this.child=null,this.sessionName=null,this.idleTimer=null,this.started=!1,this.spawnProcess=a.spawnProcess??((a,b,c)=>(0,o.spawn)(a,b,c)),this.tmuxBinary=a.tmuxBinary??"tmux",this.idleTimeoutMs=a.idleTimeoutMs??3e4}start(a){this.started||(this.sessionName=a,this.child=this.spawnProcess(this.tmuxBinary,["-C","attach-session","-t",(0,m.lA)(a)],{stdio:"pipe"}),this.started=!0,this.child.stdout.setEncoding("utf8"),this.child.stdout.on("data",a=>{this.touch();let b="string"==typeof a?a:a.toString("utf8");for(let a of this.parser.push(b))this.emit(a)}),this.child.stderr.setEncoding("utf8"),this.child.stderr.on("data",a=>{let b="string"==typeof a?a:a.toString("utf8");this.emit({type:"error",error:Error(b.trim()||"tmux control stderr")})}),this.child.on("close",a=>{for(let a of this.parser.flush())this.emit(a);this.emit({type:"exit",exitCode:a}),this.stop()}),this.child.on("error",a=>{this.emit({type:"error",error:a}),this.stop()}),this.resetIdleTimer(),q.debug("start",{sessionName:a}))}onEvent(a){return this.handlers.add(a),()=>{this.handlers.delete(a)}}sendInput(a){if(!this.child?.stdin.writable)throw Error("Tmux control client is not writable");this.touch(),this.child.stdin.write(a)}resize(a,b){if(!this.child?.stdin.writable)throw Error("Tmux control client is not writable");this.touch(),this.child.stdin.write(`refresh-client -C ${a}x${b}
|
|
23
|
-
`)}stop(){this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.child&&(this.child.removeAllListeners(),this.child.stdout.removeAllListeners(),this.child.stderr.removeAllListeners(),this.child.kill(),this.child=null),this.started=!1}isStarted(){return this.started}setSessionName(a){this.sessionName=a}emit(a){for(let b of this.handlers)b(a)}touch(){this.resetIdleTimer()}resetIdleTimer(){this.idleTimeoutMs<=0||(this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{q.debug("idle-timeout",{sessionName:this.sessionName}),this.stop()},this.idleTimeoutMs))}}let s=(0,n.h)("tmux-control-registry");class t{constructor(a={}){this.entries=new Map,this.handlers=new Map,this.idleTimeoutMs=a.idleTimeoutMs??15e3,this.createClient=a.createClient??(()=>new r(a))}subscribe(a,b,c){let d=this.ensureEntry(a);d.subscribers.add(b),this.cancelIdleCleanup(d),this.updateMetrics();let e=this.handlers.get(a);return e||(e=new Set,this.handlers.set(a,e)),e.add(c),()=>{e?.delete(c),this.unsubscribe(a,b)}}sendInput(a,b){let c=this.entries.get(a);if(!c)throw Error(`No control client registered for ${a}`);c.client.sendInput(b)}resize(a,b,c){let d=this.entries.get(a);if(!d)throw Error(`No control client registered for ${a}`);d.client.resize(b,c)}hasSession(a){return this.entries.has(a)}getSubscriberCount(a){return this.entries.get(a)?.subscribers.size??0}getTotalSubscriberCount(){let a=0;for(let b of this.entries.values())a+=b.subscribers.size;return a}getSessionCount(){return this.entries.size}shutdown(){for(let[a,b]of this.entries)this.teardownEntry(a,b);this.entries.clear(),this.handlers.clear(),this.updateMetrics()}renameSession(a,b){if(a===b)return!1;let c=this.entries.get(a);if(!c)return!1;if(this.entries.has(b))return s.warn("rename:destination-occupied",{oldName:a,newName:b}),!1;this.entries.delete(a),c.sessionName=b,this.entries.set(b,c),c.client.setSessionName(b);let d=this.handlers.get(a);return d&&(this.handlers.delete(a),this.handlers.set(b,d)),s.debug("rename",{oldName:a,newName:b}),!0}ensureEntry(a){let b=this.entries.get(a);if(b)return b;let c=this.createClient(a);c.start(a);let d={client:c,subscribers:new Set,unsubscribeClientEvent:()=>{},idleTimer:null,sessionName:a};return d.unsubscribeClientEvent=c.onEvent(a=>{let b=this.handlers.get(d.sessionName);if(b)for(let c of b)c(a);("exit"===a.type||"error"===a.type)&&this.deleteEntry(d.sessionName)}),this.entries.set(a,d),this.updateMetrics(),d}unsubscribe(a,b){let c=this.entries.get(a);c&&(c.subscribers.delete(b),this.updateMetrics(),0===c.subscribers.size&&this.scheduleIdleCleanup(a,c))}scheduleIdleCleanup(a,b){if(this.idleTimeoutMs<=0)return void this.deleteEntry(a);this.cancelIdleCleanup(b),b.idleTimer=setTimeout(()=>{s.debug("idle-cleanup",{sessionName:b.sessionName}),this.deleteEntry(b.sessionName)},this.idleTimeoutMs)}cancelIdleCleanup(a){a.idleTimer&&(clearTimeout(a.idleTimer),a.idleTimer=null)}deleteEntry(a){let b=this.entries.get(a);b&&(this.teardownEntry(a,b),this.entries.delete(a),this.handlers.delete(a),this.updateMetrics())}teardownEntry(a,b){this.cancelIdleCleanup(b),b.unsubscribeClientEvent(),b.client.stop(),l.cleanupCount+=1}updateMetrics(){l.activeControlSessions=Math.max(0,this.getSessionCount()),l.subscriberCount=Math.max(0,this.getTotalSubscriberCount())}}let u=null,v={streamingOutput:!0,explicitResize:!0,snapshotFallback:!0};class w{constructor(a={}){this.registry=a.registry??(u||(u=new t),u)}async ensureSession(a,b){await (0,m.N)(a)||await (0,m.jw)(a,b)}async sessionExists(a){return(0,m.N)(a)}async sendInput(a,b){if(this.registry.hasSession(a))return void this.registry.sendInput(a,b);await (0,m.V1)(a,b)}async sendSpecialKey(a,b){if("Escape"!==b&&"C-c"!==b&&"C-d"!==b&&"C-m"!==b&&"Enter"!==b)throw Error(`Unsupported special key for ControlModeTmuxTransport: ${b}`);await (0,m.ds)(a,b)}async resize(a,b,c){this.registry.resize(a,b,c)}async captureSnapshot(a,b){return l.capturePaneCalls+=1,(0,m.Xg)(a,b)}async subscribe(a,b){let c=`sub-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,d=this.registry.subscribe(a,c,a=>{"output"===a.type?b.onOutput(a.data):"exit"===a.type?b.onExit?.({exitCode:a.exitCode}):b.onError(a.error)});return{async unsubscribe(){d()}}}getCapabilities(){return v}getSubscriberCount(a){return this.registry.getSubscriberCount(a)}renameSession(a,b){return this.registry.renameSession(a,b)}async killSession(a){return(0,m.fY)(a)}}let x=null;function y(){return x||(x=new w),x}var z=c(7015),A=c(26838);let
|
|
23
|
+
`)}stop(){this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.child&&(this.child.removeAllListeners(),this.child.stdout.removeAllListeners(),this.child.stderr.removeAllListeners(),this.child.kill(),this.child=null),this.started=!1}isStarted(){return this.started}setSessionName(a){this.sessionName=a}emit(a){for(let b of this.handlers)b(a)}touch(){this.resetIdleTimer()}resetIdleTimer(){this.idleTimeoutMs<=0||(this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{q.debug("idle-timeout",{sessionName:this.sessionName}),this.stop()},this.idleTimeoutMs))}}let s=(0,n.h)("tmux-control-registry");class t{constructor(a={}){this.entries=new Map,this.handlers=new Map,this.idleTimeoutMs=a.idleTimeoutMs??15e3,this.createClient=a.createClient??(()=>new r(a))}subscribe(a,b,c){let d=this.ensureEntry(a);d.subscribers.add(b),this.cancelIdleCleanup(d),this.updateMetrics();let e=this.handlers.get(a);return e||(e=new Set,this.handlers.set(a,e)),e.add(c),()=>{e?.delete(c),this.unsubscribe(a,b)}}sendInput(a,b){let c=this.entries.get(a);if(!c)throw Error(`No control client registered for ${a}`);c.client.sendInput(b)}resize(a,b,c){let d=this.entries.get(a);if(!d)throw Error(`No control client registered for ${a}`);d.client.resize(b,c)}hasSession(a){return this.entries.has(a)}getSubscriberCount(a){return this.entries.get(a)?.subscribers.size??0}getTotalSubscriberCount(){let a=0;for(let b of this.entries.values())a+=b.subscribers.size;return a}getSessionCount(){return this.entries.size}shutdown(){for(let[a,b]of this.entries)this.teardownEntry(a,b);this.entries.clear(),this.handlers.clear(),this.updateMetrics()}renameSession(a,b){if(a===b)return!1;let c=this.entries.get(a);if(!c)return!1;if(this.entries.has(b))return s.warn("rename:destination-occupied",{oldName:a,newName:b}),!1;this.entries.delete(a),c.sessionName=b,this.entries.set(b,c),c.client.setSessionName(b);let d=this.handlers.get(a);return d&&(this.handlers.delete(a),this.handlers.set(b,d)),s.debug("rename",{oldName:a,newName:b}),!0}ensureEntry(a){let b=this.entries.get(a);if(b)return b;let c=this.createClient(a);c.start(a);let d={client:c,subscribers:new Set,unsubscribeClientEvent:()=>{},idleTimer:null,sessionName:a};return d.unsubscribeClientEvent=c.onEvent(a=>{let b=this.handlers.get(d.sessionName);if(b)for(let c of b)c(a);("exit"===a.type||"error"===a.type)&&this.deleteEntry(d.sessionName)}),this.entries.set(a,d),this.updateMetrics(),d}unsubscribe(a,b){let c=this.entries.get(a);c&&(c.subscribers.delete(b),this.updateMetrics(),0===c.subscribers.size&&this.scheduleIdleCleanup(a,c))}scheduleIdleCleanup(a,b){if(this.idleTimeoutMs<=0)return void this.deleteEntry(a);this.cancelIdleCleanup(b),b.idleTimer=setTimeout(()=>{s.debug("idle-cleanup",{sessionName:b.sessionName}),this.deleteEntry(b.sessionName)},this.idleTimeoutMs)}cancelIdleCleanup(a){a.idleTimer&&(clearTimeout(a.idleTimer),a.idleTimer=null)}deleteEntry(a){let b=this.entries.get(a);b&&(this.teardownEntry(a,b),this.entries.delete(a),this.handlers.delete(a),this.updateMetrics())}teardownEntry(a,b){this.cancelIdleCleanup(b),b.unsubscribeClientEvent(),b.client.stop(),l.cleanupCount+=1}updateMetrics(){l.activeControlSessions=Math.max(0,this.getSessionCount()),l.subscriberCount=Math.max(0,this.getTotalSubscriberCount())}}let u=null,v={streamingOutput:!0,explicitResize:!0,snapshotFallback:!0};class w{constructor(a={}){this.registry=a.registry??(u||(u=new t),u)}async ensureSession(a,b){await (0,m.N)(a)||await (0,m.jw)(a,b)}async sessionExists(a){return(0,m.N)(a)}async sendInput(a,b){if(this.registry.hasSession(a))return void this.registry.sendInput(a,b);await (0,m.V1)(a,b)}async sendSpecialKey(a,b){if("Escape"!==b&&"C-c"!==b&&"C-d"!==b&&"C-m"!==b&&"Enter"!==b)throw Error(`Unsupported special key for ControlModeTmuxTransport: ${b}`);await (0,m.ds)(a,b)}async resize(a,b,c){this.registry.resize(a,b,c)}async captureSnapshot(a,b){return l.capturePaneCalls+=1,(0,m.Xg)(a,b)}async subscribe(a,b){let c=`sub-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,d=this.registry.subscribe(a,c,a=>{"output"===a.type?b.onOutput(a.data):"exit"===a.type?b.onExit?.({exitCode:a.exitCode}):b.onError(a.error)});return{async unsubscribe(){d()}}}getCapabilities(){return v}getSubscriberCount(a){return this.registry.getSubscriberCount(a)}renameSession(a,b){return this.registry.renameSession(a,b)}async killSession(a){return(0,m.fY)(a)}}let x=null;function y(){return x||(x=new w),x}var z=c(7015),A=c(26838),B=c(57836);function C(){let a=globalThis.__waitingStatusBroadcastUnsubscribe;a&&(a(),globalThis.__waitingStatusBroadcastUnsubscribe=void 0)}let D=(0,n.h)("ws-server"),E=null,F=new Map,G=new Map,H=new Set(["localhost","127.0.0.1"]);function I(a,b){try{a.write(`HTTP/1.1 ${b}\r
|
|
24
24
|
Content-Length: 0\r
|
|
25
25
|
Connection: close\r
|
|
26
26
|
\r
|
|
27
|
-
`)}catch{}a.destroy()}async function H(a,b,c,d){let e,f=(a.url||"/").split("?")[0].split("/")[2]||"";if(!f)return void G(b,"400 Bad Request");try{let a=d.getDb(),b=d.getCache(a);e=await b.getByPathPrefix(f)}catch(a){B.error("ws-proxy:cache-error",{pathPrefix:f,error:a instanceof Error?a.message:String(a)}),!b.destroyed&&b.writable&&G(b,"502 Bad Gateway");return}if(b.destroyed||!b.writable)return;if(!e)return void G(b,"404 Not Found");if(!e.enabled)return void G(b,"503 Service Unavailable");if(!e.websocketEnabled)return void G(b,"403 Forbidden");if(!F.has(e.targetHost)){B.warn("ws-proxy:ssrf-blocked",{pathPrefix:f}),G(b,"403 Forbidden");return}let g=d.netConnect({host:e.targetHost,port:e.targetPort}),h=!1,i=!1,j=()=>{if(!i){i=!0;try{g.destroy()}catch{}try{b.destroy()}catch{}}};g.on("connect",()=>{h=!0;try{let b=function(a){let b=a.method||"GET",c=a.url||"/",d=a.httpVersion||"1.1",e=[`${b} ${c} HTTP/${d}`];for(let[b,c]of Object.entries(a.headers))if(void 0!==c)if(Array.isArray(c))for(let a of c)e.push(`${b}: ${a}`);else e.push(`${b}: ${c}`);return e.join("\r\n")+"\r\n\r\n"}(a);g.write(b)}catch(a){B.error("ws-proxy:upstream-write-error",{pathPrefix:f,error:a instanceof Error?a.message:String(a)}),j();return}b.pipe(g),g.pipe(b)}),g.on("error",a=>{B.error("ws-proxy:upstream-error",{pathPrefix:f,error:a.message}),h||b.destroyed||!b.writable?j():G(b,"502 Bad Gateway")}),g.on("close",()=>{j()}),b.on("error",a=>{B.error("ws-proxy:client-error",{pathPrefix:f,error:a.message}),j()}),b.on("close",()=>{j()})}function I(a){C=new d.zu({noServer:!0}),a.on("upgrade",(a,b,c)=>{let d=a.url||"/";if(d.startsWith("/_next/")){b.write("HTTP/1.1 426 Upgrade Required\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"),b.destroy();return}if((0,g.Rh)()){let c=(0,g.Z2)(a.socket.remoteAddress||"");if(!(0,g.c$)(c,(0,g.nu)())){let a=c.substring(0,45);B.warn("websocket:denied",{ip:a}),b.write("HTTP/1.1 403 Forbidden\r\n\r\n"),b.destroy();return}}if((0,f.y2)()){let c=a.headers.cookie||"",d=(0,f.JT)(c)[f.aq];if(!d||!(0,f.nr)(d)){b.write("HTTP/1.1 401 Unauthorized\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"),b.destroy();return}}if(d.startsWith("/proxy/"))return void(async()=>{try{await H(a,b,c,{getDb:()=>(0,j.getDbInstance)(),getCache:a=>(0,z.Ds)(a),netConnect:a=>(0,e.connect)(a)})}catch(a){if(B.error("ws-proxy:unhandled-error",{error:a instanceof Error?a.message:String(a)}),!b.destroyed&&b.writable){try{b.write("HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\nConnection: close\r\n\r\n")}catch{}b.destroy()}}})();C.handleUpgrade(a,b,c,b=>{C.emit("connection",b,a)})}),C.on("error",a=>{B.error("server:error",{error:a.message})}),C.on("connection",a=>{let b={ws:a,worktreeIds:new Set,terminalSubscription:null};D.set(a,b),a.on("message",b=>{try{let c=JSON.parse(b.toString());J(a,c)}catch(a){B.error("message:parse-failed",{error:a instanceof Error?a.message:String(a)})}}),a.on("close",()=>{M(a)}),a.on("error",b=>{"WS_ERR_INVALID_CLOSE_CODE"===b.code||b.message?.includes("Invalid WebSocket frame")||b.message?.includes("write after end")||b.message?.includes("ECONNRESET")||b.message?.includes("EPIPE")||B.error("websocket:error",{error:b.message});try{a.terminate()}catch{}M(a)})})}function J(a,b){switch(b.type){case"subscribe":if(!b.worktreeId)return;var c=a,d=b.worktreeId;let e=D.get(c);e&&(e.worktreeIds.add(d),E.has(d)||E.set(d,new Set),E.get(d).add(c));break;case"unsubscribe":if(!b.worktreeId)return;!function(a,b){let c=D.get(a);if(!c)return;c.worktreeIds.delete(b);let d=E.get(b);d&&(d.delete(a),0===d.size&&E.delete(b))}(a,b.worktreeId);break;case"broadcast":if(!b.worktreeId)return;L(b.worktreeId,b.data);break;case"client_version":K(a,b);break;case"terminal_subscribe":O(a,b);break;case"terminal_input":P(a,b);break;case"terminal_resize":Q(a,b);break;case"terminal_unsubscribe":R(a);break;default:B.warn("message:unknown-type")}}function K(a,b){let c="string"==typeof b.version?b.version:"";if(!c)return;let e=(0,A.Sw)();if(e&&c&&"0.0.0"!==e&&"0.0.0"!==c&&e!==c&&a.readyState===d.kb.OPEN)try{a.send(JSON.stringify({type:"version_mismatch",serverVersion:e,clientVersion:c}))}catch(a){B.error("version:notify-failed",{error:a instanceof Error?a.message:String(a)})}}function L(a,b){let c=E.get(a);if(c&&0!==c.size)try{let e=JSON.stringify({type:"broadcast",worktreeId:a,data:b});c.forEach(a=>{if(a.readyState===d.kb.OPEN)try{a.send(e)}catch(a){B.error("broadcast:send-failed",{error:a instanceof Error?a.message:String(a)})}})}catch(b){B.error("broadcast:failed",{worktreeId:a,error:b instanceof Error?b.message:String(b)});try{let b=JSON.stringify({type:"broadcast",worktreeId:a,data:{error:"Message encoding error"}});c.forEach(a=>{if(a.readyState===d.kb.OPEN)try{a.send(b)}catch{}})}catch(a){B.error("fallback:send-failed",{error:a instanceof Error?a.message:String(a)})}}}function M(a){let b=D.get(a);b&&(b.worktreeIds.forEach(b=>{let c=E.get(b);c&&(c.delete(a),0===c.size&&E.delete(b))}),b.terminalSubscription&&(b.terminalSubscription.unsubscribe(),b.terminalSubscription=null),D.delete(a))}function N(a,b){a.readyState===d.kb.OPEN&&a.send(JSON.stringify(b))}async function O(a,b){let c=D.get(a);if(!c)return void N(a,{type:"terminal_error",error:"Unauthorized WebSocket client"});if("true"!==process.env.TMUX_CONTROL_MODE_ENABLED)return void N(a,{type:"terminal_error",error:"Tmux control mode is disabled"});let{worktreeId:d,cliToolId:e}=b;if(!d||!e||!(0,h.hR)(e))return void N(a,{type:"terminal_error",error:"Invalid terminal subscription parameters"});let f=(0,j.getDbInstance)();if(!(0,k.Uim)(f,d))return void N(a,{type:"terminal_error",error:"Worktree not found"});c.terminalSubscription&&(await c.terminalSubscription.unsubscribe(),c.terminalSubscription=null);let g=i.s.getInstance().getTool(e).getSessionName(d),m=y();if(m.getSubscriberCount(g)>=4)return void N(a,{type:"terminal_error",error:"Terminal subscriber limit reached"});let n=!1,o=Date.now(),p=await m.subscribe(g,{onOutput:b=>{if(!n){n=!0;let a=Math.max(0,Math.round(Date.now()-o));l.firstOutputLatencyCount+=1,l.firstOutputLatencyTotalMs+=a,l.firstOutputLatencyLastMs=a,l.firstOutputLatencyMinMs=null===l.firstOutputLatencyMinMs?a:Math.min(l.firstOutputLatencyMinMs,a),l.firstOutputLatencyMaxMs=null===l.firstOutputLatencyMaxMs?a:Math.max(l.firstOutputLatencyMaxMs,a)}N(a,{type:"terminal_output",data:b})},onExit:({exitCode:b})=>{N(a,{type:"terminal_exit",exitCode:b})},onError:b=>{(async()=>{try{let b=await m.captureSnapshot(g,{startLine:-200});b.length>0&&N(a,{type:"terminal_output",data:b,fallback:!0})}catch{}N(a,{type:"terminal_error",error:b.message,fallback:!0})})()}});c.terminalSubscription={worktreeId:d,cliToolId:e,sessionName:g,startedAt:o,unsubscribe:p.unsubscribe},N(a,{type:"terminal_status",connected:!0,worktreeId:d,cliToolId:e})}async function P(a,b){let c=D.get(a),d=c?.terminalSubscription;if(!d)return void N(a,{type:"terminal_error",error:"No active terminal subscription"});let e="string"==typeof b.data?b.data:"";if(0===e.length||e.length>4096)return void N(a,{type:"terminal_error",error:"Invalid terminal input"});try{await y().sendInput(d.sessionName,e)}catch(b){N(a,{type:"terminal_error",error:b instanceof Error?b.message:"Failed to send terminal input"})}}async function Q(a,b){let c=D.get(a),d=c?.terminalSubscription;if(d){if("number"!=typeof b.cols||!Number.isInteger(b.cols)||b.cols<20||b.cols>500||"number"!=typeof b.rows||!Number.isInteger(b.rows)||b.rows<5||b.rows>200)return void N(a,{type:"terminal_error",error:"Invalid terminal resize payload"});try{await y().resize(d.sessionName,b.cols,b.rows)}catch(b){N(a,{type:"terminal_error",error:b instanceof Error?b.message:"Failed to resize terminal"})}}}async function R(a){let b=D.get(a);if(b?.terminalSubscription){try{await b.terminalSubscription.unsubscribe()}catch{}b.terminalSubscription=null,N(a,{type:"terminal_status",connected:!1})}}function S(a,b){L(a,b)}function T(a){let b=E.get(a);return!!b&&b.size>0}function U(a,b){b.worktreeId?L(b.worktreeId,{type:a,...b}):B.warn("broadcast:missing-worktree-id")}let V="worktree_renamed";function W(a){let b=new Map;for(let{oldId:c,newId:d}of a)c&&d&&c!==d&&b.set(c,d);if(0===b.size)return[];let c=[];for(let[a,d]of b){let b=E.get(a);b&&0!==b.size&&(E.delete(a),c.push({oldId:a,newId:d,sockets:b}))}let d=[];for(let{oldId:a,newId:b,sockets:e}of c){let c=E.get(b)??new Set;for(let d of e){c.add(d);let e=D.get(d);e&&(e.worktreeIds.delete(a),e.worktreeIds.add(b)),N(d,{type:V,worktreeId:b,previousWorktreeId:a})}E.set(b,c),d.push({oldId:a,newId:b,subscribers:e.size})}for(let a of D.values()){let c=a.terminalSubscription;if(!c)continue;let d=b.get(c.worktreeId);if(d)try{if(!(0,h.hR)(c.cliToolId))continue;let a=i.s.getInstance().getTool(c.cliToolId);c.sessionName=a.getSessionName(d),c.worktreeId=d}catch(a){B.warn("terminal:rename-failed",{worktreeId:c.worktreeId,newId:d,error:a instanceof Error?a.message:String(a)})}}return d.length>0&&B.info("rooms:migrated",{count:d.length}),d}function X(a){for(let b of a){let a=E.get(b);a&&(a.forEach(a=>{let c=D.get(a);c&&c.worktreeIds.delete(b)}),E.delete(b))}}function Y(){C&&(D.forEach(a=>{a.ws.close()}),D.clear(),E.clear(),C.close(),C=null)}let Z={handleMessage:J,handleClientVersion:K,handleProxyUpgrade:H,handleTerminalSubscribe:O,handleTerminalInput:P,handleTerminalResize:Q,handleTerminalUnsubscribe:R,handleDisconnect:M,registerClientForTest(a){D.set(a,{ws:a,worktreeIds:new Set,terminalSubscription:null})},getClientInfoForTest:a=>D.get(a),resetStateForTest(){D.clear(),E.clear()}}},71080:(a,b,c)=>{"use strict";c.d(b,{L1:()=>g,Re:()=>h,j7:()=>f});var d=c(55511);let e=new Map;function f(a,b){let c=(0,d.createHash)("sha256").update(b).digest("hex");return e.get(a)===c||(e.set(a,c),!1)}function g(a){e.delete(a)}function h(a,b){if(a===b)return;let c=e.get(a);e.delete(a),void 0!==c&&e.set(b,c)}},72457:(a,b,c)=>{"use strict";c.d(b,{gv:()=>f,i2:()=>h,iX:()=>g,zm:()=>i});var d=c(55511);let e=new Map;function f(a,b){let c=(0,d.createHash)("sha256").update(b).digest("hex");return e.get(a)===c||(e.set(a,c),!1)}function g(a){e.delete(a)}function h(a,b){if(a===b)return;let c=e.get(a);e.delete(a),void 0!==c&&e.set(b,c)}function i(a,b){return"copilot"!==b?a:a.replace(/^[❯>]\s/gm," ")}},75498:(a,b,c)=>{"use strict";c.d(b,{Lj:()=>f,Tb:()=>e,sD:()=>g});var d=c(68901);let e=2e4;function f(a,b,c){if(!c)return null;if("off"===c.mode)return{reason:"mode-off"};let f=function(a,b){if(0===b.length)return{outcome:"no-match"};let c=a.map(a=>a.length>e?a.slice(0,e):a);for(let a of b){if(a.length>200||!(0,d.P0)(a).valid)return{outcome:"unusable",pattern:a};let b=new RegExp(a);for(let e of c){let c=(0,d.eJ)(b,e);if(null===c)return{outcome:"unusable",pattern:a};if(c)return{outcome:"match",pattern:a}}}return{outcome:"no-match"}}(b,c.denyPatterns);return"match"===f.outcome?{reason:"deny-pattern",pattern:f.pattern}:"unusable"===f.outcome?{reason:"deny-pattern-unusable",pattern:f.pattern}:"safe"===c.mode?"yes_no"===a?null:{reason:"type-not-allowed"}:"allow-listed"===c.mode?c.allowPromptTypes.includes(a)?null:{reason:"type-not-allowed"}:null}function g(a,b){let c=function(a){if("yes_no"===a.type)return"y";if("multiple_choice"===a.type){let b=a.options.find(a=>a.isDefault)??a.options[0];return!b||b.requiresTextInput?null:b.number.toString()}return null}(a);if(null===c)return{answer:null,suppressedBy:null};let d=f(a.type,function(a){let b=[a.question];if(a.approvalTarget&&b.push(a.approvalTarget),"multiple_choice"===a.type)for(let c of a.options)b.push(c.label);else b.push(...a.options);return b}(a),b);return d?{answer:null,suppressedBy:d.reason,pattern:d.pattern}:{answer:c,suppressedBy:null}}},77093:(a,b,c)=>{"use strict";function d(a){return a instanceof Error?a.message:String(a)}c.d(b,{u1:()=>d})},82450:(a,b,c)=>{"use strict";c.d(b,{IS:()=>h,LH:()=>m,NN:()=>g,Sj:()=>o,aW:()=>n});var d=c(26283),e=c(13033),f=c(56263);function g(a){let b=(0,d.aJ)(a).split("\n"),c=(0,d.GT)(b),e=c>=0?b.slice(0,c):b,f=-1;for(let a=e.length-1;a>=0;a--)if(/^❯\s+\S/.test(e[a])){f=a;break}let g=f>=0?f+1:0,h=e.slice(g),i=[/CLAUDE_HOOKS_/,/\/bin\/claude/,/^claude\s*$/,/@.*\s+%\s*$/,/^[^⏺]*curl.*POST/,/^[^⏺]*Content-Type/,/^[^⏺]*export\s+CLAUDE_/,/^\s*$/,/^[╭╮╰╯│─\s]+$/,/^[│╭╮╰╯].*[│╭╮╰╯]$/,/Claude Code v[\d.]+/,/^Tips for getting started/,/^Welcome back/,/Run \/init to create/,/^Recent activity/,/^No recent activity/,/▐▛███▜▌|▝▜█████▛▘|▘▘ ▝▝/,/^\s*Opus \d+\.\d+\s*·\s*Claude Max/,/\.com's Organization/,/\?\s*for shortcuts\s*$/,/^─{10,}$/,/^❯\s*$/,d.fW],j=[];for(let a of h)!i.some(b=>b.test(a))&&a.trim()&&j.push(a);return j.join("\n").trim()}function h(a){let b=(0,d.aJ)(a).split("\n"),c=[],e=[/^maenokota@.*%/,/^zsh:/,/^feature-issue-\d+/,/^\s*$/],f=!1,g=[];for(let a of b){if(a.includes("✦")){f=!0;let b=a.indexOf("✦"),c=a.substring(b+1).trim();c&&g.push(c);continue}if(f){if(e.some(b=>b.test(a)))continue;g.push(a)}}if(g.length>0)return g.join("\n").trim();for(let a of b)e.some(b=>b.test(a))||c.push(a);return c.join("\n").trim()}let i=/^●\s+(?:Get |Read |Run |Search |Write |Delete |Edit |List |Create |Check |Fetch |Map |Explore |Execute |Find |Install |Update |Open |Close |Copy |Move |Rename |Set |Test |Build |Deploy |Start |Stop |Restart |Kill |Call |Send |Upload |Download |Compile |Analyze |Scan |Apply |Revert |Reset |Push |Pull |Clone |Merge |Commit |Checkout |Branch |Tag |Diff |Log |Show |Status |Init |Config |Add |Remove |Index |Query |Connect |Disconnect |Ping |Trace |Debug |Validate |Verify |Inspect |Monitor |Watch |Clean |Purge |Flush |Load |Save |Export |Import |Format |Lint |Parse |Generate |Transform |Convert |Migrate |Upgrade |Patch |Enable |Disable |Grant |Revoke |Approve |Deny |Lock |Unlock |Mount |Unmount |Attach |Detach |Register |Unregister |Subscribe |Unsubscribe |Publish |Unpublish |Encrypt |Decrypt |Sign |Hash |Encode |Decode |Compress |Decompress |Archive |Extract |Backup |Restore |Dump |Model changed to:)/,j=/^\d+\s+lines\.\.\.$/,k=/^[◐◑◒◓]/,l=/^(?:git\s+--no-pager|git\s+(?:log|diff|show|status|branch|remote|fetch|pull|push|merge|rebase|checkout|reset|stash|tag|config|clone|init|add|commit|rm|mv|bisect|grep|ls-files|rev-parse|describe|shortlog|blame|reflog|cherry-pick|revert|submodule|worktree)\b|npm\s+|npx\s+|node\s+|yarn\s+|pnpm\s+|cargo\s+|pip\s+|python\s+|ruby\s+|go\s+|rustc\s+|make\s+|cmake\s+|docker\s+|kubectl\s+|aws\s+|gcloud\s+|az\s+|terraform\s+|ansible\s+|curl\s+|wget\s+|ssh\s+|scp\s+|rsync\s+|find\s+|grep\s+|sed\s+|awk\s+|cat\s+|ls\s+|cd\s+|mkdir\s+|rm\s+|cp\s+|mv\s+|chmod\s+|chown\s+|echo\s+)/;function m(a){let b=(0,d.aJ)(a).split("\n"),c=-1;for(let a=b.length-1;a>=0;a--){let d=(0,e.IW)(b[a]);if(d&&/^❯\s+\S/.test(d)){c=a;break}}let f=c>=0?c+1:0,g=b.slice(f),h=[],m=!1,n=!1;for(let a of g){let b=(0,e.IW)(a);if(!(!b||d.J7.some(a=>a.test(b)))){if(i.test(b)){n=!0,m=!1;continue}if(k.test(b)){m=!0,n=!1;continue}if(!(j.test(b)||l.test(b)||/^❯\s*/.test(b)||/^[│└]/.test(b))){if(/^●/.test(b)){m=!1,n=!1,h.push(b.replace(/^●\s*/,""));continue}m||n||h.push(b)}}}return h.join("\n").trim()}function n(a){let b=a.split("\n"),c=[];for(let a=0;a<b.length;a++){let f=(0,e.l1)(b[a]);f&&d.Md.test(f)&&c.push(a)}let f=0;c.length>=2&&(f=c[c.length-2]+1);let g=[];for(let a=f;a<b.length;a++){let c=(0,e.l1)(b[a]);!(!c||d.sx.some(a=>a.test(c)))&&(d.Md.test(c)||g.push(c))}return g.join("\n").trim()}function o(a,b=f.Rf,c=f.ky){if(!a||a.length<=b)return a;let d=c+"\n",e=b-d.length;if(e<=0)return c.slice(0,b);let g=a.length-e;if(g>0&&g<a.length){let b=a.charCodeAt(g);b>=56320&&b<=57343&&(g+=1)}return d+a.slice(g)}},90164:(a,b,c)=>{"use strict";c.d(b,{Dk:()=>e,kD:()=>f});let d="https://github.com/Kewton/CommandMate",e=`${d}/releases/`,f=`${d}/blob/main/docs/security-guide.md`},90736:(a,b,c)=>{"use strict";c.d(b,{c0:()=>ab,zw:()=>Z,Yq:()=>$,oV:()=>W,pU:()=>aa,R7:()=>_,VU:()=>ac});var d=c(11665),e=c(26283),f=c(40236),g=c(93997),h=c(77093),i=c(20610),j=c(79646),k=c(28354),l=c(72626);let m=(0,l.h)("session-key-sender"),n=(0,k.promisify)(j.exec);async function o(a,b=50){let c=await (0,d.Xg)(a,{startLine:-b});return(0,e.aJ)(c)}async function p(a){await n("tmux set-environment -g -u CLAUDECODE 2>/dev/null || true"),await (0,d.V1)(a,"unset CLAUDECODE",!0),await new Promise(a=>setTimeout(a,i.Em))}async function q(a,b){let c=Date.now();for(;Date.now()-c<b;){let b=await o(a);if(e.hx.test(b))return;await new Promise(a=>setTimeout(a,200))}throw Error(`Prompt detection timeout (${b}ms)`)}async function r(a,b,c,h){if(!await (0,d.N)(a))throw Error(`Claude session ${a} does not exist. Start the session first.`);let i=await o(a);e.hx.test(i)||await q(a,h),await new Promise(a=>setTimeout(a,c)),await (0,f.FW)({sessionName:a,message:b,cliToolId:"claude"}),(0,g.gm)(a),m.info("sent-message-to-session",{sessionName:a})}async function s(a){try{await (0,d.N)(a)&&(await (0,d.V1)(a,"",!1),await (0,d.ds)(a,"C-d"),(0,g.gm)(a),await new Promise(a=>setTimeout(a,i.Zf)));let b=await (0,d.fY)(a);return b&&m.info("stopped-session",{sessionName:a}),b}catch(a){return m.error("session:stop-failed",{error:(0,h.u1)(a)}),!1}}var t=c(79748),u=c(15194),v=c(55511),w=c(29021),x=c(21820),y=c(33873),z=c(87447),A=c(13287);let B=(0,l.h)("lib/hooks/hook-settings-generator"),C="CM_AUTH_TOKEN",D=A.k$,E=["Bash(pkill:*)","Bash(killall:*)","Bash(kill -9:*)"],F=(0,y.join)("scripts","hooks","cmate-agent-event.sh");function G(){return!!(process.env[C]||process.env.CM_AUTH_TOKEN_HASH)}function H(a={}){if(a.directory)return a.directory;let b=process.env.CM_AGENT_HOOKS_DIR;return b||(0,y.join)((0,x.homedir)(),".commandmate","hooks")}function I(a){let b=a.cliToolId??"claude";return a.instanceId??b}function J(a,b={}){return K("/api/hooks/agent-event",a,b)}function K(a,b,c){let d=b.cliToolId??"claude",e=c.port??(0,z.D0)(),f=new URLSearchParams({tool:d,worktreeId:b.worktreeId,instanceId:I(b)});return`http://127.0.0.1:${e}${a}?${f.toString()}`}function L(a){return`'${a.replace(/'/g,"'\\''")}'`}function M(a,b,c=5){let d={"Content-Type":"application/json"},e={type:"http",url:a,headers:d,timeout:c};return b&&(d.Authorization=`Bearer $${C}`,e.allowedEnvVars=[C]),e}var N=c(48083),O=c(2669);let P=(0,l.h)("claude-session"),Q=(0,k.promisify)(j.exec),R=["$","%","#"],S=null;async function T(){if(S)return S;let a=process.env.CLAUDE_PATH;if(a&&(/^[/a-zA-Z0-9._-]+$/.test(a)?!a.includes("..")||(P.info("claudepath-contains-path"),!1):(P.info("claudepath-contains-invalid-characters-i"),!1)))try{return await (0,t.access)(a,t.constants.X_OK),S=a}catch{P.info("claudepath-is-not-executable:envclaudepa")}try{let{stdout:a}=await Q("which claude",{timeout:5e3});return S=a.trim()}catch{for(let a of["/opt/homebrew/bin/claude","/usr/local/bin/claude","/usr/bin/claude"])try{return await Q(`test -x "${a}"`,{timeout:1e3}),S=a}catch{}throw Error("Claude CLI not found. Set CLAUDE_PATH environment variable or install Claude CLI.")}}async function U(a,b=50){let c=await (0,d.Xg)(a,{startLine:-b});return(0,e.aJ)(c)}function V(a){let b=a.trim().split("\n").filter(a=>""!==a.trim()).slice(-10).join("\n");for(let a of e.F0)if(b.includes(a))return a;for(let a of e.Fw)if(a.test(b))return a.source;return null}async function W(a){try{let b=(await U(a)).trim();if(""===b)return{healthy:!1,reason:"empty output"};if(e.hx.test(b))return{healthy:!0};let c=b.split("\n").filter(a=>""!==a.trim()),d=V(b);if(null!==d)return{healthy:!1,reason:`error pattern: ${d}`};let f=c[c.length-1]?.trim()??"";if(f.length>=40)return{healthy:!0};if(R.some(a=>!(!f.endsWith(a)||"%"===a&&/\d+%$/.test(f))))return{healthy:!1,reason:`shell prompt ending detected: ${f}`};return{healthy:!0}}catch{return{healthy:!1,reason:"capture error"}}}async function X(a){return!!(await W(a)).healthy||(P.warn("session-sessionname-unhealthy:resultreas"),await (0,d.fY)(a),!1)}function Y(a,b){let c=`mcbd-claude-${a}`;if(!b||"claude"===b)return c;let d=(0,u.pL)(b,"claude");return d?`${c}-${d}`:c}async function Z(){try{return await Q("which claude",{timeout:5e3}),!0}catch{return!1}}async function $(a,b){let c=Y(a,b);return!!await (0,d.N)(c)&&(!!(await W(c)).healthy||(P.warn("session-sessionname-unhealthy:resultreas"),!1))}async function _(a){let{worktreeId:b,worktreePath:c,instanceId:f}=a;if(!await Z())throw Error("Claude CLI is not installed or not in PATH");let g=Y(b,f);if(await (0,d.N)(g)&&await X(g)){await (0,d.zT)(g),P.info("claude-session-sessionname");return}(0,N.dj)(b,"claude",f);try{await (0,d.jw)({sessionName:g,workingDirectory:c}),await p(g);let a=await T(),h=function(a,b,c={}){if("0"===process.env.CM_AGENT_HOOKS_INJECT)return a;if(!(0,u.n6)(I(b)))return B.warn("hook-settings-invalid-instance-id",{worktreeId:b.worktreeId}),a;try{let d=function(a,b={}){let c=function(a,b={}){let c=a.cliToolId??"claude",d=I(a),e=`${c}-${a.worktreeId}-${d}`.replace(/[^a-zA-Z0-9_-]/g,"_"),f=(0,v.createHash)("sha256").update(JSON.stringify([c,a.worktreeId,d])).digest("hex").slice(0,12);return(0,y.join)(H(b),`${e.slice(0,80)}-${f}.json`)}(a,b);return(0,w.mkdirSync)(H(b),{recursive:!0,mode:448}),(0,w.writeFileSync)(c,`${JSON.stringify(function(a,b={}){let c=J(a,b),d=b.withAuthHeader??G(),e=()=>M(c,d);return{hooks:{SessionStart:[{hooks:[{type:"command",command:function(a,b={}){let c=J(a,b),d=b.withAuthHeader??G(),e=void 0===b.relayScriptPath?function(){let a=(0,y.resolve)(process.cwd(),F);return(0,w.existsSync)(a)?a:null}():b.relayScriptPath;if(e)return[L(e),"--tool",L(a.cliToolId??"claude"),"--event session_start --worktree-id",L(a.worktreeId),"--instance-id",L(I(a)),"--url",L(c),"--stdin-json"].join(" ");let f=d?` -H "Authorization: Bearer $${C}"`:"";return`curl -sS -m 5 -X POST -H 'Content-Type: application/json'${f} --data-binary @- ${L(c)} >/dev/null 2>&1 || true`}(a,b),timeout:5}]}],UserPromptSubmit:[{hooks:[e()]}],Stop:[{hooks:[e()]}],Notification:[{matcher:"permission_prompt|idle_prompt",hooks:[e()]}],SessionEnd:[{hooks:[e()]}],PreToolUse:[{matcher:D,hooks:[e()]}],PostToolUse:[{matcher:D,hooks:[e()]}],PermissionRequest:[{hooks:[M(function(a,b={}){return K("/api/hooks/permission-request",a,b)}(a,b),d,5)]}]},permissions:{deny:[...E]}}}(a,b),null,2)}
|
|
28
|
-
`,{mode:384}),c}(b,c);return`${L(a)} --settings ${L(d)}`}catch(c){return B.warn("hook-settings-write-failed",{worktreeId:b.worktreeId,error:c instanceof Error?c.message:String(c)}),a}}(a,{worktreeId:b,instanceId:f});await (0,d.V1)(g,h,!0);let i=Date.now(),j=!1,k=!1;for(;Date.now()-i<6e4;){await new Promise(a=>setTimeout(a,300));let a=null;try{a=await U(g)}catch{}if(null===a)continue;if(e.hx.test(a)){await new Promise(a=>setTimeout(a,500)),P.info("claude-initialized-in"),j=!0;break}if(!k&&e.CX.test(a))try{await (0,d.V1)(g,"",!0),k=!0,P.info("trust-dialog-detected")}catch{}let b=V(a);if(null!==b)throw new O.mR("Claude Code",g,b)}if(!j)throw new O.Sr("Claude Code",g,6e4);P.info("started-claude-session:sessionname")}catch(a){if(S=null,P.error("session:start-failed",{error:a instanceof Error?a.message:String(a)}),(0,O.su)(a))throw a;throw Error("Failed to start Claude session")}}async function aa(a,b,c){let d=Y(a,c);await r(d,b,500,1e4)}async function ab(a,b=1e3,c){let e=Y(a,c);if(!await (0,d.N)(e))throw Error(`Claude session ${e} does not exist`);try{return await (0,d.Xg)(e,{startLine:-b})}catch(a){throw Error(`Failed to capture Claude output: ${a instanceof Error?a.message:String(a)}`)}}async function ac(a,b){let c=Y(a,b),d=await s(c);return(0,N.je)(a,"claude",b),d}},91318:(a,b,c)=>{"use strict";c.d(b,{ie:()=>j,n:()=>i});var d=c(56791),e=c(88807),f=c(24455);let g=(0,c(72626).h)("auto-yes-policy"),h=new Map;function i(a,b,c){let i=c??b,j=(0,f.v7)(a,b,i),k=Date.now(),l=h.get(j);if(l&&l.expiresAt>k)return l.policy;let m=function(a,b,c){try{let f=(0,d.MHq)((0,e.getDbInstance)(),a,b,c);if(!f)return null;return f.contract.autoYes}catch(d){return g.warn("policy-lookup-failed",{worktreeId:a,cliToolId:b,instanceId:c,error:d instanceof Error?d.message:String(d)}),null}}(a,b,i);return h.size>=200&&function(a){for(let[b,c]of h.entries())c.expiresAt<=a&&h.delete(b)}(k),h.set(j,{policy:m,expiresAt:k+5e3}),m}function j(a){h.delete(a)}},93997:(a,b,c)=>{"use strict";c.d(b,{aq:()=>m,gm:()=>k,pc:()=>l,sl:()=>f,vF:()=>j,wd:()=>i,xE:()=>e});let d=(0,c(72626).h)("tmux-capture-cache"),e=1e4;function f(a,b=e){return b>0&&a>=b}function g(){return globalThis.__tmuxCaptureCache??=new Map}function h(){return globalThis.__tmuxCaptureCacheInflight??=new Map}function i(a,b){if(""===a)return"";let c=a.split("\n");return b>=c.length?a:c.slice(-b).join("\n")}function j(a,b,c){let d=g(),e=Date.now();for(let[a,b]of d)e-b.timestamp>5e3&&d.delete(a);if(d.size>=100&&!d.has(a)){let a=null,b=1/0;for(let[c,e]of d)e.timestamp<b&&(b=e.timestamp,a=c);a&&d.delete(a)}d.set(a,{output:b,capturedLines:c,timestamp:e})}function k(a){g().delete(a),d.debug("cache:invalidate",{sessionName:a})}function l(){g().clear(),h().clear()}async function m(a,b,c){let d=function(a,b){let c=g(),d=c.get(a);return d?Date.now()-d.timestamp>5e3?(c.delete(a),null):b>d.capturedLines?null:i(d.output,b):null}(a,b);if(null!==d)return d;let f=h(),k=f.get(a);if(k)return i(await k,b);let l=c();f.set(a,l);try{let c=await l;return c.length>0&&j(a,c,e),i(c,b)}finally{f.delete(a)}}},95220:(a,b,c)=>{"use strict";c.r(b),c.d(b,{accumulateTuiContent:()=>g.IZ,cleanClaudeResponse:()=>f.NN,cleanCopilotResponse:()=>f.LH,cleanGeminiResponse:()=>f.IS,cleanOpenCodeResponse:()=>f.aW,clearPromptHashCache:()=>h.iX,clearTuiAccumulator:()=>g.q1,extractCopilotContentLines:()=>g.o0,extractTuiContentLines:()=>g.K0,findOverlapIndex:()=>g.vQ,getAccumulatedContent:()=>g.Uz,getActivePollers:()=>d.KQ,initTuiAccumulator:()=>g.tb,isDuplicatePrompt:()=>h.gv,isOpenCodeComplete:()=>e.b,migrateResponsePollerWorktreeIds:()=>d.sR,normalizeCopilotLine:()=>g.IW,normalizePromptForDedup:()=>h.zm,renamePromptHashCacheKey:()=>h.i2,resolveExtractionStartIndex:()=>e.Q,startPolling:()=>d.g8,stopAllPolling:()=>d.fq,stopPolling:()=>d.Et,truncateMessage:()=>f.Sj});var d=c(45146),e=c(60),f=c(82450),g=c(13033),h=c(72457)},95595:(a,b,c)=>{"use strict";c.d(b,{WC:()=>m,gv:()=>h,ug:()=>i});var d=c(26283),e=c(25129),f=c(68652),g=c(46423);let h={PROMPT_DETECTED:"prompt_detected",THINKING_INDICATOR:"thinking_indicator",OPENCODE_PROCESSING_INDICATOR:"opencode_processing_indicator",OPENCODE_SELECTION_LIST:"opencode_selection_list",CLAUDE_SELECTION_LIST:"claude_selection_list",COPILOT_SELECTION_LIST:"copilot_selection_list",CODEX_SELECTION_LIST:"codex_selection_list",CODEX_PAGER:"codex_pager",ANTIGRAVITY_SELECTION_LIST:"antigravity_selection_list",OPENCODE_RESPONSE_COMPLETE:"opencode_response_complete",INPUT_PROMPT:"input_prompt",NO_RECENT_OUTPUT:"no_recent_output",DEFAULT:"default"},i=new Set([h.OPENCODE_SELECTION_LIST,h.CLAUDE_SELECTION_LIST,h.COPILOT_SELECTION_LIST,h.CODEX_SELECTION_LIST,h.CODEX_PAGER,h.ANTIGRAVITY_SELECTION_LIST]),j=/press\s+(?:number|enter)\s+to\s+confirm/i,k=/^\s*[❯›●]?\s*\d{1,2}[.)]\s/;function l(a){let b=-1;for(let c=a.length-1;c>=Math.max(0,a.length-10);c--)if(d.aW.test(a[c])){b=c;break}let c=b>=0?b:a.length,e=-1,f=-1;for(let b=0;b<c;b++){let c=a[b],g=c.trim();""!==g&&((j.test(g)||k.test(g))&&(e=b),(0,d.ut)("codex",c)&&(f=b))}return e>=0&&f>e}function m(a,b,c){let i=(0,f.N)((0,d.aJ)(a)),j=i.split("\n"),k=j.length-1;for(;k>=0&&""===j[k].trim();)k--;let m=j.slice(0,k+1),n=m.slice(-15).join("\n"),o=m.slice(-g.$).join("\n"),p=m.slice(-30).join("\n");if("copilot"===b&&d.Mi.test(p)){let a=(0,d.KO)(b),c=(0,e.gF)((0,d._A)(i),a);return c.isPrompt&&(c.promptData?.options?.length??0)<=3?{status:"waiting",confidence:"high",reason:"prompt_detected",hasActivePrompt:!0,promptDetection:c}:{status:"waiting",confidence:"high",reason:h.COPILOT_SELECTION_LIST,hasActivePrompt:!1,promptDetection:c}}let q=m.slice(-15).join("\n");if("copilot"===b&&(0,d.ut)(b,q)){let a=(0,d.KO)(b);return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:(0,e.gF)((0,d._A)(i),a)}}if("codex"===b&&d.pn.test(n)){let a=(0,d.KO)(b),c=(0,e.gF)((0,d._A)(i),a);return{status:"waiting",confidence:"high",reason:h.CODEX_PAGER,hasActivePrompt:!1,promptDetection:c}}if("codex"===b){let a=-1;for(let b=m.length-1;b>=Math.max(0,m.length-10);b--)if(d.aW.test(m[b])){a=b;break}let c=a>=0?a-1:m.length-1;for(;c>=0&&""===m[c].trim();)c--;if(c>=0){let a=m.slice(Math.max(0,c-15+1),c+1).join("\n");if(d.Jn.test(a)){let c=(0,d.KO)(b),f=(0,e.gF)((0,d._A)(i),c);return f.isPrompt&&((f.promptData?.question?.trim()??"").endsWith("?")||d.Dd.test(a))&&!l(m)?{status:"waiting",confidence:"high",reason:h.PROMPT_DETECTED,hasActivePrompt:!0,promptDetection:f}:{status:"waiting",confidence:"high",reason:h.CODEX_SELECTION_LIST,hasActivePrompt:!1,promptDetection:f}}}}if("antigravity"===b&&d.kT.test(n)){let a=(0,d.KO)(b),c=(0,e.gF)((0,d._A)(i),a);return{status:"waiting",confidence:"high",reason:h.ANTIGRAVITY_SELECTION_LIST,hasActivePrompt:!1,promptDetection:c}}let r=(0,d.KO)(b),s="opencode"===b||"codex"===b||"claude"===b||"copilot"===b?(0,d._A)(i):(0,d._A)(n),t=(0,e.gF)(s,r);if(t.isPrompt)if(!("codex"===b&&l(m)))return{status:"waiting",confidence:"high",reason:"prompt_detected",hasActivePrompt:!0,promptDetection:t};else t={...t,isPrompt:!1,promptData:void 0};if("claude"===b&&d.XY.test(n))return{status:"waiting",confidence:"high",reason:h.CLAUDE_SELECTION_LIST,hasActivePrompt:!1,promptDetection:t};if((0,d.ut)(b,o))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:t};if("claude"===b&&d.aU.test(n))return{status:"running",confidence:"high",reason:h.THINKING_INDICATOR,hasActivePrompt:!1,promptDetection:t};if("opencode"===b){if(d.kD.test(n))return{status:"running",confidence:"high",reason:"opencode_processing_indicator",hasActivePrompt:!1,promptDetection:t};let a=(0,d._A)(i).split("\n"),b=Math.max(0,a.length-7);for(let c=a.length-1;c>=Math.max(0,a.length-10);c--)if(/ctrl\+[tp]/.test(a[c])){b=Math.max(0,c-2);break}let c=a.slice(0,b),e=c.length-1;for(;e>=0&&""===c[e].trim();)e--;if(e>=0){let a=c.slice(Math.max(0,e-g.$+1),e+1).join("\n");if((0,d.ut)("opencode",a))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:t};let b=c.slice(Math.max(0,e-15+1),e+1).join("\n"),f=c.join("\n");if(d.LO.test(f))return{status:"waiting",confidence:"high",reason:h.OPENCODE_SELECTION_LIST,hasActivePrompt:!1,promptDetection:t};if(d.Md.test(b))return{status:"ready",confidence:"high",reason:h.OPENCODE_RESPONSE_COMPLETE,hasActivePrompt:!1,promptDetection:t};let{promptPattern:i}=(0,d._X)("opencode");if(i.test(b))return{status:"ready",confidence:"high",reason:h.PROMPT_DETECTED,hasActivePrompt:!0,promptDetection:t}}}if("codex"===b){let a=-1;for(let b=m.length-1;b>=Math.max(0,m.length-10);b--)if(d.aW.test(m[b])){a=b;break}if(a>=0){let b=a-1;for(;b>=0&&""===m[b].trim();)b--;if(b>=0){let a=m.slice(Math.max(0,b-g.$+1),b+1).join("\n");if((0,d.ut)("codex",a))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:t};let c=m[b].trim();return d.gm.test(c)?{status:"ready",confidence:"high",reason:"input_prompt",hasActivePrompt:!1,promptDetection:t}:{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:t}}}else{let a=m.length-1;for(;a>=0&&""===m[a].trim();)a--;if(!(a>=0&&d.gm.test(m[a].trim()))&&(0,d.ut)("codex",n))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:t}}}if("antigravity"===b){if((0,d.ut)("antigravity",n))return{status:"running",confidence:"high",reason:h.THINKING_INDICATOR,hasActivePrompt:!1,promptDetection:t};let{promptPattern:a}=(0,d._X)("antigravity");if(a.test(n))return{status:"ready",confidence:"high",reason:h.INPUT_PROMPT,hasActivePrompt:!1,promptDetection:t}}let{promptPattern:u}=(0,d._X)(b);return u.test(n)?{status:"ready",confidence:"high",reason:"input_prompt",hasActivePrompt:!1,promptDetection:t}:c&&Date.now()-c.getTime()>5e3?{status:"ready",confidence:"low",reason:"no_recent_output",hasActivePrompt:!1,promptDetection:t}:{status:"running",confidence:"low",reason:"default",hasActivePrompt:!1,promptDetection:t}}},99508:(a,b,c)=>{"use strict";c.r(b),c.d(b,{INTERACTION_SNAPSHOT_RETRY_DELAYS_MS:()=>l,__resetTerminalBroadcastState:()=>s,broadcastSessionStatus:()=>r,broadcastTerminalSnapshot:()=>m,broadcastTerminalSnapshotAfterInteraction:()=>q});var d=c(69297),e=c(88807),f=c(40467),g=c(72626),h=c(31268),i=c(93997);let j=(0,g.h)("terminal-broadcast"),k=new Map,l=[100,250,500,750];async function m(a,b,c){if((0,d.hasRoomSubscribers)(a))try{let d=(0,e.getDbInstance)(),g=await (0,f.$)(d,a,b,c);p(a,b,g,c)}catch(b){j.error("terminal-snapshot:failed",{worktreeId:a,error:b instanceof Error?b.message:String(b)})}}function n(a){return JSON.stringify([a.fullOutput??"",a.isRunning,a.thinking??!1,a.isPromptWaiting??!1,a.isSelectionListActive??!1,a.isPagerActive??!1,a.isUnclassifiedActive??!1])}async function o(a,b,c){let d=h.s.getInstance().getTool(b);return(0,i.gm)(d.getSessionName(a,c)),(0,f.$)((0,e.getDbInstance)(),a,b,c)}function p(a,b,c,e){let f=e??b,g=`${a}:${b}:${f}`;(0,d.broadcast)(a,{type:"terminal_snapshot",worktreeId:a,cliToolId:b,instanceId:f,output:c.fullOutput??"",isRunning:c.isRunning,thinking:c.thinking??!1,isPromptWaiting:c.isPromptWaiting??!1,promptData:c.promptData??null,isSelectionListActive:c.isSelectionListActive??!1,isPagerActive:c.isPagerActive??!1,isUnclassifiedActive:c.isUnclassifiedActive??!1,version:function(a){let b=(k.get(a)??0)+1;return k.set(a,b),b}(g)})}async function q(a,b,c,e=l){if((0,d.hasRoomSubscribers)(a))try{let d=await o(a,b,c),f=n(d);for(let g of(p(a,b,d,c),e)){await new Promise(a=>setTimeout(a,g));let d=await o(a,b,c);if(n(d)!==f)return void p(a,b,d,c)}}catch(d){j.error("terminal-snapshot:interaction-refresh-failed",{worktreeId:a,cliToolId:b,instanceId:c,error:d instanceof Error?d.message:String(d)})}}function r(a,b,c){(0,d.broadcast)(a,{type:"session_status_changed",worktreeId:a,isRunning:b,cliTool:c?.cliTool??null,instance:c?.instance??null})}function s(){k.clear()}}};
|
|
27
|
+
`)}catch{}a.destroy()}async function J(a,b,c,d){let e,f=(a.url||"/").split("?")[0].split("/")[2]||"";if(!f)return void I(b,"400 Bad Request");try{let a=d.getDb(),b=d.getCache(a);e=await b.getByPathPrefix(f)}catch(a){D.error("ws-proxy:cache-error",{pathPrefix:f,error:a instanceof Error?a.message:String(a)}),!b.destroyed&&b.writable&&I(b,"502 Bad Gateway");return}if(b.destroyed||!b.writable)return;if(!e)return void I(b,"404 Not Found");if(!e.enabled)return void I(b,"503 Service Unavailable");if(!e.websocketEnabled)return void I(b,"403 Forbidden");if(!H.has(e.targetHost)){D.warn("ws-proxy:ssrf-blocked",{pathPrefix:f}),I(b,"403 Forbidden");return}let g=d.netConnect({host:e.targetHost,port:e.targetPort}),h=!1,i=!1,j=()=>{if(!i){i=!0;try{g.destroy()}catch{}try{b.destroy()}catch{}}};g.on("connect",()=>{h=!0;try{let b=function(a){let b=a.method||"GET",c=a.url||"/",d=a.httpVersion||"1.1",e=[`${b} ${c} HTTP/${d}`];for(let[b,c]of Object.entries(a.headers))if(void 0!==c)if(Array.isArray(c))for(let a of c)e.push(`${b}: ${a}`);else e.push(`${b}: ${c}`);return e.join("\r\n")+"\r\n\r\n"}(a);g.write(b)}catch(a){D.error("ws-proxy:upstream-write-error",{pathPrefix:f,error:a instanceof Error?a.message:String(a)}),j();return}b.pipe(g),g.pipe(b)}),g.on("error",a=>{D.error("ws-proxy:upstream-error",{pathPrefix:f,error:a.message}),h||b.destroyed||!b.writable?j():I(b,"502 Bad Gateway")}),g.on("close",()=>{j()}),b.on("error",a=>{D.error("ws-proxy:client-error",{pathPrefix:f,error:a.message}),j()}),b.on("close",()=>{j()})}function K(a){E=new d.zu({noServer:!0}),function(a){C();let b=(0,B.wN)(b=>{a(b.worktreeId,{type:"session_status_changed",worktreeId:b.worktreeId,cliTool:b.cliToolId,instance:b.instanceId??b.cliToolId,isWaitingForResponse:b.waiting,waitingKind:b.kind??null,waitingSince:b.since})});globalThis.__waitingStatusBroadcastUnsubscribe=b}(N),a.on("upgrade",(a,b,c)=>{let d=a.url||"/";if(d.startsWith("/_next/")){b.write("HTTP/1.1 426 Upgrade Required\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"),b.destroy();return}if((0,g.Rh)()){let c=(0,g.Z2)(a.socket.remoteAddress||"");if(!(0,g.c$)(c,(0,g.nu)())){let a=c.substring(0,45);D.warn("websocket:denied",{ip:a}),b.write("HTTP/1.1 403 Forbidden\r\n\r\n"),b.destroy();return}}if((0,f.y2)()){let c=a.headers.cookie||"",d=(0,f.JT)(c)[f.aq];if(!d||!(0,f.nr)(d)){b.write("HTTP/1.1 401 Unauthorized\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"),b.destroy();return}}if(d.startsWith("/proxy/"))return void(async()=>{try{await J(a,b,c,{getDb:()=>(0,j.getDbInstance)(),getCache:a=>(0,z.Ds)(a),netConnect:a=>(0,e.connect)(a)})}catch(a){if(D.error("ws-proxy:unhandled-error",{error:a instanceof Error?a.message:String(a)}),!b.destroyed&&b.writable){try{b.write("HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\nConnection: close\r\n\r\n")}catch{}b.destroy()}}})();E.handleUpgrade(a,b,c,b=>{E.emit("connection",b,a)})}),E.on("error",a=>{D.error("server:error",{error:a.message})}),E.on("connection",a=>{let b={ws:a,worktreeIds:new Set,terminalSubscription:null};F.set(a,b),a.on("message",b=>{try{let c=JSON.parse(b.toString());L(a,c)}catch(a){D.error("message:parse-failed",{error:a instanceof Error?a.message:String(a)})}}),a.on("close",()=>{O(a)}),a.on("error",b=>{"WS_ERR_INVALID_CLOSE_CODE"===b.code||b.message?.includes("Invalid WebSocket frame")||b.message?.includes("write after end")||b.message?.includes("ECONNRESET")||b.message?.includes("EPIPE")||D.error("websocket:error",{error:b.message});try{a.terminate()}catch{}O(a)})})}function L(a,b){switch(b.type){case"subscribe":if(!b.worktreeId)return;var c=a,d=b.worktreeId;let e=F.get(c);e&&(e.worktreeIds.add(d),G.has(d)||G.set(d,new Set),G.get(d).add(c));break;case"unsubscribe":if(!b.worktreeId)return;!function(a,b){let c=F.get(a);if(!c)return;c.worktreeIds.delete(b);let d=G.get(b);d&&(d.delete(a),0===d.size&&G.delete(b))}(a,b.worktreeId);break;case"broadcast":if(!b.worktreeId)return;N(b.worktreeId,b.data);break;case"client_version":M(a,b);break;case"terminal_subscribe":Q(a,b);break;case"terminal_input":R(a,b);break;case"terminal_resize":S(a,b);break;case"terminal_unsubscribe":T(a);break;default:D.warn("message:unknown-type")}}function M(a,b){let c="string"==typeof b.version?b.version:"";if(!c)return;let e=(0,A.Sw)();if(e&&c&&"0.0.0"!==e&&"0.0.0"!==c&&e!==c&&a.readyState===d.kb.OPEN)try{a.send(JSON.stringify({type:"version_mismatch",serverVersion:e,clientVersion:c}))}catch(a){D.error("version:notify-failed",{error:a instanceof Error?a.message:String(a)})}}function N(a,b){let c=G.get(a);if(c&&0!==c.size)try{let e=JSON.stringify({type:"broadcast",worktreeId:a,data:b});c.forEach(a=>{if(a.readyState===d.kb.OPEN)try{a.send(e)}catch(a){D.error("broadcast:send-failed",{error:a instanceof Error?a.message:String(a)})}})}catch(b){D.error("broadcast:failed",{worktreeId:a,error:b instanceof Error?b.message:String(b)});try{let b=JSON.stringify({type:"broadcast",worktreeId:a,data:{error:"Message encoding error"}});c.forEach(a=>{if(a.readyState===d.kb.OPEN)try{a.send(b)}catch{}})}catch(a){D.error("fallback:send-failed",{error:a instanceof Error?a.message:String(a)})}}}function O(a){let b=F.get(a);b&&(b.worktreeIds.forEach(b=>{let c=G.get(b);c&&(c.delete(a),0===c.size&&G.delete(b))}),b.terminalSubscription&&(b.terminalSubscription.unsubscribe(),b.terminalSubscription=null),F.delete(a))}function P(a,b){a.readyState===d.kb.OPEN&&a.send(JSON.stringify(b))}async function Q(a,b){let c=F.get(a);if(!c)return void P(a,{type:"terminal_error",error:"Unauthorized WebSocket client"});if("true"!==process.env.TMUX_CONTROL_MODE_ENABLED)return void P(a,{type:"terminal_error",error:"Tmux control mode is disabled"});let{worktreeId:d,cliToolId:e}=b;if(!d||!e||!(0,h.hR)(e))return void P(a,{type:"terminal_error",error:"Invalid terminal subscription parameters"});let f=(0,j.getDbInstance)();if(!(0,k.getWorktreeById)(f,d))return void P(a,{type:"terminal_error",error:"Worktree not found"});c.terminalSubscription&&(await c.terminalSubscription.unsubscribe(),c.terminalSubscription=null);let g=i.s.getInstance().getTool(e).getSessionName(d),m=y();if(m.getSubscriberCount(g)>=4)return void P(a,{type:"terminal_error",error:"Terminal subscriber limit reached"});let n=!1,o=Date.now(),p=await m.subscribe(g,{onOutput:b=>{if(!n){n=!0;let a=Math.max(0,Math.round(Date.now()-o));l.firstOutputLatencyCount+=1,l.firstOutputLatencyTotalMs+=a,l.firstOutputLatencyLastMs=a,l.firstOutputLatencyMinMs=null===l.firstOutputLatencyMinMs?a:Math.min(l.firstOutputLatencyMinMs,a),l.firstOutputLatencyMaxMs=null===l.firstOutputLatencyMaxMs?a:Math.max(l.firstOutputLatencyMaxMs,a)}P(a,{type:"terminal_output",data:b})},onExit:({exitCode:b})=>{P(a,{type:"terminal_exit",exitCode:b})},onError:b=>{(async()=>{try{let b=await m.captureSnapshot(g,{startLine:-200});b.length>0&&P(a,{type:"terminal_output",data:b,fallback:!0})}catch{}P(a,{type:"terminal_error",error:b.message,fallback:!0})})()}});c.terminalSubscription={worktreeId:d,cliToolId:e,sessionName:g,startedAt:o,unsubscribe:p.unsubscribe},P(a,{type:"terminal_status",connected:!0,worktreeId:d,cliToolId:e})}async function R(a,b){let c=F.get(a),d=c?.terminalSubscription;if(!d)return void P(a,{type:"terminal_error",error:"No active terminal subscription"});let e="string"==typeof b.data?b.data:"";if(0===e.length||e.length>4096)return void P(a,{type:"terminal_error",error:"Invalid terminal input"});try{await y().sendInput(d.sessionName,e)}catch(b){P(a,{type:"terminal_error",error:b instanceof Error?b.message:"Failed to send terminal input"})}}async function S(a,b){let c=F.get(a),d=c?.terminalSubscription;if(d){if("number"!=typeof b.cols||!Number.isInteger(b.cols)||b.cols<20||b.cols>500||"number"!=typeof b.rows||!Number.isInteger(b.rows)||b.rows<5||b.rows>200)return void P(a,{type:"terminal_error",error:"Invalid terminal resize payload"});try{await y().resize(d.sessionName,b.cols,b.rows)}catch(b){P(a,{type:"terminal_error",error:b instanceof Error?b.message:"Failed to resize terminal"})}}}async function T(a){let b=F.get(a);if(b?.terminalSubscription){try{await b.terminalSubscription.unsubscribe()}catch{}b.terminalSubscription=null,P(a,{type:"terminal_status",connected:!1})}}function U(a,b){N(a,b)}function V(a){let b=G.get(a);return!!b&&b.size>0}function W(a,b){b.worktreeId?N(b.worktreeId,{type:a,...b}):D.warn("broadcast:missing-worktree-id")}let X="worktree_renamed";function Y(a){let b=new Map;for(let{oldId:c,newId:d}of a)c&&d&&c!==d&&b.set(c,d);if(0===b.size)return[];let c=[];for(let[a,d]of b){let b=G.get(a);b&&0!==b.size&&(G.delete(a),c.push({oldId:a,newId:d,sockets:b}))}let d=[];for(let{oldId:a,newId:b,sockets:e}of c){let c=G.get(b)??new Set;for(let d of e){c.add(d);let e=F.get(d);e&&(e.worktreeIds.delete(a),e.worktreeIds.add(b)),P(d,{type:X,worktreeId:b,previousWorktreeId:a})}G.set(b,c),d.push({oldId:a,newId:b,subscribers:e.size})}for(let a of F.values()){let c=a.terminalSubscription;if(!c)continue;let d=b.get(c.worktreeId);if(d)try{if(!(0,h.hR)(c.cliToolId))continue;let a=i.s.getInstance().getTool(c.cliToolId);c.sessionName=a.getSessionName(d),c.worktreeId=d}catch(a){D.warn("terminal:rename-failed",{worktreeId:c.worktreeId,newId:d,error:a instanceof Error?a.message:String(a)})}}return d.length>0&&D.info("rooms:migrated",{count:d.length}),d}function Z(a){for(let b of a){let a=G.get(b);a&&(a.forEach(a=>{let c=F.get(a);c&&c.worktreeIds.delete(b)}),G.delete(b))}}function $(){C(),E&&(F.forEach(a=>{a.ws.close()}),F.clear(),G.clear(),E.close(),E=null)}let _={handleMessage:L,handleClientVersion:M,handleProxyUpgrade:J,handleTerminalSubscribe:Q,handleTerminalInput:R,handleTerminalResize:S,handleTerminalUnsubscribe:T,handleDisconnect:O,registerClientForTest(a){F.set(a,{ws:a,worktreeIds:new Set,terminalSubscription:null})},getClientInfoForTest:a=>F.get(a),resetStateForTest(){F.clear(),G.clear()}}},99508:(a,b,c)=>{"use strict";c.r(b),c.d(b,{INTERACTION_SNAPSHOT_RETRY_DELAYS_MS:()=>l,__resetTerminalBroadcastState:()=>s,broadcastSessionStatus:()=>r,broadcastTerminalSnapshot:()=>m,broadcastTerminalSnapshotAfterInteraction:()=>q});var d=c(95620),e=c(88807),f=c(40467),g=c(72626),h=c(31268),i=c(93997);let j=(0,g.h)("terminal-broadcast"),k=new Map,l=[100,250,500,750];async function m(a,b,c){if((0,d.hasRoomSubscribers)(a))try{let d=(0,e.getDbInstance)(),g=await (0,f.$)(d,a,b,c);p(a,b,g,c)}catch(b){j.error("terminal-snapshot:failed",{worktreeId:a,error:b instanceof Error?b.message:String(b)})}}function n(a){return JSON.stringify([a.fullOutput??"",a.isRunning,a.thinking??!1,a.isPromptWaiting??!1,a.isSelectionListActive??!1,a.isPagerActive??!1,a.isUnclassifiedActive??!1])}async function o(a,b,c){let d=h.s.getInstance().getTool(b);return(0,i.gm)(d.getSessionName(a,c)),(0,f.$)((0,e.getDbInstance)(),a,b,c)}function p(a,b,c,e){let f=e??b,g=`${a}:${b}:${f}`;(0,d.broadcast)(a,{type:"terminal_snapshot",worktreeId:a,cliToolId:b,instanceId:f,output:c.fullOutput??"",isRunning:c.isRunning,thinking:c.thinking??!1,isPromptWaiting:c.isPromptWaiting??!1,promptData:c.promptData??null,isSelectionListActive:c.isSelectionListActive??!1,isPagerActive:c.isPagerActive??!1,isUnclassifiedActive:c.isUnclassifiedActive??!1,version:function(a){let b=(k.get(a)??0)+1;return k.set(a,b),b}(g)})}async function q(a,b,c,e=l){if((0,d.hasRoomSubscribers)(a))try{let d=await o(a,b,c),f=n(d);for(let g of(p(a,b,d,c),e)){await new Promise(a=>setTimeout(a,g));let d=await o(a,b,c);if(n(d)!==f)return void p(a,b,d,c)}}catch(d){j.error("terminal-snapshot:interaction-refresh-failed",{worktreeId:a,cliToolId:b,instanceId:c,error:d instanceof Error?d.message:String(d)})}}function r(a,b,c){(0,d.broadcast)(a,{type:"session_status_changed",worktreeId:a,isRunning:b,cliTool:c?.cliTool??null,instance:c?.instance??null})}function s(){k.clear()}}};
|