@aria_asi/cli 0.2.40 → 0.2.41
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/bin/aria.js +236 -34
- package/dist/aria-connector/src/action-ledger-core.d.ts +387 -0
- package/dist/aria-connector/src/action-ledger-core.d.ts.map +1 -0
- package/dist/aria-connector/src/action-ledger-core.js +638 -0
- package/dist/aria-connector/src/action-ledger-core.js.map +1 -0
- package/dist/aria-connector/src/chat.d.ts.map +1 -1
- package/dist/aria-connector/src/chat.js +5 -6
- package/dist/aria-connector/src/chat.js.map +1 -1
- package/dist/aria-connector/src/codebase-scanner.d.ts +1 -1
- package/dist/aria-connector/src/codebase-scanner.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.d.ts +1 -0
- package/dist/aria-connector/src/connectors/claude-code.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.js +152 -14
- package/dist/aria-connector/src/connectors/claude-code.js.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts +10 -0
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.js +276 -27
- package/dist/aria-connector/src/connectors/codebase-awareness.js.map +1 -1
- package/dist/aria-connector/src/connectors/codex.d.ts +3 -1
- package/dist/aria-connector/src/connectors/codex.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/codex.js +1223 -41
- package/dist/aria-connector/src/connectors/codex.js.map +1 -1
- package/dist/aria-connector/src/connectors/cursor.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/cursor.js +7 -0
- package/dist/aria-connector/src/connectors/cursor.js.map +1 -1
- package/dist/aria-connector/src/connectors/governed-adapter.d.ts +30 -0
- package/dist/aria-connector/src/connectors/governed-adapter.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/governed-adapter.js +132 -0
- package/dist/aria-connector/src/connectors/governed-adapter.js.map +1 -0
- package/dist/aria-connector/src/connectors/opencode.d.ts +3 -1
- package/dist/aria-connector/src/connectors/opencode.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/opencode.js +18 -2
- package/dist/aria-connector/src/connectors/opencode.js.map +1 -1
- package/dist/aria-connector/src/connectors/repo-guard.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/repo-guard.js +25 -14
- package/dist/aria-connector/src/connectors/repo-guard.js.map +1 -1
- package/dist/aria-connector/src/connectors/runtime.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/runtime.js +92 -2
- package/dist/aria-connector/src/connectors/runtime.js.map +1 -1
- package/dist/aria-connector/src/connectors/shell.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/shell.js +123 -7
- package/dist/aria-connector/src/connectors/shell.js.map +1 -1
- package/dist/aria-connector/src/cross-cli-hive-binding.d.ts +63 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.d.ts.map +1 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.js +205 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.js.map +1 -0
- package/dist/aria-connector/src/garden-control-plane.d.ts +6 -1
- package/dist/aria-connector/src/garden-control-plane.d.ts.map +1 -1
- package/dist/aria-connector/src/garden-control-plane.js +8 -2
- package/dist/aria-connector/src/garden-control-plane.js.map +1 -1
- package/dist/aria-connector/src/governed-surface-runner.d.ts +189 -0
- package/dist/aria-connector/src/governed-surface-runner.d.ts.map +1 -0
- package/dist/aria-connector/src/governed-surface-runner.js +1022 -0
- package/dist/aria-connector/src/governed-surface-runner.js.map +1 -0
- package/dist/aria-connector/src/index.d.ts +10 -1
- package/dist/aria-connector/src/index.d.ts.map +1 -1
- package/dist/aria-connector/src/index.js +5 -0
- package/dist/aria-connector/src/index.js.map +1 -1
- package/dist/aria-connector/src/task-runner.d.ts +3 -0
- package/dist/aria-connector/src/task-runner.d.ts.map +1 -0
- package/dist/aria-connector/src/task-runner.js +3526 -0
- package/dist/aria-connector/src/task-runner.js.map +1 -0
- package/dist/aria-web/src/lib/codebase-scanner.d.ts +21 -2
- package/dist/aria-web/src/lib/codebase-scanner.d.ts.map +1 -1
- package/dist/aria-web/src/lib/codebase-scanner.js +59 -14
- package/dist/aria-web/src/lib/codebase-scanner.js.map +1 -1
- package/dist/assets/hooks/README.md +58 -0
- package/dist/assets/hooks/aria-agent-handoff.mjs +147 -2
- package/dist/assets/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/dist/assets/hooks/aria-architect-fallback.mjs +10 -2
- package/dist/assets/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/dist/assets/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/dist/assets/hooks/aria-first-class-coach.mjs +305 -10
- package/dist/assets/hooks/aria-harness-via-sdk.mjs +93 -16
- package/dist/assets/hooks/aria-import-resolution-gate.mjs +106 -20
- package/dist/assets/hooks/aria-outcome-record.mjs +56 -20
- package/dist/assets/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/dist/assets/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/dist/assets/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/dist/assets/hooks/aria-pre-text-gate.mjs +11 -2
- package/dist/assets/hooks/aria-pre-tool-gate.mjs +477 -81
- package/dist/assets/hooks/aria-pre-tool-use.mjs +70 -6
- package/dist/assets/hooks/aria-preprompt-consult.mjs +23 -4
- package/dist/assets/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/dist/assets/hooks/aria-stop-gate.mjs +585 -76
- package/dist/assets/hooks/aria-trigger-autolearn.mjs +17 -3
- package/dist/assets/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/dist/assets/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/dist/assets/hooks/canonical-settings-block.json +172 -0
- package/dist/assets/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/dist/assets/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/dist/assets/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/dist/assets/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/dist/assets/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/dist/assets/hooks/codex-native/aria-stop.mjs +691 -0
- package/dist/assets/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/dist/assets/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/dist/assets/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/dist/assets/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/dist/assets/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/dist/assets/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/dist/assets/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/dist/assets/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/dist/assets/hooks/doctrine_trigger_map.json +236 -25
- package/dist/assets/hooks/doctrine_trigger_map.schema.json +46 -0
- package/dist/assets/hooks/install.sh +84 -0
- package/dist/assets/hooks/lib/action-ledger-core.mjs +269 -0
- package/dist/assets/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/dist/assets/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/dist/assets/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/dist/assets/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/dist/assets/hooks/lib/canonical-lenses.mjs +83 -6
- package/dist/assets/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/dist/assets/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/dist/assets/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/dist/assets/hooks/lib/domain-output-quality.mjs +132 -3
- package/dist/assets/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/dist/assets/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/dist/assets/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/assets/hooks/lib/first-class-coach.mjs +454 -19
- package/dist/assets/hooks/lib/gate-audit.mjs +12 -2
- package/dist/assets/hooks/lib/gate-loop-state.mjs +11 -2
- package/dist/assets/hooks/lib/goal-contract-quality.mjs +302 -0
- package/dist/assets/hooks/lib/hook-message-window.mjs +101 -9
- package/dist/assets/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/dist/assets/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/assets/hooks/lib/obligation-ledger.mjs +147 -0
- package/dist/assets/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/dist/assets/hooks/lib/owner-authorizations.mjs +269 -0
- package/dist/assets/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/dist/assets/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/dist/assets/hooks/lib/recovery-context.mjs +151 -0
- package/dist/assets/hooks/lib/recovery-template-loader.mjs +154 -0
- package/dist/assets/hooks/lib/self-doctrine-check.mjs +321 -0
- package/dist/assets/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/dist/assets/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/dist/assets/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/dist/assets/hooks/lib/surface-caught.mjs +94 -0
- package/dist/assets/hooks/recovery-templates/force-reauthor.md +67 -0
- package/dist/assets/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/dist/assets/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/dist/assets/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/dist/assets/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/dist/assets/hooks/test-tier-lens-labeling.mjs +14 -3
- package/dist/assets/opencode-plugins/harness-context/index.js +39 -6
- package/dist/assets/opencode-plugins/harness-context/task-project-ledger.mjs +5 -1
- package/dist/assets/opencode-plugins/harness-gate/index.js +36 -0
- package/dist/assets/opencode-plugins/harness-gate/lib/atlas-dossier-client.js +1 -0
- package/dist/assets/opencode-plugins/harness-gate/lib/recovery-grants.js +79 -0
- package/dist/assets/opencode-plugins/harness-outcome/index.js +12 -0
- package/dist/assets/opencode-plugins/harness-stop/index.js +97 -2
- package/dist/assets/opencode-plugins/harness-stop/lib/atlas-dossier-client.js +1 -0
- package/dist/assets/opencode-plugins/harness-stop/lib/domain-output-quality.js +15 -2
- package/dist/assets/opencode-plugins/lib/coach.js +148 -0
- package/dist/runtime/coach-kernel.mjs +144 -7
- package/dist/runtime/codex-bridge.mjs +254 -8
- package/dist/runtime/discipline/doctrine_trigger_map.json +236 -25
- package/dist/runtime/discipline/skills/aria-cognition/34-frameworks-unified/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-cognitives/SKILL.md +128 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-post-phase/SKILL.md +118 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/SKILL.md +202 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/references/source-map.md +130 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-backend-architect/SKILL.md +124 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-backend-architect/references/backend-cookbook.md +417 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-audit/SKILL.md +133 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-audit/references/audit-cookbook.md +247 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-frame/SKILL.md +138 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-frame/references/business-cookbook.md +154 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-chat/SKILL.md +84 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-chat/scripts/aria-chat.sh +57 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-cognition-autofire/SKILL.md +137 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-cognition-batch/SKILL.md +264 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-decision-mizan/SKILL.md +136 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-decision-mizan/references/decision-frameworks.md +287 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-first-class-operating-contract/SKILL.md +104 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-frontend-architect/SKILL.md +123 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-frontend-architect/references/frontend-cookbook.md +358 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-fullstack-orchestrator/SKILL.md +127 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-fullstack-orchestrator/references/fullstack-cookbook.md +383 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-gtm-architect/SKILL.md +126 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-gtm-architect/references/gtm-cookbook.md +235 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-deploy/SKILL.md +145 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-no-stripping/SKILL.md +135 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-onboarding/SKILL.md +130 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-output-discipline/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-substrate-binding/SKILL.md +139 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-http-harness-client/SKILL.md +85 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-k8s-deploy/SKILL.md +174 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ladduniframe/SKILL.md +60 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-live-ops/SKILL.md +54 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-mac-ssh-ops/SKILL.md +100 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-memory-index/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-noor-cognitives/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ops/SKILL.md +60 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ops/references/live-endpoints.md +59 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-quality-audit/SKILL.md +133 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-readable-output/SKILL.md +239 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-readable-output/references/layout-cookbook.md +366 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-reasoning/SKILL.md +67 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-reasoning/references/core-principles.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-repo-audit/SKILL.md +135 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-repo-audit/references/repo-audit-cookbook.md +375 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-research-orchestrator/SKILL.md +138 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-research-orchestrator/references/research-patterns.md +270 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-retention-engine/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-retention-engine/references/retention-cookbook.md +271 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-revenue-engine/SKILL.md +128 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-revenue-engine/references/revenue-cookbook.md +227 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-audit/SKILL.md +233 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-audit/references/audit-checklist.md +369 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-cookbook/SKILL.md +288 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-cookbook/references/engineering-cookbook.md +489 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-soul-principles/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-task-codex-executor/SKILL.md +86 -0
- package/dist/runtime/discipline/skills/aria-cognition/aristotle-engine/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/cross-domain-24/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/deepsoul-emotional/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/fitrah-guard/SKILL.md +78 -0
- package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/SKILL.md +227 -29
- package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/references/ghazali-8lens-cookbook.md +797 -0
- package/dist/runtime/discipline/skills/aria-cognition/ijtihad-novel/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/ilham-intuition/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/never-guess/SKILL.md +77 -0
- package/dist/runtime/discipline/skills/aria-cognition/noor-recognition/SKILL.md +45 -0
- package/dist/runtime/discipline/skills/aria-cognition/qiyas-analogy/SKILL.md +174 -14
- package/dist/runtime/discipline/skills/aria-cognition/ruh-basis/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur/SKILL.md +506 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur/references/tadabbur-cookbook.md +921 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur-ops/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/tafakkur/SKILL.md +104 -0
- package/dist/runtime/doctrine_trigger_map.json +236 -25
- package/dist/runtime/embedded-public-key.mjs +27 -0
- package/dist/runtime/gated-ledger.mjs +41 -14
- package/dist/runtime/harness-daemon.mjs +85 -10
- package/dist/runtime/hive-wal-publisher.mjs +292 -0
- package/dist/runtime/hooks/README.md +58 -0
- package/dist/runtime/hooks/aria-agent-handoff.mjs +147 -2
- package/dist/runtime/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/dist/runtime/hooks/aria-architect-fallback.mjs +10 -2
- package/dist/runtime/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/dist/runtime/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/dist/runtime/hooks/aria-first-class-coach.mjs +305 -10
- package/dist/runtime/hooks/aria-harness-via-sdk.mjs +93 -16
- package/dist/runtime/hooks/aria-import-resolution-gate.mjs +106 -20
- package/dist/runtime/hooks/aria-outcome-record.mjs +56 -20
- package/dist/runtime/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/dist/runtime/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/dist/runtime/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/dist/runtime/hooks/aria-pre-text-gate.mjs +11 -2
- package/dist/runtime/hooks/aria-pre-tool-gate.mjs +477 -81
- package/dist/runtime/hooks/aria-pre-tool-use.mjs +70 -6
- package/dist/runtime/hooks/aria-preprompt-consult.mjs +23 -4
- package/dist/runtime/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/dist/runtime/hooks/aria-stop-gate.mjs +585 -76
- package/dist/runtime/hooks/aria-trigger-autolearn.mjs +17 -3
- package/dist/runtime/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/dist/runtime/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/dist/runtime/hooks/canonical-settings-block.json +172 -0
- package/dist/runtime/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/dist/runtime/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/dist/runtime/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/dist/runtime/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/dist/runtime/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/dist/runtime/hooks/codex-native/aria-stop.mjs +691 -0
- package/dist/runtime/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/dist/runtime/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/dist/runtime/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/dist/runtime/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/dist/runtime/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/dist/runtime/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/dist/runtime/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/dist/runtime/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/dist/runtime/hooks/doctrine_trigger_map.json +236 -25
- package/dist/runtime/hooks/doctrine_trigger_map.schema.json +46 -0
- package/dist/runtime/hooks/install.sh +84 -0
- package/dist/runtime/hooks/lib/action-ledger-core.mjs +269 -0
- package/dist/runtime/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/dist/runtime/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/dist/runtime/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/dist/runtime/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/dist/runtime/hooks/lib/canonical-lenses.mjs +83 -6
- package/dist/runtime/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/dist/runtime/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/dist/runtime/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/dist/runtime/hooks/lib/domain-output-quality.mjs +132 -3
- package/dist/runtime/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/dist/runtime/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/dist/runtime/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/runtime/hooks/lib/first-class-coach.mjs +454 -19
- package/dist/runtime/hooks/lib/gate-audit.mjs +12 -2
- package/dist/runtime/hooks/lib/gate-loop-state.mjs +11 -2
- package/dist/runtime/hooks/lib/goal-contract-quality.mjs +302 -0
- package/dist/runtime/hooks/lib/hook-message-window.mjs +101 -9
- package/dist/runtime/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/dist/runtime/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/runtime/hooks/lib/obligation-ledger.mjs +147 -0
- package/dist/runtime/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/dist/runtime/hooks/lib/owner-authorizations.mjs +269 -0
- package/dist/runtime/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/dist/runtime/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/dist/runtime/hooks/lib/recovery-context.mjs +151 -0
- package/dist/runtime/hooks/lib/recovery-template-loader.mjs +154 -0
- package/dist/runtime/hooks/lib/self-doctrine-check.mjs +321 -0
- package/dist/runtime/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/dist/runtime/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/dist/runtime/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/dist/runtime/hooks/lib/surface-caught.mjs +94 -0
- package/dist/runtime/hooks/recovery-templates/force-reauthor.md +67 -0
- package/dist/runtime/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/dist/runtime/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/dist/runtime/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/dist/runtime/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/dist/runtime/hooks/test-tier-lens-labeling.mjs +14 -3
- package/dist/runtime/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/runtime/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/runtime/local-phase.mjs +10 -5
- package/dist/runtime/manifest.json +8 -8
- package/dist/runtime/packet-verifier.mjs +166 -0
- package/dist/runtime/provider-proxy.mjs +13 -0
- package/dist/runtime/quality-enforcer.mjs +40 -23
- package/dist/runtime/runtime-rails/registry.mjs +252 -0
- package/dist/runtime/sdk/BUNDLED.json +2 -2
- package/dist/runtime/sdk/index.d.ts +119 -4
- package/dist/runtime/sdk/index.js +138 -12
- package/dist/runtime/sdk/index.js.map +1 -1
- package/dist/runtime/service.mjs +8036 -764
- package/dist/runtime/sub-agent-enforcer.mjs +201 -0
- package/dist/runtime/task-project-ledger.mjs +5 -1
- package/dist/sdk/BUNDLED.json +2 -2
- package/dist/sdk/index.d.ts +119 -4
- package/dist/sdk/index.js +138 -12
- package/dist/sdk/index.js.map +1 -1
- package/hooks/README.md +58 -0
- package/hooks/aria-agent-handoff.mjs +147 -2
- package/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/hooks/aria-architect-fallback.mjs +10 -2
- package/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/hooks/aria-first-class-coach.mjs +305 -10
- package/hooks/aria-harness-via-sdk.mjs +93 -16
- package/hooks/aria-import-resolution-gate.mjs +106 -20
- package/hooks/aria-outcome-record.mjs +56 -20
- package/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/hooks/aria-pre-text-gate.mjs +11 -2
- package/hooks/aria-pre-tool-gate.mjs +477 -81
- package/hooks/aria-pre-tool-use.mjs +70 -6
- package/hooks/aria-preprompt-consult.mjs +23 -4
- package/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/hooks/aria-stop-gate.mjs +585 -76
- package/hooks/aria-trigger-autolearn.mjs +17 -3
- package/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/hooks/canonical-settings-block.json +172 -0
- package/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/hooks/codex-native/aria-stop.mjs +691 -0
- package/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/hooks/doctrine_trigger_map.json +236 -25
- package/hooks/doctrine_trigger_map.schema.json +46 -0
- package/hooks/install.sh +84 -0
- package/hooks/lib/action-ledger-core.mjs +269 -0
- package/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/hooks/lib/canonical-lenses.mjs +83 -6
- package/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/hooks/lib/domain-output-quality.mjs +132 -3
- package/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/hooks/lib/first-class-coach.mjs +454 -19
- package/hooks/lib/gate-audit.mjs +12 -2
- package/hooks/lib/gate-loop-state.mjs +11 -2
- package/hooks/lib/goal-contract-quality.mjs +302 -0
- package/hooks/lib/hook-message-window.mjs +101 -9
- package/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/hooks/lib/obligation-ledger.mjs +147 -0
- package/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/hooks/lib/owner-authorizations.mjs +269 -0
- package/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/hooks/lib/recovery-context.mjs +151 -0
- package/hooks/lib/recovery-template-loader.mjs +154 -0
- package/hooks/lib/self-doctrine-check.mjs +321 -0
- package/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/hooks/lib/surface-caught.mjs +94 -0
- package/hooks/recovery-templates/force-reauthor.md +67 -0
- package/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/hooks/test-tier-lens-labeling.mjs +14 -3
- package/opencode-plugins/harness-context/index.js +39 -6
- package/opencode-plugins/harness-context/task-project-ledger.mjs +5 -1
- package/opencode-plugins/harness-gate/index.js +36 -0
- package/opencode-plugins/harness-gate/lib/atlas-dossier-client.js +1 -0
- package/opencode-plugins/harness-gate/lib/recovery-grants.js +79 -0
- package/opencode-plugins/harness-outcome/index.js +12 -0
- package/opencode-plugins/harness-stop/index.js +97 -2
- package/opencode-plugins/harness-stop/lib/atlas-dossier-client.js +1 -0
- package/opencode-plugins/harness-stop/lib/domain-output-quality.js +15 -2
- package/opencode-plugins/lib/coach.js +148 -0
- package/package.json +71 -5
- package/runtime-src/coach-kernel.mjs +144 -7
- package/runtime-src/codex-bridge.mjs +254 -8
- package/runtime-src/embedded-public-key.mjs +27 -0
- package/runtime-src/gated-ledger.mjs +41 -14
- package/runtime-src/harness-daemon.mjs +85 -10
- package/runtime-src/hive-wal-publisher.mjs +292 -0
- package/runtime-src/lib/evaluate-with-kernel.mjs +133 -0
- package/runtime-src/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/runtime-src/local-phase.mjs +10 -5
- package/runtime-src/packet-verifier.mjs +166 -0
- package/runtime-src/provider-proxy.mjs +13 -0
- package/runtime-src/quality-enforcer.mjs +40 -23
- package/runtime-src/runtime-rails/registry.mjs +252 -0
- package/runtime-src/service.mjs +8036 -764
- package/runtime-src/sub-agent-enforcer.mjs +201 -0
- package/scripts/aria-ledger-append.mjs +337 -0
- package/scripts/aria-task-cheap-worker-dispatch.mjs +234 -0
- package/scripts/audit-of-audit-prior-tasks.mjs +194 -0
- package/scripts/audit-of-audit-this-turn.mjs +116 -0
- package/scripts/bundle-sdk.mjs +31 -5
- package/scripts/check-cli-wrapper-provider-contract.mjs +160 -0
- package/scripts/check-client-compatibility.mjs +15 -5
- package/scripts/check-client-smoke.mjs +297 -0
- package/scripts/check-codex-orchestrator-adoption.mjs +150 -0
- package/scripts/check-glm-env-wired.mjs +131 -0
- package/scripts/check-hive-local-storage-contract.mjs +91 -0
- package/scripts/check-hook-mirror.mjs +150 -0
- package/scripts/check-install-sh-drift.mjs +152 -0
- package/scripts/check-kernel-sync.mjs +101 -0
- package/scripts/check-package-artifact.mjs +152 -0
- package/scripts/check-registry-mirror.mjs +71 -0
- package/scripts/drain-owner-airtable-sync-queue.mjs +287 -0
- package/scripts/export-owner-status-sheets.mjs +589 -0
- package/scripts/live-sidecar-receipt-canary.mjs +347 -0
- package/scripts/qiyas-tadabbur-model-matrix.mjs +970 -0
- package/scripts/quality-ab-live-provider.mjs +913 -0
- package/scripts/self-test-action-ledger-core.mjs +190 -0
- package/scripts/self-test-approval-receipt-binding.mjs +122 -0
- package/scripts/self-test-autofire-quality-output.mjs +110 -0
- package/scripts/self-test-claude-code-action-ledger.mjs +132 -0
- package/scripts/self-test-claude-code-mechanical-autofire-hive.mjs +138 -0
- package/scripts/self-test-claude-code-mechanical-autofire.mjs +234 -0
- package/scripts/self-test-codebase-awareness-atlas-delta.mjs +159 -0
- package/scripts/self-test-codebase-awareness-delta-ingest.mjs +179 -0
- package/scripts/self-test-codex-live-hook-parity.mjs +84 -0
- package/scripts/self-test-codex-native-action-ledger.mjs +167 -0
- package/scripts/self-test-codex-native-hook-json-contract.mjs +74 -0
- package/scripts/self-test-codex-orchestrator-continuity.mjs +113 -0
- package/scripts/self-test-codex-readable-recovery.mjs +94 -0
- package/scripts/self-test-codex-self-harness.mjs +538 -0
- package/scripts/self-test-compiled-workunit.mjs +214 -0
- package/scripts/self-test-continuation-output-smoke.mjs +101 -0
- package/scripts/self-test-cross-cli-fleet-ticker.mjs +85 -0
- package/scripts/self-test-cross-cli-hive-adoption.mjs +125 -0
- package/scripts/self-test-cross-cli-hive-learning.mjs +146 -0
- package/scripts/self-test-cross-phase-tool-failure.mjs +110 -0
- package/scripts/self-test-cross-surface-action-ledger.mjs +149 -0
- package/scripts/self-test-end-of-phase-qa-court.mjs +616 -0
- package/scripts/self-test-evaluate-with-kernel.mjs +111 -0
- package/scripts/self-test-first-class-output-delta-proof.mjs +307 -0
- package/scripts/self-test-goal-contract-output-qa.mjs +73 -0
- package/scripts/self-test-goal-contract.mjs +35 -0
- package/scripts/self-test-governed-adapters.mjs +105 -0
- package/scripts/self-test-governed-surface-runner.mjs +198 -0
- package/scripts/self-test-harness-gates.mjs +15 -12
- package/scripts/self-test-harness-ticker-sidecar.mjs +153 -0
- package/scripts/self-test-hive-org-kernel.mjs +233 -0
- package/scripts/self-test-hive-session-coordination.mjs +156 -0
- package/scripts/self-test-hive-wal-consumer.mjs +111 -0
- package/scripts/self-test-kernel-a3-a4-selection.mjs +179 -0
- package/scripts/self-test-ledger-append.mjs +175 -0
- package/scripts/self-test-live-codex-posttool-packet-smoke.mjs +111 -0
- package/scripts/self-test-live-codex-pretool-packet-smoke.mjs +101 -0
- package/scripts/self-test-live-codex-stop-qa-kernel-smoke.mjs +43 -0
- package/scripts/self-test-live-wrapper-substrate-inventory.mjs +149 -0
- package/scripts/self-test-local-main-sync-script.mjs +47 -0
- package/scripts/self-test-mechanical-autofire-resolver.mjs +296 -0
- package/scripts/self-test-no-consult-cognitive-skills-output.mjs +135 -0
- package/scripts/self-test-owner-airtable-sync-queue.mjs +196 -0
- package/scripts/self-test-owner-airtable-sync.mjs +181 -0
- package/scripts/self-test-owner-sheets-action-ledger.mjs +100 -0
- package/scripts/self-test-production-preflight.mjs +78 -0
- package/scripts/self-test-project-boundary-cognition.mjs +79 -0
- package/scripts/self-test-qa-exec-kernel.mjs +34 -0
- package/scripts/self-test-qa-recovery-learning-loop.mjs +113 -0
- package/scripts/self-test-qiyas-label-alignment.mjs +94 -0
- package/scripts/self-test-recovery-context.mjs +110 -0
- package/scripts/self-test-repo-guard.mjs +10 -0
- package/scripts/self-test-runtime-health-self-heal.mjs +161 -0
- package/scripts/self-test-runtime-postcondition.mjs +70 -0
- package/scripts/self-test-soul-precommit-hook.mjs +39 -0
- package/scripts/self-test-stop-gate-kernel-guards.mjs +185 -0
- package/scripts/self-test-stop-gate.mjs +128 -0
- package/scripts/self-test-substrate-kernel-execution-receipt.mjs +130 -0
- package/scripts/self-test-substrate-open-skill-floor.mjs +87 -0
- package/scripts/self-test-substrate-output-quality-eval.mjs +171 -0
- package/scripts/self-test-task-closeout-drift.mjs +97 -0
- package/scripts/self-test-task-project-ledger-readiness.mjs +43 -0
- package/scripts/self-test-task-runner-phase-consumer.mjs +134 -0
- package/scripts/self-test-task-worker-lane.mjs +256 -0
- package/scripts/self-test-turn-substrate-qa-kernel.mjs +188 -0
- package/scripts/self-test-universal-action-capture.mjs +153 -0
- package/scripts/self-test-universal-turn-packet-entrypoints.mjs +252 -0
- package/scripts/self-test-universal-turn-packet.mjs +320 -0
- package/scripts/session-quality-backfill.mjs +253 -0
- package/scripts/smoke-autofire-100-prompts.mjs +481 -0
- package/scripts/sync-local-main-on-task-complete.mjs +278 -0
- package/scripts/sync-owner-status-airtable.mjs +1158 -0
- package/scripts/validate-skill-prompts.mjs +12 -1
- package/scripts/verify-codex-native-mirror.mjs +262 -0
- package/skills/34-frameworks-unified/SKILL.md +42 -0
- package/skills/api-design/SKILL.md +123 -0
- package/skills/architecture-decision/SKILL.md +105 -0
- package/skills/aria-aristotle-cognitives/SKILL.md +128 -0
- package/skills/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/skills/aria-aristotle-post-phase/SKILL.md +116 -0
- package/skills/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/skills/aria-axioms-first-principles/SKILL.md +202 -0
- package/skills/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/skills/aria-axioms-first-principles/references/source-map.md +130 -0
- package/skills/aria-chat/SKILL.md +84 -0
- package/skills/aria-chat/scripts/aria-chat.sh +57 -0
- package/skills/aria-cognition/34-frameworks-unified/SKILL.md +42 -0
- package/skills/aria-cognition/aria-aristotle-cognitives/SKILL.md +128 -0
- package/skills/aria-cognition/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/skills/aria-cognition/aria-aristotle-post-phase/SKILL.md +118 -0
- package/skills/aria-cognition/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/skills/aria-cognition/aria-axioms-first-principles/SKILL.md +202 -0
- package/skills/aria-cognition/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/skills/aria-cognition/aria-axioms-first-principles/references/source-map.md +130 -0
- package/skills/aria-cognition/aria-backend-architect/SKILL.md +124 -0
- package/skills/aria-cognition/aria-backend-architect/references/backend-cookbook.md +417 -0
- package/skills/aria-cognition/aria-business-audit/SKILL.md +133 -0
- package/skills/aria-cognition/aria-business-audit/references/audit-cookbook.md +247 -0
- package/skills/aria-cognition/aria-business-frame/SKILL.md +138 -0
- package/skills/aria-cognition/aria-business-frame/references/business-cookbook.md +154 -0
- package/skills/aria-cognition/aria-chat/SKILL.md +84 -0
- package/skills/aria-cognition/aria-chat/scripts/aria-chat.sh +57 -0
- package/skills/aria-cognition/aria-cognition-autofire/SKILL.md +137 -0
- package/skills/aria-cognition/aria-cognition-batch/SKILL.md +264 -0
- package/skills/aria-cognition/aria-decision-mizan/SKILL.md +136 -0
- package/skills/aria-cognition/aria-decision-mizan/references/decision-frameworks.md +287 -0
- package/skills/aria-cognition/aria-first-class-operating-contract/SKILL.md +104 -0
- package/skills/aria-cognition/aria-frontend-architect/SKILL.md +123 -0
- package/skills/aria-cognition/aria-frontend-architect/references/frontend-cookbook.md +358 -0
- package/skills/aria-cognition/aria-fullstack-orchestrator/SKILL.md +127 -0
- package/skills/aria-cognition/aria-fullstack-orchestrator/references/fullstack-cookbook.md +383 -0
- package/skills/aria-cognition/aria-gtm-architect/SKILL.md +126 -0
- package/skills/aria-cognition/aria-gtm-architect/references/gtm-cookbook.md +235 -0
- package/skills/aria-cognition/aria-harness-deploy/SKILL.md +145 -0
- package/skills/aria-cognition/aria-harness-no-stripping/SKILL.md +135 -0
- package/skills/aria-cognition/aria-harness-onboarding/SKILL.md +130 -0
- package/skills/aria-cognition/aria-harness-output-discipline/SKILL.md +120 -0
- package/skills/aria-cognition/aria-harness-substrate-binding/SKILL.md +139 -0
- package/skills/aria-cognition/aria-http-harness-client/SKILL.md +85 -0
- package/skills/aria-cognition/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/skills/aria-cognition/aria-k8s-deploy/SKILL.md +174 -0
- package/skills/aria-cognition/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/skills/aria-cognition/aria-ladduniframe/SKILL.md +60 -0
- package/skills/aria-cognition/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/skills/aria-cognition/aria-live-ops/SKILL.md +54 -0
- package/skills/aria-cognition/aria-mac-ssh-ops/SKILL.md +100 -0
- package/skills/aria-cognition/aria-memory-index/SKILL.md +42 -0
- package/skills/aria-cognition/aria-noor-cognitives/SKILL.md +120 -0
- package/skills/aria-cognition/aria-ops/SKILL.md +60 -0
- package/skills/aria-cognition/aria-ops/references/live-endpoints.md +59 -0
- package/skills/aria-cognition/aria-quality-audit/SKILL.md +133 -0
- package/skills/aria-cognition/aria-readable-output/SKILL.md +239 -0
- package/skills/aria-cognition/aria-readable-output/references/layout-cookbook.md +366 -0
- package/skills/aria-cognition/aria-reasoning/SKILL.md +67 -0
- package/skills/aria-cognition/aria-reasoning/references/core-principles.md +42 -0
- package/skills/aria-cognition/aria-repo-audit/SKILL.md +135 -0
- package/skills/aria-cognition/aria-repo-audit/references/repo-audit-cookbook.md +375 -0
- package/skills/aria-cognition/aria-research-orchestrator/SKILL.md +138 -0
- package/skills/aria-cognition/aria-research-orchestrator/references/research-patterns.md +270 -0
- package/skills/aria-cognition/aria-retention-engine/SKILL.md +120 -0
- package/skills/aria-cognition/aria-retention-engine/references/retention-cookbook.md +271 -0
- package/skills/aria-cognition/aria-revenue-engine/SKILL.md +128 -0
- package/skills/aria-cognition/aria-revenue-engine/references/revenue-cookbook.md +227 -0
- package/skills/aria-cognition/aria-senior-code-audit/SKILL.md +233 -0
- package/skills/aria-cognition/aria-senior-code-audit/references/audit-checklist.md +369 -0
- package/skills/aria-cognition/aria-senior-code-cookbook/SKILL.md +288 -0
- package/skills/aria-cognition/aria-senior-code-cookbook/references/engineering-cookbook.md +489 -0
- package/skills/aria-cognition/aria-soul-principles/SKILL.md +42 -0
- package/skills/aria-cognition/aria-task-codex-executor/SKILL.md +86 -0
- package/skills/aria-cognition/aristotle-engine/SKILL.md +42 -0
- package/skills/aria-cognition/cross-domain-24/SKILL.md +42 -0
- package/skills/aria-cognition/deepsoul-emotional/SKILL.md +42 -0
- package/skills/aria-cognition/fitrah-guard/SKILL.md +78 -0
- package/skills/aria-cognition/ghazali-8lens/SKILL.md +227 -29
- package/skills/aria-cognition/ghazali-8lens/references/ghazali-8lens-cookbook.md +797 -0
- package/skills/aria-cognition/ijtihad-novel/SKILL.md +42 -0
- package/skills/aria-cognition/ilham-intuition/SKILL.md +42 -0
- package/skills/aria-cognition/never-guess/SKILL.md +77 -0
- package/skills/aria-cognition/noor-recognition/SKILL.md +45 -0
- package/skills/aria-cognition/qiyas-analogy/SKILL.md +174 -14
- package/skills/aria-cognition/ruh-basis/SKILL.md +42 -0
- package/skills/aria-cognition/tadabbur/SKILL.md +506 -0
- package/skills/aria-cognition/tadabbur/references/tadabbur-cookbook.md +921 -0
- package/skills/aria-cognition/tadabbur-ops/SKILL.md +42 -0
- package/skills/aria-cognition/tafakkur/SKILL.md +104 -0
- package/skills/aria-cognition-autofire/SKILL.md +109 -0
- package/skills/aria-cognition-batch/SKILL.md +264 -0
- package/skills/aria-conversational-doctrine-discipline/SKILL.md +125 -0
- package/skills/aria-essence/SKILL.md +81 -0
- package/skills/aria-essence/references/domain-matrix.md +80 -0
- package/skills/aria-essence/references/evolution-loop.md +30 -0
- package/skills/aria-essence/references/readable-cognition.md +27 -0
- package/skills/aria-first-class-operating-contract/SKILL.md +104 -0
- package/skills/aria-forge-guardrails/SKILL.md +53 -0
- package/skills/aria-forge-guardrails/references/checklist.md +31 -0
- package/skills/aria-harness-deploy/SKILL.md +145 -0
- package/skills/aria-harness-no-stripping/SKILL.md +135 -0
- package/skills/aria-harness-onboarding/SKILL.md +130 -0
- package/skills/aria-harness-output-discipline/SKILL.md +120 -0
- package/skills/aria-harness-substrate-binding/SKILL.md +139 -0
- package/skills/aria-http-harness-client/SKILL.md +85 -0
- package/skills/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/skills/aria-k8s-deploy/SKILL.md +174 -0
- package/skills/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/skills/aria-ladduniframe/SKILL.md +60 -0
- package/skills/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/skills/aria-live-ops/SKILL.md +54 -0
- package/skills/aria-mac-ssh-ops/SKILL.md +100 -0
- package/skills/aria-memory-index/SKILL.md +42 -0
- package/skills/aria-noor-cognitives/SKILL.md +120 -0
- package/skills/aria-ops/SKILL.md +60 -0
- package/skills/aria-ops/references/live-endpoints.md +59 -0
- package/skills/aria-quality-audit/SKILL.md +133 -0
- package/skills/aria-reasoning/SKILL.md +67 -0
- package/skills/aria-reasoning/references/core-principles.md +42 -0
- package/skills/aria-repo-doctrine/SKILL.md +57 -0
- package/skills/aria-soul-principles/SKILL.md +42 -0
- package/skills/aria-task-codex-executor/SKILL.md +86 -0
- package/skills/aristotle-engine/SKILL.md +42 -0
- package/skills/ci-cd-pipeline/SKILL.md +116 -0
- package/skills/code-review/SKILL.md +131 -0
- package/skills/cross-domain-24/SKILL.md +42 -0
- package/skills/database-design/SKILL.md +124 -0
- package/skills/deepsoul-emotional/SKILL.md +42 -0
- package/skills/deno-kv-raft-pubsub/SKILL.md +561 -0
- package/skills/deno-kv-raft-pubsub/reference/maelstrom-integration.md +393 -0
- package/skills/deno-kv-raft-pubsub/reference/pubsub-api.md +376 -0
- package/skills/deno-kv-raft-pubsub/reference/raft-spec.md +402 -0
- package/skills/deno-kv-raft-pubsub/reference/state-machine.md +182 -0
- package/skills/error-handling/SKILL.md +159 -0
- package/skills/firecrawl/SKILL.md +165 -0
- package/skills/firecrawl/rules/install.md +82 -0
- package/skills/firecrawl/rules/security.md +26 -0
- package/skills/firecrawl-agent/SKILL.md +86 -0
- package/skills/firecrawl-build-interact/SKILL.md +96 -0
- package/skills/firecrawl-build-onboarding/SKILL.md +131 -0
- package/skills/firecrawl-build-onboarding/references/auth-flow.md +39 -0
- package/skills/firecrawl-build-onboarding/references/project-setup.md +20 -0
- package/skills/firecrawl-build-onboarding/references/sdk-installation.md +17 -0
- package/skills/firecrawl-build-scrape/SKILL.md +97 -0
- package/skills/firecrawl-build-search/SKILL.md +97 -0
- package/skills/firecrawl-clone/SKILL.md +419 -0
- package/skills/firecrawl-crawl/SKILL.md +87 -0
- package/skills/firecrawl-download/SKILL.md +98 -0
- package/skills/firecrawl-interact/SKILL.md +112 -0
- package/skills/firecrawl-map/SKILL.md +79 -0
- package/skills/firecrawl-scrape/SKILL.md +97 -0
- package/skills/firecrawl-search/SKILL.md +88 -0
- package/skills/fitrah-guard/SKILL.md +78 -0
- package/skills/forge-quality-rules/SKILL.md +61 -0
- package/skills/ghazali-8lens/SKILL.md +56 -0
- package/skills/ijtihad-novel/SKILL.md +42 -0
- package/skills/ilham-intuition/SKILL.md +42 -0
- package/skills/imagegen/LICENSE.txt +201 -0
- package/skills/imagegen/SKILL.md +374 -0
- package/skills/imagegen/agents/openai.yaml +6 -0
- package/skills/imagegen/assets/imagegen-small.svg +5 -0
- package/skills/imagegen/assets/imagegen.png +0 -0
- package/skills/imagegen/references/cli.md +242 -0
- package/skills/imagegen/references/codex-network.md +33 -0
- package/skills/imagegen/references/image-api.md +90 -0
- package/skills/imagegen/references/prompting.md +118 -0
- package/skills/imagegen/references/sample-prompts.md +433 -0
- package/skills/imagegen/scripts/image_gen.py +995 -0
- package/skills/imagegen/scripts/remove_chroma_key.py +440 -0
- package/skills/istiqra-induction/SKILL.md +44 -0
- package/skills/ladunni-22/SKILL.md +53 -0
- package/skills/mizan/SKILL.md +90 -0
- package/skills/nadia/SKILL.md +56 -0
- package/skills/nadia-psi/SKILL.md +56 -0
- package/skills/never-guess/SKILL.md +75 -0
- package/skills/noor-recognition/SKILL.md +45 -0
- package/skills/observability/SKILL.md +133 -0
- package/skills/openai-docs/LICENSE.txt +201 -0
- package/skills/openai-docs/SKILL.md +100 -0
- package/skills/openai-docs/agents/openai.yaml +14 -0
- package/skills/openai-docs/assets/openai-small.svg +3 -0
- package/skills/openai-docs/assets/openai.png +0 -0
- package/skills/openai-docs/references/latest-model.md +37 -0
- package/skills/openai-docs/references/prompting-guide.md +244 -0
- package/skills/openai-docs/references/upgrade-guide.md +181 -0
- package/skills/openai-docs/scripts/resolve-latest-model-info.js +147 -0
- package/skills/pdf/LICENSE.txt +201 -0
- package/skills/pdf/SKILL.md +85 -0
- package/skills/pdf/agents/openai.yaml +5 -0
- package/skills/pdf/assets/pdf.png +0 -0
- package/skills/playwright/LICENSE.txt +201 -0
- package/skills/playwright/NOTICE.txt +14 -0
- package/skills/playwright/SKILL.md +165 -0
- package/skills/playwright/agents/openai.yaml +6 -0
- package/skills/playwright/assets/playwright-small.svg +3 -0
- package/skills/playwright/assets/playwright.png +0 -0
- package/skills/playwright/references/cli.md +116 -0
- package/skills/playwright/references/workflows.md +95 -0
- package/skills/playwright/scripts/playwright_cli.sh +25 -0
- package/skills/plugin-creator/SKILL.md +178 -0
- package/skills/plugin-creator/agents/openai.yaml +6 -0
- package/skills/plugin-creator/assets/plugin-creator-small.svg +3 -0
- package/skills/plugin-creator/assets/plugin-creator.png +0 -0
- package/skills/plugin-creator/references/plugin-json-spec.md +170 -0
- package/skills/plugin-creator/scripts/create_basic_plugin.py +301 -0
- package/skills/predictor/SKILL.md +43 -0
- package/skills/qiyas-analogy/SKILL.md +204 -0
- package/skills/refactoring/SKILL.md +137 -0
- package/skills/ruh-basis/SKILL.md +42 -0
- package/skills/security-review/SKILL.md +129 -0
- package/skills/skill-creator/SKILL.md +434 -0
- package/skills/skill-creator/agents/openai.yaml +5 -0
- package/skills/skill-creator/assets/skill-creator-small.svg +3 -0
- package/skills/skill-creator/assets/skill-creator.png +0 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/references/openai_yaml.md +49 -0
- package/skills/skill-creator/scripts/generate_openai_yaml.py +226 -0
- package/skills/skill-creator/scripts/init_skill.py +400 -0
- package/skills/skill-creator/scripts/quick_validate.py +101 -0
- package/skills/skill-installer/LICENSE.txt +202 -0
- package/skills/skill-installer/SKILL.md +76 -0
- package/skills/skill-installer/agents/openai.yaml +5 -0
- package/skills/skill-installer/assets/skill-installer-small.svg +3 -0
- package/skills/skill-installer/assets/skill-installer.png +0 -0
- package/skills/skill-installer/scripts/github_utils.py +21 -0
- package/skills/skill-installer/scripts/install-skill-from-github.py +308 -0
- package/skills/skill-installer/scripts/list-skills.py +107 -0
- package/skills/skills-and-hooks-reference/SKILL.md +196 -0
- package/skills/soul-domains/SKILL.md +43 -0
- package/skills/tadabbur/SKILL.md +232 -0
- package/skills/tadabbur-ops/SKILL.md +42 -0
- package/skills/tafakkur/SKILL.md +104 -0
- package/skills/testing-strategy/SKILL.md +122 -0
- package/src/action-ledger-core.ts +1054 -0
- package/src/chat.ts +5 -6
- package/src/codebase-scanner.ts +2 -0
- package/src/connectors/claude-code.ts +149 -12
- package/src/connectors/codebase-awareness.ts +325 -25
- package/src/connectors/codex.ts +1225 -41
- package/src/connectors/cursor.ts +8 -0
- package/src/connectors/governed-adapter.ts +174 -0
- package/src/connectors/opencode.ts +18 -2
- package/src/connectors/repo-guard.ts +24 -12
- package/src/connectors/runtime.ts +99 -2
- package/src/connectors/shell.ts +125 -7
- package/src/cross-cli-hive-binding.ts +290 -0
- package/src/garden-control-plane.ts +24 -1
- package/src/governed-surface-runner.ts +1227 -0
- package/src/index.ts +104 -1
- package/src/task-runner.ts +3794 -0
- package/dist/aria-connector/src/install-hooks.d.ts +0 -18
- package/dist/aria-connector/src/install-hooks.d.ts.map +0 -1
- package/dist/aria-connector/src/install-hooks.js +0 -224
- package/dist/aria-connector/src/install-hooks.js.map +0 -1
- package/dist/aria-connector/src/onboarding-wizard.d.ts +0 -5
- package/dist/aria-connector/src/onboarding-wizard.d.ts.map +0 -1
- package/dist/aria-connector/src/onboarding-wizard.js +0 -188
- package/dist/aria-connector/src/onboarding-wizard.js.map +0 -1
- package/dist/cli-0.2.38.tgz +0 -0
- package/dist/install.sh +0 -13
- package/src/__tests__/anthropic-oauth.test.ts +0 -186
- package/src/__tests__/auth-commands.test.ts +0 -132
- package/src/__tests__/owner-login.test.ts +0 -311
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// ── doctrine-self-check-file: M0.SELFREVIEW.1+2 (2026-05-06) ──
|
|
3
|
+
// Session added comments describing prior antipatterns being migrated.
|
|
4
|
+
// Each comment names a trigger pattern; file-level ack covers them all.
|
|
5
|
+
// doctrine-self-check-file: (?:non-blocking|warn(?:ing)? only|advisory|falls? through|fail open|soft fail|log(?:ged)? and continue|quality gate warning) session-added-comments-describing-prior-state-or-migration
|
|
6
|
+
// doctrine-self-check-file: \b(?:patch|hotfix|band.?aid)\b session-added-comments-describing-prior-state-or-migration
|
|
7
|
+
// doctrine-self-check-file: \b(?:skeleton|stub)\b session-added-comments-describing-prior-state-or-migration
|
|
8
|
+
// doctrine-self-check-file: \bpreferred\b session-added-comments-describing-prior-state-or-migration
|
|
9
|
+
// doctrine-self-check-file: best.?effort session-added-comments-describing-prior-state-or-migration
|
|
10
|
+
// doctrine-self-check-file: carve.?out|workaround|work.?around session-added-comments-describing-prior-state-or-migration
|
|
11
|
+
// doctrine-self-check-file: deploy-service\.sh|apply-aria-organism\.sh|kubectl apply -f|kubectl set image|docker push|trivial deploy|just a config bump|fast path deploy|skip the verify|deploy without verify|hospital-service\.yaml session-added-comments-describing-prior-state-or-migration
|
|
12
|
+
// doctrine-self-check-file: eventually|for now session-added-comments-describing-prior-state-or-migration
|
|
13
|
+
// doctrine-self-check-file: fall.?through session-added-comments-describing-prior-state-or-migration
|
|
14
|
+
// doctrine-self-check-file: from training|i recall|i remember|by default session-added-comments-describing-prior-state-or-migration
|
|
15
|
+
// doctrine-self-check-file: just context|advisory|read.only session-added-comments-describing-prior-state-or-migration
|
|
16
|
+
// doctrine-self-check-file: kill.?switch|env.?(?:var|variable).?(?:override|disable|bypass)|process\.env\.[A-Z_]+\s*===\s*['"]off['"] session-added-comments-describing-prior-state-or-migration
|
|
17
|
+
// doctrine-self-check-file: preferred over|optional|fallback layer session-added-comments-describing-prior-state-or-migration
|
|
18
|
+
// doctrine-self-check-file: should be fine|should work session-added-comments-describing-prior-state-or-migration
|
|
19
|
+
// doctrine-self-check-file: should work session-added-comments-describing-prior-state-or-migration
|
|
20
|
+
// doctrine-self-check-file: TODO:?[^a-z0-9]|FIXME:?[^a-z0-9]|XXX:?[^a-z0-9] session-added-comments-describing-prior-state-or-migration
|
|
21
|
+
// doctrine-self-check-file: use the override|skip the gate|emergency flag|temporarily bypass|use the env disable|force through|DEPLOY_ALLOW_NO_ADMISSION_POLICY|ARIA_BINDING_ENABLED=false|--no-verify|--force session-added-comments-describing-prior-state-or-migration
|
|
22
|
+
|
|
2
23
|
// ARIA_ALLOW_STUB — doctrine gate file legitimately discusses stub/placeholder semantics.
|
|
3
24
|
// Aria pre-tool-use gate — enforces cognition use before destructive tool calls.
|
|
4
25
|
//
|
|
@@ -41,6 +62,8 @@ import { readFileSync, writeFileSync, appendFileSync, existsSync, mkdirSync, chm
|
|
|
41
62
|
import { dirname } from 'node:path';
|
|
42
63
|
import { homedir } from 'node:os';
|
|
43
64
|
import { spawnSync } from 'node:child_process';
|
|
65
|
+
// AI-11803-F4 (2026-05-12): probe-discipline scanner for no_timeouts_decision_tree_rule.
|
|
66
|
+
import { scanProbeDiscipline } from './lib/probe-discipline-scanner.mjs';
|
|
44
67
|
import { createHmac, randomBytes as cryptoRandomBytes } from 'node:crypto';
|
|
45
68
|
import { lensNamesForTier } from './lib/canonical-lenses.mjs';
|
|
46
69
|
import { registerGateBlock } from './lib/gate-loop-state.mjs';
|
|
@@ -49,11 +72,25 @@ import {
|
|
|
49
72
|
extractTextFromContent,
|
|
50
73
|
isMostlySystemReminder,
|
|
51
74
|
isToolResultOnlyContent,
|
|
75
|
+
isUserAuthoredMessage,
|
|
52
76
|
normalizeContent,
|
|
53
77
|
normalizeRole,
|
|
54
78
|
} from './lib/hook-message-window.mjs';
|
|
55
79
|
import { evaluateSkillGate, formatSkillGateBlock } from './lib/skill-autoload-gate.mjs';
|
|
80
|
+
// Atlas dossier client — fetches per-file governing_skills over the Atlas
|
|
81
|
+
// Unix socket. Used to augment classifyRequiredSkills output with file-bound
|
|
82
|
+
// skill bindings discovered by the cognitive extractor. Fail-open: any Atlas
|
|
83
|
+
// downtime returns [] and the gate behaves exactly as before the wire.
|
|
84
|
+
// Added 2026-05-17 (Phase 1 of corpus-to-runtime auto-trigger closure).
|
|
85
|
+
import { fetchGoverningSkills } from './lib/atlas-dossier-client.mjs';
|
|
86
|
+
// A5 (2026-05-18) — intra-turn atlas-as-orchestrator: run the deterministic
|
|
87
|
+
// cognitive kernel with a tool-class observation per-call. Selection unions
|
|
88
|
+
// into additionalRequiredSkills so the skill gate enforces atlas's per-tool
|
|
89
|
+
// pick on top of the per-target dossier governing_skills already wired.
|
|
90
|
+
import { compileCognitiveOptions as kernelCompileCognitiveOptions } from './lib/kernel/deterministic-cognitive-kernel.mjs';
|
|
56
91
|
import { emergencyGateOffDecision } from './lib/emergency-gateoff.mjs';
|
|
92
|
+
import { checkAndAuthorize, consumeGrant } from './lib/owner-authorizations.mjs';
|
|
93
|
+
import { extractManifest, manifestSkillsToInvoke } from './lib/orchestration-manifest-extract.mjs';
|
|
57
94
|
|
|
58
95
|
const HOME = process.env.HOME || '/tmp';
|
|
59
96
|
const LOG = `${HOME}/.claude/aria-pre-tool-gate.log`;
|
|
@@ -67,10 +104,26 @@ function runUniversalGovernanceGate(payload) {
|
|
|
67
104
|
input: `${JSON.stringify(payload)}\n`,
|
|
68
105
|
encoding: 'utf8',
|
|
69
106
|
maxBuffer: 1024 * 1024,
|
|
107
|
+
// M0.H.X4 (2026-05-06): subprocess timeout. Hung governance-gate
|
|
108
|
+
// would block every tool invocation; 5s is generous for JSON output.
|
|
109
|
+
timeout: 5000,
|
|
70
110
|
});
|
|
111
|
+
// M0.H.X4: timeout / signal failure → hard block (fail-CLOSED).
|
|
112
|
+
if (child.signal || child.status === null) {
|
|
113
|
+
process.stderr.write(`[aria-pre-tool-gate:governance-gate-spawn] caught: signal=${child.signal || 'unknown'} status=${child.status} stderr=${String(child.stderr || '').slice(0, 200)}\n`);
|
|
114
|
+
return { decision: 'block', ok: false, reason: `governance-gate subprocess failed (signal=${child.signal || 'unknown'}); fail-CLOSED per M0.H.X4`, governanceMode: 'block', raw: null };
|
|
115
|
+
}
|
|
71
116
|
const stdout = String(child.stdout || '').trim();
|
|
72
117
|
let result = null;
|
|
73
|
-
|
|
118
|
+
// M0.H.X3 + M0.H.X4: previous `} catch {}` silently absorbed malformed
|
|
119
|
+
// governance-gate output. Now: surface + fail-CLOSED.
|
|
120
|
+
try {
|
|
121
|
+
result = stdout ? JSON.parse(stdout) : null;
|
|
122
|
+
} catch (parseErr) {
|
|
123
|
+
const parseErrMsg = parseErr instanceof Error ? parseErr.message : String(parseErr);
|
|
124
|
+
process.stderr.write(`[aria-pre-tool-gate:governance-gate-parse] caught: ${parseErrMsg}; raw=${stdout.slice(0, 500)}\n`);
|
|
125
|
+
return { decision: 'block', ok: false, reason: `governance-gate output unparseable JSON (${parseErrMsg}); fail-CLOSED per M0.H.X4`, governanceMode: 'block', raw: stdout };
|
|
126
|
+
}
|
|
74
127
|
if (child.status !== 0 || result?.ok === false || result?.decision === 'block') {
|
|
75
128
|
const reason = stdout || child.stderr || 'aria-governance-gate blocked this action.';
|
|
76
129
|
process.stderr.write(`[aria-governance:block] ${reason.slice(0, 500)}\n`);
|
|
@@ -159,7 +212,20 @@ function audit(decision, summary) {
|
|
|
159
212
|
);
|
|
160
213
|
}
|
|
161
214
|
}
|
|
162
|
-
} catch {
|
|
215
|
+
} catch (err) {
|
|
216
|
+
// M0.H.X3: audit log write failure now surfaces (was silent — could
|
|
217
|
+
// mask bypass-rate accounting drift).
|
|
218
|
+
process.stderr.write(`[aria-pre-tool-gate:audit-log-write] caught: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function remoteRuntimeCoachEnabled() {
|
|
223
|
+
return /^(?:1|true|yes|on)$/i.test(String(
|
|
224
|
+
process.env.ARIA_REMOTE_COACH_ENABLED ||
|
|
225
|
+
process.env.ARIA_RUNTIME_COACH_ENABLED ||
|
|
226
|
+
process.env.ARIA_COACH_REMOTE_ENABLED ||
|
|
227
|
+
''
|
|
228
|
+
));
|
|
163
229
|
}
|
|
164
230
|
|
|
165
231
|
// ARIA_BINDING_ENABLED env-override REMOVED 2026-04-28 per Hamza directive
|
|
@@ -193,7 +259,12 @@ function bindingAuditAppend(record) {
|
|
|
193
259
|
try {
|
|
194
260
|
if (!existsSync(dirname(BINDING_AUDIT))) mkdirSync(dirname(BINDING_AUDIT), { recursive: true });
|
|
195
261
|
appendFileSync(BINDING_AUDIT, JSON.stringify({ ts: new Date().toISOString(), source: 'pre-tool-gate', ...record }) + '\n');
|
|
196
|
-
} catch {
|
|
262
|
+
} catch (err) {
|
|
263
|
+
// M0.H.X3: binding-audit write failure now surfaces. Loss of binding
|
|
264
|
+
// audit entries means operator can't reconstruct phase-aware action
|
|
265
|
+
// enforcement decisions; surface visibly.
|
|
266
|
+
process.stderr.write(`[aria-pre-tool-gate:binding-audit-write] caught: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
267
|
+
}
|
|
197
268
|
}
|
|
198
269
|
|
|
199
270
|
function activePlanPath(sid) {
|
|
@@ -241,17 +312,34 @@ function loadActivePlan(sid) {
|
|
|
241
312
|
if (plan.mintedAt) {
|
|
242
313
|
const mintedMs = Date.parse(plan.mintedAt);
|
|
243
314
|
if (Number.isFinite(mintedMs) && (Date.now() - mintedMs) > PLAN_MAX_AGE_MS) {
|
|
315
|
+
// M0.H.X7 (2026-05-06) — explicit stale-plan surface. Prior audit
|
|
316
|
+
// event was a generic discard log; operator now sees the explicit
|
|
317
|
+
// [BINDING_STALE_PLAN] marker via stderr AND audit ledger so
|
|
318
|
+
// staleness is observable separately from session-mismatch
|
|
319
|
+
// discards. Behavior unchanged: stale plan returns null, the
|
|
320
|
+
// downstream architect-fallback fires, and if THAT fails the
|
|
321
|
+
// gate blocks (already fail-CLOSED). What changes here: visibility
|
|
322
|
+
// of operator-intent loss (the plan named WHAT operator wanted;
|
|
323
|
+
// staleness means that intent is being discarded).
|
|
324
|
+
const ageHours = ((Date.now() - mintedMs) / 3600000).toFixed(1);
|
|
244
325
|
bindingAuditAppend({
|
|
245
326
|
event: 'discard_plan_stale_by_mintedAt',
|
|
327
|
+
marker: 'BINDING_STALE_PLAN',
|
|
246
328
|
planId: plan.planId,
|
|
247
329
|
mintedAt: plan.mintedAt,
|
|
248
|
-
ageHours
|
|
330
|
+
ageHours,
|
|
331
|
+
allowedActionsCount: Array.isArray(plan.allowedActions) ? plan.allowedActions.length : 0,
|
|
332
|
+
forbiddenActionsCount: Array.isArray(plan.forbiddenActions) ? plan.forbiddenActions.length : 0,
|
|
249
333
|
});
|
|
334
|
+
process.stderr.write(`[aria-pre-tool-gate:BINDING_STALE_PLAN] plan ${plan.planId} aged ${ageHours}h > ${PLAN_MAX_AGE_MS / 3600000}h cap; operator-intent (allowed=${Array.isArray(plan.allowedActions) ? plan.allowedActions.length : 0}, forbidden=${Array.isArray(plan.forbiddenActions) ? plan.forbiddenActions.length : 0}) discarded; architect-fallback will fire to mint fresh plan\n`);
|
|
250
335
|
return null;
|
|
251
336
|
}
|
|
252
337
|
}
|
|
253
338
|
return plan;
|
|
254
|
-
} catch {
|
|
339
|
+
} catch (err) {
|
|
340
|
+
// M0.H.X7 — surface plan parse failures to stderr so operator sees
|
|
341
|
+
// when plan files are corrupted (was silent return null).
|
|
342
|
+
process.stderr.write(`[aria-pre-tool-gate:loadActivePlan] caught: ${err instanceof Error ? err.message : String(err)} (path=${p})\n`);
|
|
255
343
|
return null;
|
|
256
344
|
}
|
|
257
345
|
}
|
|
@@ -780,7 +868,12 @@ function collectRecentRealUserText(event, transcriptPath, limit = 6) {
|
|
|
780
868
|
if (Array.isArray(content) && content.length > 0 && content.every((block) => block && block.type === 'tool_result')) continue;
|
|
781
869
|
pushText(extractTextForUserCorrection(content));
|
|
782
870
|
}
|
|
783
|
-
} catch {
|
|
871
|
+
} catch (err) {
|
|
872
|
+
// M0.H.X3: per-transcript-file read failure (multi-transcript loop)
|
|
873
|
+
// now surfaces. Helps operator notice if user-correction extraction
|
|
874
|
+
// is degraded due to transcript file corruption / missing files.
|
|
875
|
+
process.stderr.write(`[aria-pre-tool-gate:user-correction-transcript-read] caught: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
876
|
+
}
|
|
784
877
|
}
|
|
785
878
|
return texts.join('\n\n');
|
|
786
879
|
}
|
|
@@ -790,7 +883,17 @@ function userCorrectionBlocksCommand(userText, command) {
|
|
|
790
883
|
const cmd = String(command || '');
|
|
791
884
|
if (!text || !cmd) return null;
|
|
792
885
|
const k8sMutation = /\bkubectl\s+(?:apply|delete|set\s+image|patch|replace|create|scale|rollout\s+(?:restart|undo))\b|scripts\/deploy-|\bdocker\s+push\b/i.test(cmd);
|
|
793
|
-
|
|
886
|
+
// Tightened 2026-05-05: prior regex (`stop|don't|...` within 160 chars of
|
|
887
|
+
// `deploy|kubectl|...`) hard-blocked legitimate ops because conversational
|
|
888
|
+
// steering language ("don't fish around", "skip the manifest hunt") trips
|
|
889
|
+
// it. New form requires the negation token to DIRECTLY MODIFY a stop-target
|
|
890
|
+
// verb (within ~3 words, optional article + adverb), and the target must
|
|
891
|
+
// come from a tighter whitelist (deploying/restart/rollout/etc) — generic
|
|
892
|
+
// words like "command" and "pods" no longer count alone.
|
|
893
|
+
// The structural fix is the AUTHORIZE: marker bypass (see owner-authorizations.mjs)
|
|
894
|
+
// applied at the call site BEFORE this regex runs; this tightening is
|
|
895
|
+
// defense-in-depth.
|
|
896
|
+
const explicitStop = /\b(?:stop|do\s+not|don't|quit|cease|abort|halt|cancel)\s+(?:the\s+)?(?:current\s+)?(?:deploy(?:ing|ment)?|redeploy(?:ing|ment)?|restart(?:ing)?|rollout|rolling\s+(?:back|out)|kubectl|bake|push|build|update|change|patch|apply|exec|set\s+image)\b/i.test(text);
|
|
794
897
|
if (explicitStop && k8sMutation) return 'recent user explicitly told the agent to stop deploy/restart command attempts';
|
|
795
898
|
const macTargetInCommand = /\bmlx-mac\b|\bdeployment\/mlx-mac|\bdeploy(?:ment)?\s+mlx-mac/i.test(cmd);
|
|
796
899
|
const macContradiction = /\b(?:mac\s+lanes?|mac\s+pods?|mlx-mac)\b[\s\S]{0,140}\b(?:not\s+pods?|no\s+such\s+thing|non[-\s]?existent|do(?:es)?\s+not\s+exist|don't\s+exist)\b|\b(?:no\s+such\s+thing|non[-\s]?existent|do(?:es)?\s+not\s+exist|don't\s+exist)\b[\s\S]{0,140}\b(?:mac\s+lanes?|mac\s+pods?|mlx-mac|pods?)\b/i.test(text);
|
|
@@ -1047,9 +1150,30 @@ for await (const chunk of process.stdin) input += chunk;
|
|
|
1047
1150
|
let event;
|
|
1048
1151
|
try {
|
|
1049
1152
|
event = JSON.parse(input);
|
|
1050
|
-
} catch {
|
|
1051
|
-
|
|
1052
|
-
|
|
1153
|
+
} catch (parseErr) {
|
|
1154
|
+
// M0.H.X2 (2026-05-06) — Phase 0 audit Cluster H finding M0.H.2 (CRITICAL):
|
|
1155
|
+
// previous fail-open on malformed input let destructive commands through
|
|
1156
|
+
// the gate when event JSON was corrupted. The gate's job is safety; the
|
|
1157
|
+
// safe direction on parser failure is to BLOCK, not allow. Surfaces the
|
|
1158
|
+
// parse error to stderr for operator visibility and emits a structured
|
|
1159
|
+
// block decision instead of exit-0.
|
|
1160
|
+
process.stderr.write(`[aria-pre-tool-gate] event JSON parse failed (${parseErr instanceof Error ? parseErr.message : String(parseErr)}); failing-CLOSED per M0.H.X2\n`);
|
|
1161
|
+
audit('block-parse-error', 'stdin not JSON; fail-CLOSED per M0.H.X2');
|
|
1162
|
+
console.log(JSON.stringify({
|
|
1163
|
+
decision: 'block',
|
|
1164
|
+
reason: [
|
|
1165
|
+
'=== ARIA PRE-TOOL-GATE BLOCK ===',
|
|
1166
|
+
'',
|
|
1167
|
+
'Hook received malformed event JSON on stdin. Per Phase 0 audit',
|
|
1168
|
+
'integrity-stack remediation M0.H.X2, the gate fails-CLOSED on',
|
|
1169
|
+
`parser failure for safety (was previously fail-open). Parse error: ${parseErr instanceof Error ? parseErr.message : String(parseErr)}`,
|
|
1170
|
+
'',
|
|
1171
|
+
'Recovery: re-invoke the tool with a well-formed event payload.',
|
|
1172
|
+
'If this fires repeatedly, inspect the surface that emits the event',
|
|
1173
|
+
'and log the raw stdin for diagnosis.',
|
|
1174
|
+
].join('\n'),
|
|
1175
|
+
}));
|
|
1176
|
+
process.exit(2);
|
|
1053
1177
|
}
|
|
1054
1178
|
const emergencyGateOff = emergencyGateOffDecision(event);
|
|
1055
1179
|
if (emergencyGateOff.off) {
|
|
@@ -1062,53 +1186,57 @@ const toolInput = event.tool_input ?? event.toolInput ?? {};
|
|
|
1062
1186
|
|
|
1063
1187
|
// Coach Kernel routing — single source of truth, run before all hook-native checks.
|
|
1064
1188
|
try {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1189
|
+
if (remoteRuntimeCoachEnabled()) {
|
|
1190
|
+
const _coachUrl = `${HOME}/.aria/runtime/runtime.env`;
|
|
1191
|
+
const _coachBase = existsSync(_coachUrl)
|
|
1192
|
+
? String(readFileSync(_coachUrl, 'utf8')).match(/ARIA_RUNTIME_URL=(http:\/\/[^ \n]+)/)?.[1] || 'http://127.0.0.1:4319'
|
|
1193
|
+
: 'http://127.0.0.1:4319';
|
|
1194
|
+
const _coachToken = (() => {
|
|
1195
|
+
const tp = `${HOME}/.aria/owner-token`;
|
|
1196
|
+
if (existsSync(tp)) return readFileSync(tp, 'utf8').trim();
|
|
1197
|
+
const lp = `${HOME}/.aria/license.json`;
|
|
1198
|
+
if (existsSync(lp)) {
|
|
1199
|
+
try { const lt = JSON.parse(readFileSync(lp, 'utf8')); return lt.token || lt.harnessToken || ''; } catch { return ''; }
|
|
1200
|
+
}
|
|
1201
|
+
return process.env.ARIA_API_KEY || process.env.ARIA_MASTER_TOKEN || '';
|
|
1202
|
+
})();
|
|
1203
|
+
const _coachHeaders = { 'Content-Type': 'application/json' };
|
|
1204
|
+
if (_coachToken) _coachHeaders.Authorization = `Bearer ${_coachToken}`;
|
|
1205
|
+
const _cmd = String(toolInput?.command || '');
|
|
1206
|
+
const _coachPayload = {
|
|
1207
|
+
phase: 'pre_tool',
|
|
1208
|
+
requestId: `claude-pre-tool:${Date.now()}`,
|
|
1209
|
+
sessionId: String(toolInput?.session_id || process.env.HOOK_SESSION_ID || 'claude-unknown').slice(0, 80),
|
|
1210
|
+
surface: 'claude-hooks',
|
|
1211
|
+
lane: 'claude_native_hooks',
|
|
1212
|
+
action: (() => {
|
|
1213
|
+
const t = _cmd.toLowerCase();
|
|
1214
|
+
if (/\b(?:kubectl\s+(?:apply|set|rollout|delete|create|replace|scale)|helm\s+(?:upgrade|install|uninstall)|terraform\s+(?:apply|destroy)|docker\s+(?:push|build\s+.*--push)|deploy)\b/i.test(t)) return 'deploy';
|
|
1215
|
+
if (/\b(?:rm\s+-[rRfF]+\S*|sudo\s+|systemctl\s+(?:stop|disable|mask|kill)|kill\s+-[9K]|pkill\s+-[9K]|chmod\s+777|git\s+(?:push\s+--force|reset\s+--hard)|docker\s+rm\s+-f)\b/i.test(t)) return 'delete';
|
|
1216
|
+
return '';
|
|
1217
|
+
})(),
|
|
1218
|
+
target: JSON.stringify(toolInput).slice(0, 2000),
|
|
1219
|
+
text: _cmd.slice(0, 1000),
|
|
1220
|
+
metadata: { source: 'claude-pre-tool-gate', toolName },
|
|
1221
|
+
};
|
|
1222
|
+
const _coachResp = await fetch(`${_coachBase}/coach/phase`, {
|
|
1223
|
+
method: 'POST', headers: _coachHeaders, body: JSON.stringify(_coachPayload),
|
|
1224
|
+
signal: AbortSignal.timeout(2000),
|
|
1225
|
+
});
|
|
1226
|
+
if (_coachResp.ok) {
|
|
1227
|
+
const _coachBody = await _coachResp.json();
|
|
1228
|
+
if (_coachBody?.permitted === false && _coachBody?.decision === 'hard_block') {
|
|
1229
|
+
audit('block-coach-authoritative', `reasons=${(_coachBody.reasons||[]).join(',')}`);
|
|
1230
|
+
console.log(JSON.stringify({
|
|
1231
|
+
decision: 'block',
|
|
1232
|
+
reason: ['Aria Coach blocked this action before execution.', '', `Reason: ${(_coachBody.reasons||['coach_policy']).slice(0,3).join('; ')}`, '', _coachBody.clientMessage || 'Remove the high-risk condition and retry.'].join('\n'),
|
|
1233
|
+
hookSpecificOutput: { hookEventName: 'PreToolUse', coach_decision: _coachBody.decision, coach_reasons: _coachBody.reasons },
|
|
1234
|
+
}));
|
|
1235
|
+
process.exit(2);
|
|
1236
|
+
}
|
|
1111
1237
|
}
|
|
1238
|
+
} else {
|
|
1239
|
+
audit('skip-remote-runtime-coach', 'source=pre-tool-gate phase=pre_tool');
|
|
1112
1240
|
}
|
|
1113
1241
|
} catch { /* Coach unreachable — fall through to hook-native checks */ }
|
|
1114
1242
|
|
|
@@ -1137,16 +1265,57 @@ const cmdPreview = toolName === 'Bash'
|
|
|
1137
1265
|
|
|
1138
1266
|
if (toolName === 'Bash') {
|
|
1139
1267
|
const recentUserText = collectRecentRealUserText(event, transcriptPath);
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1268
|
+
// 2026-05-05 — owner-authorizations layer (M2.13 staircase). Before the
|
|
1269
|
+
// user-correction regex runs, scan recent user text for AUTHORIZE: markers
|
|
1270
|
+
// and write any new grants. Then check for an active grant matching this
|
|
1271
|
+
// cmd. If found, skip the regex hard-block (still runs other gates below).
|
|
1272
|
+
// This converts the gate from "infer authorization from negation tokens"
|
|
1273
|
+
// (heuristic, prone to false positives on steering language) to "consult
|
|
1274
|
+
// explicit operator grants first" (structural).
|
|
1275
|
+
let ownerAuth = { authorized: false, grant: null, grantsWritten: 0 };
|
|
1276
|
+
try {
|
|
1277
|
+
ownerAuth = checkAndAuthorize(cmd, event?.session_id || 'unknown', recentUserText);
|
|
1278
|
+
} catch (authErr) {
|
|
1279
|
+
process.stderr.write(
|
|
1280
|
+
`[pre-tool-gate] owner-authorizations lookup failed: ${authErr instanceof Error ? authErr.message : String(authErr)}\n`,
|
|
1281
|
+
);
|
|
1282
|
+
}
|
|
1283
|
+
if (ownerAuth.authorized) {
|
|
1284
|
+
audit(`allow-owner-grant pattern=${ownerAuth.grant?.commandPattern?.slice(0, 60) || '(?)'}`, cmdPreview);
|
|
1285
|
+
// Grant is multi-use within TTL by default; uncomment to one-shot:
|
|
1286
|
+
// try { consumeGrant(ownerAuth.grant); } catch {}
|
|
1287
|
+
// Skip the user-correction regex; continue to other gates below.
|
|
1288
|
+
} else {
|
|
1289
|
+
const correctionBlockReason = userCorrectionBlocksCommand(recentUserText, cmd);
|
|
1290
|
+
if (correctionBlockReason) {
|
|
1291
|
+
const reason = `Aria pre-tool gate: USER-CORRECTION hard-block.
|
|
1143
1292
|
|
|
1144
1293
|
${correctionBlockReason}.
|
|
1145
1294
|
|
|
1146
|
-
The next assistant response must stop the command loop, quote the user's correction in one sentence, and re-evaluate the target from substrate before any further mutation. Do not retry this Bash command shape
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1295
|
+
The next assistant response must stop the command loop, quote the user's correction in one sentence, and re-evaluate the target from substrate before any further mutation. Do not retry this Bash command shape.
|
|
1296
|
+
|
|
1297
|
+
To override: operator writes "AUTHORIZE: <command-shape>" in a fresh user message. The shape can be a substring (matches if cmd contains it) or a regex (/pattern/[i]). Grant is valid for 15 minutes from issuance.`;
|
|
1298
|
+
audit('block-user-correction-override', cmdPreview);
|
|
1299
|
+
emitBlock(reason, { source: 'pre-tool/user-correction' });
|
|
1300
|
+
process.exit(2);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
if (toolName === 'Bash') {
|
|
1306
|
+
// AI-11803-F4 (2026-05-12): no_timeouts_decision_tree_rule enforcement.
|
|
1307
|
+
// Detects shell-position `timeout N` wrappers; warns 1st-2nd occurrence
|
|
1308
|
+
// in session, hard-blocks at 3+. Bypass via ARIA_PROBE_DISCIPLINE_BYPASS=1
|
|
1309
|
+
// (logged loud to discovery ledger so hardening worker accumulates pattern).
|
|
1310
|
+
try {
|
|
1311
|
+
const probeDisc = scanProbeDiscipline(cmd, event?.session_id || 'unknown');
|
|
1312
|
+
if (probeDisc.blocked) {
|
|
1313
|
+
audit(`block-probe-discipline sessionCount=${probeDisc.sessionCount} matches=${(probeDisc.matchCount)}`, cmdPreview);
|
|
1314
|
+
emitBlock(probeDisc.blockReason, { source: 'pre-tool/probe-discipline' });
|
|
1315
|
+
process.exit(2);
|
|
1316
|
+
}
|
|
1317
|
+
} catch (pdErr) {
|
|
1318
|
+
process.stderr.write(`[pre-tool-gate:probe-discipline-error] ${pdErr instanceof Error ? pdErr.message : String(pdErr)}\n`);
|
|
1150
1319
|
}
|
|
1151
1320
|
}
|
|
1152
1321
|
|
|
@@ -1270,16 +1439,19 @@ if (transcriptPath && existsSync(transcriptPath)) {
|
|
|
1270
1439
|
const role = normalizeRole(m);
|
|
1271
1440
|
const content = normalizeContent(m);
|
|
1272
1441
|
if (role === 'user') {
|
|
1273
|
-
//
|
|
1274
|
-
//
|
|
1275
|
-
//
|
|
1276
|
-
//
|
|
1277
|
-
//
|
|
1278
|
-
//
|
|
1279
|
-
|
|
1280
|
-
//
|
|
1281
|
-
|
|
1282
|
-
if (
|
|
1442
|
+
// M9.DRIFT.10r — opt-IN classifier replaces opt-OUT two-step.
|
|
1443
|
+
// Mixed-content user messages (tool_result + system-reminder
|
|
1444
|
+
// + small noise text — the modern Claude Code transcript shape
|
|
1445
|
+
// for runtime injections after a tool call) used to defeat
|
|
1446
|
+
// both isToolResultOnlyContent (not exclusively tool_result)
|
|
1447
|
+
// and isMostlySystemReminder (text portion below threshold),
|
|
1448
|
+
// getting counted as user-boundaries and evicting cognition
|
|
1449
|
+
// from the lookback window. isUserAuthoredMessage opts IN to
|
|
1450
|
+
// identifiable user voice; conservative on uncertainty.
|
|
1451
|
+
if (!isUserAuthoredMessage(content, {
|
|
1452
|
+
systemReminderRx: SYSTEM_REMINDER_RX,
|
|
1453
|
+
systemReminderThreshold: SYSTEM_REMINDER_THRESHOLD,
|
|
1454
|
+
})) continue;
|
|
1283
1455
|
userBoundariesCrossed++;
|
|
1284
1456
|
if (userBoundariesCrossed > USER_BOUNDARIES_TO_CROSS) break;
|
|
1285
1457
|
continue;
|
|
@@ -1292,9 +1464,16 @@ if (transcriptPath && existsSync(transcriptPath)) {
|
|
|
1292
1464
|
// used to be but are system-authored, not the model's voice.
|
|
1293
1465
|
if (COMPACT_SUMMARY_RX.test(text) && text.length > 4000) continue;
|
|
1294
1466
|
transcriptAssistantTexts.push(text);
|
|
1295
|
-
} catch {
|
|
1467
|
+
} catch (err) {
|
|
1468
|
+
// M0.H.X3: per-message parse failure during transcript walk now
|
|
1469
|
+
// surfaces. Loss here would mean missed assistant-cognition history.
|
|
1470
|
+
process.stderr.write(`[aria-pre-tool-gate:transcript-message-parse] caught: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1471
|
+
}
|
|
1296
1472
|
}
|
|
1297
|
-
} catch {
|
|
1473
|
+
} catch (err) {
|
|
1474
|
+
// M0.H.X3: outer transcript-read failure now surfaces.
|
|
1475
|
+
process.stderr.write(`[aria-pre-tool-gate:transcript-read] caught: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1476
|
+
}
|
|
1298
1477
|
}
|
|
1299
1478
|
appendAssistantTexts(transcriptAssistantTexts);
|
|
1300
1479
|
const currentTurnAssistantText = extractCurrentTurnAssistantText(event, toolInput);
|
|
@@ -1313,6 +1492,20 @@ const transcriptCog = detectCognitionLenses(unionText);
|
|
|
1313
1492
|
const mergedLensSet = new Set([...inlineCog.names, ...transcriptCog.names]);
|
|
1314
1493
|
const lensCount = mergedLensSet.size;
|
|
1315
1494
|
const lensNames = [...mergedLensSet];
|
|
1495
|
+
// M9.DRIFT.10u — diagnostic meta passed to emitBlock on lens-count
|
|
1496
|
+
// failure. emitBlock's stderr dump uses these to expose the parse
|
|
1497
|
+
// breakdown (per-lens table + unrecognized tokens + canonical sets +
|
|
1498
|
+
// transcript path + scan range) so the agent self-corrects in one
|
|
1499
|
+
// cycle instead of guess-and-retry.
|
|
1500
|
+
const cognitionDiagnosticMeta = {
|
|
1501
|
+
inlineCogDiagnostic: eventCog,
|
|
1502
|
+
transcriptCogDiagnostic: transcriptCog,
|
|
1503
|
+
transcriptPath: transcriptPath || null,
|
|
1504
|
+
messagesScanned: transcriptAssistantTexts.length + eventAssistantTexts.length,
|
|
1505
|
+
transcriptScanRange: transcriptPath
|
|
1506
|
+
? `transcript=${transcriptAssistantTexts.length} assistant turns; event=${eventAssistantTexts.length}`
|
|
1507
|
+
: `event-only=${eventAssistantTexts.length} assistant turns (no transcript path)`,
|
|
1508
|
+
};
|
|
1316
1509
|
const cogBlockBody = transcriptCog.blockBody;
|
|
1317
1510
|
const inlineVerifyBody = extractInlineDirectiveBody(cmd, INLINE_VERIFY_LINE_RX);
|
|
1318
1511
|
const verifyBodies = [...unionText.matchAll(/<verify>([\s\S]*?)<\/verify>/gi)]
|
|
@@ -1369,6 +1562,76 @@ const sessionId =
|
|
|
1369
1562
|
(transcriptPath ? transcriptPath.split('/').pop()?.replace(/\.[^.]+$/, '') : null) ??
|
|
1370
1563
|
'claude-code-unknown';
|
|
1371
1564
|
|
|
1565
|
+
let preToolManifestSlot = null;
|
|
1566
|
+
let preToolManifestWorkflowSkills = [];
|
|
1567
|
+
try {
|
|
1568
|
+
preToolManifestSlot = extractManifest(unionText);
|
|
1569
|
+
preToolManifestWorkflowSkills = preToolManifestSlot ? manifestSkillsToInvoke(preToolManifestSlot.manifest) : [];
|
|
1570
|
+
} catch (err) {
|
|
1571
|
+
process.stderr.write(`[aria-pre-tool-gate:manifest-error] ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
// Atlas dossier wire (Phase 1 — corpus-to-runtime auto-trigger).
|
|
1575
|
+
// When the tool targets a known file, ask Atlas which skills govern it.
|
|
1576
|
+
// The dossier surfaces verified per-file GOVERNS edges produced by the
|
|
1577
|
+
// cognitive extractor (skill bodies that reference this file path or
|
|
1578
|
+
// basename). These augment — never replace — the classifier output, so
|
|
1579
|
+
// intent-shape triggers AND file-bound triggers both fire.
|
|
1580
|
+
//
|
|
1581
|
+
// Fail-open semantics: any socket error, Atlas-down, or timeout returns []
|
|
1582
|
+
// and the gate behaves exactly as it did before this wire. The classifier
|
|
1583
|
+
// still drives the dominant required-skills decision.
|
|
1584
|
+
let dossierGoverningSkills = [];
|
|
1585
|
+
if (filePath && typeof filePath === 'string' && filePath.trim()) {
|
|
1586
|
+
try {
|
|
1587
|
+
dossierGoverningSkills = await fetchGoverningSkills(filePath);
|
|
1588
|
+
} catch (err) {
|
|
1589
|
+
process.stderr.write(`[aria-pre-tool-gate:atlas-dossier-error] ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
// A5 (2026-05-18) — intra-turn kernel selection. Build a tool-class
|
|
1594
|
+
// observation (Edit/Write/NotebookEdit → 'edit'; Bash with deploy match →
|
|
1595
|
+
// 'deploy'; everything else → 'default') and ask the kernel for selected
|
|
1596
|
+
// skills. Atlas-orchestrator's intra-turn surface is this call: per-tool
|
|
1597
|
+
// observation → kernel taxonomy → selected skills enforced as floor.
|
|
1598
|
+
let atlasIntraSelection = { selectedSkillIds: [], selectedRuntimeIds: [], compilation_hash: null };
|
|
1599
|
+
try {
|
|
1600
|
+
const toolObservationKind = (() => {
|
|
1601
|
+
if (toolName === 'Edit' || toolName === 'Write' || toolName === 'NotebookEdit') return 'edit';
|
|
1602
|
+
if (toolName === 'Bash' && deployMatched) return 'deploy';
|
|
1603
|
+
return 'default';
|
|
1604
|
+
})();
|
|
1605
|
+
const kernelCompilation = kernelCompileCognitiveOptions({
|
|
1606
|
+
kind: toolObservationKind,
|
|
1607
|
+
source: 'aria-pre-tool-gate',
|
|
1608
|
+
summary: `intra-turn tool ${toolName} selection`,
|
|
1609
|
+
attrs: {
|
|
1610
|
+
surface: 'claude-pre-tool-gate',
|
|
1611
|
+
toolName,
|
|
1612
|
+
filePath: filePath || null,
|
|
1613
|
+
isDeploy: Boolean(deployMatched),
|
|
1614
|
+
dossierGoverningCount: dossierGoverningSkills.length,
|
|
1615
|
+
},
|
|
1616
|
+
});
|
|
1617
|
+
atlasIntraSelection = {
|
|
1618
|
+
selectedSkillIds: Array.isArray(kernelCompilation?.selectedSkillIds) ? kernelCompilation.selectedSkillIds : [],
|
|
1619
|
+
selectedRuntimeIds: Array.isArray(kernelCompilation?.selectedRuntimeIds) ? kernelCompilation.selectedRuntimeIds : [],
|
|
1620
|
+
compilation_hash: kernelCompilation?.compilation_hash || null,
|
|
1621
|
+
observationKind: toolObservationKind,
|
|
1622
|
+
};
|
|
1623
|
+
process.stderr.write(`[aria-pre-tool-gate:atlas-intra-selection] tool=${toolName} kind=${toolObservationKind} selected=${atlasIntraSelection.selectedSkillIds.length} runtimes=${atlasIntraSelection.selectedRuntimeIds.length} hash=${(atlasIntraSelection.compilation_hash || '').slice(0, 12)}\n`);
|
|
1624
|
+
} catch (err) {
|
|
1625
|
+
process.stderr.write(`[aria-pre-tool-gate:atlas-intra-selection-fallback] LOUD-fail err=${err instanceof Error ? err.message : String(err)} — gate continues with dossier-only additional skills\n`);
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
// Union dossier + kernel-selected for the skill-gate floor. The skill gate
|
|
1629
|
+
// dedupes internally; we pass the merged list.
|
|
1630
|
+
const additionalRequiredSkills = [...new Set([
|
|
1631
|
+
...dossierGoverningSkills,
|
|
1632
|
+
...atlasIntraSelection.selectedSkillIds,
|
|
1633
|
+
])];
|
|
1634
|
+
|
|
1372
1635
|
const skillGate = evaluateSkillGate({
|
|
1373
1636
|
sessionId,
|
|
1374
1637
|
surface: 'claude-pre-tool-gate',
|
|
@@ -1379,11 +1642,14 @@ const skillGate = evaluateSkillGate({
|
|
|
1379
1642
|
isDeploy: Boolean(deployMatched),
|
|
1380
1643
|
isMutation: toolName !== 'Bash',
|
|
1381
1644
|
autoLoadAvailable: false,
|
|
1645
|
+
requiredSkillsOverride: preToolManifestSlot ? preToolManifestWorkflowSkills : undefined,
|
|
1646
|
+
requiredSkillsReason: 'orchestration manifest intent.workflow_skills_to_invoke supplied pre-tool workflows',
|
|
1647
|
+
additionalRequiredSkills,
|
|
1382
1648
|
});
|
|
1383
1649
|
if (!skillGate.ok && !skillGate.redirectOnly) {
|
|
1384
1650
|
const reason = formatSkillGateBlock(skillGate);
|
|
1385
1651
|
audit('block-missing-skill-receipt', `${skillGate.missingSkills.join(',')} ${cmdPreview}`);
|
|
1386
|
-
emitBlock(reason, { source: 'pre-tool/skill-autoload', tool: toolName, lensCount, requiredLenses: REQUIRED_LENSES });
|
|
1652
|
+
emitBlock(reason, { source: 'pre-tool/skill-autoload', tool: toolName, lensCount, requiredLenses: REQUIRED_LENSES, ...cognitionDiagnosticMeta });
|
|
1387
1653
|
process.exit(2);
|
|
1388
1654
|
}
|
|
1389
1655
|
try {
|
|
@@ -1404,6 +1670,9 @@ try {
|
|
|
1404
1670
|
audit('signal-gov-gate-block', `reason=${(govGateResult.reason || '').slice(0, 120)}`);
|
|
1405
1671
|
const _cmd = String(toolInput?.command || '');
|
|
1406
1672
|
try {
|
|
1673
|
+
if (!remoteRuntimeCoachEnabled()) {
|
|
1674
|
+
audit('skip-remote-runtime-coach', 'source=pre-tool-gate-after-gov-gate phase=pre_tool');
|
|
1675
|
+
} else {
|
|
1407
1676
|
const _coachUrl = `${HOME}/.aria/runtime/runtime.env`;
|
|
1408
1677
|
const _coachBase = existsSync(_coachUrl)
|
|
1409
1678
|
? String(readFileSync(_coachUrl, 'utf8')).match(/ARIA_RUNTIME_URL=(http:\/\/[^ \n]+)/)?.[1] || 'http://127.0.0.1:4319'
|
|
@@ -1435,11 +1704,17 @@ try {
|
|
|
1435
1704
|
process.exit(2);
|
|
1436
1705
|
}
|
|
1437
1706
|
}
|
|
1438
|
-
|
|
1707
|
+
}
|
|
1708
|
+
} catch (err) {
|
|
1709
|
+
// M0.H.X3: coach-after-gov-gate failure now surfaces. Outer try/catch
|
|
1710
|
+
// at line 1533 still catches; this stderr surface adds operator-
|
|
1711
|
+
// visibility to the inner coach-call failure mode.
|
|
1712
|
+
process.stderr.write(`[aria-pre-tool-gate:coach-after-gov-gate] caught: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1713
|
+
}
|
|
1439
1714
|
}
|
|
1440
1715
|
} catch (err) {
|
|
1441
1716
|
audit('block-universal-governance', `${err instanceof Error ? err.message : String(err)}`.slice(0, 500));
|
|
1442
|
-
emitBlock(err instanceof Error ? err.message : String(err), { source: 'pre-tool/universal-governance', tool: toolName, lensCount, requiredLenses: REQUIRED_LENSES });
|
|
1717
|
+
emitBlock(err instanceof Error ? err.message : String(err), { source: 'pre-tool/universal-governance', tool: toolName, lensCount, requiredLenses: REQUIRED_LENSES, ...cognitionDiagnosticMeta });
|
|
1443
1718
|
process.exit(2);
|
|
1444
1719
|
}
|
|
1445
1720
|
|
|
@@ -1525,6 +1800,58 @@ function buildForceRedoActionReason(reasonText, { source = 'pre-tool-gate', tool
|
|
|
1525
1800
|
|
|
1526
1801
|
function emitBlock(reasonText, meta = {}) {
|
|
1527
1802
|
console.log(JSON.stringify({ decision: 'block', reason: buildForceRedoActionReason(reasonText, meta) }));
|
|
1803
|
+
// M9.DRIFT.10u — diagnostic-first observability for cognition-window
|
|
1804
|
+
// failures. When the gate blocks for a lens-count reason, dump the
|
|
1805
|
+
// full parser breakdown to stderr (operator-visible only) so the
|
|
1806
|
+
// agent can self-correct in one cycle instead of guess-and-retry.
|
|
1807
|
+
// Only fires when caller passed lens-failure context in meta.
|
|
1808
|
+
if (meta && (meta.inlineCogDiagnostic || meta.transcriptCogDiagnostic)) {
|
|
1809
|
+
try {
|
|
1810
|
+
const lines = ['=== M9.DRIFT.10u DIAGNOSTIC ==='];
|
|
1811
|
+
lines.push(`transcript_path: ${meta.transcriptPath || 'null (no transcript walked)'}`);
|
|
1812
|
+
if (meta.messagesScanned !== undefined) {
|
|
1813
|
+
lines.push(`messages_scanned: ${meta.messagesScanned}`);
|
|
1814
|
+
}
|
|
1815
|
+
if (meta.transcriptScanRange) {
|
|
1816
|
+
lines.push(`transcript_scan_range: ${meta.transcriptScanRange}`);
|
|
1817
|
+
}
|
|
1818
|
+
lines.push(`required_lenses: ${meta.requiredLenses ?? '(unset)'} ; observed_total: ${meta.lensCount ?? '(unset)'}`);
|
|
1819
|
+
const renderDiag = (label, diag) => {
|
|
1820
|
+
if (!diag) return;
|
|
1821
|
+
lines.push('');
|
|
1822
|
+
lines.push(`--- ${label} ---`);
|
|
1823
|
+
lines.push(`block_found: ${diag.blockFound === true ? 'yes' : 'no'}`);
|
|
1824
|
+
lines.push(`matched_canonical_set: ${diag.matchedSet ? 'yes (all 8 of one canonical set present)' : 'no'}`);
|
|
1825
|
+
lines.push(`canonical_sets:`);
|
|
1826
|
+
if (diag.canonicalSets) {
|
|
1827
|
+
lines.push(` older: ${(diag.canonicalSets.older || []).join(', ')}`);
|
|
1828
|
+
lines.push(` newer: ${(diag.canonicalSets.newer || []).join(', ')}`);
|
|
1829
|
+
}
|
|
1830
|
+
if (Array.isArray(diag.perLens) && diag.perLens.length > 0) {
|
|
1831
|
+
lines.push(`per_lens:`);
|
|
1832
|
+
for (const row of diag.perLens) {
|
|
1833
|
+
const status = row.present ? 'PRESENT' : 'absent';
|
|
1834
|
+
lines.push(` ${row.lens.padEnd(12)} ${status.padEnd(8)} chars=${row.charCount}` +
|
|
1835
|
+
(row.content_preview ? ` preview="${row.content_preview}"` : ''));
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
if (Array.isArray(diag.unrecognizedTokens) && diag.unrecognizedTokens.length > 0) {
|
|
1839
|
+
lines.push(`unrecognized_tokens (look like lens labels but NOT in any canonical set):`);
|
|
1840
|
+
lines.push(` ${diag.unrecognizedTokens.join(', ')}`);
|
|
1841
|
+
lines.push(` ^^ if these are lens names you intended, the canonical sets above`);
|
|
1842
|
+
lines.push(` don't include them. Either rename to canonical OR widen the`);
|
|
1843
|
+
lines.push(` allowlist via M9.DRIFT.10v after operator review.`);
|
|
1844
|
+
}
|
|
1845
|
+
};
|
|
1846
|
+
renderDiag('inline (current turn)', meta.inlineCogDiagnostic);
|
|
1847
|
+
renderDiag('transcript (recent assistant turns)', meta.transcriptCogDiagnostic);
|
|
1848
|
+
lines.push('=== END M9.DRIFT.10u DIAGNOSTIC ===');
|
|
1849
|
+
process.stderr.write(lines.join('\n') + '\n');
|
|
1850
|
+
} catch (err) {
|
|
1851
|
+
// Diagnostic dump must never break the gate. Fail-loud to stderr.
|
|
1852
|
+
process.stderr.write(`[m9-drift-10u:diagnostic-dump-failed] ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1528
1855
|
}
|
|
1529
1856
|
|
|
1530
1857
|
if (hasCognition && !appliedContract.ok) {
|
|
@@ -1543,7 +1870,7 @@ expected_predicate: <numeric, boolean, or state-string predicate proving success
|
|
|
1543
1870
|
artifact_change: <how the artifact/action is different because cognition ran>`;
|
|
1544
1871
|
audit('block-applied-cognition-contract', cmdPreview);
|
|
1545
1872
|
pushDecision('block', `applied cognition contract missing: ${appliedContract.violations.join(', ')}`);
|
|
1546
|
-
emitBlock(reason, { source: 'pre-tool/applied-cognition-contract', tool: toolName, lensCount, requiredLenses: REQUIRED_LENSES });
|
|
1873
|
+
emitBlock(reason, { source: 'pre-tool/applied-cognition-contract', tool: toolName, lensCount, requiredLenses: REQUIRED_LENSES, ...cognitionDiagnosticMeta });
|
|
1547
1874
|
process.exit(2);
|
|
1548
1875
|
}
|
|
1549
1876
|
|
|
@@ -1578,7 +1905,12 @@ if (deployMatched) {
|
|
|
1578
1905
|
missingDeployFields, cogBlockBodyLen: (cogBlockBody || '').length,
|
|
1579
1906
|
verifyBodyLen: verifyBody.length,
|
|
1580
1907
|
}) + '\n');
|
|
1581
|
-
} catch {
|
|
1908
|
+
} catch (err) {
|
|
1909
|
+
// M0.H.X3: heartbeat write failure now surfaces. Heartbeat at deploy-
|
|
1910
|
+
// gate entry exists for crash-recovery diagnostics — silent loss
|
|
1911
|
+
// defeats its purpose.
|
|
1912
|
+
process.stderr.write(`[aria-pre-tool-gate:deploy-gate-entry-heartbeat] caught: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1913
|
+
}
|
|
1582
1914
|
|
|
1583
1915
|
const deployBlocked =
|
|
1584
1916
|
!hasVerify ||
|
|
@@ -1794,7 +2126,7 @@ No per-tool bypass available (v3 doctrine — the harness's whole purpose is no
|
|
|
1794
2126
|
|
|
1795
2127
|
audit(`block ${toolName.toLowerCase()} cognition=${lensCount}`, cmdPreview);
|
|
1796
2128
|
pushDecision('block', `${toolName.toLowerCase()} missing cognition (${lensCount}/${REQUIRED_LENSES})`);
|
|
1797
|
-
emitBlock(reason, { source: 'pre-tool/missing-cognition' });
|
|
2129
|
+
emitBlock(reason, { source: 'pre-tool/missing-cognition', tool: toolName, lensCount, requiredLenses: REQUIRED_LENSES, ...cognitionDiagnosticMeta });
|
|
1798
2130
|
process.exit(2);
|
|
1799
2131
|
}
|
|
1800
2132
|
|
|
@@ -2457,6 +2789,49 @@ The substrate's contract gate refused this action. Local doctrine gates passed (
|
|
|
2457
2789
|
return; // no conflict — proceed
|
|
2458
2790
|
}
|
|
2459
2791
|
|
|
2792
|
+
let _touchContext = { ok: false, touches: [], error: null };
|
|
2793
|
+
let _threadContext = { ok: false, threads: [], error: null };
|
|
2794
|
+
try {
|
|
2795
|
+
const _touchParams = new URLSearchParams({ file_path: _lockCheckPath, limit: '10' });
|
|
2796
|
+
const _touchResp = await fetch(`${_soulUrl}/api/hive/file-touch?${_touchParams}`, {
|
|
2797
|
+
method: 'GET',
|
|
2798
|
+
headers: {
|
|
2799
|
+
'Content-Type': 'application/json',
|
|
2800
|
+
...(_harnessToken ? { Authorization: `Bearer ${_harnessToken}` } : {}),
|
|
2801
|
+
},
|
|
2802
|
+
});
|
|
2803
|
+
if (_touchResp.ok) {
|
|
2804
|
+
const _touchData = await _touchResp.json();
|
|
2805
|
+
_touchContext = { ok: true, touches: Array.isArray(_touchData?.touches) ? _touchData.touches.slice(0, 10) : [], error: null };
|
|
2806
|
+
} else {
|
|
2807
|
+
_touchContext = { ok: false, touches: [], error: `HTTP ${_touchResp.status}` };
|
|
2808
|
+
}
|
|
2809
|
+
} catch (_touchErr) {
|
|
2810
|
+
_touchContext = { ok: false, touches: [], error: _touchErr instanceof Error ? _touchErr.message : String(_touchErr) };
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
try {
|
|
2814
|
+
const _threadIds = [...new Set(_touchContext.touches.map((touch) => touch.thread_id).filter(Boolean))].slice(0, 5);
|
|
2815
|
+
const _threads = [];
|
|
2816
|
+
for (const _threadId of _threadIds) {
|
|
2817
|
+
const _threadParams = new URLSearchParams({ thread_id: _threadId, limit: '5' });
|
|
2818
|
+
const _threadResp = await fetch(`${_soulUrl}/api/hive/session-thread?${_threadParams}`, {
|
|
2819
|
+
method: 'GET',
|
|
2820
|
+
headers: {
|
|
2821
|
+
'Content-Type': 'application/json',
|
|
2822
|
+
...(_harnessToken ? { Authorization: `Bearer ${_harnessToken}` } : {}),
|
|
2823
|
+
},
|
|
2824
|
+
});
|
|
2825
|
+
if (_threadResp.ok) {
|
|
2826
|
+
const _threadData = await _threadResp.json();
|
|
2827
|
+
if (Array.isArray(_threadData?.threads)) _threads.push(..._threadData.threads);
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
_threadContext = { ok: true, threads: _threads.slice(0, 10), error: null };
|
|
2831
|
+
} catch (_threadErr) {
|
|
2832
|
+
_threadContext = { ok: false, threads: [], error: _threadErr instanceof Error ? _threadErr.message : String(_threadErr) };
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2460
2835
|
// ── Auto-post coordination message to each conflicting session ───────────
|
|
2461
2836
|
// Per hive-session-coordination doctrine (memory:feedback_hive_session_coordination.md):
|
|
2462
2837
|
// when a lock conflict is detected, the gate AUTOMATICALLY posts a
|
|
@@ -2492,6 +2867,8 @@ The substrate's contract gate refused this action. Local doctrine gates passed (
|
|
|
2492
2867
|
locked_at: _conflict.locked_at ?? null,
|
|
2493
2868
|
expires_at: _conflict.expires_at ?? null,
|
|
2494
2869
|
},
|
|
2870
|
+
hive_file_touch_context: _touchContext,
|
|
2871
|
+
hive_thread_context: _threadContext,
|
|
2495
2872
|
};
|
|
2496
2873
|
const _msgResp = await fetch(`${_soulUrl}/api/hive/session-message`, {
|
|
2497
2874
|
method: 'POST',
|
|
@@ -2543,6 +2920,17 @@ The substrate's contract gate refused this action. Local doctrine gates passed (
|
|
|
2543
2920
|
? `\nAuto-coordination: gate posted lock_conflict_request message(s) to ${_autoMessageIds.map((m) => `session ${m.session_id} (msg: ${m.message_id})`).join(', ')}. They will see this inbound on their next turn via [HIVE_SESSION_INBOX].`
|
|
2544
2921
|
: '\nAuto-coordination message could not be delivered (see stderr). Coordinate manually via POST /api/hive/session-message.';
|
|
2545
2922
|
|
|
2923
|
+
const _recentTouchDetails = _touchContext.ok && _touchContext.touches.length > 0
|
|
2924
|
+
? _touchContext.touches.slice(0, 5).map((touch) => {
|
|
2925
|
+
const _files = Array.isArray(touch.files) ? touch.files.map((file) => `${file.path}:${file.intent || 'touch'}`).join(', ') : '';
|
|
2926
|
+
return ` - ${touch.created_at || 'unknown-time'} session=${touch.session_id || 'unknown'} thread=${touch.thread_id || 'none'} event=${touch.event || 'touch'} files=${_files}`;
|
|
2927
|
+
}).join('\n')
|
|
2928
|
+
: ` - unavailable or empty (${_touchContext.error || 'no recent touches'})`;
|
|
2929
|
+
|
|
2930
|
+
const _threadDetails = _threadContext.ok && _threadContext.threads.length > 0
|
|
2931
|
+
? _threadContext.threads.slice(0, 5).map((thread) => ` - ${thread.thread_id} topic=${thread.topic || 'none'} status=${thread.status || 'unknown'} participants=${Array.isArray(thread.participants) ? thread.participants.join(',') : 'none'}`).join('\n')
|
|
2932
|
+
: ` - unavailable or empty (${_threadContext.error || 'no thread context'})`;
|
|
2933
|
+
|
|
2546
2934
|
const _lockBlockReason = `Hive session-lock conflict: another session holds an active lock on this file.
|
|
2547
2935
|
|
|
2548
2936
|
File: ${_lockCheckPath}
|
|
@@ -2551,6 +2939,12 @@ Conflicting locks:
|
|
|
2551
2939
|
${_conflictDetails}
|
|
2552
2940
|
${_autoMsgSummary}
|
|
2553
2941
|
|
|
2942
|
+
Recent Hive file-touch context:
|
|
2943
|
+
${_recentTouchDetails}
|
|
2944
|
+
|
|
2945
|
+
Related Hive thread context:
|
|
2946
|
+
${_threadDetails}
|
|
2947
|
+
|
|
2554
2948
|
Resolution:
|
|
2555
2949
|
1. A lock_conflict_request message was automatically posted to the lock-holding session. Wait for them to see it.
|
|
2556
2950
|
2. They release via: aria hive lock release --lock-id <ID> OR DELETE /api/hive/session-lock.
|
|
@@ -2569,6 +2963,8 @@ causes merge conflicts and state divergence. Explicit coordination is the only s
|
|
|
2569
2963
|
hookEventName: 'PreToolUse',
|
|
2570
2964
|
conflicting_locks: _conflictingLocks,
|
|
2571
2965
|
auto_coordination_messages: _autoMessageIds,
|
|
2966
|
+
hive_file_touch_context: _touchContext,
|
|
2967
|
+
hive_thread_context: _threadContext,
|
|
2572
2968
|
recovery: {
|
|
2573
2969
|
action: 'wait_for_lock_release_then_retry',
|
|
2574
2970
|
file_path: _lockCheckPath,
|