Repository navigation
Conversation
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Test against a Context Mill branch:
Add Results will be posted here when complete. |
Base automatically changed from
posthog/functional-c2a-tui
to
posthog/functional-c1-move
September 27, 2026 15:19
gewenyu99
force-pushed
the
posthog/functional-c2b-headless
branch
from
September 27, 2026 15:24
fd1b0b8 to
25fc53d
Compare
gewenyu99
changed the base branch from
posthog/functional-c1-move
to
posthog/functional-c2a-tui
September 27, 2026 15:26
gewenyu99
added this pull request to stack #1372
September 27, 2026 15:28
The hosts call runProgram and return exit codes the CLI applies; tools leave the programs; WizardUI and the global sinks are gone. Test edits this change needs ride with it. Generated-By: PostHog Desktop Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
gewenyu99
force-pushed
the
posthog/functional-c2b-headless
branch
from
September 29, 2026 03:42
25fc53d to
bc68897
Compare
This was referenced Sep 29, 2026
| polls.signal.removeEventListener('abort', finish); | ||
| resolve(readState()); | ||
| }; | ||
| const timer = setTimeout(finish, timeoutMs); |
| intro: (message) => console.log(`┌ ${message}`), | ||
| outro: (message) => console.log(`└ ${message}`), | ||
| log: { | ||
| info: (message) => console.log(`│ ${message}`), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The contracts in #1369 have no code behind them. On main, one process-wide
WizardUIcarries the debug output, the prompts and the abort screen for every layer. The CLI runs programs from several places, program steps name TUI screens, tools run as programs, and screens, programs and shared code can all end the process. A program cannot run without a UI, and a change to one host can break the other.Changes
This PR adds the code behind the #1369 contracts. The CLI calls one of two hosts, each host builds its own session store and calls
runProgram, andrunProgramcallsrunAgent. The programs, agent and shared core and the hosts do not compile apart, so they land together, with the test edits this PR needs to stay green.runProgram(src/programs/run-program.ts) runs a registered program on the caller's store: detection throughdetectProgramwhen the store has none, readiness,logIn, each host step throughworkflow.confirmStep, then eachrunAgentcall. Every result lands in the store, and the store ends settled even when the call rejects.SessionStore(src/programs/session/session-store.ts) holds the launch values, detection, the login, thebindingthe agent resolved and the run's progress.sessionControlTargetserves the control API from it.runTui(src/tui/run.ts) andrunTuiTool(src/tui/run-tool.ts).WizardStore(src/tui/store.ts) sits over the session store with the TUI-onlyTuiState(src/tui/tui-state.ts).tuiWorkflowconfirms steps from the screens, and a screen ends the run withstore.requestExit(code). Each program's screens live insrc/tui/programs/<id>, found bygetTuiProgram.runHeadless(src/headless/run.ts) builds its ownSessionStore, prints log lines throughLoggingUI, streams the task state, and serves the control API throughserveHeadlessControl. It loads no TUI module.src/host:wizardAborttakes itsAbortPresenterfrom the caller,startHostExitresolves each host's exit code, andsrc/host/controlholdsControlClientandRunLedger.src/tools, apart from programs:addMcpServer,removeMcpServer,runMcpPrompt,runDoctorReport,runProvision,runCliAddandlistSkills. Their screens live insrc/tui/tools/<id>, and MCP client installs insrc/shared/mcp-clients/install.ts. No program imports@tools.runWizard,runWizardCIandrunWizardHeadlessinsrc/cli/runnersstart the hosts.underSignalsaborts the run on SIGINT or SIGTERM, andexitWithturns the host's code into the exit. Insrc, only the CLI callsprocess.exit.resolveRunConfig(src/agent/runner/switchboard/resolve-run.ts) turns aRunConfiginto theResolvedRunConfigthe runner reads.tsdown.config.tsgains thePUBLISH_LIBRARYswitch, off. The package still ships thewizardbin only.WizardUI,src/ui,src/lib,src/steps,src/commands, the old programsteps.tsfiles,run-agent-legacy.ts,agent-runner.ts, and the architecture test with its allowlist. build: C2d — fence every layer with TypeScript project references #1315 fences the layers with the compiler.What calls what, on this PR's code (the diagram #1371 adds to the README):
%%{init: {"block": {"padding": 20}}}%% block-beta columns 18 user["a user at a terminal"]:3 ci["CI or a sandbox"]:3 embedder["your program"]:3 space:3 toolUser["a user or a script"]:3 caller["your code or a test"]:3 cliBand["src/cli picks a host, owns the signals and the exit"]:6 space:12 runWizard["runWizard"]:3 runWizardCI["runWizardCI<br/>runWizardHeadless"]:3 space:6 toolCmd["src/cli<br/>a tool's command"]:3 space:3 hostBand["src/tui · src/headless the two hosts"]:6 space:12 runTui["runTui"]:3 runHeadless["runHeadless"]:3 space:6 runTool["runTuiTool<br/>or an @tools runner"]:3 space:3 wizardStore["WizardStore<br/>display over the store"]:3 space:15 programsBand["@programs"]:12 space:6 tuiStore["SessionStore"]:3 headlessStore["SessionStore"]:3 ownStore["SessionStore"]:3 detect["detectProjectsWithAgent"]:3 space:6 tuiRun["runProgram"]:3 headlessRun["runProgram"]:3 ownRun["runProgram"]:3 space:9 agentBand["@agent"]:18 tuiAgent["runAgent"]:3 headlessAgent["runAgent"]:3 ownAgent["runAgent"]:3 detectAgent["runAgent"]:3 mcpStream["streamMcpPrompt"]:3 callerAgent["runAgent"]:3 user --> runWizard runWizard --> runTui runTui --> wizardStore wizardStore --> tuiStore tuiStore --> tuiRun tuiRun --> tuiAgent ci --> runWizardCI runWizardCI --> runHeadless runHeadless --> headlessStore headlessStore --> headlessRun headlessRun --> headlessAgent embedder -- "builds and owns the store" --> ownStore ownStore --> ownRun ownRun --> ownAgent detect --> detectAgent toolUser --> toolCmd toolCmd --> runTool runTool -- "the MCP tutorial only" --> mcpStream caller -- "runAgent(config, input)" --> callerAgent classDef code fill:#3b82f626,stroke:#3b82f6,stroke-width:2px classDef ext fill:none,stroke:#9ca3af,stroke-dasharray:4 3 classDef band fill:#3b82f640,stroke:none class runWizard,runWizardCI,runTui,runHeadless,wizardStore,tuiStore,headlessStore,ownStore,tuiRun,headlessRun,ownRun,tuiAgent,headlessAgent,ownAgent,detect,detectAgent,toolCmd,runTool,mcpStream,callerAgent code class user,ci,embedder,toolUser,caller ext class cliBand,hostBand,programsBand,agentBand bandStack: #1311 moves, #1369 contracts, #1313 logic, #1370 tests, #1315 fences, #1371 docs
Test plan
On this tree, which holds #1369:
pnpm typecheck: 0 errors.vitest run: 3,260 tests pass.pnpm lint: 0 errors.Proof on the final code of the stack (#1371), against a local PostHog stack:
posthog-integrationon a one-file Node app: exit 0, SDK installed.npx tsx --tsconfig tsconfig.json docs/examples/run-agent-quack.ts: replies "quack", outcome success.npx tsx --tsconfig tsconfig.json docs/examples/run-program-quack.ts: replies "quack", outcome success, ends at phase completed.Created with PostHog Desktop