agentera 3.0.0-dev.5 → 3.0.0-dev.51

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 (598) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +119 -22
  3. package/bundle/CHANGELOG.md +1351 -0
  4. package/bundle/DESIGN.md +229 -0
  5. package/bundle/LICENSE +201 -0
  6. package/bundle/README.md +143 -0
  7. package/bundle/UPGRADE.md +236 -0
  8. package/bundle/extract-corpus-parity.json +21 -0
  9. package/bundle/fixtures/routing/hybrid-corpus.yaml +154 -0
  10. package/bundle/references/adapters/package-publication.json +437 -0
  11. package/bundle/references/adapters/package-registry.yaml +435 -189
  12. package/bundle/references/adapters/package-surface-characterization.md +66 -35
  13. package/bundle/references/adapters/runtime-lifecycle-adapters.yaml +74 -0
  14. package/bundle/references/adapters/runtime-lifecycle-authority.yaml +62 -0
  15. package/bundle/references/adapters/runtime-lifecycle-operation-contract.yaml +84 -0
  16. package/bundle/references/adapters/runtime-retired-resources.yaml +333 -0
  17. package/bundle/references/analysis/evidence-tier-authority.yaml +518 -0
  18. package/bundle/references/analysis/verification-policy.yaml +191 -0
  19. package/bundle/references/artifacts/artifact-registry-interface-model.yaml +20 -10
  20. package/bundle/references/artifacts/glossary-entry-contract.yaml +1254 -0
  21. package/bundle/references/artifacts/state-storage-authority.yaml +3022 -0
  22. package/bundle/references/artifacts/verbosity-budget-authority.yaml +42 -0
  23. package/bundle/references/cli/app-lifecycle-vocabulary.yaml +7 -8
  24. package/bundle/references/cli/capability-instruction-contract.yaml +11 -14
  25. package/bundle/references/cli/hybrid-route-contract.yaml +438 -0
  26. package/bundle/references/cli/routing-model.md +155 -0
  27. package/bundle/references/cli/trigger-schema-enrichment.md +147 -0
  28. package/bundle/references/cli/update-channels.yaml +19 -1
  29. package/bundle/references/cli/vocabulary-index.yaml +20 -17
  30. package/bundle/references/cli/vocabulary.md +326 -361
  31. package/bundle/references/meta/retained-reference-authority.yaml +151 -0
  32. package/bundle/registry.json +13 -13
  33. package/bundle/skills/agentera/SKILL.md +224 -422
  34. package/bundle/skills/agentera/capabilities/audit/schemas/artifacts.yaml +84 -0
  35. package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/exit.yaml +2 -2
  36. package/bundle/skills/agentera/capabilities/audit/schemas/triggers.yaml +25 -0
  37. package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/validation.yaml +37 -18
  38. package/bundle/skills/agentera/capabilities/build/schemas/artifacts.yaml +102 -0
  39. package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/exit.yaml +6 -5
  40. package/bundle/skills/agentera/capabilities/build/schemas/triggers.yaml +27 -0
  41. package/bundle/skills/agentera/capabilities/build/schemas/validation.yaml +176 -0
  42. package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/artifacts.yaml +12 -12
  43. package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/exit.yaml +5 -5
  44. package/bundle/skills/agentera/capabilities/design/schemas/triggers.yaml +16 -0
  45. package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/validation.yaml +7 -7
  46. package/bundle/skills/agentera/capabilities/discuss/schemas/artifacts.yaml +51 -0
  47. package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/exit.yaml +2 -2
  48. package/bundle/skills/agentera/capabilities/discuss/schemas/triggers.yaml +20 -0
  49. package/bundle/skills/agentera/capabilities/discuss/schemas/validation.yaml +144 -0
  50. package/bundle/skills/agentera/capabilities/document/schemas/artifacts.yaml +80 -0
  51. package/bundle/skills/agentera/capabilities/document/schemas/triggers.yaml +16 -0
  52. package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/validation.yaml +18 -18
  53. package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/artifacts.yaml +18 -18
  54. package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/exit.yaml +2 -2
  55. package/bundle/skills/agentera/capabilities/optimize/schemas/triggers.yaml +16 -0
  56. package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/validation.yaml +9 -9
  57. package/bundle/skills/agentera/capabilities/orchestrate/schemas/artifacts.yaml +76 -0
  58. package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/exit.yaml +9 -7
  59. package/bundle/skills/agentera/capabilities/orchestrate/schemas/triggers.yaml +23 -0
  60. package/bundle/skills/agentera/capabilities/orchestrate/schemas/validation.yaml +121 -0
  61. package/bundle/skills/agentera/capabilities/plan/schemas/artifacts.yaml +66 -0
  62. package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/exit.yaml +2 -2
  63. package/bundle/skills/agentera/capabilities/plan/schemas/triggers.yaml +23 -0
  64. package/bundle/skills/agentera/capabilities/plan/schemas/validation.yaml +121 -0
  65. package/bundle/skills/agentera/capabilities/profile/schemas/artifacts.yaml +23 -0
  66. package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/exit.yaml +6 -5
  67. package/bundle/skills/agentera/capabilities/profile/schemas/triggers.yaml +20 -0
  68. package/bundle/skills/agentera/capabilities/profile/schemas/validation.yaml +115 -0
  69. package/bundle/skills/agentera/capabilities/research/schemas/artifacts.yaml +24 -0
  70. package/bundle/skills/agentera/capabilities/research/schemas/triggers.yaml +16 -0
  71. package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/validation.yaml +2 -2
  72. package/bundle/skills/agentera/capabilities/status/schemas/artifacts.yaml +73 -0
  73. package/bundle/skills/agentera/capabilities/status/schemas/triggers.yaml +22 -0
  74. package/bundle/skills/agentera/capabilities/{hej → status}/schemas/validation.yaml +5 -5
  75. package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/artifacts.yaml +16 -16
  76. package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/exit.yaml +7 -6
  77. package/bundle/skills/agentera/capabilities/vision/schemas/triggers.yaml +23 -0
  78. package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/validation.yaml +18 -20
  79. package/bundle/skills/agentera/capability_schema_contract.yaml +178 -34
  80. package/bundle/skills/agentera/protocol.yaml +31 -31
  81. package/bundle/skills/agentera/route-phrases.yaml +81 -0
  82. package/bundle/skills/agentera/schemas/artifacts/changelog.yaml +5 -4
  83. package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +39 -21
  84. package/bundle/skills/agentera/schemas/artifacts/design.yaml +5 -4
  85. package/bundle/skills/agentera/schemas/artifacts/docs.yaml +15 -19
  86. package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +145 -14
  87. package/bundle/skills/agentera/schemas/artifacts/glossary.yaml +82 -0
  88. package/bundle/skills/agentera/schemas/artifacts/health.yaml +58 -21
  89. package/bundle/skills/agentera/schemas/artifacts/objective.yaml +22 -8
  90. package/bundle/skills/agentera/schemas/artifacts/plan.yaml +458 -36
  91. package/bundle/skills/agentera/schemas/artifacts/progress.yaml +128 -17
  92. package/bundle/skills/agentera/schemas/artifacts/todo.yaml +342 -42
  93. package/bundle/skills/agentera/schemas/artifacts/vision.yaml +3 -3
  94. package/dist/analytics/extractCorpus/cli.js +190 -0
  95. package/dist/analytics/extractCorpus/copilotSessions.js +275 -0
  96. package/dist/analytics/extractCorpus/core.js +392 -0
  97. package/dist/analytics/extractCorpus/corpus.js +167 -0
  98. package/dist/analytics/extractCorpus/coverageAudit.js +260 -0
  99. package/dist/analytics/extractCorpus/cursorSessions.js +425 -0
  100. package/dist/analytics/extractCorpus/evidenceTiers.js +603 -0
  101. package/dist/analytics/extractCorpus/extractCorpusParity.js +105 -0
  102. package/dist/analytics/extractCorpus/filesystemSources.js +118 -0
  103. package/dist/analytics/extractCorpus/index.js +14 -0
  104. package/dist/analytics/extractCorpus/jsonlSessions.js +204 -0
  105. package/dist/analytics/extractCorpus/sqliteCaps.js +43 -0
  106. package/dist/analytics/extractCorpus/sqliteSessions.js +367 -0
  107. package/dist/analytics/extractCorpus/tierReader.js +108 -0
  108. package/dist/analytics/extractCorpus.js +2 -1791
  109. package/dist/analytics/glossaryAdviceResolution.js +166 -0
  110. package/dist/analytics/glossaryInputAcquisition.js +319 -0
  111. package/dist/analytics/personalGlossaryAdmission.js +133 -0
  112. package/dist/analytics/personalGlossaryProfile.js +219 -0
  113. package/dist/analytics/profileSignals.js +211 -0
  114. package/dist/analytics/usageStats.js +169 -42
  115. package/dist/audit/terminologyDrift.js +281 -0
  116. package/dist/bin/agentera.js +3 -2
  117. package/dist/capabilities/audit/instructions.js +16 -0
  118. package/dist/capabilities/build/instructions.js +56 -0
  119. package/dist/capabilities/design/instructions.js +4 -0
  120. package/dist/capabilities/discuss/instructions.js +29 -0
  121. package/dist/capabilities/document/instructions.js +11 -0
  122. package/dist/capabilities/index.js +29 -27
  123. package/dist/capabilities/optimize/instructions.js +14 -0
  124. package/dist/capabilities/orchestrate/instructions.js +42 -0
  125. package/dist/capabilities/plan/instructions.js +33 -0
  126. package/dist/capabilities/profile/instructions.js +70 -0
  127. package/dist/capabilities/research/instructions.js +5 -0
  128. package/dist/capabilities/status/instructions.js +15 -0
  129. package/dist/capabilities/status/startupInstructions.js +34 -0
  130. package/dist/capabilities/vision/instructions.js +4 -0
  131. package/dist/cli/appContext.js +30 -24
  132. package/dist/cli/argvalidate.js +0 -1
  133. package/dist/cli/capabilityContext/benchmark.js +565 -0
  134. package/dist/cli/capabilityContext/bespoke.js +44 -0
  135. package/dist/cli/capabilityContext/build.js +242 -0
  136. package/dist/cli/capabilityContext/closeout.js +233 -0
  137. package/dist/cli/capabilityContext/contract.js +179 -0
  138. package/dist/cli/capabilityContext/evidence.js +463 -0
  139. package/dist/cli/capabilityContext/index.js +3 -0
  140. package/dist/cli/capabilityContext/orchestration.js +131 -0
  141. package/dist/cli/capabilityContext/planState.js +260 -0
  142. package/dist/cli/capabilityContext/progress.js +142 -0
  143. package/dist/cli/capabilityContext/projectVerification.js +409 -0
  144. package/dist/cli/capabilityContext/shared.js +83 -0
  145. package/dist/cli/capabilityContext/slim.js +152 -0
  146. package/dist/cli/capabilityContext/startup.js +150 -0
  147. package/dist/cli/capabilityContext/startupAggregation.js +68 -0
  148. package/dist/cli/capabilityContext/types.js +56 -0
  149. package/dist/cli/capabilityContext.js +1 -2487
  150. package/dist/cli/commands/appHome.js +22 -0
  151. package/dist/cli/commands/capability.js +4 -4
  152. package/dist/cli/commands/compact.js +164 -14
  153. package/dist/cli/commands/doctor.js +122 -97
  154. package/dist/cli/commands/durability.js +81 -0
  155. package/dist/cli/commands/glossaryAdvice.js +138 -0
  156. package/dist/cli/commands/lint.js +26 -44
  157. package/dist/cli/commands/personalGlossary.js +176 -0
  158. package/dist/cli/commands/prime/briefOrientation.js +747 -0
  159. package/dist/cli/commands/prime/buildExecutionRequest.js +165 -0
  160. package/dist/cli/commands/prime/bundleStatus.js +190 -0
  161. package/dist/cli/commands/prime/collectEntityOrientation.js +326 -0
  162. package/dist/cli/commands/prime/collectOrientationState.js +212 -0
  163. package/dist/cli/commands/prime/orientationOutput.js +399 -0
  164. package/dist/cli/commands/prime/types.js +1 -0
  165. package/dist/cli/commands/prime/v1Migration.js +38 -0
  166. package/dist/cli/commands/prime.js +80 -558
  167. package/dist/cli/commands/profileGrounding.js +55 -0
  168. package/dist/cli/commands/query.js +78 -53
  169. package/dist/cli/commands/report.js +96 -25
  170. package/dist/cli/commands/route.js +142 -0
  171. package/dist/cli/commands/schema.js +266 -143
  172. package/dist/cli/commands/state/decisions.js +387 -0
  173. package/dist/cli/commands/state/docs.js +70 -0
  174. package/dist/cli/commands/state/experimentRecords.js +151 -0
  175. package/dist/cli/commands/state/experiments.js +14 -0
  176. package/dist/cli/commands/state/get.js +129 -0
  177. package/dist/cli/commands/state/health.js +14 -0
  178. package/dist/cli/commands/state/index.js +16 -0
  179. package/dist/cli/commands/state/list.js +194 -0
  180. package/dist/cli/commands/state/objective.js +25 -0
  181. package/dist/cli/commands/state/plan.js +14 -0
  182. package/dist/cli/commands/state/planTasks.js +154 -0
  183. package/dist/cli/commands/state/plans.js +154 -0
  184. package/dist/cli/commands/state/progress.js +13 -0
  185. package/dist/cli/commands/state/shared.js +14 -0
  186. package/dist/cli/commands/state/todo.js +42 -0
  187. package/dist/cli/commands/state/write.js +430 -0
  188. package/dist/cli/commands/upgrade.js +146 -5
  189. package/dist/cli/commands/upgradeVerify.js +118 -0
  190. package/dist/cli/commands/validate.js +272 -223
  191. package/dist/cli/commands/verify.js +24 -9
  192. package/dist/cli/contracts/bundleStatus.js +1 -0
  193. package/dist/cli/contracts/orientationState.js +1 -0
  194. package/dist/cli/dispatch/argvParser.js +32 -0
  195. package/dist/cli/dispatch/check.js +372 -0
  196. package/dist/cli/dispatch/commands.js +27 -0
  197. package/dist/cli/dispatch/index.js +207 -0
  198. package/dist/cli/dispatch/lifecycle.js +652 -0
  199. package/dist/cli/dispatch/prime.js +139 -0
  200. package/dist/cli/dispatch/projections.js +17 -0
  201. package/dist/cli/dispatch/shared.js +63 -0
  202. package/dist/cli/dispatch/state.js +140 -0
  203. package/dist/cli/dispatch.js +1 -1294
  204. package/dist/cli/errors.js +16 -17
  205. package/dist/cli/help.js +394 -43
  206. package/dist/cli/migrationRequired.js +87 -0
  207. package/dist/cli/orientation/attention.js +61 -0
  208. package/dist/cli/orientation/corpusCoverage.js +102 -0
  209. package/dist/cli/orientation.js +438 -170
  210. package/dist/cli/planArtifacts.js +350 -0
  211. package/dist/cli/planEvidence.js +157 -0
  212. package/dist/cli/planLifecycleState.js +36 -0
  213. package/dist/cli/planTaskIndex.js +11 -0
  214. package/dist/cli/preCutoverCommand.js +32 -0
  215. package/dist/cli/prime-blob.js +71 -3
  216. package/dist/cli/profileAcquisition.js +167 -0
  217. package/dist/cli/startupCompletenessContract.js +59 -0
  218. package/dist/cli/stateQuery.js +56 -14
  219. package/dist/cli/structured.js +0 -1
  220. package/dist/cli/todoMarkdown.js +25 -12
  221. package/dist/cli/todoReadinessSelection.js +192 -0
  222. package/dist/cli/todoSeverity.js +18 -0
  223. package/dist/core/atomicWriter.js +20 -0
  224. package/dist/core/developmentChannel.js +1 -0
  225. package/dist/core/developmentInvocation.js +374 -0
  226. package/dist/core/difflib.js +0 -1
  227. package/dist/core/envPaths.js +20 -0
  228. package/dist/core/jsonValue.js +5 -0
  229. package/dist/core/paths.js +0 -1
  230. package/dist/core/pyjson.js +67 -3
  231. package/dist/core/shell.js +4 -0
  232. package/dist/core/skillIdentity.js +23 -0
  233. package/dist/core/sourceRoot.js +9 -12
  234. package/dist/core/text.js +10 -0
  235. package/dist/core/toml.js +0 -1
  236. package/dist/core/yaml.js +8 -1
  237. package/dist/eval/evalSkills.js +30 -26
  238. package/dist/eval/hybridRouteEvaluation.js +155 -0
  239. package/dist/eval/semanticEval.js +43 -20
  240. package/dist/eval/semanticFixtures.js +16 -5
  241. package/dist/hooks/common.js +11 -79
  242. package/dist/hooks/compaction/apply.js +446 -0
  243. package/dist/hooks/compaction/dryRun.js +184 -0
  244. package/dist/hooks/compaction/index.js +22 -0
  245. package/dist/hooks/compaction/parse.js +325 -0
  246. package/dist/hooks/compaction/retention.js +202 -0
  247. package/dist/hooks/compaction/status.js +360 -0
  248. package/dist/hooks/compaction/types.js +5 -0
  249. package/dist/hooks/validateArtifact/agentFacing.js +9 -0
  250. package/dist/hooks/validateArtifact/index.js +92 -0
  251. package/dist/hooks/validateArtifact/markdown.js +145 -0
  252. package/dist/hooks/validateArtifact/schema.js +546 -0
  253. package/dist/hooks/validateArtifact/traversal.js +107 -0
  254. package/dist/hooks/validateArtifact/violations.js +107 -0
  255. package/dist/migrate/v2HandoffManifest.js +452 -0
  256. package/dist/registries/activationContract.js +2 -0
  257. package/dist/registries/activationTuples.js +107 -0
  258. package/dist/registries/artifactProtocolIds.js +78 -0
  259. package/dist/registries/artifactRegistry.js +224 -63
  260. package/dist/registries/artifactSchemaProjection.js +45 -0
  261. package/dist/registries/capabilityContract.js +129 -2
  262. package/dist/registries/evaluatorHandoffContract.js +2 -3
  263. package/dist/registries/evidenceTierContract.js +371 -0
  264. package/dist/registries/glossaryAdviceContract.js +79 -0
  265. package/dist/registries/glossaryCaveatContract.js +67 -0
  266. package/dist/registries/glossaryConsumerContractValidation.js +787 -0
  267. package/dist/registries/glossaryEntryContract.js +757 -0
  268. package/dist/registries/glossaryTermIdentity.js +17 -0
  269. package/dist/registries/glossaryTermOccurrence.js +20 -0
  270. package/dist/registries/hybridRoute.js +274 -0
  271. package/dist/registries/hybridRouteReceipt.js +221 -0
  272. package/dist/registries/packagePublication.js +229 -0
  273. package/dist/registries/packageRegistry.js +187 -211
  274. package/dist/registries/todoReadinessContract.js +448 -0
  275. package/dist/registries/triggerLoader.js +174 -0
  276. package/dist/registries/verbosityBudgetContract.js +205 -0
  277. package/dist/release/releaseMetadata.js +385 -0
  278. package/dist/runtime/lifecycleAdapterContract.js +457 -0
  279. package/dist/runtime/lifecycleAdapters.js +777 -0
  280. package/dist/runtime/lifecycleAuthority.js +453 -0
  281. package/dist/runtime/lifecycleOperationContract.js +123 -0
  282. package/dist/runtime/lifecycleOperations.js +634 -0
  283. package/dist/runtime/lifecycleOwnershipJournal.js +622 -0
  284. package/dist/runtime/lifecyclePublication.js +415 -0
  285. package/dist/runtime/lifecycleSnapshot.js +438 -0
  286. package/dist/runtime/nativeResourceCleanup.js +502 -0
  287. package/dist/setup/opencode.js +20 -0
  288. package/dist/setup/opencodeConstants.js +1 -0
  289. package/dist/setup/sharedSkill.js +45 -0
  290. package/dist/setup/smokeChecks.js +21 -82
  291. package/dist/state/archiveDiscovery.js +580 -0
  292. package/dist/state/archivePublication.js +225 -0
  293. package/dist/state/archiveRecovery.js +237 -0
  294. package/dist/state/archiveReplay.js +53 -0
  295. package/dist/state/canonicalMigrationRecord.js +36 -0
  296. package/dist/state/changelog.js +221 -0
  297. package/dist/state/decisionEntities.js +367 -0
  298. package/dist/state/decisionLegacyValidation.js +215 -0
  299. package/dist/state/decisionMigrationProvenance.js +199 -0
  300. package/dist/state/decisionOverlay.js +254 -0
  301. package/dist/state/decisionRevision.js +256 -0
  302. package/dist/state/decisionRevisionMigration.js +89 -0
  303. package/dist/state/directRetrieval.js +323 -0
  304. package/dist/state/durability.js +324 -0
  305. package/dist/state/entityCutover.js +459 -0
  306. package/dist/state/entityCutoverGit.js +127 -0
  307. package/dist/state/entityGlossaryAuthority.js +13 -0
  308. package/dist/state/entityListProjection.js +187 -0
  309. package/dist/state/entityListRuntimeRegistry.js +85 -0
  310. package/dist/state/entityMigrationCausality.js +97 -0
  311. package/dist/state/entityMigrationIdentity.js +5 -0
  312. package/dist/state/entityMigrationPreview.js +846 -0
  313. package/dist/state/entityMigrationTodo.js +133 -0
  314. package/dist/state/entityPublicationContext.js +806 -0
  315. package/dist/state/entityRetrievalHelp.js +506 -0
  316. package/dist/state/entityStorage.js +899 -0
  317. package/dist/state/exactReplacementRecovery.js +18 -0
  318. package/dist/state/experimentArchive.js +63 -0
  319. package/dist/state/experimentIdentity.js +202 -0
  320. package/dist/state/healthEntities.js +262 -0
  321. package/dist/state/healthEntityValidation.js +18 -0
  322. package/dist/state/healthRepair.js +69 -0
  323. package/dist/state/installRoot.js +64 -25
  324. package/dist/state/legacyEntityCutoverEvidence.js +65 -0
  325. package/dist/state/legacyIdentity.js +47 -0
  326. package/dist/state/legacySummaryRecord.js +6 -0
  327. package/dist/state/listAccounting.js +54 -0
  328. package/dist/state/listClassification.js +17 -0
  329. package/dist/state/listCursor.js +42 -0
  330. package/dist/state/listRetrieval.js +781 -0
  331. package/dist/state/migrationSourceBinding.js +30 -0
  332. package/dist/state/objectiveExperimentEntities.js +322 -0
  333. package/dist/state/planEntities.js +982 -0
  334. package/dist/state/planIdentity.js +47 -0
  335. package/dist/state/planLineageValidation.js +52 -0
  336. package/dist/state/planReplacementTransaction.js +475 -0
  337. package/dist/state/planRetrieval.js +313 -0
  338. package/dist/state/planTaskRetrieval.js +294 -0
  339. package/dist/state/progressEntities.js +512 -0
  340. package/dist/state/progressGlossaryCaveat.js +168 -0
  341. package/dist/state/progressPublicationOrder.js +19 -0
  342. package/dist/state/projectRoot.js +62 -0
  343. package/dist/state/projectionPolicy.js +190 -0
  344. package/dist/state/retrievalAuthority.js +156 -0
  345. package/dist/state/safeProjectFile.js +155 -0
  346. package/dist/state/startupAnalysis/benchmark.js +432 -0
  347. package/dist/state/startupAnalysis/contract.js +160 -0
  348. package/dist/state/startupAnalysis/helpers.js +286 -0
  349. package/dist/state/startupAnalysis/index.js +6 -0
  350. package/dist/state/startupAnalysis/metrics.js +340 -0
  351. package/dist/state/startupAnalysis/records.js +198 -0
  352. package/dist/state/startupAnalysis/report.js +111 -0
  353. package/dist/state/startupAnalysis/threshold.js +512 -0
  354. package/dist/state/startupAnalysis.js +2 -1953
  355. package/dist/state/startupProjection.js +499 -0
  356. package/dist/state/stateMode.js +85 -0
  357. package/dist/state/stateStorageAuthority.js +47 -0
  358. package/dist/state/summaryEntityRead.js +25 -0
  359. package/dist/state/summaryMigrationProvenance.js +66 -0
  360. package/dist/state/summarySourceRowAuthority.js +36 -0
  361. package/dist/state/todoActivationSafety.js +58 -0
  362. package/dist/state/todoDocsEntities.js +1069 -0
  363. package/dist/state/todoDocsEntityValidation.js +158 -0
  364. package/dist/state/todoMarkdownProjection.js +51 -0
  365. package/dist/state/todoReconciliationActivation.js +140 -0
  366. package/dist/state/todoReconciliationInspection.js +169 -0
  367. package/dist/state/todoReconciliationRepair.js +170 -0
  368. package/dist/state/todoReconciliationTransaction.js +582 -0
  369. package/dist/state/write/assign.js +20 -0
  370. package/dist/state/write/candidateMutation.js +269 -0
  371. package/dist/state/write/errors.js +11 -0
  372. package/dist/state/write/experimentPublication.js +192 -0
  373. package/dist/state/write/explain.js +363 -0
  374. package/dist/state/write/fields.js +61 -0
  375. package/dist/state/write/glossaryPublication.js +263 -0
  376. package/dist/state/write/grammar.js +285 -0
  377. package/dist/state/write/helpers.js +29 -0
  378. package/dist/state/write/index.js +12 -0
  379. package/dist/state/write/input.js +367 -0
  380. package/dist/state/write/lock.js +837 -0
  381. package/dist/state/write/mutation.js +234 -0
  382. package/dist/state/write/operations.js +170 -0
  383. package/dist/state/write/planEvaluation.js +128 -0
  384. package/dist/state/write/planPublication.js +179 -0
  385. package/dist/state/write/runtimeOperations.js +144 -0
  386. package/dist/state/write/serialize.js +1 -0
  387. package/dist/state/write/transaction.js +52 -0
  388. package/dist/state/write/validate.js +7 -0
  389. package/dist/upgrade/appContentRefresh.js +383 -0
  390. package/dist/upgrade/appModel.js +8 -7
  391. package/dist/upgrade/atomicWriter.js +1 -0
  392. package/dist/upgrade/bundleEvidence.js +33 -0
  393. package/dist/upgrade/channels.js +12 -8
  394. package/dist/upgrade/compatibility.js +56 -21
  395. package/dist/upgrade/doctor.js +197 -192
  396. package/dist/upgrade/doctorClassifier.js +187 -0
  397. package/dist/upgrade/installedHooksRetirement.js +196 -0
  398. package/dist/upgrade/legacyAgentCleanup.js +282 -0
  399. package/dist/upgrade/lifecycleUpgrade.js +113 -0
  400. package/dist/upgrade/migrateArtifactsV2ToV3.js +367 -149
  401. package/dist/upgrade/migrationPublication.js +122 -0
  402. package/dist/upgrade/nextMajorDoctor.js +42 -8
  403. package/dist/upgrade/npxPlatformStatus.js +22 -0
  404. package/dist/upgrade/projectIntegration.js +145 -187
  405. package/dist/upgrade/projectIntegrationDecision.js +50 -0
  406. package/dist/upgrade/retiredResourceDiagnostics.js +117 -0
  407. package/dist/upgrade/runtimeMigration.js +273 -363
  408. package/dist/upgrade/upgradeCommands.js +14 -1
  409. package/dist/upgrade/upgradeLock.js +85 -0
  410. package/dist/upgrade/upgradeOrchestrator.js +263 -59
  411. package/dist/upgrade/v3CapabilitySurface.js +14 -0
  412. package/dist/upgrade/versionResolution.js +8 -1
  413. package/dist/validate/activationArtifactEvidence.js +844 -0
  414. package/dist/validate/activationConjunction.js +816 -0
  415. package/dist/validate/activationEvidenceManifest.js +515 -0
  416. package/dist/validate/activationPackageSemantics.js +29 -0
  417. package/dist/validate/appHomeContract.js +5 -11
  418. package/dist/validate/bootstrapAuthority.js +44 -0
  419. package/dist/validate/capability.js +133 -12
  420. package/dist/validate/crossCapability.js +15 -10
  421. package/dist/validate/retainedReferenceAuthority.js +879 -0
  422. package/dist/validate/selfAudit.js +73 -37
  423. package/dist/validate/v1LegacyCruft.js +131 -0
  424. package/dist/validate/vocabularyAuthority.js +303 -0
  425. package/package.json +53 -27
  426. package/bundle/references/adapters/cursor.md +0 -213
  427. package/bundle/references/adapters/opencode.md +0 -530
  428. package/bundle/references/adapters/package-manifest-interface-model.yaml +0 -337
  429. package/bundle/references/adapters/runtime-adapter-characterization.md +0 -79
  430. package/bundle/references/adapters/runtime-adapter-interface-model.yaml +0 -200
  431. package/bundle/references/adapters/runtime-adapter-registry.yaml +0 -548
  432. package/bundle/references/adapters/runtime-feature-parity.md +0 -189
  433. package/bundle/references/analysis/benchmark.md +0 -267
  434. package/bundle/references/analysis/startup-measurement-contract.yaml +0 -424
  435. package/bundle/references/cli/agent-ready-state-contract.yaml +0 -953
  436. package/bundle/references/cli/audience-namespace-cli-migration.yaml +0 -355
  437. package/bundle/references/cli/bundle-skill-vocabulary.yaml +0 -278
  438. package/bundle/references/cli/capability-tool-classification.yaml +0 -53
  439. package/bundle/references/cli/routing-execution-vocabulary.yaml +0 -281
  440. package/bundle/references/meta/documentation-inventory.md +0 -43
  441. package/bundle/references/v1-section-mapping.md +0 -47
  442. package/bundle/skills/agentera/.claude-plugin/plugin.json +0 -27
  443. package/bundle/skills/agentera/agents/dokumentera.toml +0 -6
  444. package/bundle/skills/agentera/agents/hej.toml +0 -6
  445. package/bundle/skills/agentera/agents/inspektera.toml +0 -6
  446. package/bundle/skills/agentera/agents/inspirera.toml +0 -6
  447. package/bundle/skills/agentera/agents/optimera.toml +0 -6
  448. package/bundle/skills/agentera/agents/orkestrera.toml +0 -6
  449. package/bundle/skills/agentera/agents/planera.toml +0 -6
  450. package/bundle/skills/agentera/agents/profilera.toml +0 -6
  451. package/bundle/skills/agentera/agents/realisera.toml +0 -6
  452. package/bundle/skills/agentera/agents/resonera.toml +0 -6
  453. package/bundle/skills/agentera/agents/visionera.toml +0 -6
  454. package/bundle/skills/agentera/agents/visualisera.toml +0 -6
  455. package/bundle/skills/agentera/capabilities/dokumentera/schemas/artifacts.yaml +0 -73
  456. package/bundle/skills/agentera/capabilities/dokumentera/schemas/triggers.yaml +0 -35
  457. package/bundle/skills/agentera/capabilities/hej/schemas/artifacts.yaml +0 -69
  458. package/bundle/skills/agentera/capabilities/hej/schemas/triggers.yaml +0 -58
  459. package/bundle/skills/agentera/capabilities/inspektera/schemas/artifacts.yaml +0 -76
  460. package/bundle/skills/agentera/capabilities/inspektera/schemas/triggers.yaml +0 -38
  461. package/bundle/skills/agentera/capabilities/inspirera/schemas/artifacts.yaml +0 -24
  462. package/bundle/skills/agentera/capabilities/inspirera/schemas/triggers.yaml +0 -34
  463. package/bundle/skills/agentera/capabilities/optimera/schemas/triggers.yaml +0 -39
  464. package/bundle/skills/agentera/capabilities/orkestrera/schemas/artifacts.yaml +0 -64
  465. package/bundle/skills/agentera/capabilities/orkestrera/schemas/triggers.yaml +0 -42
  466. package/bundle/skills/agentera/capabilities/orkestrera/schemas/validation.yaml +0 -120
  467. package/bundle/skills/agentera/capabilities/planera/schemas/artifacts.yaml +0 -62
  468. package/bundle/skills/agentera/capabilities/planera/schemas/triggers.yaml +0 -34
  469. package/bundle/skills/agentera/capabilities/planera/schemas/validation.yaml +0 -61
  470. package/bundle/skills/agentera/capabilities/profilera/schemas/artifacts.yaml +0 -18
  471. package/bundle/skills/agentera/capabilities/profilera/schemas/triggers.yaml +0 -45
  472. package/bundle/skills/agentera/capabilities/profilera/schemas/validation.yaml +0 -57
  473. package/bundle/skills/agentera/capabilities/realisera/schemas/artifacts.yaml +0 -80
  474. package/bundle/skills/agentera/capabilities/realisera/schemas/triggers.yaml +0 -39
  475. package/bundle/skills/agentera/capabilities/realisera/schemas/validation.yaml +0 -110
  476. package/bundle/skills/agentera/capabilities/resonera/schemas/artifacts.yaml +0 -47
  477. package/bundle/skills/agentera/capabilities/resonera/schemas/triggers.yaml +0 -46
  478. package/bundle/skills/agentera/capabilities/resonera/schemas/validation.yaml +0 -77
  479. package/bundle/skills/agentera/capabilities/visionera/schemas/triggers.yaml +0 -41
  480. package/bundle/skills/agentera/capabilities/visualisera/schemas/triggers.yaml +0 -33
  481. package/bundle/skills/agentera/references/contract.md +0 -1039
  482. package/bundle/skills/hej/.claude-plugin/plugin.json +0 -6
  483. package/bundle/skills/hej/SKILL.md +0 -69
  484. package/bundle/skills/hej/agents/hej.toml +0 -11
  485. package/bundle/skills/hej/agents/openai.yaml +0 -8
  486. package/dist/analytics/extractCorpus.js.map +0 -1
  487. package/dist/analytics/usageStats.js.map +0 -1
  488. package/dist/bin/agentera.js.map +0 -1
  489. package/dist/capabilities/dokumentera/instructions.js +0 -6
  490. package/dist/capabilities/dokumentera/instructions.js.map +0 -1
  491. package/dist/capabilities/hej/instructions.js +0 -6
  492. package/dist/capabilities/hej/instructions.js.map +0 -1
  493. package/dist/capabilities/index.js.map +0 -1
  494. package/dist/capabilities/inspektera/instructions.js +0 -6
  495. package/dist/capabilities/inspektera/instructions.js.map +0 -1
  496. package/dist/capabilities/inspirera/instructions.js +0 -6
  497. package/dist/capabilities/inspirera/instructions.js.map +0 -1
  498. package/dist/capabilities/optimera/instructions.js +0 -6
  499. package/dist/capabilities/optimera/instructions.js.map +0 -1
  500. package/dist/capabilities/orkestrera/instructions.js +0 -6
  501. package/dist/capabilities/orkestrera/instructions.js.map +0 -1
  502. package/dist/capabilities/planera/instructions.js +0 -6
  503. package/dist/capabilities/planera/instructions.js.map +0 -1
  504. package/dist/capabilities/profilera/instructions.js +0 -6
  505. package/dist/capabilities/profilera/instructions.js.map +0 -1
  506. package/dist/capabilities/realisera/instructions.js +0 -6
  507. package/dist/capabilities/realisera/instructions.js.map +0 -1
  508. package/dist/capabilities/resonera/instructions.js +0 -6
  509. package/dist/capabilities/resonera/instructions.js.map +0 -1
  510. package/dist/capabilities/visionera/instructions.js +0 -6
  511. package/dist/capabilities/visionera/instructions.js.map +0 -1
  512. package/dist/capabilities/visualisera/instructions.js +0 -6
  513. package/dist/capabilities/visualisera/instructions.js.map +0 -1
  514. package/dist/cli/appContext.js.map +0 -1
  515. package/dist/cli/argvalidate.js.map +0 -1
  516. package/dist/cli/capabilityContext.js.map +0 -1
  517. package/dist/cli/commands/capability.js.map +0 -1
  518. package/dist/cli/commands/compact.js.map +0 -1
  519. package/dist/cli/commands/doctor.js.map +0 -1
  520. package/dist/cli/commands/lint.js.map +0 -1
  521. package/dist/cli/commands/prime.js.map +0 -1
  522. package/dist/cli/commands/query.js.map +0 -1
  523. package/dist/cli/commands/report.js.map +0 -1
  524. package/dist/cli/commands/schema.js.map +0 -1
  525. package/dist/cli/commands/state.js +0 -1023
  526. package/dist/cli/commands/state.js.map +0 -1
  527. package/dist/cli/commands/upgrade.js.map +0 -1
  528. package/dist/cli/commands/validate.js.map +0 -1
  529. package/dist/cli/commands/verify.js.map +0 -1
  530. package/dist/cli/dispatch.js.map +0 -1
  531. package/dist/cli/errors.js.map +0 -1
  532. package/dist/cli/help.js.map +0 -1
  533. package/dist/cli/orientation.js.map +0 -1
  534. package/dist/cli/prime-blob.js.map +0 -1
  535. package/dist/cli/stateQuery.js.map +0 -1
  536. package/dist/cli/structured.js.map +0 -1
  537. package/dist/cli/todoMarkdown.js.map +0 -1
  538. package/dist/core/difflib.js.map +0 -1
  539. package/dist/core/paths.js.map +0 -1
  540. package/dist/core/pyjson.js.map +0 -1
  541. package/dist/core/sourceRoot.js.map +0 -1
  542. package/dist/core/toml.js.map +0 -1
  543. package/dist/core/yaml.js.map +0 -1
  544. package/dist/eval/evalSkills.js.map +0 -1
  545. package/dist/eval/semanticEval.js.map +0 -1
  546. package/dist/eval/semanticFixtures.js.map +0 -1
  547. package/dist/hooks/common.js.map +0 -1
  548. package/dist/hooks/compaction.js +0 -935
  549. package/dist/hooks/compaction.js.map +0 -1
  550. package/dist/hooks/cursorPreToolUse.js +0 -19
  551. package/dist/hooks/cursorPreToolUse.js.map +0 -1
  552. package/dist/hooks/cursorSessionStart.js +0 -71
  553. package/dist/hooks/cursorSessionStart.js.map +0 -1
  554. package/dist/hooks/sessionStart.js +0 -209
  555. package/dist/hooks/sessionStart.js.map +0 -1
  556. package/dist/hooks/sessionStop.js +0 -212
  557. package/dist/hooks/sessionStop.js.map +0 -1
  558. package/dist/hooks/validateArtifact.js +0 -935
  559. package/dist/hooks/validateArtifact.js.map +0 -1
  560. package/dist/registries/artifactRegistry.js.map +0 -1
  561. package/dist/registries/capabilityContract.js.map +0 -1
  562. package/dist/registries/evaluatorHandoffContract.js.map +0 -1
  563. package/dist/registries/packageRegistry.js.map +0 -1
  564. package/dist/registries/runtimeAdapterRegistry.js +0 -315
  565. package/dist/registries/runtimeAdapterRegistry.js.map +0 -1
  566. package/dist/setup/codex.js +0 -1197
  567. package/dist/setup/codex.js.map +0 -1
  568. package/dist/setup/copilot.js +0 -227
  569. package/dist/setup/copilot.js.map +0 -1
  570. package/dist/setup/cursor.js +0 -127
  571. package/dist/setup/cursor.js.map +0 -1
  572. package/dist/setup/doctor.js +0 -1297
  573. package/dist/setup/doctor.js.map +0 -1
  574. package/dist/setup/smokeChecks.js.map +0 -1
  575. package/dist/state/installRoot.js.map +0 -1
  576. package/dist/state/startupAnalysis.js.map +0 -1
  577. package/dist/upgrade/appModel.js.map +0 -1
  578. package/dist/upgrade/channels.js.map +0 -1
  579. package/dist/upgrade/compatibility.js.map +0 -1
  580. package/dist/upgrade/doctor.js.map +0 -1
  581. package/dist/upgrade/migrateArtifactsV1ToV2.js +0 -570
  582. package/dist/upgrade/migrateArtifactsV1ToV2.js.map +0 -1
  583. package/dist/upgrade/migrateArtifactsV2ToV3.js.map +0 -1
  584. package/dist/upgrade/nextMajorDoctor.js.map +0 -1
  585. package/dist/upgrade/projectIntegration.js.map +0 -1
  586. package/dist/upgrade/runtimeMigration.js.map +0 -1
  587. package/dist/upgrade/upgradeCommands.js.map +0 -1
  588. package/dist/upgrade/upgradeOrchestrator.js.map +0 -1
  589. package/dist/upgrade/versionResolution.js.map +0 -1
  590. package/dist/validate/appHomeContract.js.map +0 -1
  591. package/dist/validate/capability.js.map +0 -1
  592. package/dist/validate/crossCapability.js.map +0 -1
  593. package/dist/validate/lifecycleAdapters.js +0 -772
  594. package/dist/validate/lifecycleAdapters.js.map +0 -1
  595. package/dist/validate/selfAudit.js.map +0 -1
  596. /package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/exit.yaml +0 -0
  597. /package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/exit.yaml +0 -0
  598. /package/bundle/skills/agentera/capabilities/{hej → status}/schemas/exit.yaml +0 -0
