oh-my-codex 0.20.0 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +6 -6
- package/Cargo.toml +1 -1
- package/README.md +10 -1
- package/dist/adapt/__tests__/hermes.test.js.map +1 -1
- package/dist/adapt/contracts.d.ts.map +1 -1
- package/dist/agents/native-config.js.map +1 -1
- package/dist/auth/__tests__/hotswap.test.d.ts +2 -0
- package/dist/auth/__tests__/hotswap.test.d.ts.map +1 -0
- package/dist/auth/__tests__/hotswap.test.js +183 -0
- package/dist/auth/__tests__/hotswap.test.js.map +1 -0
- package/dist/auth/hotswap.d.ts.map +1 -1
- package/dist/auth/hotswap.js +17 -4
- package/dist/auth/hotswap.js.map +1 -1
- package/dist/auth/paths.js.map +1 -1
- package/dist/auth/storage.js.map +1 -1
- package/dist/autopilot/__tests__/ralplan-gate.test.js +4 -4
- package/dist/autopilot/__tests__/ralplan-gate.test.js.map +1 -1
- package/dist/autopilot/completion-gate.js.map +1 -1
- package/dist/autopilot/fsm.d.ts +1 -1
- package/dist/autopilot/fsm.d.ts.map +1 -1
- package/dist/autoresearch/goal.js.map +1 -1
- package/dist/autoresearch/runtime.js.map +1 -1
- package/dist/capabilities/lockfile.js.map +1 -1
- package/dist/catalog/reader.js.map +1 -1
- package/dist/catalog/skill-mirror.js.map +1 -1
- package/dist/cli/__tests__/adapt-help.test.js.map +1 -1
- package/dist/cli/__tests__/agents-init.test.js.map +1 -1
- package/dist/cli/__tests__/agents.test.js.map +1 -1
- package/dist/cli/__tests__/api.test.js.map +1 -1
- package/dist/cli/__tests__/ask.test.js.map +1 -1
- package/dist/cli/__tests__/auth.test.js.map +1 -1
- package/dist/cli/__tests__/autoresearch-guided.test.js.map +1 -1
- package/dist/cli/__tests__/autoresearch.test.js.map +1 -1
- package/dist/cli/__tests__/capabilities.test.js.map +1 -1
- package/dist/cli/__tests__/codex-plugin-layout.test.js +27 -0
- package/dist/cli/__tests__/codex-plugin-layout.test.js.map +1 -1
- package/dist/cli/__tests__/doctor-context-window-warning.test.js +83 -78
- package/dist/cli/__tests__/doctor-context-window-warning.test.js.map +1 -1
- package/dist/cli/__tests__/doctor-invalid-config.test.js +56 -4
- package/dist/cli/__tests__/doctor-invalid-config.test.js.map +1 -1
- package/dist/cli/__tests__/doctor-team.test.js.map +1 -1
- package/dist/cli/__tests__/doctor-warning-copy.test.js +735 -14
- package/dist/cli/__tests__/doctor-warning-copy.test.js.map +1 -1
- package/dist/cli/__tests__/exec.test.js.map +1 -1
- package/dist/cli/__tests__/imagegen-continuation.test.js.map +1 -1
- package/dist/cli/__tests__/index.test.js +216 -11
- package/dist/cli/__tests__/index.test.js.map +1 -1
- package/dist/cli/__tests__/launch-fallback.test.js +49 -3
- package/dist/cli/__tests__/launch-fallback.test.js.map +1 -1
- package/dist/cli/__tests__/mcp-parity.test.js +84 -12
- package/dist/cli/__tests__/mcp-parity.test.js.map +1 -1
- package/dist/cli/__tests__/native-hook-claim-journal.test.d.ts +2 -0
- package/dist/cli/__tests__/native-hook-claim-journal.test.d.ts.map +1 -0
- package/dist/cli/__tests__/native-hook-claim-journal.test.js +128 -0
- package/dist/cli/__tests__/native-hook-claim-journal.test.js.map +1 -0
- package/dist/cli/__tests__/nested-help-routing.test.js.map +1 -1
- package/dist/cli/__tests__/question.test.js.map +1 -1
- package/dist/cli/__tests__/ralph-deslop-contract.test.js.map +1 -1
- package/dist/cli/__tests__/ralph-goal-mode-contract.test.js +6 -0
- package/dist/cli/__tests__/ralph-goal-mode-contract.test.js.map +1 -1
- package/dist/cli/__tests__/ralph-prd-deep-interview.test.js.map +1 -1
- package/dist/cli/__tests__/ralph-prd-smoke.test.js.map +1 -1
- package/dist/cli/__tests__/ralph.test.js +8 -3
- package/dist/cli/__tests__/ralph.test.js.map +1 -1
- package/dist/cli/__tests__/ralplan-bootstrap-3181.test.d.ts +2 -0
- package/dist/cli/__tests__/ralplan-bootstrap-3181.test.d.ts.map +1 -0
- package/dist/cli/__tests__/ralplan-bootstrap-3181.test.js +187 -0
- package/dist/cli/__tests__/ralplan-bootstrap-3181.test.js.map +1 -0
- package/dist/cli/__tests__/ralplan.test.d.ts +2 -0
- package/dist/cli/__tests__/ralplan.test.d.ts.map +1 -0
- package/dist/cli/__tests__/ralplan.test.js +129 -0
- package/dist/cli/__tests__/ralplan.test.js.map +1 -0
- package/dist/cli/__tests__/resume.test.js +6 -1
- package/dist/cli/__tests__/resume.test.js.map +1 -1
- package/dist/cli/__tests__/session-scoped-runtime.test.js +25 -0
- package/dist/cli/__tests__/session-scoped-runtime.test.js.map +1 -1
- package/dist/cli/__tests__/session-search-help.test.js.map +1 -1
- package/dist/cli/__tests__/session-search.test.js.map +1 -1
- package/dist/cli/__tests__/setup-agents-overwrite.test.js +79 -0
- package/dist/cli/__tests__/setup-agents-overwrite.test.js.map +1 -1
- package/dist/cli/__tests__/setup-gh-star.test.js.map +1 -1
- package/dist/cli/__tests__/setup-hooks-shared-ownership.test.js +131 -5
- package/dist/cli/__tests__/setup-hooks-shared-ownership.test.js.map +1 -1
- package/dist/cli/__tests__/setup-hooks-trust-e2e.test.d.ts +2 -0
- package/dist/cli/__tests__/setup-hooks-trust-e2e.test.d.ts.map +1 -0
- package/dist/cli/__tests__/setup-hooks-trust-e2e.test.js +285 -0
- package/dist/cli/__tests__/setup-hooks-trust-e2e.test.js.map +1 -0
- package/dist/cli/__tests__/setup-install-mode.test.js +2264 -17
- package/dist/cli/__tests__/setup-install-mode.test.js.map +1 -1
- package/dist/cli/__tests__/setup-preferences.test.d.ts +2 -0
- package/dist/cli/__tests__/setup-preferences.test.d.ts.map +1 -0
- package/dist/cli/__tests__/setup-preferences.test.js +79 -0
- package/dist/cli/__tests__/setup-preferences.test.js.map +1 -0
- package/dist/cli/__tests__/setup-refresh.test.js +168 -5
- package/dist/cli/__tests__/setup-refresh.test.js.map +1 -1
- package/dist/cli/__tests__/setup-scope.test.js +73 -6
- package/dist/cli/__tests__/setup-scope.test.js.map +1 -1
- package/dist/cli/__tests__/sparkshell-cli.test.js.map +1 -1
- package/dist/cli/__tests__/state.test.js +37 -0
- package/dist/cli/__tests__/state.test.js.map +1 -1
- package/dist/cli/__tests__/team.test.js.map +1 -1
- package/dist/cli/__tests__/ultragoal.test.js +61 -1
- package/dist/cli/__tests__/ultragoal.test.js.map +1 -1
- package/dist/cli/__tests__/uninstall.test.js +2067 -26
- package/dist/cli/__tests__/uninstall.test.js.map +1 -1
- package/dist/cli/__tests__/update.test.js +58 -0
- package/dist/cli/__tests__/update.test.js.map +1 -1
- package/dist/cli/__tests__/url.test.js.map +1 -1
- package/dist/cli/__tests__/windows-popup-loop-contract.test.js.map +1 -1
- package/dist/cli/adapt.js.map +1 -1
- package/dist/cli/agents-init.js.map +1 -1
- package/dist/cli/agents.js.map +1 -1
- package/dist/cli/api.js.map +1 -1
- package/dist/cli/ask.d.ts +1 -1
- package/dist/cli/ask.d.ts.map +1 -1
- package/dist/cli/ask.js.map +1 -1
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/autoresearch-guided.js.map +1 -1
- package/dist/cli/autoresearch-intake.js.map +1 -1
- package/dist/cli/capabilities.js.map +1 -1
- package/dist/cli/cleanup.js.map +1 -1
- package/dist/cli/codex-feature-probe.js.map +1 -1
- package/dist/cli/codex-home.js.map +1 -1
- package/dist/cli/doctor.d.ts +20 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +636 -161
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/explore.js.map +1 -1
- package/dist/cli/index.d.ts +11 -3
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +108 -20
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp-serve.js.map +1 -1
- package/dist/cli/mission.js.map +1 -1
- package/dist/cli/native-assets.js.map +1 -1
- package/dist/cli/native-hook-claim-journal.d.ts +18 -0
- package/dist/cli/native-hook-claim-journal.d.ts.map +1 -0
- package/dist/cli/native-hook-claim-journal.js +239 -0
- package/dist/cli/native-hook-claim-journal.js.map +1 -0
- package/dist/cli/omx.js.map +1 -1
- package/dist/cli/plugin-marketplace.js.map +1 -1
- package/dist/cli/project-runtime-codex-homes.js.map +1 -1
- package/dist/cli/question.js.map +1 -1
- package/dist/cli/ralph.d.ts.map +1 -1
- package/dist/cli/ralph.js +3 -2
- package/dist/cli/ralph.js.map +1 -1
- package/dist/cli/ralplan.d.ts +14 -0
- package/dist/cli/ralplan.d.ts.map +1 -0
- package/dist/cli/ralplan.js +203 -0
- package/dist/cli/ralplan.js.map +1 -0
- package/dist/cli/setup-preferences.d.ts +11 -0
- package/dist/cli/setup-preferences.d.ts.map +1 -1
- package/dist/cli/setup-preferences.js +32 -0
- package/dist/cli/setup-preferences.js.map +1 -1
- package/dist/cli/setup.d.ts +53 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +1403 -400
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/sparkshell.js.map +1 -1
- package/dist/cli/star-prompt.js.map +1 -1
- package/dist/cli/state.d.ts.map +1 -1
- package/dist/cli/state.js +2 -1
- package/dist/cli/state.js.map +1 -1
- package/dist/cli/team.js.map +1 -1
- package/dist/cli/ultragoal.d.ts +5 -1
- package/dist/cli/ultragoal.d.ts.map +1 -1
- package/dist/cli/ultragoal.js +34 -2
- package/dist/cli/ultragoal.js.map +1 -1
- package/dist/cli/uninstall.d.ts +8 -0
- package/dist/cli/uninstall.d.ts.map +1 -1
- package/dist/cli/uninstall.js +947 -99
- package/dist/cli/uninstall.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +8 -1
- package/dist/cli/update.js.map +1 -1
- package/dist/cli/url.js.map +1 -1
- package/dist/compat/__tests__/doctor-contract.test.js +5 -1
- package/dist/compat/__tests__/doctor-contract.test.js.map +1 -1
- package/dist/compat/__tests__/rust-runtime-compat.test.js.map +1 -1
- package/dist/config/__tests__/codex-hooks.test.js +1287 -11
- package/dist/config/__tests__/codex-hooks.test.js.map +1 -1
- package/dist/config/__tests__/generator-idempotent.test.js +1049 -135
- package/dist/config/__tests__/generator-idempotent.test.js.map +1 -1
- package/dist/config/__tests__/generator-notify.test.js +28 -49
- package/dist/config/__tests__/generator-notify.test.js.map +1 -1
- package/dist/config/codex-feature-flags.d.ts.map +1 -1
- package/dist/config/codex-feature-flags.js.map +1 -1
- package/dist/config/codex-hooks.d.ts +124 -1
- package/dist/config/codex-hooks.d.ts.map +1 -1
- package/dist/config/codex-hooks.js +2142 -265
- package/dist/config/codex-hooks.js.map +1 -1
- package/dist/config/commit-lore-guard.js.map +1 -1
- package/dist/config/generator.d.ts +40 -26
- package/dist/config/generator.d.ts.map +1 -1
- package/dist/config/generator.js +1159 -288
- package/dist/config/generator.js.map +1 -1
- package/dist/config/mcp-registry.js.map +1 -1
- package/dist/config/models.d.ts +2 -2
- package/dist/config/models.d.ts.map +1 -1
- package/dist/config/models.js.map +1 -1
- package/dist/config/omx-first-party-mcp.js.map +1 -1
- package/dist/config/team-mode.d.ts.map +1 -1
- package/dist/document-refresh/__tests__/enforcer.test.js.map +1 -1
- package/dist/document-refresh/enforcer.js.map +1 -1
- package/dist/exec/followup.js.map +1 -1
- package/dist/goal-workflows/artifacts.js.map +1 -1
- package/dist/hooks/__tests__/agents-overlay.test.js +7 -4
- package/dist/hooks/__tests__/agents-overlay.test.js.map +1 -1
- package/dist/hooks/__tests__/analyze-routing-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/analyze-skill-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/anti-slop-workflow.test.js.map +1 -1
- package/dist/hooks/__tests__/autopilot-skill-contract.test.js +9 -3
- package/dist/hooks/__tests__/autopilot-skill-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/code-review-skill-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/consensus-execution-handoff.test.js.map +1 -1
- package/dist/hooks/__tests__/deep-interview-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/design-skill.test.js.map +1 -1
- package/dist/hooks/__tests__/keyword-detector.test.js +1372 -2
- package/dist/hooks/__tests__/keyword-detector.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-fallback-watcher.test.js +14 -0
- package/dist/hooks/__tests__/notify-fallback-watcher.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js +669 -1
- package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-cross-worktree-heartbeat.test.js +2 -0
- package/dist/hooks/__tests__/notify-hook-cross-worktree-heartbeat.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-managed-tmux.test.js +142 -1
- package/dist/hooks/__tests__/notify-hook-managed-tmux.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-modules.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-non-omx-guard.test.js +48 -2
- package/dist/hooks/__tests__/notify-hook-non-omx-guard.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-ralph-resume.test.js +61 -44
- package/dist/hooks/__tests__/notify-hook-ralph-resume.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-regression-205.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.js +3 -2
- package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-session-scope.test.js +243 -4
- package/dist/hooks/__tests__/notify-hook-session-scope.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js +8 -1
- package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-tmux-heal.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-tmux-scrollback.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-visual-verdict.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-worker-idle.test.js.map +1 -1
- package/dist/hooks/__tests__/openclaw-setup-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/pre-context-gate-skills.test.js.map +1 -1
- package/dist/hooks/__tests__/prometheus-strict-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/prompt-guidance-fragments.test.js.map +1 -1
- package/dist/hooks/__tests__/prompt-guidance-test-helpers.js.map +1 -1
- package/dist/hooks/__tests__/prompt-session-provenance.test.d.ts +2 -0
- package/dist/hooks/__tests__/prompt-session-provenance.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/prompt-session-provenance.test.js +82 -0
- package/dist/hooks/__tests__/prompt-session-provenance.test.js.map +1 -0
- package/dist/hooks/__tests__/session.test.js +532 -11
- package/dist/hooks/__tests__/session.test.js.map +1 -1
- package/dist/hooks/__tests__/skill-catalog-hygiene.test.js.map +1 -1
- package/dist/hooks/__tests__/team-runtime-gating-docs-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/visual-ralph-skill.test.js.map +1 -1
- package/dist/hooks/__tests__/visual-verdict-loop.test.js.map +1 -1
- package/dist/hooks/agents-overlay.js +5 -5
- package/dist/hooks/agents-overlay.js.map +1 -1
- package/dist/hooks/code-simplifier/index.js.map +1 -1
- package/dist/hooks/explore-routing.js.map +1 -1
- package/dist/hooks/extensibility/dispatcher.js.map +1 -1
- package/dist/hooks/extensibility/events.js.map +1 -1
- package/dist/hooks/extensibility/loader.js.map +1 -1
- package/dist/hooks/extensibility/plugin-runner-stdin.js.map +1 -1
- package/dist/hooks/extensibility/sdk/logging.js.map +1 -1
- package/dist/hooks/keyword-detector.d.ts +33 -7
- package/dist/hooks/keyword-detector.d.ts.map +1 -1
- package/dist/hooks/keyword-detector.js +2228 -119
- package/dist/hooks/keyword-detector.js.map +1 -1
- package/dist/hooks/keyword-registry.d.ts +12 -0
- package/dist/hooks/keyword-registry.d.ts.map +1 -1
- package/dist/hooks/keyword-registry.js +41 -0
- package/dist/hooks/keyword-registry.js.map +1 -1
- package/dist/hooks/prompt-session-provenance.d.ts +87 -0
- package/dist/hooks/prompt-session-provenance.d.ts.map +1 -0
- package/dist/hooks/prompt-session-provenance.js +180 -0
- package/dist/hooks/prompt-session-provenance.js.map +1 -0
- package/dist/hooks/session.d.ts +139 -34
- package/dist/hooks/session.d.ts.map +1 -1
- package/dist/hooks/session.js +1239 -317
- package/dist/hooks/session.js.map +1 -1
- package/dist/hooks/task-size-detector.js.map +1 -1
- package/dist/hud/__tests__/state.test.js.map +1 -1
- package/dist/hud/authority.js.map +1 -1
- package/dist/hud/constants.js.map +1 -1
- package/dist/hud/index.js.map +1 -1
- package/dist/hud/reconcile.js.map +1 -1
- package/dist/hud/render.js.map +1 -1
- package/dist/hud/state.js.map +1 -1
- package/dist/hud/tmux.js.map +1 -1
- package/dist/leader/__tests__/contract.test.js +146 -2
- package/dist/leader/__tests__/contract.test.js.map +1 -1
- package/dist/leader/contract.d.ts +26 -5
- package/dist/leader/contract.d.ts.map +1 -1
- package/dist/leader/contract.js +131 -7
- package/dist/leader/contract.js.map +1 -1
- package/dist/mcp/__tests__/bootstrap.test.js.map +1 -1
- package/dist/mcp/__tests__/server-lifecycle.test.js +15 -2
- package/dist/mcp/__tests__/server-lifecycle.test.js.map +1 -1
- package/dist/mcp/__tests__/state-paths.test.js +98 -1
- package/dist/mcp/__tests__/state-paths.test.js.map +1 -1
- package/dist/mcp/bootstrap.js.map +1 -1
- package/dist/mcp/code-intel-server.d.ts +58 -58
- package/dist/mcp/code-intel-server.d.ts.map +1 -1
- package/dist/mcp/code-intel-server.js.map +1 -1
- package/dist/mcp/hermes-bridge.js.map +1 -1
- package/dist/mcp/hermes-server.d.ts +70 -70
- package/dist/mcp/hermes-server.d.ts.map +1 -1
- package/dist/mcp/lifecycle-telemetry.js.map +1 -1
- package/dist/mcp/memory-server.d.ts +34 -34
- package/dist/mcp/memory-server.d.ts.map +1 -1
- package/dist/mcp/memory-server.js.map +1 -1
- package/dist/mcp/state-paths.d.ts +14 -0
- package/dist/mcp/state-paths.d.ts.map +1 -1
- package/dist/mcp/state-paths.js +96 -20
- package/dist/mcp/state-paths.js.map +1 -1
- package/dist/mcp/state-server.d.ts +47 -47
- package/dist/mcp/state-server.d.ts.map +1 -1
- package/dist/mcp/trace-server.d.ts +4 -4
- package/dist/mcp/trace-server.d.ts.map +1 -1
- package/dist/mcp/trace-server.js.map +1 -1
- package/dist/mcp/wiki-server.d.ts +23 -23
- package/dist/mcp/wiki-server.d.ts.map +1 -1
- package/dist/mcp/wiki-server.js.map +1 -1
- package/dist/modes/__tests__/base-session-scope.test.js +53 -1
- package/dist/modes/__tests__/base-session-scope.test.js.map +1 -1
- package/dist/modes/base.d.ts.map +1 -1
- package/dist/modes/base.js +5 -5
- package/dist/modes/base.js.map +1 -1
- package/dist/notifications/__tests__/lifecycle-dedupe.test.js.map +1 -1
- package/dist/notifications/__tests__/reply-listener.test.js.map +1 -1
- package/dist/notifications/__tests__/session-idle-tail-dedupe.test.js +177 -85
- package/dist/notifications/__tests__/session-idle-tail-dedupe.test.js.map +1 -1
- package/dist/notifications/__tests__/session-registry.test.js.map +1 -1
- package/dist/notifications/__tests__/template-engine.test.js.map +1 -1
- package/dist/notifications/__tests__/verbosity.test.js.map +1 -1
- package/dist/notifications/http-client.js.map +1 -1
- package/dist/notifications/index.d.ts +4 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +3 -9
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/lifecycle-dedupe.js.map +1 -1
- package/dist/notifications/reply-listener.d.ts.map +1 -1
- package/dist/notifications/reply-listener.js.map +1 -1
- package/dist/notifications/session-registry.js.map +1 -1
- package/dist/notifications/session-status.js.map +1 -1
- package/dist/notifications/temp-contract.js.map +1 -1
- package/dist/notifications/tmux-detector.js.map +1 -1
- package/dist/notifications/tmux.js.map +1 -1
- package/dist/openclaw/config.js.map +1 -1
- package/dist/openclaw/dispatcher.js.map +1 -1
- package/dist/pipeline/__tests__/orchestrator.test.js.map +1 -1
- package/dist/pipeline/__tests__/stages.test.js +8 -5
- package/dist/pipeline/__tests__/stages.test.js.map +1 -1
- package/dist/pipeline/stages/code-review.js.map +1 -1
- package/dist/pipeline/stages/ralph-verify.js.map +1 -1
- package/dist/pipeline/stages/ralplan.js.map +1 -1
- package/dist/pipeline/stages/team-exec.js.map +1 -1
- package/dist/pipeline/stages/ultragoal.js.map +1 -1
- package/dist/pipeline/stages/ultraqa.js.map +1 -1
- package/dist/planning/__tests__/approved-execution-lifecycle-matrix.test.js.map +1 -1
- package/dist/planning/artifact-names.js.map +1 -1
- package/dist/planning/artifacts.js.map +1 -1
- package/dist/question/__tests__/state.test.js.map +1 -1
- package/dist/question/__tests__/ui.test.js.map +1 -1
- package/dist/question/autopilot-wait.js.map +1 -1
- package/dist/question/client.d.ts.map +1 -1
- package/dist/question/client.js.map +1 -1
- package/dist/question/deep-interview.js.map +1 -1
- package/dist/question/events.js.map +1 -1
- package/dist/question/renderer.js.map +1 -1
- package/dist/question/state.d.ts.map +1 -1
- package/dist/question/state.js.map +1 -1
- package/dist/question/ui.js.map +1 -1
- package/dist/ralph/contract.d.ts +1 -1
- package/dist/ralph/contract.d.ts.map +1 -1
- package/dist/ralplan/__tests__/consensus-gate.test.js +403 -8
- package/dist/ralplan/__tests__/consensus-gate.test.js.map +1 -1
- package/dist/ralplan/__tests__/runtime.test.js +112 -14
- package/dist/ralplan/__tests__/runtime.test.js.map +1 -1
- package/dist/ralplan/consensus-gate.d.ts +3 -3
- package/dist/ralplan/consensus-gate.d.ts.map +1 -1
- package/dist/ralplan/consensus-gate.js +155 -60
- package/dist/ralplan/consensus-gate.js.map +1 -1
- package/dist/ralplan/runtime.d.ts +2 -2
- package/dist/ralplan/runtime.d.ts.map +1 -1
- package/dist/ralplan/runtime.js +1 -2
- package/dist/ralplan/runtime.js.map +1 -1
- package/dist/runtime/bridge.d.ts.map +1 -1
- package/dist/runtime/bridge.js.map +1 -1
- package/dist/runtime/process-tree.js.map +1 -1
- package/dist/runtime/run-loop.js.map +1 -1
- package/dist/runtime/run-outcome.d.ts +3 -3
- package/dist/runtime/run-outcome.d.ts.map +1 -1
- package/dist/runtime/run-outcome.js.map +1 -1
- package/dist/runtime/run-state.js.map +1 -1
- package/dist/scripts/__tests__/codex-native-hook.test.js +5414 -801
- package/dist/scripts/__tests__/codex-native-hook.test.js.map +1 -1
- package/dist/scripts/__tests__/fixtures/issue-3138-installed-smoke.d.ts +2 -0
- package/dist/scripts/__tests__/fixtures/issue-3138-installed-smoke.d.ts.map +1 -0
- package/dist/scripts/__tests__/fixtures/issue-3138-installed-smoke.js +634 -0
- package/dist/scripts/__tests__/fixtures/issue-3138-installed-smoke.js.map +1 -0
- package/dist/scripts/__tests__/generate-release-body.test.js.map +1 -1
- package/dist/scripts/__tests__/hook-derived-watcher.test.js.map +1 -1
- package/dist/scripts/__tests__/notify-dispatcher.test.js.map +1 -1
- package/dist/scripts/__tests__/notify-fallback-delivery.test.d.ts +2 -0
- package/dist/scripts/__tests__/notify-fallback-delivery.test.d.ts.map +1 -0
- package/dist/scripts/__tests__/notify-fallback-delivery.test.js +174 -0
- package/dist/scripts/__tests__/notify-fallback-delivery.test.js.map +1 -0
- package/dist/scripts/__tests__/notify-state-io.test.js +57 -1
- package/dist/scripts/__tests__/notify-state-io.test.js.map +1 -1
- package/dist/scripts/__tests__/role-intent-bootstrap-e2e-3181.test.d.ts +2 -0
- package/dist/scripts/__tests__/role-intent-bootstrap-e2e-3181.test.d.ts.map +1 -0
- package/dist/scripts/__tests__/role-intent-bootstrap-e2e-3181.test.js +205 -0
- package/dist/scripts/__tests__/role-intent-bootstrap-e2e-3181.test.js.map +1 -0
- package/dist/scripts/__tests__/role-intent-durable-recovery-3181.test.d.ts +2 -0
- package/dist/scripts/__tests__/role-intent-durable-recovery-3181.test.d.ts.map +1 -0
- package/dist/scripts/__tests__/role-intent-durable-recovery-3181.test.js +175 -0
- package/dist/scripts/__tests__/role-intent-durable-recovery-3181.test.js.map +1 -0
- package/dist/scripts/__tests__/run-test-files.test.js.map +1 -1
- package/dist/scripts/__tests__/smoke-packed-install.test.js +848 -4
- package/dist/scripts/__tests__/smoke-packed-install.test.js.map +1 -1
- package/dist/scripts/__tests__/test-reply-listener-live.test.js.map +1 -1
- package/dist/scripts/build-api.js.map +1 -1
- package/dist/scripts/build-explore-harness.js.map +1 -1
- package/dist/scripts/build-sparkshell.js.map +1 -1
- package/dist/scripts/cleanup-explore-harness.js.map +1 -1
- package/dist/scripts/codex-execution-surface.js.map +1 -1
- package/dist/scripts/codex-native-hook.d.ts.map +1 -1
- package/dist/scripts/codex-native-hook.js +825 -172
- package/dist/scripts/codex-native-hook.js.map +1 -1
- package/dist/scripts/generate-native-release-manifest.js.map +1 -1
- package/dist/scripts/generate-release-body.js.map +1 -1
- package/dist/scripts/hook-payload-guard.d.ts.map +1 -1
- package/dist/scripts/hook-payload-guard.js.map +1 -1
- package/dist/scripts/notify-fallback-delivery.d.ts +48 -0
- package/dist/scripts/notify-fallback-delivery.d.ts.map +1 -0
- package/dist/scripts/notify-fallback-delivery.js +419 -0
- package/dist/scripts/notify-fallback-delivery.js.map +1 -0
- package/dist/scripts/notify-fallback-watcher.js +136 -30
- package/dist/scripts/notify-fallback-watcher.js.map +1 -1
- package/dist/scripts/notify-hook/auto-nudge.d.ts +18 -9
- package/dist/scripts/notify-hook/auto-nudge.d.ts.map +1 -1
- package/dist/scripts/notify-hook/auto-nudge.js +39 -13
- package/dist/scripts/notify-hook/auto-nudge.js.map +1 -1
- package/dist/scripts/notify-hook/managed-tmux.d.ts +23 -0
- package/dist/scripts/notify-hook/managed-tmux.d.ts.map +1 -1
- package/dist/scripts/notify-hook/managed-tmux.js +122 -12
- package/dist/scripts/notify-hook/managed-tmux.js.map +1 -1
- package/dist/scripts/notify-hook/orchestration-intent.d.ts +7 -7
- package/dist/scripts/notify-hook/orchestration-intent.d.ts.map +1 -1
- package/dist/scripts/notify-hook/ralph-session-resume.d.ts +5 -2
- package/dist/scripts/notify-hook/ralph-session-resume.d.ts.map +1 -1
- package/dist/scripts/notify-hook/ralph-session-resume.js +33 -37
- package/dist/scripts/notify-hook/ralph-session-resume.js.map +1 -1
- package/dist/scripts/notify-hook/state-io.d.ts +17 -0
- package/dist/scripts/notify-hook/state-io.d.ts.map +1 -1
- package/dist/scripts/notify-hook/state-io.js +73 -11
- package/dist/scripts/notify-hook/state-io.js.map +1 -1
- package/dist/scripts/notify-hook/team-dispatch.d.ts +1 -1
- package/dist/scripts/notify-hook/team-dispatch.js.map +1 -1
- package/dist/scripts/notify-hook/team-leader-nudge.d.ts +2 -2
- package/dist/scripts/notify-hook/team-tmux-guard.d.ts +4 -4
- package/dist/scripts/notify-hook/team-worker-posttooluse.js.map +1 -1
- package/dist/scripts/notify-hook/team-worker-stop.d.ts +1 -1
- package/dist/scripts/notify-hook/team-worker.d.ts +2 -2
- package/dist/scripts/notify-hook/tmux-injection.d.ts +8 -1
- package/dist/scripts/notify-hook/tmux-injection.d.ts.map +1 -1
- package/dist/scripts/notify-hook/tmux-injection.js +25 -16
- package/dist/scripts/notify-hook/tmux-injection.js.map +1 -1
- package/dist/scripts/notify-hook/visual-verdict.d.ts +1 -1
- package/dist/scripts/notify-hook/visual-verdict.d.ts.map +1 -1
- package/dist/scripts/notify-hook/visual-verdict.js +15 -13
- package/dist/scripts/notify-hook/visual-verdict.js.map +1 -1
- package/dist/scripts/notify-hook.d.ts +24 -1
- package/dist/scripts/notify-hook.d.ts.map +1 -1
- package/dist/scripts/notify-hook.js +266 -90
- package/dist/scripts/notify-hook.js.map +1 -1
- package/dist/scripts/postinstall.js.map +1 -1
- package/dist/scripts/prompt-inventory.js.map +1 -1
- package/dist/scripts/smoke-packed-install.d.ts +879 -2
- package/dist/scripts/smoke-packed-install.d.ts.map +1 -1
- package/dist/scripts/smoke-packed-install.js +1528 -7
- package/dist/scripts/smoke-packed-install.js.map +1 -1
- package/dist/scripts/sync-plugin-mirror.js.map +1 -1
- package/dist/scripts/test-reply-listener-live.js.map +1 -1
- package/dist/scripts/test-sparkshell.js.map +1 -1
- package/dist/scripts/verify-native-agents.js.map +1 -1
- package/dist/session-history/friction.js.map +1 -1
- package/dist/session-history/search.js.map +1 -1
- package/dist/sidecar/__tests__/boundary.test.js.map +1 -1
- package/dist/sidecar/collector.js.map +1 -1
- package/dist/sidecar/index.js.map +1 -1
- package/dist/sidecar/render.js.map +1 -1
- package/dist/sidecar/tmux.js.map +1 -1
- package/dist/state/__tests__/operations.test.js +64 -15
- package/dist/state/__tests__/operations.test.js.map +1 -1
- package/dist/state/__tests__/skill-active.test.js +19 -1
- package/dist/state/__tests__/skill-active.test.js.map +1 -1
- package/dist/state/__tests__/workflow-transition.test.js +61 -0
- package/dist/state/__tests__/workflow-transition.test.js.map +1 -1
- package/dist/state/mode-state-context.js.map +1 -1
- package/dist/state/operations.d.ts +1 -1
- package/dist/state/operations.d.ts.map +1 -1
- package/dist/state/operations.js +49 -55
- package/dist/state/operations.js.map +1 -1
- package/dist/state/paths.d.ts +1 -1
- package/dist/state/paths.d.ts.map +1 -1
- package/dist/state/paths.js +1 -1
- package/dist/state/paths.js.map +1 -1
- package/dist/state/skill-active.d.ts +13 -1
- package/dist/state/skill-active.d.ts.map +1 -1
- package/dist/state/skill-active.js +43 -4
- package/dist/state/skill-active.js.map +1 -1
- package/dist/state/terminal-normalization.js.map +1 -1
- package/dist/state/workflow-transition-reconcile.d.ts.map +1 -1
- package/dist/state/workflow-transition-reconcile.js +20 -4
- package/dist/state/workflow-transition-reconcile.js.map +1 -1
- package/dist/state/workflow-transition.d.ts +1 -1
- package/dist/state/workflow-transition.d.ts.map +1 -1
- package/dist/state/workflow-transition.js.map +1 -1
- package/dist/subagents/__tests__/adapted-role-binding.test.d.ts +2 -0
- package/dist/subagents/__tests__/adapted-role-binding.test.d.ts.map +1 -0
- package/dist/subagents/__tests__/adapted-role-binding.test.js +988 -0
- package/dist/subagents/__tests__/adapted-role-binding.test.js.map +1 -0
- package/dist/subagents/__tests__/leader-bootstrap-3181.test.d.ts +2 -0
- package/dist/subagents/__tests__/leader-bootstrap-3181.test.d.ts.map +1 -0
- package/dist/subagents/__tests__/leader-bootstrap-3181.test.js +273 -0
- package/dist/subagents/__tests__/leader-bootstrap-3181.test.js.map +1 -0
- package/dist/subagents/__tests__/tracker.test.js +1550 -10
- package/dist/subagents/__tests__/tracker.test.js.map +1 -1
- package/dist/subagents/adapted-role-binding.d.ts +17 -0
- package/dist/subagents/adapted-role-binding.d.ts.map +1 -0
- package/dist/subagents/adapted-role-binding.js +75 -0
- package/dist/subagents/adapted-role-binding.js.map +1 -0
- package/dist/subagents/role-routing-marker.d.ts +10 -0
- package/dist/subagents/role-routing-marker.d.ts.map +1 -0
- package/dist/subagents/role-routing-marker.js +136 -0
- package/dist/subagents/role-routing-marker.js.map +1 -0
- package/dist/subagents/tracker.d.ts +172 -0
- package/dist/subagents/tracker.d.ts.map +1 -1
- package/dist/subagents/tracker.js +1077 -61
- package/dist/subagents/tracker.js.map +1 -1
- package/dist/team/__tests__/approved-execution.test.js.map +1 -1
- package/dist/team/__tests__/delivery-e2e-smoke.test.js.map +1 -1
- package/dist/team/__tests__/model-contract.test.js +231 -1
- package/dist/team/__tests__/model-contract.test.js.map +1 -1
- package/dist/team/__tests__/role-router.test.js.map +1 -1
- package/dist/team/__tests__/runtime.test.js +401 -1
- package/dist/team/__tests__/runtime.test.js.map +1 -1
- package/dist/team/__tests__/scaling.test.js +181 -0
- package/dist/team/__tests__/scaling.test.js.map +1 -1
- package/dist/team/__tests__/state-root.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +434 -4
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/tmux-test-fixture.js.map +1 -1
- package/dist/team/api-interop.d.ts +2 -2
- package/dist/team/api-interop.d.ts.map +1 -1
- package/dist/team/api-interop.js.map +1 -1
- package/dist/team/commit-hygiene.js.map +1 -1
- package/dist/team/contracts.d.ts +5 -5
- package/dist/team/contracts.d.ts.map +1 -1
- package/dist/team/delivery-log.js.map +1 -1
- package/dist/team/followup-planner.js.map +1 -1
- package/dist/team/goal-workflow.js.map +1 -1
- package/dist/team/idle-nudge.d.ts.map +1 -1
- package/dist/team/model-contract.d.ts +20 -1
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/model-contract.js +267 -30
- package/dist/team/model-contract.js.map +1 -1
- package/dist/team/orchestrator.js.map +1 -1
- package/dist/team/pane-status.js.map +1 -1
- package/dist/team/phase-controller.js.map +1 -1
- package/dist/team/reminder-intents.d.ts +1 -1
- package/dist/team/reminder-intents.d.ts.map +1 -1
- package/dist/team/reminder-intents.js.map +1 -1
- package/dist/team/runtime-cli.js.map +1 -1
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +83 -52
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/scaling.d.ts +9 -7
- package/dist/team/scaling.d.ts.map +1 -1
- package/dist/team/scaling.js +69 -28
- package/dist/team/scaling.js.map +1 -1
- package/dist/team/state/dispatch-lock.js.map +1 -1
- package/dist/team/state/dispatch.js.map +1 -1
- package/dist/team/state/events.js.map +1 -1
- package/dist/team/state/tasks.js.map +1 -1
- package/dist/team/state-root.js.map +1 -1
- package/dist/team/state.js.map +1 -1
- package/dist/team/team-identity.d.ts.map +1 -1
- package/dist/team/team-identity.js.map +1 -1
- package/dist/team/tmux-session.d.ts +2 -0
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +90 -42
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/dist/team/worktree.js.map +1 -1
- package/dist/ultragoal/__tests__/artifacts.test.js.map +1 -1
- package/dist/ultragoal/__tests__/docs-contract.test.js.map +1 -1
- package/dist/ultragoal/artifacts.d.ts.map +1 -1
- package/dist/ultragoal/artifacts.js +4 -1
- package/dist/ultragoal/artifacts.js.map +1 -1
- package/dist/url-reader/index.js.map +1 -1
- package/dist/utils/__tests__/agents-md.test.js +16 -0
- package/dist/utils/__tests__/agents-md.test.js.map +1 -1
- package/dist/utils/agents-md.d.ts.map +1 -1
- package/dist/utils/agents-md.js +4 -3
- package/dist/utils/agents-md.js.map +1 -1
- package/dist/utils/agents-model-table.js.map +1 -1
- package/dist/utils/package.js.map +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/platform-command.js.map +1 -1
- package/dist/utils/repo-deps.js.map +1 -1
- package/dist/utils/version.js.map +1 -1
- package/dist/verification/__tests__/ci-rust-gates.test.js +1 -1
- package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.js.map +1 -1
- package/dist/verification/verifier.js.map +1 -1
- package/dist/visual/constants.d.ts +1 -1
- package/dist/visual/constants.d.ts.map +1 -1
- package/dist/vscode/__tests__/index.test.js.map +1 -1
- package/dist/vscode/index.js.map +1 -1
- package/dist/wiki/__tests__/cjk-tokenize.test.js.map +1 -1
- package/dist/wiki/__tests__/lint.test.js.map +1 -1
- package/dist/wiki/__tests__/query.test.js.map +1 -1
- package/dist/wiki/__tests__/storage.test.js.map +1 -1
- package/dist/wiki/__tests__/test-helpers.d.ts.map +1 -1
- package/dist/wiki/lint.js.map +1 -1
- package/dist/wiki/query.js.map +1 -1
- package/dist/wiki/storage.js.map +1 -1
- package/package.json +2 -2
- package/plugins/oh-my-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/oh-my-codex/skills/omx-setup/SKILL.md +10 -5
- package/plugins/oh-my-codex/skills/ralph/SKILL.md +4 -2
- package/plugins/oh-my-codex/skills/ralplan/SKILL.md +5 -2
- package/skills/omx-setup/SKILL.md +10 -5
- package/skills/ralph/SKILL.md +4 -2
- package/skills/ralplan/SKILL.md +5 -2
- package/src/scripts/__tests__/codex-native-hook.test.ts +20497 -12377
- package/src/scripts/__tests__/fixtures/issue-3138-installed-smoke.ts +734 -0
- package/src/scripts/__tests__/notify-fallback-delivery.test.ts +177 -0
- package/src/scripts/__tests__/notify-state-io.test.ts +73 -0
- package/src/scripts/__tests__/role-intent-bootstrap-e2e-3181.test.ts +215 -0
- package/src/scripts/__tests__/role-intent-durable-recovery-3181.test.ts +193 -0
- package/src/scripts/__tests__/smoke-packed-install.test.ts +991 -4
- package/src/scripts/codex-native-hook.ts +918 -172
- package/src/scripts/notify-fallback-delivery.ts +416 -0
- package/src/scripts/notify-fallback-watcher.ts +132 -40
- package/src/scripts/notify-hook/auto-nudge.ts +43 -12
- package/src/scripts/notify-hook/managed-tmux.ts +149 -12
- package/src/scripts/notify-hook/ralph-session-resume.ts +37 -36
- package/src/scripts/notify-hook/state-io.ts +100 -13
- package/src/scripts/notify-hook/tmux-injection.ts +38 -21
- package/src/scripts/notify-hook/visual-verdict.ts +22 -12
- package/src/scripts/notify-hook.ts +335 -90
- package/src/scripts/smoke-packed-install.ts +1829 -6
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { describe, it } from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
|
-
import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { mkdir, mkdtemp, readFile, readdir, rename, rm, symlink, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { existsSync } from 'node:fs';
|
|
5
5
|
import { tmpdir } from 'node:os';
|
|
6
6
|
import { join } from 'node:path';
|
|
7
|
-
import {
|
|
7
|
+
import { __createDefaultPidProbeForTests, appendPromptSessionProvenanceRejection, __resetSessionPointerTransactionDependenciesForTests, __setSessionPointerTransactionDependenciesForTests, isSessionPointerLaunchAbort, isSessionStale, readSessionPointer, readSessionState, readUsableSessionState, reconcileNativeSessionStart, resetSessionMetrics, resolveSessionPointerContext, writeSessionEnd, writeSessionStart, } from '../session.js';
|
|
8
8
|
function todayIsoDate() {
|
|
9
9
|
return new Date().toISOString().slice(0, 10);
|
|
10
10
|
}
|
|
@@ -17,6 +17,57 @@ function makeState(overrides = {}) {
|
|
|
17
17
|
...overrides,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
+
const TEST_TOKEN = 'transaction_token_123456';
|
|
21
|
+
const FOREIGN_TOKEN = 'foreign_token_123456789';
|
|
22
|
+
const SUCCESSOR_TOKEN = 'successor_token_123456789';
|
|
23
|
+
function codedError(code) {
|
|
24
|
+
return Object.assign(new Error(code), { code });
|
|
25
|
+
}
|
|
26
|
+
async function withPointerDependencies(overrides, run) {
|
|
27
|
+
__setSessionPointerTransactionDependenciesForTests(overrides);
|
|
28
|
+
try {
|
|
29
|
+
await run();
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
__resetSessionPointerTransactionDependenciesForTests();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function withOwnerEnvironment(sessionId, run) {
|
|
36
|
+
const previous = process.env.OMX_SESSION_ID;
|
|
37
|
+
if (sessionId === undefined)
|
|
38
|
+
delete process.env.OMX_SESSION_ID;
|
|
39
|
+
else
|
|
40
|
+
process.env.OMX_SESSION_ID = sessionId;
|
|
41
|
+
try {
|
|
42
|
+
await run();
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
if (previous === undefined)
|
|
46
|
+
delete process.env.OMX_SESSION_ID;
|
|
47
|
+
else
|
|
48
|
+
process.env.OMX_SESSION_ID = previous;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function matchingProcessIdentity() {
|
|
52
|
+
return { status: 'matching', startTicks: 1 };
|
|
53
|
+
}
|
|
54
|
+
async function writeLockOwner(cwd, owner) {
|
|
55
|
+
const context = resolveSessionPointerContext(cwd);
|
|
56
|
+
await mkdir(context.lockPath, { recursive: true });
|
|
57
|
+
await writeFile(join(context.lockPath, 'owner.json'), JSON.stringify(owner), 'utf-8');
|
|
58
|
+
return context.lockPath;
|
|
59
|
+
}
|
|
60
|
+
function validLockOwner(overrides = {}) {
|
|
61
|
+
return {
|
|
62
|
+
version: 1,
|
|
63
|
+
token: TEST_TOKEN,
|
|
64
|
+
pid: process.pid,
|
|
65
|
+
platform: 'linux',
|
|
66
|
+
pid_start_ticks: 1,
|
|
67
|
+
created_at: '2026-07-14T00:00:00.000Z',
|
|
68
|
+
...overrides,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
20
71
|
describe('session lifecycle manager', () => {
|
|
21
72
|
it('resets session metrics files with zeroed counters', async () => {
|
|
22
73
|
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-metrics-'));
|
|
@@ -249,7 +300,7 @@ describe('session lifecycle manager', () => {
|
|
|
249
300
|
nativeSessionId: 'codex-native-old',
|
|
250
301
|
});
|
|
251
302
|
await reconcileNativeSessionStart(cwd, 'codex-native-new', {
|
|
252
|
-
pid:
|
|
303
|
+
pid: process.pid,
|
|
253
304
|
platform: 'win32',
|
|
254
305
|
});
|
|
255
306
|
await writeSessionEnd(cwd, 'omx-owner-session');
|
|
@@ -356,22 +407,26 @@ describe('session lifecycle manager', () => {
|
|
|
356
407
|
await rm(cwd, { recursive: true, force: true });
|
|
357
408
|
}
|
|
358
409
|
});
|
|
359
|
-
it('
|
|
360
|
-
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-native-
|
|
410
|
+
it('preserves foreign selected-pointer evidence instead of replacing it during native reconciliation', async () => {
|
|
411
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-native-foreign-'));
|
|
361
412
|
try {
|
|
362
413
|
const statePath = join(cwd, '.omx', 'state', 'session.json');
|
|
363
414
|
await resetSessionMetrics(cwd);
|
|
364
415
|
await writeFile(statePath, JSON.stringify({
|
|
365
416
|
session_id: 'sess-other-worktree',
|
|
366
417
|
cwd: join(cwd, '..', 'different-worktree'),
|
|
418
|
+
pid: process.pid,
|
|
419
|
+
platform: 'win32',
|
|
367
420
|
}), 'utf-8');
|
|
368
|
-
|
|
369
|
-
|
|
421
|
+
await assert.rejects(reconcileNativeSessionStart(cwd, 'codex-fallback-1', { platform: 'win32' }), (error) => isSessionPointerLaunchAbort(error)
|
|
422
|
+
&& error.code === 'session_pointer_unusable'
|
|
423
|
+
&& error.pointerStatus === 'foreign-cwd');
|
|
424
|
+
assert.equal(await readFile(statePath, 'utf-8'), JSON.stringify({
|
|
425
|
+
session_id: 'sess-other-worktree',
|
|
426
|
+
cwd: join(cwd, '..', 'different-worktree'),
|
|
427
|
+
pid: process.pid,
|
|
370
428
|
platform: 'win32',
|
|
371
|
-
});
|
|
372
|
-
assert.equal(reconciled.session_id, 'codex-fallback-1');
|
|
373
|
-
assert.equal(reconciled.native_session_id, 'codex-fallback-1');
|
|
374
|
-
assert.equal(reconciled.pid, 67890);
|
|
429
|
+
}));
|
|
375
430
|
}
|
|
376
431
|
finally {
|
|
377
432
|
await rm(cwd, { recursive: true, force: true });
|
|
@@ -501,4 +556,470 @@ describe('isSessionStale', () => {
|
|
|
501
556
|
assert.equal(stale, false);
|
|
502
557
|
});
|
|
503
558
|
});
|
|
559
|
+
describe('session pointer transaction', () => {
|
|
560
|
+
it('makes root resolution failures pathless typed launch aborts', async () => {
|
|
561
|
+
await assert.rejects(writeSessionStart('bad\0cwd', 'sess-context'), (error) => isSessionPointerLaunchAbort(error)
|
|
562
|
+
&& error.code === 'session_pointer_context_failure'
|
|
563
|
+
&& error.operation === 'pointer-context-resolve'
|
|
564
|
+
&& !('pointerPath' in error));
|
|
565
|
+
});
|
|
566
|
+
it('classifies only the exact selected pointer as absent, usable, stale, indeterminate, malformed, or foreign', async () => {
|
|
567
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-pointer-status-'));
|
|
568
|
+
try {
|
|
569
|
+
const context = resolveSessionPointerContext(cwd);
|
|
570
|
+
await withPointerDependencies({
|
|
571
|
+
probePid: () => 'alive',
|
|
572
|
+
readProcessIdentity: () => matchingProcessIdentity(),
|
|
573
|
+
}, async () => {
|
|
574
|
+
assert.equal((await readSessionPointer(context)).status, 'absent');
|
|
575
|
+
await mkdir(context.baseStateDir, { recursive: true });
|
|
576
|
+
await writeFile(context.sessionPath, JSON.stringify({
|
|
577
|
+
session_id: 'sess-usable',
|
|
578
|
+
started_at: '2026-07-14T00:00:00.000Z',
|
|
579
|
+
cwd,
|
|
580
|
+
pid: process.pid,
|
|
581
|
+
platform: 'linux',
|
|
582
|
+
pid_start_ticks: 1,
|
|
583
|
+
}), 'utf-8');
|
|
584
|
+
assert.equal((await readSessionPointer(context)).status, 'usable');
|
|
585
|
+
__setSessionPointerTransactionDependenciesForTests({
|
|
586
|
+
probePid: () => 'dead',
|
|
587
|
+
readProcessIdentity: () => matchingProcessIdentity(),
|
|
588
|
+
});
|
|
589
|
+
assert.equal((await readSessionPointer(context)).status, 'stale-dead');
|
|
590
|
+
__setSessionPointerTransactionDependenciesForTests({
|
|
591
|
+
probePid: () => 'indeterminate',
|
|
592
|
+
readProcessIdentity: () => matchingProcessIdentity(),
|
|
593
|
+
});
|
|
594
|
+
assert.equal((await readSessionPointer(context)).status, 'identity-indeterminate');
|
|
595
|
+
await writeFile(context.sessionPath, '{ not-json', 'utf-8');
|
|
596
|
+
assert.equal((await readSessionPointer(context)).status, 'malformed');
|
|
597
|
+
await writeFile(context.sessionPath, JSON.stringify({
|
|
598
|
+
session_id: 'sess-foreign',
|
|
599
|
+
started_at: '2026-07-14T00:00:00.000Z',
|
|
600
|
+
cwd: join(cwd, '..', 'foreign-worktree'),
|
|
601
|
+
pid: process.pid,
|
|
602
|
+
platform: 'win32',
|
|
603
|
+
}), 'utf-8');
|
|
604
|
+
assert.equal((await readSessionPointer(context)).status, 'foreign-cwd');
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
finally {
|
|
608
|
+
__resetSessionPointerTransactionDependenciesForTests();
|
|
609
|
+
await rm(cwd, { recursive: true, force: true });
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
it('maps only ESRCH to a definitely dead default PID probe', () => {
|
|
613
|
+
const alive = __createDefaultPidProbeForTests(() => { });
|
|
614
|
+
const esrch = __createDefaultPidProbeForTests(() => { throw codedError('ESRCH'); });
|
|
615
|
+
const eperm = __createDefaultPidProbeForTests(() => { throw codedError('EPERM'); });
|
|
616
|
+
const unknown = __createDefaultPidProbeForTests(() => { throw codedError('EACCES'); });
|
|
617
|
+
const noCode = __createDefaultPidProbeForTests(() => { throw new Error('unknown'); });
|
|
618
|
+
const primitive = __createDefaultPidProbeForTests(() => { throw 'unknown'; });
|
|
619
|
+
assert.equal(alive(1), 'alive');
|
|
620
|
+
assert.equal(esrch(1), 'dead');
|
|
621
|
+
assert.equal(eperm(1), 'indeterminate');
|
|
622
|
+
assert.equal(unknown(1), 'indeterminate');
|
|
623
|
+
assert.equal(noCode(1), 'indeterminate');
|
|
624
|
+
assert.equal(primitive(1), 'indeterminate');
|
|
625
|
+
});
|
|
626
|
+
it('never reaps dead, reused, indeterminate, missing, or malformed lock evidence', async () => {
|
|
627
|
+
const cases = [
|
|
628
|
+
{ name: 'dead', owner: validLockOwner(), probePid: 'dead', expected: 'dead' },
|
|
629
|
+
{ name: 'reused', owner: validLockOwner(), probePid: 'alive', identity: { status: 'reused', startTicks: 2 }, expected: 'reused' },
|
|
630
|
+
{ name: 'indeterminate-probe', owner: validLockOwner(), probePid: 'indeterminate', expected: 'identity-indeterminate' },
|
|
631
|
+
{ name: 'indeterminate-identity', owner: validLockOwner(), probePid: 'alive', identity: { status: 'indeterminate' }, expected: 'identity-indeterminate' },
|
|
632
|
+
{ name: 'unsubstantiated-reuse', owner: validLockOwner(), probePid: 'alive', identity: { status: 'reused', startTicks: 1 }, expected: 'identity-indeterminate' },
|
|
633
|
+
{ name: 'missing-required-hash', owner: validLockOwner({ pid_cmdline_hash: 'a'.repeat(64) }), probePid: 'alive', identity: matchingProcessIdentity(), expected: 'identity-indeterminate' },
|
|
634
|
+
{ name: 'missing', probePid: 'alive', expected: 'missing' },
|
|
635
|
+
{ name: 'malformed', owner: { version: 1 }, probePid: 'alive', expected: 'malformed' },
|
|
636
|
+
];
|
|
637
|
+
for (const testCase of cases) {
|
|
638
|
+
const cwd = await mkdtemp(join(tmpdir(), `omx-session-lock-${testCase.name}-`));
|
|
639
|
+
try {
|
|
640
|
+
const context = resolveSessionPointerContext(cwd);
|
|
641
|
+
await mkdir(context.lockPath, { recursive: true });
|
|
642
|
+
if (testCase.owner) {
|
|
643
|
+
await writeFile(join(context.lockPath, 'owner.json'), JSON.stringify(testCase.owner), 'utf-8');
|
|
644
|
+
}
|
|
645
|
+
const before = await readdir(context.lockPath);
|
|
646
|
+
await withPointerDependencies({
|
|
647
|
+
token: () => TEST_TOKEN,
|
|
648
|
+
probePid: () => testCase.probePid,
|
|
649
|
+
readProcessIdentity: () => testCase.identity ?? matchingProcessIdentity(),
|
|
650
|
+
}, async () => {
|
|
651
|
+
await assert.rejects(writeSessionStart(cwd, 'sess-lock', { platform: 'win32' }), (error) => isSessionPointerLaunchAbort(error)
|
|
652
|
+
&& error.code === 'session_pointer_lock_recovery_required'
|
|
653
|
+
&& error.lockOwnerStatus === testCase.expected);
|
|
654
|
+
});
|
|
655
|
+
assert.deepEqual(await readdir(context.lockPath), before);
|
|
656
|
+
}
|
|
657
|
+
finally {
|
|
658
|
+
await rm(cwd, { recursive: true, force: true });
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
it('retries a positively matching live owner with the bounded 25/50/100 schedule before timing out', async () => {
|
|
663
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-lock-timeout-'));
|
|
664
|
+
try {
|
|
665
|
+
await writeLockOwner(cwd, validLockOwner());
|
|
666
|
+
const delays = [];
|
|
667
|
+
let now = 0;
|
|
668
|
+
await withPointerDependencies({
|
|
669
|
+
nowMs: () => now,
|
|
670
|
+
sleep: async (ms) => { delays.push(ms); now += ms; },
|
|
671
|
+
token: () => TEST_TOKEN,
|
|
672
|
+
probePid: () => 'alive',
|
|
673
|
+
readProcessIdentity: () => matchingProcessIdentity(),
|
|
674
|
+
}, async () => {
|
|
675
|
+
await assert.rejects(writeSessionStart(cwd, 'sess-timeout', { platform: 'win32' }), (error) => isSessionPointerLaunchAbort(error)
|
|
676
|
+
&& error.code === 'session_pointer_lock_timeout'
|
|
677
|
+
&& error.lockOwnerStatus === 'live');
|
|
678
|
+
});
|
|
679
|
+
assert.deepEqual(delays.slice(0, 3), [25, 50, 100]);
|
|
680
|
+
assert.equal(delays.at(-1), 25);
|
|
681
|
+
assert.equal(existsSync(resolveSessionPointerContext(cwd).lockPath), true);
|
|
682
|
+
}
|
|
683
|
+
finally {
|
|
684
|
+
await rm(cwd, { recursive: true, force: true });
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
it('rolls back only its unpublished owner artifacts and reports rollback ambiguity', async () => {
|
|
688
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-owner-publish-'));
|
|
689
|
+
try {
|
|
690
|
+
const context = resolveSessionPointerContext(cwd);
|
|
691
|
+
await withPointerDependencies({
|
|
692
|
+
token: () => TEST_TOKEN,
|
|
693
|
+
fs: {
|
|
694
|
+
writeFile: async (path, data, options) => {
|
|
695
|
+
if (path.endsWith(`owner.${TEST_TOKEN}.tmp`))
|
|
696
|
+
throw new Error('owner write failure');
|
|
697
|
+
await writeFile(path, data, options);
|
|
698
|
+
},
|
|
699
|
+
},
|
|
700
|
+
}, async () => {
|
|
701
|
+
await assert.rejects(writeSessionStart(cwd, 'sess-owner-publish', { platform: 'win32' }), (error) => isSessionPointerLaunchAbort(error)
|
|
702
|
+
&& error.code === 'session_pointer_io_failure'
|
|
703
|
+
&& error.operation === 'lock-owner-publish');
|
|
704
|
+
});
|
|
705
|
+
assert.equal(existsSync(context.lockPath), false);
|
|
706
|
+
await withPointerDependencies({
|
|
707
|
+
token: () => TEST_TOKEN,
|
|
708
|
+
fs: {
|
|
709
|
+
writeFile: async (path, data, options) => {
|
|
710
|
+
if (path.endsWith(`owner.${TEST_TOKEN}.tmp`))
|
|
711
|
+
throw new Error('owner write failure');
|
|
712
|
+
await writeFile(path, data, options);
|
|
713
|
+
},
|
|
714
|
+
rmdir: async (path) => {
|
|
715
|
+
if (path === context.lockPath)
|
|
716
|
+
throw new Error('keep lock evidence');
|
|
717
|
+
await rm(path, { recursive: false });
|
|
718
|
+
},
|
|
719
|
+
},
|
|
720
|
+
}, async () => {
|
|
721
|
+
await assert.rejects(writeSessionStart(cwd, 'sess-owner-residue', { platform: 'win32' }), (error) => isSessionPointerLaunchAbort(error)
|
|
722
|
+
&& error.code === 'session_pointer_lock_recovery_required'
|
|
723
|
+
&& error.primaryOperation === 'lock-owner-publish'
|
|
724
|
+
&& error.secondaryFailures?.[0]?.phase === 'remove-unpublished-lock');
|
|
725
|
+
});
|
|
726
|
+
assert.equal(existsSync(context.lockPath), true);
|
|
727
|
+
}
|
|
728
|
+
finally {
|
|
729
|
+
await rm(cwd, { recursive: true, force: true });
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
it('types state-directory, pointer-read, owner-sync, owner-rename, and invalid-token failures before commit', async () => {
|
|
733
|
+
const failures = [
|
|
734
|
+
{
|
|
735
|
+
name: 'state-dir',
|
|
736
|
+
operation: 'state-dir-create',
|
|
737
|
+
dependencies: (context) => ({
|
|
738
|
+
fs: {
|
|
739
|
+
mkdir: async (path, options) => {
|
|
740
|
+
if (path === context.baseStateDir)
|
|
741
|
+
throw new Error('state directory failure');
|
|
742
|
+
await mkdir(path, options);
|
|
743
|
+
},
|
|
744
|
+
},
|
|
745
|
+
}),
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
name: 'pointer-read',
|
|
749
|
+
operation: 'pointer-read',
|
|
750
|
+
dependencies: (context) => ({
|
|
751
|
+
token: () => TEST_TOKEN,
|
|
752
|
+
fs: {
|
|
753
|
+
readFile: async (path, encoding) => {
|
|
754
|
+
if (path === context.sessionPath)
|
|
755
|
+
throw new Error('pointer read failure');
|
|
756
|
+
return await readFile(path, encoding);
|
|
757
|
+
},
|
|
758
|
+
},
|
|
759
|
+
}),
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
name: 'owner-sync',
|
|
763
|
+
operation: 'lock-owner-publish',
|
|
764
|
+
dependencies: (context) => ({
|
|
765
|
+
token: () => TEST_TOKEN,
|
|
766
|
+
fs: {
|
|
767
|
+
openAndSync: async (path) => {
|
|
768
|
+
if (path === join(context.lockPath, `owner.${TEST_TOKEN}.tmp`))
|
|
769
|
+
throw new Error('owner sync failure');
|
|
770
|
+
},
|
|
771
|
+
},
|
|
772
|
+
}),
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
name: 'owner-rename',
|
|
776
|
+
operation: 'lock-owner-publish',
|
|
777
|
+
dependencies: (context) => ({
|
|
778
|
+
token: () => TEST_TOKEN,
|
|
779
|
+
fs: {
|
|
780
|
+
rename: async (from, to) => {
|
|
781
|
+
if (from === join(context.lockPath, `owner.${TEST_TOKEN}.tmp`))
|
|
782
|
+
throw new Error('owner rename failure');
|
|
783
|
+
await rename(from, to);
|
|
784
|
+
},
|
|
785
|
+
},
|
|
786
|
+
}),
|
|
787
|
+
},
|
|
788
|
+
];
|
|
789
|
+
for (const failure of failures) {
|
|
790
|
+
const cwd = await mkdtemp(join(tmpdir(), `omx-session-${failure.name}-`));
|
|
791
|
+
try {
|
|
792
|
+
const context = resolveSessionPointerContext(cwd);
|
|
793
|
+
await withPointerDependencies(failure.dependencies(context), async () => {
|
|
794
|
+
await assert.rejects(writeSessionStart(cwd, 'sess-precommit', { platform: 'win32' }), (error) => isSessionPointerLaunchAbort(error)
|
|
795
|
+
&& error.code === 'session_pointer_io_failure'
|
|
796
|
+
&& error.operation === failure.operation);
|
|
797
|
+
});
|
|
798
|
+
assert.equal(existsSync(context.lockPath), false);
|
|
799
|
+
}
|
|
800
|
+
finally {
|
|
801
|
+
await rm(cwd, { recursive: true, force: true });
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-invalid-token-'));
|
|
805
|
+
try {
|
|
806
|
+
const context = resolveSessionPointerContext(cwd);
|
|
807
|
+
await withPointerDependencies({ token: () => 'bad' }, async () => {
|
|
808
|
+
await assert.rejects(writeSessionStart(cwd, 'sess-invalid-token', { platform: 'win32' }), (error) => isSessionPointerLaunchAbort(error)
|
|
809
|
+
&& error.code === 'session_pointer_io_failure'
|
|
810
|
+
&& error.operation === 'lock-owner-publish');
|
|
811
|
+
});
|
|
812
|
+
assert.equal(existsSync(context.lockPath), false);
|
|
813
|
+
assert.equal(existsSync(`${context.sessionPath}.tmp-bad`), false);
|
|
814
|
+
}
|
|
815
|
+
finally {
|
|
816
|
+
await rm(cwd, { recursive: true, force: true });
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
it('types pointer write, sync, and rename failures and removes only the owned temporary file', async () => {
|
|
820
|
+
const phases = [
|
|
821
|
+
{ operation: 'pointer-temp-write', fail: 'write' },
|
|
822
|
+
{ operation: 'pointer-fsync', fail: 'sync' },
|
|
823
|
+
{ operation: 'pointer-rename', fail: 'rename' },
|
|
824
|
+
];
|
|
825
|
+
for (const phase of phases) {
|
|
826
|
+
const cwd = await mkdtemp(join(tmpdir(), `omx-session-${phase.fail}-`));
|
|
827
|
+
try {
|
|
828
|
+
const context = resolveSessionPointerContext(cwd);
|
|
829
|
+
const tempPath = `${context.sessionPath}.tmp-${TEST_TOKEN}`;
|
|
830
|
+
await withPointerDependencies({
|
|
831
|
+
token: () => TEST_TOKEN,
|
|
832
|
+
fs: {
|
|
833
|
+
writeFile: async (path, data, options) => {
|
|
834
|
+
await writeFile(path, data, options);
|
|
835
|
+
if (phase.fail === 'write' && path === tempPath)
|
|
836
|
+
throw new Error('pointer write failure');
|
|
837
|
+
},
|
|
838
|
+
openAndSync: async (path) => {
|
|
839
|
+
if (phase.fail === 'sync' && path === tempPath)
|
|
840
|
+
throw new Error('pointer sync failure');
|
|
841
|
+
},
|
|
842
|
+
rename: async (from, to) => {
|
|
843
|
+
if (phase.fail === 'rename' && from === tempPath && to === context.sessionPath) {
|
|
844
|
+
throw new Error('pointer rename failure');
|
|
845
|
+
}
|
|
846
|
+
await rename(from, to);
|
|
847
|
+
},
|
|
848
|
+
},
|
|
849
|
+
}, async () => {
|
|
850
|
+
await assert.rejects(writeSessionStart(cwd, 'sess-failure', { platform: 'win32' }), (error) => isSessionPointerLaunchAbort(error)
|
|
851
|
+
&& error.code === 'session_pointer_io_failure'
|
|
852
|
+
&& error.operation === phase.operation);
|
|
853
|
+
});
|
|
854
|
+
assert.equal(existsSync(tempPath), false);
|
|
855
|
+
assert.equal(existsSync(context.lockPath), false);
|
|
856
|
+
}
|
|
857
|
+
finally {
|
|
858
|
+
await rm(cwd, { recursive: true, force: true });
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
it('preserves owned pointer residue and ordered cleanup evidence when cleanup or release cannot complete', async () => {
|
|
863
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-pointer-residue-'));
|
|
864
|
+
try {
|
|
865
|
+
const context = resolveSessionPointerContext(cwd);
|
|
866
|
+
const tempPath = `${context.sessionPath}.tmp-${TEST_TOKEN}`;
|
|
867
|
+
await withPointerDependencies({
|
|
868
|
+
token: () => TEST_TOKEN,
|
|
869
|
+
fs: {
|
|
870
|
+
writeFile: async (path, data, options) => {
|
|
871
|
+
await writeFile(path, data, options);
|
|
872
|
+
if (path === tempPath)
|
|
873
|
+
throw new Error('pointer write failure');
|
|
874
|
+
},
|
|
875
|
+
unlink: async (path) => {
|
|
876
|
+
if (path === tempPath)
|
|
877
|
+
throw new Error('pointer temp cleanup failure');
|
|
878
|
+
await rm(path, { force: false });
|
|
879
|
+
},
|
|
880
|
+
rmdir: async (path) => {
|
|
881
|
+
if (path.endsWith(`.release-${TEST_TOKEN}`))
|
|
882
|
+
throw new Error('release cleanup failure');
|
|
883
|
+
await rm(path, { recursive: false });
|
|
884
|
+
},
|
|
885
|
+
},
|
|
886
|
+
}, async () => {
|
|
887
|
+
await assert.rejects(writeSessionStart(cwd, 'sess-residue', { platform: 'win32' }), (error) => isSessionPointerLaunchAbort(error)
|
|
888
|
+
&& error.code === 'session_pointer_lock_recovery_required'
|
|
889
|
+
&& error.primaryOperation === 'pointer-temp-write'
|
|
890
|
+
&& error.secondaryFailures?.map((failure) => failure.phase).join(',') === 'remove-pointer-temp,remove-release-dir'
|
|
891
|
+
&& error.secondaryFailures?.[0]?.evidencePath === tempPath);
|
|
892
|
+
});
|
|
893
|
+
assert.equal(existsSync(tempPath), true);
|
|
894
|
+
assert.equal(existsSync(`${context.lockPath}.release-${TEST_TOKEN}`), true);
|
|
895
|
+
}
|
|
896
|
+
finally {
|
|
897
|
+
await rm(cwd, { recursive: true, force: true });
|
|
898
|
+
}
|
|
899
|
+
});
|
|
900
|
+
it('leaves foreign pointer temps inert and a successor commits after explicit lock recovery', async () => {
|
|
901
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-pointer-successor-'));
|
|
902
|
+
try {
|
|
903
|
+
const context = resolveSessionPointerContext(cwd);
|
|
904
|
+
const ownTempPath = `${context.sessionPath}.tmp-${TEST_TOKEN}`;
|
|
905
|
+
const foreignTempPath = `${context.sessionPath}.tmp-${FOREIGN_TOKEN}`;
|
|
906
|
+
await mkdir(context.baseStateDir, { recursive: true });
|
|
907
|
+
await writeFile(foreignTempPath, 'foreign transaction evidence', 'utf-8');
|
|
908
|
+
await withPointerDependencies({
|
|
909
|
+
token: () => TEST_TOKEN,
|
|
910
|
+
fs: {
|
|
911
|
+
writeFile: async (path, data, options) => {
|
|
912
|
+
await writeFile(path, data, options);
|
|
913
|
+
if (path === ownTempPath)
|
|
914
|
+
throw new Error('pointer write failure');
|
|
915
|
+
},
|
|
916
|
+
unlink: async (path) => {
|
|
917
|
+
if (path === ownTempPath)
|
|
918
|
+
throw new Error('keep own residue');
|
|
919
|
+
await rm(path, { force: false });
|
|
920
|
+
},
|
|
921
|
+
rename: async (from, to) => {
|
|
922
|
+
if (from === context.lockPath)
|
|
923
|
+
throw new Error('preserve canonical lock');
|
|
924
|
+
await rename(from, to);
|
|
925
|
+
},
|
|
926
|
+
},
|
|
927
|
+
}, async () => {
|
|
928
|
+
await assert.rejects(writeSessionStart(cwd, 'sess-first', { platform: 'win32' }), isSessionPointerLaunchAbort);
|
|
929
|
+
});
|
|
930
|
+
assert.equal(existsSync(foreignTempPath), true);
|
|
931
|
+
assert.equal(existsSync(context.lockPath), true);
|
|
932
|
+
// This is documented stopped-session operator recovery, deliberately not
|
|
933
|
+
// product transaction behavior.
|
|
934
|
+
await rm(context.lockPath, { recursive: true, force: true });
|
|
935
|
+
await withPointerDependencies({ token: () => SUCCESSOR_TOKEN }, async () => {
|
|
936
|
+
await writeSessionStart(cwd, 'sess-successor', { platform: 'win32' });
|
|
937
|
+
});
|
|
938
|
+
assert.equal((await readSessionState(cwd))?.session_id, 'sess-successor');
|
|
939
|
+
assert.equal(existsSync(ownTempPath), true);
|
|
940
|
+
assert.equal(existsSync(foreignTempPath), true);
|
|
941
|
+
assert.equal(existsSync(context.lockPath), false);
|
|
942
|
+
}
|
|
943
|
+
finally {
|
|
944
|
+
await rm(cwd, { recursive: true, force: true });
|
|
945
|
+
}
|
|
946
|
+
});
|
|
947
|
+
it('binds an owner alias only on a verified same-native/absent transition and never during replacement', async () => {
|
|
948
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-owner-alias-'));
|
|
949
|
+
try {
|
|
950
|
+
const nativeOnly = await reconcileNativeSessionStart(cwd, 'native-first', {
|
|
951
|
+
platform: 'win32',
|
|
952
|
+
ownerOmxSessionId: 'omx-owner',
|
|
953
|
+
});
|
|
954
|
+
assert.equal(nativeOnly.owner_omx_session_id, undefined);
|
|
955
|
+
await withOwnerEnvironment('omx-owner', async () => {
|
|
956
|
+
const bound = await reconcileNativeSessionStart(cwd, 'native-first', {
|
|
957
|
+
platform: 'win32',
|
|
958
|
+
ownerAliasVerified: true,
|
|
959
|
+
});
|
|
960
|
+
assert.equal(bound.session_id, 'native-first');
|
|
961
|
+
assert.equal(bound.owner_omx_session_id, 'omx-owner');
|
|
962
|
+
const replacement = await reconcileNativeSessionStart(cwd, 'native-second', {
|
|
963
|
+
platform: 'win32',
|
|
964
|
+
ownerAliasVerified: true,
|
|
965
|
+
});
|
|
966
|
+
assert.equal(replacement.session_id, 'native-second');
|
|
967
|
+
assert.equal(replacement.owner_omx_session_id, 'omx-owner');
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
finally {
|
|
971
|
+
await rm(cwd, { recursive: true, force: true });
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
it('preserves pointer evidence when history cannot be appended and rejects unusable end states before history or HUD cleanup', async () => {
|
|
975
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-session-end-preserve-'));
|
|
976
|
+
try {
|
|
977
|
+
const context = resolveSessionPointerContext(cwd);
|
|
978
|
+
await writeSessionStart(cwd, 'sess-history', { platform: 'win32' });
|
|
979
|
+
await mkdir(join(cwd, '.omx', 'logs'), { recursive: true });
|
|
980
|
+
await rm(join(cwd, '.omx', 'logs'), { recursive: true, force: true });
|
|
981
|
+
await writeFile(join(cwd, '.omx', 'logs'), 'not-a-directory', 'utf-8');
|
|
982
|
+
await assert.rejects(writeSessionEnd(cwd, 'sess-history'));
|
|
983
|
+
assert.equal((await readSessionState(cwd))?.session_id, 'sess-history');
|
|
984
|
+
await rm(join(cwd, '.omx', 'logs'), { force: true });
|
|
985
|
+
await writeFile(context.sessionPath, '{ malformed', 'utf-8');
|
|
986
|
+
await assert.rejects(writeSessionEnd(cwd, 'sess-history'), (error) => isSessionPointerLaunchAbort(error)
|
|
987
|
+
&& error.code === 'session_pointer_unusable'
|
|
988
|
+
&& error.pointerStatus === 'malformed');
|
|
989
|
+
assert.equal(await readFile(context.sessionPath, 'utf-8'), '{ malformed');
|
|
990
|
+
assert.equal(existsSync(join(cwd, '.omx', 'logs', 'session-history.jsonl')), false);
|
|
991
|
+
}
|
|
992
|
+
finally {
|
|
993
|
+
await rm(cwd, { recursive: true, force: true });
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
});
|
|
997
|
+
describe('prompt provenance diagnostics', () => {
|
|
998
|
+
it('writes exactly one redacted record at the supplied selected root', async () => {
|
|
999
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-provenance-log-'));
|
|
1000
|
+
try {
|
|
1001
|
+
const stateDir = join(cwd, 'selected', '.omx', 'state');
|
|
1002
|
+
await appendPromptSessionProvenanceRejection({
|
|
1003
|
+
cwd,
|
|
1004
|
+
baseStateDir: stateDir,
|
|
1005
|
+
rootSource: 'cwd-default',
|
|
1006
|
+
sessionPath: join(stateDir, 'session.json'),
|
|
1007
|
+
lockPath: join(stateDir, 'session.json.lock'),
|
|
1008
|
+
}, {
|
|
1009
|
+
reason: 'payload_session_invalid',
|
|
1010
|
+
producer: 'native',
|
|
1011
|
+
selectedRootStatus: 'malformed',
|
|
1012
|
+
timestamp: '2026-07-14T00:00:00.000Z',
|
|
1013
|
+
});
|
|
1014
|
+
const log = await readFile(join(cwd, 'selected', '.omx', 'logs', `omx-${todayIsoDate()}.jsonl`), 'utf-8');
|
|
1015
|
+
assert.equal(log.trim().split('\n').length, 1);
|
|
1016
|
+
assert.match(log, /"event":"prompt_session_provenance_rejected"/);
|
|
1017
|
+
assert.equal(log.includes(cwd), false);
|
|
1018
|
+
assert.equal(existsSync(join(cwd, '.omx', 'logs', `omx-${todayIsoDate()}.jsonl`)), false);
|
|
1019
|
+
}
|
|
1020
|
+
finally {
|
|
1021
|
+
await rm(cwd, { recursive: true, force: true });
|
|
1022
|
+
}
|
|
1023
|
+
});
|
|
1024
|
+
});
|
|
504
1025
|
//# sourceMappingURL=session.test.js.map
|