stageflow 0.18.0 → 0.23.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/README.md +2 -1
- package/dist/agent/activity.d.ts +9 -0
- package/dist/agent/activityObserver.d.ts +3 -0
- package/dist/agent/activityObserver.js +6 -1
- package/dist/agent/claudeAdapter.js +38 -0
- package/dist/agent/fakeAgent.js +3 -1
- package/dist/agent/piAdapter.js +40 -4
- package/dist/agent/port.d.ts +3 -1
- package/dist/agent/providerInspect.d.ts +19 -0
- package/dist/agent/providerInspect.js +35 -0
- package/dist/agent/stageTimeout.d.ts +9 -0
- package/dist/agent/stageTimeout.js +24 -0
- package/dist/agent/streamLogRedact.d.ts +2 -0
- package/dist/agent/streamLogRedact.js +13 -0
- package/dist/cli/artifactCommand.js +2 -2
- package/dist/cli/envelopeCommand.js +2 -2
- package/dist/cli/exportRunCommand.js +2 -2
- package/dist/cli/graphCommand.d.ts +15 -0
- package/dist/cli/graphCommand.js +79 -0
- package/dist/cli/graphRender.d.ts +2 -0
- package/dist/cli/graphRender.js +85 -0
- package/dist/cli/hostClient.d.ts +43 -0
- package/dist/cli/hostClient.js +182 -0
- package/dist/cli/providersCommand.js +5 -3
- package/dist/cli/runCommand.d.ts +6 -5
- package/dist/cli/runCommand.js +23 -31
- package/dist/cli/runOutput.d.ts +1 -1
- package/dist/cli/runsCommand.d.ts +4 -8
- package/dist/cli/runsCommand.js +65 -89
- package/dist/cli.js +13 -5
- package/dist/config/describePipeline.d.ts +26 -0
- package/dist/config/describePipeline.js +37 -0
- package/dist/config/loadPipeline.d.ts +13 -1
- package/dist/config/loadPipeline.js +34 -4
- package/dist/config/mergePipelineIncludes.d.ts +11 -0
- package/dist/config/mergePipelineIncludes.js +75 -0
- package/dist/config/validateCatalog.d.ts +2 -2
- package/dist/config/validateCatalog.js +24 -17
- package/dist/mcp/catalogTools.js +146 -52
- package/dist/mcp/controlTools.js +94 -19
- package/dist/mcp/deps.d.ts +3 -0
- package/dist/mcp/projectMcpTools.d.ts +3 -0
- package/dist/mcp/projectMcpTools.js +25 -0
- package/dist/mcp/providerTools.d.ts +3 -0
- package/dist/mcp/providerTools.js +17 -0
- package/dist/mcp/readArtifact.d.ts +9 -0
- package/dist/mcp/readArtifact.js +11 -0
- package/dist/mcp/server.js +9 -1
- package/dist/mcp/tailStreamLog.d.ts +8 -0
- package/dist/mcp/tailStreamLog.js +28 -0
- package/dist/mcp/toolResults.d.ts +17 -0
- package/dist/mcp/toolResults.js +15 -0
- package/dist/mcp/tools.js +4 -0
- package/dist/mcp/waitRun.js +4 -4
- package/dist/mcp/waitingGates.d.ts +1 -0
- package/dist/mcp/waitingGates.js +3 -2
- package/dist/package-meta.d.ts +1 -1
- package/dist/package-meta.js +1 -1
- package/dist/projection/projectRun.d.ts +3 -0
- package/dist/projection/projectRun.js +7 -0
- package/dist/runstore/port.d.ts +3 -1
- package/dist/runstore/port.js +2 -0
- package/dist/runstore/sqlite/SqliteRunStore.d.ts +2 -1
- package/dist/runstore/sqlite/SqliteRunStore.js +15 -1
- package/dist/runstore/workspaceLayout.d.ts +1 -0
- package/dist/runstore/workspaceLayout.js +3 -0
- package/dist/runtime/feedbackLoopCoordinator.d.ts +9 -1
- package/dist/runtime/feedbackLoopCoordinator.js +50 -20
- package/dist/runtime/feedbackLoopDecision.js +33 -1
- package/dist/runtime/forkGeneration.d.ts +4 -0
- package/dist/runtime/forkGeneration.js +16 -0
- package/dist/runtime/pipelineRunner.d.ts +3 -3
- package/dist/runtime/pipelineRunner.js +3 -1
- package/dist/runtime/pipelineScheduler.js +23 -1
- package/dist/runtime/reopenSkipped.d.ts +13 -0
- package/dist/runtime/reopenSkipped.js +56 -0
- package/dist/runtime/resumeReconstruct.js +2 -2
- package/dist/runtime/resumeTimedOut.d.ts +33 -0
- package/dist/runtime/resumeTimedOut.js +165 -0
- package/dist/runtime/runManager.d.ts +3 -1
- package/dist/runtime/runManager.js +110 -14
- package/dist/runtime/settingsFile.d.ts +2 -0
- package/dist/runtime/settingsFile.js +19 -0
- package/dist/runtime/stageAttemptBootstrap.d.ts +3 -0
- package/dist/runtime/stageAttemptBootstrap.js +8 -2
- package/dist/runtime/stageRecovery.js +2 -2
- package/dist/runtime/stageRunner.js +6 -2
- package/dist/runtime/stageStreamLog.d.ts +17 -0
- package/dist/runtime/stageStreamLog.js +89 -0
- package/dist/runtime/stageWorker.js +2 -1
- package/dist/server/bootstrap.js +9 -2
- package/dist/server/ensureGlobalService.d.ts +35 -0
- package/dist/server/ensureGlobalService.js +138 -0
- package/dist/server/http.d.ts +20 -1
- package/dist/server/http.js +452 -386
- package/dist/server/mcpHost.js +7 -8
- package/dist/server/operatorResults.d.ts +10 -0
- package/dist/server/operatorResults.js +24 -0
- package/dist/server/providerRoutes.d.ts +0 -6
- package/dist/server/providerRoutes.js +10 -18
- package/dist/tools/askOperator.d.ts +1 -0
- package/dist/tools/askOperator.js +14 -11
- package/dist/tools/emitStageEnvelope.d.ts +1 -0
- package/dist/tools/emitStageEnvelope.js +3 -1
- package/dist/tools/prepareToolArguments.d.ts +4 -0
- package/dist/tools/prepareToolArguments.js +79 -0
- package/dist/types/pipeline.d.ts +8 -0
- package/dist/ui/assets/{index-DsgVjLUS.css → index-CSsDued1.css} +1 -1
- package/dist/ui/assets/index-Da5EHU6M.js +119 -0
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
- package/skills/stageflow/references/control-surface.md +2 -2
- package/skills/stageflow-run/SKILL.md +27 -9
- package/skills/stageflow-run/references/mcp-call.md +1 -1
- package/skills/stageflow-run/scripts/mcp-call.mjs +9 -0
- package/dist/ui/assets/index-DwKGaQvQ.js +0 -119
package/dist/ui/index.html
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&display=swap" />
|
|
14
14
|
<link rel="icon" type="image/svg+xml" href="/stageflow-icon.svg" />
|
|
15
15
|
<title>Stageflow</title>
|
|
16
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
16
|
+
<script type="module" crossorigin src="/assets/index-Da5EHU6M.js"></script>
|
|
17
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CSsDued1.css">
|
|
18
18
|
</head>
|
|
19
19
|
<body>
|
|
20
20
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -19,10 +19,10 @@ Start a host with `sf ui` or `sf mcp` when the user wants MCP. Do not auto-start
|
|
|
19
19
|
|
|
20
20
|
## When the host is up
|
|
21
21
|
|
|
22
|
-
Use MCP tools over the Streamable HTTP endpoint at `{baseUrl}/mcp`. Tool names and payloads live in [docs/mcp.md](../../../docs/mcp.md). Typical talking-job tools: `list_pipelines`, `list_tasks`, `start_run`, `get_run`, `wait_run`, `list_waiting`, `answer_gate`, `get_envelope`, `read_artifact`, `validate`, `get_health`.
|
|
22
|
+
Use MCP tools over the Streamable HTTP endpoint at `{baseUrl}/mcp`. Tool names and payloads live in [docs/mcp.md](../../../docs/mcp.md). Typical talking-job tools: `list_pipelines`, `list_tasks`, `start_run`, `get_run`, `wait_run`, `list_waiting`, `answer_gate`, `decide_feedback_loop`, `get_envelope`, `read_artifact`, `validate`, `describe_pipeline`, `get_health`, `list_providers`, `list_models`, `list_project_mcp`, `probe_project_mcp`.
|
|
23
23
|
|
|
24
24
|
## When the host is down
|
|
25
25
|
|
|
26
|
-
Use the `sf` CLI. Command names and flags live in [docs/cli-reference.md](../../../docs/cli-reference.md). Typical talking-job commands: `sf run`, `sf runs waiting`, `sf runs answer`, `sf runs wait`, `sf validate`, `sf envelope get`, `sf artifact read`, `sf providers`.
|
|
26
|
+
Use the `sf` CLI. Command names and flags live in [docs/cli-reference.md](../../../docs/cli-reference.md). Typical talking-job commands: `sf run`, `sf runs waiting`, `sf runs answer`, `sf runs feedback-decide`, `sf runs wait`, `sf validate`, `sf envelope get`, `sf artifact read`, `sf providers`.
|
|
27
27
|
|
|
28
28
|
Probe before each mutating `sf runs` verb. If the probe is **up** or the command refuses because a host is up, continue that gate via MCP — do not start a second mutating writer, and do not start `sf mcp` as a disposable bridge.
|
|
@@ -47,7 +47,7 @@ If this chat already has a `runId` and the request is check, answer, or continue
|
|
|
47
47
|
|
|
48
48
|
Prefer this harness's native Stageflow MCP tools when their names are already in the tool list. When they are not, call [`scripts/mcp-call.mjs`](scripts/mcp-call.mjs) — see [`references/mcp-call.md`](references/mcp-call.md). Use `--stateless` only when the **user** started the host with `--mcp-stateless`. Do not start `sf mcp` from this skill.
|
|
49
49
|
|
|
50
|
-
Call only these Stageflow MCP tools: `list_pipelines`, `list_tasks`, `start_run`, `get_run`, `wait_run`, `list_waiting`, `answer_gate`, `get_health`. Host question tools already in this harness's tool list (`AskQuestion`, `AskUserQuestion`, `ask_user`) are for [Gate](#gate) presentation, not Stageflow MCP.
|
|
50
|
+
Call only these Stageflow MCP tools: `list_pipelines`, `list_tasks`, `start_run`, `get_run`, `wait_run`, `list_waiting`, `list_runs`, `answer_gate`, `decide_feedback_loop`, `read_artifact`, `describe_pipeline`, `validate`, `list_providers`, `list_models`, `list_project_mcp`, `probe_project_mcp`, `get_health`. Host question tools already in this harness's tool list (`AskQuestion`, `AskUserQuestion`, `ask_user`) are for [Gate](#gate) presentation, not Stageflow MCP.
|
|
51
51
|
|
|
52
52
|
## MCP path
|
|
53
53
|
|
|
@@ -79,9 +79,19 @@ Call only these Stageflow MCP tools: `list_pipelines`, `list_tasks`, `start_run`
|
|
|
79
79
|
|
|
80
80
|
### Gate
|
|
81
81
|
|
|
82
|
-
Read [`references/native-question-ui.md`](references/native-question-ui.md) before presenting a pending prompt.
|
|
83
|
-
|
|
84
82
|
1. `list_waiting` with `{ "runId" }`.
|
|
83
|
+
|
|
84
|
+
If `waiting_kind` is `feedback_loop_decision`, do not use [`references/native-question-ui.md`](references/native-question-ui.md) or `answer_gate`:
|
|
85
|
+
|
|
86
|
+
1. Print the pending prompt text **verbatim**.
|
|
87
|
+
2. Present extend / continue / abandon (picker if a host question tool is already in this harness's tool list; otherwise this chat).
|
|
88
|
+
3. `decide_feedback_loop` with `{ "runId", "stageId", "decision" }` (`extend` | `continue` | `abandon`; optional `loopId` / `reason`).
|
|
89
|
+
4. Return to [Wait](#wait).
|
|
90
|
+
|
|
91
|
+
**Done when** `decide_feedback_loop` returns `{ "ok": true }` and Wait is re-entered. On `isError` (404 / 409), print the payload and collect a corrected decision the same way. Do not submit a loop decision through `answer_gate`.
|
|
92
|
+
|
|
93
|
+
Otherwise this is a HITL gate. Read [`references/native-question-ui.md`](references/native-question-ui.md) before presenting a pending prompt.
|
|
94
|
+
|
|
85
95
|
2. Print the pending prompt text **verbatim** (and artifacts / sub-questions when present).
|
|
86
96
|
3. Present the decision as that reference directs:
|
|
87
97
|
- If a host question tool is already in this harness's tool list and the gate is representable, invoke that picker. For `multi_question`, one picker call with one question per sub-item when **every** sub-question is representable, then one `answer_gate`; otherwise the **whole** gate in this chat.
|
|
@@ -125,9 +135,9 @@ Parse the single JSON document.
|
|
|
125
135
|
|
|
126
136
|
## CLI wait
|
|
127
137
|
|
|
128
|
-
Host down after `sf run` exit `2`, or when this chat already has a `runId` and the host is down. Do not start `sf mcp`.
|
|
138
|
+
Host down after `sf run` exit `2`, or when this chat already has a `runId` and the host is down. Do not start `sf mcp`. HITL presentation follows [`references/native-question-ui.md`](references/native-question-ui.md). Submit HITL with `sf runs answer --json`. If `waiting_kind` is `feedback_loop_decision`, present extend / continue / abandon and submit with `sf runs feedback-decide --json` — not `sf runs answer`.
|
|
129
139
|
|
|
130
|
-
1. Probe again with [`../stageflow/scripts/detect-host.mjs`](../stageflow/scripts/detect-host.mjs) (the host may have appeared). Probe before each `sf runs answer`.
|
|
140
|
+
1. Probe again with [`../stageflow/scripts/detect-host.mjs`](../stageflow/scripts/detect-host.mjs) (the host may have appeared). Probe before each `sf runs answer` or `sf runs feedback-decide`.
|
|
131
141
|
2. **Up:** use that host — native tools if present, otherwise `mcp-call.mjs` (omit `--stateless` unless the user started the host with `--mcp-stateless`). Continue at [Gate](#gate).
|
|
132
142
|
3. **Down:**
|
|
133
143
|
|
|
@@ -135,7 +145,15 @@ Host down after `sf run` exit `2`, or when this chat already has a `runId` and t
|
|
|
135
145
|
sf runs waiting --run <runId> --json
|
|
136
146
|
```
|
|
137
147
|
|
|
138
|
-
|
|
148
|
+
If `waiting_kind` is `feedback_loop_decision`, present extend / continue / abandon (picker or chat). Then:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
sf runs feedback-decide --run <runId> --stage <stageId> --decision extend|continue|abandon --json
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Success is `{ "ok": true }` exit `0` even if the run parks again. Do not treat decide as terminal.
|
|
155
|
+
|
|
156
|
+
Otherwise print the pending prompt **verbatim**. Present it as native-question-ui directs (picker or chat). Map the reply with the [Gate](#gate) kind table.
|
|
139
157
|
|
|
140
158
|
```
|
|
141
159
|
sf runs answer --run <runId> --stage <stageId> --answer '<json>' --json
|
|
@@ -151,13 +169,13 @@ A shorter `--timeout-ms` is fine when the harness timeout is tight. Default `600
|
|
|
151
169
|
|
|
152
170
|
| `reason` | next |
|
|
153
171
|
|---|---|
|
|
154
|
-
| `waiting` or `already` with a waiting snapshot | `sf runs waiting` then answer |
|
|
172
|
+
| `waiting` or `already` with a waiting snapshot | `sf runs waiting` then answer or feedback-decide |
|
|
155
173
|
| `terminal` | [Report](#report) |
|
|
156
174
|
| `timeout` | call `sf runs wait` again |
|
|
157
175
|
|
|
158
176
|
Wait abort (exit `130`, `{ "error", "code": "aborted" }`) → [Report](#report): the run continues, resumable later. Stop. Do not reuse `sf run` exit `2` for wait.
|
|
159
177
|
|
|
160
|
-
4. If `sf runs answer` refuses because the host came up, continue that gate via MCP [Gate](#gate). Do not dual-write.
|
|
178
|
+
4. If `sf runs answer` or `sf runs feedback-decide` refuses because the host came up, continue that gate via MCP [Gate](#gate). Do not dual-write.
|
|
161
179
|
|
|
162
180
|
If this chat ends before terminal, say the run stays in `.stageflow/` and to continue by re-invoking this skill (or starting a host and using MCP).
|
|
163
181
|
|
|
@@ -179,4 +197,4 @@ MCP `get_run` / `wait_run` and `sf runs wait` / `sf runs show` `--json` carry li
|
|
|
179
197
|
|
|
180
198
|
## Non-goals
|
|
181
199
|
|
|
182
|
-
This job starts, watches, and answers runs. It does not require `sf ui`. The operator console is not the answer path. It does not register or invent an MCP tool. It does not start `sf mcp`. It does not retry, abandon, or rerun stages.
|
|
200
|
+
This job starts, watches, and answers runs. It does not require `sf ui`. The operator console is not the answer path. It does not register or invent an MCP tool. It does not start `sf mcp`. It does not retry, resume, abandon, recover, or rerun stages.
|
|
@@ -14,4 +14,4 @@ Without `--stateless`: `initialize`, capture `Mcp-Session-Id`, reuse it for `too
|
|
|
14
14
|
|
|
15
15
|
Stdout is the tool JSON. Exit `0` on success, including `wait_run` with `reason: "timeout"` (keep polling). Exit `1` on transport failure or `isError: true`. Exit `2` on usage or malformed `--args` — that parse error happens before any network call.
|
|
16
16
|
|
|
17
|
-
Allowed `--tool` names (see [`docs/mcp.md`](../../../docs/mcp.md)): `list_pipelines`, `list_tasks`, `start_run`, `get_run`, `wait_run`, `list_waiting`, `answer_gate`, `get_health`.
|
|
17
|
+
Allowed `--tool` names (see [`docs/mcp.md`](../../../docs/mcp.md)): `list_pipelines`, `list_tasks`, `start_run`, `get_run`, `wait_run`, `list_waiting`, `list_runs`, `answer_gate`, `decide_feedback_loop`, `read_artifact`, `describe_pipeline`, `validate`, `list_providers`, `list_models`, `list_project_mcp`, `probe_project_mcp`, `get_health`.
|
|
@@ -8,7 +8,16 @@ const ALLOWED_TOOLS = new Set([
|
|
|
8
8
|
"get_run",
|
|
9
9
|
"wait_run",
|
|
10
10
|
"list_waiting",
|
|
11
|
+
"list_runs",
|
|
11
12
|
"answer_gate",
|
|
13
|
+
"decide_feedback_loop",
|
|
14
|
+
"read_artifact",
|
|
15
|
+
"describe_pipeline",
|
|
16
|
+
"validate",
|
|
17
|
+
"list_providers",
|
|
18
|
+
"list_models",
|
|
19
|
+
"list_project_mcp",
|
|
20
|
+
"probe_project_mcp",
|
|
12
21
|
"get_health",
|
|
13
22
|
]);
|
|
14
23
|
const PROTOCOL_VERSION = "2025-03-26";
|