ftown-bridge 0.25.3 → 0.27.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/dist/attention-cli.d.ts +32 -0
- package/dist/attention-cli.js +310 -0
- package/dist/attention-cli.js.map +1 -0
- package/dist/attention-events.d.ts +2 -1
- package/dist/attention-events.js.map +1 -1
- package/dist/attention-store.d.ts +6 -3
- package/dist/attention-store.js +60 -2
- package/dist/attention-store.js.map +1 -1
- package/dist/brief-cli.d.ts +10 -0
- package/dist/brief-cli.js +163 -0
- package/dist/brief-cli.js.map +1 -0
- package/dist/command-rpc.js +18 -15
- package/dist/command-rpc.js.map +1 -1
- package/dist/coordination/attention-routing.d.ts +37 -0
- package/dist/coordination/attention-routing.js +154 -0
- package/dist/coordination/attention-routing.js.map +1 -0
- package/dist/coordination/board.d.ts +12 -0
- package/dist/coordination/board.js +240 -0
- package/dist/coordination/board.js.map +1 -0
- package/dist/coordination/card-store.d.ts +9 -0
- package/dist/coordination/card-store.js +188 -0
- package/dist/coordination/card-store.js.map +1 -0
- package/dist/coordination/contract-b.d.ts +206 -0
- package/dist/coordination/contract-b.js +58 -0
- package/dist/coordination/contract-b.js.map +1 -0
- package/dist/coordination/contract.d.ts +236 -0
- package/dist/coordination/contract.js +63 -0
- package/dist/coordination/contract.js.map +1 -0
- package/dist/coordination/format.d.ts +5 -0
- package/dist/coordination/format.js +73 -0
- package/dist/coordination/format.js.map +1 -0
- package/dist/coordination/routes-brief.d.ts +10 -0
- package/dist/coordination/routes-brief.js +149 -0
- package/dist/coordination/routes-brief.js.map +1 -0
- package/dist/coordination/routes-worktrees.d.ts +29 -0
- package/dist/coordination/routes-worktrees.js +138 -0
- package/dist/coordination/routes-worktrees.js.map +1 -0
- package/dist/coordination/tree-events.d.ts +31 -0
- package/dist/coordination/tree-events.js +226 -0
- package/dist/coordination/tree-events.js.map +1 -0
- package/dist/coordination/wiring.d.ts +57 -0
- package/dist/coordination/wiring.js +165 -0
- package/dist/coordination/wiring.js.map +1 -0
- package/dist/coordination-cli.d.ts +34 -0
- package/dist/coordination-cli.js +466 -0
- package/dist/coordination-cli.js.map +1 -0
- package/dist/create-ftown-session.d.ts +8 -1
- package/dist/create-ftown-session.js +164 -104
- package/dist/create-ftown-session.js.map +1 -1
- package/dist/ftown-cli.js +18 -2
- package/dist/ftown-cli.js.map +1 -1
- package/dist/index.js +34 -7
- package/dist/index.js.map +1 -1
- package/dist/local-api-server.d.ts +30 -1
- package/dist/local-api-server.js +740 -32
- package/dist/local-api-server.js.map +1 -1
- package/dist/mail-delivery.d.ts +34 -6
- package/dist/mail-delivery.js +381 -85
- package/dist/mail-delivery.js.map +1 -1
- package/dist/mail-store.d.ts +7 -0
- package/dist/mail-store.js +71 -1
- package/dist/mail-store.js.map +1 -1
- package/dist/pull-request-events.d.ts +5 -0
- package/dist/pull-request-events.js +21 -1
- package/dist/pull-request-events.js.map +1 -1
- package/dist/security/bridge/permissions.js +54 -4
- package/dist/security/bridge/permissions.js.map +1 -1
- package/dist/session-controller.d.ts +17 -1
- package/dist/session-controller.js +93 -2
- package/dist/session-controller.js.map +1 -1
- package/dist/sessions-commands.js +65 -5
- package/dist/sessions-commands.js.map +1 -1
- package/dist/types.d.ts +10 -1
- package/dist/wire-types.d.ts +17 -1
- package/dist/wire-types.js +1 -1
- package/dist/wire-types.js.map +1 -1
- package/dist/worktrees-cli.d.ts +39 -0
- package/dist/worktrees-cli.js +168 -0
- package/dist/worktrees-cli.js.map +1 -0
- package/dist/worktrees.d.ts +16 -0
- package/dist/worktrees.js +292 -0
- package/dist/worktrees.js.map +1 -0
- package/hooks/ftown-antigravity-hook.sh +12 -6
- package/package.json +2 -2
- package/skills/ftown/SKILL.md +75 -9
- package/skills/ftown/references/orchestrator.md +27 -23
- package/skills/ftown/references/sessions.md +136 -11
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
# ~/.ftown/antigravity-hook.sh and registered in ~/.gemini/config/hooks.json.
|
|
4
4
|
# Translates agy's camelCase hook payload (stdin) to the bridge /hook wire format and POSTs it.
|
|
5
5
|
# On a turn-end Stop it drains this session's ftown inbox FIRST: with mail it
|
|
6
|
-
# prints {"decision":"continue","reason":"<mail>"}
|
|
7
|
-
#
|
|
8
|
-
#
|
|
6
|
+
# prints {"decision":"continue","reason":"<mail>"} (the agent keeps working) and
|
|
7
|
+
# still POSTs Stop so the bridge clears the busy marker (the drain marks the
|
|
8
|
+
# mail delivered, so that Stop finds an empty inbox); without mail it posts
|
|
9
|
+
# Stop. On terminationReason MAX_FORCED_INVOCATIONS / USER_CANCELED / ERROR it
|
|
10
|
+
# never drains, only posts Stop.
|
|
9
11
|
#
|
|
10
12
|
# Always exits 0, also on HUP/INT/TERM/PIPE (a non-zero or signalled PreToolUse
|
|
11
13
|
# hook makes agy BLOCK the tool), and writes nothing to stdout except that one
|
|
@@ -15,7 +17,7 @@
|
|
|
15
17
|
# Worst-case runtime: ~6s inside agy's 10s hook timeout. The POST tries at most
|
|
16
18
|
# 2 endpoint candidates x curl --max-time 2 (4s); on Stop the inbox read through
|
|
17
19
|
# `ftown security proxy` uses a 2s request timeout and happens before the POST,
|
|
18
|
-
# and when
|
|
20
|
+
# and the POST also follows when the drain delivers mail (busy-marker clear).
|
|
19
21
|
#
|
|
20
22
|
# bash 3.2 compatible (macOS /bin/bash). No set -e on purpose; no temp files.
|
|
21
23
|
# The hook's working directory is agy's hooks.json folder, so pwd is never used.
|
|
@@ -160,9 +162,13 @@ drain_mail() {
|
|
|
160
162
|
|
|
161
163
|
MAIL_OUT=""
|
|
162
164
|
if drain_mail; then
|
|
163
|
-
# Mail delivered: the agent continues
|
|
164
|
-
#
|
|
165
|
+
# Mail delivered: the agent continues on the decision line, but the Stop is
|
|
166
|
+
# still POSTed so the bridge clears the busy marker (this hook posts no other
|
|
167
|
+
# Stop while the mail turn runs). The decision line goes out first; the POST
|
|
168
|
+
# is fire-and-forget and silenced. stderr is silenced so a reader that closed
|
|
169
|
+
# the pipe cannot see "Broken pipe".
|
|
165
170
|
printf '%s\n' "$MAIL_OUT" 2>/dev/null
|
|
171
|
+
post_hook "$PAYLOAD" >/dev/null 2>&1 || true
|
|
166
172
|
exit 0
|
|
167
173
|
fi
|
|
168
174
|
post_hook "$PAYLOAD"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ftown-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "CLI bridge for ftown — generic PTY-over-Centrifugo relay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"overrides": {
|
|
74
74
|
"qs": "6.16.1"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "443f64c38ecd3d577f762d5e87986221fac1d26a"
|
|
77
77
|
}
|
package/skills/ftown/SKILL.md
CHANGED
|
@@ -51,6 +51,11 @@ ftown sessions preview --add ./extra.html
|
|
|
51
51
|
ftown sessions preview --remove notes.md
|
|
52
52
|
ftown sessions preview --clear
|
|
53
53
|
ftown sessions preview-reply --message "The preview is ready."
|
|
54
|
+
ftown status set --state working --headline "Reviewing the API client" --progress 0/1
|
|
55
|
+
ftown board
|
|
56
|
+
ftown brief set --file brief.md
|
|
57
|
+
ftown attention list
|
|
58
|
+
ftown worktrees list
|
|
54
59
|
ftown harness mail send <session-id> --type task "review the API client"
|
|
55
60
|
ftown harness mail read
|
|
56
61
|
ftown env --help
|
|
@@ -95,10 +100,48 @@ ftown harness mail send --parent --type escalation "Blocked: need the API contra
|
|
|
95
100
|
```
|
|
96
101
|
|
|
97
102
|
Mail arrives as `[ftown mail]` context through harness hooks/extensions where
|
|
98
|
-
available.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
available. Mail is for directed instructions (`--type task`), results
|
|
104
|
+
(`--type result`) and escalations (`--type escalation`). Use `--type fyi` for
|
|
105
|
+
non-urgent notes; `fyi` never wakes the recipient. Progress and status go on
|
|
106
|
+
your card (below), never as mail. Each new batch of mail nudges the recipient
|
|
107
|
+
at most once; un-read mail stays in the inbox — read it with
|
|
108
|
+
`ftown harness mail read`. Prefer mail for agent communication; use terminal
|
|
109
|
+
key injection only when the task needs it. Inspect peers with `ftown board`
|
|
110
|
+
and `ftown sessions list`.
|
|
111
|
+
|
|
112
|
+
## Status and board
|
|
113
|
+
|
|
114
|
+
Keep your card current with `ftown status set` at meaningful transitions —
|
|
115
|
+
starting, becoming blocked, finishing — not every turn. Set state
|
|
116
|
+
(`working`, `blocked`, `waiting_review`, `done`, `failed`), a short headline,
|
|
117
|
+
progress and any blocker. Writing a card wakes nobody. Parents read
|
|
118
|
+
`ftown board` (one line per child) instead of screening quiet workers, and
|
|
119
|
+
wait with `ftown board --wait --until any-done|any-blocked|any-ready` or
|
|
120
|
+
`ftown events --wait`. Idle workers show on the board and as an `idle` event.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
ftown status set --state working --headline "Implementing the card store" --progress 1/4
|
|
124
|
+
ftown status set --state blocked --headline "Need the API contract" --on parent --text "Waiting on the contract decision"
|
|
125
|
+
ftown status set --state done --headline "Card store shipped; checks green"
|
|
126
|
+
ftown board
|
|
127
|
+
ftown board --wait --until any-done --timeout 300
|
|
128
|
+
ftown events --wait
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Delegating work.** Delegate implementation to ftown child sessions (`ftown sessions create --parent ...`) rather than in-process subagents — only sessions appear on the board and dashboard (cards, events, digests, parent-first questions).
|
|
132
|
+
A child session may use its own subagents for reviews and lookups. Pick the CLI and model with `ftown quota --json` (see `references/quota.md`).
|
|
133
|
+
|
|
134
|
+
## Manager brief
|
|
135
|
+
|
|
136
|
+
If you coordinate children, set a brief at the start and add a note at each
|
|
137
|
+
milestone. The dashboard overview renders the brief and your children
|
|
138
|
+
automatically; you do not build a status page yourself.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
ftown brief set --file brief.md
|
|
142
|
+
ftown brief note "All workers spawned; waiting on the first results"
|
|
143
|
+
ftown brief show
|
|
144
|
+
```
|
|
102
145
|
|
|
103
146
|
## Human attention and pull requests
|
|
104
147
|
|
|
@@ -109,6 +152,18 @@ remains opt-in and requires a supported hosted session. Repeating an unresolved
|
|
|
109
152
|
request updates its occurrence count; after an uncertain result, inspect the
|
|
110
153
|
existing request before retrying.
|
|
111
154
|
|
|
155
|
+
If you have a parent, your request goes to your parent first, not the human:
|
|
156
|
+
the parent receives one waking escalation mail with the question and the
|
|
157
|
+
commands to answer or escalate it, and the human sees it greyed as "with
|
|
158
|
+
parent" (and may still answer). The parent answers with
|
|
159
|
+
`ftown attention answer <child-id> <event-id> --option <n>` (or
|
|
160
|
+
`--text "<reply>"`) only from facts it holds — the plan, the agreed contract,
|
|
161
|
+
earlier human answers — and escalates preferences and irreversible choices
|
|
162
|
+
with `ftown attention escalate <child-id> <event-id> --note "<context>"`.
|
|
163
|
+
Only the parent raises a parent-routed question to the human. Use
|
|
164
|
+
`ftown sessions attention ... --to human` for things only the human can
|
|
165
|
+
provide, such as credentials or approvals.
|
|
166
|
+
|
|
112
167
|
### Questions with answers
|
|
113
168
|
|
|
114
169
|
Add `--option <label>` (repeatable) to ask a question the human answers in the
|
|
@@ -120,7 +175,8 @@ not cancel the question; check later with
|
|
|
120
175
|
event ID.
|
|
121
176
|
|
|
122
177
|
Delivery: a live waiter receives the answer; otherwise it arrives as ftown mail
|
|
123
|
-
from "You" starting with `[ftown attention answer id=...]`.
|
|
178
|
+
from "You" starting with `[ftown attention answer id=...]`. When the parent
|
|
179
|
+
answers, the same delivery applies but the mail sender is the parent session.
|
|
124
180
|
|
|
125
181
|
Claude Code `AskUserQuestion` calls inside an FTown session are answered from
|
|
126
182
|
the same inbox, and the terminal picker appears only after "Answer in terminal"
|
|
@@ -151,12 +207,14 @@ created or updated, before the completion notice: use `ftown sessions pr <URL>`.
|
|
|
151
207
|
Omit this step for tasks without a PR; never invent a PR or guess a session
|
|
152
208
|
identity.
|
|
153
209
|
|
|
154
|
-
Once the task is complete,
|
|
155
|
-
before the final handoff, using
|
|
210
|
+
Once the task is complete, a top-level session requests user attention **once
|
|
211
|
+
per completed task**, before the final handoff, using
|
|
212
|
+
`ftown sessions attention --title 'Work complete'
|
|
156
213
|
--message "<truthful outcome, checks and PR summary>"`.
|
|
157
214
|
Do not send a completion notice every turn; retain the uncertain-result guidance
|
|
158
|
-
above.
|
|
159
|
-
|
|
215
|
+
above. If you have a parent, do not raise "Work complete": set your card to
|
|
216
|
+
`done` and report your result to the parent as assigned; the parent raises one
|
|
217
|
+
completion notice for the whole job. See the completion example in
|
|
160
218
|
`references/sessions.md`.
|
|
161
219
|
|
|
162
220
|
## Cleanup
|
|
@@ -174,6 +232,14 @@ ftown sessions revive <archived-session-id>
|
|
|
174
232
|
Removal archives the session; revival creates a new session id and resumes its
|
|
175
233
|
agent conversation when supported. Preserve useful results before cleanup.
|
|
176
234
|
|
|
235
|
+
For children that write code, create them with their own worktree:
|
|
236
|
+
`ftown sessions create --parent --worktree [--branch <b>] [--base <ref>]`.
|
|
237
|
+
`ftown sessions remove <id>` retires a bridge-created worktree when it is
|
|
238
|
+
clean and merged or pushed; otherwise it keeps the worktree and says why.
|
|
239
|
+
`--keep-worktree` always keeps it, `--force-worktree` forces removal.
|
|
240
|
+
Inspect or clean up archived worktrees with `ftown worktrees list` and
|
|
241
|
+
`ftown worktrees prune`.
|
|
242
|
+
|
|
177
243
|
## Connection and compatibility
|
|
178
244
|
|
|
179
245
|
The commands read `~/.ftown/bridge.json`. Anyone who can read that file can
|
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
# Worker coordination examples
|
|
2
2
|
|
|
3
3
|
Read `../SKILL.md` for identity, reporting and cleanup behavior, and
|
|
4
|
-
`sessions.md` for the command reference.
|
|
5
|
-
|
|
6
|
-
special orchestrator mode is needed.
|
|
4
|
+
`sessions.md` for the command reference. Use an ordinary session with the
|
|
5
|
+
requested task and parent link; no special orchestrator mode is needed.
|
|
7
6
|
|
|
8
7
|
List existing sessions before creating another worker. Give each worker a
|
|
9
8
|
bounded task, clear writable files and acceptance checks; save the returned
|
|
10
|
-
`session.id
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Before picking a CLI, model and effort for delegated work, run `ftown quota --json`
|
|
15
|
-
and follow the decision procedure in `quota.md` (owner tiers first). Pass the
|
|
16
|
-
choice as `--shell <provider>`; add `--model <id>` only with an id from that
|
|
17
|
-
harness's model list. Never route to `exhausted`.
|
|
9
|
+
`session.id`. Omit `--shell` to inherit your harness. Provider flavors require
|
|
10
|
+
a bridge-host token configured with `ftown env set <flavor>`. Before picking a
|
|
11
|
+
CLI, model and effort, run `ftown quota --json` and follow `quota.md` (owner
|
|
12
|
+
tiers first); never route to `exhausted`.
|
|
18
13
|
|
|
19
14
|
```bash
|
|
20
|
-
ftown
|
|
21
|
-
ftown sessions create --parent --workdir /path/to/repo --name
|
|
22
|
-
--prompt "
|
|
23
|
-
ftown
|
|
24
|
-
ftown
|
|
15
|
+
ftown brief set --file brief.md
|
|
16
|
+
ftown sessions create --parent --worktree --workdir /path/to/repo --name fix-auth \
|
|
17
|
+
--prompt "Fix the auth bug; run the checks; report findings."
|
|
18
|
+
ftown board --wait --until any-done --timeout 300
|
|
19
|
+
ftown brief note "First worker done; reviewing"
|
|
20
|
+
ftown attention list
|
|
25
21
|
ftown harness mail send <worker-id> --type task "Check the expired-token case too"
|
|
26
|
-
ftown sessions tell --children "Pause and report status"
|
|
27
22
|
```
|
|
28
23
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
Loop: spawn children, `ftown board --wait --until any-done --timeout 300`
|
|
25
|
+
(or `any-blocked`/`any-ready`/`all-done`), act, repeat until all are done.
|
|
26
|
+
Children keep cards current; progress goes on the card, never as mail. A
|
|
27
|
+
child's question comes to you first: answer from facts you hold with
|
|
28
|
+
`ftown attention answer`, or escalate preferences and irreversible choices
|
|
29
|
+
with `ftown attention escalate --note`. Mail is for directed instructions,
|
|
30
|
+
results and escalations; read it with `ftown harness mail read`. Each new
|
|
31
|
+
batch nudges the recipient at most once, and a nudge may append a one-line
|
|
32
|
+
digest of child status. Use `ftown sessions screen <worker-id> --limit 100`
|
|
33
|
+
only to investigate terminal detail. Parallel tasks need disjoint write
|
|
34
|
+
ownership and serialized shared resources. Children set their card to done
|
|
35
|
+
and mail their result; you raise one "Work complete" notice for the whole job.
|
|
33
36
|
|
|
34
|
-
After accepting a
|
|
35
|
-
|
|
37
|
+
After accepting a result, follow up before explicit cleanup with
|
|
38
|
+
`ftown sessions remove <worker-id>`, which retires a clean, merged or pushed
|
|
39
|
+
bridge worktree and otherwise keeps it and says why.
|
|
@@ -51,6 +51,81 @@ ftown sessions archive
|
|
|
51
51
|
ftown sessions revive <session-id>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
## Status, board and events
|
|
55
|
+
|
|
56
|
+
Each session has a card: state (`working`, `blocked`, `waiting_review`,
|
|
57
|
+
`done`, `failed`), headline, optional progress, blocker and next step. Keep
|
|
58
|
+
your own card current at meaningful transitions, not every turn. Writing a
|
|
59
|
+
card wakes nobody. The target defaults to `FTOWN_SESSION_ID`; `--session-id
|
|
60
|
+
<id>` selects another session.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Print my card
|
|
64
|
+
ftown status [--json] [--session-id <id>]
|
|
65
|
+
|
|
66
|
+
# Update my card (omitted fields unchanged; first write needs --state and --headline)
|
|
67
|
+
ftown status set [--state <s>] [--headline <t>] [--progress <d>/<t>|--no-progress] \
|
|
68
|
+
[--on human|parent|external|session:<id>] [--text <t>] [--next <t>|--no-next] [--session-id <id>]
|
|
69
|
+
|
|
70
|
+
# Remove my card
|
|
71
|
+
ftown status clear [--session-id <id>]
|
|
72
|
+
|
|
73
|
+
# One line per child of my tree
|
|
74
|
+
ftown board [--json] [--since <n>] [--ready] [--all] [--session-id <id>]
|
|
75
|
+
|
|
76
|
+
# Wait until a board condition holds
|
|
77
|
+
ftown board [--wait --until any-change|any-done|any-blocked|all-done|any-ready [--timeout <s≤300>]] [--session-id <id>]
|
|
78
|
+
|
|
79
|
+
# Tree events for my tree (status, attention, pr, preview, exit, idle, result, mail)
|
|
80
|
+
ftown events [--json] [--since <n>] [--limit <n>] [--wait [--timeout <s≤300>]] [--session-id <id>]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`--ready` lists only children whose PR checks passed and who are not done;
|
|
84
|
+
`--all` includes archived/completed children; `--since <n>` limits the board
|
|
85
|
+
to children with events after that cursor (the board prints its cursor).
|
|
86
|
+
Pass the cursor back as `--since` to see only what changed.
|
|
87
|
+
|
|
88
|
+
Exit codes for `status`, `board` and `events`: 0 ok, 1 error, 2 usage,
|
|
89
|
+
3 wait timed out with the condition unmet.
|
|
90
|
+
|
|
91
|
+
## Manager brief
|
|
92
|
+
|
|
93
|
+
A coordinating session keeps a markdown brief plus timestamped notes; the
|
|
94
|
+
dashboard overview renders the brief, the last 10 notes and the session's
|
|
95
|
+
children automatically. The target defaults to `FTOWN_SESSION_ID`.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
ftown brief show [--json] [--session-id <id>]
|
|
99
|
+
ftown brief set (--file <path.md> | --text <t> | --clear) [--session-id <id>]
|
|
100
|
+
ftown brief note <text...> [--session-id <id>]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Text is markdown, at most 16384 characters; a note is a single line of
|
|
104
|
+
1–280 characters; at most 50 notes are kept (oldest dropped). Control
|
|
105
|
+
characters except newline and tab are stripped; text over the limit is an
|
|
106
|
+
error (exit 1), never truncated.
|
|
107
|
+
|
|
108
|
+
## Worktrees
|
|
109
|
+
|
|
110
|
+
Children that write code can get a bridge-created git worktree. The default
|
|
111
|
+
branch is `ftown/<slug(name)>` at `<repoRoot>/.claude/worktrees/<slug(name)>`;
|
|
112
|
+
the base defaults to the current branch of the working directory (a detached
|
|
113
|
+
HEAD needs `--base`). Only bridge-created worktrees are ever removed.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
ftown sessions create --parent --worktree [--branch <b>] [--base <ref>] [--workdir <dir>]
|
|
117
|
+
ftown sessions remove <id> [--keep-worktree | --force-worktree]
|
|
118
|
+
ftown worktrees list [--json]
|
|
119
|
+
ftown worktrees prune [--json]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
On remove, a clean worktree whose branch is merged or fully pushed is
|
|
123
|
+
retired (worktree removed; the branch is deleted only when merged);
|
|
124
|
+
otherwise it is retained and the command prints why (for example
|
|
125
|
+
`worktree retained: 2 unpushed commits`). `--keep-worktree` always retains,
|
|
126
|
+
`--force-worktree` forces removal. `prune` applies the same rule to archived
|
|
127
|
+
sessions only.
|
|
128
|
+
|
|
54
129
|
## Preview session files
|
|
55
130
|
|
|
56
131
|
```bash
|
|
@@ -146,7 +221,9 @@ Attention persists an `agent_needs_input` event, returns its exact ID and update
|
|
|
146
221
|
the existing dashboard attention flow. Logical duplicate unresolved requests
|
|
147
222
|
coalesce while recording occurrences; resolving it permits a new incident.
|
|
148
223
|
Only creation triggers notification, and hosted push remains opt-in with existing
|
|
149
|
-
session/harness eligibility.
|
|
224
|
+
session/harness eligibility. For a parent-routed item, creation notifies only
|
|
225
|
+
the parent; the dashboard notice and push fire if it is escalated to the human.
|
|
226
|
+
Do not automatically retry an uncertain mutation.
|
|
150
227
|
Acknowledging/resolving an event never answers or approves a CLI prompt.
|
|
151
228
|
|
|
152
229
|
### Questions and answers
|
|
@@ -186,6 +263,37 @@ FTown session follow the same path and are answered from the dashboard inbox.
|
|
|
186
263
|
The terminal picker appears only if the human chooses "Answer in terminal" or
|
|
187
264
|
after an hour.
|
|
188
265
|
|
|
266
|
+
### Parent-first routing
|
|
267
|
+
|
|
268
|
+
When the asking session has a running parent, the request goes to the parent
|
|
269
|
+
first: the parent receives one waking escalation mail (`[ftown question ...]`)
|
|
270
|
+
naming the commands below, and the human's inbox shows the item greyed as
|
|
271
|
+
"with parent" (the human may still answer it). There is no timer; only the
|
|
272
|
+
parent, or the parent stopping while the item is open, moves it to the human.
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Open parent-routed questions from my children (plain: `<child> <eventId> <title>` plus options)
|
|
276
|
+
ftown attention list [--json]
|
|
277
|
+
|
|
278
|
+
# Answer a child's question (as the parent)
|
|
279
|
+
ftown attention answer <child-id> <event-id> (--option <n|label>... | --text <t> | --answers-json <json>) [--json]
|
|
280
|
+
|
|
281
|
+
# Raise it to the human instead (note at most 500 characters)
|
|
282
|
+
ftown attention escalate <child-id> <event-id> [--note <t>] [--json]
|
|
283
|
+
|
|
284
|
+
# Bypass the parent: only the human can provide this
|
|
285
|
+
ftown sessions attention --to human --message "Please paste the API token" --title "Credential needed"
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Answer only from facts you hold — the plan, the agreed contract, earlier
|
|
289
|
+
human answers. Preferences and irreversible choices are escalated, not
|
|
290
|
+
answered. A parent answer is delivered exactly like a human answer (live
|
|
291
|
+
waiter, or mail whose sender is the parent session).
|
|
292
|
+
|
|
293
|
+
Exit codes for `ftown attention`: 0 ok, 1 error, 2 usage, 4 forbidden (the
|
|
294
|
+
caller is not the child's parent), 5 conflict (already resolved or already
|
|
295
|
+
escalated to the human).
|
|
296
|
+
|
|
189
297
|
PR links accept only HTTPS GitHub `/owner/repo/pull/<positive-number>` URLs.
|
|
190
298
|
Outer whitespace, query/fragment and a trailing slash are normalized; credentials,
|
|
191
299
|
nondefault ports and other paths/hosts are rejected. No GitHub request is made.
|
|
@@ -213,8 +321,12 @@ reports the conversation id and delivers mail at turn end.
|
|
|
213
321
|
Grok and Antigravity hooks do not run in the interactive TUI until the folder
|
|
214
322
|
has been trusted in that CLI's own trust prompt; the owner answers it once per
|
|
215
323
|
folder, and ftown does not bypass it.
|
|
216
|
-
Cursor and shell sessions rely on
|
|
217
|
-
mail read` instead.
|
|
324
|
+
Cursor and shell sessions rely on a one-line nudge to run `ftown harness
|
|
325
|
+
mail read` instead. Each new batch of mail nudges the recipient at most once;
|
|
326
|
+
un-read mail stays in the inbox. Mail types are `message`, `task`, `result`,
|
|
327
|
+
`escalation` and `fyi`; `fyi` is for non-urgent notes and never wakes the
|
|
328
|
+
recipient. Progress and status go on the session card (see above), never as
|
|
329
|
+
mail.
|
|
218
330
|
|
|
219
331
|
```bash
|
|
220
332
|
# Tell a specific session
|
|
@@ -250,6 +362,9 @@ Fan-out targets are messaged sequentially, one JSON result line per target.
|
|
|
250
362
|
| `--command` | Full command override (skips `--shell` builder) |
|
|
251
363
|
| `--parent` | Set parent to `$FTOWN_SESSION_ID` |
|
|
252
364
|
| `--parent-id` | Explicit parent session UUID |
|
|
365
|
+
| `--worktree` | Create a bridge-owned git worktree for the session (see Worktrees) |
|
|
366
|
+
| `--branch <b>` | Worktree branch (requires `--worktree`; default `ftown/<slug(name)>`) |
|
|
367
|
+
| `--base <ref>` | Ref the worktree branch starts from (requires `--worktree`) |
|
|
253
368
|
| `--model` | Harness model name or provider/model pattern (when supported) |
|
|
254
369
|
|
|
255
370
|
Provider-flavored shells (`zai`, `kimi`, `deepseek`, `fireworks`) run Claude
|
|
@@ -265,15 +380,16 @@ ftown sessions list
|
|
|
265
380
|
ftown sessions create --prompt "Run tests and report" --workdir "$PWD" --parent
|
|
266
381
|
# -> note session.id from JSON
|
|
267
382
|
|
|
268
|
-
ftown
|
|
383
|
+
ftown board --wait --until any-done --timeout 300
|
|
384
|
+
ftown board
|
|
269
385
|
ftown sessions grep <child-id> --pattern 'FAIL|Error'
|
|
270
386
|
```
|
|
271
387
|
|
|
272
388
|
### Completion handoff
|
|
273
389
|
|
|
274
|
-
|
|
275
|
-
FTown session before the completion notice.
|
|
276
|
-
task is complete, before the final handoff. Replace the sample URL and summary
|
|
390
|
+
A top-level session (no parent): when the task creates or updates a GitHub PR,
|
|
391
|
+
associate its actual URL with the FTown session before the completion notice.
|
|
392
|
+
Then request user attention once the task is complete, before the final handoff. Replace the sample URL and summary
|
|
277
393
|
below with truthful outcomes and checks (including checks not run):
|
|
278
394
|
|
|
279
395
|
```bash
|
|
@@ -287,8 +403,10 @@ For tasks without a PR, omit the PR command and PR summary. Use the verified
|
|
|
287
403
|
|
|
288
404
|
Send one completion request per completed task, not repeated per-turn notices.
|
|
289
405
|
Logical duplicate coalescing does not justify retries after an uncertain outcome;
|
|
290
|
-
inspect the existing request first, as described above. Child agents
|
|
291
|
-
|
|
406
|
+
inspect the existing request first, as described above. Child agents do not
|
|
407
|
+
raise "Work complete": they set their card to `done` and send their assigned
|
|
408
|
+
result to the parent, and the parent raises one completion notice for the
|
|
409
|
+
whole job.
|
|
292
410
|
|
|
293
411
|
## Environment
|
|
294
412
|
|
|
@@ -319,7 +437,14 @@ The CLI wraps the loopback API. Raw access if needed:
|
|
|
319
437
|
| GET | `/api/sessions` | List |
|
|
320
438
|
| POST | `/api/sessions` | Create |
|
|
321
439
|
| PATCH | `/api/sessions/:id` | Rename, move or associate a PR (`{ name?, parentSessionId?, pullRequestUrl? }`; `null` detaches/clears) |
|
|
322
|
-
| POST | `/api/sessions/:id/attention` | Request
|
|
440
|
+
| POST | `/api/sessions/:id/attention` | Request input (`{ message, title?, questions?, to?: 'human' }`) → `{ event }`; invalid `questions` → 400 `invalid_prompt` |
|
|
441
|
+
| POST | `/api/sessions/:id/attention/:eventId/answer` | Parent answers a child (`{ answers }`); 403 not the parent, 409 resolved |
|
|
442
|
+
| POST | `/api/sessions/:id/attention/:eventId/escalate` | Parent raises it to the human (`{ note? }`); 403 not the parent, 409 already human/resolved |
|
|
443
|
+
| GET | `/api/sessions/:id/attention/routed` | Open parent-routed items of my children → `{ items }` |
|
|
444
|
+
| GET/PUT/DELETE | `/api/sessions/:id/brief` | Read, set/clear (`{ text: string \| null }`) or delete the manager brief |
|
|
445
|
+
| POST | `/api/sessions/:id/brief/notes` | Append a brief note (`{ text }`) |
|
|
446
|
+
| GET | `/api/worktrees` | List bridge-owned worktrees with git status |
|
|
447
|
+
| POST | `/api/worktrees/prune` | Retire eligible archived worktrees → `{ removed, retained }` |
|
|
323
448
|
| GET | `/api/sessions/:id/attention/:eventId` | Read one item (`?waitSeconds=0..25` long-polls until resolved) → `{ event }`; 404 `attention_not_found` |
|
|
324
449
|
| POST | `/api/sessions/:id/attention/ask` | Harness hook: record an AskUserQuestion (`{ toolName, toolUseId, toolInput }`) → `{ event }` or `null` if not promptable |
|
|
325
450
|
| GET | `/api/sessions/:id/screen` | Terminal lines |
|
|
@@ -331,7 +456,7 @@ The CLI wraps the loopback API. Raw access if needed:
|
|
|
331
456
|
| POST | `/api/sessions/:id/message` | Inject a message line as keystrokes (`{ text, from? }`) |
|
|
332
457
|
| PUT | `/api/sessions/:id/preview` | Replace or add preview files, local CLI only (`{ paths: string[], mode: 'replace' \| 'add' }`) |
|
|
333
458
|
| DELETE | `/api/sessions/:id/preview` | Remove preview files by name or clear the preview, local CLI only (`{ names?: string[] }`; absent names clears all) |
|
|
334
|
-
| DELETE | `/api/sessions/:id` | Remove (tombstone-archived) |
|
|
459
|
+
| DELETE | `/api/sessions/:id` | Remove (tombstone-archived; `?worktree=keep\|force` overrides worktree retirement) |
|
|
335
460
|
| GET | `/api/archive` | List removed-session tombstones |
|
|
336
461
|
| POST | `/api/sessions/:id/revive` | Recreate a removed session (new id) |
|
|
337
462
|
|