@inf-monkeys-tech/monkeys 1.1.59 → 1.1.61

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 (87) hide show
  1. package/lib/contracts/agent-data.d.ts +53 -0
  2. package/lib/contracts/agent-data.d.ts.map +1 -1
  3. package/lib/contracts/agent-data.js +46 -1
  4. package/lib/contracts/agent-data.js.map +1 -1
  5. package/lib/contracts/declarative-control-http.d.ts +971 -188
  6. package/lib/contracts/declarative-control-http.d.ts.map +1 -1
  7. package/lib/contracts/declarative-control.d.ts +166 -48
  8. package/lib/contracts/declarative-control.d.ts.map +1 -1
  9. package/lib/contracts/declarative-control.js +74 -4
  10. package/lib/contracts/declarative-control.js.map +1 -1
  11. package/lib/contracts/declarative-document-import.d.ts +60 -45
  12. package/lib/contracts/declarative-document-import.d.ts.map +1 -1
  13. package/lib/contracts/declarative-publication-job.d.ts +200 -8
  14. package/lib/contracts/declarative-publication-job.d.ts.map +1 -1
  15. package/lib/contracts/index.d.ts +1 -0
  16. package/lib/contracts/index.d.ts.map +1 -1
  17. package/lib/contracts/index.js +1 -0
  18. package/lib/contracts/index.js.map +1 -1
  19. package/lib/contracts/menu.d.ts +12 -9
  20. package/lib/contracts/menu.d.ts.map +1 -1
  21. package/lib/contracts/page.d.ts +36 -27
  22. package/lib/contracts/page.d.ts.map +1 -1
  23. package/lib/contracts/render.d.ts +34 -5
  24. package/lib/contracts/render.d.ts.map +1 -1
  25. package/lib/contracts/render.js +11 -1
  26. package/lib/contracts/render.js.map +1 -1
  27. package/lib/contracts/semantic.d.ts +14 -11
  28. package/lib/contracts/semantic.d.ts.map +1 -1
  29. package/lib/contracts/tenant.d.ts +60 -45
  30. package/lib/contracts/tenant.d.ts.map +1 -1
  31. package/lib/contracts/unified-view.d.ts +718 -0
  32. package/lib/contracts/unified-view.d.ts.map +1 -0
  33. package/lib/contracts/unified-view.js +362 -0
  34. package/lib/contracts/unified-view.js.map +1 -0
  35. package/lib/esm/{chunk-WYIVUDQH.mjs → chunk-43N4Q3U7.mjs} +42 -42
  36. package/lib/esm/chunk-43N4Q3U7.mjs.map +1 -0
  37. package/lib/esm/{chunk-6AX5KAJM.mjs → chunk-7MUE4GTZ.mjs} +142 -27
  38. package/lib/esm/chunk-7MUE4GTZ.mjs.map +1 -0
  39. package/lib/esm/{chunk-VX54ES4K.mjs → chunk-DPHV7ES3.mjs} +220 -6
  40. package/lib/esm/chunk-DPHV7ES3.mjs.map +1 -0
  41. package/lib/esm/{chunk-J6ZVASVX.mjs → chunk-NKTRUUOP.mjs} +4206 -2762
  42. package/lib/esm/chunk-NKTRUUOP.mjs.map +1 -0
  43. package/lib/esm/contracts/index.mjs +144 -96
  44. package/lib/esm/index.mjs +224 -160
  45. package/lib/esm/index.mjs.map +1 -1
  46. package/lib/esm/runtime/index.mjs +19 -3
  47. package/lib/esm/schemas/index.mjs +110 -72
  48. package/lib/json-schema/index.json +1 -0
  49. package/lib/json-schema/overlay-node.schema.json +67 -46
  50. package/lib/json-schema/page-definition.schema.json +51 -64
  51. package/lib/json-schema/page-runtime-bundle.schema.json +151 -71
  52. package/lib/json-schema/page-runtime-descriptor.schema.json +51 -64
  53. package/lib/json-schema/page.schema.json +82 -74
  54. package/lib/json-schema/product-declaration.schema.json +17 -30
  55. package/lib/json-schema/render-node.schema.json +67 -46
  56. package/lib/json-schema/render-tree.schema.json +67 -46
  57. package/lib/json-schema/tenant-product-config.schema.json +17 -30
  58. package/lib/json-schema/tenant-runtime-config.schema.json +17 -30
  59. package/lib/json-schema/view-ontology-record.schema.json +1042 -0
  60. package/lib/runtime/declarative-control-compiler.d.ts.map +1 -1
  61. package/lib/runtime/declarative-control-compiler.js +5 -0
  62. package/lib/runtime/declarative-control-compiler.js.map +1 -1
  63. package/lib/runtime/index.d.ts +1 -0
  64. package/lib/runtime/index.d.ts.map +1 -1
  65. package/lib/runtime/index.js +1 -0
  66. package/lib/runtime/index.js.map +1 -1
  67. package/lib/runtime/native-page-composition.d.ts +3 -0
  68. package/lib/runtime/native-page-composition.d.ts.map +1 -1
  69. package/lib/runtime/runtime-definition-wire.d.ts +100 -4
  70. package/lib/runtime/runtime-definition-wire.d.ts.map +1 -1
  71. package/lib/runtime/unified-view-compiler.d.ts +63 -0
  72. package/lib/runtime/unified-view-compiler.d.ts.map +1 -0
  73. package/lib/runtime/unified-view-compiler.js +225 -0
  74. package/lib/runtime/unified-view-compiler.js.map +1 -0
  75. package/lib/schemas/index.d.ts +329 -71
  76. package/lib/schemas/index.d.ts.map +1 -1
  77. package/lib/schemas/index.js +29 -6
  78. package/lib/schemas/index.js.map +1 -1
  79. package/package.json +2 -2
  80. package/lib/esm/chunk-2TZMP3VI.mjs +0 -1080
  81. package/lib/esm/chunk-2TZMP3VI.mjs.map +0 -1
  82. package/lib/esm/chunk-6AX5KAJM.mjs.map +0 -1
  83. package/lib/esm/chunk-J6ZVASVX.mjs.map +0 -1
  84. package/lib/esm/chunk-MEIIFDVZ.mjs +0 -78
  85. package/lib/esm/chunk-MEIIFDVZ.mjs.map +0 -1
  86. package/lib/esm/chunk-VX54ES4K.mjs.map +0 -1
  87. package/lib/esm/chunk-WYIVUDQH.mjs.map +0 -1
