avorelo 0.3.8 → 0.4.0-rc.2
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/LICENSE +16 -23
- package/README.md +62 -72
- package/bin/avorelo +9 -0
- package/package.json +147 -139
- package/scripts/README.md +40 -0
- package/scripts/avorelo-session-collision-guard.js +540 -0
- package/scripts/avorelo-workstream-preflight.js +918 -0
- package/scripts/cco-dashboard.js +346 -0
- package/scripts/cco-posttooluse.js +504 -0
- package/scripts/cco-pretooluse.js +381 -0
- package/scripts/cco-status.js +540 -0
- package/scripts/cco-stop.js +77 -0
- package/scripts/cco-userprompt-submit.js +83 -0
- package/scripts/lib/activation/account-state.js +37 -0
- package/scripts/lib/activation/activate-command.js +114 -0
- package/scripts/lib/activation/activation-runner.js +607 -0
- package/scripts/lib/activation/activation-self-healing.js +481 -0
- package/scripts/lib/activation/activation-state.js +96 -0
- package/scripts/lib/activation/activation-summary.js +241 -0
- package/scripts/lib/activation/adapters/claude-code.js +77 -0
- package/scripts/lib/activation/adapters/codex-cli.js +52 -0
- package/scripts/lib/activation/adapters/cursor.js +37 -0
- package/scripts/lib/activation/adapters/github-agent.js +39 -0
- package/scripts/lib/activation/adapters/terminal.js +42 -0
- package/scripts/lib/activation/adapters/vscode.js +39 -0
- package/scripts/lib/activation/adapters/windsurf.js +37 -0
- package/scripts/lib/activation/ai-surface-detector.js +151 -0
- package/scripts/lib/activation/connect-account.js +145 -0
- package/scripts/lib/activation/detect-environment.js +75 -0
- package/scripts/lib/activation/detect-hosts.js +62 -0
- package/scripts/lib/activation/format-activation-output.js +109 -0
- package/scripts/lib/activation/next-action.js +43 -0
- package/scripts/lib/activation/repair-engine.js +219 -0
- package/scripts/lib/activation/run-entry.js +346 -0
- package/scripts/lib/activation-distribution-readiness.js +507 -0
- package/scripts/lib/adapter-conformance.js +176 -0
- package/scripts/lib/adapter-readiness.js +428 -0
- package/scripts/lib/adapter-safety-boundaries.js +335 -0
- package/scripts/lib/adapter-technical-readiness-gate.js +205 -0
- package/scripts/lib/agent-access-governance.js +455 -0
- package/scripts/lib/agent-activation-readiness.js +878 -0
- package/scripts/lib/agent-enforcement.js +765 -0
- package/scripts/lib/agent-evolution-loop.js +479 -0
- package/scripts/lib/agent-policy-profile.js +210 -0
- package/scripts/lib/agent-security/action-evaluator.js +507 -0
- package/scripts/lib/agent-security/adapter-registry.js +98 -0
- package/scripts/lib/agent-security/auto-policy.js +139 -0
- package/scripts/lib/agent-security/bounded-scan.js +93 -0
- package/scripts/lib/agent-security/enforcement-adapter.js +174 -0
- package/scripts/lib/agent-security/enforcement-engine.js +1129 -0
- package/scripts/lib/agent-security/file-write-adapter.js +183 -0
- package/scripts/lib/agent-security/file-write-rules.js +178 -0
- package/scripts/lib/agent-security/index.js +3342 -0
- package/scripts/lib/agent-security/instruction-risk.js +181 -0
- package/scripts/lib/agent-security/mcp-action-adapter.js +185 -0
- package/scripts/lib/agent-security/mcp-action-rules.js +184 -0
- package/scripts/lib/agent-security/package-action-adapter.js +175 -0
- package/scripts/lib/agent-security/package-action-rules.js +233 -0
- package/scripts/lib/agent-security/performance.js +148 -0
- package/scripts/lib/agent-security/permission-minimizer.js +403 -0
- package/scripts/lib/agent-security/scan-cache.js +74 -0
- package/scripts/lib/agent-security/source-trust.js +146 -0
- package/scripts/lib/ai-efficiency-dogfood-pack.js +437 -0
- package/scripts/lib/ai-efficiency-eval.js +207 -0
- package/scripts/lib/ai-efficiency-guard-contract.js +209 -0
- package/scripts/lib/ai-efficiency-measured-value.js +106 -0
- package/scripts/lib/ai-install-prompt.js +293 -0
- package/scripts/lib/ai-task-inference.js +155 -0
- package/scripts/lib/ai-value-ledger.js +121 -0
- package/scripts/lib/ai-value-proof-table.js +151 -0
- package/scripts/lib/ai-work-efficiency-routing.js +623 -0
- package/scripts/lib/ai-workspace-hygiene.js +1499 -0
- package/scripts/lib/alpha-activation.js +520 -0
- package/scripts/lib/alpha-feedback.js +263 -0
- package/scripts/lib/alpha-readiness-gate.js +332 -0
- package/scripts/lib/anti-gaming.js +169 -0
- package/scripts/lib/artifact-health.js +431 -0
- package/scripts/lib/artifact-receipt-hygiene.js +619 -0
- package/scripts/lib/attribution.js +180 -0
- package/scripts/lib/audit.js +289 -0
- package/scripts/lib/avorelo-skill-registry.js +810 -0
- package/scripts/lib/batch-jobs.js +71 -0
- package/scripts/lib/brain-pack.js +578 -0
- package/scripts/lib/brand-boundary.js +424 -0
- package/scripts/lib/brand.js +74 -0
- package/scripts/lib/browser-capability.js +1048 -0
- package/scripts/lib/browser-proof-governed-workflow.js +1020 -0
- package/scripts/lib/browser-proof-preflight.js +321 -0
- package/scripts/lib/cache-readiness.js +296 -0
- package/scripts/lib/canonical-reentry.js +162 -0
- package/scripts/lib/capability-contract-validator.js +177 -0
- package/scripts/lib/capability-hygiene.js +504 -0
- package/scripts/lib/capability-intake-quarantine.js +789 -0
- package/scripts/lib/capability-kernel-registry.js +566 -0
- package/scripts/lib/capability-kernel.js +202 -0
- package/scripts/lib/capability-manifest.js +255 -0
- package/scripts/lib/capability-outcome-normalizer.js +104 -0
- package/scripts/lib/capability-packs.js +314 -0
- package/scripts/lib/capability-recommender.js +513 -0
- package/scripts/lib/capability-registry.js +1062 -0
- package/scripts/lib/carry-forward-surfacing.js +194 -0
- package/scripts/lib/ccusage-adapter.js +188 -0
- package/scripts/lib/claude-session-evidence/index.js +1027 -0
- package/scripts/lib/cli-output-sanitizer.js +118 -0
- package/scripts/lib/company-loop.js +1149 -0
- package/scripts/lib/config.js +641 -0
- package/scripts/lib/context-acquisition-plan.js +359 -0
- package/scripts/lib/context-authority-rules.js +138 -0
- package/scripts/lib/context-budget-guard.js +170 -0
- package/scripts/lib/context-budget-scanner.js +257 -0
- package/scripts/lib/context-budget.js +167 -0
- package/scripts/lib/context-claim-safety.js +116 -0
- package/scripts/lib/context-compiler.js +236 -0
- package/scripts/lib/context-optimizer.js +715 -0
- package/scripts/lib/context-packet.js +121 -0
- package/scripts/lib/context-receipt.js +57 -0
- package/scripts/lib/context-reduction-plan.js +179 -0
- package/scripts/lib/context-safety.js +88 -0
- package/scripts/lib/context-savings-engine.js +158 -0
- package/scripts/lib/context-source-registry.js +393 -0
- package/scripts/lib/context-task-profiles.js +147 -0
- package/scripts/lib/cost-abuse-guard.js +975 -0
- package/scripts/lib/cost-evidence.js +287 -0
- package/scripts/lib/cost-to-outcome-signals.js +639 -0
- package/scripts/lib/cross-host-install-plan.js +308 -0
- package/scripts/lib/cross-host-install-readiness.js +242 -0
- package/scripts/lib/cross-host-value-flow.js +268 -0
- package/scripts/lib/dashboard.js +1056 -0
- package/scripts/lib/data-permissions-guard.js +1187 -0
- package/scripts/lib/deployment-environment-guard.js +1236 -0
- package/scripts/lib/design-partner-feedback.js +346 -0
- package/scripts/lib/dogfood-evidence-freshness.js +567 -0
- package/scripts/lib/efficiency-receipt.js +354 -0
- package/scripts/lib/entitlements.js +100 -0
- package/scripts/lib/execution-packet.js +559 -0
- package/scripts/lib/execution-route-governor.js +179 -0
- package/scripts/lib/experimentation-events.js +547 -0
- package/scripts/lib/external-capability-compliance.js +107 -0
- package/scripts/lib/external-readiness/ai-visibility/ai-visibility-runner.js +322 -0
- package/scripts/lib/external-readiness/calibration/benchmark-site-catalog.js +121 -0
- package/scripts/lib/external-readiness/calibration/completion-gate.js +112 -0
- package/scripts/lib/external-readiness/calibration/real-site-benchmark-runner.js +284 -0
- package/scripts/lib/external-readiness/drift-detector.js +100 -0
- package/scripts/lib/external-readiness/endpoint-prober.js +332 -0
- package/scripts/lib/external-readiness/external-readiness-runner.js +112 -0
- package/scripts/lib/external-readiness/full-agent-readiness-scorer.js +220 -0
- package/scripts/lib/external-readiness/golden-path-runner.js +333 -0
- package/scripts/lib/external-readiness/inside-out-runner.js +118 -0
- package/scripts/lib/external-readiness/proof-receipt-writer.js +112 -0
- package/scripts/lib/external-readiness/safe-fix-executor.js +117 -0
- package/scripts/lib/external-readiness/skills/category-boundary-guard.js +30 -0
- package/scripts/lib/external-readiness/skills/pmm-positioning-guard.js +69 -0
- package/scripts/lib/external-readiness/skills/safe-fix-policy.js +35 -0
- package/scripts/lib/external-user-simulation.js +166 -0
- package/scripts/lib/failure-recovery-readiness.js +81 -0
- package/scripts/lib/failure-recovery.js +419 -0
- package/scripts/lib/feedback-intelligence.js +537 -0
- package/scripts/lib/feedback-signals.js +205 -0
- package/scripts/lib/file-integrity.js +68 -0
- package/scripts/lib/fsx.js +129 -0
- package/scripts/lib/full-readiness-gate.js +451 -0
- package/scripts/lib/governed-action-exposure-primitives.js +1514 -0
- package/scripts/lib/governed-exposure-planner.js +186 -0
- package/scripts/lib/governed-workspace-hygiene.js +946 -0
- package/scripts/lib/guard-suite-common.js +412 -0
- package/scripts/lib/guidance-builder.js +174 -0
- package/scripts/lib/hook-apply.js +1075 -0
- package/scripts/lib/hook-baseline.js +310 -0
- package/scripts/lib/hook-config-preview.js +275 -0
- package/scripts/lib/hook-contracts.js +290 -0
- package/scripts/lib/hook-safety-boundary-readiness.js +80 -0
- package/scripts/lib/host-capability-matrix.js +351 -0
- package/scripts/lib/host-support-context.js +254 -0
- package/scripts/lib/http-hook-action.js +538 -0
- package/scripts/lib/install-ai-readiness.js +84 -0
- package/scripts/lib/install-intake-risk.js +1051 -0
- package/scripts/lib/install-journey-intelligence.js +329 -0
- package/scripts/lib/intervention-guidance.js +57 -0
- package/scripts/lib/known-limitations.js +115 -0
- package/scripts/lib/l8-path-truth.js +146 -0
- package/scripts/lib/launch-hardening-gate.js +436 -0
- package/scripts/lib/launch-readiness.js +635 -0
- package/scripts/lib/learning-experimentation-foundation.js +1484 -0
- package/scripts/lib/learning-memory.js +686 -0
- package/scripts/lib/lifecycle-hooks.js +982 -0
- package/scripts/lib/local-package-smoke.js +436 -0
- package/scripts/lib/local-pricing.js +299 -0
- package/scripts/lib/mcp-enforcement.js +311 -0
- package/scripts/lib/mcp-least-privilege-policy.js +303 -0
- package/scripts/lib/mcp-tool-inventory.js +388 -0
- package/scripts/lib/mcp-tool-risk.js +0 -0
- package/scripts/lib/memory.js +335 -0
- package/scripts/lib/metrics.js +699 -0
- package/scripts/lib/micro-proof.js +133 -0
- package/scripts/lib/model-work-class-routing.js +79 -0
- package/scripts/lib/next-run-context.js +436 -0
- package/scripts/lib/next-run-continuity.js +1207 -0
- package/scripts/lib/observability-recovery-guard.js +1030 -0
- package/scripts/lib/operating-value.js +1662 -0
- package/scripts/lib/optimization-v3.js +122 -0
- package/scripts/lib/orchestration/adapters/_shared.js +49 -0
- package/scripts/lib/orchestration/adapters/aider.js +18 -0
- package/scripts/lib/orchestration/adapters/claude-code.js +35 -0
- package/scripts/lib/orchestration/adapters/codex.js +35 -0
- package/scripts/lib/orchestration/adapters/gemini-cli.js +18 -0
- package/scripts/lib/orchestration/adapters/git.js +25 -0
- package/scripts/lib/orchestration/adapters/index.js +31 -0
- package/scripts/lib/orchestration/adapters/lm-studio.js +18 -0
- package/scripts/lib/orchestration/adapters/ollama.js +18 -0
- package/scripts/lib/orchestration/adapters/opencode.js +18 -0
- package/scripts/lib/orchestration/adapters/openrouter.js +18 -0
- package/scripts/lib/orchestration/adapters/test-runner.js +25 -0
- package/scripts/lib/orchestration/cli.js +438 -0
- package/scripts/lib/orchestration/execution-manager.js +279 -0
- package/scripts/lib/orchestration/handoff.js +314 -0
- package/scripts/lib/orchestration/index.js +456 -0
- package/scripts/lib/orchestration/inventory.js +47 -0
- package/scripts/lib/orchestration/model-discovery.js +498 -0
- package/scripts/lib/orchestration/model-profiler.js +170 -0
- package/scripts/lib/orchestration/model-profiles.js +252 -0
- package/scripts/lib/orchestration/model-refresh-policy.js +72 -0
- package/scripts/lib/orchestration/proof-writer.js +349 -0
- package/scripts/lib/orchestration/provider-discovery/aider.js +49 -0
- package/scripts/lib/orchestration/provider-discovery/claude-code.js +56 -0
- package/scripts/lib/orchestration/provider-discovery/codex.js +49 -0
- package/scripts/lib/orchestration/provider-discovery/common.js +186 -0
- package/scripts/lib/orchestration/provider-discovery/gemini.js +106 -0
- package/scripts/lib/orchestration/provider-discovery/lm-studio.js +118 -0
- package/scripts/lib/orchestration/provider-discovery/models-dev.js +12 -0
- package/scripts/lib/orchestration/provider-discovery/ollama.js +100 -0
- package/scripts/lib/orchestration/provider-discovery/opencode.js +47 -0
- package/scripts/lib/orchestration/provider-discovery/openrouter.js +44 -0
- package/scripts/lib/orchestration/risk-classifier.js +130 -0
- package/scripts/lib/orchestration/routing-policy.js +486 -0
- package/scripts/lib/orchestration/settings.js +95 -0
- package/scripts/lib/orchestration/state.js +165 -0
- package/scripts/lib/orchestration/verification-manager.js +138 -0
- package/scripts/lib/outcome-evidence-stack.js +1083 -0
- package/scripts/lib/output-profiles.js +146 -0
- package/scripts/lib/package-content-audit.js +368 -0
- package/scripts/lib/package-runtime.js +278 -0
- package/scripts/lib/plan-surface.js +53 -0
- package/scripts/lib/plans.js +2327 -0
- package/scripts/lib/policy-provider.js +27 -0
- package/scripts/lib/prelaunch-activation-readiness.js +409 -0
- package/scripts/lib/prelaunch-evidence-store.js +816 -0
- package/scripts/lib/prelaunch-intelligence.js +869 -0
- package/scripts/lib/pricing-experiment.js +118 -0
- package/scripts/lib/pro-moment-events.js +77 -0
- package/scripts/lib/pro-moment-state.js +227 -0
- package/scripts/lib/pro-moments.js +1216 -0
- package/scripts/lib/product-home-receipt.js +1790 -0
- package/scripts/lib/product-learning-events.js +696 -0
- package/scripts/lib/production-confidence-control-tower.js +1209 -0
- package/scripts/lib/production-confidence.js +1858 -0
- package/scripts/lib/project-profile.js +555 -0
- package/scripts/lib/prompt-compiler-plan.js +94 -0
- package/scripts/lib/prompt-compiler.js +280 -0
- package/scripts/lib/prompt-lint.js +32 -0
- package/scripts/lib/prompt-suggestions.js +52 -0
- package/scripts/lib/proof-canonical.js +398 -0
- package/scripts/lib/proof-drilldown.js +383 -0
- package/scripts/lib/proof-e2e/promise-completion.js +141 -0
- package/scripts/lib/proof-e2e/promise-dashboard-claims.js +135 -0
- package/scripts/lib/proof-e2e/promise-local-proof.js +156 -0
- package/scripts/lib/proof-e2e/promise-provider-neutral.js +136 -0
- package/scripts/lib/proof-e2e/promise-registry.js +219 -0
- package/scripts/lib/proof-e2e/promise-security-trust.js +141 -0
- package/scripts/lib/proof-e2e/promise-skills-risk.js +163 -0
- package/scripts/lib/proof-e2e/promise-token-savings.js +112 -0
- package/scripts/lib/proof-e2e/promise-work-management.js +126 -0
- package/scripts/lib/proof-events.js +342 -0
- package/scripts/lib/proof-history.js +243 -0
- package/scripts/lib/proof-metrics.js +296 -0
- package/scripts/lib/proof-outcome-evidence.js +134 -0
- package/scripts/lib/proof-receipt.js +335 -0
- package/scripts/lib/proof-record.js +461 -0
- package/scripts/lib/proof-savings-report.js +1549 -0
- package/scripts/lib/public-activation-distribution-gate.js +266 -0
- package/scripts/lib/public-cli.js +5631 -0
- package/scripts/lib/public-distribution-truth.js +211 -0
- package/scripts/lib/public-distribution.js +73 -0
- package/scripts/lib/public-install-claim-checker.js +300 -0
- package/scripts/lib/publish-provenance-readiness.js +287 -0
- package/scripts/lib/readiness-delta.js +218 -0
- package/scripts/lib/readiness-evidence-closure.js +196 -0
- package/scripts/lib/reentry-memory-capture.js +241 -0
- package/scripts/lib/reentry-memory-retrieval.js +302 -0
- package/scripts/lib/reentry-memory-status.js +147 -0
- package/scripts/lib/reentry-memory-store.js +183 -0
- package/scripts/lib/reentry-state.js +66 -0
- package/scripts/lib/release-candidate-bundle.js +166 -0
- package/scripts/lib/remediation.js +81 -0
- package/scripts/lib/repo-map.js +391 -0
- package/scripts/lib/run-action-policy.js +104 -0
- package/scripts/lib/run-contract-receipt.js +48 -0
- package/scripts/lib/run-contract.js +288 -0
- package/scripts/lib/run-cost-to-verified-outcome.js +87 -0
- package/scripts/lib/run-improvements-lifecycle.js +330 -0
- package/scripts/lib/run-improvements.js +789 -0
- package/scripts/lib/run-proof-contract.js +116 -0
- package/scripts/lib/run-risk-classifier.js +131 -0
- package/scripts/lib/run-task-classifier.js +216 -0
- package/scripts/lib/runtime-decision-policy.js +387 -0
- package/scripts/lib/safe-path-engine.js +705 -0
- package/scripts/lib/safe-repair.js +877 -0
- package/scripts/lib/safe-run-controller.js +887 -0
- package/scripts/lib/scope-repair-before-approval.js +865 -0
- package/scripts/lib/score.js +262 -0
- package/scripts/lib/seamless-enforcement.js +329 -0
- package/scripts/lib/seamless-outcome.js +689 -0
- package/scripts/lib/seamless-reality-gate.js +5053 -0
- package/scripts/lib/security-confidence/activation-safety.js +78 -0
- package/scripts/lib/security-confidence/adapters/adapter-contract.js +125 -0
- package/scripts/lib/security-confidence/adapters/mock-claude-bughunter-adapter.js +36 -0
- package/scripts/lib/security-confidence/adapters/mock-decepticon-adapter.js +34 -0
- package/scripts/lib/security-confidence/adapters/mock-mcp-scan-adapter.js +35 -0
- package/scripts/lib/security-confidence/adapters/mock-snyk-agent-scan-adapter.js +35 -0
- package/scripts/lib/security-confidence/adapters/mock-tank-adapter.js +34 -0
- package/scripts/lib/security-confidence/adapters/reference-registry.js +63 -0
- package/scripts/lib/security-confidence/auth-rbac-plan.js +39 -0
- package/scripts/lib/security-confidence/component-inventory.js +151 -0
- package/scripts/lib/security-confidence/constants.js +191 -0
- package/scripts/lib/security-confidence/dependency-script-risk.js +95 -0
- package/scripts/lib/security-confidence/evidence-hygiene.js +127 -0
- package/scripts/lib/security-confidence/feature-impact-classifier.js +80 -0
- package/scripts/lib/security-confidence/file-utils.js +161 -0
- package/scripts/lib/security-confidence/finding-triage.js +90 -0
- package/scripts/lib/security-confidence/findings.js +115 -0
- package/scripts/lib/security-confidence/index.js +29 -0
- package/scripts/lib/security-confidence/permission-budget.js +93 -0
- package/scripts/lib/security-confidence/redaction.js +82 -0
- package/scripts/lib/security-confidence/redteam-fixtures.js +53 -0
- package/scripts/lib/security-confidence/reference-adoption.js +229 -0
- package/scripts/lib/security-confidence/reference-taxonomy.js +155 -0
- package/scripts/lib/security-confidence/report-quality.js +99 -0
- package/scripts/lib/security-confidence/report-writer.js +79 -0
- package/scripts/lib/security-confidence/risk-classifier.js +187 -0
- package/scripts/lib/security-confidence/runner.js +179 -0
- package/scripts/lib/security-confidence/schema.js +188 -0
- package/scripts/lib/security-confidence/secret-safety.js +74 -0
- package/scripts/lib/security-confidence/security-capability-router.js +98 -0
- package/scripts/lib/security-confidence/web-security-smoke-plan.js +46 -0
- package/scripts/lib/security-risk-classifier.js +511 -0
- package/scripts/lib/security-scan.js +396 -0
- package/scripts/lib/session-context-optimizer.js +1211 -0
- package/scripts/lib/session-timing.js +322 -0
- package/scripts/lib/skill-hygiene.js +805 -0
- package/scripts/lib/skill-packs.js +161 -0
- package/scripts/lib/skills-operating-layer-v1.js +1023 -0
- package/scripts/lib/skills-operating-layer.js +629 -0
- package/scripts/lib/smallest-safe-plan.js +214 -0
- package/scripts/lib/smart-routing-plan.js +115 -0
- package/scripts/lib/smart-work-routing.js +768 -0
- package/scripts/lib/source-catalog.js +1022 -0
- package/scripts/lib/status-value-summary.js +32 -0
- package/scripts/lib/supply-chain-dependency-guard.js +1333 -0
- package/scripts/lib/supply-chain-guard.js +219 -0
- package/scripts/lib/support-bundle.js +561 -0
- package/scripts/lib/support-redaction.js +66 -0
- package/scripts/lib/task-continuation.js +440 -0
- package/scripts/lib/test-helpers.js +15 -0
- package/scripts/lib/tier.js +38 -0
- package/scripts/lib/token-context-quality-gate.js +370 -0
- package/scripts/lib/token-cost-capture.js +187 -0
- package/scripts/lib/token-cost-evidence.js +862 -0
- package/scripts/lib/token-cost-intelligence.js +358 -0
- package/scripts/lib/token-efficiency-evidence.js +213 -0
- package/scripts/lib/token-efficiency-map.js +110 -0
- package/scripts/lib/token-evidence.js +703 -0
- package/scripts/lib/tokenish.js +17 -0
- package/scripts/lib/tool-output-sandbox.js +559 -0
- package/scripts/lib/trust-audit.js +136 -0
- package/scripts/lib/unified-events.js +396 -0
- package/scripts/lib/upgrade-interruption-recovery.js +407 -0
- package/scripts/lib/usage-ledger.js +201 -0
- package/scripts/lib/value-ledger.js +130 -0
- package/scripts/lib/value-proof-calibration.js +531 -0
- package/scripts/lib/visual-qa.js +231 -0
- package/scripts/lib/voice-alpha.js +29 -0
- package/scripts/lib/webhook-idempotency-guard.js +990 -0
- package/scripts/lib/work-aware-orchestration.js +976 -0
- package/scripts/lib/work-control-receipts.js +577 -0
- package/scripts/lib/work-ledger.js +1123 -0
- package/scripts/lib/work-panel-preview.js +352 -0
- package/scripts/lib/workflow-discipline.js +280 -0
- package/scripts/lib/workflow-intelligence-radar.js +804 -0
- package/scripts/lib/workflow-signals.js +419 -0
- package/scripts/lib/workspace-map.js +281 -0
- package/scripts/lib/workspace-registry.js +1367 -0
- package/scripts/lib/workspace-resolver.js +542 -0
- package/scripts/wuz-doctor.js +315 -0
- package/bin/avorelo.mjs +0 -7
- package/dist/avorelo.mjs +0 -24678
|
@@ -0,0 +1,878 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
ensureCcoDirs,
|
|
8
|
+
nowIso,
|
|
9
|
+
safeReadJson,
|
|
10
|
+
safeWriteJson,
|
|
11
|
+
} = require("./fsx");
|
|
12
|
+
|
|
13
|
+
const CONTRACT = "avorelo.agentActivationReadiness.v1";
|
|
14
|
+
const PACKAGE_ROOT = path.resolve(__dirname, "..", "..");
|
|
15
|
+
const REPORT_DIR_REL = ".claude/cco/orchestration/agent-readiness";
|
|
16
|
+
const LATEST_REPORT_REL = `${REPORT_DIR_REL}/latest-readiness.json`;
|
|
17
|
+
|
|
18
|
+
const PRODUCT_HOME_REPORT_REL = ".claude/cco/orchestration/product-home/latest-receipt.json";
|
|
19
|
+
const SUPPORT_BUNDLE_REL = ".claude/cco/support/latest-support-bundle.json";
|
|
20
|
+
const PUBLIC_DISTRIBUTION_TRUTH_REL = ".claude/cco/orchestration/public-distribution/latest-truth.json";
|
|
21
|
+
const INSTALL_CLAIMS_REL = ".claude/cco/orchestration/public-distribution/latest-install-claim-check.json";
|
|
22
|
+
const CAPABILITY_INTAKE_REPORT_REL = ".claude/cco/security/capability-intake/latest-report.json";
|
|
23
|
+
|
|
24
|
+
const REQUIRED_HOOK_EVENTS = Object.freeze(["PreToolUse", "PostToolUse", "Stop"]);
|
|
25
|
+
const SECRET_LIKE_RE = /authorization:\s*bearer|api[_-]?key|password\s*=|secret\s*=|_authToken|AVORELO_NPM_OTP/i;
|
|
26
|
+
|
|
27
|
+
function fileExists(cwd, relPath) {
|
|
28
|
+
return Boolean(relPath) && fs.existsSync(path.join(cwd, relPath));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function packageFileExists(relPath) {
|
|
32
|
+
return Boolean(relPath) && fs.existsSync(path.join(PACKAGE_ROOT, relPath));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function safeReadText(cwd, relPath) {
|
|
36
|
+
try {
|
|
37
|
+
return fs.readFileSync(path.join(cwd, relPath), "utf8").replace(/^\uFEFF/, "");
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function sanitizeText(value, max = 220) {
|
|
44
|
+
if (typeof value !== "string") return null;
|
|
45
|
+
const trimmed = value.replace(/\s+/g, " ").trim();
|
|
46
|
+
if (!trimmed) return null;
|
|
47
|
+
return trimmed.length > max ? `${trimmed.slice(0, max - 3)}...` : trimmed;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function toTitleCaseStatus(value) {
|
|
51
|
+
return String(value || "no_data")
|
|
52
|
+
.replace(/_/g, " ")
|
|
53
|
+
.replace(/\b\w/g, (match) => match.toUpperCase());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function uniq(items) {
|
|
57
|
+
return Array.from(new Set((items || []).filter(Boolean)));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function pushReason(reasonCodes, code, condition = true) {
|
|
61
|
+
if (condition) reasonCodes.push(code);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function hasGeneratedMarker(text) {
|
|
65
|
+
return /Generated by Wuz/i.test(text || "");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function looksThinAdapter(text) {
|
|
69
|
+
if (typeof text !== "string") return true;
|
|
70
|
+
const lines = text.split(/\r?\n/).length;
|
|
71
|
+
return text.length <= 6000 && lines <= 140;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function hasPointerLanguage(text) {
|
|
75
|
+
return /(Avorelo|Wuz|node bin\/avorelo|npx avorelo@latest|local launch layer|project instruction)/i.test(text || "");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function buildRefList(cwd, refs) {
|
|
79
|
+
return uniq((refs || []).filter((ref) => fileExists(cwd, ref) || packageFileExists(ref) || /^[A-Za-z0-9._/-]+$/.test(ref)));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function summarizeAgentReadiness(readiness) {
|
|
83
|
+
if (!readiness || typeof readiness !== "object") return null;
|
|
84
|
+
return {
|
|
85
|
+
status: readiness.status,
|
|
86
|
+
readyItems: readiness.summary?.readyItems || 0,
|
|
87
|
+
missingItems: readiness.summary?.missingItems || 0,
|
|
88
|
+
needsApproval: readiness.summary?.needsApproval || 0,
|
|
89
|
+
blockedItems: readiness.summary?.blockedItems || 0,
|
|
90
|
+
firstValueVerified: readiness.summary?.firstValueVerified === true,
|
|
91
|
+
safeNextAction: readiness.summary?.safeNextAction || "Continue with bounded AI-agent work.",
|
|
92
|
+
reasonCodes: uniq(readiness.activationPlan?.reasonCodes || []),
|
|
93
|
+
evidenceRef: LATEST_REPORT_REL,
|
|
94
|
+
redacted: true,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function listSensitiveWorkspaceFiles(cwd) {
|
|
99
|
+
const matches = [];
|
|
100
|
+
const candidates = [
|
|
101
|
+
{ rel: ".env", code: "env_file_blocked" },
|
|
102
|
+
{ rel: ".env.local", code: "env_file_blocked" },
|
|
103
|
+
{ rel: ".env.production", code: "env_file_blocked" },
|
|
104
|
+
{ rel: ".npmrc", code: "secret_like_content_blocked" },
|
|
105
|
+
{ rel: "auth.json", code: "auth_file_blocked" },
|
|
106
|
+
{ rel: "auth.config.json", code: "auth_file_blocked" },
|
|
107
|
+
{ rel: "secrets.json", code: "secret_like_content_blocked" },
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
for (const candidate of candidates) {
|
|
111
|
+
if (fileExists(cwd, candidate.rel)) {
|
|
112
|
+
matches.push({
|
|
113
|
+
relPath: candidate.rel,
|
|
114
|
+
code: candidate.code,
|
|
115
|
+
summary: `${candidate.rel} stays out of activation scope.`,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return matches;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function inspectHookState(cwd, reasonCodes) {
|
|
124
|
+
const { buildHookConfigPreview } = require("./hook-config-preview");
|
|
125
|
+
const { AVORELO_LIFECYCLE_COMMANDS } = require("./hook-apply");
|
|
126
|
+
|
|
127
|
+
const preview = buildHookConfigPreview(cwd);
|
|
128
|
+
const configTargets = uniq([
|
|
129
|
+
".claude/settings.json",
|
|
130
|
+
...((preview.configPaths || []).filter(Boolean)),
|
|
131
|
+
]);
|
|
132
|
+
|
|
133
|
+
const installedEvents = new Set();
|
|
134
|
+
const hookChanges = [];
|
|
135
|
+
const plannedChanges = [];
|
|
136
|
+
const approvalRequiredChanges = [];
|
|
137
|
+
const blockedChanges = [];
|
|
138
|
+
|
|
139
|
+
let invalidConfigDetected = false;
|
|
140
|
+
let configPresent = false;
|
|
141
|
+
let userHookConfigPresent = false;
|
|
142
|
+
|
|
143
|
+
for (const configRelPath of configTargets) {
|
|
144
|
+
const configAbsPath = path.join(cwd, configRelPath);
|
|
145
|
+
if (!fs.existsSync(configAbsPath)) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
configPresent = true;
|
|
150
|
+
let parsed = null;
|
|
151
|
+
try {
|
|
152
|
+
parsed = JSON.parse(fs.readFileSync(configAbsPath, "utf8").replace(/^\uFEFF/, ""));
|
|
153
|
+
} catch {
|
|
154
|
+
invalidConfigDetected = true;
|
|
155
|
+
hookChanges.push({
|
|
156
|
+
target: configRelPath,
|
|
157
|
+
status: "needs_review",
|
|
158
|
+
change: "Existing hook config is not valid JSON.",
|
|
159
|
+
approvalRequired: true,
|
|
160
|
+
});
|
|
161
|
+
approvalRequiredChanges.push(`Review invalid hook config in ${configRelPath} before changing lifecycle hooks.`);
|
|
162
|
+
pushReason(reasonCodes, "tool_config_requires_approval");
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const hooks = Array.isArray(parsed?.hooks) ? parsed.hooks : [];
|
|
167
|
+
const userHooks = hooks.filter((entry) =>
|
|
168
|
+
!String(entry?.command || "").includes("node bin/avorelo lifecycle-hook")
|
|
169
|
+
);
|
|
170
|
+
if (userHooks.length > 0) {
|
|
171
|
+
userHookConfigPresent = true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
for (const expected of AVORELO_LIFECYCLE_COMMANDS) {
|
|
175
|
+
const found = hooks.some((entry) =>
|
|
176
|
+
entry
|
|
177
|
+
&& entry.event === expected.event
|
|
178
|
+
&& String(entry.command || "").includes(expected.command)
|
|
179
|
+
);
|
|
180
|
+
if (found) {
|
|
181
|
+
installedEvents.add(expected.event);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const missingEvents = REQUIRED_HOOK_EVENTS.filter((event) => !installedEvents.has(event));
|
|
187
|
+
const preToolReady = installedEvents.has("PreToolUse");
|
|
188
|
+
const postToolReady = installedEvents.has("PostToolUse");
|
|
189
|
+
const stopHookReady = installedEvents.has("Stop");
|
|
190
|
+
|
|
191
|
+
for (const event of missingEvents) {
|
|
192
|
+
hookChanges.push({
|
|
193
|
+
target: ".claude/settings.json",
|
|
194
|
+
status: "missing",
|
|
195
|
+
change: `Would add the ${event} lifecycle hook through the previewed local config path.`,
|
|
196
|
+
approvalRequired: true,
|
|
197
|
+
});
|
|
198
|
+
plannedChanges.push(`Preview the missing ${event} lifecycle hook in .claude/settings.json.`);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (missingEvents.length > 0) {
|
|
202
|
+
approvalRequiredChanges.push(
|
|
203
|
+
userHookConfigPresent
|
|
204
|
+
? "Merge the previewed lifecycle hooks into the existing local hook config while preserving user-authored entries."
|
|
205
|
+
: "Approve the preview before adding lifecycle hooks to the local hook config."
|
|
206
|
+
);
|
|
207
|
+
pushReason(reasonCodes, "hook_approval_required");
|
|
208
|
+
pushReason(reasonCodes, "silent_hook_install_blocked");
|
|
209
|
+
} else if (!invalidConfigDetected) {
|
|
210
|
+
pushReason(reasonCodes, "hook_ready");
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
pushReason(reasonCodes, "hook_preview_available");
|
|
214
|
+
pushReason(reasonCodes, "pre_tool_hook_missing", !preToolReady);
|
|
215
|
+
pushReason(reasonCodes, "post_tool_hook_missing", !postToolReady);
|
|
216
|
+
pushReason(reasonCodes, "stop_hook_missing", !stopHookReady);
|
|
217
|
+
|
|
218
|
+
return {
|
|
219
|
+
checked: true,
|
|
220
|
+
preToolReady,
|
|
221
|
+
postToolReady,
|
|
222
|
+
stopHookReady,
|
|
223
|
+
hookPreviewAvailable: true,
|
|
224
|
+
silentInstall: false,
|
|
225
|
+
approvalRequired: missingEvents.length > 0 || invalidConfigDetected,
|
|
226
|
+
hookChanges,
|
|
227
|
+
plannedChanges,
|
|
228
|
+
approvalRequiredChanges,
|
|
229
|
+
blockedChanges,
|
|
230
|
+
configPresent,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function inspectAdapterFile(cwd, relPath, requiredMarkers, options = {}) {
|
|
235
|
+
const text = safeReadText(cwd, relPath);
|
|
236
|
+
const exists = text !== null;
|
|
237
|
+
const notApplicableWhenMissing = options.notApplicableWhenMissing === true;
|
|
238
|
+
|
|
239
|
+
if (!exists) {
|
|
240
|
+
return {
|
|
241
|
+
status: notApplicableWhenMissing ? "not_applicable" : "missing",
|
|
242
|
+
thin: true,
|
|
243
|
+
reasonCode: notApplicableWhenMissing ? null : "adapter_missing",
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (SECRET_LIKE_RE.test(text)) {
|
|
248
|
+
return {
|
|
249
|
+
status: "user_content_preserved",
|
|
250
|
+
thin: true,
|
|
251
|
+
reasonCode: "secret_like_content_blocked",
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const generated = hasGeneratedMarker(text);
|
|
256
|
+
const thin = looksThinAdapter(text);
|
|
257
|
+
const markersPresent = requiredMarkers.every((marker) => marker.test(text));
|
|
258
|
+
const pointerReady = hasPointerLanguage(text);
|
|
259
|
+
|
|
260
|
+
if (!generated) {
|
|
261
|
+
return {
|
|
262
|
+
status: "user_content_preserved",
|
|
263
|
+
thin,
|
|
264
|
+
reasonCode: "adapter_user_content_preserved",
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (!thin || !markersPresent || !pointerReady) {
|
|
269
|
+
return {
|
|
270
|
+
status: "stale",
|
|
271
|
+
thin,
|
|
272
|
+
reasonCode: "adapter_stale",
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return {
|
|
277
|
+
status: "ready",
|
|
278
|
+
thin: true,
|
|
279
|
+
reasonCode: "adapter_ready",
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function inspectCursorAdapter(cwd) {
|
|
284
|
+
const expectedRelPath = ".cursor/rules/wuz-project.mdc";
|
|
285
|
+
const expectedAbsPath = path.join(cwd, expectedRelPath);
|
|
286
|
+
const cursorDir = path.join(cwd, ".cursor");
|
|
287
|
+
if (!fs.existsSync(cursorDir)) {
|
|
288
|
+
return { status: "not_applicable", thin: true, reasonCode: null };
|
|
289
|
+
}
|
|
290
|
+
if (!fs.existsSync(expectedAbsPath)) {
|
|
291
|
+
const otherFiles = fs.existsSync(path.join(cursorDir, "rules"))
|
|
292
|
+
? fs.readdirSync(path.join(cursorDir, "rules")).length
|
|
293
|
+
: 0;
|
|
294
|
+
return {
|
|
295
|
+
status: otherFiles > 0 ? "user_content_preserved" : "missing",
|
|
296
|
+
thin: true,
|
|
297
|
+
reasonCode: otherFiles > 0 ? "adapter_user_content_preserved" : "adapter_missing",
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
return inspectAdapterFile(cwd, expectedRelPath, [/Cursor/i, /(Avorelo|Wuz)/i], {});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function inspectCodexAdapter(cwd) {
|
|
304
|
+
const configRelPath = ".codex/config.toml";
|
|
305
|
+
if (!fileExists(cwd, ".codex")) {
|
|
306
|
+
return { status: "not_applicable", thin: true, reasonCode: null };
|
|
307
|
+
}
|
|
308
|
+
return inspectAdapterFile(cwd, configRelPath, [/\[wuz\]/i, /tool\s*=\s*"codex"/i], {});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function inspectGeminiAdapter(cwd) {
|
|
312
|
+
const geminiDir = path.join(cwd, ".gemini");
|
|
313
|
+
if (!fs.existsSync(geminiDir)) {
|
|
314
|
+
return { status: "not_applicable", thin: true, reasonCode: null };
|
|
315
|
+
}
|
|
316
|
+
const candidateFiles = [
|
|
317
|
+
".gemini/config.json",
|
|
318
|
+
".gemini/settings.json",
|
|
319
|
+
".gemini/GEMINI.md",
|
|
320
|
+
];
|
|
321
|
+
const relPath = candidateFiles.find((candidate) => fileExists(cwd, candidate));
|
|
322
|
+
if (!relPath) {
|
|
323
|
+
return { status: "missing", thin: true, reasonCode: "adapter_missing" };
|
|
324
|
+
}
|
|
325
|
+
return inspectAdapterFile(cwd, relPath, [/(Gemini|Avorelo|Wuz)/i], {});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function inspectAdapters(cwd, reasonCodes) {
|
|
329
|
+
const claudeMd = inspectAdapterFile(cwd, "CLAUDE.md", [/Wuz/i, /Claude/i], {});
|
|
330
|
+
const agentsMd = inspectAdapterFile(cwd, "AGENTS.md", [/Wuz/i, /Codex/i], {});
|
|
331
|
+
const llmsTxt = inspectAdapterFile(cwd, "llms.txt", [/(Avorelo|Wuz)/i], { notApplicableWhenMissing: true });
|
|
332
|
+
const cursor = inspectCursorAdapter(cwd);
|
|
333
|
+
const codex = inspectCodexAdapter(cwd);
|
|
334
|
+
const gemini = inspectGeminiAdapter(cwd);
|
|
335
|
+
|
|
336
|
+
const statuses = [claudeMd, agentsMd, llmsTxt, cursor, codex, gemini];
|
|
337
|
+
const thinAdaptersOnly = statuses.every((adapter) => adapter.thin !== false);
|
|
338
|
+
|
|
339
|
+
for (const adapter of statuses) {
|
|
340
|
+
pushReason(reasonCodes, adapter.reasonCode, Boolean(adapter.reasonCode));
|
|
341
|
+
}
|
|
342
|
+
pushReason(reasonCodes, "thin_adapter_required", !thinAdaptersOnly);
|
|
343
|
+
|
|
344
|
+
return {
|
|
345
|
+
checked: true,
|
|
346
|
+
claudeMd: claudeMd.status,
|
|
347
|
+
agentsMd: agentsMd.status,
|
|
348
|
+
llmsTxt: llmsTxt.status,
|
|
349
|
+
cursor: cursor.status,
|
|
350
|
+
codex: codex.status,
|
|
351
|
+
gemini: gemini.status,
|
|
352
|
+
thinAdaptersOnly,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function classifySurfaceAvailability(cwd, refs) {
|
|
357
|
+
return refs.every((ref) => fileExists(cwd, ref) || packageFileExists(ref)) ? "pass" : "missing";
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function buildFirstValue(cwd, workspace, reasonCodes) {
|
|
361
|
+
const valueSignalsExists = packageFileExists("scripts/lib/cost-to-outcome-signals.js")
|
|
362
|
+
|| packageFileExists("tests/cost-to-outcome-signals.test.js");
|
|
363
|
+
|
|
364
|
+
const firstValue = {
|
|
365
|
+
home: classifySurfaceAvailability(cwd, ["scripts/lib/product-home-receipt.js"]),
|
|
366
|
+
status: classifySurfaceAvailability(cwd, ["scripts/cco-status.js", "scripts/lib/dashboard.js"]),
|
|
367
|
+
repair: classifySurfaceAvailability(cwd, ["scripts/lib/safe-repair.js"]),
|
|
368
|
+
nextRun: classifySurfaceAvailability(cwd, ["scripts/lib/next-run-continuity.js"]),
|
|
369
|
+
scopeRepair: classifySurfaceAvailability(cwd, ["scripts/lib/scope-repair-before-approval.js"]),
|
|
370
|
+
valueSignals: valueSignalsExists ? "pass" : "not_applicable",
|
|
371
|
+
support: classifySurfaceAvailability(cwd, ["scripts/lib/support-bundle.js"]),
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
const requiredStatuses = [firstValue.home, firstValue.status, firstValue.repair, firstValue.nextRun, firstValue.scopeRepair, firstValue.support];
|
|
375
|
+
const firstValueVerified = workspace.publicPackageVerified === true
|
|
376
|
+
&& requiredStatuses.every((status) => status === "pass")
|
|
377
|
+
&& (firstValue.valueSignals === "pass" || firstValue.valueSignals === "not_applicable");
|
|
378
|
+
|
|
379
|
+
pushReason(reasonCodes, "home_verified", firstValue.home === "pass");
|
|
380
|
+
pushReason(reasonCodes, "status_verified", firstValue.status === "pass");
|
|
381
|
+
pushReason(reasonCodes, "repair_verified", firstValue.repair === "pass");
|
|
382
|
+
pushReason(reasonCodes, "next_run_verified", firstValue.nextRun === "pass");
|
|
383
|
+
pushReason(reasonCodes, "scope_repair_verified", firstValue.scopeRepair === "pass");
|
|
384
|
+
pushReason(reasonCodes, "value_signals_verified", firstValue.valueSignals === "pass");
|
|
385
|
+
pushReason(reasonCodes, "value_signals_not_applicable", firstValue.valueSignals === "not_applicable");
|
|
386
|
+
pushReason(reasonCodes, "support_verified", firstValue.support === "pass");
|
|
387
|
+
pushReason(reasonCodes, "support_fallback_available", firstValue.support !== "missing");
|
|
388
|
+
pushReason(reasonCodes, "first_value_verified", firstValueVerified);
|
|
389
|
+
|
|
390
|
+
return {
|
|
391
|
+
firstValue,
|
|
392
|
+
firstValueVerified,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function summarizeReadyItems(workspace, hooks, adapters, firstValueVerified) {
|
|
397
|
+
let count = 0;
|
|
398
|
+
if (workspace.repoDetected) count += 1;
|
|
399
|
+
if (workspace.packageDetected) count += 1;
|
|
400
|
+
if (workspace.publicPackageVerified) count += 1;
|
|
401
|
+
if (hooks.preToolReady && hooks.postToolReady && hooks.stopHookReady) count += 1;
|
|
402
|
+
if (adapters.claudeMd === "ready") count += 1;
|
|
403
|
+
if (adapters.agentsMd === "ready") count += 1;
|
|
404
|
+
if (adapters.codex === "ready") count += 1;
|
|
405
|
+
if (adapters.cursor === "ready") count += 1;
|
|
406
|
+
if (firstValueVerified) count += 1;
|
|
407
|
+
return count;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function summarizeMissingItems(hooks, adapters, firstValue) {
|
|
411
|
+
const adapterStates = [adapters.claudeMd, adapters.agentsMd, adapters.llmsTxt, adapters.cursor, adapters.codex, adapters.gemini];
|
|
412
|
+
let count = adapterStates.filter((status) => status === "missing" || status === "stale").length;
|
|
413
|
+
count += REQUIRED_HOOK_EVENTS.filter((event) =>
|
|
414
|
+
(event === "PreToolUse" && !hooks.preToolReady)
|
|
415
|
+
|| (event === "PostToolUse" && !hooks.postToolReady)
|
|
416
|
+
|| (event === "Stop" && !hooks.stopHookReady)
|
|
417
|
+
).length;
|
|
418
|
+
count += Object.values(firstValue).filter((status) => status === "missing").length;
|
|
419
|
+
return count;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function determineSafeNextAction(status, hooks, adapters, firstValueVerified, blockedChanges) {
|
|
423
|
+
if (blockedChanges.length > 0 || status === "blocked") {
|
|
424
|
+
return "Review the blocked file or config manually before changing lifecycle hooks.";
|
|
425
|
+
}
|
|
426
|
+
if (hooks.approvalRequired) {
|
|
427
|
+
return "Run `node bin/avorelo hooks preview --json` and approve the hook preview before changing lifecycle hooks, or continue in prepare-only mode.";
|
|
428
|
+
}
|
|
429
|
+
if (
|
|
430
|
+
["missing", "stale", "user_content_preserved"].includes(adapters.claudeMd)
|
|
431
|
+
|| ["missing", "stale", "user_content_preserved"].includes(adapters.agentsMd)
|
|
432
|
+
|| ["missing", "stale", "user_content_preserved"].includes(adapters.codex)
|
|
433
|
+
) {
|
|
434
|
+
return "Keep adapter files thin and local. Preserve user-authored content and add only compact Avorelo pointers.";
|
|
435
|
+
}
|
|
436
|
+
if (!firstValueVerified) {
|
|
437
|
+
return "Run `node bin/avorelo home --text` and `node bin/avorelo next-run --text` to verify the first local value path.";
|
|
438
|
+
}
|
|
439
|
+
return "Continue with bounded AI-agent work.";
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function buildWorkspaceSection(cwd, reasonCodes) {
|
|
443
|
+
const pkg = safeReadJson(cwd, "package.json", null);
|
|
444
|
+
const truthArtifact = safeReadJson(cwd, PUBLIC_DISTRIBUTION_TRUTH_REL, null);
|
|
445
|
+
const installClaimsArtifact = safeReadJson(cwd, INSTALL_CLAIMS_REL, null);
|
|
446
|
+
|
|
447
|
+
const repoDetected = fileExists(cwd, ".git") || fileExists(cwd, "AGENTS.md") || fileExists(cwd, "CLAUDE.md") || fileExists(cwd, ".codex/config.toml");
|
|
448
|
+
const packageDetected = Boolean(pkg);
|
|
449
|
+
const distributionState = truthArtifact?.distributionState
|
|
450
|
+
|| pkg?.avoreloDistributionState
|
|
451
|
+
|| (pkg?.private === false ? "ready_to_publish" : "unknown");
|
|
452
|
+
const publicPackageVerified = distributionState === "published_verified";
|
|
453
|
+
const npmVersion = typeof pkg?.version === "string" ? pkg.version : "unknown";
|
|
454
|
+
|
|
455
|
+
pushReason(reasonCodes, "repo_detected", repoDetected);
|
|
456
|
+
pushReason(reasonCodes, "package_detected", packageDetected);
|
|
457
|
+
pushReason(reasonCodes, "public_distribution_verified", publicPackageVerified);
|
|
458
|
+
pushReason(reasonCodes, "npm_version_verified", npmVersion !== "unknown");
|
|
459
|
+
|
|
460
|
+
return {
|
|
461
|
+
workspace: {
|
|
462
|
+
repoDetected,
|
|
463
|
+
packageDetected,
|
|
464
|
+
publicPackageVerified,
|
|
465
|
+
distributionState,
|
|
466
|
+
npmVersion,
|
|
467
|
+
},
|
|
468
|
+
packageTruthBlocked: Boolean(
|
|
469
|
+
packageDetected
|
|
470
|
+
&& (pkg?.name === "avorelo" || pkg?.avoreloDistributionState || truthArtifact)
|
|
471
|
+
&& (!publicPackageVerified || Number(installClaimsArtifact?.blockedCount || 0) > 0)
|
|
472
|
+
),
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function buildIntegrationRefs(cwd, valueSignalsIncluded) {
|
|
477
|
+
return {
|
|
478
|
+
home: buildRefList(cwd, ["scripts/lib/product-home-receipt.js", PRODUCT_HOME_REPORT_REL]),
|
|
479
|
+
status: buildRefList(cwd, ["scripts/cco-status.js", "scripts/lib/dashboard.js"]),
|
|
480
|
+
dashboard: buildRefList(cwd, ["scripts/cco-dashboard.js", "scripts/lib/dashboard.js"]),
|
|
481
|
+
repair: buildRefList(cwd, ["scripts/lib/safe-repair.js"]),
|
|
482
|
+
nextRun: buildRefList(cwd, ["scripts/lib/next-run-continuity.js"]),
|
|
483
|
+
scopeRepair: buildRefList(cwd, ["scripts/lib/scope-repair-before-approval.js"]),
|
|
484
|
+
valueSignals: valueSignalsIncluded ? buildRefList(cwd, ["scripts/lib/cost-to-outcome-signals.js"]) : [],
|
|
485
|
+
support: buildRefList(cwd, ["scripts/lib/support-bundle.js", SUPPORT_BUNDLE_REL]),
|
|
486
|
+
capabilityIntake: buildRefList(cwd, ["scripts/lib/capability-intake-quarantine.js", CAPABILITY_INTAKE_REPORT_REL]),
|
|
487
|
+
packagePublicGates: buildRefList(cwd, [
|
|
488
|
+
"scripts/lib/public-distribution-truth.js",
|
|
489
|
+
"scripts/lib/public-install-claim-checker.js",
|
|
490
|
+
PUBLIC_DISTRIBUTION_TRUTH_REL,
|
|
491
|
+
INSTALL_CLAIMS_REL,
|
|
492
|
+
]),
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
function inspectCapabilityIntake(cwd, reasonCodes) {
|
|
497
|
+
const report = safeReadJson(cwd, CAPABILITY_INTAKE_REPORT_REL, null);
|
|
498
|
+
if (!report || report.schemaVersion !== "avorelo.capabilityIntakeQuarantine.v1") {
|
|
499
|
+
return {
|
|
500
|
+
present: false,
|
|
501
|
+
approvalRequiredChanges: [],
|
|
502
|
+
blockedChanges: [],
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
const relevant = (report.candidates || []).filter((candidate) =>
|
|
507
|
+
candidate.type === "adapter"
|
|
508
|
+
|| (candidate.risk?.permissions || []).some((permission) =>
|
|
509
|
+
["writes_files", "browser_access", "network_access", "executes_commands", "package_install"].includes(permission)
|
|
510
|
+
)
|
|
511
|
+
);
|
|
512
|
+
const blocked = relevant.filter((candidate) => candidate.decision?.state === "block");
|
|
513
|
+
const review = relevant.filter((candidate) =>
|
|
514
|
+
["manual_review", "quarantine"].includes(candidate.decision?.state)
|
|
515
|
+
);
|
|
516
|
+
|
|
517
|
+
if (blocked.length > 0) pushReason(reasonCodes, "capability_intake_blocked");
|
|
518
|
+
if (review.length > 0) pushReason(reasonCodes, "capability_intake_review_required");
|
|
519
|
+
|
|
520
|
+
return {
|
|
521
|
+
present: true,
|
|
522
|
+
approvalRequiredChanges: review.length > 0
|
|
523
|
+
? ["Capability intake found adapter, browser, network, command, or package candidates that need review before trust."]
|
|
524
|
+
: [],
|
|
525
|
+
blockedChanges: blocked.length > 0
|
|
526
|
+
? ["Capability intake blocked an adapter or side-effecting capability candidate that must stay out of readiness scope."]
|
|
527
|
+
: [],
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
function buildClaimSafetySection() {
|
|
532
|
+
return {
|
|
533
|
+
silentHookInstall: false,
|
|
534
|
+
universalAgentSupport: false,
|
|
535
|
+
guaranteedEnforcement: false,
|
|
536
|
+
launchReadyClaim: false,
|
|
537
|
+
cloudSync: false,
|
|
538
|
+
remoteTelemetry: false,
|
|
539
|
+
fullAdapterFramework: false,
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function buildPrivacySection() {
|
|
544
|
+
return {
|
|
545
|
+
localOnly: true,
|
|
546
|
+
rawPromptStored: false,
|
|
547
|
+
rawCodeStored: false,
|
|
548
|
+
secretsStored: false,
|
|
549
|
+
envStored: false,
|
|
550
|
+
fullLogsStored: false,
|
|
551
|
+
privatePathsStored: false,
|
|
552
|
+
redacted: true,
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function buildAgentActivationReadiness(cwd = process.cwd(), options = {}) {
|
|
557
|
+
const reasonCodes = [];
|
|
558
|
+
const { workspace, packageTruthBlocked } = buildWorkspaceSection(cwd, reasonCodes);
|
|
559
|
+
const activationContextDetected = [
|
|
560
|
+
".avorelo/activation/activation-state.json",
|
|
561
|
+
".claude/cco/state/activation.json",
|
|
562
|
+
".claude/settings.json",
|
|
563
|
+
"CLAUDE.md",
|
|
564
|
+
"AGENTS.md",
|
|
565
|
+
".codex/config.toml",
|
|
566
|
+
".cursor",
|
|
567
|
+
".gemini",
|
|
568
|
+
"llms.txt",
|
|
569
|
+
].some((relPath) => fileExists(cwd, relPath));
|
|
570
|
+
|
|
571
|
+
if (!workspace.repoDetected && !workspace.packageDetected) {
|
|
572
|
+
const noData = {
|
|
573
|
+
schemaVersion: CONTRACT,
|
|
574
|
+
generatedAt: nowIso(),
|
|
575
|
+
status: "no_data",
|
|
576
|
+
redacted: true,
|
|
577
|
+
summary: {
|
|
578
|
+
readyItems: 0,
|
|
579
|
+
missingItems: 0,
|
|
580
|
+
needsApproval: 0,
|
|
581
|
+
blockedItems: 0,
|
|
582
|
+
firstValueVerified: false,
|
|
583
|
+
safeNextAction: "Run from a project repo or use `node bin/avorelo status --text` first.",
|
|
584
|
+
},
|
|
585
|
+
workspace,
|
|
586
|
+
activationPlan: {
|
|
587
|
+
mode: "check_only",
|
|
588
|
+
plannedChanges: [],
|
|
589
|
+
approvalRequiredChanges: [],
|
|
590
|
+
blockedChanges: [],
|
|
591
|
+
reasonCodes: uniq(reasonCodes),
|
|
592
|
+
},
|
|
593
|
+
hooks: {
|
|
594
|
+
checked: false,
|
|
595
|
+
preToolReady: false,
|
|
596
|
+
postToolReady: false,
|
|
597
|
+
stopHookReady: false,
|
|
598
|
+
hookPreviewAvailable: false,
|
|
599
|
+
silentInstall: false,
|
|
600
|
+
approvalRequired: false,
|
|
601
|
+
hookChanges: [],
|
|
602
|
+
},
|
|
603
|
+
adapters: {
|
|
604
|
+
checked: false,
|
|
605
|
+
claudeMd: "not_applicable",
|
|
606
|
+
agentsMd: "not_applicable",
|
|
607
|
+
llmsTxt: "not_applicable",
|
|
608
|
+
cursor: "not_applicable",
|
|
609
|
+
codex: "not_applicable",
|
|
610
|
+
gemini: "not_applicable",
|
|
611
|
+
thinAdaptersOnly: true,
|
|
612
|
+
},
|
|
613
|
+
firstValue: {
|
|
614
|
+
home: "missing",
|
|
615
|
+
status: "missing",
|
|
616
|
+
repair: "missing",
|
|
617
|
+
nextRun: "missing",
|
|
618
|
+
scopeRepair: "missing",
|
|
619
|
+
valueSignals: "not_applicable",
|
|
620
|
+
support: "missing",
|
|
621
|
+
},
|
|
622
|
+
integrationRefs: buildIntegrationRefs(cwd, false),
|
|
623
|
+
privacy: buildPrivacySection(),
|
|
624
|
+
claimSafety: buildClaimSafetySection(),
|
|
625
|
+
};
|
|
626
|
+
return noData;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
if (!activationContextDetected) {
|
|
630
|
+
return {
|
|
631
|
+
schemaVersion: CONTRACT,
|
|
632
|
+
generatedAt: nowIso(),
|
|
633
|
+
status: "no_data",
|
|
634
|
+
redacted: true,
|
|
635
|
+
summary: {
|
|
636
|
+
readyItems: workspace.publicPackageVerified ? 1 : 0,
|
|
637
|
+
missingItems: 0,
|
|
638
|
+
needsApproval: 0,
|
|
639
|
+
blockedItems: packageTruthBlocked ? 1 : 0,
|
|
640
|
+
firstValueVerified: false,
|
|
641
|
+
safeNextAction: "Run from a project repo with local activation context, or use `node bin/avorelo status --text` first.",
|
|
642
|
+
},
|
|
643
|
+
workspace,
|
|
644
|
+
activationPlan: {
|
|
645
|
+
mode: "check_only",
|
|
646
|
+
plannedChanges: [],
|
|
647
|
+
approvalRequiredChanges: [],
|
|
648
|
+
blockedChanges: packageTruthBlocked
|
|
649
|
+
? ["Public package or install-claim truth must stay published_verified before claiming activation readiness."]
|
|
650
|
+
: [],
|
|
651
|
+
reasonCodes: uniq(reasonCodes),
|
|
652
|
+
},
|
|
653
|
+
hooks: {
|
|
654
|
+
checked: false,
|
|
655
|
+
preToolReady: false,
|
|
656
|
+
postToolReady: false,
|
|
657
|
+
stopHookReady: false,
|
|
658
|
+
hookPreviewAvailable: false,
|
|
659
|
+
silentInstall: false,
|
|
660
|
+
approvalRequired: false,
|
|
661
|
+
hookChanges: [],
|
|
662
|
+
},
|
|
663
|
+
adapters: {
|
|
664
|
+
checked: false,
|
|
665
|
+
claudeMd: "not_applicable",
|
|
666
|
+
agentsMd: "not_applicable",
|
|
667
|
+
llmsTxt: "not_applicable",
|
|
668
|
+
cursor: "not_applicable",
|
|
669
|
+
codex: "not_applicable",
|
|
670
|
+
gemini: "not_applicable",
|
|
671
|
+
thinAdaptersOnly: true,
|
|
672
|
+
},
|
|
673
|
+
firstValue: {
|
|
674
|
+
home: "missing",
|
|
675
|
+
status: "missing",
|
|
676
|
+
repair: "missing",
|
|
677
|
+
nextRun: "missing",
|
|
678
|
+
scopeRepair: "missing",
|
|
679
|
+
valueSignals: "not_applicable",
|
|
680
|
+
support: "missing",
|
|
681
|
+
},
|
|
682
|
+
integrationRefs: buildIntegrationRefs(cwd, false),
|
|
683
|
+
privacy: buildPrivacySection(),
|
|
684
|
+
claimSafety: buildClaimSafetySection(),
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
pushReason(reasonCodes, "activation_plan_created");
|
|
689
|
+
|
|
690
|
+
const hooks = inspectHookState(cwd, reasonCodes);
|
|
691
|
+
const adapters = inspectAdapters(cwd, reasonCodes);
|
|
692
|
+
const { firstValue, firstValueVerified } = buildFirstValue(cwd, workspace, reasonCodes);
|
|
693
|
+
const blockedSensitiveFiles = listSensitiveWorkspaceFiles(cwd);
|
|
694
|
+
const capabilityIntake = inspectCapabilityIntake(cwd, reasonCodes);
|
|
695
|
+
|
|
696
|
+
const plannedChanges = [...hooks.plannedChanges];
|
|
697
|
+
const approvalRequiredChanges = [...hooks.approvalRequiredChanges, ...capabilityIntake.approvalRequiredChanges];
|
|
698
|
+
const blockedChanges = [...hooks.blockedChanges, ...capabilityIntake.blockedChanges];
|
|
699
|
+
|
|
700
|
+
for (const file of blockedSensitiveFiles) {
|
|
701
|
+
blockedChanges.push(file.summary);
|
|
702
|
+
pushReason(reasonCodes, file.code);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
if (adapters.claudeMd === "missing") {
|
|
706
|
+
plannedChanges.push("Prepare a thin CLAUDE.md adapter pointer.");
|
|
707
|
+
} else if (adapters.claudeMd === "stale") {
|
|
708
|
+
plannedChanges.push("Refresh the thin CLAUDE.md adapter pointer.");
|
|
709
|
+
} else if (adapters.claudeMd === "user_content_preserved") {
|
|
710
|
+
approvalRequiredChanges.push("Preserve the existing CLAUDE.md content and add any Avorelo pointer only with review.");
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
if (adapters.agentsMd === "missing") {
|
|
714
|
+
plannedChanges.push("Prepare a thin AGENTS.md adapter pointer.");
|
|
715
|
+
} else if (adapters.agentsMd === "stale") {
|
|
716
|
+
plannedChanges.push("Refresh the thin AGENTS.md adapter pointer.");
|
|
717
|
+
} else if (adapters.agentsMd === "user_content_preserved") {
|
|
718
|
+
approvalRequiredChanges.push("Preserve the existing AGENTS.md content and add any Avorelo pointer only with review.");
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
if (adapters.codex === "missing" || adapters.codex === "stale") {
|
|
722
|
+
plannedChanges.push("Prepare or refresh the thin Codex config pointer.");
|
|
723
|
+
} else if (adapters.codex === "user_content_preserved") {
|
|
724
|
+
approvalRequiredChanges.push("Preserve the existing Codex config and review any pointer changes before applying them.");
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
let status = "ready";
|
|
728
|
+
if (packageTruthBlocked || blockedChanges.length > 0) {
|
|
729
|
+
status = "blocked";
|
|
730
|
+
} else if (
|
|
731
|
+
hooks.approvalRequired
|
|
732
|
+
|| approvalRequiredChanges.length > 0
|
|
733
|
+
|| plannedChanges.length > 0
|
|
734
|
+
|| !firstValueVerified
|
|
735
|
+
|| [adapters.claudeMd, adapters.agentsMd, adapters.codex, adapters.cursor].some((state) =>
|
|
736
|
+
state === "missing" || state === "stale" || state === "user_content_preserved"
|
|
737
|
+
)
|
|
738
|
+
) {
|
|
739
|
+
status = "needs_attention";
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
const activationMode = blockedChanges.length > 0 || packageTruthBlocked
|
|
743
|
+
? "blocked"
|
|
744
|
+
: approvalRequiredChanges.length > 0
|
|
745
|
+
? "approval_required"
|
|
746
|
+
: plannedChanges.length > 0
|
|
747
|
+
? "prepare_only"
|
|
748
|
+
: "check_only";
|
|
749
|
+
|
|
750
|
+
pushReason(reasonCodes, "prepare_only_mode", activationMode === "prepare_only");
|
|
751
|
+
pushReason(reasonCodes, "safe_next_action_available");
|
|
752
|
+
|
|
753
|
+
const safeNextAction = determineSafeNextAction(status, hooks, adapters, firstValueVerified, blockedChanges);
|
|
754
|
+
const integrationRefs = buildIntegrationRefs(cwd, firstValue.valueSignals === "pass");
|
|
755
|
+
|
|
756
|
+
return {
|
|
757
|
+
schemaVersion: CONTRACT,
|
|
758
|
+
generatedAt: nowIso(),
|
|
759
|
+
status,
|
|
760
|
+
redacted: true,
|
|
761
|
+
summary: {
|
|
762
|
+
readyItems: summarizeReadyItems(workspace, hooks, adapters, firstValueVerified),
|
|
763
|
+
missingItems: summarizeMissingItems(hooks, adapters, firstValue),
|
|
764
|
+
needsApproval: approvalRequiredChanges.length,
|
|
765
|
+
blockedItems: blockedChanges.length + (packageTruthBlocked ? 1 : 0),
|
|
766
|
+
firstValueVerified,
|
|
767
|
+
safeNextAction,
|
|
768
|
+
},
|
|
769
|
+
workspace,
|
|
770
|
+
activationPlan: {
|
|
771
|
+
mode: activationMode,
|
|
772
|
+
plannedChanges: uniq(plannedChanges),
|
|
773
|
+
approvalRequiredChanges: uniq(approvalRequiredChanges),
|
|
774
|
+
blockedChanges: uniq([
|
|
775
|
+
...blockedChanges,
|
|
776
|
+
...(packageTruthBlocked ? ["Public package or install-claim truth must stay published_verified before claiming activation readiness."] : []),
|
|
777
|
+
]),
|
|
778
|
+
reasonCodes: uniq(reasonCodes),
|
|
779
|
+
},
|
|
780
|
+
hooks: {
|
|
781
|
+
checked: hooks.checked,
|
|
782
|
+
preToolReady: hooks.preToolReady,
|
|
783
|
+
postToolReady: hooks.postToolReady,
|
|
784
|
+
stopHookReady: hooks.stopHookReady,
|
|
785
|
+
hookPreviewAvailable: hooks.hookPreviewAvailable,
|
|
786
|
+
silentInstall: hooks.silentInstall,
|
|
787
|
+
approvalRequired: hooks.approvalRequired,
|
|
788
|
+
hookChanges: hooks.hookChanges,
|
|
789
|
+
},
|
|
790
|
+
adapters,
|
|
791
|
+
firstValue,
|
|
792
|
+
integrationRefs,
|
|
793
|
+
privacy: buildPrivacySection(),
|
|
794
|
+
claimSafety: buildClaimSafetySection(),
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function writeAgentActivationReadiness(cwd, readiness) {
|
|
799
|
+
ensureCcoDirs(cwd);
|
|
800
|
+
safeWriteJson(cwd, LATEST_REPORT_REL, readiness);
|
|
801
|
+
return LATEST_REPORT_REL;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
function generateAgentActivationReadiness(cwd = process.cwd(), options = {}) {
|
|
805
|
+
const readiness = buildAgentActivationReadiness(cwd, options);
|
|
806
|
+
const shouldWrite = options.write !== false;
|
|
807
|
+
const writtenPath = shouldWrite ? writeAgentActivationReadiness(cwd, readiness) : null;
|
|
808
|
+
return {
|
|
809
|
+
readiness,
|
|
810
|
+
writtenPath,
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
function formatAgentActivationReadinessText(readiness) {
|
|
815
|
+
const readyParts = [];
|
|
816
|
+
if (readiness.workspace.packageDetected) readyParts.push("local package");
|
|
817
|
+
if (readiness.firstValue.status === "pass") readyParts.push("status");
|
|
818
|
+
if (readiness.firstValue.home === "pass") readyParts.push("home");
|
|
819
|
+
if (readiness.firstValue.repair === "pass") readyParts.push("repair");
|
|
820
|
+
if (readiness.firstValue.nextRun === "pass") readyParts.push("next-run");
|
|
821
|
+
if (readiness.hooks.preToolReady && readiness.hooks.postToolReady && readiness.hooks.stopHookReady) readyParts.push("hooks");
|
|
822
|
+
|
|
823
|
+
const foundParts = [];
|
|
824
|
+
if (!readiness.hooks.preToolReady) foundParts.push("missing pre-tool hook");
|
|
825
|
+
if (!readiness.hooks.postToolReady) foundParts.push("missing post-tool hook");
|
|
826
|
+
if (!readiness.hooks.stopHookReady) foundParts.push("missing stop hook");
|
|
827
|
+
if (readiness.adapters.claudeMd === "stale") foundParts.push("stale CLAUDE.md adapter");
|
|
828
|
+
if (readiness.adapters.agentsMd === "stale") foundParts.push("stale AGENTS.md adapter");
|
|
829
|
+
if (readiness.adapters.codex === "stale") foundParts.push("stale Codex adapter");
|
|
830
|
+
if (foundParts.length === 0 && readiness.status === "no_data") {
|
|
831
|
+
foundParts.push("no repo or activation context available");
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
const reviewParts = [];
|
|
835
|
+
if (readiness.hooks.approvalRequired) reviewParts.push("hook installation requires approval");
|
|
836
|
+
if (readiness.activationPlan.reasonCodes.includes("capability_intake_review_required")) reviewParts.push("capability intake requires review");
|
|
837
|
+
if (readiness.adapters.claudeMd === "user_content_preserved") reviewParts.push("existing CLAUDE.md content was preserved");
|
|
838
|
+
if (readiness.adapters.agentsMd === "user_content_preserved") reviewParts.push("existing AGENTS.md content was preserved");
|
|
839
|
+
if (readiness.adapters.codex === "user_content_preserved") reviewParts.push("existing Codex config was preserved");
|
|
840
|
+
if (readiness.activationPlan.blockedChanges.length > 0) reviewParts.push("sensitive files stayed blocked");
|
|
841
|
+
|
|
842
|
+
const firstValueSummary = readiness.summary.firstValueVerified
|
|
843
|
+
? "verified through local value surfaces"
|
|
844
|
+
: readiness.firstValue.home === "pass"
|
|
845
|
+
? "Product Home receipt available"
|
|
846
|
+
: "still incomplete";
|
|
847
|
+
|
|
848
|
+
return [
|
|
849
|
+
"Avorelo Agent Readiness",
|
|
850
|
+
`Status: ${toTitleCaseStatus(readiness.status)}`,
|
|
851
|
+
`Ready: ${readyParts.length > 0 ? readyParts.join(", ") : "none"}`,
|
|
852
|
+
`Found: ${foundParts.length > 0 ? foundParts.join(", ") : "none"}`,
|
|
853
|
+
`For review: ${reviewParts.length > 0 ? reviewParts.join(", ") : "none"}`,
|
|
854
|
+
`First value: ${firstValueSummary}`,
|
|
855
|
+
`Next: ${readiness.summary.safeNextAction}`,
|
|
856
|
+
].join("\n");
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
function formatAgentActivationStatusLine(readiness) {
|
|
860
|
+
if (!readiness) return "Agent readiness: unavailable";
|
|
861
|
+
const parts = [`Agent readiness: ${toTitleCaseStatus(readiness.status)}`];
|
|
862
|
+
if (readiness.hooks.approvalRequired) parts.push("hook approval required");
|
|
863
|
+
if (readiness.summary.firstValueVerified) parts.push("first value verified");
|
|
864
|
+
if (readiness.activationPlan.reasonCodes.includes("capability_intake_review_required")) parts.push("capability intake review required");
|
|
865
|
+
parts.push(`next: ${sanitizeText(readiness.summary.safeNextAction, 120)}`);
|
|
866
|
+
return parts.join(" · ");
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
module.exports = {
|
|
870
|
+
CONTRACT,
|
|
871
|
+
LATEST_REPORT_REL,
|
|
872
|
+
buildAgentActivationReadiness,
|
|
873
|
+
generateAgentActivationReadiness,
|
|
874
|
+
writeAgentActivationReadiness,
|
|
875
|
+
summarizeAgentReadiness,
|
|
876
|
+
formatAgentActivationReadinessText,
|
|
877
|
+
formatAgentActivationStatusLine,
|
|
878
|
+
};
|