pi-jarvis 1.3.2 → 1.5.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.
Files changed (42) hide show
  1. package/AGENTS.md +24 -5
  2. package/README.md +51 -24
  3. package/dist/draft-editor.d.ts +53 -0
  4. package/dist/draft-editor.d.ts.map +1 -0
  5. package/dist/draft-editor.js +303 -0
  6. package/dist/draft-editor.js.map +1 -0
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +204 -82
  10. package/dist/index.js.map +1 -1
  11. package/dist/jarvis-config.d.ts +3 -1
  12. package/dist/jarvis-config.d.ts.map +1 -1
  13. package/dist/jarvis-config.js +75 -25
  14. package/dist/jarvis-config.js.map +1 -1
  15. package/dist/main-context.d.ts.map +1 -1
  16. package/dist/main-context.js +70 -69
  17. package/dist/main-context.js.map +1 -1
  18. package/dist/main-session-state.d.ts +3 -1
  19. package/dist/main-session-state.d.ts.map +1 -1
  20. package/dist/main-session-state.js +25 -23
  21. package/dist/main-session-state.js.map +1 -1
  22. package/dist/model-picker.d.ts +23 -0
  23. package/dist/model-picker.d.ts.map +1 -0
  24. package/dist/model-picker.js +93 -0
  25. package/dist/model-picker.js.map +1 -0
  26. package/dist/overlay-layout.d.ts +21 -0
  27. package/dist/overlay-layout.d.ts.map +1 -0
  28. package/dist/overlay-layout.js +132 -0
  29. package/dist/overlay-layout.js.map +1 -0
  30. package/dist/overlay.d.ts +51 -17
  31. package/dist/overlay.d.ts.map +1 -1
  32. package/dist/overlay.js +388 -233
  33. package/dist/overlay.js.map +1 -1
  34. package/dist/side-session.d.ts +18 -5
  35. package/dist/side-session.d.ts.map +1 -1
  36. package/dist/side-session.js +230 -47
  37. package/dist/side-session.js.map +1 -1
  38. package/dist/transcript-viewport.d.ts +51 -0
  39. package/dist/transcript-viewport.d.ts.map +1 -0
  40. package/dist/transcript-viewport.js +146 -0
  41. package/dist/transcript-viewport.js.map +1 -0
  42. package/package.json +17 -19
package/AGENTS.md CHANGED
@@ -2,22 +2,41 @@
2
2
 
3
3
  ## Project Scope
4
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`.
5
+ - Core runtime files: `index.ts`, `side-session.ts`, `overlay.ts`, `overlay-layout.ts`, `draft-editor.ts`, `transcript-viewport.ts`, `model-picker.ts`, `jarvis-config.ts`, `session-ref.ts`.
6
+ - Current baseline: Pi 1.0.0 (`@earendil-works` packages), Node.js >=22.19.0. Older Pi hosts are not supported.
6
7
 
7
8
  ## Current `/jarvis-model` and `/jarvis-thinking` Behavior
8
- - `/jarvis-model` with no request opens a model picker when Pi has a UI.
9
+ - `/jarvis` requires `ctx.mode === "tui"`; other modes must not boot or prompt a hidden side session.
10
+ - `/jarvis-model` with no request opens a searchable host-registry model picker in TUI mode; other modes report status.
9
11
  - `/jarvis-model <provider/model>` writes a project-scoped override to `.pi/jarvis.json`.
10
12
  - `/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
13
  - `/jarvis-model [--project|--global] follow-main` stores a scoped `follow-main` override.
12
14
  - `/jarvis-model [--project|--global] clear` removes that scope's override so fallback applies.
13
- - `/jarvis-thinking [--project|--global] auto|follow-main|off|minimal|low|medium|high|xhigh` stores a scoped thinking override without changing the main session thinking level.
15
+ - `/jarvis-thinking [--project|--global] auto|follow-main|off|minimal|low|medium|high|xhigh|max` stores a scoped thinking override without changing the main session thinking level.
14
16
  - `/jarvis-thinking [--project|--global] clear` removes that scope's thinking override so fallback applies.
15
- - Resolution order is: project config, then global config, then built-in defaults (`follow-main` for model, `auto` for thinking).
17
+ - Resolution order is: project config, then global config, then built-in defaults (`follow-main` for model, `auto` for thinking). Global writes never override an active project setting.
18
+ - Config writes use atomic same-directory replacement. I/O errors must not trigger malformed-JSON recovery. Cross-process concurrent config writes are not locked.
16
19
  - `auto` thinking follows main only when `/jarvis` follows the main model; pinned `/jarvis` models default to thinking `off`.
17
20
  - `follow-main` thinking follows the main thinking level regardless of model selection, except xAI `/jarvis` models force thinking `off`.
18
21
  - `/compact`, `/tree`, and `/new` entered inside `/jarvis` operate on the isolated `/jarvis` side-session, not the main Pi session.
