@nathanstephenson/flow 0.1.7 → 0.1.9-beta.1
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 +122 -640
- package/build/backend-worker-chunks/chunk-J2DBNTL7.mjs +94 -0
- package/build/backend-worker-chunks/chunk-MLOUI3ZM.mjs +19752 -0
- package/build/backend-worker-chunks/chunk-UQDH2COY.mjs +15296 -0
- package/build/backend-worker-chunks/claude-GTW5KHY5.mjs +30778 -0
- package/build/backend-worker-chunks/pi-M4OA2FGL.mjs +5730 -0
- package/build/backend-worker.mjs +4401 -0
- package/dist/backend/fake/index.js +2 -0
- package/dist/backend/mcp.js +34 -15
- package/dist/backend/pi/state.js +18 -0
- package/dist/backend/registry.js +2 -1
- package/dist/backend/worker/claude-state.js +24 -3
- package/dist/backend/worker/entry.js +70 -13
- package/dist/backend/worker/frames.js +34 -0
- package/dist/backend/worker/index.js +139 -16
- package/dist/backend/worker/launcher.js +22 -3
- package/dist/backend/worker/sandbox-mcp.js +86 -0
- package/dist/build-id +1 -1
- package/dist/cli/bootstrap.js +7 -6
- package/dist/cli/install-guard.js +1 -1
- package/dist/cli/main.js +3 -6
- package/dist/cli/update.js +3 -3
- package/dist/cli/web-update.js +9 -6
- package/dist/client/connection.js +5 -2
- package/dist/client/diff.js +6 -9
- package/dist/client/reduce.js +19 -0
- package/dist/client/tool-chains.js +12 -4
- package/dist/daemon/config-store.js +21 -14
- package/dist/daemon/config.js +48 -5
- package/dist/daemon/git.js +47 -0
- package/dist/daemon/host.js +208 -29
- package/dist/daemon/models.js +27 -24
- package/dist/daemon/release-checker.js +48 -34
- package/dist/daemon/runtime.js +10 -4
- package/dist/daemon/server.js +13 -1
- package/dist/daemon/shell.js +2 -1
- package/dist/daemon/skills.js +34 -31
- package/dist/daemon/summariser.js +33 -14
- package/dist/daemon/timings.js +14 -0
- package/dist/daemon/workflow-authoring-scope-checks.js +5 -8
- package/dist/daemon/workflow-authoring-scope-reader.js +20 -9
- package/dist/daemon/workflow-builder-files.js +5 -5
- package/dist/daemon/workflow-builder-guidance.js +3 -3
- package/dist/daemon/workflow-builder-reader.js +21 -10
- package/dist/daemon/workflow-builder.js +66 -8
- package/dist/daemon/workflow-executions.js +10 -10
- package/dist/daemon/workflow-mcp-authoring-routes.js +18 -6
- package/dist/daemon/workflow-mcp-authoring.js +44 -20
- package/dist/isolation/filesystem.js +8 -9
- package/dist/isolation/sandbox-supervisor.js +50 -0
- package/dist/isolation/sandbox.js +165 -0
- package/dist/isolation/shared-sandbox.js +77 -0
- package/dist/workflows/executors.js +16 -4
- package/dist/workflows/json-schema.js +14 -4
- package/package.json +7 -4
- package/web/dist/assets/index-DRfeO6GJ.js +40 -0
- package/web/dist/assets/index-DgQFpKbn.css +2 -0
- package/web/dist/assets/settings-mcp-Clp_jMWW.js +1 -0
- package/web/dist/assets/settings-secrets-BIO_hXZ1.js +1 -0
- package/web/dist/assets/settings-workflows-H-6eCff3.js +23 -0
- package/web/dist/assets/switch-DIogWclb.js +1 -0
- package/web/dist/assets/workflow-api-BfExddae.js +6 -0
- package/web/dist/assets/workflow-editors-CsbVx4WJ.js +139 -0
- package/web/dist/assets/workflows-Bv0sj7d0.js +7 -0
- package/web/dist/assets/workflows-pane-DHm44w7P.js +1 -0
- package/web/dist/index.html +5 -5
- package/web/dist/assets/index-DxTV-TYZ.js +0 -38
- package/web/dist/assets/index-jwsr3cpu.css +0 -2
- package/web/dist/assets/input-BOuBzJVY.js +0 -6
- package/web/dist/assets/settings-mcp-D-jWezcS.js +0 -1
- package/web/dist/assets/settings-secrets-DdQ0eujd.js +0 -1
- package/web/dist/assets/settings-workflows-BCzYKkOk.js +0 -23
- package/web/dist/assets/switch-B0hMd_dH.js +0 -1
- package/web/dist/assets/workflow-editors-CDZqnDvT.js +0 -137
- package/web/dist/assets/workflows-BpPNiK-H.js +0 -7
- package/web/dist/assets/workflows-pane-N3Vf30Cb.js +0 -1
package/README.md
CHANGED
|
@@ -1,693 +1,175 @@
|
|
|
1
1
|
# Flow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Flow runs coding-agent sessions. You can watch and control them from a terminal or a browser.
|
|
4
4
|
|
|
5
|
-
- **Local mode (v1)** — a Session Host daemon on loopback
|
|
5
|
+
- **Local mode (v1)** — a Session Host daemon runs on loopback. A TUI and a web UI are equal clients.
|
|
6
6
|
- **Backends** — the Claude Agent SDK (on your own Claude subscription) and the pi SDK (for models
|
|
7
|
-
Claude
|
|
7
|
+
that Claude does not serve). You choose the backend for each Agent Session.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
[CONTEXT.md](./CONTEXT.md) defines the domain language. [docs/adr](./docs/adr) records the decisions.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Contents
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
- [Requirements](#requirements)
|
|
14
|
+
- [Install](#install)
|
|
15
|
+
- [First run](#first-run)
|
|
16
|
+
- [Backends and credentials](#backends-and-credentials)
|
|
17
|
+
- [Everyday use](#everyday-use)
|
|
18
|
+
- [Where state lives](#where-state-lives)
|
|
19
|
+
- [Updating Flow](#updating-flow)
|
|
20
|
+
- [More documentation](#more-documentation)
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
npm install --global @nathanstephenson/flow
|
|
18
|
-
flow --version
|
|
19
|
-
flow serve
|
|
20
|
-
```
|
|
22
|
+
## Requirements
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`flow serve restart` only restarts a background-owned host, with its saved address, port and working
|
|
27
|
-
directory. A port of `0` stays dynamic. Restart requires the same OIDC configuration.
|
|
28
|
-
|
|
29
|
-
Stop and restart refuse active work unless you pass `--force`. Force interrupts work gracefully;
|
|
30
|
-
it does not kill the process. Agent Sessions become Dormant and their transcripts remain on disk.
|
|
31
|
-
A TUI attaches to an existing host without stopping it on exit. If the TUI creates its own host,
|
|
32
|
-
that host stops when the TUI exits. One-shot prompts refuse an occupied state root.
|
|
33
|
-
Each `FLOW_STATE_DIR` permits one host. Background output is saved in its private `host.log`.
|
|
34
|
-
If shutdown cannot finish within its deadline, Flow reports failure and retains ownership;
|
|
35
|
-
do not start another host against that state directory. Inspect the log and resolve the stalled
|
|
36
|
-
operation before attempting recovery.
|
|
37
|
-
Configure credentials for the Backend Adapter you use.
|
|
38
|
-
|
|
39
|
-
Claude and Pi Backend Sessions run in owned workers in **both** filesystem modes. Machine-wide
|
|
40
|
-
**Settings → General → Filesystem isolation** defaults to ON when a real Linux Bubblewrap launch
|
|
41
|
-
check succeeds, and **UNRESTRICTED** when enforcement is unsupported or unavailable (including on
|
|
42
|
-
macOS, missing Bubblewrap or unavailable namespaces). Settings shows the support reason and a
|
|
43
|
-
clear unrestricted warning. The initial automatic choice is latched for the Session Host's lifetime.
|
|
44
|
-
|
|
45
|
-
When isolation is enabled, Bubblewrap makes the host filesystem read-only, with writable mounts
|
|
46
|
-
only for the selected Scope, dedicated backend state and private scratch. Subagents and Background
|
|
47
|
-
Calls inherit that boundary. Local Workflow Shell and TypeScript steps and local stdio MCP servers
|
|
48
|
-
receive the policy too. One boundary covers the local supervisor, QuickJS worker and all Shell
|
|
49
|
-
descendants; its inherited PID namespace enforces cleanup even for detached processes. Local code
|
|
50
|
-
steps require host Node 22 or later; `workflowRuntime` Settings contain only an optional absolute
|
|
51
|
-
`nodePath` override. HTTP MCP and network access are unchanged in either mode.
|
|
52
|
-
|
|
53
|
-
For Linux enforcement, install Bubblewrap (for example, `sudo apt install bubblewrap`) with
|
|
54
|
-
descriptor-backed bind mounts (`--bind-fd` and `--ro-bind-fd`) to pin mount sources, and working
|
|
55
|
-
user, mount and PID namespaces. **Explicit enable fails closed**: unavailable enforcement, unsafe
|
|
56
|
-
Scopes and failed restricted launches refuse work, never silently downgrading to unrestricted.
|
|
57
|
-
After installing or fixing enforcement, restart the Session Host to refresh its automatic choice.
|
|
58
|
-
|
|
59
|
-
With isolation off, Scope is only a working directory. Agent tools, Shell commands and local stdio
|
|
60
|
-
MCP servers can read, write or delete elsewhere as the host user, including credentials and Flow
|
|
61
|
-
state. Detached processes lack PID-namespace containment. QuickJS, closed compilation and scoped
|
|
62
|
-
filesystem APIs still restrict direct TypeScript guest access, but Shell and the trusted Node
|
|
63
|
-
supervisor have unrestricted host authority, not an OS-enforced boundary.
|
|
64
|
-
|
|
65
|
-
The Session Host retains transcripts and authorisation; worker failure interrupts rather than replays
|
|
66
|
-
work. Neither mode protects Scope from damage or fully mediates pre-existing hard links and data
|
|
67
|
-
aliases. See [the policy and its limits](docs/adr/0028-local-model-work-has-a-fail-closed-filesystem-boundary.md).
|
|
68
|
-
|
|
69
|
-
To check a release from source, run `npm ci` and `npm run test:package`.
|
|
70
|
-
This builds, packs, and installs the archive into a temporary prefix, then checks it
|
|
71
|
-
from an unrelated directory. Build outputs are not tracked in Git.
|
|
72
|
-
|
|
73
|
-
The `prepack` script builds the CLI, web client, and Workflow runtime; users do not need to build them.
|
|
74
|
-
|
|
75
|
-
### Releases
|
|
76
|
-
|
|
77
|
-
Publish the first version manually from a clean, tested `main` checkout, after choosing a license:
|
|
78
|
-
`npm ci`, `npm run test:package`, `npm login`, then `npm publish --access public`.
|
|
79
|
-
Next, configure npm Trusted Publishing for owner `nathanstephenson`, repository `flow`, and
|
|
80
|
-
workflow filename `publish.yml` (GitHub Actions), with direct `npm publish` allowed.
|
|
81
|
-
No npm token secret is used.
|
|
82
|
-
|
|
83
|
-
For later releases, update `package.json` and both lockfile version fields through a PR, merge it,
|
|
84
|
-
then push a matching stable tag such as `v0.1.1` on that `main` commit. The publish workflow
|
|
85
|
-
rejects tags outside `main`, prerelease tags, and mismatched versions. It builds and tests one
|
|
86
|
-
archive without publishing credentials, then publishes that exact archive with OIDC and provenance.
|
|
87
|
-
Protect `main` and release-tag creation in GitHub. Tag creation is the release approval;
|
|
88
|
-
do not tag a version until its license and release contents are approved.
|
|
24
|
+
- Node.js 22 or later, and npm. CI checks installs on Linux and macOS.
|
|
25
|
+
- A user-owned npm prefix, for example from a Node version manager. Do not use sudo or a shared
|
|
26
|
+
system prefix.
|
|
27
|
+
- For filesystem isolation on Linux: Bubblewrap. See [docs/isolation.md](docs/isolation.md).
|
|
89
28
|
|
|
90
|
-
##
|
|
91
|
-
|
|
92
|
-
Run `flow update` to install `@nathanstephenson/flow@latest` with the npm selected by PATH.
|
|
93
|
-
An authorised browser connected to a background or configured systemd-owned Session Host can perform the same guarded operation
|
|
94
|
-
from **Settings → General → Flow update** after explicit confirmation. The browser checks only npm's
|
|
95
|
-
stable `latest` tag, cannot select a package/version/path or force active work to stop, and reconnects
|
|
96
|
-
on the same address and port to verify the running version. Updates are never automatic.
|
|
97
|
-
|
|
98
|
-
The global prefix must match this exact installation. Only user-owned prefixes without group or
|
|
99
|
-
other write access are supported; their ancestor directories must also prevent replacement by other users. Source, npm-link, root/sudo, shared prefixes, and SEA self-update
|
|
100
|
-
are not supported. Ordinary commands still work for these installations. Update shared or system
|
|
101
|
-
installations manually with npm after stopping all Flow processes.
|
|
102
|
-
|
|
103
|
-
Close all CLI/TUI clients and stop other Session Hosts that use this installation, including those
|
|
104
|
-
under other `FLOW_STATE_DIR` roots. The selected root's background Session Host can stay running:
|
|
105
|
-
Flow stops it, updates, and restores its saved address, port, working directory and OIDC settings
|
|
106
|
-
with a new process. Use `--force` to interrupt active work. Unmanaged foreground and embedded hosts are refused.
|
|
107
|
-
For foreground systemd services (including system units with `User=agent`), see
|
|
108
|
-
[systemd update setup](docs/systemd-updates.md): a separate non-root updater unit retains service ownership
|
|
109
|
-
and needs only narrowly scoped start/stop authority configured once by an administrator.
|
|
110
|
-
The same OIDC configuration must be present when you update. No version argument is accepted.
|
|
111
|
-
|
|
112
|
-
Before first adopting this release, stop **all** older Flow processes. Old processes have no
|
|
113
|
-
installation lease and cannot be reliably detected. External `npm install` commands do not honor
|
|
114
|
-
Flow's guard: never run them while Flow is active or an update is in progress.
|
|
115
|
-
|
|
116
|
-
For eligible private installations, the guard registers every CLI process before loading application
|
|
117
|
-
code. Registry errors or changed permissions on an already guarded installation prevent startup;
|
|
118
|
-
they do not disable the guard. It blocks new
|
|
119
|
-
starts across state roots until update and restoration finish. Use `flow`, not `dist/cli/main.js`.
|
|
120
|
-
On failure, Flow attempts to reinstall the previous exact version and restore the host. This is
|
|
121
|
-
best-effort recovery, not preservation of the old package files. A failed update exits nonzero,
|
|
122
|
-
even if recovery succeeds. npm's process group must stop before verification or rollback;
|
|
123
|
-
uncertain termination retains the recovery barrier. Lifecycle scripts that detach into another
|
|
124
|
-
process group are not supported. An unchanged version is reported as unchanged. Restored Session Host
|
|
125
|
-
output is kept in the selected state root's private `host.log`.
|
|
126
|
-
|
|
127
|
-
If the updater dies or recovery fails, startup stays blocked. The error names
|
|
128
|
-
`<prefix>/.flow-installations/<slot>/update.json`. Do not remove it while an updater, npm child,
|
|
129
|
-
or Flow process might still run. Stop them all; use the matching npm to run
|
|
130
|
-
`npm install --global --prefix <prefix> @nathanstephenson/flow@<previous>` (the record stores
|
|
131
|
-
`previous`). Check the package name/version, `dist/build-id`, and bundled `dist/cli/bootstrap.js`
|
|
132
|
-
against a trusted package archive. Only after repair is complete, remove that `update.json`,
|
|
133
|
-
run `flow --version`, and start the Session Host again. Do not delete a live registry mutex.
|
|
134
|
-
|
|
135
|
-
## Publish branch names
|
|
136
|
-
|
|
137
|
-
Publish offers an editable branch name before the first push. It uses the Summary Model
|
|
138
|
-
when configured, with a local fallback otherwise. Confirmation creates a feature branch
|
|
139
|
-
from the default branch, or renames an unpublished branch. Published branches and registered
|
|
140
|
-
stack branches keep their names. No branch changes happen while preparing the review.
|
|
141
|
-
|
|
142
|
-
## Stacked pull requests
|
|
143
|
-
|
|
144
|
-
The browser's Git tab uses `github/gh-stack` directly (tested with v0.1.1).
|
|
145
|
-
Install it on the Session Host with `gh extension install github/gh-stack` and
|
|
146
|
-
authenticate with `gh auth login`. Ordinary Git controls remain available without it.
|
|
147
|
-
|
|
148
|
-
Stack supports Create, Add, Switch, Submit, Sync, and Rebase. Create is offered only
|
|
149
|
-
for a clear chain of at least two existing local branches linked by PR head/base relationships.
|
|
150
|
-
Commit ancestry alone does not identify a stack. Merged members retain their status.
|
|
151
|
-
Create registers the displayed branches; it never accepts names for new branches.
|
|
152
|
-
Ambiguous chains and branches already tracked in a stack are not offered.
|
|
153
|
-
Switching and mutations
|
|
154
|
-
require no working Agent Session in the same Scope, including background work.
|
|
155
|
-
Except for conflict continuation and abort, the working tree must be clean; Flow never
|
|
156
|
-
stashes changes. Use Publish for uncommitted files; stack branches use their active
|
|
157
|
-
parent as the review base and the base for new PRs. Switch only selects local stack
|
|
158
|
-
branches, including numeric branch names.
|
|
159
|
-
|
|
160
|
-
Submit and Sync require a fresh review of the affected branches and PRs. Submit uses
|
|
161
|
-
`gh stack submit --auto`: new PRs are drafts; existing draft states do not change.
|
|
162
|
-
Sync checks remote stack membership at review and confirmation, then fetches,
|
|
163
|
-
rebases, and pushes. If membership differs, reconcile it with `gh stack` outside
|
|
164
|
-
Flow and review again. API failures block Sync. The CLI cannot lock remote membership;
|
|
165
|
-
changes after the final check remain a race. After a Sync conflict, use Rebase to resolve it
|
|
166
|
-
locally, then confirm Sync again. No retry or push happens automatically.
|
|
167
|
-
|
|
168
|
-
A paused Rebase shows conflict files, Continue, and Abort. **Ask agent to fix, then
|
|
169
|
-
continue** sends a normal message to the current Agent Session to resolve and stage
|
|
170
|
-
conflicts, then use `gh stack rebase --continue` only when resolved. It does not grant
|
|
171
|
-
permission to publish, push, sync, or merge. Review the result and refresh Stack.
|
|
172
|
-
Merge and stack restructuring are not exposed.
|
|
173
|
-
|
|
174
|
-
**Copy stack** copies PR titles as formatted links, from top to bottom. **Copy PR link**
|
|
175
|
-
copies one PR. Plain-text paste contains titles only.
|
|
176
|
-
|
|
177
|
-
## Status
|
|
178
|
-
|
|
179
|
-
**M0 (walking skeleton) complete.** The Claude adapter drives real sessions end to end; the Session
|
|
180
|
-
Host, Presentation Transcript, and shared reducer are in place behind the Backend Adapter contract.
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
npm start -- --backend claude "Use Glob to list *.json here, then say DONE"
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
Verified along the way:
|
|
187
|
-
|
|
188
|
-
- **Spike 0** — the Agent SDK works on subscription credentials with no `ANTHROPIC_API_KEY`, and
|
|
189
|
-
with every `CLAUDE*` variable scrubbed from the child environment (`spikes/subscription-auth.ts`).
|
|
190
|
-
- **Streaming input never self-initialises.** `query()` emits nothing until the input stream yields
|
|
191
|
-
its first message, so a Backend Adapter must not await the init message before returning — it
|
|
192
|
-
deadlocks. Capabilities therefore arrive late, via `capabilities_changed`.
|
|
193
|
-
- **`bypassPermissions` shadows `canUseTool`.** Pre-approved tools are expressed as
|
|
194
|
-
`permissionMode: "default"` plus `allowedTools`, leaving `canUseTool` to handle the fall-through —
|
|
195
|
-
where it raises a Permission Prompt for the human to decide (ADR 0018), or an Enquiry for
|
|
196
|
-
`AskUserQuestion` (ADR 0016). The SDK warns that allowlisted tools skip the callback; that is the
|
|
197
|
-
intent, not a misconfiguration, and it is why `bypassPermissions` would take away the only place a
|
|
198
|
-
tool can be held open on a person. What must never happen is a callback that neither settles nor
|
|
199
|
-
denies: that is a turn nobody can end.
|
|
200
|
-
|
|
201
|
-
**M1 (pi adapter) complete.** Both backends now sit behind the same Backend Adapter contract.
|
|
202
|
-
|
|
203
|
-
pi's real `AgentSessionEvent` union was read out of its type declarations with the compiler API
|
|
204
|
-
(`spikes/probe-type.ts`) rather than inferred, which corrected three things:
|
|
205
|
-
|
|
206
|
-
- **pi separates runs from turns.** `agent_start`/`agent_end` bracket one exchange with the human;
|
|
207
|
-
`turn_start`/`turn_end` fire once per model call, many times inside it. Our `turn_started` /
|
|
208
|
-
`turn_ended` map to `agent_*`. Mapping them to `turn_*` would emit N pairs per prompt.
|
|
209
|
-
- **`agent_end` carries `willRetry`.** When set, pi is about to auto-retry and the exchange is not
|
|
210
|
-
over, so no `turn_ended` is emitted yet.
|
|
211
|
-
- The union has 17 members, including `compaction_start` and `thinking_level_changed`, which are not
|
|
212
|
-
visible from how existing consumers use it.
|
|
213
|
-
|
|
214
|
-
`Capabilities.providers` earns its place: Claude reports `["anthropic"]`, pi reports 32.
|
|
215
|
-
|
|
216
|
-
pi keeps its own credential store, so live pi runs need `pi` + `/login`. The translation itself is
|
|
217
|
-
covered without credentials in `test/backend/pi-mapping.test.ts`, including a regression test that
|
|
218
|
-
we always send `streamingBehavior: "steer"` and never touch pi's native follow-up queue.
|
|
219
|
-
|
|
220
|
-
**M2 (durability and revive) complete.** Agent Sessions outlive the process that started them.
|
|
29
|
+
## Install
|
|
221
30
|
|
|
222
31
|
```bash
|
|
223
|
-
|
|
224
|
-
flow --
|
|
225
|
-
flow --list
|
|
32
|
+
npm install --global @nathanstephenson/flow
|
|
33
|
+
flow --version
|
|
226
34
|
```
|
|
227
35
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
any client is notified — a client must never see an event a restart would lose.
|
|
231
|
-
|
|
232
|
-
- On restart, previously running sessions load as **Dormant**: transcripts readable, nothing
|
|
233
|
-
running, nothing spent. The next message revives them, or `revive` does it explicitly.
|
|
234
|
-
- A turn torn by an unclean shutdown is **closed on load** with `reason: "aborted"`. The transcript
|
|
235
|
-
is append-only, so we record that we now know it ended rather than rewriting it.
|
|
236
|
-
- Dormancy is an event (`session_dormant`), not just host state. Without it a client reducing the
|
|
237
|
-
transcript sees `turn_ended` and shows a ready prompt for a session with no backend attached.
|
|
238
|
-
- A half-written final line in `transcript.jsonl` is tolerated: parsing stops at the last good entry.
|
|
36
|
+
You do not need to build anything. The `prepack` script builds the CLI, the web client and the
|
|
37
|
+
Workflow runtime into the package.
|
|
239
38
|
|
|
240
|
-
|
|
241
|
-
"drop the torn turn" hint to pass down; the torn turn is closed in our transcript instead.
|
|
39
|
+
## First run
|
|
242
40
|
|
|
243
|
-
|
|
244
|
-
never to a session object.
|
|
41
|
+
Start the Session Host:
|
|
245
42
|
|
|
246
43
|
```bash
|
|
247
|
-
flow serve
|
|
248
|
-
flow tui # terminal client; connects to a running host or embeds one
|
|
249
|
-
flow list
|
|
44
|
+
flow serve
|
|
250
45
|
```
|
|
251
46
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
47
|
+
`flow serve` stays in the foreground. It prints a web handoff URL
|
|
48
|
+
(`http://127.0.0.1:PORT/auth?token=…`). Open that URL once in your browser.
|
|
49
|
+
To use the terminal client, run `flow tui` in another terminal.
|
|
255
50
|
|
|
256
|
-
|
|
257
|
-
is one-directional and sequence-numbered, so reconnect is `?since=N` — a replay, not a
|
|
258
|
-
resynchronisation protocol — and it needs no dependency in Node or the browser.
|
|
51
|
+
To run the Session Host in the background:
|
|
259
52
|
|
|
260
|
-
|
|
53
|
+
| Command | Action |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `flow serve start` | Start a background Session Host. |
|
|
56
|
+
| `flow serve status` | Show the installed and running versions. |
|
|
57
|
+
| `flow serve stop` | Stop the Session Host. |
|
|
58
|
+
| `flow serve restart` | Restart a background Session Host with its saved settings. |
|
|
261
59
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
- **Chunk handlers raced.** Key handling is async, so a chunk arriving mid-walk interleaved with the
|
|
265
|
-
previous one and applied keys out of order. Chunks are now processed strictly in sequence.
|
|
60
|
+
Stop and restart refuse active work unless you add `--force`.
|
|
61
|
+
[docs/operating-the-host.md](docs/operating-the-host.md) gives the full rules.
|
|
266
62
|
|
|
267
|
-
|
|
63
|
+
To reach Flow from another machine, read [docs/remote-access.md](docs/remote-access.md).
|
|
268
64
|
|
|
269
|
-
|
|
270
|
-
flow serve # prints http://127.0.0.1:PORT/auth?token=… — open that once
|
|
271
|
-
flow serve --port 3000 --address 0.0.0.0 # containers reached via a published port
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
Several Agent Sessions on screen at once, collapsible tool calls, file edits rendered as diffs,
|
|
275
|
-
per-pane transcript search, provider-grouped model picker, Steering Queue depth and context usage —
|
|
276
|
-
the surface M6 rebuilds, one Agent Session on screen at a time.
|
|
65
|
+
## Backends and credentials
|
|
277
66
|
|
|
278
|
-
|
|
279
|
-
`src/client/diff.ts` imported only types, so stripping left standalone ESM with no imports — served
|
|
280
|
-
as `/reduce.js` and `/diff.js`, no bundler — and a test loaded what the Session Host actually served
|
|
281
|
-
and asserted it produced state identical to the TypeScript reducer. **Superseded by M6**, which has
|
|
282
|
-
the browser import the reducer instead of being handed it.
|
|
67
|
+
Configure credentials for the Backend Adapter that you use.
|
|
283
68
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
69
|
+
- **Claude** — Flow uses your Claude subscription credentials. It does not need
|
|
70
|
+
`ANTHROPIC_API_KEY`. From source, the Agent SDK finds its own copy of Claude Code. The single
|
|
71
|
+
executable needs a separate Claude Code install
|
|
72
|
+
(see [docs/development.md](docs/development.md#single-executable)).
|
|
73
|
+
- **pi** — pi keeps its own credential store. Run `pi`, then `/login`, before you start a pi
|
|
74
|
+
session. Flow reads pi state from `PI_CODING_AGENT_DIR` (default `~/.pi/agent`).
|
|
289
75
|
|
|
290
|
-
|
|
291
|
-
an `EventSource`: the token goes into an HttpOnly cookie once, and the UI itself — not just the API
|
|
292
|
-
— requires it. An externally reachable personal deployment should use the OIDC gate below instead.
|
|
76
|
+
## Everyday use
|
|
293
77
|
|
|
294
|
-
###
|
|
78
|
+
### Commands
|
|
295
79
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
80
|
+
| Command | Action |
|
|
81
|
+
| --- | --- |
|
|
82
|
+
| `flow serve [--port N] [--address HOST]` | Run the Session Host in the foreground. |
|
|
83
|
+
| `flow tui [--scope DIR] [--backend claude\|pi\|fake]` | Open the terminal client. It connects to a running host, or starts its own. |
|
|
84
|
+
| `flow list` | List Agent Sessions. |
|
|
85
|
+
| `flow [--session ID] [--scope DIR] [--backend B] [--model M] [--effort L] "<prompt>"` | Send one prompt, then exit. |
|
|
86
|
+
| `flow update [--force]` | Update Flow. See [Updating Flow](#updating-flow). |
|
|
87
|
+
| `flow --version` | Show the installed version. |
|
|
300
88
|
|
|
301
|
-
|
|
302
|
-
listens; unconfigured deployments keep the local `/auth?token=…` behaviour.
|
|
89
|
+
Examples:
|
|
303
90
|
|
|
304
91
|
```bash
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
export FLOW_OIDC_PUBLIC_APP_URL=https://flow.example.com
|
|
309
|
-
flow serve --port 4318 # keep loopback when the proxy is on this host
|
|
310
|
-
# or --address 0.0.0.0 in an isolated container network
|
|
92
|
+
flow --backend claude "Remember the word marmalade" # prints a session id
|
|
93
|
+
flow --session <id> "What word did I ask you to remember?" # → marmalade
|
|
94
|
+
flow list
|
|
311
95
|
```
|
|
312
96
|
|
|
313
|
-
|
|
97
|
+
Scope rules:
|
|
314
98
|
|
|
315
|
-
-
|
|
316
|
-
|
|
99
|
+
- `flow tui` without `--scope` uses the Project Root from `config.json`. If there is no Project
|
|
100
|
+
Root, it uses the current directory.
|
|
101
|
+
- A one-shot prompt always uses the current directory, unless `--scope` names a different one.
|
|
317
102
|
|
|
318
|
-
|
|
319
|
-
method (`client_secret_basic` or `client_secret_post`), signed ID tokens, S256 PKCE, refresh tokens,
|
|
320
|
-
and the `openid` scope. Flow requests `offline_access`. Back-channel logout is optional but required
|
|
321
|
-
for immediate revocation when the issuer disables a user; discovery alone cannot report an account
|
|
322
|
-
change. Logout inside Flow does not perform global issuer logout.
|
|
103
|
+
### Agent Sessions survive restarts
|
|
323
104
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
is the only browser origin Flow trusts in this mode. Do not rewrite it from request headers and do
|
|
327
|
-
not expose the daemon directly; Flow intentionally ignores `Forwarded` and `X-Forwarded-*` for its
|
|
328
|
-
security decisions. HTTP issuer/app URLs are accepted only for `localhost`, `127.0.0.1` or `::1`
|
|
329
|
-
development.
|
|
105
|
+
When the Session Host restarts, sessions that were running load as **Dormant**. You can read their
|
|
106
|
+
transcripts. Nothing runs and nothing is spent. The next message revives a Dormant session.
|
|
330
107
|
|
|
331
|
-
|
|
332
|
-
`$FLOW_STATE_DIR/oidc/` (0700 directory, 0600 file, with no additional application-level encryption),
|
|
333
|
-
rotates refresh tokens, coordinates concurrent refreshes, and applies a seven-day absolute
|
|
334
|
-
browser-session lifetime. Flow logout, expiry, failed
|
|
335
|
-
refresh and valid back-channel notifications revoke the browser session and close its SSE/WebSocket
|
|
336
|
-
connections without ending Agent Sessions.
|
|
108
|
+
### TUI keys
|
|
337
109
|
|
|
338
|
-
|
|
110
|
+
| Key | Action |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `^S` | Sessions |
|
|
113
|
+
| `^P` | Models (grouped by provider) |
|
|
114
|
+
| `^E` | Effort |
|
|
115
|
+
| `esc` | Abort |
|
|
116
|
+
| `^C` | Quit |
|
|
339
117
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
https://flow.example.com/api/sessions
|
|
343
|
-
```
|
|
118
|
+
If you type while the agent works, Flow queues the message. It does not interrupt the agent.
|
|
119
|
+
Steering is a deliberate action.
|
|
344
120
|
|
|
345
|
-
|
|
346
|
-
Protect that token as full app access. In OIDC mode `/auth` is disabled and an old `flow=` cookie is
|
|
347
|
-
ignored, so the bypass cannot be handed to a browser through Flow.
|
|
121
|
+
### Web UI
|
|
348
122
|
|
|
349
|
-
|
|
123
|
+
- The rail on the left lists Agent Sessions. One Agent Session shows in the main pane.
|
|
124
|
+
- To resize the rail, drag its right edge (180px to 520px). The browser remembers the width.
|
|
125
|
+
- To hide or show the rail, click that edge or press ⌘B / Ctrl-B. The open state is not
|
|
126
|
+
remembered after a reload.
|
|
127
|
+
- When the edge handle has focus, the arrow keys resize the rail. Hold Shift for a larger step.
|
|
128
|
+
- To open **Settings**, click the gear at the bottom-left of the rail. Press `?` for the Keyboard
|
|
129
|
+
section.
|
|
350
130
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
```
|
|
131
|
+
Settings, Projects, MCP connections and fonts are described in
|
|
132
|
+
[docs/configuration.md](docs/configuration.md). Git publishing and stacked pull requests are
|
|
133
|
+
described in [docs/git.md](docs/git.md).
|
|
355
134
|
|
|
356
|
-
|
|
357
|
-
refresh-token rotation. It auto-admits one fixed test subject and is for localhost testing only.
|
|
358
|
-
Nathan's separate OpenAuth-based issuer has not been compatibility-verified by this change.
|
|
359
|
-
|
|
360
|
-
**M5 (single executable) complete.** `npm run build:binary` produces `build/flow`: an esbuild
|
|
361
|
-
bundle injected into a copy of the `node` binary via Node SEA.
|
|
362
|
-
|
|
363
|
-
**Claude Code is a prerequisite for the binary, not a payload.** The Agent SDK spawns the CLI as a
|
|
364
|
-
child process, and a child needs a real file on disk, which a SEA blob cannot provide. Install it
|
|
365
|
-
separately (`npm i -g @anthropic-ai/claude-code`); the binary resolves `claude` from PATH, or from
|
|
366
|
-
`FLOW_CLAUDE_PATH`. Running from source is unaffected — the SDK finds its own copy.
|
|
367
|
-
|
|
368
|
-
Building on macOS additionally needs Xcode command line tools: injection invalidates the `node`
|
|
369
|
-
binary's code signature, so the build strips it, injects into a `NODE_SEA` Mach-O segment, then
|
|
370
|
-
re-signs ad hoc. Without that the kernel SIGKILLs the binary at launch and prints only `killed`.
|
|
371
|
-
|
|
372
|
-
Five things the build needed:
|
|
373
|
-
|
|
374
|
-
- **`import.meta.url` becomes `undefined` in a CommonJS bundle**, which breaks the
|
|
375
|
-
`createRequire(import.meta.url)` calls inside bundled dependencies. The build defines it as a real
|
|
376
|
-
file URL.
|
|
377
|
-
- **pi is loaded lazily** (`src/backend/registry.ts`). It is ESM-only and pulls in native and wasm
|
|
378
|
-
packages, so a bundle cannot require it at startup. On demand, its absence is a clear error when
|
|
379
|
-
you ask for a pi session rather than a crash at launch — the binary is Claude-only unless pi is
|
|
380
|
-
installed alongside it.
|
|
381
|
-
- **The CLI is spawned directly, not through `process.execPath`.** The SDK runs the CLI as
|
|
382
|
-
`<node> <cli-path> …` using `process.execPath` as the interpreter — but inside a single executable
|
|
383
|
-
that *is* the Flow binary, so the spawn re-invokes Flow with the CLI's arguments,
|
|
384
|
-
argument parsing rejects them, and it surfaces as `Claude Code process exited with code 1`. A
|
|
385
|
-
`spawnClaudeCodeProcess` override executes the CLI path itself. It rewrites *only* interpreter
|
|
386
|
-
spawns: a native Claude Code install is spawned with no interpreter at all, so the binary is
|
|
387
|
-
already the command and `args[0]` is a real flag. Hoisting it there executes `--output-format` as
|
|
388
|
-
a program, and the SDK reports that as "native binary exists but failed to launch — probably a
|
|
389
|
-
libc mismatch", which is not what went wrong.
|
|
390
|
-
- **Native `esbuild`, after a spell on `esbuild-wasm`.** The wasm build was chosen to keep the
|
|
391
|
-
lockfile portable: the native package resolves to a per-platform binary, so one installed on macOS
|
|
392
|
-
looked as though it would leave the Linux build broken. It never would have — `package-lock.json`
|
|
393
|
-
is lockfileVersion 3 and records every platform's optional binary rather than the host's, as it
|
|
394
|
-
already did for both agent SDKs and now does for M6's Rolldown and lightningcss bindings too, and
|
|
395
|
-
`npm ci` picks the right one per OS. The shim was defending a property the tree does not have, at
|
|
396
|
-
the price of shipping two esbuilds. The switch produced a byte-identical bundle and took
|
|
397
|
-
`logLevel: "silent"` with it — that existed only because the wasm stdio shim threw writing its own
|
|
398
|
-
summary to a pipe, and the native package writes nothing there at all.
|
|
399
|
-
- **The packaging asymmetry held**, exactly backwards from intuition: pi is in-process and would
|
|
400
|
-
bundle cleanly if not for its native deps, while Claude — the one that looks like a library — is
|
|
401
|
-
the one needing an external executable.
|
|
402
|
-
|
|
403
|
-
**M6 (the web client is bundled) in progress.** The browser client is a Vite and React application
|
|
404
|
-
in `web/`, and it *imports* `src/client/reduce.ts` as TypeScript rather than being served that file
|
|
405
|
-
with its types stripped.
|
|
406
|
-
|
|
407
|
-
M4's arrangement is reversed deliberately. Importing the reducer makes two copies of it impossible
|
|
408
|
-
for the compiler's reasons rather than a test's, and it lifts the ceiling that arrangement imposed:
|
|
409
|
-
nothing shared could import a value, which is why `src/client/diff.ts` compares lines naively. So
|
|
410
|
-
`src/client/` stops being only the shared reducer and becomes the shared front-end core — reducer,
|
|
411
|
-
transport, and the presentation logic both clients need — under a standing rule that everything in
|
|
412
|
-
it stays free of DOM types, because the TUI compiles it under a program that has none.
|
|
413
|
-
|
|
414
|
-
The Session Host learns nothing about Vite. `prebuild:binary` builds `web/dist` and the binary build
|
|
415
|
-
turns it into the manifest it injects; the rest of the chain is untouched. What the host gained is a
|
|
416
|
-
manifest instead of six hard-coded files: content-hashed assets served
|
|
417
|
-
`public, max-age=31536000, immutable`, the Entry Document `no-store` — which is doing real work,
|
|
418
|
-
since an immutably cached one would pin a browser to a deleted asset hash — and a fallback that
|
|
419
|
-
answers an unknown path with the Entry Document so a deep-linked Agent Session survives a reload,
|
|
420
|
-
with `/api` and `/assets` excluded, because a missing hashed chunk answered with HTML costs an hour
|
|
421
|
-
to diagnose.
|
|
422
|
-
|
|
423
|
-
The cost is that drift changes shape rather than going away. Two gates stand in for the test that
|
|
424
|
-
used to execute the served bytes: the build refuses to emit a bundle whose module graph lacks the
|
|
425
|
-
shared client modules, and `test/assets-embedding.test.ts` holds the manifest generator to the
|
|
426
|
-
content types, the base64 boundary and the `immutable` rule the host assumes. Staleness itself is
|
|
427
|
-
not among them, because the manifest is generated by the build that embeds it and cannot lag the
|
|
428
|
-
sources it was built from. Nothing typechecks the embedded bytes any more either — they are
|
|
429
|
-
`JSON.stringify` of a plain object, and the generator is what is tested instead.
|
|
430
|
-
|
|
431
|
-
The UI is master–detail: a sidebar of Agent Sessions and exactly one of them focused in a pane, where
|
|
432
|
-
M4 opened a pane per Agent Session. One at a time is the design rather than a limitation of it — the
|
|
433
|
-
rail carries the state of the others, banded most alive first, and a dot, a Subagent count, a queue
|
|
434
|
-
depth and a relative time per row is enough to monitor any number of them without reading them. Ten modules are
|
|
435
|
-
shared with the terminal client rather than the three the old arrangement allowed, so the model and
|
|
436
|
-
Effort pickers, the status predicates, transcript search and the relative clock are now one
|
|
437
|
-
implementation each instead of two that had already drifted. Styling is stock shadcn/ui on Base UI
|
|
438
|
-
primitives, with no bespoke palette to learn: the six states an Agent Session can be in are mapped
|
|
439
|
-
onto shadcn's own chart tokens, and monospace is kept only where character alignment carries meaning
|
|
440
|
-
— transcript text, tool output, diffs and Scope paths.
|
|
441
|
-
|
|
442
|
-
Nothing automatically proves the shipped bundle renders. The compiler, the module-graph check and the
|
|
443
|
-
hash all prove things about the bundle rather than about the app working, and closing that gap needs
|
|
444
|
-
a browser-driven smoke test that is designed but deferred.
|
|
445
|
-
|
|
446
|
-
## Development
|
|
447
|
-
|
|
448
|
-
```bash
|
|
449
|
-
npm install
|
|
450
|
-
npm run typecheck # four programs: host, web presentation logic, web app, its Vite config
|
|
451
|
-
npm test
|
|
452
|
-
npm run spike:auth # re-verify subscription auth
|
|
453
|
-
npm run test:oidc-issuer -- http://127.0.0.1:5173 # local standards test Provider
|
|
454
|
-
|
|
455
|
-
FLOW_ASSETS=1 npm test # adds a Vite build, to prove the embedder handles everything it emits
|
|
456
|
-
FLOW_E2E=1 npm test # adds the live Claude contract (spends tokens)
|
|
457
|
-
FLOW_E2E_PI=1 npm test # adds the live pi contract (needs pi credentials)
|
|
458
|
-
```
|
|
135
|
+
## Where state lives
|
|
459
136
|
|
|
460
|
-
|
|
461
|
-
no network and no bundler, so a fresh clone with no `web/dist` — and an `--omit=dev` install with no
|
|
462
|
-
Vite at all — still runs it green. That holds by construction now rather than by care: no test
|
|
463
|
-
reaches a build output, and the ones about serving a web client are handed a fixture
|
|
464
|
-
(`test/assets-fixture.ts`).
|
|
465
|
-
|
|
466
|
-
### The rail
|
|
467
|
-
|
|
468
|
-
Drag its right edge to resize — 180px to 520px, remembered per browser in `localStorage`. Click that
|
|
469
|
-
same edge, or press ⌘B / Ctrl-B, to hide it entirely and give the Presentation Transcript the width.
|
|
470
|
-
The handle takes arrow keys when focused (Shift for a coarser step), because a drag handle that only
|
|
471
|
-
answers to a pointer is unusable without one.
|
|
472
|
-
|
|
473
|
-
The drag deliberately does not go through React: it writes `--sidebar-width` onto the provider
|
|
474
|
-
wrapper and commits to state once, on release. Routing it through state re-rendered the rail and the
|
|
475
|
-
transcript once per frame, and shadcn's own `transition-[width] duration-200` — which the open/close
|
|
476
|
-
slide needs — made the rail chase the pointer two frames behind. `data-resizing` on the wrapper
|
|
477
|
-
suppresses that transition for the length of the gesture and nothing else.
|
|
478
|
-
|
|
479
|
-
The width is remembered; whether the rail is open is not. Reloading into an app with no visible
|
|
480
|
-
navigation is a bad first frame, and hiding the rail is a momentary "give me the width" rather than a
|
|
481
|
-
preference — so it is browser state either way and never a Setting, which would make a laptop and a
|
|
482
|
-
desktop fight over one number.
|
|
483
|
-
|
|
484
|
-
⌘B is what shadcn's Sidebar binds and the muscle memory is worth matching, but it is resolved by
|
|
485
|
-
`web/src/presentation/bindings.ts` like every other key rather than by the component's own `window`
|
|
486
|
-
listener, which is removed. See the FLOW note in `web/src/components/ui/sidebar.tsx`.
|
|
487
|
-
|
|
488
|
-
### Settings
|
|
489
|
-
|
|
490
|
-
Everything configurable lives in one file, `<stateRoot>/config.json`, and is editable from the web
|
|
491
|
-
UI at **Settings** — the gear at the bottom-left of the rail, or `?` for the Keyboard section.
|
|
492
|
-
Settings are machine-wide: they govern every Agent Session on the machine, not one Scope.
|
|
493
|
-
|
|
494
|
-
```json
|
|
495
|
-
{
|
|
496
|
-
"retention": { "settled": "1d" },
|
|
497
|
-
"fonts": {
|
|
498
|
-
"chrome": "'Inter Variable', sans-serif",
|
|
499
|
-
"monospace": "'MesloLGS NF', monospace"
|
|
500
|
-
},
|
|
501
|
-
"projects": {
|
|
502
|
-
"root": "~/workspace",
|
|
503
|
-
"include": ["work/api", "e2e", "/srv/elsewhere/thing"]
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
```
|
|
137
|
+
Flow keeps all state under one state root: `$FLOW_STATE_DIR`, default `~/.flow`.
|
|
507
138
|
|
|
508
|
-
|
|
|
509
|
-
| --- | --- |
|
|
510
|
-
| `
|
|
511
|
-
| `
|
|
512
|
-
| `
|
|
513
|
-
| `
|
|
514
|
-
| `
|
|
515
|
-
| `
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
**strictly**, deliberately: a typo on disk costs only its own default and warns on startup, because
|
|
519
|
-
it must not stop the daemon that owns your Presentation Transcripts from starting — whereas a value
|
|
520
|
-
sent from the browser is refused with the field named, because there is someone waiting who can fix
|
|
521
|
-
it. The Session Host reads the file through one owner (`src/daemon/config-store.ts`) rather than
|
|
522
|
-
copying values at startup, so an edit applies to the running daemon: retention takes effect at the
|
|
523
|
-
next hourly sweep, and a typeface immediately.
|
|
524
|
-
|
|
525
|
-
The **General → Filesystem isolation** group shows support status/reason and warns clearly when
|
|
526
|
-
execution is unrestricted. The optional stored key is `filesystemIsolation?: boolean`; leaving it
|
|
527
|
-
out selects automatic mode, and PUT `/api/config` with `filesystemIsolation: null` resets to that
|
|
528
|
-
mode. Omitting the key in a PUT leaves the current override unchanged. The config view reports
|
|
529
|
-
isolation status with `supported`, `enabled`, `automatic`, `checking` and `reason`. The initial
|
|
530
|
-
capability-dependent automatic choice remains fixed until the Session Host restarts; a failed
|
|
531
|
-
enabled launch never changes it to unrestricted. Checking must finish before automatic work launches.
|
|
532
|
-
Settings changes apply to new Backend Sessions (including Revive), new Workflow Executions and new
|
|
533
|
-
local stdio MCP clients, not existing work. Agent Workflow Steps inherit their Backend Session's
|
|
534
|
-
policy. Worker process separation stays on in both modes; HTTP MCP and network access do not change.
|
|
535
|
-
|
|
536
|
-
Shortening `retention.settled` arms a delete. Nothing is removed on save — the sweep does it, within
|
|
537
|
-
the hour — but the Settings page counts the Agent Sessions the new window newly reaches and makes you
|
|
538
|
-
confirm before saving. Only Settled Agent Sessions are ever reaped; an Ended one stays on disk.
|
|
539
|
-
|
|
540
|
-
#### MCP connections
|
|
541
|
-
|
|
542
|
-
Use **Settings → MCP** to add a local command and its arguments, or a remote Streamable HTTP URL.
|
|
543
|
-
Connections are selected by default for new Agent Sessions; turn off the switch to change that default.
|
|
544
|
-
The New Agent Session page lets you choose the connections for that Agent Session.
|
|
545
|
-
|
|
546
|
-
Revive keeps the selected IDs and uses the latest definitions. Edits and deletions do not change an
|
|
547
|
-
open Backend Session. Subagents and Workflow Steps inherit its connections and existing permission
|
|
548
|
-
rules. Pi parent turns and ordinary Subagents still run tools without Flow Permission Prompts.
|
|
549
|
-
|
|
550
|
-
Connection startup does not block Agent Session creation. The first model prompt and Workflow Step
|
|
551
|
-
wait for bounded discovery and tool registration, then proceed even if connections fail. Its MCP
|
|
552
|
-
status shows failures and **Retry**. Retry requires no parent turn, Subagent, Background Call, or
|
|
553
|
-
Workflow Step in flight; new model work waits until Retry finishes.
|
|
554
|
-
For OAuth, select **Sign in**, complete authorization, then return to Flow and select **Retry**.
|
|
555
|
-
OAuth uses one machine-wide identity per connection. Credentials are kept separately from Settings
|
|
556
|
-
in `mcp-credentials.json` with private file permissions. OAuth servers must support dynamic client
|
|
557
|
-
registration. Resources, prompts, and legacy HTTP+SSE are not supported.
|
|
558
|
-
|
|
559
|
-
#### Projects
|
|
560
|
-
|
|
561
|
-
A **Project** is a directory you have opted into starting Agent Sessions from — a *candidate* Scope,
|
|
562
|
-
not a Scope. `projects.include` is the list, and it is the whole of it. A repository Flow can
|
|
563
|
-
see beneath the Project Root is a **Candidate** until it appears there:
|
|
139
|
+
| Path | Content |
|
|
140
|
+
| --- | --- |
|
|
141
|
+
| `sessions/<id>/meta.json`, `sessions/<id>/transcript.jsonl` | One directory for each Agent Session. The transcript is append-only. |
|
|
142
|
+
| `config.json` | Settings. See [docs/configuration.md](docs/configuration.md). |
|
|
143
|
+
| `token` | The daemon bearer token. It gives full access. Protect it. |
|
|
144
|
+
| `daemon.json` | The `{ url, token }` of the running Session Host. |
|
|
145
|
+
| `host.log` | Output of a background Session Host (private). |
|
|
146
|
+
| `mcp-credentials.json` | MCP OAuth credentials (private). |
|
|
147
|
+
| `oidc/` | OIDC tokens and browser sessions, when OIDC is on. |
|
|
148
|
+
| `sandbox-provider.json` | Optional sandbox provider file. See [docs/isolation.md](docs/isolation.md). |
|
|
564
149
|
|
|
565
|
-
|
|
566
|
-
~/workspace projects.include Offered in the dialog
|
|
567
|
-
├── work/
|
|
568
|
-
│ ├── api/.git Candidate → "work/api" ✓ api (under "work")
|
|
569
|
-
│ └── web/.git Candidate –
|
|
570
|
-
├── mono/.git Candidate → "mono/packages/api" ✓ api (under "mono/packages")
|
|
571
|
-
│ └── packages/api ↑ found by search, not offered as a Candidate
|
|
572
|
-
├── notes/ → "notes" ✓ notes (not a repo)
|
|
573
|
-
└── old-thing/.git Candidate –
|
|
574
|
-
```
|
|
150
|
+
Each state root permits one Session Host.
|
|
575
151
|
|
|
576
|
-
|
|
577
|
-
today. Settings → **Projects** is where the list is built, three ways:
|
|
578
|
-
|
|
579
|
-
- **Candidates** — the repositories found beneath the Project Root, one click each. Found by the
|
|
580
|
-
same walk as before: a directory holding a `.git` is a Candidate, a repository is never looked
|
|
581
|
-
inside (so `node_modules` and build output stay out with no blacklist), three levels deep, hidden
|
|
582
|
-
directories and symlinks skipped.
|
|
583
|
-
- **Any directory** — a search field, because the useful directory is often one no Candidate walk
|
|
584
|
-
would offer. Type a **name** and it fuzzy-matches beneath the Project Root, *reaching inside*
|
|
585
|
-
repositories, which is how `mono/packages/api` is reachable at all. Start with `/` or `~` and it
|
|
586
|
-
completes a **path** anywhere on the machine instead — that is the escape hatch for a Project
|
|
587
|
-
outside the root. The rule is the first character, so `work/api` is still a name, and narrows.
|
|
588
|
-
- **Project Root** — what the other two can see. Clearing it does not clear your Projects; an
|
|
589
|
-
absolute entry does not need it.
|
|
590
|
-
|
|
591
|
-
An opted-in directory need not be a repository, because you chose it deliberately and nothing has to
|
|
592
|
-
guess whether you meant it. An entry whose directory has since gone is **marked**, not dropped —
|
|
593
|
-
silently hiding it would look identical to the Setting having failed to save.
|
|
594
|
-
|
|
595
|
-
Until something is opted in there are no Projects, so the New Agent Session dialog behaves as it
|
|
596
|
-
did before this existed: one prefilled Scope field. Once there is at least one, the dialog leads
|
|
597
|
-
with a Project picker, the Scope field starts empty, and `n` opens with the picker focused — so `n`,
|
|
598
|
-
a few letters, Enter, Enter starts a session in the right repository. The Scope field stays
|
|
599
|
-
editable throughout, for the directory you did not opt in.
|
|
600
|
-
|
|
601
|
-
`flow tui` uses the Project Root when `--scope` is absent. A one-shot
|
|
602
|
-
`flow "<prompt>"` does not: it is run *in* a directory, so that directory is the right
|
|
603
|
-
default and `--scope` is how you say otherwise.
|
|
604
|
-
|
|
605
|
-
#### Fonts
|
|
606
|
-
|
|
607
|
-
**Set `monospace` to a Nerd Font if your prompt is a Powerline one.** Those separators are Private
|
|
608
|
-
Use Area codepoints — U+E0B0 for the arrow, U+E0A0 for the branch — and no stock system font carries
|
|
609
|
-
them, so a shell prompt that uses them renders as tofu until the terminal is told a font that has
|
|
610
|
-
them. Nothing is bundled: the right font is whichever is already installed on the machine doing the
|
|
611
|
-
reading, so the default stack names the common patched families (`MesloLGS NF`,
|
|
612
|
-
`JetBrainsMono Nerd Font`, `FiraCode Nerd Font`, `Hack Nerd Font`) ahead of the stock ones and picks
|
|
613
|
-
whichever it finds. The defaults live in `src/protocol/fonts.ts`, which is the only copy —
|
|
614
|
-
`web/src/index.css` restates them for the first frame and `test/fonts.test.ts` holds the two
|
|
615
|
-
together.
|
|
616
|
-
|
|
617
|
-
A Shell — a terminal the web client draws in one tab of a Dock, the tabbed region below an Agent
|
|
618
|
-
Session's transcript or beside it — needs a pty, which is a native addon. `npm install` builds it,
|
|
619
|
-
and where it cannot be loaded the host reports `shell: false` on `/api/config` and the web client
|
|
620
|
-
offers no Docks at all rather than a picker with nothing in it. A SEA blob cannot contain a native addon, so the binary from `npm run build:binary` has to
|
|
621
|
-
find `node-pty` on disk: it will on the machine that built it, and will not once shipped elsewhere,
|
|
622
|
-
where it reports `shell: false` and serves no Shells (ADR 0008).
|
|
623
|
-
|
|
624
|
-
Working on the web client means a Session Host to talk to, so start the host first:
|
|
152
|
+
## Updating Flow
|
|
625
153
|
|
|
626
154
|
```bash
|
|
627
|
-
|
|
628
|
-
npm run dev # terminal two: Vite on 127.0.0.1:5173
|
|
155
|
+
flow update
|
|
629
156
|
```
|
|
630
157
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
rebuild-and-diff step, because nothing generated is committed; the binary build is what proves the
|
|
650
|
-
web client can still be built and embedded.
|
|
651
|
-
|
|
652
|
-
Sources under `src/`, `test/` and `web/src/presentation/` are run through Node's
|
|
653
|
-
`--experimental-strip-types`, so TypeScript there is limited to erasable syntax: no parameter
|
|
654
|
-
properties, enums, or namespaces. Relative imports carry the `.ts` extension and are rewritten on
|
|
655
|
-
build. The rest of `web/` is Vite's and free of that constraint — but `src/client/**` is not,
|
|
656
|
-
however browser-facing it becomes, because the TUI still runs it stripped.
|
|
657
|
-
|
|
658
|
-
### Direct MCP Workflow Steps
|
|
659
|
-
|
|
660
|
-
In **Settings → Workflows**, choose **Add MCP**, select an Agent Session and one of its enabled
|
|
661
|
-
MCP servers, then **Discover tools**. Select the original tool name and compose its arguments using
|
|
662
|
-
literals and available workflow-input/predecessor references. The editor provides JSON Schema
|
|
663
|
-
fields, local references, alternatives, conditional/dependent fields, arrays/tuples and additional
|
|
664
|
-
properties, with the original constraints available for inspection. Validation uses the original
|
|
665
|
-
schema, not a reduced visual approximation. Unknown dialects, formats or validation keywords fail
|
|
666
|
-
explicitly; no constraint is silently discarded. Supported dialects are draft-07, 2019-09 and
|
|
667
|
-
2020-12 (the MCP default).
|
|
668
|
-
|
|
669
|
-
Direct steps support both stdio and Streamable HTTP, including existing OAuth sign-in. They make
|
|
670
|
-
no model call, create no Subagent and add no model tokens. New local stdio clients capture the
|
|
671
|
-
machine-wide filesystem isolation policy: servers are restricted when enabled and otherwise run
|
|
672
|
-
with unrestricted host-user filesystem authority. Existing clients retain their policy; HTTP calls
|
|
673
|
-
use the configured remote service unchanged.
|
|
674
|
-
Credentials belong in MCP Settings, never in workflow arguments. Expired/missing authentication
|
|
675
|
-
requires signing in there and a manual Retry; executions never launch a login flow or replay an
|
|
676
|
-
HTTP tool request after a 401.
|
|
677
|
-
|
|
678
|
-
The result is always `{ structuredContent: JSON | null, content: MCPContentBlock[] }`. Absent
|
|
679
|
-
structured content becomes null; text is not parsed as JSON, and links are not downloaded.
|
|
680
|
-
Map `structuredContent` (or its fields) into an Agent's input to review it directly. Successful
|
|
681
|
-
empty/not-found data stays successful and can drive a Branch. Tool errors retain bounded,
|
|
682
|
-
credential-redacted partial output. Results exceeding **100,000 UTF-8 bytes** fail without truncation.
|
|
683
|
-
|
|
684
|
-
Each execution pins connection configuration, server identity and original input/output schemas.
|
|
685
|
-
Changing the definition or reconfiguring a server never retargets an existing execution. Discovery
|
|
686
|
-
and each attempt revalidate these identities. Missing, disabled, changed or unauthenticated tools
|
|
687
|
-
require explicit reconfiguration rather than a fallback.
|
|
688
|
-
|
|
689
|
-
Ask mode prompts privately before **every call**, including single-step tests; auto-accept does not
|
|
690
|
-
prompt. The timeout defaults to **60 seconds**, configurable on the step. Existing failure/timeout
|
|
691
|
-
edges, loops, joins, Retry and Supply output work as for other steps. **Cancellation is not rollback:**
|
|
692
|
-
interrupted or timed-out writes may already have happened. Inspect the remote state before retrying.
|
|
693
|
-
See [the direct MCP execution decision](docs/adr/0025-direct-mcp-workflow-steps.md).
|
|
158
|
+
Before you update, close all CLI and TUI clients. Stop other Session Hosts that use this
|
|
159
|
+
installation. Updates are never automatic. [docs/updating.md](docs/updating.md) gives the
|
|
160
|
+
requirements, the browser update, systemd setup and the repair procedure.
|
|
161
|
+
|
|
162
|
+
## More documentation
|
|
163
|
+
|
|
164
|
+
| Page | Content |
|
|
165
|
+
| --- | --- |
|
|
166
|
+
| [docs/operating-the-host.md](docs/operating-the-host.md) | Background host, stop and restart rules, Shells |
|
|
167
|
+
| [docs/updating.md](docs/updating.md) | `flow update`, browser update, failure and repair |
|
|
168
|
+
| [docs/systemd-updates.md](docs/systemd-updates.md) | Updates for systemd-owned hosts |
|
|
169
|
+
| [docs/isolation.md](docs/isolation.md) | Filesystem isolation, Bubblewrap and sandboxes |
|
|
170
|
+
| [docs/remote-access.md](docs/remote-access.md) | Container access and the OIDC gate |
|
|
171
|
+
| [docs/configuration.md](docs/configuration.md) | Settings, MCP connections, Projects, fonts, environment variables |
|
|
172
|
+
| [docs/git.md](docs/git.md) | Publish branch names and stacked pull requests |
|
|
173
|
+
| [docs/workflow-builder-scope.md](docs/workflow-builder-scope.md) | Workflows, including direct MCP steps |
|
|
174
|
+
| [docs/development.md](docs/development.md) | Build, test, web development, releases |
|
|
175
|
+
| [docs/milestones.md](docs/milestones.md) | Project status and design notes from each milestone |
|