agentera 3.0.0-dev.32 → 3.0.0-dev.38

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 (133) hide show
  1. package/bundle/CHANGELOG.md +46 -1
  2. package/bundle/references/adapters/package-publication.json +43 -0
  3. package/bundle/references/adapters/package-surface-characterization.md +12 -0
  4. package/bundle/references/analysis/evidence-tier-authority.yaml +23 -21
  5. package/bundle/references/analysis/verification-policy.yaml +1 -0
  6. package/bundle/references/artifacts/artifact-registry-interface-model.yaml +11 -2
  7. package/bundle/references/artifacts/glossary-entry-contract.yaml +1241 -0
  8. package/bundle/references/artifacts/state-storage-authority.yaml +31 -3
  9. package/bundle/references/cli/audience-namespace-cli-migration.yaml +12 -1
  10. package/bundle/references/cli/prime-consumer-compatibility.yaml +7 -1
  11. package/bundle/skills/agentera/capabilities/audit/schemas/validation.yaml +26 -8
  12. package/bundle/skills/agentera/capabilities/build/schemas/artifacts.yaml +21 -4
  13. package/bundle/skills/agentera/capabilities/build/schemas/validation.yaml +50 -0
  14. package/bundle/skills/agentera/capabilities/discuss/schemas/artifacts.yaml +3 -2
  15. package/bundle/skills/agentera/capabilities/discuss/schemas/validation.yaml +64 -0
  16. package/bundle/skills/agentera/capabilities/plan/schemas/artifacts.yaml +4 -1
  17. package/bundle/skills/agentera/capabilities/plan/schemas/validation.yaml +30 -0
  18. package/bundle/skills/agentera/capabilities/profile/schemas/artifacts.yaml +5 -2
  19. package/bundle/skills/agentera/capabilities/profile/schemas/exit.yaml +3 -2
  20. package/bundle/skills/agentera/capabilities/profile/schemas/validation.yaml +30 -0
  21. package/bundle/skills/agentera/schemas/artifacts/glossary.yaml +82 -0
  22. package/bundle/skills/agentera/schemas/artifacts/plan.yaml +5 -1
  23. package/bundle/skills/agentera/schemas/artifacts/progress.yaml +92 -0
  24. package/dist/analytics/extractCorpus/evidenceTiers.js +46 -3
  25. package/dist/analytics/extractCorpus/evidenceTiers.js.map +1 -1
  26. package/dist/analytics/extractCorpus/tierReader.js +1 -1
  27. package/dist/analytics/extractCorpus/tierReader.js.map +1 -1
  28. package/dist/analytics/glossaryAdviceResolution.js +167 -0
  29. package/dist/analytics/glossaryAdviceResolution.js.map +1 -0
  30. package/dist/analytics/glossaryInputAcquisition.js +320 -0
  31. package/dist/analytics/glossaryInputAcquisition.js.map +1 -0
  32. package/dist/analytics/personalGlossaryAdmission.js +134 -0
  33. package/dist/analytics/personalGlossaryAdmission.js.map +1 -0
  34. package/dist/analytics/personalGlossaryProfile.js +219 -0
  35. package/dist/analytics/personalGlossaryProfile.js.map +1 -0
  36. package/dist/audit/terminologyDrift.js +282 -0
  37. package/dist/audit/terminologyDrift.js.map +1 -0
  38. package/dist/capabilities/audit/instructions.js +2 -1
  39. package/dist/capabilities/audit/instructions.js.map +1 -1
  40. package/dist/capabilities/build/instructions.js +15 -1
  41. package/dist/capabilities/build/instructions.js.map +1 -1
  42. package/dist/capabilities/discuss/instructions.js +14 -1
  43. package/dist/capabilities/discuss/instructions.js.map +1 -1
  44. package/dist/capabilities/index.js +1 -1
  45. package/dist/capabilities/index.js.map +1 -1
  46. package/dist/capabilities/orchestrate/instructions.js +1 -1
  47. package/dist/capabilities/plan/instructions.js +19 -2
  48. package/dist/capabilities/plan/instructions.js.map +1 -1
  49. package/dist/capabilities/profile/instructions.js +67 -1
  50. package/dist/capabilities/profile/instructions.js.map +1 -1
  51. package/dist/cli/capabilityContext/startup.js +19 -2
  52. package/dist/cli/capabilityContext/startup.js.map +1 -1
  53. package/dist/cli/commands/glossaryAdvice.js +139 -0
  54. package/dist/cli/commands/glossaryAdvice.js.map +1 -0
  55. package/dist/cli/commands/personalGlossary.js +177 -0
  56. package/dist/cli/commands/personalGlossary.js.map +1 -0
  57. package/dist/cli/commands/prime/collectEntityOrientation.js +16 -1
  58. package/dist/cli/commands/prime/collectEntityOrientation.js.map +1 -1
  59. package/dist/cli/commands/prime/collectOrientationState.js +4 -0
  60. package/dist/cli/commands/prime/collectOrientationState.js.map +1 -1
  61. package/dist/cli/commands/prime/orientationOutput.js +12 -2
  62. package/dist/cli/commands/prime/orientationOutput.js.map +1 -1
  63. package/dist/cli/commands/profileGrounding.js +77 -0
  64. package/dist/cli/commands/profileGrounding.js.map +1 -0
  65. package/dist/cli/commands/query.js +10 -4
  66. package/dist/cli/commands/query.js.map +1 -1
  67. package/dist/cli/commands/schema.js +10 -0
  68. package/dist/cli/commands/schema.js.map +1 -1
  69. package/dist/cli/commands/state/write.js +4 -1
  70. package/dist/cli/commands/state/write.js.map +1 -1
  71. package/dist/cli/dispatch/lifecycle.js +45 -0
  72. package/dist/cli/dispatch/lifecycle.js.map +1 -1
  73. package/dist/cli/help.js +21 -0
  74. package/dist/cli/help.js.map +1 -1
  75. package/dist/cli/migrationRequired.js +2 -0
  76. package/dist/cli/migrationRequired.js.map +1 -1
  77. package/dist/cli/orientation/attention.js +3 -1
  78. package/dist/cli/orientation/attention.js.map +1 -1
  79. package/dist/registries/artifactProtocolIds.js +2 -0
  80. package/dist/registries/artifactProtocolIds.js.map +1 -1
  81. package/dist/registries/artifactRegistry.js +2 -0
  82. package/dist/registries/artifactRegistry.js.map +1 -1
  83. package/dist/registries/evidenceTierContract.js +26 -16
  84. package/dist/registries/evidenceTierContract.js.map +1 -1
  85. package/dist/registries/glossaryAdviceContract.js +79 -0
  86. package/dist/registries/glossaryAdviceContract.js.map +1 -0
  87. package/dist/registries/glossaryCaveatContract.js +66 -0
  88. package/dist/registries/glossaryCaveatContract.js.map +1 -0
  89. package/dist/registries/glossaryConsumerContractValidation.js +792 -0
  90. package/dist/registries/glossaryConsumerContractValidation.js.map +1 -0
  91. package/dist/registries/glossaryEntryContract.js +747 -0
  92. package/dist/registries/glossaryEntryContract.js.map +1 -0
  93. package/dist/registries/glossaryTermIdentity.js +18 -0
  94. package/dist/registries/glossaryTermIdentity.js.map +1 -0
  95. package/dist/registries/glossaryTermOccurrence.js +21 -0
  96. package/dist/registries/glossaryTermOccurrence.js.map +1 -0
  97. package/dist/state/decisionEntities.js +2 -2
  98. package/dist/state/decisionEntities.js.map +1 -1
  99. package/dist/state/entityPublicationContext.js +374 -71
  100. package/dist/state/entityPublicationContext.js.map +1 -1
  101. package/dist/state/entityStorage.js +29 -14
  102. package/dist/state/entityStorage.js.map +1 -1
  103. package/dist/state/objectiveExperimentEntities.js +6 -6
  104. package/dist/state/objectiveExperimentEntities.js.map +1 -1
  105. package/dist/state/planEntities.js +17 -9
  106. package/dist/state/planEntities.js.map +1 -1
  107. package/dist/state/progressEntities.js +175 -35
  108. package/dist/state/progressEntities.js.map +1 -1
  109. package/dist/state/progressGlossaryCaveat.js +169 -0
  110. package/dist/state/progressGlossaryCaveat.js.map +1 -0
  111. package/dist/state/progressPublicationOrder.js +20 -0
  112. package/dist/state/progressPublicationOrder.js.map +1 -0
  113. package/dist/state/todoDocsEntities.js +6 -6
  114. package/dist/state/todoDocsEntities.js.map +1 -1
  115. package/dist/state/write/explain.js +64 -34
  116. package/dist/state/write/explain.js.map +1 -1
  117. package/dist/state/write/glossaryPublication.js +264 -0
  118. package/dist/state/write/glossaryPublication.js.map +1 -0
  119. package/dist/state/write/index.js +1 -0
  120. package/dist/state/write/index.js.map +1 -1
  121. package/dist/state/write/operations.js +23 -1
  122. package/dist/state/write/operations.js.map +1 -1
  123. package/dist/state/write/planEvaluation.js +6 -2
  124. package/dist/state/write/planEvaluation.js.map +1 -1
  125. package/dist/state/write/transaction.js +4 -1
  126. package/dist/state/write/transaction.js.map +1 -1
  127. package/dist/validate/crossCapability.js +3 -0
  128. package/dist/validate/crossCapability.js.map +1 -1
  129. package/dist/validate/v1LegacyCruft.js +141 -0
  130. package/dist/validate/v1LegacyCruft.js.map +1 -0
  131. package/dist/validate/vocabularyAuthority.js +2 -0
  132. package/dist/validate/vocabularyAuthority.js.map +1 -1
  133. package/package.json +4 -3
