stageflow 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/LICENSE +21 -0
- package/README.md +56 -0
- package/dist/agent/activity.d.ts +76 -0
- package/dist/agent/activity.js +89 -0
- package/dist/agent/activityObserver.d.ts +17 -0
- package/dist/agent/activityObserver.js +66 -0
- package/dist/agent/cursorExtension.d.ts +12 -0
- package/dist/agent/cursorExtension.js +88 -0
- package/dist/agent/cursorProvider.d.ts +14 -0
- package/dist/agent/cursorProvider.js +139 -0
- package/dist/agent/fakeAgent.d.ts +29 -0
- package/dist/agent/fakeAgent.js +295 -0
- package/dist/agent/oauthSessionManager.d.ts +33 -0
- package/dist/agent/oauthSessionManager.js +214 -0
- package/dist/agent/piAdapter.d.ts +128 -0
- package/dist/agent/piAdapter.js +967 -0
- package/dist/agent/port.d.ts +63 -0
- package/dist/agent/port.js +46 -0
- package/dist/agent/providerAuth.d.ts +101 -0
- package/dist/agent/providerAuth.js +282 -0
- package/dist/agent/providerSupport.d.ts +28 -0
- package/dist/agent/providerSupport.js +19 -0
- package/dist/cli/providersCommand.d.ts +11 -0
- package/dist/cli/providersCommand.js +275 -0
- package/dist/cli/terminalAuthInteraction.d.ts +8 -0
- package/dist/cli/terminalAuthInteraction.js +65 -0
- package/dist/cli/terminalSecret.d.ts +2 -0
- package/dist/cli/terminalSecret.js +67 -0
- package/dist/cli/validateCommand.d.ts +11 -0
- package/dist/cli/validateCommand.js +81 -0
- package/dist/cli/validateOutput.d.ts +8 -0
- package/dist/cli/validateOutput.js +75 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +273 -0
- package/dist/config/createPipeline.d.ts +31 -0
- package/dist/config/createPipeline.js +255 -0
- package/dist/config/createStage.d.ts +25 -0
- package/dist/config/createStage.js +181 -0
- package/dist/config/listConfig.d.ts +33 -0
- package/dist/config/listConfig.js +195 -0
- package/dist/config/listExtensions.d.ts +26 -0
- package/dist/config/listExtensions.js +50 -0
- package/dist/config/listSkills.d.ts +29 -0
- package/dist/config/listSkills.js +55 -0
- package/dist/config/loadOutcome.d.ts +27 -0
- package/dist/config/loadOutcome.js +6 -0
- package/dist/config/loadPipeline.d.ts +25 -0
- package/dist/config/loadPipeline.js +196 -0
- package/dist/config/loadStage.d.ts +4 -0
- package/dist/config/loadStage.js +127 -0
- package/dist/config/loadTask.d.ts +7 -0
- package/dist/config/loadTask.js +69 -0
- package/dist/config/readYamlObject.d.ts +1 -0
- package/dist/config/readYamlObject.js +5 -0
- package/dist/config/resolvePipelineDag.d.ts +12 -0
- package/dist/config/resolvePipelineDag.js +282 -0
- package/dist/config/validateCatalog.d.ts +36 -0
- package/dist/config/validateCatalog.js +322 -0
- package/dist/envelope/check.d.ts +3 -0
- package/dist/envelope/check.js +52 -0
- package/dist/envelope/payloadSchema.d.ts +10 -0
- package/dist/envelope/payloadSchema.js +91 -0
- package/dist/hitl/qaTrail.d.ts +31 -0
- package/dist/hitl/qaTrail.js +65 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +7 -0
- package/dist/mcp/projectRun.d.ts +37 -0
- package/dist/mcp/projectRun.js +57 -0
- package/dist/mcp/readArtifact.d.ts +2 -0
- package/dist/mcp/readArtifact.js +46 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +26 -0
- package/dist/mcp/tools.d.ts +9 -0
- package/dist/mcp/tools.js +96 -0
- package/dist/package-meta.d.ts +1 -0
- package/dist/package-meta.js +1 -0
- package/dist/prompt/priorEnvelope.d.ts +2 -0
- package/dist/prompt/priorEnvelope.js +5 -0
- package/dist/runstore/catalog.d.ts +8 -0
- package/dist/runstore/catalog.js +16 -0
- package/dist/runstore/createStore.d.ts +15 -0
- package/dist/runstore/createStore.js +23 -0
- package/dist/runstore/disk/DiskRunStore.d.ts +30 -0
- package/dist/runstore/disk/DiskRunStore.js +238 -0
- package/dist/runstore/disk/catalogHelpers.d.ts +11 -0
- package/dist/runstore/disk/catalogHelpers.js +102 -0
- package/dist/runstore/layout.d.ts +22 -0
- package/dist/runstore/layout.js +58 -0
- package/dist/runstore/paths.d.ts +7 -0
- package/dist/runstore/paths.js +60 -0
- package/dist/runstore/pipelineDagSnapshot.d.ts +5 -0
- package/dist/runstore/pipelineDagSnapshot.js +43 -0
- package/dist/runstore/port.d.ts +146 -0
- package/dist/runstore/port.js +28 -0
- package/dist/runstore/runProjection.d.ts +6 -0
- package/dist/runstore/runProjection.js +102 -0
- package/dist/runstore/sqlite/SqliteRunStore.d.ts +48 -0
- package/dist/runstore/sqlite/SqliteRunStore.js +460 -0
- package/dist/runstore/sqlite/migrateFromDisk.d.ts +5 -0
- package/dist/runstore/sqlite/migrateFromDisk.js +108 -0
- package/dist/runstore/sqlite/schema.d.ts +1 -0
- package/dist/runstore/sqlite/schema.js +59 -0
- package/dist/runstore/stageExecution.d.ts +13 -0
- package/dist/runstore/stageExecution.js +22 -0
- package/dist/runstore/stageSnapshot.d.ts +2 -0
- package/dist/runstore/stageSnapshot.js +46 -0
- package/dist/runstore/syntheticStageSnapshot.d.ts +2 -0
- package/dist/runstore/syntheticStageSnapshot.js +10 -0
- package/dist/runstore/trackProjection.d.ts +7 -0
- package/dist/runstore/trackProjection.js +94 -0
- package/dist/runstore/workspaceLayout.d.ts +31 -0
- package/dist/runstore/workspaceLayout.js +172 -0
- package/dist/runtime/answerResume.d.ts +16 -0
- package/dist/runtime/answerResume.js +22 -0
- package/dist/runtime/credentialBinding.d.ts +16 -0
- package/dist/runtime/credentialBinding.js +80 -0
- package/dist/runtime/dagTraversal.d.ts +3 -0
- package/dist/runtime/dagTraversal.js +26 -0
- package/dist/runtime/envelopeRouting.d.ts +20 -0
- package/dist/runtime/envelopeRouting.js +59 -0
- package/dist/runtime/hitlSeams.d.ts +38 -0
- package/dist/runtime/hitlSeams.js +2 -0
- package/dist/runtime/pipelineRunner.d.ts +77 -0
- package/dist/runtime/pipelineRunner.js +141 -0
- package/dist/runtime/pipelineScheduler.d.ts +90 -0
- package/dist/runtime/pipelineScheduler.js +494 -0
- package/dist/runtime/pipelineValidationError.d.ts +6 -0
- package/dist/runtime/pipelineValidationError.js +8 -0
- package/dist/runtime/resumeReconstruct.d.ts +33 -0
- package/dist/runtime/resumeReconstruct.js +144 -0
- package/dist/runtime/runManager.d.ts +129 -0
- package/dist/runtime/runManager.js +818 -0
- package/dist/runtime/runRetryCoordinator.d.ts +85 -0
- package/dist/runtime/runRetryCoordinator.js +372 -0
- package/dist/runtime/settingsFile.d.ts +17 -0
- package/dist/runtime/settingsFile.js +88 -0
- package/dist/runtime/stageAttemptBootstrap.d.ts +40 -0
- package/dist/runtime/stageAttemptBootstrap.js +82 -0
- package/dist/runtime/stageAttemptContext.d.ts +11 -0
- package/dist/runtime/stageAttemptContext.js +26 -0
- package/dist/runtime/stageConcurrency.d.ts +10 -0
- package/dist/runtime/stageConcurrency.js +51 -0
- package/dist/runtime/stageHitl.d.ts +95 -0
- package/dist/runtime/stageHitl.js +198 -0
- package/dist/runtime/stageProcessLauncher.d.ts +45 -0
- package/dist/runtime/stageProcessLauncher.js +199 -0
- package/dist/runtime/stageRecovery.d.ts +10 -0
- package/dist/runtime/stageRecovery.js +43 -0
- package/dist/runtime/stageRoots.d.ts +22 -0
- package/dist/runtime/stageRoots.js +93 -0
- package/dist/runtime/stageRunner.d.ts +59 -0
- package/dist/runtime/stageRunner.js +221 -0
- package/dist/runtime/stageWorker.d.ts +6 -0
- package/dist/runtime/stageWorker.js +109 -0
- package/dist/runtime/stageWorkerProtocol.d.ts +27 -0
- package/dist/runtime/stageWorkerProtocol.js +16 -0
- package/dist/runtime/taskInput.d.ts +15 -0
- package/dist/runtime/taskInput.js +38 -0
- package/dist/server/http.d.ts +31 -0
- package/dist/server/http.js +561 -0
- package/dist/server/providerRoutes.d.ts +15 -0
- package/dist/server/providerRoutes.js +186 -0
- package/dist/tools/askOperator.d.ts +185 -0
- package/dist/tools/askOperator.js +409 -0
- package/dist/tools/emitStageEnvelope.d.ts +42 -0
- package/dist/tools/emitStageEnvelope.js +61 -0
- package/dist/tools/writeStageArtifact.d.ts +26 -0
- package/dist/tools/writeStageArtifact.js +103 -0
- package/dist/types/envelope.d.ts +12 -0
- package/dist/types/envelope.js +6 -0
- package/dist/types/pipeline.d.ts +25 -0
- package/dist/types/pipeline.js +1 -0
- package/dist/types/stage.d.ts +12 -0
- package/dist/types/stage.js +6 -0
- package/dist/types/task.d.ts +7 -0
- package/dist/types/task.js +1 -0
- package/dist/ui/assets/index-Cry0Tpfx.js +118 -0
- package/dist/ui/assets/index-DCsDopak.css +1 -0
- package/dist/ui/index.html +21 -0
- package/package.json +72 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { AgentPort, OpaqueAnswer } from "../agent/port.js";
|
|
2
|
+
import type { RunStore } from "../runstore/port.js";
|
|
3
|
+
import type { TaskFile } from "../types/task.js";
|
|
4
|
+
import { type PipelineRunResult } from "./pipelineRunner.js";
|
|
5
|
+
import { type RetryStageResult } from "./runRetryCoordinator.js";
|
|
6
|
+
import { type StageExecutionMode } from "./stageConcurrency.js";
|
|
7
|
+
import { StageProcessLauncher } from "./stageProcessLauncher.js";
|
|
8
|
+
import { StageHitlController, type DeliverAnswerResult, type HitlSeams } from "./stageHitl.js";
|
|
9
|
+
import { type StartTaskInput } from "./taskInput.js";
|
|
10
|
+
import type { OperatorCatalog } from "./stageAttemptBootstrap.js";
|
|
11
|
+
export type BusyCode = "busy_capacity" | "busy_checkout";
|
|
12
|
+
export type StartRunResult = {
|
|
13
|
+
ok: true;
|
|
14
|
+
runId: string;
|
|
15
|
+
done: Promise<PipelineRunResult>;
|
|
16
|
+
} | {
|
|
17
|
+
ok: false;
|
|
18
|
+
reason: string;
|
|
19
|
+
status?: number;
|
|
20
|
+
code?: BusyCode;
|
|
21
|
+
activeCount?: number;
|
|
22
|
+
maxConcurrent?: number;
|
|
23
|
+
activeRunIds?: string[];
|
|
24
|
+
conflictingRunId?: string;
|
|
25
|
+
conflictingCheckout?: string;
|
|
26
|
+
};
|
|
27
|
+
export type CapacityHealth = {
|
|
28
|
+
ok: true;
|
|
29
|
+
activeRunIds: string[];
|
|
30
|
+
activeCount: number;
|
|
31
|
+
maxConcurrent: number;
|
|
32
|
+
slotsAvailable: number;
|
|
33
|
+
activeStageProcesses: number;
|
|
34
|
+
maxActiveStageProcesses: number | null;
|
|
35
|
+
};
|
|
36
|
+
export type { DeliverAnswerResult };
|
|
37
|
+
export type { RetryStageResult };
|
|
38
|
+
export type AbandonStageResult = {
|
|
39
|
+
ok: true;
|
|
40
|
+
runId: string;
|
|
41
|
+
stageId: string;
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
reason: string;
|
|
45
|
+
status?: number;
|
|
46
|
+
};
|
|
47
|
+
export declare class RunManager {
|
|
48
|
+
private readonly options;
|
|
49
|
+
private readonly active;
|
|
50
|
+
private readonly checkoutLeases;
|
|
51
|
+
private readonly provisionalIds;
|
|
52
|
+
private readonly resumeInFlight;
|
|
53
|
+
private readonly retryInFlight;
|
|
54
|
+
private trackingGeneration;
|
|
55
|
+
private maxConcurrent;
|
|
56
|
+
private readonly maxActiveStagesPerRun;
|
|
57
|
+
private readonly executionMode;
|
|
58
|
+
private readonly stageProcessLauncher;
|
|
59
|
+
private readonly hitl;
|
|
60
|
+
private readonly attachedWaiting;
|
|
61
|
+
private readonly retryCoordinator;
|
|
62
|
+
private readonly retryTracking;
|
|
63
|
+
private readonly cwd;
|
|
64
|
+
constructor(options: {
|
|
65
|
+
agent: AgentPort;
|
|
66
|
+
store: RunStore;
|
|
67
|
+
cwd?: string;
|
|
68
|
+
operatorCatalog?: OperatorCatalog;
|
|
69
|
+
seams?: HitlSeams;
|
|
70
|
+
maxConcurrent?: number;
|
|
71
|
+
maxActiveStagesPerRun?: number;
|
|
72
|
+
executionMode?: StageExecutionMode;
|
|
73
|
+
stageProcessLauncher?: StageProcessLauncher;
|
|
74
|
+
});
|
|
75
|
+
getMaxConcurrent(): number;
|
|
76
|
+
setMaxConcurrent(n: number): CapacityHealth;
|
|
77
|
+
getActiveCount(): number;
|
|
78
|
+
getActiveRunIds(): string[];
|
|
79
|
+
getHealth(): CapacityHealth;
|
|
80
|
+
getHitlController(): StageHitlController;
|
|
81
|
+
/**
|
|
82
|
+
* KTD7/KTD8: discover waiting stages from the store; leave waiting; do not
|
|
83
|
+
* auto-resume. Registers each waiting run into the active set (capacity)
|
|
84
|
+
* and re-acquires checkout leases from durable checkout_root (even over soft max).
|
|
85
|
+
*/
|
|
86
|
+
attachWaitingStages(): Promise<Array<{
|
|
87
|
+
runId: string;
|
|
88
|
+
stageId: string;
|
|
89
|
+
}>>;
|
|
90
|
+
hasActiveWorker(runId: string, stageId: string): boolean;
|
|
91
|
+
reconcileOrphanedStages(): Promise<{
|
|
92
|
+
reconciled: Array<{
|
|
93
|
+
runId: string;
|
|
94
|
+
stageId: string;
|
|
95
|
+
reason: string;
|
|
96
|
+
}>;
|
|
97
|
+
}>;
|
|
98
|
+
abandonStage(runId: string, stageId: string): Promise<AbandonStageResult>;
|
|
99
|
+
startRun(input: StartTaskInput & {
|
|
100
|
+
pipeline: string;
|
|
101
|
+
task?: string | TaskFile;
|
|
102
|
+
checkoutOverride?: string;
|
|
103
|
+
}): Promise<StartRunResult>;
|
|
104
|
+
rerun(runId: string): Promise<StartRunResult>;
|
|
105
|
+
retryStage(runId: string, stageId: string): Promise<RetryStageResult>;
|
|
106
|
+
/**
|
|
107
|
+
* Deliver an operator answer for `(runId, stageId)` (KTD2 / KTD6).
|
|
108
|
+
* Same-process: unparks the live yield loop. After restart: reconstructs
|
|
109
|
+
* the stage session seam and continues that stage (KTD8).
|
|
110
|
+
*/
|
|
111
|
+
deliverAnswer(runId: string, stageId: string, opaqueAnswer: OpaqueAnswer): Promise<DeliverAnswerResult>;
|
|
112
|
+
private resumeViaSubprocess;
|
|
113
|
+
private reconstructAndContinue;
|
|
114
|
+
private reserveAndStartPipeline;
|
|
115
|
+
private busyFailure;
|
|
116
|
+
private tryReserve;
|
|
117
|
+
private clearReservation;
|
|
118
|
+
private track;
|
|
119
|
+
/**
|
|
120
|
+
* Acquire active tracking + checkout lease for a restart resume before
|
|
121
|
+
* reconstruct starts. Over-max is allowed. Lease held by another run → fail closed.
|
|
122
|
+
*/
|
|
123
|
+
private ensureResumeTracked;
|
|
124
|
+
private registerResumeUntrack;
|
|
125
|
+
private findActiveCheckoutConflict;
|
|
126
|
+
private quarantineAttachRun;
|
|
127
|
+
private untrackIfGeneration;
|
|
128
|
+
private removeActiveEntry;
|
|
129
|
+
}
|