avorelo 0.1.0 → 0.3.0

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.
Files changed (260) hide show
  1. package/LICENSE +23 -16
  2. package/README.md +90 -51
  3. package/bin/avorelo.mjs +7 -0
  4. package/dist/avorelo.mjs +19741 -0
  5. package/package.json +135 -120
  6. package/bin/avorelo +0 -9
  7. package/scripts/README.md +0 -40
  8. package/scripts/cco-dashboard.js +0 -252
  9. package/scripts/cco-status.js +0 -430
  10. package/scripts/lib/activation/account-state.js +0 -37
  11. package/scripts/lib/activation/activation-runner.js +0 -546
  12. package/scripts/lib/activation/activation-self-healing.js +0 -480
  13. package/scripts/lib/activation/activation-state.js +0 -83
  14. package/scripts/lib/activation/activation-summary.js +0 -191
  15. package/scripts/lib/activation/adapters/claude-code.js +0 -77
  16. package/scripts/lib/activation/adapters/codex-cli.js +0 -52
  17. package/scripts/lib/activation/adapters/cursor.js +0 -37
  18. package/scripts/lib/activation/adapters/github-agent.js +0 -39
  19. package/scripts/lib/activation/adapters/terminal.js +0 -42
  20. package/scripts/lib/activation/adapters/vscode.js +0 -39
  21. package/scripts/lib/activation/adapters/windsurf.js +0 -37
  22. package/scripts/lib/activation/ai-surface-detector.js +0 -151
  23. package/scripts/lib/activation/connect-account.js +0 -145
  24. package/scripts/lib/activation/detect-environment.js +0 -75
  25. package/scripts/lib/activation/detect-hosts.js +0 -62
  26. package/scripts/lib/activation/format-activation-output.js +0 -109
  27. package/scripts/lib/activation/next-action.js +0 -43
  28. package/scripts/lib/activation/repair-engine.js +0 -219
  29. package/scripts/lib/activation-distribution-readiness.js +0 -507
  30. package/scripts/lib/adapter-conformance.js +0 -176
  31. package/scripts/lib/adapter-readiness.js +0 -417
  32. package/scripts/lib/adapter-safety-boundaries.js +0 -335
  33. package/scripts/lib/adapter-technical-readiness-gate.js +0 -205
  34. package/scripts/lib/agent-access-governance.js +0 -455
  35. package/scripts/lib/agent-enforcement.js +0 -765
  36. package/scripts/lib/agent-policy-profile.js +0 -210
  37. package/scripts/lib/agent-security/action-evaluator.js +0 -507
  38. package/scripts/lib/agent-security/adapter-registry.js +0 -98
  39. package/scripts/lib/agent-security/auto-policy.js +0 -139
  40. package/scripts/lib/agent-security/bounded-scan.js +0 -93
  41. package/scripts/lib/agent-security/enforcement-adapter.js +0 -174
  42. package/scripts/lib/agent-security/enforcement-engine.js +0 -1129
  43. package/scripts/lib/agent-security/file-write-adapter.js +0 -183
  44. package/scripts/lib/agent-security/file-write-rules.js +0 -178
  45. package/scripts/lib/agent-security/index.js +0 -3342
  46. package/scripts/lib/agent-security/instruction-risk.js +0 -181
  47. package/scripts/lib/agent-security/mcp-action-adapter.js +0 -185
  48. package/scripts/lib/agent-security/mcp-action-rules.js +0 -184
  49. package/scripts/lib/agent-security/package-action-adapter.js +0 -175
  50. package/scripts/lib/agent-security/package-action-rules.js +0 -233
  51. package/scripts/lib/agent-security/performance.js +0 -148
  52. package/scripts/lib/agent-security/permission-minimizer.js +0 -403
  53. package/scripts/lib/agent-security/scan-cache.js +0 -74
  54. package/scripts/lib/agent-security/source-trust.js +0 -146
  55. package/scripts/lib/ai-install-prompt.js +0 -288
  56. package/scripts/lib/ai-workspace-hygiene.js +0 -1499
  57. package/scripts/lib/alpha-activation.js +0 -520
  58. package/scripts/lib/alpha-feedback.js +0 -263
  59. package/scripts/lib/alpha-readiness-gate.js +0 -332
  60. package/scripts/lib/anti-gaming.js +0 -169
  61. package/scripts/lib/artifact-health.js +0 -431
  62. package/scripts/lib/attribution.js +0 -180
  63. package/scripts/lib/audit.js +0 -289
  64. package/scripts/lib/avorelo-skill-registry.js +0 -810
  65. package/scripts/lib/batch-jobs.js +0 -71
  66. package/scripts/lib/brain-pack.js +0 -578
  67. package/scripts/lib/brand-boundary.js +0 -424
  68. package/scripts/lib/brand.js +0 -74
  69. package/scripts/lib/browser-capability.js +0 -1048
  70. package/scripts/lib/browser-proof-preflight.js +0 -321
  71. package/scripts/lib/cache-readiness.js +0 -187
  72. package/scripts/lib/canonical-reentry.js +0 -162
  73. package/scripts/lib/capability-packs.js +0 -314
  74. package/scripts/lib/capability-recommender.js +0 -512
  75. package/scripts/lib/capability-registry.js +0 -1059
  76. package/scripts/lib/carry-forward-surfacing.js +0 -194
  77. package/scripts/lib/ccusage-adapter.js +0 -188
  78. package/scripts/lib/company-loop.js +0 -1149
  79. package/scripts/lib/config.js +0 -637
  80. package/scripts/lib/context-acquisition-plan.js +0 -287
  81. package/scripts/lib/context-budget-guard.js +0 -170
  82. package/scripts/lib/context-budget-scanner.js +0 -257
  83. package/scripts/lib/context-optimizer.js +0 -715
  84. package/scripts/lib/context-reduction-plan.js +0 -178
  85. package/scripts/lib/context-safety.js +0 -88
  86. package/scripts/lib/context-savings-engine.js +0 -158
  87. package/scripts/lib/cost-evidence.js +0 -254
  88. package/scripts/lib/cross-host-install-plan.js +0 -308
  89. package/scripts/lib/cross-host-install-readiness.js +0 -237
  90. package/scripts/lib/cross-host-value-flow.js +0 -268
  91. package/scripts/lib/dashboard.js +0 -900
  92. package/scripts/lib/design-partner-feedback.js +0 -346
  93. package/scripts/lib/entitlements.js +0 -100
  94. package/scripts/lib/execution-packet.js +0 -559
  95. package/scripts/lib/experimentation-events.js +0 -547
  96. package/scripts/lib/external-capability-compliance.js +0 -107
  97. package/scripts/lib/external-user-simulation.js +0 -166
  98. package/scripts/lib/failure-recovery-readiness.js +0 -81
  99. package/scripts/lib/failure-recovery.js +0 -419
  100. package/scripts/lib/feedback-intelligence.js +0 -537
  101. package/scripts/lib/feedback-signals.js +0 -205
  102. package/scripts/lib/file-integrity.js +0 -68
  103. package/scripts/lib/fsx.js +0 -127
  104. package/scripts/lib/full-readiness-gate.js +0 -451
  105. package/scripts/lib/guidance-builder.js +0 -174
  106. package/scripts/lib/hook-apply.js +0 -1019
  107. package/scripts/lib/hook-baseline.js +0 -310
  108. package/scripts/lib/hook-config-preview.js +0 -275
  109. package/scripts/lib/hook-contracts.js +0 -290
  110. package/scripts/lib/hook-safety-boundary-readiness.js +0 -80
  111. package/scripts/lib/host-capability-matrix.js +0 -351
  112. package/scripts/lib/host-support-context.js +0 -254
  113. package/scripts/lib/http-hook-action.js +0 -538
  114. package/scripts/lib/install-ai-readiness.js +0 -84
  115. package/scripts/lib/install-intake-risk.js +0 -1037
  116. package/scripts/lib/install-journey-intelligence.js +0 -329
  117. package/scripts/lib/intervention-guidance.js +0 -57
  118. package/scripts/lib/known-limitations.js +0 -115
  119. package/scripts/lib/l8-path-truth.js +0 -146
  120. package/scripts/lib/launch-hardening-gate.js +0 -436
  121. package/scripts/lib/launch-readiness.js +0 -628
  122. package/scripts/lib/learning-memory.js +0 -686
  123. package/scripts/lib/lifecycle-hooks.js +0 -802
  124. package/scripts/lib/local-package-smoke.js +0 -423
  125. package/scripts/lib/local-pricing.js +0 -299
  126. package/scripts/lib/mcp-enforcement.js +0 -311
  127. package/scripts/lib/mcp-least-privilege-policy.js +0 -303
  128. package/scripts/lib/mcp-tool-inventory.js +0 -388
  129. package/scripts/lib/mcp-tool-risk.js +0 -0
  130. package/scripts/lib/memory.js +0 -335
  131. package/scripts/lib/metrics.js +0 -699
  132. package/scripts/lib/micro-proof.js +0 -133
  133. package/scripts/lib/next-run-context.js +0 -436
  134. package/scripts/lib/operating-value.js +0 -1648
  135. package/scripts/lib/optimization-v3.js +0 -122
  136. package/scripts/lib/orchestration/adapters/_shared.js +0 -49
  137. package/scripts/lib/orchestration/adapters/aider.js +0 -18
  138. package/scripts/lib/orchestration/adapters/claude-code.js +0 -35
  139. package/scripts/lib/orchestration/adapters/codex.js +0 -35
  140. package/scripts/lib/orchestration/adapters/gemini-cli.js +0 -18
  141. package/scripts/lib/orchestration/adapters/git.js +0 -25
  142. package/scripts/lib/orchestration/adapters/index.js +0 -31
  143. package/scripts/lib/orchestration/adapters/lm-studio.js +0 -18
  144. package/scripts/lib/orchestration/adapters/ollama.js +0 -18
  145. package/scripts/lib/orchestration/adapters/opencode.js +0 -18
  146. package/scripts/lib/orchestration/adapters/openrouter.js +0 -18
  147. package/scripts/lib/orchestration/adapters/test-runner.js +0 -25
  148. package/scripts/lib/orchestration/cli.js +0 -438
  149. package/scripts/lib/orchestration/execution-manager.js +0 -279
  150. package/scripts/lib/orchestration/handoff.js +0 -314
  151. package/scripts/lib/orchestration/index.js +0 -456
  152. package/scripts/lib/orchestration/inventory.js +0 -47
  153. package/scripts/lib/orchestration/model-discovery.js +0 -498
  154. package/scripts/lib/orchestration/model-profiler.js +0 -170
  155. package/scripts/lib/orchestration/model-profiles.js +0 -252
  156. package/scripts/lib/orchestration/model-refresh-policy.js +0 -72
  157. package/scripts/lib/orchestration/proof-writer.js +0 -349
  158. package/scripts/lib/orchestration/provider-discovery/aider.js +0 -49
  159. package/scripts/lib/orchestration/provider-discovery/claude-code.js +0 -56
  160. package/scripts/lib/orchestration/provider-discovery/codex.js +0 -49
  161. package/scripts/lib/orchestration/provider-discovery/common.js +0 -186
  162. package/scripts/lib/orchestration/provider-discovery/gemini.js +0 -106
  163. package/scripts/lib/orchestration/provider-discovery/lm-studio.js +0 -118
  164. package/scripts/lib/orchestration/provider-discovery/models-dev.js +0 -12
  165. package/scripts/lib/orchestration/provider-discovery/ollama.js +0 -100
  166. package/scripts/lib/orchestration/provider-discovery/opencode.js +0 -47
  167. package/scripts/lib/orchestration/provider-discovery/openrouter.js +0 -44
  168. package/scripts/lib/orchestration/risk-classifier.js +0 -130
  169. package/scripts/lib/orchestration/routing-policy.js +0 -486
  170. package/scripts/lib/orchestration/settings.js +0 -112
  171. package/scripts/lib/orchestration/state.js +0 -165
  172. package/scripts/lib/orchestration/verification-manager.js +0 -138
  173. package/scripts/lib/output-profiles.js +0 -146
  174. package/scripts/lib/package-content-audit.js +0 -368
  175. package/scripts/lib/package-runtime.js +0 -278
  176. package/scripts/lib/plan-surface.js +0 -53
  177. package/scripts/lib/plans.js +0 -2318
  178. package/scripts/lib/policy-provider.js +0 -27
  179. package/scripts/lib/prelaunch-activation-readiness.js +0 -409
  180. package/scripts/lib/prelaunch-evidence-store.js +0 -816
  181. package/scripts/lib/prelaunch-intelligence.js +0 -869
  182. package/scripts/lib/pricing-experiment.js +0 -118
  183. package/scripts/lib/pro-moment-events.js +0 -77
  184. package/scripts/lib/pro-moment-state.js +0 -227
  185. package/scripts/lib/pro-moments.js +0 -1216
  186. package/scripts/lib/product-learning-events.js +0 -629
  187. package/scripts/lib/project-profile.js +0 -555
  188. package/scripts/lib/prompt-compiler.js +0 -280
  189. package/scripts/lib/prompt-lint.js +0 -32
  190. package/scripts/lib/prompt-suggestions.js +0 -52
  191. package/scripts/lib/proof-canonical.js +0 -398
  192. package/scripts/lib/proof-drilldown.js +0 -383
  193. package/scripts/lib/proof-events.js +0 -342
  194. package/scripts/lib/proof-history.js +0 -243
  195. package/scripts/lib/proof-metrics.js +0 -296
  196. package/scripts/lib/proof-outcome-evidence.js +0 -134
  197. package/scripts/lib/proof-receipt.js +0 -335
  198. package/scripts/lib/proof-record.js +0 -461
  199. package/scripts/lib/public-activation-distribution-gate.js +0 -258
  200. package/scripts/lib/public-cli.js +0 -3891
  201. package/scripts/lib/public-distribution-truth.js +0 -211
  202. package/scripts/lib/public-install-claim-checker.js +0 -294
  203. package/scripts/lib/publish-provenance-readiness.js +0 -283
  204. package/scripts/lib/readiness-delta.js +0 -218
  205. package/scripts/lib/readiness-evidence-closure.js +0 -196
  206. package/scripts/lib/reentry-memory-capture.js +0 -241
  207. package/scripts/lib/reentry-memory-retrieval.js +0 -302
  208. package/scripts/lib/reentry-memory-status.js +0 -146
  209. package/scripts/lib/reentry-memory-store.js +0 -178
  210. package/scripts/lib/reentry-state.js +0 -66
  211. package/scripts/lib/release-candidate-bundle.js +0 -166
  212. package/scripts/lib/remediation.js +0 -81
  213. package/scripts/lib/repo-map.js +0 -391
  214. package/scripts/lib/run-improvements-lifecycle.js +0 -330
  215. package/scripts/lib/run-improvements.js +0 -789
  216. package/scripts/lib/runtime-decision-policy.js +0 -387
  217. package/scripts/lib/safe-path-engine.js +0 -705
  218. package/scripts/lib/safe-run-controller.js +0 -887
  219. package/scripts/lib/score.js +0 -262
  220. package/scripts/lib/seamless-enforcement.js +0 -329
  221. package/scripts/lib/seamless-outcome.js +0 -689
  222. package/scripts/lib/seamless-reality-gate.js +0 -5043
  223. package/scripts/lib/security-risk-classifier.js +0 -511
  224. package/scripts/lib/security-scan.js +0 -384
  225. package/scripts/lib/session-context-optimizer.js +0 -1211
  226. package/scripts/lib/session-timing.js +0 -315
  227. package/scripts/lib/skill-hygiene.js +0 -805
  228. package/scripts/lib/skill-packs.js +0 -161
  229. package/scripts/lib/skills-operating-layer.js +0 -580
  230. package/scripts/lib/smart-work-routing.js +0 -768
  231. package/scripts/lib/source-catalog.js +0 -700
  232. package/scripts/lib/status-value-summary.js +0 -32
  233. package/scripts/lib/support-bundle.js +0 -578
  234. package/scripts/lib/task-continuation.js +0 -440
  235. package/scripts/lib/test-helpers.js +0 -15
  236. package/scripts/lib/tier.js +0 -38
  237. package/scripts/lib/token-context-quality-gate.js +0 -370
  238. package/scripts/lib/token-cost-capture.js +0 -187
  239. package/scripts/lib/token-cost-intelligence.js +0 -358
  240. package/scripts/lib/token-efficiency-evidence.js +0 -213
  241. package/scripts/lib/token-evidence.js +0 -699
  242. package/scripts/lib/tokenish.js +0 -17
  243. package/scripts/lib/tool-output-sandbox.js +0 -304
  244. package/scripts/lib/trust-audit.js +0 -136
  245. package/scripts/lib/unified-events.js +0 -396
  246. package/scripts/lib/upgrade-interruption-recovery.js +0 -407
  247. package/scripts/lib/usage-ledger.js +0 -201
  248. package/scripts/lib/value-ledger.js +0 -130
  249. package/scripts/lib/value-proof-calibration.js +0 -531
  250. package/scripts/lib/visual-qa.js +0 -231
  251. package/scripts/lib/voice-alpha.js +0 -29
  252. package/scripts/lib/work-aware-orchestration.js +0 -976
  253. package/scripts/lib/work-control-receipts.js +0 -577
  254. package/scripts/lib/work-ledger.js +0 -1123
  255. package/scripts/lib/work-panel-preview.js +0 -352
  256. package/scripts/lib/workflow-discipline.js +0 -280
  257. package/scripts/lib/workflow-signals.js +0 -419
  258. package/scripts/lib/workspace-map.js +0 -281
  259. package/scripts/lib/workspace-registry.js +0 -1367
  260. package/scripts/lib/workspace-resolver.js +0 -480
