veryfront 0.1.700 → 0.1.703

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.
Files changed (37) hide show
  1. package/esm/cli/templates/manifest.d.ts +0 -2
  2. package/esm/cli/templates/manifest.js +1 -3
  3. package/esm/deno.js +1 -1
  4. package/esm/src/agent/streaming/fork-runtime-part-mapper.d.ts +59 -0
  5. package/esm/src/agent/streaming/fork-runtime-part-mapper.d.ts.map +1 -0
  6. package/esm/src/agent/streaming/fork-runtime-part-mapper.js +246 -0
  7. package/esm/src/agent/streaming/fork-runtime-stream.d.ts +2 -50
  8. package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
  9. package/esm/src/agent/streaming/fork-runtime-stream.js +3 -245
  10. package/esm/src/integrations/_data.d.ts.map +1 -1
  11. package/esm/src/integrations/_data.js +1 -42
  12. package/esm/src/oauth/providers/common.d.ts.map +1 -1
  13. package/esm/src/oauth/providers/common.js +6 -1
  14. package/esm/src/utils/version-constant.d.ts +1 -1
  15. package/esm/src/utils/version-constant.js +1 -1
  16. package/esm/src/workflow/claude-code/react/event-state-reducer.d.ts +37 -0
  17. package/esm/src/workflow/claude-code/react/event-state-reducer.d.ts.map +1 -0
  18. package/esm/src/workflow/claude-code/react/event-state-reducer.js +104 -0
  19. package/esm/src/workflow/claude-code/react/use-claude-code-stream.d.ts +3 -35
  20. package/esm/src/workflow/claude-code/react/use-claude-code-stream.d.ts.map +1 -1
  21. package/esm/src/workflow/claude-code/react/use-claude-code-stream.js +9 -78
  22. package/esm/src/workflow/claude-code/react/use-claude-code-websocket.d.ts +2 -27
  23. package/esm/src/workflow/claude-code/react/use-claude-code-websocket.d.ts.map +1 -1
  24. package/esm/src/workflow/claude-code/react/use-claude-code-websocket.js +5 -57
  25. package/esm/src/workflow/executor/dag/index.d.ts +1 -2
  26. package/esm/src/workflow/executor/dag/index.d.ts.map +1 -1
  27. package/esm/src/workflow/executor/dag/index.js +37 -216
  28. package/esm/src/workflow/executor/dag/loop-node-strategy.d.ts +13 -0
  29. package/esm/src/workflow/executor/dag/loop-node-strategy.d.ts.map +1 -0
  30. package/esm/src/workflow/executor/dag/loop-node-strategy.js +134 -0
  31. package/esm/src/workflow/executor/dag/map-node-strategy.d.ts +13 -0
  32. package/esm/src/workflow/executor/dag/map-node-strategy.d.ts.map +1 -0
  33. package/esm/src/workflow/executor/dag/map-node-strategy.js +78 -0
  34. package/esm/src/workflow/executor/dag/node-strategy-types.d.ts +11 -0
  35. package/esm/src/workflow/executor/dag/node-strategy-types.d.ts.map +1 -0
  36. package/esm/src/workflow/executor/dag/node-strategy-types.js +1 -0
  37. package/package.json +1 -1
