@inf-monkeys-tech/monkeys 1.1.24 → 1.1.25
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.
- package/README.md +25 -0
- package/lib/contracts/declarative-control-http.d.ts +148 -0
- package/lib/contracts/declarative-control-http.d.ts.map +1 -1
- package/lib/contracts/declarative-control.d.ts +31 -0
- package/lib/contracts/declarative-control.d.ts.map +1 -1
- package/lib/contracts/declarative-control.js +6 -0
- package/lib/contracts/declarative-control.js.map +1 -1
- package/lib/contracts/declarative-document-import.d.ts +25 -0
- package/lib/contracts/declarative-document-import.d.ts.map +1 -1
- package/lib/contracts/declarative-publication-job.d.ts +16 -0
- package/lib/contracts/declarative-publication-job.d.ts.map +1 -1
- package/lib/esm/chunk-4H5MD2LH.mjs +7280 -0
- package/lib/esm/chunk-4H5MD2LH.mjs.map +1 -0
- package/lib/esm/chunk-4ZSCTEY6.mjs +1009 -0
- package/lib/esm/chunk-4ZSCTEY6.mjs.map +1 -0
- package/lib/esm/chunk-H7J4XGXK.mjs +159 -0
- package/lib/esm/chunk-H7J4XGXK.mjs.map +1 -0
- package/lib/esm/chunk-KRIKORSN.mjs +20328 -0
- package/lib/esm/chunk-KRIKORSN.mjs.map +1 -0
- package/lib/esm/chunk-X4YQITI2.mjs +205 -0
- package/lib/esm/chunk-X4YQITI2.mjs.map +1 -0
- package/lib/esm/chunk-YKM3R2KZ.mjs +78 -0
- package/lib/esm/chunk-YKM3R2KZ.mjs.map +1 -0
- package/lib/esm/contracts/index.mjs +585 -20882
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +765 -27904
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +144 -26592
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +352 -20670
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/json-schema/page-runtime-bundle.schema.json +15 -0
- package/lib/json-schema/page.schema.json +15 -0
- package/lib/runtime/declarative-control-compiler.d.ts.map +1 -1
- package/lib/runtime/declarative-control-compiler.js +2 -0
- package/lib/runtime/declarative-control-compiler.js.map +1 -1
- package/lib/runtime/index.d.ts +2 -0
- package/lib/runtime/index.d.ts.map +1 -1
- package/lib/runtime/index.js +2 -0
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/page-composition.d.ts +35 -0
- package/lib/runtime/page-composition.d.ts.map +1 -0
- package/lib/runtime/page-composition.js +107 -0
- package/lib/runtime/page-composition.js.map +1 -0
- package/lib/runtime/runtime-definition-wire.d.ts +8275 -0
- package/lib/runtime/runtime-definition-wire.d.ts.map +1 -0
- package/lib/runtime/runtime-definition-wire.js +111 -0
- package/lib/runtime/runtime-definition-wire.js.map +1 -0
- package/lib/schemas/index.d.ts +14 -0
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/theme-tokens/core.d.ts.map +1 -1
- package/lib/theme-tokens/core.js +16 -8
- package/lib/theme-tokens/core.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/contracts/artifact.ts","../../src/contracts/aggregate-commit.ts","../../src/contracts/context.ts","../../src/contracts/continuity.ts","../../src/contracts/declarative-document-import.ts","../../src/contracts/trend.ts","../../src/contracts/workflow-runtime.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n ContractIdentifierSchema,\n EntityRefSchema,\n IsoDateTimeSchema,\n JsonValueSchema,\n Sha256Schema,\n} from './common';\n\nexport const StorageLocatorSchema = z\n .object({\n provider: ContractIdentifierSchema,\n bucket: ContractIdentifierSchema.optional(),\n key: ContractIdentifierSchema,\n region: ContractIdentifierSchema.optional(),\n url: z.string().url().optional(),\n expiresAt: IsoDateTimeSchema.optional(),\n })\n .strict();\n\nexport const ArtifactAccessSchema = z\n .object({\n tenantId: ContractIdentifierSchema.optional(),\n teamId: ContractIdentifierSchema.optional(),\n ownerRef: EntityRefSchema.optional(),\n visibility: z.enum(['private', 'team', 'tenant', 'public']),\n })\n .strict();\n\nexport const ArtifactManifestSchema = z\n .object({\n contract: z.literal('ArtifactManifest'),\n artifactId: ContractIdentifierSchema,\n kind: ContractIdentifierSchema,\n mimeType: z.string().trim().min(1),\n byteSize: z.number().int().nonnegative().optional(),\n sha256: Sha256Schema,\n storage: StorageLocatorSchema,\n sourceRef: EntityRefSchema.optional(),\n runRef: EntityRefSchema,\n outputRef: EntityRefSchema,\n producer: z\n .object({\n service: ContractIdentifierSchema,\n version: ContractIdentifierSchema,\n capabilityRef: EntityRefSchema.optional(),\n })\n .strict(),\n access: ArtifactAccessSchema,\n metadata: z.record(z.string(), JsonValueSchema).default({}),\n createdAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const OutputRecordSchema = z\n .object({\n contract: z.literal('OutputRecord'),\n outputId: ContractIdentifierSchema,\n runRef: EntityRefSchema,\n outputPort: ContractIdentifierSchema,\n value: JsonValueSchema.optional(),\n artifactRefs: z.array(EntityRefSchema).default([]),\n schemaRef: ContractIdentifierSchema.optional(),\n createdAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport type StorageLocator = z.infer<typeof StorageLocatorSchema>;\nexport type ArtifactAccess = z.infer<typeof ArtifactAccessSchema>;\nexport type ArtifactManifest = z.infer<typeof ArtifactManifestSchema>;\nexport type OutputRecord = z.infer<typeof OutputRecordSchema>;\n","import { z } from 'zod';\nimport { JsonObjectSchema } from './common';\n\nconst AggregateIdentifierSchema = z.string().trim().min(1).max(128);\nconst AggregateRequestIdentifierSchema = z.string().trim().min(1).max(256);\nconst AggregateMutationsLimit = 500;\n\nexport const AggregateAssetSchema = z\n .object({\n id: AggregateIdentifierSchema,\n name: z.string().trim().min(1).max(500),\n asset_type: AggregateIdentifierSchema,\n primary_content: JsonObjectSchema,\n status: z.string().trim().min(1).max(64).optional(),\n creator_user_id: AggregateIdentifierSchema.optional(),\n properties: JsonObjectSchema.optional(),\n files: z.array(JsonObjectSchema).max(100).optional(),\n media: z.string().max(4096).optional(),\n thumbnail: z.string().max(4096).optional(),\n media_ref: JsonObjectSchema.optional(),\n keywords: z.string().max(2000).optional(),\n extra: JsonObjectSchema.optional(),\n sort: z.number().int().nonnegative().optional(),\n })\n .strict();\n\nexport const AggregateAssetUpsertSchema = z\n .object({\n ontology_id: AggregateIdentifierSchema,\n asset: AggregateAssetSchema,\n tag_ids: z.array(AggregateIdentifierSchema).max(200).optional(),\n })\n .strict();\n\nexport const AggregateAssetDeleteSchema = z\n .object({\n ontology_id: AggregateIdentifierSchema,\n asset_id: AggregateIdentifierSchema,\n })\n .strict();\n\nexport const AggregateFeatureValueWriteSchema = z\n .object({\n ontology_id: AggregateIdentifierSchema,\n asset_id: AggregateIdentifierSchema,\n column_id: AggregateIdentifierSchema,\n value_text: z.string().max(1_000_000).nullable(),\n })\n .strict();\n\nexport const AggregateFeatureRelationTargetSchema = z\n .object({\n ontology_id: AggregateIdentifierSchema,\n asset_id: AggregateIdentifierSchema,\n })\n .strict();\n\nexport const AggregateFeatureRelationReplaceSchema = z\n .object({\n ontology_id: AggregateIdentifierSchema,\n asset_id: AggregateIdentifierSchema,\n column_id: AggregateIdentifierSchema,\n targets: z.array(AggregateFeatureRelationTargetSchema).max(AggregateMutationsLimit),\n })\n .strict();\n\nexport const AggregateAssetRelationObjectSchema = z\n .object({\n object_kind: z.string().trim().min(1).max(64),\n object_id: z.string().trim().min(1).max(256),\n properties: JsonObjectSchema.optional(),\n })\n .strict();\n\nexport const AggregateAssetRelationReplaceSchema = z\n .object({\n ontology_id: AggregateIdentifierSchema,\n asset_id: AggregateIdentifierSchema,\n relation_kind: z.string().trim().min(1).max(64),\n objects: z.array(AggregateAssetRelationObjectSchema).max(AggregateMutationsLimit),\n })\n .strict();\n\nexport const AggregateContainerMembershipWriteSchema = z\n .object({\n ontology_id: AggregateIdentifierSchema,\n container_view_id: AggregateIdentifierSchema,\n asset_id: AggregateIdentifierSchema,\n present: z.boolean(),\n })\n .strict();\n\nexport const AggregateCommitRequestSchema = z\n .object({\n contract: z.literal('AggregateCommitRequest'),\n aggregate_id: AggregateIdentifierSchema,\n request_id: AggregateRequestIdentifierSchema,\n idempotency_key: AggregateIdentifierSchema,\n expected_head_commit_id: AggregateIdentifierSchema.optional(),\n message: z.string().trim().max(500).optional(),\n assets: z.array(AggregateAssetUpsertSchema).max(AggregateMutationsLimit).optional(),\n asset_deletes: z.array(AggregateAssetDeleteSchema).max(AggregateMutationsLimit).optional(),\n feature_values: z.array(AggregateFeatureValueWriteSchema).max(AggregateMutationsLimit).optional(),\n feature_relations: z.array(AggregateFeatureRelationReplaceSchema).max(AggregateMutationsLimit).optional(),\n asset_relations: z.array(AggregateAssetRelationReplaceSchema).max(AggregateMutationsLimit).optional(),\n container_memberships: z.array(AggregateContainerMembershipWriteSchema).max(AggregateMutationsLimit).optional(),\n })\n .strict()\n .superRefine((request, context) => {\n const mutationCount =\n (request.assets?.length ?? 0) +\n (request.asset_deletes?.length ?? 0) +\n (request.feature_values?.length ?? 0) +\n (request.feature_relations?.length ?? 0) +\n (request.asset_relations?.length ?? 0) +\n (request.container_memberships?.length ?? 0);\n if (mutationCount === 0) {\n context.addIssue({ code: 'custom', message: 'at least one aggregate mutation is required' });\n }\n });\n\nexport type AggregateAsset = z.infer<typeof AggregateAssetSchema>;\nexport type AggregateAssetUpsert = z.infer<typeof AggregateAssetUpsertSchema>;\nexport type AggregateAssetDelete = z.infer<typeof AggregateAssetDeleteSchema>;\nexport type AggregateFeatureValueWrite = z.infer<typeof AggregateFeatureValueWriteSchema>;\nexport type AggregateFeatureRelationTarget = z.infer<typeof AggregateFeatureRelationTargetSchema>;\nexport type AggregateFeatureRelationReplace = z.infer<typeof AggregateFeatureRelationReplaceSchema>;\nexport type AggregateAssetRelationObject = z.infer<typeof AggregateAssetRelationObjectSchema>;\nexport type AggregateAssetRelationReplace = z.infer<typeof AggregateAssetRelationReplaceSchema>;\nexport type AggregateContainerMembershipWrite = z.infer<typeof AggregateContainerMembershipWriteSchema>;\nexport type AggregateCommitRequest = z.infer<typeof AggregateCommitRequestSchema>;\n","import { z } from 'zod';\nimport {\n ContractIdentifierSchema,\n EntityRefSchema,\n IsoDateTimeSchema,\n JsonValueSchema,\n} from './common';\n\nexport const ActorRefSchema = z\n .object({\n kind: z.enum(['human', 'agent', 'service', 'tenant', 'public']),\n id: ContractIdentifierSchema.optional(),\n userId: ContractIdentifierSchema.optional(),\n agentId: ContractIdentifierSchema.optional(),\n serviceId: ContractIdentifierSchema.optional(),\n })\n .strict();\n\nexport const AuthorityScopeSchema = z\n .object({\n resource: ContractIdentifierSchema,\n actions: z.array(ContractIdentifierSchema).min(1),\n constraints: z.record(z.string(), JsonValueSchema).optional(),\n })\n .strict();\n\nexport const RequestScopeSchema = z\n .object({\n contract: z.literal('RequestScope'),\n requestId: ContractIdentifierSchema,\n traceId: ContractIdentifierSchema.optional(),\n appId: ContractIdentifierSchema,\n tenantId: ContractIdentifierSchema.optional(),\n teamId: ContractIdentifierSchema.optional(),\n actor: ActorRefSchema,\n session: z\n .object({\n authType: ContractIdentifierSchema,\n authenticated: z.boolean(),\n membershipVerified: z.boolean(),\n })\n .strict(),\n permissionCodes: z.array(ContractIdentifierSchema).default([]),\n authority: z.array(AuthorityScopeSchema).default([]),\n issuedAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const ExecutionLinkSchema = z\n .object({\n contract: z.literal('ExecutionLink'),\n requestId: ContractIdentifierSchema,\n traceId: ContractIdentifierSchema.optional(),\n correlationId: ContractIdentifierSchema.optional(),\n causationId: ContractIdentifierSchema.optional(),\n workflowRef: EntityRefSchema.optional(),\n runRef: EntityRefSchema,\n taskRef: EntityRefSchema.optional(),\n parentRunRef: EntityRefSchema.optional(),\n })\n .strict();\n\nexport const CompletionHeaderSchema = z\n .object({\n contract: z.literal('CompletionHeader'),\n eventId: ContractIdentifierSchema,\n runtimeEventId: ContractIdentifierSchema,\n idempotencyKey: ContractIdentifierSchema,\n sequence: z.number().int().nonnegative(),\n execution: ExecutionLinkSchema,\n producer: z\n .object({\n service: ContractIdentifierSchema,\n runtime: ContractIdentifierSchema,\n version: ContractIdentifierSchema,\n })\n .strict(),\n status: z.enum(['SUCCEEDED', 'FAILED', 'CANCELLED', 'TIMED_OUT']),\n occurredAt: IsoDateTimeSchema,\n payloadSchemaRef: ContractIdentifierSchema.optional(),\n })\n .strict();\n\nexport const CompletionEventSchema = z\n .object({\n header: CompletionHeaderSchema,\n payload: JsonValueSchema.optional(),\n })\n .strict();\n\nexport const AgentRuntimeEventSchema = z\n .object({\n contract: z.literal('AgentRuntimeEvent'),\n runtimeEventId: ContractIdentifierSchema,\n streamId: ContractIdentifierSchema,\n sequence: z.number().int().nonnegative(),\n requestId: ContractIdentifierSchema,\n teamId: ContractIdentifierSchema,\n threadId: ContractIdentifierSchema.optional(),\n eventType: z.enum(['messages:append', 'messages:update', 'thread:update', 'tool-call:upsert', 'session:event']),\n payload: JsonValueSchema,\n occurredAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport type ActorRef = z.infer<typeof ActorRefSchema>;\nexport type AuthorityScope = z.infer<typeof AuthorityScopeSchema>;\nexport type RequestScope = z.infer<typeof RequestScopeSchema>;\nexport type ExecutionLink = z.infer<typeof ExecutionLinkSchema>;\nexport type CompletionHeader = z.infer<typeof CompletionHeaderSchema>;\nexport type CompletionEvent = z.infer<typeof CompletionEventSchema>;\nexport type AgentRuntimeEvent = z.infer<typeof AgentRuntimeEventSchema>;\n","import { z } from 'zod';\nimport {\n ContractIdentifierSchema,\n ContractVersionSchema,\n EntityRefSchema,\n IsoDateTimeSchema,\n JsonObjectSchema,\n} from './common';\n\nexport const DataContinuityEnvelopeSchema = z\n .object({\n contract: z.literal('DataContinuityEnvelope'),\n tenantId: ContractIdentifierSchema,\n teamId: ContractIdentifierSchema,\n sourceRef: EntityRefSchema.optional(),\n bodyRef: EntityRefSchema.optional(),\n runRef: EntityRefSchema.optional(),\n outputRef: EntityRefSchema.optional(),\n artifactRef: EntityRefSchema.optional(),\n requestId: ContractIdentifierSchema,\n actorRef: EntityRefSchema,\n schemaVersion: ContractVersionSchema,\n })\n .strict()\n .refine(\n value => Boolean(value.sourceRef || value.bodyRef || value.runRef || value.outputRef || value.artifactRef),\n 'At least one continuity ref is required.',\n );\n\nexport const BodyRelationRecordSchema = z\n .object({\n contract: z.literal('BodyRelationRecord'),\n relationId: ContractIdentifierSchema,\n relationKind: ContractIdentifierSchema,\n subjectRef: EntityRefSchema,\n objectRef: EntityRefSchema,\n ownerRepo: ContractIdentifierSchema,\n authorityScope: z.enum(['tenant', 'team', 'global']),\n properties: JsonObjectSchema.default({}),\n createdAt: IsoDateTimeSchema,\n updatedAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const ApplicationRunSchema = z\n .object({\n contract: z.literal('ApplicationRun'),\n runId: ContractIdentifierSchema,\n definitionRef: EntityRefSchema,\n runtimeLedgerRef: EntityRefSchema.optional(),\n requestId: ContractIdentifierSchema,\n actorRef: EntityRefSchema,\n status: z.enum(['PENDING', 'RUNNING', 'COMPLETED', 'FAILED', 'CANCELLED', 'EXPIRED']),\n inputRefs: z.array(EntityRefSchema).default([]),\n outputRefs: z.array(EntityRefSchema).default([]),\n startedAt: IsoDateTimeSchema.optional(),\n completedAt: IsoDateTimeSchema.optional(),\n expiresAt: IsoDateTimeSchema.optional(),\n metadata: JsonObjectSchema.default({}),\n })\n .strict()\n .superRefine((run, context) => {\n if (run.definitionRef.kind !== 'workflow-definition') {\n context.addIssue({\n code: 'custom',\n path: ['definitionRef', 'kind'],\n message: 'definitionRef must reference a workflow-definition.',\n });\n }\n if (run.runtimeLedgerRef && run.runtimeLedgerRef.kind !== 'workflow-run') {\n context.addIssue({\n code: 'custom',\n path: ['runtimeLedgerRef', 'kind'],\n message: 'runtimeLedgerRef must reference a workflow-run.',\n });\n }\n if ((run.status === 'RUNNING' || run.status === 'COMPLETED' || run.status === 'CANCELLED') && !run.runtimeLedgerRef) {\n context.addIssue({\n code: 'custom',\n path: ['runtimeLedgerRef'],\n message: `${run.status} ApplicationRun requires runtimeLedgerRef.`,\n });\n }\n if (run.status === 'RUNNING' && !run.startedAt) {\n context.addIssue({\n code: 'custom',\n path: ['startedAt'],\n message: 'RUNNING ApplicationRun requires startedAt.',\n });\n }\n if (['COMPLETED', 'FAILED', 'CANCELLED', 'EXPIRED'].includes(run.status) && !run.completedAt) {\n context.addIssue({\n code: 'custom',\n path: ['completedAt'],\n message: `Terminal ApplicationRun status ${run.status} requires completedAt.`,\n });\n }\n });\n\nexport const ExpiringAccessGrantSchema = z\n .object({\n contract: z.literal('ExpiringAccessGrant'),\n grantId: ContractIdentifierSchema,\n subjectRef: EntityRefSchema,\n resourceRef: EntityRefSchema,\n permissions: z.array(ContractIdentifierSchema).min(1),\n issuedAt: IsoDateTimeSchema,\n expiresAt: IsoDateTimeSchema,\n revokedAt: IsoDateTimeSchema.optional(),\n })\n .strict()\n .refine(value => Date.parse(value.expiresAt) > Date.parse(value.issuedAt), 'expiresAt must be after issuedAt');\n\nexport type DataContinuityEnvelope = z.infer<typeof DataContinuityEnvelopeSchema>;\nexport type BodyRelationRecord = z.infer<typeof BodyRelationRecordSchema>;\nexport type ApplicationRun = z.infer<typeof ApplicationRunSchema>;\nexport type ExpiringAccessGrant = z.infer<typeof ExpiringAccessGrantSchema>;\n","import { z } from \"zod\";\nimport { ContractIdentifierSchema, Sha256Schema } from \"./common\";\nimport { DeclarativeDiagnosticSchema } from \"./declarative-diagnostic\";\nimport {\n NavigationSchema,\n PageSchema,\n ProductSurfaceSchema,\n RevisionRefSchema,\n TenantScopeSchema,\n} from \"./declarative-control\";\n\nconst sameScope = (\n left: z.infer<typeof TenantScopeSchema>,\n right: z.infer<typeof TenantScopeSchema>,\n): boolean =>\n ([\"tenantRef\", \"dataSpaceRef\", \"teamRef\"] as const).every(\n (key) =>\n left[key]?.kind === right[key]?.kind &&\n left[key]?.id === right[key]?.id &&\n left[key]?.ownerRepo === right[key]?.ownerRepo,\n );\n\nexport const DeclarativeImportDocumentSchema = z.union([\n PageSchema,\n NavigationSchema,\n]);\n\nconst requestShape = {\n document: DeclarativeImportDocumentSchema,\n surface: ProductSurfaceSchema,\n environmentId: ContractIdentifierSchema.optional(),\n};\n\nfunction supportsSurface(value: {\n document: z.infer<typeof DeclarativeImportDocumentSchema>;\n surface: \"kernel\" | \"studio\";\n}): boolean {\n return value.document.contract === \"Page\"\n ? value.document.surface === value.surface\n : value.document.supportedSurfaces.includes(value.surface);\n}\n\nexport const DeclarativeDocumentImportRequestSchema = z\n .object(requestShape)\n .strict()\n .refine(supportsSurface, {\n path: [\"surface\"],\n message: \"The document does not support the selected surface.\",\n });\n\nexport const DeclarativeDocumentImportIntentSchema = z\n .object({\n ...requestShape,\n expectedVersion: z.number().int().nonnegative(),\n expectedPlanHash: Sha256Schema,\n idempotencyKey: z.string().trim().min(1).max(256),\n })\n .strict()\n .refine(supportsSurface, {\n path: [\"surface\"],\n message: \"The document does not support the selected surface.\",\n });\n\nexport const DeclarativeDocumentImportPlanSchema = z\n .object({\n contract: z.literal(\"DeclarativeDocumentImportPlan\"),\n schemaVersion: z.literal(1),\n resourceKind: z.enum([\"page\", \"navigation\"]),\n resourceId: ContractIdentifierSchema,\n surface: ProductSurfaceSchema,\n sourceContentHash: Sha256Schema,\n environmentRevisionRef: RevisionRefSchema,\n document: DeclarativeImportDocumentSchema,\n tenantScope: TenantScopeSchema.nullable(),\n requiresInitialization: z.boolean(),\n expectedVersion: z.number().int().nonnegative(),\n currentContentHash: Sha256Schema.nullable(),\n changed: z.boolean(),\n diagnostics: z.array(DeclarativeDiagnosticSchema),\n dependencyContentHash: Sha256Schema,\n planHash: Sha256Schema,\n })\n .strict()\n .superRefine((value, context) => {\n const kind = value.document.contract === \"Page\" ? \"page\" : \"navigation\";\n const id =\n value.document.contract === \"Page\"\n ? value.document.pageId\n : value.document.navigationId;\n if (\n kind !== value.resourceKind ||\n id !== value.resourceId ||\n !supportsSurface(value)\n )\n context.addIssue({\n code: \"custom\",\n path: [\"document\"],\n message: \"The plan must identify its document and supported surface.\",\n });\n if (value.requiresInitialization !== (value.tenantScope === null))\n context.addIssue({\n code: \"custom\",\n path: [\"requiresInitialization\"],\n message: \"Only an uninitialized target may omit tenantScope.\",\n });\n if (value.environmentRevisionRef.kind !== \"environment\")\n context.addIssue({\n code: \"custom\",\n path: [\"environmentRevisionRef\"],\n message: \"The import plan must pin an environment revision.\",\n });\n if (\n value.tenantScope &&\n !sameScope(value.tenantScope, value.document.tenantScope)\n )\n context.addIssue({\n code: \"custom\",\n path: [\"tenantScope\"],\n message: \"The plan and bound document must belong to the same scope.\",\n });\n });\n\nexport const DeclarativeDocumentImportResultSchema = z\n .object({\n action: z.literal(\"import\"),\n changed: z.boolean(),\n plan: DeclarativeDocumentImportPlanSchema,\n revisionRef: RevisionRefSchema,\n })\n .strict()\n .superRefine((value, context) => {\n if (\n value.changed !== value.plan.changed ||\n value.revisionRef.kind !== value.plan.resourceKind ||\n value.revisionRef.id !== value.plan.resourceId ||\n value.revisionRef.revision !==\n value.plan.expectedVersion + Number(value.changed) ||\n !value.revisionRef.tenantScope ||\n !sameScope(value.revisionRef.tenantScope, value.plan.document.tenantScope)\n ) {\n context.addIssue({\n code: \"custom\",\n path: [\"revisionRef\"],\n message:\n \"The import result must identify the exact saved or unchanged draft revision.\",\n });\n }\n });\n\nexport type DeclarativeImportDocument = z.infer<\n typeof DeclarativeImportDocumentSchema\n>;\nexport type DeclarativeDocumentImportRequest = z.infer<\n typeof DeclarativeDocumentImportRequestSchema\n>;\nexport type DeclarativeDocumentImportIntent = z.infer<\n typeof DeclarativeDocumentImportIntentSchema\n>;\nexport type DeclarativeDocumentImportPlan = z.infer<\n typeof DeclarativeDocumentImportPlanSchema\n>;\nexport type DeclarativeDocumentImportResult = z.infer<\n typeof DeclarativeDocumentImportResultSchema\n>;\n","import { z } from 'zod';\nimport {\n ContractIdentifierSchema,\n EntityRefSchema,\n IsoDateTimeSchema,\n JsonObjectSchema,\n JsonValueSchema,\n Sha256Schema,\n} from './common';\nimport { LineageRecordSchema } from './data';\nimport { OutputRecordSchema } from './artifact';\n\nexport const RadarDecisionMetricsSchema = z\n .object({\n currentSales: z.number().finite(),\n forecastSales: z.number().finite(),\n searchHeat: z.number().finite(),\n socialHeat: z.number().finite(),\n confidence: z.number().min(0).max(1),\n })\n .strict();\n\nexport const TrendSourceSchema = z\n .object({\n sourceId: ContractIdentifierSchema,\n provider: ContractIdentifierSchema,\n channel: z.enum(['trend', 'ecommerce', 'social', 'search', 'internal']),\n collectedAt: IsoDateTimeSchema,\n sourceUrl: z.string().url().optional(),\n evidenceRefs: z.array(EntityRefSchema).default([]),\n })\n .strict();\n\nexport const TrendIngestRunSchema = z\n .object({\n contract: z.literal('TrendIngestRun'),\n ingestRunId: ContractIdentifierSchema,\n sourceId: ContractIdentifierSchema,\n requestId: ContractIdentifierSchema,\n idempotencyKey: ContractIdentifierSchema,\n status: z.enum(['RUNNING', 'SUCCEEDED', 'FAILED', 'PARTIAL']),\n recordCount: z.number().int().nonnegative(),\n errorCount: z.number().int().nonnegative(),\n startedAt: IsoDateTimeSchema,\n completedAt: IsoDateTimeSchema.optional(),\n })\n .strict();\n\nexport const TrendSourceRecordSchema = z\n .object({\n contract: z.literal('TrendSourceRecord'),\n sourceRecordId: ContractIdentifierSchema,\n source: TrendSourceSchema,\n ingestRunRef: EntityRefSchema,\n recordVersion: z.number().int().positive(),\n contentHash: Sha256Schema,\n payload: JsonValueSchema,\n idempotencyKey: ContractIdentifierSchema,\n collectedAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const HotwordBodySchema = z\n .object({\n contract: z.literal('HotwordBody'),\n hotwordId: ContractIdentifierSchema,\n label: z.string().trim().min(1),\n normalizedLabel: z.string().trim().min(1),\n categories: z.array(ContractIdentifierSchema).default([]),\n sourceRefs: z.array(TrendSourceSchema).min(1),\n relationRefs: z.array(EntityRefSchema).default([]),\n createdAt: IsoDateTimeSchema,\n updatedAt: IsoDateTimeSchema,\n })\n .strict();\n\nconst CommerceBodyFieldsSchema = {\n displayName: z.string().trim().min(1),\n normalizedName: z.string().trim().min(1),\n categories: z.array(ContractIdentifierSchema).default([]),\n sourceRefs: z.array(EntityRefSchema).min(1),\n relationRefs: z.array(EntityRefSchema).default([]),\n createdAt: IsoDateTimeSchema,\n updatedAt: IsoDateTimeSchema,\n};\n\nexport const BrandBodySchema = z\n .object({\n contract: z.literal('BrandBody'),\n brandId: ContractIdentifierSchema,\n ...CommerceBodyFieldsSchema,\n })\n .strict();\n\nexport const ProductBodySchema = z\n .object({\n contract: z.literal('ProductBody'),\n productId: ContractIdentifierSchema,\n brandRef: EntityRefSchema.optional(),\n ...CommerceBodyFieldsSchema,\n })\n .strict();\n\nexport const TrendMetricSnapshotSchema = z\n .object({\n contract: z.literal('TrendMetricSnapshot'),\n snapshotId: ContractIdentifierSchema,\n subjectRef: EntityRefSchema,\n observedAt: IsoDateTimeSchema,\n metrics: z.record(z.string(), z.number().finite()),\n confidence: z.number().min(0).max(1),\n evidenceRefs: z.array(EntityRefSchema).min(1),\n })\n .strict();\n\nexport const RadarScoreModelBodySchema = z\n .object({\n contract: z.literal('RadarScoreModelBody'),\n modelId: ContractIdentifierSchema,\n version: z.number().int().positive(),\n weights: RadarDecisionMetricsSchema,\n thresholds: z.record(z.string(), z.number().finite()).default({}),\n explanationRules: z.record(z.string(), z.string().trim().min(1)).default({}),\n createdAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const RadarScoreProjectionSchema = z\n .object({\n contract: z.literal('RadarScoreProjection'),\n projectionId: ContractIdentifierSchema,\n subjectRef: EntityRefSchema,\n modelRef: EntityRefSchema,\n totalScore: z.number().finite(),\n dimensions: RadarDecisionMetricsSchema,\n evidenceRefs: z.array(EntityRefSchema).min(1),\n freshnessAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const RadarPanoramaNodeSchema = z\n .object({\n ref: EntityRefSchema,\n label: z.string().trim().min(1),\n categories: z.array(ContractIdentifierSchema).default([]),\n score: z.number().finite().optional(),\n freshnessAt: IsoDateTimeSchema.optional(),\n })\n .strict();\n\nexport const RadarPanoramaEdgeSchema = z\n .object({\n sourceRef: EntityRefSchema,\n targetRef: EntityRefSchema,\n relation: ContractIdentifierSchema,\n evidenceRefs: z.array(EntityRefSchema).default([]),\n })\n .strict();\n\nexport const RadarPanoramaSchema = z\n .object({\n contract: z.literal('RadarPanorama'),\n nodes: z.array(RadarPanoramaNodeSchema),\n edges: z.array(RadarPanoramaEdgeSchema),\n generatedAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const BrandGeneticsProfileSchema = z\n .object({\n contract: z.literal('BrandGeneticsProfile'),\n brandRef: EntityRefSchema,\n categories: z.array(ContractIdentifierSchema).default([]),\n signature: z.record(ContractIdentifierSchema, z.number().finite()),\n relatedRefs: z.array(EntityRefSchema).default([]),\n evidenceRefs: z.array(EntityRefSchema).default([]),\n computedAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const RadarOpportunityMatrixPointSchema = z\n .object({\n subjectRef: EntityRefSchema,\n label: z.string().trim().min(1),\n x: z.number().finite(),\n y: z.number().finite(),\n score: z.number().finite(),\n evidenceRefs: z.array(EntityRefSchema).default([]),\n })\n .strict();\n\nexport const RadarOpportunityMatrixSchema = z\n .object({\n contract: z.literal('RadarOpportunityMatrix'),\n xMetric: z.enum(['currentSales', 'forecastSales', 'searchHeat', 'socialHeat', 'confidence']),\n yMetric: z.enum(['currentSales', 'forecastSales', 'searchHeat', 'socialHeat', 'confidence']),\n points: z.array(RadarOpportunityMatrixPointSchema),\n computedAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const RadarQueryBodySchema = z\n .object({\n contract: z.literal('RadarQueryBody'),\n queryId: ContractIdentifierSchema,\n filters: z.record(z.string(), JsonValueSchema).default({}),\n sort: z\n .object({\n field: ContractIdentifierSchema,\n direction: z.enum(['asc', 'desc']),\n })\n .strict(),\n pageSize: z.number().int().min(1).max(200),\n updatedAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const SavedRadarQuerySchema = z\n .object({\n contract: z.literal('SavedRadarQuery'),\n savedQueryId: ContractIdentifierSchema,\n teamId: ContractIdentifierSchema,\n ownerRef: EntityRefSchema,\n name: z.string().trim().min(1),\n queryRef: EntityRefSchema,\n expectedVersion: z.number().int().nonnegative(),\n updatedAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const RadarSelectionSchema = z\n .object({\n contract: z.literal('RadarSelection'),\n selectionId: ContractIdentifierSchema,\n teamId: ContractIdentifierSchema,\n ownerRef: EntityRefSchema,\n subjectRefs: z.array(EntityRefSchema),\n status: z.enum(['stashed', 'selected', 'rejected', 'archived']),\n note: z.string().optional(),\n expectedVersion: z.number().int().nonnegative(),\n updatedAt: IsoDateTimeSchema,\n })\n .strict();\n\nconst versionedRefFields = {\n id: ContractIdentifierSchema,\n version: z.union([z.number().int().positive(), z.string().trim().min(1)]).optional(),\n ownerRepo: ContractIdentifierSchema.optional(),\n};\n\nexport const TrendRadarCollectionAssetRefSchema = z\n .object({\n kind: z.literal('asset'),\n ...versionedRefFields,\n })\n .strict();\n\nexport const TrendRadarCollectionSelectionRefSchema = z\n .object({\n kind: z.literal('radar-selection'),\n ...versionedRefFields,\n })\n .strict();\n\nexport const TrendRadarCollectionRunRefSchema = z\n .object({\n kind: z.literal('radar-analysis-run'),\n ...versionedRefFields,\n })\n .strict();\n\nexport const TrendRadarCollectionSubjectRefSchema = z\n .object({\n kind: z.literal('hotword'),\n ...versionedRefFields,\n })\n .strict();\n\nexport const TrendRadarCollectionArtifactRefSchema = z\n .object({\n kind: z.literal('artifact'),\n ...versionedRefFields,\n })\n .strict();\n\nexport const TrendRadarCollectionRecipeEntrySchema = z\n .object({\n subjectRef: TrendRadarCollectionSubjectRefSchema,\n label: z.string().trim().min(1).max(200),\n })\n .strict();\n\nexport const TrendRadarCollectionRecipeSchema = z\n .object({\n category: z.array(TrendRadarCollectionRecipeEntrySchema),\n design: z.array(TrendRadarCollectionRecipeEntrySchema),\n audience: z.array(TrendRadarCollectionRecipeEntrySchema),\n })\n .strict()\n .refine(\n recipe => recipe.category.length + recipe.design.length + recipe.audience.length > 0,\n 'A Trend Radar collection recipe must contain at least one subject.',\n );\n\nexport const TrendRadarCollectionDecisionAxisSchema = z\n .object({\n key: ContractIdentifierSchema,\n label: z.string().trim().min(1).max(200).optional(),\n value: z.number().finite(),\n })\n .strict();\n\nexport const TrendRadarCollectionDecisionProjectionSchema = z\n .object({\n axes: z.array(TrendRadarCollectionDecisionAxisSchema).max(32).optional(),\n overallScore: z.number().finite().optional(),\n itemRank: z.number().finite().optional(),\n sourceRefs: z.array(EntityRefSchema).optional(),\n outputRefs: z.array(EntityRefSchema).optional(),\n })\n .strict()\n .superRefine((projection, context) => {\n const hasProjection = Boolean(\n projection.axes?.length\n || projection.overallScore !== undefined\n || projection.itemRank !== undefined\n || projection.sourceRefs?.length\n || projection.outputRefs?.length,\n );\n if (!hasProjection) {\n context.addIssue({\n code: 'custom',\n message: 'A decision projection must contain canonical decision data or references.',\n });\n }\n\n const seenAxisKeys = new Set<string>();\n projection.axes?.forEach((axis, index) => {\n if (seenAxisKeys.has(axis.key)) {\n context.addIssue({\n code: 'custom',\n path: ['axes', index, 'key'],\n message: `Duplicate decision axis key: ${axis.key}`,\n });\n }\n seenAxisKeys.add(axis.key);\n });\n });\n\nexport const TrendRadarCollectionArtifactProjectionSchema = z\n .object({\n artifactRef: TrendRadarCollectionArtifactRefSchema,\n url: z.string().url().optional(),\n thumbnailUrl: z.string().url().optional(),\n mimeType: z.string().trim().min(1).optional(),\n metadata: JsonObjectSchema.optional(),\n })\n .strict();\n\nexport const TrendRadarCollectionProjectionWritebackSchema = z\n .object({\n status: z.enum(['PENDING', 'APPLIED', 'FAILED']),\n updatedAt: IsoDateTimeSchema,\n error: z\n .object({\n code: ContractIdentifierSchema,\n message: z.string().trim().min(1),\n retryable: z.boolean(),\n })\n .strict()\n .optional(),\n })\n .strict()\n .superRefine((writeback, context) => {\n if (writeback.status === 'FAILED' && !writeback.error) {\n context.addIssue({\n code: 'custom',\n path: ['error'],\n message: 'A failed collection projection writeback must include an error.',\n });\n }\n if (writeback.status !== 'FAILED' && writeback.error) {\n context.addIssue({\n code: 'custom',\n path: ['error'],\n message: 'Only a failed collection projection writeback may include an error.',\n });\n }\n });\n\nexport const TrendRadarCollectionItemSchema = z\n .object({\n contract: z.literal('TrendRadarCollectionItem'),\n schemaVersion: z.literal(1),\n selectionRef: TrendRadarCollectionSelectionRefSchema,\n recipe: TrendRadarCollectionRecipeSchema,\n status: z.enum(['SAVED', 'QUEUED', 'RUNNING', 'SUCCEEDED', 'FAILED', 'CANCELLED', 'PARTIAL']),\n latestRunRef: TrendRadarCollectionRunRefSchema.optional(),\n decisionProjection: TrendRadarCollectionDecisionProjectionSchema.optional(),\n artifactProjection: TrendRadarCollectionArtifactProjectionSchema.optional(),\n createdAt: IsoDateTimeSchema,\n updatedAt: IsoDateTimeSchema,\n generatedAt: IsoDateTimeSchema.optional(),\n })\n .strict();\n\nexport const RadarAnalysisRunSchema = z\n .object({\n contract: z.literal('RadarAnalysisRun'),\n runId: ContractIdentifierSchema,\n teamId: ContractIdentifierSchema,\n selectionRef: EntityRefSchema,\n workflowRef: EntityRefSchema,\n executionRef: EntityRefSchema.optional(),\n designProjectRef: EntityRefSchema.optional(),\n replayedFromRef: EntityRefSchema.optional(),\n collectionAssetRef: TrendRadarCollectionAssetRefSchema.optional(),\n collectionProjectionWriteback: TrendRadarCollectionProjectionWritebackSchema.optional(),\n workflowDefinitionTeamId: ContractIdentifierSchema.optional(),\n workflowInput: z.record(z.string(), JsonValueSchema).default({}),\n createDesignProject: z.boolean().default(true),\n designProjectName: z.string().trim().min(1).max(200).optional(),\n modelRef: EntityRefSchema,\n requestId: ContractIdentifierSchema,\n idempotencyKey: ContractIdentifierSchema,\n status: z.enum(['QUEUED', 'RUNNING', 'SUCCEEDED', 'FAILED', 'CANCELLED', 'PARTIAL']),\n outputRefs: z.array(EntityRefSchema).default([]),\n error: z\n .object({\n code: ContractIdentifierSchema,\n message: z.string().trim().min(1),\n retryable: z.boolean(),\n })\n .strict()\n .optional(),\n startedAt: IsoDateTimeSchema.optional(),\n completedAt: IsoDateTimeSchema.optional(),\n createdAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const RadarAnalysisAssetSchema = z\n .object({\n artifactRef: EntityRefSchema,\n kind: ContractIdentifierSchema,\n mimeType: z.string().trim().min(1).optional(),\n url: z.string().url(),\n metadata: z.record(z.string(), JsonValueSchema).default({}),\n createdAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const RadarAnalysisDetailSchema = z\n .object({\n contract: z.literal('RadarAnalysisDetail'),\n run: RadarAnalysisRunSchema,\n runVersion: z.number().int().positive(),\n selection: RadarSelectionSchema,\n outputs: z.array(OutputRecordSchema),\n assets: z.array(RadarAnalysisAssetSchema),\n lineage: z.array(LineageRecordSchema),\n })\n .strict();\n\nexport const RadarActionRecordSchema = z\n .object({\n contract: z.literal('RadarActionRecord'),\n actionId: ContractIdentifierSchema,\n teamId: ContractIdentifierSchema,\n actorRef: EntityRefSchema,\n action: z.enum(['stash', 'select', 'reject', 'archive', 'launch', 'retry', 'replay', 'rollback']),\n targetRef: EntityRefSchema,\n requestId: ContractIdentifierSchema,\n idempotencyKey: ContractIdentifierSchema,\n expectedVersion: z.number().int().nonnegative(),\n occurredAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport const RadarWritebackRecordSchema = z\n .object({\n contract: z.literal('RadarWritebackRecord'),\n writebackId: ContractIdentifierSchema,\n actionRef: EntityRefSchema,\n targetRef: EntityRefSchema,\n status: z.enum(['PENDING', 'APPLIED', 'FAILED']),\n resultingVersion: z.number().int().nonnegative().optional(),\n error: z.string().trim().min(1).optional(),\n recordedAt: IsoDateTimeSchema,\n })\n .strict();\n\nexport type TrendSource = z.infer<typeof TrendSourceSchema>;\nexport type TrendIngestRun = z.infer<typeof TrendIngestRunSchema>;\nexport type TrendSourceRecord = z.infer<typeof TrendSourceRecordSchema>;\nexport type HotwordBody = z.infer<typeof HotwordBodySchema>;\nexport type BrandBody = z.infer<typeof BrandBodySchema>;\nexport type ProductBody = z.infer<typeof ProductBodySchema>;\nexport type TrendMetricSnapshot = z.infer<typeof TrendMetricSnapshotSchema>;\nexport type RadarDecisionMetrics = z.infer<typeof RadarDecisionMetricsSchema>;\nexport type RadarScoreModelBody = z.infer<typeof RadarScoreModelBodySchema>;\nexport type RadarScoreProjection = z.infer<typeof RadarScoreProjectionSchema>;\nexport type RadarPanorama = z.infer<typeof RadarPanoramaSchema>;\nexport type BrandGeneticsProfile = z.infer<typeof BrandGeneticsProfileSchema>;\nexport type RadarOpportunityMatrix = z.infer<typeof RadarOpportunityMatrixSchema>;\nexport type RadarQueryBody = z.infer<typeof RadarQueryBodySchema>;\nexport type SavedRadarQuery = z.infer<typeof SavedRadarQuerySchema>;\nexport type RadarSelection = z.infer<typeof RadarSelectionSchema>;\nexport type TrendRadarCollectionAssetRef = z.infer<typeof TrendRadarCollectionAssetRefSchema>;\nexport type TrendRadarCollectionSelectionRef = z.infer<typeof TrendRadarCollectionSelectionRefSchema>;\nexport type TrendRadarCollectionRunRef = z.infer<typeof TrendRadarCollectionRunRefSchema>;\nexport type TrendRadarCollectionSubjectRef = z.infer<typeof TrendRadarCollectionSubjectRefSchema>;\nexport type TrendRadarCollectionArtifactRef = z.infer<typeof TrendRadarCollectionArtifactRefSchema>;\nexport type TrendRadarCollectionRecipeEntry = z.infer<typeof TrendRadarCollectionRecipeEntrySchema>;\nexport type TrendRadarCollectionRecipe = z.infer<typeof TrendRadarCollectionRecipeSchema>;\nexport type TrendRadarCollectionDecisionAxis = z.infer<typeof TrendRadarCollectionDecisionAxisSchema>;\nexport type TrendRadarCollectionDecisionProjection = z.infer<typeof TrendRadarCollectionDecisionProjectionSchema>;\nexport type TrendRadarCollectionArtifactProjection = z.infer<typeof TrendRadarCollectionArtifactProjectionSchema>;\nexport type TrendRadarCollectionProjectionWriteback = z.infer<typeof TrendRadarCollectionProjectionWritebackSchema>;\nexport type TrendRadarCollectionItem = z.infer<typeof TrendRadarCollectionItemSchema>;\nexport type RadarAnalysisRun = z.infer<typeof RadarAnalysisRunSchema>;\nexport type RadarAnalysisAsset = z.infer<typeof RadarAnalysisAssetSchema>;\nexport type RadarAnalysisDetail = z.infer<typeof RadarAnalysisDetailSchema>;\nexport type RadarActionRecord = z.infer<typeof RadarActionRecordSchema>;\nexport type RadarWritebackRecord = z.infer<typeof RadarWritebackRecordSchema>;\n","import { z } from 'zod';\nimport { ArtifactManifestSchema, OutputRecordSchema } from './artifact';\nimport {\n ContractIdentifierSchema,\n EntityRefSchema,\n IsoDateTimeSchema,\n JsonObjectSchema,\n Sha256Schema,\n} from './common';\nimport { ApplicationRunSchema } from './continuity';\nimport { LineageRecordSchema } from './data';\n\nexport const WorkflowCatalogEntrySchema = z\n .object({\n contract: z.literal('WorkflowCatalogEntry'),\n workflowId: ContractIdentifierSchema,\n teamId: ContractIdentifierSchema,\n creatorRef: EntityRefSchema,\n currentDefinitionRef: EntityRefSchema,\n lifecycle: z.enum(['ACTIVE', 'DELETED']),\n asset: z\n .object({\n preset: z.boolean(),\n marketplacePublished: z.boolean(),\n publishConfig: JsonObjectSchema.optional(),\n sort: z.number().int(),\n forkFromRef: EntityRefSchema.optional(),\n notAuthorized: z.boolean(),\n })\n .strict(),\n createdAt: IsoDateTimeSchema,\n updatedAt: IsoDateTimeSchema,\n deletedAt: IsoDateTimeSchema.optional(),\n })\n .strict()\n .superRefine((entry, context) => {\n if (\n entry.creatorRef.kind !== 'user' &&\n entry.creatorRef.kind !== 'service'\n ) {\n context.addIssue({\n code: 'custom',\n path: ['creatorRef', 'kind'],\n message: 'creatorRef must reference a user or service.',\n });\n }\n if (entry.currentDefinitionRef.kind !== 'workflow-definition') {\n context.addIssue({\n code: 'custom',\n path: ['currentDefinitionRef', 'kind'],\n message: 'currentDefinitionRef must reference a workflow-definition.',\n });\n }\n if (entry.lifecycle === 'DELETED' && !entry.deletedAt) {\n context.addIssue({\n code: 'custom',\n path: ['deletedAt'],\n message: 'Deleted workflow catalog entries require deletedAt.',\n });\n }\n if (entry.lifecycle === 'ACTIVE' && entry.deletedAt) {\n context.addIssue({\n code: 'custom',\n path: ['deletedAt'],\n message: 'Active workflow catalog entries cannot declare deletedAt.',\n });\n }\n });\n\nexport const WorkflowPublicationSchema = z\n .object({\n contract: z.literal('WorkflowPublication'),\n publicationId: ContractIdentifierSchema,\n definitionRef: EntityRefSchema,\n runtimeDefinitionRef: EntityRefSchema,\n sourceHash: Sha256Schema,\n compiledHash: Sha256Schema,\n status: z.enum(['PENDING', 'PUBLISHED', 'FAILED', 'RETIRED']),\n publisherRef: EntityRefSchema,\n publishedAt: IsoDateTimeSchema.optional(),\n failureReason: z.string().trim().min(1).optional(),\n })\n .strict()\n .superRefine((publication, context) => {\n if (publication.definitionRef.kind !== 'workflow-definition') {\n context.addIssue({\n code: 'custom',\n path: ['definitionRef', 'kind'],\n message: 'definitionRef must reference a workflow-definition.',\n });\n }\n if (publication.runtimeDefinitionRef.kind !== 'conductor-workflow-definition') {\n context.addIssue({\n code: 'custom',\n path: ['runtimeDefinitionRef', 'kind'],\n message: 'runtimeDefinitionRef must reference a conductor-workflow-definition.',\n });\n }\n if (publication.status === 'PUBLISHED' && !publication.publishedAt) {\n context.addIssue({\n code: 'custom',\n path: ['publishedAt'],\n message: 'Published workflow publications require publishedAt.',\n });\n }\n if (publication.status === 'FAILED' && !publication.failureReason) {\n context.addIssue({\n code: 'custom',\n path: ['failureReason'],\n message: 'Failed workflow publications require failureReason.',\n });\n }\n });\n\nexport const WorkflowCompletionCommitSchema = z\n .object({\n contract: z.literal('WorkflowCompletionCommit'),\n commitId: ContractIdentifierSchema,\n run: ApplicationRunSchema,\n outputs: z.array(OutputRecordSchema),\n artifacts: z.array(ArtifactManifestSchema),\n lineage: LineageRecordSchema,\n completedAt: IsoDateTimeSchema,\n })\n .strict()\n .superRefine((commit, context) => {\n const expectedRunId = commit.run.runId;\n const referencesRun = (value: { runRef: { kind: string; id: string } }) =>\n value.runRef.kind === 'application-run' && value.runRef.id === expectedRunId;\n\n commit.outputs.forEach((output, index) => {\n if (!referencesRun(output)) {\n context.addIssue({\n code: 'custom',\n path: ['outputs', index, 'runRef'],\n message: 'Every output must reference the committed ApplicationRun.',\n });\n }\n });\n commit.artifacts.forEach((artifact, index) => {\n if (!referencesRun(artifact)) {\n context.addIssue({\n code: 'custom',\n path: ['artifacts', index, 'runRef'],\n message: 'Every artifact must reference the committed ApplicationRun.',\n });\n }\n });\n if (\n commit.lineage.subjectRef.kind !== 'application-run' ||\n commit.lineage.subjectRef.id !== expectedRunId\n ) {\n context.addIssue({\n code: 'custom',\n path: ['lineage', 'subjectRef'],\n message: 'Completion lineage must use the committed ApplicationRun as its subject.',\n });\n }\n const outputIds = new Set(commit.outputs.map(output => output.outputId));\n commit.artifacts.forEach((artifact, index) => {\n if (\n artifact.outputRef.kind !== 'workflow-output' ||\n !outputIds.has(artifact.outputRef.id)\n ) {\n context.addIssue({\n code: 'custom',\n path: ['artifacts', index, 'outputRef'],\n message: 'Artifact outputRef must reference an output in the same commit.',\n });\n }\n });\n });\n\nexport const WorkflowCompletionReceiptSchema = z\n .object({\n contract: z.literal('WorkflowCompletionReceipt'),\n commitId: ContractIdentifierSchema,\n runRef: EntityRefSchema,\n outputRefs: z.array(EntityRefSchema),\n artifactRefs: z.array(EntityRefSchema),\n contentHash: Sha256Schema,\n committedAt: IsoDateTimeSchema,\n idempotentReplay: z.boolean(),\n })\n .strict()\n .superRefine((receipt, context) => {\n if (receipt.runRef.kind !== 'application-run') {\n context.addIssue({\n code: 'custom',\n path: ['runRef', 'kind'],\n message: 'runRef must reference an application-run.',\n });\n }\n receipt.outputRefs.forEach((ref, index) => {\n if (ref.kind !== 'workflow-output') {\n context.addIssue({\n code: 'custom',\n path: ['outputRefs', index, 'kind'],\n message: 'outputRefs must reference workflow-output records.',\n });\n }\n });\n receipt.artifactRefs.forEach((ref, index) => {\n if (ref.kind !== 'artifact') {\n context.addIssue({\n code: 'custom',\n path: ['artifactRefs', index, 'kind'],\n message: 'artifactRefs must reference artifacts.',\n });\n }\n });\n });\n\nexport type WorkflowPublication = z.infer<typeof WorkflowPublicationSchema>;\nexport type WorkflowCatalogEntry = z.infer<typeof WorkflowCatalogEntrySchema>;\nexport type WorkflowCompletionCommit = z.infer<typeof WorkflowCompletionCommitSchema>;\nexport type WorkflowCompletionReceipt = z.infer<typeof WorkflowCompletionReceiptSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AASX,IAAM,uBAAuB,EACjC,OAAO;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,yBAAyB,SAAS;AAAA,EAC1C,KAAK;AAAA,EACL,QAAQ,yBAAyB,SAAS;AAAA,EAC1C,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAC/B,WAAW,kBAAkB,SAAS;AACxC,CAAC,EACA,OAAO;AAEH,IAAM,uBAAuB,EACjC,OAAO;AAAA,EACN,UAAU,yBAAyB,SAAS;AAAA,EAC5C,QAAQ,yBAAyB,SAAS;AAAA,EAC1C,UAAU,gBAAgB,SAAS;AAAA,EACnC,YAAY,EAAE,KAAK,CAAC,WAAW,QAAQ,UAAU,QAAQ,CAAC;AAC5D,CAAC,EACA,OAAO;AAEH,IAAM,yBAAyB,EACnC,OAAO;AAAA,EACN,UAAU,EAAE,QAAQ,kBAAkB;AAAA,EACtC,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;AAAA,EACjC,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS;AAAA,EAClD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW,gBAAgB,SAAS;AAAA,EACpC,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU,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AmB;AAClC,cAAQ,SAAS;AAAA,QACf,MAAM;AAAA,QACN,MAAM,CAAC,cAAc,OAAO,MAAM;AAAA,QAClC,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACD,UAAQ,aAAa,QAAQ,CAAC,KAAK,UAAU;AAC3C,QAAI,IAAI,SAAS,YAAY;AAC3B,cAAQ,SAAS;AAAA,QACf,MAAM;AAAA,QACN,MAAM,CAAC,gBAAgB,OAAO,MAAM;AAAA,QACpC,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH,CAAC;","names":["z","z","z","z","z","z","z","z","z","z","z","z"]}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ActionProgramArtifactSchema,
|
|
3
|
+
ContractIdentifierSchema,
|
|
4
|
+
DeclarativeBatchOperationIntentSchema,
|
|
5
|
+
DeclarativeDiagnosticSchema,
|
|
6
|
+
DeclarativeNativeDownloadSchema,
|
|
7
|
+
DeclarativePublicationResultSchema,
|
|
8
|
+
DeclarativeRuntimeActionExecuteIntentSchema,
|
|
9
|
+
JsonObjectSchema,
|
|
10
|
+
RevisionRefSchema,
|
|
11
|
+
Sha256Schema
|
|
12
|
+
} from "./chunk-KRIKORSN.mjs";
|
|
13
|
+
|
|
14
|
+
// src/contracts/agent-native-runtime.ts
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
var AgentNativeRuntimeBindingSchema = z.object({
|
|
17
|
+
engine: z.literal("app-server"),
|
|
18
|
+
cliVersion: z.string().min(1),
|
|
19
|
+
workerId: z.string().min(1),
|
|
20
|
+
epoch: z.number().int().positive()
|
|
21
|
+
});
|
|
22
|
+
var AgentArtifactDeliverySchema = z.object({
|
|
23
|
+
runId: z.string().min(1),
|
|
24
|
+
status: z.enum(["pending", "uploading", "ready", "failed"]),
|
|
25
|
+
error: z.string().optional()
|
|
26
|
+
});
|
|
27
|
+
var AgentNativeRecoverySchema = z.object({
|
|
28
|
+
runId: z.string().min(1),
|
|
29
|
+
state: z.enum(["reconciling", "uncertain"]),
|
|
30
|
+
message: z.string()
|
|
31
|
+
});
|
|
32
|
+
var AgentNativeInteractionSchema = z.object({
|
|
33
|
+
runId: z.string().min(1),
|
|
34
|
+
requestId: z.union([z.string(), z.number().int()]),
|
|
35
|
+
method: z.enum([
|
|
36
|
+
"item/commandExecution/requestApproval",
|
|
37
|
+
"item/fileChange/requestApproval",
|
|
38
|
+
"item/permissions/requestApproval",
|
|
39
|
+
"item/tool/requestUserInput",
|
|
40
|
+
"mcpServer/elicitation/request"
|
|
41
|
+
]),
|
|
42
|
+
params: z.record(z.string(), z.unknown())
|
|
43
|
+
});
|
|
44
|
+
var AgentNativeInteractionResponseSchema = z.object({
|
|
45
|
+
commandId: z.string().min(1).max(256),
|
|
46
|
+
runId: z.string().min(1),
|
|
47
|
+
requestId: z.union([z.string(), z.number().int()]),
|
|
48
|
+
result: z.unknown()
|
|
49
|
+
});
|
|
50
|
+
var AgentQuickStartIntentSchema = z.object({
|
|
51
|
+
quickStartId: z.string().min(1),
|
|
52
|
+
text: z.string(),
|
|
53
|
+
/** Authorized Skill IDs, never a workflow ID or hidden execution plan. */
|
|
54
|
+
skillIds: z.array(z.string()).optional(),
|
|
55
|
+
attachmentUris: z.array(z.string()).default([])
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// src/contracts/declarative-publication-job.ts
|
|
59
|
+
import { z as z2 } from "zod";
|
|
60
|
+
var jobIdSchema = ContractIdentifierSchema.regex(/^job[.:][a-zA-Z0-9][a-zA-Z0-9._:-]*$/);
|
|
61
|
+
var DeclarativePublicationJobOperationSchema = z2.object({
|
|
62
|
+
id: ContractIdentifierSchema,
|
|
63
|
+
dependsOn: z2.array(ContractIdentifierSchema).max(16),
|
|
64
|
+
operation: DeclarativeBatchOperationIntentSchema
|
|
65
|
+
}).strict();
|
|
66
|
+
var DeclarativePublicationJobManifestSchema = z2.object({
|
|
67
|
+
idempotencyKey: z2.string().trim().min(1).max(256),
|
|
68
|
+
expectedGeneration: z2.number().int().nonnegative(),
|
|
69
|
+
operations: z2.array(DeclarativePublicationJobOperationSchema).min(1).max(128)
|
|
70
|
+
}).strict();
|
|
71
|
+
var DeclarativePublicationJobOperationStateSchema = z2.object({
|
|
72
|
+
id: ContractIdentifierSchema,
|
|
73
|
+
status: z2.enum(["queued", "running", "succeeded", "failed"]),
|
|
74
|
+
attemptCount: z2.number().int().nonnegative(),
|
|
75
|
+
diagnostics: z2.array(DeclarativeDiagnosticSchema).max(32),
|
|
76
|
+
result: DeclarativePublicationResultSchema.optional()
|
|
77
|
+
}).strict();
|
|
78
|
+
var DeclarativePublicationJobScopeSchema = z2.object({
|
|
79
|
+
tenantId: ContractIdentifierSchema,
|
|
80
|
+
teamId: ContractIdentifierSchema.optional(),
|
|
81
|
+
surfaces: z2.array(z2.enum(["kernel", "studio"])).max(2),
|
|
82
|
+
environmentIds: z2.array(ContractIdentifierSchema).max(128)
|
|
83
|
+
}).strict();
|
|
84
|
+
var DeclarativePublicationJobReconciliationSchema = z2.object({
|
|
85
|
+
requested: z2.number().int().nonnegative(),
|
|
86
|
+
succeeded: z2.number().int().nonnegative(),
|
|
87
|
+
failed: z2.number().int().nonnegative(),
|
|
88
|
+
pending: z2.number().int().nonnegative()
|
|
89
|
+
}).strict();
|
|
90
|
+
var DeclarativePublicationJobSchema = z2.object({
|
|
91
|
+
contract: z2.literal("DeclarativePublicationJob"),
|
|
92
|
+
schemaVersion: z2.literal(1),
|
|
93
|
+
jobId: jobIdSchema,
|
|
94
|
+
status: z2.enum(["queued", "running", "succeeded", "failed", "cancelled"]),
|
|
95
|
+
manifest: DeclarativePublicationJobManifestSchema,
|
|
96
|
+
operations: z2.array(DeclarativePublicationJobOperationStateSchema).min(1).max(128),
|
|
97
|
+
scope: DeclarativePublicationJobScopeSchema,
|
|
98
|
+
generation: z2.number().int().nonnegative(),
|
|
99
|
+
reconciliation: DeclarativePublicationJobReconciliationSchema,
|
|
100
|
+
diagnostics: z2.array(DeclarativeDiagnosticSchema).max(64),
|
|
101
|
+
createdAt: z2.string().datetime({ offset: true }),
|
|
102
|
+
updatedAt: z2.string().datetime({ offset: true })
|
|
103
|
+
}).strict();
|
|
104
|
+
|
|
105
|
+
// src/contracts/action-program-http.ts
|
|
106
|
+
import { z as z3 } from "zod";
|
|
107
|
+
var PrepareActionProgramRequestSchema = z3.object({
|
|
108
|
+
artifact: ActionProgramArtifactSchema,
|
|
109
|
+
expectedVersion: z3.number().int().min(0)
|
|
110
|
+
}).strict();
|
|
111
|
+
var RegisterActionProgramRequestSchema = PrepareActionProgramRequestSchema.extend({
|
|
112
|
+
planHash: Sha256Schema,
|
|
113
|
+
idempotencyKey: ContractIdentifierSchema
|
|
114
|
+
}).strict();
|
|
115
|
+
var ReadActionProgramRequestSchema = z3.object({ revisionRef: RevisionRefSchema }).strict();
|
|
116
|
+
var RuntimeProgramLoadRequestSchema = z3.object({
|
|
117
|
+
context: DeclarativeRuntimeActionExecuteIntentSchema
|
|
118
|
+
}).strict();
|
|
119
|
+
var RuntimeProgramCallRequestSchema = RuntimeProgramLoadRequestSchema.extend({
|
|
120
|
+
kind: z3.enum(["query", "command"]),
|
|
121
|
+
dependencyId: ContractIdentifierSchema,
|
|
122
|
+
args: JsonObjectSchema,
|
|
123
|
+
stepKey: z3.string().min(1).max(128),
|
|
124
|
+
recoveryOnly: z3.literal(true).optional()
|
|
125
|
+
}).strict();
|
|
126
|
+
var RuntimeProgramLoadResultSchema = z3.object({
|
|
127
|
+
artifact: ActionProgramArtifactSchema,
|
|
128
|
+
input: JsonObjectSchema,
|
|
129
|
+
schemas: z3.array(z3.object({ revisionRef: RevisionRefSchema, document: JsonObjectSchema }).strict()).max(512)
|
|
130
|
+
}).strict();
|
|
131
|
+
var RuntimeProgramCallResultSchema = z3.object({ value: JsonObjectSchema }).strict();
|
|
132
|
+
var RuntimeProgramDownloadResultSchema = z3.discriminatedUnion("kind", [
|
|
133
|
+
z3.object({ kind: z3.literal("native"), download: DeclarativeNativeDownloadSchema }).strict(),
|
|
134
|
+
z3.object({ kind: z3.literal("text-artifact"), fileName: z3.string().min(1).max(255), mimeType: z3.enum(["application/json", "text/plain", "text/csv"]), content: z3.string().max(1048576) }).strict()
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
AgentNativeRuntimeBindingSchema,
|
|
139
|
+
AgentArtifactDeliverySchema,
|
|
140
|
+
AgentNativeRecoverySchema,
|
|
141
|
+
AgentNativeInteractionSchema,
|
|
142
|
+
AgentNativeInteractionResponseSchema,
|
|
143
|
+
AgentQuickStartIntentSchema,
|
|
144
|
+
DeclarativePublicationJobOperationSchema,
|
|
145
|
+
DeclarativePublicationJobManifestSchema,
|
|
146
|
+
DeclarativePublicationJobOperationStateSchema,
|
|
147
|
+
DeclarativePublicationJobScopeSchema,
|
|
148
|
+
DeclarativePublicationJobReconciliationSchema,
|
|
149
|
+
DeclarativePublicationJobSchema,
|
|
150
|
+
PrepareActionProgramRequestSchema,
|
|
151
|
+
RegisterActionProgramRequestSchema,
|
|
152
|
+
ReadActionProgramRequestSchema,
|
|
153
|
+
RuntimeProgramLoadRequestSchema,
|
|
154
|
+
RuntimeProgramCallRequestSchema,
|
|
155
|
+
RuntimeProgramLoadResultSchema,
|
|
156
|
+
RuntimeProgramCallResultSchema,
|
|
157
|
+
RuntimeProgramDownloadResultSchema
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=chunk-H7J4XGXK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/contracts/agent-native-runtime.ts","../../src/contracts/declarative-publication-job.ts","../../src/contracts/action-program-http.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** Product contracts. Native JSON-RPC and process control stay in the worker. */\nexport const AgentNativeRuntimeBindingSchema = z.object({\n engine: z.literal(\"app-server\"),\n cliVersion: z.string().min(1),\n workerId: z.string().min(1),\n epoch: z.number().int().positive(),\n});\nexport const AgentArtifactDeliverySchema = z.object({\n runId: z.string().min(1),\n status: z.enum([\"pending\", \"uploading\", \"ready\", \"failed\"]),\n error: z.string().optional(),\n});\nexport const AgentNativeRecoverySchema = z.object({\n runId: z.string().min(1),\n state: z.enum([\"reconciling\", \"uncertain\"]),\n message: z.string(),\n});\nexport const AgentNativeInteractionSchema = z.object({\n runId: z.string().min(1),\n requestId: z.union([z.string(), z.number().int()]),\n method: z.enum([\n \"item/commandExecution/requestApproval\",\n \"item/fileChange/requestApproval\",\n \"item/permissions/requestApproval\",\n \"item/tool/requestUserInput\",\n \"mcpServer/elicitation/request\",\n ]),\n params: z.record(z.string(), z.unknown()),\n});\nexport const AgentNativeInteractionResponseSchema = z.object({\n commandId: z.string().min(1).max(256),\n runId: z.string().min(1),\n requestId: z.union([z.string(), z.number().int()]),\n result: z.unknown(),\n});\nexport const AgentQuickStartIntentSchema = z.object({\n quickStartId: z.string().min(1),\n text: z.string(),\n /** Authorized Skill IDs, never a workflow ID or hidden execution plan. */\n skillIds: z.array(z.string()).optional(),\n attachmentUris: z.array(z.string()).default([]),\n});\nexport type AgentNativeRuntimeBinding = z.infer<\n typeof AgentNativeRuntimeBindingSchema\n>;\nexport type AgentArtifactDelivery = z.infer<typeof AgentArtifactDeliverySchema>;\nexport type AgentNativeRecovery = z.infer<typeof AgentNativeRecoverySchema>;\nexport type AgentNativeInteraction = z.infer<\n typeof AgentNativeInteractionSchema\n>;\nexport type AgentNativeInteractionResponse = z.infer<\n typeof AgentNativeInteractionResponseSchema\n>;\n","import { z } from \"zod\";\n\nimport {\n DeclarativeBatchOperationIntentSchema,\n DeclarativePublicationResultSchema,\n} from \"./declarative-control-http\";\nimport { DeclarativeDiagnosticSchema } from \"./declarative-diagnostic\";\nimport { ContractIdentifierSchema } from \"./common\";\n\nconst jobIdSchema = ContractIdentifierSchema.regex(/^job[.:][a-zA-Z0-9][a-zA-Z0-9._:-]*$/);\n\nexport const DeclarativePublicationJobOperationSchema = z\n .object({\n id: ContractIdentifierSchema,\n dependsOn: z.array(ContractIdentifierSchema).max(16),\n operation: DeclarativeBatchOperationIntentSchema,\n })\n .strict();\n\nexport const DeclarativePublicationJobManifestSchema = z\n .object({\n idempotencyKey: z.string().trim().min(1).max(256),\n expectedGeneration: z.number().int().nonnegative(),\n operations: z.array(DeclarativePublicationJobOperationSchema).min(1).max(128),\n })\n .strict();\n\nexport const DeclarativePublicationJobOperationStateSchema = z\n .object({\n id: ContractIdentifierSchema,\n status: z.enum([\"queued\", \"running\", \"succeeded\", \"failed\"]),\n attemptCount: z.number().int().nonnegative(),\n diagnostics: z.array(DeclarativeDiagnosticSchema).max(32),\n result: DeclarativePublicationResultSchema.optional(),\n })\n .strict();\n\nexport const DeclarativePublicationJobScopeSchema = z\n .object({\n tenantId: ContractIdentifierSchema,\n teamId: ContractIdentifierSchema.optional(),\n surfaces: z.array(z.enum([\"kernel\", \"studio\"])).max(2),\n environmentIds: z.array(ContractIdentifierSchema).max(128),\n })\n .strict();\n\nexport const DeclarativePublicationJobReconciliationSchema = z\n .object({\n requested: z.number().int().nonnegative(),\n succeeded: z.number().int().nonnegative(),\n failed: z.number().int().nonnegative(),\n pending: z.number().int().nonnegative(),\n })\n .strict();\n\nexport const DeclarativePublicationJobSchema = z\n .object({\n contract: z.literal(\"DeclarativePublicationJob\"),\n schemaVersion: z.literal(1),\n jobId: jobIdSchema,\n status: z.enum([\"queued\", \"running\", \"succeeded\", \"failed\", \"cancelled\"]),\n manifest: DeclarativePublicationJobManifestSchema,\n operations: z.array(DeclarativePublicationJobOperationStateSchema).min(1).max(128),\n scope: DeclarativePublicationJobScopeSchema,\n generation: z.number().int().nonnegative(),\n reconciliation: DeclarativePublicationJobReconciliationSchema,\n diagnostics: z.array(DeclarativeDiagnosticSchema).max(64),\n createdAt: z.string().datetime({ offset: true }),\n updatedAt: z.string().datetime({ offset: true }),\n })\n .strict();\n\nexport type DeclarativePublicationJobOperation = z.infer<typeof DeclarativePublicationJobOperationSchema>;\nexport type DeclarativePublicationJobManifest = z.infer<typeof DeclarativePublicationJobManifestSchema>;\nexport type DeclarativePublicationJob = z.infer<typeof DeclarativePublicationJobSchema>;\n","import { z } from \"zod\";\nimport {\n ActionProgramArtifactSchema,\n RevisionRefSchema,\n} from \"./declarative-control\";\nimport { DeclarativeRuntimeActionExecuteIntentSchema, DeclarativeNativeDownloadSchema } from \"./declarative-control-http\";\nimport { ContractIdentifierSchema, Sha256Schema, JsonObjectSchema } from \"./common\";\n\nexport const PrepareActionProgramRequestSchema = z\n .object({\n artifact: ActionProgramArtifactSchema,\n expectedVersion: z.number().int().min(0),\n })\n .strict();\nexport const RegisterActionProgramRequestSchema =\n PrepareActionProgramRequestSchema.extend({\n planHash: Sha256Schema,\n idempotencyKey: ContractIdentifierSchema,\n }).strict();\nexport const ReadActionProgramRequestSchema = z\n .object({ revisionRef: RevisionRefSchema })\n .strict();\nexport type PrepareActionProgramRequest = z.infer<\n typeof PrepareActionProgramRequestSchema\n>;\nexport type RegisterActionProgramRequest = z.infer<\n typeof RegisterActionProgramRequestSchema\n>;\n\n/** No persistent run: the original event is re-authorized against the exact Page on every call. */\nexport const RuntimeProgramLoadRequestSchema = z.object({\n context: DeclarativeRuntimeActionExecuteIntentSchema,\n}).strict();\nexport const RuntimeProgramCallRequestSchema = RuntimeProgramLoadRequestSchema.extend({\n kind: z.enum([\"query\", \"command\"]),\n dependencyId: ContractIdentifierSchema,\n args: JsonObjectSchema,\n stepKey: z.string().min(1).max(128),\n recoveryOnly: z.literal(true).optional(),\n}).strict();\nexport const RuntimeProgramLoadResultSchema = z.object({\n artifact: ActionProgramArtifactSchema,\n input: JsonObjectSchema,\n schemas: z.array(z.object({ revisionRef: RevisionRefSchema, document: JsonObjectSchema }).strict()).max(512),\n}).strict();\nexport const RuntimeProgramCallResultSchema = z.object({ value: JsonObjectSchema }).strict();\nexport type RuntimeProgramLoadRequest = z.infer<typeof RuntimeProgramLoadRequestSchema>;\nexport type RuntimeProgramCallRequest = z.infer<typeof RuntimeProgramCallRequestSchema>;\nexport type RuntimeProgramLoadResult = z.infer<typeof RuntimeProgramLoadResultSchema>;\n\nexport const RuntimeProgramDownloadResultSchema = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"native\"), download: DeclarativeNativeDownloadSchema }).strict(),\n z.object({ kind: z.literal(\"text-artifact\"), fileName: z.string().min(1).max(255), mimeType: z.enum([\"application/json\", \"text/plain\", \"text/csv\"]), content: z.string().max(1048576) }).strict(),\n]);\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAGX,IAAM,kCAAkC,EAAE,OAAO;AAAA,EACtD,QAAQ,EAAE,QAAQ,YAAY;AAAA,EAC9B,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC5B,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC1B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AACnC,CAAC;AACM,IAAM,8BAA8B,EAAE,OAAO;AAAA,EAClD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACvB,QAAQ,EAAE,KAAK,CAAC,WAAW,aAAa,SAAS,QAAQ,CAAC;AAAA,EAC1D,OAAO,EAAE,OAAO,EAAE,SAAS;AAC7B,CAAC;AACM,IAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACvB,OAAO,EAAE,KAAK,CAAC,eAAe,WAAW,CAAC;AAAA,EAC1C,SAAS,EAAE,OAAO;AACpB,CAAC;AACM,IAAM,+BAA+B,EAAE,OAAO;AAAA,EACnD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACvB,WAAW,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAAA,EACjD,QAAQ,EAAE,KAAK;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAA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