agentera 3.0.0-dev.7 → 3.0.0-dev.72

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 (723) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +118 -22
  3. package/bundle/CHANGELOG.md +1361 -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 +252 -0
  8. package/bundle/extract-corpus-parity.json +2 -4
  9. package/bundle/fixtures/routing/hybrid-corpus.yaml +154 -0
  10. package/bundle/references/adapters/package-publication.json +488 -0
  11. package/bundle/references/adapters/package-registry.yaml +435 -188
  12. package/bundle/references/adapters/package-surface-characterization.md +66 -34
  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 +266 -0
  19. package/bundle/references/artifacts/artifact-registry-interface-model.yaml +17 -8
  20. package/bundle/references/artifacts/glossary-entry-contract.yaml +1254 -0
  21. package/bundle/references/artifacts/state-storage-authority.yaml +3061 -0
  22. package/bundle/references/artifacts/verbosity-budget-authority.yaml +42 -0
  23. package/bundle/references/cli/app-lifecycle-vocabulary.yaml +3 -4
  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 +152 -93
  27. package/bundle/references/cli/trigger-schema-enrichment.md +57 -46
  28. package/bundle/references/cli/update-channels.yaml +4 -2
  29. package/bundle/references/cli/vocabulary-index.yaml +5 -7
  30. package/bundle/references/cli/vocabulary.md +51 -93
  31. package/bundle/references/meta/retained-reference-authority.yaml +151 -0
  32. package/bundle/skills/agentera/SKILL.md +183 -63
  33. package/bundle/skills/agentera/capabilities/audit/schemas/artifacts.yaml +27 -19
  34. package/bundle/skills/agentera/capabilities/audit/schemas/exit.yaml +2 -2
  35. package/bundle/skills/agentera/capabilities/audit/schemas/triggers.yaml +13 -35
  36. package/bundle/skills/agentera/capabilities/audit/schemas/validation.yaml +30 -11
  37. package/bundle/skills/agentera/capabilities/build/schemas/artifacts.yaml +44 -21
  38. package/bundle/skills/agentera/capabilities/build/schemas/exit.yaml +8 -6
  39. package/bundle/skills/agentera/capabilities/build/schemas/triggers.yaml +14 -36
  40. package/bundle/skills/agentera/capabilities/build/schemas/validation.yaml +95 -21
  41. package/bundle/skills/agentera/capabilities/design/schemas/artifacts.yaml +6 -6
  42. package/bundle/skills/agentera/capabilities/design/schemas/exit.yaml +5 -5
  43. package/bundle/skills/agentera/capabilities/design/schemas/triggers.yaml +5 -34
  44. package/bundle/skills/agentera/capabilities/design/schemas/validation.yaml +2 -2
  45. package/bundle/skills/agentera/capabilities/discuss/schemas/artifacts.yaml +17 -13
  46. package/bundle/skills/agentera/capabilities/discuss/schemas/exit.yaml +2 -2
  47. package/bundle/skills/agentera/capabilities/discuss/schemas/triggers.yaml +6 -40
  48. package/bundle/skills/agentera/capabilities/discuss/schemas/validation.yaml +72 -5
  49. package/bundle/skills/agentera/capabilities/document/schemas/artifacts.yaml +24 -17
  50. package/bundle/skills/agentera/capabilities/document/schemas/triggers.yaml +5 -35
  51. package/bundle/skills/agentera/capabilities/document/schemas/validation.yaml +13 -13
  52. package/bundle/skills/agentera/capabilities/optimize/schemas/artifacts.yaml +10 -10
  53. package/bundle/skills/agentera/capabilities/optimize/schemas/exit.yaml +2 -2
  54. package/bundle/skills/agentera/capabilities/optimize/schemas/triggers.yaml +4 -35
  55. package/bundle/skills/agentera/capabilities/optimize/schemas/validation.yaml +3 -3
  56. package/bundle/skills/agentera/capabilities/orchestrate/schemas/artifacts.yaml +34 -22
  57. package/bundle/skills/agentera/capabilities/orchestrate/schemas/exit.yaml +9 -7
  58. package/bundle/skills/agentera/capabilities/orchestrate/schemas/triggers.yaml +5 -37
  59. package/bundle/skills/agentera/capabilities/orchestrate/schemas/validation.yaml +38 -37
  60. package/bundle/skills/agentera/capabilities/plan/schemas/artifacts.yaml +20 -16
  61. package/bundle/skills/agentera/capabilities/plan/schemas/triggers.yaml +8 -31
  62. package/bundle/skills/agentera/capabilities/plan/schemas/validation.yaml +66 -6
  63. package/bundle/skills/agentera/capabilities/profile/schemas/artifacts.yaml +9 -4
  64. package/bundle/skills/agentera/capabilities/profile/schemas/exit.yaml +4 -4
  65. package/bundle/skills/agentera/capabilities/profile/schemas/triggers.yaml +8 -37
  66. package/bundle/skills/agentera/capabilities/profile/schemas/validation.yaml +61 -3
  67. package/bundle/skills/agentera/capabilities/research/schemas/artifacts.yaml +6 -6
  68. package/bundle/skills/agentera/capabilities/research/schemas/triggers.yaml +5 -29
  69. package/bundle/skills/agentera/capabilities/status/schemas/artifacts.yaml +13 -12
  70. package/bundle/skills/agentera/capabilities/status/schemas/triggers.yaml +7 -49
  71. package/bundle/skills/agentera/capabilities/vision/schemas/artifacts.yaml +8 -8
  72. package/bundle/skills/agentera/capabilities/vision/schemas/exit.yaml +7 -6
  73. package/bundle/skills/agentera/capabilities/vision/schemas/triggers.yaml +7 -39
  74. package/bundle/skills/agentera/capabilities/vision/schemas/validation.yaml +14 -16
  75. package/bundle/skills/agentera/capability_schema_contract.yaml +32 -32
  76. package/bundle/skills/agentera/protocol.yaml +4 -4
  77. package/bundle/skills/agentera/route-phrases.yaml +81 -0
  78. package/bundle/skills/agentera/schemas/artifacts/changelog.yaml +1 -0
  79. package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +30 -12
  80. package/bundle/skills/agentera/schemas/artifacts/design.yaml +1 -0
  81. package/bundle/skills/agentera/schemas/artifacts/docs.yaml +7 -12
  82. package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +140 -9
  83. package/bundle/skills/agentera/schemas/artifacts/glossary.yaml +82 -0
  84. package/bundle/skills/agentera/schemas/artifacts/health.yaml +56 -19
  85. package/bundle/skills/agentera/schemas/artifacts/objective.yaml +18 -4
  86. package/bundle/skills/agentera/schemas/artifacts/plan.yaml +457 -32
  87. package/bundle/skills/agentera/schemas/artifacts/progress.yaml +131 -18
  88. package/bundle/skills/agentera/schemas/artifacts/todo.yaml +302 -7
  89. package/dist/analytics/extractCorpus/cli.js +52 -11
  90. package/dist/analytics/extractCorpus/copilotSessions.js +6 -4
  91. package/dist/analytics/extractCorpus/core.js +40 -12
  92. package/dist/analytics/extractCorpus/corpus.js +39 -17
  93. package/dist/analytics/extractCorpus/coverageAudit.js +44 -45
  94. package/dist/analytics/extractCorpus/cursorSessions.js +6 -4
  95. package/dist/analytics/extractCorpus/evidenceTiers.js +603 -0
  96. package/dist/analytics/extractCorpus/extractCorpusParity.js +4 -4
  97. package/dist/analytics/extractCorpus/filesystemSources.js +1 -5
  98. package/dist/analytics/extractCorpus/index.js +3 -1
  99. package/dist/analytics/extractCorpus/jsonlSessions.js +24 -5
  100. package/dist/analytics/extractCorpus/sqliteCaps.js +0 -1
  101. package/dist/analytics/extractCorpus/sqliteSessions.js +0 -1
  102. package/dist/analytics/extractCorpus/tierReader.js +108 -0
  103. package/dist/analytics/extractCorpus.js +0 -1
  104. package/dist/analytics/glossaryAdviceResolution.js +166 -0
  105. package/dist/analytics/glossaryInputAcquisition.js +319 -0
  106. package/dist/analytics/personalGlossaryAdmission.js +133 -0
  107. package/dist/analytics/personalGlossaryProfile.js +219 -0
  108. package/dist/analytics/profileSignals.js +211 -0
  109. package/dist/analytics/usageStats.js +150 -23
  110. package/dist/audit/terminologyDrift.js +281 -0
  111. package/dist/bin/agentera.js +3 -2
  112. package/dist/capabilities/audit/instructions.js +16 -6
  113. package/dist/capabilities/build/instructions.js +59 -6
  114. package/dist/capabilities/design/instructions.js +3 -4
  115. package/dist/capabilities/discuss/instructions.js +29 -6
  116. package/dist/capabilities/document/instructions.js +11 -6
  117. package/dist/capabilities/index.js +16 -14
  118. package/dist/capabilities/optimize/instructions.js +14 -6
  119. package/dist/capabilities/orchestrate/instructions.js +42 -6
  120. package/dist/capabilities/plan/instructions.js +30 -3
  121. package/dist/capabilities/profile/instructions.js +70 -6
  122. package/dist/capabilities/research/instructions.js +4 -5
  123. package/dist/capabilities/status/instructions.js +15 -6
  124. package/dist/capabilities/status/startupInstructions.js +34 -0
  125. package/dist/capabilities/vision/instructions.js +3 -5
  126. package/dist/cli/appContext.js +14 -7
  127. package/dist/cli/argvalidate.js +0 -1
  128. package/dist/cli/capabilityContext/benchmark.js +5 -4
  129. package/dist/cli/capabilityContext/bespoke.js +14 -6
  130. package/dist/cli/capabilityContext/build.js +116 -42
  131. package/dist/cli/capabilityContext/closeout.js +30 -27
  132. package/dist/cli/capabilityContext/contract.js +18 -27
  133. package/dist/cli/capabilityContext/evidence.js +84 -77
  134. package/dist/cli/capabilityContext/index.js +0 -1
  135. package/dist/cli/capabilityContext/orchestration.js +42 -18
  136. package/dist/cli/capabilityContext/planState.js +89 -96
  137. package/dist/cli/capabilityContext/progress.js +51 -12
  138. package/dist/cli/capabilityContext/projectVerification.js +409 -0
  139. package/dist/cli/capabilityContext/shared.js +9 -20
  140. package/dist/cli/capabilityContext/slim.js +52 -8
  141. package/dist/cli/capabilityContext/startup.js +51 -114
  142. package/dist/cli/capabilityContext/startupAggregation.js +68 -0
  143. package/dist/cli/capabilityContext/types.js +26 -10
  144. package/dist/cli/capabilityContext.js +0 -1
  145. package/dist/cli/commands/appHome.js +0 -1
  146. package/dist/cli/commands/capability.js +2 -2
  147. package/dist/cli/commands/compact.js +163 -13
  148. package/dist/cli/commands/doctor.js +117 -11
  149. package/dist/cli/commands/durability.js +81 -0
  150. package/dist/cli/commands/glossaryAdvice.js +138 -0
  151. package/dist/cli/commands/lint.js +22 -8
  152. package/dist/cli/commands/personalGlossary.js +176 -0
  153. package/dist/cli/commands/prime/briefOrientation.js +746 -0
  154. package/dist/cli/commands/prime/buildExecutionRequest.js +165 -0
  155. package/dist/cli/commands/prime/bundleStatus.js +54 -4
  156. package/dist/cli/commands/prime/collectEntityOrientation.js +326 -0
  157. package/dist/cli/commands/prime/collectOrientationState.js +126 -63
  158. package/dist/cli/commands/prime/orientationOutput.js +267 -56
  159. package/dist/cli/commands/prime/types.js +0 -1
  160. package/dist/cli/commands/prime/v1Migration.js +0 -1
  161. package/dist/cli/commands/prime.js +76 -11
  162. package/dist/cli/commands/profileGrounding.js +55 -0
  163. package/dist/cli/commands/query.js +74 -52
  164. package/dist/cli/commands/report.js +73 -19
  165. package/dist/cli/commands/route.js +142 -0
  166. package/dist/cli/commands/schema.js +257 -138
  167. package/dist/cli/commands/state/decisions.js +40 -56
  168. package/dist/cli/commands/state/docs.js +58 -85
  169. package/dist/cli/commands/state/experimentRecords.js +151 -0
  170. package/dist/cli/commands/state/experiments.js +11 -65
  171. package/dist/cli/commands/state/get.js +129 -0
  172. package/dist/cli/commands/state/health.js +11 -113
  173. package/dist/cli/commands/state/index.js +6 -41
  174. package/dist/cli/commands/state/list.js +194 -0
  175. package/dist/cli/commands/state/objective.js +21 -65
  176. package/dist/cli/commands/state/plan.js +11 -170
  177. package/dist/cli/commands/state/planTasks.js +154 -0
  178. package/dist/cli/commands/state/plans.js +154 -0
  179. package/dist/cli/commands/state/progress.js +11 -45
  180. package/dist/cli/commands/state/shared.js +0 -1
  181. package/dist/cli/commands/state/todo.js +28 -107
  182. package/dist/cli/commands/state/write.js +433 -0
  183. package/dist/cli/commands/upgrade.js +146 -5
  184. package/dist/cli/commands/upgradeVerify.js +118 -0
  185. package/dist/cli/commands/validate.js +235 -136
  186. package/dist/cli/commands/verify.js +23 -8
  187. package/dist/cli/contracts/bundleStatus.js +0 -1
  188. package/dist/cli/contracts/orientationState.js +0 -1
  189. package/dist/cli/dispatch/argvParser.js +0 -1
  190. package/dist/cli/dispatch/check.js +84 -40
  191. package/dist/cli/dispatch/commands.js +3 -3
  192. package/dist/cli/dispatch/index.js +77 -52
  193. package/dist/cli/dispatch/lifecycle.js +117 -62
  194. package/dist/cli/dispatch/prime.js +37 -2
  195. package/dist/cli/dispatch/projections.js +17 -0
  196. package/dist/cli/dispatch/shared.js +1 -2
  197. package/dist/cli/dispatch/state.js +62 -66
  198. package/dist/cli/dispatch.js +0 -1
  199. package/dist/cli/errors.js +16 -17
  200. package/dist/cli/help.js +358 -39
  201. package/dist/cli/migrationRequired.js +122 -0
  202. package/dist/cli/orientation/attention.js +19 -19
  203. package/dist/cli/orientation/corpusCoverage.js +32 -1
  204. package/dist/cli/orientation.js +346 -129
  205. package/dist/cli/planArtifacts.js +350 -0
  206. package/dist/cli/planEvidence.js +157 -0
  207. package/dist/cli/planLifecycleState.js +36 -0
  208. package/dist/cli/planTaskIndex.js +11 -0
  209. package/dist/cli/preCutoverCommand.js +32 -0
  210. package/dist/cli/prime-blob.js +71 -3
  211. package/dist/cli/profileAcquisition.js +167 -0
  212. package/dist/cli/startupCompletenessContract.js +11 -8
  213. package/dist/cli/stateQuery.js +47 -12
  214. package/dist/cli/structured.js +0 -1
  215. package/dist/cli/todoMarkdown.js +25 -12
  216. package/dist/cli/todoReadinessSelection.js +192 -0
  217. package/dist/cli/todoSeverity.js +0 -1
  218. package/dist/core/atomicWriter.js +20 -0
  219. package/dist/core/developmentChannel.js +1 -0
  220. package/dist/core/developmentInvocation.js +374 -0
  221. package/dist/core/difflib.js +0 -1
  222. package/dist/core/envPaths.js +0 -1
  223. package/dist/core/jsonValue.js +0 -1
  224. package/dist/core/paths.js +0 -1
  225. package/dist/core/pyjson.js +0 -1
  226. package/dist/core/shell.js +4 -0
  227. package/dist/core/skillIdentity.js +23 -0
  228. package/dist/core/sourceRoot.js +9 -12
  229. package/dist/core/text.js +10 -0
  230. package/dist/core/toml.js +0 -1
  231. package/dist/core/yaml.js +8 -1
  232. package/dist/eval/evalSkills.js +13 -14
  233. package/dist/eval/hybridRouteEvaluation.js +155 -0
  234. package/dist/eval/semanticEval.js +0 -1
  235. package/dist/eval/semanticFixtures.js +0 -1
  236. package/dist/hooks/common.js +3 -56
  237. package/dist/hooks/compaction/apply.js +224 -47
  238. package/dist/hooks/compaction/dryRun.js +2 -1
  239. package/dist/hooks/compaction/index.js +5 -6
  240. package/dist/hooks/compaction/parse.js +73 -6
  241. package/dist/hooks/compaction/retention.js +28 -25
  242. package/dist/hooks/compaction/status.js +145 -26
  243. package/dist/hooks/compaction/types.js +0 -1
  244. package/dist/hooks/validateArtifact/agentFacing.js +0 -1
  245. package/dist/hooks/validateArtifact/index.js +6 -65
  246. package/dist/hooks/validateArtifact/markdown.js +9 -10
  247. package/dist/hooks/validateArtifact/schema.js +96 -9
  248. package/dist/hooks/validateArtifact/traversal.js +12 -11
  249. package/dist/hooks/validateArtifact/violations.js +5 -3
  250. package/dist/migrate/v2HandoffManifest.js +8 -3
  251. package/dist/registries/activationContract.js +2 -0
  252. package/dist/registries/activationTuples.js +108 -0
  253. package/dist/registries/artifactProtocolIds.js +2 -1
  254. package/dist/registries/artifactRegistry.js +207 -60
  255. package/dist/registries/artifactSchemaProjection.js +45 -0
  256. package/dist/registries/capabilityContract.js +5 -21
  257. package/dist/registries/evaluatorHandoffContract.js +0 -1
  258. package/dist/registries/evidenceTierContract.js +371 -0
  259. package/dist/registries/glossaryAdviceContract.js +79 -0
  260. package/dist/registries/glossaryCaveatContract.js +67 -0
  261. package/dist/registries/glossaryConsumerContractValidation.js +787 -0
  262. package/dist/registries/glossaryEntryContract.js +757 -0
  263. package/dist/registries/glossaryTermIdentity.js +17 -0
  264. package/dist/registries/glossaryTermOccurrence.js +20 -0
  265. package/dist/registries/hybridRoute.js +274 -0
  266. package/dist/registries/hybridRouteReceipt.js +221 -0
  267. package/dist/registries/packagePublication.js +273 -0
  268. package/dist/registries/packageRegistry.js +184 -209
  269. package/dist/registries/todoReadinessContract.js +448 -0
  270. package/dist/registries/triggerLoader.js +7 -44
  271. package/dist/registries/verbosityBudgetContract.js +205 -0
  272. package/dist/release/releaseMetadata.js +155 -5
  273. package/dist/runtime/lifecycleAdapterContract.js +457 -0
  274. package/dist/runtime/lifecycleAdapters.js +777 -0
  275. package/dist/runtime/lifecycleAuthority.js +453 -0
  276. package/dist/runtime/lifecycleOperationContract.js +123 -0
  277. package/dist/runtime/lifecycleOperations.js +634 -0
  278. package/dist/runtime/lifecycleOwnershipJournal.js +622 -0
  279. package/dist/runtime/lifecyclePublication.js +415 -0
  280. package/dist/runtime/lifecycleSnapshot.js +438 -0
  281. package/dist/runtime/nativeResourceCleanup.js +502 -0
  282. package/dist/setup/opencode.js +20 -13
  283. package/dist/setup/opencodeConstants.js +1 -0
  284. package/dist/setup/sharedSkill.js +45 -0
  285. package/dist/setup/smokeChecks.js +14 -75
  286. package/dist/state/archiveDiscovery.js +580 -0
  287. package/dist/state/archivePublication.js +225 -0
  288. package/dist/state/archiveRecovery.js +237 -0
  289. package/dist/state/archiveReplay.js +53 -0
  290. package/dist/state/canonicalMigrationRecord.js +36 -0
  291. package/dist/state/changelog.js +221 -0
  292. package/dist/state/decisionEntities.js +367 -0
  293. package/dist/state/decisionLegacyValidation.js +215 -0
  294. package/dist/state/decisionMigrationProvenance.js +199 -0
  295. package/dist/state/decisionOverlay.js +254 -0
  296. package/dist/state/decisionRevision.js +256 -0
  297. package/dist/state/decisionRevisionMigration.js +89 -0
  298. package/dist/state/directRetrieval.js +323 -0
  299. package/dist/state/durability.js +324 -0
  300. package/dist/state/entityCutover.js +459 -0
  301. package/dist/state/entityCutoverGit.js +127 -0
  302. package/dist/state/entityGlossaryAuthority.js +13 -0
  303. package/dist/state/entityListProjection.js +187 -0
  304. package/dist/state/entityListRuntimeRegistry.js +85 -0
  305. package/dist/state/entityMigrationCausality.js +97 -0
  306. package/dist/state/entityMigrationIdentity.js +5 -0
  307. package/dist/state/entityMigrationPreview.js +840 -0
  308. package/dist/state/entityMigrationTodo.js +133 -0
  309. package/dist/state/entityPublicationContext.js +859 -0
  310. package/dist/state/entityRetrievalHelp.js +506 -0
  311. package/dist/state/entityStorage.js +899 -0
  312. package/dist/state/exactReplacementRecovery.js +18 -0
  313. package/dist/state/experimentArchive.js +63 -0
  314. package/dist/state/experimentIdentity.js +202 -0
  315. package/dist/state/healthEntities.js +262 -0
  316. package/dist/state/healthEntityValidation.js +18 -0
  317. package/dist/state/healthRepair.js +69 -0
  318. package/dist/state/installRoot.js +15 -7
  319. package/dist/state/legacyEntityCutoverEvidence.js +65 -0
  320. package/dist/state/legacyIdentity.js +47 -0
  321. package/dist/state/legacySummaryRecord.js +6 -0
  322. package/dist/state/listAccounting.js +54 -0
  323. package/dist/state/listClassification.js +17 -0
  324. package/dist/state/listCursor.js +42 -0
  325. package/dist/state/listRetrieval.js +781 -0
  326. package/dist/state/migrationSourceBinding.js +30 -0
  327. package/dist/state/objectiveExperimentEntities.js +322 -0
  328. package/dist/state/planEntities.js +1027 -0
  329. package/dist/state/planIdentity.js +47 -0
  330. package/dist/state/planLineageValidation.js +52 -0
  331. package/dist/state/planReplacementTransaction.js +475 -0
  332. package/dist/state/planRetrieval.js +313 -0
  333. package/dist/state/planTaskRetrieval.js +294 -0
  334. package/dist/state/progressEntities.js +512 -0
  335. package/dist/state/progressGlossaryCaveat.js +168 -0
  336. package/dist/state/progressPublicationOrder.js +19 -0
  337. package/dist/state/progressWritePolicy.js +33 -0
  338. package/dist/state/projectRoot.js +62 -0
  339. package/dist/state/projectionPolicy.js +190 -0
  340. package/dist/state/retrievalAuthority.js +156 -0
  341. package/dist/state/safeProjectFile.js +155 -0
  342. package/dist/state/startupAnalysis/benchmark.js +70 -9
  343. package/dist/state/startupAnalysis/contract.js +44 -10
  344. package/dist/state/startupAnalysis/helpers.js +1 -2
  345. package/dist/state/startupAnalysis/index.js +0 -1
  346. package/dist/state/startupAnalysis/metrics.js +0 -1
  347. package/dist/state/startupAnalysis/records.js +0 -1
  348. package/dist/state/startupAnalysis/report.js +0 -1
  349. package/dist/state/startupAnalysis/threshold.js +13 -1
  350. package/dist/state/startupAnalysis.js +0 -1
  351. package/dist/state/startupProjection.js +499 -0
  352. package/dist/state/stateMode.js +222 -0
  353. package/dist/state/stateStorageAuthority.js +47 -0
  354. package/dist/state/summaryEntityRead.js +25 -0
  355. package/dist/state/summaryMigrationProvenance.js +66 -0
  356. package/dist/state/summarySourceRowAuthority.js +36 -0
  357. package/dist/state/todoActivationSafety.js +58 -0
  358. package/dist/state/todoDocsEntities.js +1124 -0
  359. package/dist/state/todoDocsEntityValidation.js +158 -0
  360. package/dist/state/todoMarkdownProjection.js +51 -0
  361. package/dist/state/todoReconciliationActivation.js +182 -0
  362. package/dist/state/todoReconciliationInspection.js +171 -0
  363. package/dist/state/todoReconciliationRepair.js +318 -0
  364. package/dist/state/todoReconciliationTransaction.js +595 -0
  365. package/dist/state/write/assign.js +20 -0
  366. package/dist/state/write/candidateMutation.js +269 -0
  367. package/dist/state/write/errors.js +11 -0
  368. package/dist/state/write/experimentPublication.js +192 -0
  369. package/dist/state/write/explain.js +377 -0
  370. package/dist/state/write/fields.js +61 -0
  371. package/dist/state/write/glossaryPublication.js +263 -0
  372. package/dist/state/write/grammar.js +285 -0
  373. package/dist/state/write/helpers.js +29 -0
  374. package/dist/state/write/index.js +12 -0
  375. package/dist/state/write/input.js +391 -0
  376. package/dist/state/write/lock.js +837 -0
  377. package/dist/state/write/mutation.js +234 -0
  378. package/dist/state/write/operations.js +170 -0
  379. package/dist/state/write/planEvaluation.js +128 -0
  380. package/dist/state/write/planPublication.js +179 -0
  381. package/dist/state/write/runtimeOperations.js +146 -0
  382. package/dist/state/write/serialize.js +1 -0
  383. package/dist/state/write/transaction.js +57 -0
  384. package/dist/state/write/validate.js +7 -0
  385. package/dist/upgrade/appContentRefresh.js +77 -36
  386. package/dist/upgrade/appModel.js +0 -1
  387. package/dist/upgrade/atomicWriter.js +1 -0
  388. package/dist/upgrade/bundleEvidence.js +0 -1
  389. package/dist/upgrade/channels.js +6 -9
  390. package/dist/upgrade/compatibility.js +43 -17
  391. package/dist/upgrade/doctor.js +55 -32
  392. package/dist/upgrade/doctorClassifier.js +11 -1
  393. package/dist/upgrade/installedHooksRetirement.js +46 -40
  394. package/dist/upgrade/legacyAgentCleanup.js +187 -21
  395. package/dist/upgrade/lifecycleUpgrade.js +113 -0
  396. package/dist/upgrade/migrateArtifactsV2ToV3.js +334 -64
  397. package/dist/upgrade/migrationPublication.js +122 -0
  398. package/dist/upgrade/nextMajorDoctor.js +0 -1
  399. package/dist/upgrade/npxPlatformStatus.js +0 -1
  400. package/dist/upgrade/projectIntegration.js +121 -159
  401. package/dist/upgrade/projectIntegrationDecision.js +42 -85
  402. package/dist/upgrade/retiredResourceDiagnostics.js +117 -0
  403. package/dist/upgrade/runtimeMigration.js +262 -453
  404. package/dist/upgrade/upgradeCommands.js +14 -1
  405. package/dist/upgrade/upgradeLock.js +85 -0
  406. package/dist/upgrade/upgradeOrchestrator.js +263 -59
  407. package/dist/upgrade/v3CapabilitySurface.js +2 -3
  408. package/dist/upgrade/versionResolution.js +0 -1
  409. package/dist/validate/activationArtifactEvidence.js +852 -0
  410. package/dist/validate/activationArtifactEvidenceTypes.js +12 -0
  411. package/dist/validate/activationConjunction.js +816 -0
  412. package/dist/validate/activationEvidenceManifest.js +531 -0
  413. package/dist/validate/activationPackageSemantics.js +29 -0
  414. package/dist/validate/appHomeContract.js +1 -7
  415. package/dist/validate/bootstrapAuthority.js +44 -0
  416. package/dist/validate/capability.js +11 -3
  417. package/dist/validate/crossCapability.js +14 -9
  418. package/dist/validate/retainedReferenceAuthority.js +879 -0
  419. package/dist/validate/selfAudit.js +39 -45
  420. package/dist/validate/v1LegacyCruft.js +131 -0
  421. package/dist/validate/vocabularyAuthority.js +8 -8
  422. package/package.json +41 -13
  423. package/bundle/references/adapters/cursor.md +0 -214
  424. package/bundle/references/adapters/opencode.md +0 -530
  425. package/bundle/references/adapters/package-manifest-interface-model.yaml +0 -337
  426. package/bundle/references/adapters/runtime-adapter-characterization.md +0 -79
  427. package/bundle/references/adapters/runtime-adapter-interface-model.yaml +0 -200
  428. package/bundle/references/adapters/runtime-adapter-registry.yaml +0 -554
  429. package/bundle/references/adapters/runtime-feature-parity.md +0 -189
  430. package/bundle/references/analysis/benchmark.md +0 -267
  431. package/bundle/references/analysis/startup-measurement-contract.yaml +0 -424
  432. package/bundle/references/cli/agent-ready-state-contract.yaml +0 -953
  433. package/bundle/references/cli/audience-namespace-cli-migration.yaml +0 -369
  434. package/bundle/references/cli/bundle-skill-vocabulary.yaml +0 -250
  435. package/bundle/references/cli/capability-tool-classification.yaml +0 -53
  436. package/bundle/references/cli/coexistence-probe.yaml +0 -13
  437. package/bundle/references/cli/parity-expected-actual-template.md +0 -30
  438. package/bundle/references/cli/routing-execution-vocabulary.yaml +0 -281
  439. package/bundle/references/cli/single-name-protocol.yaml +0 -42
  440. package/bundle/references/cli/upgrade-repair-wording.md +0 -45
  441. package/bundle/references/cli/v3-handoff-manifest.schema.yaml +0 -98
  442. package/bundle/references/meta/documentation-inventory.md +0 -49
  443. package/bundle/skills/agentera/.claude-plugin/plugin.json +0 -27
  444. package/bundle/skills/agentera/agents/audit.toml +0 -6
  445. package/bundle/skills/agentera/agents/build.toml +0 -6
  446. package/bundle/skills/agentera/agents/design.toml +0 -6
  447. package/bundle/skills/agentera/agents/discuss.toml +0 -6
  448. package/bundle/skills/agentera/agents/document.toml +0 -6
  449. package/bundle/skills/agentera/agents/optimize.toml +0 -6
  450. package/bundle/skills/agentera/agents/orchestrate.toml +0 -6
  451. package/bundle/skills/agentera/agents/plan.toml +0 -6
  452. package/bundle/skills/agentera/agents/profile.toml +0 -6
  453. package/bundle/skills/agentera/agents/research.toml +0 -6
  454. package/bundle/skills/agentera/agents/status.toml +0 -6
  455. package/bundle/skills/agentera/agents/vision.toml +0 -6
  456. package/bundle/skills/agentera/references/contract.md +0 -1048
  457. package/dist/analytics/extractCorpus/cli.js.map +0 -1
  458. package/dist/analytics/extractCorpus/copilotSessions.js.map +0 -1
  459. package/dist/analytics/extractCorpus/core.js.map +0 -1
  460. package/dist/analytics/extractCorpus/corpus.js.map +0 -1
  461. package/dist/analytics/extractCorpus/coverageAudit.js.map +0 -1
  462. package/dist/analytics/extractCorpus/cursorSessions.js.map +0 -1
  463. package/dist/analytics/extractCorpus/extractCorpusParity.js.map +0 -1
  464. package/dist/analytics/extractCorpus/filesystemSources.js.map +0 -1
  465. package/dist/analytics/extractCorpus/index.js.map +0 -1
  466. package/dist/analytics/extractCorpus/jsonlSessions.js.map +0 -1
  467. package/dist/analytics/extractCorpus/sqliteCaps.js.map +0 -1
  468. package/dist/analytics/extractCorpus/sqliteSessions.js.map +0 -1
  469. package/dist/analytics/extractCorpus.js.map +0 -1
  470. package/dist/analytics/usageStats.js.map +0 -1
  471. package/dist/bin/agentera.js.map +0 -1
  472. package/dist/capabilities/audit/instructions.js.map +0 -1
  473. package/dist/capabilities/build/instructions.js.map +0 -1
  474. package/dist/capabilities/design/instructions.js.map +0 -1
  475. package/dist/capabilities/discuss/instructions.js.map +0 -1
  476. package/dist/capabilities/document/instructions.js.map +0 -1
  477. package/dist/capabilities/dokumentera/instructions.js +0 -6
  478. package/dist/capabilities/dokumentera/instructions.js.map +0 -1
  479. package/dist/capabilities/hej/instructions.js +0 -6
  480. package/dist/capabilities/hej/instructions.js.map +0 -1
  481. package/dist/capabilities/index.js.map +0 -1
  482. package/dist/capabilities/inspektera/instructions.js +0 -6
  483. package/dist/capabilities/inspektera/instructions.js.map +0 -1
  484. package/dist/capabilities/inspirera/instructions.js +0 -6
  485. package/dist/capabilities/inspirera/instructions.js.map +0 -1
  486. package/dist/capabilities/optimera/instructions.js +0 -6
  487. package/dist/capabilities/optimera/instructions.js.map +0 -1
  488. package/dist/capabilities/optimize/instructions.js.map +0 -1
  489. package/dist/capabilities/orchestrate/instructions.js.map +0 -1
  490. package/dist/capabilities/orkestrera/instructions.js +0 -6
  491. package/dist/capabilities/orkestrera/instructions.js.map +0 -1
  492. package/dist/capabilities/plan/instructions.js.map +0 -1
  493. package/dist/capabilities/planera/instructions.js +0 -6
  494. package/dist/capabilities/planera/instructions.js.map +0 -1
  495. package/dist/capabilities/profile/instructions.js.map +0 -1
  496. package/dist/capabilities/profilera/instructions.js +0 -6
  497. package/dist/capabilities/profilera/instructions.js.map +0 -1
  498. package/dist/capabilities/realisera/instructions.js +0 -6
  499. package/dist/capabilities/realisera/instructions.js.map +0 -1
  500. package/dist/capabilities/research/instructions.js.map +0 -1
  501. package/dist/capabilities/resonera/instructions.js +0 -6
  502. package/dist/capabilities/resonera/instructions.js.map +0 -1
  503. package/dist/capabilities/status/instructions.js.map +0 -1
  504. package/dist/capabilities/vision/instructions.js.map +0 -1
  505. package/dist/capabilities/visionera/instructions.js +0 -6
  506. package/dist/capabilities/visionera/instructions.js.map +0 -1
  507. package/dist/capabilities/visualisera/instructions.js +0 -5
  508. package/dist/capabilities/visualisera/instructions.js.map +0 -1
  509. package/dist/cli/appContext.js.map +0 -1
  510. package/dist/cli/argvalidate.js.map +0 -1
  511. package/dist/cli/capabilityContext/benchmark.js.map +0 -1
  512. package/dist/cli/capabilityContext/bespoke.js.map +0 -1
  513. package/dist/cli/capabilityContext/build.js.map +0 -1
  514. package/dist/cli/capabilityContext/closeout.js.map +0 -1
  515. package/dist/cli/capabilityContext/contract.js.map +0 -1
  516. package/dist/cli/capabilityContext/evidence.js.map +0 -1
  517. package/dist/cli/capabilityContext/index.js.map +0 -1
  518. package/dist/cli/capabilityContext/orchestration.js.map +0 -1
  519. package/dist/cli/capabilityContext/planState.js.map +0 -1
  520. package/dist/cli/capabilityContext/progress.js.map +0 -1
  521. package/dist/cli/capabilityContext/realisera.js +0 -174
  522. package/dist/cli/capabilityContext/realisera.js.map +0 -1
  523. package/dist/cli/capabilityContext/shared.js.map +0 -1
  524. package/dist/cli/capabilityContext/slim.js.map +0 -1
  525. package/dist/cli/capabilityContext/startup.js.map +0 -1
  526. package/dist/cli/capabilityContext/types.js.map +0 -1
  527. package/dist/cli/capabilityContext.js.map +0 -1
  528. package/dist/cli/commands/appHome.js.map +0 -1
  529. package/dist/cli/commands/backfill.js +0 -84
  530. package/dist/cli/commands/backfill.js.map +0 -1
  531. package/dist/cli/commands/capability.js.map +0 -1
  532. package/dist/cli/commands/compact.js.map +0 -1
  533. package/dist/cli/commands/doctor.js.map +0 -1
  534. package/dist/cli/commands/lint.js.map +0 -1
  535. package/dist/cli/commands/prime/bundleStatus.js.map +0 -1
  536. package/dist/cli/commands/prime/collectOrientationState.js.map +0 -1
  537. package/dist/cli/commands/prime/orientationOutput.js.map +0 -1
  538. package/dist/cli/commands/prime/routeOutput.js +0 -50
  539. package/dist/cli/commands/prime/routeOutput.js.map +0 -1
  540. package/dist/cli/commands/prime/types.js.map +0 -1
  541. package/dist/cli/commands/prime/v1Migration.js.map +0 -1
  542. package/dist/cli/commands/prime.js.map +0 -1
  543. package/dist/cli/commands/query.js.map +0 -1
  544. package/dist/cli/commands/report.js.map +0 -1
  545. package/dist/cli/commands/schema.js.map +0 -1
  546. package/dist/cli/commands/state/decisions.js.map +0 -1
  547. package/dist/cli/commands/state/docs.js.map +0 -1
  548. package/dist/cli/commands/state/experiments.js.map +0 -1
  549. package/dist/cli/commands/state/health.js.map +0 -1
  550. package/dist/cli/commands/state/index.js.map +0 -1
  551. package/dist/cli/commands/state/objective.js.map +0 -1
  552. package/dist/cli/commands/state/plan.js.map +0 -1
  553. package/dist/cli/commands/state/progress.js.map +0 -1
  554. package/dist/cli/commands/state/shared.js.map +0 -1
  555. package/dist/cli/commands/state/todo.js.map +0 -1
  556. package/dist/cli/commands/state.js +0 -1023
  557. package/dist/cli/commands/state.js.map +0 -1
  558. package/dist/cli/commands/upgrade.js.map +0 -1
  559. package/dist/cli/commands/validate.js.map +0 -1
  560. package/dist/cli/commands/verify.js.map +0 -1
  561. package/dist/cli/contracts/bundleStatus.js.map +0 -1
  562. package/dist/cli/contracts/orientationState.js.map +0 -1
  563. package/dist/cli/dispatch/argvParser.js.map +0 -1
  564. package/dist/cli/dispatch/check.js.map +0 -1
  565. package/dist/cli/dispatch/commands.js.map +0 -1
  566. package/dist/cli/dispatch/index.js.map +0 -1
  567. package/dist/cli/dispatch/lifecycle.js.map +0 -1
  568. package/dist/cli/dispatch/prime.js.map +0 -1
  569. package/dist/cli/dispatch/shared.js.map +0 -1
  570. package/dist/cli/dispatch/state.js.map +0 -1
  571. package/dist/cli/dispatch.js.map +0 -1
  572. package/dist/cli/errors.js.map +0 -1
  573. package/dist/cli/help.js.map +0 -1
  574. package/dist/cli/orientation/attention.js.map +0 -1
  575. package/dist/cli/orientation/corpusCoverage.js.map +0 -1
  576. package/dist/cli/orientation.js.map +0 -1
  577. package/dist/cli/prime-blob.js.map +0 -1
  578. package/dist/cli/startupCompletenessContract.js.map +0 -1
  579. package/dist/cli/stateQuery.js.map +0 -1
  580. package/dist/cli/structured.js.map +0 -1
  581. package/dist/cli/todoMarkdown.js.map +0 -1
  582. package/dist/cli/todoSeverity.js.map +0 -1
  583. package/dist/core/difflib.js.map +0 -1
  584. package/dist/core/envPaths.js.map +0 -1
  585. package/dist/core/git.js +0 -43
  586. package/dist/core/git.js.map +0 -1
  587. package/dist/core/jsonValue.js.map +0 -1
  588. package/dist/core/paths.js.map +0 -1
  589. package/dist/core/pyjson.js.map +0 -1
  590. package/dist/core/sourceRoot.js.map +0 -1
  591. package/dist/core/toml.js.map +0 -1
  592. package/dist/core/yaml.js.map +0 -1
  593. package/dist/eval/evalSkills.js.map +0 -1
  594. package/dist/eval/semanticEval.js.map +0 -1
  595. package/dist/eval/semanticFixtures.js.map +0 -1
  596. package/dist/hooks/common.js.map +0 -1
  597. package/dist/hooks/compaction/apply.js.map +0 -1
  598. package/dist/hooks/compaction/dryRun.js.map +0 -1
  599. package/dist/hooks/compaction/index.js.map +0 -1
  600. package/dist/hooks/compaction/parse.js.map +0 -1
  601. package/dist/hooks/compaction/retention.js.map +0 -1
  602. package/dist/hooks/compaction/status.js.map +0 -1
  603. package/dist/hooks/compaction/todoResolved.js +0 -137
  604. package/dist/hooks/compaction/todoResolved.js.map +0 -1
  605. package/dist/hooks/compaction/types.js.map +0 -1
  606. package/dist/hooks/compaction.js +0 -935
  607. package/dist/hooks/compaction.js.map +0 -1
  608. package/dist/hooks/cursorPreToolUse.js +0 -19
  609. package/dist/hooks/cursorPreToolUse.js.map +0 -1
  610. package/dist/hooks/cursorSessionStart.js +0 -79
  611. package/dist/hooks/cursorSessionStart.js.map +0 -1
  612. package/dist/hooks/sessionStart.js +0 -216
  613. package/dist/hooks/sessionStart.js.map +0 -1
  614. package/dist/hooks/sessionStop.js +0 -206
  615. package/dist/hooks/sessionStop.js.map +0 -1
  616. package/dist/hooks/todoLayout.js +0 -177
  617. package/dist/hooks/todoLayout.js.map +0 -1
  618. package/dist/hooks/validateArtifact/agentFacing.js.map +0 -1
  619. package/dist/hooks/validateArtifact/index.js.map +0 -1
  620. package/dist/hooks/validateArtifact/markdown.js.map +0 -1
  621. package/dist/hooks/validateArtifact/runtime.js +0 -86
  622. package/dist/hooks/validateArtifact/runtime.js.map +0 -1
  623. package/dist/hooks/validateArtifact/schema.js.map +0 -1
  624. package/dist/hooks/validateArtifact/traversal.js.map +0 -1
  625. package/dist/hooks/validateArtifact/violations.js.map +0 -1
  626. package/dist/hooks/validateArtifact.js +0 -924
  627. package/dist/hooks/validateArtifact.js.map +0 -1
  628. package/dist/migrate/v2HandoffManifest.js.map +0 -1
  629. package/dist/registries/artifactProtocolIds.js.map +0 -1
  630. package/dist/registries/artifactRegistry.js.map +0 -1
  631. package/dist/registries/capabilityContract.js.map +0 -1
  632. package/dist/registries/evaluatorHandoffContract.js.map +0 -1
  633. package/dist/registries/packageRegistry.js.map +0 -1
  634. package/dist/registries/runtimeAdapterRegistry.js +0 -316
  635. package/dist/registries/runtimeAdapterRegistry.js.map +0 -1
  636. package/dist/registries/triggerLoader.js.map +0 -1
  637. package/dist/release/releaseMetadata.js.map +0 -1
  638. package/dist/routing/index.js +0 -2
  639. package/dist/routing/index.js.map +0 -1
  640. package/dist/routing/routeEngine.js +0 -189
  641. package/dist/routing/routeEngine.js.map +0 -1
  642. package/dist/setup/codex/agents.js +0 -96
  643. package/dist/setup/codex/agents.js.map +0 -1
  644. package/dist/setup/codex/cli.js +0 -161
  645. package/dist/setup/codex/cli.js.map +0 -1
  646. package/dist/setup/codex/configToml.js +0 -639
  647. package/dist/setup/codex/configToml.js.map +0 -1
  648. package/dist/setup/codex/constants.js +0 -29
  649. package/dist/setup/codex/constants.js.map +0 -1
  650. package/dist/setup/codex/installRoot.js +0 -64
  651. package/dist/setup/codex/installRoot.js.map +0 -1
  652. package/dist/setup/codex/state.js +0 -270
  653. package/dist/setup/codex/state.js.map +0 -1
  654. package/dist/setup/codex.js +0 -12
  655. package/dist/setup/codex.js.map +0 -1
  656. package/dist/setup/copilot.js +0 -227
  657. package/dist/setup/copilot.js.map +0 -1
  658. package/dist/setup/cursor.js +0 -129
  659. package/dist/setup/cursor.js.map +0 -1
  660. package/dist/setup/cursorSurfaces.js +0 -67
  661. package/dist/setup/cursorSurfaces.js.map +0 -1
  662. package/dist/setup/doctor/core.js +0 -300
  663. package/dist/setup/doctor/core.js.map +0 -1
  664. package/dist/setup/doctor/diagnostics.js +0 -240
  665. package/dist/setup/doctor/diagnostics.js.map +0 -1
  666. package/dist/setup/doctor/opencode.js +0 -313
  667. package/dist/setup/doctor/opencode.js.map +0 -1
  668. package/dist/setup/doctor/report.js +0 -425
  669. package/dist/setup/doctor/report.js.map +0 -1
  670. package/dist/setup/doctor.js +0 -10
  671. package/dist/setup/doctor.js.map +0 -1
  672. package/dist/setup/opencode.js.map +0 -1
  673. package/dist/setup/smokeChecks.js.map +0 -1
  674. package/dist/state/installRoot.js.map +0 -1
  675. package/dist/state/progressCommit.js +0 -289
  676. package/dist/state/progressCommit.js.map +0 -1
  677. package/dist/state/startupAnalysis/benchmark.js.map +0 -1
  678. package/dist/state/startupAnalysis/contract.js.map +0 -1
  679. package/dist/state/startupAnalysis/helpers.js.map +0 -1
  680. package/dist/state/startupAnalysis/index.js.map +0 -1
  681. package/dist/state/startupAnalysis/metrics.js.map +0 -1
  682. package/dist/state/startupAnalysis/records.js.map +0 -1
  683. package/dist/state/startupAnalysis/report.js.map +0 -1
  684. package/dist/state/startupAnalysis/threshold.js.map +0 -1
  685. package/dist/state/startupAnalysis.js.map +0 -1
  686. package/dist/upgrade/appContentRefresh.js.map +0 -1
  687. package/dist/upgrade/appModel.js.map +0 -1
  688. package/dist/upgrade/bundleEvidence.js.map +0 -1
  689. package/dist/upgrade/channels.js.map +0 -1
  690. package/dist/upgrade/cliProbe.js +0 -22
  691. package/dist/upgrade/cliProbe.js.map +0 -1
  692. package/dist/upgrade/coexistenceProbe.js +0 -107
  693. package/dist/upgrade/coexistenceProbe.js.map +0 -1
  694. package/dist/upgrade/compatibility.js.map +0 -1
  695. package/dist/upgrade/doctor.js.map +0 -1
  696. package/dist/upgrade/doctorClassifier.js.map +0 -1
  697. package/dist/upgrade/installedHooksRetirement.js.map +0 -1
  698. package/dist/upgrade/legacyAgentCleanup.js.map +0 -1
  699. package/dist/upgrade/migrateArtifactsV1ToV2.js +0 -570
  700. package/dist/upgrade/migrateArtifactsV1ToV2.js.map +0 -1
  701. package/dist/upgrade/migrateArtifactsV2ToV3.js.map +0 -1
  702. package/dist/upgrade/nextMajorDoctor.js.map +0 -1
  703. package/dist/upgrade/npxPlatformStatus.js.map +0 -1
  704. package/dist/upgrade/projectIntegration.js.map +0 -1
  705. package/dist/upgrade/projectIntegrationDecision.js.map +0 -1
  706. package/dist/upgrade/runtimeMigration.js.map +0 -1
  707. package/dist/upgrade/upgradeCommands.js.map +0 -1
  708. package/dist/upgrade/upgradeOrchestrator.js.map +0 -1
  709. package/dist/upgrade/v3CapabilitySurface.js.map +0 -1
  710. package/dist/upgrade/versionResolution.js.map +0 -1
  711. package/dist/validate/appHomeContract.js.map +0 -1
  712. package/dist/validate/capability.js.map +0 -1
  713. package/dist/validate/crossCapability.js.map +0 -1
  714. package/dist/validate/lifecycleAdapters/legacyPythonParity.js +0 -93
  715. package/dist/validate/lifecycleAdapters/legacyPythonParity.js.map +0 -1
  716. package/dist/validate/lifecycleAdapters/nodeFormChecks.js +0 -488
  717. package/dist/validate/lifecycleAdapters/nodeFormChecks.js.map +0 -1
  718. package/dist/validate/lifecycleAdapters/shared.js +0 -198
  719. package/dist/validate/lifecycleAdapters/shared.js.map +0 -1
  720. package/dist/validate/lifecycleAdapters.js +0 -62
  721. package/dist/validate/lifecycleAdapters.js.map +0 -1
  722. package/dist/validate/selfAudit.js.map +0 -1
  723. package/dist/validate/vocabularyAuthority.js.map +0 -1
