pi-jarvis 1.1.4 → 1.2.3

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/AGENTS.md ADDED
@@ -0,0 +1,24 @@
1
+ # pi-jarvis Agent Notes
2
+
3
+ ## Project Scope
4
+ - `pi-jarvis` is a Pi extension that opens a `/jarvis` side-conversation overlay.
5
+ - Core runtime files: `index.ts`, `side-session.ts`, `overlay.ts`, `jarvis-config.ts`, `session-ref.ts`.
6
+
7
+ ## Current `/jarvis-model` Behavior
8
+ - `/jarvis-model` with no request opens a model picker when Pi has a UI.
9
+ - `/jarvis-model <provider/model>` writes a project-scoped override to `.pi/jarvis.json`.
10
+ - `/jarvis-model --global <provider/model>` writes the default global override to the active Pi agent directory's `extensions/pi-jarvis.json` (by default `~/.pi/agent/extensions/pi-jarvis.json`).
11
+ - `/jarvis-model [--project|--global] follow-main` stores a scoped `follow-main` override.
12
+ - `/jarvis-model [--project|--global] clear` removes that scope's override so fallback applies.
13
+ - Resolution order is: project config, then global config, then built-in `follow-main`.
14
+ - `Note main` and `Redirect` stay disabled when the active `/jarvis` model is incompatible with bridge tools.
15
+
16
+ ## Validation
17
+ - Run `npm test` for full validation.
18
+ - Run `npm run build` before release packaging.
19
+
20
+ ## Docs To Keep In Sync
21
+ - `README.md`
22
+ - `CHANGELOG.md`
23
+ - `package.json` version
24
+ - this `AGENTS.md` when command/config behavior changes
package/README.md CHANGED
@@ -1,109 +1,298 @@
1
1
  # pi-jarvis
2
2
 
3
- `pi-jarvis` adds a polished `/jarvis` side-conversation overlay to Pi so you can ask for help without derailing the main session.
3
+ <div align="center">
4
4
 
5
- ## Why use it
5
+ ## A cinematic side-conversation overlay for Pi
6
6
 
7
- `/jarvis` gives you a second lane for quick questions, triage, and local investigation while the main session keeps moving. Instead of interrupting the primary flow, it opens a separate persistent side thread with explicit controls for tool access and main-session handoff.
7
+ **Open a second lane of thought without derailing the main session.**
8
8
 
9
- ## What you get
9
+ `pi-jarvis` adds `/jarvis`: a polished overlay where you can ask for status, inspect the repo when you explicitly allow it, and send a quiet note or a confirmed redirect back to the main lane.
10
10
 