@@ -1,1080 +0,0 @@
1
- import {
2
- ContractIdentifierSchema,
3
- ContractVersionSchema,
4
- DeclarativeDiagnosticSchema,
5
- EntityRefSchema,
6
- IsoDateTimeSchema,
7
- JsonObjectSchema,
8
- JsonValueSchema,
9
- LineageRecordSchema,
10
- NavigationSchema,
11
- PageSchema,
12
- ProductSurfaceSchema,
13
- RevisionRefSchema,
14
- Sha256Schema,
15
- TenantScopeSchema
16
- } from "./chunk-J6ZVASVX.mjs";
17
-
18
- // src/contracts/artifact.ts
19
- import { z } from "zod";
20
- var StorageLocatorSchema = z.object({
21
- provider: ContractIdentifierSchema,
22
- bucket: ContractIdentifierSchema.optional(),
23
- key: ContractIdentifierSchema,
24
- region: ContractIdentifierSchema.optional(),
25
- url: z.string().url().optional(),
26
- expiresAt: IsoDateTimeSchema.optional()
27
- }).strict();
28
- var ArtifactAccessSchema = z.object({
29
- tenantId: ContractIdentifierSchema.optional(),
30
- teamId: ContractIdentifierSchema.optional(),
31
- ownerRef: EntityRefSchema.optional(),
32
- visibility: z.enum(["private", "team", "tenant", "public"])
33
- }).strict();
34
- var ArtifactManifestSchema = z.object({
35
- contract: z.literal("ArtifactManifest"),
36
- artifactId: ContractIdentifierSchema,
37
- kind: ContractIdentifierSchema,
38
- mimeType: z.string().trim().min(1),
39
- byteSize: z.number().int().nonnegative().optional(),
40
- sha256: Sha256Schema,
41
- storage: StorageLocatorSchema,
42
- sourceRef: EntityRefSchema.optional(),
43
- runRef: EntityRefSchema,
44
- outputRef: EntityRefSchema,
45
- producer: z.object({
46
- service: ContractIdentifierSchema,
47
- version: ContractIdentifierSchema,
48
- capabilityRef: EntityRefSchema.optional()
49
- }).strict(),
50
- access: ArtifactAccessSchema,
51
- metadata: z.record(z.string(), JsonValueSchema).default({}),
52
- createdAt: IsoDateTimeSchema
53
- }).strict();
54
- var OutputRecordSchema = z.object({
55
- contract: z.literal("OutputRecord"),
56
- outputId: ContractIdentifierSchema,
57
- runRef: EntityRefSchema,
58
- outputPort: ContractIdentifierSchema,
59
- value: JsonValueSchema.optional(),
60
- artifactRefs: z.array(EntityRefSchema).default([]),
61
- schemaRef: ContractIdentifierSchema.optional(),
62
- createdAt: IsoDateTimeSchema
63
- }).strict();
64
-
65
- // src/contracts/aggregate-commit.ts
66
- import { z as z2 } from "zod";
67
- var AggregateIdentifierSchema = z2.string().trim().min(1).max(128);
68
- var AggregateRequestIdentifierSchema = z2.string().trim().min(1).max(256);
69
- var AggregateMutationsLimit = 500;
70
- var AggregateAssetSchema = z2.object({
71
- id: AggregateIdentifierSchema,
72
- name: z2.string().trim().min(1).max(500),
73
- asset_type: AggregateIdentifierSchema,
74
- primary_content: JsonObjectSchema,
75
- status: z2.string().trim().min(1).max(64).optional(),
76
- creator_user_id: AggregateIdentifierSchema.optional(),
77
- properties: JsonObjectSchema.optional(),
78
- files: z2.array(JsonObjectSchema).max(100).optional(),
79
- media: z2.string().max(4096).optional(),
80
- thumbnail: z2.string().max(4096).optional(),
81
- media_ref: JsonObjectSchema.optional(),
82
- keywords: z2.string().max(2e3).optional(),
83
- extra: JsonObjectSchema.optional(),
84
- sort: z2.number().int().nonnegative().optional()
85
- }).strict();
86
- var AggregateAssetUpsertSchema = z2.object({
87
- ontology_id: AggregateIdentifierSchema,
88
- asset: AggregateAssetSchema,
89
- tag_ids: z2.array(AggregateIdentifierSchema).max(200).optional()
90
- }).strict();
91
- var AggregateAssetDeleteSchema = z2.object({
92
- ontology_id: AggregateIdentifierSchema,
93
- asset_id: AggregateIdentifierSchema
94
- }).strict();
95
- var AggregateFeatureValueWriteSchema = z2.object({
96
- ontology_id: AggregateIdentifierSchema,
97
- asset_id: AggregateIdentifierSchema,
98
- column_id: AggregateIdentifierSchema,
99
- value_text: z2.string().max(1e6).nullable()
100
- }).strict();
101
- var AggregateFeatureRelationTargetSchema = z2.object({
102
- ontology_id: AggregateIdentifierSchema,
103
- asset_id: AggregateIdentifierSchema
104
- }).strict();
105
- var AggregateFeatureRelationReplaceSchema = z2.object({
106
- ontology_id: AggregateIdentifierSchema,
107
- asset_id: AggregateIdentifierSchema,
108
- column_id: AggregateIdentifierSchema,
109
- targets: z2.array(AggregateFeatureRelationTargetSchema).max(AggregateMutationsLimit)
110
- }).strict();
111
- var AggregateAssetRelationObjectSchema = z2.object({
112
- object_kind: z2.string().trim().min(1).max(64),
113
- object_id: z2.string().trim().min(1).max(256),
114
- properties: JsonObjectSchema.optional()
115
- }).strict();
116
- var AggregateAssetRelationReplaceSchema = z2.object({
117
- ontology_id: AggregateIdentifierSchema,
118
- asset_id: AggregateIdentifierSchema,
119
- relation_kind: z2.string().trim().min(1).max(64),
120
- objects: z2.array(AggregateAssetRelationObjectSchema).max(AggregateMutationsLimit)
121
- }).strict();
122
- var AggregateContainerMembershipWriteSchema = z2.object({
123
- ontology_id: AggregateIdentifierSchema,
124
- container_view_id: AggregateIdentifierSchema,
125
- asset_id: AggregateIdentifierSchema,
126
- present: z2.boolean()
127
- }).strict();
128
- var AggregateCommitRequestSchema = z2.object({
129
- contract: z2.literal("AggregateCommitRequest"),
130
- aggregate_id: AggregateIdentifierSchema,
131
- request_id: AggregateRequestIdentifierSchema,
132
- idempotency_key: AggregateIdentifierSchema,
133
- expected_head_commit_id: AggregateIdentifierSchema.optional(),
134
- message: z2.string().trim().max(500).optional(),
135
- assets: z2.array(AggregateAssetUpsertSchema).max(AggregateMutationsLimit).optional(),
136
- asset_deletes: z2.array(AggregateAssetDeleteSchema).max(AggregateMutationsLimit).optional(),
137
- feature_values: z2.array(AggregateFeatureValueWriteSchema).max(AggregateMutationsLimit).optional(),
138
- feature_relations: z2.array(AggregateFeatureRelationReplaceSchema).max(AggregateMutationsLimit).optional(),
139
- asset_relations: z2.array(AggregateAssetRelationReplaceSchema).max(AggregateMutationsLimit).optional(),
140
- container_memberships: z2.array(AggregateContainerMembershipWriteSchema).max(AggregateMutationsLimit).optional()
141
- }).strict().superRefine((request, context) => {
142
- const mutationCount = (request.assets?.length ?? 0) + (request.asset_deletes?.length ?? 0) + (request.feature_values?.length ?? 0) + (request.feature_relations?.length ?? 0) + (request.asset_relations?.length ?? 0) + (request.container_memberships?.length ?? 0);
143
- if (mutationCount === 0) {
144
- context.addIssue({ code: "custom", message: "at least one aggregate mutation is required" });
145
- }
146
- });
147
-
148
- // src/contracts/context.ts
149
- import { z as z3 } from "zod";
150
- var ActorRefSchema = z3.object({
151
- kind: z3.enum(["human", "agent", "service", "tenant", "public"]),
152
- id: ContractIdentifierSchema.optional(),
153
- userId: ContractIdentifierSchema.optional(),
154
- agentId: ContractIdentifierSchema.optional(),
155
- serviceId: ContractIdentifierSchema.optional()
156
- }).strict();
157
- var AuthorityScopeSchema = z3.object({
158
- resource: ContractIdentifierSchema,
159
- actions: z3.array(ContractIdentifierSchema).min(1),
160
- constraints: z3.record(z3.string(), JsonValueSchema).optional()
161
- }).strict();
162
- var RequestScopeSchema = z3.object({
163
- contract: z3.literal("RequestScope"),
164
- requestId: ContractIdentifierSchema,
165
- traceId: ContractIdentifierSchema.optional(),
166
- appId: ContractIdentifierSchema,
167
- tenantId: ContractIdentifierSchema.optional(),
168
- teamId: ContractIdentifierSchema.optional(),
169
- actor: ActorRefSchema,
170
- session: z3.object({
171
- authType: ContractIdentifierSchema,
172
- authenticated: z3.boolean(),
173
- membershipVerified: z3.boolean()
174
- }).strict(),
175
- permissionCodes: z3.array(ContractIdentifierSchema).default([]),
176
- authority: z3.array(AuthorityScopeSchema).default([]),
177
- issuedAt: IsoDateTimeSchema
178
- }).strict();
179
- var ExecutionLinkSchema = z3.object({
180
- contract: z3.literal("ExecutionLink"),
181
- requestId: ContractIdentifierSchema,
182
- traceId: ContractIdentifierSchema.optional(),
183
- correlationId: ContractIdentifierSchema.optional(),
184
- causationId: ContractIdentifierSchema.optional(),
185
- workflowRef: EntityRefSchema.optional(),
186
- runRef: EntityRefSchema,
187
- taskRef: EntityRefSchema.optional(),
188
- parentRunRef: EntityRefSchema.optional()
189
- }).strict();
190
- var CompletionHeaderSchema = z3.object({
191
- contract: z3.literal("CompletionHeader"),
192
- eventId: ContractIdentifierSchema,
193
- runtimeEventId: ContractIdentifierSchema,
194
- idempotencyKey: ContractIdentifierSchema,
195
- sequence: z3.number().int().nonnegative(),
196
- execution: ExecutionLinkSchema,
197
- producer: z3.object({
198
- service: ContractIdentifierSchema,
199
- runtime: ContractIdentifierSchema,
200
- version: ContractIdentifierSchema
201
- }).strict(),
202
- status: z3.enum(["SUCCEEDED", "FAILED", "CANCELLED", "TIMED_OUT"]),
203
- occurredAt: IsoDateTimeSchema,
204
- payloadSchemaRef: ContractIdentifierSchema.optional()
205
- }).strict();
206
- var CompletionEventSchema = z3.object({
207
- header: CompletionHeaderSchema,
208
- payload: JsonValueSchema.optional()
209
- }).strict();
210
- var AgentRuntimeEventSchema = z3.object({
211
- contract: z3.literal("AgentRuntimeEvent"),
212
- runtimeEventId: ContractIdentifierSchema,
213
- streamId: ContractIdentifierSchema,
214
- sequence: z3.number().int().nonnegative(),
215
- requestId: ContractIdentifierSchema,
216
- teamId: ContractIdentifierSchema,
217
- threadId: ContractIdentifierSchema.optional(),
218
- eventType: z3.enum(["messages:append", "messages:update", "thread:update", "tool-call:upsert", "session:event"]),
219
- payload: JsonValueSchema,
220
- occurredAt: IsoDateTimeSchema
221
- }).strict();
222
-
223
- // src/contracts/continuity.ts
224
- import { z as z4 } from "zod";
225
- var DataContinuityEnvelopeSchema = z4.object({
226
- contract: z4.literal("DataContinuityEnvelope"),
227
- tenantId: ContractIdentifierSchema,
228
- teamId: ContractIdentifierSchema,
229
- sourceRef: EntityRefSchema.optional(),
230
- bodyRef: EntityRefSchema.optional(),
231
- runRef: EntityRefSchema.optional(),
232
- outputRef: EntityRefSchema.optional(),
233
- artifactRef: EntityRefSchema.optional(),
234
- requestId: ContractIdentifierSchema,
235
- actorRef: EntityRefSchema,
236
- schemaVersion: ContractVersionSchema
237
- }).strict().refine(
238
- (value) => Boolean(value.sourceRef || value.bodyRef || value.runRef || value.outputRef || value.artifactRef),
239
- "At least one continuity ref is required."
240
- );
241
- var BodyRelationRecordSchema = z4.object({
242
- contract: z4.literal("BodyRelationRecord"),
243
- relationId: ContractIdentifierSchema,
244
- relationKind: ContractIdentifierSchema,
245
- subjectRef: EntityRefSchema,
246
- objectRef: EntityRefSchema,
247
- ownerRepo: ContractIdentifierSchema,
248
- authorityScope: z4.enum(["tenant", "team", "global"]),
249
- properties: JsonObjectSchema.default({}),
250
- createdAt: IsoDateTimeSchema,
251
- updatedAt: IsoDateTimeSchema
252
- }).strict();
253
- var ApplicationRunSchema = z4.object({
254
- contract: z4.literal("ApplicationRun"),
255
- runId: ContractIdentifierSchema,
256
- definitionRef: EntityRefSchema,
257
- runtimeLedgerRef: EntityRefSchema.optional(),
258
- requestId: ContractIdentifierSchema,
259
- actorRef: EntityRefSchema,
260
- status: z4.enum(["PENDING", "RUNNING", "COMPLETED", "FAILED", "CANCELLED", "EXPIRED"]),
261
- inputRefs: z4.array(EntityRefSchema).default([]),
262
- outputRefs: z4.array(EntityRefSchema).default([]),
263
- startedAt: IsoDateTimeSchema.optional(),
264
- completedAt: IsoDateTimeSchema.optional(),
265
- expiresAt: IsoDateTimeSchema.optional(),
266
- metadata: JsonObjectSchema.default({})
267
- }).strict().superRefine((run, context) => {
268
- if (run.definitionRef.kind !== "workflow-definition") {
269
- context.addIssue({
270
- code: "custom",
271
- path: ["definitionRef", "kind"],
272
- message: "definitionRef must reference a workflow-definition."
273
- });
274
- }
275
- if (run.runtimeLedgerRef && run.runtimeLedgerRef.kind !== "workflow-run") {
276
- context.addIssue({
277
- code: "custom",
278
- path: ["runtimeLedgerRef", "kind"],
279
- message: "runtimeLedgerRef must reference a workflow-run."
280
- });
281
- }
282
- if ((run.status === "RUNNING" || run.status === "COMPLETED" || run.status === "CANCELLED") && !run.runtimeLedgerRef) {
283
- context.addIssue({
284
- code: "custom",
285
- path: ["runtimeLedgerRef"],
286
- message: `${run.status} ApplicationRun requires runtimeLedgerRef.`
287
- });
288
- }
289
- if (run.status === "RUNNING" && !run.startedAt) {
290
- context.addIssue({
291
- code: "custom",
292
- path: ["startedAt"],
293
- message: "RUNNING ApplicationRun requires startedAt."
294
- });
295
- }
296
- if (["COMPLETED", "FAILED", "CANCELLED", "EXPIRED"].includes(run.status) && !run.completedAt) {
297
- context.addIssue({
298
- code: "custom",
299
- path: ["completedAt"],
300
- message: `Terminal ApplicationRun status ${run.status} requires completedAt.`
301
- });
302
- }
303
- });
304
- var ExpiringAccessGrantSchema = z4.object({
305
- contract: z4.literal("ExpiringAccessGrant"),
306
- grantId: ContractIdentifierSchema,
307
- subjectRef: EntityRefSchema,
308
- resourceRef: EntityRefSchema,
309
- permissions: z4.array(ContractIdentifierSchema).min(1),
310
- issuedAt: IsoDateTimeSchema,
311
- expiresAt: IsoDateTimeSchema,
312
- revokedAt: IsoDateTimeSchema.optional()
313
- }).strict().refine((value) => Date.parse(value.expiresAt) > Date.parse(value.issuedAt), "expiresAt must be after issuedAt");
314
-
315
- // src/contracts/declarative-publication-verification.ts
316
- import { z as z5 } from "zod";
317
- var DECLARATIVE_PUBLICATION_SCOPE_HEADER = "x-monkeys-declarative-scope";
318
- var DECLARATIVE_PUBLICATION_SURFACE_HEADER = "x-monkeys-declarative-surface";
319
- var DeclarativePublicationScopeSchema = z5.discriminatedUnion("kind", [
320
- z5.object({ kind: z5.literal("global") }).strict(),
321
- z5.object({
322
- kind: z5.literal("team"),
323
- teamId: ContractIdentifierSchema.refine((value) => value !== "0", "Use global scope for the reserved namespace.")
324
- }).strict()
325
- ]);
326
- var DeclarativePublicationVerificationRequestSchema = z5.object({
327
- resourceKind: z5.enum(["page", "navigation", "workbench"]),
328
- resourceId: ContractIdentifierSchema,
329
- releaseSlotId: ContractIdentifierSchema,
330
- releaseVersion: z5.number().int().positive().optional(),
331
- expectedReleaseRevisionRef: RevisionRefSchema.optional(),
332
- expectedDefinitionRevisionRef: RevisionRefSchema.optional(),
333
- idempotencyKey: z5.string().trim().min(1).max(256).optional(),
334
- audience: z5.object({
335
- teamId: ContractIdentifierSchema.optional(),
336
- path: z5.string().trim().min(1).max(4096).optional()
337
- }).strict().optional()
338
- }).strict();
339
- var DeclarativePublicationVerificationSchema = z5.object({
340
- contract: z5.literal("DeclarativePublicationVerification"),
341
- schemaVersion: z5.literal(1),
342
- resourceKind: z5.enum(["page", "navigation", "workbench"]),
343
- resourceId: ContractIdentifierSchema,
344
- scope: DeclarativePublicationScopeSchema,
345
- publication: z5.enum(["committed", "unknown"]),
346
- activation: z5.enum(["active", "superseded", "deactivated", "unavailable"]),
347
- integrity: z5.enum(["verified", "unverified", "failed"]),
348
- runtime: z5.enum(["not-requested", "verified", "context-required", "forbidden", "failed"]),
349
- retryable: z5.boolean().default(false),
350
- releaseRevisionRef: RevisionRefSchema.optional(),
351
- definitionRevisionRef: RevisionRefSchema.optional(),
352
- runtimeContentHash: z5.string().regex(/^[a-f0-9]{64}$/).optional(),
353
- requestId: z5.string().max(256).optional(),
354
- diagnostics: z5.array(DeclarativeDiagnosticSchema).max(32)
355
- }).strict().superRefine((value, context) => {
356
- if ((value.integrity === "verified" || value.runtime === "verified") && (value.publication !== "committed" || value.activation !== "active" || !value.releaseRevisionRef || !value.definitionRevisionRef)) {
357
- context.addIssue({ code: "custom", path: ["integrity"], message: "Verification requires an exact committed active Release and definition." });
358
- }
359
- if (value.runtime === "verified" && value.integrity !== "verified") {
360
- context.addIssue({ code: "custom", path: ["runtime"], message: "Audience verification requires publication integrity." });
361
- }
362
- });
363
-
364
- // src/contracts/declarative-document-import.ts
365
- import { z as z6 } from "zod";
366
- var sameScope = (left, right) => ["tenantRef", "dataSpaceRef", "teamRef"].every(
367
- (key) => left[key]?.kind === right[key]?.kind && left[key]?.id === right[key]?.id && left[key]?.ownerRepo === right[key]?.ownerRepo
368
- );
369
- var DeclarativeImportDocumentSchema = z6.union([
370
- PageSchema,
371
- NavigationSchema
372
- ]);
373
- var requestShape = {
374
- document: DeclarativeImportDocumentSchema,
375
- surface: ProductSurfaceSchema,
376
- environmentId: ContractIdentifierSchema.optional()
377
- };
378
- function supportsSurface(value) {
379
- return value.document.contract === "Page" ? value.document.surface === value.surface : value.document.supportedSurfaces.includes(value.surface);
380
- }
381
- var DeclarativeDocumentImportRequestSchema = z6.object(requestShape).strict().refine(supportsSurface, {
382
- path: ["surface"],
383
- message: "The document does not support the selected surface."
384
- });
385
- var DeclarativeDocumentImportIntentSchema = z6.object({
386
- ...requestShape,
387
- expectedVersion: z6.number().int().nonnegative(),
388
- expectedPlanHash: Sha256Schema,
389
- idempotencyKey: z6.string().trim().min(1).max(256)
390
- }).strict().refine(supportsSurface, {
391
- path: ["surface"],
392
- message: "The document does not support the selected surface."
393
- });
394
- var DeclarativeAuthoringEnvelopeSchema = z6.object({
395
- document: z6.record(z6.string(), z6.unknown()),
396
- surface: ProductSurfaceSchema.optional(),
397
- environmentId: ContractIdentifierSchema.optional()
398
- }).strict();
399
- var DeclarativeAuthoringImportIntentSchema = DeclarativeAuthoringEnvelopeSchema.extend({
400
- expectedPlanHash: Sha256Schema,
401
- expectedVersion: z6.number().int().nonnegative(),
402
- idempotencyKey: z6.string().trim().min(1).max(256)
403
- }).strict();
404
- var DeclarativeAuthoringPublishEnvelopeSchema = DeclarativeAuthoringEnvelopeSchema.extend({
405
- placement: ContractIdentifierSchema.optional(),
406
- routeClaimIndex: z6.number().int().nonnegative().optional()
407
- }).strict();
408
- var DeclarativeDocumentImportPlanSchema = z6.object({
409
- contract: z6.literal("DeclarativeDocumentImportPlan"),
410
- schemaVersion: z6.literal(1),
411
- resourceKind: z6.enum(["page", "navigation"]),
412
- resourceId: ContractIdentifierSchema,
413
- surface: ProductSurfaceSchema,
414
- sourceContentHash: Sha256Schema,
415
- environmentRevisionRef: RevisionRefSchema,
416
- document: DeclarativeImportDocumentSchema,
417
- tenantScope: TenantScopeSchema.nullable(),
418
- requiresInitialization: z6.boolean(),
419
- expectedVersion: z6.number().int().nonnegative(),
420
- currentContentHash: Sha256Schema.nullable(),
421
- changed: z6.boolean(),
422
- diagnostics: z6.array(DeclarativeDiagnosticSchema),
423
- dependencyContentHash: Sha256Schema,
424
- planHash: Sha256Schema
425
- }).strict().superRefine((value, context) => {
426
- const kind = value.document.contract === "Page" ? "page" : "navigation";
427
- const id = value.document.contract === "Page" ? value.document.pageId : value.document.navigationId;
428
- if (kind !== value.resourceKind || id !== value.resourceId || !supportsSurface(value))
429
- context.addIssue({
430
- code: "custom",
431
- path: ["document"],
432
- message: "The plan must identify its document and supported surface."
433
- });
434
- if (value.requiresInitialization !== (value.tenantScope === null))
435
- context.addIssue({
436
- code: "custom",
437
- path: ["requiresInitialization"],
438
- message: "Only an uninitialized target may omit tenantScope."
439
- });
440
- if (value.environmentRevisionRef.kind !== "environment")
441
- context.addIssue({
442
- code: "custom",
443
- path: ["environmentRevisionRef"],
444
- message: "The import plan must pin an environment revision."
445
- });
446
- if (value.tenantScope && !sameScope(value.tenantScope, value.document.tenantScope))
447
- context.addIssue({
448
- code: "custom",
449
- path: ["tenantScope"],
450
- message: "The plan and bound document must belong to the same scope."
451
- });
452
- });
453
- var DeclarativeDocumentImportResultSchema = z6.object({
454
- action: z6.literal("import"),
455
- changed: z6.boolean(),
456
- plan: DeclarativeDocumentImportPlanSchema,
457
- revisionRef: RevisionRefSchema
458
- }).strict().superRefine((value, context) => {
459
- if (value.changed !== value.plan.changed || value.revisionRef.kind !== value.plan.resourceKind || value.revisionRef.id !== value.plan.resourceId || value.revisionRef.revision !== value.plan.expectedVersion + Number(value.changed) || !value.revisionRef.tenantScope || !sameScope(value.revisionRef.tenantScope, value.plan.document.tenantScope)) {
460
- context.addIssue({
461
- code: "custom",
462
- path: ["revisionRef"],
463
- message: "The import result must identify the exact saved or unchanged draft revision."
464
- });
465
- }
466
- });
467
-
468
- // src/contracts/trend.ts
469
- import { z as z7 } from "zod";
470
- var RadarDecisionMetricsSchema = z7.object({
471
- currentSales: z7.number().finite(),
472
- forecastSales: z7.number().finite(),
473
- searchHeat: z7.number().finite(),
474
- socialHeat: z7.number().finite(),
475
- confidence: z7.number().min(0).max(1)
476
- }).strict();
477
- var TrendSourceSchema = z7.object({
478
- sourceId: ContractIdentifierSchema,
479
- provider: ContractIdentifierSchema,
480
- channel: z7.enum(["trend", "ecommerce", "social", "search", "internal"]),
481
- collectedAt: IsoDateTimeSchema,
482
- sourceUrl: z7.string().url().optional(),
483
- evidenceRefs: z7.array(EntityRefSchema).default([])
484
- }).strict();
485
- var TrendIngestRunSchema = z7.object({
486
- contract: z7.literal("TrendIngestRun"),
487
- ingestRunId: ContractIdentifierSchema,
488
- sourceId: ContractIdentifierSchema,
489
- requestId: ContractIdentifierSchema,
490
- idempotencyKey: ContractIdentifierSchema,
491
- status: z7.enum(["RUNNING", "SUCCEEDED", "FAILED", "PARTIAL"]),
492
- recordCount: z7.number().int().nonnegative(),
493
- errorCount: z7.number().int().nonnegative(),
494
- startedAt: IsoDateTimeSchema,
495
- completedAt: IsoDateTimeSchema.optional()
496
- }).strict();
497
- var TrendSourceRecordSchema = z7.object({
498
- contract: z7.literal("TrendSourceRecord"),
499
- sourceRecordId: ContractIdentifierSchema,
500
- source: TrendSourceSchema,
501
- ingestRunRef: EntityRefSchema,
502
- recordVersion: z7.number().int().positive(),
503
- contentHash: Sha256Schema,
504
- payload: JsonValueSchema,
505
- idempotencyKey: ContractIdentifierSchema,
506
- collectedAt: IsoDateTimeSchema
507
- }).strict();
508
- var HotwordBodySchema = z7.object({
509
- contract: z7.literal("HotwordBody"),
510
- hotwordId: ContractIdentifierSchema,
511
- label: z7.string().trim().min(1),
512
- normalizedLabel: z7.string().trim().min(1),
513
- categories: z7.array(ContractIdentifierSchema).default([]),
514
- sourceRefs: z7.array(TrendSourceSchema).min(1),
515
- relationRefs: z7.array(EntityRefSchema).default([]),
516
- createdAt: IsoDateTimeSchema,
517
- updatedAt: IsoDateTimeSchema
518
- }).strict();
519
- var CommerceBodyFieldsSchema = {
520
- displayName: z7.string().trim().min(1),
521
- normalizedName: z7.string().trim().min(1),
522
- categories: z7.array(ContractIdentifierSchema).default([]),
523
- sourceRefs: z7.array(EntityRefSchema).min(1),
524
- relationRefs: z7.array(EntityRefSchema).default([]),
525
- createdAt: IsoDateTimeSchema,
526
- updatedAt: IsoDateTimeSchema
527
- };
528
- var BrandBodySchema = z7.object({
529
- contract: z7.literal("BrandBody"),
530
- brandId: ContractIdentifierSchema,
531
- ...CommerceBodyFieldsSchema
532
- }).strict();
533
- var ProductBodySchema = z7.object({
534
- contract: z7.literal("ProductBody"),
535
- productId: ContractIdentifierSchema,
536
- brandRef: EntityRefSchema.optional(),
537
- ...CommerceBodyFieldsSchema
538
- }).strict();
539
- var TrendMetricSnapshotSchema = z7.object({
540
- contract: z7.literal("TrendMetricSnapshot"),
541
- snapshotId: ContractIdentifierSchema,
542
- subjectRef: EntityRefSchema,
543
- observedAt: IsoDateTimeSchema,
544
- metrics: z7.record(z7.string(), z7.number().finite()),
545
- confidence: z7.number().min(0).max(1),
546
- evidenceRefs: z7.array(EntityRefSchema).min(1)
547
- }).strict();
548
- var RadarScoreModelBodySchema = z7.object({
549
- contract: z7.literal("RadarScoreModelBody"),
550
- modelId: ContractIdentifierSchema,
551
- version: z7.number().int().positive(),
552
- weights: RadarDecisionMetricsSchema,
553
- thresholds: z7.record(z7.string(), z7.number().finite()).default({}),
554
- explanationRules: z7.record(z7.string(), z7.string().trim().min(1)).default({}),
555
- createdAt: IsoDateTimeSchema
556
- }).strict();
557
- var RadarScoreProjectionSchema = z7.object({
558
- contract: z7.literal("RadarScoreProjection"),
559
- projectionId: ContractIdentifierSchema,
560
- subjectRef: EntityRefSchema,
561
- modelRef: EntityRefSchema,
562
- totalScore: z7.number().finite(),
563
- dimensions: RadarDecisionMetricsSchema,
564
- evidenceRefs: z7.array(EntityRefSchema).min(1),
565
- freshnessAt: IsoDateTimeSchema
566
- }).strict();
567
- var RadarPanoramaNodeSchema = z7.object({
568
- ref: EntityRefSchema,
569
- label: z7.string().trim().min(1),
570
- categories: z7.array(ContractIdentifierSchema).default([]),
571
- score: z7.number().finite().optional(),
572
- freshnessAt: IsoDateTimeSchema.optional()
573
- }).strict();
574
- var RadarPanoramaEdgeSchema = z7.object({
575
- sourceRef: EntityRefSchema,
576
- targetRef: EntityRefSchema,
577
- relation: ContractIdentifierSchema,
578
- evidenceRefs: z7.array(EntityRefSchema).default([])
579
- }).strict();
580
- var RadarPanoramaSchema = z7.object({
581
- contract: z7.literal("RadarPanorama"),
582
- nodes: z7.array(RadarPanoramaNodeSchema),
583
- edges: z7.array(RadarPanoramaEdgeSchema),
584
- generatedAt: IsoDateTimeSchema
585
- }).strict();
586
- var BrandGeneticsProfileSchema = z7.object({
587
- contract: z7.literal("BrandGeneticsProfile"),
588
- brandRef: EntityRefSchema,
589
- categories: z7.array(ContractIdentifierSchema).default([]),
590
- signature: z7.record(ContractIdentifierSchema, z7.number().finite()),
591
- relatedRefs: z7.array(EntityRefSchema).default([]),
592
- evidenceRefs: z7.array(EntityRefSchema).default([]),
593
- computedAt: IsoDateTimeSchema
594
- }).strict();
595
- var RadarOpportunityMatrixPointSchema = z7.object({
596
- subjectRef: EntityRefSchema,
597
- label: z7.string().trim().min(1),
598
- x: z7.number().finite(),
599
- y: z7.number().finite(),
600
- score: z7.number().finite(),
601
- evidenceRefs: z7.array(EntityRefSchema).default([])
602
- }).strict();
603
- var RadarOpportunityMatrixSchema = z7.object({
604
- contract: z7.literal("RadarOpportunityMatrix"),
605
- xMetric: z7.enum(["currentSales", "forecastSales", "searchHeat", "socialHeat", "confidence"]),
606
- yMetric: z7.enum(["currentSales", "forecastSales", "searchHeat", "socialHeat", "confidence"]),
607
- points: z7.array(RadarOpportunityMatrixPointSchema),
608
- computedAt: IsoDateTimeSchema
609
- }).strict();
610
- var RadarQueryBodySchema = z7.object({
611
- contract: z7.literal("RadarQueryBody"),
612
- queryId: ContractIdentifierSchema,
613
- filters: z7.record(z7.string(), JsonValueSchema).default({}),
614
- sort: z7.object({
615
- field: ContractIdentifierSchema,
616
- direction: z7.enum(["asc", "desc"])
617
- }).strict(),
618
- pageSize: z7.number().int().min(1).max(200),
619
- updatedAt: IsoDateTimeSchema
620
- }).strict();
621
- var SavedRadarQuerySchema = z7.object({
622
- contract: z7.literal("SavedRadarQuery"),
623
- savedQueryId: ContractIdentifierSchema,
624
- teamId: ContractIdentifierSchema,
625
- ownerRef: EntityRefSchema,
626
- name: z7.string().trim().min(1),
627
- queryRef: EntityRefSchema,
628
- expectedVersion: z7.number().int().nonnegative(),
629
- updatedAt: IsoDateTimeSchema
630
- }).strict();
631
- var RadarSelectionSchema = z7.object({
632
- contract: z7.literal("RadarSelection"),
633
- selectionId: ContractIdentifierSchema,
634
- teamId: ContractIdentifierSchema,
635
- ownerRef: EntityRefSchema,
636
- subjectRefs: z7.array(EntityRefSchema),
637
- status: z7.enum(["stashed", "selected", "rejected", "archived"]),
638
- note: z7.string().optional(),
639
- expectedVersion: z7.number().int().nonnegative(),
640
- updatedAt: IsoDateTimeSchema
641
- }).strict();
642
- var versionedRefFields = {
643
- id: ContractIdentifierSchema,
644
- version: z7.union([z7.number().int().positive(), z7.string().trim().min(1)]).optional(),
645
- ownerRepo: ContractIdentifierSchema.optional()
646
- };
647
- var TrendRadarCollectionAssetRefSchema = z7.object({
648
- kind: z7.literal("asset"),
649
- ...versionedRefFields
650
- }).strict();
651
- var TrendRadarCollectionSelectionRefSchema = z7.object({
652
- kind: z7.literal("radar-selection"),
653
- ...versionedRefFields
654
- }).strict();
655
- var TrendRadarCollectionRunRefSchema = z7.object({
656
- kind: z7.literal("radar-analysis-run"),
657
- ...versionedRefFields
658
- }).strict();
659
- var TrendRadarCollectionSubjectRefSchema = z7.object({
660
- kind: z7.literal("hotword"),
661
- ...versionedRefFields
662
- }).strict();
663
- var TrendRadarCollectionArtifactRefSchema = z7.object({
664
- kind: z7.literal("artifact"),
665
- ...versionedRefFields
666
- }).strict();
667
- var TrendRadarCollectionRecipeEntrySchema = z7.object({
668
- subjectRef: TrendRadarCollectionSubjectRefSchema,
669
- label: z7.string().trim().min(1).max(200)
670
- }).strict();
671
- var TrendRadarCollectionRecipeSchema = z7.object({
672
- category: z7.array(TrendRadarCollectionRecipeEntrySchema),
673
- design: z7.array(TrendRadarCollectionRecipeEntrySchema),
674
- audience: z7.array(TrendRadarCollectionRecipeEntrySchema)
675
- }).strict().refine(
676
- (recipe) => recipe.category.length + recipe.design.length + recipe.audience.length > 0,
677
- "A Trend Radar collection recipe must contain at least one subject."
678
- );
679
- var TrendRadarCollectionDecisionAxisSchema = z7.object({
680
- key: ContractIdentifierSchema,
681
- label: z7.string().trim().min(1).max(200).optional(),
682
- value: z7.number().finite()
683
- }).strict();
684
- var TrendRadarCollectionDecisionProjectionSchema = z7.object({
685
- axes: z7.array(TrendRadarCollectionDecisionAxisSchema).max(32).optional(),
686
- overallScore: z7.number().finite().optional(),
687
- itemRank: z7.number().finite().optional(),
688
- sourceRefs: z7.array(EntityRefSchema).optional(),
689
- outputRefs: z7.array(EntityRefSchema).optional()
690
- }).strict().superRefine((projection, context) => {
691
- const hasProjection = Boolean(
692
- projection.axes?.length || projection.overallScore !== void 0 || projection.itemRank !== void 0 || projection.sourceRefs?.length || projection.outputRefs?.length
693
- );
694
- if (!hasProjection) {
695
- context.addIssue({
696
- code: "custom",
697
- message: "A decision projection must contain canonical decision data or references."
698
- });
699
- }
700
- const seenAxisKeys = /* @__PURE__ */ new Set();
701
- projection.axes?.forEach((axis, index) => {
702
- if (seenAxisKeys.has(axis.key)) {
703
- context.addIssue({
704
- code: "custom",
705
- path: ["axes", index, "key"],
706
- message: `Duplicate decision axis key: ${axis.key}`
707
- });
708
- }
709
- seenAxisKeys.add(axis.key);
710
- });
711
- });
712
- var TrendRadarCollectionArtifactProjectionSchema = z7.object({
713
- artifactRef: TrendRadarCollectionArtifactRefSchema,
714
- url: z7.string().url().optional(),
715
- thumbnailUrl: z7.string().url().optional(),
716
- mimeType: z7.string().trim().min(1).optional(),
717
- metadata: JsonObjectSchema.optional()
718
- }).strict();
719
- var TrendRadarCollectionProjectionWritebackSchema = z7.object({
720
- status: z7.enum(["PENDING", "APPLIED", "FAILED"]),
721
- updatedAt: IsoDateTimeSchema,
722
- error: z7.object({
723
- code: ContractIdentifierSchema,
724
- message: z7.string().trim().min(1),
725
- retryable: z7.boolean()
726
- }).strict().optional()
727
- }).strict().superRefine((writeback, context) => {
728
- if (writeback.status === "FAILED" && !writeback.error) {
729
- context.addIssue({
730
- code: "custom",
731
- path: ["error"],
732
- message: "A failed collection projection writeback must include an error."
733
- });
734
- }
735
- if (writeback.status !== "FAILED" && writeback.error) {
736
- context.addIssue({
737
- code: "custom",
738
- path: ["error"],
739
- message: "Only a failed collection projection writeback may include an error."
740
- });
741
- }
742
- });
743
- var TrendRadarCollectionItemSchema = z7.object({
744
- contract: z7.literal("TrendRadarCollectionItem"),
745
- schemaVersion: z7.literal(1),
746
- selectionRef: TrendRadarCollectionSelectionRefSchema,
747
- recipe: TrendRadarCollectionRecipeSchema,
748
- status: z7.enum(["SAVED", "QUEUED", "RUNNING", "SUCCEEDED", "FAILED", "CANCELLED", "PARTIAL"]),
749
- latestRunRef: TrendRadarCollectionRunRefSchema.optional(),
750
- decisionProjection: TrendRadarCollectionDecisionProjectionSchema.optional(),
751
- artifactProjection: TrendRadarCollectionArtifactProjectionSchema.optional(),
752
- createdAt: IsoDateTimeSchema,
753
- updatedAt: IsoDateTimeSchema,
754
- generatedAt: IsoDateTimeSchema.optional()
755
- }).strict();
756
- var RadarAnalysisRunSchema = z7.object({
757
- contract: z7.literal("RadarAnalysisRun"),
758
- runId: ContractIdentifierSchema,
759
- teamId: ContractIdentifierSchema,
760
- selectionRef: EntityRefSchema,
761
- workflowRef: EntityRefSchema,
762
- executionRef: EntityRefSchema.optional(),
763
- designProjectRef: EntityRefSchema.optional(),
764
- replayedFromRef: EntityRefSchema.optional(),
765
- collectionAssetRef: TrendRadarCollectionAssetRefSchema.optional(),
766
- collectionProjectionWriteback: TrendRadarCollectionProjectionWritebackSchema.optional(),
767
- workflowDefinitionTeamId: ContractIdentifierSchema.optional(),
768
- workflowInput: z7.record(z7.string(), JsonValueSchema).default({}),
769
- createDesignProject: z7.boolean().default(true),
770
- designProjectName: z7.string().trim().min(1).max(200).optional(),
771
- modelRef: EntityRefSchema,
772
- requestId: ContractIdentifierSchema,
773
- idempotencyKey: ContractIdentifierSchema,
774
- status: z7.enum(["QUEUED", "RUNNING", "SUCCEEDED", "FAILED", "CANCELLED", "PARTIAL"]),
775
- outputRefs: z7.array(EntityRefSchema).default([]),
776
- error: z7.object({
777
- code: ContractIdentifierSchema,
778
- message: z7.string().trim().min(1),
779
- retryable: z7.boolean()
780
- }).strict().optional(),
781
- startedAt: IsoDateTimeSchema.optional(),
782
- completedAt: IsoDateTimeSchema.optional(),
783
- createdAt: IsoDateTimeSchema
784
- }).strict();
785
- var RadarAnalysisAssetSchema = z7.object({
786
- artifactRef: EntityRefSchema,
787
- kind: ContractIdentifierSchema,
788
- mimeType: z7.string().trim().min(1).optional(),
789
- url: z7.string().url(),
790
- metadata: z7.record(z7.string(), JsonValueSchema).default({}),
791
- createdAt: IsoDateTimeSchema
792
- }).strict();
793
- var RadarAnalysisDetailSchema = z7.object({
794
- contract: z7.literal("RadarAnalysisDetail"),
795
- run: RadarAnalysisRunSchema,
796
- runVersion: z7.number().int().positive(),
797
- selection: RadarSelectionSchema,
798
- outputs: z7.array(OutputRecordSchema),
799
- assets: z7.array(RadarAnalysisAssetSchema),
800
- lineage: z7.array(LineageRecordSchema)
801
- }).strict();
802
- var RadarActionRecordSchema = z7.object({
803
- contract: z7.literal("RadarActionRecord"),
804
- actionId: ContractIdentifierSchema,
805
- teamId: ContractIdentifierSchema,
806
- actorRef: EntityRefSchema,
807
- action: z7.enum(["stash", "select", "reject", "archive", "launch", "retry", "replay", "rollback"]),
808
- targetRef: EntityRefSchema,
809
- requestId: ContractIdentifierSchema,
810
- idempotencyKey: ContractIdentifierSchema,
811
- expectedVersion: z7.number().int().nonnegative(),
812
- occurredAt: IsoDateTimeSchema
813
- }).strict();
814
- var RadarWritebackRecordSchema = z7.object({
815
- contract: z7.literal("RadarWritebackRecord"),
816
- writebackId: ContractIdentifierSchema,
817
- actionRef: EntityRefSchema,
818
- targetRef: EntityRefSchema,
819
- status: z7.enum(["PENDING", "APPLIED", "FAILED"]),
820
- resultingVersion: z7.number().int().nonnegative().optional(),
821
- error: z7.string().trim().min(1).optional(),
822
- recordedAt: IsoDateTimeSchema
823
- }).strict();
824
-
825
- // src/contracts/workflow-runtime.ts
826
- import { z as z8 } from "zod";
827
- var WorkflowCatalogEntrySchema = z8.object({
828
- contract: z8.literal("WorkflowCatalogEntry"),
829
- workflowId: ContractIdentifierSchema,
830
- teamId: ContractIdentifierSchema,
831
- creatorRef: EntityRefSchema,
832
- currentDefinitionRef: EntityRefSchema,
833
- lifecycle: z8.enum(["ACTIVE", "DELETED"]),
834
- asset: z8.object({
835
- preset: z8.boolean(),
836
- marketplacePublished: z8.boolean(),
837
- publishConfig: JsonObjectSchema.optional(),
838
- sort: z8.number().int(),
839
- forkFromRef: EntityRefSchema.optional(),
840
- notAuthorized: z8.boolean()
841
- }).strict(),
842
- createdAt: IsoDateTimeSchema,
843
- updatedAt: IsoDateTimeSchema,
844
- deletedAt: IsoDateTimeSchema.optional()
845
- }).strict().superRefine((entry, context) => {
846
- if (entry.creatorRef.kind !== "user" && entry.creatorRef.kind !== "service") {
847
- context.addIssue({
848
- code: "custom",
849
- path: ["creatorRef", "kind"],
850
- message: "creatorRef must reference a user or service."
851
- });
852
- }
853
- if (entry.currentDefinitionRef.kind !== "workflow-definition") {
854
- context.addIssue({
855
- code: "custom",
856
- path: ["currentDefinitionRef", "kind"],
857
- message: "currentDefinitionRef must reference a workflow-definition."
858
- });
859
- }
860
- if (entry.lifecycle === "DELETED" && !entry.deletedAt) {
861
- context.addIssue({
862
- code: "custom",
863
- path: ["deletedAt"],
864
- message: "Deleted workflow catalog entries require deletedAt."
865
- });
866
- }
867
- if (entry.lifecycle === "ACTIVE" && entry.deletedAt) {
868
- context.addIssue({
869
- code: "custom",
870
- path: ["deletedAt"],
871
- message: "Active workflow catalog entries cannot declare deletedAt."
872
- });
873
- }
874
- });
875
- var WorkflowPublicationSchema = z8.object({
876
- contract: z8.literal("WorkflowPublication"),
877
- publicationId: ContractIdentifierSchema,
878
- definitionRef: EntityRefSchema,
879
- runtimeDefinitionRef: EntityRefSchema,
880
- sourceHash: Sha256Schema,
881
- compiledHash: Sha256Schema,
882
- status: z8.enum(["PENDING", "PUBLISHED", "FAILED", "RETIRED"]),
883
- publisherRef: EntityRefSchema,
884
- publishedAt: IsoDateTimeSchema.optional(),
885
- failureReason: z8.string().trim().min(1).optional()
886
- }).strict().superRefine((publication, context) => {
887
- if (publication.definitionRef.kind !== "workflow-definition") {
888
- context.addIssue({
889
- code: "custom",
890
- path: ["definitionRef", "kind"],
891
- message: "definitionRef must reference a workflow-definition."
892
- });
893
- }
894
- if (publication.runtimeDefinitionRef.kind !== "conductor-workflow-definition") {
895
- context.addIssue({
896
- code: "custom",
897
- path: ["runtimeDefinitionRef", "kind"],
898
- message: "runtimeDefinitionRef must reference a conductor-workflow-definition."
899
- });
900
- }
901
- if (publication.status === "PUBLISHED" && !publication.publishedAt) {
902
- context.addIssue({
903
- code: "custom",
904
- path: ["publishedAt"],
905
- message: "Published workflow publications require publishedAt."
906
- });
907
- }
908
- if (publication.status === "FAILED" && !publication.failureReason) {
909
- context.addIssue({
910
- code: "custom",
911
- path: ["failureReason"],
912
- message: "Failed workflow publications require failureReason."
913
- });
914
- }
915
- });
916
- var WorkflowCompletionCommitSchema = z8.object({
917
- contract: z8.literal("WorkflowCompletionCommit"),
918
- commitId: ContractIdentifierSchema,
919
- run: ApplicationRunSchema,
920
- outputs: z8.array(OutputRecordSchema),
921
- artifacts: z8.array(ArtifactManifestSchema),
922
- lineage: LineageRecordSchema,
923
- completedAt: IsoDateTimeSchema
924
- }).strict().superRefine((commit, context) => {
925
- const expectedRunId = commit.run.runId;
926
- const referencesRun = (value) => value.runRef.kind === "application-run" && value.runRef.id === expectedRunId;
927
- commit.outputs.forEach((output, index) => {
928
- if (!referencesRun(output)) {
929
- context.addIssue({
930
- code: "custom",
931
- path: ["outputs", index, "runRef"],
932
- message: "Every output must reference the committed ApplicationRun."
933
- });
934
- }
935
- });
936
- commit.artifacts.forEach((artifact, index) => {
937
- if (!referencesRun(artifact)) {
938
- context.addIssue({
939
- code: "custom",
940
- path: ["artifacts", index, "runRef"],
941
- message: "Every artifact must reference the committed ApplicationRun."
942
- });
943
- }
944
- });
945
- if (commit.lineage.subjectRef.kind !== "application-run" || commit.lineage.subjectRef.id !== expectedRunId) {
946
- context.addIssue({
947
- code: "custom",
948
- path: ["lineage", "subjectRef"],
949
- message: "Completion lineage must use the committed ApplicationRun as its subject."
950
- });
951
- }
952
- const outputIds = new Set(commit.outputs.map((output) => output.outputId));
953
- commit.artifacts.forEach((artifact, index) => {
954
- if (artifact.outputRef.kind !== "workflow-output" || !outputIds.has(artifact.outputRef.id)) {
955
- context.addIssue({
956
- code: "custom",
957
- path: ["artifacts", index, "outputRef"],
958
- message: "Artifact outputRef must reference an output in the same commit."
959
- });
960
- }
961
- });
962
- });
963
- var WorkflowCompletionReceiptSchema = z8.object({
964
- contract: z8.literal("WorkflowCompletionReceipt"),
965
- commitId: ContractIdentifierSchema,
966
- runRef: EntityRefSchema,
967
- outputRefs: z8.array(EntityRefSchema),
968
- artifactRefs: z8.array(EntityRefSchema),
969
- contentHash: Sha256Schema,
970
- committedAt: IsoDateTimeSchema,
971
- idempotentReplay: z8.boolean()
972
- }).strict().superRefine((receipt, context) => {
973
- if (receipt.runRef.kind !== "application-run") {
974
- context.addIssue({
975
- code: "custom",
976
- path: ["runRef", "kind"],
977
- message: "runRef must reference an application-run."
978
- });
979
- }
980
- receipt.outputRefs.forEach((ref, index) => {
981
- if (ref.kind !== "workflow-output") {
982
- context.addIssue({
983
- code: "custom",
984
- path: ["outputRefs", index, "kind"],
985
- message: "outputRefs must reference workflow-output records."
986
- });
987
- }
988
- });
989
- receipt.artifactRefs.forEach((ref, index) => {
990
- if (ref.kind !== "artifact") {
991
- context.addIssue({
992
- code: "custom",
993
- path: ["artifactRefs", index, "kind"],
994
- message: "artifactRefs must reference artifacts."
995
- });
996
- }
997
- });
998
- });
999
-
1000
- export {
1001
- StorageLocatorSchema,
1002
- ArtifactAccessSchema,
1003
- ArtifactManifestSchema,
1004
- OutputRecordSchema,
1005
- AggregateAssetSchema,
1006
- AggregateAssetUpsertSchema,
1007
- AggregateAssetDeleteSchema,
1008
- AggregateFeatureValueWriteSchema,
1009
- AggregateFeatureRelationTargetSchema,
1010
- AggregateFeatureRelationReplaceSchema,
1011
- AggregateAssetRelationObjectSchema,
1012
- AggregateAssetRelationReplaceSchema,
1013
- AggregateContainerMembershipWriteSchema,
1014
- AggregateCommitRequestSchema,
1015
- ActorRefSchema,
1016
- AuthorityScopeSchema,
1017
- RequestScopeSchema,
1018
- ExecutionLinkSchema,
1019
- CompletionHeaderSchema,
1020
- CompletionEventSchema,
1021
- AgentRuntimeEventSchema,
1022
- DataContinuityEnvelopeSchema,
1023
- BodyRelationRecordSchema,
1024
- ApplicationRunSchema,
1025
- ExpiringAccessGrantSchema,
1026
- DECLARATIVE_PUBLICATION_SCOPE_HEADER,
1027
- DECLARATIVE_PUBLICATION_SURFACE_HEADER,
1028
- DeclarativePublicationScopeSchema,
1029
- DeclarativePublicationVerificationRequestSchema,
1030
- DeclarativePublicationVerificationSchema,
1031
- DeclarativeImportDocumentSchema,
1032
- DeclarativeDocumentImportRequestSchema,
1033
- DeclarativeDocumentImportIntentSchema,
1034
- DeclarativeAuthoringEnvelopeSchema,
1035
- DeclarativeAuthoringImportIntentSchema,
1036
- DeclarativeAuthoringPublishEnvelopeSchema,
1037
- DeclarativeDocumentImportPlanSchema,
1038
- DeclarativeDocumentImportResultSchema,
1039
- RadarDecisionMetricsSchema,
1040
- TrendSourceSchema,
1041
- TrendIngestRunSchema,
1042
- TrendSourceRecordSchema,
1043
- HotwordBodySchema,
1044
- BrandBodySchema,
1045
- ProductBodySchema,
1046
- TrendMetricSnapshotSchema,
1047
- RadarScoreModelBodySchema,
1048
- RadarScoreProjectionSchema,
1049
- RadarPanoramaNodeSchema,
1050
- RadarPanoramaEdgeSchema,
1051
- RadarPanoramaSchema,
1052
- BrandGeneticsProfileSchema,
1053
- RadarOpportunityMatrixPointSchema,
1054
- RadarOpportunityMatrixSchema,
1055
- RadarQueryBodySchema,
1056
- SavedRadarQuerySchema,
1057
- RadarSelectionSchema,
1058
- TrendRadarCollectionAssetRefSchema,
1059
- TrendRadarCollectionSelectionRefSchema,
1060
- TrendRadarCollectionRunRefSchema,
1061
- TrendRadarCollectionSubjectRefSchema,
1062
- TrendRadarCollectionArtifactRefSchema,
1063
- TrendRadarCollectionRecipeEntrySchema,
1064
- TrendRadarCollectionRecipeSchema,
1065
- TrendRadarCollectionDecisionAxisSchema,
1066
- TrendRadarCollectionDecisionProjectionSchema,
1067
- TrendRadarCollectionArtifactProjectionSchema,
1068
- TrendRadarCollectionProjectionWritebackSchema,
1069
- TrendRadarCollectionItemSchema,
1070
- RadarAnalysisRunSchema,
1071
- RadarAnalysisAssetSchema,
1072
- RadarAnalysisDetailSchema,
1073
- RadarActionRecordSchema,
1074
- RadarWritebackRecordSchema,
1075
- WorkflowCatalogEntrySchema,
1076
- WorkflowPublicationSchema,
1077
- WorkflowCompletionCommitSchema,
1078
- WorkflowCompletionReceiptSchema
1079
- };
1080
- //# sourceMappingURL=chunk-2TZMP3VI.mjs.map