@@ -0,0 +1,792 @@
1
+ import path from "node:path";
2
+ import { resolveSourceRoot } from "../core/sourceRoot.js";
3
+ import { loadYamlMappingFile } from "../core/yaml.js";
4
+ const OUTCOME_SEMANTICS = {
5
+ invalid_or_unavailable_project: {
6
+ judgment: "deterministic",
7
+ selected_owner: "none",
8
+ selected_meaning: "none",
9
+ review: "unavailable",
10
+ tension: "authority_unavailable",
11
+ },
12
+ equivalent_exact_collision: {
13
+ judgment: "deterministic",
14
+ selected_owner: "project",
15
+ selected_meaning: "project",
16
+ review: "none",
17
+ tension: "none",
18
+ },
19
+ divergent_exact_collision: {
20
+ judgment: "deterministic",
21
+ selected_owner: "project",
22
+ selected_meaning: "project",
23
+ review: "none",
24
+ tension: "divergent_exact_collision",
25
+ },
26
+ project_only: {
27
+ judgment: "deterministic",
28
+ selected_owner: "project",
29
+ selected_meaning: "project",
30
+ review: "none_for_primary",
31
+ tension: "none",
32
+ },
33
+ proven_project_gap: {
34
+ judgment: "deterministic",
35
+ selected_owner: "personal",
36
+ selected_meaning: "personal",
37
+ review: "none",
38
+ tension: "none",
39
+ },
40
+ inferred_equivalence: {
41
+ judgment: "host_reviewed",
42
+ selected_owner: "none_until_review",
43
+ selected_meaning: "none_until_review",
44
+ review: "required_when_meaning_sensitive",
45
+ tension: "inferred_equivalence",
46
+ },
47
+ invalid_or_unavailable_personal: {
48
+ judgment: "deterministic",
49
+ selected_owner: "none",
50
+ selected_meaning: "none",
51
+ review: "unavailable",
52
+ tension: "input_unavailable",
53
+ },
54
+ no_applicable_entry: {
55
+ judgment: "deterministic",
56
+ selected_owner: "none",
57
+ selected_meaning: "none",
58
+ review: "none",
59
+ tension: "none",
60
+ },
61
+ };
62
+ const OUTCOME_SEMANTIC_FIELDS = [
63
+ "judgment",
64
+ "selected_owner",
65
+ "selected_meaning",
66
+ "review",
67
+ "tension",
68
+ ];
69
+ function mapping(value) {
70
+ return value !== null && typeof value === "object" && !Array.isArray(value)
71
+ ? value
72
+ : null;
73
+ }
74
+ function strings(value) {
75
+ return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : [];
76
+ }
77
+ function contract(pathname) {
78
+ return loadYamlMappingFile(pathname);
79
+ }
80
+ function sameStrings(actual, expected) {
81
+ return JSON.stringify(strings(actual)) === JSON.stringify(expected);
82
+ }
83
+ function nonEmpty(value) {
84
+ return typeof value === "string" && value.trim().length > 0;
85
+ }
86
+ function sameMappings(actual, expected) {
87
+ return Array.isArray(actual) && JSON.stringify(actual) === JSON.stringify(expected);
88
+ }
89
+ const ALLOWED_CAVEAT_PAIRS = [
90
+ { reason: "inferred_equivalence", ownership_state: "review_required" },
91
+ { reason: "inferred_equivalence", ownership_state: "project_governs_exact" },
92
+ { reason: "authority_unavailable", ownership_state: "authority_unavailable" },
93
+ { reason: "personal_input_unavailable", ownership_state: "authority_unavailable" },
94
+ ];
95
+ export function validateConsumerBoundary(consumer) {
96
+ const errors = [];
97
+ const implementation = mapping(consumer?.implementation);
98
+ const integrations = mapping(implementation?.capability_integrations);
99
+ if (consumer?.contract_status !== "active" ||
100
+ implementation?.acquisition !== "active" ||
101
+ implementation?.advice_resolution !== "active" ||
102
+ integrations?.build !== "active" ||
103
+ integrations?.discuss !== "active" ||
104
+ integrations?.plan !== "active" ||
105
+ integrations?.prime !== "active") {
106
+ errors.push("consumer_boundary.implementation must activate Build, Discuss, Plan, and prime");
107
+ }
108
+ const discuss = mapping(consumer?.discuss_integration);
109
+ const discussInteraction = mapping(discuss?.interaction);
110
+ if (discuss?.implementation !== "active" ||
111
+ discuss?.invocation !== "consumer_boundary.advice_resolution.invocation" ||
112
+ discuss?.governed_events !== "consumer_boundary.refresh_events" ||
113
+ discuss?.outcome_authority !== "consumer_boundary.outcome_matrix" ||
114
+ discuss?.disclosure !== "consumer_boundary.disclosure.transient_advice" ||
115
+ discussInteraction?.scope !== "current_user_authored_meaning_sensitive_input" ||
116
+ discussInteraction?.transcript_scan !== "forbidden" ||
117
+ discussInteraction?.done_only_control !== "no_refresh" ||
118
+ !nonEmpty(discussInteraction?.review_rule) ||
119
+ !nonEmpty(discussInteraction?.exact_collision_rule) ||
120
+ !nonEmpty(discussInteraction?.unavailable_rule) ||
121
+ !nonEmpty(discuss?.output_rule) ||
122
+ discuss?.mutation !== "forbidden" ||
123
+ !sameStrings(discuss?.forbidden_effects, [
124
+ "glossary_write",
125
+ "glossary_approval",
126
+ "publication_consent",
127
+ "progress_caveat",
128
+ "plan_conflict",
129
+ "decision_conflict",
130
+ ])) {
131
+ errors.push("consumer_boundary.discuss_integration must use bounded transient advice without mutation");
132
+ }
133
+ const plan = mapping(consumer?.plan_integration);
134
+ const planMode = mapping(plan?.mode);
135
+ const planSignals = mapping(planMode?.signals);
136
+ const planInteraction = mapping(plan?.interaction);
137
+ const planReview = mapping(planInteraction?.review);
138
+ const handoffIntent = mapping(plan?.autonomous_handoff_intent);
139
+ const exactProjectUnavailable = mapping(plan?.exact_project_personal_unavailable);
140
+ const unavailable = mapping(plan?.unavailable);
141
+ const invalidProject = mapping(unavailable?.invalid_project);
142
+ const invalidPersonalGap = mapping(unavailable?.invalid_personal_after_project_gap);
143
+ const behavior = mapping(plan?.behavior_matrix);
144
+ if (plan?.implementation !== "active" ||
145
+ plan?.invocation !== "consumer_boundary.advice_resolution.invocation" ||
146
+ plan?.governed_events !== "consumer_boundary.refresh_events" ||
147
+ plan?.outcome_authority !== "consumer_boundary.outcome_matrix" ||
148
+ plan?.disclosure !== "consumer_boundary.disclosure.transient_advice" ||
149
+ !sameStrings(planMode?.precedence, [
150
+ "explicit_delegated_or_orchestrated_no_pause",
151
+ "direct_user_invocation_with_available_clarification_turn",
152
+ "unknown_or_ambiguous",
153
+ ]) ||
154
+ mapping(planSignals?.explicit_delegated_or_orchestrated_no_pause)?.result !== "autonomous" ||
155
+ mapping(planSignals?.direct_user_invocation_with_available_clarification_turn)?.result !==
156
+ "interactive" ||
157
+ mapping(planSignals?.unknown_or_ambiguous)?.result !== "interactive_waiting" ||
158
+ planMode?.silence_or_timeout !== "never_autonomous" ||
159
+ !nonEmpty(planMode?.rule) ||
160
+ planInteraction?.scope !== "current_user_authored_meaning_sensitive_input" ||
161
+ planInteraction?.transcript_scan !== "forbidden" ||
162
+ planInteraction?.control_only_continuation !== "no_refresh" ||
163
+ !sameStrings(planReview?.interactive_sequence, [
164
+ "emit_one_focused_clarification",
165
+ "wait_for_user_answer",
166
+ "refresh_advice_for_affected_term",
167
+ "finalize_affected_scope_requirements_tasks_acceptance",
168
+ ]) ||
169
+ !sameStrings(planReview?.autonomous_sequence, [
170
+ "abstain_from_disputed_meaning",
171
+ "defer_affected_scope_requirements_tasks_acceptance",
172
+ "emit_transient_handoff_intent",
173
+ ]) ||
174
+ !sameStrings(planReview?.clarification_effects, [
175
+ "not_plan_approval",
176
+ "not_decision_confirmation",
177
+ "not_glossary_approval",
178
+ "not_publication_consent",
179
+ ]) ||
180
+ !nonEmpty(planInteraction?.exact_collision_rule) ||
181
+ !nonEmpty(planInteraction?.unavailable_rule) ||
182
+ handoffIntent?.status !== "transient_emitted_not_delivered" ||
183
+ !sameStrings(handoffIntent?.caller_fields, ["event", "reason", "ownership_state"]) ||
184
+ JSON.stringify(mapping(handoffIntent?.fixed_values)) !== JSON.stringify({ event: "current" }) ||
185
+ !sameStrings(handoffIntent?.accepted_writer_flags, [
186
+ "--glossary-caveat-event",
187
+ "--glossary-caveat-reason",
188
+ "--glossary-caveat-ownership-state",
189
+ ]) ||
190
+ !sameStrings(handoffIntent?.writer_owned_fields, [
191
+ "caveat_id",
192
+ "capability",
193
+ "transition_id",
194
+ ]) ||
195
+ !sameStrings(handoffIntent?.forbidden_fields, ["caveat_id", "capability", "transition_id"]) ||
196
+ !sameStrings(handoffIntent?.forbidden_claims, [
197
+ "delivered",
198
+ "stored",
199
+ "persisted",
200
+ "published",
201
+ "durable_envelope",
202
+ ]) ||
203
+ handoffIntent?.durable_writer !== "build" ||
204
+ handoffIntent?.writer_interface !==
205
+ "agentera state progress explain --verb append --format json" ||
206
+ handoffIntent?.writer_result !== "authoritative_identity_and_six_field_envelope" ||
207
+ handoffIntent?.allowed_reason_state_pairs !==
208
+ "consumer_boundary.autonomous_caveat.allowed_current_pairs" ||
209
+ !nonEmpty(handoffIntent?.rule) ||
210
+ !nonEmpty(plan?.output_rule) ||
211
+ plan?.handoff !== "consumer_boundary.autonomous_caveat.handoff.plan" ||
212
+ plan?.mutation !== "forbidden" ||
213
+ !sameStrings(plan?.forbidden_effects, [
214
+ "glossary_write",
215
+ "glossary_approval",
216
+ "publication_consent",
217
+ "progress_caveat",
218
+ "plan_conflict",
219
+ "decision_conflict",
220
+ ])) {
221
+ errors.push("consumer_boundary.plan_integration must define deterministic mode, ordered review, autonomous abstention, and an emitted event/reason/state writer intent");
222
+ }
223
+ if (exactProjectUnavailable?.primary_outcome !== "project_only" ||
224
+ exactProjectUnavailable?.advisory_reason !== "personal_input_unavailable" ||
225
+ exactProjectUnavailable?.advisory_ownership_state !== "project_governs_exact" ||
226
+ exactProjectUnavailable?.plan_action !== "ground_exact_project_meaning" ||
227
+ exactProjectUnavailable?.autonomous_handoff_intent !== "none" ||
228
+ exactProjectUnavailable?.durable_unresolved_caveat !== "none" ||
229
+ !nonEmpty(exactProjectUnavailable?.rule) ||
230
+ invalidProject?.interactive !== "clarify_or_wait_when_meaning_critical" ||
231
+ invalidProject?.autonomous !== "abstain_defer_and_emit_authority_unavailable" ||
232
+ !sameStrings(invalidProject?.handoff_pair, [
233
+ "authority_unavailable",
234
+ "authority_unavailable",
235
+ ]) ||
236
+ invalidPersonalGap?.interactive !== "clarify_or_wait_when_meaning_critical" ||
237
+ invalidPersonalGap?.autonomous !== "abstain_defer_and_emit_personal_input_unavailable" ||
238
+ !sameStrings(invalidPersonalGap?.handoff_pair, [
239
+ "personal_input_unavailable",
240
+ "authority_unavailable",
241
+ ]) ||
242
+ mapping(behavior?.interactive_review_required)?.mode !== "interactive" ||
243
+ mapping(behavior?.interactive_review_required)?.plan_action !==
244
+ "clarify_refresh_then_finalize" ||
245
+ mapping(behavior?.interactive_review_required)?.handoff_intent !== "none" ||
246
+ mapping(behavior?.autonomous_review_required)?.mode !== "autonomous" ||
247
+ mapping(behavior?.autonomous_review_required)?.plan_action !== "abstain_and_defer" ||
248
+ mapping(behavior?.autonomous_review_required)?.handoff_intent !== "emitted" ||
249
+ mapping(behavior?.exact_project_personal_unavailable)?.mode !== "any" ||
250
+ mapping(behavior?.exact_project_personal_unavailable)?.plan_action !==
251
+ "ground_exact_project_meaning" ||
252
+ mapping(behavior?.exact_project_personal_unavailable)?.handoff_intent !== "none" ||
253
+ mapping(behavior?.unavailable_unresolved)?.mode !== "autonomous" ||
254
+ mapping(behavior?.unavailable_unresolved)?.plan_action !== "abstain_and_defer" ||
255
+ mapping(behavior?.unavailable_unresolved)?.handoff_intent !== "emitted" ||
256
+ mapping(behavior?.divergent_exact_collision)?.mode !== "any" ||
257
+ mapping(behavior?.divergent_exact_collision)?.plan_action !==
258
+ "ground_project_and_bound_tension" ||
259
+ mapping(behavior?.divergent_exact_collision)?.handoff_intent !== "none" ||
260
+ mapping(behavior?.irrelevant_or_no_applicable_entry)?.mode !== "any" ||
261
+ mapping(behavior?.irrelevant_or_no_applicable_entry)?.plan_action !==
262
+ "leave_unaffected_planning_unchanged" ||
263
+ mapping(behavior?.irrelevant_or_no_applicable_entry)?.handoff_intent !== "none") {
264
+ errors.push("consumer_boundary.plan_integration must separate exact-project personal-input advice from unresolved autonomous handoff");
265
+ }
266
+ const advice = mapping(consumer?.advice_resolution);
267
+ const invocation = mapping(advice?.invocation);
268
+ const adviceInput = mapping(advice?.input);
269
+ const hostReview = mapping(adviceInput?.host_review);
270
+ const adviceOutput = mapping(advice?.output);
271
+ const adviceFailure = mapping(advice?.failure);
272
+ if (advice?.implementation !== "active" ||
273
+ advice?.runtime !==
274
+ "packages/cli/src/analytics/glossaryAdviceResolution.ts#resolveGlossaryAdvice" ||
275
+ advice?.mutation !== "forbidden" ||
276
+ invocation?.command !== "agentera report glossary-advice --input REQUEST --format json" ||
277
+ invocation?.request_schema_version !== "agentera.glossaryAdviceRequest.v1" ||
278
+ !sameStrings(invocation?.request_fields, ["schema_version", "requested_term", "host_review"]) ||
279
+ invocation?.max_request_utf8_bytes !== 131072 ||
280
+ invocation?.acquisition !== "internal_bounded_owned_sources" ||
281
+ invocation?.project_root !== "current_working_directory" ||
282
+ invocation?.profile_path !== "canonical_registry_resolution" ||
283
+ !sameStrings(invocation?.output_envelope_fields, [
284
+ "schemaVersion",
285
+ "command",
286
+ "status",
287
+ "advice",
288
+ ]) ||
289
+ !nonEmpty(invocation?.rule) ||
290
+ !sameStrings(adviceInput?.fields, ["requested_term", "acquired", "host_review"]) ||
291
+ adviceInput?.requested_term_utf8_bound !==
292
+ "consumer_boundary.acquisition.bounds.max_source_utf8_bytes" ||
293
+ adviceInput?.acquired_contract !== "consumer_boundary.acquisition.output" ||
294
+ hostReview?.optional !== true ||
295
+ !sameStrings(hostReview?.fields, ["relation", "candidate_owner", "candidate_term"]) ||
296
+ !sameStrings(hostReview?.relations, ["inferred_equivalence"]) ||
297
+ !sameStrings(hostReview?.candidate_owners, ["personal"]) ||
298
+ !nonEmpty(hostReview?.rule) ||
299
+ adviceInput?.additional_fields !== "forbidden" ||
300
+ adviceOutput?.schema_version !== "agentera.glossaryAdvice.v1" ||
301
+ !sameStrings(adviceOutput?.fields, [
302
+ "outcome",
303
+ "applicable_meaning",
304
+ "applicable_owner",
305
+ "review",
306
+ "tension",
307
+ "advisory",
308
+ ]) ||
309
+ !sameStrings(adviceOutput?.owners, ["personal", "project"]) ||
310
+ !sameStrings(adviceOutput?.advisory_fields, ["reason", "ownership_state"]) ||
311
+ !sameStrings(adviceOutput?.advisory_reasons, [
312
+ "personal_input_unavailable",
313
+ "inferred_equivalence",
314
+ ]) ||
315
+ !sameStrings(adviceOutput?.advisory_ownership_states, ["project_governs_exact"]) ||
316
+ !nonEmpty(adviceOutput?.rule) ||
317
+ !sameStrings(adviceFailure?.classes, [
318
+ "invalid_request",
319
+ "invalid_acquisition",
320
+ "invalid_host_review",
321
+ ]) ||
322
+ !nonEmpty(adviceFailure?.rule)) {
323
+ errors.push("consumer_boundary.advice_resolution must define the active bounded read-only runtime, host-review input, transient output, and privacy-safe failure contract");
324
+ }
325
+ const acquisition = mapping(consumer?.acquisition);
326
+ const bounds = mapping(acquisition?.bounds);
327
+ const availability = mapping(acquisition?.availability);
328
+ const projectAcquisition = mapping(acquisition?.project);
329
+ const personalAcquisition = mapping(acquisition?.personal);
330
+ const acquisitionOutput = mapping(acquisition?.output);
331
+ if (acquisition?.implementation !== "active" ||
332
+ acquisition?.runtime !==
333
+ "packages/cli/src/analytics/glossaryInputAcquisition.ts#acquireGlossaryInputs" ||
334
+ acquisition?.mutation !== "forbidden" ||
335
+ bounds?.authority !== "consumer_boundary.profile_grounding.max_profile_utf8_bytes" ||
336
+ bounds?.max_source_utf8_bytes !== 65536 ||
337
+ bounds?.max_entries !== 100 ||
338
+ !nonEmpty(bounds?.rule) ||
339
+ !sameStrings(availability?.states, [
340
+ "absent",
341
+ "valid_empty",
342
+ "valid_present",
343
+ "malformed",
344
+ "unreadable",
345
+ "ambiguous",
346
+ "over_bound",
347
+ ]) ||
348
+ !sameStrings(availability?.valid, ["absent", "valid_empty", "valid_present"]) ||
349
+ !sameStrings(availability?.invalid, ["malformed", "unreadable", "ambiguous", "over_bound"]) ||
350
+ !sameStrings(availability?.project_gap_proving, ["absent", "valid_empty"]) ||
351
+ !nonEmpty(availability?.rule) ||
352
+ projectAcquisition?.identity !== "glossary" ||
353
+ projectAcquisition?.discovery !==
354
+ "packages/cli/src/registries/artifactRegistry.ts#loadArtifactRecord" ||
355
+ projectAcquisition?.path_resolution !==
356
+ "packages/cli/src/registries/artifactRegistry.ts#resolveArtifactPath" ||
357
+ projectAcquisition?.docs_override_read !== "bounded_no_follow_regular_file" ||
358
+ projectAcquisition?.project_root !==
359
+ "packages/cli/src/state/projectRoot.ts#validateRealProjectRoot" ||
360
+ !nonEmpty(projectAcquisition?.filesystem_guarantee) ||
361
+ !nonEmpty(projectAcquisition?.external_docs_rule) ||
362
+ projectAcquisition?.approval_output !== "forbidden" ||
363
+ projectAcquisition?.raw_source_provenance_output !== "forbidden" ||
364
+ personalAcquisition?.parser !==
365
+ "packages/cli/src/analytics/personalGlossaryProfile.ts#personalGlossaryConsumerEntries" ||
366
+ personalAcquisition?.provenance_output !== "forbidden" ||
367
+ !nonEmpty(personalAcquisition?.profile_path_input) ||
368
+ !nonEmpty(personalAcquisition?.grounding_parser_isolation) ||
369
+ !nonEmpty(personalAcquisition?.producer_invariance) ||
370
+ !sameStrings(acquisitionOutput?.entry_fields, ["term", "meaning", "owner"]) ||
371
+ !sameStrings(acquisitionOutput?.owners, ["personal", "project"]) ||
372
+ !sameStrings(acquisitionOutput?.source_fields, [
373
+ "owner",
374
+ "availability",
375
+ "entries",
376
+ "gap_proving",
377
+ "diagnostic",
378
+ ]) ||
379
+ !sameStrings(acquisitionOutput?.diagnostic_fields, ["class", "recovery"]) ||
380
+ !nonEmpty(acquisitionOutput?.diagnostic_rule) ||
381
+ !nonEmpty(acquisitionOutput?.entry_rule)) {
382
+ errors.push("consumer_boundary.acquisition must define canonical bounded independent project and personal reads with sanitized term/meaning/owner output");
383
+ }
384
+ const judgments = mapping(consumer?.deterministic_judgments);
385
+ const hostJudgments = mapping(consumer?.host_reviewed_judgments);
386
+ const projectState = mapping(consumer?.project_state);
387
+ if (judgments?.term_identity !== "unicode_caseless_exact_no_normalization" ||
388
+ judgments?.term_identity_runtime !==
389
+ "packages/cli/src/registries/glossaryTermIdentity.ts#unicodeCaselessExact" ||
390
+ judgments?.meaning_identity !== "exact_string" ||
391
+ judgments?.project_state_validity !== "schema_and_bound_validation" ||
392
+ judgments?.project_gap !== "valid_project_state_without_exact_term_identity" ||
393
+ !sameStrings(judgments?.forbidden_semantic_heuristics, [
394
+ "scores",
395
+ "thresholds",
396
+ "embeddings",
397
+ "automatic_merge",
398
+ ]) ||
399
+ !nonEmpty(hostJudgments?.inferred_semantic_equivalence) ||
400
+ !sameStrings(projectState?.gap_proving_states, [
401
+ "canonically_absent",
402
+ "valid_empty",
403
+ "valid_nonmatching",
404
+ ]) ||
405
+ !sameStrings(projectState?.invalid_states, [
406
+ "malformed",
407
+ "unreadable",
408
+ "ambiguous_path",
409
+ "over_bound",
410
+ ]) ||
411
+ !nonEmpty(projectState?.invalid_rule)) {
412
+ errors.push("consumer_boundary judgments must separate deterministic exact identity and valid gaps from host-reviewed inferred equivalence and invalid project state");
413
+ }
414
+ const selection = mapping(consumer?.primary_selection);
415
+ const dimensions = mapping(selection?.dimensions);
416
+ const matrix = mapping(consumer?.outcome_matrix);
417
+ // These literals validate the authority's fixed primary-outcome shape; runtime
418
+ // behavior and predicates remain owned by the YAML contract below this gate.
419
+ const expectedOutcomes = Object.keys(OUTCOME_SEMANTICS);
420
+ const matrixValid = sameStrings(dimensions?.project_input, ["invalid", "valid_gap", "valid_exact"]) &&
421
+ sameStrings(dimensions?.personal_input, ["invalid", "valid_without_exact", "valid_exact"]) &&
422
+ sameStrings(dimensions?.exact_meaning, ["not_applicable", "equivalent", "divergent"]) &&
423
+ sameStrings(dimensions?.inferred_candidate, ["absent", "present"]) &&
424
+ nonEmpty(selection?.valid_state_rule) &&
425
+ sameStrings(selection?.order, expectedOutcomes) &&
426
+ nonEmpty(selection?.rule) &&
427
+ sameStrings(Object.keys(matrix ?? {}), expectedOutcomes) &&
428
+ expectedOutcomes.every((name) => {
429
+ const outcome = mapping(matrix?.[name]);
430
+ const match = mapping(outcome?.match);
431
+ return (nonEmpty(outcome?.when) &&
432
+ strings(match?.project_input).length > 0 &&
433
+ strings(match?.project_input).every((value) => strings(dimensions?.project_input).includes(value)) &&
434
+ strings(match?.personal_input).length > 0 &&
435
+ strings(match?.personal_input).every((value) => strings(dimensions?.personal_input).includes(value)) &&
436
+ strings(match?.exact_meaning).length > 0 &&
437
+ strings(match?.exact_meaning).every((value) => strings(dimensions?.exact_meaning).includes(value)) &&
438
+ strings(match?.inferred_candidate).length > 0 &&
439
+ strings(match?.inferred_candidate).every((value) => strings(dimensions?.inferred_candidate).includes(value)));
440
+ });
441
+ if (!matrixValid) {
442
+ errors.push("consumer_boundary outcome matrix and primary_selection must define all eight ordered collision, gap, review, absence, and invalid-input outcomes");
443
+ }
444
+ for (const outcomeName of expectedOutcomes) {
445
+ const outcome = mapping(matrix?.[outcomeName]);
446
+ const expected = OUTCOME_SEMANTICS[outcomeName];
447
+ for (const field of OUTCOME_SEMANTIC_FIELDS) {
448
+ if (outcome?.[field] === expected[field])
449
+ continue;
450
+ const actual = outcome && field in outcome ? JSON.stringify(outcome[field]) : "missing";
451
+ errors.push(`consumer_boundary.outcome_matrix.${outcomeName}.${field} must be ${JSON.stringify(expected[field])} (found ${actual}); restore the canonical primary-outcome semantics and rerun agentera check validate vocabularyAuthority --format json`);
452
+ }
453
+ }
454
+ const validStates = [];
455
+ for (const projectInput of ["invalid", "valid_gap", "valid_exact"]) {
456
+ for (const personalInput of ["invalid", "valid_without_exact", "valid_exact"]) {
457
+ const exactMeanings = projectInput === "valid_exact" && personalInput === "valid_exact"
458
+ ? ["equivalent", "divergent"]
459
+ : ["not_applicable"];
460
+ for (const exactMeaning of exactMeanings) {
461
+ for (const inferredCandidate of ["absent", "present"]) {
462
+ validStates.push({
463
+ project_input: projectInput,
464
+ personal_input: personalInput,
465
+ exact_meaning: exactMeaning,
466
+ inferred_candidate: inferredCandidate,
467
+ });
468
+ }
469
+ }
470
+ }
471
+ }
472
+ const selectionFailures = validStates.flatMap((state) => {
473
+ const matches = expectedOutcomes.filter((name) => {
474
+ const match = mapping(mapping(matrix?.[name])?.match);
475
+ return Object.entries(state).every(([dimension, value]) => strings(match?.[dimension]).includes(value));
476
+ });
477
+ return matches.length === 1 ? [] : [`${JSON.stringify(state)} matched [${matches.join(", ")}]`];
478
+ });
479
+ if (selectionFailures.length > 0) {
480
+ errors.push(`consumer_boundary.primary_selection must be exhaustive and non-overlapping: ${selectionFailures[0]}; correct outcome_matrix[*].match and rerun agentera check validate vocabularyAuthority --format json`);
481
+ }
482
+ const advisories = mapping(consumer?.orthogonal_advisories);
483
+ const unavailableAdvisory = mapping(advisories?.personal_input_unavailable_with_project_exact);
484
+ const inferredAdvisory = mapping(advisories?.inferred_equivalence_with_project_exact);
485
+ if (unavailableAdvisory?.primary_outcome !== "project_only" ||
486
+ !sameStrings(mapping(unavailableAdvisory?.match)?.project_input, ["valid_exact"]) ||
487
+ !sameStrings(mapping(unavailableAdvisory?.match)?.personal_input, ["invalid"]) ||
488
+ !sameStrings(mapping(unavailableAdvisory?.match)?.exact_meaning, ["not_applicable"]) ||
489
+ !sameStrings(mapping(unavailableAdvisory?.match)?.inferred_candidate, ["absent", "present"]) ||
490
+ unavailableAdvisory?.caveat_reason !== "personal_input_unavailable" ||
491
+ unavailableAdvisory?.ownership_state !== "project_governs_exact" ||
492
+ !nonEmpty(unavailableAdvisory?.rule) ||
493
+ inferredAdvisory?.primary_outcome !== "project_only" ||
494
+ !sameStrings(mapping(inferredAdvisory?.match)?.project_input, ["valid_exact"]) ||
495
+ !sameStrings(mapping(inferredAdvisory?.match)?.personal_input, ["valid_without_exact"]) ||
496
+ !sameStrings(mapping(inferredAdvisory?.match)?.exact_meaning, ["not_applicable"]) ||
497
+ !sameStrings(mapping(inferredAdvisory?.match)?.inferred_candidate, ["present"]) ||
498
+ inferredAdvisory?.caveat_reason !== "inferred_equivalence" ||
499
+ inferredAdvisory?.ownership_state !== "project_governs_exact" ||
500
+ !nonEmpty(inferredAdvisory?.review) ||
501
+ !nonEmpty(inferredAdvisory?.rule)) {
502
+ errors.push("consumer_boundary.orthogonal_advisories must preserve exact project authority while bounding personal availability and inferred-equivalence review caveats");
503
+ }
504
+ const refresh = mapping(consumer?.refresh_events);
505
+ if (!sameStrings(refresh?.required, [
506
+ "initial_meaning_sensitive_input",
507
+ "later_user_requirement_change_that_can_change_meaning",
508
+ "later_user_intent_change_that_can_change_meaning",
509
+ "later_acceptance_change_that_can_change_meaning",
510
+ "later_deliberation_premise_change_that_can_change_meaning",
511
+ "later_cycle_intent_change_that_can_change_meaning",
512
+ "clarification_answer_for_a_reviewed_term",
513
+ ]) ||
514
+ !sameStrings(refresh?.not_required, [
515
+ "unrelated_conversation_turn",
516
+ "unchanged_input_replay",
517
+ "background_state_reread",
518
+ "status_or_progress_render",
519
+ "tool_output_without_requirement_or_intent_change",
520
+ "artifact_rendering",
521
+ "evaluator_text_without_user_change",
522
+ "control_only_continuation",
523
+ ]) ||
524
+ !nonEmpty(refresh?.rule)) {
525
+ errors.push("consumer_boundary.refresh_events must require meaning-sensitive initial and changed intent inputs and exclude unrelated turns and background rereads");
526
+ }
527
+ const disclosure = mapping(consumer?.disclosure);
528
+ const transient = mapping(disclosure?.transient_advice);
529
+ const durable = mapping(disclosure?.durable_surfaces);
530
+ const planArtifacts = mapping(disclosure?.plan_artifacts);
531
+ const durableForbidden = [
532
+ "personal_definition",
533
+ "project_definition",
534
+ "personal_evidence_anchor",
535
+ "personal_profile_path",
536
+ "raw_personal_glossary_section",
537
+ "raw_project_glossary_section",
538
+ "unrelated_entry",
539
+ "provenance",
540
+ "project_source_path",
541
+ ];
542
+ if (!sameStrings(transient?.allowed, [
543
+ "outcome",
544
+ "applicable_meaning",
545
+ "applicable_owner",
546
+ "review",
547
+ "tension",
548
+ "advisory",
549
+ ]) ||
550
+ !nonEmpty(transient?.minimum_rule) ||
551
+ !sameStrings(durable?.surfaces, [
552
+ "progress_evidence",
553
+ "prime_attention",
554
+ "diagnostics",
555
+ "errors",
556
+ ]) ||
557
+ !sameStrings(durable?.allowed, [
558
+ "caveat_id",
559
+ "event",
560
+ "capability",
561
+ "reason",
562
+ "ownership_state",
563
+ "transition_id",
564
+ ]) ||
565
+ !sameStrings(durable?.forbidden, durableForbidden) ||
566
+ !nonEmpty(durable?.failure_rule)) {
567
+ errors.push("consumer_boundary.disclosure must bound transient advice and exclude definitions, anchors, paths, raw sections, unrelated entries, and provenance from durable output and errors");
568
+ }
569
+ if (!sameStrings(planArtifacts?.surfaces, [
570
+ "scope",
571
+ "requirements",
572
+ "constraints",
573
+ "tasks",
574
+ "task_acceptance",
575
+ "overall_acceptance",
576
+ "diagnostics",
577
+ "handoff",
578
+ ]) ||
579
+ !sameStrings(planArtifacts?.allowed_sources, [
580
+ "user_authored_term",
581
+ "user_authored_clarification",
582
+ "derived_behavioral_requirement",
583
+ ]) ||
584
+ !sameStrings(planArtifacts?.forbidden_content, [
585
+ "profile_derived_definition",
586
+ "personal_glossary_definition",
587
+ "personal_evidence_anchor",
588
+ "personal_profile_path",
589
+ "raw_personal_glossary_section",
590
+ "raw_project_glossary_section",
591
+ "unrelated_entry",
592
+ "provenance",
593
+ "project_source_path",
594
+ ]) ||
595
+ !nonEmpty(planArtifacts?.user_term_rule)) {
596
+ errors.push("consumer_boundary.disclosure must forbid private glossary content in every durable Plan surface while allowing user-authored terms and derived requirements");
597
+ }
598
+ const caveat = mapping(consumer?.autonomous_caveat);
599
+ const identity = mapping(caveat?.identity);
600
+ const envelope = mapping(caveat?.envelope);
601
+ const currentAppend = mapping(envelope?.current_append);
602
+ const lifecycle = mapping(caveat?.lifecycle);
603
+ const handoff = mapping(caveat?.handoff);
604
+ const primeProjection = mapping(caveat?.prime_projection);
605
+ const primeSource = mapping(primeProjection?.source);
606
+ const primeCapacity = mapping(primeProjection?.capacity);
607
+ const malformedEvidence = mapping(primeProjection?.malformed_evidence);
608
+ if (caveat?.durable_owner !== "build" ||
609
+ caveat?.durable_channel !== "progress" ||
610
+ caveat?.authority !== "skills/agentera/schemas/artifacts/progress.yaml#ENTITY_AUTHORITY" ||
611
+ caveat?.publication_command !== "agentera state progress append" ||
612
+ caveat?.publication_boundary !== "progress_cycle.glossary_caveat" ||
613
+ caveat?.publication_status !== "active_build" ||
614
+ caveat?.writer_runtime !== "packages/cli/src/state/progressEntities.ts#appendProgressEntity" ||
615
+ caveat?.writer_interface !== "agentera state progress explain --verb append --format json" ||
616
+ caveat?.envelope_validator !==
617
+ "packages/cli/src/state/progressGlossaryCaveat.ts#validateProgressGlossaryCaveat" ||
618
+ caveat?.lifecycle_validator !==
619
+ "packages/cli/src/state/progressGlossaryCaveat.ts#glossaryCaveatLifecycleInvalidEntities" ||
620
+ !sameMappings(caveat?.allowed_current_pairs, ALLOWED_CAVEAT_PAIRS) ||
621
+ identity?.field !== "caveat_id" ||
622
+ identity?.type !== "opaque_non_content_id" ||
623
+ identity?.alphabet !== "abcdefghijklmnopqrstuvwxyz" ||
624
+ identity?.length !== 10 ||
625
+ identity?.pattern !== "^[a-z]{10}$" ||
626
+ !nonEmpty(identity?.rule) ||
627
+ envelope?.schema_version !== "agentera.glossaryConsumerCaveat.v1" ||
628
+ envelope?.additional_fields !== "forbidden" ||
629
+ envelope?.max_string_utf8_bytes !== 64 ||
630
+ !sameStrings(envelope?.events, ["current", "resolved", "superseded"]) ||
631
+ !sameStrings(envelope?.fields, [
632
+ "caveat_id",
633
+ "event",
634
+ "capability",
635
+ "reason",
636
+ "ownership_state",
637
+ "transition_id",
638
+ ]) ||
639
+ !sameStrings(envelope?.capabilities, ["build"]) ||
640
+ !sameStrings(envelope?.reasons, [
641
+ "inferred_equivalence",
642
+ "authority_unavailable",
643
+ "personal_input_unavailable",
644
+ ]) ||
645
+ !sameStrings(envelope?.ownership_states, [
646
+ "project_governs_exact",
647
+ "review_required",
648
+ "authority_unavailable",
649
+ ]) ||
650
+ !sameStrings(currentAppend?.caller_fields, ["event", "reason", "ownership_state"]) ||
651
+ JSON.stringify(mapping(currentAppend?.caller_fixed_values)) !==
652
+ JSON.stringify({ event: "current" }) ||
653
+ !sameStrings(currentAppend?.writer_fields, ["caveat_id", "capability", "transition_id"]) ||
654
+ JSON.stringify(mapping(currentAppend?.writer_fixed_values)) !==
655
+ JSON.stringify({ capability: "build", transition_id: null }) ||
656
+ !nonEmpty(currentAppend?.rule) ||
657
+ !nonEmpty(envelope?.transition_rule) ||
658
+ !nonEmpty(lifecycle?.current) ||
659
+ !nonEmpty(lifecycle?.resolved) ||
660
+ !nonEmpty(lifecycle?.superseded) ||
661
+ !nonEmpty(lifecycle?.matching_rule) ||
662
+ lifecycle?.expiration !== "none" ||
663
+ !nonEmpty(lifecycle?.expiration_rule) ||
664
+ primeProjection?.status !== "active" ||
665
+ primeProjection?.runtime !==
666
+ "packages/cli/src/state/progressGlossaryCaveat.ts#projectCurrentGlossaryCaveats" ||
667
+ primeProjection?.retrieval !== "canonical_validated_progress_entities" ||
668
+ !nonEmpty(primeProjection?.attention_text) ||
669
+ primeProjection?.max_attention_entries !== 1 ||
670
+ primeProjection?.insertion !== "reserved_final_slot_when_current" ||
671
+ !nonEmpty(primeProjection?.rule) ||
672
+ primeProjection?.expiration !== "none" ||
673
+ !sameStrings(primeProjection?.forbidden_sources, [
674
+ "timestamp",
675
+ "recency",
676
+ "plan_state",
677
+ "transient_plan_handoff",
678
+ "profile_presence",
679
+ "unrelated_progress",
680
+ ]) ||
681
+ !sameStrings(primeProjection?.forbidden_output, [
682
+ "caveat_id",
683
+ "transition_id",
684
+ "reason",
685
+ "ownership_state",
686
+ "definition",
687
+ "meaning",
688
+ "anchor",
689
+ "path",
690
+ "raw_section",
691
+ "provenance",
692
+ "source_bytes",
693
+ ]) ||
694
+ primeSource?.artifact !== "progress" ||
695
+ primeSource?.boundary !== "progress_cycle" ||
696
+ primeSource?.capability !== "build" ||
697
+ primeCapacity?.public_attention_limit !== 6 ||
698
+ primeCapacity?.reserved_glossary_slots !== 1 ||
699
+ primeCapacity?.policy !== "reserve_final_slot_when_current" ||
700
+ primeCapacity?.unrelated_retention !== "first_five_in_existing_order" ||
701
+ malformedEvidence?.prime !== "omit" ||
702
+ malformedEvidence?.direct_progress_retrieval !== "fail_closed_generic_corrupt_entity" ||
703
+ !nonEmpty(malformedEvidence?.allowed_diagnostic) ||
704
+ !sameStrings(malformedEvidence?.forbidden_diagnostic_content, [
705
+ "stored_filename",
706
+ "stored_path",
707
+ "parser_text",
708
+ "raw_value",
709
+ "raw_bytes",
710
+ "provenance",
711
+ ]) ||
712
+ !nonEmpty(handoff?.plan) ||
713
+ !nonEmpty(handoff?.discuss) ||
714
+ !nonEmpty(handoff?.build)) {
715
+ errors.push("consumer_boundary.autonomous_caveat must define Build-owned progress evidence, exact pairs, lifecycle, and bounded active prime projection");
716
+ }
717
+ const publication = mapping(consumer?.publication_isolation);
718
+ if (!nonEmpty(publication?.rule) ||
719
+ publication?.project_publication_authority !== "ownership_contracts.project.publication") {
720
+ errors.push("consumer_boundary.publication_isolation must keep advice and caveat lifecycle separate from Build-owned digest-confirmed publication and approval");
721
+ }
722
+ const gate = mapping(consumer?.downstream_gate);
723
+ if (gate?.status !== "blocked_until_contract_valid" ||
724
+ gate?.validator !==
725
+ "packages/cli/src/registries/glossaryEntryContract.ts#validateGlossaryEntryContract" ||
726
+ gate?.command !== "agentera check validate vocabularyAuthority --format json" ||
727
+ !sameStrings(gate?.required_sections, [
728
+ "consumer_boundary.acquisition",
729
+ "consumer_boundary.advice_resolution",
730
+ "consumer_boundary.primary_selection",
731
+ "consumer_boundary.outcome_matrix",
732
+ "consumer_boundary.orthogonal_advisories",
733
+ "consumer_boundary.refresh_events",
734
+ "consumer_boundary.discuss_integration",
735
+ "consumer_boundary.plan_integration",
736
+ "consumer_boundary.disclosure",
737
+ "consumer_boundary.autonomous_caveat",
738
+ "consumer_boundary.publication_isolation",
739
+ ]) ||
740
+ !nonEmpty(gate?.failure_rule)) {
741
+ errors.push("consumer_boundary.downstream_gate must block integration with section-specific validation and an actionable local command");
742
+ }
743
+ return errors;
744
+ }
745
+ export function validateConsumerEvidenceOwner(consumer) {
746
+ let progress;
747
+ try {
748
+ progress = contract(path.join(resolveSourceRoot(), "skills", "agentera", "schemas", "artifacts", "progress.yaml"));
749
+ }
750
+ catch (error) {
751
+ return [
752
+ `consumer_boundary.autonomous_caveat progress authority is unavailable: ${error.message}`,
753
+ ];
754
+ }
755
+ const cycle = mapping(mapping(progress.CYCLE)?.["11"]);
756
+ const schema = mapping(progress.GLOSSARY_CAVEAT);
757
+ const fields = mapping(schema?.fields);
758
+ const schemaCurrentAppend = mapping(schema?.current_append);
759
+ const caveat = mapping(consumer?.autonomous_caveat);
760
+ const envelope = mapping(caveat?.envelope);
761
+ const authorityCurrentAppend = mapping(envelope?.current_append);
762
+ if (cycle?.field !== "glossary_caveat" ||
763
+ cycle?.implementation_status !== "active_build" ||
764
+ cycle?.authority !==
765
+ "references/artifacts/glossary-entry-contract.yaml#consumer_boundary.autonomous_caveat" ||
766
+ schema?.schema_version !== envelope?.schema_version ||
767
+ schema?.implementation_status !== "active_build" ||
768
+ mapping(schema?.reader_status)?.prime !== "active" ||
769
+ schema?.envelope_validator !== caveat?.envelope_validator ||
770
+ schema?.lifecycle_validator !== caveat?.lifecycle_validator ||
771
+ schema?.allowed_current_pairs !==
772
+ "references/artifacts/glossary-entry-contract.yaml#consumer_boundary.autonomous_caveat.allowed_current_pairs" ||
773
+ !sameStrings(Object.keys(fields ?? {}), strings(envelope?.fields)) ||
774
+ !sameStrings(mapping(fields?.capability)?.values, strings(envelope?.capabilities)) ||
775
+ !sameStrings(mapping(fields?.reason)?.values, strings(envelope?.reasons)) ||
776
+ !sameStrings(mapping(fields?.ownership_state)?.values, strings(envelope?.ownership_states)) ||
777
+ !sameStrings(schemaCurrentAppend?.caller_fields, strings(authorityCurrentAppend?.caller_fields)) ||
778
+ JSON.stringify(mapping(schemaCurrentAppend?.caller_fixed_values)) !==
779
+ JSON.stringify(mapping(authorityCurrentAppend?.caller_fixed_values)) ||
780
+ !sameStrings(schemaCurrentAppend?.writer_fields, strings(authorityCurrentAppend?.writer_fields)) ||
781
+ JSON.stringify(mapping(schemaCurrentAppend?.writer_fixed_values)) !==
782
+ JSON.stringify(mapping(authorityCurrentAppend?.writer_fixed_values)) ||
783
+ !nonEmpty(schemaCurrentAppend?.rule) ||
784
+ schema?.prime_projection !==
785
+ "references/artifacts/glossary-entry-contract.yaml#consumer_boundary.autonomous_caveat.prime_projection") {
786
+ return [
787
+ "consumer_boundary.autonomous_caveat must match the active Build-owned progress_cycle.glossary_caveat schema",
788
+ ];
789
+ }
790
+ return [];
791
+ }
792
+ //# sourceMappingURL=glossaryConsumerContractValidation.js.map