@inf-monkeys-tech/monkeys 1.0.65 → 1.0.66

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 (61) hide show
  1. package/README.md +6 -0
  2. package/lib/contracts/capability.d.ts +4 -0
  3. package/lib/contracts/capability.d.ts.map +1 -1
  4. package/lib/contracts/capability.js +1 -0
  5. package/lib/contracts/capability.js.map +1 -1
  6. package/lib/contracts/declarative-control-http.d.ts +81284 -0
  7. package/lib/contracts/declarative-control-http.d.ts.map +1 -0
  8. package/lib/contracts/declarative-control-http.js +926 -0
  9. package/lib/contracts/declarative-control-http.js.map +1 -0
  10. package/lib/contracts/declarative-control.d.ts +17709 -0
  11. package/lib/contracts/declarative-control.d.ts.map +1 -0
  12. package/lib/contracts/declarative-control.js +1075 -0
  13. package/lib/contracts/declarative-control.js.map +1 -0
  14. package/lib/contracts/index.d.ts +2 -0
  15. package/lib/contracts/index.d.ts.map +1 -1
  16. package/lib/contracts/index.js +2 -0
  17. package/lib/contracts/index.js.map +1 -1
  18. package/lib/contracts/menu.d.ts +1 -1
  19. package/lib/contracts/page.d.ts +3 -3
  20. package/lib/contracts/semantic.d.ts +78 -1
  21. package/lib/contracts/semantic.d.ts.map +1 -1
  22. package/lib/contracts/semantic.js +27 -1
  23. package/lib/contracts/semantic.js.map +1 -1
  24. package/lib/contracts/tenant.d.ts +12 -12
  25. package/lib/contracts/trend.d.ts +4 -4
  26. package/lib/esm/contracts/index.mjs +2868 -1028
  27. package/lib/esm/contracts/index.mjs.map +1 -1
  28. package/lib/esm/index.mjs +5746 -3027
  29. package/lib/esm/index.mjs.map +1 -1
  30. package/lib/esm/runtime/index.mjs +2415 -594
  31. package/lib/esm/runtime/index.mjs.map +1 -1
  32. package/lib/esm/schemas/index.mjs +1986 -962
  33. package/lib/esm/schemas/index.mjs.map +1 -1
  34. package/lib/json-schema/capability-registry.schema.json +2 -1
  35. package/lib/json-schema/declarative-control-ontology-definition.schema.json +130 -0
  36. package/lib/json-schema/index.json +13 -0
  37. package/lib/json-schema/navigation-release.schema.json +2037 -0
  38. package/lib/json-schema/navigation-runtime-bundle.schema.json +7497 -0
  39. package/lib/json-schema/navigation.schema.json +4649 -0
  40. package/lib/json-schema/page-release.schema.json +2457 -0
  41. package/lib/json-schema/page-runtime-bundle.schema.json +5705 -0
  42. package/lib/json-schema/page.schema.json +7944 -0
  43. package/lib/json-schema/publication-plan.schema.json +1286 -0
  44. package/lib/json-schema/route-space.schema.json +93 -0
  45. package/lib/json-schema/stable-ref-alias-map.schema.json +535 -0
  46. package/lib/json-schema/workbench-release.schema.json +2473 -0
  47. package/lib/json-schema/workbench-runtime-bundle.schema.json +5274 -0
  48. package/lib/json-schema/workbench.schema.json +6698 -0
  49. package/lib/runtime/declarative-control-compiler.d.ts +141 -0
  50. package/lib/runtime/declarative-control-compiler.d.ts.map +1 -0
  51. package/lib/runtime/declarative-control-compiler.js +874 -0
  52. package/lib/runtime/declarative-control-compiler.js.map +1 -0
  53. package/lib/runtime/index.d.ts +1 -0
  54. package/lib/runtime/index.d.ts.map +1 -1
  55. package/lib/runtime/index.js +1 -0
  56. package/lib/runtime/index.js.map +1 -1
  57. package/lib/schemas/index.d.ts +14116 -3955
  58. package/lib/schemas/index.d.ts.map +1 -1
  59. package/lib/schemas/index.js +76 -4
  60. package/lib/schemas/index.js.map +1 -1
  61. package/package.json +1 -1
