@ixo/editor 6.1.2 → 6.2.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 +91 -90
- package/dist/{chunk-ZVN55I7Q.js → chunk-5JGB36AV.js} +2 -2
- package/dist/{chunk-3WFCW7U7.js → chunk-BVGNIZAG.js} +1191 -2309
- package/dist/chunk-BVGNIZAG.js.map +1 -0
- package/dist/{chunk-5Y2WABQE.js → chunk-GUKGNTGT.js} +117 -354
- package/dist/chunk-GUKGNTGT.js.map +1 -0
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +2 -2
- package/dist/{graphql-client-COOgxW6T.d.ts → graphql-client-Bje1zG1x.d.ts} +1 -1
- package/dist/{index-DQOd905K.d.ts → index-KtqCT-bj.d.ts} +61 -36
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mantine/index.d.ts +3 -3
- package/dist/mantine/index.js +2 -2
- package/dist/{store-Kob5Setw.d.ts → store-CZP9PIO-.d.ts} +77 -1
- package/package.json +1 -1
- package/style-core.css +22 -0
- package/style-mantine.css +22 -0
- package/style-scoped.css +22 -0
- package/style.css +22 -0
- package/dist/chunk-3WFCW7U7.js.map +0 -1
- package/dist/chunk-5Y2WABQE.js.map +0 -1
- /package/dist/{chunk-ZVN55I7Q.js.map → chunk-5JGB36AV.js.map} +0 -0
|
@@ -39,7 +39,6 @@ var ACTION_TYPE_ALIASES = {
|
|
|
39
39
|
MemberMultiSelect: "qi/pod.member-multi-select",
|
|
40
40
|
governanceConfig: "qi/pod.governance-config",
|
|
41
41
|
listDomainFlows: "qi/pod.list-domain-flows",
|
|
42
|
-
payment: "qi/payment.execute",
|
|
43
42
|
"matrix.dm": "qi/matrix.dm"
|
|
44
43
|
};
|
|
45
44
|
var aliases = new Map(Object.entries(ACTION_TYPE_ALIASES));
|
|
@@ -191,7 +190,6 @@ var CAN_TO_TYPE = {
|
|
|
191
190
|
"domain/card-preview": "qi/domain.card-preview",
|
|
192
191
|
"domain/sign": "qi/domain.sign",
|
|
193
192
|
"credential/store": "qi/credential.store",
|
|
194
|
-
"payment/execute": "qi/payment.execute",
|
|
195
193
|
"http/request": "qi/http.request",
|
|
196
194
|
"protocol/select": "qi/protocol.select",
|
|
197
195
|
"human/checkbox": "qi/human.checkbox.set",
|
|
@@ -254,7 +252,8 @@ var SERVICE_GROUP_REQUIRED_HANDLERS = {
|
|
|
254
252
|
"collection.updateIntents"
|
|
255
253
|
],
|
|
256
254
|
collectionUsers: ["collectionUsers.grant", "collectionUsers.revoke", "collectionUsers.list", "collectionUsers.classifyAddress", "collectionUsers.enumerateMembers"],
|
|
257
|
-
carbon: ["carbon.loadBatches", "carbon.harvest", "carbon.retire"]
|
|
255
|
+
carbon: ["carbon.loadBatches", "carbon.harvest", "carbon.retire"],
|
|
256
|
+
kyc: ["kycLoadForm", "kycInitiate", "kycGetVerificationUrl", "kycGetStatus", "kycSaveCredential"]
|
|
258
257
|
};
|
|
259
258
|
function getHandlerAtPath(handlers, path) {
|
|
260
259
|
return path.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], handlers);
|
|
@@ -402,6 +401,17 @@ function buildServicesFromHandlers(handlers) {
|
|
|
402
401
|
// we only forward the call here.
|
|
403
402
|
entity: handlers?.entity?.transfer ? {
|
|
404
403
|
transfer: async (params) => handlers.entity.transfer(params)
|
|
404
|
+
} : void 0,
|
|
405
|
+
// KYC verification service (qi/kyc.verify). The consumer exposes the five
|
|
406
|
+
// flat kyc* handlers (all-or-nothing group); wire each method straight
|
|
407
|
+
// through. The consumer handler owns the KYC-server calls, PII handling,
|
|
408
|
+
// and saveCredential idempotency — we only forward calls here.
|
|
409
|
+
kyc: handlers?.kycLoadForm && handlers?.kycInitiate && handlers?.kycGetVerificationUrl && handlers?.kycGetStatus && handlers?.kycSaveCredential ? {
|
|
410
|
+
loadForm: async (params) => handlers.kycLoadForm(params),
|
|
411
|
+
initiate: async (params) => handlers.kycInitiate(params),
|
|
412
|
+
getVerificationUrl: async (params) => handlers.kycGetVerificationUrl(params),
|
|
413
|
+
getStatus: async (params) => handlers.kycGetStatus(params),
|
|
414
|
+
saveCredential: async (params) => handlers.kycSaveCredential(params)
|
|
405
415
|
} : void 0
|
|
406
416
|
};
|
|
407
417
|
}
|
|
@@ -4722,91 +4732,6 @@ registerAction({
|
|
|
4722
4732
|
}
|
|
4723
4733
|
});
|
|
4724
4734
|
|
|
4725
|
-
// src/core/lib/actionRegistry/actions/payment.ts
|
|
4726
|
-
registerAction({
|
|
4727
|
-
type: "qi/payment.execute",
|
|
4728
|
-
can: "payment/execute",
|
|
4729
|
-
sideEffect: true,
|
|
4730
|
-
proof: { fields: ["paymentBlockId"] },
|
|
4731
|
-
defaultRequiresConfirmation: true,
|
|
4732
|
-
requiredCapability: "flow/block/execute",
|
|
4733
|
-
inputSchema: {
|
|
4734
|
-
type: "object",
|
|
4735
|
-
required: ["rowIds", "verb", "paymentBlockId"],
|
|
4736
|
-
properties: {
|
|
4737
|
-
rowIds: { type: "array", description: "IDs of the rows in the payment block to operate on (at least one)." },
|
|
4738
|
-
verb: { type: "string", description: 'Which worker route to hit: "propose", "execute", or "check".' },
|
|
4739
|
-
paymentBlockId: { type: "string", description: "The payment block ID so the oracle can edit_block back into the right place." },
|
|
4740
|
-
delegationCid: { type: "string", description: "Optional user's UCAN delegation CID to the oracle." },
|
|
4741
|
-
skill: { type: "object", description: "Optional skill context with cid and name." }
|
|
4742
|
-
}
|
|
4743
|
-
},
|
|
4744
|
-
outputSchema: [
|
|
4745
|
-
{ path: "verb", displayName: "Action verb", type: "string" },
|
|
4746
|
-
{ path: "rowCount", displayName: "Rows targeted", type: "number" },
|
|
4747
|
-
{ path: "paymentBlockId", displayName: "Payment block ID", type: "string" }
|
|
4748
|
-
],
|
|
4749
|
-
events: [
|
|
4750
|
-
{
|
|
4751
|
-
name: "rows.completed",
|
|
4752
|
-
displayName: "Payment rows completed",
|
|
4753
|
-
description: "Fires after the oracle writes terminal status for one or more rows in this batch. Listeners can react to the just-completed payouts.",
|
|
4754
|
-
payloadSchema: [
|
|
4755
|
-
{ path: "paymentBlockId", displayName: "Payment block ID", type: "string" },
|
|
4756
|
-
{ path: "completedRowIds", displayName: "Completed row IDs", type: "string" },
|
|
4757
|
-
{ path: "failedRowIds", displayName: "Failed row IDs", type: "string" }
|
|
4758
|
-
]
|
|
4759
|
-
}
|
|
4760
|
-
],
|
|
4761
|
-
run: async (inputs, ctx) => {
|
|
4762
|
-
const rowIds = Array.isArray(inputs.rowIds) ? inputs.rowIds.filter((v) => typeof v === "string" && v.length > 0) : [];
|
|
4763
|
-
if (rowIds.length === 0) {
|
|
4764
|
-
throw new Error("rowIds is required \u2014 pick at least one row before sending");
|
|
4765
|
-
}
|
|
4766
|
-
const verb = String(inputs.verb || "").trim().toLowerCase();
|
|
4767
|
-
if (verb !== "propose" && verb !== "execute" && verb !== "check") {
|
|
4768
|
-
throw new Error('verb is required and must be one of: "propose", "execute", "check"');
|
|
4769
|
-
}
|
|
4770
|
-
const paymentBlockId = String(inputs.paymentBlockId || "").trim();
|
|
4771
|
-
if (!paymentBlockId) {
|
|
4772
|
-
throw new Error("paymentBlockId is required");
|
|
4773
|
-
}
|
|
4774
|
-
const delegationCid = typeof inputs.delegationCid === "string" ? inputs.delegationCid : "";
|
|
4775
|
-
const skillCtx = inputs.skill && typeof inputs.skill === "object" ? inputs.skill : null;
|
|
4776
|
-
if (!ctx.handlers?.askCompanion) {
|
|
4777
|
-
throw new Error("askCompanion handler is not available");
|
|
4778
|
-
}
|
|
4779
|
-
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.";
|
|
4780
|
-
const lines = [verbDescription];
|
|
4781
|
-
lines.push(
|
|
4782
|
-
"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.",
|
|
4783
|
-
`Payment block ID: ${paymentBlockId}`,
|
|
4784
|
-
`Verb: ${verb}`,
|
|
4785
|
-
`Row IDs (in this batch): ${rowIds.join(", ")}`
|
|
4786
|
-
);
|
|
4787
|
-
if (skillCtx?.name) lines.push(`Skill name: ${skillCtx.name}`);
|
|
4788
|
-
if (skillCtx?.cid) lines.push(`Skill CID: ${skillCtx.cid}`);
|
|
4789
|
-
if (delegationCid) lines.push(`UCAN delegation CID: ${delegationCid}`);
|
|
4790
|
-
await ctx.handlers.askCompanion(lines.join("\n"));
|
|
4791
|
-
return {
|
|
4792
|
-
output: {
|
|
4793
|
-
verb,
|
|
4794
|
-
rowCount: rowIds.length,
|
|
4795
|
-
paymentBlockId
|
|
4796
|
-
},
|
|
4797
|
-
completion: {
|
|
4798
|
-
state: "awaiting_readback",
|
|
4799
|
-
readBack: {
|
|
4800
|
-
kind: "paymentRows",
|
|
4801
|
-
paymentBlockId,
|
|
4802
|
-
rowIds,
|
|
4803
|
-
verb
|
|
4804
|
-
}
|
|
4805
|
-
}
|
|
4806
|
-
};
|
|
4807
|
-
}
|
|
4808
|
-
});
|
|
4809
|
-
|
|
4810
4735
|
// src/core/lib/actionRegistry/actions/matrixDm.ts
|
|
4811
4736
|
registerAction({
|
|
4812
4737
|
type: "qi/matrix.dm",
|
|
@@ -6546,6 +6471,89 @@ registerAction({
|
|
|
6546
6471
|
}
|
|
6547
6472
|
});
|
|
6548
6473
|
|
|
6474
|
+
// src/core/lib/actionRegistry/actions/kycVerify.ts
|
|
6475
|
+
registerAction({
|
|
6476
|
+
type: "qi/kyc.verify",
|
|
6477
|
+
can: "kyc/verify",
|
|
6478
|
+
sideEffect: true,
|
|
6479
|
+
proof: { fields: ["credentialCid"] },
|
|
6480
|
+
defaultRequiresConfirmation: false,
|
|
6481
|
+
cardinality: "once",
|
|
6482
|
+
// Human-driven (details form + hosted webview) — never event-triggered,
|
|
6483
|
+
// same as the human input actions.
|
|
6484
|
+
eligibleForEventTrigger: false,
|
|
6485
|
+
inputSchema: {
|
|
6486
|
+
type: "object",
|
|
6487
|
+
required: ["protocolDid"],
|
|
6488
|
+
properties: {
|
|
6489
|
+
protocolDid: { type: "string", description: "DID of the KYC protocol entity to verify against. The protocol determines the KYC level and check plan." },
|
|
6490
|
+
credentialType: {
|
|
6491
|
+
type: "string",
|
|
6492
|
+
description: "Vault index key of the credential the protocol issues (e.g. 'kycamllevel1', 'kycamllevel2'). Defaults to level 1 when omitted."
|
|
6493
|
+
},
|
|
6494
|
+
credentialCid: {
|
|
6495
|
+
type: "string",
|
|
6496
|
+
description: "Runtime-selected CID of an existing Vault credential to use (set by the FlowDetail when the user picks one of several)."
|
|
6497
|
+
}
|
|
6498
|
+
}
|
|
6499
|
+
},
|
|
6500
|
+
outputSchema: [
|
|
6501
|
+
{ path: "credentialCid", displayName: "Credential CID", type: "string", description: "CID of the SD-JWT credential saved to the Vault (proof of completion)." },
|
|
6502
|
+
{ path: "credentialType", displayName: "Credential Type", type: "string", description: "Type of the issued credential." },
|
|
6503
|
+
{ path: "protocolId", displayName: "Protocol ID", type: "string", description: "The KYC protocol this verification ran against." },
|
|
6504
|
+
{ path: "status", displayName: "Status", type: "string", description: "Terminal lifecycle status \u2014 'complete' once the credential is saved." }
|
|
6505
|
+
],
|
|
6506
|
+
events: [
|
|
6507
|
+
{
|
|
6508
|
+
name: "kyc.completed",
|
|
6509
|
+
displayName: "KYC completed",
|
|
6510
|
+
description: "Fires when the issued credential has been saved to the Vault and the verification is complete.",
|
|
6511
|
+
payloadSchema: [
|
|
6512
|
+
{ path: "credentialCid", displayName: "Credential CID", type: "string" },
|
|
6513
|
+
{ path: "credentialType", displayName: "Credential Type", type: "string" },
|
|
6514
|
+
{ path: "protocolId", displayName: "Protocol ID", type: "string" },
|
|
6515
|
+
{ path: "status", displayName: "Status", type: "string" }
|
|
6516
|
+
],
|
|
6517
|
+
pendingDisplayFields: ["credentialType", "status"]
|
|
6518
|
+
}
|
|
6519
|
+
],
|
|
6520
|
+
run: async (inputs, ctx) => {
|
|
6521
|
+
if (!ctx.services.kyc) {
|
|
6522
|
+
throw new Error("kyc handlers not available");
|
|
6523
|
+
}
|
|
6524
|
+
if (!inputs.protocolDid) throw new Error("protocolDid is required");
|
|
6525
|
+
const credentialType = typeof inputs.credentialType === "string" && inputs.credentialType.trim() ? inputs.credentialType.trim() : void 0;
|
|
6526
|
+
const credentialCid = typeof inputs.credentialCid === "string" && inputs.credentialCid.trim() ? inputs.credentialCid.trim() : void 0;
|
|
6527
|
+
const { status } = await ctx.services.kyc.getStatus({ protocolId: inputs.protocolDid });
|
|
6528
|
+
let eligible = status === "issued" || status === "complete";
|
|
6529
|
+
if (!eligible) {
|
|
6530
|
+
try {
|
|
6531
|
+
const form = await ctx.services.kyc.loadForm({ protocolDid: inputs.protocolDid, credentialType });
|
|
6532
|
+
eligible = !!form.hasExistingCredential;
|
|
6533
|
+
} catch (err) {
|
|
6534
|
+
console.warn("[kyc.verify] vault fallback check failed", err);
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6537
|
+
if (!eligible) {
|
|
6538
|
+
throw new Error(`KYC verification not complete \u2014 current status: ${status}`);
|
|
6539
|
+
}
|
|
6540
|
+
const saved = await ctx.services.kyc.saveCredential({ protocolId: inputs.protocolDid, credentialType, credentialCid });
|
|
6541
|
+
if (!saved?.credentialCid) {
|
|
6542
|
+
throw new Error("kyc.saveCredential returned no credentialCid. Check the [kyc:saveCredential] handler logs.");
|
|
6543
|
+
}
|
|
6544
|
+
const output = {
|
|
6545
|
+
credentialCid: saved.credentialCid,
|
|
6546
|
+
credentialType: saved.credentialType,
|
|
6547
|
+
protocolId: inputs.protocolDid,
|
|
6548
|
+
status: "complete"
|
|
6549
|
+
};
|
|
6550
|
+
return {
|
|
6551
|
+
output,
|
|
6552
|
+
events: [{ name: "kyc.completed", payload: output }]
|
|
6553
|
+
};
|
|
6554
|
+
}
|
|
6555
|
+
});
|
|
6556
|
+
|
|
6549
6557
|
// src/core/lib/actionRegistry/actions/_shared/delegatedTool.ts
|
|
6550
6558
|
function parseBoundConnection(raw) {
|
|
6551
6559
|
if (!raw || typeof raw !== "object") return null;
|
|
@@ -10599,42 +10607,6 @@ import * as Y3 from "yjs";
|
|
|
10599
10607
|
|
|
10600
10608
|
// src/core/lib/flowEngine/readBackReconciler.ts
|
|
10601
10609
|
import * as Y2 from "yjs";
|
|
10602
|
-
function isYDoc(value) {
|
|
10603
|
-
return value instanceof Y2.Doc;
|
|
10604
|
-
}
|
|
10605
|
-
function getYDoc(editorOrYDoc) {
|
|
10606
|
-
if (!editorOrYDoc) return void 0;
|
|
10607
|
-
if (isYDoc(editorOrYDoc)) return editorOrYDoc;
|
|
10608
|
-
return editorOrYDoc._yDoc;
|
|
10609
|
-
}
|
|
10610
|
-
function getEditor(editorOrYDoc) {
|
|
10611
|
-
return editorOrYDoc && !isYDoc(editorOrYDoc) ? editorOrYDoc : void 0;
|
|
10612
|
-
}
|
|
10613
|
-
function getRuntime(editorOrYDoc, runtime) {
|
|
10614
|
-
if (runtime) return runtime;
|
|
10615
|
-
const yDoc = getYDoc(editorOrYDoc);
|
|
10616
|
-
if (yDoc) return createYDocRuntimeManager(yDoc);
|
|
10617
|
-
return createRuntimeStateManager(!isYDoc(editorOrYDoc) ? editorOrYDoc : void 0);
|
|
10618
|
-
}
|
|
10619
|
-
function getReconcileEditor(params, yDoc, editor) {
|
|
10620
|
-
if (editor) return editor;
|
|
10621
|
-
if (!yDoc || !params.document) return void 0;
|
|
10622
|
-
return {
|
|
10623
|
-
_yDoc: yDoc,
|
|
10624
|
-
_yRuntime: yDoc.getMap("runtime"),
|
|
10625
|
-
document: params.document
|
|
10626
|
-
};
|
|
10627
|
-
}
|
|
10628
|
-
function makeRunId(now) {
|
|
10629
|
-
return `readback-${now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
10630
|
-
}
|
|
10631
|
-
function asOutput(value) {
|
|
10632
|
-
return value && typeof value === "object" && !Array.isArray(value) ? { ...value } : {};
|
|
10633
|
-
}
|
|
10634
|
-
function errorRecord(error) {
|
|
10635
|
-
if (!error) return void 0;
|
|
10636
|
-
return typeof error === "string" ? { message: error } : { message: error.message, code: error.code };
|
|
10637
|
-
}
|
|
10638
10610
|
function normalizeActionReadBackMetadata(params) {
|
|
10639
10611
|
const base = params.readBack && typeof params.readBack === "object" && !Array.isArray(params.readBack) ? { ...params.readBack } : {};
|
|
10640
10612
|
const kind = typeof base.kind === "string" && base.kind.trim() ? base.kind.trim() : params.actionType;
|
|
@@ -10659,221 +10631,14 @@ function normalizeActionReadBackMetadata(params) {
|
|
|
10659
10631
|
}
|
|
10660
10632
|
return normalized;
|
|
10661
10633
|
}
|
|
10662
|
-
function writeReconciliationRunRecord(params) {
|
|
10663
|
-
if (!params.yDoc) return void 0;
|
|
10664
|
-
const completedAt = params.now();
|
|
10665
|
-
const runId = makeRunId(params.now);
|
|
10666
|
-
const pendingInvocation = params.readBack.pendingInvocation;
|
|
10667
|
-
const details = {
|
|
10668
|
-
runId,
|
|
10669
|
-
output: params.output,
|
|
10670
|
-
events: params.events,
|
|
10671
|
-
startedAt: params.readBack.requestedAt || new Date(completedAt).toISOString(),
|
|
10672
|
-
completedAt: new Date(completedAt).toISOString(),
|
|
10673
|
-
actorDid: params.actorDid,
|
|
10674
|
-
invocationCid: params.readBack.invocationCid,
|
|
10675
|
-
capabilityId: params.readBack.capabilityId,
|
|
10676
|
-
error: params.error,
|
|
10677
|
-
readBack: params.readBack,
|
|
10678
|
-
reconciled: true
|
|
10679
|
-
};
|
|
10680
|
-
if (pendingInvocation) {
|
|
10681
|
-
details.fromPendingInvocationId = pendingInvocation.id;
|
|
10682
|
-
details.triggeredBy = {
|
|
10683
|
-
sourceBlockId: pendingInvocation.triggeringBlockId,
|
|
10684
|
-
eventName: pendingInvocation.eventName
|
|
10685
|
-
};
|
|
10686
|
-
details.sourceRunId = pendingInvocation.sourceRunId;
|
|
10687
|
-
}
|
|
10688
|
-
appendRunRecord(params.yDoc, params.blockId, details, params.actorDid);
|
|
10689
|
-
if (params.editor && params.events.length > 0) {
|
|
10690
|
-
reconcilePendingInvocations(params.editor);
|
|
10691
|
-
}
|
|
10692
|
-
return runId;
|
|
10693
|
-
}
|
|
10694
|
-
async function reconcileActionReadBack(params) {
|
|
10695
|
-
const now = params.now || Date.now;
|
|
10696
|
-
const yDoc = getYDoc(params.editorOrYDoc);
|
|
10697
|
-
const editor = getEditor(params.editorOrYDoc);
|
|
10698
|
-
const runtime = getRuntime(params.editorOrYDoc, params.runtime);
|
|
10699
|
-
const current = runtime.get(params.blockId);
|
|
10700
|
-
const output = asOutput(current.output);
|
|
10701
|
-
const readBack = current.readBack;
|
|
10702
|
-
if (current.state !== "awaiting_readback" || !readBack?.kind) {
|
|
10703
|
-
return {
|
|
10704
|
-
success: false,
|
|
10705
|
-
blockId: params.blockId,
|
|
10706
|
-
state: current.state === "failed" ? "failed" : "pending",
|
|
10707
|
-
output,
|
|
10708
|
-
events: [],
|
|
10709
|
-
error: `Block "${params.blockId}" is not awaiting read-back`,
|
|
10710
|
-
pendingInvocationRemoved: false,
|
|
10711
|
-
readBack
|
|
10712
|
-
};
|
|
10713
|
-
}
|
|
10714
|
-
const resolver = params.resolver || params.resolvers?.[readBack.kind];
|
|
10715
|
-
if (!resolver) {
|
|
10716
|
-
return {
|
|
10717
|
-
success: false,
|
|
10718
|
-
blockId: params.blockId,
|
|
10719
|
-
state: "pending",
|
|
10720
|
-
output,
|
|
10721
|
-
events: [],
|
|
10722
|
-
error: `No read-back resolver registered for "${readBack.kind}"`,
|
|
10723
|
-
pendingInvocationRemoved: false,
|
|
10724
|
-
readBack
|
|
10725
|
-
};
|
|
10726
|
-
}
|
|
10727
|
-
const resolution = await resolver({
|
|
10728
|
-
blockId: params.blockId,
|
|
10729
|
-
runtime: current,
|
|
10730
|
-
output,
|
|
10731
|
-
readBack
|
|
10732
|
-
});
|
|
10733
|
-
const checkedAt = now();
|
|
10734
|
-
const checkedIso = new Date(checkedAt).toISOString();
|
|
10735
|
-
const nextReadBack = {
|
|
10736
|
-
...readBack,
|
|
10737
|
-
...resolution.readBack || {},
|
|
10738
|
-
status: resolution.state,
|
|
10739
|
-
lastCheckedAt: checkedIso
|
|
10740
|
-
};
|
|
10741
|
-
if (resolution.state === "pending") {
|
|
10742
|
-
runtime.update(params.blockId, {
|
|
10743
|
-
readBack: nextReadBack
|
|
10744
|
-
});
|
|
10745
|
-
return {
|
|
10746
|
-
success: true,
|
|
10747
|
-
blockId: params.blockId,
|
|
10748
|
-
state: "pending",
|
|
10749
|
-
output,
|
|
10750
|
-
events: resolution.events || [],
|
|
10751
|
-
pendingInvocationRemoved: false,
|
|
10752
|
-
readBack: nextReadBack
|
|
10753
|
-
};
|
|
10754
|
-
}
|
|
10755
|
-
const events = resolution.events || [];
|
|
10756
|
-
const finalOutput = {
|
|
10757
|
-
...output,
|
|
10758
|
-
...resolution.output || {}
|
|
10759
|
-
};
|
|
10760
|
-
const actorDid = params.actorDid || readBack.actorDid || current.executedByDid || "system:readback";
|
|
10761
|
-
if (resolution.state === "failed") {
|
|
10762
|
-
const error = errorRecord(resolution.error) || { message: "External read-back failed" };
|
|
10763
|
-
const failedReadBack = {
|
|
10764
|
-
...nextReadBack,
|
|
10765
|
-
terminalAt: checkedIso
|
|
10766
|
-
};
|
|
10767
|
-
runtime.update(params.blockId, {
|
|
10768
|
-
state: "failed",
|
|
10769
|
-
output: finalOutput,
|
|
10770
|
-
error: { ...error, at: checkedAt },
|
|
10771
|
-
readBack: failedReadBack
|
|
10772
|
-
});
|
|
10773
|
-
const runId2 = writeReconciliationRunRecord({
|
|
10774
|
-
yDoc,
|
|
10775
|
-
editor: getReconcileEditor(params, yDoc, editor),
|
|
10776
|
-
blockId: params.blockId,
|
|
10777
|
-
actorDid,
|
|
10778
|
-
output: finalOutput,
|
|
10779
|
-
events,
|
|
10780
|
-
readBack: failedReadBack,
|
|
10781
|
-
error,
|
|
10782
|
-
now
|
|
10783
|
-
});
|
|
10784
|
-
return {
|
|
10785
|
-
success: false,
|
|
10786
|
-
blockId: params.blockId,
|
|
10787
|
-
state: "failed",
|
|
10788
|
-
output: finalOutput,
|
|
10789
|
-
events,
|
|
10790
|
-
error: error.message,
|
|
10791
|
-
runId: runId2,
|
|
10792
|
-
pendingInvocationRemoved: false,
|
|
10793
|
-
readBack: failedReadBack
|
|
10794
|
-
};
|
|
10795
|
-
}
|
|
10796
|
-
const readBackActionType = readBack.actionType || readBack.kind;
|
|
10797
|
-
const actionDef = readBackActionType ? getAction(readBackActionType) : void 0;
|
|
10798
|
-
if (actionDef) {
|
|
10799
|
-
const proofCheck = validateActionProof(actionDef, finalOutput || {});
|
|
10800
|
-
if (!proofCheck.valid) {
|
|
10801
|
-
const message = proofCheck.reason || "Read-back resolved completed without proof of execution.";
|
|
10802
|
-
const proofFailedReadBack = {
|
|
10803
|
-
...nextReadBack,
|
|
10804
|
-
terminalAt: checkedIso
|
|
10805
|
-
};
|
|
10806
|
-
runtime.update(params.blockId, {
|
|
10807
|
-
state: actionDef.sideEffect ? "needs_verification" : "failed",
|
|
10808
|
-
output: finalOutput,
|
|
10809
|
-
error: { message, code: PROOF_MISSING_CODE, at: checkedAt },
|
|
10810
|
-
readBack: proofFailedReadBack
|
|
10811
|
-
});
|
|
10812
|
-
const failedRunId = writeReconciliationRunRecord({
|
|
10813
|
-
yDoc,
|
|
10814
|
-
editor: getReconcileEditor(params, yDoc, editor),
|
|
10815
|
-
blockId: params.blockId,
|
|
10816
|
-
actorDid,
|
|
10817
|
-
output: finalOutput,
|
|
10818
|
-
events,
|
|
10819
|
-
readBack: proofFailedReadBack,
|
|
10820
|
-
error: { message, code: PROOF_MISSING_CODE },
|
|
10821
|
-
now
|
|
10822
|
-
});
|
|
10823
|
-
return {
|
|
10824
|
-
success: false,
|
|
10825
|
-
blockId: params.blockId,
|
|
10826
|
-
state: "failed",
|
|
10827
|
-
output: finalOutput,
|
|
10828
|
-
events,
|
|
10829
|
-
error: message,
|
|
10830
|
-
runId: failedRunId,
|
|
10831
|
-
pendingInvocationRemoved: false,
|
|
10832
|
-
readBack: proofFailedReadBack
|
|
10833
|
-
};
|
|
10834
|
-
}
|
|
10835
|
-
}
|
|
10836
|
-
const completedReadBack = {
|
|
10837
|
-
...nextReadBack,
|
|
10838
|
-
terminalAt: checkedIso
|
|
10839
|
-
};
|
|
10840
|
-
runtime.update(params.blockId, {
|
|
10841
|
-
state: "completed",
|
|
10842
|
-
output: finalOutput,
|
|
10843
|
-
executedAt: checkedAt,
|
|
10844
|
-
error: void 0,
|
|
10845
|
-
readBack: completedReadBack
|
|
10846
|
-
});
|
|
10847
|
-
const runId = writeReconciliationRunRecord({
|
|
10848
|
-
yDoc,
|
|
10849
|
-
editor: getReconcileEditor(params, yDoc, editor),
|
|
10850
|
-
blockId: params.blockId,
|
|
10851
|
-
actorDid,
|
|
10852
|
-
output: finalOutput,
|
|
10853
|
-
events,
|
|
10854
|
-
readBack: completedReadBack,
|
|
10855
|
-
now
|
|
10856
|
-
});
|
|
10857
|
-
const pendingInvocationRemoved = Boolean(yDoc && completedReadBack.pendingInvocation?.id) && removePendingInvocation(yDoc, params.blockId, completedReadBack.pendingInvocation.id);
|
|
10858
|
-
return {
|
|
10859
|
-
success: true,
|
|
10860
|
-
blockId: params.blockId,
|
|
10861
|
-
state: "completed",
|
|
10862
|
-
output: finalOutput,
|
|
10863
|
-
events,
|
|
10864
|
-
runId,
|
|
10865
|
-
pendingInvocationRemoved,
|
|
10866
|
-
readBack: completedReadBack
|
|
10867
|
-
};
|
|
10868
|
-
}
|
|
10869
10634
|
|
|
10870
10635
|
// src/core/lib/flowEngine/actionExecutor.ts
|
|
10871
|
-
function
|
|
10636
|
+
function isYDoc(value) {
|
|
10872
10637
|
return value instanceof Y3.Doc;
|
|
10873
10638
|
}
|
|
10874
|
-
function
|
|
10639
|
+
function getYDoc(editorOrYDoc) {
|
|
10875
10640
|
if (!editorOrYDoc) return void 0;
|
|
10876
|
-
if (
|
|
10641
|
+
if (isYDoc(editorOrYDoc)) return editorOrYDoc;
|
|
10877
10642
|
return editorOrYDoc._yDoc;
|
|
10878
10643
|
}
|
|
10879
10644
|
function parseInputs2(value) {
|
|
@@ -10888,20 +10653,20 @@ function parseInputs2(value) {
|
|
|
10888
10653
|
return {};
|
|
10889
10654
|
}
|
|
10890
10655
|
}
|
|
10891
|
-
function
|
|
10656
|
+
function getRuntime(editorOrYDoc, runtime) {
|
|
10892
10657
|
if (runtime) return runtime;
|
|
10893
|
-
const yDoc =
|
|
10658
|
+
const yDoc = getYDoc(editorOrYDoc);
|
|
10894
10659
|
if (yDoc) return createYDocRuntimeManager(yDoc);
|
|
10895
|
-
return createRuntimeStateManager(!
|
|
10660
|
+
return createRuntimeStateManager(!isYDoc(editorOrYDoc) ? editorOrYDoc : void 0);
|
|
10896
10661
|
}
|
|
10897
|
-
function
|
|
10898
|
-
return editorOrYDoc && !
|
|
10662
|
+
function getEditor(editorOrYDoc) {
|
|
10663
|
+
return editorOrYDoc && !isYDoc(editorOrYDoc) ? editorOrYDoc : void 0;
|
|
10899
10664
|
}
|
|
10900
10665
|
function findBlock(params) {
|
|
10901
10666
|
if (params.block) return params.block;
|
|
10902
10667
|
const blockId = params.blockId;
|
|
10903
10668
|
if (!blockId) return void 0;
|
|
10904
|
-
const editor =
|
|
10669
|
+
const editor = getEditor(params.editorOrYDoc);
|
|
10905
10670
|
return (params.document || editor?.document || []).find((block) => block?.id === blockId);
|
|
10906
10671
|
}
|
|
10907
10672
|
function getFlowMetadata(editor) {
|
|
@@ -10935,8 +10700,8 @@ function getNodeOutput(runtime, nodeId) {
|
|
|
10935
10700
|
}
|
|
10936
10701
|
function buildActionRunInputs(params) {
|
|
10937
10702
|
const blockId = params.blockId || params.block?.id;
|
|
10938
|
-
const yDoc =
|
|
10939
|
-
const runtime =
|
|
10703
|
+
const yDoc = getYDoc(params.editorOrYDoc);
|
|
10704
|
+
const runtime = getRuntime(params.editorOrYDoc, params.runtime);
|
|
10940
10705
|
const savedInputs = parseInputs2(params.savedInputs ?? params.block?.props?.inputs);
|
|
10941
10706
|
const pendingInvocation = getPendingInvocation(yDoc, blockId, params.pendingInvocationId);
|
|
10942
10707
|
const triggerContext = pendingInvocation ? {
|
|
@@ -10975,10 +10740,10 @@ function updateRuntimeFailure(runtime, blockId, message, now) {
|
|
|
10975
10740
|
error: { message, at: now() }
|
|
10976
10741
|
});
|
|
10977
10742
|
}
|
|
10978
|
-
function
|
|
10743
|
+
function makeRunId(now) {
|
|
10979
10744
|
return `run-${now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
10980
10745
|
}
|
|
10981
|
-
function
|
|
10746
|
+
function getReconcileEditor(params, yDoc, editor) {
|
|
10982
10747
|
if (editor) return editor;
|
|
10983
10748
|
if (!yDoc || !params.document) return void 0;
|
|
10984
10749
|
return {
|
|
@@ -10989,7 +10754,7 @@ function getReconcileEditor2(params, yDoc, editor) {
|
|
|
10989
10754
|
}
|
|
10990
10755
|
function persistEvents(params) {
|
|
10991
10756
|
if (!params.yDoc || params.events.length === 0) return void 0;
|
|
10992
|
-
const runId =
|
|
10757
|
+
const runId = makeRunId(params.now);
|
|
10993
10758
|
const details = {
|
|
10994
10759
|
runId,
|
|
10995
10760
|
output: params.output,
|
|
@@ -11021,9 +10786,9 @@ function cleanupCompletedPendingInvocation(yDoc, blockId, pendingInvocation) {
|
|
|
11021
10786
|
async function executeActionBlock(params) {
|
|
11022
10787
|
const block = findBlock(params);
|
|
11023
10788
|
const blockId = params.blockId || block?.id;
|
|
11024
|
-
const editor =
|
|
11025
|
-
const yDoc =
|
|
11026
|
-
const runtime =
|
|
10789
|
+
const editor = getEditor(params.editorOrYDoc);
|
|
10790
|
+
const yDoc = getYDoc(params.editorOrYDoc);
|
|
10791
|
+
const runtime = getRuntime(params.editorOrYDoc, params.runtime);
|
|
11027
10792
|
const now = params.now || Date.now;
|
|
11028
10793
|
if (!block || !blockId) {
|
|
11029
10794
|
return buildFailureResult({
|
|
@@ -11183,7 +10948,7 @@ async function executeActionBlock(params) {
|
|
|
11183
10948
|
});
|
|
11184
10949
|
const runId = persistEvents({
|
|
11185
10950
|
yDoc,
|
|
11186
|
-
editor:
|
|
10951
|
+
editor: getReconcileEditor(params, yDoc, editor),
|
|
11187
10952
|
blockId,
|
|
11188
10953
|
actorDid: params.actorDid,
|
|
11189
10954
|
output,
|
|
@@ -11445,7 +11210,6 @@ var ICON_DEFAULTS = {
|
|
|
11445
11210
|
"domain/card-preview": "id",
|
|
11446
11211
|
"domain/sign": "feather",
|
|
11447
11212
|
"credential/store": "shield",
|
|
11448
|
-
"payment/execute": "credit-card",
|
|
11449
11213
|
"http/request": "cloud",
|
|
11450
11214
|
"protocol/select": "git-branch",
|
|
11451
11215
|
"human/checkbox": "check-square",
|
|
@@ -12943,7 +12707,7 @@ var BLOCKER_DIAGNOSIS_VERSION = 2;
|
|
|
12943
12707
|
function getBlocks(context) {
|
|
12944
12708
|
return context.blocks || context.editor?.document || [];
|
|
12945
12709
|
}
|
|
12946
|
-
function
|
|
12710
|
+
function getRuntime2(yDoc, nodeId) {
|
|
12947
12711
|
const runtime = yDoc.getMap("runtime");
|
|
12948
12712
|
const value = runtime.get(nodeId);
|
|
12949
12713
|
return value && typeof value === "object" ? value : {};
|
|
@@ -13153,7 +12917,7 @@ function planRalphLoopCommands(context, options = {}) {
|
|
|
13153
12917
|
const nodeId = getBlockId(block);
|
|
13154
12918
|
if (!nodeId) continue;
|
|
13155
12919
|
const pendingInvocationCount = readPendingInvocations(context.yDoc, nodeId).length;
|
|
13156
|
-
const runtime =
|
|
12920
|
+
const runtime = getRuntime2(context.yDoc, nodeId);
|
|
13157
12921
|
const actionType = getBlockActionType(block);
|
|
13158
12922
|
const completionVerification = verifyCompletion({
|
|
13159
12923
|
runtime,
|
|
@@ -13845,7 +13609,6 @@ export {
|
|
|
13845
13609
|
executeNode,
|
|
13846
13610
|
PROOF_MISSING_CODE,
|
|
13847
13611
|
validateActionProof,
|
|
13848
|
-
reconcileActionReadBack,
|
|
13849
13612
|
buildActionRunInputs,
|
|
13850
13613
|
executeActionBlock,
|
|
13851
13614
|
verifyCompletion,
|
|
@@ -13906,4 +13669,4 @@ export {
|
|
|
13906
13669
|
executeQueuedFlowAgentCoreCommands,
|
|
13907
13670
|
FlowAgentService
|
|
13908
13671
|
};
|
|
13909
|
-
//# sourceMappingURL=chunk-
|
|
13672
|
+
//# sourceMappingURL=chunk-GUKGNTGT.js.map
|