oh-my-copilot 5.1.0 → 5.5.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +11 -1
- package/README.md +15 -4
- package/agents/debugger.md +9 -1
- package/agents/explore.md +3 -1
- package/bridge/__pycache__/gyoshu_bridge.cpython-312.pyc +0 -0
- package/bridge/claude-md-coordinator.cjs +2 -2
- package/bridge/cli.cjs +25337 -17510
- package/bridge/mcp-server.cjs +2055 -1188
- package/bridge/runtime-cli.cjs +20732 -16478
- package/bridge/team-bridge.cjs +1790 -605
- package/bridge/team-mcp.cjs +21984 -13250
- package/bridge/team.js +15861 -10740
- package/copilot/agents/analyst.md +120 -0
- package/copilot/agents/architect.md +129 -0
- package/copilot/agents/code-reviewer.md +242 -0
- package/copilot/agents/code-simplifier.md +92 -0
- package/copilot/agents/critic.md +280 -0
- package/copilot/agents/debugger.md +158 -0
- package/copilot/agents/designer.md +117 -0
- package/copilot/agents/devils-advocate.md +221 -0
- package/copilot/agents/document-specialist.md +77 -0
- package/copilot/agents/executor.md +121 -0
- package/copilot/agents/explore.md +120 -0
- package/copilot/agents/git-master.md +95 -0
- package/copilot/agents/planner.md +140 -0
- package/copilot/agents/qa-tester.md +101 -0
- package/copilot/agents/scientist.md +95 -0
- package/copilot/agents/security-reviewer.md +191 -0
- package/copilot/agents/test-engineer.md +126 -0
- package/copilot/agents/tracer.md +168 -0
- package/copilot/agents/verifier.md +114 -0
- package/copilot/agents/writer.md +91 -0
- package/copilot/hooks.json +381 -0
- package/dist/__tests__/auto-slash-aliases.test.js +2 -2
- package/dist/__tests__/auto-slash-aliases.test.js.map +1 -1
- package/dist/__tests__/auto-slash-live-data-security.test.js +4 -4
- package/dist/__tests__/auto-slash-live-data-security.test.js.map +1 -1
- package/dist/__tests__/auto-update.test.js +16 -16
- package/dist/__tests__/auto-update.test.js.map +1 -1
- package/dist/__tests__/cli-config-stop-callback.test.js +3 -3
- package/dist/__tests__/cli-config-stop-callback.test.js.map +1 -1
- package/dist/__tests__/cli-notify-profile.test.js +1 -1
- package/dist/__tests__/cli-notify-profile.test.js.map +1 -1
- package/dist/__tests__/config-dir.test.js +88 -36
- package/dist/__tests__/config-dir.test.js.map +1 -1
- package/dist/__tests__/config-worker-permissions.test.d.ts +2 -0
- package/dist/__tests__/config-worker-permissions.test.d.ts.map +1 -0
- package/dist/__tests__/config-worker-permissions.test.js +99 -0
- package/dist/__tests__/config-worker-permissions.test.js.map +1 -0
- package/dist/__tests__/consolidation-contracts.test.js +7 -1
- package/dist/__tests__/consolidation-contracts.test.js.map +1 -1
- package/dist/__tests__/context-bloat-2577.test.js.map +1 -1
- package/dist/__tests__/copilot-agents-manifest.test.d.ts +2 -0
- package/dist/__tests__/copilot-agents-manifest.test.d.ts.map +1 -0
- package/dist/__tests__/copilot-agents-manifest.test.js +162 -0
- package/dist/__tests__/copilot-agents-manifest.test.js.map +1 -0
- package/dist/__tests__/copilot-config-dir-alias.test.d.ts +2 -0
- package/dist/__tests__/copilot-config-dir-alias.test.d.ts.map +1 -0
- package/dist/__tests__/copilot-config-dir-alias.test.js +13 -0
- package/dist/__tests__/copilot-config-dir-alias.test.js.map +1 -0
- package/dist/__tests__/copilot-hook-adapter.test.d.ts +2 -0
- package/dist/__tests__/copilot-hook-adapter.test.d.ts.map +1 -0
- package/dist/__tests__/copilot-hook-adapter.test.js +385 -0
- package/dist/__tests__/copilot-hook-adapter.test.js.map +1 -0
- package/dist/__tests__/copilot-hooks-manifest.test.d.ts +2 -0
- package/dist/__tests__/copilot-hooks-manifest.test.d.ts.map +1 -0
- package/dist/__tests__/copilot-hooks-manifest.test.js +201 -0
- package/dist/__tests__/copilot-hooks-manifest.test.js.map +1 -0
- package/dist/__tests__/delegation-enforcement-levels.test.js +15 -15
- package/dist/__tests__/delegation-enforcement-levels.test.js.map +1 -1
- package/dist/__tests__/directory-context-injector-registration.test.d.ts +2 -0
- package/dist/__tests__/directory-context-injector-registration.test.d.ts.map +1 -0
- package/dist/__tests__/directory-context-injector-registration.test.js +79 -0
- package/dist/__tests__/directory-context-injector-registration.test.js.map +1 -0
- package/dist/__tests__/doctor-conflicts.test.js +71 -16
- package/dist/__tests__/doctor-conflicts.test.js.map +1 -1
- package/dist/__tests__/doctor-legacy-config-dir.test.d.ts +2 -0
- package/dist/__tests__/doctor-legacy-config-dir.test.d.ts.map +1 -0
- package/dist/__tests__/doctor-legacy-config-dir.test.js +45 -0
- package/dist/__tests__/doctor-legacy-config-dir.test.js.map +1 -0
- package/dist/__tests__/doctor-node-on-path.test.d.ts +2 -0
- package/dist/__tests__/doctor-node-on-path.test.d.ts.map +1 -0
- package/dist/__tests__/doctor-node-on-path.test.js +63 -0
- package/dist/__tests__/doctor-node-on-path.test.js.map +1 -0
- package/dist/__tests__/hook-command-normalizer.test.js +4 -4
- package/dist/__tests__/hook-command-normalizer.test.js.map +1 -1
- package/dist/__tests__/hooks-command-escaping.test.js +2 -2
- package/dist/__tests__/hooks-command-escaping.test.js.map +1 -1
- package/dist/__tests__/hooks.test.js +44 -0
- package/dist/__tests__/hooks.test.js.map +1 -1
- package/dist/__tests__/host-detection.test.js +28 -8
- package/dist/__tests__/host-detection.test.js.map +1 -1
- package/dist/__tests__/hud/labels.test.js +4 -4
- package/dist/__tests__/hud/labels.test.js.map +1 -1
- package/dist/__tests__/hud/model.test.js +22 -0
- package/dist/__tests__/hud/model.test.js.map +1 -1
- package/dist/__tests__/hud/usage-api-header-fallback.test.d.ts +2 -0
- package/dist/__tests__/hud/usage-api-header-fallback.test.d.ts.map +1 -0
- package/dist/__tests__/hud/usage-api-header-fallback.test.js +70 -0
- package/dist/__tests__/hud/usage-api-header-fallback.test.js.map +1 -0
- package/dist/__tests__/hud/usage-api-lock.test.js +6 -6
- package/dist/__tests__/hud/usage-api-lock.test.js.map +1 -1
- package/dist/__tests__/hud/usage-api-stale.test.js +6 -6
- package/dist/__tests__/hud/usage-api-stale.test.js.map +1 -1
- package/dist/__tests__/hud/usage-api.test.js +84 -6
- package/dist/__tests__/hud/usage-api.test.js.map +1 -1
- package/dist/__tests__/hud/watch-mode-init.test.js +170 -22
- package/dist/__tests__/hud/watch-mode-init.test.js.map +1 -1
- package/dist/__tests__/hud-cache-wrapper.test.js +104 -1
- package/dist/__tests__/hud-cache-wrapper.test.js.map +1 -1
- package/dist/__tests__/hud-marketplace-resolution.test.js +10 -10
- package/dist/__tests__/hud-marketplace-resolution.test.js.map +1 -1
- package/dist/__tests__/hud-windows.test.js +1 -1
- package/dist/__tests__/hud-windows.test.js.map +1 -1
- package/dist/__tests__/installer-hooks-merge.test.js +3 -3
- package/dist/__tests__/installer-hooks-merge.test.js.map +1 -1
- package/dist/__tests__/installer-hud-skip.test.js +8 -8
- package/dist/__tests__/installer-hud-skip.test.js.map +1 -1
- package/dist/__tests__/installer-mcp-config.test.js +2 -2
- package/dist/__tests__/installer-mcp-config.test.js.map +1 -1
- package/dist/__tests__/installer-omc-reference.test.js +4 -4
- package/dist/__tests__/installer-omc-reference.test.js.map +1 -1
- package/dist/__tests__/installer-plugin-agents.test.js +4 -4
- package/dist/__tests__/installer-plugin-agents.test.js.map +1 -1
- package/dist/__tests__/installer-version-guard.test.js +2 -2
- package/dist/__tests__/installer-version-guard.test.js.map +1 -1
- package/dist/__tests__/installer.test.js +8 -8
- package/dist/__tests__/installer.test.js.map +1 -1
- package/dist/__tests__/keyword-detector-echo-guard.test.js +2 -2
- package/dist/__tests__/keyword-detector-echo-guard.test.js.map +1 -1
- package/dist/__tests__/keyword-detector-script.test.js +50 -6
- package/dist/__tests__/keyword-detector-script.test.js.map +1 -1
- package/dist/__tests__/manual-compact-command.test.js +4 -4
- package/dist/__tests__/manual-compact-command.test.js.map +1 -1
- package/dist/__tests__/notepad.test.js +61 -0
- package/dist/__tests__/notepad.test.js.map +1 -1
- package/dist/__tests__/npm-package-bin-surface.test.js +2 -2
- package/dist/__tests__/package-dir-resolution-regression.test.js +13 -6
- package/dist/__tests__/package-dir-resolution-regression.test.js.map +1 -1
- package/dist/__tests__/plugin-setup-deps.test.js +137 -50
- package/dist/__tests__/plugin-setup-deps.test.js.map +1 -1
- package/dist/__tests__/plugin-shipping-surface.test.js +61 -0
- package/dist/__tests__/plugin-shipping-surface.test.js.map +1 -1
- package/dist/__tests__/plugin-skill-budget.test.js +7 -1
- package/dist/__tests__/plugin-skill-budget.test.js.map +1 -1
- package/dist/__tests__/post-tool-rules-injector.test.js +2 -2
- package/dist/__tests__/post-tool-rules-injector.test.js.map +1 -1
- package/dist/__tests__/pre-tool-enforcer-jev-wiring.test.d.ts +2 -0
- package/dist/__tests__/pre-tool-enforcer-jev-wiring.test.d.ts.map +1 -0
- package/dist/__tests__/pre-tool-enforcer-jev-wiring.test.js +136 -0
- package/dist/__tests__/pre-tool-enforcer-jev-wiring.test.js.map +1 -0
- package/dist/__tests__/pre-tool-enforcer.test.js +180 -4
- package/dist/__tests__/pre-tool-enforcer.test.js.map +1 -1
- package/dist/__tests__/preemptive-compaction-hook.test.js +41 -4
- package/dist/__tests__/preemptive-compaction-hook.test.js.map +1 -1
- package/dist/__tests__/rate-limit-wait/daemon-bootstrap.test.js +2 -2
- package/dist/__tests__/rate-limit-wait/daemon-bootstrap.test.js.map +1 -1
- package/dist/__tests__/rate-limit-wait/pane-fresh-capture.test.js +0 -1
- package/dist/__tests__/rate-limit-wait/pane-fresh-capture.test.js.map +1 -1
- package/dist/__tests__/read-budget-preflight.test.d.ts +2 -0
- package/dist/__tests__/read-budget-preflight.test.d.ts.map +1 -0
- package/dist/__tests__/read-budget-preflight.test.js +142 -0
- package/dist/__tests__/read-budget-preflight.test.js.map +1 -0
- package/dist/__tests__/release-boundary.test.js +32 -2
- package/dist/__tests__/release-boundary.test.js.map +1 -1
- package/dist/__tests__/release-guidance.test.js +10 -0
- package/dist/__tests__/release-guidance.test.js.map +1 -1
- package/dist/__tests__/repair-plugin-cache-script.test.js +10 -9
- package/dist/__tests__/repair-plugin-cache-script.test.js.map +1 -1
- package/dist/__tests__/resolve-transcript-path.test.js +10 -10
- package/dist/__tests__/resolve-transcript-path.test.js.map +1 -1
- package/dist/__tests__/run-cjs-graceful-fallback.test.js +1 -1
- package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -1
- package/dist/__tests__/run-cjs-windows-stdio-contract.test.js +32 -38
- package/dist/__tests__/run-cjs-windows-stdio-contract.test.js.map +1 -1
- package/dist/__tests__/run-cjs-worker-skip-guard.test.d.ts +2 -0
- package/dist/__tests__/run-cjs-worker-skip-guard.test.d.ts.map +1 -0
- package/dist/__tests__/run-cjs-worker-skip-guard.test.js +75 -0
- package/dist/__tests__/run-cjs-worker-skip-guard.test.js.map +1 -0
- package/dist/__tests__/session-end-process-exit.test.js +22 -8
- package/dist/__tests__/session-end-process-exit.test.js.map +1 -1
- package/dist/__tests__/session-friction-report.test.js +2 -2
- package/dist/__tests__/session-friction-report.test.js.map +1 -1
- package/dist/__tests__/session-history-search.test.js +6 -6
- package/dist/__tests__/session-history-search.test.js.map +1 -1
- package/dist/__tests__/session-start-background-output.test.js +1 -1
- package/dist/__tests__/session-start-background-output.test.js.map +1 -1
- package/dist/__tests__/session-start-cache-cleanup.test.js +9 -9
- package/dist/__tests__/session-start-cache-cleanup.test.js.map +1 -1
- package/dist/__tests__/session-start-context-budget.test.d.ts +2 -0
- package/dist/__tests__/session-start-context-budget.test.d.ts.map +1 -0
- package/dist/__tests__/session-start-context-budget.test.js +84 -0
- package/dist/__tests__/session-start-context-budget.test.js.map +1 -0
- package/dist/__tests__/session-start-script-context.test.js +4 -4
- package/dist/__tests__/session-start-script-context.test.js.map +1 -1
- package/dist/__tests__/session-start-update-check.test.js +2 -2
- package/dist/__tests__/session-start-update-check.test.js.map +1 -1
- package/dist/__tests__/session-start-update-refresh.test.js +2 -2
- package/dist/__tests__/session-start-update-refresh.test.js.map +1 -1
- package/dist/__tests__/setup/clear-copilot-home.d.ts +2 -0
- package/dist/__tests__/setup/clear-copilot-home.d.ts.map +1 -0
- package/dist/__tests__/setup/clear-copilot-home.js +5 -0
- package/dist/__tests__/setup/clear-copilot-home.js.map +1 -0
- package/dist/__tests__/setup-claude-md-script.test.js +105 -21
- package/dist/__tests__/setup-claude-md-script.test.js.map +1 -1
- package/dist/__tests__/setup-contracts-regression.test.d.ts +2 -2
- package/dist/__tests__/setup-contracts-regression.test.js +49 -43
- package/dist/__tests__/setup-contracts-regression.test.js.map +1 -1
- package/dist/__tests__/setup-lifecycle-node.test.js +5 -5
- package/dist/__tests__/setup-lifecycle-node.test.js.map +1 -1
- package/dist/__tests__/setup-progress-script.test.js +3 -3
- package/dist/__tests__/setup-progress-script.test.js.map +1 -1
- package/dist/__tests__/shared-memory.test.js +8 -8
- package/dist/__tests__/shared-memory.test.js.map +1 -1
- package/dist/__tests__/shipyard-skills.test.js +394 -15
- package/dist/__tests__/shipyard-skills.test.js.map +1 -1
- package/dist/__tests__/skill-entitlements-cross-surface.test.js +4 -4
- package/dist/__tests__/skill-entitlements-cross-surface.test.js.map +1 -1
- package/dist/__tests__/skill-injector-script.test.js +3 -0
- package/dist/__tests__/skill-injector-script.test.js.map +1 -1
- package/dist/__tests__/skills-frontmatter-regression.test.js +65 -0
- package/dist/__tests__/skills-frontmatter-regression.test.js.map +1 -1
- package/dist/__tests__/skills.test.js +48 -20
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/__tests__/smoke-pipeline-edge.test.js +1 -0
- package/dist/__tests__/smoke-pipeline-edge.test.js.map +1 -1
- package/dist/__tests__/state-root-resolution.test.js +78 -2
- package/dist/__tests__/state-root-resolution.test.js.map +1 -1
- package/dist/__tests__/team-server-validation.test.js +7 -3
- package/dist/__tests__/team-server-validation.test.js.map +1 -1
- package/dist/__tests__/tier0-contracts.test.js +0 -4
- package/dist/__tests__/tier0-contracts.test.js.map +1 -1
- package/dist/__tests__/trusted-publishing-contract.test.js +10 -3
- package/dist/__tests__/trusted-publishing-contract.test.js.map +1 -1
- package/dist/__tests__/update-check-path.test.js +4 -4
- package/dist/__tests__/update-check-path.test.js.map +1 -1
- package/dist/__tests__/user-skill-compat.test.js +4 -4
- package/dist/__tests__/user-skill-compat.test.js.map +1 -1
- package/dist/__tests__/workflow-profile-activation-script.test.js +13 -7
- package/dist/__tests__/workflow-profile-activation-script.test.js.map +1 -1
- package/dist/alias-retirement/__tests__/registry.test.js +11 -3
- package/dist/alias-retirement/__tests__/registry.test.js.map +1 -1
- package/dist/cli/__tests__/ask.test.js +2 -1
- package/dist/cli/__tests__/ask.test.js.map +1 -1
- package/dist/cli/__tests__/autoresearch-guided.test.js +34 -0
- package/dist/cli/__tests__/autoresearch-guided.test.js.map +1 -1
- package/dist/cli/__tests__/autoresearch-setup-session.test.js +21 -1
- package/dist/cli/__tests__/autoresearch-setup-session.test.js.map +1 -1
- package/dist/cli/__tests__/hud-watch.test.js +55 -2
- package/dist/cli/__tests__/hud-watch.test.js.map +1 -1
- package/dist/cli/__tests__/launch-secure-transport.test.d.ts +2 -0
- package/dist/cli/__tests__/launch-secure-transport.test.d.ts.map +1 -0
- package/dist/cli/__tests__/launch-secure-transport.test.js +58 -0
- package/dist/cli/__tests__/launch-secure-transport.test.js.map +1 -0
- package/dist/cli/__tests__/launch.test.js +767 -94
- package/dist/cli/__tests__/launch.test.js.map +1 -1
- package/dist/cli/__tests__/lookout-cli.test.d.ts +7 -0
- package/dist/cli/__tests__/lookout-cli.test.d.ts.map +1 -0
- package/dist/cli/__tests__/lookout-cli.test.js +118 -0
- package/dist/cli/__tests__/lookout-cli.test.js.map +1 -0
- package/dist/cli/__tests__/plugin-dir-capture.test.js +5 -4
- package/dist/cli/__tests__/plugin-dir-capture.test.js.map +1 -1
- package/dist/cli/__tests__/self-improve-paths.test.js +7 -4
- package/dist/cli/__tests__/self-improve-paths.test.js.map +1 -1
- package/dist/cli/__tests__/session-search.test.js +2 -2
- package/dist/cli/__tests__/session-search.test.js.map +1 -1
- package/dist/cli/__tests__/team-runtime-boundary.test.js +41 -0
- package/dist/cli/__tests__/team-runtime-boundary.test.js.map +1 -1
- package/dist/cli/__tests__/team-status-worktree.test.js +4 -0
- package/dist/cli/__tests__/team-status-worktree.test.js.map +1 -1
- package/dist/cli/__tests__/team.test.js +633 -186
- package/dist/cli/__tests__/team.test.js.map +1 -1
- package/dist/cli/__tests__/tmux-env-forward.integration.test.d.ts +3 -2
- package/dist/cli/__tests__/tmux-env-forward.integration.test.d.ts.map +1 -1
- package/dist/cli/__tests__/tmux-env-forward.integration.test.js +59 -17
- package/dist/cli/__tests__/tmux-env-forward.integration.test.js.map +1 -1
- package/dist/cli/__tests__/tmux-utils.test.js +140 -4
- package/dist/cli/__tests__/tmux-utils.test.js.map +1 -1
- package/dist/cli/autoresearch-guided.d.ts.map +1 -1
- package/dist/cli/autoresearch-guided.js +10 -4
- package/dist/cli/autoresearch-guided.js.map +1 -1
- package/dist/cli/autoresearch-setup-session.d.ts.map +1 -1
- package/dist/cli/autoresearch-setup-session.js +4 -2
- package/dist/cli/autoresearch-setup-session.js.map +1 -1
- package/dist/cli/commands/__tests__/doctor-team-routing.test.js +12 -0
- package/dist/cli/commands/__tests__/doctor-team-routing.test.js.map +1 -1
- package/dist/cli/commands/__tests__/team-role-shorthand.test.js +145 -1
- package/dist/cli/commands/__tests__/team-role-shorthand.test.js.map +1 -1
- package/dist/cli/commands/__tests__/team.test.js +98 -2
- package/dist/cli/commands/__tests__/team.test.js.map +1 -1
- package/dist/cli/commands/doctor-conflicts.d.ts +7 -0
- package/dist/cli/commands/doctor-conflicts.d.ts.map +1 -1
- package/dist/cli/commands/doctor-conflicts.js +86 -8
- package/dist/cli/commands/doctor-conflicts.js.map +1 -1
- package/dist/cli/commands/doctor-team-routing.d.ts.map +1 -1
- package/dist/cli/commands/doctor-team-routing.js +4 -3
- package/dist/cli/commands/doctor-team-routing.js.map +1 -1
- package/dist/cli/commands/team.d.ts +1 -1
- package/dist/cli/commands/team.d.ts.map +1 -1
- package/dist/cli/commands/team.js +201 -89
- package/dist/cli/commands/team.js.map +1 -1
- package/dist/cli/hud-watch.d.ts +3 -0
- package/dist/cli/hud-watch.d.ts.map +1 -1
- package/dist/cli/hud-watch.js +14 -0
- package/dist/cli/hud-watch.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +23 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/interop.d.ts.map +1 -1
- package/dist/cli/interop.js +3 -1
- package/dist/cli/interop.js.map +1 -1
- package/dist/cli/launch.d.ts +53 -6
- package/dist/cli/launch.d.ts.map +1 -1
- package/dist/cli/launch.js +446 -97
- package/dist/cli/launch.js.map +1 -1
- package/dist/cli/lookout.d.ts +19 -0
- package/dist/cli/lookout.d.ts.map +1 -0
- package/dist/cli/lookout.js +111 -0
- package/dist/cli/lookout.js.map +1 -0
- package/dist/cli/team.d.ts +2 -0
- package/dist/cli/team.d.ts.map +1 -1
- package/dist/cli/team.js +469 -177
- package/dist/cli/team.js.map +1 -1
- package/dist/cli/tmux-utils.d.ts +4 -2
- package/dist/cli/tmux-utils.d.ts.map +1 -1
- package/dist/cli/tmux-utils.js +55 -8
- package/dist/cli/tmux-utils.js.map +1 -1
- package/dist/config/__tests__/loader.test.js +22 -1
- package/dist/config/__tests__/loader.test.js.map +1 -1
- package/dist/config/loader.d.ts +6 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +63 -15
- package/dist/config/loader.js.map +1 -1
- package/dist/features/__tests__/jev-model-routing.test.d.ts +10 -0
- package/dist/features/__tests__/jev-model-routing.test.d.ts.map +1 -0
- package/dist/features/__tests__/jev-model-routing.test.js +170 -0
- package/dist/features/__tests__/jev-model-routing.test.js.map +1 -0
- package/dist/features/__tests__/jev-slop-warning.test.d.ts +2 -0
- package/dist/features/__tests__/jev-slop-warning.test.d.ts.map +1 -0
- package/dist/features/__tests__/jev-slop-warning.test.js +150 -0
- package/dist/features/__tests__/jev-slop-warning.test.js.map +1 -0
- package/dist/features/auto-update.d.ts +3 -1
- package/dist/features/auto-update.d.ts.map +1 -1
- package/dist/features/auto-update.js +9 -7
- package/dist/features/auto-update.js.map +1 -1
- package/dist/features/builtin-skills/skills.js +1 -1
- package/dist/features/builtin-skills/skills.js.map +1 -1
- package/dist/features/delegation-enforcer.d.ts.map +1 -1
- package/dist/features/delegation-enforcer.js +5 -0
- package/dist/features/delegation-enforcer.js.map +1 -1
- package/dist/features/index.d.ts +2 -1
- package/dist/features/index.d.ts.map +1 -1
- package/dist/features/index.js +4 -1
- package/dist/features/index.js.map +1 -1
- package/dist/features/jev-model-routing.d.ts +28 -0
- package/dist/features/jev-model-routing.d.ts.map +1 -0
- package/dist/features/jev-model-routing.js +37 -0
- package/dist/features/jev-model-routing.js.map +1 -0
- package/dist/features/jev-slop-warning.d.ts +32 -0
- package/dist/features/jev-slop-warning.d.ts.map +1 -0
- package/dist/features/jev-slop-warning.js +33 -0
- package/dist/features/jev-slop-warning.js.map +1 -0
- package/dist/features/lookout/__tests__/lookout-workspace.test.d.ts +3 -0
- package/dist/features/lookout/__tests__/lookout-workspace.test.d.ts.map +1 -0
- package/dist/features/lookout/__tests__/lookout-workspace.test.js +203 -0
- package/dist/features/lookout/__tests__/lookout-workspace.test.js.map +1 -0
- package/dist/features/lookout/__tests__/lookout.test.d.ts +11 -0
- package/dist/features/lookout/__tests__/lookout.test.d.ts.map +1 -0
- package/dist/features/lookout/__tests__/lookout.test.js +769 -0
- package/dist/features/lookout/__tests__/lookout.test.js.map +1 -0
- package/dist/features/lookout/command-parser.d.ts +20 -0
- package/dist/features/lookout/command-parser.d.ts.map +1 -0
- package/dist/features/lookout/command-parser.js +815 -0
- package/dist/features/lookout/command-parser.js.map +1 -0
- package/dist/features/lookout/index.d.ts +54 -0
- package/dist/features/lookout/index.d.ts.map +1 -0
- package/dist/features/lookout/index.js +566 -0
- package/dist/features/lookout/index.js.map +1 -0
- package/dist/features/lookout/substitution-parser.d.ts +11 -0
- package/dist/features/lookout/substitution-parser.d.ts.map +1 -0
- package/dist/features/lookout/substitution-parser.js +157 -0
- package/dist/features/lookout/substitution-parser.js.map +1 -0
- package/dist/features/lookout/test-artifact-parser.d.ts +7 -0
- package/dist/features/lookout/test-artifact-parser.d.ts.map +1 -0
- package/dist/features/lookout/test-artifact-parser.js +106 -0
- package/dist/features/lookout/test-artifact-parser.js.map +1 -0
- package/dist/features/lookout/types.d.ts +33 -0
- package/dist/features/lookout/types.d.ts.map +1 -0
- package/dist/features/lookout/types.js +10 -0
- package/dist/features/lookout/types.js.map +1 -0
- package/dist/features/lookout/workspace.d.ts +7 -0
- package/dist/features/lookout/workspace.d.ts.map +1 -0
- package/dist/features/lookout/workspace.js +140 -0
- package/dist/features/lookout/workspace.js.map +1 -0
- package/dist/features/lookout/wrapper-parser.d.ts +4 -0
- package/dist/features/lookout/wrapper-parser.d.ts.map +1 -0
- package/dist/features/lookout/wrapper-parser.js +15 -0
- package/dist/features/lookout/wrapper-parser.js.map +1 -0
- package/dist/features/rate-limit-wait/daemon.js +1 -1
- package/dist/features/rate-limit-wait/daemon.js.map +1 -1
- package/dist/graph/__tests__/runtime/cli.test.js +7 -8
- package/dist/graph/__tests__/runtime/cli.test.js.map +1 -1
- package/dist/graph/__tests__/runtime/e2e-crash-recovery.test.js +3 -3
- package/dist/graph/__tests__/runtime/e2e-crash-recovery.test.js.map +1 -1
- package/dist/graph/__tests__/runtime/fence.test.js +4 -4
- package/dist/graph/__tests__/runtime/fence.test.js.map +1 -1
- package/dist/graph/__tests__/runtime/journal-epoch.test.js +2 -2
- package/dist/graph/__tests__/runtime/journal-epoch.test.js.map +1 -1
- package/dist/graph/__tests__/runtime/journal.test.js +2 -2
- package/dist/graph/__tests__/runtime/journal.test.js.map +1 -1
- package/dist/graph/__tests__/runtime/native-contained-fs.test.d.ts +2 -0
- package/dist/graph/__tests__/runtime/native-contained-fs.test.d.ts.map +1 -0
- package/dist/graph/__tests__/runtime/native-contained-fs.test.js +117 -0
- package/dist/graph/__tests__/runtime/native-contained-fs.test.js.map +1 -0
- package/dist/graph/__tests__/runtime/regression-matrix.test.js +2 -2
- package/dist/graph/__tests__/runtime/regression-matrix.test.js.map +1 -1
- package/dist/graph/__tests__/runtime/remote-approval.test.js +83 -2
- package/dist/graph/__tests__/runtime/remote-approval.test.js.map +1 -1
- package/dist/graph/__tests__/runtime/run-dir.test.js +13 -7
- package/dist/graph/__tests__/runtime/run-dir.test.js.map +1 -1
- package/dist/graph/__tests__/runtime/runner.test.js +2 -2
- package/dist/graph/__tests__/runtime/runner.test.js.map +1 -1
- package/dist/graph/__tests__/runtime/safe-fs.test.js +156 -29
- package/dist/graph/__tests__/runtime/safe-fs.test.js.map +1 -1
- package/dist/graph/__tests__/runtime/store.test.js +2 -2
- package/dist/graph/__tests__/runtime/store.test.js.map +1 -1
- package/dist/graph/runtime/contained-fd.d.ts +28 -0
- package/dist/graph/runtime/contained-fd.d.ts.map +1 -0
- package/dist/graph/runtime/contained-fd.js +72 -0
- package/dist/graph/runtime/contained-fd.js.map +1 -0
- package/dist/graph/runtime/executors/command.d.ts.map +1 -1
- package/dist/graph/runtime/executors/command.js +1 -2
- package/dist/graph/runtime/executors/command.js.map +1 -1
- package/dist/graph/runtime/fence.d.ts +0 -1
- package/dist/graph/runtime/fence.d.ts.map +1 -1
- package/dist/graph/runtime/fence.js +59 -64
- package/dist/graph/runtime/fence.js.map +1 -1
- package/dist/graph/runtime/journal.d.ts.map +1 -1
- package/dist/graph/runtime/journal.js +4 -3
- package/dist/graph/runtime/journal.js.map +1 -1
- package/dist/graph/runtime/native-contained-fs.d.ts +26 -0
- package/dist/graph/runtime/native-contained-fs.d.ts.map +1 -0
- package/dist/graph/runtime/native-contained-fs.js +32 -0
- package/dist/graph/runtime/native-contained-fs.js.map +1 -0
- package/dist/graph/runtime/remote-approval.d.ts +8 -1
- package/dist/graph/runtime/remote-approval.d.ts.map +1 -1
- package/dist/graph/runtime/remote-approval.js +86 -69
- package/dist/graph/runtime/remote-approval.js.map +1 -1
- package/dist/graph/runtime/run-dir.d.ts +13 -1
- package/dist/graph/runtime/run-dir.d.ts.map +1 -1
- package/dist/graph/runtime/run-dir.js +41 -15
- package/dist/graph/runtime/run-dir.js.map +1 -1
- package/dist/graph/runtime/runner.js +3 -3
- package/dist/graph/runtime/runner.js.map +1 -1
- package/dist/graph/runtime/safe-fs.d.ts +31 -1
- package/dist/graph/runtime/safe-fs.d.ts.map +1 -1
- package/dist/graph/runtime/safe-fs.js +173 -9
- package/dist/graph/runtime/safe-fs.js.map +1 -1
- package/dist/graph/runtime/store.js +3 -3
- package/dist/graph/runtime/store.js.map +1 -1
- package/dist/graph/schema.d.ts +34 -34
- package/dist/hooks/__tests__/background-process-guard.test.js +1 -1
- package/dist/hooks/__tests__/background-process-guard.test.js.map +1 -1
- package/dist/hooks/__tests__/pre-tool-use-template-source-ext.test.js +7 -6
- package/dist/hooks/__tests__/pre-tool-use-template-source-ext.test.js.map +1 -1
- package/dist/hooks/__tests__/workflow-drift-guard-script.test.js +1 -1
- package/dist/hooks/__tests__/workflow-drift-guard-script.test.js.map +1 -1
- package/dist/hooks/auto-slash-command/executor.js +4 -4
- package/dist/hooks/auto-slash-command/executor.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/cancel.test.js +23 -3
- package/dist/hooks/autopilot/__tests__/cancel.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/pipeline.test.js +14 -0
- package/dist/hooks/autopilot/__tests__/pipeline.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/workflow-integrity.test.js +3 -3
- package/dist/hooks/autopilot/__tests__/workflow-integrity.test.js.map +1 -1
- package/dist/hooks/autopilot/adapters/execution-adapter.js +1 -1
- package/dist/hooks/autopilot/adapters/execution-adapter.js.map +1 -1
- package/dist/hooks/autopilot/cancel.js +1 -1
- package/dist/hooks/autopilot/cancel.js.map +1 -1
- package/dist/hooks/autopilot/named-workflow-resume-validator.d.ts +1 -1
- package/dist/hooks/autopilot/named-workflow-resume-validator.js +1 -1
- package/dist/hooks/autopilot/pipeline-types.d.ts +1 -1
- package/dist/hooks/autopilot/pipeline-types.d.ts.map +1 -1
- package/dist/hooks/autopilot/pipeline-types.js.map +1 -1
- package/dist/hooks/bridge.d.ts.map +1 -1
- package/dist/hooks/bridge.js +28 -5
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.d.ts +2 -0
- package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.d.ts.map +1 -0
- package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js +181 -0
- package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js.map +1 -0
- package/dist/hooks/code-simplifier/index.d.ts.map +1 -1
- package/dist/hooks/code-simplifier/index.js +10 -0
- package/dist/hooks/code-simplifier/index.js.map +1 -1
- package/dist/hooks/code-simplifier/jev-shadow.d.ts +38 -0
- package/dist/hooks/code-simplifier/jev-shadow.d.ts.map +1 -0
- package/dist/hooks/code-simplifier/jev-shadow.js +45 -0
- package/dist/hooks/code-simplifier/jev-shadow.js.map +1 -0
- package/dist/hooks/factcheck/__tests__/config-tokens.test.d.ts +2 -0
- package/dist/hooks/factcheck/__tests__/config-tokens.test.d.ts.map +1 -0
- package/dist/hooks/factcheck/__tests__/config-tokens.test.js +13 -0
- package/dist/hooks/factcheck/__tests__/config-tokens.test.js.map +1 -0
- package/dist/hooks/factcheck/config.d.ts +3 -2
- package/dist/hooks/factcheck/config.d.ts.map +1 -1
- package/dist/hooks/factcheck/config.js +5 -4
- package/dist/hooks/factcheck/config.js.map +1 -1
- package/dist/hooks/jev/__tests__/client.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/client.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/client.test.js +114 -0
- package/dist/hooks/jev/__tests__/client.test.js.map +1 -0
- package/dist/hooks/jev/__tests__/points-wire-shape.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/points-wire-shape.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/points-wire-shape.test.js +72 -0
- package/dist/hooks/jev/__tests__/points-wire-shape.test.js.map +1 -0
- package/dist/hooks/jev/__tests__/resolver.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/resolver.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/resolver.test.js +340 -0
- package/dist/hooks/jev/__tests__/resolver.test.js.map +1 -0
- package/dist/hooks/jev/client.d.ts +39 -0
- package/dist/hooks/jev/client.d.ts.map +1 -0
- package/dist/hooks/jev/client.js +91 -0
- package/dist/hooks/jev/client.js.map +1 -0
- package/dist/hooks/jev/config.d.ts +66 -0
- package/dist/hooks/jev/config.d.ts.map +1 -0
- package/dist/hooks/jev/config.js +124 -0
- package/dist/hooks/jev/config.js.map +1 -0
- package/dist/hooks/jev/index.d.ts +12 -0
- package/dist/hooks/jev/index.d.ts.map +1 -0
- package/dist/hooks/jev/index.js +12 -0
- package/dist/hooks/jev/index.js.map +1 -0
- package/dist/hooks/jev/points.d.ts +55 -0
- package/dist/hooks/jev/points.d.ts.map +1 -0
- package/dist/hooks/jev/points.js +230 -0
- package/dist/hooks/jev/points.js.map +1 -0
- package/dist/hooks/jev/resolver.d.ts +47 -0
- package/dist/hooks/jev/resolver.d.ts.map +1 -0
- package/dist/hooks/jev/resolver.js +162 -0
- package/dist/hooks/jev/resolver.js.map +1 -0
- package/dist/hooks/jev/types.d.ts +58 -0
- package/dist/hooks/jev/types.d.ts.map +1 -0
- package/dist/hooks/jev/types.js +8 -0
- package/dist/hooks/jev/types.js.map +1 -0
- package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.d.ts +2 -0
- package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.d.ts.map +1 -0
- package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js +131 -0
- package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js.map +1 -0
- package/dist/hooks/keyword-detector/index.d.ts +6 -0
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/index.js +4 -2
- package/dist/hooks/keyword-detector/index.js.map +1 -1
- package/dist/hooks/keyword-detector/jev-shadow.d.ts +27 -0
- package/dist/hooks/keyword-detector/jev-shadow.d.ts.map +1 -0
- package/dist/hooks/keyword-detector/jev-shadow.js +47 -0
- package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -0
- package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.d.ts +2 -0
- package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.d.ts.map +1 -0
- package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js +150 -0
- package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js.map +1 -0
- package/dist/hooks/learner/detection-hook.d.ts.map +1 -1
- package/dist/hooks/learner/detection-hook.js +5 -0
- package/dist/hooks/learner/detection-hook.js.map +1 -1
- package/dist/hooks/learner/jev-shadow.d.ts +22 -0
- package/dist/hooks/learner/jev-shadow.d.ts.map +1 -0
- package/dist/hooks/learner/jev-shadow.js +32 -0
- package/dist/hooks/learner/jev-shadow.js.map +1 -0
- package/dist/hooks/mode-registry/__tests__/session-isolation.test.js +4 -2
- package/dist/hooks/mode-registry/__tests__/session-isolation.test.js.map +1 -1
- package/dist/hooks/mode-registry/index.js +8 -8
- package/dist/hooks/mode-registry/index.js.map +1 -1
- package/dist/hooks/notepad/index.d.ts.map +1 -1
- package/dist/hooks/notepad/index.js +9 -2
- package/dist/hooks/notepad/index.js.map +1 -1
- package/dist/hooks/omc-orchestrator/constants.d.ts +1 -1
- package/dist/hooks/omc-orchestrator/constants.d.ts.map +1 -1
- package/dist/hooks/omc-orchestrator/constants.js +1 -1
- package/dist/hooks/omc-orchestrator/index.js +1 -1
- package/dist/hooks/permission-handler/__tests__/index.test.js +83 -1
- package/dist/hooks/permission-handler/__tests__/index.test.js.map +1 -1
- package/dist/hooks/permission-handler/index.d.ts.map +1 -1
- package/dist/hooks/permission-handler/index.js +43 -19
- package/dist/hooks/permission-handler/index.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/cancel-race.test.js +29 -1
- package/dist/hooks/persistent-mode/__tests__/cancel-race.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.d.ts +2 -0
- package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.d.ts.map +1 -0
- package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js +131 -0
- package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js.map +1 -0
- package/dist/hooks/persistent-mode/__tests__/ralph-verification-flow.test.js +4 -4
- package/dist/hooks/persistent-mode/__tests__/ralph-verification-flow.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/ultragoal-persistence.test.js +2 -2
- package/dist/hooks/persistent-mode/__tests__/ultragoal-persistence.test.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +35 -2
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/persistent-mode/jev-shadow.d.ts +33 -0
- package/dist/hooks/persistent-mode/jev-shadow.d.ts.map +1 -0
- package/dist/hooks/persistent-mode/jev-shadow.js +63 -0
- package/dist/hooks/persistent-mode/jev-shadow.js.map +1 -0
- package/dist/hooks/persistent-mode/session-isolation.test.js +2 -1
- package/dist/hooks/persistent-mode/session-isolation.test.js.map +1 -1
- package/dist/hooks/pre-compact/restore.d.ts.map +1 -1
- package/dist/hooks/pre-compact/restore.js.map +1 -1
- package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.d.ts +2 -0
- package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.d.ts.map +1 -0
- package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.js +179 -0
- package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.js.map +1 -0
- package/dist/hooks/preemptive-compaction/index.d.ts.map +1 -1
- package/dist/hooks/preemptive-compaction/index.js +26 -0
- package/dist/hooks/preemptive-compaction/index.js.map +1 -1
- package/dist/hooks/preemptive-compaction/jev-shadow.d.ts +42 -0
- package/dist/hooks/preemptive-compaction/jev-shadow.d.ts.map +1 -0
- package/dist/hooks/preemptive-compaction/jev-shadow.js +39 -0
- package/dist/hooks/preemptive-compaction/jev-shadow.js.map +1 -0
- package/dist/hooks/preemptive-compaction/types.d.ts +2 -0
- package/dist/hooks/preemptive-compaction/types.d.ts.map +1 -1
- package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.d.ts +2 -0
- package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.d.ts.map +1 -0
- package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js +144 -0
- package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js.map +1 -0
- package/dist/hooks/ralph/jev-shadow.d.ts +35 -0
- package/dist/hooks/ralph/jev-shadow.d.ts.map +1 -0
- package/dist/hooks/ralph/jev-shadow.js +37 -0
- package/dist/hooks/ralph/jev-shadow.js.map +1 -0
- package/dist/hooks/ralph/loop.d.ts.map +1 -1
- package/dist/hooks/ralph/loop.js.map +1 -1
- package/dist/hooks/rules-injector/finder.d.ts +2 -2
- package/dist/hooks/rules-injector/finder.js +2 -2
- package/dist/hooks/rules-injector/finder.test.d.ts +1 -1
- package/dist/hooks/rules-injector/finder.test.js +6 -6
- package/dist/hooks/rules-injector/finder.test.js.map +1 -1
- package/dist/hooks/rules-injector/index.d.ts +1 -1
- package/dist/hooks/rules-injector/index.js +1 -1
- package/dist/hooks/self-improve/__tests__/session-isolation.test.js +4 -4
- package/dist/hooks/self-improve/__tests__/session-isolation.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/action-runner.test.js +1 -1
- package/dist/hooks/session-end/__tests__/action-runner.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js +44 -3
- package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/duplicate-notifications.test.js +4 -0
- package/dist/hooks/session-end/__tests__/duplicate-notifications.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/openclaw-session-end.test.js +1 -0
- package/dist/hooks/session-end/__tests__/openclaw-session-end.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/session-end-bridge-cleanup.test.js +2 -0
- package/dist/hooks/session-end/__tests__/session-end-bridge-cleanup.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/session-end-timeout.test.js +13 -3
- package/dist/hooks/session-end/__tests__/session-end-timeout.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/team-cleanup.test.js +186 -33
- package/dist/hooks/session-end/__tests__/team-cleanup.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/worker.test.js +9 -0
- package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
- package/dist/hooks/session-end/action-runner.js +9 -3
- package/dist/hooks/session-end/action-runner.js.map +1 -1
- package/dist/hooks/session-end/cleanup-manifest.d.ts +23 -1
- package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
- package/dist/hooks/session-end/cleanup-manifest.js +21 -4
- package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
- package/dist/hooks/session-end/foreground-bootstrap.d.ts +22 -0
- package/dist/hooks/session-end/foreground-bootstrap.d.ts.map +1 -0
- package/dist/hooks/session-end/foreground-bootstrap.js +23 -0
- package/dist/hooks/session-end/foreground-bootstrap.js.map +1 -0
- package/dist/hooks/session-end/index.d.ts +2 -0
- package/dist/hooks/session-end/index.d.ts.map +1 -1
- package/dist/hooks/session-end/index.js +116 -59
- package/dist/hooks/session-end/index.js.map +1 -1
- package/dist/hooks/session-end/worker.d.ts +2 -2
- package/dist/hooks/session-end/worker.d.ts.map +1 -1
- package/dist/hooks/session-end/worker.js +50 -17
- package/dist/hooks/session-end/worker.js.map +1 -1
- package/dist/hooks/setup/__tests__/stdin-symlink.test.js +7 -7
- package/dist/hooks/setup/__tests__/stdin-symlink.test.js.map +1 -1
- package/dist/hooks/setup/__tests__/windows-patch.test.js +12 -12
- package/dist/hooks/setup/__tests__/windows-patch.test.js.map +1 -1
- package/dist/hooks/setup/index.d.ts +7 -3
- package/dist/hooks/setup/index.d.ts.map +1 -1
- package/dist/hooks/setup/index.js +14 -7
- package/dist/hooks/setup/index.js.map +1 -1
- package/dist/hooks/skill-bridge.cjs +35 -6
- package/dist/hooks/subagent-tracker/__tests__/flow-tracer.test.js +8 -0
- package/dist/hooks/subagent-tracker/__tests__/flow-tracer.test.js.map +1 -1
- package/dist/hooks/subagent-tracker/__tests__/index.test.js +6 -0
- package/dist/hooks/subagent-tracker/__tests__/index.test.js.map +1 -1
- package/dist/hooks/subagent-tracker/__tests__/session-replay.test.js +8 -0
- package/dist/hooks/subagent-tracker/__tests__/session-replay.test.js.map +1 -1
- package/dist/hooks/subagent-tracker/__tests__/worktree-evidence.test.js +4 -4
- package/dist/hooks/subagent-tracker/__tests__/worktree-evidence.test.js.map +1 -1
- package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.d.ts +2 -0
- package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.d.ts.map +1 -0
- package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js +120 -0
- package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js.map +1 -0
- package/dist/hooks/task-size-detector/jev-shadow.d.ts +26 -0
- package/dist/hooks/task-size-detector/jev-shadow.d.ts.map +1 -0
- package/dist/hooks/task-size-detector/jev-shadow.js +32 -0
- package/dist/hooks/task-size-detector/jev-shadow.js.map +1 -0
- package/dist/hooks/team-dispatch-hook.d.ts.map +1 -1
- package/dist/hooks/team-dispatch-hook.js +0 -7
- package/dist/hooks/team-dispatch-hook.js.map +1 -1
- package/dist/hooks/todo-continuation/index.d.ts +2 -1
- package/dist/hooks/todo-continuation/index.d.ts.map +1 -1
- package/dist/hooks/todo-continuation/index.js +3 -2
- package/dist/hooks/todo-continuation/index.js.map +1 -1
- package/dist/hooks/wiki/__tests__/session-hooks.test.js +9 -9
- package/dist/hooks/wiki/__tests__/session-hooks.test.js.map +1 -1
- package/dist/hud/elements/model.d.ts.map +1 -1
- package/dist/hud/elements/model.js +4 -2
- package/dist/hud/elements/model.js.map +1 -1
- package/dist/hud/index.d.ts.map +1 -1
- package/dist/hud/index.js +26 -6
- package/dist/hud/index.js.map +1 -1
- package/dist/hud/types.d.ts +1 -1
- package/dist/hud/types.d.ts.map +1 -1
- package/dist/hud/types.js +1 -1
- package/dist/hud/types.js.map +1 -1
- package/dist/hud/usage-api.d.ts +8 -0
- package/dist/hud/usage-api.d.ts.map +1 -1
- package/dist/hud/usage-api.js +182 -20
- package/dist/hud/usage-api.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/installer/__tests__/bundled-skill-sync.test.d.ts +2 -0
- package/dist/installer/__tests__/bundled-skill-sync.test.d.ts.map +1 -0
- package/dist/installer/__tests__/bundled-skill-sync.test.js +119 -0
- package/dist/installer/__tests__/bundled-skill-sync.test.js.map +1 -0
- package/dist/installer/__tests__/claude-md-target-resolution.test.js +4 -4
- package/dist/installer/__tests__/claude-md-target-resolution.test.js.map +1 -1
- package/dist/installer/__tests__/claude-md-transaction.test.js +16 -13
- package/dist/installer/__tests__/claude-md-transaction.test.js.map +1 -1
- package/dist/installer/__tests__/has-enabled-omc-plugin.test.js +1 -1
- package/dist/installer/__tests__/has-enabled-omc-plugin.test.js.map +1 -1
- package/dist/installer/__tests__/hook-command-portability.test.d.ts +1 -1
- package/dist/installer/__tests__/hook-command-portability.test.js +14 -14
- package/dist/installer/__tests__/hook-command-portability.test.js.map +1 -1
- package/dist/installer/__tests__/hook-templates.test.js +117 -23
- package/dist/installer/__tests__/hook-templates.test.js.map +1 -1
- package/dist/installer/__tests__/hud-cache-wrapper.test.js +33 -8
- package/dist/installer/__tests__/hud-cache-wrapper.test.js.map +1 -1
- package/dist/installer/__tests__/hud-wrapper-env.test.js +9 -9
- package/dist/installer/__tests__/hud-wrapper-env.test.js.map +1 -1
- package/dist/installer/__tests__/mcp-registry.test.js +1 -1
- package/dist/installer/__tests__/mcp-registry.test.js.map +1 -1
- package/dist/installer/__tests__/plugin-cache-sync.test.js +13 -13
- package/dist/installer/__tests__/plugin-cache-sync.test.js.map +1 -1
- package/dist/installer/__tests__/plugin-dir-mode-e2e.test.d.ts +1 -1
- package/dist/installer/__tests__/plugin-dir-mode-e2e.test.js +3 -3
- package/dist/installer/__tests__/plugin-dir-mode-e2e.test.js.map +1 -1
- package/dist/installer/__tests__/plugin-dir-mode.test.d.ts +1 -1
- package/dist/installer/__tests__/plugin-dir-mode.test.js +2 -2
- package/dist/installer/__tests__/plugin-dir-mode.test.js.map +1 -1
- package/dist/installer/__tests__/safe-installer.test.js +5 -5
- package/dist/installer/__tests__/safe-installer.test.js.map +1 -1
- package/dist/installer/__tests__/settings-race.test.js +1 -1
- package/dist/installer/__tests__/settings-race.test.js.map +1 -1
- package/dist/installer/__tests__/stale-cleanup.test.js +16 -16
- package/dist/installer/__tests__/stale-cleanup.test.js.map +1 -1
- package/dist/installer/__tests__/standalone-hook-reconcile.test.js +40 -12
- package/dist/installer/__tests__/standalone-hook-reconcile.test.js.map +1 -1
- package/dist/installer/__tests__/standalone-state-lock-bridge.test.d.ts +2 -0
- package/dist/installer/__tests__/standalone-state-lock-bridge.test.d.ts.map +1 -0
- package/dist/installer/__tests__/standalone-state-lock-bridge.test.js +105 -0
- package/dist/installer/__tests__/standalone-state-lock-bridge.test.js.map +1 -0
- package/dist/installer/__tests__/user-skill-compat.test.js +4 -4
- package/dist/installer/__tests__/user-skill-compat.test.js.map +1 -1
- package/dist/installer/hooks.js +1 -1
- package/dist/installer/hooks.js.map +1 -1
- package/dist/installer/index.d.ts +3 -0
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +150 -29
- package/dist/installer/index.js.map +1 -1
- package/dist/lib/__tests__/atomic-write.test.js +75 -86
- package/dist/lib/__tests__/atomic-write.test.js.map +1 -1
- package/dist/lib/__tests__/mode-state-io.test.js +65 -47
- package/dist/lib/__tests__/mode-state-io.test.js.map +1 -1
- package/dist/lib/__tests__/mode-state-lock.test.d.ts +2 -0
- package/dist/lib/__tests__/mode-state-lock.test.d.ts.map +1 -0
- package/dist/lib/__tests__/mode-state-lock.test.js +242 -0
- package/dist/lib/__tests__/mode-state-lock.test.js.map +1 -0
- package/dist/lib/__tests__/sync-publication-short-write.test.js +36 -5
- package/dist/lib/__tests__/sync-publication-short-write.test.js.map +1 -1
- package/dist/lib/__tests__/worktree-paths-bare-container.test.d.ts +2 -0
- package/dist/lib/__tests__/worktree-paths-bare-container.test.d.ts.map +1 -0
- package/dist/lib/__tests__/worktree-paths-bare-container.test.js +99 -0
- package/dist/lib/__tests__/worktree-paths-bare-container.test.js.map +1 -0
- package/dist/lib/__tests__/worktree-paths-foreign-root.test.js +5 -5
- package/dist/lib/__tests__/worktree-paths-foreign-root.test.js.map +1 -1
- package/dist/lib/__tests__/worktree-paths-git-probe-failclosed.test.js +3 -3
- package/dist/lib/__tests__/worktree-paths-git-probe-failclosed.test.js.map +1 -1
- package/dist/lib/__tests__/worktree-paths-git-probe-locale.test.d.ts +2 -0
- package/dist/lib/__tests__/worktree-paths-git-probe-locale.test.d.ts.map +1 -0
- package/dist/lib/__tests__/worktree-paths-git-probe-locale.test.js +66 -0
- package/dist/lib/__tests__/worktree-paths-git-probe-locale.test.js.map +1 -0
- package/dist/lib/__tests__/worktree-paths-nongit-anchor.test.js +11 -9
- package/dist/lib/__tests__/worktree-paths-nongit-anchor.test.js.map +1 -1
- package/dist/lib/__tests__/worktree-paths-split-warning.test.js +9 -9
- package/dist/lib/__tests__/worktree-paths-split-warning.test.js.map +1 -1
- package/dist/lib/__tests__/worktree-paths-toplevel-cache.test.js +46 -31
- package/dist/lib/__tests__/worktree-paths-toplevel-cache.test.js.map +1 -1
- package/dist/lib/atomic-write.d.ts +12 -2
- package/dist/lib/atomic-write.d.ts.map +1 -1
- package/dist/lib/atomic-write.js +45 -35
- package/dist/lib/atomic-write.js.map +1 -1
- package/dist/lib/mode-state-io.d.ts +8 -1
- package/dist/lib/mode-state-io.d.ts.map +1 -1
- package/dist/lib/mode-state-io.js +926 -448
- package/dist/lib/mode-state-io.js.map +1 -1
- package/dist/lib/shared-memory.d.ts +1 -1
- package/dist/lib/shared-memory.js +1 -1
- package/dist/lib/worktree-paths.d.ts +2 -0
- package/dist/lib/worktree-paths.d.ts.map +1 -1
- package/dist/lib/worktree-paths.js +76 -6
- package/dist/lib/worktree-paths.js.map +1 -1
- package/dist/mcp/__tests__/team-cleanup.test.d.ts +1 -1
- package/dist/mcp/__tests__/team-cleanup.test.js +211 -110
- package/dist/mcp/__tests__/team-cleanup.test.js.map +1 -1
- package/dist/mcp/__tests__/team-server-artifact-convergence.test.js +1155 -41
- package/dist/mcp/__tests__/team-server-artifact-convergence.test.js.map +1 -1
- package/dist/mcp/team-job-convergence.d.ts +20 -6
- package/dist/mcp/team-job-convergence.d.ts.map +1 -1
- package/dist/mcp/team-job-convergence.js +150 -49
- package/dist/mcp/team-job-convergence.js.map +1 -1
- package/dist/mcp/team-server.d.ts +6 -4
- package/dist/mcp/team-server.d.ts.map +1 -1
- package/dist/mcp/team-server.js +629 -207
- package/dist/mcp/team-server.js.map +1 -1
- package/dist/platform/__tests__/process-utils-identity.test.js +24 -2
- package/dist/platform/__tests__/process-utils-identity.test.js.map +1 -1
- package/dist/platform/executable-resolution.d.ts.map +1 -1
- package/dist/platform/executable-resolution.js +17 -2
- package/dist/platform/executable-resolution.js.map +1 -1
- package/dist/platform/process-utils.js +1 -1
- package/dist/platform/process-utils.js.map +1 -1
- package/dist/shared/types.d.ts +6 -2
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js.map +1 -1
- package/dist/skills/__tests__/mingw-escape.test.js +1 -1
- package/dist/skills/__tests__/mingw-escape.test.js.map +1 -1
- package/dist/skills/__tests__/omc-doctor-skill.test.js +9 -7
- package/dist/skills/__tests__/omc-doctor-skill.test.js.map +1 -1
- package/dist/skills/__tests__/skill-config-dir.test.d.ts +2 -2
- package/dist/skills/__tests__/skill-config-dir.test.js +17 -17
- package/dist/skills/__tests__/skill-config-dir.test.js.map +1 -1
- package/dist/team/__tests__/api-interop.cleanup.test.js +137 -23
- package/dist/team/__tests__/api-interop.cleanup.test.js.map +1 -1
- package/dist/team/__tests__/api-interop.cwd-resolution.test.js +89 -45
- package/dist/team/__tests__/api-interop.cwd-resolution.test.js.map +1 -1
- package/dist/team/__tests__/api-interop.dispatch.test.js +56 -12
- package/dist/team/__tests__/api-interop.dispatch.test.js.map +1 -1
- package/dist/team/__tests__/auto-cleanup.test.js +4 -4
- package/dist/team/__tests__/auto-cleanup.test.js.map +1 -1
- package/dist/team/__tests__/auto-merge.perf.test.js +2 -4
- package/dist/team/__tests__/auto-merge.perf.test.js.map +1 -1
- package/dist/team/__tests__/behavior-snapshot.test.js +8 -1
- package/dist/team/__tests__/behavior-snapshot.test.js.map +1 -1
- package/dist/team/__tests__/bridge-integration.test.js +4 -4
- package/dist/team/__tests__/bridge-integration.test.js.map +1 -1
- package/dist/team/__tests__/cli-detection.test.js +39 -0
- package/dist/team/__tests__/cli-detection.test.js.map +1 -1
- package/dist/team/__tests__/critic-cli-worker.integration.test.js +16 -3
- package/dist/team/__tests__/critic-cli-worker.integration.test.js.map +1 -1
- package/dist/team/__tests__/governance-enforcement.test.js +42 -2
- package/dist/team/__tests__/governance-enforcement.test.js.map +1 -1
- package/dist/team/__tests__/idle-nudge.test.d.ts +1 -0
- package/dist/team/__tests__/idle-nudge.test.d.ts.map +1 -1
- package/dist/team/__tests__/idle-nudge.test.js +124 -27
- package/dist/team/__tests__/idle-nudge.test.js.map +1 -1
- package/dist/team/__tests__/mailbox-notification-guard.test.js +219 -6
- package/dist/team/__tests__/mailbox-notification-guard.test.js.map +1 -1
- package/dist/team/__tests__/mcp-comm.mailbox-notification.test.js +49 -3
- package/dist/team/__tests__/mcp-comm.mailbox-notification.test.js.map +1 -1
- package/dist/team/__tests__/merge-orchestrator.test.js +22 -15
- package/dist/team/__tests__/merge-orchestrator.test.js.map +1 -1
- package/dist/team/__tests__/message-router.test.js +4 -4
- package/dist/team/__tests__/message-router.test.js.map +1 -1
- package/dist/team/__tests__/model-contract.test.js +97 -13
- package/dist/team/__tests__/model-contract.test.js.map +1 -1
- package/dist/team/__tests__/psmux-adapter.test.d.ts +2 -0
- package/dist/team/__tests__/psmux-adapter.test.d.ts.map +1 -0
- package/dist/team/__tests__/psmux-adapter.test.js +188 -0
- package/dist/team/__tests__/psmux-adapter.test.js.map +1 -0
- package/dist/team/__tests__/recovery-finalization-concurrency.test.js +69 -5
- package/dist/team/__tests__/recovery-finalization-concurrency.test.js.map +1 -1
- package/dist/team/__tests__/recovery-owner-finalization.test.js +2 -0
- package/dist/team/__tests__/recovery-owner-finalization.test.js.map +1 -1
- package/dist/team/__tests__/recovery-pane-rollback.test.js +450 -206
- package/dist/team/__tests__/recovery-pane-rollback.test.js.map +1 -1
- package/dist/team/__tests__/recovery-public-api.test.js +70 -15
- package/dist/team/__tests__/recovery-public-api.test.js.map +1 -1
- package/dist/team/__tests__/recovery-request-store.test.js +11 -2
- package/dist/team/__tests__/recovery-request-store.test.js.map +1 -1
- package/dist/team/__tests__/recovery-saga.test.js +16 -1
- package/dist/team/__tests__/recovery-saga.test.js.map +1 -1
- package/dist/team/__tests__/resolved-routing-snapshot.test.js +33 -2
- package/dist/team/__tests__/resolved-routing-snapshot.test.js.map +1 -1
- package/dist/team/__tests__/runtime-cli.test.js +310 -197
- package/dist/team/__tests__/runtime-cli.test.js.map +1 -1
- package/dist/team/__tests__/runtime-done-recovery.test.js +64 -74
- package/dist/team/__tests__/runtime-done-recovery.test.js.map +1 -1
- package/dist/team/__tests__/runtime-owner-busy.test.js +351 -57
- package/dist/team/__tests__/runtime-owner-busy.test.js.map +1 -1
- package/dist/team/__tests__/runtime-owner-client.test.js +153 -49
- package/dist/team/__tests__/runtime-owner-client.test.js.map +1 -1
- package/dist/team/__tests__/runtime-prompt-mode.test.js +29 -16
- package/dist/team/__tests__/runtime-prompt-mode.test.js.map +1 -1
- package/dist/team/__tests__/runtime-storage-boundary.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-storage-boundary.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-storage-boundary.test.js +409 -0
- package/dist/team/__tests__/runtime-storage-boundary.test.js.map +1 -0
- package/dist/team/__tests__/runtime-v2-role-routing.test.js +613 -72
- package/dist/team/__tests__/runtime-v2-role-routing.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.cursor-routing.test.js +6 -10
- package/dist/team/__tests__/runtime-v2.cursor-routing.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.dispatch.test.js +2288 -212
- package/dist/team/__tests__/runtime-v2.dispatch.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.explicit-provider-routing.test.js +3 -9
- package/dist/team/__tests__/runtime-v2.explicit-provider-routing.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.gemini-preflight.test.js +290 -3
- package/dist/team/__tests__/runtime-v2.gemini-preflight.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.monitor.test.js +174 -13
- package/dist/team/__tests__/runtime-v2.monitor.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.permission-lines.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-v2.permission-lines.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-v2.permission-lines.test.js +42 -0
- package/dist/team/__tests__/runtime-v2.permission-lines.test.js.map +1 -0
- package/dist/team/__tests__/runtime-v2.shutdown-interruption.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-v2.shutdown-interruption.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-v2.shutdown-interruption.test.js +875 -0
- package/dist/team/__tests__/runtime-v2.shutdown-interruption.test.js.map +1 -0
- package/dist/team/__tests__/runtime-v2.shutdown-pane-cleanup.test.js +115 -60
- package/dist/team/__tests__/runtime-v2.shutdown-pane-cleanup.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.shutdown.test.js +551 -52
- package/dist/team/__tests__/runtime-v2.shutdown.test.js.map +1 -1
- package/dist/team/__tests__/runtime-watchdog-retry.test.js +125 -369
- package/dist/team/__tests__/runtime-watchdog-retry.test.js.map +1 -1
- package/dist/team/__tests__/runtime.test.js +54 -3
- package/dist/team/__tests__/runtime.test.js.map +1 -1
- package/dist/team/__tests__/scaling-launch-config.test.js +179 -52
- package/dist/team/__tests__/scaling-launch-config.test.js.map +1 -1
- package/dist/team/__tests__/scaling.test.js +380 -39
- package/dist/team/__tests__/scaling.test.js.map +1 -1
- package/dist/team/__tests__/split-pane-cleanup-evidence.test.js.map +1 -1
- package/dist/team/__tests__/stage-router.test.js +23 -1
- package/dist/team/__tests__/stage-router.test.js.map +1 -1
- package/dist/team/__tests__/startup-claim-error.test.d.ts +2 -0
- package/dist/team/__tests__/startup-claim-error.test.d.ts.map +1 -0
- package/dist/team/__tests__/startup-claim-error.test.js +73 -0
- package/dist/team/__tests__/startup-claim-error.test.js.map +1 -0
- package/dist/team/__tests__/task-recovery-checkpoint.test.js +2 -1
- package/dist/team/__tests__/task-recovery-checkpoint.test.js.map +1 -1
- package/dist/team/__tests__/task-storage-integrity.test.d.ts +2 -0
- package/dist/team/__tests__/task-storage-integrity.test.d.ts.map +1 -0
- package/dist/team/__tests__/task-storage-integrity.test.js +590 -0
- package/dist/team/__tests__/task-storage-integrity.test.js.map +1 -0
- package/dist/team/__tests__/team-config-revision-lock.test.js +250 -4
- package/dist/team/__tests__/team-config-revision-lock.test.js.map +1 -1
- package/dist/team/__tests__/team-instance.test.d.ts +2 -0
- package/dist/team/__tests__/team-instance.test.d.ts.map +1 -0
- package/dist/team/__tests__/team-instance.test.js +367 -0
- package/dist/team/__tests__/team-instance.test.js.map +1 -0
- package/dist/team/__tests__/team-owner-epoch.test.js +80 -1
- package/dist/team/__tests__/team-owner-epoch.test.js.map +1 -1
- package/dist/team/__tests__/team-state-reader.test.js +50 -1
- package/dist/team/__tests__/team-state-reader.test.js.map +1 -1
- package/dist/team/__tests__/teardown-invariant.test.js +20 -2
- package/dist/team/__tests__/teardown-invariant.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session-liveness.test.js +4 -0
- package/dist/team/__tests__/tmux-session-liveness.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.create-team.test.js +497 -65
- package/dist/team/__tests__/tmux-session.create-team.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.kill-team-session.test.js +255 -60
- package/dist/team/__tests__/tmux-session.kill-team-session.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.psmux.test.d.ts +2 -0
- package/dist/team/__tests__/tmux-session.psmux.test.d.ts.map +1 -0
- package/dist/team/__tests__/tmux-session.psmux.test.js +394 -0
- package/dist/team/__tests__/tmux-session.psmux.test.js.map +1 -0
- package/dist/team/__tests__/tmux-session.spawn.test.js +113 -30
- package/dist/team/__tests__/tmux-session.spawn.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.startup.test.js +395 -26
- package/dist/team/__tests__/tmux-session.startup.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.target-membership.test.js +181 -28
- package/dist/team/__tests__/tmux-session.target-membership.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +325 -50
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/worker-activation-gate.test.js +15 -9
- package/dist/team/__tests__/worker-activation-gate.test.js.map +1 -1
- package/dist/team/__tests__/worker-bootstrap.test.js +9 -1
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/__tests__/worker-launch-ack.test.js +1792 -74
- package/dist/team/__tests__/worker-launch-ack.test.js.map +1 -1
- package/dist/team/__tests__/worker-launch-posix-transport.test.js +266 -42
- package/dist/team/__tests__/worker-launch-posix-transport.test.js.map +1 -1
- package/dist/team/__tests__/worker-launch-wrapper-posix.test.js +1 -0
- package/dist/team/__tests__/worker-launch-wrapper-posix.test.js.map +1 -1
- package/dist/team/__tests__/worktree-runtime-e2e.test.js.map +1 -1
- package/dist/team/api-interop.d.ts.map +1 -1
- package/dist/team/api-interop.js +33 -29
- package/dist/team/api-interop.js.map +1 -1
- package/dist/team/idle-nudge.d.ts +27 -4
- package/dist/team/idle-nudge.d.ts.map +1 -1
- package/dist/team/idle-nudge.js +59 -9
- package/dist/team/idle-nudge.js.map +1 -1
- package/dist/team/index.d.ts +3 -3
- package/dist/team/index.d.ts.map +1 -1
- package/dist/team/index.js +2 -2
- package/dist/team/index.js.map +1 -1
- package/dist/team/mailbox-notification-guard.d.ts +14 -2
- package/dist/team/mailbox-notification-guard.d.ts.map +1 -1
- package/dist/team/mailbox-notification-guard.js +72 -1
- package/dist/team/mailbox-notification-guard.js.map +1 -1
- package/dist/team/mcp-team-bridge.d.ts.map +1 -1
- package/dist/team/mcp-team-bridge.js +0 -8
- package/dist/team/mcp-team-bridge.js.map +1 -1
- package/dist/team/merge-orchestrator.d.ts.map +1 -1
- package/dist/team/merge-orchestrator.js +49 -0
- package/dist/team/merge-orchestrator.js.map +1 -1
- package/dist/team/model-contract.d.ts +24 -0
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/model-contract.js +64 -4
- package/dist/team/model-contract.js.map +1 -1
- package/dist/team/monitor.d.ts +25 -5
- package/dist/team/monitor.d.ts.map +1 -1
- package/dist/team/monitor.js +242 -88
- package/dist/team/monitor.js.map +1 -1
- package/dist/team/pane-readiness.d.ts.map +1 -1
- package/dist/team/pane-readiness.js +4 -1
- package/dist/team/pane-readiness.js.map +1 -1
- package/dist/team/psmux-adapter.d.ts +73 -0
- package/dist/team/psmux-adapter.d.ts.map +1 -0
- package/dist/team/psmux-adapter.js +219 -0
- package/dist/team/psmux-adapter.js.map +1 -0
- package/dist/team/recovery-request-store.d.ts +4 -0
- package/dist/team/recovery-request-store.d.ts.map +1 -1
- package/dist/team/recovery-request-store.js +16 -4
- package/dist/team/recovery-request-store.js.map +1 -1
- package/dist/team/recovery-saga.d.ts +7 -0
- package/dist/team/recovery-saga.d.ts.map +1 -1
- package/dist/team/recovery-saga.js +4 -1
- package/dist/team/recovery-saga.js.map +1 -1
- package/dist/team/runtime-cli.d.ts +36 -22
- package/dist/team/runtime-cli.d.ts.map +1 -1
- package/dist/team/runtime-cli.js +491 -354
- package/dist/team/runtime-cli.js.map +1 -1
- package/dist/team/runtime-owner-client.d.ts +6 -1
- package/dist/team/runtime-owner-client.d.ts.map +1 -1
- package/dist/team/runtime-owner-client.js +230 -78
- package/dist/team/runtime-owner-client.js.map +1 -1
- package/dist/team/runtime-v2.d.ts +62 -16
- package/dist/team/runtime-v2.d.ts.map +1 -1
- package/dist/team/runtime-v2.js +2171 -848
- package/dist/team/runtime-v2.js.map +1 -1
- package/dist/team/runtime.d.ts +20 -33
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +115 -754
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/scaling.d.ts +1 -1
- package/dist/team/scaling.d.ts.map +1 -1
- package/dist/team/scaling.js +490 -181
- package/dist/team/scaling.js.map +1 -1
- package/dist/team/stage-router.d.ts +1 -1
- package/dist/team/stage-router.d.ts.map +1 -1
- package/dist/team/stage-router.js +8 -6
- package/dist/team/stage-router.js.map +1 -1
- package/dist/team/state/tasks.d.ts +23 -3
- package/dist/team/state/tasks.d.ts.map +1 -1
- package/dist/team/state/tasks.js +234 -52
- package/dist/team/state/tasks.js.map +1 -1
- package/dist/team/state-paths.d.ts +57 -0
- package/dist/team/state-paths.d.ts.map +1 -1
- package/dist/team/state-paths.js +176 -1
- package/dist/team/state-paths.js.map +1 -1
- package/dist/team/team-instance.d.ts +71 -0
- package/dist/team/team-instance.d.ts.map +1 -0
- package/dist/team/team-instance.js +863 -0
- package/dist/team/team-instance.js.map +1 -0
- package/dist/team/team-ops.d.ts +13 -1
- package/dist/team/team-ops.d.ts.map +1 -1
- package/dist/team/team-ops.js +325 -36
- package/dist/team/team-ops.js.map +1 -1
- package/dist/team/team-owner-epoch.d.ts +21 -0
- package/dist/team/team-owner-epoch.d.ts.map +1 -1
- package/dist/team/team-owner-epoch.js +128 -9
- package/dist/team/team-owner-epoch.js.map +1 -1
- package/dist/team/team-state-reader.d.ts.map +1 -1
- package/dist/team/team-state-reader.js +4 -1
- package/dist/team/team-state-reader.js.map +1 -1
- package/dist/team/tmux-session.d.ts +150 -23
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +1837 -260
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/types.d.ts +130 -1
- package/dist/team/types.d.ts.map +1 -1
- package/dist/team/types.js +34 -0
- package/dist/team/types.js.map +1 -1
- package/dist/team/worker-activation-gate.d.ts.map +1 -1
- package/dist/team/worker-activation-gate.js +14 -12
- package/dist/team/worker-activation-gate.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts +2 -0
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +25 -5
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/dist/team/worker-launch-ack.d.ts +31 -1
- package/dist/team/worker-launch-ack.d.ts.map +1 -1
- package/dist/team/worker-launch-ack.js +966 -148
- package/dist/team/worker-launch-ack.js.map +1 -1
- package/dist/tools/__tests__/cancel-integration.test.js +99 -21
- package/dist/tools/__tests__/cancel-integration.test.js.map +1 -1
- package/dist/tools/__tests__/state-tools-nongit-ownership.test.js +2 -2
- package/dist/tools/__tests__/state-tools-nongit-ownership.test.js.map +1 -1
- package/dist/tools/__tests__/state-tools.test.js +927 -6
- package/dist/tools/__tests__/state-tools.test.js.map +1 -1
- package/dist/tools/skills-tools.js +1 -1
- package/dist/tools/skills-tools.js.map +1 -1
- package/dist/tools/state-tools.d.ts.map +1 -1
- package/dist/tools/state-tools.js +456 -456
- package/dist/tools/state-tools.js.map +1 -1
- package/dist/utils/__tests__/cache-occupancy.test.js +25 -0
- package/dist/utils/__tests__/cache-occupancy.test.js.map +1 -1
- package/dist/utils/cache-occupancy.d.ts +10 -2
- package/dist/utils/cache-occupancy.d.ts.map +1 -1
- package/dist/utils/cache-occupancy.js +18 -6
- package/dist/utils/cache-occupancy.js.map +1 -1
- package/dist/utils/config-dir.d.ts +4 -4
- package/dist/utils/config-dir.js +5 -5
- package/dist/utils/config-dir.js.map +1 -1
- package/dist/utils/host-detection.d.ts +2 -4
- package/dist/utils/host-detection.d.ts.map +1 -1
- package/dist/utils/host-detection.js +4 -7
- package/dist/utils/host-detection.js.map +1 -1
- package/dist/utils/host-signal.d.ts +19 -0
- package/dist/utils/host-signal.d.ts.map +1 -0
- package/dist/utils/host-signal.js +24 -0
- package/dist/utils/host-signal.js.map +1 -0
- package/dist/workflow/__tests__/alias-resolver.test.js +8 -6
- package/dist/workflow/__tests__/alias-resolver.test.js.map +1 -1
- package/dist/workflow/__tests__/projections.test.js +8 -6
- package/dist/workflow/__tests__/projections.test.js.map +1 -1
- package/dist/workflow/__tests__/registry.test.js +11 -4
- package/dist/workflow/__tests__/registry.test.js.map +1 -1
- package/dist/workflow/registry.d.ts.map +1 -1
- package/dist/workflow/registry.js +11 -1
- package/dist/workflow/registry.js.map +1 -1
- package/docs/ARCHITECTURE.md +57 -31
- package/docs/CLAUDE.md +2 -2
- package/docs/COMPATIBILITY.md +6 -0
- package/docs/FEATURES.md +61 -0
- package/docs/GETTING-STARTED.md +31 -25
- package/docs/HOOKS.md +102 -26
- package/docs/MIGRATION.md +261 -1
- package/docs/PERFORMANCE-MONITORING.md +1 -1
- package/docs/REFERENCE.md +157 -28
- package/docs/TEAM-WORKTREE-MODE.md +3 -1
- package/docs/TOOLS.md +9 -3
- package/docs/adr/03665-jev-degradation-contract.md +3 -0
- package/docs/adr/03671-script-side-judgment-channel.md +37 -0
- package/docs/adr/03672-env-activated-active-mode.md +3 -0
- package/docs/business/README.md +6 -0
- package/docs/copilot-instructions.md +1 -1
- package/docs/graph-contained-filesystem.md +77 -0
- package/docs/issues/issue-3668-ralph-namespace.md +3 -3
- package/docs/issues/issue-3669-jev-judgment-points.md +103 -0
- package/docs/shared/features.md +4 -2
- package/docs/shipyard.md +66 -7
- package/docs/standards/architecture.md +6 -0
- package/docs/standards/data.md +4 -0
- package/docs/standards/process.md +5 -0
- package/hooks/hooks.json +35 -25
- package/native/contained-fs.c +292 -0
- package/package.json +15 -7
- package/plugin.json +23 -0
- package/scripts/budget-guard.mjs +217 -0
- package/scripts/build-bridge-entry.mjs +5 -0
- package/scripts/build-contained-fs.mjs +38 -0
- package/scripts/build-generated-artifact-authorization.mjs +100 -0
- package/scripts/build-mcp-server.mjs +5 -0
- package/scripts/build-runtime-cli.mjs +7 -0
- package/scripts/build-team-server.mjs +7 -0
- package/scripts/ci/check-multirepo-paths.mjs +2 -2
- package/scripts/code-simplifier.mjs +18 -0
- package/scripts/copilot/build-agents.mjs +173 -0
- package/scripts/copilot/build-hooks.mjs +128 -0
- package/scripts/generate-inventory-graph.mjs +13 -4
- package/scripts/jev-eval.mjs +257 -0
- package/scripts/jev-resolve.mjs +245 -0
- package/scripts/keyword-detector.mjs +120 -18
- package/scripts/lib/atomic-write.mjs +27 -445
- package/scripts/lib/cache-occupancy.mjs +21 -6
- package/scripts/lib/config-dir.cjs +2 -2
- package/scripts/lib/config-dir.mjs +2 -2
- package/scripts/lib/config-dir.sh +2 -1
- package/scripts/lib/copilot-hook-adapter.cjs +325 -0
- package/scripts/lib/enforcement-log.mjs +46 -0
- package/scripts/lib/hook-command-normalizer.mjs +34 -12
- package/scripts/lib/hud-cache-wrapper.sh +79 -19
- package/scripts/lib/hud-wrapper-template.txt +1 -1
- package/scripts/lib/jev-shadow.mjs +49 -0
- package/scripts/lib/pre-tool-enforcer-preflight.mjs +10 -3
- package/scripts/lib/read-budget-preflight.mjs +410 -0
- package/scripts/lib/state-lock.mjs +750 -0
- package/scripts/lib/state-root.cjs +9 -3
- package/scripts/lib/state-root.mjs +34 -4
- package/scripts/lib/workflow-profile-runtime.mjs +1 -1
- package/scripts/persistent-mode.mjs +157 -18
- package/scripts/plugin-setup.mjs +66 -18
- package/scripts/plugin-shipping-surface.mjs +35 -3
- package/scripts/post-tool-directory-context-injector.mjs +115 -0
- package/scripts/post-tool-verifier.mjs +61 -3
- package/scripts/pre-tool-enforcer.mjs +118 -2
- package/scripts/release-boundary.mjs +14 -0
- package/scripts/release.ts +29 -16
- package/scripts/repair-plugin-cache.mjs +1 -1
- package/scripts/run-provider-advisor.js +14 -0
- package/scripts/run.cjs +66 -14
- package/scripts/session-end.mjs +3 -7
- package/scripts/session-start.mjs +40 -14
- package/scripts/setup-claude-md.sh +36 -5
- package/scripts/setup-progress.mjs +1 -1
- package/scripts/shipyard-audit.mjs +322 -0
- package/scripts/sync-version.sh +9 -1
- package/scripts/uninstall.sh +37 -37
- package/scripts/verify-graph-contained-fs.mjs +202 -0
- package/skills/AGENTS.md +48 -13
- package/skills/agent-doc-discipline/SKILL.md +54 -0
- package/skills/architecture-survey/SKILL.md +59 -0
- package/skills/ask-navigator/SKILL.md +21 -5
- package/skills/cancel/SKILL.md +288 -299
- package/skills/configure-notifications/SKILL.md +11 -11
- package/skills/debug/SKILL.md +3 -0
- package/skills/deep-interview/SKILL.md +16 -4
- package/skills/deepinit/SKILL.md +47 -24
- package/skills/diagram/SKILL.md +125 -0
- package/skills/drydock/SKILL.md +50 -6
- package/skills/harbor/SKILL.md +169 -0
- package/skills/hud/SKILL.md +10 -10
- package/skills/intent/SKILL.md +95 -0
- package/skills/launch/SKILL.md +42 -9
- package/skills/loft/SKILL.md +1 -1
- package/skills/map/SKILL.md +73 -0
- package/skills/minimal-prose-discipline/SKILL.md +73 -0
- package/skills/omc-ado-auto-review/SKILL.md +1 -4
- package/skills/omc-ado-review/SKILL.md +1 -4
- package/skills/omc-ado-setup/SKILL.md +1 -4
- package/skills/omc-ado-sprint/SKILL.md +1 -4
- package/skills/omc-ado-triage/SKILL.md +1 -4
- package/skills/omc-doctor/SKILL.md +32 -27
- package/skills/omc-gh-auto-review/SKILL.md +1 -4
- package/skills/omc-gh-project/SKILL.md +1 -4
- package/skills/omc-gh-review/SKILL.md +1 -4
- package/skills/omc-gh-setup/SKILL.md +1 -4
- package/skills/omc-gh-triage/SKILL.md +1 -4
- package/skills/omc-setup/SKILL.md +2 -2
- package/skills/omc-setup/phases/02-configure.md +7 -6
- package/skills/omc-setup/phases/03-integrations.md +7 -7
- package/skills/omc-setup/phases/04-welcome.md +2 -2
- package/skills/pr/SKILL.md +66 -0
- package/skills/refit/SKILL.md +46 -0
- package/skills/review/SKILL.md +9 -0
- package/skills/skill/SKILL.md +7 -7
- package/skills/skillify/SKILL.md +1 -1
- package/skills/tdd/SKILL.md +33 -0
- package/skills/team/SKILL.md +84 -81
- package/templates/hooks/keyword-detector.mjs +24 -10
- package/templates/hooks/lib/atomic-write.mjs +27 -445
- package/templates/hooks/lib/cache-occupancy.mjs +20 -6
- package/templates/hooks/lib/config-dir.mjs +2 -2
- package/templates/hooks/lib/state-lock.mjs +4 -0
- package/templates/hooks/lib/state-root.mjs +34 -4
- package/templates/hooks/lib/workflow-profile-runtime.mjs +1 -1
- package/templates/hooks/persistent-mode.mjs +59 -17
- package/templates/hooks/session-start.mjs +29 -9
- package/dist/__tests__/safe-command-approver.test.d.ts +0 -2
- package/dist/__tests__/safe-command-approver.test.d.ts.map +0 -1
- package/dist/__tests__/safe-command-approver.test.js +0 -103
- package/dist/__tests__/safe-command-approver.test.js.map +0 -1
- package/dist/installer/permissions.d.ts +0 -9
- package/dist/installer/permissions.d.ts.map +0 -1
- package/dist/installer/permissions.js +0 -59
- package/dist/installer/permissions.js.map +0 -1
- package/scripts/safe-command-approver.mjs +0 -156
|
@@ -0,0 +1,863 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { lstat, mkdir, readFile, readdir, rename, rm, unlink, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { TEAM_NAME_SAFE_PATTERN } from './contracts.js';
|
|
5
|
+
import { canonicalTeamCwd, canonicalTeamStatePath, canonicalTeamStateRoot, assertTeamStatePathSafe, assertTeamStatePathSafeSync, teamInstanceLifecycleLockPath, teamWorkspaceHash, TeamPaths, } from './state-paths.js';
|
|
6
|
+
import { withProcessIdentityFileLock } from './process-identity-lock.js';
|
|
7
|
+
import { currentProcessStartIdentity, isProcessIdentityDead, isValidProcessStartIdentity, } from './team-owner-epoch.js';
|
|
8
|
+
import { isValidTeamInstanceId } from './types.js';
|
|
9
|
+
export class TeamInstanceError extends Error {
|
|
10
|
+
code;
|
|
11
|
+
constructor(code, message = code, options) {
|
|
12
|
+
super(message, options);
|
|
13
|
+
this.name = 'TeamInstanceError';
|
|
14
|
+
this.code = code;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const TEAM_INSTANCE_RESERVATION_PHASES = ['pending', 'active'];
|
|
18
|
+
const TEAM_INSTANCE_CLEANUP_PHASES = [
|
|
19
|
+
'prepared', 'detached', 'removing', 'failed', 'completed',
|
|
20
|
+
];
|
|
21
|
+
function fail(code, message = code) {
|
|
22
|
+
throw new TeamInstanceError(code, message);
|
|
23
|
+
}
|
|
24
|
+
function stableJson(value) {
|
|
25
|
+
if (value === null || typeof value !== 'object')
|
|
26
|
+
return JSON.stringify(value) ?? 'undefined';
|
|
27
|
+
if (Array.isArray(value))
|
|
28
|
+
return `[${value.map(stableJson).join(',')}]`;
|
|
29
|
+
const record = value;
|
|
30
|
+
return `{${Object.keys(record).sort().map(key => `${JSON.stringify(key)}:${stableJson(record[key])}`).join(',')}}`;
|
|
31
|
+
}
|
|
32
|
+
function isRecord(value) {
|
|
33
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
34
|
+
}
|
|
35
|
+
function isTimestamp(value) {
|
|
36
|
+
return typeof value === 'string' && Number.isFinite(Date.parse(value));
|
|
37
|
+
}
|
|
38
|
+
function validateTeamName(teamName) {
|
|
39
|
+
if (!TEAM_NAME_SAFE_PATTERN.test(teamName))
|
|
40
|
+
fail('team_instance_name_invalid', 'invalid_team_name');
|
|
41
|
+
}
|
|
42
|
+
function validateCwd(cwd) {
|
|
43
|
+
if (typeof cwd !== 'string' || cwd.trim().length === 0) {
|
|
44
|
+
fail('team_instance_cwd_invalid', 'invalid_cwd');
|
|
45
|
+
}
|
|
46
|
+
return canonicalTeamCwd(cwd);
|
|
47
|
+
}
|
|
48
|
+
function validateInstanceId(instanceId) {
|
|
49
|
+
if (!isValidTeamInstanceId(instanceId))
|
|
50
|
+
fail('team_instance_id_invalid', 'invalid_instance_id');
|
|
51
|
+
return instanceId.toLowerCase();
|
|
52
|
+
}
|
|
53
|
+
function expectedPaths(binding) {
|
|
54
|
+
return {
|
|
55
|
+
reservation: canonicalTeamStatePath(binding.cwd, TeamPaths.teamInstanceReservation(binding.workspace_hash, binding.team_name)),
|
|
56
|
+
cleanupRoot: canonicalTeamStatePath(binding.cwd, TeamPaths.teamInstanceCleanupRoot(binding.workspace_hash, binding.team_name, binding.instance_id)),
|
|
57
|
+
cleanup: canonicalTeamStatePath(binding.cwd, TeamPaths.teamInstanceCleanupReceipt(binding.workspace_hash, binding.team_name, binding.instance_id)),
|
|
58
|
+
detached: canonicalTeamStatePath(binding.cwd, TeamPaths.teamInstanceDetachedRoot(binding.workspace_hash, binding.team_name, binding.instance_id)),
|
|
59
|
+
lifecycle: teamInstanceLifecycleLockPath(binding.cwd, binding.team_name),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
async function assertBindingPathsSafe(binding) {
|
|
63
|
+
const paths = expectedPaths(binding);
|
|
64
|
+
try {
|
|
65
|
+
await assertTeamStatePathSafe(binding.cwd, binding.state_root);
|
|
66
|
+
await assertTeamStatePathSafe(binding.cwd, paths.reservation);
|
|
67
|
+
await assertTeamStatePathSafe(binding.cwd, paths.cleanupRoot);
|
|
68
|
+
await assertTeamStatePathSafe(binding.cwd, paths.cleanup);
|
|
69
|
+
await assertTeamStatePathSafe(binding.cwd, paths.detached);
|
|
70
|
+
await assertTeamStatePathSafe(binding.cwd, paths.lifecycle);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (error instanceof TeamInstanceError)
|
|
74
|
+
throw error;
|
|
75
|
+
fail('team_instance_state_corrupt', error instanceof Error ? error.message : String(error));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async function assertExternalCleanupPathsSafe(binding) {
|
|
79
|
+
const paths = expectedPaths(binding);
|
|
80
|
+
try {
|
|
81
|
+
await assertTeamStatePathSafe(binding.cwd, paths.cleanupRoot);
|
|
82
|
+
await assertTeamStatePathSafe(binding.cwd, paths.cleanup);
|
|
83
|
+
await assertTeamStatePathSafe(binding.cwd, paths.detached);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (error instanceof TeamInstanceError)
|
|
87
|
+
throw error;
|
|
88
|
+
fail('team_instance_state_corrupt', error instanceof Error ? error.message : String(error));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function canonicalPath(path) {
|
|
92
|
+
return resolve(path);
|
|
93
|
+
}
|
|
94
|
+
function sameBinding(a, b) {
|
|
95
|
+
return a.instance_id === b.instance_id
|
|
96
|
+
&& a.team_name === b.team_name
|
|
97
|
+
&& canonicalTeamCwd(a.cwd) === b.cwd
|
|
98
|
+
&& a.workspace_hash === b.workspace_hash
|
|
99
|
+
&& canonicalTeamStatePath(b.cwd, a.state_root) === canonicalPath(b.state_root);
|
|
100
|
+
}
|
|
101
|
+
function currentOwner() {
|
|
102
|
+
const processStartedAt = currentProcessStartIdentity();
|
|
103
|
+
if (!isValidProcessStartIdentity(processStartedAt)) {
|
|
104
|
+
fail('team_instance_process_identity_unavailable');
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
pid: process.pid,
|
|
108
|
+
process_started_at: processStartedAt,
|
|
109
|
+
nonce: randomUUID(),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function ownerMatchesCurrent(owner) {
|
|
113
|
+
const processStartedAt = currentProcessStartIdentity();
|
|
114
|
+
return processStartedAt !== null
|
|
115
|
+
&& owner.pid === process.pid
|
|
116
|
+
&& owner.process_started_at === processStartedAt;
|
|
117
|
+
}
|
|
118
|
+
async function readJsonState(path) {
|
|
119
|
+
try {
|
|
120
|
+
const stat = await lstat(path);
|
|
121
|
+
if (!stat.isFile())
|
|
122
|
+
return { kind: 'invalid' };
|
|
123
|
+
return { kind: 'value', value: JSON.parse(await readFile(path, 'utf8')) };
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
if (error.code === 'ENOENT')
|
|
127
|
+
return { kind: 'missing' };
|
|
128
|
+
return { kind: 'invalid' };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async function pathKind(path) {
|
|
132
|
+
try {
|
|
133
|
+
const stat = await lstat(path);
|
|
134
|
+
if (stat.isDirectory())
|
|
135
|
+
return 'directory';
|
|
136
|
+
if (stat.isFile())
|
|
137
|
+
return 'file';
|
|
138
|
+
return 'other';
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
if (error.code === 'ENOENT')
|
|
142
|
+
return 'missing';
|
|
143
|
+
fail('team_instance_state_corrupt', `state_path_unreadable:${path}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function defaultPublish(path, value) {
|
|
147
|
+
const bytes = JSON.stringify(value, null, 2);
|
|
148
|
+
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
149
|
+
const tempPath = `${path}.tmp.${process.pid}.${randomUUID()}`;
|
|
150
|
+
try {
|
|
151
|
+
await writeFile(tempPath, bytes, { encoding: 'utf8', mode: 0o600, flag: 'wx' });
|
|
152
|
+
await rename(tempPath, path);
|
|
153
|
+
const persisted = JSON.parse(await readFile(path, 'utf8'));
|
|
154
|
+
if (stableJson(persisted) !== stableJson(value)) {
|
|
155
|
+
throw new Error('publication_verification_failed');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
try {
|
|
160
|
+
await unlink(tempPath);
|
|
161
|
+
}
|
|
162
|
+
catch { /* successful rename removes the temp path */ }
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
async function verifyPublished(path, value) {
|
|
166
|
+
const state = await readJsonState(path);
|
|
167
|
+
if (state.kind !== 'value' || stableJson(state.value) !== stableJson(value)) {
|
|
168
|
+
throw new Error('publication_verification_failed');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async function publishReservation(record, io) {
|
|
172
|
+
try {
|
|
173
|
+
await assertTeamStatePathSafe(record.cwd, record.reservation_path);
|
|
174
|
+
if (io?.publishReservation)
|
|
175
|
+
await io.publishReservation(record.reservation_path, record);
|
|
176
|
+
else
|
|
177
|
+
await defaultPublish(record.reservation_path, record);
|
|
178
|
+
await verifyPublished(record.reservation_path, record);
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
throw new TeamInstanceError('team_instance_receipt_publish_failed', `reservation_publish_failed:${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async function publishCleanupReceipt(record, io, path = record.receipt_path) {
|
|
185
|
+
try {
|
|
186
|
+
await assertTeamStatePathSafe(record.cwd, path);
|
|
187
|
+
if (io?.publishCleanupReceipt)
|
|
188
|
+
await io.publishCleanupReceipt(path, record);
|
|
189
|
+
else
|
|
190
|
+
await defaultPublish(path, record);
|
|
191
|
+
await verifyPublished(path, record);
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
throw new TeamInstanceError('team_instance_receipt_publish_failed', `cleanup_receipt_publish_failed:${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Publish the first cleanup receipt as a directory transaction. The permanent
|
|
199
|
+
* instance directory is created only by the final directory rename, after the
|
|
200
|
+
* complete receipt has been written and verified in a unique sibling staging
|
|
201
|
+
* directory. A write/rename failure therefore leaves no empty cleanupRoot
|
|
202
|
+
* that could masquerade as retained history on retry.
|
|
203
|
+
*/
|
|
204
|
+
async function publishInitialCleanupReceipt(record, io) {
|
|
205
|
+
const cleanupRoot = dirname(record.receipt_path);
|
|
206
|
+
const stagingRoot = `${cleanupRoot}.staging-${process.pid}-${randomUUID()}`;
|
|
207
|
+
let published = false;
|
|
208
|
+
try {
|
|
209
|
+
await assertTeamStatePathSafe(record.cwd, cleanupRoot);
|
|
210
|
+
await assertTeamStatePathSafe(record.cwd, stagingRoot);
|
|
211
|
+
if (await pathKind(cleanupRoot) !== 'missing') {
|
|
212
|
+
fail('team_instance_authority_corrupt', 'cleanup_root_already_exists');
|
|
213
|
+
}
|
|
214
|
+
// Reservation and canonical state were independently revalidated by the
|
|
215
|
+
// caller. An abandoned staging directory is not authority to adopt, nor
|
|
216
|
+
// a reason to block this fresh transaction; leave its evidence untouched.
|
|
217
|
+
await mkdir(stagingRoot, { recursive: true, mode: 0o700 });
|
|
218
|
+
const stagedReceiptPath = join(stagingRoot, 'cleanup.json');
|
|
219
|
+
await publishCleanupReceipt(record, io, stagedReceiptPath);
|
|
220
|
+
await rename(stagingRoot, cleanupRoot);
|
|
221
|
+
published = true;
|
|
222
|
+
await verifyPublished(record.receipt_path, record);
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
if (published) {
|
|
226
|
+
if (error instanceof TeamInstanceError)
|
|
227
|
+
throw error;
|
|
228
|
+
throw new TeamInstanceError('team_instance_receipt_publish_failed', `initial_cleanup_receipt_verification_failed:${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
await rm(stagingRoot, { recursive: true, force: true });
|
|
232
|
+
}
|
|
233
|
+
catch { /* best effort; no permanent target was published */ }
|
|
234
|
+
if (error instanceof TeamInstanceError)
|
|
235
|
+
throw error;
|
|
236
|
+
throw new TeamInstanceError('team_instance_receipt_publish_failed', `initial_cleanup_receipt_publish_failed:${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
async function readReservation(binding) {
|
|
240
|
+
const path = expectedPaths(binding).reservation;
|
|
241
|
+
const state = await readJsonState(path);
|
|
242
|
+
if (state.kind === 'missing')
|
|
243
|
+
return null;
|
|
244
|
+
if (state.kind !== 'value' || !isValidReservation(state.value)) {
|
|
245
|
+
fail('team_instance_authority_corrupt', 'invalid_team_instance_reservation');
|
|
246
|
+
}
|
|
247
|
+
return state.value;
|
|
248
|
+
}
|
|
249
|
+
async function readCleanupReceipt(binding) {
|
|
250
|
+
await assertExternalCleanupPathsSafe(binding);
|
|
251
|
+
const paths = expectedPaths(binding);
|
|
252
|
+
const path = paths.cleanup;
|
|
253
|
+
const state = await readJsonState(path);
|
|
254
|
+
if (state.kind === 'missing') {
|
|
255
|
+
const rootKind = await pathKind(paths.cleanupRoot);
|
|
256
|
+
if (rootKind !== 'missing')
|
|
257
|
+
fail('team_instance_authority_corrupt', 'cleanup_receipt_missing');
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
if (state.kind !== 'value' || !isValidCleanupRecord(state.value, binding)) {
|
|
261
|
+
fail('team_instance_authority_corrupt', 'invalid_team_instance_cleanup_receipt');
|
|
262
|
+
}
|
|
263
|
+
return state.value;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Cleanup authority is intentionally monotonic: once a UUID has a cleanup
|
|
267
|
+
* directory, that UUID can never be admitted again. Even an empty, malformed,
|
|
268
|
+
* or otherwise unreadable directory is evidence that must fail closed.
|
|
269
|
+
*/
|
|
270
|
+
async function hasHistoricalCleanupAuthority(binding) {
|
|
271
|
+
const root = expectedPaths(binding).cleanupRoot;
|
|
272
|
+
const kind = await pathKind(root);
|
|
273
|
+
if (kind !== 'missing')
|
|
274
|
+
return true;
|
|
275
|
+
const parent = dirname(root);
|
|
276
|
+
try {
|
|
277
|
+
const entries = await readdir(parent);
|
|
278
|
+
return entries.some(entry => entry.startsWith(`${basename(root)}.staging-`));
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
if (error.code === 'ENOENT')
|
|
282
|
+
return false;
|
|
283
|
+
fail('team_instance_authority_corrupt', `cleanup_authority_parent_unreadable:${String(error)}`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function isValidProcessIdentity(value) {
|
|
287
|
+
return isRecord(value)
|
|
288
|
+
&& typeof value.pid === 'number' && Number.isSafeInteger(value.pid) && value.pid > 0
|
|
289
|
+
&& isValidProcessStartIdentity(value.process_started_at)
|
|
290
|
+
&& typeof value.nonce === 'string' && value.nonce.length > 0;
|
|
291
|
+
}
|
|
292
|
+
function isValidReservation(value) {
|
|
293
|
+
if (!isRecord(value)
|
|
294
|
+
|| value.schema_version !== 1
|
|
295
|
+
|| value.kind !== 'team-instance-reservation'
|
|
296
|
+
|| !isValidTeamInstanceId(value.instance_id)
|
|
297
|
+
|| !isNonEmptyString(value.team_name)
|
|
298
|
+
|| !TEAM_NAME_SAFE_PATTERN.test(value.team_name)
|
|
299
|
+
|| !isNonEmptyString(value.cwd)
|
|
300
|
+
|| !isNonEmptyString(value.state_root)
|
|
301
|
+
|| !TEAM_INSTANCE_RESERVATION_PHASES.includes(value.phase)
|
|
302
|
+
|| !isValidProcessIdentity(value.owner)
|
|
303
|
+
|| !isNonEmptyString(value.reservation_path)
|
|
304
|
+
|| !isNonEmptyString(value.lifecycle_lock_path)
|
|
305
|
+
|| !isTimestamp(value.created_at)
|
|
306
|
+
|| !isTimestamp(value.updated_at))
|
|
307
|
+
return false;
|
|
308
|
+
const recordCwd = canonicalTeamCwd(value.cwd);
|
|
309
|
+
const recordBinding = {
|
|
310
|
+
instance_id: value.instance_id,
|
|
311
|
+
team_name: value.team_name,
|
|
312
|
+
cwd: recordCwd,
|
|
313
|
+
workspace_hash: teamWorkspaceHash(recordCwd, value.team_name),
|
|
314
|
+
state_root: canonicalTeamStateRoot(recordCwd, value.team_name),
|
|
315
|
+
};
|
|
316
|
+
const expected = expectedPaths(recordBinding);
|
|
317
|
+
return value.workspace_hash === recordBinding.workspace_hash
|
|
318
|
+
&& canonicalTeamStatePath(recordCwd, value.state_root) === canonicalPath(recordBinding.state_root)
|
|
319
|
+
&& canonicalTeamStatePath(recordCwd, value.reservation_path) === expected.reservation
|
|
320
|
+
&& canonicalTeamStatePath(recordCwd, value.lifecycle_lock_path) === expected.lifecycle;
|
|
321
|
+
}
|
|
322
|
+
function isValidAuthorization(value) {
|
|
323
|
+
return isRecord(value)
|
|
324
|
+
&& value.protocol === 'caller-owned-final-state-v1'
|
|
325
|
+
&& value.providers === 'disposed'
|
|
326
|
+
&& value.panes === 'disposed'
|
|
327
|
+
&& value.worktrees === 'disposed';
|
|
328
|
+
}
|
|
329
|
+
function isValidCleanupRecord(value, binding) {
|
|
330
|
+
if (!isRecord(value)
|
|
331
|
+
|| value.schema_version !== 1
|
|
332
|
+
|| value.kind !== 'team-instance-cleanup'
|
|
333
|
+
|| !isValidTeamInstanceId(value.instance_id)
|
|
334
|
+
|| !isNonEmptyString(value.team_name)
|
|
335
|
+
|| !isNonEmptyString(value.cwd)
|
|
336
|
+
|| value.workspace_hash !== binding.workspace_hash
|
|
337
|
+
|| !isNonEmptyString(value.state_root)
|
|
338
|
+
|| !isNonEmptyString(value.detached_root)
|
|
339
|
+
|| !isNonEmptyString(value.receipt_path)
|
|
340
|
+
|| !TEAM_INSTANCE_CLEANUP_PHASES.includes(value.phase)
|
|
341
|
+
|| (value.detached_at !== undefined && !isTimestamp(value.detached_at))
|
|
342
|
+
|| (value.phase === 'prepared' && value.detached_at !== undefined)
|
|
343
|
+
|| (value.phase !== 'prepared' && value.detached_at === undefined)
|
|
344
|
+
|| !isValidAuthorization(value.authorization)
|
|
345
|
+
|| !isTimestamp(value.created_at)
|
|
346
|
+
|| !isTimestamp(value.updated_at)
|
|
347
|
+
|| (value.failure_reason !== undefined && typeof value.failure_reason !== 'string'))
|
|
348
|
+
return false;
|
|
349
|
+
const expected = expectedPaths(binding);
|
|
350
|
+
return value.instance_id === binding.instance_id
|
|
351
|
+
&& value.team_name === binding.team_name
|
|
352
|
+
&& canonicalTeamCwd(value.cwd) === binding.cwd
|
|
353
|
+
&& canonicalTeamStatePath(binding.cwd, value.state_root) === canonicalPath(binding.state_root)
|
|
354
|
+
&& canonicalTeamStatePath(binding.cwd, value.detached_root) === canonicalPath(expected.detached)
|
|
355
|
+
&& canonicalTeamStatePath(binding.cwd, value.receipt_path) === expected.cleanup;
|
|
356
|
+
}
|
|
357
|
+
function isNonEmptyString(value) {
|
|
358
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
359
|
+
}
|
|
360
|
+
function identityFromDocument(value, binding) {
|
|
361
|
+
if (!isRecord(value))
|
|
362
|
+
fail('team_instance_state_corrupt', 'invalid_team_config_document');
|
|
363
|
+
if (value.name !== undefined && value.name !== binding.team_name) {
|
|
364
|
+
fail('team_instance_state_corrupt', 'team_name_binding_mismatch');
|
|
365
|
+
}
|
|
366
|
+
if (value.instance_id === undefined)
|
|
367
|
+
return undefined;
|
|
368
|
+
if (!isValidTeamInstanceId(value.instance_id)) {
|
|
369
|
+
fail('team_instance_state_corrupt', 'invalid_team_instance_id');
|
|
370
|
+
}
|
|
371
|
+
if (value.leader_cwd !== undefined) {
|
|
372
|
+
if (typeof value.leader_cwd !== 'string' || canonicalTeamCwd(value.leader_cwd) !== binding.cwd) {
|
|
373
|
+
fail('team_instance_mismatch', 'team_cwd_binding_mismatch');
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
if (value.team_state_root !== undefined) {
|
|
377
|
+
if (typeof value.team_state_root !== 'string'
|
|
378
|
+
|| canonicalTeamStatePath(binding.cwd, value.team_state_root) !== canonicalPath(binding.state_root)) {
|
|
379
|
+
fail('team_instance_mismatch', 'team_state_root_binding_mismatch');
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return value.instance_id.toLowerCase();
|
|
383
|
+
}
|
|
384
|
+
async function inspectTeamState(binding) {
|
|
385
|
+
await assertTeamStatePathSafe(binding.cwd, binding.state_root);
|
|
386
|
+
const root = binding.state_root;
|
|
387
|
+
const kind = await pathKind(root);
|
|
388
|
+
if (kind === 'missing')
|
|
389
|
+
return { observed_state: 'missing' };
|
|
390
|
+
if (kind !== 'directory')
|
|
391
|
+
fail('team_instance_state_corrupt', 'team_state_root_not_directory');
|
|
392
|
+
let entries;
|
|
393
|
+
try {
|
|
394
|
+
entries = await readdir(root);
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
fail('team_instance_state_corrupt', `team_state_root_unreadable:${error instanceof Error ? error.message : String(error)}`);
|
|
398
|
+
}
|
|
399
|
+
if (entries.length === 0)
|
|
400
|
+
return { observed_state: 'empty' };
|
|
401
|
+
const identities = [];
|
|
402
|
+
for (const fileName of ['config.json', 'manifest.json']) {
|
|
403
|
+
const path = join(root, fileName);
|
|
404
|
+
const fileKind = await pathKind(path);
|
|
405
|
+
if (fileKind === 'missing')
|
|
406
|
+
continue;
|
|
407
|
+
if (fileKind !== 'file')
|
|
408
|
+
fail('team_instance_state_corrupt', `team_state_document_not_file:${fileName}`);
|
|
409
|
+
const state = await readJsonState(path);
|
|
410
|
+
if (state.kind !== 'value')
|
|
411
|
+
fail('team_instance_state_corrupt', `invalid_team_state_document:${fileName}`);
|
|
412
|
+
const identity = identityFromDocument(state.value, binding);
|
|
413
|
+
if (identity === undefined)
|
|
414
|
+
fail('team_instance_state_unknown', 'team_state_identity_missing');
|
|
415
|
+
identities.push(identity);
|
|
416
|
+
}
|
|
417
|
+
if (identities.length === 0)
|
|
418
|
+
fail('team_instance_state_unknown', 'team_state_identity_missing');
|
|
419
|
+
if (identities.some(identity => identity !== binding.instance_id.toLowerCase())) {
|
|
420
|
+
fail('team_instance_newer_instance', 'team_instance_identity_mismatch');
|
|
421
|
+
}
|
|
422
|
+
if (new Set(identities).size !== 1)
|
|
423
|
+
fail('team_instance_state_corrupt', 'team_state_identity_conflict');
|
|
424
|
+
return { observed_state: 'bound', instance_id: identities[0] };
|
|
425
|
+
}
|
|
426
|
+
function bindingFromInput(input, requireInstanceId) {
|
|
427
|
+
validateTeamName(input.teamName);
|
|
428
|
+
const cwd = validateCwd(input.cwd);
|
|
429
|
+
const instanceId = input.instanceId === undefined
|
|
430
|
+
? (requireInstanceId ? fail('team_instance_id_invalid', 'instance_id_required') : randomUUID())
|
|
431
|
+
: validateInstanceId(input.instanceId);
|
|
432
|
+
return {
|
|
433
|
+
instance_id: instanceId,
|
|
434
|
+
team_name: input.teamName,
|
|
435
|
+
cwd,
|
|
436
|
+
workspace_hash: teamWorkspaceHash(cwd, input.teamName),
|
|
437
|
+
state_root: canonicalTeamStateRoot(cwd, input.teamName),
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
function bindingFromBoundInput(input) {
|
|
441
|
+
if ('team_name' in input) {
|
|
442
|
+
const binding = bindingFromInput({ teamName: input.team_name, cwd: input.cwd, instanceId: input.instance_id }, true);
|
|
443
|
+
if (!sameBinding(input, binding))
|
|
444
|
+
fail('team_instance_mismatch', 'invalid_team_instance_binding');
|
|
445
|
+
return binding;
|
|
446
|
+
}
|
|
447
|
+
return bindingFromInput(input, true);
|
|
448
|
+
}
|
|
449
|
+
function reservationForBinding(binding, phase, owner, createdAt = new Date().toISOString()) {
|
|
450
|
+
const paths = expectedPaths(binding);
|
|
451
|
+
return {
|
|
452
|
+
schema_version: 1,
|
|
453
|
+
kind: 'team-instance-reservation',
|
|
454
|
+
instance_id: binding.instance_id,
|
|
455
|
+
team_name: binding.team_name,
|
|
456
|
+
cwd: binding.cwd,
|
|
457
|
+
workspace_hash: binding.workspace_hash,
|
|
458
|
+
state_root: binding.state_root,
|
|
459
|
+
phase,
|
|
460
|
+
owner,
|
|
461
|
+
reservation_path: paths.reservation,
|
|
462
|
+
lifecycle_lock_path: paths.lifecycle,
|
|
463
|
+
created_at: createdAt,
|
|
464
|
+
updated_at: new Date().toISOString(),
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
function assertAuthorization(authorization) {
|
|
468
|
+
if (!isValidAuthorization(authorization)) {
|
|
469
|
+
fail('team_instance_final_state_required', 'caller_owned_final_state_protocol_required');
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
function assertSameAuthorization(expected, actual) {
|
|
473
|
+
assertAuthorization(actual);
|
|
474
|
+
if (stableJson(expected) !== stableJson(actual)) {
|
|
475
|
+
fail('team_instance_mismatch', 'cleanup_authorization_mismatch');
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
/** Build and canonicalize an instance id before any state effect. */
|
|
479
|
+
export function createTeamInstanceBinding(input) {
|
|
480
|
+
return bindingFromInput(input, false);
|
|
481
|
+
}
|
|
482
|
+
/** The one external lock shared by startup, lifecycle mutation and cleanup. */
|
|
483
|
+
export { teamInstanceLifecycleLockPath };
|
|
484
|
+
export async function withTeamInstanceLifecycleLock(cwd, teamName, fn, timeoutMs = 10_000) {
|
|
485
|
+
validateTeamName(teamName);
|
|
486
|
+
const canonicalCwd = validateCwd(cwd);
|
|
487
|
+
const lifecyclePath = teamInstanceLifecycleLockPath(canonicalCwd, teamName);
|
|
488
|
+
try {
|
|
489
|
+
assertTeamStatePathSafeSync(canonicalCwd, lifecyclePath);
|
|
490
|
+
}
|
|
491
|
+
catch (error) {
|
|
492
|
+
throw new TeamInstanceError('team_instance_state_corrupt', error instanceof Error ? error.message : String(error), { cause: error });
|
|
493
|
+
}
|
|
494
|
+
return withProcessIdentityFileLock(lifecyclePath, fn, timeoutMs);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Reserve a new instance under the caller's lifecycle lock. This function is
|
|
498
|
+
* intentionally lock-free so startup can reserve, write its pending config,
|
|
499
|
+
* and perform every effect while retaining one lock.
|
|
500
|
+
*/
|
|
501
|
+
export async function reserveTeamInstanceUnderLock(input, options = {}) {
|
|
502
|
+
const binding = bindingFromInput(input, false);
|
|
503
|
+
await assertBindingPathsSafe(binding);
|
|
504
|
+
if (await hasHistoricalCleanupAuthority(binding)) {
|
|
505
|
+
fail('team_instance_reservation_conflict', 'instance_id_reuse_blocked');
|
|
506
|
+
}
|
|
507
|
+
const existing = await readReservation(binding);
|
|
508
|
+
if (existing) {
|
|
509
|
+
fail('team_instance_reservation_conflict', existing.instance_id === binding.instance_id
|
|
510
|
+
? 'instance_already_reserved'
|
|
511
|
+
: 'team_name_already_reserved');
|
|
512
|
+
}
|
|
513
|
+
const state = await inspectTeamState(binding);
|
|
514
|
+
if (state.observed_state === 'bound')
|
|
515
|
+
fail('team_instance_reservation_conflict', 'team_state_already_exists');
|
|
516
|
+
const reservation = reservationForBinding(binding, 'pending', currentOwner());
|
|
517
|
+
await publishReservation(reservation, options.io);
|
|
518
|
+
return reservation;
|
|
519
|
+
}
|
|
520
|
+
/** Convenience form for callers that do not already own the lifecycle lock. */
|
|
521
|
+
export function reserveTeamInstance(input, options = {}) {
|
|
522
|
+
const binding = bindingFromInput(input, false);
|
|
523
|
+
return withTeamInstanceLifecycleLock(binding.cwd, binding.team_name, () => reserveTeamInstanceUnderLock({ teamName: binding.team_name, cwd: binding.cwd, instanceId: binding.instance_id }, options), options.timeoutMs);
|
|
524
|
+
}
|
|
525
|
+
/** Return the minimal config projection safe to write before startup effects. */
|
|
526
|
+
export function buildTeamInstancePendingConfig(input) {
|
|
527
|
+
const binding = bindingFromBoundInput(input);
|
|
528
|
+
return {
|
|
529
|
+
name: binding.team_name,
|
|
530
|
+
instance_id: binding.instance_id,
|
|
531
|
+
leader_cwd: binding.cwd,
|
|
532
|
+
team_state_root: binding.state_root,
|
|
533
|
+
lifecycle_state: 'starting',
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Assert the reservation and any config/manifest identity while the lifecycle
|
|
538
|
+
* lock is held. It never acquires the lock itself, preventing recursive-lock
|
|
539
|
+
* deadlocks when config CAS is performed inside lifecycle operations.
|
|
540
|
+
*/
|
|
541
|
+
export async function assertTeamInstanceUnderLock(input) {
|
|
542
|
+
const binding = bindingFromBoundInput(input);
|
|
543
|
+
await assertBindingPathsSafe(binding);
|
|
544
|
+
const reservation = await readReservation(binding);
|
|
545
|
+
if (!reservation)
|
|
546
|
+
fail('team_instance_authority_missing', 'team_instance_reservation_missing');
|
|
547
|
+
if (!sameBinding(reservation, binding))
|
|
548
|
+
fail('team_instance_mismatch', 'reservation_binding_mismatch');
|
|
549
|
+
const state = await inspectTeamState(binding);
|
|
550
|
+
return { binding, reservation, observed_state: state.observed_state };
|
|
551
|
+
}
|
|
552
|
+
/** Mark a pending reservation active after the identity-bearing config exists. */
|
|
553
|
+
export async function activateTeamInstanceUnderLock(input, options = {}) {
|
|
554
|
+
const assertion = await assertTeamInstanceUnderLock(input);
|
|
555
|
+
if (!ownerMatchesCurrent(assertion.reservation.owner)) {
|
|
556
|
+
fail('team_instance_owner_unknown', 'startup_reservation_owner_not_current');
|
|
557
|
+
}
|
|
558
|
+
if (assertion.observed_state !== 'bound') {
|
|
559
|
+
fail('team_instance_startup_config_missing', 'identity_bearing_config_required');
|
|
560
|
+
}
|
|
561
|
+
const active = {
|
|
562
|
+
...assertion.reservation,
|
|
563
|
+
phase: 'active',
|
|
564
|
+
updated_at: new Date().toISOString(),
|
|
565
|
+
};
|
|
566
|
+
await publishReservation(active, options.io);
|
|
567
|
+
return active;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Release only a failed, still-empty startup. The root is checked and removed
|
|
571
|
+
* before the reservation, so a release failure leaves a retryable authority.
|
|
572
|
+
*/
|
|
573
|
+
export async function releaseFailedStartupReservationUnderLock(input, options = {}) {
|
|
574
|
+
const binding = bindingFromBoundInput(input);
|
|
575
|
+
await assertBindingPathsSafe(binding);
|
|
576
|
+
const reservation = await readReservation(binding);
|
|
577
|
+
if (!reservation)
|
|
578
|
+
return;
|
|
579
|
+
if (!sameBinding(reservation, binding))
|
|
580
|
+
fail('team_instance_mismatch', 'reservation_binding_mismatch');
|
|
581
|
+
if (reservation.phase !== 'pending')
|
|
582
|
+
fail('team_instance_reservation_active', 'active_reservation_not_releaseable');
|
|
583
|
+
if (!ownerMatchesCurrent(reservation.owner) && !isProcessIdentityDead(reservation.owner)) {
|
|
584
|
+
fail('team_instance_owner_unknown', 'startup_owner_not_confirmed_dead');
|
|
585
|
+
}
|
|
586
|
+
const rootKind = await pathKind(binding.state_root);
|
|
587
|
+
if (rootKind === 'other' || rootKind === 'file')
|
|
588
|
+
fail('team_instance_state_corrupt', 'team_state_root_not_directory');
|
|
589
|
+
if (rootKind === 'directory') {
|
|
590
|
+
let entries;
|
|
591
|
+
try {
|
|
592
|
+
entries = await readdir(binding.state_root);
|
|
593
|
+
}
|
|
594
|
+
catch (error) {
|
|
595
|
+
fail('team_instance_state_corrupt', `team_state_root_unreadable:${String(error)}`);
|
|
596
|
+
}
|
|
597
|
+
if (entries.length > 0)
|
|
598
|
+
fail('team_instance_startup_not_empty', 'failed_startup_root_not_empty');
|
|
599
|
+
try {
|
|
600
|
+
if (options.io?.removeTree)
|
|
601
|
+
await options.io.removeTree(binding.state_root);
|
|
602
|
+
else
|
|
603
|
+
await rm(binding.state_root, { recursive: true, force: true });
|
|
604
|
+
}
|
|
605
|
+
catch (error) {
|
|
606
|
+
throw new TeamInstanceError('team_instance_remove_failed', `empty_startup_root_remove_failed:${String(error)}`, { cause: error });
|
|
607
|
+
}
|
|
608
|
+
if (await pathKind(binding.state_root) !== 'missing') {
|
|
609
|
+
fail('team_instance_remove_failed', 'empty_startup_root_remove_unverified');
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
try {
|
|
613
|
+
await unlink(reservation.reservation_path);
|
|
614
|
+
}
|
|
615
|
+
catch (error) {
|
|
616
|
+
if (error.code !== 'ENOENT') {
|
|
617
|
+
throw new TeamInstanceError('team_instance_reservation_release_failed', `reservation_release_failed:${String(error)}`, { cause: error });
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
if (await readReservation(binding))
|
|
621
|
+
fail('team_instance_reservation_release_failed', 'reservation_release_unverified');
|
|
622
|
+
}
|
|
623
|
+
export function releaseFailedStartupReservation(input, options = {}) {
|
|
624
|
+
const binding = bindingFromBoundInput(input);
|
|
625
|
+
return withTeamInstanceLifecycleLock(binding.cwd, binding.team_name, () => releaseFailedStartupReservationUnderLock(binding, options), options.timeoutMs);
|
|
626
|
+
}
|
|
627
|
+
async function renameIntoDetachedRoot(binding, options) {
|
|
628
|
+
await assertBindingPathsSafe(binding);
|
|
629
|
+
const paths = expectedPaths(binding);
|
|
630
|
+
const sourceKind = await pathKind(binding.state_root);
|
|
631
|
+
const destinationKind = await pathKind(paths.detached);
|
|
632
|
+
if (sourceKind === 'missing' && destinationKind === 'missing') {
|
|
633
|
+
fail('team_instance_state_missing', 'team_state_root_missing_before_detach');
|
|
634
|
+
}
|
|
635
|
+
if (sourceKind === 'missing' && destinationKind !== 'missing')
|
|
636
|
+
return;
|
|
637
|
+
if (sourceKind !== 'directory')
|
|
638
|
+
fail('team_instance_state_corrupt', 'team_state_root_not_directory');
|
|
639
|
+
if (destinationKind !== 'missing')
|
|
640
|
+
fail('team_instance_cleanup_inconsistent', 'both_state_and_detached_roots_exist');
|
|
641
|
+
await mkdir(dirname(paths.detached), { recursive: true, mode: 0o700 });
|
|
642
|
+
try {
|
|
643
|
+
if (options.io?.renameStateRoot)
|
|
644
|
+
await options.io.renameStateRoot(binding.state_root, paths.detached);
|
|
645
|
+
else
|
|
646
|
+
await rename(binding.state_root, paths.detached);
|
|
647
|
+
}
|
|
648
|
+
catch (error) {
|
|
649
|
+
throw new TeamInstanceError('team_instance_rename_failed', `state_root_detach_failed:${String(error)}`, { cause: error });
|
|
650
|
+
}
|
|
651
|
+
if (await pathKind(binding.state_root) !== 'missing' || await pathKind(paths.detached) !== 'directory') {
|
|
652
|
+
fail('team_instance_rename_failed', 'state_root_detach_unverified');
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
async function removeDetachedRoot(binding, options) {
|
|
656
|
+
await assertExternalCleanupPathsSafe(binding);
|
|
657
|
+
const detached = expectedPaths(binding).detached;
|
|
658
|
+
const kind = await pathKind(detached);
|
|
659
|
+
if (kind === 'missing')
|
|
660
|
+
return;
|
|
661
|
+
if (kind !== 'directory')
|
|
662
|
+
fail('team_instance_cleanup_inconsistent', 'detached_root_not_directory');
|
|
663
|
+
try {
|
|
664
|
+
if (options.io?.removeTree)
|
|
665
|
+
await options.io.removeTree(detached);
|
|
666
|
+
else
|
|
667
|
+
await rm(detached, { recursive: true, force: true });
|
|
668
|
+
}
|
|
669
|
+
catch (error) {
|
|
670
|
+
throw new TeamInstanceError('team_instance_remove_failed', `detached_root_remove_failed:${String(error)}`, { cause: error });
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
async function clearReservationIfOwned(binding) {
|
|
674
|
+
const path = expectedPaths(binding).reservation;
|
|
675
|
+
// Reservation is shared with successors. A replacement may intentionally
|
|
676
|
+
// have changed this path (including by installing a symlink); never follow
|
|
677
|
+
// such a path and never let it block removal of an already-detached owner.
|
|
678
|
+
try {
|
|
679
|
+
await assertTeamStatePathSafe(binding.cwd, path);
|
|
680
|
+
}
|
|
681
|
+
catch {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
let stat;
|
|
685
|
+
try {
|
|
686
|
+
stat = await lstat(path);
|
|
687
|
+
}
|
|
688
|
+
catch (error) {
|
|
689
|
+
if (error.code === 'ENOENT')
|
|
690
|
+
return;
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
// A successor may have installed a symlink or another non-regular marker at
|
|
694
|
+
// the shared reservation path. Never follow or remove it during old-instance
|
|
695
|
+
// detached cleanup.
|
|
696
|
+
if (!stat.isFile())
|
|
697
|
+
return;
|
|
698
|
+
const state = await readJsonState(path);
|
|
699
|
+
if (state.kind !== 'value' || !isValidReservation(state.value))
|
|
700
|
+
return;
|
|
701
|
+
const reservation = state.value;
|
|
702
|
+
if (!sameBinding(reservation, binding))
|
|
703
|
+
return; // A newer reservation is never touched.
|
|
704
|
+
try {
|
|
705
|
+
await unlink(path);
|
|
706
|
+
}
|
|
707
|
+
catch (error) {
|
|
708
|
+
if (error.code !== 'ENOENT') {
|
|
709
|
+
throw new TeamInstanceError('team_instance_reservation_release_failed', `reservation_release_failed:${String(error)}`, { cause: error });
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
try {
|
|
713
|
+
const after = await lstat(path);
|
|
714
|
+
// A concurrent successor may have replaced the path immediately after our
|
|
715
|
+
// unlink. That replacement is not ours and must remain untouched.
|
|
716
|
+
if (after.isSymbolicLink() || after.isFile())
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
catch (error) {
|
|
720
|
+
if (error.code !== 'ENOENT')
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
function transitionCleanupRecord(record, phase, failureReason) {
|
|
725
|
+
const next = { ...record, phase, updated_at: new Date().toISOString() };
|
|
726
|
+
if (phase === 'prepared')
|
|
727
|
+
delete next.detached_at;
|
|
728
|
+
else
|
|
729
|
+
next.detached_at ??= new Date().toISOString();
|
|
730
|
+
if (failureReason === undefined)
|
|
731
|
+
delete next.failure_reason;
|
|
732
|
+
else
|
|
733
|
+
next.failure_reason = failureReason;
|
|
734
|
+
return next;
|
|
735
|
+
}
|
|
736
|
+
async function resumeCleanupUnderLock(binding, authorization, existing, options) {
|
|
737
|
+
assertSameAuthorization(existing.authorization, authorization);
|
|
738
|
+
await assertExternalCleanupPathsSafe(binding);
|
|
739
|
+
const paths = expectedPaths(binding);
|
|
740
|
+
let receipt = existing;
|
|
741
|
+
if (existing.phase === 'completed') {
|
|
742
|
+
if (await pathKind(paths.detached) !== 'missing') {
|
|
743
|
+
fail('team_instance_cleanup_inconsistent', 'completed_receipt_with_detached_root');
|
|
744
|
+
}
|
|
745
|
+
return { outcome: 'already_cleaned', binding, receipt: existing };
|
|
746
|
+
}
|
|
747
|
+
if (receipt.phase === 'prepared') {
|
|
748
|
+
// Before the detached phase is durably recorded, the canonical root is
|
|
749
|
+
// still the only authority. A replacement must block this retry.
|
|
750
|
+
const currentState = await inspectTeamState(binding);
|
|
751
|
+
const detachedBefore = await pathKind(paths.detached);
|
|
752
|
+
if (currentState.observed_state === 'bound' && currentState.instance_id !== binding.instance_id) {
|
|
753
|
+
fail('team_instance_newer_instance', 'newer_same_name_instance_present');
|
|
754
|
+
}
|
|
755
|
+
const alreadyRenamed = currentState.observed_state === 'missing' && detachedBefore === 'directory';
|
|
756
|
+
if (!alreadyRenamed && currentState.observed_state !== 'bound') {
|
|
757
|
+
fail('team_instance_state_missing', 'identity_bearing_state_required_before_detach');
|
|
758
|
+
}
|
|
759
|
+
if (!alreadyRenamed)
|
|
760
|
+
await renameIntoDetachedRoot(binding, options);
|
|
761
|
+
receipt = transitionCleanupRecord(receipt, 'detached');
|
|
762
|
+
await publishCleanupReceipt(receipt, options.io);
|
|
763
|
+
}
|
|
764
|
+
// Once the original root is durably detached, the shared name is safe for a
|
|
765
|
+
// replacement instance. Release only the matching reservation; a newer
|
|
766
|
+
// reservation is never touched.
|
|
767
|
+
await clearReservationIfOwned(binding);
|
|
768
|
+
const detachedKind = await pathKind(paths.detached);
|
|
769
|
+
if (detachedKind !== 'missing') {
|
|
770
|
+
receipt = transitionCleanupRecord(receipt, 'removing');
|
|
771
|
+
await publishCleanupReceipt(receipt, options.io);
|
|
772
|
+
try {
|
|
773
|
+
await removeDetachedRoot(binding, options);
|
|
774
|
+
}
|
|
775
|
+
catch (error) {
|
|
776
|
+
const failed = {
|
|
777
|
+
...receipt,
|
|
778
|
+
phase: 'failed',
|
|
779
|
+
failure_reason: error instanceof Error ? error.message : String(error),
|
|
780
|
+
updated_at: new Date().toISOString(),
|
|
781
|
+
};
|
|
782
|
+
try {
|
|
783
|
+
await publishCleanupReceipt(failed, options.io);
|
|
784
|
+
}
|
|
785
|
+
catch { /* preserve the last durable phase */ }
|
|
786
|
+
throw error;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
const completed = transitionCleanupRecord(receipt, 'completed');
|
|
790
|
+
await publishCleanupReceipt(completed, options.io);
|
|
791
|
+
return { outcome: 'cleaned', binding, receipt: completed };
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Dispose one instance after the caller-owned final-state protocol has run.
|
|
795
|
+
* Callers MUST prove provider termination from launch/process identity evidence,
|
|
796
|
+
* prove pane ownership/absence separately, and complete worktree cleanup in
|
|
797
|
+
* its established order before passing this authorization. This module never
|
|
798
|
+
* probes or kills providers and never infers provider death from a pane.
|
|
799
|
+
*/
|
|
800
|
+
export async function disposeTeamInstanceUnderLock(input, authorization, options = {}) {
|
|
801
|
+
assertAuthorization(authorization);
|
|
802
|
+
const binding = bindingFromBoundInput(input);
|
|
803
|
+
// Existing receipts may be resumed after the named state root and shared
|
|
804
|
+
// reservation have already been replaced. Read only the old external
|
|
805
|
+
// authority first; canonical-root validation is restricted to initial and
|
|
806
|
+
// prepared disposal.
|
|
807
|
+
await assertExternalCleanupPathsSafe(binding);
|
|
808
|
+
const existing = await readCleanupReceipt(binding);
|
|
809
|
+
if (existing)
|
|
810
|
+
return resumeCleanupUnderLock(binding, authorization, existing, options);
|
|
811
|
+
await assertBindingPathsSafe(binding);
|
|
812
|
+
const assertion = await assertTeamInstanceUnderLock(binding);
|
|
813
|
+
if (assertion.observed_state !== 'bound') {
|
|
814
|
+
fail('team_instance_state_missing', 'identity_bearing_state_required_for_disposal');
|
|
815
|
+
}
|
|
816
|
+
const paths = expectedPaths(binding);
|
|
817
|
+
let receipt = {
|
|
818
|
+
schema_version: 1,
|
|
819
|
+
kind: 'team-instance-cleanup',
|
|
820
|
+
instance_id: binding.instance_id,
|
|
821
|
+
team_name: binding.team_name,
|
|
822
|
+
cwd: binding.cwd,
|
|
823
|
+
workspace_hash: binding.workspace_hash,
|
|
824
|
+
state_root: binding.state_root,
|
|
825
|
+
detached_root: paths.detached,
|
|
826
|
+
receipt_path: paths.cleanup,
|
|
827
|
+
phase: 'prepared',
|
|
828
|
+
authorization,
|
|
829
|
+
created_at: new Date().toISOString(),
|
|
830
|
+
updated_at: new Date().toISOString(),
|
|
831
|
+
};
|
|
832
|
+
await publishInitialCleanupReceipt(receipt, options.io);
|
|
833
|
+
await renameIntoDetachedRoot(binding, options);
|
|
834
|
+
receipt = transitionCleanupRecord(receipt, 'detached');
|
|
835
|
+
await publishCleanupReceipt(receipt, options.io);
|
|
836
|
+
return resumeCleanupUnderLock(binding, authorization, receipt, options);
|
|
837
|
+
}
|
|
838
|
+
/** Convenience disposal form for callers that do not already own the lock. */
|
|
839
|
+
export function disposeTeamInstance(input, authorization, options = {}) {
|
|
840
|
+
assertAuthorization(authorization);
|
|
841
|
+
const binding = bindingFromBoundInput(input);
|
|
842
|
+
return withTeamInstanceLifecycleLock(binding.cwd, binding.team_name, () => disposeTeamInstanceUnderLock(binding, authorization, options), options.timeoutMs);
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Retry only a cleanup transaction that already published a valid receipt.
|
|
846
|
+
* Unlike `disposeTeamInstance`, this API never creates a prepared receipt and
|
|
847
|
+
* therefore cannot turn a caller's literal authorization into a new deletion.
|
|
848
|
+
*/
|
|
849
|
+
export async function retryTeamInstanceDisposalUnderLock(input, authorization, options = {}) {
|
|
850
|
+
assertAuthorization(authorization);
|
|
851
|
+
const binding = bindingFromBoundInput(input);
|
|
852
|
+
await assertExternalCleanupPathsSafe(binding);
|
|
853
|
+
const existing = await readCleanupReceipt(binding);
|
|
854
|
+
if (!existing)
|
|
855
|
+
fail('team_instance_authority_missing', 'team_instance_cleanup_receipt_missing');
|
|
856
|
+
return resumeCleanupUnderLock(binding, authorization, existing, options);
|
|
857
|
+
}
|
|
858
|
+
/** Explicit public retry entry point; it acquires the canonical name lock. */
|
|
859
|
+
export function retryTeamInstanceDisposal(input, authorization, options = {}) {
|
|
860
|
+
const binding = bindingFromBoundInput(input);
|
|
861
|
+
return withTeamInstanceLifecycleLock(binding.cwd, binding.team_name, () => retryTeamInstanceDisposalUnderLock(binding, authorization, options), options.timeoutMs);
|
|
862
|
+
}
|
|
863
|
+
//# sourceMappingURL=team-instance.js.map
|