@ixo/editor 6.31.0 → 6.31.1
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 +16640 -3129
- package/dist/{chunk-S7CAGFE3.js → chunk-4475SO6R.js} +2 -2
- package/dist/{chunk-NYQBGIZ2.js → chunk-FQAKOGKS.js} +2355 -926
- package/dist/chunk-FQAKOGKS.js.map +1 -0
- package/dist/{chunk-ZXNBOVAA.js → chunk-TBCPHCFA.js} +2410 -265
- package/dist/chunk-TBCPHCFA.js.map +1 -0
- package/dist/{store-CqvAkvIZ.d.ts → connections-B24zj0RI.d.ts} +340 -323
- package/dist/core/index.d.ts +314 -251
- package/dist/core/index.js +455 -2
- package/dist/core/index.js.map +1 -1
- package/dist/{graphql-client-ZY4Iw0jB.d.ts → graphql-client-BICFLCX8.d.ts} +6 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mantine/index.d.ts +5 -5
- package/dist/mantine/index.js +2 -2
- package/dist/mantine/index.js.map +1 -1
- package/dist/{nodeContext-C-BsYuYi.d.ts → nodeContext-CV9D4s3X.d.ts} +1 -1
- package/dist/{index-Up8gA_E9.d.ts → runtime-DFPayq89.d.ts} +9378 -8728
- package/package.json +7 -5
- package/style.css.d.ts +5 -5
- package/dist/chunk-NYQBGIZ2.js.map +0 -1
- package/dist/chunk-ZXNBOVAA.js.map +0 -1
- /package/dist/{chunk-S7CAGFE3.js.map → chunk-4475SO6R.js.map} +0 -0
package/dist/core/index.d.ts
CHANGED
|
@@ -1,15 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
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 {
|
|
7
|
-
|
|
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
|
-
|
|
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
|
-
|
|
93
|
-
|
|
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
|
-
|
|
134
|
+
displayName: string;
|
|
135
|
+
description: string;
|
|
120
136
|
aliases: string[];
|
|
121
|
-
|
|
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
|
-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
|
|
147
|
-
|
|
170
|
+
manifestVersion: typeof ACTION_MANIFEST_VERSION;
|
|
171
|
+
registryVersion: string;
|
|
172
|
+
manifestDigest: `sha256:${string}`;
|
|
148
173
|
actions: ActionManifestEntry[];
|
|
149
174
|
}
|
|
150
175
|
/**
|
|
151
|
-
* Generate
|
|
176
|
+
* Generate deterministic Action Manifest v4 from the one live registry.
|
|
152
177
|
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
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 };
|