@ixo/editor 5.14.0 → 5.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-JAB2IBVH.mjs → chunk-67477PYU.mjs} +310 -81
- package/dist/chunk-67477PYU.mjs.map +1 -0
- package/dist/{chunk-UVZZ52PF.mjs → chunk-7OOTFDLP.mjs} +2396 -812
- package/dist/chunk-7OOTFDLP.mjs.map +1 -0
- package/dist/{chunk-ZEKC5FGC.mjs → chunk-K4YAG7AQ.mjs} +2 -2
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.mjs +2 -2
- package/dist/{graphql-client-BjgWToqz.d.ts → graphql-client-xxQMIQzo.d.ts} +1 -1
- package/dist/{index-1Y4fIZa7.d.ts → index-BoRWeiDg.d.ts} +113 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/mantine/index.d.ts +3 -3
- package/dist/mantine/index.mjs +2 -2
- package/dist/{store-CEGM2mJP.d.ts → store-DZobLMG3.d.ts} +2 -1
- package/package.json +3 -3
- package/dist/chunk-JAB2IBVH.mjs.map +0 -1
- package/dist/chunk-UVZZ52PF.mjs.map +0 -1
- /package/dist/{chunk-ZEKC5FGC.mjs.map → chunk-K4YAG7AQ.mjs.map} +0 -0
|
@@ -337,17 +337,38 @@ registerAction({
|
|
|
337
337
|
outputSchema: [
|
|
338
338
|
{ path: "selectedBlueprintDid", displayName: "Selected Blueprint DID", type: "string", description: "DID of the selected blueprint" },
|
|
339
339
|
{ path: "selectedBlueprintName", displayName: "Selected Blueprint Name", type: "string", description: "Display name of the selected blueprint" },
|
|
340
|
-
{ path: "selectedBlueprintDescription", displayName: "Selected Blueprint Description", type: "string", description: "Description of the selected blueprint" }
|
|
340
|
+
{ path: "selectedBlueprintDescription", displayName: "Selected Blueprint Description", type: "string", description: "Description of the selected blueprint" },
|
|
341
|
+
{ path: "context", displayName: "Entity Context", type: "array", description: "Entity context entries derived from the selected blueprint" }
|
|
342
|
+
],
|
|
343
|
+
events: [
|
|
344
|
+
{
|
|
345
|
+
name: "selected",
|
|
346
|
+
displayName: "Blueprint Selected",
|
|
347
|
+
description: "Fires when a blueprint is selected for the POD.",
|
|
348
|
+
payloadSchema: [
|
|
349
|
+
{ path: "selectedBlueprintDid", displayName: "Selected Blueprint DID", type: "string", description: "DID of the selected blueprint" },
|
|
350
|
+
{ path: "selectedBlueprintName", displayName: "Selected Blueprint Name", type: "string", description: "Display name of the selected blueprint" },
|
|
351
|
+
{ path: "selectedBlueprintDescription", displayName: "Selected Blueprint Description", type: "string", description: "Description of the selected blueprint" },
|
|
352
|
+
{ path: "context", displayName: "Entity Context", type: "array", description: "Entity context entries for createDomain, including class = selected blueprint DID" }
|
|
353
|
+
],
|
|
354
|
+
pendingDisplayFields: ["selectedBlueprintName", "selectedBlueprintDid"]
|
|
355
|
+
}
|
|
341
356
|
],
|
|
342
357
|
run: async (inputs) => {
|
|
343
358
|
const selectedBlueprintDid = String(inputs.selectedBlueprintDid || "").trim();
|
|
344
359
|
if (!selectedBlueprintDid) throw new Error("selectedBlueprintDid is required");
|
|
360
|
+
const selectedBlueprintName = String(inputs.selectedBlueprintName || "").trim();
|
|
361
|
+
const selectedBlueprintDescription = String(inputs.selectedBlueprintDescription || "").trim();
|
|
362
|
+
const context = [{ key: "class", val: selectedBlueprintDid }];
|
|
363
|
+
const output = {
|
|
364
|
+
selectedBlueprintDid,
|
|
365
|
+
selectedBlueprintName,
|
|
366
|
+
selectedBlueprintDescription,
|
|
367
|
+
context
|
|
368
|
+
};
|
|
345
369
|
return {
|
|
346
|
-
output
|
|
347
|
-
|
|
348
|
-
selectedBlueprintName: String(inputs.selectedBlueprintName || "").trim(),
|
|
349
|
-
selectedBlueprintDescription: String(inputs.selectedBlueprintDescription || "").trim()
|
|
350
|
-
}
|
|
370
|
+
output,
|
|
371
|
+
events: [{ name: "selected", payload: output }]
|
|
351
372
|
};
|
|
352
373
|
}
|
|
353
374
|
});
|
|
@@ -361,21 +382,51 @@ registerAction({
|
|
|
361
382
|
outputSchema: [
|
|
362
383
|
{ path: "selectedEntityDid", displayName: "Selected Entity DID", type: "string", description: "DID of the selected parent entity, or null if skipped" },
|
|
363
384
|
{ path: "selectedEntityName", displayName: "Selected Entity Name", type: "string", description: "Display name of the selected parent entity" },
|
|
385
|
+
{ path: "selectedEntityType", displayName: "Selected Entity Type", type: "string", description: "Entity type of the selected parent entity" },
|
|
364
386
|
{ path: "skipped", displayName: "Skipped", type: "boolean", description: "True if the user skipped this step" }
|
|
365
387
|
],
|
|
388
|
+
events: [
|
|
389
|
+
{
|
|
390
|
+
name: "selected",
|
|
391
|
+
displayName: "Entity Selected",
|
|
392
|
+
description: "Fires when a parent DAO or POD is selected.",
|
|
393
|
+
payloadSchema: [
|
|
394
|
+
{ path: "selectedEntityDid", displayName: "Selected Entity DID", type: "string", description: "DID of the selected parent entity" },
|
|
395
|
+
{ path: "selectedEntityName", displayName: "Selected Entity Name", type: "string", description: "Display name of the selected parent entity" },
|
|
396
|
+
{ path: "selectedEntityType", displayName: "Selected Entity Type", type: "string", description: "Entity type of the selected parent entity" },
|
|
397
|
+
{ path: "skipped", displayName: "Skipped", type: "boolean", description: "False when a parent entity was selected" }
|
|
398
|
+
],
|
|
399
|
+
pendingDisplayFields: ["selectedEntityName", "selectedEntityDid"]
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "skipped",
|
|
403
|
+
displayName: "Selection Skipped",
|
|
404
|
+
description: "Fires when parent entity selection is skipped.",
|
|
405
|
+
payloadSchema: [
|
|
406
|
+
{ path: "selectedEntityDid", displayName: "Selected Entity DID", type: "string", description: "Null when skipped" },
|
|
407
|
+
{ path: "skipped", displayName: "Skipped", type: "boolean", description: "True when skipped" }
|
|
408
|
+
],
|
|
409
|
+
pendingDisplayFields: ["skipped"]
|
|
410
|
+
}
|
|
411
|
+
],
|
|
366
412
|
run: async (inputs) => {
|
|
367
413
|
const skipped = !!inputs.skipped;
|
|
368
414
|
if (skipped) {
|
|
369
|
-
|
|
415
|
+
const output2 = { selectedEntityDid: null, selectedEntityName: "", selectedEntityType: "", skipped: true };
|
|
416
|
+
return { output: output2, events: [{ name: "skipped", payload: output2 }] };
|
|
370
417
|
}
|
|
371
418
|
const selectedEntityDid = String(inputs.selectedEntityDid || "").trim();
|
|
372
419
|
if (!selectedEntityDid) throw new Error("selectedEntityDid is required when not skipping");
|
|
420
|
+
const selectedEntityType = String(inputs.selectedEntityType || "").trim();
|
|
421
|
+
const output = {
|
|
422
|
+
selectedEntityDid,
|
|
423
|
+
selectedEntityName: String(inputs.selectedEntityName || "").trim(),
|
|
424
|
+
selectedEntityType,
|
|
425
|
+
skipped: false
|
|
426
|
+
};
|
|
373
427
|
return {
|
|
374
|
-
output
|
|
375
|
-
|
|
376
|
-
selectedEntityName: String(inputs.selectedEntityName || "").trim(),
|
|
377
|
-
skipped: false
|
|
378
|
-
}
|
|
428
|
+
output,
|
|
429
|
+
events: [{ name: "selected", payload: output }]
|
|
379
430
|
};
|
|
380
431
|
}
|
|
381
432
|
});
|
|
@@ -1887,7 +1938,7 @@ function parseLinkedEntities(entitiesString) {
|
|
|
1887
1938
|
}
|
|
1888
1939
|
function buildGovernanceGroupLinkedEntities(linkedEntities) {
|
|
1889
1940
|
return linkedEntities.filter((entity) => entity.type === "governanceGroup" && entity.coreAddress).map((entity) => ({
|
|
1890
|
-
id: entity.coreAddress
|
|
1941
|
+
id: `{id}#${entity.coreAddress}`,
|
|
1891
1942
|
type: "group",
|
|
1892
1943
|
relationship: "governs",
|
|
1893
1944
|
service: ""
|
|
@@ -2601,6 +2652,23 @@ function parseJsonInput(value) {
|
|
|
2601
2652
|
}
|
|
2602
2653
|
return null;
|
|
2603
2654
|
}
|
|
2655
|
+
function parseContextInput(value) {
|
|
2656
|
+
let raw = value;
|
|
2657
|
+
if (typeof value === "string") {
|
|
2658
|
+
try {
|
|
2659
|
+
raw = JSON.parse(value);
|
|
2660
|
+
} catch {
|
|
2661
|
+
raw = [];
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
if (!Array.isArray(raw)) return [];
|
|
2665
|
+
return raw.map((entry) => {
|
|
2666
|
+
if (!entry || typeof entry !== "object") return null;
|
|
2667
|
+
const key = String(entry.key || "").trim();
|
|
2668
|
+
const val = String(entry.val || "").trim();
|
|
2669
|
+
return key && val ? { key, val } : null;
|
|
2670
|
+
}).filter((entry) => entry !== null);
|
|
2671
|
+
}
|
|
2604
2672
|
function parseDuration(raw) {
|
|
2605
2673
|
const seconds = parseInt(raw, 10) || 0;
|
|
2606
2674
|
if (seconds % (7 * 86400) === 0) return { amount: seconds / (7 * 86400), unit: "weeks" };
|
|
@@ -2681,7 +2749,13 @@ registerAction({
|
|
|
2681
2749
|
type: "string",
|
|
2682
2750
|
description: "The core address of the created governance group, when one was created"
|
|
2683
2751
|
},
|
|
2684
|
-
{ path: "transactionHash", displayName: "Transaction Hash", type: "string", description: "The on-chain transaction hash for domain creation" }
|
|
2752
|
+
{ path: "transactionHash", displayName: "Transaction Hash", type: "string", description: "The on-chain transaction hash for domain creation" },
|
|
2753
|
+
{
|
|
2754
|
+
path: "linkedResourceTransactionHash",
|
|
2755
|
+
displayName: "Linked Resource Transaction Hash",
|
|
2756
|
+
type: "string",
|
|
2757
|
+
description: "The on-chain transaction hash for adding the domain card linked resource"
|
|
2758
|
+
}
|
|
2685
2759
|
],
|
|
2686
2760
|
events: [
|
|
2687
2761
|
{
|
|
@@ -2696,7 +2770,13 @@ registerAction({
|
|
|
2696
2770
|
type: "string",
|
|
2697
2771
|
description: "Core address of the created governance group, when present"
|
|
2698
2772
|
},
|
|
2699
|
-
{ path: "transactionHash", displayName: "Transaction Hash", type: "string", description: "On-chain transaction hash" }
|
|
2773
|
+
{ path: "transactionHash", displayName: "Transaction Hash", type: "string", description: "On-chain transaction hash" },
|
|
2774
|
+
{
|
|
2775
|
+
path: "linkedResourceTransactionHash",
|
|
2776
|
+
displayName: "Linked Resource Transaction Hash",
|
|
2777
|
+
type: "string",
|
|
2778
|
+
description: "On-chain transaction hash for adding the domain card linked resource"
|
|
2779
|
+
}
|
|
2700
2780
|
],
|
|
2701
2781
|
pendingDisplayFields: ["entityDid", "governanceGroupCoreAddress"]
|
|
2702
2782
|
}
|
|
@@ -2710,6 +2790,8 @@ registerAction({
|
|
|
2710
2790
|
if (!handlers.signCredential) throw new Error("signCredential handler not implemented");
|
|
2711
2791
|
if (!handlers.publicFileUpload) throw new Error("publicFileUpload handler not available");
|
|
2712
2792
|
if (!handlers.createDomain) throw new Error("createDomain handler not implemented");
|
|
2793
|
+
if (!handlers.createAddLinkedResourceMessage) throw new Error("createAddLinkedResourceMessage handler not implemented");
|
|
2794
|
+
if (!handlers.executeTransaction) throw new Error("executeTransaction handler not implemented");
|
|
2713
2795
|
let domainCardData;
|
|
2714
2796
|
if (typeof inputs.domainCardData === "string") {
|
|
2715
2797
|
try {
|
|
@@ -2726,21 +2808,53 @@ registerAction({
|
|
|
2726
2808
|
throw new Error("domainCardData is missing or invalid (credentialSubject.name required)");
|
|
2727
2809
|
}
|
|
2728
2810
|
const entityType = String(inputs.entityType || "").trim() || (domainCardData.credentialSubject?.type?.[0] ? resolveEntityTypeFromSchema(domainCardData.credentialSubject.type[0]) : "dao/pod");
|
|
2729
|
-
const issuerDid = handlers.getEntityDid?.() || handlers.getCurrentUser?.()?.address;
|
|
2730
|
-
if (!issuerDid) throw new Error("Unable to determine issuer DID");
|
|
2731
|
-
const entityDidPlaceholder = "did:ixo:entity:pending";
|
|
2732
2811
|
const validFrom = domainCardData.validFrom || (/* @__PURE__ */ new Date()).toISOString();
|
|
2733
2812
|
const validUntil = domainCardData.validUntil || (() => {
|
|
2734
2813
|
const d = /* @__PURE__ */ new Date();
|
|
2735
2814
|
d.setFullYear(d.getFullYear() + 100);
|
|
2736
2815
|
return d.toISOString();
|
|
2737
2816
|
})();
|
|
2817
|
+
let governanceGroupLinkedEntities = [];
|
|
2818
|
+
let governanceGroupCoreAddress = "";
|
|
2819
|
+
const govConfig = parseJsonInput(inputs.governanceConfig);
|
|
2820
|
+
const memberConfig = parseJsonInput(inputs.memberConfig);
|
|
2821
|
+
const context = parseContextInput(inputs.context);
|
|
2822
|
+
if (govConfig && handlers.createGovernanceGroup) {
|
|
2823
|
+
const groupType = govConfig.groupType;
|
|
2824
|
+
const governance = govConfig.governance || {};
|
|
2825
|
+
const config = buildGroupConfig(groupType, governance, memberConfig);
|
|
2826
|
+
const groupResult = await handlers.createGovernanceGroup({
|
|
2827
|
+
groupType,
|
|
2828
|
+
name: govConfig.groupName || domainCardData.credentialSubject?.name || "Governance Group",
|
|
2829
|
+
config
|
|
2830
|
+
});
|
|
2831
|
+
governanceGroupCoreAddress = groupResult.coreAddress;
|
|
2832
|
+
governanceGroupLinkedEntities = [
|
|
2833
|
+
{
|
|
2834
|
+
id: `{id}#${governanceGroupCoreAddress}`,
|
|
2835
|
+
type: "group",
|
|
2836
|
+
relationship: "governs",
|
|
2837
|
+
service: ""
|
|
2838
|
+
}
|
|
2839
|
+
];
|
|
2840
|
+
}
|
|
2841
|
+
const endDate = domainCardData.endDate || validUntil;
|
|
2842
|
+
const { entityDid: newEntityDid, transactionHash } = await handlers.createDomain({
|
|
2843
|
+
entityType,
|
|
2844
|
+
context: context.length > 0 ? context : void 0,
|
|
2845
|
+
linkedResource: [],
|
|
2846
|
+
linkedEntity: governanceGroupLinkedEntities.length > 0 ? governanceGroupLinkedEntities : void 0,
|
|
2847
|
+
startDate: validFrom,
|
|
2848
|
+
endDate
|
|
2849
|
+
});
|
|
2850
|
+
const issuerDid = handlers.getEntityDid?.() || handlers.getCurrentUser?.()?.address;
|
|
2851
|
+
if (!issuerDid) throw new Error("Unable to determine issuer DID");
|
|
2738
2852
|
const credentialSubject = {
|
|
2739
2853
|
...domainCardData.credentialSubject,
|
|
2740
|
-
id:
|
|
2854
|
+
id: newEntityDid
|
|
2741
2855
|
};
|
|
2742
2856
|
const unsignedCredential = buildVerifiableCredential({
|
|
2743
|
-
entityDid:
|
|
2857
|
+
entityDid: newEntityDid,
|
|
2744
2858
|
issuerDid,
|
|
2745
2859
|
credentialSubject,
|
|
2746
2860
|
validFrom,
|
|
@@ -2765,50 +2879,33 @@ registerAction({
|
|
|
2765
2879
|
});
|
|
2766
2880
|
const uploadResult = await handlers.publicFileUpload(credentialFile);
|
|
2767
2881
|
const domainCardLinkedResource = buildDomainCardLinkedResource({
|
|
2768
|
-
entityDid:
|
|
2882
|
+
entityDid: newEntityDid,
|
|
2769
2883
|
cid: uploadResult.cid,
|
|
2770
2884
|
serviceEndpoint: uploadResult.url,
|
|
2771
2885
|
description: `Domain Card for ${domainCardData.credentialSubject?.name || "Domain"}`
|
|
2772
2886
|
});
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
const config = buildGroupConfig(groupType, governance, memberConfig);
|
|
2781
|
-
const groupResult = await handlers.createGovernanceGroup({
|
|
2782
|
-
groupType,
|
|
2783
|
-
name: govConfig.groupName || domainCardData.credentialSubject?.name || "Governance Group",
|
|
2784
|
-
config
|
|
2785
|
-
});
|
|
2786
|
-
governanceGroupCoreAddress = groupResult.coreAddress;
|
|
2787
|
-
governanceGroupLinkedEntities = [
|
|
2788
|
-
{
|
|
2789
|
-
id: governanceGroupCoreAddress,
|
|
2790
|
-
type: "group",
|
|
2791
|
-
relationship: "governs",
|
|
2792
|
-
service: ""
|
|
2793
|
-
}
|
|
2794
|
-
];
|
|
2795
|
-
}
|
|
2796
|
-
const endDate = domainCardData.endDate || validUntil;
|
|
2797
|
-
const { entityDid: newEntityDid, transactionHash } = await handlers.createDomain({
|
|
2798
|
-
entityType,
|
|
2799
|
-
linkedResource: [domainCardLinkedResource],
|
|
2800
|
-
linkedEntity: governanceGroupLinkedEntities.length > 0 ? governanceGroupLinkedEntities : void 0,
|
|
2801
|
-
startDate: validFrom,
|
|
2802
|
-
endDate
|
|
2887
|
+
const addLinkedResourceMessage = await handlers.createAddLinkedResourceMessage({
|
|
2888
|
+
entityDid: newEntityDid,
|
|
2889
|
+
linkedResource: domainCardLinkedResource
|
|
2890
|
+
});
|
|
2891
|
+
const addLinkedResourceResult = await handlers.executeTransaction({
|
|
2892
|
+
messages: [addLinkedResourceMessage],
|
|
2893
|
+
memo: ""
|
|
2803
2894
|
});
|
|
2895
|
+
const linkedResourceTransactionHash = String(addLinkedResourceResult?.transactionHash || "");
|
|
2896
|
+
if (!linkedResourceTransactionHash) {
|
|
2897
|
+
throw new Error("Linked resource transaction completed but no transaction hash received");
|
|
2898
|
+
}
|
|
2804
2899
|
return {
|
|
2805
2900
|
output: {
|
|
2806
2901
|
entityDid: newEntityDid,
|
|
2807
2902
|
governanceGroupCoreAddress,
|
|
2808
2903
|
linkedEntities: governanceGroupLinkedEntities,
|
|
2809
|
-
|
|
2904
|
+
linkedResources: [domainCardLinkedResource],
|
|
2905
|
+
transactionHash,
|
|
2906
|
+
linkedResourceTransactionHash
|
|
2810
2907
|
},
|
|
2811
|
-
events: [{ name: "created", payload: { entityDid: newEntityDid, governanceGroupCoreAddress, transactionHash } }]
|
|
2908
|
+
events: [{ name: "created", payload: { entityDid: newEntityDid, governanceGroupCoreAddress, transactionHash, linkedResourceTransactionHash } }]
|
|
2812
2909
|
};
|
|
2813
2910
|
}
|
|
2814
2911
|
});
|
|
@@ -2958,33 +3055,59 @@ registerAction({
|
|
|
2958
3055
|
defaultRequiresConfirmation: true,
|
|
2959
3056
|
requiredCapability: "flow/block/execute",
|
|
2960
3057
|
outputSchema: [
|
|
2961
|
-
{ path: "
|
|
2962
|
-
{ path: "
|
|
2963
|
-
{ path: "
|
|
2964
|
-
|
|
3058
|
+
{ path: "verb", displayName: "Action verb", type: "string" },
|
|
3059
|
+
{ path: "rowCount", displayName: "Rows targeted", type: "number" },
|
|
3060
|
+
{ path: "paymentBlockId", displayName: "Payment block ID", type: "string" }
|
|
3061
|
+
],
|
|
3062
|
+
events: [
|
|
3063
|
+
{
|
|
3064
|
+
name: "rows.completed",
|
|
3065
|
+
displayName: "Payment rows completed",
|
|
3066
|
+
description: "Fires after the oracle writes terminal status for one or more rows in this batch. Listeners can react to the just-completed payouts.",
|
|
3067
|
+
payloadSchema: [
|
|
3068
|
+
{ path: "paymentBlockId", displayName: "Payment block ID", type: "string" },
|
|
3069
|
+
{ path: "completedRowIds", displayName: "Completed row IDs", type: "string" },
|
|
3070
|
+
{ path: "failedRowIds", displayName: "Failed row IDs", type: "string" }
|
|
3071
|
+
]
|
|
3072
|
+
}
|
|
2965
3073
|
],
|
|
2966
3074
|
run: async (inputs, ctx) => {
|
|
2967
|
-
const
|
|
2968
|
-
if (
|
|
2969
|
-
throw new Error("
|
|
3075
|
+
const rowIds = Array.isArray(inputs.rowIds) ? inputs.rowIds.filter((v) => typeof v === "string" && v.length > 0) : [];
|
|
3076
|
+
if (rowIds.length === 0) {
|
|
3077
|
+
throw new Error("rowIds is required \u2014 pick at least one row before sending");
|
|
3078
|
+
}
|
|
3079
|
+
const verb = String(inputs.verb || "").trim().toLowerCase();
|
|
3080
|
+
if (verb !== "propose" && verb !== "execute" && verb !== "check") {
|
|
3081
|
+
throw new Error(
|
|
3082
|
+
'verb is required and must be one of: "propose", "execute", "check"'
|
|
3083
|
+
);
|
|
2970
3084
|
}
|
|
3085
|
+
const paymentBlockId = String(inputs.paymentBlockId || "").trim();
|
|
3086
|
+
if (!paymentBlockId) {
|
|
3087
|
+
throw new Error("paymentBlockId is required");
|
|
3088
|
+
}
|
|
3089
|
+
const delegationCid = typeof inputs.delegationCid === "string" ? inputs.delegationCid : "";
|
|
3090
|
+
const skillCtx = inputs.skill && typeof inputs.skill === "object" ? inputs.skill : null;
|
|
2971
3091
|
if (!ctx.handlers?.askCompanion) {
|
|
2972
3092
|
throw new Error("askCompanion handler is not available");
|
|
2973
3093
|
}
|
|
2974
|
-
const
|
|
2975
|
-
const
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
${configJson}`
|
|
2982
|
-
].join("\n")
|
|
3094
|
+
const verbDescription = verb === "propose" ? "Make payout proposals for the rows listed below." : verb === "execute" ? "Execute the previously-proposed payouts for the rows listed below." : "Check status for the rows listed below.";
|
|
3095
|
+
const lines = [verbDescription];
|
|
3096
|
+
lines.push(
|
|
3097
|
+
"Read the flow context and the payment block to find the worker base URL, sender info, defaults, and the rows. Follow the skill's SKILL.md for the workflow.",
|
|
3098
|
+
`Payment block ID: ${paymentBlockId}`,
|
|
3099
|
+
`Verb: ${verb}`,
|
|
3100
|
+
`Row IDs (in this batch): ${rowIds.join(", ")}`
|
|
2983
3101
|
);
|
|
3102
|
+
if (skillCtx?.name) lines.push(`Skill name: ${skillCtx.name}`);
|
|
3103
|
+
if (skillCtx?.cid) lines.push(`Skill CID: ${skillCtx.cid}`);
|
|
3104
|
+
if (delegationCid) lines.push(`UCAN delegation CID: ${delegationCid}`);
|
|
3105
|
+
await ctx.handlers.askCompanion(lines.join("\n"));
|
|
2984
3106
|
return {
|
|
2985
3107
|
output: {
|
|
2986
|
-
|
|
2987
|
-
|
|
3108
|
+
verb,
|
|
3109
|
+
rowCount: rowIds.length,
|
|
3110
|
+
paymentBlockId
|
|
2988
3111
|
}
|
|
2989
3112
|
};
|
|
2990
3113
|
}
|
|
@@ -5192,7 +5315,6 @@ function getCidFromDelegation(delegation) {
|
|
|
5192
5315
|
}
|
|
5193
5316
|
var createUcanService = (config) => {
|
|
5194
5317
|
const { delegationStore, invocationStore, handlers, flowOwnerDid } = config;
|
|
5195
|
-
const normalizedFlowOwnerDid = normalizeDid(flowOwnerDid);
|
|
5196
5318
|
const delegationCache = /* @__PURE__ */ new Map();
|
|
5197
5319
|
const isConfigured = () => {
|
|
5198
5320
|
const hasSessionHandlers = !!(handlers.createSignerSession && handlers.signWithSession);
|
|
@@ -5225,11 +5347,49 @@ var createUcanService = (config) => {
|
|
|
5225
5347
|
}
|
|
5226
5348
|
return proofs;
|
|
5227
5349
|
};
|
|
5350
|
+
const getProofCars = async (proofCids) => {
|
|
5351
|
+
const cars = [];
|
|
5352
|
+
for (const cid of proofCids) {
|
|
5353
|
+
const stored = delegationStore.get(cid);
|
|
5354
|
+
if (stored && stored.delegation) {
|
|
5355
|
+
cars.push(stored.delegation);
|
|
5356
|
+
}
|
|
5357
|
+
}
|
|
5358
|
+
return cars;
|
|
5359
|
+
};
|
|
5228
5360
|
const createRootDelegation = async (params) => {
|
|
5229
5361
|
const { flowOwnerDid: ownerDid, issuerType, entityRoomId, flowUri: uri, pin } = params;
|
|
5230
5362
|
const normalizedOwnerDid = normalizeDid(ownerDid);
|
|
5231
|
-
const signer = await getSigner(handlers, normalizedOwnerDid, issuerType, entityRoomId, pin);
|
|
5232
5363
|
const capabilities = [{ can: "flow/*", with: uri }];
|
|
5364
|
+
if (handlers.createSignerSession && handlers.createDelegationWithSession) {
|
|
5365
|
+
const session = await handlers.createSignerSession({
|
|
5366
|
+
did: ownerDid,
|
|
5367
|
+
didType: issuerType,
|
|
5368
|
+
entityRoomId,
|
|
5369
|
+
pin,
|
|
5370
|
+
scope: "operation"
|
|
5371
|
+
});
|
|
5372
|
+
const result = await handlers.createDelegationWithSession({
|
|
5373
|
+
sessionId: session.sessionId,
|
|
5374
|
+
audience: ownerDid,
|
|
5375
|
+
capabilities,
|
|
5376
|
+
proofs: []
|
|
5377
|
+
});
|
|
5378
|
+
const storedDelegation2 = {
|
|
5379
|
+
cid: result.cid,
|
|
5380
|
+
delegation: result.delegation,
|
|
5381
|
+
issuerDid: ownerDid,
|
|
5382
|
+
audienceDid: ownerDid,
|
|
5383
|
+
capabilities,
|
|
5384
|
+
createdAt: Date.now(),
|
|
5385
|
+
format: "car",
|
|
5386
|
+
proofCids: []
|
|
5387
|
+
};
|
|
5388
|
+
delegationStore.set(storedDelegation2);
|
|
5389
|
+
delegationStore.setRootCid(result.cid);
|
|
5390
|
+
return storedDelegation2;
|
|
5391
|
+
}
|
|
5392
|
+
const signer = await getSigner(handlers, ownerDid, issuerType, entityRoomId, pin);
|
|
5233
5393
|
const delegation = await ucanCreateDelegation({
|
|
5234
5394
|
issuer: signer,
|
|
5235
5395
|
audience: toInvocationAudienceDID(normalizedOwnerDid),
|
|
@@ -5257,8 +5417,38 @@ var createUcanService = (config) => {
|
|
|
5257
5417
|
const { issuerDid, issuerType, entityRoomId, audience, capabilities, proofs = [], expiration, pin } = params;
|
|
5258
5418
|
const normalizedIssuerDid = normalizeDid(issuerDid);
|
|
5259
5419
|
const normalizedAudienceDid = normalizeDid(audience);
|
|
5260
|
-
const
|
|
5261
|
-
|
|
5420
|
+
const proofCids = proofs;
|
|
5421
|
+
if (handlers.createSignerSession && handlers.createDelegationWithSession) {
|
|
5422
|
+
const session = await handlers.createSignerSession({
|
|
5423
|
+
did: issuerDid,
|
|
5424
|
+
didType: issuerType,
|
|
5425
|
+
entityRoomId,
|
|
5426
|
+
pin,
|
|
5427
|
+
scope: "operation"
|
|
5428
|
+
});
|
|
5429
|
+
const proofCars = await getProofCars(proofCids);
|
|
5430
|
+
const result = await handlers.createDelegationWithSession({
|
|
5431
|
+
sessionId: session.sessionId,
|
|
5432
|
+
audience,
|
|
5433
|
+
capabilities,
|
|
5434
|
+
proofs: proofCars,
|
|
5435
|
+
expiration: expiration ? Math.floor(expiration / 1e3) : void 0
|
|
5436
|
+
});
|
|
5437
|
+
const storedDelegation2 = {
|
|
5438
|
+
cid: result.cid,
|
|
5439
|
+
delegation: result.delegation,
|
|
5440
|
+
issuerDid,
|
|
5441
|
+
audienceDid: audience,
|
|
5442
|
+
capabilities,
|
|
5443
|
+
expiration,
|
|
5444
|
+
createdAt: Date.now(),
|
|
5445
|
+
format: "car",
|
|
5446
|
+
proofCids
|
|
5447
|
+
};
|
|
5448
|
+
delegationStore.set(storedDelegation2);
|
|
5449
|
+
return storedDelegation2;
|
|
5450
|
+
}
|
|
5451
|
+
const signer = await getSigner(handlers, issuerDid, issuerType, entityRoomId, pin);
|
|
5262
5452
|
const proofDelegations = await getProofDelegations(proofCids);
|
|
5263
5453
|
const delegation = await ucanCreateDelegation({
|
|
5264
5454
|
issuer: signer,
|
|
@@ -5354,9 +5544,12 @@ var createUcanService = (config) => {
|
|
|
5354
5544
|
};
|
|
5355
5545
|
}
|
|
5356
5546
|
}
|
|
5357
|
-
const
|
|
5358
|
-
if (
|
|
5359
|
-
|
|
5547
|
+
const isFlowScoped = capability.can === "flow/*" || capability.can.startsWith("flow/");
|
|
5548
|
+
if (isFlowScoped) {
|
|
5549
|
+
const root = proofChain[proofChain.length - 1];
|
|
5550
|
+
if (root.issuerDid !== flowOwnerDid) {
|
|
5551
|
+
return { valid: false, error: `Root issuer ${root.issuerDid} is not flow owner ${flowOwnerDid}` };
|
|
5552
|
+
}
|
|
5360
5553
|
}
|
|
5361
5554
|
return { valid: true, proofChain };
|
|
5362
5555
|
};
|
|
@@ -5371,6 +5564,41 @@ var createUcanService = (config) => {
|
|
|
5371
5564
|
error: validation.error
|
|
5372
5565
|
};
|
|
5373
5566
|
}
|
|
5567
|
+
const audience = params.audience ?? flowOwnerDid;
|
|
5568
|
+
if (handlers.createSignerSession && handlers.createInvocationWithSession) {
|
|
5569
|
+
try {
|
|
5570
|
+
const session = await handlers.createSignerSession({
|
|
5571
|
+
did: invokerDid,
|
|
5572
|
+
didType: invokerType,
|
|
5573
|
+
entityRoomId,
|
|
5574
|
+
pin,
|
|
5575
|
+
scope: "operation"
|
|
5576
|
+
});
|
|
5577
|
+
const proofCars = await getProofCars(proofs);
|
|
5578
|
+
const result = await handlers.createInvocationWithSession({
|
|
5579
|
+
sessionId: session.sessionId,
|
|
5580
|
+
audience,
|
|
5581
|
+
capability: {
|
|
5582
|
+
can: capability.can,
|
|
5583
|
+
with: capability.with,
|
|
5584
|
+
...capability.nb && { nb: capability.nb }
|
|
5585
|
+
},
|
|
5586
|
+
proofs: proofCars
|
|
5587
|
+
});
|
|
5588
|
+
return {
|
|
5589
|
+
cid: result.cid,
|
|
5590
|
+
invocation: result.invocation,
|
|
5591
|
+
valid: true
|
|
5592
|
+
};
|
|
5593
|
+
} catch (err) {
|
|
5594
|
+
return {
|
|
5595
|
+
cid: "",
|
|
5596
|
+
invocation: "",
|
|
5597
|
+
valid: false,
|
|
5598
|
+
error: err instanceof Error ? err.message : "Failed to create invocation via session"
|
|
5599
|
+
};
|
|
5600
|
+
}
|
|
5601
|
+
}
|
|
5374
5602
|
const signer = await getSigner(handlers, invokerDid, invokerType, entityRoomId, pin);
|
|
5375
5603
|
const proofDelegations = await getProofDelegations(proofs);
|
|
5376
5604
|
const ucantoCapability = {
|
|
@@ -5380,7 +5608,7 @@ var createUcanService = (config) => {
|
|
|
5380
5608
|
};
|
|
5381
5609
|
const invocation = await ucanCreateInvocation({
|
|
5382
5610
|
issuer: signer,
|
|
5383
|
-
audience
|
|
5611
|
+
audience,
|
|
5384
5612
|
capability: ucantoCapability,
|
|
5385
5613
|
proofs: proofDelegations
|
|
5386
5614
|
});
|
|
@@ -5896,7 +6124,8 @@ var VERSION_MANIFEST = {
|
|
|
5896
6124
|
"1.0.0": {
|
|
5897
6125
|
version: "1.0.0",
|
|
5898
6126
|
label: "UCAN Required",
|
|
5899
|
-
|
|
6127
|
+
/** TEMP Disablement - needs to be true TODO */
|
|
6128
|
+
ucanRequired: false,
|
|
5900
6129
|
delegationRootRequired: true,
|
|
5901
6130
|
whitelistOnlyAllowed: false,
|
|
5902
6131
|
unrestrictedAllowed: false,
|
|
@@ -8914,4 +9143,4 @@ export {
|
|
|
8914
9143
|
executeQueuedFlowAgentCoreCommands,
|
|
8915
9144
|
FlowAgentService
|
|
8916
9145
|
};
|
|
8917
|
-
//# sourceMappingURL=chunk-
|
|
9146
|
+
//# sourceMappingURL=chunk-67477PYU.mjs.map
|