@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
@@ -8074,15 +8074,30 @@ var RenderScrollSchema = z7.object({
8074
8074
  });
8075
8075
  var RenderActivationSchema = z7.object({
8076
8076
  activationId: ContractIdentifierSchema,
8077
- mode: z7.enum(["navigate", "select", "drawer", "modal", "fullscreen", "inline"]),
8077
+ mode: z7.enum([
8078
+ "navigate",
8079
+ "select",
8080
+ "drawer",
8081
+ "modal",
8082
+ "fullscreen",
8083
+ "inline"
8084
+ ]),
8078
8085
  targetPath: z7.string().trim().regex(/^\/(?!\/)/, "Expected an application-relative path.").optional(),
8079
8086
  history: z7.enum(["push", "replace"]).optional()
8080
8087
  }).strict().superRefine((activation, context) => {
8081
8088
  if (activation.mode === "navigate" && !activation.targetPath) {
8082
- context.addIssue({ code: "custom", path: ["targetPath"], message: "Navigate activation requires an application-relative targetPath." });
8089
+ context.addIssue({
8090
+ code: "custom",
8091
+ path: ["targetPath"],
8092
+ message: "Navigate activation requires an application-relative targetPath."
8093
+ });
8083
8094
  }
8084
8095
  if (activation.mode !== "navigate" && activation.targetPath) {
8085
- context.addIssue({ code: "custom", path: ["targetPath"], message: "Only navigate activation may declare targetPath." });
8096
+ context.addIssue({
8097
+ code: "custom",
8098
+ path: ["targetPath"],
8099
+ message: "Only navigate activation may declare targetPath."
8100
+ });
8086
8101
  }
8087
8102
  });