@@ -0,0 +1,134 @@
1
+ import { parseDuration } from "../../types.js";
2
+ import { sleep } from "./utils.js";
3
+ export async function executeLoopNodeStrategy(input) {
4
+ const { node, config, context, nodeStates, runtime } = input;
5
+ const startTime = Date.now();
6
+ const previousResults = [];
7
+ let iteration = 0;
8
+ let exitReason = "condition";
9
+ let lastError;
10
+ const existingLoopState = context[`${node.id}_loop_state`];
11
+ // Child node states for the in-flight (resumed) iteration, so its already
12
+ // completed steps are not re-executed on resume (H9).
13
+ let resumeIterationNodeStates;
14
+ let resumeIteration;
15
+ if (existingLoopState) {
16
+ iteration = existingLoopState.iteration;
17
+ previousResults.push(...existingLoopState.previousResults);
18
+ resumeIterationNodeStates = existingLoopState.iterationNodeStates;
19
+ resumeIteration = existingLoopState.iteration;
20
+ }
21
+ while (iteration < config.maxIterations) {
22
+ const loopContext = {
23
+ iteration,
24
+ totalIterations: iteration,
25
+ previousResults: [...previousResults],
26
+ isFirstIteration: iteration === 0,
27
+ isLastAllowedIteration: iteration === config.maxIterations - 1,
28
+ };
29
+ if (!(await config.while(context, loopContext))) {
30
+ exitReason = "condition";
31
+ break;
32
+ }
33
+ const steps = typeof config.steps === "function"
34
+ ? config.steps(context, loopContext)
35
+ : config.steps;
36
+ // On resume, rehydrate the in-flight iteration's child node states so its
37
+ // already-completed steps are skipped instead of re-executed (H9).
38
+ const iterationNodeStates = resumeIteration === iteration && resumeIterationNodeStates
39
+ ? { ...resumeIterationNodeStates }
40
+ : {};
41
+ // Only rehydrate once; subsequent iterations start fresh.
42
+ resumeIterationNodeStates = undefined;
43
+ const result = await runtime.executeChildGraph(steps, {
44
+ id: `${node.id}_iter_${iteration}`,
45
+ workflowId: "",
46
+ status: "running",
47
+ input: context.input,
48
+ nodeStates: iterationNodeStates,
49
+ currentNodes: [],
50
+ context: { ...context, _loop: loopContext },
51
+ checkpoints: [],
52
+ pendingApprovals: [],
53
+ createdAt: new Date(),
54
+ });
55
+ if (result.waiting) {
56
+ Object.assign(nodeStates, result.nodeStates);
57
+ const state = {
58
+ nodeId: node.id,
59
+ status: "running",
60
+ output: { iteration, waiting: true, previousResults },
61
+ attempt: 1,
62
+ startedAt: new Date(startTime),
63
+ };
64
+ return {
65
+ state,
66
+ contextUpdates: {
67
+ ...result.context,
68
+ [`${node.id}_loop_state`]: {
69
+ iteration,
70
+ previousResults,
71
+ // Persist the in-flight iteration's child states so completed
72
+ // steps are not re-executed when this iteration resumes (H9).
73
+ iterationNodeStates: result.nodeStates,
74
+ },
75
+ },
76
+ waiting: true,
77
+ };
78
+ }
79
+ if (result.error) {
80
+ lastError = result.error;
81
+ exitReason = "error";
82
+ break;
83
+ }
84
+ previousResults.push(result.context);
85
+ Object.assign(context, result.context);
86
+ Object.assign(nodeStates, result.nodeStates);
87
+ if (config.delay && iteration < config.maxIterations - 1) {
88
+ const delayMs = typeof config.delay === "number" ? config.delay : parseDuration(config.delay);
89
+ await sleep(delayMs);
90
+ }
91
+ iteration++;
92
+ }
93
+ if (iteration >= config.maxIterations && exitReason !== "condition") {
94
+ exitReason = "maxIterations";
95
+ }
96
+ const finalLoopContext = {
97
+ iteration,
98
+ totalIterations: iteration,
99
+ previousResults,
100
+ isFirstIteration: false,
101
+ isLastAllowedIteration: true,
102
+ };
103
+ let completionUpdates = {};
104
+ if (exitReason === "maxIterations" && config.onMaxIterations) {
105
+ completionUpdates = await config.onMaxIterations(context, finalLoopContext);
106
+ }
107
+ else if (exitReason === "condition" && config.onComplete) {
108
+ completionUpdates = await config.onComplete(context, finalLoopContext);
109
+ }
110
+ const output = {
111
+ exitReason,
112
+ iterations: iteration,
113
+ previousResults,
114
+ ...completionUpdates,
115
+ };
116
+ const state = {
117
+ nodeId: node.id,
118
+ status: exitReason === "error" ? "failed" : "completed",
119
+ output,
120
+ error: lastError,
121
+ attempt: 1,
122
+ startedAt: new Date(startTime),
123
+ completedAt: new Date(),
124
+ };
125
+ runtime.onNodeComplete?.(node.id, state);
126
+ return {
127
+ state,
128
+ contextUpdates: {
129
+ [node.id]: output,
130
+ ...completionUpdates,
131
+ },
132
+ waiting: false,
133
+ };
134
+ }
@@ -0,0 +1,13 @@
1
+ import type { MapNodeConfig, NodeState, WorkflowContext, WorkflowNode } from "../../types.js";
2
+ import type { NodeExecutionResult } from "./types.js";
3
+ import type { NodeStrategyRuntime } from "./node-strategy-types.js";
4
+ interface ExecuteMapNodeStrategyInput {
5
+ node: WorkflowNode;
6
+ config: MapNodeConfig;
7
+ context: WorkflowContext;
8
+ nodeStates: Record<string, NodeState>;
9
+ runtime: NodeStrategyRuntime;
10
+ }
11
+ export declare function executeMapNodeStrategy(input: ExecuteMapNodeStrategyInput): Promise<NodeExecutionResult>;
12
+ export {};
13
+ //# sourceMappingURL=map-node-strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-node-strategy.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/executor/dag/map-node-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,eAAe,EAEf,YAAY,EAEb,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,UAAU,2BAA2B;IACnC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACtC,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAqCD,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,2BAA2B,GACjC,OAAO,CAAC,mBAAmB,CAAC,CAgE9B"}
@@ -0,0 +1,78 @@
1
+ import { INVALID_ARGUMENT } from "../../../errors/index.js";
2
+ import { deriveNodeStatus } from "./utils.js";
3
+ function isWorkflowDefinition(processor) {
4
+ return typeof processor === "object" && processor !== null && "steps" in processor;
5
+ }
6
+ function createMapChildNodes(node, config, items) {
7
+ return items.map((item, i) => {
8
+ const childId = `${node.id}_${i}`;
9
+ if (isWorkflowDefinition(config.processor)) {
10
+ return {
11
+ id: childId,
12
+ config: {
13
+ type: "subWorkflow",
14
+ workflow: config.processor,
15
+ input: item,
16
+ retry: config.retry,
17
+ checkpoint: false,
18
+ },
19
+ };
20
+ }
21
+ const processorConfig = { ...config.processor.config };
22
+ if (processorConfig.type === "step") {
23
+ processorConfig.input = item;
24
+ }
25
+ return { id: childId, config: processorConfig };
26
+ });
27
+ }
28
+ export async function executeMapNodeStrategy(input) {
29
+ const { node, config, context, nodeStates, runtime } = input;
30
+ const startTime = Date.now();
31
+ const items = typeof config.items === "function" ? await config.items(context) : config.items;
32
+ if (!Array.isArray(items)) {
33
+ throw INVALID_ARGUMENT.create({ detail: `Map node "${node.id}" items must be an array` });
34
+ }
35
+ if (items.length === 0) {
36
+ const state = {
37
+ nodeId: node.id,
38
+ status: "completed",
39
+ output: [],
40
+ attempt: 1,
41
+ startedAt: new Date(startTime),
42
+ completedAt: new Date(),
43
+ };
44
+ return { state, contextUpdates: { [node.id]: [] }, waiting: false };
45
+ }
46
+ const childNodes = createMapChildNodes(node, config, items);
47
+ const result = await runtime.executeChildGraph(childNodes, {
48
+ id: `${node.id}_map`,
49
+ workflowId: "",
50
+ status: "running",
51
+ input: context.input,
52
+ // Carry already-accumulated child states so completed children are
53
+ // skipped on resume instead of re-executing (H8).
54
+ nodeStates,
55
+ currentNodes: [],
56
+ context: { ...context },
57
+ checkpoints: [],
58
+ pendingApprovals: [],
59
+ createdAt: new Date(),
60
+ }, config.concurrency ? { maxConcurrency: config.concurrency } : undefined);
61
+ Object.assign(nodeStates, result.nodeStates);
62
+ const outputs = childNodes.map((child) => result.nodeStates[child.id]?.output);
63
+ const state = {
64
+ nodeId: node.id,
65
+ status: deriveNodeStatus(result.completed, result.waiting),
66
+ output: outputs,
67
+ error: result.error,
68
+ attempt: 1,
69
+ startedAt: new Date(startTime),
70
+ completedAt: result.completed ? new Date() : undefined,
71
+ };
72
+ runtime.onNodeComplete?.(node.id, state);
73
+ return {
74
+ state,
75
+ contextUpdates: result.completed ? { [node.id]: outputs } : {},
76
+ waiting: result.waiting,
77
+ };
78
+ }
@@ -0,0 +1,11 @@
1
+ import type { NodeState, WorkflowNode, WorkflowRun } from "../../types.js";
2
+ import type { DAGExecutionResult } from "./types.js";
3
+ export interface ChildGraphExecutionOptions {
4
+ maxConcurrency?: number;
5
+ }
6
+ export type ExecuteChildGraph = (nodes: WorkflowNode[], run: WorkflowRun, options?: ChildGraphExecutionOptions) => Promise<DAGExecutionResult>;
7
+ export interface NodeStrategyRuntime {
8
+ executeChildGraph: ExecuteChildGraph;
9
+ onNodeComplete?: (nodeId: string, state: NodeState) => void;
10
+ }
11
+ //# sourceMappingURL=node-strategy-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-strategy-types.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/executor/dag/node-strategy-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,0BAA0B;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAC9B,KAAK,EAAE,YAAY,EAAE,EACrB,GAAG,EAAE,WAAW,EAChB,OAAO,CAAC,EAAE,0BAA0B,KACjC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CAC7D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.700",
3
+ "version": "0.1.703",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",