19
22
  - `Note main` and `Redirect` stay disabled when the active `/jarvis` model is incompatible with bridge tools.
20
- - Published package keeps Pi runtime packages and `pi-mcp-adapter` as optional peers so installing `pi-jarvis` does not pull the full Pi/AI/MCP dependency stack; MCP becomes available only when the host environment provides `pi-mcp-adapter`.
23
+ - Published package keeps Pi runtime packages as optional peers, not bundled dependencies. MCP adapter auto-loading is disabled: the published adapter does not declare Pi 1.0 support; native MCP is not enabled. Repo tools expose only read/bash/edit/write.
24
+ - Physical models delegate to the host's public registry for auth and dispatch. Virtual/router models explicitly reject; do not access the registry's private backing runtime.
25
+ - Side resources/settings honor `ctx.isProjectTrusted()`. Local tool execution and bridge delivery recheck live permissions; closing the overlay revokes them and cancels pending confirmations.
26
+ - Use `agent_settled`, not `agent_end`, for final idle state. Main context must honor Pi context-edit/compaction projection.
27
+ - Runtime disposal must not detach the overlay's bridge subscription. Queue ownership must survive side `/new` but not main-session replacement; failed/uncertain sends are not auto-retried.
28
+
29
+ ## Overlay UX (1.5.0)
30
+ - Compact header by default; Ctrl+O expands diagnostics, PageUp/PageDown scroll transcript, Ctrl+End follows live, Ctrl+L dismisses notices.
31
+ - Use Pi's public multiline Editor. Enter sends; Shift+Enter/Ctrl+J inserts newline. Preserve indentation and reject unsafe/oversized drafts (64 KiB) explicitly.
32
+ - Bridge-owned in-memory drafts survive close/reopen. Bridge reset clears draft/recall on side `/new` or main/side-reference replacement; side-tree navigation only resets scroll.
33
+ - Consume bracketed paste before global shortcuts and confirmation keys; pasted content must not toggle permissions or approve a redirect.
34
+ - Queue count excludes active work; processing includes boot and complete queue settlement. Keep activity separate from scrollback and never replay uncertain sends.
35
+ - Bound overlay history (500 entries, 512K UTF-16 units total, 64K per entry) with explicit omission notices; never truncate persisted history.
36
+
37
+ ## Git and Release Policy
38
+ - Every commit must have an annotated git tag; this is mandatory. Release commits use `v<version>`; other commits use `commit-<short-sha>`.
39
+ - Push each commit with its tag. Keep release versions synchronized across package metadata, lockfile, README, and changelog.
21
40
 
22
41
  ## Validation
23
42
  - Run `npm test` for full validation.
package/README.md CHANGED
@@ -10,10 +10,10 @@
10
10
 
