@juicesharp/rpiv-pi 2.13.7 → 2.13.8
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/docs/architecture.md +14 -5
- package/docs/lanes.md +8 -2
- package/extensions/rpiv-core/agents-sync.ts +11 -7
- package/extensions/rpiv-core/lane-console.ts +37 -5
- package/extensions/rpiv-core/loaded-siblings.ts +41 -0
- package/extensions/rpiv-core/package-checks.ts +50 -18
- package/extensions/rpiv-core/session-hooks.ts +11 -6
- package/extensions/rpiv-core/setup-command.ts +11 -4
- package/extensions/rpiv-core/siblings.ts +18 -3
- package/extensions/rpiv-core/update-agents-command.ts +4 -2
- package/package.json +2 -2
package/docs/architecture.md
CHANGED
|
@@ -96,12 +96,21 @@ into the first real user turn after compaction — hidden by default, visible un
|
|
|
96
96
|
|
|
97
97
|
## Sibling coupling
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
`packages[]` array in the active Pi settings file (`<agent dir>/settings.json`, honoring
|
|
101
|
-
`PI_CODING_AGENT_DIR`). No sibling is statically imported from the entry graph; a test
|
|
102
|
-
enforces that.
|
|
99
|
+
A sibling counts as **present** when either signal finds it:
|
|
103
100
|
|
|
104
|
-
|
|
101
|
+
- a case-insensitive regex over the `packages[]` array in the active Pi settings file
|
|
102
|
+
(`<agent dir>/settings.json`, honoring `PI_CODING_AGENT_DIR`);
|
|
103
|
+
- or it is actually loaded in this session: the same regex matched against the source
|
|
104
|
+
path of every loaded tool and extension command, plus a presence marker for
|
|
105
|
+
`rpiv-args`, which registers neither.
|
|
106
|
+
|
|
107
|
+
The second signal covers siblings that load without a settings entry of their own:
|
|
108
|
+
bundled inside another Pi package (a kit), installed per project (`pi install -l`), or
|
|
109
|
+
loaded with `pi -e`. They no longer trigger the missing-siblings banner, and
|
|
110
|
+
`/rpiv-setup` does not install a second copy whose tools would conflict. No sibling is
|
|
111
|
+
statically imported from the entry graph; a test enforces that.
|
|
112
|
+
|
|
113
|
+
`/rpiv-setup` installs whichever of these eight packages are neither declared nor loaded:
|
|
105
114
|
|
|
106
115
|
| Package | Provides |
|
|
107
116
|
| --- | --- |
|
package/docs/lanes.md
CHANGED
|
@@ -35,7 +35,7 @@ The browser replays the selected lane's transcript, tool calls included.
|
|
|
35
35
|
| --- | --- |
|
|
36
36
|
| `↑` / `↓` | Move along the lane spine. `↑` on the top row backs out |
|
|
37
37
|
| `⏎` | Arm the parked question on a flagged lane, inline |
|
|
38
|
-
| `PgUp` / `PgDn
|
|
38
|
+
| `u` / `d`, `PgUp` / `PgDn`, mouse wheel | Scroll the transcript |
|
|
39
39
|
| `t` | Expand or collapse tool output |
|
|
40
40
|
| `s` | Show or hide the per-stage token breakdown |
|
|
41
41
|
| `x` | Stop the selected run |
|
|
@@ -44,9 +44,15 @@ The browser replays the selected lane's transcript, tool calls included.
|
|
|
44
44
|
The footer states the live contract:
|
|
45
45
|
|
|
46
46
|
```
|
|
47
|
-
↑/↓ lanes · ⏎ answer ·
|
|
47
|
+
↑/↓ lanes · ⏎ answer · u/d scroll · t expand · s stages · x stop · ↑/←/esc back
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
In Pi's fullscreen TUI (`--tui-mode fullscreen`), Pi keeps `PgUp`/`PgDn` for its own
|
|
51
|
+
transcript, so page the lane with `u`/`d` instead. The mouse wheel scrolls the lane
|
|
52
|
+
transcript while the pointer is over the browser (Pi 0.87 or newer), including while
|
|
53
|
+
you answer a parked question; over the rest of the screen it scrolls Pi's transcript
|
|
54
|
+
as usual.
|
|
55
|
+
|
|
50
56
|
## Parked questions
|
|
51
57
|
|
|
52
58
|
When a detached stage needs an answer, it does not steal your session. The question
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
type SyncResult,
|
|
25
25
|
} from "./agents-types.js";
|
|
26
26
|
import { loadModelsConfig } from "./models-config.js";
|
|
27
|
-
import { findInstalledSiblings } from "./package-checks.js";
|
|
27
|
+
import { findInstalledSiblings, type LoadedSiblingSources } from "./package-checks.js";
|
|
28
28
|
import { BUNDLED_AGENTS_DIR } from "./paths.js";
|
|
29
29
|
import { toErrorMessage } from "./utils.js";
|
|
30
30
|
|
|
@@ -69,6 +69,7 @@ function processSourceEntries(
|
|
|
69
69
|
manifest: Manifest,
|
|
70
70
|
apply: boolean,
|
|
71
71
|
result: SyncResult,
|
|
72
|
+
loaded: LoadedSiblingSources | undefined,
|
|
72
73
|
): Manifest {
|
|
73
74
|
const newManifest: Manifest = {};
|
|
74
75
|
|
|
@@ -81,7 +82,7 @@ function processSourceEntries(
|
|
|
81
82
|
// mid-pass would tear the recorded hashes and falsely flag agents
|
|
82
83
|
// diverged.
|
|
83
84
|
const injection: AgentInjectionContext = {
|
|
84
|
-
installedExtensions: installedExtensionNames(findInstalledSiblings().map((s) => s.pkg)),
|
|
85
|
+
installedExtensions: installedExtensionNames(findInstalledSiblings(loaded).map((s) => s.pkg)),
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
for (const entry of sourceEntries) {
|
|
@@ -254,9 +255,12 @@ function commitStaleUnlinks(
|
|
|
254
255
|
* mid-sync leaves the manifest claiming files-already-removed (next run picks
|
|
255
256
|
* those up via the vanish branch and reports them in result.removed).
|
|
256
257
|
*
|
|
258
|
+
* `loaded` is the caller's one-per-pass runtime snapshot (`readLoadedSiblingSources`)
|
|
259
|
+
* for the sibling enablement gate; omitted, the gate reads settings only.
|
|
260
|
+
*
|
|
257
261
|
* Never throws — errors are collected in `result.errors`.
|
|
258
262
|
*/
|
|
259
|
-
export function syncBundledAgents(apply: boolean): SyncResult {
|
|
263
|
+
export function syncBundledAgents(apply: boolean, loaded?: LoadedSiblingSources): SyncResult {
|
|
260
264
|
const result = emptySyncResult();
|
|
261
265
|
|
|
262
266
|
if (!existsSync(BUNDLED_AGENTS_DIR)) {
|
|
@@ -280,7 +284,7 @@ export function syncBundledAgents(apply: boolean): SyncResult {
|
|
|
280
284
|
const sourceNames = new Set(sourceEntries);
|
|
281
285
|
const manifest = readManifest(targetDir);
|
|
282
286
|
|
|
283
|
-
const newManifest = processSourceEntries(sourceEntries, targetDir, manifest, apply, result);
|
|
287
|
+
const newManifest = processSourceEntries(sourceEntries, targetDir, manifest, apply, result, loaded);
|
|
284
288
|
|
|
285
289
|
const toUnlink = classifyStaleEntries(manifest, sourceNames, targetDir, apply, newManifest, result);
|
|
286
290
|
|
|
@@ -302,9 +306,9 @@ export function syncBundledAgents(apply: boolean): SyncResult {
|
|
|
302
306
|
* 3. No non-managed files exist in the directory
|
|
303
307
|
*
|
|
304
308
|
* If any check fails, the directory is left intact. Never throws — errors
|
|
305
|
-
* are collected in the CleanupResult.
|
|
309
|
+
* are collected in the CleanupResult. `loaded`: same snapshot as syncBundledAgents.
|
|
306
310
|
*/
|
|
307
|
-
export function cleanupPerCwdAgents(cwd: string): CleanupResult {
|
|
311
|
+
export function cleanupPerCwdAgents(cwd: string, loaded?: LoadedSiblingSources): CleanupResult {
|
|
308
312
|
const result = emptyCleanupResult();
|
|
309
313
|
const perCwdDir = join(cwd, ".pi", "agents");
|
|
310
314
|
|
|
@@ -324,7 +328,7 @@ export function cleanupPerCwdAgents(cwd: string): CleanupResult {
|
|
|
324
328
|
// must use one settings read for the whole pass — the identical gate a
|
|
325
329
|
// sync pass with the same settings would have used.
|
|
326
330
|
const cleanupInjection: AgentInjectionContext = {
|
|
327
|
-
installedExtensions: installedExtensionNames(findInstalledSiblings().map((s) => s.pkg)),
|
|
331
|
+
installedExtensions: installedExtensionNames(findInstalledSiblings(loaded).map((s) => s.pkg)),
|
|
328
332
|
};
|
|
329
333
|
for (const [name] of Object.entries(manifest)) {
|
|
330
334
|
const srcPath = safeJoin(BUNDLED_AGENTS_DIR, name);
|
|
@@ -44,7 +44,15 @@
|
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
46
|
import type { ExtensionUIContext, KeybindingsManager, Theme } from "@earendil-works/pi-coding-agent";
|
|
47
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
type Component,
|
|
49
|
+
Key,
|
|
50
|
+
matchesKey,
|
|
51
|
+
type TUI,
|
|
52
|
+
type TuiMouseEvent,
|
|
53
|
+
type TuiMouseEventResult,
|
|
54
|
+
truncateToWidth,
|
|
55
|
+
} from "@earendil-works/pi-tui";
|
|
48
56
|
import {
|
|
49
57
|
computeLaneLayout,
|
|
50
58
|
FALLBACK_ROWS,
|
|
@@ -80,8 +88,8 @@ const MAX_HEIGHT_RATIO = 0.9;
|
|
|
80
88
|
* collapse the surface below the chrome it must always show (live-output border + a minimal
|
|
81
89
|
* transcript band + the lane block). */
|
|
82
90
|
const MIN_SURFACE_ROWS = 8;
|
|
83
|
-
/** The PageUp/PageDown transcript-scroll page size. (The armed band reclaims the
|
|
84
|
-
* up to `maxRows − chrome`, so this no longer floors the transcript region.) */
|
|
91
|
+
/** The PageUp/PageDown (and `u`/`d`) transcript-scroll page size. (The armed band reclaims the
|
|
92
|
+
* full surface up to `maxRows − chrome`, so this no longer floors the transcript region.) */
|
|
85
93
|
const TRANSCRIPT_MIN = 4;
|
|
86
94
|
|
|
87
95
|
/** The (runId, unitIndex) a display row addresses — a lane (parent) row resolves the
|
|
@@ -441,7 +449,7 @@ export class LaneConsole implements Component {
|
|
|
441
449
|
return truncateToWidth(
|
|
442
450
|
this.theme.fg(
|
|
443
451
|
"dim",
|
|
444
|
-
`↑/↓ lanes · ${answer}
|
|
452
|
+
`↑/↓ lanes · ${answer}u/d scroll · ${toggle} · ${stages} · ${rerun}x stop · ↑/←/esc back`,
|
|
445
453
|
),
|
|
446
454
|
width,
|
|
447
455
|
"…",
|
|
@@ -497,6 +505,17 @@ export class LaneConsole implements Component {
|
|
|
497
505
|
this.scroll(-TRANSCRIPT_MIN);
|
|
498
506
|
return;
|
|
499
507
|
}
|
|
508
|
+
// u/d page the transcript too: Pi's fullscreen viewport consumes PageUp/PageDown before an
|
|
509
|
+
// editor-slot component sees them (only a focused overlay gets them), but plain letters
|
|
510
|
+
// reach us, like t/s/x/r (#173). Lane focus only — in question focus letters are typed.
|
|
511
|
+
if (data === "u") {
|
|
512
|
+
this.scroll(TRANSCRIPT_MIN);
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
if (data === "d") {
|
|
516
|
+
this.scroll(-TRANSCRIPT_MIN);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
500
519
|
// ⏎/→ arm the selected unit's queued question (inert → hot). Inert when nothing is
|
|
501
520
|
// queued — the transcript is already shown, so there is no separate "open" verb.
|
|
502
521
|
if (matchesKey(data, Key.enter) || matchesKey(data, Key.right)) {
|
|
@@ -543,6 +562,19 @@ export class LaneConsole implements Component {
|
|
|
543
562
|
}
|
|
544
563
|
}
|
|
545
564
|
|
|
565
|
+
/**
|
|
566
|
+
* Mouse wheel scrolls the selected unit's transcript, in either focus (#173). Pi's fullscreen
|
|
567
|
+
* screen offers a wheel event to the component under the pointer before scrolling the parent
|
|
568
|
+
* transcript, and `handled` stops that fallback. `wheelDelta` is in lines (negative = up) and
|
|
569
|
+
* already carries Pi's wheel acceleration. Hosts without component mouse dispatch (regular
|
|
570
|
+
* mode, Pi < 0.87) never call this, so nothing changes there.
|
|
571
|
+
*/
|
|
572
|
+
handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined {
|
|
573
|
+
if (event.type !== "wheel" || !event.wheelDelta) return undefined;
|
|
574
|
+
this.scroll(-event.wheelDelta);
|
|
575
|
+
return { handled: true };
|
|
576
|
+
}
|
|
577
|
+
|
|
546
578
|
/** Move the spine selection (clamped) and reconcile via sync() — the single seam that
|
|
547
579
|
* re-targets the transcript and mounts the newly-selected unit's question. */
|
|
548
580
|
private move(delta: number): void {
|
|
@@ -554,7 +586,7 @@ export class LaneConsole implements Component {
|
|
|
554
586
|
this.sync(); // retarget + question-reconcile; retarget forces the reflow repaint
|
|
555
587
|
}
|
|
556
588
|
|
|
557
|
-
/** The single follow/anchor chokepoint (both
|
|
589
|
+
/** The single follow/anchor chokepoint (PageUp/PageDown in both focuses, `u`/`d`, the wheel).
|
|
558
590
|
* PageUp (delta>0) freezes on a stable anchor; PageDown (delta<0) walks it toward the tail
|
|
559
591
|
* and auto-resumes follow when it lands there. `cur` is read from the state this call just
|
|
560
592
|
* mutated, so rapid chained PageUp/PageDown accumulate correctly. */
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot of which SIBLINGS are loaded in this process — the runtime half of
|
|
3
|
+
* sibling detection (#216); package-checks.ts unions it with the settings file.
|
|
4
|
+
* Reads a structural slice of `ExtensionAPI`, so it imports no Pi value.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { LoadedSiblingSources } from "./package-checks.js";
|
|
8
|
+
import { SIBLINGS } from "./siblings.js";
|
|
9
|
+
|
|
10
|
+
/** The structural slice of `ExtensionAPI` the snapshot reads (Pi ≥ 0.80.1 carries `sourceInfo` on both). */
|
|
11
|
+
export interface LoadedSourcesReader {
|
|
12
|
+
getAllTools(): ReadonlyArray<{ sourceInfo?: { path?: string } }>;
|
|
13
|
+
getCommands(): ReadonlyArray<{ source?: string; sourceInfo?: { path?: string } }>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Snapshot what is loaded right now. Call after extensions have loaded
|
|
18
|
+
* (session_start, a command handler). Only extension commands count — a skill
|
|
19
|
+
* or prompt file whose path happens to contain a sibling's name proves nothing.
|
|
20
|
+
* Fail-soft: an unexpected host shape yields an empty snapshot, which reduces
|
|
21
|
+
* detection to the settings-only rule.
|
|
22
|
+
*/
|
|
23
|
+
export function readLoadedSiblingSources(pi: LoadedSourcesReader): LoadedSiblingSources {
|
|
24
|
+
const extensionPaths: string[] = [];
|
|
25
|
+
try {
|
|
26
|
+
for (const tool of pi.getAllTools()) {
|
|
27
|
+
if (tool.sourceInfo?.path) extensionPaths.push(tool.sourceInfo.path);
|
|
28
|
+
}
|
|
29
|
+
for (const command of pi.getCommands()) {
|
|
30
|
+
if (command.source === "extension" && command.sourceInfo?.path) extensionPaths.push(command.sourceInfo.path);
|
|
31
|
+
}
|
|
32
|
+
} catch {
|
|
33
|
+
extensionPaths.length = 0;
|
|
34
|
+
}
|
|
35
|
+
const markers = new Set<string>();
|
|
36
|
+
const slots = globalThis as Record<symbol, unknown>;
|
|
37
|
+
for (const s of SIBLINGS) {
|
|
38
|
+
if (s.marker && slots[Symbol.for(s.marker)] !== undefined) markers.add(s.marker);
|
|
39
|
+
}
|
|
40
|
+
return { extensionPaths, markers };
|
|
41
|
+
}
|
|
@@ -1,32 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Detect which SIBLINGS are installed
|
|
3
|
-
* Pure utility — no ExtensionAPI.
|
|
2
|
+
* Detect which SIBLINGS are installed: declared in the active Pi settings file,
|
|
3
|
+
* OR actually loaded in this process (#216). Pure utility — no ExtensionAPI.
|
|
4
|
+
*
|
|
5
|
+
* Settings alone miss every sibling that loads some other way: bundled as a
|
|
6
|
+
* resource of another Pi package (a "kit"), installed per-project (`pi install
|
|
7
|
+
* -l`), or loaded with `pi -e`. Those showed a false "missing" banner, and
|
|
8
|
+
* /rpiv-setup then installed duplicate copies whose tools conflict. Presence is
|
|
9
|
+
* the UNION of both signals, so detection can only ever find MORE siblings than
|
|
10
|
+
* the settings-only rule did — never fewer. The runtime snapshot is taken by
|
|
11
|
+
* loaded-siblings.ts and passed in; omitted, every function here is exactly the
|
|
12
|
+
* settings-only rule.
|
|
4
13
|
*/
|
|
5
14
|
|
|
6
15
|
import { SIBLINGS, type SiblingPlugin } from "./siblings.js";
|
|
7
16
|
import { readPiAgentSettings } from "./utils.js";
|
|
8
17
|
|
|
9
18
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
19
|
+
* What is loaded in this process, read once per pass by `readLoadedSiblingSources`
|
|
20
|
+
* (loaded-siblings.ts): the source paths of every extension that registered a
|
|
21
|
+
* tool or a slash command, plus the presence markers set by siblings that
|
|
22
|
+
* register neither (rpiv-args only hooks events).
|
|
13
23
|
*/
|
|
14
|
-
export
|
|
24
|
+
export interface LoadedSiblingSources {
|
|
25
|
+
readonly extensionPaths: readonly string[];
|
|
26
|
+
readonly markers: ReadonlySet<string>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function isLoaded(sibling: SiblingPlugin, loaded: LoadedSiblingSources | undefined): boolean {
|
|
30
|
+
if (!loaded) return false;
|
|
31
|
+
if (sibling.marker && loaded.markers.has(sibling.marker)) return true;
|
|
32
|
+
return loaded.extensionPaths.some((path) => sibling.matches.test(path));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The settings file's string `packages` entries — `undefined` when there is no usable settings file. */
|
|
36
|
+
function declaredPackages(): string[] | undefined {
|
|
15
37
|
const result = readPiAgentSettings();
|
|
16
|
-
if (!result) return
|
|
17
|
-
|
|
18
|
-
|
|
38
|
+
if (!result) return undefined;
|
|
39
|
+
return result.packages.filter((e): e is string => typeof e === "string");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function isInstalled(sibling: SiblingPlugin, declared: string[] | undefined, loaded?: LoadedSiblingSources): boolean {
|
|
43
|
+
return (declared?.some((entry) => sibling.matches.test(entry)) ?? false) || isLoaded(sibling, loaded);
|
|
19
44
|
}
|
|
20
45
|
|
|
21
46
|
/**
|
|
22
|
-
* Return the SIBLINGS
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
47
|
+
* Return the SIBLINGS neither declared in settings nor loaded. Without
|
|
48
|
+
* `loaded`, this is exactly the settings-only rule (no settings file ⇒ all
|
|
49
|
+
* missing). Reads the settings file once per call — callers that need both the
|
|
50
|
+
* full snapshot and the missing subset should call this once and filter.
|
|
26
51
|
*/
|
|
27
|
-
export function
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
52
|
+
export function findMissingSiblings(loaded?: LoadedSiblingSources): SiblingPlugin[] {
|
|
53
|
+
const declared = declaredPackages();
|
|
54
|
+
return SIBLINGS.filter((s) => !isInstalled(s, declared, loaded));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Return the SIBLINGS declared in settings or loaded — the exact complement of
|
|
59
|
+
* findMissingSiblings for the same `loaded` snapshot and settings read.
|
|
60
|
+
*/
|
|
61
|
+
export function findInstalledSiblings(loaded?: LoadedSiblingSources): SiblingPlugin[] {
|
|
62
|
+
const declared = declaredPackages();
|
|
63
|
+
return SIBLINGS.filter((s) => isInstalled(s, declared, loaded));
|
|
32
64
|
}
|
|
@@ -29,7 +29,8 @@ import {
|
|
|
29
29
|
takeGitContextIfChanged,
|
|
30
30
|
} from "./git-context.js";
|
|
31
31
|
import { clearInjectionState, handleToolCallGuidance, injectRootGuidance, takeRootGuidance } from "./guidance.js";
|
|
32
|
-
import {
|
|
32
|
+
import { readLoadedSiblingSources } from "./loaded-siblings.js";
|
|
33
|
+
import { findMissingSiblings, type LoadedSiblingSources } from "./package-checks.js";
|
|
33
34
|
import { injectPipelinePointer, PIPELINE_POINTER } from "./pipeline-pointer.js";
|
|
34
35
|
import { isStaleCtxError } from "./utils.js";
|
|
35
36
|
|
|
@@ -137,14 +138,18 @@ async function onSessionStart(
|
|
|
137
138
|
if (startupMaintenanceDone) return;
|
|
138
139
|
startupMaintenanceDone = true;
|
|
139
140
|
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
// One loaded-siblings snapshot for the whole maintenance pass (#216): every
|
|
142
|
+
// extension has registered by session_start, and cleanup, sync and the banner
|
|
143
|
+
// must agree on which siblings are present.
|
|
144
|
+
const loaded = readLoadedSiblingSources(pi);
|
|
145
|
+
const cleanup = cleanupPerCwdAgents(ctx.cwd, loaded);
|
|
146
|
+
const agents = syncBundledAgents(false, loaded);
|
|
142
147
|
// Banner only when a UI is bound; the filesystem work above runs regardless,
|
|
143
148
|
// so a headless first session still installs agents.
|
|
144
149
|
if (ctx.hasUI) {
|
|
145
150
|
notifyCleanup(ctx.ui, cleanup);
|
|
146
151
|
notifyAgentSyncDrift(ctx.ui, agents);
|
|
147
|
-
warnMissingSiblings(ctx.ui);
|
|
152
|
+
warnMissingSiblings(ctx.ui, loaded);
|
|
148
153
|
}
|
|
149
154
|
}
|
|
150
155
|
|
|
@@ -262,8 +267,8 @@ function notifyCleanup(ui: UI, result: CleanupResult): void {
|
|
|
262
267
|
}
|
|
263
268
|
}
|
|
264
269
|
|
|
265
|
-
function warnMissingSiblings(ui: UI): void {
|
|
266
|
-
const missing = findMissingSiblings();
|
|
270
|
+
function warnMissingSiblings(ui: UI, loaded: LoadedSiblingSources): void {
|
|
271
|
+
const missing = findMissingSiblings(loaded);
|
|
267
272
|
if (missing.length === 0) return;
|
|
268
273
|
// Leading newline so Pi's "Warning: " severity prefix sits on its own
|
|
269
274
|
// line; every box row then gets Pi's 1-space continuation indent
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* /rpiv-setup — installs any SIBLINGS
|
|
2
|
+
* /rpiv-setup — installs any SIBLINGS neither declared in the active Pi settings
|
|
3
|
+
* file nor already loaded (bundled in another package, a project install — #216:
|
|
4
|
+
* installing those again makes both copies register the same tools)
|
|
3
5
|
* and prunes deprecated entries (e.g. the unscoped `npm:pi-subagents` from
|
|
4
6
|
* the rpiv-pi 0.12.x → 0.14.0 line). Both mutations are previewed in the
|
|
5
7
|
* confirmation dialog and only executed after the user agrees.
|
|
@@ -9,6 +11,7 @@
|
|
|
9
11
|
*/
|
|
10
12
|
|
|
11
13
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
14
|
+
import { readLoadedSiblingSources } from "./loaded-siblings.js";
|
|
12
15
|
import { findMissingSiblings } from "./package-checks.js";
|
|
13
16
|
import { spawnPiInstall } from "./pi-installer.js";
|
|
14
17
|
import { findLegacySiblings, pruneLegacySiblings } from "./prune-legacy-siblings.js";
|
|
@@ -56,17 +59,21 @@ function buildConfirmBody(missing: SiblingPlugin[], legacyEntries: string[]): st
|
|
|
56
59
|
export function registerSetupCommand(pi: ExtensionAPI): void {
|
|
57
60
|
pi.registerCommand("rpiv-setup", {
|
|
58
61
|
description: "Install rpiv-pi's sibling extension plugins",
|
|
59
|
-
handler: handleSetupCommand,
|
|
62
|
+
handler: (args, ctx) => handleSetupCommand(args, ctx, pi),
|
|
60
63
|
});
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
async function handleSetupCommand(
|
|
66
|
+
async function handleSetupCommand(
|
|
67
|
+
_args: string,
|
|
68
|
+
ctx: { hasUI: boolean; ui: UI },
|
|
69
|
+
pi: Pick<ExtensionAPI, "getAllTools" | "getCommands">,
|
|
70
|
+
): Promise<void> {
|
|
64
71
|
if (!ctx.hasUI) {
|
|
65
72
|
ctx.ui.notify(MSG_INTERACTIVE_ONLY, "error");
|
|
66
73
|
return;
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
const missing = findMissingSiblings();
|
|
76
|
+
const missing = findMissingSiblings(readLoadedSiblingSources(pi));
|
|
70
77
|
const legacyEntries = findLegacySiblings();
|
|
71
78
|
if (missing.length === 0 && legacyEntries.length === 0) {
|
|
72
79
|
ctx.ui.notify(MSG_NOTHING_TO_DO, "info");
|
|
@@ -6,15 +6,28 @@
|
|
|
6
6
|
* /rpiv-setup installer (setup-command.ts). Add a sibling here and every
|
|
7
7
|
* consumer picks it up automatically.
|
|
8
8
|
*
|
|
9
|
-
* Detection is
|
|
10
|
-
*
|
|
9
|
+
* Detection (package-checks.ts) is the union of a regex over the active Pi
|
|
10
|
+
* settings file and what is actually loaded: `matches` is also tested against
|
|
11
|
+
* the source path of every loaded tool / extension command, and `marker` names
|
|
12
|
+
* the presence slot of a sibling that registers neither (#216). No runtime
|
|
13
|
+
* import of sibling packages (keeps rpiv-core pure-orchestrator).
|
|
11
14
|
*/
|
|
12
15
|
|
|
13
16
|
export interface SiblingPlugin {
|
|
14
17
|
/** Install spec passed to `pi install`. Prefixed with `npm:` for Pi's installer. */
|
|
15
18
|
readonly pkg: string;
|
|
16
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Case-insensitive regex that matches the package in settings.json AND in the
|
|
21
|
+
* source path of its loaded extension (e.g. `…/@juicesharp/rpiv-todo/index.ts`
|
|
22
|
+
* bundled inside another package).
|
|
23
|
+
*/
|
|
17
24
|
readonly matches: RegExp;
|
|
25
|
+
/**
|
|
26
|
+
* `Symbol.for` key the sibling sets on `globalThis` when it loads — only for a
|
|
27
|
+
* sibling with no tool or command to find by source path. Keep in sync with
|
|
28
|
+
* the sibling's own constant.
|
|
29
|
+
*/
|
|
30
|
+
readonly marker?: string;
|
|
18
31
|
/** What the sibling provides — shown in /rpiv-setup confirmation and reports. */
|
|
19
32
|
readonly provides: string;
|
|
20
33
|
}
|
|
@@ -55,6 +68,8 @@ export const SIBLINGS: readonly SiblingPlugin[] = [
|
|
|
55
68
|
{
|
|
56
69
|
pkg: "npm:@juicesharp/rpiv-args",
|
|
57
70
|
matches: /rpiv-args(?![-\w])/i,
|
|
71
|
+
// Hooks events only — nothing to find by source path (`LOADED_MARKER`, rpiv-args/index.ts).
|
|
72
|
+
marker: "@juicesharp/rpiv-args:loaded",
|
|
58
73
|
provides: "skill-argument resolver — substitutes $N/$ARGUMENTS in skill bodies",
|
|
59
74
|
},
|
|
60
75
|
{
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
8
8
|
import { cleanupPerCwdAgents, type SyncResult, summarizeCleanupSkips, syncBundledAgents } from "./agents.js";
|
|
9
|
+
import { readLoadedSiblingSources } from "./loaded-siblings.js";
|
|
9
10
|
import { invalidateModelsConfigCache } from "./models-config.js";
|
|
10
11
|
|
|
11
12
|
const MSG_UP_TO_DATE = "All agents already up-to-date.";
|
|
@@ -27,8 +28,9 @@ export function registerUpdateAgentsCommand(pi: ExtensionAPI): void {
|
|
|
27
28
|
// breaking the "/rpiv-update-agents applies edits" promise
|
|
28
29
|
// (models-config.ts module doc).
|
|
29
30
|
invalidateModelsConfigCache();
|
|
30
|
-
const
|
|
31
|
-
const
|
|
31
|
+
const loaded = readLoadedSiblingSources(pi);
|
|
32
|
+
const cleanup = cleanupPerCwdAgents(ctx.cwd, loaded);
|
|
33
|
+
const result = syncBundledAgents(true, loaded);
|
|
32
34
|
if (!ctx.hasUI) return;
|
|
33
35
|
const parts: string[] = [];
|
|
34
36
|
if (cleanup.cleanedUp.length > 0) parts.push(`${cleanup.cleanedUp.length} old dir(s) cleaned up`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-pi",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.8",
|
|
4
4
|
"description": "A skill-based development workflow for Pi Agent. 30 contract-carrying skills (discover → research → design → plan → implement → validate → code-review → commit, and more), the 15 named subagents they dispatch, and four built-in /wf workflows that chain them end to end in detached parallel runs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@juicesharp/rpiv-config": "^2.13.
|
|
55
|
+
"@juicesharp/rpiv-config": "^2.13.8"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@earendil-works/pi-ai": "*",
|