@streichsbaer/pi-mesh 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+
2
+ <h1 align="center">pi-mesh — local session mesh for Pi</h1>
3
+
4
+
5
+ <p align="center">
6
+ <img src="assets/logo-512.png" alt="pi-mesh logo" width="240" />
7
+ </p>
8
+
9
+
10
+ `pi-mesh` is a local CLI and Agent Skill for coordinating multiple [Pi](https://github.com/earendil-works/pi) coding-agent sessions.
11
+
12
+ ## Goals
13
+
14
+ - Keep vanilla Pi TUI for interactive use.
15
+ - Let coding agents discover, inspect, and message Pi sessions through a CLI.
16
+ - Support sleeping managed sessions: session state persists, but the Pi process exits when idle.
17
+ - Wake sleeping sessions on demand, resume the JSONL session, run a turn, and shut down again.
18
+ - Avoid MCP and heavyweight daemons for the MVP.
19
+
20
+ ## Common commands
21
+
22
+ ```bash
23
+ pi-mesh sessions list
24
+ pi-mesh sessions list --include-pi # include recent unmanaged Pi sessions
25
+ pi-mesh sessions find auth
26
+ pi-mesh sessions list --folder ./api
27
+ pi-mesh sessions list --label pi-mesh-development
28
+ pi-mesh models list sonnet --folder ./api --scoped
29
+ pi-mesh transcript <session> --last 3
30
+ pi-mesh state <session>
31
+
32
+ # Create a sleeping/headless managed worker. It exits when idle.
33
+ pi-mesh spawn --name worker-api --folder ./api --label pi-mesh-development --model anthropic/claude-sonnet-4-5 --prompt "Inspect the auth tests"
34
+
35
+ # Wake a sleeping session, run one turn, then shut down again.
36
+ pi-mesh send worker-api "Fix the failing auth test" --stream
37
+
38
+ # Broadcast intentionally to all sessions with a label.
39
+ pi-mesh send --label pi-mesh-development --all "Please report status."
40
+
41
+ # Override the model or thinking level for a managed session turn.
42
+ pi-mesh send worker-api "Use a cheaper model for this check" --model claude-haiku-4-5
43
+ pi-mesh send worker-api "Think deeply about this migration" --thinking high
44
+
45
+ # Start or resume a vanilla Pi TUI with a live pi-mesh socket.
46
+ pi-mesh run --name coordinator --folder . --label pi-mesh-development
47
+
48
+ # Attach an existing Pi JSONL session to vanilla Pi TUI and register it with pi-mesh.
49
+ pi-mesh attach /path/to/session.jsonl --name old-session
50
+ ```
51
+
52
+ ## Lifecycle defaults
53
+
54
+ - `pi-mesh run` is interactive and keeps the vanilla Pi TUI process alive until you quit.
55
+ - `pi-mesh spawn` is sleeping/headless by default.
56
+ - `pi-mesh spawn --attach` creates a session and immediately opens it in vanilla Pi TUI.
57
+ - `pi-mesh send` uses a live socket when a managed TUI session is running; otherwise it wakes the sleeping session headlessly.
58
+ - `--model <provider/model>`, optional `--provider <name>`, and `--thinking <level>` can be passed to `spawn`, `run`, `attach`, or `send`; model changes are stored in the Pi session history once a turn is materialized.
59
+ - `pi-mesh models list [search] [--folder <dir>]` lists Pi-configured models; use `--folder <session-folder>` when inspecting models for a target session, add `--scoped` for Pi `enabledModels`, `--all` for unauthenticated known models, and `--json` for machine-readable output.
60
+ - Session names are not unique. Use `--folder`, `--name`, `--label`, or the stable session id to disambiguate; pass `--all` only when intentionally broadcasting a message to multiple matches.
61
+
62
+ ## Local registry storage
63
+
64
+ A machine has one durable pi-mesh registry. Session folder and labels are filters, not separate ownership scopes, so each underlying Pi JSONL session can be managed only once.
65
+
66
+ State is stored outside the repo:
67
+
68
+ ```text
69
+ ~/.pi/agent/pi-mesh/
70
+ registry.jsonl
71
+ inbox/
72
+ locks/
73
+ socket-dir
74
+ ```
75
+
76
+ Live control sockets use short hashed paths under a private randomized runtime directory such as `/tmp/pi-mesh-<uid>-<random>/`.
77
+
78
+ ## Existing Pi sessions
79
+
80
+ Already-running normal Pi sessions can be discovered and read from their JSONL files. `pi-mesh sessions list` shows managed sessions by default; pass `--include-pi` or `--all` to include recent unmanaged Pi sessions. To message one, close the original process first and attach/resume it through `pi-mesh attach` so pi-mesh can own the live control socket.
81
+
82
+ ## Install for development
83
+
84
+ ```bash
85
+ npm install
86
+ npm run build
87
+ npm link
88
+ ```
89
+
90
+ Or run directly:
91
+
92
+ ```bash
93
+ npm run dev -- sessions list
94
+ ```
95
+
96
+ ## Testing
97
+
98
+ ```bash
99
+ npm run ci
100
+ ```
101
+
102
+ Real Pi CLI smoke tests are opt-in because they use live auth/subscription credentials. They copy `auth.json` into an isolated temp Pi agent dir and default to the cheapest configured model, `openai-codex/gpt-5.4-mini`:
103
+
104
+ ```bash
105
+ PI_MESH_REAL_E2E=1 npm run test:e2e:real
106
+ PI_MESH_REAL_E2E=1 npm run test:e2e:interactive
107
+ ```
108
+
109
+ Set `PI_MESH_E2E_MODEL=<provider/model>` to override the model, `PI_MESH_E2E_SOURCE_AGENT_DIR=<dir>` to copy auth from a non-default Pi agent dir, and `PI_MESH_E2E_KEEP=1` to keep the temp folder for debugging.
110
+
111
+ ## License
112
+
113
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};