@aria_asi/cli 0.2.39 → 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 +1271 -40
- 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 +516 -92
- 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 +516 -92
- 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 +516 -92
- 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 +1273 -40
- 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
package/src/connectors/codex.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { connectShell } from './shell.js';
|
|
|
18
18
|
import { installAriaCognitionSkills } from './cognitive-skills.js';
|
|
19
19
|
import { syncDoctrineTriggerMap } from './doctrine-trigger-map.js';
|
|
20
20
|
import { buildMustReadGuide, mustReadIntro } from './must-read.js';
|
|
21
|
+
import { requireGovernedConnectorMutation } from './governed-adapter.js';
|
|
21
22
|
|
|
22
23
|
function packageSdkDir(): string {
|
|
23
24
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -27,12 +28,23 @@ function packageSdkDir(): string {
|
|
|
27
28
|
function packageTaskProjectLedgerHelperPath(): string {
|
|
28
29
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
29
30
|
const candidates = [
|
|
31
|
+
path.resolve(here, '..', '..', 'opencode-plugins', 'harness-context', 'task-project-ledger.mjs'),
|
|
30
32
|
path.resolve(here, '..', '..', '..', '..', 'opencode-plugins', 'harness-context', 'task-project-ledger.mjs'),
|
|
31
33
|
path.resolve(here, '..', '..', '..', 'assets', 'opencode-plugins', 'harness-context', 'task-project-ledger.mjs'),
|
|
32
34
|
];
|
|
33
35
|
return candidates.find((candidate) => existsSync(candidate)) || candidates[0];
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
function packageProjectBoundaryCognitionPath(): string {
|
|
39
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
40
|
+
const candidates = [
|
|
41
|
+
path.resolve(here, '..', '..', 'hooks', 'lib', 'project-boundary-cognition.mjs'),
|
|
42
|
+
path.resolve(here, '..', '..', '..', '..', 'hooks', 'lib', 'project-boundary-cognition.mjs'),
|
|
43
|
+
path.resolve(here, '..', '..', '..', 'assets', 'hooks', 'lib', 'project-boundary-cognition.mjs'),
|
|
44
|
+
];
|
|
45
|
+
return candidates.find((candidate) => existsSync(candidate)) || candidates[0];
|
|
46
|
+
}
|
|
47
|
+
|
|
36
48
|
function installSdk(codexDir: string, logs: string[]): void {
|
|
37
49
|
const sdkSrc = packageSdkDir();
|
|
38
50
|
if (!existsSync(sdkSrc)) {
|
|
@@ -97,7 +109,25 @@ function tomlString(value: string): string {
|
|
|
97
109
|
return JSON.stringify(value);
|
|
98
110
|
}
|
|
99
111
|
|
|
112
|
+
function canonicalCodexHookPath(relativePath: string): string {
|
|
113
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
114
|
+
const candidates = [
|
|
115
|
+
path.resolve(here, '..', '..', 'hooks', 'codex-native', relativePath),
|
|
116
|
+
path.resolve(here, '..', '..', '..', '..', 'hooks', 'codex-native', relativePath),
|
|
117
|
+
];
|
|
118
|
+
return candidates.find((candidate) => existsSync(candidate)) || candidates[0];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function readCanonicalCodexHook(relativePath: string): string {
|
|
122
|
+
const hookPath = canonicalCodexHookPath(relativePath);
|
|
123
|
+
if (!existsSync(hookPath)) {
|
|
124
|
+
throw new Error(`Canonical Codex hook asset missing: ${hookPath}`);
|
|
125
|
+
}
|
|
126
|
+
return readFileSync(hookPath, 'utf8');
|
|
127
|
+
}
|
|
128
|
+
|
|
100
129
|
function buildCodexHookRuntimeClient(): string {
|
|
130
|
+
return readCanonicalCodexHook('lib/runtime-client.mjs');
|
|
101
131
|
return `import { readFileSync, existsSync, mkdirSync, writeFileSync, unlinkSync } from 'node:fs';
|
|
102
132
|
import { spawnSync } from 'node:child_process';
|
|
103
133
|
import { createHash, randomUUID } from 'node:crypto';
|
|
@@ -169,6 +199,15 @@ export function inferSessionId(event) {
|
|
|
169
199
|
return \`codex:\${threadId}:\${turnId}\`;
|
|
170
200
|
}
|
|
171
201
|
|
|
202
|
+
export function inferHiveThreadId(event = {}, sessionId = '') {
|
|
203
|
+
const threadId =
|
|
204
|
+
extractFirst(event, ['thread_id', 'threadId', 'conversation_id', 'conversationId']) ||
|
|
205
|
+
extractFirst(event?.metadata, ['thread_id', 'threadId', 'conversation_id', 'conversationId']);
|
|
206
|
+
if (threadId) return \`codex:\${threadId}\`;
|
|
207
|
+
const raw = sessionId || 'codex';
|
|
208
|
+
return \`codex:\${createHash('sha256').update(raw).digest('hex').slice(0, 16)}\`;
|
|
209
|
+
}
|
|
210
|
+
|
|
172
211
|
export function ensureTraceId(state = {}) {
|
|
173
212
|
return typeof state.traceId === 'string' && state.traceId ? state.traceId : \`trace_\${randomUUID()}\`;
|
|
174
213
|
}
|
|
@@ -276,7 +315,41 @@ export async function runtimePost(route, body = {}) {
|
|
|
276
315
|
return response.json();
|
|
277
316
|
}
|
|
278
317
|
|
|
318
|
+
export async function runtimeGet(route) {
|
|
319
|
+
const token = readToken();
|
|
320
|
+
const headers = {};
|
|
321
|
+
if (token) headers.Authorization = \`Bearer \${token}\`;
|
|
322
|
+
const response = await fetch(\`\${DEFAULT_RUNTIME_URL}\${route}\`, {
|
|
323
|
+
method: 'GET',
|
|
324
|
+
headers,
|
|
325
|
+
});
|
|
326
|
+
if (!response.ok) {
|
|
327
|
+
const detail = await response.text().catch(() => response.statusText);
|
|
328
|
+
throw new Error(\`runtime \${route} failed (\${response.status}): \${detail}\`);
|
|
329
|
+
}
|
|
330
|
+
return response.json();
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export function remoteCoachEnabled(env = process.env) {
|
|
334
|
+
return /^(?:1|true|yes|on)$/i.test(String(
|
|
335
|
+
env.ARIA_REMOTE_COACH_ENABLED ||
|
|
336
|
+
env.ARIA_RUNTIME_COACH_ENABLED ||
|
|
337
|
+
env.ARIA_COACH_REMOTE_ENABLED ||
|
|
338
|
+
''
|
|
339
|
+
));
|
|
340
|
+
}
|
|
341
|
+
|
|
279
342
|
export async function recordCoachPhase(phase, body = {}) {
|
|
343
|
+
if (!remoteCoachEnabled()) {
|
|
344
|
+
return {
|
|
345
|
+
ok: true,
|
|
346
|
+
skipped: true,
|
|
347
|
+
permitted: true,
|
|
348
|
+
decision: 'allow',
|
|
349
|
+
phase,
|
|
350
|
+
reasons: ['remote_coach_disabled'],
|
|
351
|
+
};
|
|
352
|
+
}
|
|
280
353
|
try {
|
|
281
354
|
return await runtimePost('/coach/phase', {
|
|
282
355
|
phase,
|
|
@@ -294,17 +367,82 @@ export async function recordCoachPhase(phase, body = {}) {
|
|
|
294
367
|
}
|
|
295
368
|
}
|
|
296
369
|
|
|
370
|
+
export async function ensurePreTurnMizanReceipt({ sessionId, traceId, state = {}, event = {}, action = '', target = '' } = {}) {
|
|
371
|
+
if (state?.preReceiptId) {
|
|
372
|
+
return { ok: true, state, healed: false };
|
|
373
|
+
}
|
|
374
|
+
const message = String(state?.userText || target || 'codex tool request').slice(0, 4000);
|
|
375
|
+
const packet = await getHarnessClient().getHarnessPacket({
|
|
376
|
+
sessionId,
|
|
377
|
+
platform: 'codex',
|
|
378
|
+
message,
|
|
379
|
+
});
|
|
380
|
+
const packetRef = makeEvidenceRef('harness_packet', packet, { sessionId, platform: 'codex', source: 'pre_tool_receipt_heal' });
|
|
381
|
+
const result = await runtimePost('/mizan/pre', {
|
|
382
|
+
sessionId,
|
|
383
|
+
packet,
|
|
384
|
+
packetRequest: {
|
|
385
|
+
sessionId,
|
|
386
|
+
platform: 'codex',
|
|
387
|
+
message,
|
|
388
|
+
stage: 'codex-pre-tool-receipt-heal',
|
|
389
|
+
actor: 'codex-hook',
|
|
390
|
+
system: 'codex-hook',
|
|
391
|
+
},
|
|
392
|
+
context: {
|
|
393
|
+
sessionId,
|
|
394
|
+
traceId,
|
|
395
|
+
surface: 'codex-hooks',
|
|
396
|
+
platform: 'codex',
|
|
397
|
+
userText: state?.userText || '',
|
|
398
|
+
action,
|
|
399
|
+
target,
|
|
400
|
+
event,
|
|
401
|
+
evidenceRefs: [packetRef],
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
const nextState = saveTurnState(sessionId, {
|
|
405
|
+
...state,
|
|
406
|
+
traceId,
|
|
407
|
+
preReceiptId: result?.receipt?.receiptId || null,
|
|
408
|
+
packetTimestamp: packet?.timestamp || null,
|
|
409
|
+
packetRef,
|
|
410
|
+
preReceiptHealed: true,
|
|
411
|
+
preReceiptHealedAt: new Date().toISOString(),
|
|
412
|
+
lastEvent: 'PreToolUse',
|
|
413
|
+
});
|
|
414
|
+
return {
|
|
415
|
+
ok: Boolean(result?.receipt?.receiptId),
|
|
416
|
+
state: nextState,
|
|
417
|
+
healed: true,
|
|
418
|
+
receipt: result?.receipt || null,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
|
|
297
422
|
export function classifyAction(event) {
|
|
298
423
|
const toolName = String(event?.tool_name || event?.toolName || '').trim();
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
).
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (
|
|
424
|
+
const toolInput = event?.tool_input || event?.toolInput || {};
|
|
425
|
+
const toolCommand = String(toolInput?.command ?? '').trim();
|
|
426
|
+
const lowerTool = toolName.toLowerCase();
|
|
427
|
+
|
|
428
|
+
if (/^(?:read|grep|glob|list_mcp_resources|list_mcp_resource_templates)$/i.test(toolName)) return 'read';
|
|
429
|
+
if (lowerTool.includes('apply_patch')) {
|
|
430
|
+
return /^\\*\\*\\* Begin Patch[\\s\\S]*^\\*\\*\\* Delete File:/m.test(toolCommand) ? 'delete' : 'write';
|
|
431
|
+
}
|
|
432
|
+
if (/^(?:edit|write|notebookedit)$/i.test(toolName) || toolInput?.file_path || toolInput?.notebook_path) {
|
|
433
|
+
return 'write';
|
|
434
|
+
}
|
|
435
|
+
if (/delete|destroy|drop|wipe|purge/i.test(toolName)) return 'delete';
|
|
436
|
+
if (/deploy|rollout|release/i.test(toolName)) return 'deploy';
|
|
437
|
+
if (/build|compile|test/i.test(toolName)) return 'build';
|
|
438
|
+
if (!toolCommand) return 'write';
|
|
439
|
+
|
|
440
|
+
if (/^(?:ls|cat|head|tail|grep|rg|sed\\s+-n|wc|find|tree|stat|file|ps|pgrep|du|df|env|printenv|date|pwd|which|type|whoami|id)\\b/.test(toolCommand)) return 'read';
|
|
441
|
+
if (/^git\\s+(?:status|log|diff|show|branch|remote|rev-parse|ls-tree|ls-files|stash\\s+list)\\b/.test(toolCommand)) return 'read';
|
|
442
|
+
if (/^(?:kubectl\\s+(?:get|describe|logs|top|version|api-resources)\\b|docker\\s+ps\\b)/.test(toolCommand)) return 'read';
|
|
443
|
+
if (/\\b(?:scripts\\/deploy-|kubectl\\s+(?:apply|set\\s+image|delete|patch|rollout|scale|drain|cordon)\\b|docker\\s+push\\b|helm\\s+(?:upgrade|install|rollback)\\b)/i.test(toolCommand)) return 'deploy';
|
|
444
|
+
if (/^(?:rm|rmdir|unlink|truncate)\\b|drop\\s+table|git\\s+(?:reset|clean)\\b/i.test(toolCommand)) return 'delete';
|
|
445
|
+
if (/\\b(?:npm|pnpm|yarn)\\s+(?:run\\s+)?(?:build|test|check|lint|typecheck)\\b|\\b(?:tsc|jest|vitest|eslint)\\b/i.test(toolCommand)) return 'build';
|
|
308
446
|
return 'write';
|
|
309
447
|
}
|
|
310
448
|
|
|
@@ -315,6 +453,104 @@ export function summarizeTarget(event) {
|
|
|
315
453
|
}).slice(0, 4000);
|
|
316
454
|
}
|
|
317
455
|
|
|
456
|
+
function normalizeTouchedPath(value) {
|
|
457
|
+
const raw = String(value || '').trim();
|
|
458
|
+
if (!raw) return '';
|
|
459
|
+
return raw.replace(/\\\\/g, '/').replace(/\\/+/, '/');
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function pushTouchedFile(files, value, intent = 'touch') {
|
|
463
|
+
const pathValue = normalizeTouchedPath(value);
|
|
464
|
+
if (!pathValue) return;
|
|
465
|
+
if (!files.some((file) => file.path === pathValue && file.intent === intent)) {
|
|
466
|
+
files.push({ path: pathValue, intent });
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export function extractToolTouchedFiles(event, action = '') {
|
|
471
|
+
const files = [];
|
|
472
|
+
const toolName = String(event?.tool_name || event?.toolName || '').trim();
|
|
473
|
+
const toolInput = event?.tool_input || event?.toolInput || {};
|
|
474
|
+
const intent = action || classifyAction(event);
|
|
475
|
+
pushTouchedFile(files, toolInput?.file_path, intent);
|
|
476
|
+
pushTouchedFile(files, toolInput?.filePath, intent);
|
|
477
|
+
pushTouchedFile(files, toolInput?.path, intent);
|
|
478
|
+
pushTouchedFile(files, toolInput?.notebook_path, intent);
|
|
479
|
+
pushTouchedFile(files, toolInput?.notebookPath, intent);
|
|
480
|
+
if (Array.isArray(toolInput?.files)) toolInput.files.forEach((file) => pushTouchedFile(files, file, intent));
|
|
481
|
+
if (Array.isArray(toolInput?.targetFiles)) toolInput.targetFiles.forEach((file) => pushTouchedFile(files, file, intent));
|
|
482
|
+
const command = String(toolInput?.command || '');
|
|
483
|
+
if (/apply_patch/i.test(toolName) || /^\\*\\*\\* Begin Patch/m.test(command)) {
|
|
484
|
+
for (const match of command.matchAll(/^\\*\\*\\* (?:Update|Add|Delete) File: (.+)$/gm)) {
|
|
485
|
+
pushTouchedFile(files, match[1], intent);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return files.slice(0, 200);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export async function recordHiveFileTouch({ sessionId, threadId = null, event = 'tool_request', files = [], source = 'codex-hook', body = {} } = {}) {
|
|
492
|
+
if (!sessionId || !Array.isArray(files) || files.length === 0) {
|
|
493
|
+
return { ok: true, skipped: true, reason: 'no files to record' };
|
|
494
|
+
}
|
|
495
|
+
try {
|
|
496
|
+
return await runtimePost('/api/hive/file-touch', {
|
|
497
|
+
session_id: sessionId,
|
|
498
|
+
thread_id: threadId,
|
|
499
|
+
event,
|
|
500
|
+
files,
|
|
501
|
+
source,
|
|
502
|
+
body: {
|
|
503
|
+
cwd: process.cwd(),
|
|
504
|
+
...body,
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
} catch (error) {
|
|
508
|
+
return {
|
|
509
|
+
ok: false,
|
|
510
|
+
skipped: false,
|
|
511
|
+
error: error instanceof Error ? error.message : String(error),
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export async function recordHiveSessionLifecycle({
|
|
517
|
+
sessionId,
|
|
518
|
+
threadId = null,
|
|
519
|
+
event = 'heartbeat',
|
|
520
|
+
status = null,
|
|
521
|
+
intentSummary = null,
|
|
522
|
+
sourceArtifact = null,
|
|
523
|
+
fileClaims = [],
|
|
524
|
+
doNotTouch = [],
|
|
525
|
+
source = 'codex-hook',
|
|
526
|
+
body = {},
|
|
527
|
+
} = {}) {
|
|
528
|
+
if (!sessionId) return { ok: true, skipped: true, reason: 'no session_id to record' };
|
|
529
|
+
try {
|
|
530
|
+
return await runtimePost('/api/hive/session-lifecycle', {
|
|
531
|
+
session_id: sessionId,
|
|
532
|
+
thread_id: threadId,
|
|
533
|
+
event,
|
|
534
|
+
status: status || event,
|
|
535
|
+
intent_summary: intentSummary || \`\${source} \${event}\`,
|
|
536
|
+
source_artifact: sourceArtifact,
|
|
537
|
+
file_claims: Array.isArray(fileClaims) ? fileClaims : [],
|
|
538
|
+
do_not_touch: Array.isArray(doNotTouch) ? doNotTouch : [],
|
|
539
|
+
body: {
|
|
540
|
+
cwd: process.cwd(),
|
|
541
|
+
source,
|
|
542
|
+
...body,
|
|
543
|
+
},
|
|
544
|
+
});
|
|
545
|
+
} catch (error) {
|
|
546
|
+
return {
|
|
547
|
+
ok: false,
|
|
548
|
+
skipped: false,
|
|
549
|
+
error: error instanceof Error ? error.message : String(error),
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
318
554
|
export function extractUserText(event) {
|
|
319
555
|
return extractText(
|
|
320
556
|
event?.input ??
|
|
@@ -337,11 +573,495 @@ export function extractAssistantText(event) {
|
|
|
337
573
|
);
|
|
338
574
|
}
|
|
339
575
|
|
|
576
|
+
export const ARIA_ALWAYS_ON_SKILLS = Object.freeze([
|
|
577
|
+
'aria-axioms-first-principles',
|
|
578
|
+
'aria-cognition-autofire',
|
|
579
|
+
'aria-first-class-operating-contract',
|
|
580
|
+
'aria-cognition-batch',
|
|
581
|
+
'aria-forge-guardrails',
|
|
582
|
+
'aria-harness-no-stripping',
|
|
583
|
+
'aria-harness-output-discipline',
|
|
584
|
+
'aria-quality-audit',
|
|
585
|
+
'aria-readable-output',
|
|
586
|
+
'aria-senior-code-audit',
|
|
587
|
+
'ghazali-8lens',
|
|
588
|
+
'mizan',
|
|
589
|
+
'never-guess',
|
|
590
|
+
'predictor',
|
|
591
|
+
'qiyas-analogy',
|
|
592
|
+
'tadabbur',
|
|
593
|
+
'aria-repo-doctrine',
|
|
594
|
+
'aria-senior-code-cookbook',
|
|
595
|
+
'aria-http-harness-client',
|
|
596
|
+
'aria-task-codex-executor',
|
|
597
|
+
'aria-decision-mizan',
|
|
598
|
+
'tadabbur-ops',
|
|
599
|
+
'aria-repo-audit',
|
|
600
|
+
'aria-backend-architect',
|
|
601
|
+
'aria-live-ops',
|
|
602
|
+
'aria-memory-index',
|
|
603
|
+
'aria-ops',
|
|
604
|
+
]);
|
|
605
|
+
|
|
606
|
+
export const ARIA_QIYAS_15_PERSPECTIVES = Object.freeze([
|
|
607
|
+
'Owner-Hamza-tomorrow',
|
|
608
|
+
'operator-client',
|
|
609
|
+
'investor',
|
|
610
|
+
'LLM-consumer',
|
|
611
|
+
'human-end-user',
|
|
612
|
+
'skeptic',
|
|
613
|
+
'compliance',
|
|
614
|
+
'engineering-quality',
|
|
615
|
+
'cognitive-load',
|
|
616
|
+
'scale',
|
|
617
|
+
'Islamic-scholar',
|
|
618
|
+
'clinical-scholar',
|
|
619
|
+
'red-team-attacker',
|
|
620
|
+
'1-week-future-self',
|
|
621
|
+
'1-year-future-self',
|
|
622
|
+
]);
|
|
623
|
+
|
|
624
|
+
export const ARIA_TADABBUR_12_STAGES = Object.freeze([
|
|
625
|
+
'EMBED',
|
|
626
|
+
'EXCAVATE',
|
|
627
|
+
'ROOT TRACE',
|
|
628
|
+
'MULTI-LENS',
|
|
629
|
+
'PATTERN',
|
|
630
|
+
'CONSEQUENCE',
|
|
631
|
+
'DWELLING',
|
|
632
|
+
'COLLAPSE',
|
|
633
|
+
'PRINCIPLE',
|
|
634
|
+
'INVERSION',
|
|
635
|
+
'PERSONAL',
|
|
636
|
+
'VOICE',
|
|
637
|
+
]);
|
|
638
|
+
|
|
639
|
+
export const ARIA_QA_AUTOFIRE_CYCLE = Object.freeze([
|
|
640
|
+
'qiyas_15_pass',
|
|
641
|
+
'tadabbur_full_canonical_12_stage',
|
|
642
|
+
'correct',
|
|
643
|
+
'enhance',
|
|
644
|
+
'harden',
|
|
645
|
+
'verify',
|
|
646
|
+
]);
|
|
647
|
+
|
|
648
|
+
export const ARIA_QA_METHOD_CONTRACT = Object.freeze({
|
|
649
|
+
qiyas: 'Qiyas means full Qiyas-15 only. Mini Qiyas is not acceptable for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
650
|
+
tadabbur: 'Tadabbur means the full canonical 12-stage Tadabbur path for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
export const UNIVERSAL_CONNECTOR_ACTUAL_GOAL =
|
|
654
|
+
'Wire extracted books, doctrines, skills, runtimes, primitives, mappings, CLIs, connectors, hooks, sidecars, and agent surfaces into the operating system so agent output improves automatically.';
|
|
655
|
+
|
|
656
|
+
export const UNIVERSAL_CONNECTOR_HIGH_IMPACT_SKILLS = Object.freeze([
|
|
657
|
+
'ghazali-tauba-kca-repair-contract',
|
|
658
|
+
'ghazali-rights-before-balance-settlement',
|
|
659
|
+
'ghazali-delay-is-risk-auditor',
|
|
660
|
+
'ghazali-knowledge-condition-action-patience-bridge',
|
|
661
|
+
'ghazali-cause-means-tawakkal-mizan',
|
|
662
|
+
'ghazali-ultimate-cause-chain-tracer',
|
|
663
|
+
'ghazali-necessity-vs-attachment-mizan',
|
|
664
|
+
'ghazali-attachment-not-possession-auditor',
|
|
665
|
+
'ghazali-acquaintance-before-love-diagnoser',
|
|
666
|
+
'ghazali-love-cup-attachment-displacement-auditor',
|
|
667
|
+
'ghazali-knowledge-will-strength-action-chain',
|
|
668
|
+
'ghazali-means-do-not-cleanse-end-gate',
|
|
669
|
+
'ghazali-six-register-truthfulness-audit',
|
|
670
|
+
'ghazali-breath-capital-day-contract',
|
|
671
|
+
'ghazali-two-premise-action-transduction',
|
|
672
|
+
'ghazali-four-object-thought-ledger',
|
|
673
|
+
'ghazali-one-vice-one-replacement-register',
|
|
674
|
+
'ghazali-bounded-sign-observation',
|
|
675
|
+
'ghazali-three-question-intention-gate',
|
|
676
|
+
'ghazali-principal-profit-loss-muhasabah',
|
|
677
|
+
'ghazali-self-rebuke-false-narrative-interrogator',
|
|
678
|
+
'ghazali-death-remembrance-deception-breaker',
|
|
679
|
+
'ghazali-condition-specific-hope-fear-medicine',
|
|
680
|
+
'ghazali-fear-action-not-paralysis-gate',
|
|
681
|
+
'ghazali-hope-requires-cultivation-auditor',
|
|
682
|
+
]);
|
|
683
|
+
|
|
684
|
+
export const UNIVERSAL_CONNECTOR_REQUIRED_RUNTIMES = Object.freeze([
|
|
685
|
+
'tafakkur-transduction-runtime',
|
|
686
|
+
'six-stage-self-accounting-runtime',
|
|
687
|
+
'mortality-accounting-runtime',
|
|
688
|
+
'fear-hope-condition-regulation-runtime',
|
|
689
|
+
'intention-to-action-integrity-runtime',
|
|
690
|
+
'love-fruit-contentment-runtime',
|
|
691
|
+
'patience-gratitude-purpose-mizan-runtime',
|
|
692
|
+
'tauba-rights-repair-runtime',
|
|
693
|
+
'tawakkal-cause-mizan-runtime',
|
|
694
|
+
'zuhd-necessity-attachment-runtime',
|
|
695
|
+
]);
|
|
696
|
+
|
|
697
|
+
function includesAny(text = '', terms = []) {
|
|
698
|
+
const source = String(text || '').toLowerCase();
|
|
699
|
+
return terms.some((term) => source.includes(String(term).toLowerCase()));
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
function countIncluded(text = '', terms = []) {
|
|
703
|
+
const source = String(text || '').toLowerCase();
|
|
704
|
+
return terms.reduce((count, term) => count + (source.includes(String(term).toLowerCase()) ? 1 : 0), 0);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
function continuationRequested(text = '') {
|
|
708
|
+
return includesAny(text, [
|
|
709
|
+
'continue',
|
|
710
|
+
'next phase',
|
|
711
|
+
'next step',
|
|
712
|
+
'next best',
|
|
713
|
+
'fire',
|
|
714
|
+
'skills',
|
|
715
|
+
'production',
|
|
716
|
+
'ready',
|
|
717
|
+
'what is left',
|
|
718
|
+
"what's left",
|
|
719
|
+
'how far',
|
|
720
|
+
'qa',
|
|
721
|
+
'ledger',
|
|
722
|
+
'autofire',
|
|
723
|
+
'wire',
|
|
724
|
+
]);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
function actualGoalHits(text = '') {
|
|
728
|
+
return countIncluded(text, [
|
|
729
|
+
'wire extracted',
|
|
730
|
+
'books',
|
|
731
|
+
'doctrines',
|
|
732
|
+
'skills',
|
|
733
|
+
'runtimes',
|
|
734
|
+
'primitives',
|
|
735
|
+
'mappings',
|
|
736
|
+
'connectors',
|
|
737
|
+
'hooks',
|
|
738
|
+
'sidecars',
|
|
739
|
+
'agent surfaces',
|
|
740
|
+
'output improves automatically',
|
|
741
|
+
'corpus',
|
|
742
|
+
'forced-selection',
|
|
743
|
+
'actual goal',
|
|
744
|
+
]);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
function supportMechanismHits(text = '') {
|
|
748
|
+
return countIncluded(text, ['receipt', 'gate', 'ledger', 'canary', 'drift check', 'phase ']);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
export function buildUniversalConnectorGoalContract({ userText = '', phase = 'turn' } = {}) {
|
|
752
|
+
return {
|
|
753
|
+
id: 'universal-connector-corpus-runtime-goal-contract',
|
|
754
|
+
phase,
|
|
755
|
+
actualGoal: UNIVERSAL_CONNECTOR_ACTUAL_GOAL,
|
|
756
|
+
supportRule: 'Receipts, gates, ledgers, and canaries are support evidence only; they pass when they prove corpus-backed behavior changed action, QA, correction, verification, or learning.',
|
|
757
|
+
hardStopOnlyFor: ['secrets', 'destructive actions', 'deploy/publication boundary', 'owner-contradicted action', 'proven false completion risk'],
|
|
758
|
+
qaPacket: {
|
|
759
|
+
qiyas: 'Qiyas-15 over owner trust, operator value, engineering quality, cognitive load, scale, compliance, red-team, one-week future, and one-year future.',
|
|
760
|
+
tadabbur: 'Full consequence trace from current action to production behavior; reject motion that only improves receipts.',
|
|
761
|
+
mizan: 'Balance evidence, owner impact, throughput, and false-completion risk; repair low-risk misses before hard-blocking.',
|
|
762
|
+
ghazali8: 'Nur observed substrate, Mizan proportion, Hikma doctrine, Tafakkur structure, Tadabbur consequence, Ilham sensed drift, Wahi owner/corpus anchor, Firasah owner need.',
|
|
763
|
+
fitrah: 'Truth over deception, no harm, sacred trust, power obligates service, reflection before action.',
|
|
764
|
+
},
|
|
765
|
+
selectedSkills: [...UNIVERSAL_CONNECTOR_HIGH_IMPACT_SKILLS],
|
|
766
|
+
selectedRuntimes: [...UNIVERSAL_CONNECTOR_REQUIRED_RUNTIMES],
|
|
767
|
+
nextHighestImpactAction: 'Promote the sandbox corpus registry consumer into the real connector/hook forced-selection path, then run behavioral QA on actual Claude/Codex/OpenCode continuation prompts.',
|
|
768
|
+
continuation: continuationRequested(userText),
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
export function evaluateGoalContractOutput(text = '', { userText = '', goalContract = null } = {}) {
|
|
773
|
+
const source = String(text || '');
|
|
774
|
+
const contract = goalContract || buildUniversalConnectorGoalContract({ userText, phase: 'stop' });
|
|
775
|
+
const continuation = contract.continuation || continuationRequested(userText) || actualGoalHits(userText) > 0;
|
|
776
|
+
const blockers = [];
|
|
777
|
+
const warnings = [];
|
|
778
|
+
const repairs = [];
|
|
779
|
+
if (!continuation) return { pass: true, hardBlock: false, score: 1, blockers, warnings, repairs, contract };
|
|
780
|
+
const goalHits = actualGoalHits(source);
|
|
781
|
+
const supportHits = supportMechanismHits(source);
|
|
782
|
+
const hasEvidence = includesAny(source, ['verified', 'observed', 'evidence', 'smoke', 'test', 'audit', 'not production-ready', 'integration-ready', 'blocked', 'pending', 'unverified']);
|
|
783
|
+
const hasNextAction = includesAny(source, ['next highest', 'next best', 'next action', 'next step', 'continue by', 'promote the sandbox corpus', 'wire the registry', 'forced-selection']);
|
|
784
|
+
const hasQa = includesAny(source, ['qa', 'qiyas', 'tadabbur', 'mizan', 'ghazali', 'correct', 'enhance', 'harden', 'repair']);
|
|
785
|
+
if (goalHits === 0) {
|
|
786
|
+
warnings.push('goal-contract: output does not bind the turn to corpus-to-runtime wiring or automatic output improvement');
|
|
787
|
+
repairs.push('Name the actual goal or make the current action directly advance corpus registry, runtime, hook, connector, surface, or forced-selection wiring.');
|
|
788
|
+
}
|
|
789
|
+
if (!hasNextAction) {
|
|
790
|
+
warnings.push('goal-contract: continuation output does not name the next highest-impact action');
|
|
791
|
+
repairs.push('Add a concrete next action that advances real wiring or behavioral QA.');
|
|
792
|
+
}
|
|
793
|
+
if (!hasQa) {
|
|
794
|
+
warnings.push('goal-contract: QA/correction loop is missing from the visible state');
|
|
795
|
+
repairs.push('Add expected-vs-observed QA with correction, enhancement, hardening, or an explicit pass boundary.');
|
|
796
|
+
}
|
|
797
|
+
if (!hasEvidence) {
|
|
798
|
+
warnings.push('goal-contract: evidence boundary is missing');
|
|
799
|
+
repairs.push('State verified, blocked, pending, unverified, or the exact evidence class used before making status claims.');
|
|
800
|
+
}
|
|
801
|
+
if (supportHits >= 3 && supportHits > goalHits + 1) {
|
|
802
|
+
warnings.push('goal-contract: support mechanisms dominate the answer over the actual product goal');
|
|
803
|
+
repairs.push('Reframe receipts, gates, ledgers, and canaries as evidence only, then return to corpus-to-runtime wiring and output improvement.');
|
|
804
|
+
}
|
|
805
|
+
if (/\\bwhat would you like me to do next\\b|\\bhow would you like me to proceed\\b/i.test(source)) {
|
|
806
|
+
blockers.push('goal-contract: output asks the owner to choose the obvious continuation instead of naming the next highest-impact step');
|
|
807
|
+
}
|
|
808
|
+
if (/\\b(?:production ready|ready for production|release ready|promotion pass|complete|completed|done|verified|fixed)\\b/i.test(source) && !/\\b(?:not production-ready|not production ready|integration-ready|pending|blocked|unverified|bounded|evidence)\\b/i.test(source)) {
|
|
809
|
+
blockers.push('goal-contract: false completion or readiness claim without bounded evidence');
|
|
810
|
+
}
|
|
811
|
+
if (/\\b(?:\\/consult|consult api|consult response)\\b/i.test(source) && /\\b(?:quality source|core quality|dependency|required)\\b/i.test(source)) {
|
|
812
|
+
blockers.push('goal-contract: consult API is being treated as the core quality engine');
|
|
813
|
+
}
|
|
814
|
+
const score = [goalHits > 0, hasNextAction, hasQa, hasEvidence, !(supportHits >= 3 && supportHits > goalHits + 1), blockers.length === 0].filter(Boolean).length / 6;
|
|
815
|
+
return {
|
|
816
|
+
pass: blockers.length === 0 && score >= 0.67,
|
|
817
|
+
hardBlock: blockers.length > 0,
|
|
818
|
+
score,
|
|
819
|
+
blockers: [...new Set(blockers)],
|
|
820
|
+
warnings: [...new Set(warnings)],
|
|
821
|
+
repairs: [...new Set(repairs)],
|
|
822
|
+
nextHighestImpactAction: contract.nextHighestImpactAction,
|
|
823
|
+
selectedSkills: contract.selectedSkills,
|
|
824
|
+
selectedRuntimes: contract.selectedRuntimes,
|
|
825
|
+
contract,
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
export function inferRequiredAriaSkills(text = '') {
|
|
830
|
+
const raw = String(text || '');
|
|
831
|
+
const lower = raw.toLowerCase();
|
|
832
|
+
const required = new Set(ARIA_ALWAYS_ON_SKILLS);
|
|
833
|
+
const add = (skill) => required.add(skill);
|
|
834
|
+
const mentions = (skill) => new RegExp('(?:^|[^a-z0-9_-])\\\\$?' + skill.replace(/[.*+?^\${}()|[\\]\\\\]/g, '\\\\$&') + '(?:$|[^a-z0-9_-])', 'i').test(raw);
|
|
835
|
+
|
|
836
|
+
for (const skill of [
|
|
837
|
+
'aria-axioms-first-principles',
|
|
838
|
+
'aria-cognition-autofire',
|
|
839
|
+
'aria-first-class-operating-contract',
|
|
840
|
+
'aria-cognition-batch',
|
|
841
|
+
'aria-readable-output',
|
|
842
|
+
'tadabbur',
|
|
843
|
+
'qiyas-analogy',
|
|
844
|
+
]) {
|
|
845
|
+
if (mentions(skill)) add(skill);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
if (/\\b(?:aria|harness|garden|claude code|codex|opencode|skill|skills|hook|hooks|runtime|connector|sdk|gate|quality|qa|audit|completion claim)\\b/i.test(raw)) {
|
|
849
|
+
add('aria-cognition-autofire');
|
|
850
|
+
add('aria-readable-output');
|
|
851
|
+
}
|
|
852
|
+
if (/\\b(?:first class|first-class|world class|world-class|revolutionary upgrade|full upgrade|substrate os|not just a watcher|serious upgrade)\\b/i.test(raw)) {
|
|
853
|
+
add('aria-first-class-operating-contract');
|
|
854
|
+
}
|
|
855
|
+
if (/\\b(?:axiom|axioms|first principles?|fitrah|source trust|evidence threshold)\\b/i.test(raw)) {
|
|
856
|
+
add('aria-axioms-first-principles');
|
|
857
|
+
}
|
|
858
|
+
if (/\\b(?:full cognition|batch cognition|28\\+15|mizan plus tadabbur|rich cognitives|cognitive batch)\\b/i.test(raw)) {
|
|
859
|
+
add('aria-cognition-batch');
|
|
860
|
+
}
|
|
861
|
+
if (/\\b(?:tadabbur|taddabur|12-stage|heart filter|consequence reasoning|cookbook|deep reflection)\\b/i.test(lower)) {
|
|
862
|
+
add('tadabbur');
|
|
863
|
+
}
|
|
864
|
+
if (/\\b(?:qiyas|analogy|analogical|qiyas-15|structural analogy|asl|hukm|illah|furuq)\\b/i.test(lower)) {
|
|
865
|
+
add('qiyas-analogy');
|
|
866
|
+
}
|
|
867
|
+
if (/\\b(?:fire named skills|fire skills|use aria skills|named skills)\\b/i.test(lower)) {
|
|
868
|
+
add('aria-axioms-first-principles');
|
|
869
|
+
add('aria-cognition-autofire');
|
|
870
|
+
add('aria-cognition-batch');
|
|
871
|
+
add('aria-readable-output');
|
|
872
|
+
add('tadabbur');
|
|
873
|
+
add('qiyas-analogy');
|
|
874
|
+
}
|
|
875
|
+
if (/\\b(?:readable output|readability|owner surface|owner-facing|scannable|stop gate|closeout|final answer)\\b/i.test(lower)) {
|
|
876
|
+
add('aria-readable-output');
|
|
877
|
+
}
|
|
878
|
+
if (/\\b(?:backend|api|server|database|auth|queue|worker|service)\\b/i.test(lower)) {
|
|
879
|
+
add('aria-backend-architect');
|
|
880
|
+
}
|
|
881
|
+
if (/\\b(?:frontend|ui|ux|component|page|screen|css|layout)\\b/i.test(lower)) {
|
|
882
|
+
add('aria-frontend-architect');
|
|
883
|
+
}
|
|
884
|
+
if (/\\b(?:fullstack|end-to-end|e2e|web app|application)\\b/i.test(lower)) {
|
|
885
|
+
add('aria-fullstack-orchestrator');
|
|
886
|
+
}
|
|
887
|
+
if (/\\b(?:deploy|k8s|kubernetes|kubectl|cluster|infra|infrastructure|rollout)\\b/i.test(lower)) {
|
|
888
|
+
add('aria-live-ops');
|
|
889
|
+
add('aria-k8s-deploy');
|
|
890
|
+
}
|
|
891
|
+
if (/\\b(?:repo audit|repository audit|codebase audit|refactor|review)\\b/i.test(lower)) {
|
|
892
|
+
add('aria-repo-audit');
|
|
893
|
+
}
|
|
894
|
+
if (/\\b(?:research|diligence|sources|market|competitor|public sources)\\b/i.test(lower)) {
|
|
895
|
+
add('aria-research-orchestrator');
|
|
896
|
+
}
|
|
897
|
+
if (/\\b(?:business|pricing|gtm|go-to-market|revenue|retention|launch)\\b/i.test(lower)) {
|
|
898
|
+
add('aria-business-frame');
|
|
899
|
+
add('aria-gtm-architect');
|
|
900
|
+
}
|
|
901
|
+
if (required.size > 0 && /\\b(?:aria|harness|codex|claude|hook|gate|runtime|skill|cognition|coach)\\b/i.test(raw)) {
|
|
902
|
+
add('aria-readable-output');
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
return [...required].sort();
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
export function summarizeForcedSkillLoad(promptBuild = null) {
|
|
909
|
+
if (!promptBuild || typeof promptBuild !== 'object') return null;
|
|
910
|
+
const loadedCookbooks = Array.isArray(promptBuild.loadedCookbooks) ? promptBuild.loadedCookbooks : [];
|
|
911
|
+
const missingCookbooks = Array.isArray(promptBuild.missingCookbooks) ? promptBuild.missingCookbooks : [];
|
|
912
|
+
const receipt = promptBuild.skillExecutionReceipt && typeof promptBuild.skillExecutionReceipt === 'object'
|
|
913
|
+
? promptBuild.skillExecutionReceipt
|
|
914
|
+
: null;
|
|
915
|
+
const substrateKernelExecution = receipt?.substrateKernelExecution && typeof receipt.substrateKernelExecution === 'object'
|
|
916
|
+
? receipt.substrateKernelExecution
|
|
917
|
+
: null;
|
|
918
|
+
const executedSkillIds = Array.isArray(receipt?.executedSkillIds)
|
|
919
|
+
? receipt.executedSkillIds
|
|
920
|
+
: Array.isArray(substrateKernelExecution?.executedSkillIds)
|
|
921
|
+
? substrateKernelExecution.executedSkillIds
|
|
922
|
+
: [];
|
|
923
|
+
const executedOperatorIds = Array.isArray(receipt?.executedOperatorIds)
|
|
924
|
+
? receipt.executedOperatorIds
|
|
925
|
+
: Array.isArray(substrateKernelExecution?.executedOperatorIds)
|
|
926
|
+
? substrateKernelExecution.executedOperatorIds
|
|
927
|
+
: [];
|
|
928
|
+
return {
|
|
929
|
+
ok: promptBuild.ok === true,
|
|
930
|
+
requiredSkillIds: Array.isArray(promptBuild.requiredSkillIds) ? promptBuild.requiredSkillIds : [],
|
|
931
|
+
loadedSkillIds: Array.isArray(promptBuild.loadedSkillIds) ? promptBuild.loadedSkillIds : [],
|
|
932
|
+
missingSkillIds: Array.isArray(promptBuild.missingSkillIds) ? promptBuild.missingSkillIds : [],
|
|
933
|
+
loadedSkillHashes: Array.isArray(promptBuild.loadedSkillHashes) ? promptBuild.loadedSkillHashes : [],
|
|
934
|
+
loadedCookbooks: loadedCookbooks.map((entry) => ({
|
|
935
|
+
skillId: entry.skillId || null,
|
|
936
|
+
requestedBy: entry.requestedBy || null,
|
|
937
|
+
cookbookName: entry.cookbookName || null,
|
|
938
|
+
path: entry.path || null,
|
|
939
|
+
hash: entry.hash || null,
|
|
940
|
+
chars: entry.chars || null,
|
|
941
|
+
})),
|
|
942
|
+
missingCookbooks: missingCookbooks.map((entry) => ({
|
|
943
|
+
skillId: entry.skillId || null,
|
|
944
|
+
requestedBy: entry.requestedBy || null,
|
|
945
|
+
cookbookName: entry.cookbookName || null,
|
|
946
|
+
path: entry.path || null,
|
|
947
|
+
})),
|
|
948
|
+
skillExecutionMode: typeof promptBuild.skillExecutionMode === 'string' ? promptBuild.skillExecutionMode : null,
|
|
949
|
+
skillExecutionReceipt: receipt
|
|
950
|
+
? {
|
|
951
|
+
ok: receipt.ok === true,
|
|
952
|
+
mode: receipt.mode || null,
|
|
953
|
+
firedSkillIds: executedSkillIds.length
|
|
954
|
+
? executedSkillIds
|
|
955
|
+
: Array.isArray(receipt.firedSkillIds) ? receipt.firedSkillIds : [],
|
|
956
|
+
executedSkillIds,
|
|
957
|
+
executedOperatorCount: executedOperatorIds.length,
|
|
958
|
+
substrateKernelExecution: substrateKernelExecution
|
|
959
|
+
? {
|
|
960
|
+
ok: substrateKernelExecution.ok === true,
|
|
961
|
+
mode: substrateKernelExecution.mode || null,
|
|
962
|
+
executedOperatorIdsHash: substrateKernelExecution.executedOperatorIdsHash || null,
|
|
963
|
+
executionHash: substrateKernelExecution.executionHash || null,
|
|
964
|
+
}
|
|
965
|
+
: null,
|
|
966
|
+
receiptHash: receipt.receiptHash || null,
|
|
967
|
+
}
|
|
968
|
+
: null,
|
|
969
|
+
promptSha256: promptBuild.prompt ? createHash('sha256').update(String(promptBuild.prompt)).digest('hex') : null,
|
|
970
|
+
promptChars: promptBuild.prompt ? String(promptBuild.prompt).length : 0,
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
export function forcedSkillLoadGaps(state = {}) {
|
|
975
|
+
const summary = state?.forcedSkillLoad || null;
|
|
976
|
+
const required = Array.isArray(state?.requiredSkills) ? state.requiredSkills : [];
|
|
977
|
+
if (required.length === 0) return [];
|
|
978
|
+
if (!summary) return ['forced runtime skill/cookbook context was not built'];
|
|
979
|
+
const gaps = [];
|
|
980
|
+
if (Array.isArray(summary.missingSkillIds) && summary.missingSkillIds.length > 0) {
|
|
981
|
+
gaps.push('missing skill ids: ' + summary.missingSkillIds.join(', '));
|
|
982
|
+
}
|
|
983
|
+
if (Array.isArray(summary.missingCookbooks) && summary.missingCookbooks.length > 0) {
|
|
984
|
+
gaps.push('missing cookbooks: ' + summary.missingCookbooks.map((entry) => entry.path || entry.cookbookName).join(', '));
|
|
985
|
+
}
|
|
986
|
+
if (summary.skillExecutionMode === 'mechanical-receipt') {
|
|
987
|
+
const receipt = summary.skillExecutionReceipt || {};
|
|
988
|
+
const fired = Array.isArray(receipt.executedSkillIds) && receipt.executedSkillIds.length
|
|
989
|
+
? receipt.executedSkillIds
|
|
990
|
+
: Array.isArray(receipt.firedSkillIds) ? receipt.firedSkillIds : [];
|
|
991
|
+
const missingFired = required.filter((skill) => !fired.includes(skill));
|
|
992
|
+
if (receipt.ok !== true) gaps.push('mechanical skill execution receipt did not pass');
|
|
993
|
+
if (receipt.substrateKernelExecution?.ok !== true) gaps.push('substrate kernel execution receipt did not pass');
|
|
994
|
+
if (missingFired.length > 0) gaps.push('mechanical receipt missing fired skill ids: ' + missingFired.join(', '));
|
|
995
|
+
if (summary.promptChars > 75000) gaps.push('mechanical receipt prompt exceeds compact prompt budget');
|
|
996
|
+
}
|
|
997
|
+
if (required.includes('tadabbur')) {
|
|
998
|
+
const cookbookNames = new Set((summary.loadedCookbooks || []).map((entry) => entry.cookbookName).filter(Boolean));
|
|
999
|
+
if (!cookbookNames.has('tadabbur-cookbook.md')) gaps.push('tadabbur required but tadabbur-cookbook.md was not loaded');
|
|
1000
|
+
}
|
|
1001
|
+
return gaps;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
export function requiresFullAriaCognition(userText = '', requiredSkills = []) {
|
|
1005
|
+
const text = String(userText || '');
|
|
1006
|
+
if (/\b(?:social|casual|small talk|quick reply)\b/i.test(text)) return false;
|
|
1007
|
+
if (/\b(?:qiyas|tadabbur|taddabur|full cognition|architecture|runtime|code|coding|repo|hook|hooks|sdk|worker|workers|queue|ledger|qa|quality|audit|harness|connector|gate|skills?|cookbooks?|daemon|telemetry)\b/i.test(text)) {
|
|
1008
|
+
return true;
|
|
1009
|
+
}
|
|
1010
|
+
return requiredSkills.includes('qiyas-analogy') || requiredSkills.includes('tadabbur');
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
function ownerVisibleText(text = '') {
|
|
1014
|
+
return String(text || '')
|
|
1015
|
+
.replace(new RegExp('<!--[\\\\s\\\\S]*?-->', 'g'), '')
|
|
1016
|
+
.replace(new RegExp('<details\\\\b[\\\\s\\\\S]*?</details>', 'gi'), '')
|
|
1017
|
+
.replace(new RegExp('<gate\\\\b[\\\\s\\\\S]*?</gate>', 'gi'), '')
|
|
1018
|
+
.replace(new RegExp('<cognition\\\\b[\\\\s\\\\S]*?</cognition>', 'gi'), '')
|
|
1019
|
+
.replace(new RegExp('<applied_cognition\\\\b[\\\\s\\\\S]*?</applied_cognition>', 'gi'), '');
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
export function fullCognitionMethodGaps({ state = {}, text = '' } = {}) {
|
|
1023
|
+
const required = Array.isArray(state?.requiredSkills) ? state.requiredSkills : [];
|
|
1024
|
+
const userText = state?.userText || '';
|
|
1025
|
+
if (!requiresFullAriaCognition(userText, required)) return [];
|
|
1026
|
+
const visible = ownerVisibleText(text);
|
|
1027
|
+
const gaps = [];
|
|
1028
|
+
const qiyasLabel = new RegExp('(^|\\\\n)\\\\s*qiyas_15_pass\\\\s*:', 'i');
|
|
1029
|
+
const tadabburLabel = new RegExp('(^|\\\\n)\\\\s*tadabbur_full_canonical_12_stage\\\\s*:', 'i');
|
|
1030
|
+
const tadabburStages = new RegExp('\\\\b(?:EMBED|EXCAVATE|ROOT TRACE|INTENT TRACE|CONTRACT TRACE|CONSEQUENCE|COLLAPSE|SEPARATE|VERIFY|RECORD|DECIDE|ACT)\\\\b', 'g');
|
|
1031
|
+
if (qiyasLabel.test(visible) || (visible.match(/Owner-Hamza-(?:now|tomorrow|future)|Repo integrity|Deploy integrity|Scope discipline/g) || []).length >= 4) {
|
|
1032
|
+
gaps.push('raw Qiyas method dump is on the owner surface; collapse it into the decision and keep method evidence off the visible answer');
|
|
1033
|
+
}
|
|
1034
|
+
if (tadabburLabel.test(visible) || (visible.match(tadabburStages) || []).length >= 4) {
|
|
1035
|
+
gaps.push('raw Tadabbur stage dump is on the owner surface; collapse it into consequence-aware guidance and keep method evidence off the visible answer');
|
|
1036
|
+
}
|
|
1037
|
+
// Method coverage is proven by runtime skill-load state, not by forcing
|
|
1038
|
+
// every Qiyas/Tadabbur label into the owner-visible answer.
|
|
1039
|
+
if (new RegExp('<applied_cognition\\\\b', 'i').test(visible) || new RegExp('</applied_cognition>', 'i').test(visible)) {
|
|
1040
|
+
gaps.push('raw applied_cognition XML is on the owner surface; summarize the decision delta in prose unless a gate explicitly asks for machine-readable XML');
|
|
1041
|
+
}
|
|
1042
|
+
return gaps;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
340
1045
|
function normalizeValidationIssue(issue) {
|
|
341
1046
|
const raw = String(issue || '').replace(/\\s+/g, ' ').trim();
|
|
342
1047
|
if (!raw) return '';
|
|
343
1048
|
if (/No <cognition>/i.test(raw)) return 'missing readable cognition block';
|
|
344
1049
|
if (/missing\\s+<applied_cognition>/i.test(raw)) return 'missing applied cognition contract';
|
|
1050
|
+
if (/owner_facing_cognition_first|owner[- ]readable|Leading with <cognition>|gate surface/i.test(raw)) {
|
|
1051
|
+
return 'owner-readable answer must come before gate XML; move <cognition>/<applied_cognition> after the headline, evidence, and next action';
|
|
1052
|
+
}
|
|
1053
|
+
if (/feedback_full_harness_binding_must_be_structural|just-context-I-read|SDK has primitives|just context|advisory|read[.-]?only/i.test(raw)) {
|
|
1054
|
+
return 'structural harness binding requires executed SDK primitive evidence: name the validateOutput/checkAction/inject/gardenTurn/verifyClaim receipt, or state that no SDK primitive has run and make the next action the exact primitive call; avoid ambiguous "read-only" wording when you mean "no production writes were performed"';
|
|
1055
|
+
}
|
|
1056
|
+
if (/feedback_pretoolgate_covers_all_action_tools/i.test(raw)) {
|
|
1057
|
+
return 'doctrine wording issue: requirements must not be framed as preferences, optional paths, or fallback layers';
|
|
1058
|
+
}
|
|
1059
|
+
if (/feedback_qa_binds_to_fix_not_question|QA finding has been emitted|Recovery Contract is BINDING/i.test(raw)) {
|
|
1060
|
+
return 'QA finding requires A/B/C/D closure with evidence: fixed in turn, tracked task, scoped Mizan choice, or invalidated';
|
|
1061
|
+
}
|
|
1062
|
+
if (/feedback_no_premature_task_closeout|premature_task_closeout/i.test(raw)) {
|
|
1063
|
+
return 'completion/readiness claim needs matching verification or bounded status';
|
|
1064
|
+
}
|
|
345
1065
|
if (/qualitative_drift/i.test(raw)) return 'qualitative drift language needs a measurable predicate';
|
|
346
1066
|
if (/premature_task_closeout|feedback_no_premature_task_closeout|done\\|complete\\|completed\\|ready\\|verified\\|fixed/i.test(raw)) {
|
|
347
1067
|
return 'completion/readiness claim conflicts with unresolved blocker state';
|
|
@@ -369,26 +1089,36 @@ export function formatValidationFailure(result) {
|
|
|
369
1089
|
}
|
|
370
1090
|
|
|
371
1091
|
export function isAriaControlBlock(text) {
|
|
372
|
-
return /^(?:ARIA CODEX RECOVERY CONTRACT|Aria runtime blocked final output for this Codex turn\\.|Aria stop gate blocked output:|Aria task\\/project ledger blocked output claim\\.|Aria stop hook failed closed:)/i.test(String(text || '').trim());
|
|
1092
|
+
return /^(?:ARIA CODEX RECOVERY CONTRACT|Aria held this Codex output for re-authoring\\.|Aria runtime blocked final output for this Codex turn\\.|Aria stop gate blocked output:|Aria task\\/project ledger blocked output claim\\.|Aria stop hook failed closed:)/i.test(String(text || '').trim());
|
|
373
1093
|
}
|
|
374
1094
|
|
|
375
1095
|
export function formatCodexRecoveryBlock({ surface = 'codex', reason = '', issues = [], next = '' } = {}) {
|
|
376
1096
|
const blockers = uniqueStrings([reason, ...issues]);
|
|
1097
|
+
const hasStructuralHarnessBindingBlocker = blockers.some((item) => /structural harness binding/i.test(item));
|
|
1098
|
+
const recoveryLines = hasStructuralHarnessBindingBlocker
|
|
1099
|
+
? [
|
|
1100
|
+
'4. Structural harness binding blocker: do not repeat "SDK primitives" as prose.',
|
|
1101
|
+
'5. In the owner answer, include one concrete line: SDK evidence: <primitive> <receipt/path/status> or SDK evidence: not run yet.',
|
|
1102
|
+
'6. If not run yet, the next action must be the exact primitive call, for example validateOutput, checkAction, inject, gardenTurn, or verifyClaim.',
|
|
1103
|
+
'7. Avoid ambiguous read-only wording; say no production writes were performed when that is the actual evidence.',
|
|
1104
|
+
]
|
|
1105
|
+
: [
|
|
1106
|
+
next || '4. Re-submit the corrected answer; if this blocker repeats twice, escalate with this block report.',
|
|
1107
|
+
];
|
|
377
1108
|
return [
|
|
378
|
-
'
|
|
379
|
-
'
|
|
380
|
-
'
|
|
1109
|
+
'Aria held this Codex output for re-authoring.',
|
|
1110
|
+
'',
|
|
1111
|
+
'Surface: ' + surface,
|
|
1112
|
+
'Status: blocked before user release',
|
|
381
1113
|
'',
|
|
382
1114
|
'Observed blockers:',
|
|
383
1115
|
...(blockers.length ? blockers.map((item) => '- ' + item) : ['- Aria validation failed.']),
|
|
384
1116
|
'',
|
|
385
|
-
'
|
|
386
|
-
'1.
|
|
387
|
-
'2.
|
|
388
|
-
'3.
|
|
389
|
-
|
|
390
|
-
'5. Name a measurable verification predicate, or explicitly state that verification has not run.',
|
|
391
|
-
next || '6. Re-submit the corrected answer; if the same blocker repeats twice, escalate with this full recovery contract.',
|
|
1117
|
+
'Rewrite shape:',
|
|
1118
|
+
'1. Start with the owner-readable answer: status, evidence, next action.',
|
|
1119
|
+
'2. Keep claims bounded unless verification evidence is present.',
|
|
1120
|
+
'3. Put raw gate XML after the answer only when the gate explicitly requires it.',
|
|
1121
|
+
...recoveryLines,
|
|
392
1122
|
].join('\\n');
|
|
393
1123
|
}
|
|
394
1124
|
|
|
@@ -416,10 +1146,12 @@ export function runGovernanceGate(payload = {}) {
|
|
|
416
1146
|
}
|
|
417
1147
|
|
|
418
1148
|
function buildCodexUserPromptHook(): string {
|
|
1149
|
+
return readCanonicalCodexHook('aria-userprompt-submit.mjs');
|
|
419
1150
|
return `#!/usr/bin/env node
|
|
420
1151
|
import {
|
|
421
1152
|
getHarnessClient,
|
|
422
1153
|
inferSessionId,
|
|
1154
|
+
inferHiveThreadId,
|
|
423
1155
|
inferUserId,
|
|
424
1156
|
ensureTraceId,
|
|
425
1157
|
extractUserText,
|
|
@@ -429,19 +1161,41 @@ import {
|
|
|
429
1161
|
recordCoachPhase,
|
|
430
1162
|
loadTurnState,
|
|
431
1163
|
saveTurnState,
|
|
1164
|
+
inferRequiredAriaSkills,
|
|
1165
|
+
summarizeForcedSkillLoad,
|
|
1166
|
+
forcedSkillLoadGaps,
|
|
1167
|
+
buildUniversalConnectorGoalContract,
|
|
432
1168
|
runGovernanceGate,
|
|
1169
|
+
recordHiveSessionLifecycle,
|
|
433
1170
|
updateTaskProjectLedger,
|
|
434
1171
|
formatCodexRecoveryBlock,
|
|
435
1172
|
emitJson,
|
|
436
1173
|
} from './lib/runtime-client.mjs';
|
|
437
1174
|
|
|
1175
|
+
const ARIA_QA_AUTOFIRE_CYCLE = Object.freeze([
|
|
1176
|
+
'qiyas_15_pass',
|
|
1177
|
+
'tadabbur_full_canonical_12_stage',
|
|
1178
|
+
'correct',
|
|
1179
|
+
'enhance',
|
|
1180
|
+
'harden',
|
|
1181
|
+
'verify',
|
|
1182
|
+
]);
|
|
1183
|
+
|
|
1184
|
+
const ARIA_QA_METHOD_CONTRACT = Object.freeze({
|
|
1185
|
+
qiyas: 'Qiyas means full Qiyas-15 only. Mini Qiyas is not acceptable for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1186
|
+
tadabbur: 'Tadabbur means the full canonical 12-stage Tadabbur path for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1187
|
+
});
|
|
1188
|
+
|
|
438
1189
|
const event = readEventFromStdin();
|
|
439
1190
|
const client = getHarnessClient();
|
|
440
1191
|
const userText = extractUserText(event);
|
|
441
1192
|
const sessionId = inferSessionId(event);
|
|
1193
|
+
const hiveThreadId = inferHiveThreadId(event, sessionId);
|
|
442
1194
|
const userId = inferUserId(event);
|
|
443
1195
|
const priorState = loadTurnState(sessionId);
|
|
444
1196
|
const traceId = ensureTraceId(priorState);
|
|
1197
|
+
const requiredSkills = inferRequiredAriaSkills(userText);
|
|
1198
|
+
const goalContract = buildUniversalConnectorGoalContract({ userText, phase: 'pre_prompt' });
|
|
445
1199
|
const ledgerResult = updateTaskProjectLedger({
|
|
446
1200
|
platform: 'codex',
|
|
447
1201
|
phase: 'pre_prompt_injection',
|
|
@@ -450,6 +1204,15 @@ const ledgerResult = updateTaskProjectLedger({
|
|
|
450
1204
|
});
|
|
451
1205
|
|
|
452
1206
|
try {
|
|
1207
|
+
const lifecycleStart = await recordHiveSessionLifecycle({
|
|
1208
|
+
sessionId,
|
|
1209
|
+
threadId: hiveThreadId,
|
|
1210
|
+
event: 'turn_start',
|
|
1211
|
+
status: 'active',
|
|
1212
|
+
intentSummary: userText.slice(0, 240) || 'Codex session turn started',
|
|
1213
|
+
source: 'codex-userprompt-hook',
|
|
1214
|
+
body: { traceId, userId, goalContract },
|
|
1215
|
+
});
|
|
453
1216
|
await recordCoachPhase('pre_turn', {
|
|
454
1217
|
requestId: traceId,
|
|
455
1218
|
sessionId,
|
|
@@ -488,20 +1251,81 @@ try {
|
|
|
488
1251
|
platform: 'codex',
|
|
489
1252
|
userText,
|
|
490
1253
|
userId,
|
|
1254
|
+
goalContract,
|
|
491
1255
|
evidenceRefs: [packetRef],
|
|
492
1256
|
},
|
|
493
1257
|
});
|
|
1258
|
+
let forcedSkillLoad = null;
|
|
1259
|
+
if (requiredSkills.length > 0) {
|
|
1260
|
+
try {
|
|
1261
|
+
const promptBuild = await runtimePost('/build-system-prompt', {
|
|
1262
|
+
sessionId,
|
|
1263
|
+
message: userText || 'codex forced skill load',
|
|
1264
|
+
requiredSkills,
|
|
1265
|
+
metadata: {
|
|
1266
|
+
source: 'codex-userprompt-submit',
|
|
1267
|
+
cookbookMode: 'required-when-referenced',
|
|
1268
|
+
skillExecutionMode: 'mechanical-receipt',
|
|
1269
|
+
goalContract,
|
|
1270
|
+
},
|
|
1271
|
+
skillExecutionMode: 'mechanical-receipt',
|
|
1272
|
+
});
|
|
1273
|
+
forcedSkillLoad = summarizeForcedSkillLoad(promptBuild);
|
|
1274
|
+
forcedSkillLoad.gaps = forcedSkillLoadGaps({ requiredSkills, forcedSkillLoad });
|
|
1275
|
+
} catch (error) {
|
|
1276
|
+
forcedSkillLoad = {
|
|
1277
|
+
ok: false,
|
|
1278
|
+
requiredSkillIds: requiredSkills,
|
|
1279
|
+
loadedSkillIds: [],
|
|
1280
|
+
missingSkillIds: [],
|
|
1281
|
+
loadedSkillHashes: [],
|
|
1282
|
+
loadedCookbooks: [],
|
|
1283
|
+
missingCookbooks: [],
|
|
1284
|
+
promptSha256: null,
|
|
1285
|
+
promptChars: 0,
|
|
1286
|
+
gaps: ['forced skill autofire runtime call failed: ' + (error instanceof Error ? error.message : String(error))],
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
494
1290
|
await recordCoachPhase('post_cognition', {
|
|
495
1291
|
requestId: traceId,
|
|
496
1292
|
sessionId,
|
|
497
1293
|
text: userText,
|
|
498
|
-
evidenceRefs: [
|
|
499
|
-
|
|
1294
|
+
evidenceRefs: [
|
|
1295
|
+
packetRef,
|
|
1296
|
+
makeEvidenceRef('mizan_pre_receipt', result?.receipt || null, { sessionId, traceId }),
|
|
1297
|
+
...(forcedSkillLoad ? [makeEvidenceRef('forced_skill_load', forcedSkillLoad, { sessionId, traceId })] : []),
|
|
1298
|
+
],
|
|
1299
|
+
metadata: {
|
|
1300
|
+
source: 'codex-userprompt-hook',
|
|
1301
|
+
pre_receipt_id: result?.receipt?.receiptId || null,
|
|
1302
|
+
requiredSkills,
|
|
1303
|
+
forcedSkillLoad,
|
|
1304
|
+
goalContract,
|
|
1305
|
+
hiveThreadId,
|
|
1306
|
+
lifecycleStart,
|
|
1307
|
+
qaAutofire: {
|
|
1308
|
+
mode: 'always-on-15',
|
|
1309
|
+
phase: 'pre_turn',
|
|
1310
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1311
|
+
},
|
|
1312
|
+
},
|
|
500
1313
|
});
|
|
501
1314
|
saveTurnState(sessionId, {
|
|
502
1315
|
traceId,
|
|
503
1316
|
userId,
|
|
504
1317
|
userText,
|
|
1318
|
+
requiredSkills,
|
|
1319
|
+
forcedSkillLoad,
|
|
1320
|
+
goalContract,
|
|
1321
|
+
forcedSkillLoadEnforced: false,
|
|
1322
|
+
forcedSkillAutofire: requiredSkills.length > 0,
|
|
1323
|
+
hiveThreadId,
|
|
1324
|
+
lifecycleStart,
|
|
1325
|
+
qaAutofire: {
|
|
1326
|
+
mode: 'always-on-15',
|
|
1327
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1328
|
+
},
|
|
505
1329
|
preReceiptId: result?.receipt?.receiptId || null,
|
|
506
1330
|
taskProjectLedgerId: ledgerResult.ledger.ledgerId,
|
|
507
1331
|
packetTimestamp: packet?.timestamp || null,
|
|
@@ -522,7 +1346,16 @@ try {
|
|
|
522
1346
|
`;
|
|
523
1347
|
}
|
|
524
1348
|
|
|
1349
|
+
function buildCodexLiveTickerHook(): string {
|
|
1350
|
+
return readCanonicalCodexHook('aria-live-ticker.mjs');
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
function buildCodexHarnessTickerSidecar(): string {
|
|
1354
|
+
return readCanonicalCodexHook('aria-harness-ticker-sidecar.mjs');
|
|
1355
|
+
}
|
|
1356
|
+
|
|
525
1357
|
function buildCodexPreToolHook(): string {
|
|
1358
|
+
return readCanonicalCodexHook('aria-pre-tool-use.mjs');
|
|
526
1359
|
return `#!/usr/bin/env node
|
|
527
1360
|
import {
|
|
528
1361
|
inferSessionId,
|
|
@@ -532,29 +1365,86 @@ import {
|
|
|
532
1365
|
loadTurnState,
|
|
533
1366
|
makeEvidenceRef,
|
|
534
1367
|
recordCoachPhase,
|
|
1368
|
+
ensurePreTurnMizanReceipt,
|
|
1369
|
+
runGovernanceGate,
|
|
535
1370
|
saveTurnState,
|
|
1371
|
+
forcedSkillLoadGaps,
|
|
1372
|
+
extractToolTouchedFiles,
|
|
1373
|
+
recordHiveFileTouch,
|
|
1374
|
+
recordHiveSessionLifecycle,
|
|
536
1375
|
formatCodexRecoveryBlock,
|
|
537
1376
|
emitJson,
|
|
538
1377
|
} from './lib/runtime-client.mjs';
|
|
539
1378
|
|
|
1379
|
+
const ARIA_QA_AUTOFIRE_CYCLE = Object.freeze([
|
|
1380
|
+
'qiyas_15_pass',
|
|
1381
|
+
'tadabbur_full_canonical_12_stage',
|
|
1382
|
+
'correct',
|
|
1383
|
+
'enhance',
|
|
1384
|
+
'harden',
|
|
1385
|
+
'verify',
|
|
1386
|
+
]);
|
|
1387
|
+
|
|
1388
|
+
const ARIA_QA_METHOD_CONTRACT = Object.freeze({
|
|
1389
|
+
qiyas: 'Qiyas means full Qiyas-15 only. Mini Qiyas is not acceptable for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1390
|
+
tadabbur: 'Tadabbur means the full canonical 12-stage Tadabbur path for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1391
|
+
});
|
|
1392
|
+
|
|
540
1393
|
const event = readEventFromStdin();
|
|
541
1394
|
const sessionId = inferSessionId(event);
|
|
542
1395
|
const action = classifyAction(event);
|
|
543
1396
|
const target = summarizeTarget(event);
|
|
544
|
-
|
|
1397
|
+
let state = loadTurnState(sessionId);
|
|
545
1398
|
|
|
546
1399
|
try {
|
|
547
|
-
if (!state?.preReceiptId
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
1400
|
+
if (!state?.preReceiptId) {
|
|
1401
|
+
try {
|
|
1402
|
+
const healed = await ensurePreTurnMizanReceipt({
|
|
1403
|
+
sessionId,
|
|
1404
|
+
traceId: state?.traceId || sessionId,
|
|
1405
|
+
state,
|
|
1406
|
+
event,
|
|
1407
|
+
action,
|
|
1408
|
+
target,
|
|
1409
|
+
});
|
|
1410
|
+
state = healed.state || state;
|
|
1411
|
+
if (!healed.ok) {
|
|
1412
|
+
emitJson({
|
|
1413
|
+
decision: 'block',
|
|
1414
|
+
reason: 'Codex pre-tool gate could not mint a real Mizan pre-turn receipt from the mounted runtime. Runtime returned no receipt id; tool use is blocked until the runtime receipt path is healthy.',
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
} catch (error) {
|
|
1418
|
+
emitJson({
|
|
1419
|
+
decision: 'block',
|
|
1420
|
+
reason: 'Codex pre-tool gate could not mint a real Mizan pre-turn receipt from the mounted runtime: ' + (error instanceof Error ? error.message : String(error)),
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
556
1423
|
}
|
|
1424
|
+
const forcedSkillGaps = forcedSkillLoadGaps(state);
|
|
557
1425
|
const toolName = String(event?.tool_name || event?.toolName || '').trim() || null;
|
|
1426
|
+
const touchedFiles = extractToolTouchedFiles(event, action);
|
|
1427
|
+
const hiveThreadId = state?.hiveThreadId || null;
|
|
1428
|
+
const hiveTouch = await recordHiveFileTouch({
|
|
1429
|
+
sessionId,
|
|
1430
|
+
threadId: hiveThreadId,
|
|
1431
|
+
event: 'pre_tool',
|
|
1432
|
+
files: touchedFiles,
|
|
1433
|
+
source: 'codex-pre-tool-hook',
|
|
1434
|
+
body: { action, toolName, target },
|
|
1435
|
+
});
|
|
1436
|
+
const hiveLifecycle = touchedFiles.length > 0
|
|
1437
|
+
? await recordHiveSessionLifecycle({
|
|
1438
|
+
sessionId,
|
|
1439
|
+
threadId: hiveThreadId,
|
|
1440
|
+
event: 'tool_claim',
|
|
1441
|
+
status: 'active',
|
|
1442
|
+
intentSummary: \`Codex tool requested \${action}\${toolName ? ' via ' + toolName : ''}\`,
|
|
1443
|
+
fileClaims: touchedFiles,
|
|
1444
|
+
source: 'codex-pre-tool-hook',
|
|
1445
|
+
body: { action, toolName, target },
|
|
1446
|
+
})
|
|
1447
|
+
: { ok: true, skipped: true, reason: 'no touched files' };
|
|
558
1448
|
const requestRef = makeEvidenceRef('codex_tool_request', { action, toolName, target }, { sessionId });
|
|
559
1449
|
const coach = await recordCoachPhase('pre_tool', {
|
|
560
1450
|
requestId: state?.traceId || sessionId,
|
|
@@ -563,7 +1453,22 @@ try {
|
|
|
563
1453
|
action,
|
|
564
1454
|
target,
|
|
565
1455
|
evidenceRefs: [requestRef],
|
|
566
|
-
metadata: {
|
|
1456
|
+
metadata: {
|
|
1457
|
+
source: 'codex-pre-tool-hook',
|
|
1458
|
+
toolName,
|
|
1459
|
+
requireVerify: action === 'deploy' || action === 'delete',
|
|
1460
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : [],
|
|
1461
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1462
|
+
forcedSkillGaps,
|
|
1463
|
+
touchedFiles,
|
|
1464
|
+
hiveTouch,
|
|
1465
|
+
hiveLifecycle,
|
|
1466
|
+
qaAutofire: {
|
|
1467
|
+
mode: 'always-on-15',
|
|
1468
|
+
phase: 'pre_tool',
|
|
1469
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1470
|
+
},
|
|
1471
|
+
},
|
|
567
1472
|
});
|
|
568
1473
|
if (coach?.permitted === false) {
|
|
569
1474
|
emitJson({
|
|
@@ -575,12 +1480,63 @@ try {
|
|
|
575
1480
|
}),
|
|
576
1481
|
});
|
|
577
1482
|
}
|
|
1483
|
+
let gateEvidence = null;
|
|
1484
|
+
try {
|
|
1485
|
+
gateEvidence = runGovernanceGate({
|
|
1486
|
+
sessionId,
|
|
1487
|
+
sourceRuntime: 'codex',
|
|
1488
|
+
surface: 'codex-pre-tool-use',
|
|
1489
|
+
text: JSON.stringify(event).slice(0, 8000),
|
|
1490
|
+
action,
|
|
1491
|
+
toolName,
|
|
1492
|
+
isDeploy: action === 'deploy',
|
|
1493
|
+
isMutation: action === 'write' || action === 'delete',
|
|
1494
|
+
evidence: requestRef,
|
|
1495
|
+
});
|
|
1496
|
+
} catch {}
|
|
1497
|
+
if (gateEvidence) {
|
|
1498
|
+
const gateRef = makeEvidenceRef('governance_gate', gateEvidence, { sessionId, action, toolName });
|
|
1499
|
+
const gateCoach = await recordCoachPhase('pre_tool', {
|
|
1500
|
+
requestId: state?.traceId || sessionId,
|
|
1501
|
+
sessionId,
|
|
1502
|
+
text: target,
|
|
1503
|
+
action,
|
|
1504
|
+
target,
|
|
1505
|
+
evidenceRefs: [requestRef, gateRef],
|
|
1506
|
+
metadata: {
|
|
1507
|
+
source: 'codex-pre-tool-hook',
|
|
1508
|
+
toolName,
|
|
1509
|
+
governanceGate: gateEvidence,
|
|
1510
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : [],
|
|
1511
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1512
|
+
forcedSkillGaps,
|
|
1513
|
+
qaAutofire: {
|
|
1514
|
+
mode: 'always-on-15',
|
|
1515
|
+
phase: 'pre_tool_gate_signal',
|
|
1516
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1517
|
+
},
|
|
1518
|
+
},
|
|
1519
|
+
});
|
|
1520
|
+
if (gateCoach?.permitted === false) {
|
|
1521
|
+
emitJson({
|
|
1522
|
+
decision: 'block',
|
|
1523
|
+
reason: formatCodexRecoveryBlock({
|
|
1524
|
+
surface: 'codex-pre-tool-gate-coach',
|
|
1525
|
+
reason: gateCoach.clientMessage || 'Coach Kernel denied after governance gate signal.',
|
|
1526
|
+
next: '6. Repair the condition flagged by the governance gate, then request the tool again.',
|
|
1527
|
+
}),
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
578
1531
|
const tools = Array.isArray(state?.tools) ? state.tools.slice(-24) : [];
|
|
579
1532
|
tools.push({
|
|
580
1533
|
at: new Date().toISOString(),
|
|
581
1534
|
action,
|
|
582
1535
|
toolName,
|
|
583
1536
|
target,
|
|
1537
|
+
touchedFiles,
|
|
1538
|
+
hiveTouch,
|
|
1539
|
+
hiveLifecycle,
|
|
584
1540
|
evidenceRef: makeEvidenceRef('tool_request', { action, toolName, target }, { sessionId }),
|
|
585
1541
|
});
|
|
586
1542
|
saveTurnState(sessionId, {
|
|
@@ -601,6 +1557,7 @@ try {
|
|
|
601
1557
|
}
|
|
602
1558
|
|
|
603
1559
|
function buildCodexPostToolHook(): string {
|
|
1560
|
+
return readCanonicalCodexHook('aria-post-tool-use.mjs');
|
|
604
1561
|
return `#!/usr/bin/env node
|
|
605
1562
|
import {
|
|
606
1563
|
inferSessionId,
|
|
@@ -609,15 +1566,63 @@ import {
|
|
|
609
1566
|
makeEvidenceRef,
|
|
610
1567
|
recordCoachPhase,
|
|
611
1568
|
saveTurnState,
|
|
1569
|
+
forcedSkillLoadGaps,
|
|
1570
|
+
classifyAction,
|
|
1571
|
+
extractToolTouchedFiles,
|
|
1572
|
+
recordHiveFileTouch,
|
|
1573
|
+
recordHiveSessionLifecycle,
|
|
612
1574
|
updateTaskProjectLedger,
|
|
613
1575
|
} from './lib/runtime-client.mjs';
|
|
614
1576
|
|
|
1577
|
+
const ARIA_QA_AUTOFIRE_CYCLE = Object.freeze([
|
|
1578
|
+
'qiyas_15_pass',
|
|
1579
|
+
'tadabbur_full_canonical_12_stage',
|
|
1580
|
+
'correct',
|
|
1581
|
+
'enhance',
|
|
1582
|
+
'harden',
|
|
1583
|
+
'verify',
|
|
1584
|
+
]);
|
|
1585
|
+
|
|
1586
|
+
const ARIA_QA_METHOD_CONTRACT = Object.freeze({
|
|
1587
|
+
qiyas: 'Qiyas means full Qiyas-15 only. Mini Qiyas is not acceptable for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1588
|
+
tadabbur: 'Tadabbur means the full canonical 12-stage Tadabbur path for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1589
|
+
});
|
|
1590
|
+
|
|
615
1591
|
const event = readEventFromStdin();
|
|
616
1592
|
const sessionId = inferSessionId(event);
|
|
617
1593
|
const state = loadTurnState(sessionId);
|
|
618
1594
|
|
|
619
1595
|
try {
|
|
620
1596
|
const toolResponse = JSON.stringify(event?.tool_response ?? event?.toolResponse ?? null).slice(0, 4000);
|
|
1597
|
+
const action = classifyAction(event);
|
|
1598
|
+
const touchedFiles = extractToolTouchedFiles(event, action);
|
|
1599
|
+
const hiveThreadId = state?.hiveThreadId || null;
|
|
1600
|
+
const hiveTouch = await recordHiveFileTouch({
|
|
1601
|
+
sessionId,
|
|
1602
|
+
threadId: hiveThreadId,
|
|
1603
|
+
event: 'post_tool',
|
|
1604
|
+
files: touchedFiles,
|
|
1605
|
+
source: 'codex-post-tool-hook',
|
|
1606
|
+
body: {
|
|
1607
|
+
action,
|
|
1608
|
+
toolName: event?.tool_name || event?.toolName || null,
|
|
1609
|
+
success: !event?.error,
|
|
1610
|
+
},
|
|
1611
|
+
});
|
|
1612
|
+
const hiveLifecycle = await recordHiveSessionLifecycle({
|
|
1613
|
+
sessionId,
|
|
1614
|
+
threadId: hiveThreadId,
|
|
1615
|
+
event: event?.error ? 'tool_error' : 'tool_complete',
|
|
1616
|
+
status: event?.error ? 'needs_review' : 'active',
|
|
1617
|
+
intentSummary: event?.error ? 'Codex tool returned an error' : 'Codex tool completed',
|
|
1618
|
+
fileClaims: touchedFiles,
|
|
1619
|
+
source: 'codex-post-tool-hook',
|
|
1620
|
+
body: {
|
|
1621
|
+
action,
|
|
1622
|
+
toolName: event?.tool_name || event?.toolName || null,
|
|
1623
|
+
success: !event?.error,
|
|
1624
|
+
},
|
|
1625
|
+
});
|
|
621
1626
|
const evidenceRef = makeEvidenceRef('tool_response', event?.tool_response ?? event?.toolResponse ?? null, {
|
|
622
1627
|
sessionId,
|
|
623
1628
|
toolName: event?.tool_name || event?.toolName || null,
|
|
@@ -625,6 +1630,7 @@ try {
|
|
|
625
1630
|
const toolOutputs = Array.isArray(state?.toolOutputs) ? state.toolOutputs.slice(-24) : [];
|
|
626
1631
|
const verificationText = JSON.stringify(event).slice(0, 8000);
|
|
627
1632
|
const verification = !event?.error && /\\b(?:npm\\s+run\\s+(?:check|test|build|lint|typecheck)|(?:npx\\s+)?(?:jest|vitest|tsc|eslint)|check:|test:|build:|passed|exit\\s*0|0\\s*failures?)\\b/i.test(verificationText);
|
|
1633
|
+
const forcedSkillGaps = forcedSkillLoadGaps(state);
|
|
628
1634
|
await recordCoachPhase('post_tool', {
|
|
629
1635
|
requestId: state?.traceId || sessionId,
|
|
630
1636
|
sessionId,
|
|
@@ -635,12 +1641,27 @@ try {
|
|
|
635
1641
|
toolName: event?.tool_name || event?.toolName || null,
|
|
636
1642
|
verification,
|
|
637
1643
|
error: event?.error || null,
|
|
1644
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : [],
|
|
1645
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1646
|
+
forcedSkillGaps,
|
|
1647
|
+
touchedFiles,
|
|
1648
|
+
hiveTouch,
|
|
1649
|
+
hiveLifecycle,
|
|
1650
|
+
qaAutofire: {
|
|
1651
|
+
mode: 'always-on-15',
|
|
1652
|
+
phase: 'post_tool',
|
|
1653
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1654
|
+
},
|
|
638
1655
|
},
|
|
639
1656
|
});
|
|
640
1657
|
toolOutputs.push({
|
|
641
1658
|
at: new Date().toISOString(),
|
|
642
1659
|
toolName: event?.tool_name || event?.toolName || null,
|
|
643
1660
|
toolResponse,
|
|
1661
|
+
action,
|
|
1662
|
+
touchedFiles,
|
|
1663
|
+
hiveTouch,
|
|
1664
|
+
hiveLifecycle,
|
|
644
1665
|
evidenceRef,
|
|
645
1666
|
});
|
|
646
1667
|
saveTurnState(sessionId, {
|
|
@@ -656,6 +1677,14 @@ try {
|
|
|
656
1677
|
outcome_ref: evidenceRef,
|
|
657
1678
|
verification,
|
|
658
1679
|
commandResult: verification ? 'success' : '',
|
|
1680
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : [],
|
|
1681
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1682
|
+
forcedSkillGaps,
|
|
1683
|
+
qaAutofire: {
|
|
1684
|
+
mode: 'always-on-15',
|
|
1685
|
+
phase: 'post_tool',
|
|
1686
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1687
|
+
},
|
|
659
1688
|
},
|
|
660
1689
|
});
|
|
661
1690
|
process.exit(0);
|
|
@@ -666,31 +1695,55 @@ try {
|
|
|
666
1695
|
}
|
|
667
1696
|
|
|
668
1697
|
function buildCodexStopHook(): string {
|
|
1698
|
+
return readCanonicalCodexHook('aria-stop.mjs');
|
|
669
1699
|
return `#!/usr/bin/env node
|
|
670
1700
|
import {
|
|
671
1701
|
inferSessionId,
|
|
672
1702
|
extractAssistantText,
|
|
673
1703
|
readEventFromStdin,
|
|
674
1704
|
runtimePost,
|
|
1705
|
+
recordHiveSessionLifecycle,
|
|
675
1706
|
recordCoachPhase,
|
|
676
1707
|
loadTurnState,
|
|
677
1708
|
makeEvidenceRef,
|
|
678
1709
|
clearTurnState,
|
|
1710
|
+
inferRequiredAriaSkills,
|
|
1711
|
+
forcedSkillLoadGaps,
|
|
1712
|
+
fullCognitionMethodGaps,
|
|
1713
|
+
buildUniversalConnectorGoalContract,
|
|
1714
|
+
evaluateGoalContractOutput,
|
|
679
1715
|
formatValidationFailure,
|
|
680
1716
|
formatCodexRecoveryBlock,
|
|
681
1717
|
isAriaControlBlock,
|
|
1718
|
+
runGovernanceGate,
|
|
682
1719
|
updateTaskProjectLedger,
|
|
683
1720
|
evaluateTaskProjectClaim,
|
|
684
1721
|
recordBlockedTaskProjectClaim,
|
|
685
1722
|
emitJson,
|
|
686
1723
|
} from './lib/runtime-client.mjs';
|
|
687
1724
|
|
|
1725
|
+
const ARIA_QA_AUTOFIRE_CYCLE = Object.freeze([
|
|
1726
|
+
'qiyas_15_pass',
|
|
1727
|
+
'tadabbur_full_canonical_12_stage',
|
|
1728
|
+
'correct',
|
|
1729
|
+
'enhance',
|
|
1730
|
+
'harden',
|
|
1731
|
+
'verify',
|
|
1732
|
+
]);
|
|
1733
|
+
|
|
1734
|
+
const ARIA_QA_METHOD_CONTRACT = Object.freeze({
|
|
1735
|
+
qiyas: 'Qiyas means full Qiyas-15 only. Mini Qiyas is not acceptable for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1736
|
+
tadabbur: 'Tadabbur means the full canonical 12-stage Tadabbur path for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1737
|
+
});
|
|
1738
|
+
|
|
688
1739
|
const event = readEventFromStdin();
|
|
689
1740
|
const sessionId = inferSessionId(event);
|
|
690
1741
|
const state = loadTurnState(sessionId);
|
|
691
1742
|
const text = extractAssistantText(event);
|
|
1743
|
+
|
|
692
1744
|
const outputRef = makeEvidenceRef('assistant_output', text, { sessionId, traceId: state?.traceId || null });
|
|
693
1745
|
const toolRefs = Array.isArray(state?.toolOutputs) ? state.toolOutputs.map((entry) => entry.evidenceRef).filter(Boolean) : [];
|
|
1746
|
+
const inferredRequiredSkills = inferRequiredAriaSkills(state?.userText || '');
|
|
694
1747
|
const ledgerResult = updateTaskProjectLedger({
|
|
695
1748
|
platform: 'codex',
|
|
696
1749
|
phase: 'stop',
|
|
@@ -706,12 +1759,60 @@ try {
|
|
|
706
1759
|
clearTurnState(sessionId);
|
|
707
1760
|
emitJson({ continue: true });
|
|
708
1761
|
}
|
|
1762
|
+
const forcedSkillGaps = forcedSkillLoadGaps(state);
|
|
1763
|
+
const cognitionMethodGaps = fullCognitionMethodGaps({ state, text });
|
|
1764
|
+
if (cognitionMethodGaps.length > 0) {
|
|
1765
|
+
emitJson({
|
|
1766
|
+
decision: 'block',
|
|
1767
|
+
reason: formatCodexRecoveryBlock({
|
|
1768
|
+
surface: 'codex-stop-full-cognition-method',
|
|
1769
|
+
reason: 'owner-facing output contains raw cognition method dump',
|
|
1770
|
+
issues: cognitionMethodGaps,
|
|
1771
|
+
next: '4. Re-author as a professional owner-readable closeout: one status line, 2-4 evidence bullets, concrete next action. Do not paste qiyas_15_pass, Tadabbur stages, or raw applied_cognition into the visible answer.',
|
|
1772
|
+
}),
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
const qaAutofire = {
|
|
1776
|
+
mode: 'always-on-15',
|
|
1777
|
+
phase: 'stop',
|
|
1778
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1779
|
+
methodContract: ARIA_QA_METHOD_CONTRACT,
|
|
1780
|
+
};
|
|
1781
|
+
const goalContract = state?.goalContract || buildUniversalConnectorGoalContract({
|
|
1782
|
+
userText: state?.userText || '',
|
|
1783
|
+
phase: 'stop',
|
|
1784
|
+
});
|
|
1785
|
+
const goalQa = evaluateGoalContractOutput(text, {
|
|
1786
|
+
userText: state?.userText || '',
|
|
1787
|
+
goalContract,
|
|
1788
|
+
});
|
|
1789
|
+
if (goalQa.hardBlock) {
|
|
1790
|
+
emitJson({
|
|
1791
|
+
decision: 'block',
|
|
1792
|
+
reason: formatCodexRecoveryBlock({
|
|
1793
|
+
surface: 'codex-stop-goal-contract',
|
|
1794
|
+
reason: 'active goal contract rejected drift or false completion risk',
|
|
1795
|
+
issues: [...goalQa.blockers, ...goalQa.repairs],
|
|
1796
|
+
next: '4. Re-author around the actual corpus-to-runtime wiring goal, name the next highest-impact action, include QA/correction/evidence, and keep receipts/gates as support only.',
|
|
1797
|
+
}),
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
709
1800
|
const postGenerationCoach = await recordCoachPhase('post_generation', {
|
|
710
1801
|
requestId: state?.traceId || sessionId,
|
|
711
1802
|
sessionId,
|
|
712
1803
|
text,
|
|
713
1804
|
evidenceRefs: [outputRef],
|
|
714
|
-
metadata: {
|
|
1805
|
+
metadata: {
|
|
1806
|
+
source: 'codex-stop-hook',
|
|
1807
|
+
requireCognitionBlock: false,
|
|
1808
|
+
requireAppliedCognition: false,
|
|
1809
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1810
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1811
|
+
forcedSkillGaps,
|
|
1812
|
+
goalContract,
|
|
1813
|
+
goalQa,
|
|
1814
|
+
qaAutofire: { ...qaAutofire, phase: 'post_generation' },
|
|
1815
|
+
},
|
|
715
1816
|
});
|
|
716
1817
|
if (postGenerationCoach?.permitted === false) {
|
|
717
1818
|
emitJson({
|
|
@@ -722,6 +1823,17 @@ try {
|
|
|
722
1823
|
}),
|
|
723
1824
|
});
|
|
724
1825
|
}
|
|
1826
|
+
let gateEvidence = null;
|
|
1827
|
+
try {
|
|
1828
|
+
gateEvidence = runGovernanceGate({
|
|
1829
|
+
sessionId,
|
|
1830
|
+
sourceRuntime: 'codex',
|
|
1831
|
+
surface: 'codex-stop',
|
|
1832
|
+
text: text.slice(0, 8000),
|
|
1833
|
+
isOutputCloseout: true,
|
|
1834
|
+
evidence: outputRef,
|
|
1835
|
+
});
|
|
1836
|
+
} catch {}
|
|
725
1837
|
const ledgerClaim = evaluateTaskProjectClaim({ text, ledger: ledgerResult.ledger });
|
|
726
1838
|
if (!ledgerClaim.ok) {
|
|
727
1839
|
recordBlockedTaskProjectClaim({
|
|
@@ -763,8 +1875,19 @@ try {
|
|
|
763
1875
|
text,
|
|
764
1876
|
validation: validation?.validation || null,
|
|
765
1877
|
layer3: validation?.layer3 || null,
|
|
766
|
-
evidenceRefs: [outputRef, makeEvidenceRef('runtime_validation', validation, { sessionId, traceId: state?.traceId || null })],
|
|
767
|
-
metadata: {
|
|
1878
|
+
evidenceRefs: [outputRef, makeEvidenceRef('runtime_validation', validation, { sessionId, traceId: state?.traceId || null }), ...(gateEvidence ? [makeEvidenceRef('governance_gate', gateEvidence, { sessionId })] : [])],
|
|
1879
|
+
metadata: {
|
|
1880
|
+
source: 'codex-stop-hook',
|
|
1881
|
+
requireCognitionBlock: false,
|
|
1882
|
+
requireAppliedCognition: false,
|
|
1883
|
+
governanceGate: gateEvidence || null,
|
|
1884
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1885
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1886
|
+
forcedSkillGaps,
|
|
1887
|
+
goalContract,
|
|
1888
|
+
goalQa,
|
|
1889
|
+
qaAutofire: { ...qaAutofire, phase: 'pre_output' },
|
|
1890
|
+
},
|
|
768
1891
|
});
|
|
769
1892
|
if (preOutputCoach?.permitted === false) {
|
|
770
1893
|
emitJson({
|
|
@@ -796,6 +1919,12 @@ try {
|
|
|
796
1919
|
trace_id: state?.traceId || null,
|
|
797
1920
|
output_ref: outputRef,
|
|
798
1921
|
tool_refs: toolRefs,
|
|
1922
|
+
required_skills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1923
|
+
forced_skill_load: state?.forcedSkillLoad || null,
|
|
1924
|
+
forced_skill_gaps: forcedSkillGaps,
|
|
1925
|
+
goal_contract: goalContract,
|
|
1926
|
+
goal_qa: goalQa,
|
|
1927
|
+
qa_autofire: { ...qaAutofire, phase: 'mizan_post' },
|
|
799
1928
|
},
|
|
800
1929
|
context: {
|
|
801
1930
|
sessionId,
|
|
@@ -816,7 +1945,17 @@ try {
|
|
|
816
1945
|
outputRef,
|
|
817
1946
|
makeEvidenceRef('mizan_post_receipt', post?.receipt || null, { sessionId, traceId: state?.traceId || null }),
|
|
818
1947
|
],
|
|
819
|
-
metadata: {
|
|
1948
|
+
metadata: {
|
|
1949
|
+
source: 'codex-stop-hook',
|
|
1950
|
+
requireCognitionBlock: false,
|
|
1951
|
+
requireAppliedCognition: false,
|
|
1952
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1953
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1954
|
+
forcedSkillGaps,
|
|
1955
|
+
goalContract,
|
|
1956
|
+
goalQa,
|
|
1957
|
+
qaAutofire: { ...qaAutofire, phase: 'post_output' },
|
|
1958
|
+
},
|
|
820
1959
|
});
|
|
821
1960
|
await runtimePost('/decision/log', {
|
|
822
1961
|
session_id: sessionId,
|
|
@@ -837,6 +1976,12 @@ try {
|
|
|
837
1976
|
tool_count: Array.isArray(state?.tools) ? state.tools.length : 0,
|
|
838
1977
|
validation_severity: validation?.validation?.severity || 'pass',
|
|
839
1978
|
layer3_pass: validation?.layer3?.pass !== false,
|
|
1979
|
+
required_skills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1980
|
+
forced_skill_load: state?.forcedSkillLoad || null,
|
|
1981
|
+
forced_skill_gaps: forcedSkillGaps,
|
|
1982
|
+
goal_contract: goalContract,
|
|
1983
|
+
goal_qa: goalQa,
|
|
1984
|
+
qa_autofire: { ...qaAutofire, phase: 'decision_log' },
|
|
840
1985
|
},
|
|
841
1986
|
});
|
|
842
1987
|
if (typeof state?.userText === 'string' && state.userText.trim()) {
|
|
@@ -851,6 +1996,12 @@ try {
|
|
|
851
1996
|
decision_category: 'codex-hooks',
|
|
852
1997
|
trace_id: state?.traceId || null,
|
|
853
1998
|
output_ref: outputRef,
|
|
1999
|
+
required_skills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
2000
|
+
forced_skill_load: state?.forcedSkillLoad || null,
|
|
2001
|
+
forced_skill_gaps: forcedSkillGaps,
|
|
2002
|
+
goal_contract: goalContract,
|
|
2003
|
+
goal_qa: goalQa,
|
|
2004
|
+
qa_autofire: { ...qaAutofire, phase: 'garden_turn' },
|
|
854
2005
|
},
|
|
855
2006
|
});
|
|
856
2007
|
}
|
|
@@ -863,6 +2014,12 @@ try {
|
|
|
863
2014
|
post_turn: true,
|
|
864
2015
|
output_ref: outputRef,
|
|
865
2016
|
verification: false,
|
|
2017
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
2018
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
2019
|
+
forcedSkillGaps,
|
|
2020
|
+
goalContract,
|
|
2021
|
+
goalQa,
|
|
2022
|
+
qaAutofire: { ...qaAutofire, phase: 'post_turn_ledger' },
|
|
866
2023
|
},
|
|
867
2024
|
});
|
|
868
2025
|
const releaseCoach = await recordCoachPhase('claim_or_release', {
|
|
@@ -878,6 +2035,12 @@ try {
|
|
|
878
2035
|
requireCognitionBlock: false,
|
|
879
2036
|
requireAppliedCognition: false,
|
|
880
2037
|
post_receipt_id: post?.receipt?.receiptId || null,
|
|
2038
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
2039
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
2040
|
+
forcedSkillGaps,
|
|
2041
|
+
goalContract,
|
|
2042
|
+
goalQa,
|
|
2043
|
+
qaAutofire: { ...qaAutofire, phase: 'claim_or_release' },
|
|
881
2044
|
},
|
|
882
2045
|
});
|
|
883
2046
|
if (releaseCoach?.permitted === false) {
|
|
@@ -889,6 +2052,28 @@ try {
|
|
|
889
2052
|
}),
|
|
890
2053
|
});
|
|
891
2054
|
}
|
|
2055
|
+
const touchedFileMap = new Map();
|
|
2056
|
+
for (const entry of [...(Array.isArray(state?.tools) ? state.tools : []), ...(Array.isArray(state?.toolOutputs) ? state.toolOutputs : [])]) {
|
|
2057
|
+
for (const file of Array.isArray(entry?.touchedFiles) ? entry.touchedFiles : []) {
|
|
2058
|
+
if (file?.path && !touchedFileMap.has(file.path)) touchedFileMap.set(file.path, file);
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
await recordHiveSessionLifecycle({
|
|
2062
|
+
sessionId,
|
|
2063
|
+
threadId: state?.hiveThreadId || null,
|
|
2064
|
+
event: 'turn_complete',
|
|
2065
|
+
status: 'completed',
|
|
2066
|
+
intentSummary: (state?.userText || text || 'Codex turn completed').slice(0, 240),
|
|
2067
|
+
fileClaims: [...touchedFileMap.values()],
|
|
2068
|
+
source: 'codex-stop-hook',
|
|
2069
|
+
body: {
|
|
2070
|
+
traceId: state?.traceId || null,
|
|
2071
|
+
outputRef,
|
|
2072
|
+
validationSeverity: validation?.validation?.severity || 'pass',
|
|
2073
|
+
layer3Pass: validation?.layer3?.pass !== false,
|
|
2074
|
+
goalQa,
|
|
2075
|
+
},
|
|
2076
|
+
});
|
|
892
2077
|
clearTurnState(sessionId);
|
|
893
2078
|
emitJson({ continue: true });
|
|
894
2079
|
} catch (error) {
|
|
@@ -906,7 +2091,11 @@ try {
|
|
|
906
2091
|
|
|
907
2092
|
function buildCodexHooksToml(codexDir: string): string {
|
|
908
2093
|
const hooksDir = path.join(codexDir, 'hooks');
|
|
2094
|
+
const configPath = path.join(codexDir, 'config.toml');
|
|
909
2095
|
const command = (name: string) => tomlString(`node ${path.join(hooksDir, name)}`);
|
|
2096
|
+
const stateKey = (event: string, index: number) => tomlString(`${configPath}:${event}:${index}:0`);
|
|
2097
|
+
const enabledState = (event: string, index: number) => `[hooks.state.${stateKey(event, index)}]
|
|
2098
|
+
enabled = true`;
|
|
910
2099
|
return `# BEGIN ARIA MANAGED HOOKS
|
|
911
2100
|
[hooks]
|
|
912
2101
|
managed_dir = ${tomlString(hooksDir)}
|
|
@@ -914,6 +2103,9 @@ managed_dir = ${tomlString(hooksDir)}
|
|
|
914
2103
|
[[hooks.UserPromptSubmit]]
|
|
915
2104
|
hooks = [{ type = "command", command = ${command('aria-userprompt-submit.mjs')} }]
|
|
916
2105
|
|
|
2106
|
+
[[hooks.UserPromptSubmit]]
|
|
2107
|
+
hooks = [{ type = "command", command = ${command('aria-live-ticker.mjs')} }]
|
|
2108
|
+
|
|
917
2109
|
[[hooks.PreToolUse]]
|
|
918
2110
|
matcher = ".*"
|
|
919
2111
|
hooks = [{ type = "command", command = ${command('aria-pre-tool-use.mjs')} }]
|
|
@@ -924,6 +2116,18 @@ hooks = [{ type = "command", command = ${command('aria-post-tool-use.mjs')} }]
|
|
|
924
2116
|
|
|
925
2117
|
[[hooks.Stop]]
|
|
926
2118
|
hooks = [{ type = "command", command = ${command('aria-stop.mjs')} }]
|
|
2119
|
+
|
|
2120
|
+
[hooks.state]
|
|
2121
|
+
|
|
2122
|
+
${enabledState('user_prompt_submit', 0)}
|
|
2123
|
+
|
|
2124
|
+
${enabledState('user_prompt_submit', 1)}
|
|
2125
|
+
|
|
2126
|
+
${enabledState('pre_tool_use', 0)}
|
|
2127
|
+
|
|
2128
|
+
${enabledState('post_tool_use', 0)}
|
|
2129
|
+
|
|
2130
|
+
${enabledState('stop', 0)}
|
|
927
2131
|
# END ARIA MANAGED HOOKS
|
|
928
2132
|
`;
|
|
929
2133
|
}
|
|
@@ -946,14 +2150,21 @@ function installCodexHooksConfig(codexDir: string, logs: string[]): void {
|
|
|
946
2150
|
function installCodexHooks(codexDir: string, logs: string[]): void {
|
|
947
2151
|
const hooksDir = path.join(codexDir, 'hooks');
|
|
948
2152
|
mkdirSync(path.join(hooksDir, 'lib'), { recursive: true, mode: 0o755 });
|
|
2153
|
+
mkdirSync(path.join(codexDir, 'lib'), { recursive: true, mode: 0o755 });
|
|
949
2154
|
const ledgerHelperSrc = packageTaskProjectLedgerHelperPath();
|
|
950
2155
|
if (!existsSync(ledgerHelperSrc)) {
|
|
951
2156
|
throw new Error(`Task/project ledger helper missing: ${ledgerHelperSrc}`);
|
|
952
2157
|
}
|
|
2158
|
+
const projectBoundarySrc = packageProjectBoundaryCognitionPath();
|
|
2159
|
+
if (!existsSync(projectBoundarySrc)) {
|
|
2160
|
+
throw new Error(`Project boundary cognition helper missing: ${projectBoundarySrc}`);
|
|
2161
|
+
}
|
|
953
2162
|
|
|
954
2163
|
const files: Array<[string, string]> = [
|
|
955
2164
|
[path.join(hooksDir, 'lib', 'runtime-client.mjs'), buildCodexHookRuntimeClient()],
|
|
956
2165
|
[path.join(hooksDir, 'aria-userprompt-submit.mjs'), buildCodexUserPromptHook()],
|
|
2166
|
+
[path.join(hooksDir, 'aria-live-ticker.mjs'), buildCodexLiveTickerHook()],
|
|
2167
|
+
[path.join(hooksDir, 'aria-harness-ticker-sidecar.mjs'), buildCodexHarnessTickerSidecar()],
|
|
957
2168
|
[path.join(hooksDir, 'aria-pre-tool-use.mjs'), buildCodexPreToolHook()],
|
|
958
2169
|
[path.join(hooksDir, 'aria-post-tool-use.mjs'), buildCodexPostToolHook()],
|
|
959
2170
|
[path.join(hooksDir, 'aria-stop.mjs'), buildCodexStopHook()],
|
|
@@ -965,6 +2176,8 @@ function installCodexHooks(codexDir: string, logs: string[]): void {
|
|
|
965
2176
|
}
|
|
966
2177
|
copyFileSync(ledgerHelperSrc, path.join(hooksDir, 'lib', 'task-project-ledger.mjs'));
|
|
967
2178
|
try { chmodSync(path.join(hooksDir, 'lib', 'task-project-ledger.mjs'), 0o755); } catch {}
|
|
2179
|
+
copyFileSync(projectBoundarySrc, path.join(codexDir, 'lib', 'project-boundary-cognition.mjs'));
|
|
2180
|
+
try { chmodSync(path.join(codexDir, 'lib', 'project-boundary-cognition.mjs'), 0o755); } catch {}
|
|
968
2181
|
|
|
969
2182
|
logs.push(`Installed Codex native hooks → ${hooksDir}`);
|
|
970
2183
|
installCodexHooksConfig(codexDir, logs);
|
|
@@ -1085,10 +2298,19 @@ Lens roles for decisions:
|
|
|
1085
2298
|
## Structural Cognition Contract
|
|
1086
2299
|
- Cognition is not accepted as proof by itself. It must change the next action, tool call, or output claim.
|
|
1087
2300
|
- Each lens must affect work selection or artifact shape; do not write lenses after the decision is already made.
|
|
1088
|
-
- For every non-trivial output,
|
|
2301
|
+
- For every non-trivial output, applied cognition must change the answer, tool call, or claim boundary.
|
|
2302
|
+
- Owner-readable output comes first. Raw \`<applied_cognition>\` is required only when a gate or owner explicitly asks for machine-readable XML; otherwise fold the fields into concise prose.
|
|
1089
2303
|
- Tool-bound cognition must name the exact tool/action it constrains and the measurable predicate that proves the action succeeded.
|
|
1090
2304
|
- Deploy or destructive actions still require \`<verify>\` and \`<expected>\` blocks before execution.
|
|
1091
2305
|
- If cognition did not change anything, stop and re-think; \`decision_delta: none\` is treated as performative.
|
|
2306
|
+
|
|
2307
|
+
## Autofire Quality Continuation Contract
|
|
2308
|
+
- Actual goal: wire extracted books, doctrines, skills, runtimes, primitives, mappings, CLIs, connectors, and agent surfaces into the operating system so output improves automatically.
|
|
2309
|
+
- Receipts, gates, ledgers, and canaries are evidence, not the product. They pass only when they prove corpus-backed behavior changed the next action, QA, correction, verification, or learning loop.
|
|
2310
|
+
- For continuation work, name the next highest-quality, highest-impact step by default; do not make the owner ask for the obvious next action.
|
|
2311
|
+
- Forced QA is the ordinary gate: compare expected vs observed, name findings or explicit pass criteria, correct low-risk misses, verify with real evidence, and record Dalio-style lesson plus Reflexion-style next action.
|
|
2312
|
+
- Hard stops are reserved for secrets, destructive actions, deploy/publication boundaries, owner-contradicted actions, and proven false completion risk.
|
|
2313
|
+
- Final owner-facing output must be readable: status, evidence, QA/correction result, and next action. Do not dump lifecycle receipts or raw JSON unless the owner explicitly asks for raw receipt/debug evidence.
|
|
1092
2314
|
`;
|
|
1093
2315
|
}
|
|
1094
2316
|
|
|
@@ -1166,10 +2388,17 @@ function installAgentsMd(codexDir: string, config: AriaConfig, logs: string[]):
|
|
|
1166
2388
|
logs.push(`Installed Codex must-read guide → ${mustReadPath}`);
|
|
1167
2389
|
}
|
|
1168
2390
|
|
|
1169
|
-
export async function connectCodex(config: AriaConfig): Promise<string[]> {
|
|
2391
|
+
export async function connectCodex(config: AriaConfig, opts: { installWrapper?: boolean } = {}): Promise<string[]> {
|
|
1170
2392
|
const logs: string[] = [];
|
|
1171
2393
|
const codexDir = path.join(homedir(), '.codex');
|
|
1172
2394
|
|
|
2395
|
+
await requireGovernedConnectorMutation({
|
|
2396
|
+
surfaceId: 'codex',
|
|
2397
|
+
action: 'install',
|
|
2398
|
+
targetPath: codexDir,
|
|
2399
|
+
reason: 'install Codex harness surface',
|
|
2400
|
+
});
|
|
2401
|
+
|
|
1173
2402
|
if (!existsSync(codexDir)) {
|
|
1174
2403
|
mkdirSync(codexDir, { recursive: true, mode: 0o700 });
|
|
1175
2404
|
logs.push(`Created ${codexDir}`);
|
|
@@ -1182,6 +2411,10 @@ export async function connectCodex(config: AriaConfig): Promise<string[]> {
|
|
|
1182
2411
|
installCodexHooks(codexDir, logs);
|
|
1183
2412
|
installAriaCognitionSkills(codexDir, logs);
|
|
1184
2413
|
syncDoctrineTriggerMap(logs);
|
|
1185
|
-
|
|
2414
|
+
if (opts.installWrapper === true) {
|
|
2415
|
+
logs.push(...await connectShell('codex', config));
|
|
2416
|
+
} else {
|
|
2417
|
+
logs.push('Skipped Codex shell wrapper install; Codex direct login/default provider path remains untouched. Use aria connect --with-wrappers only when explicitly desired.');
|
|
2418
|
+
}
|
|
1186
2419
|
return logs;
|
|
1187
2420
|
}
|