@aria_asi/cli 0.2.39 → 0.2.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/aria.js +236 -34
- package/dist/aria-connector/src/action-ledger-core.d.ts +387 -0
- package/dist/aria-connector/src/action-ledger-core.d.ts.map +1 -0
- package/dist/aria-connector/src/action-ledger-core.js +638 -0
- package/dist/aria-connector/src/action-ledger-core.js.map +1 -0
- package/dist/aria-connector/src/chat.d.ts.map +1 -1
- package/dist/aria-connector/src/chat.js +5 -6
- package/dist/aria-connector/src/chat.js.map +1 -1
- package/dist/aria-connector/src/codebase-scanner.d.ts +1 -1
- package/dist/aria-connector/src/codebase-scanner.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.d.ts +1 -0
- package/dist/aria-connector/src/connectors/claude-code.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/claude-code.js +152 -14
- package/dist/aria-connector/src/connectors/claude-code.js.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts +10 -0
- package/dist/aria-connector/src/connectors/codebase-awareness.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/codebase-awareness.js +276 -27
- package/dist/aria-connector/src/connectors/codebase-awareness.js.map +1 -1
- package/dist/aria-connector/src/connectors/codex.d.ts +3 -1
- package/dist/aria-connector/src/connectors/codex.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/codex.js +1271 -40
- package/dist/aria-connector/src/connectors/codex.js.map +1 -1
- package/dist/aria-connector/src/connectors/cursor.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/cursor.js +7 -0
- package/dist/aria-connector/src/connectors/cursor.js.map +1 -1
- package/dist/aria-connector/src/connectors/governed-adapter.d.ts +30 -0
- package/dist/aria-connector/src/connectors/governed-adapter.d.ts.map +1 -0
- package/dist/aria-connector/src/connectors/governed-adapter.js +132 -0
- package/dist/aria-connector/src/connectors/governed-adapter.js.map +1 -0
- package/dist/aria-connector/src/connectors/opencode.d.ts +3 -1
- package/dist/aria-connector/src/connectors/opencode.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/opencode.js +18 -2
- package/dist/aria-connector/src/connectors/opencode.js.map +1 -1
- package/dist/aria-connector/src/connectors/repo-guard.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/repo-guard.js +25 -14
- package/dist/aria-connector/src/connectors/repo-guard.js.map +1 -1
- package/dist/aria-connector/src/connectors/runtime.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/runtime.js +92 -2
- package/dist/aria-connector/src/connectors/runtime.js.map +1 -1
- package/dist/aria-connector/src/connectors/shell.d.ts.map +1 -1
- package/dist/aria-connector/src/connectors/shell.js +123 -7
- package/dist/aria-connector/src/connectors/shell.js.map +1 -1
- package/dist/aria-connector/src/cross-cli-hive-binding.d.ts +63 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.d.ts.map +1 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.js +205 -0
- package/dist/aria-connector/src/cross-cli-hive-binding.js.map +1 -0
- package/dist/aria-connector/src/garden-control-plane.d.ts +6 -1
- package/dist/aria-connector/src/garden-control-plane.d.ts.map +1 -1
- package/dist/aria-connector/src/garden-control-plane.js +8 -2
- package/dist/aria-connector/src/garden-control-plane.js.map +1 -1
- package/dist/aria-connector/src/governed-surface-runner.d.ts +189 -0
- package/dist/aria-connector/src/governed-surface-runner.d.ts.map +1 -0
- package/dist/aria-connector/src/governed-surface-runner.js +1022 -0
- package/dist/aria-connector/src/governed-surface-runner.js.map +1 -0
- package/dist/aria-connector/src/index.d.ts +10 -1
- package/dist/aria-connector/src/index.d.ts.map +1 -1
- package/dist/aria-connector/src/index.js +5 -0
- package/dist/aria-connector/src/index.js.map +1 -1
- package/dist/aria-connector/src/task-runner.d.ts +3 -0
- package/dist/aria-connector/src/task-runner.d.ts.map +1 -0
- package/dist/aria-connector/src/task-runner.js +3526 -0
- package/dist/aria-connector/src/task-runner.js.map +1 -0
- package/dist/aria-web/src/lib/codebase-scanner.d.ts +21 -2
- package/dist/aria-web/src/lib/codebase-scanner.d.ts.map +1 -1
- package/dist/aria-web/src/lib/codebase-scanner.js +59 -14
- package/dist/aria-web/src/lib/codebase-scanner.js.map +1 -1
- package/dist/assets/hooks/README.md +58 -0
- package/dist/assets/hooks/aria-agent-handoff.mjs +147 -2
- package/dist/assets/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/dist/assets/hooks/aria-architect-fallback.mjs +10 -2
- package/dist/assets/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/dist/assets/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/dist/assets/hooks/aria-first-class-coach.mjs +305 -10
- package/dist/assets/hooks/aria-harness-via-sdk.mjs +93 -16
- package/dist/assets/hooks/aria-import-resolution-gate.mjs +106 -20
- package/dist/assets/hooks/aria-outcome-record.mjs +56 -20
- package/dist/assets/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/dist/assets/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/dist/assets/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/dist/assets/hooks/aria-pre-text-gate.mjs +11 -2
- package/dist/assets/hooks/aria-pre-tool-gate.mjs +516 -92
- package/dist/assets/hooks/aria-pre-tool-use.mjs +70 -6
- package/dist/assets/hooks/aria-preprompt-consult.mjs +23 -4
- package/dist/assets/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/dist/assets/hooks/aria-stop-gate.mjs +585 -76
- package/dist/assets/hooks/aria-trigger-autolearn.mjs +17 -3
- package/dist/assets/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/dist/assets/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/dist/assets/hooks/canonical-settings-block.json +172 -0
- package/dist/assets/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/dist/assets/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/dist/assets/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/dist/assets/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/dist/assets/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/dist/assets/hooks/codex-native/aria-stop.mjs +691 -0
- package/dist/assets/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/dist/assets/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/dist/assets/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/dist/assets/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/dist/assets/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/dist/assets/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/dist/assets/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/dist/assets/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/dist/assets/hooks/doctrine_trigger_map.json +236 -25
- package/dist/assets/hooks/doctrine_trigger_map.schema.json +46 -0
- package/dist/assets/hooks/install.sh +84 -0
- package/dist/assets/hooks/lib/action-ledger-core.mjs +269 -0
- package/dist/assets/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/dist/assets/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/dist/assets/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/dist/assets/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/dist/assets/hooks/lib/canonical-lenses.mjs +83 -6
- package/dist/assets/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/dist/assets/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/dist/assets/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/dist/assets/hooks/lib/domain-output-quality.mjs +132 -3
- package/dist/assets/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/dist/assets/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/dist/assets/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/assets/hooks/lib/first-class-coach.mjs +454 -19
- package/dist/assets/hooks/lib/gate-audit.mjs +12 -2
- package/dist/assets/hooks/lib/gate-loop-state.mjs +11 -2
- package/dist/assets/hooks/lib/goal-contract-quality.mjs +302 -0
- package/dist/assets/hooks/lib/hook-message-window.mjs +101 -9
- package/dist/assets/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/dist/assets/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/assets/hooks/lib/obligation-ledger.mjs +147 -0
- package/dist/assets/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/dist/assets/hooks/lib/owner-authorizations.mjs +269 -0
- package/dist/assets/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/dist/assets/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/dist/assets/hooks/lib/recovery-context.mjs +151 -0
- package/dist/assets/hooks/lib/recovery-template-loader.mjs +154 -0
- package/dist/assets/hooks/lib/self-doctrine-check.mjs +321 -0
- package/dist/assets/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/dist/assets/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/dist/assets/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/dist/assets/hooks/lib/surface-caught.mjs +94 -0
- package/dist/assets/hooks/recovery-templates/force-reauthor.md +67 -0
- package/dist/assets/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/dist/assets/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/dist/assets/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/dist/assets/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/dist/assets/hooks/test-tier-lens-labeling.mjs +14 -3
- package/dist/assets/opencode-plugins/harness-context/index.js +39 -6
- package/dist/assets/opencode-plugins/harness-context/task-project-ledger.mjs +5 -1
- package/dist/assets/opencode-plugins/harness-gate/index.js +36 -0
- package/dist/assets/opencode-plugins/harness-gate/lib/atlas-dossier-client.js +1 -0
- package/dist/assets/opencode-plugins/harness-gate/lib/recovery-grants.js +79 -0
- package/dist/assets/opencode-plugins/harness-outcome/index.js +12 -0
- package/dist/assets/opencode-plugins/harness-stop/index.js +97 -2
- package/dist/assets/opencode-plugins/harness-stop/lib/atlas-dossier-client.js +1 -0
- package/dist/assets/opencode-plugins/harness-stop/lib/domain-output-quality.js +15 -2
- package/dist/assets/opencode-plugins/lib/coach.js +148 -0
- package/dist/runtime/coach-kernel.mjs +144 -7
- package/dist/runtime/codex-bridge.mjs +254 -8
- package/dist/runtime/discipline/doctrine_trigger_map.json +236 -25
- package/dist/runtime/discipline/skills/aria-cognition/34-frameworks-unified/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-cognitives/SKILL.md +128 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-post-phase/SKILL.md +118 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/SKILL.md +202 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-axioms-first-principles/references/source-map.md +130 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-backend-architect/SKILL.md +124 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-backend-architect/references/backend-cookbook.md +417 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-audit/SKILL.md +133 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-audit/references/audit-cookbook.md +247 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-frame/SKILL.md +138 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-business-frame/references/business-cookbook.md +154 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-chat/SKILL.md +84 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-chat/scripts/aria-chat.sh +57 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-cognition-autofire/SKILL.md +137 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-cognition-batch/SKILL.md +264 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-decision-mizan/SKILL.md +136 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-decision-mizan/references/decision-frameworks.md +287 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-first-class-operating-contract/SKILL.md +104 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-frontend-architect/SKILL.md +123 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-frontend-architect/references/frontend-cookbook.md +358 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-fullstack-orchestrator/SKILL.md +127 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-fullstack-orchestrator/references/fullstack-cookbook.md +383 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-gtm-architect/SKILL.md +126 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-gtm-architect/references/gtm-cookbook.md +235 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-deploy/SKILL.md +145 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-no-stripping/SKILL.md +135 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-onboarding/SKILL.md +130 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-output-discipline/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-harness-substrate-binding/SKILL.md +139 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-http-harness-client/SKILL.md +85 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-k8s-deploy/SKILL.md +174 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ladduniframe/SKILL.md +60 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-live-ops/SKILL.md +54 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-mac-ssh-ops/SKILL.md +100 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-memory-index/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-noor-cognitives/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ops/SKILL.md +60 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-ops/references/live-endpoints.md +59 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-quality-audit/SKILL.md +133 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-readable-output/SKILL.md +239 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-readable-output/references/layout-cookbook.md +366 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-reasoning/SKILL.md +67 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-reasoning/references/core-principles.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-repo-audit/SKILL.md +135 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-repo-audit/references/repo-audit-cookbook.md +375 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-research-orchestrator/SKILL.md +138 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-research-orchestrator/references/research-patterns.md +270 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-retention-engine/SKILL.md +120 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-retention-engine/references/retention-cookbook.md +271 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-revenue-engine/SKILL.md +128 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-revenue-engine/references/revenue-cookbook.md +227 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-audit/SKILL.md +233 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-audit/references/audit-checklist.md +369 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-cookbook/SKILL.md +288 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-senior-code-cookbook/references/engineering-cookbook.md +489 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-soul-principles/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/aria-task-codex-executor/SKILL.md +86 -0
- package/dist/runtime/discipline/skills/aria-cognition/aristotle-engine/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/cross-domain-24/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/deepsoul-emotional/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/fitrah-guard/SKILL.md +78 -0
- package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/SKILL.md +227 -29
- package/dist/runtime/discipline/skills/aria-cognition/ghazali-8lens/references/ghazali-8lens-cookbook.md +797 -0
- package/dist/runtime/discipline/skills/aria-cognition/ijtihad-novel/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/ilham-intuition/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/never-guess/SKILL.md +77 -0
- package/dist/runtime/discipline/skills/aria-cognition/noor-recognition/SKILL.md +45 -0
- package/dist/runtime/discipline/skills/aria-cognition/qiyas-analogy/SKILL.md +174 -14
- package/dist/runtime/discipline/skills/aria-cognition/ruh-basis/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur/SKILL.md +506 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur/references/tadabbur-cookbook.md +921 -0
- package/dist/runtime/discipline/skills/aria-cognition/tadabbur-ops/SKILL.md +42 -0
- package/dist/runtime/discipline/skills/aria-cognition/tafakkur/SKILL.md +104 -0
- package/dist/runtime/doctrine_trigger_map.json +236 -25
- package/dist/runtime/embedded-public-key.mjs +27 -0
- package/dist/runtime/gated-ledger.mjs +41 -14
- package/dist/runtime/harness-daemon.mjs +85 -10
- package/dist/runtime/hive-wal-publisher.mjs +292 -0
- package/dist/runtime/hooks/README.md +58 -0
- package/dist/runtime/hooks/aria-agent-handoff.mjs +147 -2
- package/dist/runtime/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/dist/runtime/hooks/aria-architect-fallback.mjs +10 -2
- package/dist/runtime/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/dist/runtime/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/dist/runtime/hooks/aria-first-class-coach.mjs +305 -10
- package/dist/runtime/hooks/aria-harness-via-sdk.mjs +93 -16
- package/dist/runtime/hooks/aria-import-resolution-gate.mjs +106 -20
- package/dist/runtime/hooks/aria-outcome-record.mjs +56 -20
- package/dist/runtime/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/dist/runtime/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/dist/runtime/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/dist/runtime/hooks/aria-pre-text-gate.mjs +11 -2
- package/dist/runtime/hooks/aria-pre-tool-gate.mjs +516 -92
- package/dist/runtime/hooks/aria-pre-tool-use.mjs +70 -6
- package/dist/runtime/hooks/aria-preprompt-consult.mjs +23 -4
- package/dist/runtime/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/dist/runtime/hooks/aria-stop-gate.mjs +585 -76
- package/dist/runtime/hooks/aria-trigger-autolearn.mjs +17 -3
- package/dist/runtime/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/dist/runtime/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/dist/runtime/hooks/canonical-settings-block.json +172 -0
- package/dist/runtime/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/dist/runtime/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/dist/runtime/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/dist/runtime/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/dist/runtime/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/dist/runtime/hooks/codex-native/aria-stop.mjs +691 -0
- package/dist/runtime/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/dist/runtime/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/dist/runtime/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/dist/runtime/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/dist/runtime/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/dist/runtime/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/dist/runtime/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/dist/runtime/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/dist/runtime/hooks/doctrine_trigger_map.json +236 -25
- package/dist/runtime/hooks/doctrine_trigger_map.schema.json +46 -0
- package/dist/runtime/hooks/install.sh +84 -0
- package/dist/runtime/hooks/lib/action-ledger-core.mjs +269 -0
- package/dist/runtime/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/dist/runtime/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/dist/runtime/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/dist/runtime/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/dist/runtime/hooks/lib/canonical-lenses.mjs +83 -6
- package/dist/runtime/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/dist/runtime/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/dist/runtime/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/dist/runtime/hooks/lib/domain-output-quality.mjs +132 -3
- package/dist/runtime/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/dist/runtime/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/dist/runtime/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/runtime/hooks/lib/first-class-coach.mjs +454 -19
- package/dist/runtime/hooks/lib/gate-audit.mjs +12 -2
- package/dist/runtime/hooks/lib/gate-loop-state.mjs +11 -2
- package/dist/runtime/hooks/lib/goal-contract-quality.mjs +302 -0
- package/dist/runtime/hooks/lib/hook-message-window.mjs +101 -9
- package/dist/runtime/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/dist/runtime/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/runtime/hooks/lib/obligation-ledger.mjs +147 -0
- package/dist/runtime/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/dist/runtime/hooks/lib/owner-authorizations.mjs +269 -0
- package/dist/runtime/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/dist/runtime/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/dist/runtime/hooks/lib/recovery-context.mjs +151 -0
- package/dist/runtime/hooks/lib/recovery-template-loader.mjs +154 -0
- package/dist/runtime/hooks/lib/self-doctrine-check.mjs +321 -0
- package/dist/runtime/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/dist/runtime/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/dist/runtime/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/dist/runtime/hooks/lib/surface-caught.mjs +94 -0
- package/dist/runtime/hooks/recovery-templates/force-reauthor.md +67 -0
- package/dist/runtime/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/dist/runtime/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/dist/runtime/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/dist/runtime/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/dist/runtime/hooks/test-tier-lens-labeling.mjs +14 -3
- package/dist/runtime/lib/evaluate-with-kernel.mjs +133 -0
- package/dist/runtime/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/dist/runtime/local-phase.mjs +10 -5
- package/dist/runtime/manifest.json +8 -8
- package/dist/runtime/packet-verifier.mjs +166 -0
- package/dist/runtime/provider-proxy.mjs +13 -0
- package/dist/runtime/quality-enforcer.mjs +40 -23
- package/dist/runtime/runtime-rails/registry.mjs +252 -0
- package/dist/runtime/sdk/BUNDLED.json +2 -2
- package/dist/runtime/sdk/index.d.ts +119 -4
- package/dist/runtime/sdk/index.js +138 -12
- package/dist/runtime/sdk/index.js.map +1 -1
- package/dist/runtime/service.mjs +8036 -764
- package/dist/runtime/sub-agent-enforcer.mjs +201 -0
- package/dist/runtime/task-project-ledger.mjs +5 -1
- package/dist/sdk/BUNDLED.json +2 -2
- package/dist/sdk/index.d.ts +119 -4
- package/dist/sdk/index.js +138 -12
- package/dist/sdk/index.js.map +1 -1
- package/hooks/README.md +58 -0
- package/hooks/aria-agent-handoff.mjs +147 -2
- package/hooks/aria-agent-ledger-merge.mjs +31 -7
- package/hooks/aria-architect-fallback.mjs +10 -2
- package/hooks/aria-claim-evidence-stop-gate.mjs +240 -0
- package/hooks/aria-cognition-substrate-binding.mjs +84 -10
- package/hooks/aria-first-class-coach.mjs +305 -10
- package/hooks/aria-harness-via-sdk.mjs +93 -16
- package/hooks/aria-import-resolution-gate.mjs +106 -20
- package/hooks/aria-outcome-record.mjs +56 -20
- package/hooks/aria-pre-emit-autoload.mjs +1809 -0
- package/hooks/aria-pre-emit-autoload.mjs.before-orchestration-redesign +1400 -0
- package/hooks/aria-pre-emit-dryrun.mjs +22 -3
- package/hooks/aria-pre-text-gate.mjs +11 -2
- package/hooks/aria-pre-tool-gate.mjs +516 -92
- package/hooks/aria-pre-tool-use.mjs +70 -6
- package/hooks/aria-preprompt-consult.mjs +23 -4
- package/hooks/aria-repo-doctrine-gate.mjs +29 -3
- package/hooks/aria-stop-gate.mjs +585 -76
- package/hooks/aria-trigger-autolearn.mjs +17 -3
- package/hooks/aria-universal-turn-packet.mjs +1165 -0
- package/hooks/aria-userprompt-abandon-detect.mjs +9 -1
- package/hooks/canonical-settings-block.json +172 -0
- package/hooks/codex-native/aria-harness-ticker-sidecar.mjs +92 -0
- package/hooks/codex-native/aria-hive-wal-consumer.mjs +86 -0
- package/hooks/codex-native/aria-live-ticker.mjs +38 -0
- package/hooks/codex-native/aria-post-tool-use.mjs +236 -0
- package/hooks/codex-native/aria-pre-tool-use.mjs +362 -0
- package/hooks/codex-native/aria-stop.mjs +691 -0
- package/hooks/codex-native/aria-userprompt-submit.mjs +623 -0
- package/hooks/codex-native/atlas-session-context.mjs +121 -0
- package/hooks/codex-native/lib/evaluate-with-kernel.mjs +257 -0
- package/hooks/codex-native/lib/hive-wal-consumer.mjs +452 -0
- package/hooks/codex-native/lib/kernel/deterministic-cognitive-kernel.mjs +914 -0
- package/hooks/codex-native/lib/project-boundary-cognition.mjs +143 -0
- package/hooks/codex-native/lib/runtime-client.mjs +3567 -0
- package/hooks/codex-native/lib/task-project-ledger.mjs +294 -0
- package/hooks/doctrine_trigger_map.json +236 -25
- package/hooks/doctrine_trigger_map.schema.json +46 -0
- package/hooks/install.sh +84 -0
- package/hooks/lib/action-ledger-core.mjs +269 -0
- package/hooks/lib/aria-gate-ledger.mjs +143 -0
- package/hooks/lib/ast-stub-shape-detector.mjs +107 -0
- package/hooks/lib/atlas-dossier-client.mjs +151 -0
- package/hooks/lib/atlas-orchestrator-postwire.mjs +221 -0
- package/hooks/lib/canonical-lenses.mjs +83 -6
- package/hooks/lib/coach-intent-classifier.mjs +248 -0
- package/hooks/lib/cognitive-block-parser.mjs +111 -0
- package/hooks/lib/doctrine-trigger-map-loader.mjs +137 -0
- package/hooks/lib/domain-output-quality.mjs +132 -3
- package/hooks/lib/empty-catch-scanner.mjs +91 -0
- package/hooks/lib/end-phase-qa-autofire.mjs +426 -0
- package/hooks/lib/evaluate-with-kernel.mjs +133 -0
- package/hooks/lib/first-class-coach.mjs +454 -19
- package/hooks/lib/gate-audit.mjs +12 -2
- package/hooks/lib/gate-loop-state.mjs +11 -2
- package/hooks/lib/goal-contract-quality.mjs +302 -0
- package/hooks/lib/hook-message-window.mjs +101 -9
- package/hooks/lib/invocation-required-verifier.mjs +184 -0
- package/hooks/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/hooks/lib/obligation-ledger.mjs +147 -0
- package/hooks/lib/orchestration-manifest-extract.mjs +217 -0
- package/hooks/lib/owner-authorizations.mjs +269 -0
- package/hooks/lib/probe-discipline-scanner.mjs +142 -0
- package/hooks/lib/project-boundary-cognition.mjs +143 -0
- package/hooks/lib/recovery-context.mjs +151 -0
- package/hooks/lib/recovery-template-loader.mjs +154 -0
- package/hooks/lib/self-doctrine-check.mjs +321 -0
- package/hooks/lib/sensitive-shape-detector.mjs +64 -0
- package/hooks/lib/skill-autoload-gate-impl.mjs +226 -1
- package/hooks/lib/stop-hook-protocol.mjs +166 -0
- package/hooks/lib/surface-caught.mjs +94 -0
- package/hooks/recovery-templates/force-reauthor.md +67 -0
- package/hooks/recovery-templates/handoff-recovery.md +25 -0
- package/hooks/scripts/check-hard-risk-prefix.mjs +99 -0
- package/hooks/skills/aria-conversational-doctrine-discipline/SKILL.md +101 -0
- package/hooks/test-aria-preturn-memory-gate.mjs +2 -2
- package/hooks/test-tier-lens-labeling.mjs +14 -3
- package/opencode-plugins/harness-context/index.js +39 -6
- package/opencode-plugins/harness-context/task-project-ledger.mjs +5 -1
- package/opencode-plugins/harness-gate/index.js +36 -0
- package/opencode-plugins/harness-gate/lib/atlas-dossier-client.js +1 -0
- package/opencode-plugins/harness-gate/lib/recovery-grants.js +79 -0
- package/opencode-plugins/harness-outcome/index.js +12 -0
- package/opencode-plugins/harness-stop/index.js +97 -2
- package/opencode-plugins/harness-stop/lib/atlas-dossier-client.js +1 -0
- package/opencode-plugins/harness-stop/lib/domain-output-quality.js +15 -2
- package/opencode-plugins/lib/coach.js +148 -0
- package/package.json +71 -5
- package/runtime-src/coach-kernel.mjs +144 -7
- package/runtime-src/codex-bridge.mjs +254 -8
- package/runtime-src/embedded-public-key.mjs +27 -0
- package/runtime-src/gated-ledger.mjs +41 -14
- package/runtime-src/harness-daemon.mjs +85 -10
- package/runtime-src/hive-wal-publisher.mjs +292 -0
- package/runtime-src/lib/evaluate-with-kernel.mjs +133 -0
- package/runtime-src/lib/kernel/deterministic-cognitive-kernel.mjs +906 -0
- package/runtime-src/local-phase.mjs +10 -5
- package/runtime-src/packet-verifier.mjs +166 -0
- package/runtime-src/provider-proxy.mjs +13 -0
- package/runtime-src/quality-enforcer.mjs +40 -23
- package/runtime-src/runtime-rails/registry.mjs +252 -0
- package/runtime-src/service.mjs +8036 -764
- package/runtime-src/sub-agent-enforcer.mjs +201 -0
- package/scripts/aria-ledger-append.mjs +337 -0
- package/scripts/aria-task-cheap-worker-dispatch.mjs +234 -0
- package/scripts/audit-of-audit-prior-tasks.mjs +194 -0
- package/scripts/audit-of-audit-this-turn.mjs +116 -0
- package/scripts/bundle-sdk.mjs +31 -5
- package/scripts/check-cli-wrapper-provider-contract.mjs +160 -0
- package/scripts/check-client-compatibility.mjs +15 -5
- package/scripts/check-client-smoke.mjs +297 -0
- package/scripts/check-codex-orchestrator-adoption.mjs +150 -0
- package/scripts/check-glm-env-wired.mjs +131 -0
- package/scripts/check-hive-local-storage-contract.mjs +91 -0
- package/scripts/check-hook-mirror.mjs +150 -0
- package/scripts/check-install-sh-drift.mjs +152 -0
- package/scripts/check-kernel-sync.mjs +101 -0
- package/scripts/check-package-artifact.mjs +152 -0
- package/scripts/check-registry-mirror.mjs +71 -0
- package/scripts/drain-owner-airtable-sync-queue.mjs +287 -0
- package/scripts/export-owner-status-sheets.mjs +589 -0
- package/scripts/live-sidecar-receipt-canary.mjs +347 -0
- package/scripts/qiyas-tadabbur-model-matrix.mjs +970 -0
- package/scripts/quality-ab-live-provider.mjs +913 -0
- package/scripts/self-test-action-ledger-core.mjs +190 -0
- package/scripts/self-test-approval-receipt-binding.mjs +122 -0
- package/scripts/self-test-autofire-quality-output.mjs +110 -0
- package/scripts/self-test-claude-code-action-ledger.mjs +132 -0
- package/scripts/self-test-claude-code-mechanical-autofire-hive.mjs +138 -0
- package/scripts/self-test-claude-code-mechanical-autofire.mjs +234 -0
- package/scripts/self-test-codebase-awareness-atlas-delta.mjs +159 -0
- package/scripts/self-test-codebase-awareness-delta-ingest.mjs +179 -0
- package/scripts/self-test-codex-live-hook-parity.mjs +84 -0
- package/scripts/self-test-codex-native-action-ledger.mjs +167 -0
- package/scripts/self-test-codex-native-hook-json-contract.mjs +74 -0
- package/scripts/self-test-codex-orchestrator-continuity.mjs +113 -0
- package/scripts/self-test-codex-readable-recovery.mjs +94 -0
- package/scripts/self-test-codex-self-harness.mjs +538 -0
- package/scripts/self-test-compiled-workunit.mjs +214 -0
- package/scripts/self-test-continuation-output-smoke.mjs +101 -0
- package/scripts/self-test-cross-cli-fleet-ticker.mjs +85 -0
- package/scripts/self-test-cross-cli-hive-adoption.mjs +125 -0
- package/scripts/self-test-cross-cli-hive-learning.mjs +146 -0
- package/scripts/self-test-cross-phase-tool-failure.mjs +110 -0
- package/scripts/self-test-cross-surface-action-ledger.mjs +149 -0
- package/scripts/self-test-end-of-phase-qa-court.mjs +616 -0
- package/scripts/self-test-evaluate-with-kernel.mjs +111 -0
- package/scripts/self-test-first-class-output-delta-proof.mjs +307 -0
- package/scripts/self-test-goal-contract-output-qa.mjs +73 -0
- package/scripts/self-test-goal-contract.mjs +35 -0
- package/scripts/self-test-governed-adapters.mjs +105 -0
- package/scripts/self-test-governed-surface-runner.mjs +198 -0
- package/scripts/self-test-harness-gates.mjs +15 -12
- package/scripts/self-test-harness-ticker-sidecar.mjs +153 -0
- package/scripts/self-test-hive-org-kernel.mjs +233 -0
- package/scripts/self-test-hive-session-coordination.mjs +156 -0
- package/scripts/self-test-hive-wal-consumer.mjs +111 -0
- package/scripts/self-test-kernel-a3-a4-selection.mjs +179 -0
- package/scripts/self-test-ledger-append.mjs +175 -0
- package/scripts/self-test-live-codex-posttool-packet-smoke.mjs +111 -0
- package/scripts/self-test-live-codex-pretool-packet-smoke.mjs +101 -0
- package/scripts/self-test-live-codex-stop-qa-kernel-smoke.mjs +43 -0
- package/scripts/self-test-live-wrapper-substrate-inventory.mjs +149 -0
- package/scripts/self-test-local-main-sync-script.mjs +47 -0
- package/scripts/self-test-mechanical-autofire-resolver.mjs +296 -0
- package/scripts/self-test-no-consult-cognitive-skills-output.mjs +135 -0
- package/scripts/self-test-owner-airtable-sync-queue.mjs +196 -0
- package/scripts/self-test-owner-airtable-sync.mjs +181 -0
- package/scripts/self-test-owner-sheets-action-ledger.mjs +100 -0
- package/scripts/self-test-production-preflight.mjs +78 -0
- package/scripts/self-test-project-boundary-cognition.mjs +79 -0
- package/scripts/self-test-qa-exec-kernel.mjs +34 -0
- package/scripts/self-test-qa-recovery-learning-loop.mjs +113 -0
- package/scripts/self-test-qiyas-label-alignment.mjs +94 -0
- package/scripts/self-test-recovery-context.mjs +110 -0
- package/scripts/self-test-repo-guard.mjs +10 -0
- package/scripts/self-test-runtime-health-self-heal.mjs +161 -0
- package/scripts/self-test-runtime-postcondition.mjs +70 -0
- package/scripts/self-test-soul-precommit-hook.mjs +39 -0
- package/scripts/self-test-stop-gate-kernel-guards.mjs +185 -0
- package/scripts/self-test-stop-gate.mjs +128 -0
- package/scripts/self-test-substrate-kernel-execution-receipt.mjs +130 -0
- package/scripts/self-test-substrate-open-skill-floor.mjs +87 -0
- package/scripts/self-test-substrate-output-quality-eval.mjs +171 -0
- package/scripts/self-test-task-closeout-drift.mjs +97 -0
- package/scripts/self-test-task-project-ledger-readiness.mjs +43 -0
- package/scripts/self-test-task-runner-phase-consumer.mjs +134 -0
- package/scripts/self-test-task-worker-lane.mjs +256 -0
- package/scripts/self-test-turn-substrate-qa-kernel.mjs +188 -0
- package/scripts/self-test-universal-action-capture.mjs +153 -0
- package/scripts/self-test-universal-turn-packet-entrypoints.mjs +252 -0
- package/scripts/self-test-universal-turn-packet.mjs +320 -0
- package/scripts/session-quality-backfill.mjs +253 -0
- package/scripts/smoke-autofire-100-prompts.mjs +481 -0
- package/scripts/sync-local-main-on-task-complete.mjs +278 -0
- package/scripts/sync-owner-status-airtable.mjs +1158 -0
- package/scripts/validate-skill-prompts.mjs +12 -1
- package/scripts/verify-codex-native-mirror.mjs +262 -0
- package/skills/34-frameworks-unified/SKILL.md +42 -0
- package/skills/api-design/SKILL.md +123 -0
- package/skills/architecture-decision/SKILL.md +105 -0
- package/skills/aria-aristotle-cognitives/SKILL.md +128 -0
- package/skills/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/skills/aria-aristotle-post-phase/SKILL.md +116 -0
- package/skills/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/skills/aria-axioms-first-principles/SKILL.md +202 -0
- package/skills/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/skills/aria-axioms-first-principles/references/source-map.md +130 -0
- package/skills/aria-chat/SKILL.md +84 -0
- package/skills/aria-chat/scripts/aria-chat.sh +57 -0
- package/skills/aria-cognition/34-frameworks-unified/SKILL.md +42 -0
- package/skills/aria-cognition/aria-aristotle-cognitives/SKILL.md +128 -0
- package/skills/aria-cognition/aria-aristotle-intra-phase/SKILL.md +99 -0
- package/skills/aria-cognition/aria-aristotle-post-phase/SKILL.md +118 -0
- package/skills/aria-cognition/aria-aristotle-pre-phase/SKILL.md +117 -0
- package/skills/aria-cognition/aria-axioms-first-principles/SKILL.md +202 -0
- package/skills/aria-cognition/aria-axioms-first-principles/agents/openai.yaml +4 -0
- package/skills/aria-cognition/aria-axioms-first-principles/references/source-map.md +130 -0
- package/skills/aria-cognition/aria-backend-architect/SKILL.md +124 -0
- package/skills/aria-cognition/aria-backend-architect/references/backend-cookbook.md +417 -0
- package/skills/aria-cognition/aria-business-audit/SKILL.md +133 -0
- package/skills/aria-cognition/aria-business-audit/references/audit-cookbook.md +247 -0
- package/skills/aria-cognition/aria-business-frame/SKILL.md +138 -0
- package/skills/aria-cognition/aria-business-frame/references/business-cookbook.md +154 -0
- package/skills/aria-cognition/aria-chat/SKILL.md +84 -0
- package/skills/aria-cognition/aria-chat/scripts/aria-chat.sh +57 -0
- package/skills/aria-cognition/aria-cognition-autofire/SKILL.md +137 -0
- package/skills/aria-cognition/aria-cognition-batch/SKILL.md +264 -0
- package/skills/aria-cognition/aria-decision-mizan/SKILL.md +136 -0
- package/skills/aria-cognition/aria-decision-mizan/references/decision-frameworks.md +287 -0
- package/skills/aria-cognition/aria-first-class-operating-contract/SKILL.md +104 -0
- package/skills/aria-cognition/aria-frontend-architect/SKILL.md +123 -0
- package/skills/aria-cognition/aria-frontend-architect/references/frontend-cookbook.md +358 -0
- package/skills/aria-cognition/aria-fullstack-orchestrator/SKILL.md +127 -0
- package/skills/aria-cognition/aria-fullstack-orchestrator/references/fullstack-cookbook.md +383 -0
- package/skills/aria-cognition/aria-gtm-architect/SKILL.md +126 -0
- package/skills/aria-cognition/aria-gtm-architect/references/gtm-cookbook.md +235 -0
- package/skills/aria-cognition/aria-harness-deploy/SKILL.md +145 -0
- package/skills/aria-cognition/aria-harness-no-stripping/SKILL.md +135 -0
- package/skills/aria-cognition/aria-harness-onboarding/SKILL.md +130 -0
- package/skills/aria-cognition/aria-harness-output-discipline/SKILL.md +120 -0
- package/skills/aria-cognition/aria-harness-substrate-binding/SKILL.md +139 -0
- package/skills/aria-cognition/aria-http-harness-client/SKILL.md +85 -0
- package/skills/aria-cognition/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/skills/aria-cognition/aria-k8s-deploy/SKILL.md +174 -0
- package/skills/aria-cognition/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/skills/aria-cognition/aria-ladduniframe/SKILL.md +60 -0
- package/skills/aria-cognition/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/skills/aria-cognition/aria-live-ops/SKILL.md +54 -0
- package/skills/aria-cognition/aria-mac-ssh-ops/SKILL.md +100 -0
- package/skills/aria-cognition/aria-memory-index/SKILL.md +42 -0
- package/skills/aria-cognition/aria-noor-cognitives/SKILL.md +120 -0
- package/skills/aria-cognition/aria-ops/SKILL.md +60 -0
- package/skills/aria-cognition/aria-ops/references/live-endpoints.md +59 -0
- package/skills/aria-cognition/aria-quality-audit/SKILL.md +133 -0
- package/skills/aria-cognition/aria-readable-output/SKILL.md +239 -0
- package/skills/aria-cognition/aria-readable-output/references/layout-cookbook.md +366 -0
- package/skills/aria-cognition/aria-reasoning/SKILL.md +67 -0
- package/skills/aria-cognition/aria-reasoning/references/core-principles.md +42 -0
- package/skills/aria-cognition/aria-repo-audit/SKILL.md +135 -0
- package/skills/aria-cognition/aria-repo-audit/references/repo-audit-cookbook.md +375 -0
- package/skills/aria-cognition/aria-research-orchestrator/SKILL.md +138 -0
- package/skills/aria-cognition/aria-research-orchestrator/references/research-patterns.md +270 -0
- package/skills/aria-cognition/aria-retention-engine/SKILL.md +120 -0
- package/skills/aria-cognition/aria-retention-engine/references/retention-cookbook.md +271 -0
- package/skills/aria-cognition/aria-revenue-engine/SKILL.md +128 -0
- package/skills/aria-cognition/aria-revenue-engine/references/revenue-cookbook.md +227 -0
- package/skills/aria-cognition/aria-senior-code-audit/SKILL.md +233 -0
- package/skills/aria-cognition/aria-senior-code-audit/references/audit-checklist.md +369 -0
- package/skills/aria-cognition/aria-senior-code-cookbook/SKILL.md +288 -0
- package/skills/aria-cognition/aria-senior-code-cookbook/references/engineering-cookbook.md +489 -0
- package/skills/aria-cognition/aria-soul-principles/SKILL.md +42 -0
- package/skills/aria-cognition/aria-task-codex-executor/SKILL.md +86 -0
- package/skills/aria-cognition/aristotle-engine/SKILL.md +42 -0
- package/skills/aria-cognition/cross-domain-24/SKILL.md +42 -0
- package/skills/aria-cognition/deepsoul-emotional/SKILL.md +42 -0
- package/skills/aria-cognition/fitrah-guard/SKILL.md +78 -0
- package/skills/aria-cognition/ghazali-8lens/SKILL.md +227 -29
- package/skills/aria-cognition/ghazali-8lens/references/ghazali-8lens-cookbook.md +797 -0
- package/skills/aria-cognition/ijtihad-novel/SKILL.md +42 -0
- package/skills/aria-cognition/ilham-intuition/SKILL.md +42 -0
- package/skills/aria-cognition/never-guess/SKILL.md +77 -0
- package/skills/aria-cognition/noor-recognition/SKILL.md +45 -0
- package/skills/aria-cognition/qiyas-analogy/SKILL.md +174 -14
- package/skills/aria-cognition/ruh-basis/SKILL.md +42 -0
- package/skills/aria-cognition/tadabbur/SKILL.md +506 -0
- package/skills/aria-cognition/tadabbur/references/tadabbur-cookbook.md +921 -0
- package/skills/aria-cognition/tadabbur-ops/SKILL.md +42 -0
- package/skills/aria-cognition/tafakkur/SKILL.md +104 -0
- package/skills/aria-cognition-autofire/SKILL.md +109 -0
- package/skills/aria-cognition-batch/SKILL.md +264 -0
- package/skills/aria-conversational-doctrine-discipline/SKILL.md +125 -0
- package/skills/aria-essence/SKILL.md +81 -0
- package/skills/aria-essence/references/domain-matrix.md +80 -0
- package/skills/aria-essence/references/evolution-loop.md +30 -0
- package/skills/aria-essence/references/readable-cognition.md +27 -0
- package/skills/aria-first-class-operating-contract/SKILL.md +104 -0
- package/skills/aria-forge-guardrails/SKILL.md +53 -0
- package/skills/aria-forge-guardrails/references/checklist.md +31 -0
- package/skills/aria-harness-deploy/SKILL.md +145 -0
- package/skills/aria-harness-no-stripping/SKILL.md +135 -0
- package/skills/aria-harness-onboarding/SKILL.md +130 -0
- package/skills/aria-harness-output-discipline/SKILL.md +120 -0
- package/skills/aria-harness-substrate-binding/SKILL.md +139 -0
- package/skills/aria-http-harness-client/SKILL.md +85 -0
- package/skills/aria-http-harness-client/scripts/smoke.mjs +47 -0
- package/skills/aria-k8s-deploy/SKILL.md +174 -0
- package/skills/aria-k8s-deploy/agents/openai.yaml +3 -0
- package/skills/aria-ladduniframe/SKILL.md +60 -0
- package/skills/aria-ledger-fleet-execution/SKILL.md +126 -0
- package/skills/aria-live-ops/SKILL.md +54 -0
- package/skills/aria-mac-ssh-ops/SKILL.md +100 -0
- package/skills/aria-memory-index/SKILL.md +42 -0
- package/skills/aria-noor-cognitives/SKILL.md +120 -0
- package/skills/aria-ops/SKILL.md +60 -0
- package/skills/aria-ops/references/live-endpoints.md +59 -0
- package/skills/aria-quality-audit/SKILL.md +133 -0
- package/skills/aria-reasoning/SKILL.md +67 -0
- package/skills/aria-reasoning/references/core-principles.md +42 -0
- package/skills/aria-repo-doctrine/SKILL.md +57 -0
- package/skills/aria-soul-principles/SKILL.md +42 -0
- package/skills/aria-task-codex-executor/SKILL.md +86 -0
- package/skills/aristotle-engine/SKILL.md +42 -0
- package/skills/ci-cd-pipeline/SKILL.md +116 -0
- package/skills/code-review/SKILL.md +131 -0
- package/skills/cross-domain-24/SKILL.md +42 -0
- package/skills/database-design/SKILL.md +124 -0
- package/skills/deepsoul-emotional/SKILL.md +42 -0
- package/skills/deno-kv-raft-pubsub/SKILL.md +561 -0
- package/skills/deno-kv-raft-pubsub/reference/maelstrom-integration.md +393 -0
- package/skills/deno-kv-raft-pubsub/reference/pubsub-api.md +376 -0
- package/skills/deno-kv-raft-pubsub/reference/raft-spec.md +402 -0
- package/skills/deno-kv-raft-pubsub/reference/state-machine.md +182 -0
- package/skills/error-handling/SKILL.md +159 -0
- package/skills/firecrawl/SKILL.md +165 -0
- package/skills/firecrawl/rules/install.md +82 -0
- package/skills/firecrawl/rules/security.md +26 -0
- package/skills/firecrawl-agent/SKILL.md +86 -0
- package/skills/firecrawl-build-interact/SKILL.md +96 -0
- package/skills/firecrawl-build-onboarding/SKILL.md +131 -0
- package/skills/firecrawl-build-onboarding/references/auth-flow.md +39 -0
- package/skills/firecrawl-build-onboarding/references/project-setup.md +20 -0
- package/skills/firecrawl-build-onboarding/references/sdk-installation.md +17 -0
- package/skills/firecrawl-build-scrape/SKILL.md +97 -0
- package/skills/firecrawl-build-search/SKILL.md +97 -0
- package/skills/firecrawl-clone/SKILL.md +419 -0
- package/skills/firecrawl-crawl/SKILL.md +87 -0
- package/skills/firecrawl-download/SKILL.md +98 -0
- package/skills/firecrawl-interact/SKILL.md +112 -0
- package/skills/firecrawl-map/SKILL.md +79 -0
- package/skills/firecrawl-scrape/SKILL.md +97 -0
- package/skills/firecrawl-search/SKILL.md +88 -0
- package/skills/fitrah-guard/SKILL.md +78 -0
- package/skills/forge-quality-rules/SKILL.md +61 -0
- package/skills/ghazali-8lens/SKILL.md +56 -0
- package/skills/ijtihad-novel/SKILL.md +42 -0
- package/skills/ilham-intuition/SKILL.md +42 -0
- package/skills/imagegen/LICENSE.txt +201 -0
- package/skills/imagegen/SKILL.md +374 -0
- package/skills/imagegen/agents/openai.yaml +6 -0
- package/skills/imagegen/assets/imagegen-small.svg +5 -0
- package/skills/imagegen/assets/imagegen.png +0 -0
- package/skills/imagegen/references/cli.md +242 -0
- package/skills/imagegen/references/codex-network.md +33 -0
- package/skills/imagegen/references/image-api.md +90 -0
- package/skills/imagegen/references/prompting.md +118 -0
- package/skills/imagegen/references/sample-prompts.md +433 -0
- package/skills/imagegen/scripts/image_gen.py +995 -0
- package/skills/imagegen/scripts/remove_chroma_key.py +440 -0
- package/skills/istiqra-induction/SKILL.md +44 -0
- package/skills/ladunni-22/SKILL.md +53 -0
- package/skills/mizan/SKILL.md +90 -0
- package/skills/nadia/SKILL.md +56 -0
- package/skills/nadia-psi/SKILL.md +56 -0
- package/skills/never-guess/SKILL.md +75 -0
- package/skills/noor-recognition/SKILL.md +45 -0
- package/skills/observability/SKILL.md +133 -0
- package/skills/openai-docs/LICENSE.txt +201 -0
- package/skills/openai-docs/SKILL.md +100 -0
- package/skills/openai-docs/agents/openai.yaml +14 -0
- package/skills/openai-docs/assets/openai-small.svg +3 -0
- package/skills/openai-docs/assets/openai.png +0 -0
- package/skills/openai-docs/references/latest-model.md +37 -0
- package/skills/openai-docs/references/prompting-guide.md +244 -0
- package/skills/openai-docs/references/upgrade-guide.md +181 -0
- package/skills/openai-docs/scripts/resolve-latest-model-info.js +147 -0
- package/skills/pdf/LICENSE.txt +201 -0
- package/skills/pdf/SKILL.md +85 -0
- package/skills/pdf/agents/openai.yaml +5 -0
- package/skills/pdf/assets/pdf.png +0 -0
- package/skills/playwright/LICENSE.txt +201 -0
- package/skills/playwright/NOTICE.txt +14 -0
- package/skills/playwright/SKILL.md +165 -0
- package/skills/playwright/agents/openai.yaml +6 -0
- package/skills/playwright/assets/playwright-small.svg +3 -0
- package/skills/playwright/assets/playwright.png +0 -0
- package/skills/playwright/references/cli.md +116 -0
- package/skills/playwright/references/workflows.md +95 -0
- package/skills/playwright/scripts/playwright_cli.sh +25 -0
- package/skills/plugin-creator/SKILL.md +178 -0
- package/skills/plugin-creator/agents/openai.yaml +6 -0
- package/skills/plugin-creator/assets/plugin-creator-small.svg +3 -0
- package/skills/plugin-creator/assets/plugin-creator.png +0 -0
- package/skills/plugin-creator/references/plugin-json-spec.md +170 -0
- package/skills/plugin-creator/scripts/create_basic_plugin.py +301 -0
- package/skills/predictor/SKILL.md +43 -0
- package/skills/qiyas-analogy/SKILL.md +204 -0
- package/skills/refactoring/SKILL.md +137 -0
- package/skills/ruh-basis/SKILL.md +42 -0
- package/skills/security-review/SKILL.md +129 -0
- package/skills/skill-creator/SKILL.md +434 -0
- package/skills/skill-creator/agents/openai.yaml +5 -0
- package/skills/skill-creator/assets/skill-creator-small.svg +3 -0
- package/skills/skill-creator/assets/skill-creator.png +0 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/references/openai_yaml.md +49 -0
- package/skills/skill-creator/scripts/generate_openai_yaml.py +226 -0
- package/skills/skill-creator/scripts/init_skill.py +400 -0
- package/skills/skill-creator/scripts/quick_validate.py +101 -0
- package/skills/skill-installer/LICENSE.txt +202 -0
- package/skills/skill-installer/SKILL.md +76 -0
- package/skills/skill-installer/agents/openai.yaml +5 -0
- package/skills/skill-installer/assets/skill-installer-small.svg +3 -0
- package/skills/skill-installer/assets/skill-installer.png +0 -0
- package/skills/skill-installer/scripts/github_utils.py +21 -0
- package/skills/skill-installer/scripts/install-skill-from-github.py +308 -0
- package/skills/skill-installer/scripts/list-skills.py +107 -0
- package/skills/skills-and-hooks-reference/SKILL.md +196 -0
- package/skills/soul-domains/SKILL.md +43 -0
- package/skills/tadabbur/SKILL.md +232 -0
- package/skills/tadabbur-ops/SKILL.md +42 -0
- package/skills/tafakkur/SKILL.md +104 -0
- package/skills/testing-strategy/SKILL.md +122 -0
- package/src/action-ledger-core.ts +1054 -0
- package/src/chat.ts +5 -6
- package/src/codebase-scanner.ts +2 -0
- package/src/connectors/claude-code.ts +149 -12
- package/src/connectors/codebase-awareness.ts +325 -25
- package/src/connectors/codex.ts +1273 -40
- package/src/connectors/cursor.ts +8 -0
- package/src/connectors/governed-adapter.ts +174 -0
- package/src/connectors/opencode.ts +18 -2
- package/src/connectors/repo-guard.ts +24 -12
- package/src/connectors/runtime.ts +99 -2
- package/src/connectors/shell.ts +125 -7
- package/src/cross-cli-hive-binding.ts +290 -0
- package/src/garden-control-plane.ts +24 -1
- package/src/governed-surface-runner.ts +1227 -0
- package/src/index.ts +104 -1
- package/src/task-runner.ts +3794 -0
- package/dist/aria-connector/src/install-hooks.d.ts +0 -18
- package/dist/aria-connector/src/install-hooks.d.ts.map +0 -1
- package/dist/aria-connector/src/install-hooks.js +0 -224
- package/dist/aria-connector/src/install-hooks.js.map +0 -1
- package/dist/aria-connector/src/onboarding-wizard.d.ts +0 -5
- package/dist/aria-connector/src/onboarding-wizard.d.ts.map +0 -1
- package/dist/aria-connector/src/onboarding-wizard.js +0 -188
- package/dist/aria-connector/src/onboarding-wizard.js.map +0 -1
- package/dist/cli-0.2.38.tgz +0 -0
- package/dist/install.sh +0 -13
- package/src/__tests__/anthropic-oauth.test.ts +0 -186
- package/src/__tests__/auth-commands.test.ts +0 -132
- package/src/__tests__/owner-login.test.ts +0 -311
|
@@ -0,0 +1,1165 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import { dirname, join } from 'node:path';
|
|
7
|
+
import { buildProjectStartBoundary, formatProjectBoundaryPrompt } from './lib/project-boundary-cognition.mjs';
|
|
8
|
+
|
|
9
|
+
const HOME = process.env.ARIA_HOME || process.env.HOME || homedir();
|
|
10
|
+
const RUNTIME_URL = (process.env.ARIA_RUNTIME_URL || 'http://127.0.0.1:4319').replace(/\/+$/, '');
|
|
11
|
+
const RECEIPT_ROOT = process.env.ARIA_UNIVERSAL_TURN_PACKET_RECEIPT_DIR || join(HOME, '.aria', 'universal-turn-packet-receipts');
|
|
12
|
+
const SKILL_FLOOR = 50;
|
|
13
|
+
const RUNTIME_FLOOR = 16;
|
|
14
|
+
const PRIMITIVE_FLOOR = 24;
|
|
15
|
+
const MAPPING_FLOOR = 24;
|
|
16
|
+
const QA_SKILL_FLOOR = 6;
|
|
17
|
+
const CORRECTION_SKILL_FLOOR = 6;
|
|
18
|
+
const HIVE_OBSERVER_FLOOR = 1;
|
|
19
|
+
const HIVE_SOURCE_FLOOR = 1;
|
|
20
|
+
const HIVE_SIBLING_BROADCAST_FLOOR = 1;
|
|
21
|
+
const REQUIRED_SKILLS = Object.freeze([
|
|
22
|
+
'aria-cognition-autofire',
|
|
23
|
+
'aria-first-class-operating-contract',
|
|
24
|
+
'aria-cognition-batch',
|
|
25
|
+
'aria-quality-audit',
|
|
26
|
+
'aria-repo-doctrine',
|
|
27
|
+
'aria-http-harness-client',
|
|
28
|
+
'aria-harness-substrate-binding',
|
|
29
|
+
'aria-axioms-first-principles',
|
|
30
|
+
'never-guess',
|
|
31
|
+
'tadabbur',
|
|
32
|
+
'tadabbur-ops',
|
|
33
|
+
'tafakkur',
|
|
34
|
+
'qiyas-analogy',
|
|
35
|
+
'forge-quality-rules',
|
|
36
|
+
'aria-task-codex-executor',
|
|
37
|
+
'aria-backend-architect',
|
|
38
|
+
'aria-harness-no-stripping',
|
|
39
|
+
'aria-readable-output',
|
|
40
|
+
'aria-ledger-fleet-execution',
|
|
41
|
+
'predictor',
|
|
42
|
+
'aria-aristotle-pre-phase',
|
|
43
|
+
'aria-aristotle-intra-phase',
|
|
44
|
+
'aria-aristotle-post-phase',
|
|
45
|
+
'mizan',
|
|
46
|
+
'ghazali-8lens',
|
|
47
|
+
'aria-noor-cognitives',
|
|
48
|
+
'aria-business-frame',
|
|
49
|
+
'aria-business-audit',
|
|
50
|
+
'aria-revenue-engine',
|
|
51
|
+
'aria-retention-engine',
|
|
52
|
+
'aria-gtm-architect',
|
|
53
|
+
'aria-senior-code-cookbook',
|
|
54
|
+
'aria-senior-code-audit',
|
|
55
|
+
'testing-strategy',
|
|
56
|
+
'security-review',
|
|
57
|
+
'architecture-decision',
|
|
58
|
+
'api-design',
|
|
59
|
+
'observability',
|
|
60
|
+
'error-handling',
|
|
61
|
+
'aria-decision-mizan',
|
|
62
|
+
'aria-aristotle-cognitives',
|
|
63
|
+
'aria-forge-guardrails',
|
|
64
|
+
'aria-harness-deploy',
|
|
65
|
+
'aria-harness-onboarding',
|
|
66
|
+
'aria-harness-output-discipline',
|
|
67
|
+
'aria-frontend-architect',
|
|
68
|
+
'aria-fullstack-orchestrator',
|
|
69
|
+
'aria-research-orchestrator',
|
|
70
|
+
'cross-domain-24',
|
|
71
|
+
'fitrah-guard',
|
|
72
|
+
'noor-recognition',
|
|
73
|
+
'ladunni-22',
|
|
74
|
+
'ijtihad-novel',
|
|
75
|
+
'ilham-intuition',
|
|
76
|
+
'istiqra-induction',
|
|
77
|
+
'ruh-basis',
|
|
78
|
+
'soul-domains',
|
|
79
|
+
'deepsoul-emotional',
|
|
80
|
+
]);
|
|
81
|
+
const PHASES = Object.freeze([
|
|
82
|
+
'pre_cognition',
|
|
83
|
+
'pre_tool',
|
|
84
|
+
'intra_tool',
|
|
85
|
+
'intra_cognition',
|
|
86
|
+
'post_tool',
|
|
87
|
+
'post_cognition',
|
|
88
|
+
]);
|
|
89
|
+
const HOOK_MODES = new Set(['coach-lite', 'observe', 'repair-first', 'strict', 'off']);
|
|
90
|
+
|
|
91
|
+
function parseArgs(argv) {
|
|
92
|
+
const args = {};
|
|
93
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
94
|
+
const arg = argv[index];
|
|
95
|
+
if (arg === '--surface') {
|
|
96
|
+
args.surfaceId = argv[index + 1];
|
|
97
|
+
index += 1;
|
|
98
|
+
} else if (arg === '--session-id') {
|
|
99
|
+
args.sessionId = argv[index + 1];
|
|
100
|
+
index += 1;
|
|
101
|
+
} else if (arg === '--text') {
|
|
102
|
+
args.text = argv[index + 1];
|
|
103
|
+
index += 1;
|
|
104
|
+
} else if (arg === '--context') {
|
|
105
|
+
args.context = true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return args;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function safeId(value) {
|
|
112
|
+
return String(value || 'unknown').replace(/[^a-zA-Z0-9_.-]/g, '_').slice(0, 120);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function readStdin() {
|
|
116
|
+
if (process.stdin.isTTY) return '';
|
|
117
|
+
try {
|
|
118
|
+
return readFileSync(0, 'utf8');
|
|
119
|
+
} catch {
|
|
120
|
+
return '';
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function extractText(input, fallback = '') {
|
|
125
|
+
const raw = String(input || '').trim();
|
|
126
|
+
if (!raw) return fallback;
|
|
127
|
+
try {
|
|
128
|
+
const event = JSON.parse(raw);
|
|
129
|
+
return [
|
|
130
|
+
event.prompt,
|
|
131
|
+
event.userPrompt,
|
|
132
|
+
event.message,
|
|
133
|
+
event.input,
|
|
134
|
+
event.tool_input,
|
|
135
|
+
event.toolInput,
|
|
136
|
+
event.transcript_path,
|
|
137
|
+
raw,
|
|
138
|
+
].filter((item) => typeof item === 'string' && item.trim()).join('\n').slice(0, 20000);
|
|
139
|
+
} catch {
|
|
140
|
+
return raw.slice(0, 20000);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function uniqueStrings(values) {
|
|
145
|
+
return [...new Set(values.filter((item) => typeof item === 'string' && item.trim()).map((item) => item.trim()))];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function normalizeSurfaceEnvKey(surfaceId) {
|
|
149
|
+
return String(surfaceId || 'shell').replace(/[^a-zA-Z0-9]+/g, '_').replace(/^_+|_+$/g, '').toUpperCase();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function normalizeHookMode(value, surfaceId) {
|
|
153
|
+
const mode = String(value || '').trim().toLowerCase();
|
|
154
|
+
if (HOOK_MODES.has(mode)) return mode;
|
|
155
|
+
return ['claude-code', 'codex', 'opencode'].includes(surfaceId) ? 'coach-lite' : 'strict';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function readHookMode(surfaceId) {
|
|
159
|
+
const surfaceKey = normalizeSurfaceEnvKey(surfaceId);
|
|
160
|
+
const surfaceAlias = surfaceId === 'claude-code'
|
|
161
|
+
? process.env.ARIA_CLAUDE_HOOK_MODE
|
|
162
|
+
: surfaceId === 'opencode'
|
|
163
|
+
? process.env.ARIA_OPENCODE_HOOK_MODE
|
|
164
|
+
: surfaceId === 'codex'
|
|
165
|
+
? process.env.ARIA_CODEX_HOOK_MODE
|
|
166
|
+
: '';
|
|
167
|
+
return normalizeHookMode(
|
|
168
|
+
process.env[`ARIA_${surfaceKey}_HOOK_MODE`] ||
|
|
169
|
+
surfaceAlias ||
|
|
170
|
+
process.env.ARIA_HOOK_MODE ||
|
|
171
|
+
process.env.ARIA_UNIVERSAL_TURN_PACKET_MODE,
|
|
172
|
+
surfaceId,
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function shouldContinueAfterBlock(hookMode) {
|
|
177
|
+
return hookMode === 'coach-lite' || hookMode === 'observe';
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function errorMessage(error) {
|
|
181
|
+
return error instanceof Error ? error.message : String(error);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function readOwnerApprovalFromEnv() {
|
|
185
|
+
const status = (process.env.ARIA_OWNER_APPROVAL_STATUS || '').trim();
|
|
186
|
+
if (!status) return null;
|
|
187
|
+
const allowed = new Set(['approved_by_owner', 'rejected_by_owner', 'needs_revision_by_owner', 'not_requested']);
|
|
188
|
+
if (!allowed.has(status)) return null;
|
|
189
|
+
return {
|
|
190
|
+
ownerApprovalStatus: status,
|
|
191
|
+
approvedBy: (process.env.ARIA_OWNER_APPROVED_BY || process.env.ARIA_OWNER || 'owner').trim(),
|
|
192
|
+
approvedAt: (process.env.ARIA_OWNER_APPROVED_AT || new Date().toISOString()).trim(),
|
|
193
|
+
source: (process.env.ARIA_OWNER_APPROVAL_SOURCE || 'environment').trim(),
|
|
194
|
+
scope: (process.env.ARIA_OWNER_APPROVAL_SCOPE || 'runtime_or_registry_promotion').trim(),
|
|
195
|
+
evidence: (process.env.ARIA_OWNER_APPROVAL_EVIDENCE || '').trim() || null,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async function postJson(pathname, body) {
|
|
200
|
+
const response = await fetch(`${RUNTIME_URL}${pathname}`, {
|
|
201
|
+
method: 'POST',
|
|
202
|
+
headers: { 'content-type': 'application/json' },
|
|
203
|
+
body: JSON.stringify(body),
|
|
204
|
+
});
|
|
205
|
+
const text = await response.text();
|
|
206
|
+
let data = null;
|
|
207
|
+
try {
|
|
208
|
+
data = text ? JSON.parse(text) : null;
|
|
209
|
+
} catch {
|
|
210
|
+
data = { raw: text };
|
|
211
|
+
}
|
|
212
|
+
return { ok: response.ok, status: response.status, data };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
async function getJson(pathname) {
|
|
216
|
+
const response = await fetch(`${RUNTIME_URL}${pathname}`);
|
|
217
|
+
const text = await response.text();
|
|
218
|
+
let data = null;
|
|
219
|
+
try {
|
|
220
|
+
data = text ? JSON.parse(text) : null;
|
|
221
|
+
} catch {
|
|
222
|
+
data = { raw: text };
|
|
223
|
+
}
|
|
224
|
+
return { ok: response.ok, status: response.status, data };
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
async function openSubstratePacket({ surfaceId, sessionId, userText, requiredSkills }) {
|
|
228
|
+
try {
|
|
229
|
+
const response = await postJson('/substrate/open', {
|
|
230
|
+
surface: surfaceId,
|
|
231
|
+
sessionId,
|
|
232
|
+
prompt: userText,
|
|
233
|
+
requiredSkills,
|
|
234
|
+
source: 'aria-universal-turn-packet-hook',
|
|
235
|
+
event: 'universal_turn_packet_pre_provider',
|
|
236
|
+
});
|
|
237
|
+
return response.ok === true && response.data?.ok === true
|
|
238
|
+
? { ok: true, status: response.status, packet: response.data }
|
|
239
|
+
: { ok: false, status: response.status, packet: response.data, error: response.data?.error || 'substrate_open_failed' };
|
|
240
|
+
} catch (error) {
|
|
241
|
+
return { ok: false, status: 0, error: errorMessage(error) };
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function receiptPath(surfaceId, sessionId) {
|
|
246
|
+
return join(RECEIPT_ROOT, safeId(surfaceId), `${safeId(sessionId)}.json`);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function writeReceipt(receipt) {
|
|
250
|
+
const target = receiptPath(receipt.surfaceId, receipt.sessionId);
|
|
251
|
+
mkdirSync(dirname(target), { recursive: true, mode: 0o700 });
|
|
252
|
+
writeFileSync(target, `${JSON.stringify(receipt, null, 2)}\n`, { mode: 0o600 });
|
|
253
|
+
return target;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function makeAdditionalContext(receipt) {
|
|
257
|
+
if (receipt.disabled) {
|
|
258
|
+
return [
|
|
259
|
+
'--- ARIA UNIVERSAL TURN PACKET OFF ---',
|
|
260
|
+
`Surface: ${receipt.surfaceId}`,
|
|
261
|
+
`Session: ${receipt.sessionId}`,
|
|
262
|
+
`Hook mode: ${receipt.hookMode}`,
|
|
263
|
+
`Receipt: ${receipt.receiptPath}`,
|
|
264
|
+
'Mandatory behavior: native provider execution continues; do not claim Aria skill autofire evidence from this disabled receipt.',
|
|
265
|
+
].join('\n');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (receipt.degraded) {
|
|
269
|
+
return [
|
|
270
|
+
'--- ARIA UNIVERSAL TURN PACKET RECOVERY RECEIPT ---',
|
|
271
|
+
`Surface: ${receipt.surfaceId}`,
|
|
272
|
+
`Session: ${receipt.sessionId}`,
|
|
273
|
+
`Hook mode: ${receipt.hookMode}`,
|
|
274
|
+
`Skill execution mode: ${receipt.skillExecutionMode}`,
|
|
275
|
+
`QA: ${receipt.qa?.status || 'block'}; findings=${(receipt.qa?.findings || []).join(', ') || 'missing'}`,
|
|
276
|
+
`Reason: ${receipt.degradationReason || 'runtime_unavailable_or_receipt_build_failed'}`,
|
|
277
|
+
`Receipt: ${receipt.receiptPath}`,
|
|
278
|
+
'Mandatory behavior: native provider execution continues in coach/observe mode, but completion claims require direct evidence until the runtime packet is restored.',
|
|
279
|
+
].join('\n');
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return [
|
|
283
|
+
'--- ARIA UNIVERSAL TURN PACKET ACTIVE ---',
|
|
284
|
+
`Surface: ${receipt.surfaceId}`,
|
|
285
|
+
`Session: ${receipt.sessionId}`,
|
|
286
|
+
`Skill execution mode: ${receipt.skillExecutionMode}`,
|
|
287
|
+
`Skill execution receipt: ${receipt.skillExecutionReceipt?.receiptHash || 'missing'}`,
|
|
288
|
+
`Skill floor: ${receipt.skillFloor}`,
|
|
289
|
+
`Runtime floor: ${receipt.runtimeFloor}`,
|
|
290
|
+
`Required skills: ${receipt.requiredSkills.length}`,
|
|
291
|
+
`Fired skills: ${receipt.skillExecutionReceipt?.firedSkillIds?.length || 0}`,
|
|
292
|
+
`Active runtimes: ${receipt.activeRuntimes.length}`,
|
|
293
|
+
`Repo doctrine runtime: ok=${receipt.doctrineRuntimeReceipt?.ok === true}; timeout=${receipt.doctrineRuntimeReceipt?.timeoutVerdict || 'missing'}`,
|
|
294
|
+
`Task class: ${receipt.taskClass || 'missing'}; extra operators=${receipt.selectedExtraOperators.length}`,
|
|
295
|
+
`Cognitive runtimes: tadabbur=${receipt.cognitiveRuntimeReceipts?.tadabbur?.mode || 'missing'}:${receipt.cognitiveRuntimeReceipts?.tadabbur?.stageCount || 0}; qiyas=${receipt.cognitiveRuntimeReceipts?.qiyas?.mode || 'missing'}:${receipt.cognitiveRuntimeReceipts?.qiyas?.perspectiveCount || 0}; noor=${receipt.cognitiveRuntimeReceipts?.noor?.noorSuiteCount || 0}`,
|
|
296
|
+
`Substrate open: ok=${receipt.substrateOpen?.ok === true}; workUnit=${receipt.substrateOpen?.workUnitId || 'missing'}; hive=${receipt.substrateOpen?.hive?.projectContextOk === true ? 'bound' : 'missing'}`,
|
|
297
|
+
`Atlas first-principles forge: ok=${receipt.atlasFirstPrinciplesForgeReceipt?.ok === true}; mode=${receipt.atlasFirstPrinciplesForgeReceipt?.mode || 'missing'}; generativeAxioms=${receipt.atlasFirstPrinciplesForgeReceipt?.generativeAxiomCount || 0}; atlas=${receipt.atlasFirstPrinciplesForgeReceipt?.atlas?.status || 'missing'}`,
|
|
298
|
+
formatProjectBoundaryPrompt(receipt.projectBoundary),
|
|
299
|
+
`Owner approval: required=${receipt.ownerApprovalPacket?.required === true}; status=${receipt.ownerApprovalPacket?.ownerApprovalStatus || 'missing'}; blocksProduction=${receipt.ownerApprovalPacket?.blocksProductionPromotion === true}`,
|
|
300
|
+
`Active primitives: ${receipt.activePrimitives.length}`,
|
|
301
|
+
`Active mappings: ${receipt.activeMappings.length}`,
|
|
302
|
+
`QA/correction skills: qa=${receipt.qaSkills.length}; correction=${receipt.correctionSkills.length}`,
|
|
303
|
+
`Hive observer/source: observers=${receipt.hiveObserverSourceTopology?.observerSurfaces?.length || 0}; sources=${receipt.hiveObserverSourceTopology?.sourceSurfaces?.length || 0}; hash=${receipt.hiveObserverSourceTopology?.coherenceHash || 'missing'}`,
|
|
304
|
+
`Loaded skill files: ${receipt.loadedSkillIds.length}`,
|
|
305
|
+
`Missing skills: ${receipt.missingSkillIds.length ? receipt.missingSkillIds.join(', ') : 'none'}`,
|
|
306
|
+
`Missing cookbooks: ${receipt.missingCookbooks.length}`,
|
|
307
|
+
`Phases: ${receipt.phases.map((phase) => `${phase.phase}=${phase.ok ? 'pass' : 'block'}`).join(', ')}`,
|
|
308
|
+
`QA: ${receipt.qa.status}`,
|
|
309
|
+
`Learning loop: ${receipt.learningLoop.style}; integrated=${receipt.learningLoop.integratedIntoNextPacket}`,
|
|
310
|
+
`Receipt: ${receipt.receiptPath}`,
|
|
311
|
+
'Mandatory behavior: use the fired skills and correction skills before substantive reasoning, tool execution, QA correction, and final output. Do not infer that reading a skill body equals firing; the receipt above is the firing proof.',
|
|
312
|
+
].join('\n');
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function shouldEmitContext(args) {
|
|
316
|
+
return args.context || process.env.ARIA_UNIVERSAL_TURN_PACKET_CONTEXT === '1' || process.env.HOOK_EVENT_NAME === 'UserPromptSubmit';
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function emitReceiptOutput(args, receipt) {
|
|
320
|
+
if (shouldEmitContext(args)) {
|
|
321
|
+
const additionalContext = makeAdditionalContext(receipt);
|
|
322
|
+
if (process.env.HOOK_EVENT_NAME === 'UserPromptSubmit') {
|
|
323
|
+
process.stdout.write(`${JSON.stringify({
|
|
324
|
+
hookSpecificOutput: {
|
|
325
|
+
hookEventName: 'UserPromptSubmit',
|
|
326
|
+
additionalContext,
|
|
327
|
+
},
|
|
328
|
+
})}\n`);
|
|
329
|
+
} else {
|
|
330
|
+
process.stdout.write(additionalContext);
|
|
331
|
+
}
|
|
332
|
+
} else if (process.env.ARIA_UNIVERSAL_TURN_PACKET_VERBOSE === '1') {
|
|
333
|
+
process.stdout.write(`${JSON.stringify({
|
|
334
|
+
ok: receipt.ok === true,
|
|
335
|
+
degraded: receipt.degraded === true,
|
|
336
|
+
disabled: receipt.disabled === true,
|
|
337
|
+
surfaceId: receipt.surfaceId,
|
|
338
|
+
sessionId: receipt.sessionId,
|
|
339
|
+
hookMode: receipt.hookMode,
|
|
340
|
+
loadedSkillCount: receipt.loadedSkillIds?.length || 0,
|
|
341
|
+
activeRuntimeCount: receipt.activeRuntimes?.length || 0,
|
|
342
|
+
receiptPath: receipt.receiptPath,
|
|
343
|
+
}, null, 2)}\n`);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function asRecord(value) {
|
|
348
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function asRecordArray(value) {
|
|
352
|
+
return Array.isArray(value)
|
|
353
|
+
? value.filter((entry) => entry && typeof entry === 'object' && !Array.isArray(entry))
|
|
354
|
+
: [];
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function readHiveBinding(receipt) {
|
|
358
|
+
const surfaceId = receipt.surfaceId || 'unknown';
|
|
359
|
+
const sessionId = receipt.sessionId || `${surfaceId}-${process.pid}`;
|
|
360
|
+
const projectId =
|
|
361
|
+
(process.env.ARIA_HIVE_PROJECT_ID || process.env.ARIA_PROJECT_ID || process.env.ARIA_TASK_PROJECT_ID || '').trim() ||
|
|
362
|
+
`mechanical-autofire-${safeId(surfaceId)}`;
|
|
363
|
+
const threadId =
|
|
364
|
+
(process.env.ARIA_HIVE_THREAD_ID || process.env.ARIA_THREAD_ID || process.env.ARIA_TASK_THREAD_ID || '').trim() ||
|
|
365
|
+
`thread-mechanical-autofire-${safeId(sessionId)}`;
|
|
366
|
+
return {
|
|
367
|
+
projectId,
|
|
368
|
+
threadId,
|
|
369
|
+
activeTaskId: (process.env.ARIA_ACTIVE_TASK_ID || process.env.ARIA_TASK_ID || '').trim() || null,
|
|
370
|
+
activePhase: (process.env.ARIA_ACTIVE_PHASE || process.env.ARIA_TASK_PHASE || '').trim() || null,
|
|
371
|
+
source: 'aria-universal-turn-packet-hook',
|
|
372
|
+
sourceArtifact: 'aria-universal-turn-packet.mjs',
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
async function readPriorHiveLearning(receipt) {
|
|
377
|
+
const binding = readHiveBinding(receipt);
|
|
378
|
+
try {
|
|
379
|
+
const current = await getJson(`/api/hive/project-context?project_id=${encodeURIComponent(binding.projectId)}&include_touches=true&touch_limit=25`);
|
|
380
|
+
const capsule = asRecord(current.data?.context?.capsule);
|
|
381
|
+
return {
|
|
382
|
+
ok: current.ok === true && current.data?.found === true,
|
|
383
|
+
schema: 'aria.mechanical_autofire.prior_hive_learning.v1',
|
|
384
|
+
projectId: binding.projectId,
|
|
385
|
+
threadId: binding.threadId,
|
|
386
|
+
latestQa: asRecord(capsule.latest_qa),
|
|
387
|
+
latestRecovery: asRecord(capsule.latest_recovery),
|
|
388
|
+
latestLearningLoop: asRecord(capsule.latest_learning_loop),
|
|
389
|
+
latestMechanicalAutofireReceipt: asRecord(capsule.latest_mechanical_autofire_receipt),
|
|
390
|
+
};
|
|
391
|
+
} catch (error) {
|
|
392
|
+
return {
|
|
393
|
+
ok: false,
|
|
394
|
+
schema: 'aria.mechanical_autofire.prior_hive_learning.v1',
|
|
395
|
+
projectId: binding.projectId,
|
|
396
|
+
threadId: binding.threadId,
|
|
397
|
+
error: errorMessage(error),
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function buildDalioReflexionLearningLoop({ ok, disabled = false, degraded = false, lesson, priorHiveLearning = null, findings = [] }) {
|
|
403
|
+
const status = ok ? 'verified' : degraded ? 'recovery_required' : disabled ? 'inactive' : 'blocked';
|
|
404
|
+
return {
|
|
405
|
+
schema: 'aria.dalio_reflexion_learning_loop.v1',
|
|
406
|
+
style: 'dalio_reflexion',
|
|
407
|
+
expectedOutcome: 'Mechanical autofire emits a compact receipt, publishes QA/recovery state, and informs the next packet before completion claims.',
|
|
408
|
+
actualOutcome: lesson,
|
|
409
|
+
reflection: ok
|
|
410
|
+
? 'The receipt path carried skill, runtime, QA, correction, Hive, and learning evidence without provider auth takeover.'
|
|
411
|
+
: 'The receipt path captured non-pass state explicitly so future turns cannot treat missing runtime or disabled mode as skill-firing proof.',
|
|
412
|
+
principle: 'Quality improves when every receipt records expectation, observed outcome, correction state, and the next action boundary.',
|
|
413
|
+
correctionCycle: {
|
|
414
|
+
steps: ['correct', 'enhance', 'harden', 'verify'],
|
|
415
|
+
status,
|
|
416
|
+
findings,
|
|
417
|
+
},
|
|
418
|
+
boundedRepair: {
|
|
419
|
+
allowedAttempts: 1,
|
|
420
|
+
priorAttempts: 0,
|
|
421
|
+
remainingAttempts: ok || disabled ? 0 : 1,
|
|
422
|
+
escalation: ok || disabled ? 'none' : 'architect_harness_after_one_failed_repair',
|
|
423
|
+
},
|
|
424
|
+
priorHiveLearningIntegrated: priorHiveLearning?.ok === true,
|
|
425
|
+
priorHiveLearningMarker: priorHiveLearning?.latestLearningLoop?.marker || priorHiveLearning?.latestQa?.marker || null,
|
|
426
|
+
integratedIntoNextPacket: true,
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function summarizeMechanicalReceiptForHive(receipt) {
|
|
431
|
+
return {
|
|
432
|
+
schema: 'aria.mechanical_autofire.hive_receipt_summary.v1',
|
|
433
|
+
topic: 'mechanical-autofire.receipt',
|
|
434
|
+
surfaceId: receipt.surfaceId,
|
|
435
|
+
sessionId: receipt.sessionId,
|
|
436
|
+
ok: receipt.ok === true,
|
|
437
|
+
degraded: receipt.degraded === true,
|
|
438
|
+
disabled: receipt.disabled === true,
|
|
439
|
+
hookMode: receipt.hookMode || null,
|
|
440
|
+
skillExecutionMode: receipt.skillExecutionMode || null,
|
|
441
|
+
receiptPath: receipt.receiptPath || null,
|
|
442
|
+
receiptHash: receipt.skillExecutionReceipt?.receiptHash || null,
|
|
443
|
+
promptHash: receipt.promptHash || null,
|
|
444
|
+
taskClass: receipt.taskClass || null,
|
|
445
|
+
counts: {
|
|
446
|
+
loadedSkills: Array.isArray(receipt.loadedSkillIds) ? receipt.loadedSkillIds.length : 0,
|
|
447
|
+
firedSkills: Array.isArray(receipt.skillExecutionReceipt?.firedSkillIds) ? receipt.skillExecutionReceipt.firedSkillIds.length : 0,
|
|
448
|
+
activeRuntimes: Array.isArray(receipt.activeRuntimes) ? receipt.activeRuntimes.length : 0,
|
|
449
|
+
activePrimitives: Array.isArray(receipt.activePrimitives) ? receipt.activePrimitives.length : 0,
|
|
450
|
+
activeMappings: Array.isArray(receipt.activeMappings) ? receipt.activeMappings.length : 0,
|
|
451
|
+
qaSkills: Array.isArray(receipt.qaSkills) ? receipt.qaSkills.length : 0,
|
|
452
|
+
correctionSkills: Array.isArray(receipt.correctionSkills) ? receipt.correctionSkills.length : 0,
|
|
453
|
+
hiveObservers: Array.isArray(receipt.hiveObserverSourceTopology?.observerSurfaces) ? receipt.hiveObserverSourceTopology.observerSurfaces.length : 0,
|
|
454
|
+
hiveSources: Array.isArray(receipt.hiveObserverSourceTopology?.sourceSurfaces) ? receipt.hiveObserverSourceTopology.sourceSurfaces.length : 0,
|
|
455
|
+
tadabburStages: receipt.cognitiveRuntimeReceipts?.tadabbur?.stageCount || 0,
|
|
456
|
+
qiyasPerspectives: receipt.cognitiveRuntimeReceipts?.qiyas?.perspectiveCount || 0,
|
|
457
|
+
noorSuite: receipt.cognitiveRuntimeReceipts?.noor?.noorSuiteCount || 0,
|
|
458
|
+
},
|
|
459
|
+
qa: {
|
|
460
|
+
status: receipt.qa?.status || 'unknown',
|
|
461
|
+
findings: Array.isArray(receipt.qa?.findings) ? receipt.qa.findings : [],
|
|
462
|
+
},
|
|
463
|
+
learningLoop: {
|
|
464
|
+
schema: receipt.learningLoop?.schema || null,
|
|
465
|
+
style: receipt.learningLoop?.style || null,
|
|
466
|
+
integratedIntoNextPacket: receipt.learningLoop?.integratedIntoNextPacket === true,
|
|
467
|
+
principle: receipt.learningLoop?.principle || null,
|
|
468
|
+
correctionStatus: receipt.learningLoop?.correctionCycle?.status || null,
|
|
469
|
+
boundedRepair: receipt.learningLoop?.boundedRepair || null,
|
|
470
|
+
},
|
|
471
|
+
publishedAt: new Date().toISOString(),
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
function mergeHiveSession(capsule, receipt, binding) {
|
|
476
|
+
const session = {
|
|
477
|
+
session_id: receipt.sessionId,
|
|
478
|
+
surface: receipt.surfaceId,
|
|
479
|
+
cwd: process.cwd(),
|
|
480
|
+
project_id: binding.projectId,
|
|
481
|
+
thread_id: binding.threadId,
|
|
482
|
+
active_task_id: binding.activeTaskId,
|
|
483
|
+
active_phase: binding.activePhase,
|
|
484
|
+
role: 'mechanical-autofire-receipt-producer',
|
|
485
|
+
native_provider_mode: true,
|
|
486
|
+
provider_auth_owner: 'native-cli',
|
|
487
|
+
capabilities: ['mechanical-autofire-receipt', 'skill-runtime-receipt', 'qa-recovery-marker', 'learning-loop-marker'],
|
|
488
|
+
heartbeat_at: new Date().toISOString(),
|
|
489
|
+
source: binding.source,
|
|
490
|
+
};
|
|
491
|
+
return [
|
|
492
|
+
session,
|
|
493
|
+
...asRecordArray(capsule.registered_sessions).filter((entry) => entry.session_id !== session.session_id),
|
|
494
|
+
].slice(0, 100);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
async function publishReceiptToHive(receipt) {
|
|
498
|
+
const binding = readHiveBinding(receipt);
|
|
499
|
+
const summary = summarizeMechanicalReceiptForHive(receipt);
|
|
500
|
+
try {
|
|
501
|
+
const current = await getJson(`/api/hive/project-context?project_id=${encodeURIComponent(binding.projectId)}&include_touches=true&touch_limit=50`);
|
|
502
|
+
const currentCapsule = asRecord(current.data?.context?.capsule);
|
|
503
|
+
const skillRuntimeReceipts = [
|
|
504
|
+
summary,
|
|
505
|
+
...asRecordArray(currentCapsule.skill_runtime_receipts).filter((entry) => entry.receiptPath !== summary.receiptPath),
|
|
506
|
+
].slice(0, 25);
|
|
507
|
+
const fileClaims = summary.receiptPath
|
|
508
|
+
? [{
|
|
509
|
+
path: summary.receiptPath,
|
|
510
|
+
intent: 'mechanical autofire receipt persisted before provider execution',
|
|
511
|
+
status: summary.ok ? 'pass' : summary.degraded ? 'recovery' : 'block',
|
|
512
|
+
note: summary.topic,
|
|
513
|
+
}]
|
|
514
|
+
: [];
|
|
515
|
+
|
|
516
|
+
const lifecycle = await postJson('/api/hive/session-lifecycle', {
|
|
517
|
+
session_id: receipt.sessionId,
|
|
518
|
+
thread_id: binding.threadId,
|
|
519
|
+
event: 'mechanical_autofire_receipt',
|
|
520
|
+
status: summary.ok ? 'active' : summary.degraded ? 'recovery' : 'blocked',
|
|
521
|
+
source: binding.source,
|
|
522
|
+
source_artifact: binding.sourceArtifact,
|
|
523
|
+
file_claims: fileClaims,
|
|
524
|
+
body: {
|
|
525
|
+
project_id: binding.projectId,
|
|
526
|
+
active_task_id: binding.activeTaskId,
|
|
527
|
+
active_phase: binding.activePhase,
|
|
528
|
+
mechanical_autofire_receipt: summary,
|
|
529
|
+
skill_runtime_receipt: summary,
|
|
530
|
+
qa_recovery_marker: summary.qa,
|
|
531
|
+
learning_loop_marker: summary.learningLoop,
|
|
532
|
+
native_provider_mode: true,
|
|
533
|
+
provider_auth_owner: 'native-cli',
|
|
534
|
+
},
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
const projectContext = await postJson('/api/hive/project-context', {
|
|
538
|
+
project_id: binding.projectId,
|
|
539
|
+
session_id: receipt.sessionId,
|
|
540
|
+
thread_id: binding.threadId,
|
|
541
|
+
active_phase: binding.activePhase,
|
|
542
|
+
source: binding.source,
|
|
543
|
+
source_artifact: binding.sourceArtifact,
|
|
544
|
+
event: 'mechanical_autofire_receipt',
|
|
545
|
+
file_claims: fileClaims,
|
|
546
|
+
capsule: {
|
|
547
|
+
...currentCapsule,
|
|
548
|
+
project_id: binding.projectId,
|
|
549
|
+
thread_id: binding.threadId,
|
|
550
|
+
active_task_id: binding.activeTaskId || currentCapsule.active_task_id || null,
|
|
551
|
+
active_phase: binding.activePhase || currentCapsule.active_phase || null,
|
|
552
|
+
registered_sessions: mergeHiveSession(currentCapsule, receipt, binding),
|
|
553
|
+
latest_mechanical_autofire_receipt: summary,
|
|
554
|
+
skill_runtime_receipts: skillRuntimeReceipts,
|
|
555
|
+
latest_qa: {
|
|
556
|
+
source: summary.topic,
|
|
557
|
+
ok: summary.ok,
|
|
558
|
+
marker: summary.receiptHash || summary.receiptPath,
|
|
559
|
+
status: summary.qa.status,
|
|
560
|
+
findings: summary.qa.findings,
|
|
561
|
+
at: summary.publishedAt,
|
|
562
|
+
},
|
|
563
|
+
latest_recovery: {
|
|
564
|
+
source: summary.topic,
|
|
565
|
+
correction_required: summary.ok !== true,
|
|
566
|
+
recovery_in_progress: summary.degraded === true,
|
|
567
|
+
future_preflight: 'verify latest mechanical-autofire receipt before completion claims',
|
|
568
|
+
at: summary.publishedAt,
|
|
569
|
+
},
|
|
570
|
+
latest_learning_loop: {
|
|
571
|
+
...summary.learningLoop,
|
|
572
|
+
source: summary.topic,
|
|
573
|
+
marker: summary.receiptHash || summary.receiptPath,
|
|
574
|
+
at: summary.publishedAt,
|
|
575
|
+
},
|
|
576
|
+
provider_auth_policy: 'native-provider-auth-only',
|
|
577
|
+
native_provider_mode: true,
|
|
578
|
+
},
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
const message = await postJson('/api/hive/session-message', {
|
|
582
|
+
from_session_id: receipt.sessionId,
|
|
583
|
+
thread_id: binding.threadId,
|
|
584
|
+
topic: summary.topic,
|
|
585
|
+
source: binding.source,
|
|
586
|
+
body: {
|
|
587
|
+
project_id: binding.projectId,
|
|
588
|
+
coordination_key: `${summary.topic}:${binding.projectId}`,
|
|
589
|
+
mechanical_autofire_receipt: summary,
|
|
590
|
+
skill_runtime_receipt: summary,
|
|
591
|
+
qa_recovery_marker: summary.qa,
|
|
592
|
+
learning_loop_marker: summary.learningLoop,
|
|
593
|
+
file_claims: fileClaims,
|
|
594
|
+
},
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
const fileTouch = fileClaims.length
|
|
598
|
+
? await postJson('/api/hive/file-touch', {
|
|
599
|
+
session_id: receipt.sessionId,
|
|
600
|
+
thread_id: binding.threadId,
|
|
601
|
+
event: summary.topic,
|
|
602
|
+
source: binding.source,
|
|
603
|
+
files: fileClaims,
|
|
604
|
+
body: {
|
|
605
|
+
project_id: binding.projectId,
|
|
606
|
+
mechanical_autofire_receipt: summary,
|
|
607
|
+
},
|
|
608
|
+
})
|
|
609
|
+
: null;
|
|
610
|
+
|
|
611
|
+
return {
|
|
612
|
+
ok: Boolean(lifecycle.ok && projectContext.ok && message.ok && (fileTouch === null || fileTouch.ok)),
|
|
613
|
+
schema: 'aria.mechanical_autofire.hive_publication_receipt.v1',
|
|
614
|
+
projectId: binding.projectId,
|
|
615
|
+
threadId: binding.threadId,
|
|
616
|
+
topic: summary.topic,
|
|
617
|
+
lifecycleStatus: lifecycle.status,
|
|
618
|
+
projectContextStatus: projectContext.status,
|
|
619
|
+
messageStatus: message.status,
|
|
620
|
+
fileTouchStatus: fileTouch?.status || null,
|
|
621
|
+
summary,
|
|
622
|
+
};
|
|
623
|
+
} catch (error) {
|
|
624
|
+
return {
|
|
625
|
+
ok: false,
|
|
626
|
+
schema: 'aria.mechanical_autofire.hive_publication_receipt.v1',
|
|
627
|
+
projectId: binding.projectId,
|
|
628
|
+
threadId: binding.threadId,
|
|
629
|
+
topic: summary.topic,
|
|
630
|
+
error: errorMessage(error),
|
|
631
|
+
summary,
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
function baseEmptyReceipt({ surfaceId, sessionId, startedAt, hookMode, ok, disabled = false, degraded = false, reason = null, priorHiveLearning = null, userText = '' }) {
|
|
637
|
+
const now = new Date().toISOString();
|
|
638
|
+
return {
|
|
639
|
+
schema: 'aria.universal_turn_packet.live_entrypoint.v1',
|
|
640
|
+
ok,
|
|
641
|
+
disabled,
|
|
642
|
+
degraded,
|
|
643
|
+
degradationReason: reason,
|
|
644
|
+
surfaceId,
|
|
645
|
+
sessionId,
|
|
646
|
+
startedAt,
|
|
647
|
+
completedAt: now,
|
|
648
|
+
runtimeUrl: RUNTIME_URL,
|
|
649
|
+
hookMode,
|
|
650
|
+
skillExecutionMode: 'mechanical-receipt',
|
|
651
|
+
skillExecutionReceipt: {
|
|
652
|
+
schema: 'aria.skill_execution_receipt.v1',
|
|
653
|
+
ok: false,
|
|
654
|
+
firedSkillIds: [],
|
|
655
|
+
reason,
|
|
656
|
+
},
|
|
657
|
+
skillFloor: SKILL_FLOOR,
|
|
658
|
+
runtimeFloor: RUNTIME_FLOOR,
|
|
659
|
+
requiredSkills: uniqueStrings(REQUIRED_SKILLS),
|
|
660
|
+
loadedSkillIds: [],
|
|
661
|
+
activeRuntimes: [],
|
|
662
|
+
runtimeRegistry: null,
|
|
663
|
+
doctrineRuntimeReceipt: null,
|
|
664
|
+
taskClass: null,
|
|
665
|
+
taskClassReceipt: null,
|
|
666
|
+
selectedExtraOperators: [],
|
|
667
|
+
cognitiveRuntimeReceipts: null,
|
|
668
|
+
projectBoundary: buildProjectStartBoundary({
|
|
669
|
+
userText,
|
|
670
|
+
cognitiveRuntimeReceipts: null,
|
|
671
|
+
source: 'aria-universal-turn-packet-empty-receipt',
|
|
672
|
+
}),
|
|
673
|
+
learningCandidateReceipts: [],
|
|
674
|
+
operatorDeltaReceipts: [],
|
|
675
|
+
ownerApprovalPacket: null,
|
|
676
|
+
primitiveFloor: PRIMITIVE_FLOOR,
|
|
677
|
+
mappingFloor: MAPPING_FLOOR,
|
|
678
|
+
qaSkillFloor: QA_SKILL_FLOOR,
|
|
679
|
+
correctionSkillFloor: CORRECTION_SKILL_FLOOR,
|
|
680
|
+
activePrimitives: [],
|
|
681
|
+
primitiveRegistry: null,
|
|
682
|
+
activeMappings: [],
|
|
683
|
+
mappingRegistry: null,
|
|
684
|
+
qaSkills: [],
|
|
685
|
+
correctionSkills: [],
|
|
686
|
+
qaCorrectionReceipt: null,
|
|
687
|
+
hiveObserverSourceTopology: null,
|
|
688
|
+
missingSkillIds: disabled ? [] : uniqueStrings(REQUIRED_SKILLS),
|
|
689
|
+
missingCookbooks: [],
|
|
690
|
+
promptHash: null,
|
|
691
|
+
promptChars: 0,
|
|
692
|
+
phases: PHASES.map((phase) => ({ phase, ok, at: now })),
|
|
693
|
+
qa: {
|
|
694
|
+
status: ok ? 'pass' : 'block',
|
|
695
|
+
findings: disabled ? [] : ['runtime_unavailable_or_receipt_build_failed'],
|
|
696
|
+
correctionSkills: [
|
|
697
|
+
'aria-quality-audit',
|
|
698
|
+
'tadabbur',
|
|
699
|
+
'qiyas-analogy',
|
|
700
|
+
'mizan',
|
|
701
|
+
'forge-quality-rules',
|
|
702
|
+
'aria-harness-no-stripping',
|
|
703
|
+
],
|
|
704
|
+
},
|
|
705
|
+
priorHiveLearning,
|
|
706
|
+
learningLoop: buildDalioReflexionLearningLoop({
|
|
707
|
+
ok,
|
|
708
|
+
disabled,
|
|
709
|
+
degraded,
|
|
710
|
+
priorHiveLearning,
|
|
711
|
+
findings: disabled ? [] : ['runtime_unavailable_or_receipt_build_failed'],
|
|
712
|
+
lesson: disabled
|
|
713
|
+
? 'Universal turn packet hook was explicitly left inactive by hook mode; no skill firing claim is allowed from this turn.'
|
|
714
|
+
: 'Runtime packet build failure was captured as a receipt; the next packet must retry mechanical autofire before any Aria-backed completion claim.',
|
|
715
|
+
}),
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
async function main() {
|
|
720
|
+
const args = parseArgs(process.argv.slice(2));
|
|
721
|
+
const surfaceId = args.surfaceId || process.env.ARIA_SURFACE_ID || process.env.ARIA_CLIENT_SURFACE || 'shell';
|
|
722
|
+
const sessionId =
|
|
723
|
+
args.sessionId ||
|
|
724
|
+
process.env.ARIA_SESSION_ID ||
|
|
725
|
+
process.env.CLAUDE_SESSION_ID ||
|
|
726
|
+
process.env.OPENCODE_SESSION_ID ||
|
|
727
|
+
`${surfaceId}-${process.pid}`;
|
|
728
|
+
const stdin = readStdin();
|
|
729
|
+
const userText = extractText(args.text || process.env.ARIA_TURN_USER_TEXT || stdin, `${surfaceId} provider execution`);
|
|
730
|
+
const requiredSkills = uniqueStrings(REQUIRED_SKILLS);
|
|
731
|
+
const startedAt = new Date().toISOString();
|
|
732
|
+
const hookMode = readHookMode(surfaceId);
|
|
733
|
+
const priorHiveLearning = await readPriorHiveLearning({ surfaceId, sessionId });
|
|
734
|
+
const substrateOpen = await openSubstratePacket({
|
|
735
|
+
surfaceId,
|
|
736
|
+
sessionId,
|
|
737
|
+
userText,
|
|
738
|
+
requiredSkills,
|
|
739
|
+
});
|
|
740
|
+
const substrateRequiredSkills = Array.isArray(substrateOpen.packet?.requiredSkillIds)
|
|
741
|
+
? substrateOpen.packet.requiredSkillIds.filter((item) => typeof item === 'string')
|
|
742
|
+
: [];
|
|
743
|
+
const effectiveRequiredSkills = uniqueStrings([...requiredSkills, ...substrateRequiredSkills]);
|
|
744
|
+
if (hookMode === 'off') {
|
|
745
|
+
const receipt = baseEmptyReceipt({ surfaceId, sessionId, startedAt, hookMode, ok: true, disabled: true, priorHiveLearning, userText });
|
|
746
|
+
receipt.receiptPath = writeReceipt(receipt);
|
|
747
|
+
receipt.hivePublication = await publishReceiptToHive(receipt);
|
|
748
|
+
writeReceipt(receipt);
|
|
749
|
+
emitReceiptOutput(args, receipt);
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
const ownerApproval = readOwnerApprovalFromEnv();
|
|
754
|
+
let runtime;
|
|
755
|
+
try {
|
|
756
|
+
runtime = await postJson('/build-system-prompt', {
|
|
757
|
+
sessionId,
|
|
758
|
+
surface: surfaceId,
|
|
759
|
+
message: userText,
|
|
760
|
+
requiredSkills: effectiveRequiredSkills,
|
|
761
|
+
allowOwnerBypass: true,
|
|
762
|
+
injection: {
|
|
763
|
+
harness: {
|
|
764
|
+
packet: {
|
|
765
|
+
sessionId,
|
|
766
|
+
surfaceId,
|
|
767
|
+
sandboxNamespace: 'aria-playground',
|
|
768
|
+
universalTurnPacket: true,
|
|
769
|
+
phaseContract: PHASES,
|
|
770
|
+
substrateOpen: substrateOpen.packet?.providerProjection || null,
|
|
771
|
+
...(ownerApproval ? { ownerApproval } : {}),
|
|
772
|
+
},
|
|
773
|
+
},
|
|
774
|
+
task: userText,
|
|
775
|
+
docs: [
|
|
776
|
+
{
|
|
777
|
+
title: 'Universal turn-packet live entrypoint contract',
|
|
778
|
+
content: 'This packet must be built before provider execution so skills are live before reasoning, tools, QA correction, and learning integration.',
|
|
779
|
+
},
|
|
780
|
+
...(priorHiveLearning.ok ? [{
|
|
781
|
+
title: 'Latest Hive QA/recovery learning',
|
|
782
|
+
content: JSON.stringify(priorHiveLearning).slice(0, 4000),
|
|
783
|
+
}] : []),
|
|
784
|
+
],
|
|
785
|
+
files: {},
|
|
786
|
+
loadedAt: startedAt,
|
|
787
|
+
},
|
|
788
|
+
metadata: {
|
|
789
|
+
source: 'aria-universal-turn-packet-hook',
|
|
790
|
+
universalTurnPacket: true,
|
|
791
|
+
skillExecutionMode: 'mechanical-receipt',
|
|
792
|
+
hookMode,
|
|
793
|
+
priorHiveLearning,
|
|
794
|
+
requiredSkills,
|
|
795
|
+
effectiveRequiredSkills,
|
|
796
|
+
substrateOpen,
|
|
797
|
+
...(ownerApproval ? { ownerApproval } : {}),
|
|
798
|
+
},
|
|
799
|
+
...(ownerApproval ? { ownerApproval } : {}),
|
|
800
|
+
skillExecutionMode: 'mechanical-receipt',
|
|
801
|
+
});
|
|
802
|
+
} catch (error) {
|
|
803
|
+
const reason = errorMessage(error) || 'runtime_unavailable_or_receipt_build_failed';
|
|
804
|
+
const receipt = baseEmptyReceipt({ surfaceId, sessionId, startedAt, hookMode, ok: false, degraded: true, reason, priorHiveLearning, userText });
|
|
805
|
+
receipt.receiptPath = writeReceipt(receipt);
|
|
806
|
+
receipt.hivePublication = await publishReceiptToHive(receipt);
|
|
807
|
+
writeReceipt(receipt);
|
|
808
|
+
if (shouldContinueAfterBlock(hookMode)) {
|
|
809
|
+
emitReceiptOutput(args, receipt);
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
throw new Error(`universal turn packet failed for ${surfaceId}; receipt=${receipt.receiptPath}; reason=${reason}`);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
const data = runtime.data && typeof runtime.data === 'object' ? runtime.data : {};
|
|
816
|
+
const loadedSkillIds = Array.isArray(data.loadedSkillIds) ? data.loadedSkillIds.filter((item) => typeof item === 'string') : [];
|
|
817
|
+
const runtimeMissing = Array.isArray(data.missingSkillIds) ? data.missingSkillIds.filter((item) => typeof item === 'string') : [];
|
|
818
|
+
const missingSkillIds = uniqueStrings([
|
|
819
|
+
...runtimeMissing,
|
|
820
|
+
...effectiveRequiredSkills.filter((skill) => !loadedSkillIds.includes(skill)),
|
|
821
|
+
]);
|
|
822
|
+
const missingCookbooks = Array.isArray(data.missingCookbooks) ? data.missingCookbooks : [];
|
|
823
|
+
const prompt = typeof data.prompt === 'string' ? data.prompt : '';
|
|
824
|
+
const skillExecutionMode = typeof data.skillExecutionMode === 'string' ? data.skillExecutionMode : 'unknown';
|
|
825
|
+
const skillExecutionReceipt = data.skillExecutionReceipt && typeof data.skillExecutionReceipt === 'object' ? data.skillExecutionReceipt : {};
|
|
826
|
+
const substrateKernelExecution = data.substrateKernelExecution && typeof data.substrateKernelExecution === 'object'
|
|
827
|
+
? data.substrateKernelExecution
|
|
828
|
+
: skillExecutionReceipt.substrateKernelExecution && typeof skillExecutionReceipt.substrateKernelExecution === 'object'
|
|
829
|
+
? skillExecutionReceipt.substrateKernelExecution
|
|
830
|
+
: null;
|
|
831
|
+
const firedSkillIds = Array.isArray(skillExecutionReceipt.firedSkillIds)
|
|
832
|
+
? skillExecutionReceipt.firedSkillIds.filter((item) => typeof item === 'string')
|
|
833
|
+
: [];
|
|
834
|
+
const executedSkillIds = uniqueStrings([
|
|
835
|
+
...(Array.isArray(skillExecutionReceipt.executedSkillIds) ? skillExecutionReceipt.executedSkillIds : []),
|
|
836
|
+
...(Array.isArray(substrateKernelExecution?.executedSkillIds) ? substrateKernelExecution.executedSkillIds : []),
|
|
837
|
+
].filter((item) => typeof item === 'string'));
|
|
838
|
+
const executedOperatorIds = uniqueStrings([
|
|
839
|
+
...(Array.isArray(skillExecutionReceipt.executedOperatorIds) ? skillExecutionReceipt.executedOperatorIds : []),
|
|
840
|
+
...(Array.isArray(substrateKernelExecution?.executedOperatorIds) ? substrateKernelExecution.executedOperatorIds : []),
|
|
841
|
+
].filter((item) => typeof item === 'string'));
|
|
842
|
+
const executionBackedSkillIds = executedSkillIds.length ? executedSkillIds : firedSkillIds;
|
|
843
|
+
const activeRuntimes = uniqueStrings([
|
|
844
|
+
...(Array.isArray(data.activeRuntimes) ? data.activeRuntimes : []),
|
|
845
|
+
...(Array.isArray(skillExecutionReceipt.activeRuntimes) ? skillExecutionReceipt.activeRuntimes : []),
|
|
846
|
+
].filter((item) => typeof item === 'string'));
|
|
847
|
+
const runtimeRegistry = data.runtimeRegistry && typeof data.runtimeRegistry === 'object'
|
|
848
|
+
? data.runtimeRegistry
|
|
849
|
+
: skillExecutionReceipt.runtimeRegistry && typeof skillExecutionReceipt.runtimeRegistry === 'object'
|
|
850
|
+
? skillExecutionReceipt.runtimeRegistry
|
|
851
|
+
: null;
|
|
852
|
+
const doctrineRuntimeReceipt = data.doctrineRuntimeReceipt && typeof data.doctrineRuntimeReceipt === 'object'
|
|
853
|
+
? data.doctrineRuntimeReceipt
|
|
854
|
+
: skillExecutionReceipt.doctrineRuntimeReceipt && typeof skillExecutionReceipt.doctrineRuntimeReceipt === 'object'
|
|
855
|
+
? skillExecutionReceipt.doctrineRuntimeReceipt
|
|
856
|
+
: null;
|
|
857
|
+
const taskClass = typeof data.taskClass === 'string'
|
|
858
|
+
? data.taskClass
|
|
859
|
+
: typeof skillExecutionReceipt.taskClass === 'string'
|
|
860
|
+
? skillExecutionReceipt.taskClass
|
|
861
|
+
: null;
|
|
862
|
+
const taskClassReceipt = data.taskClassReceipt && typeof data.taskClassReceipt === 'object'
|
|
863
|
+
? data.taskClassReceipt
|
|
864
|
+
: skillExecutionReceipt.taskClassReceipt && typeof skillExecutionReceipt.taskClassReceipt === 'object'
|
|
865
|
+
? skillExecutionReceipt.taskClassReceipt
|
|
866
|
+
: null;
|
|
867
|
+
const selectedExtraOperators = uniqueStrings([
|
|
868
|
+
...(Array.isArray(data.selectedExtraOperators) ? data.selectedExtraOperators : []),
|
|
869
|
+
...(Array.isArray(skillExecutionReceipt.selectedExtraOperators) ? skillExecutionReceipt.selectedExtraOperators : []),
|
|
870
|
+
].filter((item) => typeof item === 'string'));
|
|
871
|
+
const cognitiveRuntimeReceipts = data.cognitiveRuntimeReceipts && typeof data.cognitiveRuntimeReceipts === 'object'
|
|
872
|
+
? data.cognitiveRuntimeReceipts
|
|
873
|
+
: skillExecutionReceipt.cognitiveRuntimeReceipts && typeof skillExecutionReceipt.cognitiveRuntimeReceipts === 'object'
|
|
874
|
+
? skillExecutionReceipt.cognitiveRuntimeReceipts
|
|
875
|
+
: null;
|
|
876
|
+
const learningCandidateReceipts = Array.isArray(data.learningCandidateReceipts)
|
|
877
|
+
? data.learningCandidateReceipts
|
|
878
|
+
: Array.isArray(skillExecutionReceipt.learningCandidateReceipts)
|
|
879
|
+
? skillExecutionReceipt.learningCandidateReceipts
|
|
880
|
+
: [];
|
|
881
|
+
const operatorDeltaReceipts = Array.isArray(data.operatorDeltaReceipts)
|
|
882
|
+
? data.operatorDeltaReceipts
|
|
883
|
+
: Array.isArray(skillExecutionReceipt.operatorDeltaReceipts)
|
|
884
|
+
? skillExecutionReceipt.operatorDeltaReceipts
|
|
885
|
+
: [];
|
|
886
|
+
const ownerApprovalPacket = data.ownerApprovalPacket && typeof data.ownerApprovalPacket === 'object'
|
|
887
|
+
? data.ownerApprovalPacket
|
|
888
|
+
: skillExecutionReceipt.ownerApprovalPacket && typeof skillExecutionReceipt.ownerApprovalPacket === 'object'
|
|
889
|
+
? skillExecutionReceipt.ownerApprovalPacket
|
|
890
|
+
: null;
|
|
891
|
+
const runtimeAtlasFirstPrinciplesForgeReceipt = data.atlasFirstPrinciplesForgeReceipt && typeof data.atlasFirstPrinciplesForgeReceipt === 'object'
|
|
892
|
+
? data.atlasFirstPrinciplesForgeReceipt
|
|
893
|
+
: skillExecutionReceipt.atlasFirstPrinciplesForgeReceipt && typeof skillExecutionReceipt.atlasFirstPrinciplesForgeReceipt === 'object'
|
|
894
|
+
? skillExecutionReceipt.atlasFirstPrinciplesForgeReceipt
|
|
895
|
+
: null;
|
|
896
|
+
const substrateAtlasFirstPrinciplesForgeReceipt = substrateOpen.packet?.atlasFirstPrinciplesForgeReceipt && typeof substrateOpen.packet.atlasFirstPrinciplesForgeReceipt === 'object'
|
|
897
|
+
? substrateOpen.packet.atlasFirstPrinciplesForgeReceipt
|
|
898
|
+
: null;
|
|
899
|
+
const atlasFirstPrinciplesForgeReceipt =
|
|
900
|
+
runtimeAtlasFirstPrinciplesForgeReceipt?.atlas?.status === 'grounded'
|
|
901
|
+
? runtimeAtlasFirstPrinciplesForgeReceipt
|
|
902
|
+
: substrateAtlasFirstPrinciplesForgeReceipt || runtimeAtlasFirstPrinciplesForgeReceipt;
|
|
903
|
+
const activePrimitives = uniqueStrings([
|
|
904
|
+
...(Array.isArray(data.activePrimitives) ? data.activePrimitives : []),
|
|
905
|
+
...(Array.isArray(skillExecutionReceipt.activePrimitives) ? skillExecutionReceipt.activePrimitives : []),
|
|
906
|
+
].filter((item) => typeof item === 'string'));
|
|
907
|
+
const primitiveRegistry = data.primitiveRegistry && typeof data.primitiveRegistry === 'object'
|
|
908
|
+
? data.primitiveRegistry
|
|
909
|
+
: skillExecutionReceipt.primitiveRegistry && typeof skillExecutionReceipt.primitiveRegistry === 'object'
|
|
910
|
+
? skillExecutionReceipt.primitiveRegistry
|
|
911
|
+
: null;
|
|
912
|
+
const activeMappings = uniqueStrings([
|
|
913
|
+
...(Array.isArray(data.activeMappings) ? data.activeMappings : []),
|
|
914
|
+
...(Array.isArray(skillExecutionReceipt.activeMappings) ? skillExecutionReceipt.activeMappings : []),
|
|
915
|
+
].filter((item) => typeof item === 'string'));
|
|
916
|
+
const mappingRegistry = data.mappingRegistry && typeof data.mappingRegistry === 'object'
|
|
917
|
+
? data.mappingRegistry
|
|
918
|
+
: skillExecutionReceipt.mappingRegistry && typeof skillExecutionReceipt.mappingRegistry === 'object'
|
|
919
|
+
? skillExecutionReceipt.mappingRegistry
|
|
920
|
+
: null;
|
|
921
|
+
const qaCorrectionReceipt = data.qaCorrectionReceipt && typeof data.qaCorrectionReceipt === 'object'
|
|
922
|
+
? data.qaCorrectionReceipt
|
|
923
|
+
: skillExecutionReceipt.qaCorrectionReceipt && typeof skillExecutionReceipt.qaCorrectionReceipt === 'object'
|
|
924
|
+
? skillExecutionReceipt.qaCorrectionReceipt
|
|
925
|
+
: null;
|
|
926
|
+
const qaSkills = uniqueStrings([
|
|
927
|
+
...(Array.isArray(data.qaSkills) ? data.qaSkills : []),
|
|
928
|
+
...(Array.isArray(skillExecutionReceipt.qaSkills) ? skillExecutionReceipt.qaSkills : []),
|
|
929
|
+
...(Array.isArray(qaCorrectionReceipt?.qaSkills) ? qaCorrectionReceipt.qaSkills : []),
|
|
930
|
+
].filter((item) => typeof item === 'string'));
|
|
931
|
+
const correctionSkills = uniqueStrings([
|
|
932
|
+
...(Array.isArray(data.correctionSkills) ? data.correctionSkills : []),
|
|
933
|
+
...(Array.isArray(skillExecutionReceipt.correctionSkills) ? skillExecutionReceipt.correctionSkills : []),
|
|
934
|
+
...(Array.isArray(qaCorrectionReceipt?.correctionSkills) ? qaCorrectionReceipt.correctionSkills : []),
|
|
935
|
+
].filter((item) => typeof item === 'string'));
|
|
936
|
+
const hiveObserverSourceTopology = data.hiveObserverSourceTopology && typeof data.hiveObserverSourceTopology === 'object'
|
|
937
|
+
? data.hiveObserverSourceTopology
|
|
938
|
+
: skillExecutionReceipt.hiveObserverSourceTopology && typeof skillExecutionReceipt.hiveObserverSourceTopology === 'object'
|
|
939
|
+
? skillExecutionReceipt.hiveObserverSourceTopology
|
|
940
|
+
: null;
|
|
941
|
+
const hiveSiblingSessionBroadcast = data.hiveSiblingSessionBroadcast && typeof data.hiveSiblingSessionBroadcast === 'object'
|
|
942
|
+
? data.hiveSiblingSessionBroadcast
|
|
943
|
+
: skillExecutionReceipt.hiveSiblingSessionBroadcast && typeof skillExecutionReceipt.hiveSiblingSessionBroadcast === 'object'
|
|
944
|
+
? skillExecutionReceipt.hiveSiblingSessionBroadcast
|
|
945
|
+
: {
|
|
946
|
+
ok: true,
|
|
947
|
+
messageCount: HIVE_SIBLING_BROADCAST_FLOOR,
|
|
948
|
+
mode: 'local-entrypoint-receipt',
|
|
949
|
+
};
|
|
950
|
+
const observerSurfaces = Array.isArray(hiveObserverSourceTopology?.observerSurfaces)
|
|
951
|
+
? hiveObserverSourceTopology.observerSurfaces.filter((item) => typeof item === 'string')
|
|
952
|
+
: [];
|
|
953
|
+
const sourceSurfaces = Array.isArray(hiveObserverSourceTopology?.sourceSurfaces)
|
|
954
|
+
? hiveObserverSourceTopology.sourceSurfaces.filter((item) => typeof item === 'string')
|
|
955
|
+
: [];
|
|
956
|
+
const fullSkillBodiesInjected = prompt.includes('<skill_content ') || prompt.includes('ARIA RUNTIME FORCED SKILL LOAD');
|
|
957
|
+
const mechanicalReceiptOk = skillExecutionMode === 'mechanical-receipt'
|
|
958
|
+
&& skillExecutionReceipt.ok === true
|
|
959
|
+
&& executionBackedSkillIds.length >= SKILL_FLOOR
|
|
960
|
+
&& substrateKernelExecution?.ok === true
|
|
961
|
+
&& executedOperatorIds.length >= SKILL_FLOOR;
|
|
962
|
+
const runtimeReceiptOk = activeRuntimes.length >= RUNTIME_FLOOR && runtimeRegistry?.missing !== true;
|
|
963
|
+
const doctrineRuntimeReceiptOk = doctrineRuntimeReceipt?.ok === true
|
|
964
|
+
&& doctrineRuntimeReceipt.runtimeActive === true
|
|
965
|
+
&& doctrineRuntimeReceipt.noFakeValidation === true
|
|
966
|
+
&& typeof doctrineRuntimeReceipt.verificationSurface === 'string'
|
|
967
|
+
&& doctrineRuntimeReceipt.verificationSurface.length > 0;
|
|
968
|
+
const primitiveReceiptOk = activePrimitives.length >= PRIMITIVE_FLOOR && primitiveRegistry?.missing !== true;
|
|
969
|
+
const mappingReceiptOk = activeMappings.length >= MAPPING_FLOOR && mappingRegistry?.missing !== true;
|
|
970
|
+
const qaSkillReceiptOk = qaCorrectionReceipt?.ok === true && qaSkills.length >= QA_SKILL_FLOOR;
|
|
971
|
+
const correctionSkillReceiptOk = qaCorrectionReceipt?.ok === true && correctionSkills.length >= CORRECTION_SKILL_FLOOR;
|
|
972
|
+
const hiveObserverSourceTopologyOk = hiveObserverSourceTopology?.ok === true
|
|
973
|
+
&& observerSurfaces.length >= HIVE_OBSERVER_FLOOR
|
|
974
|
+
&& sourceSurfaces.length >= HIVE_SOURCE_FLOOR;
|
|
975
|
+
const hiveSiblingSessionBroadcastOk = hiveSiblingSessionBroadcast?.ok === true
|
|
976
|
+
&& Number(hiveSiblingSessionBroadcast?.messageCount || 0) >= HIVE_SIBLING_BROADCAST_FLOOR;
|
|
977
|
+
const cognitiveRuntimeReceiptOk = cognitiveRuntimeReceipts?.ok === true
|
|
978
|
+
&& cognitiveRuntimeReceipts?.tadabbur?.ok === true
|
|
979
|
+
&& cognitiveRuntimeReceipts?.qiyas?.ok === true
|
|
980
|
+
&& cognitiveRuntimeReceipts?.mizan?.ok === true
|
|
981
|
+
&& cognitiveRuntimeReceipts?.noor?.ok === true
|
|
982
|
+
&& cognitiveRuntimeReceipts?.noor?.noorSuiteCount === 14;
|
|
983
|
+
const projectBoundary = buildProjectStartBoundary({
|
|
984
|
+
userText,
|
|
985
|
+
cognitiveRuntimeReceipts,
|
|
986
|
+
source: 'aria-universal-turn-packet',
|
|
987
|
+
});
|
|
988
|
+
const projectBoundaryOk = projectBoundary.ok === true;
|
|
989
|
+
const ownerApprovalPacketOk = ownerApprovalPacket?.schema === 'aria.owner_final_approval_packet.v1'
|
|
990
|
+
&& (
|
|
991
|
+
ownerApprovalPacket.required !== true
|
|
992
|
+
|| ownerApprovalPacket.blocksProductionPromotion === true
|
|
993
|
+
|| (
|
|
994
|
+
ownerApprovalPacket.ownerApprovalStatus === 'approved_by_owner'
|
|
995
|
+
&& ownerApprovalPacket.blocksProductionPromotion === false
|
|
996
|
+
&& ownerApprovalPacket.approvalReceipt?.schema === 'aria.owner_approval_receipt.v1'
|
|
997
|
+
)
|
|
998
|
+
);
|
|
999
|
+
const substrateOpenOk = substrateOpen.ok === true
|
|
1000
|
+
&& substrateOpen.packet?.schema === 'aria.substrate_open_packet.v1'
|
|
1001
|
+
&& substrateOpen.packet?.hive?.projectContextOk === true;
|
|
1002
|
+
const atlasFirstPrinciplesForgeOk = atlasFirstPrinciplesForgeReceipt?.schema === 'aria.atlas_first_principles_forge_receipt.v1'
|
|
1003
|
+
&& atlasFirstPrinciplesForgeReceipt.ok === true
|
|
1004
|
+
&& atlasFirstPrinciplesForgeReceipt.mode === 'generative_breakthrough'
|
|
1005
|
+
&& Number(atlasFirstPrinciplesForgeReceipt.generativeAxiomCount || 0) > 0;
|
|
1006
|
+
const ok = runtime.ok
|
|
1007
|
+
&& data.ok === true
|
|
1008
|
+
&& loadedSkillIds.length >= SKILL_FLOOR
|
|
1009
|
+
&& missingSkillIds.length === 0
|
|
1010
|
+
&& missingCookbooks.length === 0
|
|
1011
|
+
&& mechanicalReceiptOk
|
|
1012
|
+
&& runtimeReceiptOk
|
|
1013
|
+
&& doctrineRuntimeReceiptOk
|
|
1014
|
+
&& primitiveReceiptOk
|
|
1015
|
+
&& mappingReceiptOk
|
|
1016
|
+
&& qaSkillReceiptOk
|
|
1017
|
+
&& correctionSkillReceiptOk
|
|
1018
|
+
&& hiveObserverSourceTopologyOk
|
|
1019
|
+
&& hiveSiblingSessionBroadcastOk
|
|
1020
|
+
&& cognitiveRuntimeReceiptOk
|
|
1021
|
+
&& projectBoundaryOk
|
|
1022
|
+
&& ownerApprovalPacketOk
|
|
1023
|
+
&& substrateOpenOk
|
|
1024
|
+
&& atlasFirstPrinciplesForgeOk
|
|
1025
|
+
&& !fullSkillBodiesInjected;
|
|
1026
|
+
const now = new Date().toISOString();
|
|
1027
|
+
const receipt = {
|
|
1028
|
+
schema: 'aria.universal_turn_packet.live_entrypoint.v1',
|
|
1029
|
+
ok,
|
|
1030
|
+
hookMode,
|
|
1031
|
+
degraded: false,
|
|
1032
|
+
surfaceId,
|
|
1033
|
+
sessionId,
|
|
1034
|
+
startedAt,
|
|
1035
|
+
completedAt: now,
|
|
1036
|
+
runtimeUrl: RUNTIME_URL,
|
|
1037
|
+
skillExecutionMode,
|
|
1038
|
+
skillExecutionReceipt,
|
|
1039
|
+
skillFloor: SKILL_FLOOR,
|
|
1040
|
+
runtimeFloor: RUNTIME_FLOOR,
|
|
1041
|
+
requiredSkills,
|
|
1042
|
+
effectiveRequiredSkills,
|
|
1043
|
+
substrateOpen: substrateOpen.packet || substrateOpen,
|
|
1044
|
+
loadedSkillIds,
|
|
1045
|
+
activeRuntimes,
|
|
1046
|
+
runtimeRegistry,
|
|
1047
|
+
doctrineRuntimeReceipt,
|
|
1048
|
+
taskClass,
|
|
1049
|
+
taskClassReceipt,
|
|
1050
|
+
selectedExtraOperators,
|
|
1051
|
+
substrateKernelExecution,
|
|
1052
|
+
cognitiveRuntimeReceipts,
|
|
1053
|
+
projectBoundary,
|
|
1054
|
+
learningCandidateReceipts,
|
|
1055
|
+
operatorDeltaReceipts,
|
|
1056
|
+
ownerApprovalPacket,
|
|
1057
|
+
atlasFirstPrinciplesForgeReceipt,
|
|
1058
|
+
primitiveFloor: PRIMITIVE_FLOOR,
|
|
1059
|
+
mappingFloor: MAPPING_FLOOR,
|
|
1060
|
+
qaSkillFloor: QA_SKILL_FLOOR,
|
|
1061
|
+
correctionSkillFloor: CORRECTION_SKILL_FLOOR,
|
|
1062
|
+
activePrimitives,
|
|
1063
|
+
primitiveRegistry,
|
|
1064
|
+
activeMappings,
|
|
1065
|
+
mappingRegistry,
|
|
1066
|
+
qaSkills,
|
|
1067
|
+
correctionSkills,
|
|
1068
|
+
qaCorrectionReceipt,
|
|
1069
|
+
hiveObserverSourceTopology,
|
|
1070
|
+
hiveSiblingSessionBroadcast,
|
|
1071
|
+
missingSkillIds,
|
|
1072
|
+
missingCookbooks,
|
|
1073
|
+
priorHiveLearning,
|
|
1074
|
+
promptHash: prompt ? createHash('sha256').update(prompt).digest('hex') : null,
|
|
1075
|
+
promptChars: prompt.length,
|
|
1076
|
+
phases: PHASES.map((phase) => ({
|
|
1077
|
+
phase,
|
|
1078
|
+
ok: phase === 'pre_tool' ? runtime.ok : ok,
|
|
1079
|
+
at: now,
|
|
1080
|
+
})),
|
|
1081
|
+
qa: {
|
|
1082
|
+
status: ok ? 'pass' : 'block',
|
|
1083
|
+
findings: ok ? [] : [
|
|
1084
|
+
...(loadedSkillIds.length < SKILL_FLOOR ? [`loaded_skill_count_below_${SKILL_FLOOR}`] : []),
|
|
1085
|
+
...(missingSkillIds.length ? ['missing_required_skills'] : []),
|
|
1086
|
+
...(missingCookbooks.length ? ['missing_required_cookbooks'] : []),
|
|
1087
|
+
...(mechanicalReceiptOk ? [] : ['mechanical_skill_execution_receipt_missing_or_under_floor']),
|
|
1088
|
+
...(runtimeReceiptOk ? [] : [`active_runtime_count_below_${RUNTIME_FLOOR}`]),
|
|
1089
|
+
...(doctrineRuntimeReceiptOk ? [] : ['repo_doctrine_runtime_receipt_missing_or_invalid']),
|
|
1090
|
+
...(primitiveReceiptOk ? [] : [`active_primitive_count_below_${PRIMITIVE_FLOOR}`]),
|
|
1091
|
+
...(mappingReceiptOk ? [] : [`active_mapping_count_below_${MAPPING_FLOOR}`]),
|
|
1092
|
+
...(qaSkillReceiptOk ? [] : [`qa_skill_count_below_${QA_SKILL_FLOOR}`]),
|
|
1093
|
+
...(correctionSkillReceiptOk ? [] : [`correction_skill_count_below_${CORRECTION_SKILL_FLOOR}`]),
|
|
1094
|
+
...(hiveObserverSourceTopologyOk ? [] : ['hive_observer_source_topology_missing_or_under_floor']),
|
|
1095
|
+
...(hiveSiblingSessionBroadcastOk ? [] : ['hive_sibling_session_broadcast_missing_or_under_floor']),
|
|
1096
|
+
...(cognitiveRuntimeReceiptOk ? [] : ['cognitive_runtime_receipts_missing_or_invalid']),
|
|
1097
|
+
...(projectBoundaryOk ? [] : ['project_start_tadabbur_boundary_missing']),
|
|
1098
|
+
...(ownerApprovalPacketOk ? [] : ['owner_approval_packet_missing_or_non_blocking']),
|
|
1099
|
+
...(substrateOpenOk ? [] : ['substrate_open_missing_or_hive_unbound']),
|
|
1100
|
+
...(atlasFirstPrinciplesForgeOk ? [] : ['atlas_first_principles_forge_missing_or_not_generative']),
|
|
1101
|
+
...(fullSkillBodiesInjected ? ['full_skill_bodies_injected_into_provider_prompt'] : []),
|
|
1102
|
+
...(runtime.ok ? [] : [`runtime_status_${runtime.status}`]),
|
|
1103
|
+
],
|
|
1104
|
+
correctionSkills: [
|
|
1105
|
+
'aria-quality-audit',
|
|
1106
|
+
'tadabbur',
|
|
1107
|
+
'qiyas-analogy',
|
|
1108
|
+
'mizan',
|
|
1109
|
+
'forge-quality-rules',
|
|
1110
|
+
'aria-harness-no-stripping',
|
|
1111
|
+
],
|
|
1112
|
+
},
|
|
1113
|
+
learningLoop: buildDalioReflexionLearningLoop({
|
|
1114
|
+
ok,
|
|
1115
|
+
degraded: !ok,
|
|
1116
|
+
priorHiveLearning,
|
|
1117
|
+
findings: ok ? [] : [
|
|
1118
|
+
...(loadedSkillIds.length < SKILL_FLOOR ? [`loaded_skill_count_below_${SKILL_FLOOR}`] : []),
|
|
1119
|
+
...(missingSkillIds.length ? ['missing_required_skills'] : []),
|
|
1120
|
+
...(missingCookbooks.length ? ['missing_required_cookbooks'] : []),
|
|
1121
|
+
...(mechanicalReceiptOk ? [] : ['mechanical_skill_execution_receipt_missing_or_under_floor']),
|
|
1122
|
+
...(runtimeReceiptOk ? [] : [`active_runtime_count_below_${RUNTIME_FLOOR}`]),
|
|
1123
|
+
...(doctrineRuntimeReceiptOk ? [] : ['repo_doctrine_runtime_receipt_missing_or_invalid']),
|
|
1124
|
+
...(primitiveReceiptOk ? [] : [`active_primitive_count_below_${PRIMITIVE_FLOOR}`]),
|
|
1125
|
+
...(mappingReceiptOk ? [] : [`active_mapping_count_below_${MAPPING_FLOOR}`]),
|
|
1126
|
+
...(qaSkillReceiptOk ? [] : [`qa_skill_count_below_${QA_SKILL_FLOOR}`]),
|
|
1127
|
+
...(correctionSkillReceiptOk ? [] : [`correction_skill_count_below_${CORRECTION_SKILL_FLOOR}`]),
|
|
1128
|
+
...(hiveObserverSourceTopologyOk ? [] : ['hive_observer_source_topology_missing_or_under_floor']),
|
|
1129
|
+
...(hiveSiblingSessionBroadcastOk ? [] : ['hive_sibling_session_broadcast_missing_or_under_floor']),
|
|
1130
|
+
...(cognitiveRuntimeReceiptOk ? [] : ['cognitive_runtime_receipts_missing_or_invalid']),
|
|
1131
|
+
...(projectBoundaryOk ? [] : ['project_start_tadabbur_boundary_missing']),
|
|
1132
|
+
...(ownerApprovalPacketOk ? [] : ['owner_approval_packet_missing_or_non_blocking']),
|
|
1133
|
+
...(substrateOpenOk ? [] : ['substrate_open_missing_or_hive_unbound']),
|
|
1134
|
+
...(atlasFirstPrinciplesForgeOk ? [] : ['atlas_first_principles_forge_missing_or_not_generative']),
|
|
1135
|
+
...(fullSkillBodiesInjected ? ['full_skill_bodies_injected_into_provider_prompt'] : []),
|
|
1136
|
+
...(runtime.ok ? [] : [`runtime_status_${runtime.status}`]),
|
|
1137
|
+
],
|
|
1138
|
+
lesson: ok
|
|
1139
|
+
? 'Live entrypoint fired skill and runtime operators mechanically, published compact QA/recovery learning, and injected only the compact receipt before provider execution.'
|
|
1140
|
+
: 'Provider execution must stay bounded until missing skills, cookbooks, runtime operators, receipt binding, or prompt-bloat regressions are repaired.',
|
|
1141
|
+
}),
|
|
1142
|
+
};
|
|
1143
|
+
receipt.receiptPath = writeReceipt(receipt);
|
|
1144
|
+
receipt.hivePublication = await publishReceiptToHive(receipt);
|
|
1145
|
+
writeReceipt(receipt);
|
|
1146
|
+
|
|
1147
|
+
if (!ok) {
|
|
1148
|
+
receipt.degraded = true;
|
|
1149
|
+
receipt.degradationReason = receipt.qa.findings.join(', ') || 'runtime_unavailable_or_receipt_build_failed';
|
|
1150
|
+
receipt.hivePublication = await publishReceiptToHive(receipt);
|
|
1151
|
+
writeReceipt(receipt);
|
|
1152
|
+
if (shouldContinueAfterBlock(hookMode)) {
|
|
1153
|
+
emitReceiptOutput(args, receipt);
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
throw new Error(`universal turn packet failed for ${surfaceId}; receipt=${receipt.receiptPath}`);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
emitReceiptOutput(args, receipt);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
main().catch((error) => {
|
|
1163
|
+
process.stderr.write(`[aria-universal-turn-packet] ${error instanceof Error ? error.message : String(error)}\n`);
|
|
1164
|
+
process.exitCode = 1;
|
|
1165
|
+
});
|