@@ -0,0 +1,107 @@
1
+ /**
2
+ * YAML-side violation orchestrators.
3
+ *
4
+ * `validateYamlContent` is the single entry point: parse, walk the
5
+ * schema singleton groups, run sequence validation, apply artifact-
6
+ * specific rules (plan, decisions), and finally run BUDGET and
7
+ * VALIDATION_RULES checks. Lower-level helpers live in `schema.ts`.
8
+ */
9
+ import path from "node:path";
10
+ import { parseYaml } from "../../core/yaml.js";
11
+ import { resolveSourceRoot } from "../../core/sourceRoot.js";
12
+ import { loadYamlMapping } from "../../core/yaml.js";
13
+ import { expectedSequenceOrder, isMapping, sequenceInOrder, validationRuleSeverity, validateDecisionAlternatives, validateDecisionSatisfaction, validateFullPlanContract, validatePlanDependencies, validatePlanKnownFields, validateSequences, validateSingletonGroup, collectSingletonGroups, wordCount, } from "./schema.js";
14
+ function schemasDirDefault() {
15
+ return path.join(resolveSourceRoot(), "skills", "agentera", "schemas", "artifacts");
16
+ }
17
+ export function validateYamlContent(content, schema, name) {
18
+ const violations = [];
19
+ let data;
20
+ try {
21
+ data = parseYaml(content);
22
+ }
23
+ catch (exc) {
24
+ return [`${name}: invalid YAML: ${exc.message}`];
25
+ }
26
+ if (!isMapping(data)) {
27
+ return [`${name}: root must be a mapping`];
28
+ }
29
+ for (const [group, groupLower, fields] of collectSingletonGroups(schema)) {
30
+ let scope;
31
+ if (groupLower in data && isMapping(data[groupLower])) {
32
+ scope = data[groupLower];
33
+ }
34
+ else if (fields.some((f) => f in data)) {
35
+ scope = data;
36
+ }
37
+ else {
38
+ continue;
39
+ }
40
+ validateSingletonGroup(violations, name, schema, group, scope, groupLower);
41
+ }
42
+ if (name === "plan") {
43
+ validatePlanKnownFields(data, schema, violations);
44
+ validateFullPlanContract(data, violations);
45
+ validatePlanDependencies(data, violations);
46
+ }
47
+ validateSequences(data, schema, name, violations);
48
+ if (name === "decisions") {
49
+ violations.push(...validateDecisionAlternatives(data, name));
50
+ violations.push(...validateDecisionSatisfaction(data, name));
51
+ }
52
+ const wordBudgetSeverity = validationRuleSeverity(schema, "word_budget");
53
+ for (const be of Object.values(schema.BUDGET ?? {})) {
54
+ if (!isMapping(be))
55
+ continue;
56
+ const mw = be.max_words;
57
+ const scope = be.scope ?? "";
58
+ if (mw && String(scope).includes("full_file") && wordBudgetSeverity === "error") {
59
+ const wc = wordCount(content);
60
+ if (wc > Number(mw))
61
+ violations.push(`${name}: word count (${wc}) exceeds budget (${mw})`);
62
+ }
63
+ }
64
+ for (const groupKey of ["VALIDATION", "VALIDATION_RULES"]) {
65
+ for (const ve of Object.values(schema[groupKey] ?? {})) {
66
+ if (!isMapping(ve))
67
+ continue;
68
+ const rule = String(ve.rule ?? "");
69
+ if (ve.severity !== "error")
70
+ continue;
71
+ if (rule.includes("unique") && rule.includes("number")) {
72
+ for (const [key, val] of Object.entries(data)) {
73
+ if (Array.isArray(val)) {
74
+ const nums = val
75
+ .filter((e) => isMapping(e) && "number" in e)
76
+ .map((e) => e.number);
77
+ if (nums.length > 0) {
78
+ if (nums.length !== new Set(nums).size) {
79
+ violations.push(`${name}: duplicate numbers in '${key}'`);
80
+ }
81
+ const direction = expectedSequenceOrder(name, key);
82
+ if (!sequenceInOrder(nums, direction)) {
83
+ violations.push(`${name}: '${key}' not in ${direction} order`);
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ else if (rule === "closure_consistency") {
90
+ const header = isMapping(data.header) ? data.header : {};
91
+ const status = data.status ?? header.status;
92
+ if (typeof status === "string" && status === "closed") {
93
+ for (const field of ["closed_at", "final_value", "target_ref", "reason"]) {
94
+ let val = data[field];
95
+ if (val === null || val === undefined)
96
+ val = header[field];
97
+ if (val === null || val === undefined || (typeof val === "string" && !val.trim())) {
98
+ violations.push(`${name}: closure field '${field}' is required when status is 'closed'`);
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
105
+ return violations;
106
+ }
107
+ export { loadYamlMapping, schemasDirDefault };
@@ -0,0 +1,452 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { isLifecycleOwnershipStateDirectory } from "../runtime/lifecycleOwnershipJournal.js";
4
+ import { AGENTERA_PROFILE_DIR_ENV, PROFILERA_PROFILE_DIR_ENV, resolveProfileDirOverride, } from "../core/envPaths.js";
5
+ import { expanduser, isFile, pathExists, resolvePath } from "../core/paths.js";
6
+ import { opencodeConfigDir } from "../setup/opencode.js";
7
+ import { doctorRoots, loadSuiteVersion } from "../upgrade/appModel.js";
8
+ import { MANAGED_APP_CONTENT_ROOT_ENTRIES } from "../upgrade/appContentRefresh.js";
9
+ import { AGENTERA_USER_STATE_NAMES, ROOT_USER_STATE_DIR_NAMES, ROOT_USER_STATE_FILE_NAMES, } from "../upgrade/doctor.js";
10
+ export const V2_HANDOFF_MANIFEST_FILENAME = "v3-handoff.json";
11
+ export const V2_HANDOFF_SCHEMA_VERSION = "agentera.v3_handoff_manifest.v1";
12
+ export const READER_PREFLIGHT_BUDGET_MS = 100;
13
+ export const USER_DATA_CATALOG_DIRS = [
14
+ "benchmarks",
15
+ "intermediate",
16
+ "sessions",
17
+ "history",
18
+ "corpus",
19
+ ];
20
+ export const PROFILE_FILE_MEMBERS = ["PROFILE.md", "USAGE.md"];
21
+ function isRecord(value) {
22
+ return value !== null && typeof value === "object" && !Array.isArray(value);
23
+ }
24
+ function asNonEmptyString(value, field) {
25
+ if (typeof value !== "string" || !value.trim()) {
26
+ throw new Error(`${field} must be a non-empty string`);
27
+ }
28
+ return value.trim();
29
+ }
30
+ function parseDirectoryEntry(raw) {
31
+ const id = asNonEmptyString(raw.id, "user_data_inventory.id");
32
+ if (!USER_DATA_CATALOG_DIRS.includes(id)) {
33
+ throw new Error(`user_data_inventory id ${id} is not in the catalog`);
34
+ }
35
+ if (raw.kind !== "directory") {
36
+ throw new Error(`user_data_inventory entry ${id} must have kind=directory`);
37
+ }
38
+ if (typeof raw.exists !== "boolean") {
39
+ throw new Error(`user_data_inventory entry ${id} must have boolean exists`);
40
+ }
41
+ return {
42
+ id: id,
43
+ relative_path: asNonEmptyString(raw.relative_path, `user_data_inventory.${id}.relative_path`),
44
+ kind: "directory",
45
+ exists: raw.exists,
46
+ };
47
+ }
48
+ function parseProfileFilesEntry(raw) {
49
+ if (raw.id !== "profile_files") {
50
+ throw new Error("profile_files entry must have id=profile_files");
51
+ }
52
+ if (raw.kind !== "profile_files") {
53
+ throw new Error("profile_files entry must have kind=profile_files");
54
+ }
55
+ if (!Array.isArray(raw.members)) {
56
+ throw new Error("profile_files entry must have members array");
57
+ }
58
+ const members = raw.members.map((member, index) => {
59
+ if (!isRecord(member)) {
60
+ throw new Error(`profile_files.members[${index}] must be an object`);
61
+ }
62
+ if (member.kind !== "file") {
63
+ throw new Error(`profile_files.members[${index}] must have kind=file`);
64
+ }
65
+ if (typeof member.exists !== "boolean") {
66
+ throw new Error(`profile_files.members[${index}] must have boolean exists`);
67
+ }
68
+ return {
69
+ relative_path: asNonEmptyString(member.relative_path, `profile_files.members[${index}].relative_path`),
70
+ kind: "file",
71
+ exists: member.exists,
72
+ };
73
+ });
74
+ return { id: "profile_files", kind: "profile_files", members };
75
+ }
76
+ function parseUserDataInventory(raw) {
77
+ if (!Array.isArray(raw) || raw.length < 6) {
78
+ throw new Error("user_data_inventory must be an array with at least six entries");
79
+ }
80
+ const entries = raw.map((item, index) => {
81
+ if (!isRecord(item)) {
82
+ throw new Error(`user_data_inventory[${index}] must be an object`);
83
+ }
84
+ if (item.kind === "profile_files") {
85
+ return parseProfileFilesEntry(item);
86
+ }
87
+ return parseDirectoryEntry(item);
88
+ });
89
+ const ids = new Set(entries.map((entry) => entry.id));
90
+ for (const id of [...USER_DATA_CATALOG_DIRS, "profile_files"]) {
91
+ if (!ids.has(id)) {
92
+ throw new Error(`user_data_inventory missing catalog id ${id}`);
93
+ }
94
+ }
95
+ return entries;
96
+ }
97
+ export function parseV2HandoffManifest(raw) {
98
+ if (!isRecord(raw)) {
99
+ throw new Error("manifest must be a JSON object");
100
+ }
101
+ const schemaVersion = asNonEmptyString(raw.schema_version, "schema_version");
102
+ if (schemaVersion !== V2_HANDOFF_SCHEMA_VERSION) {
103
+ throw new Error(`schema_version must be ${V2_HANDOFF_SCHEMA_VERSION}`);
104
+ }
105
+ const writtenAt = asNonEmptyString(raw.written_at, "written_at");
106
+ if (Number.isNaN(Date.parse(writtenAt))) {
107
+ throw new Error("written_at must be an ISO-8601 UTC timestamp");
108
+ }
109
+ if (!Array.isArray(raw.runtime_adapters)) {
110
+ throw new Error("runtime_adapters must be an array");
111
+ }
112
+ const runtimeAdapters = raw.runtime_adapters.map((adapter, index) => asNonEmptyString(adapter, `runtime_adapters[${index}]`));
113
+ return {
114
+ schema_version: V2_HANDOFF_SCHEMA_VERSION,
115
+ written_at: writtenAt,
116
+ installed_v2_version: asNonEmptyString(raw.installed_v2_version, "installed_v2_version"),
117
+ app_home_path: asNonEmptyString(raw.app_home_path, "app_home_path"),
118
+ user_data_inventory: parseUserDataInventory(raw.user_data_inventory),
119
+ runtime_adapters: runtimeAdapters,
120
+ };
121
+ }
122
+ export function v2HandoffManifestPath(appHome) {
123
+ return path.join(resolvePath(appHome), V2_HANDOFF_MANIFEST_FILENAME);
124
+ }
125
+ export function readV2HandoffManifestFile(appHome) {
126
+ const manifestPath = v2HandoffManifestPath(appHome);
127
+ if (!isFile(manifestPath)) {
128
+ return null;
129
+ }
130
+ const started = performance.now();
131
+ let parsed;
132
+ try {
133
+ parsed = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
134
+ }
135
+ catch (exc) {
136
+ throw new Error(`failed to read ${V2_HANDOFF_MANIFEST_FILENAME}: ${exc.message}`);
137
+ }
138
+ const manifest = parseV2HandoffManifest(parsed);
139
+ const elapsedMs = performance.now() - started;
140
+ return { manifest, elapsedMs };
141
+ }
142
+ function agenteraUserStateDirIsRecognized(dir) {
143
+ if (!pathExists(dir) || !fs.statSync(dir).isDirectory()) {
144
+ return false;
145
+ }
146
+ for (const entry of fs.readdirSync(dir)) {
147
+ const full = path.join(dir, entry);
148
+ const st = fs.statSync(full);
149
+ if (AGENTERA_USER_STATE_NAMES.has(entry) && st.isFile()) {
150
+ continue;
151
+ }
152
+ if ((entry === "optimize" || entry === "optimera") && st.isDirectory()) {
153
+ // "optimera" is the v2 stable legacy objective dir name; keep it
154
+ // recognized so v2->v3 migration preserves legacy objective state.
155
+ continue;
156
+ }
157
+ if (entry === "runtime-lifecycle" && isLifecycleOwnershipStateDirectory(full)) {
158
+ continue;
159
+ }
160
+ return false;
161
+ }
162
+ return true;
163
+ }
164
+ function isPreservedUserStateEntry(appHome, entry) {
165
+ const full = path.join(appHome, entry);
166
+ if (!pathExists(full)) {
167
+ return false;
168
+ }
169
+ const st = fs.statSync(full);
170
+ if (ROOT_USER_STATE_FILE_NAMES.has(entry) && st.isFile()) {
171
+ return true;
172
+ }
173
+ if (ROOT_USER_STATE_DIR_NAMES.has(entry) && st.isDirectory()) {
174
+ return true;
175
+ }
176
+ if (entry === ".agentera" && agenteraUserStateDirIsRecognized(full)) {
177
+ return true;
178
+ }
179
+ if (USER_DATA_CATALOG_DIRS.includes(entry) &&
180
+ st.isDirectory()) {
181
+ return true;
182
+ }
183
+ return false;
184
+ }
185
+ function listPreservedTopLevelFromScan(appHome) {
186
+ if (!pathExists(appHome)) {
187
+ return [];
188
+ }
189
+ const preserved = [];
190
+ for (const entry of fs.readdirSync(appHome)) {
191
+ if (entry === "app" || entry === V2_HANDOFF_MANIFEST_FILENAME) {
192
+ continue;
193
+ }
194
+ if (isPreservedUserStateEntry(appHome, entry)) {
195
+ preserved.push(entry);
196
+ }
197
+ }
198
+ return preserved.sort();
199
+ }
200
+ function listPreservedAbsolutePathsFromScan(appHome) {
201
+ const preserved = [];
202
+ for (const entry of listPreservedTopLevelFromScan(appHome)) {
203
+ const full = path.join(appHome, entry);
204
+ preserved.push(full);
205
+ if (entry === ".agentera" && pathExists(full) && fs.statSync(full).isDirectory()) {
206
+ for (const name of AGENTERA_USER_STATE_NAMES) {
207
+ const nested = path.join(full, name);
208
+ if (isFile(nested)) {
209
+ preserved.push(nested);
210
+ }
211
+ }
212
+ }
213
+ }
214
+ return preserved.sort();
215
+ }
216
+ function listPreservedTopLevelFromManifest(manifest) {
217
+ const preserved = new Set();
218
+ for (const entry of manifest.user_data_inventory) {
219
+ if (entry.kind === "directory" && entry.exists) {
220
+ preserved.add(entry.relative_path);
221
+ }
222
+ if (entry.kind === "profile_files") {
223
+ for (const member of entry.members) {
224
+ if (member.exists) {
225
+ preserved.add(member.relative_path);
226
+ }
227
+ }
228
+ }
229
+ }
230
+ return [...preserved].sort();
231
+ }
232
+ function listPreservedAbsolutePathsFromManifest(manifest, appHome) {
233
+ const root = resolvePath(appHome);
234
+ const preserved = [];
235
+ for (const rel of listPreservedTopLevelFromManifest(manifest)) {
236
+ preserved.push(path.join(root, rel));
237
+ }
238
+ const agenteraDir = path.join(root, ".agentera");
239
+ if (pathExists(agenteraDir) && fs.statSync(agenteraDir).isDirectory()) {
240
+ preserved.push(agenteraDir);
241
+ for (const name of AGENTERA_USER_STATE_NAMES) {
242
+ const nested = path.join(agenteraDir, name);
243
+ if (isFile(nested)) {
244
+ preserved.push(nested);
245
+ }
246
+ }
247
+ }
248
+ return preserved.sort();
249
+ }
250
+ export function isManifestCatalogEntryPreserved(manifest, entry) {
251
+ for (const item of manifest.user_data_inventory) {
252
+ if (item.kind === "directory" && item.relative_path === entry) {
253
+ return item.exists;
254
+ }
255
+ if (item.kind === "profile_files") {
256
+ for (const member of item.members) {
257
+ if (member.relative_path === entry) {
258
+ return member.exists;
259
+ }
260
+ }
261
+ }
262
+ }
263
+ if (entry === ".agentera") {
264
+ const agenteraDir = path.join(resolvePath(manifest.app_home_path), ".agentera");
265
+ return agenteraUserStateDirIsRecognized(agenteraDir);
266
+ }
267
+ return false;
268
+ }
269
+ function profileDirEnvVar(env) {
270
+ if (env[AGENTERA_PROFILE_DIR_ENV]) {
271
+ return AGENTERA_PROFILE_DIR_ENV;
272
+ }
273
+ if (env[PROFILERA_PROFILE_DIR_ENV]) {
274
+ return PROFILERA_PROFILE_DIR_ENV;
275
+ }
276
+ return null;
277
+ }
278
+ function opencodeConfigDirEnvVar(env) {
279
+ if (env.OPENCODE_CONFIG_DIR) {
280
+ return "OPENCODE_CONFIG_DIR";
281
+ }
282
+ if (env.XDG_CONFIG_HOME) {
283
+ return "XDG_CONFIG_HOME";
284
+ }
285
+ return null;
286
+ }
287
+ function listUserDataPathsAtRoot(root) {
288
+ const preserved = new Set([root]);
289
+ for (const dir of USER_DATA_CATALOG_DIRS) {
290
+ const full = path.join(root, dir);
291
+ if (pathExists(full) && fs.statSync(full).isDirectory()) {
292
+ preserved.add(full);
293
+ }
294
+ }
295
+ for (const file of PROFILE_FILE_MEMBERS) {
296
+ const full = path.join(root, file);
297
+ if (isFile(full)) {
298
+ preserved.add(full);
299
+ }
300
+ }
301
+ return [...preserved].sort();
302
+ }
303
+ function opencodeConfigDirHasArtifacts(configDir) {
304
+ if (isFile(path.join(configDir, "plugins", "agentera.js"))) {
305
+ return true;
306
+ }
307
+ const agentsDir = path.join(configDir, "agents");
308
+ if (pathExists(agentsDir) && fs.statSync(agentsDir).isDirectory()) {
309
+ if (fs.readdirSync(agentsDir).some((name) => isFile(path.join(agentsDir, name)))) {
310
+ return true;
311
+ }
312
+ }
313
+ return pathExists(path.join(configDir, "skills", "agentera"));
314
+ }
315
+ function listOpencodeConfigCatalog(configDir) {
316
+ const preserved = new Set([configDir]);
317
+ for (const rel of ["plugins/agentera.js", "agents", "commands", "skills"]) {
318
+ const full = path.join(configDir, rel);
319
+ if (pathExists(full)) {
320
+ preserved.add(full);
321
+ }
322
+ }
323
+ return [...preserved].sort();
324
+ }
325
+ export function buildExternalHandoffCatalog(appHome, opts) {
326
+ if (!opts?.env) {
327
+ return [];
328
+ }
329
+ const env = opts.env;
330
+ const home = resolvePath(opts.home ?? appHome);
331
+ const resolvedAppHome = resolvePath(appHome);
332
+ const catalog = [];
333
+ const profileEnvVar = profileDirEnvVar(env);
334
+ const profileOverride = resolveProfileDirOverride(env);
335
+ if (profileEnvVar && profileOverride) {
336
+ const profileDir = resolvePath(expanduser(profileOverride));
337
+ if (profileDir !== resolvedAppHome) {
338
+ catalog.push({
339
+ surface: "custom_profile_dir",
340
+ root: profileDir,
341
+ envVar: profileEnvVar,
342
+ entries: listUserDataPathsAtRoot(profileDir),
343
+ });
344
+ }
345
+ }
346
+ const opencodeEnvVar = opencodeConfigDirEnvVar(env);
347
+ if (opencodeEnvVar) {
348
+ const configDir = opencodeConfigDir(home, env);
349
+ const defaultDir = resolvePath(path.join(home, ".config", "opencode"));
350
+ if (configDir !== defaultDir && opencodeConfigDirHasArtifacts(configDir)) {
351
+ catalog.push({
352
+ surface: "opencode_runtime_config_dir",
353
+ root: configDir,
354
+ envVar: opencodeEnvVar,
355
+ entries: listOpencodeConfigCatalog(configDir),
356
+ });
357
+ }
358
+ }
359
+ return catalog;
360
+ }
361
+ function mergePreservedAbsolutePaths(base, handoffCatalog) {
362
+ const merged = new Set(base);
363
+ for (const entry of handoffCatalog) {
364
+ for (const absolutePath of entry.entries) {
365
+ merged.add(absolutePath);
366
+ }
367
+ }
368
+ return [...merged].sort();
369
+ }
370
+ export function handoffCatalogMessage(entry) {
371
+ if (entry.surface === "custom_profile_dir") {
372
+ return `custom profile dir (${entry.envVar}=${entry.root}) cataloged for v2→v3 handoff`;
373
+ }
374
+ return `opencode runtime config dir (${entry.envVar} → ${entry.root}) cataloged for v2→v3 handoff`;
375
+ }
376
+ export function resolveMigrationUserStatePreflight(appHome, opts) {
377
+ const resolvedHome = resolvePath(appHome);
378
+ const handoffCatalog = buildExternalHandoffCatalog(resolvedHome, opts);
379
+ const manifestRead = readV2HandoffManifestFile(resolvedHome);
380
+ if (manifestRead) {
381
+ return {
382
+ source: "manifest",
383
+ elapsedMs: manifestRead.elapsedMs,
384
+ manifest: manifestRead.manifest,
385
+ preservedTopLevel: listPreservedTopLevelFromManifest(manifestRead.manifest),
386
+ preservedAbsolutePaths: mergePreservedAbsolutePaths(listPreservedAbsolutePathsFromManifest(manifestRead.manifest, resolvedHome), handoffCatalog),
387
+ handoffCatalog,
388
+ };
389
+ }
390
+ const started = performance.now();
391
+ const preservedTopLevel = listPreservedTopLevelFromScan(resolvedHome);
392
+ const preservedAbsolutePaths = mergePreservedAbsolutePaths(listPreservedAbsolutePathsFromScan(resolvedHome), handoffCatalog);
393
+ return {
394
+ source: "scan",
395
+ elapsedMs: performance.now() - started,
396
+ manifest: null,
397
+ preservedTopLevel,
398
+ preservedAbsolutePaths,
399
+ handoffCatalog,
400
+ };
401
+ }
402
+ export function appHomeHasUnrecognizedEntriesWithPreflight(appHome, preflight) {
403
+ if (!pathExists(appHome)) {
404
+ return [];
405
+ }
406
+ const unknown = [];
407
+ for (const entry of fs.readdirSync(appHome)) {
408
+ if (entry === "app" || entry === V2_HANDOFF_MANIFEST_FILENAME) {
409
+ continue;
410
+ }
411
+ if (MANAGED_APP_CONTENT_ROOT_ENTRIES.has(entry)) {
412
+ continue;
413
+ }
414
+ if (preflight.source === "manifest" && preflight.manifest) {
415
+ if (isManifestCatalogEntryPreserved(preflight.manifest, entry)) {
416
+ continue;
417
+ }
418
+ }
419
+ else if (isPreservedUserStateEntry(appHome, entry)) {
420
+ continue;
421
+ }
422
+ unknown.push(entry);
423
+ }
424
+ return unknown;
425
+ }
426
+ export function isV2HandoffManifestStale(manifest, ctx) {
427
+ if (resolvePath(manifest.app_home_path) !== resolvePath(ctx.appHome)) {
428
+ return true;
429
+ }
430
+ if (manifest.installed_v2_version !== ctx.installedVersion) {
431
+ return true;
432
+ }
433
+ const writtenAtMs = Date.parse(manifest.written_at);
434
+ const markerMs = ctx.bundleMarkerMtimeMs;
435
+ if (Number.isNaN(writtenAtMs) || Math.floor(writtenAtMs / 1000) < Math.floor(markerMs / 1000)) {
436
+ return true;
437
+ }
438
+ return false;
439
+ }
440
+ export function bundleMarkerFreshnessContext(appHome, sourceRoot) {
441
+ const roots = doctorRoots(appHome);
442
+ const markerPath = path.join(roots.activeBundleRoot, ".agentera-bundle.json");
443
+ if (!isFile(markerPath)) {
444
+ return null;
445
+ }
446
+ const installedVersion = loadSuiteVersion(roots.activeBundleRoot) ?? loadSuiteVersion(sourceRoot) ?? "unknown";
447
+ return {
448
+ appHome: resolvePath(appHome),
449
+ installedVersion,
450
+ bundleMarkerMtimeMs: fs.statSync(markerPath).mtimeMs,
451
+ };
452
+ }
@@ -0,0 +1,2 @@
1
+ export { ACTIVATION_CENSUS_AUTHORITY, ACTIVATION_CHECK_IDS, ACTIVATION_CLASSES, ACTIVATION_CLASS_AUTHORITIES, ACTIVATION_DIMENSIONS, ACTIVATION_EVIDENCE_SOURCES, } from "./packagePublication.js";
2
+ export { ACTIVATION_CANONICAL_TUPLES, ACTIVATION_TUPLE_AUTHORITY, canonicalTupleJson, digestCanonicalTuples, } from "./activationTuples.js";
@@ -0,0 +1,107 @@
1
+ import { createHash } from "node:crypto";
2
+ import { gunzipSync } from "node:zlib";
3
+ // This compressed literal is the immutable, code-owned tuple catalog. It expands
4
+ // only into exact tuple records; no production loader participates in authority.
5
+ const CATALOG = [
6
+ "H4sIAAAAAAACA+1dW3PiOBZ+319B8TyGqd23bO1DOs32ZDed9JJMV01NpihhC1DHWG7JZsJMzX9fyTdssEEm7uYcwUsugI4/fd/R",
7
+ "7egg/fpb71+9X//W6/3Zd30iZf9K/Wb9H/oyFjPi0gnz1EuhYEuqXuS/B1RMQhIt9IvEfSFzKoeqwFAKN/ntManedhdDly+XJPDk",
8
+ "IJ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zarGty1npytjxobbdgdqNv2aj1Gs9phEDiAmWHCqc2rRcY7uS8EWeHIls8La9W1GcSQ0PewOxQ5Myo9RondxDB",
59
+ "13gDs0ONM6MWa5wdWQ1a4ArGTtTdWLRf2s/JEzAIXEbapcyFXYvFXsFXedW1vCt7dc3TtiCnqXWXnGZ3zmFy1RrofMMSwk5yDXN7",
60
+ "FosK9ssZdQg7EdXeL2cUVZRQdxfqEHYiqrRyt0BfAlA+62lUXAoATdxDSI8Vea9du8TerNTfc1cmOawM3jej96E8VuRGm7AFnnIe",
61
+ "6fMZwm2Js9tyr9JT3g/Kl19eOywMXsfRgoutL8XW6lcU+UiUA7wWBWuvVtmGdeTNvLV0RVRGmeWe4yT/JhXMHvquinMQZUm+bSk1",
62
+ "vf/1e3Naaux4SE3a3ZXrUxKAIbSKCR2Zq78DYzIBhI7GkIiIER8YlxtU+PzyH9D88h+4aCSuS8Nk3pZcMPE15uofx5+BoXUPQPQ0",
63
+ "uwI4zQlAtDQDJRcppQoGXy5p4Cm/yHJc4RFcDxIj3R7XQCF3yDUI8RMNsUuuQYiXaKj0Iu6VV1SsnR9hdsYFNkxBGfolff5V+pcz",
64
+ "JQJQaKYBHXaCnYC+RrBZziFiplrNiqY+YG8u8OEnGXi/UQWJmW59fXPAnTVcrksIUft16DP1M68oXNfexomZ9CWTkgVzJ90ehEv6",
65
+ "Dk7MpAvKhUcF9eDyXYaImWoarJzf1QdDCrhHqYLETLc2Cp/vLZSo/VuRiMDBqyhxryblAj7hWygxE64oJBIu0zk8zBTP4iDFA5bl",
66
+ "EkLUa0llAPKsr8CHmWSXL0MuGWyHroJEvYKM/YiFkKN+JYSo4yPxVEYsimE79hZK1J5NfB1uoF66OwrYwXeA2kG7uyBBQH0MxG+g",
67
+ "wqD+t/8DfpAaejqfAQA=",
68
+ ].join("");
69
+ // Emitted producers carry `reason`, while generated files carry
70
+ // `command_authority_reason`. This immutable patch catalog intentionally updates
71
+ // the M6 tuple payload without consulting the mutable package registry loader.
72
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ioBqlQFnlSw7Oev+M9vRAPDIelRS+gKKPcx+8CdrU2LgeOb2AHyRsG5rKWxdb6JWWL+zjIpVLCsGMfJI8duCBu6wU0shz6jhvCG9fyQhJCY/XTfdjfPG0LfxSPuADsxU44moWy2MkuMPJEGa4Vrk7KYhBsU+isw3MfER8D/oOtebgrnBoUPbK3b8k1S1r5EZ8W0ejzGHwWuoQUkE87bPoWODwTeLg8uRT6TRhEqzt73o2A+NqE8z8GRStcpxbsfLb6O6lkqr95uj5sU5cGM2nE/DsOzoZN4uli1J9gxGY/xm79nGAjUXE9Im3G4Od05MlR1dXS4Thn1fX9opbYnH+ae+kbdHvq//xjj3fEGjxBaEYwf9QcRvTzMQ/6uw8wuwvMqRh2qAOhJJzA6PPkhwg+hvKL1yccN5lk85NClQT6+VMHpDMPd64FdfKIDEnAJ/igskV/PRKvorEAMyzT0+LjMD/89z8hk4jWPxsAAA==";
73
+ const decodedCatalog = gunzipSync(Buffer.from(CATALOG, "base64")).toString("utf8");
74
+ const emittedReasons = JSON.parse(gunzipSync(Buffer.from(EMITTED_REASON_CATALOG, "base64")).toString("utf8"));
75
+ const rawTuples = JSON.parse(decodedCatalog.slice(decodedCatalog.indexOf("[", 2)).replace(/,\s*]$/, "]"));
76
+ const addedTuples = [
77
+ { class: "state", surface_id: "write:plan.replace", owner_path: "packages/cli/src/state/write/runtimeOperations.ts", owner_symbol_or_selector: "runtimeOperationSpecs", owner_selector: "plan.replace", semantic_selector_if_any: null, canonical_correction: "node packages/cli/dist/bin/agentera.js check validate state --format json" },
78
+ { class: "state", surface_id: "write:todo.activate", owner_path: "packages/cli/src/state/write/runtimeOperations.ts", owner_symbol_or_selector: "runtimeOperationSpecs", owner_selector: "todo.activate", semantic_selector_if_any: null, canonical_correction: "node packages/cli/dist/bin/agentera.js check validate state --format json" },
79
+ { class: "state", surface_id: "write:todo.repair", owner_path: "packages/cli/src/state/write/runtimeOperations.ts", owner_symbol_or_selector: "runtimeOperationSpecs", owner_selector: "todo.repair", semantic_selector_if_any: null, canonical_correction: "node packages/cli/dist/bin/agentera.js check validate state --format json" },
80
+ { class: "package", surface_id: "emitted:packages/cli/src/cli/commands/doctor.ts", owner_path: "packages/cli/src/registries/packageRegistry.ts", owner_symbol_or_selector: "loadRegistry", owner_selector: "packages/cli/src/cli/commands/doctor.ts", semantic_selector_if_any: JSON.stringify({ path: "packages/cli/src/cli/commands/doctor.ts", selector: null, format: null, classification: null, reason: "Doctor project-state signals publish bounded reconciliation preview and apply guidance." }), canonical_correction: "pnpm -C packages/cli run verify:package" },
81
+ { class: "package", surface_id: "emitted:packages/cli/src/state/todoReconciliationInspection.ts", owner_path: "packages/cli/src/registries/packageRegistry.ts", owner_symbol_or_selector: "loadRegistry", owner_selector: "packages/cli/src/state/todoReconciliationInspection.ts", semantic_selector_if_any: JSON.stringify({ path: "packages/cli/src/state/todoReconciliationInspection.ts", selector: null, format: null, classification: null, reason: "TODO reconciliation inspection publishes bounded preview and effect-bound apply guidance." }), canonical_correction: "pnpm -C packages/cli run verify:package" },
82
+ ];
83
+ const tuples = [...rawTuples, ...addedTuples].map((tuple) => {
84
+ const reason = emittedReasons[tuple.surface_id];
85
+ if (tuple.class !== "package" || reason === undefined || tuple.semantic_selector_if_any === null)
86
+ return tuple;
87
+ const semantic = JSON.parse(tuple.semantic_selector_if_any);
88
+ return { ...tuple, semantic_selector_if_any: JSON.stringify({ ...semantic, reason }) };
89
+ });
90
+ export const ACTIVATION_CANONICAL_TUPLES = Object.freeze(tuples.map((tuple) => Object.freeze(tuple)));
91
+ export const ACTIVATION_TUPLE_AUTHORITY = Object.freeze({
92
+ algorithm: "sha256(sorted_canonical_json_tuples_joined_by_lf)",
93
+ classes: {
94
+ cli: { count: 27, sha256: "9d0db6cafe592da30ea3469c91dc514bdd1b3b22e8229a0519e680cbcb01c2fa" },
95
+ capability: { count: 12, sha256: "892e6e5e2a57b41064bc44fa2946453225f1b1195aff77aad05365fd0a1071c2" },
96
+ runtime: { count: 81, sha256: "99b2abff3ebff889b54b1781c563ab4b32609a479c4e90d6aad854f48fba7edc" },
97
+ reference: { count: 22, sha256: "243fd3c317553f8924c56a52c61af90ccf2793b7b0018af1373b73c69b6c3afb" },
98
+ state: { count: 37, sha256: "210bd831c5d62beac149efd888ee4a99af49a9469cf373031f8db9893904d0c1" },
99
+ package: { count: 66, sha256: "83e6971af7f7564e42369aaccc445b32a0793bfffade843d149b6abd4fd3dbbc" },
100
+ bootstrap: { count: 34, sha256: "9a7dd7e27110d85cf5c08835fdd8f08119e75579858e63bc6d396c733961d0bc" },
101
+ },
102
+ total: { count: 279, sha256: "c2d7a66bc9af04a5511348825995317a5968357c6cacbfd87eb2cc4fbe77156c" },
103
+ });
104
+ export function canonicalTupleJson(value) { return JSON.stringify(value); }
105
+ export function digestCanonicalTuples(values) {
106
+ return createHash("sha256").update(values.map(canonicalTupleJson).sort().join("\n"), "utf8").digest("hex");
107
+ }