@xzzpig/pi-subagents 0.1.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/CHANGELOG.md +1621 -0
- package/LICENSE +21 -0
- package/README.md +118 -0
- package/agents/delegate.md +14 -0
- package/agents/oracle.md +74 -0
- package/agents/researcher.md +52 -0
- package/agents/reviewer.md +79 -0
- package/agents/scout.md +50 -0
- package/agents/worker.md +58 -0
- package/index.ts +1 -0
- package/inspector-runner.mjs +11 -0
- package/install.mjs +93 -0
- package/package.json +105 -0
- package/prompts/gather-context-and-clarify.md +13 -0
- package/prompts/parallel-cleanup.md +59 -0
- package/prompts/parallel-research.md +50 -0
- package/prompts/parallel-review.md +54 -0
- package/prompts/review-loop.md +43 -0
- package/skills/pi-subagents/SKILL.md +41 -0
- package/skills/pi-subagents/references/constraints-and-recipes.md +251 -0
- package/skills/pi-subagents/references/execution-controls.md +428 -0
- package/skills/pi-subagents/references/management-authoring-rpc.md +161 -0
- package/skills/pi-subagents/references/prompting-and-roles.md +242 -0
- package/src/agents/agent-management.ts +1256 -0
- package/src/agents/agent-memory.ts +254 -0
- package/src/agents/agent-refinements.ts +624 -0
- package/src/agents/agent-scope.ts +6 -0
- package/src/agents/agent-selection.ts +25 -0
- package/src/agents/agent-serializer.ts +163 -0
- package/src/agents/agents.ts +1889 -0
- package/src/agents/chain-serializer.ts +280 -0
- package/src/agents/frontmatter.ts +149 -0
- package/src/agents/identity.ts +30 -0
- package/src/agents/proactive-skills.ts +194 -0
- package/src/agents/skills.ts +761 -0
- package/src/api/background-work.ts +197 -0
- package/src/api/capability-ceiling.ts +17 -0
- package/src/api/control-channel.ts +4 -0
- package/src/api/delegation.ts +119 -0
- package/src/api/external-runs.ts +129 -0
- package/src/api/intercom-bridge.ts +3 -0
- package/src/api/pi-args.ts +5 -0
- package/src/api/preflight.ts +403 -0
- package/src/api/shared-types.ts +19 -0
- package/src/extension/config.ts +76 -0
- package/src/extension/control-notices.ts +58 -0
- package/src/extension/doctor.ts +230 -0
- package/src/extension/fanout-child.ts +201 -0
- package/src/extension/index.ts +805 -0
- package/src/extension/public-execution.ts +71 -0
- package/src/extension/rpc.ts +653 -0
- package/src/extension/schemas.ts +375 -0
- package/src/extension/steering-notices.ts +35 -0
- package/src/extension/tool-description.ts +164 -0
- package/src/inspectors/herdr/actions.ts +229 -0
- package/src/inspectors/herdr/client.ts +130 -0
- package/src/inspectors/herdr/inspector-runner.ts +141 -0
- package/src/inspectors/herdr/project-panes.ts +154 -0
- package/src/integrations/herdr-status.ts +330 -0
- package/src/intercom/intercom-bridge.ts +187 -0
- package/src/intercom/native-supervisor-channel.ts +715 -0
- package/src/intercom/result-intercom.ts +421 -0
- package/src/missions/actions.ts +410 -0
- package/src/missions/goal-driver.ts +162 -0
- package/src/missions/lifecycle.ts +346 -0
- package/src/missions/store.ts +507 -0
- package/src/missions/types.ts +157 -0
- package/src/missions/workflow-state.ts +250 -0
- package/src/policy/authority.ts +46 -0
- package/src/profiles/profiles.ts +661 -0
- package/src/runs/background/async-execution.ts +1574 -0
- package/src/runs/background/async-job-tracker.ts +511 -0
- package/src/runs/background/async-resume.ts +539 -0
- package/src/runs/background/async-status.ts +542 -0
- package/src/runs/background/auto-drain.ts +67 -0
- package/src/runs/background/chain-append.ts +328 -0
- package/src/runs/background/chain-root-attachment.ts +199 -0
- package/src/runs/background/completion-batcher.ts +168 -0
- package/src/runs/background/completion-dedupe.ts +54 -0
- package/src/runs/background/control-channel.ts +692 -0
- package/src/runs/background/fleet-view.ts +540 -0
- package/src/runs/background/notify.ts +332 -0
- package/src/runs/background/parallel-groups.ts +45 -0
- package/src/runs/background/process-terminal.ts +280 -0
- package/src/runs/background/result-watcher.ts +414 -0
- package/src/runs/background/retained-children.ts +68 -0
- package/src/runs/background/run-id-resolver.ts +167 -0
- package/src/runs/background/run-status.ts +504 -0
- package/src/runs/background/scheduled-runs.ts +753 -0
- package/src/runs/background/stale-run-reconciler.ts +396 -0
- package/src/runs/background/steering.ts +239 -0
- package/src/runs/background/subagent-runner.ts +4718 -0
- package/src/runs/background/subagent-wait.ts +661 -0
- package/src/runs/background/top-level-async.ts +14 -0
- package/src/runs/background/wait-completions.ts +112 -0
- package/src/runs/background/wait-config.ts +36 -0
- package/src/runs/background/wait-subscriptions.ts +253 -0
- package/src/runs/background/wait-tool.ts +34 -0
- package/src/runs/foreground/async-steering-action.ts +256 -0
- package/src/runs/foreground/async-stop-action.ts +65 -0
- package/src/runs/foreground/chain-clarify.ts +1354 -0
- package/src/runs/foreground/chain-execution.ts +1527 -0
- package/src/runs/foreground/execution.ts +1868 -0
- package/src/runs/foreground/foreground-control.ts +132 -0
- package/src/runs/foreground/subagent-executor.ts +5532 -0
- package/src/runs/shared/acceptance.ts +1365 -0
- package/src/runs/shared/agent-contract.ts +38 -0
- package/src/runs/shared/capability-ceiling.ts +209 -0
- package/src/runs/shared/chain-outputs.ts +118 -0
- package/src/runs/shared/child-protocol.ts +401 -0
- package/src/runs/shared/completion-guard.ts +95 -0
- package/src/runs/shared/context-mode.ts +44 -0
- package/src/runs/shared/dynamic-fanout.ts +297 -0
- package/src/runs/shared/external-cli-runner.ts +130 -0
- package/src/runs/shared/long-running-guard.ts +220 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +406 -0
- package/src/runs/shared/model-fallback.ts +336 -0
- package/src/runs/shared/model-scope.ts +128 -0
- package/src/runs/shared/nested-events.ts +1076 -0
- package/src/runs/shared/nested-path.ts +52 -0
- package/src/runs/shared/nested-render.ts +123 -0
- package/src/runs/shared/parallel-handoff.ts +238 -0
- package/src/runs/shared/parallel-utils.ts +256 -0
- package/src/runs/shared/permissions.ts +95 -0
- package/src/runs/shared/pi-args.ts +808 -0
- package/src/runs/shared/pi-spawn.ts +163 -0
- package/src/runs/shared/process-signal.ts +19 -0
- package/src/runs/shared/run-history.ts +181 -0
- package/src/runs/shared/runtime-acknowledged-extensions.ts +71 -0
- package/src/runs/shared/session-lease.ts +299 -0
- package/src/runs/shared/single-output.ts +235 -0
- package/src/runs/shared/spawn-budget.ts +128 -0
- package/src/runs/shared/structured-output.ts +182 -0
- package/src/runs/shared/subagent-control.ts +231 -0
- package/src/runs/shared/subagent-prompt-runtime.ts +588 -0
- package/src/runs/shared/subagent-startup-retry.ts +104 -0
- package/src/runs/shared/task-intent.ts +181 -0
- package/src/runs/shared/tool-availability.ts +83 -0
- package/src/runs/shared/tool-budget.ts +80 -0
- package/src/runs/shared/turn-budget.ts +98 -0
- package/src/runs/shared/usage-budget.ts +65 -0
- package/src/runs/shared/workflow-graph.ts +231 -0
- package/src/runs/shared/worktree.ts +759 -0
- package/src/shared/accessible-dir.ts +47 -0
- package/src/shared/artifacts.ts +285 -0
- package/src/shared/atomic-json.ts +61 -0
- package/src/shared/child-transcript.ts +264 -0
- package/src/shared/file-coalescer.ts +40 -0
- package/src/shared/file-system-retry.ts +47 -0
- package/src/shared/fork-context.ts +213 -0
- package/src/shared/formatters.ts +133 -0
- package/src/shared/jsonl-writer.ts +81 -0
- package/src/shared/launch-contract.ts +124 -0
- package/src/shared/model-info.ts +81 -0
- package/src/shared/post-exit-stdio-guard.ts +85 -0
- package/src/shared/session-identity.ts +10 -0
- package/src/shared/session-tokens.ts +44 -0
- package/src/shared/settings.ts +501 -0
- package/src/shared/status-format.ts +55 -0
- package/src/shared/types.ts +2069 -0
- package/src/shared/utils.ts +613 -0
- package/src/slash/delegation-adapters.ts +434 -0
- package/src/slash/delegation-json.ts +108 -0
- package/src/slash/delegation-request.ts +166 -0
- package/src/slash/prompt-template-bridge.ts +383 -0
- package/src/slash/prompt-workflows.ts +300 -0
- package/src/slash/selector.ts +147 -0
- package/src/slash/slash-bridge.ts +192 -0
- package/src/slash/slash-commands.ts +994 -0
- package/src/slash/slash-live-state.ts +296 -0
- package/src/slash/subagents-admin.ts +432 -0
- package/src/tui/fleet-status.ts +564 -0
- package/src/tui/fleet-transcript.ts +577 -0
- package/src/tui/fleet.ts +879 -0
- package/src/tui/render-helpers.ts +80 -0
- package/src/tui/render.ts +2029 -0
- package/src/types/pi-runtime-compat.d.ts +8 -0
- package/src/watchdog/change-signature.ts +220 -0
- package/src/watchdog/child-status.ts +205 -0
- package/src/watchdog/emission-guard.ts +123 -0
- package/src/watchdog/lsp-diagnostics.ts +537 -0
- package/src/watchdog/model-selection.ts +167 -0
- package/src/watchdog/permission-arbiter.ts +145 -0
- package/src/watchdog/register-child.ts +117 -0
- package/src/watchdog/register-main.ts +440 -0
- package/src/watchdog/render.ts +54 -0
- package/src/watchdog/review.ts +302 -0
- package/src/watchdog/runtime.ts +868 -0
- package/src/watchdog/scope.ts +62 -0
- package/src/watchdog/settings.ts +568 -0
- package/src/watchdog/tool-actions.ts +155 -0
- package/src/watchdog/turn-delta.ts +161 -0
- package/src/watchdog/types.ts +198 -0
- package/src/watchdog/warning-format.ts +73 -0
- package/src/workflows/chat-progress.ts +140 -0
- package/src/workflows/scripted-workflow.ts +506 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { isCheckpointStep, isDynamicParallelStep, isParallelStep, type ChainStep, type SequentialStep } from "../../shared/settings.ts";
|
|
2
|
+
import type { SingleResult, SubagentRunMode, WorkflowGraphNode, WorkflowGraphSnapshot, WorkflowNodeStatus } from "../../shared/types.ts";
|
|
3
|
+
|
|
4
|
+
export interface WorkflowGraphBuildInput {
|
|
5
|
+
runId: string;
|
|
6
|
+
mode?: SubagentRunMode;
|
|
7
|
+
steps: ChainStep[];
|
|
8
|
+
results?: Array<Pick<SingleResult, "exitCode" | "detached" | "interrupted" | "error" | "acceptance">>;
|
|
9
|
+
currentFlatIndex?: number;
|
|
10
|
+
currentStepIndex?: number;
|
|
11
|
+
stepStatuses?: Array<{ status?: string; error?: string }>;
|
|
12
|
+
dynamicChildren?: Record<number, Array<{ agent: string; label?: string; flatIndex: number; itemKey: string; outputName?: string; structured?: boolean; error?: string }>>;
|
|
13
|
+
dynamicGroupStatuses?: Record<number, { status: WorkflowNodeStatus; error?: string; acceptance?: SingleResult["acceptance"] }>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function normalizeStatus(status: string | undefined): WorkflowNodeStatus | undefined {
|
|
17
|
+
switch (status) {
|
|
18
|
+
case "complete":
|
|
19
|
+
case "completed":
|
|
20
|
+
return "completed";
|
|
21
|
+
case "running":
|
|
22
|
+
return "running";
|
|
23
|
+
case "failed":
|
|
24
|
+
return "failed";
|
|
25
|
+
case "paused":
|
|
26
|
+
return "paused";
|
|
27
|
+
case "detached":
|
|
28
|
+
return "detached";
|
|
29
|
+
case "rejected":
|
|
30
|
+
return "rejected";
|
|
31
|
+
case "pending":
|
|
32
|
+
return "pending";
|
|
33
|
+
default:
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function resultStatus(result: Pick<SingleResult, "exitCode" | "detached" | "interrupted"> | undefined): WorkflowNodeStatus | undefined {
|
|
39
|
+
if (!result) return undefined;
|
|
40
|
+
if (result.detached) return "detached";
|
|
41
|
+
if (result.interrupted) return "paused";
|
|
42
|
+
return result.exitCode === 0 ? "completed" : "failed";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function nodeStatus(input: WorkflowGraphBuildInput, flatIndex: number): WorkflowNodeStatus {
|
|
46
|
+
return normalizeStatus(input.stepStatuses?.[flatIndex]?.status)
|
|
47
|
+
?? resultStatus(input.results?.[flatIndex])
|
|
48
|
+
?? (input.currentFlatIndex === flatIndex ? "running" : "pending");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function pushPhase(phases: WorkflowGraphSnapshot["phases"], phase: string | undefined, nodeId: string): void {
|
|
52
|
+
if (!phase) return;
|
|
53
|
+
let group = phases.find((candidate) => candidate.title === phase);
|
|
54
|
+
if (!group) {
|
|
55
|
+
group = { title: phase, nodeIds: [] };
|
|
56
|
+
phases.push(group);
|
|
57
|
+
}
|
|
58
|
+
group.nodeIds.push(nodeId);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function seqLabel(step: SequentialStep, stepIndex: number): string {
|
|
62
|
+
return step.label?.trim() || step.agent || `Step ${stepIndex + 1}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function summarizeParallelStatuses(statuses: WorkflowNodeStatus[]): WorkflowNodeStatus {
|
|
66
|
+
if (statuses.some((status) => status === "running")) return "running";
|
|
67
|
+
if (statuses.some((status) => status === "rejected")) return "rejected";
|
|
68
|
+
if (statuses.some((status) => status === "failed")) return "failed";
|
|
69
|
+
if (statuses.some((status) => status === "paused")) return "paused";
|
|
70
|
+
if (statuses.some((status) => status === "detached")) return "detached";
|
|
71
|
+
if (statuses.length > 0 && statuses.every((status) => status === "completed")) return "completed";
|
|
72
|
+
if (statuses.some((status) => status === "completed")) return "running";
|
|
73
|
+
return "pending";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function buildWorkflowGraphSnapshot(input: WorkflowGraphBuildInput): WorkflowGraphSnapshot {
|
|
77
|
+
const nodes: WorkflowGraphNode[] = [];
|
|
78
|
+
const phases: WorkflowGraphSnapshot["phases"] = [];
|
|
79
|
+
let flatIndex = 0;
|
|
80
|
+
let currentNodeId: string | undefined;
|
|
81
|
+
|
|
82
|
+
for (let stepIndex = 0; stepIndex < input.steps.length; stepIndex++) {
|
|
83
|
+
const step = input.steps[stepIndex]!;
|
|
84
|
+
if (isCheckpointStep(step)) {
|
|
85
|
+
const status = normalizeStatus(input.stepStatuses?.[flatIndex]?.status)
|
|
86
|
+
?? (input.currentStepIndex === stepIndex ? "paused" : "pending");
|
|
87
|
+
const checkpoint = { name: step.checkpoint, ...(step.message ? { message: step.message } : {}), status: status === "rejected" ? "rejected" as const : status === "completed" ? "approved" as const : "pending" as const, stepIndex };
|
|
88
|
+
const id = `step-${stepIndex}`;
|
|
89
|
+
nodes.push({
|
|
90
|
+
id,
|
|
91
|
+
kind: "checkpoint",
|
|
92
|
+
phase: step.phase,
|
|
93
|
+
label: step.label?.trim() || step.checkpoint,
|
|
94
|
+
status,
|
|
95
|
+
flatIndex,
|
|
96
|
+
stepIndex,
|
|
97
|
+
checkpoint,
|
|
98
|
+
error: input.stepStatuses?.[flatIndex]?.error,
|
|
99
|
+
});
|
|
100
|
+
pushPhase(phases, step.phase, id);
|
|
101
|
+
if (status === "paused" || input.currentStepIndex === stepIndex) currentNodeId = id;
|
|
102
|
+
flatIndex++;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (isParallelStep(step)) {
|
|
107
|
+
const groupId = `step-${stepIndex}`;
|
|
108
|
+
const children: WorkflowGraphNode[] = [];
|
|
109
|
+
const childStatuses: WorkflowNodeStatus[] = [];
|
|
110
|
+
for (let taskIndex = 0; taskIndex < step.parallel.length; taskIndex++) {
|
|
111
|
+
const task = step.parallel[taskIndex]!;
|
|
112
|
+
const status = nodeStatus(input, flatIndex);
|
|
113
|
+
childStatuses.push(status);
|
|
114
|
+
const childId = `step-${stepIndex}-agent-${taskIndex}`;
|
|
115
|
+
const child: WorkflowGraphNode = {
|
|
116
|
+
id: childId,
|
|
117
|
+
kind: "agent",
|
|
118
|
+
agent: task.agent,
|
|
119
|
+
phase: task.phase,
|
|
120
|
+
label: task.label?.trim() || task.agent || `Agent ${taskIndex + 1}`,
|
|
121
|
+
status,
|
|
122
|
+
flatIndex,
|
|
123
|
+
stepIndex,
|
|
124
|
+
outputName: task.as,
|
|
125
|
+
structured: Boolean(task.outputSchema),
|
|
126
|
+
acceptanceStatus: input.results?.[flatIndex]?.acceptance?.status,
|
|
127
|
+
error: input.stepStatuses?.[flatIndex]?.error ?? input.results?.[flatIndex]?.error,
|
|
128
|
+
};
|
|
129
|
+
children.push(child);
|
|
130
|
+
pushPhase(phases, task.phase, childId);
|
|
131
|
+
if (status === "running" || input.currentFlatIndex === flatIndex) currentNodeId = childId;
|
|
132
|
+
flatIndex++;
|
|
133
|
+
}
|
|
134
|
+
const groupStatus = summarizeParallelStatuses(childStatuses);
|
|
135
|
+
if (input.currentStepIndex === stepIndex && !currentNodeId) currentNodeId = groupId;
|
|
136
|
+
nodes.push({
|
|
137
|
+
id: groupId,
|
|
138
|
+
kind: "parallel-group",
|
|
139
|
+
label: step.parallel.length === 1 ? "Parallel task" : `Parallel group (${step.parallel.length})`,
|
|
140
|
+
status: groupStatus,
|
|
141
|
+
stepIndex,
|
|
142
|
+
children,
|
|
143
|
+
});
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (isDynamicParallelStep(step)) {
|
|
148
|
+
const groupId = `step-${stepIndex}`;
|
|
149
|
+
const materialized = input.dynamicChildren?.[stepIndex] ?? [];
|
|
150
|
+
const groupOverride = input.dynamicGroupStatuses?.[stepIndex];
|
|
151
|
+
const children: WorkflowGraphNode[] = [];
|
|
152
|
+
const childStatuses: WorkflowNodeStatus[] = [];
|
|
153
|
+
for (let taskIndex = 0; taskIndex < materialized.length; taskIndex++) {
|
|
154
|
+
const task = materialized[taskIndex]!;
|
|
155
|
+
const status = nodeStatus(input, task.flatIndex);
|
|
156
|
+
childStatuses.push(status);
|
|
157
|
+
const childId = `step-${stepIndex}-item-${task.itemKey.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
158
|
+
const child: WorkflowGraphNode = {
|
|
159
|
+
id: childId,
|
|
160
|
+
kind: "agent",
|
|
161
|
+
agent: task.agent,
|
|
162
|
+
phase: step.parallel.phase ?? step.phase,
|
|
163
|
+
label: task.label?.trim() || step.parallel.label?.trim() || `${task.agent} ${task.itemKey}`,
|
|
164
|
+
status,
|
|
165
|
+
flatIndex: task.flatIndex,
|
|
166
|
+
stepIndex,
|
|
167
|
+
itemKey: task.itemKey,
|
|
168
|
+
outputName: task.outputName,
|
|
169
|
+
structured: task.structured,
|
|
170
|
+
acceptanceStatus: input.results?.[task.flatIndex]?.acceptance?.status,
|
|
171
|
+
error: input.stepStatuses?.[task.flatIndex]?.error ?? input.results?.[task.flatIndex]?.error ?? task.error,
|
|
172
|
+
};
|
|
173
|
+
children.push(child);
|
|
174
|
+
pushPhase(phases, child.phase, childId);
|
|
175
|
+
if (status === "running" || input.currentFlatIndex === task.flatIndex) currentNodeId = childId;
|
|
176
|
+
}
|
|
177
|
+
const groupStatus = groupOverride?.status ?? (children.length > 0 ? summarizeParallelStatuses(childStatuses) : (input.currentStepIndex === stepIndex ? "running" : "pending"));
|
|
178
|
+
if (input.currentStepIndex === stepIndex && !currentNodeId) currentNodeId = groupId;
|
|
179
|
+
nodes.push({
|
|
180
|
+
id: groupId,
|
|
181
|
+
kind: "dynamic-parallel-group",
|
|
182
|
+
label: step.label?.trim() || step.parallel.label?.trim() || `Dynamic fanout (${step.collect.as})`,
|
|
183
|
+
status: groupStatus,
|
|
184
|
+
stepIndex,
|
|
185
|
+
outputName: step.collect.as,
|
|
186
|
+
structured: Boolean(step.collect.outputSchema),
|
|
187
|
+
acceptanceStatus: groupOverride?.acceptance?.status,
|
|
188
|
+
error: groupOverride?.error,
|
|
189
|
+
dynamic: {
|
|
190
|
+
sourceOutput: step.expand.from.output,
|
|
191
|
+
sourcePath: step.expand.from.path,
|
|
192
|
+
itemName: step.expand.item ?? "item",
|
|
193
|
+
maxItems: step.expand.maxItems,
|
|
194
|
+
collectAs: step.collect.as,
|
|
195
|
+
},
|
|
196
|
+
children,
|
|
197
|
+
});
|
|
198
|
+
if (materialized.length > 0) flatIndex = Math.max(flatIndex, ...materialized.map((child) => child.flatIndex + 1));
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const seq = step as SequentialStep;
|
|
203
|
+
const status = nodeStatus(input, flatIndex);
|
|
204
|
+
const id = `step-${stepIndex}`;
|
|
205
|
+
nodes.push({
|
|
206
|
+
id,
|
|
207
|
+
kind: "step",
|
|
208
|
+
agent: seq.agent,
|
|
209
|
+
phase: seq.phase,
|
|
210
|
+
label: seqLabel(seq, stepIndex),
|
|
211
|
+
status,
|
|
212
|
+
flatIndex,
|
|
213
|
+
stepIndex,
|
|
214
|
+
outputName: seq.as,
|
|
215
|
+
structured: Boolean(seq.outputSchema),
|
|
216
|
+
acceptanceStatus: input.results?.[flatIndex]?.acceptance?.status,
|
|
217
|
+
error: input.stepStatuses?.[flatIndex]?.error ?? input.results?.[flatIndex]?.error,
|
|
218
|
+
});
|
|
219
|
+
pushPhase(phases, seq.phase, id);
|
|
220
|
+
if (status === "running" || input.currentFlatIndex === flatIndex || input.currentStepIndex === stepIndex) currentNodeId = id;
|
|
221
|
+
flatIndex++;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
runId: input.runId,
|
|
226
|
+
mode: input.mode ?? "chain",
|
|
227
|
+
phases,
|
|
228
|
+
nodes,
|
|
229
|
+
currentNodeId,
|
|
230
|
+
};
|
|
231
|
+
}
|