@@ -1,451 +0,0 @@
1
- "use strict";
2
-
3
- // ── Full Readiness / Release Candidate Gate ───────────────────────────────────
4
- // Contract: avorelo.fullReadinessGate.v1
5
- // Consumes all existing signals and makes a formal go/no-go release candidate
6
- // determination. Local-only. Redacted. No public launch claim.
7
-
8
- const fs = require("fs");
9
- const path = require("path");
10
- const { nowIso } = require("./fsx");
11
- const { appendProductLearningEvent } = require("./product-learning-events");
12
-
13
- const CONTRACT = "avorelo.fullReadinessGate.v1";
14
- const SCHEMA_VERSION = 1;
15
- const GATE_DIR_REL = ".claude/cco/orchestration/full-readiness";
16
- const ARTIFACT_REL = GATE_DIR_REL + "/latest-gate.json";
17
- const SCORE_READY = 85;
18
- const SCORE_WARN = 70;
19
-
20
- function safeReadJson(absPath) {
21
- try {
22
- if (!fs.existsSync(absPath)) return null;
23
- return JSON.parse(fs.readFileSync(absPath, "utf8").replace(/^/, ""));
24
- } catch { return null; }
25
- }
26
-
27
- function collectFullReadinessSignals(cwd, options) {
28
- options = options || {};
29
- function read(rel) { return safeReadJson(path.join(cwd, rel)); }
30
- var proofOutcomeEvidence = null;
31
- var installAiReadiness = null;
32
- var failureRecoveryReadiness = null;
33
- var hookSafetyBoundaryReadiness = null;
34
- try {
35
- var poe = require("./proof-outcome-evidence");
36
- proofOutcomeEvidence = poe.buildProofOutcomeEvidence(cwd);
37
- poe.writeProofOutcomeEvidence(cwd, proofOutcomeEvidence);
38
- } catch (e) {}
39
- try { installAiReadiness = require("./install-ai-readiness").buildInstallAiReadiness(cwd); } catch (e) {}
40
- try { failureRecoveryReadiness = require("./failure-recovery-readiness").buildFailureRecoveryReadiness(cwd); } catch (e) {}
41
- try { hookSafetyBoundaryReadiness = require("./hook-safety-boundary-readiness").buildHookSafetyBoundaryReadiness(cwd); } catch (e) {}
42
- return {
43
- prelaunchIntelligence: read(".claude/cco/orchestration/prelaunch-intelligence/latest-intelligence.json"),
44
- feedbackIntelligence: read(".claude/cco/orchestration/prelaunch-intelligence/latest-feedback-intelligence.json"),
45
- tokenCostIntelligence: read(".claude/cco/orchestration/prelaunch-intelligence/latest-token-cost-intelligence.json"),
46
- installJourneyIntelligence: read(".claude/cco/orchestration/prelaunch-intelligence/latest-install-journey.json"),
47
- installPrompt: read(".claude/cco/orchestration/ai-install/latest-prompt.json"),
48
- installAiReadiness: installAiReadiness,
49
- prelaunchReadiness: read(".claude/cco/orchestration/prelaunch-readiness/latest-activation-readiness.json"),
50
- activation: read(".claude/cco/orchestration/activation/latest-activation.json"),
51
- alphaReadiness: read(".claude/cco/orchestration/alpha-readiness/latest-gate.json"),
52
- launchHardening: read(".claude/cco/orchestration/launch-hardening/latest-gate.json"),
53
- failureRecovery: read(".claude/cco/orchestration/failure-recovery/latest-recovery.json"),
54
- failureRecoveryReadiness: failureRecoveryReadiness,
55
- artifactHealth: read(".claude/cco/orchestration/artifact-health/latest-health.json"),
56
- tokenEfficiency: read(".claude/cco/orchestration/token-efficiency/latest-evidence.json"),
57
- tokenQualityGate: read(".claude/cco/orchestration/token-efficiency/latest-quality-gate.json"),
58
- mcpInventory: read(".claude/cco/orchestration/mcp-tool-governance/latest-inventory.json"),
59
- mcpRisk: read(".claude/cco/orchestration/mcp-tool-governance/latest-risk.json"),
60
- mcpPolicy: read(".claude/cco/orchestration/mcp-tool-governance/latest-policy.json"),
61
- hookDoctor: read(".claude/cco/orchestration/hook-apply/latest-doctor.json"),
62
- hookSafetyBoundaryReadiness: hookSafetyBoundaryReadiness,
63
- supportBundle: read(".claude/cco/support/latest-support-bundle.json"),
64
- valueSummary: read(".claude/cco/orchestration/seamless-outcome/latest-value-summary.json"),
65
- realityGate: read(".claude/cco/orchestration/seamless-outcome/latest-reality-gate.json"),
66
- proofOutcomeEvidence: proofOutcomeEvidence,
67
- companyLoop: read(".claude/cco/orchestration/company-loop/latest-report.json"),
68
- activationDistribution: (function() { try { var adr = require("./activation-distribution-readiness"); return adr.buildActivationDistributionSurface(cwd, {}); } catch(e) { return null; } })(),
69
- publicDistributionGate: (function() {
70
- try { return safeReadJson(path.join(cwd, ".claude/cco/orchestration/public-distribution/latest-gate.json")); } catch(e) { return null; }
71
- })(),
72
- adapterTechnicalReadiness: (function() {
73
- try { return safeReadJson(path.join(cwd, ".claude/cco/orchestration/adapter-readiness/latest-technical-gate.json")); } catch(e) { return null; }
74
- })(),
75
- };
76
- }
77
-
78
- function checkInstallAi(signals) {
79
- var readiness = signals.installAiReadiness;
80
- if (readiness) {
81
- if (readiness.status === "pass") return { id: "install_ai", status: "pass", message: "AI install path present with explicit approval boundaries" };
82
- return {
83
- id: "install_ai",
84
- status: "warn",
85
- message: "AI install path exists but still has internal readiness gaps",
86
- safeNextAction: (readiness.safeNextActions && readiness.safeNextActions[0]) || "Run: node bin/avorelo install-ai --json",
87
- };
88
- }
89
- var s = signals.installPrompt;
90
- if (!s) return { id: "install_ai", status: "warn", message: "AI install prompt not generated", safeNextAction: "Run: node bin/avorelo install-ai --json" };
91
- var ok = s.activationAvailable === true && s.prelaunchAvailable === true && Array.isArray(s.approvalBoundaries) && s.approvalBoundaries.length > 0;
92
- if (!ok) return { id: "install_ai", status: "warn", message: "AI install prompt exists but approval boundaries unclear", safeNextAction: "Run: node bin/avorelo install-ai --json" };
93
- return { id: "install_ai", status: "pass", message: "AI install prompt present with approval boundaries" };
94
- }
95
-
96
- function checkFirstValue(signals) {
97
- var s = signals.prelaunchReadiness;
98
- if (!s) return { id: "first_value", status: "warn", message: "First value check not run", safeNextAction: "Run: node bin/avorelo first-value-check --json" };
99
- var fv = s.firstValuePath || s.firstValue || s.firstValueJourney;
100
- if (!fv) return { id: "first_value", status: "warn", message: "First value path not confirmed", safeNextAction: "Run: node bin/avorelo first-value-check --json" };
101
- return { id: "first_value", status: "pass", message: "First value path confirmed" };
102
- }
103
-
104
- function checkPrelaunchActivation(signals) {
105
- var s = signals.prelaunchReadiness;
106
- if (!s) return { id: "prelaunch_activation", status: "warn", message: "Prelaunch activation readiness not run", safeNextAction: "Run: node bin/avorelo prelaunch-readiness --json" };
107
- if (s.status !== "ready" && s.status !== "warn" && s.status !== "pass") return { id: "prelaunch_activation", status: "blocked", message: "Prelaunch readiness status: " + (s.status || "unknown"), safeNextAction: "Run: node bin/avorelo prelaunch-readiness --json and resolve blockers" };
108
- return { id: "prelaunch_activation", status: (s.status === "ready" || s.status === "pass") ? "pass" : "warn", message: "Prelaunch readiness: " + s.status };
109
- }
110
-
111
- function checkPrelaunchIntelligence(signals) {
112
- var s = signals.prelaunchIntelligence;
113
- if (!s) return { id: "prelaunch_intelligence", status: "warn", message: "Prelaunch intelligence not run", safeNextAction: "Run: node bin/avorelo prelaunch-intelligence --json" };
114
- var score = s.score || 0;
115
- if ((s.missingEvidence || []).length > 0) {
116
- return {
117
- id: "prelaunch_intelligence",
118
- status: "warn",
119
- message: "Prelaunch intelligence has unresolved evidence gaps",
120
- safeNextAction: (s.safeNextActions && s.safeNextActions[0]) || "Run: node bin/avorelo prelaunch-intelligence --json",
121
- };
122
- }
123
- if (score >= SCORE_READY) return { id: "prelaunch_intelligence", status: "pass", message: "Intelligence score: " + score };
124
- return { id: "prelaunch_intelligence", status: "warn", message: "Intelligence score: " + score + " (below " + SCORE_READY + " ready threshold)", safeNextAction: "Run dogfood feedback pass then rerun prelaunch-intelligence" };
125
- }
126
-
127
- function checkLaunchHardening(signals) {
128
- var s = signals.launchHardening;
129
- if (!s) return { id: "launch_hardening", status: "warn", message: "Launch hardening gate not run", safeNextAction: "Run: node bin/avorelo launch-hardening --json" };
130
- if ((s.summary && s.summary.fail || 0) > 0) return { id: "launch_hardening", status: "blocked", message: "Launch hardening has " + s.summary.fail + " failures", safeNextAction: "Run: node bin/avorelo launch-hardening --json and resolve failures" };
131
- return { id: "launch_hardening", status: "pass", message: "Launch hardening pass: " + (s.summary && s.summary.pass || 0) + ", warn: " + (s.summary && s.summary.warn || 0) };
132
- }
133
-
134
- function checkFailureRecovery(signals) {
135
- var readiness = signals.failureRecoveryReadiness;
136
- if (readiness) {
137
- if (readiness.status === "pass") return { id: "failure_recovery", status: "pass", message: "Failure recovery path and support surfaces are internally ready" };
138
- return {
139
- id: "failure_recovery",
140
- status: "warn",
141
- message: "Failure recovery path still has internal readiness gaps",
142
- safeNextAction: (readiness.safeNextActions && readiness.safeNextActions[0]) || "Run: node bin/avorelo launch-hardening --json",
143
- };
144
- }
145
- var s = signals.failureRecovery;
146
- if (!s) return { id: "failure_recovery", status: "warn", message: "Failure recovery plan not generated", safeNextAction: "Run: node bin/avorelo launch-hardening --json" };
147
- return { id: "failure_recovery", status: "pass", message: "Failure recovery plan present" };
148
- }
149
-
150
- function checkTokenContextQuality(signals) {
151
- var s = signals.tokenQualityGate;
152
- var e = signals.tokenEfficiency;
153
- if (!s && !e) return { id: "token_context_quality", status: "warn", message: "Token/context quality gate not run", safeNextAction: "Run: node bin/avorelo token-efficiency --json" };
154
- if (s && s.summary && s.summary.fail > 0) return { id: "token_context_quality", status: "blocked", message: "Token quality gate has " + s.summary.fail + " failures", safeNextAction: "Run: node bin/avorelo token-efficiency --json and resolve failures" };
155
- return { id: "token_context_quality", status: "pass", message: "Token/context quality checks passing" };
156
- }
157
-
158
- function checkTokenCostDiscipline(signals) {
159
- var s = signals.tokenCostIntelligence;
160
- if (!s) return { id: "token_cost_discipline", status: "warn", message: "Token/cost intelligence not available", safeNextAction: "Run: node bin/avorelo token-cost --json" };
161
- if (s.noExactSavingsClaim === false) return { id: "token_cost_discipline", status: "blocked", message: "Exact savings claimed without verified source", safeNextAction: "Remove exact savings claims" };
162
- if ((s.realUsageSamplesCount || 0) === 0) {
163
- return {
164
- id: "token_cost_discipline",
165
- status: "warn",
166
- message: "Token/cost evidence is " + (s.evidenceMode || s.evidenceLevel || "missing") + " and still lacks measured real usage samples",
167
- safeNextAction: (s.safeNextActions && s.safeNextActions[0]) || "Run: node bin/avorelo token-cost import --file <redacted-json-or-jsonl> --json",
168
- evidenceLevel: s.evidenceLevel || "not_available",
169
- };
170
- }
171
- if (s.status === "not_available" || s.evidenceLevel === "not_available") return { id: "token_cost_discipline", status: "warn", message: "Token/cost evidence not_available — acceptable if caveated", evidenceLevel: "not_available" };
172
- return { id: "token_cost_discipline", status: "pass", message: "Token/cost evidence: " + (s.evidenceLevel || s.status) };
173
- }
174
-
175
- function checkMcpToolGovernance(signals) {
176
- var inv = signals.mcpInventory;
177
- var risk = signals.mcpRisk;
178
- var policy = signals.mcpPolicy;
179
- if (!inv && !risk && !policy) return { id: "mcp_tool_governance", status: "warn", message: "MCP governance not run", safeNextAction: "Run: node bin/avorelo mcp doctor --json" };
180
- if (risk && (risk.highCritical || 0) > 0) return { id: "mcp_tool_governance", status: "blocked", message: "MCP has " + risk.highCritical + " high/critical risk tools", safeNextAction: "Run: node bin/avorelo mcp doctor --json and resolve high/critical risks" };
181
- return { id: "mcp_tool_governance", status: "pass", message: "MCP governance active. Risk: " + (risk && risk.status || "pass") };
182
- }
183
-
184
- function checkHookSafetyBoundaries(signals) {
185
- var readiness = signals.hookSafetyBoundaryReadiness;
186
- if (readiness) {
187
- if (readiness.status === "pass") return { id: "hook_safety_boundaries", status: "pass", message: "Hook safety boundaries are enforced and explicit" };
188
- return {
189
- id: "hook_safety_boundaries",
190
- status: "warn",
191
- message: "Hook safety boundaries still need internal verification",
192
- safeNextAction: (readiness.safeNextActions && readiness.safeNextActions[0]) || "Run: node bin/avorelo hooks doctor --json",
193
- };
194
- }
195
- var s = signals.hookDoctor;
196
- if (!s) return { id: "hook_safety_boundaries", status: "warn", message: "Hook doctor not run — hooks require explicit approval", safeNextAction: "Run: node bin/avorelo hooks doctor --json" };
197
- if (s.summary && s.summary.fail > 0) return { id: "hook_safety_boundaries", status: "blocked", message: "Hook safety boundary check failed", safeNextAction: "Run: node bin/avorelo hooks doctor --json and resolve failures" };
198
- return { id: "hook_safety_boundaries", status: "pass", message: "Hook safety boundaries enforced — hooks require explicit approval" };
199
- }
200
-
201
- function checkSupportBundleRedaction(signals) {
202
- var s = signals.supportBundle;
203
- if (!s) return { id: "support_bundle_redaction", status: "warn", message: "Support bundle not generated", safeNextAction: "Run: node bin/avorelo support-bundle --json" };
204
- if (s.redacted !== true) return { id: "support_bundle_redaction", status: "blocked", message: "Support bundle is not marked redacted", safeNextAction: "Run: node bin/avorelo support-bundle --json" };
205
- return { id: "support_bundle_redaction", status: "pass", message: "Support bundle present and redacted" };
206
- }
207
-
208
- function checkProofOutcomeEvidence(signals) {
209
- var s = signals.proofOutcomeEvidence;
210
- if (!s || s.latestProofAvailable !== true) {
211
- return {
212
- id: "proof_outcome_evidence",
213
- status: "warn",
214
- message: "No proof/value summary generated from a completed real task",
215
- safeNextAction: (s && s.safeNextActions && s.safeNextActions[0]) || "Run: node bin/avorelo proof after completing a real task",
216
- redacted: true,
217
- };
218
- }
219
- if (s.status !== "pass") {
220
- return {
221
- id: "proof_outcome_evidence",
222
- status: "warn",
223
- message: "Proof/value summary exists but readiness evidence is still incomplete",
224
- safeNextAction: (s.safeNextActions && s.safeNextActions[0]) || "Run: node bin/avorelo outcome --gate --json",
225
- redacted: true,
226
- };
227
- }
228
- return {
229
- id: "proof_outcome_evidence",
230
- status: "pass",
231
- message: "Proof/value summary present and evidence-backed",
232
- redacted: true,
233
- };
234
- }
235
-
236
- function checkFeedbackIntelligence(signals) {
237
- var s = signals.feedbackIntelligence;
238
- if (!s) return { id: "feedback_intelligence", status: "warn", message: "Feedback intelligence not run", safeNextAction: "Run: node bin/avorelo feedback intake-pack --json" };
239
- if ((s.qualifiedFeedbackItemsCount || 0) === 0 || s.status === "insufficient_data") {
240
- return {
241
- id: "feedback_intelligence",
242
- status: "warn",
243
- message: "Feedback insufficient — no qualified redacted feedback evidence exists",
244
- safeNextAction: (s.safeNextActions && s.safeNextActions[0]) || "Run: node bin/avorelo feedback intake-pack --json",
245
- evidenceLevel: "insufficient_data",
246
- };
247
- }
248
- if (s.hasBlockerSeverity === true) return { id: "feedback_intelligence", status: "warn", message: "Feedback has blocker-severity friction", safeNextAction: "Address feedback blockers then rerun" };
249
- return { id: "feedback_intelligence", status: "pass", message: "Feedback clusters: " + (s.clustersFound || 0) };
250
- }
251
-
252
- function checkCompanyLoopRecommendation(signals) {
253
- var s = signals.companyLoop;
254
- if (!s) return { id: "company_loop_recommendation", status: "warn", message: "Company loop not run", safeNextAction: "Run: node bin/avorelo company-loop --json" };
255
- var rec = (s.nextPrRecommendation && s.nextPrRecommendation.recommendedNextPr) || s.recommendedNextPr;
256
- return { id: "company_loop_recommendation", status: "pass", message: "Company loop recommendation: " + (rec || "present"), recommendation: rec || null };
257
- }
258
-
259
- function checkKnownLimitations(signals, options) {
260
- options = options || {};
261
- var limitations = options.knownLimitations || null;
262
- if (!limitations) return { id: "known_limitations", status: "warn", message: "Known limitations register not yet built", safeNextAction: "Run: node bin/avorelo known-limitations --json" };
263
- var blockerLimits = (limitations.limitations || []).filter(function(l) { return l.severity === "blocker" && l.status !== "accepted"; });
264
- if (blockerLimits.length > 0) return { id: "known_limitations", status: "blocked", message: blockerLimits.length + " unmitigated blocker limitations", safeNextAction: "Resolve blocker limitations before release candidate", blockerCount: blockerLimits.length };
265
- return { id: "known_limitations", status: "pass", message: "Known limitations documented: " + (limitations.limitations || []).length, count: (limitations.limitations || []).length };
266
- }
267
-
268
- function checkNoFalseClaims(signals) {
269
- var tci = signals.tokenCostIntelligence;
270
- var intel = signals.prelaunchIntelligence;
271
- var pi = signals.prelaunchReadiness;
272
- if ((tci && tci.noExactSavingsClaim === false) || (intel && intel.noExactSavingsClaim === false) || (pi && pi.noExactSavingsClaim === false)) {
273
- return { id: "no_false_claims", status: "blocked", message: "Exact savings claimed without verified billing source", safeNextAction: "Remove exact savings claims" };
274
- }
275
- if ((intel && intel.noPublicLaunchClaim === false) || (pi && pi.noPublicLaunchClaim === false)) {
276
- return { id: "no_false_claims", status: "blocked", message: "Public launch ready claimed before gate passes", safeNextAction: "Remove public launch claim" };
277
- }
278
- return { id: "no_false_claims", status: "pass", message: "No false claims detected" };
279
- }
280
-
281
-
282
- function checkAdapterTechnicalReadiness(signals) {
283
- var id = "adapter_technical_readiness";
284
- var s = signals.adapterTechnicalReadiness;
285
- if (!s) return { id: id, status: "warn", message: "Adapter technical readiness gate not yet run.", safeNextAction: "Run: node bin/avorelo adapter-readiness-technical --json" };
286
- if (s.status === "blocked") return { id: id, status: "blocked", message: "Adapter technical readiness blocked (" + (s.blockerCount || s.totalBlockers || 0) + " blockers).", safeNextAction: s.safeNextAction || "Run: node bin/avorelo adapter-readiness-technical --json and fix blockers." };
287
- if (s.verdict === "adapter_ready") return { id: id, status: "pass", message: "Adapter technical readiness: ready (score " + s.score + "/100).", safeNextAction: null };
288
- return { id: id, status: "warn", message: "Adapter technical readiness: " + s.status + " (score " + (s.score || "?") + "/100).", safeNextAction: s.safeNextAction || "Run: node bin/avorelo adapter-readiness-technical --json" };
289
- }
290
-
291
- function checkActivationDistributionReadiness(signals) {
292
- var id = "activation_distribution_readiness";
293
- var s = signals.activationDistribution;
294
- if (!s) return { id: id, status: "warn", message: "Activation distribution readiness not yet run.", safeNextAction: "Run: node bin/avorelo activation-distribution --json" };
295
- if (s.status === "blocked") return { id: id, status: "blocked", message: "Activation distribution readiness is blocked (" + (s.blockerCount || 0) + " blockers).", safeNextAction: s.safeNextActions && s.safeNextActions[0] || "Run: node bin/avorelo activation-distribution --json and fix blockers." };
296
- if (s.status === "ready") return { id: id, status: "pass", message: "Activation distribution readiness: ready (score " + s.score + ").", safeNextAction: null };
297
- return { id: id, status: "warn", message: "Activation distribution readiness: " + s.status + " (score " + (s.score || "?") + ").", safeNextAction: s.safeNextActions && s.safeNextActions[0] || "Run: node bin/avorelo activation-distribution --json" };
298
- }
299
-
300
- function checkPublicDistributionGate(signals) {
301
- var id = "public_distribution_gate";
302
- var s = signals.publicDistributionGate;
303
- if (!s) return { id: id, status: "warn", message: "Public distribution truth gate not yet run.", safeNextAction: "Run: node bin/avorelo public-distribution --json" };
304
- // Only block full readiness if distribution gate is truly blocked (false install claims, forbidden files, broken bin)
305
- if (s.status === "blocked") return { id: id, status: "blocked", message: "Public distribution gate blocked (" + (s.blockers || []).length + " blockers).", safeNextAction: s.safeNextAction || "Run: node bin/avorelo public-distribution --json and fix blockers." };
306
- // local_only, warn, or pending are all acceptable — package is not yet public
307
- if (s.status === "local_only" || s.status === "pending") return { id: id, status: "pass", message: "Public distribution: " + s.status + " (private package, local install verified).", safeNextAction: null };
308
- if (s.status === "ready") return { id: id, status: "pass", message: "Public distribution gate: ready (score " + s.score + ").", safeNextAction: null };
309
- return { id: id, status: "warn", message: "Public distribution: " + s.status + " (score " + (s.score || "?") + ").", safeNextAction: s.safeNextAction || "Run: node bin/avorelo public-distribution --json" };
310
- }
311
-
312
- var CHECK_WEIGHTS = { install_ai: 10, first_value: 8, prelaunch_activation: 10, prelaunch_intelligence: 12, launch_hardening: 10, failure_recovery: 5, token_context_quality: 8, token_cost_discipline: 5, mcp_tool_governance: 8, hook_safety_boundaries: 8, support_bundle_redaction: 5, proof_outcome_evidence: 5, feedback_intelligence: 3, company_loop_recommendation: 2, known_limitations: 5, no_false_claims: 10, activation_distribution_readiness: 8, public_distribution_gate: 5, adapter_technical_readiness: 5 };
313
- var TOTAL_WEIGHT = Object.values(CHECK_WEIGHTS).reduce(function(a, b) { return a + b; }, 0);
314
-
315
- function scoreFullReadiness(checks) {
316
- var earned = 0;
317
- for (var i = 0; i < checks.length; i++) {
318
- var w = CHECK_WEIGHTS[checks[i].id] || 0;
319
- if (checks[i].status === "pass") earned += w;
320
- else if (checks[i].status === "warn") earned += w * 0.6;
321
- }
322
- return Math.round((earned / TOTAL_WEIGHT) * 100);
323
- }
324
-
325
- function runFullReadinessGate(cwd, options) {
326
- options = options || {};
327
- var signals = collectFullReadinessSignals(cwd, options);
328
- var knownLimitations = options.knownLimitations || null;
329
- var checks = [
330
- checkInstallAi(signals), checkFirstValue(signals), checkPrelaunchActivation(signals),
331
- checkPrelaunchIntelligence(signals), checkLaunchHardening(signals), checkFailureRecovery(signals),
332
- checkTokenContextQuality(signals), checkTokenCostDiscipline(signals), checkMcpToolGovernance(signals),
333
- checkHookSafetyBoundaries(signals), checkSupportBundleRedaction(signals), checkProofOutcomeEvidence(signals),
334
- checkFeedbackIntelligence(signals), checkCompanyLoopRecommendation(signals),
335
- checkKnownLimitations(signals, { knownLimitations: knownLimitations }), checkNoFalseClaims(signals),
336
- checkActivationDistributionReadiness(signals), checkPublicDistributionGate(signals),
337
- checkAdapterTechnicalReadiness(signals),
338
- ].map(function(check) { return Object.assign({ redacted: true }, check); });
339
- var score = scoreFullReadiness(checks);
340
- var blockers = checks.filter(function(c) { return c.status === "blocked"; });
341
- var warnings = checks.filter(function(c) { return c.status === "warn"; });
342
- var passes = checks.filter(function(c) { return c.status === "pass"; });
343
- var evidenceRefs = [
344
- ".claude/cco/orchestration/prelaunch-intelligence/latest-intelligence.json",
345
- ".claude/cco/orchestration/prelaunch-readiness/latest-activation-readiness.json",
346
- ".claude/cco/orchestration/launch-hardening/latest-gate.json",
347
- ".claude/cco/orchestration/mcp-tool-governance/latest-policy.json",
348
- ".claude/cco/orchestration/token-efficiency/latest-evidence.json",
349
- ".claude/cco/support/latest-support-bundle.json",
350
- ".claude/cco/orchestration/seamless-outcome/latest-value-summary.json",
351
- ".claude/cco/orchestration/company-loop/latest-report.json",
352
- ].filter(function(r) { return fs.existsSync(path.join(cwd, r)); });
353
-
354
- var status, releaseCandidateStatus;
355
- if (blockers.length > 0) { status = "blocked"; releaseCandidateStatus = "candidate_blocked"; }
356
- else if (score >= SCORE_READY) {
357
- var hasSparse = signals.feedbackIntelligence && signals.feedbackIntelligence.status === "insufficient_data" &&
358
- (signals.tokenCostIntelligence && (signals.tokenCostIntelligence.status === "not_available" || signals.tokenCostIntelligence.evidenceLevel === "not_available"));
359
- if (hasSparse) { status = "warn"; releaseCandidateStatus = "candidate_warn"; }
360
- else { status = "ready"; releaseCandidateStatus = "candidate_ready"; }
361
- } else if (score >= SCORE_WARN) { status = "warn"; releaseCandidateStatus = "candidate_warn"; }
362
- else { status = "insufficient_data"; releaseCandidateStatus = "insufficient_data"; }
363
-
364
- var decision;
365
- if (status === "ready") decision = "Release candidate criteria met. Evidence supports proceeding to distribution readiness.";
366
- else if (status === "warn") decision = "Not release-candidate ready yet. Incomplete evidence but no hard blockers.";
367
- else if (status === "blocked") decision = "Blocked by " + blockers.length + " hard blocker(s). Resolve before proceeding.";
368
- else decision = "Insufficient evidence to make a release candidate determination.";
369
-
370
- var recommendedNextPr;
371
- var evidenceOnlyWarnings = ["feedback_intelligence", "token_cost_discipline", "proof_outcome_evidence", "prelaunch_intelligence"];
372
- var nonEvidenceWarnings = warnings.filter(function(w) { return evidenceOnlyWarnings.indexOf(w.id) === -1; });
373
- if (status !== "blocked" && blockers.length === 0 && warnings.length > 0 && nonEvidenceWarnings.length === 0) recommendedNextPr = "GrowthBook Provider + Exposure Events";
374
- else if (warnings.some(function(w) { return w.id === "feedback_intelligence"; })) recommendedNextPr = "Operational: Import real design-partner feedback";
375
- else if (warnings.some(function(w) { return w.id === "token_cost_discipline"; })) recommendedNextPr = "Operational: Capture/import real token-cost evidence";
376
- else if (warnings.some(function(w) { return w.id === "proof_outcome_evidence"; })) recommendedNextPr = "Operational: Run proof after a real bounded task";
377
- else if (status === "ready" || (status === "warn" && blockers.length === 0)) recommendedNextPr = "Activation Distribution Readiness v1";
378
- else if (blockers.some(function(b) { return b.id === "mcp_tool_governance" || b.id === "hook_safety_boundaries"; })) recommendedNextPr = "Repair: MCP/Hook safety";
379
- else recommendedNextPr = "Dogfood / Feedback Collection pass";
380
-
381
- var firstBlocker = blockers[0];
382
- var firstWarning = warnings[0];
383
- var safeNextAction = (firstBlocker && firstBlocker.safeNextAction) || (firstWarning && firstWarning.safeNextAction) || "Run: node bin/avorelo release-candidate-bundle --json for full summary";
384
-
385
- var gate = {
386
- contract: CONTRACT, schemaVersion: SCHEMA_VERSION, createdAt: nowIso(),
387
- status: status, releaseCandidateStatus: releaseCandidateStatus, score: score, decision: decision,
388
- checks: checks, blockers: blockers, warnings: warnings, passes: passes.map(function(p) { return p.id; }),
389
- evidenceRefs: evidenceRefs,
390
- knownLimitationsRef: ".claude/cco/orchestration/full-readiness/latest-known-limitations.json",
391
- recommendedNextPr: recommendedNextPr, safeNextAction: safeNextAction,
392
- knownLimitationsCount: knownLimitations ? (knownLimitations.limitations || []).length : 0,
393
- noPublicLaunchClaim: true, noReleaseReadyClaimUnlessPassed: true, redacted: true,
394
- };
395
-
396
- try { appendProductLearningEvent(cwd, { eventName: "full_readiness_gate_run", category: "full_readiness", status: status, score: score, blockerCount: blockers.length, warningCount: warnings.length }); } catch (e) {}
397
- return gate;
398
- }
399
-
400
- function writeFullReadinessGate(cwd, gate) {
401
- var dir = path.join(cwd, GATE_DIR_REL);
402
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
403
- fs.writeFileSync(path.join(cwd, ARTIFACT_REL), JSON.stringify(gate, null, 2));
404
- return gate;
405
- }
406
-
407
- function buildFullReadinessSurface(cwd, options) {
408
- options = options || {};
409
- var gate = safeReadJson(path.join(cwd, ARTIFACT_REL));
410
- if (!gate) return { status: "not_available", score: null, releaseCandidateStatus: "insufficient_data", blockerCount: 0, warningCount: 0, knownLimitationsCount: 0, recommendedNextPr: null };
411
- return { status: gate.status, score: gate.score, releaseCandidateStatus: gate.releaseCandidateStatus, blockerCount: (gate.blockers || []).length, warningCount: (gate.warnings || []).length, knownLimitationsCount: gate.knownLimitationsCount || 0, recommendedNextPr: gate.recommendedNextPr, blockers: gate.blockers, noPublicLaunchClaim: true };
412
- }
413
-
414
- function formatFullReadinessText(gate, options) {
415
- options = options || {};
416
- var debug = options.debug === true;
417
- var lines = [];
418
- lines.push("Full readiness: " + gate.status);
419
- lines.push("Score: " + gate.score);
420
- lines.push("");
421
- lines.push("Decision:");
422
- lines.push(" " + gate.decision);
423
- if (gate.blockers.length > 0) {
424
- lines.push(""); lines.push("Blockers:");
425
- gate.blockers.forEach(function(b) { lines.push(" - " + b.message); if (b.safeNextAction) lines.push(" Next: " + b.safeNextAction); });
426
- } else { lines.push(""); lines.push("Blockers:"); lines.push(" none"); }
427
- if (gate.warnings.length > 0) {
428
- lines.push(""); lines.push("Warnings:");
429
- gate.warnings.forEach(function(w) { lines.push(" - " + w.message); });
430
- }
431
- if (debug) {
432
- lines.push(""); lines.push("Checks:");
433
- gate.checks.forEach(function(c) { lines.push(" " + c.status.padEnd(8) + " " + c.id + ": " + c.message); });
434
- lines.push(""); lines.push("Evidence refs: " + gate.evidenceRefs.length);
435
- lines.push("Release candidate status: " + gate.releaseCandidateStatus);
436
- }
437
- lines.push(""); lines.push("Next:"); lines.push(" " + gate.safeNextAction); lines.push(""); lines.push("No public launch claim.");
438
- return lines.join("\n");
439
- }
440
-
441
- module.exports = {
442
- CONTRACT, SCHEMA_VERSION, ARTIFACT_REL, GATE_DIR_REL, SCORE_READY, SCORE_WARN,
443
- runFullReadinessGate, collectFullReadinessSignals, scoreFullReadiness,
444
- writeFullReadinessGate, buildFullReadinessSurface, formatFullReadinessText,
445
- checkInstallAi, checkFirstValue, checkPrelaunchActivation, checkPrelaunchIntelligence,
446
- checkLaunchHardening, checkFailureRecovery, checkTokenContextQuality, checkTokenCostDiscipline,
447
- checkMcpToolGovernance, checkHookSafetyBoundaries, checkSupportBundleRedaction,
448
- checkProofOutcomeEvidence, checkFeedbackIntelligence, checkCompanyLoopRecommendation,
449
- checkKnownLimitations, checkNoFalseClaims, checkActivationDistributionReadiness,
450
- checkAdapterTechnicalReadiness, checkPublicDistributionGate,
451
- };
@@ -1,174 +0,0 @@
1
- "use strict";
2
-
3
- const { formatNextBoundedAction } = require("./proof-canonical");
4
-
5
- function extractContinueField(text, label) {
6
- const pattern = new RegExp(`^${label}:\\s*(.+)$`, "mi");
7
- const match = String(text || "").match(pattern);
8
- return match ? String(match[1]).trim() : "";
9
- }
10
-
11
- function parseContinueNote(text) {
12
- if (!String(text || "").trim()) return null;
13
-
14
- const whatHappened = extractContinueField(text, "What happened");
15
- const nextAction = extractContinueField(text, "Next");
16
- const preservedState = extractContinueField(text, "Preserved");
17
- const artifactPath = extractContinueField(text, "Artifact");
18
-
19
- if (!whatHappened && !nextAction && !preservedState && !artifactPath) {
20
- return null;
21
- }
22
-
23
- return {
24
- whatHappened,
25
- nextAction,
26
- preservedState,
27
- artifactPath: artifactPath || null,
28
- };
29
- }
30
-
31
- function buildFreshStartGuidance(onboardingReady) {
32
- const lines = ["## Avorelo Session Guidance", ""];
33
-
34
- if (onboardingReady) {
35
- lines.push("Fresh start.");
36
- lines.push("");
37
- lines.push("Run /avorelo-init, then avorelo status.");
38
- lines.push("Avorelo should stay quiet unless it needs to intervene or guide recovery.");
39
- return { text: lines.join("\n"), hasResume: false };
40
- }
41
-
42
- lines.push("Fresh start.");
43
- lines.push("");
44
- lines.push("Continue working normally.");
45
- lines.push("Use avorelo status if you want a quick check before the next step.");
46
- lines.push("Avorelo should stay quiet unless it needs to intervene or guide recovery.");
47
- return { text: lines.join("\n"), hasResume: false };
48
- }
49
-
50
- function buildCanonicalReentryGuidance(input = {}, parsedContinueNote = null) {
51
- const canonicalReentry =
52
- input.canonicalReentry && input.canonicalReentry.is_canonical_truth_available
53
- ? input.canonicalReentry
54
- : null;
55
- if (!canonicalReentry) return null;
56
-
57
- const carryForward = input.carryForward || null;
58
- const reentryState = input.reentryState || null;
59
- const lines = ["## Avorelo Session Guidance", "", "**Current bounded state**"];
60
- const nextAction =
61
- canonicalReentry.next_bounded_action_text ||
62
- formatNextBoundedAction(canonicalReentry.next_bounded_action) ||
63
- parsedContinueNote?.nextAction ||
64
- reentryState?.nextAction ||
65
- "Run avorelo status to inspect the current bounded state.";
66
- const preservedState =
67
- parsedContinueNote?.preservedState ||
68
- (carryForward?.toolHistory?.toolNames?.length
69
- ? `Recent tool context was preserved: ${carryForward.toolHistory.toolNames.join(", ")}.`
70
- : null);
71
- const artifactPath =
72
- canonicalReentry.state_source ||
73
- parsedContinueNote?.artifactPath ||
74
- reentryState?.primaryArtifactPath ||
75
- null;
76
-
77
- if (canonicalReentry.where_am_i_now) {
78
- lines.push(`- Where am I now: ${canonicalReentry.where_am_i_now}`);
79
- }
80
- if (canonicalReentry.what_can_i_honestly_claim) {
81
- lines.push(`- Honest claim: ${canonicalReentry.what_can_i_honestly_claim}`);
82
- }
83
- if (canonicalReentry.reentry_status) {
84
- lines.push(`- Re-entry: ${canonicalReentry.reentry_status}`);
85
- }
86
- lines.push(`- Next: ${nextAction}`);
87
- if (canonicalReentry.latest_trustworthy_run_id) {
88
- lines.push(`- Trustworthy run: ${canonicalReentry.latest_trustworthy_run_id}`);
89
- }
90
- if (canonicalReentry.readiness_state) {
91
- lines.push(`- Readiness: ${canonicalReentry.readiness_state}`);
92
- }
93
- if (canonicalReentry.rollback_available === true) {
94
- const rollbackSuffix = canonicalReentry.rollback_trigger ? ` (${canonicalReentry.rollback_trigger})` : "";
95
- lines.push(`- Rollback: available${rollbackSuffix}.`);
96
- }
97
- if (preservedState) {
98
- lines.push(`- Preserved: ${preservedState}`);
99
- }
100
- if (artifactPath) {
101
- lines.push(`- Artifact: ${artifactPath}`);
102
- }
103
- if (reentryState?.unresolvedRisk) {
104
- lines.push("- Risk: unresolved review still needs attention before the next unsafe step.");
105
- }
106
- lines.push("");
107
- lines.push("Avorelo is active. Continue with the next bounded step.");
108
-
109
- return {
110
- text: lines.join("\n"),
111
- hasResume: true,
112
- usedCanonicalTruth: true,
113
- };
114
- }
115
-
116
- function buildStartGuidance(input = {}) {
117
- const carryForward = input.carryForward || null;
118
- const reentryState = input.reentryState || null;
119
- const continueNote = parseContinueNote(input.continueNoteText || "");
120
- const onboardingReady = input.onboardingReady === true;
121
- const canonicalGuidance = buildCanonicalReentryGuidance(input, continueNote);
122
- if (canonicalGuidance) {
123
- return canonicalGuidance;
124
- }
125
-
126
- const lines = ["## Avorelo Session Guidance", ""];
127
-
128
- const hasResume = Boolean(continueNote || reentryState || carryForward);
129
- if (!hasResume) {
130
- return buildFreshStartGuidance(onboardingReady);
131
- }
132
-
133
- const whatHappened =
134
- continueNote?.whatHappened ||
135
- (reentryState?.lastInterventionType && reentryState.lastInterventionType !== "none"
136
- ? `The last session ended after ${reentryState.lastInterventionType.replace(/_/g, " ")}.`
137
- : "The last session left a bounded continuation cue.");
138
- const nextAction =
139
- continueNote?.nextAction ||
140
- reentryState?.nextAction ||
141
- "Run avorelo status to continue.";
142
- const preservedState =
143
- continueNote?.preservedState ||
144
- (carryForward?.toolHistory?.toolNames?.length
145
- ? `Recent tool context was preserved: ${carryForward.toolHistory.toolNames.join(", ")}.`
146
- : "Bounded local evidence from the last session was preserved.");
147
- const artifactPath =
148
- continueNote?.artifactPath ||
149
- reentryState?.primaryArtifactPath ||
150
- null;
151
-
152
- lines.push("**Resume cue**");
153
- lines.push(`- What happened: ${whatHappened}`);
154
- lines.push(`- Next: ${nextAction}`);
155
- lines.push(`- Preserved: ${preservedState}`);
156
- if (artifactPath) {
157
- lines.push(`- Artifact: ${artifactPath}`);
158
- }
159
- if (reentryState?.unresolvedRisk) {
160
- lines.push("- Risk: unresolved risk still needs review before the next unsafe step.");
161
- }
162
- lines.push("");
163
- lines.push("Avorelo is active. Continue with the next bounded step.");
164
-
165
- return {
166
- text: lines.join("\n"),
167
- hasResume: true,
168
- };
169
- }
170
-
171
- module.exports = {
172
- buildStartGuidance,
173
- parseContinueNote,
174
- };