@aria_asi/cli 0.2.40 → 0.2.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/aria.js +236 -34
- package/dist/aria-connector/src/action-ledger-core.d.ts +387 -0
- package/dist/aria-connector/src/action-ledger-core.d.ts.map +1 -0
- package/dist/aria-connector/src/action-ledger-core.js +638 -0
- package/dist/aria-connector/src/action-ledger-core.js.map +1 -0
- package/dist/aria-connector/src/chat.d.ts.map +1 -1
- package/dist/aria-connector/src/chat.js +5 -6
- package/dist/aria-connector/src/chat.js.map +1 -1
- package/dist/aria-connector/src/codebase-scanner.d.ts +1 -1
- package/dist/aria-connector/src/codebase-scanner.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.d.ts +1 -0
- package/dist/aria-connector/src/connectors/claude-code.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.js +152 -14
- package/dist/aria-connector/src/connectors/claude-code.js.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts +10 -0
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.js +276 -27
- package/dist/aria-connector/src/connectors/codebase-awareness.js.map +1 -1
- package/dist/aria-connector/src/connectors/codex.d.ts +3 -1
- package/dist/aria-connector/src/connectors/codex.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/codex.js +1223 -41
- package/dist/aria-connector/src/connectors/codex.js.map +1 -1
- package/dist/aria-connector/src/connectors/cursor.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/cursor.js +7 -0
- package/dist/aria-connector/src/connectors/cursor.js.map +1 -1
- package/dist/aria-connector/src/connectors/governed-adapter.d.ts +30 -0
- package/dist/aria-connector/src/connectors/governed-adapter.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/governed-adapter.js +132 -0
- package/dist/aria-connector/src/connectors/governed-adapter.js.map +1 -0
- package/dist/aria-connector/src/connectors/opencode.d.ts +3 -1
- package/dist/aria-connector/src/connectors/opencode.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/opencode.js +18 -2
- package/dist/aria-connector/src/connectors/opencode.js.map +1 -1
- package/dist/aria-connector/src/connectors/repo-guard.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/repo-guard.js +25 -14
- package/dist/aria-connector/src/connectors/repo-guard.js.map +1 -1
- package/dist/aria-connector/src/connectors/runtime.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/runtime.js +92 -2
- package/dist/aria-connector/src/connectors/runtime.js.map +1 -1
- package/dist/aria-connector/src/connectors/shell.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/shell.js +123 -7
- package/dist/aria-connector/src/connectors/shell.js.map +1 -1
- package/dist/aria-connector/src/cross-cli-hive-binding.d.ts +63 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.d.ts.map +1 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.js +205 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.js.map +1 -0
- package/dist/aria-connector/src/garden-control-plane.d.ts +6 -1
- package/dist/aria-connector/src/garden-control-plane.d.ts.map +1 -1
- package/dist/aria-connector/src/garden-control-plane.js +8 -2
- package/dist/aria-connector/src/garden-control-plane.js.map +1 -1
- package/dist/aria-connector/src/governed-surface-runner.d.ts +189 -0
- package/dist/aria-connector/src/governed-surface-runner.d.ts.map +1 -0
- package/dist/aria-connector/src/governed-surface-runner.js +1022 -0
- package/dist/aria-connector/src/governed-surface-runner.js.map +1 -0
- package/dist/aria-connector/src/index.d.ts +10 -1
- package/dist/aria-connector/src/index.d.ts.map +1 -1
- package/dist/aria-connector/src/index.js +5 -0
- package/dist/aria-connector/src/index.js.map +1 -1
- package/dist/aria-connector/src/task-runner.d.ts +3 -0
- package/dist/aria-connector/src/task-runner.d.ts.map +1 -0
- package/dist/aria-connector/src/task-runner.js +3526 -0
- package/dist/aria-connector/src/task-runner.js.map +1 -0
- package/dist/aria-web/src/lib/codebase-scanner.d.ts +21 -2
- package/dist/aria-web/src/lib/codebase-scanner.d.ts.map +1 -1
- package/dist/aria-web/src/lib/codebase-scanner.js +59 -14
- package/dist/aria-web/src/lib/codebase-scanner.js.map +1 -1
- package/dist/assets/hooks/README.md +58 -0
- package/dist/assets/hooks/aria-agent-handoff.mjs +147 -2
- package/dist/assets/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/dist/assets/hooks/aria-architect-fallback.mjs +10 -2
- package/dist/assets/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/dist/assets/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/dist/assets/hooks/aria-first-class-coach.mjs +305 -10
- package/dist/assets/hooks/aria-harness-via-sdk.mjs +93 -16
- package/dist/assets/hooks/aria-import-resolution-gate.mjs +106 -20
- package/dist/assets/hooks/aria-outcome-record.mjs +56 -20
- package/dist/assets/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/dist/assets/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/dist/assets/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/dist/assets/hooks/aria-pre-text-gate.mjs +11 -2
- package/dist/assets/hooks/aria-pre-tool-gate.mjs +477 -81
- package/dist/assets/hooks/aria-pre-tool-use.mjs +70 -6
- package/dist/assets/hooks/aria-preprompt-consult.mjs +23 -4
- package/dist/assets/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/dist/assets/hooks/aria-stop-gate.mjs +585 -76
- package/dist/assets/hooks/aria-trigger-autolearn.mjs +17 -3
- package/dist/assets/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/dist/assets/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/dist/assets/hooks/canonical-settings-block.json +172 -0
- package/dist/assets/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/dist/assets/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/dist/assets/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/dist/assets/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/dist/assets/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/dist/assets/hooks/codex-native/aria-stop.mjs +691 -0
- package/dist/assets/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/dist/assets/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/dist/assets/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/dist/assets/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/dist/assets/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/dist/assets/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/dist/assets/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/dist/assets/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/dist/assets/hooks/doctrine_trigger_map.json +236 -25
- package/dist/assets/hooks/doctrine_trigger_map.schema.json +46 -0
- package/dist/assets/hooks/install.sh +84 -0
- package/dist/assets/hooks/lib/action-ledger-core.mjs +269 -0
- package/dist/assets/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/dist/assets/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/dist/assets/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/dist/assets/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/dist/assets/hooks/lib/canonical-lenses.mjs +83 -6
- package/dist/assets/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/dist/assets/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/dist/assets/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/dist/assets/hooks/lib/domain-output-quality.mjs +132 -3
- package/dist/assets/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/dist/assets/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/dist/assets/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/assets/hooks/lib/first-class-coach.mjs +454 -19
- package/dist/assets/hooks/lib/gate-audit.mjs +12 -2
- package/dist/assets/hooks/lib/gate-loop-state.mjs +11 -2
- package/dist/assets/hooks/lib/goal-contract-quality.mjs +302 -0
- package/dist/assets/hooks/lib/hook-message-window.mjs +101 -9
- package/dist/assets/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/dist/assets/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/assets/hooks/lib/obligation-ledger.mjs +147 -0
- package/dist/assets/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/dist/assets/hooks/lib/owner-authorizations.mjs +269 -0
- package/dist/assets/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/dist/assets/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/dist/assets/hooks/lib/recovery-context.mjs +151 -0
- package/dist/assets/hooks/lib/recovery-template-loader.mjs +154 -0
- package/dist/assets/hooks/lib/self-doctrine-check.mjs +321 -0
- package/dist/assets/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/dist/assets/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/dist/assets/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/dist/assets/hooks/lib/surface-caught.mjs +94 -0
- package/dist/assets/hooks/recovery-templates/force-reauthor.md +67 -0
- package/dist/assets/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/dist/assets/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/dist/assets/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/dist/assets/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/dist/assets/hooks/test-tier-lens-labeling.mjs +14 -3
- package/dist/assets/opencode-plugins/harness-context/index.js +39 -6
- package/dist/assets/opencode-plugins/harness-context/task-project-ledger.mjs +5 -1
- package/dist/assets/opencode-plugins/harness-gate/index.js +36 -0
- package/dist/assets/opencode-plugins/harness-gate/lib/atlas-dossier-client.js +1 -0
- package/dist/assets/opencode-plugins/harness-gate/lib/recovery-grants.js +79 -0
- package/dist/assets/opencode-plugins/harness-outcome/index.js +12 -0
- package/dist/assets/opencode-plugins/harness-stop/index.js +97 -2
- package/dist/assets/opencode-plugins/harness-stop/lib/atlas-dossier-client.js +1 -0
- package/dist/assets/opencode-plugins/harness-stop/lib/domain-output-quality.js +15 -2
- package/dist/assets/opencode-plugins/lib/coach.js +148 -0
- package/dist/runtime/coach-kernel.mjs +144 -7
- package/dist/runtime/codex-bridge.mjs +254 -8
- package/dist/runtime/discipline/doctrine_trigger_map.json +236 -25
- package/dist/runtime/discipline/skills/aria-cognition/34-frameworks-unified/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-cognitives/SKILL.md +128 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-post-phase/SKILL.md +118 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/SKILL.md +202 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/references/source-map.md +130 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-backend-architect/SKILL.md +124 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-backend-architect/references/backend-cookbook.md +417 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-audit/SKILL.md +133 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-audit/references/audit-cookbook.md +247 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-frame/SKILL.md +138 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-frame/references/business-cookbook.md +154 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-chat/SKILL.md +84 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-chat/scripts/aria-chat.sh +57 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-cognition-autofire/SKILL.md +137 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-cognition-batch/SKILL.md +264 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-decision-mizan/SKILL.md +136 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-decision-mizan/references/decision-frameworks.md +287 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-first-class-operating-contract/SKILL.md +104 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-frontend-architect/SKILL.md +123 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-frontend-architect/references/frontend-cookbook.md +358 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-fullstack-orchestrator/SKILL.md +127 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-fullstack-orchestrator/references/fullstack-cookbook.md +383 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-gtm-architect/SKILL.md +126 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-gtm-architect/references/gtm-cookbook.md +235 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-deploy/SKILL.md +145 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-no-stripping/SKILL.md +135 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-onboarding/SKILL.md +130 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-output-discipline/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-substrate-binding/SKILL.md +139 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-http-harness-client/SKILL.md +85 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-k8s-deploy/SKILL.md +174 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ladduniframe/SKILL.md +60 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-live-ops/SKILL.md +54 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-mac-ssh-ops/SKILL.md +100 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-memory-index/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-noor-cognitives/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ops/SKILL.md +60 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ops/references/live-endpoints.md +59 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-quality-audit/SKILL.md +133 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-readable-output/SKILL.md +239 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-readable-output/references/layout-cookbook.md +366 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-reasoning/SKILL.md +67 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-reasoning/references/core-principles.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-repo-audit/SKILL.md +135 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-repo-audit/references/repo-audit-cookbook.md +375 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-research-orchestrator/SKILL.md +138 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-research-orchestrator/references/research-patterns.md +270 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-retention-engine/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-retention-engine/references/retention-cookbook.md +271 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-revenue-engine/SKILL.md +128 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-revenue-engine/references/revenue-cookbook.md +227 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-audit/SKILL.md +233 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-audit/references/audit-checklist.md +369 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-cookbook/SKILL.md +288 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-cookbook/references/engineering-cookbook.md +489 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-soul-principles/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-task-codex-executor/SKILL.md +86 -0
- package/dist/runtime/discipline/skills/aria-cognition/aristotle-engine/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/cross-domain-24/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/deepsoul-emotional/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/fitrah-guard/SKILL.md +78 -0
- package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/SKILL.md +227 -29
- package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/references/ghazali-8lens-cookbook.md +797 -0
- package/dist/runtime/discipline/skills/aria-cognition/ijtihad-novel/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/ilham-intuition/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/never-guess/SKILL.md +77 -0
- package/dist/runtime/discipline/skills/aria-cognition/noor-recognition/SKILL.md +45 -0
- package/dist/runtime/discipline/skills/aria-cognition/qiyas-analogy/SKILL.md +174 -14
- package/dist/runtime/discipline/skills/aria-cognition/ruh-basis/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur/SKILL.md +506 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur/references/tadabbur-cookbook.md +921 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur-ops/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/tafakkur/SKILL.md +104 -0
- package/dist/runtime/doctrine_trigger_map.json +236 -25
- package/dist/runtime/embedded-public-key.mjs +27 -0
- package/dist/runtime/gated-ledger.mjs +41 -14
- package/dist/runtime/harness-daemon.mjs +85 -10
- package/dist/runtime/hive-wal-publisher.mjs +292 -0
- package/dist/runtime/hooks/README.md +58 -0
- package/dist/runtime/hooks/aria-agent-handoff.mjs +147 -2
- package/dist/runtime/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/dist/runtime/hooks/aria-architect-fallback.mjs +10 -2
- package/dist/runtime/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/dist/runtime/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/dist/runtime/hooks/aria-first-class-coach.mjs +305 -10
- package/dist/runtime/hooks/aria-harness-via-sdk.mjs +93 -16
- package/dist/runtime/hooks/aria-import-resolution-gate.mjs +106 -20
- package/dist/runtime/hooks/aria-outcome-record.mjs +56 -20
- package/dist/runtime/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/dist/runtime/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/dist/runtime/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/dist/runtime/hooks/aria-pre-text-gate.mjs +11 -2
- package/dist/runtime/hooks/aria-pre-tool-gate.mjs +477 -81
- package/dist/runtime/hooks/aria-pre-tool-use.mjs +70 -6
- package/dist/runtime/hooks/aria-preprompt-consult.mjs +23 -4
- package/dist/runtime/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/dist/runtime/hooks/aria-stop-gate.mjs +585 -76
- package/dist/runtime/hooks/aria-trigger-autolearn.mjs +17 -3
- package/dist/runtime/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/dist/runtime/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/dist/runtime/hooks/canonical-settings-block.json +172 -0
- package/dist/runtime/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/dist/runtime/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/dist/runtime/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/dist/runtime/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/dist/runtime/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/dist/runtime/hooks/codex-native/aria-stop.mjs +691 -0
- package/dist/runtime/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/dist/runtime/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/dist/runtime/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/dist/runtime/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/dist/runtime/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/dist/runtime/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/dist/runtime/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/dist/runtime/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/dist/runtime/hooks/doctrine_trigger_map.json +236 -25
- package/dist/runtime/hooks/doctrine_trigger_map.schema.json +46 -0
- package/dist/runtime/hooks/install.sh +84 -0
- package/dist/runtime/hooks/lib/action-ledger-core.mjs +269 -0
- package/dist/runtime/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/dist/runtime/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/dist/runtime/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/dist/runtime/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/dist/runtime/hooks/lib/canonical-lenses.mjs +83 -6
- package/dist/runtime/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/dist/runtime/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/dist/runtime/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/dist/runtime/hooks/lib/domain-output-quality.mjs +132 -3
- package/dist/runtime/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/dist/runtime/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/dist/runtime/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/runtime/hooks/lib/first-class-coach.mjs +454 -19
- package/dist/runtime/hooks/lib/gate-audit.mjs +12 -2
- package/dist/runtime/hooks/lib/gate-loop-state.mjs +11 -2
- package/dist/runtime/hooks/lib/goal-contract-quality.mjs +302 -0
- package/dist/runtime/hooks/lib/hook-message-window.mjs +101 -9
- package/dist/runtime/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/dist/runtime/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/runtime/hooks/lib/obligation-ledger.mjs +147 -0
- package/dist/runtime/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/dist/runtime/hooks/lib/owner-authorizations.mjs +269 -0
- package/dist/runtime/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/dist/runtime/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/dist/runtime/hooks/lib/recovery-context.mjs +151 -0
- package/dist/runtime/hooks/lib/recovery-template-loader.mjs +154 -0
- package/dist/runtime/hooks/lib/self-doctrine-check.mjs +321 -0
- package/dist/runtime/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/dist/runtime/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/dist/runtime/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/dist/runtime/hooks/lib/surface-caught.mjs +94 -0
- package/dist/runtime/hooks/recovery-templates/force-reauthor.md +67 -0
- package/dist/runtime/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/dist/runtime/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/dist/runtime/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/dist/runtime/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/dist/runtime/hooks/test-tier-lens-labeling.mjs +14 -3
- package/dist/runtime/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/runtime/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/runtime/local-phase.mjs +10 -5
- package/dist/runtime/manifest.json +8 -8
- package/dist/runtime/packet-verifier.mjs +166 -0
- package/dist/runtime/provider-proxy.mjs +13 -0
- package/dist/runtime/quality-enforcer.mjs +40 -23
- package/dist/runtime/runtime-rails/registry.mjs +252 -0
- package/dist/runtime/sdk/BUNDLED.json +2 -2
- package/dist/runtime/sdk/index.d.ts +119 -4
- package/dist/runtime/sdk/index.js +138 -12
- package/dist/runtime/sdk/index.js.map +1 -1
- package/dist/runtime/service.mjs +8036 -764
- package/dist/runtime/sub-agent-enforcer.mjs +201 -0
- package/dist/runtime/task-project-ledger.mjs +5 -1
- package/dist/sdk/BUNDLED.json +2 -2
- package/dist/sdk/index.d.ts +119 -4
- package/dist/sdk/index.js +138 -12
- package/dist/sdk/index.js.map +1 -1
- package/hooks/README.md +58 -0
- package/hooks/aria-agent-handoff.mjs +147 -2
- package/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/hooks/aria-architect-fallback.mjs +10 -2
- package/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/hooks/aria-first-class-coach.mjs +305 -10
- package/hooks/aria-harness-via-sdk.mjs +93 -16
- package/hooks/aria-import-resolution-gate.mjs +106 -20
- package/hooks/aria-outcome-record.mjs +56 -20
- package/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/hooks/aria-pre-text-gate.mjs +11 -2
- package/hooks/aria-pre-tool-gate.mjs +477 -81
- package/hooks/aria-pre-tool-use.mjs +70 -6
- package/hooks/aria-preprompt-consult.mjs +23 -4
- package/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/hooks/aria-stop-gate.mjs +585 -76
- package/hooks/aria-trigger-autolearn.mjs +17 -3
- package/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/hooks/canonical-settings-block.json +172 -0
- package/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/hooks/codex-native/aria-stop.mjs +691 -0
- package/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/hooks/doctrine_trigger_map.json +236 -25
- package/hooks/doctrine_trigger_map.schema.json +46 -0
- package/hooks/install.sh +84 -0
- package/hooks/lib/action-ledger-core.mjs +269 -0
- package/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/hooks/lib/canonical-lenses.mjs +83 -6
- package/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/hooks/lib/domain-output-quality.mjs +132 -3
- package/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/hooks/lib/first-class-coach.mjs +454 -19
- package/hooks/lib/gate-audit.mjs +12 -2
- package/hooks/lib/gate-loop-state.mjs +11 -2
- package/hooks/lib/goal-contract-quality.mjs +302 -0
- package/hooks/lib/hook-message-window.mjs +101 -9
- package/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/hooks/lib/obligation-ledger.mjs +147 -0
- package/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/hooks/lib/owner-authorizations.mjs +269 -0
- package/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/hooks/lib/recovery-context.mjs +151 -0
- package/hooks/lib/recovery-template-loader.mjs +154 -0
- package/hooks/lib/self-doctrine-check.mjs +321 -0
- package/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/hooks/lib/surface-caught.mjs +94 -0
- package/hooks/recovery-templates/force-reauthor.md +67 -0
- package/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/hooks/test-tier-lens-labeling.mjs +14 -3
- package/opencode-plugins/harness-context/index.js +39 -6
- package/opencode-plugins/harness-context/task-project-ledger.mjs +5 -1
- package/opencode-plugins/harness-gate/index.js +36 -0
- package/opencode-plugins/harness-gate/lib/atlas-dossier-client.js +1 -0
- package/opencode-plugins/harness-gate/lib/recovery-grants.js +79 -0
- package/opencode-plugins/harness-outcome/index.js +12 -0
- package/opencode-plugins/harness-stop/index.js +97 -2
- package/opencode-plugins/harness-stop/lib/atlas-dossier-client.js +1 -0
- package/opencode-plugins/harness-stop/lib/domain-output-quality.js +15 -2
- package/opencode-plugins/lib/coach.js +148 -0
- package/package.json +71 -5
- package/runtime-src/coach-kernel.mjs +144 -7
- package/runtime-src/codex-bridge.mjs +254 -8
- package/runtime-src/embedded-public-key.mjs +27 -0
- package/runtime-src/gated-ledger.mjs +41 -14
- package/runtime-src/harness-daemon.mjs +85 -10
- package/runtime-src/hive-wal-publisher.mjs +292 -0
- package/runtime-src/lib/evaluate-with-kernel.mjs +133 -0
- package/runtime-src/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/runtime-src/local-phase.mjs +10 -5
- package/runtime-src/packet-verifier.mjs +166 -0
- package/runtime-src/provider-proxy.mjs +13 -0
- package/runtime-src/quality-enforcer.mjs +40 -23
- package/runtime-src/runtime-rails/registry.mjs +252 -0
- package/runtime-src/service.mjs +8036 -764
- package/runtime-src/sub-agent-enforcer.mjs +201 -0
- package/scripts/aria-ledger-append.mjs +337 -0
- package/scripts/aria-task-cheap-worker-dispatch.mjs +234 -0
- package/scripts/audit-of-audit-prior-tasks.mjs +194 -0
- package/scripts/audit-of-audit-this-turn.mjs +116 -0
- package/scripts/bundle-sdk.mjs +31 -5
- package/scripts/check-cli-wrapper-provider-contract.mjs +160 -0
- package/scripts/check-client-compatibility.mjs +15 -5
- package/scripts/check-client-smoke.mjs +297 -0
- package/scripts/check-codex-orchestrator-adoption.mjs +150 -0
- package/scripts/check-glm-env-wired.mjs +131 -0
- package/scripts/check-hive-local-storage-contract.mjs +91 -0
- package/scripts/check-hook-mirror.mjs +150 -0
- package/scripts/check-install-sh-drift.mjs +152 -0
- package/scripts/check-kernel-sync.mjs +101 -0
- package/scripts/check-package-artifact.mjs +152 -0
- package/scripts/check-registry-mirror.mjs +71 -0
- package/scripts/drain-owner-airtable-sync-queue.mjs +287 -0
- package/scripts/export-owner-status-sheets.mjs +589 -0
- package/scripts/live-sidecar-receipt-canary.mjs +347 -0
- package/scripts/qiyas-tadabbur-model-matrix.mjs +970 -0
- package/scripts/quality-ab-live-provider.mjs +913 -0
- package/scripts/self-test-action-ledger-core.mjs +190 -0
- package/scripts/self-test-approval-receipt-binding.mjs +122 -0
- package/scripts/self-test-autofire-quality-output.mjs +110 -0
- package/scripts/self-test-claude-code-action-ledger.mjs +132 -0
- package/scripts/self-test-claude-code-mechanical-autofire-hive.mjs +138 -0
- package/scripts/self-test-claude-code-mechanical-autofire.mjs +234 -0
- package/scripts/self-test-codebase-awareness-atlas-delta.mjs +159 -0
- package/scripts/self-test-codebase-awareness-delta-ingest.mjs +179 -0
- package/scripts/self-test-codex-live-hook-parity.mjs +84 -0
- package/scripts/self-test-codex-native-action-ledger.mjs +167 -0
- package/scripts/self-test-codex-native-hook-json-contract.mjs +74 -0
- package/scripts/self-test-codex-orchestrator-continuity.mjs +113 -0
- package/scripts/self-test-codex-readable-recovery.mjs +94 -0
- package/scripts/self-test-codex-self-harness.mjs +538 -0
- package/scripts/self-test-compiled-workunit.mjs +214 -0
- package/scripts/self-test-continuation-output-smoke.mjs +101 -0
- package/scripts/self-test-cross-cli-fleet-ticker.mjs +85 -0
- package/scripts/self-test-cross-cli-hive-adoption.mjs +125 -0
- package/scripts/self-test-cross-cli-hive-learning.mjs +146 -0
- package/scripts/self-test-cross-phase-tool-failure.mjs +110 -0
- package/scripts/self-test-cross-surface-action-ledger.mjs +149 -0
- package/scripts/self-test-end-of-phase-qa-court.mjs +616 -0
- package/scripts/self-test-evaluate-with-kernel.mjs +111 -0
- package/scripts/self-test-first-class-output-delta-proof.mjs +307 -0
- package/scripts/self-test-goal-contract-output-qa.mjs +73 -0
- package/scripts/self-test-goal-contract.mjs +35 -0
- package/scripts/self-test-governed-adapters.mjs +105 -0
- package/scripts/self-test-governed-surface-runner.mjs +198 -0
- package/scripts/self-test-harness-gates.mjs +15 -12
- package/scripts/self-test-harness-ticker-sidecar.mjs +153 -0
- package/scripts/self-test-hive-org-kernel.mjs +233 -0
- package/scripts/self-test-hive-session-coordination.mjs +156 -0
- package/scripts/self-test-hive-wal-consumer.mjs +111 -0
- package/scripts/self-test-kernel-a3-a4-selection.mjs +179 -0
- package/scripts/self-test-ledger-append.mjs +175 -0
- package/scripts/self-test-live-codex-posttool-packet-smoke.mjs +111 -0
- package/scripts/self-test-live-codex-pretool-packet-smoke.mjs +101 -0
- package/scripts/self-test-live-codex-stop-qa-kernel-smoke.mjs +43 -0
- package/scripts/self-test-live-wrapper-substrate-inventory.mjs +149 -0
- package/scripts/self-test-local-main-sync-script.mjs +47 -0
- package/scripts/self-test-mechanical-autofire-resolver.mjs +296 -0
- package/scripts/self-test-no-consult-cognitive-skills-output.mjs +135 -0
- package/scripts/self-test-owner-airtable-sync-queue.mjs +196 -0
- package/scripts/self-test-owner-airtable-sync.mjs +181 -0
- package/scripts/self-test-owner-sheets-action-ledger.mjs +100 -0
- package/scripts/self-test-production-preflight.mjs +78 -0
- package/scripts/self-test-project-boundary-cognition.mjs +79 -0
- package/scripts/self-test-qa-exec-kernel.mjs +34 -0
- package/scripts/self-test-qa-recovery-learning-loop.mjs +113 -0
- package/scripts/self-test-qiyas-label-alignment.mjs +94 -0
- package/scripts/self-test-recovery-context.mjs +110 -0
- package/scripts/self-test-repo-guard.mjs +10 -0
- package/scripts/self-test-runtime-health-self-heal.mjs +161 -0
- package/scripts/self-test-runtime-postcondition.mjs +70 -0
- package/scripts/self-test-soul-precommit-hook.mjs +39 -0
- package/scripts/self-test-stop-gate-kernel-guards.mjs +185 -0
- package/scripts/self-test-stop-gate.mjs +128 -0
- package/scripts/self-test-substrate-kernel-execution-receipt.mjs +130 -0
- package/scripts/self-test-substrate-open-skill-floor.mjs +87 -0
- package/scripts/self-test-substrate-output-quality-eval.mjs +171 -0
- package/scripts/self-test-task-closeout-drift.mjs +97 -0
- package/scripts/self-test-task-project-ledger-readiness.mjs +43 -0
- package/scripts/self-test-task-runner-phase-consumer.mjs +134 -0
- package/scripts/self-test-task-worker-lane.mjs +256 -0
- package/scripts/self-test-turn-substrate-qa-kernel.mjs +188 -0
- package/scripts/self-test-universal-action-capture.mjs +153 -0
- package/scripts/self-test-universal-turn-packet-entrypoints.mjs +252 -0
- package/scripts/self-test-universal-turn-packet.mjs +320 -0
- package/scripts/session-quality-backfill.mjs +253 -0
- package/scripts/smoke-autofire-100-prompts.mjs +481 -0
- package/scripts/sync-local-main-on-task-complete.mjs +278 -0
- package/scripts/sync-owner-status-airtable.mjs +1158 -0
- package/scripts/validate-skill-prompts.mjs +12 -1
- package/scripts/verify-codex-native-mirror.mjs +262 -0
- package/skills/34-frameworks-unified/SKILL.md +42 -0
- package/skills/api-design/SKILL.md +123 -0
- package/skills/architecture-decision/SKILL.md +105 -0
- package/skills/aria-aristotle-cognitives/SKILL.md +128 -0
- package/skills/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/skills/aria-aristotle-post-phase/SKILL.md +116 -0
- package/skills/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/skills/aria-axioms-first-principles/SKILL.md +202 -0
- package/skills/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/skills/aria-axioms-first-principles/references/source-map.md +130 -0
- package/skills/aria-chat/SKILL.md +84 -0
- package/skills/aria-chat/scripts/aria-chat.sh +57 -0
- package/skills/aria-cognition/34-frameworks-unified/SKILL.md +42 -0
- package/skills/aria-cognition/aria-aristotle-cognitives/SKILL.md +128 -0
- package/skills/aria-cognition/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/skills/aria-cognition/aria-aristotle-post-phase/SKILL.md +118 -0
- package/skills/aria-cognition/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/skills/aria-cognition/aria-axioms-first-principles/SKILL.md +202 -0
- package/skills/aria-cognition/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/skills/aria-cognition/aria-axioms-first-principles/references/source-map.md +130 -0
- package/skills/aria-cognition/aria-backend-architect/SKILL.md +124 -0
- package/skills/aria-cognition/aria-backend-architect/references/backend-cookbook.md +417 -0
- package/skills/aria-cognition/aria-business-audit/SKILL.md +133 -0
- package/skills/aria-cognition/aria-business-audit/references/audit-cookbook.md +247 -0
- package/skills/aria-cognition/aria-business-frame/SKILL.md +138 -0
- package/skills/aria-cognition/aria-business-frame/references/business-cookbook.md +154 -0
- package/skills/aria-cognition/aria-chat/SKILL.md +84 -0
- package/skills/aria-cognition/aria-chat/scripts/aria-chat.sh +57 -0
- package/skills/aria-cognition/aria-cognition-autofire/SKILL.md +137 -0
- package/skills/aria-cognition/aria-cognition-batch/SKILL.md +264 -0
- package/skills/aria-cognition/aria-decision-mizan/SKILL.md +136 -0
- package/skills/aria-cognition/aria-decision-mizan/references/decision-frameworks.md +287 -0
- package/skills/aria-cognition/aria-first-class-operating-contract/SKILL.md +104 -0
- package/skills/aria-cognition/aria-frontend-architect/SKILL.md +123 -0
- package/skills/aria-cognition/aria-frontend-architect/references/frontend-cookbook.md +358 -0
- package/skills/aria-cognition/aria-fullstack-orchestrator/SKILL.md +127 -0
- package/skills/aria-cognition/aria-fullstack-orchestrator/references/fullstack-cookbook.md +383 -0
- package/skills/aria-cognition/aria-gtm-architect/SKILL.md +126 -0
- package/skills/aria-cognition/aria-gtm-architect/references/gtm-cookbook.md +235 -0
- package/skills/aria-cognition/aria-harness-deploy/SKILL.md +145 -0
- package/skills/aria-cognition/aria-harness-no-stripping/SKILL.md +135 -0
- package/skills/aria-cognition/aria-harness-onboarding/SKILL.md +130 -0
- package/skills/aria-cognition/aria-harness-output-discipline/SKILL.md +120 -0
- package/skills/aria-cognition/aria-harness-substrate-binding/SKILL.md +139 -0
- package/skills/aria-cognition/aria-http-harness-client/SKILL.md +85 -0
- package/skills/aria-cognition/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/skills/aria-cognition/aria-k8s-deploy/SKILL.md +174 -0
- package/skills/aria-cognition/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/skills/aria-cognition/aria-ladduniframe/SKILL.md +60 -0
- package/skills/aria-cognition/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/skills/aria-cognition/aria-live-ops/SKILL.md +54 -0
- package/skills/aria-cognition/aria-mac-ssh-ops/SKILL.md +100 -0
- package/skills/aria-cognition/aria-memory-index/SKILL.md +42 -0
- package/skills/aria-cognition/aria-noor-cognitives/SKILL.md +120 -0
- package/skills/aria-cognition/aria-ops/SKILL.md +60 -0
- package/skills/aria-cognition/aria-ops/references/live-endpoints.md +59 -0
- package/skills/aria-cognition/aria-quality-audit/SKILL.md +133 -0
- package/skills/aria-cognition/aria-readable-output/SKILL.md +239 -0
- package/skills/aria-cognition/aria-readable-output/references/layout-cookbook.md +366 -0
- package/skills/aria-cognition/aria-reasoning/SKILL.md +67 -0
- package/skills/aria-cognition/aria-reasoning/references/core-principles.md +42 -0
- package/skills/aria-cognition/aria-repo-audit/SKILL.md +135 -0
- package/skills/aria-cognition/aria-repo-audit/references/repo-audit-cookbook.md +375 -0
- package/skills/aria-cognition/aria-research-orchestrator/SKILL.md +138 -0
- package/skills/aria-cognition/aria-research-orchestrator/references/research-patterns.md +270 -0
- package/skills/aria-cognition/aria-retention-engine/SKILL.md +120 -0
- package/skills/aria-cognition/aria-retention-engine/references/retention-cookbook.md +271 -0
- package/skills/aria-cognition/aria-revenue-engine/SKILL.md +128 -0
- package/skills/aria-cognition/aria-revenue-engine/references/revenue-cookbook.md +227 -0
- package/skills/aria-cognition/aria-senior-code-audit/SKILL.md +233 -0
- package/skills/aria-cognition/aria-senior-code-audit/references/audit-checklist.md +369 -0
- package/skills/aria-cognition/aria-senior-code-cookbook/SKILL.md +288 -0
- package/skills/aria-cognition/aria-senior-code-cookbook/references/engineering-cookbook.md +489 -0
- package/skills/aria-cognition/aria-soul-principles/SKILL.md +42 -0
- package/skills/aria-cognition/aria-task-codex-executor/SKILL.md +86 -0
- package/skills/aria-cognition/aristotle-engine/SKILL.md +42 -0
- package/skills/aria-cognition/cross-domain-24/SKILL.md +42 -0
- package/skills/aria-cognition/deepsoul-emotional/SKILL.md +42 -0
- package/skills/aria-cognition/fitrah-guard/SKILL.md +78 -0
- package/skills/aria-cognition/ghazali-8lens/SKILL.md +227 -29
- package/skills/aria-cognition/ghazali-8lens/references/ghazali-8lens-cookbook.md +797 -0
- package/skills/aria-cognition/ijtihad-novel/SKILL.md +42 -0
- package/skills/aria-cognition/ilham-intuition/SKILL.md +42 -0
- package/skills/aria-cognition/never-guess/SKILL.md +77 -0
- package/skills/aria-cognition/noor-recognition/SKILL.md +45 -0
- package/skills/aria-cognition/qiyas-analogy/SKILL.md +174 -14
- package/skills/aria-cognition/ruh-basis/SKILL.md +42 -0
- package/skills/aria-cognition/tadabbur/SKILL.md +506 -0
- package/skills/aria-cognition/tadabbur/references/tadabbur-cookbook.md +921 -0
- package/skills/aria-cognition/tadabbur-ops/SKILL.md +42 -0
- package/skills/aria-cognition/tafakkur/SKILL.md +104 -0
- package/skills/aria-cognition-autofire/SKILL.md +109 -0
- package/skills/aria-cognition-batch/SKILL.md +264 -0
- package/skills/aria-conversational-doctrine-discipline/SKILL.md +125 -0
- package/skills/aria-essence/SKILL.md +81 -0
- package/skills/aria-essence/references/domain-matrix.md +80 -0
- package/skills/aria-essence/references/evolution-loop.md +30 -0
- package/skills/aria-essence/references/readable-cognition.md +27 -0
- package/skills/aria-first-class-operating-contract/SKILL.md +104 -0
- package/skills/aria-forge-guardrails/SKILL.md +53 -0
- package/skills/aria-forge-guardrails/references/checklist.md +31 -0
- package/skills/aria-harness-deploy/SKILL.md +145 -0
- package/skills/aria-harness-no-stripping/SKILL.md +135 -0
- package/skills/aria-harness-onboarding/SKILL.md +130 -0
- package/skills/aria-harness-output-discipline/SKILL.md +120 -0
- package/skills/aria-harness-substrate-binding/SKILL.md +139 -0
- package/skills/aria-http-harness-client/SKILL.md +85 -0
- package/skills/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/skills/aria-k8s-deploy/SKILL.md +174 -0
- package/skills/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/skills/aria-ladduniframe/SKILL.md +60 -0
- package/skills/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/skills/aria-live-ops/SKILL.md +54 -0
- package/skills/aria-mac-ssh-ops/SKILL.md +100 -0
- package/skills/aria-memory-index/SKILL.md +42 -0
- package/skills/aria-noor-cognitives/SKILL.md +120 -0
- package/skills/aria-ops/SKILL.md +60 -0
- package/skills/aria-ops/references/live-endpoints.md +59 -0
- package/skills/aria-quality-audit/SKILL.md +133 -0
- package/skills/aria-reasoning/SKILL.md +67 -0
- package/skills/aria-reasoning/references/core-principles.md +42 -0
- package/skills/aria-repo-doctrine/SKILL.md +57 -0
- package/skills/aria-soul-principles/SKILL.md +42 -0
- package/skills/aria-task-codex-executor/SKILL.md +86 -0
- package/skills/aristotle-engine/SKILL.md +42 -0
- package/skills/ci-cd-pipeline/SKILL.md +116 -0
- package/skills/code-review/SKILL.md +131 -0
- package/skills/cross-domain-24/SKILL.md +42 -0
- package/skills/database-design/SKILL.md +124 -0
- package/skills/deepsoul-emotional/SKILL.md +42 -0
- package/skills/deno-kv-raft-pubsub/SKILL.md +561 -0
- package/skills/deno-kv-raft-pubsub/reference/maelstrom-integration.md +393 -0
- package/skills/deno-kv-raft-pubsub/reference/pubsub-api.md +376 -0
- package/skills/deno-kv-raft-pubsub/reference/raft-spec.md +402 -0
- package/skills/deno-kv-raft-pubsub/reference/state-machine.md +182 -0
- package/skills/error-handling/SKILL.md +159 -0
- package/skills/firecrawl/SKILL.md +165 -0
- package/skills/firecrawl/rules/install.md +82 -0
- package/skills/firecrawl/rules/security.md +26 -0
- package/skills/firecrawl-agent/SKILL.md +86 -0
- package/skills/firecrawl-build-interact/SKILL.md +96 -0
- package/skills/firecrawl-build-onboarding/SKILL.md +131 -0
- package/skills/firecrawl-build-onboarding/references/auth-flow.md +39 -0
- package/skills/firecrawl-build-onboarding/references/project-setup.md +20 -0
- package/skills/firecrawl-build-onboarding/references/sdk-installation.md +17 -0
- package/skills/firecrawl-build-scrape/SKILL.md +97 -0
- package/skills/firecrawl-build-search/SKILL.md +97 -0
- package/skills/firecrawl-clone/SKILL.md +419 -0
- package/skills/firecrawl-crawl/SKILL.md +87 -0
- package/skills/firecrawl-download/SKILL.md +98 -0
- package/skills/firecrawl-interact/SKILL.md +112 -0
- package/skills/firecrawl-map/SKILL.md +79 -0
- package/skills/firecrawl-scrape/SKILL.md +97 -0
- package/skills/firecrawl-search/SKILL.md +88 -0
- package/skills/fitrah-guard/SKILL.md +78 -0
- package/skills/forge-quality-rules/SKILL.md +61 -0
- package/skills/ghazali-8lens/SKILL.md +56 -0
- package/skills/ijtihad-novel/SKILL.md +42 -0
- package/skills/ilham-intuition/SKILL.md +42 -0
- package/skills/imagegen/LICENSE.txt +201 -0
- package/skills/imagegen/SKILL.md +374 -0
- package/skills/imagegen/agents/openai.yaml +6 -0
- package/skills/imagegen/assets/imagegen-small.svg +5 -0
- package/skills/imagegen/assets/imagegen.png +0 -0
- package/skills/imagegen/references/cli.md +242 -0
- package/skills/imagegen/references/codex-network.md +33 -0
- package/skills/imagegen/references/image-api.md +90 -0
- package/skills/imagegen/references/prompting.md +118 -0
- package/skills/imagegen/references/sample-prompts.md +433 -0
- package/skills/imagegen/scripts/image_gen.py +995 -0
- package/skills/imagegen/scripts/remove_chroma_key.py +440 -0
- package/skills/istiqra-induction/SKILL.md +44 -0
- package/skills/ladunni-22/SKILL.md +53 -0
- package/skills/mizan/SKILL.md +90 -0
- package/skills/nadia/SKILL.md +56 -0
- package/skills/nadia-psi/SKILL.md +56 -0
- package/skills/never-guess/SKILL.md +75 -0
- package/skills/noor-recognition/SKILL.md +45 -0
- package/skills/observability/SKILL.md +133 -0
- package/skills/openai-docs/LICENSE.txt +201 -0
- package/skills/openai-docs/SKILL.md +100 -0
- package/skills/openai-docs/agents/openai.yaml +14 -0
- package/skills/openai-docs/assets/openai-small.svg +3 -0
- package/skills/openai-docs/assets/openai.png +0 -0
- package/skills/openai-docs/references/latest-model.md +37 -0
- package/skills/openai-docs/references/prompting-guide.md +244 -0
- package/skills/openai-docs/references/upgrade-guide.md +181 -0
- package/skills/openai-docs/scripts/resolve-latest-model-info.js +147 -0
- package/skills/pdf/LICENSE.txt +201 -0
- package/skills/pdf/SKILL.md +85 -0
- package/skills/pdf/agents/openai.yaml +5 -0
- package/skills/pdf/assets/pdf.png +0 -0
- package/skills/playwright/LICENSE.txt +201 -0
- package/skills/playwright/NOTICE.txt +14 -0
- package/skills/playwright/SKILL.md +165 -0
- package/skills/playwright/agents/openai.yaml +6 -0
- package/skills/playwright/assets/playwright-small.svg +3 -0
- package/skills/playwright/assets/playwright.png +0 -0
- package/skills/playwright/references/cli.md +116 -0
- package/skills/playwright/references/workflows.md +95 -0
- package/skills/playwright/scripts/playwright_cli.sh +25 -0
- package/skills/plugin-creator/SKILL.md +178 -0
- package/skills/plugin-creator/agents/openai.yaml +6 -0
- package/skills/plugin-creator/assets/plugin-creator-small.svg +3 -0
- package/skills/plugin-creator/assets/plugin-creator.png +0 -0
- package/skills/plugin-creator/references/plugin-json-spec.md +170 -0
- package/skills/plugin-creator/scripts/create_basic_plugin.py +301 -0
- package/skills/predictor/SKILL.md +43 -0
- package/skills/qiyas-analogy/SKILL.md +204 -0
- package/skills/refactoring/SKILL.md +137 -0
- package/skills/ruh-basis/SKILL.md +42 -0
- package/skills/security-review/SKILL.md +129 -0
- package/skills/skill-creator/SKILL.md +434 -0
- package/skills/skill-creator/agents/openai.yaml +5 -0
- package/skills/skill-creator/assets/skill-creator-small.svg +3 -0
- package/skills/skill-creator/assets/skill-creator.png +0 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/references/openai_yaml.md +49 -0
- package/skills/skill-creator/scripts/generate_openai_yaml.py +226 -0
- package/skills/skill-creator/scripts/init_skill.py +400 -0
- package/skills/skill-creator/scripts/quick_validate.py +101 -0
- package/skills/skill-installer/LICENSE.txt +202 -0
- package/skills/skill-installer/SKILL.md +76 -0
- package/skills/skill-installer/agents/openai.yaml +5 -0
- package/skills/skill-installer/assets/skill-installer-small.svg +3 -0
- package/skills/skill-installer/assets/skill-installer.png +0 -0
- package/skills/skill-installer/scripts/github_utils.py +21 -0
- package/skills/skill-installer/scripts/install-skill-from-github.py +308 -0
- package/skills/skill-installer/scripts/list-skills.py +107 -0
- package/skills/skills-and-hooks-reference/SKILL.md +196 -0
- package/skills/soul-domains/SKILL.md +43 -0
- package/skills/tadabbur/SKILL.md +232 -0
- package/skills/tadabbur-ops/SKILL.md +42 -0
- package/skills/tafakkur/SKILL.md +104 -0
- package/skills/testing-strategy/SKILL.md +122 -0
- package/src/action-ledger-core.ts +1054 -0
- package/src/chat.ts +5 -6
- package/src/codebase-scanner.ts +2 -0
- package/src/connectors/claude-code.ts +149 -12
- package/src/connectors/codebase-awareness.ts +325 -25
- package/src/connectors/codex.ts +1225 -41
- package/src/connectors/cursor.ts +8 -0
- package/src/connectors/governed-adapter.ts +174 -0
- package/src/connectors/opencode.ts +18 -2
- package/src/connectors/repo-guard.ts +24 -12
- package/src/connectors/runtime.ts +99 -2
- package/src/connectors/shell.ts +125 -7
- package/src/cross-cli-hive-binding.ts +290 -0
- package/src/garden-control-plane.ts +24 -1
- package/src/governed-surface-runner.ts +1227 -0
- package/src/index.ts +104 -1
- package/src/task-runner.ts +3794 -0
- package/dist/aria-connector/src/install-hooks.d.ts +0 -18
- package/dist/aria-connector/src/install-hooks.d.ts.map +0 -1
- package/dist/aria-connector/src/install-hooks.js +0 -224
- package/dist/aria-connector/src/install-hooks.js.map +0 -1
- package/dist/aria-connector/src/onboarding-wizard.d.ts +0 -5
- package/dist/aria-connector/src/onboarding-wizard.d.ts.map +0 -1
- package/dist/aria-connector/src/onboarding-wizard.js +0 -188
- package/dist/aria-connector/src/onboarding-wizard.js.map +0 -1
- package/dist/cli-0.2.38.tgz +0 -0
- package/dist/install.sh +0 -13
- package/src/__tests__/anthropic-oauth.test.ts +0 -186
- package/src/__tests__/auth-commands.test.ts +0 -132
- package/src/__tests__/owner-login.test.ts +0 -311
|
@@ -7,6 +7,7 @@ import { connectShell } from './shell.js';
|
|
|
7
7
|
import { installAriaCognitionSkills } from './cognitive-skills.js';
|
|
8
8
|
import { syncDoctrineTriggerMap } from './doctrine-trigger-map.js';
|
|
9
9
|
import { buildMustReadGuide, mustReadIntro } from './must-read.js';
|
|
10
|
+
import { requireGovernedConnectorMutation } from './governed-adapter.js';
|
|
10
11
|
function packageSdkDir() {
|
|
11
12
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
12
13
|
return path.resolve(here, '..', '..', '..', 'sdk');
|
|
@@ -14,11 +15,21 @@ function packageSdkDir() {
|
|
|
14
15
|
function packageTaskProjectLedgerHelperPath() {
|
|
15
16
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
16
17
|
const candidates = [
|
|
18
|
+
path.resolve(here, '..', '..', 'opencode-plugins', 'harness-context', 'task-project-ledger.mjs'),
|
|
17
19
|
path.resolve(here, '..', '..', '..', '..', 'opencode-plugins', 'harness-context', 'task-project-ledger.mjs'),
|
|
18
20
|
path.resolve(here, '..', '..', '..', 'assets', 'opencode-plugins', 'harness-context', 'task-project-ledger.mjs'),
|
|
19
21
|
];
|
|
20
22
|
return candidates.find((candidate) => existsSync(candidate)) || candidates[0];
|
|
21
23
|
}
|
|
24
|
+
function packageProjectBoundaryCognitionPath() {
|
|
25
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const candidates = [
|
|
27
|
+
path.resolve(here, '..', '..', 'hooks', 'lib', 'project-boundary-cognition.mjs'),
|
|
28
|
+
path.resolve(here, '..', '..', '..', '..', 'hooks', 'lib', 'project-boundary-cognition.mjs'),
|
|
29
|
+
path.resolve(here, '..', '..', '..', 'assets', 'hooks', 'lib', 'project-boundary-cognition.mjs'),
|
|
30
|
+
];
|
|
31
|
+
return candidates.find((candidate) => existsSync(candidate)) || candidates[0];
|
|
32
|
+
}
|
|
22
33
|
function installSdk(codexDir, logs) {
|
|
23
34
|
const sdkSrc = packageSdkDir();
|
|
24
35
|
if (!existsSync(sdkSrc)) {
|
|
@@ -74,7 +85,23 @@ function installNodePackage(codexDir, logs) {
|
|
|
74
85
|
function tomlString(value) {
|
|
75
86
|
return JSON.stringify(value);
|
|
76
87
|
}
|
|
88
|
+
function canonicalCodexHookPath(relativePath) {
|
|
89
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
90
|
+
const candidates = [
|
|
91
|
+
path.resolve(here, '..', '..', 'hooks', 'codex-native', relativePath),
|
|
92
|
+
path.resolve(here, '..', '..', '..', '..', 'hooks', 'codex-native', relativePath),
|
|
93
|
+
];
|
|
94
|
+
return candidates.find((candidate) => existsSync(candidate)) || candidates[0];
|
|
95
|
+
}
|
|
96
|
+
function readCanonicalCodexHook(relativePath) {
|
|
97
|
+
const hookPath = canonicalCodexHookPath(relativePath);
|
|
98
|
+
if (!existsSync(hookPath)) {
|
|
99
|
+
throw new Error(`Canonical Codex hook asset missing: ${hookPath}`);
|
|
100
|
+
}
|
|
101
|
+
return readFileSync(hookPath, 'utf8');
|
|
102
|
+
}
|
|
77
103
|
function buildCodexHookRuntimeClient() {
|
|
104
|
+
return readCanonicalCodexHook('lib/runtime-client.mjs');
|
|
78
105
|
return `import { readFileSync, existsSync, mkdirSync, writeFileSync, unlinkSync } from 'node:fs';
|
|
79
106
|
import { spawnSync } from 'node:child_process';
|
|
80
107
|
import { createHash, randomUUID } from 'node:crypto';
|
|
@@ -146,6 +173,15 @@ export function inferSessionId(event) {
|
|
|
146
173
|
return \`codex:\${threadId}:\${turnId}\`;
|
|
147
174
|
}
|
|
148
175
|
|
|
176
|
+
export function inferHiveThreadId(event = {}, sessionId = '') {
|
|
177
|
+
const threadId =
|
|
178
|
+
extractFirst(event, ['thread_id', 'threadId', 'conversation_id', 'conversationId']) ||
|
|
179
|
+
extractFirst(event?.metadata, ['thread_id', 'threadId', 'conversation_id', 'conversationId']);
|
|
180
|
+
if (threadId) return \`codex:\${threadId}\`;
|
|
181
|
+
const raw = sessionId || 'codex';
|
|
182
|
+
return \`codex:\${createHash('sha256').update(raw).digest('hex').slice(0, 16)}\`;
|
|
183
|
+
}
|
|
184
|
+
|
|
149
185
|
export function ensureTraceId(state = {}) {
|
|
150
186
|
return typeof state.traceId === 'string' && state.traceId ? state.traceId : \`trace_\${randomUUID()}\`;
|
|
151
187
|
}
|
|
@@ -253,7 +289,41 @@ export async function runtimePost(route, body = {}) {
|
|
|
253
289
|
return response.json();
|
|
254
290
|
}
|
|
255
291
|
|
|
292
|
+
export async function runtimeGet(route) {
|
|
293
|
+
const token = readToken();
|
|
294
|
+
const headers = {};
|
|
295
|
+
if (token) headers.Authorization = \`Bearer \${token}\`;
|
|
296
|
+
const response = await fetch(\`\${DEFAULT_RUNTIME_URL}\${route}\`, {
|
|
297
|
+
method: 'GET',
|
|
298
|
+
headers,
|
|
299
|
+
});
|
|
300
|
+
if (!response.ok) {
|
|
301
|
+
const detail = await response.text().catch(() => response.statusText);
|
|
302
|
+
throw new Error(\`runtime \${route} failed (\${response.status}): \${detail}\`);
|
|
303
|
+
}
|
|
304
|
+
return response.json();
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export function remoteCoachEnabled(env = process.env) {
|
|
308
|
+
return /^(?:1|true|yes|on)$/i.test(String(
|
|
309
|
+
env.ARIA_REMOTE_COACH_ENABLED ||
|
|
310
|
+
env.ARIA_RUNTIME_COACH_ENABLED ||
|
|
311
|
+
env.ARIA_COACH_REMOTE_ENABLED ||
|
|
312
|
+
''
|
|
313
|
+
));
|
|
314
|
+
}
|
|
315
|
+
|
|
256
316
|
export async function recordCoachPhase(phase, body = {}) {
|
|
317
|
+
if (!remoteCoachEnabled()) {
|
|
318
|
+
return {
|
|
319
|
+
ok: true,
|
|
320
|
+
skipped: true,
|
|
321
|
+
permitted: true,
|
|
322
|
+
decision: 'allow',
|
|
323
|
+
phase,
|
|
324
|
+
reasons: ['remote_coach_disabled'],
|
|
325
|
+
};
|
|
326
|
+
}
|
|
257
327
|
try {
|
|
258
328
|
return await runtimePost('/coach/phase', {
|
|
259
329
|
phase,
|
|
@@ -271,17 +341,82 @@ export async function recordCoachPhase(phase, body = {}) {
|
|
|
271
341
|
}
|
|
272
342
|
}
|
|
273
343
|
|
|
344
|
+
export async function ensurePreTurnMizanReceipt({ sessionId, traceId, state = {}, event = {}, action = '', target = '' } = {}) {
|
|
345
|
+
if (state?.preReceiptId) {
|
|
346
|
+
return { ok: true, state, healed: false };
|
|
347
|
+
}
|
|
348
|
+
const message = String(state?.userText || target || 'codex tool request').slice(0, 4000);
|
|
349
|
+
const packet = await getHarnessClient().getHarnessPacket({
|
|
350
|
+
sessionId,
|
|
351
|
+
platform: 'codex',
|
|
352
|
+
message,
|
|
353
|
+
});
|
|
354
|
+
const packetRef = makeEvidenceRef('harness_packet', packet, { sessionId, platform: 'codex', source: 'pre_tool_receipt_heal' });
|
|
355
|
+
const result = await runtimePost('/mizan/pre', {
|
|
356
|
+
sessionId,
|
|
357
|
+
packet,
|
|
358
|
+
packetRequest: {
|
|
359
|
+
sessionId,
|
|
360
|
+
platform: 'codex',
|
|
361
|
+
message,
|
|
362
|
+
stage: 'codex-pre-tool-receipt-heal',
|
|
363
|
+
actor: 'codex-hook',
|
|
364
|
+
system: 'codex-hook',
|
|
365
|
+
},
|
|
366
|
+
context: {
|
|
367
|
+
sessionId,
|
|
368
|
+
traceId,
|
|
369
|
+
surface: 'codex-hooks',
|
|
370
|
+
platform: 'codex',
|
|
371
|
+
userText: state?.userText || '',
|
|
372
|
+
action,
|
|
373
|
+
target,
|
|
374
|
+
event,
|
|
375
|
+
evidenceRefs: [packetRef],
|
|
376
|
+
},
|
|
377
|
+
});
|
|
378
|
+
const nextState = saveTurnState(sessionId, {
|
|
379
|
+
...state,
|
|
380
|
+
traceId,
|
|
381
|
+
preReceiptId: result?.receipt?.receiptId || null,
|
|
382
|
+
packetTimestamp: packet?.timestamp || null,
|
|
383
|
+
packetRef,
|
|
384
|
+
preReceiptHealed: true,
|
|
385
|
+
preReceiptHealedAt: new Date().toISOString(),
|
|
386
|
+
lastEvent: 'PreToolUse',
|
|
387
|
+
});
|
|
388
|
+
return {
|
|
389
|
+
ok: Boolean(result?.receipt?.receiptId),
|
|
390
|
+
state: nextState,
|
|
391
|
+
healed: true,
|
|
392
|
+
receipt: result?.receipt || null,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
274
396
|
export function classifyAction(event) {
|
|
275
397
|
const toolName = String(event?.tool_name || event?.toolName || '').trim();
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
).
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if (
|
|
398
|
+
const toolInput = event?.tool_input || event?.toolInput || {};
|
|
399
|
+
const toolCommand = String(toolInput?.command ?? '').trim();
|
|
400
|
+
const lowerTool = toolName.toLowerCase();
|
|
401
|
+
|
|
402
|
+
if (/^(?:read|grep|glob|list_mcp_resources|list_mcp_resource_templates)$/i.test(toolName)) return 'read';
|
|
403
|
+
if (lowerTool.includes('apply_patch')) {
|
|
404
|
+
return /^\\*\\*\\* Begin Patch[\\s\\S]*^\\*\\*\\* Delete File:/m.test(toolCommand) ? 'delete' : 'write';
|
|
405
|
+
}
|
|
406
|
+
if (/^(?:edit|write|notebookedit)$/i.test(toolName) || toolInput?.file_path || toolInput?.notebook_path) {
|
|
407
|
+
return 'write';
|
|
408
|
+
}
|
|
409
|
+
if (/delete|destroy|drop|wipe|purge/i.test(toolName)) return 'delete';
|
|
410
|
+
if (/deploy|rollout|release/i.test(toolName)) return 'deploy';
|
|
411
|
+
if (/build|compile|test/i.test(toolName)) return 'build';
|
|
412
|
+
if (!toolCommand) return 'write';
|
|
413
|
+
|
|
414
|
+
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';
|
|
415
|
+
if (/^git\\s+(?:status|log|diff|show|branch|remote|rev-parse|ls-tree|ls-files|stash\\s+list)\\b/.test(toolCommand)) return 'read';
|
|
416
|
+
if (/^(?:kubectl\\s+(?:get|describe|logs|top|version|api-resources)\\b|docker\\s+ps\\b)/.test(toolCommand)) return 'read';
|
|
417
|
+
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';
|
|
418
|
+
if (/^(?:rm|rmdir|unlink|truncate)\\b|drop\\s+table|git\\s+(?:reset|clean)\\b/i.test(toolCommand)) return 'delete';
|
|
419
|
+
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';
|
|
285
420
|
return 'write';
|
|
286
421
|
}
|
|
287
422
|
|
|
@@ -292,6 +427,104 @@ export function summarizeTarget(event) {
|
|
|
292
427
|
}).slice(0, 4000);
|
|
293
428
|
}
|
|
294
429
|
|
|
430
|
+
function normalizeTouchedPath(value) {
|
|
431
|
+
const raw = String(value || '').trim();
|
|
432
|
+
if (!raw) return '';
|
|
433
|
+
return raw.replace(/\\\\/g, '/').replace(/\\/+/, '/');
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function pushTouchedFile(files, value, intent = 'touch') {
|
|
437
|
+
const pathValue = normalizeTouchedPath(value);
|
|
438
|
+
if (!pathValue) return;
|
|
439
|
+
if (!files.some((file) => file.path === pathValue && file.intent === intent)) {
|
|
440
|
+
files.push({ path: pathValue, intent });
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export function extractToolTouchedFiles(event, action = '') {
|
|
445
|
+
const files = [];
|
|
446
|
+
const toolName = String(event?.tool_name || event?.toolName || '').trim();
|
|
447
|
+
const toolInput = event?.tool_input || event?.toolInput || {};
|
|
448
|
+
const intent = action || classifyAction(event);
|
|
449
|
+
pushTouchedFile(files, toolInput?.file_path, intent);
|
|
450
|
+
pushTouchedFile(files, toolInput?.filePath, intent);
|
|
451
|
+
pushTouchedFile(files, toolInput?.path, intent);
|
|
452
|
+
pushTouchedFile(files, toolInput?.notebook_path, intent);
|
|
453
|
+
pushTouchedFile(files, toolInput?.notebookPath, intent);
|
|
454
|
+
if (Array.isArray(toolInput?.files)) toolInput.files.forEach((file) => pushTouchedFile(files, file, intent));
|
|
455
|
+
if (Array.isArray(toolInput?.targetFiles)) toolInput.targetFiles.forEach((file) => pushTouchedFile(files, file, intent));
|
|
456
|
+
const command = String(toolInput?.command || '');
|
|
457
|
+
if (/apply_patch/i.test(toolName) || /^\\*\\*\\* Begin Patch/m.test(command)) {
|
|
458
|
+
for (const match of command.matchAll(/^\\*\\*\\* (?:Update|Add|Delete) File: (.+)$/gm)) {
|
|
459
|
+
pushTouchedFile(files, match[1], intent);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return files.slice(0, 200);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export async function recordHiveFileTouch({ sessionId, threadId = null, event = 'tool_request', files = [], source = 'codex-hook', body = {} } = {}) {
|
|
466
|
+
if (!sessionId || !Array.isArray(files) || files.length === 0) {
|
|
467
|
+
return { ok: true, skipped: true, reason: 'no files to record' };
|
|
468
|
+
}
|
|
469
|
+
try {
|
|
470
|
+
return await runtimePost('/api/hive/file-touch', {
|
|
471
|
+
session_id: sessionId,
|
|
472
|
+
thread_id: threadId,
|
|
473
|
+
event,
|
|
474
|
+
files,
|
|
475
|
+
source,
|
|
476
|
+
body: {
|
|
477
|
+
cwd: process.cwd(),
|
|
478
|
+
...body,
|
|
479
|
+
},
|
|
480
|
+
});
|
|
481
|
+
} catch (error) {
|
|
482
|
+
return {
|
|
483
|
+
ok: false,
|
|
484
|
+
skipped: false,
|
|
485
|
+
error: error instanceof Error ? error.message : String(error),
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export async function recordHiveSessionLifecycle({
|
|
491
|
+
sessionId,
|
|
492
|
+
threadId = null,
|
|
493
|
+
event = 'heartbeat',
|
|
494
|
+
status = null,
|
|
495
|
+
intentSummary = null,
|
|
496
|
+
sourceArtifact = null,
|
|
497
|
+
fileClaims = [],
|
|
498
|
+
doNotTouch = [],
|
|
499
|
+
source = 'codex-hook',
|
|
500
|
+
body = {},
|
|
501
|
+
} = {}) {
|
|
502
|
+
if (!sessionId) return { ok: true, skipped: true, reason: 'no session_id to record' };
|
|
503
|
+
try {
|
|
504
|
+
return await runtimePost('/api/hive/session-lifecycle', {
|
|
505
|
+
session_id: sessionId,
|
|
506
|
+
thread_id: threadId,
|
|
507
|
+
event,
|
|
508
|
+
status: status || event,
|
|
509
|
+
intent_summary: intentSummary || \`\${source} \${event}\`,
|
|
510
|
+
source_artifact: sourceArtifact,
|
|
511
|
+
file_claims: Array.isArray(fileClaims) ? fileClaims : [],
|
|
512
|
+
do_not_touch: Array.isArray(doNotTouch) ? doNotTouch : [],
|
|
513
|
+
body: {
|
|
514
|
+
cwd: process.cwd(),
|
|
515
|
+
source,
|
|
516
|
+
...body,
|
|
517
|
+
},
|
|
518
|
+
});
|
|
519
|
+
} catch (error) {
|
|
520
|
+
return {
|
|
521
|
+
ok: false,
|
|
522
|
+
skipped: false,
|
|
523
|
+
error: error instanceof Error ? error.message : String(error),
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
295
528
|
export function extractUserText(event) {
|
|
296
529
|
return extractText(
|
|
297
530
|
event?.input ??
|
|
@@ -314,11 +547,495 @@ export function extractAssistantText(event) {
|
|
|
314
547
|
);
|
|
315
548
|
}
|
|
316
549
|
|
|
550
|
+
export const ARIA_ALWAYS_ON_SKILLS = Object.freeze([
|
|
551
|
+
'aria-axioms-first-principles',
|
|
552
|
+
'aria-cognition-autofire',
|
|
553
|
+
'aria-first-class-operating-contract',
|
|
554
|
+
'aria-cognition-batch',
|
|
555
|
+
'aria-forge-guardrails',
|
|
556
|
+
'aria-harness-no-stripping',
|
|
557
|
+
'aria-harness-output-discipline',
|
|
558
|
+
'aria-quality-audit',
|
|
559
|
+
'aria-readable-output',
|
|
560
|
+
'aria-senior-code-audit',
|
|
561
|
+
'ghazali-8lens',
|
|
562
|
+
'mizan',
|
|
563
|
+
'never-guess',
|
|
564
|
+
'predictor',
|
|
565
|
+
'qiyas-analogy',
|
|
566
|
+
'tadabbur',
|
|
567
|
+
'aria-repo-doctrine',
|
|
568
|
+
'aria-senior-code-cookbook',
|
|
569
|
+
'aria-http-harness-client',
|
|
570
|
+
'aria-task-codex-executor',
|
|
571
|
+
'aria-decision-mizan',
|
|
572
|
+
'tadabbur-ops',
|
|
573
|
+
'aria-repo-audit',
|
|
574
|
+
'aria-backend-architect',
|
|
575
|
+
'aria-live-ops',
|
|
576
|
+
'aria-memory-index',
|
|
577
|
+
'aria-ops',
|
|
578
|
+
]);
|
|
579
|
+
|
|
580
|
+
export const ARIA_QIYAS_15_PERSPECTIVES = Object.freeze([
|
|
581
|
+
'Owner-Hamza-tomorrow',
|
|
582
|
+
'operator-client',
|
|
583
|
+
'investor',
|
|
584
|
+
'LLM-consumer',
|
|
585
|
+
'human-end-user',
|
|
586
|
+
'skeptic',
|
|
587
|
+
'compliance',
|
|
588
|
+
'engineering-quality',
|
|
589
|
+
'cognitive-load',
|
|
590
|
+
'scale',
|
|
591
|
+
'Islamic-scholar',
|
|
592
|
+
'clinical-scholar',
|
|
593
|
+
'red-team-attacker',
|
|
594
|
+
'1-week-future-self',
|
|
595
|
+
'1-year-future-self',
|
|
596
|
+
]);
|
|
597
|
+
|
|
598
|
+
export const ARIA_TADABBUR_12_STAGES = Object.freeze([
|
|
599
|
+
'EMBED',
|
|
600
|
+
'EXCAVATE',
|
|
601
|
+
'ROOT TRACE',
|
|
602
|
+
'MULTI-LENS',
|
|
603
|
+
'PATTERN',
|
|
604
|
+
'CONSEQUENCE',
|
|
605
|
+
'DWELLING',
|
|
606
|
+
'COLLAPSE',
|
|
607
|
+
'PRINCIPLE',
|
|
608
|
+
'INVERSION',
|
|
609
|
+
'PERSONAL',
|
|
610
|
+
'VOICE',
|
|
611
|
+
]);
|
|
612
|
+
|
|
613
|
+
export const ARIA_QA_AUTOFIRE_CYCLE = Object.freeze([
|
|
614
|
+
'qiyas_15_pass',
|
|
615
|
+
'tadabbur_full_canonical_12_stage',
|
|
616
|
+
'correct',
|
|
617
|
+
'enhance',
|
|
618
|
+
'harden',
|
|
619
|
+
'verify',
|
|
620
|
+
]);
|
|
621
|
+
|
|
622
|
+
export const ARIA_QA_METHOD_CONTRACT = Object.freeze({
|
|
623
|
+
qiyas: 'Qiyas means full Qiyas-15 only. Mini Qiyas is not acceptable for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
624
|
+
tadabbur: 'Tadabbur means the full canonical 12-stage Tadabbur path for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
export const UNIVERSAL_CONNECTOR_ACTUAL_GOAL =
|
|
628
|
+
'Wire extracted books, doctrines, skills, runtimes, primitives, mappings, CLIs, connectors, hooks, sidecars, and agent surfaces into the operating system so agent output improves automatically.';
|
|
629
|
+
|
|
630
|
+
export const UNIVERSAL_CONNECTOR_HIGH_IMPACT_SKILLS = Object.freeze([
|
|
631
|
+
'ghazali-tauba-kca-repair-contract',
|
|
632
|
+
'ghazali-rights-before-balance-settlement',
|
|
633
|
+
'ghazali-delay-is-risk-auditor',
|
|
634
|
+
'ghazali-knowledge-condition-action-patience-bridge',
|
|
635
|
+
'ghazali-cause-means-tawakkal-mizan',
|
|
636
|
+
'ghazali-ultimate-cause-chain-tracer',
|
|
637
|
+
'ghazali-necessity-vs-attachment-mizan',
|
|
638
|
+
'ghazali-attachment-not-possession-auditor',
|
|
639
|
+
'ghazali-acquaintance-before-love-diagnoser',
|
|
640
|
+
'ghazali-love-cup-attachment-displacement-auditor',
|
|
641
|
+
'ghazali-knowledge-will-strength-action-chain',
|
|
642
|
+
'ghazali-means-do-not-cleanse-end-gate',
|
|
643
|
+
'ghazali-six-register-truthfulness-audit',
|
|
644
|
+
'ghazali-breath-capital-day-contract',
|
|
645
|
+
'ghazali-two-premise-action-transduction',
|
|
646
|
+
'ghazali-four-object-thought-ledger',
|
|
647
|
+
'ghazali-one-vice-one-replacement-register',
|
|
648
|
+
'ghazali-bounded-sign-observation',
|
|
649
|
+
'ghazali-three-question-intention-gate',
|
|
650
|
+
'ghazali-principal-profit-loss-muhasabah',
|
|
651
|
+
'ghazali-self-rebuke-false-narrative-interrogator',
|
|
652
|
+
'ghazali-death-remembrance-deception-breaker',
|
|
653
|
+
'ghazali-condition-specific-hope-fear-medicine',
|
|
654
|
+
'ghazali-fear-action-not-paralysis-gate',
|
|
655
|
+
'ghazali-hope-requires-cultivation-auditor',
|
|
656
|
+
]);
|
|
657
|
+
|
|
658
|
+
export const UNIVERSAL_CONNECTOR_REQUIRED_RUNTIMES = Object.freeze([
|
|
659
|
+
'tafakkur-transduction-runtime',
|
|
660
|
+
'six-stage-self-accounting-runtime',
|
|
661
|
+
'mortality-accounting-runtime',
|
|
662
|
+
'fear-hope-condition-regulation-runtime',
|
|
663
|
+
'intention-to-action-integrity-runtime',
|
|
664
|
+
'love-fruit-contentment-runtime',
|
|
665
|
+
'patience-gratitude-purpose-mizan-runtime',
|
|
666
|
+
'tauba-rights-repair-runtime',
|
|
667
|
+
'tawakkal-cause-mizan-runtime',
|
|
668
|
+
'zuhd-necessity-attachment-runtime',
|
|
669
|
+
]);
|
|
670
|
+
|
|
671
|
+
function includesAny(text = '', terms = []) {
|
|
672
|
+
const source = String(text || '').toLowerCase();
|
|
673
|
+
return terms.some((term) => source.includes(String(term).toLowerCase()));
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
function countIncluded(text = '', terms = []) {
|
|
677
|
+
const source = String(text || '').toLowerCase();
|
|
678
|
+
return terms.reduce((count, term) => count + (source.includes(String(term).toLowerCase()) ? 1 : 0), 0);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
function continuationRequested(text = '') {
|
|
682
|
+
return includesAny(text, [
|
|
683
|
+
'continue',
|
|
684
|
+
'next phase',
|
|
685
|
+
'next step',
|
|
686
|
+
'next best',
|
|
687
|
+
'fire',
|
|
688
|
+
'skills',
|
|
689
|
+
'production',
|
|
690
|
+
'ready',
|
|
691
|
+
'what is left',
|
|
692
|
+
"what's left",
|
|
693
|
+
'how far',
|
|
694
|
+
'qa',
|
|
695
|
+
'ledger',
|
|
696
|
+
'autofire',
|
|
697
|
+
'wire',
|
|
698
|
+
]);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function actualGoalHits(text = '') {
|
|
702
|
+
return countIncluded(text, [
|
|
703
|
+
'wire extracted',
|
|
704
|
+
'books',
|
|
705
|
+
'doctrines',
|
|
706
|
+
'skills',
|
|
707
|
+
'runtimes',
|
|
708
|
+
'primitives',
|
|
709
|
+
'mappings',
|
|
710
|
+
'connectors',
|
|
711
|
+
'hooks',
|
|
712
|
+
'sidecars',
|
|
713
|
+
'agent surfaces',
|
|
714
|
+
'output improves automatically',
|
|
715
|
+
'corpus',
|
|
716
|
+
'forced-selection',
|
|
717
|
+
'actual goal',
|
|
718
|
+
]);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
function supportMechanismHits(text = '') {
|
|
722
|
+
return countIncluded(text, ['receipt', 'gate', 'ledger', 'canary', 'drift check', 'phase ']);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
export function buildUniversalConnectorGoalContract({ userText = '', phase = 'turn' } = {}) {
|
|
726
|
+
return {
|
|
727
|
+
id: 'universal-connector-corpus-runtime-goal-contract',
|
|
728
|
+
phase,
|
|
729
|
+
actualGoal: UNIVERSAL_CONNECTOR_ACTUAL_GOAL,
|
|
730
|
+
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.',
|
|
731
|
+
hardStopOnlyFor: ['secrets', 'destructive actions', 'deploy/publication boundary', 'owner-contradicted action', 'proven false completion risk'],
|
|
732
|
+
qaPacket: {
|
|
733
|
+
qiyas: 'Qiyas-15 over owner trust, operator value, engineering quality, cognitive load, scale, compliance, red-team, one-week future, and one-year future.',
|
|
734
|
+
tadabbur: 'Full consequence trace from current action to production behavior; reject motion that only improves receipts.',
|
|
735
|
+
mizan: 'Balance evidence, owner impact, throughput, and false-completion risk; repair low-risk misses before hard-blocking.',
|
|
736
|
+
ghazali8: 'Nur observed substrate, Mizan proportion, Hikma doctrine, Tafakkur structure, Tadabbur consequence, Ilham sensed drift, Wahi owner/corpus anchor, Firasah owner need.',
|
|
737
|
+
fitrah: 'Truth over deception, no harm, sacred trust, power obligates service, reflection before action.',
|
|
738
|
+
},
|
|
739
|
+
selectedSkills: [...UNIVERSAL_CONNECTOR_HIGH_IMPACT_SKILLS],
|
|
740
|
+
selectedRuntimes: [...UNIVERSAL_CONNECTOR_REQUIRED_RUNTIMES],
|
|
741
|
+
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.',
|
|
742
|
+
continuation: continuationRequested(userText),
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
export function evaluateGoalContractOutput(text = '', { userText = '', goalContract = null } = {}) {
|
|
747
|
+
const source = String(text || '');
|
|
748
|
+
const contract = goalContract || buildUniversalConnectorGoalContract({ userText, phase: 'stop' });
|
|
749
|
+
const continuation = contract.continuation || continuationRequested(userText) || actualGoalHits(userText) > 0;
|
|
750
|
+
const blockers = [];
|
|
751
|
+
const warnings = [];
|
|
752
|
+
const repairs = [];
|
|
753
|
+
if (!continuation) return { pass: true, hardBlock: false, score: 1, blockers, warnings, repairs, contract };
|
|
754
|
+
const goalHits = actualGoalHits(source);
|
|
755
|
+
const supportHits = supportMechanismHits(source);
|
|
756
|
+
const hasEvidence = includesAny(source, ['verified', 'observed', 'evidence', 'smoke', 'test', 'audit', 'not production-ready', 'integration-ready', 'blocked', 'pending', 'unverified']);
|
|
757
|
+
const hasNextAction = includesAny(source, ['next highest', 'next best', 'next action', 'next step', 'continue by', 'promote the sandbox corpus', 'wire the registry', 'forced-selection']);
|
|
758
|
+
const hasQa = includesAny(source, ['qa', 'qiyas', 'tadabbur', 'mizan', 'ghazali', 'correct', 'enhance', 'harden', 'repair']);
|
|
759
|
+
if (goalHits === 0) {
|
|
760
|
+
warnings.push('goal-contract: output does not bind the turn to corpus-to-runtime wiring or automatic output improvement');
|
|
761
|
+
repairs.push('Name the actual goal or make the current action directly advance corpus registry, runtime, hook, connector, surface, or forced-selection wiring.');
|
|
762
|
+
}
|
|
763
|
+
if (!hasNextAction) {
|
|
764
|
+
warnings.push('goal-contract: continuation output does not name the next highest-impact action');
|
|
765
|
+
repairs.push('Add a concrete next action that advances real wiring or behavioral QA.');
|
|
766
|
+
}
|
|
767
|
+
if (!hasQa) {
|
|
768
|
+
warnings.push('goal-contract: QA/correction loop is missing from the visible state');
|
|
769
|
+
repairs.push('Add expected-vs-observed QA with correction, enhancement, hardening, or an explicit pass boundary.');
|
|
770
|
+
}
|
|
771
|
+
if (!hasEvidence) {
|
|
772
|
+
warnings.push('goal-contract: evidence boundary is missing');
|
|
773
|
+
repairs.push('State verified, blocked, pending, unverified, or the exact evidence class used before making status claims.');
|
|
774
|
+
}
|
|
775
|
+
if (supportHits >= 3 && supportHits > goalHits + 1) {
|
|
776
|
+
warnings.push('goal-contract: support mechanisms dominate the answer over the actual product goal');
|
|
777
|
+
repairs.push('Reframe receipts, gates, ledgers, and canaries as evidence only, then return to corpus-to-runtime wiring and output improvement.');
|
|
778
|
+
}
|
|
779
|
+
if (/\\bwhat would you like me to do next\\b|\\bhow would you like me to proceed\\b/i.test(source)) {
|
|
780
|
+
blockers.push('goal-contract: output asks the owner to choose the obvious continuation instead of naming the next highest-impact step');
|
|
781
|
+
}
|
|
782
|
+
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)) {
|
|
783
|
+
blockers.push('goal-contract: false completion or readiness claim without bounded evidence');
|
|
784
|
+
}
|
|
785
|
+
if (/\\b(?:\\/consult|consult api|consult response)\\b/i.test(source) && /\\b(?:quality source|core quality|dependency|required)\\b/i.test(source)) {
|
|
786
|
+
blockers.push('goal-contract: consult API is being treated as the core quality engine');
|
|
787
|
+
}
|
|
788
|
+
const score = [goalHits > 0, hasNextAction, hasQa, hasEvidence, !(supportHits >= 3 && supportHits > goalHits + 1), blockers.length === 0].filter(Boolean).length / 6;
|
|
789
|
+
return {
|
|
790
|
+
pass: blockers.length === 0 && score >= 0.67,
|
|
791
|
+
hardBlock: blockers.length > 0,
|
|
792
|
+
score,
|
|
793
|
+
blockers: [...new Set(blockers)],
|
|
794
|
+
warnings: [...new Set(warnings)],
|
|
795
|
+
repairs: [...new Set(repairs)],
|
|
796
|
+
nextHighestImpactAction: contract.nextHighestImpactAction,
|
|
797
|
+
selectedSkills: contract.selectedSkills,
|
|
798
|
+
selectedRuntimes: contract.selectedRuntimes,
|
|
799
|
+
contract,
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
export function inferRequiredAriaSkills(text = '') {
|
|
804
|
+
const raw = String(text || '');
|
|
805
|
+
const lower = raw.toLowerCase();
|
|
806
|
+
const required = new Set(ARIA_ALWAYS_ON_SKILLS);
|
|
807
|
+
const add = (skill) => required.add(skill);
|
|
808
|
+
const mentions = (skill) => new RegExp('(?:^|[^a-z0-9_-])\\\\$?' + skill.replace(/[.*+?^\${}()|[\\]\\\\]/g, '\\\\$&') + '(?:$|[^a-z0-9_-])', 'i').test(raw);
|
|
809
|
+
|
|
810
|
+
for (const skill of [
|
|
811
|
+
'aria-axioms-first-principles',
|
|
812
|
+
'aria-cognition-autofire',
|
|
813
|
+
'aria-first-class-operating-contract',
|
|
814
|
+
'aria-cognition-batch',
|
|
815
|
+
'aria-readable-output',
|
|
816
|
+
'tadabbur',
|
|
817
|
+
'qiyas-analogy',
|
|
818
|
+
]) {
|
|
819
|
+
if (mentions(skill)) add(skill);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
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)) {
|
|
823
|
+
add('aria-cognition-autofire');
|
|
824
|
+
add('aria-readable-output');
|
|
825
|
+
}
|
|
826
|
+
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)) {
|
|
827
|
+
add('aria-first-class-operating-contract');
|
|
828
|
+
}
|
|
829
|
+
if (/\\b(?:axiom|axioms|first principles?|fitrah|source trust|evidence threshold)\\b/i.test(raw)) {
|
|
830
|
+
add('aria-axioms-first-principles');
|
|
831
|
+
}
|
|
832
|
+
if (/\\b(?:full cognition|batch cognition|28\\+15|mizan plus tadabbur|rich cognitives|cognitive batch)\\b/i.test(raw)) {
|
|
833
|
+
add('aria-cognition-batch');
|
|
834
|
+
}
|
|
835
|
+
if (/\\b(?:tadabbur|taddabur|12-stage|heart filter|consequence reasoning|cookbook|deep reflection)\\b/i.test(lower)) {
|
|
836
|
+
add('tadabbur');
|
|
837
|
+
}
|
|
838
|
+
if (/\\b(?:qiyas|analogy|analogical|qiyas-15|structural analogy|asl|hukm|illah|furuq)\\b/i.test(lower)) {
|
|
839
|
+
add('qiyas-analogy');
|
|
840
|
+
}
|
|
841
|
+
if (/\\b(?:fire named skills|fire skills|use aria skills|named skills)\\b/i.test(lower)) {
|
|
842
|
+
add('aria-axioms-first-principles');
|
|
843
|
+
add('aria-cognition-autofire');
|
|
844
|
+
add('aria-cognition-batch');
|
|
845
|
+
add('aria-readable-output');
|
|
846
|
+
add('tadabbur');
|
|
847
|
+
add('qiyas-analogy');
|
|
848
|
+
}
|
|
849
|
+
if (/\\b(?:readable output|readability|owner surface|owner-facing|scannable|stop gate|closeout|final answer)\\b/i.test(lower)) {
|
|
850
|
+
add('aria-readable-output');
|
|
851
|
+
}
|
|
852
|
+
if (/\\b(?:backend|api|server|database|auth|queue|worker|service)\\b/i.test(lower)) {
|
|
853
|
+
add('aria-backend-architect');
|
|
854
|
+
}
|
|
855
|
+
if (/\\b(?:frontend|ui|ux|component|page|screen|css|layout)\\b/i.test(lower)) {
|
|
856
|
+
add('aria-frontend-architect');
|
|
857
|
+
}
|
|
858
|
+
if (/\\b(?:fullstack|end-to-end|e2e|web app|application)\\b/i.test(lower)) {
|
|
859
|
+
add('aria-fullstack-orchestrator');
|
|
860
|
+
}
|
|
861
|
+
if (/\\b(?:deploy|k8s|kubernetes|kubectl|cluster|infra|infrastructure|rollout)\\b/i.test(lower)) {
|
|
862
|
+
add('aria-live-ops');
|
|
863
|
+
add('aria-k8s-deploy');
|
|
864
|
+
}
|
|
865
|
+
if (/\\b(?:repo audit|repository audit|codebase audit|refactor|review)\\b/i.test(lower)) {
|
|
866
|
+
add('aria-repo-audit');
|
|
867
|
+
}
|
|
868
|
+
if (/\\b(?:research|diligence|sources|market|competitor|public sources)\\b/i.test(lower)) {
|
|
869
|
+
add('aria-research-orchestrator');
|
|
870
|
+
}
|
|
871
|
+
if (/\\b(?:business|pricing|gtm|go-to-market|revenue|retention|launch)\\b/i.test(lower)) {
|
|
872
|
+
add('aria-business-frame');
|
|
873
|
+
add('aria-gtm-architect');
|
|
874
|
+
}
|
|
875
|
+
if (required.size > 0 && /\\b(?:aria|harness|codex|claude|hook|gate|runtime|skill|cognition|coach)\\b/i.test(raw)) {
|
|
876
|
+
add('aria-readable-output');
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
return [...required].sort();
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
export function summarizeForcedSkillLoad(promptBuild = null) {
|
|
883
|
+
if (!promptBuild || typeof promptBuild !== 'object') return null;
|
|
884
|
+
const loadedCookbooks = Array.isArray(promptBuild.loadedCookbooks) ? promptBuild.loadedCookbooks : [];
|
|
885
|
+
const missingCookbooks = Array.isArray(promptBuild.missingCookbooks) ? promptBuild.missingCookbooks : [];
|
|
886
|
+
const receipt = promptBuild.skillExecutionReceipt && typeof promptBuild.skillExecutionReceipt === 'object'
|
|
887
|
+
? promptBuild.skillExecutionReceipt
|
|
888
|
+
: null;
|
|
889
|
+
const substrateKernelExecution = receipt?.substrateKernelExecution && typeof receipt.substrateKernelExecution === 'object'
|
|
890
|
+
? receipt.substrateKernelExecution
|
|
891
|
+
: null;
|
|
892
|
+
const executedSkillIds = Array.isArray(receipt?.executedSkillIds)
|
|
893
|
+
? receipt.executedSkillIds
|
|
894
|
+
: Array.isArray(substrateKernelExecution?.executedSkillIds)
|
|
895
|
+
? substrateKernelExecution.executedSkillIds
|
|
896
|
+
: [];
|
|
897
|
+
const executedOperatorIds = Array.isArray(receipt?.executedOperatorIds)
|
|
898
|
+
? receipt.executedOperatorIds
|
|
899
|
+
: Array.isArray(substrateKernelExecution?.executedOperatorIds)
|
|
900
|
+
? substrateKernelExecution.executedOperatorIds
|
|
901
|
+
: [];
|
|
902
|
+
return {
|
|
903
|
+
ok: promptBuild.ok === true,
|
|
904
|
+
requiredSkillIds: Array.isArray(promptBuild.requiredSkillIds) ? promptBuild.requiredSkillIds : [],
|
|
905
|
+
loadedSkillIds: Array.isArray(promptBuild.loadedSkillIds) ? promptBuild.loadedSkillIds : [],
|
|
906
|
+
missingSkillIds: Array.isArray(promptBuild.missingSkillIds) ? promptBuild.missingSkillIds : [],
|
|
907
|
+
loadedSkillHashes: Array.isArray(promptBuild.loadedSkillHashes) ? promptBuild.loadedSkillHashes : [],
|
|
908
|
+
loadedCookbooks: loadedCookbooks.map((entry) => ({
|
|
909
|
+
skillId: entry.skillId || null,
|
|
910
|
+
requestedBy: entry.requestedBy || null,
|
|
911
|
+
cookbookName: entry.cookbookName || null,
|
|
912
|
+
path: entry.path || null,
|
|
913
|
+
hash: entry.hash || null,
|
|
914
|
+
chars: entry.chars || null,
|
|
915
|
+
})),
|
|
916
|
+
missingCookbooks: missingCookbooks.map((entry) => ({
|
|
917
|
+
skillId: entry.skillId || null,
|
|
918
|
+
requestedBy: entry.requestedBy || null,
|
|
919
|
+
cookbookName: entry.cookbookName || null,
|
|
920
|
+
path: entry.path || null,
|
|
921
|
+
})),
|
|
922
|
+
skillExecutionMode: typeof promptBuild.skillExecutionMode === 'string' ? promptBuild.skillExecutionMode : null,
|
|
923
|
+
skillExecutionReceipt: receipt
|
|
924
|
+
? {
|
|
925
|
+
ok: receipt.ok === true,
|
|
926
|
+
mode: receipt.mode || null,
|
|
927
|
+
firedSkillIds: executedSkillIds.length
|
|
928
|
+
? executedSkillIds
|
|
929
|
+
: Array.isArray(receipt.firedSkillIds) ? receipt.firedSkillIds : [],
|
|
930
|
+
executedSkillIds,
|
|
931
|
+
executedOperatorCount: executedOperatorIds.length,
|
|
932
|
+
substrateKernelExecution: substrateKernelExecution
|
|
933
|
+
? {
|
|
934
|
+
ok: substrateKernelExecution.ok === true,
|
|
935
|
+
mode: substrateKernelExecution.mode || null,
|
|
936
|
+
executedOperatorIdsHash: substrateKernelExecution.executedOperatorIdsHash || null,
|
|
937
|
+
executionHash: substrateKernelExecution.executionHash || null,
|
|
938
|
+
}
|
|
939
|
+
: null,
|
|
940
|
+
receiptHash: receipt.receiptHash || null,
|
|
941
|
+
}
|
|
942
|
+
: null,
|
|
943
|
+
promptSha256: promptBuild.prompt ? createHash('sha256').update(String(promptBuild.prompt)).digest('hex') : null,
|
|
944
|
+
promptChars: promptBuild.prompt ? String(promptBuild.prompt).length : 0,
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
export function forcedSkillLoadGaps(state = {}) {
|
|
949
|
+
const summary = state?.forcedSkillLoad || null;
|
|
950
|
+
const required = Array.isArray(state?.requiredSkills) ? state.requiredSkills : [];
|
|
951
|
+
if (required.length === 0) return [];
|
|
952
|
+
if (!summary) return ['forced runtime skill/cookbook context was not built'];
|
|
953
|
+
const gaps = [];
|
|
954
|
+
if (Array.isArray(summary.missingSkillIds) && summary.missingSkillIds.length > 0) {
|
|
955
|
+
gaps.push('missing skill ids: ' + summary.missingSkillIds.join(', '));
|
|
956
|
+
}
|
|
957
|
+
if (Array.isArray(summary.missingCookbooks) && summary.missingCookbooks.length > 0) {
|
|
958
|
+
gaps.push('missing cookbooks: ' + summary.missingCookbooks.map((entry) => entry.path || entry.cookbookName).join(', '));
|
|
959
|
+
}
|
|
960
|
+
if (summary.skillExecutionMode === 'mechanical-receipt') {
|
|
961
|
+
const receipt = summary.skillExecutionReceipt || {};
|
|
962
|
+
const fired = Array.isArray(receipt.executedSkillIds) && receipt.executedSkillIds.length
|
|
963
|
+
? receipt.executedSkillIds
|
|
964
|
+
: Array.isArray(receipt.firedSkillIds) ? receipt.firedSkillIds : [];
|
|
965
|
+
const missingFired = required.filter((skill) => !fired.includes(skill));
|
|
966
|
+
if (receipt.ok !== true) gaps.push('mechanical skill execution receipt did not pass');
|
|
967
|
+
if (receipt.substrateKernelExecution?.ok !== true) gaps.push('substrate kernel execution receipt did not pass');
|
|
968
|
+
if (missingFired.length > 0) gaps.push('mechanical receipt missing fired skill ids: ' + missingFired.join(', '));
|
|
969
|
+
if (summary.promptChars > 75000) gaps.push('mechanical receipt prompt exceeds compact prompt budget');
|
|
970
|
+
}
|
|
971
|
+
if (required.includes('tadabbur')) {
|
|
972
|
+
const cookbookNames = new Set((summary.loadedCookbooks || []).map((entry) => entry.cookbookName).filter(Boolean));
|
|
973
|
+
if (!cookbookNames.has('tadabbur-cookbook.md')) gaps.push('tadabbur required but tadabbur-cookbook.md was not loaded');
|
|
974
|
+
}
|
|
975
|
+
return gaps;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
export function requiresFullAriaCognition(userText = '', requiredSkills = []) {
|
|
979
|
+
const text = String(userText || '');
|
|
980
|
+
if (/\b(?:social|casual|small talk|quick reply)\b/i.test(text)) return false;
|
|
981
|
+
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)) {
|
|
982
|
+
return true;
|
|
983
|
+
}
|
|
984
|
+
return requiredSkills.includes('qiyas-analogy') || requiredSkills.includes('tadabbur');
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
function ownerVisibleText(text = '') {
|
|
988
|
+
return String(text || '')
|
|
989
|
+
.replace(new RegExp('<!--[\\\\s\\\\S]*?-->', 'g'), '')
|
|
990
|
+
.replace(new RegExp('<details\\\\b[\\\\s\\\\S]*?</details>', 'gi'), '')
|
|
991
|
+
.replace(new RegExp('<gate\\\\b[\\\\s\\\\S]*?</gate>', 'gi'), '')
|
|
992
|
+
.replace(new RegExp('<cognition\\\\b[\\\\s\\\\S]*?</cognition>', 'gi'), '')
|
|
993
|
+
.replace(new RegExp('<applied_cognition\\\\b[\\\\s\\\\S]*?</applied_cognition>', 'gi'), '');
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
export function fullCognitionMethodGaps({ state = {}, text = '' } = {}) {
|
|
997
|
+
const required = Array.isArray(state?.requiredSkills) ? state.requiredSkills : [];
|
|
998
|
+
const userText = state?.userText || '';
|
|
999
|
+
if (!requiresFullAriaCognition(userText, required)) return [];
|
|
1000
|
+
const visible = ownerVisibleText(text);
|
|
1001
|
+
const gaps = [];
|
|
1002
|
+
const qiyasLabel = new RegExp('(^|\\\\n)\\\\s*qiyas_15_pass\\\\s*:', 'i');
|
|
1003
|
+
const tadabburLabel = new RegExp('(^|\\\\n)\\\\s*tadabbur_full_canonical_12_stage\\\\s*:', 'i');
|
|
1004
|
+
const tadabburStages = new RegExp('\\\\b(?:EMBED|EXCAVATE|ROOT TRACE|INTENT TRACE|CONTRACT TRACE|CONSEQUENCE|COLLAPSE|SEPARATE|VERIFY|RECORD|DECIDE|ACT)\\\\b', 'g');
|
|
1005
|
+
if (qiyasLabel.test(visible) || (visible.match(/Owner-Hamza-(?:now|tomorrow|future)|Repo integrity|Deploy integrity|Scope discipline/g) || []).length >= 4) {
|
|
1006
|
+
gaps.push('raw Qiyas method dump is on the owner surface; collapse it into the decision and keep method evidence off the visible answer');
|
|
1007
|
+
}
|
|
1008
|
+
if (tadabburLabel.test(visible) || (visible.match(tadabburStages) || []).length >= 4) {
|
|
1009
|
+
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');
|
|
1010
|
+
}
|
|
1011
|
+
// Method coverage is proven by runtime skill-load state, not by forcing
|
|
1012
|
+
// every Qiyas/Tadabbur label into the owner-visible answer.
|
|
1013
|
+
if (new RegExp('<applied_cognition\\\\b', 'i').test(visible) || new RegExp('</applied_cognition>', 'i').test(visible)) {
|
|
1014
|
+
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');
|
|
1015
|
+
}
|
|
1016
|
+
return gaps;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
317
1019
|
function normalizeValidationIssue(issue) {
|
|
318
1020
|
const raw = String(issue || '').replace(/\\s+/g, ' ').trim();
|
|
319
1021
|
if (!raw) return '';
|
|
320
1022
|
if (/No <cognition>/i.test(raw)) return 'missing readable cognition block';
|
|
321
1023
|
if (/missing\\s+<applied_cognition>/i.test(raw)) return 'missing applied cognition contract';
|
|
1024
|
+
if (/owner_facing_cognition_first|owner[- ]readable|Leading with <cognition>|gate surface/i.test(raw)) {
|
|
1025
|
+
return 'owner-readable answer must come before gate XML; move <cognition>/<applied_cognition> after the headline, evidence, and next action';
|
|
1026
|
+
}
|
|
1027
|
+
if (/feedback_full_harness_binding_must_be_structural|just-context-I-read|SDK has primitives|just context|advisory|read[.-]?only/i.test(raw)) {
|
|
1028
|
+
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"';
|
|
1029
|
+
}
|
|
1030
|
+
if (/feedback_pretoolgate_covers_all_action_tools/i.test(raw)) {
|
|
1031
|
+
return 'doctrine wording issue: requirements must not be framed as preferences, optional paths, or fallback layers';
|
|
1032
|
+
}
|
|
1033
|
+
if (/feedback_qa_binds_to_fix_not_question|QA finding has been emitted|Recovery Contract is BINDING/i.test(raw)) {
|
|
1034
|
+
return 'QA finding requires A/B/C/D closure with evidence: fixed in turn, tracked task, scoped Mizan choice, or invalidated';
|
|
1035
|
+
}
|
|
1036
|
+
if (/feedback_no_premature_task_closeout|premature_task_closeout/i.test(raw)) {
|
|
1037
|
+
return 'completion/readiness claim needs matching verification or bounded status';
|
|
1038
|
+
}
|
|
322
1039
|
if (/qualitative_drift/i.test(raw)) return 'qualitative drift language needs a measurable predicate';
|
|
323
1040
|
if (/premature_task_closeout|feedback_no_premature_task_closeout|done\\|complete\\|completed\\|ready\\|verified\\|fixed/i.test(raw)) {
|
|
324
1041
|
return 'completion/readiness claim conflicts with unresolved blocker state';
|
|
@@ -346,26 +1063,36 @@ export function formatValidationFailure(result) {
|
|
|
346
1063
|
}
|
|
347
1064
|
|
|
348
1065
|
export function isAriaControlBlock(text) {
|
|
349
|
-
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());
|
|
1066
|
+
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());
|
|
350
1067
|
}
|
|
351
1068
|
|
|
352
1069
|
export function formatCodexRecoveryBlock({ surface = 'codex', reason = '', issues = [], next = '' } = {}) {
|
|
353
1070
|
const blockers = uniqueStrings([reason, ...issues]);
|
|
1071
|
+
const hasStructuralHarnessBindingBlocker = blockers.some((item) => /structural harness binding/i.test(item));
|
|
1072
|
+
const recoveryLines = hasStructuralHarnessBindingBlocker
|
|
1073
|
+
? [
|
|
1074
|
+
'4. Structural harness binding blocker: do not repeat "SDK primitives" as prose.',
|
|
1075
|
+
'5. In the owner answer, include one concrete line: SDK evidence: <primitive> <receipt/path/status> or SDK evidence: not run yet.',
|
|
1076
|
+
'6. If not run yet, the next action must be the exact primitive call, for example validateOutput, checkAction, inject, gardenTurn, or verifyClaim.',
|
|
1077
|
+
'7. Avoid ambiguous read-only wording; say no production writes were performed when that is the actual evidence.',
|
|
1078
|
+
]
|
|
1079
|
+
: [
|
|
1080
|
+
next || '4. Re-submit the corrected answer; if this blocker repeats twice, escalate with this block report.',
|
|
1081
|
+
];
|
|
354
1082
|
return [
|
|
355
|
-
'
|
|
356
|
-
'
|
|
357
|
-
'
|
|
1083
|
+
'Aria held this Codex output for re-authoring.',
|
|
1084
|
+
'',
|
|
1085
|
+
'Surface: ' + surface,
|
|
1086
|
+
'Status: blocked before user release',
|
|
358
1087
|
'',
|
|
359
1088
|
'Observed blockers:',
|
|
360
1089
|
...(blockers.length ? blockers.map((item) => '- ' + item) : ['- Aria validation failed.']),
|
|
361
1090
|
'',
|
|
362
|
-
'
|
|
363
|
-
'1.
|
|
364
|
-
'2.
|
|
365
|
-
'3.
|
|
366
|
-
|
|
367
|
-
'5. Name a measurable verification predicate, or explicitly state that verification has not run.',
|
|
368
|
-
next || '6. Re-submit the corrected answer; if the same blocker repeats twice, escalate with this full recovery contract.',
|
|
1091
|
+
'Rewrite shape:',
|
|
1092
|
+
'1. Start with the owner-readable answer: status, evidence, next action.',
|
|
1093
|
+
'2. Keep claims bounded unless verification evidence is present.',
|
|
1094
|
+
'3. Put raw gate XML after the answer only when the gate explicitly requires it.',
|
|
1095
|
+
...recoveryLines,
|
|
369
1096
|
].join('\\n');
|
|
370
1097
|
}
|
|
371
1098
|
|
|
@@ -392,10 +1119,12 @@ export function runGovernanceGate(payload = {}) {
|
|
|
392
1119
|
`;
|
|
393
1120
|
}
|
|
394
1121
|
function buildCodexUserPromptHook() {
|
|
1122
|
+
return readCanonicalCodexHook('aria-userprompt-submit.mjs');
|
|
395
1123
|
return `#!/usr/bin/env node
|
|
396
1124
|
import {
|
|
397
1125
|
getHarnessClient,
|
|
398
1126
|
inferSessionId,
|
|
1127
|
+
inferHiveThreadId,
|
|
399
1128
|
inferUserId,
|
|
400
1129
|
ensureTraceId,
|
|
401
1130
|
extractUserText,
|
|
@@ -405,19 +1134,41 @@ import {
|
|
|
405
1134
|
recordCoachPhase,
|
|
406
1135
|
loadTurnState,
|
|
407
1136
|
saveTurnState,
|
|
1137
|
+
inferRequiredAriaSkills,
|
|
1138
|
+
summarizeForcedSkillLoad,
|
|
1139
|
+
forcedSkillLoadGaps,
|
|
1140
|
+
buildUniversalConnectorGoalContract,
|
|
408
1141
|
runGovernanceGate,
|
|
1142
|
+
recordHiveSessionLifecycle,
|
|
409
1143
|
updateTaskProjectLedger,
|
|
410
1144
|
formatCodexRecoveryBlock,
|
|
411
1145
|
emitJson,
|
|
412
1146
|
} from './lib/runtime-client.mjs';
|
|
413
1147
|
|
|
1148
|
+
const ARIA_QA_AUTOFIRE_CYCLE = Object.freeze([
|
|
1149
|
+
'qiyas_15_pass',
|
|
1150
|
+
'tadabbur_full_canonical_12_stage',
|
|
1151
|
+
'correct',
|
|
1152
|
+
'enhance',
|
|
1153
|
+
'harden',
|
|
1154
|
+
'verify',
|
|
1155
|
+
]);
|
|
1156
|
+
|
|
1157
|
+
const ARIA_QA_METHOD_CONTRACT = Object.freeze({
|
|
1158
|
+
qiyas: 'Qiyas means full Qiyas-15 only. Mini Qiyas is not acceptable for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1159
|
+
tadabbur: 'Tadabbur means the full canonical 12-stage Tadabbur path for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1160
|
+
});
|
|
1161
|
+
|
|
414
1162
|
const event = readEventFromStdin();
|
|
415
1163
|
const client = getHarnessClient();
|
|
416
1164
|
const userText = extractUserText(event);
|
|
417
1165
|
const sessionId = inferSessionId(event);
|
|
1166
|
+
const hiveThreadId = inferHiveThreadId(event, sessionId);
|
|
418
1167
|
const userId = inferUserId(event);
|
|
419
1168
|
const priorState = loadTurnState(sessionId);
|
|
420
1169
|
const traceId = ensureTraceId(priorState);
|
|
1170
|
+
const requiredSkills = inferRequiredAriaSkills(userText);
|
|
1171
|
+
const goalContract = buildUniversalConnectorGoalContract({ userText, phase: 'pre_prompt' });
|
|
421
1172
|
const ledgerResult = updateTaskProjectLedger({
|
|
422
1173
|
platform: 'codex',
|
|
423
1174
|
phase: 'pre_prompt_injection',
|
|
@@ -426,6 +1177,15 @@ const ledgerResult = updateTaskProjectLedger({
|
|
|
426
1177
|
});
|
|
427
1178
|
|
|
428
1179
|
try {
|
|
1180
|
+
const lifecycleStart = await recordHiveSessionLifecycle({
|
|
1181
|
+
sessionId,
|
|
1182
|
+
threadId: hiveThreadId,
|
|
1183
|
+
event: 'turn_start',
|
|
1184
|
+
status: 'active',
|
|
1185
|
+
intentSummary: userText.slice(0, 240) || 'Codex session turn started',
|
|
1186
|
+
source: 'codex-userprompt-hook',
|
|
1187
|
+
body: { traceId, userId, goalContract },
|
|
1188
|
+
});
|
|
429
1189
|
await recordCoachPhase('pre_turn', {
|
|
430
1190
|
requestId: traceId,
|
|
431
1191
|
sessionId,
|
|
@@ -464,20 +1224,81 @@ try {
|
|
|
464
1224
|
platform: 'codex',
|
|
465
1225
|
userText,
|
|
466
1226
|
userId,
|
|
1227
|
+
goalContract,
|
|
467
1228
|
evidenceRefs: [packetRef],
|
|
468
1229
|
},
|
|
469
1230
|
});
|
|
1231
|
+
let forcedSkillLoad = null;
|
|
1232
|
+
if (requiredSkills.length > 0) {
|
|
1233
|
+
try {
|
|
1234
|
+
const promptBuild = await runtimePost('/build-system-prompt', {
|
|
1235
|
+
sessionId,
|
|
1236
|
+
message: userText || 'codex forced skill load',
|
|
1237
|
+
requiredSkills,
|
|
1238
|
+
metadata: {
|
|
1239
|
+
source: 'codex-userprompt-submit',
|
|
1240
|
+
cookbookMode: 'required-when-referenced',
|
|
1241
|
+
skillExecutionMode: 'mechanical-receipt',
|
|
1242
|
+
goalContract,
|
|
1243
|
+
},
|
|
1244
|
+
skillExecutionMode: 'mechanical-receipt',
|
|
1245
|
+
});
|
|
1246
|
+
forcedSkillLoad = summarizeForcedSkillLoad(promptBuild);
|
|
1247
|
+
forcedSkillLoad.gaps = forcedSkillLoadGaps({ requiredSkills, forcedSkillLoad });
|
|
1248
|
+
} catch (error) {
|
|
1249
|
+
forcedSkillLoad = {
|
|
1250
|
+
ok: false,
|
|
1251
|
+
requiredSkillIds: requiredSkills,
|
|
1252
|
+
loadedSkillIds: [],
|
|
1253
|
+
missingSkillIds: [],
|
|
1254
|
+
loadedSkillHashes: [],
|
|
1255
|
+
loadedCookbooks: [],
|
|
1256
|
+
missingCookbooks: [],
|
|
1257
|
+
promptSha256: null,
|
|
1258
|
+
promptChars: 0,
|
|
1259
|
+
gaps: ['forced skill autofire runtime call failed: ' + (error instanceof Error ? error.message : String(error))],
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
470
1263
|
await recordCoachPhase('post_cognition', {
|
|
471
1264
|
requestId: traceId,
|
|
472
1265
|
sessionId,
|
|
473
1266
|
text: userText,
|
|
474
|
-
evidenceRefs: [
|
|
475
|
-
|
|
1267
|
+
evidenceRefs: [
|
|
1268
|
+
packetRef,
|
|
1269
|
+
makeEvidenceRef('mizan_pre_receipt', result?.receipt || null, { sessionId, traceId }),
|
|
1270
|
+
...(forcedSkillLoad ? [makeEvidenceRef('forced_skill_load', forcedSkillLoad, { sessionId, traceId })] : []),
|
|
1271
|
+
],
|
|
1272
|
+
metadata: {
|
|
1273
|
+
source: 'codex-userprompt-hook',
|
|
1274
|
+
pre_receipt_id: result?.receipt?.receiptId || null,
|
|
1275
|
+
requiredSkills,
|
|
1276
|
+
forcedSkillLoad,
|
|
1277
|
+
goalContract,
|
|
1278
|
+
hiveThreadId,
|
|
1279
|
+
lifecycleStart,
|
|
1280
|
+
qaAutofire: {
|
|
1281
|
+
mode: 'always-on-15',
|
|
1282
|
+
phase: 'pre_turn',
|
|
1283
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1284
|
+
},
|
|
1285
|
+
},
|
|
476
1286
|
});
|
|
477
1287
|
saveTurnState(sessionId, {
|
|
478
1288
|
traceId,
|
|
479
1289
|
userId,
|
|
480
1290
|
userText,
|
|
1291
|
+
requiredSkills,
|
|
1292
|
+
forcedSkillLoad,
|
|
1293
|
+
goalContract,
|
|
1294
|
+
forcedSkillLoadEnforced: false,
|
|
1295
|
+
forcedSkillAutofire: requiredSkills.length > 0,
|
|
1296
|
+
hiveThreadId,
|
|
1297
|
+
lifecycleStart,
|
|
1298
|
+
qaAutofire: {
|
|
1299
|
+
mode: 'always-on-15',
|
|
1300
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1301
|
+
},
|
|
481
1302
|
preReceiptId: result?.receipt?.receiptId || null,
|
|
482
1303
|
taskProjectLedgerId: ledgerResult.ledger.ledgerId,
|
|
483
1304
|
packetTimestamp: packet?.timestamp || null,
|
|
@@ -497,9 +1318,16 @@ try {
|
|
|
497
1318
|
}
|
|
498
1319
|
`;
|
|
499
1320
|
}
|
|
1321
|
+
function buildCodexLiveTickerHook() {
|
|
1322
|
+
return readCanonicalCodexHook('aria-live-ticker.mjs');
|
|
1323
|
+
}
|
|
1324
|
+
function buildCodexHarnessTickerSidecar() {
|
|
1325
|
+
return readCanonicalCodexHook('aria-harness-ticker-sidecar.mjs');
|
|
1326
|
+
}
|
|
500
1327
|
function buildCodexPreToolHook() {
|
|
1328
|
+
return readCanonicalCodexHook('aria-pre-tool-use.mjs');
|
|
501
1329
|
return `#!/usr/bin/env node
|
|
502
|
-
|
|
1330
|
+
import {
|
|
503
1331
|
inferSessionId,
|
|
504
1332
|
classifyAction,
|
|
505
1333
|
summarizeTarget,
|
|
@@ -507,30 +1335,86 @@ function buildCodexPreToolHook() {
|
|
|
507
1335
|
loadTurnState,
|
|
508
1336
|
makeEvidenceRef,
|
|
509
1337
|
recordCoachPhase,
|
|
1338
|
+
ensurePreTurnMizanReceipt,
|
|
510
1339
|
runGovernanceGate,
|
|
511
1340
|
saveTurnState,
|
|
1341
|
+
forcedSkillLoadGaps,
|
|
1342
|
+
extractToolTouchedFiles,
|
|
1343
|
+
recordHiveFileTouch,
|
|
1344
|
+
recordHiveSessionLifecycle,
|
|
512
1345
|
formatCodexRecoveryBlock,
|
|
513
1346
|
emitJson,
|
|
514
1347
|
} from './lib/runtime-client.mjs';
|
|
515
1348
|
|
|
1349
|
+
const ARIA_QA_AUTOFIRE_CYCLE = Object.freeze([
|
|
1350
|
+
'qiyas_15_pass',
|
|
1351
|
+
'tadabbur_full_canonical_12_stage',
|
|
1352
|
+
'correct',
|
|
1353
|
+
'enhance',
|
|
1354
|
+
'harden',
|
|
1355
|
+
'verify',
|
|
1356
|
+
]);
|
|
1357
|
+
|
|
1358
|
+
const ARIA_QA_METHOD_CONTRACT = Object.freeze({
|
|
1359
|
+
qiyas: 'Qiyas means full Qiyas-15 only. Mini Qiyas is not acceptable for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1360
|
+
tadabbur: 'Tadabbur means the full canonical 12-stage Tadabbur path for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1361
|
+
});
|
|
1362
|
+
|
|
516
1363
|
const event = readEventFromStdin();
|
|
517
1364
|
const sessionId = inferSessionId(event);
|
|
518
1365
|
const action = classifyAction(event);
|
|
519
1366
|
const target = summarizeTarget(event);
|
|
520
|
-
|
|
1367
|
+
let state = loadTurnState(sessionId);
|
|
521
1368
|
|
|
522
1369
|
try {
|
|
523
|
-
if (!state?.preReceiptId
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
1370
|
+
if (!state?.preReceiptId) {
|
|
1371
|
+
try {
|
|
1372
|
+
const healed = await ensurePreTurnMizanReceipt({
|
|
1373
|
+
sessionId,
|
|
1374
|
+
traceId: state?.traceId || sessionId,
|
|
1375
|
+
state,
|
|
1376
|
+
event,
|
|
1377
|
+
action,
|
|
1378
|
+
target,
|
|
1379
|
+
});
|
|
1380
|
+
state = healed.state || state;
|
|
1381
|
+
if (!healed.ok) {
|
|
1382
|
+
emitJson({
|
|
1383
|
+
decision: 'block',
|
|
1384
|
+
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.',
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
} catch (error) {
|
|
1388
|
+
emitJson({
|
|
1389
|
+
decision: 'block',
|
|
1390
|
+
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)),
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
532
1393
|
}
|
|
1394
|
+
const forcedSkillGaps = forcedSkillLoadGaps(state);
|
|
533
1395
|
const toolName = String(event?.tool_name || event?.toolName || '').trim() || null;
|
|
1396
|
+
const touchedFiles = extractToolTouchedFiles(event, action);
|
|
1397
|
+
const hiveThreadId = state?.hiveThreadId || null;
|
|
1398
|
+
const hiveTouch = await recordHiveFileTouch({
|
|
1399
|
+
sessionId,
|
|
1400
|
+
threadId: hiveThreadId,
|
|
1401
|
+
event: 'pre_tool',
|
|
1402
|
+
files: touchedFiles,
|
|
1403
|
+
source: 'codex-pre-tool-hook',
|
|
1404
|
+
body: { action, toolName, target },
|
|
1405
|
+
});
|
|
1406
|
+
const hiveLifecycle = touchedFiles.length > 0
|
|
1407
|
+
? await recordHiveSessionLifecycle({
|
|
1408
|
+
sessionId,
|
|
1409
|
+
threadId: hiveThreadId,
|
|
1410
|
+
event: 'tool_claim',
|
|
1411
|
+
status: 'active',
|
|
1412
|
+
intentSummary: \`Codex tool requested \${action}\${toolName ? ' via ' + toolName : ''}\`,
|
|
1413
|
+
fileClaims: touchedFiles,
|
|
1414
|
+
source: 'codex-pre-tool-hook',
|
|
1415
|
+
body: { action, toolName, target },
|
|
1416
|
+
})
|
|
1417
|
+
: { ok: true, skipped: true, reason: 'no touched files' };
|
|
534
1418
|
const requestRef = makeEvidenceRef('codex_tool_request', { action, toolName, target }, { sessionId });
|
|
535
1419
|
const coach = await recordCoachPhase('pre_tool', {
|
|
536
1420
|
requestId: state?.traceId || sessionId,
|
|
@@ -539,7 +1423,22 @@ try {
|
|
|
539
1423
|
action,
|
|
540
1424
|
target,
|
|
541
1425
|
evidenceRefs: [requestRef],
|
|
542
|
-
metadata: {
|
|
1426
|
+
metadata: {
|
|
1427
|
+
source: 'codex-pre-tool-hook',
|
|
1428
|
+
toolName,
|
|
1429
|
+
requireVerify: action === 'deploy' || action === 'delete',
|
|
1430
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : [],
|
|
1431
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1432
|
+
forcedSkillGaps,
|
|
1433
|
+
touchedFiles,
|
|
1434
|
+
hiveTouch,
|
|
1435
|
+
hiveLifecycle,
|
|
1436
|
+
qaAutofire: {
|
|
1437
|
+
mode: 'always-on-15',
|
|
1438
|
+
phase: 'pre_tool',
|
|
1439
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1440
|
+
},
|
|
1441
|
+
},
|
|
543
1442
|
});
|
|
544
1443
|
if (coach?.permitted === false) {
|
|
545
1444
|
emitJson({
|
|
@@ -574,7 +1473,19 @@ try {
|
|
|
574
1473
|
action,
|
|
575
1474
|
target,
|
|
576
1475
|
evidenceRefs: [requestRef, gateRef],
|
|
577
|
-
metadata: {
|
|
1476
|
+
metadata: {
|
|
1477
|
+
source: 'codex-pre-tool-hook',
|
|
1478
|
+
toolName,
|
|
1479
|
+
governanceGate: gateEvidence,
|
|
1480
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : [],
|
|
1481
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1482
|
+
forcedSkillGaps,
|
|
1483
|
+
qaAutofire: {
|
|
1484
|
+
mode: 'always-on-15',
|
|
1485
|
+
phase: 'pre_tool_gate_signal',
|
|
1486
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1487
|
+
},
|
|
1488
|
+
},
|
|
578
1489
|
});
|
|
579
1490
|
if (gateCoach?.permitted === false) {
|
|
580
1491
|
emitJson({
|
|
@@ -593,6 +1504,9 @@ try {
|
|
|
593
1504
|
action,
|
|
594
1505
|
toolName,
|
|
595
1506
|
target,
|
|
1507
|
+
touchedFiles,
|
|
1508
|
+
hiveTouch,
|
|
1509
|
+
hiveLifecycle,
|
|
596
1510
|
evidenceRef: makeEvidenceRef('tool_request', { action, toolName, target }, { sessionId }),
|
|
597
1511
|
});
|
|
598
1512
|
saveTurnState(sessionId, {
|
|
@@ -612,6 +1526,7 @@ try {
|
|
|
612
1526
|
`;
|
|
613
1527
|
}
|
|
614
1528
|
function buildCodexPostToolHook() {
|
|
1529
|
+
return readCanonicalCodexHook('aria-post-tool-use.mjs');
|
|
615
1530
|
return `#!/usr/bin/env node
|
|
616
1531
|
import {
|
|
617
1532
|
inferSessionId,
|
|
@@ -620,15 +1535,63 @@ import {
|
|
|
620
1535
|
makeEvidenceRef,
|
|
621
1536
|
recordCoachPhase,
|
|
622
1537
|
saveTurnState,
|
|
1538
|
+
forcedSkillLoadGaps,
|
|
1539
|
+
classifyAction,
|
|
1540
|
+
extractToolTouchedFiles,
|
|
1541
|
+
recordHiveFileTouch,
|
|
1542
|
+
recordHiveSessionLifecycle,
|
|
623
1543
|
updateTaskProjectLedger,
|
|
624
1544
|
} from './lib/runtime-client.mjs';
|
|
625
1545
|
|
|
1546
|
+
const ARIA_QA_AUTOFIRE_CYCLE = Object.freeze([
|
|
1547
|
+
'qiyas_15_pass',
|
|
1548
|
+
'tadabbur_full_canonical_12_stage',
|
|
1549
|
+
'correct',
|
|
1550
|
+
'enhance',
|
|
1551
|
+
'harden',
|
|
1552
|
+
'verify',
|
|
1553
|
+
]);
|
|
1554
|
+
|
|
1555
|
+
const ARIA_QA_METHOD_CONTRACT = Object.freeze({
|
|
1556
|
+
qiyas: 'Qiyas means full Qiyas-15 only. Mini Qiyas is not acceptable for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1557
|
+
tadabbur: 'Tadabbur means the full canonical 12-stage Tadabbur path for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1558
|
+
});
|
|
1559
|
+
|
|
626
1560
|
const event = readEventFromStdin();
|
|
627
1561
|
const sessionId = inferSessionId(event);
|
|
628
1562
|
const state = loadTurnState(sessionId);
|
|
629
1563
|
|
|
630
1564
|
try {
|
|
631
1565
|
const toolResponse = JSON.stringify(event?.tool_response ?? event?.toolResponse ?? null).slice(0, 4000);
|
|
1566
|
+
const action = classifyAction(event);
|
|
1567
|
+
const touchedFiles = extractToolTouchedFiles(event, action);
|
|
1568
|
+
const hiveThreadId = state?.hiveThreadId || null;
|
|
1569
|
+
const hiveTouch = await recordHiveFileTouch({
|
|
1570
|
+
sessionId,
|
|
1571
|
+
threadId: hiveThreadId,
|
|
1572
|
+
event: 'post_tool',
|
|
1573
|
+
files: touchedFiles,
|
|
1574
|
+
source: 'codex-post-tool-hook',
|
|
1575
|
+
body: {
|
|
1576
|
+
action,
|
|
1577
|
+
toolName: event?.tool_name || event?.toolName || null,
|
|
1578
|
+
success: !event?.error,
|
|
1579
|
+
},
|
|
1580
|
+
});
|
|
1581
|
+
const hiveLifecycle = await recordHiveSessionLifecycle({
|
|
1582
|
+
sessionId,
|
|
1583
|
+
threadId: hiveThreadId,
|
|
1584
|
+
event: event?.error ? 'tool_error' : 'tool_complete',
|
|
1585
|
+
status: event?.error ? 'needs_review' : 'active',
|
|
1586
|
+
intentSummary: event?.error ? 'Codex tool returned an error' : 'Codex tool completed',
|
|
1587
|
+
fileClaims: touchedFiles,
|
|
1588
|
+
source: 'codex-post-tool-hook',
|
|
1589
|
+
body: {
|
|
1590
|
+
action,
|
|
1591
|
+
toolName: event?.tool_name || event?.toolName || null,
|
|
1592
|
+
success: !event?.error,
|
|
1593
|
+
},
|
|
1594
|
+
});
|
|
632
1595
|
const evidenceRef = makeEvidenceRef('tool_response', event?.tool_response ?? event?.toolResponse ?? null, {
|
|
633
1596
|
sessionId,
|
|
634
1597
|
toolName: event?.tool_name || event?.toolName || null,
|
|
@@ -636,6 +1599,7 @@ try {
|
|
|
636
1599
|
const toolOutputs = Array.isArray(state?.toolOutputs) ? state.toolOutputs.slice(-24) : [];
|
|
637
1600
|
const verificationText = JSON.stringify(event).slice(0, 8000);
|
|
638
1601
|
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);
|
|
1602
|
+
const forcedSkillGaps = forcedSkillLoadGaps(state);
|
|
639
1603
|
await recordCoachPhase('post_tool', {
|
|
640
1604
|
requestId: state?.traceId || sessionId,
|
|
641
1605
|
sessionId,
|
|
@@ -646,12 +1610,27 @@ try {
|
|
|
646
1610
|
toolName: event?.tool_name || event?.toolName || null,
|
|
647
1611
|
verification,
|
|
648
1612
|
error: event?.error || null,
|
|
1613
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : [],
|
|
1614
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1615
|
+
forcedSkillGaps,
|
|
1616
|
+
touchedFiles,
|
|
1617
|
+
hiveTouch,
|
|
1618
|
+
hiveLifecycle,
|
|
1619
|
+
qaAutofire: {
|
|
1620
|
+
mode: 'always-on-15',
|
|
1621
|
+
phase: 'post_tool',
|
|
1622
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1623
|
+
},
|
|
649
1624
|
},
|
|
650
1625
|
});
|
|
651
1626
|
toolOutputs.push({
|
|
652
1627
|
at: new Date().toISOString(),
|
|
653
1628
|
toolName: event?.tool_name || event?.toolName || null,
|
|
654
1629
|
toolResponse,
|
|
1630
|
+
action,
|
|
1631
|
+
touchedFiles,
|
|
1632
|
+
hiveTouch,
|
|
1633
|
+
hiveLifecycle,
|
|
655
1634
|
evidenceRef,
|
|
656
1635
|
});
|
|
657
1636
|
saveTurnState(sessionId, {
|
|
@@ -667,6 +1646,14 @@ try {
|
|
|
667
1646
|
outcome_ref: evidenceRef,
|
|
668
1647
|
verification,
|
|
669
1648
|
commandResult: verification ? 'success' : '',
|
|
1649
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : [],
|
|
1650
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1651
|
+
forcedSkillGaps,
|
|
1652
|
+
qaAutofire: {
|
|
1653
|
+
mode: 'always-on-15',
|
|
1654
|
+
phase: 'post_tool',
|
|
1655
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1656
|
+
},
|
|
670
1657
|
},
|
|
671
1658
|
});
|
|
672
1659
|
process.exit(0);
|
|
@@ -676,16 +1663,23 @@ try {
|
|
|
676
1663
|
`;
|
|
677
1664
|
}
|
|
678
1665
|
function buildCodexStopHook() {
|
|
1666
|
+
return readCanonicalCodexHook('aria-stop.mjs');
|
|
679
1667
|
return `#!/usr/bin/env node
|
|
680
1668
|
import {
|
|
681
1669
|
inferSessionId,
|
|
682
1670
|
extractAssistantText,
|
|
683
1671
|
readEventFromStdin,
|
|
684
1672
|
runtimePost,
|
|
1673
|
+
recordHiveSessionLifecycle,
|
|
685
1674
|
recordCoachPhase,
|
|
686
1675
|
loadTurnState,
|
|
687
1676
|
makeEvidenceRef,
|
|
688
1677
|
clearTurnState,
|
|
1678
|
+
inferRequiredAriaSkills,
|
|
1679
|
+
forcedSkillLoadGaps,
|
|
1680
|
+
fullCognitionMethodGaps,
|
|
1681
|
+
buildUniversalConnectorGoalContract,
|
|
1682
|
+
evaluateGoalContractOutput,
|
|
689
1683
|
formatValidationFailure,
|
|
690
1684
|
formatCodexRecoveryBlock,
|
|
691
1685
|
isAriaControlBlock,
|
|
@@ -696,12 +1690,28 @@ import {
|
|
|
696
1690
|
emitJson,
|
|
697
1691
|
} from './lib/runtime-client.mjs';
|
|
698
1692
|
|
|
1693
|
+
const ARIA_QA_AUTOFIRE_CYCLE = Object.freeze([
|
|
1694
|
+
'qiyas_15_pass',
|
|
1695
|
+
'tadabbur_full_canonical_12_stage',
|
|
1696
|
+
'correct',
|
|
1697
|
+
'enhance',
|
|
1698
|
+
'harden',
|
|
1699
|
+
'verify',
|
|
1700
|
+
]);
|
|
1701
|
+
|
|
1702
|
+
const ARIA_QA_METHOD_CONTRACT = Object.freeze({
|
|
1703
|
+
qiyas: 'Qiyas means full Qiyas-15 only. Mini Qiyas is not acceptable for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1704
|
+
tadabbur: 'Tadabbur means the full canonical 12-stage Tadabbur path for architecture, runtime, code, QA, hook, SDK, worker, or harness work.',
|
|
1705
|
+
});
|
|
1706
|
+
|
|
699
1707
|
const event = readEventFromStdin();
|
|
700
1708
|
const sessionId = inferSessionId(event);
|
|
701
1709
|
const state = loadTurnState(sessionId);
|
|
702
1710
|
const text = extractAssistantText(event);
|
|
1711
|
+
|
|
703
1712
|
const outputRef = makeEvidenceRef('assistant_output', text, { sessionId, traceId: state?.traceId || null });
|
|
704
1713
|
const toolRefs = Array.isArray(state?.toolOutputs) ? state.toolOutputs.map((entry) => entry.evidenceRef).filter(Boolean) : [];
|
|
1714
|
+
const inferredRequiredSkills = inferRequiredAriaSkills(state?.userText || '');
|
|
705
1715
|
const ledgerResult = updateTaskProjectLedger({
|
|
706
1716
|
platform: 'codex',
|
|
707
1717
|
phase: 'stop',
|
|
@@ -717,12 +1727,60 @@ try {
|
|
|
717
1727
|
clearTurnState(sessionId);
|
|
718
1728
|
emitJson({ continue: true });
|
|
719
1729
|
}
|
|
1730
|
+
const forcedSkillGaps = forcedSkillLoadGaps(state);
|
|
1731
|
+
const cognitionMethodGaps = fullCognitionMethodGaps({ state, text });
|
|
1732
|
+
if (cognitionMethodGaps.length > 0) {
|
|
1733
|
+
emitJson({
|
|
1734
|
+
decision: 'block',
|
|
1735
|
+
reason: formatCodexRecoveryBlock({
|
|
1736
|
+
surface: 'codex-stop-full-cognition-method',
|
|
1737
|
+
reason: 'owner-facing output contains raw cognition method dump',
|
|
1738
|
+
issues: cognitionMethodGaps,
|
|
1739
|
+
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.',
|
|
1740
|
+
}),
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
const qaAutofire = {
|
|
1744
|
+
mode: 'always-on-15',
|
|
1745
|
+
phase: 'stop',
|
|
1746
|
+
correctionCycle: ARIA_QA_AUTOFIRE_CYCLE,
|
|
1747
|
+
methodContract: ARIA_QA_METHOD_CONTRACT,
|
|
1748
|
+
};
|
|
1749
|
+
const goalContract = state?.goalContract || buildUniversalConnectorGoalContract({
|
|
1750
|
+
userText: state?.userText || '',
|
|
1751
|
+
phase: 'stop',
|
|
1752
|
+
});
|
|
1753
|
+
const goalQa = evaluateGoalContractOutput(text, {
|
|
1754
|
+
userText: state?.userText || '',
|
|
1755
|
+
goalContract,
|
|
1756
|
+
});
|
|
1757
|
+
if (goalQa.hardBlock) {
|
|
1758
|
+
emitJson({
|
|
1759
|
+
decision: 'block',
|
|
1760
|
+
reason: formatCodexRecoveryBlock({
|
|
1761
|
+
surface: 'codex-stop-goal-contract',
|
|
1762
|
+
reason: 'active goal contract rejected drift or false completion risk',
|
|
1763
|
+
issues: [...goalQa.blockers, ...goalQa.repairs],
|
|
1764
|
+
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.',
|
|
1765
|
+
}),
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
720
1768
|
const postGenerationCoach = await recordCoachPhase('post_generation', {
|
|
721
1769
|
requestId: state?.traceId || sessionId,
|
|
722
1770
|
sessionId,
|
|
723
1771
|
text,
|
|
724
1772
|
evidenceRefs: [outputRef],
|
|
725
|
-
metadata: {
|
|
1773
|
+
metadata: {
|
|
1774
|
+
source: 'codex-stop-hook',
|
|
1775
|
+
requireCognitionBlock: false,
|
|
1776
|
+
requireAppliedCognition: false,
|
|
1777
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1778
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1779
|
+
forcedSkillGaps,
|
|
1780
|
+
goalContract,
|
|
1781
|
+
goalQa,
|
|
1782
|
+
qaAutofire: { ...qaAutofire, phase: 'post_generation' },
|
|
1783
|
+
},
|
|
726
1784
|
});
|
|
727
1785
|
if (postGenerationCoach?.permitted === false) {
|
|
728
1786
|
emitJson({
|
|
@@ -786,7 +1844,18 @@ try {
|
|
|
786
1844
|
validation: validation?.validation || null,
|
|
787
1845
|
layer3: validation?.layer3 || null,
|
|
788
1846
|
evidenceRefs: [outputRef, makeEvidenceRef('runtime_validation', validation, { sessionId, traceId: state?.traceId || null }), ...(gateEvidence ? [makeEvidenceRef('governance_gate', gateEvidence, { sessionId })] : [])],
|
|
789
|
-
metadata: {
|
|
1847
|
+
metadata: {
|
|
1848
|
+
source: 'codex-stop-hook',
|
|
1849
|
+
requireCognitionBlock: false,
|
|
1850
|
+
requireAppliedCognition: false,
|
|
1851
|
+
governanceGate: gateEvidence || null,
|
|
1852
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1853
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1854
|
+
forcedSkillGaps,
|
|
1855
|
+
goalContract,
|
|
1856
|
+
goalQa,
|
|
1857
|
+
qaAutofire: { ...qaAutofire, phase: 'pre_output' },
|
|
1858
|
+
},
|
|
790
1859
|
});
|
|
791
1860
|
if (preOutputCoach?.permitted === false) {
|
|
792
1861
|
emitJson({
|
|
@@ -818,6 +1887,12 @@ try {
|
|
|
818
1887
|
trace_id: state?.traceId || null,
|
|
819
1888
|
output_ref: outputRef,
|
|
820
1889
|
tool_refs: toolRefs,
|
|
1890
|
+
required_skills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1891
|
+
forced_skill_load: state?.forcedSkillLoad || null,
|
|
1892
|
+
forced_skill_gaps: forcedSkillGaps,
|
|
1893
|
+
goal_contract: goalContract,
|
|
1894
|
+
goal_qa: goalQa,
|
|
1895
|
+
qa_autofire: { ...qaAutofire, phase: 'mizan_post' },
|
|
821
1896
|
},
|
|
822
1897
|
context: {
|
|
823
1898
|
sessionId,
|
|
@@ -838,7 +1913,17 @@ try {
|
|
|
838
1913
|
outputRef,
|
|
839
1914
|
makeEvidenceRef('mizan_post_receipt', post?.receipt || null, { sessionId, traceId: state?.traceId || null }),
|
|
840
1915
|
],
|
|
841
|
-
metadata: {
|
|
1916
|
+
metadata: {
|
|
1917
|
+
source: 'codex-stop-hook',
|
|
1918
|
+
requireCognitionBlock: false,
|
|
1919
|
+
requireAppliedCognition: false,
|
|
1920
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1921
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1922
|
+
forcedSkillGaps,
|
|
1923
|
+
goalContract,
|
|
1924
|
+
goalQa,
|
|
1925
|
+
qaAutofire: { ...qaAutofire, phase: 'post_output' },
|
|
1926
|
+
},
|
|
842
1927
|
});
|
|
843
1928
|
await runtimePost('/decision/log', {
|
|
844
1929
|
session_id: sessionId,
|
|
@@ -859,6 +1944,12 @@ try {
|
|
|
859
1944
|
tool_count: Array.isArray(state?.tools) ? state.tools.length : 0,
|
|
860
1945
|
validation_severity: validation?.validation?.severity || 'pass',
|
|
861
1946
|
layer3_pass: validation?.layer3?.pass !== false,
|
|
1947
|
+
required_skills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1948
|
+
forced_skill_load: state?.forcedSkillLoad || null,
|
|
1949
|
+
forced_skill_gaps: forcedSkillGaps,
|
|
1950
|
+
goal_contract: goalContract,
|
|
1951
|
+
goal_qa: goalQa,
|
|
1952
|
+
qa_autofire: { ...qaAutofire, phase: 'decision_log' },
|
|
862
1953
|
},
|
|
863
1954
|
});
|
|
864
1955
|
if (typeof state?.userText === 'string' && state.userText.trim()) {
|
|
@@ -873,6 +1964,12 @@ try {
|
|
|
873
1964
|
decision_category: 'codex-hooks',
|
|
874
1965
|
trace_id: state?.traceId || null,
|
|
875
1966
|
output_ref: outputRef,
|
|
1967
|
+
required_skills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1968
|
+
forced_skill_load: state?.forcedSkillLoad || null,
|
|
1969
|
+
forced_skill_gaps: forcedSkillGaps,
|
|
1970
|
+
goal_contract: goalContract,
|
|
1971
|
+
goal_qa: goalQa,
|
|
1972
|
+
qa_autofire: { ...qaAutofire, phase: 'garden_turn' },
|
|
876
1973
|
},
|
|
877
1974
|
});
|
|
878
1975
|
}
|
|
@@ -885,6 +1982,12 @@ try {
|
|
|
885
1982
|
post_turn: true,
|
|
886
1983
|
output_ref: outputRef,
|
|
887
1984
|
verification: false,
|
|
1985
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
1986
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
1987
|
+
forcedSkillGaps,
|
|
1988
|
+
goalContract,
|
|
1989
|
+
goalQa,
|
|
1990
|
+
qaAutofire: { ...qaAutofire, phase: 'post_turn_ledger' },
|
|
888
1991
|
},
|
|
889
1992
|
});
|
|
890
1993
|
const releaseCoach = await recordCoachPhase('claim_or_release', {
|
|
@@ -900,6 +2003,12 @@ try {
|
|
|
900
2003
|
requireCognitionBlock: false,
|
|
901
2004
|
requireAppliedCognition: false,
|
|
902
2005
|
post_receipt_id: post?.receipt?.receiptId || null,
|
|
2006
|
+
requiredSkills: Array.isArray(state?.requiredSkills) ? state.requiredSkills : inferredRequiredSkills,
|
|
2007
|
+
forcedSkillLoad: state?.forcedSkillLoad || null,
|
|
2008
|
+
forcedSkillGaps,
|
|
2009
|
+
goalContract,
|
|
2010
|
+
goalQa,
|
|
2011
|
+
qaAutofire: { ...qaAutofire, phase: 'claim_or_release' },
|
|
903
2012
|
},
|
|
904
2013
|
});
|
|
905
2014
|
if (releaseCoach?.permitted === false) {
|
|
@@ -911,6 +2020,28 @@ try {
|
|
|
911
2020
|
}),
|
|
912
2021
|
});
|
|
913
2022
|
}
|
|
2023
|
+
const touchedFileMap = new Map();
|
|
2024
|
+
for (const entry of [...(Array.isArray(state?.tools) ? state.tools : []), ...(Array.isArray(state?.toolOutputs) ? state.toolOutputs : [])]) {
|
|
2025
|
+
for (const file of Array.isArray(entry?.touchedFiles) ? entry.touchedFiles : []) {
|
|
2026
|
+
if (file?.path && !touchedFileMap.has(file.path)) touchedFileMap.set(file.path, file);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
await recordHiveSessionLifecycle({
|
|
2030
|
+
sessionId,
|
|
2031
|
+
threadId: state?.hiveThreadId || null,
|
|
2032
|
+
event: 'turn_complete',
|
|
2033
|
+
status: 'completed',
|
|
2034
|
+
intentSummary: (state?.userText || text || 'Codex turn completed').slice(0, 240),
|
|
2035
|
+
fileClaims: [...touchedFileMap.values()],
|
|
2036
|
+
source: 'codex-stop-hook',
|
|
2037
|
+
body: {
|
|
2038
|
+
traceId: state?.traceId || null,
|
|
2039
|
+
outputRef,
|
|
2040
|
+
validationSeverity: validation?.validation?.severity || 'pass',
|
|
2041
|
+
layer3Pass: validation?.layer3?.pass !== false,
|
|
2042
|
+
goalQa,
|
|
2043
|
+
},
|
|
2044
|
+
});
|
|
914
2045
|
clearTurnState(sessionId);
|
|
915
2046
|
emitJson({ continue: true });
|
|
916
2047
|
} catch (error) {
|
|
@@ -927,7 +2058,11 @@ try {
|
|
|
927
2058
|
}
|
|
928
2059
|
function buildCodexHooksToml(codexDir) {
|
|
929
2060
|
const hooksDir = path.join(codexDir, 'hooks');
|
|
2061
|
+
const configPath = path.join(codexDir, 'config.toml');
|
|
930
2062
|
const command = (name) => tomlString(`node ${path.join(hooksDir, name)}`);
|
|
2063
|
+
const stateKey = (event, index) => tomlString(`${configPath}:${event}:${index}:0`);
|
|
2064
|
+
const enabledState = (event, index) => `[hooks.state.${stateKey(event, index)}]
|
|
2065
|
+
enabled = true`;
|
|
931
2066
|
return `# BEGIN ARIA MANAGED HOOKS
|
|
932
2067
|
[hooks]
|
|
933
2068
|
managed_dir = ${tomlString(hooksDir)}
|
|
@@ -935,6 +2070,9 @@ managed_dir = ${tomlString(hooksDir)}
|
|
|
935
2070
|
[[hooks.UserPromptSubmit]]
|
|
936
2071
|
hooks = [{ type = "command", command = ${command('aria-userprompt-submit.mjs')} }]
|
|
937
2072
|
|
|
2073
|
+
[[hooks.UserPromptSubmit]]
|
|
2074
|
+
hooks = [{ type = "command", command = ${command('aria-live-ticker.mjs')} }]
|
|
2075
|
+
|
|
938
2076
|
[[hooks.PreToolUse]]
|
|
939
2077
|
matcher = ".*"
|
|
940
2078
|
hooks = [{ type = "command", command = ${command('aria-pre-tool-use.mjs')} }]
|
|
@@ -945,6 +2083,18 @@ hooks = [{ type = "command", command = ${command('aria-post-tool-use.mjs')} }]
|
|
|
945
2083
|
|
|
946
2084
|
[[hooks.Stop]]
|
|
947
2085
|
hooks = [{ type = "command", command = ${command('aria-stop.mjs')} }]
|
|
2086
|
+
|
|
2087
|
+
[hooks.state]
|
|
2088
|
+
|
|
2089
|
+
${enabledState('user_prompt_submit', 0)}
|
|
2090
|
+
|
|
2091
|
+
${enabledState('user_prompt_submit', 1)}
|
|
2092
|
+
|
|
2093
|
+
${enabledState('pre_tool_use', 0)}
|
|
2094
|
+
|
|
2095
|
+
${enabledState('post_tool_use', 0)}
|
|
2096
|
+
|
|
2097
|
+
${enabledState('stop', 0)}
|
|
948
2098
|
# END ARIA MANAGED HOOKS
|
|
949
2099
|
`;
|
|
950
2100
|
}
|
|
@@ -967,13 +2117,20 @@ function installCodexHooksConfig(codexDir, logs) {
|
|
|
967
2117
|
function installCodexHooks(codexDir, logs) {
|
|
968
2118
|
const hooksDir = path.join(codexDir, 'hooks');
|
|
969
2119
|
mkdirSync(path.join(hooksDir, 'lib'), { recursive: true, mode: 0o755 });
|
|
2120
|
+
mkdirSync(path.join(codexDir, 'lib'), { recursive: true, mode: 0o755 });
|
|
970
2121
|
const ledgerHelperSrc = packageTaskProjectLedgerHelperPath();
|
|
971
2122
|
if (!existsSync(ledgerHelperSrc)) {
|
|
972
2123
|
throw new Error(`Task/project ledger helper missing: ${ledgerHelperSrc}`);
|
|
973
2124
|
}
|
|
2125
|
+
const projectBoundarySrc = packageProjectBoundaryCognitionPath();
|
|
2126
|
+
if (!existsSync(projectBoundarySrc)) {
|
|
2127
|
+
throw new Error(`Project boundary cognition helper missing: ${projectBoundarySrc}`);
|
|
2128
|
+
}
|
|
974
2129
|
const files = [
|
|
975
2130
|
[path.join(hooksDir, 'lib', 'runtime-client.mjs'), buildCodexHookRuntimeClient()],
|
|
976
2131
|
[path.join(hooksDir, 'aria-userprompt-submit.mjs'), buildCodexUserPromptHook()],
|
|
2132
|
+
[path.join(hooksDir, 'aria-live-ticker.mjs'), buildCodexLiveTickerHook()],
|
|
2133
|
+
[path.join(hooksDir, 'aria-harness-ticker-sidecar.mjs'), buildCodexHarnessTickerSidecar()],
|
|
977
2134
|
[path.join(hooksDir, 'aria-pre-tool-use.mjs'), buildCodexPreToolHook()],
|
|
978
2135
|
[path.join(hooksDir, 'aria-post-tool-use.mjs'), buildCodexPostToolHook()],
|
|
979
2136
|
[path.join(hooksDir, 'aria-stop.mjs'), buildCodexStopHook()],
|
|
@@ -990,6 +2147,11 @@ function installCodexHooks(codexDir, logs) {
|
|
|
990
2147
|
chmodSync(path.join(hooksDir, 'lib', 'task-project-ledger.mjs'), 0o755);
|
|
991
2148
|
}
|
|
992
2149
|
catch { }
|
|
2150
|
+
copyFileSync(projectBoundarySrc, path.join(codexDir, 'lib', 'project-boundary-cognition.mjs'));
|
|
2151
|
+
try {
|
|
2152
|
+
chmodSync(path.join(codexDir, 'lib', 'project-boundary-cognition.mjs'), 0o755);
|
|
2153
|
+
}
|
|
2154
|
+
catch { }
|
|
993
2155
|
logs.push(`Installed Codex native hooks → ${hooksDir}`);
|
|
994
2156
|
installCodexHooksConfig(codexDir, logs);
|
|
995
2157
|
}
|
|
@@ -1106,10 +2268,19 @@ Lens roles for decisions:
|
|
|
1106
2268
|
## Structural Cognition Contract
|
|
1107
2269
|
- Cognition is not accepted as proof by itself. It must change the next action, tool call, or output claim.
|
|
1108
2270
|
- Each lens must affect work selection or artifact shape; do not write lenses after the decision is already made.
|
|
1109
|
-
- For every non-trivial output,
|
|
2271
|
+
- For every non-trivial output, applied cognition must change the answer, tool call, or claim boundary.
|
|
2272
|
+
- 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.
|
|
1110
2273
|
- Tool-bound cognition must name the exact tool/action it constrains and the measurable predicate that proves the action succeeded.
|
|
1111
2274
|
- Deploy or destructive actions still require \`<verify>\` and \`<expected>\` blocks before execution.
|
|
1112
2275
|
- If cognition did not change anything, stop and re-think; \`decision_delta: none\` is treated as performative.
|
|
2276
|
+
|
|
2277
|
+
## Autofire Quality Continuation Contract
|
|
2278
|
+
- Actual goal: wire extracted books, doctrines, skills, runtimes, primitives, mappings, CLIs, connectors, and agent surfaces into the operating system so output improves automatically.
|
|
2279
|
+
- 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.
|
|
2280
|
+
- For continuation work, name the next highest-quality, highest-impact step by default; do not make the owner ask for the obvious next action.
|
|
2281
|
+
- 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.
|
|
2282
|
+
- Hard stops are reserved for secrets, destructive actions, deploy/publication boundaries, owner-contradicted actions, and proven false completion risk.
|
|
2283
|
+
- 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.
|
|
1113
2284
|
`;
|
|
1114
2285
|
}
|
|
1115
2286
|
function buildSmokeScript() {
|
|
@@ -1183,9 +2354,15 @@ function installAgentsMd(codexDir, config, logs) {
|
|
|
1183
2354
|
writeFileSync(mustReadPath, buildMustReadGuide('codex'), { mode: 0o644 });
|
|
1184
2355
|
logs.push(`Installed Codex must-read guide → ${mustReadPath}`);
|
|
1185
2356
|
}
|
|
1186
|
-
export async function connectCodex(config) {
|
|
2357
|
+
export async function connectCodex(config, opts = {}) {
|
|
1187
2358
|
const logs = [];
|
|
1188
2359
|
const codexDir = path.join(homedir(), '.codex');
|
|
2360
|
+
await requireGovernedConnectorMutation({
|
|
2361
|
+
surfaceId: 'codex',
|
|
2362
|
+
action: 'install',
|
|
2363
|
+
targetPath: codexDir,
|
|
2364
|
+
reason: 'install Codex harness surface',
|
|
2365
|
+
});
|
|
1189
2366
|
if (!existsSync(codexDir)) {
|
|
1190
2367
|
mkdirSync(codexDir, { recursive: true, mode: 0o700 });
|
|
1191
2368
|
logs.push(`Created ${codexDir}`);
|
|
@@ -1197,7 +2374,12 @@ export async function connectCodex(config) {
|
|
|
1197
2374
|
installCodexHooks(codexDir, logs);
|
|
1198
2375
|
installAriaCognitionSkills(codexDir, logs);
|
|
1199
2376
|
syncDoctrineTriggerMap(logs);
|
|
1200
|
-
|
|
2377
|
+
if (opts.installWrapper === true) {
|
|
2378
|
+
logs.push(...await connectShell('codex', config));
|
|
2379
|
+
}
|
|
2380
|
+
else {
|
|
2381
|
+
logs.push('Skipped Codex shell wrapper install; Codex direct login/default provider path remains untouched. Use aria connect --with-wrappers only when explicitly desired.');
|
|
2382
|
+
}
|
|
1201
2383
|
return logs;
|
|
1202
2384
|
}
|
|
1203
2385
|
//# sourceMappingURL=codex.js.map
|