ftown-bridge 0.30.48 → 0.30.49

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.
Files changed (43) hide show
  1. package/dist/browser-access.js +1 -1
  2. package/dist/browser-access.js.map +1 -1
  3. package/dist/command-rpc.d.ts +1 -0
  4. package/dist/command-rpc.js +9 -1
  5. package/dist/command-rpc.js.map +1 -1
  6. package/dist/create-ftown-session.d.ts +5 -1
  7. package/dist/create-ftown-session.js +21 -27
  8. package/dist/create-ftown-session.js.map +1 -1
  9. package/dist/host-resources.d.ts +19 -0
  10. package/dist/host-resources.js +50 -0
  11. package/dist/host-resources.js.map +1 -0
  12. package/dist/index.js +47 -17
  13. package/dist/index.js.map +1 -1
  14. package/dist/local-api-server.d.ts +5 -1
  15. package/dist/local-api-server.js +38 -7
  16. package/dist/local-api-server.js.map +1 -1
  17. package/dist/peer-session-cache.d.ts +27 -0
  18. package/dist/peer-session-cache.js +76 -0
  19. package/dist/peer-session-cache.js.map +1 -0
  20. package/dist/peers-cli.js +20 -5
  21. package/dist/peers-cli.js.map +1 -1
  22. package/dist/security/bridge/permissions.js +6 -2
  23. package/dist/security/bridge/permissions.js.map +1 -1
  24. package/dist/security/bridge/security.d.ts +1 -0
  25. package/dist/security/bridge/security.js +8 -0
  26. package/dist/security/bridge/security.js.map +1 -1
  27. package/dist/session-controller.d.ts +1 -0
  28. package/dist/session-controller.js +25 -12
  29. package/dist/session-controller.js.map +1 -1
  30. package/dist/session-handoff.js +2 -0
  31. package/dist/session-handoff.js.map +1 -1
  32. package/dist/session-parent.d.ts +24 -0
  33. package/dist/session-parent.js +41 -0
  34. package/dist/session-parent.js.map +1 -0
  35. package/dist/sessions-commands.js +12 -6
  36. package/dist/sessions-commands.js.map +1 -1
  37. package/dist/types.d.ts +6 -1
  38. package/dist/wire-types.d.ts +2 -0
  39. package/dist/wire-types.js.map +1 -1
  40. package/package.json +2 -2
  41. package/skills/ftown/SKILL.md +11 -8
  42. package/skills/ftown/references/orchestrator.md +6 -8
  43. package/skills/ftown/references/sessions.md +25 -2
