@ixo/editor 5.40.0 → 6.0.0
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/dist/action-manifest.json +5276 -0
- package/dist/{chunk-KNMPGX5G.js → chunk-5TJK6JKV.js} +624 -119
- package/dist/chunk-5TJK6JKV.js.map +1 -0
- package/dist/{chunk-OFW7NYJK.js → chunk-EOMC6ZVX.js} +2 -2
- package/dist/{chunk-OIX5IZOQ.js → chunk-LMYTTXOQ.js} +2307 -2311
- package/dist/chunk-LMYTTXOQ.js.map +1 -0
- package/dist/core/index.d.ts +184 -251
- package/dist/core/index.js +22 -2
- package/dist/core/index.js.map +1 -1
- package/dist/{graphql-client-BLdk01vt.d.ts → graphql-client-s4ig1o1G.d.ts} +1 -1
- package/dist/{index-B4Qe8xbv.d.ts → index-DL8Yh3Xu.d.ts} +11 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mantine/index.d.ts +3 -3
- package/dist/mantine/index.js +2 -2
- package/dist/{store-B-2A-Tlv.d.ts → store-C_KCYNzv.d.ts} +911 -567
- package/package.json +3 -2
- package/dist/chunk-KNMPGX5G.js.map +0 -1
- package/dist/chunk-OIX5IZOQ.js.map +0 -1
- /package/dist/{chunk-OFW7NYJK.js.map → chunk-EOMC6ZVX.js.map} +0 -0
package/dist/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a5 as ActionDefinition, a6 as ActionEventDefinition, a7 as OutputSchemaField, a8 as ActionServices, a9 as CompiledBlock, v as CompiledFlow,
|
|
2
|
-
export {
|
|
3
|
-
import { a4 as
|
|
4
|
-
export { af as ActionReadBackMetadata, a9 as ClaimCollectionURI, am as CreateDelegationParams, an as CreateInvocationParams, al as CreateRootDelegationParams, a8 as DID, D as DelegationChainValidationResult, k as DelegationGrant, aa as EvaluationStatus, aj as ExecutionWithInvocationResult, ak as FindProofsResult, ac as FlowNodeAuthzExtension, ag as FlowNodeBase, ah as InvocationRequest, ai as InvocationResult, ab as LinkedClaim, ad as NodeState, ae as ReadBackTerminalState,
|
|
1
|
+
import { a5 as ActionDefinition, a6 as ActionEventDefinition, a7 as OutputSchemaField, a8 as ActionServices, a9 as ActionProofDeclaration, aa as RunRecordDetails, ab as CompiledBlock, v as CompiledFlow, ac as CompiledEdge, Z as FlowAgentCommand, $ as FlowAgentContext, ad as ActionHandlers, _ as FlowAgentCommandResult, a0 as FlowAgentExecutor, a2 as FlowAgentNodeSnapshot, ae as FlowAgentBlockerCause, a3 as FlowAgentPublicNodeState } from '../store-C_KCYNzv.js';
|
|
2
|
+
export { aP as AcquireFlowAgentLeaseParams, ag as ActionContext, at as ActionResult, b1 as ActorConstraint, A as AuthorizationResult, B as BaseUcanFlow, ak as BidService, X as BuildFlowAgentContextParams, ar as CarbonService, al as ClaimService, am as CollectionService, an as CollectionUsersService, b4 as CompiledFlowNode, C as CompilerRegistry, b0 as ConditionRef, aQ as CreateAgentCommandParams, ai as EmailService, as as EntityService, aR as EvaluateFlowAgentPolicyParams, E as ExecuteNodeParams, f as ExecutionContext, d as ExecutionOutcome, aH as FailedListenerRun, Y as FlowAgentActor, aU as FlowAgentCommandBase, aV as FlowAgentCommandStatus, aW as FlowAgentCommandType, a1 as FlowAgentLease, aX as FlowAgentLedgerEvent, aY as FlowAgentLedgerEventType, aZ as FlowAgentMaps, aS as FlowAgentOrchestratorOptions, a_ as FlowAgentPolicyDecision, a$ as FlowAgentRunPhase, x as FlowAgentService, aT as FlowAgentServiceOptions, a4 as FlowAgentTickResult, u as FlowCapability, F as FlowRuntimeStateManager, w as FlowStrategy, ah as HttpService, ap as IntegrationsService, ao as MatrixCredentialService, M as MergeResult, N as NodeActionResult, aj as NotifyService, aq as OracleService, aG as PendingInvocation, aF as RUN_RECORD_AUDIT_TYPE, R as ReadFlowOptions, q as ReadFlowResult, b3 as RuntimeRef, S as SetupFlowOptions, p as SetupFlowResult, b2 as TTLConstraint, b5 as TriggerSpec, y as acquireFlowAgentLease, z as appendAgentLedgerEvent, au as appendRunRecord, a as buildAuthzFromProps, D as buildFlowAgentContext, b as buildFlowNodeFromBlock, aI as canMatches, G as cleanupExpiredFlowAgentLeases, af as clearRuntimeForTemplateClone, l as compileBaseUcanFlow, aJ as computeAgentCommandId, aE as computePendingInvocationId, H as createAgentCommand, c as createRuntimeStateManager, o as decompileToBaseUcanFlow, I as evaluateFlowAgentPolicy, e as executeNode, J as executeQueuedAgentCommands, aB as findFailedListenersForSourceRun, k as getActiveEditor, K as getFlowAgentMaps, ax as getOrCreateBlockPendingMap, aw as getPendingInvocationsMap, i as isAuthorized, aK as isCapabilityMatch, aL as isExternalMutation, b6 as isRuntimeRef, n as mergeCompiledFlows, L as planRalphLoopCommands, O as queueAgentCommand, az as queuePendingInvocation, P as readAgentLedgerEvents, m as readCompiledFlowFromYDoc, h as readFlow, r as readFlowAsBaseUcan, g as readFlowFromEditor, ay as readPendingInvocations, Q as readQueuedAgentCommands, av as readRunRecords, T as releaseFlowAgentLease, aA as removePendingInvocation, aC as replayFailedListenerRun, aM as requiredCapabilityForCommand, aN as resourceMatches, j as setActiveEditor, s as setupFlowFromBaseUcan, aD as snapshotInputRefs, U as tickFlowAgent, aO as updateAgentCommand, V as validateAgentCommand, W as validateFlowAgentLease } from '../store-C_KCYNzv.js';
|
|
3
|
+
import { a4 as FlowNodeRuntimeState, j as StoredInvocation, a5 as IxoEditorType, f as UcanService, U as UcanDelegationStore, S as StoredDelegation, I as InvocationStore, a6 as FlowMetadata, a7 as FlowNode } from '../index-DL8Yh3Xu.js';
|
|
4
|
+
export { af as ActionReadBackMetadata, a9 as ClaimCollectionURI, am as CreateDelegationParams, an as CreateInvocationParams, al as CreateRootDelegationParams, a8 as DID, D as DelegationChainValidationResult, k as DelegationGrant, aa as EvaluationStatus, aj as ExecutionWithInvocationResult, ak as FindProofsResult, ac as FlowNodeAuthzExtension, ag as FlowNodeBase, ah as InvocationRequest, ai as InvocationResult, ab as LinkedClaim, ad as NodeState, ae as ReadBackTerminalState, i as UcanCapability, g as UcanServiceConfig, h as UcanServiceHandlers, b as createInvocationStore, d as createMemoryInvocationStore, a as createMemoryUcanDelegationStore, c as createUcanDelegationStore, e as createUcanService } from '../index-DL8Yh3Xu.js';
|
|
5
5
|
import * as Y from 'yjs';
|
|
6
6
|
import { Doc } from 'yjs';
|
|
7
7
|
import 'matrix-js-sdk';
|
|
@@ -22,6 +22,8 @@ declare const STEP_COMPLETED_EVENT: ActionEventDefinition;
|
|
|
22
22
|
declare function registerAction<TInputs extends Record<string, any> = Record<string, any>>(definition: ActionDefinition<TInputs>): void;
|
|
23
23
|
declare function getAction(type: string): ActionDefinition | undefined;
|
|
24
24
|
declare function getAllActions(): ActionDefinition[];
|
|
25
|
+
/** All (alias → canonical type) pairs, for manifest generation and consistency checks. */
|
|
26
|
+
declare function getAliasEntries(): Array<[string, string]>;
|
|
25
27
|
declare function hasAction(type: string): boolean;
|
|
26
28
|
/** Look up an action by its UCAN `can` ability string, e.g., "bid/submit". */
|
|
27
29
|
declare function getActionByCan(can: string): ActionDefinition | undefined;
|
|
@@ -46,6 +48,54 @@ declare function getEventsForBlock(action: ActionDefinition | undefined, inputs:
|
|
|
46
48
|
*/
|
|
47
49
|
declare function getOutputSchemaForBlock(action: ActionDefinition | undefined, inputs: unknown): OutputSchemaField[];
|
|
48
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Serializable proof declaration: custom `validate` functions can't cross a
|
|
53
|
+
* JSON boundary, so they are represented as `{ kind: 'custom' }` — consumers
|
|
54
|
+
* know a proof exists and is enforced kernel-side, without its logic.
|
|
55
|
+
*/
|
|
56
|
+
type ManifestProofDeclaration = {
|
|
57
|
+
kind: 'none';
|
|
58
|
+
} | {
|
|
59
|
+
kind: 'fields';
|
|
60
|
+
fields: string[];
|
|
61
|
+
} | {
|
|
62
|
+
kind: 'custom';
|
|
63
|
+
};
|
|
64
|
+
interface ActionManifestEntry {
|
|
65
|
+
type: string;
|
|
66
|
+
/** Legacy names that resolve to this canonical type. */
|
|
67
|
+
aliases: string[];
|
|
68
|
+
can?: string;
|
|
69
|
+
sideEffect: boolean;
|
|
70
|
+
defaultRequiresConfirmation: boolean;
|
|
71
|
+
requiredCapability?: string;
|
|
72
|
+
proof: ManifestProofDeclaration;
|
|
73
|
+
/** JSON Schema for the action's inputs, when declared. */
|
|
74
|
+
inputSchema?: object;
|
|
75
|
+
/** Static output schema. Actions with dynamic schemas also set hasDynamicOutputSchema. */
|
|
76
|
+
outputSchema?: OutputSchemaField[];
|
|
77
|
+
/** Static event vocabulary. Actions with dynamic events also set hasDynamicEvents. */
|
|
78
|
+
events?: Array<Pick<ActionEventDefinition, 'name' | 'displayName' | 'description' | 'payloadSchema'>>;
|
|
79
|
+
hasDynamicEvents: boolean;
|
|
80
|
+
hasDynamicOutputSchema: boolean;
|
|
81
|
+
eligibleForEventTrigger: boolean;
|
|
82
|
+
}
|
|
83
|
+
interface ActionManifest {
|
|
84
|
+
/** Schema version of the manifest format itself. */
|
|
85
|
+
manifestVersion: '1';
|
|
86
|
+
actions: ActionManifestEntry[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Generate the machine-readable action contract from the live registry.
|
|
90
|
+
*
|
|
91
|
+
* This is the single artifact external actors (the flow-manager oracle,
|
|
92
|
+
* third-party agentic Oracle actors) implement against, replacing
|
|
93
|
+
* hand-maintained copies of input contracts. It is emitted to
|
|
94
|
+
* `dist/action-manifest.json` at build time and also callable at runtime
|
|
95
|
+
* from `@ixo/editor/core`.
|
|
96
|
+
*/
|
|
97
|
+
declare function generateActionManifest(): ActionManifest;
|
|
98
|
+
|
|
49
99
|
/**
|
|
50
100
|
* Bidirectional mapping between UCAN `can` vocabulary and registry `type` strings.
|
|
51
101
|
* Derived mechanically: strip "qi/", replace "." with "/".
|
|
@@ -60,13 +110,6 @@ declare function getAllCanMappings(): ReadonlyArray<{
|
|
|
60
110
|
type: string;
|
|
61
111
|
}>;
|
|
62
112
|
|
|
63
|
-
/**
|
|
64
|
-
* Builds an ActionServices map from BlocknoteHandlers.
|
|
65
|
-
* Used by block components to bridge existing DI into registry calls.
|
|
66
|
-
*
|
|
67
|
-
* The handlers parameter is typed as `any` to avoid a circular dependency
|
|
68
|
-
* between core and mantine layers — BlocknoteHandlers is defined in mantine/context.
|
|
69
|
-
*/
|
|
70
113
|
declare function buildServicesFromHandlers(handlers: any): ActionServices;
|
|
71
114
|
|
|
72
115
|
/**
|
|
@@ -110,249 +153,68 @@ interface TriggerResolutionContext {
|
|
|
110
153
|
*/
|
|
111
154
|
declare function resolveRuntimeRefs(nb: Record<string, unknown>, getNodeOutput: (nodeId: string) => Record<string, unknown> | undefined, triggerContext?: TriggerResolutionContext): Record<string, unknown>;
|
|
112
155
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
* `_yRunHistory` structure — they ride on the existing `auditTrail` Y.Map
|
|
118
|
-
* via `useAuditTrail.addEvent`. The shape below is what goes into the
|
|
119
|
-
* audit trail event's `details` field.
|
|
120
|
-
*
|
|
121
|
-
* See `docs/events-and-triggers-plan.md` §3.4, §18, §19.
|
|
122
|
-
*/
|
|
123
|
-
interface RunRecordDetails {
|
|
124
|
-
/** Stable identifier for this run, deterministic from invocation context. */
|
|
125
|
-
runId: string;
|
|
126
|
-
/** Action's output. */
|
|
127
|
-
output: Record<string, unknown>;
|
|
128
|
-
/**
|
|
129
|
-
* Events the action emitted on this run. Persisted as part of the run
|
|
130
|
-
* record so the reconciliation loop can process them idempotently — even
|
|
131
|
-
* across page refreshes and across multiple clients.
|
|
132
|
-
*/
|
|
133
|
-
events: Array<{
|
|
134
|
-
name: string;
|
|
135
|
-
payload: Record<string, unknown>;
|
|
136
|
-
}>;
|
|
137
|
-
/** ISO timestamp when the action started. */
|
|
138
|
-
startedAt: string;
|
|
139
|
-
/** ISO timestamp when the action completed (success or failure). */
|
|
140
|
-
completedAt: string;
|
|
141
|
-
/** DID of the actor who signed the invocation that produced this run. */
|
|
142
|
-
actorDid: string;
|
|
143
|
-
/** UCAN invocation CID when execution produced one. */
|
|
144
|
-
invocationCid?: string;
|
|
145
|
-
/** Capability/proof CID used when no invocation CID was produced. */
|
|
146
|
-
capabilityId?: string;
|
|
147
|
-
/** Optional error if the run failed. */
|
|
148
|
-
error?: {
|
|
149
|
-
message: string;
|
|
150
|
-
code?: string;
|
|
151
|
-
};
|
|
152
|
-
/** External read-back metadata associated with this run or reconciliation. */
|
|
153
|
-
readBack?: Record<string, unknown>;
|
|
154
|
-
/** True when this audit entry was written by external read-back reconciliation. */
|
|
155
|
-
reconciled?: boolean;
|
|
156
|
-
/**
|
|
157
|
-
* If this run was triggered by a pending invocation (i.e. it's a listener
|
|
158
|
-
* run), the id of that pending invocation. Used to dedup replays and trace
|
|
159
|
-
* causality back through `triggeredBy`.
|
|
160
|
-
*/
|
|
161
|
-
fromPendingInvocationId?: string;
|
|
162
|
-
/**
|
|
163
|
-
* If this run is a listener run, the (sourceBlockId, eventName) that
|
|
164
|
-
* caused it. Used by the failure visibility surface to attribute failures
|
|
165
|
-
* back to the source block (CP-1).
|
|
166
|
-
*/
|
|
167
|
-
triggeredBy?: {
|
|
168
|
-
sourceBlockId: string;
|
|
169
|
-
eventName: string;
|
|
170
|
-
};
|
|
171
|
-
/** Source run id for listener runs, stored explicitly for failure lookups. */
|
|
172
|
-
sourceRunId?: string;
|
|
156
|
+
declare const PROOF_MISSING_CODE = "PROOF_MISSING";
|
|
157
|
+
interface ProofValidationResult {
|
|
158
|
+
valid: boolean;
|
|
159
|
+
reason?: string;
|
|
173
160
|
}
|
|
174
|
-
declare const RUN_RECORD_AUDIT_TYPE = "block.run";
|
|
175
161
|
/**
|
|
176
|
-
*
|
|
162
|
+
* Validate a successful action run's output against the action's proof
|
|
163
|
+
* declaration. Called by `executeActionBlock` before writing
|
|
164
|
+
* `state: 'completed'` — success without proof becomes a failure.
|
|
177
165
|
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* `(sourceBlockId, sourceRunId, listenerBlockId, eventName, eventIndex)` —
|
|
182
|
-
* so the reconciliation loop can run idempotently from multiple clients
|
|
183
|
-
* without producing duplicates.
|
|
184
|
-
*
|
|
185
|
-
* See `docs/events-and-triggers-plan.md` §3.4, §3.5.1, §18.
|
|
166
|
+
* A `sideEffect: true` action with no declaration fails closed; a
|
|
167
|
+
* side-effect-free action with no declaration is tolerated (legacy
|
|
168
|
+
* consumer-registered actions) but should declare `'none'` explicitly.
|
|
186
169
|
*/
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
|
|
196
|
-
/** Event index within the source run's `events` array (a single run can emit multiple). */
|
|
197
|
-
eventIndex: number;
|
|
198
|
-
/**
|
|
199
|
-
* The frozen event payload, captured by value at emission time. The
|
|
200
|
-
* assignee invokes the listener against this payload, not against the
|
|
201
|
-
* source block's current state. This is the property that makes the
|
|
202
|
-
* Sally → Mike scenario produce 10 distinct emails even when Mike acts
|
|
203
|
-
* on them all hours later.
|
|
204
|
-
*/
|
|
205
|
-
payload: Record<string, unknown>;
|
|
206
|
-
/**
|
|
207
|
-
* Snapshots of `nodeId.output.*` ref values that the listener's inputs
|
|
208
|
-
* reference, captured at queue time. Keyed by the full ref string.
|
|
209
|
-
*
|
|
210
|
-
* §3.5.1: ref snapshots are the load-bearing fix for the lag-time
|
|
211
|
-
* overwrite scenario. If a listener references a non-trigger block's
|
|
212
|
-
* output (e.g. `evaluateBlock.output.claimId`), that value is captured
|
|
213
|
-
* here at queue time. Resolution at invocation time prefers the snapshot
|
|
214
|
-
* over current state, so multiple queued invocations don't drift when
|
|
215
|
-
* the source re-runs.
|
|
216
|
-
*/
|
|
217
|
-
refSnapshots: Record<string, unknown>;
|
|
218
|
-
/** DID of the assigned actor who must invoke this listener. Resolved from `props.assignment.assignedActor.did`. */
|
|
219
|
-
assigneeDid: string;
|
|
220
|
-
/** ISO timestamp when the source emission happened. */
|
|
221
|
-
emittedAt: string;
|
|
222
|
-
/** ISO timestamp after which this pending invocation is considered expired. Resolved from `FlowCapability.ttl` at queue time. */
|
|
223
|
-
expiresAt: string;
|
|
170
|
+
declare function validateActionProof(action: Pick<ActionDefinition, 'type' | 'sideEffect'> & {
|
|
171
|
+
proof?: ActionProofDeclaration;
|
|
172
|
+
}, output: Record<string, unknown>): ProofValidationResult;
|
|
173
|
+
|
|
174
|
+
type CompletionVerificationStatus = 'verified' | 'unverified' | 'not_completed';
|
|
175
|
+
interface CompletionVerification {
|
|
176
|
+
status: CompletionVerificationStatus;
|
|
177
|
+
/** Populated when status is 'unverified'. */
|
|
178
|
+
reason?: string;
|
|
224
179
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
* Implementation: simple deterministic string concatenation, hashed via a
|
|
235
|
-
* 32-bit FNV-1a. The id is short and stable; collision risk within a single
|
|
236
|
-
* flow is negligible because the inputs are scoped (block ids are unique
|
|
237
|
-
* within a flow, run ids are unique within a block).
|
|
238
|
-
*/
|
|
239
|
-
declare function computePendingInvocationId(args: {
|
|
240
|
-
sourceBlockId: string;
|
|
241
|
-
sourceRunId: string;
|
|
242
|
-
listenerBlockId: string;
|
|
243
|
-
eventName: string;
|
|
244
|
-
eventIndex: number;
|
|
245
|
-
}): string;
|
|
246
|
-
/**
|
|
247
|
-
* Walk an inputs object and collect every RuntimeRef of the form
|
|
248
|
-
* `nodeId.output.fieldPath`. Returns a map of `{refString: resolvedValue}`
|
|
249
|
-
* suitable for storing as `PendingInvocation.refSnapshots`.
|
|
250
|
-
*
|
|
251
|
-
* The walker mirrors `resolveRuntimeRefs` in `flowCompiler/resolveRefs.ts`
|
|
252
|
-
* but reads instead of resolving — it captures the current value of each
|
|
253
|
-
* ref so the listener can later resolve against the snapshot rather than
|
|
254
|
-
* against current state.
|
|
255
|
-
*
|
|
256
|
-
* See `docs/events-and-triggers-plan.md` §3.5.1.
|
|
257
|
-
*/
|
|
258
|
-
declare function snapshotInputRefs(inputs: unknown, getNodeOutput: (nodeId: string) => Record<string, unknown> | undefined): Record<string, unknown>;
|
|
259
|
-
/**
|
|
260
|
-
* Get the top-level pending invocations Y.Map from the editor's yDoc.
|
|
261
|
-
* Lazily creates it if missing.
|
|
262
|
-
*
|
|
263
|
-
* Shape: `Y.Map<blockId, Y.Map<pendingInvocationId, PendingInvocation>>`.
|
|
264
|
-
* The outer map is keyed by listener block id; the inner map is keyed by
|
|
265
|
-
* deterministic pending invocation id (see `computePendingInvocationId`).
|
|
266
|
-
*/
|
|
267
|
-
declare function getPendingInvocationsMap(yDoc: Y.Doc): Y.Map<Y.Map<unknown>>;
|
|
268
|
-
/**
|
|
269
|
-
* Get the inner pending-invocations map for a specific listener block.
|
|
270
|
-
* Lazily creates it if missing. Caller is responsible for being inside a
|
|
271
|
-
* Yjs transaction if atomic creation matters.
|
|
272
|
-
*/
|
|
273
|
-
declare function getOrCreateBlockPendingMap(yDoc: Y.Doc, blockId: string): Y.Map<unknown>;
|
|
274
|
-
/**
|
|
275
|
-
* Read all pending invocations for a block as plain JS objects.
|
|
276
|
-
* Returns an array sorted by `emittedAt` ascending (oldest first).
|
|
277
|
-
*/
|
|
278
|
-
declare function readPendingInvocations(yDoc: Y.Doc, blockId: string): PendingInvocation[];
|
|
279
|
-
/**
|
|
280
|
-
* Idempotently write a pending invocation under its deterministic id.
|
|
281
|
-
*
|
|
282
|
-
* Returns true if a new entry was created, false if the id already
|
|
283
|
-
* existed (meaning another client or a previous reconciliation pass
|
|
284
|
-
* already queued this invocation). This is the property that makes
|
|
285
|
-
* `reconcilePendingInvocations` safe to run from multiple clients
|
|
286
|
-
* simultaneously and across page refreshes — see plan §18.
|
|
287
|
-
*
|
|
288
|
-
* Wraps the write in a Yjs transaction so the existence check and the
|
|
289
|
-
* subsequent set are atomic from the local client's perspective. Concurrent
|
|
290
|
-
* clients each computing the same id will all converge to a single entry
|
|
291
|
-
* because Y.Map.set with the same key is last-writer-wins on identical
|
|
292
|
-
* content.
|
|
293
|
-
*/
|
|
294
|
-
declare function queuePendingInvocation(yDoc: Y.Doc, listenerBlockId: string, invocation: PendingInvocation): boolean;
|
|
295
|
-
/**
|
|
296
|
-
* Remove a pending invocation by id. Used when the assignee completes the
|
|
297
|
-
* invocation (transitioning to a `block.run` audit trail entry) or when
|
|
298
|
-
* the expiration sweep marks it as expired.
|
|
299
|
-
*/
|
|
300
|
-
declare function removePendingInvocation(yDoc: Y.Doc, listenerBlockId: string, pendingInvocationId: string): boolean;
|
|
301
|
-
/**
|
|
302
|
-
* Append a run record to the audit trail for a block. Run records are
|
|
303
|
-
* stored as audit trail events with `type: 'block.run'` and the structured
|
|
304
|
-
* data in `details`. Per Phase 0 #2 of eng review pass 2, this avoids
|
|
305
|
-
* inventing a parallel `_yRunHistory` storage system.
|
|
306
|
-
*
|
|
307
|
-
* Y.Array.push from concurrent clients merges correctly — verified by the
|
|
308
|
-
* existing `useAuditTrail` shipping in production.
|
|
309
|
-
*/
|
|
310
|
-
declare function appendRunRecord(yDoc: Y.Doc, blockId: string, details: RunRecordDetails, userId: string): void;
|
|
311
|
-
/**
|
|
312
|
-
* Read all run records for a block from the audit trail. Filters audit
|
|
313
|
-
* trail entries to only those with `type: 'block.run'`.
|
|
314
|
-
*/
|
|
315
|
-
declare function readRunRecords(yDoc: Y.Doc, blockId: string): RunRecordDetails[];
|
|
316
|
-
/**
|
|
317
|
-
* A failed listener run, attributed to the source block emission that
|
|
318
|
-
* triggered it. Used by the failure visibility surface (CP-1) on source
|
|
319
|
-
* blocks: the source block can show "N listeners failed for your last run".
|
|
320
|
-
*/
|
|
321
|
-
interface FailedListenerRun {
|
|
322
|
-
/** Block id of the listener whose run failed. */
|
|
323
|
-
listenerBlockId: string;
|
|
324
|
-
/** The full RunRecordDetails of the failed listener invocation. */
|
|
325
|
-
record: RunRecordDetails;
|
|
180
|
+
interface VerifyCompletionParams {
|
|
181
|
+
runtime: FlowNodeRuntimeState | undefined | null;
|
|
182
|
+
blockId: string;
|
|
183
|
+
/** Action type of the block, used to re-check the proof declaration. */
|
|
184
|
+
actionType?: string;
|
|
185
|
+
/** Invocation lookup, typically backed by the doc's `invocations` Y.Map. */
|
|
186
|
+
getInvocation?: (cid: string) => StoredInvocation | undefined | null;
|
|
187
|
+
/** Flow schema version; UCAN binding is only required when the version policy demands it. */
|
|
188
|
+
schemaVersion?: string;
|
|
326
189
|
}
|
|
327
190
|
/**
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
*
|
|
341
|
-
* invocation
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
declare function replayFailedListenerRun(yDoc: Y.Doc, failedRecord: RunRecordDetails, listenerBlockId: string, originalPayload: Record<string, unknown>, originalRefSnapshots: Record<string, unknown>, assigneeDid: string): boolean;
|
|
191
|
+
* Decide whether a block's `state: 'completed'` can be trusted.
|
|
192
|
+
*
|
|
193
|
+
* Anyone with room write access can set `completed` directly in the runtime
|
|
194
|
+
* Y.Map — a completion is only *verified* when it carries the evidence the
|
|
195
|
+
* execution kernel writes:
|
|
196
|
+
*
|
|
197
|
+
* 1. Proof of execution per the action's `proof` declaration (all versions).
|
|
198
|
+
* 2. On UCAN-enforced flows (policy.ucanRequired), a `lastInvocationCid`
|
|
199
|
+
* that resolves in the invocation store to a successful invocation for
|
|
200
|
+
* this block.
|
|
201
|
+
*
|
|
202
|
+
* The invocation check is store-level PRESENCE, not a cryptographic
|
|
203
|
+
* re-verification of the CAR bytes: signatures are validated when the
|
|
204
|
+
* invocation is minted, but the `invocations` Y.Map is room-writable, so a
|
|
205
|
+
* member with write access can forge a matching `{ result: 'success', blockId }`
|
|
206
|
+
* entry and pass this check. This raises the bar (a completion must at least
|
|
207
|
+
* reference a resolvable, successful, block-matching invocation) but does NOT
|
|
208
|
+
* make completions unforgeable — that needs read-time CAR-signature
|
|
209
|
+
* re-verification against the delegation chain (open trust-model decision, H3).
|
|
210
|
+
* Do not describe a completion that passes here as "impossible to forge".
|
|
211
|
+
*
|
|
212
|
+
* Consumers gate on this instead of raw `state === 'completed'`:
|
|
213
|
+
* trigger reconciliation (event sources), flow-agent planning (Done
|
|
214
|
+
* classification), and the FlowView completion badge.
|
|
215
|
+
*/
|
|
216
|
+
declare function verifyCompletion(params: VerifyCompletionParams): CompletionVerification;
|
|
217
|
+
declare function isVerifiedCompletion(params: VerifyCompletionParams): boolean;
|
|
356
218
|
|
|
357
219
|
declare function reconcilePendingInvocations(editor: IxoEditorType): void;
|
|
358
220
|
declare function getActionForBlock(block: any): ReturnType<typeof getAction>;
|
|
@@ -371,6 +233,62 @@ declare function writeRunRecordAndReconcile(editor: IxoEditorType, blockId: stri
|
|
|
371
233
|
sourceRunId?: string;
|
|
372
234
|
}): void;
|
|
373
235
|
|
|
236
|
+
/**
|
|
237
|
+
* Flow Version Manifest
|
|
238
|
+
*
|
|
239
|
+
* Single source of truth for what each schema version requires.
|
|
240
|
+
* Blocks and components read policy hints rather than checking version strings directly.
|
|
241
|
+
*/
|
|
242
|
+
type FlowVersionString = '0.3' | '1.0.0';
|
|
243
|
+
interface VersionPolicyUi {
|
|
244
|
+
/** Show the delegation management panel in block config */
|
|
245
|
+
showDelegationPanel: boolean;
|
|
246
|
+
/** Show the whitelist (specific actors) option in authorization config */
|
|
247
|
+
showWhitelistConfig: boolean;
|
|
248
|
+
/** Show the "anyone with flow access" option in authorization config */
|
|
249
|
+
showAnyoneConfig: boolean;
|
|
250
|
+
/** Show a banner when a newer version is available */
|
|
251
|
+
showMigrationBanner: boolean;
|
|
252
|
+
/** Require PIN entry for block execution (invocation signing) */
|
|
253
|
+
requirePinForExecution: boolean;
|
|
254
|
+
}
|
|
255
|
+
interface VersionPolicy {
|
|
256
|
+
/** Semver-style version identifier */
|
|
257
|
+
version: FlowVersionString;
|
|
258
|
+
/** Human-readable label */
|
|
259
|
+
label: string;
|
|
260
|
+
/** Whether UCAN delegation chains are required for all executions */
|
|
261
|
+
ucanRequired: boolean;
|
|
262
|
+
/** Whether a root delegation must exist before any execution */
|
|
263
|
+
delegationRootRequired: boolean;
|
|
264
|
+
/** Whether whitelist-only authorization (no parentCapability) is acceptable */
|
|
265
|
+
whitelistOnlyAllowed: boolean;
|
|
266
|
+
/** Whether unrestricted access (no authorisedActors, no parentCapability) is acceptable */
|
|
267
|
+
unrestrictedAllowed: boolean;
|
|
268
|
+
/** Which execution path to use */
|
|
269
|
+
executionPath: 'legacy' | 'invocation';
|
|
270
|
+
/** Which authorization function to use */
|
|
271
|
+
authorizationFn: 'v1' | 'v2';
|
|
272
|
+
/** Allowed authorization modes in the UI */
|
|
273
|
+
allowedAuthModes: Array<'anyone' | 'actors' | 'capability'>;
|
|
274
|
+
/** UI rendering hints — blocks query these instead of checking version strings */
|
|
275
|
+
ui: VersionPolicyUi;
|
|
276
|
+
/** Human-readable description of this version */
|
|
277
|
+
description: string;
|
|
278
|
+
}
|
|
279
|
+
declare const VERSION_MANIFEST: Record<FlowVersionString, VersionPolicy>;
|
|
280
|
+
/** The version stamped on newly created flows */
|
|
281
|
+
declare const LATEST_VERSION: FlowVersionString;
|
|
282
|
+
/**
|
|
283
|
+
* Get the policy for a given schema version.
|
|
284
|
+
* Unknown versions fall back to the strictest (latest) policy.
|
|
285
|
+
*/
|
|
286
|
+
declare function getVersionPolicy(version: string): VersionPolicy;
|
|
287
|
+
/**
|
|
288
|
+
* Check whether `current` is at least `minimum` in the migration path.
|
|
289
|
+
*/
|
|
290
|
+
declare function isVersionAtLeast(current: string, minimum: FlowVersionString): boolean;
|
|
291
|
+
|
|
374
292
|
/**
|
|
375
293
|
* Writes compiled blocks into BlockNote's collaborative XmlFragment using the
|
|
376
294
|
* ProseMirror/Yjs structure that BlockNote reads from collaboration.
|
|
@@ -572,7 +490,7 @@ interface ExecuteFlowAgentCoreCommandOptions {
|
|
|
572
490
|
actorType: 'entity' | 'user';
|
|
573
491
|
entityRoomId?: string;
|
|
574
492
|
actionServices?: ActionServices;
|
|
575
|
-
actionHandlers?:
|
|
493
|
+
actionHandlers?: ActionHandlers;
|
|
576
494
|
delegationStore?: UcanDelegationStore;
|
|
577
495
|
delegations?: StoredDelegation[];
|
|
578
496
|
invocationStore?: InvocationStore;
|
|
@@ -593,10 +511,25 @@ interface ClassifyNodeStateInput {
|
|
|
593
511
|
runtime: FlowNodeRuntimeState;
|
|
594
512
|
now: number;
|
|
595
513
|
pendingInvocationCount?: number;
|
|
514
|
+
/**
|
|
515
|
+
* Verification of a `completed` runtime entry (see
|
|
516
|
+
* `flowEngine/verifiedCompletion.ts`). When provided and 'unverified', the
|
|
517
|
+
* node classifies as Blocked instead of Done — the planner must not advance
|
|
518
|
+
* past a completion that lacks proof or a valid invocation. Omitted ⇒
|
|
519
|
+
* legacy behavior (completed = Done).
|
|
520
|
+
*/
|
|
521
|
+
completionVerification?: CompletionVerification;
|
|
522
|
+
/**
|
|
523
|
+
* Whether this block's action is a repeatable ('many') capability. A
|
|
524
|
+
* repeatable block that has fired (`completed`) is classified 'Active', not
|
|
525
|
+
* 'Done' — it is a standing capability, never a finished task. See
|
|
526
|
+
* `ActionDefinition.cardinality`.
|
|
527
|
+
*/
|
|
528
|
+
isRepeatable?: boolean;
|
|
596
529
|
}
|
|
597
530
|
declare function classifyBlockerCause(block: unknown, runtime: FlowNodeRuntimeState): FlowAgentBlockerCause | undefined;
|
|
598
|
-
declare function classifyNodeState({ block, runtime, now, pendingInvocationCount }: ClassifyNodeStateInput): FlowAgentPublicNodeState;
|
|
599
|
-
declare function snapshotNode(block: unknown, runtime: FlowNodeRuntimeState, now: number, pendingInvocationCount?: number): FlowAgentNodeSnapshot;
|
|
531
|
+
declare function classifyNodeState({ block, runtime, now, pendingInvocationCount, completionVerification, isRepeatable, }: ClassifyNodeStateInput): FlowAgentPublicNodeState;
|
|
532
|
+
declare function snapshotNode(block: unknown, runtime: FlowNodeRuntimeState, now: number, pendingInvocationCount?: number, completionVerification?: CompletionVerification, isRepeatable?: boolean): FlowAgentNodeSnapshot;
|
|
600
533
|
|
|
601
534
|
/**
|
|
602
535
|
* Compute an IPFS-compatible CID for arbitrary content.
|
|
@@ -725,4 +658,4 @@ declare function createOracleInitFlowTemplate(): {
|
|
|
725
658
|
nodes: FlowNode[];
|
|
726
659
|
};
|
|
727
660
|
|
|
728
|
-
export { ActionDefinition, ActionServices, type AddFlowNodeOptions, type BlockConditionInput, type ClassifyNodeStateInput, CompiledBlock, CompiledEdge, CompiledFlow, type
|
|
661
|
+
export { ActionDefinition, ActionHandlers, type ActionManifest, type ActionManifestEntry, ActionServices, type AddFlowNodeOptions, type BlockConditionInput, type ClassifyNodeStateInput, CompiledBlock, CompiledEdge, CompiledFlow, type CompletionVerification, type CompletionVerificationStatus, type EvaluatorOperator, type ExecuteFlowAgentCoreCommandOptions, type ExecuteQueuedFlowAgentCoreCommandsOptions, FlowAgentBlockerCause, FlowAgentCommand, FlowAgentCommandResult, FlowAgentContext, FlowAgentExecutor, FlowAgentNodeSnapshot, FlowAgentPublicNodeState, type FlowDocumentNode, type FlowDocumentRead, FlowNode, FlowNodeRuntimeState, type FlowVersionString, InvocationStore, LATEST_VERSION, type ManifestProofDeclaration, OutputSchemaField, PROOF_MISSING_CODE, type ProofValidationResult, RunRecordDetails, STEP_COMPLETED_EVENT, STEP_COMPLETED_EVENT_NAME, StoredDelegation, StoredInvocation, type TriggerResolutionContext, UcanDelegationStore, UcanService, VERSION_MANIFEST, type VersionPolicy, addFlowNode, buildBlockConditionsProp, buildServicesFromHandlers, canToType, classifyBlockerCause, classifyNodeState, computeCID, computeJsonCID, createOracleInitFlowTemplate, executeFlowAgentCoreCommand, executeQueuedFlowAgentCoreCommands, generateActionManifest, getAction, getActionByCan, getActionForBlock, getAliasEntries, getAllActions, getAllCanMappings, getEventsForBlock, getOutputSchemaForBlock, getVersionPolicy, hasAction, isVerifiedCompletion, isVersionAtLeast, oracleInitSurveySchema, readBlocksFromFragment, readFlowDocument, reconcilePendingInvocations, registerAction, removeBlockFromFragment, removeFlowNode, reorderFlowNodes, replaceBlockInFragment, resetStepRuntime, resolveRuntimeRefs, setBlockProps, setFormAnswers, snapshotNode, swapFlowBlocks, toEvaluatorOperator, typeToCan, updateNodeRuntime, validateActionProof, verifyCompletion, writeCompiledBlocksToFragment, writeRunRecordAndReconcile };
|
package/dist/core/index.js
CHANGED
|
@@ -8,12 +8,15 @@ import {
|
|
|
8
8
|
setFormAnswers,
|
|
9
9
|
swapFlowBlocks,
|
|
10
10
|
updateNodeRuntime
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-EOMC6ZVX.js";
|
|
12
12
|
import {
|
|
13
13
|
FlowAgentService,
|
|
14
|
+
LATEST_VERSION,
|
|
15
|
+
PROOF_MISSING_CODE,
|
|
14
16
|
RUN_RECORD_AUDIT_TYPE,
|
|
15
17
|
STEP_COMPLETED_EVENT,
|
|
16
18
|
STEP_COMPLETED_EVENT_NAME,
|
|
19
|
+
VERSION_MANIFEST,
|
|
17
20
|
acquireFlowAgentLease,
|
|
18
21
|
appendAgentLedgerEvent,
|
|
19
22
|
appendRunRecord,
|
|
@@ -45,10 +48,12 @@ import {
|
|
|
45
48
|
executeQueuedAgentCommands,
|
|
46
49
|
executeQueuedFlowAgentCoreCommands,
|
|
47
50
|
findFailedListenersForSourceRun,
|
|
51
|
+
generateActionManifest,
|
|
48
52
|
getAction,
|
|
49
53
|
getActionByCan,
|
|
50
54
|
getActionForBlock,
|
|
51
55
|
getActiveEditor,
|
|
56
|
+
getAliasEntries,
|
|
52
57
|
getAllActions,
|
|
53
58
|
getAllCanMappings,
|
|
54
59
|
getEventsForBlock,
|
|
@@ -56,11 +61,14 @@ import {
|
|
|
56
61
|
getOrCreateBlockPendingMap,
|
|
57
62
|
getOutputSchemaForBlock,
|
|
58
63
|
getPendingInvocationsMap,
|
|
64
|
+
getVersionPolicy,
|
|
59
65
|
hasAction,
|
|
60
66
|
isAuthorized,
|
|
61
67
|
isCapabilityMatch,
|
|
62
68
|
isExternalMutation,
|
|
63
69
|
isRuntimeRef,
|
|
70
|
+
isVerifiedCompletion,
|
|
71
|
+
isVersionAtLeast,
|
|
64
72
|
mergeCompiledFlows,
|
|
65
73
|
planRalphLoopCommands,
|
|
66
74
|
queueAgentCommand,
|
|
@@ -92,11 +100,13 @@ import {
|
|
|
92
100
|
toEvaluatorOperator,
|
|
93
101
|
typeToCan,
|
|
94
102
|
updateAgentCommand,
|
|
103
|
+
validateActionProof,
|
|
95
104
|
validateAgentCommand,
|
|
96
105
|
validateFlowAgentLease,
|
|
106
|
+
verifyCompletion,
|
|
97
107
|
writeCompiledBlocksToFragment,
|
|
98
108
|
writeRunRecordAndReconcile
|
|
99
|
-
} from "../chunk-
|
|
109
|
+
} from "../chunk-5TJK6JKV.js";
|
|
100
110
|
import {
|
|
101
111
|
computeCID,
|
|
102
112
|
computeJsonCID
|
|
@@ -483,9 +493,12 @@ function createOracleInitFlowTemplate() {
|
|
|
483
493
|
}
|
|
484
494
|
export {
|
|
485
495
|
FlowAgentService,
|
|
496
|
+
LATEST_VERSION,
|
|
497
|
+
PROOF_MISSING_CODE,
|
|
486
498
|
RUN_RECORD_AUDIT_TYPE,
|
|
487
499
|
STEP_COMPLETED_EVENT,
|
|
488
500
|
STEP_COMPLETED_EVENT_NAME,
|
|
501
|
+
VERSION_MANIFEST,
|
|
489
502
|
acquireFlowAgentLease,
|
|
490
503
|
addFlowNode,
|
|
491
504
|
appendAgentLedgerEvent,
|
|
@@ -521,10 +534,12 @@ export {
|
|
|
521
534
|
executeQueuedAgentCommands,
|
|
522
535
|
executeQueuedFlowAgentCoreCommands,
|
|
523
536
|
findFailedListenersForSourceRun,
|
|
537
|
+
generateActionManifest,
|
|
524
538
|
getAction,
|
|
525
539
|
getActionByCan,
|
|
526
540
|
getActionForBlock,
|
|
527
541
|
getActiveEditor,
|
|
542
|
+
getAliasEntries,
|
|
528
543
|
getAllActions,
|
|
529
544
|
getAllCanMappings,
|
|
530
545
|
getEventsForBlock,
|
|
@@ -532,11 +547,14 @@ export {
|
|
|
532
547
|
getOrCreateBlockPendingMap,
|
|
533
548
|
getOutputSchemaForBlock,
|
|
534
549
|
getPendingInvocationsMap,
|
|
550
|
+
getVersionPolicy,
|
|
535
551
|
hasAction,
|
|
536
552
|
isAuthorized,
|
|
537
553
|
isCapabilityMatch,
|
|
538
554
|
isExternalMutation,
|
|
539
555
|
isRuntimeRef,
|
|
556
|
+
isVerifiedCompletion,
|
|
557
|
+
isVersionAtLeast,
|
|
540
558
|
mergeCompiledFlows,
|
|
541
559
|
oracleInitSurveySchema,
|
|
542
560
|
planRalphLoopCommands,
|
|
@@ -577,8 +595,10 @@ export {
|
|
|
577
595
|
typeToCan,
|
|
578
596
|
updateAgentCommand,
|
|
579
597
|
updateNodeRuntime,
|
|
598
|
+
validateActionProof,
|
|
580
599
|
validateAgentCommand,
|
|
581
600
|
validateFlowAgentLease,
|
|
601
|
+
verifyCompletion,
|
|
582
602
|
writeCompiledBlocksToFragment,
|
|
583
603
|
writeRunRecordAndReconcile
|
|
584
604
|
};
|