@ixo/editor 5.10.1 → 5.12.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.
@@ -1,6 +1,6 @@
1
- import { Y as FlowNode, a1 as FlowNodeAuthzExtension, a2 as FlowNodeRuntimeState, W as IxoEditorType, f as UcanService, I as InvocationStore, $ as EvaluationStatus } from './index-DKKQa1q-.mjs';
1
+ import { Z as FlowNode, a2 as FlowNodeAuthzExtension, X as FlowNodeRuntimeState, W as IxoEditorType, f as UcanService, I as InvocationStore, a0 as EvaluationStatus, i as UcanCapability, U as UcanDelegationStore, S as StoredDelegation } from './index-C0ikjICf.mjs';
2
2
  import * as Y from 'yjs';
3
- import { Doc } from 'yjs';
3
+ import { Doc, Map } from 'yjs';
4
4
  import { MatrixClient } from 'matrix-js-sdk';
5
5
 
6
6
  /** Condition that gates when a capability activates. */
@@ -954,4 +954,229 @@ declare function readCompiledFlowFromYDoc(yDoc: Doc): CompiledFlow | null;
954
954
  */
955
955
  declare function decompileToBaseUcanFlow(compiled: CompiledFlow): BaseUcanFlow;
956
956
 
957
- export { type AuthorizationResult as A, type BaseUcanFlow as B, type CompilerRegistry as C, type ActionContext as D, type ExecuteNodeParams as E, type FlowRuntimeStateManager as F, type ActionResult as G, type ConditionRef as H, type ActorConstraint as I, type RuntimeRef as J, type CompiledBlock as K, type CompiledEdge as L, type MergeResult as M, type NodeActionResult as N, type OutputSchemaField as O, type CompiledFlowNode as P, type TriggerSpec as Q, type ReadFlowOptions as R, type SetupFlowOptions as S, type TTLConstraint as T, isRuntimeRef as U, buildAuthzFromProps as a, buildFlowNodeFromBlock as b, createRuntimeStateManager as c, type ExecutionOutcome as d, executeNode as e, type ExecutionContext as f, readFlowFromEditor as g, readFlow as h, isAuthorized as i, setActiveEditor as j, getActiveEditor as k, compileBaseUcanFlow as l, readCompiledFlowFromYDoc as m, mergeCompiledFlows as n, decompileToBaseUcanFlow as o, type SetupFlowResult as p, type ReadFlowResult as q, readFlowAsBaseUcan as r, setupFlowFromBaseUcan as s, type ReadableEditor as t, type FlowCapability as u, type CompiledFlow as v, type FlowStrategy as w, type ActionDefinition as x, type ActionServices as y, clearRuntimeForTemplateClone as z };
957
+ type FlowAgentPublicNodeState = 'Pending' | 'Blocked' | 'Overdue' | 'Done';
958
+ type FlowAgentRunPhase = 'Running' | 'Validating' | 'Failed' | 'Archived';
959
+ type FlowAgentBlockerCause = 'missing_input' | 'failed_upstream' | 'missing_ucan' | 'stale_config' | 'service_error' | 'external_confirmation_pending' | 'validation_mismatch' | 'unknown';
960
+ type FlowAgentCommandType = 'diagnose_blocker' | 'assign_actor' | 'notify_actor' | 'execute_action' | 'validate_external_state' | 'submit_claim' | 'watch_udid' | 'archive_flow' | 'propose_config_change';
961
+ type FlowAgentCommandStatus = 'queued' | 'leased' | 'running' | 'confirmed' | 'failed' | 'skipped';
962
+ type FlowAgentLedgerEventType = 'agent.decision' | 'agent.command' | 'agent.validation' | 'agent.escalation' | 'agent.memory';
963
+ interface FlowAgentActor {
964
+ did: string;
965
+ matrixUserId?: string;
966
+ displayName?: string;
967
+ skills?: string[];
968
+ }
969
+ interface FlowAgentLease {
970
+ id: string;
971
+ commandId: string;
972
+ nodeId: string;
973
+ actorDid: string;
974
+ acquiredAt: number;
975
+ expiresAt: number;
976
+ epoch: number;
977
+ }
978
+ interface FlowAgentNodeSnapshot {
979
+ nodeId: string;
980
+ blockType: string;
981
+ actionType?: string;
982
+ title?: string;
983
+ runtime: FlowNodeRuntimeState;
984
+ publicState: FlowAgentPublicNodeState;
985
+ blockerCause?: FlowAgentBlockerCause;
986
+ assigneeDid?: string;
987
+ dueAt?: number;
988
+ pendingInvocationCount: number;
989
+ }
990
+ interface FlowAgentCommandBase {
991
+ id: string;
992
+ type: FlowAgentCommandType;
993
+ flowId: string;
994
+ flowUri: string;
995
+ nodeId: string;
996
+ actorDid: string;
997
+ status: FlowAgentCommandStatus;
998
+ capability: UcanCapability;
999
+ idempotencyKey: string;
1000
+ createdAt: number;
1001
+ updatedAt: number;
1002
+ reason: string;
1003
+ payload: Record<string, unknown>;
1004
+ lease?: FlowAgentLease;
1005
+ error?: string;
1006
+ }
1007
+ type FlowAgentCommand = FlowAgentCommandBase;
1008
+ interface FlowAgentLedgerEvent {
1009
+ id: string;
1010
+ type: FlowAgentLedgerEventType;
1011
+ flowId: string;
1012
+ nodeId?: string;
1013
+ commandId?: string;
1014
+ actorDid: string;
1015
+ timestamp: number;
1016
+ details: Record<string, unknown>;
1017
+ }
1018
+ interface FlowAgentMaps {
1019
+ outbox: Map<FlowAgentCommand>;
1020
+ leases: Map<FlowAgentLease>;
1021
+ }
1022
+ interface FlowAgentPolicyDecision {
1023
+ allowed: boolean;
1024
+ reason: string;
1025
+ capability: UcanCapability;
1026
+ proofCids: string[];
1027
+ }
1028
+ interface FlowAgentContext {
1029
+ yDoc: Doc;
1030
+ editor?: IxoEditorType;
1031
+ blocks?: unknown[];
1032
+ flowId: string;
1033
+ flowUri: string;
1034
+ actor: FlowAgentActor;
1035
+ now?: () => number;
1036
+ }
1037
+ interface FlowAgentCommandResult {
1038
+ commandId: string;
1039
+ success: boolean;
1040
+ output?: Record<string, unknown>;
1041
+ confirmed?: boolean;
1042
+ error?: string;
1043
+ }
1044
+ interface FlowAgentExecutor {
1045
+ executeAction?: (command: FlowAgentCommand, context: FlowAgentContext) => Promise<FlowAgentCommandResult>;
1046
+ assignActor?: (command: FlowAgentCommand, context: FlowAgentContext) => Promise<FlowAgentCommandResult>;
1047
+ notifyActor?: (command: FlowAgentCommand, context: FlowAgentContext) => Promise<FlowAgentCommandResult>;
1048
+ validateExternalState?: (command: FlowAgentCommand, context: FlowAgentContext) => Promise<FlowAgentCommandResult>;
1049
+ submitClaim?: (command: FlowAgentCommand, context: FlowAgentContext) => Promise<FlowAgentCommandResult>;
1050
+ watchUdid?: (command: FlowAgentCommand, context: FlowAgentContext) => Promise<FlowAgentCommandResult>;
1051
+ archiveFlow?: (command: FlowAgentCommand, context: FlowAgentContext) => Promise<FlowAgentCommandResult>;
1052
+ proposeConfigChange?: (command: FlowAgentCommand, context: FlowAgentContext) => Promise<FlowAgentCommandResult>;
1053
+ diagnoseBlocker?: (command: FlowAgentCommand, context: FlowAgentContext) => Promise<FlowAgentCommandResult>;
1054
+ }
1055
+ interface FlowAgentTickResult {
1056
+ flowDone: boolean;
1057
+ snapshots: FlowAgentNodeSnapshot[];
1058
+ queuedCommands: FlowAgentCommand[];
1059
+ executedCommands: FlowAgentCommandResult[];
1060
+ }
1061
+
1062
+ interface CreateAgentCommandParams {
1063
+ type: FlowAgentCommandType;
1064
+ flowId: string;
1065
+ flowUri: string;
1066
+ nodeId: string;
1067
+ actor: FlowAgentActor;
1068
+ reason: string;
1069
+ payload?: Record<string, unknown>;
1070
+ now?: number;
1071
+ }
1072
+ declare function createAgentCommand({ type, flowId, flowUri, nodeId, actor, reason, payload, now }: CreateAgentCommandParams): FlowAgentCommand;
1073
+ declare function validateAgentCommand(command: FlowAgentCommand): {
1074
+ valid: boolean;
1075
+ error?: string;
1076
+ };
1077
+ declare function isExternalMutation(type: FlowAgentCommandType): boolean;
1078
+
1079
+ interface BuildFlowAgentContextParams {
1080
+ yDoc: Doc;
1081
+ flowId: string;
1082
+ flowUri?: string;
1083
+ actor: FlowAgentActor;
1084
+ blocks?: unknown[];
1085
+ editor?: IxoEditorType;
1086
+ now?: () => number;
1087
+ }
1088
+ /**
1089
+ * Builds the host-facing runtime context expected by the Flow Agent.
1090
+ *
1091
+ * Headless hosts own Matrix login, room joins, and Y.Doc sync. Once a host has
1092
+ * a live room document and an agent identity, this helper gives it the stable
1093
+ * context shape to pass into `tickFlowAgent` or `FlowAgentService`.
1094
+ */
1095
+ declare function buildFlowAgentContext({ yDoc, flowId, flowUri, actor, blocks, editor, now }: BuildFlowAgentContextParams): FlowAgentContext;
1096
+
1097
+ interface AcquireFlowAgentLeaseParams {
1098
+ leases: Map<FlowAgentLease>;
1099
+ commandId: string;
1100
+ nodeId: string;
1101
+ actorDid: string;
1102
+ now?: number;
1103
+ ttlMs?: number;
1104
+ }
1105
+ declare function acquireFlowAgentLease({ leases, commandId, nodeId, actorDid, now, ttlMs, }: AcquireFlowAgentLeaseParams): FlowAgentLease | null;
1106
+ declare function validateFlowAgentLease(leases: Map<FlowAgentLease>, lease: FlowAgentLease, now?: number): boolean;
1107
+ declare function releaseFlowAgentLease(leases: Map<FlowAgentLease>, lease: FlowAgentLease): boolean;
1108
+ declare function cleanupExpiredFlowAgentLeases(leases: Map<FlowAgentLease>, now?: number): FlowAgentLease[];
1109
+
1110
+ declare function requiredCapabilityForCommand(type: FlowAgentCommandType, flowUri: string, nodeId: string): UcanCapability;
1111
+ declare function isCapabilityMatch(granted: UcanCapability, required: UcanCapability): boolean;
1112
+ declare function canMatches(granted: string, required: string): boolean;
1113
+ declare function resourceMatches(granted: string, required: string): boolean;
1114
+ interface EvaluateFlowAgentPolicyParams {
1115
+ actorDid: string;
1116
+ commandType: FlowAgentCommandType;
1117
+ flowUri: string;
1118
+ nodeId: string;
1119
+ delegationStore?: UcanDelegationStore;
1120
+ delegations?: StoredDelegation[];
1121
+ now?: number;
1122
+ }
1123
+ declare function evaluateFlowAgentPolicy({ actorDid, commandType, flowUri, nodeId, delegationStore, delegations, now, }: EvaluateFlowAgentPolicyParams): FlowAgentPolicyDecision;
1124
+
1125
+ interface FlowAgentOrchestratorOptions {
1126
+ delegationStore?: UcanDelegationStore;
1127
+ delegations?: StoredDelegation[];
1128
+ candidateActors?: FlowAgentActor[];
1129
+ executor?: FlowAgentExecutor;
1130
+ leaseTtlMs?: number;
1131
+ archiveWhenDone?: boolean;
1132
+ }
1133
+ declare function planRalphLoopCommands(context: FlowAgentContext, options?: FlowAgentOrchestratorOptions): {
1134
+ snapshots: FlowAgentNodeSnapshot[];
1135
+ queuedCommands: FlowAgentCommand[];
1136
+ flowDone: boolean;
1137
+ };
1138
+ declare function executeQueuedAgentCommands(context: FlowAgentContext, options?: FlowAgentOrchestratorOptions): Promise<FlowAgentCommandResult[]>;
1139
+ declare function tickFlowAgent(context: FlowAgentContext, options?: FlowAgentOrchestratorOptions): Promise<FlowAgentTickResult>;
1140
+
1141
+ interface FlowAgentServiceOptions extends FlowAgentOrchestratorOptions {
1142
+ intervalMs?: number;
1143
+ onTick?: (result: FlowAgentTickResult) => void | Promise<void>;
1144
+ onError?: (error: unknown) => void;
1145
+ }
1146
+ /**
1147
+ * Headless-service adapter boundary.
1148
+ *
1149
+ * Host applications own Matrix login, room joins, and Y.Doc sync. Once they
1150
+ * have a live Y.Doc/editor snapshot, this service provides the deterministic
1151
+ * Ralph-loop tick and command execution cycle.
1152
+ */
1153
+ declare class FlowAgentService {
1154
+ private readonly context;
1155
+ private readonly options;
1156
+ private timer;
1157
+ private running;
1158
+ constructor(context: FlowAgentContext, options?: FlowAgentServiceOptions);
1159
+ tick(): Promise<FlowAgentTickResult>;
1160
+ start(): void;
1161
+ stop(): void;
1162
+ }
1163
+
1164
+ declare function getFlowAgentMaps(yDoc: Doc): FlowAgentMaps;
1165
+ declare function computeAgentCommandId(params: {
1166
+ flowId: string;
1167
+ nodeId: string;
1168
+ type: string;
1169
+ payload: Record<string, unknown>;
1170
+ }): string;
1171
+ declare function queueAgentCommand(yDoc: Doc, command: FlowAgentCommand): {
1172
+ command: FlowAgentCommand;
1173
+ created: boolean;
1174
+ };
1175
+ declare function readQueuedAgentCommands(yDoc: Doc): FlowAgentCommand[];
1176
+ declare function updateAgentCommand(yDoc: Doc, commandId: string, patch: Partial<FlowAgentCommand>): FlowAgentCommand | null;
1177
+ declare function appendAgentLedgerEvent(yDoc: Doc, event: Omit<FlowAgentLedgerEvent, 'id'> & {
1178
+ id?: string;
1179
+ }): FlowAgentLedgerEvent;
1180
+ declare function readAgentLedgerEvents(yDoc: Doc, eventType?: FlowAgentLedgerEventType): FlowAgentLedgerEvent[];
1181
+
1182
+ export { type FlowAgentContext as $, type AuthorizationResult as A, type BaseUcanFlow as B, type CompilerRegistry as C, buildFlowAgentContext as D, type ExecuteNodeParams as E, type FlowRuntimeStateManager as F, cleanupExpiredFlowAgentLeases as G, createAgentCommand as H, evaluateFlowAgentPolicy as I, executeQueuedAgentCommands as J, getFlowAgentMaps as K, planRalphLoopCommands as L, type MergeResult as M, type NodeActionResult as N, queueAgentCommand as O, readAgentLedgerEvents as P, readQueuedAgentCommands as Q, type ReadFlowOptions as R, type SetupFlowOptions as S, releaseFlowAgentLease as T, tickFlowAgent as U, validateAgentCommand as V, validateFlowAgentLease as W, type BuildFlowAgentContextParams as X, type FlowAgentActor as Y, type FlowAgentCommand as Z, type FlowAgentCommandResult as _, buildAuthzFromProps as a, type FlowAgentExecutor as a0, type FlowAgentLease as a1, type FlowAgentNodeSnapshot as a2, type FlowAgentPublicNodeState as a3, type FlowAgentTickResult as a4, type ActionDefinition as a5, type ActionServices as a6, type FlowAgentBlockerCause as a7, clearRuntimeForTemplateClone as a8, type ActionContext as a9, type CompiledBlock as aA, type CompiledEdge as aB, type CompiledFlowNode as aC, type TriggerSpec as aD, isRuntimeRef as aE, type ActionResult as aa, type OutputSchemaField as ab, canMatches as ac, computeAgentCommandId as ad, isCapabilityMatch as ae, isExternalMutation as af, requiredCapabilityForCommand as ag, resourceMatches as ah, updateAgentCommand as ai, type AcquireFlowAgentLeaseParams as aj, type CreateAgentCommandParams as ak, type EvaluateFlowAgentPolicyParams as al, type FlowAgentOrchestratorOptions as am, type FlowAgentServiceOptions as an, type FlowAgentCommandBase as ao, type FlowAgentCommandStatus as ap, type FlowAgentCommandType as aq, type FlowAgentLedgerEvent as ar, type FlowAgentLedgerEventType as as, type FlowAgentMaps as at, type FlowAgentPolicyDecision as au, type FlowAgentRunPhase as av, type ConditionRef as aw, type ActorConstraint as ax, type TTLConstraint as ay, type RuntimeRef as az, buildFlowNodeFromBlock as b, createRuntimeStateManager as c, type ExecutionOutcome as d, executeNode as e, type ExecutionContext as f, readFlowFromEditor as g, readFlow as h, isAuthorized as i, setActiveEditor as j, getActiveEditor as k, compileBaseUcanFlow as l, readCompiledFlowFromYDoc as m, mergeCompiledFlows as n, decompileToBaseUcanFlow as o, type SetupFlowResult as p, type ReadFlowResult as q, readFlowAsBaseUcan as r, setupFlowFromBaseUcan as s, type ReadableEditor as t, type FlowCapability as u, type CompiledFlow as v, type FlowStrategy as w, FlowAgentService as x, acquireFlowAgentLease as y, appendAgentLedgerEvent as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixo/editor",
3
- "version": "5.10.1",
3
+ "version": "5.12.0",
4
4
  "description": "A custom BlockNote editor wrapper for IXO team",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -1,63 +0,0 @@
1
- import {
2
- isRuntimeRef
3
- } from "./chunk-DQCYLHDD.mjs";
4
-
5
- // src/core/lib/flowCompiler/resolveRefs.ts
6
- function resolveRuntimeRefs(nb, getNodeOutput, triggerContext) {
7
- return resolveValue(nb, getNodeOutput, triggerContext);
8
- }
9
- function resolveValue(value, getNodeOutput, triggerContext) {
10
- if (isRuntimeRef(value)) {
11
- return resolveRef(value.$ref, getNodeOutput, triggerContext);
12
- }
13
- if (Array.isArray(value)) {
14
- return value.map((item) => resolveValue(item, getNodeOutput, triggerContext));
15
- }
16
- if (typeof value === "object" && value !== null) {
17
- const result = {};
18
- for (const [key, val] of Object.entries(value)) {
19
- result[key] = resolveValue(val, getNodeOutput, triggerContext);
20
- }
21
- return result;
22
- }
23
- return value;
24
- }
25
- function resolveRef(ref, getNodeOutput, triggerContext) {
26
- if (ref.startsWith("trigger.payload.")) {
27
- if (!triggerContext) {
28
- throw new Error(`Trigger ref "${ref}" used outside of a listener invocation context. trigger.payload.* refs are only valid on block.event-triggered blocks.`);
29
- }
30
- const fieldPath2 = ref.slice("trigger.payload.".length);
31
- return getNestedValue(triggerContext.payload, fieldPath2);
32
- }
33
- if (triggerContext && Object.prototype.hasOwnProperty.call(triggerContext.refSnapshots, ref)) {
34
- return triggerContext.refSnapshots[ref];
35
- }
36
- const outputIndex = ref.indexOf(".output.");
37
- if (outputIndex === -1) {
38
- throw new Error(`Invalid runtime reference "${ref}". Expected format: "nodeId.output.fieldPath" or "trigger.payload.fieldPath"`);
39
- }
40
- const nodeId = ref.slice(0, outputIndex);
41
- const fieldPath = ref.slice(outputIndex + ".output.".length);
42
- const output = getNodeOutput(nodeId);
43
- if (!output) {
44
- return void 0;
45
- }
46
- return getNestedValue(output, fieldPath);
47
- }
48
- function getNestedValue(obj, path) {
49
- const parts = path.split(".");
50
- let current = obj;
51
- for (const part of parts) {
52
- if (current == null || typeof current !== "object") {
53
- return void 0;
54
- }
55
- current = current[part];
56
- }
57
- return current;
58
- }
59
-
60
- export {
61
- resolveRuntimeRefs
62
- };
63
- //# sourceMappingURL=chunk-UKZ5T7V4.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/lib/flowCompiler/resolveRefs.ts"],"sourcesContent":["import { isRuntimeRef } from '../../types/baseUcan';\n\n/**\n * Context passed to resolveRuntimeRefs when resolving inputs for a triggered\n * listener block. The runtime constructs this from a PendingInvocation when\n * the assignee invokes the listener.\n *\n * - `payload`: the frozen event payload, used to resolve `trigger.payload.*` refs\n * - `refSnapshots`: frozen `nodeId.output.*` values captured at queue time,\n * used to resolve those refs against the moment of emission rather than\n * current state. See docs/events-and-triggers-plan.md §3.5.1 for the\n * Sally → Mike scenario this fixes.\n */\nexport interface TriggerResolutionContext {\n payload: Record<string, unknown>;\n refSnapshots: Record<string, unknown>;\n}\n\n/**\n * Resolve runtime references in an nb (caveats) object.\n *\n * At compile time, `{ \"$ref\": \"nodeId.output.fieldPath\" }` values are serialized\n * as-is into the block's `inputs` JSON string. At execution time, this function\n * replaces them with actual output values from upstream nodes.\n *\n * Two ref namespaces are supported:\n * - `nodeId.output.fieldPath` — looked up via `getNodeOutput`. When a\n * `triggerContext` is provided AND `refSnapshots[ref]` exists, the\n * snapshot is preferred over the live lookup. This is the load-bearing\n * fix for the lag-time scenario where multiple pending invocations are\n * queued and the source block re-runs before the assignee acts on them.\n * - `trigger.payload.fieldPath` — looked up in `triggerContext.payload`.\n * Only valid when `triggerContext` is provided (i.e. resolving inputs\n * for a triggered listener invocation). Compile-time validation in\n * compiler.ts guarantees these only appear on `block.event`-triggered\n * blocks.\n *\n * @param nb - The caveats object (may contain nested RuntimeRef values)\n * @param getNodeOutput - Lookup function for upstream node outputs\n * @param triggerContext - Optional, present only for triggered listener invocations\n * @returns A new object with all $ref values resolved\n */\nexport function resolveRuntimeRefs(\n nb: Record<string, unknown>,\n getNodeOutput: (nodeId: string) => Record<string, unknown> | undefined,\n triggerContext?: TriggerResolutionContext\n): Record<string, unknown> {\n return resolveValue(nb, getNodeOutput, triggerContext) as Record<string, unknown>;\n}\n\nfunction resolveValue(value: unknown, getNodeOutput: (nodeId: string) => Record<string, unknown> | undefined, triggerContext?: TriggerResolutionContext): unknown {\n if (isRuntimeRef(value)) {\n return resolveRef(value.$ref, getNodeOutput, triggerContext);\n }\n\n if (Array.isArray(value)) {\n return value.map((item) => resolveValue(item, getNodeOutput, triggerContext));\n }\n\n if (typeof value === 'object' && value !== null) {\n const result: Record<string, unknown> = {};\n for (const [key, val] of Object.entries(value)) {\n result[key] = resolveValue(val, getNodeOutput, triggerContext);\n }\n return result;\n }\n\n return value;\n}\n\n/**\n * Resolve a single $ref string.\n *\n * Supported forms:\n * - \"trigger.payload.fieldPath\" — looked up in triggerContext.payload\n * - \"nodeId.output.fieldPath\" — looked up in triggerContext.refSnapshots first\n * (if present), falling back to getNodeOutput. Snapshot preference is\n * what makes the Sally → Mike scenario produce frozen values per pending\n * invocation.\n */\nfunction resolveRef(ref: string, getNodeOutput: (nodeId: string) => Record<string, unknown> | undefined, triggerContext?: TriggerResolutionContext): unknown {\n // trigger.payload.* — only valid when a triggerContext is provided\n if (ref.startsWith('trigger.payload.')) {\n if (!triggerContext) {\n throw new Error(`Trigger ref \"${ref}\" used outside of a listener invocation context. trigger.payload.* refs are only valid on block.event-triggered blocks.`);\n }\n const fieldPath = ref.slice('trigger.payload.'.length);\n return getNestedValue(triggerContext.payload, fieldPath);\n }\n\n // nodeId.output.fieldPath — prefer the snapshot if we're inside a trigger context\n if (triggerContext && Object.prototype.hasOwnProperty.call(triggerContext.refSnapshots, ref)) {\n return triggerContext.refSnapshots[ref];\n }\n\n // Parse \"nodeId.output.fieldPath\"\n const outputIndex = ref.indexOf('.output.');\n if (outputIndex === -1) {\n throw new Error(`Invalid runtime reference \"${ref}\". Expected format: \"nodeId.output.fieldPath\" or \"trigger.payload.fieldPath\"`);\n }\n\n const nodeId = ref.slice(0, outputIndex);\n const fieldPath = ref.slice(outputIndex + '.output.'.length);\n\n const output = getNodeOutput(nodeId);\n if (!output) {\n return undefined;\n }\n\n // Traverse the field path (supports dot notation)\n return getNestedValue(output, fieldPath);\n}\n\nfunction getNestedValue(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split('.');\n let current: unknown = obj;\n\n for (const part of parts) {\n if (current == null || typeof current !== 'object') {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n\n return current;\n}\n"],"mappings":";;;;;AA0CO,SAAS,mBACd,IACA,eACA,gBACyB;AACzB,SAAO,aAAa,IAAI,eAAe,cAAc;AACvD;AAEA,SAAS,aAAa,OAAgB,eAAwE,gBAAoD;AAChK,MAAI,aAAa,KAAK,GAAG;AACvB,WAAO,WAAW,MAAM,MAAM,eAAe,cAAc;AAAA,EAC7D;AAEA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM,IAAI,CAAC,SAAS,aAAa,MAAM,eAAe,cAAc,CAAC;AAAA,EAC9E;AAEA,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,UAAM,SAAkC,CAAC;AACzC,eAAW,CAAC,KAAK,GAAG,KAAK,OAAO,QAAQ,KAAK,GAAG;AAC9C,aAAO,GAAG,IAAI,aAAa,KAAK,eAAe,cAAc;AAAA,IAC/D;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAYA,SAAS,WAAW,KAAa,eAAwE,gBAAoD;AAE3J,MAAI,IAAI,WAAW,kBAAkB,GAAG;AACtC,QAAI,CAAC,gBAAgB;AACnB,YAAM,IAAI,MAAM,gBAAgB,GAAG,yHAAyH;AAAA,IAC9J;AACA,UAAMA,aAAY,IAAI,MAAM,mBAAmB,MAAM;AACrD,WAAO,eAAe,eAAe,SAASA,UAAS;AAAA,EACzD;AAGA,MAAI,kBAAkB,OAAO,UAAU,eAAe,KAAK,eAAe,cAAc,GAAG,GAAG;AAC5F,WAAO,eAAe,aAAa,GAAG;AAAA,EACxC;AAGA,QAAM,cAAc,IAAI,QAAQ,UAAU;AAC1C,MAAI,gBAAgB,IAAI;AACtB,UAAM,IAAI,MAAM,8BAA8B,GAAG,8EAA8E;AAAA,EACjI;AAEA,QAAM,SAAS,IAAI,MAAM,GAAG,WAAW;AACvC,QAAM,YAAY,IAAI,MAAM,cAAc,WAAW,MAAM;AAE3D,QAAM,SAAS,cAAc,MAAM;AACnC,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AAGA,SAAO,eAAe,QAAQ,SAAS;AACzC;AAEA,SAAS,eAAe,KAA8B,MAAuB;AAC3E,QAAM,QAAQ,KAAK,MAAM,GAAG;AAC5B,MAAI,UAAmB;AAEvB,aAAW,QAAQ,OAAO;AACxB,QAAI,WAAW,QAAQ,OAAO,YAAY,UAAU;AAClD,aAAO;AAAA,IACT;AACA,cAAW,QAAoC,IAAI;AAAA,EACrD;AAEA,SAAO;AACT;","names":["fieldPath"]}