@ixo/editor 6.31.0 → 6.31.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.
@@ -1,15 +1,39 @@
1
- import { an as CompiledBlock, W as CompiledFlow, ao as CompiledEdge, af as FlowAgentCommand, ah as FlowAgentContext, ag as FlowAgentCommandResult, ai as FlowAgentExecutor, ak as FlowAgentNodeSnapshot, ap as FlowAgentBlockerCause, al as FlowAgentPublicNodeState, Q as FlowConnectionBinding } from '../store-CqvAkvIZ.js';
2
- export { aH as AcquireFlowAgentLeaseParams, as as ActionBlockLike, at as ActionExecutionCompletionState, aX as ActorConstraint, A as AuthorizationResult, U as BaseUcanFlow, au as BuildActionRunInputsParams, av as BuildActionRunInputsResult, ad as BuildFlowAgentContextParams, a_ as CompiledFlowNode, L as CompilerRegistry, aW as ConditionRef, aI as CreateAgentCommandParams, aJ as EvaluateFlowAgentPolicyParams, aw as ExecuteActionBlockParams, ax as ExecuteActionBlockResult, E as ExecuteNodeParams, d as ExecutionContext, c as ExecutionOutcome, G as FLOW_CONNECTIONS_MAP_KEY, H as FLOW_CONNECTION_BINDINGS_MAP_KEY, F as FLOW_PARTICIPANTS_MAP_KEY, ae as FlowAgentActor, aM as FlowAgentCommandBase, aN as FlowAgentCommandStatus, aO as FlowAgentCommandType, aj as FlowAgentLease, aP as FlowAgentLedgerEvent, aQ as FlowAgentLedgerEventType, aR as FlowAgentMaps, aK as FlowAgentOrchestratorOptions, aS as FlowAgentPolicyDecision, aT as FlowAgentRunPhase, Y as FlowAgentService, aL as FlowAgentServiceOptions, am as FlowAgentTickResult, V as FlowCapability, P as FlowConnection, T as FlowConnectionRequirementKey, O as FlowParticipant, X as FlowStrategy, M as MergeResult, N as NodeActionResult, R as ReadFlowOptions, J as ReadFlowResult, aZ as RuntimeRef, S as SetupFlowOptions, I as SetupFlowResult, aY as TTLConstraint, aV as TriggerResolutionContext, a$ as TriggerSpec, Z as acquireFlowAgentLease, _ as appendAgentLedgerEvent, aq as buildActionRunInputs, a as buildAuthzFromProps, $ as buildFlowAgentContext, b as buildFlowNodeFromBlock, ay as canMatches, a0 as cleanupExpiredFlowAgentLeases, k as compileBaseUcanFlow, az as computeAgentCommandId, a1 as createAgentCommand, n as decompileToBaseUcanFlow, a2 as evaluateFlowAgentPolicy, ar as executeActionBlock, e as executeNode, a3 as executeQueuedAgentCommands, j as getActiveEditor, a4 as getFlowAgentMaps, i as isAuthorized, aA as isCapabilityMatch, aB as isExternalMutation, b0 as isRuntimeRef, m as mergeCompiledFlows, a5 as planRalphLoopCommands, a6 as queueAgentCommand, aC as readAgentCommands, a7 as readAgentLedgerEvents, l as readCompiledFlowFromYDoc, g as readFlow, aD as readFlowAgentLeases, r as readFlowAsBaseUcan, B as readFlowConnectionBindings, v as readFlowConnections, f as readFlowFromEditor, o as readFlowParticipants, a8 as readQueuedAgentCommands, a9 as releaseFlowAgentLease, x as removeFlowConnection, D as removeFlowConnectionBinding, p as removeFlowParticipant, aE as requiredCapabilityForCommand, aU as resolveRuntimeRefs, aF as resourceMatches, h as setActiveEditor, y as setFlowConnectionOptional, z as setFlowConnectionRequires, q as setFlowParticipantPowerLevel, t as setFlowParticipantRequirements, s as setupFlowFromBaseUcan, aa as tickFlowAgent, aG as updateAgentCommand, w as upsertFlowConnection, C as upsertFlowConnectionBinding, u as upsertFlowParticipant, ab as validateAgentCommand, ac as validateFlowAgentLease } from '../store-CqvAkvIZ.js';
3
- import { af as ActionDefinition, ap as ActionDoneContract, aq as ActionEventDefinition, ar as OutputSchemaField, ab as ActionServices, ag as FlowNodeRuntimeState, ad as RunEventAppender, as as RunEventInput, F as FlowRuntimeStateManager, at as RunJsonValue, au as ActionRunContext, av as CompletionCheck, k as StoredInvocation, aa as PendingInvocation, aw as ActionReadBackMetadata, a9 as IxoEditorType, ax as ReadBackTerminalState, ae as ActionResult, ay as ActionProofDeclaration, az as RunRecordDetails, g as UcanService, ac as ActionHandlers, U as UcanDelegationStore, S as StoredDelegation, I as InvocationStore, aA as FlowMetadata, a6 as FlowNode } from '../index-Up8gA_E9.js';
4
- export { bV as ActionContext, bD as ActionRunEventInput, bZ as BidService, bB as CancelRunParams, c4 as CarbonService, co as ClaimCollectionURI, b_ as ClaimService, bC as CloseRunParams, b$ as CollectionService, c0 as CollectionUsersService, cy as CreateDelegationParams, cz as CreateInvocationParams, cx as CreateRootDelegationParams, cn as DID, D as DelegationChainValidationResult, l as DelegationGrant, bX as EmailService, c5 as EntityService, c6 as EvalRegisterService, a8 as EvaluationStatus, cv as ExecutionWithInvocationResult, ba as ExplicitRunRequiredError, cm as FailedListenerRun, cw as FindProofsResult, bE as FinishRunResult, a7 as FlowNodeAuthzExtension, cs as FlowNodeBase, bx as FlowNotMigratedError, c8 as FlowRunLifecycleService, bW as HttpService, c2 as IntegrationsService, ct as InvocationRequest, cu as InvocationResult, aD as LEGACY_RUN_STORAGE_VERSION, bH as LifecycleRunEventInput, cp as LinkedClaim, aE as MULTI_RUN_STORAGE_VERSION, c1 as MatrixCredentialService, bF as MigrateFlowParams, bG as MigrateFlowResult, be as MultiRunMigrationResult, cq as NodeServiceReport, cr as NodeState, bY as NotifyService, c3 as OracleService, aF as RUNS_TERMINAL_MAP_KEY, cl as RUN_RECORD_AUDIT_TYPE, aG as RUN_STORAGE_VERSION_KEY, c7 as RubricService, bI as RunDefinitionBlock, bJ as RunDefinitionDrift, bK as RunDefinitionSnapshot, bL as RunJsonObject, bN as RunLifecycleAuthorizationDecision, by as RunLifecycleAuthorizationError, bO as RunLifecycleAuthorizationRequest, bP as RunLifecycleAuthorizer, bQ as RunLifecycleCapability, bM as RunLogEventInput, bR as RunManifest, bd as RunMeta, bz as RunNotMigratedError, bA as RunNotReadyError, bS as RunSnapshot, bf as RunStorageVersion, bg as RunTerminalRecord, bT as StartRunParams, bU as StartRunResult, bb as TerminalRunExecutionError, j as UcanCapability, h as UcanServiceConfig, i as UcanServiceHandlers, bc as UnknownRunError, aH as adoptLegacyRuntime, c9 as appendRunRecord, a$ as assertRunActionExecutionAllowed, bh as buildRunDefinitionSnapshot, bi as cancelRun, aI as clearAllActionState, aC as clearRuntimeForTemplateClone, bj as closeRun, aJ as collectPhantomLegacyRun, ck as computePendingInvocationId, bk as computeRunDefinitionHash, bl as computeRunSummary, cc as countPendingInvocations, d as createInvocationStore, e as createMemoryInvocationStore, b as createMemoryUcanDelegationStore, bm as createRunId, aK as createRunRuntimeReader, aL as createRunRuntimeReaderWithDoc, aM as createRunScopedRuntimeManager, bn as createRunUlid, c as createRuntimeStateManager, a as createUcanDelegationStore, f as createUcanService, aB as createYDocRuntimeManager, aN as deleteActionState, bo as detectRunDefinitionDrift, aO as enableMultiRunStorage, aP as ensureRun, ch as findFailedListenersForSourceRun, cd as getOrCreateBlockPendingMap, cb as getPendingInvocationsMap, aQ as getRunActionsMap, aR as getRunMeta, aU as getRunStorageVersion, aS as getRunsMap, aT as getRunsTerminalMap, aV as hasLegacyRuntimeHistory, b0 as isBelowTheLineBlock, aW as isLegacyRuntimeAdoptionEnabled, aX as isRecordInRun, bp as listOpenRuns, bq as listRuns, br as migrateFlowToSessions, cf as queuePendingInvocation, aY as readActionState, aZ as readActionStates, ce as readPendingInvocations, bs as readRunActionStates, ca as readRunRecords, bt as recordRunDefinitionDrift, cg as removePendingInvocation, ci as replayFailedListenerRun, a_ as resetActionState, b1 as resolveActiveRunId, b2 as resolveRecordRunId, b3 as resolveRunIdForExecution, b4 as resolveRunIdForRead, b5 as seedRunFromLegacyRuntime, bu as setAdvisoryActiveRunId, b6 as setMultiRunStorage, cj as snapshotInputRefs, bv as startRun, b7 as subscribeToActionState, bw as toRunJsonValue, b8 as usesLegacyRuntimeCompatibility, b9 as writeActionState } from '../index-Up8gA_E9.js';
1
+ import { k as FlowAgentExecutor, h as FlowAgentCommand, j as FlowAgentContext, i as FlowAgentCommandResult, an as FlowAgentBlockerCause, n as FlowAgentPublicNodeState, m as FlowAgentNodeSnapshot, ao as CompiledBlock, C as CompiledFlow, ap as CompiledEdge, s as FlowConnectionBinding } from '../connections-B24zj0RI.js';
2
+ export { aq as AcquireFlowAgentLeaseParams, ar as ActionBlockLike, as as ActionExecutionCompletionState, at as ActorConstraint, A as AuthorizationResult, B as BaseUcanFlow, au as BuildActionRunInputsParams, av as BuildActionRunInputsResult, a as BuildFlowAgentContextParams, aw as CompiledFlowNode, b as CompilerRegistry, ax as ConditionRef, ay as CreateAgentCommandParams, az as EvaluateFlowAgentPolicyParams, aA as ExecuteActionBlockParams, aB as ExecuteActionBlockResult, E as ExecuteNodeParams, c as ExecutionContext, d as ExecutionOutcome, F as FLOW_CONNECTIONS_MAP_KEY, e as FLOW_CONNECTION_BINDINGS_MAP_KEY, f as FLOW_PARTICIPANTS_MAP_KEY, g as FlowAgentActor, aC as FlowAgentCommandBase, aD as FlowAgentCommandStatus, aE as FlowAgentCommandType, l as FlowAgentLease, aF as FlowAgentLedgerEvent, aG as FlowAgentLedgerEventType, aH as FlowAgentMaps, aI as FlowAgentOrchestratorOptions, aJ as FlowAgentPolicyDecision, aK as FlowAgentRunPhase, o as FlowAgentService, aL as FlowAgentServiceOptions, p as FlowAgentTickResult, q as FlowCapability, r as FlowConnection, t as FlowConnectionRequirementKey, u as FlowParticipant, v as FlowStrategy, M as MergeResult, N as NodeActionResult, R as ReadFlowOptions, w as ReadFlowResult, aM as RuntimeRef, S as SetupFlowOptions, y as SetupFlowResult, aN as TTLConstraint, aO as TriggerResolutionContext, aP as TriggerSpec, z as acquireFlowAgentLease, D as appendAgentLedgerEvent, aQ as buildActionRunInputs, G as buildAuthzFromProps, H as buildFlowAgentContext, I as buildFlowNodeFromBlock, aR as canMatches, J as cleanupExpiredFlowAgentLeases, K as compileBaseUcanFlow, aS as computeAgentCommandId, L as createAgentCommand, O as decompileToBaseUcanFlow, P as evaluateFlowAgentPolicy, aT as executeActionBlock, Q as executeNode, T as executeQueuedAgentCommands, U as getActiveEditor, V as getFlowAgentMaps, W as isAuthorized, aU as isCapabilityMatch, aV as isExternalMutation, aW as isRuntimeRef, X as mergeCompiledFlows, Y as planRalphLoopCommands, Z as queueAgentCommand, aX as readAgentCommands, _ as readAgentLedgerEvents, $ as readCompiledFlowFromYDoc, a0 as readFlow, aY as readFlowAgentLeases, a1 as readFlowAsBaseUcan, a2 as readFlowConnectionBindings, a3 as readFlowConnections, a4 as readFlowFromEditor, a5 as readFlowParticipants, a6 as readQueuedAgentCommands, a7 as releaseFlowAgentLease, a8 as removeFlowConnection, a9 as removeFlowConnectionBinding, aa as removeFlowParticipant, aZ as requiredCapabilityForCommand, a_ as resolveRuntimeRefs, a$ as resourceMatches, ab as setActiveEditor, ac as setFlowConnectionOptional, ad as setFlowConnectionRequires, ae as setFlowParticipantPowerLevel, af as setFlowParticipantRequirements, ag as setupFlowFromBaseUcan, ah as tickFlowAgent, b0 as updateAgentCommand, ai as upsertFlowConnection, aj as upsertFlowConnectionBinding, ak as upsertFlowParticipant, al as validateAgentCommand, am as validateFlowAgentLease } from '../connections-B24zj0RI.js';
3
+ import { au as TopicSemanticRecordDefinition, av as TopicActionMetadata, aw as ActionEventDefinition, ax as ActionDoneContract, aj as ActionDefinition, ay as OutputSchemaField, az as ActionRiskTier, aA as ActionSchedulingContract, ab as ActionServices, aB as TopicActionInvocationV1, aC as TopicActionReceiptV2, aD as TopicActionRecord, aE as TopicActionRuntimeProvider, af as TopicActionBridge, ah as TopicActionWriteBackResult, ai as FlowNodeRuntimeState, aF as RunEventInput, ad as RunEventAppender, F as FlowRuntimeStateManager, aG as RunJsonValue, aH as ActionRunContext, aI as CompletionCheck, w as StoredInvocation, aJ as ReadBackTerminalState, ag as ActionResult, aK as ActionReadBackMetadata, a9 as IxoEditorType, aa as PendingInvocation, aL as ActionProofDeclaration, aM as RunRecordDetails, G as UcanService, ac as ActionHandlers, z as UcanDelegationStore, v as StoredDelegation, g as InvocationStore, aN as FlowMetadata, a7 as FlowNode } from '../runtime-DFPayq89.js';
4
+ export { aO as ActionContext, aP as ActionRunEventInput, aQ as AgentRuntimeService, aR as BidService, aS as CancelRunParams, aT as CarbonService, aU as ClaimCollectionURI, aV as ClaimService, aW as CloseRunParams, aX as CollectionService, aY as CollectionUsersService, aZ as CreateDelegationParams, a_ as CreateInvocationParams, a$ as CreateRootDelegationParams, b0 as DID, D as DelegationChainValidationResult, e as DelegationGrant, b1 as EmailService, b2 as EntityService, b3 as EvalRegisterService, b4 as EvaluationRuntimeService, a8 as EvaluationStatus, b5 as EvidenceService, b6 as ExecutionWithInvocationResult, b7 as ExplicitRunRequiredError, b8 as FailedListenerRun, b9 as FindProofsResult, ba as FinishRunResult, a6 as FlowNodeAuthzExtension, bb as FlowNodeBase, bc as FlowNotMigratedError, bd as FlowRunLifecycleService, be as HttpService, bf as InMemoryTopicActionOutboxStore, bg as IncidentService, bh as IntegrationsService, bi as InvocationRequest, bj as InvocationResult, bk as LEGACY_RUN_STORAGE_VERSION, bl as LifecycleRunEventInput, bm as LinkedClaim, bn as MULTI_RUN_STORAGE_VERSION, bo as MatrixCredentialService, bp as MigrateFlowParams, bq as MigrateFlowResult, br as MultiRunMigrationResult, bs as NodeServiceReport, bt as NodeState, bu as NotifyService, bv as OracleService, bw as RUNS_TERMINAL_MAP_KEY, bx as RUN_RECORD_AUDIT_TYPE, by as RUN_STORAGE_VERSION_KEY, bz as RecordFlowActionPhaseParams, bA as RubricService, bB as RunDefinitionBlock, bC as RunDefinitionDrift, bD as RunDefinitionSnapshot, bE as RunJsonObject, bF as RunLifecycleAuthorizationDecision, bG as RunLifecycleAuthorizationError, bH as RunLifecycleAuthorizationRequest, bI as RunLifecycleAuthorizer, bJ as RunLifecycleCapability, bK as RunLogEventInput, bL as RunManifest, bM as RunMeta, bN as RunNotMigratedError, bO as RunNotReadyError, bP as RunSnapshot, bQ as RunStorageVersion, bR as RunTerminalRecord, bS as SettlementService, bT as StartRunParams, bU as StartRunResult, bV as TerminalRunExecutionError, bW as TopicActionOutboxEntry, bX as TopicActionOutboxStore, bY as TopicActionReceiptSigner, bZ as TopicActionReceiptSink, b_ as TopicActionReceiptStatus, b$ as TopicActionReceiptVerifier, c0 as TopicActionTerminalStatus, c1 as TopicActionThreadUpdateV1, c2 as TopicActionWriteBackState, ae as TopicExecutionContext, c3 as TopicOperationAppendResult, c4 as TopicRevisionConflictError, c5 as TopicService, U as UcanCapability, H as UcanServiceConfig, J as UcanServiceHandlers, c6 as UnknownRunError, c7 as UnsignedTopicActionReceiptV2, c8 as YjsTopicActionOutboxStore, c9 as adoptLegacyRuntime, ca as appendRunRecord, cb as assertRunActionExecutionAllowed, cc as buildRunDefinitionSnapshot, cd as buildTopicActionThreadUpdate, ce as cancelRun, cf as clearAllActionState, cg as clearRuntimeForTemplateClone, ch as closeRun, ci as collectPhantomLegacyRun, cj as computePendingInvocationId, ck as computeRunDefinitionHash, cl as computeRunSummary, cm as countPendingInvocations, Y as createInvocationStore, Z as createMemoryInvocationStore, _ as createMemoryUcanDelegationStore, cn as createRunId, co as createRunRuntimeReader, cp as createRunRuntimeReaderWithDoc, cq as createRunScopedRuntimeManager, cr as createRunUlid, $ as createRuntimeStateManager, a0 as createUcanDelegationStore, a1 as createUcanService, cs as createYDocRuntimeManager, ct as deleteActionState, cu as detectRunDefinitionDrift, cv as enableMultiRunStorage, cw as ensureRun, cx as findFailedListenersForSourceRun, cy as getOrCreateBlockPendingMap, cz as getPendingInvocationsMap, cA as getRunActionsMap, cB as getRunMeta, cC as getRunStorageVersion, cD as getRunsMap, cE as getRunsTerminalMap, cF as hasLegacyRuntimeHistory, cG as isBelowTheLineBlock, cH as isLegacyRuntimeAdoptionEnabled, cI as isRecordInRun, cJ as listOpenRuns, cK as listRuns, cL as migrateFlowToSessions, cM as queuePendingInvocation, cN as readActionState, cO as readActionStates, cP as readPendingInvocations, cQ as readRunActionStates, cR as readRunRecords, cS as recordRunDefinitionDrift, cT as removePendingInvocation, cU as replayFailedListenerRun, cV as resetActionState, cW as resolveActiveRunId, cX as resolveRecordRunId, cY as resolveRunIdForExecution, cZ as resolveRunIdForRead, c_ as seedRunFromLegacyRuntime, c$ as setAdvisoryActiveRunId, d0 as setMultiRunStorage, d1 as snapshotInputRefs, d2 as startRun, d3 as subscribeToActionState, d4 as toRunJsonValue, d5 as topicActionReceiptSigningPayload, d6 as topicActionThreadUpdateBody, d7 as topicActionThreadUpdateId, d8 as topicActionThreadUpdateTransactionId, d9 as topicSemanticRecordsDigest, da as usesLegacyRuntimeCompatibility, db as writeActionState } from '../runtime-DFPayq89.js';
5
5
  import * as Y from 'yjs';