11
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
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)
13
+ [![Pi extension](https://img.shields.io/badge/Pi-extension-06b6d4?style=for-the-badge)](https://github.com/crustyhacker/pi-jarvis)
14
14
  [![TypeScript](https://img.shields.io/badge/TypeScript-powered-2563eb?style=for-the-badge)](./package.json)
15
15
 
16
- <p><strong>Current version:</strong> 1.3.2</p>
16
+ <p><strong>Current version:</strong> 1.5.0</p>
17
17
 
18
18
  <p>
19
19
  <strong>Persistent side session</strong> ·
@@ -57,10 +57,10 @@ The main Pi session should stay on the critical path.
57
57
  |---|---|
58
58
  | **Persistent side lane** | `/jarvis` keeps its own isolated conversation state and restores prior side-session history |
59
59
  | **Live awareness** | Jarvis sees the current main-session summary plus a delta since the last `/jarvis` turn |
60
- | **Permission-gated tools** | Local `read`, `bash`, `edit`, `write`, and optional `mcp` stay off until you enable them |
60
+ | **Permission-gated tools** | Local `read`, `bash`, `edit`, and `write` stay off until you enable them |
61
61
  | **Safe main-session handoff** | `Note main` is quiet; `Redirect` is confirmation-gated |
62
62
  | **Independent model control** | Follow the main model or pin `/jarvis` to a separate model |
63
- | **Cleaner UX** | Thinking-step streaming is collapsed into a cleaner animated fallback |
63
+ | **Cleaner UX** | Compact header, scrollable history, multiline drafts, and independent activity/queue feedback |
64
64
 
65
65
  ---
66
66
 
@@ -72,7 +72,6 @@ flowchart LR
72
72
  U -->|open /jarvis| J[Jarvis overlay]
73
73
  M -->|summary + recent delta| J
74
74
  J -->|Repo tools enabled| R[Local tools\nread • bash • edit • write]
75
- J -->|optional| X[MCP]
76
75
  J -. Note main .-> M
77
76
  J -. Redirect after confirmation .-> M
78
77
  ```
@@ -116,20 +115,16 @@ Stay in the main lane when you want:
116
115
  ### 1) Install
117
116
 
118
117
  ```bash
119
- npm install pi-jarvis
118
+ pi install npm:pi-jarvis
120
119
  ```
121
120
 
122
121
  This package is meant to run **inside a Pi installation** that already provides the Pi runtime packages. Those host packages are declared as optional peers so npm does not install a second copy of the full Pi/AI provider stack just to add this extension.
123
122
 
124
- MCP support is optional. If you want the `/jarvis` Repo tools toggle to expose the `mcp` tool, install `pi-mcp-adapter` in the same Pi environment; otherwise `/jarvis` still enables local `read`, `bash`, `edit`, and `write` tools when you opt in.
123
+ Requires **Pi 1.0.0** and **Node.js 22.19.0 or newer**. This release supports local repository tools only: automatic `pi-mcp-adapter` loading is disabled because the published adapter does not declare Pi 1.0 support. Native MCP integration is not yet enabled; the overlay reports MCP as unavailable.
125
124
 
126
- ### 2) Register the extension in Pi
125
+ ### 2) Restart or reload Pi
127
126
 
128
- Use the package's published extension entrypoint:
129
-
130
- ```text
131
- ./dist/index.js
132
- ```
127
+ `pi install` registers the package automatically. For local development, build and load `./dist/index.js` with `pi -e ./dist/index.js`.
133
128
  ### 3) Open Jarvis
134
129
 
135
130
  ```bash
@@ -145,7 +140,7 @@ Or open it and send the first message immediately:
145
140
  ### 4) Turn on more power only when you want it
146
141
 
147
142
  - leave `Repo tools` off for pure context / analysis
148
- - turn `Repo tools` on when you want local `read`, `bash`, `edit`, `write`, and optional `mcp`
143
+ - turn `Repo tools` on when you want local `read`, `bash`, `edit`, and `write`
149
144
  - turn `Note main` on when you want Jarvis to quietly message the main session
150
145
  - turn `Redirect` on when you want Jarvis to propose a redirect that you still explicitly confirm
151
146
 
@@ -157,7 +152,7 @@ Or open it and send the first message immediately:
157
152
  Opens the side overlay. If text follows the command, that text becomes the first side-session prompt.
158
153
 
159
154
  ### `/jarvis-model`
160
- When Pi has a UI, running `/jarvis-model` with no argument opens a model picker instead of requiring an exact provider/model string.
155
+ In Pi's terminal UI, running `/jarvis-model` with no argument opens a searchable model picker. In RPC, JSON, and print modes it reports the current selection; exact model-setting commands still work. `/jarvis` itself requires the terminal UI and does not start hidden work in other modes.
161
156
 
162
157
  ### `/jarvis-model [--project|--global] <provider/model>`
163
158
  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`.
@@ -168,12 +163,13 @@ Restores the chosen scope to `follow-main`. A project-scoped `follow-main` overr
168
163
  ### `/jarvis-model [--project|--global] clear`
169
164
  Removes the selected scope so `/jarvis` falls back through the remaining config layers to the built-in default.
170
165
 
171
- ### `/jarvis-thinking [--project|--global] auto|follow-main|off|minimal|low|medium|high|xhigh`
166
+ ### `/jarvis-thinking [--project|--global] auto|follow-main|off|minimal|low|medium|high|xhigh|max`
172
167
  Sets the thinking level used by `/jarvis` without changing the main session thinking level. A plain `/jarvis-thinking <level>` writes a **project-local** override to `.pi/jarvis.json`.
173
168
 
174
169
  - `auto` preserves the built-in behavior: follow the main thinking level only when `/jarvis` follows the main model; pinned `/jarvis` models use `off`.
175
170
  - `follow-main` follows the main thinking level even when `/jarvis` is pinned to a separate model.
176
- - Explicit levels pin `/jarvis` thinking to that level.
171
+ - Explicit levels request that thinking level; Pi clamps it to the selected model's supported levels.
172
+ - Changes to main thinking immediately synchronize when `/jarvis` follows it.
177
173
  - xAI `/jarvis` models still force thinking `off`.
178
174
 
179
175
  ### `/jarvis-thinking [--project|--global] clear`
@@ -212,6 +208,8 @@ Model and thinking settings resolve through the same config layers, then fall ba
212
208
  2. global config: `~/.pi/agent/extensions/pi-jarvis.json` or the equivalent path under a custom Pi agent dir
213
209
  3. built-in defaults: model `follow-main`, thinking `auto`
214
210
 
211
+ Global writes do not displace an existing project override. Config writes use same-directory atomic replacement and preserve unrelated keys; unreadable files are never treated as malformed JSON and overwritten. Malformed JSON can still be explicitly cleared or replaced. Avoid simultaneous configuration writes from multiple Pi processes: cross-process locking is not implemented.
212
+
215
213
  ---
216
214
 
217
215
  ## Overlay controls
@@ -220,11 +218,37 @@ The overlay header exposes three controls, all **off by default**:
220
218
 
221
219
  | Control | What it does | Safety model |
222
220
  |---|---|---|
223
- | `Repo tools` | Enables local `read`, `bash`, `edit`, `write`, and optional `mcp` | Explicit opt-in |
221
+ | `Repo tools` | Enables local `read`, `bash`, `edit`, and `write` | Explicit opt-in |
224
222
  | `Note main` | Sends a concise, non-interrupting note to the main session | Explicit opt-in |
225
223
  | `Redirect` | Sends a redirecting instruction to the main session | Explicit opt-in + per-send confirmation |
226
224
 
227
- `Note main` and `Redirect` can be forcibly disabled when the active `/jarvis` model is incompatible with bridge tools.
225
+ `Note main` and `Redirect` can be forcibly disabled when the active `/jarvis` model is incompatible with bridge tools. Closing the overlay revokes all three permissions and cancels pending confirmations. Already-running local operations are not undone; newly starting calls are blocked.
226
+
227
+ Long redirects are paged: review every page with Up/Down or PageUp/PageDown before pressing Y. Resize if the terminal is too small to review safely. Configured Pi selection keybindings are respected.
228
+
229
+ ### Keyboard and drafts
230
+
231
+ Version **1.5.0** adds compact diagnostics, scrollback, and a multiline draft editor.
232
+
233
+ | Key | Action |
234
+ |---|---|
235
+ | Enter | Send the draft; toggle a focused permission control |
236
+ | Shift+Enter / Ctrl+J | Insert a newline |
237
+ | Tab / Shift+Tab | Cycle between the editor and permission controls |
238
+ | Space | Toggle a focused permission control |
239
+ | PageUp / PageDown | Scroll conversation history; reaching the bottom resumes live following |
240
+ | Ctrl+End | Jump back to live output |
241
+ | Ctrl+O | Expand/collapse model, main-context delta, and access details |
242
+ | Ctrl+L | Dismiss notices |
243
+ | Escape | Close; during redirect review, cancel the confirmation instead |
244
+
245
+ The compact header keeps main status, the side model, main focus, and permissions visible. Activity and waiting-message counts remain visible while reading older output; counts exclude the active request. The latest notice appears separately; expand details for more of a long notice.
246
+
247
+ The multiline editor uses Pi's public editor and configured editing keybindings. Up/Down move within a draft; Up at the beginning of the first line (or in an empty editor) recalls prompts. Down past recalled prompts restores the draft. Pasted indentation and newlines are preserved, with Pi's normal tab-to-spaces normalization. Oversized drafts (over 64 KiB) and terminal-control payloads are rejected explicitly, never silently truncated or sent.
248
+
249
+ Unsent drafts survive closing and reopening `/jarvis` in the same running Pi session. They are not saved to disk. Side `/new`, main-session replacement, and switching to an unrelated side-session reference clear them; navigating the side tree only resets the transcript view. Closing still revokes every permission.
250
+
251
+ Scrollback follows new output until you scroll up. To bound rendering work, the overlay retains up to 500 recent entries and 512K UTF-16 code units of source text, with a 64K-unit per-entry limit. Omitted content is marked explicitly; these display limits do not modify persisted conversation history. Resizing preserves the reading position on a best-effort basis.
228
252
 
229
253
  ### Permission flow
230
254
 
@@ -235,9 +259,7 @@ flowchart TD
235
259
  A --> D[Redirect off]
236
260
 
237
261
  B -->|enable| E[Jarvis may use local tools]
238
- E --> F{MCP adapter available?}
239
- F -->|yes| G[Local tools + MCP]
240
- F -->|no| H[Local tools only]
262
+ E --> H[MCP unavailable in this release]
241
263
 
242
264
  C -->|enable| I[Jarvis may send a quiet note to main]
243
265
  D -->|enable| J[Jarvis may request redirect sends]
@@ -271,6 +293,9 @@ sequenceDiagram
271
293
 
272
294
  - `/jarvis` keeps its own isolated conversation state
273
295
  - prior side-session history is restored from a session file under `jarvis-sessions/`
296
+ - main-tree navigation reconciles the side-session reference instead of continuing in an unrelated side thread
297
+ - reset/shutdown invalidates old queues; failed commands and uncertain sends are not automatically replayed
298
+ - side-session project resources honor the main session's project-trust decision
274
299
  - Jarvis sees current main-session state plus a compact delta since the last `/jarvis` turn
275
300
  - `/compact`, `/tree`, and `/new` entered inside `/jarvis` operate on the side-session, not the main session
276
301
  - plain `/jarvis-model <provider/model>` writes the project model override; use `--global` to change the global default
@@ -316,9 +341,11 @@ sequenceDiagram
316
341
 
317
342
  ## Compatibility note
318
343
 
319
- This repository's current validation baseline is **Pi 0.69.0**.
344
+ This repository's validation baseline is **Pi 1.0.0**, using host-provided `@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`, and `@earendil-works/pi-tui`. Older Pi versions are not supported by this release.
345
+
346
+ Physical models use the main host's public model registry for requests and credentials, including custom providers and runtime-only authentication. **Virtual/router models are not supported**: Pi's public extension registry does not expose session-aware virtual routing. Pin `/jarvis-model <provider/physical-model>` if the main session uses a virtual model.
320
347
 
321
- 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.
348
+ MCP is deliberately unavailable in this release. A future native integration needs execution-time permission checks for direct, deferred, and nested tool calls; installing the old adapter does not enable it.
322
349
 
323
350
  ---
324
351
 
@@ -0,0 +1,53 @@
1
+ import type { Theme } from "@earendil-works/pi-coding-agent";
2
+ import { type Focusable, type TUI } from "@earendil-works/pi-tui";
3
+ export declare const MAX_DRAFT_BYTES: number;
4
+ export interface JarvisDraftEditorCallbacks {
5
+ onSubmit: (text: string) => void;
6
+ onChange: (text: string) => void;
7
+ /** Without a handler, rejected text raises an explicit error instead. */
8
+ onError?: (message: string) => void;
9
+ }
10
+ /** A content-only, bounded viewport around Pi's public multiline Editor. */
11
+ export declare class JarvisDraftEditor implements Focusable {
12
+ private readonly tui;
13
+ private readonly callbacks;
14
+ private readonly editor;
15
+ private disposed;
16
+ private submitted;
17
+ private inPaste;
18
+ private pasteBuffer;
19
+ private pasteTail;
20
+ private pasteRejected;
21
+ private pasteDiscard;
22
+ private startTail;
23
+ constructor(tui: TUI, theme: Theme, callbacks: JarvisDraftEditorCallbacks, initialText?: string);
24
+ get focused(): boolean;
25
+ set focused(value: boolean);
26
+ /** Includes all pasted text, never a display-only paste placeholder. */
27
+ getText(): string;
28
+ /** Silent programmatic replacement/restore; does not publish onChange. */
29
+ setText(text: string): void;
30
+ addToHistory(text: string): void;
31
+ /**
32
+ * Route this BEFORE confirmation/global shortcuts. Returns true when the
33
+ * entire packet was consumed as paste framing/content, never as keys.
34
+ * Discard is sticky through the paste, even if confirmation later closes.
35
+ */
36
+ handlePasteInput(data: string, discard?: boolean): boolean;
37
+ /** Carry only framing across a thread reset, discarding all old paste text. */
38
+ inheritPasteDrain(previous: JarvisDraftEditor): void;
39
+ handleInput(data: string): void;
40
+ /** Crops around the public cursor marker, including one-cell viewports. */
41
+ render(width: number, maxLines: number): string[];
42
+ invalidate(): void;
43
+ dispose(): void;
44
+ private error;
45
+ private acceptText;
46
+ private textError;
47
+ private appendPaste;
48
+ private resetPaste;
49
+ private insertText;
50
+ private dispatch;
51
+ private publishChange;
52
+ }
53
+ //# sourceMappingURL=draft-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft-editor.d.ts","sourceRoot":"","sources":["../draft-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAEwC,KAAK,SAAS,EAAmB,KAAK,GAAG,EACvF,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,eAAe,QAAY,CAAC;AAEzC,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,yEAAyE;IACzE,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AA2BD,4EAA4E;AAC5E,qBAAa,iBAAkB,YAAW,SAAS;IAYjD,OAAO,CAAC,QAAQ,CAAC,GAAG;IAEpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAb3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAS;IACz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@earendil-works/pi-tui";
2
+ export const MAX_DRAFT_BYTES = 64 * 1024;
3
+ const PASTE_START = "\x1b[200~";
4
+ const PASTE_END = "\x1b[201~";
5
+ const EDITOR_ACTIONS = [
6
+ "tui.editor.cursorUp", "tui.editor.cursorDown", "tui.editor.historyPrevious", "tui.editor.historyNext",
7
+ "tui.editor.cursorLeft", "tui.editor.cursorRight", "tui.editor.cursorWordLeft", "tui.editor.cursorWordRight",
8
+ "tui.editor.cursorLineStart", "tui.editor.cursorLineEnd", "tui.editor.jumpForward", "tui.editor.jumpBackward",
9
+ "tui.editor.pageUp", "tui.editor.pageDown", "tui.editor.deleteCharBackward", "tui.editor.deleteCharForward",
10
+ "tui.editor.deleteWordBackward", "tui.editor.deleteWordForward", "tui.editor.deleteToLineStart",
11
+ "tui.editor.deleteToLineEnd", "tui.editor.yank", "tui.editor.yankPop", "tui.editor.undo",
12
+ "tui.input.newLine", "tui.input.submit", "tui.input.tab", "tui.input.copy",
13
+ ];
14
+ // Only used for the size preflight. Actual normalization belongs to Pi's public
15
+ // setText/insertTextAtCursor APIs (CRLF/CR -> LF, tabs -> four spaces).
16
+ function normalizedBytes(text) {
17
+ return Buffer.byteLength(text.replace(/\r\n?/g, "\n").replace(/\t/g, " "), "utf8");
18
+ }
19
+ function delimiterTail(text, delimiter) {
20
+ for (let size = Math.min(text.length, delimiter.length - 1); size > 0; size--) {
21
+ if (text.endsWith(delimiter.slice(0, size)))
22
+ return size;
23
+ }
24
+ return 0;
25
+ }
26
+ /** A content-only, bounded viewport around Pi's public multiline Editor. */
27
+ export class JarvisDraftEditor {
28
+ tui;
29
+ callbacks;
30
+ editor;
31
+ disposed = false;
32
+ submitted = false;
33
+ inPaste = false;
34
+ pasteBuffer = "";
35
+ pasteTail = "";
36
+ pasteRejected = false;
37
+ pasteDiscard = false;
38
+ startTail = "";
39
+ constructor(tui, theme, callbacks, initialText = "") {
40
+ this.tui = tui;
41
+ this.callbacks = callbacks;
42
+ this.editor = new Editor(tui, {
43
+ borderColor: (text) => theme.fg("borderMuted", text),
44
+ selectList: {
45
+ selectedPrefix: (text) => theme.fg("accent", text),
46
+ selectedText: (text) => theme.fg("accent", text),
47
+ description: (text) => theme.fg("muted", text),
48
+ scrollInfo: (text) => theme.fg("dim", text),
49
+ noMatch: (text) => theme.fg("muted", text),
50
+ },
51
+ }, { paddingX: 0 });
52
+ // Pi submits a trimmed value. Capture the full pre-submit draft in
53
+ // dispatch instead; let Pi still own clearing and its undo lifecycle.
54
+ this.editor.onSubmit = () => { this.submitted = true; };
55
+ this.setText(initialText);
56
+ }
57
+ get focused() { return this.editor.focused; }
58
+ set focused(value) { this.editor.focused = !this.disposed && value; }
59
+ /** Includes all pasted text, never a display-only paste placeholder. */
60
+ getText() { return this.editor.getExpandedText(); }
61
+ /** Silent programmatic replacement/restore; does not publish onChange. */
62
+ setText(text) {
63
+ if (this.disposed || !this.acceptText(text))
64
+ return;
65
+ this.resetPaste();
66
+ this.editor.setText(text);
67
+ this.invalidate();
68
+ }
69
+ addToHistory(text) {
70
+ if (this.disposed || !this.acceptText(text))
71
+ return;
72
+ // addToHistory itself does not normalize line endings/tabs. Normalize
73
+ // through a temporary public Editor without changing this draft/cursor.
74
+ const normalizer = new Editor(this.tui, {
75
+ borderColor: (value) => value,
76
+ selectList: { selectedPrefix: (v) => v, selectedText: (v) => v, description: (v) => v,
77
+ scrollInfo: (v) => v, noMatch: (v) => v },
78
+ });
79
+ normalizer.setText(text);
80
+ this.editor.addToHistory(normalizer.getExpandedText());
81
+ }
82
+ /**
83
+ * Route this BEFORE confirmation/global shortcuts. Returns true when the
84
+ * entire packet was consumed as paste framing/content, never as keys.
85
+ * Discard is sticky through the paste, even if confirmation later closes.
86
+ */
87
+ handlePasteInput(data, discard = false) {
88
+ if (this.disposed || !data)
89
+ return false;
90
+ if (!this.inPaste) {
91
+ const pendingStart = Boolean(this.startTail);
92
+ const packet = this.startTail + data;
93
+ const start = packet.indexOf(PASTE_START);
94
+ const tail = delimiterTail(packet, PASTE_START);
95
+ // A lone Escape remains an ordinary close/cancel key outside paste.
96
+ if (start < 0 && !pendingStart && tail <= 1)
97
+ return false;
98
+ this.pasteDiscard ||= discard;
99
+ this.startTail = "";
100
+ if (start < 0) {
101
+ if (tail > 1)
102
+ this.startTail = packet.slice(packet.length - tail);
103
+ else
104
+ this.resetPaste(); // Consume, don't replay a malformed opener.
105
+ return true;
106
+ }
107
+ this.inPaste = true;
108
+ // No ambiguous keyboard prefix in a framing packet gets replayed.
109
+ data = packet.slice(start + PASTE_START.length);
110
+ }
111
+ else {
112
+ this.pasteDiscard ||= discard;
113
+ }
114
+ if (this.pasteDiscard)
115
+ this.pasteBuffer = "";
116
+ const packet = this.pasteTail + data;
117
+ this.pasteTail = "";
118
+ const end = packet.indexOf(PASTE_END);
119
+ if (end < 0) {
120
+ const tail = delimiterTail(packet, PASTE_END);
121
+ this.pasteTail = packet.slice(packet.length - tail);
122
+ if (!this.pasteDiscard)
123
+ this.appendPaste(packet.slice(0, packet.length - tail));
124
+ return true;
125
+ }
126
+ if (!this.pasteDiscard)
127
+ this.appendPaste(packet.slice(0, end));
128
+ const paste = this.pasteBuffer;
129
+ const rejected = this.pasteRejected || this.pasteDiscard;
130
+ this.resetPaste();
131
+ // Public insertion avoids Pi marker-ID collisions with literal markers,
132
+ // stale history, and recursively expanded IDs. Anything attached AFTER
133
+ // the terminator is dropped, including Enter or confirmation shortcuts.
134
+ if (!rejected)
135
+ this.insertText(paste);
136
+ return true;
137
+ }
138
+ /** Carry only framing across a thread reset, discarding all old paste text. */
139
+ inheritPasteDrain(previous) {
140
+ this.resetPaste();
141
+ this.inPaste = previous.inPaste;
142
+ this.startTail = previous.startTail;
143
+ this.pasteTail = previous.pasteTail;
144
+ this.pasteDiscard = this.inPaste || Boolean(this.startTail);
145
+ }
146
+ handleInput(data) {
147
+ if (this.disposed || !data || this.handlePasteInput(data))
148
+ return;
149
+ this.dispatch(data);
150
+ }
151
+ /** Crops around the public cursor marker, including one-cell viewports. */
152
+ render(width, maxLines) {
153
+ width = Number.isFinite(width) ? Math.max(0, Math.floor(width)) : 0;
154
+ maxLines = Number.isFinite(maxLines) ? Math.max(0, Math.floor(maxLines)) : 0;
155
+ if (this.disposed || !width || !maxLines)
156
+ return [];
157
+ const focused = this.focused;
158
+ let lines;
159
+ // Obtain cursor geometry even while unfocused, then remove the marker.
160
+ // Width >=3 avoids Pi's one-column wide-grapheme wrapping edge case.
161
+ this.editor.focused = true;
162
+ try {
163
+ lines = this.editor.render(Math.max(3, width)).slice(1, -1);
164
+ }
165
+ finally {
166
+ this.editor.focused = focused;
167
+ }
168
+ const cursor = Math.max(0, lines.findIndex((line) => line.includes(CURSOR_MARKER)));
169
+ const start = Math.max(0, Math.min(cursor - Math.floor(maxLines / 2), lines.length - maxLines));
170
+ return lines.slice(start, start + maxLines).map((line) => {
171
+ const marker = line.indexOf(CURSOR_MARKER);
172
+ if (visibleWidth(line) > width && marker >= 0) {
173
+ const before = line.slice(0, marker);
174
+ const beforeWidth = visibleWidth(before);
175
+ const prefix = sliceByColumn(before, Math.max(0, beforeWidth - width + 1), width - 1, true);
176
+ let suffix = sliceByColumn(line.slice(marker + CURSOR_MARKER.length), 0, width - visibleWidth(prefix), true);
177
+ // A wide cursor grapheme cannot fit in one cell; retain a visible
178
+ // cursor cell rather than dropping either the cursor or its marker.
179
+ if (!visibleWidth(suffix))
180
+ suffix = "\x1b[7m \x1b[0m";
181
+ line = prefix + CURSOR_MARKER + suffix;
182
+ }
183
+ else {
184
+ line = truncateToWidth(line, width, "");
185
+ }
186
+ return focused ? line : line.replaceAll(CURSOR_MARKER, "");
187
+ });
188
+ }
189
+ invalidate() {
190
+ if (this.disposed)
191
+ return;
192
+ this.editor.invalidate();
193
+ this.tui.requestRender();
194
+ }
195
+ dispose() {
196
+ if (this.disposed)
197
+ return;
198
+ this.focused = false;
199
+ this.disposed = true;
200
+ this.resetPaste();
201
+ this.editor.onSubmit = undefined;
202
+ }
203
+ error(message) {
204
+ if (this.callbacks.onError)
205
+ this.callbacks.onError(message);
206
+ else
207
+ throw new Error(message);
208
+ return false;
209
+ }
210
+ acceptText(text, existingBytes = 0) {
211
+ const rejection = this.textError(text, existingBytes);
212
+ return rejection ? this.error(rejection) : true;
213
+ }
214
+ textError(text, existingBytes = 0) {
215
+ // Reject complete text operations instead of leaking printable tails of
216
+ // ANSI/OSC/APC sequences. LF/CR/tabs are data and Pi normalizes them.
217
+ if (/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(text)) {
218
+ return "Draft rejected: terminal control characters are not allowed.";
219
+ }
220
+ if (existingBytes + normalizedBytes(text) > MAX_DRAFT_BYTES) {
221
+ return "Draft rejected: maximum size is 64 KiB. Nothing was truncated or sent.";
222
+ }
223
+ return undefined;
224
+ }
225
+ appendPaste(text) {
226
+ if (this.pasteRejected)
227
+ return;
228
+ this.pasteBuffer += text;
229
+ if (normalizedBytes(this.pasteBuffer) + Buffer.byteLength(this.getText(), "utf8") > MAX_DRAFT_BYTES) {
230
+ this.pasteRejected = true;
231
+ this.pasteBuffer = "";
232
+ this.error("Paste rejected: draft maximum size is 64 KiB. Nothing was truncated or sent.");
233
+ }
234
+ }
235
+ resetPaste() {
236
+ this.inPaste = false;
237
+ this.pasteBuffer = this.pasteTail = this.startTail = "";
238
+ this.pasteRejected = this.pasteDiscard = false;
239
+ }
240
+ insertText(text) {
241
+ const before = this.getText();
242
+ if (!this.acceptText(text, Buffer.byteLength(before, "utf8")))
243
+ return false;
244
+ this.editor.insertTextAtCursor(text);
245
+ this.publishChange(before);
246
+ return true;
247
+ }
248
+ dispatch(data) {
249
+ if (isKeyRelease(data))
250
+ return;
251
+ const kb = getKeybindings();
252
+ const action = EDITOR_ACTIONS.some((id) => kb.matches(data, id));
253
+ const legacyNewline = data === "\x1b\r" || data === "\x1b[13;2~";
254
+ const extraEditingKey = matchesKey(data, "shift+backspace") || matchesKey(data, "shift+delete");
255
+ const key = parseKey(data);
256
+ // Pi exposes a Kitty printable decoder and a protocol-independent key
257
+ // parser. The latter also recognizes xterm modifyOtherKeys characters;
258
+ // use its identity only for preflight, leaving actual decoding to Pi.
259
+ const printable = decodeKittyPrintable(data) ?? (key === "space" || key === "shift+space" ? " " :
260
+ key?.length === 1 ? key : key?.startsWith("shift+") && key.length === 7 ? key.slice(-1) : undefined);
261
+ if (!action && !legacyNewline && !extraEditingKey && printable === undefined) {
262
+ // Unknown escape/control packets are not text. Bulk printable input,
263
+ // including unframed multiline text, uses Pi's normalized insertion.
264
+ if (data.startsWith("\x1b") || (data.length === 1 && data.charCodeAt(0) < 32))
265
+ return;
266
+ if (/[\r\n\t]/.test(data)) {
267
+ this.insertText(data);
268
+ return;
269
+ }
270
+ }
271
+ const before = this.getText();
272
+ if (printable !== undefined || (!action && !legacyNewline && !extraEditingKey)) {
273
+ if (!this.acceptText(printable ?? data, Buffer.byteLength(before, "utf8")))
274
+ return;
275
+ }
276
+ if ((kb.matches(data, "tui.input.newLine") || legacyNewline || data === "\n") &&
277
+ !this.acceptText("\n", Buffer.byteLength(before, "utf8")))
278
+ return;
279
+ this.submitted = false;
280
+ this.editor.handleInput(data);
281
+ const after = this.getText();
282
+ // Defensive guard for Pi actions such as yank/undo/history. All external
283
+ // text is already checked; reject any unexpected expanded oversize edit.
284
+ const rejection = this.textError(after);
285
+ if (rejection) {
286
+ this.editor.setText(before);
287
+ this.invalidate();
288
+ this.error(rejection);
289
+ return;
290
+ }
291
+ const submitted = this.submitted;
292
+ this.publishChange(before);
293
+ if (submitted && before.trim())
294
+ this.callbacks.onSubmit(before);
295
+ }
296
+ publishChange(before) {
297
+ const after = this.getText();
298
+ if (after !== before)
299
+ this.callbacks.onChange(after);
300
+ this.invalidate();
301
+ }
302
+ }
303
+ //# sourceMappingURL=draft-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft-editor.js","sourceRoot":"","sources":["../draft-editor.ts"],"names":[],"mappings":"AACA,OAAO,EACN,aAAa,EAAE,MAAM,EAAE,oBAAoB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CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACtB,OAAO;QACR,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,SAAS,IAAI,MAAM,CAAC,IAAI,EAAE;YAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC;IAEO,aAAa,CAAC,MAAc;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,KAAK,KAAK,MAAM;YAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrD,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;CACD"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { type ExtensionAPI } from "@mariozechner/pi-coding-agent";
1
+ import { type ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  export default function jarvisExtension(pi: ExtensionAPI): void;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -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;AA8FvC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA8c9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,YAAY,EAGjB,MAAM,iCAAiC,CAAC;AAkGzC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAwhB9D"}