ftown-bridge 0.30.64 → 0.30.68
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/browser-access.js +1 -1
- package/dist/browser-access.js.map +1 -1
- package/dist/cli-client.js +1 -1
- package/dist/cli-client.js.map +1 -1
- package/dist/command-rpc.js +3 -2
- package/dist/command-rpc.js.map +1 -1
- package/dist/gzip.d.ts +2 -0
- package/dist/gzip.js +43 -0
- package/dist/gzip.js.map +1 -0
- package/dist/harness-commands.js +1 -1
- package/dist/host-resources-protocol.d.ts +14 -0
- package/dist/host-resources-protocol.js +8 -0
- package/dist/host-resources-protocol.js.map +1 -0
- package/dist/host-resources.d.ts +4 -11
- package/dist/host-resources.js +26 -10
- package/dist/host-resources.js.map +1 -1
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/dist/local-pair-cli.js +1 -1
- package/dist/local-pair-cli.js.map +1 -1
- package/dist/peer-control.js +2 -1
- package/dist/peer-control.js.map +1 -1
- package/dist/peers-cli.js +2 -1
- package/dist/peers-cli.js.map +1 -1
- package/dist/preview-protocol.d.ts +6 -1
- package/dist/preview-protocol.js +1 -1
- package/dist/preview-protocol.js.map +1 -1
- package/dist/quota-cli.js +6 -6
- package/dist/security/application-compression.d.ts +6 -0
- package/dist/security/application-compression.js +40 -0
- package/dist/security/application-compression.js.map +1 -0
- package/dist/security/bridge/local-client.js +6 -3
- package/dist/security/bridge/local-client.js.map +1 -1
- package/dist/security/bridge/security.d.ts +2 -1
- package/dist/security/bridge/security.js +25 -6
- package/dist/security/bridge/security.js.map +1 -1
- package/dist/session-controller.d.ts +1 -1
- package/dist/session-controller.js +6 -5
- package/dist/session-controller.js.map +1 -1
- package/dist/session-preview.d.ts +9 -2
- package/dist/session-preview.js +80 -26
- package/dist/session-preview.js.map +1 -1
- package/dist/sessions-commands.js +1 -1
- package/dist/sessions-commands.js.map +1 -1
- package/package.json +2 -2
- package/pi-extension/API.md +6 -2
- package/pi-extension/ftown.js +16 -6
- package/skills/ftown/SKILL.md +6 -9
- package/skills/ftown/references/sessions.md +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ftown-bridge",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.68",
|
|
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": "6cc27d4b810923e3337beb3c2002d5a6a1220d70"
|
|
77
77
|
}
|
package/pi-extension/API.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Pi and Oh My Pi (OMP) load the bundled extension, which exposes ftown's authenticated local bridge API as a small set of model-callable tools. It uses camel-case JSON, opaque string identifiers, plural resource names, and wrapped success objects. Failures are returned as a tool error with a sanitized `{ "error": string }` detail object.
|
|
4
4
|
|
|
5
|
+
The [ftown skill](../skills/ftown/SKILL.md) documents the shell commands shared across harnesses. The tool names and JSON inputs below apply to the Pi and OMP extension.
|
|
6
|
+
|
|
5
7
|
## Resource model
|
|
6
8
|
|
|
7
9
|
| Resource | Identity | Relationships | Lifecycle |
|
|
@@ -10,16 +12,18 @@ Pi and Oh My Pi (OMP) load the bundled extension, which exposes ftown's authenti
|
|
|
10
12
|
| Discussion thread | Thread ID | Belongs to a project channel on the project’s home bridge | Read and post with `ftown discuss`, reply with `ftown_discuss` |
|
|
11
13
|
| Mail message | Assigned by the session inbox | Direct session messages can be grouped by inbox thread | Send, peek/read, delivered |
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Tools that access the bridge use the local bridge selected by `FTOWN_HOOK_PORT` or `~/.ftown/bridge.json`. The extension supplies that bridge's bearer token and never sends credentials to the model.
|
|
14
16
|
|
|
15
17
|
## Tool contract
|
|
16
18
|
|
|
17
19
|
| Tool | Operation | Required input | Result | Mutation |
|
|
18
20
|
| --- | --- | --- | --- | --- |
|
|
21
|
+
| `ftown_ask_user` | — | `question` | Interactive answer or cancellation | No |
|
|
19
22
|
| `ftown_mail` | `send` | `target`, `body` | Stored direct session message | Yes |
|
|
20
23
|
| `ftown_discuss` | `reply` | `project`, `threadId`, `text` | Stored thread post ID | Yes |
|
|
21
24
|
| `ftown_mail` | `read` | None | `{ messages }` for the current session | No |
|
|
22
25
|
| `ftown_sessions` | `list` | None | `{ sessions }` | No |
|
|
26
|
+
| `ftown_sessions` | `children` | None | Child sessions of `target` or the current session | No |
|
|
23
27
|
| `ftown_sessions` | `archive` | None | `{ archived }` tombstones | No |
|
|
24
28
|
| `ftown_sessions` | `get` | `target` | `{ session }` | No |
|
|
25
29
|
| `ftown_sessions` | `running` | `target` | `{ sessionId, running }` | No |
|
|
@@ -67,7 +71,7 @@ The tool schemas ship with `ftown-bridge` and follow its semantic version. Addin
|
|
|
67
71
|
|
|
68
72
|
## Consumer walkthrough
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
Call `ftown_sessions` with `{"operation":"list"}` to find a session. Use its ID as `target` with operation `get` or `usage`. To send the session an instruction, call `ftown_mail` with `{"operation":"send","target":"<session-id>","body":"Review the API client"}`. For a shared discussion, call `ftown_discuss` with `operation: "reply"`, `project`, `threadId` and `text`. To delegate work, create a child with `ftown_session_create` and use the returned ID with `ftown_session_manage`.
|
|
71
75
|
|
|
72
76
|
The ftown extension is installed by explicit `ftown setup`; use
|
|
73
77
|
`ftown setup --repair` after installing a new optional harness. Structured creates
|
package/pi-extension/ftown.js
CHANGED
|
@@ -75,14 +75,24 @@ function sessionMetadata(ctx) {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
function quoteCommandArgument(value) {
|
|
79
|
+
return /^[a-zA-Z0-9._-]+$/.test(value) ? value : "'" + value.replaceAll("'", "'\\''") + "'";
|
|
80
|
+
}
|
|
81
|
+
|
|
78
82
|
function discussionReplyHint(message) {
|
|
79
83
|
if (message.from !== 'project-discussion') return '';
|
|
80
84
|
const legacyProject = /^discussion:([0-9a-f-]{36}):[0-9a-f-]{36}$/i.exec(message.idempotencyKey ?? '')?.[1];
|
|
81
85
|
const project = message.discussion?.projectId || legacyProject || message.fromName?.replace(/ discussion$/, '');
|
|
82
|
-
if (!project || !message.threadId) return '
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
if (!project || !message.threadId) return 'Use ftown discuss reply --help for the project thread reply syntax.';
|
|
87
|
+
const prefix = `Reply in this discussion thread: ftown discuss reply ${quoteCommandArgument(message.threadId)} --project ${quoteCommandArgument(project)}`;
|
|
88
|
+
const textOption = ' --text "your reply"';
|
|
89
|
+
const homeBridge = message.discussion?.homeBridgeId;
|
|
90
|
+
const hint = prefix + (homeBridge ? ' --bridge ' + quoteCommandArgument(homeBridge) : '') + textOption;
|
|
91
|
+
const lastLine = message.body?.split('\n').at(-1) ?? '';
|
|
92
|
+
if (lastLine === hint) return '';
|
|
93
|
+
// A bridge running an older version can forward the full command without its home bridge metadata.
|
|
94
|
+
if (!homeBridge && lastLine.startsWith(prefix) && /^ --bridge [\w.-]+ --text "your reply"$/.test(lastLine.slice(prefix.length))) return '';
|
|
95
|
+
return hint;
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
function formatMail(message) {
|
|
@@ -329,7 +339,7 @@ export function registerFtownPiExtension(pi, options = {}) {
|
|
|
329
339
|
|
|
330
340
|
const sessions = await listSessions();
|
|
331
341
|
if (params.target.trim() === 'project-discussion' && !sessions.some(s => s.name === 'project-discussion' || s.id === 'project-discussion')) {
|
|
332
|
-
throw new Error('Use
|
|
342
|
+
throw new Error('Use the ftown discuss reply command in the discussion notification to answer in the project thread.');
|
|
333
343
|
}
|
|
334
344
|
const target = resolveSession(sessions, params.target);
|
|
335
345
|
const self = sessions.find((session) => session.id === ftownSessionId);
|
|
@@ -400,7 +410,7 @@ export function registerFtownPiExtension(pi, options = {}) {
|
|
|
400
410
|
pi.registerTool({
|
|
401
411
|
name: 'ftown_mail',
|
|
402
412
|
label: 'ftown mail',
|
|
403
|
-
description: 'Send direct mail to another ftown session or read this session inbox.
|
|
413
|
+
description: 'Send direct mail to another ftown session or read this session inbox. Reply to project discussion notifications with ftown discuss reply.',
|
|
404
414
|
parameters: {
|
|
405
415
|
type: 'object',
|
|
406
416
|
properties: {
|
package/skills/ftown/SKILL.md
CHANGED
|
@@ -37,9 +37,8 @@ For upgrades, use the exact new version named by the startup readiness hint:
|
|
|
37
37
|
npx ftown@<new-version> setup
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Start the bridge with `ftown start
|
|
41
|
-
LAN deployment. `npx ftown start` accepts the same options
|
|
42
|
-
remains compatible. `ftown start --help` only displays help. The installed alias
|
|
40
|
+
Start the bridge with `ftown start`. Use `ftown start --solo` for a single-port
|
|
41
|
+
LAN deployment. `npx ftown start` accepts the same options. `ftown start --help` only displays help. The installed alias
|
|
43
42
|
checks npm for a newer version before starting and runs its setup when available.
|
|
44
43
|
Use `--no-update` or `FTOWN_NO_AUTO_UPDATE=1` to skip the check; CI and Docker
|
|
45
44
|
Solo images skip it automatically. An offline check is skipped.
|
|
@@ -104,7 +103,7 @@ The first command to another bridge goes through the relay and opens a direct
|
|
|
104
103
|
link to it; later commands use that link (`ftown bridges` marks it `direct`).
|
|
105
104
|
If no direct link can be made, commands keep using the relay.
|
|
106
105
|
|
|
107
|
-
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.
|
|
106
|
+
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). On macOS, prefer `memoryPressure` to judge RAM headroom. A `normal` reading can accompany low free RAM because macOS reuses cached memory. A `warning` or `critical` reading favors a different host. Older bridges and platforms without this reading omit the field. 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.
|
|
108
107
|
|
|
109
108
|
The dashboard’s **Create project** selects a home bridge and creates one SQLite database per hosted project. Use **Board** beside a legacy project to choose its home. Boards route writes to that home; workers can run on any allowed bridge. Open a ticket to link sessions or launch a worker. Outstanding attention is shown on the ticket and appears in the board’s Blocked column when present. Paired bridges exchange the project directory; an offline home leaves a previously viewed board readable from the client cache.
|
|
110
109
|
|
|
@@ -158,7 +157,7 @@ ftown discuss reply <thread-id> --text "ARM smoke tests passed." --project App
|
|
|
158
157
|
ftown discuss activity releases --after 0 --project App --json
|
|
159
158
|
```
|
|
160
159
|
|
|
161
|
-
A post or reply can mention sessions with repeatable `--mention <bridge-id>/<session-id>` or inline `@<bridge-id>/<session-id>`. Mentions notify the named sessions. Run `follow` from a session to receive notifications about replies and `unfollow` to stop. A session posting from another bridge uses its own identity and the project's home for storage. Read notifications with `ftown harness mail read`.
|
|
160
|
+
A post or reply can mention sessions with repeatable `--mention <bridge-id>/<session-id>` or inline `@<bridge-id>/<session-id>`. Mentions notify the named sessions. Run `follow` from a session to receive notifications about replies and `unfollow` to stop. A session posting from another bridge uses its own identity and the project's home for storage. Read notifications with `ftown harness mail read`. To answer a discussion notification, run its `ftown discuss reply` command with your reply text. It identifies the original thread, project and, when supplied, the home bridge. For a direct session message, use `ftown harness mail send <session-id> "message"`.
|
|
162
161
|
|
|
163
162
|
Read additional result pages with `--after <nextAfter>`. For incremental channel activity, save the last post's `seq` and pass it to `activity --after` next time. `post`, `reply`, `channels create` and `create-ticket` accept a client-generated UUID via `--id` for retries.
|
|
164
163
|
|
|
@@ -176,7 +175,7 @@ work (`ftown quota --json`). Each command group also has `--help`.
|
|
|
176
175
|
`ftown sessions preview <path...>` registers up to 12 files in the current
|
|
177
176
|
session's working directory for the dashboard, in this order. Kind is by
|
|
178
177
|
extension: `.html`/`.htm` → HTML, `.md`/`.markdown` → Markdown, anything else
|
|
179
|
-
is rejected. Each file is at most
|
|
178
|
+
is rejected. Each file is at most 8 MiB. A duplicate basename is rejected.
|
|
180
179
|
`--add <path...>` appends to the current set, `--remove <name...>` removes by
|
|
181
180
|
basename, and `--clear` removes the whole registration (never deletes files).
|
|
182
181
|
HTML previews are self-contained: inline CSS and scripts and data images work;
|
|
@@ -444,7 +443,5 @@ Inspect or clean up archived worktrees with `ftown worktrees list` and
|
|
|
444
443
|
## Connection and compatibility
|
|
445
444
|
|
|
446
445
|
The commands read `~/.ftown/bridge.json`. Anyone who can read that file can
|
|
447
|
-
control the bridge's sessions.
|
|
448
|
-
`ftown-env` launchers remain compatible; use the grouped commands above in new
|
|
449
|
-
instructions. ftown does not install a ticket system or provide a workflow
|
|
446
|
+
control the bridge's sessions. ftown does not install a ticket system or provide a workflow
|
|
450
447
|
runner. Independently installed coordination tools remain yours to manage.
|
|
@@ -234,7 +234,7 @@ ftown sessions preview --session-id <id> ./preview.html ./notes.md
|
|
|
234
234
|
The target defaults to `FTOWN_SESSION_ID`. A session holds up to 12 files, in
|
|
235
235
|
registration order. Kind is by extension (case-insensitive): `.html`/`.htm` →
|
|
236
236
|
HTML, `.md`/`.markdown` → Markdown; anything else is rejected. Each file must
|
|
237
|
-
be UTF-8, at most 1 MiB, and inside that session's working directory; relative
|
|
237
|
+
be UTF-8, at most 8 MiB before compression (1 MiB on older bridges), and inside that session's working directory; relative
|
|
238
238
|
paths resolve from the CLI's current directory. Two registered files may not
|
|
239
239
|
share a basename (the selector and links are by basename): a duplicate basename
|
|
240
240
|
is rejected with a clear error. Registration is all-or-nothing — if any path
|
|
@@ -401,8 +401,8 @@ with the exact version setup command in their readiness hint.
|
|
|
401
401
|
## Direct session mail
|
|
402
402
|
|
|
403
403
|
For a project conversation, use `ftown discuss post` to start a thread. When
|
|
404
|
-
a discussion notification arrives in your inbox,
|
|
405
|
-
command
|
|
404
|
+
a discussion notification arrives in your inbox, run its `ftown discuss reply`
|
|
405
|
+
command with your reply text.
|
|
406
406
|
|
|
407
407
|
`tell` posts to the target session's **inbox**. Mail is delivered into the
|
|
408
408
|
recipient's context automatically (as `[ftown mail]` context), so there is no
|