6
- import { Doc, Map } from 'yjs';
7
- export { b as NODE_CONTEXT_MAP_NAME, c as NODE_CONTEXT_OVERRIDES_MAP_NAME, a as NodeContextFieldProvenance, N as NodeContextRecord, i as isNodeContextRecord } from '../nodeContext-C-BsYuYi.js';
6
+ import { Map, Doc } from 'yjs';
7
+ import { ErrorObject } from 'ajv/dist/2020.js';
8
+ export { a as NODE_CONTEXT_MAP_NAME, b as NODE_CONTEXT_OVERRIDES_MAP_NAME, c as NodeContextFieldProvenance, N as NodeContextRecord, i as isNodeContextRecord } from '../nodeContext-CV9D4s3X.js';
8
9
  import 'matrix-js-sdk';
9
10
  import '@blocknote/core';
10
11
  import 'react';
11
12
  import '@ixo/ucan';
12
13
 
14
+ /** Keep the complete record batch comfortably below Matrix's event-size ceiling. */
15
+ declare const MAX_TOPIC_SEMANTIC_RECORDS_PER_RECEIPT = 25;
16
+ declare const MAX_TOPIC_SEMANTIC_RECORD_BATCH_BYTES: number;
17
+ type TopicSemanticRecordValidationResult = {
18
+ valid: true;
19
+ definition: TopicSemanticRecordDefinition;
20
+ } | {
21
+ valid: false;
22
+ code: string;
23
+ errors?: ErrorObject[];
24
+ };
25
+ type TopicSemanticRecordBatchValidationResult = {
26
+ valid: true;
27
+ } | {
28
+ valid: false;
29
+ code: string;
30
+ errors?: ErrorObject[];
31
+ };
32
+ /** Validate the complete safe envelope and its declared value contract. */
33
+ declare function validateTopicSemanticRecord(record: unknown, topic: TopicActionMetadata): TopicSemanticRecordValidationResult;
34
+ /** Validate every record and the bounded, JSON-portable batch written to Matrix. */
35
+ declare function validateTopicSemanticRecordBatch(records: readonly unknown[], topic: TopicActionMetadata): TopicSemanticRecordBatchValidationResult;
36
+
13
37
  /** Stable name of the universal completion event every step emits. */
