agent-log-viewer 1.2.1 → 1.2.2
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/dist/mcp-server.mjs +2225 -1385
- package/dist/runtime-host.mjs +1690 -972
- package/dist/standalone/.next/BUILD_ID +1 -1
- package/dist/standalone/.next/app-path-routes-manifest.json +26 -24
- package/dist/standalone/.next/build-manifest.json +2 -2
- package/dist/standalone/.next/prerender-manifest.json +4 -4
- package/dist/standalone/.next/required-server-files.json +1 -0
- package/dist/standalone/.next/routes-manifest.json +12 -0
- package/dist/standalone/.next/server/account-migration-controller-worker.js +1 -1
- package/dist/standalone/.next/server/app/_global-error/page.js +2 -2
- package/dist/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found/page.js +1 -1
- package/dist/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/standalone/.next/server/app/_not-found.rsc +2 -2
- package/dist/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/api/access/route.js +1 -1
- package/dist/standalone/.next/server/app/api/access/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/account-migrations/[intentId]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/account-migrations/[intentId]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/account-project-bindings/route.js +1 -1
- package/dist/standalone/.next/server/app/api/account-project-bindings/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/[id]/status/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/[id]/status/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/active/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/active/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/limits/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/limits/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/input/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/input/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/policy/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/policy/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/terminal/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/terminal/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/cli/route.js +1 -0
- package/dist/standalone/.next/server/app/api/accounts/cli/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/accounts/cli/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/accounts/codex/active/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/active/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/limits/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/limits/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/policy/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/policy/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/reset-credits/route.js +2 -2
- package/dist/standalone/.next/server/app/api/accounts/codex/reset-credits/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/terminal/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/terminal/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/agent/route.js +1 -1
- package/dist/standalone/.next/server/app/api/agent/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/agent/snapshot/route.js +1 -1
- package/dist/standalone/.next/server/app/api/agent/snapshot/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/answer/route.js +1 -1
- package/dist/standalone/.next/server/app/api/answer/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/artifact/route.js +1 -1
- package/dist/standalone/.next/server/app/api/artifact/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/attach-command/route.js +1 -1
- package/dist/standalone/.next/server/app/api/attach-command/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/attention/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/attention/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/attention/route.js +1 -1
- package/dist/standalone/.next/server/app/api/attention/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/board/route.js +1 -1
- package/dist/standalone/.next/server/app/api/board/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/bridge/route.js +1 -1
- package/dist/standalone/.next/server/app/api/bridge/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/conversation-host/route.js +1 -1
- package/dist/standalone/.next/server/app/api/conversation-host/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/conversation-host/targets/route.js +1 -1
- package/dist/standalone/.next/server/app/api/conversation-host/targets/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/conversations/[conversationId]/migration/route.js +1 -1
- package/dist/standalone/.next/server/app/api/conversations/[conversationId]/migration/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/conversations/route.js +1 -1
- package/dist/standalone/.next/server/app/api/conversations/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/files/route.js +6 -3
- package/dist/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/flows/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/flows/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/image/route.js +1 -1
- package/dist/standalone/.next/server/app/api/image/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/inbox/route.js +2 -2
- package/dist/standalone/.next/server/app/api/inbox/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/lifecycle/reaper/route.js +1 -1
- package/dist/standalone/.next/server/app/api/lifecycle/reaper/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/limits/history/route.js +1 -1
- package/dist/standalone/.next/server/app/api/limits/history/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/limits/route.js +1 -1
- package/dist/standalone/.next/server/app/api/limits/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/preflight/route.js +1 -1
- package/dist/standalone/.next/server/app/api/log/preflight/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/project-delete/route.js +1 -1
- package/dist/standalone/.next/server/app/api/log/project-delete/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/provenance/route.js +14 -12
- package/dist/standalone/.next/server/app/api/log/provenance/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/route.js +1 -1
- package/dist/standalone/.next/server/app/api/log/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/suggestions/route.js +2 -2
- package/dist/standalone/.next/server/app/api/log/suggestions/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/logs/route.js +1 -1
- package/dist/standalone/.next/server/app/api/logs/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/logs/stream/route.js +2 -2
- package/dist/standalone/.next/server/app/api/logs/stream/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/monitor/runs/route.js +1 -1
- package/dist/standalone/.next/server/app/api/monitor/runs/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/monitor/seat-tick/route.js +6 -5
- package/dist/standalone/.next/server/app/api/monitor/seat-tick/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/monitor/seat-tick/settings/route.js +2 -2
- package/dist/standalone/.next/server/app/api/monitor/seat-tick/settings/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/onboarding/route.js +1 -0
- package/dist/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/orchestrator/rotate/route.js +1 -1
- package/dist/standalone/.next/server/app/api/orchestrator/rotate/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/orchestrator/seat/route.js +1 -1
- package/dist/standalone/.next/server/app/api/orchestrator/seat/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/orchestrator/seat/status/route.js +1 -1
- package/dist/standalone/.next/server/app/api/orchestrator/seat/status/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/preflight/route.js +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/preflight/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/route.js +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/tick/route.js +1 -2
- package/dist/standalone/.next/server/app/api/pipelines/tick/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/proc/route.js +1 -1
- package/dist/standalone/.next/server/app/api/proc/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/projects/create/route.js +2 -2
- package/dist/standalone/.next/server/app/api/projects/create/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/projects/crown/route.js +1 -1
- package/dist/standalone/.next/server/app/api/projects/crown/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/projects/directories/route.js +1 -1
- package/dist/standalone/.next/server/app/api/projects/directories/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/push/route.js +2 -2
- package/dist/standalone/.next/server/app/api/push/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/resources/route.js +1 -1
- package/dist/standalone/.next/server/app/api/resources/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/roles/route.js +3 -3
- package/dist/standalone/.next/server/app/api/roles/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/answer/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/answer/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/[deploymentId]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/[deploymentId]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/capabilities/v1/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/capabilities/v1/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/hosts/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/hosts/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/inject/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/inject/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/interrupt/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/interrupt/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/operations/[operationId]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/operations/[operationId]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/operations/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/operations/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/queue/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/queue/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/realtime/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/realtime/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/send/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/send/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/snapshot/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/snapshot/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/spawn/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/spawn/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/steer/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/steer/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/stream/route.js +2 -2
- package/dist/standalone/.next/server/app/api/runtime/stream/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/search/transcripts/route.js +1 -1
- package/dist/standalone/.next/server/app/api/search/transcripts/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/session/route.js +1 -1
- package/dist/standalone/.next/server/app/api/session/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/session/supersedence/route.js +1 -1
- package/dist/standalone/.next/server/app/api/session/supersedence/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/session/title/route.js +1 -1
- package/dist/standalone/.next/server/app/api/session/title/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/spawn/policy/route.js +2 -2
- package/dist/standalone/.next/server/app/api/spawn/policy/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/spawn/route.js +1 -1
- package/dist/standalone/.next/server/app/api/spawn/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/spawn/validate/route.js +1 -1
- package/dist/standalone/.next/server/app/api/spawn/validate/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/staging/route.js +2 -2
- package/dist/standalone/.next/server/app/api/staging/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/task-attachments/route.js +2 -2
- package/dist/standalone/.next/server/app/api/task-attachments/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/assignment/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/assignment/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/curator/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/curator/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/telegram/reports/route.js +1 -1
- package/dist/standalone/.next/server/app/api/telegram/reports/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/telegram/route.js +1 -1
- package/dist/standalone/.next/server/app/api/telegram/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/timeline/route.js +1 -1
- package/dist/standalone/.next/server/app/api/timeline/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tmux/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tmux/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tmux/targets/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tmux/targets/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/backend/route.js +2 -2
- package/dist/standalone/.next/server/app/api/transcribe/backend/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/route.js +2 -2
- package/dist/standalone/.next/server/app/api/transcribe/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/token/route.js +2 -2
- package/dist/standalone/.next/server/app/api/transcribe/token/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tts/backend/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tts/backend/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tts/route.js +2 -2
- package/dist/standalone/.next/server/app/api/tts/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/view/presence/route.js +2 -1
- package/dist/standalone/.next/server/app/api/view/presence/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/workflows/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/workflows/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/workflows/route.js +1 -1
- package/dist/standalone/.next/server/app/api/workflows/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/favicon.ico/route.js +1 -1
- package/dist/standalone/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/index.html +1 -1
- package/dist/standalone/.next/server/app/index.rsc +3 -3
- package/dist/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/dist/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/dist/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/page.js +20 -20
- package/dist/standalone/.next/server/app/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app-paths-manifest.json +26 -24
- package/dist/standalone/.next/server/chunks/107.js +1 -1
- package/dist/standalone/.next/server/chunks/1106.js +5 -0
- package/dist/standalone/.next/server/chunks/112.js +1 -0
- package/dist/standalone/.next/server/chunks/1406.js +35 -168
- package/dist/standalone/.next/server/chunks/1585.js +3 -3
- package/dist/standalone/.next/server/chunks/160.js +18 -18
- package/dist/standalone/.next/server/chunks/1617.js +1 -1
- package/dist/standalone/.next/server/chunks/1849.js +1 -1
- package/dist/standalone/.next/server/chunks/1952.js +1 -1
- package/dist/standalone/.next/server/chunks/2499.js +1 -0
- package/dist/standalone/.next/server/chunks/2555.js +1 -1
- package/dist/standalone/.next/server/chunks/2589.js +127 -0
- package/dist/standalone/.next/server/chunks/261.js +1 -0
- package/dist/standalone/.next/server/chunks/2744.js +1 -1
- package/dist/standalone/.next/server/chunks/286.js +2 -2
- package/dist/standalone/.next/server/chunks/2914.js +20 -21
- package/dist/standalone/.next/server/chunks/2916.js +1 -0
- package/dist/standalone/.next/server/chunks/3086.js +1 -1
- package/dist/standalone/.next/server/chunks/3407.js +1 -1
- package/dist/standalone/.next/server/chunks/3509.js +1 -0
- package/dist/standalone/.next/server/chunks/3570.js +1 -1
- package/dist/standalone/.next/server/chunks/3696.js +5 -0
- package/dist/standalone/.next/server/chunks/3743.js +9 -9
- package/dist/standalone/.next/server/chunks/3784.js +5 -0
- package/dist/standalone/.next/server/chunks/3830.js +1 -1
- package/dist/standalone/.next/server/chunks/3957.js +1 -0
- package/dist/standalone/.next/server/chunks/4037.js +1 -1
- package/dist/standalone/.next/server/chunks/4651.js +1 -1
- package/dist/standalone/.next/server/chunks/4972.js +38 -16
- package/dist/standalone/.next/server/chunks/53.js +1 -0
- package/dist/standalone/.next/server/chunks/5408.js +1 -1
- package/dist/standalone/.next/server/chunks/5465.js +156 -0
- package/dist/standalone/.next/server/chunks/5545.js +1 -1
- package/dist/standalone/.next/server/chunks/568.js +1 -1
- package/dist/standalone/.next/server/chunks/6023.js +1 -1
- package/dist/standalone/.next/server/chunks/6211.js +1 -0
- package/dist/standalone/.next/server/chunks/6289.js +1 -2
- package/dist/standalone/.next/server/chunks/6418.js +1 -0
- package/dist/standalone/.next/server/chunks/6453.js +1 -1
- package/dist/standalone/.next/server/chunks/6522.js +1 -1
- package/dist/standalone/.next/server/chunks/6796.js +1 -1
- package/dist/standalone/.next/server/chunks/6826.js +3 -3
- package/dist/standalone/.next/server/chunks/6942.js +3 -3
- package/dist/standalone/.next/server/chunks/6978.js +1 -1
- package/dist/standalone/.next/server/chunks/7008.js +21 -19
- package/dist/standalone/.next/server/chunks/7192.js +1 -1
- package/dist/standalone/.next/server/chunks/7238.js +2 -2
- package/dist/standalone/.next/server/chunks/7294.js +1 -0
- package/dist/standalone/.next/server/chunks/7722.js +1 -1
- package/dist/standalone/.next/server/chunks/781.js +17 -17
- package/dist/standalone/.next/server/chunks/8027.js +1 -1
- package/dist/standalone/.next/server/chunks/8330.js +1 -0
- package/dist/standalone/.next/server/chunks/8444.js +1 -1
- package/dist/standalone/.next/server/chunks/8512.js +1 -1
- package/dist/standalone/.next/server/chunks/8513.js +2 -2
- package/dist/standalone/.next/server/chunks/8617.js +1 -1
- package/dist/standalone/.next/server/chunks/8817.js +2 -2
- package/dist/standalone/.next/server/chunks/8966.js +1 -1
- package/dist/standalone/.next/server/chunks/8985.js +1 -1
- package/dist/standalone/.next/server/chunks/8996.js +1 -1
- package/dist/standalone/.next/server/chunks/9006.js +1 -0
- package/dist/standalone/.next/server/chunks/9060.js +4 -0
- package/dist/standalone/.next/server/chunks/9296.js +20 -21
- package/dist/standalone/.next/server/chunks/9298.js +1 -2
- package/dist/standalone/.next/server/chunks/9307.js +1 -1
- package/dist/standalone/.next/server/chunks/9360.js +12 -12
- package/dist/standalone/.next/server/chunks/9517.js +1 -1
- package/dist/standalone/.next/server/chunks/9611.js +1 -0
- package/dist/standalone/.next/server/chunks/9822.js +1 -1
- package/dist/standalone/.next/server/chunks/9839.js +5 -0
- package/dist/standalone/.next/server/chunks/9867.js +1 -0
- package/dist/standalone/.next/server/chunks/9940.js +37 -15
- package/dist/standalone/.next/server/chunks/9998.js +1 -1
- package/dist/standalone/.next/server/file-scanner-worker.js +1 -1
- package/dist/standalone/.next/server/files-response-worker.js +2 -2
- package/dist/standalone/.next/server/functions-config-manifest.json +2 -0
- package/dist/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/standalone/.next/server/middleware.js +3 -3
- package/dist/standalone/.next/server/pages/404.html +1 -1
- package/dist/standalone/.next/server/pages/500.html +1 -1
- package/dist/standalone/.next/server/resource-collector-worker.js +1 -1
- package/dist/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/standalone/.next/server/state-backup-worker.js +3 -0
- package/dist/standalone/.next/server/wakatime-sync-worker.js +1 -1
- package/dist/standalone/.next/static/chunks/9591-0fd6a5a4172de16d.js +1 -0
- package/dist/standalone/.next/static/chunks/app/_global-error/page-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/access/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/account-migrations/[intentId]/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/account-project-bindings/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/[id]/status/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/active/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/limits/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/input/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/policy/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/terminal/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/cli/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/active/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/limits/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/policy/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/reset-credits/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/terminal/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/agent/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/agent/snapshot/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/answer/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/artifact/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/attach-command/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/attention/[id]/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/attention/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/board/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/bridge/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/conversation-host/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/conversation-host/targets/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/conversations/[conversationId]/migration/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/conversations/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/files/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/image/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/lifecycle/reaper/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/limits/history/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/limits/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/preflight/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/project-delete/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/provenance/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/suggestions/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/logs/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/logs/stream/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/monitor/runs/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/monitor/seat-tick/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/monitor/seat-tick/settings/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/onboarding/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/rotate/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/status/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/pipelines/[id]/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/pipelines/preflight/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/pipelines/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/pipelines/tick/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/proc/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/projects/create/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/projects/crown/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/projects/directories/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/push/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/resources/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/roles/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/answer/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/[deploymentId]/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/capabilities/v1/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/hosts/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/inject/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/interrupt/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/operations/[operationId]/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/operations/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/queue/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/realtime/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/send/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/snapshot/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/spawn/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/steer/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/stream/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/search/transcripts/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/session/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/session/supersedence/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/session/title/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/spawn/policy/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/spawn/validate/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/staging/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/task-attachments/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/assignment/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/curator/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/telegram/reports/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/telegram/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tmux/targets/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/backend/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tts/backend/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tts/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/view/presence/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/workflows/[id]/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/workflows/route-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/page-a2e19d755e17b569.js +125 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-151390fbd8c93c25.js +1 -0
- package/dist/standalone/.next/static/css/9b32c3f7f468cbcc.css +1 -0
- package/dist/standalone/.next/static/fQ2a5S10vvpyAqE0L_wUj/_buildManifest.js +1 -0
- package/dist/standalone/package.json +1 -1
- package/dist/standalone/server.bun.js +1 -1
- package/dist/standalone/src/lib/viewerInstrumentation.ts +44 -1
- package/package.json +1 -1
- package/dist/standalone/.next/server/chunks/1888.js +0 -1
- package/dist/standalone/.next/server/chunks/4127.js +0 -1
- package/dist/standalone/.next/server/chunks/606.js +0 -126
- package/dist/standalone/.next/static/836HTp-5V8cZC5YWFVOCk/_buildManifest.js +0 -1
- package/dist/standalone/.next/static/chunks/7333-cf17cea2a91e7b4b.js +0 -1
- package/dist/standalone/.next/static/chunks/app/_global-error/page-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/access/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/account-migrations/[intentId]/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/account-project-bindings/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/[id]/status/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/active/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/limits/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/input/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/policy/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/terminal/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/active/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/limits/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/policy/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/reset-credits/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/terminal/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/agent/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/agent/snapshot/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/answer/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/artifact/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/attach-command/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/attention/[id]/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/attention/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/board/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/bridge/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/conversation-host/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/conversation-host/targets/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/conversations/[conversationId]/migration/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/conversations/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/files/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/flows/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/image/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/lifecycle/reaper/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/limits/history/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/limits/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/preflight/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/project-delete/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/provenance/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/suggestions/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/logs/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/logs/stream/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/monitor/runs/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/monitor/seat-tick/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/monitor/seat-tick/settings/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/rotate/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/status/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/pipelines/[id]/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/pipelines/preflight/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/pipelines/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/pipelines/tick/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/proc/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/projects/create/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/projects/crown/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/projects/directories/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/push/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/resources/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/roles/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/answer/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/[deploymentId]/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/capabilities/v1/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/hosts/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/inject/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/interrupt/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/operations/[operationId]/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/operations/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/queue/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/realtime/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/send/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/snapshot/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/spawn/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/steer/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/stream/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/search/transcripts/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/session/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/session/supersedence/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/session/title/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/spawn/policy/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/spawn/validate/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/staging/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/task-attachments/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/assignment/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/curator/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/telegram/reports/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/telegram/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tmux/targets/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/backend/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tts/backend/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tts/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/view/presence/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/workflows/[id]/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/workflows/route-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/app/page-1cde2db61f461960.js +0 -125
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-60a25d1c4cbf0128.js +0 -1
- package/dist/standalone/.next/static/css/b25c03e915fd256b.css +0 -1
- /package/dist/standalone/.next/static/{836HTp-5V8cZC5YWFVOCk → fQ2a5S10vvpyAqE0L_wUj}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";exports.id=6942,exports.ids=[6942],exports.modules={66942:(a,b,c)=>{c.d(b,{CP:()=>
|
|
1
|
+
"use strict";exports.id=6942,exports.ids=[6942],exports.modules={66942:(a,b,c)=>{c.d(b,{CP:()=>M,H2:()=>O,A9:()=>N,hA:()=>ao,PU:()=>B});var d=c(63657),e=c(9302),f=c(77598),g=c.n(f),h=c(73024),i=c(31421),j=c(76760),k=c.n(j),l=c(46193),m=c(1849);function n(a){if(a&&"object"==typeof a&&!Object.isFrozen(a))for(let b of(Object.freeze(a),Object.values(a)))n(b);return a}function o(a){let b=/(^|[^A-Z0-9_.-])((?:\\+)?["']?)([A-Z0-9_.-]*(?:TOKEN|SECRET|PASSWORD|PASSWD|API[_-]?KEY|AUTHORIZATION|COOKIE)[A-Z0-9_.-]*)\2\s*[:=]\s*(?!<redacted>(?:$|[\s,}\]]))(?:((?:\\+)?["'])|(?=[^"'\\\s]))/i.exec(a),c=/\b(Bearer)\s+(?:((?:\\+)?["'])|(?=\S))/i.exec(a),d=/\b(?:(?:sk|ghp|github_pat|xox[baprs])[-_A-Za-z0-9]{16,}|[A-Za-z0-9+/_=-]{48,})/i.exec(a),e=[];if(b){let a=b[4]??"",c=a.at(-1);e.push({index:b.index+b[1].length,length:b[0].length-b[1].length,replacement:`${b[3]}=<redacted>`,quote:'"'===c||"'"===c?c:null,quoteEscapeDepth:Math.max(0,a.length-1),quotedKey:b[2].endsWith('"')||b[2].endsWith("'"),authorization:/AUTHORIZATION/i.test(b[3]),bearer:!1})}if(c){let a=c[2]??"",b=a.at(-1);e.push({index:c.index,length:c[0].length,replacement:`${c[1]} <redacted>`,quote:'"'===b||"'"===b?b:null,quoteEscapeDepth:Math.max(0,a.length-1),quotedKey:!1,authorization:!1,bearer:!0})}return d&&e.push({index:d.index,length:d[0].length,replacement:"<redacted>",quote:null,quoteEscapeDepth:0,quotedKey:!1,authorization:!1,bearer:!1}),e.sort((a,b)=>a.index-b.index)[0]??null}function p(a,b,c=!1){return function(a,b,c=!1){let d=Buffer.from(a);if(d.length<=b)return a;if(c){let a=d.length-Math.max(0,b-Buffer.byteLength("..."));for(;a<d.length&&(192&d[a])==128;)a+=1;return"...".slice(0,b)+d.subarray(a).toString("utf8")}let e=b;for(;e>0&&(192&d[e])==128;)e-=1;return d.subarray(0,e).toString("utf8")}(function(a){let b="",c=a;for(;c;){let a=o(c);if(!a){b+=c;break}if(b+=c.slice(0,a.index)+a.replacement,c=c.slice(a.index+a.length),a.authorization&&!(a.quotedKey&&a.quote)){let a=c.search(/[\r\n]/);c=a<0?"":c.slice(a);continue}if(a.quote){let b=function(a,b,c,d=0){let e=0;for(let f=d;f<a.length;f+=1){let d=a[f];if("\\"===d){e+=1;continue}if(d===b&&e===c)return f+1;e=0}return -1}(c,a.quote,a.quoteEscapeDepth);c=b<0?"":c.slice(b);continue}if(a.bearer){let a=c.search(/[\r\n]/);c=a<0?"":c.slice(a);continue}if(!a.authorization){let a=c.search(/\s/);c=a<0?"":c.slice(a)}}return b.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,"").trim()}(a),b,c)}function q(a,b,c,d={}){let e=void 0===d.stderr?void 0:p(d.stderr,2048,!0);return n({reason:a,diagnostic:{cause:b,message:p(c,512),causes:function(a,b=[]){let c=[];for(let d of[a,...b])for(let a of function(a){let b=[],c=a;for(let a=0;a<4&&void 0!==c;a+=1){if(c instanceof Error){let a=p(c.message,512);a&&b.push(a),c=c.cause;continue}let a=p(String(c),512);a&&b.push(a);break}return b}(d))if(c.push(a),4===c.length)return c;return c}(d.cause,d.secondaryCauses),...e?{stderr:e}:{}}})}class r extends Error{constructor(a,b,c,d={}){super(c,void 0===d.cause?void 0:{cause:d.cause}),this.name="ResourceCollectorFailureError",this.failure=q(a,b,c,d)}}var s=c(70547),t=c(23921),u=c(36177),v=c(64487),w=c(3743),x=c(91724),y=c(65154),z=c(92806),A=c(30096);function B(a){let b=JSON.stringify(a);if(void 0===b)throw TypeError("resource diagnostic cannot be serialized");return b.replace(/[\u007f-\uffff]/g,a=>`\\u${a.charCodeAt(0).toString(16).padStart(4,"0")}`)}function C(){return{systemMemory:0,readFiles:0,readHosts:0,ppidMap:0,processMemory:0,attach:0,serialization:0}}function D(a,b,c){let d=performance.now();try{return c()}finally{a[b]+=performance.now()-d}}async function E(a,b,c){let d=performance.now();try{return await c()}finally{a[b]+=performance.now()-d}}function F(a){return"number"==typeof a&&Number.isFinite(a)&&a>=0}function G(a=d.B){let b=a.systemMemory();return b?{...b,capturedAt:new Date().toISOString()}:null}function H(a){return"structured"===a.kind}let I=globalThis;function J(){let a=I.__llvLastResourceBuild;return a?{...a,phases:{...a.phases}}:null}function K(a){let b=new Map;for(let{target:c,ref:d}of a)b.set(c,d);I.__llvResourceTargets=b,L([...b].map(([a,b])=>({target:a,ref:b})))}function L(a){I.__llvLastResourceTargets=[...a].map(({target:a,ref:b})=>({target:a,ref:b}))}function M(a){if(""===a)return null;let b=I.__llvResourceTargets?.get(a)??null;return null===b||H(b)?null:b}function N(a){I.__llvResourceTargets?.delete(a)&&(I.__llvResourceTargetEpoch=(I.__llvResourceTargetEpoch??0)+1)}function O(a){if(""===a)return null;let b=I.__llvResourceTargets?.get(a)??null;return null!==b&&H(b)?b:null}function P(a){return new Date(1e3*a).toISOString()}async function Q(){return(await Promise.resolve().then(c.bind(c,9488))).readStructuredHostRecords()}let R={readFiles:async a=>{let b=await S(a);return(0,u.iD)(b),b},readHosts:(a,b,c)=>(0,v.oe)(a,b,c),proc:d.B,captureAttachReferences:w.yq,readStructuredHosts:Q,listAgentProcesses:t.Bj,directoryExists:a=>(0,h.existsSync)(a),processIdentity:a=>d.B.processIdentity(a),hostStamp:t.Tu};async function S(a){var b,c;return b=(a?await (0,m.vx)():await (0,m.Nm)({revalidate:!1})).snapshot.files,c=()=>null,b.map(a=>({path:a.path,parent:a.parent,title:a.title,project:a.project,activity:a.activity,mtime:a.mtime,engine:a.engine,pid:a.pid,proc:a.proc,conversationId:c(a.path)??a.conversationId??null}))}async function T(a,b,c){let f=await c.readStructuredHosts?.(a)??[],g=c.processIdentity??(a=>d.B.processIdentity(a)),h=(c.bootEpoch??e.h_)(),i=c.hostStamp??t.Tu,j=(0,t.TK)(),k=[],l=new Set;for(let a of f){if(!Number.isSafeInteger(a.pid)||a.pid<=1||l.has(a.pid))continue;let b=g(a.pid);if(null!==b&&(null===a.startIdentity||a.startIdentity===b)&&(null===a.bootEpoch||null===h||a.bootEpoch===h)&&(l.add(a.pid),k.push({...a,startIdentity:b}),k.length>=A.sb))break}for(let d of c.listAgentProcesses?.(a)??[]){if(k.length>=A.sb)break;if(l.has(d.pid)||(0,t.qM)(d.argv))continue;let a=(0,t.qP)(d.argv);if(null===a||i(d.pid)!==j)continue;let c=function(a,b,c,d){let e=a,f=new Set([a]);for(;;){let a=b.get(e);if(void 0===a||a<=1||f.has(a)||c(a)!==d)return e;f.add(a),e=a}}(d.pid,b,i,j);if(l.has(c))continue;let e=g(c);null!==e&&(l.add(d.pid),l.add(c),k.push({id:`pid:${c}`,engine:a,sessionId:null,pid:c,startIdentity:e,bootEpoch:h,cwd:d.cwd,path:null,conversationId:null,title:null,role:null,model:null,stage:null,seat:null,turnBusy:null,owned:!1}))}return k.map(a=>({record:a,tree:(0,s.mO)(a.pid,b)}))}async function U(a,b=R){let c=performance.now(),d=C();try{let e=D(d,"systemMemory",()=>G(b.proc)),f=await E(d,"readFiles",()=>b.readFiles(a)),g=D(d,"ppidMap",()=>b.proc.ppidMap()),h=await E(d,"readHosts",()=>b.readHosts(a,f,g)),i=await E(d,"readHosts",()=>T(a,g,b)),j=[],k=new Map(f.map(a=>[a.path,a])),l=new Map;for(let a of h.hosts){let b=l.get(a.paneId);b?b.push(a):l.set(a.paneId,[a])}let m=[],n=new Set;for(let a of l.values()){let b=a[0],c=(0,s.mO)(b.panePid,g);for(let d of(m.push({host:b,tree:c,paneHosts:a}),c))n.add(d)}let o=[];for(let a of i)if(!n.has(a.record.pid))for(let b of(o.push(a),a.tree))n.add(b);let p=D(d,"processMemory",()=>b.proc.processMemory(n)),q=a=>{let b=0,c=0;for(let d of a){let a=p.get(d);a&&(b+=a.rssBytes,c+=a.swapBytes)}return{rssBytes:b,swapBytes:c}},r=[];for(let{record:a,tree:c}of(D(d,"attach",()=>{let a=b.captureAttachReferences(m.map(({host:a})=>({tmuxServerPid:a.tmuxServerPid,panePid:a.panePid,paneId:a.paneId})));for(let{host:b,tree:c,paneHosts:d}of m){let e=function(a,b,c){for(let d of b){if(!d.primaryPath)continue;let b=a.canonicalFor(d.primaryPath);if(b?.paneId===d.paneId&&b.agentPid===d.agentPid)return c.get(d.primaryPath)??null}return null}(h,d,k);j.push({target:b.display,panePid:b.panePid,path:e?.path??null,engine:b.engine,hostConflict:function(a,b){return a.conflicts?.some(a=>a.paneIds.includes(b.paneId))??!1}(h,b),title:e?.title??null,project:e?.project||null,activity:e?.activity??null,lastActiveAt:e?P(e.mtime):null,cwd:b.cwd,...q(c),procCount:c.length});let f=a.get(b.paneId);f&&r.push({target:b.display,ref:f})}}),o)){let d=a.path?k.get(a.path)??null:null,e=d?P(d.mtime):null,f="structured:"+a.id;j.push({target:f,panePid:a.pid,kind:"structured",path:a.path,engine:a.engine,title:a.title??d?.title??null,project:d?.project||null,activity:d?.activity??null,lastActiveAt:e,cwd:a.cwd||null,...q(c),procCount:c.length,model:a.model,role:a.role,conversationId:a.conversationId,stage:a.stage,ownership:null===a.sessionId||a.cwd.length>0&&b.directoryExists?.(a.cwd)===!1?"orphaned":a.owned?"owned":"released",seat:a.seat,turnBusy:a.turnBusy}),r.push({target:f,ref:{kind:"structured",pid:a.pid,startIdentity:a.startIdentity,bootEpoch:a.bootEpoch,engine:a.engine,sessionId:a.sessionId,conversationId:a.conversationId,seat:a.seat,turnBusy:a.turnBusy,owned:a.owned,lastActiveAt:e}})}return j.sort((a,b)=>b.rssBytes+b.swapBytes-(a.rssBytes+a.swapBytes)),L(r),I.__llvLastResourceBuild={fresh:a,status:"complete",durationMs:performance.now()-c,phases:d},{system:e,sessions:j}}catch(b){throw I.__llvLastResourceBuild={fresh:a,status:"failed",durationMs:performance.now()-c,phases:d},b}}let V="resources-observation.json",W=`
|
|
2
2
|
const { spawn } = require("node:child_process");
|
|
3
3
|
const child = spawn(process.argv[1], process.argv.slice(2), { stdio: "inherit" });
|
|
4
4
|
let finished = false;
|
|
@@ -17,11 +17,11 @@ child.once("error", () => finish(127, null));
|
|
|
17
17
|
child.once("exit", finish);
|
|
18
18
|
process.on("SIGTERM", () => { terminationRequested = true; });
|
|
19
19
|
process.on("SIGINT", () => { terminationRequested = true; });
|
|
20
|
-
`,
|
|
20
|
+
`,X=`
|
|
21
21
|
token="$1"
|
|
22
22
|
shift
|
|
23
23
|
read host_pid _ < /proc/self/stat
|
|
24
24
|
printf '%s %s %s
|
|
25
25
|
' "$token" "$host_pid" "$(readlink /proc/self/ns/pid)"
|
|
26
26
|
exec "$@"
|
|
27
|
-
`;function X(a){try{let b=(0,h.statSync)(a);return b.isFile()&&(73&b.mode)!=0}catch{return!1}}function Y(a){try{let b=(0,h.readFileSync)(`/proc/${a}/stat`,"utf8"),c=b.lastIndexOf(")");if(c<0)return null;let d=Number(b.slice(c+2).trim().split(/\s+/)[2]);return Number.isInteger(d)&&d>0?d:null}catch{return null}}let Z="LLV_RESOURCE_COLLECTOR_OWNER",$={pidAlive:a=>d.B.pidAlive(a),processIdentity:a=>d.B.processIdentity(a),processExited:a=>"linux"===d.B.name&&function(a){try{let b=(0,h.readFileSync)(`/proc/${a}/stat`,"utf8"),c=b.slice(b.lastIndexOf(")")+2).trim().split(/\s+/,1)[0];return"Z"===c||"X"===c||"x"===c}catch{return!1}}(a),descendants:function(a){return"linux"===d.B.name?function(a){let b=[],c=new Set([a]),d=[a];for(;d.length>0;){let a,e=d.pop();b.push(e);try{a=(0,h.readFileSync)(`/proc/${e}/task/${e}/children`,"utf8")}catch{continue}for(let b of a.trim().split(/\s+/)){let a=Number(b);!Number.isInteger(a)||a<=0||c.has(a)||(c.add(a),d.push(a))}}return b}(a):(0,s.mO)(a,d.B.ppidMap())},processGroupId:a=>{let b,c;return"linux"===d.B.name?Y(a):Number.isInteger(c=Number(0===(b=(0,i.spawnSync)("ps",["-p",String(a),"-o","pgid="],{encoding:"utf8",timeout:1e3,windowsHide:!0})).status?b.stdout.trim():""))&&c>0?c:null},processGroupMembers:a=>"linux"===d.B.name?function(a){let b,c=[];try{b=(0,h.readdirSync)("/proc")}catch{return c}for(let d of b){let b=Number(d);Number.isInteger(b)&&!(b<=0)&&Y(b)===a&&c.push(b)}return c}(a):function(a){let b=(0,i.spawnSync)("ps",["-axo","pid=,pgid="],{encoding:"utf8",timeout:1e3,windowsHide:!0});if(0!==b.status)return[];let c=[];for(let d of b.stdout.split("\n")){let b=/^\s*(\d+)\s+(\d+)\s*$/.exec(d);b&&Number(b[2])===a&&c.push(Number(b[1]))}return c}(a),namespaceMembers:a=>"linux"===d.B.name?function(a){let b;try{b=(0,h.readdirSync)("/proc")}catch{return null}let c=`${Z}=${a}`,e=[];for(let a of b){let b,f=Number(a);if(!Number.isInteger(f)||f<=0)continue;try{b=(0,h.readFileSync)(`/proc/${f}/environ`,"utf8")}catch{continue}if(!b.split("\0").includes(c))continue;let g=d.B.processIdentity(f);if(null!==g){try{b=(0,h.readFileSync)(`/proc/${f}/environ`,"utf8")}catch{continue}b.split("\0").includes(c)&&d.B.processIdentity(f)===g&&e.push(f)}}return e}(a):function(a){let b=`${Z}=${a}`,c=(0,i.spawnSync)("ps",["eww","-axo","pid=,command="],{encoding:"utf8",timeout:1e3,windowsHide:!0,maxBuffer:0x1000000});if(0!==c.status)return null;let d=[];for(let a of c.stdout.split("\n")){let c=/^\s*(\d+)\s+/.exec(a);c&&a.includes(b)&&d.push(Number(c[1]))}return d}(a),processNamespaceId:a=>"linux"===d.B.name?function(a){try{let b=(0,h.readlinkSync)(`/proc/${a}/ns/pid`);return/^pid:\[\d+\]$/.test(b)?b:null}catch{return null}}(a):null,processNamespacePid:a=>"linux"===d.B.name?function(a){try{let b=(0,h.readFileSync)(`/proc/${a}/status`,"utf8").split("\n").find(a=>a.startsWith("NSpid:")),c=Number(b?.trim().split(/\s+/).at(-1));return Number.isInteger(c)&&c>0?c:null}catch{return null}}(a):null,openNamespaceReference:(a,b)=>"linux"===d.B.name?function(a,b){let c;try{c=(0,h.openSync)(`/proc/${a}/ns/pid`,"r")}catch{return null}try{if((0,h.readlinkSync)(`/proc/self/fd/${c}`)!==b)return(0,h.closeSync)(c),null;let a=(0,h.fstatSync)(c,{bigint:!0}),d=!1;return{members:()=>{let b;try{b=(0,h.readdirSync)("/proc")}catch{return null}let c=[];for(let d of b){let b=Number(d);if(Number.isInteger(b)&&!(b<=0))try{let d=(0,h.statSync)(`/proc/${b}/ns/pid`,{bigint:!0});d.dev===a.dev&&d.ino===a.ino&&c.push(b)}catch{}}return c},close:()=>{d||(d=!0,(0,h.closeSync)(c))}}}catch{return(0,h.closeSync)(c),null}}(a,b):null,signal:(a,b)=>process.kill(a,b)};function _(a,b,c=[],d=H.__llvResourceTargetEpoch??0){return{payload:a,diagnostic:b,hostCount:a.sessions.length,treeCount:a.sessions.reduce((a,b)=>a+b.procCount,0),targets:c,targetEpoch:d}}function aa(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function ab(a,b,c=[]){let d=new Set([...b,...c]);return b.every(b=>Object.hasOwn(a,b))&&Object.keys(a).every(a=>d.has(a))}function ac(a){return null===a||"string"==typeof a}function ad(a){return null===a||"boolean"==typeof a}function ae(a){return!!aa(a)&&!!ab(a,["target","panePid","path","engine","title","project","activity","lastActiveAt","cwd","rssBytes","swapBytes","procCount"],["hostConflict","kind","model","role","conversationId","stage","ownership","seat","turnBusy"])&&(void 0===a.kind||"tmux"===a.kind||"structured"===a.kind)&&(void 0===a.ownership||"owned"===a.ownership||"released"===a.ownership||"orphaned"===a.ownership)&&(void 0===a.model||!!ac(a.model))&&(void 0===a.role||!!ac(a.role))&&(void 0===a.conversationId||!!ac(a.conversationId))&&(void 0===a.stage||!!ac(a.stage))&&(void 0===a.seat||!!ad(a.seat))&&(void 0===a.turnBusy||!!ad(a.turnBusy))&&"string"==typeof a.target&&a.target.length>0&&Number.isSafeInteger(a.panePid)&&a.panePid>0&&ac(a.path)&&("claude"===a.engine||"codex"===a.engine||null===a.engine)&&ac(a.title)&&ac(a.project)&&("live"===a.activity||"recent"===a.activity||"stalled"===a.activity||"idle"===a.activity||null===a.activity)&&ac(a.lastActiveAt)&&(null===a.lastActiveAt||Number.isFinite(Date.parse(a.lastActiveAt)))&&ac(a.cwd)&&E(a.rssBytes)&&E(a.swapBytes)&&Number.isSafeInteger(a.procCount)&&a.procCount>=0&&(void 0===a.hostConflict||"boolean"==typeof a.hostConflict)}function af(a){var b;return!!aa(a)&&!!ab(a,["system","sessions"])&&!!(null===(b=a.system)||aa(b)&&ab(b,["ramTotal","ramAvailable","swapTotal","swapUsed","capturedAt"])&&E(b.ramTotal)&&E(b.ramAvailable)&&E(b.swapTotal)&&E(b.swapUsed)&&"string"==typeof b.capturedAt&&Number.isFinite(Date.parse(b.capturedAt)))&&!!Array.isArray(a.sessions)&&a.sessions.length<=1e4&&a.sessions.every(ae)}function ag(a){if(!aa(a)||!ab(a,["fresh","status","durationMs","phases"])||!aa(a.phases))return!1;let b=a.phases,c=["systemMemory","readFiles","readHosts","ppidMap","processMemory","attach","serialization"];return"boolean"==typeof a.fresh&&("complete"===a.status||"failed"===a.status)&&E(a.durationMs)&&ab(b,c)&&c.every(a=>E(b[a]))}function ah(a){var b,c;return aa(a)&&ab(a,["target","ref"])&&"string"==typeof a.target&&a.target.length>0&&!!aa(b=a.ref)&&(void 0!==b.kind?!!aa(c=b)&&!!ab(c,["kind","pid","startIdentity","bootEpoch","engine","sessionId","conversationId","seat","turnBusy","owned","lastActiveAt"])&&"structured"===c.kind&&Number.isSafeInteger(c.pid)&&c.pid>1&&"string"==typeof c.startIdentity&&c.startIdentity.length>0&&ac(c.bootEpoch)&&("claude"===c.engine||"codex"===c.engine)&&ac(c.sessionId)&&ac(c.conversationId)&&ad(c.seat)&&ad(c.turnBusy)&&"boolean"==typeof c.owned&&ac(c.lastActiveAt)&&(null===c.lastActiveAt||Number.isFinite(Date.parse(c.lastActiveAt))):!!ab(b,["tmuxServerPid","tmuxServerStartIdentity","paneId","panePid","paneStartIdentity"])&&Number.isSafeInteger(b.tmuxServerPid)&&b.tmuxServerPid>0&&ac(b.tmuxServerStartIdentity)&&"string"==typeof b.paneId&&/^%\d+$/.test(b.paneId)&&Number.isSafeInteger(b.panePid)&&b.panePid>0&&ac(b.paneStartIdentity))}function ai(a,b){let c=new Map;for(let b of a.sessions){if(c.has(b.target))return!1;c.set(b.target,b)}let d=new Set;return b.every(({target:a,ref:b})=>{if(d.has(a))return!1;d.add(a);let e=c.get(a);return!!e&&(G(b)?"structured"===e.kind&&e.panePid===b.pid:"structured"!==e.kind&&e.panePid===b.panePid)})}function aj(a){let b,c=(0,x.BQ)(U);try{(0,h.mkdirSync)(k().dirname(c),{recursive:!0,mode:448}),b=k().join(k().dirname(c),`.${k().basename(c)}.${process.pid}.${g().randomUUID()}.tmp`);let d=JSON.stringify({version:1,observation:a})+"\n";if(Buffer.byteLength(d)>0x1000000)throw Error("resource observation exceeded durable size limit");return(0,h.writeFileSync)(b,d,{mode:384}),(0,h.renameSync)(b,c),(0,h.chmodSync)(c,384),!0}catch(a){if(b)try{(0,h.unlinkSync)(b)}catch{}return console.error(`[resources] observation persistence failed: ${a instanceof Error?a.message:String(a)}`),!1}}function ak(a){let b=JSON.stringify({version:1,observation:a})+"\n";if(Buffer.byteLength(b)>0x1000000)throw new r("collector-crash","observation-limit","resource observation exceeded durable size limit")}async function al(a,b=R,c={},d=H.__llvResourceTargetEpoch??0,f=$,j=P){let m,n,q=function(a={}){let b=a.cwd??process.cwd(),c=a.env??process.env,d=a.exists??h.existsSync,e=a.execPath??process.execPath,f=a.versions??process.versions,g=k().join(b,"src/lib/resourceCollector.worker.ts"),i=k().join(b,".next/server/resource-collector-worker.js"),j=d(g),l=d(i),m=j||!l?g:i;if(c.LLV_RESOURCE_COLLECTOR_EXECUTABLE)return{executable:c.LLV_RESOURCE_COLLECTOR_EXECUTABLE,workerPath:l?i:m};let n="/usr/local/bin/bun-container";return j&&d(n)?{executable:n,workerPath:g}:l?{executable:f.bun?e:c.LLV_BUN_EXECUTABLE||"bun",workerPath:i}:{executable:"bun",workerPath:g}}(),s=c.observeTimeoutMs??3e4,t=c.inputTimeoutMs??5e3,u=c.closeTimeoutMs??1e3,v=Math.max(0,Math.min(100,Math.floor(.75*u))),w=c.headroomMs??500,x=Math.min(25,Math.max(5,u)),z=Math.max(u+x+5,c.cleanupTimeoutMs??u+Math.floor(w/2)),A=Math.max(z,u+x+50),B=Math.max(Math.min(250,Math.ceil(.2*s)),50+x+Math.max(0,w-Math.max(0,A-u))),C=Math.max(0,s-t-A-B),D=Math.min(c.timeoutMs??23500,C),E=b(a),F=Promise.race([j(),new Promise(a=>{m=setTimeout(()=>a([]),t)})]).catch(a=>(console.error(`[resources] structured host inventory failed: ${a instanceof Error?a.message:String(a)}`),[])).finally(()=>{m&&clearTimeout(m)}),G=await Promise.race([E,new Promise((a,b)=>{n=setTimeout(()=>b(new r("timeout","file-handoff-timeout","resource collector file handoff timed out")),t)})]).finally(()=>{n&&clearTimeout(n)}),I=await F,J=JSON.stringify({type:"collect",fresh:a,files:G,identityEpoch:(0,e.h_)(),hosts:I})+"\n",K=c.outputMaxBytes??0x1010000;if(Buffer.byteLength(J)>0x1010000)throw new r("collector-crash","worker-input","resource collector input exceeded transport limit");let L=f===$&&X(q.executable),M=g().randomUUID(),N=L?process.execPath:q.executable,O=L?["-e",V,q.executable,q.workerPath]:[q.workerPath],Q=["/usr/bin/unshare","/bin/unshare"].find(h.existsSync),S=q.executable.includes(k().sep)&&!X(q.executable),T=f===$&&"linux"===process.platform&&void 0!==Q&&!S,U=g().randomUUID(),Y=(0,i.spawn)(T?Q:N,T?["--user","--map-root-user","--pid","--fork","/bin/sh","-c",W,"llv-resource-worker",U,N,...O]:O,{cwd:process.cwd(),detached:!0,stdio:["pipe","pipe","pipe"],env:{...(0,y.Fd)(process.env),[Z]:M}});return new Promise((b,c)=>{let e,g,h,i,j,k=Y.pid,m="number"==typeof k?f.processIdentity(k):null,n="number"==typeof k&&null!==m&&f.processGroupId(k)===k&&f.processIdentity(k)===m,q=null,s=null,t=0,w=function(a=2048){let b="",c="",d=null,e=0,f=0,g=null,h=c=>{let d=(b+=c).length-2*a;if(d<=0)return;let e=b.charCodeAt(d);e>=56320&&e<=57343&&(d+=1),b=b.slice(d)};return{append(a){c+=a,(()=>{let a=(a=!1)=>{let b=/^((?:\\+)?["'])/.exec(c)?.[1]??"",h=b.at(-1);'"'===h||"'"===h?(c=c.slice(b.length),d=h,e=b.length-1,f=0):d=a?"line":"unquoted",g=null};for(;c;){if("authorization"===g){d="line",g=null;continue}if("bearer"===g){let b=c.search(/\S/);if(b<0){c="";return}c=c.slice(b),a(!0);continue}if("value"===g){let b=c.search(/\S/);if(b<0){c="";return}c=c.slice(b),a(),g=null;continue}if("key"===g||"authorization-key"===g){let a="authorization-key"===g,b=/^[A-Z0-9_.-]*\s*[:=]\s*(?:((?:\\+)?["'])|(?=[^"'\\\s]))/i.exec(c);if(b){h("<redacted>"),c=c.slice(b[0].length);let i=b[1]??"",j=i.at(-1);d='"'===j||"'"===j?j:a?"line":"unquoted",e=i.length>0?i.length-1:0,f=0,g=null;continue}if(/^[A-Z0-9_.-]*\s*[:=]\s*$/i.exec(c)){h("<redacted>"),c="",g=a?"authorization":"value";return}if(/^[A-Z0-9_.-]*\s*$/i.test(c)){c=c.slice(-256);return}g=null}if(d){let a;if("line"===d)a=c.search(/[\r\n]/);else if("unquoted"===d)a=c.search(/\s/);else{a=-1;let b=f;for(let f=0;f<c.length;f+=1){let g=c[f];if("\\"===g){b+=1;continue}if(g===d&&b===e){a=f;break}b=0}f=b}if(a<0){c="";return}c=c.slice(a+ +("unquoted"!==d&&"line"!==d)),d=null,e=0,f=0;continue}let b=o(c);if(b){if(h(c.slice(0,b.index)+b.replacement),c=c.slice(b.index+b.length),b.authorization){d=b.quotedKey&&b.quote?b.quote:"line",e=b.quoteEscapeDepth;continue}if(b.bearer){d=b.quote??"line",e=b.quoteEscapeDepth;continue}d=b.quote??"unquoted",e=b.quoteEscapeDepth;continue}if(c.length<=256)return;let i=/(?:^|[^A-Z0-9_])(Bearer)(\s+)$/i.exec(c);if(i){let a=i.index+i[0].length-i[1].length-i[2].length;if(a<c.length-256){h(c.slice(0,a)+`${i[1]} <redacted>`),c="",g="bearer";return}}let j=/(^|[^A-Z0-9_.-])((?:\\+)?["']?)([A-Z0-9_.-]*(?:TOKEN|SECRET|PASSWORD|PASSWD|API[_-]?KEY|AUTHORIZATION|COOKIE)[A-Z0-9_.-]*)\2(\s*)(?:([:=])(\s*))?$/i.exec(c);if(j){let a=j.index+j[1].length;if(a<c.length-256){h(c.slice(0,a)),j[5]?(h("<redacted>"),c="",g=/AUTHORIZATION/i.test(j[3])?"authorization":"value"):(c=(j[3]+j[4]).slice(-256),g=/AUTHORIZATION/i.test(j[3])?"authorization-key":"key");return}}h(c.slice(0,-256)),c=c.slice(-256);return}})()},value:()=>p(b+(d?"":c),a,!0)}}(),y=new l.StringDecoder("utf8"),B=new Map;"number"==typeof k&&null!==m&&B.set(k,m);let C=[],E=null,F=!1,G=!1,H=null,I=!1,L=void 0===f.namespaceMembers,N=null,O=null,P=null,Q=null,R=!1,S=f!==$&&"unavailable"!==f.kernelContainment,V=S,W=S,X=S,Z=!1,ac=!1,ad=!1,ae=!1,aj=!1,ak=!1,al=!1,am=(a,b,c,d)=>new r(a,b,c,{cause:d,stderr:w.value(),secondaryCauses:H?[H]:[]}),an=a=>{j??=a},ao=a=>{I=!0,an(Error(a))},ap=(a,b)=>{let c=f.processIdentity(a);if(null===c)return!f.pidAlive(a);if(c!==b||!f.processExited?.(a))return!1;let d=f.processIdentity(a);return d===c||null===d&&!f.pidAlive(a)},aq=()=>{ak||(ak=!0,w.append(y.end()))},ar=()=>{for(let a of C)clearTimeout(a);C.length=0},as=()=>{let a;if(!X||null===N||null===Q)return!1;try{if(!R&&null!==O&&null!==P){let a=f.processIdentity(O);if(a===P)if(ap(O,P))R=!0;else{let b=f.processNamespaceId?.(O),c=f.processNamespacePid?.(O);f.processIdentity(O)!==a?R=!0:(b!==N||1!==c)&&ao("resource collector PID namespace root identity changed")}else null!==a?(R=!0,ao("resource collector PID namespace root identity was recycled")):f.pidAlive(O)||(R=!0)}a=Q.members()}catch(a){return V=!1,W=!1,an(a),!1}if(V=null!==a,W=a?.length===0,null===a)return an(Error("resource collector PID namespace could not be inspected")),!1;let b=!1;for(let c of a){let a=f.processIdentity(c);if(null===a||f.processNamespaceId?.(c)!==N||f.processIdentity(c)!==a)continue;let d=B.get(c);if(void 0!==d&&d!==a){ao("resource collector PID namespace member identity was recycled");continue}void 0===d&&(B.set(c,a),b=!0)}return b},at=(a=!0)=>{let b=!1,c=[...B.keys()],d=new Set;for(;c.length>0;){let a,e=c.pop();if(d.has(e))continue;d.add(e);let g=B.get(e);if(void 0!==g&&f.processIdentity(e)===g){try{a=f.descendants(e)}catch(a){an(a);continue}if(f.processIdentity(e)===g)for(let d of a){if(d===e)continue;let a=f.processIdentity(d);if(null===a||f.processIdentity(e)!==g||f.processIdentity(d)!==a)continue;let h=B.get(d);if(void 0!==h&&h!==a){ao("resource collector descendant identity was recycled");continue}void 0===h&&(B.set(d,a),b=!0),c.push(d)}}}(()=>{let a;if(null!==N||!n||Z||ac||ad||"number"!=typeof k||null===m)return;if(f.processIdentity(k)!==m){Z=!0,ao("resource collector worker group leader identity changed");return}try{a=f.processGroupMembers(k)}catch(a){Z=!0,ao("resource collector worker group membership could not be inspected"),an(a);return}if(!a.includes(k)){Z=!0,ao("resource collector worker group continuity was lost");return}let b=[];for(let c of a){let a=f.processIdentity(c);null!==a&&f.processGroupId(c)===k&&f.processIdentity(c)===a&&b.push([c,a])}if(f.processIdentity(k)!==m){Z=!0,ao("resource collector worker group leader identity changed");return}for(let[a,c]of b){let b=B.get(a);if(void 0!==b&&b!==c){Z=!0,ao("resource collector worker group member identity changed");return}B.set(a,c)}})();let e=as();return!!a&&null===N&&(()=>{let a;if(!f.namespaceMembers)return!1;try{a=f.namespaceMembers(M)}catch(a){return L=!1,an(a),!1}if(L=null!==a,null===a)return an(Error("resource collector worker namespace could not be inspected")),!1;let b=!1;for(let c of a){let a=f.processIdentity(c);if(null===a||f.processIdentity(c)!==a)continue;let d=B.get(c);if(void 0!==d&&d!==a){ao("resource collector namespace member identity was recycled");continue}void 0===d&&(B.set(c,a),b=!0)}return b})()||e||b},au=()=>{let a=[],b=!1;for(let[c,d]of B){let e=f.processIdentity(c);if(e===d){if(ap(c,d))continue;let e=f.processIdentity(c);e===d?a.push(c):null===e&&f.pidAlive(c)?b=!0:null!==e&&null!==N&&ao("resource collector contained process identity was recycled");continue}null===e&&f.pidAlive(c)?b=!0:null!==e&&null!==N&&ao("resource collector contained process identity was recycled")}return{active:a,uncertain:b}},av=()=>{if("number"!=typeof k)return"absent";try{return f.signal(-k,0),"present"}catch(b){let a=b.code;if("ESRCH"===a)return ac||(Z=!0),"absent";if("EPERM"===a)return"denied";return an(b),"unknown"}},aw=(a,b=!0,c="all")=>{if(at(b),null!==N&&null!==O&&null!==P){let b=au().active.filter(a=>a!==O&&f.processNamespaceId?.(a)===N),d=new Set(b),e="SIGTERM"===a?b:[];for(let g of("SIGTERM"===a&&"members"===c&&(e=b.filter(a=>{let b,c=B.get(a);if(void 0===c||f.processIdentity(a)!==c)return!1;try{b=f.descendants(a)}catch(a){return an(a),!1}return f.processIdentity(a)===c&&!b.some(b=>b!==a&&d.has(b))})),e)){let b=B.get(g);if(void 0===b)continue;let c=f.processIdentity(g);if(null!==c){if(c!==b||f.processNamespaceId?.(g)!==N||f.processIdentity(g)!==c){ao("resource collector PID namespace member identity changed before cleanup");continue}try{f.signal(g,a)}catch(a){"ESRCH"!==a.code&&an(a)}}}if("members"===c)return;let g=()=>{if("number"!=typeof k||null===m||k===O)return;let b=f.processIdentity(k);if(null!==b){if(b!==m||f.processIdentity(k)!==b)return void ao("resource collector worker wrapper identity changed before cleanup");if(!ap(k,m))try{f.signal(k,a)}catch(a){"ESRCH"!==a.code&&an(a)}}};if(R)return void g();let h=f.processIdentity(O);if(null===h){f.pidAlive(O)||(R=!0),g();return}if(ap(O,P)){R=!0,g();return}if(h!==P){R=!0,ao("resource collector PID namespace root identity changed before cleanup"),g();return}if(f.processNamespaceId?.(O)!==N||f.processNamespacePid?.(O)!==1||f.processIdentity(O)!==h){ao("resource collector PID namespace root identity changed before cleanup"),g();return}try{f.signal(O,a)}catch(a){"ESRCH"!==a.code&&an(a)}return void g()}let d=au();if("present"===av())if((()=>{if(!n||Z||"number"!=typeof k||null===m)return!1;for(let[a,b]of B)if(f.processIdentity(a)===b&&f.processGroupId(a)===k&&f.processIdentity(a)===b)return!0;return!1})())try{f.signal(-k,a),ac=!0}catch(a){"ESRCH"!==a.code&&an(a)}else ac?an(Error("resource collector worker group ownership could not be verified")):ao("resource collector worker group ownership could not be verified");for(let b of d.active){let c=B.get(b);if(void 0===c||f.processIdentity(b)!==c){ac||ao("resource collector worker identity changed before individual cleanup");continue}try{f.signal(b,a)}catch(a){"ESRCH"!==a.code&&an(a)}}},ax=()=>{let a=au(),b="number"==typeof k&&null!==m&&ap(k,m),c=av();null!==N&&W&&b&&"present"===c&&(c="absent");let d=L&&"absent"===c&&0===a.active.length&&!a.uncertain,e=d&&V&&W;return d&&!X&&null===H?(I=!0,H=Error("resource collector kernel containment could not be established"),!0):(e&&I&&null===H&&(H=Error("resource collector worker cleanup ownership verification failed",void 0===j?void 0:{cause:j})),e)},ay=()=>{if(!aj){aj=!0;try{Q?.close()}catch(a){an(a),H??=Error("resource collector PID namespace reference could not be closed",{cause:a})}for(let a of(Q=null,aq(),Y.removeAllListeners(),[Y.stdin,Y.stdout,Y.stderr]))a.removeAllListeners(),a.destroy(),a.unref?.();Y.unref()}},az=a=>{if(!T||!a.startsWith(`${U} `))return!1;let[b,c,d,...e]=a.split(" "),g=Number(c);if(a.length>512||b!==U||!Number.isInteger(g)||g<=0||!/^pid:\[\d+\]$/.test(d)||e.length>0||!f.openNamespaceReference||!f.processNamespaceId||!f.processNamespacePid)return ao("resource collector PID namespace handshake was invalid"),!0;let h=f.processIdentity(g),i=null!==h&&f.processNamespaceId(g)===d&&1===f.processNamespacePid(g)&&f.processIdentity(g)===h?f.openNamespaceReference(g,d):null;return null===i||f.processIdentity(g)!==h||f.processNamespaceId(g)!==d||1!==f.processNamespacePid(g)||f.processIdentity(g)!==h?(i?.close(),ao("resource collector PID namespace root could not be verified")):(N=d,O=g,P=h,Q=i,X=!0,V=!1,W=!1,L=!0,as()),!0};T||X||ao("resource collector kernel containment is unavailable");let aA=()=>{if(al||!q||!ae&&!aj||!G)return;al=!0;let a=q;(clearTimeout(aE),e&&clearTimeout(e),g&&clearTimeout(g),h&&clearTimeout(h),i&&clearTimeout(i),ar(),ay(),H)?"success"===a.type?c(am("collector-crash","worker-cleanup","resource collector worker cleanup failed")):c(am(a.reason,a.cause,a.message,a.error)):"success"===a.type?b(a.value):c(am(a.reason,a.cause,a.message,a.error))},aB=()=>{if(!F||G)return;at()&&(E=null);let a=ax();if(a?null===E&&(E=Date.now()):E=null,a&&Date.now()-E>=x){G=!0,g&&clearTimeout(g),i&&clearTimeout(i),aA();return}(i=setTimeout(aB,5)).unref()},aC=()=>{F||(F=!0,ar(),(h=setTimeout(()=>{if(at(),ax()&&void 0===j){G=!0,ay(),aA();return}!q&&s&&(q=s),H=Error("resource collector worker cleanup deadline expired",void 0===j?void 0:{cause:j}),G=!0,ay(),aA()},q?.type==="success"?A:z)).unref(),null===N?aw("SIGTERM",!1):(aw("SIGTERM",!1,"members"),(e=setTimeout(()=>{G||(aw("SIGTERM",!1,"root"),aB())},v)).unref()),(g=setTimeout(()=>{aw("SIGKILL"),aB()},u)).unref(),aB())},aD=a=>{if(q){"success"===q.type&&"failure"===a.type&&"worker-output-limit"===a.cause&&(q=a);return}q=a,clearTimeout(aE),aC()};for(let a of(at(),[0,5,20,40])){let b=setTimeout(()=>{F||ad||at()},a);b.unref(),C.push(b)}let aE=setTimeout(()=>aD({type:"failure",reason:"timeout",cause:"worker-timeout",message:"resource collector worker timed out"}),D);Y.once("error",a=>{"number"!=typeof k&&(X=!0,V=!0,W=!0,L=!0),aD({type:"failure",reason:"collector-crash",cause:"worker-spawn",message:"resource collector worker failed to start",error:a})}),Y.once("exit",(a,b)=>{ad=!0,ar(),clearTimeout(aE),s={type:"failure",reason:"collector-crash",cause:"worker-exit",message:`resource collector worker exited before observation (${b??a??"unknown"})`},aC()}),Y.once("close",(a,b)=>{clearTimeout(aE),aq(),ae=!0,q||(q=s??{type:"failure",reason:"collector-crash",cause:"worker-exit",message:`resource collector worker closed before observation (${b??a??"unknown"})`},aC()),aB(),aA()});let aF="";Y.stdout.setEncoding("utf8"),Y.stdout.on("data",b=>{if((t+=Buffer.byteLength(b))>K+(T&&!X?512:0))return void aD({type:"failure",reason:"collector-crash",cause:"worker-output-limit",message:"resource collector worker exceeded stdout limit"});if(!q)for(aF+=b;!q;){var c;let b,e=aF.indexOf("\n");if(e<0)return;let f=aF.slice(0,e);if(aF=aF.slice(e+1),az(f)){(t-=Buffer.byteLength(f)+1)>K&&aD({type:"failure",reason:"collector-crash",cause:"worker-output-limit",message:"resource collector worker exceeded stdout limit"});continue}if(t>K)return void aD({type:"failure",reason:"collector-crash",cause:"worker-output-limit",message:"resource collector worker exceeded stdout limit"});try{b=JSON.parse(f)}catch{aD({type:"failure",reason:"collector-crash",cause:"worker-output-invalid",message:"resource collector worker emitted invalid JSON"});return}let g=aa(c=b)?"failure"===c.type?ab(c,["type","error"])&&"string"==typeof c.error&&c.error.length<=4096?c:null:"observation"===c.type&&ab(c,["type","payload","diagnostic","targets"])&&af(c.payload)&&ag(c.diagnostic)&&Array.isArray(c.targets)&&!(c.targets.length>1e4)&&c.targets.every(ah)&&"complete"===c.diagnostic.status&&ai(c.payload,c.targets)?c:null:null;if(!g)return void aD({type:"failure",reason:"collector-crash",cause:"worker-output-invalid",message:"resource collector worker emitted an invalid message"});if("observation"===g.type&&g.diagnostic.fresh!==a)return void aD({type:"failure",reason:"collector-crash",cause:"worker-output-invalid",message:"resource collector worker returned mismatched freshness"});if("failure"===g.type)return void aD({type:"failure",reason:"collector-crash",cause:"worker-failure",message:"resource collector worker reported a failure",error:Error(g.error)});aD({type:"success",value:_(g.payload,g.diagnostic,g.targets,d)}),aF=""}}),Y.stderr.on("data",a=>{t+=a.length,w.append(y.write(a)),t>K+(T&&!X?512:0)&&aD({type:"failure",reason:"collector-crash",cause:"worker-output-limit",message:"resource collector worker exceeded output limit"})}),Y.stdin.once("error",a=>aD({type:"failure",reason:"collector-crash",cause:"worker-input",message:"resource collector worker input failed",error:a})),Y.stdin.end(J)})}function am(a,b,c,d=!1){var e,f;let{observation:g,failure:h}=a,i=(e=a.collectorId,f=d||void 0!==h,g&&f?{status:g.collectorId===e?"memory":"durable",collectorId:g.collectorId,generation:g.generation}:{status:"miss"});if(!g){if(!h)throw Error("resource collector returned no observation or failure");return{payload:{system:b(),sessions:[]},diagnostic:{fresh:c,status:"failed",durationMs:Math.max(0,a.completedAt-a.startedAt),phases:B(),generation:a.generation,startedAt:new Date(a.startedAt).toISOString(),completedAt:new Date(a.completedAt).toISOString(),collectorId:a.collectorId,cache:i,degradedReason:h.reason,failure:h.diagnostic}}}let{payload:j,diagnostic:k}=g.value;return(h||g.collectorId!==a.collectorId||void 0===g.value.targetEpoch||function(a,b,c=H.__llvResourceTargetEpoch??0){c!==(H.__llvResourceTargetEpoch??0)||a<=(H.__llvResourceTargetsGeneration??0)||(J(b),H.__llvResourceTargetsGeneration=a)}(g.generation,g.value.targets,g.value.targetEpoch),h)?{payload:c?j:{...j,system:b()},diagnostic:{fresh:c,status:"failed",durationMs:Math.max(0,a.completedAt-a.startedAt),phases:B(),generation:a.generation,startedAt:new Date(a.startedAt).toISOString(),completedAt:new Date(a.completedAt).toISOString(),collectorId:a.collectorId,cache:i,degradedReason:h.reason,failure:h.diagnostic}}:{payload:c?j:{...j,system:b()},diagnostic:{...k,fresh:c,generation:g.generation,startedAt:new Date(g.startedAt).toISOString(),completedAt:new Date(g.completedAt).toISOString(),collectorId:a.collectorId,cache:i}}}async function an(a=!1){let b,c=process.env.LLV_RESOURCES_FIXTURE;if(c){var d;let b;return J([]),d=function(a){let b;try{b=JSON.parse(a)}catch{throw Error("invalid resources fixture: expected JSON")}let c=b,d=c?.system,e=null===d||"object"==typeof d&&E(d.ramTotal)&&E(d.ramAvailable)&&E(d.swapTotal)&&E(d.swapUsed)&&"string"==typeof d.capturedAt&&Number.isFinite(Date.parse(d.capturedAt));if(!c||!e||!Array.isArray(c.sessions)||0!==c.sessions.length)throw Error("invalid resources fixture: expected system metrics and an empty sessions list");return{system:d??null,sessions:[]}}((0,h.readFileSync)(c,"utf8")),b=Date.now(),{payload:d,diagnostic:{fresh:a,status:"complete",durationMs:0,phases:B(),generation:0,startedAt:new Date(b).toISOString(),completedAt:new Date(b).toISOString(),collectorId:"fixture",cache:{status:"miss"}}}}return(b=H.__llvResourcesReader,(3!==H.__llvResourcesReaderVersion||!b)&&(H.__llvResourcesReaderVersion=3,b=function(a,b,c=Date.now,d=I,e={}){var f;let h,i,j,k,l,m=e.inProcess??"1"===process.env.LLV_RESOURCE_COLLECTOR_IN_PROCESS,o=e.collectorId??(m?`in-process:${process.pid}:${g().randomUUID()}`:`worker:${process.pid}:${g().randomUUID()}`),p=(h=(f={collectorId:o,now:c,initial:e.initial,validateObservation:ak,collect:m?async(b=!1)=>{let c=H.__llvResourceTargetEpoch??0,e=await a(b),f=d();if(!f)throw Error("resource build completed without diagnostics");return _(e,f,H.__llvLastResourceTargets?.map(({target:a,ref:b})=>({target:a,ref:{...b}}))??[],c)}:(a=!1)=>al(a,e.readFiles,e.workerLimits,H.__llvResourceTargetEpoch??0,e.workerProcessRuntime)}).now??Date.now,i=f.initial?.generation??0,j=f.initial??null,k=null,l=a=>{let b=++i,c=h(),d=Promise.resolve().then(()=>f.collect(a)).then(a=>{let d={generation:b,startedAt:c,completedAt:h(),collectorId:f.collectorId,value:n(a)};return f.validateObservation?.(d),n(d)}),e={generation:b,promise:d};return k=e,d.then(a=>{k===e&&(k=null),(!j||a.generation>j.generation)&&(j=a)},()=>{k===e&&(k=null)}),d},{latest:()=>j,fence:()=>i,async observe(a,b,c){let d,e,g=h(),m=(e=k)?e.generation>a?e.promise:e.promise.catch(()=>void 0).then(()=>{let b=k;return b&&b.generation>a?b.promise:l(c)}):l(c),o=(a,b)=>n({observation:a,generation:b?Math.max(i,a?.generation??0):a?.generation??i,startedAt:g,completedAt:h(),collectorId:f.collectorId,...b?{failure:b}:{}}),p=Math.max(0,b);if(0===p)return m.catch(()=>void 0),o(j,q("collector-busy","collection-active","resource collection is still active"));let s=Symbol("resource-observation-timeout");try{let a=await Promise.race([m,new Promise(a=>{d=setTimeout(()=>a(s),p)})]);if(a===s)return o(j,q("timeout","observation-timeout","resource collection observation timed out"));return o(a)}catch(a){return o(j,a instanceof r?a.failure:q("collector-crash","collector-error","resource collection failed",{cause:a}))}finally{d&&clearTimeout(d)}}}),s=e.initial?.generation??0,t=a=>{a.degradedReason||a.generation<=s||(e.persist?.(a)??!0)&&(s=a.generation)},u=null,v=null,w=null,x=e.workerLimits?.observeTimeoutMs??3e4,y=a=>{w&&a.generation>=w.generation&&(w=null)},z=async a=>{let d=p.latest();if(!a&&d)return(c()-d.completedAt>=6e5&&(a=>{if(v)return;let b=p.observe(a.generation,x,!1).then(a=>{if(a.failure){w=a;return}a.observation&&y(a.observation)}).finally(()=>{v===b&&(v=null)});v=b})(d),t(d),w)?am(w,b,!1,!0):am({observation:d,generation:d.generation,startedAt:d.startedAt,completedAt:d.completedAt,collectorId:o},b,!1,!0);let e=a?p.fence():-1,f=await p.observe(e,x,a);return f.observation&&!f.failure&&(t(f.observation),y(f.observation)),am(f,b,a)};return{async read(a=!1){if(!a)return z(!1);if(u)return u;let b=z(!0);u=b;try{return await b}finally{u===b&&(u=null)}}}}(T,()=>F(),Date.now,I,{initial:function(){try{let a=(0,x.BQ)(U),b=(0,h.statSync)(a).size;if(b<=0||b>0x1000000)return null;return function(a){if(0>=Buffer.byteLength(a)||Buffer.byteLength(a)>0x1000000)return null;try{var b;let c=JSON.parse(a);if(!aa(c)||!ab(c,["version","observation"])||1!==c.version||!aa(c.observation))return null;let d=c.observation;if(!ab(d,["generation","startedAt","completedAt","collectorId","value"],["degradedReason"])||!Number.isSafeInteger(d.generation)||d.generation<0||!E(d.startedAt)||!E(d.completedAt)||d.completedAt<d.startedAt||"string"!=typeof d.collectorId||0===d.collectorId.length||d.collectorId.length>256||void 0!==d.degradedReason&&"collector-busy"!==d.degradedReason&&"timeout"!==d.degradedReason&&"collector-crash"!==d.degradedReason||(b=d.value,!(aa(b)&&ab(b,["payload","diagnostic","hostCount","treeCount","targets"],["targetEpoch"])&&af(b.payload)&&ag(b.diagnostic)&&Number.isSafeInteger(b.hostCount)&&!(b.hostCount<0)&&Number.isSafeInteger(b.treeCount)&&!(b.treeCount<0)&&(void 0===b.targetEpoch||Number.isSafeInteger(b.targetEpoch)&&!(b.targetEpoch<0))&&Array.isArray(b.targets)&&!(b.targets.length>1e4)&&b.targets.every(ah)&&"complete"===b.diagnostic.status&&ai(b.payload,b.targets)&&b.hostCount===b.payload.sessions.length&&b.treeCount===b.payload.sessions.reduce((a,b)=>a+b.procCount,0))))return null;return d}catch{return null}}((0,h.readFileSync)(a,"utf8"))}catch{return null}}(),persist:aj}),H.__llvResourcesReader=b),b).read(a)}}};
|
|
27
|
+
`;function Y(a){try{let b=(0,h.statSync)(a);return b.isFile()&&(73&b.mode)!=0}catch{return!1}}function Z(a){try{let b=(0,h.readFileSync)(`/proc/${a}/stat`,"utf8"),c=b.lastIndexOf(")");if(c<0)return null;let d=Number(b.slice(c+2).trim().split(/\s+/)[2]);return Number.isInteger(d)&&d>0?d:null}catch{return null}}let $="LLV_RESOURCE_COLLECTOR_OWNER",_={pidAlive:a=>d.B.pidAlive(a),processIdentity:a=>d.B.processIdentity(a),processExited:a=>"linux"===d.B.name&&function(a){try{let b=(0,h.readFileSync)(`/proc/${a}/stat`,"utf8"),c=b.slice(b.lastIndexOf(")")+2).trim().split(/\s+/,1)[0];return"Z"===c||"X"===c||"x"===c}catch{return!1}}(a),descendants:function(a){return"linux"===d.B.name?function(a){let b=[],c=new Set([a]),d=[a];for(;d.length>0;){let a,e=d.pop();b.push(e);try{a=(0,h.readFileSync)(`/proc/${e}/task/${e}/children`,"utf8")}catch{continue}for(let b of a.trim().split(/\s+/)){let a=Number(b);!Number.isInteger(a)||a<=0||c.has(a)||(c.add(a),d.push(a))}}return b}(a):(0,s.mO)(a,d.B.ppidMap())},processGroupId:a=>{let b,c;return"linux"===d.B.name?Z(a):Number.isInteger(c=Number(0===(b=(0,i.spawnSync)("ps",["-p",String(a),"-o","pgid="],{encoding:"utf8",timeout:1e3,windowsHide:!0})).status?b.stdout.trim():""))&&c>0?c:null},processGroupMembers:a=>"linux"===d.B.name?function(a){let b,c=[];try{b=(0,h.readdirSync)("/proc")}catch{return c}for(let d of b){let b=Number(d);Number.isInteger(b)&&!(b<=0)&&Z(b)===a&&c.push(b)}return c}(a):function(a){let b=(0,i.spawnSync)("ps",["-axo","pid=,pgid="],{encoding:"utf8",timeout:1e3,windowsHide:!0});if(0!==b.status)return[];let c=[];for(let d of b.stdout.split("\n")){let b=/^\s*(\d+)\s+(\d+)\s*$/.exec(d);b&&Number(b[2])===a&&c.push(Number(b[1]))}return c}(a),namespaceMembers:a=>"linux"===d.B.name?function(a){let b;try{b=(0,h.readdirSync)("/proc")}catch{return null}let c=`${$}=${a}`,e=[];for(let a of b){let b,f=Number(a);if(!Number.isInteger(f)||f<=0)continue;try{b=(0,h.readFileSync)(`/proc/${f}/environ`,"utf8")}catch{continue}if(!b.split("\0").includes(c))continue;let g=d.B.processIdentity(f);if(null!==g){try{b=(0,h.readFileSync)(`/proc/${f}/environ`,"utf8")}catch{continue}b.split("\0").includes(c)&&d.B.processIdentity(f)===g&&e.push(f)}}return e}(a):function(a){let b=`${$}=${a}`,c=(0,i.spawnSync)("ps",["eww","-axo","pid=,command="],{encoding:"utf8",timeout:1e3,windowsHide:!0,maxBuffer:0x1000000});if(0!==c.status)return null;let d=[];for(let a of c.stdout.split("\n")){let c=/^\s*(\d+)\s+/.exec(a);c&&a.includes(b)&&d.push(Number(c[1]))}return d}(a),processNamespaceId:a=>"linux"===d.B.name?function(a){try{let b=(0,h.readlinkSync)(`/proc/${a}/ns/pid`);return/^pid:\[\d+\]$/.test(b)?b:null}catch{return null}}(a):null,processNamespacePid:a=>"linux"===d.B.name?function(a){try{let b=(0,h.readFileSync)(`/proc/${a}/status`,"utf8").split("\n").find(a=>a.startsWith("NSpid:")),c=Number(b?.trim().split(/\s+/).at(-1));return Number.isInteger(c)&&c>0?c:null}catch{return null}}(a):null,openNamespaceReference:(a,b)=>"linux"===d.B.name?function(a,b){let c;try{c=(0,h.openSync)(`/proc/${a}/ns/pid`,"r")}catch{return null}try{if((0,h.readlinkSync)(`/proc/self/fd/${c}`)!==b)return(0,h.closeSync)(c),null;let a=(0,h.fstatSync)(c,{bigint:!0}),d=!1;return{members:()=>{let b;try{b=(0,h.readdirSync)("/proc")}catch{return null}let c=[];for(let d of b){let b=Number(d);if(Number.isInteger(b)&&!(b<=0))try{let d=(0,h.statSync)(`/proc/${b}/ns/pid`,{bigint:!0});d.dev===a.dev&&d.ino===a.ino&&c.push(b)}catch{}}return c},close:()=>{d||(d=!0,(0,h.closeSync)(c))}}}catch{return(0,h.closeSync)(c),null}}(a,b):null,signal:(a,b)=>process.kill(a,b)};function aa(a,b,c=[],d=I.__llvResourceTargetEpoch??0){return{payload:a,diagnostic:b,hostCount:a.sessions.length,treeCount:a.sessions.reduce((a,b)=>a+b.procCount,0),targets:c,targetEpoch:d}}function ab(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function ac(a,b,c=[]){let d=new Set([...b,...c]);return b.every(b=>Object.hasOwn(a,b))&&Object.keys(a).every(a=>d.has(a))}function ad(a){return null===a||"string"==typeof a}function ae(a){return null===a||"boolean"==typeof a}function af(a){return!!ab(a)&&!!ac(a,["target","panePid","path","engine","title","project","activity","lastActiveAt","cwd","rssBytes","swapBytes","procCount"],["hostConflict","kind","model","role","conversationId","stage","ownership","seat","turnBusy"])&&(void 0===a.kind||"tmux"===a.kind||"structured"===a.kind)&&(void 0===a.ownership||"owned"===a.ownership||"released"===a.ownership||"orphaned"===a.ownership)&&(void 0===a.model||!!ad(a.model))&&(void 0===a.role||!!ad(a.role))&&(void 0===a.conversationId||!!ad(a.conversationId))&&(void 0===a.stage||!!ad(a.stage))&&(void 0===a.seat||!!ae(a.seat))&&(void 0===a.turnBusy||!!ae(a.turnBusy))&&"string"==typeof a.target&&a.target.length>0&&Number.isSafeInteger(a.panePid)&&a.panePid>0&&ad(a.path)&&("claude"===a.engine||"codex"===a.engine||null===a.engine)&&ad(a.title)&&ad(a.project)&&("live"===a.activity||"recent"===a.activity||"stalled"===a.activity||"idle"===a.activity||null===a.activity)&&ad(a.lastActiveAt)&&(null===a.lastActiveAt||Number.isFinite(Date.parse(a.lastActiveAt)))&&ad(a.cwd)&&F(a.rssBytes)&&F(a.swapBytes)&&Number.isSafeInteger(a.procCount)&&a.procCount>=0&&(void 0===a.hostConflict||"boolean"==typeof a.hostConflict)}function ag(a){var b;return!!ab(a)&&!!ac(a,["system","sessions"])&&!!(null===(b=a.system)||ab(b)&&ac(b,["ramTotal","ramAvailable","swapTotal","swapUsed","capturedAt"])&&F(b.ramTotal)&&F(b.ramAvailable)&&F(b.swapTotal)&&F(b.swapUsed)&&"string"==typeof b.capturedAt&&Number.isFinite(Date.parse(b.capturedAt)))&&!!Array.isArray(a.sessions)&&a.sessions.length<=1e4&&a.sessions.every(af)}function ah(a){if(!ab(a)||!ac(a,["fresh","status","durationMs","phases"])||!ab(a.phases))return!1;let b=a.phases,c=["systemMemory","readFiles","readHosts","ppidMap","processMemory","attach","serialization"];return"boolean"==typeof a.fresh&&("complete"===a.status||"failed"===a.status)&&F(a.durationMs)&&ac(b,c)&&c.every(a=>F(b[a]))}function ai(a){var b,c;return ab(a)&&ac(a,["target","ref"])&&"string"==typeof a.target&&a.target.length>0&&!!ab(b=a.ref)&&(void 0!==b.kind?!!ab(c=b)&&!!ac(c,["kind","pid","startIdentity","bootEpoch","engine","sessionId","conversationId","seat","turnBusy","owned","lastActiveAt"])&&"structured"===c.kind&&Number.isSafeInteger(c.pid)&&c.pid>1&&"string"==typeof c.startIdentity&&c.startIdentity.length>0&&ad(c.bootEpoch)&&("claude"===c.engine||"codex"===c.engine)&&ad(c.sessionId)&&ad(c.conversationId)&&ae(c.seat)&&ae(c.turnBusy)&&"boolean"==typeof c.owned&&ad(c.lastActiveAt)&&(null===c.lastActiveAt||Number.isFinite(Date.parse(c.lastActiveAt))):!!ac(b,["tmuxServerPid","tmuxServerStartIdentity","paneId","panePid","paneStartIdentity"])&&Number.isSafeInteger(b.tmuxServerPid)&&b.tmuxServerPid>0&&ad(b.tmuxServerStartIdentity)&&"string"==typeof b.paneId&&/^%\d+$/.test(b.paneId)&&Number.isSafeInteger(b.panePid)&&b.panePid>0&&ad(b.paneStartIdentity))}function aj(a,b){let c=new Map;for(let b of a.sessions){if(c.has(b.target))return!1;c.set(b.target,b)}let d=new Set;return b.every(({target:a,ref:b})=>{if(d.has(a))return!1;d.add(a);let e=c.get(a);return!!e&&(H(b)?"structured"===e.kind&&e.panePid===b.pid:"structured"!==e.kind&&e.panePid===b.panePid)})}function ak(a){let b,c=(0,x.BQ)(V);try{(0,h.mkdirSync)(k().dirname(c),{recursive:!0,mode:448}),b=k().join(k().dirname(c),`.${k().basename(c)}.${process.pid}.${g().randomUUID()}.tmp`);let d=JSON.stringify({version:1,observation:a})+"\n";if(Buffer.byteLength(d)>0x1000000)throw Error("resource observation exceeded durable size limit");return(0,h.writeFileSync)(b,d,{mode:384}),(0,y.Hr)(b),(0,h.renameSync)(b,c),(0,h.chmodSync)(c,384),(0,y.Hr)(k().dirname(c)),!0}catch(a){if(b)try{(0,h.unlinkSync)(b)}catch{}return console.error(`[resources] observation persistence failed: ${a instanceof Error?a.message:String(a)}`),!1}}function al(a){let b=JSON.stringify({version:1,observation:a})+"\n";if(Buffer.byteLength(b)>0x1000000)throw new r("collector-crash","observation-limit","resource observation exceeded durable size limit")}async function am(a,b=S,c={},d=I.__llvResourceTargetEpoch??0,f=_,j=Q){let m,n,q=function(a={}){let b=a.cwd??process.cwd(),c=a.env??process.env,d=a.exists??h.existsSync,e=a.execPath??process.execPath,f=a.versions??process.versions,g=k().join(b,"src/lib/resourceCollector.worker.ts"),i=k().join(b,".next/server/resource-collector-worker.js"),j=d(g),l=d(i),m=j||!l?g:i;if(c.LLV_RESOURCE_COLLECTOR_EXECUTABLE)return{executable:c.LLV_RESOURCE_COLLECTOR_EXECUTABLE,workerPath:l?i:m};let n="/usr/local/bin/bun-container";return j&&d(n)?{executable:n,workerPath:g}:l?{executable:f.bun?e:c.LLV_BUN_EXECUTABLE||"bun",workerPath:i}:{executable:"bun",workerPath:g}}(),s=c.observeTimeoutMs??3e4,t=c.inputTimeoutMs??5e3,u=c.closeTimeoutMs??1e3,v=Math.max(0,Math.min(100,Math.floor(.75*u))),w=c.headroomMs??500,x=Math.min(25,Math.max(5,u)),y=Math.max(u+x+5,c.cleanupTimeoutMs??u+Math.floor(w/2)),A=Math.max(y,u+x+50),B=Math.max(Math.min(250,Math.ceil(.2*s)),50+x+Math.max(0,w-Math.max(0,A-u))),C=Math.max(0,s-t-A-B),D=Math.min(c.timeoutMs??23500,C),E=b(a),F=Promise.race([j(),new Promise(a=>{m=setTimeout(()=>a([]),t)})]).catch(a=>(console.error(`[resources] structured host inventory failed: ${a instanceof Error?a.message:String(a)}`),[])).finally(()=>{m&&clearTimeout(m)}),G=await Promise.race([E,new Promise((a,b)=>{n=setTimeout(()=>b(new r("timeout","file-handoff-timeout","resource collector file handoff timed out")),t)})]).finally(()=>{n&&clearTimeout(n)}),H=await F,J=JSON.stringify({type:"collect",fresh:a,files:G,identityEpoch:(0,e.h_)(),hosts:H})+"\n",K=c.outputMaxBytes??0x1010000;if(Buffer.byteLength(J)>0x1010000)throw new r("collector-crash","worker-input","resource collector input exceeded transport limit");let L=f===_&&Y(q.executable),M=g().randomUUID(),N=L?process.execPath:q.executable,O=L?["-e",W,q.executable,q.workerPath]:[q.workerPath],P=["/usr/bin/unshare","/bin/unshare"].find(h.existsSync),R=q.executable.includes(k().sep)&&!Y(q.executable),T=f===_&&"linux"===process.platform&&void 0!==P&&!R,U=g().randomUUID(),V=(0,i.spawn)(T?P:N,T?["--user","--map-root-user","--pid","--fork","/bin/sh","-c",X,"llv-resource-worker",U,N,...O]:O,{cwd:process.cwd(),detached:!0,stdio:["pipe","pipe","pipe"],env:{...(0,z.Fd)(process.env),[$]:M}});return new Promise((b,c)=>{let e,g,h,i,j,k=V.pid,m="number"==typeof k?f.processIdentity(k):null,n="number"==typeof k&&null!==m&&f.processGroupId(k)===k&&f.processIdentity(k)===m,q=null,s=null,t=0,w=function(a=2048){let b="",c="",d=null,e=0,f=0,g=null,h=c=>{let d=(b+=c).length-2*a;if(d<=0)return;let e=b.charCodeAt(d);e>=56320&&e<=57343&&(d+=1),b=b.slice(d)};return{append(a){c+=a,(()=>{let a=(a=!1)=>{let b=/^((?:\\+)?["'])/.exec(c)?.[1]??"",h=b.at(-1);'"'===h||"'"===h?(c=c.slice(b.length),d=h,e=b.length-1,f=0):d=a?"line":"unquoted",g=null};for(;c;){if("authorization"===g){d="line",g=null;continue}if("bearer"===g){let b=c.search(/\S/);if(b<0){c="";return}c=c.slice(b),a(!0);continue}if("value"===g){let b=c.search(/\S/);if(b<0){c="";return}c=c.slice(b),a(),g=null;continue}if("key"===g||"authorization-key"===g){let a="authorization-key"===g,b=/^[A-Z0-9_.-]*\s*[:=]\s*(?:((?:\\+)?["'])|(?=[^"'\\\s]))/i.exec(c);if(b){h("<redacted>"),c=c.slice(b[0].length);let i=b[1]??"",j=i.at(-1);d='"'===j||"'"===j?j:a?"line":"unquoted",e=i.length>0?i.length-1:0,f=0,g=null;continue}if(/^[A-Z0-9_.-]*\s*[:=]\s*$/i.exec(c)){h("<redacted>"),c="",g=a?"authorization":"value";return}if(/^[A-Z0-9_.-]*\s*$/i.test(c)){c=c.slice(-256);return}g=null}if(d){let a;if("line"===d)a=c.search(/[\r\n]/);else if("unquoted"===d)a=c.search(/\s/);else{a=-1;let b=f;for(let f=0;f<c.length;f+=1){let g=c[f];if("\\"===g){b+=1;continue}if(g===d&&b===e){a=f;break}b=0}f=b}if(a<0){c="";return}c=c.slice(a+ +("unquoted"!==d&&"line"!==d)),d=null,e=0,f=0;continue}let b=o(c);if(b){if(h(c.slice(0,b.index)+b.replacement),c=c.slice(b.index+b.length),b.authorization){d=b.quotedKey&&b.quote?b.quote:"line",e=b.quoteEscapeDepth;continue}if(b.bearer){d=b.quote??"line",e=b.quoteEscapeDepth;continue}d=b.quote??"unquoted",e=b.quoteEscapeDepth;continue}if(c.length<=256)return;let i=/(?:^|[^A-Z0-9_])(Bearer)(\s+)$/i.exec(c);if(i){let a=i.index+i[0].length-i[1].length-i[2].length;if(a<c.length-256){h(c.slice(0,a)+`${i[1]} <redacted>`),c="",g="bearer";return}}let j=/(^|[^A-Z0-9_.-])((?:\\+)?["']?)([A-Z0-9_.-]*(?:TOKEN|SECRET|PASSWORD|PASSWD|API[_-]?KEY|AUTHORIZATION|COOKIE)[A-Z0-9_.-]*)\2(\s*)(?:([:=])(\s*))?$/i.exec(c);if(j){let a=j.index+j[1].length;if(a<c.length-256){h(c.slice(0,a)),j[5]?(h("<redacted>"),c="",g=/AUTHORIZATION/i.test(j[3])?"authorization":"value"):(c=(j[3]+j[4]).slice(-256),g=/AUTHORIZATION/i.test(j[3])?"authorization-key":"key");return}}h(c.slice(0,-256)),c=c.slice(-256);return}})()},value:()=>p(b+(d?"":c),a,!0)}}(),z=new l.StringDecoder("utf8"),B=new Map;"number"==typeof k&&null!==m&&B.set(k,m);let C=[],E=null,F=!1,G=!1,H=null,I=!1,L=void 0===f.namespaceMembers,N=null,O=null,P=null,Q=null,R=!1,S=f!==_&&"unavailable"!==f.kernelContainment,W=S,X=S,Y=S,Z=!1,$=!1,ad=!1,ae=!1,af=!1,ak=!1,al=!1,am=(a,b,c,d)=>new r(a,b,c,{cause:d,stderr:w.value(),secondaryCauses:H?[H]:[]}),an=a=>{j??=a},ao=a=>{I=!0,an(Error(a))},ap=(a,b)=>{let c=f.processIdentity(a);if(null===c)return!f.pidAlive(a);if(c!==b||!f.processExited?.(a))return!1;let d=f.processIdentity(a);return d===c||null===d&&!f.pidAlive(a)},aq=()=>{ak||(ak=!0,w.append(z.end()))},ar=()=>{for(let a of C)clearTimeout(a);C.length=0},as=()=>{let a;if(!Y||null===N||null===Q)return!1;try{if(!R&&null!==O&&null!==P){let a=f.processIdentity(O);if(a===P)if(ap(O,P))R=!0;else{let b=f.processNamespaceId?.(O),c=f.processNamespacePid?.(O);f.processIdentity(O)!==a?R=!0:(b!==N||1!==c)&&ao("resource collector PID namespace root identity changed")}else null!==a?(R=!0,ao("resource collector PID namespace root identity was recycled")):f.pidAlive(O)||(R=!0)}a=Q.members()}catch(a){return W=!1,X=!1,an(a),!1}if(W=null!==a,X=a?.length===0,null===a)return an(Error("resource collector PID namespace could not be inspected")),!1;let b=!1;for(let c of a){let a=f.processIdentity(c);if(null===a||f.processNamespaceId?.(c)!==N||f.processIdentity(c)!==a)continue;let d=B.get(c);if(void 0!==d&&d!==a){ao("resource collector PID namespace member identity was recycled");continue}void 0===d&&(B.set(c,a),b=!0)}return b},at=(a=!0)=>{let b=!1,c=[...B.keys()],d=new Set;for(;c.length>0;){let a,e=c.pop();if(d.has(e))continue;d.add(e);let g=B.get(e);if(void 0!==g&&f.processIdentity(e)===g){try{a=f.descendants(e)}catch(a){an(a);continue}if(f.processIdentity(e)===g)for(let d of a){if(d===e)continue;let a=f.processIdentity(d);if(null===a||f.processIdentity(e)!==g||f.processIdentity(d)!==a)continue;let h=B.get(d);if(void 0!==h&&h!==a){ao("resource collector descendant identity was recycled");continue}void 0===h&&(B.set(d,a),b=!0),c.push(d)}}}(()=>{let a;if(null!==N||!n||Z||$||ad||"number"!=typeof k||null===m)return;if(f.processIdentity(k)!==m){Z=!0,ao("resource collector worker group leader identity changed");return}try{a=f.processGroupMembers(k)}catch(a){Z=!0,ao("resource collector worker group membership could not be inspected"),an(a);return}if(!a.includes(k)){Z=!0,ao("resource collector worker group continuity was lost");return}let b=[];for(let c of a){let a=f.processIdentity(c);null!==a&&f.processGroupId(c)===k&&f.processIdentity(c)===a&&b.push([c,a])}if(f.processIdentity(k)!==m){Z=!0,ao("resource collector worker group leader identity changed");return}for(let[a,c]of b){let b=B.get(a);if(void 0!==b&&b!==c){Z=!0,ao("resource collector worker group member identity changed");return}B.set(a,c)}})();let e=as();return!!a&&null===N&&(()=>{let a;if(!f.namespaceMembers)return!1;try{a=f.namespaceMembers(M)}catch(a){return L=!1,an(a),!1}if(L=null!==a,null===a)return an(Error("resource collector worker namespace could not be inspected")),!1;let b=!1;for(let c of a){let a=f.processIdentity(c);if(null===a||f.processIdentity(c)!==a)continue;let d=B.get(c);if(void 0!==d&&d!==a){ao("resource collector namespace member identity was recycled");continue}void 0===d&&(B.set(c,a),b=!0)}return b})()||e||b},au=()=>{let a=[],b=!1;for(let[c,d]of B){let e=f.processIdentity(c);if(e===d){if(ap(c,d))continue;let e=f.processIdentity(c);e===d?a.push(c):null===e&&f.pidAlive(c)?b=!0:null!==e&&null!==N&&ao("resource collector contained process identity was recycled");continue}null===e&&f.pidAlive(c)?b=!0:null!==e&&null!==N&&ao("resource collector contained process identity was recycled")}return{active:a,uncertain:b}},av=()=>{if("number"!=typeof k)return"absent";try{return f.signal(-k,0),"present"}catch(b){let a=b.code;if("ESRCH"===a)return $||(Z=!0),"absent";if("EPERM"===a)return"denied";return an(b),"unknown"}},aw=(a,b=!0,c="all")=>{if(at(b),null!==N&&null!==O&&null!==P){let b=au().active.filter(a=>a!==O&&f.processNamespaceId?.(a)===N),d=new Set(b),e="SIGTERM"===a?b:[];for(let g of("SIGTERM"===a&&"members"===c&&(e=b.filter(a=>{let b,c=B.get(a);if(void 0===c||f.processIdentity(a)!==c)return!1;try{b=f.descendants(a)}catch(a){return an(a),!1}return f.processIdentity(a)===c&&!b.some(b=>b!==a&&d.has(b))})),e)){let b=B.get(g);if(void 0===b)continue;let c=f.processIdentity(g);if(null!==c){if(c!==b||f.processNamespaceId?.(g)!==N||f.processIdentity(g)!==c){ao("resource collector PID namespace member identity changed before cleanup");continue}try{f.signal(g,a)}catch(a){"ESRCH"!==a.code&&an(a)}}}if("members"===c)return;let g=()=>{if("number"!=typeof k||null===m||k===O)return;let b=f.processIdentity(k);if(null!==b){if(b!==m||f.processIdentity(k)!==b)return void ao("resource collector worker wrapper identity changed before cleanup");if(!ap(k,m))try{f.signal(k,a)}catch(a){"ESRCH"!==a.code&&an(a)}}};if(R)return void g();let h=f.processIdentity(O);if(null===h){f.pidAlive(O)||(R=!0),g();return}if(ap(O,P)){R=!0,g();return}if(h!==P){R=!0,ao("resource collector PID namespace root identity changed before cleanup"),g();return}if(f.processNamespaceId?.(O)!==N||f.processNamespacePid?.(O)!==1||f.processIdentity(O)!==h){ao("resource collector PID namespace root identity changed before cleanup"),g();return}try{f.signal(O,a)}catch(a){"ESRCH"!==a.code&&an(a)}return void g()}let d=au();if("present"===av())if((()=>{if(!n||Z||"number"!=typeof k||null===m)return!1;for(let[a,b]of B)if(f.processIdentity(a)===b&&f.processGroupId(a)===k&&f.processIdentity(a)===b)return!0;return!1})())try{f.signal(-k,a),$=!0}catch(a){"ESRCH"!==a.code&&an(a)}else $?an(Error("resource collector worker group ownership could not be verified")):ao("resource collector worker group ownership could not be verified");for(let b of d.active){let c=B.get(b);if(void 0===c||f.processIdentity(b)!==c){$||ao("resource collector worker identity changed before individual cleanup");continue}try{f.signal(b,a)}catch(a){"ESRCH"!==a.code&&an(a)}}},ax=()=>{let a=au(),b="number"==typeof k&&null!==m&&ap(k,m),c=av();null!==N&&X&&b&&"present"===c&&(c="absent");let d=L&&"absent"===c&&0===a.active.length&&!a.uncertain,e=d&&W&&X;return d&&!Y&&null===H?(I=!0,H=Error("resource collector kernel containment could not be established"),!0):(e&&I&&null===H&&(H=Error("resource collector worker cleanup ownership verification failed",void 0===j?void 0:{cause:j})),e)},ay=()=>{if(!af){af=!0;try{Q?.close()}catch(a){an(a),H??=Error("resource collector PID namespace reference could not be closed",{cause:a})}for(let a of(Q=null,aq(),V.removeAllListeners(),[V.stdin,V.stdout,V.stderr]))a.removeAllListeners(),a.destroy(),a.unref?.();V.unref()}},az=a=>{if(!T||!a.startsWith(`${U} `))return!1;let[b,c,d,...e]=a.split(" "),g=Number(c);if(a.length>512||b!==U||!Number.isInteger(g)||g<=0||!/^pid:\[\d+\]$/.test(d)||e.length>0||!f.openNamespaceReference||!f.processNamespaceId||!f.processNamespacePid)return ao("resource collector PID namespace handshake was invalid"),!0;let h=f.processIdentity(g),i=null!==h&&f.processNamespaceId(g)===d&&1===f.processNamespacePid(g)&&f.processIdentity(g)===h?f.openNamespaceReference(g,d):null;return null===i||f.processIdentity(g)!==h||f.processNamespaceId(g)!==d||1!==f.processNamespacePid(g)||f.processIdentity(g)!==h?(i?.close(),ao("resource collector PID namespace root could not be verified")):(N=d,O=g,P=h,Q=i,Y=!0,W=!1,X=!1,L=!0,as()),!0};T||Y||ao("resource collector kernel containment is unavailable");let aA=()=>{if(al||!q||!ae&&!af||!G)return;al=!0;let a=q;(clearTimeout(aE),e&&clearTimeout(e),g&&clearTimeout(g),h&&clearTimeout(h),i&&clearTimeout(i),ar(),ay(),H)?"success"===a.type?c(am("collector-crash","worker-cleanup","resource collector worker cleanup failed")):c(am(a.reason,a.cause,a.message,a.error)):"success"===a.type?b(a.value):c(am(a.reason,a.cause,a.message,a.error))},aB=()=>{if(!F||G)return;at()&&(E=null);let a=ax();if(a?null===E&&(E=Date.now()):E=null,a&&Date.now()-E>=x){G=!0,g&&clearTimeout(g),i&&clearTimeout(i),aA();return}(i=setTimeout(aB,5)).unref()},aC=()=>{F||(F=!0,ar(),(h=setTimeout(()=>{if(at(),ax()&&void 0===j){G=!0,ay(),aA();return}!q&&s&&(q=s),H=Error("resource collector worker cleanup deadline expired",void 0===j?void 0:{cause:j}),G=!0,ay(),aA()},q?.type==="success"?A:y)).unref(),null===N?aw("SIGTERM",!1):(aw("SIGTERM",!1,"members"),(e=setTimeout(()=>{G||(aw("SIGTERM",!1,"root"),aB())},v)).unref()),(g=setTimeout(()=>{aw("SIGKILL"),aB()},u)).unref(),aB())},aD=a=>{if(q){"success"===q.type&&"failure"===a.type&&"worker-output-limit"===a.cause&&(q=a);return}q=a,clearTimeout(aE),aC()};for(let a of(at(),[0,5,20,40])){let b=setTimeout(()=>{F||ad||at()},a);b.unref(),C.push(b)}let aE=setTimeout(()=>aD({type:"failure",reason:"timeout",cause:"worker-timeout",message:"resource collector worker timed out"}),D);V.once("error",a=>{"number"!=typeof k&&(Y=!0,W=!0,X=!0,L=!0),aD({type:"failure",reason:"collector-crash",cause:"worker-spawn",message:"resource collector worker failed to start",error:a})}),V.once("exit",(a,b)=>{ad=!0,ar(),clearTimeout(aE),s={type:"failure",reason:"collector-crash",cause:"worker-exit",message:`resource collector worker exited before observation (${b??a??"unknown"})`},aC()}),V.once("close",(a,b)=>{clearTimeout(aE),aq(),ae=!0,q||(q=s??{type:"failure",reason:"collector-crash",cause:"worker-exit",message:`resource collector worker closed before observation (${b??a??"unknown"})`},aC()),aB(),aA()});let aF="";V.stdout.setEncoding("utf8"),V.stdout.on("data",b=>{if((t+=Buffer.byteLength(b))>K+(T&&!Y?512:0))return void aD({type:"failure",reason:"collector-crash",cause:"worker-output-limit",message:"resource collector worker exceeded stdout limit"});if(!q)for(aF+=b;!q;){var c;let b,e=aF.indexOf("\n");if(e<0)return;let f=aF.slice(0,e);if(aF=aF.slice(e+1),az(f)){(t-=Buffer.byteLength(f)+1)>K&&aD({type:"failure",reason:"collector-crash",cause:"worker-output-limit",message:"resource collector worker exceeded stdout limit"});continue}if(t>K)return void aD({type:"failure",reason:"collector-crash",cause:"worker-output-limit",message:"resource collector worker exceeded stdout limit"});try{b=JSON.parse(f)}catch{aD({type:"failure",reason:"collector-crash",cause:"worker-output-invalid",message:"resource collector worker emitted invalid JSON"});return}let g=ab(c=b)?"failure"===c.type?ac(c,["type","error"])&&"string"==typeof c.error&&c.error.length<=4096?c:null:"observation"===c.type&&ac(c,["type","payload","diagnostic","targets"])&&ag(c.payload)&&ah(c.diagnostic)&&Array.isArray(c.targets)&&!(c.targets.length>1e4)&&c.targets.every(ai)&&"complete"===c.diagnostic.status&&aj(c.payload,c.targets)?c:null:null;if(!g)return void aD({type:"failure",reason:"collector-crash",cause:"worker-output-invalid",message:"resource collector worker emitted an invalid message"});if("observation"===g.type&&g.diagnostic.fresh!==a)return void aD({type:"failure",reason:"collector-crash",cause:"worker-output-invalid",message:"resource collector worker returned mismatched freshness"});if("failure"===g.type)return void aD({type:"failure",reason:"collector-crash",cause:"worker-failure",message:"resource collector worker reported a failure",error:Error(g.error)});aD({type:"success",value:aa(g.payload,g.diagnostic,g.targets,d)}),aF=""}}),V.stderr.on("data",a=>{t+=a.length,w.append(z.write(a)),t>K+(T&&!Y?512:0)&&aD({type:"failure",reason:"collector-crash",cause:"worker-output-limit",message:"resource collector worker exceeded output limit"})}),V.stdin.once("error",a=>aD({type:"failure",reason:"collector-crash",cause:"worker-input",message:"resource collector worker input failed",error:a})),V.stdin.end(J)})}function an(a,b,c,d=!1){var e,f;let{observation:g,failure:h}=a,i=(e=a.collectorId,f=d||void 0!==h,g&&f?{status:g.collectorId===e?"memory":"durable",collectorId:g.collectorId,generation:g.generation}:{status:"miss"});if(!g){if(!h)throw Error("resource collector returned no observation or failure");return{payload:{system:b(),sessions:[]},diagnostic:{fresh:c,status:"failed",durationMs:Math.max(0,a.completedAt-a.startedAt),phases:C(),generation:a.generation,startedAt:new Date(a.startedAt).toISOString(),completedAt:new Date(a.completedAt).toISOString(),collectorId:a.collectorId,cache:i,degradedReason:h.reason,failure:h.diagnostic}}}let{payload:j,diagnostic:k}=g.value;return(h||g.collectorId!==a.collectorId||void 0===g.value.targetEpoch||function(a,b,c=I.__llvResourceTargetEpoch??0){c!==(I.__llvResourceTargetEpoch??0)||a<=(I.__llvResourceTargetsGeneration??0)||(K(b),I.__llvResourceTargetsGeneration=a)}(g.generation,g.value.targets,g.value.targetEpoch),h)?{payload:c?j:{...j,system:b()},diagnostic:{fresh:c,status:"failed",durationMs:Math.max(0,a.completedAt-a.startedAt),phases:C(),generation:a.generation,startedAt:new Date(a.startedAt).toISOString(),completedAt:new Date(a.completedAt).toISOString(),collectorId:a.collectorId,cache:i,degradedReason:h.reason,failure:h.diagnostic}}:{payload:c?j:{...j,system:b()},diagnostic:{...k,fresh:c,generation:g.generation,startedAt:new Date(g.startedAt).toISOString(),completedAt:new Date(g.completedAt).toISOString(),collectorId:a.collectorId,cache:i}}}async function ao(a=!1){let b,c=process.env.LLV_RESOURCES_FIXTURE;if(c){var d;let b;return K([]),d=function(a){let b;try{b=JSON.parse(a)}catch{throw Error("invalid resources fixture: expected JSON")}let c=b,d=c?.system,e=null===d||"object"==typeof d&&F(d.ramTotal)&&F(d.ramAvailable)&&F(d.swapTotal)&&F(d.swapUsed)&&"string"==typeof d.capturedAt&&Number.isFinite(Date.parse(d.capturedAt));if(!c||!e||!Array.isArray(c.sessions)||0!==c.sessions.length)throw Error("invalid resources fixture: expected system metrics and an empty sessions list");return{system:d??null,sessions:[]}}((0,h.readFileSync)(c,"utf8")),b=Date.now(),{payload:d,diagnostic:{fresh:a,status:"complete",durationMs:0,phases:C(),generation:0,startedAt:new Date(b).toISOString(),completedAt:new Date(b).toISOString(),collectorId:"fixture",cache:{status:"miss"}}}}return(b=I.__llvResourcesReader,(3!==I.__llvResourcesReaderVersion||!b)&&(I.__llvResourcesReaderVersion=3,b=function(a,b,c=Date.now,d=J,e={}){var f;let h,i,j,k,l,m=e.inProcess??"1"===process.env.LLV_RESOURCE_COLLECTOR_IN_PROCESS,o=e.collectorId??(m?`in-process:${process.pid}:${g().randomUUID()}`:`worker:${process.pid}:${g().randomUUID()}`),p=(h=(f={collectorId:o,now:c,initial:e.initial,validateObservation:al,collect:m?async(b=!1)=>{let c=I.__llvResourceTargetEpoch??0,e=await a(b),f=d();if(!f)throw Error("resource build completed without diagnostics");return aa(e,f,I.__llvLastResourceTargets?.map(({target:a,ref:b})=>({target:a,ref:{...b}}))??[],c)}:(a=!1)=>am(a,e.readFiles,e.workerLimits,I.__llvResourceTargetEpoch??0,e.workerProcessRuntime)}).now??Date.now,i=f.initial?.generation??0,j=f.initial??null,k=null,l=a=>{let b=++i,c=h(),d=Promise.resolve().then(()=>f.collect(a)).then(a=>{let d={generation:b,startedAt:c,completedAt:h(),collectorId:f.collectorId,value:n(a)};return f.validateObservation?.(d),n(d)}),e={generation:b,promise:d};return k=e,d.then(a=>{k===e&&(k=null),(!j||a.generation>j.generation)&&(j=a)},()=>{k===e&&(k=null)}),d},{latest:()=>j,fence:()=>i,async observe(a,b,c){let d,e,g=h(),m=(e=k)?e.generation>a?e.promise:e.promise.catch(()=>void 0).then(()=>{let b=k;return b&&b.generation>a?b.promise:l(c)}):l(c),o=(a,b)=>n({observation:a,generation:b?Math.max(i,a?.generation??0):a?.generation??i,startedAt:g,completedAt:h(),collectorId:f.collectorId,...b?{failure:b}:{}}),p=Math.max(0,b);if(0===p)return m.catch(()=>void 0),o(j,q("collector-busy","collection-active","resource collection is still active"));let s=Symbol("resource-observation-timeout");try{let a=await Promise.race([m,new Promise(a=>{d=setTimeout(()=>a(s),p)})]);if(a===s)return o(j,q("timeout","observation-timeout","resource collection observation timed out"));return o(a)}catch(a){return o(j,a instanceof r?a.failure:q("collector-crash","collector-error","resource collection failed",{cause:a}))}finally{d&&clearTimeout(d)}}}),s=e.initial?.generation??0,t=a=>{a.degradedReason||a.generation<=s||(e.persist?.(a)??!0)&&(s=a.generation)},u=null,v=null,w=null,x=e.workerLimits?.observeTimeoutMs??3e4,y=a=>{w&&a.generation>=w.generation&&(w=null)},z=async a=>{let d=p.latest();if(!a&&d)return(c()-d.completedAt>=6e5&&(a=>{if(v)return;let b=p.observe(a.generation,x,!1).then(a=>{if(a.failure){w=a;return}a.observation&&y(a.observation)}).finally(()=>{v===b&&(v=null)});v=b})(d),t(d),w)?an(w,b,!1,!0):an({observation:d,generation:d.generation,startedAt:d.startedAt,completedAt:d.completedAt,collectorId:o},b,!1,!0);let e=a?p.fence():-1,f=await p.observe(e,x,a);return f.observation&&!f.failure&&(t(f.observation),y(f.observation)),an(f,b,a)};return{async read(a=!1){if(!a)return z(!1);if(u)return u;let b=z(!0);u=b;try{return await b}finally{u===b&&(u=null)}}}}(U,()=>G(),Date.now,J,{initial:function(){try{let a=(0,x.BQ)(V),b=(0,h.statSync)(a).size;if(b<=0||b>0x1000000)return null;return function(a){if(0>=Buffer.byteLength(a)||Buffer.byteLength(a)>0x1000000)return null;try{var b;let c=JSON.parse(a);if(!ab(c)||!ac(c,["version","observation"])||1!==c.version||!ab(c.observation))return null;let d=c.observation;if(!ac(d,["generation","startedAt","completedAt","collectorId","value"],["degradedReason"])||!Number.isSafeInteger(d.generation)||d.generation<0||!F(d.startedAt)||!F(d.completedAt)||d.completedAt<d.startedAt||"string"!=typeof d.collectorId||0===d.collectorId.length||d.collectorId.length>256||void 0!==d.degradedReason&&"collector-busy"!==d.degradedReason&&"timeout"!==d.degradedReason&&"collector-crash"!==d.degradedReason||(b=d.value,!(ab(b)&&ac(b,["payload","diagnostic","hostCount","treeCount","targets"],["targetEpoch"])&&ag(b.payload)&&ah(b.diagnostic)&&Number.isSafeInteger(b.hostCount)&&!(b.hostCount<0)&&Number.isSafeInteger(b.treeCount)&&!(b.treeCount<0)&&(void 0===b.targetEpoch||Number.isSafeInteger(b.targetEpoch)&&!(b.targetEpoch<0))&&Array.isArray(b.targets)&&!(b.targets.length>1e4)&&b.targets.every(ai)&&"complete"===b.diagnostic.status&&aj(b.payload,b.targets)&&b.hostCount===b.payload.sessions.length&&b.treeCount===b.payload.sessions.reduce((a,b)=>a+b.procCount,0))))return null;return d}catch{return null}}((0,h.readFileSync)(a,"utf8"))}catch{return null}}(),persist:ak}),I.__llvResourcesReader=b),b).read(a)}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.id=6978,exports.ids=[6978],exports.modules={6978:(a,b,c)=>{c.d(b,{O6:()=>D,Xb:()=>z,UT:()=>v,vq:()=>y,mQ:()=>w,fW:()=>C,yy:()=>B});var d=c(77598),e=c.n(d),f=c(49729),g=c(64859),h=c(60641),i=c(58396),j=c(36883),k=c(36522);let l=["coral","amber","lime","teal","sky","violet","pink","slate"];function m(a){return{ok:!1,error:'The board already shows 300 task bands for this project. Hide a band you no longer need, or keep this task off the board with board: "hidden".',status:409,code:"TASK_BOARD_FULL",field:a}}function n(a){return"string"!=typeof a?null:a.trim()||null}function o(a){let b=a&&"object"==typeof a&&!Array.isArray(a)?a:null,c=b?"number"==typeof b.x&&Number.isFinite(b.x)?"pos.y":"pos.x":"pos";return{ok:!1,error:`${c} must be ${"pos"===c?"an object with finite x and y":"a finite number"}`,status:400,code:"TASK_INVALID_FIELD",field:c}}function p(a){return!a||"object"!=typeof a||Array.isArray(a)?null:"number"==typeof a.x&&Number.isFinite(a.x)&&"number"==typeof a.y&&Number.isFinite(a.y)?{x:a.x,y:a.y}:null}function q(a){return"shown"===a||"hidden"===a?a:null}function r(a){return"pinned"===a||"unplaced"===a?a:null}function s(a,b){let c=null!=a,d=null!=b;if(!c&&!d)return{ok:!0};if(c!==d)return{ok:!1,error:"dueAt and dueTz must be set together"};if("string"!=typeof a||"string"!=typeof b)return{ok:!1,error:"invalid deadline"};let e=Date.parse(a);return Number.isFinite(e)?!function(a){try{return new Intl.DateTimeFormat(void 0,{timeZone:a}),!0}catch{return!1}}(b)?{ok:!1,error:"invalid dueTz"}:{ok:!0,dueAt:new Date(e).toISOString(),dueTz:b}:{ok:!1,error:"invalid dueAt"}}function t(){return{ok:!1,error:"Task text must be no longer than 6000 characters",status:400}}function u(a){if(null==a)return{ok:!0};if("string"!=typeof a)return{ok:!1,error:"details must be a string",status:400,code:"TASK_INVALID_FIELD",field:"details"};let b=a.trim();return b?b.length>2e4?{ok:!1,error:"Task details must be no longer than 20000 characters",status:400,code:"TASK_INVALID_FIELD",field:"details"}:{ok:!0,details:b}:{ok:!0}}function v(a,b,c=[],d={}){var g,j;let k="string"!=typeof(j=b.project)?null:j.trim()||null;if(!k)return{ok:!1,error:"project is required",status:400};let l=n(b.text);if(!l)return{ok:!1,error:"task text is required",status:400};if(l.length>6e3)return t();let w=u(b.details);if(!w.ok)return w;let x="string"==typeof b.clientRequestId&&b.clientRequestId.trim()?b.clientRequestId.trim():null;if(x){let b=c.find(a=>a.clientRequestId===x);if(b){let d=a.find(a=>a.id===b.taskId);if(d)return{ok:!0,tasks:a,task:d,recentCreates:c,replay:!0}}}let y=p(b.pos);if(Object.hasOwn(b,"pos")&&!y)return o(b.pos);let z=r(b.placement)??(y?"pinned":null);if(void 0!==b.placement&&null===z)return{ok:!1,error:"invalid placement",status:400};if("pinned"===z&&!y)return{ok:!1,error:"task position is required",status:400,code:"TASK_INVALID_FIELD",field:"pos"};if("unplaced"===z&&y)return{ok:!1,error:"unplaced task must not carry a position",status:400,code:"TASK_INVALID_FIELD",field:"pos"};if(null===z)return{ok:!1,error:"task position is required",status:400,code:"TASK_INVALID_FIELD",field:"pos"};let A=s(b.dueAt,b.dueTz);if(!A.ok)return{ok:!1,error:A.error,status:400};let B=function(a,b){if(null==a)return{ok:!0};if(!Array.isArray(a))return{ok:!1,error:"invalid attachments",status:400};if(0===a.length)return{ok:!0};let c=[];for(let d of a){if(!(0,f.tK)(d))return{ok:!1,error:"invalid attachment ref",status:400};if(!b(d))return{ok:!1,error:"attachment not found in store",status:400};c.push(d)}return{ok:!0,attachments:c}}(b.attachments,d.attachmentExists??(()=>!0));if(!B.ok)return B;let C=void 0===(g=b.source)?void 0:!g||"object"!=typeof g||Array.isArray(g)?null:"string"==typeof g.path&&g.path.trim()&&(null===g.ts||"string"==typeof g.ts)&&"string"==typeof g.text&&g.text.trim()&&"string"==typeof g.fingerprint&&g.fingerprint.trim()&&("claude"===g.engine||"codex"===g.engine)?{path:g.path,ts:g.ts,text:g.text,fingerprint:g.fingerprint,engine:g.engine}:null;if(null===C)return{ok:!1,error:"invalid task source",status:400};let D=Object.hasOwn(b,"board")?q(b.board):void 0;if(null===D)return{ok:!1,error:"invalid board visibility",status:400,code:"TASK_INVALID_FIELD",field:"board"};if("hidden"!==D&&(0,i.Qi)(a,k,d.hasBoardMembers??(()=>!1))>=300)return m("project");let E=d.now?.()??(0,h.Ec)(),F=d.id?.()??e().randomUUID(),G={id:F,project:k,status:"inbox",text:l,...w.details?{details:w.details}:{},placement:z,..."pinned"===z&&y?{pos:y}:{},...A.dueAt?{dueAt:A.dueAt,dueTz:A.dueTz}:{},...B.attachments?{attachments:B.attachments}:{},...C?{source:C}:{},...D?{board:D}:{},assignments:[],createdAt:E,updatedAt:E};return{ok:!0,tasks:[...a,G],task:G,recentCreates:x?[...c,{clientRequestId:x,taskId:F}].slice(-100):c,replay:!1}}function w(a,b,c,d=(0,h.Ec)(),e={}){var f,k;let v=a.findIndex(a=>a.id===b);if(v<0)return{ok:!1,error:"task not found",status:404};let x=a[v];if(e.requirePlacementGuards&&(Object.hasOwn(c,"pos")||Object.hasOwn(c,"placement"))||Object.hasOwn(c,"hide")||Object.hasOwn(c,"expectedProject")||Object.hasOwn(c,"expectedRevision")){for(let a of["expectedProject","expectedRevision"])if("string"!=typeof c[a]||!c[a].trim())return{ok:!1,status:400,code:"TASK_INVALID_FIELD",field:a,error:`${a} must be a non-empty string copied from the current task`};if(c.expectedProject!==x.project)return{ok:!1,status:409,code:"TASK_PROJECT_MISMATCH",field:"expectedProject",error:"expectedProject does not match the current task project; read the task and reconsider the request"};if(c.expectedRevision!==(0,g.d4)(x))return{ok:!1,status:409,code:"TASK_REVISION_MISMATCH",field:"expectedRevision",error:"expectedRevision is stale; read the task and reconsider the request"}}let y={};if(Object.hasOwn(c,"text")){let b=n(c.text);if(!b)return{ok:!1,error:"task text is required",status:400};if(b.length>6e3)return t();y.text=b,a[v].origin?.refinement==="pending"&&b!==a[v].text&&(y.origin={...a[v].origin,refinement:"titled"})}if(Object.hasOwn(c,"details")){let a=u(c.details);if(!a.ok)return a;y.details=a.details}if(Object.hasOwn(c,"status")){let a="inbox"===(f=c.status)||"assigned"===f||"blocked"===f||"done"===f?f:null;if(!a)return{ok:!1,error:"invalid task status",status:400};y.status=a}if(Object.hasOwn(c,"pos")){let a=p(c.pos);if(!a)return o(c.pos);y.pos=a,y.placement="pinned"}if(Object.hasOwn(c,"board")){let b=q(c.board);if(!b)return{ok:!1,error:"invalid board visibility",status:400,code:"TASK_INVALID_FIELD",field:"board"};let d=e.hasBoardMembers??(()=>!1);if("shown"===b&&!(0,i.d4)(x,d(x))&&(0,i.Qi)(a,x.project,d)>=300)return m("board");y.board=b}if(Object.hasOwn(c,"color")){let a="none"===(k=c.color)||"string"==typeof k&&l.includes(k)?k:null;if(!a)return{ok:!1,error:`color must be one of none, ${l.join(", ")}`,status:400,code:"TASK_INVALID_FIELD",field:"color"};y.color="none"===a?void 0:a}if(Object.hasOwn(c,"hide")){if(!0!==c.hide&&!1!==c.hide)return{ok:!1,error:"hide must be true or false",status:400,code:"TASK_INVALID_FIELD",field:"hide"};if(c.hide){let a=e.seatHolding?e.seatHolding(x):"unknown";if("holds"===a)return{ok:!1,status:409,code:"TASK_HIDE_PROTECTED",field:"hide",error:"this task holds the project's orchestrator seat conversation, which stays on the board; it cannot be hidden"};if("unknown"===a)return{ok:!1,status:503,code:"TASK_HIDE_UNVERIFIED",field:"hide",error:"the orchestrator seat record could not be read, so the hide was not applied; try again"};y.groupHidden={at:d,by:e.actor??"operator",admitted:(0,j.QE)(x.assignments)}}else y.groupHidden=void 0}if(Object.hasOwn(c,"placement")){let a=r(c.placement);if(!a)return{ok:!1,error:"invalid placement",status:400};if("pinned"===a&&!y.pos&&!x.pos)return{ok:!1,error:"task position is required",status:400,code:"TASK_INVALID_FIELD",field:"pos"};y.placement=a}if(Object.hasOwn(c,"dueAt")||Object.hasOwn(c,"dueTz"))if(null===c.dueAt&&void 0===c.dueTz)y.dueAt=void 0,y.dueTz=void 0;else{let a=s(c.dueAt,c.dueTz);if(!a.ok)return{ok:!1,error:a.error,status:400};y.dueAt=a.dueAt,y.dueTz=a.dueTz}let z=Object.keys(c).every(a=>"color"===a||"hide"===a||"expectedProject"===a||"expectedRevision"===a)&&(Object.hasOwn(c,"color")||Object.hasOwn(c,"hide")),A={...x,...y,updatedAt:z?x.updatedAt:d};Object.hasOwn(y,"dueAt")&&void 0===y.dueAt&&(delete A.dueAt,delete A.dueTz),"unplaced"===A.placement&&delete A.pos,Object.hasOwn(y,"details")&&void 0===y.details&&delete A.details,Object.hasOwn(y,"color")&&void 0===y.color&&delete A.color,Object.hasOwn(y,"groupHidden")&&void 0===y.groupHidden&&delete A.groupHidden;let B=a.slice();return B[v]=A,{ok:!0,tasks:B,task:A}}function x(a,b,c,d,e){let f=a,g=[];for(let a of c){if("failed"===a.state)continue;let c=(0,k.On)(a),h=(0,k.Z1)(a);if(!c||!h||(0,k.v1)(f,c))continue;let i=(0,k.IE)(f,{project:b,origin:h,identity:c},e);if(!i.ok)return i;if(d&&i.taskIds.includes(d))return{ok:!1,error:"this task is the conversation's own membership; link the conversation to another task first or delete the task",status:409};f=i.tasks,g.push(...i.created)}return{ok:!0,tasks:f,replacements:g}}function y(a,b,c={}){let d=a.find(a=>a.id===b);return d?x(a.filter(a=>a.id!==b),d.project,d.assignments,null,c):{ok:!1,error:"task not found",status:404}}function z(a){if(!a||"object"!=typeof a||Array.isArray(a))return null;let b={};return"string"==typeof a.launchId&&a.launchId.trim()&&(b.launchId=a.launchId.trim()),"string"==typeof a.path&&a.path.trim()&&(b.path=a.path.trim()),"string"==typeof a.conversationId&&a.conversationId.trim()&&(b.conversationId=a.conversationId.trim()),"number"==typeof a.panePid&&Number.isInteger(a.panePid)&&a.panePid>0&&(b.panePid=a.panePid),null!=b.launchId||null!=b.conversationId||null!=b.path||null!=b.panePid?b:null}function A(a,b){return null!=b.launchId?a.launchId===b.launchId:null!=b.conversationId?a.conversationId===b.conversationId:null!=b.path?a.path===b.path:null!=b.panePid&&a.panePid===b.panePid}function B(a,b,c,d=(0,h.Ec)(),e={}){let f=a.findIndex(a=>a.id===b);if(f<0)return{ok:!1,error:"task not found",status:404};let g="string"==typeof c?{path:c}:c,i=a[f],j=i.assignments.filter(a=>!A(a,g));if(j.length===i.assignments.length)return{ok:!0,tasks:a,task:i};let k=i.assignments.filter(a=>A(a,g)),l={...i,assignments:j,updatedAt:d},m=a.slice();m[f]=l;let n=x(m,i.project,k,b,{now:()=>d,...e});return n.ok?{ok:!0,tasks:n.tasks,task:l}:n}function C(a,b){return a.find(a=>a.engine===b&&"string"==typeof a.accountId)?.accountId??null}function D(a,b,c,d=(0,h.Ec)()){let e=a.findIndex(a=>a.id===b);if(e<0)return{ok:!1,error:"task not found",status:404};let f=a[e],g=function(a,b){let c=a.slice();for(let a of b){let b=c.findIndex(b=>a.launchId&&b.launchId?b.launchId===a.launchId:null!==a.path&&b.path===a.path||null===a.path&&null!==a.panePid&&null===b.path&&b.panePid===a.panePid),d=b>=0?c[b]:void 0,e=void 0!==a.launchId?a.launchId:d?.launchId,f=void 0!==a.clientAttemptId?a.clientAttemptId:d?.clientAttemptId,g=void 0!==a.conversationId?a.conversationId:d?.conversationId,h={...void 0!==e?{launchId:e}:{},...void 0!==f?{clientAttemptId:f}:{},path:a.path,...void 0!==g?{conversationId:g}:{},panePid:a.panePid,state:a.state,error:a.error,at:a.at,...void 0!==a.accountId?{accountId:a.accountId}:{},...void 0!==a.engine?{engine:a.engine}:{}};c=b>=0?[...c.slice(0,b),h,...c.slice(b+1)]:[...c,h]}return c}(f.assignments,c),i=g.some(a=>"delivered"===a.state||"spawning"===a.state||"handoff"===a.state||"linked"===a.state),j=f.status;("inbox"===j||"assigned"===j)&&(j=i?"assigned":"inbox");let k={...f,status:j,assignments:g,updatedAt:d},l=a.slice();return l[e]=k,{ok:!0,tasks:l,task:k}}},36883:(a,b,c)=>{function d(a){let b=new Set;for(let c of a)if("failed"!==c.state){for(let a of[c.clientAttemptId,c.launchId,c.conversationId,c.path].filter(a=>"string"==typeof a&&a.length>0))b.add(a)}return[...b].sort()}function e(a,b){return b.conversationIds.length||b.paths.length?a.find(a=>a.conversationId&&b.conversationIds.includes(a.conversationId)||a.path&&b.paths.includes(a.path))??null:null}c.d(b,{QE:()=>d,VE:()=>e})},58396:(a,b,c)=>{c.d(b,{HR:()=>d,Qi:()=>f,d4:()=>e});let d="emptyTaskBandsHidden";function e(a,b){return"hidden"!==a.board||b}function f(a,b,c){let d=0;for(let f of a)f.project===b&&e(f,c(f))&&(d+=1);return d}}};
|
|
1
|
+
"use strict";exports.id=6978,exports.ids=[6978],exports.modules={6978:(a,b,c)=>{c.r(b),c.d(b,{BOARD_TASKS_PER_PROJECT_LIMIT:()=>o,RECENT_CREATES_CAP:()=>p,TASK_DETAILS_LIMIT:()=>m,TASK_TEXT_LIMIT:()=>l,applyAssignmentPatches:()=>I,assignmentRefFromBody:()=>D,createTask:()=>z,deleteTask:()=>C,mergeAssignments:()=>H,patchTask:()=>A,pinnedAccountId:()=>G,removeAssignment:()=>F});var d=c(77598),e=c.n(d),f=c(49729),g=c(64859),h=c(60641),i=c(58396),j=c(36883),k=c(36522);let l=6e3,m=2e4,n=["coral","amber","lime","teal","sky","violet","pink","slate"],o=300,p=100;function q(a){return{ok:!1,error:`The board already shows ${o} task bands for this project. Hide a band you no longer need, or keep this task off the board with board: "hidden".`,status:409,code:"TASK_BOARD_FULL",field:a}}function r(a){return"string"!=typeof a?null:a.trim()||null}function s(a){let b=a&&"object"==typeof a&&!Array.isArray(a)?a:null,c=b?"number"==typeof b.x&&Number.isFinite(b.x)?"pos.y":"pos.x":"pos";return{ok:!1,error:`${c} must be ${"pos"===c?"an object with finite x and y":"a finite number"}`,status:400,code:"TASK_INVALID_FIELD",field:c}}function t(a){return!a||"object"!=typeof a||Array.isArray(a)?null:"number"==typeof a.x&&Number.isFinite(a.x)&&"number"==typeof a.y&&Number.isFinite(a.y)?{x:a.x,y:a.y}:null}function u(a){return"shown"===a||"hidden"===a?a:null}function v(a){return"pinned"===a||"unplaced"===a?a:null}function w(a,b){let c=null!=a,d=null!=b;if(!c&&!d)return{ok:!0};if(c!==d)return{ok:!1,error:"dueAt and dueTz must be set together"};if("string"!=typeof a||"string"!=typeof b)return{ok:!1,error:"invalid deadline"};let e=Date.parse(a);return Number.isFinite(e)?!function(a){try{return new Intl.DateTimeFormat(void 0,{timeZone:a}),!0}catch{return!1}}(b)?{ok:!1,error:"invalid dueTz"}:{ok:!0,dueAt:new Date(e).toISOString(),dueTz:b}:{ok:!1,error:"invalid dueAt"}}function x(){return{ok:!1,error:`Task text must be no longer than ${l} characters`,status:400}}function y(a){if(null==a)return{ok:!0};if("string"!=typeof a)return{ok:!1,error:"details must be a string",status:400,code:"TASK_INVALID_FIELD",field:"details"};let b=a.trim();return b?b.length>m?{ok:!1,error:`Task details must be no longer than ${m} characters`,status:400,code:"TASK_INVALID_FIELD",field:"details"}:{ok:!0,details:b}:{ok:!0}}function z(a,b,c=[],d={}){var g,j;let k="string"!=typeof(j=b.project)?null:j.trim()||null;if(!k)return{ok:!1,error:"project is required",status:400};let m=r(b.text);if(!m)return{ok:!1,error:"task text is required",status:400};if(m.length>l)return x();let n=y(b.details);if(!n.ok)return n;let A="string"==typeof b.clientRequestId&&b.clientRequestId.trim()?b.clientRequestId.trim():null;if(A){let b=c.find(a=>a.clientRequestId===A);if(b){let d=a.find(a=>a.id===b.taskId);if(d)return{ok:!0,tasks:a,task:d,recentCreates:c,replay:!0}}}let B=t(b.pos);if(Object.hasOwn(b,"pos")&&!B)return s(b.pos);let C=v(b.placement)??(B?"pinned":null);if(void 0!==b.placement&&null===C)return{ok:!1,error:"invalid placement",status:400};if("pinned"===C&&!B)return{ok:!1,error:"task position is required",status:400,code:"TASK_INVALID_FIELD",field:"pos"};if("unplaced"===C&&B)return{ok:!1,error:"unplaced task must not carry a position",status:400,code:"TASK_INVALID_FIELD",field:"pos"};if(null===C)return{ok:!1,error:"task position is required",status:400,code:"TASK_INVALID_FIELD",field:"pos"};let D=w(b.dueAt,b.dueTz);if(!D.ok)return{ok:!1,error:D.error,status:400};let E=function(a,b){if(null==a)return{ok:!0};if(!Array.isArray(a))return{ok:!1,error:"invalid attachments",status:400};if(0===a.length)return{ok:!0};let c=[];for(let d of a){if(!(0,f.tK)(d))return{ok:!1,error:"invalid attachment ref",status:400};if(!b(d))return{ok:!1,error:"attachment not found in store",status:400};c.push(d)}return{ok:!0,attachments:c}}(b.attachments,d.attachmentExists??(()=>!0));if(!E.ok)return E;let F=void 0===(g=b.source)?void 0:!g||"object"!=typeof g||Array.isArray(g)?null:"string"==typeof g.path&&g.path.trim()&&(null===g.ts||"string"==typeof g.ts)&&"string"==typeof g.text&&g.text.trim()&&"string"==typeof g.fingerprint&&g.fingerprint.trim()&&("claude"===g.engine||"codex"===g.engine)?{path:g.path,ts:g.ts,text:g.text,fingerprint:g.fingerprint,engine:g.engine}:null;if(null===F)return{ok:!1,error:"invalid task source",status:400};let G=Object.hasOwn(b,"board")?u(b.board):void 0;if(null===G)return{ok:!1,error:"invalid board visibility",status:400,code:"TASK_INVALID_FIELD",field:"board"};if("hidden"!==G&&(0,i.Qi)(a,k,d.hasBoardMembers??(()=>!1))>=o)return q("project");let H=d.now?.()??(0,h.Ec)(),I=d.id?.()??e().randomUUID(),J={id:I,project:k,status:"inbox",text:m,...n.details?{details:n.details}:{},placement:C,..."pinned"===C&&B?{pos:B}:{},...D.dueAt?{dueAt:D.dueAt,dueTz:D.dueTz}:{},...E.attachments?{attachments:E.attachments}:{},...F?{source:F}:{},...G?{board:G}:{},assignments:[],createdAt:H,updatedAt:H};return{ok:!0,tasks:[...a,J],task:J,recentCreates:A?[...c.filter(a=>a.clientRequestId!==A),{clientRequestId:A,taskId:I}].slice(-p):c,replay:!1}}function A(a,b,c,d=(0,h.Ec)(),e={}){var f,k;let m=a.findIndex(a=>a.id===b);if(m<0)return{ok:!1,error:"task not found",status:404};let p=a[m];if(e.requirePlacementGuards&&(Object.hasOwn(c,"pos")||Object.hasOwn(c,"placement"))||Object.hasOwn(c,"hide")||Object.hasOwn(c,"expectedProject")||Object.hasOwn(c,"expectedRevision")){for(let a of["expectedProject","expectedRevision"])if("string"!=typeof c[a]||!c[a].trim())return{ok:!1,status:400,code:"TASK_INVALID_FIELD",field:a,error:`${a} must be a non-empty string copied from the current task`};if(c.expectedProject!==p.project)return{ok:!1,status:409,code:"TASK_PROJECT_MISMATCH",field:"expectedProject",error:"expectedProject does not match the current task project; read the task and reconsider the request"};if(c.expectedRevision!==(0,g.d4)(p))return{ok:!1,status:409,code:"TASK_REVISION_MISMATCH",field:"expectedRevision",error:"expectedRevision is stale; read the task and reconsider the request"}}let z={};if(Object.hasOwn(c,"text")){let b=r(c.text);if(!b)return{ok:!1,error:"task text is required",status:400};if(b.length>l)return x();z.text=b,a[m].origin?.refinement==="pending"&&b!==a[m].text&&(z.origin={...a[m].origin,refinement:"titled"})}if(Object.hasOwn(c,"details")){let a=y(c.details);if(!a.ok)return a;z.details=a.details}if(Object.hasOwn(c,"status")){let a="inbox"===(f=c.status)||"assigned"===f||"blocked"===f||"done"===f?f:null;if(!a)return{ok:!1,error:"invalid task status",status:400};z.status=a}if(Object.hasOwn(c,"pos")){let a=t(c.pos);if(!a)return s(c.pos);z.pos=a,z.placement="pinned"}if(Object.hasOwn(c,"board")){let b=u(c.board);if(!b)return{ok:!1,error:"invalid board visibility",status:400,code:"TASK_INVALID_FIELD",field:"board"};let d=e.hasBoardMembers??(()=>!1);if("shown"===b&&!(0,i.d4)(p,d(p))&&(0,i.Qi)(a,p.project,d)>=o)return q("board");z.board=b}if(Object.hasOwn(c,"color")){let a="none"===(k=c.color)||"string"==typeof k&&n.includes(k)?k:null;if(!a)return{ok:!1,error:`color must be one of none, ${n.join(", ")}`,status:400,code:"TASK_INVALID_FIELD",field:"color"};z.color="none"===a?void 0:a}if(Object.hasOwn(c,"hide")){if(!0!==c.hide&&!1!==c.hide)return{ok:!1,error:"hide must be true or false",status:400,code:"TASK_INVALID_FIELD",field:"hide"};if(c.hide){let a=e.seatHolding?e.seatHolding(p):"unknown";if("holds"===a)return{ok:!1,status:409,code:"TASK_HIDE_PROTECTED",field:"hide",error:"this task holds the project's orchestrator seat conversation, which stays on the board; it cannot be hidden"};if("unknown"===a)return{ok:!1,status:503,code:"TASK_HIDE_UNVERIFIED",field:"hide",error:"the orchestrator seat record could not be read, so the hide was not applied; try again"};z.groupHidden={at:d,by:e.actor??"operator",admitted:(0,j.QE)(p.assignments)}}else z.groupHidden=void 0}if(Object.hasOwn(c,"placement")){let a=v(c.placement);if(!a)return{ok:!1,error:"invalid placement",status:400};if("pinned"===a&&!z.pos&&!p.pos)return{ok:!1,error:"task position is required",status:400,code:"TASK_INVALID_FIELD",field:"pos"};z.placement=a}if(Object.hasOwn(c,"dueAt")||Object.hasOwn(c,"dueTz"))if(null===c.dueAt&&void 0===c.dueTz)z.dueAt=void 0,z.dueTz=void 0;else{let a=w(c.dueAt,c.dueTz);if(!a.ok)return{ok:!1,error:a.error,status:400};z.dueAt=a.dueAt,z.dueTz=a.dueTz}let B=Object.keys(c).every(a=>"color"===a||"hide"===a||"expectedProject"===a||"expectedRevision"===a)&&(Object.hasOwn(c,"color")||Object.hasOwn(c,"hide")),C={...p,...z,updatedAt:B?p.updatedAt:d};Object.hasOwn(z,"dueAt")&&void 0===z.dueAt&&(delete C.dueAt,delete C.dueTz),"unplaced"===C.placement&&delete C.pos,Object.hasOwn(z,"details")&&void 0===z.details&&delete C.details,Object.hasOwn(z,"color")&&void 0===z.color&&delete C.color,Object.hasOwn(z,"groupHidden")&&void 0===z.groupHidden&&delete C.groupHidden;let D=a.slice();return D[m]=C,{ok:!0,tasks:D,task:C}}function B(a,b,c,d,e){let f=a,g=[];for(let a of c){if("failed"===a.state)continue;let c=(0,k.On)(a),h=(0,k.Z1)(a);if(!c||!h||(0,k.v1)(f,c))continue;let i=(0,k.IE)(f,{project:b,origin:h,identity:c},e);if(!i.ok)return i;if(d&&i.taskIds.includes(d))return{ok:!1,error:"this task is the conversation's own membership; link the conversation to another task first or delete the task",status:409};f=i.tasks,g.push(...i.created)}return{ok:!0,tasks:f,replacements:g}}function C(a,b,c={}){let d=a.find(a=>a.id===b);return d?B(a.filter(a=>a.id!==b),d.project,d.assignments,null,c):{ok:!1,error:"task not found",status:404}}function D(a){if(!a||"object"!=typeof a||Array.isArray(a))return null;let b={};return"string"==typeof a.launchId&&a.launchId.trim()&&(b.launchId=a.launchId.trim()),"string"==typeof a.path&&a.path.trim()&&(b.path=a.path.trim()),"string"==typeof a.conversationId&&a.conversationId.trim()&&(b.conversationId=a.conversationId.trim()),"number"==typeof a.panePid&&Number.isInteger(a.panePid)&&a.panePid>0&&(b.panePid=a.panePid),null!=b.launchId||null!=b.conversationId||null!=b.path||null!=b.panePid?b:null}function E(a,b){return null!=b.launchId?a.launchId===b.launchId:null!=b.conversationId?a.conversationId===b.conversationId:null!=b.path?a.path===b.path:null!=b.panePid&&a.panePid===b.panePid}function F(a,b,c,d=(0,h.Ec)(),e={}){let f=a.findIndex(a=>a.id===b);if(f<0)return{ok:!1,error:"task not found",status:404};let g="string"==typeof c?{path:c}:c,i=a[f],j=i.assignments.filter(a=>!E(a,g));if(j.length===i.assignments.length)return{ok:!0,tasks:a,task:i};let k=i.assignments.filter(a=>E(a,g)),l={...i,assignments:j,updatedAt:d},m=a.slice();m[f]=l;let n=B(m,i.project,k,b,{now:()=>d,...e});return n.ok?{ok:!0,tasks:n.tasks,task:l}:n}function G(a,b){return a.find(a=>a.engine===b&&"string"==typeof a.accountId)?.accountId??null}function H(a,b){let c=a.slice();for(let a of b){let b=c.findIndex(b=>a.launchId&&b.launchId?b.launchId===a.launchId:null!==a.path&&b.path===a.path||null===a.path&&null!==a.panePid&&null===b.path&&b.panePid===a.panePid),d=b>=0?c[b]:void 0,e=void 0!==a.launchId?a.launchId:d?.launchId,f=void 0!==a.clientAttemptId?a.clientAttemptId:d?.clientAttemptId,g=void 0!==a.conversationId?a.conversationId:d?.conversationId,h={...void 0!==e?{launchId:e}:{},...void 0!==f?{clientAttemptId:f}:{},path:a.path,...void 0!==g?{conversationId:g}:{},panePid:a.panePid,state:a.state,error:a.error,at:a.at,...void 0!==a.accountId?{accountId:a.accountId}:{},...void 0!==a.engine?{engine:a.engine}:{}};c=b>=0?[...c.slice(0,b),h,...c.slice(b+1)]:[...c,h]}return c}function I(a,b,c,d=(0,h.Ec)()){let e=a.findIndex(a=>a.id===b);if(e<0)return{ok:!1,error:"task not found",status:404};let f=a[e],g=H(f.assignments,c),i=g.some(a=>"delivered"===a.state||"spawning"===a.state||"handoff"===a.state||"linked"===a.state),j=f.status;("inbox"===j||"assigned"===j)&&(j=i?"assigned":"inbox");let k={...f,status:j,assignments:g,updatedAt:d},l=a.slice();return l[e]=k,{ok:!0,tasks:l,task:k}}},36883:(a,b,c)=>{function d(a){let b=new Set;for(let c of a)if("failed"!==c.state){for(let a of[c.clientAttemptId,c.launchId,c.conversationId,c.path].filter(a=>"string"==typeof a&&a.length>0))b.add(a)}return[...b].sort()}function e(a,b){return b.conversationIds.length||b.paths.length?a.find(a=>a.conversationId&&b.conversationIds.includes(a.conversationId)||a.path&&b.paths.includes(a.path))??null:null}c.d(b,{QE:()=>d,VE:()=>e})},58396:(a,b,c)=>{c.d(b,{HR:()=>d,Qi:()=>f,d4:()=>e});let d="emptyTaskBandsHidden";function e(a,b){return"hidden"!==a.board||b}function f(a,b,c){let d=0;for(let f of a)f.project===b&&e(f,c(f))&&(d+=1);return d}}};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";exports.id=7008,exports.ids=[3302,7008],exports.modules={2798:(a,b,c)=>{c.d(b,{Ge:()=>
|
|
1
|
+
"use strict";exports.id=7008,exports.ids=[3302,7008],exports.modules={2798:(a,b,c)=>{c.d(b,{BE:()=>u,Ge:()=>g,L8:()=>f,OT:()=>t,ij:()=>n,rk:()=>r});var d=c(18797),e=c(37664);let f=20;function g(a){return"number"==typeof a&&a<f}let h=`## Initial visible status
|
|
2
2
|
Your first turn after receiving this mandate must produce a visible assistant status in this conversation. For a FRESH seat with no missions, greet in exactly two lines:
|
|
3
3
|
Ready in {project}.
|
|
4
4
|
Tell me what to ship — I open lanes, spawn implementers and reviewers, and merge on APPROVE. Nothing starts until you ask.
|
|
5
|
-
Use the actual project name in place of {project}. For a ROTATION, when work remains, inventory the mandate missions and state your plan in that status. When every rotation mission is already complete, reply exactly: "all mandate missions are complete; standing by". A generic continuation nudge never replaces or suppresses this first visible status.`,
|
|
5
|
+
Use the actual project name in place of {project}. For a ROTATION, when work remains, inventory the mandate missions and state your plan in that status. When every rotation mission is already complete, reply exactly: "all mandate missions are complete; standing by". A generic continuation nudge never replaces or suppresses this first visible status.`,i="## The Viewer's clock — you never schedule yourself",j=`${i}
|
|
6
6
|
The Viewer wakes you. A controller in the release that owns traffic checks this project's seat every few minutes and sends you a wake when something is actually owed: a stage parked, a decision waiting, a lane event landed, a board task nobody started, or the interval elapsing while work is open. It survives your session, your host dying, a Viewer restart and a rotation, because it is durable state rather than a schedule living inside a conversation.
|
|
7
7
|
So do not schedule yourself: no ScheduleWakeup, no CronCreate, no Monitor loop, for self-monitoring or for polling the board. A session schedule dies with the session and takes the monitor with it, which is how every rotation used to silently drop it, and two clocks on one seat means the outgoing one keeps acting after its authority is gone.
|
|
8
8
|
If you are holding a self-schedule right now, cancel it in this turn — the arrival of this mandate is the handover, not a later observation. Delete every recurring job you created (CronDelete on each id CronList returns) and arm no replacement. Do not wait to "see the Viewer's tick work first": while your own schedule keeps your turn open, the Viewer's tick finds you busy and drops its check every time, so the two deadlock and the wake you are waiting for can never arrive. Yours goes first.
|
|
9
|
-
Between wakes you are idle on purpose, and idle is correct: a seat with nothing owed costs nothing. When a wake arrives, act on the items it lists first, then make one bounded pass over the rest of the board — lanes, pull requests, agents, tasks — and act on what stands still, record every outcome where it belongs, and mark a task blocked with the reason when it cannot be done — that is the stop. This paragraph outranks every playbook, skill and checkpoint convention in the checkout: one that still tells you to self-pace with wakeups is out of date, and this governs.`,
|
|
9
|
+
Between wakes you are idle on purpose, and idle is correct: a seat with nothing owed costs nothing. When a wake arrives, act on the items it lists first, then make one bounded pass over the rest of the board — lanes, pull requests, agents, tasks — and act on what stands still, record every outcome where it belongs, and mark a task blocked with the reason when it cannot be done — that is the stop. This paragraph outranks every playbook, skill and checkpoint convention in the checkout: one that still tells you to self-pace with wakeups is out of date, and this governs.`,k="## The task is the unit of work — find it before you launch anything",l=`${k}
|
|
10
10
|
A board task is one PRODUCT OUTCOME. Everything done for that outcome — the diagnosis, the implementer, every reviewer, every retry, the fix round, the release — belongs to that one task. Open a second task only for genuinely separate work: an independent audit, or an investigation asked for on its own.
|
|
11
11
|
|
|
12
12
|
FIND IT BEFORE YOU LAUNCH ANYTHING. Call list_tasks for this project with NO status filter and limit: 200, so blocked and finished work can reach you beside inbox and assigned. That answer is one capped page in creation order (#1725), so a page at the cap was truncated and the NEWEST work is what it dropped: treat it as a lead, never as the whole board. Read the candidates with get_task, get_task any id the operator or a report hands you even when the page did not carry it, and run search_transcripts when their words name work you cannot place. Reuse what you find, and create a task only when nothing you can reach owns this outcome.
|
|
@@ -29,14 +29,14 @@ READ BACK WHAT YOU DID. After a create or a link, call get_pipeline and confirm
|
|
|
29
29
|
|
|
30
30
|
ONE OUTCOME NEVER SHOWS TWO LIVE CLAIMS. When you supersede work — a fresh pipeline after a failure, a fix lane after a review — retire the superseded container only once the outcome is carried by the surviving one and nothing in the old one is still running or unknown. Closing a container is unavailable as a way to hide work that is still owed: say out loud what you are dropping, and mark a task blocked with the reason when it cannot proceed. Never close containers in bulk to tidy the board.
|
|
31
31
|
|
|
32
|
-
RECEIPTS ARE THE RECORD. Every one of these calls is keyed by clientRequestId. A retry of the SAME logical operation reuses its id and replays the original receipt; a new operation gets a new id. When an outcome is unknown, replay the original id and read what the receipt says. Re-issuing it under a fresh id is how one outcome ends up with two pipelines and two cards.`,
|
|
32
|
+
RECEIPTS ARE THE RECORD. Every one of these calls is keyed by clientRequestId. A retry of the SAME logical operation reuses its id and replays the original receipt; a new operation gets a new id. When an outcome is unknown, replay the original id and read what the receipt says. Re-issuing it under a fresh id is how one outcome ends up with two pipelines and two cards.`,m=`## Deploys
|
|
33
33
|
YOU decide when to deploy, and you execute it yourself. Your authority is your designated seat, attributed server-side — a session that is not the designated orchestrator is refused, and a seat acts only for its own project. Nobody — you included — ever asks the user to confirm, approve, repeat, or say a commit hash. There is no confirmation step for the user, anywhere; deploys reach the user through your reports.
|
|
34
34
|
1. Prepare: merges landed on origin/main, gates green. Never deploy red.
|
|
35
35
|
2. Resolve origin/main to a full 40-hex commit SHA yourself and verify it contains what you shipped. The SHA is machine evidence — never route it through the user.
|
|
36
36
|
3. Call deploy_exact_sha with revision=<sha>. Deployments serialize (a busy receipt means one is already running); a retry reuses the same clientRequestId and replays the original receipt.
|
|
37
|
-
4. Report the outcome as a bridge report (completed/failed) — a statement of fact, never a question. The deployment ledger is the durable audit of what shipped and when.`,
|
|
37
|
+
4. Report the outcome as a bridge report (completed/failed) — a statement of fact, never a question. The deployment ledger is the durable audit of what shipped and when.`,n=`You are the viewer's built-in Manager (issues #182, #691) — the agent that owns the board and runs the whole conveyor through the viewer's own HTTP API and MCP tools. You never act outside them.
|
|
38
38
|
|
|
39
|
-
${
|
|
39
|
+
${h}
|
|
40
40
|
|
|
41
41
|
## Two channels to the operator
|
|
42
42
|
The operator talks to whoever they want, you included. When they write in your own conversation, answer them there — directly, plainly, helpfully, in your own voice, at whatever length the question deserves. That channel is sanctioned and first-class: what you write in it reaches them, and a question they put to you is yours to answer.
|
|
@@ -69,7 +69,7 @@ intent "show" frames and highlights the card; intent "open" also opens it. A rej
|
|
|
69
69
|
Call suggest_replies after EVERY message of yours that asks the operator something or proposes a course of action — a question, a choice between options, a plan you want a yes to, a status that ends in "shall I". Offer 2–4 short, distinct drafts, each one a message they could send as-is: the plain yes, the narrowed yes, the "hold — explain X first". Write them in the operator's own language, the one they are writing to you in.
|
|
70
70
|
They render as pills under your message and land in their composer on a tap, editable before sending — the viewer never sends one, so a draft is an offer and never a decision, and never a substitute for asking clearly in the message itself. The newest set replaces your previous one for that conversation, and their next message clears it: offer a fresh set with each new ask, and never re-offer drafts to something they already answered. A message that asks nothing needs no drafts.
|
|
71
71
|
|
|
72
|
-
${
|
|
72
|
+
${j}
|
|
73
73
|
|
|
74
74
|
## Search prior conversations before deciding
|
|
75
75
|
Much of what you will meet has been met before, and the Viewer indexes every user and assistant message of every conversation on this machine, across both engines and all accounts. At the start of any non-trivial task, and whenever a problem, failure or unknown appears, run several search_transcripts queries — 3 to 5, in different phrasings: the error text, the subsystem, the symptom, the file or tool involved — scoped to the project first, then unscoped. A snippet is only a pointer: open the hit through conversation_messages at its transcript path (its timestamp as since; the transcript path and byte offset pin the exact line) and read the turns around it before choosing an approach. Cite what you found, by conversation title and date, in the plan or spec you hand on, or state that nothing relevant existed. Check an old answer against current main before you build on it; the code has usually moved since.
|
|
@@ -80,12 +80,12 @@ Decide yourself whatever the code, the running system or one cheap observation c
|
|
|
80
80
|
- When a stage parks on such a question, bring it to the operator in chat at once, with suggested replies.
|
|
81
81
|
- After a deploy, check the operator-visible result on prod before you mark the task done.
|
|
82
82
|
|
|
83
|
-
${
|
|
83
|
+
${l}
|
|
84
84
|
|
|
85
85
|
## Conveyor rules
|
|
86
86
|
Drive every accepted piece of work through: GitHub issue -> worktree lane -> implementer agent -> review flow -> merge bar -> this project's own release step, where it has one -> cleanup.
|
|
87
87
|
- One lane (worktree + branch) per issue; one owner per file across active worktrees.
|
|
88
|
-
- Spawn implementers via POST /api/spawn with title = a semantic task name, taskId = the outcome's board task, src = YOUR transcript path (lineage draws the diagram edges), and role per the role table; workers end with "REVIEW_READY: <PR url>".
|
|
88
|
+
- Spawn implementers via POST /api/spawn with title = a semantic task name, taskId = the outcome's board task, src = YOUR transcript path (lineage draws the diagram edges), and role per the role table at the end of this mandate; workers end with "REVIEW_READY: <PR url>".
|
|
89
89
|
- Reviews run as flows (POST /api/flows) or fresh reviewer spawns (role: "reviewer", reviews: <implementer ref>, taskId) — a fresh reviewer every round, verdict contract "VERDICT: APPROVE|REQUEST_CHANGES".
|
|
90
90
|
- Merge bar: merge only on an APPROVE verdict with green gates (tsc + tests), after reading the PR body. Never merge red; a PR that calls a premise unverified, assumed or synthetic goes to the operator.
|
|
91
91
|
- Keep the outcome's ONE task card updated via /api/tasks; pipelines and spawns for it carry its id at launch. Report state changes as bridge reports.
|
|
@@ -100,25 +100,27 @@ When the operator asks for work, assess complexity, compose stages/roles, POST /
|
|
|
100
100
|
- Operate exclusively through the viewer API and MCP tools (spawn, flows, pipelines, tasks, files, agent/snapshot, conversation-host). No direct process or runtime manipulation.
|
|
101
101
|
- If this checkout carries an llv-conveyor skill, it is your playbook, subordinate to this mandate wherever the two disagree; otherwise the conveyor rules above are the playbook.
|
|
102
102
|
- Replacing manual spawns is a non-goal: the user's own agents keep working; you coordinate, you do not take over.
|
|
103
|
-
- Re-derive board state per turn from bounded snapshots rather than accumulating it in context.`,
|
|
103
|
+
- Re-derive board state per turn from bounded snapshots rather than accumulating it in context.`,o="## Role table — what a stage runs when you name no runtime";function p(a){return`${a.engine}/${a.model}/${a.effort}`}function q(a){let b=a.capabilities.includes("read-only")?"read-only":"read-write",c="builder"===a.id?` domain=frontend runs ${p(e.C)}; mode=apply-fixes runs ${p(e.i)}.`:"";return`| ${a.id} | ${a.config.engine} | ${a.config.model} | ${a.config.effort} | ${b} | ${a.description}${c} |`}function r(a){return[o,"Read from this install's role registry when this mandate was delivered. A stage or spawn that omits engine, model and effort runs exactly its role's row.","| role | engine | model | effort | access | for |","| --- | --- | --- | --- | --- | --- |",...a.map(q),"- Runtime overrides (engine, model, effort, access) go on the stage beside role, never inside it. A review-loop stage is always read-only.","- Choose effort deliberately: low or medium for routine, read-only or mechanical work; keep high and xhigh for work that needs them.","- Set the runtime at creation. override-stage binds from the NEXT attempt (pending-next-attempt): an attempt already running keeps the runtime it started with.","- create_pipeline's answer lists each stage's resolved engine, model and effort. Read it back and correct a wrong runtime before attempt 1 spends quota: create a draft, or pause, override-stage, then start."].join("\n")}let s=[{marker:k,directive:l},{marker:i,directive:j},{marker:h,directive:h}];function t(a,b=d.W){return u(a,r(b))}function u(a,b){let c=a.split(`
|
|
104
|
+
|
|
105
|
+
${m}`).join("").split(m).join(""),d=s.reduce((a,{marker:b,directive:c})=>a.includes(b)?a:`${a}
|
|
104
106
|
|
|
105
|
-
${
|
|
107
|
+
${c}`,function a(b){let c=b.indexOf(o);if(c<0)return b;let d=b.indexOf("\n\n",c),e=b.slice(0,c).replace(/\n\n$/,""),f=d<0?"":b.slice(d);return a(e?e+f:f.replace(/^\n\n/,""))}(c));return null===b?d:`${d}
|
|
106
108
|
|
|
107
|
-
${
|
|
108
|
-
${b}`]:[],[
|
|
109
|
-
${d}`]:[]].join("\n\n")].join("\n\n")}function
|
|
109
|
+
${b}`}},33302:(a,b,c)=>{c.d(b,{NZ:()=>r,OE:()=>m,Tj:()=>u,Yd:()=>t,kg:()=>s,mn:()=>n});var d=c(77598),e=c.n(d),f=c(10781),g=c(89937),h=c(4012);let i=/^[A-Za-z0-9_-]{43}$/,j="x-llv-internal-service",k=/^[a-f0-9]{64}$/,l=["monitor","mcp","orchestrator"];function m(a){let b,c=a.headers.get(h.VIEWER_SPAWN_CAPABILITY_HEADER)?.trim()??"";return c&&i.test(c)?(b=e().createHash("sha256").update(c).digest("hex"),(0,f.agentRegistry)().conversationIdForSpawnCapabilityDigest(b)):null}function n(a){return null===m(a)}let o={ok:!1,status:403,error:"this is an operator-only action; an agent may not perform it, whatever role it holds"},p={ok:!1,status:403,error:"background Viewer activity is outside direct operator activity"};function q(a){return e().createHmac("sha256",(0,g.ensureOperatorSpawnCapability)()).update(`llv-internal-service-v1\0${a}`).digest("hex")}function r(a){return{[j]:`${a}.${q(a)}`}}function s(a){return"valid"===function(a){let b=a.headers.get(j)?.trim()??"";if(!b)return"absent";let c=b.indexOf("."),d=b.slice(0,c),f=b.slice(c+1);if(!l.includes(d)||!k.test(f))return"invalid";try{let a=q(d);return e().timingSafeEqual(Buffer.from(f),Buffer.from(a))?"valid":"invalid"}catch{return"invalid"}}(a)?p:u(a)}function t(a){let b=m(a);return b?{kind:"agent",conversationId:b}:{kind:"operator",conversationId:null}}function u(a){return m(a)?o:{ok:!0}}},47008:(a,b,c)=>{c.d(b,{CX:()=>ak,eV:()=>an,reconcileActiveOrchestratorSeat:()=>ah});var d=c(73024),e=c.n(d),f=c(22962),g=c(74382),h=c(10781),i=c(89937),j=c(4837),k=c(33302),l=c(4012),m=c(10167),n=c(50201),o=c(11149),p=c(70107),q=c(89333),r=c(74127),s=c(38840),t=c(89822),u=c(41022),v=c(30795),w=c(23784),x=c(76760),y=c.n(x),z=c(91724),A=c(56809),B=c(2798);let C="## Handoff from your predecessor (rotation)",D="## Rotation history",E=" …[truncated]";function F(a){return Buffer.byteLength(a,"utf8")}function G(a,b){if(F(a)<=b)return{value:a,truncated:!1,codePoints:[...a].length};let c=F(E),d=0,e=0,f="";for(let g of a){let a=F(g);if(d+a+c>b)break;f+=g,d+=a,e+=1}return f?{value:`${f}${E}`,truncated:!0,codePoints:e}:{value:"",truncated:!0,codePoints:0}}function H(a){return a.replace(/\r\n?/g,"\n")}function I(a){return H(a).replace(/^#{1,6}[ \t]+/gm,"- ")}function J(a,b,c,d){return[a,...b?[`${D}
|
|
110
|
+
${b}`]:[],[C,...c.header,...c.tasks?[c.tasks]:[],...d?[`Notes from the caller:
|
|
111
|
+
${d}`]:[]].join("\n\n")].join("\n\n")}function K(a,b){if("existing"===a)return 0;let c=(0,s.s8)({role:"orchestrator",roleParams:b??{mode:"standard"}});return c.ok&&c.value?F(c.value.scaffold)+2:0}function L(a){return{error:`mandate is too large to deliver: ${a.bytes} bytes of mandate plus ${a.overhead} bytes of launch overhead exceeds the ${a.bound}-byte structured envelope by ${a.excess} bytes; shorten the mandate by at least ${a.excess} bytes`,code:"mandate_too_large",bytes:a.bytes,overhead:a.overhead,bound:a.bound,excess:a.excess}}let M={resolveAccount:async a=>{let{accountManager:b}=await Promise.resolve().then(c.bind(c,26926));return b.resolveHeadlessSpawn("codex",null,[],a)},run:async a=>{let{runHeadlessCodexOnce:b}=await Promise.resolve().then(c.bind(c,51906));return await b(a)},readPredecessorReport:(a,b)=>(function(a,b){let c,d=null;try{d=e().openSync(a,e().constants.O_RDONLY|e().constants.O_NOFOLLOW);let b=e().fstatSync(d);if(!b.isFile())return null;let f=e().lstatSync(a);if(!f.isFile()||f.dev!==b.dev||f.ino!==b.ino)return null;let g=Math.max(0,b.size-262144),h=Buffer.alloc(b.size-g);e().readSync(d,h,0,h.length,g),c=h.toString("utf8"),g>0&&(c=c.slice(c.indexOf("\n")+1))}catch{return null}finally{null!==d&&e().closeSync(d)}let f=c.split("\n");for(let a=f.length-1;a>=0;a-=1){let c;try{let b=JSON.parse(f[a]);if(!b||"object"!=typeof b||Array.isArray(b))continue;c=b}catch{continue}let d="claude"===b?function(a){if("assistant"!==a.type)return null;let b=a.message;if(!b||"object"!=typeof b||Array.isArray(b))return null;let c=b.content;return"string"==typeof c?c:Array.isArray(c)?c.flatMap(a=>a&&"object"==typeof a&&!Array.isArray(a)&&"text"===a.type&&"string"==typeof a.text?[a.text]:[]).join("\n"):null}(c):function(a){let b=a.payload;return!b||"object"!=typeof b||Array.isArray(b)?null:"agent_message"===b.type&&"string"==typeof b.message?b.message:null}(c);if(d?.trim())return G(d.trim(),6e3).value||null}return null})(a,b)},N=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,O=/\b((?:github|gitlab)\.com\/|bitbucket\.org\/)[A-Za-z0-9][A-Za-z0-9-]{0,38}/gi,P=/(^|[^A-Za-z0-9_@/])@[A-Za-z0-9][A-Za-z0-9._-]{1,38}/g,Q=/~\/[^\s"'`)\],;]*/g,R=/(?<![A-Za-z0-9_~:/])\/(?:home|Users|root|tmp|var|etc|opt|srv|mnt|media|app|workspace|private|data|usr|proc|dev)\/[^\s"'`)\],;]*/g,S=/(?<![A-Za-z0-9_~:/])\/[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+\/[^\s"'`)\],;]*/g,T=/\b(?:conversation|session|launch|thread|run|acct|account|agent)_(?=[A-Za-z0-9-]*\d)[A-Za-z0-9-]{6,}\b/gi,U=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;function V(a){return(0,A.j)(a).replace(N,"[redacted-email]").replace(O,"$1[redacted-handle]").replace(P,"$1[redacted-handle]").replace(Q,"[redacted-path]").replace(R,"[redacted-path]").replace(S,"[redacted-path]").replace(T,"[redacted-id]").replace(U,"[redacted-id]")}let W=`You are compacting the rotation history of a project manager agent's mandate. Write a digest of the material below for the manager's successor. Use exactly these three headings and short bullet points under each:
|
|
110
112
|
|
|
111
113
|
Decisions:
|
|
112
114
|
Blockers:
|
|
113
115
|
In flight:
|
|
114
116
|
|
|
115
|
-
Rules: at most 3500 bytes in total. Keep only what the successor needs to act: decisions already made, blockers still open, and work in flight with its current state. Never include names, account handles, email addresses, tokens, or file paths. Do not use Markdown headings starting with "#". Do not run commands or read files; everything you need is below. Output the digest only — no preamble, no closing remarks.`;async function
|
|
117
|
+
Rules: at most 3500 bytes in total. Keep only what the successor needs to act: decisions already made, blockers still open, and work in flight with its current state. Never include names, account handles, email addresses, tokens, or file paths. Do not use Markdown headings starting with "#". Do not run commands or read files; everything you need is below. Output the digest only — no preamble, no closing remarks.`;async function X(a,b=M){let c=await b.resolveAccount(a.project);if("exhausted"===c.kind)return{kind:"fallback",reason:"exhausted"};if("available"!==c.kind)return{kind:"fallback",reason:"unavailable"};let d=a.predecessor?b.readPredecessorReport(a.predecessor.path,a.predecessor.engine):null,f=(0,z.BQ)("orchestrator","handoff-digests",a.clientRequestId);try{let e=await b.run({key:`orchestrator-handoff:${a.clientRequestId}`,cwd:y().join(f,"cwd"),prompt:function(a,b){let c=a.priorHistory?V(a.priorHistory).trim():null,d=b?V(b).trim():null,e=a.priorHandoffs.map(a=>V(a).trim()).filter(Boolean),f=F(c??"")+F(d??"")+e.reduce((a,b)=>a+F(b),0),g=0;for(;g<e.length&&f>48e3;)f-=F(e[g]),g+=1;let h=e.slice(g);return[W,`=== Previous rotation history ===
|
|
116
118
|
${c??"(none)"}`,`=== Earlier handoffs, oldest first ===
|
|
117
119
|
${h.length?h.map((a,b)=>`--- handoff ${b+1} ---
|
|
118
120
|
${a}`).join("\n\n"):"(none)"}`,`=== Predecessor's last report ===
|
|
119
|
-
${d??"(unavailable)"}`].join("\n\n")}(a,d),model:j.Ze,effort:"low",account:"codex"===c.account.engine?{home:c.account.home,managed:"managed"===c.account.kind}:null,artifactDir:f,timeoutMs:75e3,sandbox:"read-only"});if("timeout"===e.status)return{kind:"fallback",reason:"timeout"};if("done"!==e.status)return{kind:"fallback",reason:"failed"};let g=U(e.finalOutput).trim();if(!g)return{kind:"fallback",reason:"empty"};if(E(g)>4096)return{kind:"fallback",reason:"over_budget"};let h=H(g).trim();return h?{kind:"digest",text:h}:{kind:"fallback",reason:"empty"}}finally{e().rmSync(f,{recursive:!0,force:!0})}}var X=c(15408);let Y={spawn:async function(a){let{executeSpawnRequest:b}=await Promise.all([c.e(1849),c.e(7238),c.e(7722)]).then(c.bind(c,67722)),d={headers:new Headers({host:"127.0.0.1",...(0,k.NZ)("orchestrator"),[l.VIEWER_SPAWN_CAPABILITY_HEADER]:(0,i.ensureOperatorSpawnCapability)()}),json:async()=>a},e=await b(d);return{status:e.status,body:await e.json()}},deliver:async function(a){if((0,n.cM)()){let{enqueueStructuredMessage:b}=await Promise.resolve().then(c.bind(c,34083)),d=await b({path:a.path??"",conversationId:a.conversationId,clientMessageId:a.clientMessageId,text:a.text,images:[]});if(d)return d.ok?{ok:!0,outcome:"outcome"in d&&"string"==typeof d.outcome?d.outcome:"delivered"}:{ok:!1,error:d.error}}let b=await (0,m.Ku)({pid:null,path:a.path??"",conversationId:a.conversationId,clientMessageId:a.clientMessageId,text:a.text,images:[]});return b.ok?{ok:!0,outcome:b.outcome??"delivered"}:{ok:!1,error:b.error}},conversationTarget:a=>{let b=(0,h.agentRegistry)().conversation(a);if(!b)return null;if(b.supersededBy)return{kind:"ineligible",code:"conversation_ineligible",error:"conversation is superseded"};let c=b.generations.at(-1),d=c?.path?.trim();if(!d||!e().existsSync(d))return{kind:"ineligible",code:"missing_transcript",error:"conversation transcript is unavailable"};let f=c?.launchProfile?.cwd?.trim();if(!f||!e().existsSync(f)||!e().statSync(f).isDirectory())return{kind:"ineligible",code:"invalid_cwd",error:"conversation cwd is unavailable"};let g=b.projectOwnership?.project??(0,p.hY)(f);return g?{kind:"eligible",conversationId:b.id,path:d,cwd:f,project:(0,X.canonicalOrchestratorProject)(g),engine:b.engine,model:c?.launchProfile.model?.trim()||(0,j.Gh)(b.engine)}:{kind:"ineligible",code:"missing_project",error:"conversation project is unavailable"}},projectTasks:a=>(0,v.h6)().filter(b=>b.project===a&&"done"!==b.status).map(a=>({id:a.id,status:a.status,text:a.text})),summarizeHandoffs:a=>W(a),launchSettlement:({launchId:a,clientRequestId:b})=>{let c=(0,h.agentRegistry)(),d=c.spawnReceiptForClientAttempt(b);return!d||a&&d.launchId!==a?{kind:"unknown"}:d.rejection||"failed"===d.state||"conflicted"===d.state?{kind:"failed",error:d.error??d.rejection?.guidance??`spawn receipt is terminally ${d.state}`}:{kind:"settled",conversationId:d.conversationId,path:(0,h.Vt)(c.readOnlySnapshot()).allowsReceipt(d)?d.artifactPath:null,launchId:d.launchId,engine:d.engine,model:d.launchProfile.model}},resolvedConversation:a=>{if(!a)return null;let b=(0,h.agentRegistry)().conversation(a);if(!b)return null;let c=b.generations.at(-1)?.path?.trim();if(!c||!(0,q.EG)(c))return null;let d=b.generations.at(-1)?.launchProfile?.cwd?.trim();return{conversationId:b.id,path:c,holdsTurns:(0,r.x_)(c,b.engine),cwd:d&&function(a){try{return e().statSync(a).isDirectory()}catch{return!1}}(d)?d:null}},runtimeIdentity:a=>{let b=(0,h.agentRegistry)().conversation(a),c=b?b.generations.at(-1)?.launchProfile.model?.trim()||(0,j.Gh)(b.engine):null;return{engine:b?.engine??null,model:c}},stampRegistryIdentity:a=>{(0,h.agentRegistry)().stampOrchestratorSeatIdentity(a)},now:()=>new Date().toISOString()},Z=/^[A-Za-z0-9_-]{8,128}$/;function $(a,b,c){return{status:409,body:{error:`the orchestrator seat for ${a} changed while this rotation composed its handoff (designation epoch ${b} is no longer current); rotate again to hand off from the seated orchestrator`,code:"incumbent_changed",currentSeatEpoch:c?.seatEpoch??null,currentConversationId:c?.conversationId??null}}}function _(a){return"string"==typeof a?a.trim():""}function aa(a){let b=null===a.path&&null!==a.intent.launchId;return{status:200,body:{ok:!0,replayed:!0,state:a.path?"settled":b?"accepted":"starting",accepted:b,conversationId:a.conversationId,path:a.path,launchId:a.intent.launchId,seat:a}}}function ab(a){return{status:409,body:{error:"an orchestrator seat transition is already in progress for this project",code:"seat_intent_in_progress",seat:a}}}async function ac(a,b){let c=null,d=(0,f.oV)(()=>{let d=(0,X.completeOrchestratorSeatIntent)({project:a.project,clientRequestId:a.clientRequestId,conversationId:a.conversationId,path:a.path,launchId:a.launchId,engine:a.engine,model:a.model,now:b.now()});return"missing"!==d.kind&&(c=ad(d.seat,b)),d});return"missing"===d.kind?null:{seat:c??d.seat}}function ad(a,b){if(!a.conversationId)throw Error("active orchestrator seat is missing its conversation identity");let c=a.engine&&a.model?{engine:null,model:null}:b.runtimeIdentity(a.conversationId),d=(0,X.repairOrchestratorSeatRuntimeIdentity)({project:a.project,conversationId:a.conversationId,engine:c.engine,model:c.model})??a;return b.stampRegistryIdentity(d),d}function ae(a,b,c){return(0,f.oV)(()=>{let d=(0,X.orchestratorSeatFor)(a).active;return d&&d.intent.clientRequestId===b?ad(d,c):null})}function af(a,b){let c=(0,X.orchestratorSeatFor)(a).active;if(!c?.conversationId||"spawn"!==c.intent.mode||null!==c.path)return null;let d=b.resolvedConversation(c.conversationId);if(d)return(0,X.confirmOrchestratorSeatMaterialization)({project:a,clientRequestId:c.intent.clientRequestId,conversationId:c.conversationId,path:d.path}),null;let e=b.launchSettlement({launchId:c.intent.launchId,clientRequestId:c.intent.clientRequestId});if("failed"!==e.kind)return null;let f=(0,X.abandonStillbornOrchestratorSeat)({project:a,clientRequestId:c.intent.clientRequestId,error:`the accepted launch failed before its conversation became readable: ${e.error}`,now:b.now(),resolvable:a=>null!==b.resolvedConversation(a),restorableSeat:a=>(function(a,b){let c=b.resolvedConversation(a.conversationId);if(!c)return null;let d=b.runtimeIdentity(a.conversationId);return{project:a.stillborn.project,seatEpoch:a.stillborn.seatEpoch,conversationId:c.conversationId,path:c.path,engine:d.engine,model:d.model,runtimeIdentityFrozen:!1,mandate:A.ij,promptVersion:A.L8,predecessorConversationId:null,triggeredBy:null,state:"active",intent:{clientRequestId:`restored-${a.stillborn.intent.clientRequestId}`.slice(0,128),mode:"existing",launchId:null,error:null},designatedAt:a.stillborn.designatedAt,activatedAt:null}})(a,b)});return f&&console.warn(`orchestrator seat for ${a} was rolled back: its accepted launch failed before the conversation became readable (${e.error})`),f}function ag(a,b=Y){return af((0,X.canonicalOrchestratorProject)(a),b)}function ah(a,b){let c=(0,X.orchestratorSeatFor)(a).pending;if(!c||"spawn"!==c.intent.mode||null!==c.intent.error)return null;let d=b.launchSettlement({launchId:c.intent.launchId,clientRequestId:c.intent.clientRequestId});return"settled"===d.kind?ac({project:a,clientRequestId:c.intent.clientRequestId,conversationId:d.conversationId,path:d.path,launchId:d.launchId??c.intent.launchId,...d.engine?{engine:d.engine}:{},...d.model?{model:d.model}:{}},b):("failed"===d.kind&&(0,X.failOrchestratorSeatIntent)(a,c.intent.clientRequestId,d.error,b.now()),null)}async function ai(a,b,c){try{return await c()}catch(j){let c=j instanceof f.gB,d=j instanceof Error?j.message:String(j),e="string"==typeof a.project?(0,g.QK)(a.project):null,h=_(a.clientRequestId),i=null;if(e&&Z.test(h)){let a=(0,X.canonicalOrchestratorProject)(e);try{i=(0,X.failOrchestratorSeatIntent)(a,h,d)}catch{}}return console.error(`orchestrator seat transition failed for ${String(a.project)}: ${d}`),{status:c?503:500,body:{error:d,code:c?"seat_store_busy":b,retryable:c,seat:i?.seat??null}}}}function aj(a,b=Y,c=null){return ai(a,"seat_transition_failed",()=>ak(a,b,c))}async function ak(a,b,c){let d,f,i,j="string"==typeof a.project?(0,g.QK)(a.project):null;if(!j)return{status:400,body:{error:"project must be a valid project key"}};(0,o.n)([(0,o.M)((0,X.canonicalOrchestratorProject)(j),_(a.cwd))]);let k=(0,X.canonicalOrchestratorProject)(j),l="string"==typeof a.mandate?a.mandate:"";if(!l.trim())return{status:400,body:{error:"mandate is required"}};let m=_(a.clientRequestId);if(!Z.test(m))return{status:400,body:{error:"clientRequestId must be 8-128 URL-safe characters"}};let n=_(a.conversationId);if(n&&!n.startsWith("conversation_"))return{status:400,body:{error:"conversationId is invalid"}};let p="number"==typeof a.promptVersion&&Number.isInteger(a.promptVersion)?a.promptVersion:null,q=(d=J(n?"existing":"spawn",a.roleParams),(i=(f=E((0,A.OT)(l)))+d-t.N0)>0?{ok:!1,bytes:f,overhead:d,bound:t.N0,excess:i}:{ok:!0,bytes:f,overhead:d});if(!q.ok)return{status:413,body:K(q)};af(k,b);let r=ah(k,b);r&&await r;let v=ae(k,m,b);if(v)return aa(v);let w="number"==typeof a.expectedIncumbentSeatEpoch?a.expectedIncumbentSeatEpoch:null;if(null!==w){let a=(0,X.orchestratorSeatFor)(k).active;if(!a||a.seatEpoch!==w)return $(k,w,a)}if(n){let a=b.conversationTarget(n);if(!a)return{status:404,body:{error:"conversation is unknown to the registry"}};if("ineligible"===a.kind)return{status:409,body:{error:a.error,code:a.code}};if(a.project!==k)return{status:409,body:{error:"conversation belongs to a different project",code:"project_mismatch"}};let d=(0,X.beginOrchestratorSeatIntent)({project:k,mandate:l,clientRequestId:m,mode:"existing",conversationId:a.conversationId,engine:a.engine??null,model:a.model??null,promptVersion:p,triggeredBy:c,now:b.now()});if("completed"===d.kind){let a=ae(k,m,b);return a?aa(a):{status:409,body:{error:"seat intent was superseded by a newer designation"}}}if("in_progress"===d.kind)return ab(d.seat);let e="replay"===d.kind?b.conversationTarget(d.seat.conversationId??""):a;if(!e||"ineligible"===e.kind||e.project!==k){let a="the pending adoption target is no longer eligible",c=(0,X.failOrchestratorSeatIntent)(k,m,a,b.now());return{status:409,body:{error:a,code:"adoption_target_unavailable",seat:c?.seat??null}}}let f=await b.deliver({conversationId:e.conversationId,path:e.path,clientMessageId:`orchmandate_${m}`,text:(0,A.OT)("replay"===d.kind?d.seat.mandate:l)});if(!f.ok){let a=f.error??"mandate delivery failed",c=(0,X.failOrchestratorSeatIntent)(k,m,a,b.now());return{status:502,body:{error:a,code:"mandate_delivery_failed",seat:c?.seat??null}}}let g=await ac({project:k,clientRequestId:m,conversationId:e.conversationId,path:e.path},b);return g?{status:200,body:{ok:!0,state:"settled",conversationId:e.conversationId,path:e.path,delivery:f.outcome??"delivered",seat:g.seat}}:{status:409,body:{error:"seat intent was superseded by a newer designation"}}}let x=(0,X.orchestratorSeatFor)(k).active;if(x&&x.intent.clientRequestId!==m&&!0!==a.replaceIncumbent)return{status:409,body:{error:`an orchestrator is already designated for ${k}; use rotate_orchestrator for an explicit handoff, or pass replaceIncumbent: true to replace deliberately`,code:"already_designated",incumbentSeatEpoch:x.seatEpoch}};let y=(0,s.s8)({role:"orchestrator",roleParams:a.roleParams,engine:a.engine,model:a.model,effort:a.effort});if(!y.ok||!y.value)return{status:400,body:{error:y.ok?"orchestrator runtime is unavailable":y.error}};let z=(0,X.beginOrchestratorSeatIntent)({project:k,mandate:l,clientRequestId:m,mode:"spawn",engine:y.value.config.engine,model:y.value.config.model,promptVersion:p,triggeredBy:c,now:b.now()});if("completed"===z.kind){let a=ae(k,m,b);return a?aa(a):{status:409,body:{error:"seat intent was superseded by a newer designation"}}}if("in_progress"===z.kind)return ab(z.seat);if("replay"===z.kind&&!0!==z.seat.runtimeIdentityFrozen){let a="legacy pending orchestrator runtime identity is unavailable; retry the designation with a new clientRequestId",c=(0,X.failOrchestratorSeatIntent)(k,m,a,b.now());return{status:409,body:{error:a,code:"legacy_runtime_identity_unavailable",seat:c?.seat??null}}}let B=(0,A.OT)("replay"===z.kind?z.seat.mandate:l),C="replay"===z.kind?{...z.seat.engine?{engine:z.seat.engine}:{},...z.seat.model?{model:z.seat.model}:{}}:{engine:y.value.config.engine,model:y.value.config.model},D=function(a,b){if("string"==typeof b&&b.trim())return b.trim();let c=process.env.LLV_ORCHESTRATOR_CWD?.trim();if(c)return c;let d=a=>{if(!a)return!1;try{return e().statSync(a).isDirectory()}catch{return!1}};for(let b of Object.values((0,h.agentRegistry)().readOnlySnapshot().conversations).filter(b=>b.projectOwnership?.project===a||b.generations.some(b=>b.launchProfile?.project===a)).sort((a,b)=>(b.updatedAt??"").localeCompare(a.updatedAt??"")))for(let a=b.generations.length-1;a>=0;a-=1){let c=b.generations[a]?.launchProfile?.cwd;if(d(c))return c}return null}(k,a.cwd);if(!D){let a=(0,X.failOrchestratorSeatIntent)(k,m,"orchestrator cwd could not be resolved",b.now());return{status:400,body:{error:"orchestrator cwd could not be resolved — pass cwd explicitly or set LLV_ORCHESTRATOR_CWD",code:"cwd_unresolved",seat:a?.seat??null}}}let F={...Object.fromEntries(["cwd","effort","fast","accountId","images","roleParams","allowSubagents"].flatMap(b=>void 0===a[b]?[]:[[b,a[b]]])),...C,role:"orchestrator",roleParams:a.roleParams??{mode:"standard"},project:k,cwd:D,prompt:B,title:(0,u.bF)("orchestrator",B,k),clientAttemptId:m},G=await b.spawn(F),H=_(G.body.conversationId),I=G.status>=200&&G.status<300&&!1!==G.body.ok,L=_(G.body.launchId),M=I&&202===G.status&&!!H&&!!L;if(!(I&&!1!==G.body.launched&&H)&&!M){let a=_(G.body.error)||(I?H?"spawn did not report an accepted launch":"spawn response omitted conversationId":`spawn was rejected with HTTP status ${G.status}`),c=(0,X.failOrchestratorSeatIntent)(k,m,a,b.now());return{status:G.status,body:{...G.body,seat:c?.seat??null}}}let N=await ac({project:k,clientRequestId:m,conversationId:H,path:"string"==typeof G.body.path?G.body.path:null,launchId:L||null,engine:y.value.config.engine,model:y.value.config.model},b);return N?{status:G.status,body:{...G.body,...M?{accepted:!0,state:"accepted"}:{},seat:N.seat}}:{status:409,body:{error:"seat intent was superseded by a newer designation"}}}function al(a){return`conversation_messages({"clientRequestId":"rotation-predecessor-recent-turns-${a}","conversationId":"${a}","roles":["user","assistant"],"limit":40})`}function am(a,b,c=Y){return function(a,b=Y,c=null){return ai(a,"rotation_failed",()=>an(a,b,c))}(b,c,(0,k.Yd)(a))}async function an(a,b,c){var d,e;let f,h,i=c?(h=c.conversationId?(0,X.activeOrchestratorSeats)().find(a=>a.conversationId===c.conversationId):void 0,{kind:c.kind,conversationId:c.conversationId,seatEpoch:h?.seatEpoch??null}):null,j="string"==typeof a.project?(0,g.QK)(a.project):null;if(!j)return{status:400,body:{error:"project must be a valid project key"}};let k=(0,X.canonicalOrchestratorProject)(j),l=_(a.clientRequestId);if(!Z.test(l))return{status:400,body:{error:"clientRequestId must be 8-128 URL-safe characters"}};let m=af(k,b),n=m?{rolledBack:{conversationId:m.terminalized.seat.conversationId,seatEpoch:m.terminalized.seat.seatEpoch,error:m.terminalized.seat.intent.error,terminalizedAt:m.terminalized.terminalizedAt,restoredConversationId:m.restored?.conversationId??null}}:{},o=ah(k,b);o&&await o;let p=(0,X.orchestratorSeatFor)(k).active;if(!p?.conversationId)return{status:409,body:{error:"no orchestrator is designated for this project — use create_orchestrator instead of rotating",code:"no_incumbent",...n}};let q=b.conversationTarget(p.conversationId),r=q?.kind==="eligible"?q:null,s=function(a,b,c){let d=a=>{if(!a)return null;let b=c.resolvedConversation(a);return b?.holdsTurns?{conversationId:b.conversationId,cwd:b.cwd}:null},e=d(b.conversationId);if(e)return e;let f=(0,X.orchestratorRevocations)().filter(b=>b.project===a),g=new Set([b.conversationId??""]),h=b.conversationId;for(let a=0;a<8&&h;a+=1){let a=[...f].reverse().find(a=>a.successorConversationId===h),b=a?.conversationId??null;if(!b||g.has(b))break;g.add(b),h=b;let c=d(b);if(c)return c}return null}(k,p,b),t=b.projectTasks(k).slice(0,12),u=_(a.handoffNotes).slice(0,2e3),v={header:[`You are replacing orchestrator conversation ${p.conversationId} for project ${k}. Its manager authority is revoked; its session and card remain on the board, linked to yours.`,...s?[s.conversationId===p.conversationId?`Your predecessor's recent turns — decisions, blockers, in-flight work — are one call away: ${al(s.conversationId)}. Records are newest first; pass the returned cursor with a fresh clientRequestId for each older page. Read them before acting, and never open the transcript file. If the call reports that the conversation has no transcript, reconstruct state from the board.`:`The seat you are replacing holds no readable turns, so it is not what you read. The last predecessor in this lineage that does is ${s.conversationId}: ${al(s.conversationId)}. Records are newest first; pass the returned cursor with a fresh clientRequestId for each older page. Read them before acting, and never open the transcript file.`]:["No conversation in this seat's lineage holds readable turns — the seat you are replacing has none, and neither does any predecessor on record. There is no handover transcript to read: reconstruct state from the board tasks below and from the notes in this mandate, and do not go looking for the predecessor's transcript file."]],tasks:t.length?`Open board tasks for this project:
|
|
120
|
-
${t.map(a=>`- [${a.status}] ${a.text.slice(0,140)} (${a.id})`).join("\n")}`:"No open board tasks are recorded for this project.",notes:u||null},w=
|
|
121
|
+
${d??"(unavailable)"}`].join("\n\n")}(a,d),model:j.Ze,effort:"low",account:"codex"===c.account.engine?{home:c.account.home,managed:"managed"===c.account.kind}:null,artifactDir:f,timeoutMs:75e3,sandbox:"read-only"});if("timeout"===e.status)return{kind:"fallback",reason:"timeout"};if("done"!==e.status)return{kind:"fallback",reason:"failed"};let g=V(e.finalOutput).trim();if(!g)return{kind:"fallback",reason:"empty"};if(F(g)>4096)return{kind:"fallback",reason:"over_budget"};let h=I(g).trim();return h?{kind:"digest",text:h}:{kind:"fallback",reason:"empty"}}finally{e().rmSync(f,{recursive:!0,force:!0})}}var Y=c(15408);let Z={spawn:async function(a){let{executeSpawnRequest:b}=await Promise.all([c.e(1849),c.e(7238),c.e(7722)]).then(c.bind(c,67722)),d={headers:new Headers({host:"127.0.0.1",...(0,k.NZ)("orchestrator"),[l.VIEWER_SPAWN_CAPABILITY_HEADER]:(0,i.ensureOperatorSpawnCapability)()}),json:async()=>a},e=await b(d);return{status:e.status,body:await e.json()}},deliver:async function(a){if((0,n.cM)()){let{enqueueStructuredMessage:b}=await Promise.resolve().then(c.bind(c,34083)),d=await b({path:a.path??"",conversationId:a.conversationId,clientMessageId:a.clientMessageId,text:a.text,images:[]});if(d)return d.ok?{ok:!0,outcome:"outcome"in d&&"string"==typeof d.outcome?d.outcome:"delivered"}:{ok:!1,error:d.error}}let b=await (0,m.Ku)({pid:null,path:a.path??"",conversationId:a.conversationId,clientMessageId:a.clientMessageId,text:a.text,images:[]});return b.ok?{ok:!0,outcome:b.outcome??"delivered"}:{ok:!1,error:b.error}},conversationTarget:a=>{let b=(0,h.agentRegistry)().conversation(a);if(!b)return null;if(b.supersededBy)return{kind:"ineligible",code:"conversation_ineligible",error:"conversation is superseded"};let c=b.generations.at(-1),d=c?.path?.trim();if(!d||!e().existsSync(d))return{kind:"ineligible",code:"missing_transcript",error:"conversation transcript is unavailable"};let f=c?.launchProfile?.cwd?.trim();if(!f||!e().existsSync(f)||!e().statSync(f).isDirectory())return{kind:"ineligible",code:"invalid_cwd",error:"conversation cwd is unavailable"};let g=b.projectOwnership?.project??(0,p.hY)(f);return g?{kind:"eligible",conversationId:b.id,path:d,cwd:f,project:(0,Y.canonicalOrchestratorProject)(g),engine:b.engine,model:c?.launchProfile.model?.trim()||(0,j.Gh)(b.engine)}:{kind:"ineligible",code:"missing_project",error:"conversation project is unavailable"}},projectTasks:a=>(0,w.loadTasks)().filter(b=>b.project===a&&"done"!==b.status).map(a=>({id:a.id,status:a.status,text:a.text})),summarizeHandoffs:a=>X(a),launchSettlement:({launchId:a,clientRequestId:b})=>{let c=(0,h.agentRegistry)(),d=c.spawnReceiptForClientAttempt(b);return!d||a&&d.launchId!==a?{kind:"unknown"}:d.rejection||"failed"===d.state||"conflicted"===d.state?{kind:"failed",error:d.error??d.rejection?.guidance??`spawn receipt is terminally ${d.state}`}:{kind:"settled",conversationId:d.conversationId,path:(0,h.Vt)(c.readOnlySnapshot()).allowsReceipt(d)?d.artifactPath:null,launchId:d.launchId,engine:d.engine,model:d.launchProfile.model}},resolvedConversation:a=>{if(!a)return null;let b=(0,h.agentRegistry)().conversation(a);if(!b)return null;let c=b.generations.at(-1)?.path?.trim();if(!c||!(0,q.EG)(c))return null;let d=b.generations.at(-1)?.launchProfile?.cwd?.trim();return{conversationId:b.id,path:c,holdsTurns:(0,r.x_)(c,b.engine),cwd:d&&function(a){try{return e().statSync(a).isDirectory()}catch{return!1}}(d)?d:null}},runtimeIdentity:a=>{let b=(0,h.agentRegistry)().conversation(a),c=b?b.generations.at(-1)?.launchProfile.model?.trim()||(0,j.Gh)(b.engine):null;return{engine:b?.engine??null,model:c}},stampRegistryIdentity:a=>{(0,h.agentRegistry)().stampOrchestratorSeatIdentity(a)},now:()=>new Date().toISOString()},$=/^[A-Za-z0-9_-]{8,128}$/;function _(a,b,c){return{status:409,body:{error:`the orchestrator seat for ${a} changed while this rotation composed its handoff (designation epoch ${b} is no longer current); rotate again to hand off from the seated orchestrator`,code:"incumbent_changed",currentSeatEpoch:c?.seatEpoch??null,currentConversationId:c?.conversationId??null}}}function aa(a){return"string"==typeof a?a.trim():""}function ab(a){let b=null===a.path&&null!==a.intent.launchId;return{status:200,body:{ok:!0,replayed:!0,state:a.path?"settled":b?"accepted":"starting",accepted:b,conversationId:a.conversationId,path:a.path,launchId:a.intent.launchId,seat:a}}}function ac(a){return{status:409,body:{error:"an orchestrator seat transition is already in progress for this project",code:"seat_intent_in_progress",seat:a}}}async function ad(a,b){let c=null,d=(0,f.oV)(()=>{let d=(0,Y.completeOrchestratorSeatIntent)({project:a.project,clientRequestId:a.clientRequestId,conversationId:a.conversationId,path:a.path,launchId:a.launchId,engine:a.engine,model:a.model,now:b.now()});return"missing"!==d.kind&&(c=ae(d.seat,b)),d});return"missing"===d.kind?null:{seat:c??d.seat}}function ae(a,b){if(!a.conversationId)throw Error("active orchestrator seat is missing its conversation identity");let c=a.engine&&a.model?{engine:null,model:null}:b.runtimeIdentity(a.conversationId),d=(0,Y.repairOrchestratorSeatRuntimeIdentity)({project:a.project,conversationId:a.conversationId,engine:c.engine,model:c.model})??a;return b.stampRegistryIdentity(d),d}function af(a,b,c){return(0,f.oV)(()=>{let d=(0,Y.orchestratorSeatFor)(a).active;return d&&d.intent.clientRequestId===b?ae(d,c):null})}function ag(a,b){let c=(0,Y.orchestratorSeatFor)(a).active;if(!c?.conversationId||"spawn"!==c.intent.mode||null!==c.path)return null;let d=b.resolvedConversation(c.conversationId);if(d)return(0,Y.confirmOrchestratorSeatMaterialization)({project:a,clientRequestId:c.intent.clientRequestId,conversationId:c.conversationId,path:d.path}),null;let e=b.launchSettlement({launchId:c.intent.launchId,clientRequestId:c.intent.clientRequestId});if("failed"!==e.kind)return null;let f=(0,Y.abandonStillbornOrchestratorSeat)({project:a,clientRequestId:c.intent.clientRequestId,error:`the accepted launch failed before its conversation became readable: ${e.error}`,now:b.now(),resolvable:a=>null!==b.resolvedConversation(a),restorableSeat:a=>(function(a,b){let c=b.resolvedConversation(a.conversationId);if(!c)return null;let d=b.runtimeIdentity(a.conversationId);return{project:a.stillborn.project,seatEpoch:a.stillborn.seatEpoch,conversationId:c.conversationId,path:c.path,engine:d.engine,model:d.model,runtimeIdentityFrozen:!1,mandate:B.ij,promptVersion:B.L8,predecessorConversationId:null,triggeredBy:null,state:"active",intent:{clientRequestId:`restored-${a.stillborn.intent.clientRequestId}`.slice(0,128),mode:"existing",launchId:null,error:null},designatedAt:a.stillborn.designatedAt,activatedAt:null}})(a,b)});return f&&console.warn(`orchestrator seat for ${a} was rolled back: its accepted launch failed before the conversation became readable (${e.error})`),f}function ah(a,b=Z){return ag((0,Y.canonicalOrchestratorProject)(a),b)}function ai(a,b){let c=(0,Y.orchestratorSeatFor)(a).pending;if(!c||"spawn"!==c.intent.mode||null!==c.intent.error)return null;let d=b.launchSettlement({launchId:c.intent.launchId,clientRequestId:c.intent.clientRequestId});return"settled"===d.kind?ad({project:a,clientRequestId:c.intent.clientRequestId,conversationId:d.conversationId,path:d.path,launchId:d.launchId??c.intent.launchId,...d.engine?{engine:d.engine}:{},...d.model?{model:d.model}:{}},b):("failed"===d.kind&&(0,Y.failOrchestratorSeatIntent)(a,c.intent.clientRequestId,d.error,b.now()),null)}async function aj(a,b,c){try{return await c()}catch(j){let c=j instanceof f.gB,d=j instanceof Error?j.message:String(j),e="string"==typeof a.project?(0,g.QK)(a.project):null,h=aa(a.clientRequestId),i=null;if(e&&$.test(h)){let a=(0,Y.canonicalOrchestratorProject)(e);try{i=(0,Y.failOrchestratorSeatIntent)(a,h,d)}catch{}}return console.error(`orchestrator seat transition failed for ${String(a.project)}: ${d}`),{status:c?503:500,body:{error:d,code:c?"seat_store_busy":b,retryable:c,seat:i?.seat??null}}}}function ak(a,b=Z,c=null){return aj(a,"seat_transition_failed",()=>al(a,b,c))}async function al(a,b,c){let d,f,i,j="string"==typeof a.project?(0,g.QK)(a.project):null;if(!j)return{status:400,body:{error:"project must be a valid project key"}};(0,o.n)([(0,o.M)((0,Y.canonicalOrchestratorProject)(j),aa(a.cwd))]);let k=(0,Y.canonicalOrchestratorProject)(j),l="string"==typeof a.mandate?a.mandate:"";if(!l.trim())return{status:400,body:{error:"mandate is required"}};let m=aa(a.clientRequestId);if(!$.test(m))return{status:400,body:{error:"clientRequestId must be 8-128 URL-safe characters"}};let n=aa(a.conversationId);if(n&&!n.startsWith("conversation_"))return{status:400,body:{error:"conversationId is invalid"}};let p="number"==typeof a.promptVersion&&Number.isInteger(a.promptVersion)?a.promptVersion:null,q=(d=K(n?"existing":"spawn",a.roleParams),(i=(f=F((0,B.OT)(l,(0,t.e3)())))+d-u.N0)>0?{ok:!1,bytes:f,overhead:d,bound:u.N0,excess:i}:{ok:!0,bytes:f,overhead:d});if(!q.ok)return{status:413,body:L(q)};ag(k,b);let r=ai(k,b);r&&await r;let w=af(k,m,b);if(w)return ab(w);let x="number"==typeof a.expectedIncumbentSeatEpoch?a.expectedIncumbentSeatEpoch:null;if(null!==x){let a=(0,Y.orchestratorSeatFor)(k).active;if(!a||a.seatEpoch!==x)return _(k,x,a)}if(n){let a=b.conversationTarget(n);if(!a)return{status:404,body:{error:"conversation is unknown to the registry"}};if("ineligible"===a.kind)return{status:409,body:{error:a.error,code:a.code}};if(a.project!==k)return{status:409,body:{error:"conversation belongs to a different project",code:"project_mismatch"}};let d=(0,Y.beginOrchestratorSeatIntent)({project:k,mandate:l,roleTable:(0,B.rk)((0,t.e3)()),clientRequestId:m,mode:"existing",conversationId:a.conversationId,engine:a.engine??null,model:a.model??null,promptVersion:p,triggeredBy:c,now:b.now()});if("completed"===d.kind){let a=af(k,m,b);return a?ab(a):{status:409,body:{error:"seat intent was superseded by a newer designation"}}}if("in_progress"===d.kind)return ac(d.seat);let e="replay"===d.kind?b.conversationTarget(d.seat.conversationId??""):a;if(!e||"ineligible"===e.kind||e.project!==k){let a="the pending adoption target is no longer eligible",c=(0,Y.failOrchestratorSeatIntent)(k,m,a,b.now());return{status:409,body:{error:a,code:"adoption_target_unavailable",seat:c?.seat??null}}}let f=await b.deliver({conversationId:e.conversationId,path:e.path,clientMessageId:`orchmandate_${m}`,text:(0,B.BE)(d.seat.mandate,d.seat.roleTable??null)});if(!f.ok){let a=f.error??"mandate delivery failed",c=(0,Y.failOrchestratorSeatIntent)(k,m,a,b.now());return{status:502,body:{error:a,code:"mandate_delivery_failed",seat:c?.seat??null}}}let g=await ad({project:k,clientRequestId:m,conversationId:e.conversationId,path:e.path},b);return g?{status:200,body:{ok:!0,state:"settled",conversationId:e.conversationId,path:e.path,delivery:f.outcome??"delivered",seat:g.seat}}:{status:409,body:{error:"seat intent was superseded by a newer designation"}}}let y=(0,Y.orchestratorSeatFor)(k).active;if(y&&y.intent.clientRequestId!==m&&!0!==a.replaceIncumbent)return{status:409,body:{error:`an orchestrator is already designated for ${k}; use rotate_orchestrator for an explicit handoff, or pass replaceIncumbent: true to replace deliberately`,code:"already_designated",incumbentSeatEpoch:y.seatEpoch}};let z=(0,s.s8)({role:"orchestrator",roleParams:a.roleParams,engine:a.engine,model:a.model,effort:a.effort});if(!z.ok||!z.value)return{status:400,body:{error:z.ok?"orchestrator runtime is unavailable":z.error}};let A=(0,Y.beginOrchestratorSeatIntent)({project:k,mandate:l,roleTable:(0,B.rk)((0,t.e3)()),clientRequestId:m,mode:"spawn",engine:z.value.config.engine,model:z.value.config.model,promptVersion:p,triggeredBy:c,now:b.now()});if("completed"===A.kind){let a=af(k,m,b);return a?ab(a):{status:409,body:{error:"seat intent was superseded by a newer designation"}}}if("in_progress"===A.kind)return ac(A.seat);if("replay"===A.kind&&!0!==A.seat.runtimeIdentityFrozen){let a="legacy pending orchestrator runtime identity is unavailable; retry the designation with a new clientRequestId",c=(0,Y.failOrchestratorSeatIntent)(k,m,a,b.now());return{status:409,body:{error:a,code:"legacy_runtime_identity_unavailable",seat:c?.seat??null}}}let C=(0,B.BE)(A.seat.mandate,A.seat.roleTable??null),D="replay"===A.kind?{...A.seat.engine?{engine:A.seat.engine}:{},...A.seat.model?{model:A.seat.model}:{}}:{engine:z.value.config.engine,model:z.value.config.model},E=function(a,b){if("string"==typeof b&&b.trim())return b.trim();let c=process.env.LLV_ORCHESTRATOR_CWD?.trim();if(c)return c;let d=a=>{if(!a)return!1;try{return e().statSync(a).isDirectory()}catch{return!1}};for(let b of Object.values((0,h.agentRegistry)().readOnlySnapshot().conversations).filter(b=>b.projectOwnership?.project===a||b.generations.some(b=>b.launchProfile?.project===a)).sort((a,b)=>(b.updatedAt??"").localeCompare(a.updatedAt??"")))for(let a=b.generations.length-1;a>=0;a-=1){let c=b.generations[a]?.launchProfile?.cwd;if(d(c))return c}return null}(k,a.cwd);if(!E){let a=(0,Y.failOrchestratorSeatIntent)(k,m,"orchestrator cwd could not be resolved",b.now());return{status:400,body:{error:"orchestrator cwd could not be resolved — pass cwd explicitly or set LLV_ORCHESTRATOR_CWD",code:"cwd_unresolved",seat:a?.seat??null}}}let G={...Object.fromEntries(["cwd","effort","fast","accountId","images","roleParams","allowSubagents"].flatMap(b=>void 0===a[b]?[]:[[b,a[b]]])),...D,role:"orchestrator",roleParams:a.roleParams??{mode:"standard"},project:k,cwd:E,prompt:C,title:(0,v.bF)("orchestrator",C,k),clientAttemptId:m},H=await b.spawn(G),I=aa(H.body.conversationId),J=H.status>=200&&H.status<300&&!1!==H.body.ok,M=aa(H.body.launchId),N=J&&202===H.status&&!!I&&!!M;if(!(J&&!1!==H.body.launched&&I)&&!N){let a=aa(H.body.error)||(J?I?"spawn did not report an accepted launch":"spawn response omitted conversationId":`spawn was rejected with HTTP status ${H.status}`),c=(0,Y.failOrchestratorSeatIntent)(k,m,a,b.now());return{status:H.status,body:{...H.body,seat:c?.seat??null}}}let O=await ad({project:k,clientRequestId:m,conversationId:I,path:"string"==typeof H.body.path?H.body.path:null,launchId:M||null,engine:z.value.config.engine,model:z.value.config.model},b);return O?{status:H.status,body:{...H.body,...N?{accepted:!0,state:"accepted"}:{},seat:O.seat}}:{status:409,body:{error:"seat intent was superseded by a newer designation"}}}function am(a){return`conversation_messages({"clientRequestId":"rotation-predecessor-recent-turns-${a}","conversationId":"${a}","roles":["user","assistant"],"limit":40})`}function an(a,b,c=Z){return function(a,b=Z,c=null){return aj(a,"rotation_failed",()=>ao(a,b,c))}(b,c,(0,k.Yd)(a))}async function ao(a,b,c){var d,e;let f,h,i=c?(h=c.conversationId?(0,Y.activeOrchestratorSeats)().find(a=>a.conversationId===c.conversationId):void 0,{kind:c.kind,conversationId:c.conversationId,seatEpoch:h?.seatEpoch??null}):null,j="string"==typeof a.project?(0,g.QK)(a.project):null;if(!j)return{status:400,body:{error:"project must be a valid project key"}};let k=(0,Y.canonicalOrchestratorProject)(j),l=aa(a.clientRequestId);if(!$.test(l))return{status:400,body:{error:"clientRequestId must be 8-128 URL-safe characters"}};let m=ag(k,b),n=m?{rolledBack:{conversationId:m.terminalized.seat.conversationId,seatEpoch:m.terminalized.seat.seatEpoch,error:m.terminalized.seat.intent.error,terminalizedAt:m.terminalized.terminalizedAt,restoredConversationId:m.restored?.conversationId??null}}:{},o=ai(k,b);o&&await o;let p=(0,Y.orchestratorSeatFor)(k).active;if(!p?.conversationId)return{status:409,body:{error:"no orchestrator is designated for this project — use create_orchestrator instead of rotating",code:"no_incumbent",...n}};let q=b.conversationTarget(p.conversationId),r=q?.kind==="eligible"?q:null,s=function(a,b,c){let d=a=>{if(!a)return null;let b=c.resolvedConversation(a);return b?.holdsTurns?{conversationId:b.conversationId,cwd:b.cwd}:null},e=d(b.conversationId);if(e)return e;let f=(0,Y.orchestratorRevocations)().filter(b=>b.project===a),g=new Set([b.conversationId??""]),h=b.conversationId;for(let a=0;a<8&&h;a+=1){let a=[...f].reverse().find(a=>a.successorConversationId===h),b=a?.conversationId??null;if(!b||g.has(b))break;g.add(b),h=b;let c=d(b);if(c)return c}return null}(k,p,b),t=b.projectTasks(k).slice(0,12),u=aa(a.handoffNotes).slice(0,2e3),v={header:[`You are replacing orchestrator conversation ${p.conversationId} for project ${k}. Its manager authority is revoked; its session and card remain on the board, linked to yours.`,...s?[s.conversationId===p.conversationId?`Your predecessor's recent turns — decisions, blockers, in-flight work — are one call away: ${am(s.conversationId)}. Records are newest first; pass the returned cursor with a fresh clientRequestId for each older page. Read them before acting, and never open the transcript file. If the call reports that the conversation has no transcript, reconstruct state from the board.`:`The seat you are replacing holds no readable turns, so it is not what you read. The last predecessor in this lineage that does is ${s.conversationId}: ${am(s.conversationId)}. Records are newest first; pass the returned cursor with a fresh clientRequestId for each older page. Read them before acting, and never open the transcript file.`]:["No conversation in this seat's lineage holds readable turns — the seat you are replacing has none, and neither does any predecessor on record. There is no handover transcript to read: reconstruct state from the board tasks below and from the notes in this mandate, and do not go looking for the predecessor's transcript file."]],tasks:t.length?`Open board tasks for this project:
|
|
122
|
+
${t.map(a=>`- [${a.status}] ${a.text.slice(0,140)} (${a.id})`).join("\n")}`:"No open board tasks are recorded for this project.",notes:u||null},w=aa(a.mandate)||p.mandate,x=w===B.ij?B.L8:w!==p.mandate&&(0,B.Ge)(p.promptVersion)?null:p.promptVersion,y=function(a,b){let c=(0,Y.orchestratorSeatFor)(a.project).pending;if(c&&c.intent.clientRequestId===a.clientRequestId&&null===c.intent.error)return{kind:"composed",mandate:c.mandate,handoff:null};let d=function(a){let b=[],c=[],d=[],e=null,f=[],g=()=>{let a=f.join("\n").trim();a&&("history"===e?c.push(a):"handoff"===e&&d.push(a)),f=[]};for(let c of H(a).split("\n")){if(c===D||c===C){g(),e=c===D?"history":"handoff";continue}null===e?b.push(c):f.push(c)}return g(),{core:b.join("\n").trimEnd(),history:c.length?c.join("\n\n"):null,handoffs:d}}(a.base);return null===d.history&&0===d.handoffs.length?ap(a,d.core,null,"none",null):(async()=>{let c;try{c=await b.summarizeHandoffs({project:a.project,clientRequestId:a.clientRequestId,priorHistory:d.history,priorHandoffs:d.handoffs,predecessor:a.predecessor})}catch{c={kind:"fallback",reason:"error"}}if("digest"===c.kind){let b;return ap(a,d.core,(b=I(c.text).trim())&&G(b,4096).value||null,"digest",null)}return console.warn(`orchestrator rotation for ${a.project} used the verbatim handoff fallback: ${c.reason}`),ap(a,d.core,function(a,b,c){let d=[...[...b].reverse().slice(0,2).map(a=>({label:"### Earlier handoff",body:a})),...a?[{label:"### Earlier rotation history",body:a}]:[]];if(!d.length)return null;let e=`(verbatim — summarizer ${c})`,f=4096-F(e),g=[];for(let a of d){let b=F(`
|
|
121
123
|
|
|
122
124
|
${a.label}
|
|
123
|
-
`);if(f-b<=0)continue;let c=
|
|
124
|
-
${a.body}`)].join("\n\n"):null}(d.history,d.handoffs,c.reason),"fallback",c.reason)})()}({project:k,clientRequestId:l,base:w,handoff:v,predecessor:r?{path:r.path,engine:r.engine}:null,roleParams:a.roleParams},b),z=y instanceof Promise?await y:y,
|
|
125
|
+
`);if(f-b<=0)continue;let c=G(I(a.body).trim(),f-b).value;c&&(g.push({label:a.label,body:c}),f-=b+F(c))}return g.length?[e,...g.reverse().map(a=>`${a.label}
|
|
126
|
+
${a.body}`)].join("\n\n"):null}(d.history,d.handoffs,c.reason),"fallback",c.reason)})()}({project:k,clientRequestId:l,base:w,handoff:v,predecessor:r?{path:r.path,engine:r.engine}:null,roleParams:a.roleParams},b),z=y instanceof Promise?await y:y,A={conversationId:p.conversationId,path:r?.path??p.path,seatEpoch:p.seatEpoch},E=(0,Y.orchestratorSeatFor)(k).active;if(!E||E.conversationId!==p.conversationId||E.seatEpoch!==p.seatEpoch){let a=_(k,p.seatEpoch,E);return{status:a.status,body:{...a.body,rotatedFrom:A,triggeredBy:i}}}if("too_large"===z.kind)return{status:413,body:{...z.body,rotatedFrom:A,triggeredBy:i}};let J=await ak({project:k,mandate:z.mandate,clientRequestId:l,replaceIncumbent:!0,expectedIncumbentSeatEpoch:p.seatEpoch,promptVersion:x,...void 0!==a.engine?{engine:a.engine}:p.engine?{engine:p.engine}:{},...void 0!==a.model?{model:a.model}:(void 0===a.engine||a.engine===p.engine)&&p.model?{model:p.model}:{},...void 0!==a.effort?{effort:a.effort}:{},...void 0!==a.fast?{fast:a.fast}:{},...void 0!==a.cwd?{cwd:a.cwd}:r?{cwd:r.cwd}:s?.cwd?{cwd:s.cwd}:{},...void 0!==a.accountId?{accountId:a.accountId}:{}},b,i);return{status:J.status,body:{...J.body,...n,rotatedFrom:A,triggeredBy:(d=J.body,e=i,!(f=d.seat)||"object"!=typeof f||Array.isArray(f)?e:f.triggeredBy??null),...z.handoff?{handoff:z.handoff}:{}}}}function ap(a,b,c,d,e){let f=K("spawn",a.roleParams),g=(0,t.e3)(),h=function(a){let b=H(a.core),c=null===a.history?null:I(a.history),d={header:a.handoff.header.map(I),tasks:null===a.handoff.tasks?null:I(a.handoff.tasks),notes:null===a.handoff.notes?null:I(a.handoff.notes)},e=b=>F(a.deliver(b)),f=J(b,c,d,d.notes),g=e(f);if(g<=a.budgetBytes)return{kind:"fits",mandate:f,bytes:g,historyDropped:!1,notesTruncatedTo:null};if(null!==c){let c=J(b,null,d,d.notes),f=e(c);if(f<=a.budgetBytes)return{kind:"fits",mandate:c,bytes:f,historyDropped:!0,notesTruncatedTo:null}}let h=null!==c,i=J(b,null,d,null),j=e(i);if(j>a.budgetBytes)return{kind:"too_large",bytes:j,budgetBytes:a.budgetBytes};let k=d.notes;if(!k)return{kind:"fits",mandate:i,bytes:j,historyDropped:h,notesTruncatedTo:null};let l=[...k],m={mandate:i,bytes:j,kept:0},n=1,o=l.length-1;for(;n<=o;){let c=Math.floor((n+o)/2),f=J(b,null,d,`${l.slice(0,c).join("")}${E}`),g=e(f);g<=a.budgetBytes?(m={mandate:f,bytes:g,kept:c},n=c+1):o=c-1}return{kind:"fits",mandate:m.mandate,bytes:m.bytes,historyDropped:h,notesTruncatedTo:m.kept}}({core:b,history:c,handoff:a.handoff,budgetBytes:u.N0-f,deliver:a=>(0,B.OT)(a,g)});return"too_large"===h.kind?{kind:"too_large",body:L({ok:!1,bytes:h.bytes,overhead:f,bound:u.N0,excess:h.bytes-h.budgetBytes})}:{kind:"composed",mandate:h.mandate,handoff:{history:d,reason:e,historyDropped:h.historyDropped,notesTruncatedTo:h.notesTruncatedTo,mandateBytes:h.bytes}}}}};
|