pi-link 0.1.9 → 0.1.11

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/CHANGELOG.md CHANGED
@@ -1,159 +1,179 @@
1
- # Changelog
2
-
3
- All notable changes to pi-link are documented here.
4
-
5
- This changelog is based on the git history from `2026-03-21` (initial commit) through the present. Versions correspond to npm publishes.
6
-
7
- ---
8
-
9
- ## 0.1.9 — 2026-04-22
10
-
11
- ### Added
12
-
13
- - **`--link-name <name>` flag.** Connect to link with a chosen terminal name on startup. Implies `--link` (no need for both). Persists the name and sets the Pi session name if currently unnamed. Name precedence: `--link-name` > saved `/link-name` > session name > random `t-xxxx`.
14
-
15
- - **`pi-link start` CLI.** New bin script (`bin/pi-link.mjs`) for session-by-name resume. `pi-link start worker-1` scans `~/.pi/agent/sessions/` for a matching session name — one match resumes it, no match creates a new session, multiple matches prints candidates and exits. Extra Pi flags pass through: `pi-link start worker-1 --model sonnet --thinking high`. Local-cwd sessions prioritized.
16
-
17
- ---
18
-
19
- ## 0.1.8 — 2026-04-16
20
-
21
- ### Added
22
-
23
- - **Idle-gated batched delivery for `triggerTurn:true`.** `link_send` with `triggerTurn:true` no longer calls `pi.sendMessage()` immediately. Messages queue in a local inbox, coalesce over a 200ms debounce window, and flush only when the receiver is idle (`ctx.isIdle()`). Delivered as a single `[Link: N message(s) received]` block at the start of a fresh turn. Avoids a Pi platform race where mid-run steering messages can be stranded. `triggerTurn:false` is unchanged (immediate fire-and-forget). (`82977ec`, `ca2996b`)
24
-
25
- - **Session name as default terminal identity.** When no explicit `/link-name` is saved for a session, the terminal now adopts the Pi session name instead of a random `t-xxxx` ID. The session name is used at runtime only — it is not saved as `preferredName`, so only explicit `/link-name` calls persist across sessions.
26
-
27
- ### Changed
28
-
29
- - **Removed per-item truncation, raised batch cap.** Deleted the `ITEM_MAX_CHARS` (2 000) constant — it was silently cutting real agent work mid-word. `BATCH_MAX_CHARS` raised from 8 000 → 16 000 (~4K tokens). The batch cap is a soft limit: the first item is always included even if oversized, so one large message fills the batch alone and defers others to the next flush.
30
-
31
- ### Fixed
32
-
33
- - **`flushInbox()` used `pi.isIdle()` instead of `ctx.isIdle()`.** `isIdle()` lives on `ExtensionContext`, not `ExtensionAPI`. Fixed to use the stored `ctx`.
34
-
35
- ---
36
-
37
- ## 0.1.7 — 2026-04-09
38
-
39
- ### Added
40
-
41
- - **Bundled `pi-link-coordination` skill.** The coordination guide is now shipped with the package via `pi.skills` manifest entry. Installing pi-link now auto-loads the skill — no manual copy required. The skill provides on-demand guidance for agents delegating work across terminals: tool selection (`link_prompt` vs `link_send`), the golden rule (no sync-after-async on same target), callback contracts, and coordination modes.
42
-
43
- ---
44
-
45
- ## 0.1.62026-04-03
46
-
47
- **Pi 0.65.0 migration.** Pi removed `session_switch` and `session_fork` events. All session transitions (startup, reload, `/new`, `/resume`, `/fork`) now fire `session_start` with `event.reason`. Each transition tears down the old extension runtime via `session_shutdown` before creating a fresh one — so there is no live connection to update in-place across sessions.
48
-
49
- ### Added
50
-
51
- - **Persistent connection intent.** `/link-connect` and `/link-disconnect` now save their state to the session via `pi.appendEntry("link-active", ...)`. On `session_start`, the saved preference is checked before falling back to `--link`. Connect once and it stays connected across session resumes without needing the flag. Explicit user intent (`link-active`) takes precedence over the `--link` flag default.
52
-
53
- ### Removed
54
-
55
- - **`cwd_update` message type.** With the old `session_switch` gone, mid-session cwd changes have no trigger. Working directories are now only reported on connect (via `register`/`welcome`). Protocol returns to 9 message types.
56
-
57
- - **`session_switch` handler.** The 77-line in-place mutation matrix (hub rename, cwd diffing, client reconnect) is dead under the new lifecycle. Replaced by a unified `session_start` handler + `shouldConnect()` helper.
58
-
59
- ---
60
-
61
- ## 0.1.52026-04-02
62
-
63
- ### Added
64
-
65
- - **Working directory sharing.** Each terminal reports its `cwd` on connect and on session switch. New `cwd_update` protocol message (10th message type) broadcasts mid-session directory changes. `link_list` and `/link` now show per-terminal working directories full absolute paths in tool output, `~/…` shortened in the TUI. Agents can use this to choose the right target, use explicit paths when terminals differ, and catch wrong-project mistakes early.
66
-
67
- - **Header comment cleanup.** Simplified the top-of-file doc comment removed feature bullet list and install instructions in favor of a concise summary.
68
-
69
- ---
70
-
71
- ## 0.1.4 2026-03-30
72
-
73
- ### Added
74
-
75
- - **Heartbeat-based prompt timeout.** `link_prompt` no longer uses a fixed 2-minute timeout. The target sends keepalives every 30s while working (reusing `status_update`). The sender resets a 90-second inactivity timer on each keepalive. A 30-minute hard ceiling prevents broken-but-chatty targets from hanging forever. Long tasks with regular activity no longer false-timeout. (`fc73a00`, `5603f0d`)
76
-
77
- - **Self-target rejection.** `link_prompt` immediately rejects prompts where `to` equals your own terminal name, instead of sending a round-trip that would fail. (`0086c04`)
78
-
79
- - **Immediate failure on disconnect.** Pending `link_prompt` calls fail instantly when the target terminal leaves the network (`terminal_left`), instead of waiting for the inactivity timeout. (`0086c04`)
80
-
81
- - **`cleanupPending()` helper.** Single authority for resolving pending prompt state all paths (response, inactivity, ceiling, abort, disconnect, delivery failure) go through one function, preventing double-resolution races. (`fc73a00`)
82
-
83
- ---
84
-
85
- ## 0.1.32026-03-26
86
-
87
- ### Added
88
-
89
- - **Persistent link names.** `/link-name` saves your preferred name to the session via `pi.appendEntry()`. Resume a session and your name is restored automatically. Session switches (`/resume`) restore the new session's preferred name. Only explicit `/link-name` calls persist — hub-assigned variants like `"builder-2"` are not saved. (`369cf5d`)
90
-
91
- ### Fixed
92
-
93
- - **Self join/leave echoes suppressed.** Hub no longer sends `terminal_joined`/`terminal_left` back to the terminal that triggered the event (e.g., during renames). Previously, renaming on the hub would echo a leave/join pair back to yourself. (`45cb018`)
94
-
95
- - **Pre-flight target validation for `link_prompt`.** The sender now checks if the target exists in the local terminal list before sending, returning an immediate error with the current terminal list instead of waiting for a timeout. (`45cb018`)
96
-
97
- ---
98
-
99
- ## 0.1.2 — 2026-03-24
100
-
101
- ### Added
102
-
103
- - **Automatic agent status.** Each terminal's activity status is derived from Pi lifecycle events and broadcast across the link. Three states: `idle`, `thinking`, `tool:<name>` — each with a duration computed at render time. New `status_update` protocol message (push model: terminal → hub → all). New joiners receive a status snapshot in the `welcome` message. (`454415a`)
104
-
105
- - `/link` and `link_list` now show per-terminal status alongside names.
106
-
107
- ---
108
-
109
- ## 0.1.12026-03-22
110
-
111
- ### Changed
112
-
113
- - **Published to npm.** Install command changed from `pi install git:github.com/alvivar/pi-mesh` to `pi install npm:pi-link`. (`87b394f`, `ed1e6cf`)
114
-
115
- ---
116
-
117
- ## 0.1.0 — 2026-03-22
118
-
119
- First npm publish. Renamed from `pi-mesh` to `pi-link`. (`57bda8b`)
120
-
121
- Everything below shipped together as the initial release.
122
-
123
- ### Core
124
-
125
- - **Hub-spoke WebSocket network** on `127.0.0.1:9900`. First terminal becomes the hub; others connect as clients. All messages route through the hub. (`c239a9e`)
126
-
127
- - **Auto-discovery protocol.** Try client → fallback to hub → retry with 2–5s randomized backoff on race conditions. (`c239a9e`)
128
-
129
- - **Hub promotion.** When the hub goes down, the first client to reconnect becomes the new hub (race-based, no leader election). (`c239a9e`)
130
-
131
- ### Tools
132
-
133
- - **`link_send`** fire-and-forget message to a specific terminal or `"*"` for broadcast. Optional `triggerTurn` to kick off the remote LLM via `deliverAs: "steer"`. (`c239a9e`)
134
-
135
- - **`link_prompt`** — synchronous RPC: send a prompt to a remote terminal, wait for the LLM's response. Single-queue per terminal (immediate `"Terminal is busy"` rejection, no queuing). 2-minute fixed timeout at this version. (`c239a9e`)
136
-
137
- - **`link_list`**list connected terminals with role info and self-identification. (`c239a9e`)
138
-
139
- ### Commands
140
-
141
- - **`/link`** show link status (name, role, online count). (`c239a9e`)
142
- - **`/link-name [name]`** — rename this terminal. No-arg form adopts the Pi session name. (`c239a9e`, `2fd67c7`)
143
- - **`/link-broadcast <msg>`** — broadcast a chat message to all other terminals. (`c0bf65a`)
144
- - **`/link-connect`** — connect mid-session without `--link` flag. Enables auto-reconnect. (`a2a0eac`)
145
- - **`/link-disconnect`** disconnect and suppress auto-reconnect, even if `--link` was passed. (`a2a0eac`)
146
-
147
- ### Opt-in startup
148
-
149
- - **`--link` flag.** Link is off by default completely silent without the flag. No status bar, no connection attempts, no warnings. (`48d7e97`)
150
-
151
- ### Protocol hardening (pre-release)
152
-
153
- These fixes shipped before 0.1.0 but are worth noting as they shaped the protocol:
154
-
155
- - **Early failure on missing targets.** Hub sends `prompt_response` with error for unknown targets, so the sender's promise resolves immediately instead of timing out. (`da38f62`)
156
- - **Delivery status from routing.** `routeMessage()` returns a boolean — authoritative on the hub, optimistic on clients. (`a29fefc`)
157
- - **Unique name enforcement.** Hub deduplicates names (`builder` `builder-2`). Renames check for collisions. No-op renames short-circuit. (`84d2b68`, `1207647`)
158
- - **Unregistered client guard.** Hub ignores all non-`register` messages from clients that haven't completed registration. (`679f25f`)
159
- - **Session names as defaults.** Terminals use the Pi session name as their default link identity when available. (`2fd67c7`)
1
+ # Changelog
2
+
3
+ All notable changes to pi-link are documented here.
4
+
5
+ This changelog is based on the git history from `2026-03-21` (initial commit) through the present. Versions correspond to npm publishes.
6
+
7
+ ---
8
+
9
+ ## 0.1.11 — 2026-04-27
10
+
11
+ ### Added
12
+
13
+ - **`pi-link list` command.** Lists pi-link sessions in the current cwd. Use `--all` (or `-a`) to list sessions across all directories adds a CWD column with `~` substituted for `$HOME`. Shows name, last-modified time, message count, and short ID. Sessions are detected by presence of a `link-name` entry. ANSI styling (bold headers, dim secondary columns) in TTY; plain when piped (`NO_COLOR` honored).
14
+
15
+ ---
16
+
17
+ ## 0.1.10 — 2026-04-26
18
+
19
+ ### Changed
20
+
21
+ - **`pi-link start <name>` simplified to `pi-link <name>`.** Resolves session by name and launches Pi directly. `pi-link resolve <name>` available for machine-readable path-only output. Rejects conflicting flags (`--session`, `--continue`, etc.).
22
+
23
+ - **`--link-name` flag replaced with `PI_LINK_NAME` env var.** The flag was a footgun `pi --link-name worker-1` created duplicate sessions on every run. Now `pi-link <name>` passes the name via env var internally. Users should use `pi-link <name>` or `/link-name` mid-session.
24
+
25
+ ### Fixed
26
+
27
+ - **Stale extension context crash on startup.** WebSocket callbacks could fire after Pi invalidated the extension context (~1ms after `session_start` returns), causing unhandled exceptions that killed the process. Fixed with deferred startup connect, safe context helpers, and `disposed` guards on all WebSocket callback sites.
28
+
29
+ ---
30
+
31
+ ## 0.1.9 — 2026-04-23
32
+
33
+ ### Added
34
+
35
+ - **`--link-name <name>` flag.** Connect to link with a chosen terminal name on startup. Implies `--link`. Persists the name and sets the Pi session name if currently unnamed. Session resume by name is handled separately by the `pi-link` CLI. Name precedence: `--link-name` > saved `/link-name` > session name > random `t-xxxx`.
36
+
37
+ ---
38
+
39
+ ## 0.1.8 — 2026-04-16
40
+
41
+ ### Added
42
+
43
+ - **Idle-gated batched delivery for `triggerTurn:true`.** `link_send` with `triggerTurn:true` no longer calls `pi.sendMessage()` immediately. Messages queue in a local inbox, coalesce over a 200ms debounce window, and flush only when the receiver is idle (`ctx.isIdle()`). Delivered as a single `[Link: N message(s) received]` block at the start of a fresh turn. Avoids a Pi platform race where mid-run steering messages can be stranded. `triggerTurn:false` is unchanged (immediate fire-and-forget). (`82977ec`, `ca2996b`)
44
+
45
+ - **Session name as default terminal identity.** When no explicit `/link-name` is saved for a session, the terminal now adopts the Pi session name instead of a random `t-xxxx` ID. The session name is used at runtime only it is not saved as `preferredName`, so only explicit `/link-name` calls persist across sessions.
46
+
47
+ ### Changed
48
+
49
+ - **Removed per-item truncation, raised batch cap.** Deleted the `ITEM_MAX_CHARS` (2 000) constant — it was silently cutting real agent work mid-word. `BATCH_MAX_CHARS` raised from 8 000 → 16 000 (~4K tokens). The batch cap is a soft limit: the first item is always included even if oversized, so one large message fills the batch alone and defers others to the next flush.
50
+
51
+ ### Fixed
52
+
53
+ - **`flushInbox()` used `pi.isIdle()` instead of `ctx.isIdle()`.** `isIdle()` lives on `ExtensionContext`, not `ExtensionAPI`. Fixed to use the stored `ctx`.
54
+
55
+ ---
56
+
57
+ ## 0.1.7 2026-04-09
58
+
59
+ ### Added
60
+
61
+ - **Bundled `pi-link-coordination` skill.** The coordination guide is now shipped with the package via `pi.skills` manifest entry. Installing pi-link now auto-loads the skill no manual copy required. The skill provides on-demand guidance for agents delegating work across terminals: tool selection (`link_prompt` vs `link_send`), the golden rule (no sync-after-async on same target), callback contracts, and coordination modes.
62
+
63
+ ---
64
+
65
+ ## 0.1.62026-04-03
66
+
67
+ **Pi 0.65.0 migration.** Pi removed `session_switch` and `session_fork` events. All session transitions (startup, reload, `/new`, `/resume`, `/fork`) now fire `session_start` with `event.reason`. Each transition tears down the old extension runtime via `session_shutdown` before creating a fresh one — so there is no live connection to update in-place across sessions.
68
+
69
+ ### Added
70
+
71
+ - **Persistent connection intent.** `/link-connect` and `/link-disconnect` now save their state to the session via `pi.appendEntry("link-active", ...)`. On `session_start`, the saved preference is checked before falling back to `--link`. Connect once and it stays connected across session resumes without needing the flag. Explicit user intent (`link-active`) takes precedence over the `--link` flag default.
72
+
73
+ ### Removed
74
+
75
+ - **`cwd_update` message type.** With the old `session_switch` gone, mid-session cwd changes have no trigger. Working directories are now only reported on connect (via `register`/`welcome`). Protocol returns to 9 message types.
76
+
77
+ - **`session_switch` handler.** The 77-line in-place mutation matrix (hub rename, cwd diffing, client reconnect) is dead under the new lifecycle. Replaced by a unified `session_start` handler + `shouldConnect()` helper.
78
+
79
+ ---
80
+
81
+ ## 0.1.52026-04-02
82
+
83
+ ### Added
84
+
85
+ - **Working directory sharing.** Each terminal reports its `cwd` on connect and on session switch. New `cwd_update` protocol message (10th message type) broadcasts mid-session directory changes. `link_list` and `/link` now show per-terminal working directories full absolute paths in tool output, `~/…` shortened in the TUI. Agents can use this to choose the right target, use explicit paths when terminals differ, and catch wrong-project mistakes early.
86
+
87
+ - **Header comment cleanup.** Simplified the top-of-file doc comment — removed feature bullet list and install instructions in favor of a concise summary.
88
+
89
+ ---
90
+
91
+ ## 0.1.4 — 2026-03-30
92
+
93
+ ### Added
94
+
95
+ - **Heartbeat-based prompt timeout.** `link_prompt` no longer uses a fixed 2-minute timeout. The target sends keepalives every 30s while working (reusing `status_update`). The sender resets a 90-second inactivity timer on each keepalive. A 30-minute hard ceiling prevents broken-but-chatty targets from hanging forever. Long tasks with regular activity no longer false-timeout. (`fc73a00`, `5603f0d`)
96
+
97
+ - **Self-target rejection.** `link_prompt` immediately rejects prompts where `to` equals your own terminal name, instead of sending a round-trip that would fail. (`0086c04`)
98
+
99
+ - **Immediate failure on disconnect.** Pending `link_prompt` calls fail instantly when the target terminal leaves the network (`terminal_left`), instead of waiting for the inactivity timeout. (`0086c04`)
100
+
101
+ - **`cleanupPending()` helper.** Single authority for resolving pending prompt state — all paths (response, inactivity, ceiling, abort, disconnect, delivery failure) go through one function, preventing double-resolution races. (`fc73a00`)
102
+
103
+ ---
104
+
105
+ ## 0.1.3 2026-03-26
106
+
107
+ ### Added
108
+
109
+ - **Persistent link names.** `/link-name` saves your preferred name to the session via `pi.appendEntry()`. Resume a session and your name is restored automatically. Session switches (`/resume`) restore the new session's preferred name. Only explicit `/link-name` calls persist hub-assigned variants like `"builder-2"` are not saved. (`369cf5d`)
110
+
111
+ ### Fixed
112
+
113
+ - **Self join/leave echoes suppressed.** Hub no longer sends `terminal_joined`/`terminal_left` back to the terminal that triggered the event (e.g., during renames). Previously, renaming on the hub would echo a leave/join pair back to yourself. (`45cb018`)
114
+
115
+ - **Pre-flight target validation for `link_prompt`.** The sender now checks if the target exists in the local terminal list before sending, returning an immediate error with the current terminal list instead of waiting for a timeout. (`45cb018`)
116
+
117
+ ---
118
+
119
+ ## 0.1.2 2026-03-24
120
+
121
+ ### Added
122
+
123
+ - **Automatic agent status.** Each terminal's activity status is derived from Pi lifecycle events and broadcast across the link. Three states: `idle`, `thinking`, `tool:<name>` — each with a duration computed at render time. New `status_update` protocol message (push model: terminal → hub → all). New joiners receive a status snapshot in the `welcome` message. (`454415a`)
124
+
125
+ - `/link` and `link_list` now show per-terminal status alongside names.
126
+
127
+ ---
128
+
129
+ ## 0.1.1 2026-03-22
130
+
131
+ ### Changed
132
+
133
+ - **Published to npm.** Install command changed from `pi install git:github.com/alvivar/pi-mesh` to `pi install npm:pi-link`. (`87b394f`, `ed1e6cf`)
134
+
135
+ ---
136
+
137
+ ## 0.1.02026-03-22
138
+
139
+ First npm publish. Renamed from `pi-mesh` to `pi-link`. (`57bda8b`)
140
+
141
+ Everything below shipped together as the initial release.
142
+
143
+ ### Core
144
+
145
+ - **Hub-spoke WebSocket network** on `127.0.0.1:9900`. First terminal becomes the hub; others connect as clients. All messages route through the hub. (`c239a9e`)
146
+
147
+ - **Auto-discovery protocol.** Try client → fallback to hub → retry with 2–5s randomized backoff on race conditions. (`c239a9e`)
148
+
149
+ - **Hub promotion.** When the hub goes down, the first client to reconnect becomes the new hub (race-based, no leader election). (`c239a9e`)
150
+
151
+ ### Tools
152
+
153
+ - **`link_send`** fire-and-forget message to a specific terminal or `"*"` for broadcast. Optional `triggerTurn` to kick off the remote LLM via `deliverAs: "steer"`. (`c239a9e`)
154
+
155
+ - **`link_prompt`** synchronous RPC: send a prompt to a remote terminal, wait for the LLM's response. Single-queue per terminal (immediate `"Terminal is busy"` rejection, no queuing). 2-minute fixed timeout at this version. (`c239a9e`)
156
+
157
+ - **`link_list`** list connected terminals with role info and self-identification. (`c239a9e`)
158
+
159
+ ### Commands
160
+
161
+ - **`/link`** — show link status (name, role, online count). (`c239a9e`)
162
+ - **`/link-name [name]`** — rename this terminal. No-arg form adopts the Pi session name. (`c239a9e`, `2fd67c7`)
163
+ - **`/link-broadcast <msg>`** — broadcast a chat message to all other terminals. (`c0bf65a`)
164
+ - **`/link-connect`** — connect mid-session without `--link` flag. Enables auto-reconnect. (`a2a0eac`)
165
+ - **`/link-disconnect`** — disconnect and suppress auto-reconnect, even if `--link` was passed. (`a2a0eac`)
166
+
167
+ ### Opt-in startup
168
+
169
+ - **`--link` flag.** Link is off by default — completely silent without the flag. No status bar, no connection attempts, no warnings. (`48d7e97`)
170
+
171
+ ### Protocol hardening (pre-release)
172
+
173
+ These fixes shipped before 0.1.0 but are worth noting as they shaped the protocol:
174
+
175
+ - **Early failure on missing targets.** Hub sends `prompt_response` with error for unknown targets, so the sender's promise resolves immediately instead of timing out. (`da38f62`)
176
+ - **Delivery status from routing.** `routeMessage()` returns a boolean — authoritative on the hub, optimistic on clients. (`a29fefc`)
177
+ - **Unique name enforcement.** Hub deduplicates names (`builder` → `builder-2`). Renames check for collisions. No-op renames short-circuit. (`84d2b68`, `1207647`)
178
+ - **Unregistered client guard.** Hub ignores all non-`register` messages from clients that haven't completed registration. (`679f25f`)
179
+ - **Session names as defaults.** Terminals use the Pi session name as their default link identity when available. (`2fd67c7`)