@inf-monkeys-tech/monkeys 1.1.0 → 1.1.2

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 (41) hide show
  1. package/lib/contracts/declarative-control-http.d.ts +55903 -73794
  2. package/lib/contracts/declarative-control-http.d.ts.map +1 -1
  3. package/lib/contracts/declarative-control-http.js +703 -544
  4. package/lib/contracts/declarative-control-http.js.map +1 -1
  5. package/lib/contracts/declarative-control.d.ts +1623 -3
  6. package/lib/contracts/declarative-control.d.ts.map +1 -1
  7. package/lib/contracts/declarative-control.js +2107 -1136
  8. package/lib/contracts/declarative-control.js.map +1 -1
  9. package/lib/contracts/render.d.ts +591 -1
  10. package/lib/contracts/render.d.ts.map +1 -1
  11. package/lib/contracts/render.js +331 -134
  12. package/lib/contracts/render.js.map +1 -1
  13. package/lib/contracts/tenant.d.ts +3 -3
  14. package/lib/contracts/theme.d.ts +1 -1
  15. package/lib/contracts/workflow-definition.d.ts +1 -0
  16. package/lib/contracts/workflow-definition.d.ts.map +1 -1
  17. package/lib/contracts/workflow-definition.js +1 -1
  18. package/lib/contracts/workflow-definition.js.map +1 -1
  19. package/lib/esm/contracts/index.mjs +1873 -409
  20. package/lib/esm/contracts/index.mjs.map +1 -1
  21. package/lib/esm/index.mjs +3029 -672
  22. package/lib/esm/index.mjs.map +1 -1
  23. package/lib/esm/runtime/index.mjs +3017 -670
  24. package/lib/esm/runtime/index.mjs.map +1 -1
  25. package/lib/esm/schemas/index.mjs +1867 -412
  26. package/lib/esm/schemas/index.mjs.map +1 -1
  27. package/lib/json-schema/overlay-node.schema.json +602 -0
  28. package/lib/json-schema/page-runtime-bundle.schema.json +602 -0
  29. package/lib/json-schema/page.schema.json +5619 -11743
  30. package/lib/json-schema/render-node.schema.json +602 -0
  31. package/lib/json-schema/render-tree.schema.json +602 -0
  32. package/lib/json-schema/workflow-definition.schema.json +3 -0
  33. package/lib/runtime/declarative-control-compiler.d.ts +52 -27
  34. package/lib/runtime/declarative-control-compiler.d.ts.map +1 -1
  35. package/lib/runtime/declarative-control-compiler.js +858 -366
  36. package/lib/runtime/declarative-control-compiler.js.map +1 -1
  37. package/lib/schemas/index.d.ts +787 -2335
  38. package/lib/schemas/index.d.ts.map +1 -1
  39. package/lib/schemas/index.js +100 -99
  40. package/lib/schemas/index.js.map +1 -1
  41. package/package.json +1 -1
@@ -7002,15 +7002,30 @@ var RenderScrollSchema = z6.object({
7002
7002
  });
7003
7003
  var RenderActivationSchema = z6.object({
7004
7004
  activationId: ContractIdentifierSchema,
7005
- mode: z6.enum(["navigate", "select", "drawer", "modal", "fullscreen", "inline"]),
7005
+ mode: z6.enum([
7006
+ "navigate",
7007
+ "select",
7008
+ "drawer",
7009
+ "modal",
7010
+ "fullscreen",
7011
+ "inline"
7012
+ ]),
7006
7013
  targetPath: z6.string().trim().regex(/^\/(?!\/)/, "Expected an application-relative path.").optional(),
7007
7014
  history: z6.enum(["push", "replace"]).optional()
7008
7015
  }).strict().superRefine((activation, context) => {
7009
7016
  if (activation.mode === "navigate" && !activation.targetPath) {
7010
- context.addIssue({ code: "custom", path: ["targetPath"], message: "Navigate activation requires an application-relative targetPath." });
7017
+ context.addIssue({
7018
+ code: "custom",
7019
+ path: ["targetPath"],
7020
+ message: "Navigate activation requires an application-relative targetPath."
7021
+ });
7011
7022
  }
7012
7023
  if (activation.mode !== "navigate" && activation.targetPath) {
7013
- context.addIssue({ code: "custom", path: ["targetPath"], message: "Only navigate activation may declare targetPath." });
7024
+ context.addIssue({
7025
+ code: "custom",
7026
+ path: ["targetPath"],
7027
+ message: "Only navigate activation may declare targetPath."
7028
+ });
7014
7029
  }
7015
7030
  });
