stageflow 0.2.0 → 0.3.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 +158 -14
- package/dist/agent/activity.d.ts +10 -1
- package/dist/agent/activity.js +37 -2
- package/dist/agent/activityObserver.d.ts +5 -1
- package/dist/agent/activityObserver.js +174 -11
- package/dist/agent/fakeAgent.js +4 -0
- package/dist/agent/piAdapter.d.ts +16 -0
- package/dist/agent/piAdapter.js +88 -21
- package/dist/agent/port.d.ts +2 -0
- package/dist/agent/providerAuth.js +12 -7
- package/dist/catalog/displayCatalogPath.d.ts +12 -0
- package/dist/catalog/displayCatalogPath.js +28 -0
- package/dist/cli/initCommand.d.ts +9 -0
- package/dist/cli/initCommand.js +71 -0
- package/dist/cli/initTemplates.d.ts +3 -0
- package/dist/cli/initTemplates.js +19 -0
- package/dist/cli/operatorCatalog.d.ts +10 -0
- package/dist/cli/operatorCatalog.js +16 -0
- package/dist/cli/runCommand.d.ts +3 -1
- package/dist/cli/runCommand.js +48 -7
- package/dist/cli/validateCommand.d.ts +1 -1
- package/dist/cli/validateCommand.js +20 -3
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +52 -19
- package/dist/config/browseCatalog.d.ts +45 -0
- package/dist/config/browseCatalog.js +170 -0
- package/dist/config/createPipeline.d.ts +12 -3
- package/dist/config/createPipeline.js +292 -100
- package/dist/config/createStage.d.ts +10 -4
- package/dist/config/createStage.js +44 -14
- package/dist/config/listConfig.d.ts +14 -19
- package/dist/config/listConfig.js +26 -191
- package/dist/config/listModelsFromManifest.d.ts +2 -0
- package/dist/config/listModelsFromManifest.js +4 -0
- package/dist/config/loadOutcome.d.ts +4 -0
- package/dist/config/loadPipeline.d.ts +1 -15
- package/dist/config/loadPipeline.js +84 -142
- package/dist/config/loadStage.d.ts +4 -0
- package/dist/config/loadStage.js +60 -32
- package/dist/config/loadStageflowManifest.d.ts +5 -0
- package/dist/config/loadStageflowManifest.js +157 -0
- package/dist/config/mergePipelineIncludes.d.ts +9 -0
- package/dist/config/mergePipelineIncludes.js +141 -0
- package/dist/config/normalizePipelineStageEntry.d.ts +16 -0
- package/dist/config/normalizePipelineStageEntry.js +186 -0
- package/dist/config/pipelineStageKeys.d.ts +4 -0
- package/dist/config/pipelineStageKeys.js +14 -0
- package/dist/config/resolveCatalogContext.d.ts +13 -0
- package/dist/config/resolveCatalogContext.js +13 -0
- package/dist/config/resolveForkEmitContext.d.ts +3 -0
- package/dist/config/resolveForkEmitContext.js +12 -0
- package/dist/config/resolvePipelineDag.d.ts +5 -1
- package/dist/config/resolvePipelineDag.js +54 -36
- package/dist/config/scanCatalogPaths.d.ts +4 -0
- package/dist/config/scanCatalogPaths.js +83 -0
- package/dist/config/validateCatalog.d.ts +22 -4
- package/dist/config/validateCatalog.js +169 -132
- package/dist/envelope/check.js +7 -0
- package/dist/envelope/forkChoice.d.ts +3 -0
- package/dist/envelope/forkChoice.js +47 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/mcp/projectRun.d.ts +3 -0
- package/dist/mcp/projectRun.js +7 -0
- package/dist/mcp/tools.js +28 -11
- package/dist/project/findProjectRoot.d.ts +2 -0
- package/dist/project/findProjectRoot.js +51 -0
- package/dist/project/globalHome.d.ts +2 -0
- package/dist/project/globalHome.js +19 -0
- package/dist/project/resolveProjectContext.d.ts +9 -0
- package/dist/project/resolveProjectContext.js +38 -0
- package/dist/project/resolveStageflowContext.d.ts +11 -0
- package/dist/project/resolveStageflowContext.js +66 -0
- package/dist/runstore/normalizeCatalogPath.d.ts +1 -0
- package/dist/runstore/normalizeCatalogPath.js +4 -0
- package/dist/runstore/port.d.ts +9 -0
- package/dist/runstore/runProjection.js +11 -1
- package/dist/runstore/sqlite/SqliteRunStore.js +30 -4
- package/dist/runstore/sqlite/schema.d.ts +1 -1
- package/dist/runstore/sqlite/schema.js +4 -1
- package/dist/runtime/credentialBinding.d.ts +8 -6
- package/dist/runtime/credentialBinding.js +18 -24
- package/dist/runtime/pipelineRunner.d.ts +3 -0
- package/dist/runtime/pipelineRunner.js +15 -1
- package/dist/runtime/pipelineScheduler.d.ts +2 -0
- package/dist/runtime/pipelineScheduler.js +51 -11
- package/dist/runtime/reloadRunCatalog.d.ts +5 -0
- package/dist/runtime/reloadRunCatalog.js +44 -0
- package/dist/runtime/resumeReconstruct.d.ts +1 -0
- package/dist/runtime/resumeReconstruct.js +23 -7
- package/dist/runtime/runManager.d.ts +4 -0
- package/dist/runtime/runManager.js +36 -16
- package/dist/runtime/settingsFile.d.ts +12 -0
- package/dist/runtime/settingsFile.js +87 -6
- package/dist/runtime/stageAttemptBootstrap.js +3 -0
- package/dist/runtime/stageProcessLauncher.js +3 -0
- package/dist/runtime/stageRecovery.js +3 -1
- package/dist/runtime/stageWorker.js +2 -6
- package/dist/server/http.js +33 -9
- package/dist/tools/emitStageEnvelope.d.ts +3 -1
- package/dist/tools/emitStageEnvelope.js +11 -1
- package/dist/types/envelope.d.ts +1 -0
- package/dist/types/forkChoice.d.ts +8 -0
- package/dist/types/forkChoice.js +1 -0
- package/dist/types/pipeline.d.ts +51 -2
- package/dist/types/stageflowManifest.d.ts +23 -0
- package/dist/types/stageflowManifest.js +1 -0
- package/dist/ui/assets/index-CFSzDZje.js +118 -0
- package/dist/ui/assets/{index-DCsDopak.css → index-DefBlEvN.css} +1 -1
- package/dist/ui/index.html +3 -2
- package/dist/ui/stageflow-icon.svg +12 -0
- package/package.json +7 -5
- package/dist/ui/assets/index-Cry0Tpfx.js +0 -118
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { Type } from "typebox";
|
|
13
13
|
import { assertRequiredEnvelope, isAdvancingEnvelope, } from "../envelope/check.js";
|
|
14
|
+
import { normalizeForkChoice } from "../envelope/forkChoice.js";
|
|
14
15
|
import { assertEnvelopePayload, compilePayloadSchema, } from "../envelope/payloadSchema.js";
|
|
15
16
|
function toolResult(text, details, options) {
|
|
16
17
|
return {
|
|
@@ -20,7 +21,7 @@ function toolResult(text, details, options) {
|
|
|
20
21
|
...(options?.terminate ? { terminate: true } : {}),
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
|
-
export function createEmitStageEnvelopeTool(capture, payloadSchema) {
|
|
24
|
+
export function createEmitStageEnvelopeTool(capture, payloadSchema, forkEmitContext) {
|
|
24
25
|
const compiledPayload = payloadSchema !== undefined
|
|
25
26
|
? compilePayloadSchema(payloadSchema)
|
|
26
27
|
: undefined;
|
|
@@ -35,6 +36,9 @@ export function createEmitStageEnvelopeTool(capture, payloadSchema) {
|
|
|
35
36
|
payload: compiledPayload !== undefined
|
|
36
37
|
? compiledPayload
|
|
37
38
|
: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
|
39
|
+
fork_choice: forkEmitContext !== undefined
|
|
40
|
+
? Type.Array(Type.String())
|
|
41
|
+
: Type.Optional(Type.Array(Type.String())),
|
|
38
42
|
stage_id: Type.Optional(Type.String()),
|
|
39
43
|
notes: Type.Optional(Type.String()),
|
|
40
44
|
}),
|
|
@@ -43,6 +47,12 @@ export function createEmitStageEnvelopeTool(capture, payloadSchema) {
|
|
|
43
47
|
return toolResult("Envelope already accepted; later emits are ignored.", { advancing: isAdvancingEnvelope(capture.envelope), error: "" }, { terminate: true });
|
|
44
48
|
}
|
|
45
49
|
try {
|
|
50
|
+
if (forkEmitContext !== undefined) {
|
|
51
|
+
const record = params;
|
|
52
|
+
if (record.status !== "failure") {
|
|
53
|
+
normalizeForkChoice(record.fork_choice, "emit", forkEmitContext);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
46
56
|
const envelope = assertRequiredEnvelope(params);
|
|
47
57
|
assertEnvelopePayload(envelope, payloadSchema);
|
|
48
58
|
capture.envelope = envelope;
|
package/dist/types/envelope.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/pipeline.d.ts
CHANGED
|
@@ -1,17 +1,64 @@
|
|
|
1
|
+
import type { StageConfig, StageGateKind } from "./stage.js";
|
|
1
2
|
export type PipelineConfig = {
|
|
2
3
|
id: string;
|
|
3
4
|
stages: string[];
|
|
4
5
|
};
|
|
6
|
+
export type PipelineForkConfig = {
|
|
7
|
+
select: "one" | "subset";
|
|
8
|
+
allow_none: boolean;
|
|
9
|
+
};
|
|
5
10
|
export type PipelineStageRef = {
|
|
6
11
|
id: string;
|
|
7
12
|
needs?: string;
|
|
13
|
+
fork?: {
|
|
14
|
+
select: "one" | "subset";
|
|
15
|
+
allow_none?: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type PipelineStageYamlEntry = PipelineStageRef & {
|
|
19
|
+
uses?: string;
|
|
20
|
+
system_prompt?: string;
|
|
21
|
+
model?: string;
|
|
22
|
+
payload_schema?: unknown;
|
|
23
|
+
gate_kinds?: StageGateKind[];
|
|
24
|
+
skill?: string;
|
|
25
|
+
};
|
|
26
|
+
export type PipelineIncludeEntry = {
|
|
27
|
+
local: string;
|
|
28
|
+
};
|
|
29
|
+
export type PipelineFragmentConfig = {
|
|
30
|
+
include?: PipelineIncludeEntry[];
|
|
31
|
+
stages?: PipelineStageYamlEntry[];
|
|
32
|
+
};
|
|
33
|
+
export type NormalizedPipelineStageEntry = {
|
|
34
|
+
id: string;
|
|
35
|
+
needs?: string;
|
|
36
|
+
fork?: {
|
|
37
|
+
select: "one" | "subset";
|
|
38
|
+
allow_none?: boolean;
|
|
39
|
+
};
|
|
40
|
+
body: {
|
|
41
|
+
kind: "inline";
|
|
42
|
+
raw: Record<string, unknown>;
|
|
43
|
+
} | {
|
|
44
|
+
kind: "uses";
|
|
45
|
+
path: string;
|
|
46
|
+
absolutePath: string;
|
|
47
|
+
};
|
|
48
|
+
declaringPath: string;
|
|
49
|
+
};
|
|
50
|
+
export type PipelineStageSource = {
|
|
51
|
+
kind: "inline";
|
|
52
|
+
} | {
|
|
53
|
+
kind: "file";
|
|
54
|
+
path: string;
|
|
8
55
|
};
|
|
9
|
-
export type PipelineStageYamlEntry = string | PipelineStageRef;
|
|
10
56
|
export type ResolvedPipelineStageNode = {
|
|
11
57
|
id: string;
|
|
12
58
|
needs: string | null;
|
|
13
59
|
ancestors: string[];
|
|
14
60
|
stageIndex: number;
|
|
61
|
+
fork?: PipelineForkConfig;
|
|
15
62
|
};
|
|
16
63
|
export type ResolvedPipelineDag = {
|
|
17
64
|
nodes: ResolvedPipelineStageNode[];
|
|
@@ -20,6 +67,8 @@ export type ResolvedPipelineDag = {
|
|
|
20
67
|
};
|
|
21
68
|
export type LoadedPipeline = {
|
|
22
69
|
pipeline: PipelineConfig;
|
|
23
|
-
stages:
|
|
70
|
+
stages: StageConfig[];
|
|
24
71
|
dag: ResolvedPipelineDag;
|
|
72
|
+
pipelinePath: string;
|
|
73
|
+
stageSources?: Record<string, PipelineStageSource>;
|
|
25
74
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type StageflowManifestVersion = 1;
|
|
2
|
+
export type StageflowManifestCatalog = {
|
|
3
|
+
pipelines: string[];
|
|
4
|
+
tasks: string[];
|
|
5
|
+
patterns?: {
|
|
6
|
+
pipeline?: string;
|
|
7
|
+
task?: string;
|
|
8
|
+
};
|
|
9
|
+
exclude?: string[];
|
|
10
|
+
};
|
|
11
|
+
export type StageflowManifest = {
|
|
12
|
+
version: StageflowManifestVersion;
|
|
13
|
+
catalog: StageflowManifestCatalog;
|
|
14
|
+
};
|
|
15
|
+
export type LoadedManifest = {
|
|
16
|
+
path: string;
|
|
17
|
+
projectRoot: string;
|
|
18
|
+
manifest: StageflowManifest;
|
|
19
|
+
patterns: {
|
|
20
|
+
pipeline: string;
|
|
21
|
+
task: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|