@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,1158 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { dirname, join, resolve } from 'node:path';
|
|
6
|
+
import http from 'node:http';
|
|
7
|
+
|
|
8
|
+
import { exportOwnerGoogleSheetsCsv } from './export-owner-status-sheets.mjs';
|
|
9
|
+
|
|
10
|
+
const AIRTABLE_API = 'https://api.airtable.com';
|
|
11
|
+
const DEFAULT_SECRETS_ENV = join(homedir(), '.aria', 'secrets', 'airtable.env');
|
|
12
|
+
const DEFAULT_OWNER_AIRTABLE_DIR = join(homedir(), '.aria', 'owner-airtable');
|
|
13
|
+
const DEFAULT_STATE_PATH = join(DEFAULT_OWNER_AIRTABLE_DIR, 'latest.json');
|
|
14
|
+
const DEFAULT_ATLAS_SOCKET = join(homedir(), '.aria', 'atlas', 'atlas-server.sock');
|
|
15
|
+
|
|
16
|
+
function parseArgs(argv = process.argv.slice(2)) {
|
|
17
|
+
const args = {
|
|
18
|
+
taskId: null,
|
|
19
|
+
taskDir: null,
|
|
20
|
+
runtimeStateDir: null,
|
|
21
|
+
actionLedgerDir: null,
|
|
22
|
+
outDir: null,
|
|
23
|
+
ownerAirtableDir: null,
|
|
24
|
+
secretsEnv: DEFAULT_SECRETS_ENV,
|
|
25
|
+
statePath: DEFAULT_STATE_PATH,
|
|
26
|
+
baseId: process.env.AIRTABLE_ARIA_BASE_ID || process.env.AIRTABLE_BASE_ID || null,
|
|
27
|
+
token: process.env.AIRTABLE_ACCESS_TOKEN || process.env.AIRTABLE_API_KEY || process.env.AIRTABLE_PAT || null,
|
|
28
|
+
atlasSocket: process.env.ATLAS_SERVER_SOCKET || DEFAULT_ATLAS_SOCKET,
|
|
29
|
+
dryRun: false,
|
|
30
|
+
};
|
|
31
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
32
|
+
const arg = argv[index];
|
|
33
|
+
if (arg === '--task-id') args.taskId = argv[++index];
|
|
34
|
+
else if (arg === '--task-dir') args.taskDir = resolve(argv[++index]);
|
|
35
|
+
else if (arg === '--runtime-state-dir') args.runtimeStateDir = resolve(argv[++index]);
|
|
36
|
+
else if (arg === '--action-ledger-dir') args.actionLedgerDir = resolve(argv[++index]);
|
|
37
|
+
else if (arg === '--out-dir') args.outDir = resolve(argv[++index]);
|
|
38
|
+
else if (arg === '--owner-airtable-dir') args.ownerAirtableDir = resolve(argv[++index]);
|
|
39
|
+
else if (arg === '--secrets-env') args.secretsEnv = resolve(argv[++index]);
|
|
40
|
+
else if (arg === '--state-path') args.statePath = resolve(argv[++index]);
|
|
41
|
+
else if (arg === '--base-id') args.baseId = argv[++index];
|
|
42
|
+
else if (arg === '--atlas-socket') args.atlasSocket = resolve(argv[++index]);
|
|
43
|
+
else if (arg === '--dry-run') args.dryRun = true;
|
|
44
|
+
else if (arg === '--help' || arg === '-h') {
|
|
45
|
+
printHelp();
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return args;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function printHelp() {
|
|
53
|
+
console.log(`
|
|
54
|
+
node scripts/sync-owner-status-airtable.mjs [options]
|
|
55
|
+
|
|
56
|
+
Syncs owner-visible Aria runtime ledger tables into Airtable.
|
|
57
|
+
|
|
58
|
+
Options:
|
|
59
|
+
--base-id ID Defaults to AIRTABLE_ARIA_BASE_ID or AIRTABLE_BASE_ID.
|
|
60
|
+
--secrets-env PATH Defaults to ~/.aria/secrets/airtable.env.
|
|
61
|
+
--state-path PATH Defaults to ~/.aria/owner-airtable/latest.json.
|
|
62
|
+
--task-id ID Export a specific Aria task.
|
|
63
|
+
--task-dir PATH Defaults to ~/.aria/cli-tasks in the exporter.
|
|
64
|
+
--runtime-state-dir PATH Defaults to ~/.aria/runtime/state in the exporter.
|
|
65
|
+
--action-ledger-dir PATH Defaults to ~/.aria/action-ledger in the exporter.
|
|
66
|
+
--out-dir PATH Defaults to ~/.aria/owner-google-sheets in the exporter.
|
|
67
|
+
--owner-airtable-dir PATH Defaults to ~/.aria/owner-airtable.
|
|
68
|
+
--atlas-socket PATH Defaults to ~/.aria/atlas/atlas-server.sock.
|
|
69
|
+
--dry-run Build rows and schema plan without writing Airtable.
|
|
70
|
+
`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function readEnvFile(path) {
|
|
74
|
+
if (!existsSync(path)) return {};
|
|
75
|
+
const env = {};
|
|
76
|
+
for (const line of readFileSync(path, 'utf8').split(/\r?\n/)) {
|
|
77
|
+
const trimmed = line.trim();
|
|
78
|
+
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
79
|
+
const match = trimmed.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);
|
|
80
|
+
if (!match) continue;
|
|
81
|
+
let value = match[2].trim();
|
|
82
|
+
if ((value.startsWith("'") && value.endsWith("'")) || (value.startsWith('"') && value.endsWith('"'))) {
|
|
83
|
+
value = value.slice(1, -1);
|
|
84
|
+
}
|
|
85
|
+
env[match[1]] = value;
|
|
86
|
+
}
|
|
87
|
+
return env;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function resolveAuth(options) {
|
|
91
|
+
const fileEnv = readEnvFile(options.secretsEnv || DEFAULT_SECRETS_ENV);
|
|
92
|
+
const token = options.token || fileEnv.AIRTABLE_ACCESS_TOKEN || fileEnv.AIRTABLE_API_KEY || fileEnv.AIRTABLE_PAT;
|
|
93
|
+
const baseId = options.baseId || fileEnv.AIRTABLE_ARIA_BASE_ID || fileEnv.AIRTABLE_BASE_ID;
|
|
94
|
+
if (!token) throw new Error(`Missing Airtable token. Set AIRTABLE_ACCESS_TOKEN or save ${options.secretsEnv || DEFAULT_SECRETS_ENV}.`);
|
|
95
|
+
if (!baseId) throw new Error(`Missing Airtable base id. Set AIRTABLE_ARIA_BASE_ID or save ${options.secretsEnv || DEFAULT_SECRETS_ENV}.`);
|
|
96
|
+
return { token, baseId };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function sleep(ms) {
|
|
100
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function airtableRequest({ token, method = 'GET', path, body = null, apiFetch = fetch, attempts = 3 }) {
|
|
104
|
+
let lastText = '';
|
|
105
|
+
let lastStatus = 0;
|
|
106
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
107
|
+
const response = await apiFetch(`${AIRTABLE_API}${path}`, {
|
|
108
|
+
method,
|
|
109
|
+
headers: {
|
|
110
|
+
authorization: `Bearer ${token}`,
|
|
111
|
+
'content-type': 'application/json',
|
|
112
|
+
},
|
|
113
|
+
body: body === null ? undefined : JSON.stringify(body),
|
|
114
|
+
});
|
|
115
|
+
const text = await response.text();
|
|
116
|
+
lastText = text;
|
|
117
|
+
lastStatus = response.status;
|
|
118
|
+
let parsed = {};
|
|
119
|
+
try { parsed = text ? JSON.parse(text) : {}; } catch { parsed = { raw: text.slice(0, 1000) }; }
|
|
120
|
+
if (response.ok) return parsed;
|
|
121
|
+
if (![429, 500, 502, 503, 504].includes(response.status) || attempt === attempts) {
|
|
122
|
+
throw new Error(`Airtable ${method} ${path} failed (${response.status}): ${text.slice(0, 1200)}`);
|
|
123
|
+
}
|
|
124
|
+
await sleep(250 * attempt);
|
|
125
|
+
}
|
|
126
|
+
throw new Error(`Airtable ${method} ${path} failed (${lastStatus}): ${lastText.slice(0, 1200)}`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function csvToRows(csv) {
|
|
130
|
+
const rows = [];
|
|
131
|
+
let row = [];
|
|
132
|
+
let cell = '';
|
|
133
|
+
let quoted = false;
|
|
134
|
+
for (let index = 0; index < csv.length; index += 1) {
|
|
135
|
+
const char = csv[index];
|
|
136
|
+
const next = csv[index + 1];
|
|
137
|
+
if (quoted) {
|
|
138
|
+
if (char === '"' && next === '"') {
|
|
139
|
+
cell += '"';
|
|
140
|
+
index += 1;
|
|
141
|
+
} else if (char === '"') {
|
|
142
|
+
quoted = false;
|
|
143
|
+
} else {
|
|
144
|
+
cell += char;
|
|
145
|
+
}
|
|
146
|
+
} else if (char === '"') {
|
|
147
|
+
quoted = true;
|
|
148
|
+
} else if (char === ',') {
|
|
149
|
+
row.push(cell);
|
|
150
|
+
cell = '';
|
|
151
|
+
} else if (char === '\n') {
|
|
152
|
+
row.push(cell);
|
|
153
|
+
rows.push(row);
|
|
154
|
+
row = [];
|
|
155
|
+
cell = '';
|
|
156
|
+
} else if (char !== '\r') {
|
|
157
|
+
cell += char;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (cell || row.length) {
|
|
161
|
+
row.push(cell);
|
|
162
|
+
rows.push(row);
|
|
163
|
+
}
|
|
164
|
+
return rows;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function tableToObjects(table) {
|
|
168
|
+
const rows = csvToRows(readFileSync(table.path, 'utf8'));
|
|
169
|
+
const headers = rows[0] || [];
|
|
170
|
+
return rows.slice(1)
|
|
171
|
+
.filter((row) => row.some(Boolean))
|
|
172
|
+
.map((row) => Object.fromEntries(headers.map((header, index) => [header, row[index] || ''])));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function field(name, type = 'multilineText', options = undefined) {
|
|
176
|
+
return options ? { name, type, options } : { name, type };
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const NUMBER_FIELDS = new Set([
|
|
180
|
+
'sort_order',
|
|
181
|
+
'blockers',
|
|
182
|
+
'attempts',
|
|
183
|
+
'event_count',
|
|
184
|
+
'task_count',
|
|
185
|
+
'session_count',
|
|
186
|
+
'sentinel_findings',
|
|
187
|
+
'publish_outbox_count',
|
|
188
|
+
'replay_attempts',
|
|
189
|
+
'nodes',
|
|
190
|
+
'edges',
|
|
191
|
+
'active_gates',
|
|
192
|
+
'sentinel_high',
|
|
193
|
+
'priority_rank',
|
|
194
|
+
'queue_depth',
|
|
195
|
+
'queue_oldest_age_minutes',
|
|
196
|
+
'invalid_line_count',
|
|
197
|
+
'run_count',
|
|
198
|
+
'consumed',
|
|
199
|
+
'drained',
|
|
200
|
+
'remaining',
|
|
201
|
+
]);
|
|
202
|
+
|
|
203
|
+
const CHECKBOX_FIELDS = new Set([
|
|
204
|
+
'correction_required',
|
|
205
|
+
'last_sync_ok',
|
|
206
|
+
'sync_ok',
|
|
207
|
+
]);
|
|
208
|
+
|
|
209
|
+
const SINGLE_LINE_FIELDS = new Set([
|
|
210
|
+
'record_key',
|
|
211
|
+
'section',
|
|
212
|
+
'title',
|
|
213
|
+
'status',
|
|
214
|
+
'metric',
|
|
215
|
+
'source_table',
|
|
216
|
+
'updated_at',
|
|
217
|
+
'task_id',
|
|
218
|
+
'phase_id',
|
|
219
|
+
'receipt_type',
|
|
220
|
+
'event_type',
|
|
221
|
+
'project_id',
|
|
222
|
+
'event_id',
|
|
223
|
+
'action_id',
|
|
224
|
+
'surface',
|
|
225
|
+
'lifecycle_phase',
|
|
226
|
+
'latest_event_id',
|
|
227
|
+
'latest_surface',
|
|
228
|
+
'latest_phase',
|
|
229
|
+
'latest_status',
|
|
230
|
+
'latest_created_at',
|
|
231
|
+
'latest_atlas_status',
|
|
232
|
+
'latest_atlas_target',
|
|
233
|
+
'at',
|
|
234
|
+
'last_replay_at',
|
|
235
|
+
'source',
|
|
236
|
+
'snapshot_id',
|
|
237
|
+
'target',
|
|
238
|
+
'hash',
|
|
239
|
+
'source_sha256',
|
|
240
|
+
'lane',
|
|
241
|
+
'priority',
|
|
242
|
+
'owner',
|
|
243
|
+
'owner_label',
|
|
244
|
+
'card_title',
|
|
245
|
+
'readable_status',
|
|
246
|
+
'status_group',
|
|
247
|
+
'source_kind',
|
|
248
|
+
'source_id',
|
|
249
|
+
'deferred_id',
|
|
250
|
+
'target_surface',
|
|
251
|
+
'created_at',
|
|
252
|
+
'due',
|
|
253
|
+
'backfill_scope',
|
|
254
|
+
'sync_status',
|
|
255
|
+
'last_sync_at',
|
|
256
|
+
'last_drain_at',
|
|
257
|
+
'queue_oldest_at',
|
|
258
|
+
'drain_last_status',
|
|
259
|
+
]);
|
|
260
|
+
|
|
261
|
+
function fieldTypeFor(name) {
|
|
262
|
+
if (NUMBER_FIELDS.has(name)) return 'number';
|
|
263
|
+
if (CHECKBOX_FIELDS.has(name)) return 'checkbox';
|
|
264
|
+
if (SINGLE_LINE_FIELDS.has(name)) return 'singleLineText';
|
|
265
|
+
return 'multilineText';
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function fieldForHeader(name) {
|
|
269
|
+
const type = fieldTypeFor(name);
|
|
270
|
+
if (type === 'number') return field(name, type, { precision: 0 });
|
|
271
|
+
if (type === 'checkbox') return field(name, type, { icon: 'check', color: 'greenBright' });
|
|
272
|
+
return field(name, type);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function fieldDefsForTable(tableName, headers = []) {
|
|
276
|
+
if (tableName === 'Dashboard') {
|
|
277
|
+
return [
|
|
278
|
+
field('record_key', 'singleLineText'),
|
|
279
|
+
field('sort_order', 'number', { precision: 0 }),
|
|
280
|
+
field('section', 'singleLineText'),
|
|
281
|
+
field('title', 'singleLineText'),
|
|
282
|
+
field('status', 'singleLineText'),
|
|
283
|
+
field('metric', 'singleLineText'),
|
|
284
|
+
field('summary'),
|
|
285
|
+
field('next_action'),
|
|
286
|
+
field('evidence'),
|
|
287
|
+
field('source_table', 'singleLineText'),
|
|
288
|
+
field('updated_at', 'singleLineText'),
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
if (tableName === 'OwnerBoard') {
|
|
292
|
+
return [
|
|
293
|
+
field('record_key', 'singleLineText'),
|
|
294
|
+
field('priority_rank', 'number', { precision: 0 }),
|
|
295
|
+
field('lane', 'singleLineText'),
|
|
296
|
+
field('priority', 'singleLineText'),
|
|
297
|
+
field('owner', 'singleLineText'),
|
|
298
|
+
field('owner_label', 'singleLineText'),
|
|
299
|
+
field('card_title', 'singleLineText'),
|
|
300
|
+
field('readable_status', 'singleLineText'),
|
|
301
|
+
field('status_group', 'singleLineText'),
|
|
302
|
+
field('metric', 'singleLineText'),
|
|
303
|
+
field('summary'),
|
|
304
|
+
field('why_it_matters'),
|
|
305
|
+
field('next_action'),
|
|
306
|
+
field('evidence'),
|
|
307
|
+
field('source_table', 'singleLineText'),
|
|
308
|
+
field('source_kind', 'singleLineText'),
|
|
309
|
+
field('source_id', 'singleLineText'),
|
|
310
|
+
field('updated_at', 'singleLineText'),
|
|
311
|
+
];
|
|
312
|
+
}
|
|
313
|
+
if (tableName === 'DeferredLedger') {
|
|
314
|
+
return [
|
|
315
|
+
field('record_key', 'singleLineText'),
|
|
316
|
+
field('deferred_id', 'singleLineText'),
|
|
317
|
+
field('priority_rank', 'number', { precision: 0 }),
|
|
318
|
+
field('priority', 'singleLineText'),
|
|
319
|
+
field('owner', 'singleLineText'),
|
|
320
|
+
field('target_surface', 'singleLineText'),
|
|
321
|
+
field('card_title', 'singleLineText'),
|
|
322
|
+
field('readable_status', 'singleLineText'),
|
|
323
|
+
field('summary'),
|
|
324
|
+
field('why_it_matters'),
|
|
325
|
+
field('next_action'),
|
|
326
|
+
field('evidence'),
|
|
327
|
+
field('created_at', 'singleLineText'),
|
|
328
|
+
field('due', 'singleLineText'),
|
|
329
|
+
field('backfill_scope', 'singleLineText'),
|
|
330
|
+
field('updated_at', 'singleLineText'),
|
|
331
|
+
];
|
|
332
|
+
}
|
|
333
|
+
if (tableName === 'OwnerAirtableSync') {
|
|
334
|
+
return [
|
|
335
|
+
field('record_key', 'singleLineText'),
|
|
336
|
+
field('section', 'singleLineText'),
|
|
337
|
+
field('card_title', 'singleLineText'),
|
|
338
|
+
field('sync_status', 'singleLineText'),
|
|
339
|
+
field('last_sync_at', 'singleLineText'),
|
|
340
|
+
field('last_sync_ok', 'checkbox', { icon: 'check', color: 'greenBright' }),
|
|
341
|
+
field('last_sync_error'),
|
|
342
|
+
field('queue_depth', 'number', { precision: 0 }),
|
|
343
|
+
field('queue_oldest_at', 'singleLineText'),
|
|
344
|
+
field('queue_oldest_age_minutes', 'number', { precision: 0 }),
|
|
345
|
+
field('invalid_line_count', 'number', { precision: 0 }),
|
|
346
|
+
field('drain_last_status', 'singleLineText'),
|
|
347
|
+
field('last_drain_at', 'singleLineText'),
|
|
348
|
+
field('run_count', 'number', { precision: 0 }),
|
|
349
|
+
field('summary'),
|
|
350
|
+
field('next_owner_action'),
|
|
351
|
+
field('evidence'),
|
|
352
|
+
field('updated_at', 'singleLineText'),
|
|
353
|
+
];
|
|
354
|
+
}
|
|
355
|
+
if (tableName === 'AtlasContext') {
|
|
356
|
+
return [
|
|
357
|
+
field('record_key', 'singleLineText'),
|
|
358
|
+
field('source', 'singleLineText'),
|
|
359
|
+
field('status', 'singleLineText'),
|
|
360
|
+
field('snapshot_id', 'singleLineText'),
|
|
361
|
+
field('target', 'singleLineText'),
|
|
362
|
+
field('nodes', 'number', { precision: 0 }),
|
|
363
|
+
field('edges', 'number', { precision: 0 }),
|
|
364
|
+
field('active_gates', 'number', { precision: 0 }),
|
|
365
|
+
field('sentinel_high', 'number', { precision: 0 }),
|
|
366
|
+
field('summary'),
|
|
367
|
+
field('updated_at', 'singleLineText'),
|
|
368
|
+
];
|
|
369
|
+
}
|
|
370
|
+
return [
|
|
371
|
+
field('record_key', 'singleLineText'),
|
|
372
|
+
...headers.filter((header) => header && header !== 'record_key').map((header) => fieldForHeader(header)),
|
|
373
|
+
];
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
async function getMeta({ token, baseId, apiFetch }) {
|
|
377
|
+
return airtableRequest({ token, apiFetch, path: `/v0/meta/bases/${baseId}/tables` });
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
async function ensureTables({ token, baseId, tablePlans, apiFetch, dryRun = false }) {
|
|
381
|
+
const meta = await getMeta({ token, baseId, apiFetch });
|
|
382
|
+
const existing = new Map((meta.tables || []).map((table) => [table.name, table]));
|
|
383
|
+
const results = [];
|
|
384
|
+
for (const plan of tablePlans) {
|
|
385
|
+
const current = existing.get(plan.name);
|
|
386
|
+
if (!current) {
|
|
387
|
+
if (!dryRun) {
|
|
388
|
+
const created = await airtableRequest({
|
|
389
|
+
token,
|
|
390
|
+
apiFetch,
|
|
391
|
+
method: 'POST',
|
|
392
|
+
path: `/v0/meta/bases/${baseId}/tables`,
|
|
393
|
+
body: {
|
|
394
|
+
name: plan.name,
|
|
395
|
+
description: plan.description || 'Aria owner runtime ledger sync table',
|
|
396
|
+
fields: plan.fields,
|
|
397
|
+
},
|
|
398
|
+
});
|
|
399
|
+
existing.set(plan.name, created);
|
|
400
|
+
results.push({ table: plan.name, action: 'created', fieldCount: plan.fields.length });
|
|
401
|
+
} else {
|
|
402
|
+
results.push({ table: plan.name, action: 'would_create', fieldCount: plan.fields.length });
|
|
403
|
+
}
|
|
404
|
+
continue;
|
|
405
|
+
}
|
|
406
|
+
const fields = new Set((current.fields || []).map((entry) => entry.name));
|
|
407
|
+
const missing = plan.fields.filter((entry) => !fields.has(entry.name));
|
|
408
|
+
for (const missingField of missing) {
|
|
409
|
+
if (!dryRun) {
|
|
410
|
+
await airtableRequest({
|
|
411
|
+
token,
|
|
412
|
+
apiFetch,
|
|
413
|
+
method: 'POST',
|
|
414
|
+
path: `/v0/meta/bases/${baseId}/tables/${current.id}/fields`,
|
|
415
|
+
body: missingField,
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
results.push({ table: plan.name, action: missing.length ? (dryRun ? 'would_add_fields' : 'added_fields') : 'exists', missingFields: missing.map((entry) => entry.name) });
|
|
420
|
+
}
|
|
421
|
+
return results;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function recordKey(tableName, row, index) {
|
|
425
|
+
const get = (key) => row[key] || '';
|
|
426
|
+
if (tableName === 'Overview') return `overview:${get('task_id') || 'latest'}`;
|
|
427
|
+
if (tableName === 'Phases') return `phase:${get('task_id')}:${get('phase_id') || index}`;
|
|
428
|
+
if (tableName === 'Events') return `event:${get('task_id')}:${get('phase_id')}:${get('at')}:${get('event_type')}:${index}`;
|
|
429
|
+
if (tableName === 'Receipts') return `receipt:${get('task_id')}:${get('receipt_type')}:${get('at') || index}`;
|
|
430
|
+
if (tableName === 'Blockers') return `blocker:${get('task_id')}:${get('phase_id')}:${get('blocker')}:${index}`;
|
|
431
|
+
if (tableName === 'ActionLedger') return `action-ledger:${get('project_id')}`;
|
|
432
|
+
if (tableName === 'ActionLedgerPublishQueue') return `publish-queue:${get('project_id')}:${get('event_id') || index}`;
|
|
433
|
+
if (tableName === 'Dashboard') return `dashboard:${get('section')}:${get('title')}`;
|
|
434
|
+
if (tableName === 'OwnerBoard') return `owner-board:${get('source_table')}:${get('source_id') || get('card_title') || index}`;
|
|
435
|
+
if (tableName === 'DeferredLedger') return `deferred:${get('deferred_id') || get('card_title') || index}`;
|
|
436
|
+
if (tableName === 'OwnerAirtableSync') return `owner-sync:${get('section')}:${get('card_title') || index}`;
|
|
437
|
+
if (tableName === 'AtlasContext') return `atlas:${get('source')}:${get('target') || get('snapshot_id') || index}`;
|
|
438
|
+
return `${tableName}:${index}`;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function coerceValueForField(fieldName, value) {
|
|
442
|
+
if (value === null || value === undefined) return '';
|
|
443
|
+
if (NUMBER_FIELDS.has(fieldName)) {
|
|
444
|
+
if (value === '') return undefined;
|
|
445
|
+
const number = Number(value);
|
|
446
|
+
return Number.isFinite(number) ? number : undefined;
|
|
447
|
+
}
|
|
448
|
+
if (CHECKBOX_FIELDS.has(fieldName)) {
|
|
449
|
+
if (value === '' || value === 'false' || value === false || value === '0') return false;
|
|
450
|
+
return Boolean(value);
|
|
451
|
+
}
|
|
452
|
+
if (typeof value !== 'string') return JSON.stringify(value);
|
|
453
|
+
return value.slice(0, 95000);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function rowsForTable(tableName, rows) {
|
|
457
|
+
return rows.map((row, index) => ({
|
|
458
|
+
fields: Object.fromEntries(
|
|
459
|
+
Object.entries({
|
|
460
|
+
record_key: recordKey(tableName, row, index),
|
|
461
|
+
...row,
|
|
462
|
+
})
|
|
463
|
+
.map(([key, value]) => [key, coerceValueForField(key, value)])
|
|
464
|
+
.filter(([, value]) => value !== undefined),
|
|
465
|
+
),
|
|
466
|
+
}));
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function numberFrom(value) {
|
|
470
|
+
const n = Number(value);
|
|
471
|
+
return Number.isFinite(n) ? n : 0;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
function firstNonEmpty(...values) {
|
|
475
|
+
for (const value of values) {
|
|
476
|
+
if (value !== null && value !== undefined && String(value).trim()) return String(value).trim();
|
|
477
|
+
}
|
|
478
|
+
return '';
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function readJsonFile(path) {
|
|
482
|
+
try {
|
|
483
|
+
if (!existsSync(path)) return null;
|
|
484
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
485
|
+
} catch (error) {
|
|
486
|
+
return { ok: false, parse_error: error.message, path };
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function readJsonlFile(path) {
|
|
491
|
+
if (!existsSync(path)) return { path, lines: [], entries: [], invalid: [] };
|
|
492
|
+
const lines = readFileSync(path, 'utf8').split(/\r?\n/).filter(Boolean);
|
|
493
|
+
const entries = [];
|
|
494
|
+
const invalid = [];
|
|
495
|
+
for (const line of lines) {
|
|
496
|
+
try {
|
|
497
|
+
entries.push(JSON.parse(line));
|
|
498
|
+
} catch {
|
|
499
|
+
invalid.push(line.slice(0, 500));
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return { path, lines, entries, invalid };
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
function minutesSince(value, nowMs = Date.now()) {
|
|
506
|
+
if (!value) return 0;
|
|
507
|
+
const time = Date.parse(value);
|
|
508
|
+
if (!Number.isFinite(time)) return 0;
|
|
509
|
+
return Math.max(0, Math.round((nowMs - time) / 60000));
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
function priorityRank(priority) {
|
|
513
|
+
const normalized = String(priority || '').toLowerCase();
|
|
514
|
+
if (normalized.includes('p0') || normalized.includes('critical')) return 0;
|
|
515
|
+
if (normalized.includes('p1') || normalized.includes('high')) return 1;
|
|
516
|
+
if (normalized.includes('p2') || normalized.includes('medium')) return 2;
|
|
517
|
+
if (normalized.includes('p3') || normalized.includes('low')) return 3;
|
|
518
|
+
return 4;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function statusGroup(status) {
|
|
522
|
+
const normalized = String(status || '').toLowerCase();
|
|
523
|
+
if (/(blocked|failed|needs|queued)/.test(normalized)) return 'needs-action';
|
|
524
|
+
if (/(verified|completed|clear|healthy|visible|synced)/.test(normalized)) return 'verified';
|
|
525
|
+
if (/(active|running|repaired)/.test(normalized)) return 'in-progress';
|
|
526
|
+
if (/(deferred|planned|pending)/.test(normalized)) return 'deferred';
|
|
527
|
+
return 'watch';
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
function ownerBoardRow({
|
|
531
|
+
priority = 'P2',
|
|
532
|
+
lane,
|
|
533
|
+
owner = 'Aria',
|
|
534
|
+
cardTitle,
|
|
535
|
+
readableStatus,
|
|
536
|
+
metric = '',
|
|
537
|
+
summary = '',
|
|
538
|
+
whyItMatters = '',
|
|
539
|
+
nextAction = '',
|
|
540
|
+
evidence = '',
|
|
541
|
+
sourceTable,
|
|
542
|
+
sourceKind,
|
|
543
|
+
sourceId,
|
|
544
|
+
updatedAt,
|
|
545
|
+
}) {
|
|
546
|
+
const status = readableStatus || 'watch';
|
|
547
|
+
return {
|
|
548
|
+
priority_rank: priorityRank(priority),
|
|
549
|
+
lane,
|
|
550
|
+
priority,
|
|
551
|
+
owner,
|
|
552
|
+
owner_label: `${priority} - ${lane} - ${status}`,
|
|
553
|
+
card_title: cardTitle,
|
|
554
|
+
readable_status: status,
|
|
555
|
+
status_group: statusGroup(status),
|
|
556
|
+
metric,
|
|
557
|
+
summary,
|
|
558
|
+
why_it_matters: whyItMatters,
|
|
559
|
+
next_action: nextAction,
|
|
560
|
+
evidence,
|
|
561
|
+
source_table: sourceTable,
|
|
562
|
+
source_kind: sourceKind,
|
|
563
|
+
source_id: sourceId,
|
|
564
|
+
updated_at: updatedAt,
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function buildDeferredLedgerRows({ generatedAt }) {
|
|
569
|
+
return [
|
|
570
|
+
{
|
|
571
|
+
deferred_id: 'atlas-github-mirror-owner',
|
|
572
|
+
priority_rank: 1,
|
|
573
|
+
priority: 'P1',
|
|
574
|
+
owner: 'Atlas',
|
|
575
|
+
target_surface: 'atlas-runtime-github-mirror',
|
|
576
|
+
card_title: 'Make Atlas own mirroring its runtime repo to GitHub',
|
|
577
|
+
readable_status: 'deferred',
|
|
578
|
+
summary: 'Atlas runtime changes currently live under ~/.aria/atlas with no remote configured, so fixes are local-only until an explicit mirror/publish path exists.',
|
|
579
|
+
why_it_matters: 'Atlas is the source of codebase substrate. If Atlas cannot mirror itself with evidence and secret-safe excludes, the substrate layer can drift from the repo-of-record.',
|
|
580
|
+
next_action: 'Add Atlas-owned mirror command plus QA: detect remote, redact secrets/build artifacts, commit only owned runtime changes, push to GitHub, and report mirror evidence into this ledger.',
|
|
581
|
+
evidence: '~/.aria/atlas has no remote configured; owner requested Atlas should be in charge of mirroring to GitHub.',
|
|
582
|
+
created_at: generatedAt,
|
|
583
|
+
due: 'deferred',
|
|
584
|
+
backfill_scope: 'future-atlas-runtime-mirroring',
|
|
585
|
+
updated_at: generatedAt,
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
deferred_id: 'action-ledger-publish-replay-controls',
|
|
589
|
+
priority_rank: 0,
|
|
590
|
+
priority: 'P0',
|
|
591
|
+
owner: 'Aria Runtime',
|
|
592
|
+
target_surface: 'action-ledger-hive-runtime-replay',
|
|
593
|
+
card_title: 'Build action-ledger publish replay controls and owner-visible status',
|
|
594
|
+
readable_status: 'open',
|
|
595
|
+
summary: 'ActionLedgerPublishQueue rows are visible in Airtable, but queued Hive/runtime publish failures are not yet owner-replayable or monitored end to end from the owner board.',
|
|
596
|
+
why_it_matters: 'The ledger is only first-class if a future session can drain queued runtime events, see expected vs observed publish results, and know whether Hive/runtime actually received the state.',
|
|
597
|
+
next_action: 'Implement owner-visible replay controls/status for ActionLedgerPublishQueue: run replayActionLedgerPublishOutbox by project id, persist replay attempts/results, update Airtable queue rows after replay, expose success/failure counts on OwnerBoard, and add QA proving queue count changes after a real or fake publish replay.',
|
|
598
|
+
evidence: 'Live Airtable readback after owner board work showed ActionLedgerPublishQueue=13; next first-class item named by owner session was replay plus monitoring so queued events are not just stored locally.',
|
|
599
|
+
created_at: generatedAt,
|
|
600
|
+
due: 'open',
|
|
601
|
+
backfill_scope: 'action-ledger-runtime-publish-replay',
|
|
602
|
+
updated_at: generatedAt,
|
|
603
|
+
},
|
|
604
|
+
];
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function buildOwnerBoardRows({ manifest, tableRows, atlasRows, deferredRows }) {
|
|
608
|
+
const generatedAt = new Date().toISOString();
|
|
609
|
+
const overview = tableRows.Overview?.[0] || {};
|
|
610
|
+
const blockerRows = tableRows.Blockers || [];
|
|
611
|
+
const queueRows = tableRows.ActionLedgerPublishQueue || [];
|
|
612
|
+
const actionRows = tableRows.ActionLedger || [];
|
|
613
|
+
const eventRows = tableRows.Events || [];
|
|
614
|
+
const ownerSyncRows = tableRows.OwnerAirtableSync || [];
|
|
615
|
+
const atlasHealth = atlasRows.find((row) => row.source === 'atlas-daemon') || {};
|
|
616
|
+
const rows = [];
|
|
617
|
+
|
|
618
|
+
rows.push(ownerBoardRow({
|
|
619
|
+
priority: overview.status === 'active' ? 'P1' : 'P2',
|
|
620
|
+
lane: 'Now',
|
|
621
|
+
owner: 'Codex',
|
|
622
|
+
cardTitle: 'Current owner task',
|
|
623
|
+
readableStatus: overview.status || manifest.taskStatus || 'unknown',
|
|
624
|
+
metric: overview.current_phase || '',
|
|
625
|
+
summary: firstNonEmpty(overview.goal, 'No active task summary exported.'),
|
|
626
|
+
whyItMatters: 'This is the top-level owner-visible work item; it should be understandable without opening raw JSON or logs.',
|
|
627
|
+
nextAction: overview.next_action || 'Keep action ledger, QA, and owner board in sync.',
|
|
628
|
+
evidence: manifest.taskFile || 'Overview',
|
|
629
|
+
sourceTable: 'Overview',
|
|
630
|
+
sourceKind: 'current-task',
|
|
631
|
+
sourceId: overview.task_id || manifest.taskId || 'latest',
|
|
632
|
+
updatedAt: generatedAt,
|
|
633
|
+
}));
|
|
634
|
+
|
|
635
|
+
rows.push(ownerBoardRow({
|
|
636
|
+
priority: blockerRows.length ? 'P0' : 'P3',
|
|
637
|
+
lane: 'Quality',
|
|
638
|
+
owner: 'QA',
|
|
639
|
+
cardTitle: 'Open blockers',
|
|
640
|
+
readableStatus: blockerRows.length ? 'needs-action' : 'clear',
|
|
641
|
+
metric: `${blockerRows.length} blockers`,
|
|
642
|
+
summary: blockerRows.slice(0, 5).map((row) => row.blocker).filter(Boolean).join(' | ') || 'No exported blockers.',
|
|
643
|
+
whyItMatters: 'Blockers are the fastest way for the owner to see what prevents a true completion claim.',
|
|
644
|
+
nextAction: blockerRows[0]?.action || overview.next_action || '',
|
|
645
|
+
evidence: 'Blockers',
|
|
646
|
+
sourceTable: 'Blockers',
|
|
647
|
+
sourceKind: 'quality-blockers',
|
|
648
|
+
sourceId: 'open-blockers',
|
|
649
|
+
updatedAt: generatedAt,
|
|
650
|
+
}));
|
|
651
|
+
|
|
652
|
+
rows.push(ownerBoardRow({
|
|
653
|
+
priority: queueRows.length ? 'P1' : 'P3',
|
|
654
|
+
lane: 'Replay',
|
|
655
|
+
owner: 'Hive',
|
|
656
|
+
cardTitle: 'Hive publish queue',
|
|
657
|
+
readableStatus: queueRows.length ? 'queued' : 'clear',
|
|
658
|
+
metric: `${queueRows.length} queued`,
|
|
659
|
+
summary: queueRows.slice(0, 5).map((row) => `${row.project_id || 'project'}:${row.error || row.recovery || 'queued'}`).join(' | ') || 'No queued publish failures.',
|
|
660
|
+
whyItMatters: 'Queued events mean local evidence exists but Hive/runtime may not yet have received the latest state.',
|
|
661
|
+
nextAction: queueRows.length ? 'Run action-ledger replay for queued project ids, then drain owner Airtable sync.' : '',
|
|
662
|
+
evidence: 'ActionLedgerPublishQueue',
|
|
663
|
+
sourceTable: 'ActionLedgerPublishQueue',
|
|
664
|
+
sourceKind: 'publish-queue',
|
|
665
|
+
sourceId: 'publish-queue',
|
|
666
|
+
updatedAt: generatedAt,
|
|
667
|
+
}));
|
|
668
|
+
|
|
669
|
+
rows.push(ownerBoardRow({
|
|
670
|
+
priority: atlasHealth.status === 'healthy' ? 'P2' : 'P1',
|
|
671
|
+
lane: 'Atlas',
|
|
672
|
+
owner: 'Atlas',
|
|
673
|
+
cardTitle: 'Atlas substrate freshness',
|
|
674
|
+
readableStatus: atlasHealth.status || 'unavailable',
|
|
675
|
+
metric: atlasHealth.snapshot_id ? `snapshot ${atlasHealth.snapshot_id}` : '',
|
|
676
|
+
summary: atlasHealth.summary || 'Atlas health row unavailable.',
|
|
677
|
+
whyItMatters: 'Atlas is the substrate source for architecture and runtime context; stale Atlas data weakens worker QA and future mirroring.',
|
|
678
|
+
nextAction: atlasHealth.status === 'healthy' ? 'Keep Atlas cache and owner sync timer healthy.' : 'Repair Atlas before relying on fresh dossiers.',
|
|
679
|
+
evidence: 'AtlasContext',
|
|
680
|
+
sourceTable: 'AtlasContext',
|
|
681
|
+
sourceKind: 'atlas-health',
|
|
682
|
+
sourceId: 'atlas-daemon',
|
|
683
|
+
updatedAt: generatedAt,
|
|
684
|
+
}));
|
|
685
|
+
|
|
686
|
+
for (const row of actionRows.slice(0, 25)) {
|
|
687
|
+
rows.push(ownerBoardRow({
|
|
688
|
+
priority: statusGroup(row.latest_status) === 'needs-action' ? 'P1' : 'P2',
|
|
689
|
+
lane: 'Projects',
|
|
690
|
+
owner: row.latest_surface || 'Aria',
|
|
691
|
+
cardTitle: `Project ${row.project_id || 'unknown'}`,
|
|
692
|
+
readableStatus: row.latest_status || 'unknown',
|
|
693
|
+
metric: `${row.event_count || 0} events`,
|
|
694
|
+
summary: `Latest phase ${row.latest_phase || 'unknown'} via ${row.latest_surface || 'unknown surface'}.`,
|
|
695
|
+
whyItMatters: 'Backfilled project rows make historical action-ledger state visible as cards instead of raw tables.',
|
|
696
|
+
nextAction: row.publish_outbox_count && row.publish_outbox_count !== '0' ? 'Replay queued runtime publish events.' : '',
|
|
697
|
+
evidence: 'ActionLedger',
|
|
698
|
+
sourceTable: 'ActionLedger',
|
|
699
|
+
sourceKind: 'action-project-backfill',
|
|
700
|
+
sourceId: row.project_id || 'unknown',
|
|
701
|
+
updatedAt: row.latest_created_at || generatedAt,
|
|
702
|
+
}));
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
for (const row of eventRows.slice(-25).reverse()) {
|
|
706
|
+
rows.push(ownerBoardRow({
|
|
707
|
+
priority: statusGroup(row.status) === 'needs-action' ? 'P1' : 'P3',
|
|
708
|
+
lane: 'Recent Events',
|
|
709
|
+
owner: row.surface || 'Aria',
|
|
710
|
+
cardTitle: `${row.event_type || 'event'} · ${row.phase_id || row.task_id || 'runtime'}`,
|
|
711
|
+
readableStatus: row.status || 'observed',
|
|
712
|
+
metric: row.at || '',
|
|
713
|
+
summary: firstNonEmpty(row.summary, row.intent, `${row.event_type || 'event'} from ${row.surface || 'unknown surface'}`),
|
|
714
|
+
whyItMatters: 'Recent backfilled events let the owner inspect what changed without decoding event JSON.',
|
|
715
|
+
nextAction: row.action || '',
|
|
716
|
+
evidence: 'Events',
|
|
717
|
+
sourceTable: 'Events',
|
|
718
|
+
sourceKind: 'recent-event-backfill',
|
|
719
|
+
sourceId: `${row.task_id || 'task'}:${row.phase_id || 'phase'}:${row.at || row.event_type || 'event'}`,
|
|
720
|
+
updatedAt: row.at || generatedAt,
|
|
721
|
+
}));
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
for (const row of ownerSyncRows) {
|
|
725
|
+
rows.push(ownerBoardRow({
|
|
726
|
+
priority: statusGroup(row.sync_status || row.drain_last_status) === 'needs-action' ? 'P1' : 'P2',
|
|
727
|
+
lane: 'Owner Sync',
|
|
728
|
+
owner: 'Aria',
|
|
729
|
+
cardTitle: row.card_title,
|
|
730
|
+
readableStatus: row.sync_status || row.drain_last_status || 'watch',
|
|
731
|
+
metric: row.queue_depth ? `${row.queue_depth} queued` : '',
|
|
732
|
+
summary: row.summary,
|
|
733
|
+
whyItMatters: 'This is the owner-visible health surface for the Airtable mirror itself; sync failures must show up as records, not disappear into local logs.',
|
|
734
|
+
nextAction: row.next_owner_action,
|
|
735
|
+
evidence: row.evidence,
|
|
736
|
+
sourceTable: 'OwnerAirtableSync',
|
|
737
|
+
sourceKind: 'sync-control',
|
|
738
|
+
sourceId: row.card_title,
|
|
739
|
+
updatedAt: row.updated_at,
|
|
740
|
+
}));
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
for (const row of deferredRows) {
|
|
744
|
+
rows.push(ownerBoardRow({
|
|
745
|
+
priority: row.priority,
|
|
746
|
+
lane: 'Deferred',
|
|
747
|
+
owner: row.owner,
|
|
748
|
+
cardTitle: row.card_title,
|
|
749
|
+
readableStatus: row.readable_status,
|
|
750
|
+
metric: row.target_surface,
|
|
751
|
+
summary: row.summary,
|
|
752
|
+
whyItMatters: row.why_it_matters,
|
|
753
|
+
nextAction: row.next_action,
|
|
754
|
+
evidence: row.evidence,
|
|
755
|
+
sourceTable: 'DeferredLedger',
|
|
756
|
+
sourceKind: 'deferred-ledger',
|
|
757
|
+
sourceId: row.deferred_id,
|
|
758
|
+
updatedAt: row.updated_at,
|
|
759
|
+
}));
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
return rows;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
function buildOwnerAirtableSyncRows({ ownerAirtableDir, statePath, generatedAt }) {
|
|
766
|
+
const latestPath = resolve(statePath || join(ownerAirtableDir, 'latest.json'));
|
|
767
|
+
const drainLatestPath = join(ownerAirtableDir, 'drain-latest.json');
|
|
768
|
+
const historyPath = join(ownerAirtableDir, 'drain-run-history.jsonl');
|
|
769
|
+
const queuePath = join(ownerAirtableDir, 'sync-queue.jsonl');
|
|
770
|
+
const latest = readJsonFile(latestPath);
|
|
771
|
+
const drainLatest = readJsonFile(drainLatestPath);
|
|
772
|
+
const queue = readJsonlFile(queuePath);
|
|
773
|
+
const history = readJsonlFile(historyPath);
|
|
774
|
+
const nowMs = Date.parse(generatedAt) || Date.now();
|
|
775
|
+
const validQueueEntries = queue.entries.filter((entry) => entry?.schema === 'aria.owner_airtable_sync_needed.v1');
|
|
776
|
+
const oldestQueuedAt = validQueueEntries
|
|
777
|
+
.map((entry) => entry.at || entry.createdAt)
|
|
778
|
+
.filter(Boolean)
|
|
779
|
+
.sort()[0] || '';
|
|
780
|
+
const lastHistory = history.entries[history.entries.length - 1] || {};
|
|
781
|
+
const latestOk = latest?.ok === true;
|
|
782
|
+
const latestError = latest?.error || latest?.syncError || latest?.parse_error || '';
|
|
783
|
+
const drainStatus = drainLatest
|
|
784
|
+
? (drainLatest.skipped ? `skipped:${drainLatest.reason || 'unknown'}` : (drainLatest.ok ? 'success' : 'failed'))
|
|
785
|
+
: 'no-run-recorded';
|
|
786
|
+
|
|
787
|
+
return [
|
|
788
|
+
{
|
|
789
|
+
section: 'Control',
|
|
790
|
+
card_title: 'Owner Airtable sync',
|
|
791
|
+
sync_status: latest ? (latestOk ? 'synced' : 'failed') : 'no-prior-sync',
|
|
792
|
+
last_sync_at: latest?.generatedAt || latest?.at || '',
|
|
793
|
+
last_sync_ok: latestOk,
|
|
794
|
+
last_sync_error: latestError,
|
|
795
|
+
queue_depth: queue.lines.length,
|
|
796
|
+
queue_oldest_at: oldestQueuedAt,
|
|
797
|
+
queue_oldest_age_minutes: minutesSince(oldestQueuedAt, nowMs),
|
|
798
|
+
invalid_line_count: queue.invalid.length,
|
|
799
|
+
drain_last_status: drainStatus,
|
|
800
|
+
last_drain_at: drainLatest?.at || lastHistory?.at || '',
|
|
801
|
+
run_count: history.entries.length,
|
|
802
|
+
summary: latest ? `Last sync ${latestOk ? 'succeeded' : 'did not succeed'} for base ${latest.baseId || 'unknown'}; queue has ${queue.lines.length} lines.` : 'No previous owner Airtable sync state file was found.',
|
|
803
|
+
next_owner_action: latestOk ? 'Use OwnerBoard as the visual first stop; investigate this table only if sync status changes.' : 'Inspect OwnerAirtableSync error fields and drain-run-history, then rerun owner:airtable-drain.',
|
|
804
|
+
evidence: `${latestPath}; ${queuePath}; ${drainLatestPath}`,
|
|
805
|
+
updated_at: generatedAt,
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
section: 'Queue',
|
|
809
|
+
card_title: 'Owner sync queue backlog',
|
|
810
|
+
sync_status: queue.lines.length ? 'queued' : 'clear',
|
|
811
|
+
last_sync_at: latest?.generatedAt || latest?.at || '',
|
|
812
|
+
last_sync_ok: latestOk,
|
|
813
|
+
last_sync_error: latestError,
|
|
814
|
+
queue_depth: queue.lines.length,
|
|
815
|
+
queue_oldest_at: oldestQueuedAt,
|
|
816
|
+
queue_oldest_age_minutes: minutesSince(oldestQueuedAt, nowMs),
|
|
817
|
+
invalid_line_count: queue.invalid.length,
|
|
818
|
+
drain_last_status: drainStatus,
|
|
819
|
+
last_drain_at: drainLatest?.at || lastHistory?.at || '',
|
|
820
|
+
run_count: history.entries.length,
|
|
821
|
+
summary: queue.lines.length ? `${queue.lines.length} sync requests waiting; ${queue.invalid.length} invalid queue lines.` : 'No pending owner Airtable sync queue entries.',
|
|
822
|
+
next_owner_action: queue.lines.length ? 'Let the user timer drain the queue or run owner:airtable-drain manually.' : 'No queue action needed.',
|
|
823
|
+
evidence: queuePath,
|
|
824
|
+
updated_at: generatedAt,
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
section: 'Drain',
|
|
828
|
+
card_title: 'Owner sync drain runner',
|
|
829
|
+
sync_status: drainStatus,
|
|
830
|
+
last_sync_at: latest?.generatedAt || latest?.at || '',
|
|
831
|
+
last_sync_ok: latestOk,
|
|
832
|
+
last_sync_error: drainLatest?.syncError || latestError,
|
|
833
|
+
queue_depth: queue.lines.length,
|
|
834
|
+
queue_oldest_at: oldestQueuedAt,
|
|
835
|
+
queue_oldest_age_minutes: minutesSince(oldestQueuedAt, nowMs),
|
|
836
|
+
invalid_line_count: queue.invalid.length,
|
|
837
|
+
drain_last_status: drainStatus,
|
|
838
|
+
last_drain_at: drainLatest?.at || lastHistory?.at || '',
|
|
839
|
+
run_count: history.entries.length,
|
|
840
|
+
summary: drainLatest ? `Last drain consumed ${drainLatest.consumed || 0}, drained ${drainLatest.drained || 0}, remaining ${drainLatest.remaining || 0}.` : 'No drain state file was found.',
|
|
841
|
+
next_owner_action: drainLatest?.ok === false ? 'Fix the recorded syncError before trusting automatic Airtable freshness.' : 'Keep the systemd timer active and monitor failure rows here.',
|
|
842
|
+
evidence: `${drainLatestPath}; ${historyPath}`,
|
|
843
|
+
updated_at: generatedAt,
|
|
844
|
+
},
|
|
845
|
+
];
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
function buildDashboardRows({ manifest, tableRows, atlasRows, deferredRows }) {
|
|
849
|
+
const overview = tableRows.Overview?.[0] || {};
|
|
850
|
+
const actionLedgerRows = tableRows.ActionLedger || [];
|
|
851
|
+
const queueRows = tableRows.ActionLedgerPublishQueue || [];
|
|
852
|
+
const blockerRows = tableRows.Blockers || [];
|
|
853
|
+
const ownerSyncRows = tableRows.OwnerAirtableSync || [];
|
|
854
|
+
const ownerSync = ownerSyncRows.find((row) => row.section === 'Control') || {};
|
|
855
|
+
const ownerQueue = ownerSyncRows.find((row) => row.section === 'Queue') || {};
|
|
856
|
+
const drainSync = ownerSyncRows.find((row) => row.section === 'Drain') || {};
|
|
857
|
+
const deferred = deferredRows[0] || {};
|
|
858
|
+
const atlasHealth = atlasRows.find((row) => row.source === 'atlas-daemon') || {};
|
|
859
|
+
const generatedAt = new Date().toISOString();
|
|
860
|
+
return [
|
|
861
|
+
{
|
|
862
|
+
sort_order: 10,
|
|
863
|
+
section: 'Runtime',
|
|
864
|
+
title: 'Current task',
|
|
865
|
+
status: overview.status || manifest.taskStatus || 'unknown',
|
|
866
|
+
metric: overview.current_phase || '',
|
|
867
|
+
summary: overview.goal || '',
|
|
868
|
+
next_action: overview.next_action || '',
|
|
869
|
+
evidence: manifest.taskFile || '',
|
|
870
|
+
source_table: 'Overview',
|
|
871
|
+
updated_at: generatedAt,
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
sort_order: 20,
|
|
875
|
+
section: 'Quality',
|
|
876
|
+
title: 'Open blockers',
|
|
877
|
+
status: blockerRows.length ? 'needs-action' : 'clear',
|
|
878
|
+
metric: String(blockerRows.length),
|
|
879
|
+
summary: blockerRows.slice(0, 5).map((row) => row.blocker).filter(Boolean).join(' | '),
|
|
880
|
+
next_action: blockerRows[0]?.action || overview.next_action || '',
|
|
881
|
+
evidence: 'Blockers',
|
|
882
|
+
source_table: 'Blockers',
|
|
883
|
+
updated_at: generatedAt,
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
sort_order: 30,
|
|
887
|
+
section: 'Replay',
|
|
888
|
+
title: 'Publish queue',
|
|
889
|
+
status: queueRows.length ? 'queued' : 'empty',
|
|
890
|
+
metric: String(queueRows.length),
|
|
891
|
+
summary: queueRows.slice(0, 5).map((row) => `${row.surface || 'event'}:${row.error || row.recovery || 'queued'}`).join(' | '),
|
|
892
|
+
next_action: queueRows.length ? 'Run aria owner action-ledger-replay for queued project ids.' : '',
|
|
893
|
+
evidence: 'ActionLedgerPublishQueue',
|
|
894
|
+
source_table: 'ActionLedgerPublishQueue',
|
|
895
|
+
updated_at: generatedAt,
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
sort_order: 40,
|
|
899
|
+
section: 'Atlas',
|
|
900
|
+
title: 'Atlas substrate',
|
|
901
|
+
status: atlasHealth.status || (actionLedgerRows.some((row) => row.latest_atlas_status) ? 'ledger-observed' : 'unavailable'),
|
|
902
|
+
metric: atlasHealth.snapshot_id || '',
|
|
903
|
+
summary: atlasHealth.summary || actionLedgerRows.slice(0, 5).map((row) => `${row.project_id}:${row.latest_atlas_status || 'none'}`).join(' | '),
|
|
904
|
+
next_action: atlasHealth.status === 'unavailable' ? 'Check atlas-server health before relying on fresh dossiers.' : '',
|
|
905
|
+
evidence: 'AtlasContext',
|
|
906
|
+
source_table: 'AtlasContext',
|
|
907
|
+
updated_at: generatedAt,
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
sort_order: 50,
|
|
911
|
+
section: 'Coverage',
|
|
912
|
+
title: 'Action projects',
|
|
913
|
+
status: actionLedgerRows.length ? 'visible' : 'empty',
|
|
914
|
+
metric: String(actionLedgerRows.length),
|
|
915
|
+
summary: actionLedgerRows.slice(0, 5).map((row) => `${row.project_id}:${row.latest_status || 'unknown'}`).join(' | '),
|
|
916
|
+
next_action: '',
|
|
917
|
+
evidence: 'ActionLedger',
|
|
918
|
+
source_table: 'ActionLedger',
|
|
919
|
+
updated_at: generatedAt,
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
sort_order: 60,
|
|
923
|
+
section: 'Owner Sync',
|
|
924
|
+
title: 'Airtable sync control',
|
|
925
|
+
status: ownerSync.sync_status || 'unknown',
|
|
926
|
+
metric: ownerSync.last_sync_at || '',
|
|
927
|
+
summary: ownerSync.summary || '',
|
|
928
|
+
next_action: ownerSync.next_owner_action || '',
|
|
929
|
+
evidence: ownerSync.evidence || 'OwnerAirtableSync',
|
|
930
|
+
source_table: 'OwnerAirtableSync',
|
|
931
|
+
updated_at: generatedAt,
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
sort_order: 70,
|
|
935
|
+
section: 'Owner Sync',
|
|
936
|
+
title: 'Airtable queue backlog',
|
|
937
|
+
status: ownerQueue.sync_status || 'unknown',
|
|
938
|
+
metric: String(ownerQueue.queue_depth || 0),
|
|
939
|
+
summary: ownerQueue.summary || '',
|
|
940
|
+
next_action: ownerQueue.next_owner_action || '',
|
|
941
|
+
evidence: ownerQueue.evidence || 'OwnerAirtableSync',
|
|
942
|
+
source_table: 'OwnerAirtableSync',
|
|
943
|
+
updated_at: generatedAt,
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
sort_order: 80,
|
|
947
|
+
section: 'Deferred',
|
|
948
|
+
title: 'Atlas GitHub mirror',
|
|
949
|
+
status: deferred.readable_status || 'deferred',
|
|
950
|
+
metric: deferred.target_surface || '',
|
|
951
|
+
summary: deferred.summary || '',
|
|
952
|
+
next_action: deferred.next_action || '',
|
|
953
|
+
evidence: deferred.evidence || 'DeferredLedger',
|
|
954
|
+
source_table: 'DeferredLedger',
|
|
955
|
+
updated_at: generatedAt,
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
sort_order: 90,
|
|
959
|
+
section: 'Owner Sync',
|
|
960
|
+
title: 'Airtable drain runner',
|
|
961
|
+
status: drainSync.drain_last_status || drainSync.sync_status || 'unknown',
|
|
962
|
+
metric: drainSync.last_drain_at || '',
|
|
963
|
+
summary: drainSync.summary || '',
|
|
964
|
+
next_action: drainSync.next_owner_action || '',
|
|
965
|
+
evidence: drainSync.evidence || 'OwnerAirtableSync',
|
|
966
|
+
source_table: 'OwnerAirtableSync',
|
|
967
|
+
updated_at: generatedAt,
|
|
968
|
+
},
|
|
969
|
+
];
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
function atlasSocketGet(socketPath, route, timeoutMs = 1500) {
|
|
973
|
+
return new Promise((resolve) => {
|
|
974
|
+
if (!existsSync(socketPath)) {
|
|
975
|
+
resolve({ ok: false, error: `atlas socket missing at ${socketPath}` });
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
const req = http.request({
|
|
979
|
+
socketPath,
|
|
980
|
+
path: route,
|
|
981
|
+
method: 'GET',
|
|
982
|
+
timeout: timeoutMs,
|
|
983
|
+
headers: { host: 'atlas' },
|
|
984
|
+
}, (res) => {
|
|
985
|
+
let body = '';
|
|
986
|
+
res.setEncoding('utf8');
|
|
987
|
+
res.on('data', (chunk) => { body += chunk; });
|
|
988
|
+
res.on('end', () => {
|
|
989
|
+
try {
|
|
990
|
+
resolve({ ok: res.statusCode >= 200 && res.statusCode < 300, statusCode: res.statusCode, body: body ? JSON.parse(body) : {} });
|
|
991
|
+
} catch {
|
|
992
|
+
resolve({ ok: false, statusCode: res.statusCode, error: body.slice(0, 500) });
|
|
993
|
+
}
|
|
994
|
+
});
|
|
995
|
+
});
|
|
996
|
+
req.on('timeout', () => req.destroy(new Error(`atlas timeout ${timeoutMs}ms`)));
|
|
997
|
+
req.on('error', (error) => resolve({ ok: false, error: error.message }));
|
|
998
|
+
req.end();
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
async function buildAtlasRows({ actionLedgerRows, atlasSocket }) {
|
|
1003
|
+
const rows = [];
|
|
1004
|
+
const health = await atlasSocketGet(atlasSocket, '/healthz');
|
|
1005
|
+
if (health.ok) {
|
|
1006
|
+
const snapshot = health.body?.last_successful_snapshot || health.body?.last_snapshot || {};
|
|
1007
|
+
rows.push({
|
|
1008
|
+
source: 'atlas-daemon',
|
|
1009
|
+
status: health.body?.ok === false ? 'unhealthy' : 'healthy',
|
|
1010
|
+
snapshot_id: snapshot.id || '',
|
|
1011
|
+
target: 'atlas-server',
|
|
1012
|
+
nodes: numberFrom(snapshot.node_count),
|
|
1013
|
+
edges: numberFrom(snapshot.edge_count),
|
|
1014
|
+
active_gates: 0,
|
|
1015
|
+
sentinel_high: 0,
|
|
1016
|
+
summary: `schema=${health.body?.schema_version || ''} snapshot_status=${snapshot.status || ''}`,
|
|
1017
|
+
updated_at: new Date().toISOString(),
|
|
1018
|
+
});
|
|
1019
|
+
} else {
|
|
1020
|
+
rows.push({
|
|
1021
|
+
source: 'atlas-daemon',
|
|
1022
|
+
status: 'unavailable',
|
|
1023
|
+
snapshot_id: '',
|
|
1024
|
+
target: 'atlas-server',
|
|
1025
|
+
nodes: 0,
|
|
1026
|
+
edges: 0,
|
|
1027
|
+
active_gates: 0,
|
|
1028
|
+
sentinel_high: 0,
|
|
1029
|
+
summary: health.error || `HTTP ${health.statusCode || 'unknown'}`,
|
|
1030
|
+
updated_at: new Date().toISOString(),
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
for (const row of actionLedgerRows) {
|
|
1034
|
+
if (!row.latest_atlas_status && !row.latest_atlas_target) continue;
|
|
1035
|
+
rows.push({
|
|
1036
|
+
source: 'action-ledger',
|
|
1037
|
+
status: row.latest_atlas_status || 'observed',
|
|
1038
|
+
snapshot_id: '',
|
|
1039
|
+
target: row.latest_atlas_target || row.project_id,
|
|
1040
|
+
nodes: 0,
|
|
1041
|
+
edges: 0,
|
|
1042
|
+
active_gates: 0,
|
|
1043
|
+
sentinel_high: numberFrom(row.sentinel_findings),
|
|
1044
|
+
summary: `project=${row.project_id} events=${row.event_count} latest=${row.latest_status}`,
|
|
1045
|
+
updated_at: row.latest_created_at || new Date().toISOString(),
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
return rows;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
async function upsertRecords({ token, baseId, tableName, records, apiFetch, dryRun = false }) {
|
|
1052
|
+
if (dryRun) return { table: tableName, rows: records.length, upserted: 0, dryRun: true };
|
|
1053
|
+
let upserted = 0;
|
|
1054
|
+
for (let index = 0; index < records.length; index += 10) {
|
|
1055
|
+
const batch = records.slice(index, index + 10);
|
|
1056
|
+
if (!batch.length) continue;
|
|
1057
|
+
const result = await airtableRequest({
|
|
1058
|
+
token,
|
|
1059
|
+
apiFetch,
|
|
1060
|
+
method: 'PATCH',
|
|
1061
|
+
path: `/v0/${baseId}/${encodeURIComponent(tableName)}`,
|
|
1062
|
+
body: {
|
|
1063
|
+
performUpsert: { fieldsToMergeOn: ['record_key'] },
|
|
1064
|
+
records: batch,
|
|
1065
|
+
typecast: true,
|
|
1066
|
+
},
|
|
1067
|
+
});
|
|
1068
|
+
upserted += (result.records || []).length;
|
|
1069
|
+
}
|
|
1070
|
+
return { table: tableName, rows: records.length, upserted };
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
export async function syncOwnerStatusAirtable(options = {}) {
|
|
1074
|
+
const auth = resolveAuth(options);
|
|
1075
|
+
const apiFetch = options.apiFetch || fetch;
|
|
1076
|
+
const manifest = exportOwnerGoogleSheetsCsv({
|
|
1077
|
+
taskId: options.taskId || null,
|
|
1078
|
+
taskDir: options.taskDir || undefined,
|
|
1079
|
+
runtimeStateDir: options.runtimeStateDir || undefined,
|
|
1080
|
+
actionLedgerDir: options.actionLedgerDir || undefined,
|
|
1081
|
+
outDir: options.outDir || undefined,
|
|
1082
|
+
});
|
|
1083
|
+
const tableRows = Object.fromEntries(manifest.tables.map((table) => [table.name, tableToObjects(table)]));
|
|
1084
|
+
const atlasRows = await buildAtlasRows({
|
|
1085
|
+
actionLedgerRows: tableRows.ActionLedger || [],
|
|
1086
|
+
atlasSocket: options.atlasSocket || DEFAULT_ATLAS_SOCKET,
|
|
1087
|
+
});
|
|
1088
|
+
const generatedAt = new Date().toISOString();
|
|
1089
|
+
const statePath = resolve(options.statePath || DEFAULT_STATE_PATH);
|
|
1090
|
+
const ownerAirtableDir = resolve(options.ownerAirtableDir || dirname(statePath));
|
|
1091
|
+
const deferredRows = buildDeferredLedgerRows({ generatedAt });
|
|
1092
|
+
tableRows.DeferredLedger = deferredRows;
|
|
1093
|
+
tableRows.AtlasContext = atlasRows;
|
|
1094
|
+
tableRows.OwnerAirtableSync = buildOwnerAirtableSyncRows({ ownerAirtableDir, statePath, generatedAt });
|
|
1095
|
+
tableRows.Dashboard = buildDashboardRows({ manifest, tableRows, atlasRows, deferredRows });
|
|
1096
|
+
tableRows.OwnerBoard = buildOwnerBoardRows({ manifest, tableRows, atlasRows, deferredRows });
|
|
1097
|
+
|
|
1098
|
+
const orderedNames = Array.from(new Set(['OwnerBoard', 'Dashboard', ...manifest.tables.map((table) => table.name), 'OwnerAirtableSync', 'DeferredLedger', 'AtlasContext']));
|
|
1099
|
+
const sourceTablesByName = Object.fromEntries(manifest.tables.map((table) => [table.name, table]));
|
|
1100
|
+
const tablePlans = orderedNames.map((name) => {
|
|
1101
|
+
const headers = sourceTablesByName[name]
|
|
1102
|
+
? (csvToRows(readFileSync(sourceTablesByName[name].path, 'utf8'))[0] || [])
|
|
1103
|
+
: Object.keys(tableRows[name]?.[0] || {});
|
|
1104
|
+
return { name, fields: fieldDefsForTable(name, headers) };
|
|
1105
|
+
});
|
|
1106
|
+
|
|
1107
|
+
const schemaResults = await ensureTables({
|
|
1108
|
+
token: auth.token,
|
|
1109
|
+
baseId: auth.baseId,
|
|
1110
|
+
tablePlans,
|
|
1111
|
+
apiFetch,
|
|
1112
|
+
dryRun: options.dryRun === true,
|
|
1113
|
+
});
|
|
1114
|
+
const syncResults = [];
|
|
1115
|
+
for (const name of orderedNames) {
|
|
1116
|
+
const records = rowsForTable(name, tableRows[name] || []);
|
|
1117
|
+
syncResults.push(await upsertRecords({
|
|
1118
|
+
token: auth.token,
|
|
1119
|
+
baseId: auth.baseId,
|
|
1120
|
+
tableName: name,
|
|
1121
|
+
records,
|
|
1122
|
+
apiFetch,
|
|
1123
|
+
dryRun: options.dryRun === true,
|
|
1124
|
+
}));
|
|
1125
|
+
}
|
|
1126
|
+
const result = {
|
|
1127
|
+
ok: true,
|
|
1128
|
+
schema: 'aria.owner_airtable_sync.v1',
|
|
1129
|
+
generatedAt,
|
|
1130
|
+
baseId: auth.baseId,
|
|
1131
|
+
baseUrl: `https://airtable.com/${auth.baseId}`,
|
|
1132
|
+
taskId: manifest.taskId,
|
|
1133
|
+
taskStatus: manifest.taskStatus,
|
|
1134
|
+
manifestPath: join(manifest.outDir, 'manifest.json'),
|
|
1135
|
+
outDir: manifest.outDir,
|
|
1136
|
+
dryRun: options.dryRun === true,
|
|
1137
|
+
schemaResults,
|
|
1138
|
+
syncResults,
|
|
1139
|
+
ownerBoardRows: tableRows.OwnerBoard.length,
|
|
1140
|
+
dashboardRows: tableRows.Dashboard.length,
|
|
1141
|
+
ownerSyncRows: tableRows.OwnerAirtableSync.length,
|
|
1142
|
+
deferredRows: tableRows.DeferredLedger.length,
|
|
1143
|
+
atlasRows: tableRows.AtlasContext.length,
|
|
1144
|
+
};
|
|
1145
|
+
mkdirSync(dirname(statePath), { recursive: true });
|
|
1146
|
+
writeFileSync(statePath, `${JSON.stringify(result, null, 2)}\n`, { mode: 0o600 });
|
|
1147
|
+
return result;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
1151
|
+
try {
|
|
1152
|
+
const result = await syncOwnerStatusAirtable(parseArgs());
|
|
1153
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1154
|
+
} catch (error) {
|
|
1155
|
+
console.error(error && error.message ? error.message : String(error));
|
|
1156
|
+
process.exit(1);
|
|
1157
|
+
}
|
|
1158
|
+
}
|