commandmate 0.33.1 → 0.33.3
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 +307 -307
- package/.next/app-path-routes-manifest.json +28 -28
- package/.next/build-manifest.json +5 -5
- package/.next/diagnostics/framework.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +15 -15
- package/.next/required-server-files.json +1 -2
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/agents/update/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/agents/versions/route_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.js.nft.json +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 +32 -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 +33 -2
- 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/capabilities/route.js +1 -1
- package/.next/server/app/api/capabilities/route.js.nft.json +1 -1
- package/.next/server/app/api/capabilities/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/hooks/agent-event/route.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 +2 -2
- 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_client-reference-manifest.js +1 -1
- package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/relays/[relayId]/cancel/route.js +1 -1
- package/.next/server/app/api/relays/[relayId]/cancel/route.js.nft.json +1 -1
- package/.next/server/app/api/relays/[relayId]/cancel/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/relays/route.js +1 -1
- package/.next/server/app/api/relays/route.js.nft.json +1 -1
- package/.next/server/app/api/relays/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/remote/pair/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/clone/[jobId]/route.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_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_client-reference-manifest.js +1 -1
- package/.next/server/app/api/settings/default-agents/route.js +1 -1
- package/.next/server/app/api/settings/default-agents/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/default-agents/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/settings/default-surface-mode/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/[id]/route.js +1 -1
- package/.next/server/app/api/skills/[id]/route.js.nft.json +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_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/route.js +1 -1
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route.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]/clear-composer/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/clear-composer/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/clear-composer/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cli-reference/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route.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]/env/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/instances/notes/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/instances/opencode/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_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/opencode/diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/opencode/session/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/opencode/share/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]/resolve-target/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_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route.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_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_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route.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_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/special-keys/route.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]/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 +103 -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_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_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/config/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/route.js +1 -1
- 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]/cancel/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/apply-default-agents/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_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_client-reference-manifest.js +1 -1
- package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
- package/.next/server/app/review/page_client-reference-manifest.js +1 -1
- package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/page_client-reference-manifest.js +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 +10 -10
- package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +28 -28
- package/.next/server/chunks/1068.js +1 -0
- package/.next/server/chunks/1210.js +1 -1
- package/.next/server/chunks/1331.js +2 -2
- package/.next/server/chunks/1366.js +5 -3
- package/.next/server/chunks/1501.js +6 -2
- package/.next/server/chunks/1886.js +2 -2
- package/.next/server/chunks/2119.js +1 -1
- package/.next/server/chunks/2445.js +1 -1
- package/.next/server/chunks/2839.js +1 -0
- package/.next/server/chunks/3123.js +1 -1
- package/.next/server/chunks/3241.js +1 -1
- package/.next/server/chunks/3323.js +1 -0
- package/.next/server/chunks/3707.js +1 -1
- package/.next/server/chunks/3708.js +1 -1
- package/.next/server/chunks/4443.js +1 -1
- package/.next/server/chunks/5220.js +1 -1
- package/.next/server/chunks/595.js +2 -2
- package/.next/server/chunks/6130.js +1 -0
- package/.next/server/chunks/650.js +1 -0
- package/.next/server/chunks/6661.js +1 -1
- package/.next/server/chunks/6781.js +1 -0
- package/.next/server/chunks/6808.js +1 -0
- package/.next/server/chunks/7875.js +3 -3
- package/.next/server/chunks/7905.js +1 -1
- package/.next/server/chunks/8918.js +107 -5
- package/.next/server/chunks/9553.js +1 -0
- package/.next/server/chunks/9627.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-manifest.json +5 -5
- 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/1255-7e5873f06b25e129.js +1 -0
- package/.next/static/chunks/{4718-2bc5cdf06573bf54.js → 4718-814f4ecfd7fcc513.js} +1 -1
- package/.next/static/chunks/6022-7a7d1760fc9814c7.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/page-3af707e74a75172b.js +1 -0
- package/.next/static/chunks/{main-6092074a0dc78280.js → main-ac91ed6e71380841.js} +1 -1
- package/.next/trace +13 -14
- package/dist/server/locales/en/worktree.json +9 -2
- package/dist/server/locales/ja/worktree.json +9 -2
- package/dist/server/src/lib/assistant-response-saver.js +168 -12
- package/dist/server/src/lib/cli-tools/vibe-local.js +10 -0
- package/dist/server/src/lib/hooks/hook-settings-generator.js +61 -1
- package/dist/server/src/lib/hooks/sources/antigravity/history.js +497 -27
- package/dist/server/src/lib/hooks/sources/antigravity/transcript.js +103 -0
- package/dist/server/src/lib/hooks/sources/claude/history.js +29 -3
- package/dist/server/src/lib/hooks/sources/codex/history.js +29 -3
- package/dist/server/src/lib/hooks/sources/command-code/history.js +29 -3
- package/dist/server/src/lib/hooks/stop-history-capture.js +30 -4
- package/dist/server/src/lib/polling/response-checker.js +258 -9
- package/dist/server/src/lib/polling/response-poller-core.js +20 -0
- package/dist/server/src/lib/polling/structured-history-gate.js +94 -10
- package/dist/server/src/lib/response-cleaner.js +84 -0
- package/dist/server/src/lib/session/agent-session-lifecycle.js +31 -1
- package/dist/server/src/lib/session/session-generation-archive.js +194 -0
- package/dist/server/src/lib/tasks/contract-message.js +83 -9
- package/dist/server/src/lib/tasks/contract-parser.js +2 -0
- package/package.json +2 -2
- package/.next/server/chunks/153.js +0 -1
- package/.next/server/chunks/21.js +0 -1
- package/.next/server/chunks/3086.js +0 -1
- package/.next/server/chunks/3270.js +0 -1
- package/.next/server/chunks/3925.js +0 -1
- package/.next/server/chunks/4299.js +0 -1
- package/.next/server/chunks/5043.js +0 -1
- package/.next/server/chunks/6306.js +0 -1
- package/.next/server/chunks/6363.js +0 -1
- package/.next/server/chunks/6491.js +0 -103
- package/.next/server/chunks/6838.js +0 -1
- package/.next/server/chunks/7366.js +0 -5
- package/.next/server/chunks/7890.js +0 -1
- package/.next/server/chunks/8063.js +0 -32
- package/.next/server/chunks/8687.js +0 -1
- package/.next/static/chunks/1255-8cb587d9170b45ed.js +0 -1
- package/.next/static/chunks/6022-2fa0b5a82d4ce7b6.js +0 -1
- package/.next/static/chunks/app/worktrees/[id]/page-13ca0ba551fe5cfb.js +0 -1
- /package/.next/static/{9lgw9hA727UMyFhXryGWG → 9x6U1h52hH_r6pOsGwI_p}/_buildManifest.js +0 -0
- /package/.next/static/{9lgw9hA727UMyFhXryGWG → 9x6U1h52hH_r6pOsGwI_p}/_ssgManifest.js +0 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
"use strict";exports.id=1501,exports.ids=[1501],exports.modules={11501:(a,b,c)=>{c.d(b,{Ky:()=>
|
|
1
|
+
"use strict";exports.id=1501,exports.ids=[1501],exports.modules={11501:(a,b,c)=>{c.d(b,{Ky:()=>m,RR:()=>p,cI:()=>o,ct:()=>q,fc:()=>k,oX:()=>n});var d=c(90384),e=c(74985);let f=`${d.uz}(commit または未 commit の変更が存在すること)`,g=`${d.uz}(commit が存在すること。未 commit の変更は作業証跡として数えない)`,h=`${d.le}(変更ファイルが scope.allow の内側に収まっていること)`,i=`${d.Q5}(タスク開始時に在ったポート・tmux セッション・$HOME / ~/.commandmate 直下のエントリが、増えても減っても不合格)`,j=`options.requireCommit (${d.aT})`;function k(a,b){let c=[];return b?.options.requireCommit&&c.push(j),a?.success.requireCommit&&c.push("success.requireCommit (task contract)"),{required:c.length>0,sources:c}}let l=[d.uz,d.le,d.Q5];function m(a){let b=a.verify.gates;if(!b)return null;let c=new Map([[d.uz,a.success.requireWorkEvidence],[d.le,a.success.requireScopeClean],[d.Q5,a.success.requireEnvClean]]);return[...l.filter(a=>!0===c.get(a)||b.includes(a)),...b.filter(a=>!l.includes(a))]}function n(a,b){return!!(0,e.Uq)(a,b).required||(m(a)?.includes(d.Q5)??!1)}function o(a){return a.verify.gateDefinitions??[]}function p(a,b){let c=a.verify.gates,e=o(a),f=[];if(!b)return e.length>0&&f.push(`verify.gateDefinitions: declared ${e.map(a=>a.id).join(", ")}, but ${d.aT} is missing or unreadable in this worktree, so no verification run can execute them`),c&&f.push(`verify.gates: declared ${c.join(", ")}, but ${d.aT} is missing or unreadable in this worktree, so the gate ids cannot be resolved`),f;let g=b.gates.map(a=>a.id),h=e.map(a=>a.id).filter(a=>g.includes(a));if(h.length>0&&f.push(`verify.gateDefinitions: gate id(s) ${h.join(", ")} are already declared in ${d.aT}. A contract may add gates, never redefine the repository's own — rename the contract gate.`),c){let a=new Set([d.uz,d.le,d.Q5,...g]),b=new Set(e.map(a=>a.id)),h=c.filter(c=>!a.has(c)&&!b.has(c));if(h.length>0){let c=[`Declared in ${d.aT}: ${[...a].join(", ")}`];b.size>0&&c.push(`in verify.gateDefinitions: ${[...b].join(", ")}`),f.push(`verify.gates: unknown gate id(s) ${h.join(", ")}. ${c.join("; ")}`)}}return f}function q(a,b){let c=["## 実行契約"];c.push(a.scope.allow.length>0?`- 変更してよいのは次のパスのみ: ${a.scope.allow.join(", ")}`:"- 変更パスの制限: なし(scope.allow が未宣言)"),a.scope.deny.length>0&&c.push(`- 変更してはならないパス: ${a.scope.deny.join(", ")}`),c.push(k(a,b).required?"- 作業完了後は必ず commit すること(未 commit の作業は未完了とみなされる)":"- 作業完了後は commit すること(ただし work-evidence は未 commit の変更も作業証跡として認めるため、commit の有無そのものは検査されない)");let j=function(a,b){if(!b)return[];let c=k(a,b).required?g:f,j=new Map([[d.uz,c],[d.le,h],[d.Q5,i]]),n=[...b.gates,...o(a)],p=(0,e.Uq)(a,b).required,q=m(a);if(!q){let b=[c];return a.success.requireScopeClean&&b.push(h),p&&b.push(i),[...b,...n.map(a=>a.command)]}let r=l.filter(a=>q.includes(a)||a===d.Q5&&p),s=q.filter(a=>!l.includes(a)),t=new Map(n.map(a=>[a.id,a.command]));return[...r,...s].map(a=>j.get(a)??t.get(a))}(a,b);return c.push(j.length>0?`- 完了条件: 次の検証コマンドがすべて成功すること: ${j.join(" / ")}`:`- 完了条件: ${d.aT} に検証ゲートが宣言されていないため、検証コマンドは無い`),`${c.join("\n")}
|
|
2
2
|
|
|
3
3
|
## タスク
|
|
4
|
-
${a.goal}`}},
|
|
4
|
+
${a.goal}`}},49987:(a,b,c)=>{c.d(b,{H:()=>l,Iq:()=>i,M:()=>k,xL:()=>o});var d=c(29021),e=c(21820),f=c(33873),g=c(55511);let h=(0,c(72626).h)("lib/verification/machine-lock"),i="locks",j="owner";function k(a,b){return(0,f.join)(b,`${a}.lock`)}function l(a=process.env){let b=a.CM_VERIFY_LOCK_ROOT;return b&&""!==b.trim()?b:(0,f.join)((0,e.homedir)(),".commandmate",i)}function m(a){try{let b=JSON.parse((0,d.readFileSync)((0,f.join)(a,j),"utf8"));if("number"!=typeof b.pid||"string"!=typeof b.token)return null;return{pid:b.pid,host:"string"==typeof b.host?b.host:"",token:b.token,acquiredAt:"number"==typeof b.acquiredAt?b.acquiredAt:0}}catch{return null}}function n(a){return a?`pid ${a.pid} on ${a.host||"unknown host"}`:null}async function o(a,b){let c=b.root??l(),i=b.pollIntervalMs??250,o=k(a,c),p=Date.now(),q=p+Math.max(0,b.timeoutMs),r=(0,g.randomUUID)();(0,d.mkdirSync)(c,{recursive:!0});let s=new Set;for(;;){if(b.shouldAbandon?.())return{acquired:!1,waitedMs:Date.now()-p,heldBy:n(m(o)),abandoned:!0};if(function(a,b){try{(0,d.mkdirSync)(a)}catch(a){if("EEXIST"===a.code)return!1;throw a}return(0,d.writeFileSync)((0,f.join)(a,j),JSON.stringify(b),{encoding:"utf8"}),!0}(o,{pid:process.pid,host:(0,e.hostname)(),token:r,acquiredAt:Date.now()}))return{acquired:!0,waitedMs:Date.now()-p,handle:{name:a,path:o,release:()=>{let a=m(o);if(!a||a.token===r)try{(0,d.rmSync)(o,{recursive:!0,force:!0})}catch(a){h.warn("machine-lock-release-failed",{lockPath:o,error:a instanceof Error?a.message:String(a)})}}}};let c=m(o);if(c&&!s.has(c.token)&&function(a){if(a.host!==(0,e.hostname)())return!1;try{return process.kill(a.pid,0),!1}catch(a){return"ESRCH"===a.code}}(c)){s.add(c.token);let a=m(o);if(a&&a.token===c.token)try{(0,d.rmSync)(o,{recursive:!0,force:!0}),h.warn("machine-lock-broken-stale",{lockPath:o,pid:c.pid})}catch{}continue}let g=Date.now();if(g>=q)return{acquired:!1,waitedMs:g-p,heldBy:n(c)};await function(a){return new Promise(b=>setTimeout(b,a))}(Math.min(i,q-g))}}},53604:(a,b,c)=>{c.d(b,{Cr:()=>k,L8:()=>i});var d=c(55511),e=c(29021),f=c(21820),g=c(33873);let h=(0,c(72626).h)("lib/verification/worktree-index"),i="worktree-index";function j(a,b){try{return(0,e.readFileSync)((0,g.join)(a,b),"utf8").trim()}catch{return null}}function k(a,b={}){let c=b.root??function(a=process.env){let b=a.CM_VERIFY_WORKTREE_INDEX_ROOT;return b&&""!==b.trim()?b:(0,g.join)((0,f.homedir)(),".commandmate",i)}();try{(0,e.mkdirSync)(c,{recursive:!0});let b=new Set;for(let d of(0,e.readdirSync)(c))if(/^\d+$/.test(d)){if(j(c,d)===a)return Number(d);b.add(Number(d))}for(let d=0;d<1024;d++)if(!b.has(d)&&function(a,b,c){try{return(0,e.writeFileSync)((0,g.join)(a,String(b)),`${c}
|
|
5
|
+
`,{encoding:"utf8",flag:"wx"}),!0}catch(d){if("EEXIST"!==d.code)throw d;return j(a,String(b))===c}}(c,d,a))return d;h.warn("worktree-index-exhausted",{worktreeId:a,root:c})}catch(b){h.warn("worktree-index-unavailable",{worktreeId:a,root:c,error:b instanceof Error?b.message:String(b)})}return Number.parseInt((0,d.createHash)("sha256").update(a).digest("hex").slice(0,8),16)%1024}},74985:(a,b,c)=>{c.d(b,{Uq:()=>i,uT:()=>n});var d=c(33873),e=c(15194),f=c(77142),g=c(90384);let h=`options.requireEnvClean (${g.aT})`;function i(a,b){let c=[];return b?.options.requireEnvClean&&c.push(h),a&&!0===a.success.requireEnvClean&&c.push("success.requireEnvClean (task contract)"),{required:c.length>0,sources:c}}let j=[...e.XH].sort((a,b)=>b.length-a.length);function k(a,b,c){switch(a){case"tmux-sessions":return function(a,b){if(!a.startsWith(f.HL))return"unattributed";let c=a.slice(f.HL.length),d=j.find(a=>c.startsWith(`${a}-`));if(!d)return"unattributed";let e=c.slice(d.length+1);return e===b||e.startsWith(`${b}-`)?"self":"other"}(b.key,c.worktreeId);case"listeners":return function(a,b){if(!a)return"unattributed";let c=(0,d.resolve)(b),e=(0,d.resolve)(a);if(e===c||e.startsWith(c+d.sep))return"self";let f=(0,d.dirname)(c);return e!==f&&e.startsWith(f+d.sep)?"other":"unattributed"}(b.anchor,c.worktreePath);default:return"unattributed"}}function l(a,b){return{key:a.key,detail:a.detail,owner:b}}function m(a,b){let c=b.slice(0,25),d=b.length-c.length,e=c.map(b=>{let c=b.detail?` ${b.detail}`:"";return` ${a} ${b.key}${c} [${b.owner}]`});return d>0&&e.push(` ... and ${d} more`),e}async function n(a){let b,c=Date.now(),d=(a,b,d)=>({status:a,exitCode:d,startedAt:c,durationMs:Date.now()-c,logTail:b});if(!a.baseline)return d("error",function(a,b){let c=a?`task ${a}`:"this run",d=b.length>0?b.join(" and "):"nothing";return`${g.Q5}: UNKNOWN — no baseline snapshot exists for ${c}, so nothing can be compared. This is NOT "the environment is unchanged": no measurement was taken. A baseline is recorded when the task is created (\`send --contract\`) and only while the gate is switched on (currently: ${d}). Switch it on, then re-send the task.`}(a.taskId,a.sources),null);let e=a.capture??(()=>(0,f._8)({worktreeId:a.worktreeId}));try{b=await e()}catch(a){return d("error",`${g.Q5}: UNKNOWN — the current snapshot could not be taken: ${a instanceof Error?a.message:String(a)}`,null)}let h=function(a,b,c){let d=f.I1.map(d=>{let e=a.probes[d],f=b.probes[d];if(!e||"ok"!==e.status)return{probeId:d,status:"unknown",reason:`baseline probe unavailable: ${e?.reason??"not recorded"}`,added:[],ignoredAdded:[],removed:[]};if(!f||"ok"!==f.status)return{probeId:d,status:"unknown",reason:`current probe unavailable: ${f?.reason??"not recorded"}`,added:[],ignoredAdded:[],removed:[]};let g=new Set(e.entries.map(a=>a.key)),h=new Set(f.entries.map(a=>a.key)),i=[],j=[];for(let a of f.entries){if(g.has(a.key))continue;let b=k(d,a,c);("other"===b?j:i).push(l(a,b))}let m=e.entries.filter(a=>!h.has(a.key)).map(a=>l(a,k(d,a,c)));return{probeId:d,status:i.length+m.length>0?"violated":"clean",reason:null,added:i,ignoredAdded:j,removed:m}});return{status:d.some(a=>"violated"===a.status)?"violated":d.some(a=>"unknown"===a.status)?"unknown":"clean",probes:d}}(a.baseline,b,a),i=`${g.Q5}: baseline=${new Date(a.baseline.capturedAt).toISOString()} status=${h.status}`,j=`${i}
|
|
6
|
+
${function(a){let b=[];for(let c of a.probes){let a=f.J6[c.probeId];if("unknown"===c.status){b.push(` ${c.probeId} UNKNOWN (${a}): ${c.reason??"no reason recorded"}`);continue}if("clean"===c.status){let d=c.ignoredAdded.length>0?` (${c.ignoredAdded.length} addition(s) attributed to another worktree)`:"";b.push(` ${c.probeId} clean (${a})${d}`);continue}for(let d of(b.push(` ${c.probeId} VIOLATED (${a}): +${c.added.length} -${c.removed.length}`),b.push(...m("+",c.added)),b.push(...m("-",c.removed)),c.ignoredAdded))b.push(` \xb7 ${d.key} (ignored: belongs to another worktree)`)}return b.join("\n")}(h)}`;return"clean"===h.status?d("passed",j,0):"unknown"===h.status?d("error",`${j}
|
|
7
|
+
UNKNOWN is not a pass: at least one probe could not be compared, so the environment was not measured.`,null):d("failed",`${j}
|
|
8
|
+
Anything listed under "+" was started or created during this task and left behind — stop it by PID and remove it. Anything under "-" existed when the task started and is now gone — it was killed or deleted; restart or restore it. Never stop a process by pattern (\`pkill -f\`): it takes every process whose command line matches, which is how the production server was stopped in #1739.`,1)}},77142:(a,b,c)=>{c.d(b,{HL:()=>u,I1:()=>m,J6:()=>n,_8:()=>A,dV:()=>E,g9:()=>F});var d=c(79646),e=c(29021),f=c(21820),g=c(33873),h=c(87447),i=c(72626),j=c(49987),k=c(53604);let l=(0,i.h)("lib/verification/env-snapshot"),m=["listeners","tmux-sessions","home-entries","commandmate-entries"],n={listeners:"CommandMate TCP listeners","tmux-sessions":"mcbd-* tmux sessions","home-entries":"$HOME entries","commandmate-entries":"~/.commandmate entries"},o={run:function(a,b){return new Promise(c=>{(0,d.execFile)(a,b,{timeout:5e3,maxBuffer:4194304,encoding:"utf8"},(b,d,e)=>b?"number"!=typeof b.code||b.killed?void c({code:null,stdout:d,stderr:e,failure:b.killed?`${a} exceeded 5000ms and was terminated`:`${a} could not be run: ${b.message}`}):void c({code:b.code,stdout:d,stderr:e,failure:null}):void c({code:0,stdout:d,stderr:e,failure:null}))})},readDir:a=>(0,e.readdirSync)(a),homeDir:()=>(0,f.homedir)()},p=/commandmate|dist\/server\/server\.js|next-server|next (dev|start)|server\.ts/i;function q(a){let b=[],c=null;for(let d of a.split("\n")){if(""===d)continue;let a=d[0],e=d.slice(1);if("p"===a){let a=Number(e);if(!Number.isInteger(a)){c=null;continue}c={pid:a,fields:new Map},b.push(c);continue}if(!c)continue;let f=c.fields.get(a);f?f.push(e):c.fields.set(a,[e])}return b}function r(a){return{status:"unavailable",entries:[],reason:a}}function s(a){let b=new Map;for(let c of a)b.has(c.key)||b.set(c.key,c);return{status:"ok",entries:[...b.values()].sort((a,b)=>a.key<b.key?-1:+(a.key>b.key)),reason:null}}async function t(a){let b=await a.run("lsof",["-nP","-iTCP","-sTCP:LISTEN","-F","pcn"]);if(null!==b.failure)return r(b.failure);if(0!==b.code&&1!==b.code)return r(`lsof exited ${b.code}: ${b.stderr.trim()||"no diagnostic output"}`);let c=q(b.stdout);if(0===c.length)return s([]);let d=await a.run("ps",["-A","-o","pid=,command="]);if(null!==d.failure||0!==d.code)return r(d.failure??`ps exited ${d.code}: ${d.stderr.trim()||"no diagnostic output"}`);let e=function(a){let b=new Map;for(let c of a.split("\n")){let a=/^\s*(\d+)\s+(.*)$/.exec(c);a&&b.set(Number(a[1]),a[2].trim())}return b}(d.stdout),f=c.filter(a=>{let b=e.get(a.pid);return void 0!==b&&p.test(b)});if(0===f.length)return s([]);let g=new Map,h=f.map(a=>String(a.pid)),i=await a.run("lsof",["-a","-d","cwd","-p",h.join(","),"-F","pn"]);if(null===i.failure&&(0===i.code||1===i.code))for(let a of q(i.stdout)){let[b]=a.fields.get("n")??[];b&&g.set(a.pid,b)}let j=[];for(let a of f){let b=a.fields.get("c")?.[0]??"unknown";for(let c of a.fields.get("n")??[]){let d=function(a){let b=a.lastIndexOf(":");if(b<0)return null;let c=a.slice(b+1);return/^\d+$/.test(c)?c:null}(c);d&&j.push({key:`tcp/${d}`,detail:`${b} pid=${a.pid}`,anchor:g.get(a.pid)??null})}}return s(j)}let u="mcbd-";async function v(a){let b=await a.run("tmux",["list-sessions","-F","#{session_name}"]);return null!==b.failure?r(b.failure):0!==b.code?/no server running|error connecting to|no sessions/i.test(b.stderr)?s([]):r(`tmux list-sessions exited ${b.code}: ${b.stderr.trim()||"no diagnostic output"}`):s(b.stdout.split("\n").map(a=>a.trim()).filter(a=>a.startsWith(u)).map(a=>({key:a,detail:null,anchor:null})))}let w=[/-wal$/,/-shm$/,/-journal$/,/^\.DS_Store$/],x="env-snapshots",y=[j.Iq,k.L8];function z(a,b,{missingIsEmpty:c,alsoIgnored:d=[]}){let e;try{e=a.readDir(b)}catch(d){let a=d.code;if(c&&"ENOENT"===a)return s([]);return r(`could not list ${b}: ${d.message}`)}return s(e.filter(a=>!(a===x||w.some(b=>b.test(a)))&&!d.includes(a)).map(a=>({key:a,detail:null,anchor:null})))}async function A(a){let b=a.deps??o,[c,d]=await Promise.all([t(b).catch(a=>r(`listeners probe threw: ${a.message}`)),v(b).catch(a=>r(`tmux probe threw: ${a.message}`))]);return{version:1,capturedAt:a.now??Date.now(),worktreeId:a.worktreeId,probes:{listeners:c,"tmux-sessions":d,"home-entries":z(b,b.homeDir(),{missingIsEmpty:!1}),"commandmate-entries":z(b,(0,g.join)(b.homeDir(),".commandmate"),{missingIsEmpty:!0,alsoIgnored:y})}}}function B(){return(0,g.join)((0,g.dirname)((0,h._$)().CM_DB_PATH),x)}let C=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function D(a,b){return C.test(b)?(0,g.join)(a,`${b}.json`):null}function E(a,b,c=B()){let d=D(c,a);if(!d)return l.warn("env-snapshot-rejected-task-id",{taskId:a}),!1;try{return(0,e.mkdirSync)(c,{recursive:!0,mode:448}),(0,e.writeFileSync)(d,JSON.stringify(b),{encoding:"utf8",mode:384}),!function(a,b){let c;try{c=(0,e.readdirSync)(a)}catch{return}for(let d of c){if(!d.endsWith(".json"))continue;let c=(0,g.join)(a,d);try{b-(0,e.statSync)(c).mtimeMs>2592e6&&(0,e.rmSync)(c,{force:!0})}catch{}}}(c,b.capturedAt),!0}catch(b){return l.warn("env-snapshot-write-failed",{taskId:a,error:b instanceof Error?b.message:String(b)}),!1}}function F(a,b=B()){let c=D(b,a);if(!c)return null;try{let a=JSON.parse((0,e.readFileSync)(c,"utf8"));if(!function(a){if("object"!=typeof a||null===a||1!==a.version||"number"!=typeof a.capturedAt)return!1;let b=a.probes;return"object"==typeof b&&null!==b&&m.every(a=>{var c;return"object"==typeof(c=b[a])&&null!==c&&("ok"===c.status||"unavailable"===c.status)&&Array.isArray(c.entries)})}(a))return null;return a}catch{return null}}},90384:(a,b,c)=>{c.d(b,{D:()=>n,Q5:()=>i,Tc:()=>l,UL:()=>y,Yp:()=>s,aT:()=>k,iE:()=>j,le:()=>h,sN:()=>m,uz:()=>g,yR:()=>z});var d=c(29021),e=c(33873),f=c(4689);let g="work-evidence",h="scope",i="env-clean",j=[g,h,i],k=".commandmate/verify.yaml";function l(a,b=[]){return[g,h,...a.options.requireEnvClean?[i]:[],...a.gates.map(a=>a.id),...b.map(a=>a.id)]}let m=600,n=/^[a-z0-9][a-z0-9-]{0,31}$/,o=/^[A-Za-z0-9_.-]+$/,p=["version","gates","options"],q=["id","command","timeoutSec","mutex","retryOnFail","flakyIsPass"],r=["baseRef","skipInPrimaryCheckout","maxLogTailBytes","requireCommit","requireEnvClean"];class s extends Error{constructor(a){super(`invalid verify config:
|
|
5
9
|
${a.map(a=>` - ${a}`).join("\n")}`),this.name="VerifyConfigError",this.issues=a}}function t(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function u(a){return"number"==typeof a?Number.isInteger(a)?a:null:"string"==typeof a&&/^-?\d+$/.test(a)?Number(a):null}function v(a){return"boolean"==typeof a?a:"true"===a||"false"!==a&&null}function w(a){return void 0===a?"nothing":null===a?"null":"string"==typeof a?JSON.stringify(a):Array.isArray(a)?"a list":"object"==typeof a?"a mapping":String(a)}function x(a,b,c,d){for(let e of Object.keys(a))b.includes(e)||d.push(`${c}: unknown key "${e}" (v1 is a closed set)`)}function y(a,b,c){if(!Array.isArray(a))return c.push(`${b}: must be a list (got ${w(a)})`),[];let d=[],e=new Set;return a.forEach((a,f)=>{!function(a,b,c,d,e){let f,g,h,i=e.length;if(!t(a))return e.push(`${b}: must be a mapping (got ${w(a)})`);x(a,q,b,e),"string"!=typeof a.id||""===a.id?e.push(`${b}.id: required, must be a non-empty string (got ${w(a.id)})`):n.test(a.id)?j.includes(a.id)?e.push(`${b}.id: "${a.id}" is reserved for a built-in gate`):c.has(a.id)?e.push(`${b}.id: duplicate gate id "${a.id}"`):c.add(a.id):e.push(`${b}.id: "${a.id}" must match ${n.source}`),("string"!=typeof a.command||""===a.command.trim())&&e.push(`${b}.command: required, must be a non-empty string (got ${w(a.command)})`);let k=m;if(void 0!==a.timeoutSec){let c=u(a.timeoutSec);null===c?e.push(`${b}.timeoutSec: must be an integer (got ${w(a.timeoutSec)})`):c<1||c>7200?e.push(`${b}.timeoutSec: must be 1..7200 (got ${c})`):k=c}if(void 0!==a.mutex&&("string"!=typeof a.mutex||""===a.mutex?e.push(`${b}.mutex: must be a non-empty string (got ${w(a.mutex)})`):a.mutex.length>64?e.push(`${b}.mutex: must be at most 64 characters (got ${a.mutex.length})`):o.test(a.mutex)?f=a.mutex:e.push(`${b}.mutex: "${a.mutex}" must match ${o.source}`)),void 0!==a.retryOnFail){let c=u(a.retryOnFail);null===c?e.push(`${b}.retryOnFail: must be an integer (got ${w(a.retryOnFail)})`):c<0||c>1?e.push(`${b}.retryOnFail: must be 0 or 1 (got ${c})`):g=c}if(void 0!==a.flakyIsPass){let c=v(a.flakyIsPass);null===c?e.push(`${b}.flakyIsPass: must be true or false (got ${w(a.flakyIsPass)})`):c&&1!==g?e.push(`${b}.flakyIsPass: true requires retryOnFail: 1 (without a retry a gate can never be FLAKY)`):h=c}if(e.length===i){let b={id:a.id,command:a.command,timeoutSec:k};void 0!==f&&(b.mutex=f),void 0!==g&&(b.retryOnFail=g),void 0!==h&&(b.flakyIsPass=h),d.push(b)}}(a,`${b}[${f}]`,e,d,c)}),d}function z(a){let b,c=(0,e.join)(a,k);try{b=(0,d.readFileSync)(c,"utf8")}catch(a){if("ENOENT"===a.code)return null;throw new s([`${c}: ${a.message}`])}return function(a,b){var c;let d;try{d=(0,f.qg)(a)}catch(a){throw new s([`${b}: YAML parse error: ${a.message}`])}if(!t(d))throw new s([`${b}: expected a YAML mapping at the top level (got ${w(d)})`]);let e=[];x(d,p,"top level",e),"version"in d?1!==u(d.version)&&e.push(`version: must be 1 (got ${w(d.version)})`):e.push('version: required, v1 configs must declare "version: 1"');let g=(c=d.gates,null==c?(e.push("gates: required, at least one gate must be defined"),[]):Array.isArray(c)&&0===c.length?(e.push("gates: at least one gate must be defined"),[]):y(c,"gates",e)),h=function(a,b){let c={baseRef:null,skipInPrimaryCheckout:!0,maxLogTailBytes:8192,requireCommit:!1,requireEnvClean:!1};if(null==a)return c;if(!t(a))return b.push(`options: must be a mapping (got ${w(a)})`),c;if(x(a,r,"options",b),void 0!==a.baseRef&&("string"!=typeof a.baseRef||""===a.baseRef.trim()?b.push(`options.baseRef: must be a non-empty string (got ${w(a.baseRef)})`):c.baseRef=a.baseRef),void 0!==a.skipInPrimaryCheckout){let d=v(a.skipInPrimaryCheckout);null===d?b.push(`options.skipInPrimaryCheckout: must be true or false (got ${w(a.skipInPrimaryCheckout)})`):c.skipInPrimaryCheckout=d}if(void 0!==a.requireCommit){let d=v(a.requireCommit);null===d?b.push(`options.requireCommit: must be true or false (got ${w(a.requireCommit)})`):c.requireCommit=d}if(void 0!==a.requireEnvClean){let d=v(a.requireEnvClean);null===d?b.push(`options.requireEnvClean: must be true or false (got ${w(a.requireEnvClean)})`):c.requireEnvClean=d}if(void 0!==a.maxLogTailBytes){let d=u(a.maxLogTailBytes);null===d?b.push(`options.maxLogTailBytes: must be an integer (got ${w(a.maxLogTailBytes)})`):d<0||d>1048576?b.push(`options.maxLogTailBytes: must be 0..1048576 (got ${d})`):c.maxLogTailBytes=d}return c}(d.options,e);if(e.length>0)throw new s(e);return{version:1,gates:g,options:h}}(b,c)}}};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";exports.id=1886,exports.ids=[1886],exports.modules={17287:(a,b,c)=>{c.d(b,{CD:()=>g,nL:()=>f});var d=c(24455);let e=globalThis.__permissionDecisions??(globalThis.__permissionDecisions=new Map);function f(a,b,c,f){e.set((0,d.v7)(a,b,c),f)}function g(a,b,c){return e.get((0,d.v7)(a,b,c))??null}},23365:(a,b,c)=>{c.d(b,{H:()=>g,y:()=>h});var d=c(16983),e=c(34405),f=c(15194);let g=200;function h(a){var b;return{statusLines:"opencode"===(b=a)?d.xT:"gemini"===b?g:e.G,usesAlternateScreen:(0,f.VA)(a)}}},34405:(a,b,c)=>{c.d(b,{G:()=>e,_:()=>d});let d=1e4,e=1e3},39333:(a,b,c)=>{c.d(b,{$Y:()=>g,Bg:()=>i,HB:()=>f,df:()=>h,f9:()=>d});let d=[".png",".jpg",".jpeg",".gif",".webp",".svg"],e=[{extension:".png",mimeType:"image/png",magicBytes:[137,80,78,71]},{extension:".jpg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".jpeg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".gif",mimeType:"image/gif",magicBytes:[71,73,70,56]},{extension:".webp",mimeType:"image/webp",magicBytes:[82,73,70,70]},{extension:".svg",mimeType:"image/svg+xml"}];function f(a){return a?a.startsWith(".")?a.toLowerCase():"."+a.toLowerCase():""}function g(a){let b=f(a),c=e.find(a=>a.extension===b);return c?.mimeType||"application/octet-stream"}function h(a){if(!a)return!1;let b=f(a);return d.includes(b)}function i(a,b){if(b.length>0x1400000)return{valid:!1,error:"File size exceeds 20MB limit"};if(".svg"===f(a)){var c;return(c=b.toString("utf-8")).includes("<svg")||c.startsWith("<?xml")?/<script[\s>]/i.test(c)?{valid:!1,error:"SVG contains script tags"}:/\s+on\w+\s*=/i.test(c)?{valid:!1,error:"SVG contains event handler attributes"}:/(?:xlink:)?href\s*=\s*["']?\s*(?:javascript|data|vbscript):/i.test(c)?{valid:!1,error:"SVG contains dangerous URI scheme"}:/<foreignObject[\s>]/i.test(c)?{valid:!1,error:"SVG contains foreignObject element"}:{valid:!0}:{valid:!1,error:"Invalid SVG format"}}return!function(a,b){let c=f(a),d=e.find(a=>a.extension===c);if(!d?.magicBytes)return".svg"===c;let g=d.magicBytesOffset||0;return!(b.length<g+d.magicBytes.length)&&d.magicBytes.every((a,c)=>b[g+c]===a)}(a,b)?{valid:!1,error:"Invalid image magic bytes"}:{valid:!0}}d.filter(a=>".svg"!==a).map(a=>g(a)).filter(a=>"application/octet-stream"!==a).join(",")},41466:(a,b,c)=>{c.d(b,{Ui:()=>as,TZ:()=>ar});var d=c(81886),e=c(8953),f=c(79892),g=c(85164),h=c(40236),i=c(93997),j=c(29021),k=c(21820),l=c(33873),m=c(8004),n=c(72626);let o=(0,n.h)("cli-tools/opencode-config"),p=/^[a-zA-Z0-9._:/-]{1,100}$/,q=/^[a-zA-Z0-9._:/@-]{1,200}$/,r="CM_OPENCODE_LOCAL_PROVIDER_CONFIG",s="OPENCODE_CONFIG",t=["opencode.json","opencode.jsonc",l.join(".opencode","opencode.json"),l.join(".opencode","opencode.jsonc")],u=["opencode.json","opencode.jsonc"];async function v(){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 o.warn("ollama-api-returned"),{};let e=await d.text();if(e.length>1048576)return o.warn("ollama-api-response"),{};let f=JSON.parse(e);if(!f||!Array.isArray(f.models))return o.warn("invalid-ollama-api"),{};for(let b of f.models.slice(0,100))"string"==typeof b?.name&&p.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?o.warn("ollama-api-timeout"):o.warn("failed-to-fetch")}return a}async function w(){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 o.warn("lm-studio-api"),{};let e=await d.text();if(e.length>1048576)return o.warn("lm-studio-api"),{};let f=JSON.parse(e);if(!f||!Array.isArray(f.data))return o.warn("invalid-lm-studio"),{};for(let b of f.data.slice(0,100))"string"==typeof b?.id&&q.test(b.id)&&(a[b.id]={name:b.id})}catch(a){a instanceof Error&&"AbortError"===a.name?o.warn("lm-studio-api"):o.warn("failed-to-fetch")}return a}function x(a=process.env){let b=l.join(k.homedir(),".config");return l.join((0,m.T)(a.XDG_CONFIG_HOME,b,"XDG_CONFIG_HOME"),"opencode")}async function y(){let[a,b]=await Promise.all([v(),w()]),c={};return Object.keys(a).length>0&&(c.ollama={npm:"@ai-sdk/openai-compatible",name:"Ollama (local)",options:{baseURL:"http://localhost:11434/v1"},models:a}),Object.keys(b).length>0&&(c.lmstudio={npm:"@ai-sdk/openai-compatible",name:"LM Studio (local)",options:{baseURL:"http://localhost:1234/v1"},models:b}),c}async function z(a){let b=function(a=process.env){let b=(a[r]??"").trim().toLowerCase();return"worktree"===b||"project"===b?"worktree":"global"===b||"user"===b?"global":(""!==b&&"off"!==b&&"0"!==b&&"false"!==b&&"none"!==b&&o.warn("opencode-config-mode-unrecognised",{variable:r,value:b}),"off")}();if("off"===b)return{written:!1,configPath:null,reason:"disabled"};let c="worktree"===b?function(a){let b=l.resolve(a);try{if(!j.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 j.realpathSync(b)}(a):null,d=function(a,b=process.env){if(""!==(b[s]??"").trim())return`env:${s}`;if(null!==a)for(let b of t){let c=l.join(a,b);if(j.existsSync(c))return c}let c=x(b);for(let a of u){let b=l.join(c,a);if(j.existsSync(b))return b}return null}(c);if(null!==d)return o.info("opencode-config-generation-skipped",{mode:b,owned:d}),{written:!1,configPath:null,reason:"existing-config"};let e=c??x(),f=l.join(e,"opencode.json"),g=await y();if(0===Object.keys(g).length)return{written:!1,configPath:null,reason:"no-providers"};try{"global"===b&&j.mkdirSync(e,{recursive:!0}),j.writeFileSync(f,JSON.stringify({$schema:"https://opencode.ai/config.json",provider:g},null,2),{encoding:"utf-8",flag:"wx"})}catch(a){if("EEXIST"===a.code)return{written:!1,configPath:null,reason:"existing-config"};return o.warn("failed-to-write-opencodejson:error-insta"),{written:!1,configPath:null,reason:"write-failed"}}return o.info("opencode-config-generated",{mode:b,configPath:f}),{written:!0,configPath:f,reason:"written"}}var A=c(16983),B=c(79646),C=c(28354),D=c(39333),E=c(4970),F=c(49791),G=c(62887),H=c(72272),I=c(49154),J=c(48083),K=c(36051),L=c(57510),M=c(129),N=c(75356),O=c(98211),P=c(90488),Q=c(85322);let R=(0,n.h)("lib/hooks/sources/opencode/ingest");async function S(a,b,c){let d=(0,M.VM)(Q.k),e=(0,O.Lu)(b.raw,b.receivedAt);if(!e)return R.info("opencode-permission-unparsed",{worktreeId:a.worktreeId,instanceId:c}),!1;let f=await (0,H.t)(d,a,e,d.parsePermissionRequest(b.raw));return R.info("opencode-permission-decided",{worktreeId:a.worktreeId,instanceId:c,decisionId:e.id,behavior:f.behavior,reason:f.reason,delivered:f.delivered,settled:f.settled}),f.settled}async function T(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(1356),c.e(6065),c.e(1191),c.e(6337),c.e(1501),c.e(7366),c.e(3707),c.e(5043)]).then(c.bind(c,35043))]),g=d(),h=e(g,a.worktreeId)??null;if(!h)return void R.info("opencode-stop-unresolved-target",{worktreeId:a.worktreeId});let i=await f(g,h,Q.k,b);R.info("opencode-stop-applied",{worktreeId:a.worktreeId,instanceId:b,taskId:i.taskId,taskEventApplied:i.taskEventApplied,verificationRunId:i.verificationRunId})}async function U(a,b){let c=a.instanceId??Q.k;try{let d=(0,M.VM)(Q.k),e=(0,J.qo)({worktreeId:a.worktreeId,cliToolId:Q.k,instanceId:c,event:b.event,detail:b.detail,sessionId:b.conversationId,at:b.receivedAt,identity:d.eventIdentityOf(b.raw),identityKind:d.capabilities.eventIdentity});if(e.duplicate)return void R.info("opencode-event-duplicate-dropped",{worktreeId:a.worktreeId,instanceId:c,event:b.event,detail:b.detail,by:e.by});let f={event:b.event,at:b.receivedAt,detail:b.detail?.slice(0,G.h9)??null,sessionId:b.conversationId,message:(function(a){let b=(0,L.Qd)(a.raw.properties)?a.raw.properties:{};if(a.detail===N.aF)return(0,L.NZ)(b,["metadata","command"])??(0,L.O2)(b,"permission");if(a.detail===N.Tm){let a=b.questions;return Array.isArray(a)&&(0,L.Qd)(a[0])?(0,L.O2)(a[0],"question"):null}return a.detail===N.vE?(0,L.NZ)(b,["error","data","message"])??(0,L.NZ)(b,["error","name"]):null})(b)?.slice(0,K.lY)??null,model:b.model},g={sessionStartMayArriveLate:d.capabilities.sessionStartMayArriveLate};if("notification"===b.event&&b.detail===N.aF){f.decisionId=(0,L.O2)((0,L.Qd)(b.raw.properties)?b.raw.properties:{},"id");let d=(0,O.LF)(b.raw,b.receivedAt);f.toolName=d?.toolName??null,f.decisionPatterns=d?.patterns??null,f.promptSettled=await S(a,b,c),(0,J.recordAgentEvent)(a.worktreeId,Q.k,c,f,g);return}if("notification"===b.event&&b.detail===N.C8){f.decisionId=(0,N.Mn)(b.raw),f.promptSettled=!!(0,M.VM)(Q.k).capabilities.permissionReplyReleasesPrompt||(R.info("opencode-permission-reply-not-releasing",{worktreeId:a.worktreeId,instanceId:c,reason:"capability-permissionReplyReleasesPrompt-false"}),!1),(0,J.recordAgentEvent)(a.worktreeId,Q.k,c,f,g),R.info("opencode-permission-reply-observed",{worktreeId:a.worktreeId,instanceId:c,decisionId:f.decisionId,released:f.promptSettled});return}if((0,J.recordAgentEvent)(a.worktreeId,Q.k,c,f,g),"notification"===b.event&&b.detail===N.Tm){let d=(0,M.VM)(Q.k).parseQuestion(b.raw);d&&((0,J._N)(a.worktreeId,Q.k,c,d,b.receivedAt),(0,J.MU)(a.worktreeId,Q.k,c,{toolName:I.GF,decisionId:d.promptId,detail:N.Tm},b.receivedAt),R.info("opencode-question-recorded",{worktreeId:a.worktreeId,instanceId:c,decisionId:d.promptId,questionCount:d.questions.length,optionCounts:d.questions.map(a=>a.choices.length)})),await (0,P.Vo)(a,c,f.message??null,b.receivedAt);return}if("stop"===b.event)return void await T(a,c);"notification"===b.event&&b.detail===N.vE&&await (0,P.dJ)(a,c,(0,L.NZ)((0,L.Qd)(b.raw.properties)?b.raw.properties:{},["error","name"]),f.message??null,b.conversationId,b.receivedAt),R.info("opencode-event-received",{worktreeId:a.worktreeId,instanceId:c,event:b.event,detail:b.detail})}catch(d){R.error("opencode-event-ingest-failed",{worktreeId:a.worktreeId,instanceId:c,event:b.event,error:d instanceof Error?d.message:String(d)})}}var V=c(84574),W=c(85965),X=c(53163);let Y=(0,n.h)("lib/hooks/sources/opencode/runtime");function Z(a,b){return{worktreeId:a,cliToolId:"opencode",instanceId:b}}async function $(a,b){try{return await (0,V.CU)(a,b)}catch(b){return Y.warn("opencode-port-reserve-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)}),null}}let _=[0,500,1e3,2e3,4e3];async function aa(a,b){for(let[c,d]of _.entries()){d>0&&await new Promise(a=>setTimeout(a,d));let e=await (0,F.sc)(b);if("healthy"===e.kind)return c>0&&Y.info("opencode-server-reachable-after-retry",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,attempt:c}),e.health;if("rejected"===e.kind){Y.warn("opencode-server-refused-commandmate",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,status:e.status,consequence:"structured events are off for this session; the scraper decides"});break}}return null}async function ab(a){try{let b=(0,V.hC)(a);if(null===b)return!1;if((0,X.wb)(a))return!0;let c=await aa(a,b);if(!c)return Y.info("opencode-server-not-reachable",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,attempts:_.length}),!1;await W.cC.subscribe(a,b=>{U(a,b)});let d=await ac(a);return Y.info("opencode-event-stream-attached",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,version:c.version,activity:d}),!0}catch(b){return Y.warn("opencode-event-stream-attach-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)}),!1}}async function ac(a){let b=null;try{b=await W.cC.probeActivity(a)}catch(b){Y.debug("opencode-activity-probe-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,error:b instanceof Error?b.message:String(b)})}return(0,X.yn)(a,b,Date.now()),b}async function ad(a,b){try{if((0,X.wb)(a))return!0;let c=await (0,V.jp)(a,b);if(null===c)return!1;return await ab(a)}catch(b){return Y.warn("opencode-event-stream-resume-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)}),!1}}async function ae(a){let b=a.instanceId??a.cliToolId;try{let c=(0,V.hC)(a);if(null===c)return!1;let d=(0,X.lf)(a);if("live"!==d.state)return Y.info("opencode-abort-skipped-not-live",{worktreeId:a.worktreeId,instanceId:b,port:c,liveness:d.state}),!1;let e=(0,X.ym)(a);if(null===e)return Y.info("opencode-abort-skipped-no-session",{worktreeId:a.worktreeId,instanceId:b,port:c}),!1;let f=(0,X.H1)(a,e,2e3);if(!await (0,F.UR)(c,e))return f.cancel(),Y.warn("opencode-abort-rejected",{worktreeId:a.worktreeId,instanceId:b,port:c,sessionId:e}),!1;if(!await f.seen)return Y.warn("opencode-abort-unconfirmed",{worktreeId:a.worktreeId,instanceId:b,port:c,sessionId:e,timeoutMs:2e3}),!1;return Y.info("opencode-abort-confirmed",{worktreeId:a.worktreeId,instanceId:b,port:c,sessionId:e}),!0}catch(c){return Y.warn("opencode-abort-failed",{worktreeId:a.worktreeId,instanceId:b,error:c instanceof Error?c.message:String(c)}),!1}}async function af(a){try{await (0,X.FN)(a),(0,V.kE)(a)}catch(b){Y.warn("opencode-event-stream-release-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)})}}var ag=c(18529),ah=c(70849),ai=c(27939),aj=c(93949),ak=c(20610),al=c(78099);let am=(0,n.h)("cli-tools/opencode"),an=(0,C.promisify)(B.execFile);function ao(a){return a instanceof Error?a.message:String(a)}function ap(){let a=process.env[A.ao],b=(0,A._u)();return void 0!==a&&String(b)!==a.trim()?am.warn("opencode-pane-width-rejected",{requested:a,applied:b}):b>=A.Lg&&am.warn("opencode-pane-width-sidebar-visible",{width:b,sidebarMinWidth:A.Lg}),b}let aq=[0,50,100,200];function ar(a,b){return a?`${a}
|
|
1
|
+
"use strict";exports.id=1886,exports.ids=[1886],exports.modules={17287:(a,b,c)=>{c.d(b,{CD:()=>g,nL:()=>f});var d=c(24455);let e=globalThis.__permissionDecisions??(globalThis.__permissionDecisions=new Map);function f(a,b,c,f){e.set((0,d.v7)(a,b,c),f)}function g(a,b,c){return e.get((0,d.v7)(a,b,c))??null}},23365:(a,b,c)=>{c.d(b,{H:()=>g,y:()=>h});var d=c(16983),e=c(34405),f=c(15194);let g=200;function h(a){var b;return{statusLines:"opencode"===(b=a)?d.xT:"gemini"===b?g:e.G,usesAlternateScreen:(0,f.VA)(a)}}},34405:(a,b,c)=>{c.d(b,{G:()=>e,_:()=>d});let d=1e4,e=1e3},39333:(a,b,c)=>{c.d(b,{$Y:()=>g,Bg:()=>i,HB:()=>f,df:()=>h,f9:()=>d});let d=[".png",".jpg",".jpeg",".gif",".webp",".svg"],e=[{extension:".png",mimeType:"image/png",magicBytes:[137,80,78,71]},{extension:".jpg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".jpeg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".gif",mimeType:"image/gif",magicBytes:[71,73,70,56]},{extension:".webp",mimeType:"image/webp",magicBytes:[82,73,70,70]},{extension:".svg",mimeType:"image/svg+xml"}];function f(a){return a?a.startsWith(".")?a.toLowerCase():"."+a.toLowerCase():""}function g(a){let b=f(a),c=e.find(a=>a.extension===b);return c?.mimeType||"application/octet-stream"}function h(a){if(!a)return!1;let b=f(a);return d.includes(b)}function i(a,b){if(b.length>0x1400000)return{valid:!1,error:"File size exceeds 20MB limit"};if(".svg"===f(a)){var c;return(c=b.toString("utf-8")).includes("<svg")||c.startsWith("<?xml")?/<script[\s>]/i.test(c)?{valid:!1,error:"SVG contains script tags"}:/\s+on\w+\s*=/i.test(c)?{valid:!1,error:"SVG contains event handler attributes"}:/(?:xlink:)?href\s*=\s*["']?\s*(?:javascript|data|vbscript):/i.test(c)?{valid:!1,error:"SVG contains dangerous URI scheme"}:/<foreignObject[\s>]/i.test(c)?{valid:!1,error:"SVG contains foreignObject element"}:{valid:!0}:{valid:!1,error:"Invalid SVG format"}}return!function(a,b){let c=f(a),d=e.find(a=>a.extension===c);if(!d?.magicBytes)return".svg"===c;let g=d.magicBytesOffset||0;return!(b.length<g+d.magicBytes.length)&&d.magicBytes.every((a,c)=>b[g+c]===a)}(a,b)?{valid:!1,error:"Invalid image magic bytes"}:{valid:!0}}d.filter(a=>".svg"!==a).map(a=>g(a)).filter(a=>"application/octet-stream"!==a).join(",")},41466:(a,b,c)=>{c.d(b,{Ui:()=>as,TZ:()=>ar});var d=c(81886),e=c(8953),f=c(79892),g=c(85164),h=c(40236),i=c(93997),j=c(29021),k=c(21820),l=c(33873),m=c(8004),n=c(72626);let o=(0,n.h)("cli-tools/opencode-config"),p=/^[a-zA-Z0-9._:/-]{1,100}$/,q=/^[a-zA-Z0-9._:/@-]{1,200}$/,r="CM_OPENCODE_LOCAL_PROVIDER_CONFIG",s="OPENCODE_CONFIG",t=["opencode.json","opencode.jsonc",l.join(".opencode","opencode.json"),l.join(".opencode","opencode.jsonc")],u=["opencode.json","opencode.jsonc"];async function v(){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 o.warn("ollama-api-returned"),{};let e=await d.text();if(e.length>1048576)return o.warn("ollama-api-response"),{};let f=JSON.parse(e);if(!f||!Array.isArray(f.models))return o.warn("invalid-ollama-api"),{};for(let b of f.models.slice(0,100))"string"==typeof b?.name&&p.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?o.warn("ollama-api-timeout"):o.warn("failed-to-fetch")}return a}async function w(){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 o.warn("lm-studio-api"),{};let e=await d.text();if(e.length>1048576)return o.warn("lm-studio-api"),{};let f=JSON.parse(e);if(!f||!Array.isArray(f.data))return o.warn("invalid-lm-studio"),{};for(let b of f.data.slice(0,100))"string"==typeof b?.id&&q.test(b.id)&&(a[b.id]={name:b.id})}catch(a){a instanceof Error&&"AbortError"===a.name?o.warn("lm-studio-api"):o.warn("failed-to-fetch")}return a}function x(a=process.env){let b=l.join(k.homedir(),".config");return l.join((0,m.T)(a.XDG_CONFIG_HOME,b,"XDG_CONFIG_HOME"),"opencode")}async function y(){let[a,b]=await Promise.all([v(),w()]),c={};return Object.keys(a).length>0&&(c.ollama={npm:"@ai-sdk/openai-compatible",name:"Ollama (local)",options:{baseURL:"http://localhost:11434/v1"},models:a}),Object.keys(b).length>0&&(c.lmstudio={npm:"@ai-sdk/openai-compatible",name:"LM Studio (local)",options:{baseURL:"http://localhost:1234/v1"},models:b}),c}async function z(a){let b=function(a=process.env){let b=(a[r]??"").trim().toLowerCase();return"worktree"===b||"project"===b?"worktree":"global"===b||"user"===b?"global":(""!==b&&"off"!==b&&"0"!==b&&"false"!==b&&"none"!==b&&o.warn("opencode-config-mode-unrecognised",{variable:r,value:b}),"off")}();if("off"===b)return{written:!1,configPath:null,reason:"disabled"};let c="worktree"===b?function(a){let b=l.resolve(a);try{if(!j.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 j.realpathSync(b)}(a):null,d=function(a,b=process.env){if(""!==(b[s]??"").trim())return`env:${s}`;if(null!==a)for(let b of t){let c=l.join(a,b);if(j.existsSync(c))return c}let c=x(b);for(let a of u){let b=l.join(c,a);if(j.existsSync(b))return b}return null}(c);if(null!==d)return o.info("opencode-config-generation-skipped",{mode:b,owned:d}),{written:!1,configPath:null,reason:"existing-config"};let e=c??x(),f=l.join(e,"opencode.json"),g=await y();if(0===Object.keys(g).length)return{written:!1,configPath:null,reason:"no-providers"};try{"global"===b&&j.mkdirSync(e,{recursive:!0}),j.writeFileSync(f,JSON.stringify({$schema:"https://opencode.ai/config.json",provider:g},null,2),{encoding:"utf-8",flag:"wx"})}catch(a){if("EEXIST"===a.code)return{written:!1,configPath:null,reason:"existing-config"};return o.warn("failed-to-write-opencodejson:error-insta"),{written:!1,configPath:null,reason:"write-failed"}}return o.info("opencode-config-generated",{mode:b,configPath:f}),{written:!0,configPath:f,reason:"written"}}var A=c(16983),B=c(79646),C=c(28354),D=c(39333),E=c(1305),F=c(49791),G=c(62887),H=c(72272),I=c(49154),J=c(48083),K=c(36051),L=c(57510),M=c(129),N=c(75356),O=c(98211),P=c(90488),Q=c(85322);let R=(0,n.h)("lib/hooks/sources/opencode/ingest");async function S(a,b,c){let d=(0,M.VM)(Q.k),e=(0,O.Lu)(b.raw,b.receivedAt);if(!e)return R.info("opencode-permission-unparsed",{worktreeId:a.worktreeId,instanceId:c}),!1;let f=await (0,H.t)(d,a,e,d.parsePermissionRequest(b.raw));return R.info("opencode-permission-decided",{worktreeId:a.worktreeId,instanceId:c,decisionId:e.id,behavior:f.behavior,reason:f.reason,delivered:f.delivered,settled:f.settled}),f.settled}async function T(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(1356),c.e(6065),c.e(1191),c.e(6337),c.e(3323),c.e(1501),c.e(3707),c.e(6781)]).then(c.bind(c,16781))]),g=d(),h=e(g,a.worktreeId)??null;if(!h)return void R.info("opencode-stop-unresolved-target",{worktreeId:a.worktreeId});let i=await f(g,h,Q.k,b);R.info("opencode-stop-applied",{worktreeId:a.worktreeId,instanceId:b,taskId:i.taskId,taskEventApplied:i.taskEventApplied,verificationRunId:i.verificationRunId})}async function U(a,b){let c=a.instanceId??Q.k;try{let d=(0,M.VM)(Q.k),e=(0,J.classifyAgentEventDelivery)({worktreeId:a.worktreeId,cliToolId:Q.k,instanceId:c,event:b.event,detail:b.detail,sessionId:b.conversationId,at:b.receivedAt,identity:d.eventIdentityOf(b.raw),identityKind:d.capabilities.eventIdentity});if(e.duplicate)return void R.info("opencode-event-duplicate-dropped",{worktreeId:a.worktreeId,instanceId:c,event:b.event,detail:b.detail,by:e.by});let f={event:b.event,at:b.receivedAt,detail:b.detail?.slice(0,G.h9)??null,sessionId:b.conversationId,message:(function(a){let b=(0,L.Qd)(a.raw.properties)?a.raw.properties:{};if(a.detail===N.aF)return(0,L.NZ)(b,["metadata","command"])??(0,L.O2)(b,"permission");if(a.detail===N.Tm){let a=b.questions;return Array.isArray(a)&&(0,L.Qd)(a[0])?(0,L.O2)(a[0],"question"):null}return a.detail===N.vE?(0,L.NZ)(b,["error","data","message"])??(0,L.NZ)(b,["error","name"]):null})(b)?.slice(0,K.lY)??null,model:b.model},g={sessionStartMayArriveLate:d.capabilities.sessionStartMayArriveLate};if("notification"===b.event&&b.detail===N.aF){f.decisionId=(0,L.O2)((0,L.Qd)(b.raw.properties)?b.raw.properties:{},"id");let d=(0,O.LF)(b.raw,b.receivedAt);f.toolName=d?.toolName??null,f.decisionPatterns=d?.patterns??null,f.promptSettled=await S(a,b,c),(0,J.recordAgentEvent)(a.worktreeId,Q.k,c,f,g);return}if("notification"===b.event&&b.detail===N.C8){f.decisionId=(0,N.Mn)(b.raw),f.promptSettled=!!(0,M.VM)(Q.k).capabilities.permissionReplyReleasesPrompt||(R.info("opencode-permission-reply-not-releasing",{worktreeId:a.worktreeId,instanceId:c,reason:"capability-permissionReplyReleasesPrompt-false"}),!1),(0,J.recordAgentEvent)(a.worktreeId,Q.k,c,f,g),R.info("opencode-permission-reply-observed",{worktreeId:a.worktreeId,instanceId:c,decisionId:f.decisionId,released:f.promptSettled});return}if((0,J.recordAgentEvent)(a.worktreeId,Q.k,c,f,g),"notification"===b.event&&b.detail===N.Tm){let d=(0,M.VM)(Q.k).parseQuestion(b.raw);d&&((0,J.recordAskUserQuestion)(a.worktreeId,Q.k,c,d,b.receivedAt),(0,J.reportQuestionPending)(a.worktreeId,Q.k,c,{toolName:I.GF,decisionId:d.promptId,detail:N.Tm},b.receivedAt),R.info("opencode-question-recorded",{worktreeId:a.worktreeId,instanceId:c,decisionId:d.promptId,questionCount:d.questions.length,optionCounts:d.questions.map(a=>a.choices.length)})),await (0,P.Vo)(a,c,f.message??null,b.receivedAt);return}if("stop"===b.event)return void await T(a,c);"notification"===b.event&&b.detail===N.vE&&await (0,P.dJ)(a,c,(0,L.NZ)((0,L.Qd)(b.raw.properties)?b.raw.properties:{},["error","name"]),f.message??null,b.conversationId,b.receivedAt),R.info("opencode-event-received",{worktreeId:a.worktreeId,instanceId:c,event:b.event,detail:b.detail})}catch(d){R.error("opencode-event-ingest-failed",{worktreeId:a.worktreeId,instanceId:c,event:b.event,error:d instanceof Error?d.message:String(d)})}}var V=c(84574),W=c(85965),X=c(53163);let Y=(0,n.h)("lib/hooks/sources/opencode/runtime");function Z(a,b){return{worktreeId:a,cliToolId:"opencode",instanceId:b}}async function $(a,b){try{return await (0,V.CU)(a,b)}catch(b){return Y.warn("opencode-port-reserve-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)}),null}}let _=[0,500,1e3,2e3,4e3];async function aa(a,b){for(let[c,d]of _.entries()){d>0&&await new Promise(a=>setTimeout(a,d));let e=await (0,F.sc)(b);if("healthy"===e.kind)return c>0&&Y.info("opencode-server-reachable-after-retry",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,attempt:c}),e.health;if("rejected"===e.kind){Y.warn("opencode-server-refused-commandmate",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,status:e.status,consequence:"structured events are off for this session; the scraper decides"});break}}return null}async function ab(a){try{let b=(0,V.hC)(a);if(null===b)return!1;if((0,X.wb)(a))return!0;let c=await aa(a,b);if(!c)return Y.info("opencode-server-not-reachable",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,attempts:_.length}),!1;await W.cC.subscribe(a,b=>{U(a,b)});let d=await ac(a);return Y.info("opencode-event-stream-attached",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,port:b,version:c.version,activity:d}),!0}catch(b){return Y.warn("opencode-event-stream-attach-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)}),!1}}async function ac(a){let b=null;try{b=await W.cC.probeActivity(a)}catch(b){Y.debug("opencode-activity-probe-failed",{worktreeId:a.worktreeId,instanceId:a.instanceId??a.cliToolId,error:b instanceof Error?b.message:String(b)})}return(0,X.yn)(a,b,Date.now()),b}async function ad(a,b){try{if((0,X.wb)(a))return!0;let c=await (0,V.jp)(a,b);if(null===c)return!1;return await ab(a)}catch(b){return Y.warn("opencode-event-stream-resume-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)}),!1}}async function ae(a){let b=a.instanceId??a.cliToolId;try{let c=(0,V.hC)(a);if(null===c)return!1;let d=(0,X.lf)(a);if("live"!==d.state)return Y.info("opencode-abort-skipped-not-live",{worktreeId:a.worktreeId,instanceId:b,port:c,liveness:d.state}),!1;let e=(0,X.ym)(a);if(null===e)return Y.info("opencode-abort-skipped-no-session",{worktreeId:a.worktreeId,instanceId:b,port:c}),!1;let f=(0,X.H1)(a,e,2e3);if(!await (0,F.UR)(c,e))return f.cancel(),Y.warn("opencode-abort-rejected",{worktreeId:a.worktreeId,instanceId:b,port:c,sessionId:e}),!1;if(!await f.seen)return Y.warn("opencode-abort-unconfirmed",{worktreeId:a.worktreeId,instanceId:b,port:c,sessionId:e,timeoutMs:2e3}),!1;return Y.info("opencode-abort-confirmed",{worktreeId:a.worktreeId,instanceId:b,port:c,sessionId:e}),!0}catch(c){return Y.warn("opencode-abort-failed",{worktreeId:a.worktreeId,instanceId:b,error:c instanceof Error?c.message:String(c)}),!1}}async function af(a){try{await (0,X.FN)(a),(0,V.kE)(a)}catch(b){Y.warn("opencode-event-stream-release-failed",{worktreeId:a.worktreeId,error:b instanceof Error?b.message:String(b)})}}var ag=c(18529),ah=c(70849),ai=c(27939),aj=c(93949),ak=c(20610),al=c(78099);let am=(0,n.h)("cli-tools/opencode"),an=(0,C.promisify)(B.execFile);function ao(a){return a instanceof Error?a.message:String(a)}function ap(){let a=process.env[A.ao],b=(0,A._u)();return void 0!==a&&String(b)!==a.trim()?am.warn("opencode-pane-width-rejected",{requested:a,applied:b}):b>=A.Lg&&am.warn("opencode-pane-width-sidebar-visible",{width:b,sidebarMinWidth:A.Lg}),b}let aq=[0,50,100,200];function ar(a,b){return a?`${a}
|
|
2
2
|
|
|
3
3
|
[添付画像: ${b}]`:`[添付画像: ${b}]`}class as extends d.Mj{navigationKeys(){return{keys:e.sM,leaderKey:e.Mx}}async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,f.N)(c)}async launchSession(a,b,c){if(!await this.isInstalled())throw(0,al.Tl)(this);let d=this.getSessionName(a,c),e=Z(a,c),g=await (0,f.N)(d);if(g){if(await this.reconcileExistingSession(d,{windowWidth:ap(),windowHeight:A.xT}),await this.isToolLive(d,{confirm:!0})){await ad(e,b),am.info("opencode-session-sessionname");return}am.warn("opencode-session-relaunch",{sessionName:d}),await af(e)}(0,E.Fq)(e);try{await z(b),g||(await (0,f.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,ak.Uc)));try{await an("tmux",["resize-window","-t",(0,f.lA)(d),"-x",String(ap()),"-y",String(A.xT)])}catch{}await $(e,b);let h=(0,E.wK)({target:e,executablePath:this.command,worktreePath:b}),i=(0,ai.pr)(e,b),j=null===i?h:(0,ai.XO)(h,i);null!==i&&am.info("opencode-session-resumed",{worktreeId:a,instanceId:c??this.id,sessionId:i}),await (0,f.V1)(d,j,!0),await this.waitForReady(d),await ab(e),am.info("started-opencode-session:sessionname")}catch(b){let a=ao(b);throw Error(`Failed to start OpenCode session: ${a}`)}}async waitForReady(a){for(let b=0;b<60;b++){try{let c=(0,g.aJ)(await (0,f.Xg)(a,50));if(g.vU.test(c))return am.info("opencode-composer-detected",{attempt:b}),!0;if(g.LO.test(c))return am.info("opencode-overlay-detected",{attempt:b}),!0}catch{}await new Promise(a=>setTimeout(a,500))}return am.info("opencode-ready-detection-timeout"),!1}async trySendViaServer(a,b,c){let d=a.instanceId??a.cliToolId;try{let e=(0,V.hC)(a);if(null===e)return!1;let f=(0,X.lf)(a);if("live"!==f.state)return am.info("opencode-send-skipped-not-live",{worktreeId:a.worktreeId,instanceId:d,port:e,liveness:f.state}),!1;let g=(0,X.ym)(a);if(null===g)return am.info("opencode-send-skipped-no-session",{worktreeId:a.worktreeId,instanceId:d,port:e}),!1;let h=[{type:"text",text:b}];void 0!==c&&h.push({type:"file",mime:(0,D.$Y)((0,l.extname)(c)),filename:(0,l.basename)(c),url:(0,F.fy)(c)});let i=(0,F.CH)(),j=(0,ag.QH)((0,ag.Q1)(a));if(!await (0,F.wZ)(e,g,i,h,j))return!1;if(!await this.verifyPostedMessage(e,g,i,b))return am.warn("opencode-send-unverified",{worktreeId:a.worktreeId,instanceId:d,port:e,sessionId:g,messageId:i,hasImage:void 0!==c}),!1;return am.info("opencode-send-delivered-via-api",{worktreeId:a.worktreeId,instanceId:d,port:e,sessionId:g,messageId:i,hasImage:void 0!==c}),!0}catch(b){return am.warn("opencode-send-api-failed",{worktreeId:a.worktreeId,instanceId:d,error:ao(b)}),!1}}async verifyPostedMessage(a,b,c,d){for(let e of aq){e>0&&await new Promise(a=>setTimeout(a,e));let f=await (0,F.ep)(a,b,c);if("found"===f.kind)return f.texts.includes(d);if("missing"===f.kind)break}return!1}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,f.N)(d))throw Error(`OpenCode session ${d} does not exist. Start the session first.`);if(await this.relaunchIfToolExited(a,c),await this.trySendViaServer(Z(a,c),b))return void(0,i.gm)(d);try{await (0,h.FW)({sessionName:d,message:b,cliToolId:"opencode",composer:this.describeComposer()}),(0,i.gm)(d),am.info("sent-message-to-opencode-session:session")}catch(b){let a=ao(b);throw Error(`Failed to send message to OpenCode: ${a}`)}}supportsImage(){return!0}async sendMessageWithImage(a,b,c,d){let e=this.getSessionName(a,d);if(!await (0,f.N)(e))throw Error(`OpenCode session ${e} does not exist. Start the session first.`);let g=Z(a,d);if(await this.trySendViaServer(g,b,c))return void(0,i.gm)(e);am.info("opencode-image-degraded-to-path",{worktreeId:a,instanceId:d??this.id}),await this.sendMessage(a,ar(b,c),d)}async killSession(a,b){let c=this.getSessionName(a,b),d=Z(a,b),e=(0,V.hC)(d),g=await (0,ah.LQ)(d).catch(()=>null);g&&!g.captured&&am.info("opencode-session-capture-skipped",{sessionName:c,reason:g.skipped}),await af(d);try{if(await (0,f.N)(c)){await (0,f.V1)(c,"/exit",!1),await new Promise(a=>setTimeout(a,ak.pL)),await (0,f.KB)(c,["Enter"]),await new Promise(a=>setTimeout(a,ak.KI));let a=await (0,aj.rY)({sessionAlive:()=>(0,f.N)(c),portAnswering:null===e?null:async()=>await (0,F.Ok)(e)!==null});a.ok||(am.warn("opencode-graceful-exit-postcondition-failed",{sessionName:c,reason:a.reason,...null!==e?{port:e}:{}}),await (0,f.fY)(c))}else await (0,f.fY)(c);(0,i.gm)(c),am.info("stopped-opencode-session:sessionname")}catch(a){throw am.error("session:stop-failed",{error:ao(a)}),a}}async interrupt(a,b){let c=this.getSessionName(a,b);if(await ae(Z(a,b))){(0,i.gm)(c),am.info("opencode-interrupt-aborted-via-api");return}await (0,f.ds)(c,"Escape"),await new Promise(a=>setTimeout(a,ak.os)),await (0,f.ds)(c,"Escape"),(0,i.gm)(c),am.info("opencode-interrupt-sent")}constructor(...a){super(...a),this.id="opencode",this.name="OpenCode",this.command="opencode"}}},43234:(a,b,c)=>{c.r(b),c.d(b,{CLIToolManager:()=>ae});var d=c(81886),e=c(8953),f=c(57905);class g extends d.Mj{navigationKeys(){return{keys:e.pU,leaderKey:null}}async isInstalled(){return await (0,f.zw)()}async isRunning(a,b){return await (0,f.Yq)(a,b)}async launchSession(a,b,c){await (0,f.R7)({worktreeId:a,worktreePath:b,instanceId:c})}async sendMessage(a,b,c){await (0,f.pU)(a,b,c)}supportsImage(){return!0}async sendMessageWithImage(a,b,c,d){let e=`
|
|
4
|
-
`,f=b?`${b}${e}`:e;await this.sendMessage(a,f,d)}async killSession(a,b){await (0,f.VU)(a,b)}constructor(...a){super(...a),this.id="claude",this.name="Claude Code",this.command="claude"}}var h=c(79892),i=c(40236),j=c(93997),k=c(85164),l=c(11472);let m=["skip","skip-until-next-version","update","ask"],n=Object.freeze({update:"1",skip:"2","skip-until-next-version":"3",ask:null});function o(a){if("string"!=typeof a)return null;let b=a.trim().toLowerCase();return"string"==typeof b&&m.includes(b)?b:null}c(68847);var p=c(61260);c(48800);var q=c(72626),r=c(22354),s=c(99432),t=c(4970),u=c(20610),v=c(78099);let w=(0,q.h)("cli-tools/codex");function x(a){return a instanceof Error?a.message:String(a)}let y="codex";function z(){return{screen:null,attempts:0}}class A extends d.Mj{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c){if(!await this.isInstalled())throw(0,v.Tl)(this);let d=this.getSessionName(a,c),e=await (0,h.N)(d);if(e){if(await this.reconcileExistingSession(d),await this.isToolLive(d,{confirm:!0}))return void w.info("codex-session-sessionname");w.warn("codex-session-relaunch",{sessionName:d})}(0,t.Fq)({worktreeId:a,cliToolId:r.c1,instanceId:c});try{e||(await (0,h.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc)));let f=(0,t.wK)({target:{worktreeId:a,cliToolId:r.c1,instanceId:c},executablePath:this.command,worktreePath:b}),g=async()=>{(0,t.Fq)({worktreeId:a,cliToolId:r.c1,instanceId:c}),await (0,h.V1)(d,f,!0),await new Promise(a=>setTimeout(a,3e3))};await (0,h.V1)(d,f,!0),await new Promise(a=>setTimeout(a,3e3)),await this.waitForReady(d,{relaunch:g,trustHooks:(0,s.dO)(b)}),w.info("started-codex-session:sessionname")}catch(b){let a=x(b);throw Error(`Failed to start Codex session: ${a}`)}}async waitForReady(a,b){let c=b?.trustHooks??!1,d=!1,e=!1,f=z(),g=function(a){let b=o(void 0);if(null!==b)return b;let c=o(((void 0)??process.env).CM_CODEX_UPDATE_DIALOG);return null!==c?c:"skip-until-next-version"}(),i=n[g],j=!1,m=!1,q=!1,r=30;try{for(let o=0;o<r;o++){try{let s=await (0,h.Xg)(a,50),t=(0,k.aJ)(s),v=(0,k.E6)(t);if(("hooks-review"===v||"hooks-list"===v||"hooks-detail"===v)&&await this.answerCodexHooksScreen(a,v,f,c)){await new Promise(a=>setTimeout(a,u.CV));continue}if((0,k.zZ)(t))return void w.info("codex-prompt-detected");if(j&&!m&&b?.relaunch&&null!==(0,l.GE)(t,this.livenessSpec())){m=!0,r=Math.max(r,o+1+30),e=!1,f.screen=null,f.attempts=0,q&&(q=!1,(0,p.lM)(y),w.info("codex-update-lock-released",{sessionName:a})),w.info("codex-relaunched-after-update",{sessionName:a,policy:g}),await b.relaunch();continue}let x=(0,k.Qh)(t);if("update"===x){if(j=!0,null===i){await new Promise(a=>setTimeout(a,1e3));continue}if(!d){let b=i;b!==n.update||(0,p.mf)(y)?b===n.update&&(q=!0):(b=n["skip-until-next-version"],w.warn("codex-update-dialog-yielded-to-running-update",{sessionName:a,policy:g,requestedKey:i,key:b})),await (0,h.V1)(a,b,!1),d=!0,b===n.update&&(r=Math.max(r,o+1+120)),w.info("codex-update-dialog-answered",{sessionName:a,policy:g,key:b}),await new Promise(a=>setTimeout(a,u.CV));continue}}if("press-enter"===x){await (0,h.ds)(a,"Enter"),w.info("dismissed-codex-notification"),await new Promise(a=>setTimeout(a,u.CV));continue}if("trust"===x&&!e){await (0,h.V1)(a,"1",!1),e=!0,w.info("auto-trusted-folder-for"),await new Promise(a=>setTimeout(a,u.CV));continue}}catch{}await new Promise(a=>setTimeout(a,1e3))}w.info("codex-prompt-detection")}finally{q&&(q=!1,(0,p.lM)(y),w.warn("codex-update-lock-released-unfinished",{sessionName:a}))}}async answerCodexHooksScreen(a,b,c,d){if(c.screen!==b&&(c.screen=b,c.attempts=0),c.attempts>=3)return w.warn("codex-hooks-screen-unresponsive",{sessionName:a,screen:b,trust:d}),!1;let e=++c.attempts;if("hooks-review"===b){let b=1===e?d?"2":"3":"1";return await (0,h.V1)(a,b,!1),w.info("codex-hooks-review-answered",{sessionName:a,key:b,attempt:e,trust:d}),!0}return d?(await (0,h.V1)(a,"t",!1,{literal:!0}),w.info("codex-hooks-screen-trusted",{sessionName:a,screen:b,attempt:e})):(await (0,h.ds)(a,"Escape"),w.info("codex-hooks-screen-escaped",{sessionName:a,screen:b,attempt:e})),!0}async waitForPrompt(a){let b=Date.now(),c=z(),d=null;for(;Date.now()-b<15e3;){try{let b=await (0,h.Xg)(a,50),e=(0,k.aJ)(b),f=(0,k.E6)(e);if("hooks-review"===f||"hooks-list"===f||"hooks-detail"===f){if(null===d){let b=await (0,h.nS)(a);d=null!==b&&(0,s.dO)(b)}await this.answerCodexHooksScreen(a,f,c,d)}else if((0,k.zZ)(e))return}catch{}await new Promise(a=>setTimeout(a,500))}throw w.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,h.N)(d))throw Error(`Codex session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await this.waitForPrompt(d),await (0,i.FW)({sessionName:d,message:b,cliToolId:"codex",composer:this.describeComposer()}),(0,j.gm)(d),w.info("sent-message-to-codex-session:sessionnam")}catch(b){let a=x(b);throw Error(`Failed to send message to Codex: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,h.N)(c)&&(await (0,h.ds)(c,"C-d"),await new Promise(a=>setTimeout(a,u.Zf))),await (0,h.fY)(c)&&w.info("stopped-codex-session:sessionname")}catch(a){throw w.error("session:stop-failed",{error:x(a)}),a}}constructor(...a){super(...a),this.id="codex",this.name="Codex CLI",this.command="codex"}}var B=c(23365);let C=(0,q.h)("cli-tools/gemini");function D(a){return a instanceof Error?a.message:String(a)}class E extends d.Mj{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c){if(!await this.isInstalled())throw(0,v.Tl)(this);let d=this.getSessionName(a,c),e=await (0,h.N)(d);if(e){if(await this.reconcileExistingSession(d),await this.isToolLive(d,{confirm:!0}))return void C.info("gemini-session-sessionname");C.warn("gemini-session-relaunch",{sessionName:d})}(0,t.Fq)({worktreeId:a,cliToolId:r.o,instanceId:c});try{e||(await (0,h.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc)));let f=(0,t.wK)({target:{worktreeId:a,cliToolId:r.o,instanceId:c},executablePath:this.command,worktreePath:b});await (0,h.V1)(d,f,!0),await new Promise(a=>setTimeout(a,6e3)),await this.waitForReady(d),C.info("started-gemini-session:sessionname")}catch(b){let a=D(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,h.Xg)(a,B.H),d=(0,k.aJ)(c);if(k.wN.test(d))return void C.info("gemini-prompt-detected");!b&&d.includes("Do you trust this folder?")&&(await (0,h.ds)(a,"Enter"),b=!0,C.info("auto-trusted-folder-for"))}catch{}await new Promise(a=>setTimeout(a,1e3))}C.info("gemini-prompt-detection")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,h.Xg)(a,B.H),c=(0,k.aJ)(b);if(k.wN.test(c))return}catch{}await new Promise(a=>setTimeout(a,500))}C.info("gemini-prompt-not")}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,h.N)(d))throw Error(`Gemini session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await this.waitForPrompt(d),await (0,i.FW)({sessionName:d,message:b,cliToolId:"gemini",composer:this.describeComposer()}),(0,j.gm)(d),C.info("sent-message-to-gemini-session:sessionna")}catch(b){let a=D(b);throw Error(`Failed to send message to Gemini: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,h.N)(c)&&(await (0,h.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,u.Is)),await (0,h.V1)(c,"/quit",!0),await new Promise(a=>setTimeout(a,u.Zf))),await (0,h.fY)(c)&&C.info("stopped-gemini-session:sessionname")}catch(a){throw C.error("session:stop-failed",{error:D(a)}),a}}constructor(...a){super(...a),this.id="gemini",this.name="Gemini CLI",this.command="gemini"}}var F=c(15194),G=c(88807),H=c(56791);let I=(0,q.h)("cli-tools/vibe-local");function J(a){return a instanceof Error?a.message:String(a)}class K extends d.Mj{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c){if(!await this.isInstalled())throw(0,v.Tl)(this);let d=this.getSessionName(a,c),e=await (0,h.N)(d);if(e){if(await this.reconcileExistingSession(d),await this.isToolLive(d,{confirm:!0}))return void I.info("vibe-local-session");I.warn("vibe-local-session-relaunch",{sessionName:d})}try{e||(await (0,h.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc)));let c="vibe-local -y";try{let b=(0,G.getDbInstance)(),d=(0,H.getWorktreeById)(b,a);d?.vibeLocalModel&&F.QP.test(d.vibeLocalModel)&&(c+=` -m ${d.vibeLocalModel}`);let e=d?.vibeLocalContextWindow;(0,F.FV)(e)&&(c+=` --context-window ${Number(e)}`)}catch{}await (0,h.V1)(d,c,!0),await new Promise(a=>setTimeout(a,5e3)),I.info("started-vibe-local-session:sessionname")}catch(b){let a=J(b);throw Error(`Failed to start Vibe Local session: ${a}`)}}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,h.N)(d))throw Error(`Vibe Local session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await (0,i.FW)({sessionName:d,message:b,cliToolId:"vibe-local",composer:this.describeComposer(),interEnterWaitMs:u.PY}),(0,j.gm)(d),I.info("sent-message-to-vibe-local-session:sessi")}catch(b){let a=J(b);throw Error(`Failed to send message to Vibe Local: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,h.N)(c)&&(await (0,h.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,u.Is)),await (0,h.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,u.Zf))),await (0,h.fY)(c)&&I.info("stopped-vibe-local-session:sessionname")}catch(a){throw I.error("session:stop-failed",{error:J(a)}),a}}constructor(...a){super(...a),this.id="vibe-local",this.name="Vibe Local",this.command="vibe-local"}}var L=c(41466),M=c(81776),N=c(56263),O=c(21758),P=c(54633),Q=c(77093);let R=(0,q.h)("cli-tools/copilot"),S=new Set(["model","agent","theme","permissions","skills","mcp","settings","statusline","subagents","resume","session"]),T=/^[>❯](?:\s|$)/;class U extends d.Mj{async isInstalled(){return await (0,M.B0)()!==null}launchExecutable(a){return"path"===a.source?this.command:O.nL}async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c){let d=await (0,M.B0)();if(!d)throw(0,v.Tl)(this);let e=this.getSessionName(a,c),f=await (0,h.N)(e);if(f){if(await this.reconcileExistingSession(e),await this.isToolLive(e,{confirm:!0}))return void R.info("copilot-session-exists");R.warn("copilot-session-relaunch",{sessionName:e})}(0,t.Fq)({worktreeId:a,cliToolId:P.V,instanceId:c});try{f||(await (0,h.jw)({sessionName:e,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc)));let g=(0,t.wK)({target:{worktreeId:a,cliToolId:P.V,instanceId:c},executablePath:this.launchExecutable(d),worktreePath:b});await (0,h.V1)(e,g,!0),await this.waitForReady(e),R.info("started-copilot-session",{executableSource:d.source,version:d.version})}catch(b){let a=(0,Q.u1)(b);throw Error(`Failed to start Copilot session: ${a}`)}}async answerFolderTrustDialog(a,b){return!!(0,k.Rx)(b)&&(await (0,h.V1)(a,k.oD,!1),(0,j.gm)(a),R.info("copilot-folder-trust-answered"),!0)}isComposerDrawn(a){let b=a.split("\n");for(let a=1;a<b.length-1;a++)if(T.test(b[a])&&k.A.test(b[a-1].trimEnd())&&k.A.test(b[a+1].trimEnd()))return!0;return!1}async waitForReady(a){let b=!1;for(let c=0;c<30;c++){try{let c=await (0,h.Xg)(a,50),d=(0,k.aJ)(c);if(this.isComposerDrawn(d))return void R.info("copilot-prompt-detected");!b&&await this.answerFolderTrustDialog(a,d)&&(b=!0)}catch{}await new Promise(a=>setTimeout(a,1e3))}R.info("copilot-prompt-detection-timeout")}async waitForPrompt(a,b=15e3){let c=Date.now(),d=!1;for(;Date.now()-c<b;){try{let b=await (0,h.Xg)(a,50),c=(0,k.aJ)(b);if(k.Du.test(c))return;!d&&await this.answerFolderTrustDialog(a,c)&&(d=!0)}catch{}await new Promise(a=>setTimeout(a,500))}R.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,h.Xg)(a,50),c=(0,k.aJ)(b);if((0,k.gT)(c.split("\n")))return R.info("copilot-selection-list-detected"),!0}catch{}}return R.info("copilot-selection-list-not-detected-timeout"),!1}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,h.N)(d))throw Error(`Copilot session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await this.waitForPrompt(d);let a=this.extractSlashCommand(b);if(a&&S.has(a)){await (0,h.V1)(d,b,!0),await this.waitForSelectionList(d),(0,j.gm)(d),R.info("sent-selection-list-command-to-copilot",{command:a});return}await (0,i.FW)({sessionName:d,message:b,cliToolId:"copilot",composer:this.describeComposer(),textInputWaitMs:N.L1,verifyDelayMs:N.wp}),(0,j.gm)(d),R.info("sent-message-to-copilot-session")}catch(b){let a=(0,Q.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,h.N)(d))throw Error(`Copilot session ${d} does not exist. Start the session first.`);try{await (0,h.V1)(d,`/model ${b}`,!0),await this.waitForPrompt(d,N.pL),(0,j.gm)(d),R.info("copilot-model-switched",{model:b})}catch(c){let a=(0,Q.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,h.N)(c)&&(await (0,h.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,u.Is)),await (0,h.V1)(c,"/exit",!1),await new Promise(a=>setTimeout(a,N.L1)),await (0,h.KB)(c,["Enter"]),await new Promise(a=>setTimeout(a,u.Rk))),await (0,h.fY)(c)&&R.info("stopped-copilot-session")}catch(a){throw R.error("session:stop-failed",{error:(0,Q.u1)(a)}),a}}constructor(...a){super(...a),this.id="copilot",this.name="Copilot",this.command="copilot"}}let V=(0,q.h)("cli-tools/antigravity");function W(a){return a instanceof Error?a.message:String(a)}let X=/\?\s+for\s+shortcuts/,Y=/Do you trust the contents of this project\?/;function Z(a){return X.test(a)&&!Y.test(a)}class $ extends d.Mj{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c,d){if(!await this.isInstalled())throw(0,v.Tl)(this);let e=this.getSessionName(a,c),f=await (0,h.N)(e);if(f){if(await this.reconcileExistingSession(e),await this.isToolLive(e,{confirm:!0}))return void V.info("antigravity-session-exists");V.warn("antigravity-session-relaunch",{sessionName:e})}(0,t.Fq)({worktreeId:a,cliToolId:r.F0,instanceId:c});try{f||(await (0,h.jw)({sessionName:e,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc)));let g=(0,t.wK)({target:{worktreeId:a,cliToolId:r.F0,instanceId:c},executablePath:this.command,worktreePath:b}),i=d?`${g} --model '${d.replace(/'/g,"'\\''")}'`:g;await (0,h.V1)(e,i,!0),await new Promise(a=>setTimeout(a,3e3)),await this.waitForReady(e),V.info("started-antigravity-session")}catch(b){let a=W(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,h.Xg)(a,50),d=(0,k.aJ)(c);if(Z(d))return void V.info("antigravity-prompt-detected");if(!b&&Y.test(d)){await (0,h.ds)(a,"Enter"),b=!0,V.info("auto-trusted-folder-for-antigravity"),await new Promise(a=>setTimeout(a,500));continue}}catch{}await new Promise(a=>setTimeout(a,1e3))}V.info("antigravity-prompt-detection-timeout")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,h.Xg)(a,50),c=(0,k.aJ)(b);if(Z(c))return}catch{}await new Promise(a=>setTimeout(a,500))}throw V.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,h.N)(d))throw Error(`Antigravity session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await this.waitForPrompt(d),await (0,i.FW)({sessionName:d,message:b,cliToolId:"antigravity",composer:this.describeComposer()}),(0,j.gm)(d),V.info("sent-message-to-antigravity-session")}catch(b){let a=W(b);throw Error(`Failed to send message to Antigravity: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,h.N)(c)&&(await (0,h.ds)(c,"C-d"),await new Promise(a=>setTimeout(a,u.Zf)));let a=await (0,h.fY)(c);(0,j.gm)(c),a&&V.info("stopped-antigravity-session")}catch(a){throw V.error("session:stop-failed",{error:W(a)}),a}}constructor(...a){super(...a),this.id="antigravity",this.name="Antigravity CLI",this.command="agy"}}var _=c(28862);let aa=(0,q.h)("cli-tools/command-code"),ab=["--trust","--skip-onboarding","--no-auto-update"];function ac(a){let b=a.split("\n");return!(0>(0,k.I$)(b))&&!k.k0.test((0,k.aJ)(a))}class ad extends d.Mj{navigationKeys(){return{keys:e.pU,leaderKey:null}}async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c){if(!await this.isInstalled())throw(0,v.Tl)(this);let d=this.getSessionName(a,c),e=await (0,h.N)(d);if(e){if(await this.reconcileExistingSession(d),await this.isToolLive(d,{confirm:!0}))return void aa.info("command-code-session-exists");aa.warn("command-code-session-relaunch",{sessionName:d})}(0,t.Fq)({worktreeId:a,cliToolId:_.k,instanceId:c});try{var f;e||(await (0,h.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc))),await (0,h.V1)(d,(f={target:{worktreeId:a,cliToolId:_.k,instanceId:c},executablePath:this.command,worktreePath:b},[(0,t.wK)(f),...ab].join(" ")),!0),await new Promise(a=>setTimeout(a,u.yO)),await this.waitForReady(d),aa.info("started-command-code-session")}catch(a){throw Error(`Failed to start Command Code session: ${(0,Q.u1)(a)}`)}}async waitForReady(a){for(let b=0;b<30;b++){try{let b=await (0,h.Xg)(a,50);if(ac(b))return void aa.info("command-code-prompt-detected")}catch{}await new Promise(a=>setTimeout(a,1e3))}aa.info("command-code-prompt-detection-timeout")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,h.Xg)(a,50);if(ac(b))return}catch{}await new Promise(a=>setTimeout(a,500))}throw aa.info("command-code-prompt-not-ready"),Error("Command Code prompt not ready: timed out waiting for the composer before sending")}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,h.N)(d))throw Error(`Command Code session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await this.waitForPrompt(d),await (0,i.FW)({sessionName:d,message:b,cliToolId:"command-code",composer:this.describeComposer()}),(0,j.gm)(d),aa.info("sent-message-to-command-code-session")}catch(a){throw Error(`Failed to send message to Command Code: ${(0,Q.u1)(a)}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,h.N)(c)&&(await (0,h.V1)(c,"/exit",!1),await new Promise(a=>setTimeout(a,u.pL)),await (0,h.KB)(c,["Enter"]),await new Promise(a=>setTimeout(a,u.Zf)));let a=await (0,h.fY)(c);(0,j.gm)(c),a&&aa.info("stopped-command-code-session")}catch(a){throw aa.error("session:stop-failed",{error:(0,Q.u1)(a)}),a}}constructor(...a){super(...a),this.id="command-code",this.name="Command Code CLI",this.command="commandcode"}}class ae{constructor(){this.tools=new Map,this.tools.set("claude",new g),this.tools.set("codex",new A),this.tools.set("gemini",new E),this.tools.set("vibe-local",new K),this.tools.set("opencode",new L.Ui),this.tools.set("copilot",new U),this.tools.set("antigravity",new $),this.tools.set("command-code",new ad)}static getInstance(){return ae.instance||(ae.instance=new ae),ae.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)}async stopPollers(a,b,d){let{stopPolling:e}=await Promise.all([c.e(1356),c.e(1503),c.e(1634),c.e(1191),c.e(6838),c.e(1719),c.e(2119),c.e(2445),c.e(6337),c.e(595),c.e(6491),c.e(8918),c.e(7875),c.e(3086)]).then(c.bind(c,95220));e(a,b,d)}}},56263:(a,b,c)=>{c.d(b,{L1:()=>e,MJ:()=>j,Rf:()=>f,ky:()=>g,lM:()=>i,pL:()=>h,wp:()=>d,zt:()=>k});let d=200,e=100,f=1e5,g="[... truncated ...]",h=3e4,i=/^[a-zA-Z0-9][a-zA-Z0-9\-._/:]*$/,j=128,k="Install with: brew install copilot-cli (macOS) or npm i -g @github/copilot"},70849:(a,b,c)=>{c.d(b,{LQ:()=>k,SW:()=>l});var d=c(72626),e=c(84574),f=c(48083),g=c(77634),h=c(27939);let i=(0,d.h)("lib/session/opencode-session-recall");async function j(a,b){let c=new Set,d=await (0,g.GP)(a,b);for(let b=0;b<3;b+=1){if(null===d)return null;if(null===d.parentId||c.has(d.parentId))break;c.add(d.parentId),i.debug("opencode-session-parent-hop",{from:d.id,to:d.parentId}),d=await (0,g.GP)(a,d.parentId)}return d}async function k(a){let b=a.instanceId??a.cliToolId,c=(0,e.hC)(a);if(null===c)return{captured:!1,skipped:"no-port"};let d=(0,f.getLastAgentEvent)(a.worktreeId,"opencode",a.instanceId)?.sessionId;if(!(0,h.jp)(d))return{captured:!1,skipped:"no-session-observed"};let g=await j(c,d);if(null===g)return{captured:!1,skipped:"session-unreadable"};if(null===g.directory)return{captured:!1,skipped:"no-directory"};let k=(0,e.U9)(a);return null!==k&&k!==g.directory?(i.warn("opencode-session-capture-directory-mismatch",{worktreeId:a.worktreeId,instanceId:b,expected:k,reported:g.directory}),{captured:!1,skipped:"directory-mismatch"}):(0,h.F_)(a,{sessionId:g.id,title:g.title,worktreePath:g.directory})?(i.info("opencode-session-captured",{worktreeId:a.worktreeId,instanceId:b,sessionId:g.id,viaParentOf:g.id===d?null:d}),{captured:!0,memory:{sessionId:g.id,title:g.title,worktreePath:g.directory,updatedAt:Date.now()}}):{captured:!1,skipped:"not-persisted"}}async function l(a){let b=(0,e.hC)(a),c=(0,f.getLastAgentEvent)(a.worktreeId,"opencode",a.instanceId)?.sessionId;if(null!==b&&(0,h.jp)(c)){let a=await j(b,c);if(null!==a)return a.id}return(0,h.KA)(a)?.sessionId??null}},72272:(a,b,c)=>{c.d(b,{t:()=>i});var d=c(72626),e=c(50474),f=c(25071),g=c(17287);let h=(0,d.h)("lib/hooks/permission-adjudication");async function i(a,b,d,j,k="event"){let l=b.instanceId??b.cliToolId,m={worktreeId:b.worktreeId,cliToolId:b.cliToolId,instanceId:l},{resolvePermissionRequest:n}=await c.e(3241).then(c.bind(c,43241)),o=n(m,j),p="allow"===o.behavior?{kind:"allowOnce"}:{kind:"abstain"};if("abstain"===p.kind){let c=(0,e.y_)(a);c.safe||h.warn("permission-request-abstain-blocks-agent",{worktreeId:b.worktreeId,cliToolId:b.cliToolId,instanceId:l,toolName:j?.toolName??null,decisionId:d.id,reason:o.reason,consequence:c.summary,blocksForMs:c.blocksForMs})}let{delivery:q}=await (0,f.GW)(a,b,d,p),r=q?.delivered===!0,s=r&&a.capabilities.permissionReplyReleasesPrompt;return(0,g.nL)(b.worktreeId,b.cliToolId,b.instanceId,{decisionId:d.id,toolName:j?.toolName??null,behavior:"allow"===o.behavior?"allow":null,reason:o.reason,delivered:r,releasedPrompt:s,trigger:k,at:d.askedAt}),h.info("permission-decision-adjudicated",{worktreeId:b.worktreeId,cliToolId:b.cliToolId,instanceId:l,decisionId:d.id,toolName:j?.toolName??null,behavior:o.behavior,reason:o.reason,suppressedBy:o.suppressedBy,delivered:r,settled:s,trigger:k}),{decisionId:d.id,behavior:"allow"===o.behavior?"allow":null,reason:o.reason,delivered:r,settled:s}}},77634:(a,b,c)=>{c.d(b,{GP:()=>l,Hv:()=>h,eJ:()=>n,mf:()=>o,y4:()=>m,yg:()=>p});var d=c(72626),e=c(49791),f=c(27939);let g=(0,d.h)("lib/session/opencode-session-api"),h="session_new";function i(a,b){let c=a[b];return"string"==typeof c&&c.length>0?c:null}async function j(a,b){try{let c=await fetch(a,{...b,redirect:e.uS,signal:AbortSignal.timeout(e.T0)});if(!c.ok)return null;if(!function(a){let b=a.headers?.get?.("content-type");return"string"==typeof b&&b.split(";",1)[0]?.trim().toLowerCase()===e._t}(c))return g.debug("opencode-session-request-content-type",{url:a,contentType:c.headers?.get?.("content-type")??null}),null;return await c.json()}catch(b){return g.debug("opencode-session-request-failed",{url:a,error:b instanceof Error?b.message:String(b)}),null}}function k(a){if(!("object"==typeof a&&null!==a&&!Array.isArray(a)))return null;let b=i(a,"id");if(!(0,f.jp)(b))return null;let c=i(a,"title");return{id:b,title:null===c?null:c.slice(0,f.Y2),directory:i(a,"directory"),parentId:i(a,"parentID")}}async function l(a,b){return(0,f.jp)(b)?k(await j(`${(0,e.M2)(a)}/session/${encodeURIComponent(b)}`)):null}async function m(a,b){return(0,f.jp)(b)?k(await j(`${(0,e.M2)(a)}/session/${encodeURIComponent(b)}/fork`,{method:"POST",headers:{"content-type":e._t},body:"{}"})):null}async function n(a){return!0===await j(`${(0,e.M2)(a)}/tui/open-sessions`,{method:"POST",headers:{"content-type":e._t},body:"{}"})}async function o(a,b){return!0===await j(`${(0,e.M2)(a)}/tui/execute-command`,{method:"POST",headers:{"content-type":e._t},body:JSON.stringify({command:b})})}async function p(a,b){return!!(0,f.jp)(b)&&!0===await j(`${(0,e.M2)(a)}/tui/select-session`,{method:"POST",headers:{"content-type":e._t},body:JSON.stringify({sessionID:b})})}},78099:(a,b,c)=>{c.d(b,{Tl:()=>g});var d=c(56263),e=c(2669);let f={claude:"Install with: npm install -g @anthropic-ai/claude-code",codex:"Install with: npm install -g @openai/codex",gemini:"Install with: npm install -g @google/gemini-cli",opencode:"Install with: npm install -g opencode-ai",copilot:d.zt,"command-code":"Install with: npm install -g command-code",antigravity:"Install the Antigravity CLI: https://antigravity.google/docs/cli/reference","vibe-local":"vibe-local is a local script rather than a published package: put your own `vibe-local` executable on PATH."};function g(a){var b;return new e.lU(a.name,(b=a,`${b.name} (${b.command}) is not installed or not in PATH. ${f[b.id]}`))}},81886:(a,b,c)=>{c.d(b,{Km:()=>A,Mj:()=>z});var d=c(79646),e=c(28354),f=c(40964),g=c(79892),h=c(56717),i=c(23365),j=c(93949),k=c(91536),l=c(50945),m=c(96287),n=c(51297),o=c(87447),p=c(45567),q=c(72626),r=c(8953),s=c(20610),t=c(16983);let u=(0,e.promisify)(d.exec),v=(0,q.h)("cli-tools/base"),w=RegExp(`${p.ZM}=(?:'([^']*)'|"([^"]*)"|(\\S+))`,"g"),x=new Set,y=new Set;class z{async isInstalled(){try{return await u(`which ${this.command}`,{timeout:5e3}),!0}catch{return!1}}getSessionName(a,b){return(0,f.m)(this.id,a,b)}async startSession(a,b,c,d){try{await this.launchSession(a,b,c,d)}catch(b){throw this.takeAdoptionMark(a,c),(0,m.Zl)({worktreeId:a,cliToolId:this.id,instanceId:c,toolName:this.name},b),b}let e=this.takeAdoptionMark(a,c);null!==e&&await this.warnIfHookUrlIsStale(a,e,c)}async reconcileExistingSession(a,b){x.add(a),await (0,g.zT)(a,b)}takeAdoptionMark(a,b){try{let c=this.getSessionName(a,b);return x.delete(c)?c:null}catch{return null}}async warnIfHookUrlIsStale(a,b,c){if(!y.has(b))try{let d=await (0,g.Xg)(b,{startLine:-t.eu});y.add(b);let e=function(a){let b=null;for(let c of(0,n.aJ)(a).matchAll(w)){let a=c[1]??c[2]??c[3]??null;a&&(b=a)}return b}(d);if(null===e)return;let f=function(a){try{let b=new URL(a);if(""!==b.port)return Number(b.port);return"https:"===b.protocol?443:80}catch{return null}}(e),h=(0,o.D0)();if(null===f||f===h)return;v.warn("session:hook-url-stale",{cliToolId:this.id,sessionName:b,sessionPort:f,serverPort:h}),(0,m.ED)({worktreeId:a,cliToolId:this.id,instanceId:c,toolName:this.name,sessionPort:f,serverPort:h})}catch(b){v.debug("session:hook-url-probe-failed",{cliToolId:this.id,worktreeId:a,error:b instanceof Error?b.message:String(b)})}}async warnIfRunningSessionHookUrlIsStale(a,b){let c;try{c=this.getSessionName(a,b)}catch{return}await this.warnIfHookUrlIsStale(a,c,b)}async interrupt(a,b){let c=this.getSessionName(a,b);await (0,g.ds)(c,"Escape")}describeComposer(){return(0,h.gc)(this.id)}gracefulExitSequence(){return(0,j.JV)(this.id)}captureSpec(){return(0,i.y)(this.id)}livenessSpec(){return(0,k.H7)(this.id)}async isToolLive(a,b){let c=this.livenessSpec(),d=await (0,l.Q)(a,c);if(d.alive)return!0;if(!b?.confirm)return!1;await new Promise(a=>setTimeout(a,s.kZ));let e=await (0,l.Q)(a,c);return e.alive?(v.info("session:liveness-confirm-recovered",{cliToolId:this.id,firstReason:d.reason}),!0):(v.warn("session:tool-exited",{cliToolId:this.id,reason:e.reason}),!1)}async relaunchIfToolExited(a,b){let c=this.getSessionName(a,b);if(await this.isToolLive(c))return;let d=await (0,g.nS)(c);if(null===d)return void v.warn("session:relaunch-skipped-no-path",{cliToolId:this.id,worktreeId:a});v.info("session:relaunch-before-send",{cliToolId:this.id,sessionName:c}),await this.startSession(a,d,b)}navigationKeys(){return{keys:r.qD,leaderKey:null}}}function A(a,b,c){a instanceof z&&a.warnIfRunningSessionHookUrlIsStale(b,c).catch(()=>{})}},93949:(a,b,c)=>{c.d(b,{JV:()=>i,rY:()=>k});var d=c(56263),e=c(20610),f=c(86069);let g={keys:[(0,f.IS)("C-d")],exitWaitMs:e.Zf,ownsLoopbackServer:!1},h={claude:g,codex:g,antigravity:g,gemini:{keys:[(0,f.IS)("C-c",e.Is),(0,f.iF)(`/quit\r`,void 0)],exitWaitMs:e.Zf,ownsLoopbackServer:!1},"vibe-local":{keys:[(0,f.IS)("C-c",e.Is),(0,f.IS)("C-c")],exitWaitMs:e.Zf,ownsLoopbackServer:!1},copilot:{keys:[(0,f.IS)("C-c",e.Is),(0,f.iF)("/exit",d.L1),(0,f.IS)("Enter")],exitWaitMs:e.Rk,ownsLoopbackServer:!1},"command-code":{keys:[(0,f.iF)("/exit",e.pL),(0,f.IS)("Enter")],exitWaitMs:e.Zf,ownsLoopbackServer:!1},opencode:{keys:[(0,f.iF)("/exit",e.pL),(0,f.IS)("Enter")],exitWaitMs:e.KI,ownsLoopbackServer:!0}};function i(a){return h[a]??g}let j=a=>new Promise(b=>setTimeout(b,a));async function k(a){let b=Math.max(1,a.attempts??1),c=a.intervalMs??0,d=a.sleep??j,e=!0;for(let f=0;f<b&&(e=await a.sessionAlive());f+=1)f<b-1&&c>0&&await d(c);if(e)return{ok:!1,reason:"graceful_exit_timeout"};let f=a.portAnswering;if(!f)return{ok:!0};let g=!0;for(let a=0;a<b&&(g=await f());a+=1)a<b-1&&c>0&&await d(c);return g?{ok:!1,reason:"port_orphaned"}:{ok:!0}}},96287:(a,b,c)=>{c.d(b,{$k:()=>h,ED:()=>g,VI:()=>i,Zl:()=>e});var d=c(78099);function e(a,b){Promise.all([c.e(1356),c.e(1191),c.e(6337)]).then(c.bind(c,81099)).then(({notifySessionStartFailurePush:c})=>c({...a,error:b})).catch(()=>{})}let f=new Set;function g(a){let b=[a.worktreeId,a.instanceId??a.cliToolId,a.sessionPort,a.serverPort].join(":");f.has(b)||(f.add(b),Promise.all([c.e(1356),c.e(1191),c.e(6337)]).then(c.bind(c,81099)).then(({notifyStaleHookUrlPush:b})=>b(a)).catch(()=>{}))}async function h(a,b){if(await a.isInstalled())return;let c=(0,d.Tl)(a);throw e({worktreeId:b.worktreeId,cliToolId:a.id,instanceId:b.instanceId,toolName:a.name,subject:b.subject},c),c}function i(a,b){Promise.resolve().then(c.bind(c,43234)).then(({CLIToolManager:c})=>{let f=c.getInstance().getTool(a);e({worktreeId:b.worktreeId,cliToolId:a,instanceId:b.instanceId,toolName:f.name,subject:b.subject},(0,d.Tl)(f))}).catch(()=>{})}}};
|
|
4
|
+
`,f=b?`${b}${e}`:e;await this.sendMessage(a,f,d)}async killSession(a,b){await (0,f.VU)(a,b)}constructor(...a){super(...a),this.id="claude",this.name="Claude Code",this.command="claude"}}var h=c(79892),i=c(40236),j=c(93997),k=c(85164),l=c(11472);let m=["skip","skip-until-next-version","update","ask"],n=Object.freeze({update:"1",skip:"2","skip-until-next-version":"3",ask:null});function o(a){if("string"!=typeof a)return null;let b=a.trim().toLowerCase();return"string"==typeof b&&m.includes(b)?b:null}c(68847);var p=c(61260);c(48800);var q=c(72626),r=c(22354),s=c(99432),t=c(1305),u=c(20610),v=c(78099);let w=(0,q.h)("cli-tools/codex");function x(a){return a instanceof Error?a.message:String(a)}let y="codex";function z(){return{screen:null,attempts:0}}class A extends d.Mj{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c){if(!await this.isInstalled())throw(0,v.Tl)(this);let d=this.getSessionName(a,c),e=await (0,h.N)(d);if(e){if(await this.reconcileExistingSession(d),await this.isToolLive(d,{confirm:!0}))return void w.info("codex-session-sessionname");w.warn("codex-session-relaunch",{sessionName:d})}(0,t.Fq)({worktreeId:a,cliToolId:r.c1,instanceId:c});try{e||(await (0,h.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc)));let f=(0,t.wK)({target:{worktreeId:a,cliToolId:r.c1,instanceId:c},executablePath:this.command,worktreePath:b}),g=async()=>{(0,t.Fq)({worktreeId:a,cliToolId:r.c1,instanceId:c}),await (0,h.V1)(d,f,!0),await new Promise(a=>setTimeout(a,3e3))};await (0,h.V1)(d,f,!0),await new Promise(a=>setTimeout(a,3e3)),await this.waitForReady(d,{relaunch:g,trustHooks:(0,s.dO)(b)}),w.info("started-codex-session:sessionname")}catch(b){let a=x(b);throw Error(`Failed to start Codex session: ${a}`)}}async waitForReady(a,b){let c=b?.trustHooks??!1,d=!1,e=!1,f=z(),g=function(a){let b=o(void 0);if(null!==b)return b;let c=o(((void 0)??process.env).CM_CODEX_UPDATE_DIALOG);return null!==c?c:"skip-until-next-version"}(),i=n[g],j=!1,m=!1,q=!1,r=30;try{for(let o=0;o<r;o++){try{let s=await (0,h.Xg)(a,50),t=(0,k.aJ)(s),v=(0,k.E6)(t);if(("hooks-review"===v||"hooks-list"===v||"hooks-detail"===v)&&await this.answerCodexHooksScreen(a,v,f,c)){await new Promise(a=>setTimeout(a,u.CV));continue}if((0,k.zZ)(t))return void w.info("codex-prompt-detected");if(j&&!m&&b?.relaunch&&null!==(0,l.GE)(t,this.livenessSpec())){m=!0,r=Math.max(r,o+1+30),e=!1,f.screen=null,f.attempts=0,q&&(q=!1,(0,p.lM)(y),w.info("codex-update-lock-released",{sessionName:a})),w.info("codex-relaunched-after-update",{sessionName:a,policy:g}),await b.relaunch();continue}let x=(0,k.Qh)(t);if("update"===x){if(j=!0,null===i){await new Promise(a=>setTimeout(a,1e3));continue}if(!d){let b=i;b!==n.update||(0,p.mf)(y)?b===n.update&&(q=!0):(b=n["skip-until-next-version"],w.warn("codex-update-dialog-yielded-to-running-update",{sessionName:a,policy:g,requestedKey:i,key:b})),await (0,h.V1)(a,b,!1),d=!0,b===n.update&&(r=Math.max(r,o+1+120)),w.info("codex-update-dialog-answered",{sessionName:a,policy:g,key:b}),await new Promise(a=>setTimeout(a,u.CV));continue}}if("press-enter"===x){await (0,h.ds)(a,"Enter"),w.info("dismissed-codex-notification"),await new Promise(a=>setTimeout(a,u.CV));continue}if("trust"===x&&!e){await (0,h.V1)(a,"1",!1),e=!0,w.info("auto-trusted-folder-for"),await new Promise(a=>setTimeout(a,u.CV));continue}}catch{}await new Promise(a=>setTimeout(a,1e3))}w.info("codex-prompt-detection")}finally{q&&(q=!1,(0,p.lM)(y),w.warn("codex-update-lock-released-unfinished",{sessionName:a}))}}async answerCodexHooksScreen(a,b,c,d){if(c.screen!==b&&(c.screen=b,c.attempts=0),c.attempts>=3)return w.warn("codex-hooks-screen-unresponsive",{sessionName:a,screen:b,trust:d}),!1;let e=++c.attempts;if("hooks-review"===b){let b=1===e?d?"2":"3":"1";return await (0,h.V1)(a,b,!1),w.info("codex-hooks-review-answered",{sessionName:a,key:b,attempt:e,trust:d}),!0}return d?(await (0,h.V1)(a,"t",!1,{literal:!0}),w.info("codex-hooks-screen-trusted",{sessionName:a,screen:b,attempt:e})):(await (0,h.ds)(a,"Escape"),w.info("codex-hooks-screen-escaped",{sessionName:a,screen:b,attempt:e})),!0}async waitForPrompt(a){let b=Date.now(),c=z(),d=null;for(;Date.now()-b<15e3;){try{let b=await (0,h.Xg)(a,50),e=(0,k.aJ)(b),f=(0,k.E6)(e);if("hooks-review"===f||"hooks-list"===f||"hooks-detail"===f){if(null===d){let b=await (0,h.nS)(a);d=null!==b&&(0,s.dO)(b)}await this.answerCodexHooksScreen(a,f,c,d)}else if((0,k.zZ)(e))return}catch{}await new Promise(a=>setTimeout(a,500))}throw w.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,h.N)(d))throw Error(`Codex session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await this.waitForPrompt(d),await (0,i.FW)({sessionName:d,message:b,cliToolId:"codex",composer:this.describeComposer()}),(0,j.gm)(d),w.info("sent-message-to-codex-session:sessionnam")}catch(b){let a=x(b);throw Error(`Failed to send message to Codex: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,h.N)(c)&&(await (0,h.ds)(c,"C-d"),await new Promise(a=>setTimeout(a,u.Zf))),await (0,h.fY)(c)&&w.info("stopped-codex-session:sessionname")}catch(a){throw w.error("session:stop-failed",{error:x(a)}),a}}constructor(...a){super(...a),this.id="codex",this.name="Codex CLI",this.command="codex"}}var B=c(23365);let C=(0,q.h)("cli-tools/gemini");function D(a){return a instanceof Error?a.message:String(a)}class E extends d.Mj{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c){if(!await this.isInstalled())throw(0,v.Tl)(this);let d=this.getSessionName(a,c),e=await (0,h.N)(d);if(e){if(await this.reconcileExistingSession(d),await this.isToolLive(d,{confirm:!0}))return void C.info("gemini-session-sessionname");C.warn("gemini-session-relaunch",{sessionName:d})}(0,t.Fq)({worktreeId:a,cliToolId:r.o,instanceId:c});try{e||(await (0,h.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc)));let f=(0,t.wK)({target:{worktreeId:a,cliToolId:r.o,instanceId:c},executablePath:this.command,worktreePath:b});await (0,h.V1)(d,f,!0),await new Promise(a=>setTimeout(a,6e3)),await this.waitForReady(d),C.info("started-gemini-session:sessionname")}catch(b){let a=D(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,h.Xg)(a,B.H),d=(0,k.aJ)(c);if(k.wN.test(d))return void C.info("gemini-prompt-detected");!b&&d.includes("Do you trust this folder?")&&(await (0,h.ds)(a,"Enter"),b=!0,C.info("auto-trusted-folder-for"))}catch{}await new Promise(a=>setTimeout(a,1e3))}C.info("gemini-prompt-detection")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,h.Xg)(a,B.H),c=(0,k.aJ)(b);if(k.wN.test(c))return}catch{}await new Promise(a=>setTimeout(a,500))}C.info("gemini-prompt-not")}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,h.N)(d))throw Error(`Gemini session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await this.waitForPrompt(d),await (0,i.FW)({sessionName:d,message:b,cliToolId:"gemini",composer:this.describeComposer()}),(0,j.gm)(d),C.info("sent-message-to-gemini-session:sessionna")}catch(b){let a=D(b);throw Error(`Failed to send message to Gemini: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,h.N)(c)&&(await (0,h.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,u.Is)),await (0,h.V1)(c,"/quit",!0),await new Promise(a=>setTimeout(a,u.Zf))),await (0,h.fY)(c)&&C.info("stopped-gemini-session:sessionname")}catch(a){throw C.error("session:stop-failed",{error:D(a)}),a}}constructor(...a){super(...a),this.id="gemini",this.name="Gemini CLI",this.command="gemini"}}var F=c(15194),G=c(88807),H=c(56791);let I=(0,q.h)("cli-tools/vibe-local");function J(a){return a instanceof Error?a.message:String(a)}class K extends d.Mj{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c){if(!await this.isInstalled())throw(0,v.Tl)(this);let d=this.getSessionName(a,c),e=await (0,h.N)(d);if(e){if(await this.reconcileExistingSession(d),await this.isToolLive(d,{confirm:!0}))return void I.info("vibe-local-session");I.warn("vibe-local-session-relaunch",{sessionName:d})}(0,t.Fq)({worktreeId:a,cliToolId:this.id,instanceId:c});try{e||(await (0,h.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc)));let c="vibe-local -y";try{let b=(0,G.getDbInstance)(),d=(0,H.getWorktreeById)(b,a);d?.vibeLocalModel&&F.QP.test(d.vibeLocalModel)&&(c+=` -m ${d.vibeLocalModel}`);let e=d?.vibeLocalContextWindow;(0,F.FV)(e)&&(c+=` --context-window ${Number(e)}`)}catch{}await (0,h.V1)(d,c,!0),await new Promise(a=>setTimeout(a,5e3)),I.info("started-vibe-local-session:sessionname")}catch(b){let a=J(b);throw Error(`Failed to start Vibe Local session: ${a}`)}}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,h.N)(d))throw Error(`Vibe Local session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await (0,i.FW)({sessionName:d,message:b,cliToolId:"vibe-local",composer:this.describeComposer(),interEnterWaitMs:u.PY}),(0,j.gm)(d),I.info("sent-message-to-vibe-local-session:sessi")}catch(b){let a=J(b);throw Error(`Failed to send message to Vibe Local: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,h.N)(c)&&(await (0,h.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,u.Is)),await (0,h.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,u.Zf))),await (0,h.fY)(c)&&I.info("stopped-vibe-local-session:sessionname")}catch(a){throw I.error("session:stop-failed",{error:J(a)}),a}}constructor(...a){super(...a),this.id="vibe-local",this.name="Vibe Local",this.command="vibe-local"}}var L=c(41466),M=c(81776),N=c(56263),O=c(21758),P=c(54633),Q=c(77093);let R=(0,q.h)("cli-tools/copilot"),S=new Set(["model","agent","theme","permissions","skills","mcp","settings","statusline","subagents","resume","session"]),T=/^[>❯](?:\s|$)/;class U extends d.Mj{async isInstalled(){return await (0,M.B0)()!==null}launchExecutable(a){return"path"===a.source?this.command:O.nL}async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c){let d=await (0,M.B0)();if(!d)throw(0,v.Tl)(this);let e=this.getSessionName(a,c),f=await (0,h.N)(e);if(f){if(await this.reconcileExistingSession(e),await this.isToolLive(e,{confirm:!0}))return void R.info("copilot-session-exists");R.warn("copilot-session-relaunch",{sessionName:e})}(0,t.Fq)({worktreeId:a,cliToolId:P.V,instanceId:c});try{f||(await (0,h.jw)({sessionName:e,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc)));let g=(0,t.wK)({target:{worktreeId:a,cliToolId:P.V,instanceId:c},executablePath:this.launchExecutable(d),worktreePath:b});await (0,h.V1)(e,g,!0),await this.waitForReady(e),R.info("started-copilot-session",{executableSource:d.source,version:d.version})}catch(b){let a=(0,Q.u1)(b);throw Error(`Failed to start Copilot session: ${a}`)}}async answerFolderTrustDialog(a,b){return!!(0,k.Rx)(b)&&(await (0,h.V1)(a,k.oD,!1),(0,j.gm)(a),R.info("copilot-folder-trust-answered"),!0)}isComposerDrawn(a){let b=a.split("\n");for(let a=1;a<b.length-1;a++)if(T.test(b[a])&&k.A.test(b[a-1].trimEnd())&&k.A.test(b[a+1].trimEnd()))return!0;return!1}async waitForReady(a){let b=!1;for(let c=0;c<30;c++){try{let c=await (0,h.Xg)(a,50),d=(0,k.aJ)(c);if(this.isComposerDrawn(d))return void R.info("copilot-prompt-detected");!b&&await this.answerFolderTrustDialog(a,d)&&(b=!0)}catch{}await new Promise(a=>setTimeout(a,1e3))}R.info("copilot-prompt-detection-timeout")}async waitForPrompt(a,b=15e3){let c=Date.now(),d=!1;for(;Date.now()-c<b;){try{let b=await (0,h.Xg)(a,50),c=(0,k.aJ)(b);if(k.Du.test(c))return;!d&&await this.answerFolderTrustDialog(a,c)&&(d=!0)}catch{}await new Promise(a=>setTimeout(a,500))}R.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,h.Xg)(a,50),c=(0,k.aJ)(b);if((0,k.gT)(c.split("\n")))return R.info("copilot-selection-list-detected"),!0}catch{}}return R.info("copilot-selection-list-not-detected-timeout"),!1}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,h.N)(d))throw Error(`Copilot session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await this.waitForPrompt(d);let a=this.extractSlashCommand(b);if(a&&S.has(a)){await (0,h.V1)(d,b,!0),await this.waitForSelectionList(d),(0,j.gm)(d),R.info("sent-selection-list-command-to-copilot",{command:a});return}await (0,i.FW)({sessionName:d,message:b,cliToolId:"copilot",composer:this.describeComposer(),textInputWaitMs:N.L1,verifyDelayMs:N.wp}),(0,j.gm)(d),R.info("sent-message-to-copilot-session")}catch(b){let a=(0,Q.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,h.N)(d))throw Error(`Copilot session ${d} does not exist. Start the session first.`);try{await (0,h.V1)(d,`/model ${b}`,!0),await this.waitForPrompt(d,N.pL),(0,j.gm)(d),R.info("copilot-model-switched",{model:b})}catch(c){let a=(0,Q.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,h.N)(c)&&(await (0,h.ds)(c,"C-c"),await new Promise(a=>setTimeout(a,u.Is)),await (0,h.V1)(c,"/exit",!1),await new Promise(a=>setTimeout(a,N.L1)),await (0,h.KB)(c,["Enter"]),await new Promise(a=>setTimeout(a,u.Rk))),await (0,h.fY)(c)&&R.info("stopped-copilot-session")}catch(a){throw R.error("session:stop-failed",{error:(0,Q.u1)(a)}),a}}constructor(...a){super(...a),this.id="copilot",this.name="Copilot",this.command="copilot"}}let V=(0,q.h)("cli-tools/antigravity");function W(a){return a instanceof Error?a.message:String(a)}let X=/\?\s+for\s+shortcuts/,Y=/Do you trust the contents of this project\?/;function Z(a){return X.test(a)&&!Y.test(a)}class $ extends d.Mj{async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c,d){if(!await this.isInstalled())throw(0,v.Tl)(this);let e=this.getSessionName(a,c),f=await (0,h.N)(e);if(f){if(await this.reconcileExistingSession(e),await this.isToolLive(e,{confirm:!0}))return void V.info("antigravity-session-exists");V.warn("antigravity-session-relaunch",{sessionName:e})}(0,t.Fq)({worktreeId:a,cliToolId:r.F0,instanceId:c});try{f||(await (0,h.jw)({sessionName:e,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc)));let g=(0,t.wK)({target:{worktreeId:a,cliToolId:r.F0,instanceId:c},executablePath:this.command,worktreePath:b}),i=d?`${g} --model '${d.replace(/'/g,"'\\''")}'`:g;await (0,h.V1)(e,i,!0),await new Promise(a=>setTimeout(a,3e3)),await this.waitForReady(e),V.info("started-antigravity-session")}catch(b){let a=W(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,h.Xg)(a,50),d=(0,k.aJ)(c);if(Z(d))return void V.info("antigravity-prompt-detected");if(!b&&Y.test(d)){await (0,h.ds)(a,"Enter"),b=!0,V.info("auto-trusted-folder-for-antigravity"),await new Promise(a=>setTimeout(a,500));continue}}catch{}await new Promise(a=>setTimeout(a,1e3))}V.info("antigravity-prompt-detection-timeout")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,h.Xg)(a,50),c=(0,k.aJ)(b);if(Z(c))return}catch{}await new Promise(a=>setTimeout(a,500))}throw V.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,h.N)(d))throw Error(`Antigravity session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await this.waitForPrompt(d),await (0,i.FW)({sessionName:d,message:b,cliToolId:"antigravity",composer:this.describeComposer()}),(0,j.gm)(d),V.info("sent-message-to-antigravity-session")}catch(b){let a=W(b);throw Error(`Failed to send message to Antigravity: ${a}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,h.N)(c)&&(await (0,h.ds)(c,"C-d"),await new Promise(a=>setTimeout(a,u.Zf)));let a=await (0,h.fY)(c);(0,j.gm)(c),a&&V.info("stopped-antigravity-session")}catch(a){throw V.error("session:stop-failed",{error:W(a)}),a}}constructor(...a){super(...a),this.id="antigravity",this.name="Antigravity CLI",this.command="agy"}}var _=c(28862);let aa=(0,q.h)("cli-tools/command-code"),ab=["--trust","--skip-onboarding","--no-auto-update"];function ac(a){let b=a.split("\n");return!(0>(0,k.I$)(b))&&!k.k0.test((0,k.aJ)(a))}class ad extends d.Mj{navigationKeys(){return{keys:e.pU,leaderKey:null}}async isRunning(a,b){let c=this.getSessionName(a,b);return await (0,h.N)(c)}async launchSession(a,b,c){if(!await this.isInstalled())throw(0,v.Tl)(this);let d=this.getSessionName(a,c),e=await (0,h.N)(d);if(e){if(await this.reconcileExistingSession(d),await this.isToolLive(d,{confirm:!0}))return void aa.info("command-code-session-exists");aa.warn("command-code-session-relaunch",{sessionName:d})}(0,t.Fq)({worktreeId:a,cliToolId:_.k,instanceId:c});try{var f;e||(await (0,h.jw)({sessionName:d,workingDirectory:b}),await new Promise(a=>setTimeout(a,u.Uc))),await (0,h.V1)(d,(f={target:{worktreeId:a,cliToolId:_.k,instanceId:c},executablePath:this.command,worktreePath:b},[(0,t.wK)(f),...ab].join(" ")),!0),await new Promise(a=>setTimeout(a,u.yO)),await this.waitForReady(d),aa.info("started-command-code-session")}catch(a){throw Error(`Failed to start Command Code session: ${(0,Q.u1)(a)}`)}}async waitForReady(a){for(let b=0;b<30;b++){try{let b=await (0,h.Xg)(a,50);if(ac(b))return void aa.info("command-code-prompt-detected")}catch{}await new Promise(a=>setTimeout(a,1e3))}aa.info("command-code-prompt-detection-timeout")}async waitForPrompt(a){let b=Date.now();for(;Date.now()-b<15e3;){try{let b=await (0,h.Xg)(a,50);if(ac(b))return}catch{}await new Promise(a=>setTimeout(a,500))}throw aa.info("command-code-prompt-not-ready"),Error("Command Code prompt not ready: timed out waiting for the composer before sending")}async sendMessage(a,b,c){let d=this.getSessionName(a,c);if(!await (0,h.N)(d))throw Error(`Command Code session ${d} does not exist. Start the session first.`);await this.relaunchIfToolExited(a,c);try{await this.waitForPrompt(d),await (0,i.FW)({sessionName:d,message:b,cliToolId:"command-code",composer:this.describeComposer()}),(0,j.gm)(d),aa.info("sent-message-to-command-code-session")}catch(a){throw Error(`Failed to send message to Command Code: ${(0,Q.u1)(a)}`)}}async killSession(a,b){let c=this.getSessionName(a,b);try{await (0,h.N)(c)&&(await (0,h.V1)(c,"/exit",!1),await new Promise(a=>setTimeout(a,u.pL)),await (0,h.KB)(c,["Enter"]),await new Promise(a=>setTimeout(a,u.Zf)));let a=await (0,h.fY)(c);(0,j.gm)(c),a&&aa.info("stopped-command-code-session")}catch(a){throw aa.error("session:stop-failed",{error:(0,Q.u1)(a)}),a}}constructor(...a){super(...a),this.id="command-code",this.name="Command Code CLI",this.command="commandcode"}}class ae{constructor(){this.tools=new Map,this.tools.set("claude",new g),this.tools.set("codex",new A),this.tools.set("gemini",new E),this.tools.set("vibe-local",new K),this.tools.set("opencode",new L.Ui),this.tools.set("copilot",new U),this.tools.set("antigravity",new $),this.tools.set("command-code",new ad)}static getInstance(){return ae.instance||(ae.instance=new ae),ae.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)}async stopPollers(a,b,d){let{stopPolling:e}=await Promise.all([c.e(1356),c.e(1503),c.e(1634),c.e(1191),c.e(1719),c.e(2119),c.e(2445),c.e(6337),c.e(595),c.e(3323),c.e(8918),c.e(650),c.e(7875),c.e(5220)]).then(c.bind(c,95220));e(a,b,d)}}},56263:(a,b,c)=>{c.d(b,{L1:()=>e,MJ:()=>j,Rf:()=>f,ky:()=>g,lM:()=>i,pL:()=>h,wp:()=>d,zt:()=>k});let d=200,e=100,f=1e5,g="[... truncated ...]",h=3e4,i=/^[a-zA-Z0-9][a-zA-Z0-9\-._/:]*$/,j=128,k="Install with: brew install copilot-cli (macOS) or npm i -g @github/copilot"},70849:(a,b,c)=>{c.d(b,{LQ:()=>k,SW:()=>l});var d=c(72626),e=c(84574),f=c(48083),g=c(77634),h=c(27939);let i=(0,d.h)("lib/session/opencode-session-recall");async function j(a,b){let c=new Set,d=await (0,g.GP)(a,b);for(let b=0;b<3;b+=1){if(null===d)return null;if(null===d.parentId||c.has(d.parentId))break;c.add(d.parentId),i.debug("opencode-session-parent-hop",{from:d.id,to:d.parentId}),d=await (0,g.GP)(a,d.parentId)}return d}async function k(a){let b=a.instanceId??a.cliToolId,c=(0,e.hC)(a);if(null===c)return{captured:!1,skipped:"no-port"};let d=(0,f.getLastAgentEvent)(a.worktreeId,"opencode",a.instanceId)?.sessionId;if(!(0,h.jp)(d))return{captured:!1,skipped:"no-session-observed"};let g=await j(c,d);if(null===g)return{captured:!1,skipped:"session-unreadable"};if(null===g.directory)return{captured:!1,skipped:"no-directory"};let k=(0,e.U9)(a);return null!==k&&k!==g.directory?(i.warn("opencode-session-capture-directory-mismatch",{worktreeId:a.worktreeId,instanceId:b,expected:k,reported:g.directory}),{captured:!1,skipped:"directory-mismatch"}):(0,h.F_)(a,{sessionId:g.id,title:g.title,worktreePath:g.directory})?(i.info("opencode-session-captured",{worktreeId:a.worktreeId,instanceId:b,sessionId:g.id,viaParentOf:g.id===d?null:d}),{captured:!0,memory:{sessionId:g.id,title:g.title,worktreePath:g.directory,updatedAt:Date.now()}}):{captured:!1,skipped:"not-persisted"}}async function l(a){let b=(0,e.hC)(a),c=(0,f.getLastAgentEvent)(a.worktreeId,"opencode",a.instanceId)?.sessionId;if(null!==b&&(0,h.jp)(c)){let a=await j(b,c);if(null!==a)return a.id}return(0,h.KA)(a)?.sessionId??null}},72272:(a,b,c)=>{c.d(b,{t:()=>i});var d=c(72626),e=c(50474),f=c(25071),g=c(17287);let h=(0,d.h)("lib/hooks/permission-adjudication");async function i(a,b,d,j,k="event"){let l=b.instanceId??b.cliToolId,m={worktreeId:b.worktreeId,cliToolId:b.cliToolId,instanceId:l},{resolvePermissionRequest:n}=await c.e(3241).then(c.bind(c,43241)),o=n(m,j),p="allow"===o.behavior?{kind:"allowOnce"}:{kind:"abstain"};if("abstain"===p.kind){let c=(0,e.y_)(a);c.safe||h.warn("permission-request-abstain-blocks-agent",{worktreeId:b.worktreeId,cliToolId:b.cliToolId,instanceId:l,toolName:j?.toolName??null,decisionId:d.id,reason:o.reason,consequence:c.summary,blocksForMs:c.blocksForMs})}let{delivery:q}=await (0,f.GW)(a,b,d,p),r=q?.delivered===!0,s=r&&a.capabilities.permissionReplyReleasesPrompt;return(0,g.nL)(b.worktreeId,b.cliToolId,b.instanceId,{decisionId:d.id,toolName:j?.toolName??null,behavior:"allow"===o.behavior?"allow":null,reason:o.reason,delivered:r,releasedPrompt:s,trigger:k,at:d.askedAt}),h.info("permission-decision-adjudicated",{worktreeId:b.worktreeId,cliToolId:b.cliToolId,instanceId:l,decisionId:d.id,toolName:j?.toolName??null,behavior:o.behavior,reason:o.reason,suppressedBy:o.suppressedBy,delivered:r,settled:s,trigger:k}),{decisionId:d.id,behavior:"allow"===o.behavior?"allow":null,reason:o.reason,delivered:r,settled:s}}},77634:(a,b,c)=>{c.d(b,{GP:()=>l,Hv:()=>h,eJ:()=>n,mf:()=>o,y4:()=>m,yg:()=>p});var d=c(72626),e=c(49791),f=c(27939);let g=(0,d.h)("lib/session/opencode-session-api"),h="session_new";function i(a,b){let c=a[b];return"string"==typeof c&&c.length>0?c:null}async function j(a,b){try{let c=await fetch(a,{...b,redirect:e.uS,signal:AbortSignal.timeout(e.T0)});if(!c.ok)return null;if(!function(a){let b=a.headers?.get?.("content-type");return"string"==typeof b&&b.split(";",1)[0]?.trim().toLowerCase()===e._t}(c))return g.debug("opencode-session-request-content-type",{url:a,contentType:c.headers?.get?.("content-type")??null}),null;return await c.json()}catch(b){return g.debug("opencode-session-request-failed",{url:a,error:b instanceof Error?b.message:String(b)}),null}}function k(a){if(!("object"==typeof a&&null!==a&&!Array.isArray(a)))return null;let b=i(a,"id");if(!(0,f.jp)(b))return null;let c=i(a,"title");return{id:b,title:null===c?null:c.slice(0,f.Y2),directory:i(a,"directory"),parentId:i(a,"parentID")}}async function l(a,b){return(0,f.jp)(b)?k(await j(`${(0,e.M2)(a)}/session/${encodeURIComponent(b)}`)):null}async function m(a,b){return(0,f.jp)(b)?k(await j(`${(0,e.M2)(a)}/session/${encodeURIComponent(b)}/fork`,{method:"POST",headers:{"content-type":e._t},body:"{}"})):null}async function n(a){return!0===await j(`${(0,e.M2)(a)}/tui/open-sessions`,{method:"POST",headers:{"content-type":e._t},body:"{}"})}async function o(a,b){return!0===await j(`${(0,e.M2)(a)}/tui/execute-command`,{method:"POST",headers:{"content-type":e._t},body:JSON.stringify({command:b})})}async function p(a,b){return!!(0,f.jp)(b)&&!0===await j(`${(0,e.M2)(a)}/tui/select-session`,{method:"POST",headers:{"content-type":e._t},body:JSON.stringify({sessionID:b})})}},78099:(a,b,c)=>{c.d(b,{Tl:()=>g});var d=c(56263),e=c(2669);let f={claude:"Install with: npm install -g @anthropic-ai/claude-code",codex:"Install with: npm install -g @openai/codex",gemini:"Install with: npm install -g @google/gemini-cli",opencode:"Install with: npm install -g opencode-ai",copilot:d.zt,"command-code":"Install with: npm install -g command-code",antigravity:"Install the Antigravity CLI: https://antigravity.google/docs/cli/reference","vibe-local":"vibe-local is a local script rather than a published package: put your own `vibe-local` executable on PATH."};function g(a){var b;return new e.lU(a.name,(b=a,`${b.name} (${b.command}) is not installed or not in PATH. ${f[b.id]}`))}},81886:(a,b,c)=>{c.d(b,{Km:()=>A,Mj:()=>z});var d=c(79646),e=c(28354),f=c(40964),g=c(79892),h=c(56717),i=c(23365),j=c(93949),k=c(91536),l=c(50945),m=c(96287),n=c(51297),o=c(87447),p=c(45567),q=c(72626),r=c(8953),s=c(20610),t=c(16983);let u=(0,e.promisify)(d.exec),v=(0,q.h)("cli-tools/base"),w=RegExp(`${p.ZM}=(?:'([^']*)'|"([^"]*)"|(\\S+))`,"g"),x=new Set,y=new Set;class z{async isInstalled(){try{return await u(`which ${this.command}`,{timeout:5e3}),!0}catch{return!1}}getSessionName(a,b){return(0,f.m)(this.id,a,b)}async startSession(a,b,c,d){try{await this.launchSession(a,b,c,d)}catch(b){throw this.takeAdoptionMark(a,c),(0,m.Zl)({worktreeId:a,cliToolId:this.id,instanceId:c,toolName:this.name},b),b}let e=this.takeAdoptionMark(a,c);null!==e&&await this.warnIfHookUrlIsStale(a,e,c)}async reconcileExistingSession(a,b){x.add(a),await (0,g.zT)(a,b)}takeAdoptionMark(a,b){try{let c=this.getSessionName(a,b);return x.delete(c)?c:null}catch{return null}}async warnIfHookUrlIsStale(a,b,c){if(!y.has(b))try{let d=await (0,g.Xg)(b,{startLine:-t.eu});y.add(b);let e=function(a){let b=null;for(let c of(0,n.aJ)(a).matchAll(w)){let a=c[1]??c[2]??c[3]??null;a&&(b=a)}return b}(d);if(null===e)return;let f=function(a){try{let b=new URL(a);if(""!==b.port)return Number(b.port);return"https:"===b.protocol?443:80}catch{return null}}(e),h=(0,o.D0)();if(null===f||f===h)return;v.warn("session:hook-url-stale",{cliToolId:this.id,sessionName:b,sessionPort:f,serverPort:h}),(0,m.ED)({worktreeId:a,cliToolId:this.id,instanceId:c,toolName:this.name,sessionPort:f,serverPort:h})}catch(b){v.debug("session:hook-url-probe-failed",{cliToolId:this.id,worktreeId:a,error:b instanceof Error?b.message:String(b)})}}async warnIfRunningSessionHookUrlIsStale(a,b){let c;try{c=this.getSessionName(a,b)}catch{return}await this.warnIfHookUrlIsStale(a,c,b)}async interrupt(a,b){let c=this.getSessionName(a,b);await (0,g.ds)(c,"Escape")}describeComposer(){return(0,h.gc)(this.id)}gracefulExitSequence(){return(0,j.JV)(this.id)}captureSpec(){return(0,i.y)(this.id)}livenessSpec(){return(0,k.H7)(this.id)}async isToolLive(a,b){let c=this.livenessSpec(),d=await (0,l.Q)(a,c);if(d.alive)return!0;if(!b?.confirm)return!1;await new Promise(a=>setTimeout(a,s.kZ));let e=await (0,l.Q)(a,c);return e.alive?(v.info("session:liveness-confirm-recovered",{cliToolId:this.id,firstReason:d.reason}),!0):(v.warn("session:tool-exited",{cliToolId:this.id,reason:e.reason}),!1)}async relaunchIfToolExited(a,b){let c=this.getSessionName(a,b);if(await this.isToolLive(c))return;let d=await (0,g.nS)(c);if(null===d)return void v.warn("session:relaunch-skipped-no-path",{cliToolId:this.id,worktreeId:a});v.info("session:relaunch-before-send",{cliToolId:this.id,sessionName:c}),await this.startSession(a,d,b)}navigationKeys(){return{keys:r.qD,leaderKey:null}}}function A(a,b,c){a instanceof z&&a.warnIfRunningSessionHookUrlIsStale(b,c).catch(()=>{})}},93949:(a,b,c)=>{c.d(b,{JV:()=>i,rY:()=>k});var d=c(56263),e=c(20610),f=c(86069);let g={keys:[(0,f.IS)("C-d")],exitWaitMs:e.Zf,ownsLoopbackServer:!1},h={claude:g,codex:g,antigravity:g,gemini:{keys:[(0,f.IS)("C-c",e.Is),(0,f.iF)(`/quit\r`,void 0)],exitWaitMs:e.Zf,ownsLoopbackServer:!1},"vibe-local":{keys:[(0,f.IS)("C-c",e.Is),(0,f.IS)("C-c")],exitWaitMs:e.Zf,ownsLoopbackServer:!1},copilot:{keys:[(0,f.IS)("C-c",e.Is),(0,f.iF)("/exit",d.L1),(0,f.IS)("Enter")],exitWaitMs:e.Rk,ownsLoopbackServer:!1},"command-code":{keys:[(0,f.iF)("/exit",e.pL),(0,f.IS)("Enter")],exitWaitMs:e.Zf,ownsLoopbackServer:!1},opencode:{keys:[(0,f.iF)("/exit",e.pL),(0,f.IS)("Enter")],exitWaitMs:e.KI,ownsLoopbackServer:!0}};function i(a){return h[a]??g}let j=a=>new Promise(b=>setTimeout(b,a));async function k(a){let b=Math.max(1,a.attempts??1),c=a.intervalMs??0,d=a.sleep??j,e=!0;for(let f=0;f<b&&(e=await a.sessionAlive());f+=1)f<b-1&&c>0&&await d(c);if(e)return{ok:!1,reason:"graceful_exit_timeout"};let f=a.portAnswering;if(!f)return{ok:!0};let g=!0;for(let a=0;a<b&&(g=await f());a+=1)a<b-1&&c>0&&await d(c);return g?{ok:!1,reason:"port_orphaned"}:{ok:!0}}},96287:(a,b,c)=>{c.d(b,{$k:()=>h,ED:()=>g,VI:()=>i,Zl:()=>e});var d=c(78099);function e(a,b){Promise.all([c.e(1356),c.e(1191),c.e(6337)]).then(c.bind(c,81099)).then(({notifySessionStartFailurePush:c})=>c({...a,error:b})).catch(()=>{})}let f=new Set;function g(a){let b=[a.worktreeId,a.instanceId??a.cliToolId,a.sessionPort,a.serverPort].join(":");f.has(b)||(f.add(b),Promise.all([c.e(1356),c.e(1191),c.e(6337)]).then(c.bind(c,81099)).then(({notifyStaleHookUrlPush:b})=>b(a)).catch(()=>{}))}async function h(a,b){if(await a.isInstalled())return;let c=(0,d.Tl)(a);throw e({worktreeId:b.worktreeId,cliToolId:a.id,instanceId:b.instanceId,toolName:a.name,subject:b.subject},c),c}function i(a,b){Promise.resolve().then(c.bind(c,43234)).then(({CLIToolManager:c})=>{let f=c.getInstance().getTool(a);e({worktreeId:b.worktreeId,cliToolId:a,instanceId:b.instanceId,toolName:f.name,subject:b.subject},(0,d.Tl)(f))}).catch(()=>{})}}};
|