stageflow 0.32.0 → 0.35.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 +4 -3
- package/dist/agent/adapterSpill.d.ts +14 -0
- package/dist/agent/adapterSpill.js +83 -0
- package/dist/agent/agentBackend.d.ts +2 -2
- package/dist/agent/agentBackend.js +2 -2
- package/dist/agent/claudeAdapter.d.ts +13 -2
- package/dist/agent/claudeAdapter.js +50 -6
- package/dist/agent/cursorProvider.d.ts +3 -0
- package/dist/agent/cursorProvider.js +23 -6
- package/dist/agent/fakeAgent.d.ts +3 -3
- package/dist/agent/fakeAgent.js +0 -6
- package/dist/agent/piAdapter.d.ts +2 -2
- package/dist/agent/piAdapter.js +116 -15
- package/dist/agent/piIsolatedMcp.d.ts +1 -0
- package/dist/agent/piIsolatedMcp.js +19 -1
- package/dist/agent/piIsolatedMcpProbe.d.ts +11 -0
- package/dist/agent/piIsolatedMcpProbe.js +20 -0
- package/dist/agent/port.d.ts +2 -2
- package/dist/agent/providerAuth.d.ts +6 -0
- package/dist/agent/providerAuth.js +86 -17
- package/dist/agent/{resolveAgentPort.d.ts → resolveStagePort.d.ts} +8 -6
- package/dist/agent/{resolveAgentPort.js → resolveStagePort.js} +13 -9
- package/dist/agent/stageTurnDriver.d.ts +33 -0
- package/dist/agent/stageTurnDriver.js +64 -0
- package/dist/agent/toolOutputBudget.d.ts +46 -0
- package/dist/agent/toolOutputBudget.js +97 -0
- package/dist/agent/toolOutputBudgetExtension.d.ts +22 -0
- package/dist/agent/toolOutputBudgetExtension.js +141 -0
- package/dist/agent/toolOutputSpill.d.ts +34 -0
- package/dist/agent/toolOutputSpill.js +85 -0
- package/dist/browser/agentBrowserLiveViewRelay.d.ts +41 -0
- package/dist/browser/agentBrowserLiveViewRelay.js +801 -0
- package/dist/browser/anchor.d.ts +2 -0
- package/dist/browser/anchor.js +2 -1
- package/dist/browser/auditSink.d.ts +8 -0
- package/dist/browser/browserHost.d.ts +29 -0
- package/dist/browser/browserSweep.d.ts +4 -1
- package/dist/browser/browserSweep.js +7 -0
- package/dist/browser/browserTeardown.d.ts +1 -0
- package/dist/browser/browserTeardown.js +32 -2
- package/dist/browser/containerBrowserEndpoint.d.ts +11 -0
- package/dist/browser/containerBrowserEndpoint.js +57 -0
- package/dist/browser/containerBrowserHost.d.ts +24 -0
- package/dist/browser/containerBrowserHost.js +147 -0
- package/dist/browser/dockerSandboxOrchestrator.d.ts +26 -0
- package/dist/browser/dockerSandboxOrchestrator.js +142 -0
- package/dist/browser/fakeLiveViewRelay.d.ts +15 -0
- package/dist/browser/fakeLiveViewRelay.js +94 -0
- package/dist/browser/fakeLiveViewSource.d.ts +6 -0
- package/dist/browser/fakeLiveViewSource.js +16 -0
- package/dist/browser/fakeRemoteBrowserHost.d.ts +2 -1
- package/dist/browser/fakeRemoteBrowserHost.js +2 -1
- package/dist/browser/fakeSandboxOrchestrator.d.ts +9 -0
- package/dist/browser/fakeSandboxOrchestrator.js +44 -0
- package/dist/browser/gateHandoff.d.ts +0 -2
- package/dist/browser/gateHandoff.js +5 -11
- package/dist/browser/hostCapabilities.d.ts +23 -0
- package/dist/browser/hostCapabilities.js +23 -0
- package/dist/browser/humanLogin.d.ts +2 -2
- package/dist/browser/humanLogin.js +11 -2
- package/dist/browser/liveViewPersisted.d.ts +11 -0
- package/dist/browser/liveViewPersisted.js +22 -0
- package/dist/browser/liveViewRelay.d.ts +76 -0
- package/dist/browser/liveViewRelay.js +1 -0
- package/dist/browser/liveViewSessions.d.ts +25 -0
- package/dist/browser/liveViewSessions.js +139 -0
- package/dist/browser/liveViewSource.d.ts +25 -0
- package/dist/browser/liveViewSource.js +7 -0
- package/dist/browser/liveViewTickets.d.ts +46 -0
- package/dist/browser/liveViewTickets.js +122 -0
- package/dist/browser/localBrowserHost.d.ts +10 -0
- package/dist/browser/localBrowserHost.js +53 -7
- package/dist/browser/ownerScope.d.ts +10 -0
- package/dist/browser/ownerScope.js +6 -0
- package/dist/browser/profileStore.d.ts +5 -2
- package/dist/browser/profileStore.js +3 -5
- package/dist/browser/sandboxOrchestrator.d.ts +60 -0
- package/dist/browser/sandboxOrchestrator.js +8 -0
- package/dist/browser/sessionApiSandboxOrchestrator.d.ts +34 -0
- package/dist/browser/sessionApiSandboxOrchestrator.js +108 -0
- package/dist/browser/stageBrowserEnv.d.ts +7 -0
- package/dist/browser/stageBrowserEnv.js +53 -15
- package/dist/browser/stageHandoff.d.ts +47 -0
- package/dist/browser/stageHandoff.js +101 -0
- package/dist/browser/stageProfileLock.d.ts +1 -0
- package/dist/browser/stageProfileLock.js +1 -3
- package/dist/browser/volumeProfileStore.d.ts +7 -0
- package/dist/browser/volumeProfileStore.js +35 -0
- package/dist/cli/browserCommand.d.ts +3 -1
- package/dist/cli/browserCommand.js +25 -20
- package/dist/cli/resolveCliProjectRoot.d.ts +7 -0
- package/dist/cli/resolveCliProjectRoot.js +27 -0
- package/dist/cli/runCommand.d.ts +1 -1
- package/dist/cli/runCommand.js +59 -17
- package/dist/cli/skillsCommand.d.ts +20 -0
- package/dist/cli/skillsCommand.js +74 -31
- package/dist/cli/validateCommand.d.ts +1 -1
- package/dist/cli/validateCommand.js +22 -4
- package/dist/cli.js +4 -4
- package/dist/config/browseCatalog.d.ts +2 -0
- package/dist/config/browseCatalog.js +6 -0
- package/dist/config/catalogRelativePath.d.ts +4 -0
- package/dist/config/catalogRelativePath.js +37 -9
- package/dist/config/createStage.d.ts +1 -0
- package/dist/config/createStage.js +11 -2
- package/dist/config/createTask.d.ts +30 -0
- package/dist/config/createTask.js +161 -0
- package/dist/config/createTrigger.d.ts +15 -0
- package/dist/config/createTrigger.js +32 -25
- package/dist/config/draftPackage.d.ts +41 -0
- package/dist/config/draftPackage.js +216 -23
- package/dist/config/ensureCatalogScanRoot.d.ts +2 -1
- package/dist/config/ensureCatalogScanRoot.js +6 -2
- package/dist/config/findTaskInCatalog.d.ts +33 -0
- package/dist/config/findTaskInCatalog.js +69 -0
- package/dist/config/hostConfig.d.ts +21 -0
- package/dist/config/hostConfig.js +113 -1
- package/dist/config/importTask.d.ts +19 -0
- package/dist/config/importTask.js +133 -0
- package/dist/config/installSkillRequest.d.ts +40 -0
- package/dist/config/installSkillRequest.js +286 -0
- package/dist/config/listConfig.d.ts +0 -16
- package/dist/config/listConfig.js +0 -3
- package/dist/config/loadOutcome.d.ts +11 -6
- package/dist/config/loadPipeline.js +0 -1
- package/dist/config/loadStage.js +2 -0
- package/dist/config/loadStageflowManifest.js +4 -1
- package/dist/config/loadTask.js +2 -0
- package/dist/config/loadTrigger.js +2 -0
- package/dist/config/mergePipelineIncludes.js +3 -0
- package/dist/config/normalizePipelineStageEntry.js +10 -1
- package/dist/config/printTargetYaml.js +0 -1
- package/dist/config/publishDraftPackage.d.ts +5 -1
- package/dist/config/publishDraftPackage.js +4 -1
- package/dist/config/resolveCatalogRoots.d.ts +4 -1
- package/dist/config/resolveCatalogRoots.js +18 -1
- package/dist/config/skillUsageIndex.d.ts +6 -0
- package/dist/config/skillUsageIndex.js +39 -0
- package/dist/config/stageBrowser.js +13 -0
- package/dist/config/triggerAdapterStatus.d.ts +11 -0
- package/dist/config/triggerAdapterStatus.js +90 -0
- package/dist/config/triggerCatalog.d.ts +41 -2
- package/dist/config/triggerCatalog.js +107 -15
- package/dist/config/updateTask.d.ts +30 -0
- package/dist/config/updateTask.js +119 -0
- package/dist/config/updateTrigger.d.ts +38 -0
- package/dist/config/updateTrigger.js +220 -0
- package/dist/config/validateCatalog.d.ts +6 -2
- package/dist/config/validateCatalog.js +48 -7
- package/dist/config/workshopCatalogFilenames.d.ts +37 -0
- package/dist/config/workshopCatalogFilenames.js +125 -0
- package/dist/config/workshopCatalogRepair.d.ts +7 -0
- package/dist/config/workshopCatalogRepair.js +144 -0
- package/dist/config/yamlParsePosition.d.ts +4 -0
- package/dist/config/yamlParsePosition.js +9 -0
- package/dist/hosted/containment.d.ts +3 -0
- package/dist/hosted/containment.js +36 -0
- package/dist/hosted/errors.d.ts +21 -0
- package/dist/hosted/errors.js +30 -0
- package/dist/hosted/packageSkills.d.ts +3 -0
- package/dist/hosted/packageSkills.js +80 -0
- package/dist/hosted/runtime.d.ts +12 -0
- package/dist/hosted/runtime.js +596 -0
- package/dist/hosted/sequencer.d.ts +28 -0
- package/dist/hosted/sequencer.js +129 -0
- package/dist/hosted/translate.d.ts +3 -0
- package/dist/hosted/translate.js +43 -0
- package/dist/hosted/types.d.ts +108 -0
- package/dist/hosted/types.js +10 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +6 -0
- package/dist/mcp/getStartedTool.js +15 -6
- package/dist/mcp/triggerTools.js +2 -8
- package/dist/operatorAgent/agentPort.d.ts +11 -0
- package/dist/operatorAgent/agentPort.js +12 -0
- package/dist/operatorAgent/index.d.ts +1 -0
- package/dist/operatorAgent/index.js +1 -0
- package/dist/operatorAgent/piModel.js +26 -6
- package/dist/operatorAgent/profiles/workshopAuthorPlaybook.d.ts +1 -1
- package/dist/operatorAgent/profiles/workshopAuthorPlaybook.js +4 -2
- package/dist/operatorAgent/profiles/workshopAuthorTools.js +103 -16
- package/dist/package-meta.d.ts +1 -1
- package/dist/package-meta.js +1 -1
- package/dist/project/ensureProjectRootsFromEnv.d.ts +3 -0
- package/dist/project/ensureProjectRootsFromEnv.js +22 -0
- package/dist/project/globalHome.d.ts +1 -0
- package/dist/project/globalHome.js +18 -0
- package/dist/project/workspaceCatalog.d.ts +10 -0
- package/dist/project/workspaceCatalog.js +91 -0
- package/dist/projection/projectRun.d.ts +0 -1
- package/dist/projection/projectRun.js +0 -1
- package/dist/runstore/backup.js +14 -4
- package/dist/runstore/port.d.ts +11 -1
- package/dist/runstore/restore.js +5 -2
- package/dist/runstore/sqlite/SqliteRunStore.d.ts +8 -0
- package/dist/runstore/sqlite/SqliteRunStore.js +29 -9
- package/dist/runstore/sqlite/migrations/012-trigger-fires.d.ts +7 -0
- package/dist/runstore/sqlite/migrations/012-trigger-fires.js +18 -0
- package/dist/runstore/sqlite/migrations/index.js +2 -0
- package/dist/runstore/stageSnapshot.d.ts +3 -1
- package/dist/runstore/stageSnapshot.js +19 -0
- package/dist/runstore/workspaceLayout.js +27 -0
- package/dist/runstore/writeContainedArtifact.d.ts +1 -0
- package/dist/runstore/writeContainedArtifact.js +52 -0
- package/dist/runtime/containerLimits.d.ts +0 -3
- package/dist/runtime/containerLimits.js +0 -5
- package/dist/runtime/credentialBinding.d.ts +3 -0
- package/dist/runtime/credentialBinding.js +23 -6
- package/dist/runtime/emailSource.js +20 -28
- package/dist/runtime/githubPollSource.js +20 -28
- package/dist/runtime/pipelineRunner.d.ts +4 -4
- package/dist/runtime/pipelineScheduler.d.ts +2 -2
- package/dist/runtime/pipelineScheduler.js +3 -0
- package/dist/runtime/resumeReconstruct.d.ts +2 -2
- package/dist/runtime/resumeTimedOut.d.ts +2 -2
- package/dist/runtime/runManager.d.ts +18 -2
- package/dist/runtime/runManager.js +95 -30
- package/dist/runtime/runRetentionSweep.d.ts +0 -2
- package/dist/runtime/runRetentionSweep.js +0 -8
- package/dist/runtime/runRetryCoordinator.d.ts +2 -2
- package/dist/runtime/scheduleSource.js +15 -24
- package/dist/runtime/stageAttemptBootstrap.d.ts +2 -2
- package/dist/runtime/stageAttemptBootstrap.js +10 -1
- package/dist/runtime/stageProcessLauncher.js +2 -2
- package/dist/runtime/stageRoots.js +12 -1
- package/dist/runtime/stageRunner.d.ts +2 -2
- package/dist/runtime/stageRunner.js +8 -2
- package/dist/runtime/stageWorker.js +2 -2
- package/dist/runtime/triggerPort.d.ts +5 -3
- package/dist/runtime/triggerRunner.d.ts +1 -0
- package/dist/runtime/triggerRunner.js +27 -20
- package/dist/runtime/webhookAccept.d.ts +25 -0
- package/dist/runtime/webhookAccept.js +56 -0
- package/dist/server/bootstrap.d.ts +7 -2
- package/dist/server/bootstrap.js +15 -1
- package/dist/server/controlToken.d.ts +1 -1
- package/dist/server/controlToken.js +18 -2
- package/dist/server/healthSurfaces.d.ts +12 -0
- package/dist/server/healthSurfaces.js +27 -6
- package/dist/server/http.d.ts +19 -10
- package/dist/server/http.js +605 -85
- package/dist/server/liveViewPath.d.ts +9 -0
- package/dist/server/liveViewPath.js +8 -0
- package/dist/server/liveViewRoutes.d.ts +58 -0
- package/dist/server/liveViewRoutes.js +565 -0
- package/dist/server/mcpHost.d.ts +4 -2
- package/dist/server/mcpHost.js +2 -0
- package/dist/server/readCatalogFile.d.ts +29 -0
- package/dist/server/readCatalogFile.js +215 -0
- package/dist/server/triggerRoutes.d.ts +1 -0
- package/dist/server/triggerRoutes.js +200 -73
- package/dist/tools/readEmail.d.ts +3 -3
- package/dist/tools/writeStageArtifact.d.ts +9 -0
- package/dist/tools/writeStageArtifact.js +2 -47
- package/dist/types/pipeline.d.ts +1 -1
- package/dist/types/stage.d.ts +1 -1
- package/dist/types/stageflowManifest.d.ts +1 -1
- package/dist/ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/ui/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/ui/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/ui/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/ui/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/ui/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/ui/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/ui/assets/index-BoFPkKFg.js +256 -0
- package/dist/ui/assets/{index-Bv4p1aPK.css → index-CIPbbBUi.css} +1 -1
- package/dist/ui/index.html +4 -4
- package/dist/workshop/autosave.d.ts +2 -2
- package/dist/workshop/autosave.js +4 -6
- package/dist/workshop/buildStore.d.ts +2 -0
- package/dist/workshop/chatAttachments.d.ts +27 -0
- package/dist/workshop/chatAttachments.js +98 -0
- package/dist/workshop/chatTurn.d.ts +5 -2
- package/dist/workshop/chatTurn.js +22 -18
- package/dist/workshop/sessionMutations.d.ts +17 -0
- package/dist/workshop/sessionMutations.js +107 -0
- package/dist/workshop/sessionStore.d.ts +10 -0
- package/dist/workshop/sessionStore.js +52 -0
- package/dist/workshop/workshopPin.d.ts +4 -3
- package/dist/workshop/workshopPin.js +26 -6
- package/dist/workshop/workshopTranscriptTurn.d.ts +8 -0
- package/dist/workshop/workshopTranscriptTurn.js +46 -0
- package/examples/README.md +1 -1
- package/examples/archify-on-pr/README.md +1 -1
- package/examples/archify-on-pr/archify-on-pr.pipeline.yaml +0 -1
- package/examples/archify-on-pr/author-diagrams.yaml +1 -0
- package/examples/conditional-fork/branch-a.yaml +1 -1
- package/examples/conditional-fork/decide.yaml +2 -1
- package/examples/feature-loop/{implement.yaml → feature-implement.yaml} +1 -1
- package/examples/feature-loop/feature-loop.pipeline.yaml +10 -10
- package/examples/feature-loop/{plan.yaml → feature-plan.yaml} +1 -1
- package/examples/feature-loop/{review.yaml → feature-review.yaml} +1 -1
- package/examples/feedback-loop/{implement.yaml → feedback-implement.yaml} +1 -1
- package/examples/feedback-loop/feedback-loop-wait-human.pipeline.yaml +9 -9
- package/examples/feedback-loop/feedback-loop.pipeline.yaml +9 -9
- package/examples/feedback-loop/{plan.yaml → feedback-plan.yaml} +1 -1
- package/examples/feedback-loop/{review.yaml → feedback-review.yaml} +1 -1
- package/examples/generic-fan-in/{research.yaml → fan-in-research.yaml} +1 -1
- package/examples/generic-fan-in/generic-fan-in-accepted.pipeline.yaml +3 -3
- package/examples/generic-fan-in/generic-fan-in.pipeline.yaml +3 -3
- package/examples/hello-world/{research.yaml → hello-research.yaml} +1 -1
- package/examples/hello-world/hello.pipeline.yaml +2 -2
- package/examples/mcp-hitl-tour/{review.yaml → mcp-hitl-review.yaml} +1 -1
- package/examples/mcp-hitl-tour/mcp-hitl-tour.pipeline.yaml +3 -3
- package/examples/oss-issue-contribution/oss-explain-fix.yaml +1 -0
- package/examples/oss-issue-contribution/oss-explain-issue.yaml +1 -0
- package/examples/oss-issue-contribution/oss-issue-contribution.pipeline.yaml +0 -2
- package/examples/stageflow.yaml +6 -0
- package/examples/triggers/sample-github-pr.trigger.yaml +12 -0
- package/examples/triggers/sample-inbox-email.trigger.yaml +14 -0
- package/examples/triggers/sample-manual-hello.trigger.yaml +5 -0
- package/examples/triggers/sample-nightly-hello.trigger.yaml +8 -0
- package/examples/triggers/sample-signed-webhook.trigger.yaml +11 -0
- package/examples/triggers-readiness/README.md +48 -0
- package/examples/triggers-readiness/readiness-emit.yaml +18 -0
- package/examples/triggers-readiness/readiness.pipeline.yaml +4 -0
- package/examples/triggers-readiness/readiness.task.yaml +6 -0
- package/examples/triggers-readiness/stageflow.yaml +13 -0
- package/examples/triggers-readiness/triggers/readiness-dynamic-manual.trigger.yaml +4 -0
- package/examples/triggers-readiness/triggers/readiness-email.trigger.yaml +12 -0
- package/examples/triggers-readiness/triggers/readiness-github-pr.trigger.yaml +12 -0
- package/examples/triggers-readiness/triggers/readiness-manual.trigger.yaml +5 -0
- package/examples/triggers-readiness/triggers/readiness-schedule.trigger.yaml +8 -0
- package/examples/triggers-readiness/triggers/readiness-webhook.trigger.yaml +11 -0
- package/package.json +9 -1
- package/skills/stageflow/references/control-surface.md +1 -1
- package/skills/stageflow-author/references/catalog-write-conventions.md +2 -2
- package/skills/stageflow-run/SKILL.md +1 -1
- package/skills/stageflow-run/references/mcp-call.md +1 -1
- package/skills/stageflow-setup/SKILL.md +1 -1
- package/dist/ui/assets/index-59cjF0OA.js +0 -133
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Open-source runtime for **configurable multi-stage agent workflows** with typed handoffs, DAG execution, human gates, MCP, CI, and a local operator console.
|
|
4
4
|
|
|
5
|
-
[](https://stage-flow.dev)
|
|
6
6
|
[](https://www.npmjs.com/package/stageflow)
|
|
7
7
|
[](https://www.npmjs.com/package/stageflow)
|
|
8
8
|

|
|
@@ -46,7 +46,7 @@ The same pipeline runs three ways without rewriting anything:
|
|
|
46
46
|
|
|
47
47
|

|
|
48
48
|
|
|
49
|
-
The scheduler owns orchestration semantics: DAG readiness, bounded parallelism, fan-out/join, conditional routing, retries, skipped branches, and resumable human gates. Agent execution sits behind `
|
|
49
|
+
The scheduler owns orchestration semantics: DAG readiness, bounded parallelism, fan-out/join, conditional routing, retries, skipped branches, and resumable human gates. Agent execution sits behind `StagePort`; Pi supplies the current coding-agent session, while Stageflow owns pipeline state, stage workspaces, handoff validation, and the interfaces used by the CLI, console, MCP, and CI.
|
|
50
50
|
|
|
51
51
|
See [Architecture](docs/architecture.md) for component boundaries, execution flow, persistence, recovery behavior, and the tradeoffs behind fresh sessions and explicit handoffs.
|
|
52
52
|
|
|
@@ -101,7 +101,7 @@ sf run --pipeline pipelines/hello.pipeline.yaml --task tasks/hello.task.yaml
|
|
|
101
101
|
|
|
102
102
|
Expanded walkthrough: [docs/quickstart.md](docs/quickstart.md)
|
|
103
103
|
|
|
104
|
-
**Docker Compose** (UI + MCP in one Host): copy [`.env.example`](.env.example) → `.env`,
|
|
104
|
+
**Docker Compose** (UI + MCP in one Host): copy [`.env.example`](.env.example) → `.env`, then `docker compose up --build -d`. The shipped compose file publishes port 3847 on localhost only and does not require a control token. Checklist: [docs/docker.md](docs/docker.md#local-try-compose).
|
|
105
105
|
|
|
106
106
|
## Connect a model provider
|
|
107
107
|
|
|
@@ -254,6 +254,7 @@ Full docs: **[tejasghutukade.github.io/stageflow](https://tejasghutukade.github.
|
|
|
254
254
|
|-----|-------------|
|
|
255
255
|
| [docs/README.md](docs/README.md) | Documentation index |
|
|
256
256
|
| [docs/architecture.md](docs/architecture.md) | Runtime components, execution flow, persistence, and design decisions |
|
|
257
|
+
| [docs/hosted.md](docs/hosted.md) | Embed Stageflow from another application and receive ordered run events |
|
|
257
258
|
| [docs/quickstart.md](docs/quickstart.md) | Expanded quick start |
|
|
258
259
|
| [docs/yaml-catalog.md](docs/yaml-catalog.md) | Pipelines, stages, tasks schema |
|
|
259
260
|
| [docs/cli-reference.md](docs/cli-reference.md) | `sf init`, `sf run`, `sf run-stage`, `sf graph`, `sf validate`, `sf ui`, `sf mcp`, `sf envelope`, `sf export-run`, `sf artifact`, `sf skills`, `sf providers` |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type AdapterSpill = {
|
|
2
|
+
kind: "none";
|
|
3
|
+
} | {
|
|
4
|
+
kind: "full";
|
|
5
|
+
text: string;
|
|
6
|
+
sourcePath: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: "lost";
|
|
9
|
+
reason: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function acceptedAdapterSpillPath(candidate: string): Promise<string | undefined>;
|
|
12
|
+
export declare function readAdapterSpill(text: string, details: unknown): Promise<AdapterSpill>;
|
|
13
|
+
/** Removes a vetted spill file and its now-empty `pi-mcp-output-*` dir. */
|
|
14
|
+
export declare function discardAdapterSpill(sourcePath: string): Promise<void>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pi-mcp-adapter cuts MCP text output at its output-guard limit and writes the
|
|
3
|
+
* full text to `<tmpdir>/pi-mcp-output-*\/output-<hex>.txt`. When that happens
|
|
4
|
+
* the visible result is only a head preview, so the tool output budget reads
|
|
5
|
+
* the full body from the spill file instead. Only real files inside the OS
|
|
6
|
+
* temp dir with the adapter's naming are accepted.
|
|
7
|
+
*/
|
|
8
|
+
import { lstat, readFile, realpath, rmdir, unlink } from "node:fs/promises";
|
|
9
|
+
import { tmpdir } from "node:os";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { isInsideDir } from "../runstore/workspaceLayout.js";
|
|
12
|
+
const SPILL_DIR = /^pi-mcp-output-[A-Za-z0-9]+$/;
|
|
13
|
+
const SPILL_FILE = /^output-[0-9a-f]{8}\.txt$/;
|
|
14
|
+
const SAVED_NOTICE = /Full text saved to: (\S+) —/;
|
|
15
|
+
function outputGuardOf(details) {
|
|
16
|
+
if (details === null || typeof details !== "object")
|
|
17
|
+
return undefined;
|
|
18
|
+
const guard = details.outputGuard;
|
|
19
|
+
return guard !== null && typeof guard === "object"
|
|
20
|
+
? guard
|
|
21
|
+
: undefined;
|
|
22
|
+
}
|
|
23
|
+
export async function acceptedAdapterSpillPath(candidate) {
|
|
24
|
+
if (candidate.includes("\0") || !path.isAbsolute(candidate))
|
|
25
|
+
return undefined;
|
|
26
|
+
let real;
|
|
27
|
+
try {
|
|
28
|
+
const linked = await lstat(candidate);
|
|
29
|
+
if (!linked.isFile() && !linked.isSymbolicLink())
|
|
30
|
+
return undefined;
|
|
31
|
+
real = await realpath(candidate);
|
|
32
|
+
if (!(await lstat(real)).isFile())
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const tempRoot = await realpath(tmpdir());
|
|
39
|
+
if (!isInsideDir(real, tempRoot))
|
|
40
|
+
return undefined;
|
|
41
|
+
if (!SPILL_DIR.test(path.basename(path.dirname(real))))
|
|
42
|
+
return undefined;
|
|
43
|
+
if (!SPILL_FILE.test(path.basename(real)))
|
|
44
|
+
return undefined;
|
|
45
|
+
return real;
|
|
46
|
+
}
|
|
47
|
+
export async function readAdapterSpill(text, details) {
|
|
48
|
+
const guard = outputGuardOf(details);
|
|
49
|
+
if (guard?.truncated !== true) {
|
|
50
|
+
return { kind: "none" };
|
|
51
|
+
}
|
|
52
|
+
const candidates = [
|
|
53
|
+
typeof guard?.fullOutputPath === "string" ? guard.fullOutputPath : undefined,
|
|
54
|
+
SAVED_NOTICE.exec(text)?.[1],
|
|
55
|
+
].filter((candidate) => candidate !== undefined);
|
|
56
|
+
for (const candidate of new Set(candidates)) {
|
|
57
|
+
const source = await acceptedAdapterSpillPath(candidate);
|
|
58
|
+
if (source === undefined)
|
|
59
|
+
continue;
|
|
60
|
+
try {
|
|
61
|
+
return { kind: "full", text: await readFile(source, "utf8"), sourcePath: source };
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
kind: "lost",
|
|
69
|
+
reason: typeof guard?.writeError === "string"
|
|
70
|
+
? guard.writeError
|
|
71
|
+
: "the MCP adapter's full-output file was not available",
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** Removes a vetted spill file and its now-empty `pi-mcp-output-*` dir. */
|
|
75
|
+
export async function discardAdapterSpill(sourcePath) {
|
|
76
|
+
try {
|
|
77
|
+
await unlink(sourcePath);
|
|
78
|
+
await rmdir(path.dirname(sourcePath));
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// best-effort cleanup
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Known
|
|
2
|
+
* Known StagePort backend ids, and the config-hierarchy gate.
|
|
3
3
|
*
|
|
4
4
|
* Kept dependency-free (no adapter imports) so config loaders can validate
|
|
5
5
|
* `agent:` fields without pulling in the actual SDKs.
|
|
@@ -25,7 +25,7 @@ export type ParsedAgentField = {
|
|
|
25
25
|
export declare function parseAgentField(raw: unknown): ParsedAgentField;
|
|
26
26
|
/**
|
|
27
27
|
* Stage-level `agent` overrides are parsed and stored on StageConfig, but
|
|
28
|
-
* intentionally not consulted by
|
|
28
|
+
* intentionally not consulted by resolveStageBackend while this is false.
|
|
29
29
|
* Flip to true once per-stage selection is ready to ship; no other change
|
|
30
30
|
* needed to light it up.
|
|
31
31
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Known
|
|
2
|
+
* Known StagePort backend ids, and the config-hierarchy gate.
|
|
3
3
|
*
|
|
4
4
|
* Kept dependency-free (no adapter imports) so config loaders can validate
|
|
5
5
|
* `agent:` fields without pulling in the actual SDKs.
|
|
@@ -31,7 +31,7 @@ export function parseAgentField(raw) {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Stage-level `agent` overrides are parsed and stored on StageConfig, but
|
|
34
|
-
* intentionally not consulted by
|
|
34
|
+
* intentionally not consulted by resolveStageBackend while this is false.
|
|
35
35
|
* Flip to true once per-stage selection is ready to ship; no other change
|
|
36
36
|
* needed to light it up.
|
|
37
37
|
*/
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
1
|
+
import { type StagePort, type StageHandle, type StageRunInput, type StageRunResult } from "./port.js";
|
|
2
|
+
/**
|
|
3
|
+
* Provider error carried by a query() `result` message: an API error on a "success" result
|
|
4
|
+
* (`is_error` with the error text in `result`) or an error subtype with `errors`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function claudeResultError(message: {
|
|
7
|
+
subtype?: unknown;
|
|
8
|
+
is_error?: unknown;
|
|
9
|
+
result?: unknown;
|
|
10
|
+
errors?: unknown;
|
|
11
|
+
api_error_status?: unknown;
|
|
12
|
+
}): string | undefined;
|
|
13
|
+
export declare class ClaudeAgentAdapter implements StagePort {
|
|
3
14
|
openStage(input: StageRunInput): StageHandle;
|
|
4
15
|
runStage(input: StageRunInput): Promise<StageRunResult>;
|
|
5
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Claude Agent SDK implementation of
|
|
2
|
+
* Claude Agent SDK implementation of StagePort.
|
|
3
3
|
*
|
|
4
4
|
* One turn = one streaming-input `query()` call, spawned as a subprocess by
|
|
5
5
|
* the SDK. The session is sealed the same way Pi's sealed stage session is:
|
|
@@ -43,6 +43,7 @@ import { isAdvancingEnvelope } from "../envelope/check.js";
|
|
|
43
43
|
import { assertAnswerMatchesPrompt, parseAskOperatorAnswer, summarizeAnswer, } from "../tools/askOperator.js";
|
|
44
44
|
import { buildStageflowMcpServer, EMIT_STAGE_ENVELOPE_TOOL_NAME, STAGEFLOW_MCP_SERVER_NAME, WRITE_STAGE_ARTIFACT_TOOL_NAME, ASK_OPERATOR_TOOL_NAME, } from "./claudeTools.js";
|
|
45
45
|
import { createClaudeActivityMapper } from "./claudeActivity.js";
|
|
46
|
+
import { DEFAULT_EMIT_REMINDERS, emitReminderPrompt, formatProviderError } from "./stageTurnDriver.js";
|
|
46
47
|
import { readActivityVerbose } from "./activity.js";
|
|
47
48
|
import { composeStageUserPrompt } from "./piAdapter.js";
|
|
48
49
|
import { claudeSessionMarkerPath, clearClaudeSessionMarker, readClaudeSessionMarker, writeClaudeSessionMarker, } from "./claudeSession.js";
|
|
@@ -79,7 +80,10 @@ function preflight(input) {
|
|
|
79
80
|
}
|
|
80
81
|
return resolveClaudeModel(input.stage.model);
|
|
81
82
|
}
|
|
82
|
-
function resultFromCapture(capture) {
|
|
83
|
+
function resultFromCapture(capture, providerError) {
|
|
84
|
+
if (providerError !== undefined && !capture.envelope) {
|
|
85
|
+
return { ok: false, reason: `provider error: ${providerError}` };
|
|
86
|
+
}
|
|
83
87
|
if (capture.error && !capture.envelope) {
|
|
84
88
|
return { ok: false, reason: capture.error };
|
|
85
89
|
}
|
|
@@ -105,6 +109,20 @@ function failedPassedMcpConnect(resolved, listed) {
|
|
|
105
109
|
}
|
|
106
110
|
return undefined;
|
|
107
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Provider error carried by a query() `result` message: an API error on a "success" result
|
|
114
|
+
* (`is_error` with the error text in `result`) or an error subtype with `errors`.
|
|
115
|
+
*/
|
|
116
|
+
export function claudeResultError(message) {
|
|
117
|
+
if (message.subtype === "success") {
|
|
118
|
+
if (message.is_error !== true)
|
|
119
|
+
return undefined;
|
|
120
|
+
const status = typeof message.api_error_status === "number" ? ` (HTTP ${message.api_error_status})` : "";
|
|
121
|
+
return formatProviderError(`${typeof message.result === "string" ? message.result : ""}${status}`);
|
|
122
|
+
}
|
|
123
|
+
const errors = Array.isArray(message.errors) ? message.errors.filter((e) => typeof e === "string") : [];
|
|
124
|
+
return formatProviderError(errors.length > 0 ? errors.join("; ") : String(message.subtype ?? "error"));
|
|
125
|
+
}
|
|
108
126
|
/** Merge one query() call's per-model totals (this call's own turns only) into the stage-level accumulator. */
|
|
109
127
|
function mergeClaudeModelUsage(usage, modelUsage) {
|
|
110
128
|
if (!modelUsage)
|
|
@@ -184,6 +202,7 @@ async function runTurn(input, model, markerPath, promptText, resumeSessionId, us
|
|
|
184
202
|
input.onActivity?.({ event: "agent_start" });
|
|
185
203
|
input.onActivity?.({ event: "turn_start" });
|
|
186
204
|
let sessionId = resumeSessionId;
|
|
205
|
+
let providerError;
|
|
187
206
|
try {
|
|
188
207
|
const mcpServer = buildStageflowMcpServer({
|
|
189
208
|
capture: emitCapture,
|
|
@@ -266,6 +285,7 @@ async function runTurn(input, model, markerPath, promptText, resumeSessionId, us
|
|
|
266
285
|
console.error(`[claudeAdapter] main loop saw result: modelUsage=${JSON.stringify(message.modelUsage)}`);
|
|
267
286
|
}
|
|
268
287
|
mergeClaudeModelUsage(usage, message.modelUsage);
|
|
288
|
+
providerError = claudeResultError(message);
|
|
269
289
|
break;
|
|
270
290
|
}
|
|
271
291
|
}
|
|
@@ -285,7 +305,14 @@ async function runTurn(input, model, markerPath, promptText, resumeSessionId, us
|
|
|
285
305
|
return { kind: "waiting", sessionId: resolvedSessionId, request: askCapture.prompt };
|
|
286
306
|
}
|
|
287
307
|
await clearClaudeSessionMarker(markerPath);
|
|
288
|
-
|
|
308
|
+
const remind = emitCapture.envelope === undefined && providerError === undefined && sessionId !== undefined
|
|
309
|
+
? { sessionId, ...(emitCapture.error !== undefined ? { rejectedEmit: emitCapture.error } : {}) }
|
|
310
|
+
: undefined;
|
|
311
|
+
return {
|
|
312
|
+
kind: "completed",
|
|
313
|
+
result: { ...resultFromCapture(emitCapture, providerError), usage },
|
|
314
|
+
...(remind !== undefined ? { remind } : {}),
|
|
315
|
+
};
|
|
289
316
|
}
|
|
290
317
|
catch (err) {
|
|
291
318
|
if (askCapture.prompt !== undefined && sessionId !== undefined) {
|
|
@@ -350,6 +377,23 @@ export class ClaudeAgentAdapter {
|
|
|
350
377
|
let waiting;
|
|
351
378
|
let pendingAnswer;
|
|
352
379
|
const usage = emptyStageUsage();
|
|
380
|
+
/**
|
|
381
|
+
* While a turn ends on its own without an envelope, resume the same session with a short
|
|
382
|
+
* reminder turn, up to DEFAULT_EMIT_REMINDERS times. A reminder turn may itself park on
|
|
383
|
+
* ask_operator; a closed handle stops the loop.
|
|
384
|
+
*/
|
|
385
|
+
const withEmitReminders = async (first, model) => {
|
|
386
|
+
let outcome = first;
|
|
387
|
+
for (let attempt = 1; attempt <= DEFAULT_EMIT_REMINDERS; attempt++) {
|
|
388
|
+
if (closed || outcome.kind !== "completed" || outcome.remind === undefined)
|
|
389
|
+
break;
|
|
390
|
+
const reminder = emitReminderPrompt(EMIT_STAGE_ENVELOPE_TOOL_NAME, attempt, DEFAULT_EMIT_REMINDERS, outcome.remind.rejectedEmit);
|
|
391
|
+
// The Claude activity mapper does not echo prompts; show the reminder like Pi does.
|
|
392
|
+
input.onActivity?.({ event: "message", role: "user", text: reminder });
|
|
393
|
+
outcome = await runTurn(input, model, markerPath, reminder, outcome.remind.sessionId, usage);
|
|
394
|
+
}
|
|
395
|
+
return outcome;
|
|
396
|
+
};
|
|
353
397
|
const applyOutcome = (outcome) => {
|
|
354
398
|
if (outcome.kind === "waiting") {
|
|
355
399
|
waiting = { sessionId: outcome.sessionId, prompt: outcome.request };
|
|
@@ -403,7 +447,7 @@ export class ClaudeAgentAdapter {
|
|
|
403
447
|
return { status: "completed", result: { ok: false, reason: pre.reason } };
|
|
404
448
|
}
|
|
405
449
|
const outcome = await runTurn(input, pre.model, markerPath, resumePromptText(parsedAnswer), sessionId, usage);
|
|
406
|
-
return applyOutcome(outcome);
|
|
450
|
+
return applyOutcome(await withEmitReminders(outcome, pre.model));
|
|
407
451
|
}
|
|
408
452
|
const pre = preflight(input);
|
|
409
453
|
if (!pre.ok) {
|
|
@@ -421,10 +465,10 @@ export class ClaudeAgentAdapter {
|
|
|
421
465
|
};
|
|
422
466
|
}
|
|
423
467
|
const outcome = await runTurn(input, pre.model, markerPath, composeTimeoutResumePrompt(), marker.sessionId, usage);
|
|
424
|
-
return applyOutcome(outcome);
|
|
468
|
+
return applyOutcome(await withEmitReminders(outcome, pre.model));
|
|
425
469
|
}
|
|
426
470
|
const outcome = await runTurn(input, pre.model, markerPath, composeStageUserPrompt(input, EMIT_STAGE_ENVELOPE_TOOL_NAME, undefined, WRITE_STAGE_ARTIFACT_TOOL_NAME), undefined, usage);
|
|
427
|
-
return applyOutcome(outcome);
|
|
471
|
+
return applyOutcome(await withEmitReminders(outcome, pre.model));
|
|
428
472
|
},
|
|
429
473
|
deliverAnswer(answer) {
|
|
430
474
|
pendingAnswer = answer;
|
|
@@ -8,6 +8,9 @@ export declare function isCursorModelRef(modelRef: string): boolean;
|
|
|
8
8
|
export declare function workshopCursorBridgeHint(toolNames: readonly string[]): string;
|
|
9
9
|
export declare function cursorBridgePrompt(message: string, modelId: string | undefined, toolNames: readonly string[]): string;
|
|
10
10
|
export declare const cursorProviderSupport: StageProviderSupport;
|
|
11
|
+
export declare function cursorCredentialMissingReason(): string;
|
|
12
|
+
/** Publish the credential-root Cursor key onto the process for a cursor/* model. */
|
|
13
|
+
export declare function bindCursorApiKey(modelId: string): (() => void) | undefined;
|
|
11
14
|
export declare function readCursorApiKey(env?: NodeJS.ProcessEnv): string | undefined;
|
|
12
15
|
export declare function getCursorHostStatus(env?: NodeJS.ProcessEnv): {
|
|
13
16
|
cursorSdkReady: boolean;
|
|
@@ -9,9 +9,8 @@ import { createRequire } from "node:module";
|
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { readSecretFromEnvOrFile } from "../config/secretFromEnvOrFile.js";
|
|
12
|
-
import { globalStageflowHome } from "../project/globalHome.js";
|
|
12
|
+
import { globalCredentialRoot, globalStageflowHome, } from "../project/globalHome.js";
|
|
13
13
|
import { registerProviderSupport, } from "./providerSupport.js";
|
|
14
|
-
import { stageflowAgentAuthPath } from "../runtime/credentialBinding.js";
|
|
15
14
|
const CURSOR_SETTING_SOURCES_ENV = "PI_CURSOR_SETTING_SOURCES";
|
|
16
15
|
/**
|
|
17
16
|
* Locate the pi-cursor-sdk extension entry without opening full global package
|
|
@@ -25,13 +24,13 @@ const CURSOR_SETTING_SOURCES_ENV = "PI_CURSOR_SETTING_SOURCES";
|
|
|
25
24
|
* (`dist/index.js` for 0.3+, `src/index.ts` for older publishes)
|
|
26
25
|
* 5. Sibling checkout at ../pi-cursor-sdk relative to this repo
|
|
27
26
|
*
|
|
28
|
-
* A stage worker's HOME is an empty attempt directory
|
|
29
|
-
*
|
|
27
|
+
* A stage worker's HOME is an empty attempt directory. Package lookup uses
|
|
28
|
+
* $STAGEFLOW_HOME/agent, not the credential root.
|
|
30
29
|
*/
|
|
31
30
|
const CURSOR_PACKAGE_ENTRIES = ["dist/index.js", "src/index.ts"];
|
|
32
31
|
/** Stageflow agent dir ($STAGEFLOW_HOME/agent). Stage workers must not use os.homedir(): HOME is the attempt dir. */
|
|
33
32
|
function piAgentDir() {
|
|
34
|
-
return path.
|
|
33
|
+
return path.join(globalStageflowHome(), "agent");
|
|
35
34
|
}
|
|
36
35
|
export function cursorExtensionEntryInPackage(packageRoot) {
|
|
37
36
|
for (const rel of CURSOR_PACKAGE_ENTRIES) {
|
|
@@ -142,6 +141,24 @@ export const cursorProviderSupport = {
|
|
|
142
141
|
},
|
|
143
142
|
};
|
|
144
143
|
const CURSOR_API_KEY_FILE_NAME = "cursor-api-key";
|
|
144
|
+
export function cursorCredentialMissingReason() {
|
|
145
|
+
return "Cursor API key is missing from the credential root. Configure credentials via `sf providers` / the operator console Providers page, then retry.";
|
|
146
|
+
}
|
|
147
|
+
/** Publish the credential-root Cursor key onto the process for a cursor/* model. */
|
|
148
|
+
export function bindCursorApiKey(modelId) {
|
|
149
|
+
if (!isCursorModelRef(modelId))
|
|
150
|
+
return undefined;
|
|
151
|
+
const key = readCursorApiKey();
|
|
152
|
+
if (!key) {
|
|
153
|
+
throw new Error(cursorCredentialMissingReason());
|
|
154
|
+
}
|
|
155
|
+
if (process.env.CURSOR_API_KEY?.trim())
|
|
156
|
+
return undefined;
|
|
157
|
+
process.env.CURSOR_API_KEY = key;
|
|
158
|
+
return () => {
|
|
159
|
+
delete process.env.CURSOR_API_KEY;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
145
162
|
export function readCursorApiKey(env = process.env) {
|
|
146
163
|
let fromEnv;
|
|
147
164
|
try {
|
|
@@ -153,7 +170,7 @@ export function readCursorApiKey(env = process.env) {
|
|
|
153
170
|
if (fromEnv !== undefined && fromEnv.trim() !== "") {
|
|
154
171
|
return fromEnv.trim();
|
|
155
172
|
}
|
|
156
|
-
const filePath = path.join(
|
|
173
|
+
const filePath = path.join(globalCredentialRoot(), "agent", CURSOR_API_KEY_FILE_NAME);
|
|
157
174
|
if (!existsSync(filePath)) {
|
|
158
175
|
return undefined;
|
|
159
176
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StageRoots } from "../runtime/stageRoots.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { StagePort, OpaqueAnswer, OpaqueWaitRequest, StageHandle, StageRunInput, StageRunResult } from "./port.js";
|
|
3
3
|
export type FakeAgentBehavior = {
|
|
4
4
|
type: "emit";
|
|
5
5
|
envelope: unknown;
|
|
@@ -17,7 +17,7 @@ export type FakeAgentBehavior = {
|
|
|
17
17
|
};
|
|
18
18
|
export type RecordedStageRoots = StageRoots;
|
|
19
19
|
export declare function fakeHitlResumePath(roots: Pick<StageRoots, "runWorkspaceDir">, stageId: string): string;
|
|
20
|
-
export declare class FakeAgent implements
|
|
20
|
+
export declare class FakeAgent implements StagePort {
|
|
21
21
|
private readonly behavior;
|
|
22
22
|
lastRoots?: RecordedStageRoots;
|
|
23
23
|
receivedAnswers: OpaqueAnswer[];
|
|
@@ -25,6 +25,6 @@ export declare class FakeAgent implements AgentPort {
|
|
|
25
25
|
openStage(input: StageRunInput): StageHandle;
|
|
26
26
|
runStage(input: StageRunInput): Promise<StageRunResult>;
|
|
27
27
|
}
|
|
28
|
-
export declare function scriptedFakeAgent(behaviors: FakeAgentBehavior[]):
|
|
28
|
+
export declare function scriptedFakeAgent(behaviors: FakeAgentBehavior[]): StagePort & {
|
|
29
29
|
recorded: RecordedStageRoots[];
|
|
30
30
|
};
|
package/dist/agent/fakeAgent.js
CHANGED
|
@@ -113,12 +113,6 @@ export class FakeAgent {
|
|
|
113
113
|
armWait();
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
if (sessionMode === "feedback_resume" && behavior.type === "wait_then_emit") {
|
|
117
|
-
behavior = {
|
|
118
|
-
type: "emit",
|
|
119
|
-
envelope: behavior.envelope,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
116
|
const emitStartActivity = () => {
|
|
123
117
|
if (started)
|
|
124
118
|
return;
|
|
@@ -3,7 +3,7 @@ import type { StageRoots } from "../runtime/stageRoots.js";
|
|
|
3
3
|
import { type AskOperatorPrompt, type AskOperatorWaitBridge } from "../tools/askOperator.js";
|
|
4
4
|
import "./cursorProvider.js";
|
|
5
5
|
import { type StageActivityObserver } from "./activityObserver.js";
|
|
6
|
-
import type {
|
|
6
|
+
import type { StagePort, OpaqueAnswer, StageHandle, StageHandleCloseOptions, StageRunInput, StageRunResult } from "./port.js";
|
|
7
7
|
import type { StageGateKind } from "../types/stage.js";
|
|
8
8
|
import { type StageUsage } from "../types/usage.js";
|
|
9
9
|
import { STAGEFLOW_PATH_DENIED } from "../runstore/workspaceLayout.js";
|
|
@@ -133,7 +133,7 @@ export type ReconstructedStageSession = {
|
|
|
133
133
|
* Does not auto-continue the model turn — U4 owns the yield loop.
|
|
134
134
|
*/
|
|
135
135
|
export declare function reconstructStageSessionForAnswer(input: StageRunInput, answer: OpaqueAnswer): Promise<ReconstructedStageSession>;
|
|
136
|
-
export declare class PiAgentAdapter implements
|
|
136
|
+
export declare class PiAgentAdapter implements StagePort {
|
|
137
137
|
openStage(input: StageRunInput): StageHandle;
|
|
138
138
|
runStage(input: StageRunInput): Promise<StageRunResult>;
|
|
139
139
|
}
|