ftown 0.27.0 → 0.28.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/dist/attention-store.js +34 -2
- package/dist/attention-store.js.map +1 -1
- package/dist/command-rpc.d.ts +11 -0
- package/dist/command-rpc.js +79 -15
- package/dist/command-rpc.js.map +1 -1
- package/dist/coordination/board.js +82 -3
- package/dist/coordination/board.js.map +1 -1
- package/dist/coordination/contract-c.d.ts +117 -0
- package/dist/coordination/contract-c.js +47 -0
- package/dist/coordination/contract-c.js.map +1 -0
- package/dist/coordination/contract.d.ts +8 -1
- package/dist/coordination/contract.js +1 -1
- package/dist/coordination/contract.js.map +1 -1
- package/dist/coordination/format.js +37 -11
- package/dist/coordination/format.js.map +1 -1
- package/dist/coordination/plan.d.ts +74 -0
- package/dist/coordination/plan.js +534 -0
- package/dist/coordination/plan.js.map +1 -0
- package/dist/coordination/routes-plan.d.ts +13 -0
- package/dist/coordination/routes-plan.js +182 -0
- package/dist/coordination/routes-plan.js.map +1 -0
- package/dist/coordination/wiring.d.ts +6 -0
- package/dist/coordination/wiring.js +50 -2
- package/dist/coordination/wiring.js.map +1 -1
- package/dist/coordination-cli.d.ts +6 -1
- package/dist/coordination-cli.js +17 -7
- package/dist/coordination-cli.js.map +1 -1
- package/dist/create-ftown-session.d.ts +18 -0
- package/dist/create-ftown-session.js +44 -0
- package/dist/create-ftown-session.js.map +1 -1
- package/dist/ftown-cli.js +5 -2
- package/dist/ftown-cli.js.map +1 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/local-api-server.js +14 -4
- package/dist/local-api-server.js.map +1 -1
- package/dist/local-pair-cli.js +2 -3
- package/dist/local-pair-cli.js.map +1 -1
- package/dist/plan-cli.d.ts +52 -0
- package/dist/plan-cli.js +374 -0
- package/dist/plan-cli.js.map +1 -0
- package/dist/security/bridge/permissions.js +21 -1
- package/dist/security/bridge/permissions.js.map +1 -1
- package/dist/security-cli.d.ts +13 -2
- package/dist/security-cli.js +35 -6
- package/dist/security-cli.js.map +1 -1
- package/dist/sessions-commands.js +10 -0
- package/dist/sessions-commands.js.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/wire-types.d.ts +2 -0
- package/dist/wire-types.js.map +1 -1
- package/muse-plugin/.muse-plugin/plugin.json +41 -1
- package/muse-plugin/hooks/ftown-post-tool-use-failure.sh +27 -0
- package/muse-plugin/hooks/ftown-post-tool-use.sh +26 -0
- package/muse-plugin/hooks/ftown-pre-tool-use.sh +26 -0
- package/muse-plugin/hooks/ftown-user-prompt-submit.sh +26 -0
- package/muse-plugin/lib/ftown-hook.sh +42 -5
- package/opencode-plugin/ftown.js +121 -11
- package/package.json +2 -2
- package/skills/ftown/SKILL.md +42 -0
- package/skills/ftown/references/orchestrator.md +29 -25
- package/skills/ftown/references/sessions.md +64 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ftown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
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": "1d602fcdc7e33f265c1f486ce9e26f03654f4dec"
|
|
77
77
|
}
|
package/skills/ftown/SKILL.md
CHANGED
|
@@ -53,6 +53,9 @@ ftown sessions preview --clear
|
|
|
53
53
|
ftown sessions preview-reply --message "The preview is ready."
|
|
54
54
|
ftown status set --state working --headline "Reviewing the API client" --progress 0/1
|
|
55
55
|
ftown board
|
|
56
|
+
ftown plan
|
|
57
|
+
ftown plan add "Review the API client" --after p1 --priority 1
|
|
58
|
+
ftown sessions create --parent --plan-item p2 --prompt "Review the API client"
|
|
56
59
|
ftown brief set --file brief.md
|
|
57
60
|
ftown attention list
|
|
58
61
|
ftown worktrees list
|
|
@@ -128,6 +131,45 @@ ftown board --wait --until any-done --timeout 300
|
|
|
128
131
|
ftown events --wait
|
|
129
132
|
```
|
|
130
133
|
|
|
134
|
+
Plain `ftown board` appends a `planned` section with up to 5 ready plan
|
|
135
|
+
items (`→ <id> <title>`, then `+N more`). `ftown board --all` also shows
|
|
136
|
+
retired (archived) children after the live ones, suffixed `(retired)`.
|
|
137
|
+
Tree events include the `plan` kind for plan changes and `removed` when a
|
|
138
|
+
child is removed or archived while not already exited.
|
|
139
|
+
|
|
140
|
+
## Plan list
|
|
141
|
+
|
|
142
|
+
Keep the plan on the manager: `ftown plan` defaults to your own session
|
|
143
|
+
(`$FTOWN_SESSION_ID`, the manager), and `--session-id <id>` targets another
|
|
144
|
+
session's plan. This is the manager's plan, not a ticket system — it is a
|
|
145
|
+
short ordered todo list the manager keeps for its own coordination. Add
|
|
146
|
+
items, order them with precedence, and link each child to one item:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
ftown plan [--json] [--session-id <id>]
|
|
150
|
+
ftown plan add <title...> [--note <t>] [--after <id,id>] [--priority 1|2|3]
|
|
151
|
+
ftown plan start <id> --session <child-id>
|
|
152
|
+
ftown plan done <id>
|
|
153
|
+
ftown plan drop <id>
|
|
154
|
+
ftown plan todo <id>
|
|
155
|
+
ftown plan edit <id> [--title <t>] [--note <t>|--no-note] [--after <ids>|--no-after] [--priority n]
|
|
156
|
+
ftown plan rm <id>
|
|
157
|
+
ftown sessions create --parent --plan-item <id> --prompt "<task>"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Precedence comes from `--after <id,id>` and `--priority 1|2|3` (1 is
|
|
161
|
+
highest). An item is ready when it is `todo` and every item in its `after`
|
|
162
|
+
list is `done` or `dropped`; the list shows `→` ready, `·` waiting, `▸`
|
|
163
|
+
started, `✓` done and `✗` dropped. Creating a child with `--plan-item <id>`
|
|
164
|
+
requires a parent, fails before creating anything when the item is unknown
|
|
165
|
+
or not `todo`, and otherwise marks the item `started` with that child
|
|
166
|
+
linked. When the linked child's card becomes `done`, its item becomes
|
|
167
|
+
`done` too; a `failed` card leaves the item `started` for the manager to
|
|
168
|
+
decide. `ftown plan start <id> --session <child-id>` links an existing
|
|
169
|
+
child by hand, and `done`/`drop`/`todo` set the state directly. Every plan
|
|
170
|
+
change emits one `plan` tree event (`<id> <state>: <title>`, plus
|
|
171
|
+
` → ready: …` when items become ready). Exit codes: 0 ok, 1 error, 2 usage.
|
|
172
|
+
|
|
131
173
|
**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
174
|
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
175
|
|
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
# Worker coordination examples
|
|
2
2
|
|
|
3
|
-
Read `../SKILL.md` for identity, reporting and cleanup
|
|
4
|
-
`sessions.md` for the command reference.
|
|
5
|
-
requested task and parent link; no special orchestrator mode is needed.
|
|
3
|
+
Read `../SKILL.md` for identity, reporting and cleanup, and
|
|
4
|
+
`sessions.md` for the command reference. No special orchestrator mode is needed.
|
|
6
5
|
|
|
7
6
|
List existing sessions before creating another worker. Give each worker a
|
|
8
|
-
bounded task, clear writable files and
|
|
9
|
-
`session.id`. Omit `--shell` to inherit your harness.
|
|
10
|
-
|
|
11
|
-
CLI, model and effort, run `ftown quota --json` and follow `quota.md` (owner
|
|
7
|
+
bounded task, clear writable files and checks; save the returned
|
|
8
|
+
`session.id`. Omit `--shell` to inherit your harness. Before picking a CLI,
|
|
9
|
+
model and effort, run `ftown quota --json` and follow `quota.md` (owner
|
|
12
10
|
tiers first); never route to `exhausted`.
|
|
13
11
|
|
|
12
|
+
Keep the plan on the manager — the manager's plan, not a ticket system.
|
|
13
|
+
Add steps with `ftown plan add` (`--after`/`--priority` set precedence;
|
|
14
|
+
ready = every `after` done or dropped) and create each child with
|
|
15
|
+
`--plan-item`, so its item starts and completes with the child:
|
|
16
|
+
|
|
14
17
|
```bash
|
|
15
18
|
ftown brief set --file brief.md
|
|
16
|
-
ftown
|
|
17
|
-
|
|
19
|
+
ftown plan add "Fix the auth bug" --priority 1
|
|
20
|
+
ftown sessions create --parent --plan-item p1 --worktree --workdir /path/to/repo --name fix-auth --prompt "Fix auth; run checks."
|
|
18
21
|
ftown board --wait --until any-done --timeout 300
|
|
19
|
-
ftown brief note "First worker done; reviewing"
|
|
20
22
|
ftown attention list
|
|
21
|
-
ftown harness mail send <worker-id> --type task "Check the expired-token case
|
|
23
|
+
ftown harness mail send <worker-id> --type task "Check the expired-token case"
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
Loop:
|
|
25
|
-
(or `any-blocked`/`any-ready
|
|
26
|
-
|
|
27
|
-
child's question comes to you
|
|
28
|
-
`ftown attention answer`, or
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
and
|
|
26
|
+
Loop: keep the plan on the manager, create children with `--plan-item`,
|
|
27
|
+
`ftown board --wait --until any-done` (or `any-blocked`/`any-ready`/
|
|
28
|
+
`all-done`), act, repeat until all are done. Children keep cards current;
|
|
29
|
+
progress goes on the card, never as mail. A child's question comes to you
|
|
30
|
+
first: answer from facts you hold with `ftown attention answer`, or
|
|
31
|
+
escalate preferences and irreversible choices
|
|
32
|
+
with `ftown attention escalate --note`. Mail is for directed
|
|
33
|
+
instructions, results and escalations; read it with
|
|
34
|
+
`ftown harness mail read`. Each mail batch nudges at most once (a digest
|
|
35
|
+
may be appended). Use `ftown sessions screen <worker-id> --limit 100`
|
|
36
|
+
only to investigate. Parallel tasks need disjoint write
|
|
37
|
+
ownership and serialized shared resources. Children set their card to
|
|
38
|
+
done and report to the parent; you raise one "Work complete" notice
|
|
39
|
+
for the whole job.
|
|
36
40
|
|
|
37
|
-
After accepting a result,
|
|
41
|
+
After accepting a result, clean up with
|
|
38
42
|
`ftown sessions remove <worker-id>`, which retires a clean, merged or pushed
|
|
39
|
-
|
|
43
|
+
worktree and otherwise keeps it and says why.
|
|
@@ -76,18 +76,73 @@ ftown board [--json] [--since <n>] [--ready] [--all] [--session-id <id>]
|
|
|
76
76
|
# Wait until a board condition holds
|
|
77
77
|
ftown board [--wait --until any-change|any-done|any-blocked|all-done|any-ready [--timeout <s≤300>]] [--session-id <id>]
|
|
78
78
|
|
|
79
|
-
# Tree events for my tree (status, attention, pr, preview, exit, idle, result, mail)
|
|
79
|
+
# Tree events for my tree (status, attention, pr, preview, exit, idle, result, mail, plan, removed)
|
|
80
80
|
ftown events [--json] [--since <n>] [--limit <n>] [--wait [--timeout <s≤300>]] [--session-id <id>]
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
`--ready` lists only children whose PR checks passed and who are not done;
|
|
84
|
-
`--all` includes archived
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
`--all` includes retired (archived) children after the live ones, newest
|
|
85
|
+
first, capped at 50 and suffixed `(retired)` in plain output; `--since <n>`
|
|
86
|
+
limits the board to children with events after that cursor (the board
|
|
87
|
+
prints its cursor). Pass the cursor back as `--since` to see only what
|
|
88
|
+
changed. Plain board output appends a `planned` section after the child
|
|
89
|
+
rows: up to 5 ready plan items as `→ <id> <title>`, then `+N more` when
|
|
90
|
+
more are ready.
|
|
91
|
+
|
|
92
|
+
Tree events also include `plan` (one per plan change, summary
|
|
93
|
+
`<id> <state>: <title>`, plus ` → ready: <id>, …` when items become ready)
|
|
94
|
+
and `removed` (summary `removed`, when a child is removed or archived
|
|
95
|
+
while not already exited).
|
|
87
96
|
|
|
88
97
|
Exit codes for `status`, `board` and `events`: 0 ok, 1 error, 2 usage,
|
|
89
98
|
3 wait timed out with the condition unmet.
|
|
90
99
|
|
|
100
|
+
## Plan list
|
|
101
|
+
|
|
102
|
+
The plan is the manager's plan, not a ticket system: a todo list with
|
|
103
|
+
precedence stored on the manager (parent) session. It defaults to
|
|
104
|
+
`FTOWN_SESSION_ID`; `--session-id <id>` targets another session's plan.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# List in plan order (--json passes the PlanView through)
|
|
108
|
+
ftown plan [--json] [--session-id <id>]
|
|
109
|
+
|
|
110
|
+
# Add (title is the remaining words; precedence via --after/--priority)
|
|
111
|
+
ftown plan add <title...> [--note <t>] [--after <id,id>] [--priority 1|2|3] [--session-id <id>]
|
|
112
|
+
|
|
113
|
+
# Link an existing child, or set state directly
|
|
114
|
+
ftown plan start <id> --session <child-id> [--session-id <id>]
|
|
115
|
+
ftown plan done <id> [--session-id <id>]
|
|
116
|
+
ftown plan drop <id> [--session-id <id>]
|
|
117
|
+
ftown plan todo <id> [--session-id <id>]
|
|
118
|
+
|
|
119
|
+
# Edit or remove (removing strips the id from other items' after lists)
|
|
120
|
+
ftown plan edit <id> [--title <t>] [--note <t>|--no-note] [--after <ids>|--no-after] [--priority n] [--session-id <id>]
|
|
121
|
+
ftown plan rm <id> [--session-id <id>]
|
|
122
|
+
|
|
123
|
+
# Create a child for a plan item (marks it started, linked to the child)
|
|
124
|
+
ftown sessions create --parent --plan-item <id> --prompt "<task>"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
List marks: `→` ready, `·` waiting, `▸` started, `✓` done, `✗` dropped,
|
|
128
|
+
printed as `<mark> <id> [P<priority>] <title>` plus `(after p1,p2)` or
|
|
129
|
+
`→ <child name>` when linked. Ordering is ready first, then waiting (both
|
|
130
|
+
by priority ascending, then creation time), then started, done and
|
|
131
|
+
dropped. An item is ready when it is `todo` and every item in its `after`
|
|
132
|
+
list is `done` or `dropped`; precedence is set only with `--after` and
|
|
133
|
+
`--priority` (1 is highest). Item ids are `p<n>` and are never reused.
|
|
134
|
+
Limits: 200 items, title 140 characters, note 500, at most 20 `after`
|
|
135
|
+
ids; `after` ids must exist, with no self-reference or cycles.
|
|
136
|
+
|
|
137
|
+
`--plan-item <id>` (on `ftown sessions create`, requires `--parent` or
|
|
138
|
+
`--parent-id`) fails with an error before any session is created when the
|
|
139
|
+
item is unknown or not `todo`; after creation the item becomes `started`
|
|
140
|
+
with the child linked, and a linking failure only warns (the session
|
|
141
|
+
stays). When a linked child's card becomes `done`, the item becomes
|
|
142
|
+
`done`; a `failed` card leaves it `started` for the manager to decide.
|
|
143
|
+
Setting an item back to `todo` clears its linked session. Exit codes for
|
|
144
|
+
`ftown plan`: 0 ok, 1 error, 2 usage.
|
|
145
|
+
|
|
91
146
|
## Manager brief
|
|
92
147
|
|
|
93
148
|
A coordinating session keeps a markdown brief plus timestamped notes; the
|
|
@@ -362,6 +417,7 @@ Fan-out targets are messaged sequentially, one JSON result line per target.
|
|
|
362
417
|
| `--command` | Full command override (skips `--shell` builder) |
|
|
363
418
|
| `--parent` | Set parent to `$FTOWN_SESSION_ID` |
|
|
364
419
|
| `--parent-id` | Explicit parent session UUID |
|
|
420
|
+
| `--plan-item <id>` | Do plan item `p<n>` of the parent (requires `--parent` or `--parent-id`; see Plan list) |
|
|
365
421
|
| `--worktree` | Create a bridge-owned git worktree for the session (see Worktrees) |
|
|
366
422
|
| `--branch <b>` | Worktree branch (requires `--worktree`; default `ftown/<slug(name)>`) |
|
|
367
423
|
| `--base <ref>` | Ref the worktree branch starts from (requires `--worktree`) |
|
|
@@ -443,6 +499,10 @@ The CLI wraps the loopback API. Raw access if needed:
|
|
|
443
499
|
| GET | `/api/sessions/:id/attention/routed` | Open parent-routed items of my children → `{ items }` |
|
|
444
500
|
| GET/PUT/DELETE | `/api/sessions/:id/brief` | Read, set/clear (`{ text: string \| null }`) or delete the manager brief |
|
|
445
501
|
| POST | `/api/sessions/:id/brief/notes` | Append a brief note (`{ text }`) |
|
|
502
|
+
| GET | `/api/sessions/:id/plan` | Read the plan (`PlanView`: ordered items plus ready ids) |
|
|
503
|
+
| POST | `/api/sessions/:id/plan` | Add a plan item (`{ title, note?, after?, priority? }`) → `{ item }` |
|
|
504
|
+
| PATCH | `/api/sessions/:id/plan/:itemId` | Edit a plan item (`{ title?, note?: string\|null, after?, priority?, state?, sessionId?: string\|null }`) → `{ item }`; item id is `p<n>` |
|
|
505
|
+
| DELETE | `/api/sessions/:id/plan/:itemId` | Remove a plan item (strips it from other items' `after`) → `{ ok: true }` |
|
|
446
506
|
| GET | `/api/worktrees` | List bridge-owned worktrees with git status |
|
|
447
507
|
| POST | `/api/worktrees/prune` | Retire eligible archived worktrees → `{ removed, retained }` |
|
|
448
508
|
| GET | `/api/sessions/:id/attention/:eventId` | Read one item (`?waitSeconds=0..25` long-polls until resolved) → `{ event }`; 404 `attention_not_found` |
|