11
- - A floating `/jarvis` overlay inside the current Pi session
12
- - A separate side-session history that survives reopening the overlay
13
- - Automatic follow-main model behavior, with optional `/jarvis-model` pinning
14
- - Permission-gated local `read`, `bash`, `edit`, and `write` access, plus `mcp` when available
15
- - Optional non-interrupting notes or confirmed redirects back to the main session
16
- - A focused regression suite covering the risky runtime and overlay paths
11
+ [![npm version](https://img.shields.io/npm/v/pi-jarvis?style=for-the-badge&color=7c3aed)](https://www.npmjs.com/package/pi-jarvis)
12
+ [![license](https://img.shields.io/badge/license-MIT-111827?style=for-the-badge)](./LICENSE)
13
+ [![Pi extension](https://img.shields.io/badge/Pi-extension-06b6d4?style=for-the-badge)](https://github.com/fluxgear/pi-jarvis)
14
+ [![TypeScript](https://img.shields.io/badge/TypeScript-powered-2563eb?style=for-the-badge)](./package.json)
15
+
16
+ <p>
17
+ <strong>Persistent side session</strong> ·
18
+ <strong>Live main-session awareness</strong> ·
19
+ <strong>Permission-gated tools</strong> ·
20
+ <strong>Safe redirect flow</strong>
21
+ </p>
22
+
23
+ </div>
24
+
25
+ ---
26
+
27
+ ## The pitch
28
+
29
+ The main Pi session should stay on the critical path.
30
+
31
+ `/jarvis` gives you a **second cockpit** for the work that should not interrupt that primary flow:
32
+
33
+ - checking what the main agent is doing right now
34
+ - seeing what changed since the last `/jarvis` turn
35
+ - asking for triage, summaries, or a second opinion
36
+ - inspecting the repo with local tools when you turn them on
37
+ - sending a non-interrupting note back to the main session
38
+ - redirecting the main session only after explicit confirmation
39
+
40
+ > Think of it as a side conversation with real context, not a detached scratchpad.
41
+
42
+ ### Typical prompts
43
+
44
+ - *"What is the main agent doing right now?"*
45
+ - *"Summarize the last validation failure and tell me what matters."*
46
+ - *"Check this file while the main session keeps moving."*
47
+ - *"Compare what changed since my last `/jarvis` turn."*
48
+ - *"Redirect the main session, but make me confirm it first."*
49
+
50
+ ---
51
+
52
+ ## At a glance
53
+
54
+ | Capability | What you get |
55
+ |---|---|
56
+ | **Persistent side lane** | `/jarvis` keeps its own isolated conversation state and restores prior side-session history |
57
+ | **Live awareness** | Jarvis sees the current main-session summary plus a delta since the last `/jarvis` turn |
58
+ | **Permission-gated tools** | Local `read`, `bash`, `edit`, `write`, and optional `mcp` stay off until you enable them |
59
+ | **Safe main-session handoff** | `Note main` is quiet; `Redirect` is confirmation-gated |
60
+ | **Independent model control** | Follow the main model or pin `/jarvis` to a separate model |
61
+ | **Cleaner UX** | Thinking-step streaming is collapsed into a cleaner animated fallback |
62
+
63
+ ---
64
+
65
+ ## How it fits into Pi
66
+
67
+ ```mermaid
68
+ flowchart LR
69
+ U[You] -->|primary work| M[Main Pi session]
70
+ U -->|open /jarvis| J[Jarvis overlay]
71
+ M -->|summary + recent delta| J
72
+ J -->|Repo tools enabled| R[Local tools\nread • bash • edit • write]
73
+ J -->|optional| X[MCP]
74
+ J -. Note main .-> M
75
+ J -. Redirect after confirmation .-> M
76
+ ```
77
+
78
+ ### Operating model
79
+
80
+ ```mermaid
81
+ flowchart TD
82
+ A[Main session keeps moving] --> B[/jarvis opens in overlay]
83
+ B --> C[Jarvis sees current main-session context]
84
+ C --> D{What do you need?}
85
+ D -->|Status / summary / analysis| E[Jarvis handles the side task]
86
+ D -->|Repo inspection| F[Enable Repo tools]
87
+ D -->|Influence the main lane| G[Enable Note main or Redirect]
88
+ G --> H{Redirect?}
89
+ H -->|Yes| I[Per-send confirmation]
90
+ H -->|No| J[Quiet follow-up note]
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Why use `/jarvis` instead of the main lane?
96
+
97
+ Use `/jarvis` when you want:
98
+
99
+ - a second opinion without changing the primary plan yet
100
+ - a quick repo inspection while the main agent keeps moving
101
+ - a compact explanation of current progress or validation state
102
+ - a controlled way to send guidance back to the main session
103
+
104
+ Stay in the main lane when you want:
105
+
106
+ - the main plan to change immediately
107
+ - the main session itself to execute the next step directly
108
+ - no side conversation overhead at all
109
+
110
+ ---
17
111
 
18
112
  ## Quick start
19
113
 
20
- ### 1. Install the package
114
+ ### 1) Install
21
115
 
22
116
  ```bash
23
117
  npm install pi-jarvis
24
118
  ```
25
119
 
26
- ### 2. Register the extension entrypoint in Pi
120
+ ### 2) Register the extension in Pi
27
121
 
28
- Use the published entrypoint:
122
+ Use the package's published extension entrypoint:
29
123
 
30
124
  ```text
31
125
  ./dist/index.js
32
126
  ```
33
127
 
34
- This package is intended to run inside a Pi installation that provides the required peer dependencies.
128
+ This package is meant to run **inside a Pi installation** that provides the required peer dependencies.
35
129
 
36
- ### 3. Open `/jarvis`
130
+ ### 3) Open Jarvis
37
131
 
38
132
  ```bash
39
133
  /jarvis
40
134
  ```
41
135
 
42
- You can also send the first message immediately:
136
+ Or open it and send the first message immediately:
43
137
 
44
138
  ```bash
45
- /jarvis check this file for obvious regressions
139
+ /jarvis summarize the last validation failure and suggest the fastest next move
46
140
  ```
47
141
 
48
- Or use it as a background helper while continuing the main flow:
142
+ ### 4) Turn on more power only when you want it
49
143
 
50
- ```bash
51
- /jarvis summarize last 20 lines of build output and suggest next action
52
- ```
144
+ - leave `Repo tools` off for pure context / analysis
145
+ - turn `Repo tools` on when you want local `read`, `bash`, `edit`, `write`, and optional `mcp`
146
+ - turn `Note main` on when you want Jarvis to quietly message the main session
147
+ - turn `Redirect` on when you want Jarvis to propose a redirect that you still explicitly confirm
53
148
 
54
- ## Commands
149
+ ---
150
+
151
+ ## Command surface
55
152
 
56
153
  ### `/jarvis`
57
- Opens the side overlay. If you pass text after the command, that text becomes the first side-session prompt.
154
+ Opens the side overlay. If text follows the command, that text becomes the first side-session prompt.
155
+
156
+ ### `/jarvis-model`
157
+ When Pi has a UI, running `/jarvis-model` with no argument opens a model picker instead of requiring an exact provider/model string.
58
158
 
59
- ### `/jarvis-model <provider/model>`
60
- Pins `/jarvis` to a specific model without changing the main session model.
159
+ ### `/jarvis-model [--project|--global] <provider/model>`
160
+ Pins `/jarvis` to a specific model without changing the main session model. A plain `/jarvis-model <provider/model>` writes a **project-local** override to `.pi/jarvis.json`.
61
161
 
62
- ### `/jarvis-model follow-main`
63
- Returns `/jarvis` to the default mode where it follows the current main model.
162
+ ### `/jarvis-model [--project|--global] follow-main`
163
+ Restores the chosen scope to `follow-main`. A project-scoped `follow-main` override still wins over a global pinned setting.
64
164
 
65
- ## Overlay behavior
165
+ ### `/jarvis-model [--project|--global] clear`
166
+ Removes the selected scope so `/jarvis` falls back through the remaining config layers to the built-in default.
66
167
 
67
- The overlay is designed to stay explicit about what `/jarvis` can do right now. It surfaces:
168
+ ---
68
169
 
69
- - the current main-session state
70
- - the active `/jarvis` model and mode
71
- - what changed since the last `/jarvis` turn
72
- - whether local tools are off, enabled, or enabled without MCP
170
+ ## Model resolution
73
171
 
74
- The main header controls are:
172
+ ```mermaid
173
+ flowchart TD
174
+ A[Project config\n.pi/jarvis.json] -->|if present| B{valid?}
175
+ B -->|yes| P[Use project selection]
176
+ B -->|no or missing| C[Global config\n&lt;agentDir&gt;/extensions/pi-jarvis.json]
177
+ C -->|if present| D{valid?}
178
+ D -->|yes| G[Use global selection]
179
+ D -->|no or missing| E[Built-in default]
180
+ E --> F[follow-main]
181
+ ```
182
+
183
+ ### Resolution order
75
184
 
76
- - `Repo tools`
77
- - `Note main`
78
- - `Redirect`
185
+ 1. project config: `.pi/jarvis.json`
186
+ 2. global config: `~/.pi/agent/extensions/pi-jarvis.json` or the equivalent path under a custom Pi agent dir
187
+ 3. built-in default: `follow-main`
79
188
 
80
- All three are off by default.
189
+ ---
81
190
 
82
- ## Permission model
191
+ ## Overlay controls
83
192
 
84
- ### Repo tools
85
- When enabled, `/jarvis` may use local:
193
+ The overlay header exposes three controls, all **off by default**:
86
194
 
87
- - `read`
88
- - `bash`
89
- - `edit`
90
- - `write`
91
- - `mcp` when the MCP adapter is available in the current Pi environment
195
+ | Control | What it does | Safety model |
196
+ |---|---|---|
197
+ | `Repo tools` | Enables local `read`, `bash`, `edit`, `write`, and optional `mcp` | Explicit opt-in |
198
+ | `Note main` | Sends a concise, non-interrupting note to the main session | Explicit opt-in |
199
+ | `Redirect` | Sends a redirecting instruction to the main session | Explicit opt-in + per-send confirmation |
92
200
 
93
- When disabled, `/jarvis` works from injected session context and the bridge controls only.
201
+ `Note main` and `Redirect` can be forcibly disabled when the active `/jarvis` model is incompatible with bridge tools.
94
202
 
95
- ### Note main
96
- Allows `/jarvis` to send a concise, non-interrupting note back to the main session.
203
+ ### Permission flow
97
204
 
98
- ### Redirect
99
- Allows `/jarvis` to send a redirecting instruction to the main session, but every actual redirect still requires explicit confirmation.
205
+ ```mermaid
206
+ flowchart TD
207
+ A[Overlay opens] --> B[Repo tools off]
208
+ A --> C[Note main off]
209
+ A --> D[Redirect off]
100
210
 
101
- ## Session model
211
+ B -->|enable| E[Jarvis may use local tools]
212
+ E --> F{MCP adapter available?}
213
+ F -->|yes| G[Local tools + MCP]
214
+ F -->|no| H[Local tools only]
215
+
216
+ C -->|enable| I[Jarvis may send a quiet note to main]
217
+ D -->|enable| J[Jarvis may request redirect sends]
218
+ J --> K[Every redirect still requires confirmation]
219
+
220
+ L[Incompatible /jarvis model] --> M[Note main disabled]
221
+ L --> N[Redirect disabled]
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Redirect flow
227
+
228
+ ```mermaid
229
+ sequenceDiagram
230
+ participant You
231
+ participant Jarvis
232
+ participant Main as Main session
233
+
234
+ You->>Jarvis: Enable Redirect
235
+ You->>Jarvis: "Tell the main session to stop and inspect overlay teardown"
236
+ Jarvis->>You: Confirmation request
237
+ You-->>Jarvis: Approve
238
+ Jarvis-->>Main: Redirect instruction
239
+ Main-->>You: Continues on new priority
240
+ ```
241
+
242
+ ---
243
+
244
+ ## Session behavior
102
245
 
103
246
  - `/jarvis` keeps its own isolated conversation state
104
247
  - prior side-session history is restored from a session file under `jarvis-sessions/`
105
- - `/jarvis` follows the main model by default
106
- - thinking-step streaming is collapsed to a cleaner animated fallback for readability
248
+ - Jarvis sees current main-session state plus a compact delta since the last `/jarvis` turn
249
+ - plain `/jarvis-model <provider/model>` writes the project override; use `--global` to change the global default
250
+ - thinking-step streaming is intentionally collapsed to a cleaner animated fallback for readability
251
+
252
+ ---
253
+
254
+ ## Example usage
255
+
256
+ ### Ask for live status
257
+
258
+ ```bash
259
+ /jarvis what is the main agent doing right now?
260
+ ```
261
+
262
+ ### Ask for triage while the main lane keeps moving
263
+
264
+ ```bash
265
+ /jarvis summarize the last failing test and tell me the fastest likely fix
266
+ ```
267
+
268
+ ### Use Jarvis as a repo-side helper
269
+
270
+ ```bash
271
+ /jarvis inspect overlay.ts for teardown or redraw risks
272
+ ```
273
+
274
+ ### Send a non-interrupting note back to the main session
275
+
276
+ 1. Open `/jarvis`
277
+ 2. Enable `Note main`
278
+ 3. Ask Jarvis to send the note
279
+
280
+ ### Send a redirect safely
281
+
282
+ 1. Open `/jarvis`
283
+ 2. Enable `Redirect`
284
+ 3. Ask Jarvis to redirect the main session
285
+ 4. Confirm the send
286
+
287
+ ---
288
+
289
+ ## Compatibility note
290
+
291
+ This repository's current validation baseline is **Pi 0.69.0**.
292
+
293
+ The package relies on Pi-provided peer dependencies, so treat other host versions as **not the validated baseline for this repo** unless you have tested them yourself.
294
+
295
+ ---
107
296
 
108
297
  ## Development
109
298
 
@@ -131,15 +320,14 @@ Build the published package contents:
131
320
  npm run build
132
321
  ```
133
322
 
134
- ## Published package contents
323
+ Preview the npm payload:
135
324
 
136
- The npm package publishes:
325
+ ```bash
326
+ npm pack --dry-run
327
+ ```
137
328
 
138
- - `dist/`
139
- - `README.md`
140
- - `LICENSE`
141
- - `package.json`
329
+ ---
142
330
 
143
331
  ## License
144
332
 
145
- MIT
333
+ `pi-jarvis` is released under the **MIT License**. See [LICENSE](./LICENSE).
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAGN,KAAK,YAAY,EAGjB,MAAM,+BAA+B,CAAC;AA+BvC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAyP9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAGN,KAAK,YAAY,EAGjB,MAAM,+BAA+B,CAAC;AA8DvC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAyV9D"}