package/dist/types.d.ts CHANGED
@@ -54,6 +54,8 @@ export interface Session {
54
54
  grokSessionId?: string;
55
55
  antigravitySessionId?: string;
56
56
  env?: Record<string, string>;
57
+ projectName?: string;
58
+ parentBridgeId?: string;
57
59
  parentSessionId?: string;
58
60
  requireGreenPr?: boolean;
59
61
  pullRequestUrl?: string;
@@ -131,7 +133,7 @@ export interface Command {
131
133
  payload: CommandPayload;
132
134
  requestId: string;
133
135
  }
134
- export type CommandType = 'get_pull_request_review' | 'get_pull_request_review_chunk' | 'preview_chat_list' | 'preview_chat_send' | 'preview_chat_reply' | 'get_pull_request_statuses' | 'session_preview_status' | 'session_preview_chunk' | 'get_bridge_update' | 'get_direct_address' | 'update_bridge' | 'security_devices' | 'security_invite' | 'security_revoke' | 'ledger_head' | 'ledger_chain' | 'create_session' | 'stop_session' | 'list_sessions' | 'get_history' | 'dismiss_session_block' | 'retry_session' | 'send_message' | 'rename_session' | 'remove_session' | 'bridge_exec' | 'clear_terminal' | 'update_session_parent' | 'get_session_usage' | 'get_sessions_usage' | 'get_session_attention' | 'get_attention_summary' | 'resolve_session_attention' | 'answer_session_attention' | 'get_session_board' | 'get_model_routing' | 'set_model_routing' | 'get_accounts' | 'handoff_session' | 'list_native_sessions';
136
+ export type CommandType = 'get_pull_request_review' | 'get_pull_request_review_chunk' | 'preview_chat_list' | 'preview_chat_send' | 'preview_chat_reply' | 'get_pull_request_statuses' | 'session_preview_status' | 'session_preview_chunk' | 'get_bridge_update' | 'get_direct_address' | 'update_bridge' | 'security_devices' | 'security_invite' | 'security_revoke' | 'ledger_head' | 'ledger_chain' | 'create_session' | 'stop_session' | 'list_sessions' | 'get_host_resources' | 'get_history' | 'dismiss_session_block' | 'retry_session' | 'send_message' | 'rename_session' | 'remove_session' | 'bridge_exec' | 'clear_terminal' | 'update_session_parent' | 'get_session_usage' | 'get_sessions_usage' | 'get_session_attention' | 'get_attention_summary' | 'resolve_session_attention' | 'answer_session_attention' | 'get_session_board' | 'get_model_routing' | 'set_model_routing' | 'get_accounts' | 'handoff_session' | 'list_native_sessions';
135
137
  export interface GetSessionAttentionPayload {
136
138
  bridgeId: string;
137
139
  sessionId: string;
@@ -167,6 +169,8 @@ export interface CreateSessionPayload {
167
169
  museSessionId?: string;
168
170
  grokSessionId?: string;
169
171
  antigravitySessionId?: string;
172
+ projectName?: string;
173
+ parentBridgeId?: string;
170
174
  parentSessionId?: string;
171
175
  requireGreenPr?: boolean;
172
176
  /** @deprecated Ignored compatibility input. Ordinary sessions use task + parent. */
@@ -199,6 +203,7 @@ export interface RenameSessionPayload {
199
203
  }
200
204
  export interface UpdateSessionParentPayload {
201
205
  sessionId: string;
206
+ parentBridgeId?: string;
202
207
  parentSessionId: string | null;
203
208
  }
204
209
  export interface RemoveSessionPayload {
@@ -49,6 +49,8 @@ export interface Session {
49
49
  model?: string;
50
50
  account?: string;
51
51
  allowedAccounts?: string[];
52
+ projectName?: string;
53
+ parentBridgeId?: string;
52
54
  parentSessionId?: string;
53
55
  pullRequestUrl?: string;
54
56
  /** Historical automation provenance; new sessions cannot set it. */
@@ -1 +1 @@
1
- {"version":3,"file":"wire-types.js","sourceRoot":"","sources":["../src/wire-types.ts"],"names":[],"mappings":"AAAA,0EAA0E;AA6E1E,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AAkBlG,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAA6B,CAAC;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,0DAA0D,CAAC;AAErG;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,UAAmB;IAC9C,OAAO,IAAI,CAAC;AACd,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,iBAAiB,CAAC,CAAc;IAC9C,OAAO,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACpE,CAAC"}
1
+ {"version":3,"file":"wire-types.js","sourceRoot":"","sources":["../src/wire-types.ts"],"names":[],"mappings":"AAAA,0EAA0E;AA+E1E,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AAkBlG,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAA6B,CAAC;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,0DAA0D,CAAC;AAErG;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,UAAmB;IAC9C,OAAO,IAAI,CAAC;AACd,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,iBAAiB,CAAC,CAAc;IAC9C,OAAO,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACpE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ftown-bridge",
3
- "version": "0.30.48",
3
+ "version": "0.30.49",
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": "f937cce4ee556f900a560db53ca59e9724cdb6f3"
76
+ "gitHead": "af1676165b5c14280aab58e264d19d4f5512e3d4"
77
77
  }
@@ -3,6 +3,8 @@ name: ftown
3
3
  description: >-
4
4
  Control ftown sessions and multi-provider routing: sessions
5
5
  (create/list/read/drive, archive/revive/remove), worktrees, and ftown mail.
6
+ Choose bridges by capacity, transfer folders between paired computers, and
7
+ launch workers under the same project across bridges.
6
8
  Handle human attention and questions routed to the parent first. Support
7
9
  HTML/Markdown previews, HTML preview replies, PR links, status cards and
8
10
  ftown board/events, the manager's plan list (ftown plan), and manager brief.
@@ -48,7 +50,7 @@ entrypoint with `--repair`.
48
50
  ```bash
49
51
  ftown sessions list
50
52
  ftown sessions create --prompt "Review the auth module" --workdir "$PWD" --parent
51
- ftown sessions create --shell claude --account personal --prompt "Review the auth module"
53
+ ftown sessions create --project "App" --shell claude --account personal --prompt "Review the auth module"
52
54
  ftown sessions create --parent --allowed-accounts personal,work --prompt "Delegate account-scoped work"
53
55
  ftown sessions screen <session-id> --limit 200
54
56
  ftown sessions attention --message "Please review the migration plan" --title "Review requested"
@@ -89,8 +91,9 @@ set `FTOWN_BRIDGE`, to run `sessions`, `status`, `board`, `events`,
89
91
 
90
92
  ```bash
91
93
  ftown bridges --probe
94
+ ftown bridges --resources --json
92
95
  ftown sessions list --bridge my-laptop
93
- ftown sessions create --bridge my-laptop --shell codex --workdir ~/src/app --prompt "Run the test suite"
96
+ ftown sessions create --bridge my-laptop --project "App" --shell codex --workdir /srv/app --prompt "Run the test suite"
94
97
  ftown sessions screen <session-id> --bridge my-laptop --limit 100
95
98
  ```
96
99
 
@@ -98,11 +101,11 @@ The first command to another bridge goes through the relay and opens a direct
98
101
  link to it; later commands use that link (`ftown bridges` marks it `direct`).
99
102
  If no direct link can be made, commands keep using the relay.
100
103
 
101
- Requests travel end-to-end encrypted over the account relay; the target bridge
102
- has to run an ftown version with cross-bridge control. Security commands
103
- (pairing, devices, revocation) never work across bridges. `--parent` links
104
- cannot cross bridges, and `harness mail` only reaches sessions on this bridge.
105
- Not available in `--local`/`--solo` mode.
104
+ Use `ftown bridges --resources --json` to choose a host. Compare the local `resources` with each entry’s `peers[].resources`. Check `cpuPercent` (average utilization between samples), `freeRamBytes`, `totalRamBytes`, `freeDiskBytes` (bridge data volume), and `sampledAt` (Unix milliseconds). A null reading means unknown capacity. The dashboard’s new-session picker refreshes these readings every 15 seconds while open. The caller chooses the destination.
105
+
106
+ The sidebar groups sessions by project, then root session, then children across bridges. Supply `--project <name>` for a new root. A child inherits its root’s project. Use `--parent` for a local child or `--bridge <target> --parent` for a remote child. When the caller is already a child, the new session joins the same root, even on a third bridge. Use an absolute `--workdir` on the destination. Account choices on a remote child come from its destination bridge. Security commands and `harness mail` operate on the local bridge. Cross-bridge control requires paired account bridges.
107
+
108
+ For a worker that needs a folder from another machine, see **Copy a folder and launch a worker** in `references/sessions.md`. The recipient runs `ftown transfer receive`, the sender runs `ftown transfer send`, and the worker can start once the transfer reports `installed`. When the folder already exists on the destination, go straight to session creation. Use `ftown sessions list --remembered` to inspect last-known peer sessions from the local bridge.
106
109
 
107
110
  Read `references/sessions.md` for the session, mail and terminal command
108
111
  reference. Read `references/orchestrator.md` for practical worker coordination
@@ -322,7 +325,7 @@ does not copy, link, or read credentials between account directories.
322
325
 
323
326
  Choose an account when starting a session with `ftown sessions create
324
327
  --shell claude --account personal ...` (or `--shell codex`). A child started
325
- with `--parent` inherits the parent's account unless `--account` is supplied.
328
+ on its root’s bridge inherits the root’s account unless `--account` is supplied. For a remote root, choose an account registered on the child’s bridge or use its default.
326
329
  To constrain future children, set `--allowed-accounts personal,work`; the
327
330
  bridge enforces this policy for CLI and API requests, intersecting a child's
328
331
  requested list with inherited restrictions so descendants can only narrow it.
@@ -1,13 +1,14 @@
1
1
  # Worker coordination examples
2
2
 
3
3
  Read `../SKILL.md` for identity, reporting and cleanup, and
4
- `sessions.md` for commands. No special orchestrator mode is needed.
4
+ `sessions.md` for commands.
5
5
 
6
- List existing sessions before creating another worker. Give each worker a
7
- bounded task, clear writable files and checks; save `session.id`. Omit `--shell` to inherit your harness. Before picking a CLI,
6
+ List sessions first. Scope each task, files and checks; save `session.id`. Omit `--shell` to inherit your harness. Before picking a CLI,
8
7
  model and effort, run `ftown quota --json` and follow `quota.md` (owner
9
8
  tiers first); never route to `exhausted`.
10
9
 
10
+ For cross-bridge delegation, use `ftown bridges --resources --json` to compare host capacity. If the destination needs files, follow **Copy a folder and launch a worker** in `sessions.md`.
11
+
11
12
  Keep the plan on the manager, not in a ticket system.
12
13
  Add steps with `ftown plan add` (`--after`/`--priority` set precedence;
13
14
  ready = every `after` done or dropped) and create each child with
@@ -22,16 +23,13 @@ ftown attention list
22
23
  ftown harness mail send <worker-id> --type task "Check the expired-token case"
23
24
  ```
24
25
 
25
- Loop: keep the plan on the manager, create children with `--plan-item`,
26
- `ftown board --wait --until any-done` (or `any-blocked`/`any-ready`/
27
- `all-done`), act, repeat until all are done. Children keep cards current;
26
+ Wait on the board for `any-done`, `any-blocked`, `any-ready` or `all-done`; act and repeat. Children keep cards current;
28
27
  progress goes on the card, never as mail. A child's question comes to you
29
28
  first: answer from facts you hold with `ftown attention answer`, or
30
29
  escalate preferences and irreversible choices
31
30
  with `ftown attention escalate --note`. Mail is for directed
32
31
  instructions, results and escalations; read it with
33
- `ftown harness mail read`. Each mail batch nudges at most once (a digest
34
- may be appended). Use `ftown sessions screen <worker-id> --limit 100`
32
+ `ftown harness mail read`. Use `ftown sessions screen <worker-id> --limit 100`
35
33
  only to investigate. Parallel tasks need disjoint write
36
34
  ownership and serialized shared resources. Children set their card to
37
35
  done and report to the parent; you raise one "Work complete" notice
@@ -453,10 +453,11 @@ Fan-out targets are messaged sequentially, one JSON result line per target.
453
453
  | `--shell` | Explicit harness override: `claude`, `cursor`, `codex`, `grok`, `muse`, `antigravity`, `pi`, `kimi-code`, `opencode`, `shell`, or Claude Code provider flavors `zai`, `kimi`, `deepseek`, `fireworks`. When omitted inside a session, inherits that session's harness; outside a session, defaults to `claude`. |
454
454
  | `--prompt` | Initial task — passed as a CLI launch argument to `claude`/Claude provider flavors/`cursor`/`codex`/`grok`/`muse`/`antigravity`/`pi` (typed after boot for other shells) |
455
455
  | `--workdir` | Working directory |
456
+ | `--project <name>` | Required for a new root. Children inherit their root’s project. |
456
457
  | `--name` | Dashboard label |
457
458
  | `--effort <level>` | Reasoning effort for claude, codex, grok, muse and antigravity (opencode: `--model provider/model#<level>`) |
458
459
  | `--command` | Full command override, run exactly as written: skips the `--shell` builder and the flags it adds for unattended runs (a codex launched this way asks for approvals). Not for setting a model or effort. |
459
- | `--parent` | Set parent to `$FTOWN_SESSION_ID` |
460
+ | `--parent` | Attach to the root of the calling session (`$FTOWN_SESSION_ID`), including when creating on another bridge. |
460
461
  | `--parent-id` | Explicit parent session UUID |
461
462
  | `--plan-item <id>` | Do plan item `p<n>` of the parent (requires `--parent` or `--parent-id`; see Plan list) |
462
463
  | `--worktree` | Create a bridge-owned git worktree for the session (see Worktrees) |
@@ -573,7 +574,29 @@ To move a session under a different parent, PATCH it with the new parent's id:
573
574
  ```
574
575
 
575
576
  Set `parentSessionId` to `null` to detach it from its current parent and move it
576
- back to the bridge root. Parent and child must belong to the same bridge.
577
+ back to the project root. For a parent on another computer, include its bridge ID in `parentBridgeId`. New root sessions require a project name (`--project` on the CLI or `projectName` in the request body).
578
+
579
+ Project visibility is saved on each client. Previous bridge and session hiding preferences no longer filter the sidebar. Use **Hide** on the projects you want to hide on that client. Run `ftown sessions list --remembered` to inspect the local bridge’s last peer snapshots. Browsers retain the last state received directly from each approved computer. A new browser needs to see a computer online once before it can show that computer’s sessions offline.
580
+
581
+ ## Copy a folder and launch a worker
582
+
583
+ Use this workflow when a remote worker needs a one-time copy of local files. Both bridges must belong to the same account and be able to establish a direct link. The recipient needs an unused destination under an existing directory and enough space on that volume for both the snapshot and the extracted files. Keep the source stable during the copy. Transfers support ordinary files and directories and reject symlinks.
584
+
585
+ 1. On the **recipient** (here, `linux`), authorize the sender and reserve the destination. Save the returned receive ID.
586
+ ```bash
587
+ ftown transfer receive /srv/jobs/app-review --bridge mac
588
+ ```
589
+ 2. On the **sender** (`mac`), send the folder using that ID.
590
+ ```bash
591
+ ftown transfer send ./app --bridge linux --id <receive-id>
592
+ ftown transfer status <receive-id>
593
+ ```
594
+ 3. Check status on either computer until it reports `state: installed`. From the parent session on the sender, launch the child in the installed folder.
595
+ ```bash
596
+ ftown sessions create --bridge linux --parent --workdir /srv/jobs/app-review --prompt "Run the tests"
597
+ ```
598
+
599
+ Use `ftown transfer list` to find local transfers or `ftown transfer cancel <receive-id>` to cancel one. If status is `retained`, the recipient has the verified snapshot. Correct the installation problem there and run `ftown transfer retry <receive-id>`, or use `ftown transfer discard <receive-id>` to remove that retained copy.
577
600
 
578
601
  ## If the CLI is missing
579
602