@@ -0,0 +1,757 @@
1
+ import path from "node:path";
2
+ import { projectGlossaryDevelopmentValue } from "../core/developmentInvocation.js";
3
+ import { resolveSourceRoot } from "../core/sourceRoot.js";
4
+ import { loadYamlMappingFile } from "../core/yaml.js";
5
+ import { validateConsumerBoundary, validateConsumerEvidenceOwner, } from "./glossaryConsumerContractValidation.js";
6
+ export class GlossaryEntryBoundError extends Error {
7
+ }
8
+ const DEFERRED_CAPABILITIES = ["profile", "audit", "discuss", "plan", "build"];
9
+ export function glossaryEntryAuthorityPath(root = resolveSourceRoot()) {
10
+ return path.join(root, "references", "artifacts", "glossary-entry-contract.yaml");
11
+ }
12
+ function mapping(value) {
13
+ return value !== null && typeof value === "object" && !Array.isArray(value)
14
+ ? value
15
+ : null;
16
+ }
17
+ function strings(value) {
18
+ return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : [];
19
+ }
20
+ function contract(pathname) {
21
+ return loadYamlMappingFile(pathname);
22
+ }
23
+ export function personalGlossaryAdmissionContract(pathname = glossaryEntryAuthorityPath()) {
24
+ const authority = contract(pathname);
25
+ const personal = mapping(mapping(authority.ownership_contracts)?.personal);
26
+ const admission = mapping(personal?.admission);
27
+ return {
28
+ explicitSignalTypes: strings(mapping(admission?.explicit)?.candidate_signal_types),
29
+ inferredSignalTypes: strings(mapping(admission?.inferred)?.candidate_signal_types),
30
+ inferredSourceKinds: strings(mapping(admission?.inferred)?.source_kinds),
31
+ insufficientRecovery: typeof admission?.insufficient_recovery === "string"
32
+ ? admission.insufficient_recovery.trim()
33
+ : "",
34
+ };
35
+ }
36
+ export function confirmedVariantGuardContract(pathname = glossaryEntryAuthorityPath()) {
37
+ const authority = contract(pathname);
38
+ const project = mapping(mapping(authority.ownership_contracts)?.project);
39
+ const guard = mapping(project?.confirmed_variant_guard);
40
+ return { excludedDirectories: strings(guard?.excluded_directory_names) };
41
+ }
42
+ export function personalGlossaryOutputContract(pathname = glossaryEntryAuthorityPath()) {
43
+ const authority = contract(pathname);
44
+ const personal = mapping(mapping(authority.ownership_contracts)?.personal);
45
+ const output = mapping(personal?.profile_output);
46
+ const command = mapping(output?.command);
47
+ const request = mapping(command?.request);
48
+ const section = mapping(output?.section);
49
+ return {
50
+ command: projectGlossaryDevelopmentValue(command?.canonical, "profile_output.command"),
51
+ requestSchemaVersion: typeof request?.schema_version === "string" ? request.schema_version : "",
52
+ sectionSchemaVersion: typeof section?.document_schema_version === "string" ? section.document_schema_version : "",
53
+ outputStatuses: strings(command?.output_statuses),
54
+ };
55
+ }
56
+ export function personalProfileGroundingContract(pathname = glossaryEntryAuthorityPath()) {
57
+ const grounding = mapping(mapping(contract(pathname).consumer_boundary)?.profile_grounding);
58
+ return {
59
+ command: projectGlossaryDevelopmentValue(grounding?.command, "profile_grounding.command"),
60
+ schemaVersion: typeof grounding?.schema_version === "string" ? grounding.schema_version : "",
61
+ maxProfileUtf8Bytes: typeof grounding?.max_profile_utf8_bytes === "number" ? grounding.max_profile_utf8_bytes : 0,
62
+ validityStatuses: strings(mapping(grounding?.validity)?.statuses),
63
+ validityClasses: strings(mapping(grounding?.validity)?.classes),
64
+ freshnessStates: strings(mapping(grounding?.freshness)?.states),
65
+ repairRecovery: projectGlossaryDevelopmentValue(mapping(grounding?.recovery)?.repair, "profile_grounding.repair"),
66
+ absentRecovery: projectGlossaryDevelopmentValue(mapping(grounding?.recovery)?.absent, "profile_grounding.absent"),
67
+ };
68
+ }
69
+ export function glossaryConsumerContract(pathname = glossaryEntryAuthorityPath()) {
70
+ const consumer = mapping(contract(pathname).consumer_boundary);
71
+ const implementation = mapping(consumer?.implementation);
72
+ const integrations = mapping(implementation?.capability_integrations);
73
+ const matrix = mapping(consumer?.outcome_matrix);
74
+ const refresh = mapping(consumer?.refresh_events);
75
+ const disclosure = mapping(consumer?.disclosure);
76
+ const transient = mapping(disclosure?.transient_advice);
77
+ const durable = mapping(disclosure?.durable_surfaces);
78
+ const caveat = mapping(consumer?.autonomous_caveat);
79
+ const lifecycle = mapping(caveat?.lifecycle);
80
+ const gate = mapping(consumer?.downstream_gate);
81
+ return {
82
+ contractStatus: typeof consumer?.contract_status === "string" ? consumer.contract_status : "",
83
+ implementation: Object.fromEntries(Object.entries(implementation ?? {}).filter((entry) => typeof entry[1] === "string")),
84
+ capabilityIntegrations: Object.fromEntries(Object.entries(integrations ?? {}).filter((entry) => typeof entry[1] === "string")),
85
+ outcomes: Object.keys(matrix ?? {}),
86
+ refreshRequired: strings(refresh?.required),
87
+ refreshNotRequired: strings(refresh?.not_required),
88
+ transientAllowed: strings(transient?.allowed),
89
+ durableAllowed: strings(durable?.allowed),
90
+ caveatOwner: typeof caveat?.durable_owner === "string" ? caveat.durable_owner : "",
91
+ caveatChannel: typeof caveat?.durable_channel === "string" ? caveat.durable_channel : "",
92
+ caveatEvents: ["current", "resolved", "superseded"].filter((event) => nonEmpty(lifecycle?.[event])),
93
+ caveatExpiration: typeof lifecycle?.expiration === "string" ? lifecycle.expiration : "",
94
+ downstreamGateStatus: typeof gate?.status === "string" ? gate.status : "",
95
+ };
96
+ }
97
+ export function glossaryAcquisitionContract(pathname = glossaryEntryAuthorityPath()) {
98
+ const acquisition = mapping(mapping(contract(pathname).consumer_boundary)?.acquisition);
99
+ const bounds = mapping(acquisition?.bounds);
100
+ const availability = mapping(acquisition?.availability);
101
+ const output = mapping(acquisition?.output);
102
+ return {
103
+ maxSourceUtf8Bytes: typeof bounds?.max_source_utf8_bytes === "number" ? bounds.max_source_utf8_bytes : 0,
104
+ maxEntries: typeof bounds?.max_entries === "number" ? bounds.max_entries : 0,
105
+ availabilityStates: strings(availability?.states),
106
+ outputEntryFields: strings(output?.entry_fields),
107
+ };
108
+ }
109
+ function sameStrings(actual, expected) {
110
+ return JSON.stringify(strings(actual)) === JSON.stringify(expected);
111
+ }
112
+ function nonEmpty(value) {
113
+ return typeof value === "string" && value.trim().length > 0;
114
+ }
115
+ export function isSafeProjectSourcePath(value) {
116
+ return (typeof value === "string" &&
117
+ value.length > 0 &&
118
+ !path.posix.isAbsolute(value) &&
119
+ !path.win32.isAbsolute(value) &&
120
+ !value.split(/[\\/]/).includes(".."));
121
+ }
122
+ function isIsoCalendarDate(value) {
123
+ if (typeof value !== "string")
124
+ return false;
125
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
126
+ if (!match)
127
+ return false;
128
+ const [, year, month, day] = match.map(Number);
129
+ const date = new Date(`${value}T00:00:00.000Z`);
130
+ return (!Number.isNaN(date.getTime()) &&
131
+ date.getUTCFullYear() === year &&
132
+ date.getUTCMonth() + 1 === month &&
133
+ date.getUTCDate() === day);
134
+ }
135
+ export function validateGlossaryEntryContract(pathname = glossaryEntryAuthorityPath()) {
136
+ let authority;
137
+ try {
138
+ authority = contract(pathname);
139
+ }
140
+ catch (error) {
141
+ return [`glossary-entry-contract.yaml: ${error.message}`];
142
+ }
143
+ const errors = [];
144
+ if (authority.schema_version !== "agentera.glossaryEntryContract.v1") {
145
+ errors.push("schema_version must be agentera.glossaryEntryContract.v1");
146
+ }
147
+ const occurrence = mapping(authority.term_occurrence);
148
+ if (occurrence?.runtime !==
149
+ "packages/cli/src/registries/glossaryTermOccurrence.ts#containsGlossaryTerm" ||
150
+ !sameStrings(occurrence?.consumers, [
151
+ "audit_evidence",
152
+ "project_publication_revalidation",
153
+ "confirmed_variant_guard",
154
+ ]) ||
155
+ occurrence?.comparison !== "exact_case_sensitive_literal" ||
156
+ occurrence?.normalization !== "none" ||
157
+ occurrence?.identifier_continuation !== "unicode_ID_Continue_plus_dollar_ZWNJ_ZWJ" ||
158
+ !nonEmpty(occurrence?.rule)) {
159
+ errors.push("term_occurrence must define one exact-case escaped literal matcher with ECMAScript identifier-continuation boundaries");
160
+ }
161
+ const primitive = mapping(authority.shared_primitive);
162
+ const required = strings(primitive?.required_fields);
163
+ const expected = ["term", "meaning", "confidence", "permanence", "temporal", "provenance"];
164
+ if (!sameStrings(required, expected)) {
165
+ errors.push("shared_primitive.required_fields must define the canonical entry shape once");
166
+ }
167
+ const fields = mapping(primitive?.fields);
168
+ for (const field of expected) {
169
+ if (!mapping(fields?.[field]))
170
+ errors.push(`shared_primitive.fields.${field} is required`);
171
+ }
172
+ for (const field of ["term", "meaning"]) {
173
+ if (mapping(fields?.[field])?.type !== "non_empty_string") {
174
+ errors.push(`shared_primitive.fields.${field}.type must be non_empty_string`);
175
+ }
176
+ }
177
+ const confidence = mapping(fields?.confidence);
178
+ if (confidence?.type !== "integer" ||
179
+ confidence?.range_from !== "skills/agentera/protocol.yaml#CONFIDENCE_SCALE") {
180
+ errors.push("confidence must derive integer bounds from protocol CONFIDENCE_SCALE");
181
+ }
182
+ const permanence = mapping(fields?.permanence);
183
+ if (permanence?.type !== "enum" ||
184
+ !sameStrings(permanence?.values, ["stable", "durable", "situational"])) {
185
+ errors.push("permanence must use the existing profile permanence classes");
186
+ }
187
+ if (!nonEmpty(permanence?.classification_rule)) {
188
+ errors.push("permanence classification must remain independent from confidence");
189
+ }
190
+ const temporal = mapping(fields?.temporal);
191
+ if (temporal?.type !== "object" ||
192
+ temporal?.field_type !== "iso_date" ||
193
+ !sameStrings(temporal?.required_fields, ["observed_at", "last_confirmed_at"])) {
194
+ errors.push("temporal metadata must include observed_at and last_confirmed_at");
195
+ }
196
+ const provenance = mapping(fields?.provenance);
197
+ if (provenance?.type !== "discriminated_union" ||
198
+ provenance?.discriminator !== "kind" ||
199
+ provenance?.evidence_field !== "evidence" ||
200
+ provenance?.variants_from !== "provenance_variants") {
201
+ errors.push("provenance must derive its kind and evidence variants from provenance_variants");
202
+ }
203
+ const variants = mapping(authority.provenance_variants);
204
+ const variantExpectations = {
205
+ personal_explicit_definition: {
206
+ owner: "personal",
207
+ evidence_count: 1,
208
+ required_evidence_fields: ["source_id", "evidence_anchor", "signal_type"],
209
+ allowed_signal_types: ["correction", "decision", "instruction"],
210
+ },
211
+ personal_inferred_usage: {
212
+ owner: "personal",
213
+ evidence_count: 2,
214
+ required_evidence_fields: ["source_id", "evidence_anchor", "source_kind"],
215
+ allowed_source_kinds: ["instruction_document", "project_config_signal"],
216
+ },
217
+ project_file: {
218
+ owner: "project",
219
+ evidence_count: 1,
220
+ required_evidence_fields: ["source_path", "source_record_sha256"],
221
+ },
222
+ };
223
+ for (const [kind, expectedVariant] of Object.entries(variantExpectations)) {
224
+ const variant = mapping(variants?.[kind]);
225
+ if (!variant) {
226
+ errors.push(`provenance variant ${kind} is required`);
227
+ continue;
228
+ }
229
+ if (variant.owner !== expectedVariant.owner)
230
+ errors.push(`${kind}.owner must be ${expectedVariant.owner}`);
231
+ if (variant.evidence_count !== expectedVariant.evidence_count) {
232
+ errors.push(`${kind}.evidence_count must be ${expectedVariant.evidence_count}`);
233
+ }
234
+ if (!sameStrings(variant.required_evidence_fields, expectedVariant.required_evidence_fields)) {
235
+ errors.push(`${kind}.required_evidence_fields must match its provenance variant`);
236
+ }
237
+ if (variant.additional_evidence_fields !== "forbidden") {
238
+ errors.push(`${kind}.additional_evidence_fields must be forbidden`);
239
+ }
240
+ for (const allowedField of ["allowed_signal_types", "allowed_source_kinds"]) {
241
+ if (allowedField in expectedVariant &&
242
+ !sameStrings(variant[allowedField], expectedVariant[allowedField])) {
243
+ errors.push(`${kind}.${allowedField} must preserve the admitted evidence classes`);
244
+ }
245
+ }
246
+ if (!nonEmpty(variant.resolution_rule))
247
+ errors.push(`${kind}.resolution_rule is required`);
248
+ }
249
+ const ownership = mapping(authority.ownership_contracts);
250
+ const personal = mapping(ownership?.personal);
251
+ if (personal?.scope !== "user")
252
+ errors.push("personal ownership scope must be user");
253
+ if (!sameStrings(personal?.allowed_provenance, [
254
+ "personal_explicit_definition",
255
+ "personal_inferred_usage",
256
+ ])) {
257
+ errors.push("personal ownership must admit only personal provenance variants");
258
+ }
259
+ const personalInput = mapping(personal?.input);
260
+ const excluded = strings(personalInput?.excluded_categories);
261
+ for (const category of [
262
+ "project_glossary_artifact_identity",
263
+ "project_glossary_path",
264
+ "project_glossary_record",
265
+ "project_file_provenance",
266
+ ]) {
267
+ if (!excluded.includes(category))
268
+ errors.push(`personal input must exclude ${category}`);
269
+ }
270
+ if (personalInput?.tier !== "signal")
271
+ errors.push("personal input must use the bounded signal tier");
272
+ if (personalInput?.authority !== "references/analysis/evidence-tier-authority.yaml") {
273
+ errors.push("personal input must use evidence-tier authority");
274
+ }
275
+ if (!nonEmpty(personalInput?.bounded_rule)) {
276
+ errors.push("personal input bounded_rule is required");
277
+ }
278
+ const personalImplementation = mapping(personal?.implementation);
279
+ const admission = mapping(personal?.admission);
280
+ if (personalImplementation?.status !== "active_partial" ||
281
+ !sameStrings(personalImplementation?.active, [
282
+ "bounded_admission",
283
+ "explicit_classification",
284
+ "inferred_evidence_check",
285
+ "profile_full_rendering",
286
+ "profile_persistence",
287
+ ]) ||
288
+ !sameStrings(personalImplementation?.inactive, ["lookup"])) {
289
+ errors.push("personal rendering and persistence must be active_partial while lookup remains inactive");
290
+ }
291
+ if (!sameStrings(mapping(admission?.explicit)?.candidate_signal_types, [
292
+ "correction",
293
+ "decision",
294
+ ]) ||
295
+ !sameStrings(mapping(admission?.inferred)?.candidate_signal_types, [
296
+ "instruction",
297
+ "configuration",
298
+ ]) ||
299
+ !sameStrings(mapping(admission?.inferred)?.source_kinds, [
300
+ "instruction_document",
301
+ "project_config_signal",
302
+ ]) ||
303
+ !nonEmpty(admission?.read_rule) ||
304
+ !nonEmpty(admission?.insufficient_recovery) ||
305
+ !nonEmpty(admission?.isolation_rule)) {
306
+ errors.push("personal admission must declare bounded classifier, recovery, and isolation rules");
307
+ }
308
+ const decay = mapping(personal?.retention_and_decay);
309
+ if (decay?.authority !== "packages/cli/src/capabilities/profile/instructions.ts#Profile-format") {
310
+ errors.push("personal decay must delegate to the existing profile decay authority");
311
+ }
312
+ if (mapping(authority.authority)?.confidence !== "skills/agentera/protocol.yaml#CONFIDENCE_SCALE") {
313
+ errors.push("contract confidence authority must be protocol CONFIDENCE_SCALE");
314
+ }
315
+ for (const field of ["retention", "confidence", "permanence"]) {
316
+ if (!nonEmpty(decay?.[field]))
317
+ errors.push(`personal retention_and_decay.${field} is required`);
318
+ }
319
+ const profileOutput = mapping(personal?.profile_output);
320
+ const profileSection = mapping(profileOutput?.section);
321
+ const mergeIdentity = mapping(profileOutput?.merge_identity);
322
+ const profileCommand = mapping(profileOutput?.command);
323
+ const profileRequest = mapping(profileCommand?.request);
324
+ if (profileOutput?.owner !== "profile_full" ||
325
+ profileOutput?.lifecycle_callable !==
326
+ "packages/cli/src/analytics/personalGlossaryProfile.ts#updatePersonalGlossaryProfile" ||
327
+ profileCommand?.canonical !== "npx -y agentera@next report profile-glossary" ||
328
+ profileCommand?.namespace !== "report" ||
329
+ profileCommand?.input_flag !== "--input" ||
330
+ profileCommand?.stdin_value !== "-" ||
331
+ profileCommand?.format !== "json" ||
332
+ profileCommand?.dry_run_flag !== "--dry-run" ||
333
+ profileCommand?.project_checkout !== "not_required" ||
334
+ profileRequest?.schema_version !== "agentera.personalGlossaryUpdateRequest.v1" ||
335
+ !sameStrings(profileRequest?.required_fields, [
336
+ "schema_version",
337
+ "profile_path",
338
+ "as_of",
339
+ "fresh_entries",
340
+ "retained_history",
341
+ ]) ||
342
+ profileRequest?.additional_fields !== "forbidden" ||
343
+ !nonEmpty(profileRequest?.profile_path_rule) ||
344
+ !nonEmpty(profileRequest?.retained_history_shape) ||
345
+ !sameStrings(profileCommand?.output_statuses, [
346
+ "changed",
347
+ "unchanged_replay",
348
+ "dry_run_candidate",
349
+ ]) ||
350
+ !nonEmpty(profileCommand?.rule) ||
351
+ profileSection?.heading !== "## Glossary" ||
352
+ profileSection?.start_marker !== "<!-- agentera:personal-glossary:start -->" ||
353
+ profileSection?.end_marker !== "<!-- agentera:personal-glossary:end -->" ||
354
+ profileSection?.encoding !== "deterministic_json_fence" ||
355
+ profileSection?.document_schema_version !== "agentera.personalGlossarySection.v1" ||
356
+ profileSection?.entry_shape !== "shared_primitive" ||
357
+ !sameStrings(profileSection?.lifecycle_metadata, ["as_of", "confidence_basis"]) ||
358
+ !nonEmpty(profileSection?.boundary_rule) ||
359
+ mergeIdentity?.normalization !== "unicode_caseless_exact_no_normalization" ||
360
+ !nonEmpty(mergeIdentity?.rule) ||
361
+ !nonEmpty(profileOutput?.refresh_rule) ||
362
+ !nonEmpty(profileOutput?.decay_rule) ||
363
+ !nonEmpty(profileOutput?.isolation_rule)) {
364
+ errors.push("personal profile output must define deterministic isolated rendering and lifecycle rules");
365
+ }
366
+ const project = mapping(ownership?.project);
367
+ const projectInput = mapping(project?.input);
368
+ const projectImplementation = mapping(project?.implementation);
369
+ const proposalDigest = mapping(project?.proposal_digest);
370
+ const proposalValidation = mapping(project?.proposal_validation);
371
+ const entryDerivation = mapping(project?.entry_derivation);
372
+ const publication = mapping(project?.publication);
373
+ const confirmedVariantGuard = mapping(project?.confirmed_variant_guard);
374
+ const publicationRequest = mapping(publication?.request);
375
+ const persistedDocument = mapping(publication?.persisted_document);
376
+ const terminologySetIdentity = mapping(persistedDocument?.terminology_set_identity);
377
+ if (project?.scope !== "repository" ||
378
+ !sameStrings(project?.allowed_provenance, ["project_file"])) {
379
+ errors.push("project ownership must be repository-scoped project_file provenance");
380
+ }
381
+ if (projectImplementation?.status !== "active" ||
382
+ !sameStrings(projectImplementation?.active, [
383
+ "audit_proposal_digest",
384
+ "build_publication",
385
+ "confirmed_variant_guard",
386
+ ]) ||
387
+ !sameStrings(projectImplementation?.inactive, [
388
+ "lookup",
389
+ "precedence",
390
+ "semantic_equivalence_review",
391
+ ]) ||
392
+ proposalDigest?.algorithm !== "sha256" ||
393
+ proposalDigest?.encoding !== "lowercase_hex" ||
394
+ !nonEmpty(proposalDigest?.canonicalization)) {
395
+ errors.push("project glossary digest and build publication must remain active under the declared consumer boundary");
396
+ }
397
+ if (confirmedVariantGuard?.owner !==
398
+ "packages/cli/src/validate/v1LegacyCruft.ts#scanPost30CruftViolations" ||
399
+ confirmedVariantGuard?.validation_surface !== "packages/cli/test/cli/v1LegacyCruft.test.ts" ||
400
+ confirmedVariantGuard?.loader !==
401
+ "packages/cli/src/state/write/glossaryPublication.ts#loadProjectGlossaryDocument" ||
402
+ confirmedVariantGuard?.matching !== "exact_case_sensitive_boundary_aware_literal" ||
403
+ !nonEmpty(confirmedVariantGuard?.source_rule) ||
404
+ !nonEmpty(confirmedVariantGuard?.approved_evidence_rule) ||
405
+ !nonEmpty(confirmedVariantGuard?.failure_rule) ||
406
+ !sameStrings(confirmedVariantGuard?.exclusions, [
407
+ "generated_output",
408
+ "vendor_and_dependency_state",
409
+ "cache_state",
410
+ "repository_metadata",
411
+ "historical_agentera_state",
412
+ "project_glossary_document",
413
+ "unrelated_agentera_state",
414
+ ]) ||
415
+ !sameStrings(confirmedVariantGuard?.excluded_directory_names, [
416
+ ".agentera",
417
+ ".agentera-generated",
418
+ ".cache",
419
+ ".git",
420
+ ".next",
421
+ ".pnpm",
422
+ ".turbo",
423
+ ".venv",
424
+ ".vite",
425
+ "build",
426
+ "bundle",
427
+ "coverage",
428
+ "dist",
429
+ "node_modules",
430
+ "target",
431
+ "vendor",
432
+ ]) ||
433
+ !nonEmpty(confirmedVariantGuard?.exclusion_rule)) {
434
+ errors.push("confirmed variant guard must reuse validated project glossary pairs and bounded legacy-cruft exclusions");
435
+ }
436
+ if (proposalValidation?.owner !== "audit" ||
437
+ proposalValidation?.shared_runtime !==
438
+ "packages/cli/src/audit/terminologyDrift.ts#validateTerminologyProposal" ||
439
+ !sameStrings(proposalValidation?.required_rules, [
440
+ "safe_distinct_evidence_identities_per_term",
441
+ "unicode_caseless_exact_unique_term_identities",
442
+ "best_supported_canonical_term_with_lexicographic_tie_break",
443
+ "authority_confidence_floor_and_range",
444
+ "confidence_below_70_forces_info_severity",
445
+ "canonical_evidence_and_variant_order",
446
+ "canonical_proposal_digest",
447
+ ]) ||
448
+ !nonEmpty(proposalValidation?.publication_rule)) {
449
+ errors.push("project publication must reuse the Audit-owned canonical proposal validator");
450
+ }
451
+ if (entryDerivation?.term !== "proposal.proposed_canonical_term" ||
452
+ entryDerivation?.meaning !== "proposal.concept" ||
453
+ entryDerivation?.confidence !== "proposal.confidence" ||
454
+ entryDerivation?.permanence !== "stable" ||
455
+ entryDerivation?.["provenance.kind"] !== "project_file" ||
456
+ !nonEmpty(entryDerivation?.["provenance.evidence"]) ||
457
+ !nonEmpty(entryDerivation?.rejection_rule)) {
458
+ errors.push("project entry derivation must produce only the shared project_file primitive");
459
+ }
460
+ if (publication?.owner !== "build" ||
461
+ publication?.command !== "npx -y agentera@next state glossary publish --input REQUEST --format json" ||
462
+ publicationRequest?.schema_version !== "agentera.glossaryPublicationRequest.v1" ||
463
+ !sameStrings(publicationRequest?.required_fields, [
464
+ "schema_version",
465
+ "proposal",
466
+ "confirmation",
467
+ ]) ||
468
+ persistedDocument?.schema_version !== "agentera.projectGlossary.v1" ||
469
+ !sameStrings(persistedDocument?.required_fields, ["schema_version", "approvals", "entries"]) ||
470
+ terminologySetIdentity?.normalization !== "unicode_caseless_exact_no_normalization" ||
471
+ !sameStrings(terminologySetIdentity?.members, [
472
+ "paired_entry.term",
473
+ "paired_approval.proposal.variants.term",
474
+ ]) ||
475
+ terminologySetIdentity?.uniqueness !== "global_across_complete_document" ||
476
+ !nonEmpty(terminologySetIdentity?.rule) ||
477
+ !nonEmpty(publication?.transaction) ||
478
+ !nonEmpty(publication?.merge_and_replay)) {
479
+ errors.push("project publication must define one versioned atomic build-owned request and document");
480
+ }
481
+ if (projectInput?.authority !== "repository_files" ||
482
+ !nonEmpty(projectInput?.bounded_rule) ||
483
+ !sameStrings(projectInput?.excluded_categories, [
484
+ "personal_history_record",
485
+ "personal_history_anchor",
486
+ ])) {
487
+ errors.push("project input must be bounded repository-file evidence excluding personal history");
488
+ }
489
+ const consumer = mapping(authority.consumer_boundary);
490
+ errors.push(...validateConsumerBoundary(consumer));
491
+ errors.push(...validateConsumerEvidenceOwner(consumer));
492
+ const profileGrounding = mapping(consumer?.profile_grounding);
493
+ if (!sameStrings(consumer?.forbidden_persisted_entry_fields, [
494
+ "precedence",
495
+ "collision",
496
+ "review",
497
+ ]) ||
498
+ profileGrounding?.implementation !== "active_exclusion_only" ||
499
+ !sameStrings(profileGrounding?.capabilities, ["discuss", "plan", "build"]) ||
500
+ profileGrounding?.command !== "npx -y agentera@next report profile-grounding --format json" ||
501
+ profileGrounding?.schema_version !== "agentera.profileGrounding.v1" ||
502
+ profileGrounding?.parser !==
503
+ "packages/cli/src/analytics/personalGlossaryProfile.ts#personalProfileGrounding" ||
504
+ profileGrounding?.max_profile_utf8_bytes !== 65536 ||
505
+ !sameStrings(mapping(profileGrounding?.validity)?.statuses, ["absent", "valid", "repair_needed"]) ||
506
+ !sameStrings(mapping(profileGrounding?.validity)?.classes, ["absent", "valid", "malformed", "ambiguous", "unreadable", "unsafe", "oversized", "invalid_utf8"]) ||
507
+ !sameStrings(mapping(profileGrounding?.freshness)?.states, ["current", "stale", "unknown"]) ||
508
+ !nonEmpty(mapping(profileGrounding?.recovery)?.repair) ||
509
+ !nonEmpty(mapping(profileGrounding?.recovery)?.absent) ||
510
+ profileGrounding?.raw_profile_read !== "forbidden" ||
511
+ !nonEmpty(profileGrounding?.content_rule) ||
512
+ !nonEmpty(profileGrounding?.failure_rule)) {
513
+ errors.push("sanitized profile grounding must continue excluding the owned glossary while consumer acquisition remains separate");
514
+ }
515
+ const exactCollision = mapping(consumer?.exact_collision);
516
+ if (exactCollision?.behavior !== "project_precedence_at_consumption" ||
517
+ exactCollision?.persistence !== "forbidden" ||
518
+ exactCollision?.personal_entry_suppression !== "forbidden") {
519
+ errors.push("exact collisions must defer project precedence to consumption without persistence or suppression");
520
+ }
521
+ const inferred = mapping(consumer?.inferred_semantic_equivalence);
522
+ if (inferred?.behavior !== "user_review" ||
523
+ inferred?.automatic_merge !== "forbidden" ||
524
+ inferred?.suppression !== "forbidden" ||
525
+ inferred?.precedence !== "forbidden") {
526
+ errors.push("inferred equivalence must defer to user review without merge, suppression, or precedence");
527
+ }
528
+ const capabilities = mapping(authority.deferred_capability_contracts);
529
+ const profile = mapping(capabilities?.profile);
530
+ const profileContracts = mapping(profile?.contracts);
531
+ if (profile?.implementation !== "active_partial" ||
532
+ !sameStrings(profile?.capabilities, ["profile"]) ||
533
+ !sameStrings(profile?.active_behavior, [
534
+ "ownership_contracts.personal.admission",
535
+ "ownership_contracts.personal.profile_output",
536
+ ]) ||
537
+ !sameStrings(profile?.inactive_behavior, ["lookup"]) ||
538
+ profileContracts?.admission !== "ownership_contracts.personal.input" ||
539
+ profileContracts?.provenance !== "ownership_contracts.personal.allowed_provenance" ||
540
+ profileContracts?.confidence !== "shared_primitive.fields.confidence" ||
541
+ profileContracts?.retention_and_decay !== "ownership_contracts.personal.retention_and_decay" ||
542
+ !sameStrings(profile?.forbidden_current_claims, ["lookup", "project_glossary_consumption"])) {
543
+ errors.push("profile glossary rendering and persistence must be active while Profile itself performs no consumer lookup");
544
+ }
545
+ const audit = mapping(capabilities?.audit);
546
+ const findingFamily = mapping(audit?.finding_family);
547
+ const proposalOutput = mapping(audit?.proposal_output);
548
+ const auditInputs = mapping(audit?.inputs);
549
+ if (audit?.implementation !== "active_partial" ||
550
+ !sameStrings(audit?.capabilities, ["audit"]) ||
551
+ audit?.active_behavior !== "terminology_drift_finding_generation" ||
552
+ findingFamily?.status !== "implemented" ||
553
+ findingFamily?.mutation !== "forbidden" ||
554
+ findingFamily?.evidence !== "ownership_contracts.project.input" ||
555
+ findingFamily?.confidence !== "skills/agentera/protocol.yaml#CONFIDENCE_SCALE" ||
556
+ findingFamily?.filtering !== "skills/agentera/capabilities/audit/schemas/validation.yaml" ||
557
+ !nonEmpty(findingFamily?.canonical_proposal_rule) ||
558
+ !nonEmpty(findingFamily?.personal_comparison_rule) ||
559
+ proposalOutput?.implementation !== "active" ||
560
+ proposalOutput?.intended_output !== "read_only_terminology_drift_finding" ||
561
+ proposalOutput?.digest !== "ownership_contracts.project.proposal_digest" ||
562
+ auditInputs?.personal_history !== "ownership_contracts.personal.input" ||
563
+ auditInputs?.project_file !== "ownership_contracts.project.input" ||
564
+ auditInputs?.project_file_history_classification !== "forbidden" ||
565
+ !sameStrings(audit?.forbidden_current_claims, [
566
+ "persistence",
567
+ "approval",
568
+ "docs_mapping_mutation",
569
+ "lookup",
570
+ ])) {
571
+ errors.push("audit findings and proposal digests must be active and read-only");
572
+ }
573
+ const buildPublication = mapping(capabilities?.build_publication);
574
+ if (buildPublication?.implementation !== "active" ||
575
+ !sameStrings(buildPublication?.capabilities, ["build"]) ||
576
+ buildPublication?.active_behavior !== "ownership_contracts.project.publication" ||
577
+ buildPublication?.output !== "skills/agentera/schemas/artifacts/glossary.yaml" ||
578
+ !sameStrings(buildPublication?.inactive_behavior, [
579
+ "lookup",
580
+ "precedence",
581
+ "semantic_equivalence_review",
582
+ "personal_profile_mutation",
583
+ "docs_mapping_mutation",
584
+ ])) {
585
+ errors.push("build must own only active typed glossary publication");
586
+ }
587
+ const consumers = mapping(capabilities?.consumers);
588
+ const consumerImplementations = mapping(consumers?.implementation);
589
+ if (consumerImplementations?.build !== "active" ||
590
+ consumerImplementations?.discuss !== "active" ||
591
+ consumerImplementations?.plan !== "active" ||
592
+ consumerImplementations?.prime !== "active" ||
593
+ !sameStrings(consumers?.capabilities, ["discuss", "plan", "build", "prime"]) ||
594
+ consumers?.behavior !== "consumer_boundary" ||
595
+ !sameStrings(consumers?.forbidden_current_claims, [])) {
596
+ errors.push("build, discuss, plan, and prime glossary consumption must be active");
597
+ }
598
+ return errors;
599
+ }
600
+ export function validateGlossaryCapabilityImplementationClaim(capability, claimedImplementation, pathname = glossaryEntryAuthorityPath()) {
601
+ if (!DEFERRED_CAPABILITIES.includes(capability)) {
602
+ return [`${capability} is not an affected glossary capability`];
603
+ }
604
+ const authority = contract(pathname);
605
+ const declarations = mapping(authority.deferred_capability_contracts);
606
+ const declaration = Object.values(declarations ?? {})
607
+ .map(mapping)
608
+ .find((candidate) => strings(candidate?.capabilities).includes(capability));
609
+ if (!declaration)
610
+ return [`${capability} has no deferred glossary declaration`];
611
+ const declaredImplementation = mapping(declaration.implementation)?.[capability] ?? declaration.implementation;
612
+ if (claimedImplementation !== declaredImplementation) {
613
+ return [
614
+ `${capability} glossary behavior is ${String(declaredImplementation)}; ${claimedImplementation} is a false implementation claim`,
615
+ ];
616
+ }
617
+ return [];
618
+ }
619
+ function requiredEntryShape(entry, authority) {
620
+ const errors = [];
621
+ const primitive = mapping(authority.shared_primitive);
622
+ const fields = mapping(primitive?.fields);
623
+ const consumer = mapping(authority.consumer_boundary);
624
+ const forbidden = strings(consumer?.forbidden_persisted_entry_fields).filter((field) => field in entry);
625
+ if (forbidden.length > 0) {
626
+ errors.push(`entry contains forbidden persisted fields: ${forbidden.join(", ")}`);
627
+ }
628
+ const requiredFields = strings(primitive?.required_fields);
629
+ const additional = Object.keys(entry).filter((field) => !requiredFields.includes(field));
630
+ if (additional.length > 0)
631
+ errors.push(`entry contains fields outside the shared primitive: ${additional.join(", ")}`);
632
+ for (const field of requiredFields) {
633
+ if (!(field in entry))
634
+ errors.push(`${field} is required`);
635
+ }
636
+ if (typeof entry.term !== "string" || entry.term.trim() === "")
637
+ errors.push("term must be a non-empty string");
638
+ if (typeof entry.meaning !== "string" || entry.meaning.trim() === "")
639
+ errors.push("meaning must be a non-empty string");
640
+ if (!Number.isInteger(entry.confidence) ||
641
+ Number(entry.confidence) < 0 ||
642
+ Number(entry.confidence) > 100) {
643
+ errors.push("confidence must be an integer from protocol CS1-CS5");
644
+ }
645
+ if (!strings(mapping(fields?.permanence)?.values).includes(String(entry.permanence))) {
646
+ errors.push("permanence must be an existing profile permanence class");
647
+ }
648
+ const temporal = mapping(entry.temporal);
649
+ for (const field of strings(mapping(fields?.temporal)?.required_fields)) {
650
+ if (!isIsoCalendarDate(temporal?.[field])) {
651
+ errors.push(`temporal.${field} must be an ISO date`);
652
+ }
653
+ }
654
+ return errors;
655
+ }
656
+ function evidenceShape(evidence, requiredFields, kind, index) {
657
+ const errors = [];
658
+ const missing = requiredFields.filter((field) => !(field in evidence));
659
+ const forbidden = Object.keys(evidence).filter((field) => !requiredFields.includes(field));
660
+ if (missing.length > 0) {
661
+ errors.push(`provenance.evidence[${index}] is missing ${kind} fields: ${missing.join(", ")}`);
662
+ }
663
+ if (forbidden.length > 0) {
664
+ errors.push(`provenance.evidence[${index}] contains fields forbidden for ${kind}: ${forbidden.join(", ")}`);
665
+ }
666
+ return errors;
667
+ }
668
+ function validateHistoryEvidence(evidence, context, index) {
669
+ const errors = [];
670
+ const sourceId = typeof evidence.source_id === "string" ? evidence.source_id : "";
671
+ const anchor = typeof evidence.evidence_anchor === "string" ? evidence.evidence_anchor : "";
672
+ const retained = context.retainedHistory.get(anchor);
673
+ if (!sourceId || !anchor)
674
+ errors.push(`provenance.evidence[${index}] requires source_id and evidence_anchor`);
675
+ if (!retained || retained.sourceId !== sourceId) {
676
+ errors.push(`provenance.evidence[${index}].evidence_anchor must resolve to its retained source_id`);
677
+ }
678
+ return errors;
679
+ }
680
+ export function validateGlossaryEntry(entry, owner, context = { retainedHistory: new Map() }, pathname = glossaryEntryAuthorityPath()) {
681
+ const authorityErrors = validateGlossaryEntryContract(pathname);
682
+ if (authorityErrors.length > 0) {
683
+ return authorityErrors.map((error) => `glossary authority invalid: ${error}`);
684
+ }
685
+ const authority = contract(pathname);
686
+ const variants = mapping(authority.provenance_variants);
687
+ const ownership = mapping(authority.ownership_contracts);
688
+ const ownerContract = mapping(ownership[owner]);
689
+ const errors = requiredEntryShape(entry, authority);
690
+ const provenance = mapping(entry.provenance);
691
+ const kind = provenance?.kind;
692
+ const evidence = Array.isArray(provenance?.evidence) ? provenance.evidence.map(mapping) : [];
693
+ if (!kind || !strings(ownerContract.allowed_provenance).includes(kind)) {
694
+ errors.push(owner === "personal"
695
+ ? "personal entries admit only bounded personal-history provenance"
696
+ : "project entries admit only repository-file provenance");
697
+ return errors;
698
+ }
699
+ const variant = mapping(variants[kind]);
700
+ const requiredEvidenceFields = strings(variant.required_evidence_fields);
701
+ for (const [index, item] of evidence.entries()) {
702
+ if (item)
703
+ errors.push(...evidenceShape(item, requiredEvidenceFields, kind, index));
704
+ }
705
+ const evidenceCount = Number(variant.evidence_count);
706
+ if (kind === "personal_explicit_definition") {
707
+ if (evidence.length !== evidenceCount || evidence[0] === null) {
708
+ errors.push("explicit personal definitions require exactly one retained record");
709
+ }
710
+ else {
711
+ errors.push(...validateHistoryEvidence(evidence[0], context, 0));
712
+ const retained = context.retainedHistory.get(String(evidence[0].evidence_anchor));
713
+ if (!retained ||
714
+ evidence[0].signal_type !== retained.signalType ||
715
+ !strings(variant.allowed_signal_types).includes(retained.signalType)) {
716
+ errors.push("explicit personal definition evidence has an inadmissible signal type");
717
+ }
718
+ }
719
+ }
720
+ if (kind === "personal_inferred_usage") {
721
+ if (evidence.length !== evidenceCount || evidence.some((item) => item === null)) {
722
+ errors.push("inferred personal usage requires exactly two retained records");
723
+ }
724
+ else {
725
+ for (const [index, item] of evidence.entries()) {
726
+ errors.push(...validateHistoryEvidence(item, context, index));
727
+ const retained = context.retainedHistory.get(String(item.evidence_anchor));
728
+ if (!retained ||
729
+ item.source_kind !== retained.sourceKind ||
730
+ !strings(variant.allowed_source_kinds).includes(retained.sourceKind)) {
731
+ errors.push(`provenance.evidence[${index}] has an inadmissible inferred source kind`);
732
+ }
733
+ }
734
+ const sourceIds = evidence.map((item) => String(item?.source_id));
735
+ const anchors = evidence.map((item) => String(item?.evidence_anchor));
736
+ if (new Set(sourceIds).size !== 2 || new Set(anchors).size !== 2) {
737
+ errors.push("inferred personal usage requires two distinct retained identities and anchors");
738
+ }
739
+ }
740
+ }
741
+ if (kind === "project_file") {
742
+ if (evidence.length !== evidenceCount || evidence[0] === null) {
743
+ errors.push("project file provenance requires exactly one source record");
744
+ }
745
+ else {
746
+ const sourcePath = evidence[0].source_path;
747
+ const digest = evidence[0].source_record_sha256;
748
+ if (!isSafeProjectSourcePath(sourcePath)) {
749
+ errors.push("project source_path must be safe and project-relative");
750
+ }
751
+ if (typeof digest !== "string" || !/^[a-f0-9]{64}$/.test(digest)) {
752
+ errors.push("project source_record_sha256 must be a lowercase SHA-256 digest");
753
+ }
754
+ }
755
+ }
756
+ return errors;
757
+ }