@inf-monkeys-tech/monkeys 1.0.72 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/lib/contracts/aggregate-commit.d.ts +155 -0
  2. package/lib/contracts/aggregate-commit.d.ts.map +1 -0
  3. package/lib/contracts/aggregate-commit.js +112 -0
  4. package/lib/contracts/aggregate-commit.js.map +1 -0
  5. package/lib/contracts/capability.d.ts +3 -0
  6. package/lib/contracts/capability.d.ts.map +1 -1
  7. package/lib/contracts/capability.js +1 -1
  8. package/lib/contracts/capability.js.map +1 -1
  9. package/lib/contracts/common.d.ts +2 -0
  10. package/lib/contracts/common.d.ts.map +1 -1
  11. package/lib/contracts/common.js +34 -1
  12. package/lib/contracts/common.js.map +1 -1
  13. package/lib/contracts/component-assembly.d.ts +118 -0
  14. package/lib/contracts/component-assembly.d.ts.map +1 -0
  15. package/lib/contracts/component-assembly.js +61 -0
  16. package/lib/contracts/component-assembly.js.map +1 -0
  17. package/lib/contracts/declarative-control-http.d.ts +101608 -44791
  18. package/lib/contracts/declarative-control-http.d.ts.map +1 -1
  19. package/lib/contracts/declarative-control-http.js +1358 -86
  20. package/lib/contracts/declarative-control-http.js.map +1 -1
  21. package/lib/contracts/declarative-control.d.ts +9668 -3376
  22. package/lib/contracts/declarative-control.d.ts.map +1 -1
  23. package/lib/contracts/declarative-control.js +2585 -186
  24. package/lib/contracts/declarative-control.js.map +1 -1
  25. package/lib/contracts/index.d.ts +6 -0
  26. package/lib/contracts/index.d.ts.map +1 -1
  27. package/lib/contracts/index.js +6 -0
  28. package/lib/contracts/index.js.map +1 -1
  29. package/lib/contracts/legacy-route.d.ts +15 -0
  30. package/lib/contracts/legacy-route.d.ts.map +1 -0
  31. package/lib/contracts/legacy-route.js +13 -0
  32. package/lib/contracts/legacy-route.js.map +1 -0
  33. package/lib/contracts/menu.d.ts +12 -0
  34. package/lib/contracts/menu.d.ts.map +1 -1
  35. package/lib/contracts/page-binding-dependencies.d.ts +25 -0
  36. package/lib/contracts/page-binding-dependencies.d.ts.map +1 -0
  37. package/lib/contracts/page-binding-dependencies.js +54 -0
  38. package/lib/contracts/page-binding-dependencies.js.map +1 -0
  39. package/lib/contracts/page-expression.d.ts +106 -0
  40. package/lib/contracts/page-expression.d.ts.map +1 -0
  41. package/lib/contracts/page-expression.js +136 -0
  42. package/lib/contracts/page-expression.js.map +1 -0
  43. package/lib/contracts/page-stream.d.ts +101 -0
  44. package/lib/contracts/page-stream.d.ts.map +1 -0
  45. package/lib/contracts/page-stream.js +66 -0
  46. package/lib/contracts/page-stream.js.map +1 -0
  47. package/lib/contracts/page.d.ts +24 -0
  48. package/lib/contracts/page.d.ts.map +1 -1
  49. package/lib/contracts/page.js +2 -0
  50. package/lib/contracts/page.js.map +1 -1
  51. package/lib/contracts/record-editor-draft.d.ts +95 -0
  52. package/lib/contracts/record-editor-draft.d.ts.map +1 -0
  53. package/lib/contracts/record-editor-draft.js +35 -0
  54. package/lib/contracts/record-editor-draft.js.map +1 -0
  55. package/lib/contracts/render.d.ts +16 -0
  56. package/lib/contracts/render.d.ts.map +1 -1
  57. package/lib/contracts/render.js +3 -1
  58. package/lib/contracts/render.js.map +1 -1
  59. package/lib/contracts/semantic.d.ts +48 -1
  60. package/lib/contracts/semantic.d.ts.map +1 -1
  61. package/lib/contracts/semantic.js +22 -19
  62. package/lib/contracts/semantic.js.map +1 -1
  63. package/lib/contracts/tenant.d.ts +112 -6
  64. package/lib/contracts/tenant.d.ts.map +1 -1
  65. package/lib/contracts/tenant.js +14 -1
  66. package/lib/contracts/tenant.js.map +1 -1
  67. package/lib/esm/contracts/index.mjs +6921 -3032
  68. package/lib/esm/contracts/index.mjs.map +1 -1
  69. package/lib/esm/index.mjs +11333 -4947
  70. package/lib/esm/index.mjs.map +1 -1
  71. package/lib/esm/runtime/index.mjs +11514 -4411
  72. package/lib/esm/runtime/index.mjs.map +1 -1
  73. package/lib/esm/schemas/index.mjs +7282 -2571
  74. package/lib/esm/schemas/index.mjs.map +1 -1
  75. package/lib/json-schema/aggregate-commit-request.schema.json +426 -0
  76. package/lib/json-schema/capability-manifest.schema.json +1 -0
  77. package/lib/json-schema/capability-registry.schema.json +1 -0
  78. package/lib/json-schema/declarative-route-owner-index.schema.json +1092 -0
  79. package/lib/json-schema/declarative-workbench-catalog.schema.json +769 -0
  80. package/lib/json-schema/design-capability-catalog-artifact.schema.json +2787 -0
  81. package/lib/json-schema/domain-command-definition.schema.json +18 -0
  82. package/lib/json-schema/domain-query-definition.schema.json +1406 -0
  83. package/lib/json-schema/index.json +7 -0
  84. package/lib/json-schema/legacy-route-takeover-authorization.schema.json +601 -0
  85. package/lib/json-schema/navigation-release.schema.json +296 -0
  86. package/lib/json-schema/navigation-runtime-bundle.schema.json +48 -8
  87. package/lib/json-schema/navigation.schema.json +47 -8
  88. package/lib/json-schema/overlay-node.schema.json +281 -0
  89. package/lib/json-schema/page-definition.schema.json +34 -0
  90. package/lib/json-schema/page-release.schema.json +1520 -626
  91. package/lib/json-schema/page-runtime-bundle.schema.json +5980 -401
  92. package/lib/json-schema/page-runtime-descriptor.schema.json +34 -0
  93. package/lib/json-schema/page.schema.json +7333 -1482
  94. package/lib/json-schema/permission-alternative-policy.schema.json +60 -0
  95. package/lib/json-schema/product-declaration.schema.json +53 -0
  96. package/lib/json-schema/render-node.schema.json +281 -0
  97. package/lib/json-schema/render-tree.schema.json +281 -0
  98. package/lib/json-schema/tenant-product-config.schema.json +88 -0
  99. package/lib/json-schema/tenant-runtime-config.schema.json +88 -0
  100. package/lib/json-schema/view-provider-descriptor.schema.json +1 -0
  101. package/lib/json-schema/workbench-release.schema.json +1520 -626
  102. package/lib/json-schema/workbench-runtime-bundle.schema.json +686 -20
  103. package/lib/json-schema/workbench.schema.json +1196 -0
  104. package/lib/runtime/component-assembly.d.ts +4 -0
  105. package/lib/runtime/component-assembly.d.ts.map +1 -0
  106. package/lib/runtime/component-assembly.js +126 -0
  107. package/lib/runtime/component-assembly.js.map +1 -0
  108. package/lib/runtime/declarative-control-compiler.d.ts +66 -5
  109. package/lib/runtime/declarative-control-compiler.d.ts.map +1 -1
  110. package/lib/runtime/declarative-control-compiler.js +862 -109
  111. package/lib/runtime/declarative-control-compiler.js.map +1 -1
  112. package/lib/runtime/index.d.ts +5 -0
  113. package/lib/runtime/index.d.ts.map +1 -1
  114. package/lib/runtime/index.js +7 -0
  115. package/lib/runtime/index.js.map +1 -1
  116. package/lib/runtime/page-expression.d.ts +9 -0
  117. package/lib/runtime/page-expression.d.ts.map +1 -0
  118. package/lib/runtime/page-expression.js +257 -0
  119. package/lib/runtime/page-expression.js.map +1 -0
  120. package/lib/runtime/page-stream.d.ts +24 -0
  121. package/lib/runtime/page-stream.d.ts.map +1 -0
  122. package/lib/runtime/page-stream.js +65 -0
  123. package/lib/runtime/page-stream.js.map +1 -0
  124. package/lib/runtime/record-editor-draft.d.ts +29 -0
  125. package/lib/runtime/record-editor-draft.d.ts.map +1 -0
  126. package/lib/runtime/record-editor-draft.js +161 -0
  127. package/lib/runtime/record-editor-draft.js.map +1 -0
  128. package/lib/runtime/target-render-model.d.ts +4 -0
  129. package/lib/runtime/target-render-model.d.ts.map +1 -0
  130. package/lib/runtime/target-render-model.js +28 -0
  131. package/lib/runtime/target-render-model.js.map +1 -0
  132. package/lib/runtime/tenant-config.d.ts +2 -0
  133. package/lib/runtime/tenant-config.d.ts.map +1 -1
  134. package/lib/runtime/tenant-config.js +6 -1
  135. package/lib/runtime/tenant-config.js.map +1 -1
  136. package/lib/schemas/index.d.ts +6957 -2171
  137. package/lib/schemas/index.d.ts.map +1 -1
  138. package/lib/schemas/index.js +86 -8
  139. package/lib/schemas/index.js.map +1 -1
  140. package/package.json +1 -1
@@ -1,34 +1,43 @@
1
1
  "use strict";
2
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;
3
+ 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.DeclarativeSchemaDefinitionRegistrationSchema = exports.DeclarativeDomainCommandDefinitionRegistrationSchema = exports.DeclarativeDomainQueryDefinitionRegistrationSchema = exports.DeclarativeDefaultPolicyRegistrationSchema = exports.DeclarativeProductResourceRegistrationSchema = exports.DeclarativeEnvironmentResourceDocumentSchema = exports.DeclarativeLayoutPolicyResourceDocumentSchema = exports.DeclarativeShellResourceDocumentSchema = exports.DeclarativeRouteSpaceRegistrationSchema = exports.DeclarativeCreateTemplateRegistrationSchema = exports.DeclarativeCapabilityAuthoringChoiceSchema = exports.ProductDeclarativeCapabilityRegistrationSchema = exports.DesignCapabilityCatalogArtifactSchema = exports.DesignCapabilityCatalogEntrySchema = exports.DeclarativeCapabilityAuthoringRegistrationSchema = exports.DeclarativeCapabilitySchemaDocumentSchema = exports.DeclarativeAuthoringChoiceSchema = exports.DeclarativePublicationPlanIntentSchema = exports.DeclarativeBatchOperationIntentSchema = exports.DeclarativeCommandIntentSchema = exports.DeclarativeReleaseTargetIntentSchema = exports.DeclarativeAudienceSimulationSchema = exports.DeclarativeRuntimeNavigationActionExecuteResultSchema = exports.DeclarativeRuntimeNavigationActionExecuteIntentSchema = exports.DeclarativeRuntimeActionExecuteResultSchema = exports.DeclarativeNativeDownloadSchema = exports.DeclarativeRuntimeActionExecuteIntentSchema = exports.DeclarativeRuntimeActionRoutePathSchema = exports.DeclarativeRuntimeBindingQueryResultSchema = exports.DeclarativeRuntimeBindingQueryIntentSchema = exports.DeclarativeErrorEnvelopeSchema = exports.DeclarativeSuccessEnvelopeSchema = exports.declarativeControlRoutes = exports.DeclarativeLegacyMigrationKindSchema = exports.DeclarativeAuthoringActionSchema = exports.DeclarativeResourceKindSchema = exports.DECLARATIVE_CONTROL_CONTROLLER_PATH = exports.DECLARATIVE_CONTROL_API_PREFIX = void 0;
4
+ exports.DeclarativeRouteClaimIntentSchema = exports.DeclarativeRuntimeRouteOwnerSchema = exports.DeclarativeRuntimeRouteOwnerQuerySchema = exports.DeclarativeRuntimeResolveQuerySchema = exports.DeclarativeNavigationImportResultSchema = exports.DeclarativeNavigationImportIntentSchema = exports.DeclarativeWorkbenchRuntimeBootstrapSchema = exports.DeclarativeLegacyWorkbenchSummarySchema = exports.DeclarativeWorkbenchSummarySchema = exports.DeclarativeNavigationRuntimeBootstrapSchema = exports.DeclarativeRuntimeResolveResultSchema = exports.DeclarativeRuntimeResolvedSchema = exports.DeclarativeRuntimeRedirectSchema = exports.DeclarativeAuthoringBootstrapSchema = exports.DeclarativeNavigationPlacementSchema = exports.DeclarativeNavigationSeedMigrationResultSchema = exports.DeclarativeNavigationSeedMigrationIntentSchema = exports.DeclarativeAuthoringCommandResultSchema = exports.DeclarativeRetireResultSchema = exports.DECLARATIVE_MIGRATION_ERROR_CODES = exports.DeclarativeLegacyMigrationCreateDraftResultSchema = exports.DeclarativeLegacyMigrationCreateDraftIntentSchema = exports.DeclarativeLegacyMigrationInspectionSchema = exports.DeclarativeMigrationBlockerSchema = exports.DeclarativeMigrationDiffEntrySchema = exports.DeclarativePublicationResultSchema = exports.DeclarativePublicationItemResultSchema = exports.DeclarativePreviewResultSchema = exports.DeclarativeValidationResultSchema = exports.DeclarativeDraftResultSchema = exports.DeclarativeAuthoringHistorySchema = exports.DeclarativeAuthoringHistoryEntrySchema = exports.DeclarativeAuthoringResourcePageSchema = exports.DeclarativeAuthoringResourceSummarySchema = exports.DeclarativeDocumentSummarySchema = exports.DeclarativeAuthoringChoicePageQuerySchema = exports.DeclarativeAuthoringResourcePageQuerySchema = exports.DeclarativeAuthoringChoicePageSchema = exports.DeclarativeAuthoringChoiceKindSchema = exports.DeclarativeAuthoringPageInfoSchema = void 0;
5
5
  const zod_1 = require("zod");
6
+ const page_expression_1 = require("./page-expression");
6
7
  const declarative_control_1 = require("./declarative-control");
7
8
  const common_1 = require("./common");
9
+ const capability_1 = require("./capability");
10
+ const render_1 = require("./render");
11
+ const semantic_1 = require("./semantic");
8
12
  exports.DECLARATIVE_CONTROL_API_PREFIX = '/api/declarative-control';
9
13
  exports.DECLARATIVE_CONTROL_CONTROLLER_PATH = '/declarative-control';