7016
7031
  var RenderLifecycleSchema = z6.object({
@@ -7029,13 +7044,25 @@ var RenderLayoutSchema = z6.object({
7029
7044
  gapTokenRef: EntityRefSchema.optional()
7030
7045
  }).strict().superRefine((layout, context) => {
7031
7046
  if (layout.direction && layout.mode !== "flex") {
7032
- context.addIssue({ code: "custom", path: ["direction"], message: "direction is only valid for flex layout." });
7047
+ context.addIssue({
7048
+ code: "custom",
7049
+ path: ["direction"],
7050
+ message: "direction is only valid for flex layout."
7051
+ });
7033
7052
  }
7034
7053
  if (layout.columns && layout.mode !== "grid") {
7035
- context.addIssue({ code: "custom", path: ["columns"], message: "columns is only valid for grid layout." });
7054
+ context.addIssue({
7055
+ code: "custom",
7056
+ path: ["columns"],
7057
+ message: "columns is only valid for grid layout."
7058
+ });
7036
7059
  }
7037
7060
  if (layout.gapTokenRef && layout.gapTokenRef.kind !== "design-token") {
7038
- context.addIssue({ code: "custom", path: ["gapTokenRef", "kind"], message: "gapTokenRef must reference design-token." });
7061
+ context.addIssue({
7062
+ code: "custom",
7063
+ path: ["gapTokenRef", "kind"],
7064
+ message: "gapTokenRef must reference design-token."
7065
+ });
7039
7066
  }
7040
7067
  });
7041
7068
  var RenderResponsiveRuleSchema = z6.object({
@@ -7044,12 +7071,103 @@ var RenderResponsiveRuleSchema = z6.object({
7044
7071
  layout: RenderLayoutSchema
7045
7072
  }).strict().superRefine((rule, context) => {
7046
7073
  if (rule.minWidthPx === void 0 && rule.maxWidthPx === void 0) {
7047
- context.addIssue({ code: "custom", path: [], message: "Responsive rule must declare minWidthPx or maxWidthPx." });
7074
+ context.addIssue({
7075
+ code: "custom",
7076
+ path: [],
7077
+ message: "Responsive rule must declare minWidthPx or maxWidthPx."
7078
+ });
7048
7079
  }
7049
7080
  if (rule.minWidthPx !== void 0 && rule.maxWidthPx !== void 0 && rule.minWidthPx > rule.maxWidthPx) {
7050
- context.addIssue({ code: "custom", path: ["maxWidthPx"], message: "maxWidthPx must be greater than or equal to minWidthPx." });
7081
+ context.addIssue({
7082
+ code: "custom",
7083
+ path: ["maxWidthPx"],
7084
+ message: "maxWidthPx must be greater than or equal to minWidthPx."
7085
+ });
7051
7086
  }
7052
7087
  });
7088
+ var RenderStyleValueSchema = z6.union([
7089
+ z6.number().finite(),
7090
+ z6.string().trim().min(1).max(256).superRefine((value, context) => {
7091
+ if (/[;{}]/.test(value) || /(?:url|expression|javascript|var)\s*\(/i.test(value)) {
7092
+ context.addIssue({
7093
+ code: "custom",
7094
+ message: "Render style values must be bounded CSS values or $ Design Token references."
7095
+ });
7096
+ }
7097
+ })
7098
+ ]);
7099
+ var RenderStyleSchema = z6.object({
7100
+ width: RenderStyleValueSchema.optional(),
7101
+ height: RenderStyleValueSchema.optional(),
7102
+ minWidth: RenderStyleValueSchema.optional(),
7103
+ maxWidth: RenderStyleValueSchema.optional(),
7104
+ minHeight: RenderStyleValueSchema.optional(),
7105
+ maxHeight: RenderStyleValueSchema.optional(),
7106
+ padding: RenderStyleValueSchema.optional(),
7107
+ paddingBlock: RenderStyleValueSchema.optional(),
7108
+ paddingInline: RenderStyleValueSchema.optional(),
7109
+ margin: RenderStyleValueSchema.optional(),
7110
+ marginBlockStart: RenderStyleValueSchema.optional(),
7111
+ marginBlockEnd: RenderStyleValueSchema.optional(),
7112
+ marginInlineStart: RenderStyleValueSchema.optional(),
7113
+ marginInlineEnd: RenderStyleValueSchema.optional(),
7114
+ display: z6.enum([
7115
+ "none",
7116
+ "block",
7117
+ "inline",
7118
+ "inline-block",
7119
+ "flex",
7120
+ "inline-flex",
7121
+ "grid",
7122
+ "contents"
7123
+ ]).optional(),
7124
+ gap: RenderStyleValueSchema.optional(),
7125
+ rowGap: RenderStyleValueSchema.optional(),
7126
+ columnGap: RenderStyleValueSchema.optional(),
7127
+ background: RenderStyleValueSchema.optional(),
7128
+ color: RenderStyleValueSchema.optional(),
7129
+ borderColor: RenderStyleValueSchema.optional(),
7130
+ borderWidth: RenderStyleValueSchema.optional(),
7131
+ borderStyle: z6.enum(["none", "solid", "dashed", "dotted"]).optional(),
7132
+ borderRadius: RenderStyleValueSchema.optional(),
7133
+ boxShadow: RenderStyleValueSchema.optional(),
7134
+ fontSize: RenderStyleValueSchema.optional(),
7135
+ fontFamily: RenderStyleValueSchema.optional(),
7136
+ fontWeight: RenderStyleValueSchema.optional(),
7137
+ lineHeight: RenderStyleValueSchema.optional(),
7138
+ textAlign: z6.enum(["start", "center", "end", "left", "right"]).optional(),
7139
+ whiteSpace: z6.enum(["normal", "nowrap", "pre", "pre-wrap", "pre-line", "break-spaces"]).optional(),
7140
+ overflow: z6.enum(["visible", "hidden", "auto", "scroll", "clip"]).optional(),
7141
+ overflowX: z6.enum(["visible", "hidden", "auto", "scroll", "clip"]).optional(),
7142
+ overflowY: z6.enum(["visible", "hidden", "auto", "scroll", "clip"]).optional(),
7143
+ position: z6.enum(["static", "relative", "absolute", "sticky", "fixed"]).optional(),
7144
+ inset: RenderStyleValueSchema.optional(),
7145
+ top: RenderStyleValueSchema.optional(),
7146
+ right: RenderStyleValueSchema.optional(),
7147
+ bottom: RenderStyleValueSchema.optional(),
7148
+ left: RenderStyleValueSchema.optional(),
7149
+ gridTemplateColumns: RenderStyleValueSchema.optional(),
7150
+ gridColumn: RenderStyleValueSchema.optional(),
7151
+ gridRow: RenderStyleValueSchema.optional(),
7152
+ flex: RenderStyleValueSchema.optional(),
7153
+ flexDirection: z6.enum(["row", "row-reverse", "column", "column-reverse"]).optional(),
7154
+ flexWrap: z6.enum(["nowrap", "wrap", "wrap-reverse"]).optional(),
7155
+ alignItems: z6.enum(["start", "center", "end", "stretch", "baseline"]).optional(),
7156
+ justifyContent: z6.enum([
7157
+ "start",
7158
+ "center",
7159
+ "end",
7160
+ "space-between",
7161
+ "space-around",
7162
+ "space-evenly"
7163
+ ]).optional(),
7164
+ flexGrow: z6.number().finite().nonnegative().optional(),
7165
+ flexShrink: z6.number().finite().nonnegative().optional(),
7166
+ alignSelf: z6.enum(["auto", "start", "center", "end", "stretch"]).optional(),
7167
+ justifySelf: z6.enum(["auto", "start", "center", "end", "stretch"]).optional(),
7168
+ objectFit: z6.enum(["contain", "cover", "fill", "none", "scale-down"]).optional(),
7169
+ opacity: z6.number().finite().min(0).max(1).optional()
7170
+ }).strict();
7053
7171
  var requireRef = (reference, expectedKind, path, context) => {
7054
7172
  if (!reference) return;
7055
7173
  if (reference.kind !== expectedKind) {
@@ -7098,16 +7216,31 @@ var RenderNodeSchema = z6.object({
7098
7216
  activation: RenderActivationSchema,
7099
7217
  lifecycle: RenderLifecycleSchema,
7100
7218
  layout: RenderLayoutSchema,
7219
+ style: RenderStyleSchema.optional(),
7101
7220
  responsive: z6.array(RenderResponsiveRuleSchema),
7102
7221
  accessRef: EntityRefSchema.optional(),
7103
7222
  evidenceRef: EntityRefSchema.optional(),
7104
7223
  state: RenderNodeStateSchema,
7105
7224
  renderModel: JsonObjectSchema,
7106
- repeat: z6.object({ source: PageExpressionSchema, keyPath: PageValuePathSchema.min(1), limit: z6.number().int().min(1).max(1e3).default(200) }).strict().optional()
7225
+ repeat: z6.object({
7226
+ source: PageExpressionSchema,
7227
+ keyPath: PageValuePathSchema.min(1),
7228
+ limit: z6.number().int().min(1).max(1e3).default(200)
7229
+ }).strict().optional()
7107
7230
  }).strict().superRefine((node, context) => {
7108
7231
  requireRef(node.pageRef, "page", ["pageRef"], context);
7109
- requirePinnedOwnedRef(node.capabilityRef, "capability", ["capabilityRef"], context);
7110
- requirePinnedOwnedRef(node.providerRef, "view-provider", ["providerRef"], context);
7232
+ requirePinnedOwnedRef(
7233
+ node.capabilityRef,
7234
+ "capability",
7235
+ ["capabilityRef"],
7236
+ context
7237
+ );
7238
+ requirePinnedOwnedRef(
7239
+ node.providerRef,
7240
+ "view-provider",
7241
+ ["providerRef"],
7242
+ context
7243
+ );
7111
7244
  requireRef(node.accessRef, "access-policy", ["accessRef"], context);
7112
7245
  requireRef(node.evidenceRef, "evidence", ["evidenceRef"], context);
7113
7246
  if (node.parentNodeId === node.nodeId) {
@@ -7118,10 +7251,18 @@ var RenderNodeSchema = z6.object({
7118
7251
  });
7119
7252
  }
7120
7253
  if (new Set(node.children).size !== node.children.length) {
7121
- context.addIssue({ code: "custom", path: ["children"], message: "RenderNode children must be unique." });
7254
+ context.addIssue({
7255
+ code: "custom",
7256
+ path: ["children"],
7257
+ message: "RenderNode children must be unique."
7258
+ });
7122
7259
  }
7123
7260
  if (node.children.includes(node.nodeId)) {
7124
- context.addIssue({ code: "custom", path: ["children"], message: "RenderNode cannot be its own child." });
7261
+ context.addIssue({
7262
+ code: "custom",
7263
+ path: ["children"],
7264
+ message: "RenderNode cannot be its own child."
7265
+ });
7125
7266
  }
7126
7267
  if (node.surface.frameOwner === "provider" && !node.providerRef) {
7127
7268
  context.addIssue({
@@ -7241,9 +7382,28 @@ var ViewProviderDescriptorSchema = z6.object({
7241
7382
  loading: z6.enum(["eager", "lazy", "viewport", "on-activation"]),
7242
7383
  stateOwner: z6.enum(["host", "provider", "external"]),
7243
7384
  supportedPageTypes: z6.array(ContractIdentifierSchema).min(1),
7244
- supportedSurfaces: z6.array(z6.enum(["page", "workspace", "view", "record", "action", "overlay", "agent"])).min(1),
7385
+ supportedSurfaces: z6.array(
7386
+ z6.enum([
7387
+ "page",
7388
+ "workspace",
7389
+ "view",
7390
+ "record",
7391
+ "action",
7392
+ "overlay",
7393
+ "agent"
7394
+ ])
7395
+ ).min(1),
7245
7396
  frameOwner: z6.enum(["host", "provider", "none"]),
7246
- sideEffects: z6.array(z6.enum(["network", "storage", "navigation", "clipboard", "worker", "websocket"])),
7397
+ sideEffects: z6.array(
7398
+ z6.enum([
7399
+ "network",
7400
+ "storage",
7401
+ "navigation",
7402
+ "clipboard",
7403
+ "worker",
7404
+ "websocket"
7405
+ ])
7406
+ ),
7247
7407
  sideEffectAdapterRef: EntityRefSchema.optional(),
7248
7408
  lifecycle: z6.object({
7249
7409
  preserveMount: z6.boolean(),
@@ -7258,8 +7418,18 @@ var ViewProviderDescriptorSchema = z6.object({
7258
7418
  accessRef: EntityRefSchema.optional(),
7259
7419
  evidenceRef: EntityRefSchema.optional()
7260
7420
  }).strict().superRefine((provider, context) => {
7261
- requirePinnedOwnedRef(provider.capabilityRef, "capability", ["capabilityRef"], context);
7262
- requirePinnedOwnedRef(provider.sideEffectAdapterRef, "side-effect-adapter", ["sideEffectAdapterRef"], context);
7421
+ requirePinnedOwnedRef(
7422
+ provider.capabilityRef,
7423
+ "capability",
7424
+ ["capabilityRef"],
7425
+ context
7426
+ );
7427
+ requirePinnedOwnedRef(
7428
+ provider.sideEffectAdapterRef,
7429
+ "side-effect-adapter",
7430
+ ["sideEffectAdapterRef"],
7431
+ context
7432
+ );
7263
7433
  requireRef(provider.accessRef, "access-policy", ["accessRef"], context);
7264
7434
  requireRef(provider.evidenceRef, "evidence", ["evidenceRef"], context);
7265
7435
  if (provider.capabilityRef.version === void 0) {
@@ -7277,10 +7447,18 @@ var ViewProviderDescriptorSchema = z6.object({
7277
7447
  });
7278
7448
  }
7279
7449
  if (provider.sideEffects.length > 0 && !provider.sideEffectAdapterRef) {
7280
- context.addIssue({ code: "custom", path: ["sideEffectAdapterRef"], message: "Providers with side effects require a pinned side-effect adapter." });
7450
+ context.addIssue({
7451
+ code: "custom",
7452
+ path: ["sideEffectAdapterRef"],
7453
+ message: "Providers with side effects require a pinned side-effect adapter."
7454
+ });
7281
7455
  }
7282
7456
  if (provider.sideEffects.length === 0 && provider.sideEffectAdapterRef) {
7283
- context.addIssue({ code: "custom", path: ["sideEffectAdapterRef"], message: "Pure providers cannot declare a side-effect adapter." });
7457
+ context.addIssue({
7458
+ code: "custom",
7459
+ path: ["sideEffectAdapterRef"],
7460
+ message: "Pure providers cannot declare a side-effect adapter."
7461
+ });
7284
7462
  }
7285
7463
  });
7286
7464
 
@@ -9007,7 +9185,10 @@ var StableRefAliasMapSchema = z14.object({
9007
9185
  aliases: z14.array(StableRefAliasSchema),
9008
9186
  contentHash: Sha256Schema
9009
9187
  }).strict().superRefine((value, context) => {
9010
- const duplicate = uniqueArray(value.aliases, (entry) => stableRefIdentity(entry.aliasRef));
9188
+ const duplicate = uniqueArray(
9189
+ value.aliases,
9190
+ (entry) => stableRefIdentity(entry.aliasRef)
9191
+ );
9011
9192
  if (duplicate)
9012
9193
  context.addIssue({
9013
9194
  code: "custom",
@@ -9015,15 +9196,25 @@ var StableRefAliasMapSchema = z14.object({
9015
9196
  message: `Duplicate alias reference: ${duplicate}`
9016
9197
  });
9017
9198
  });
9018
- var DeclarativeLifecycleSchema = z14.enum(["active", "deprecated", "retired"]);
9019
- var ProductSurfaceSchema = z14.enum(["studio", "kernel"]);
9020
- var DeclarativeShellHeaderChromeSchema = z14.discriminatedUnion("enabled", [
9021
- z14.object({ enabled: z14.literal(false) }).strict(),
9022
- z14.object({
9023
- enabled: z14.literal(true),
9024
- navigationPlacement: z14.enum(["studio.headbar.primary", "kernel.primary"])
9025
- }).strict()
9199
+ var DeclarativeLifecycleSchema = z14.enum([
9200
+ "active",
9201
+ "deprecated",
9202
+ "retired"
9026
9203
  ]);
9204
+ var ProductSurfaceSchema = z14.enum(["studio", "kernel"]);
9205
+ var DeclarativeShellHeaderChromeSchema = z14.discriminatedUnion(
9206
+ "enabled",
9207
+ [
9208
+ z14.object({ enabled: z14.literal(false) }).strict(),
9209
+ z14.object({
9210
+ enabled: z14.literal(true),
9211
+ navigationPlacement: z14.enum([
9212
+ "studio.headbar.primary",
9213
+ "kernel.primary"
9214
+ ])
9215
+ }).strict()
9216
+ ]
9217
+ );
9027
9218
  var DeclarativeShellSurfaceChromeSchema = z14.object({
9028
9219
  surface: ProductSurfaceSchema,
9029
9220
  header: DeclarativeShellHeaderChromeSchema
@@ -9058,15 +9249,17 @@ var GroupRefSchema = StableRefSchema.superRefine((value, context) => {
9058
9249
  message: "Access group references must use kind group."
9059
9250
  });
9060
9251
  });
9061
- var AccessConditionRefSchema = RevisionRefSchema.superRefine((value, context) => {
9062
- if (value.kind !== "access-condition") {
9063
- context.addIssue({
9064
- code: "custom",
9065
- path: ["kind"],
9066
- message: "Access condition references must use kind access-condition."
9067
- });
9252
+ var AccessConditionRefSchema = RevisionRefSchema.superRefine(
9253
+ (value, context) => {
9254
+ if (value.kind !== "access-condition") {
9255
+ context.addIssue({
9256
+ code: "custom",
9257
+ path: ["kind"],
9258
+ message: "Access condition references must use kind access-condition."
9259
+ });
9260
+ }
9068
9261
  }
9069
- });
9262
+ );
9070
9263
  var AccessPolicySchema = z14.object({
9071
9264
  authenticated: z14.boolean(),
9072
9265
  groupAllOf: z14.array(GroupRefSchema),
@@ -9076,8 +9269,16 @@ var AccessPolicySchema = z14.object({
9076
9269
  conditionAllOf: z14.array(AccessConditionRefSchema)
9077
9270
  }).strict().superRefine((value, context) => {
9078
9271
  const checks = [
9079
- ["groupAllOf", value.groupAllOf, (candidate) => stableRefIdentity(candidate)],
9080
- ["groupAnyOf", value.groupAnyOf, (candidate) => stableRefIdentity(candidate)],
9272
+ [
9273
+ "groupAllOf",
9274
+ value.groupAllOf,
9275
+ (candidate) => stableRefIdentity(candidate)
9276
+ ],
9277
+ [
9278
+ "groupAnyOf",
9279
+ value.groupAnyOf,
9280
+ (candidate) => stableRefIdentity(candidate)
9281
+ ],
9081
9282
  ["permissionAllOf", value.permissionAllOf, String],
9082
9283
  ["permissionAnyOf", value.permissionAnyOf, String],
9083
9284
  [
@@ -9243,14 +9444,19 @@ var validateReleaseRouteSurface = (target, context) => {
9243
9444
  const claimSurface = "surface" in target.routeClaim ? target.routeClaim.surface : void 0;
9244
9445
  const matcherSurface = "surface" in target.routeClaim.matcher ? target.routeClaim.matcher.surface : void 0;
9245
9446
  if (claimSurface === void 0 && matcherSurface === void 0) return;
9246
- if (claimSurface === target.surface && matcherSurface === target.surface) return;
9447
+ if (claimSurface === target.surface && matcherSurface === target.surface)
9448
+ return;
9247
9449
  context.addIssue({
9248
9450
  code: "custom",
9249
9451
  path: ["target", "routeClaim"],
9250
9452
  message: "A compiled Release route claim must either be fully legacy or bind both claim and matcher to the target surface."
9251
9453
  });
9252
9454
  };
9253
- var ReleaseOperationSchema = z14.enum(["activate", "deactivate", "rollback"]);
9455
+ var ReleaseOperationSchema = z14.enum([
9456
+ "activate",
9457
+ "deactivate",
9458
+ "rollback"
9459
+ ]);
9254
9460
  var ReleaseDependencyRoleSchema = z14.enum([
9255
9461
  "route-space",
9256
9462
  "shell",
@@ -9341,8 +9547,16 @@ var ReleaseEvidenceSchema = z14.object({
9341
9547
  }).strict().superRefine((value, context) => {
9342
9548
  const expectedKinds = [
9343
9549
  ["publicationPlanRef", value.publicationPlanRef, "publication-plan"],
9344
- ["approvalPolicyRevisionRef", value.approvalPolicyRevisionRef, "approval-policy"],
9345
- ["approvalDecisionRevisionRef", value.approvalDecisionRevisionRef, "approval-decision"],
9550
+ [
9551
+ "approvalPolicyRevisionRef",
9552
+ value.approvalPolicyRevisionRef,
9553
+ "approval-policy"
9554
+ ],
9555
+ [
9556
+ "approvalDecisionRevisionRef",
9557
+ value.approvalDecisionRevisionRef,
9558
+ "approval-decision"
9559
+ ],
9346
9560
  ["actorRef", value.actorRef, "actor"]
9347
9561
  ];
9348
9562
  expectedKinds.forEach(([field, reference, expectedKind]) => {
@@ -9364,7 +9578,11 @@ var ReleaseEvidenceSchema = z14.object({
9364
9578
  });
9365
9579
  });
9366
9580
  var PublicationPlanOperationSchema = z14.object({
9367
- releaseKind: z14.enum(["page-release", "workbench-release", "navigation-release"]),
9581
+ releaseKind: z14.enum([
9582
+ "page-release",
9583
+ "workbench-release",
9584
+ "navigation-release"
9585
+ ]),
9368
9586
  releaseSlotId: ContractIdentifierSchema,
9369
9587
  releaseRevisionRef: RevisionRefSchema,
9370
9588
  expectedHeadRevisionRef: RevisionRefSchema.nullable()
@@ -9405,10 +9623,23 @@ var PublicationPlanSchema = z14.object({
9405
9623
  path: ["environmentRef", "kind"],
9406
9624
  message: "Publication Plan requires an environment reference."
9407
9625
  });
9408
- validateTenantCompatibleReference(value.environmentRef, value.tenantScope, ["environmentRef"], context);
9626
+ validateTenantCompatibleReference(
9627
+ value.environmentRef,
9628
+ value.tenantScope,
9629
+ ["environmentRef"],
9630
+ context
9631
+ );
9409
9632
  const governedRefs = [
9410
- ["approvalPolicyRevisionRef", value.approvalPolicyRevisionRef, "approval-policy"],
9411
- ["approvalDecisionRevisionRef", value.approvalDecisionRevisionRef, "approval-decision"],
9633
+ [
9634
+ "approvalPolicyRevisionRef",
9635
+ value.approvalPolicyRevisionRef,
9636
+ "approval-policy"
9637
+ ],
9638
+ [
9639
+ "approvalDecisionRevisionRef",
9640
+ value.approvalDecisionRevisionRef,
9641
+ "approval-decision"
9642
+ ],
9412
9643
  ["actorRef", value.actorRef, "actor"]
9413
9644
  ];
9414
9645
  governedRefs.forEach(([field, reference, expectedKind]) => {
@@ -9418,19 +9649,26 @@ var PublicationPlanSchema = z14.object({
9418
9649
  path: [field, "kind"],
9419
9650
  message: `${field} must reference ${expectedKind}.`
9420
9651
  });
9421
- validateTenantCompatibleReference(reference, value.tenantScope, [field], context);
9652
+ validateTenantCompatibleReference(
9653
+ reference,
9654
+ value.tenantScope,
9655
+ [field],
9656
+ context
9657
+ );
9422
9658
  });
9423
9659
  value.operations.forEach((operation, index) => {
9424
- [operation.releaseRevisionRef, operation.expectedHeadRevisionRef].forEach((reference, referenceIndex) => {
9425
- if (reference?.tenantScope && tenantScopeKey(reference.tenantScope) !== tenantScopeKey(value.tenantScope)) {
9426
- const field = referenceIndex === 0 ? "releaseRevisionRef" : "expectedHeadRevisionRef";
9427
- context.addIssue({
9428
- code: "custom",
9429
- path: ["operations", index, field, "tenantScope"],
9430
- message: "Publication Plan operation belongs to another tenant scope."
9431
- });
9660
+ [operation.releaseRevisionRef, operation.expectedHeadRevisionRef].forEach(
9661
+ (reference, referenceIndex) => {
9662
+ if (reference?.tenantScope && tenantScopeKey(reference.tenantScope) !== tenantScopeKey(value.tenantScope)) {
9663
+ const field = referenceIndex === 0 ? "releaseRevisionRef" : "expectedHeadRevisionRef";
9664
+ context.addIssue({
9665
+ code: "custom",
9666
+ path: ["operations", index, field, "tenantScope"],
9667
+ message: "Publication Plan operation belongs to another tenant scope."
9668
+ });
9669
+ }
9432
9670
  }
9433
- });
9671
+ );
9434
9672
  });
9435
9673
  value.evidenceRefs.forEach((reference, index) => {
9436
9674
  if (reference.kind !== "evidence")
@@ -9439,9 +9677,17 @@ var PublicationPlanSchema = z14.object({
9439
9677
  path: ["evidenceRefs", index, "kind"],
9440
9678
  message: "Publication Plan evidenceRefs must reference evidence revisions."
9441
9679
  });
9442
- validateTenantCompatibleReference(reference, value.tenantScope, ["evidenceRefs", index], context);
9680
+ validateTenantCompatibleReference(
9681
+ reference,
9682
+ value.tenantScope,
9683
+ ["evidenceRefs", index],
9684
+ context
9685
+ );
9443
9686
  });
9444
- if (uniqueArray(value.operations, (operation) => `${operation.releaseKind}:${operation.releaseSlotId}`)) {
9687
+ if (uniqueArray(
9688
+ value.operations,
9689
+ (operation) => `${operation.releaseKind}:${operation.releaseSlotId}`
9690
+ )) {
9445
9691
  context.addIssue({
9446
9692
  code: "custom",
9447
9693
  path: ["operations"],
@@ -9628,11 +9874,20 @@ var validateReleaseGovernanceScope = (value, expectedKind, context) => {
9628
9874
  }
9629
9875
  const governedEvidenceRefs = [
9630
9876
  [["evidence", "publicationPlanRef"], value.evidence.publicationPlanRef],
9631
- [["evidence", "approvalPolicyRevisionRef"], value.evidence.approvalPolicyRevisionRef],
9632
- [["evidence", "approvalDecisionRevisionRef"], value.evidence.approvalDecisionRevisionRef],
9877
+ [
9878
+ ["evidence", "approvalPolicyRevisionRef"],
9879
+ value.evidence.approvalPolicyRevisionRef
9880
+ ],
9881
+ [
9882
+ ["evidence", "approvalDecisionRevisionRef"],
9883
+ value.evidence.approvalDecisionRevisionRef
9884
+ ],
9633
9885
  [["evidence", "actorRef"], value.evidence.actorRef],
9634
9886
  ...value.evidence.validation.diagnosticRefs.map(
9635
- (reference, index) => [["evidence", "validation", "diagnosticRefs", index], reference]
9887
+ (reference, index) => [
9888
+ ["evidence", "validation", "diagnosticRefs", index],
9889
+ reference
9890
+ ]
9636
9891
  ),
9637
9892
  ...value.evidence.evidenceRefs.map(
9638
9893
  (reference, index) => [["evidence", "evidenceRefs", index], reference]
@@ -9643,15 +9898,31 @@ var validateReleaseGovernanceScope = (value, expectedKind, context) => {
9643
9898
  ["legacyRestoration", "legacyAdapterRevisionRef"],
9644
9899
  value.legacyRestoration.legacyAdapterRevisionRef
9645
9900
  ],
9646
- [["legacyRestoration", "sourceRevisionRef"], value.legacyRestoration.sourceRevisionRef]
9901
+ [
9902
+ ["legacyRestoration", "sourceRevisionRef"],
9903
+ value.legacyRestoration.sourceRevisionRef
9904
+ ]
9647
9905
  ] : []
9648
9906
  ];
9649
9907
  governedEvidenceRefs.forEach(
9650
- ([path, reference]) => validateTenantCompatibleReference(reference, value.tenantScope, [...path], context)
9908
+ ([path, reference]) => validateTenantCompatibleReference(
9909
+ reference,
9910
+ value.tenantScope,
9911
+ [...path],
9912
+ context
9913
+ )
9651
9914
  );
9652
9915
  };
9653
9916
  var BindingSourceSchema = z14.discriminatedUnion("kind", [
9654
- z14.object({ kind: z14.literal("scope-field"), path: z14.string().trim().min(1).max(4096).regex(/^[A-Za-z0-9_.-]+$/).refine((path) => path.split(".").length <= 16 && path.split(".").every((part) => part.length > 0 && !["__proto__", "prototype", "constructor"].includes(part)), "Scope paths require safe own members.") }).strict(),
9917
+ z14.object({
9918
+ kind: z14.literal("scope-field"),
9919
+ path: z14.string().trim().min(1).max(4096).regex(/^[A-Za-z0-9_.-]+$/).refine(
9920
+ (path) => path.split(".").length <= 16 && path.split(".").every(
9921
+ (part) => part.length > 0 && !["__proto__", "prototype", "constructor"].includes(part)
9922
+ ),
9923
+ "Scope paths require safe own members."
9924
+ )
9925
+ }).strict(),
9655
9926
  z14.object({
9656
9927
  kind: z14.literal("binding-field"),
9657
9928
  bindingId: ContractIdentifierSchema,
@@ -9683,22 +9954,48 @@ var BindingSourceSchema = z14.discriminatedUnion("kind", [
9683
9954
  }).strict()
9684
9955
  ]);
9685
9956
  var ExpressionBindingSourceSchema = z14.object({ kind: z14.literal("expression"), expression: PageExpressionSchema }).strict().superRefine((value, context) => {
9686
- if (collectPageExpressionReads(value.expression).some((read) => read.root === "actions")) context.addIssue({ code: "custom", path: ["expression"], message: "Action runtime state is presentation-only and cannot influence an input or state transition." });
9957
+ if (collectPageExpressionReads(value.expression).some(
9958
+ (read) => read.root === "actions"
9959
+ ))
9960
+ context.addIssue({
9961
+ code: "custom",
9962
+ path: ["expression"],
9963
+ message: "Action runtime state is presentation-only and cannot influence an input or state transition."
9964
+ });
9687
9965
  });
9688
- var FileFieldBindingSourceSchema = z14.object({ kind: z14.literal("file-field"), fileInputId: ContractIdentifierSchema, path: z14.enum(["fileName", "content", "canonicalUri"]) }).strict();
9966
+ var FileFieldBindingSourceSchema = z14.object({
9967
+ kind: z14.literal("file-field"),
9968
+ fileInputId: ContractIdentifierSchema,
9969
+ path: z14.enum(["fileName", "content", "canonicalUri"])
9970
+ }).strict();
9689
9971
  var ActionFileInputSchema = z14.object({
9690
9972
  inputId: ContractIdentifierSchema,
9691
9973
  source: z14.discriminatedUnion("kind", [
9692
- z14.object({ kind: z14.literal("page-state"), stateId: ContractIdentifierSchema }).strict(),
9693
- z14.object({ kind: z14.literal("intent-field"), path: z14.string().trim().regex(/^[A-Za-z0-9_.-]+$/) }).strict()
9974
+ z14.object({
9975
+ kind: z14.literal("page-state"),
9976
+ stateId: ContractIdentifierSchema
9977
+ }).strict(),
9978
+ z14.object({
9979
+ kind: z14.literal("intent-field"),
9980
+ path: z14.string().trim().regex(/^[A-Za-z0-9_.-]+$/)
9981
+ }).strict()
9694
9982
  ]),
9695
9983
  maxBytes: z14.number().int().min(1).max(5368709120),
9696
9984
  upload: z14.object({ purpose: FilePurposeSchema }).strict().optional(),
9697
9985
  accept: z14.string().min(1).max(256).optional()
9698
9986
  }).strict().superRefine((value, context) => {
9699
- if (!value.upload && value.maxBytes > 1048576) context.addIssue({ code: "custom", path: ["maxBytes"], message: "Inline text files are limited to one MiB." });
9987
+ if (!value.upload && value.maxBytes > 1048576)
9988
+ context.addIssue({
9989
+ code: "custom",
9990
+ path: ["maxBytes"],
9991
+ message: "Inline text files are limited to one MiB."
9992
+ });
9700
9993
  });
9701
- var ActionInputBindingSourceSchema = z14.discriminatedUnion("kind", [...BindingSourceSchema.options, ExpressionBindingSourceSchema, FileFieldBindingSourceSchema]);
9994
+ var ActionInputBindingSourceSchema = z14.discriminatedUnion("kind", [
9995
+ ...BindingSourceSchema.options,
9996
+ ExpressionBindingSourceSchema,
9997
+ FileFieldBindingSourceSchema
9998
+ ]);
9702
9999
  var InteractionBindingSourceSchema = z14.discriminatedUnion("kind", [
9703
10000
  ExpressionBindingSourceSchema,
9704
10001
  z14.object({
@@ -9718,7 +10015,12 @@ var InteractionBindingSourceSchema = z14.discriminatedUnion("kind", [
9718
10015
  stateId: ContractIdentifierSchema
9719
10016
  }).strict()
9720
10017
  ]);
9721
- var PageStateComparableLiteralSchema = z14.union([z14.string(), z14.number().finite(), z14.boolean(), z14.null()]);
10018
+ var PageStateComparableLiteralSchema = z14.union([
10019
+ z14.string(),
10020
+ z14.number().finite(),
10021
+ z14.boolean(),
10022
+ z14.null()
10023
+ ]);
9722
10024
  var PageStateConditionSchema = z14.discriminatedUnion("predicate", [
9723
10025
  z14.object({
9724
10026
  stateId: ContractIdentifierSchema,
@@ -9752,7 +10054,10 @@ var forEachPageStateCondition = (activation, visit, path = []) => {
9752
10054
  });
9753
10055
  };
9754
10056
  var PageRouteValueSourceSchema = z14.discriminatedUnion("kind", [
9755
- z14.object({ kind: z14.literal("route-parameter"), name: ContractIdentifierSchema }).strict(),
10057
+ z14.object({
10058
+ kind: z14.literal("route-parameter"),
10059
+ name: ContractIdentifierSchema
10060
+ }).strict(),
9756
10061
  z14.object({
9757
10062
  kind: z14.literal("constant"),
9758
10063
  value: z14.union([z14.string(), z14.number().finite(), z14.boolean()])
@@ -9764,11 +10069,17 @@ var PageRouteValueSourceSchema = z14.discriminatedUnion("kind", [
9764
10069
  ]);
9765
10070
  var PageEntryTransitionSchema = z14.object({
9766
10071
  browsingContext: z14.enum(["same", "new"]).optional(),
9767
- gestureSource: z14.object({ capabilityInstanceId: ContractIdentifierSchema, port: ContractIdentifierSchema }).strict().optional(),
10072
+ gestureSource: z14.object({
10073
+ capabilityInstanceId: ContractIdentifierSchema,
10074
+ port: ContractIdentifierSchema
10075
+ }).strict().optional(),
9768
10076
  transitionId: ContractIdentifierSchema,
9769
10077
  activation: PageStateActivationSchema,
9770
10078
  targetRef: StableRefSchema,
9771
- pathParameters: z14.record(ContractIdentifierSchema, PageRouteValueSourceSchema),
10079
+ pathParameters: z14.record(
10080
+ ContractIdentifierSchema,
10081
+ PageRouteValueSourceSchema
10082
+ ),
9772
10083
  query: z14.object({
9773
10084
  preserve: z14.boolean(),
9774
10085
  remove: z14.array(ContractIdentifierSchema),
@@ -9805,7 +10116,12 @@ var ResolvedPageEntryTransitionSchema = PageEntryTransitionSchema.safeExtend({
9805
10116
  }).strict();
9806
10117
  var LegacyBrowserPreferenceImportSchema = z14.object({
9807
10118
  storageKey: z14.string().trim().min(1).max(256),
9808
- jsonPath: z14.array(z14.union([z14.string().trim().min(1).max(128), z14.object({ stateId: ContractIdentifierSchema }).strict()])).min(1).max(16).optional(),
10119
+ jsonPath: z14.array(
10120
+ z14.union([
10121
+ z14.string().trim().min(1).max(128),
10122
+ z14.object({ stateId: ContractIdentifierSchema }).strict()
10123
+ ])
10124
+ ).min(1).max(16).optional(),
9809
10125
  valueType: z14.enum(["string", "number", "boolean-01", "json"])
9810
10126
  }).strict();
9811
10127
  var PageStateDefinitionSchema = z14.object({
@@ -9814,13 +10130,29 @@ var PageStateDefinitionSchema = z14.object({
9814
10130
  initialValue: PageExpressionSchema.optional(),
9815
10131
  schemaRevisionRef: RevisionRefSchema,
9816
10132
  defaultValue: JsonValueSchema.optional(),
9817
- persistence: z14.enum(["none", "session", "url", "tenant-preference", "url-with-tenant-preference"]),
10133
+ persistence: z14.enum([
10134
+ "none",
10135
+ "session",
10136
+ "url",
10137
+ "tenant-preference",
10138
+ "url-with-tenant-preference"
10139
+ ]),
9818
10140
  urlWriteback: z14.enum(["synchronize", "never"]).optional(),
9819
10141
  preferencePartitionStateId: ContractIdentifierSchema.optional(),
9820
10142
  legacyBrowserPreferenceImport: LegacyBrowserPreferenceImportSchema.optional()
9821
10143
  }).strict().superRefine((value, context) => {
9822
- if (value.scopeNodeId && value.persistence !== "none") context.addIssue({ code: "custom", path: ["persistence"], message: "Repeated instance state must not persist outside its instance." });
9823
- if (value.initialValue && !value.scopeNodeId && (value.persistence !== "none" || value.initialValue.kind !== "read" || value.initialValue.root !== "state" || value.initialValue.path.length !== 1)) context.addIssue({ code: "custom", path: ["initialValue"], message: "Root initialization must directly read one persisted Page state into non-persistent state." });
10144
+ if (value.scopeNodeId && value.persistence !== "none")
10145
+ context.addIssue({
10146
+ code: "custom",
10147
+ path: ["persistence"],
10148
+ message: "Repeated instance state must not persist outside its instance."
10149
+ });
10150
+ if (value.initialValue && !value.scopeNodeId && (value.persistence !== "none" || value.initialValue.kind !== "read" || value.initialValue.root !== "state" || value.initialValue.path.length !== 1))
10151
+ context.addIssue({
10152
+ code: "custom",
10153
+ path: ["initialValue"],
10154
+ message: "Root initialization must directly read one persisted Page state into non-persistent state."
10155
+ });
9824
10156
  if (value.schemaRevisionRef.kind !== "schema") {
9825
10157
  context.addIssue({
9826
10158
  code: "custom",
@@ -9853,7 +10185,10 @@ var InteractionBindingSchema = z14.object({
9853
10185
  sourceResultSchemaRevisionRef: RevisionRefSchema.optional(),
9854
10186
  targetStateId: ContractIdentifierSchema,
9855
10187
  transition: z14.enum(["set", "merge", "toggle", "append", "remove", "reset"]),
9856
- inputMapping: z14.record(ContractIdentifierSchema, InteractionBindingSourceSchema)
10188
+ inputMapping: z14.record(
10189
+ ContractIdentifierSchema,
10190
+ InteractionBindingSourceSchema
10191
+ )
9857
10192
  }).strict().superRefine((value, context) => {
9858
10193
  if (value.sourceIntentSchemaRevisionRef.kind !== "schema") {
9859
10194
  context.addIssue({
@@ -9862,7 +10197,11 @@ var InteractionBindingSchema = z14.object({
9862
10197
  message: "Interaction source intents must pin a schema revision."
9863
10198
  });
9864
10199
  }
9865
- const mapsResult = Object.values(value.inputMapping).some((source) => source.kind === "result-field" || source.kind === "expression" && collectPageExpressionReads(source.expression).some((read) => read.root === "result"));
10200
+ const mapsResult = Object.values(value.inputMapping).some(
10201
+ (source) => source.kind === "result-field" || source.kind === "expression" && collectPageExpressionReads(source.expression).some(
10202
+ (read) => read.root === "result"
10203
+ )
10204
+ );
9866
10205
  if (mapsResult && !value.sourceResultSchemaRevisionRef) {
9867
10206
  context.addIssue({
9868
10207
  code: "custom",
@@ -9900,7 +10239,11 @@ var InteractionBindingSchema = z14.object({
9900
10239
  });
9901
10240
  }
9902
10241
  });
9903
- var GovernedCatalogResourceKindSchema = z14.enum(["tag", "tag-group", "feature-column"]);
10242
+ var GovernedCatalogResourceKindSchema = z14.enum([
10243
+ "tag",
10244
+ "tag-group",
10245
+ "feature-column"
10246
+ ]);
9904
10247
  var GovernedCatalogDomainQueryDataSourceSchema = z14.object({
9905
10248
  kind: z14.literal("governed-catalog"),
9906
10249
  resourceKind: GovernedCatalogResourceKindSchema
@@ -9982,9 +10325,21 @@ var DomainQueryDefinitionSchema = z14.object({
9982
10325
  });
9983
10326
  }
9984
10327
  const refs = [
9985
- ...sourceKind === "exact-view" && value.ontologyDefinitionRevisionRef ? [["ontologyDefinitionRevisionRef", value.ontologyDefinitionRevisionRef, "ontology-definition"]] : [],
10328
+ ...sourceKind === "exact-view" && value.ontologyDefinitionRevisionRef ? [
10329
+ [
10330
+ "ontologyDefinitionRevisionRef",
10331
+ value.ontologyDefinitionRevisionRef,
10332
+ "ontology-definition"
10333
+ ]
10334
+ ] : [],
9986
10335
  ...sourceKind === "exact-view" && value.viewRevisionRef ? [["viewRevisionRef", value.viewRevisionRef, "view"]] : [],
9987
- ...sourceKind === "exact-view" && value.canonicalDataViewRevisionRef ? [["canonicalDataViewRevisionRef", value.canonicalDataViewRevisionRef, "view"]] : [],
10336
+ ...sourceKind === "exact-view" && value.canonicalDataViewRevisionRef ? [
10337
+ [
10338
+ "canonicalDataViewRevisionRef",
10339
+ value.canonicalDataViewRevisionRef,
10340
+ "view"
10341
+ ]
10342
+ ] : [],
9988
10343
  ["inputSchemaRevisionRef", value.inputSchemaRevisionRef, "schema"],
9989
10344
  ["resultSchemaRevisionRef", value.resultSchemaRevisionRef, "schema"]
9990
10345
  ];
@@ -9996,10 +10351,23 @@ var DomainQueryDefinitionSchema = z14.object({
9996
10351
  message: `${field} must reference ${expectedKind}.`
9997
10352
  });
9998
10353
  }
9999
- validateTenantCompatibleReference(reference, value.tenantScope, [field], context);
10354
+ validateTenantCompatibleReference(
10355
+ reference,
10356
+ value.tenantScope,
10357
+ [field],
10358
+ context
10359
+ );
10000
10360
  });
10001
- [...value.accessPolicy.groupAllOf, ...value.accessPolicy.groupAnyOf].forEach(
10002
- (reference, index) => validateTenantCompatibleReference(reference, value.tenantScope, ["accessPolicy", "groups", index], context)
10361
+ [
10362
+ ...value.accessPolicy.groupAllOf,
10363
+ ...value.accessPolicy.groupAnyOf
10364
+ ].forEach(
10365
+ (reference, index) => validateTenantCompatibleReference(
10366
+ reference,
10367
+ value.tenantScope,
10368
+ ["accessPolicy", "groups", index],
10369
+ context
10370
+ )
10003
10371
  );
10004
10372
  value.accessPolicy.conditionAllOf.forEach(
10005
10373
  (reference, index) => validateTenantCompatibleReference(
@@ -10009,7 +10377,10 @@ var DomainQueryDefinitionSchema = z14.object({
10009
10377
  context
10010
10378
  )
10011
10379
  );
10012
- if (value.viewRevisionRef && value.canonicalDataViewRevisionRef && exactRevisionRef(value.viewRevisionRef, value.canonicalDataViewRevisionRef)) {
10380
+ if (value.viewRevisionRef && value.canonicalDataViewRevisionRef && exactRevisionRef(
10381
+ value.viewRevisionRef,
10382
+ value.canonicalDataViewRevisionRef
10383
+ )) {
10013
10384
  context.addIssue({
10014
10385
  code: "custom",
10015
10386
  path: ["canonicalDataViewRevisionRef"],
@@ -10052,9 +10423,21 @@ var QueryBindingSchema = z14.object({
10052
10423
  port: ContractIdentifierSchema
10053
10424
  }).strict(),
10054
10425
  renderModelSchemaRevisionRef: RevisionRefSchema,
10055
- targetProjection: z14.object({ expression: PageExpressionSchema, schemaRevisionRef: RevisionRefSchema }).strict().optional(),
10056
- streamTargetProjection: z14.object({ expression: PageExpressionSchema, schemaRevisionRef: RevisionRefSchema }).strict().optional(),
10057
- stateEffects: z14.array(z14.object({ targetStateId: ContractIdentifierSchema, value: PageExpressionSchema, when: PageExpressionSchema.optional() }).strict()).max(32).optional(),
10426
+ targetProjection: z14.object({
10427
+ expression: PageExpressionSchema,
10428
+ schemaRevisionRef: RevisionRefSchema
10429
+ }).strict().optional(),
10430
+ streamTargetProjection: z14.object({
10431
+ expression: PageExpressionSchema,
10432
+ schemaRevisionRef: RevisionRefSchema
10433
+ }).strict().optional(),
10434
+ stateEffects: z14.array(
10435
+ z14.object({
10436
+ targetStateId: ContractIdentifierSchema,
10437
+ value: PageExpressionSchema,
10438
+ when: PageExpressionSchema.optional()
10439
+ }).strict()
10440
+ ).max(32).optional(),
10058
10441
  queryWhen: PageStateActivationSchema.optional(),
10059
10442
  accessFailure: z14.literal("render-forbidden").optional(),
10060
10443
  resultStateBindings: z14.array(QueryResultStateBindingSchema).max(32).optional(),
@@ -10063,27 +10446,88 @@ var QueryBindingSchema = z14.object({
10063
10446
  cursorWindow: CursorWindowBindingSchema.optional(),
10064
10447
  cache: z14.enum(["none", "identity-scoped", "tenant-scoped"]),
10065
10448
  cancelOnChange: z14.boolean(),
10066
- refreshPolicy: z14.object({ intervalMs: z14.number().int().min(1e3).max(3e5), when: PageExpressionSchema.optional() }).strict().optional()
10449
+ refreshPolicy: z14.object({
10450
+ intervalMs: z14.number().int().min(1e3).max(3e5),
10451
+ when: PageExpressionSchema.optional()
10452
+ }).strict().optional()
10067
10453
  }).strict().superRefine((value, context) => {
10068
10454
  if (value.targetProjection) {
10069
- if (value.targetProjection.schemaRevisionRef.kind !== "schema") context.addIssue({ code: "custom", path: ["targetProjection", "schemaRevisionRef"], message: "Query target projections require an exact target schema revision." });
10070
- for (const read of collectExternalPageExpressionReads(value.targetProjection.expression)) if (read.root !== "model") context.addIssue({ code: "custom", path: ["targetProjection", "expression"], message: "Query target projections may read only the validated raw model." });
10455
+ if (value.targetProjection.schemaRevisionRef.kind !== "schema")
10456
+ context.addIssue({
10457
+ code: "custom",
10458
+ path: ["targetProjection", "schemaRevisionRef"],
10459
+ message: "Query target projections require an exact target schema revision."
10460
+ });
10461
+ for (const read of collectExternalPageExpressionReads(
10462
+ value.targetProjection.expression
10463
+ ))
10464
+ if (read.root !== "model")
10465
+ context.addIssue({
10466
+ code: "custom",
10467
+ path: ["targetProjection", "expression"],
10468
+ message: "Query target projections may read only the validated raw model."
10469
+ });
10071
10470
  }
10072
10471
  if (value.streamTargetProjection) {
10073
10472
  const projection = value.streamTargetProjection;
10074
- if (projection.schemaRevisionRef.kind !== "schema") context.addIssue({ code: "custom", path: ["streamTargetProjection", "schemaRevisionRef"], message: "Stream target projections require an exact target schema revision." });
10075
- for (const read of collectExternalPageExpressionReads(projection.expression)) if (read.root !== "model") context.addIssue({ code: "custom", path: ["streamTargetProjection", "expression"], message: "Stream target projections may read only the verified query and stream envelope." });
10076
- if (value.execution !== "server" || value.pagination !== "none") context.addIssue({ code: "custom", path: ["streamTargetProjection"], message: "Stream target projections require a non-paginated Server query." });
10473
+ if (projection.schemaRevisionRef.kind !== "schema")
10474
+ context.addIssue({
10475
+ code: "custom",
10476
+ path: ["streamTargetProjection", "schemaRevisionRef"],
10477
+ message: "Stream target projections require an exact target schema revision."
10478
+ });
10479
+ for (const read of collectExternalPageExpressionReads(
10480
+ projection.expression
10481
+ ))
10482
+ if (read.root !== "model")
10483
+ context.addIssue({
10484
+ code: "custom",
10485
+ path: ["streamTargetProjection", "expression"],
10486
+ message: "Stream target projections may read only the verified query and stream envelope."
10487
+ });
10488
+ if (value.execution !== "server" || value.pagination !== "none")
10489
+ context.addIssue({
10490
+ code: "custom",
10491
+ path: ["streamTargetProjection"],
10492
+ message: "Stream target projections require a non-paginated Server query."
10493
+ });
10077
10494
  }
10078
10495
  const effects = value.stateEffects ?? [];
10079
- if (new Set(effects.map((effect) => effect.targetStateId)).size !== effects.length) context.addIssue({ code: "custom", path: ["stateEffects"], message: "A query completion may update each state only once." });
10080
- for (const [index, effect] of effects.entries()) for (const expression of [effect.value, ...effect.when ? [effect.when] : []]) {
10081
- for (const read of collectPageExpressionReads(expression)) if (!["model", "state", "scope"].includes(read.root)) context.addIssue({ code: "custom", path: ["stateEffects", index], message: "Query state effects may read only model, state, and scope." });
10082
- }
10083
- if (effects.length && (value.execution !== "server" || value.pagination !== "none")) context.addIssue({ code: "custom", path: ["stateEffects"], message: "Query state effects require a non-paginated Server query." });
10496
+ if (new Set(effects.map((effect) => effect.targetStateId)).size !== effects.length)
10497
+ context.addIssue({
10498
+ code: "custom",
10499
+ path: ["stateEffects"],
10500
+ message: "A query completion may update each state only once."
10501
+ });
10502
+ for (const [index, effect] of effects.entries())
10503
+ for (const expression of [
10504
+ effect.value,
10505
+ ...effect.when ? [effect.when] : []
10506
+ ]) {
10507
+ for (const read of collectPageExpressionReads(expression))
10508
+ if (!["model", "state", "scope"].includes(read.root))
10509
+ context.addIssue({
10510
+ code: "custom",
10511
+ path: ["stateEffects", index],
10512
+ message: "Query state effects may read only model, state, and scope."
10513
+ });
10514
+ }
10515
+ if (effects.length && (value.execution !== "server" || value.pagination !== "none"))
10516
+ context.addIssue({
10517
+ code: "custom",
10518
+ path: ["stateEffects"],
10519
+ message: "Query state effects require a non-paginated Server query."
10520
+ });
10084
10521
  if (value.refreshPolicy?.when) {
10085
- for (const read of collectExternalPageExpressionReads(value.refreshPolicy.when)) {
10086
- if (read.root !== "model" && !(read.root === "actions" && read.path.length === 2 && read.path[1] === "pending")) context.addIssue({ code: "custom", path: ["refreshPolicy", "when"], message: "Automatic refresh conditions may read only the verified raw model and declared action pending state." });
10522
+ for (const read of collectExternalPageExpressionReads(
10523
+ value.refreshPolicy.when
10524
+ )) {
10525
+ if (read.root !== "model" && !(read.root === "actions" && read.path.length === 2 && read.path[1] === "pending"))
10526
+ context.addIssue({
10527
+ code: "custom",
10528
+ path: ["refreshPolicy", "when"],
10529
+ message: "Automatic refresh conditions may read only the verified raw model and declared action pending state."
10530
+ });
10087
10531
  }
10088
10532
  }
10089
10533
  if (value.refreshPolicy && (value.execution !== "server" || value.pagination !== "none")) {
@@ -10159,15 +10603,31 @@ var CapabilityInstanceSchema = z14.object({
10159
10603
  propertySchemaRevisionRef: RevisionRefSchema,
10160
10604
  properties: JsonObjectSchema,
10161
10605
  propertyBindings: z14.array(PagePropertyBindingSchema).max(128).optional(),
10162
- eventPayloadBindings: z14.array(z14.object({ port: ContractIdentifierSchema, expression: PageExpressionSchema }).strict()).max(32).optional(),
10163
- eventEffects: z14.array(z14.object({
10164
- sourcePort: ContractIdentifierSchema,
10165
- sourceIntentSchemaRevisionRef: RevisionRefSchema,
10166
- refreshBindingIds: z14.array(ContractIdentifierSchema).min(1).max(128)
10167
- }).strict()).max(32).optional(),
10606
+ eventPayloadBindings: z14.array(
10607
+ z14.object({
10608
+ port: ContractIdentifierSchema,
10609
+ expression: PageExpressionSchema
10610
+ }).strict()
10611
+ ).max(32).optional(),
10612
+ eventEffects: z14.array(
10613
+ z14.object({
10614
+ sourcePort: ContractIdentifierSchema,
10615
+ sourceIntentSchemaRevisionRef: RevisionRefSchema,
10616
+ refreshBindingIds: z14.array(ContractIdentifierSchema).min(1).max(128)
10617
+ }).strict()
10618
+ ).max(32).optional(),
10168
10619
  accessPolicy: AccessPolicySchema.optional(),
10169
10620
  activationWhen: PageStateActivationSchema.optional(),
10170
- allowedSideEffects: z14.array(z14.enum(["network", "storage", "navigation", "clipboard", "worker", "websocket"]))
10621
+ allowedSideEffects: z14.array(
10622
+ z14.enum([
10623
+ "network",
10624
+ "storage",
10625
+ "navigation",
10626
+ "clipboard",
10627
+ "worker",
10628
+ "websocket"
10629
+ ])
10630
+ )
10171
10631
  }).strict();
10172
10632
  var OntologyBindingSchema = z14.object({
10173
10633
  bindingId: ContractIdentifierSchema,
@@ -10199,7 +10659,10 @@ var OntologyBindingSchema = z14.object({
10199
10659
  message: "Ontology bindings require an exact canonical data.view revision."
10200
10660
  });
10201
10661
  }
10202
- if (exactRevisionRef(value.viewRevisionRef, value.canonicalDataViewRevisionRef)) {
10662
+ if (exactRevisionRef(
10663
+ value.viewRevisionRef,
10664
+ value.canonicalDataViewRevisionRef
10665
+ )) {
10203
10666
  context.addIssue({
10204
10667
  code: "custom",
10205
10668
  path: ["canonicalDataViewRevisionRef"],
@@ -10221,17 +10684,20 @@ var OntologyBindingSchema = z14.object({
10221
10684
  });
10222
10685
  }
10223
10686
  });
10224
- var ActionResultBindingEffectSourceSchema = z14.discriminatedUnion("kind", [
10225
- z14.object({
10226
- kind: z14.literal("result-field"),
10227
- path: z14.string().trim().regex(/^[A-Za-z0-9_.-]+$/)
10228
- }).strict(),
10229
- z14.object({ kind: z14.literal("constant"), value: JsonValueSchema }).strict(),
10230
- z14.object({
10231
- kind: z14.literal("collection-length"),
10232
- offset: z14.number().int().min(-1e3).max(1e3)
10233
- }).strict()
10234
- ]);
10687
+ var ActionResultBindingEffectSourceSchema = z14.discriminatedUnion(
10688
+ "kind",
10689
+ [
10690
+ z14.object({
10691
+ kind: z14.literal("result-field"),
10692
+ path: z14.string().trim().regex(/^[A-Za-z0-9_.-]+$/)
10693
+ }).strict(),
10694
+ z14.object({ kind: z14.literal("constant"), value: JsonValueSchema }).strict(),
10695
+ z14.object({
10696
+ kind: z14.literal("collection-length"),
10697
+ offset: z14.number().int().min(-1e3).max(1e3)
10698
+ }).strict()
10699
+ ]
10700
+ );
10235
10701
  var ActionResultBindingEffectSchema = z14.object({
10236
10702
  bindingId: ContractIdentifierSchema,
10237
10703
  operation: z14.enum(["upsert-append", "remove-exact"]),
@@ -10244,7 +10710,9 @@ var ActionResultBindingEffectSchema = z14.object({
10244
10710
  }).strict()
10245
10711
  ).min(1).max(64)
10246
10712
  }).strict().superRefine((value, context) => {
10247
- const targetPaths = value.mappings.map(({ targetPath }) => targetPath.join("."));
10713
+ const targetPaths = value.mappings.map(
10714
+ ({ targetPath }) => targetPath.join(".")
10715
+ );
10248
10716
  if (new Set(targetPaths).size !== targetPaths.length) {
10249
10717
  context.addIssue({
10250
10718
  code: "custom",
@@ -10306,17 +10774,30 @@ var ActionBindingSchema = z14.object({
10306
10774
  inputSchemaRevisionRef: RevisionRefSchema,
10307
10775
  when: PageExpressionSchema.optional(),
10308
10776
  fileInputs: z14.array(ActionFileInputSchema).min(1).max(4).optional(),
10309
- inputMapping: z14.record(ContractIdentifierSchema, ActionInputBindingSourceSchema),
10777
+ inputMapping: z14.record(
10778
+ ContractIdentifierSchema,
10779
+ ActionInputBindingSourceSchema
10780
+ ),
10310
10781
  sensitiveInputPaths: SensitiveResultPathsSchema.optional(),
10311
10782
  accessPolicy: AccessPolicySchema,
10312
10783
  confirmation: I18nTextSchema.optional(),
10313
- idempotencyKeySource: z14.enum(["interaction", "record-and-interaction", "caller-provided"]),
10784
+ idempotencyKeySource: z14.enum([
10785
+ "interaction",
10786
+ "record-and-interaction",
10787
+ "caller-provided"
10788
+ ]),
10314
10789
  compensationCommandRevisionRef: RevisionRefSchema.optional(),
10315
10790
  resultSchemaRevisionRef: RevisionRefSchema,
10316
10791
  success: z14.object({
10317
10792
  download: z14.discriminatedUnion("kind", [
10318
10793
  z14.object({ kind: z14.literal("native") }).strict(),
10319
- z14.object({ kind: z14.literal("text-artifact"), fileNamePath: PageValuePathSchema.min(1), mimeTypePath: PageValuePathSchema.min(1), contentPath: PageValuePathSchema.min(1), maxBytes: z14.number().int().min(1).max(1048576) }).strict()
10794
+ z14.object({
10795
+ kind: z14.literal("text-artifact"),
10796
+ fileNamePath: PageValuePathSchema.min(1),
10797
+ mimeTypePath: PageValuePathSchema.min(1),
10798
+ contentPath: PageValuePathSchema.min(1),
10799
+ maxBytes: z14.number().int().min(1).max(1048576)
10800
+ }).strict()
10320
10801
  ]).optional(),
10321
10802
  refreshBindingIds: z14.array(ContractIdentifierSchema),
10322
10803
  ephemeralResult: z14.object({
@@ -10338,19 +10819,55 @@ var ActionBindingSchema = z14.object({
10338
10819
  }).strict().superRefine((value, context) => {
10339
10820
  const fileIds = /* @__PURE__ */ new Set();
10340
10821
  for (const file of value.fileInputs ?? []) {
10341
- if (fileIds.has(file.inputId)) context.addIssue({ code: "custom", path: ["fileInputs"], message: "File input ids must be unique." });
10822
+ if (fileIds.has(file.inputId))
10823
+ context.addIssue({
10824
+ code: "custom",
10825
+ path: ["fileInputs"],
10826
+ message: "File input ids must be unique."
10827
+ });
10342
10828
  fileIds.add(file.inputId);
10343
- if (!Object.values(value.inputMapping).some((source) => source.kind === "file-field" && source.fileInputId === file.inputId)) context.addIssue({ code: "custom", path: ["fileInputs"], message: "File inputs require an explicit governed input mapping." });
10344
- }
10345
- for (const [name, source] of Object.entries(value.inputMapping)) if (source.kind === "file-field") {
10346
- const file = value.fileInputs?.find((file2) => file2.inputId === source.fileInputId);
10347
- if (source.path === "canonicalUri" && !file?.upload || source.path === "content" && file?.upload) context.addIssue({ code: "custom", path: ["inputMapping", name], message: "File field must match its declared transport mode." });
10348
- if (!fileIds.has(source.fileInputId)) context.addIssue({ code: "custom", path: ["inputMapping", name], message: "File fields must reference a declared file input." });
10349
- if (source.path === "content" && !value.sensitiveInputPaths?.includes(`/${name}`)) context.addIssue({ code: "custom", path: ["sensitiveInputPaths"], message: "File content must be declared as a sensitive command input." });
10350
- }
10351
- if (value.when) for (const read of collectPageExpressionReads(value.when)) {
10352
- if (!["intent", "state", "scope"].includes(read.root)) context.addIssue({ code: "custom", path: ["when"], message: "Action conditions may read only intent, declared Page state, and instance scope." });
10829
+ if (!Object.values(value.inputMapping).some(
10830
+ (source) => source.kind === "file-field" && source.fileInputId === file.inputId
10831
+ ))
10832
+ context.addIssue({
10833
+ code: "custom",
10834
+ path: ["fileInputs"],
10835
+ message: "File inputs require an explicit governed input mapping."
10836
+ });
10353
10837
  }
10838
+ for (const [name, source] of Object.entries(value.inputMapping))
10839
+ if (source.kind === "file-field") {
10840
+ const file = value.fileInputs?.find(
10841
+ (file2) => file2.inputId === source.fileInputId
10842
+ );
10843
+ if (source.path === "canonicalUri" && !file?.upload || source.path === "content" && file?.upload)
10844
+ context.addIssue({
10845
+ code: "custom",
10846
+ path: ["inputMapping", name],
10847
+ message: "File field must match its declared transport mode."
10848
+ });
10849
+ if (!fileIds.has(source.fileInputId))
10850
+ context.addIssue({
10851
+ code: "custom",
10852
+ path: ["inputMapping", name],
10853
+ message: "File fields must reference a declared file input."
10854
+ });
10855
+ if (source.path === "content" && !value.sensitiveInputPaths?.includes(`/${name}`))
10856
+ context.addIssue({
10857
+ code: "custom",
10858
+ path: ["sensitiveInputPaths"],
10859
+ message: "File content must be declared as a sensitive command input."
10860
+ });
10861
+ }
10862
+ if (value.when)
10863
+ for (const read of collectPageExpressionReads(value.when)) {
10864
+ if (!["intent", "state", "scope"].includes(read.root))
10865
+ context.addIssue({
10866
+ code: "custom",
10867
+ path: ["when"],
10868
+ message: "Action conditions may read only intent, declared Page state, and instance scope."
10869
+ });
10870
+ }
10354
10871
  if (value.success.ephemeralResult) {
10355
10872
  const { valuePath, labelPath } = value.success.ephemeralResult;
10356
10873
  const segments = (path) => path.split("/").slice(1);
@@ -10480,7 +10997,9 @@ var PageMigrationEquivalenceSchema = z14.object({
10480
10997
  message: "Migration equivalence scenario identities must be unique."
10481
10998
  });
10482
10999
  }
10483
- const viewportIds = new Set(value.viewports.map((viewport) => viewport.viewportId));
11000
+ const viewportIds = new Set(
11001
+ value.viewports.map((viewport) => viewport.viewportId)
11002
+ );
10484
11003
  value.scenarios.forEach((scenario, index) => {
10485
11004
  scenario.viewportIds.forEach((viewportId, viewportIndex) => {
10486
11005
  if (!viewportIds.has(viewportId)) {
@@ -10526,7 +11045,165 @@ var PageRouteStatePresentationSchema = z14.object({
10526
11045
  });
10527
11046
  });
10528
11047
  });
11048
+ var PageStateSchema = PageStateDefinitionSchema.omit({
11049
+ schemaRevisionRef: true
11050
+ }).extend({
11051
+ stateId: ContractIdentifierSchema,
11052
+ schema: ContractIdentifierSchema
11053
+ }).strict();
11054
+ var PageEntryTargetSchema = z14.object({
11055
+ kind: z14.enum(["page", "workbench"]),
11056
+ id: ContractIdentifierSchema
11057
+ }).strict();
11058
+ var PageEntrySchema = PageEntryTransitionSchema.omit({
11059
+ targetRef: true
11060
+ }).extend({
11061
+ target: PageEntryTargetSchema
11062
+ }).strict();
11063
+ var PageInteractionSchema = InteractionBindingSchema.omit({
11064
+ source: true,
11065
+ sourceIntentSchemaRevisionRef: true,
11066
+ sourceResultSchemaRevisionRef: true
11067
+ }).extend({
11068
+ port: ContractIdentifierSchema
11069
+ }).strict();
11070
+ var PageCursorWindowSchema = CursorWindowBindingSchema.omit({
11071
+ pageChangeIntentSchemaRevisionRef: true
11072
+ }).strict();
11073
+ var PageResultStateBindingSchema = QueryResultStateBindingSchema.omit({
11074
+ targetStateSchemaRevisionRef: true
11075
+ }).strict();
11076
+ var PageDataSchema = QueryBindingSchema.omit({
11077
+ queryDefinitionRevisionRef: true,
11078
+ target: true,
11079
+ renderModelSchemaRevisionRef: true,
11080
+ targetProjection: true,
11081
+ streamTargetProjection: true,
11082
+ cursorWindow: true,
11083
+ resultStateBindings: true
11084
+ }).extend({
11085
+ query: ContractIdentifierSchema,
11086
+ port: ContractIdentifierSchema,
11087
+ targetProjection: z14.object({ expression: PageExpressionSchema }).strict().optional(),
11088
+ streamTargetProjection: z14.object({ expression: PageExpressionSchema }).strict().optional(),
11089
+ cursorWindow: PageCursorWindowSchema.optional(),
11090
+ resultStateBindings: z14.array(PageResultStateBindingSchema).max(32).optional()
11091
+ }).strict();
11092
+ var PageActionSchema = ActionBindingSchema.omit({
11093
+ commandRevisionRef: true,
11094
+ source: true,
11095
+ sourceIntentSchemaRevisionRef: true,
11096
+ inputSchemaRevisionRef: true,
11097
+ compensationCommandRevisionRef: true,
11098
+ resultSchemaRevisionRef: true
11099
+ }).extend({
11100
+ command: ContractIdentifierSchema,
11101
+ port: ContractIdentifierSchema,
11102
+ compensationCommand: ContractIdentifierSchema.optional()
11103
+ }).strict();
11104
+ var PageEventEffectSchema = z14.object({
11105
+ port: ContractIdentifierSchema,
11106
+ refresh: z14.array(ContractIdentifierSchema).min(1).max(128)
11107
+ }).strict();
11108
+ var PageNodeSchema = z14.lazy(
11109
+ () => z14.object({
11110
+ id: ContractIdentifierSchema,
11111
+ component: ContractIdentifierSchema,
11112
+ kind: RenderNodeKindSchema.optional(),
11113
+ slot: ContractIdentifierSchema.optional(),
11114
+ props: JsonObjectSchema.optional(),
11115
+ bindings: z14.array(PagePropertyBindingSchema).max(128).optional(),
11116
+ model: JsonObjectSchema.optional(),
11117
+ style: RenderStyleSchema.optional(),
11118
+ layout: RenderLayoutSchema.optional(),
11119
+ responsive: z14.array(RenderResponsiveRuleSchema).optional(),
11120
+ surface: RenderSurfaceSchema.optional(),
11121
+ scroll: RenderScrollSchema.optional(),
11122
+ activation: RenderActivationSchema.optional(),
11123
+ lifecycle: RenderLifecycleSchema.optional(),
11124
+ state: RenderNodeStateSchema.optional(),
11125
+ access: AccessPolicySchema.optional(),
11126
+ activeWhen: PageStateActivationSchema.optional(),
11127
+ repeat: z14.object({
11128
+ source: PageExpressionSchema,
11129
+ keyPath: PageValuePathSchema.min(1),
11130
+ limit: z14.number().int().min(1).max(1e3).optional()
11131
+ }).strict().optional(),
11132
+ data: z14.array(PageDataSchema).optional(),
11133
+ actions: z14.array(PageActionSchema).optional(),
11134
+ on: z14.array(PageInteractionSchema).optional(),
11135
+ effects: z14.array(PageEventEffectSchema).optional(),
11136
+ eventPayloads: z14.array(
11137
+ z14.object({
11138
+ port: ContractIdentifierSchema,
11139
+ expression: PageExpressionSchema
11140
+ }).strict()
11141
+ ).optional(),
11142
+ children: z14.array(PageNodeSchema).optional()
11143
+ }).strict()
11144
+ );
10529
11145
  var PageSchema = z14.object({
11146
+ contract: z14.literal("Page"),
11147
+ schemaVersion: z14.literal(DECLARATIVE_CONTROL_SCHEMA_VERSION),
11148
+ pageId: ContractIdentifierSchema,
11149
+ tenantScope: TenantScopeSchema,
11150
+ identity: IdentitySchema,
11151
+ surface: ProductSurfaceSchema,
11152
+ route: RoutePathTemplateSchema,
11153
+ routeSpace: ContractIdentifierSchema.optional(),
11154
+ lifecycle: DeclarativeLifecycleSchema.default("active"),
11155
+ routeStatePresentations: z14.array(PageRouteStatePresentationSchema).max(8).optional(),
11156
+ shell: ContractIdentifierSchema.optional(),
11157
+ body: PageNodeSchema,
11158
+ state: z14.array(PageStateSchema).optional(),
11159
+ entryTransitions: z14.array(PageEntrySchema).optional(),
11160
+ access: AccessPolicySchema,
11161
+ managementAccess: ManagementAccessSchema,
11162
+ tokens: z14.array(ContractIdentifierSchema).optional(),
11163
+ performanceBudget: ContractIdentifierSchema.optional(),
11164
+ observationPolicy: ContractIdentifierSchema.optional(),
11165
+ privacyClassification: z14.enum(["public", "internal", "confidential", "restricted"]).default("internal")
11166
+ }).strict().superRefine((page, context) => {
11167
+ const ids = /* @__PURE__ */ new Set();
11168
+ const dataIds = /* @__PURE__ */ new Set();
11169
+ const actionIds = /* @__PURE__ */ new Set();
11170
+ const interactionIds = /* @__PURE__ */ new Set();
11171
+ const visit = (node, path) => {
11172
+ if (ids.has(node.id))
11173
+ context.addIssue({
11174
+ code: "custom",
11175
+ path: [...path, "id"],
11176
+ message: `Duplicate Page node id ${node.id}.`
11177
+ });
11178
+ ids.add(node.id);
11179
+ for (const [field, values, target] of [
11180
+ ["data", node.data ?? [], dataIds],
11181
+ ["actions", node.actions ?? [], actionIds],
11182
+ ["on", node.on ?? [], interactionIds]
11183
+ ])
11184
+ for (const [index, value] of values.entries()) {
11185
+ if (target.has(value.bindingId))
11186
+ context.addIssue({
11187
+ code: "custom",
11188
+ path: [...path, field, index, "bindingId"],
11189
+ message: `Duplicate Page binding id ${value.bindingId}.`
11190
+ });
11191
+ target.add(value.bindingId);
11192
+ }
11193
+ (node.children ?? []).forEach(
11194
+ (child, index) => visit(child, [...path, "children", index])
11195
+ );
11196
+ };
11197
+ visit(page.body, ["body"]);
11198
+ const stateIds = (page.state ?? []).map((entry) => entry.stateId);
11199
+ if (new Set(stateIds).size !== stateIds.length)
11200
+ context.addIssue({
11201
+ code: "custom",
11202
+ path: ["state"],
11203
+ message: "Page state ids must be unique."
11204
+ });
11205
+ });
11206
+ var ResolvedPageSchema = z14.object({
10530
11207
  contract: z14.literal("Page"),
10531
11208
  schemaVersion: z14.literal(DECLARATIVE_CONTROL_SCHEMA_VERSION),
10532
11209
  pageId: ContractIdentifierSchema,
@@ -10537,7 +11214,12 @@ var PageSchema = z14.object({
10537
11214
  legacyRoutePolicy: LegacyRoutePolicySchema.optional(),
10538
11215
  migrationEquivalence: PageMigrationEquivalenceSchema.optional(),
10539
11216
  routeStatePresentations: z14.array(PageRouteStatePresentationSchema).max(8).optional(),
10540
- routeClaims: z14.array(z14.union([DeclarativeRouteClaimSchema, LegacyDeclarativeRouteClaimSchema])).min(1),
11217
+ routeClaims: z14.array(
11218
+ z14.union([
11219
+ DeclarativeRouteClaimSchema,
11220
+ LegacyDeclarativeRouteClaimSchema
11221
+ ])
11222
+ ).min(1),
10541
11223
  shellRevisionRef: RevisionRefSchema,
10542
11224
  renderTree: RenderTreeSchema,
10543
11225
  capabilityInstances: z14.array(CapabilityInstanceSchema).min(1),
@@ -10552,11 +11234,23 @@ var PageSchema = z14.object({
10552
11234
  tokenRevisionRefs: z14.array(RevisionRefSchema).min(1),
10553
11235
  performanceBudgetRef: RevisionRefSchema,
10554
11236
  observationPolicyRevisionRef: RevisionRefSchema,
10555
- privacyClassification: z14.enum(["public", "internal", "confidential", "restricted"])
11237
+ privacyClassification: z14.enum([
11238
+ "public",
11239
+ "internal",
11240
+ "confidential",
11241
+ "restricted"
11242
+ ])
10556
11243
  }).strict().superRefine((value, context) => {
10557
- validateDeclaredRouteSurfaces(value.supportedSurfaces, value.routeClaims, context);
11244
+ validateDeclaredRouteSurfaces(
11245
+ value.supportedSurfaces,
11246
+ value.routeClaims,
11247
+ context
11248
+ );
10558
11249
  const routeStatePresentations = value.routeStatePresentations ?? [];
10559
- if (uniqueArray(routeStatePresentations, (candidate) => `${candidate.surface}:${candidate.state}`)) {
11250
+ if (uniqueArray(
11251
+ routeStatePresentations,
11252
+ (candidate) => `${candidate.surface}:${candidate.state}`
11253
+ )) {
10560
11254
  context.addIssue({
10561
11255
  code: "custom",
10562
11256
  path: ["routeStatePresentations"],
@@ -10578,18 +11272,27 @@ var PageSchema = z14.object({
10578
11272
  const queryBindings = value.queryBindings ?? [];
10579
11273
  stateDefinitions.forEach((definition, index) => {
10580
11274
  const partitionStateId = definition.preferencePartitionStateId;
10581
- const dynamicLegacySegments = definition.legacyBrowserPreferenceImport?.jsonPath?.filter((segment) => typeof segment !== "string") ?? [];
11275
+ const dynamicLegacySegments = definition.legacyBrowserPreferenceImport?.jsonPath?.filter(
11276
+ (segment) => typeof segment !== "string"
11277
+ ) ?? [];
10582
11278
  if (!partitionStateId) {
10583
11279
  if (dynamicLegacySegments.length > 0) {
10584
11280
  context.addIssue({
10585
11281
  code: "custom",
10586
- path: ["stateDefinitions", index, "legacyBrowserPreferenceImport", "jsonPath"],
11282
+ path: [
11283
+ "stateDefinitions",
11284
+ index,
11285
+ "legacyBrowserPreferenceImport",
11286
+ "jsonPath"
11287
+ ],
10587
11288
  message: "A dynamic legacy preference path requires a declared preference partition state."
10588
11289
  });
10589
11290
  }
10590
11291
  return;
10591
11292
  }
10592
- const partitionDefinition = stateDefinitions.find((candidate) => candidate.stateId === partitionStateId);
11293
+ const partitionDefinition = stateDefinitions.find(
11294
+ (candidate) => candidate.stateId === partitionStateId
11295
+ );
10593
11296
  if (partitionStateId === definition.stateId || !partitionDefinition || partitionDefinition.preferencePartitionStateId) {
10594
11297
  context.addIssue({
10595
11298
  code: "custom",
@@ -10597,24 +11300,60 @@ var PageSchema = z14.object({
10597
11300
  message: "Preference partitioning must reference a distinct, non-partitioned Page state."
10598
11301
  });
10599
11302
  }
10600
- definition.legacyBrowserPreferenceImport?.jsonPath?.forEach((segment, segmentIndex) => {
10601
- if (typeof segment !== "string" && segment.stateId !== partitionStateId) {
10602
- context.addIssue({
10603
- code: "custom",
10604
- path: ["stateDefinitions", index, "legacyBrowserPreferenceImport", "jsonPath", segmentIndex],
10605
- message: "A dynamic legacy preference path must use the declared preference partition state."
10606
- });
11303
+ definition.legacyBrowserPreferenceImport?.jsonPath?.forEach(
11304
+ (segment, segmentIndex) => {
11305
+ if (typeof segment !== "string" && segment.stateId !== partitionStateId) {
11306
+ context.addIssue({
11307
+ code: "custom",
11308
+ path: [
11309
+ "stateDefinitions",
11310
+ index,
11311
+ "legacyBrowserPreferenceImport",
11312
+ "jsonPath",
11313
+ segmentIndex
11314
+ ],
11315
+ message: "A dynamic legacy preference path must use the declared preference partition state."
11316
+ });
11317
+ }
10607
11318
  }
10608
- });
11319
+ );
10609
11320
  });
10610
11321
  const uniqueness = [
10611
- ["capabilityInstances", value.capabilityInstances, (candidate) => String(candidate.instanceId)],
10612
- ["stateDefinitions", stateDefinitions, (candidate) => String(candidate.stateId)],
10613
- ["entryTransitions", entryTransitions, (candidate) => String(candidate.transitionId)],
10614
- ["interactionBindings", interactionBindings, (candidate) => String(candidate.bindingId)],
10615
- ["ontologyBindings", value.ontologyBindings, (candidate) => String(candidate.bindingId)],
10616
- ["queryBindings", queryBindings, (candidate) => String(candidate.bindingId)],
10617
- ["actionBindings", value.actionBindings, (candidate) => String(candidate.bindingId)]
11322
+ [
11323
+ "capabilityInstances",
11324
+ value.capabilityInstances,
11325
+ (candidate) => String(candidate.instanceId)
11326
+ ],
11327
+ [
11328
+ "stateDefinitions",
11329
+ stateDefinitions,
11330
+ (candidate) => String(candidate.stateId)
11331
+ ],
11332
+ [
11333
+ "entryTransitions",
11334
+ entryTransitions,
11335
+ (candidate) => String(candidate.transitionId)
11336
+ ],
11337
+ [
11338
+ "interactionBindings",
11339
+ interactionBindings,
11340
+ (candidate) => String(candidate.bindingId)
11341
+ ],
11342
+ [
11343
+ "ontologyBindings",
11344
+ value.ontologyBindings,
11345
+ (candidate) => String(candidate.bindingId)
11346
+ ],
11347
+ [
11348
+ "queryBindings",
11349
+ queryBindings,
11350
+ (candidate) => String(candidate.bindingId)
11351
+ ],
11352
+ [
11353
+ "actionBindings",
11354
+ value.actionBindings,
11355
+ (candidate) => String(candidate.bindingId)
11356
+ ]
10618
11357
  ];
10619
11358
  uniqueness.forEach(([field, values, identity]) => {
10620
11359
  if (uniqueArray(values, identity))
@@ -10624,49 +11363,132 @@ var PageSchema = z14.object({
10624
11363
  message: `${field} identities must be unique.`
10625
11364
  });
10626
11365
  });
10627
- const instanceIds = new Set(value.capabilityInstances.map((instance) => instance.instanceId));
11366
+ const instanceIds = new Set(
11367
+ value.capabilityInstances.map((instance) => instance.instanceId)
11368
+ );
10628
11369
  const stateIds = new Set(stateDefinitions.map((state) => state.stateId));
10629
11370
  value.capabilityInstances.forEach((instance, index) => {
10630
11371
  const ports = /* @__PURE__ */ new Set();
10631
11372
  const payloadPorts = /* @__PURE__ */ new Set();
10632
11373
  instance.eventPayloadBindings?.forEach((binding, bindingIndex) => {
10633
- const path = ["capabilityInstances", index, "eventPayloadBindings", bindingIndex];
10634
- if (payloadPorts.has(binding.port)) context.addIssue({ code: "custom", path, message: "An event payload can have only one declarative projection." });
11374
+ const path = [
11375
+ "capabilityInstances",
11376
+ index,
11377
+ "eventPayloadBindings",
11378
+ bindingIndex
11379
+ ];
11380
+ if (payloadPorts.has(binding.port))
11381
+ context.addIssue({
11382
+ code: "custom",
11383
+ path,
11384
+ message: "An event payload can have only one declarative projection."
11385
+ });
10635
11386
  payloadPorts.add(binding.port);
10636
11387
  for (const read of collectPageExpressionReads(binding.expression)) {
10637
- if (read.root === "actions" || read.root === "result" || read.root === "state" && !stateIds.has(read.path[0] ?? "") || read.root === "bindings" && ![...value.ontologyBindings, ...queryBindings].some((candidate) => candidate.bindingId === read.path[0])) context.addIssue({ code: "custom", path, message: "Event payload projections require local event, model, scope, declared query results, or declared state." });
11388
+ if (read.root === "actions" || read.root === "result" || read.root === "state" && !stateIds.has(read.path[0] ?? "") || read.root === "bindings" && ![...value.ontologyBindings, ...queryBindings].some(
11389
+ (candidate) => candidate.bindingId === read.path[0]
11390
+ ))
11391
+ context.addIssue({
11392
+ code: "custom",
11393
+ path,
11394
+ message: "Event payload projections require local event, model, scope, declared query results, or declared state."
11395
+ });
10638
11396
  }
10639
11397
  });
10640
11398
  instance.eventEffects?.forEach((effect, effectIndex) => {
10641
- const path = ["capabilityInstances", index, "eventEffects", effectIndex];
10642
- if (effect.sourceIntentSchemaRevisionRef.kind !== "schema" || ports.has(effect.sourcePort)) context.addIssue({ code: "custom", path, message: "Event effects require one exact source schema per output port." });
11399
+ const path = [
11400
+ "capabilityInstances",
11401
+ index,
11402
+ "eventEffects",
11403
+ effectIndex
11404
+ ];
11405
+ if (effect.sourceIntentSchemaRevisionRef.kind !== "schema" || ports.has(effect.sourcePort))
11406
+ context.addIssue({
11407
+ code: "custom",
11408
+ path,
11409
+ message: "Event effects require one exact source schema per output port."
11410
+ });
10643
11411
  ports.add(effect.sourcePort);
10644
- if (value.actionBindings.some((binding) => binding.source.capabilityInstanceId === instance.instanceId && binding.source.port === effect.sourcePort)) context.addIssue({ code: "custom", path, message: "An Action output port must declare refresh effects through Action.success." });
10645
- for (const id of effect.refreshBindingIds) if (![...value.ontologyBindings, ...queryBindings].some((binding) => binding.bindingId === id)) context.addIssue({ code: "custom", path, message: "Event effect references an unknown query binding." });
11412
+ if (value.actionBindings.some(
11413
+ (binding) => binding.source.capabilityInstanceId === instance.instanceId && binding.source.port === effect.sourcePort
11414
+ ))
11415
+ context.addIssue({
11416
+ code: "custom",
11417
+ path,
11418
+ message: "An Action output port must declare refresh effects through Action.success."
11419
+ });
11420
+ for (const id of effect.refreshBindingIds)
11421
+ if (![...value.ontologyBindings, ...queryBindings].some(
11422
+ (binding) => binding.bindingId === id
11423
+ ))
11424
+ context.addIssue({
11425
+ code: "custom",
11426
+ path,
11427
+ message: "Event effect references an unknown query binding."
11428
+ });
10646
11429
  });
10647
11430
  });
10648
- const repeatNodes = new Set(value.renderTree.nodes.filter((node) => node.repeat).map((node) => node.nodeId));
11431
+ const repeatNodes = new Set(
11432
+ value.renderTree.nodes.filter((node) => node.repeat).map((node) => node.nodeId)
11433
+ );
10649
11434
  stateDefinitions.forEach((definition, index) => {
10650
- if (definition.scopeNodeId && !repeatNodes.has(definition.scopeNodeId)) context.addIssue({ code: "custom", path: ["stateDefinitions", index, "scopeNodeId"], message: "Instance state must reference an existing repeated RenderNode." });
11435
+ if (definition.scopeNodeId && !repeatNodes.has(definition.scopeNodeId))
11436
+ context.addIssue({
11437
+ code: "custom",
11438
+ path: ["stateDefinitions", index, "scopeNodeId"],
11439
+ message: "Instance state must reference an existing repeated RenderNode."
11440
+ });
10651
11441
  if (definition.initialValue && !definition.scopeNodeId) {
10652
11442
  const expression = definition.initialValue;
10653
- const source = expression.kind === "read" ? stateDefinitions.find((state) => state.stateId === expression.path[0] && !state.scopeNodeId) : void 0;
10654
- if (!source || source.initialValue || !["tenant-preference", "url-with-tenant-preference"].includes(source.persistence)) context.addIssue({ code: "custom", path: ["stateDefinitions", index, "initialValue"], message: "Root initialization requires an independently hydrated tenant preference; initialization chains are forbidden." });
11443
+ const source = expression.kind === "read" ? stateDefinitions.find(
11444
+ (state) => state.stateId === expression.path[0] && !state.scopeNodeId
11445
+ ) : void 0;
11446
+ if (!source || source.initialValue || !["tenant-preference", "url-with-tenant-preference"].includes(
11447
+ source.persistence
11448
+ ))
11449
+ context.addIssue({
11450
+ code: "custom",
11451
+ path: ["stateDefinitions", index, "initialValue"],
11452
+ message: "Root initialization requires an independently hydrated tenant preference; initialization chains are forbidden."
11453
+ });
10655
11454
  }
10656
11455
  if (definition.initialValue) {
10657
- for (const read of collectPageExpressionReads(definition.initialValue)) {
10658
- if (!["scope", "state"].includes(read.root) || read.root === "state" && !stateDefinitions.some((state) => state.stateId === read.path[0] && !state.scopeNodeId)) context.addIssue({ code: "custom", path: ["stateDefinitions", index, "initialValue"], message: "Instance initial values can read only their item scope and declared Page state." });
11456
+ for (const read of collectPageExpressionReads(
11457
+ definition.initialValue
11458
+ )) {
11459
+ if (!["scope", "state"].includes(read.root) || read.root === "state" && !stateDefinitions.some(
11460
+ (state) => state.stateId === read.path[0] && !state.scopeNodeId
11461
+ ))
11462
+ context.addIssue({
11463
+ code: "custom",
11464
+ path: ["stateDefinitions", index, "initialValue"],
11465
+ message: "Instance initial values can read only their item scope and declared Page state."
11466
+ });
10659
11467
  }
10660
11468
  }
10661
11469
  });
10662
11470
  value.renderTree.nodes.forEach((node, index) => {
10663
11471
  if (!node.repeat) return;
10664
11472
  for (const read of collectPageExpressionReads(node.repeat.source)) {
10665
- if (read.root === "actions" || read.root === "intent" || read.root === "result" || read.root === "model" || read.root === "state" && !stateIds.has(read.path[0] ?? "") || read.root === "bindings" && ![...value.ontologyBindings, ...queryBindings].some((binding) => binding.bindingId === read.path[0])) context.addIssue({ code: "custom", path: ["renderTree", "nodes", index, "repeat", "source"], message: "Repeated nodes require declared Page state, query results, or parent item scope." });
11473
+ if (read.root === "actions" || read.root === "intent" || read.root === "result" || read.root === "model" || read.root === "state" && !stateIds.has(read.path[0] ?? "") || read.root === "bindings" && ![...value.ontologyBindings, ...queryBindings].some(
11474
+ (binding) => binding.bindingId === read.path[0]
11475
+ ))
11476
+ context.addIssue({
11477
+ code: "custom",
11478
+ path: ["renderTree", "nodes", index, "repeat", "source"],
11479
+ message: "Repeated nodes require declared Page state, query results, or parent item scope."
11480
+ });
10666
11481
  }
10667
11482
  });
10668
- const renderNodesById = new Map(value.renderTree.nodes.map((node) => [node.nodeId, node]));
10669
- const instanceNodes = new Map(value.capabilityInstances.map((instance) => [instance.instanceId, instance.nodeId]));
11483
+ const renderNodesById = new Map(
11484
+ value.renderTree.nodes.map((node) => [node.nodeId, node])
11485
+ );
11486
+ const instanceNodes = new Map(
11487
+ value.capabilityInstances.map((instance) => [
11488
+ instance.instanceId,
11489
+ instance.nodeId
11490
+ ])
11491
+ );
10670
11492
  const scopesForNode = (nodeId) => {
10671
11493
  const scopes = /* @__PURE__ */ new Set();
10672
11494
  const visited = /* @__PURE__ */ new Set();
@@ -10678,60 +11500,170 @@ var PageSchema = z14.object({
10678
11500
  }
10679
11501
  return scopes;
10680
11502
  };
10681
- const queryOwners = new Map([...value.ontologyBindings, ...queryBindings].map((binding) => [
10682
- binding.bindingId,
10683
- [...scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId))][0]
10684
- ]));
10685
- const actionScopes = new Map(value.actionBindings.map((binding) => [binding.bindingId, scopesForNode(instanceNodes.get(binding.source.capabilityInstanceId))]));
10686
- const actionOwners = new Map([...actionScopes].map(([id, scopes]) => [id, [...scopes][0]]));
10687
- if (actionOwners.size !== value.actionBindings.length) context.addIssue({ code: "custom", path: ["actionBindings"], message: "Action binding identifiers must be unique." });
11503
+ const queryOwners = new Map(
11504
+ [...value.ontologyBindings, ...queryBindings].map((binding) => [
11505
+ binding.bindingId,
11506
+ [
11507
+ ...scopesForNode(
11508
+ instanceNodes.get(binding.target.capabilityInstanceId)
11509
+ )
11510
+ ][0]
11511
+ ])
11512
+ );
11513
+ const actionScopes = new Map(
11514
+ value.actionBindings.map((binding) => [
11515
+ binding.bindingId,
11516
+ scopesForNode(instanceNodes.get(binding.source.capabilityInstanceId))
11517
+ ])
11518
+ );
11519
+ const actionOwners = new Map(
11520
+ [...actionScopes].map(([id, scopes]) => [id, [...scopes][0]])
11521
+ );
11522
+ if (actionOwners.size !== value.actionBindings.length)
11523
+ context.addIssue({
11524
+ code: "custom",
11525
+ path: ["actionBindings"],
11526
+ message: "Action binding identifiers must be unique."
11527
+ });
10688
11528
  const checkScopedReads = (reads, scopes, path) => {
10689
11529
  for (const read of reads) {
10690
11530
  const owner = read.root === "state" ? stateDefinitions.find((state) => state.stateId === read.path[0])?.scopeNodeId : read.root === "bindings" ? queryOwners.get(read.path[0]) : read.root === "actions" ? actionOwners.get(read.path[0]) : void 0;
10691
- const pendingAggregate = read.root === "actions" && read.path.length === 2 && read.path[1] === "pending" && actionScopes.has(read.path[0]) && [...scopes].every((scope) => actionScopes.get(read.path[0]).has(scope));
10692
- if (owner && !scopes.has(owner) && !pendingAggregate) context.addIssue({ code: "custom", path, message: "A binding cannot read state, query results, or individual action status from a sibling or descendant instance." });
11531
+ const pendingAggregate = read.root === "actions" && read.path.length === 2 && read.path[1] === "pending" && actionScopes.has(read.path[0]) && [...scopes].every(
11532
+ (scope) => actionScopes.get(read.path[0]).has(scope)
11533
+ );
11534
+ if (owner && !scopes.has(owner) && !pendingAggregate)
11535
+ context.addIssue({
11536
+ code: "custom",
11537
+ path,
11538
+ message: "A binding cannot read state, query results, or individual action status from a sibling or descendant instance."
11539
+ });
10693
11540
  }
10694
11541
  };
10695
11542
  const checkScopedSources = (sources, scopes, path) => {
10696
11543
  Object.entries(sources).forEach(([name, source]) => {
10697
- if (source.kind === "expression") checkScopedReads(collectPageExpressionReads(source.expression), scopes, [...path, name]);
10698
- if (source.kind === "page-state") checkScopedReads([{ kind: "read", root: "state", path: [source.stateId] }], scopes, [...path, name]);
10699
- if (source.kind === "binding-field") checkScopedReads([{ kind: "read", root: "bindings", path: [source.bindingId] }], scopes, [...path, name]);
10700
- if (source.kind === "scope-field" && scopes.size === 0) context.addIssue({ code: "custom", path: [...path, name], message: "A scope field requires a repeated instance." });
11544
+ if (source.kind === "expression")
11545
+ checkScopedReads(
11546
+ collectPageExpressionReads(source.expression),
11547
+ scopes,
11548
+ [...path, name]
11549
+ );
11550
+ if (source.kind === "page-state")
11551
+ checkScopedReads(
11552
+ [{ kind: "read", root: "state", path: [source.stateId] }],
11553
+ scopes,
11554
+ [...path, name]
11555
+ );
11556
+ if (source.kind === "binding-field")
11557
+ checkScopedReads(
11558
+ [{ kind: "read", root: "bindings", path: [source.bindingId] }],
11559
+ scopes,
11560
+ [...path, name]
11561
+ );
11562
+ if (source.kind === "scope-field" && scopes.size === 0)
11563
+ context.addIssue({
11564
+ code: "custom",
11565
+ path: [...path, name],
11566
+ message: "A scope field requires a repeated instance."
11567
+ });
10701
11568
  });
10702
11569
  };
10703
- value.capabilityInstances.forEach((instance, index) => instance.eventPayloadBindings?.forEach((binding, bindingIndex) => checkScopedReads(collectPageExpressionReads(binding.expression), scopesForNode(instance.nodeId), ["capabilityInstances", index, "eventPayloadBindings", bindingIndex])));
10704
- value.capabilityInstances.forEach((instance, index) => instance.propertyBindings?.forEach((binding, bindingIndex) => {
10705
- checkScopedReads(collectPageExpressionReads(binding.expression), scopesForNode(instance.nodeId), ["capabilityInstances", index, "propertyBindings", bindingIndex]);
10706
- }));
10707
- for (const [collection, bindings] of [["ontologyBindings", value.ontologyBindings], ["queryBindings", queryBindings]]) {
10708
- bindings.forEach((binding, index) => checkScopedSources(binding.parameters, scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId)), [collection, index, "parameters"]));
11570
+ value.capabilityInstances.forEach(
11571
+ (instance, index) => instance.eventPayloadBindings?.forEach(
11572
+ (binding, bindingIndex) => checkScopedReads(
11573
+ collectPageExpressionReads(binding.expression),
11574
+ scopesForNode(instance.nodeId),
11575
+ ["capabilityInstances", index, "eventPayloadBindings", bindingIndex]
11576
+ )
11577
+ )
11578
+ );
11579
+ value.capabilityInstances.forEach(
11580
+ (instance, index) => instance.propertyBindings?.forEach((binding, bindingIndex) => {
11581
+ checkScopedReads(
11582
+ collectPageExpressionReads(binding.expression),
11583
+ scopesForNode(instance.nodeId),
11584
+ ["capabilityInstances", index, "propertyBindings", bindingIndex]
11585
+ );
11586
+ })
11587
+ );
11588
+ for (const [collection, bindings] of [
11589
+ ["ontologyBindings", value.ontologyBindings],
11590
+ ["queryBindings", queryBindings]
11591
+ ]) {
11592
+ bindings.forEach(
11593
+ (binding, index) => checkScopedSources(
11594
+ binding.parameters,
11595
+ scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId)),
11596
+ [collection, index, "parameters"]
11597
+ )
11598
+ );
10709
11599
  }
10710
11600
  value.actionBindings.forEach((binding, index) => {
10711
- const scopes = scopesForNode(instanceNodes.get(binding.source.capabilityInstanceId));
10712
- checkScopedSources(binding.inputMapping, scopes, ["actionBindings", index, "inputMapping"]);
11601
+ const scopes = scopesForNode(
11602
+ instanceNodes.get(binding.source.capabilityInstanceId)
11603
+ );
11604
+ checkScopedSources(binding.inputMapping, scopes, [
11605
+ "actionBindings",
11606
+ index,
11607
+ "inputMapping"
11608
+ ]);
10713
11609
  for (const [fileIndex, file] of (binding.fileInputs ?? []).entries()) {
10714
11610
  if (file.source.kind === "page-state") {
10715
11611
  const stateId = file.source.stateId;
10716
- const state = stateDefinitions.find((candidate) => candidate.stateId === stateId);
10717
- if (!state || state.persistence !== "none") context.addIssue({ code: "custom", path: ["actionBindings", index, "fileInputs", fileIndex], message: "File handles require declared nonpersistent Page state." });
10718
- checkScopedSources({ file: file.source }, scopes, ["actionBindings", index, "fileInputs", fileIndex]);
11612
+ const state = stateDefinitions.find(
11613
+ (candidate) => candidate.stateId === stateId
11614
+ );
11615
+ if (!state || state.persistence !== "none")
11616
+ context.addIssue({
11617
+ code: "custom",
11618
+ path: ["actionBindings", index, "fileInputs", fileIndex],
11619
+ message: "File handles require declared nonpersistent Page state."
11620
+ });
11621
+ checkScopedSources({ file: file.source }, scopes, [
11622
+ "actionBindings",
11623
+ index,
11624
+ "fileInputs",
11625
+ fileIndex
11626
+ ]);
10719
11627
  }
10720
11628
  }
10721
11629
  if (binding.when) {
10722
11630
  const reads = collectPageExpressionReads(binding.when);
10723
11631
  checkScopedReads(reads, scopes, ["actionBindings", index, "when"]);
10724
- for (const read of reads) if (read.root === "state" && !stateIds.has(read.path[0])) context.addIssue({ code: "custom", path: ["actionBindings", index, "when"], message: "Action condition references an unknown Page state." });
11632
+ for (const read of reads)
11633
+ if (read.root === "state" && !stateIds.has(read.path[0]))
11634
+ context.addIssue({
11635
+ code: "custom",
11636
+ path: ["actionBindings", index, "when"],
11637
+ message: "Action condition references an unknown Page state."
11638
+ });
10725
11639
  }
10726
11640
  });
10727
11641
  interactionBindings.forEach((binding, index) => {
10728
- const sourceScopes = scopesForNode(instanceNodes.get(binding.source.capabilityInstanceId));
10729
- const targetScope = stateDefinitions.find((state) => state.stateId === binding.targetStateId)?.scopeNodeId;
10730
- if (targetScope && !sourceScopes.has(targetScope)) context.addIssue({ code: "custom", path: ["interactionBindings", index, "targetStateId"], message: "An interaction must target its own instance or an ancestor." });
10731
- checkScopedSources(binding.inputMapping, targetScope ? scopesForNode(targetScope) : /* @__PURE__ */ new Set(), ["interactionBindings", index, "inputMapping"]);
11642
+ const sourceScopes = scopesForNode(
11643
+ instanceNodes.get(binding.source.capabilityInstanceId)
11644
+ );
11645
+ const targetScope = stateDefinitions.find(
11646
+ (state) => state.stateId === binding.targetStateId
11647
+ )?.scopeNodeId;
11648
+ if (targetScope && !sourceScopes.has(targetScope))
11649
+ context.addIssue({
11650
+ code: "custom",
11651
+ path: ["interactionBindings", index, "targetStateId"],
11652
+ message: "An interaction must target its own instance or an ancestor."
11653
+ });
11654
+ checkScopedSources(
11655
+ binding.inputMapping,
11656
+ targetScope ? scopesForNode(targetScope) : /* @__PURE__ */ new Set(),
11657
+ ["interactionBindings", index, "inputMapping"]
11658
+ );
10732
11659
  });
10733
11660
  value.renderTree.nodes.forEach((node, index) => {
10734
- if (node.repeat) checkScopedReads(collectPageExpressionReads(node.repeat.source), scopesForNode(node.parentNodeId), ["renderTree", "nodes", index, "repeat", "source"]);
11661
+ if (node.repeat)
11662
+ checkScopedReads(
11663
+ collectPageExpressionReads(node.repeat.source),
11664
+ scopesForNode(node.parentNodeId),
11665
+ ["renderTree", "nodes", index, "repeat", "source"]
11666
+ );
10735
11667
  });
10736
11668
  entryTransitions.forEach((transition, transitionIndex) => {
10737
11669
  if (transition.gestureSource && (!instanceIds.has(transition.gestureSource.capabilityInstanceId) || !interactionBindings.some(
@@ -10750,22 +11682,42 @@ var PageSchema = z14.object({
10750
11682
  message: "A Page cannot route into itself on entry."
10751
11683
  });
10752
11684
  }
10753
- forEachPageStateCondition(transition.activation, (condition, conditionPath) => {
10754
- if (!stateIds.has(condition.stateId)) {
11685
+ forEachPageStateCondition(
11686
+ transition.activation,
11687
+ (condition, conditionPath) => {
11688
+ if (!stateIds.has(condition.stateId)) {
11689
+ context.addIssue({
11690
+ code: "custom",
11691
+ path: [
11692
+ "entryTransitions",
11693
+ transitionIndex,
11694
+ "activation",
11695
+ ...conditionPath,
11696
+ "stateId"
11697
+ ],
11698
+ message: `Entry transition references unknown Page state ${condition.stateId}.`
11699
+ });
11700
+ }
11701
+ }
11702
+ );
11703
+ const declaredRouteParameters = new Set(
11704
+ value.routeClaims.flatMap(
11705
+ (claim) => [...claim.pathTemplate.matchAll(/:([A-Za-z][A-Za-z0-9_-]*)/g)].map(
11706
+ (match) => match[1]
11707
+ )
11708
+ )
11709
+ );
11710
+ for (const source of [
11711
+ ...Object.values(transition.pathParameters),
11712
+ ...Object.values(transition.query.set)
11713
+ ]) {
11714
+ if (source.kind === "route-parameter" && !declaredRouteParameters.has(source.name)) {
10755
11715
  context.addIssue({
10756
11716
  code: "custom",
10757
- path: ["entryTransitions", transitionIndex, "activation", ...conditionPath, "stateId"],
10758
- message: `Entry transition references unknown Page state ${condition.stateId}.`
11717
+ path: ["entryTransitions", transitionIndex],
11718
+ message: `Entry transition references unknown source route parameter ${source.name}.`
10759
11719
  });
10760
11720
  }
10761
- });
10762
- const declaredRouteParameters = new Set(value.routeClaims.flatMap(
10763
- (claim) => [...claim.pathTemplate.matchAll(/:([A-Za-z][A-Za-z0-9_-]*)/g)].map((match) => match[1])
10764
- ));
10765
- for (const source of [...Object.values(transition.pathParameters), ...Object.values(transition.query.set)]) {
10766
- if (source.kind === "route-parameter" && !declaredRouteParameters.has(source.name)) {
10767
- context.addIssue({ code: "custom", path: ["entryTransitions", transitionIndex], message: `Entry transition references unknown source route parameter ${source.name}.` });
10768
- }
10769
11721
  }
10770
11722
  const stateSources = [
10771
11723
  ...Object.values(transition.pathParameters).flatMap(
@@ -10790,7 +11742,11 @@ var PageSchema = z14.object({
10790
11742
  if (source.kind === "expression") {
10791
11743
  for (const read of collectPageExpressionReads(source.expression)) {
10792
11744
  if (read.root === "state" && (!read.path[0] || !stateIds.has(read.path[0])) || read.root === "model" || read.root === "bindings" || read.root === "result" && path[0] !== "interactionBindings") {
10793
- context.addIssue({ code: "custom", path: [...path, name, "expression"], message: "Expression references unavailable context or an undeclared Page state." });
11745
+ context.addIssue({
11746
+ code: "custom",
11747
+ path: [...path, name, "expression"],
11748
+ message: "Expression references unavailable context or an undeclared Page state."
11749
+ });
10794
11750
  }
10795
11751
  }
10796
11752
  }
@@ -10807,7 +11763,12 @@ var PageSchema = z14.object({
10807
11763
  if (!instanceIds.has(binding.source.capabilityInstanceId)) {
10808
11764
  context.addIssue({
10809
11765
  code: "custom",
10810
- path: ["interactionBindings", index, "source", "capabilityInstanceId"],
11766
+ path: [
11767
+ "interactionBindings",
11768
+ index,
11769
+ "source",
11770
+ "capabilityInstanceId"
11771
+ ],
10811
11772
  message: "Interaction binding sources an unknown capability instance."
10812
11773
  });
10813
11774
  }
@@ -10818,8 +11779,16 @@ var PageSchema = z14.object({
10818
11779
  message: "Interaction binding targets an unknown Page state."
10819
11780
  });
10820
11781
  }
10821
- validatePageStateSources(binding.inputMapping, ["interactionBindings", index, "inputMapping"]);
10822
- if (Object.values(binding.inputMapping).some((source) => source.kind === "result-field" || source.kind === "expression" && collectPageExpressionReads(source.expression).some((read) => read.root === "result"))) {
11782
+ validatePageStateSources(binding.inputMapping, [
11783
+ "interactionBindings",
11784
+ index,
11785
+ "inputMapping"
11786
+ ]);
11787
+ if (Object.values(binding.inputMapping).some(
11788
+ (source) => source.kind === "result-field" || source.kind === "expression" && collectPageExpressionReads(source.expression).some(
11789
+ (read) => read.root === "result"
11790
+ )
11791
+ )) {
10823
11792
  const action = value.actionBindings.find(
10824
11793
  (candidate) => candidate.source.capabilityInstanceId === binding.source.capabilityInstanceId && candidate.source.port === binding.source.port
10825
11794
  );
@@ -10829,10 +11798,17 @@ var PageSchema = z14.object({
10829
11798
  path: ["interactionBindings", index, "source"],
10830
11799
  message: "Result-field interactions must source one declared Action binding."
10831
11800
  });
10832
- } else if (!binding.sourceResultSchemaRevisionRef || !exactRevisionRef(binding.sourceResultSchemaRevisionRef, action.resultSchemaRevisionRef)) {
11801
+ } else if (!binding.sourceResultSchemaRevisionRef || !exactRevisionRef(
11802
+ binding.sourceResultSchemaRevisionRef,
11803
+ action.resultSchemaRevisionRef
11804
+ )) {
10833
11805
  context.addIssue({
10834
11806
  code: "custom",
10835
- path: ["interactionBindings", index, "sourceResultSchemaRevisionRef"],
11807
+ path: [
11808
+ "interactionBindings",
11809
+ index,
11810
+ "sourceResultSchemaRevisionRef"
11811
+ ],
10836
11812
  message: "Interaction result schema must exactly match the sourced Action result schema."
10837
11813
  });
10838
11814
  }
@@ -10841,45 +11817,90 @@ var PageSchema = z14.object({
10841
11817
  value.capabilityInstances.forEach((instance, index) => {
10842
11818
  const paths = [];
10843
11819
  instance.propertyBindings?.forEach((binding, bindingIndex) => {
10844
- const path = ["capabilityInstances", index, "propertyBindings", bindingIndex];
10845
- if (instance.capabilityRevisionRef.id.startsWith("monkeys.design.component.")) {
11820
+ const path = [
11821
+ "capabilityInstances",
11822
+ index,
11823
+ "propertyBindings",
11824
+ bindingIndex
11825
+ ];
11826
+ if (instance.capabilityRevisionRef.id.startsWith(
11827
+ "monkeys.design.component."
11828
+ )) {
10846
11829
  const [group, member3, field] = binding.targetPath;
10847
11830
  const messages = instance.properties.messages;
10848
11831
  const message = messages && typeof messages === "object" && !Array.isArray(messages) ? messages[member3] : void 0;
10849
11832
  const declaredMessage = message && typeof message === "object" && !Array.isArray(message);
10850
11833
  const allowed = group === "props" && binding.targetPath.length >= 2 || group === "messages" && declaredMessage && (field === "values" && binding.targetPath.length >= 3 || binding.targetPath.length === 3 && (field === "key" || field === "textI18n") && Object.prototype.hasOwnProperty.call(message, field));
10851
- if (!allowed) context.addIssue({ code: "custom", path: [...path, "targetPath"], message: "Component expressions can update property values or declared message fields, never executable wiring." });
11834
+ if (!allowed)
11835
+ context.addIssue({
11836
+ code: "custom",
11837
+ path: [...path, "targetPath"],
11838
+ message: "Component expressions can update property values or declared message fields, never executable wiring."
11839
+ });
10852
11840
  }
10853
- if (paths.some((previous) => previous.slice(0, Math.min(previous.length, binding.targetPath.length)).every((key, i) => key === binding.targetPath[i]))) {
10854
- context.addIssue({ code: "custom", path: [...path, "targetPath"], message: "Dynamic property targets must not overlap." });
11841
+ if (paths.some(
11842
+ (previous) => previous.slice(0, Math.min(previous.length, binding.targetPath.length)).every((key, i) => key === binding.targetPath[i])
11843
+ )) {
11844
+ context.addIssue({
11845
+ code: "custom",
11846
+ path: [...path, "targetPath"],
11847
+ message: "Dynamic property targets must not overlap."
11848
+ });
10855
11849
  }
10856
11850
  paths.push(binding.targetPath);
10857
11851
  visitPageExpression(binding.expression, (expression) => {
10858
11852
  if (expression.kind !== "read") return;
10859
11853
  if (expression.root === "state" && (!expression.path[0] || !stateIds.has(expression.path[0]))) {
10860
- context.addIssue({ code: "custom", path: [...path, "expression"], message: "Property expressions must reference a declared Page state." });
11854
+ context.addIssue({
11855
+ code: "custom",
11856
+ path: [...path, "expression"],
11857
+ message: "Property expressions must reference a declared Page state."
11858
+ });
10861
11859
  }
10862
- if (expression.root === "bindings" && ![...value.ontologyBindings, ...queryBindings].some((candidate) => candidate.bindingId === expression.path[0])) {
10863
- context.addIssue({ code: "custom", path: [...path, "expression"], message: "Property expressions must reference a declared Page query binding." });
11860
+ if (expression.root === "bindings" && ![...value.ontologyBindings, ...queryBindings].some(
11861
+ (candidate) => candidate.bindingId === expression.path[0]
11862
+ )) {
11863
+ context.addIssue({
11864
+ code: "custom",
11865
+ path: [...path, "expression"],
11866
+ message: "Property expressions must reference a declared Page query binding."
11867
+ });
10864
11868
  }
10865
11869
  if (expression.root === "actions" && (expression.path.length !== 2 || !actionOwners.has(expression.path[0]) || !["pending", "errorCode"].includes(expression.path[1]))) {
10866
- context.addIssue({ code: "custom", path: [...path, "expression"], message: "Property expressions may read only pending or errorCode from a declared Action binding." });
11870
+ context.addIssue({
11871
+ code: "custom",
11872
+ path: [...path, "expression"],
11873
+ message: "Property expressions may read only pending or errorCode from a declared Action binding."
11874
+ });
10867
11875
  }
10868
11876
  if (expression.root === "intent" || expression.root === "result") {
10869
- context.addIssue({ code: "custom", path: [...path, "expression"], message: "Property expressions cannot read transient event or Action results." });
11877
+ context.addIssue({
11878
+ code: "custom",
11879
+ path: [...path, "expression"],
11880
+ message: "Property expressions cannot read transient event or Action results."
11881
+ });
10870
11882
  }
10871
11883
  });
10872
11884
  });
10873
11885
  if (!instance.activationWhen) return;
10874
- forEachPageStateCondition(instance.activationWhen, (condition, conditionPath) => {
10875
- if (!stateIds.has(condition.stateId)) {
10876
- context.addIssue({
10877
- code: "custom",
10878
- path: ["capabilityInstances", index, "activationWhen", ...conditionPath, "stateId"],
10879
- message: "Capability activation condition references an unknown Page state."
10880
- });
11886
+ forEachPageStateCondition(
11887
+ instance.activationWhen,
11888
+ (condition, conditionPath) => {
11889
+ if (!stateIds.has(condition.stateId)) {
11890
+ context.addIssue({
11891
+ code: "custom",
11892
+ path: [
11893
+ "capabilityInstances",
11894
+ index,
11895
+ "activationWhen",
11896
+ ...conditionPath,
11897
+ "stateId"
11898
+ ],
11899
+ message: "Capability activation condition references an unknown Page state."
11900
+ });
11901
+ }
10881
11902
  }
10882
- });
11903
+ );
10883
11904
  });
10884
11905
  value.ontologyBindings.forEach((binding, index) => {
10885
11906
  if (!instanceIds.has(binding.target.capabilityInstanceId)) {
@@ -10889,7 +11910,11 @@ var PageSchema = z14.object({
10889
11910
  message: "Ontology binding targets an unknown capability instance."
10890
11911
  });
10891
11912
  }
10892
- validatePageStateSources(binding.parameters, ["ontologyBindings", index, "parameters"]);
11913
+ validatePageStateSources(binding.parameters, [
11914
+ "ontologyBindings",
11915
+ index,
11916
+ "parameters"
11917
+ ]);
10893
11918
  });
10894
11919
  queryBindings.forEach((binding, index) => {
10895
11920
  if (!instanceIds.has(binding.target.capabilityInstanceId)) {
@@ -10899,35 +11924,93 @@ var PageSchema = z14.object({
10899
11924
  message: "Query binding targets an unknown capability instance."
10900
11925
  });
10901
11926
  }
10902
- validatePageStateSources(binding.parameters, ["queryBindings", index, "parameters"]);
11927
+ validatePageStateSources(binding.parameters, [
11928
+ "queryBindings",
11929
+ index,
11930
+ "parameters"
11931
+ ]);
10903
11932
  if (binding.queryWhen) {
10904
- forEachPageStateCondition(binding.queryWhen, (condition, conditionPath) => {
10905
- if (!stateIds.has(condition.stateId)) {
10906
- context.addIssue({
10907
- code: "custom",
10908
- path: ["queryBindings", index, "queryWhen", ...conditionPath, "stateId"],
10909
- message: "Query activation condition references an unknown Page state."
10910
- });
11933
+ forEachPageStateCondition(
11934
+ binding.queryWhen,
11935
+ (condition, conditionPath) => {
11936
+ if (!stateIds.has(condition.stateId)) {
11937
+ context.addIssue({
11938
+ code: "custom",
11939
+ path: [
11940
+ "queryBindings",
11941
+ index,
11942
+ "queryWhen",
11943
+ ...conditionPath,
11944
+ "stateId"
11945
+ ],
11946
+ message: "Query activation condition references an unknown Page state."
11947
+ });
11948
+ }
10911
11949
  }
10912
- });
11950
+ );
10913
11951
  }
10914
11952
  if (binding.refreshPolicy?.when) {
10915
11953
  const path = ["queryBindings", index, "refreshPolicy", "when"];
10916
- const reads = collectExternalPageExpressionReads(binding.refreshPolicy.when);
10917
- checkScopedReads(reads, scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId)), path);
10918
- for (const read of reads) if (read.root === "actions" && !actionScopes.has(read.path[0])) context.addIssue({ code: "custom", path, message: "Automatic refresh condition references an unknown action binding." });
11954
+ const reads = collectExternalPageExpressionReads(
11955
+ binding.refreshPolicy.when
11956
+ );
11957
+ checkScopedReads(
11958
+ reads,
11959
+ scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId)),
11960
+ path
11961
+ );
11962
+ for (const read of reads)
11963
+ if (read.root === "actions" && !actionScopes.has(read.path[0]))
11964
+ context.addIssue({
11965
+ code: "custom",
11966
+ path,
11967
+ message: "Automatic refresh condition references an unknown action binding."
11968
+ });
10919
11969
  }
10920
- const effectOwners = new Set(binding.stateEffects?.map((effect) => stateDefinitions.find((definition) => definition.stateId === effect.targetStateId)?.scopeNodeId ?? "") ?? []);
10921
- if (effectOwners.size > 1) context.addIssue({ code: "custom", path: ["queryBindings", index, "stateEffects"], message: "A query completion must update a single state owner atomically." });
11970
+ const effectOwners = new Set(
11971
+ binding.stateEffects?.map(
11972
+ (effect) => stateDefinitions.find(
11973
+ (definition) => definition.stateId === effect.targetStateId
11974
+ )?.scopeNodeId ?? ""
11975
+ ) ?? []
11976
+ );
11977
+ if (effectOwners.size > 1)
11978
+ context.addIssue({
11979
+ code: "custom",
11980
+ path: ["queryBindings", index, "stateEffects"],
11981
+ message: "A query completion must update a single state owner atomically."
11982
+ });
10922
11983
  binding.stateEffects?.forEach((effect, effectIndex) => {
10923
11984
  const path = ["queryBindings", index, "stateEffects", effectIndex];
10924
- const state = stateDefinitions.find((definition) => definition.stateId === effect.targetStateId);
10925
- const scopes = scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId));
10926
- if (!state || state.scopeNodeId && !scopes.has(state.scopeNodeId)) context.addIssue({ code: "custom", path: [...path, "targetStateId"], message: "A query effect must target declared state in its own scope or an ancestor." });
10927
- for (const expression of [effect.value, ...effect.when ? [effect.when] : []]) {
11985
+ const state = stateDefinitions.find(
11986
+ (definition) => definition.stateId === effect.targetStateId
11987
+ );
11988
+ const scopes = scopesForNode(
11989
+ instanceNodes.get(binding.target.capabilityInstanceId)
11990
+ );
11991
+ if (!state || state.scopeNodeId && !scopes.has(state.scopeNodeId))
11992
+ context.addIssue({
11993
+ code: "custom",
11994
+ path: [...path, "targetStateId"],
11995
+ message: "A query effect must target declared state in its own scope or an ancestor."
11996
+ });
11997
+ for (const expression of [
11998
+ effect.value,
11999
+ ...effect.when ? [effect.when] : []
12000
+ ]) {
10928
12001
  const reads = collectPageExpressionReads(expression);
10929
- checkScopedReads(reads, state?.scopeNodeId ? scopesForNode(state.scopeNodeId) : /* @__PURE__ */ new Set(), path);
10930
- for (const read of reads) if (read.root === "state" && !stateIds.has(read.path[0])) context.addIssue({ code: "custom", path, message: "Query effect references an unknown Page state." });
12002
+ checkScopedReads(
12003
+ reads,
12004
+ state?.scopeNodeId ? scopesForNode(state.scopeNodeId) : /* @__PURE__ */ new Set(),
12005
+ path
12006
+ );
12007
+ for (const read of reads)
12008
+ if (read.root === "state" && !stateIds.has(read.path[0]))
12009
+ context.addIssue({
12010
+ code: "custom",
12011
+ path,
12012
+ message: "Query effect references an unknown Page state."
12013
+ });
10931
12014
  }
10932
12015
  });
10933
12016
  binding.resultStateBindings?.forEach((resultBinding, resultIndex) => {
@@ -10937,41 +12020,78 @@ var PageSchema = z14.object({
10937
12020
  if (!stateDefinition) {
10938
12021
  context.addIssue({
10939
12022
  code: "custom",
10940
- path: ["queryBindings", index, "resultStateBindings", resultIndex, "targetStateId"],
12023
+ path: [
12024
+ "queryBindings",
12025
+ index,
12026
+ "resultStateBindings",
12027
+ resultIndex,
12028
+ "targetStateId"
12029
+ ],
10941
12030
  message: "Query result binding targets an unknown Page state."
10942
12031
  });
10943
12032
  return;
10944
12033
  }
10945
- if (!exactRevisionRef(resultBinding.targetStateSchemaRevisionRef, stateDefinition.schemaRevisionRef)) {
12034
+ if (!exactRevisionRef(
12035
+ resultBinding.targetStateSchemaRevisionRef,
12036
+ stateDefinition.schemaRevisionRef
12037
+ )) {
10946
12038
  context.addIssue({
10947
12039
  code: "custom",
10948
- path: ["queryBindings", index, "resultStateBindings", resultIndex, "targetStateSchemaRevisionRef"],
12040
+ path: [
12041
+ "queryBindings",
12042
+ index,
12043
+ "resultStateBindings",
12044
+ resultIndex,
12045
+ "targetStateSchemaRevisionRef"
12046
+ ],
10949
12047
  message: "Query result binding must pin the exact target Page-state schema revision."
10950
12048
  });
10951
12049
  }
10952
12050
  if (stateDefinition.persistence !== "none") {
10953
12051
  context.addIssue({
10954
12052
  code: "custom",
10955
- path: ["queryBindings", index, "resultStateBindings", resultIndex, "targetStateId"],
12053
+ path: [
12054
+ "queryBindings",
12055
+ index,
12056
+ "resultStateBindings",
12057
+ resultIndex,
12058
+ "targetStateId"
12059
+ ],
10956
12060
  message: "Query result state projections must target non-persistent Page state."
10957
12061
  });
10958
12062
  }
10959
12063
  });
10960
12064
  });
10961
12065
  const dependencyBindings = [...value.ontologyBindings, ...queryBindings];
10962
- analyzePageBindingDependencies(dependencyBindings).errors.forEach((error) => {
10963
- const ontologyIndex = value.ontologyBindings.findIndex((binding) => binding.bindingId === error.bindingId);
10964
- const collection = ontologyIndex >= 0 ? "ontologyBindings" : "queryBindings";
10965
- const index = ontologyIndex >= 0 ? ontologyIndex : queryBindings.findIndex((binding) => binding.bindingId === error.bindingId);
10966
- context.addIssue({ code: "custom", path: [collection, index, "parameters"], message: `Page binding dependency ${error.code}: ${error.dependencyId ?? error.bindingId}` });
10967
- });
12066
+ analyzePageBindingDependencies(dependencyBindings).errors.forEach(
12067
+ (error) => {
12068
+ const ontologyIndex = value.ontologyBindings.findIndex(
12069
+ (binding) => binding.bindingId === error.bindingId
12070
+ );
12071
+ const collection = ontologyIndex >= 0 ? "ontologyBindings" : "queryBindings";
12072
+ const index = ontologyIndex >= 0 ? ontologyIndex : queryBindings.findIndex(
12073
+ (binding) => binding.bindingId === error.bindingId
12074
+ );
12075
+ context.addIssue({
12076
+ code: "custom",
12077
+ path: [collection, index, "parameters"],
12078
+ message: `Page binding dependency ${error.code}: ${error.dependencyId ?? error.bindingId}`
12079
+ });
12080
+ }
12081
+ );
10968
12082
  const projectedQueryStateIds = /* @__PURE__ */ new Set();
10969
12083
  queryBindings.forEach((binding, index) => {
10970
12084
  binding.resultStateBindings?.forEach((resultBinding, resultIndex) => {
10971
12085
  if (projectedQueryStateIds.has(resultBinding.targetStateId)) {
10972
12086
  context.addIssue({
10973
12087
  code: "custom",
10974
- path: ["queryBindings", index, "resultStateBindings", resultIndex, "targetStateId"],
12088
+ path: [
12089
+ "queryBindings",
12090
+ index,
12091
+ "resultStateBindings",
12092
+ resultIndex,
12093
+ "targetStateId"
12094
+ ],
10975
12095
  message: "One Page state can have only one Server Query result owner."
10976
12096
  });
10977
12097
  }
@@ -10981,12 +12101,19 @@ var PageSchema = z14.object({
10981
12101
  queryBindings.forEach((binding, index) => {
10982
12102
  if (binding.execution !== "server") return;
10983
12103
  const readStateIds = new Set(
10984
- Object.values(binding.parameters).flatMap((source) => source.kind === "page-state" ? [source.stateId] : [])
12104
+ Object.values(binding.parameters).flatMap(
12105
+ (source) => source.kind === "page-state" ? [source.stateId] : []
12106
+ )
10985
12107
  );
10986
12108
  if (binding.queryWhen) {
10987
- forEachPageStateCondition(binding.queryWhen, (condition) => readStateIds.add(condition.stateId));
12109
+ forEachPageStateCondition(
12110
+ binding.queryWhen,
12111
+ (condition) => readStateIds.add(condition.stateId)
12112
+ );
10988
12113
  }
10989
- const feedbackStateId = [...readStateIds].find((stateId) => projectedQueryStateIds.has(stateId));
12114
+ const feedbackStateId = [...readStateIds].find(
12115
+ (stateId) => projectedQueryStateIds.has(stateId)
12116
+ );
10990
12117
  if (feedbackStateId) {
10991
12118
  context.addIssue({
10992
12119
  code: "custom",
@@ -11010,10 +12137,34 @@ var PageSchema = z14.object({
11010
12137
  const cursorWindowSources = /* @__PURE__ */ new Set();
11011
12138
  cursorWindowBindings.forEach(({ binding, index, collection }) => {
11012
12139
  const sourceId = binding.cursorWindow.sourceCapabilityInstanceId ?? binding.target.capabilityInstanceId;
11013
- if (!instanceIds.has(sourceId)) context.addIssue({ code: "custom", path: [collection, index, "cursorWindow", "sourceCapabilityInstanceId"], message: "Cursor-window source must reference a declared capability instance." });
12140
+ if (!instanceIds.has(sourceId))
12141
+ context.addIssue({
12142
+ code: "custom",
12143
+ path: [
12144
+ collection,
12145
+ index,
12146
+ "cursorWindow",
12147
+ "sourceCapabilityInstanceId"
12148
+ ],
12149
+ message: "Cursor-window source must reference a declared capability instance."
12150
+ });
11014
12151
  const sourceScopes = [...scopesForNode(instanceNodes.get(sourceId))];
11015
- const targetScopes = [...scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId))];
11016
- if (sourceScopes.length !== targetScopes.length || sourceScopes.some((id, index2) => id !== targetScopes[index2])) context.addIssue({ code: "custom", path: [collection, index, "cursorWindow", "sourceCapabilityInstanceId"], message: "Cursor-window source and query target must share the same repeated scope." });
12152
+ const targetScopes = [
12153
+ ...scopesForNode(
12154
+ instanceNodes.get(binding.target.capabilityInstanceId)
12155
+ )
12156
+ ];
12157
+ if (sourceScopes.length !== targetScopes.length || sourceScopes.some((id, index2) => id !== targetScopes[index2]))
12158
+ context.addIssue({
12159
+ code: "custom",
12160
+ path: [
12161
+ collection,
12162
+ index,
12163
+ "cursorWindow",
12164
+ "sourceCapabilityInstanceId"
12165
+ ],
12166
+ message: "Cursor-window source and query target must share the same repeated scope."
12167
+ });
11017
12168
  const sourceKey = `${sourceId}:${binding.cursorWindow.pageChangePort}`;
11018
12169
  if (cursorWindowSources.has(sourceKey)) {
11019
12170
  context.addIssue({
@@ -11045,9 +12196,15 @@ var PageSchema = z14.object({
11045
12196
  message: "Action binding sources an unknown capability instance."
11046
12197
  });
11047
12198
  }
11048
- validatePageStateSources(binding.inputMapping, ["actionBindings", index, "inputMapping"]);
12199
+ validatePageStateSources(binding.inputMapping, [
12200
+ "actionBindings",
12201
+ index,
12202
+ "inputMapping"
12203
+ ]);
11049
12204
  binding.success.refreshBindingIds.forEach((bindingId) => {
11050
- if (!value.ontologyBindings.some((candidate) => candidate.bindingId === bindingId) && !queryBindings.some((candidate) => candidate.bindingId === bindingId)) {
12205
+ if (!value.ontologyBindings.some(
12206
+ (candidate) => candidate.bindingId === bindingId
12207
+ ) && !queryBindings.some((candidate) => candidate.bindingId === bindingId)) {
11051
12208
  context.addIssue({
11052
12209
  code: "custom",
11053
12210
  path: ["actionBindings", index, "success", "refreshBindingIds"],
@@ -11055,7 +12212,9 @@ var PageSchema = z14.object({
11055
12212
  });
11056
12213
  }
11057
12214
  });
11058
- const effectBindingIds = binding.success.resultBindingEffects?.map((effect) => effect.bindingId) ?? [];
12215
+ const effectBindingIds = binding.success.resultBindingEffects?.map(
12216
+ (effect) => effect.bindingId
12217
+ ) ?? [];
11059
12218
  if (new Set(effectBindingIds).size !== effectBindingIds.length) {
11060
12219
  context.addIssue({
11061
12220
  code: "custom",
@@ -11064,17 +12223,35 @@ var PageSchema = z14.object({
11064
12223
  });
11065
12224
  }
11066
12225
  binding.success.resultBindingEffects?.forEach((effect, effectIndex) => {
11067
- if (!value.ontologyBindings.some((candidate) => candidate.bindingId === effect.bindingId) && !queryBindings.some((candidate) => candidate.bindingId === effect.bindingId)) {
12226
+ if (!value.ontologyBindings.some(
12227
+ (candidate) => candidate.bindingId === effect.bindingId
12228
+ ) && !queryBindings.some(
12229
+ (candidate) => candidate.bindingId === effect.bindingId
12230
+ )) {
11068
12231
  context.addIssue({
11069
12232
  code: "custom",
11070
- path: ["actionBindings", index, "success", "resultBindingEffects", effectIndex, "bindingId"],
12233
+ path: [
12234
+ "actionBindings",
12235
+ index,
12236
+ "success",
12237
+ "resultBindingEffects",
12238
+ effectIndex,
12239
+ "bindingId"
12240
+ ],
11071
12241
  message: `Unknown result effect binding: ${effect.bindingId}`
11072
12242
  });
11073
12243
  }
11074
12244
  if (binding.success.refreshBindingIds.includes(effect.bindingId)) {
11075
12245
  context.addIssue({
11076
12246
  code: "custom",
11077
- path: ["actionBindings", index, "success", "resultBindingEffects", effectIndex, "bindingId"],
12247
+ path: [
12248
+ "actionBindings",
12249
+ index,
12250
+ "success",
12251
+ "resultBindingEffects",
12252
+ effectIndex,
12253
+ "bindingId"
12254
+ ],
11078
12255
  message: "A result-projected binding cannot also be refreshed by the same Action."
11079
12256
  });
11080
12257
  }
@@ -11115,7 +12292,11 @@ var PageSchema = z14.object({
11115
12292
  const refs = [
11116
12293
  ["capabilityRevisionRef", instance.capabilityRevisionRef, "capability"],
11117
12294
  ["providerRevisionRef", instance.providerRevisionRef, "view-provider"],
11118
- ["propertySchemaRevisionRef", instance.propertySchemaRevisionRef, "schema"]
12295
+ [
12296
+ "propertySchemaRevisionRef",
12297
+ instance.propertySchemaRevisionRef,
12298
+ "schema"
12299
+ ]
11119
12300
  ];
11120
12301
  refs.forEach(([field, reference, expectedKind]) => {
11121
12302
  if (reference.kind !== expectedKind)
@@ -11156,7 +12337,10 @@ var PageReleaseSchema = z14.object({
11156
12337
  surface: ProductSurfaceSchema,
11157
12338
  routeSpaceRevisionRef: RevisionRefSchema,
11158
12339
  normalizedPath: RoutePathTemplateSchema,
11159
- routeClaim: z14.union([CompiledRouteClaimSchema, LegacyCompiledRouteClaimSchema]),
12340
+ routeClaim: z14.union([
12341
+ CompiledRouteClaimSchema,
12342
+ LegacyCompiledRouteClaimSchema
12343
+ ]),
11160
12344
  legacyRouteTakeoverAuthorization: LegacyRouteTakeoverAuthorizationSchema.optional()
11161
12345
  }).strict()
11162
12346
  }).strict().superRefine((value, context) => {
@@ -11182,7 +12366,10 @@ var PageReleaseSchema = z14.object({
11182
12366
  message: "Page release target requires a route-space revision."
11183
12367
  });
11184
12368
  validateReleaseRouteSurface(value.target, context);
11185
- if (value.target.normalizedPath !== value.target.routeClaim.normalizedPath || !exactRevisionRef(value.target.routeSpaceRevisionRef, value.target.routeClaim.routeSpaceRevisionRef)) {
12369
+ if (value.target.normalizedPath !== value.target.routeClaim.normalizedPath || !exactRevisionRef(
12370
+ value.target.routeSpaceRevisionRef,
12371
+ value.target.routeClaim.routeSpaceRevisionRef
12372
+ )) {
11186
12373
  context.addIssue({
11187
12374
  code: "custom",
11188
12375
  path: ["target", "routeClaim"],
@@ -11190,7 +12377,10 @@ var PageReleaseSchema = z14.object({
11190
12377
  });
11191
12378
  }
11192
12379
  const takeover = value.target.legacyRouteTakeoverAuthorization;
11193
- if (takeover && (value.target.routeClaim.kind !== "canonical" || takeover.normalizedPath !== value.target.normalizedPath || !exactRevisionRef(takeover.routeSpaceRevisionRef, value.target.routeSpaceRevisionRef) || takeover.targetResourceRef.kind !== "page" || takeover.targetResourceRef.id !== value.pageRevisionRef.id || takeover.targetResourceRef.ownerRepo !== value.pageRevisionRef.ownerRepo)) {
12380
+ if (takeover && (value.target.routeClaim.kind !== "canonical" || takeover.normalizedPath !== value.target.normalizedPath || !exactRevisionRef(
12381
+ takeover.routeSpaceRevisionRef,
12382
+ value.target.routeSpaceRevisionRef
12383
+ ) || takeover.targetResourceRef.kind !== "page" || takeover.targetResourceRef.id !== value.pageRevisionRef.id || takeover.targetResourceRef.ownerRepo !== value.pageRevisionRef.ownerRepo)) {
11194
12384
  context.addIssue({
11195
12385
  code: "custom",
11196
12386
  path: ["target", "legacyRouteTakeoverAuthorization"],
@@ -11208,7 +12398,14 @@ var WorkbenchGroupSchema = z14.object({
11208
12398
  }).strict();
11209
12399
  var WorkbenchAppInstanceSchema = z14.object({
11210
12400
  instanceId: ContractIdentifierSchema,
11211
- kind: z14.enum(["built-in-application", "workflow-form", "workflow", "agent", "design", "capability"]),
12401
+ kind: z14.enum([
12402
+ "built-in-application",
12403
+ "workflow-form",
12404
+ "workflow",
12405
+ "agent",
12406
+ "design",
12407
+ "capability"
12408
+ ]),
11212
12409
  targetRevisionRef: RevisionRefSchema,
11213
12410
  providerRevisionRef: RevisionRefSchema,
11214
12411
  inputSchemaRevisionRef: RevisionRefSchema,
@@ -11231,7 +12428,12 @@ var WorkbenchSchema = z14.object({
11231
12428
  identity: WorkbenchIdentitySchema,
11232
12429
  supportedSurfaces: z14.array(ProductSurfaceSchema).min(1),
11233
12430
  lifecycle: DeclarativeLifecycleSchema,
11234
- routeClaims: z14.array(z14.union([DeclarativeRouteClaimSchema, LegacyDeclarativeRouteClaimSchema])).min(1),
12431
+ routeClaims: z14.array(
12432
+ z14.union([
12433
+ DeclarativeRouteClaimSchema,
12434
+ LegacyDeclarativeRouteClaimSchema
12435
+ ])
12436
+ ).min(1),
11235
12437
  groups: z14.array(WorkbenchGroupSchema).min(1),
11236
12438
  appInstances: z14.array(WorkbenchAppInstanceSchema).min(1),
11237
12439
  defaultEntry: z14.object({
@@ -11248,14 +12450,25 @@ var WorkbenchSchema = z14.object({
11248
12450
  workbenchAccessPolicy: AccessPolicySchema,
11249
12451
  managementAccess: ManagementAccessSchema,
11250
12452
  personalPreferencesPolicy: z14.object({
11251
- allowed: z14.array(z14.enum(["collapsed-groups", "recent-entry", "layout-density"])),
12453
+ allowed: z14.array(
12454
+ z14.enum(["collapsed-groups", "recent-entry", "layout-density"])
12455
+ ),
11252
12456
  authority: z14.literal("identity-overlay")
11253
12457
  }).strict(),
11254
12458
  performanceBudgetRef: RevisionRefSchema,
11255
12459
  observationPolicyRevisionRef: RevisionRefSchema,
11256
- privacyClassification: z14.enum(["public", "internal", "confidential", "restricted"])
12460
+ privacyClassification: z14.enum([
12461
+ "public",
12462
+ "internal",
12463
+ "confidential",
12464
+ "restricted"
12465
+ ])
11257
12466
  }).strict().superRefine((value, context) => {
11258
- validateDeclaredRouteSurfaces(value.supportedSurfaces, value.routeClaims, context);
12467
+ validateDeclaredRouteSurfaces(
12468
+ value.supportedSurfaces,
12469
+ value.routeClaims,
12470
+ context
12471
+ );
11259
12472
  if (value.purpose === "template" && value.sourceTemplateRevisionRef) {
11260
12473
  context.addIssue({
11261
12474
  code: "custom",
@@ -11270,7 +12483,10 @@ var WorkbenchSchema = z14.object({
11270
12483
  path: ["groups"],
11271
12484
  message: `Duplicate Workbench group: ${duplicateGroup}`
11272
12485
  });
11273
- const duplicateInstance = uniqueArray(value.appInstances, (instance) => instance.instanceId);
12486
+ const duplicateInstance = uniqueArray(
12487
+ value.appInstances,
12488
+ (instance) => instance.instanceId
12489
+ );
11274
12490
  if (duplicateInstance)
11275
12491
  context.addIssue({
11276
12492
  code: "custom",
@@ -11325,9 +12541,21 @@ var WorkbenchSchema = z14.object({
11325
12541
  });
11326
12542
  });
11327
12543
  const layoutRefs = [
11328
- ["hostCapabilityRevisionRef", value.layout.hostCapabilityRevisionRef, "capability"],
11329
- ["hostProviderRevisionRef", value.layout.hostProviderRevisionRef, "view-provider"],
11330
- ["layoutPolicyRevisionRef", value.layout.layoutPolicyRevisionRef, "layout-policy"]
12544
+ [
12545
+ "hostCapabilityRevisionRef",
12546
+ value.layout.hostCapabilityRevisionRef,
12547
+ "capability"
12548
+ ],
12549
+ [
12550
+ "hostProviderRevisionRef",
12551
+ value.layout.hostProviderRevisionRef,
12552
+ "view-provider"
12553
+ ],
12554
+ [
12555
+ "layoutPolicyRevisionRef",
12556
+ value.layout.layoutPolicyRevisionRef,
12557
+ "layout-policy"
12558
+ ]
11331
12559
  ];
11332
12560
  layoutRefs.forEach(([field, reference, expectedKind]) => {
11333
12561
  if (reference.kind !== expectedKind)
@@ -11356,7 +12584,10 @@ var WorkbenchReleaseSchema = z14.object({
11356
12584
  workbenchId: ContractIdentifierSchema,
11357
12585
  routeSpaceRevisionRef: RevisionRefSchema,
11358
12586
  normalizedPath: RoutePathTemplateSchema,
11359
- routeClaim: z14.union([CompiledRouteClaimSchema, LegacyCompiledRouteClaimSchema]),
12587
+ routeClaim: z14.union([
12588
+ CompiledRouteClaimSchema,
12589
+ LegacyCompiledRouteClaimSchema
12590
+ ]),
11360
12591
  legacyRouteTakeoverAuthorization: LegacyRouteTakeoverAuthorizationSchema.optional(),
11361
12592
  order: z14.number().int(),
11362
12593
  isDefaultCandidate: z14.boolean()
@@ -11384,7 +12615,10 @@ var WorkbenchReleaseSchema = z14.object({
11384
12615
  message: "Workbench release target requires a route-space revision."
11385
12616
  });
11386
12617
  validateReleaseRouteSurface(value.target, context);
11387
- if (value.target.normalizedPath !== value.target.routeClaim.normalizedPath || !exactRevisionRef(value.target.routeSpaceRevisionRef, value.target.routeClaim.routeSpaceRevisionRef)) {
12618
+ if (value.target.normalizedPath !== value.target.routeClaim.normalizedPath || !exactRevisionRef(
12619
+ value.target.routeSpaceRevisionRef,
12620
+ value.target.routeClaim.routeSpaceRevisionRef
12621
+ )) {
11388
12622
  context.addIssue({
11389
12623
  code: "custom",
11390
12624
  path: ["target", "routeClaim"],
@@ -11392,7 +12626,10 @@ var WorkbenchReleaseSchema = z14.object({
11392
12626
  });
11393
12627
  }
11394
12628
  const takeover = value.target.legacyRouteTakeoverAuthorization;
11395
- if (takeover && (value.target.routeClaim.kind !== "canonical" || takeover.normalizedPath !== value.target.normalizedPath || !exactRevisionRef(takeover.routeSpaceRevisionRef, value.target.routeSpaceRevisionRef) || takeover.targetResourceRef.kind !== "workbench" || takeover.targetResourceRef.id !== value.workbenchRevisionRef.id || takeover.targetResourceRef.ownerRepo !== value.workbenchRevisionRef.ownerRepo)) {
12629
+ if (takeover && (value.target.routeClaim.kind !== "canonical" || takeover.normalizedPath !== value.target.normalizedPath || !exactRevisionRef(
12630
+ takeover.routeSpaceRevisionRef,
12631
+ value.target.routeSpaceRevisionRef
12632
+ ) || takeover.targetResourceRef.kind !== "workbench" || takeover.targetResourceRef.id !== value.workbenchRevisionRef.id || takeover.targetResourceRef.ownerRepo !== value.workbenchRevisionRef.ownerRepo)) {
11396
12633
  context.addIssue({
11397
12634
  code: "custom",
11398
12635
  path: ["target", "legacyRouteTakeoverAuthorization"],
@@ -11501,7 +12738,9 @@ var NavigationSchema = z14.object({
11501
12738
  }).strict().superRefine((value, context) => {
11502
12739
  validateNavigationTree(value.nodes, context);
11503
12740
  value.nodes.forEach((node, index) => {
11504
- if (node.kind === "target" && !["page", "workbench", "menu-action", "domain-command"].includes(node.targetRef.kind)) {
12741
+ if (node.kind === "target" && !["page", "workbench", "menu-action", "domain-command"].includes(
12742
+ node.targetRef.kind
12743
+ )) {
11505
12744
  context.addIssue({
11506
12745
  code: "custom",
11507
12746
  path: ["nodes", index, "targetRef", "kind"],
@@ -11518,7 +12757,10 @@ var ResolvedNavigationTargetSchema = z14.object({
11518
12757
  }).strict();
11519
12758
  var UnavailableNavigationTargetSchema = z14.object({
11520
12759
  nodeId: ContractIdentifierSchema,
11521
- stableTargetRef: StableRefSchema.refine((reference) => reference.kind === "page", "Only missing Pages can be isolated."),
12760
+ stableTargetRef: StableRefSchema.refine(
12761
+ (reference) => reference.kind === "page",
12762
+ "Only missing Pages can be isolated."
12763
+ ),
11522
12764
  reason: z14.literal("page-missing"),
11523
12765
  accessPolicy: AccessPolicySchema.nullable()
11524
12766
  }).strict();
@@ -11555,8 +12797,15 @@ var NavigationReleaseSchema = z14.object({
11555
12797
  path: ["resolvedTargets"],
11556
12798
  message: "Resolved Navigation node IDs must be unique."
11557
12799
  });
11558
- if (uniqueArray([...value.resolvedTargets, ...value.unavailableTargets ?? []], (target) => target.nodeId)) {
11559
- context.addIssue({ code: "custom", path: ["unavailableTargets"], message: "Navigation target resolutions must have unique node IDs." });
12800
+ if (uniqueArray(
12801
+ [...value.resolvedTargets, ...value.unavailableTargets ?? []],
12802
+ (target) => target.nodeId
12803
+ )) {
12804
+ context.addIssue({
12805
+ code: "custom",
12806
+ path: ["unavailableTargets"],
12807
+ message: "Navigation target resolutions must have unique node IDs."
12808
+ });
11560
12809
  }
11561
12810
  });
11562
12811
  var RuntimeDiagnosticSchema = z14.object({
@@ -11645,7 +12894,9 @@ var DeclarativeRouteOwnerIndexSchema = z14.object({
11645
12894
  contentHash: Sha256Schema,
11646
12895
  rebuildable: z14.literal(true)
11647
12896
  }).strict().superRefine((value, context) => {
11648
- const identities = value.entries.map((entry) => `${entry.resourceKind}:${entry.releaseSlotId}`);
12897
+ const identities = value.entries.map(
12898
+ (entry) => `${entry.resourceKind}:${entry.releaseSlotId}`
12899
+ );
11649
12900
  if (new Set(identities).size !== identities.length) {
11650
12901
  context.addIssue({
11651
12902
  code: "custom",
@@ -11653,7 +12904,9 @@ var DeclarativeRouteOwnerIndexSchema = z14.object({
11653
12904
  message: "Route owner index entries must be unique by Release slot."
11654
12905
  });
11655
12906
  }
11656
- if (identities.some((identity, index) => index > 0 && identities[index - 1].localeCompare(identity) > 0)) {
12907
+ if (identities.some(
12908
+ (identity, index) => index > 0 && identities[index - 1].localeCompare(identity) > 0
12909
+ )) {
11657
12910
  context.addIssue({
11658
12911
  code: "custom",
11659
12912
  path: ["entries"],
@@ -11735,7 +12988,9 @@ var DeclarativeWorkbenchCatalogSchema = z14.object({
11735
12988
  message: "Workbench catalog identities must be unique."
11736
12989
  });
11737
12990
  }
11738
- if (value.entries.filter((entry) => entry.authority !== "unavailable" && entry.isDefaultCandidate).length > 1) {
12991
+ if (value.entries.filter(
12992
+ (entry) => entry.authority !== "unavailable" && entry.isDefaultCandidate
12993
+ ).length > 1) {
11739
12994
  context.addIssue({
11740
12995
  code: "custom",
11741
12996
  path: ["entries"],
@@ -11745,7 +13000,9 @@ var DeclarativeWorkbenchCatalogSchema = z14.object({
11745
13000
  const sorted = [...value.entries].sort(
11746
13001
  (left, right) => left.order - right.order || left.workbenchId.localeCompare(right.workbenchId)
11747
13002
  );
11748
- if (sorted.some((entry, index) => entry.workbenchId !== value.entries[index]?.workbenchId)) {
13003
+ if (sorted.some(
13004
+ (entry, index) => entry.workbenchId !== value.entries[index]?.workbenchId
13005
+ )) {
11749
13006
  context.addIssue({
11750
13007
  code: "custom",
11751
13008
  path: ["entries"],
@@ -11777,9 +13034,16 @@ var PageRuntimeBundleSchema = z14.object({
11777
13034
  tokenRevisionRefs: z14.array(RevisionRefSchema),
11778
13035
  performanceBudgetRef: RevisionRefSchema,
11779
13036
  observationPolicyRevisionRef: RevisionRefSchema,
11780
- privacyClassification: z14.enum(["public", "internal", "confidential", "restricted"])
13037
+ privacyClassification: z14.enum([
13038
+ "public",
13039
+ "internal",
13040
+ "confidential",
13041
+ "restricted"
13042
+ ])
11781
13043
  }).strict().superRefine((value, context) => {
11782
- const instanceIds = new Set(value.capabilityInstances.map((instance) => instance.instanceId));
13044
+ const instanceIds = new Set(
13045
+ value.capabilityInstances.map((instance) => instance.instanceId)
13046
+ );
11783
13047
  if (new Set(value.deniedCapabilityInstanceIds).size !== value.deniedCapabilityInstanceIds.length || value.deniedCapabilityInstanceIds.some((id) => !instanceIds.has(id))) {
11784
13048
  context.addIssue({
11785
13049
  code: "custom",
@@ -11842,7 +13106,12 @@ var WorkbenchRuntimeBundleSchema = z14.object({
11842
13106
  target: WorkbenchRuntimeTargetSchema,
11843
13107
  performanceBudgetRef: RevisionRefSchema,
11844
13108
  observationPolicyRevisionRef: RevisionRefSchema,
11845
- privacyClassification: z14.enum(["public", "internal", "confidential", "restricted"])
13109
+ privacyClassification: z14.enum([
13110
+ "public",
13111
+ "internal",
13112
+ "confidential",
13113
+ "restricted"
13114
+ ])
11846
13115
  }).strict().superRefine((value, context) => {
11847
13116
  validateRuntimeBundleBase(value, "workbench-release", context);
11848
13117
  value.routeClaims.forEach((claim, index) => {
@@ -11890,7 +13159,9 @@ var WorkbenchRuntimeBundleSchema = z14.object({
11890
13159
  message: "Workbench runtime default entry must reference a visible app in the declared group."
11891
13160
  });
11892
13161
  }
11893
- if (!value.groups.some((group) => group.groupId === value.defaultEntry?.groupId)) {
13162
+ if (!value.groups.some(
13163
+ (group) => group.groupId === value.defaultEntry?.groupId
13164
+ )) {
11894
13165
  context.addIssue({
11895
13166
  code: "custom",
11896
13167
  path: ["defaultEntry", "groupId"],
@@ -11922,12 +13193,15 @@ var CompiledNavigationDomainCommandTargetSchema = ResolvedNavigationTargetSchema
11922
13193
  resultSchemaRevisionRef: RevisionRefSchema.optional(),
11923
13194
  input: JsonObjectSchema
11924
13195
  }).strict();
11925
- var CompiledNavigationResolvedTargetSchema = z14.discriminatedUnion("kind", [
11926
- CompiledNavigationTargetSchema,
11927
- CompiledNavigationRegisteredMenuActionTargetSchema,
11928
- CompiledNavigationDomainCommandTargetSchema,
11929
- UnavailableNavigationTargetSchema.omit({ reason: true }).extend({ kind: z14.literal("unavailable") }).strict()
11930
- ]);
13196
+ var CompiledNavigationResolvedTargetSchema = z14.discriminatedUnion(
13197
+ "kind",
13198
+ [
13199
+ CompiledNavigationTargetSchema,
13200
+ CompiledNavigationRegisteredMenuActionTargetSchema,
13201
+ CompiledNavigationDomainCommandTargetSchema,
13202
+ UnavailableNavigationTargetSchema.omit({ reason: true }).extend({ kind: z14.literal("unavailable") }).strict()
13203
+ ]
13204
+ );
11931
13205
  var CompiledNavigationGroupNodeSchema = NavigationGroupNodeSchema.extend({
11932
13206
  ancestorAccessPolicies: z14.array(AccessPolicySchema)
11933
13207
  }).strict();
@@ -11936,10 +13210,18 @@ var CompiledNavigationTargetNodeSchema = NavigationTargetNodeSchema.extend({
11936
13210
  resolvedTarget: CompiledNavigationResolvedTargetSchema
11937
13211
  }).strict().superRefine((node, context) => {
11938
13212
  if (node.resolvedTarget.nodeId !== node.nodeId || stableRefIdentity(node.resolvedTarget.stableTargetRef) !== stableRefIdentity(node.targetRef)) {
11939
- context.addIssue({ code: "custom", path: ["resolvedTarget"], message: "Resolved target identity must match the source node." });
13213
+ context.addIssue({
13214
+ code: "custom",
13215
+ path: ["resolvedTarget"],
13216
+ message: "Resolved target identity must match the source node."
13217
+ });
11940
13218
  }
11941
13219
  if (node.resolvedTarget.kind === "unavailable" && (node.disabled !== true || Object.keys(node.parameterMapping).length > 0)) {
11942
- context.addIssue({ code: "custom", path: ["resolvedTarget"], message: "Unavailable targets must be disabled and contain no executable input." });
13220
+ context.addIssue({
13221
+ code: "custom",
13222
+ path: ["resolvedTarget"],
13223
+ message: "Unavailable targets must be disabled and contain no executable input."
13224
+ });
11943
13225
  }
11944
13226
  });
11945
13227
  var CompiledNavigationSeparatorNodeSchema = NavigationSeparatorNodeSchema.extend({
@@ -12005,11 +13287,23 @@ var controlDefinition = (ontologyId, bodySchemaRef) => DeclarativeControlOntolog
12005
13287
  });
12006
13288
  var DECLARATIVE_CONTROL_ONTOLOGY_DEFINITIONS = Object.freeze([
12007
13289
  controlDefinition("monkeys.system.page", "monkeys.system.page/v1"),
12008
- controlDefinition("monkeys.system.page-release", "monkeys.system.page-release/v1"),
13290
+ controlDefinition(
13291
+ "monkeys.system.page-release",
13292
+ "monkeys.system.page-release/v1"
13293
+ ),
12009
13294
  controlDefinition("monkeys.system.workbench", "monkeys.system.workbench/v1"),
12010
- controlDefinition("monkeys.system.workbench-release", "monkeys.system.workbench-release/v1"),
12011
- controlDefinition("monkeys.system.navigation", "monkeys.system.navigation/v1"),
12012
- controlDefinition("monkeys.system.navigation-release", "monkeys.system.navigation-release/v1")
13295
+ controlDefinition(
13296
+ "monkeys.system.workbench-release",
13297
+ "monkeys.system.workbench-release/v1"
13298
+ ),
13299
+ controlDefinition(
13300
+ "monkeys.system.navigation",
13301
+ "monkeys.system.navigation/v1"
13302
+ ),
13303
+ controlDefinition(
13304
+ "monkeys.system.navigation-release",
13305
+ "monkeys.system.navigation-release/v1"
13306
+ )
12013
13307
  ]);
12014
13308
 
12015
13309
  // src/contracts/declarative-control-http.ts
@@ -12686,9 +13980,22 @@ var ChangeImpactGraphSchema = z17.object({
12686
13980
  }).strict();
12687
13981
 
12688
13982
  // src/contracts/declarative-control-http.ts
12689
- var DeclarativeResourceKindSchema = z18.enum(["page", "navigation", "workbench"]);
12690
- var DeclarativeAuthoringActionSchema = z18.enum(["validate", "preview", "publish", "rollback"]);
12691
- var DeclarativeLegacyMigrationKindSchema = z18.enum(["page", "page-data-assets", "workbench"]);
13983
+ var DeclarativeResourceKindSchema = z18.enum([
13984
+ "page",
13985
+ "navigation",
13986
+ "workbench"
13987
+ ]);
13988
+ var DeclarativeAuthoringActionSchema = z18.enum([
13989
+ "validate",
13990
+ "preview",
13991
+ "publish",
13992
+ "rollback"
13993
+ ]);
13994
+ var DeclarativeLegacyMigrationKindSchema = z18.enum([
13995
+ "page",
13996
+ "page-data-assets",
13997
+ "workbench"
13998
+ ]);
12692
13999
  var DeclarativeErrorEnvelopeSchema = z18.object({
12693
14000
  code: z18.string().trim().min(1),
12694
14001
  message: z18.string().trim().min(1),
@@ -12715,10 +14022,16 @@ var DeclarativeRuntimePageTargetSchema = z18.object({
12715
14022
  });
12716
14023
  }
12717
14024
  });
12718
- var forbiddenRuntimeParameterKeys = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
14025
+ var forbiddenRuntimeParameterKeys = /* @__PURE__ */ new Set([
14026
+ "__proto__",
14027
+ "prototype",
14028
+ "constructor"
14029
+ ]);
12719
14030
  var rejectRuntimePrototypeKeys = (value, context, path = []) => {
12720
14031
  if (Array.isArray(value)) {
12721
- value.forEach((child, index) => rejectRuntimePrototypeKeys(child, context, [...path, index]));
14032
+ value.forEach(
14033
+ (child, index) => rejectRuntimePrototypeKeys(child, context, [...path, index])
14034
+ );
12722
14035
  return;
12723
14036
  }
12724
14037
  if (!value || typeof value !== "object") return;
@@ -12730,13 +14043,20 @@ var rejectRuntimePrototypeKeys = (value, context, path = []) => {
12730
14043
  message: "Prototype-mutating runtime parameter keys are forbidden."
12731
14044
  });
12732
14045
  }
12733
- rejectRuntimePrototypeKeys(value[key], context, [...path, key]);
14046
+ rejectRuntimePrototypeKeys(
14047
+ value[key],
14048
+ context,
14049
+ [...path, key]
14050
+ );
12734
14051
  }
12735
14052
  };
12736
14053
  var runtimeParameterDepth = (value, depth = 0) => {
12737
14054
  if (value === null || typeof value !== "object") return depth;
12738
14055
  const values = Array.isArray(value) ? value : Object.values(value);
12739
- return values.reduce((maximum, child) => Math.max(maximum, runtimeParameterDepth(child, depth + 1)), depth);
14056
+ return values.reduce(
14057
+ (maximum, child) => Math.max(maximum, runtimeParameterDepth(child, depth + 1)),
14058
+ depth
14059
+ );
12740
14060
  };
12741
14061
  var DeclarativeRuntimeParametersSchema = z18.any().superRefine(rejectRuntimePrototypeKeys).pipe(
12742
14062
  JsonObjectSchema.superRefine((value, context) => {
@@ -12775,9 +14095,12 @@ var DeclarativeRuntimeParametersSchema = z18.any().superRefine(rejectRuntimeProt
12775
14095
  path,
12776
14096
  message: "Runtime parameter string values cannot exceed 2048 characters."
12777
14097
  });
12778
- else if (Array.isArray(entry)) entry.forEach((child, index) => visit(child, [...path, index]));
14098
+ else if (Array.isArray(entry))
14099
+ entry.forEach((child, index) => visit(child, [...path, index]));
12779
14100
  else if (entry && typeof entry === "object")
12780
- Object.entries(entry).forEach(([key, child]) => visit(child, [...path, key]));
14101
+ Object.entries(entry).forEach(
14102
+ ([key, child]) => visit(child, [...path, key])
14103
+ );
12781
14104
  };
12782
14105
  visit(value, []);
12783
14106
  })
@@ -12812,17 +14135,36 @@ var DeclarativeRuntimeActionExecuteIntentSchema = DeclarativeRuntimePageTargetSc
12812
14135
  intent: JsonObjectSchema,
12813
14136
  recoveryOnly: z18.literal(true).optional(),
12814
14137
  pageState: DeclarativeRuntimeParametersSchema,
12815
- files: z18.record(z18.string().min(1).max(256), z18.union([
12816
- z18.object({ fileName: z18.string().min(1).max(255), content: z18.string().max(1048576) }).strict(),
12817
- z18.object({ fileName: z18.string().min(1).max(255), canonicalUri: z18.string().regex(/^file:\/\/[^\s/?#]+$/).max(1024) }).strict()
12818
- ])).superRefine((files, context) => {
12819
- 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) context.addIssue({ code: "custom", message: "Action files exceed the transient input budget." });
14138
+ files: z18.record(
14139
+ z18.string().min(1).max(256),
14140
+ z18.union([
14141
+ z18.object({
14142
+ fileName: z18.string().min(1).max(255),
14143
+ content: z18.string().max(1048576)
14144
+ }).strict(),
14145
+ z18.object({
14146
+ fileName: z18.string().min(1).max(255),
14147
+ canonicalUri: z18.string().regex(/^file:\/\/[^\s/?#]+$/).max(1024)
14148
+ }).strict()
14149
+ ])
14150
+ ).superRefine((files, context) => {
14151
+ if (Object.keys(files).length > 4 || Object.values(files).reduce(
14152
+ (bytes, file) => bytes + ("content" in file ? new TextEncoder().encode(file.content).byteLength : 0),
14153
+ 0
14154
+ ) > 1048576)
14155
+ context.addIssue({
14156
+ code: "custom",
14157
+ message: "Action files exceed the transient input budget."
14158
+ });
12820
14159
  }).optional(),
12821
14160
  scope: z18.unknown().superRefine((value, context) => {
12822
14161
  try {
12823
14162
  assertPageValueBudget(value);
12824
14163
  } catch {
12825
- context.addIssue({ code: "custom", message: "Action instance scope exceeds the safe JSON budget." });
14164
+ context.addIssue({
14165
+ code: "custom",
14166
+ message: "Action instance scope exceeds the safe JSON budget."
14167
+ });
12826
14168
  }
12827
14169
  }).pipe(JsonObjectSchema).optional(),
12828
14170
  routePath: DeclarativeRuntimeActionRoutePathSchema.optional(),
@@ -12847,7 +14189,12 @@ var DeclarativeRuntimeActionExecuteResultSchema = z18.object({
12847
14189
  resultSchemaRevisionRef: RevisionRefSchema,
12848
14190
  result: JsonObjectSchema,
12849
14191
  download: DeclarativeNativeDownloadSchema.optional(),
12850
- downloadError: z18.object({ code: z18.enum(["DECLARATIVE_DOWNLOAD_FORBIDDEN", "DECLARATIVE_DOWNLOAD_UNAVAILABLE"]) }).strict().optional(),
14192
+ downloadError: z18.object({
14193
+ code: z18.enum([
14194
+ "DECLARATIVE_DOWNLOAD_FORBIDDEN",
14195
+ "DECLARATIVE_DOWNLOAD_UNAVAILABLE"
14196
+ ])
14197
+ }).strict().optional(),
12851
14198
  idempotentReplay: z18.boolean(),
12852
14199
  lineageRef: StableRefSchema,
12853
14200
  refreshBindingIds: z18.array(ContractIdentifierSchema),
@@ -13022,7 +14369,16 @@ var DeclarativeCapabilityAuthoringRegistrationSchema = z18.object({
13022
14369
  allowedChildCapabilityRefs: z18.array(StableRefSchema),
13023
14370
  inputPorts: z18.array(DeclarativeCapabilityPortSchema),
13024
14371
  outputPorts: z18.array(DeclarativeCapabilityPortSchema),
13025
- allowedSideEffects: z18.array(z18.enum(["network", "storage", "navigation", "clipboard", "worker", "websocket"])),
14372
+ allowedSideEffects: z18.array(
14373
+ z18.enum([
14374
+ "network",
14375
+ "storage",
14376
+ "navigation",
14377
+ "clipboard",
14378
+ "worker",
14379
+ "websocket"
14380
+ ])
14381
+ ),
13026
14382
  ontologyRequirements: z18.array(
13027
14383
  z18.object({
13028
14384
  inputPort: ContractIdentifierSchema,
@@ -13067,7 +14423,9 @@ var DeclarativeCapabilityAuthoringRegistrationSchema = z18.object({
13067
14423
  ...value.uiSchemaRevisionRef ? [value.uiSchemaRevisionRef] : [],
13068
14424
  ...value.inputPorts.map((port) => port.schemaRevisionRef),
13069
14425
  ...value.outputPorts.map((port) => port.schemaRevisionRef),
13070
- ...value.ontologyRequirements.map((requirement) => requirement.renderModelSchemaRevisionRef)
14426
+ ...value.ontologyRequirements.map(
14427
+ (requirement) => requirement.renderModelSchemaRevisionRef
14428
+ )
13071
14429
  ];
13072
14430
  required.forEach((reference) => {
13073
14431
  const key = `${reference.ownerRepo}:${reference.id}@${reference.revision}:${reference.contentHash}`;
@@ -13179,7 +14537,9 @@ var ProductDeclarativeCapabilityRegistrationSchema = z18.object({
13179
14537
  }
13180
14538
  });
13181
14539
  const permissions = value.requiredPermissionCodes;
13182
- if (new Set(permissions).size !== permissions.length || permissions.some((permission, index) => index > 0 && permissions[index - 1].localeCompare(permission) > 0)) {
14540
+ if (new Set(permissions).size !== permissions.length || permissions.some(
14541
+ (permission, index) => index > 0 && permissions[index - 1].localeCompare(permission) > 0
14542
+ )) {
13183
14543
  context.addIssue({
13184
14544
  code: "custom",
13185
14545
  path: ["requiredPermissionCodes"],
@@ -13333,7 +14693,9 @@ var DeclarativeProductResourceRegistrationSchema = z18.object({
13333
14693
  });
13334
14694
  }
13335
14695
  if (value.resourceKind === "shell") {
13336
- const parsed = DeclarativeShellResourceDocumentSchema.safeParse(value.document);
14696
+ const parsed = DeclarativeShellResourceDocumentSchema.safeParse(
14697
+ value.document
14698
+ );
13337
14699
  if (!parsed.success)
13338
14700
  context.addIssue({
13339
14701
  code: "custom",
@@ -13341,7 +14703,9 @@ var DeclarativeProductResourceRegistrationSchema = z18.object({
13341
14703
  message: `Invalid shell declaration: ${parsed.error.message}`
13342
14704
  });
13343
14705
  if (parsed.success) {
13344
- const declaredSurfaces = new Set(parsed.data.surfaceChrome.map((entry) => entry.surface));
14706
+ const declaredSurfaces = new Set(
14707
+ parsed.data.surfaceChrome.map((entry) => entry.surface)
14708
+ );
13345
14709
  const supportedSurfaces = new Set(value.supportedSurfaces);
13346
14710
  value.supportedSurfaces.forEach((surface) => {
13347
14711
  if (!declaredSurfaces.has(surface))
@@ -13362,7 +14726,9 @@ var DeclarativeProductResourceRegistrationSchema = z18.object({
13362
14726
  }
13363
14727
  }
13364
14728
  if (value.resourceKind === "layout-policy") {
13365
- const parsed = DeclarativeLayoutPolicyResourceDocumentSchema.safeParse(value.document);
14729
+ const parsed = DeclarativeLayoutPolicyResourceDocumentSchema.safeParse(
14730
+ value.document
14731
+ );
13366
14732
  if (!parsed.success)
13367
14733
  context.addIssue({
13368
14734
  code: "custom",
@@ -13371,7 +14737,9 @@ var DeclarativeProductResourceRegistrationSchema = z18.object({
13371
14737
  });
13372
14738
  }
13373
14739
  if (value.resourceKind === "environment") {
13374
- const parsed = DeclarativeEnvironmentResourceDocumentSchema.safeParse(value.document);
14740
+ const parsed = DeclarativeEnvironmentResourceDocumentSchema.safeParse(
14741
+ value.document
14742
+ );
13375
14743
  if (!parsed.success)
13376
14744
  context.addIssue({
13377
14745
  code: "custom",
@@ -13388,7 +14756,15 @@ var DeclarativeProductResourceRegistrationSchema = z18.object({
13388
14756
  }
13389
14757
  });
13390
14758
  var DeclarativeDefaultPolicyRegistrationSchema = z18.object({
13391
- role: z18.enum(["management", "access", "layout", "performance", "observability", "tokens", "environment"]),
14759
+ role: z18.enum([
14760
+ "management",
14761
+ "access",
14762
+ "layout",
14763
+ "performance",
14764
+ "observability",
14765
+ "tokens",
14766
+ "environment"
14767
+ ]),
13392
14768
  resourceRevisionRef: RevisionRefSchema,
13393
14769
  supportedSurfaces: z18.array(ProductSurfaceSchema).min(1)
13394
14770
  }).strict();
@@ -13462,7 +14838,9 @@ var ProductDeclarativeAuthoringCatalogSchema = z18.object({
13462
14838
  applicationId: ContractIdentifierSchema,
13463
14839
  createTemplates: z18.array(DeclarativeCreateTemplateRegistrationSchema),
13464
14840
  routeSpaces: z18.array(DeclarativeRouteSpaceRegistrationSchema),
13465
- resourceRegistrations: z18.array(DeclarativeProductResourceRegistrationSchema),
14841
+ resourceRegistrations: z18.array(
14842
+ DeclarativeProductResourceRegistrationSchema
14843
+ ),
13466
14844
  defaultPolicies: z18.array(DeclarativeDefaultPolicyRegistrationSchema),
13467
14845
  domainQueryDefinitions: z18.array(DeclarativeDomainQueryDefinitionRegistrationSchema).default([]),
13468
14846
  domainCommandDefinitions: z18.array(DeclarativeDomainCommandDefinitionRegistrationSchema).default([]),
@@ -13471,7 +14849,9 @@ var ProductDeclarativeAuthoringCatalogSchema = z18.object({
13471
14849
  }).strict().superRefine((value, context) => {
13472
14850
  const duplicates = (items) => items.find((item, index) => items.indexOf(item) !== index);
13473
14851
  const duplicateTemplate = duplicates(
13474
- value.createTemplates.map((item) => `${item.templateRevisionRef.id}@${item.templateRevisionRef.revision}`)
14852
+ value.createTemplates.map(
14853
+ (item) => `${item.templateRevisionRef.id}@${item.templateRevisionRef.revision}`
14854
+ )
13475
14855
  );
13476
14856
  if (duplicateTemplate)
13477
14857
  context.addIssue({
@@ -13493,7 +14873,9 @@ var ProductDeclarativeAuthoringCatalogSchema = z18.object({
13493
14873
  message: `Duplicate legacy Page migration source ${duplicateMigrationSource}.`
13494
14874
  });
13495
14875
  const duplicateRouteSpace = duplicates(
13496
- value.routeSpaces.map((item) => `${item.routeSpaceRevisionRef.id}@${item.routeSpaceRevisionRef.revision}`)
14876
+ value.routeSpaces.map(
14877
+ (item) => `${item.routeSpaceRevisionRef.id}@${item.routeSpaceRevisionRef.revision}`
14878
+ )
13497
14879
  );
13498
14880
  if (duplicateRouteSpace)
13499
14881
  context.addIssue({
@@ -13535,7 +14917,9 @@ var ProductDeclarativeAuthoringCatalogSchema = z18.object({
13535
14917
  message: `Duplicate Domain Command definition ${duplicateCommandDefinition}.`
13536
14918
  });
13537
14919
  const duplicateSchemaDefinition = duplicates(
13538
- value.schemaDefinitions.map((item) => `${item.definitionRevisionRef.id}@${item.definitionRevisionRef.revision}`)
14920
+ value.schemaDefinitions.map(
14921
+ (item) => `${item.definitionRevisionRef.id}@${item.definitionRevisionRef.revision}`
14922
+ )
13539
14923
  );
13540
14924
  if (duplicateSchemaDefinition)
13541
14925
  context.addIssue({
@@ -13593,7 +14977,7 @@ var DeclarativeProductResourceChoiceSchema = DeclarativeAuthoringChoiceSchema.ex
13593
14977
  }).strict();
13594
14978
  var DeclarativeBindingAuthoringChoiceSchema = DeclarativeAuthoringChoiceSchema.extend({
13595
14979
  bindingTemplate: z18.object({
13596
- kind: z18.enum(["ontology", "view", "action"]),
14980
+ kind: z18.enum(["ontology", "view", "query", "action"]),
13597
14981
  requiredRevisionRefs: z18.array(RevisionRefSchema),
13598
14982
  requiredPermissionCodes: z18.array(ContractIdentifierSchema),
13599
14983
  inputTemplate: z18.record(z18.string(), z18.unknown())
@@ -13609,7 +14993,14 @@ var DeclarativeWorkbenchTargetChoiceSchema = z18.object({
13609
14993
  targetRevisionRef: RevisionRefSchema,
13610
14994
  providerRevisionRef: RevisionRefSchema,
13611
14995
  inputSchemaRevisionRef: RevisionRefSchema,
13612
- kind: z18.enum(["built-in-application", "workflow-form", "workflow", "agent", "design", "capability"]),
14996
+ kind: z18.enum([
14997
+ "built-in-application",
14998
+ "workflow-form",
14999
+ "workflow",
15000
+ "agent",
15001
+ "design",
15002
+ "capability"
15003
+ ]),
13613
15004
  name: I18nTextSchema,
13614
15005
  targetAccessPolicy: AccessPolicySchema,
13615
15006
  supportedSurfaces: z18.array(ProductSurfaceSchema).min(1),
@@ -13660,7 +15051,11 @@ var DeclarativeCreateIntentSchema = z18.object({
13660
15051
  });
13661
15052
  }
13662
15053
  });
13663
- var DeclarativeDocumentSchema = z18.union([PageSchema, NavigationSchema, WorkbenchSchema]);
15054
+ var DeclarativeDocumentSchema = z18.union([
15055
+ PageSchema,
15056
+ NavigationSchema,
15057
+ WorkbenchSchema
15058
+ ]);
13664
15059
  var DeclarativeSaveDraftIntentSchema = z18.object({
13665
15060
  document: DeclarativeDocumentSchema,
13666
15061
  expectedVersion: z18.number().int().nonnegative(),
@@ -13711,6 +15106,7 @@ var DeclarativeAuthoringChoiceKindSchema = z18.enum([
13711
15106
  "capability",
13712
15107
  "ontology",
13713
15108
  "view",
15109
+ "query",
13714
15110
  "action",
13715
15111
  "access",
13716
15112
  "published-target",
@@ -13728,15 +15124,24 @@ var authoringChoicePage = (choiceKind, itemSchema) => z18.object({
13728
15124
  message: "PageInfo returned must match choice item count."
13729
15125
  });
13730
15126
  });
13731
- var DeclarativeAuthoringChoicePageSchema = z18.discriminatedUnion("choiceKind", [
13732
- authoringChoicePage("capability", DeclarativeCapabilityAuthoringChoiceSchema),
13733
- authoringChoicePage("ontology", DeclarativeBindingAuthoringChoiceSchema),
13734
- authoringChoicePage("view", DeclarativeBindingAuthoringChoiceSchema),
13735
- authoringChoicePage("action", DeclarativeBindingAuthoringChoiceSchema),
13736
- authoringChoicePage("access", DeclarativeAuthoringChoiceSchema),
13737
- authoringChoicePage("published-target", DeclarativeAuthoringChoiceSchema),
13738
- authoringChoicePage("workbench-target", DeclarativeWorkbenchTargetChoiceSchema)
13739
- ]);
15127
+ var DeclarativeAuthoringChoicePageSchema = z18.discriminatedUnion(
15128
+ "choiceKind",
15129
+ [
15130
+ authoringChoicePage(
15131
+ "capability",
15132
+ DeclarativeCapabilityAuthoringChoiceSchema
15133
+ ),
15134
+ authoringChoicePage("ontology", DeclarativeBindingAuthoringChoiceSchema),
15135
+ authoringChoicePage("view", DeclarativeBindingAuthoringChoiceSchema),
15136
+ authoringChoicePage("action", DeclarativeBindingAuthoringChoiceSchema),
15137
+ authoringChoicePage("access", DeclarativeAuthoringChoiceSchema),
15138
+ authoringChoicePage("published-target", DeclarativeAuthoringChoiceSchema),
15139
+ authoringChoicePage(
15140
+ "workbench-target",
15141
+ DeclarativeWorkbenchTargetChoiceSchema
15142
+ )
15143
+ ]
15144
+ );
13740
15145
  var DeclarativeAuthoringResourcePageQuerySchema = z18.object({
13741
15146
  resourceKind: DeclarativeResourceKindSchema.optional(),
13742
15147
  resourceId: ContractIdentifierSchema.optional(),
@@ -13787,11 +15192,14 @@ var DeclarativeWorkbenchDocumentSummarySchema = z18.object({
13787
15192
  accessPolicy: AccessPolicySchema,
13788
15193
  managementAccess: ManagementAccessSchema
13789
15194
  }).strict();
13790
- var DeclarativeDocumentSummarySchema = z18.discriminatedUnion("resourceKind", [
13791
- DeclarativePageDocumentSummarySchema,
13792
- DeclarativeNavigationDocumentSummarySchema,
13793
- DeclarativeWorkbenchDocumentSummarySchema
13794
- ]);
15195
+ var DeclarativeDocumentSummarySchema = z18.discriminatedUnion(
15196
+ "resourceKind",
15197
+ [
15198
+ DeclarativePageDocumentSummarySchema,
15199
+ DeclarativeNavigationDocumentSummarySchema,
15200
+ DeclarativeWorkbenchDocumentSummarySchema
15201
+ ]
15202
+ );
13795
15203
  var declarativeReferenceTenantScopeKey = (scope) => JSON.stringify(scope);
13796
15204
  var DeclarativeDefinitionKindByResourceKind = {
13797
15205
  page: "page",
@@ -13830,11 +15238,21 @@ var DeclarativeAuthoringResourceSummarySchema = z18.object({
13830
15238
  }).strict().superRefine((value, context) => {
13831
15239
  const expectedDefinitionKind = DeclarativeDefinitionKindByResourceKind[value.resourceKind];
13832
15240
  const expectedReleaseKind = DeclarativeReleaseKindByResourceKind[value.resourceKind];
13833
- const expectedTenantScope = declarativeReferenceTenantScopeKey(value.tenantScope);
15241
+ const expectedTenantScope = declarativeReferenceTenantScopeKey(
15242
+ value.tenantScope
15243
+ );
13834
15244
  const seenReleaseRefs = /* @__PURE__ */ new Set();
13835
15245
  value.releasePlacements.forEach((placement, index) => {
13836
- const releasePath = ["releasePlacements", index, "releaseRevisionRef"];
13837
- const definitionPath = ["releasePlacements", index, "definitionRevisionRef"];
15246
+ const releasePath = [
15247
+ "releasePlacements",
15248
+ index,
15249
+ "releaseRevisionRef"
15250
+ ];
15251
+ const definitionPath = [
15252
+ "releasePlacements",
15253
+ index,
15254
+ "definitionRevisionRef"
15255
+ ];
13838
15256
  if (placement.releaseRevisionRef.kind !== expectedReleaseKind) {
13839
15257
  context.addIssue({
13840
15258
  code: "custom",
@@ -13842,7 +15260,9 @@ var DeclarativeAuthoringResourceSummarySchema = z18.object({
13842
15260
  message: `Release placement must reference ${expectedReleaseKind}.`
13843
15261
  });
13844
15262
  }
13845
- if (placement.releaseRevisionRef.visibility !== "tenant" || declarativeReferenceTenantScopeKey(placement.releaseRevisionRef.tenantScope) !== expectedTenantScope) {
15263
+ if (placement.releaseRevisionRef.visibility !== "tenant" || declarativeReferenceTenantScopeKey(
15264
+ placement.releaseRevisionRef.tenantScope
15265
+ ) !== expectedTenantScope) {
13846
15266
  context.addIssue({
13847
15267
  code: "custom",
13848
15268
  path: [...releasePath, "tenantScope"],
@@ -13872,7 +15292,9 @@ var DeclarativeAuthoringResourceSummarySchema = z18.object({
13872
15292
  message: "Release placement definition must reference the summary resource."
13873
15293
  });
13874
15294
  }
13875
- if (placement.definitionRevisionRef.visibility !== "tenant" || declarativeReferenceTenantScopeKey(placement.definitionRevisionRef.tenantScope) !== expectedTenantScope) {
15295
+ if (placement.definitionRevisionRef.visibility !== "tenant" || declarativeReferenceTenantScopeKey(
15296
+ placement.definitionRevisionRef.tenantScope
15297
+ ) !== expectedTenantScope) {
13876
15298
  context.addIssue({
13877
15299
  code: "custom",
13878
15300
  path: [...definitionPath, "tenantScope"],
@@ -13936,7 +15358,11 @@ var DeclarativePreviewResultSchema = z18.object({
13936
15358
  expiresAt: z18.string().datetime(),
13937
15359
  revision: z18.number().int().positive(),
13938
15360
  contentHash: Sha256Schema,
13939
- bundle: z18.union([PageRuntimeBundleSchema, NavigationRuntimeBundleSchema, WorkbenchRuntimeBundleSchema]),
15361
+ bundle: z18.union([
15362
+ PageRuntimeBundleSchema,
15363
+ NavigationRuntimeBundleSchema,
15364
+ WorkbenchRuntimeBundleSchema
15365
+ ]),
13940
15366
  etag: z18.string().trim().min(1),
13941
15367
  sourceContentHash: Sha256Schema
13942
15368
  }).strict();
@@ -13944,8 +15370,16 @@ var DeclarativePublicationItemResultSchema = z18.object({
13944
15370
  resourceKind: DeclarativeResourceKindSchema,
13945
15371
  resourceId: ContractIdentifierSchema,
13946
15372
  releaseRevisionRef: RevisionRefSchema,
13947
- release: z18.union([PageReleaseSchema, NavigationReleaseSchema, WorkbenchReleaseSchema]),
13948
- bundle: z18.union([PageRuntimeBundleSchema, NavigationRuntimeBundleSchema, WorkbenchRuntimeBundleSchema]).optional()
15373
+ release: z18.union([
15374
+ PageReleaseSchema,
15375
+ NavigationReleaseSchema,
15376
+ WorkbenchReleaseSchema
15377
+ ]),
15378
+ bundle: z18.union([
15379
+ PageRuntimeBundleSchema,
15380
+ NavigationRuntimeBundleSchema,
15381
+ WorkbenchRuntimeBundleSchema
15382
+ ]).optional()
13949
15383
  }).strict().superRefine((value, context) => {
13950
15384
  const expectedReleaseKind = {
13951
15385
  page: "page-release",
@@ -13988,7 +15422,10 @@ var DeclarativePublicationItemResultSchema = z18.object({
13988
15422
  if (value.bundle) {
13989
15423
  const bundleDefinitionRef = value.bundle.contract === "PageRuntimeBundle" ? value.bundle.pageRevisionRef : value.bundle.contract === "NavigationRuntimeBundle" ? value.bundle.navigationRevisionRef : value.bundle.workbenchRevisionRef;
13990
15424
  const sameRevision = (left, right) => left.kind === right.kind && left.id === right.id && left.ownerRepo === right.ownerRepo && left.revision === right.revision && left.schemaVersion === right.schemaVersion && left.contentHash === right.contentHash;
13991
- if (value.bundle.contract !== expectedBundleContract || !sameRevision(value.bundle.releaseRevisionRef, value.releaseRevisionRef) || !sameRevision(bundleDefinitionRef, definitionRef)) {
15425
+ if (value.bundle.contract !== expectedBundleContract || !sameRevision(
15426
+ value.bundle.releaseRevisionRef,
15427
+ value.releaseRevisionRef
15428
+ ) || !sameRevision(bundleDefinitionRef, definitionRef)) {
13992
15429
  context.addIssue({
13993
15430
  code: "custom",
13994
15431
  path: ["bundle"],
@@ -14217,7 +15654,9 @@ var DeclarativeRuntimeResolvedSchema = z18.object({
14217
15654
  generation: z18.number().int().nonnegative(),
14218
15655
  contentHash: Sha256Schema
14219
15656
  }).strict().superRefine((value, context) => {
14220
- const outcomes = [value.page, value.workbench, value.redirect].filter(Boolean).length;
15657
+ const outcomes = [value.page, value.workbench, value.redirect].filter(
15658
+ Boolean
15659
+ ).length;
14221
15660
  if (outcomes !== 1)
14222
15661
  context.addIssue({
14223
15662
  code: "custom",
@@ -14272,35 +15711,44 @@ var DeclarativeRuntimeDeniedOutcomeSchema = (outcome, code) => z18.object({
14272
15711
  ...DeclarativeRuntimeSafeBaseShape,
14273
15712
  code: z18.literal(code)
14274
15713
  }).strict();
14275
- var DeclarativeRuntimeForbiddenOutcomeSchema = z18.discriminatedUnion("resourceKind", [
14276
- z18.object({
14277
- outcome: z18.literal("forbidden"),
14278
- ...DeclarativeRuntimeSafeBaseShape,
14279
- resourceKind: z18.literal("page"),
14280
- code: z18.literal("DECLARATIVE_PAGE_FORBIDDEN"),
14281
- presentation: PageRouteStatePresentationSchema.optional()
14282
- }).strict().superRefine((value, context) => {
14283
- if (value.presentation && value.presentation.surface !== value.surface) {
14284
- context.addIssue({
14285
- code: "custom",
14286
- path: ["presentation", "surface"],
14287
- message: "A forbidden Page presentation must match the resolved route surface."
14288
- });
14289
- }
14290
- }),
14291
- z18.object({
14292
- outcome: z18.literal("forbidden"),
14293
- ...DeclarativeRuntimeSafeBaseShape,
14294
- resourceKind: z18.literal("workbench"),
14295
- code: z18.literal("DECLARATIVE_WORKBENCH_FORBIDDEN")
14296
- }).strict()
14297
- ]);
15714
+ var DeclarativeRuntimeForbiddenOutcomeSchema = z18.discriminatedUnion(
15715
+ "resourceKind",
15716
+ [
15717
+ z18.object({
15718
+ outcome: z18.literal("forbidden"),
15719
+ ...DeclarativeRuntimeSafeBaseShape,
15720
+ resourceKind: z18.literal("page"),
15721
+ code: z18.literal("DECLARATIVE_PAGE_FORBIDDEN"),
15722
+ presentation: PageRouteStatePresentationSchema.optional()
15723
+ }).strict().superRefine((value, context) => {
15724
+ if (value.presentation && value.presentation.surface !== value.surface) {
15725
+ context.addIssue({
15726
+ code: "custom",
15727
+ path: ["presentation", "surface"],
15728
+ message: "A forbidden Page presentation must match the resolved route surface."
15729
+ });
15730
+ }
15731
+ }),
15732
+ z18.object({
15733
+ outcome: z18.literal("forbidden"),
15734
+ ...DeclarativeRuntimeSafeBaseShape,
15735
+ resourceKind: z18.literal("workbench"),
15736
+ code: z18.literal("DECLARATIVE_WORKBENCH_FORBIDDEN")
15737
+ }).strict()
15738
+ ]
15739
+ );
14298
15740
  var DeclarativeRuntimeResolveResultSchema = z18.union([
14299
15741
  DeclarativeRuntimeLegacyOutcomeSchema,
14300
15742
  DeclarativeRuntimeAuthorizedOutcomeSchema,
14301
15743
  DeclarativeRuntimeForbiddenOutcomeSchema,
14302
- DeclarativeRuntimeDeniedOutcomeSchema("unavailable", "DECLARATIVE_ROUTE_UNAVAILABLE"),
14303
- DeclarativeRuntimeDeniedOutcomeSchema("not-found", "DECLARATIVE_ROUTE_NOT_FOUND")
15744
+ DeclarativeRuntimeDeniedOutcomeSchema(
15745
+ "unavailable",
15746
+ "DECLARATIVE_ROUTE_UNAVAILABLE"
15747
+ ),
15748
+ DeclarativeRuntimeDeniedOutcomeSchema(
15749
+ "not-found",
15750
+ "DECLARATIVE_ROUTE_NOT_FOUND"
15751
+ )
14304
15752
  ]);
14305
15753
  var DeclarativeNavigationRuntimeBootstrapSchema = z18.object({
14306
15754
  placements: z18.array(
@@ -14366,7 +15814,9 @@ var DeclarativeNavigationRuntimeBootstrapSchema = z18.object({
14366
15814
  authDigest: Sha256Schema,
14367
15815
  etag: z18.string().trim().min(1)
14368
15816
  }).strict().superRefine((value, context) => {
14369
- const active = value.placements.filter((entry) => entry.authority === "declarative" && entry.state === "active");
15817
+ const active = value.placements.filter(
15818
+ (entry) => entry.authority === "declarative" && entry.state === "active"
15819
+ );
14370
15820
  if (active.length !== value.bundles.length || active.length !== value.releaseSlotIds.length) {
14371
15821
  context.addIssue({
14372
15822
  code: "custom",
@@ -14519,7 +15969,10 @@ var DeclarativeRuntimeRouteOwnerSchema = z18.object({
14519
15969
  surface: ProductSurfaceSchema,
14520
15970
  normalizedPath: z18.string().trim().startsWith("/").max(2048),
14521
15971
  routeParameters: DeclarativeRuntimeRouteParametersSchema,
14522
- owner: z18.discriminatedUnion("authority", [DeclarativeLegacyRouteOwnerSchema, DeclarativeReleaseRouteOwnerSchema]),
15972
+ owner: z18.discriminatedUnion("authority", [
15973
+ DeclarativeLegacyRouteOwnerSchema,
15974
+ DeclarativeReleaseRouteOwnerSchema
15975
+ ]),
14523
15976
  contentHash: Sha256Schema
14524
15977
  }).strict();
14525
15978
 
@@ -18085,6 +19538,7 @@ var WorkflowParameterTypeOptionsSchema = z22.object({
18085
19538
  enableBooleanSwitchMode: z22.boolean().optional(),
18086
19539
  enableClear: z22.boolean().optional(),
18087
19540
  enableExpand: z22.boolean().optional(),
19541
+ enableImageCrop: z22.boolean().optional(),
18088
19542
  enableImageMask: z22.boolean().optional(),
18089
19543
  enableImageOverlay: z22.boolean().optional(),
18090
19544
  enablePopupEditor: z22.boolean().optional(),
@@ -18672,14 +20126,14 @@ var canonicalContractSchemas = {
18672
20126
  "menu-definition": MenuDefinitionSchema,
18673
20127
  "menu-definition-set": MenuDefinitionSetSchema,
18674
20128
  "menu-runtime-bundle": MenuRuntimeBundleSchema,
18675
- "navigation": NavigationSchema,
20129
+ navigation: NavigationSchema,
18676
20130
  "navigation-release": NavigationReleaseSchema,
18677
20131
  "navigation-runtime-bundle": NavigationRuntimeBundleSchema,
18678
20132
  "ontology-definition": OntologyDefinitionSchema,
18679
20133
  "overlay-node": OverlayNodeSchema,
18680
20134
  "output-record": OutputRecordSchema,
18681
20135
  "page-definition": PageDefinitionSchema,
18682
- "page": PageSchema,
20136
+ page: PageSchema,
18683
20137
  "page-release": PageReleaseSchema,
18684
20138
  "page-runtime-bundle": PageRuntimeBundleSchema,
18685
20139
  "page-runtime-descriptor": PageRuntimeDescriptorSchema,
@@ -18713,7 +20167,7 @@ var canonicalContractSchemas = {
18713
20167
  "trend-metric-snapshot": TrendMetricSnapshotSchema,
18714
20168
  "trend-source-record": TrendSourceRecordSchema,
18715
20169
  "view-provider-descriptor": ViewProviderDescriptorSchema,
18716
- "workbench": WorkbenchSchema,
20170
+ workbench: WorkbenchSchema,
18717
20171
  "workbench-release": WorkbenchReleaseSchema,
18718
20172
  "workbench-runtime-bundle": WorkbenchRuntimeBundleSchema,
18719
20173
  "workflow-definition": WorkflowDefinitionSchema,
@@ -18982,6 +20436,7 @@ export {
18982
20436
  RenderTreeSchema,
18983
20437
  RequestScopeSchema,
18984
20438
  ResolvedNavigationTargetSchema,
20439
+ ResolvedPageSchema,
18985
20440
  ResolvedThemeTokensSchema,
18986
20441
  ResolvedWorkbenchAppInstanceSchema,
18987
20442
  RevisionRefSchema,