holarchy-eidolon-adapter 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,289 @@
1
+ import { decodeCanonicalBase64 } from './canonicalBase64.js';
2
+ import { HOLON_EXECUTION_BINDING_KIND, HOLON_EXECUTION_BINDING_KIND_DEFINITION_BYTES, HOLON_EXECUTION_BINDING_KIND_DEFINITION_FQN, parseHolonExecutionBindingBytes, validateHolonExecutionBindingGraph, } from "./HolonExecutionBinding.js";
3
+ import { HOLON_EFFECTIVE_SNAPSHOT_KIND, HOLON_EFFECTIVE_SNAPSHOT_KIND_DEFINITION_BYTES, HOLON_EFFECTIVE_SNAPSHOT_KIND_DEFINITION_FQN, parseHolonEffectiveSnapshotBytes, parseHolonEffectiveSnapshotIssuanceReceiptBytes, } from "holarchy-core-contract";
4
+ import { buildResourceDependencySnapshot, sha256Digest, } from "halfcode-compiler.xnl/resource-core";
5
+ import { HolarchyEidolonAdapterError as EidolonResourceRegistryError } from "./HolarchyEidolonAdapterError.js";
6
+ const authenticProjections = new WeakSet();
7
+ const authenticFreezeReceipts = new WeakSet();
8
+ export async function projectHolonExecutionBindings(input) {
9
+ const resources = [...(input.registry.byKind.get(HOLON_EXECUTION_BINDING_KIND) ?? [])]
10
+ .sort((left, right) => compareUtf16(left.resourceId, right.resourceId));
11
+ if (resources.length === 0)
12
+ return Object.freeze([]);
13
+ assertCanonicalKindDefinition(input, {
14
+ resourceKind: HOLON_EXECUTION_BINDING_KIND,
15
+ fqn: HOLON_EXECUTION_BINDING_KIND_DEFINITION_FQN,
16
+ bytes: HOLON_EXECUTION_BINDING_KIND_DEFINITION_BYTES,
17
+ code: "EIDOLON_HOLON_BINDING_KIND_DEFINITION_MISMATCH",
18
+ });
19
+ assertCanonicalKindDefinition(input, {
20
+ resourceKind: HOLON_EFFECTIVE_SNAPSHOT_KIND,
21
+ fqn: HOLON_EFFECTIVE_SNAPSHOT_KIND_DEFINITION_FQN,
22
+ bytes: HOLON_EFFECTIVE_SNAPSHOT_KIND_DEFINITION_BYTES,
23
+ code: "EIDOLON_HOLON_SNAPSHOT_KIND_DEFINITION_MISMATCH",
24
+ });
25
+ const decoded = resources.map((resource) => {
26
+ const bindingBytes = canonicalBase64Property(resource, "bindingBytesBase64");
27
+ const binding = parseHolonExecutionBindingBytes(bindingBytes);
28
+ if (binding.bindingRef !== resourceRef(resource.resourceId)) {
29
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_IDENTITY_MISMATCH", `HolonExecutionBinding '${resource.resourceId}' bytes select '${binding.bindingRef}'.`);
30
+ }
31
+ return Object.freeze({ resource, binding, bindingBytes });
32
+ });
33
+ const bindingGraph = validateHolonExecutionBindingGraph(decoded.map(({ binding }) => binding));
34
+ const decodedByRef = new Map(decoded.map((entry) => [entry.binding.bindingRef, entry]));
35
+ const projections = [];
36
+ for (const binding of bindingGraph) {
37
+ const decodedBinding = decodedByRef.get(binding.bindingRef);
38
+ if (!decodedBinding)
39
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_GRAPH_INTERNAL", `HolonExecutionBinding '${binding.bindingRef}' disappeared during projection.`);
40
+ const snapshotId = resourceId(binding.snapshotRef);
41
+ const snapshotResource = exactResource(input.registry, snapshotId);
42
+ if (snapshotResource.kind !== HOLON_EFFECTIVE_SNAPSHOT_KIND) {
43
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_SNAPSHOT_KIND_MISMATCH", `Resource '${snapshotId}' must be a canonical ${HOLON_EFFECTIVE_SNAPSHOT_KIND} Resource.`);
44
+ }
45
+ const snapshotBytes = canonicalBase64Property(snapshotResource, "snapshotBytesBase64");
46
+ const snapshot = await parseHolonEffectiveSnapshotBytes(snapshotBytes);
47
+ const receiptBytes = canonicalBase64Property(snapshotResource, "issuanceReceiptBytesBase64");
48
+ const receipt = parseHolonEffectiveSnapshotIssuanceReceiptBytes(receiptBytes, snapshot);
49
+ assertTargetExists(binding, snapshot);
50
+ const closureResourceIds = resolveBindingClosureResourceIds(binding, decodedByRef, input.registry);
51
+ for (const resourceId of closureResourceIds)
52
+ requiredIdentity(input.contentIdentities, resourceId);
53
+ requiredIdentity(input.contentIdentities, snapshotResource.resourceId);
54
+ const projection = Object.freeze({
55
+ schemaVersion: "eidolon.holon-execution-binding-projection/v1",
56
+ resource: decodedBinding.resource,
57
+ binding,
58
+ snapshotResource,
59
+ snapshot,
60
+ snapshotBytes,
61
+ receiptBytes,
62
+ receipt,
63
+ bindingBytesDigest: sha256Digest(decodedBinding.bindingBytes),
64
+ receiptBytesDigest: sha256Digest(receiptBytes),
65
+ closureResourceIds,
66
+ registryRevision: input.registryRevision,
67
+ });
68
+ authenticProjections.add(projection);
69
+ projections.push(projection);
70
+ }
71
+ return Object.freeze(projections);
72
+ }
73
+ export function freezeHolonExecutionBinding(input) {
74
+ if (!authenticProjections.has(input.projection)) {
75
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_PROJECTION_UNTRUSTED", "Binding freeze requires the exact projection produced by the shared registry.");
76
+ }
77
+ const closure = Object.freeze(input.projection.closureResourceIds.map((resourceId) => {
78
+ const resource = exactResource(input.registry, resourceId);
79
+ const identity = requiredIdentity(input.contentIdentities, resourceId);
80
+ return Object.freeze({
81
+ resourceId,
82
+ kind: resource.kind,
83
+ authorityDigest: exactSha256(identity.authorityDigest, `${resourceId}.authorityDigest`),
84
+ contentDigest: exactSha256(identity.contentDigest, `${resourceId}.contentDigest`),
85
+ });
86
+ }));
87
+ const agentProofs = Object.freeze(agentRefs(input.projection.binding, new Map((input.registry.byKind.get(HOLON_EXECUTION_BINDING_KIND) ?? []).map((resource) => {
88
+ const projected = resourceRef(resource.resourceId);
89
+ return [projected, projected === input.projection.binding.bindingRef
90
+ ? input.projection.binding
91
+ : parseHolonExecutionBindingBytes(canonicalBase64Property(resource, "bindingBytesBase64"))];
92
+ }))).map((agentDefinitionRef) => {
93
+ const agentId = resourceId(agentDefinitionRef);
94
+ const agent = input.agentResources.agentDefinitions.find((candidate) => candidate.resource.resourceId === agentId);
95
+ if (!agent)
96
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_AGENT_PROJECTION_MISSING", `AIAgentDefinition '${agentDefinitionRef}' has no authentic shared-registry projection.`);
97
+ const roots = agentClosureResourceIds(agent);
98
+ const dependencySnapshot = buildResourceDependencySnapshot({
99
+ registry: input.registry,
100
+ roots,
101
+ edges: input.agentResources.dependencyEdges,
102
+ contentIdentities: input.contentIdentities,
103
+ });
104
+ return Object.freeze({
105
+ agentDefinitionRef,
106
+ agentContentDigest: requiredIdentity(input.contentIdentities, agentId).contentDigest,
107
+ closureResourceIds: Object.freeze(dependencySnapshot.closure.map(({ resourceId }) => resourceId)),
108
+ snapshotRevision: dependencySnapshot.snapshotRevision,
109
+ });
110
+ }));
111
+ const semanticFingerprint = sha256Digest(JSON.stringify({
112
+ schemaVersion: "eidolon.holon-execution-binding-freeze-semantic/v1",
113
+ bindingRef: input.projection.binding.bindingRef,
114
+ snapshotRef: input.projection.binding.snapshotRef,
115
+ snapshotTreeDigest: input.projection.snapshot.treeDigest,
116
+ snapshotReceiptDigest: input.projection.receiptBytesDigest,
117
+ bindingBytesDigest: input.projection.bindingBytesDigest,
118
+ registryRevision: input.registryRevision,
119
+ closure,
120
+ agentProofs,
121
+ }));
122
+ const receipt = Object.freeze({
123
+ schemaVersion: "eidolon.holon-execution-binding-freeze/v1",
124
+ bindingRef: input.projection.binding.bindingRef,
125
+ snapshotRef: input.projection.binding.snapshotRef,
126
+ snapshotTreeDigest: input.projection.snapshot.treeDigest,
127
+ snapshotReceiptDigest: input.projection.receiptBytesDigest,
128
+ bindingBytesDigest: input.projection.bindingBytesDigest,
129
+ registryRevision: input.registryRevision,
130
+ closure,
131
+ agentProofs,
132
+ semanticFingerprint,
133
+ });
134
+ authenticFreezeReceipts.add(receipt);
135
+ return receipt;
136
+ }
137
+ export function assertHolonExecutionBindingFreezeReceipt(value) {
138
+ if (!authenticFreezeReceipts.has(value)) {
139
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_FREEZE_RECEIPT_UNTRUSTED", "Holon binding dispatch requires the authentic receipt produced by the shared registry freeze boundary.");
140
+ }
141
+ return value;
142
+ }
143
+ function agentRefs(root, byRef) {
144
+ const refs = new Set();
145
+ const visited = new Set();
146
+ const visit = (binding) => {
147
+ if (visited.has(binding.bindingRef))
148
+ return;
149
+ visited.add(binding.bindingRef);
150
+ if (binding.adapter.kind === "ai-agent")
151
+ refs.add(binding.adapter.agentDefinitionRef);
152
+ if (binding.adapter.kind === "hybrid") {
153
+ for (const candidateRef of binding.adapter.candidateBindingRefs) {
154
+ const candidate = byRef.get(candidateRef);
155
+ if (!candidate)
156
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_CANDIDATE_MISSING", `Hybrid candidate '${candidateRef}' disappeared before freeze.`);
157
+ visit(candidate);
158
+ }
159
+ }
160
+ };
161
+ visit(root);
162
+ return Object.freeze([...refs].sort(compareUtf16));
163
+ }
164
+ function agentClosureResourceIds(agent) {
165
+ const ids = new Set([agent.resource.resourceId]);
166
+ for (const message of agent.messages) {
167
+ ids.add(message.prompt.resource.resourceId);
168
+ if (message.schema)
169
+ ids.add(message.schema.resource.resourceId);
170
+ }
171
+ if (agent.inputSchema)
172
+ ids.add(agent.inputSchema.resource.resourceId);
173
+ if (agent.outputSchema)
174
+ ids.add(agent.outputSchema.resource.resourceId);
175
+ if (agent.effectPolicy)
176
+ ids.add(agent.effectPolicy.resource.resourceId);
177
+ for (const tool of agent.tools)
178
+ ids.add(tool.resource.resourceId);
179
+ for (const port of agent.materialPorts)
180
+ ids.add(port.resource.resourceId);
181
+ return Object.freeze([...ids].sort(compareUtf16));
182
+ }
183
+ function assertCanonicalKindDefinition(input, expected) {
184
+ const kindDefinition = input.registry.kindDefinitions.get(expected.resourceKind)?.definition;
185
+ if (!kindDefinition || kindDefinition.resourceId !== expected.fqn) {
186
+ throw new EidolonResourceRegistryError(expected.code, `Kind '${expected.resourceKind}' must be registered by canonical KindDefinition '${expected.fqn}'.`);
187
+ }
188
+ const expectedDigest = sha256Digest(Uint8Array.from(expected.bytes));
189
+ if (input.kindDefinitionAuthorityDigests.get(expected.resourceKind) !== expectedDigest) {
190
+ throw new EidolonResourceRegistryError(expected.code, `KindDefinition '${expected.fqn}' bytes do not match the canonical owner bytes.`);
191
+ }
192
+ }
193
+ function canonicalBase64Property(resource, property) {
194
+ const value = resource.node.properties[property];
195
+ if (typeof value !== "string" || value.length === 0 || value !== value.trim()) {
196
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_RESOURCE_BYTES_MISSING", `Resource '${resource.resourceId}' requires exact '${property}' base64 bytes.`);
197
+ }
198
+ let bytes;
199
+ try {
200
+ bytes = decodeCanonicalBase64(value);
201
+ }
202
+ catch {
203
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_RESOURCE_BYTES_INVALID", `Resource '${resource.resourceId}' '${property}' is not valid base64.`);
204
+ }
205
+ return bytes;
206
+ }
207
+ function assertTargetExists(binding, snapshot) {
208
+ const expectedKind = binding.target.kind === "member" ? "Member" : "Role";
209
+ const targetRef = binding.target.kind === "member" ? binding.target.memberRef : binding.target.roleRef;
210
+ if (!snapshot.records.some((record) => record.kind === expectedKind && record.id === targetRef)) {
211
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_TARGET_MISSING", `${expectedKind} '${targetRef}' is not present in frozen snapshot '${snapshot.snapshotId}'.`);
212
+ }
213
+ }
214
+ function resolveBindingClosureResourceIds(root, bindings, registry) {
215
+ const selected = new Set();
216
+ const visited = new Set();
217
+ const add = (ref, expectedKind) => {
218
+ const id = resourceId(ref);
219
+ const resource = exactResource(registry, id);
220
+ if (expectedKind && resource.kind !== expectedKind) {
221
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_RESOURCE_KIND_MISMATCH", `Resource '${id}' must have kind '${expectedKind}', got '${resource.kind}'.`);
222
+ }
223
+ selected.add(id);
224
+ };
225
+ const visit = (binding) => {
226
+ if (visited.has(binding.bindingRef))
227
+ return;
228
+ visited.add(binding.bindingRef);
229
+ add(binding.bindingRef, HOLON_EXECUTION_BINDING_KIND);
230
+ add(binding.snapshotRef, HOLON_EFFECTIVE_SNAPSHOT_KIND);
231
+ add(binding.policy.taskProfileRef);
232
+ for (const ref of binding.policy.capabilityRefs)
233
+ add(ref);
234
+ for (const ref of binding.policy.toolRefs)
235
+ add(ref);
236
+ for (const ref of binding.policy.materialRefs)
237
+ add(ref);
238
+ if (binding.adapter.kind === "ai-agent") {
239
+ add(binding.adapter.agentDefinitionRef, "AIAgentDefinition");
240
+ add(binding.adapter.runtimeProfileRef);
241
+ }
242
+ else if (binding.adapter.kind === "human-endpoint") {
243
+ add(binding.adapter.humanEndpointRef);
244
+ add(binding.adapter.inboxProfileRef);
245
+ }
246
+ else if (binding.adapter.kind === "service") {
247
+ add(binding.adapter.serviceAdapterRef);
248
+ add(binding.adapter.runtimeProfileRef);
249
+ }
250
+ else {
251
+ add(binding.adapter.policyRef);
252
+ for (const candidateRef of binding.adapter.candidateBindingRefs) {
253
+ const candidate = bindings.get(candidateRef);
254
+ if (!candidate)
255
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_CANDIDATE_MISSING", `Hybrid candidate '${candidateRef}' is not present in the admitted registry.`);
256
+ visit(candidate.binding);
257
+ }
258
+ }
259
+ };
260
+ visit(root);
261
+ return Object.freeze([...selected].sort(compareUtf16));
262
+ }
263
+ function exactResource(registry, resourceId) {
264
+ const resource = registry.byId.get(resourceId)?.resource;
265
+ if (!resource) {
266
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_RESOURCE_MISSING", `Resource '${resourceId}' is not present in the admitted registry.`);
267
+ }
268
+ return resource;
269
+ }
270
+ function requiredIdentity(identities, resourceId) {
271
+ const identity = identities.get(resourceId);
272
+ if (!identity)
273
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_CONTENT_IDENTITY_MISSING", `Resource '${resourceId}' has no exact content identity.`);
274
+ return identity;
275
+ }
276
+ function resourceId(ref) {
277
+ return ref.slice("resource://".length);
278
+ }
279
+ function resourceRef(resourceId) {
280
+ return `resource://${resourceId}`;
281
+ }
282
+ function compareUtf16(left, right) {
283
+ return left < right ? -1 : left > right ? 1 : 0;
284
+ }
285
+ function exactSha256(value, path) {
286
+ if (!/^sha256:[0-9a-f]{64}$/.test(value))
287
+ throw new EidolonResourceRegistryError("EIDOLON_HOLON_BINDING_DIGEST_INVALID", `Expected one canonical SHA-256 digest at '${path}'.`);
288
+ return value;
289
+ }
@@ -0,0 +1,12 @@
1
+ /** A path selects a local owner operation, never a network destination. */
2
+ export type OrganizationWorkbenchRequest = {
3
+ method: "GET" | "POST";
4
+ path: string;
5
+ body?: Record<string, unknown>;
6
+ };
7
+ export type OrganizationWorkbenchReply = {
8
+ status: number;
9
+ body: unknown;
10
+ };
11
+ export declare function parseOrganizationWorkbenchRequest(value: unknown): OrganizationWorkbenchRequest;
12
+ export declare function parseOrganizationWorkbenchReply(value: unknown): OrganizationWorkbenchReply;
@@ -0,0 +1,102 @@
1
+ function invalid() {
2
+ throw Object.assign(new Error("Invalid organization workbench request"), {
3
+ code: "invalid_schema",
4
+ });
5
+ }
6
+ function jsonValue(value, depth = 0) {
7
+ if (depth > 64)
8
+ invalid();
9
+ if (value === null || typeof value === "string" || typeof value === "boolean")
10
+ return;
11
+ if (typeof value === "number" && Number.isFinite(value))
12
+ return;
13
+ if (Array.isArray(value)) {
14
+ for (const item of value)
15
+ jsonValue(item, depth + 1);
16
+ return;
17
+ }
18
+ if (value &&
19
+ typeof value === "object" &&
20
+ Object.getPrototypeOf(value) === Object.prototype) {
21
+ for (const [key, item] of Object.entries(value)) {
22
+ if (["__proto__", "constructor", "prototype"].includes(key))
23
+ invalid();
24
+ jsonValue(item, depth + 1);
25
+ }
26
+ return;
27
+ }
28
+ invalid();
29
+ }
30
+ export function parseOrganizationWorkbenchRequest(value) {
31
+ if (!value || typeof value !== "object" || Array.isArray(value))
32
+ invalid();
33
+ const row = value;
34
+ if (Object.keys(row).some((key) => !["method", "path", "body"].includes(key)) ||
35
+ !["GET", "POST"].includes(String(row.method)) ||
36
+ typeof row.path !== "string" ||
37
+ row.path.length > 4096 ||
38
+ !row.path.startsWith("/api/") ||
39
+ /[\\\u0000-\u001f]/.test(row.path))
40
+ invalid();
41
+ const url = new URL(row.path, "http://workbench.local");
42
+ if (url.origin !== "http://workbench.local" ||
43
+ url.hash ||
44
+ url.pathname !== row.path.split("?")[0])
45
+ invalid();
46
+ const parts = url.pathname.split("/").filter(Boolean).map(decodeURIComponent);
47
+ if (parts.some((part) => !part || part === "." || part === ".." || part.includes("/")))
48
+ invalid();
49
+ if (row.method === "POST") {
50
+ if (parts.length !== 4 ||
51
+ parts[0] !== "api" ||
52
+ parts[1] !== "connections" ||
53
+ parts[3] !== "invoke" ||
54
+ [...url.searchParams].length ||
55
+ !row.body ||
56
+ typeof row.body !== "object" ||
57
+ Array.isArray(row.body))
58
+ invalid();
59
+ }
60
+ else {
61
+ if (row.body !== undefined)
62
+ invalid();
63
+ const top = parts.length === 2 && ["health", "connections"].includes(parts[1]);
64
+ const leaf = parts[1] === "connections" &&
65
+ parts.length >= 4 &&
66
+ parts.length <= 6 &&
67
+ [
68
+ "state",
69
+ "history",
70
+ "xnl",
71
+ "operations",
72
+ "issuances",
73
+ "projection",
74
+ "objects",
75
+ "result",
76
+ ].includes(parts[3]);
77
+ if (!top && !leaf)
78
+ invalid();
79
+ for (const [key] of url.searchParams)
80
+ if (!["effectiveDate", "observation"].includes(key))
81
+ invalid();
82
+ }
83
+ jsonValue(value);
84
+ if (new TextEncoder().encode(JSON.stringify(value)).length > 2 * 1024 * 1024)
85
+ invalid();
86
+ return value;
87
+ }
88
+ export function parseOrganizationWorkbenchReply(value) {
89
+ if (!value || typeof value !== "object" || Array.isArray(value))
90
+ invalid();
91
+ const row = value;
92
+ if (Object.keys(row).some((key) => !["status", "body"].includes(key)) ||
93
+ !Number.isInteger(row.status) ||
94
+ Number(row.status) < 200 ||
95
+ Number(row.status) > 599 ||
96
+ !Object.hasOwn(row, "body"))
97
+ invalid();
98
+ jsonValue(row.body);
99
+ if (new TextEncoder().encode(JSON.stringify(value)).length > 16 * 1024 * 1024)
100
+ invalid();
101
+ return value;
102
+ }
@@ -0,0 +1,90 @@
1
+ import type { ImmutableJsonValue, TaskProfileEnvelope } from 'task-manager-contract';
2
+ export declare const HOLON_TASK_TARGET_SCHEMA_VERSION: "ai-workflow.holon-task-target/v1";
3
+ export declare const HOLON_TASK_SNAPSHOT_RECEIPT_SCHEMA_VERSION: "eidolon.holon-task-snapshot-receipt/v2";
4
+ export declare const AI_ORGANIZATION_TASK_PROFILE_KIND: "depa.ai.organization-task";
5
+ export type HolonTaskResourceRef = `resource://${string}`;
6
+ export type HolonTaskDigest = `sha256:${string}`;
7
+ type ClosedRecord<Shape> = Readonly<Record<string, ImmutableJsonValue>> & Readonly<Shape>;
8
+ export type HolonTaskTarget = ClosedRecord<{
9
+ readonly kind: 'holon-task-target';
10
+ readonly schemaVersion: typeof HOLON_TASK_TARGET_SCHEMA_VERSION;
11
+ readonly invocation: ClosedRecord<{
12
+ readonly workflowKind: 'AICtrlWorkflow' | 'AIDataWorkflow';
13
+ readonly workflowRef: HolonTaskResourceRef;
14
+ readonly nodeId: string;
15
+ readonly invocationId: string;
16
+ }>;
17
+ readonly holon: ClosedRecord<{
18
+ readonly rootHolonRef: string;
19
+ readonly effectiveAt: string;
20
+ }>;
21
+ readonly executionBinding: ClosedRecord<{
22
+ readonly ref: HolonTaskResourceRef;
23
+ readonly digest: HolonTaskDigest;
24
+ }>;
25
+ readonly taskSpace: ClosedRecord<{
26
+ readonly profileRef: HolonTaskResourceRef;
27
+ readonly policyRef: HolonTaskResourceRef;
28
+ readonly requiredRoleRefs: readonly string[];
29
+ readonly requiredCapabilityRefs: readonly HolonTaskResourceRef[];
30
+ }>;
31
+ readonly output: ClosedRecord<{
32
+ readonly schemaRef: HolonTaskResourceRef;
33
+ readonly materialPortRefs: readonly HolonTaskResourceRef[];
34
+ }>;
35
+ }>;
36
+ export type HolonTaskSnapshotReceipt = ClosedRecord<{
37
+ readonly kind: 'holon-task-snapshot-receipt';
38
+ readonly schemaVersion: typeof HOLON_TASK_SNAPSHOT_RECEIPT_SCHEMA_VERSION;
39
+ readonly taskSpaceId: string;
40
+ readonly holonRef: string;
41
+ readonly effectiveAt: string;
42
+ readonly holonSnapshotRef: string;
43
+ readonly holonSnapshotDigest: HolonTaskDigest;
44
+ readonly snapshotArtifactDigest: HolonTaskDigest;
45
+ readonly issuerReceiptId: HolonTaskDigest;
46
+ readonly executionBindingRef: HolonTaskResourceRef;
47
+ readonly executionBindingDigest: HolonTaskDigest;
48
+ readonly eligibleMemberRefs: readonly string[];
49
+ readonly eligibleRoleRefs: readonly string[];
50
+ }>;
51
+ export type HolonTaskSnapshotAdoptionReceipt = ClosedRecord<{
52
+ readonly kind: 'holon-task-snapshot-adoption-receipt';
53
+ readonly schemaVersion: 'ai-workflow.holon-task-snapshot-adoption-receipt/v1';
54
+ readonly taskSpaceId: string;
55
+ readonly previousTaskId: string;
56
+ readonly successorTaskId: string;
57
+ readonly previousIssuerReceiptId: HolonTaskDigest;
58
+ readonly successorIssuerReceiptId: HolonTaskDigest;
59
+ readonly executionBindingDigest: HolonTaskDigest;
60
+ readonly adoptedAt: string;
61
+ }>;
62
+ export type AIOrganizationTaskProfileFacts = ClosedRecord<{
63
+ target: HolonTaskTarget;
64
+ snapshotReceipt: HolonTaskSnapshotReceipt;
65
+ assignmentReceipt: null;
66
+ memberRuntimeRef: null;
67
+ settlementReceipt: null;
68
+ snapshotAdoptions: readonly HolonTaskSnapshotAdoptionReceipt[];
69
+ }>;
70
+ export type AIOrganizationTaskProfile = TaskProfileEnvelope<typeof AI_ORGANIZATION_TASK_PROFILE_KIND, AIOrganizationTaskProfileFacts>;
71
+ export interface WorkflowHolonTaskContext {
72
+ readonly target: HolonTaskTarget;
73
+ readonly semanticFingerprint: HolonTaskDigest;
74
+ readonly snapshotRevision: HolonTaskDigest;
75
+ readonly closureResourceIds: readonly string[];
76
+ }
77
+ export declare function holonTaskTargetFromNodeConfig(configInput: unknown, expected: Readonly<{
78
+ readonly workflowKind: 'AICtrlWorkflow' | 'AIDataWorkflow';
79
+ readonly workflowRef: HolonTaskResourceRef;
80
+ readonly nodeId: string;
81
+ }>): HolonTaskTarget | undefined;
82
+ export declare class HolonTaskContractError extends Error {
83
+ readonly path: string;
84
+ constructor(path: string, message: string);
85
+ }
86
+ export declare function normalizeHolonTaskTarget(value: unknown): HolonTaskTarget;
87
+ export declare function normalizeHolonTaskSnapshotReceipt(value: unknown): HolonTaskSnapshotReceipt;
88
+ export declare function createAIOrganizationTaskProfile(targetInput: unknown, receiptInput: unknown, adoptionInputs?: readonly unknown[]): AIOrganizationTaskProfile;
89
+ export declare function normalizeHolonTaskSnapshotAdoptionReceipt(value: unknown): HolonTaskSnapshotAdoptionReceipt;
90
+ export {};