8088
8103
  var RenderLifecycleSchema = z7.object({
@@ -8101,13 +8116,25 @@ var RenderLayoutSchema = z7.object({
8101
8116
  gapTokenRef: EntityRefSchema.optional()
8102
8117
  }).strict().superRefine((layout, context) => {
8103
8118
  if (layout.direction && layout.mode !== "flex") {
8104
- context.addIssue({ code: "custom", path: ["direction"], message: "direction is only valid for flex layout." });
8119
+ context.addIssue({
8120
+ code: "custom",
8121
+ path: ["direction"],
8122
+ message: "direction is only valid for flex layout."
8123
+ });
8105
8124
  }
8106
8125
  if (layout.columns && layout.mode !== "grid") {
8107
- context.addIssue({ code: "custom", path: ["columns"], message: "columns is only valid for grid layout." });
8126
+ context.addIssue({
8127
+ code: "custom",
8128
+ path: ["columns"],
8129
+ message: "columns is only valid for grid layout."
8130
+ });
8108
8131
  }
8109
8132
  if (layout.gapTokenRef && layout.gapTokenRef.kind !== "design-token") {
8110
- context.addIssue({ code: "custom", path: ["gapTokenRef", "kind"], message: "gapTokenRef must reference design-token." });
8133
+ context.addIssue({
8134
+ code: "custom",
8135
+ path: ["gapTokenRef", "kind"],
8136
+ message: "gapTokenRef must reference design-token."
8137
+ });
8111
8138
  }
8112
8139
  });
8113
8140
  var RenderResponsiveRuleSchema = z7.object({
@@ -8116,12 +8143,103 @@ var RenderResponsiveRuleSchema = z7.object({
8116
8143
  layout: RenderLayoutSchema
8117
8144
  }).strict().superRefine((rule, context) => {
8118
8145
  if (rule.minWidthPx === void 0 && rule.maxWidthPx === void 0) {
8119
- context.addIssue({ code: "custom", path: [], message: "Responsive rule must declare minWidthPx or maxWidthPx." });
8146
+ context.addIssue({
8147
+ code: "custom",
8148
+ path: [],
8149
+ message: "Responsive rule must declare minWidthPx or maxWidthPx."
8150
+ });
8120
8151
  }
8121
8152
  if (rule.minWidthPx !== void 0 && rule.maxWidthPx !== void 0 && rule.minWidthPx > rule.maxWidthPx) {
8122
- context.addIssue({ code: "custom", path: ["maxWidthPx"], message: "maxWidthPx must be greater than or equal to minWidthPx." });
8153
+ context.addIssue({
8154
+ code: "custom",
8155
+ path: ["maxWidthPx"],
8156
+ message: "maxWidthPx must be greater than or equal to minWidthPx."
8157
+ });
8123
8158
  }
8124
8159
  });
8160
+ var RenderStyleValueSchema = z7.union([
8161
+ z7.number().finite(),
8162
+ z7.string().trim().min(1).max(256).superRefine((value, context) => {
8163
+ if (/[;{}]/.test(value) || /(?:url|expression|javascript|var)\s*\(/i.test(value)) {
8164
+ context.addIssue({
8165
+ code: "custom",
8166
+ message: "Render style values must be bounded CSS values or $ Design Token references."
8167
+ });
8168
+ }
8169
+ })
8170
+ ]);
8171
+ var RenderStyleSchema = z7.object({
8172
+ width: RenderStyleValueSchema.optional(),
8173
+ height: RenderStyleValueSchema.optional(),
8174
+ minWidth: RenderStyleValueSchema.optional(),
8175
+ maxWidth: RenderStyleValueSchema.optional(),
8176
+ minHeight: RenderStyleValueSchema.optional(),
8177
+ maxHeight: RenderStyleValueSchema.optional(),
8178
+ padding: RenderStyleValueSchema.optional(),
8179
+ paddingBlock: RenderStyleValueSchema.optional(),
8180
+ paddingInline: RenderStyleValueSchema.optional(),
8181
+ margin: RenderStyleValueSchema.optional(),
8182
+ marginBlockStart: RenderStyleValueSchema.optional(),
8183
+ marginBlockEnd: RenderStyleValueSchema.optional(),
8184
+ marginInlineStart: RenderStyleValueSchema.optional(),
8185
+ marginInlineEnd: RenderStyleValueSchema.optional(),
8186
+ display: z7.enum([
8187
+ "none",
8188
+ "block",
8189
+ "inline",
8190
+ "inline-block",
8191
+ "flex",
8192
+ "inline-flex",
8193
+ "grid",
8194
+ "contents"
8195
+ ]).optional(),
8196
+ gap: RenderStyleValueSchema.optional(),
8197
+ rowGap: RenderStyleValueSchema.optional(),
8198
+ columnGap: RenderStyleValueSchema.optional(),
8199
+ background: RenderStyleValueSchema.optional(),
8200
+ color: RenderStyleValueSchema.optional(),
8201
+ borderColor: RenderStyleValueSchema.optional(),
8202
+ borderWidth: RenderStyleValueSchema.optional(),
8203
+ borderStyle: z7.enum(["none", "solid", "dashed", "dotted"]).optional(),
8204
+ borderRadius: RenderStyleValueSchema.optional(),
8205
+ boxShadow: RenderStyleValueSchema.optional(),
8206
+ fontSize: RenderStyleValueSchema.optional(),
8207
+ fontFamily: RenderStyleValueSchema.optional(),
8208
+ fontWeight: RenderStyleValueSchema.optional(),
8209
+ lineHeight: RenderStyleValueSchema.optional(),
8210
+ textAlign: z7.enum(["start", "center", "end", "left", "right"]).optional(),
8211
+ whiteSpace: z7.enum(["normal", "nowrap", "pre", "pre-wrap", "pre-line", "break-spaces"]).optional(),
8212
+ overflow: z7.enum(["visible", "hidden", "auto", "scroll", "clip"]).optional(),
8213
+ overflowX: z7.enum(["visible", "hidden", "auto", "scroll", "clip"]).optional(),
8214
+ overflowY: z7.enum(["visible", "hidden", "auto", "scroll", "clip"]).optional(),
8215
+ position: z7.enum(["static", "relative", "absolute", "sticky", "fixed"]).optional(),
8216
+ inset: RenderStyleValueSchema.optional(),
8217
+ top: RenderStyleValueSchema.optional(),
8218
+ right: RenderStyleValueSchema.optional(),
8219
+ bottom: RenderStyleValueSchema.optional(),
8220
+ left: RenderStyleValueSchema.optional(),
8221
+ gridTemplateColumns: RenderStyleValueSchema.optional(),
8222
+ gridColumn: RenderStyleValueSchema.optional(),
8223
+ gridRow: RenderStyleValueSchema.optional(),
8224
+ flex: RenderStyleValueSchema.optional(),
8225
+ flexDirection: z7.enum(["row", "row-reverse", "column", "column-reverse"]).optional(),
8226
+ flexWrap: z7.enum(["nowrap", "wrap", "wrap-reverse"]).optional(),
8227
+ alignItems: z7.enum(["start", "center", "end", "stretch", "baseline"]).optional(),
8228
+ justifyContent: z7.enum([
8229
+ "start",
8230
+ "center",
8231
+ "end",
8232
+ "space-between",
8233
+ "space-around",
8234
+ "space-evenly"
8235
+ ]).optional(),
8236
+ flexGrow: z7.number().finite().nonnegative().optional(),
8237
+ flexShrink: z7.number().finite().nonnegative().optional(),
8238
+ alignSelf: z7.enum(["auto", "start", "center", "end", "stretch"]).optional(),
8239
+ justifySelf: z7.enum(["auto", "start", "center", "end", "stretch"]).optional(),
8240
+ objectFit: z7.enum(["contain", "cover", "fill", "none", "scale-down"]).optional(),
8241
+ opacity: z7.number().finite().min(0).max(1).optional()
8242
+ }).strict();
8125
8243
  var requireRef = (reference, expectedKind, path, context) => {
8126
8244
  if (!reference) return;
8127
8245
  if (reference.kind !== expectedKind) {
@@ -8170,16 +8288,31 @@ var RenderNodeSchema = z7.object({
8170
8288
  activation: RenderActivationSchema,
8171
8289
  lifecycle: RenderLifecycleSchema,
8172
8290
  layout: RenderLayoutSchema,
8291
+ style: RenderStyleSchema.optional(),
8173
8292
  responsive: z7.array(RenderResponsiveRuleSchema),
8174
8293
  accessRef: EntityRefSchema.optional(),
8175
8294
  evidenceRef: EntityRefSchema.optional(),
8176
8295
  state: RenderNodeStateSchema,
8177
8296
  renderModel: JsonObjectSchema,
8178
- repeat: z7.object({ source: PageExpressionSchema, keyPath: PageValuePathSchema.min(1), limit: z7.number().int().min(1).max(1e3).default(200) }).strict().optional()
8297
+ repeat: z7.object({
8298
+ source: PageExpressionSchema,
8299
+ keyPath: PageValuePathSchema.min(1),
8300
+ limit: z7.number().int().min(1).max(1e3).default(200)
8301
+ }).strict().optional()
8179
8302
  }).strict().superRefine((node, context) => {
8180
8303
  requireRef(node.pageRef, "page", ["pageRef"], context);
8181
- requirePinnedOwnedRef(node.capabilityRef, "capability", ["capabilityRef"], context);
8182
- requirePinnedOwnedRef(node.providerRef, "view-provider", ["providerRef"], context);
8304
+ requirePinnedOwnedRef(
8305
+ node.capabilityRef,
8306
+ "capability",
8307
+ ["capabilityRef"],
8308
+ context
8309
+ );
8310
+ requirePinnedOwnedRef(
8311
+ node.providerRef,
8312
+ "view-provider",
8313
+ ["providerRef"],
8314
+ context
8315
+ );
8183
8316
  requireRef(node.accessRef, "access-policy", ["accessRef"], context);
8184
8317
  requireRef(node.evidenceRef, "evidence", ["evidenceRef"], context);
8185
8318
  if (node.parentNodeId === node.nodeId) {
@@ -8190,10 +8323,18 @@ var RenderNodeSchema = z7.object({
8190
8323
  });
8191
8324
  }
8192
8325
  if (new Set(node.children).size !== node.children.length) {
8193
- context.addIssue({ code: "custom", path: ["children"], message: "RenderNode children must be unique." });
8326
+ context.addIssue({
8327
+ code: "custom",
8328
+ path: ["children"],
8329
+ message: "RenderNode children must be unique."
8330
+ });
8194
8331
  }
8195
8332
  if (node.children.includes(node.nodeId)) {
8196
- context.addIssue({ code: "custom", path: ["children"], message: "RenderNode cannot be its own child." });
8333
+ context.addIssue({
8334
+ code: "custom",
8335
+ path: ["children"],
8336
+ message: "RenderNode cannot be its own child."
8337
+ });
8197
8338
  }
8198
8339
  if (node.surface.frameOwner === "provider" && !node.providerRef) {
8199
8340
  context.addIssue({
@@ -8313,9 +8454,28 @@ var ViewProviderDescriptorSchema = z7.object({
8313
8454
  loading: z7.enum(["eager", "lazy", "viewport", "on-activation"]),
8314
8455
  stateOwner: z7.enum(["host", "provider", "external"]),
8315
8456
  supportedPageTypes: z7.array(ContractIdentifierSchema).min(1),
8316
- supportedSurfaces: z7.array(z7.enum(["page", "workspace", "view", "record", "action", "overlay", "agent"])).min(1),
8457
+ supportedSurfaces: z7.array(
8458
+ z7.enum([
8459
+ "page",
8460
+ "workspace",
8461
+ "view",
8462
+ "record",
8463
+ "action",
8464
+ "overlay",
8465
+ "agent"
8466
+ ])
8467
+ ).min(1),
8317
8468
  frameOwner: z7.enum(["host", "provider", "none"]),
8318
- sideEffects: z7.array(z7.enum(["network", "storage", "navigation", "clipboard", "worker", "websocket"])),
8469
+ sideEffects: z7.array(
8470
+ z7.enum([
8471
+ "network",
8472
+ "storage",
8473
+ "navigation",
8474
+ "clipboard",
8475
+ "worker",
8476
+ "websocket"
8477
+ ])
8478
+ ),
8319
8479
  sideEffectAdapterRef: EntityRefSchema.optional(),
8320
8480
  lifecycle: z7.object({
8321
8481
  preserveMount: z7.boolean(),
@@ -8330,8 +8490,18 @@ var ViewProviderDescriptorSchema = z7.object({
8330
8490
  accessRef: EntityRefSchema.optional(),
8331
8491
  evidenceRef: EntityRefSchema.optional()
8332
8492
  }).strict().superRefine((provider, context) => {
8333
- requirePinnedOwnedRef(provider.capabilityRef, "capability", ["capabilityRef"], context);
8334
- requirePinnedOwnedRef(provider.sideEffectAdapterRef, "side-effect-adapter", ["sideEffectAdapterRef"], context);
8493
+ requirePinnedOwnedRef(
8494
+ provider.capabilityRef,
8495
+ "capability",
8496
+ ["capabilityRef"],
8497
+ context
8498
+ );
8499
+ requirePinnedOwnedRef(
8500
+ provider.sideEffectAdapterRef,
8501
+ "side-effect-adapter",
8502
+ ["sideEffectAdapterRef"],
8503
+ context
8504
+ );
8335
8505
  requireRef(provider.accessRef, "access-policy", ["accessRef"], context);
8336
8506
  requireRef(provider.evidenceRef, "evidence", ["evidenceRef"], context);
8337
8507
  if (provider.capabilityRef.version === void 0) {
@@ -8349,10 +8519,18 @@ var ViewProviderDescriptorSchema = z7.object({
8349
8519
  });
8350
8520
  }
8351
8521
  if (provider.sideEffects.length > 0 && !provider.sideEffectAdapterRef) {
8352
- context.addIssue({ code: "custom", path: ["sideEffectAdapterRef"], message: "Providers with side effects require a pinned side-effect adapter." });
8522
+ context.addIssue({
8523
+ code: "custom",
8524
+ path: ["sideEffectAdapterRef"],
8525
+ message: "Providers with side effects require a pinned side-effect adapter."
8526
+ });
8353
8527
  }
8354
8528
  if (provider.sideEffects.length === 0 && provider.sideEffectAdapterRef) {
8355
- context.addIssue({ code: "custom", path: ["sideEffectAdapterRef"], message: "Pure providers cannot declare a side-effect adapter." });
8529
+ context.addIssue({
8530
+ code: "custom",
8531
+ path: ["sideEffectAdapterRef"],
8532
+ message: "Pure providers cannot declare a side-effect adapter."
8533
+ });
8356
8534
  }
8357
8535
  });
8358
8536
 
@@ -9084,7 +9262,10 @@ var StableRefAliasMapSchema = z14.object({
9084
9262
  aliases: z14.array(StableRefAliasSchema),
9085
9263
  contentHash: Sha256Schema
9086
9264
  }).strict().superRefine((value, context) => {
9087
- const duplicate = uniqueArray(value.aliases, (entry) => stableRefIdentity(entry.aliasRef));
9265
+ const duplicate = uniqueArray(
9266
+ value.aliases,
9267
+ (entry) => stableRefIdentity(entry.aliasRef)
9268
+ );
9088
9269
  if (duplicate)
9089
9270
  context.addIssue({
9090
9271
  code: "custom",
@@ -9092,15 +9273,25 @@ var StableRefAliasMapSchema = z14.object({
9092
9273
  message: `Duplicate alias reference: ${duplicate}`
9093
9274
  });
9094
9275
  });
9095
- var DeclarativeLifecycleSchema = z14.enum(["active", "deprecated", "retired"]);
9096
- var ProductSurfaceSchema = z14.enum(["studio", "kernel"]);
9097
- var DeclarativeShellHeaderChromeSchema = z14.discriminatedUnion("enabled", [
9098
- z14.object({ enabled: z14.literal(false) }).strict(),
9099
- z14.object({
9100
- enabled: z14.literal(true),
9101
- navigationPlacement: z14.enum(["studio.headbar.primary", "kernel.primary"])
9102
- }).strict()
9276
+ var DeclarativeLifecycleSchema = z14.enum([
9277
+ "active",
9278
+ "deprecated",
9279
+ "retired"
9103
9280
  ]);
9281
+ var ProductSurfaceSchema = z14.enum(["studio", "kernel"]);
9282
+ var DeclarativeShellHeaderChromeSchema = z14.discriminatedUnion(
9283
+ "enabled",
9284
+ [
9285
+ z14.object({ enabled: z14.literal(false) }).strict(),
9286
+ z14.object({
9287
+ enabled: z14.literal(true),
9288
+ navigationPlacement: z14.enum([
9289
+ "studio.headbar.primary",
9290
+ "kernel.primary"
9291
+ ])
9292
+ }).strict()
9293
+ ]
9294
+ );
9104
9295
  var DeclarativeShellSurfaceChromeSchema = z14.object({
9105
9296
  surface: ProductSurfaceSchema,
9106
9297
  header: DeclarativeShellHeaderChromeSchema
@@ -9135,15 +9326,17 @@ var GroupRefSchema = StableRefSchema.superRefine((value, context) => {
9135
9326
  message: "Access group references must use kind group."
9136
9327
  });
9137
9328
  });
9138
- var AccessConditionRefSchema = RevisionRefSchema.superRefine((value, context) => {
9139
- if (value.kind !== "access-condition") {
9140
- context.addIssue({
9141
- code: "custom",
9142
- path: ["kind"],
9143
- message: "Access condition references must use kind access-condition."
9144
- });
9329
+ var AccessConditionRefSchema = RevisionRefSchema.superRefine(
9330
+ (value, context) => {
9331
+ if (value.kind !== "access-condition") {
9332
+ context.addIssue({
9333
+ code: "custom",
9334
+ path: ["kind"],
9335
+ message: "Access condition references must use kind access-condition."
9336
+ });
9337
+ }
9145
9338
  }
9146
- });
9339
+ );
9147
9340
  var AccessPolicySchema = z14.object({
9148
9341
  authenticated: z14.boolean(),
9149
9342
  groupAllOf: z14.array(GroupRefSchema),
@@ -9153,8 +9346,16 @@ var AccessPolicySchema = z14.object({
9153
9346
  conditionAllOf: z14.array(AccessConditionRefSchema)
9154
9347
  }).strict().superRefine((value, context) => {
9155
9348
  const checks = [
9156
- ["groupAllOf", value.groupAllOf, (candidate) => stableRefIdentity(candidate)],
9157
- ["groupAnyOf", value.groupAnyOf, (candidate) => stableRefIdentity(candidate)],
9349
+ [
9350
+ "groupAllOf",
9351
+ value.groupAllOf,
9352
+ (candidate) => stableRefIdentity(candidate)
9353
+ ],
9354
+ [
9355
+ "groupAnyOf",
9356
+ value.groupAnyOf,
9357
+ (candidate) => stableRefIdentity(candidate)
9358
+ ],
9158
9359
  ["permissionAllOf", value.permissionAllOf, String],
9159
9360
  ["permissionAnyOf", value.permissionAnyOf, String],
9160
9361
  [
@@ -9320,14 +9521,19 @@ var validateReleaseRouteSurface = (target, context) => {
9320
9521
  const claimSurface = "surface" in target.routeClaim ? target.routeClaim.surface : void 0;
9321
9522
  const matcherSurface = "surface" in target.routeClaim.matcher ? target.routeClaim.matcher.surface : void 0;
9322
9523
  if (claimSurface === void 0 && matcherSurface === void 0) return;
9323
- if (claimSurface === target.surface && matcherSurface === target.surface) return;
9524
+ if (claimSurface === target.surface && matcherSurface === target.surface)
9525
+ return;
9324
9526
  context.addIssue({
9325
9527
  code: "custom",
9326
9528
  path: ["target", "routeClaim"],
9327
9529
  message: "A compiled Release route claim must either be fully legacy or bind both claim and matcher to the target surface."
9328
9530
  });
9329
9531
  };
9330
- var ReleaseOperationSchema = z14.enum(["activate", "deactivate", "rollback"]);
9532
+ var ReleaseOperationSchema = z14.enum([
9533
+ "activate",
9534
+ "deactivate",
9535
+ "rollback"
9536
+ ]);
9331
9537
  var ReleaseDependencyRoleSchema = z14.enum([
9332
9538
  "route-space",
9333
9539
  "shell",
@@ -9418,8 +9624,16 @@ var ReleaseEvidenceSchema = z14.object({
9418
9624
  }).strict().superRefine((value, context) => {
9419
9625
  const expectedKinds = [
9420
9626
  ["publicationPlanRef", value.publicationPlanRef, "publication-plan"],
9421
- ["approvalPolicyRevisionRef", value.approvalPolicyRevisionRef, "approval-policy"],
9422
- ["approvalDecisionRevisionRef", value.approvalDecisionRevisionRef, "approval-decision"],
9627
+ [
9628
+ "approvalPolicyRevisionRef",
9629
+ value.approvalPolicyRevisionRef,
9630
+ "approval-policy"
9631
+ ],
9632
+ [
9633
+ "approvalDecisionRevisionRef",
9634
+ value.approvalDecisionRevisionRef,
9635
+ "approval-decision"
9636
+ ],
9423
9637
  ["actorRef", value.actorRef, "actor"]
9424
9638
  ];
9425
9639
  expectedKinds.forEach(([field, reference, expectedKind]) => {
@@ -9441,7 +9655,11 @@ var ReleaseEvidenceSchema = z14.object({
9441
9655
  });
9442
9656
  });
9443
9657
  var PublicationPlanOperationSchema = z14.object({
9444
- releaseKind: z14.enum(["page-release", "workbench-release", "navigation-release"]),
9658
+ releaseKind: z14.enum([
9659
+ "page-release",
9660
+ "workbench-release",
9661
+ "navigation-release"
9662
+ ]),
9445
9663
  releaseSlotId: ContractIdentifierSchema,
9446
9664
  releaseRevisionRef: RevisionRefSchema,
9447
9665
  expectedHeadRevisionRef: RevisionRefSchema.nullable()
@@ -9482,10 +9700,23 @@ var PublicationPlanSchema = z14.object({
9482
9700
  path: ["environmentRef", "kind"],
9483
9701
  message: "Publication Plan requires an environment reference."
9484
9702
  });
9485
- validateTenantCompatibleReference(value.environmentRef, value.tenantScope, ["environmentRef"], context);
9703
+ validateTenantCompatibleReference(
9704
+ value.environmentRef,
9705
+ value.tenantScope,
9706
+ ["environmentRef"],
9707
+ context
9708
+ );
9486
9709
  const governedRefs = [
9487
- ["approvalPolicyRevisionRef", value.approvalPolicyRevisionRef, "approval-policy"],
9488
- ["approvalDecisionRevisionRef", value.approvalDecisionRevisionRef, "approval-decision"],
9710
+ [
9711
+ "approvalPolicyRevisionRef",
9712
+ value.approvalPolicyRevisionRef,
9713
+ "approval-policy"
9714
+ ],
9715
+ [
9716
+ "approvalDecisionRevisionRef",
9717
+ value.approvalDecisionRevisionRef,
9718
+ "approval-decision"
9719
+ ],
9489
9720
  ["actorRef", value.actorRef, "actor"]
9490
9721
  ];
9491
9722
  governedRefs.forEach(([field, reference, expectedKind]) => {
@@ -9495,19 +9726,26 @@ var PublicationPlanSchema = z14.object({
9495
9726
  path: [field, "kind"],
9496
9727
  message: `${field} must reference ${expectedKind}.`
9497
9728
  });
9498
- validateTenantCompatibleReference(reference, value.tenantScope, [field], context);
9729
+ validateTenantCompatibleReference(
9730
+ reference,
9731
+ value.tenantScope,
9732
+ [field],
9733
+ context
9734
+ );
9499
9735
  });
9500
9736
  value.operations.forEach((operation, index) => {
9501
- [operation.releaseRevisionRef, operation.expectedHeadRevisionRef].forEach((reference, referenceIndex) => {
9502
- if (reference?.tenantScope && tenantScopeKey(reference.tenantScope) !== tenantScopeKey(value.tenantScope)) {
9503
- const field = referenceIndex === 0 ? "releaseRevisionRef" : "expectedHeadRevisionRef";
9504
- context.addIssue({
9505
- code: "custom",
9506
- path: ["operations", index, field, "tenantScope"],
9507
- message: "Publication Plan operation belongs to another tenant scope."
9508
- });
9737
+ [operation.releaseRevisionRef, operation.expectedHeadRevisionRef].forEach(
9738
+ (reference, referenceIndex) => {
9739
+ if (reference?.tenantScope && tenantScopeKey(reference.tenantScope) !== tenantScopeKey(value.tenantScope)) {
9740
+ const field = referenceIndex === 0 ? "releaseRevisionRef" : "expectedHeadRevisionRef";
9741
+ context.addIssue({
9742
+ code: "custom",
9743
+ path: ["operations", index, field, "tenantScope"],
9744
+ message: "Publication Plan operation belongs to another tenant scope."
9745
+ });
9746
+ }
9509
9747
  }
9510
- });
9748
+ );
9511
9749
  });
9512
9750
  value.evidenceRefs.forEach((reference, index) => {
9513
9751
  if (reference.kind !== "evidence")
@@ -9516,9 +9754,17 @@ var PublicationPlanSchema = z14.object({
9516
9754
  path: ["evidenceRefs", index, "kind"],
9517
9755
  message: "Publication Plan evidenceRefs must reference evidence revisions."
9518
9756
  });
9519
- validateTenantCompatibleReference(reference, value.tenantScope, ["evidenceRefs", index], context);
9757
+ validateTenantCompatibleReference(
9758
+ reference,
9759
+ value.tenantScope,
9760
+ ["evidenceRefs", index],
9761
+ context
9762
+ );
9520
9763
  });
9521
- if (uniqueArray(value.operations, (operation) => `${operation.releaseKind}:${operation.releaseSlotId}`)) {
9764
+ if (uniqueArray(
9765
+ value.operations,
9766
+ (operation) => `${operation.releaseKind}:${operation.releaseSlotId}`
9767
+ )) {
9522
9768
  context.addIssue({
9523
9769
  code: "custom",
9524
9770
  path: ["operations"],
@@ -9705,11 +9951,20 @@ var validateReleaseGovernanceScope = (value, expectedKind, context) => {
9705
9951
  }
9706
9952
  const governedEvidenceRefs = [
9707
9953
  [["evidence", "publicationPlanRef"], value.evidence.publicationPlanRef],
9708
- [["evidence", "approvalPolicyRevisionRef"], value.evidence.approvalPolicyRevisionRef],
9709
- [["evidence", "approvalDecisionRevisionRef"], value.evidence.approvalDecisionRevisionRef],
9954
+ [
9955
+ ["evidence", "approvalPolicyRevisionRef"],
9956
+ value.evidence.approvalPolicyRevisionRef
9957
+ ],
9958
+ [
9959
+ ["evidence", "approvalDecisionRevisionRef"],
9960
+ value.evidence.approvalDecisionRevisionRef
9961
+ ],
9710
9962
  [["evidence", "actorRef"], value.evidence.actorRef],
9711
9963
  ...value.evidence.validation.diagnosticRefs.map(
9712
- (reference, index) => [["evidence", "validation", "diagnosticRefs", index], reference]
9964
+ (reference, index) => [
9965
+ ["evidence", "validation", "diagnosticRefs", index],
9966
+ reference
9967
+ ]
9713
9968
  ),
9714
9969
  ...value.evidence.evidenceRefs.map(
9715
9970
  (reference, index) => [["evidence", "evidenceRefs", index], reference]
@@ -9720,15 +9975,31 @@ var validateReleaseGovernanceScope = (value, expectedKind, context) => {
9720
9975
  ["legacyRestoration", "legacyAdapterRevisionRef"],
9721
9976
  value.legacyRestoration.legacyAdapterRevisionRef
9722
9977
  ],
9723
- [["legacyRestoration", "sourceRevisionRef"], value.legacyRestoration.sourceRevisionRef]
9978
+ [
9979
+ ["legacyRestoration", "sourceRevisionRef"],
9980
+ value.legacyRestoration.sourceRevisionRef
9981
+ ]
9724
9982
  ] : []
9725
9983
  ];
9726
9984
  governedEvidenceRefs.forEach(
9727
- ([path, reference]) => validateTenantCompatibleReference(reference, value.tenantScope, [...path], context)
9985
+ ([path, reference]) => validateTenantCompatibleReference(
9986
+ reference,
9987
+ value.tenantScope,
9988
+ [...path],
9989
+ context
9990
+ )
9728
9991
  );
9729
9992
  };
9730
9993
  var BindingSourceSchema = z14.discriminatedUnion("kind", [
9731
- 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(),
9994
+ z14.object({
9995
+ kind: z14.literal("scope-field"),
9996
+ path: z14.string().trim().min(1).max(4096).regex(/^[A-Za-z0-9_.-]+$/).refine(
9997
+ (path) => path.split(".").length <= 16 && path.split(".").every(
9998
+ (part) => part.length > 0 && !["__proto__", "prototype", "constructor"].includes(part)
9999
+ ),
10000
+ "Scope paths require safe own members."
10001
+ )
10002
+ }).strict(),
9732
10003
  z14.object({
9733
10004
  kind: z14.literal("binding-field"),
9734
10005
  bindingId: ContractIdentifierSchema,
@@ -9760,22 +10031,48 @@ var BindingSourceSchema = z14.discriminatedUnion("kind", [
9760
10031
  }).strict()
9761
10032
  ]);
9762
10033
  var ExpressionBindingSourceSchema = z14.object({ kind: z14.literal("expression"), expression: PageExpressionSchema }).strict().superRefine((value, context) => {
9763
- 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." });
10034
+ if (collectPageExpressionReads(value.expression).some(
10035
+ (read) => read.root === "actions"
10036
+ ))
10037
+ context.addIssue({
10038
+ code: "custom",
10039
+ path: ["expression"],
10040
+ message: "Action runtime state is presentation-only and cannot influence an input or state transition."
10041
+ });
9764
10042
  });
9765
- var FileFieldBindingSourceSchema = z14.object({ kind: z14.literal("file-field"), fileInputId: ContractIdentifierSchema, path: z14.enum(["fileName", "content", "canonicalUri"]) }).strict();
10043
+ var FileFieldBindingSourceSchema = z14.object({
10044
+ kind: z14.literal("file-field"),
10045
+ fileInputId: ContractIdentifierSchema,
10046
+ path: z14.enum(["fileName", "content", "canonicalUri"])
10047
+ }).strict();
9766
10048
  var ActionFileInputSchema = z14.object({
9767
10049
  inputId: ContractIdentifierSchema,
9768
10050
  source: z14.discriminatedUnion("kind", [
9769
- z14.object({ kind: z14.literal("page-state"), stateId: ContractIdentifierSchema }).strict(),
9770
- z14.object({ kind: z14.literal("intent-field"), path: z14.string().trim().regex(/^[A-Za-z0-9_.-]+$/) }).strict()
10051
+ z14.object({
10052
+ kind: z14.literal("page-state"),
10053
+ stateId: ContractIdentifierSchema
10054
+ }).strict(),
10055
+ z14.object({
10056
+ kind: z14.literal("intent-field"),
10057
+ path: z14.string().trim().regex(/^[A-Za-z0-9_.-]+$/)
10058
+ }).strict()
9771
10059
  ]),
9772
10060
  maxBytes: z14.number().int().min(1).max(5368709120),
9773
10061
  upload: z14.object({ purpose: FilePurposeSchema }).strict().optional(),
9774
10062
  accept: z14.string().min(1).max(256).optional()
9775
10063
  }).strict().superRefine((value, context) => {
9776
- if (!value.upload && value.maxBytes > 1048576) context.addIssue({ code: "custom", path: ["maxBytes"], message: "Inline text files are limited to one MiB." });
10064
+ if (!value.upload && value.maxBytes > 1048576)
10065
+ context.addIssue({
10066
+ code: "custom",
10067
+ path: ["maxBytes"],
10068
+ message: "Inline text files are limited to one MiB."
10069
+ });
9777
10070
  });
9778
- var ActionInputBindingSourceSchema = z14.discriminatedUnion("kind", [...BindingSourceSchema.options, ExpressionBindingSourceSchema, FileFieldBindingSourceSchema]);
10071
+ var ActionInputBindingSourceSchema = z14.discriminatedUnion("kind", [
10072
+ ...BindingSourceSchema.options,
10073
+ ExpressionBindingSourceSchema,
10074
+ FileFieldBindingSourceSchema
10075
+ ]);
9779
10076
  var InteractionBindingSourceSchema = z14.discriminatedUnion("kind", [
9780
10077
  ExpressionBindingSourceSchema,
9781
10078
  z14.object({
@@ -9795,7 +10092,12 @@ var InteractionBindingSourceSchema = z14.discriminatedUnion("kind", [
9795
10092
  stateId: ContractIdentifierSchema
9796
10093
  }).strict()
9797
10094
  ]);
9798
- var PageStateComparableLiteralSchema = z14.union([z14.string(), z14.number().finite(), z14.boolean(), z14.null()]);
10095
+ var PageStateComparableLiteralSchema = z14.union([
10096
+ z14.string(),
10097
+ z14.number().finite(),
10098
+ z14.boolean(),
10099
+ z14.null()
10100
+ ]);
9799
10101
  var PageStateConditionSchema = z14.discriminatedUnion("predicate", [
9800
10102
  z14.object({
9801
10103
  stateId: ContractIdentifierSchema,
@@ -9829,7 +10131,10 @@ var forEachPageStateCondition = (activation, visit, path = []) => {
9829
10131
  });
9830
10132
  };
9831
10133
  var PageRouteValueSourceSchema = z14.discriminatedUnion("kind", [
9832
- z14.object({ kind: z14.literal("route-parameter"), name: ContractIdentifierSchema }).strict(),
10134
+ z14.object({
10135
+ kind: z14.literal("route-parameter"),
10136
+ name: ContractIdentifierSchema
10137
+ }).strict(),
9833
10138
  z14.object({
9834
10139
  kind: z14.literal("constant"),
9835
10140
  value: z14.union([z14.string(), z14.number().finite(), z14.boolean()])
@@ -9841,11 +10146,17 @@ var PageRouteValueSourceSchema = z14.discriminatedUnion("kind", [
9841
10146
  ]);
9842
10147
  var PageEntryTransitionSchema = z14.object({
9843
10148
  browsingContext: z14.enum(["same", "new"]).optional(),
9844
- gestureSource: z14.object({ capabilityInstanceId: ContractIdentifierSchema, port: ContractIdentifierSchema }).strict().optional(),
10149
+ gestureSource: z14.object({
10150
+ capabilityInstanceId: ContractIdentifierSchema,
10151
+ port: ContractIdentifierSchema
10152
+ }).strict().optional(),
9845
10153
  transitionId: ContractIdentifierSchema,
9846
10154
  activation: PageStateActivationSchema,
9847
10155
  targetRef: StableRefSchema,
9848
- pathParameters: z14.record(ContractIdentifierSchema, PageRouteValueSourceSchema),
10156
+ pathParameters: z14.record(
10157
+ ContractIdentifierSchema,
10158
+ PageRouteValueSourceSchema
10159
+ ),
9849
10160
  query: z14.object({
9850
10161
  preserve: z14.boolean(),
9851
10162
  remove: z14.array(ContractIdentifierSchema),
@@ -9882,7 +10193,12 @@ var ResolvedPageEntryTransitionSchema = PageEntryTransitionSchema.safeExtend({
9882
10193
  }).strict();
9883
10194
  var LegacyBrowserPreferenceImportSchema = z14.object({
9884
10195
  storageKey: z14.string().trim().min(1).max(256),
9885
- jsonPath: z14.array(z14.union([z14.string().trim().min(1).max(128), z14.object({ stateId: ContractIdentifierSchema }).strict()])).min(1).max(16).optional(),
10196
+ jsonPath: z14.array(
10197
+ z14.union([
10198
+ z14.string().trim().min(1).max(128),
10199
+ z14.object({ stateId: ContractIdentifierSchema }).strict()
10200
+ ])
10201
+ ).min(1).max(16).optional(),
9886
10202
  valueType: z14.enum(["string", "number", "boolean-01", "json"])
9887
10203
  }).strict();
9888
10204
  var PageStateDefinitionSchema = z14.object({
@@ -9891,13 +10207,29 @@ var PageStateDefinitionSchema = z14.object({
9891
10207
  initialValue: PageExpressionSchema.optional(),
9892
10208
  schemaRevisionRef: RevisionRefSchema,
9893
10209
  defaultValue: JsonValueSchema.optional(),
9894
- persistence: z14.enum(["none", "session", "url", "tenant-preference", "url-with-tenant-preference"]),
10210
+ persistence: z14.enum([
10211
+ "none",
10212
+ "session",
10213
+ "url",
10214
+ "tenant-preference",
10215
+ "url-with-tenant-preference"
10216
+ ]),
9895
10217
  urlWriteback: z14.enum(["synchronize", "never"]).optional(),
9896
10218
  preferencePartitionStateId: ContractIdentifierSchema.optional(),
9897
10219
  legacyBrowserPreferenceImport: LegacyBrowserPreferenceImportSchema.optional()
9898
10220
  }).strict().superRefine((value, context) => {
9899
- if (value.scopeNodeId && value.persistence !== "none") context.addIssue({ code: "custom", path: ["persistence"], message: "Repeated instance state must not persist outside its instance." });
9900
- 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." });
10221
+ if (value.scopeNodeId && value.persistence !== "none")
10222
+ context.addIssue({
10223
+ code: "custom",
10224
+ path: ["persistence"],
10225
+ message: "Repeated instance state must not persist outside its instance."
10226
+ });
10227
+ if (value.initialValue && !value.scopeNodeId && (value.persistence !== "none" || value.initialValue.kind !== "read" || value.initialValue.root !== "state" || value.initialValue.path.length !== 1))
10228
+ context.addIssue({
10229
+ code: "custom",
10230
+ path: ["initialValue"],
10231
+ message: "Root initialization must directly read one persisted Page state into non-persistent state."
10232
+ });
9901
10233
  if (value.schemaRevisionRef.kind !== "schema") {
9902
10234
  context.addIssue({
9903
10235
  code: "custom",
@@ -9930,7 +10262,10 @@ var InteractionBindingSchema = z14.object({
9930
10262
  sourceResultSchemaRevisionRef: RevisionRefSchema.optional(),
9931
10263
  targetStateId: ContractIdentifierSchema,
9932
10264
  transition: z14.enum(["set", "merge", "toggle", "append", "remove", "reset"]),
9933
- inputMapping: z14.record(ContractIdentifierSchema, InteractionBindingSourceSchema)
10265
+ inputMapping: z14.record(
10266
+ ContractIdentifierSchema,
10267
+ InteractionBindingSourceSchema
10268
+ )
9934
10269
  }).strict().superRefine((value, context) => {
9935
10270
  if (value.sourceIntentSchemaRevisionRef.kind !== "schema") {
9936
10271
  context.addIssue({
@@ -9939,7 +10274,11 @@ var InteractionBindingSchema = z14.object({
9939
10274
  message: "Interaction source intents must pin a schema revision."
9940
10275
  });
9941
10276
  }
9942
- const mapsResult = Object.values(value.inputMapping).some((source) => source.kind === "result-field" || source.kind === "expression" && collectPageExpressionReads(source.expression).some((read) => read.root === "result"));
10277
+ const mapsResult = Object.values(value.inputMapping).some(
10278
+ (source) => source.kind === "result-field" || source.kind === "expression" && collectPageExpressionReads(source.expression).some(
10279
+ (read) => read.root === "result"
10280
+ )
10281
+ );
9943
10282
  if (mapsResult && !value.sourceResultSchemaRevisionRef) {
9944
10283
  context.addIssue({
9945
10284
  code: "custom",
@@ -9977,7 +10316,11 @@ var InteractionBindingSchema = z14.object({
9977
10316
  });
9978
10317
  }
9979
10318
  });
9980
- var GovernedCatalogResourceKindSchema = z14.enum(["tag", "tag-group", "feature-column"]);
10319
+ var GovernedCatalogResourceKindSchema = z14.enum([
10320
+ "tag",
10321
+ "tag-group",
10322
+ "feature-column"
10323
+ ]);
9981
10324
  var GovernedCatalogDomainQueryDataSourceSchema = z14.object({
9982
10325
  kind: z14.literal("governed-catalog"),
9983
10326
  resourceKind: GovernedCatalogResourceKindSchema
@@ -10059,9 +10402,21 @@ var DomainQueryDefinitionSchema = z14.object({
10059
10402
  });
10060
10403
  }
10061
10404
  const refs = [
10062
- ...sourceKind === "exact-view" && value.ontologyDefinitionRevisionRef ? [["ontologyDefinitionRevisionRef", value.ontologyDefinitionRevisionRef, "ontology-definition"]] : [],
10405
+ ...sourceKind === "exact-view" && value.ontologyDefinitionRevisionRef ? [
10406
+ [
10407
+ "ontologyDefinitionRevisionRef",
10408
+ value.ontologyDefinitionRevisionRef,
10409
+ "ontology-definition"
10410
+ ]
10411
+ ] : [],
10063
10412
  ...sourceKind === "exact-view" && value.viewRevisionRef ? [["viewRevisionRef", value.viewRevisionRef, "view"]] : [],
10064
- ...sourceKind === "exact-view" && value.canonicalDataViewRevisionRef ? [["canonicalDataViewRevisionRef", value.canonicalDataViewRevisionRef, "view"]] : [],
10413
+ ...sourceKind === "exact-view" && value.canonicalDataViewRevisionRef ? [
10414
+ [
10415
+ "canonicalDataViewRevisionRef",
10416
+ value.canonicalDataViewRevisionRef,
10417
+ "view"
10418
+ ]
10419
+ ] : [],
10065
10420
  ["inputSchemaRevisionRef", value.inputSchemaRevisionRef, "schema"],
10066
10421
  ["resultSchemaRevisionRef", value.resultSchemaRevisionRef, "schema"]
10067
10422
  ];
@@ -10073,10 +10428,23 @@ var DomainQueryDefinitionSchema = z14.object({
10073
10428
  message: `${field} must reference ${expectedKind}.`
10074
10429
  });
10075
10430
  }
10076
- validateTenantCompatibleReference(reference, value.tenantScope, [field], context);
10431
+ validateTenantCompatibleReference(
10432
+ reference,
10433
+ value.tenantScope,
10434
+ [field],
10435
+ context
10436
+ );
10077
10437
  });
10078
- [...value.accessPolicy.groupAllOf, ...value.accessPolicy.groupAnyOf].forEach(
10079
- (reference, index) => validateTenantCompatibleReference(reference, value.tenantScope, ["accessPolicy", "groups", index], context)
10438
+ [
10439
+ ...value.accessPolicy.groupAllOf,
10440
+ ...value.accessPolicy.groupAnyOf
10441
+ ].forEach(
10442
+ (reference, index) => validateTenantCompatibleReference(
10443
+ reference,
10444
+ value.tenantScope,
10445
+ ["accessPolicy", "groups", index],
10446
+ context
10447
+ )
10080
10448
  );
10081
10449
  value.accessPolicy.conditionAllOf.forEach(
10082
10450
  (reference, index) => validateTenantCompatibleReference(
@@ -10086,7 +10454,10 @@ var DomainQueryDefinitionSchema = z14.object({
10086
10454
  context
10087
10455
  )
10088
10456
  );
10089
- if (value.viewRevisionRef && value.canonicalDataViewRevisionRef && exactRevisionRef(value.viewRevisionRef, value.canonicalDataViewRevisionRef)) {
10457
+ if (value.viewRevisionRef && value.canonicalDataViewRevisionRef && exactRevisionRef(
10458
+ value.viewRevisionRef,
10459
+ value.canonicalDataViewRevisionRef
10460
+ )) {
10090
10461
  context.addIssue({
10091
10462
  code: "custom",
10092
10463
  path: ["canonicalDataViewRevisionRef"],
@@ -10129,9 +10500,21 @@ var QueryBindingSchema = z14.object({
10129
10500
  port: ContractIdentifierSchema
10130
10501
  }).strict(),
10131
10502
  renderModelSchemaRevisionRef: RevisionRefSchema,
10132
- targetProjection: z14.object({ expression: PageExpressionSchema, schemaRevisionRef: RevisionRefSchema }).strict().optional(),
10133
- streamTargetProjection: z14.object({ expression: PageExpressionSchema, schemaRevisionRef: RevisionRefSchema }).strict().optional(),
10134
- stateEffects: z14.array(z14.object({ targetStateId: ContractIdentifierSchema, value: PageExpressionSchema, when: PageExpressionSchema.optional() }).strict()).max(32).optional(),
10503
+ targetProjection: z14.object({
10504
+ expression: PageExpressionSchema,
10505
+ schemaRevisionRef: RevisionRefSchema
10506
+ }).strict().optional(),
10507
+ streamTargetProjection: z14.object({
10508
+ expression: PageExpressionSchema,
10509
+ schemaRevisionRef: RevisionRefSchema
10510
+ }).strict().optional(),
10511
+ stateEffects: z14.array(
10512
+ z14.object({
10513
+ targetStateId: ContractIdentifierSchema,
10514
+ value: PageExpressionSchema,
10515
+ when: PageExpressionSchema.optional()
10516
+ }).strict()
10517
+ ).max(32).optional(),
10135
10518
  queryWhen: PageStateActivationSchema.optional(),
10136
10519
  accessFailure: z14.literal("render-forbidden").optional(),
10137
10520
  resultStateBindings: z14.array(QueryResultStateBindingSchema).max(32).optional(),
@@ -10140,27 +10523,88 @@ var QueryBindingSchema = z14.object({
10140
10523
  cursorWindow: CursorWindowBindingSchema.optional(),
10141
10524
  cache: z14.enum(["none", "identity-scoped", "tenant-scoped"]),
10142
10525
  cancelOnChange: z14.boolean(),
10143
- refreshPolicy: z14.object({ intervalMs: z14.number().int().min(1e3).max(3e5), when: PageExpressionSchema.optional() }).strict().optional()
10526
+ refreshPolicy: z14.object({
10527
+ intervalMs: z14.number().int().min(1e3).max(3e5),
10528
+ when: PageExpressionSchema.optional()
10529
+ }).strict().optional()
10144
10530
  }).strict().superRefine((value, context) => {
10145
10531
  if (value.targetProjection) {
10146
- if (value.targetProjection.schemaRevisionRef.kind !== "schema") context.addIssue({ code: "custom", path: ["targetProjection", "schemaRevisionRef"], message: "Query target projections require an exact target schema revision." });
10147
- 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." });
10532
+ if (value.targetProjection.schemaRevisionRef.kind !== "schema")
10533
+ context.addIssue({
10534
+ code: "custom",
10535
+ path: ["targetProjection", "schemaRevisionRef"],
10536
+ message: "Query target projections require an exact target schema revision."
10537
+ });
10538
+ for (const read of collectExternalPageExpressionReads(
10539
+ value.targetProjection.expression
10540
+ ))
10541
+ if (read.root !== "model")
10542
+ context.addIssue({
10543
+ code: "custom",
10544
+ path: ["targetProjection", "expression"],
10545
+ message: "Query target projections may read only the validated raw model."
10546
+ });
10148
10547
  }
10149
10548
  if (value.streamTargetProjection) {
10150
10549
  const projection = value.streamTargetProjection;
10151
- if (projection.schemaRevisionRef.kind !== "schema") context.addIssue({ code: "custom", path: ["streamTargetProjection", "schemaRevisionRef"], message: "Stream target projections require an exact target schema revision." });
10152
- 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." });
10153
- if (value.execution !== "server" || value.pagination !== "none") context.addIssue({ code: "custom", path: ["streamTargetProjection"], message: "Stream target projections require a non-paginated Server query." });
10550
+ if (projection.schemaRevisionRef.kind !== "schema")
10551
+ context.addIssue({
10552
+ code: "custom",
10553
+ path: ["streamTargetProjection", "schemaRevisionRef"],
10554
+ message: "Stream target projections require an exact target schema revision."
10555
+ });
10556
+ for (const read of collectExternalPageExpressionReads(
10557
+ projection.expression
10558
+ ))
10559
+ if (read.root !== "model")
10560
+ context.addIssue({
10561
+ code: "custom",
10562
+ path: ["streamTargetProjection", "expression"],
10563
+ message: "Stream target projections may read only the verified query and stream envelope."
10564
+ });
10565
+ if (value.execution !== "server" || value.pagination !== "none")
10566
+ context.addIssue({
10567
+ code: "custom",
10568
+ path: ["streamTargetProjection"],
10569
+ message: "Stream target projections require a non-paginated Server query."
10570
+ });
10154
10571
  }
10155
10572
  const effects = value.stateEffects ?? [];
10156
- 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." });
10157
- for (const [index, effect] of effects.entries()) for (const expression of [effect.value, ...effect.when ? [effect.when] : []]) {
10158
- 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." });
10159
- }
10160
- 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." });
10573
+ if (new Set(effects.map((effect) => effect.targetStateId)).size !== effects.length)
10574
+ context.addIssue({
10575
+ code: "custom",
10576
+ path: ["stateEffects"],
10577
+ message: "A query completion may update each state only once."
10578
+ });
10579
+ for (const [index, effect] of effects.entries())
10580
+ for (const expression of [
10581
+ effect.value,
10582
+ ...effect.when ? [effect.when] : []
10583
+ ]) {
10584
+ for (const read of collectPageExpressionReads(expression))
10585
+ if (!["model", "state", "scope"].includes(read.root))
10586
+ context.addIssue({
10587
+ code: "custom",
10588
+ path: ["stateEffects", index],
10589
+ message: "Query state effects may read only model, state, and scope."
10590
+ });
10591
+ }
10592
+ if (effects.length && (value.execution !== "server" || value.pagination !== "none"))
10593
+ context.addIssue({
10594
+ code: "custom",
10595
+ path: ["stateEffects"],
10596
+ message: "Query state effects require a non-paginated Server query."
10597
+ });
10161
10598
  if (value.refreshPolicy?.when) {
10162
- for (const read of collectExternalPageExpressionReads(value.refreshPolicy.when)) {
10163
- 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." });
10599
+ for (const read of collectExternalPageExpressionReads(
10600
+ value.refreshPolicy.when
10601
+ )) {
10602
+ if (read.root !== "model" && !(read.root === "actions" && read.path.length === 2 && read.path[1] === "pending"))
10603
+ context.addIssue({
10604
+ code: "custom",
10605
+ path: ["refreshPolicy", "when"],
10606
+ message: "Automatic refresh conditions may read only the verified raw model and declared action pending state."
10607
+ });
10164
10608
  }
10165
10609
  }
10166
10610
  if (value.refreshPolicy && (value.execution !== "server" || value.pagination !== "none")) {
@@ -10236,15 +10680,31 @@ var CapabilityInstanceSchema = z14.object({
10236
10680
  propertySchemaRevisionRef: RevisionRefSchema,
10237
10681
  properties: JsonObjectSchema,
10238
10682
  propertyBindings: z14.array(PagePropertyBindingSchema).max(128).optional(),
10239
- eventPayloadBindings: z14.array(z14.object({ port: ContractIdentifierSchema, expression: PageExpressionSchema }).strict()).max(32).optional(),
10240
- eventEffects: z14.array(z14.object({
10241
- sourcePort: ContractIdentifierSchema,
10242
- sourceIntentSchemaRevisionRef: RevisionRefSchema,
10243
- refreshBindingIds: z14.array(ContractIdentifierSchema).min(1).max(128)
10244
- }).strict()).max(32).optional(),
10683
+ eventPayloadBindings: z14.array(
10684
+ z14.object({
10685
+ port: ContractIdentifierSchema,
10686
+ expression: PageExpressionSchema
10687
+ }).strict()
10688
+ ).max(32).optional(),
10689
+ eventEffects: z14.array(
10690
+ z14.object({
10691
+ sourcePort: ContractIdentifierSchema,
10692
+ sourceIntentSchemaRevisionRef: RevisionRefSchema,
10693
+ refreshBindingIds: z14.array(ContractIdentifierSchema).min(1).max(128)
10694
+ }).strict()
10695
+ ).max(32).optional(),
10245
10696
  accessPolicy: AccessPolicySchema.optional(),
10246
10697
  activationWhen: PageStateActivationSchema.optional(),
10247
- allowedSideEffects: z14.array(z14.enum(["network", "storage", "navigation", "clipboard", "worker", "websocket"]))
10698
+ allowedSideEffects: z14.array(
10699
+ z14.enum([
10700
+ "network",
10701
+ "storage",
10702
+ "navigation",
10703
+ "clipboard",
10704
+ "worker",
10705
+ "websocket"
10706
+ ])
10707
+ )
10248
10708
  }).strict();
10249
10709
  var OntologyBindingSchema = z14.object({
10250
10710
  bindingId: ContractIdentifierSchema,
@@ -10276,7 +10736,10 @@ var OntologyBindingSchema = z14.object({
10276
10736
  message: "Ontology bindings require an exact canonical data.view revision."
10277
10737
  });
10278
10738
  }
10279
- if (exactRevisionRef(value.viewRevisionRef, value.canonicalDataViewRevisionRef)) {
10739
+ if (exactRevisionRef(
10740
+ value.viewRevisionRef,
10741
+ value.canonicalDataViewRevisionRef
10742
+ )) {
10280
10743
  context.addIssue({
10281
10744
  code: "custom",
10282
10745
  path: ["canonicalDataViewRevisionRef"],
@@ -10298,17 +10761,20 @@ var OntologyBindingSchema = z14.object({
10298
10761
  });
10299
10762
  }
10300
10763
  });
10301
- var ActionResultBindingEffectSourceSchema = z14.discriminatedUnion("kind", [
10302
- z14.object({
10303
- kind: z14.literal("result-field"),
10304
- path: z14.string().trim().regex(/^[A-Za-z0-9_.-]+$/)
10305
- }).strict(),
10306
- z14.object({ kind: z14.literal("constant"), value: JsonValueSchema }).strict(),
10307
- z14.object({
10308
- kind: z14.literal("collection-length"),
10309
- offset: z14.number().int().min(-1e3).max(1e3)
10310
- }).strict()
10311
- ]);
10764
+ var ActionResultBindingEffectSourceSchema = z14.discriminatedUnion(
10765
+ "kind",
10766
+ [
10767
+ z14.object({
10768
+ kind: z14.literal("result-field"),
10769
+ path: z14.string().trim().regex(/^[A-Za-z0-9_.-]+$/)
10770
+ }).strict(),
10771
+ z14.object({ kind: z14.literal("constant"), value: JsonValueSchema }).strict(),
10772
+ z14.object({
10773
+ kind: z14.literal("collection-length"),
10774
+ offset: z14.number().int().min(-1e3).max(1e3)
10775
+ }).strict()
10776
+ ]
10777
+ );
10312
10778
  var ActionResultBindingEffectSchema = z14.object({
10313
10779
  bindingId: ContractIdentifierSchema,
10314
10780
  operation: z14.enum(["upsert-append", "remove-exact"]),
@@ -10321,7 +10787,9 @@ var ActionResultBindingEffectSchema = z14.object({
10321
10787
  }).strict()
10322
10788
  ).min(1).max(64)
10323
10789
  }).strict().superRefine((value, context) => {
10324
- const targetPaths = value.mappings.map(({ targetPath }) => targetPath.join("."));
10790
+ const targetPaths = value.mappings.map(
10791
+ ({ targetPath }) => targetPath.join(".")
10792
+ );
10325
10793
  if (new Set(targetPaths).size !== targetPaths.length) {
10326
10794
  context.addIssue({
10327
10795
  code: "custom",
@@ -10383,17 +10851,30 @@ var ActionBindingSchema = z14.object({
10383
10851
  inputSchemaRevisionRef: RevisionRefSchema,
10384
10852
  when: PageExpressionSchema.optional(),
10385
10853
  fileInputs: z14.array(ActionFileInputSchema).min(1).max(4).optional(),
10386
- inputMapping: z14.record(ContractIdentifierSchema, ActionInputBindingSourceSchema),
10854
+ inputMapping: z14.record(
10855
+ ContractIdentifierSchema,
10856
+ ActionInputBindingSourceSchema
10857
+ ),
10387
10858
  sensitiveInputPaths: SensitiveResultPathsSchema.optional(),
10388
10859
  accessPolicy: AccessPolicySchema,
10389
10860
  confirmation: I18nTextSchema.optional(),
10390
- idempotencyKeySource: z14.enum(["interaction", "record-and-interaction", "caller-provided"]),
10861
+ idempotencyKeySource: z14.enum([
10862
+ "interaction",
10863
+ "record-and-interaction",
10864
+ "caller-provided"
10865
+ ]),
10391
10866
  compensationCommandRevisionRef: RevisionRefSchema.optional(),
10392
10867
  resultSchemaRevisionRef: RevisionRefSchema,
10393
10868
  success: z14.object({
10394
10869
  download: z14.discriminatedUnion("kind", [
10395
10870
  z14.object({ kind: z14.literal("native") }).strict(),
10396
- 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()
10871
+ z14.object({
10872
+ kind: z14.literal("text-artifact"),
10873
+ fileNamePath: PageValuePathSchema.min(1),
10874
+ mimeTypePath: PageValuePathSchema.min(1),
10875
+ contentPath: PageValuePathSchema.min(1),
10876
+ maxBytes: z14.number().int().min(1).max(1048576)
10877
+ }).strict()
10397
10878
  ]).optional(),
10398
10879
  refreshBindingIds: z14.array(ContractIdentifierSchema),
10399
10880
  ephemeralResult: z14.object({
@@ -10415,19 +10896,55 @@ var ActionBindingSchema = z14.object({
10415
10896
  }).strict().superRefine((value, context) => {
10416
10897
  const fileIds = /* @__PURE__ */ new Set();
10417
10898
  for (const file of value.fileInputs ?? []) {
10418
- if (fileIds.has(file.inputId)) context.addIssue({ code: "custom", path: ["fileInputs"], message: "File input ids must be unique." });
10899
+ if (fileIds.has(file.inputId))
10900
+ context.addIssue({
10901
+ code: "custom",
10902
+ path: ["fileInputs"],
10903
+ message: "File input ids must be unique."
10904
+ });
10419
10905
  fileIds.add(file.inputId);
10420
- 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." });
10421
- }
10422
- for (const [name, source] of Object.entries(value.inputMapping)) if (source.kind === "file-field") {
10423
- const file = value.fileInputs?.find((file2) => file2.inputId === source.fileInputId);
10424
- 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." });
10425
- if (!fileIds.has(source.fileInputId)) context.addIssue({ code: "custom", path: ["inputMapping", name], message: "File fields must reference a declared file input." });
10426
- 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." });
10427
- }
10428
- if (value.when) for (const read of collectPageExpressionReads(value.when)) {
10429
- 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." });
10906
+ if (!Object.values(value.inputMapping).some(
10907
+ (source) => source.kind === "file-field" && source.fileInputId === file.inputId
10908
+ ))
10909
+ context.addIssue({
10910
+ code: "custom",
10911
+ path: ["fileInputs"],
10912
+ message: "File inputs require an explicit governed input mapping."
10913
+ });
10430
10914
  }
10915
+ for (const [name, source] of Object.entries(value.inputMapping))
10916
+ if (source.kind === "file-field") {
10917
+ const file = value.fileInputs?.find(
10918
+ (file2) => file2.inputId === source.fileInputId
10919
+ );
10920
+ if (source.path === "canonicalUri" && !file?.upload || source.path === "content" && file?.upload)
10921
+ context.addIssue({
10922
+ code: "custom",
10923
+ path: ["inputMapping", name],
10924
+ message: "File field must match its declared transport mode."
10925
+ });
10926
+ if (!fileIds.has(source.fileInputId))
10927
+ context.addIssue({
10928
+ code: "custom",
10929
+ path: ["inputMapping", name],
10930
+ message: "File fields must reference a declared file input."
10931
+ });
10932
+ if (source.path === "content" && !value.sensitiveInputPaths?.includes(`/${name}`))
10933
+ context.addIssue({
10934
+ code: "custom",
10935
+ path: ["sensitiveInputPaths"],
10936
+ message: "File content must be declared as a sensitive command input."
10937
+ });
10938
+ }
10939
+ if (value.when)
10940
+ for (const read of collectPageExpressionReads(value.when)) {
10941
+ if (!["intent", "state", "scope"].includes(read.root))
10942
+ context.addIssue({
10943
+ code: "custom",
10944
+ path: ["when"],
10945
+ message: "Action conditions may read only intent, declared Page state, and instance scope."
10946
+ });
10947
+ }
10431
10948
  if (value.success.ephemeralResult) {
10432
10949
  const { valuePath, labelPath } = value.success.ephemeralResult;
10433
10950
  const segments = (path) => path.split("/").slice(1);
@@ -10557,7 +11074,9 @@ var PageMigrationEquivalenceSchema = z14.object({
10557
11074
  message: "Migration equivalence scenario identities must be unique."
10558
11075
  });
10559
11076
  }
10560
- const viewportIds = new Set(value.viewports.map((viewport) => viewport.viewportId));
11077
+ const viewportIds = new Set(
11078
+ value.viewports.map((viewport) => viewport.viewportId)
11079
+ );
10561
11080
  value.scenarios.forEach((scenario, index) => {
10562
11081
  scenario.viewportIds.forEach((viewportId, viewportIndex) => {
10563
11082
  if (!viewportIds.has(viewportId)) {
@@ -10603,7 +11122,165 @@ var PageRouteStatePresentationSchema = z14.object({
10603
11122
  });
10604
11123
  });
10605
11124
  });
11125
+ var PageStateSchema = PageStateDefinitionSchema.omit({
11126
+ schemaRevisionRef: true
11127
+ }).extend({
11128
+ stateId: ContractIdentifierSchema,
11129
+ schema: ContractIdentifierSchema
11130
+ }).strict();
11131
+ var PageEntryTargetSchema = z14.object({
11132
+ kind: z14.enum(["page", "workbench"]),
11133
+ id: ContractIdentifierSchema
11134
+ }).strict();
11135
+ var PageEntrySchema = PageEntryTransitionSchema.omit({
11136
+ targetRef: true
11137
+ }).extend({
11138
+ target: PageEntryTargetSchema
11139
+ }).strict();
11140
+ var PageInteractionSchema = InteractionBindingSchema.omit({
11141
+ source: true,
11142
+ sourceIntentSchemaRevisionRef: true,
11143
+ sourceResultSchemaRevisionRef: true
11144
+ }).extend({
11145
+ port: ContractIdentifierSchema
11146
+ }).strict();
11147
+ var PageCursorWindowSchema = CursorWindowBindingSchema.omit({
11148
+ pageChangeIntentSchemaRevisionRef: true
11149
+ }).strict();
11150
+ var PageResultStateBindingSchema = QueryResultStateBindingSchema.omit({
11151
+ targetStateSchemaRevisionRef: true
11152
+ }).strict();
11153
+ var PageDataSchema = QueryBindingSchema.omit({
11154
+ queryDefinitionRevisionRef: true,
11155
+ target: true,
11156
+ renderModelSchemaRevisionRef: true,
11157
+ targetProjection: true,
11158
+ streamTargetProjection: true,
11159
+ cursorWindow: true,
11160
+ resultStateBindings: true
11161
+ }).extend({
11162
+ query: ContractIdentifierSchema,
11163
+ port: ContractIdentifierSchema,
11164
+ targetProjection: z14.object({ expression: PageExpressionSchema }).strict().optional(),
11165
+ streamTargetProjection: z14.object({ expression: PageExpressionSchema }).strict().optional(),
11166
+ cursorWindow: PageCursorWindowSchema.optional(),
11167
+ resultStateBindings: z14.array(PageResultStateBindingSchema).max(32).optional()
11168
+ }).strict();
11169
+ var PageActionSchema = ActionBindingSchema.omit({
11170
+ commandRevisionRef: true,
11171
+ source: true,
11172
+ sourceIntentSchemaRevisionRef: true,
11173
+ inputSchemaRevisionRef: true,
11174
+ compensationCommandRevisionRef: true,
11175
+ resultSchemaRevisionRef: true
11176
+ }).extend({
11177
+ command: ContractIdentifierSchema,
11178
+ port: ContractIdentifierSchema,
11179
+ compensationCommand: ContractIdentifierSchema.optional()
11180
+ }).strict();
11181
+ var PageEventEffectSchema = z14.object({
11182
+ port: ContractIdentifierSchema,
11183
+ refresh: z14.array(ContractIdentifierSchema).min(1).max(128)
11184
+ }).strict();
11185
+ var PageNodeSchema = z14.lazy(
11186
+ () => z14.object({
11187
+ id: ContractIdentifierSchema,
11188
+ component: ContractIdentifierSchema,
11189
+ kind: RenderNodeKindSchema.optional(),
11190
+ slot: ContractIdentifierSchema.optional(),
11191
+ props: JsonObjectSchema.optional(),
11192
+ bindings: z14.array(PagePropertyBindingSchema).max(128).optional(),
11193
+ model: JsonObjectSchema.optional(),
11194
+ style: RenderStyleSchema.optional(),
11195
+ layout: RenderLayoutSchema.optional(),
11196
+ responsive: z14.array(RenderResponsiveRuleSchema).optional(),
11197
+ surface: RenderSurfaceSchema.optional(),
11198
+ scroll: RenderScrollSchema.optional(),
11199
+ activation: RenderActivationSchema.optional(),
11200
+ lifecycle: RenderLifecycleSchema.optional(),
11201
+ state: RenderNodeStateSchema.optional(),
11202
+ access: AccessPolicySchema.optional(),
11203
+ activeWhen: PageStateActivationSchema.optional(),
11204
+ repeat: z14.object({
11205
+ source: PageExpressionSchema,
11206
+ keyPath: PageValuePathSchema.min(1),
11207
+ limit: z14.number().int().min(1).max(1e3).optional()
11208
+ }).strict().optional(),
11209
+ data: z14.array(PageDataSchema).optional(),
11210
+ actions: z14.array(PageActionSchema).optional(),
11211
+ on: z14.array(PageInteractionSchema).optional(),
11212
+ effects: z14.array(PageEventEffectSchema).optional(),
11213
+ eventPayloads: z14.array(
11214
+ z14.object({
11215
+ port: ContractIdentifierSchema,
11216
+ expression: PageExpressionSchema
11217
+ }).strict()
11218
+ ).optional(),
11219
+ children: z14.array(PageNodeSchema).optional()
11220
+ }).strict()
11221
+ );
10606
11222
  var PageSchema = z14.object({
11223
+ contract: z14.literal("Page"),
11224
+ schemaVersion: z14.literal(DECLARATIVE_CONTROL_SCHEMA_VERSION),
11225
+ pageId: ContractIdentifierSchema,
11226
+ tenantScope: TenantScopeSchema,
11227
+ identity: IdentitySchema,
11228
+ surface: ProductSurfaceSchema,
11229
+ route: RoutePathTemplateSchema,
11230
+ routeSpace: ContractIdentifierSchema.optional(),
11231
+ lifecycle: DeclarativeLifecycleSchema.default("active"),
11232
+ routeStatePresentations: z14.array(PageRouteStatePresentationSchema).max(8).optional(),
11233
+ shell: ContractIdentifierSchema.optional(),
11234
+ body: PageNodeSchema,
11235
+ state: z14.array(PageStateSchema).optional(),
11236
+ entryTransitions: z14.array(PageEntrySchema).optional(),
11237
+ access: AccessPolicySchema,
11238
+ managementAccess: ManagementAccessSchema,
11239
+ tokens: z14.array(ContractIdentifierSchema).optional(),
11240
+ performanceBudget: ContractIdentifierSchema.optional(),
11241
+ observationPolicy: ContractIdentifierSchema.optional(),
11242
+ privacyClassification: z14.enum(["public", "internal", "confidential", "restricted"]).default("internal")
11243
+ }).strict().superRefine((page, context) => {
11244
+ const ids = /* @__PURE__ */ new Set();
11245
+ const dataIds = /* @__PURE__ */ new Set();
11246
+ const actionIds = /* @__PURE__ */ new Set();
11247
+ const interactionIds = /* @__PURE__ */ new Set();
11248
+ const visit = (node, path) => {
11249
+ if (ids.has(node.id))
11250
+ context.addIssue({
11251
+ code: "custom",
11252
+ path: [...path, "id"],
11253
+ message: `Duplicate Page node id ${node.id}.`
11254
+ });
11255
+ ids.add(node.id);
11256
+ for (const [field, values, target] of [
11257
+ ["data", node.data ?? [], dataIds],
11258
+ ["actions", node.actions ?? [], actionIds],
11259
+ ["on", node.on ?? [], interactionIds]
11260
+ ])
11261
+ for (const [index, value] of values.entries()) {
11262
+ if (target.has(value.bindingId))
11263
+ context.addIssue({
11264
+ code: "custom",
11265
+ path: [...path, field, index, "bindingId"],
11266
+ message: `Duplicate Page binding id ${value.bindingId}.`
11267
+ });
11268
+ target.add(value.bindingId);
11269
+ }
11270
+ (node.children ?? []).forEach(
11271
+ (child, index) => visit(child, [...path, "children", index])
11272
+ );
11273
+ };
11274
+ visit(page.body, ["body"]);
11275
+ const stateIds = (page.state ?? []).map((entry) => entry.stateId);
11276
+ if (new Set(stateIds).size !== stateIds.length)
11277
+ context.addIssue({
11278
+ code: "custom",
11279
+ path: ["state"],
11280
+ message: "Page state ids must be unique."
11281
+ });
11282
+ });
11283
+ var ResolvedPageSchema = z14.object({
10607
11284
  contract: z14.literal("Page"),
10608
11285
  schemaVersion: z14.literal(DECLARATIVE_CONTROL_SCHEMA_VERSION),
10609
11286
  pageId: ContractIdentifierSchema,
@@ -10614,7 +11291,12 @@ var PageSchema = z14.object({
10614
11291
  legacyRoutePolicy: LegacyRoutePolicySchema.optional(),
10615
11292
  migrationEquivalence: PageMigrationEquivalenceSchema.optional(),
10616
11293
  routeStatePresentations: z14.array(PageRouteStatePresentationSchema).max(8).optional(),
10617
- routeClaims: z14.array(z14.union([DeclarativeRouteClaimSchema, LegacyDeclarativeRouteClaimSchema])).min(1),
11294
+ routeClaims: z14.array(
11295
+ z14.union([
11296
+ DeclarativeRouteClaimSchema,
11297
+ LegacyDeclarativeRouteClaimSchema
11298
+ ])
11299
+ ).min(1),
10618
11300
  shellRevisionRef: RevisionRefSchema,
10619
11301
  renderTree: RenderTreeSchema,
10620
11302
  capabilityInstances: z14.array(CapabilityInstanceSchema).min(1),
@@ -10629,11 +11311,23 @@ var PageSchema = z14.object({
10629
11311
  tokenRevisionRefs: z14.array(RevisionRefSchema).min(1),
10630
11312
  performanceBudgetRef: RevisionRefSchema,
10631
11313
  observationPolicyRevisionRef: RevisionRefSchema,
10632
- privacyClassification: z14.enum(["public", "internal", "confidential", "restricted"])
11314
+ privacyClassification: z14.enum([
11315
+ "public",
11316
+ "internal",
11317
+ "confidential",
11318
+ "restricted"
11319
+ ])
10633
11320
  }).strict().superRefine((value, context) => {
10634
- validateDeclaredRouteSurfaces(value.supportedSurfaces, value.routeClaims, context);
11321
+ validateDeclaredRouteSurfaces(
11322
+ value.supportedSurfaces,
11323
+ value.routeClaims,
11324
+ context
11325
+ );
10635
11326
  const routeStatePresentations = value.routeStatePresentations ?? [];
10636
- if (uniqueArray(routeStatePresentations, (candidate) => `${candidate.surface}:${candidate.state}`)) {
11327
+ if (uniqueArray(
11328
+ routeStatePresentations,
11329
+ (candidate) => `${candidate.surface}:${candidate.state}`
11330
+ )) {
10637
11331
  context.addIssue({
10638
11332
  code: "custom",
10639
11333
  path: ["routeStatePresentations"],
@@ -10655,18 +11349,27 @@ var PageSchema = z14.object({
10655
11349
  const queryBindings = value.queryBindings ?? [];
10656
11350
  stateDefinitions.forEach((definition, index) => {
10657
11351
  const partitionStateId = definition.preferencePartitionStateId;
10658
- const dynamicLegacySegments = definition.legacyBrowserPreferenceImport?.jsonPath?.filter((segment) => typeof segment !== "string") ?? [];
11352
+ const dynamicLegacySegments = definition.legacyBrowserPreferenceImport?.jsonPath?.filter(
11353
+ (segment) => typeof segment !== "string"
11354
+ ) ?? [];
10659
11355
  if (!partitionStateId) {
10660
11356
  if (dynamicLegacySegments.length > 0) {
10661
11357
  context.addIssue({
10662
11358
  code: "custom",
10663
- path: ["stateDefinitions", index, "legacyBrowserPreferenceImport", "jsonPath"],
11359
+ path: [
11360
+ "stateDefinitions",
11361
+ index,
11362
+ "legacyBrowserPreferenceImport",
11363
+ "jsonPath"
11364
+ ],
10664
11365
  message: "A dynamic legacy preference path requires a declared preference partition state."
10665
11366
  });
10666
11367
  }
10667
11368
  return;
10668
11369
  }
10669
- const partitionDefinition = stateDefinitions.find((candidate) => candidate.stateId === partitionStateId);
11370
+ const partitionDefinition = stateDefinitions.find(
11371
+ (candidate) => candidate.stateId === partitionStateId
11372
+ );
10670
11373
  if (partitionStateId === definition.stateId || !partitionDefinition || partitionDefinition.preferencePartitionStateId) {
10671
11374
  context.addIssue({
10672
11375
  code: "custom",
@@ -10674,24 +11377,60 @@ var PageSchema = z14.object({
10674
11377
  message: "Preference partitioning must reference a distinct, non-partitioned Page state."
10675
11378
  });
10676
11379
  }
10677
- definition.legacyBrowserPreferenceImport?.jsonPath?.forEach((segment, segmentIndex) => {
10678
- if (typeof segment !== "string" && segment.stateId !== partitionStateId) {
10679
- context.addIssue({
10680
- code: "custom",
10681
- path: ["stateDefinitions", index, "legacyBrowserPreferenceImport", "jsonPath", segmentIndex],
10682
- message: "A dynamic legacy preference path must use the declared preference partition state."
10683
- });
11380
+ definition.legacyBrowserPreferenceImport?.jsonPath?.forEach(
11381
+ (segment, segmentIndex) => {
11382
+ if (typeof segment !== "string" && segment.stateId !== partitionStateId) {
11383
+ context.addIssue({
11384
+ code: "custom",
11385
+ path: [
11386
+ "stateDefinitions",
11387
+ index,
11388
+ "legacyBrowserPreferenceImport",
11389
+ "jsonPath",
11390
+ segmentIndex
11391
+ ],
11392
+ message: "A dynamic legacy preference path must use the declared preference partition state."
11393
+ });
11394
+ }
10684
11395
  }
10685
- });
11396
+ );
10686
11397
  });
10687
11398
  const uniqueness = [
10688
- ["capabilityInstances", value.capabilityInstances, (candidate) => String(candidate.instanceId)],
10689
- ["stateDefinitions", stateDefinitions, (candidate) => String(candidate.stateId)],
10690
- ["entryTransitions", entryTransitions, (candidate) => String(candidate.transitionId)],
10691
- ["interactionBindings", interactionBindings, (candidate) => String(candidate.bindingId)],
10692
- ["ontologyBindings", value.ontologyBindings, (candidate) => String(candidate.bindingId)],
10693
- ["queryBindings", queryBindings, (candidate) => String(candidate.bindingId)],
10694
- ["actionBindings", value.actionBindings, (candidate) => String(candidate.bindingId)]
11399
+ [
11400
+ "capabilityInstances",
11401
+ value.capabilityInstances,
11402
+ (candidate) => String(candidate.instanceId)
11403
+ ],
11404
+ [
11405
+ "stateDefinitions",
11406
+ stateDefinitions,
11407
+ (candidate) => String(candidate.stateId)
11408
+ ],
11409
+ [
11410
+ "entryTransitions",
11411
+ entryTransitions,
11412
+ (candidate) => String(candidate.transitionId)
11413
+ ],
11414
+ [
11415
+ "interactionBindings",
11416
+ interactionBindings,
11417
+ (candidate) => String(candidate.bindingId)
11418
+ ],
11419
+ [
11420
+ "ontologyBindings",
11421
+ value.ontologyBindings,
11422
+ (candidate) => String(candidate.bindingId)
11423
+ ],
11424
+ [
11425
+ "queryBindings",
11426
+ queryBindings,
11427
+ (candidate) => String(candidate.bindingId)
11428
+ ],
11429
+ [
11430
+ "actionBindings",
11431
+ value.actionBindings,
11432
+ (candidate) => String(candidate.bindingId)
11433
+ ]
10695
11434
  ];
10696
11435
  uniqueness.forEach(([field, values, identity]) => {
10697
11436
  if (uniqueArray(values, identity))
@@ -10701,49 +11440,132 @@ var PageSchema = z14.object({
10701
11440
  message: `${field} identities must be unique.`
10702
11441
  });
10703
11442
  });
10704
- const instanceIds = new Set(value.capabilityInstances.map((instance) => instance.instanceId));
11443
+ const instanceIds = new Set(
11444
+ value.capabilityInstances.map((instance) => instance.instanceId)
11445
+ );
10705
11446
  const stateIds = new Set(stateDefinitions.map((state) => state.stateId));
10706
11447
  value.capabilityInstances.forEach((instance, index) => {
10707
11448
  const ports = /* @__PURE__ */ new Set();
10708
11449
  const payloadPorts = /* @__PURE__ */ new Set();
10709
11450
  instance.eventPayloadBindings?.forEach((binding, bindingIndex) => {
10710
- const path = ["capabilityInstances", index, "eventPayloadBindings", bindingIndex];
10711
- if (payloadPorts.has(binding.port)) context.addIssue({ code: "custom", path, message: "An event payload can have only one declarative projection." });
11451
+ const path = [
11452
+ "capabilityInstances",
11453
+ index,
11454
+ "eventPayloadBindings",
11455
+ bindingIndex
11456
+ ];
11457
+ if (payloadPorts.has(binding.port))
11458
+ context.addIssue({
11459
+ code: "custom",
11460
+ path,
11461
+ message: "An event payload can have only one declarative projection."
11462
+ });
10712
11463
  payloadPorts.add(binding.port);
10713
11464
  for (const read of collectPageExpressionReads(binding.expression)) {
10714
- 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." });
11465
+ if (read.root === "actions" || read.root === "result" || read.root === "state" && !stateIds.has(read.path[0] ?? "") || read.root === "bindings" && ![...value.ontologyBindings, ...queryBindings].some(
11466
+ (candidate) => candidate.bindingId === read.path[0]
11467
+ ))
11468
+ context.addIssue({
11469
+ code: "custom",
11470
+ path,
11471
+ message: "Event payload projections require local event, model, scope, declared query results, or declared state."
11472
+ });
10715
11473
  }
10716
11474
  });
10717
11475
  instance.eventEffects?.forEach((effect, effectIndex) => {
10718
- const path = ["capabilityInstances", index, "eventEffects", effectIndex];
10719
- 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." });
11476
+ const path = [
11477
+ "capabilityInstances",
11478
+ index,
11479
+ "eventEffects",
11480
+ effectIndex
11481
+ ];
11482
+ if (effect.sourceIntentSchemaRevisionRef.kind !== "schema" || ports.has(effect.sourcePort))
11483
+ context.addIssue({
11484
+ code: "custom",
11485
+ path,
11486
+ message: "Event effects require one exact source schema per output port."
11487
+ });
10720
11488
  ports.add(effect.sourcePort);
10721
- 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." });
10722
- 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." });
11489
+ if (value.actionBindings.some(
11490
+ (binding) => binding.source.capabilityInstanceId === instance.instanceId && binding.source.port === effect.sourcePort
11491
+ ))
11492
+ context.addIssue({
11493
+ code: "custom",
11494
+ path,
11495
+ message: "An Action output port must declare refresh effects through Action.success."
11496
+ });
11497
+ for (const id of effect.refreshBindingIds)
11498
+ if (![...value.ontologyBindings, ...queryBindings].some(
11499
+ (binding) => binding.bindingId === id
11500
+ ))
11501
+ context.addIssue({
11502
+ code: "custom",
11503
+ path,
11504
+ message: "Event effect references an unknown query binding."
11505
+ });
10723
11506
  });
10724
11507
  });
10725
- const repeatNodes = new Set(value.renderTree.nodes.filter((node) => node.repeat).map((node) => node.nodeId));
11508
+ const repeatNodes = new Set(
11509
+ value.renderTree.nodes.filter((node) => node.repeat).map((node) => node.nodeId)
11510
+ );
10726
11511
  stateDefinitions.forEach((definition, index) => {
10727
- if (definition.scopeNodeId && !repeatNodes.has(definition.scopeNodeId)) context.addIssue({ code: "custom", path: ["stateDefinitions", index, "scopeNodeId"], message: "Instance state must reference an existing repeated RenderNode." });
11512
+ if (definition.scopeNodeId && !repeatNodes.has(definition.scopeNodeId))
11513
+ context.addIssue({
11514
+ code: "custom",
11515
+ path: ["stateDefinitions", index, "scopeNodeId"],
11516
+ message: "Instance state must reference an existing repeated RenderNode."
11517
+ });
10728
11518
  if (definition.initialValue && !definition.scopeNodeId) {
10729
11519
  const expression = definition.initialValue;
10730
- const source = expression.kind === "read" ? stateDefinitions.find((state) => state.stateId === expression.path[0] && !state.scopeNodeId) : void 0;
10731
- 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." });
11520
+ const source = expression.kind === "read" ? stateDefinitions.find(
11521
+ (state) => state.stateId === expression.path[0] && !state.scopeNodeId
11522
+ ) : void 0;
11523
+ if (!source || source.initialValue || !["tenant-preference", "url-with-tenant-preference"].includes(
11524
+ source.persistence
11525
+ ))
11526
+ context.addIssue({
11527
+ code: "custom",
11528
+ path: ["stateDefinitions", index, "initialValue"],
11529
+ message: "Root initialization requires an independently hydrated tenant preference; initialization chains are forbidden."
11530
+ });
10732
11531
  }
10733
11532
  if (definition.initialValue) {
10734
- for (const read of collectPageExpressionReads(definition.initialValue)) {
10735
- 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." });
11533
+ for (const read of collectPageExpressionReads(
11534
+ definition.initialValue
11535
+ )) {
11536
+ if (!["scope", "state"].includes(read.root) || read.root === "state" && !stateDefinitions.some(
11537
+ (state) => state.stateId === read.path[0] && !state.scopeNodeId
11538
+ ))
11539
+ context.addIssue({
11540
+ code: "custom",
11541
+ path: ["stateDefinitions", index, "initialValue"],
11542
+ message: "Instance initial values can read only their item scope and declared Page state."
11543
+ });
10736
11544
  }
10737
11545
  }
10738
11546
  });
10739
11547
  value.renderTree.nodes.forEach((node, index) => {
10740
11548
  if (!node.repeat) return;
10741
11549
  for (const read of collectPageExpressionReads(node.repeat.source)) {
10742
- 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." });
11550
+ 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(
11551
+ (binding) => binding.bindingId === read.path[0]
11552
+ ))
11553
+ context.addIssue({
11554
+ code: "custom",
11555
+ path: ["renderTree", "nodes", index, "repeat", "source"],
11556
+ message: "Repeated nodes require declared Page state, query results, or parent item scope."
11557
+ });
10743
11558
  }
10744
11559
  });
10745
- const renderNodesById = new Map(value.renderTree.nodes.map((node) => [node.nodeId, node]));
10746
- const instanceNodes = new Map(value.capabilityInstances.map((instance) => [instance.instanceId, instance.nodeId]));
11560
+ const renderNodesById = new Map(
11561
+ value.renderTree.nodes.map((node) => [node.nodeId, node])
11562
+ );
11563
+ const instanceNodes = new Map(
11564
+ value.capabilityInstances.map((instance) => [
11565
+ instance.instanceId,
11566
+ instance.nodeId
11567
+ ])
11568
+ );
10747
11569
  const scopesForNode = (nodeId) => {
10748
11570
  const scopes = /* @__PURE__ */ new Set();
10749
11571
  const visited = /* @__PURE__ */ new Set();
@@ -10755,60 +11577,170 @@ var PageSchema = z14.object({
10755
11577
  }
10756
11578
  return scopes;
10757
11579
  };
10758
- const queryOwners = new Map([...value.ontologyBindings, ...queryBindings].map((binding) => [
10759
- binding.bindingId,
10760
- [...scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId))][0]
10761
- ]));
10762
- const actionScopes = new Map(value.actionBindings.map((binding) => [binding.bindingId, scopesForNode(instanceNodes.get(binding.source.capabilityInstanceId))]));
10763
- const actionOwners = new Map([...actionScopes].map(([id, scopes]) => [id, [...scopes][0]]));
10764
- if (actionOwners.size !== value.actionBindings.length) context.addIssue({ code: "custom", path: ["actionBindings"], message: "Action binding identifiers must be unique." });
11580
+ const queryOwners = new Map(
11581
+ [...value.ontologyBindings, ...queryBindings].map((binding) => [
11582
+ binding.bindingId,
11583
+ [
11584
+ ...scopesForNode(
11585
+ instanceNodes.get(binding.target.capabilityInstanceId)
11586
+ )
11587
+ ][0]
11588
+ ])
11589
+ );
11590
+ const actionScopes = new Map(
11591
+ value.actionBindings.map((binding) => [
11592
+ binding.bindingId,
11593
+ scopesForNode(instanceNodes.get(binding.source.capabilityInstanceId))
11594
+ ])
11595
+ );
11596
+ const actionOwners = new Map(
11597
+ [...actionScopes].map(([id, scopes]) => [id, [...scopes][0]])
11598
+ );
11599
+ if (actionOwners.size !== value.actionBindings.length)
11600
+ context.addIssue({
11601
+ code: "custom",
11602
+ path: ["actionBindings"],
11603
+ message: "Action binding identifiers must be unique."
11604
+ });
10765
11605
  const checkScopedReads = (reads, scopes, path) => {
10766
11606
  for (const read of reads) {
10767
11607
  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;
10768
- 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));
10769
- 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." });
11608
+ const pendingAggregate = read.root === "actions" && read.path.length === 2 && read.path[1] === "pending" && actionScopes.has(read.path[0]) && [...scopes].every(
11609
+ (scope) => actionScopes.get(read.path[0]).has(scope)
11610
+ );
11611
+ if (owner && !scopes.has(owner) && !pendingAggregate)
11612
+ context.addIssue({
11613
+ code: "custom",
11614
+ path,
11615
+ message: "A binding cannot read state, query results, or individual action status from a sibling or descendant instance."
11616
+ });
10770
11617
  }
10771
11618
  };
10772
11619
  const checkScopedSources = (sources, scopes, path) => {
10773
11620
  Object.entries(sources).forEach(([name, source]) => {
10774
- if (source.kind === "expression") checkScopedReads(collectPageExpressionReads(source.expression), scopes, [...path, name]);
10775
- if (source.kind === "page-state") checkScopedReads([{ kind: "read", root: "state", path: [source.stateId] }], scopes, [...path, name]);
10776
- if (source.kind === "binding-field") checkScopedReads([{ kind: "read", root: "bindings", path: [source.bindingId] }], scopes, [...path, name]);
10777
- if (source.kind === "scope-field" && scopes.size === 0) context.addIssue({ code: "custom", path: [...path, name], message: "A scope field requires a repeated instance." });
11621
+ if (source.kind === "expression")
11622
+ checkScopedReads(
11623
+ collectPageExpressionReads(source.expression),
11624
+ scopes,
11625
+ [...path, name]
11626
+ );
11627
+ if (source.kind === "page-state")
11628
+ checkScopedReads(
11629
+ [{ kind: "read", root: "state", path: [source.stateId] }],
11630
+ scopes,
11631
+ [...path, name]
11632
+ );
11633
+ if (source.kind === "binding-field")
11634
+ checkScopedReads(
11635
+ [{ kind: "read", root: "bindings", path: [source.bindingId] }],
11636
+ scopes,
11637
+ [...path, name]
11638
+ );
11639
+ if (source.kind === "scope-field" && scopes.size === 0)
11640
+ context.addIssue({
11641
+ code: "custom",
11642
+ path: [...path, name],
11643
+ message: "A scope field requires a repeated instance."
11644
+ });
10778
11645
  });
10779
11646
  };
10780
- value.capabilityInstances.forEach((instance, index) => instance.eventPayloadBindings?.forEach((binding, bindingIndex) => checkScopedReads(collectPageExpressionReads(binding.expression), scopesForNode(instance.nodeId), ["capabilityInstances", index, "eventPayloadBindings", bindingIndex])));
10781
- value.capabilityInstances.forEach((instance, index) => instance.propertyBindings?.forEach((binding, bindingIndex) => {
10782
- checkScopedReads(collectPageExpressionReads(binding.expression), scopesForNode(instance.nodeId), ["capabilityInstances", index, "propertyBindings", bindingIndex]);
10783
- }));
10784
- for (const [collection, bindings] of [["ontologyBindings", value.ontologyBindings], ["queryBindings", queryBindings]]) {
10785
- bindings.forEach((binding, index) => checkScopedSources(binding.parameters, scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId)), [collection, index, "parameters"]));
11647
+ value.capabilityInstances.forEach(
11648
+ (instance, index) => instance.eventPayloadBindings?.forEach(
11649
+ (binding, bindingIndex) => checkScopedReads(
11650
+ collectPageExpressionReads(binding.expression),
11651
+ scopesForNode(instance.nodeId),
11652
+ ["capabilityInstances", index, "eventPayloadBindings", bindingIndex]
11653
+ )
11654
+ )
11655
+ );
11656
+ value.capabilityInstances.forEach(
11657
+ (instance, index) => instance.propertyBindings?.forEach((binding, bindingIndex) => {
11658
+ checkScopedReads(
11659
+ collectPageExpressionReads(binding.expression),
11660
+ scopesForNode(instance.nodeId),
11661
+ ["capabilityInstances", index, "propertyBindings", bindingIndex]
11662
+ );
11663
+ })
11664
+ );
11665
+ for (const [collection, bindings] of [
11666
+ ["ontologyBindings", value.ontologyBindings],
11667
+ ["queryBindings", queryBindings]
11668
+ ]) {
11669
+ bindings.forEach(
11670
+ (binding, index) => checkScopedSources(
11671
+ binding.parameters,
11672
+ scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId)),
11673
+ [collection, index, "parameters"]
11674
+ )
11675
+ );
10786
11676
  }
10787
11677
  value.actionBindings.forEach((binding, index) => {
10788
- const scopes = scopesForNode(instanceNodes.get(binding.source.capabilityInstanceId));
10789
- checkScopedSources(binding.inputMapping, scopes, ["actionBindings", index, "inputMapping"]);
11678
+ const scopes = scopesForNode(
11679
+ instanceNodes.get(binding.source.capabilityInstanceId)
11680
+ );
11681
+ checkScopedSources(binding.inputMapping, scopes, [
11682
+ "actionBindings",
11683
+ index,
11684
+ "inputMapping"
11685
+ ]);
10790
11686
  for (const [fileIndex, file] of (binding.fileInputs ?? []).entries()) {
10791
11687
  if (file.source.kind === "page-state") {
10792
11688
  const stateId = file.source.stateId;
10793
- const state = stateDefinitions.find((candidate) => candidate.stateId === stateId);
10794
- if (!state || state.persistence !== "none") context.addIssue({ code: "custom", path: ["actionBindings", index, "fileInputs", fileIndex], message: "File handles require declared nonpersistent Page state." });
10795
- checkScopedSources({ file: file.source }, scopes, ["actionBindings", index, "fileInputs", fileIndex]);
11689
+ const state = stateDefinitions.find(
11690
+ (candidate) => candidate.stateId === stateId
11691
+ );
11692
+ if (!state || state.persistence !== "none")
11693
+ context.addIssue({
11694
+ code: "custom",
11695
+ path: ["actionBindings", index, "fileInputs", fileIndex],
11696
+ message: "File handles require declared nonpersistent Page state."
11697
+ });
11698
+ checkScopedSources({ file: file.source }, scopes, [
11699
+ "actionBindings",
11700
+ index,
11701
+ "fileInputs",
11702
+ fileIndex
11703
+ ]);
10796
11704
  }
10797
11705
  }
10798
11706
  if (binding.when) {
10799
11707
  const reads = collectPageExpressionReads(binding.when);
10800
11708
  checkScopedReads(reads, scopes, ["actionBindings", index, "when"]);
10801
- 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." });
11709
+ for (const read of reads)
11710
+ if (read.root === "state" && !stateIds.has(read.path[0]))
11711
+ context.addIssue({
11712
+ code: "custom",
11713
+ path: ["actionBindings", index, "when"],
11714
+ message: "Action condition references an unknown Page state."
11715
+ });
10802
11716
  }
10803
11717
  });
10804
11718
  interactionBindings.forEach((binding, index) => {
10805
- const sourceScopes = scopesForNode(instanceNodes.get(binding.source.capabilityInstanceId));
10806
- const targetScope = stateDefinitions.find((state) => state.stateId === binding.targetStateId)?.scopeNodeId;
10807
- if (targetScope && !sourceScopes.has(targetScope)) context.addIssue({ code: "custom", path: ["interactionBindings", index, "targetStateId"], message: "An interaction must target its own instance or an ancestor." });
10808
- checkScopedSources(binding.inputMapping, targetScope ? scopesForNode(targetScope) : /* @__PURE__ */ new Set(), ["interactionBindings", index, "inputMapping"]);
11719
+ const sourceScopes = scopesForNode(
11720
+ instanceNodes.get(binding.source.capabilityInstanceId)
11721
+ );
11722
+ const targetScope = stateDefinitions.find(
11723
+ (state) => state.stateId === binding.targetStateId
11724
+ )?.scopeNodeId;
11725
+ if (targetScope && !sourceScopes.has(targetScope))
11726
+ context.addIssue({
11727
+ code: "custom",
11728
+ path: ["interactionBindings", index, "targetStateId"],
11729
+ message: "An interaction must target its own instance or an ancestor."
11730
+ });
11731
+ checkScopedSources(
11732
+ binding.inputMapping,
11733
+ targetScope ? scopesForNode(targetScope) : /* @__PURE__ */ new Set(),
11734
+ ["interactionBindings", index, "inputMapping"]
11735
+ );
10809
11736
  });
10810
11737
  value.renderTree.nodes.forEach((node, index) => {
10811
- if (node.repeat) checkScopedReads(collectPageExpressionReads(node.repeat.source), scopesForNode(node.parentNodeId), ["renderTree", "nodes", index, "repeat", "source"]);
11738
+ if (node.repeat)
11739
+ checkScopedReads(
11740
+ collectPageExpressionReads(node.repeat.source),
11741
+ scopesForNode(node.parentNodeId),
11742
+ ["renderTree", "nodes", index, "repeat", "source"]
11743
+ );
10812
11744
  });
10813
11745
  entryTransitions.forEach((transition, transitionIndex) => {
10814
11746
  if (transition.gestureSource && (!instanceIds.has(transition.gestureSource.capabilityInstanceId) || !interactionBindings.some(
@@ -10827,22 +11759,42 @@ var PageSchema = z14.object({
10827
11759
  message: "A Page cannot route into itself on entry."
10828
11760
  });
10829
11761
  }
10830
- forEachPageStateCondition(transition.activation, (condition, conditionPath) => {
10831
- if (!stateIds.has(condition.stateId)) {
11762
+ forEachPageStateCondition(
11763
+ transition.activation,
11764
+ (condition, conditionPath) => {
11765
+ if (!stateIds.has(condition.stateId)) {
11766
+ context.addIssue({
11767
+ code: "custom",
11768
+ path: [
11769
+ "entryTransitions",
11770
+ transitionIndex,
11771
+ "activation",
11772
+ ...conditionPath,
11773
+ "stateId"
11774
+ ],
11775
+ message: `Entry transition references unknown Page state ${condition.stateId}.`
11776
+ });
11777
+ }
11778
+ }
11779
+ );
11780
+ const declaredRouteParameters = new Set(
11781
+ value.routeClaims.flatMap(
11782
+ (claim) => [...claim.pathTemplate.matchAll(/:([A-Za-z][A-Za-z0-9_-]*)/g)].map(
11783
+ (match) => match[1]
11784
+ )
11785
+ )
11786
+ );
11787
+ for (const source of [
11788
+ ...Object.values(transition.pathParameters),
11789
+ ...Object.values(transition.query.set)
11790
+ ]) {
11791
+ if (source.kind === "route-parameter" && !declaredRouteParameters.has(source.name)) {
10832
11792
  context.addIssue({
10833
11793
  code: "custom",
10834
- path: ["entryTransitions", transitionIndex, "activation", ...conditionPath, "stateId"],
10835
- message: `Entry transition references unknown Page state ${condition.stateId}.`
11794
+ path: ["entryTransitions", transitionIndex],
11795
+ message: `Entry transition references unknown source route parameter ${source.name}.`
10836
11796
  });
10837
11797
  }
10838
- });
10839
- const declaredRouteParameters = new Set(value.routeClaims.flatMap(
10840
- (claim) => [...claim.pathTemplate.matchAll(/:([A-Za-z][A-Za-z0-9_-]*)/g)].map((match) => match[1])
10841
- ));
10842
- for (const source of [...Object.values(transition.pathParameters), ...Object.values(transition.query.set)]) {
10843
- if (source.kind === "route-parameter" && !declaredRouteParameters.has(source.name)) {
10844
- context.addIssue({ code: "custom", path: ["entryTransitions", transitionIndex], message: `Entry transition references unknown source route parameter ${source.name}.` });
10845
- }
10846
11798
  }
10847
11799
  const stateSources = [
10848
11800
  ...Object.values(transition.pathParameters).flatMap(
@@ -10867,7 +11819,11 @@ var PageSchema = z14.object({
10867
11819
  if (source.kind === "expression") {
10868
11820
  for (const read of collectPageExpressionReads(source.expression)) {
10869
11821
  if (read.root === "state" && (!read.path[0] || !stateIds.has(read.path[0])) || read.root === "model" || read.root === "bindings" || read.root === "result" && path[0] !== "interactionBindings") {
10870
- context.addIssue({ code: "custom", path: [...path, name, "expression"], message: "Expression references unavailable context or an undeclared Page state." });
11822
+ context.addIssue({
11823
+ code: "custom",
11824
+ path: [...path, name, "expression"],
11825
+ message: "Expression references unavailable context or an undeclared Page state."
11826
+ });
10871
11827
  }
10872
11828
  }
10873
11829
  }
@@ -10884,7 +11840,12 @@ var PageSchema = z14.object({
10884
11840
  if (!instanceIds.has(binding.source.capabilityInstanceId)) {
10885
11841
  context.addIssue({
10886
11842
  code: "custom",
10887
- path: ["interactionBindings", index, "source", "capabilityInstanceId"],
11843
+ path: [
11844
+ "interactionBindings",
11845
+ index,
11846
+ "source",
11847
+ "capabilityInstanceId"
11848
+ ],
10888
11849
  message: "Interaction binding sources an unknown capability instance."
10889
11850
  });
10890
11851
  }
@@ -10895,8 +11856,16 @@ var PageSchema = z14.object({
10895
11856
  message: "Interaction binding targets an unknown Page state."
10896
11857
  });
10897
11858
  }
10898
- validatePageStateSources(binding.inputMapping, ["interactionBindings", index, "inputMapping"]);
10899
- if (Object.values(binding.inputMapping).some((source) => source.kind === "result-field" || source.kind === "expression" && collectPageExpressionReads(source.expression).some((read) => read.root === "result"))) {
11859
+ validatePageStateSources(binding.inputMapping, [
11860
+ "interactionBindings",
11861
+ index,
11862
+ "inputMapping"
11863
+ ]);
11864
+ if (Object.values(binding.inputMapping).some(
11865
+ (source) => source.kind === "result-field" || source.kind === "expression" && collectPageExpressionReads(source.expression).some(
11866
+ (read) => read.root === "result"
11867
+ )
11868
+ )) {
10900
11869
  const action = value.actionBindings.find(
10901
11870
  (candidate) => candidate.source.capabilityInstanceId === binding.source.capabilityInstanceId && candidate.source.port === binding.source.port
10902
11871
  );
@@ -10906,10 +11875,17 @@ var PageSchema = z14.object({
10906
11875
  path: ["interactionBindings", index, "source"],
10907
11876
  message: "Result-field interactions must source one declared Action binding."
10908
11877
  });
10909
- } else if (!binding.sourceResultSchemaRevisionRef || !exactRevisionRef(binding.sourceResultSchemaRevisionRef, action.resultSchemaRevisionRef)) {
11878
+ } else if (!binding.sourceResultSchemaRevisionRef || !exactRevisionRef(
11879
+ binding.sourceResultSchemaRevisionRef,
11880
+ action.resultSchemaRevisionRef
11881
+ )) {
10910
11882
  context.addIssue({
10911
11883
  code: "custom",
10912
- path: ["interactionBindings", index, "sourceResultSchemaRevisionRef"],
11884
+ path: [
11885
+ "interactionBindings",
11886
+ index,
11887
+ "sourceResultSchemaRevisionRef"
11888
+ ],
10913
11889
  message: "Interaction result schema must exactly match the sourced Action result schema."
10914
11890
  });
10915
11891
  }
@@ -10918,45 +11894,90 @@ var PageSchema = z14.object({
10918
11894
  value.capabilityInstances.forEach((instance, index) => {
10919
11895
  const paths = [];
10920
11896
  instance.propertyBindings?.forEach((binding, bindingIndex) => {
10921
- const path = ["capabilityInstances", index, "propertyBindings", bindingIndex];
10922
- if (instance.capabilityRevisionRef.id.startsWith("monkeys.design.component.")) {
11897
+ const path = [
11898
+ "capabilityInstances",
11899
+ index,
11900
+ "propertyBindings",
11901
+ bindingIndex
11902
+ ];
11903
+ if (instance.capabilityRevisionRef.id.startsWith(
11904
+ "monkeys.design.component."
11905
+ )) {
10923
11906
  const [group, member3, field] = binding.targetPath;
10924
11907
  const messages = instance.properties.messages;
10925
11908
  const message = messages && typeof messages === "object" && !Array.isArray(messages) ? messages[member3] : void 0;
10926
11909
  const declaredMessage = message && typeof message === "object" && !Array.isArray(message);
10927
11910
  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));
10928
- if (!allowed) context.addIssue({ code: "custom", path: [...path, "targetPath"], message: "Component expressions can update property values or declared message fields, never executable wiring." });
11911
+ if (!allowed)
11912
+ context.addIssue({
11913
+ code: "custom",
11914
+ path: [...path, "targetPath"],
11915
+ message: "Component expressions can update property values or declared message fields, never executable wiring."
11916
+ });
10929
11917
  }
10930
- if (paths.some((previous) => previous.slice(0, Math.min(previous.length, binding.targetPath.length)).every((key, i) => key === binding.targetPath[i]))) {
10931
- context.addIssue({ code: "custom", path: [...path, "targetPath"], message: "Dynamic property targets must not overlap." });
11918
+ if (paths.some(
11919
+ (previous) => previous.slice(0, Math.min(previous.length, binding.targetPath.length)).every((key, i) => key === binding.targetPath[i])
11920
+ )) {
11921
+ context.addIssue({
11922
+ code: "custom",
11923
+ path: [...path, "targetPath"],
11924
+ message: "Dynamic property targets must not overlap."
11925
+ });
10932
11926
  }
10933
11927
  paths.push(binding.targetPath);
10934
11928
  visitPageExpression(binding.expression, (expression) => {
10935
11929
  if (expression.kind !== "read") return;
10936
11930
  if (expression.root === "state" && (!expression.path[0] || !stateIds.has(expression.path[0]))) {
10937
- context.addIssue({ code: "custom", path: [...path, "expression"], message: "Property expressions must reference a declared Page state." });
11931
+ context.addIssue({
11932
+ code: "custom",
11933
+ path: [...path, "expression"],
11934
+ message: "Property expressions must reference a declared Page state."
11935
+ });
10938
11936
  }
10939
- if (expression.root === "bindings" && ![...value.ontologyBindings, ...queryBindings].some((candidate) => candidate.bindingId === expression.path[0])) {
10940
- context.addIssue({ code: "custom", path: [...path, "expression"], message: "Property expressions must reference a declared Page query binding." });
11937
+ if (expression.root === "bindings" && ![...value.ontologyBindings, ...queryBindings].some(
11938
+ (candidate) => candidate.bindingId === expression.path[0]
11939
+ )) {
11940
+ context.addIssue({
11941
+ code: "custom",
11942
+ path: [...path, "expression"],
11943
+ message: "Property expressions must reference a declared Page query binding."
11944
+ });
10941
11945
  }
10942
11946
  if (expression.root === "actions" && (expression.path.length !== 2 || !actionOwners.has(expression.path[0]) || !["pending", "errorCode"].includes(expression.path[1]))) {
10943
- context.addIssue({ code: "custom", path: [...path, "expression"], message: "Property expressions may read only pending or errorCode from a declared Action binding." });
11947
+ context.addIssue({
11948
+ code: "custom",
11949
+ path: [...path, "expression"],
11950
+ message: "Property expressions may read only pending or errorCode from a declared Action binding."
11951
+ });
10944
11952
  }
10945
11953
  if (expression.root === "intent" || expression.root === "result") {
10946
- context.addIssue({ code: "custom", path: [...path, "expression"], message: "Property expressions cannot read transient event or Action results." });
11954
+ context.addIssue({
11955
+ code: "custom",
11956
+ path: [...path, "expression"],
11957
+ message: "Property expressions cannot read transient event or Action results."
11958
+ });
10947
11959
  }
10948
11960
  });
10949
11961
  });
10950
11962
  if (!instance.activationWhen) return;
10951
- forEachPageStateCondition(instance.activationWhen, (condition, conditionPath) => {
10952
- if (!stateIds.has(condition.stateId)) {
10953
- context.addIssue({
10954
- code: "custom",
10955
- path: ["capabilityInstances", index, "activationWhen", ...conditionPath, "stateId"],
10956
- message: "Capability activation condition references an unknown Page state."
10957
- });
11963
+ forEachPageStateCondition(
11964
+ instance.activationWhen,
11965
+ (condition, conditionPath) => {
11966
+ if (!stateIds.has(condition.stateId)) {
11967
+ context.addIssue({
11968
+ code: "custom",
11969
+ path: [
11970
+ "capabilityInstances",
11971
+ index,
11972
+ "activationWhen",
11973
+ ...conditionPath,
11974
+ "stateId"
11975
+ ],
11976
+ message: "Capability activation condition references an unknown Page state."
11977
+ });
11978
+ }
10958
11979
  }
10959
- });
11980
+ );
10960
11981
  });
10961
11982
  value.ontologyBindings.forEach((binding, index) => {
10962
11983
  if (!instanceIds.has(binding.target.capabilityInstanceId)) {
@@ -10966,7 +11987,11 @@ var PageSchema = z14.object({
10966
11987
  message: "Ontology binding targets an unknown capability instance."
10967
11988
  });
10968
11989
  }
10969
- validatePageStateSources(binding.parameters, ["ontologyBindings", index, "parameters"]);
11990
+ validatePageStateSources(binding.parameters, [
11991
+ "ontologyBindings",
11992
+ index,
11993
+ "parameters"
11994
+ ]);
10970
11995
  });
10971
11996
  queryBindings.forEach((binding, index) => {
10972
11997
  if (!instanceIds.has(binding.target.capabilityInstanceId)) {
@@ -10976,35 +12001,93 @@ var PageSchema = z14.object({
10976
12001
  message: "Query binding targets an unknown capability instance."
10977
12002
  });
10978
12003
  }
10979
- validatePageStateSources(binding.parameters, ["queryBindings", index, "parameters"]);
12004
+ validatePageStateSources(binding.parameters, [
12005
+ "queryBindings",
12006
+ index,
12007
+ "parameters"
12008
+ ]);
10980
12009
  if (binding.queryWhen) {
10981
- forEachPageStateCondition(binding.queryWhen, (condition, conditionPath) => {
10982
- if (!stateIds.has(condition.stateId)) {
10983
- context.addIssue({
10984
- code: "custom",
10985
- path: ["queryBindings", index, "queryWhen", ...conditionPath, "stateId"],
10986
- message: "Query activation condition references an unknown Page state."
10987
- });
12010
+ forEachPageStateCondition(
12011
+ binding.queryWhen,
12012
+ (condition, conditionPath) => {
12013
+ if (!stateIds.has(condition.stateId)) {
12014
+ context.addIssue({
12015
+ code: "custom",
12016
+ path: [
12017
+ "queryBindings",
12018
+ index,
12019
+ "queryWhen",
12020
+ ...conditionPath,
12021
+ "stateId"
12022
+ ],
12023
+ message: "Query activation condition references an unknown Page state."
12024
+ });
12025
+ }
10988
12026
  }
10989
- });
12027
+ );
10990
12028
  }
10991
12029
  if (binding.refreshPolicy?.when) {
10992
12030
  const path = ["queryBindings", index, "refreshPolicy", "when"];
10993
- const reads = collectExternalPageExpressionReads(binding.refreshPolicy.when);
10994
- checkScopedReads(reads, scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId)), path);
10995
- 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." });
12031
+ const reads = collectExternalPageExpressionReads(
12032
+ binding.refreshPolicy.when
12033
+ );
12034
+ checkScopedReads(
12035
+ reads,
12036
+ scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId)),
12037
+ path
12038
+ );
12039
+ for (const read of reads)
12040
+ if (read.root === "actions" && !actionScopes.has(read.path[0]))
12041
+ context.addIssue({
12042
+ code: "custom",
12043
+ path,
12044
+ message: "Automatic refresh condition references an unknown action binding."
12045
+ });
10996
12046
  }
10997
- const effectOwners = new Set(binding.stateEffects?.map((effect) => stateDefinitions.find((definition) => definition.stateId === effect.targetStateId)?.scopeNodeId ?? "") ?? []);
10998
- if (effectOwners.size > 1) context.addIssue({ code: "custom", path: ["queryBindings", index, "stateEffects"], message: "A query completion must update a single state owner atomically." });
12047
+ const effectOwners = new Set(
12048
+ binding.stateEffects?.map(
12049
+ (effect) => stateDefinitions.find(
12050
+ (definition) => definition.stateId === effect.targetStateId
12051
+ )?.scopeNodeId ?? ""
12052
+ ) ?? []
12053
+ );
12054
+ if (effectOwners.size > 1)
12055
+ context.addIssue({
12056
+ code: "custom",
12057
+ path: ["queryBindings", index, "stateEffects"],
12058
+ message: "A query completion must update a single state owner atomically."
12059
+ });
10999
12060
  binding.stateEffects?.forEach((effect, effectIndex) => {
11000
12061
  const path = ["queryBindings", index, "stateEffects", effectIndex];
11001
- const state = stateDefinitions.find((definition) => definition.stateId === effect.targetStateId);
11002
- const scopes = scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId));
11003
- 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." });
11004
- for (const expression of [effect.value, ...effect.when ? [effect.when] : []]) {
12062
+ const state = stateDefinitions.find(
12063
+ (definition) => definition.stateId === effect.targetStateId
12064
+ );
12065
+ const scopes = scopesForNode(
12066
+ instanceNodes.get(binding.target.capabilityInstanceId)
12067
+ );
12068
+ if (!state || state.scopeNodeId && !scopes.has(state.scopeNodeId))
12069
+ context.addIssue({
12070
+ code: "custom",
12071
+ path: [...path, "targetStateId"],
12072
+ message: "A query effect must target declared state in its own scope or an ancestor."
12073
+ });
12074
+ for (const expression of [
12075
+ effect.value,
12076
+ ...effect.when ? [effect.when] : []
12077
+ ]) {
11005
12078
  const reads = collectPageExpressionReads(expression);
11006
- checkScopedReads(reads, state?.scopeNodeId ? scopesForNode(state.scopeNodeId) : /* @__PURE__ */ new Set(), path);
11007
- 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." });
12079
+ checkScopedReads(
12080
+ reads,
12081
+ state?.scopeNodeId ? scopesForNode(state.scopeNodeId) : /* @__PURE__ */ new Set(),
12082
+ path
12083
+ );
12084
+ for (const read of reads)
12085
+ if (read.root === "state" && !stateIds.has(read.path[0]))
12086
+ context.addIssue({
12087
+ code: "custom",
12088
+ path,
12089
+ message: "Query effect references an unknown Page state."
12090
+ });
11008
12091
  }
11009
12092
  });
11010
12093
  binding.resultStateBindings?.forEach((resultBinding, resultIndex) => {
@@ -11014,41 +12097,78 @@ var PageSchema = z14.object({
11014
12097
  if (!stateDefinition) {
11015
12098
  context.addIssue({
11016
12099
  code: "custom",
11017
- path: ["queryBindings", index, "resultStateBindings", resultIndex, "targetStateId"],
12100
+ path: [
12101
+ "queryBindings",
12102
+ index,
12103
+ "resultStateBindings",
12104
+ resultIndex,
12105
+ "targetStateId"
12106
+ ],
11018
12107
  message: "Query result binding targets an unknown Page state."
11019
12108
  });
11020
12109
  return;
11021
12110
  }
11022
- if (!exactRevisionRef(resultBinding.targetStateSchemaRevisionRef, stateDefinition.schemaRevisionRef)) {
12111
+ if (!exactRevisionRef(
12112
+ resultBinding.targetStateSchemaRevisionRef,
12113
+ stateDefinition.schemaRevisionRef
12114
+ )) {
11023
12115
  context.addIssue({
11024
12116
  code: "custom",
11025
- path: ["queryBindings", index, "resultStateBindings", resultIndex, "targetStateSchemaRevisionRef"],
12117
+ path: [
12118
+ "queryBindings",
12119
+ index,
12120
+ "resultStateBindings",
12121
+ resultIndex,
12122
+ "targetStateSchemaRevisionRef"
12123
+ ],
11026
12124
  message: "Query result binding must pin the exact target Page-state schema revision."
11027
12125
  });
11028
12126
  }
11029
12127
  if (stateDefinition.persistence !== "none") {
11030
12128
  context.addIssue({
11031
12129
  code: "custom",
11032
- path: ["queryBindings", index, "resultStateBindings", resultIndex, "targetStateId"],
12130
+ path: [
12131
+ "queryBindings",
12132
+ index,
12133
+ "resultStateBindings",
12134
+ resultIndex,
12135
+ "targetStateId"
12136
+ ],
11033
12137
  message: "Query result state projections must target non-persistent Page state."
11034
12138
  });
11035
12139
  }
11036
12140
  });
11037
12141
  });
11038
12142
  const dependencyBindings = [...value.ontologyBindings, ...queryBindings];
11039
- analyzePageBindingDependencies(dependencyBindings).errors.forEach((error) => {
11040
- const ontologyIndex = value.ontologyBindings.findIndex((binding) => binding.bindingId === error.bindingId);
11041
- const collection = ontologyIndex >= 0 ? "ontologyBindings" : "queryBindings";
11042
- const index = ontologyIndex >= 0 ? ontologyIndex : queryBindings.findIndex((binding) => binding.bindingId === error.bindingId);
11043
- context.addIssue({ code: "custom", path: [collection, index, "parameters"], message: `Page binding dependency ${error.code}: ${error.dependencyId ?? error.bindingId}` });
11044
- });
12143
+ analyzePageBindingDependencies(dependencyBindings).errors.forEach(
12144
+ (error) => {
12145
+ const ontologyIndex = value.ontologyBindings.findIndex(
12146
+ (binding) => binding.bindingId === error.bindingId
12147
+ );
12148
+ const collection = ontologyIndex >= 0 ? "ontologyBindings" : "queryBindings";
12149
+ const index = ontologyIndex >= 0 ? ontologyIndex : queryBindings.findIndex(
12150
+ (binding) => binding.bindingId === error.bindingId
12151
+ );
12152
+ context.addIssue({
12153
+ code: "custom",
12154
+ path: [collection, index, "parameters"],
12155
+ message: `Page binding dependency ${error.code}: ${error.dependencyId ?? error.bindingId}`
12156
+ });
12157
+ }
12158
+ );
11045
12159
  const projectedQueryStateIds = /* @__PURE__ */ new Set();
11046
12160
  queryBindings.forEach((binding, index) => {
11047
12161
  binding.resultStateBindings?.forEach((resultBinding, resultIndex) => {
11048
12162
  if (projectedQueryStateIds.has(resultBinding.targetStateId)) {
11049
12163
  context.addIssue({
11050
12164
  code: "custom",
11051
- path: ["queryBindings", index, "resultStateBindings", resultIndex, "targetStateId"],
12165
+ path: [
12166
+ "queryBindings",
12167
+ index,
12168
+ "resultStateBindings",
12169
+ resultIndex,
12170
+ "targetStateId"
12171
+ ],
11052
12172
  message: "One Page state can have only one Server Query result owner."
11053
12173
  });
11054
12174
  }
@@ -11058,12 +12178,19 @@ var PageSchema = z14.object({
11058
12178
  queryBindings.forEach((binding, index) => {
11059
12179
  if (binding.execution !== "server") return;
11060
12180
  const readStateIds = new Set(
11061
- Object.values(binding.parameters).flatMap((source) => source.kind === "page-state" ? [source.stateId] : [])
12181
+ Object.values(binding.parameters).flatMap(
12182
+ (source) => source.kind === "page-state" ? [source.stateId] : []
12183
+ )
11062
12184
  );
11063
12185
  if (binding.queryWhen) {
11064
- forEachPageStateCondition(binding.queryWhen, (condition) => readStateIds.add(condition.stateId));
12186
+ forEachPageStateCondition(
12187
+ binding.queryWhen,
12188
+ (condition) => readStateIds.add(condition.stateId)
12189
+ );
11065
12190
  }
11066
- const feedbackStateId = [...readStateIds].find((stateId) => projectedQueryStateIds.has(stateId));
12191
+ const feedbackStateId = [...readStateIds].find(
12192
+ (stateId) => projectedQueryStateIds.has(stateId)
12193
+ );
11067
12194
  if (feedbackStateId) {
11068
12195
  context.addIssue({
11069
12196
  code: "custom",
@@ -11087,10 +12214,34 @@ var PageSchema = z14.object({
11087
12214
  const cursorWindowSources = /* @__PURE__ */ new Set();
11088
12215
  cursorWindowBindings.forEach(({ binding, index, collection }) => {
11089
12216
  const sourceId = binding.cursorWindow.sourceCapabilityInstanceId ?? binding.target.capabilityInstanceId;
11090
- if (!instanceIds.has(sourceId)) context.addIssue({ code: "custom", path: [collection, index, "cursorWindow", "sourceCapabilityInstanceId"], message: "Cursor-window source must reference a declared capability instance." });
12217
+ if (!instanceIds.has(sourceId))
12218
+ context.addIssue({
12219
+ code: "custom",
12220
+ path: [
12221
+ collection,
12222
+ index,
12223
+ "cursorWindow",
12224
+ "sourceCapabilityInstanceId"
12225
+ ],
12226
+ message: "Cursor-window source must reference a declared capability instance."
12227
+ });
11091
12228
  const sourceScopes = [...scopesForNode(instanceNodes.get(sourceId))];
11092
- const targetScopes = [...scopesForNode(instanceNodes.get(binding.target.capabilityInstanceId))];
11093
- 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." });
12229
+ const targetScopes = [
12230
+ ...scopesForNode(
12231
+ instanceNodes.get(binding.target.capabilityInstanceId)
12232
+ )
12233
+ ];
12234
+ if (sourceScopes.length !== targetScopes.length || sourceScopes.some((id, index2) => id !== targetScopes[index2]))
12235
+ context.addIssue({
12236
+ code: "custom",
12237
+ path: [
12238
+ collection,
12239
+ index,
12240
+ "cursorWindow",
12241
+ "sourceCapabilityInstanceId"
12242
+ ],
12243
+ message: "Cursor-window source and query target must share the same repeated scope."
12244
+ });
11094
12245
  const sourceKey = `${sourceId}:${binding.cursorWindow.pageChangePort}`;
11095
12246
  if (cursorWindowSources.has(sourceKey)) {
11096
12247
  context.addIssue({
@@ -11122,9 +12273,15 @@ var PageSchema = z14.object({
11122
12273
  message: "Action binding sources an unknown capability instance."
11123
12274
  });
11124
12275
  }
11125
- validatePageStateSources(binding.inputMapping, ["actionBindings", index, "inputMapping"]);
12276
+ validatePageStateSources(binding.inputMapping, [
12277
+ "actionBindings",
12278
+ index,
12279
+ "inputMapping"
12280
+ ]);
11126
12281
  binding.success.refreshBindingIds.forEach((bindingId) => {
11127
- if (!value.ontologyBindings.some((candidate) => candidate.bindingId === bindingId) && !queryBindings.some((candidate) => candidate.bindingId === bindingId)) {
12282
+ if (!value.ontologyBindings.some(
12283
+ (candidate) => candidate.bindingId === bindingId
12284
+ ) && !queryBindings.some((candidate) => candidate.bindingId === bindingId)) {
11128
12285
  context.addIssue({
11129
12286
  code: "custom",
11130
12287
  path: ["actionBindings", index, "success", "refreshBindingIds"],
@@ -11132,7 +12289,9 @@ var PageSchema = z14.object({
11132
12289
  });
11133
12290
  }
11134
12291
  });
11135
- const effectBindingIds = binding.success.resultBindingEffects?.map((effect) => effect.bindingId) ?? [];
12292
+ const effectBindingIds = binding.success.resultBindingEffects?.map(
12293
+ (effect) => effect.bindingId
12294
+ ) ?? [];
11136
12295
  if (new Set(effectBindingIds).size !== effectBindingIds.length) {
11137
12296
  context.addIssue({
11138
12297
  code: "custom",
@@ -11141,17 +12300,35 @@ var PageSchema = z14.object({
11141
12300
  });
11142
12301
  }
11143
12302
  binding.success.resultBindingEffects?.forEach((effect, effectIndex) => {
11144
- if (!value.ontologyBindings.some((candidate) => candidate.bindingId === effect.bindingId) && !queryBindings.some((candidate) => candidate.bindingId === effect.bindingId)) {
12303
+ if (!value.ontologyBindings.some(
12304
+ (candidate) => candidate.bindingId === effect.bindingId
12305
+ ) && !queryBindings.some(
12306
+ (candidate) => candidate.bindingId === effect.bindingId
12307
+ )) {
11145
12308
  context.addIssue({
11146
12309
  code: "custom",
11147
- path: ["actionBindings", index, "success", "resultBindingEffects", effectIndex, "bindingId"],
12310
+ path: [
12311
+ "actionBindings",
12312
+ index,
12313
+ "success",
12314
+ "resultBindingEffects",
12315
+ effectIndex,
12316
+ "bindingId"
12317
+ ],
11148
12318
  message: `Unknown result effect binding: ${effect.bindingId}`
11149
12319
  });
11150
12320
  }
11151
12321
  if (binding.success.refreshBindingIds.includes(effect.bindingId)) {
11152
12322
  context.addIssue({
11153
12323
  code: "custom",
11154
- path: ["actionBindings", index, "success", "resultBindingEffects", effectIndex, "bindingId"],
12324
+ path: [
12325
+ "actionBindings",
12326
+ index,
12327
+ "success",
12328
+ "resultBindingEffects",
12329
+ effectIndex,
12330
+ "bindingId"
12331
+ ],
11155
12332
  message: "A result-projected binding cannot also be refreshed by the same Action."
11156
12333
  });
11157
12334
  }
@@ -11192,7 +12369,11 @@ var PageSchema = z14.object({
11192
12369
  const refs = [
11193
12370
  ["capabilityRevisionRef", instance.capabilityRevisionRef, "capability"],
11194
12371
  ["providerRevisionRef", instance.providerRevisionRef, "view-provider"],
11195
- ["propertySchemaRevisionRef", instance.propertySchemaRevisionRef, "schema"]
12372
+ [
12373
+ "propertySchemaRevisionRef",
12374
+ instance.propertySchemaRevisionRef,
12375
+ "schema"
12376
+ ]
11196
12377
  ];
11197
12378
  refs.forEach(([field, reference, expectedKind]) => {
11198
12379
  if (reference.kind !== expectedKind)
@@ -11233,7 +12414,10 @@ var PageReleaseSchema = z14.object({
11233
12414
  surface: ProductSurfaceSchema,
11234
12415
  routeSpaceRevisionRef: RevisionRefSchema,
11235
12416
  normalizedPath: RoutePathTemplateSchema,
11236
- routeClaim: z14.union([CompiledRouteClaimSchema, LegacyCompiledRouteClaimSchema]),
12417
+ routeClaim: z14.union([
12418
+ CompiledRouteClaimSchema,
12419
+ LegacyCompiledRouteClaimSchema
12420
+ ]),
11237
12421
  legacyRouteTakeoverAuthorization: LegacyRouteTakeoverAuthorizationSchema.optional()
11238
12422
  }).strict()
11239
12423
  }).strict().superRefine((value, context) => {
@@ -11259,7 +12443,10 @@ var PageReleaseSchema = z14.object({
11259
12443
  message: "Page release target requires a route-space revision."
11260
12444
  });
11261
12445
  validateReleaseRouteSurface(value.target, context);
11262
- if (value.target.normalizedPath !== value.target.routeClaim.normalizedPath || !exactRevisionRef(value.target.routeSpaceRevisionRef, value.target.routeClaim.routeSpaceRevisionRef)) {
12446
+ if (value.target.normalizedPath !== value.target.routeClaim.normalizedPath || !exactRevisionRef(
12447
+ value.target.routeSpaceRevisionRef,
12448
+ value.target.routeClaim.routeSpaceRevisionRef
12449
+ )) {
11263
12450
  context.addIssue({
11264
12451
  code: "custom",
11265
12452
  path: ["target", "routeClaim"],
@@ -11267,7 +12454,10 @@ var PageReleaseSchema = z14.object({
11267
12454
  });
11268
12455
  }
11269
12456
  const takeover = value.target.legacyRouteTakeoverAuthorization;
11270
- 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)) {
12457
+ if (takeover && (value.target.routeClaim.kind !== "canonical" || takeover.normalizedPath !== value.target.normalizedPath || !exactRevisionRef(
12458
+ takeover.routeSpaceRevisionRef,
12459
+ value.target.routeSpaceRevisionRef
12460
+ ) || takeover.targetResourceRef.kind !== "page" || takeover.targetResourceRef.id !== value.pageRevisionRef.id || takeover.targetResourceRef.ownerRepo !== value.pageRevisionRef.ownerRepo)) {
11271
12461
  context.addIssue({
11272
12462
  code: "custom",
11273
12463
  path: ["target", "legacyRouteTakeoverAuthorization"],
@@ -11285,7 +12475,14 @@ var WorkbenchGroupSchema = z14.object({
11285
12475
  }).strict();
11286
12476
  var WorkbenchAppInstanceSchema = z14.object({
11287
12477
  instanceId: ContractIdentifierSchema,
11288
- kind: z14.enum(["built-in-application", "workflow-form", "workflow", "agent", "design", "capability"]),
12478
+ kind: z14.enum([
12479
+ "built-in-application",
12480
+ "workflow-form",
12481
+ "workflow",
12482
+ "agent",
12483
+ "design",
12484
+ "capability"
12485
+ ]),
11289
12486
  targetRevisionRef: RevisionRefSchema,
11290
12487
  providerRevisionRef: RevisionRefSchema,
11291
12488
  inputSchemaRevisionRef: RevisionRefSchema,
@@ -11308,7 +12505,12 @@ var WorkbenchSchema = z14.object({
11308
12505
  identity: WorkbenchIdentitySchema,
11309
12506
  supportedSurfaces: z14.array(ProductSurfaceSchema).min(1),
11310
12507
  lifecycle: DeclarativeLifecycleSchema,
11311
- routeClaims: z14.array(z14.union([DeclarativeRouteClaimSchema, LegacyDeclarativeRouteClaimSchema])).min(1),
12508
+ routeClaims: z14.array(
12509
+ z14.union([
12510
+ DeclarativeRouteClaimSchema,
12511
+ LegacyDeclarativeRouteClaimSchema
12512
+ ])
12513
+ ).min(1),
11312
12514
  groups: z14.array(WorkbenchGroupSchema).min(1),
11313
12515
  appInstances: z14.array(WorkbenchAppInstanceSchema).min(1),
11314
12516
  defaultEntry: z14.object({
@@ -11325,14 +12527,25 @@ var WorkbenchSchema = z14.object({
11325
12527
  workbenchAccessPolicy: AccessPolicySchema,
11326
12528
  managementAccess: ManagementAccessSchema,
11327
12529
  personalPreferencesPolicy: z14.object({
11328
- allowed: z14.array(z14.enum(["collapsed-groups", "recent-entry", "layout-density"])),
12530
+ allowed: z14.array(
12531
+ z14.enum(["collapsed-groups", "recent-entry", "layout-density"])
12532
+ ),
11329
12533
  authority: z14.literal("identity-overlay")
11330
12534
  }).strict(),
11331
12535
  performanceBudgetRef: RevisionRefSchema,
11332
12536
  observationPolicyRevisionRef: RevisionRefSchema,
11333
- privacyClassification: z14.enum(["public", "internal", "confidential", "restricted"])
12537
+ privacyClassification: z14.enum([
12538
+ "public",
12539
+ "internal",
12540
+ "confidential",
12541
+ "restricted"
12542
+ ])
11334
12543
  }).strict().superRefine((value, context) => {
11335
- validateDeclaredRouteSurfaces(value.supportedSurfaces, value.routeClaims, context);
12544
+ validateDeclaredRouteSurfaces(
12545
+ value.supportedSurfaces,
12546
+ value.routeClaims,
12547
+ context
12548
+ );
11336
12549
  if (value.purpose === "template" && value.sourceTemplateRevisionRef) {
11337
12550
  context.addIssue({
11338
12551
  code: "custom",
@@ -11347,7 +12560,10 @@ var WorkbenchSchema = z14.object({
11347
12560
  path: ["groups"],
11348
12561
  message: `Duplicate Workbench group: ${duplicateGroup}`
11349
12562
  });
11350
- const duplicateInstance = uniqueArray(value.appInstances, (instance) => instance.instanceId);
12563
+ const duplicateInstance = uniqueArray(
12564
+ value.appInstances,
12565
+ (instance) => instance.instanceId
12566
+ );
11351
12567
  if (duplicateInstance)
11352
12568
  context.addIssue({
11353
12569
  code: "custom",
@@ -11402,9 +12618,21 @@ var WorkbenchSchema = z14.object({
11402
12618
  });
11403
12619
  });
11404
12620
  const layoutRefs = [
11405
- ["hostCapabilityRevisionRef", value.layout.hostCapabilityRevisionRef, "capability"],
11406
- ["hostProviderRevisionRef", value.layout.hostProviderRevisionRef, "view-provider"],
11407
- ["layoutPolicyRevisionRef", value.layout.layoutPolicyRevisionRef, "layout-policy"]
12621
+ [
12622
+ "hostCapabilityRevisionRef",
12623
+ value.layout.hostCapabilityRevisionRef,
12624
+ "capability"
12625
+ ],
12626
+ [
12627
+ "hostProviderRevisionRef",
12628
+ value.layout.hostProviderRevisionRef,
12629
+ "view-provider"
12630
+ ],
12631
+ [
12632
+ "layoutPolicyRevisionRef",
12633
+ value.layout.layoutPolicyRevisionRef,
12634
+ "layout-policy"
12635
+ ]
11408
12636
  ];
11409
12637
  layoutRefs.forEach(([field, reference, expectedKind]) => {
11410
12638
  if (reference.kind !== expectedKind)
@@ -11433,7 +12661,10 @@ var WorkbenchReleaseSchema = z14.object({
11433
12661
  workbenchId: ContractIdentifierSchema,
11434
12662
  routeSpaceRevisionRef: RevisionRefSchema,
11435
12663
  normalizedPath: RoutePathTemplateSchema,
11436
- routeClaim: z14.union([CompiledRouteClaimSchema, LegacyCompiledRouteClaimSchema]),
12664
+ routeClaim: z14.union([
12665
+ CompiledRouteClaimSchema,
12666
+ LegacyCompiledRouteClaimSchema
12667
+ ]),
11437
12668
  legacyRouteTakeoverAuthorization: LegacyRouteTakeoverAuthorizationSchema.optional(),
11438
12669
  order: z14.number().int(),
11439
12670
  isDefaultCandidate: z14.boolean()
@@ -11461,7 +12692,10 @@ var WorkbenchReleaseSchema = z14.object({
11461
12692
  message: "Workbench release target requires a route-space revision."
11462
12693
  });
11463
12694
  validateReleaseRouteSurface(value.target, context);
11464
- if (value.target.normalizedPath !== value.target.routeClaim.normalizedPath || !exactRevisionRef(value.target.routeSpaceRevisionRef, value.target.routeClaim.routeSpaceRevisionRef)) {
12695
+ if (value.target.normalizedPath !== value.target.routeClaim.normalizedPath || !exactRevisionRef(
12696
+ value.target.routeSpaceRevisionRef,
12697
+ value.target.routeClaim.routeSpaceRevisionRef
12698
+ )) {
11465
12699
  context.addIssue({
11466
12700
  code: "custom",
11467
12701
  path: ["target", "routeClaim"],
@@ -11469,7 +12703,10 @@ var WorkbenchReleaseSchema = z14.object({
11469
12703
  });
11470
12704
  }
11471
12705
  const takeover = value.target.legacyRouteTakeoverAuthorization;
11472
- 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)) {
12706
+ if (takeover && (value.target.routeClaim.kind !== "canonical" || takeover.normalizedPath !== value.target.normalizedPath || !exactRevisionRef(
12707
+ takeover.routeSpaceRevisionRef,
12708
+ value.target.routeSpaceRevisionRef
12709
+ ) || takeover.targetResourceRef.kind !== "workbench" || takeover.targetResourceRef.id !== value.workbenchRevisionRef.id || takeover.targetResourceRef.ownerRepo !== value.workbenchRevisionRef.ownerRepo)) {
11473
12710
  context.addIssue({
11474
12711
  code: "custom",
11475
12712
  path: ["target", "legacyRouteTakeoverAuthorization"],
@@ -11578,7 +12815,9 @@ var NavigationSchema = z14.object({
11578
12815
  }).strict().superRefine((value, context) => {
11579
12816
  validateNavigationTree(value.nodes, context);
11580
12817
  value.nodes.forEach((node, index) => {
11581
- if (node.kind === "target" && !["page", "workbench", "menu-action", "domain-command"].includes(node.targetRef.kind)) {
12818
+ if (node.kind === "target" && !["page", "workbench", "menu-action", "domain-command"].includes(
12819
+ node.targetRef.kind
12820
+ )) {
11582
12821
  context.addIssue({
11583
12822
  code: "custom",
11584
12823
  path: ["nodes", index, "targetRef", "kind"],
@@ -11595,7 +12834,10 @@ var ResolvedNavigationTargetSchema = z14.object({
11595
12834
  }).strict();
11596
12835
  var UnavailableNavigationTargetSchema = z14.object({
11597
12836
  nodeId: ContractIdentifierSchema,
11598
- stableTargetRef: StableRefSchema.refine((reference) => reference.kind === "page", "Only missing Pages can be isolated."),
12837
+ stableTargetRef: StableRefSchema.refine(
12838
+ (reference) => reference.kind === "page",
12839
+ "Only missing Pages can be isolated."
12840
+ ),
11599
12841
  reason: z14.literal("page-missing"),
11600
12842
  accessPolicy: AccessPolicySchema.nullable()
11601
12843
  }).strict();
@@ -11632,8 +12874,15 @@ var NavigationReleaseSchema = z14.object({
11632
12874
  path: ["resolvedTargets"],
11633
12875
  message: "Resolved Navigation node IDs must be unique."
11634
12876
  });
11635
- if (uniqueArray([...value.resolvedTargets, ...value.unavailableTargets ?? []], (target) => target.nodeId)) {
11636
- context.addIssue({ code: "custom", path: ["unavailableTargets"], message: "Navigation target resolutions must have unique node IDs." });
12877
+ if (uniqueArray(
12878
+ [...value.resolvedTargets, ...value.unavailableTargets ?? []],
12879
+ (target) => target.nodeId
12880
+ )) {
12881
+ context.addIssue({
12882
+ code: "custom",
12883
+ path: ["unavailableTargets"],
12884
+ message: "Navigation target resolutions must have unique node IDs."
12885
+ });
11637
12886
  }
11638
12887
  });
11639
12888
  var RuntimeDiagnosticSchema = z14.object({
@@ -11722,7 +12971,9 @@ var DeclarativeRouteOwnerIndexSchema = z14.object({
11722
12971
  contentHash: Sha256Schema,
11723
12972
  rebuildable: z14.literal(true)
11724
12973
  }).strict().superRefine((value, context) => {
11725
- const identities = value.entries.map((entry) => `${entry.resourceKind}:${entry.releaseSlotId}`);
12974
+ const identities = value.entries.map(
12975
+ (entry) => `${entry.resourceKind}:${entry.releaseSlotId}`
12976
+ );
11726
12977
  if (new Set(identities).size !== identities.length) {
11727
12978
  context.addIssue({
11728
12979
  code: "custom",
@@ -11730,7 +12981,9 @@ var DeclarativeRouteOwnerIndexSchema = z14.object({
11730
12981
  message: "Route owner index entries must be unique by Release slot."
11731
12982
  });
11732
12983
  }
11733
- if (identities.some((identity, index) => index > 0 && identities[index - 1].localeCompare(identity) > 0)) {
12984
+ if (identities.some(
12985
+ (identity, index) => index > 0 && identities[index - 1].localeCompare(identity) > 0
12986
+ )) {
11734
12987
  context.addIssue({
11735
12988
  code: "custom",
11736
12989
  path: ["entries"],
@@ -11812,7 +13065,9 @@ var DeclarativeWorkbenchCatalogSchema = z14.object({
11812
13065
  message: "Workbench catalog identities must be unique."
11813
13066
  });
11814
13067
  }
11815
- if (value.entries.filter((entry) => entry.authority !== "unavailable" && entry.isDefaultCandidate).length > 1) {
13068
+ if (value.entries.filter(
13069
+ (entry) => entry.authority !== "unavailable" && entry.isDefaultCandidate
13070
+ ).length > 1) {
11816
13071
  context.addIssue({
11817
13072
  code: "custom",
11818
13073
  path: ["entries"],
@@ -11822,7 +13077,9 @@ var DeclarativeWorkbenchCatalogSchema = z14.object({
11822
13077
  const sorted = [...value.entries].sort(
11823
13078
  (left, right) => left.order - right.order || left.workbenchId.localeCompare(right.workbenchId)
11824
13079
  );
11825
- if (sorted.some((entry, index) => entry.workbenchId !== value.entries[index]?.workbenchId)) {
13080
+ if (sorted.some(
13081
+ (entry, index) => entry.workbenchId !== value.entries[index]?.workbenchId
13082
+ )) {
11826
13083
  context.addIssue({
11827
13084
  code: "custom",
11828
13085
  path: ["entries"],
@@ -11854,9 +13111,16 @@ var PageRuntimeBundleSchema = z14.object({
11854
13111
  tokenRevisionRefs: z14.array(RevisionRefSchema),
11855
13112
  performanceBudgetRef: RevisionRefSchema,
11856
13113
  observationPolicyRevisionRef: RevisionRefSchema,
11857
- privacyClassification: z14.enum(["public", "internal", "confidential", "restricted"])
13114
+ privacyClassification: z14.enum([
13115
+ "public",
13116
+ "internal",
13117
+ "confidential",
13118
+ "restricted"
13119
+ ])
11858
13120
  }).strict().superRefine((value, context) => {
11859
- const instanceIds = new Set(value.capabilityInstances.map((instance) => instance.instanceId));
13121
+ const instanceIds = new Set(
13122
+ value.capabilityInstances.map((instance) => instance.instanceId)
13123
+ );
11860
13124
  if (new Set(value.deniedCapabilityInstanceIds).size !== value.deniedCapabilityInstanceIds.length || value.deniedCapabilityInstanceIds.some((id) => !instanceIds.has(id))) {
11861
13125
  context.addIssue({
11862
13126
  code: "custom",
@@ -11919,7 +13183,12 @@ var WorkbenchRuntimeBundleSchema = z14.object({
11919
13183
  target: WorkbenchRuntimeTargetSchema,
11920
13184
  performanceBudgetRef: RevisionRefSchema,
11921
13185
  observationPolicyRevisionRef: RevisionRefSchema,
11922
- privacyClassification: z14.enum(["public", "internal", "confidential", "restricted"])
13186
+ privacyClassification: z14.enum([
13187
+ "public",
13188
+ "internal",
13189
+ "confidential",
13190
+ "restricted"
13191
+ ])
11923
13192
  }).strict().superRefine((value, context) => {
11924
13193
  validateRuntimeBundleBase(value, "workbench-release", context);
11925
13194
  value.routeClaims.forEach((claim, index) => {
@@ -11967,7 +13236,9 @@ var WorkbenchRuntimeBundleSchema = z14.object({
11967
13236
  message: "Workbench runtime default entry must reference a visible app in the declared group."
11968
13237
  });
11969
13238
  }
11970
- if (!value.groups.some((group) => group.groupId === value.defaultEntry?.groupId)) {
13239
+ if (!value.groups.some(
13240
+ (group) => group.groupId === value.defaultEntry?.groupId
13241
+ )) {
11971
13242
  context.addIssue({
11972
13243
  code: "custom",
11973
13244
  path: ["defaultEntry", "groupId"],
@@ -11999,12 +13270,15 @@ var CompiledNavigationDomainCommandTargetSchema = ResolvedNavigationTargetSchema
11999
13270
  resultSchemaRevisionRef: RevisionRefSchema.optional(),
12000
13271
  input: JsonObjectSchema
12001
13272
  }).strict();
12002
- var CompiledNavigationResolvedTargetSchema = z14.discriminatedUnion("kind", [
12003
- CompiledNavigationTargetSchema,
12004
- CompiledNavigationRegisteredMenuActionTargetSchema,
12005
- CompiledNavigationDomainCommandTargetSchema,
12006
- UnavailableNavigationTargetSchema.omit({ reason: true }).extend({ kind: z14.literal("unavailable") }).strict()
12007
- ]);
13273
+ var CompiledNavigationResolvedTargetSchema = z14.discriminatedUnion(
13274
+ "kind",
13275
+ [
13276
+ CompiledNavigationTargetSchema,
13277
+ CompiledNavigationRegisteredMenuActionTargetSchema,
13278
+ CompiledNavigationDomainCommandTargetSchema,
13279
+ UnavailableNavigationTargetSchema.omit({ reason: true }).extend({ kind: z14.literal("unavailable") }).strict()
13280
+ ]
13281
+ );
12008
13282
  var CompiledNavigationGroupNodeSchema = NavigationGroupNodeSchema.extend({
12009
13283
  ancestorAccessPolicies: z14.array(AccessPolicySchema)
12010
13284
  }).strict();
@@ -12013,10 +13287,18 @@ var CompiledNavigationTargetNodeSchema = NavigationTargetNodeSchema.extend({
12013
13287
  resolvedTarget: CompiledNavigationResolvedTargetSchema
12014
13288
  }).strict().superRefine((node, context) => {
12015
13289
  if (node.resolvedTarget.nodeId !== node.nodeId || stableRefIdentity(node.resolvedTarget.stableTargetRef) !== stableRefIdentity(node.targetRef)) {
12016
- context.addIssue({ code: "custom", path: ["resolvedTarget"], message: "Resolved target identity must match the source node." });
13290
+ context.addIssue({
13291
+ code: "custom",
13292
+ path: ["resolvedTarget"],
13293
+ message: "Resolved target identity must match the source node."
13294
+ });
12017
13295
  }
12018
13296
  if (node.resolvedTarget.kind === "unavailable" && (node.disabled !== true || Object.keys(node.parameterMapping).length > 0)) {
12019
- context.addIssue({ code: "custom", path: ["resolvedTarget"], message: "Unavailable targets must be disabled and contain no executable input." });
13297
+ context.addIssue({
13298
+ code: "custom",
13299
+ path: ["resolvedTarget"],
13300
+ message: "Unavailable targets must be disabled and contain no executable input."
13301
+ });
12020
13302
  }
12021
13303
  });
12022
13304
  var CompiledNavigationSeparatorNodeSchema = NavigationSeparatorNodeSchema.extend({
@@ -12082,11 +13364,23 @@ var controlDefinition = (ontologyId, bodySchemaRef) => DeclarativeControlOntolog
12082
13364
  });
12083
13365
  var DECLARATIVE_CONTROL_ONTOLOGY_DEFINITIONS = Object.freeze([
12084
13366
  controlDefinition("monkeys.system.page", "monkeys.system.page/v1"),
12085
- controlDefinition("monkeys.system.page-release", "monkeys.system.page-release/v1"),
13367
+ controlDefinition(
13368
+ "monkeys.system.page-release",
13369
+ "monkeys.system.page-release/v1"
13370
+ ),
12086
13371
  controlDefinition("monkeys.system.workbench", "monkeys.system.workbench/v1"),
12087
- controlDefinition("monkeys.system.workbench-release", "monkeys.system.workbench-release/v1"),
12088
- controlDefinition("monkeys.system.navigation", "monkeys.system.navigation/v1"),
12089
- controlDefinition("monkeys.system.navigation-release", "monkeys.system.navigation-release/v1")
13372
+ controlDefinition(
13373
+ "monkeys.system.workbench-release",
13374
+ "monkeys.system.workbench-release/v1"
13375
+ ),
13376
+ controlDefinition(
13377
+ "monkeys.system.navigation",
13378
+ "monkeys.system.navigation/v1"
13379
+ ),
13380
+ controlDefinition(
13381
+ "monkeys.system.navigation-release",
13382
+ "monkeys.system.navigation-release/v1"
13383
+ )
12090
13384
  ]);
12091
13385
 
12092
13386
  // src/contracts/declarative-control-http.ts
@@ -12766,9 +14060,22 @@ var ChangeImpactGraphSchema = z17.object({
12766
14060
  // src/contracts/declarative-control-http.ts
12767
14061
  var DECLARATIVE_CONTROL_API_PREFIX = "/api/declarative-control";
12768
14062
  var DECLARATIVE_CONTROL_CONTROLLER_PATH = "/declarative-control";
12769
- var DeclarativeResourceKindSchema = z18.enum(["page", "navigation", "workbench"]);
12770
- var DeclarativeAuthoringActionSchema = z18.enum(["validate", "preview", "publish", "rollback"]);
12771
- var DeclarativeLegacyMigrationKindSchema = z18.enum(["page", "page-data-assets", "workbench"]);
14063
+ var DeclarativeResourceKindSchema = z18.enum([
14064
+ "page",
14065
+ "navigation",
14066
+ "workbench"
14067
+ ]);
14068
+ var DeclarativeAuthoringActionSchema = z18.enum([
14069
+ "validate",
14070
+ "preview",
14071
+ "publish",
14072
+ "rollback"
14073
+ ]);
14074
+ var DeclarativeLegacyMigrationKindSchema = z18.enum([
14075
+ "page",
14076
+ "page-data-assets",
14077
+ "workbench"
14078
+ ]);
12772
14079
  var encodePath = (value) => encodeURIComponent(value);
12773
14080
  var declarativeControlRoutes = {
12774
14081
  validate: (kind, resourceId) => `${DECLARATIVE_CONTROL_API_PREFIX}/resources/${kind}/${encodePath(resourceId)}/validate`,
@@ -12833,10 +14140,16 @@ var DeclarativeRuntimePageTargetSchema = z18.object({
12833
14140
  });
12834
14141
  }
12835
14142
  });
12836
- var forbiddenRuntimeParameterKeys = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
14143
+ var forbiddenRuntimeParameterKeys = /* @__PURE__ */ new Set([
14144
+ "__proto__",
14145
+ "prototype",
14146
+ "constructor"
14147
+ ]);
12837
14148
  var rejectRuntimePrototypeKeys = (value, context, path = []) => {
12838
14149
  if (Array.isArray(value)) {
12839
- value.forEach((child, index) => rejectRuntimePrototypeKeys(child, context, [...path, index]));
14150
+ value.forEach(
14151
+ (child, index) => rejectRuntimePrototypeKeys(child, context, [...path, index])
14152
+ );
12840
14153
  return;
12841
14154
  }
12842
14155
  if (!value || typeof value !== "object") return;
@@ -12848,13 +14161,20 @@ var rejectRuntimePrototypeKeys = (value, context, path = []) => {
12848
14161
  message: "Prototype-mutating runtime parameter keys are forbidden."
12849
14162
  });
12850
14163
  }
12851
- rejectRuntimePrototypeKeys(value[key], context, [...path, key]);
14164
+ rejectRuntimePrototypeKeys(
14165
+ value[key],
14166
+ context,
14167
+ [...path, key]
14168
+ );
12852
14169
  }
12853
14170
  };
12854
14171
  var runtimeParameterDepth = (value, depth = 0) => {
12855
14172
  if (value === null || typeof value !== "object") return depth;
12856
14173
  const values = Array.isArray(value) ? value : Object.values(value);
12857
- return values.reduce((maximum, child) => Math.max(maximum, runtimeParameterDepth(child, depth + 1)), depth);
14174
+ return values.reduce(
14175
+ (maximum, child) => Math.max(maximum, runtimeParameterDepth(child, depth + 1)),
14176
+ depth
14177
+ );
12858
14178
  };
12859
14179
  var DeclarativeRuntimeParametersSchema = z18.any().superRefine(rejectRuntimePrototypeKeys).pipe(
12860
14180
  JsonObjectSchema.superRefine((value, context) => {
@@ -12893,9 +14213,12 @@ var DeclarativeRuntimeParametersSchema = z18.any().superRefine(rejectRuntimeProt
12893
14213
  path,
12894
14214
  message: "Runtime parameter string values cannot exceed 2048 characters."
12895
14215
  });
12896
- else if (Array.isArray(entry)) entry.forEach((child, index) => visit(child, [...path, index]));
14216
+ else if (Array.isArray(entry))
14217
+ entry.forEach((child, index) => visit(child, [...path, index]));
12897
14218
  else if (entry && typeof entry === "object")
12898
- Object.entries(entry).forEach(([key, child]) => visit(child, [...path, key]));
14219
+ Object.entries(entry).forEach(
14220
+ ([key, child]) => visit(child, [...path, key])
14221
+ );
12899
14222
  };
12900
14223
  visit(value, []);
12901
14224
  })
@@ -12930,17 +14253,36 @@ var DeclarativeRuntimeActionExecuteIntentSchema = DeclarativeRuntimePageTargetSc
12930
14253
  intent: JsonObjectSchema,
12931
14254
  recoveryOnly: z18.literal(true).optional(),
12932
14255
  pageState: DeclarativeRuntimeParametersSchema,
12933
- files: z18.record(z18.string().min(1).max(256), z18.union([
12934
- z18.object({ fileName: z18.string().min(1).max(255), content: z18.string().max(1048576) }).strict(),
12935
- z18.object({ fileName: z18.string().min(1).max(255), canonicalUri: z18.string().regex(/^file:\/\/[^\s/?#]+$/).max(1024) }).strict()
12936
- ])).superRefine((files, context) => {
12937
- 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." });
14256
+ files: z18.record(
14257
+ z18.string().min(1).max(256),
14258
+ z18.union([
14259
+ z18.object({
14260
+ fileName: z18.string().min(1).max(255),
14261
+ content: z18.string().max(1048576)
14262
+ }).strict(),
14263
+ z18.object({
14264
+ fileName: z18.string().min(1).max(255),
14265
+ canonicalUri: z18.string().regex(/^file:\/\/[^\s/?#]+$/).max(1024)
14266
+ }).strict()
14267
+ ])
14268
+ ).superRefine((files, context) => {
14269
+ if (Object.keys(files).length > 4 || Object.values(files).reduce(
14270
+ (bytes, file) => bytes + ("content" in file ? new TextEncoder().encode(file.content).byteLength : 0),
14271
+ 0
14272
+ ) > 1048576)
14273
+ context.addIssue({
14274
+ code: "custom",
14275
+ message: "Action files exceed the transient input budget."
14276
+ });
12938
14277
  }).optional(),
12939
14278
  scope: z18.unknown().superRefine((value, context) => {
12940
14279
  try {
12941
14280
  assertPageValueBudget(value);
12942
14281
  } catch {
12943
- context.addIssue({ code: "custom", message: "Action instance scope exceeds the safe JSON budget." });
14282
+ context.addIssue({
14283
+ code: "custom",
14284
+ message: "Action instance scope exceeds the safe JSON budget."
14285
+ });
12944
14286
  }
12945
14287
  }).pipe(JsonObjectSchema).optional(),
12946
14288
  routePath: DeclarativeRuntimeActionRoutePathSchema.optional(),
@@ -12965,7 +14307,12 @@ var DeclarativeRuntimeActionExecuteResultSchema = z18.object({
12965
14307
  resultSchemaRevisionRef: RevisionRefSchema,
12966
14308
  result: JsonObjectSchema,
12967
14309
  download: DeclarativeNativeDownloadSchema.optional(),
12968
- downloadError: z18.object({ code: z18.enum(["DECLARATIVE_DOWNLOAD_FORBIDDEN", "DECLARATIVE_DOWNLOAD_UNAVAILABLE"]) }).strict().optional(),
14310
+ downloadError: z18.object({
14311
+ code: z18.enum([
14312
+ "DECLARATIVE_DOWNLOAD_FORBIDDEN",
14313
+ "DECLARATIVE_DOWNLOAD_UNAVAILABLE"
14314
+ ])
14315
+ }).strict().optional(),
12969
14316
  idempotentReplay: z18.boolean(),
12970
14317
  lineageRef: StableRefSchema,
12971
14318
  refreshBindingIds: z18.array(ContractIdentifierSchema),
@@ -13140,7 +14487,16 @@ var DeclarativeCapabilityAuthoringRegistrationSchema = z18.object({
13140
14487
  allowedChildCapabilityRefs: z18.array(StableRefSchema),
13141
14488
  inputPorts: z18.array(DeclarativeCapabilityPortSchema),
13142
14489
  outputPorts: z18.array(DeclarativeCapabilityPortSchema),
13143
- allowedSideEffects: z18.array(z18.enum(["network", "storage", "navigation", "clipboard", "worker", "websocket"])),
14490
+ allowedSideEffects: z18.array(
14491
+ z18.enum([
14492
+ "network",
14493
+ "storage",
14494
+ "navigation",
14495
+ "clipboard",
14496
+ "worker",
14497
+ "websocket"
14498
+ ])
14499
+ ),
13144
14500
  ontologyRequirements: z18.array(
13145
14501
  z18.object({
13146
14502
  inputPort: ContractIdentifierSchema,
@@ -13185,7 +14541,9 @@ var DeclarativeCapabilityAuthoringRegistrationSchema = z18.object({
13185
14541
  ...value.uiSchemaRevisionRef ? [value.uiSchemaRevisionRef] : [],
13186
14542
  ...value.inputPorts.map((port) => port.schemaRevisionRef),
13187
14543
  ...value.outputPorts.map((port) => port.schemaRevisionRef),
13188
- ...value.ontologyRequirements.map((requirement) => requirement.renderModelSchemaRevisionRef)
14544
+ ...value.ontologyRequirements.map(
14545
+ (requirement) => requirement.renderModelSchemaRevisionRef
14546
+ )
13189
14547
  ];
13190
14548
  required.forEach((reference) => {
13191
14549
  const key = `${reference.ownerRepo}:${reference.id}@${reference.revision}:${reference.contentHash}`;
@@ -13297,7 +14655,9 @@ var ProductDeclarativeCapabilityRegistrationSchema = z18.object({
13297
14655
  }
13298
14656
  });
13299
14657
  const permissions = value.requiredPermissionCodes;
13300
- if (new Set(permissions).size !== permissions.length || permissions.some((permission, index) => index > 0 && permissions[index - 1].localeCompare(permission) > 0)) {
14658
+ if (new Set(permissions).size !== permissions.length || permissions.some(
14659
+ (permission, index) => index > 0 && permissions[index - 1].localeCompare(permission) > 0
14660
+ )) {
13301
14661
  context.addIssue({
13302
14662
  code: "custom",
13303
14663
  path: ["requiredPermissionCodes"],
@@ -13451,7 +14811,9 @@ var DeclarativeProductResourceRegistrationSchema = z18.object({
13451
14811
  });
13452
14812
  }
13453
14813
  if (value.resourceKind === "shell") {
13454
- const parsed = DeclarativeShellResourceDocumentSchema.safeParse(value.document);
14814
+ const parsed = DeclarativeShellResourceDocumentSchema.safeParse(
14815
+ value.document
14816
+ );
13455
14817
  if (!parsed.success)
13456
14818
  context.addIssue({
13457
14819
  code: "custom",
@@ -13459,7 +14821,9 @@ var DeclarativeProductResourceRegistrationSchema = z18.object({
13459
14821
  message: `Invalid shell declaration: ${parsed.error.message}`
13460
14822
  });
13461
14823
  if (parsed.success) {
13462
- const declaredSurfaces = new Set(parsed.data.surfaceChrome.map((entry) => entry.surface));
14824
+ const declaredSurfaces = new Set(
14825
+ parsed.data.surfaceChrome.map((entry) => entry.surface)
14826
+ );
13463
14827
  const supportedSurfaces = new Set(value.supportedSurfaces);
13464
14828
  value.supportedSurfaces.forEach((surface) => {
13465
14829
  if (!declaredSurfaces.has(surface))
@@ -13480,7 +14844,9 @@ var DeclarativeProductResourceRegistrationSchema = z18.object({
13480
14844
  }
13481
14845
  }
13482
14846
  if (value.resourceKind === "layout-policy") {
13483
- const parsed = DeclarativeLayoutPolicyResourceDocumentSchema.safeParse(value.document);
14847
+ const parsed = DeclarativeLayoutPolicyResourceDocumentSchema.safeParse(
14848
+ value.document
14849
+ );
13484
14850
  if (!parsed.success)
13485
14851
  context.addIssue({
13486
14852
  code: "custom",
@@ -13489,7 +14855,9 @@ var DeclarativeProductResourceRegistrationSchema = z18.object({
13489
14855
  });
13490
14856
  }
13491
14857
  if (value.resourceKind === "environment") {
13492
- const parsed = DeclarativeEnvironmentResourceDocumentSchema.safeParse(value.document);
14858
+ const parsed = DeclarativeEnvironmentResourceDocumentSchema.safeParse(
14859
+ value.document
14860
+ );
13493
14861
  if (!parsed.success)
13494
14862
  context.addIssue({
13495
14863
  code: "custom",
@@ -13506,7 +14874,15 @@ var DeclarativeProductResourceRegistrationSchema = z18.object({
13506
14874
  }
13507
14875
  });
13508
14876
  var DeclarativeDefaultPolicyRegistrationSchema = z18.object({
13509
- role: z18.enum(["management", "access", "layout", "performance", "observability", "tokens", "environment"]),
14877
+ role: z18.enum([
14878
+ "management",
14879
+ "access",
14880
+ "layout",
14881
+ "performance",
14882
+ "observability",
14883
+ "tokens",
14884
+ "environment"
14885
+ ]),
13510
14886
  resourceRevisionRef: RevisionRefSchema,
13511
14887
  supportedSurfaces: z18.array(ProductSurfaceSchema).min(1)
13512
14888
  }).strict();
@@ -13580,7 +14956,9 @@ var ProductDeclarativeAuthoringCatalogSchema = z18.object({
13580
14956
  applicationId: ContractIdentifierSchema,
13581
14957
  createTemplates: z18.array(DeclarativeCreateTemplateRegistrationSchema),
13582
14958
  routeSpaces: z18.array(DeclarativeRouteSpaceRegistrationSchema),
13583
- resourceRegistrations: z18.array(DeclarativeProductResourceRegistrationSchema),
14959
+ resourceRegistrations: z18.array(
14960
+ DeclarativeProductResourceRegistrationSchema
14961
+ ),
13584
14962
  defaultPolicies: z18.array(DeclarativeDefaultPolicyRegistrationSchema),
13585
14963
  domainQueryDefinitions: z18.array(DeclarativeDomainQueryDefinitionRegistrationSchema).default([]),
13586
14964
  domainCommandDefinitions: z18.array(DeclarativeDomainCommandDefinitionRegistrationSchema).default([]),
@@ -13589,7 +14967,9 @@ var ProductDeclarativeAuthoringCatalogSchema = z18.object({
13589
14967
  }).strict().superRefine((value, context) => {
13590
14968
  const duplicates = (items) => items.find((item, index) => items.indexOf(item) !== index);
13591
14969
  const duplicateTemplate = duplicates(
13592
- value.createTemplates.map((item) => `${item.templateRevisionRef.id}@${item.templateRevisionRef.revision}`)
14970
+ value.createTemplates.map(
14971
+ (item) => `${item.templateRevisionRef.id}@${item.templateRevisionRef.revision}`
14972
+ )
13593
14973
  );
13594
14974
  if (duplicateTemplate)
13595
14975
  context.addIssue({
@@ -13611,7 +14991,9 @@ var ProductDeclarativeAuthoringCatalogSchema = z18.object({
13611
14991
  message: `Duplicate legacy Page migration source ${duplicateMigrationSource}.`
13612
14992
  });
13613
14993
  const duplicateRouteSpace = duplicates(
13614
- value.routeSpaces.map((item) => `${item.routeSpaceRevisionRef.id}@${item.routeSpaceRevisionRef.revision}`)
14994
+ value.routeSpaces.map(
14995
+ (item) => `${item.routeSpaceRevisionRef.id}@${item.routeSpaceRevisionRef.revision}`
14996
+ )
13615
14997
  );
13616
14998
  if (duplicateRouteSpace)
13617
14999
  context.addIssue({
@@ -13653,7 +15035,9 @@ var ProductDeclarativeAuthoringCatalogSchema = z18.object({
13653
15035
  message: `Duplicate Domain Command definition ${duplicateCommandDefinition}.`
13654
15036
  });
13655
15037
  const duplicateSchemaDefinition = duplicates(
13656
- value.schemaDefinitions.map((item) => `${item.definitionRevisionRef.id}@${item.definitionRevisionRef.revision}`)
15038
+ value.schemaDefinitions.map(
15039
+ (item) => `${item.definitionRevisionRef.id}@${item.definitionRevisionRef.revision}`
15040
+ )
13657
15041
  );
13658
15042
  if (duplicateSchemaDefinition)
13659
15043
  context.addIssue({
@@ -13711,7 +15095,7 @@ var DeclarativeProductResourceChoiceSchema = DeclarativeAuthoringChoiceSchema.ex
13711
15095
  }).strict();
13712
15096
  var DeclarativeBindingAuthoringChoiceSchema = DeclarativeAuthoringChoiceSchema.extend({
13713
15097
  bindingTemplate: z18.object({
13714
- kind: z18.enum(["ontology", "view", "action"]),
15098
+ kind: z18.enum(["ontology", "view", "query", "action"]),
13715
15099
  requiredRevisionRefs: z18.array(RevisionRefSchema),
13716
15100
  requiredPermissionCodes: z18.array(ContractIdentifierSchema),
13717
15101
  inputTemplate: z18.record(z18.string(), z18.unknown())
@@ -13727,7 +15111,14 @@ var DeclarativeWorkbenchTargetChoiceSchema = z18.object({
13727
15111
  targetRevisionRef: RevisionRefSchema,
13728
15112
  providerRevisionRef: RevisionRefSchema,
13729
15113
  inputSchemaRevisionRef: RevisionRefSchema,
13730
- kind: z18.enum(["built-in-application", "workflow-form", "workflow", "agent", "design", "capability"]),
15114
+ kind: z18.enum([
15115
+ "built-in-application",
15116
+ "workflow-form",
15117
+ "workflow",
15118
+ "agent",
15119
+ "design",
15120
+ "capability"
15121
+ ]),
13731
15122
  name: I18nTextSchema,
13732
15123
  targetAccessPolicy: AccessPolicySchema,
13733
15124
  supportedSurfaces: z18.array(ProductSurfaceSchema).min(1),
@@ -13778,7 +15169,11 @@ var DeclarativeCreateIntentSchema = z18.object({
13778
15169
  });
13779
15170
  }
13780
15171
  });
13781
- var DeclarativeDocumentSchema = z18.union([PageSchema, NavigationSchema, WorkbenchSchema]);
15172
+ var DeclarativeDocumentSchema = z18.union([
15173
+ PageSchema,
15174
+ NavigationSchema,
15175
+ WorkbenchSchema
15176
+ ]);
13782
15177
  var DeclarativeSaveDraftIntentSchema = z18.object({
13783
15178
  document: DeclarativeDocumentSchema,
13784
15179
  expectedVersion: z18.number().int().nonnegative(),
@@ -13829,6 +15224,7 @@ var DeclarativeAuthoringChoiceKindSchema = z18.enum([
13829
15224
  "capability",
13830
15225
  "ontology",
13831
15226
  "view",
15227
+ "query",
13832
15228
  "action",
13833
15229
  "access",
13834
15230
  "published-target",
@@ -13846,15 +15242,24 @@ var authoringChoicePage = (choiceKind, itemSchema) => z18.object({
13846
15242
  message: "PageInfo returned must match choice item count."
13847
15243
  });
13848
15244
  });
13849
- var DeclarativeAuthoringChoicePageSchema = z18.discriminatedUnion("choiceKind", [
13850
- authoringChoicePage("capability", DeclarativeCapabilityAuthoringChoiceSchema),
13851
- authoringChoicePage("ontology", DeclarativeBindingAuthoringChoiceSchema),
13852
- authoringChoicePage("view", DeclarativeBindingAuthoringChoiceSchema),
13853
- authoringChoicePage("action", DeclarativeBindingAuthoringChoiceSchema),
13854
- authoringChoicePage("access", DeclarativeAuthoringChoiceSchema),
13855
- authoringChoicePage("published-target", DeclarativeAuthoringChoiceSchema),
13856
- authoringChoicePage("workbench-target", DeclarativeWorkbenchTargetChoiceSchema)
13857
- ]);
15245
+ var DeclarativeAuthoringChoicePageSchema = z18.discriminatedUnion(
15246
+ "choiceKind",
15247
+ [
15248
+ authoringChoicePage(
15249
+ "capability",
15250
+ DeclarativeCapabilityAuthoringChoiceSchema
15251
+ ),
15252
+ authoringChoicePage("ontology", DeclarativeBindingAuthoringChoiceSchema),
15253
+ authoringChoicePage("view", DeclarativeBindingAuthoringChoiceSchema),
15254
+ authoringChoicePage("action", DeclarativeBindingAuthoringChoiceSchema),
15255
+ authoringChoicePage("access", DeclarativeAuthoringChoiceSchema),
15256
+ authoringChoicePage("published-target", DeclarativeAuthoringChoiceSchema),
15257
+ authoringChoicePage(
15258
+ "workbench-target",
15259
+ DeclarativeWorkbenchTargetChoiceSchema
15260
+ )
15261
+ ]
15262
+ );
13858
15263
  var DeclarativeAuthoringResourcePageQuerySchema = z18.object({
13859
15264
  resourceKind: DeclarativeResourceKindSchema.optional(),
13860
15265
  resourceId: ContractIdentifierSchema.optional(),
@@ -13905,11 +15310,14 @@ var DeclarativeWorkbenchDocumentSummarySchema = z18.object({
13905
15310
  accessPolicy: AccessPolicySchema,
13906
15311
  managementAccess: ManagementAccessSchema
13907
15312
  }).strict();
13908
- var DeclarativeDocumentSummarySchema = z18.discriminatedUnion("resourceKind", [
13909
- DeclarativePageDocumentSummarySchema,
13910
- DeclarativeNavigationDocumentSummarySchema,
13911
- DeclarativeWorkbenchDocumentSummarySchema
13912
- ]);
15313
+ var DeclarativeDocumentSummarySchema = z18.discriminatedUnion(
15314
+ "resourceKind",
15315
+ [
15316
+ DeclarativePageDocumentSummarySchema,
15317
+ DeclarativeNavigationDocumentSummarySchema,
15318
+ DeclarativeWorkbenchDocumentSummarySchema
15319
+ ]
15320
+ );
13913
15321
  var declarativeReferenceTenantScopeKey = (scope) => JSON.stringify(scope);
13914
15322
  var DeclarativeDefinitionKindByResourceKind = {
13915
15323
  page: "page",
@@ -13948,11 +15356,21 @@ var DeclarativeAuthoringResourceSummarySchema = z18.object({
13948
15356
  }).strict().superRefine((value, context) => {
13949
15357
  const expectedDefinitionKind = DeclarativeDefinitionKindByResourceKind[value.resourceKind];
13950
15358
  const expectedReleaseKind = DeclarativeReleaseKindByResourceKind[value.resourceKind];
13951
- const expectedTenantScope = declarativeReferenceTenantScopeKey(value.tenantScope);
15359
+ const expectedTenantScope = declarativeReferenceTenantScopeKey(
15360
+ value.tenantScope
15361
+ );
13952
15362
  const seenReleaseRefs = /* @__PURE__ */ new Set();
13953
15363
  value.releasePlacements.forEach((placement, index) => {
13954
- const releasePath = ["releasePlacements", index, "releaseRevisionRef"];
13955
- const definitionPath = ["releasePlacements", index, "definitionRevisionRef"];
15364
+ const releasePath = [
15365
+ "releasePlacements",
15366
+ index,
15367
+ "releaseRevisionRef"
15368
+ ];
15369
+ const definitionPath = [
15370
+ "releasePlacements",
15371
+ index,
15372
+ "definitionRevisionRef"
15373
+ ];
13956
15374
  if (placement.releaseRevisionRef.kind !== expectedReleaseKind) {
13957
15375
  context.addIssue({
13958
15376
  code: "custom",
@@ -13960,7 +15378,9 @@ var DeclarativeAuthoringResourceSummarySchema = z18.object({
13960
15378
  message: `Release placement must reference ${expectedReleaseKind}.`
13961
15379
  });
13962
15380
  }
13963
- if (placement.releaseRevisionRef.visibility !== "tenant" || declarativeReferenceTenantScopeKey(placement.releaseRevisionRef.tenantScope) !== expectedTenantScope) {
15381
+ if (placement.releaseRevisionRef.visibility !== "tenant" || declarativeReferenceTenantScopeKey(
15382
+ placement.releaseRevisionRef.tenantScope
15383
+ ) !== expectedTenantScope) {
13964
15384
  context.addIssue({
13965
15385
  code: "custom",
13966
15386
  path: [...releasePath, "tenantScope"],
@@ -13990,7 +15410,9 @@ var DeclarativeAuthoringResourceSummarySchema = z18.object({
13990
15410
  message: "Release placement definition must reference the summary resource."
13991
15411
  });
13992
15412
  }
13993
- if (placement.definitionRevisionRef.visibility !== "tenant" || declarativeReferenceTenantScopeKey(placement.definitionRevisionRef.tenantScope) !== expectedTenantScope) {
15413
+ if (placement.definitionRevisionRef.visibility !== "tenant" || declarativeReferenceTenantScopeKey(
15414
+ placement.definitionRevisionRef.tenantScope
15415
+ ) !== expectedTenantScope) {
13994
15416
  context.addIssue({
13995
15417
  code: "custom",
13996
15418
  path: [...definitionPath, "tenantScope"],
@@ -14054,7 +15476,11 @@ var DeclarativePreviewResultSchema = z18.object({
14054
15476
  expiresAt: z18.string().datetime(),
14055
15477
  revision: z18.number().int().positive(),
14056
15478
  contentHash: Sha256Schema,
14057
- bundle: z18.union([PageRuntimeBundleSchema, NavigationRuntimeBundleSchema, WorkbenchRuntimeBundleSchema]),
15479
+ bundle: z18.union([
15480
+ PageRuntimeBundleSchema,
15481
+ NavigationRuntimeBundleSchema,
15482
+ WorkbenchRuntimeBundleSchema
15483
+ ]),
14058
15484
  etag: z18.string().trim().min(1),
14059
15485
  sourceContentHash: Sha256Schema
14060
15486
  }).strict();
@@ -14062,8 +15488,16 @@ var DeclarativePublicationItemResultSchema = z18.object({
14062
15488
  resourceKind: DeclarativeResourceKindSchema,
14063
15489
  resourceId: ContractIdentifierSchema,
14064
15490
  releaseRevisionRef: RevisionRefSchema,
14065
- release: z18.union([PageReleaseSchema, NavigationReleaseSchema, WorkbenchReleaseSchema]),
14066
- bundle: z18.union([PageRuntimeBundleSchema, NavigationRuntimeBundleSchema, WorkbenchRuntimeBundleSchema]).optional()
15491
+ release: z18.union([
15492
+ PageReleaseSchema,
15493
+ NavigationReleaseSchema,
15494
+ WorkbenchReleaseSchema
15495
+ ]),
15496
+ bundle: z18.union([
15497
+ PageRuntimeBundleSchema,
15498
+ NavigationRuntimeBundleSchema,
15499
+ WorkbenchRuntimeBundleSchema
15500
+ ]).optional()
14067
15501
  }).strict().superRefine((value, context) => {
14068
15502
  const expectedReleaseKind = {
14069
15503
  page: "page-release",
@@ -14106,7 +15540,10 @@ var DeclarativePublicationItemResultSchema = z18.object({
14106
15540
  if (value.bundle) {
14107
15541
  const bundleDefinitionRef = value.bundle.contract === "PageRuntimeBundle" ? value.bundle.pageRevisionRef : value.bundle.contract === "NavigationRuntimeBundle" ? value.bundle.navigationRevisionRef : value.bundle.workbenchRevisionRef;
14108
15542
  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;
14109
- if (value.bundle.contract !== expectedBundleContract || !sameRevision(value.bundle.releaseRevisionRef, value.releaseRevisionRef) || !sameRevision(bundleDefinitionRef, definitionRef)) {
15543
+ if (value.bundle.contract !== expectedBundleContract || !sameRevision(
15544
+ value.bundle.releaseRevisionRef,
15545
+ value.releaseRevisionRef
15546
+ ) || !sameRevision(bundleDefinitionRef, definitionRef)) {
14110
15547
  context.addIssue({
14111
15548
  code: "custom",
14112
15549
  path: ["bundle"],
@@ -14342,7 +15779,9 @@ var DeclarativeRuntimeResolvedSchema = z18.object({
14342
15779
  generation: z18.number().int().nonnegative(),
14343
15780
  contentHash: Sha256Schema
14344
15781
  }).strict().superRefine((value, context) => {
14345
- const outcomes = [value.page, value.workbench, value.redirect].filter(Boolean).length;
15782
+ const outcomes = [value.page, value.workbench, value.redirect].filter(
15783
+ Boolean
15784
+ ).length;
14346
15785
  if (outcomes !== 1)
14347
15786
  context.addIssue({
14348
15787
  code: "custom",
@@ -14397,35 +15836,44 @@ var DeclarativeRuntimeDeniedOutcomeSchema = (outcome, code) => z18.object({
14397
15836
  ...DeclarativeRuntimeSafeBaseShape,
14398
15837
  code: z18.literal(code)
14399
15838
  }).strict();
14400
- var DeclarativeRuntimeForbiddenOutcomeSchema = z18.discriminatedUnion("resourceKind", [
14401
- z18.object({
14402
- outcome: z18.literal("forbidden"),
14403
- ...DeclarativeRuntimeSafeBaseShape,
14404
- resourceKind: z18.literal("page"),
14405
- code: z18.literal("DECLARATIVE_PAGE_FORBIDDEN"),
14406
- presentation: PageRouteStatePresentationSchema.optional()
14407
- }).strict().superRefine((value, context) => {
14408
- if (value.presentation && value.presentation.surface !== value.surface) {
14409
- context.addIssue({
14410
- code: "custom",
14411
- path: ["presentation", "surface"],
14412
- message: "A forbidden Page presentation must match the resolved route surface."
14413
- });
14414
- }
14415
- }),
14416
- z18.object({
14417
- outcome: z18.literal("forbidden"),
14418
- ...DeclarativeRuntimeSafeBaseShape,
14419
- resourceKind: z18.literal("workbench"),
14420
- code: z18.literal("DECLARATIVE_WORKBENCH_FORBIDDEN")
14421
- }).strict()
14422
- ]);
15839
+ var DeclarativeRuntimeForbiddenOutcomeSchema = z18.discriminatedUnion(
15840
+ "resourceKind",
15841
+ [
15842
+ z18.object({
15843
+ outcome: z18.literal("forbidden"),
15844
+ ...DeclarativeRuntimeSafeBaseShape,
15845
+ resourceKind: z18.literal("page"),
15846
+ code: z18.literal("DECLARATIVE_PAGE_FORBIDDEN"),
15847
+ presentation: PageRouteStatePresentationSchema.optional()
15848
+ }).strict().superRefine((value, context) => {
15849
+ if (value.presentation && value.presentation.surface !== value.surface) {
15850
+ context.addIssue({
15851
+ code: "custom",
15852
+ path: ["presentation", "surface"],
15853
+ message: "A forbidden Page presentation must match the resolved route surface."
15854
+ });
15855
+ }
15856
+ }),
15857
+ z18.object({
15858
+ outcome: z18.literal("forbidden"),
15859
+ ...DeclarativeRuntimeSafeBaseShape,
15860
+ resourceKind: z18.literal("workbench"),
15861
+ code: z18.literal("DECLARATIVE_WORKBENCH_FORBIDDEN")
15862
+ }).strict()
15863
+ ]
15864
+ );
14423
15865
  var DeclarativeRuntimeResolveResultSchema = z18.union([
14424
15866
  DeclarativeRuntimeLegacyOutcomeSchema,
14425
15867
  DeclarativeRuntimeAuthorizedOutcomeSchema,
14426
15868
  DeclarativeRuntimeForbiddenOutcomeSchema,
14427
- DeclarativeRuntimeDeniedOutcomeSchema("unavailable", "DECLARATIVE_ROUTE_UNAVAILABLE"),
14428
- DeclarativeRuntimeDeniedOutcomeSchema("not-found", "DECLARATIVE_ROUTE_NOT_FOUND")
15869
+ DeclarativeRuntimeDeniedOutcomeSchema(
15870
+ "unavailable",
15871
+ "DECLARATIVE_ROUTE_UNAVAILABLE"
15872
+ ),
15873
+ DeclarativeRuntimeDeniedOutcomeSchema(
15874
+ "not-found",
15875
+ "DECLARATIVE_ROUTE_NOT_FOUND"
15876
+ )
14429
15877
  ]);
14430
15878
  var DeclarativeNavigationRuntimeBootstrapSchema = z18.object({
14431
15879
  placements: z18.array(
@@ -14491,7 +15939,9 @@ var DeclarativeNavigationRuntimeBootstrapSchema = z18.object({
14491
15939
  authDigest: Sha256Schema,
14492
15940
  etag: z18.string().trim().min(1)
14493
15941
  }).strict().superRefine((value, context) => {
14494
- const active = value.placements.filter((entry) => entry.authority === "declarative" && entry.state === "active");
15942
+ const active = value.placements.filter(
15943
+ (entry) => entry.authority === "declarative" && entry.state === "active"
15944
+ );
14495
15945
  if (active.length !== value.bundles.length || active.length !== value.releaseSlotIds.length) {
14496
15946
  context.addIssue({
14497
15947
  code: "custom",
@@ -14644,7 +16094,10 @@ var DeclarativeRuntimeRouteOwnerSchema = z18.object({
14644
16094
  surface: ProductSurfaceSchema,
14645
16095
  normalizedPath: z18.string().trim().startsWith("/").max(2048),
14646
16096
  routeParameters: DeclarativeRuntimeRouteParametersSchema,
14647
- owner: z18.discriminatedUnion("authority", [DeclarativeLegacyRouteOwnerSchema, DeclarativeReleaseRouteOwnerSchema]),
16097
+ owner: z18.discriminatedUnion("authority", [
16098
+ DeclarativeLegacyRouteOwnerSchema,
16099
+ DeclarativeReleaseRouteOwnerSchema
16100
+ ]),
14648
16101
  contentHash: Sha256Schema
14649
16102
  }).strict();
14650
16103
  var DeclarativeRouteClaimIntentSchema = RouteClaimSchema;
@@ -18211,6 +19664,7 @@ var WorkflowParameterTypeOptionsSchema = z22.object({
18211
19664
  enableBooleanSwitchMode: z22.boolean().optional(),
18212
19665
  enableClear: z22.boolean().optional(),
18213
19666
  enableExpand: z22.boolean().optional(),
19667
+ enableImageCrop: z22.boolean().optional(),
18214
19668
  enableImageMask: z22.boolean().optional(),
18215
19669
  enableImageOverlay: z22.boolean().optional(),
18216
19670
  enablePopupEditor: z22.boolean().optional(),
@@ -19145,15 +20599,21 @@ export {
19145
20599
  PAGE_STREAM_MAX_EVENT_ITEMS,
19146
20600
  PAGE_STREAM_MAX_FRAME_BYTES,
19147
20601
  PAGE_STREAM_MAX_INPUT_BYTES,
20602
+ PageActionSchema,
20603
+ PageDataSchema,
19148
20604
  PageDefinitionSchema,
20605
+ PageEntrySchema,
20606
+ PageEntryTargetSchema,
19149
20607
  PageEntryTransitionSchema,
19150
20608
  PageExpressionRootSchema,
19151
20609
  PageExpressionSchema,
19152
20610
  PageGuardProjectionSchema,
20611
+ PageInteractionSchema,
19153
20612
  PageMemberSchema,
19154
20613
  PageMigrationEquivalenceDimensionSchema,
19155
20614
  PageMigrationEquivalenceSchema,
19156
20615
  PageNavigationProjectionSchema,
20616
+ PageNodeSchema,
19157
20617
  PageOperatorSchema,
19158
20618
  PagePropertyBindingSchema,
19159
20619
  PageReleaseSchema,
@@ -19168,6 +20628,7 @@ export {
19168
20628
  PageStateActivationSchema,
19169
20629
  PageStateConditionSchema,
19170
20630
  PageStateDefinitionSchema,
20631
+ PageStateSchema,
19171
20632
  PageStreamConnectSchema,
19172
20633
  PageStreamControlResultSchema,
19173
20634
  PageStreamControlSchema,
@@ -19227,12 +20688,15 @@ export {
19227
20688
  RenderNodeStateSchema,
19228
20689
  RenderResponsiveRuleSchema,
19229
20690
  RenderScrollSchema,
20691
+ RenderStyleSchema,
20692
+ RenderStyleValueSchema,
19230
20693
  RenderSurfaceSchema,
19231
20694
  RenderTreeSchema,
19232
20695
  RequestScopeSchema,
19233
20696
  ResolvedFileSchema,
19234
20697
  ResolvedNavigationTargetSchema,
19235
20698
  ResolvedPageEntryTransitionSchema,
20699
+ ResolvedPageSchema,
19236
20700
  ResolvedThemeTokensSchema,
19237
20701
  ResolvedWorkbenchAppInstanceSchema,
19238
20702
  RevisionRefSchema,