@ixo/editor 3.0.0-beta.26 → 3.0.0-beta.28
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/{chunk-K75BAQDR.mjs → chunk-LQP2DPYM.mjs} +498 -189
- package/dist/chunk-LQP2DPYM.mjs.map +1 -0
- package/dist/{chunk-SUFKRSSM.mjs → chunk-NOMJJJDB.mjs} +107 -22
- package/dist/chunk-NOMJJJDB.mjs.map +1 -0
- package/dist/chunk-SZSEZY6Z.mjs +470 -0
- package/dist/chunk-SZSEZY6Z.mjs.map +1 -0
- package/dist/core/index.d.ts +34 -170
- package/dist/core/index.mjs +19 -1
- package/dist/{graphql-client-CJ0vMGiH.d.ts → graphql-client-CSiffz9I.d.ts} +1 -1
- package/dist/{index-aAHFla8N.d.ts → index-BmOZ-1iJ.d.ts} +2 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/dist/mantine/index.d.ts +4 -4
- package/dist/mantine/index.mjs +2 -2
- package/dist/{capabilityValidation-BSzFr-F6.d.ts → setup-C5MpJdyr.d.ts} +376 -2
- package/package.json +1 -1
- package/dist/chunk-K75BAQDR.mjs.map +0 -1
- package/dist/chunk-SUFKRSSM.mjs.map +0 -1
|
@@ -1,6 +1,160 @@
|
|
|
1
|
-
import { r as FlowNode, F as FlowNodeAuthzExtension, p as FlowNodeRuntimeState, J as IxoEditorType, S as SignedCapability, B as CreateRootDelegationParams, t as StoredDelegation, G as CreateDelegationParams, H as CreateInvocationParams, w as InvocationResult, x as ExecutionWithInvocationResult, s as UcanCapability, y as DelegationChainValidationResult, z as FindProofsResult, M as MigrationReport, U as UcanDelegationStore, l as InvocationStore, E as EvaluationStatus, C as Capability, a as CapabilityValidationResult } from './index-
|
|
1
|
+
import { r as FlowNode, F as FlowNodeAuthzExtension, p as FlowNodeRuntimeState, J as IxoEditorType, S as SignedCapability, B as CreateRootDelegationParams, t as StoredDelegation, G as CreateDelegationParams, H as CreateInvocationParams, w as InvocationResult, x as ExecutionWithInvocationResult, s as UcanCapability, y as DelegationChainValidationResult, z as FindProofsResult, M as MigrationReport, U as UcanDelegationStore, l as InvocationStore, E as EvaluationStatus, C as Capability, a as CapabilityValidationResult } from './index-BmOZ-1iJ.mjs';
|
|
2
2
|
import { Delegation } from '@ixo/ucan';
|
|
3
3
|
import { Doc, Map } from 'yjs';
|
|
4
|
+
import { MatrixClient } from 'matrix-js-sdk';
|
|
5
|
+
|
|
6
|
+
/** Condition that gates when a capability activates. */
|
|
7
|
+
interface ConditionRef {
|
|
8
|
+
/** ID of the upstream capability whose output is checked. */
|
|
9
|
+
sourceId: string;
|
|
10
|
+
/** Output field path to inspect, e.g., "decision". */
|
|
11
|
+
field: string;
|
|
12
|
+
/** Comparison operator. */
|
|
13
|
+
operator: 'eq' | 'neq' | 'gt' | 'lt' | 'in' | 'exists';
|
|
14
|
+
/** Value to compare against (omit for 'exists'). */
|
|
15
|
+
value?: unknown;
|
|
16
|
+
/** What happens when the condition is (not) met. */
|
|
17
|
+
effect?: {
|
|
18
|
+
action: 'enable' | 'disable' | 'hide' | 'show';
|
|
19
|
+
message?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** Authorization constraint for a capability. */
|
|
23
|
+
interface ActorConstraint {
|
|
24
|
+
/** Whitelisted actor DIDs. */
|
|
25
|
+
authorisedActors?: string[];
|
|
26
|
+
/** Parent capability URI for delegation chain. */
|
|
27
|
+
parentCapability?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Time-to-live constraint for a capability. */
|
|
30
|
+
interface TTLConstraint {
|
|
31
|
+
/** Hard deadline (ISO 8601 date string). */
|
|
32
|
+
absoluteDueDate?: string;
|
|
33
|
+
/** Duration from when the block becomes enabled (ISO 8601 duration, e.g., "P7D"). */
|
|
34
|
+
fromEnablement?: string;
|
|
35
|
+
/** Duration from when an actor commits (ISO 8601 duration, e.g., "PT2H"). */
|
|
36
|
+
fromCommitment?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A single capability in a Base UCAN flow plan.
|
|
40
|
+
*
|
|
41
|
+
* UCAN semantics:
|
|
42
|
+
* can = the action
|
|
43
|
+
* with = the resource or scope
|
|
44
|
+
* nb = typed caveats, inputs, parameters
|
|
45
|
+
*
|
|
46
|
+
* Workflow semantics (kept separate from nb):
|
|
47
|
+
* dependsOn, condition, parallelGroup, phase
|
|
48
|
+
*/
|
|
49
|
+
interface FlowCapability {
|
|
50
|
+
/** Stable node identifier for this step. */
|
|
51
|
+
id: string;
|
|
52
|
+
/** UCAN-style ability string, e.g., "bid/submit", "email/send". */
|
|
53
|
+
can: string;
|
|
54
|
+
/** Resource URI, e.g., "ixo:flow:{flowId}" or "ixo:flow:{flowId}:{nodeId}". */
|
|
55
|
+
with: string;
|
|
56
|
+
/** Typed caveats / input parameters. Shape is dictated by the action registry. */
|
|
57
|
+
nb?: Record<string, unknown>;
|
|
58
|
+
/** IDs of upstream capabilities this depends on. */
|
|
59
|
+
dependsOn?: string[];
|
|
60
|
+
/** Condition that must be met for this capability to activate. */
|
|
61
|
+
condition?: ConditionRef;
|
|
62
|
+
/** Capabilities sharing a parallelGroup run concurrently. */
|
|
63
|
+
parallelGroup?: string;
|
|
64
|
+
/** Semantic grouping for layout lanes. */
|
|
65
|
+
phase?: string;
|
|
66
|
+
/** Who can execute this step. */
|
|
67
|
+
actor?: ActorConstraint;
|
|
68
|
+
/** Time-to-live constraints. */
|
|
69
|
+
ttl?: TTLConstraint;
|
|
70
|
+
/** Display title (falls back to can statement). */
|
|
71
|
+
title?: string;
|
|
72
|
+
/** Description of what this step does. */
|
|
73
|
+
description?: string;
|
|
74
|
+
/** Icon identifier. */
|
|
75
|
+
icon?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The Base UCAN flow plan — the intermediate representation between
|
|
79
|
+
* user intent and the compiled flow graph.
|
|
80
|
+
*
|
|
81
|
+
* capabilities is an ordered list. Each capability carries its own stable `id`.
|
|
82
|
+
*/
|
|
83
|
+
interface BaseUcanFlow {
|
|
84
|
+
kind: 'qi.flow.base-ucan';
|
|
85
|
+
version: '1.0';
|
|
86
|
+
flowId: string;
|
|
87
|
+
title: string;
|
|
88
|
+
goal?: string;
|
|
89
|
+
meta?: {
|
|
90
|
+
entityDid?: string;
|
|
91
|
+
flowUri?: string;
|
|
92
|
+
rootIssuer?: string;
|
|
93
|
+
};
|
|
94
|
+
/** Ordered capabilities, each with its own stable node ID. */
|
|
95
|
+
capabilities: FlowCapability[];
|
|
96
|
+
}
|
|
97
|
+
/** A reference to an upstream node's output field. Format: "nodeId.output.fieldPath" */
|
|
98
|
+
interface RuntimeRef {
|
|
99
|
+
$ref: string;
|
|
100
|
+
}
|
|
101
|
+
declare function isRuntimeRef(value: unknown): value is RuntimeRef;
|
|
102
|
+
/** A single block ready for insertion into BlockNote. */
|
|
103
|
+
interface CompiledBlock {
|
|
104
|
+
/** Pre-generated stable block ID. */
|
|
105
|
+
id: string;
|
|
106
|
+
/** BlockNote block type (e.g., "action"). */
|
|
107
|
+
type: string;
|
|
108
|
+
/** Block props — all values are strings per BlockNote convention. */
|
|
109
|
+
props: Record<string, string>;
|
|
110
|
+
}
|
|
111
|
+
/** A dependency edge in the flow graph. */
|
|
112
|
+
interface CompiledEdge {
|
|
113
|
+
id: string;
|
|
114
|
+
source: string;
|
|
115
|
+
target: string;
|
|
116
|
+
kind: 'dependency';
|
|
117
|
+
condition?: ConditionRef;
|
|
118
|
+
}
|
|
119
|
+
/** A compiled flow node stored in qi.flow.nodes. */
|
|
120
|
+
interface CompiledFlowNode {
|
|
121
|
+
id: string;
|
|
122
|
+
blockId: string;
|
|
123
|
+
can: string;
|
|
124
|
+
with: string;
|
|
125
|
+
registryType: string;
|
|
126
|
+
title: string;
|
|
127
|
+
description: string;
|
|
128
|
+
props: Record<string, string>;
|
|
129
|
+
dependsOn: string[];
|
|
130
|
+
phase?: string;
|
|
131
|
+
parallelGroup?: string;
|
|
132
|
+
actor?: ActorConstraint;
|
|
133
|
+
}
|
|
134
|
+
/** The complete compiled output from the Base UCAN compiler. */
|
|
135
|
+
interface CompiledFlow {
|
|
136
|
+
/** Flow metadata for qi.flow.meta and Y.Map('root'). */
|
|
137
|
+
meta: {
|
|
138
|
+
flowId: string;
|
|
139
|
+
title: string;
|
|
140
|
+
goal?: string;
|
|
141
|
+
version: string;
|
|
142
|
+
flowOwnerDid: string;
|
|
143
|
+
flowUri?: string;
|
|
144
|
+
compiledAt: string;
|
|
145
|
+
compiledFrom: 'BaseUcanFlow';
|
|
146
|
+
};
|
|
147
|
+
/** Blocks to insert into BlockNote, in topological order. */
|
|
148
|
+
blocks: CompiledBlock[];
|
|
149
|
+
/** Flow graph nodes, keyed by node ID. */
|
|
150
|
+
nodes: Record<string, CompiledFlowNode>;
|
|
151
|
+
/** Dependency edges. */
|
|
152
|
+
edges: CompiledEdge[];
|
|
153
|
+
/** Topological order of node IDs. */
|
|
154
|
+
order: string[];
|
|
155
|
+
/** nodeId → blockId mapping. */
|
|
156
|
+
blockIndex: Record<string, string>;
|
|
157
|
+
}
|
|
4
158
|
|
|
5
159
|
declare const buildAuthzFromProps: (props: Record<string, any>) => FlowNodeAuthzExtension;
|
|
6
160
|
declare const buildFlowNodeFromBlock: (block: any) => FlowNode;
|
|
@@ -403,4 +557,224 @@ declare const findValidCapability: (params: {
|
|
|
403
557
|
error?: string;
|
|
404
558
|
}>;
|
|
405
559
|
|
|
406
|
-
|
|
560
|
+
interface ActionContext {
|
|
561
|
+
actorDid: string;
|
|
562
|
+
flowId: string;
|
|
563
|
+
nodeId: string;
|
|
564
|
+
services: ActionServices;
|
|
565
|
+
flowNode?: any;
|
|
566
|
+
runtime?: any;
|
|
567
|
+
delegationStore?: any;
|
|
568
|
+
verifySignature?: (capabilityRaw: string, issuerDid: string) => Promise<{
|
|
569
|
+
valid: boolean;
|
|
570
|
+
error?: string;
|
|
571
|
+
}>;
|
|
572
|
+
rootIssuer?: string;
|
|
573
|
+
flowUri?: string;
|
|
574
|
+
handlers?: any;
|
|
575
|
+
editor?: any;
|
|
576
|
+
}
|
|
577
|
+
interface ActionServices {
|
|
578
|
+
http?: {
|
|
579
|
+
request: (params: {
|
|
580
|
+
url: string;
|
|
581
|
+
method: string;
|
|
582
|
+
headers?: Record<string, string>;
|
|
583
|
+
body?: any;
|
|
584
|
+
}) => Promise<{
|
|
585
|
+
status: number;
|
|
586
|
+
headers: Record<string, string>;
|
|
587
|
+
data: any;
|
|
588
|
+
}>;
|
|
589
|
+
};
|
|
590
|
+
email?: {
|
|
591
|
+
send: (params: {
|
|
592
|
+
to: string;
|
|
593
|
+
subject: string;
|
|
594
|
+
template: string;
|
|
595
|
+
templateVersion?: string;
|
|
596
|
+
variables?: Record<string, any>;
|
|
597
|
+
cc?: string;
|
|
598
|
+
bcc?: string;
|
|
599
|
+
replyTo?: string;
|
|
600
|
+
}) => Promise<{
|
|
601
|
+
messageId: string;
|
|
602
|
+
sentAt: string;
|
|
603
|
+
}>;
|
|
604
|
+
};
|
|
605
|
+
notify?: {
|
|
606
|
+
send: (params: {
|
|
607
|
+
channel: string;
|
|
608
|
+
to: string[];
|
|
609
|
+
cc?: string[];
|
|
610
|
+
bcc?: string[];
|
|
611
|
+
subject?: string;
|
|
612
|
+
body?: string;
|
|
613
|
+
bodyType?: 'text' | 'html';
|
|
614
|
+
from?: string;
|
|
615
|
+
replyTo?: string;
|
|
616
|
+
}) => Promise<{
|
|
617
|
+
messageId: string;
|
|
618
|
+
sentAt: string;
|
|
619
|
+
}>;
|
|
620
|
+
};
|
|
621
|
+
bid?: {
|
|
622
|
+
submitBid: (params: {
|
|
623
|
+
collectionId: string;
|
|
624
|
+
role: string;
|
|
625
|
+
surveyAnswers: Record<string, any>;
|
|
626
|
+
}) => Promise<any>;
|
|
627
|
+
approveBid: (params: {
|
|
628
|
+
bidId: string;
|
|
629
|
+
collectionId: string;
|
|
630
|
+
did: string;
|
|
631
|
+
}) => Promise<any>;
|
|
632
|
+
rejectBid: (params: {
|
|
633
|
+
bidId: string;
|
|
634
|
+
collectionId: string;
|
|
635
|
+
did: string;
|
|
636
|
+
reason: string;
|
|
637
|
+
}) => Promise<any>;
|
|
638
|
+
approveServiceAgentApplication: (params: {
|
|
639
|
+
adminAddress: string;
|
|
640
|
+
collectionId: string;
|
|
641
|
+
agentQuota: number;
|
|
642
|
+
deedDid: string;
|
|
643
|
+
currentUserAddress: string;
|
|
644
|
+
}) => Promise<void>;
|
|
645
|
+
approveEvaluatorApplication: (params: {
|
|
646
|
+
adminAddress: string;
|
|
647
|
+
collectionId: string;
|
|
648
|
+
deedDid: string;
|
|
649
|
+
evaluatorAddress: string;
|
|
650
|
+
agentQuota?: number;
|
|
651
|
+
claimIds?: string[];
|
|
652
|
+
maxAmounts?: Array<{
|
|
653
|
+
denom: string;
|
|
654
|
+
amount: string;
|
|
655
|
+
}>;
|
|
656
|
+
}) => Promise<void>;
|
|
657
|
+
};
|
|
658
|
+
claim?: {
|
|
659
|
+
requestPin: (config?: {
|
|
660
|
+
title?: string;
|
|
661
|
+
description?: string;
|
|
662
|
+
submitText?: string;
|
|
663
|
+
}) => Promise<string>;
|
|
664
|
+
submitClaim: (params: {
|
|
665
|
+
surveyData: any;
|
|
666
|
+
deedDid: string;
|
|
667
|
+
collectionId: string;
|
|
668
|
+
adminAddress: string;
|
|
669
|
+
pin: string;
|
|
670
|
+
}) => Promise<{
|
|
671
|
+
transactionHash: string;
|
|
672
|
+
claimId: string;
|
|
673
|
+
}>;
|
|
674
|
+
evaluateClaim: (granteeAddress: string, did: string, payload: {
|
|
675
|
+
claimId: string;
|
|
676
|
+
collectionId: string;
|
|
677
|
+
adminAddress: string;
|
|
678
|
+
status?: number;
|
|
679
|
+
verificationProof: string;
|
|
680
|
+
amount?: {
|
|
681
|
+
denom: string;
|
|
682
|
+
amount: string;
|
|
683
|
+
} | Array<{
|
|
684
|
+
denom: string;
|
|
685
|
+
amount: string;
|
|
686
|
+
}>;
|
|
687
|
+
}) => Promise<void>;
|
|
688
|
+
getCurrentUser: () => {
|
|
689
|
+
address: string;
|
|
690
|
+
};
|
|
691
|
+
createUdid?: (params: any) => Promise<any>;
|
|
692
|
+
};
|
|
693
|
+
matrix?: {
|
|
694
|
+
storeCredential: (params: {
|
|
695
|
+
roomId: string;
|
|
696
|
+
credentialKey: string;
|
|
697
|
+
credential: Record<string, any>;
|
|
698
|
+
cid: string;
|
|
699
|
+
}) => Promise<{
|
|
700
|
+
storedAt: string;
|
|
701
|
+
duplicate: boolean;
|
|
702
|
+
}>;
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
interface OutputSchemaField {
|
|
706
|
+
path: string;
|
|
707
|
+
displayName: string;
|
|
708
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
709
|
+
description?: string;
|
|
710
|
+
}
|
|
711
|
+
interface ActionDefinition {
|
|
712
|
+
type: string;
|
|
713
|
+
/** UCAN-style ability string used by the flow compiler, e.g., "bid/submit". */
|
|
714
|
+
can?: string;
|
|
715
|
+
sideEffect: boolean;
|
|
716
|
+
defaultRequiresConfirmation: boolean;
|
|
717
|
+
requiredCapability?: string;
|
|
718
|
+
inputSchema?: object;
|
|
719
|
+
/** Static output schema for action types with predictable output (e.g. email.send).
|
|
720
|
+
* For action types with dynamic output (e.g. http.request), the schema is user-defined in inputs. */
|
|
721
|
+
outputSchema?: OutputSchemaField[];
|
|
722
|
+
run: (inputs: Record<string, any>, ctx: ActionContext) => Promise<ActionResult>;
|
|
723
|
+
}
|
|
724
|
+
interface ActionResult {
|
|
725
|
+
output: Record<string, any>;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/** Registry interface expected by the compiler (keeps it pure / testable). */
|
|
729
|
+
interface CompilerRegistry {
|
|
730
|
+
getActionByCan(can: string): ActionDefinition | undefined;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Compile a Base UCAN flow plan into blocks, graph state, and metadata.
|
|
734
|
+
*
|
|
735
|
+
* This is a **pure function** — no React, no Yjs, no side effects.
|
|
736
|
+
* The output is consumed by `hydrateFlowFromPlan()`.
|
|
737
|
+
*/
|
|
738
|
+
declare function compileBaseUcanFlow(plan: BaseUcanFlow, registry: CompilerRegistry): CompiledFlow;
|
|
739
|
+
|
|
740
|
+
interface SetupFlowOptions {
|
|
741
|
+
/** The Base UCAN flow plan to compile. */
|
|
742
|
+
plan: BaseUcanFlow;
|
|
743
|
+
/** Matrix room ID to hydrate the flow into. */
|
|
744
|
+
roomId: string;
|
|
745
|
+
/** Authenticated Matrix client. */
|
|
746
|
+
matrixClient: MatrixClient;
|
|
747
|
+
/** DID of the user setting up the flow. */
|
|
748
|
+
creatorDid: string;
|
|
749
|
+
/** Optional doc ID override (defaults to plan.flowId). */
|
|
750
|
+
docId?: string;
|
|
751
|
+
}
|
|
752
|
+
interface SetupFlowResult {
|
|
753
|
+
/** The compiled flow artifacts. */
|
|
754
|
+
compiled: CompiledFlow;
|
|
755
|
+
/** The room ID (same as input, for convenience). */
|
|
756
|
+
roomId: string;
|
|
757
|
+
/** The flow ID from the plan. */
|
|
758
|
+
flowId: string;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* One-shot function that compiles a Base UCAN flow plan and writes it
|
|
762
|
+
* into a Matrix room's Y.Doc. After this completes, the room is a
|
|
763
|
+
* normal flow that anyone can open via `useCreateCollaborativeIxoEditor`.
|
|
764
|
+
*
|
|
765
|
+
* Usage:
|
|
766
|
+
* ```ts
|
|
767
|
+
* const result = await setupFlowFromBaseUcan({
|
|
768
|
+
* plan: myBaseUcanFlow,
|
|
769
|
+
* roomId: '!abc:matrix.org',
|
|
770
|
+
* matrixClient,
|
|
771
|
+
* creatorDid: 'did:ixo:abc123',
|
|
772
|
+
* });
|
|
773
|
+
*
|
|
774
|
+
* // Now open the flow through normal channels:
|
|
775
|
+
* // useCreateCollaborativeIxoEditor({ roomId: result.roomId, ... })
|
|
776
|
+
* ```
|
|
777
|
+
*/
|
|
778
|
+
declare function setupFlowFromBaseUcan(options: SetupFlowOptions): Promise<SetupFlowResult>;
|
|
779
|
+
|
|
780
|
+
export { isRuntimeRef as $, type AuthorizationResult as A, type BaseUcanFlow as B, type CompilerRegistry as C, type DelegationStore as D, type ExecuteNodeParams as E, type FlowRuntimeStateManager as F, type AuthorizationContextV2 as G, createUcanService as H, type UcanServiceConfig as I, type UcanServiceHandlers as J, SimpleUCANManager as K, type UCANManager as L, type CapabilityGrant as M, type NodeActionResult as N, type DerivedCapability as O, type ActionContext as P, type ActionResult as Q, type OutputSchemaField as R, type SetupFlowOptions as S, type ConditionRef as T, type UcanService as U, type ActorConstraint as V, type TTLConstraint as W, type RuntimeRef as X, type CompiledBlock as Y, type CompiledEdge as Z, type CompiledFlowNode as _, isNodeActive as a, createMemoryDelegationStore as b, createDelegationStore as c, createRuntimeStateManager as d, executeNode as e, findValidCapability as f, buildFlowNodeFromBlock as g, buildAuthzFromProps as h, isActorAuthorized as i, type ExecutionOutcome as j, type ExecutionContext as k, type AuthorizationContext as l, type ActivationResult as m, compileBaseUcanFlow as n, type SetupFlowResult as o, type FlowCapability as p, type CompiledFlow as q, type ActionDefinition as r, setupFlowFromBaseUcan as s, type ActionServices as t, clearRuntimeForTemplateClone as u, validateCapabilityChain as v, executeNodeWithInvocation as w, type ExecuteNodeParamsV2 as x, type ExecutionContextV2 as y, isActorAuthorizedV2 as z };
|