pi-link 0.1.6 → 0.1.7

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
@@ -6,17 +6,27 @@ This changelog is based on the git history from `2026-03-21` through `2026-04-03
6
6
 
7
7
  ---
8
8
 
9
+ ## 0.1.7 — 2026-04-09
10
+
11
+ ### Added
12
+
13
+ - **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.
14
+
15
+ ---
16
+
9
17
  ## 0.1.6 — 2026-04-03
10
18
 
19
+ **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.
20
+
11
21
  ### Added
12
22
 
13
- - **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.
23
+ - **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.
14
24
 
15
25
  ### Removed
16
26
 
17
- - **`cwd_update` message type.** Working directories are now only reported on connect (via `register`/`welcome`), not mid-session. Protocol returns to 9 message types.
27
+ - **`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.
18
28
 
19
- - **`session_switch` handler.** Removed the session-switch logic that handled name and cwd changes on `/resume`. Simplifies the lifecycle.
29
+ - **`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.
20
30
 
21
31
  ---
22
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-link",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "WebSocket-based inter-terminal communication for Pi. Connect multiple Pi terminals over a local link network.",
5
5
  "author": "alvivar",
6
6
  "license": "MIT",
@@ -25,6 +25,9 @@
25
25
  "pi": {
26
26
  "extensions": [
27
27
  "./index.ts"
28
+ ],
29
+ "skills": [
30
+ "./skills"
28
31
  ]
29
32
  }
30
33
  }
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: pi-link-coordination
3
+ description: Guidance for coordinating work across Pi terminals using pi-link. Use when delegating tasks, choosing between link_prompt and link_send, planning async vs sync work, batching parallel jobs, or avoiding busy/conflict patterns.
4
+ ---
5
+
6
+ # Pi-Link Coordination
7
+
8
+ How to coordinate work across Pi terminals via pi-link.
9
+
10
+ ---
11
+
12
+ ## Tool Selection Rule
13
+
14
+ - Need the answer back now? → `link_prompt`
15
+ - Need autonomous work done? → `link_send(triggerTurn: true)`
16
+ - Need to notify only? → `link_send(triggerTurn: false)`
17
+
18
+ ---
19
+
20
+ ## The Golden Rule
21
+
22
+ > After `link_send(triggerTurn: true)` to terminal X, do not `link_prompt` X until X sends a completion callback.
23
+
24
+ Pick one mode per terminal per task. Mixing sync and async on the same terminal is the most common coordination failure.
25
+
26
+ ---
27
+
28
+ ## The Tools
29
+
30
+ ### `link_list`
31
+
32
+ Returns connected terminals with names, live status (`idle`, `thinking`, `tool:<name>`), and working directory (cwd). Use before delegating when availability or path context is uncertain.
33
+
34
+ ### `link_prompt`
35
+
36
+ Synchronous RPC. Send a prompt, wait for the response.
37
+
38
+ - Fails immediately if target is missing, self, disconnects, or busy (local work or another remote prompt)
39
+ - 90s inactivity timeout, 30min hard ceiling
40
+ - Remote agent doesn't share your context — prompts must be self-contained
41
+ - Include: goal, scope, constraints, output format, done condition
42
+
43
+ ### `link_send`
44
+
45
+ Fire-and-forget. Send to one terminal or `to: "*"` to broadcast (excludes sender).
46
+
47
+ Set `triggerTurn: true` to activate the receiver's LLM. The sender does **not** get the response back.
48
+
49
+ **Callback contract for `triggerTurn: true`:** ask the receiver to reply via `link_send` with:
50
+
51
+ - `DONE` signal
52
+ - Output paths / artifacts created
53
+ - Blockers or open questions
54
+
55
+ ---
56
+
57
+ ## Operating Constraints
58
+
59
+ - **One remote prompt at a time per target.** Concurrent requests rejected as busy.
60
+ - **No shared context.** Every remote prompt must be self-contained.
61
+ - **Messages are ephemeral.** Offline terminals lose messages.
62
+ - **Localhost only.** Same machine.
63
+ - **Cwd is a hint, not proof.** Same cwd ≠ same workspace/branch/access. Use explicit paths; absolute when cwds differ or shared-root assumptions are unclear.
64
+ - **Naming:** `role@domain` (e.g., `builder@pi-link`). Only talk to your own domain unless told otherwise.
65
+
66
+ ---
67
+
68
+ ## Coordination Modes
69
+
70
+ ### Sync ask — `link_prompt`
71
+
72
+ For answers, review, analysis you need back now. One terminal at a time. Keep scope focused to avoid timeout.
73
+
74
+ ### Async delegate — `link_send(triggerTurn: true)`
75
+
76
+ For autonomous work. Require the callback contract (DONE + paths + blockers). Do your own work in parallel. Don't `link_prompt` the target until the callback arrives.
77
+
78
+ ### Parallel batch — async to multiple terminals
79
+
80
+ Distribute independent tasks. Use explicit paths (absolute if cwds differ). Wait for all callbacks, then synthesize. Don't prompt any dispatched terminal until its callback arrives.
81
+
82
+ ---
83
+
84
+ ## Anti-Patterns
85
+
86
+ **❌ Mixing async and sync on the same terminal**
87
+ Dispatched with `link_send(triggerTurn: true)` then sent a `link_prompt` → rejected as busy. See Golden Rule.
88
+
89
+ **❌ Using `link_send` when you need the response**
90
+ Result disappears. Use `link_prompt`.
91
+
92
+ **❌ Vague prompts**
93
+ "Fix the bug" is useless. Include file, line, root cause, expected fix.
94
+
95
+ **❌ No completion callback on async work**
96
+ Always require DONE + artifact paths + blockers.
97
+
98
+ **❌ Circular delegation**
99
+ A → B → C → A = deadlock. Maintain clear hierarchy.
100
+
101
+ **❌ Skipping `link_list` before retrying a busy target**
102
+ Check status before re-sending.
103
+
104
+ ---
105
+
106
+ ## Quick Reference
107
+
108
+ | I need to... | Tool | Mode |
109
+ | -------------------------------- | ------------------------------- | --------------- |
110
+ | See who's available | `link_list` | — |
111
+ | Get an answer from another agent | `link_prompt` | Synchronous |
112
+ | Delegate autonomous work | `link_send(triggerTurn: true)` | Asynchronous |
113
+ | Notify without activating | `link_send(triggerTurn: false)` | Fire-and-forget |
114
+ | Broadcast to all | `link_send(to: "*")` | Broadcast |
package/sync.ffs_db CHANGED
Binary file