@@ -0,0 +1,926 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeclarativePublicationResultSchema = exports.DeclarativePublicationItemResultSchema = exports.DeclarativePreviewResultSchema = exports.DeclarativeValidationResultSchema = exports.DeclarativeDraftResultSchema = exports.DeclarativeAuthoringHistorySchema = exports.DeclarativeAuthoringHistoryEntrySchema = exports.DeclarativeAuthoringResourceSummarySchema = exports.DeclarativeDocumentSummarySchema = exports.DeclarativeEnvironmentChoiceSchema = exports.DeclarativePreparedReleaseTargetSchema = exports.DeclarativeRetireIntentSchema = exports.DeclarativeSaveDraftIntentSchema = exports.DeclarativeDocumentSchema = exports.DeclarativeCreateIntentSchema = exports.DeclarativeWorkbenchTargetChoiceSchema = exports.DeclarativeBindingAuthoringChoiceSchema = exports.DeclarativeProductResourceChoiceSchema = exports.DeclarativeRouteSpaceChoiceSchema = exports.DeclarativeCreateTemplateChoiceSchema = exports.ProductDeclarativeAuthoringCatalogSchema = exports.DeclarativeDefaultPolicyRegistrationSchema = exports.DeclarativeProductResourceRegistrationSchema = exports.DeclarativeEnvironmentResourceDocumentSchema = exports.DeclarativeLayoutPolicyResourceDocumentSchema = exports.DeclarativeShellResourceDocumentSchema = exports.DeclarativeRouteSpaceRegistrationSchema = exports.DeclarativeCreateTemplateRegistrationSchema = exports.DeclarativeCapabilityAuthoringChoiceSchema = exports.DeclarativeCapabilityAuthoringRegistrationSchema = exports.DeclarativeCapabilitySchemaDocumentSchema = exports.DeclarativeAuthoringChoiceSchema = exports.DeclarativePublicationPlanIntentSchema = exports.DeclarativeBatchOperationIntentSchema = exports.DeclarativeCommandIntentSchema = exports.DeclarativeReleaseTargetIntentSchema = exports.DeclarativeAudienceSimulationSchema = exports.DeclarativeRuntimeNavigationActionExecuteResultSchema = exports.DeclarativeRuntimeNavigationActionExecuteIntentSchema = exports.DeclarativeRuntimeActionExecuteResultSchema = exports.DeclarativeRuntimeActionExecuteIntentSchema = exports.DeclarativeRuntimeBindingQueryResultSchema = exports.DeclarativeRuntimeBindingQueryIntentSchema = exports.DeclarativeErrorEnvelopeSchema = exports.DeclarativeSuccessEnvelopeSchema = exports.declarativeControlRoutes = exports.DeclarativeAuthoringActionSchema = exports.DeclarativeResourceKindSchema = exports.DECLARATIVE_CONTROL_CONTROLLER_PATH = exports.DECLARATIVE_CONTROL_API_PREFIX = void 0;
4
+ exports.DeclarativeRouteClaimIntentSchema = exports.DeclarativeRuntimeResolveQuerySchema = exports.DeclarativeNavigationImportResultSchema = exports.DeclarativeNavigationImportIntentSchema = exports.DeclarativeWorkbenchRuntimeBootstrapSchema = exports.DeclarativeLegacyWorkbenchSummarySchema = exports.DeclarativeWorkbenchSummarySchema = exports.DeclarativeNavigationRuntimeBootstrapSchema = exports.DeclarativeRuntimeResolvedSchema = exports.DeclarativeAuthoringBootstrapSchema = exports.DeclarativeNavigationPlacementSchema = exports.DeclarativeNavigationSeedMigrationResultSchema = exports.DeclarativeNavigationSeedMigrationIntentSchema = exports.DeclarativeAuthoringCommandResultSchema = exports.DeclarativeRetireResultSchema = void 0;
5
+ const zod_1 = require("zod");
6
+ const declarative_control_1 = require("./declarative-control");
7
+ const common_1 = require("./common");
8
+ exports.DECLARATIVE_CONTROL_API_PREFIX = '/api/declarative-control';
9
+ exports.DECLARATIVE_CONTROL_CONTROLLER_PATH = '/declarative-control';
10
+ exports.DeclarativeResourceKindSchema = zod_1.z.enum(['page', 'navigation', 'workbench']);
11
+ exports.DeclarativeAuthoringActionSchema = zod_1.z.enum(['validate', 'preview', 'publish', 'rollback']);
12
+ const encodePath = (value) => encodeURIComponent(value);
13
+ exports.declarativeControlRoutes = {
14
+ resources: (kind) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}`,
15
+ authoringCreate: (kind) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind}`,
16
+ draft: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/draft`,
17
+ revisions: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/revisions`,
18
+ authoringHistory: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind}/${encodePath(resourceId)}/history`,
19
+ releaseRevisions: (kind, resourceId, releaseSlotId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/releases/${encodePath(releaseSlotId)}/revisions`,
20
+ validate: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/validate`,
21
+ preview: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/preview`,
22
+ publish: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/publish`,
23
+ rollback: (kind, resourceId, releaseSlotId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/releases/${encodePath(releaseSlotId)}/rollback`,
24
+ references: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/references`,
25
+ retire: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/retire`,
26
+ slotAuthority: (kind, slotId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/slot-authorities/${kind}/${encodePath(slotId)}`,
27
+ authoringBootstrap: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/bootstrap`,
28
+ authoringPrepare: (kind, resourceId, action) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind}/${encodePath(resourceId)}/${action}`,
29
+ navigationPlacements: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/navigation/placements`,
30
+ navigationImport: (placement) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/navigation/placements/${encodePath(placement)}/import`,
31
+ navigationSeedMigration: (placement) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/navigation/placements/${encodePath(placement)}/seed-migration`,
32
+ publicationPlan: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/publication-plans`,
33
+ runtimeResolve: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/resolve`,
34
+ runtimeNavigationBootstrap: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/navigations/bootstrap`,
35
+ runtimeWorkbenchBootstrap: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/workbenches/bootstrap`,
36
+ runtimePage: (releaseSlotId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/pages/${encodePath(releaseSlotId)}`,
37
+ runtimeNavigation: (releaseSlotId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/navigations/${encodePath(releaseSlotId)}`,
38
+ runtimeWorkbench: (releaseSlotId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/workbenches/${encodePath(releaseSlotId)}`,
39
+ runtimePreview: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/previews`,
40
+ runtimeBindingQuery: (releaseSlotId, bindingId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/pages/${encodePath(releaseSlotId)}/bindings/${encodePath(bindingId)}/query`,
41
+ runtimeActionExecute: (releaseSlotId, actionBindingId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/pages/${encodePath(releaseSlotId)}/actions/${encodePath(actionBindingId)}/execute`,
42
+ runtimeNavigationActionExecute: (releaseSlotId, nodeId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/navigations/${encodePath(releaseSlotId)}/actions/${encodePath(nodeId)}/execute`,
43
+ };
44
+ const DeclarativeSuccessEnvelopeSchema = (data) => zod_1.z.object({ code: zod_1.z.number().int(), message: zod_1.z.string(), data }).passthrough();
45
+ exports.DeclarativeSuccessEnvelopeSchema = DeclarativeSuccessEnvelopeSchema;
46
+ exports.DeclarativeErrorEnvelopeSchema = zod_1.z
47
+ .object({
48
+ code: zod_1.z.string().trim().min(1),
49
+ message: zod_1.z.string().trim().min(1),
50
+ requestId: zod_1.z.string().trim().min(1).optional(),
51
+ details: zod_1.z.unknown().optional(),
52
+ diagnostics: zod_1.z.array(zod_1.z.unknown()).optional(),
53
+ })
54
+ .passthrough();
55
+ const DeclarativeRuntimePageTargetSchema = zod_1.z
56
+ .object({
57
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
58
+ pageRevisionRef: declarative_control_1.RevisionRefSchema,
59
+ })
60
+ .strict()
61
+ .superRefine((value, context) => {
62
+ if (value.activeReleaseRevisionRef.kind !== 'page-release') {
63
+ context.addIssue({ code: 'custom', path: ['activeReleaseRevisionRef', 'kind'], message: 'Runtime requests require an exact page-release revision.' });
64
+ }
65
+ if (value.pageRevisionRef.kind !== 'page') {
66
+ context.addIssue({ code: 'custom', path: ['pageRevisionRef', 'kind'], message: 'Runtime requests require an exact page revision.' });
67
+ }
68
+ });
69
+ exports.DeclarativeRuntimeBindingQueryIntentSchema = DeclarativeRuntimePageTargetSchema.safeExtend({
70
+ parameters: common_1.JsonObjectSchema.default({}),
71
+ pageSize: zod_1.z.number().int().min(1).max(200).default(60),
72
+ cursor: zod_1.z.string().trim().min(1).max(8192).optional(),
73
+ }).strict();
74
+ exports.DeclarativeRuntimeBindingQueryResultSchema = zod_1.z
75
+ .object({
76
+ bindingId: common_1.ContractIdentifierSchema,
77
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
78
+ pageRevisionRef: declarative_control_1.RevisionRefSchema,
79
+ renderModelSchemaRevisionRef: declarative_control_1.RevisionRefSchema,
80
+ model: common_1.JsonObjectSchema,
81
+ pageInfo: zod_1.z
82
+ .object({
83
+ pageSize: zod_1.z.number().int().positive(),
84
+ returned: zod_1.z.number().int().nonnegative(),
85
+ hasMore: zod_1.z.boolean(),
86
+ nextCursor: zod_1.z.string().trim().min(1).optional(),
87
+ total: zod_1.z.number().int().nonnegative().optional(),
88
+ })
89
+ .strict()
90
+ .optional(),
91
+ sourceRevisionRefs: zod_1.z.array(declarative_control_1.RevisionRefSchema),
92
+ contentHash: common_1.Sha256Schema,
93
+ })
94
+ .strict();
95
+ exports.DeclarativeRuntimeActionExecuteIntentSchema = DeclarativeRuntimePageTargetSchema.safeExtend({
96
+ intent: common_1.JsonObjectSchema,
97
+ idempotencyKey: zod_1.z.string().trim().min(1).max(256),
98
+ }).strict();
99
+ exports.DeclarativeRuntimeActionExecuteResultSchema = zod_1.z
100
+ .object({
101
+ actionBindingId: common_1.ContractIdentifierSchema,
102
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
103
+ pageRevisionRef: declarative_control_1.RevisionRefSchema,
104
+ commandRevisionRef: declarative_control_1.RevisionRefSchema,
105
+ resultSchemaRevisionRef: declarative_control_1.RevisionRefSchema,
106
+ result: common_1.JsonObjectSchema,
107
+ idempotentReplay: zod_1.z.boolean(),
108
+ lineageRef: declarative_control_1.StableRefSchema,
109
+ refreshBindingIds: zod_1.z.array(common_1.ContractIdentifierSchema),
110
+ navigationTargetRef: declarative_control_1.StableRefSchema.optional(),
111
+ contentHash: common_1.Sha256Schema,
112
+ })
113
+ .strict();
114
+ const DeclarativeRuntimeNavigationTargetSchema = zod_1.z
115
+ .object({
116
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
117
+ navigationRevisionRef: declarative_control_1.RevisionRefSchema,
118
+ })
119
+ .strict()
120
+ .superRefine((value, context) => {
121
+ if (value.activeReleaseRevisionRef.kind !== 'navigation-release') {
122
+ context.addIssue({ code: 'custom', path: ['activeReleaseRevisionRef', 'kind'], message: 'Navigation Action requests require an exact navigation-release revision.' });
123
+ }
124
+ if (value.navigationRevisionRef.kind !== 'navigation') {
125
+ context.addIssue({ code: 'custom', path: ['navigationRevisionRef', 'kind'], message: 'Navigation Action requests require an exact navigation revision.' });
126
+ }
127
+ });
128
+ exports.DeclarativeRuntimeNavigationActionExecuteIntentSchema = DeclarativeRuntimeNavigationTargetSchema.safeExtend({
129
+ intent: common_1.JsonObjectSchema.default({}),
130
+ idempotencyKey: zod_1.z.string().trim().min(1).max(256),
131
+ }).strict();
132
+ exports.DeclarativeRuntimeNavigationActionExecuteResultSchema = zod_1.z
133
+ .object({
134
+ nodeId: common_1.ContractIdentifierSchema,
135
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
136
+ navigationRevisionRef: declarative_control_1.RevisionRefSchema,
137
+ commandRevisionRef: declarative_control_1.RevisionRefSchema,
138
+ resultSchemaRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
139
+ result: common_1.JsonObjectSchema,
140
+ idempotentReplay: zod_1.z.boolean(),
141
+ lineageRef: declarative_control_1.StableRefSchema,
142
+ navigationTargetRef: declarative_control_1.StableRefSchema.optional(),
143
+ contentHash: common_1.Sha256Schema,
144
+ })
145
+ .strict();
146
+ exports.DeclarativeAudienceSimulationSchema = zod_1.z
147
+ .object({
148
+ groupRefs: zod_1.z
149
+ .array(declarative_control_1.StableRefSchema)
150
+ .max(128)
151
+ .default([])
152
+ .superRefine((references, context) => {
153
+ references.forEach((reference, index) => {
154
+ if (reference.kind !== 'group')
155
+ context.addIssue({ code: 'custom', path: [index, 'kind'], message: 'Audience simulation only accepts stable Group refs.' });
156
+ });
157
+ }),
158
+ permissions: zod_1.z.array(common_1.ContractIdentifierSchema).max(512).default([]),
159
+ })
160
+ .strict();
161
+ exports.DeclarativeReleaseTargetIntentSchema = zod_1.z
162
+ .object({
163
+ environmentRef: declarative_control_1.StableRefSchema,
164
+ environmentRevisionRef: declarative_control_1.RevisionRefSchema,
165
+ surface: declarative_control_1.ProductSurfaceSchema,
166
+ routeClaimIndex: zod_1.z.number().int().nonnegative().optional(),
167
+ placement: common_1.ContractIdentifierSchema.optional(),
168
+ order: zod_1.z.number().int().optional(),
169
+ isDefaultCandidate: zod_1.z.boolean().optional(),
170
+ })
171
+ .strict()
172
+ .superRefine((value, context) => {
173
+ if (value.environmentRef.kind !== 'environment' || value.environmentRevisionRef.kind !== 'environment') {
174
+ context.addIssue({ code: 'custom', path: ['environmentRevisionRef', 'kind'], message: 'Release targets require an exact environment registration.' });
175
+ }
176
+ if (value.environmentRef.id !== value.environmentRevisionRef.id || value.environmentRef.ownerRepo !== value.environmentRevisionRef.ownerRepo) {
177
+ context.addIssue({ code: 'custom', path: ['environmentRevisionRef'], message: 'The exact environment revision must identify the selected environment.' });
178
+ }
179
+ });
180
+ exports.DeclarativeCommandIntentSchema = zod_1.z
181
+ .object({
182
+ idempotencyKey: zod_1.z.string().trim().min(1).max(256),
183
+ definitionVersion: zod_1.z.number().int().positive(),
184
+ releaseSlotId: common_1.ContractIdentifierSchema.optional(),
185
+ releaseExpectedVersion: zod_1.z.number().int().nonnegative(),
186
+ publicationExpectedGeneration: zod_1.z.number().int().nonnegative().default(0),
187
+ target: exports.DeclarativeReleaseTargetIntentSchema,
188
+ targetReleaseVersion: zod_1.z.number().int().positive().optional(),
189
+ ttlSeconds: zod_1.z.number().int().min(30).max(600).optional(),
190
+ audienceSimulation: exports.DeclarativeAudienceSimulationSchema.optional(),
191
+ reason: zod_1.z.string().trim().min(1).max(4096).optional(),
192
+ })
193
+ .strict();
194
+ exports.DeclarativeBatchOperationIntentSchema = zod_1.z
195
+ .object({
196
+ resourceKind: exports.DeclarativeResourceKindSchema,
197
+ resourceId: common_1.ContractIdentifierSchema,
198
+ intent: exports.DeclarativeCommandIntentSchema,
199
+ })
200
+ .strict();
201
+ exports.DeclarativePublicationPlanIntentSchema = zod_1.z
202
+ .object({
203
+ idempotencyKey: zod_1.z.string().trim().min(1).max(256),
204
+ expectedGeneration: zod_1.z.number().int().nonnegative(),
205
+ operations: zod_1.z.array(exports.DeclarativeBatchOperationIntentSchema).min(1).max(128),
206
+ })
207
+ .strict();
208
+ exports.DeclarativeAuthoringChoiceSchema = zod_1.z
209
+ .object({
210
+ stableRef: declarative_control_1.StableRefSchema,
211
+ revisionRef: declarative_control_1.RevisionRefSchema.optional(),
212
+ label: declarative_control_1.I18nTextSchema,
213
+ accessPolicy: declarative_control_1.AccessPolicySchema.optional(),
214
+ surface: declarative_control_1.ProductSurfaceSchema.optional(),
215
+ status: zod_1.z.enum(['active', 'deprecated', 'retired', 'unavailable']),
216
+ metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).default({}),
217
+ })
218
+ .strict();
219
+ const DeclarativeCapabilityPortSchema = zod_1.z
220
+ .object({
221
+ name: common_1.ContractIdentifierSchema,
222
+ schemaRevisionRef: declarative_control_1.RevisionRefSchema,
223
+ required: zod_1.z.boolean(),
224
+ multiple: zod_1.z.boolean(),
225
+ })
226
+ .strict();
227
+ exports.DeclarativeCapabilitySchemaDocumentSchema = zod_1.z
228
+ .object({
229
+ schemaRevisionRef: declarative_control_1.RevisionRefSchema,
230
+ document: common_1.JsonObjectSchema,
231
+ })
232
+ .strict()
233
+ .superRefine((value, context) => {
234
+ if (value.schemaRevisionRef.kind !== 'schema') {
235
+ context.addIssue({ code: 'custom', path: ['schemaRevisionRef', 'kind'], message: 'Capability schema documents must use schema RevisionRefs.' });
236
+ }
237
+ });
238
+ exports.DeclarativeCapabilityAuthoringRegistrationSchema = zod_1.z
239
+ .object({
240
+ registrationRevisionRef: declarative_control_1.RevisionRefSchema,
241
+ capabilityRevisionRef: declarative_control_1.RevisionRefSchema,
242
+ providerRevisionRef: declarative_control_1.RevisionRefSchema,
243
+ propertySchemaRevisionRef: declarative_control_1.RevisionRefSchema,
244
+ uiSchemaRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
245
+ editorEligible: zod_1.z.boolean(),
246
+ category: common_1.ContractIdentifierSchema,
247
+ label: declarative_control_1.I18nTextSchema,
248
+ description: declarative_control_1.I18nTextSchema,
249
+ supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
250
+ allowedSlots: zod_1.z.array(common_1.ContractIdentifierSchema),
251
+ allowedParentCapabilityRefs: zod_1.z.array(declarative_control_1.StableRefSchema),
252
+ allowedChildCapabilityRefs: zod_1.z.array(declarative_control_1.StableRefSchema),
253
+ inputPorts: zod_1.z.array(DeclarativeCapabilityPortSchema),
254
+ outputPorts: zod_1.z.array(DeclarativeCapabilityPortSchema),
255
+ allowedSideEffects: zod_1.z.array(zod_1.z.enum(['network', 'storage', 'navigation', 'worker', 'websocket'])),
256
+ ontologyRequirements: zod_1.z.array(zod_1.z.object({ inputPort: common_1.ContractIdentifierSchema, renderModelSchemaRevisionRef: declarative_control_1.RevisionRefSchema, modes: zod_1.z.array(zod_1.z.enum(['view', 'filter'])).min(1), requiredPermissionCodes: zod_1.z.array(common_1.ContractIdentifierSchema) }).strict()),
257
+ actionRequirements: zod_1.z.array(zod_1.z.object({ outputPort: common_1.ContractIdentifierSchema, allowedCommandKinds: zod_1.z.array(common_1.ContractIdentifierSchema), requiredPermissionCodes: zod_1.z.array(common_1.ContractIdentifierSchema) }).strict()),
258
+ propertyFields: zod_1.z.array(zod_1.z.object({ path: zod_1.z.string().trim().min(1), label: declarative_control_1.I18nTextSchema, control: common_1.ContractIdentifierSchema, required: zod_1.z.boolean(), advanced: zod_1.z.boolean() }).strict()),
259
+ schemaDocuments: zod_1.z.array(exports.DeclarativeCapabilitySchemaDocumentSchema).min(1),
260
+ sourceContentHash: common_1.Sha256Schema,
261
+ })
262
+ .strict()
263
+ .superRefine((value, context) => {
264
+ const documents = new Map();
265
+ value.schemaDocuments.forEach((entry, index) => {
266
+ const key = `${entry.schemaRevisionRef.ownerRepo}:${entry.schemaRevisionRef.id}@${entry.schemaRevisionRef.revision}:${entry.schemaRevisionRef.contentHash}`;
267
+ if (documents.has(key)) {
268
+ context.addIssue({ code: 'custom', path: ['schemaDocuments', index], message: 'Capability schema documents must be unique by exact RevisionRef.' });
269
+ }
270
+ documents.set(key, index);
271
+ });
272
+ const required = [
273
+ value.propertySchemaRevisionRef,
274
+ ...(value.uiSchemaRevisionRef ? [value.uiSchemaRevisionRef] : []),
275
+ ...value.inputPorts.map((port) => port.schemaRevisionRef),
276
+ ...value.outputPorts.map((port) => port.schemaRevisionRef),
277
+ ...value.ontologyRequirements.map((requirement) => requirement.renderModelSchemaRevisionRef),
278
+ ];
279
+ required.forEach((reference) => {
280
+ const key = `${reference.ownerRepo}:${reference.id}@${reference.revision}:${reference.contentHash}`;
281
+ if (!documents.has(key)) {
282
+ context.addIssue({ code: 'custom', path: ['schemaDocuments'], message: `Missing exact schema document for ${reference.id}.` });
283
+ }
284
+ });
285
+ });
286
+ exports.DeclarativeCapabilityAuthoringChoiceSchema = exports.DeclarativeAuthoringChoiceSchema.extend({
287
+ registration: exports.DeclarativeCapabilityAuthoringRegistrationSchema,
288
+ }).strict();
289
+ exports.DeclarativeCreateTemplateRegistrationSchema = zod_1.z
290
+ .object({
291
+ templateRevisionRef: declarative_control_1.RevisionRefSchema,
292
+ resourceKind: exports.DeclarativeResourceKindSchema,
293
+ label: declarative_control_1.I18nTextSchema,
294
+ description: declarative_control_1.I18nTextSchema,
295
+ supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
296
+ document: zod_1.z.union([declarative_control_1.PageSchema, declarative_control_1.NavigationSchema, declarative_control_1.WorkbenchSchema]),
297
+ sourceContentHash: common_1.Sha256Schema,
298
+ })
299
+ .strict()
300
+ .superRefine((value, context) => {
301
+ const expected = value.document.contract === 'Page' ? 'page' : value.document.contract === 'Navigation' ? 'navigation' : 'workbench';
302
+ if (value.resourceKind !== expected)
303
+ context.addIssue({ code: 'custom', path: ['resourceKind'], message: 'Create template kind must match its document contract.' });
304
+ if (value.templateRevisionRef.kind !== 'declarative-create-template')
305
+ context.addIssue({ code: 'custom', path: ['templateRevisionRef', 'kind'], message: 'Create templates require declarative-create-template RevisionRefs.' });
306
+ });
307
+ exports.DeclarativeRouteSpaceRegistrationSchema = zod_1.z
308
+ .object({
309
+ routeSpaceRevisionRef: declarative_control_1.RevisionRefSchema,
310
+ routeSpace: declarative_control_1.RouteSpaceSchema,
311
+ sourceContentHash: common_1.Sha256Schema,
312
+ })
313
+ .strict()
314
+ .superRefine((value, context) => {
315
+ if (value.routeSpaceRevisionRef.kind !== 'route-space') {
316
+ context.addIssue({ code: 'custom', path: ['routeSpaceRevisionRef', 'kind'], message: 'Route-space registrations require route-space RevisionRefs.' });
317
+ }
318
+ if (value.routeSpaceRevisionRef.id !== value.routeSpace.routeSpaceId) {
319
+ context.addIssue({ code: 'custom', path: ['routeSpaceRevisionRef', 'id'], message: 'Route-space registration identity must match its document.' });
320
+ }
321
+ });
322
+ exports.DeclarativeShellResourceDocumentSchema = zod_1.z
323
+ .object({
324
+ contract: zod_1.z.literal('DeclarativeShell'),
325
+ schemaVersion: zod_1.z.literal(1),
326
+ hostCapabilityRevisionRef: declarative_control_1.RevisionRefSchema,
327
+ hostProviderRevisionRef: declarative_control_1.RevisionRefSchema,
328
+ allowedSlots: zod_1.z.array(common_1.ContractIdentifierSchema).min(1),
329
+ tokenRevisionRefs: zod_1.z.array(declarative_control_1.RevisionRefSchema).min(1),
330
+ })
331
+ .strict()
332
+ .superRefine((value, context) => {
333
+ if (value.hostCapabilityRevisionRef.kind !== 'capability')
334
+ context.addIssue({ code: 'custom', path: ['hostCapabilityRevisionRef', 'kind'], message: 'Shell host capability must reference a capability.' });
335
+ if (value.hostProviderRevisionRef.kind !== 'view-provider')
336
+ context.addIssue({ code: 'custom', path: ['hostProviderRevisionRef', 'kind'], message: 'Shell host provider must reference a view-provider.' });
337
+ value.tokenRevisionRefs.forEach((reference, index) => {
338
+ if (reference.kind !== 'design-token')
339
+ context.addIssue({ code: 'custom', path: ['tokenRevisionRefs', index, 'kind'], message: 'Shell tokens must use design-token RevisionRefs.' });
340
+ });
341
+ });
342
+ exports.DeclarativeLayoutPolicyResourceDocumentSchema = zod_1.z
343
+ .object({
344
+ contract: zod_1.z.literal('DeclarativeLayoutPolicy'),
345
+ schemaVersion: zod_1.z.literal(1),
346
+ allowedModes: zod_1.z.array(zod_1.z.enum(['single', 'tabs', 'columns', 'grid', 'sidebar'])).min(1),
347
+ propertySchemaRevisionRef: declarative_control_1.RevisionRefSchema,
348
+ })
349
+ .strict()
350
+ .superRefine((value, context) => {
351
+ if (value.propertySchemaRevisionRef.kind !== 'schema')
352
+ context.addIssue({ code: 'custom', path: ['propertySchemaRevisionRef', 'kind'], message: 'Layout policy properties must reference a schema.' });
353
+ });
354
+ exports.DeclarativeEnvironmentResourceDocumentSchema = zod_1.z
355
+ .object({
356
+ contract: zod_1.z.literal('DeclarativeEnvironment'),
357
+ schemaVersion: zod_1.z.literal(1),
358
+ environmentId: common_1.ContractIdentifierSchema,
359
+ label: declarative_control_1.I18nTextSchema,
360
+ active: zod_1.z.boolean(),
361
+ })
362
+ .strict();
363
+ exports.DeclarativeProductResourceRegistrationSchema = zod_1.z
364
+ .object({
365
+ resourceRevisionRef: declarative_control_1.RevisionRefSchema,
366
+ resourceKind: zod_1.z.enum(['shell', 'layout-policy', 'performance-budget', 'observation-policy', 'design-token', 'access-policy', 'environment']),
367
+ supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
368
+ accessPolicy: declarative_control_1.AccessPolicySchema.optional(),
369
+ schemaRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
370
+ document: common_1.JsonObjectSchema,
371
+ sourceContentHash: common_1.Sha256Schema,
372
+ })
373
+ .strict()
374
+ .superRefine((value, context) => {
375
+ if (value.resourceRevisionRef.kind !== value.resourceKind) {
376
+ context.addIssue({ code: 'custom', path: ['resourceRevisionRef', 'kind'], message: 'Product resource kind must match its RevisionRef.' });
377
+ }
378
+ if (value.resourceKind === 'shell') {
379
+ const parsed = exports.DeclarativeShellResourceDocumentSchema.safeParse(value.document);
380
+ if (!parsed.success)
381
+ context.addIssue({ code: 'custom', path: ['document'], message: `Invalid shell declaration: ${parsed.error.message}` });
382
+ }
383
+ if (value.resourceKind === 'layout-policy') {
384
+ const parsed = exports.DeclarativeLayoutPolicyResourceDocumentSchema.safeParse(value.document);
385
+ if (!parsed.success)
386
+ context.addIssue({ code: 'custom', path: ['document'], message: `Invalid layout-policy declaration: ${parsed.error.message}` });
387
+ }
388
+ if (value.resourceKind === 'environment') {
389
+ const parsed = exports.DeclarativeEnvironmentResourceDocumentSchema.safeParse(value.document);
390
+ if (!parsed.success)
391
+ context.addIssue({ code: 'custom', path: ['document'], message: `Invalid environment declaration: ${parsed.error.message}` });
392
+ if (parsed.success && parsed.data.environmentId !== value.resourceRevisionRef.id) {
393
+ context.addIssue({ code: 'custom', path: ['document', 'environmentId'], message: 'Environment registration identity must match its document.' });
394
+ }
395
+ }
396
+ });
397
+ exports.DeclarativeDefaultPolicyRegistrationSchema = zod_1.z
398
+ .object({
399
+ role: zod_1.z.enum(['management', 'access', 'layout', 'performance', 'observability', 'tokens', 'environment']),
400
+ resourceRevisionRef: declarative_control_1.RevisionRefSchema,
401
+ supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
402
+ })
403
+ .strict();
404
+ /** Release-owned product authoring inputs. Instances and releases remain Ontology records. */
405
+ exports.ProductDeclarativeAuthoringCatalogSchema = zod_1.z
406
+ .object({
407
+ contract: zod_1.z.literal('ProductDeclarativeAuthoringCatalog'),
408
+ schemaVersion: zod_1.z.literal(1),
409
+ applicationId: common_1.ContractIdentifierSchema,
410
+ createTemplates: zod_1.z.array(exports.DeclarativeCreateTemplateRegistrationSchema),
411
+ routeSpaces: zod_1.z.array(exports.DeclarativeRouteSpaceRegistrationSchema),
412
+ resourceRegistrations: zod_1.z.array(exports.DeclarativeProductResourceRegistrationSchema),
413
+ defaultPolicies: zod_1.z.array(exports.DeclarativeDefaultPolicyRegistrationSchema),
414
+ })
415
+ .strict()
416
+ .superRefine((value, context) => {
417
+ const duplicates = (items) => items.find((item, index) => items.indexOf(item) !== index);
418
+ const duplicateTemplate = duplicates(value.createTemplates.map((item) => `${item.templateRevisionRef.id}@${item.templateRevisionRef.revision}`));
419
+ if (duplicateTemplate)
420
+ context.addIssue({ code: 'custom', path: ['createTemplates'], message: `Duplicate create template ${duplicateTemplate}.` });
421
+ const duplicateRouteSpace = duplicates(value.routeSpaces.map((item) => `${item.routeSpaceRevisionRef.id}@${item.routeSpaceRevisionRef.revision}`));
422
+ if (duplicateRouteSpace)
423
+ context.addIssue({ code: 'custom', path: ['routeSpaces'], message: `Duplicate route space ${duplicateRouteSpace}.` });
424
+ const duplicateResource = duplicates(value.resourceRegistrations.map((item) => `${item.resourceRevisionRef.kind}:${item.resourceRevisionRef.id}@${item.resourceRevisionRef.revision}`));
425
+ if (duplicateResource)
426
+ context.addIssue({ code: 'custom', path: ['resourceRegistrations'], message: `Duplicate product resource ${duplicateResource}.` });
427
+ value.defaultPolicies.forEach((selection, index) => {
428
+ const expectedKind = { management: 'access-policy', access: 'access-policy', layout: 'layout-policy', performance: 'performance-budget', observability: 'observation-policy', tokens: 'design-token', environment: 'environment' }[selection.role];
429
+ if (selection.resourceRevisionRef.kind !== expectedKind) {
430
+ context.addIssue({ code: 'custom', path: ['defaultPolicies', index, 'resourceRevisionRef', 'kind'], message: `Default ${selection.role} selection must reference ${expectedKind}.` });
431
+ }
432
+ if (!value.resourceRegistrations.some((registration) => registration.resourceRevisionRef.kind === selection.resourceRevisionRef.kind && registration.resourceRevisionRef.id === selection.resourceRevisionRef.id && registration.resourceRevisionRef.revision === selection.resourceRevisionRef.revision && registration.resourceRevisionRef.contentHash === selection.resourceRevisionRef.contentHash)) {
433
+ context.addIssue({ code: 'custom', path: ['defaultPolicies', index, 'resourceRevisionRef'], message: 'Default policy must select an exact registered product resource.' });
434
+ }
435
+ });
436
+ });
437
+ exports.DeclarativeCreateTemplateChoiceSchema = exports.DeclarativeAuthoringChoiceSchema.extend({
438
+ template: exports.DeclarativeCreateTemplateRegistrationSchema,
439
+ }).strict();
440
+ exports.DeclarativeRouteSpaceChoiceSchema = exports.DeclarativeAuthoringChoiceSchema.extend({
441
+ registration: exports.DeclarativeRouteSpaceRegistrationSchema,
442
+ }).strict();
443
+ exports.DeclarativeProductResourceChoiceSchema = exports.DeclarativeAuthoringChoiceSchema.extend({
444
+ registration: exports.DeclarativeProductResourceRegistrationSchema,
445
+ }).strict();
446
+ exports.DeclarativeBindingAuthoringChoiceSchema = exports.DeclarativeAuthoringChoiceSchema.extend({
447
+ bindingTemplate: zod_1.z
448
+ .object({
449
+ kind: zod_1.z.enum(['ontology', 'view', 'action']),
450
+ requiredRevisionRefs: zod_1.z.array(declarative_control_1.RevisionRefSchema),
451
+ requiredPermissionCodes: zod_1.z.array(common_1.ContractIdentifierSchema),
452
+ inputTemplate: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
453
+ })
454
+ .strict(),
455
+ accessDiagnostics: zod_1.z
456
+ .object({ allowed: zod_1.z.boolean(), missingPermissionCodes: zod_1.z.array(common_1.ContractIdentifierSchema), issueCodes: zod_1.z.array(common_1.ContractIdentifierSchema) })
457
+ .strict(),
458
+ }).strict();
459
+ exports.DeclarativeWorkbenchTargetChoiceSchema = zod_1.z
460
+ .object({
461
+ stableTargetRef: declarative_control_1.StableRefSchema,
462
+ targetRevisionRef: declarative_control_1.RevisionRefSchema,
463
+ providerRevisionRef: declarative_control_1.RevisionRefSchema,
464
+ inputSchemaRevisionRef: declarative_control_1.RevisionRefSchema,
465
+ kind: zod_1.z.enum(['built-in-application', 'workflow-form', 'workflow', 'agent', 'design', 'capability']),
466
+ name: declarative_control_1.I18nTextSchema,
467
+ targetAccessPolicy: declarative_control_1.AccessPolicySchema,
468
+ supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
469
+ status: zod_1.z.enum(['active', 'deprecated', 'retired', 'unavailable']),
470
+ provenanceContentHash: common_1.Sha256Schema,
471
+ })
472
+ .strict()
473
+ .superRefine((value, context) => {
474
+ if (value.targetRevisionRef.id !== value.stableTargetRef.id || value.targetRevisionRef.kind !== value.stableTargetRef.kind) {
475
+ context.addIssue({ code: 'custom', path: ['targetRevisionRef'], message: 'Workbench target identity and exact revision must match.' });
476
+ }
477
+ if (value.providerRevisionRef.kind !== 'view-provider') {
478
+ context.addIssue({ code: 'custom', path: ['providerRevisionRef', 'kind'], message: 'Workbench targets require an exact view-provider revision.' });
479
+ }
480
+ if (value.inputSchemaRevisionRef.kind !== 'schema') {
481
+ context.addIssue({ code: 'custom', path: ['inputSchemaRevisionRef', 'kind'], message: 'Workbench targets require an exact input schema revision.' });
482
+ }
483
+ });
484
+ exports.DeclarativeCreateIntentSchema = zod_1.z
485
+ .object({
486
+ resourceId: common_1.ContractIdentifierSchema,
487
+ templateRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
488
+ sourceRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
489
+ identity: zod_1.z.object({ name: declarative_control_1.I18nTextSchema, description: declarative_control_1.I18nTextSchema.optional(), tags: zod_1.z.array(common_1.ContractIdentifierSchema).default([]) }).strict(),
490
+ surface: declarative_control_1.ProductSurfaceSchema,
491
+ pathTemplate: zod_1.z.string().trim().min(1).optional(),
492
+ placement: common_1.ContractIdentifierSchema.optional(),
493
+ idempotencyKey: zod_1.z.string().trim().min(1).max(256),
494
+ })
495
+ .strict()
496
+ .superRefine((value, context) => {
497
+ if (Number(Boolean(value.templateRevisionRef)) + Number(Boolean(value.sourceRevisionRef)) !== 1) {
498
+ context.addIssue({ code: 'custom', path: ['templateRevisionRef'], message: 'Create intent requires exactly one governed template or source revision.' });
499
+ }
500
+ });
501
+ exports.DeclarativeDocumentSchema = zod_1.z.union([declarative_control_1.PageSchema, declarative_control_1.NavigationSchema, declarative_control_1.WorkbenchSchema]);
502
+ exports.DeclarativeSaveDraftIntentSchema = zod_1.z
503
+ .object({
504
+ document: exports.DeclarativeDocumentSchema,
505
+ expectedVersion: zod_1.z.number().int().nonnegative(),
506
+ idempotencyKey: zod_1.z.string().trim().min(1).max(256),
507
+ })
508
+ .strict();
509
+ exports.DeclarativeRetireIntentSchema = zod_1.z
510
+ .object({
511
+ expectedVersion: zod_1.z.number().int().positive(),
512
+ idempotencyKey: zod_1.z.string().trim().min(1).max(256),
513
+ reason: zod_1.z.string().trim().min(1).max(4096),
514
+ })
515
+ .strict();
516
+ exports.DeclarativePreparedReleaseTargetSchema = zod_1.z
517
+ .object({
518
+ environmentRef: declarative_control_1.StableRefSchema,
519
+ environmentRevisionRef: declarative_control_1.RevisionRefSchema,
520
+ surface: declarative_control_1.ProductSurfaceSchema,
521
+ routeClaimIndex: zod_1.z.number().int().nonnegative().optional(),
522
+ placement: common_1.ContractIdentifierSchema.optional(),
523
+ order: zod_1.z.number().int().optional(),
524
+ isDefaultCandidate: zod_1.z.boolean().optional(),
525
+ releaseSlotId: common_1.ContractIdentifierSchema.optional(),
526
+ releaseExpectedVersion: zod_1.z.number().int().nonnegative(),
527
+ })
528
+ .strict();
529
+ exports.DeclarativeEnvironmentChoiceSchema = exports.DeclarativeAuthoringChoiceSchema.extend({
530
+ revisionRef: declarative_control_1.RevisionRefSchema,
531
+ registration: exports.DeclarativeProductResourceRegistrationSchema,
532
+ }).strict();
533
+ const DeclarativePageDocumentSummarySchema = zod_1.z
534
+ .object({
535
+ resourceKind: zod_1.z.literal('page'),
536
+ title: declarative_control_1.I18nTextSchema,
537
+ supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
538
+ routeClaims: zod_1.z.array(declarative_control_1.RouteClaimSchema).min(1),
539
+ lifecycle: zod_1.z.enum(['active', 'deprecated', 'retired']),
540
+ accessPolicy: declarative_control_1.AccessPolicySchema,
541
+ managementAccess: declarative_control_1.ManagementAccessSchema,
542
+ })
543
+ .strict();
544
+ const DeclarativeNavigationDocumentSummarySchema = zod_1.z
545
+ .object({
546
+ resourceKind: zod_1.z.literal('navigation'),
547
+ title: declarative_control_1.I18nTextSchema,
548
+ supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
549
+ placements: zod_1.z.array(common_1.ContractIdentifierSchema).min(1),
550
+ nodeCount: zod_1.z.number().int().nonnegative(),
551
+ lifecycle: zod_1.z.enum(['active', 'deprecated', 'retired']),
552
+ managementAccess: declarative_control_1.ManagementAccessSchema,
553
+ })
554
+ .strict();
555
+ const DeclarativeWorkbenchDocumentSummarySchema = zod_1.z
556
+ .object({
557
+ resourceKind: zod_1.z.literal('workbench'),
558
+ title: declarative_control_1.I18nTextSchema,
559
+ purpose: zod_1.z.enum(['instance', 'template']),
560
+ supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
561
+ routeClaims: zod_1.z.array(declarative_control_1.RouteClaimSchema).min(1),
562
+ layout: zod_1.z.object({ hostCapabilityRevisionRef: declarative_control_1.RevisionRefSchema, hostProviderRevisionRef: declarative_control_1.RevisionRefSchema, layoutPolicyRevisionRef: declarative_control_1.RevisionRefSchema }).strict(),
563
+ instanceCount: zod_1.z.number().int().nonnegative(),
564
+ lifecycle: zod_1.z.enum(['active', 'deprecated', 'retired']),
565
+ accessPolicy: declarative_control_1.AccessPolicySchema,
566
+ managementAccess: declarative_control_1.ManagementAccessSchema,
567
+ })
568
+ .strict();
569
+ exports.DeclarativeDocumentSummarySchema = zod_1.z.discriminatedUnion('resourceKind', [
570
+ DeclarativePageDocumentSummarySchema,
571
+ DeclarativeNavigationDocumentSummarySchema,
572
+ DeclarativeWorkbenchDocumentSummarySchema,
573
+ ]);
574
+ exports.DeclarativeAuthoringResourceSummarySchema = zod_1.z
575
+ .object({
576
+ resourceKind: exports.DeclarativeResourceKindSchema,
577
+ resourceId: common_1.ContractIdentifierSchema,
578
+ tenantScope: declarative_control_1.TenantScopeSchema,
579
+ documentSummary: exports.DeclarativeDocumentSummarySchema,
580
+ lifecycle: zod_1.z.enum(['active', 'deprecated', 'retired']),
581
+ draftRevisionRef: declarative_control_1.RevisionRefSchema,
582
+ activeReleaseRevisionRefs: zod_1.z.array(declarative_control_1.RevisionRefSchema),
583
+ placements: zod_1.z.array(common_1.ContractIdentifierSchema),
584
+ updatedAt: zod_1.z.string().datetime(),
585
+ actorRef: declarative_control_1.StableRefSchema,
586
+ preparedTargets: zod_1.z.array(exports.DeclarativePreparedReleaseTargetSchema),
587
+ releasePlacements: zod_1.z.array(zod_1.z.object({
588
+ releaseRevisionRef: declarative_control_1.RevisionRefSchema,
589
+ environmentRef: declarative_control_1.StableRefSchema,
590
+ surface: declarative_control_1.ProductSurfaceSchema,
591
+ routePath: zod_1.z.string().optional(),
592
+ placement: common_1.ContractIdentifierSchema.optional(),
593
+ order: zod_1.z.number().int().optional(),
594
+ isDefaultCandidate: zod_1.z.boolean().optional(),
595
+ }).strict()),
596
+ })
597
+ .strict();
598
+ exports.DeclarativeAuthoringHistoryEntrySchema = zod_1.z
599
+ .object({
600
+ revisionRef: declarative_control_1.RevisionRefSchema,
601
+ version: zod_1.z.number().int().positive(),
602
+ lifecycle: zod_1.z.enum(['active', 'deprecated', 'retired']),
603
+ name: declarative_control_1.I18nTextSchema,
604
+ actorRef: declarative_control_1.StableRefSchema,
605
+ source: zod_1.z.enum(['user', 'migration', 'rollback']),
606
+ reason: zod_1.z.string().trim().min(1).optional(),
607
+ occurredAt: zod_1.z.string().datetime(),
608
+ activeRelease: zod_1.z.boolean(),
609
+ })
610
+ .strict();
611
+ exports.DeclarativeAuthoringHistorySchema = zod_1.z
612
+ .object({ items: zod_1.z.array(exports.DeclarativeAuthoringHistoryEntrySchema), nextBeforeVersion: zod_1.z.number().int().positive().optional() })
613
+ .strict();
614
+ const DeclarativeRuntimeDiagnosticSchema = zod_1.z
615
+ .object({
616
+ code: common_1.ContractIdentifierSchema,
617
+ severity: zod_1.z.enum(['info', 'warning', 'error']),
618
+ path: zod_1.z.string().trim().min(1),
619
+ message: zod_1.z.string().trim().min(1),
620
+ })
621
+ .strict();
622
+ exports.DeclarativeDraftResultSchema = zod_1.z
623
+ .object({
624
+ action: zod_1.z.enum(['create', 'save']),
625
+ resourceKind: exports.DeclarativeResourceKindSchema,
626
+ resourceId: common_1.ContractIdentifierSchema,
627
+ document: exports.DeclarativeDocumentSchema,
628
+ revisionRef: declarative_control_1.RevisionRefSchema,
629
+ actorRef: declarative_control_1.StableRefSchema,
630
+ occurredAt: zod_1.z.string().datetime(),
631
+ provenance: zod_1.z.object({ sourceRevisionRef: declarative_control_1.RevisionRefSchema }).strict().optional(),
632
+ })
633
+ .strict();
634
+ exports.DeclarativeValidationResultSchema = zod_1.z
635
+ .object({
636
+ action: zod_1.z.literal('validate'),
637
+ valid: zod_1.z.literal(true),
638
+ releaseRevisionRef: declarative_control_1.RevisionRefSchema,
639
+ bundleContentHash: common_1.Sha256Schema,
640
+ diagnostics: zod_1.z.array(DeclarativeRuntimeDiagnosticSchema),
641
+ })
642
+ .strict();
643
+ exports.DeclarativePreviewResultSchema = zod_1.z
644
+ .object({
645
+ action: zod_1.z.literal('preview'),
646
+ token: zod_1.z.string().trim().min(1),
647
+ expiresAt: zod_1.z.string().datetime(),
648
+ revision: zod_1.z.number().int().positive(),
649
+ contentHash: common_1.Sha256Schema,
650
+ bundle: zod_1.z.union([declarative_control_1.PageRuntimeBundleSchema, declarative_control_1.NavigationRuntimeBundleSchema, declarative_control_1.WorkbenchRuntimeBundleSchema]),
651
+ etag: zod_1.z.string().trim().min(1),
652
+ sourceContentHash: common_1.Sha256Schema,
653
+ })
654
+ .strict();
655
+ exports.DeclarativePublicationItemResultSchema = zod_1.z
656
+ .object({
657
+ resourceKind: exports.DeclarativeResourceKindSchema,
658
+ resourceId: common_1.ContractIdentifierSchema,
659
+ releaseRevisionRef: declarative_control_1.RevisionRefSchema,
660
+ release: zod_1.z.union([declarative_control_1.PageReleaseSchema, declarative_control_1.NavigationReleaseSchema, declarative_control_1.WorkbenchReleaseSchema]),
661
+ bundle: zod_1.z.union([declarative_control_1.PageRuntimeBundleSchema, declarative_control_1.NavigationRuntimeBundleSchema, declarative_control_1.WorkbenchRuntimeBundleSchema]),
662
+ })
663
+ .strict();
664
+ exports.DeclarativePublicationResultSchema = zod_1.z
665
+ .object({
666
+ action: zod_1.z.enum(['publish', 'rollback', 'publication-plan']),
667
+ generation: zod_1.z.number().int().nonnegative(),
668
+ publicationPlanRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
669
+ items: zod_1.z.array(exports.DeclarativePublicationItemResultSchema).min(1),
670
+ etag: zod_1.z.string().trim().min(1),
671
+ })
672
+ .strict();
673
+ exports.DeclarativeRetireResultSchema = zod_1.z
674
+ .object({
675
+ action: zod_1.z.literal('retire'),
676
+ resourceKind: exports.DeclarativeResourceKindSchema,
677
+ resourceId: common_1.ContractIdentifierSchema,
678
+ revisionRef: declarative_control_1.RevisionRefSchema,
679
+ lifecycle: zod_1.z.literal('retired'),
680
+ actorRef: declarative_control_1.StableRefSchema,
681
+ occurredAt: zod_1.z.string().datetime(),
682
+ reason: zod_1.z.string().trim().min(1).max(4096),
683
+ })
684
+ .strict();
685
+ exports.DeclarativeAuthoringCommandResultSchema = zod_1.z.discriminatedUnion('action', [
686
+ exports.DeclarativeDraftResultSchema,
687
+ exports.DeclarativeValidationResultSchema,
688
+ exports.DeclarativePreviewResultSchema,
689
+ exports.DeclarativePublicationResultSchema,
690
+ exports.DeclarativeRetireResultSchema,
691
+ ]);
692
+ exports.DeclarativeNavigationSeedMigrationIntentSchema = zod_1.z
693
+ .object({
694
+ idempotencyKey: zod_1.z.string().trim().min(1).max(256),
695
+ })
696
+ .strict();
697
+ const DeclarativeNavigationSeedMigrationDiffSchema = zod_1.z
698
+ .object({
699
+ path: zod_1.z.string().trim().min(1),
700
+ legacyContentHash: common_1.Sha256Schema,
701
+ declarativeContentHash: common_1.Sha256Schema,
702
+ })
703
+ .strict();
704
+ exports.DeclarativeNavigationSeedMigrationResultSchema = zod_1.z
705
+ .object({
706
+ outcome: zod_1.z.enum(['already-active', 'review-required', 'published']),
707
+ placement: common_1.ContractIdentifierSchema,
708
+ legacyContentHash: common_1.Sha256Schema,
709
+ templateRevisionRef: declarative_control_1.RevisionRefSchema,
710
+ draftRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
711
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
712
+ requiresReview: zod_1.z.boolean(),
713
+ diff: zod_1.z.array(DeclarativeNavigationSeedMigrationDiffSchema),
714
+ })
715
+ .strict()
716
+ .superRefine((value, context) => {
717
+ if (value.outcome === 'review-required' && (!value.requiresReview || !value.draftRevisionRef)) {
718
+ context.addIssue({ code: 'custom', path: ['outcome'], message: 'Review-required migrations must expose their draft.' });
719
+ }
720
+ if ((value.outcome === 'already-active' || value.outcome === 'published') && !value.activeReleaseRevisionRef) {
721
+ context.addIssue({ code: 'custom', path: ['activeReleaseRevisionRef'], message: 'Active migrations require an exact release revision.' });
722
+ }
723
+ });
724
+ exports.DeclarativeNavigationPlacementSchema = zod_1.z
725
+ .object({
726
+ placement: common_1.ContractIdentifierSchema,
727
+ surface: declarative_control_1.ProductSurfaceSchema,
728
+ authority: zod_1.z.enum(['legacy', 'declarative']),
729
+ authorityRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
730
+ navigationRef: declarative_control_1.StableRefSchema.optional(),
731
+ draftRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
732
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
733
+ legacySourceRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
734
+ legacyContentHash: common_1.Sha256Schema.optional(),
735
+ legacyReadOnly: zod_1.z.boolean(),
736
+ declarativeEditorReadOnly: zod_1.z.boolean(),
737
+ })
738
+ .strict();
739
+ exports.DeclarativeAuthoringBootstrapSchema = zod_1.z
740
+ .object({
741
+ resources: zod_1.z.array(exports.DeclarativeAuthoringResourceSummarySchema),
742
+ createTemplates: zod_1.z.array(exports.DeclarativeCreateTemplateChoiceSchema),
743
+ routeSpaces: zod_1.z.array(exports.DeclarativeRouteSpaceChoiceSchema),
744
+ productResources: zod_1.z.array(exports.DeclarativeProductResourceChoiceSchema),
745
+ environmentChoices: zod_1.z.array(exports.DeclarativeEnvironmentChoiceSchema),
746
+ defaultEnvironmentRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
747
+ navigationPlacements: zod_1.z.array(exports.DeclarativeNavigationPlacementSchema),
748
+ capabilityCatalog: zod_1.z.array(exports.DeclarativeCapabilityAuthoringChoiceSchema),
749
+ ontologyChoices: zod_1.z.array(exports.DeclarativeBindingAuthoringChoiceSchema),
750
+ viewChoices: zod_1.z.array(exports.DeclarativeBindingAuthoringChoiceSchema),
751
+ actionChoices: zod_1.z.array(exports.DeclarativeBindingAuthoringChoiceSchema),
752
+ accessChoices: zod_1.z.array(exports.DeclarativeAuthoringChoiceSchema),
753
+ publishedTargets: zod_1.z.array(exports.DeclarativeAuthoringChoiceSchema),
754
+ workbenchTargets: zod_1.z.array(exports.DeclarativeWorkbenchTargetChoiceSchema),
755
+ compilerRevisionRef: declarative_control_1.RevisionRefSchema,
756
+ generation: zod_1.z.number().int().nonnegative(),
757
+ contentHash: common_1.Sha256Schema,
758
+ })
759
+ .strict();
760
+ exports.DeclarativeRuntimeResolvedSchema = zod_1.z
761
+ .object({
762
+ surface: declarative_control_1.ProductSurfaceSchema,
763
+ normalizedPath: zod_1.z.string().trim().min(1),
764
+ page: declarative_control_1.PageRuntimeBundleSchema.optional(),
765
+ workbench: declarative_control_1.WorkbenchRuntimeBundleSchema.optional(),
766
+ navigation: declarative_control_1.NavigationRuntimeBundleSchema.optional(),
767
+ releaseSlotRefs: zod_1.z.array(zod_1.z.object({ resourceKind: exports.DeclarativeResourceKindSchema, releaseSlotId: common_1.ContractIdentifierSchema }).strict()),
768
+ generation: zod_1.z.number().int().nonnegative(),
769
+ contentHash: common_1.Sha256Schema,
770
+ })
771
+ .strict()
772
+ .superRefine((value, context) => {
773
+ if (!value.page && !value.workbench)
774
+ context.addIssue({ code: 'custom', path: ['page'], message: 'A resolved runtime must contain a Page or Workbench bundle.' });
775
+ });
776
+ exports.DeclarativeNavigationRuntimeBootstrapSchema = zod_1.z
777
+ .object({
778
+ placements: zod_1.z.array(zod_1.z
779
+ .object({
780
+ placement: common_1.ContractIdentifierSchema,
781
+ surface: declarative_control_1.ProductSurfaceSchema,
782
+ authority: zod_1.z.enum(['legacy', 'declarative']),
783
+ state: zod_1.z.enum(['active', 'deactivated']),
784
+ releaseSlotId: common_1.ContractIdentifierSchema.optional(),
785
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
786
+ bundle: declarative_control_1.NavigationRuntimeBundleSchema.optional(),
787
+ })
788
+ .strict()
789
+ .superRefine((value, context) => {
790
+ if (value.authority === 'legacy') {
791
+ if (value.releaseSlotId || value.activeReleaseRevisionRef || value.bundle) {
792
+ context.addIssue({ code: 'custom', path: ['authority'], message: 'Legacy navigation placements cannot expose declarative Release or Bundle state.' });
793
+ }
794
+ if (value.state !== 'active')
795
+ context.addIssue({ code: 'custom', path: ['state'], message: 'Legacy navigation placements are active until an explicit declarative cutover.' });
796
+ return;
797
+ }
798
+ if (!value.releaseSlotId || !value.activeReleaseRevisionRef) {
799
+ context.addIssue({ code: 'custom', path: ['releaseSlotId'], message: 'Declarative navigation placements require an exact active Release reference.' });
800
+ }
801
+ if (value.state === 'active' && !value.bundle) {
802
+ context.addIssue({ code: 'custom', path: ['bundle'], message: 'An active declarative navigation placement requires its identity-filtered Runtime Bundle.' });
803
+ }
804
+ if (value.state === 'deactivated' && value.bundle) {
805
+ context.addIssue({ code: 'custom', path: ['bundle'], message: 'A deactivated declarative navigation placement cannot expose a Runtime Bundle.' });
806
+ }
807
+ if (value.bundle && (value.bundle.placement !== value.placement || value.bundle.surface !== value.surface)) {
808
+ context.addIssue({ code: 'custom', path: ['bundle'], message: 'The Navigation Runtime Bundle must match its placement and surface.' });
809
+ }
810
+ })),
811
+ bundles: zod_1.z.array(declarative_control_1.NavigationRuntimeBundleSchema),
812
+ releaseSlotIds: zod_1.z.array(common_1.ContractIdentifierSchema),
813
+ generation: zod_1.z.number().int().nonnegative(),
814
+ contentHash: common_1.Sha256Schema,
815
+ authDigest: common_1.Sha256Schema,
816
+ etag: zod_1.z.string().trim().min(1),
817
+ })
818
+ .strict()
819
+ .superRefine((value, context) => {
820
+ const active = value.placements.filter((entry) => entry.authority === 'declarative' && entry.state === 'active');
821
+ if (active.length !== value.bundles.length || active.length !== value.releaseSlotIds.length) {
822
+ context.addIssue({ code: 'custom', path: ['placements'], message: 'Compatibility bundle arrays must exactly project active declarative placements.' });
823
+ return;
824
+ }
825
+ active.forEach((entry, index) => {
826
+ if (entry.bundle?.contentHash !== value.bundles[index]?.contentHash || entry.releaseSlotId !== value.releaseSlotIds[index]) {
827
+ context.addIssue({ code: 'custom', path: ['placements', index], message: 'Navigation placement and compatibility bundle order must match.' });
828
+ }
829
+ });
830
+ });
831
+ exports.DeclarativeWorkbenchSummarySchema = zod_1.z
832
+ .object({
833
+ workbenchId: common_1.ContractIdentifierSchema,
834
+ releaseSlotId: common_1.ContractIdentifierSchema,
835
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
836
+ identity: declarative_control_1.WorkbenchIdentitySchema,
837
+ routeClaims: zod_1.z.array(declarative_control_1.CompiledRouteClaimSchema),
838
+ order: zod_1.z.number().int(),
839
+ isDefaultCandidate: zod_1.z.boolean(),
840
+ generation: zod_1.z.number().int().nonnegative(),
841
+ contentHash: common_1.Sha256Schema,
842
+ })
843
+ .strict();
844
+ exports.DeclarativeLegacyWorkbenchSummarySchema = zod_1.z
845
+ .object({
846
+ workbenchId: common_1.ContractIdentifierSchema,
847
+ authority: zod_1.z.literal('legacy'),
848
+ identity: declarative_control_1.WorkbenchIdentitySchema,
849
+ order: zod_1.z.number().int(),
850
+ isDefaultCandidate: zod_1.z.boolean(),
851
+ })
852
+ .strict();
853
+ exports.DeclarativeWorkbenchRuntimeBootstrapSchema = zod_1.z
854
+ .object({
855
+ defaultAuthority: zod_1.z.literal('legacy'),
856
+ authorities: zod_1.z.array(zod_1.z
857
+ .object({
858
+ workbenchId: common_1.ContractIdentifierSchema,
859
+ releaseSlotId: common_1.ContractIdentifierSchema,
860
+ authority: zod_1.z.enum(['legacy', 'declarative']),
861
+ state: zod_1.z.enum(['active', 'deactivated']),
862
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
863
+ visible: zod_1.z.boolean(),
864
+ })
865
+ .strict()
866
+ .superRefine((value, context) => {
867
+ if (value.authority === 'legacy' && value.visible)
868
+ context.addIssue({ code: 'custom', path: ['visible'], message: 'Legacy workbenches are delivered by the compatibility API, not by declarative summaries.' });
869
+ if (value.state === 'deactivated' && value.visible)
870
+ context.addIssue({ code: 'custom', path: ['visible'], message: 'Deactivated workbenches cannot be visible.' });
871
+ })),
872
+ legacySummaries: zod_1.z.array(exports.DeclarativeLegacyWorkbenchSummarySchema),
873
+ summaries: zod_1.z.array(exports.DeclarativeWorkbenchSummarySchema),
874
+ selected: zod_1.z
875
+ .object({
876
+ workbenchId: common_1.ContractIdentifierSchema,
877
+ authority: zod_1.z.enum(['legacy', 'declarative']),
878
+ releaseSlotId: common_1.ContractIdentifierSchema.optional(),
879
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
880
+ source: zod_1.z.enum(['explicit', 'default', 'first-accessible']),
881
+ })
882
+ .strict()
883
+ .superRefine((value, context) => {
884
+ if (value.authority === 'declarative' && (!value.releaseSlotId || !value.activeReleaseRevisionRef)) {
885
+ context.addIssue({ code: 'custom', path: ['releaseSlotId'], message: 'Declarative Workbench selection requires its exact Release slot and revision.' });
886
+ }
887
+ if (value.authority === 'legacy' && (value.releaseSlotId || value.activeReleaseRevisionRef)) {
888
+ context.addIssue({ code: 'custom', path: ['releaseSlotId'], message: 'Legacy Workbench selection cannot expose declarative Release state.' });
889
+ }
890
+ })
891
+ .nullable(),
892
+ authDigest: common_1.Sha256Schema,
893
+ etag: zod_1.z.string().trim().min(1),
894
+ })
895
+ .strict();
896
+ exports.DeclarativeNavigationImportIntentSchema = zod_1.z
897
+ .object({
898
+ environmentRef: declarative_control_1.StableRefSchema,
899
+ surface: declarative_control_1.ProductSurfaceSchema,
900
+ expectedLegacyContentHash: common_1.Sha256Schema,
901
+ expectedDraftVersion: zod_1.z.number().int().nonnegative(),
902
+ idempotencyKey: zod_1.z.string().trim().min(1).max(256),
903
+ })
904
+ .strict();
905
+ exports.DeclarativeNavigationImportResultSchema = zod_1.z
906
+ .object({
907
+ document: zod_1.z.unknown(),
908
+ revisionRef: declarative_control_1.RevisionRefSchema,
909
+ provenance: zod_1.z.object({ sourceKey: zod_1.z.literal('server.ui.menus'), sourceRevisionRef: declarative_control_1.RevisionRefSchema, sourceContentHash: common_1.Sha256Schema }).strict(),
910
+ diff: zod_1.z.object({ added: zod_1.z.array(common_1.ContractIdentifierSchema), removed: zod_1.z.array(common_1.ContractIdentifierSchema), changed: zod_1.z.array(common_1.ContractIdentifierSchema) }).strict(),
911
+ })
912
+ .strict();
913
+ exports.DeclarativeRuntimeResolveQuerySchema = zod_1.z
914
+ .object({
915
+ // Runtime callers may select an exact active environment. When omitted,
916
+ // Server resolves the single release-owned default for this surface.
917
+ environmentId: common_1.ContractIdentifierSchema.optional(),
918
+ surface: declarative_control_1.ProductSurfaceSchema,
919
+ path: zod_1.z.string().trim().min(1),
920
+ navigationPlacement: common_1.ContractIdentifierSchema.optional(),
921
+ })
922
+ .strict();
923
+ // Route claims are re-exported here because authoring clients select an existing
924
+ // declaration claim; they never submit a URL or mutable endpoint as authority.
925
+ exports.DeclarativeRouteClaimIntentSchema = declarative_control_1.RouteClaimSchema;
926
+ //# sourceMappingURL=declarative-control-http.js.map