14
38
  declare const STEP_COMPLETED_EVENT_NAME = "step.completed";
15
39
  /**
@@ -59,7 +83,8 @@ interface CapabilityPatternCoversCanOptions {
59
83
  }
60
84
  /** Return true when a capability pattern grants the requested `can` ability. */
61
85
  declare function capabilityPatternCoversCan(pattern: string, can: string, options?: CapabilityPatternCoversCanOptions): boolean;
62
- declare function registerAction<TInputs extends Record<string, any> = Record<string, any>>(definition: ActionDefinition<TInputs>): void;
86
+ type ActionRegistrationDefinition<TInputs extends Record<string, any>> = Omit<ActionDefinition<TInputs>, 'displayName' | 'description'> & Partial<Pick<ActionDefinition<TInputs>, 'displayName' | 'description'>>;
87
+ declare function registerAction<TInputs extends Record<string, any> = Record<string, any>>(definition: ActionRegistrationDefinition<TInputs>): void;
63
88
  declare function getAction(type: string): ActionDefinition | undefined;
64
89
  declare function getAllActions(): ActionDefinition[];
65
90
  /** All (alias → canonical type) pairs, for manifest generation and consistency checks. */
@@ -88,11 +113,9 @@ declare function getEventsForBlock(action: ActionDefinition | undefined, inputs:
88
113
  */
89
114
  declare function getOutputSchemaForBlock(action: ActionDefinition | undefined, inputs: unknown): OutputSchemaField[];
90
115
 
91
- /**
92
- * Serializable proof declaration: custom `validate` functions can't cross a
93
- * JSON boundary, so they are represented as `{ kind: 'custom' }` — consumers
94
- * know a proof exists and is enforced kernel-side, without its logic.
95
- */
116
+ declare const ACTION_MANIFEST_VERSION: "4";
117
+ declare const ACTION_REGISTRY_VERSION: "6.32.0-topic-actions.3";
118
+ /** Serializable declaration; custom functions remain kernel-enforced. */
96
119
  type ManifestProofDeclaration = {
97
120
  kind: 'none';
98
121
  } | {
@@ -102,61 +125,81 @@ type ManifestProofDeclaration = {
102
125
  kind: 'custom';
103
126
  };
104
127
  interface ManifestDoneDeclaration {
105
- /**
106
- * `default` = one of the two shared standard contracts — a one-shot action
107
- * is Done when its run reached `completed`, a repeatable one never latches
108
- * (read `cardinality` to tell which applies). `custom` = the action defines
109
- * its own predicate, which (like a custom proof) can't cross the JSON
110
- * boundary; ask for an external check or run in-process to evaluate it.
111
- */
112
128
  kind: 'default' | 'custom';
113
- /** Whether an external actor can request a side-effect-free truth check. */
114
129
  hasExternalCheck: boolean;
115
130
  cardinality: 'once' | 'many';
116
131
  }
117
132
  interface ActionManifestEntry {
118
133
  type: string;
119
- /** Legacy names that resolve to this canonical type. */
134
+ displayName: string;
135
+ description: string;
120
136
  aliases: string[];
121
- can?: string;
137
+ contractDigest: `sha256:${string}`;
138
+ can: string;
139
+ effectiveCapability: {
140
+ action: string;
141
+ flowExecution?: string;
142
+ topicWriteBack: string[];
143
+ };
122
144
  sideEffect: boolean;
123
145
  defaultRequiresConfirmation: boolean;
124
- requiredCapability?: string;
146
+ executionOwner: 'agent' | 'human';
147
+ riskTier: ActionRiskTier;
148
+ requiredServices: string[];
149
+ sensitiveInputPaths: string[];
150
+ sensitiveOutputPaths: string[];
151
+ hidden: boolean;
152
+ deprecated: boolean;
153
+ supersededBy?: string;
125
154
  proof: ManifestProofDeclaration;
126
155
  done: ManifestDoneDeclaration;
127
- /** JSON Schema for the action's inputs, when declared. */
128
- inputSchema?: object;
129
- /** Static output schema. Actions with dynamic schemas also set hasDynamicOutputSchema. */
130
- outputSchema?: OutputSchemaField[];
131
- /** Static event vocabulary. Actions with dynamic events also set hasDynamicEvents. */
132
- events?: Array<Pick<ActionEventDefinition, 'name' | 'displayName' | 'description' | 'payloadSchema'>>;
156
+ inputSchema: object;
157
+ outputSchema: OutputSchemaField[];
158
+ events: Array<Pick<ActionEventDefinition, 'name' | 'displayName' | 'description' | 'payloadSchema'>>;
133
159
  hasDynamicEvents: boolean;
134
160
  hasDynamicOutputSchema: boolean;
135
161
  eligibleForEventTrigger: boolean;
136
- /**
137
- * True when the action defines `getMissingInputs` — conditional requiredness
138
- * that `inputSchema.required` cannot express (like a custom proof, the
139
- * function itself can't cross the JSON boundary). Out-of-process consumers
140
- * should treat the schema's `required` as a lower bound for such actions;
141
- * in-process consumers get the full logic via `getMissingActionInputs`.
142
- */
162
+ /** Whether a time trigger may target this action (Sovereign Scheduling, IXO-4433). */
163
+ eligibleForTimeTrigger: boolean;
164
+ /** Present exactly when eligibleForTimeTrigger is true: the Timed Action contract. */
165
+ scheduling?: ActionSchedulingContract;
143
166
  hasCustomInputValidation: boolean;
167
+ topic: TopicActionMetadata;
144
168
  }
145
169
  interface ActionManifest {
146
- /** Schema version of the manifest format itself. */
147
- manifestVersion: '1';
170
+ manifestVersion: typeof ACTION_MANIFEST_VERSION;
171
+ registryVersion: string;
172
+ manifestDigest: `sha256:${string}`;
148
173
  actions: ActionManifestEntry[];
149
174
  }
150
175
  /**
151
- * Generate the machine-readable action contract from the live registry.
176
+ * Generate deterministic Action Manifest v4 from the one live registry.
152
177
  *
153
- * This is the single artifact external actors (the flow-manager oracle,
154
- * third-party agentic Oracle actors) implement against, replacing
155
- * hand-maintained copies of input contracts. It is emitted to
156
- * `dist/action-manifest.json` at build time and also callable at runtime
157
- * from `@ixo/editor/core`.
178
+ * Memoized against the registry revision: building the manifest canonicalizes and
179
+ * SHA-256s every registered contract, and the validation paths (flow bindings,
180
+ * Action requests, receipts, external invocations) call this on every check —
181
+ * several of them from React render. The registry only changes when an Action
182
+ * registers, which bumps the revision and invalidates this.
183
+ *
184
+ * The returned manifest is shared, so callers must treat it as read-only.
158
185
  */
159
186
  declare function generateActionManifest(): ActionManifest;
187
+ interface ActionManifestIssue {
188
+ actionType: string;
189
+ code: 'MISSING_CAN' | 'MISSING_PRESENTATION' | 'MISSING_INPUT_SCHEMA' | 'MISSING_OUTPUT_SCHEMA' | 'SIDE_EFFECT_WITHOUT_PROOF' | 'MISSING_TOPIC_POLICY' | 'INVALID_TOPIC_POLICY' | 'INVALID_SEMANTIC_RECORD_DEFINITION';
190
+ message: string;
191
+ }
192
+ /** CI/build gate for the public portable registry contract. */
193
+ declare function actionManifestIssues(manifest?: ActionManifest): ActionManifestIssue[];
194
+
195
+ declare function sha256Digest(value: unknown): `sha256:${string}`;
196
+
197
+ interface ActionPresentation {
198
+ displayName: string;
199
+ description: string;
200
+ }
201
+ /** Core-owned default used by built-ins and by legacy registrations during migration. */
202
+ declare function getActionPresentation(type: string): ActionPresentation;
160
203
 
161
204
  /**
162
205
  * Required-input evaluation for action types — the machine-readable mirror of
@@ -267,6 +310,26 @@ declare function parseServiceCan(value: string): {
267
310
 
268
311
  declare function buildServicesFromHandlers(handlers: any): ActionServices;
269
312
 
313
+ interface ExternalTopicExecutorResult {
314
+ receipt: TopicActionReceiptV2;
315
+ semanticRecords?: TopicActionRecord[];
316
+ }
317
+ interface ExternalTopicExecutorPort {
318
+ invoke(invocation: TopicActionInvocationV1): Promise<ExternalTopicExecutorResult>;
319
+ }
320
+ /** Shared manifest/invocation boundary for both QiForge and MCP providers. */
321
+ declare class ManifestBoundTopicExecutorAdapter {
322
+ readonly provider: Exclude<TopicActionRuntimeProvider, 'qi-flow'>;
323
+ private readonly executor;
324
+ private readonly bridge;
325
+ constructor(provider: Exclude<TopicActionRuntimeProvider, 'qi-flow'>, executor: ExternalTopicExecutorPort, bridge: TopicActionBridge);
326
+ execute(invocation: TopicActionInvocationV1): Promise<TopicActionWriteBackResult>;
327
+ private validateInvocation;
328
+ private validateResult;
329
+ }
330
+ declare const createQiForgeTopicExecutorAdapter: (executor: ExternalTopicExecutorPort, bridge: TopicActionBridge) => ManifestBoundTopicExecutorAdapter;
331
+ declare const createMcpTopicExecutorAdapter: (executor: ExternalTopicExecutorPort, bridge: TopicActionBridge) => ManifestBoundTopicExecutorAdapter;
332
+
270
333
  type ConditionOperator = 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'contains' | 'not_contains' | 'is_empty' | 'is_not_empty';
271
334
  interface BlockCondition {
272
335
  id: string;
@@ -813,212 +876,6 @@ declare function getVersionPolicy(version: string): VersionPolicy;
813
876
  */
814
877
  declare function isVersionAtLeast(current: string, minimum: FlowVersionString): boolean;
815
878
 
816
- /**
817
- * Writes compiled blocks into BlockNote's collaborative XmlFragment using the
818
- * ProseMirror/Yjs structure that BlockNote reads from collaboration.
819
- */
820
- declare function writeCompiledBlocksToFragment(fragment: Y.XmlFragment, blocks: CompiledBlock[]): void;
821
- /**
822
- * Remove a single block container by its block ID.
823
- * Returns `true` if the block was found and removed.
824
- */
825
- declare function removeBlockFromFragment(fragment: Y.XmlFragment, blockId: string): boolean;
826
- /**
827
- * Replace a block container in-place (same position) by its block ID.
828
- * Returns `true` if the block was found and replaced.
829
- */
830
- declare function replaceBlockInFragment(fragment: Y.XmlFragment, block: CompiledBlock): boolean;
831
- /**
832
- * Read all blocks (with their props) back out of the document fragment.
833
- *
834
- * The inverse of `writeCompiledBlocksToFragment` / `createBlockContainer`: walks the single
835
- * `blockGroup` and, for each `blockContainer`, returns `{ id, type, props }` where `props` is
836
- * the inner `blockContent` element's attributes — the **authoritative per-block prop store**
837
- * (the `qi.flow.nodes` map omits props, so this is the only place to recover them headlessly).
838
- *
839
- * `textColor`/`backgroundColor` are folded back into `props` only when non-`'default'`, so a
840
- * default-styled block round-trips to exactly its content props. Note: props written as `''`
841
- * are not persisted by `createBlockContainer`, so they do not reappear here.
842
- *
843
- * Returns `[]` when the fragment has no `blockGroup`.
844
- */
845
- declare function readBlocksFromFragment(fragment: Y.XmlFragment): CompiledBlock[];
846
-
847
- /**
848
- * A single flow node as read from a live Y.Doc, assembled from all three sources:
849
- * structure (`qi.flow.*`), per-block `props` (the `document` fragment), and per-block
850
- * `runtime` (the `runtime` map). `props` and `runtime` are what the graph map cannot provide.
851
- */
852
- interface FlowDocumentNode {
853
- nodeId: string;
854
- blockId: string;
855
- can: string;
856
- with: string;
857
- title: string;
858
- description: string;
859
- /** Authoritative per-block props, recovered from the document fragment. */
860
- props: Record<string, string>;
861
- /** Per-block runtime; `{}` for a fresh/never-run node (e.g. a template). */
862
- runtime: FlowNodeRuntimeState;
863
- }
864
- interface FlowDocumentRead {
865
- meta: CompiledFlow['meta'];
866
- order: string[];
867
- edges: CompiledEdge[];
868
- blockIndex: Record<string, string>;
869
- nodes: FlowDocumentNode[];
870
- }
871
- /**
872
- * Read a flow document **losslessly** from a headless Y.Doc, in one call.
873
- *
874
- * Why this exists: `readCompiledFlowFromYDoc` returns nodes with **empty `props`** (the
875
- * `qi.flow.nodes` map omits props — they live only in the `document` fragment), and
876
- * `decompileToBaseUcanFlow` is lossy for the same reason. `readFlowDocument` merges the three
877
- * sources so a consumer (e.g. an authoring agent) sees the *true* current flow:
878
- *
879
- * - structure ← `readCompiledFlowFromYDoc` (nodes, order, edges, `can`/`with`)
880
- * - per-block props ← `readBlocksFromFragment` (inputs/conditions/trigger/ttl/icon/…)
881
- * - per-block runtime ← the run's `actions` map, resolved against the flat `runtime` mirror
882
- *
883
- * Fragment props are authoritative for the denormalized fields (`title`/`description`); the
884
- * node-map copy is used only as a fallback when the fragment didn't persist them.
885
- *
886
- * Returns `null` when the doc has no flow at all (mirrors `readCompiledFlowFromYDoc`).
887
- */
888
- declare function readFlowDocument(yDoc: Doc, runId?: string): FlowDocumentRead | null;
889
- interface AddFlowNodeOptions {
890
- /** Registry action type, e.g. `'qi/form.submit'`. Must exist in the registry. */
891
- type: string;
892
- /** Insert into the logical order right after this node id; appended to the end if omitted. */
893
- afterNodeId?: string;
894
- /** Optional starting title (defaults to the action's `can` / type). */
895
- title?: string;
896
- /** Optional extra block props merged over the compiled defaults. */
897
- props?: Record<string, string>;
898
- }
899
- /**
900
- * Add a step to the flow document — the inverse of `removeFlowNode`. Inserts an
901
- * attr-only `action` block into the `document` fragment and registers the
902
- * matching `qi.flow.*` structure (`nodes`, `blockIndex`, `order`) in one
903
- * transaction, mirroring exactly what the compiler's `hydrate` writes for a
904
- * single node. No recompile, no runtime entry (a template node is never-run).
905
- *
906
- * Returns the new ids, or `null` if `type` is not a known registry action.
907
- */
908
- declare function addFlowNode(yDoc: Doc, opts: AddFlowNodeOptions): {
909
- nodeId: string;
910
- blockId: string;
911
- } | null;
912
- /**
913
- * Edit one block's config props in place, in the `document` fragment. Surgical: it touches
914
- * only the target block (siblings untouched), does **not** recompile, and does **not** touch
915
- * the `runtime` map. Pass `''` for a prop to clear it (the writer drops empty values).
916
- *
917
- * Keeps the denormalized node-map fields in sync — `title`/`description` and the `actor`
918
- * object (derived from `authorisedActors`/`parentCapability`) live in BOTH the fragment and
919
- * `qi.flow.nodes`, so a fragment-only write would desync structural readers.
920
- *
921
- * Returns `false` when no block with `blockId` exists.
922
- */
923
- declare function setBlockProps(yDoc: Doc, blockId: string, partial: Record<string, string>): boolean;
924
- /**
925
- * Remove one step from the flow document — fragment block + `qi.flow.*` entries + its
926
- * `runtime` entry + any edges touching it — in one transaction. Siblings untouched.
927
- *
928
- * Guards against orphaning references: if another node's trigger, condition, or a
929
- * `{{nodeId.output.*}}` input ref points at this node, removal is refused and the referring
930
- * node ids are returned so the caller can surface them.
931
- */
932
- declare function removeFlowNode(yDoc: Doc, nodeId: string, runId?: string): {
933
- ok: true;
934
- } | {
935
- ok: false;
936
- referencedBy: string[];
937
- };
938
- /**
939
- * Reorder the flow's steps. Always rewrites the logical order (`qi.flow.order`). Also
940
- * reorders the visual `document` fragment to match — but only when every block is an
941
- * attr-only compiled block; if the doc contains inline prose, the fragment is left untouched
942
- * (recreating it would lose content) and only the logical order changes.
943
- *
944
- * `order` must be a permutation of the current `qi.flow.order` (same ids, no dups); returns
945
- * `false` otherwise.
946
- */
947
- declare function reorderFlowNodes(yDoc: Doc, order: string[]): boolean;
948
- /**
949
- * Swap two step blocks by document position — the move-up/move-down primitive
950
- * for template authoring. Reorders the visual `document` fragment (so the change
951
- * is what the author sees), and keeps `qi.flow.order` consistent when BOTH
952
- * blocks are graph-registered nodes. Works for slash-menu ("legacy") blocks too,
953
- * since it operates on document position rather than the graph.
954
- *
955
- * Returns `false` if either block id is missing.
956
- */
957
- declare function swapFlowBlocks(yDoc: Doc, blockIdA: string, blockIdB: string): boolean;
958
- /**
959
- * Merge a partial into a node's action state — the headless twin of the React `updateRuntime`.
960
- *
961
- * Goes through `writeActionState`, so the run entry and the flat mirror are
962
- * written in one transaction from one resolved `prev`. A flat-only write here
963
- * would be invisible to run-scoped readers the moment they land.
964
- */
965
- declare function updateNodeRuntime(yDoc: Doc, blockId: string, partial: Partial<FlowNodeRuntimeState>, runId?: string): void;
966
- /**
967
- * Clear a failed step back to idle so the user can cleanly re-run it. The headless twin of
968
- * the editor's "Reset" recovery affordance — benign and non-executing.
969
- *
970
- * Resetting only the flat map is the failure this exists to avoid: a surviving
971
- * `completed`/`failed` run entry beats a fresh `idle` flat entry under
972
- * `resolveActionState` rule (a), so "Reset" would appear to do nothing at all
973
- * once readers go run-first.
974
- */
975
- declare function resetStepRuntime(yDoc: Doc, blockId: string, runId?: string): void;
976
- /**
977
- * Pre-fill a (live) form step's answers at `runtime.output.form.answers` (a JSON string,
978
- * matching `FormPanel`). Merges into existing `output`; **never** sets `state:'completed'` —
979
- * submission stays the user's action.
980
- */
981
- declare function setFormAnswers(yDoc: Doc, blockId: string, answers: Record<string, unknown>, runId?: string): void;
982
-
983
- /**
984
- * The operator vocabulary the FE condition evaluator actually understands
985
- * (`src/mantine/blocks/utils/conditionEvaluator.ts`). The compiler historically wrote the
986
- * BaseUcan `ConditionRef` vocabulary (`eq`/`neq`/…) verbatim, which the evaluator does NOT
987
- * recognise (and no normalizer bridged them) — so those conditions silently never fired.
988
- * This module is the single source of truth that maps every supported spelling onto the
989
- * evaluator's vocabulary, and assembles the `props.conditions` JSON.
990
- */
991
- type EvaluatorOperator = 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'contains' | 'not_contains' | 'is_empty' | 'is_not_empty';
992
- /** Normalize any supported operator spelling to the evaluator's vocabulary. Unknown → `equals`. */
993
- declare function toEvaluatorOperator(operator: string): EvaluatorOperator;
994
- interface BlockConditionInput {
995
- /** The BLOCK id of the source step (note: the stored shape keys on blockId, not nodeId). */
996
- sourceBlockId: string;
997
- /** Property on the source block to test. */
998
- property: string;
999
- /** Any supported operator spelling — normalized to the evaluator's vocabulary on write. */
1000
- operator: string;
1001
- value?: unknown;
1002
- effect?: {
1003
- action: 'enable' | 'disable' | 'show' | 'hide';
1004
- message?: string;
1005
- };
1006
- /** Source block type label; defaults to the compiled action type (`'action'`). */
1007
- sourceBlockType?: string;
1008
- name?: string;
1009
- }
1010
- /**
1011
- * Build the `props.conditions` JSON string in the exact shape the FE evaluator reads, with
1012
- * operators normalized to its vocabulary. Single source of truth for the conditions prop —
1013
- * used by both the flow compiler (`compileCondition`) and direct authoring writes
1014
- * (`setBlockProps('conditions', buildBlockConditionsProp(...))`), so a condition authored
1015
- * either way actually evaluates.
1016
- */
1017
- declare function buildBlockConditionsProp(conditions: BlockConditionInput[], opts?: {
1018
- mode?: 'all_must_pass' | 'any_can_pass';
1019
- enabled?: boolean;
1020
- }): string;
1021
-
1022
879
  interface ExecuteFlowAgentCoreCommandOptions {
1023
880
  ucanService: UcanService;
1024
881
  pin: string;
@@ -1261,6 +1118,212 @@ declare function computeCID(content: Uint8Array): Promise<string>;
1261
1118
  */
1262
1119
  declare function computeJsonCID(obj: Record<string, any>): Promise<string>;
1263
1120
 
1121
+ /**
1122
+ * Writes compiled blocks into BlockNote's collaborative XmlFragment using the
1123
+ * ProseMirror/Yjs structure that BlockNote reads from collaboration.
1124
+ */
1125
+ declare function writeCompiledBlocksToFragment(fragment: Y.XmlFragment, blocks: CompiledBlock[]): void;
1126
+ /**
1127
+ * Remove a single block container by its block ID.
1128
+ * Returns `true` if the block was found and removed.
1129
+ */
1130
+ declare function removeBlockFromFragment(fragment: Y.XmlFragment, blockId: string): boolean;
1131
+ /**
1132
+ * Replace a block container in-place (same position) by its block ID.
1133
+ * Returns `true` if the block was found and replaced.
1134
+ */
1135
+ declare function replaceBlockInFragment(fragment: Y.XmlFragment, block: CompiledBlock): boolean;
1136
+ /**
1137
+ * Read all blocks (with their props) back out of the document fragment.
1138
+ *
1139
+ * The inverse of `writeCompiledBlocksToFragment` / `createBlockContainer`: walks the single
1140
+ * `blockGroup` and, for each `blockContainer`, returns `{ id, type, props }` where `props` is
1141
+ * the inner `blockContent` element's attributes — the **authoritative per-block prop store**
1142
+ * (the `qi.flow.nodes` map omits props, so this is the only place to recover them headlessly).
1143
+ *
1144
+ * `textColor`/`backgroundColor` are folded back into `props` only when non-`'default'`, so a
1145
+ * default-styled block round-trips to exactly its content props. Note: props written as `''`
1146
+ * are not persisted by `createBlockContainer`, so they do not reappear here.
1147
+ *
1148
+ * Returns `[]` when the fragment has no `blockGroup`.
1149
+ */
1150
+ declare function readBlocksFromFragment(fragment: Y.XmlFragment): CompiledBlock[];
1151
+
1152
+ /**
1153
+ * A single flow node as read from a live Y.Doc, assembled from all three sources:
1154
+ * structure (`qi.flow.*`), per-block `props` (the `document` fragment), and per-block
1155
+ * `runtime` (the `runtime` map). `props` and `runtime` are what the graph map cannot provide.
1156
+ */
1157
+ interface FlowDocumentNode {
1158
+ nodeId: string;
1159
+ blockId: string;
1160
+ can: string;
1161
+ with: string;
1162
+ title: string;
1163
+ description: string;
1164
+ /** Authoritative per-block props, recovered from the document fragment. */
1165
+ props: Record<string, string>;
1166
+ /** Per-block runtime; `{}` for a fresh/never-run node (e.g. a template). */
1167
+ runtime: FlowNodeRuntimeState;
1168
+ }
1169
+ interface FlowDocumentRead {
1170
+ meta: CompiledFlow['meta'];
1171
+ order: string[];
1172
+ edges: CompiledEdge[];
1173
+ blockIndex: Record<string, string>;
1174
+ nodes: FlowDocumentNode[];
1175
+ }
1176
+ /**
1177
+ * Read a flow document **losslessly** from a headless Y.Doc, in one call.
1178
+ *
1179
+ * Why this exists: `readCompiledFlowFromYDoc` returns nodes with **empty `props`** (the
1180
+ * `qi.flow.nodes` map omits props — they live only in the `document` fragment), and
1181
+ * `decompileToBaseUcanFlow` is lossy for the same reason. `readFlowDocument` merges the three
1182
+ * sources so a consumer (e.g. an authoring agent) sees the *true* current flow:
1183
+ *
1184
+ * - structure ← `readCompiledFlowFromYDoc` (nodes, order, edges, `can`/`with`)
1185
+ * - per-block props ← `readBlocksFromFragment` (inputs/conditions/trigger/ttl/icon/…)
1186
+ * - per-block runtime ← the run's `actions` map, resolved against the flat `runtime` mirror
1187
+ *
1188
+ * Fragment props are authoritative for the denormalized fields (`title`/`description`); the
1189
+ * node-map copy is used only as a fallback when the fragment didn't persist them.
1190
+ *
1191
+ * Returns `null` when the doc has no flow at all (mirrors `readCompiledFlowFromYDoc`).
1192
+ */
1193
+ declare function readFlowDocument(yDoc: Doc, runId?: string): FlowDocumentRead | null;
1194
+ interface AddFlowNodeOptions {
1195
+ /** Registry action type, e.g. `'qi/form.submit'`. Must exist in the registry. */
1196
+ type: string;
1197
+ /** Insert into the logical order right after this node id; appended to the end if omitted. */
1198
+ afterNodeId?: string;
1199
+ /** Optional starting title (defaults to the action's `can` / type). */
1200
+ title?: string;
1201
+ /** Optional extra block props merged over the compiled defaults. */
1202
+ props?: Record<string, string>;
1203
+ }
1204
+ /**
1205
+ * Add a step to the flow document — the inverse of `removeFlowNode`. Inserts an
1206
+ * attr-only `action` block into the `document` fragment and registers the
1207
+ * matching `qi.flow.*` structure (`nodes`, `blockIndex`, `order`) in one
1208
+ * transaction, mirroring exactly what the compiler's `hydrate` writes for a
1209
+ * single node. No recompile, no runtime entry (a template node is never-run).
1210
+ *
1211
+ * Returns the new ids, or `null` if `type` is not a known registry action.
1212
+ */
1213
+ declare function addFlowNode(yDoc: Doc, opts: AddFlowNodeOptions): {
1214
+ nodeId: string;
1215
+ blockId: string;
1216
+ } | null;
1217
+ /**
1218
+ * Edit one block's config props in place, in the `document` fragment. Surgical: it touches
1219
+ * only the target block (siblings untouched), does **not** recompile, and does **not** touch
1220
+ * the `runtime` map. Pass `''` for a prop to clear it (the writer drops empty values).
1221
+ *
1222
+ * Keeps the denormalized node-map fields in sync — `title`/`description` and the `actor`
1223
+ * object (derived from `authorisedActors`/`parentCapability`) live in BOTH the fragment and
1224
+ * `qi.flow.nodes`, so a fragment-only write would desync structural readers.
1225
+ *
1226
+ * Returns `false` when no block with `blockId` exists.
1227
+ */
1228
+ declare function setBlockProps(yDoc: Doc, blockId: string, partial: Record<string, string>): boolean;
1229
+ /**
1230
+ * Remove one step from the flow document — fragment block + `qi.flow.*` entries + its
1231
+ * `runtime` entry + any edges touching it — in one transaction. Siblings untouched.
1232
+ *
1233
+ * Guards against orphaning references: if another node's trigger, condition, or a
1234
+ * `{{nodeId.output.*}}` input ref points at this node, removal is refused and the referring
1235
+ * node ids are returned so the caller can surface them.
1236
+ */
1237
+ declare function removeFlowNode(yDoc: Doc, nodeId: string, runId?: string): {
1238
+ ok: true;
1239
+ } | {
1240
+ ok: false;
1241
+ referencedBy: string[];
1242
+ };
1243
+ /**
1244
+ * Reorder the flow's steps. Always rewrites the logical order (`qi.flow.order`). Also
1245
+ * reorders the visual `document` fragment to match — but only when every block is an
1246
+ * attr-only compiled block; if the doc contains inline prose, the fragment is left untouched
1247
+ * (recreating it would lose content) and only the logical order changes.
1248
+ *
1249
+ * `order` must be a permutation of the current `qi.flow.order` (same ids, no dups); returns
1250
+ * `false` otherwise.
1251
+ */
1252
+ declare function reorderFlowNodes(yDoc: Doc, order: string[]): boolean;
1253
+ /**
1254
+ * Swap two step blocks by document position — the move-up/move-down primitive
1255
+ * for template authoring. Reorders the visual `document` fragment (so the change
1256
+ * is what the author sees), and keeps `qi.flow.order` consistent when BOTH
1257
+ * blocks are graph-registered nodes. Works for slash-menu ("legacy") blocks too,
1258
+ * since it operates on document position rather than the graph.
1259
+ *
1260
+ * Returns `false` if either block id is missing.
1261
+ */
1262
+ declare function swapFlowBlocks(yDoc: Doc, blockIdA: string, blockIdB: string): boolean;
1263
+ /**
1264
+ * Merge a partial into a node's action state — the headless twin of the React `updateRuntime`.
1265
+ *
1266
+ * Goes through `writeActionState`, so the run entry and the flat mirror are
1267
+ * written in one transaction from one resolved `prev`. A flat-only write here
1268
+ * would be invisible to run-scoped readers the moment they land.
1269
+ */
1270
+ declare function updateNodeRuntime(yDoc: Doc, blockId: string, partial: Partial<FlowNodeRuntimeState>, runId?: string): void;
1271
+ /**
1272
+ * Clear a failed step back to idle so the user can cleanly re-run it. The headless twin of
1273
+ * the editor's "Reset" recovery affordance — benign and non-executing.
1274
+ *
1275
+ * Resetting only the flat map is the failure this exists to avoid: a surviving
1276
+ * `completed`/`failed` run entry beats a fresh `idle` flat entry under
1277
+ * `resolveActionState` rule (a), so "Reset" would appear to do nothing at all
1278
+ * once readers go run-first.
1279
+ */
1280
+ declare function resetStepRuntime(yDoc: Doc, blockId: string, runId?: string): void;
1281
+ /**
1282
+ * Pre-fill a (live) form step's answers at `runtime.output.form.answers` (a JSON string,
1283
+ * matching `FormPanel`). Merges into existing `output`; **never** sets `state:'completed'` —
1284
+ * submission stays the user's action.
1285
+ */
1286
+ declare function setFormAnswers(yDoc: Doc, blockId: string, answers: Record<string, unknown>, runId?: string): void;
1287
+
1288
+ /**
1289
+ * The operator vocabulary the FE condition evaluator actually understands
1290
+ * (`src/mantine/blocks/utils/conditionEvaluator.ts`). The compiler historically wrote the
1291
+ * BaseUcan `ConditionRef` vocabulary (`eq`/`neq`/…) verbatim, which the evaluator does NOT
1292
+ * recognise (and no normalizer bridged them) — so those conditions silently never fired.
1293
+ * This module is the single source of truth that maps every supported spelling onto the
1294
+ * evaluator's vocabulary, and assembles the `props.conditions` JSON.
1295
+ */
1296
+ type EvaluatorOperator = 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'contains' | 'not_contains' | 'is_empty' | 'is_not_empty';
1297
+ /** Normalize any supported operator spelling to the evaluator's vocabulary. Unknown → `equals`. */
1298
+ declare function toEvaluatorOperator(operator: string): EvaluatorOperator;
1299
+ interface BlockConditionInput {
1300
+ /** The BLOCK id of the source step (note: the stored shape keys on blockId, not nodeId). */
1301
+ sourceBlockId: string;
1302
+ /** Property on the source block to test. */
1303
+ property: string;
1304
+ /** Any supported operator spelling — normalized to the evaluator's vocabulary on write. */
1305
+ operator: string;
1306
+ value?: unknown;
1307
+ effect?: {
1308
+ action: 'enable' | 'disable' | 'show' | 'hide';
1309
+ message?: string;
1310
+ };
1311
+ /** Source block type label; defaults to the compiled action type (`'action'`). */
1312
+ sourceBlockType?: string;
1313
+ name?: string;
1314
+ }
1315
+ /**
1316
+ * Build the `props.conditions` JSON string in the exact shape the FE evaluator reads, with
1317
+ * operators normalized to its vocabulary. Single source of truth for the conditions prop —
1318
+ * used by both the flow compiler (`compileCondition`) and direct authoring writes
1319
+ * (`setBlockProps('conditions', buildBlockConditionsProp(...))`), so a condition authored
1320
+ * either way actually evaluates.
1321
+ */
1322
+ declare function buildBlockConditionsProp(conditions: BlockConditionInput[], opts?: {
1323
+ mode?: 'all_must_pass' | 'any_can_pass';
1324
+ enabled?: boolean;
1325
+ }): string;
1326
+
1264
1327
  declare const XERO_TOOLKIT = "xero";
1265
1328
  /**
1266
1329
  * The Xero account, organisation and bank account this flow acts through.
@@ -1395,4 +1458,4 @@ declare function createOracleInitFlowTemplate(): {
1395
1458
  nodes: FlowNode[];
1396
1459
  };
1397
1460
 
1398
- export { ActionDefinition, ActionDoneContract, ActionHandlers, type ActionManifest, type ActionManifestEntry, ActionReadBackMetadata, type ActionReadBackResolution, type ActionReadBackResolver, type ActionReadBackResolverInput, ActionResult, ActionRunContext, ActionServices, type AddFlowNodeOptions, type BlockCondition, type BlockConditionInput, type BlockConditionsResult, type BlockExecutionEligibility, type BoundedRunOutput, type CapabilityPatternCoversCanOptions, type ClassifyNodeStateInput, CompiledBlock, CompiledEdge, CompiledFlow, CompletionCheck, type CompletionReconciliationTransition, type CompletionVerification, type CompletionVerificationStatus, type ConditionActionResult, type ConditionConfig, type ConditionEvaluationOptions, type ConditionEvaluationResult, type ConditionOperator, type DetailedResolution, type EvaluatorOperator, type ExecuteFlowAgentCoreCommandOptions, type ExecuteQueuedFlowAgentCoreCommandsOptions, FlowAgentBlockerCause, FlowAgentCommand, FlowAgentCommandResult, FlowAgentContext, FlowAgentExecutor, FlowAgentNodeSnapshot, FlowAgentPublicNodeState, FlowConnectionBinding, type FlowDocumentNode, type FlowDocumentRead, FlowNode, FlowNodeRuntimeState, FlowRuntimeStateManager, type FlowVersionString, INVOCATIONS_MAP_KEY, InvalidConditionConfigError, InvocationStore, LATEST_VERSION, MAX_RUN_ACTION_OUTPUT_BYTES, type ManifestDoneDeclaration, type ManifestProofDeclaration, OutputSchemaField, PROOF_MISSING_CODE, type ParsedReference, PendingInvocation, type PendingRunTimelineEvent, type ProofValidationResult, ReadBackTerminalState, type ReconcileActionReadBackParams, type ReconcileActionReadBackResult, type ReconcileCompletionParams, type ReconcileCompletionResult, type ResolveReferencesOptions, RunEventAppender, RunEventInput, RunJsonValue, RunRecordDetails, type RunTimelineAppendResult, SERVICE_VERBS, STEP_COMPLETED_EVENT, STEP_COMPLETED_EVENT_NAME, type ServiceVerb, StoredDelegation, StoredInvocation, UcanDelegationStore, UcanService, type UnresolvedReference, type UnresolvedReferenceReason, VERSION_MANIFEST, type VersionPolicy, XERO_ORACLE_WORKING_STATUSES, XERO_PAYMENT_CREATE_ACTION_TYPE, XERO_TOOLKIT, XERO_WORK_ITEMS_MAP_NAME, XERO_WORK_TERMINAL_MAP_NAME, type XeroWorkAttempt, type XeroWorkItem, type XeroWorkItemFilter, type XeroWorkKind, type XeroWorkProvenance, type XeroWorkSource, type XeroWorkStatus, type XeroWorkTerminalRecord, actionTypeToCan, addFlowNode, appendRunTimelineEvent, appendRunTimelineEvents, boundRunActionOutput, boundRunEventJson, buildBlockConditionsProp, buildServicesFromHandlers, buildXeroInvoiceWorkKey, buildXeroPaymentWorkKey, canToActionType, canToType, capabilityPatternCoversCan, classifyBlockerCause, classifyNodeState, computeCID, computeJsonCID, createOracleInitFlowTemplate, createReference, createRunEventIdempotencyKey, dispatchFlowStartTriggers, doneWhenCompleted, evaluateBlockConditions, evaluateBlockConditionsForRun, evaluateBlockExecutionEligibilityForRun, evaluateCondition, executeFlowAgentCoreCommand, executeQueuedFlowAgentCoreCommands, findXeroWorkItems, findXeroWorkItemsForEditor, generateActionManifest, getAction, getActionByCan, getActionForBlock, getAliasEntries, getAllActions, getAllCanMappings, getEventsForBlock, getMissingActionInputs, getNestedValue, getOutputSchemaForBlock, getVersionPolicy, getXeroWorkItemsMap, getXeroWorkTerminalMap, hasAction, hasReferences, isActionDone, isActionTypeDone, isBlankInputValue, isTempUcanEnforcementDisabled, isVerifiedCompletion, isVersionAtLeast, markXeroWorkApproved, markXeroWorkApprovedForEditor, markXeroWorkCompleted, markXeroWorkCompletedForEditor, markXeroWorkFailed, markXeroWorkFailedForEditor, neverDone, normalizeActionReadBackMetadata, normalizeCan, normalizeCapabilityPattern, normalizeCondition, normalizeConditions, oracleInitSurveySchema, parseConditionConfig, parseConditionConfigStrict, parseReferences, parseServiceCan, readBlocksFromFragment, readFlowDocument, readFlowXeroBinding, readFlowXeroBindingFromEditor, readInvocationsForRun, readPendingRunTimelineEvents, reconcileActionReadBack, reconcileCompletion, reconcilePendingInvocations, registerAction, removeBlockFromFragment, removeFlowNode, reorderFlowNodes, replaceBlockInFragment, resetStepRuntime, resolveConditionSourceValue, resolveObjectReferences, resolveReferences, resolveReferencesDetailed, resolveSingleReference, retryPendingRunTimelineEvents, serviceCan, setBlockProps, setFormAnswers, setTempUcanEnforcementDisabled, snapshotNode, swapFlowBlocks, toEvaluatorOperator, typeToCan, updateNodeRuntime, updateXeroWorkReviewPayload, updateXeroWorkReviewPayloadForEditor, upsertXeroWorkItem, upsertXeroWorkItemForEditor, validateActionProof, verifyCompletion, writeCompiledBlocksToFragment, writeRunRecordAndReconcile, xeroOracleActivityForBlock, xeroOracleActivityForBlockForEditor };
1461
+ export { ACTION_MANIFEST_VERSION, ACTION_REGISTRY_VERSION, ActionDefinition, ActionDoneContract, ActionHandlers, type ActionManifest, type ActionManifestEntry, type ActionManifestIssue, ActionReadBackMetadata, type ActionReadBackResolution, type ActionReadBackResolver, type ActionReadBackResolverInput, ActionResult, ActionRunContext, ActionServices, type AddFlowNodeOptions, type BlockCondition, type BlockConditionInput, type BlockConditionsResult, type BlockExecutionEligibility, type BoundedRunOutput, type CapabilityPatternCoversCanOptions, type ClassifyNodeStateInput, CompiledBlock, CompiledEdge, CompiledFlow, CompletionCheck, type CompletionReconciliationTransition, type CompletionVerification, type CompletionVerificationStatus, type ConditionActionResult, type ConditionConfig, type ConditionEvaluationOptions, type ConditionEvaluationResult, type ConditionOperator, type DetailedResolution, type EvaluatorOperator, type ExecuteFlowAgentCoreCommandOptions, type ExecuteQueuedFlowAgentCoreCommandsOptions, type ExternalTopicExecutorPort, type ExternalTopicExecutorResult, FlowAgentBlockerCause, FlowAgentCommand, FlowAgentCommandResult, FlowAgentContext, FlowAgentExecutor, FlowAgentNodeSnapshot, FlowAgentPublicNodeState, FlowConnectionBinding, type FlowDocumentNode, type FlowDocumentRead, FlowNode, FlowNodeRuntimeState, FlowRuntimeStateManager, type FlowVersionString, INVOCATIONS_MAP_KEY, InvalidConditionConfigError, InvocationStore, LATEST_VERSION, MAX_RUN_ACTION_OUTPUT_BYTES, MAX_TOPIC_SEMANTIC_RECORDS_PER_RECEIPT, MAX_TOPIC_SEMANTIC_RECORD_BATCH_BYTES, ManifestBoundTopicExecutorAdapter, type ManifestDoneDeclaration, type ManifestProofDeclaration, OutputSchemaField, PROOF_MISSING_CODE, type ParsedReference, PendingInvocation, type PendingRunTimelineEvent, type ProofValidationResult, ReadBackTerminalState, type ReconcileActionReadBackParams, type ReconcileActionReadBackResult, type ReconcileCompletionParams, type ReconcileCompletionResult, type ResolveReferencesOptions, RunEventAppender, RunEventInput, RunJsonValue, RunRecordDetails, type RunTimelineAppendResult, SERVICE_VERBS, STEP_COMPLETED_EVENT, STEP_COMPLETED_EVENT_NAME, type ServiceVerb, StoredDelegation, StoredInvocation, TopicActionBridge, TopicActionInvocationV1, TopicActionMetadata, TopicActionReceiptV2, TopicActionRecord, TopicActionWriteBackResult, TopicSemanticRecordDefinition, type TopicSemanticRecordValidationResult, UcanDelegationStore, UcanService, type UnresolvedReference, type UnresolvedReferenceReason, VERSION_MANIFEST, type VersionPolicy, XERO_ORACLE_WORKING_STATUSES, XERO_PAYMENT_CREATE_ACTION_TYPE, XERO_TOOLKIT, XERO_WORK_ITEMS_MAP_NAME, XERO_WORK_TERMINAL_MAP_NAME, type XeroWorkAttempt, type XeroWorkItem, type XeroWorkItemFilter, type XeroWorkKind, type XeroWorkProvenance, type XeroWorkSource, type XeroWorkStatus, type XeroWorkTerminalRecord, actionManifestIssues, actionTypeToCan, addFlowNode, appendRunTimelineEvent, appendRunTimelineEvents, boundRunActionOutput, boundRunEventJson, buildBlockConditionsProp, buildServicesFromHandlers, buildXeroInvoiceWorkKey, buildXeroPaymentWorkKey, canToActionType, canToType, capabilityPatternCoversCan, classifyBlockerCause, classifyNodeState, computeCID, computeJsonCID, createMcpTopicExecutorAdapter, createOracleInitFlowTemplate, createQiForgeTopicExecutorAdapter, createReference, createRunEventIdempotencyKey, dispatchFlowStartTriggers, doneWhenCompleted, evaluateBlockConditions, evaluateBlockConditionsForRun, evaluateBlockExecutionEligibilityForRun, evaluateCondition, executeFlowAgentCoreCommand, executeQueuedFlowAgentCoreCommands, findXeroWorkItems, findXeroWorkItemsForEditor, generateActionManifest, getAction, getActionByCan, getActionForBlock, getActionPresentation, getAliasEntries, getAllActions, getAllCanMappings, getEventsForBlock, getMissingActionInputs, getNestedValue, getOutputSchemaForBlock, getVersionPolicy, getXeroWorkItemsMap, getXeroWorkTerminalMap, hasAction, hasReferences, isActionDone, isActionTypeDone, isBlankInputValue, isTempUcanEnforcementDisabled, isVerifiedCompletion, isVersionAtLeast, markXeroWorkApproved, markXeroWorkApprovedForEditor, markXeroWorkCompleted, markXeroWorkCompletedForEditor, markXeroWorkFailed, markXeroWorkFailedForEditor, neverDone, normalizeActionReadBackMetadata, normalizeCan, normalizeCapabilityPattern, normalizeCondition, normalizeConditions, oracleInitSurveySchema, parseConditionConfig, parseConditionConfigStrict, parseReferences, parseServiceCan, readBlocksFromFragment, readFlowDocument, readFlowXeroBinding, readFlowXeroBindingFromEditor, readInvocationsForRun, readPendingRunTimelineEvents, reconcileActionReadBack, reconcileCompletion, reconcilePendingInvocations, registerAction, removeBlockFromFragment, removeFlowNode, reorderFlowNodes, replaceBlockInFragment, resetStepRuntime, resolveConditionSourceValue, resolveObjectReferences, resolveReferences, resolveReferencesDetailed, resolveSingleReference, retryPendingRunTimelineEvents, serviceCan, setBlockProps, setFormAnswers, setTempUcanEnforcementDisabled, sha256Digest, snapshotNode, swapFlowBlocks, toEvaluatorOperator, typeToCan, updateNodeRuntime, updateXeroWorkReviewPayload, updateXeroWorkReviewPayloadForEditor, upsertXeroWorkItem, upsertXeroWorkItemForEditor, validateActionProof, validateTopicSemanticRecord, validateTopicSemanticRecordBatch, verifyCompletion, writeCompiledBlocksToFragment, writeRunRecordAndReconcile, xeroOracleActivityForBlock, xeroOracleActivityForBlockForEditor };