stageflow 0.19.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 +5 -0
- package/dist/agent/activityObserver.d.ts +3 -0
- package/dist/agent/activityObserver.js +6 -1
- package/dist/agent/piAdapter.js +7 -3
- package/dist/agent/port.d.ts +2 -0
- package/dist/agent/providerInspect.d.ts +19 -0
- package/dist/agent/providerInspect.js +35 -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/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 +3 -7
- package/dist/cli/runsCommand.js +33 -94
- package/dist/cli.js +1 -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 +77 -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/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/pipelineRunner.d.ts +3 -3
- package/dist/runtime/pipelineRunner.js +3 -1
- package/dist/runtime/resumeReconstruct.js +2 -2
- package/dist/runtime/runManager.d.ts +2 -1
- package/dist/runtime/runManager.js +36 -16
- 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/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 +450 -402
- 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/types/pipeline.d.ts +8 -0
- package/dist/ui/assets/{index-DMVdl1qB.js → index-Da5EHU6M.js} +5 -5
- package/dist/ui/index.html +1 -1
- 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/server/mcpHost.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { bootstrapStageflowHost, } from "./bootstrap.js";
|
|
2
2
|
import { createHttpHost, DEFAULT_PORT, } from "./createHttpHost.js";
|
|
3
|
+
import { createOperatorRoutes } from "./http.js";
|
|
3
4
|
export async function startMcpServer(options) {
|
|
4
5
|
const host = options.host ?? "127.0.0.1";
|
|
5
6
|
const port = options.port ?? DEFAULT_PORT;
|
|
6
7
|
const boot = await bootstrapStageflowHost(options);
|
|
8
|
+
const { manager, store, cwd, agentDir, rootDir } = boot;
|
|
9
|
+
const providerAuthContext = boot.providerAuthContext;
|
|
7
10
|
return createHttpHost({
|
|
8
11
|
boot,
|
|
9
12
|
host,
|
|
10
13
|
port,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
json(res, 404, { error: "Not found" });
|
|
17
|
-
return true;
|
|
18
|
-
},
|
|
14
|
+
// Headless daemon: same REST API surface as `sf ui` (this is what lets
|
|
15
|
+
// `sf run`/`sf runs *` talk to an auto-started `sf mcp` over HTTP), just
|
|
16
|
+
// without serving the console's static UI files.
|
|
17
|
+
routes: createOperatorRoutes({ manager, store, cwd, agentDir, rootDir, providerAuthContext }),
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
20
|
export { DEFAULT_PORT };
|
|
@@ -11,3 +11,13 @@ export declare function mapStartFailure(result: Extract<StartRunResult, {
|
|
|
11
11
|
}>): {
|
|
12
12
|
error: string;
|
|
13
13
|
} & Record<string, unknown>;
|
|
14
|
+
export type StoreLookupPolicy = "run" | "artifact" | "envelope";
|
|
15
|
+
export type StoreLookupKind = "not_found" | "denied" | "error";
|
|
16
|
+
export type StoreLookupMapped = {
|
|
17
|
+
error: string;
|
|
18
|
+
status: number;
|
|
19
|
+
kind: StoreLookupKind;
|
|
20
|
+
};
|
|
21
|
+
export declare function mapStoreLookupError(err: unknown, opts: {
|
|
22
|
+
policy: StoreLookupPolicy;
|
|
23
|
+
}): StoreLookupMapped;
|
|
@@ -22,3 +22,27 @@ export function mapStartFailure(result) {
|
|
|
22
22
|
const { ok: _ok, status: _status, reason, ...rest } = result;
|
|
23
23
|
return { error: reason, ...rest };
|
|
24
24
|
}
|
|
25
|
+
export function mapStoreLookupError(err, opts) {
|
|
26
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
27
|
+
if (opts.policy === "artifact") {
|
|
28
|
+
if (error === "Artifact path denied") {
|
|
29
|
+
return { error, status: 400, kind: "denied" };
|
|
30
|
+
}
|
|
31
|
+
const notFound = error.startsWith("Run not found") ||
|
|
32
|
+
error.startsWith("Artifact not found") ||
|
|
33
|
+
/no such|not found/i.test(error);
|
|
34
|
+
return {
|
|
35
|
+
error,
|
|
36
|
+
status: notFound ? 404 : 400,
|
|
37
|
+
kind: notFound ? "not_found" : "error",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const notFound = opts.policy === "envelope"
|
|
41
|
+
? /not found|no such|envelope/i.test(error)
|
|
42
|
+
: /not found|no such|unknown run/i.test(error);
|
|
43
|
+
return {
|
|
44
|
+
error,
|
|
45
|
+
status: notFound ? 404 : 500,
|
|
46
|
+
kind: notFound ? "not_found" : "error",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -6,10 +6,4 @@ export type ProviderRoutesCtx = {
|
|
|
6
6
|
json: (res: ServerResponse, status: number, body: unknown) => void;
|
|
7
7
|
providerAuthContext?: ProviderAuthContext;
|
|
8
8
|
};
|
|
9
|
-
export declare function providerAuthErrorBody(err: unknown): {
|
|
10
|
-
status: number;
|
|
11
|
-
body: {
|
|
12
|
-
error: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
9
|
export declare function handleProviderRoutes(req: IncomingMessage, res: ServerResponse, ctx: ProviderRoutesCtx): Promise<boolean>;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { defaultContext, detectPiHome, getAuthStatus, listProviders, loginWithApiKey, logoutProvider,
|
|
1
|
+
import { defaultContext, detectPiHome, getAuthStatus, listProviders, loginWithApiKey, logoutProvider, } from "../agent/providerAuth.js";
|
|
2
|
+
import { mapProviderAuthError } from "../agent/providerInspect.js";
|
|
2
3
|
import { answerLoginSession, cancelLoginSession, getLoginSession, startOAuthLoginSession, } from "../agent/oauthSessionManager.js";
|
|
3
|
-
export function providerAuthErrorBody(err) {
|
|
4
|
-
if (err instanceof ProviderAuthError) {
|
|
5
|
-
return { status: err.status, body: { error: err.message } };
|
|
6
|
-
}
|
|
7
|
-
return {
|
|
8
|
-
status: 500,
|
|
9
|
-
body: { error: "Provider auth operation failed" },
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
4
|
export async function handleProviderRoutes(req, res, ctx) {
|
|
13
5
|
const { cwd, readJsonBody, json } = ctx;
|
|
14
6
|
const authCtx = ctx.providerAuthContext ?? defaultContext;
|
|
@@ -20,7 +12,7 @@ export async function handleProviderRoutes(req, res, ctx) {
|
|
|
20
12
|
json(res, 200, detectPiHome(cwd));
|
|
21
13
|
}
|
|
22
14
|
catch (err) {
|
|
23
|
-
const mapped =
|
|
15
|
+
const mapped = mapProviderAuthError(err);
|
|
24
16
|
json(res, mapped.status, mapped.body);
|
|
25
17
|
}
|
|
26
18
|
return true;
|
|
@@ -30,7 +22,7 @@ export async function handleProviderRoutes(req, res, ctx) {
|
|
|
30
22
|
json(res, 200, await listProviders(cwd, authCtx));
|
|
31
23
|
}
|
|
32
24
|
catch (err) {
|
|
33
|
-
const mapped =
|
|
25
|
+
const mapped = mapProviderAuthError(err);
|
|
34
26
|
json(res, mapped.status, mapped.body);
|
|
35
27
|
}
|
|
36
28
|
return true;
|
|
@@ -44,7 +36,7 @@ export async function handleProviderRoutes(req, res, ctx) {
|
|
|
44
36
|
});
|
|
45
37
|
}
|
|
46
38
|
catch (err) {
|
|
47
|
-
const mapped =
|
|
39
|
+
const mapped = mapProviderAuthError(err);
|
|
48
40
|
json(res, mapped.status, mapped.body);
|
|
49
41
|
}
|
|
50
42
|
return true;
|
|
@@ -70,7 +62,7 @@ export async function handleProviderRoutes(req, res, ctx) {
|
|
|
70
62
|
json(res, 200, { ok: true, session });
|
|
71
63
|
}
|
|
72
64
|
catch (err) {
|
|
73
|
-
const mapped =
|
|
65
|
+
const mapped = mapProviderAuthError(err);
|
|
74
66
|
json(res, mapped.status, mapped.body);
|
|
75
67
|
}
|
|
76
68
|
return true;
|
|
@@ -89,7 +81,7 @@ export async function handleProviderRoutes(req, res, ctx) {
|
|
|
89
81
|
json(res, 200, { ok: true, provider });
|
|
90
82
|
}
|
|
91
83
|
catch (err) {
|
|
92
|
-
const mapped =
|
|
84
|
+
const mapped = mapProviderAuthError(err);
|
|
93
85
|
json(res, mapped.status, mapped.body);
|
|
94
86
|
}
|
|
95
87
|
return true;
|
|
@@ -135,7 +127,7 @@ export async function handleProviderRoutes(req, res, ctx) {
|
|
|
135
127
|
json(res, 200, { ok: true, session });
|
|
136
128
|
}
|
|
137
129
|
catch (err) {
|
|
138
|
-
const mapped =
|
|
130
|
+
const mapped = mapProviderAuthError(err);
|
|
139
131
|
json(res, mapped.status, mapped.body);
|
|
140
132
|
}
|
|
141
133
|
return true;
|
|
@@ -157,7 +149,7 @@ export async function handleProviderRoutes(req, res, ctx) {
|
|
|
157
149
|
json(res, 200, { ok: true, session });
|
|
158
150
|
}
|
|
159
151
|
catch (err) {
|
|
160
|
-
const mapped =
|
|
152
|
+
const mapped = mapProviderAuthError(err);
|
|
161
153
|
json(res, mapped.status, mapped.body);
|
|
162
154
|
}
|
|
163
155
|
return true;
|
|
@@ -177,7 +169,7 @@ export async function handleProviderRoutes(req, res, ctx) {
|
|
|
177
169
|
json(res, 200, { ok: true, provider });
|
|
178
170
|
}
|
|
179
171
|
catch (err) {
|
|
180
|
-
const mapped =
|
|
172
|
+
const mapped = mapProviderAuthError(err);
|
|
181
173
|
json(res, mapped.status, mapped.body);
|
|
182
174
|
}
|
|
183
175
|
return true;
|
package/dist/types/pipeline.d.ts
CHANGED
|
@@ -10,6 +10,14 @@ export type PipelineConfig = {
|
|
|
10
10
|
/** Pipeline-file `$ref` root (`#/schemas/<name>`). */
|
|
11
11
|
schemas?: Record<string, unknown>;
|
|
12
12
|
};
|
|
13
|
+
/** An inline pipeline definition authored directly in a `start_run` call, with no backing file. */
|
|
14
|
+
export type InlinePipelineDefinition = {
|
|
15
|
+
id: string;
|
|
16
|
+
stages: Array<Record<string, unknown>>;
|
|
17
|
+
agent?: unknown;
|
|
18
|
+
model?: unknown;
|
|
19
|
+
schemas?: unknown;
|
|
20
|
+
};
|
|
13
21
|
export type PipelineForkConfig = {
|
|
14
22
|
select: "one" | "subset";
|
|
15
23
|
allow_none: boolean;
|