10
14
  exports.DeclarativeResourceKindSchema = zod_1.z.enum(['page', 'navigation', 'workbench']);
11
15
  exports.DeclarativeAuthoringActionSchema = zod_1.z.enum(['validate', 'preview', 'publish', 'rollback']);
16
+ exports.DeclarativeLegacyMigrationKindSchema = zod_1.z.enum(['page', 'page-data-assets', 'workbench']);
12
17
  const encodePath = (value) => encodeURIComponent(value);
13
18
  exports.declarativeControlRoutes = {
19
+ validate: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/validate`,
20
+ preview: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/preview`,
21
+ publish: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/publish`,
22
+ rollback: (kind, resourceId, releaseSlotId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/releases/${encodePath(releaseSlotId)}/rollback`,
23
+ slotAuthority: (kind, slotId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/slot-authorities/${kind}/${encodePath(slotId)}`,
14
24
  resources: (kind) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}`,
15
25
  authoringCreate: (kind) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind}`,
16
26
  draft: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/draft`,
17
27
  revisions: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/revisions`,
18
28
  authoringHistory: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind}/${encodePath(resourceId)}/history`,
19
29
  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
30
  references: (kind, resourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/references`,
25
31
  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
32
  authoringBootstrap: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/bootstrap`,
28
33
  authoringPrepare: (kind, resourceId, action) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind}/${encodePath(resourceId)}/${action}`,
29
34
  navigationPlacements: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/navigation/placements`,
30
35
  navigationImport: (placement) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/navigation/placements/${encodePath(placement)}/import`,
31
36
  navigationSeedMigration: (placement) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/navigation/placements/${encodePath(placement)}/seed-migration`,
37
+ migrationInspect: (kind, legacyResourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/migrations/${kind}/${encodePath(legacyResourceId)}/inspect`,
38
+ migrationCreateDraft: (kind, legacyResourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/migrations/${kind}/${encodePath(legacyResourceId)}/draft`,
39
+ migrationCutover: (kind, targetResourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind === 'workbench' ? 'workbench' : 'page'}/${encodePath(targetResourceId)}/publish`,
40
+ migrationRollback: (kind, targetResourceId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/resources/${kind === 'workbench' ? 'workbench' : 'page'}/${encodePath(targetResourceId)}/rollback`,
32
41
  publicationPlan: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/authoring/publication-plans`,
33
42
  runtimeResolve: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/resolve`,
34
43
  runtimeNavigationBootstrap: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/navigations/bootstrap`,
@@ -37,6 +46,7 @@ exports.declarativeControlRoutes = {
37
46
  runtimeNavigation: (releaseSlotId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/navigations/${encodePath(releaseSlotId)}`,
38
47
  runtimeWorkbench: (releaseSlotId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/workbenches/${encodePath(releaseSlotId)}`,
39
48
  runtimePreview: () => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/previews`,
49
+ runtimePreviewBindingQuery: (bindingId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/previews/bindings/${encodePath(bindingId)}/query`,
40
50
  runtimeBindingQuery: (releaseSlotId, bindingId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/pages/${encodePath(releaseSlotId)}/bindings/${encodePath(bindingId)}/query`,
41
51
  runtimeActionExecute: (releaseSlotId, actionBindingId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/pages/${encodePath(releaseSlotId)}/actions/${encodePath(actionBindingId)}/execute`,
42
52
  runtimeNavigationActionExecute: (releaseSlotId, nodeId) => `${exports.DECLARATIVE_CONTROL_API_PREFIX}/runtime/navigations/${encodePath(releaseSlotId)}/actions/${encodePath(nodeId)}/execute`,
@@ -60,14 +70,93 @@ const DeclarativeRuntimePageTargetSchema = zod_1.z
60
70
  .strict()
61
71
  .superRefine((value, context) => {
62
72
  if (value.activeReleaseRevisionRef.kind !== 'page-release') {
63
- context.addIssue({ code: 'custom', path: ['activeReleaseRevisionRef', 'kind'], message: 'Runtime requests require an exact page-release revision.' });
73
+ context.addIssue({
74
+ code: 'custom',
75
+ path: ['activeReleaseRevisionRef', 'kind'],
76
+ message: 'Runtime requests require an exact page-release revision.',
77
+ });
64
78
  }
65
79
  if (value.pageRevisionRef.kind !== 'page') {
66
- context.addIssue({ code: 'custom', path: ['pageRevisionRef', 'kind'], message: 'Runtime requests require an exact page revision.' });
80
+ context.addIssue({
81
+ code: 'custom',
82
+ path: ['pageRevisionRef', 'kind'],
83
+ message: 'Runtime requests require an exact page revision.',
84
+ });
67
85
  }
68
86
  });
87
+ const forbiddenRuntimeParameterKeys = new Set(['__proto__', 'prototype', 'constructor']);
88
+ const rejectRuntimePrototypeKeys = (value, context, path = []) => {
89
+ if (Array.isArray(value)) {
90
+ value.forEach((child, index) => rejectRuntimePrototypeKeys(child, context, [...path, index]));
91
+ return;
92
+ }
93
+ if (!value || typeof value !== 'object')
94
+ return;
95
+ for (const key of Object.keys(value)) {
96
+ if (forbiddenRuntimeParameterKeys.has(key)) {
97
+ context.addIssue({
98
+ code: 'custom',
99
+ path: [...path, key],
100
+ message: 'Prototype-mutating runtime parameter keys are forbidden.',
101
+ });
102
+ }
103
+ rejectRuntimePrototypeKeys(value[key], context, [...path, key]);
104
+ }
105
+ };
106
+ const runtimeParameterDepth = (value, depth = 0) => {
107
+ if (value === null || typeof value !== 'object')
108
+ return depth;
109
+ const values = Array.isArray(value) ? value : Object.values(value);
110
+ return values.reduce((maximum, child) => Math.max(maximum, runtimeParameterDepth(child, depth + 1)), depth);
111
+ };
112
+ const DeclarativeRuntimeParametersSchema = zod_1.z
113
+ .any()
114
+ .superRefine(rejectRuntimePrototypeKeys)
115
+ .pipe(common_1.JsonObjectSchema.superRefine((value, context) => {
116
+ const keys = Object.keys(value);
117
+ if (keys.length > 32)
118
+ context.addIssue({
119
+ code: 'custom',
120
+ path: [],
121
+ message: 'Runtime binding parameters cannot contain more than 32 keys.',
122
+ });
123
+ keys.forEach((key) => {
124
+ if (!common_1.ContractIdentifierSchema.safeParse(key).success)
125
+ context.addIssue({
126
+ code: 'custom',
127
+ path: [key],
128
+ message: 'Runtime parameter keys must be contract identifiers.',
129
+ });
130
+ });
131
+ if (runtimeParameterDepth(value) > 8)
132
+ context.addIssue({
133
+ code: 'custom',
134
+ path: [],
135
+ message: 'Runtime binding parameters cannot exceed 8 nested levels.',
136
+ });
137
+ const serialized = JSON.stringify(value);
138
+ if (new TextEncoder().encode(serialized).length > 16 * 1024)
139
+ context.addIssue({
140
+ code: 'custom',
141
+ path: [],
142
+ message: 'Runtime binding parameters cannot exceed 16 KiB.',
143
+ });
144
+ const visit = (entry, path) => {
145
+ if (typeof entry === 'string' && entry.length > 2048)
146
+ context.addIssue({
147
+ code: 'custom',
148
+ path,
149
+ message: 'Runtime parameter string values cannot exceed 2048 characters.',
150
+ });
151
+ else if (Array.isArray(entry))
152
+ entry.forEach((child, index) => visit(child, [...path, index]));
153
+ else if (entry && typeof entry === 'object')
154
+ Object.entries(entry).forEach(([key, child]) => visit(child, [...path, key]));
155
+ };
156
+ visit(value, []);
157
+ }));
69
158
  exports.DeclarativeRuntimeBindingQueryIntentSchema = DeclarativeRuntimePageTargetSchema.safeExtend({
70
- parameters: common_1.JsonObjectSchema.default({}),
159
+ parameters: DeclarativeRuntimeParametersSchema.default({}),
71
160
  pageSize: zod_1.z.number().int().min(1).max(200).default(60),
72
161
  cursor: zod_1.z.string().trim().min(1).max(8192).optional(),
73
162
  }).strict();
@@ -78,6 +167,7 @@ exports.DeclarativeRuntimeBindingQueryResultSchema = zod_1.z
78
167
  pageRevisionRef: declarative_control_1.RevisionRefSchema,
79
168
  renderModelSchemaRevisionRef: declarative_control_1.RevisionRefSchema,
80
169
  model: common_1.JsonObjectSchema,
170
+ refresh: zod_1.z.object({ continue: zod_1.z.boolean() }).strict().optional(),
81
171
  pageInfo: zod_1.z
82
172
  .object({
83
173
  pageSize: zod_1.z.number().int().positive(),
@@ -92,10 +182,59 @@ exports.DeclarativeRuntimeBindingQueryResultSchema = zod_1.z
92
182
  contentHash: common_1.Sha256Schema,
93
183
  })
94
184
  .strict();
185
+ exports.DeclarativeRuntimeActionRoutePathSchema = zod_1.z
186
+ .string()
187
+ .min(1)
188
+ .max(8192)
189
+ .refine((value) => value.startsWith('/') &&
190
+ !value.startsWith('//') &&
191
+ value === value.trim() &&
192
+ !/[?#\\\u0000-\u0020\u007f]/.test(value) &&
193
+ !value.includes('://'), 'An Action route requires an application-relative pathname without query or fragment.');
95
194
  exports.DeclarativeRuntimeActionExecuteIntentSchema = DeclarativeRuntimePageTargetSchema.safeExtend({
96
195
  intent: common_1.JsonObjectSchema,
196
+ recoveryOnly: zod_1.z.literal(true).optional(),
197
+ pageState: DeclarativeRuntimeParametersSchema,
198
+ files: zod_1.z.record(zod_1.z.string().min(1).max(256), zod_1.z.union([
199
+ zod_1.z.object({ fileName: zod_1.z.string().min(1).max(255), content: zod_1.z.string().max(1048576) }).strict(),
200
+ zod_1.z.object({ fileName: zod_1.z.string().min(1).max(255), canonicalUri: zod_1.z.string().regex(/^file:\/\/[^\s/?#]+$/).max(1024) }).strict(),
201
+ ])).superRefine((files, context) => {
202
+ if (Object.keys(files).length > 4 || Object.values(files).reduce((bytes, file) => bytes + ('content' in file ? new TextEncoder().encode(file.content).byteLength : 0), 0) > 1048576)
203
+ context.addIssue({ code: 'custom', message: 'Action files exceed the transient input budget.' });
204
+ }).optional(),
205
+ scope: zod_1.z.unknown().superRefine((value, context) => {
206
+ try {
207
+ (0, page_expression_1.assertPageValueBudget)(value);
208
+ }
209
+ catch {
210
+ context.addIssue({ code: 'custom', message: 'Action instance scope exceeds the safe JSON budget.' });
211
+ }
212
+ }).pipe(common_1.JsonObjectSchema).optional(),
213
+ routePath: exports.DeclarativeRuntimeActionRoutePathSchema.optional(),
97
214
  idempotencyKey: zod_1.z.string().trim().min(1).max(256),
98
215
  }).strict();
216
+ exports.DeclarativeNativeDownloadSchema = zod_1.z
217
+ .object({
218
+ url: zod_1.z
219
+ .string()
220
+ .min(1)
221
+ .max(32768)
222
+ .refine((value) => {
223
+ try {
224
+ const url = new URL(value);
225
+ return ['http:', 'https:'].includes(url.protocol) && !url.username && !url.password;
226
+ }
227
+ catch {
228
+ return false;
229
+ }
230
+ }, 'A native download requires an HTTP URL without credentials.'),
231
+ fileName: zod_1.z
232
+ .string()
233
+ .min(1)
234
+ .max(2048)
235
+ .regex(/^[^\u0000-\u001f\u007f/\\]+$/),
236
+ })
237
+ .strict();
99
238
  exports.DeclarativeRuntimeActionExecuteResultSchema = zod_1.z
100
239
  .object({
101
240
  actionBindingId: common_1.ContractIdentifierSchema,
@@ -104,13 +243,26 @@ exports.DeclarativeRuntimeActionExecuteResultSchema = zod_1.z
104
243
  commandRevisionRef: declarative_control_1.RevisionRefSchema,
105
244
  resultSchemaRevisionRef: declarative_control_1.RevisionRefSchema,
106
245
  result: common_1.JsonObjectSchema,
246
+ download: exports.DeclarativeNativeDownloadSchema.optional(),
247
+ downloadError: zod_1.z
248
+ .object({ code: zod_1.z.enum(['DECLARATIVE_DOWNLOAD_FORBIDDEN', 'DECLARATIVE_DOWNLOAD_UNAVAILABLE']) })
249
+ .strict()
250
+ .optional(),
107
251
  idempotentReplay: zod_1.z.boolean(),
108
252
  lineageRef: declarative_control_1.StableRefSchema,
109
253
  refreshBindingIds: zod_1.z.array(common_1.ContractIdentifierSchema),
110
254
  navigationTargetRef: declarative_control_1.StableRefSchema.optional(),
111
255
  contentHash: common_1.Sha256Schema,
112
256
  })
113
- .strict();
257
+ .strict()
258
+ .superRefine((value, context) => {
259
+ if (value.download && value.downloadError)
260
+ context.addIssue({
261
+ code: 'custom',
262
+ path: ['downloadError'],
263
+ message: 'A download response cannot contain both a target and an error.',
264
+ });
265
+ });
114
266
  const DeclarativeRuntimeNavigationTargetSchema = zod_1.z
115
267
  .object({
116
268
  activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
@@ -119,10 +271,18 @@ const DeclarativeRuntimeNavigationTargetSchema = zod_1.z
119
271
  .strict()
120
272
  .superRefine((value, context) => {
121
273
  if (value.activeReleaseRevisionRef.kind !== 'navigation-release') {
122
- context.addIssue({ code: 'custom', path: ['activeReleaseRevisionRef', 'kind'], message: 'Navigation Action requests require an exact navigation-release revision.' });
274
+ context.addIssue({
275
+ code: 'custom',
276
+ path: ['activeReleaseRevisionRef', 'kind'],
277
+ message: 'Navigation Action requests require an exact navigation-release revision.',
278
+ });
123
279
  }
124
280
  if (value.navigationRevisionRef.kind !== 'navigation') {
125
- context.addIssue({ code: 'custom', path: ['navigationRevisionRef', 'kind'], message: 'Navigation Action requests require an exact navigation revision.' });
281
+ context.addIssue({
282
+ code: 'custom',
283
+ path: ['navigationRevisionRef', 'kind'],
284
+ message: 'Navigation Action requests require an exact navigation revision.',
285
+ });
126
286
  }
127
287
  });
128
288
  exports.DeclarativeRuntimeNavigationActionExecuteIntentSchema = DeclarativeRuntimeNavigationTargetSchema.safeExtend({
@@ -152,7 +312,11 @@ exports.DeclarativeAudienceSimulationSchema = zod_1.z
152
312
  .superRefine((references, context) => {
153
313
  references.forEach((reference, index) => {
154
314
  if (reference.kind !== 'group')
155
- context.addIssue({ code: 'custom', path: [index, 'kind'], message: 'Audience simulation only accepts stable Group refs.' });
315
+ context.addIssue({
316
+ code: 'custom',
317
+ path: [index, 'kind'],
318
+ message: 'Audience simulation only accepts stable Group refs.',
319
+ });
156
320
  });
157
321
  }),
158
322
  permissions: zod_1.z.array(common_1.ContractIdentifierSchema).max(512).default([]),
@@ -164,6 +328,7 @@ exports.DeclarativeReleaseTargetIntentSchema = zod_1.z
164
328
  environmentRevisionRef: declarative_control_1.RevisionRefSchema,
165
329
  surface: declarative_control_1.ProductSurfaceSchema,
166
330
  routeClaimIndex: zod_1.z.number().int().nonnegative().optional(),
331
+ legacyRouteTakeoverAuthorization: declarative_control_1.LegacyRouteTakeoverAuthorizationSchema.optional(),
167
332
  placement: common_1.ContractIdentifierSchema.optional(),
168
333
  order: zod_1.z.number().int().optional(),
169
334
  isDefaultCandidate: zod_1.z.boolean().optional(),
@@ -171,10 +336,19 @@ exports.DeclarativeReleaseTargetIntentSchema = zod_1.z
171
336
  .strict()
172
337
  .superRefine((value, context) => {
173
338
  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.' });
339
+ context.addIssue({
340
+ code: 'custom',
341
+ path: ['environmentRevisionRef', 'kind'],
342
+ message: 'Release targets require an exact environment registration.',
343
+ });
175
344
  }
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.' });
345
+ if (value.environmentRef.id !== value.environmentRevisionRef.id ||
346
+ value.environmentRef.ownerRepo !== value.environmentRevisionRef.ownerRepo) {
347
+ context.addIssue({
348
+ code: 'custom',
349
+ path: ['environmentRevisionRef'],
350
+ message: 'The exact environment revision must identify the selected environment.',
351
+ });
178
352
  }
179
353
  });
180
354
  exports.DeclarativeCommandIntentSchema = zod_1.z
@@ -193,11 +367,35 @@ exports.DeclarativeCommandIntentSchema = zod_1.z
193
367
  .strict();
194
368
  exports.DeclarativeBatchOperationIntentSchema = zod_1.z
195
369
  .object({
370
+ action: zod_1.z.enum(['publish', 'rollback', 'deactivate']).default('publish'),
196
371
  resourceKind: exports.DeclarativeResourceKindSchema,
197
372
  resourceId: common_1.ContractIdentifierSchema,
198
373
  intent: exports.DeclarativeCommandIntentSchema,
199
374
  })
200
- .strict();
375
+ .strict()
376
+ .superRefine((value, context) => {
377
+ if (value.action !== 'publish' && !value.intent.releaseSlotId) {
378
+ context.addIssue({
379
+ code: 'custom',
380
+ path: ['intent', 'releaseSlotId'],
381
+ message: `${value.action} requires an exact active Release slot.`,
382
+ });
383
+ }
384
+ if (value.action === 'rollback' && !value.intent.targetReleaseVersion) {
385
+ context.addIssue({
386
+ code: 'custom',
387
+ path: ['intent', 'targetReleaseVersion'],
388
+ message: 'rollback requires an exact historical Release version.',
389
+ });
390
+ }
391
+ if (value.action !== 'rollback' && value.intent.targetReleaseVersion) {
392
+ context.addIssue({
393
+ code: 'custom',
394
+ path: ['intent', 'targetReleaseVersion'],
395
+ message: 'Only rollback may select a historical Release version.',
396
+ });
397
+ }
398
+ });
201
399
  exports.DeclarativePublicationPlanIntentSchema = zod_1.z
202
400
  .object({
203
401
  idempotencyKey: zod_1.z.string().trim().min(1).max(256),
@@ -232,7 +430,11 @@ exports.DeclarativeCapabilitySchemaDocumentSchema = zod_1.z
232
430
  .strict()
233
431
  .superRefine((value, context) => {
234
432
  if (value.schemaRevisionRef.kind !== 'schema') {
235
- context.addIssue({ code: 'custom', path: ['schemaRevisionRef', 'kind'], message: 'Capability schema documents must use schema RevisionRefs.' });
433
+ context.addIssue({
434
+ code: 'custom',
435
+ path: ['schemaRevisionRef', 'kind'],
436
+ message: 'Capability schema documents must use schema RevisionRefs.',
437
+ });
236
438
  }
237
439
  });
238
440
  exports.DeclarativeCapabilityAuthoringRegistrationSchema = zod_1.z
@@ -252,10 +454,31 @@ exports.DeclarativeCapabilityAuthoringRegistrationSchema = zod_1.z
252
454
  allowedChildCapabilityRefs: zod_1.z.array(declarative_control_1.StableRefSchema),
253
455
  inputPorts: zod_1.z.array(DeclarativeCapabilityPortSchema),
254
456
  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()),
457
+ allowedSideEffects: zod_1.z.array(zod_1.z.enum(['network', 'storage', 'navigation', 'clipboard', 'worker', 'websocket'])),
458
+ ontologyRequirements: zod_1.z.array(zod_1.z
459
+ .object({
460
+ inputPort: common_1.ContractIdentifierSchema,
461
+ renderModelSchemaRevisionRef: declarative_control_1.RevisionRefSchema,
462
+ modes: zod_1.z.array(zod_1.z.enum(['view', 'filter'])).min(1),
463
+ requiredPermissionCodes: zod_1.z.array(common_1.ContractIdentifierSchema),
464
+ })
465
+ .strict()),
466
+ actionRequirements: zod_1.z.array(zod_1.z
467
+ .object({
468
+ outputPort: common_1.ContractIdentifierSchema,
469
+ allowedCommandKinds: zod_1.z.array(common_1.ContractIdentifierSchema),
470
+ requiredPermissionCodes: zod_1.z.array(common_1.ContractIdentifierSchema),
471
+ })
472
+ .strict()),
473
+ propertyFields: zod_1.z.array(zod_1.z
474
+ .object({
475
+ path: zod_1.z.string().trim().min(1),
476
+ label: declarative_control_1.I18nTextSchema,
477
+ control: common_1.ContractIdentifierSchema,
478
+ required: zod_1.z.boolean(),
479
+ advanced: zod_1.z.boolean(),
480
+ })
481
+ .strict()),
259
482
  schemaDocuments: zod_1.z.array(exports.DeclarativeCapabilitySchemaDocumentSchema).min(1),
260
483
  sourceContentHash: common_1.Sha256Schema,
261
484
  })
@@ -265,7 +488,11 @@ exports.DeclarativeCapabilityAuthoringRegistrationSchema = zod_1.z
265
488
  value.schemaDocuments.forEach((entry, index) => {
266
489
  const key = `${entry.schemaRevisionRef.ownerRepo}:${entry.schemaRevisionRef.id}@${entry.schemaRevisionRef.revision}:${entry.schemaRevisionRef.contentHash}`;
267
490
  if (documents.has(key)) {
268
- context.addIssue({ code: 'custom', path: ['schemaDocuments', index], message: 'Capability schema documents must be unique by exact RevisionRef.' });
491
+ context.addIssue({
492
+ code: 'custom',
493
+ path: ['schemaDocuments', index],
494
+ message: 'Capability schema documents must be unique by exact RevisionRef.',
495
+ });
269
496
  }
270
497
  documents.set(key, index);
271
498
  });
@@ -279,10 +506,154 @@ exports.DeclarativeCapabilityAuthoringRegistrationSchema = zod_1.z
279
506
  required.forEach((reference) => {
280
507
  const key = `${reference.ownerRepo}:${reference.id}@${reference.revision}:${reference.contentHash}`;
281
508
  if (!documents.has(key)) {
282
- context.addIssue({ code: 'custom', path: ['schemaDocuments'], message: `Missing exact schema document for ${reference.id}.` });
509
+ context.addIssue({
510
+ code: 'custom',
511
+ path: ['schemaDocuments'],
512
+ message: `Missing exact schema document for ${reference.id}.`,
513
+ });
283
514
  }
284
515
  });
285
516
  });
517
+ exports.DesignCapabilityCatalogEntrySchema = zod_1.z
518
+ .object({
519
+ manifest: capability_1.CapabilityManifestSchema,
520
+ provider: render_1.ViewProviderDescriptorSchema,
521
+ declarativeRegistration: exports.DeclarativeCapabilityAuthoringRegistrationSchema,
522
+ })
523
+ .strict();
524
+ exports.DesignCapabilityCatalogArtifactSchema = zod_1.z
525
+ .object({
526
+ contract: zod_1.z.literal('DesignCapabilityCatalogArtifact'),
527
+ schemaVersion: zod_1.z.literal(1),
528
+ sourceRef: common_1.ContractIdentifierSchema,
529
+ sourceRevisionRef: declarative_control_1.RevisionRefSchema,
530
+ entries: zod_1.z.array(exports.DesignCapabilityCatalogEntrySchema).min(1).max(512),
531
+ sourceContentHash: common_1.Sha256Schema,
532
+ })
533
+ .strict()
534
+ .superRefine((value, context) => {
535
+ if (value.sourceRevisionRef.kind !== 'design-capability-catalog' ||
536
+ value.sourceRevisionRef.id !== value.sourceRef ||
537
+ value.sourceRevisionRef.ownerRepo !== 'monkeys-design' ||
538
+ value.sourceRevisionRef.visibility !== 'global') {
539
+ context.addIssue({
540
+ code: 'custom',
541
+ path: ['sourceRevisionRef'],
542
+ message: 'A Design catalog artifact must be a global monkeys-design release revision.',
543
+ });
544
+ }
545
+ const ids = value.entries.map((entry) => entry.manifest.id);
546
+ if (new Set(ids).size !== ids.length) {
547
+ context.addIssue({
548
+ code: 'custom',
549
+ path: ['entries'],
550
+ message: 'Design catalog capability identities must be unique.',
551
+ });
552
+ }
553
+ if (ids.some((id, index) => index > 0 && ids[index - 1].localeCompare(id) > 0)) {
554
+ context.addIssue({
555
+ code: 'custom',
556
+ path: ['entries'],
557
+ message: 'Design catalog entries must use deterministic capability identity order.',
558
+ });
559
+ }
560
+ });
561
+ /**
562
+ * A product release may contribute a product-owned visual capability without
563
+ * pretending to be the global Monkeys Design catalog. The application catalog
564
+ * is the release authority; runtime code remains outside this data contract.
565
+ */
566
+ exports.ProductDeclarativeCapabilityRegistrationSchema = zod_1.z
567
+ .object({
568
+ manifest: capability_1.CapabilityManifestSchema,
569
+ provider: render_1.ViewProviderDescriptorSchema,
570
+ declarativeRegistration: exports.DeclarativeCapabilityAuthoringRegistrationSchema,
571
+ requiredPermissionCodes: zod_1.z.array(common_1.ContractIdentifierSchema).default([]),
572
+ })
573
+ .strict()
574
+ .superRefine((value, context) => {
575
+ const ownerRepo = value.manifest.ownerRepo;
576
+ const registration = value.declarativeRegistration;
577
+ if (ownerRepo === 'monkeys-design') {
578
+ context.addIssue({
579
+ code: 'custom',
580
+ path: ['manifest', 'ownerRepo'],
581
+ message: 'Monkeys Design capabilities must come from the Design capability catalog.',
582
+ });
583
+ }
584
+ if (registration.capabilityRevisionRef.kind !== 'capability' ||
585
+ registration.capabilityRevisionRef.id !== value.manifest.id ||
586
+ registration.capabilityRevisionRef.ownerRepo !== ownerRepo ||
587
+ String(registration.capabilityRevisionRef.revision) !== String(value.manifest.capabilityVersion) ||
588
+ registration.capabilityRevisionRef.visibility !== 'global') {
589
+ context.addIssue({
590
+ code: 'custom',
591
+ path: ['declarativeRegistration', 'capabilityRevisionRef'],
592
+ message: 'A product capability must pin its exact global product-owned manifest revision.',
593
+ });
594
+ }
595
+ if (registration.providerRevisionRef.kind !== 'view-provider' ||
596
+ registration.providerRevisionRef.id !== value.provider.providerId ||
597
+ registration.providerRevisionRef.ownerRepo !== ownerRepo ||
598
+ value.provider.ownerRepo !== ownerRepo ||
599
+ String(registration.providerRevisionRef.revision) !== String(value.provider.providerVersion) ||
600
+ registration.providerRevisionRef.visibility !== 'global') {
601
+ context.addIssue({
602
+ code: 'custom',
603
+ path: ['declarativeRegistration', 'providerRevisionRef'],
604
+ message: 'A product capability must pin its exact global product-owned provider revision.',
605
+ });
606
+ }
607
+ if (value.provider.capabilityRef.kind !== 'capability' ||
608
+ value.provider.capabilityRef.id !== value.manifest.id ||
609
+ value.provider.capabilityRef.ownerRepo !== ownerRepo ||
610
+ String(value.provider.capabilityRef.version) !== String(value.manifest.capabilityVersion)) {
611
+ context.addIssue({
612
+ code: 'custom',
613
+ path: ['provider', 'capabilityRef'],
614
+ message: 'A product provider must declare its exact capability owner.',
615
+ });
616
+ }
617
+ const providerBoundByManifest = value.manifest.runtime.providerBindings.some((binding) => binding.providerRef.kind === 'view-provider' &&
618
+ binding.providerRef.id === value.provider.providerId &&
619
+ binding.providerRef.ownerRepo === ownerRepo &&
620
+ String(binding.providerRef.version) === String(value.provider.providerVersion));
621
+ if (!providerBoundByManifest) {
622
+ context.addIssue({
623
+ code: 'custom',
624
+ path: ['manifest', 'runtime', 'providerBindings'],
625
+ message: 'The product capability manifest must bind the declared product provider.',
626
+ });
627
+ }
628
+ if (registration.registrationRevisionRef.kind !== 'product-capability-registration' ||
629
+ registration.registrationRevisionRef.ownerRepo !== ownerRepo ||
630
+ registration.registrationRevisionRef.visibility !== 'global' ||
631
+ registration.registrationRevisionRef.contentHash !== registration.sourceContentHash) {
632
+ context.addIssue({
633
+ code: 'custom',
634
+ path: ['declarativeRegistration', 'registrationRevisionRef'],
635
+ message: 'A product capability registration must have exact product-owned release provenance.',
636
+ });
637
+ }
638
+ registration.schemaDocuments.forEach((schema, index) => {
639
+ if (schema.schemaRevisionRef.ownerRepo !== ownerRepo || schema.schemaRevisionRef.visibility !== 'global') {
640
+ context.addIssue({
641
+ code: 'custom',
642
+ path: ['declarativeRegistration', 'schemaDocuments', index],
643
+ message: 'Embedded product capability Schemas require exact global product authority.',
644
+ });
645
+ }
646
+ });
647
+ const permissions = value.requiredPermissionCodes;
648
+ if (new Set(permissions).size !== permissions.length ||
649
+ permissions.some((permission, index) => index > 0 && permissions[index - 1].localeCompare(permission) > 0)) {
650
+ context.addIssue({
651
+ code: 'custom',
652
+ path: ['requiredPermissionCodes'],
653
+ message: 'Product capability permission codes must be unique and deterministically sorted.',
654
+ });
655
+ }
656
+ });
286
657
  exports.DeclarativeCapabilityAuthoringChoiceSchema = exports.DeclarativeAuthoringChoiceSchema.extend({
287
658
  registration: exports.DeclarativeCapabilityAuthoringRegistrationSchema,
288
659
  }).strict();
@@ -293,16 +664,44 @@ exports.DeclarativeCreateTemplateRegistrationSchema = zod_1.z
293
664
  label: declarative_control_1.I18nTextSchema,
294
665
  description: declarative_control_1.I18nTextSchema,
295
666
  supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
667
+ legacyMigrationSourcePageIds: zod_1.z.array(common_1.ContractIdentifierSchema).min(1).max(256).optional(),
296
668
  document: zod_1.z.union([declarative_control_1.PageSchema, declarative_control_1.NavigationSchema, declarative_control_1.WorkbenchSchema]),
297
669
  sourceContentHash: common_1.Sha256Schema,
298
670
  })
299
671
  .strict()
300
672
  .superRefine((value, context) => {
301
- const expected = value.document.contract === 'Page' ? 'page' : value.document.contract === 'Navigation' ? 'navigation' : 'workbench';
673
+ const expected = value.document.contract === 'Page'
674
+ ? 'page'
675
+ : value.document.contract === 'Navigation'
676
+ ? 'navigation'
677
+ : 'workbench';
302
678
  if (value.resourceKind !== expected)
303
- context.addIssue({ code: 'custom', path: ['resourceKind'], message: 'Create template kind must match its document contract.' });
679
+ context.addIssue({
680
+ code: 'custom',
681
+ path: ['resourceKind'],
682
+ message: 'Create template kind must match its document contract.',
683
+ });
304
684
  if (value.templateRevisionRef.kind !== 'declarative-create-template')
305
- context.addIssue({ code: 'custom', path: ['templateRevisionRef', 'kind'], message: 'Create templates require declarative-create-template RevisionRefs.' });
685
+ context.addIssue({
686
+ code: 'custom',
687
+ path: ['templateRevisionRef', 'kind'],
688
+ message: 'Create templates require declarative-create-template RevisionRefs.',
689
+ });
690
+ if (value.legacyMigrationSourcePageIds && value.resourceKind !== 'page') {
691
+ context.addIssue({
692
+ code: 'custom',
693
+ path: ['legacyMigrationSourcePageIds'],
694
+ message: 'Only Page templates can declare legacy Page migration sources.',
695
+ });
696
+ }
697
+ if (value.legacyMigrationSourcePageIds &&
698
+ new Set(value.legacyMigrationSourcePageIds).size !== value.legacyMigrationSourcePageIds.length) {
699
+ context.addIssue({
700
+ code: 'custom',
701
+ path: ['legacyMigrationSourcePageIds'],
702
+ message: 'Legacy Page migration source identities must be unique.',
703
+ });
704
+ }
306
705
  });
307
706
  exports.DeclarativeRouteSpaceRegistrationSchema = zod_1.z
308
707
  .object({
@@ -313,10 +712,18 @@ exports.DeclarativeRouteSpaceRegistrationSchema = zod_1.z
313
712
  .strict()
314
713
  .superRefine((value, context) => {
315
714
  if (value.routeSpaceRevisionRef.kind !== 'route-space') {
316
- context.addIssue({ code: 'custom', path: ['routeSpaceRevisionRef', 'kind'], message: 'Route-space registrations require route-space RevisionRefs.' });
715
+ context.addIssue({
716
+ code: 'custom',
717
+ path: ['routeSpaceRevisionRef', 'kind'],
718
+ message: 'Route-space registrations require route-space RevisionRefs.',
719
+ });
317
720
  }
318
721
  if (value.routeSpaceRevisionRef.id !== value.routeSpace.routeSpaceId) {
319
- context.addIssue({ code: 'custom', path: ['routeSpaceRevisionRef', 'id'], message: 'Route-space registration identity must match its document.' });
722
+ context.addIssue({
723
+ code: 'custom',
724
+ path: ['routeSpaceRevisionRef', 'id'],
725
+ message: 'Route-space registration identity must match its document.',
726
+ });
320
727
  }
321
728
  });
322
729
  exports.DeclarativeShellResourceDocumentSchema = zod_1.z
@@ -327,16 +734,39 @@ exports.DeclarativeShellResourceDocumentSchema = zod_1.z
327
734
  hostProviderRevisionRef: declarative_control_1.RevisionRefSchema,
328
735
  allowedSlots: zod_1.z.array(common_1.ContractIdentifierSchema).min(1),
329
736
  tokenRevisionRefs: zod_1.z.array(declarative_control_1.RevisionRefSchema).min(1),
737
+ surfaceChrome: zod_1.z.array(declarative_control_1.DeclarativeShellSurfaceChromeSchema).min(1),
330
738
  })
331
739
  .strict()
332
740
  .superRefine((value, context) => {
333
741
  if (value.hostCapabilityRevisionRef.kind !== 'capability')
334
- context.addIssue({ code: 'custom', path: ['hostCapabilityRevisionRef', 'kind'], message: 'Shell host capability must reference a capability.' });
742
+ context.addIssue({
743
+ code: 'custom',
744
+ path: ['hostCapabilityRevisionRef', 'kind'],
745
+ message: 'Shell host capability must reference a capability.',
746
+ });
335
747
  if (value.hostProviderRevisionRef.kind !== 'view-provider')
336
- context.addIssue({ code: 'custom', path: ['hostProviderRevisionRef', 'kind'], message: 'Shell host provider must reference a view-provider.' });
748
+ context.addIssue({
749
+ code: 'custom',
750
+ path: ['hostProviderRevisionRef', 'kind'],
751
+ message: 'Shell host provider must reference a view-provider.',
752
+ });
337
753
  value.tokenRevisionRefs.forEach((reference, index) => {
338
754
  if (reference.kind !== 'design-token')
339
- context.addIssue({ code: 'custom', path: ['tokenRevisionRefs', index, 'kind'], message: 'Shell tokens must use design-token RevisionRefs.' });
755
+ context.addIssue({
756
+ code: 'custom',
757
+ path: ['tokenRevisionRefs', index, 'kind'],
758
+ message: 'Shell tokens must use design-token RevisionRefs.',
759
+ });
760
+ });
761
+ const seenSurfaces = new Set();
762
+ value.surfaceChrome.forEach((entry, index) => {
763
+ if (seenSurfaces.has(entry.surface))
764
+ context.addIssue({
765
+ code: 'custom',
766
+ path: ['surfaceChrome', index],
767
+ message: `Duplicate shell chrome declaration for ${entry.surface}.`,
768
+ });
769
+ seenSurfaces.add(entry.surface);
340
770
  });
341
771
  });
342
772
  exports.DeclarativeLayoutPolicyResourceDocumentSchema = zod_1.z
@@ -349,7 +779,11 @@ exports.DeclarativeLayoutPolicyResourceDocumentSchema = zod_1.z
349
779
  .strict()
350
780
  .superRefine((value, context) => {
351
781
  if (value.propertySchemaRevisionRef.kind !== 'schema')
352
- context.addIssue({ code: 'custom', path: ['propertySchemaRevisionRef', 'kind'], message: 'Layout policy properties must reference a schema.' });
782
+ context.addIssue({
783
+ code: 'custom',
784
+ path: ['propertySchemaRevisionRef', 'kind'],
785
+ message: 'Layout policy properties must reference a schema.',
786
+ });
353
787
  });
354
788
  exports.DeclarativeEnvironmentResourceDocumentSchema = zod_1.z
355
789
  .object({
@@ -363,7 +797,15 @@ exports.DeclarativeEnvironmentResourceDocumentSchema = zod_1.z
363
797
  exports.DeclarativeProductResourceRegistrationSchema = zod_1.z
364
798
  .object({
365
799
  resourceRevisionRef: declarative_control_1.RevisionRefSchema,
366
- resourceKind: zod_1.z.enum(['shell', 'layout-policy', 'performance-budget', 'observation-policy', 'design-token', 'access-policy', 'environment']),
800
+ resourceKind: zod_1.z.enum([
801
+ 'shell',
802
+ 'layout-policy',
803
+ 'performance-budget',
804
+ 'observation-policy',
805
+ 'design-token',
806
+ 'access-policy',
807
+ 'environment',
808
+ ]),
367
809
  supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
368
810
  accessPolicy: declarative_control_1.AccessPolicySchema.optional(),
369
811
  schemaRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
@@ -373,24 +815,64 @@ exports.DeclarativeProductResourceRegistrationSchema = zod_1.z
373
815
  .strict()
374
816
  .superRefine((value, context) => {
375
817
  if (value.resourceRevisionRef.kind !== value.resourceKind) {
376
- context.addIssue({ code: 'custom', path: ['resourceRevisionRef', 'kind'], message: 'Product resource kind must match its RevisionRef.' });
818
+ context.addIssue({
819
+ code: 'custom',
820
+ path: ['resourceRevisionRef', 'kind'],
821
+ message: 'Product resource kind must match its RevisionRef.',
822
+ });
377
823
  }
378
824
  if (value.resourceKind === 'shell') {
379
825
  const parsed = exports.DeclarativeShellResourceDocumentSchema.safeParse(value.document);
380
826
  if (!parsed.success)
381
- context.addIssue({ code: 'custom', path: ['document'], message: `Invalid shell declaration: ${parsed.error.message}` });
827
+ context.addIssue({
828
+ code: 'custom',
829
+ path: ['document'],
830
+ message: `Invalid shell declaration: ${parsed.error.message}`,
831
+ });
832
+ if (parsed.success) {
833
+ const declaredSurfaces = new Set(parsed.data.surfaceChrome.map((entry) => entry.surface));
834
+ const supportedSurfaces = new Set(value.supportedSurfaces);
835
+ value.supportedSurfaces.forEach((surface) => {
836
+ if (!declaredSurfaces.has(surface))
837
+ context.addIssue({
838
+ code: 'custom',
839
+ path: ['document', 'surfaceChrome'],
840
+ message: `Shell chrome is missing for supported surface ${surface}.`,
841
+ });
842
+ });
843
+ parsed.data.surfaceChrome.forEach((entry) => {
844
+ if (!supportedSurfaces.has(entry.surface))
845
+ context.addIssue({
846
+ code: 'custom',
847
+ path: ['document', 'surfaceChrome'],
848
+ message: `Shell chrome declares unsupported surface ${entry.surface}.`,
849
+ });
850
+ });
851
+ }
382
852
  }
383
853
  if (value.resourceKind === 'layout-policy') {
384
854
  const parsed = exports.DeclarativeLayoutPolicyResourceDocumentSchema.safeParse(value.document);
385
855
  if (!parsed.success)
386
- context.addIssue({ code: 'custom', path: ['document'], message: `Invalid layout-policy declaration: ${parsed.error.message}` });
856
+ context.addIssue({
857
+ code: 'custom',
858
+ path: ['document'],
859
+ message: `Invalid layout-policy declaration: ${parsed.error.message}`,
860
+ });
387
861
  }
388
862
  if (value.resourceKind === 'environment') {
389
863
  const parsed = exports.DeclarativeEnvironmentResourceDocumentSchema.safeParse(value.document);
390
864
  if (!parsed.success)
391
- context.addIssue({ code: 'custom', path: ['document'], message: `Invalid environment declaration: ${parsed.error.message}` });
865
+ context.addIssue({
866
+ code: 'custom',
867
+ path: ['document'],
868
+ message: `Invalid environment declaration: ${parsed.error.message}`,
869
+ });
392
870
  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.' });
871
+ context.addIssue({
872
+ code: 'custom',
873
+ path: ['document', 'environmentId'],
874
+ message: 'Environment registration identity must match its document.',
875
+ });
394
876
  }
395
877
  }
396
878
  });
@@ -401,6 +883,79 @@ exports.DeclarativeDefaultPolicyRegistrationSchema = zod_1.z
401
883
  supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
402
884
  })
403
885
  .strict();
886
+ exports.DeclarativeDomainQueryDefinitionRegistrationSchema = zod_1.z
887
+ .object({
888
+ definitionRevisionRef: declarative_control_1.RevisionRefSchema,
889
+ definition: declarative_control_1.DomainQueryDefinitionSchema,
890
+ })
891
+ .strict()
892
+ .superRefine((value, context) => {
893
+ if (value.definitionRevisionRef.kind !== 'domain-query-definition') {
894
+ context.addIssue({
895
+ code: 'custom',
896
+ path: ['definitionRevisionRef', 'kind'],
897
+ message: 'A Domain Query registration must pin a domain-query-definition revision.',
898
+ });
899
+ }
900
+ if (value.definitionRevisionRef.id !== value.definition.queryId) {
901
+ context.addIssue({
902
+ code: 'custom',
903
+ path: ['definitionRevisionRef', 'id'],
904
+ message: 'A Domain Query registration identity must match its definition.',
905
+ });
906
+ }
907
+ });
908
+ exports.DeclarativeDomainCommandDefinitionRegistrationSchema = zod_1.z
909
+ .object({
910
+ definitionRevisionRef: declarative_control_1.RevisionRefSchema,
911
+ definition: semantic_1.DomainCommandDefinitionSchema,
912
+ })
913
+ .strict()
914
+ .superRefine((value, context) => {
915
+ if (value.definitionRevisionRef.kind !== 'domain-command') {
916
+ context.addIssue({
917
+ code: 'custom',
918
+ path: ['definitionRevisionRef', 'kind'],
919
+ message: 'A Domain Command registration must pin a domain-command revision.',
920
+ });
921
+ }
922
+ if (value.definitionRevisionRef.id !== value.definition.commandName) {
923
+ context.addIssue({
924
+ code: 'custom',
925
+ path: ['definitionRevisionRef', 'id'],
926
+ message: 'A Domain Command registration identity must match its definition.',
927
+ });
928
+ }
929
+ });
930
+ exports.DeclarativeSchemaDefinitionRegistrationSchema = zod_1.z
931
+ .object({
932
+ definitionRevisionRef: declarative_control_1.RevisionRefSchema,
933
+ definition: semantic_1.SchemaDefinitionSchema,
934
+ })
935
+ .strict()
936
+ .superRefine((value, context) => {
937
+ if (value.definitionRevisionRef.kind !== 'schema') {
938
+ context.addIssue({
939
+ code: 'custom',
940
+ path: ['definitionRevisionRef', 'kind'],
941
+ message: 'A Schema registration must pin a schema revision.',
942
+ });
943
+ }
944
+ if (value.definitionRevisionRef.id !== value.definition.schemaId) {
945
+ context.addIssue({
946
+ code: 'custom',
947
+ path: ['definitionRevisionRef', 'id'],
948
+ message: 'A Schema registration identity must match its definition.',
949
+ });
950
+ }
951
+ if (value.definitionRevisionRef.ownerRepo !== value.definition.ownerRepo) {
952
+ context.addIssue({
953
+ code: 'custom',
954
+ path: ['definitionRevisionRef', 'ownerRepo'],
955
+ message: 'A Schema registration authority must match its definition.',
956
+ });
957
+ }
958
+ });
404
959
  /** Release-owned product authoring inputs. Instances and releases remain Ontology records. */
405
960
  exports.ProductDeclarativeAuthoringCatalogSchema = zod_1.z
406
961
  .object({
@@ -411,26 +966,96 @@ exports.ProductDeclarativeAuthoringCatalogSchema = zod_1.z
411
966
  routeSpaces: zod_1.z.array(exports.DeclarativeRouteSpaceRegistrationSchema),
412
967
  resourceRegistrations: zod_1.z.array(exports.DeclarativeProductResourceRegistrationSchema),
413
968
  defaultPolicies: zod_1.z.array(exports.DeclarativeDefaultPolicyRegistrationSchema),
969
+ domainQueryDefinitions: zod_1.z.array(exports.DeclarativeDomainQueryDefinitionRegistrationSchema).default([]),
970
+ domainCommandDefinitions: zod_1.z.array(exports.DeclarativeDomainCommandDefinitionRegistrationSchema).default([]),
971
+ schemaDefinitions: zod_1.z.array(exports.DeclarativeSchemaDefinitionRegistrationSchema).default([]),
972
+ capabilityRegistrations: zod_1.z.array(exports.ProductDeclarativeCapabilityRegistrationSchema).default([]),
414
973
  })
415
974
  .strict()
416
975
  .superRefine((value, context) => {
417
976
  const duplicates = (items) => items.find((item, index) => items.indexOf(item) !== index);
418
977
  const duplicateTemplate = duplicates(value.createTemplates.map((item) => `${item.templateRevisionRef.id}@${item.templateRevisionRef.revision}`));
419
978
  if (duplicateTemplate)
420
- context.addIssue({ code: 'custom', path: ['createTemplates'], message: `Duplicate create template ${duplicateTemplate}.` });
979
+ context.addIssue({
980
+ code: 'custom',
981
+ path: ['createTemplates'],
982
+ message: `Duplicate create template ${duplicateTemplate}.`,
983
+ });
984
+ const duplicateMigrationSource = duplicates(value.createTemplates.flatMap((item) => (item.legacyMigrationSourcePageIds ?? []).flatMap((pageId) => item.supportedSurfaces.map((surface) => `${surface}:${pageId}`))));
985
+ if (duplicateMigrationSource)
986
+ context.addIssue({
987
+ code: 'custom',
988
+ path: ['createTemplates'],
989
+ message: `Duplicate legacy Page migration source ${duplicateMigrationSource}.`,
990
+ });
421
991
  const duplicateRouteSpace = duplicates(value.routeSpaces.map((item) => `${item.routeSpaceRevisionRef.id}@${item.routeSpaceRevisionRef.revision}`));
422
992
  if (duplicateRouteSpace)
423
- context.addIssue({ code: 'custom', path: ['routeSpaces'], message: `Duplicate route space ${duplicateRouteSpace}.` });
993
+ context.addIssue({
994
+ code: 'custom',
995
+ path: ['routeSpaces'],
996
+ message: `Duplicate route space ${duplicateRouteSpace}.`,
997
+ });
424
998
  const duplicateResource = duplicates(value.resourceRegistrations.map((item) => `${item.resourceRevisionRef.kind}:${item.resourceRevisionRef.id}@${item.resourceRevisionRef.revision}`));
425
999
  if (duplicateResource)
426
- context.addIssue({ code: 'custom', path: ['resourceRegistrations'], message: `Duplicate product resource ${duplicateResource}.` });
1000
+ context.addIssue({
1001
+ code: 'custom',
1002
+ path: ['resourceRegistrations'],
1003
+ message: `Duplicate product resource ${duplicateResource}.`,
1004
+ });
1005
+ const duplicateQueryDefinition = duplicates(value.domainQueryDefinitions.map((item) => `${item.definitionRevisionRef.id}@${item.definitionRevisionRef.revision}`));
1006
+ if (duplicateQueryDefinition)
1007
+ context.addIssue({
1008
+ code: 'custom',
1009
+ path: ['domainQueryDefinitions'],
1010
+ message: `Duplicate Domain Query definition ${duplicateQueryDefinition}.`,
1011
+ });
1012
+ const duplicateCommandDefinition = duplicates(value.domainCommandDefinitions.map((item) => `${item.definitionRevisionRef.id}@${item.definitionRevisionRef.revision}`));
1013
+ if (duplicateCommandDefinition)
1014
+ context.addIssue({
1015
+ code: 'custom',
1016
+ path: ['domainCommandDefinitions'],
1017
+ message: `Duplicate Domain Command definition ${duplicateCommandDefinition}.`,
1018
+ });
1019
+ const duplicateSchemaDefinition = duplicates(value.schemaDefinitions.map((item) => `${item.definitionRevisionRef.id}@${item.definitionRevisionRef.revision}`));
1020
+ if (duplicateSchemaDefinition)
1021
+ context.addIssue({
1022
+ code: 'custom',
1023
+ path: ['schemaDefinitions'],
1024
+ message: `Duplicate Schema definition ${duplicateSchemaDefinition}.`,
1025
+ });
1026
+ const duplicateCapabilityRegistration = duplicates(value.capabilityRegistrations.map((item) => `${item.declarativeRegistration.capabilityRevisionRef.id}@${item.declarativeRegistration.capabilityRevisionRef.revision}`));
1027
+ if (duplicateCapabilityRegistration)
1028
+ context.addIssue({
1029
+ code: 'custom',
1030
+ path: ['capabilityRegistrations'],
1031
+ message: `Duplicate product capability registration ${duplicateCapabilityRegistration}.`,
1032
+ });
427
1033
  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];
1034
+ const expectedKind = {
1035
+ management: 'access-policy',
1036
+ access: 'access-policy',
1037
+ layout: 'layout-policy',
1038
+ performance: 'performance-budget',
1039
+ observability: 'observation-policy',
1040
+ tokens: 'design-token',
1041
+ environment: 'environment',
1042
+ }[selection.role];
429
1043
  if (selection.resourceRevisionRef.kind !== expectedKind) {
430
- context.addIssue({ code: 'custom', path: ['defaultPolicies', index, 'resourceRevisionRef', 'kind'], message: `Default ${selection.role} selection must reference ${expectedKind}.` });
1044
+ context.addIssue({
1045
+ code: 'custom',
1046
+ path: ['defaultPolicies', index, 'resourceRevisionRef', 'kind'],
1047
+ message: `Default ${selection.role} selection must reference ${expectedKind}.`,
1048
+ });
431
1049
  }
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.' });
1050
+ if (!value.resourceRegistrations.some((registration) => registration.resourceRevisionRef.kind === selection.resourceRevisionRef.kind &&
1051
+ registration.resourceRevisionRef.id === selection.resourceRevisionRef.id &&
1052
+ registration.resourceRevisionRef.revision === selection.resourceRevisionRef.revision &&
1053
+ registration.resourceRevisionRef.contentHash === selection.resourceRevisionRef.contentHash)) {
1054
+ context.addIssue({
1055
+ code: 'custom',
1056
+ path: ['defaultPolicies', index, 'resourceRevisionRef'],
1057
+ message: 'Default policy must select an exact registered product resource.',
1058
+ });
434
1059
  }
435
1060
  });
436
1061
  });
@@ -453,7 +1078,11 @@ exports.DeclarativeBindingAuthoringChoiceSchema = exports.DeclarativeAuthoringCh
453
1078
  })
454
1079
  .strict(),
455
1080
  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) })
1081
+ .object({
1082
+ allowed: zod_1.z.boolean(),
1083
+ missingPermissionCodes: zod_1.z.array(common_1.ContractIdentifierSchema),
1084
+ issueCodes: zod_1.z.array(common_1.ContractIdentifierSchema),
1085
+ })
457
1086
  .strict(),
458
1087
  }).strict();
459
1088
  exports.DeclarativeWorkbenchTargetChoiceSchema = zod_1.z
@@ -471,14 +1100,27 @@ exports.DeclarativeWorkbenchTargetChoiceSchema = zod_1.z
471
1100
  })
472
1101
  .strict()
473
1102
  .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.' });
1103
+ if (value.targetRevisionRef.id !== value.stableTargetRef.id ||
1104
+ value.targetRevisionRef.kind !== value.stableTargetRef.kind) {
1105
+ context.addIssue({
1106
+ code: 'custom',
1107
+ path: ['targetRevisionRef'],
1108
+ message: 'Workbench target identity and exact revision must match.',
1109
+ });
476
1110
  }
477
1111
  if (value.providerRevisionRef.kind !== 'view-provider') {
478
- context.addIssue({ code: 'custom', path: ['providerRevisionRef', 'kind'], message: 'Workbench targets require an exact view-provider revision.' });
1112
+ context.addIssue({
1113
+ code: 'custom',
1114
+ path: ['providerRevisionRef', 'kind'],
1115
+ message: 'Workbench targets require an exact view-provider revision.',
1116
+ });
479
1117
  }
480
1118
  if (value.inputSchemaRevisionRef.kind !== 'schema') {
481
- context.addIssue({ code: 'custom', path: ['inputSchemaRevisionRef', 'kind'], message: 'Workbench targets require an exact input schema revision.' });
1119
+ context.addIssue({
1120
+ code: 'custom',
1121
+ path: ['inputSchemaRevisionRef', 'kind'],
1122
+ message: 'Workbench targets require an exact input schema revision.',
1123
+ });
482
1124
  }
483
1125
  });
484
1126
  exports.DeclarativeCreateIntentSchema = zod_1.z
@@ -486,7 +1128,13 @@ exports.DeclarativeCreateIntentSchema = zod_1.z
486
1128
  resourceId: common_1.ContractIdentifierSchema,
487
1129
  templateRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
488
1130
  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(),
1131
+ identity: zod_1.z
1132
+ .object({
1133
+ name: declarative_control_1.I18nTextSchema,
1134
+ description: declarative_control_1.I18nTextSchema.optional(),
1135
+ tags: zod_1.z.array(common_1.ContractIdentifierSchema).default([]),
1136
+ })
1137
+ .strict(),
490
1138
  surface: declarative_control_1.ProductSurfaceSchema,
491
1139
  pathTemplate: zod_1.z.string().trim().min(1).optional(),
492
1140
  placement: common_1.ContractIdentifierSchema.optional(),
@@ -495,7 +1143,11 @@ exports.DeclarativeCreateIntentSchema = zod_1.z
495
1143
  .strict()
496
1144
  .superRefine((value, context) => {
497
1145
  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.' });
1146
+ context.addIssue({
1147
+ code: 'custom',
1148
+ path: ['templateRevisionRef'],
1149
+ message: 'Create intent requires exactly one governed template or source revision.',
1150
+ });
499
1151
  }
500
1152
  });
501
1153
  exports.DeclarativeDocumentSchema = zod_1.z.union([declarative_control_1.PageSchema, declarative_control_1.NavigationSchema, declarative_control_1.WorkbenchSchema]);
@@ -519,6 +1171,7 @@ exports.DeclarativePreparedReleaseTargetSchema = zod_1.z
519
1171
  environmentRevisionRef: declarative_control_1.RevisionRefSchema,
520
1172
  surface: declarative_control_1.ProductSurfaceSchema,
521
1173
  routeClaimIndex: zod_1.z.number().int().nonnegative().optional(),
1174
+ legacyRouteTakeoverAuthorization: declarative_control_1.LegacyRouteTakeoverAuthorizationSchema.optional(),
522
1175
  placement: common_1.ContractIdentifierSchema.optional(),
523
1176
  order: zod_1.z.number().int().optional(),
524
1177
  isDefaultCandidate: zod_1.z.boolean().optional(),
@@ -530,6 +1183,82 @@ exports.DeclarativeEnvironmentChoiceSchema = exports.DeclarativeAuthoringChoiceS
530
1183
  revisionRef: declarative_control_1.RevisionRefSchema,
531
1184
  registration: exports.DeclarativeProductResourceRegistrationSchema,
532
1185
  }).strict();
1186
+ exports.DeclarativeAuthoringPageInfoSchema = zod_1.z
1187
+ .object({
1188
+ hasMore: zod_1.z.boolean(),
1189
+ nextPageToken: zod_1.z.string().trim().min(1).max(2048).optional(),
1190
+ pageSize: zod_1.z.number().int().min(1).max(200),
1191
+ returned: zod_1.z.number().int().nonnegative(),
1192
+ total: zod_1.z.number().int().nonnegative().optional(),
1193
+ })
1194
+ .strict()
1195
+ .superRefine((value, context) => {
1196
+ if (value.returned > value.pageSize)
1197
+ context.addIssue({
1198
+ code: 'custom',
1199
+ path: ['returned'],
1200
+ message: 'Returned items cannot exceed pageSize.',
1201
+ });
1202
+ if (value.hasMore !== Boolean(value.nextPageToken))
1203
+ context.addIssue({
1204
+ code: 'custom',
1205
+ path: ['nextPageToken'],
1206
+ message: 'hasMore and nextPageToken must agree.',
1207
+ });
1208
+ });
1209
+ exports.DeclarativeAuthoringChoiceKindSchema = zod_1.z.enum([
1210
+ 'capability',
1211
+ 'ontology',
1212
+ 'view',
1213
+ 'action',
1214
+ 'access',
1215
+ 'published-target',
1216
+ 'workbench-target',
1217
+ ]);
1218
+ const authoringChoicePage = (choiceKind, itemSchema) => zod_1.z
1219
+ .object({
1220
+ choiceKind: zod_1.z.literal(choiceKind),
1221
+ items: zod_1.z.array(itemSchema),
1222
+ pageInfo: exports.DeclarativeAuthoringPageInfoSchema,
1223
+ })
1224
+ .strict()
1225
+ .superRefine((value, context) => {
1226
+ if (value.pageInfo.returned !== value.items.length)
1227
+ context.addIssue({
1228
+ code: 'custom',
1229
+ path: ['pageInfo', 'returned'],
1230
+ message: 'PageInfo returned must match choice item count.',
1231
+ });
1232
+ });
1233
+ exports.DeclarativeAuthoringChoicePageSchema = zod_1.z.discriminatedUnion('choiceKind', [
1234
+ authoringChoicePage('capability', exports.DeclarativeCapabilityAuthoringChoiceSchema),
1235
+ authoringChoicePage('ontology', exports.DeclarativeBindingAuthoringChoiceSchema),
1236
+ authoringChoicePage('view', exports.DeclarativeBindingAuthoringChoiceSchema),
1237
+ authoringChoicePage('action', exports.DeclarativeBindingAuthoringChoiceSchema),
1238
+ authoringChoicePage('access', exports.DeclarativeAuthoringChoiceSchema),
1239
+ authoringChoicePage('published-target', exports.DeclarativeAuthoringChoiceSchema),
1240
+ authoringChoicePage('workbench-target', exports.DeclarativeWorkbenchTargetChoiceSchema),
1241
+ ]);
1242
+ exports.DeclarativeAuthoringResourcePageQuerySchema = zod_1.z
1243
+ .object({
1244
+ resourceKind: exports.DeclarativeResourceKindSchema.optional(),
1245
+ resourceId: common_1.ContractIdentifierSchema.optional(),
1246
+ surface: declarative_control_1.ProductSurfaceSchema.optional(),
1247
+ placement: common_1.ContractIdentifierSchema.optional(),
1248
+ search: zod_1.z.string().trim().min(1).max(256).optional(),
1249
+ pageSize: zod_1.z.number().int().min(1).max(200).default(60),
1250
+ pageToken: zod_1.z.string().trim().min(1).max(2048).optional(),
1251
+ })
1252
+ .strict();
1253
+ exports.DeclarativeAuthoringChoicePageQuerySchema = zod_1.z
1254
+ .object({
1255
+ choiceKind: exports.DeclarativeAuthoringChoiceKindSchema,
1256
+ surface: declarative_control_1.ProductSurfaceSchema.optional(),
1257
+ search: zod_1.z.string().trim().min(1).max(256).optional(),
1258
+ pageSize: zod_1.z.number().int().min(1).max(200).default(60),
1259
+ pageToken: zod_1.z.string().trim().min(1).max(2048).optional(),
1260
+ })
1261
+ .strict();
533
1262
  const DeclarativePageDocumentSummarySchema = zod_1.z
534
1263
  .object({
535
1264
  resourceKind: zod_1.z.literal('page'),
@@ -559,7 +1288,13 @@ const DeclarativeWorkbenchDocumentSummarySchema = zod_1.z
559
1288
  purpose: zod_1.z.enum(['instance', 'template']),
560
1289
  supportedSurfaces: zod_1.z.array(declarative_control_1.ProductSurfaceSchema).min(1),
561
1290
  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(),
1291
+ layout: zod_1.z
1292
+ .object({
1293
+ hostCapabilityRevisionRef: declarative_control_1.RevisionRefSchema,
1294
+ hostProviderRevisionRef: declarative_control_1.RevisionRefSchema,
1295
+ layoutPolicyRevisionRef: declarative_control_1.RevisionRefSchema,
1296
+ })
1297
+ .strict(),
563
1298
  instanceCount: zod_1.z.number().int().nonnegative(),
564
1299
  lifecycle: zod_1.z.enum(['active', 'deprecated', 'retired']),
565
1300
  accessPolicy: declarative_control_1.AccessPolicySchema,
@@ -571,6 +1306,17 @@ exports.DeclarativeDocumentSummarySchema = zod_1.z.discriminatedUnion('resourceK
571
1306
  DeclarativeNavigationDocumentSummarySchema,
572
1307
  DeclarativeWorkbenchDocumentSummarySchema,
573
1308
  ]);
1309
+ const declarativeReferenceTenantScopeKey = (scope) => JSON.stringify(scope);
1310
+ const DeclarativeDefinitionKindByResourceKind = {
1311
+ page: 'page',
1312
+ navigation: 'navigation',
1313
+ workbench: 'workbench',
1314
+ };
1315
+ const DeclarativeReleaseKindByResourceKind = {
1316
+ page: 'page-release',
1317
+ navigation: 'navigation-release',
1318
+ workbench: 'workbench-release',
1319
+ };
574
1320
  exports.DeclarativeAuthoringResourceSummarySchema = zod_1.z
575
1321
  .object({
576
1322
  resourceKind: exports.DeclarativeResourceKindSchema,
@@ -584,17 +1330,90 @@ exports.DeclarativeAuthoringResourceSummarySchema = zod_1.z
584
1330
  updatedAt: zod_1.z.string().datetime(),
585
1331
  actorRef: declarative_control_1.StableRefSchema,
586
1332
  preparedTargets: zod_1.z.array(exports.DeclarativePreparedReleaseTargetSchema),
587
- releasePlacements: zod_1.z.array(zod_1.z.object({
1333
+ releasePlacements: zod_1.z.array(zod_1.z
1334
+ .object({
588
1335
  releaseRevisionRef: declarative_control_1.RevisionRefSchema,
1336
+ definitionRevisionRef: declarative_control_1.RevisionRefSchema,
589
1337
  environmentRef: declarative_control_1.StableRefSchema,
590
1338
  surface: declarative_control_1.ProductSurfaceSchema,
591
1339
  routePath: zod_1.z.string().optional(),
592
1340
  placement: common_1.ContractIdentifierSchema.optional(),
593
1341
  order: zod_1.z.number().int().optional(),
594
1342
  isDefaultCandidate: zod_1.z.boolean().optional(),
595
- }).strict()),
1343
+ })
1344
+ .strict()),
596
1345
  })
597
- .strict();
1346
+ .strict()
1347
+ .superRefine((value, context) => {
1348
+ const expectedDefinitionKind = DeclarativeDefinitionKindByResourceKind[value.resourceKind];
1349
+ const expectedReleaseKind = DeclarativeReleaseKindByResourceKind[value.resourceKind];
1350
+ const expectedTenantScope = declarativeReferenceTenantScopeKey(value.tenantScope);
1351
+ const seenReleaseRefs = new Set();
1352
+ value.releasePlacements.forEach((placement, index) => {
1353
+ const releasePath = ['releasePlacements', index, 'releaseRevisionRef'];
1354
+ const definitionPath = ['releasePlacements', index, 'definitionRevisionRef'];
1355
+ if (placement.releaseRevisionRef.kind !== expectedReleaseKind) {
1356
+ context.addIssue({
1357
+ code: 'custom',
1358
+ path: [...releasePath, 'kind'],
1359
+ message: `Release placement must reference ${expectedReleaseKind}.`,
1360
+ });
1361
+ }
1362
+ if (placement.releaseRevisionRef.visibility !== 'tenant' ||
1363
+ declarativeReferenceTenantScopeKey(placement.releaseRevisionRef.tenantScope) !== expectedTenantScope) {
1364
+ context.addIssue({
1365
+ code: 'custom',
1366
+ path: [...releasePath, 'tenantScope'],
1367
+ message: 'Release placement must use the resource tenant scope.',
1368
+ });
1369
+ }
1370
+ const releaseIdentity = `${placement.releaseRevisionRef.kind}:${placement.releaseRevisionRef.id}:${placement.releaseRevisionRef.revision}`;
1371
+ if (seenReleaseRefs.has(releaseIdentity)) {
1372
+ context.addIssue({
1373
+ code: 'custom',
1374
+ path: [...releasePath],
1375
+ message: 'Release placements must not repeat an exact release revision.',
1376
+ });
1377
+ }
1378
+ seenReleaseRefs.add(releaseIdentity);
1379
+ if (placement.definitionRevisionRef.kind !== expectedDefinitionKind) {
1380
+ context.addIssue({
1381
+ code: 'custom',
1382
+ path: [...definitionPath, 'kind'],
1383
+ message: `Release placement definition must reference ${expectedDefinitionKind}.`,
1384
+ });
1385
+ }
1386
+ if (placement.definitionRevisionRef.id !== value.resourceId) {
1387
+ context.addIssue({
1388
+ code: 'custom',
1389
+ path: [...definitionPath, 'id'],
1390
+ message: 'Release placement definition must reference the summary resource.',
1391
+ });
1392
+ }
1393
+ if (placement.definitionRevisionRef.visibility !== 'tenant' ||
1394
+ declarativeReferenceTenantScopeKey(placement.definitionRevisionRef.tenantScope) !== expectedTenantScope) {
1395
+ context.addIssue({
1396
+ code: 'custom',
1397
+ path: [...definitionPath, 'tenantScope'],
1398
+ message: 'Release placement definition must use the resource tenant scope.',
1399
+ });
1400
+ }
1401
+ });
1402
+ });
1403
+ exports.DeclarativeAuthoringResourcePageSchema = zod_1.z
1404
+ .object({
1405
+ items: zod_1.z.array(exports.DeclarativeAuthoringResourceSummarySchema),
1406
+ pageInfo: exports.DeclarativeAuthoringPageInfoSchema,
1407
+ })
1408
+ .strict()
1409
+ .superRefine((value, context) => {
1410
+ if (value.pageInfo.returned !== value.items.length)
1411
+ context.addIssue({
1412
+ code: 'custom',
1413
+ path: ['pageInfo', 'returned'],
1414
+ message: 'PageInfo returned must match resource item count.',
1415
+ });
1416
+ });
598
1417
  exports.DeclarativeAuthoringHistoryEntrySchema = zod_1.z
599
1418
  .object({
600
1419
  revisionRef: declarative_control_1.RevisionRefSchema,
@@ -609,7 +1428,10 @@ exports.DeclarativeAuthoringHistoryEntrySchema = zod_1.z
609
1428
  })
610
1429
  .strict();
611
1430
  exports.DeclarativeAuthoringHistorySchema = zod_1.z
612
- .object({ items: zod_1.z.array(exports.DeclarativeAuthoringHistoryEntrySchema), nextBeforeVersion: zod_1.z.number().int().positive().optional() })
1431
+ .object({
1432
+ items: zod_1.z.array(exports.DeclarativeAuthoringHistoryEntrySchema),
1433
+ nextBeforeVersion: zod_1.z.number().int().positive().optional(),
1434
+ })
613
1435
  .strict();
614
1436
  const DeclarativeRuntimeDiagnosticSchema = zod_1.z
615
1437
  .object({
@@ -658,18 +1480,215 @@ exports.DeclarativePublicationItemResultSchema = zod_1.z
658
1480
  resourceId: common_1.ContractIdentifierSchema,
659
1481
  releaseRevisionRef: declarative_control_1.RevisionRefSchema,
660
1482
  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]),
1483
+ bundle: zod_1.z.union([declarative_control_1.PageRuntimeBundleSchema, declarative_control_1.NavigationRuntimeBundleSchema, declarative_control_1.WorkbenchRuntimeBundleSchema]).optional(),
662
1484
  })
663
- .strict();
664
- exports.DeclarativePublicationResultSchema = zod_1.z
1485
+ .strict()
1486
+ .superRefine((value, context) => {
1487
+ const expectedReleaseKind = {
1488
+ page: 'page-release',
1489
+ navigation: 'navigation-release',
1490
+ workbench: 'workbench-release',
1491
+ }[value.resourceKind];
1492
+ const expectedReleaseContract = {
1493
+ page: 'PageRelease',
1494
+ navigation: 'NavigationRelease',
1495
+ workbench: 'WorkbenchRelease',
1496
+ }[value.resourceKind];
1497
+ const expectedBundleContract = {
1498
+ page: 'PageRuntimeBundle',
1499
+ navigation: 'NavigationRuntimeBundle',
1500
+ workbench: 'WorkbenchRuntimeBundle',
1501
+ }[value.resourceKind];
1502
+ if (value.releaseRevisionRef.kind !== expectedReleaseKind ||
1503
+ value.releaseRevisionRef.id !== value.release.releaseSlotId ||
1504
+ value.release.contract !== expectedReleaseContract) {
1505
+ context.addIssue({
1506
+ code: 'custom',
1507
+ path: ['releaseRevisionRef'],
1508
+ message: 'A publication item must return the exact release identity for its resource kind.',
1509
+ });
1510
+ }
1511
+ const definitionRef = value.release.contract === 'PageRelease'
1512
+ ? value.release.pageRevisionRef
1513
+ : value.release.contract === 'NavigationRelease'
1514
+ ? value.release.navigationRevisionRef
1515
+ : value.release.workbenchRevisionRef;
1516
+ if (definitionRef.id !== value.resourceId) {
1517
+ context.addIssue({
1518
+ code: 'custom',
1519
+ path: ['resourceId'],
1520
+ message: 'A publication item release must identify the requested resource.',
1521
+ });
1522
+ }
1523
+ const unavailable = value.release.operation === 'deactivate' || Boolean(value.release.legacyRestoration);
1524
+ if (unavailable === Boolean(value.bundle)) {
1525
+ context.addIssue({
1526
+ code: 'custom',
1527
+ path: ['bundle'],
1528
+ message: unavailable
1529
+ ? 'A deactivated or legacy-restored Release cannot publish an active Runtime Bundle.'
1530
+ : 'An active declarative Release must publish its Runtime Bundle.',
1531
+ });
1532
+ }
1533
+ if (value.bundle) {
1534
+ const bundleDefinitionRef = value.bundle.contract === 'PageRuntimeBundle'
1535
+ ? value.bundle.pageRevisionRef
1536
+ : value.bundle.contract === 'NavigationRuntimeBundle'
1537
+ ? value.bundle.navigationRevisionRef
1538
+ : value.bundle.workbenchRevisionRef;
1539
+ const sameRevision = (left, right) => left.kind === right.kind &&
1540
+ left.id === right.id &&
1541
+ left.ownerRepo === right.ownerRepo &&
1542
+ left.revision === right.revision &&
1543
+ left.schemaVersion === right.schemaVersion &&
1544
+ left.contentHash === right.contentHash;
1545
+ if (value.bundle.contract !== expectedBundleContract ||
1546
+ !sameRevision(value.bundle.releaseRevisionRef, value.releaseRevisionRef) ||
1547
+ !sameRevision(bundleDefinitionRef, definitionRef)) {
1548
+ context.addIssue({
1549
+ code: 'custom',
1550
+ path: ['bundle'],
1551
+ message: 'A publication item Runtime Bundle must pin the exact returned Release and definition revisions.',
1552
+ });
1553
+ }
1554
+ }
1555
+ });
1556
+ const DeclarativeDirectPublicationResultSchema = zod_1.z
1557
+ .object({
1558
+ action: zod_1.z.enum(['publish', 'rollback']),
1559
+ generation: zod_1.z.number().int().nonnegative(),
1560
+ items: zod_1.z.array(exports.DeclarativePublicationItemResultSchema).min(1),
1561
+ etag: zod_1.z.string().trim().min(1),
1562
+ })
1563
+ .strict()
1564
+ .superRefine((value, context) => {
1565
+ const expectedOperation = value.action === 'publish' ? 'activate' : 'rollback';
1566
+ value.items.forEach((item, index) => {
1567
+ if (item.release.operation !== expectedOperation) {
1568
+ context.addIssue({
1569
+ code: 'custom',
1570
+ path: ['items', index, 'release', 'operation'],
1571
+ message: 'A direct publication result must match its requested action.',
1572
+ });
1573
+ }
1574
+ });
1575
+ });
1576
+ const DeclarativeAtomicPublicationPlanResultSchema = zod_1.z
665
1577
  .object({
666
- action: zod_1.z.enum(['publish', 'rollback', 'publication-plan']),
1578
+ action: zod_1.z.literal('publication-plan'),
667
1579
  generation: zod_1.z.number().int().nonnegative(),
668
- publicationPlanRevisionRef: declarative_control_1.RevisionRefSchema.optional(),
1580
+ publicationPlanRevisionRef: declarative_control_1.RevisionRefSchema,
669
1581
  items: zod_1.z.array(exports.DeclarativePublicationItemResultSchema).min(1),
670
1582
  etag: zod_1.z.string().trim().min(1),
1583
+ })
1584
+ .strict()
1585
+ .superRefine((value, context) => {
1586
+ if (value.publicationPlanRevisionRef.kind !== 'publication-plan') {
1587
+ context.addIssue({
1588
+ code: 'custom',
1589
+ path: ['publicationPlanRevisionRef', 'kind'],
1590
+ message: 'An atomic publication result must pin its Publication Plan revision.',
1591
+ });
1592
+ }
1593
+ });
1594
+ exports.DeclarativePublicationResultSchema = zod_1.z.union([
1595
+ DeclarativeDirectPublicationResultSchema,
1596
+ DeclarativeAtomicPublicationPlanResultSchema,
1597
+ ]);
1598
+ exports.DeclarativeMigrationDiffEntrySchema = zod_1.z
1599
+ .object({
1600
+ path: zod_1.z.string().trim().startsWith('/').max(1024),
1601
+ status: zod_1.z.enum(['added', 'changed', 'removed', 'unchanged']),
1602
+ legacyValueHash: common_1.Sha256Schema.optional(),
1603
+ declarativeValueHash: common_1.Sha256Schema.optional(),
1604
+ })
1605
+ .strict();
1606
+ exports.DeclarativeMigrationBlockerSchema = zod_1.z
1607
+ .object({
1608
+ code: common_1.ContractIdentifierSchema,
1609
+ path: zod_1.z.string().trim().max(1024).optional(),
1610
+ message: zod_1.z.string().trim().min(1).max(4096),
1611
+ })
1612
+ .strict();
1613
+ /**
1614
+ * Immutable result of inspecting one predeclared legacy source. The fingerprint
1615
+ * binds the source, target, diff, blockers and exact route-takeover authority;
1616
+ * draft creation must re-read the source and reject any mismatch.
1617
+ */
1618
+ exports.DeclarativeLegacyMigrationInspectionSchema = zod_1.z
1619
+ .object({
1620
+ contract: zod_1.z.literal('DeclarativeLegacyMigrationInspection'),
1621
+ schemaVersion: zod_1.z.literal(1),
1622
+ migrationKind: exports.DeclarativeLegacyMigrationKindSchema,
1623
+ legacyResourceId: common_1.ContractIdentifierSchema,
1624
+ sourceRevisionRef: declarative_control_1.RevisionRefSchema,
1625
+ sourceContentHash: common_1.Sha256Schema,
1626
+ legacyAdapterRevisionRef: declarative_control_1.RevisionRefSchema,
1627
+ targetResourceRef: declarative_control_1.StableRefSchema,
1628
+ environmentRevisionRef: declarative_control_1.RevisionRefSchema,
1629
+ routeSpaceRevisionRef: declarative_control_1.RevisionRefSchema,
1630
+ normalizedPath: zod_1.z.string().trim().startsWith('/').max(2048),
1631
+ takeoverAuthorization: declarative_control_1.LegacyRouteTakeoverAuthorizationSchema,
1632
+ diff: zod_1.z.array(exports.DeclarativeMigrationDiffEntrySchema).max(256),
1633
+ blockers: zod_1.z.array(exports.DeclarativeMigrationBlockerSchema).max(128),
1634
+ canCreateDraft: zod_1.z.boolean(),
1635
+ inspectionFingerprint: common_1.Sha256Schema,
1636
+ })
1637
+ .strict()
1638
+ .superRefine((value, context) => {
1639
+ const expectedKind = value.migrationKind === 'workbench' ? 'workbench' : 'page';
1640
+ if (value.targetResourceRef.kind !== expectedKind) {
1641
+ context.addIssue({
1642
+ code: 'custom',
1643
+ path: ['targetResourceRef', 'kind'],
1644
+ message: `A ${value.migrationKind} migration must target ${expectedKind}.`,
1645
+ });
1646
+ }
1647
+ if (value.takeoverAuthorization.inspectedSourceContentHash !== value.sourceContentHash ||
1648
+ value.takeoverAuthorization.normalizedPath !== value.normalizedPath ||
1649
+ value.takeoverAuthorization.targetResourceRef.kind !== value.targetResourceRef.kind ||
1650
+ value.takeoverAuthorization.targetResourceRef.id !== value.targetResourceRef.id ||
1651
+ value.takeoverAuthorization.targetResourceRef.ownerRepo !== value.targetResourceRef.ownerRepo) {
1652
+ context.addIssue({
1653
+ code: 'custom',
1654
+ path: ['takeoverAuthorization'],
1655
+ message: 'The takeover authority must bind the exact inspected source, path and target.',
1656
+ });
1657
+ }
1658
+ if (value.canCreateDraft !== (value.blockers.length === 0)) {
1659
+ context.addIssue({
1660
+ code: 'custom',
1661
+ path: ['canCreateDraft'],
1662
+ message: 'Draft creation is allowed exactly when inspection has no blockers.',
1663
+ });
1664
+ }
1665
+ });
1666
+ exports.DeclarativeLegacyMigrationCreateDraftIntentSchema = zod_1.z
1667
+ .object({
1668
+ inspectionFingerprint: common_1.Sha256Schema,
1669
+ expectedSourceRevisionRef: declarative_control_1.RevisionRefSchema,
1670
+ expectedSourceContentHash: common_1.Sha256Schema,
1671
+ idempotencyKey: zod_1.z.string().trim().min(1).max(256),
1672
+ })
1673
+ .strict();
1674
+ exports.DeclarativeLegacyMigrationCreateDraftResultSchema = zod_1.z
1675
+ .object({
1676
+ migrationKind: exports.DeclarativeLegacyMigrationKindSchema,
1677
+ legacyResourceId: common_1.ContractIdentifierSchema,
1678
+ inspectionFingerprint: common_1.Sha256Schema,
1679
+ sourceRevisionRef: declarative_control_1.RevisionRefSchema,
1680
+ sourceContentHash: common_1.Sha256Schema,
1681
+ takeoverAuthorization: declarative_control_1.LegacyRouteTakeoverAuthorizationSchema,
1682
+ draft: exports.DeclarativeDraftResultSchema,
671
1683
  })
672
1684
  .strict();
1685
+ exports.DECLARATIVE_MIGRATION_ERROR_CODES = {
1686
+ sourceChanged: 'DECLARATIVE_LEGACY_SOURCE_CHANGED',
1687
+ reservedTakeoverForbidden: 'DECLARATIVE_RESERVED_ROUTE_TAKEOVER_FORBIDDEN',
1688
+ takeoverScopeInvalid: 'DECLARATIVE_ROUTE_TAKEOVER_SCOPE_INVALID',
1689
+ workbenchDefaultConflict: 'DECLARATIVE_WORKBENCH_DEFAULT_CONFLICT',
1690
+ legacyWriteBlocked: 'DECLARATIVE_LEGACY_WRITE_BLOCKED',
1691
+ };
673
1692
  exports.DeclarativeRetireResultSchema = zod_1.z
674
1693
  .object({
675
1694
  action: zod_1.z.literal('retire'),
@@ -682,7 +1701,7 @@ exports.DeclarativeRetireResultSchema = zod_1.z
682
1701
  reason: zod_1.z.string().trim().min(1).max(4096),
683
1702
  })
684
1703
  .strict();
685
- exports.DeclarativeAuthoringCommandResultSchema = zod_1.z.discriminatedUnion('action', [
1704
+ exports.DeclarativeAuthoringCommandResultSchema = zod_1.z.union([
686
1705
  exports.DeclarativeDraftResultSchema,
687
1706
  exports.DeclarativeValidationResultSchema,
688
1707
  exports.DeclarativePreviewResultSchema,
@@ -715,10 +1734,18 @@ exports.DeclarativeNavigationSeedMigrationResultSchema = zod_1.z
715
1734
  .strict()
716
1735
  .superRefine((value, context) => {
717
1736
  if (value.outcome === 'review-required' && (!value.requiresReview || !value.draftRevisionRef)) {
718
- context.addIssue({ code: 'custom', path: ['outcome'], message: 'Review-required migrations must expose their draft.' });
1737
+ context.addIssue({
1738
+ code: 'custom',
1739
+ path: ['outcome'],
1740
+ message: 'Review-required migrations must expose their draft.',
1741
+ });
719
1742
  }
720
1743
  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.' });
1744
+ context.addIssue({
1745
+ code: 'custom',
1746
+ path: ['activeReleaseRevisionRef'],
1747
+ message: 'Active migrations require an exact release revision.',
1748
+ });
722
1749
  }
723
1750
  });
724
1751
  exports.DeclarativeNavigationPlacementSchema = zod_1.z
@@ -752,27 +1779,161 @@ exports.DeclarativeAuthoringBootstrapSchema = zod_1.z
752
1779
  accessChoices: zod_1.z.array(exports.DeclarativeAuthoringChoiceSchema),
753
1780
  publishedTargets: zod_1.z.array(exports.DeclarativeAuthoringChoiceSchema),
754
1781
  workbenchTargets: zod_1.z.array(exports.DeclarativeWorkbenchTargetChoiceSchema),
1782
+ resourcesPageInfo: exports.DeclarativeAuthoringPageInfoSchema.optional(),
1783
+ deferredChoiceKinds: zod_1.z.array(exports.DeclarativeAuthoringChoiceKindSchema).optional(),
755
1784
  compilerRevisionRef: declarative_control_1.RevisionRefSchema,
756
1785
  generation: zod_1.z.number().int().nonnegative(),
757
1786
  contentHash: common_1.Sha256Schema,
758
1787
  })
759
1788
  .strict();
1789
+ exports.DeclarativeRuntimeRedirectSchema = zod_1.z
1790
+ .object({
1791
+ statusCode: zod_1.z.literal(302),
1792
+ source: zod_1.z
1793
+ .object({
1794
+ resourceKind: zod_1.z.enum(['page', 'workbench']),
1795
+ releaseSlotId: common_1.ContractIdentifierSchema,
1796
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
1797
+ routeClaim: declarative_control_1.CompiledRouteClaimSchema,
1798
+ })
1799
+ .strict(),
1800
+ target: zod_1.z
1801
+ .object({
1802
+ resourceKind: zod_1.z.enum(['page', 'workbench']),
1803
+ stableTargetRef: declarative_control_1.StableRefSchema,
1804
+ releaseSlotId: common_1.ContractIdentifierSchema,
1805
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
1806
+ normalizedPath: zod_1.z.string().trim().startsWith('/'),
1807
+ })
1808
+ .strict(),
1809
+ })
1810
+ .strict();
760
1811
  exports.DeclarativeRuntimeResolvedSchema = zod_1.z
761
1812
  .object({
762
1813
  surface: declarative_control_1.ProductSurfaceSchema,
763
1814
  normalizedPath: zod_1.z.string().trim().min(1),
1815
+ routeParameters: zod_1.z.record(common_1.ContractIdentifierSchema, zod_1.z.string()),
764
1816
  page: declarative_control_1.PageRuntimeBundleSchema.optional(),
765
1817
  workbench: declarative_control_1.WorkbenchRuntimeBundleSchema.optional(),
1818
+ redirect: exports.DeclarativeRuntimeRedirectSchema.optional(),
766
1819
  navigation: declarative_control_1.NavigationRuntimeBundleSchema.optional(),
767
- releaseSlotRefs: zod_1.z.array(zod_1.z.object({ resourceKind: exports.DeclarativeResourceKindSchema, releaseSlotId: common_1.ContractIdentifierSchema }).strict()),
1820
+ releaseSlotRefs: zod_1.z.array(zod_1.z
1821
+ .object({
1822
+ resourceKind: exports.DeclarativeResourceKindSchema,
1823
+ releaseSlotId: common_1.ContractIdentifierSchema,
1824
+ })
1825
+ .strict()),
1826
+ generation: zod_1.z.number().int().nonnegative(),
1827
+ contentHash: common_1.Sha256Schema,
1828
+ })
1829
+ .strict()
1830
+ .superRefine((value, context) => {
1831
+ const outcomes = [value.page, value.workbench, value.redirect].filter(Boolean).length;
1832
+ if (outcomes !== 1)
1833
+ context.addIssue({
1834
+ code: 'custom',
1835
+ path: ['page'],
1836
+ message: 'A resolved runtime must contain exactly one Page, Workbench, or governed redirect outcome.',
1837
+ });
1838
+ });
1839
+ const DeclarativeRuntimeSafeBaseShape = {
1840
+ surface: declarative_control_1.ProductSurfaceSchema,
1841
+ normalizedPath: zod_1.z.string().trim().startsWith('/').max(2048),
1842
+ routeParameters: zod_1.z
1843
+ .any()
1844
+ .superRefine(rejectRuntimePrototypeKeys)
1845
+ .pipe(zod_1.z.record(common_1.ContractIdentifierSchema, zod_1.z.string().max(2048)))
1846
+ .superRefine((parameters, context) => {
1847
+ if (Object.keys(parameters).length > 32) {
1848
+ context.addIssue({
1849
+ code: 'custom',
1850
+ path: [],
1851
+ message: 'A resolved route cannot expose more than 32 parameters.',
1852
+ });
1853
+ }
1854
+ }),
768
1855
  generation: zod_1.z.number().int().nonnegative(),
1856
+ etag: zod_1.z.string().trim().min(1),
769
1857
  contentHash: common_1.Sha256Schema,
1858
+ };
1859
+ const DeclarativeRuntimeLegacyOutcomeSchema = zod_1.z
1860
+ .object({
1861
+ outcome: zod_1.z.literal('legacy'),
1862
+ ...DeclarativeRuntimeSafeBaseShape,
1863
+ legacyAdapterRevisionRef: declarative_control_1.RevisionRefSchema,
770
1864
  })
771
1865
  .strict()
772
1866
  .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.' });
1867
+ if (value.legacyAdapterRevisionRef.kind !== 'legacy-route-adapter') {
1868
+ context.addIssue({
1869
+ code: 'custom',
1870
+ path: ['legacyAdapterRevisionRef', 'kind'],
1871
+ message: 'A legacy runtime outcome must pin a legacy-route-adapter revision.',
1872
+ });
1873
+ }
775
1874
  });
1875
+ const DeclarativeRuntimeAuthorizedOutcomeSchema = zod_1.z
1876
+ .object({
1877
+ outcome: zod_1.z.literal('declarative'),
1878
+ ...DeclarativeRuntimeSafeBaseShape,
1879
+ resolved: exports.DeclarativeRuntimeResolvedSchema,
1880
+ })
1881
+ .strict()
1882
+ .superRefine((value, context) => {
1883
+ if (value.resolved.surface !== value.surface || value.resolved.normalizedPath !== value.normalizedPath) {
1884
+ context.addIssue({
1885
+ code: 'custom',
1886
+ path: ['resolved'],
1887
+ message: 'An authorized declarative outcome must match its safe route envelope.',
1888
+ });
1889
+ }
1890
+ });
1891
+ const DeclarativeRuntimeDeniedOutcomeSchema = (outcome, code) => zod_1.z
1892
+ .object({
1893
+ outcome: zod_1.z.literal(outcome),
1894
+ ...DeclarativeRuntimeSafeBaseShape,
1895
+ code: zod_1.z.literal(code),
1896
+ })
1897
+ .strict();
1898
+ const DeclarativeRuntimeForbiddenOutcomeSchema = zod_1.z.discriminatedUnion('resourceKind', [
1899
+ zod_1.z
1900
+ .object({
1901
+ outcome: zod_1.z.literal('forbidden'),
1902
+ ...DeclarativeRuntimeSafeBaseShape,
1903
+ resourceKind: zod_1.z.literal('page'),
1904
+ code: zod_1.z.literal('DECLARATIVE_PAGE_FORBIDDEN'),
1905
+ presentation: declarative_control_1.PageRouteStatePresentationSchema.optional(),
1906
+ })
1907
+ .strict()
1908
+ .superRefine((value, context) => {
1909
+ if (value.presentation && value.presentation.surface !== value.surface) {
1910
+ context.addIssue({
1911
+ code: 'custom',
1912
+ path: ['presentation', 'surface'],
1913
+ message: 'A forbidden Page presentation must match the resolved route surface.',
1914
+ });
1915
+ }
1916
+ }),
1917
+ zod_1.z
1918
+ .object({
1919
+ outcome: zod_1.z.literal('forbidden'),
1920
+ ...DeclarativeRuntimeSafeBaseShape,
1921
+ resourceKind: zod_1.z.literal('workbench'),
1922
+ code: zod_1.z.literal('DECLARATIVE_WORKBENCH_FORBIDDEN'),
1923
+ })
1924
+ .strict(),
1925
+ ]);
1926
+ /**
1927
+ * Browser-facing route resolution. Denied/unavailable/not-found branches are
1928
+ * structurally unable to expose resource, Release-slot or revision metadata.
1929
+ */
1930
+ exports.DeclarativeRuntimeResolveResultSchema = zod_1.z.union([
1931
+ DeclarativeRuntimeLegacyOutcomeSchema,
1932
+ DeclarativeRuntimeAuthorizedOutcomeSchema,
1933
+ DeclarativeRuntimeForbiddenOutcomeSchema,
1934
+ DeclarativeRuntimeDeniedOutcomeSchema('unavailable', 'DECLARATIVE_ROUTE_UNAVAILABLE'),
1935
+ DeclarativeRuntimeDeniedOutcomeSchema('not-found', 'DECLARATIVE_ROUTE_NOT_FOUND'),
1936
+ ]);
776
1937
  exports.DeclarativeNavigationRuntimeBootstrapSchema = zod_1.z
777
1938
  .object({
778
1939
  placements: zod_1.z.array(zod_1.z
@@ -789,23 +1950,47 @@ exports.DeclarativeNavigationRuntimeBootstrapSchema = zod_1.z
789
1950
  .superRefine((value, context) => {
790
1951
  if (value.authority === 'legacy') {
791
1952
  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.' });
1953
+ context.addIssue({
1954
+ code: 'custom',
1955
+ path: ['authority'],
1956
+ message: 'Legacy navigation placements cannot expose declarative Release or Bundle state.',
1957
+ });
793
1958
  }
794
1959
  if (value.state !== 'active')
795
- context.addIssue({ code: 'custom', path: ['state'], message: 'Legacy navigation placements are active until an explicit declarative cutover.' });
1960
+ context.addIssue({
1961
+ code: 'custom',
1962
+ path: ['state'],
1963
+ message: 'Legacy navigation placements are active until an explicit declarative cutover.',
1964
+ });
796
1965
  return;
797
1966
  }
798
1967
  if (!value.releaseSlotId || !value.activeReleaseRevisionRef) {
799
- context.addIssue({ code: 'custom', path: ['releaseSlotId'], message: 'Declarative navigation placements require an exact active Release reference.' });
1968
+ context.addIssue({
1969
+ code: 'custom',
1970
+ path: ['releaseSlotId'],
1971
+ message: 'Declarative navigation placements require an exact active Release reference.',
1972
+ });
800
1973
  }
801
1974
  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.' });
1975
+ context.addIssue({
1976
+ code: 'custom',
1977
+ path: ['bundle'],
1978
+ message: 'An active declarative navigation placement requires its identity-filtered Runtime Bundle.',
1979
+ });
803
1980
  }
804
1981
  if (value.state === 'deactivated' && value.bundle) {
805
- context.addIssue({ code: 'custom', path: ['bundle'], message: 'A deactivated declarative navigation placement cannot expose a Runtime Bundle.' });
1982
+ context.addIssue({
1983
+ code: 'custom',
1984
+ path: ['bundle'],
1985
+ message: 'A deactivated declarative navigation placement cannot expose a Runtime Bundle.',
1986
+ });
806
1987
  }
807
1988
  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.' });
1989
+ context.addIssue({
1990
+ code: 'custom',
1991
+ path: ['bundle'],
1992
+ message: 'The Navigation Runtime Bundle must match its placement and surface.',
1993
+ });
809
1994
  }
810
1995
  })),
811
1996
  bundles: zod_1.z.array(declarative_control_1.NavigationRuntimeBundleSchema),
@@ -819,12 +2004,21 @@ exports.DeclarativeNavigationRuntimeBootstrapSchema = zod_1.z
819
2004
  .superRefine((value, context) => {
820
2005
  const active = value.placements.filter((entry) => entry.authority === 'declarative' && entry.state === 'active');
821
2006
  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.' });
2007
+ context.addIssue({
2008
+ code: 'custom',
2009
+ path: ['placements'],
2010
+ message: 'Compatibility bundle arrays must exactly project active declarative placements.',
2011
+ });
823
2012
  return;
824
2013
  }
825
2014
  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.' });
2015
+ if (entry.bundle?.contentHash !== value.bundles[index]?.contentHash ||
2016
+ entry.releaseSlotId !== value.releaseSlotIds[index]) {
2017
+ context.addIssue({
2018
+ code: 'custom',
2019
+ path: ['placements', index],
2020
+ message: 'Navigation placement and compatibility bundle order must match.',
2021
+ });
828
2022
  }
829
2023
  });
830
2024
  });
@@ -865,9 +2059,17 @@ exports.DeclarativeWorkbenchRuntimeBootstrapSchema = zod_1.z
865
2059
  .strict()
866
2060
  .superRefine((value, context) => {
867
2061
  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.' });
2062
+ context.addIssue({
2063
+ code: 'custom',
2064
+ path: ['visible'],
2065
+ message: 'Legacy workbenches are delivered by the compatibility API, not by declarative summaries.',
2066
+ });
869
2067
  if (value.state === 'deactivated' && value.visible)
870
- context.addIssue({ code: 'custom', path: ['visible'], message: 'Deactivated workbenches cannot be visible.' });
2068
+ context.addIssue({
2069
+ code: 'custom',
2070
+ path: ['visible'],
2071
+ message: 'Deactivated workbenches cannot be visible.',
2072
+ });
871
2073
  })),
872
2074
  legacySummaries: zod_1.z.array(exports.DeclarativeLegacyWorkbenchSummarySchema),
873
2075
  summaries: zod_1.z.array(exports.DeclarativeWorkbenchSummarySchema),
@@ -882,10 +2084,18 @@ exports.DeclarativeWorkbenchRuntimeBootstrapSchema = zod_1.z
882
2084
  .strict()
883
2085
  .superRefine((value, context) => {
884
2086
  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.' });
2087
+ context.addIssue({
2088
+ code: 'custom',
2089
+ path: ['releaseSlotId'],
2090
+ message: 'Declarative Workbench selection requires its exact Release slot and revision.',
2091
+ });
886
2092
  }
887
2093
  if (value.authority === 'legacy' && (value.releaseSlotId || value.activeReleaseRevisionRef)) {
888
- context.addIssue({ code: 'custom', path: ['releaseSlotId'], message: 'Legacy Workbench selection cannot expose declarative Release state.' });
2094
+ context.addIssue({
2095
+ code: 'custom',
2096
+ path: ['releaseSlotId'],
2097
+ message: 'Legacy Workbench selection cannot expose declarative Release state.',
2098
+ });
889
2099
  }
890
2100
  })
891
2101
  .nullable(),
@@ -906,8 +2116,20 @@ exports.DeclarativeNavigationImportResultSchema = zod_1.z
906
2116
  .object({
907
2117
  document: zod_1.z.unknown(),
908
2118
  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(),
2119
+ provenance: zod_1.z
2120
+ .object({
2121
+ sourceKey: zod_1.z.literal('server.ui.menus'),
2122
+ sourceRevisionRef: declarative_control_1.RevisionRefSchema,
2123
+ sourceContentHash: common_1.Sha256Schema,
2124
+ })
2125
+ .strict(),
2126
+ diff: zod_1.z
2127
+ .object({
2128
+ added: zod_1.z.array(common_1.ContractIdentifierSchema),
2129
+ removed: zod_1.z.array(common_1.ContractIdentifierSchema),
2130
+ changed: zod_1.z.array(common_1.ContractIdentifierSchema),
2131
+ })
2132
+ .strict(),
911
2133
  })
912
2134
  .strict();
913
2135
  exports.DeclarativeRuntimeResolveQuerySchema = zod_1.z
@@ -916,10 +2138,60 @@ exports.DeclarativeRuntimeResolveQuerySchema = zod_1.z
916
2138
  // Server resolves the single release-owned default for this surface.
917
2139
  environmentId: common_1.ContractIdentifierSchema.optional(),
918
2140
  surface: declarative_control_1.ProductSurfaceSchema,
919
- path: zod_1.z.string().trim().min(1),
2141
+ path: zod_1.z.string().trim().min(1).max(2048),
920
2142
  navigationPlacement: common_1.ContractIdentifierSchema.optional(),
921
2143
  })
922
2144
  .strict();
2145
+ exports.DeclarativeRuntimeRouteOwnerQuerySchema = zod_1.z
2146
+ .object({
2147
+ // This tenant-scoped lookup is only called after authentication and team
2148
+ // selection. Login, setup and other public boot routes stay owned by the
2149
+ // predeclared legacy router and must not call this API.
2150
+ environmentId: common_1.ContractIdentifierSchema.optional(),
2151
+ surface: declarative_control_1.ProductSurfaceSchema,
2152
+ path: zod_1.z.string().trim().min(1).max(2048),
2153
+ })
2154
+ .strict();
2155
+ const DeclarativeRuntimeRouteParametersSchema = zod_1.z
2156
+ .any()
2157
+ .superRefine(rejectRuntimePrototypeKeys)
2158
+ .pipe(zod_1.z.record(common_1.ContractIdentifierSchema, zod_1.z.string().max(2048)))
2159
+ .superRefine((parameters, context) => {
2160
+ const keys = Object.keys(parameters);
2161
+ if (keys.length > 32)
2162
+ context.addIssue({
2163
+ code: 'custom',
2164
+ path: [],
2165
+ message: 'A resolved route cannot expose more than 32 parameters.',
2166
+ });
2167
+ });
2168
+ const DeclarativeLegacyRouteOwnerSchema = zod_1.z
2169
+ .object({
2170
+ authority: zod_1.z.literal('legacy'),
2171
+ legacyAdapterRevisionRef: declarative_control_1.RevisionRefSchema,
2172
+ generation: zod_1.z.number().int().positive(),
2173
+ etag: zod_1.z.string().trim().min(1),
2174
+ })
2175
+ .strict();
2176
+ const DeclarativeReleaseRouteOwnerSchema = zod_1.z
2177
+ .object({
2178
+ authority: zod_1.z.literal('declarative'),
2179
+ resourceKind: zod_1.z.enum(['page', 'workbench']),
2180
+ releaseSlotId: common_1.ContractIdentifierSchema,
2181
+ activeReleaseRevisionRef: declarative_control_1.RevisionRefSchema,
2182
+ generation: zod_1.z.number().int().positive(),
2183
+ etag: zod_1.z.string().trim().min(1),
2184
+ })
2185
+ .strict();
2186
+ exports.DeclarativeRuntimeRouteOwnerSchema = zod_1.z
2187
+ .object({
2188
+ surface: declarative_control_1.ProductSurfaceSchema,
2189
+ normalizedPath: zod_1.z.string().trim().startsWith('/').max(2048),
2190
+ routeParameters: DeclarativeRuntimeRouteParametersSchema,
2191
+ owner: zod_1.z.discriminatedUnion('authority', [DeclarativeLegacyRouteOwnerSchema, DeclarativeReleaseRouteOwnerSchema]),
2192
+ contentHash: common_1.Sha256Schema,
2193
+ })
2194
+ .strict();
923
2195
  // Route claims are re-exported here because authoring clients select an existing
924
2196
  // declaration claim; they never submit a URL or mutable endpoint as authority.
925
2197
  exports.DeclarativeRouteClaimIntentSchema = declarative_control_1.RouteClaimSchema;