oira666_pi-watcher 0.0.8 → 0.0.9
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/EVERGREEN.md +4 -2
- package/README.md +2 -3
- package/package.json +1 -1
- package/src/index.ts +0 -14
- package/src/ui.ts +1 -7
package/EVERGREEN.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Summary
|
|
2
2
|
- Watcher is a persistent, independent conversation for observing and steering a running main agent.
|
|
3
|
-
- Opening,
|
|
3
|
+
- Opening, closing, copying, and picking a model must not prompt or stop either agent.
|
|
4
4
|
- Public touchpoints: extension commands/events/UI, session metadata, tool registration, and Pi RPC.
|
|
5
5
|
- The child wraps exported package-manager implementation methods before extensions load.
|
|
6
6
|
- Main history is read-only input; steering requires human approval and is refused during compaction.
|
|
@@ -14,7 +14,7 @@ unless explicitly requested. This is a prompt policy, not a sandbox. Never chang
|
|
|
14
14
|
or its status bar. Closing the panel leaves the side conversation running.
|
|
15
15
|
|
|
16
16
|
## Pi integration (public APIs)
|
|
17
|
-
`src/index.ts` registers `/watcher`,
|
|
17
|
+
`src/index.ts` registers `/watcher`, session/agent/tool/compaction handlers, and approved
|
|
18
18
|
`sendUserMessage(..., { deliverAs })`. It reads session ID/file/leaf, idle state, and project trust.
|
|
19
19
|
The overlay uses `ctx.ui.custom`, native dialogs, clipboard helpers, themes, and pi-tui components.
|
|
20
20
|
The child registers `live_main_tools`/`steer_main`, adds prompt sections in `before_agent_start`,
|
|
@@ -46,6 +46,8 @@ Unit tests cover bounded live state, prompt identity/policy, CLI filtering, JSON
|
|
|
46
46
|
startup, inheritance/exclusions, nested Pi launches, isolated models, resume, approval refusal,
|
|
47
47
|
session guards, locks, shutdown, and recovery. `extension.test.cjs` exercises command → overlay →
|
|
48
48
|
RPC → approval → main delivery, including compaction refusal and shutdown cancellation.
|
|
49
|
+
It also verifies that Watcher registers no keyboard shortcuts and that `/watcher` opens and reopens
|
|
50
|
+
the panel without prompting or losing the side conversation.
|
|
49
51
|
E2E launches `$EVERGREEN_PI_BIN` (or `pi` on PATH) with stdin ignored and uses
|
|
50
52
|
`$EVERGREEN_E2E_MODEL` (required) for real main/side model calls. It verifies reading actual main
|
|
51
53
|
history, live-tool access, unchanged main history, and exact side-history restoration after restart.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A persistent side-agent conversation for your running [Pi](https://pi.dev) agent.
|
|
4
4
|
|
|
5
|
-
**Package:** `oira666_pi-watcher` · **Version:** `0.0.
|
|
5
|
+
**Package:** `oira666_pi-watcher` · **Version:** `0.0.9` · **License:** MIT
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -25,7 +25,6 @@ pi -e ./src/index.ts
|
|
|
25
25
|
|
|
26
26
|
| Command | Action |
|
|
27
27
|
| --- | --- |
|
|
28
|
-
| **Alt+W** | Toggle the Watcher panel without sending a prompt or stopping either agent. |
|
|
29
28
|
| `/watcher` | Create/resume the side agent and show its conversation. **Sends no prompt.** |
|
|
30
29
|
| `/watcher Why is it retrying?` | Open and send exactly that question. |
|
|
31
30
|
| `/watcher model` | Open the side agent's model picker. Does not prompt either agent. |
|
|
@@ -38,7 +37,7 @@ The panel opens immediately while the side process initializes its inherited ext
|
|
|
38
37
|
Inside the overlay:
|
|
39
38
|
|
|
40
39
|
- Type a question and press **Enter**. Use **Shift+Enter** for a newline.
|
|
41
|
-
- **
|
|
40
|
+
- **Esc** closes the conversation view without stopping either agent. In the model picker or an editor, it returns to the previous view. Use `/watcher` to reopen. Conversation, draft, and scroll position are retained.
|
|
42
41
|
- `/model` opens a searchable provider/model picker. Its selection affects **only the side agent** and is persisted in that side conversation. You can change models while the side agent is running, just like in Pi; switching does not abort the current reply.
|
|
43
42
|
- `/stop` cancels only the side agent and clears its queued messages.
|
|
44
43
|
- `/copy` copies to the system clipboard, because terminal mouse selection spans the full terminal width. Messages are numbered in the transcript (`You #n`, `Watcher #n`):
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -270,20 +270,6 @@ export default function watcher(pi: ExtensionAPI): void {
|
|
|
270
270
|
pi.on("session_compact", () => { compacting = false; mainStatus(); });
|
|
271
271
|
pi.on("session_compact_failed", () => { compacting = false; mainStatus(); });
|
|
272
272
|
|
|
273
|
-
pi.registerShortcut("alt+w", {
|
|
274
|
-
description: "Toggle the Watcher panel",
|
|
275
|
-
handler: async (ctx) => {
|
|
276
|
-
if (ctx.mode !== "tui" || !ctx.hasUI) return;
|
|
277
|
-
try {
|
|
278
|
-
if (side && isCurrent(side) && side.store.state.open) {
|
|
279
|
-
side.overlay?.abort();
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
await show(await ensure(ctx));
|
|
283
|
-
} catch (error) { ctx.ui.notify(`Watcher: ${errorText(error)}`, "error"); }
|
|
284
|
-
},
|
|
285
|
-
});
|
|
286
|
-
|
|
287
273
|
/** Copy `pi --session <side session file>` (opens it from any directory) and echo it dimmed. */
|
|
288
274
|
async function copySessionCommand(ctx: ExtensionContext): Promise<void> {
|
|
289
275
|
try {
|
package/src/ui.ts
CHANGED
|
@@ -313,11 +313,6 @@ export class WatcherOverlay implements Component, Focusable {
|
|
|
313
313
|
|
|
314
314
|
handleInput(data: string): void {
|
|
315
315
|
if (this.closed) return;
|
|
316
|
-
// Focused overlays own input, so the main editor's shortcut cannot close us.
|
|
317
|
-
if (matchesKey(data, "alt+w")) {
|
|
318
|
-
this.close("closed");
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
316
|
if (this.notice) {
|
|
322
317
|
this.notice = undefined;
|
|
323
318
|
this.requestRender();
|
|
@@ -397,7 +392,7 @@ export class WatcherOverlay implements Component, Focusable {
|
|
|
397
392
|
if (command === "model") this.openPicker(args.trim());
|
|
398
393
|
else if (command === "stop") this.doStop();
|
|
399
394
|
else if (command === "copy") this.doCopy(args);
|
|
400
|
-
else this.setNotice(`Enter send · Shift+Enter newline · PgUp/PgDn scroll · /model [filter] · /stop · ${COPY_USAGE} ·
|
|
395
|
+
else this.setNotice(`Enter send · Shift+Enter newline · PgUp/PgDn scroll · /model [filter] · /stop · ${COPY_USAGE} · Esc close (main agent untouched)`);
|
|
401
396
|
}
|
|
402
397
|
|
|
403
398
|
/** Allow local commands while an approval owns the normal input controls. */
|
|
@@ -745,7 +740,6 @@ export class WatcherOverlay implements Component, Focusable {
|
|
|
745
740
|
else if (inner >= 76) txt = "Enter send · ⇧Enter newline · PgUp/PgDn scroll · /model · /copy · /stop · Esc close";
|
|
746
741
|
else if (inner >= 50) txt = "Enter send · PgUp/PgDn · /model · /copy · /stop · Esc";
|
|
747
742
|
else txt = "Enter send · Esc close";
|
|
748
|
-
txt = `Alt+W close · ${txt}`;
|
|
749
743
|
return th.fg("dim", ` ${txt}`);
|
|
750
744
|
}
|
|
751
745
|
|