@nervekit/orchestrator 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +5 -0
- package/dist/agent-process.d.ts +32 -0
- package/dist/agent-process.d.ts.map +1 -0
- package/dist/agent-process.js +129 -0
- package/dist/agent-process.js.map +1 -0
- package/dist/agent-runner/agent-runner.d.ts +65 -0
- package/dist/agent-runner/agent-runner.d.ts.map +1 -0
- package/dist/agent-runner/agent-runner.js +802 -0
- package/dist/agent-runner/agent-runner.js.map +1 -0
- package/dist/agent-runner/index.d.ts +6 -0
- package/dist/agent-runner/index.d.ts.map +1 -0
- package/dist/agent-runner/index.js +4 -0
- package/dist/agent-runner/index.js.map +1 -0
- package/dist/agent-runner/message-mirror.d.ts +44 -0
- package/dist/agent-runner/message-mirror.d.ts.map +1 -0
- package/dist/agent-runner/message-mirror.js +154 -0
- package/dist/agent-runner/message-mirror.js.map +1 -0
- package/dist/agent-runner/run-state.d.ts +12 -0
- package/dist/agent-runner/run-state.d.ts.map +1 -0
- package/dist/agent-runner/run-state.js +2 -0
- package/dist/agent-runner/run-state.js.map +1 -0
- package/dist/agent-runner/subagent-runner.d.ts +29 -0
- package/dist/agent-runner/subagent-runner.d.ts.map +1 -0
- package/dist/agent-runner/subagent-runner.js +84 -0
- package/dist/agent-runner/subagent-runner.js.map +1 -0
- package/dist/agent-runner/system-prompt-builder.d.ts +19 -0
- package/dist/agent-runner/system-prompt-builder.d.ts.map +1 -0
- package/dist/agent-runner/system-prompt-builder.js +35 -0
- package/dist/agent-runner/system-prompt-builder.js.map +1 -0
- package/dist/agent-runner/tool-draft-streaming.d.ts +2 -0
- package/dist/agent-runner/tool-draft-streaming.d.ts.map +1 -0
- package/dist/agent-runner/tool-draft-streaming.js +5 -0
- package/dist/agent-runner/tool-draft-streaming.js.map +1 -0
- package/dist/agent-suspension-service.d.ts +44 -0
- package/dist/agent-suspension-service.d.ts.map +1 -0
- package/dist/agent-suspension-service.js +96 -0
- package/dist/agent-suspension-service.js.map +1 -0
- package/dist/agent-tool-adapter.d.ts +20 -0
- package/dist/agent-tool-adapter.d.ts.map +1 -0
- package/dist/agent-tool-adapter.js +215 -0
- package/dist/agent-tool-adapter.js.map +1 -0
- package/dist/agents/agent-authority.d.ts +5 -0
- package/dist/agents/agent-authority.d.ts.map +1 -0
- package/dist/agents/agent-authority.js +28 -0
- package/dist/agents/agent-authority.js.map +1 -0
- package/dist/agents/agent-budget.d.ts +3 -0
- package/dist/agents/agent-budget.d.ts.map +1 -0
- package/dist/agents/agent-budget.js +17 -0
- package/dist/agents/agent-budget.js.map +1 -0
- package/dist/agents/agent-status.d.ts +4 -0
- package/dist/agents/agent-status.d.ts.map +1 -0
- package/dist/agents/agent-status.js +10 -0
- package/dist/agents/agent-status.js.map +1 -0
- package/dist/auth.d.ts +30 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +158 -0
- package/dist/auth.js.map +1 -0
- package/dist/conversation-operations/compaction-service.d.ts +37 -0
- package/dist/conversation-operations/compaction-service.d.ts.map +1 -0
- package/dist/conversation-operations/compaction-service.js +102 -0
- package/dist/conversation-operations/compaction-service.js.map +1 -0
- package/dist/conversation-operations/export-service.d.ts +22 -0
- package/dist/conversation-operations/export-service.d.ts.map +1 -0
- package/dist/conversation-operations/export-service.js +79 -0
- package/dist/conversation-operations/export-service.js.map +1 -0
- package/dist/conversation-operations/import-service.d.ts +20 -0
- package/dist/conversation-operations/import-service.d.ts.map +1 -0
- package/dist/conversation-operations/import-service.js +97 -0
- package/dist/conversation-operations/import-service.js.map +1 -0
- package/dist/conversation-operations/index.d.ts +8 -0
- package/dist/conversation-operations/index.d.ts.map +1 -0
- package/dist/conversation-operations/index.js +6 -0
- package/dist/conversation-operations/index.js.map +1 -0
- package/dist/conversation-operations/navigation-service.d.ts +18 -0
- package/dist/conversation-operations/navigation-service.d.ts.map +1 -0
- package/dist/conversation-operations/navigation-service.js +102 -0
- package/dist/conversation-operations/navigation-service.js.map +1 -0
- package/dist/conversation-operations/summary.d.ts +11 -0
- package/dist/conversation-operations/summary.d.ts.map +1 -0
- package/dist/conversation-operations/summary.js +29 -0
- package/dist/conversation-operations/summary.js.map +1 -0
- package/dist/conversation-runtime.d.ts +96 -0
- package/dist/conversation-runtime.d.ts.map +1 -0
- package/dist/conversation-runtime.js +363 -0
- package/dist/conversation-runtime.js.map +1 -0
- package/dist/conversation-service.d.ts +17 -0
- package/dist/conversation-service.d.ts.map +1 -0
- package/dist/conversation-service.js +56 -0
- package/dist/conversation-service.js.map +1 -0
- package/dist/credential-crypto.d.ts +19 -0
- package/dist/credential-crypto.d.ts.map +1 -0
- package/dist/credential-crypto.js +75 -0
- package/dist/credential-crypto.js.map +1 -0
- package/dist/domains/agents/agent-authority.d.ts +5 -0
- package/dist/domains/agents/agent-authority.d.ts.map +1 -0
- package/dist/domains/agents/agent-authority.js +28 -0
- package/dist/domains/agents/agent-authority.js.map +1 -0
- package/dist/domains/agents/agent-budget.d.ts +3 -0
- package/dist/domains/agents/agent-budget.d.ts.map +1 -0
- package/dist/domains/agents/agent-budget.js +17 -0
- package/dist/domains/agents/agent-budget.js.map +1 -0
- package/dist/domains/agents/agent-lifecycle.service.d.ts +37 -0
- package/dist/domains/agents/agent-lifecycle.service.d.ts.map +1 -0
- package/dist/domains/agents/agent-lifecycle.service.js +241 -0
- package/dist/domains/agents/agent-lifecycle.service.js.map +1 -0
- package/dist/domains/agents/agent-status.d.ts +4 -0
- package/dist/domains/agents/agent-status.d.ts.map +1 -0
- package/dist/domains/agents/agent-status.js +10 -0
- package/dist/domains/agents/agent-status.js.map +1 -0
- package/dist/domains/agents/agent-suspension.service.d.ts +44 -0
- package/dist/domains/agents/agent-suspension.service.d.ts.map +1 -0
- package/dist/domains/agents/agent-suspension.service.js +96 -0
- package/dist/domains/agents/agent-suspension.service.js.map +1 -0
- package/dist/domains/agents/agent.repository.d.ts +12 -0
- package/dist/domains/agents/agent.repository.d.ts.map +1 -0
- package/dist/domains/agents/agent.repository.js +33 -0
- package/dist/domains/agents/agent.repository.js.map +1 -0
- package/dist/domains/agents/index.d.ts +6 -0
- package/dist/domains/agents/index.d.ts.map +1 -0
- package/dist/domains/agents/index.js +6 -0
- package/dist/domains/agents/index.js.map +1 -0
- package/dist/domains/agents/prompt-queue.repository.d.ts +28 -0
- package/dist/domains/agents/prompt-queue.repository.d.ts.map +1 -0
- package/dist/domains/agents/prompt-queue.repository.js +88 -0
- package/dist/domains/agents/prompt-queue.repository.js.map +1 -0
- package/dist/domains/agents/queued-prompt.service.d.ts +16 -0
- package/dist/domains/agents/queued-prompt.service.d.ts.map +1 -0
- package/dist/domains/agents/queued-prompt.service.js +30 -0
- package/dist/domains/agents/queued-prompt.service.js.map +1 -0
- package/dist/domains/agents/retry-continuation.service.d.ts +14 -0
- package/dist/domains/agents/retry-continuation.service.d.ts.map +1 -0
- package/dist/domains/agents/retry-continuation.service.js +75 -0
- package/dist/domains/agents/retry-continuation.service.js.map +1 -0
- package/dist/domains/agents/run/agent-run-session.d.ts +6 -0
- package/dist/domains/agents/run/agent-run-session.d.ts.map +1 -0
- package/dist/domains/agents/run/agent-run-session.js +587 -0
- package/dist/domains/agents/run/agent-run-session.js.map +1 -0
- package/dist/domains/agents/run/agent-runner-shared.d.ts +19 -0
- package/dist/domains/agents/run/agent-runner-shared.d.ts.map +1 -0
- package/dist/domains/agents/run/agent-runner-shared.js +58 -0
- package/dist/domains/agents/run/agent-runner-shared.js.map +1 -0
- package/dist/domains/agents/run/agent-runner.d.ts +119 -0
- package/dist/domains/agents/run/agent-runner.d.ts.map +1 -0
- package/dist/domains/agents/run/agent-runner.js +515 -0
- package/dist/domains/agents/run/agent-runner.js.map +1 -0
- package/dist/domains/agents/run/explore-helpers.d.ts +32 -0
- package/dist/domains/agents/run/explore-helpers.d.ts.map +1 -0
- package/dist/domains/agents/run/explore-helpers.js +431 -0
- package/dist/domains/agents/run/explore-helpers.js.map +1 -0
- package/dist/domains/agents/run/index.d.ts +6 -0
- package/dist/domains/agents/run/index.d.ts.map +1 -0
- package/dist/domains/agents/run/index.js +4 -0
- package/dist/domains/agents/run/index.js.map +1 -0
- package/dist/domains/agents/run/interrupted-run-recovery.d.ts +21 -0
- package/dist/domains/agents/run/interrupted-run-recovery.d.ts.map +1 -0
- package/dist/domains/agents/run/interrupted-run-recovery.js +94 -0
- package/dist/domains/agents/run/interrupted-run-recovery.js.map +1 -0
- package/dist/domains/agents/run/live-tool-draft-reconciliation.d.ts +32 -0
- package/dist/domains/agents/run/live-tool-draft-reconciliation.d.ts.map +1 -0
- package/dist/domains/agents/run/live-tool-draft-reconciliation.js +72 -0
- package/dist/domains/agents/run/live-tool-draft-reconciliation.js.map +1 -0
- package/dist/domains/agents/run/message-mirror.d.ts +44 -0
- package/dist/domains/agents/run/message-mirror.d.ts.map +1 -0
- package/dist/domains/agents/run/message-mirror.js +179 -0
- package/dist/domains/agents/run/message-mirror.js.map +1 -0
- package/dist/domains/agents/run/run-state.d.ts +28 -0
- package/dist/domains/agents/run/run-state.d.ts.map +1 -0
- package/dist/domains/agents/run/run-state.js +2 -0
- package/dist/domains/agents/run/run-state.js.map +1 -0
- package/dist/domains/agents/run/subagent-runner.d.ts +104 -0
- package/dist/domains/agents/run/subagent-runner.d.ts.map +1 -0
- package/dist/domains/agents/run/subagent-runner.js +374 -0
- package/dist/domains/agents/run/subagent-runner.js.map +1 -0
- package/dist/domains/agents/run/system-prompt-builder.d.ts +19 -0
- package/dist/domains/agents/run/system-prompt-builder.d.ts.map +1 -0
- package/dist/domains/agents/run/system-prompt-builder.js +39 -0
- package/dist/domains/agents/run/system-prompt-builder.js.map +1 -0
- package/dist/domains/agents/run/tool-draft-progress.d.ts +47 -0
- package/dist/domains/agents/run/tool-draft-progress.d.ts.map +1 -0
- package/dist/domains/agents/run/tool-draft-progress.js +438 -0
- package/dist/domains/agents/run/tool-draft-progress.js.map +1 -0
- package/dist/domains/agents/run/tool-draft-streaming.d.ts +3 -0
- package/dist/domains/agents/run/tool-draft-streaming.d.ts.map +1 -0
- package/dist/domains/agents/run/tool-draft-streaming.js +13 -0
- package/dist/domains/agents/run/tool-draft-streaming.js.map +1 -0
- package/dist/domains/completions/file-completion-candidates.d.ts +13 -0
- package/dist/domains/completions/file-completion-candidates.d.ts.map +1 -0
- package/dist/domains/completions/file-completion-candidates.js +208 -0
- package/dist/domains/completions/file-completion-candidates.js.map +1 -0
- package/dist/domains/completions/file-completion-ranking.d.ts +19 -0
- package/dist/domains/completions/file-completion-ranking.d.ts.map +1 -0
- package/dist/domains/completions/file-completion-ranking.js +350 -0
- package/dist/domains/completions/file-completion-ranking.js.map +1 -0
- package/dist/domains/completions/file-completion-service.d.ts +11 -0
- package/dist/domains/completions/file-completion-service.d.ts.map +1 -0
- package/dist/domains/completions/file-completion-service.js +60 -0
- package/dist/domains/completions/file-completion-service.js.map +1 -0
- package/dist/domains/completions/index.d.ts +4 -0
- package/dist/domains/completions/index.d.ts.map +1 -0
- package/dist/domains/completions/index.js +4 -0
- package/dist/domains/completions/index.js.map +1 -0
- package/dist/domains/conversations/conversation-lifecycle.service.d.ts +32 -0
- package/dist/domains/conversations/conversation-lifecycle.service.d.ts.map +1 -0
- package/dist/domains/conversations/conversation-lifecycle.service.js +139 -0
- package/dist/domains/conversations/conversation-lifecycle.service.js.map +1 -0
- package/dist/domains/conversations/conversation-query.service.d.ts +19 -0
- package/dist/domains/conversations/conversation-query.service.d.ts.map +1 -0
- package/dist/domains/conversations/conversation-query.service.js +76 -0
- package/dist/domains/conversations/conversation-query.service.js.map +1 -0
- package/dist/domains/conversations/conversation-runtime.d.ts +112 -0
- package/dist/domains/conversations/conversation-runtime.d.ts.map +1 -0
- package/dist/domains/conversations/conversation-runtime.js +417 -0
- package/dist/domains/conversations/conversation-runtime.js.map +1 -0
- package/dist/domains/conversations/conversation-service.d.ts +17 -0
- package/dist/domains/conversations/conversation-service.d.ts.map +1 -0
- package/dist/domains/conversations/conversation-service.js +56 -0
- package/dist/domains/conversations/conversation-service.js.map +1 -0
- package/dist/domains/conversations/conversation.repository.d.ts +13 -0
- package/dist/domains/conversations/conversation.repository.d.ts.map +1 -0
- package/dist/domains/conversations/conversation.repository.js +39 -0
- package/dist/domains/conversations/conversation.repository.js.map +1 -0
- package/dist/domains/conversations/entry.repository.d.ts +15 -0
- package/dist/domains/conversations/entry.repository.d.ts.map +1 -0
- package/dist/domains/conversations/entry.repository.js +81 -0
- package/dist/domains/conversations/entry.repository.js.map +1 -0
- package/dist/domains/conversations/harness-manager.d.ts +29 -0
- package/dist/domains/conversations/harness-manager.d.ts.map +1 -0
- package/dist/domains/conversations/harness-manager.js +129 -0
- package/dist/domains/conversations/harness-manager.js.map +1 -0
- package/dist/domains/conversations/index.d.ts +5 -0
- package/dist/domains/conversations/index.d.ts.map +1 -0
- package/dist/domains/conversations/index.js +5 -0
- package/dist/domains/conversations/index.js.map +1 -0
- package/dist/domains/conversations/operations/compaction-service.d.ts +63 -0
- package/dist/domains/conversations/operations/compaction-service.d.ts.map +1 -0
- package/dist/domains/conversations/operations/compaction-service.js +200 -0
- package/dist/domains/conversations/operations/compaction-service.js.map +1 -0
- package/dist/domains/conversations/operations/export-service.d.ts +22 -0
- package/dist/domains/conversations/operations/export-service.d.ts.map +1 -0
- package/dist/domains/conversations/operations/export-service.js +79 -0
- package/dist/domains/conversations/operations/export-service.js.map +1 -0
- package/dist/domains/conversations/operations/import-service.d.ts +20 -0
- package/dist/domains/conversations/operations/import-service.d.ts.map +1 -0
- package/dist/domains/conversations/operations/import-service.js +97 -0
- package/dist/domains/conversations/operations/import-service.js.map +1 -0
- package/dist/domains/conversations/operations/index.d.ts +8 -0
- package/dist/domains/conversations/operations/index.d.ts.map +1 -0
- package/dist/domains/conversations/operations/index.js +6 -0
- package/dist/domains/conversations/operations/index.js.map +1 -0
- package/dist/domains/conversations/operations/navigation-service.d.ts +18 -0
- package/dist/domains/conversations/operations/navigation-service.d.ts.map +1 -0
- package/dist/domains/conversations/operations/navigation-service.js +102 -0
- package/dist/domains/conversations/operations/navigation-service.js.map +1 -0
- package/dist/domains/conversations/operations/summary.d.ts +11 -0
- package/dist/domains/conversations/operations/summary.d.ts.map +1 -0
- package/dist/domains/conversations/operations/summary.js +29 -0
- package/dist/domains/conversations/operations/summary.js.map +1 -0
- package/dist/domains/git/git-branches.d.ts +12 -0
- package/dist/domains/git/git-branches.d.ts.map +1 -0
- package/dist/domains/git/git-branches.js +131 -0
- package/dist/domains/git/git-branches.js.map +1 -0
- package/dist/domains/git/git-command.d.ts +13 -0
- package/dist/domains/git/git-command.d.ts.map +1 -0
- package/dist/domains/git/git-command.js +38 -0
- package/dist/domains/git/git-command.js.map +1 -0
- package/dist/domains/git/git-github-parsers.d.ts +12 -0
- package/dist/domains/git/git-github-parsers.d.ts.map +1 -0
- package/dist/domains/git/git-github-parsers.js +82 -0
- package/dist/domains/git/git-github-parsers.js.map +1 -0
- package/dist/domains/git/git-github-service.d.ts +30 -0
- package/dist/domains/git/git-github-service.d.ts.map +1 -0
- package/dist/domains/git/git-github-service.js +171 -0
- package/dist/domains/git/git-github-service.js.map +1 -0
- package/dist/domains/git/git-service.d.ts +53 -0
- package/dist/domains/git/git-service.d.ts.map +1 -0
- package/dist/domains/git/git-service.js +440 -0
- package/dist/domains/git/git-service.js.map +1 -0
- package/dist/domains/git/git-status.d.ts +24 -0
- package/dist/domains/git/git-status.d.ts.map +1 -0
- package/dist/domains/git/git-status.js +133 -0
- package/dist/domains/git/git-status.js.map +1 -0
- package/dist/domains/human-input/human-input-resolution.service.d.ts +47 -0
- package/dist/domains/human-input/human-input-resolution.service.d.ts.map +1 -0
- package/dist/domains/human-input/human-input-resolution.service.js +305 -0
- package/dist/domains/human-input/human-input-resolution.service.js.map +1 -0
- package/dist/domains/human-input/index.d.ts +3 -0
- package/dist/domains/human-input/index.d.ts.map +1 -0
- package/dist/domains/human-input/index.js +2 -0
- package/dist/domains/human-input/index.js.map +1 -0
- package/dist/domains/pinned-commands/index.d.ts +3 -0
- package/dist/domains/pinned-commands/index.d.ts.map +1 -0
- package/dist/domains/pinned-commands/index.js +3 -0
- package/dist/domains/pinned-commands/index.js.map +1 -0
- package/dist/domains/pinned-commands/pinned-command.repository.d.ts +10 -0
- package/dist/domains/pinned-commands/pinned-command.repository.d.ts.map +1 -0
- package/dist/domains/pinned-commands/pinned-command.repository.js +28 -0
- package/dist/domains/pinned-commands/pinned-command.repository.js.map +1 -0
- package/dist/domains/pinned-commands/pinned-command.service.d.ts +11 -0
- package/dist/domains/pinned-commands/pinned-command.service.d.ts.map +1 -0
- package/dist/domains/pinned-commands/pinned-command.service.js +40 -0
- package/dist/domains/pinned-commands/pinned-command.service.js.map +1 -0
- package/dist/domains/plans/plan-paths.d.ts +6 -0
- package/dist/domains/plans/plan-paths.d.ts.map +1 -0
- package/dist/domains/plans/plan-paths.js +30 -0
- package/dist/domains/plans/plan-paths.js.map +1 -0
- package/dist/domains/plans/plan-service.d.ts +62 -0
- package/dist/domains/plans/plan-service.d.ts.map +1 -0
- package/dist/domains/plans/plan-service.js +266 -0
- package/dist/domains/plans/plan-service.js.map +1 -0
- package/dist/domains/processes/index.d.ts +10 -0
- package/dist/domains/processes/index.d.ts.map +1 -0
- package/dist/domains/processes/index.js +7 -0
- package/dist/domains/processes/index.js.map +1 -0
- package/dist/domains/processes/process-launch-config.store.d.ts +21 -0
- package/dist/domains/processes/process-launch-config.store.d.ts.map +1 -0
- package/dist/domains/processes/process-launch-config.store.js +49 -0
- package/dist/domains/processes/process-launch-config.store.js.map +1 -0
- package/dist/domains/processes/process-log.service.d.ts +25 -0
- package/dist/domains/processes/process-log.service.d.ts.map +1 -0
- package/dist/domains/processes/process-log.service.js +155 -0
- package/dist/domains/processes/process-log.service.js.map +1 -0
- package/dist/domains/processes/process-manager.d.ts +107 -0
- package/dist/domains/processes/process-manager.d.ts.map +1 -0
- package/dist/domains/processes/process-manager.js +814 -0
- package/dist/domains/processes/process-manager.js.map +1 -0
- package/dist/domains/processes/process-readiness.service.d.ts +7 -0
- package/dist/domains/processes/process-readiness.service.d.ts.map +1 -0
- package/dist/domains/processes/process-readiness.service.js +26 -0
- package/dist/domains/processes/process-readiness.service.js.map +1 -0
- package/dist/domains/processes/process-status.d.ts +5 -0
- package/dist/domains/processes/process-status.d.ts.map +1 -0
- package/dist/domains/processes/process-status.js +13 -0
- package/dist/domains/processes/process-status.js.map +1 -0
- package/dist/domains/processes/process-supervisor.d.ts +34 -0
- package/dist/domains/processes/process-supervisor.d.ts.map +1 -0
- package/dist/domains/processes/process-supervisor.js +211 -0
- package/dist/domains/processes/process-supervisor.js.map +1 -0
- package/dist/domains/processes/process.repository.d.ts +11 -0
- package/dist/domains/processes/process.repository.d.ts.map +1 -0
- package/dist/domains/processes/process.repository.js +31 -0
- package/dist/domains/processes/process.repository.js.map +1 -0
- package/dist/domains/projects/index.d.ts +5 -0
- package/dist/domains/projects/index.d.ts.map +1 -0
- package/dist/domains/projects/index.js +5 -0
- package/dist/domains/projects/index.js.map +1 -0
- package/dist/domains/projects/project-editor.service.d.ts +20 -0
- package/dist/domains/projects/project-editor.service.d.ts.map +1 -0
- package/dist/domains/projects/project-editor.service.js +240 -0
- package/dist/domains/projects/project-editor.service.js.map +1 -0
- package/dist/domains/projects/project.repository.d.ts +12 -0
- package/dist/domains/projects/project.repository.d.ts.map +1 -0
- package/dist/domains/projects/project.repository.js +33 -0
- package/dist/domains/projects/project.repository.js.map +1 -0
- package/dist/domains/projects/project.service.d.ts +22 -0
- package/dist/domains/projects/project.service.d.ts.map +1 -0
- package/dist/domains/projects/project.service.js +83 -0
- package/dist/domains/projects/project.service.js.map +1 -0
- package/dist/domains/projects/prune-conversations.service.d.ts +39 -0
- package/dist/domains/projects/prune-conversations.service.d.ts.map +1 -0
- package/dist/domains/projects/prune-conversations.service.js +91 -0
- package/dist/domains/projects/prune-conversations.service.js.map +1 -0
- package/dist/domains/providers/index.d.ts +2 -0
- package/dist/domains/providers/index.d.ts.map +1 -0
- package/dist/domains/providers/index.js +2 -0
- package/dist/domains/providers/index.js.map +1 -0
- package/dist/domains/providers/provider-catalog.store.d.ts +30 -0
- package/dist/domains/providers/provider-catalog.store.d.ts.map +1 -0
- package/dist/domains/providers/provider-catalog.store.js +109 -0
- package/dist/domains/providers/provider-catalog.store.js.map +1 -0
- package/dist/domains/runtime/python-runtime-service.d.ts +15 -0
- package/dist/domains/runtime/python-runtime-service.d.ts.map +1 -0
- package/dist/domains/runtime/python-runtime-service.js +65 -0
- package/dist/domains/runtime/python-runtime-service.js.map +1 -0
- package/dist/domains/storage/index.d.ts +2 -0
- package/dist/domains/storage/index.d.ts.map +1 -0
- package/dist/domains/storage/index.js +2 -0
- package/dist/domains/storage/index.js.map +1 -0
- package/dist/domains/storage/storage-usage.service.d.ts +39 -0
- package/dist/domains/storage/storage-usage.service.d.ts.map +1 -0
- package/dist/domains/storage/storage-usage.service.js +394 -0
- package/dist/domains/storage/storage-usage.service.js.map +1 -0
- package/dist/domains/tasks/index.d.ts +11 -0
- package/dist/domains/tasks/index.d.ts.map +1 -0
- package/dist/domains/tasks/index.js +8 -0
- package/dist/domains/tasks/index.js.map +1 -0
- package/dist/domains/tasks/task-completion.service.d.ts +31 -0
- package/dist/domains/tasks/task-completion.service.d.ts.map +1 -0
- package/dist/domains/tasks/task-completion.service.js +147 -0
- package/dist/domains/tasks/task-completion.service.js.map +1 -0
- package/dist/domains/tasks/task-launch-config.store.d.ts +21 -0
- package/dist/domains/tasks/task-launch-config.store.d.ts.map +1 -0
- package/dist/domains/tasks/task-launch-config.store.js +49 -0
- package/dist/domains/tasks/task-launch-config.store.js.map +1 -0
- package/dist/domains/tasks/task-legacy-migration.d.ts +15 -0
- package/dist/domains/tasks/task-legacy-migration.d.ts.map +1 -0
- package/dist/domains/tasks/task-legacy-migration.js +191 -0
- package/dist/domains/tasks/task-legacy-migration.js.map +1 -0
- package/dist/domains/tasks/task-log.service.d.ts +25 -0
- package/dist/domains/tasks/task-log.service.d.ts.map +1 -0
- package/dist/domains/tasks/task-log.service.js +169 -0
- package/dist/domains/tasks/task-log.service.js.map +1 -0
- package/dist/domains/tasks/task-manager-finalization.d.ts +8 -0
- package/dist/domains/tasks/task-manager-finalization.d.ts.map +1 -0
- package/dist/domains/tasks/task-manager-finalization.js +164 -0
- package/dist/domains/tasks/task-manager-finalization.js.map +1 -0
- package/dist/domains/tasks/task-manager-foreground.d.ts +5 -0
- package/dist/domains/tasks/task-manager-foreground.d.ts.map +1 -0
- package/dist/domains/tasks/task-manager-foreground.js +146 -0
- package/dist/domains/tasks/task-manager-foreground.js.map +1 -0
- package/dist/domains/tasks/task-manager-orphan.d.ts +14 -0
- package/dist/domains/tasks/task-manager-orphan.d.ts.map +1 -0
- package/dist/domains/tasks/task-manager-orphan.js +241 -0
- package/dist/domains/tasks/task-manager-orphan.js.map +1 -0
- package/dist/domains/tasks/task-manager-output-readiness.d.ts +17 -0
- package/dist/domains/tasks/task-manager-output-readiness.d.ts.map +1 -0
- package/dist/domains/tasks/task-manager-output-readiness.js +234 -0
- package/dist/domains/tasks/task-manager-output-readiness.js.map +1 -0
- package/dist/domains/tasks/task-manager-start.d.ts +12 -0
- package/dist/domains/tasks/task-manager-start.d.ts.map +1 -0
- package/dist/domains/tasks/task-manager-start.js +166 -0
- package/dist/domains/tasks/task-manager-start.js.map +1 -0
- package/dist/domains/tasks/task-manager-utils.d.ts +11 -0
- package/dist/domains/tasks/task-manager-utils.d.ts.map +1 -0
- package/dist/domains/tasks/task-manager-utils.js +28 -0
- package/dist/domains/tasks/task-manager-utils.js.map +1 -0
- package/dist/domains/tasks/task-manager.d.ts +213 -0
- package/dist/domains/tasks/task-manager.d.ts.map +1 -0
- package/dist/domains/tasks/task-manager.js +451 -0
- package/dist/domains/tasks/task-manager.js.map +1 -0
- package/dist/domains/tasks/task-notification.service.d.ts +42 -0
- package/dist/domains/tasks/task-notification.service.d.ts.map +1 -0
- package/dist/domains/tasks/task-notification.service.js +373 -0
- package/dist/domains/tasks/task-notification.service.js.map +1 -0
- package/dist/domains/tasks/task-readiness.service.d.ts +7 -0
- package/dist/domains/tasks/task-readiness.service.d.ts.map +1 -0
- package/dist/domains/tasks/task-readiness.service.js +27 -0
- package/dist/domains/tasks/task-readiness.service.js.map +1 -0
- package/dist/domains/tasks/task-status.d.ts +5 -0
- package/dist/domains/tasks/task-status.d.ts.map +1 -0
- package/dist/domains/tasks/task-status.js +13 -0
- package/dist/domains/tasks/task-status.js.map +1 -0
- package/dist/domains/tasks/task-summary-format.d.ts +42 -0
- package/dist/domains/tasks/task-summary-format.d.ts.map +1 -0
- package/dist/domains/tasks/task-summary-format.js +149 -0
- package/dist/domains/tasks/task-summary-format.js.map +1 -0
- package/dist/domains/tasks/task-supervisor.d.ts +34 -0
- package/dist/domains/tasks/task-supervisor.d.ts.map +1 -0
- package/dist/domains/tasks/task-supervisor.js +211 -0
- package/dist/domains/tasks/task-supervisor.js.map +1 -0
- package/dist/domains/tasks/task.repository.d.ts +37 -0
- package/dist/domains/tasks/task.repository.d.ts.map +1 -0
- package/dist/domains/tasks/task.repository.js +58 -0
- package/dist/domains/tasks/task.repository.js.map +1 -0
- package/dist/domains/tools/agent-tool-adapter.d.ts +25 -0
- package/dist/domains/tools/agent-tool-adapter.d.ts.map +1 -0
- package/dist/domains/tools/agent-tool-adapter.js +251 -0
- package/dist/domains/tools/agent-tool-adapter.js.map +1 -0
- package/dist/domains/tools/approval.repository.d.ts +28 -0
- package/dist/domains/tools/approval.repository.d.ts.map +1 -0
- package/dist/domains/tools/approval.repository.js +59 -0
- package/dist/domains/tools/approval.repository.js.map +1 -0
- package/dist/domains/tools/index.d.ts +12 -0
- package/dist/domains/tools/index.d.ts.map +1 -0
- package/dist/domains/tools/index.js +10 -0
- package/dist/domains/tools/index.js.map +1 -0
- package/dist/domains/tools/interaction-session.service.d.ts +23 -0
- package/dist/domains/tools/interaction-session.service.d.ts.map +1 -0
- package/dist/domains/tools/interaction-session.service.js +130 -0
- package/dist/domains/tools/interaction-session.service.js.map +1 -0
- package/dist/domains/tools/orchestration-tool-dispatcher-handlers.d.ts +25 -0
- package/dist/domains/tools/orchestration-tool-dispatcher-handlers.d.ts.map +1 -0
- package/dist/domains/tools/orchestration-tool-dispatcher-handlers.js +379 -0
- package/dist/domains/tools/orchestration-tool-dispatcher-handlers.js.map +1 -0
- package/dist/domains/tools/orchestration-tool-dispatcher.d.ts +58 -0
- package/dist/domains/tools/orchestration-tool-dispatcher.d.ts.map +1 -0
- package/dist/domains/tools/orchestration-tool-dispatcher.js +347 -0
- package/dist/domains/tools/orchestration-tool-dispatcher.js.map +1 -0
- package/dist/domains/tools/policy.d.ts +14 -0
- package/dist/domains/tools/policy.d.ts.map +1 -0
- package/dist/domains/tools/policy.js +330 -0
- package/dist/domains/tools/policy.js.map +1 -0
- package/dist/domains/tools/todo-state.service.d.ts +23 -0
- package/dist/domains/tools/todo-state.service.d.ts.map +1 -0
- package/dist/domains/tools/todo-state.service.js +63 -0
- package/dist/domains/tools/todo-state.service.js.map +1 -0
- package/dist/domains/tools/tool-args.d.ts +12 -0
- package/dist/domains/tools/tool-args.d.ts.map +1 -0
- package/dist/domains/tools/tool-args.js +55 -0
- package/dist/domains/tools/tool-args.js.map +1 -0
- package/dist/domains/tools/tool-call.repository.d.ts +55 -0
- package/dist/domains/tools/tool-call.repository.d.ts.map +1 -0
- package/dist/domains/tools/tool-call.repository.js +74 -0
- package/dist/domains/tools/tool-call.repository.js.map +1 -0
- package/dist/domains/tools/tool-errors.d.ts +9 -0
- package/dist/domains/tools/tool-errors.d.ts.map +1 -0
- package/dist/domains/tools/tool-errors.js +58 -0
- package/dist/domains/tools/tool-errors.js.map +1 -0
- package/dist/domains/tools/tool-execution-suspension.d.ts +5 -0
- package/dist/domains/tools/tool-execution-suspension.d.ts.map +1 -0
- package/dist/domains/tools/tool-execution-suspension.js +9 -0
- package/dist/domains/tools/tool-execution-suspension.js.map +1 -0
- package/dist/domains/tools/tool-executor.service.d.ts +18 -0
- package/dist/domains/tools/tool-executor.service.d.ts.map +1 -0
- package/dist/domains/tools/tool-executor.service.js +82 -0
- package/dist/domains/tools/tool-executor.service.js.map +1 -0
- package/dist/domains/tools/tool-result-bounds.d.ts +5 -0
- package/dist/domains/tools/tool-result-bounds.d.ts.map +1 -0
- package/dist/domains/tools/tool-result-bounds.js +149 -0
- package/dist/domains/tools/tool-result-bounds.js.map +1 -0
- package/dist/domains/tools/tool-service.d.ts +143 -0
- package/dist/domains/tools/tool-service.d.ts.map +1 -0
- package/dist/domains/tools/tool-service.js +459 -0
- package/dist/domains/tools/tool-service.js.map +1 -0
- package/dist/domains/tools/user-question.repository.d.ts +34 -0
- package/dist/domains/tools/user-question.repository.d.ts.map +1 -0
- package/dist/domains/tools/user-question.repository.js +62 -0
- package/dist/domains/tools/user-question.repository.js.map +1 -0
- package/dist/domains/transcription/transcription.service.d.ts +15 -0
- package/dist/domains/transcription/transcription.service.d.ts.map +1 -0
- package/dist/domains/transcription/transcription.service.js +128 -0
- package/dist/domains/transcription/transcription.service.js.map +1 -0
- package/dist/domains/usage/anthropic-client.d.ts +9 -0
- package/dist/domains/usage/anthropic-client.d.ts.map +1 -0
- package/dist/domains/usage/anthropic-client.js +207 -0
- package/dist/domains/usage/anthropic-client.js.map +1 -0
- package/dist/domains/usage/codex-client.d.ts +18 -0
- package/dist/domains/usage/codex-client.d.ts.map +1 -0
- package/dist/domains/usage/codex-client.js +316 -0
- package/dist/domains/usage/codex-client.js.map +1 -0
- package/dist/domains/usage/subscription-usage-service.d.ts +42 -0
- package/dist/domains/usage/subscription-usage-service.d.ts.map +1 -0
- package/dist/domains/usage/subscription-usage-service.js +131 -0
- package/dist/domains/usage/subscription-usage-service.js.map +1 -0
- package/dist/domains/workers/agent-process.d.ts +32 -0
- package/dist/domains/workers/agent-process.d.ts.map +1 -0
- package/dist/domains/workers/agent-process.js +129 -0
- package/dist/domains/workers/agent-process.js.map +1 -0
- package/dist/domains/workers/index.d.ts +3 -0
- package/dist/domains/workers/index.d.ts.map +1 -0
- package/dist/domains/workers/index.js +3 -0
- package/dist/domains/workers/index.js.map +1 -0
- package/dist/domains/workers/worker-manager.d.ts +51 -0
- package/dist/domains/workers/worker-manager.d.ts.map +1 -0
- package/dist/domains/workers/worker-manager.js +116 -0
- package/dist/domains/workers/worker-manager.js.map +1 -0
- package/dist/events.d.ts +2 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/git/git-service.d.ts +51 -0
- package/dist/git/git-service.d.ts.map +1 -0
- package/dist/git/git-service.js +716 -0
- package/dist/git/git-service.js.map +1 -0
- package/dist/git/git-status.d.ts +24 -0
- package/dist/git/git-status.d.ts.map +1 -0
- package/dist/git/git-status.js +133 -0
- package/dist/git/git-status.js.map +1 -0
- package/dist/harness-manager.d.ts +21 -0
- package/dist/harness-manager.d.ts.map +1 -0
- package/dist/harness-manager.js +105 -0
- package/dist/harness-manager.js.map +1 -0
- package/dist/http/auth-middleware.d.ts +12 -0
- package/dist/http/auth-middleware.d.ts.map +1 -0
- package/dist/http/auth-middleware.js +64 -0
- package/dist/http/auth-middleware.js.map +1 -0
- package/dist/http/errors.d.ts +7 -0
- package/dist/http/errors.d.ts.map +1 -0
- package/dist/http/errors.js +21 -0
- package/dist/http/errors.js.map +1 -0
- package/dist/http/query.d.ts +2 -0
- package/dist/http/query.d.ts.map +1 -0
- package/dist/http/query.js +7 -0
- package/dist/http/query.js.map +1 -0
- package/dist/http/request-context.d.ts +11 -0
- package/dist/http/request-context.d.ts.map +1 -0
- package/dist/http/request-context.js +11 -0
- package/dist/http/request-context.js.map +1 -0
- package/dist/http/responses.d.ts +3 -0
- package/dist/http/responses.d.ts.map +1 -0
- package/dist/http/responses.js +20 -0
- package/dist/http/responses.js.map +1 -0
- package/dist/http/route-params.d.ts +3 -0
- package/dist/http/route-params.d.ts.map +1 -0
- package/dist/http/route-params.js +9 -0
- package/dist/http/route-params.js.map +1 -0
- package/dist/http/static-files.d.ts +4 -0
- package/dist/http/static-files.d.ts.map +1 -0
- package/dist/http/static-files.js +125 -0
- package/dist/http/static-files.js.map +1 -0
- package/dist/index-store.d.ts +2 -0
- package/dist/index-store.d.ts.map +1 -0
- package/dist/index-store.js +2 -0
- package/dist/index-store.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/events/event-bus.d.ts +58 -0
- package/dist/infrastructure/events/event-bus.d.ts.map +1 -0
- package/dist/infrastructure/events/event-bus.js +242 -0
- package/dist/infrastructure/events/event-bus.js.map +1 -0
- package/dist/infrastructure/events/event-ref-extractor.d.ts +3 -0
- package/dist/infrastructure/events/event-ref-extractor.d.ts.map +1 -0
- package/dist/infrastructure/events/event-ref-extractor.js +30 -0
- package/dist/infrastructure/events/event-ref-extractor.js.map +1 -0
- package/dist/infrastructure/events/index.d.ts +3 -0
- package/dist/infrastructure/events/index.d.ts.map +1 -0
- package/dist/infrastructure/events/index.js +3 -0
- package/dist/infrastructure/events/index.js.map +1 -0
- package/dist/infrastructure/index-store/event-refs.d.ts +9 -0
- package/dist/infrastructure/index-store/event-refs.d.ts.map +1 -0
- package/dist/infrastructure/index-store/event-refs.js +40 -0
- package/dist/infrastructure/index-store/event-refs.js.map +1 -0
- package/dist/infrastructure/index-store/index-store.d.ts +83 -0
- package/dist/infrastructure/index-store/index-store.d.ts.map +1 -0
- package/dist/infrastructure/index-store/index-store.js +436 -0
- package/dist/infrastructure/index-store/index-store.js.map +1 -0
- package/dist/infrastructure/index-store/index.d.ts +4 -0
- package/dist/infrastructure/index-store/index.d.ts.map +1 -0
- package/dist/infrastructure/index-store/index.js +4 -0
- package/dist/infrastructure/index-store/index.js.map +1 -0
- package/dist/infrastructure/index-store/schema.d.ts +2 -0
- package/dist/infrastructure/index-store/schema.d.ts.map +1 -0
- package/dist/infrastructure/index-store/schema.js +84 -0
- package/dist/infrastructure/index-store/schema.js.map +1 -0
- package/dist/infrastructure/storage/index.d.ts +4 -0
- package/dist/infrastructure/storage/index.d.ts.map +1 -0
- package/dist/infrastructure/storage/index.js +4 -0
- package/dist/infrastructure/storage/index.js.map +1 -0
- package/dist/infrastructure/storage/initialize.d.ts +12 -0
- package/dist/infrastructure/storage/initialize.d.ts.map +1 -0
- package/dist/infrastructure/storage/initialize.js +118 -0
- package/dist/infrastructure/storage/initialize.js.map +1 -0
- package/dist/infrastructure/storage/json.d.ts +29 -0
- package/dist/infrastructure/storage/json.d.ts.map +1 -0
- package/dist/infrastructure/storage/json.js +222 -0
- package/dist/infrastructure/storage/json.js.map +1 -0
- package/dist/infrastructure/storage/paths.d.ts +11 -0
- package/dist/infrastructure/storage/paths.d.ts.map +1 -0
- package/dist/infrastructure/storage/paths.js +18 -0
- package/dist/infrastructure/storage/paths.js.map +1 -0
- package/dist/infrastructure/tls/lan-certificate.d.ts +11 -0
- package/dist/infrastructure/tls/lan-certificate.d.ts.map +1 -0
- package/dist/infrastructure/tls/lan-certificate.js +209 -0
- package/dist/infrastructure/tls/lan-certificate.js.map +1 -0
- package/dist/logging.d.ts +58 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +348 -0
- package/dist/logging.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +422 -0
- package/dist/main.js.map +1 -0
- package/dist/nerve-system-prompt.d.ts +17 -0
- package/dist/nerve-system-prompt.d.ts.map +1 -0
- package/dist/nerve-system-prompt.js +161 -0
- package/dist/nerve-system-prompt.js.map +1 -0
- package/dist/oauth-flow.d.ts +27 -0
- package/dist/oauth-flow.d.ts.map +1 -0
- package/dist/oauth-flow.js +268 -0
- package/dist/oauth-flow.js.map +1 -0
- package/dist/plan-paths.d.ts +6 -0
- package/dist/plan-paths.d.ts.map +1 -0
- package/dist/plan-paths.js +30 -0
- package/dist/plan-paths.js.map +1 -0
- package/dist/plan-service.d.ts +61 -0
- package/dist/plan-service.d.ts.map +1 -0
- package/dist/plan-service.js +255 -0
- package/dist/plan-service.js.map +1 -0
- package/dist/policy.d.ts +14 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +247 -0
- package/dist/policy.js.map +1 -0
- package/dist/process-manager.d.ts +72 -0
- package/dist/process-manager.d.ts.map +1 -0
- package/dist/process-manager.js +376 -0
- package/dist/process-manager.js.map +1 -0
- package/dist/prompt-text.d.ts +9 -0
- package/dist/prompt-text.d.ts.map +1 -0
- package/dist/prompt-text.js +48 -0
- package/dist/prompt-text.js.map +1 -0
- package/dist/registry/agent-lifecycle-service.d.ts +38 -0
- package/dist/registry/agent-lifecycle-service.d.ts.map +1 -0
- package/dist/registry/agent-lifecycle-service.js +199 -0
- package/dist/registry/agent-lifecycle-service.js.map +1 -0
- package/dist/registry/conversation-lifecycle-service.d.ts +35 -0
- package/dist/registry/conversation-lifecycle-service.d.ts.map +1 -0
- package/dist/registry/conversation-lifecycle-service.js +136 -0
- package/dist/registry/conversation-lifecycle-service.js.map +1 -0
- package/dist/registry/pinned-command-service.d.ts +11 -0
- package/dist/registry/pinned-command-service.d.ts.map +1 -0
- package/dist/registry/pinned-command-service.js +40 -0
- package/dist/registry/pinned-command-service.js.map +1 -0
- package/dist/registry/project-lifecycle-service.d.ts +22 -0
- package/dist/registry/project-lifecycle-service.d.ts.map +1 -0
- package/dist/registry/project-lifecycle-service.js +87 -0
- package/dist/registry/project-lifecycle-service.js.map +1 -0
- package/dist/registry/types.d.ts +25 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +2 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/registry.d.ts +977 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +356 -0
- package/dist/registry.js.map +1 -0
- package/dist/repositories/agent-repository.d.ts +12 -0
- package/dist/repositories/agent-repository.d.ts.map +1 -0
- package/dist/repositories/agent-repository.js +33 -0
- package/dist/repositories/agent-repository.js.map +1 -0
- package/dist/repositories/conversation-repository.d.ts +13 -0
- package/dist/repositories/conversation-repository.d.ts.map +1 -0
- package/dist/repositories/conversation-repository.js +39 -0
- package/dist/repositories/conversation-repository.js.map +1 -0
- package/dist/repositories/entry-repository.d.ts +15 -0
- package/dist/repositories/entry-repository.d.ts.map +1 -0
- package/dist/repositories/entry-repository.js +81 -0
- package/dist/repositories/entry-repository.js.map +1 -0
- package/dist/repositories/index.d.ts +7 -0
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +7 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/repositories/pinned-command-repository.d.ts +10 -0
- package/dist/repositories/pinned-command-repository.d.ts.map +1 -0
- package/dist/repositories/pinned-command-repository.js +28 -0
- package/dist/repositories/pinned-command-repository.js.map +1 -0
- package/dist/repositories/project-repository.d.ts +12 -0
- package/dist/repositories/project-repository.d.ts.map +1 -0
- package/dist/repositories/project-repository.js +33 -0
- package/dist/repositories/project-repository.js.map +1 -0
- package/dist/repositories/prompt-queue-repository.d.ts +28 -0
- package/dist/repositories/prompt-queue-repository.d.ts.map +1 -0
- package/dist/repositories/prompt-queue-repository.js +88 -0
- package/dist/repositories/prompt-queue-repository.js.map +1 -0
- package/dist/resource-loader.d.ts +15 -0
- package/dist/resource-loader.d.ts.map +1 -0
- package/dist/resource-loader.js +109 -0
- package/dist/resource-loader.js.map +1 -0
- package/dist/routes/agent-routes.d.ts +4 -0
- package/dist/routes/agent-routes.d.ts.map +1 -0
- package/dist/routes/agent-routes.js +58 -0
- package/dist/routes/agent-routes.js.map +1 -0
- package/dist/routes/auth-routes.d.ts +4 -0
- package/dist/routes/auth-routes.d.ts.map +1 -0
- package/dist/routes/auth-routes.js +70 -0
- package/dist/routes/auth-routes.js.map +1 -0
- package/dist/routes/completion-routes.d.ts +4 -0
- package/dist/routes/completion-routes.d.ts.map +1 -0
- package/dist/routes/completion-routes.js +49 -0
- package/dist/routes/completion-routes.js.map +1 -0
- package/dist/routes/conversation-routes.d.ts +4 -0
- package/dist/routes/conversation-routes.d.ts.map +1 -0
- package/dist/routes/conversation-routes.js +65 -0
- package/dist/routes/conversation-routes.js.map +1 -0
- package/dist/routes/filesystem-routes.d.ts +5 -0
- package/dist/routes/filesystem-routes.d.ts.map +1 -0
- package/dist/routes/filesystem-routes.js +341 -0
- package/dist/routes/filesystem-routes.js.map +1 -0
- package/dist/routes/git-routes.d.ts +4 -0
- package/dist/routes/git-routes.d.ts.map +1 -0
- package/dist/routes/git-routes.js +66 -0
- package/dist/routes/git-routes.js.map +1 -0
- package/dist/routes/index.d.ts +21 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +54 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/log-routes.d.ts +4 -0
- package/dist/routes/log-routes.d.ts.map +1 -0
- package/dist/routes/log-routes.js +55 -0
- package/dist/routes/log-routes.js.map +1 -0
- package/dist/routes/model-routes.d.ts +4 -0
- package/dist/routes/model-routes.d.ts.map +1 -0
- package/dist/routes/model-routes.js +8 -0
- package/dist/routes/model-routes.js.map +1 -0
- package/dist/routes/process-routes.d.ts +4 -0
- package/dist/routes/process-routes.d.ts.map +1 -0
- package/dist/routes/process-routes.js +43 -0
- package/dist/routes/process-routes.js.map +1 -0
- package/dist/routes/project-routes.d.ts +4 -0
- package/dist/routes/project-routes.d.ts.map +1 -0
- package/dist/routes/project-routes.js +42 -0
- package/dist/routes/project-routes.js.map +1 -0
- package/dist/routes/provider-catalog-routes.d.ts +4 -0
- package/dist/routes/provider-catalog-routes.d.ts.map +1 -0
- package/dist/routes/provider-catalog-routes.js +46 -0
- package/dist/routes/provider-catalog-routes.js.map +1 -0
- package/dist/routes/settings-routes.d.ts +4 -0
- package/dist/routes/settings-routes.d.ts.map +1 -0
- package/dist/routes/settings-routes.js +19 -0
- package/dist/routes/settings-routes.js.map +1 -0
- package/dist/routes/status-routes.d.ts +4 -0
- package/dist/routes/status-routes.d.ts.map +1 -0
- package/dist/routes/status-routes.js +20 -0
- package/dist/routes/status-routes.js.map +1 -0
- package/dist/routes/storage-routes.d.ts +4 -0
- package/dist/routes/storage-routes.d.ts.map +1 -0
- package/dist/routes/storage-routes.js +23 -0
- package/dist/routes/storage-routes.js.map +1 -0
- package/dist/routes/task-routes.d.ts +4 -0
- package/dist/routes/task-routes.d.ts.map +1 -0
- package/dist/routes/task-routes.js +67 -0
- package/dist/routes/task-routes.js.map +1 -0
- package/dist/routes/tool-routes.d.ts +4 -0
- package/dist/routes/tool-routes.d.ts.map +1 -0
- package/dist/routes/tool-routes.js +89 -0
- package/dist/routes/tool-routes.js.map +1 -0
- package/dist/routes/transcription-routes.d.ts +4 -0
- package/dist/routes/transcription-routes.d.ts.map +1 -0
- package/dist/routes/transcription-routes.js +38 -0
- package/dist/routes/transcription-routes.js.map +1 -0
- package/dist/routes/worker-routes.d.ts +4 -0
- package/dist/routes/worker-routes.d.ts.map +1 -0
- package/dist/routes/worker-routes.js +12 -0
- package/dist/routes/worker-routes.js.map +1 -0
- package/dist/runtime/runtime-composition.d.ts +64 -0
- package/dist/runtime/runtime-composition.d.ts.map +1 -0
- package/dist/runtime/runtime-composition.js +183 -0
- package/dist/runtime/runtime-composition.js.map +1 -0
- package/dist/runtime/runtime-state.d.ts +100 -0
- package/dist/runtime/runtime-state.d.ts.map +1 -0
- package/dist/runtime/runtime-state.js +74 -0
- package/dist/runtime/runtime-state.js.map +1 -0
- package/dist/secrets.d.ts +20 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +77 -0
- package/dist/secrets.js.map +1 -0
- package/dist/server.d.ts +43 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +270 -0
- package/dist/server.js.map +1 -0
- package/dist/storage.d.ts +2 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +2 -0
- package/dist/storage.js.map +1 -0
- package/dist/tool-service.d.ts +82 -0
- package/dist/tool-service.d.ts.map +1 -0
- package/dist/tool-service.js +409 -0
- package/dist/tool-service.js.map +1 -0
- package/dist/transcription-service.d.ts +15 -0
- package/dist/transcription-service.d.ts.map +1 -0
- package/dist/transcription-service.js +128 -0
- package/dist/transcription-service.js.map +1 -0
- package/dist/usage/anthropic-client.d.ts +9 -0
- package/dist/usage/anthropic-client.d.ts.map +1 -0
- package/dist/usage/anthropic-client.js +207 -0
- package/dist/usage/anthropic-client.js.map +1 -0
- package/dist/usage/codex-client.d.ts +18 -0
- package/dist/usage/codex-client.d.ts.map +1 -0
- package/dist/usage/codex-client.js +316 -0
- package/dist/usage/codex-client.js.map +1 -0
- package/dist/usage/subscription-usage-service.d.ts +42 -0
- package/dist/usage/subscription-usage-service.d.ts.map +1 -0
- package/dist/usage/subscription-usage-service.js +131 -0
- package/dist/usage/subscription-usage-service.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +17 -0
- package/dist/version.js.map +1 -0
- package/dist/web/apple-touch-icon.png +0 -0
- package/dist/web/assets/bash-B7CDPTg5.js +1 -0
- package/dist/web/assets/css-BsVw1vtW.js +1 -0
- package/dist/web/assets/diff-woXpYk--.js +1 -0
- package/dist/web/assets/dist-DVpGQCt0.js +4 -0
- package/dist/web/assets/dist-FQvzRocB.js +141 -0
- package/dist/web/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/dist/web/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/web/assets/html-BY76lXLH.js +1 -0
- package/dist/web/assets/index-DFKLdj_D.css +2 -0
- package/dist/web/assets/index-DP6SGqvJ.js +165 -0
- package/dist/web/assets/iosevka-latin-400-normal-7stTb90X.woff2 +0 -0
- package/dist/web/assets/iosevka-latin-500-normal-CQO8XnuS.woff2 +0 -0
- package/dist/web/assets/javascript-BgS3c2Ky.js +1 -0
- package/dist/web/assets/json-qhed-kSA.js +1 -0
- package/dist/web/assets/jsonc-CYpm1nAK.js +1 -0
- package/dist/web/assets/jsx-Bz0zcwM4.js +1 -0
- package/dist/web/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/web/assets/outfit-latin-400-normal-BGsTXAXT.woff2 +0 -0
- package/dist/web/assets/outfit-latin-400-normal-DMwTpYkH.woff +0 -0
- package/dist/web/assets/outfit-latin-500-normal-ClnHRwRh.woff +0 -0
- package/dist/web/assets/outfit-latin-500-normal-DKnIMDSk.woff2 +0 -0
- package/dist/web/assets/outfit-latin-600-normal-B7SfZ07L.woff2 +0 -0
- package/dist/web/assets/outfit-latin-600-normal-BEfTtDA7.woff +0 -0
- package/dist/web/assets/outfit-latin-700-normal-Cu9v6i1X.woff2 +0 -0
- package/dist/web/assets/outfit-latin-700-normal-D4itBLBr.woff +0 -0
- package/dist/web/assets/outfit-latin-ext-400-normal-5tcqmc2S.woff2 +0 -0
- package/dist/web/assets/outfit-latin-ext-400-normal-DHm7mdGe.woff +0 -0
- package/dist/web/assets/outfit-latin-ext-500-normal-DrCvqoFD.woff +0 -0
- package/dist/web/assets/outfit-latin-ext-500-normal-zeox_O30.woff2 +0 -0
- package/dist/web/assets/outfit-latin-ext-600-normal-B85nYjL1.woff2 +0 -0
- package/dist/web/assets/outfit-latin-ext-600-normal-CWJcPgd7.woff +0 -0
- package/dist/web/assets/outfit-latin-ext-700-normal-CI4iH74K.woff2 +0 -0
- package/dist/web/assets/outfit-latin-ext-700-normal-fjS8-Gm7.woff +0 -0
- package/dist/web/assets/python-gzcpVVnB.js +1 -0
- package/dist/web/assets/shellscript-CLZ0U2zV.js +1 -0
- package/dist/web/assets/svelte-Uaf2W_lJ.js +1 -0
- package/dist/web/assets/tsx-udAQXfEw.js +1 -0
- package/dist/web/assets/typescript-bsJCZSQ-.js +1 -0
- package/dist/web/assets/workbox-window.prod.es5-Bd17z0YL.js +2 -0
- package/dist/web/assets/yaml-rwi0_p6S.js +1 -0
- package/dist/web/favicon-16.png +0 -0
- package/dist/web/favicon-32.png +0 -0
- package/dist/web/favicon.svg +15 -0
- package/dist/web/index.html +25 -0
- package/dist/web/manifest.webmanifest +1 -0
- package/dist/web/pwa-192x192.png +0 -0
- package/dist/web/pwa-512x512.png +0 -0
- package/dist/web/pwa-maskable-512x512.png +0 -0
- package/dist/web/sw.js +1 -0
- package/dist/web/workbox-2fbc6a65.js +1 -0
- package/dist/worker-manager.d.ts +51 -0
- package/dist/worker-manager.d.ts.map +1 -0
- package/dist/worker-manager.js +116 -0
- package/dist/worker-manager.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,814 @@
|
|
|
1
|
+
import { mkdir } from "node:fs/promises";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
4
|
+
import { createId, } from "@nerve/shared";
|
|
5
|
+
import { createProcessLogCursor, defaultProcessSupervisor, isActiveProcessStatus, ProcessLogService, ProcessReadinessService, ProcessRepository, } from "./index.js";
|
|
6
|
+
import { UnconfiguredProcessLaunchConfigStore, } from "./process-launch-config.store.js";
|
|
7
|
+
export class ProcessManager {
|
|
8
|
+
events;
|
|
9
|
+
index;
|
|
10
|
+
logger;
|
|
11
|
+
processes = new Map();
|
|
12
|
+
managed = new Map();
|
|
13
|
+
processRepository;
|
|
14
|
+
processLogs;
|
|
15
|
+
processReadiness = new ProcessReadinessService();
|
|
16
|
+
supervisor;
|
|
17
|
+
launchConfigs;
|
|
18
|
+
constructor(storage, events, index, logger, options = {}) {
|
|
19
|
+
this.events = events;
|
|
20
|
+
this.index = index;
|
|
21
|
+
this.logger = logger;
|
|
22
|
+
this.supervisor = options.supervisor ?? defaultProcessSupervisor;
|
|
23
|
+
this.launchConfigs =
|
|
24
|
+
options.launchConfigs ?? new UnconfiguredProcessLaunchConfigStore();
|
|
25
|
+
this.processRepository = new ProcessRepository(storage);
|
|
26
|
+
this.processLogs = new ProcessLogService(events);
|
|
27
|
+
}
|
|
28
|
+
async hydrate() {
|
|
29
|
+
for (const persisted of await this.processRepository.hydrate()) {
|
|
30
|
+
const wasActive = isActiveProcessStatus(persisted.status);
|
|
31
|
+
const record = wasActive
|
|
32
|
+
? this.markHydratedRecordOrphaned(persisted)
|
|
33
|
+
: persisted;
|
|
34
|
+
await this.upsertProcess(record);
|
|
35
|
+
if (wasActive) {
|
|
36
|
+
await this.events.publish("process.orphaned", { process: record });
|
|
37
|
+
await this.logger?.warn("Process supervision lost after daemon restart", {
|
|
38
|
+
processId: record.id,
|
|
39
|
+
projectId: record.projectId,
|
|
40
|
+
conversationId: record.conversationId,
|
|
41
|
+
agentId: record.agentId,
|
|
42
|
+
context: {
|
|
43
|
+
pid: record.runtime?.childPid,
|
|
44
|
+
processGroupId: record.runtime?.processGroupId,
|
|
45
|
+
platform: record.runtime?.platform,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
listProcesses() {
|
|
52
|
+
return [...this.processes.values()].sort((a, b) => b.startedAt.localeCompare(a.startedAt));
|
|
53
|
+
}
|
|
54
|
+
getProcess(processId) {
|
|
55
|
+
const process = this.processes.get(processId);
|
|
56
|
+
if (!process)
|
|
57
|
+
throw new Error("Process not found.");
|
|
58
|
+
return process;
|
|
59
|
+
}
|
|
60
|
+
findProcessByName(name) {
|
|
61
|
+
return this.listProcesses().find((process) => process.name === name);
|
|
62
|
+
}
|
|
63
|
+
async startProcess(request) {
|
|
64
|
+
const now = new Date().toISOString();
|
|
65
|
+
const id = createId("proc");
|
|
66
|
+
const dir = this.processDir(id);
|
|
67
|
+
await mkdir(dir, { recursive: true, mode: 0o755 });
|
|
68
|
+
const envInfo = buildProcessEnvInfo(request.env);
|
|
69
|
+
if (envInfo) {
|
|
70
|
+
await this.launchConfigs.write(id, {
|
|
71
|
+
version: 1,
|
|
72
|
+
env: request.env,
|
|
73
|
+
createdAt: now,
|
|
74
|
+
updatedAt: now,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const readiness = this.processReadiness.buildReadiness(request);
|
|
78
|
+
const record = {
|
|
79
|
+
id,
|
|
80
|
+
name: request.name,
|
|
81
|
+
workerId: request.workerId,
|
|
82
|
+
projectId: request.projectId,
|
|
83
|
+
conversationId: request.conversationId,
|
|
84
|
+
agentId: request.agentId,
|
|
85
|
+
cwd: resolve(request.cwd),
|
|
86
|
+
command: request.command,
|
|
87
|
+
envInfo,
|
|
88
|
+
status: "starting",
|
|
89
|
+
readiness,
|
|
90
|
+
stdoutPath: join(dir, "stdout.log"),
|
|
91
|
+
stderrPath: join(dir, "stderr.log"),
|
|
92
|
+
logsPath: join(dir, "logs.jsonl"),
|
|
93
|
+
startedAt: now,
|
|
94
|
+
updatedAt: now,
|
|
95
|
+
restartedFromProcessId: request.restartedFromProcessId,
|
|
96
|
+
};
|
|
97
|
+
const readinessPattern = this.processReadiness.compilePattern(request.readyPattern);
|
|
98
|
+
await this.upsertProcess(record);
|
|
99
|
+
await this.events.publish("process.created", { process: record });
|
|
100
|
+
await this.logger?.info("Process created", {
|
|
101
|
+
processId: record.id,
|
|
102
|
+
projectId: record.projectId,
|
|
103
|
+
conversationId: record.conversationId,
|
|
104
|
+
agentId: record.agentId,
|
|
105
|
+
context: {
|
|
106
|
+
name: record.name,
|
|
107
|
+
cwd: record.cwd,
|
|
108
|
+
command: record.command,
|
|
109
|
+
envKeyCount: record.envInfo?.keys.length ?? 0,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
const spawned = this.supervisor.spawn(request.command, {
|
|
113
|
+
cwd: record.cwd,
|
|
114
|
+
env: request.env,
|
|
115
|
+
});
|
|
116
|
+
const { child, runtime } = spawned;
|
|
117
|
+
await this.updateProcess(record.id, { runtime });
|
|
118
|
+
const closePromise = new Promise((resolveClose) => {
|
|
119
|
+
child.once("close", (exitCode, signal) => {
|
|
120
|
+
resolveClose({ exitCode, signal });
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
const managed = {
|
|
124
|
+
child,
|
|
125
|
+
...createProcessLogCursor(await this.processLogs.latestLogSeq(record.logsPath)),
|
|
126
|
+
stopping: false,
|
|
127
|
+
finalized: false,
|
|
128
|
+
closePromise,
|
|
129
|
+
readinessPattern,
|
|
130
|
+
};
|
|
131
|
+
managed.finalizationPromise = closePromise
|
|
132
|
+
.then(({ exitCode, signal }) => this.markProcessExited(record.id, exitCode, signal))
|
|
133
|
+
.catch(async (error) => {
|
|
134
|
+
if (this.logger) {
|
|
135
|
+
await this.logger
|
|
136
|
+
.error("Process finalization failed", {
|
|
137
|
+
processId: record.id,
|
|
138
|
+
projectId: record.projectId,
|
|
139
|
+
conversationId: record.conversationId,
|
|
140
|
+
agentId: record.agentId,
|
|
141
|
+
error,
|
|
142
|
+
})
|
|
143
|
+
.catch(() => undefined);
|
|
144
|
+
}
|
|
145
|
+
return undefined;
|
|
146
|
+
});
|
|
147
|
+
this.managed.set(record.id, managed);
|
|
148
|
+
child.stdout?.on("data", (chunk) => {
|
|
149
|
+
void this.captureOutput(record.id, "stdout", chunk);
|
|
150
|
+
});
|
|
151
|
+
child.stderr?.on("data", (chunk) => {
|
|
152
|
+
void this.captureOutput(record.id, "stderr", chunk);
|
|
153
|
+
});
|
|
154
|
+
child.on("error", (error) => {
|
|
155
|
+
void this.markProcessError(record.id, error.message);
|
|
156
|
+
});
|
|
157
|
+
await this.updateProcess(record.id, { status: "running" });
|
|
158
|
+
await this.events.publish("process.started", {
|
|
159
|
+
process: this.getProcess(record.id),
|
|
160
|
+
pid: runtime.childPid,
|
|
161
|
+
runtime,
|
|
162
|
+
});
|
|
163
|
+
await this.logger?.info("Process started", {
|
|
164
|
+
processId: record.id,
|
|
165
|
+
projectId: record.projectId,
|
|
166
|
+
conversationId: record.conversationId,
|
|
167
|
+
agentId: record.agentId,
|
|
168
|
+
context: {
|
|
169
|
+
pid: runtime.childPid,
|
|
170
|
+
processGroupId: runtime.processGroupId,
|
|
171
|
+
platform: runtime.platform,
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
await this.waitForReadiness(record.id);
|
|
175
|
+
return this.getProcess(record.id);
|
|
176
|
+
}
|
|
177
|
+
async stopProcess(processId, request = {}) {
|
|
178
|
+
const record = this.getProcess(processId);
|
|
179
|
+
if (record.status === "orphaned") {
|
|
180
|
+
return this.cleanupOrphanedProcess(record.id, request);
|
|
181
|
+
}
|
|
182
|
+
const managed = this.managed.get(record.id);
|
|
183
|
+
if (!managed?.child || !isActiveProcessStatus(record.status))
|
|
184
|
+
return record;
|
|
185
|
+
const signal = request.signal ?? "SIGTERM";
|
|
186
|
+
managed.stopping = true;
|
|
187
|
+
const stopping = await this.updateProcess(record.id, {
|
|
188
|
+
status: "stopping",
|
|
189
|
+
});
|
|
190
|
+
await this.events.publish("process.stop_requested", {
|
|
191
|
+
processId: record.id,
|
|
192
|
+
signal,
|
|
193
|
+
});
|
|
194
|
+
await this.logger?.info("Process stop requested", {
|
|
195
|
+
processId: record.id,
|
|
196
|
+
projectId: record.projectId,
|
|
197
|
+
conversationId: record.conversationId,
|
|
198
|
+
agentId: record.agentId,
|
|
199
|
+
context: { signal },
|
|
200
|
+
});
|
|
201
|
+
void this.requestTermination(stopping, managed.child, signal, "stop requested");
|
|
202
|
+
const timeoutMs = request.timeoutMs ?? 5000;
|
|
203
|
+
const timeoutResult = Symbol("process-stop-timeout");
|
|
204
|
+
let timeout;
|
|
205
|
+
const finalized = await Promise.race([
|
|
206
|
+
managed.finalizationPromise ?? Promise.resolve(undefined),
|
|
207
|
+
new Promise((resolveTimeout) => {
|
|
208
|
+
timeout = setTimeout(() => resolveTimeout(timeoutResult), timeoutMs);
|
|
209
|
+
}),
|
|
210
|
+
]).finally(() => {
|
|
211
|
+
if (timeout)
|
|
212
|
+
clearTimeout(timeout);
|
|
213
|
+
});
|
|
214
|
+
if (finalized !== timeoutResult) {
|
|
215
|
+
return finalized ?? this.getProcess(processId);
|
|
216
|
+
}
|
|
217
|
+
void this.requestTermination(this.processes.get(processId) ?? stopping, managed.child, "SIGKILL", `stop timed out after ${timeoutMs}ms`);
|
|
218
|
+
return this.forceFinalizeStoppedProcess(processId, "SIGKILL", `Process did not close within ${timeoutMs}ms after stop was requested.`);
|
|
219
|
+
}
|
|
220
|
+
async restartProcess(processId) {
|
|
221
|
+
const record = this.getProcess(processId);
|
|
222
|
+
const env = await this.envForRestart(record);
|
|
223
|
+
if (record.status === "orphaned") {
|
|
224
|
+
await this.cleanupOrphanedProcess(record.id, { timeoutMs: 5000 });
|
|
225
|
+
}
|
|
226
|
+
else if (isActiveProcessStatus(record.status)) {
|
|
227
|
+
await this.stopProcess(processId);
|
|
228
|
+
}
|
|
229
|
+
return this.startProcess({
|
|
230
|
+
name: record.name,
|
|
231
|
+
workerId: record.workerId,
|
|
232
|
+
projectId: record.projectId,
|
|
233
|
+
conversationId: record.conversationId,
|
|
234
|
+
agentId: record.agentId,
|
|
235
|
+
cwd: record.cwd,
|
|
236
|
+
command: record.command,
|
|
237
|
+
env,
|
|
238
|
+
readyOnUrl: record.readiness.readyOnUrl,
|
|
239
|
+
readyPattern: record.readiness.readyPattern,
|
|
240
|
+
readyTimeoutMs: record.readiness.timeoutMs,
|
|
241
|
+
restartedFromProcessId: record.id,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
async removeProcess(processId) {
|
|
245
|
+
const record = this.getProcess(processId);
|
|
246
|
+
if (isActiveProcessStatus(record.status)) {
|
|
247
|
+
throw new Error("Stop the process before removing it.");
|
|
248
|
+
}
|
|
249
|
+
await this.launchConfigs.remove(record.id);
|
|
250
|
+
const managed = this.managed.get(record.id);
|
|
251
|
+
if (managed?.readinessTimer)
|
|
252
|
+
clearTimeout(managed.readinessTimer);
|
|
253
|
+
this.managed.delete(record.id);
|
|
254
|
+
this.processes.delete(record.id);
|
|
255
|
+
this.index.deleteProcess(record.id);
|
|
256
|
+
await this.processRepository.remove(record.id);
|
|
257
|
+
await this.events.publish("process.removed", { processId: record.id });
|
|
258
|
+
await this.logger?.info("Process removed", {
|
|
259
|
+
processId: record.id,
|
|
260
|
+
projectId: record.projectId,
|
|
261
|
+
conversationId: record.conversationId,
|
|
262
|
+
agentId: record.agentId,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
async pruneProcesses() {
|
|
266
|
+
const removed = [];
|
|
267
|
+
for (const record of this.listProcesses()) {
|
|
268
|
+
if (isActiveProcessStatus(record.status))
|
|
269
|
+
continue;
|
|
270
|
+
try {
|
|
271
|
+
await this.removeProcess(record.id);
|
|
272
|
+
removed.push(record.id);
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
// Best-effort: skip processes that can't be removed right now.
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return removed;
|
|
279
|
+
}
|
|
280
|
+
activeProcessesForConversations(conversationIds) {
|
|
281
|
+
const conversations = new Set(conversationIds);
|
|
282
|
+
if (conversations.size === 0)
|
|
283
|
+
return [];
|
|
284
|
+
return this.listProcesses().filter((record) => record.conversationId !== undefined &&
|
|
285
|
+
conversations.has(record.conversationId) &&
|
|
286
|
+
isActiveProcessStatus(record.status));
|
|
287
|
+
}
|
|
288
|
+
async removeInactiveProcessesForConversations(conversationIds) {
|
|
289
|
+
const conversations = new Set(conversationIds);
|
|
290
|
+
if (conversations.size === 0)
|
|
291
|
+
return [];
|
|
292
|
+
const removed = [];
|
|
293
|
+
for (const record of this.listProcesses()) {
|
|
294
|
+
if (!record.conversationId || !conversations.has(record.conversationId)) {
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
if (isActiveProcessStatus(record.status))
|
|
298
|
+
continue;
|
|
299
|
+
try {
|
|
300
|
+
await this.removeProcess(record.id);
|
|
301
|
+
removed.push(record.id);
|
|
302
|
+
}
|
|
303
|
+
catch {
|
|
304
|
+
// Best-effort: skip processes that can't be removed right now.
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return removed;
|
|
308
|
+
}
|
|
309
|
+
async queryLogs(processId, query = {}) {
|
|
310
|
+
return this.processLogs.queryLogs(this.getProcess(processId), query);
|
|
311
|
+
}
|
|
312
|
+
async envForRestart(record) {
|
|
313
|
+
if (!record.envInfo?.persisted)
|
|
314
|
+
return undefined;
|
|
315
|
+
const config = await this.launchConfigs.read(record.id);
|
|
316
|
+
if (!config) {
|
|
317
|
+
throw new Error("Process was started with persisted env metadata, but launch env is missing; refusing to restart without env.");
|
|
318
|
+
}
|
|
319
|
+
const env = config.env;
|
|
320
|
+
const missingKeys = record.envInfo.keys.filter((key) => !env || !Object.hasOwn(env, key));
|
|
321
|
+
if (missingKeys.length > 0) {
|
|
322
|
+
throw new Error(`Process launch env is missing persisted keys (${missingKeys.join(", ")}); refusing to restart without env.`);
|
|
323
|
+
}
|
|
324
|
+
return env ? { ...env } : undefined;
|
|
325
|
+
}
|
|
326
|
+
async captureOutput(processId, stream, chunk) {
|
|
327
|
+
const record = this.processes.get(processId);
|
|
328
|
+
const managed = this.managed.get(processId);
|
|
329
|
+
if (!record || !managed)
|
|
330
|
+
return;
|
|
331
|
+
await this.processLogs.captureOutput(record, managed, stream, chunk, async (event) => this.checkReadiness(record.id, event));
|
|
332
|
+
}
|
|
333
|
+
async flushProcessOutputBuffers(processId) {
|
|
334
|
+
const record = this.processes.get(processId);
|
|
335
|
+
const managed = this.managed.get(processId);
|
|
336
|
+
if (!record || !managed)
|
|
337
|
+
return;
|
|
338
|
+
try {
|
|
339
|
+
await this.processLogs.flushOutputBuffers(record, managed, async (event) => this.checkReadiness(record.id, event));
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
await this.logger
|
|
343
|
+
?.warn("Process output flush failed", {
|
|
344
|
+
processId: record.id,
|
|
345
|
+
projectId: record.projectId,
|
|
346
|
+
conversationId: record.conversationId,
|
|
347
|
+
agentId: record.agentId,
|
|
348
|
+
error,
|
|
349
|
+
})
|
|
350
|
+
.catch(() => undefined);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
async checkReadiness(processId, log) {
|
|
354
|
+
const record = this.processes.get(processId);
|
|
355
|
+
const managed = this.managed.get(processId);
|
|
356
|
+
if (!record || !managed || record.readiness.outcome !== "pending")
|
|
357
|
+
return;
|
|
358
|
+
const matched = this.processReadiness.match(record, managed.readinessPattern, log);
|
|
359
|
+
if (!matched)
|
|
360
|
+
return;
|
|
361
|
+
if (managed.readinessTimer)
|
|
362
|
+
clearTimeout(managed.readinessTimer);
|
|
363
|
+
const ready = await this.updateProcess(processId, {
|
|
364
|
+
status: "ready",
|
|
365
|
+
readiness: {
|
|
366
|
+
...record.readiness,
|
|
367
|
+
outcome: "ready",
|
|
368
|
+
matched,
|
|
369
|
+
readyAt: new Date().toISOString(),
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
await this.events.publish("process.ready", { process: ready, matched });
|
|
373
|
+
await this.logger?.info("Process ready", {
|
|
374
|
+
processId: ready.id,
|
|
375
|
+
projectId: ready.projectId,
|
|
376
|
+
conversationId: ready.conversationId,
|
|
377
|
+
agentId: ready.agentId,
|
|
378
|
+
context: { matched },
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
async waitForReadiness(processId) {
|
|
382
|
+
const record = this.getProcess(processId);
|
|
383
|
+
if (record.readiness.outcome !== "pending")
|
|
384
|
+
return;
|
|
385
|
+
const managed = this.managed.get(processId);
|
|
386
|
+
const timeoutMs = record.readiness.timeoutMs ?? 3000;
|
|
387
|
+
if (!managed || timeoutMs <= 0)
|
|
388
|
+
return;
|
|
389
|
+
await new Promise((resolveWait) => {
|
|
390
|
+
let unsubscribe = () => undefined;
|
|
391
|
+
const resolveOnce = () => {
|
|
392
|
+
unsubscribe();
|
|
393
|
+
resolveWait();
|
|
394
|
+
};
|
|
395
|
+
managed.readinessTimer = setTimeout(() => {
|
|
396
|
+
void this.markReadinessTimeout(processId).finally(resolveOnce);
|
|
397
|
+
}, timeoutMs);
|
|
398
|
+
unsubscribe = this.events.subscribe((event) => {
|
|
399
|
+
if (event.type !== "process.ready" && event.type !== "process.exited")
|
|
400
|
+
return;
|
|
401
|
+
const data = event.data;
|
|
402
|
+
if (data.process?.id !== processId)
|
|
403
|
+
return;
|
|
404
|
+
resolveOnce();
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
async markReadinessTimeout(processId) {
|
|
409
|
+
const record = this.processes.get(processId);
|
|
410
|
+
if (!record || record.readiness.outcome !== "pending")
|
|
411
|
+
return;
|
|
412
|
+
const updated = await this.updateProcess(processId, {
|
|
413
|
+
readiness: { ...record.readiness, outcome: "timeout" },
|
|
414
|
+
});
|
|
415
|
+
await this.events.publish("process.ready_timeout", { process: updated });
|
|
416
|
+
await this.logger?.warn("Process readiness timed out", {
|
|
417
|
+
processId: updated.id,
|
|
418
|
+
projectId: updated.projectId,
|
|
419
|
+
conversationId: updated.conversationId,
|
|
420
|
+
agentId: updated.agentId,
|
|
421
|
+
context: { timeoutMs: updated.readiness.timeoutMs },
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
async requestTermination(record, child, signal, reason) {
|
|
425
|
+
try {
|
|
426
|
+
const result = await this.supervisor.terminate(child, signal);
|
|
427
|
+
if (!result.error)
|
|
428
|
+
return;
|
|
429
|
+
if (this.logger) {
|
|
430
|
+
await this.logger
|
|
431
|
+
.warn("Process termination reported an error", {
|
|
432
|
+
processId: record.id,
|
|
433
|
+
projectId: record.projectId,
|
|
434
|
+
conversationId: record.conversationId,
|
|
435
|
+
agentId: record.agentId,
|
|
436
|
+
context: {
|
|
437
|
+
signal,
|
|
438
|
+
reason,
|
|
439
|
+
method: result.method,
|
|
440
|
+
error: result.error,
|
|
441
|
+
},
|
|
442
|
+
})
|
|
443
|
+
.catch(() => undefined);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
catch (error) {
|
|
447
|
+
if (this.logger) {
|
|
448
|
+
await this.logger
|
|
449
|
+
.warn("Process termination failed", {
|
|
450
|
+
processId: record.id,
|
|
451
|
+
projectId: record.projectId,
|
|
452
|
+
conversationId: record.conversationId,
|
|
453
|
+
agentId: record.agentId,
|
|
454
|
+
error,
|
|
455
|
+
context: { signal, reason },
|
|
456
|
+
})
|
|
457
|
+
.catch(() => undefined);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
markHydratedRecordOrphaned(record) {
|
|
462
|
+
return {
|
|
463
|
+
...record,
|
|
464
|
+
status: "orphaned",
|
|
465
|
+
error: this.orphanedHydrateMessage(record.runtime),
|
|
466
|
+
updatedAt: new Date().toISOString(),
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
orphanedHydrateMessage(runtime) {
|
|
470
|
+
if (runtime?.childPid) {
|
|
471
|
+
return `Process supervision was lost after daemon restart. Use process_stop to attempt cleanup of PID ${runtime.childPid}.`;
|
|
472
|
+
}
|
|
473
|
+
if (runtime?.processGroupId) {
|
|
474
|
+
return `Process supervision was lost after daemon restart. Use process_stop to attempt cleanup of process group ${runtime.processGroupId}.`;
|
|
475
|
+
}
|
|
476
|
+
return "Process supervision was lost after daemon restart, and no PID metadata was captured.";
|
|
477
|
+
}
|
|
478
|
+
async cleanupOrphanedProcess(processId, request) {
|
|
479
|
+
const record = this.getProcess(processId);
|
|
480
|
+
if (record.status !== "orphaned")
|
|
481
|
+
return record;
|
|
482
|
+
const validationError = this.orphanCleanupValidationError(record.runtime);
|
|
483
|
+
if (validationError) {
|
|
484
|
+
await this.failOrphanCleanup(record, validationError);
|
|
485
|
+
}
|
|
486
|
+
const runtime = record.runtime;
|
|
487
|
+
const initialSignal = request.signal ?? "SIGTERM";
|
|
488
|
+
const timeoutMs = request.timeoutMs ?? 5000;
|
|
489
|
+
await this.events.publish("process.stop_requested", {
|
|
490
|
+
processId: record.id,
|
|
491
|
+
signal: initialSignal,
|
|
492
|
+
orphaned: true,
|
|
493
|
+
});
|
|
494
|
+
await this.logger?.info("Orphaned process cleanup requested", {
|
|
495
|
+
processId: record.id,
|
|
496
|
+
projectId: record.projectId,
|
|
497
|
+
conversationId: record.conversationId,
|
|
498
|
+
agentId: record.agentId,
|
|
499
|
+
context: this.runtimeLogContext(runtime, { signal: initialSignal }),
|
|
500
|
+
});
|
|
501
|
+
if (runtime.platform === "win32") {
|
|
502
|
+
const result = await this.terminateRuntimeForCleanup(record, runtime, "SIGKILL");
|
|
503
|
+
if (!result.attempted || result.error) {
|
|
504
|
+
await this.failOrphanCleanup(record, result.error ?? "Could not clean up orphaned process runtime target.", { method: result.method, signal: "SIGKILL" });
|
|
505
|
+
}
|
|
506
|
+
return this.finalizeOrphanCleanup(record.id, "SIGKILL", runtime, {
|
|
507
|
+
method: result.method,
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
const initialResult = await this.terminateRuntimeForCleanup(record, runtime, initialSignal);
|
|
511
|
+
if (!initialResult.attempted || initialResult.method === "none") {
|
|
512
|
+
await this.failOrphanCleanup(record, initialResult.error ??
|
|
513
|
+
"Could not signal orphaned process runtime target.", { method: initialResult.method, signal: initialSignal });
|
|
514
|
+
}
|
|
515
|
+
if (initialResult.error) {
|
|
516
|
+
await this.logger?.warn("Orphaned process cleanup signal reported an error", {
|
|
517
|
+
processId: record.id,
|
|
518
|
+
projectId: record.projectId,
|
|
519
|
+
conversationId: record.conversationId,
|
|
520
|
+
agentId: record.agentId,
|
|
521
|
+
context: this.runtimeLogContext(runtime, {
|
|
522
|
+
signal: initialSignal,
|
|
523
|
+
method: initialResult.method,
|
|
524
|
+
error: initialResult.error,
|
|
525
|
+
}),
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
let finalSignal = initialSignal;
|
|
529
|
+
if (!(await this.waitForRuntimeTargetExit(runtime, timeoutMs))) {
|
|
530
|
+
finalSignal = "SIGKILL";
|
|
531
|
+
const killResult = await this.terminateRuntimeForCleanup(record, runtime, finalSignal);
|
|
532
|
+
if (!killResult.attempted || killResult.method === "none") {
|
|
533
|
+
await this.failOrphanCleanup(record, killResult.error ??
|
|
534
|
+
"Could not force-kill orphaned process runtime target.", { method: killResult.method, signal: finalSignal });
|
|
535
|
+
}
|
|
536
|
+
if (killResult.error && (await this.isRuntimeTargetAlive(runtime))) {
|
|
537
|
+
await this.failOrphanCleanup(record, killResult.error, {
|
|
538
|
+
method: killResult.method,
|
|
539
|
+
signal: finalSignal,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
return this.finalizeOrphanCleanup(record.id, finalSignal, runtime);
|
|
544
|
+
}
|
|
545
|
+
orphanCleanupValidationError(runtime) {
|
|
546
|
+
if (!runtime) {
|
|
547
|
+
return "Cannot clean up orphaned process because no PID metadata was captured.";
|
|
548
|
+
}
|
|
549
|
+
if (runtime.platform !== process.platform) {
|
|
550
|
+
return `Cannot clean up process spawned on ${runtime.platform} from ${process.platform}.`;
|
|
551
|
+
}
|
|
552
|
+
if (runtime.platform === "win32" && !runtime.childPid) {
|
|
553
|
+
return "Cannot clean up orphaned process because no child PID metadata was captured.";
|
|
554
|
+
}
|
|
555
|
+
if (runtime.platform !== "win32" &&
|
|
556
|
+
!runtime.processGroupId &&
|
|
557
|
+
!runtime.childPid) {
|
|
558
|
+
return "Cannot clean up orphaned process because no process-group or child PID metadata was captured.";
|
|
559
|
+
}
|
|
560
|
+
return undefined;
|
|
561
|
+
}
|
|
562
|
+
async terminateRuntimeForCleanup(record, runtime, signal) {
|
|
563
|
+
try {
|
|
564
|
+
return await this.supervisor.terminateRuntime(runtime, signal);
|
|
565
|
+
}
|
|
566
|
+
catch (error) {
|
|
567
|
+
await this.logger?.warn("Orphaned process cleanup termination threw", {
|
|
568
|
+
processId: record.id,
|
|
569
|
+
projectId: record.projectId,
|
|
570
|
+
conversationId: record.conversationId,
|
|
571
|
+
agentId: record.agentId,
|
|
572
|
+
error,
|
|
573
|
+
context: this.runtimeLogContext(runtime, { signal }),
|
|
574
|
+
});
|
|
575
|
+
return {
|
|
576
|
+
attempted: false,
|
|
577
|
+
method: "none",
|
|
578
|
+
error: this.errorMessage(error),
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
async waitForRuntimeTargetExit(runtime, timeoutMs) {
|
|
583
|
+
const deadline = Date.now() + Math.max(0, timeoutMs);
|
|
584
|
+
while (true) {
|
|
585
|
+
if (!(await this.isRuntimeTargetAlive(runtime)))
|
|
586
|
+
return true;
|
|
587
|
+
const remaining = deadline - Date.now();
|
|
588
|
+
if (remaining <= 0)
|
|
589
|
+
return false;
|
|
590
|
+
await delay(Math.min(50, remaining));
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
async isRuntimeTargetAlive(runtime) {
|
|
594
|
+
try {
|
|
595
|
+
return await this.supervisor.isRuntimeTargetAlive(runtime);
|
|
596
|
+
}
|
|
597
|
+
catch (error) {
|
|
598
|
+
await this.logger?.warn("Orphaned process liveness check failed", {
|
|
599
|
+
error,
|
|
600
|
+
context: this.runtimeLogContext(runtime),
|
|
601
|
+
});
|
|
602
|
+
return true;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
async finalizeOrphanCleanup(processId, finalSignal, runtime, context = {}) {
|
|
606
|
+
const record = this.getProcess(processId);
|
|
607
|
+
if (record.status !== "orphaned")
|
|
608
|
+
return record;
|
|
609
|
+
const managed = this.managed.get(processId);
|
|
610
|
+
if (managed?.readinessTimer)
|
|
611
|
+
clearTimeout(managed.readinessTimer);
|
|
612
|
+
const readiness = record.readiness.outcome === "pending"
|
|
613
|
+
? { ...record.readiness, outcome: "exited" }
|
|
614
|
+
: record.readiness;
|
|
615
|
+
const updated = await this.updateProcess(processId, {
|
|
616
|
+
status: "stopped",
|
|
617
|
+
readiness,
|
|
618
|
+
exitedAt: new Date().toISOString(),
|
|
619
|
+
exitCode: null,
|
|
620
|
+
signal: finalSignal,
|
|
621
|
+
error: undefined,
|
|
622
|
+
});
|
|
623
|
+
this.managed.delete(processId);
|
|
624
|
+
await this.events.publish("process.exited", { process: updated });
|
|
625
|
+
await this.events.publish("process.orphan_cleanup_succeeded", {
|
|
626
|
+
process: updated,
|
|
627
|
+
runtime,
|
|
628
|
+
signal: finalSignal,
|
|
629
|
+
...context,
|
|
630
|
+
});
|
|
631
|
+
await this.logger?.info("Orphaned process cleanup completed", {
|
|
632
|
+
processId: updated.id,
|
|
633
|
+
projectId: updated.projectId,
|
|
634
|
+
conversationId: updated.conversationId,
|
|
635
|
+
agentId: updated.agentId,
|
|
636
|
+
context: this.runtimeLogContext(runtime, {
|
|
637
|
+
signal: finalSignal,
|
|
638
|
+
...context,
|
|
639
|
+
}),
|
|
640
|
+
});
|
|
641
|
+
return updated;
|
|
642
|
+
}
|
|
643
|
+
async failOrphanCleanup(record, message, context = {}) {
|
|
644
|
+
const updated = await this.updateProcess(record.id, { error: message });
|
|
645
|
+
await this.events.publish("process.cleanup_failed", {
|
|
646
|
+
process: updated,
|
|
647
|
+
error: message,
|
|
648
|
+
orphaned: true,
|
|
649
|
+
...context,
|
|
650
|
+
});
|
|
651
|
+
await this.logger?.warn("Orphaned process cleanup failed", {
|
|
652
|
+
processId: updated.id,
|
|
653
|
+
projectId: updated.projectId,
|
|
654
|
+
conversationId: updated.conversationId,
|
|
655
|
+
agentId: updated.agentId,
|
|
656
|
+
context: this.runtimeLogContext(updated.runtime, {
|
|
657
|
+
error: message,
|
|
658
|
+
...context,
|
|
659
|
+
}),
|
|
660
|
+
});
|
|
661
|
+
throw new Error(message);
|
|
662
|
+
}
|
|
663
|
+
runtimeLogContext(runtime, extra = {}) {
|
|
664
|
+
return {
|
|
665
|
+
pid: runtime?.childPid,
|
|
666
|
+
processGroupId: runtime?.processGroupId,
|
|
667
|
+
platform: runtime?.platform,
|
|
668
|
+
detached: runtime?.detached,
|
|
669
|
+
shell: runtime?.shell,
|
|
670
|
+
spawnedAt: runtime?.spawnedAt,
|
|
671
|
+
...extra,
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
errorMessage(error) {
|
|
675
|
+
return error instanceof Error ? error.message : String(error);
|
|
676
|
+
}
|
|
677
|
+
async forceFinalizeStoppedProcess(processId, signal, reason) {
|
|
678
|
+
const record = this.getProcess(processId);
|
|
679
|
+
if (!isActiveProcessStatus(record.status))
|
|
680
|
+
return record;
|
|
681
|
+
const managed = this.managed.get(processId);
|
|
682
|
+
if (managed?.readinessTimer)
|
|
683
|
+
clearTimeout(managed.readinessTimer);
|
|
684
|
+
if (managed)
|
|
685
|
+
managed.finalized = true;
|
|
686
|
+
await this.flushProcessOutputBuffers(processId);
|
|
687
|
+
const freshRecord = this.processes.get(processId) ?? record;
|
|
688
|
+
const readiness = freshRecord.readiness.outcome === "pending"
|
|
689
|
+
? { ...freshRecord.readiness, outcome: "exited" }
|
|
690
|
+
: freshRecord.readiness;
|
|
691
|
+
const updated = await this.updateProcess(processId, {
|
|
692
|
+
status: "stopped",
|
|
693
|
+
readiness,
|
|
694
|
+
exitedAt: new Date().toISOString(),
|
|
695
|
+
exitCode: null,
|
|
696
|
+
signal,
|
|
697
|
+
});
|
|
698
|
+
this.managed.delete(processId);
|
|
699
|
+
await this.events.publish("process.exited", { process: updated });
|
|
700
|
+
await this.logger?.warn("Process stop force-finalized", {
|
|
701
|
+
processId: updated.id,
|
|
702
|
+
projectId: updated.projectId,
|
|
703
|
+
conversationId: updated.conversationId,
|
|
704
|
+
agentId: updated.agentId,
|
|
705
|
+
context: { signal, reason },
|
|
706
|
+
});
|
|
707
|
+
return updated;
|
|
708
|
+
}
|
|
709
|
+
async markProcessExited(processId, exitCode, signal) {
|
|
710
|
+
const record = this.processes.get(processId);
|
|
711
|
+
const managed = this.managed.get(processId);
|
|
712
|
+
if (!record)
|
|
713
|
+
return undefined;
|
|
714
|
+
if (!isActiveProcessStatus(record.status))
|
|
715
|
+
return record;
|
|
716
|
+
if (managed?.finalized)
|
|
717
|
+
return record;
|
|
718
|
+
if (managed?.readinessTimer)
|
|
719
|
+
clearTimeout(managed.readinessTimer);
|
|
720
|
+
if (managed)
|
|
721
|
+
managed.finalized = true;
|
|
722
|
+
await this.flushProcessOutputBuffers(processId);
|
|
723
|
+
const freshRecord = this.processes.get(processId);
|
|
724
|
+
if (!freshRecord)
|
|
725
|
+
return undefined;
|
|
726
|
+
if (!isActiveProcessStatus(freshRecord.status))
|
|
727
|
+
return freshRecord;
|
|
728
|
+
const status = managed?.stopping
|
|
729
|
+
? "stopped"
|
|
730
|
+
: exitCode === 0
|
|
731
|
+
? "exited"
|
|
732
|
+
: "error";
|
|
733
|
+
const readiness = freshRecord.readiness.outcome === "pending"
|
|
734
|
+
? { ...freshRecord.readiness, outcome: "exited" }
|
|
735
|
+
: freshRecord.readiness;
|
|
736
|
+
const updated = await this.updateProcess(processId, {
|
|
737
|
+
status,
|
|
738
|
+
readiness,
|
|
739
|
+
exitedAt: new Date().toISOString(),
|
|
740
|
+
exitCode,
|
|
741
|
+
signal,
|
|
742
|
+
});
|
|
743
|
+
this.managed.delete(processId);
|
|
744
|
+
await this.events.publish("process.exited", { process: updated });
|
|
745
|
+
await this.logger?.[status === "error" ? "error" : "info"]("Process exited", {
|
|
746
|
+
processId: updated.id,
|
|
747
|
+
projectId: updated.projectId,
|
|
748
|
+
conversationId: updated.conversationId,
|
|
749
|
+
agentId: updated.agentId,
|
|
750
|
+
context: { exitCode, signal, status },
|
|
751
|
+
});
|
|
752
|
+
return updated;
|
|
753
|
+
}
|
|
754
|
+
async markProcessError(processId, message) {
|
|
755
|
+
const record = this.processes.get(processId);
|
|
756
|
+
const managed = this.managed.get(processId);
|
|
757
|
+
if (!record || !isActiveProcessStatus(record.status))
|
|
758
|
+
return;
|
|
759
|
+
if (managed?.finalized)
|
|
760
|
+
return;
|
|
761
|
+
if (managed?.readinessTimer)
|
|
762
|
+
clearTimeout(managed.readinessTimer);
|
|
763
|
+
if (managed)
|
|
764
|
+
managed.finalized = true;
|
|
765
|
+
await this.flushProcessOutputBuffers(processId);
|
|
766
|
+
const freshRecord = this.processes.get(processId);
|
|
767
|
+
if (!freshRecord || !isActiveProcessStatus(freshRecord.status))
|
|
768
|
+
return;
|
|
769
|
+
const updated = await this.updateProcess(processId, {
|
|
770
|
+
status: "error",
|
|
771
|
+
error: message,
|
|
772
|
+
});
|
|
773
|
+
this.managed.delete(processId);
|
|
774
|
+
await this.events.publish("process.error", { process: updated, message });
|
|
775
|
+
await this.logger?.error("Process error", {
|
|
776
|
+
processId: updated.id,
|
|
777
|
+
projectId: updated.projectId,
|
|
778
|
+
conversationId: updated.conversationId,
|
|
779
|
+
agentId: updated.agentId,
|
|
780
|
+
context: { message },
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
async updateProcess(processId, patch) {
|
|
784
|
+
const current = this.getProcess(processId);
|
|
785
|
+
const updated = {
|
|
786
|
+
...current,
|
|
787
|
+
...patch,
|
|
788
|
+
updatedAt: new Date().toISOString(),
|
|
789
|
+
};
|
|
790
|
+
await this.upsertProcess(updated);
|
|
791
|
+
return updated;
|
|
792
|
+
}
|
|
793
|
+
async upsertProcess(record) {
|
|
794
|
+
this.processes.set(record.id, record);
|
|
795
|
+
this.index.upsertProcess(record);
|
|
796
|
+
await this.writeProcess(record);
|
|
797
|
+
}
|
|
798
|
+
async writeProcess(record) {
|
|
799
|
+
await this.processRepository.write(record);
|
|
800
|
+
}
|
|
801
|
+
processDir(processId) {
|
|
802
|
+
return this.processRepository.processDir(processId);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
function buildProcessEnvInfo(env) {
|
|
806
|
+
const keys = Object.keys(env ?? {})
|
|
807
|
+
.filter((key) => key.length > 0)
|
|
808
|
+
.sort();
|
|
809
|
+
if (keys.length === 0)
|
|
810
|
+
return undefined;
|
|
811
|
+
return { keys, persisted: true, redacted: true };
|
|
812
|
+
}
|
|
813
|
+
export { isActiveProcessStatus } from "./index.js";
|
|
814
|
+
//# sourceMappingURL=process-manager.js.map
|