@juicesharp/rpiv-pi 2.13.7 → 2.13.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.
Files changed (75) hide show
  1. package/docs/architecture.md +14 -5
  2. package/docs/lanes.md +8 -2
  3. package/extensions/rpiv-core/agents-inject.ts +3 -3
  4. package/extensions/rpiv-core/agents-manifest.ts +3 -3
  5. package/extensions/rpiv-core/agents-sync.ts +19 -15
  6. package/extensions/rpiv-core/agents.ts +6 -6
  7. package/extensions/rpiv-core/built-in-workflows.ts +6 -6
  8. package/extensions/rpiv-core/built-ins/citations.ts +2 -2
  9. package/extensions/rpiv-core/built-ins/design.ts +2 -2
  10. package/extensions/rpiv-core/built-ins/elaboration.ts +3 -3
  11. package/extensions/rpiv-core/built-ins/gate-passes.ts +2 -2
  12. package/extensions/rpiv-core/built-ins/gate-rosters.ts +2 -2
  13. package/extensions/rpiv-core/built-ins/gates.ts +3 -3
  14. package/extensions/rpiv-core/built-ins/goal-baseline.ts +1 -1
  15. package/extensions/rpiv-core/built-ins/grade-panel.ts +4 -4
  16. package/extensions/rpiv-core/built-ins/index.ts +16 -16
  17. package/extensions/rpiv-core/built-ins/plan-cite.ts +4 -4
  18. package/extensions/rpiv-core/built-ins/plan-phases.ts +2 -2
  19. package/extensions/rpiv-core/built-ins/priors.ts +2 -2
  20. package/extensions/rpiv-core/built-ins/reconcile.ts +2 -2
  21. package/extensions/rpiv-core/built-ins/scope-checks.ts +3 -3
  22. package/extensions/rpiv-core/built-ins/slice-checks.ts +5 -5
  23. package/extensions/rpiv-core/built-ins/slices.ts +2 -2
  24. package/extensions/rpiv-core/built-ins/verdict-collector.ts +1 -1
  25. package/extensions/rpiv-core/built-ins/verdict-core.ts +1 -1
  26. package/extensions/rpiv-core/built-ins/verdict-outcome.ts +2 -2
  27. package/extensions/rpiv-core/git-context.ts +1 -1
  28. package/extensions/rpiv-core/guidance.ts +1 -1
  29. package/extensions/rpiv-core/index.ts +14 -14
  30. package/extensions/rpiv-core/lane-console.ts +40 -8
  31. package/extensions/rpiv-core/lane-dock-editor.ts +1 -1
  32. package/extensions/rpiv-core/lane-dock.ts +2 -2
  33. package/extensions/rpiv-core/lane-list.ts +4 -4
  34. package/extensions/rpiv-core/lane-progress.ts +5 -5
  35. package/extensions/rpiv-core/lane-relay-ui.ts +1 -1
  36. package/extensions/rpiv-core/lane-streaming.ts +1 -1
  37. package/extensions/rpiv-core/lane-switcher.ts +6 -6
  38. package/extensions/rpiv-core/lane-transcript-disk.ts +2 -2
  39. package/extensions/rpiv-core/lane-transcript-view.ts +3 -3
  40. package/extensions/rpiv-core/loaded-siblings.ts +41 -0
  41. package/extensions/rpiv-core/meta/checks.ts +2 -2
  42. package/extensions/rpiv-core/meta/presets.ts +3 -3
  43. package/extensions/rpiv-core/meta/unit-graph.ts +4 -4
  44. package/extensions/rpiv-core/meta/wip-guard.ts +3 -3
  45. package/extensions/rpiv-core/models-config-sources.ts +1 -1
  46. package/extensions/rpiv-core/models-config-validate.ts +2 -2
  47. package/extensions/rpiv-core/outcome-derivation.ts +2 -2
  48. package/extensions/rpiv-core/package-checks.ts +52 -20
  49. package/extensions/rpiv-core/pi-installer.ts +1 -1
  50. package/extensions/rpiv-core/pipeline-pointer.ts +1 -1
  51. package/extensions/rpiv-core/prune-legacy-siblings.ts +2 -2
  52. package/extensions/rpiv-core/register-built-in-workflows.ts +2 -2
  53. package/extensions/rpiv-core/rpiv-models/command.ts +4 -4
  54. package/extensions/rpiv-core/rpiv-models/index.ts +3 -3
  55. package/extensions/rpiv-core/rpiv-models/items.ts +2 -2
  56. package/extensions/rpiv-core/rpiv-models/overrides.ts +3 -3
  57. package/extensions/rpiv-core/run-lane-registry.ts +5 -5
  58. package/extensions/rpiv-core/run-lane-types.ts +2 -2
  59. package/extensions/rpiv-core/sdk-workflow-host.ts +7 -7
  60. package/extensions/rpiv-core/session-capture.ts +3 -3
  61. package/extensions/rpiv-core/session-hooks.ts +18 -13
  62. package/extensions/rpiv-core/setup-command.ts +16 -9
  63. package/extensions/rpiv-core/siblings.ts +18 -3
  64. package/extensions/rpiv-core/skill-bracket.ts +2 -2
  65. package/extensions/rpiv-core/skill-contracts-source.ts +3 -3
  66. package/extensions/rpiv-core/subagent-usage.ts +1 -1
  67. package/extensions/rpiv-core/update-agents-command.ts +6 -4
  68. package/extensions/rpiv-core/workflow-execution-host.ts +7 -7
  69. package/extensions/rpiv-core/workflow-question-warp-bridge.ts +3 -3
  70. package/extensions/rpiv-core/workflows/build.ts +3 -3
  71. package/extensions/rpiv-core/workflows/polish.ts +2 -2
  72. package/extensions/rpiv-core/workflows/shared.ts +2 -2
  73. package/extensions/rpiv-core/workflows/ship.ts +2 -2
  74. package/extensions/rpiv-core/workflows/vet.ts +2 -2
  75. package/package.json +2 -2
@@ -44,7 +44,15 @@
44
44
  */
45
45
 
46
46
  import type { ExtensionUIContext, KeybindingsManager, Theme } from "@earendil-works/pi-coding-agent";
47
- import { type Component, Key, matchesKey, type TUI, truncateToWidth } from "@earendil-works/pi-tui";
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,
@@ -54,8 +62,8 @@ import {
54
62
  renderStageBreakdown,
55
63
  SPIN_INTERVAL_MS,
56
64
  SPINNER_FRAMES,
57
- } from "./lane-list.js";
58
- import { LaneTranscriptView } from "./lane-transcript-view.js";
65
+ } from "./lane-list.ts";
66
+ import { LaneTranscriptView } from "./lane-transcript-view.ts";
59
67
  import {
60
68
  type DisplayRow,
61
69
  dequeueInput,
@@ -71,7 +79,7 @@ import {
71
79
  SINGLE_UNIT_KEY,
72
80
  subscribeLanes,
73
81
  unitNeedsInput,
74
- } from "./run-lane-registry.js";
82
+ } from "./run-lane-registry.ts";
75
83
 
76
84
  /** The console renders IN-FLOW, so 0.9 leaves the bottom ~10% of the terminal for the primary
77
85
  * footer that keeps rendering below it (a full-screen ratio would push the footer off-screen). */
@@ -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 full surface
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}PgUp/PgDn scroll · ${toggle} · ${stages} · ${rerun}x stop · ↑/←/esc back`,
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 focus branches dispatch PageUp/PageDown here).
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. */
@@ -36,7 +36,7 @@ import {
36
36
  listLanes,
37
37
  listLanesForDisplay,
38
38
  SINGLE_UNIT_KEY,
39
- } from "./run-lane-registry.js";
39
+ } from "./run-lane-registry.ts";
40
40
 
41
41
  /** The navigation keys the dock cares about; everything else is "other".
42
42
  * Only "down" is acted on (the entry gesture); the rest are classified for the
@@ -25,8 +25,8 @@ import {
25
25
  renderLaneList,
26
26
  SPIN_INTERVAL_MS,
27
27
  SPINNER_FRAMES,
28
- } from "./lane-list.js";
29
- import { type LaneEntry, laneNeedsInput, listLanes, listLanesForDisplay } from "./run-lane-registry.js";
28
+ } from "./lane-list.ts";
29
+ import { type LaneEntry, laneNeedsInput, listLanes, listLanesForDisplay } from "./run-lane-registry.ts";
30
30
 
31
31
  const WIDGET_KEY = "rpiv-lanes";
32
32
  /** Ambient discoverability footer — surfaces how to step in with the two self-explanatory
@@ -13,8 +13,8 @@
13
13
 
14
14
  import type { Theme, ThemeColor } from "@earendil-works/pi-coding-agent";
15
15
  import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
16
- import { shortFailureReason } from "./lane-failure.js";
17
- import { addLaneUsage, formatTokens, type LaneUsage } from "./lane-usage.js";
16
+ import { shortFailureReason } from "./lane-failure.ts";
17
+ import { addLaneUsage, formatTokens, type LaneUsage } from "./lane-usage.ts";
18
18
  import {
19
19
  type DisplayRow,
20
20
  getLane,
@@ -27,8 +27,8 @@ import {
27
27
  type UnitLane,
28
28
  unitNeedsInput,
29
29
  unitUsage,
30
- } from "./run-lane-registry.js";
31
- import { getSubagentUsageForRun, getSubagentUsageForStage } from "./subagent-usage.js";
30
+ } from "./run-lane-registry.ts";
31
+ import { getSubagentUsageForRun, getSubagentUsageForStage } from "./subagent-usage.ts";
32
32
 
33
33
  /** Per-row CAP on the lane region (the scroll-follow window + its +N above/below summaries).
34
34
  * computeLaneLayout bounds laneCap at MAX_WIDGET_LINES - 1, so the list never grows unbounded. */
@@ -35,8 +35,8 @@
35
35
  */
36
36
 
37
37
  import type { ExtensionAPI, ExtensionUIContext } from "@earendil-works/pi-coding-agent";
38
- import { shortFailureReason } from "./lane-failure.js";
39
- import { isLaneRelayUiContext } from "./lane-relay-ui.js";
38
+ import { shortFailureReason } from "./lane-failure.ts";
39
+ import { isLaneRelayUiContext } from "./lane-relay-ui.ts";
40
40
  import {
41
41
  clearUnitLanes,
42
42
  foldStageUsage,
@@ -48,9 +48,9 @@ import {
48
48
  setRecap,
49
49
  setUnitStarted,
50
50
  sweepRunningUnits,
51
- } from "./run-lane-registry.js";
52
- import { getCapturedUiContext } from "./session-capture.js";
53
- import { isModuleNotFound } from "./utils.js";
51
+ } from "./run-lane-registry.ts";
52
+ import { getCapturedUiContext } from "./session-capture.ts";
53
+ import { isModuleNotFound } from "./utils.ts";
54
54
 
55
55
  /**
56
56
  * Process-global guard holding the active `registerLifecycle` disposer. Anchored
@@ -44,7 +44,7 @@
44
44
  */
45
45
 
46
46
  import type { ExtensionUIContext } from "@earendil-works/pi-coding-agent";
47
- import { enqueueInput, getFocusedRun } from "./run-lane-registry.js";
47
+ import { enqueueInput, getFocusedRun } from "./run-lane-registry.ts";
48
48
 
49
49
  /** Brand stamped on a relay so launcher-only session hooks can detect a detached
50
50
  * child's ctx.ui and skip (session-capture / lane-switcher). */
@@ -17,7 +17,7 @@
17
17
 
18
18
  import type { AssistantMessage } from "@earendil-works/pi-ai";
19
19
  import type { AgentSession } from "@earendil-works/pi-coding-agent";
20
- import type { LaneSession } from "./run-lane-registry.js";
20
+ import type { LaneSession } from "./run-lane-registry.ts";
21
21
 
22
22
  /** The agent event the raw session's subscribe listener receives — derived from the SDK
23
23
  * signature so this module imports no SDK event-type value. */
@@ -20,10 +20,10 @@ import type {
20
20
  } from "@earendil-works/pi-coding-agent";
21
21
  import type { EditorTheme, KeyId, TUI } from "@earendil-works/pi-tui";
22
22
  import type { WorkflowHostContext } from "@juicesharp/rpiv-workflow";
23
- import { showLaneConsole } from "./lane-console.js";
24
- import { LaneDock } from "./lane-dock.js";
25
- import { LaneDockEditor } from "./lane-dock-editor.js";
26
- import { isLaneRelayUiContext } from "./lane-relay-ui.js";
23
+ import { showLaneConsole } from "./lane-console.ts";
24
+ import { LaneDock } from "./lane-dock.ts";
25
+ import { LaneDockEditor } from "./lane-dock-editor.ts";
26
+ import { isLaneRelayUiContext } from "./lane-relay-ui.ts";
27
27
  import {
28
28
  getFocusedRun,
29
29
  laneCount,
@@ -31,8 +31,8 @@ import {
31
31
  SINGLE_UNIT_KEY,
32
32
  setFocusedRun,
33
33
  subscribeLanes,
34
- } from "./run-lane-registry.js";
35
- import { isModuleNotFound } from "./utils.js";
34
+ } from "./run-lane-registry.ts";
35
+ import { isModuleNotFound } from "./utils.ts";
36
36
 
37
37
  /**
38
38
  * Root hotkey that opens the lane switcher, registered via Pi's `registerShortcut`
@@ -18,8 +18,8 @@
18
18
  import { existsSync, readdirSync, statSync } from "node:fs";
19
19
  import { join } from "node:path";
20
20
  import { SessionManager } from "@earendil-works/pi-coding-agent";
21
- import { getCachedToolDef } from "./lane-tool-defs.js";
22
- import type { RenderSource, ToolDefArg, ViewerEntry } from "./lane-transcript.js";
21
+ import { getCachedToolDef } from "./lane-tool-defs.ts";
22
+ import type { RenderSource, ToolDefArg, ViewerEntry } from "./lane-transcript.ts";
23
23
 
24
24
  /** A branch loaded from disk plus the render source the transcript pipeline needs. */
25
25
  export interface DiskBranch {
@@ -19,8 +19,8 @@ import {
19
19
  type ToolDefArg,
20
20
  type ViewerEntry,
21
21
  type ViewerMessage,
22
- } from "./lane-transcript.js";
23
- import { type DiskBranch, loadBranchFromDisk } from "./lane-transcript-disk.js";
22
+ } from "./lane-transcript.ts";
23
+ import { type DiskBranch, loadBranchFromDisk } from "./lane-transcript-disk.ts";
24
24
  import {
25
25
  getLane,
26
26
  getUnit,
@@ -29,7 +29,7 @@ import {
29
29
  SINGLE_UNIT_KEY,
30
30
  subscribeLanes,
31
31
  type UnitLane,
32
- } from "./run-lane-registry.js";
32
+ } from "./run-lane-registry.ts";
33
33
 
34
34
  /** True when the lane currently carries real fan-out unit sub-rows (indices ≥ 0 —
35
35
  * the reserved scalar slot is negative, so it never counts as a generation). */
@@ -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.ts";
8
+ import { SIBLINGS } from "./siblings.ts";
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
+ }
@@ -7,8 +7,8 @@
7
7
  import { execSync } from "node:child_process";
8
8
  import { existsSync, readFileSync } from "node:fs";
9
9
  import { isAbsolute, join } from "node:path";
10
- import { FILE_LINE_CITATION_RE, planCitationCheck } from "../built-ins/index.js";
11
- import type { Check, CheckContext, Failure } from "./unit-graph.js";
10
+ import { FILE_LINE_CITATION_RE, planCitationCheck } from "../built-ins/index.ts";
11
+ import type { Check, CheckContext, Failure } from "./unit-graph.ts";
12
12
 
13
13
  const abs = (ctx: CheckContext, p: string) => (isAbsolute(p) ? p : join(ctx.cwd, p));
14
14
 
@@ -10,7 +10,7 @@
10
10
  * scoped returns vs build's sliced, panel-gated stage graph — not the prompts.
11
11
  */
12
12
 
13
- import { IMPLEMENT_DAG_FANOUT } from "../built-ins/index.js";
13
+ import { IMPLEMENT_DAG_FANOUT } from "../built-ins/index.ts";
14
14
  import {
15
15
  acceptanceCommands,
16
16
  acceptanceDisposed,
@@ -19,8 +19,8 @@ import {
19
19
  minCitations,
20
20
  planCitations,
21
21
  treeChanged,
22
- } from "./checks.js";
23
- import { defineUnitGraph, type UnitSpec } from "./unit-graph.js";
22
+ } from "./checks.ts";
23
+ import { defineUnitGraph, type UnitSpec } from "./unit-graph.ts";
24
24
 
25
25
  const research: UnitSpec = {
26
26
  skill: "research",
@@ -48,10 +48,10 @@ import {
48
48
  setRouteNote,
49
49
  type Workflow,
50
50
  } from "@juicesharp/rpiv-workflow/registration";
51
- import { rpivBucketOutcome } from "../artifact-collector.js";
52
- import { COMMIT_BASELINE_PROMPT, latestFsArtifact } from "../built-ins/index.js";
53
- import { lessonsBlock, recordLessons } from "./lessons.js";
54
- import { captureGoalKeepingWip, wipIntact, wipNotice } from "./wip-guard.js";
51
+ import { rpivBucketOutcome } from "../artifact-collector.ts";
52
+ import { COMMIT_BASELINE_PROMPT, latestFsArtifact } from "../built-ins/index.ts";
53
+ import { lessonsBlock, recordLessons } from "./lessons.ts";
54
+ import { captureGoalKeepingWip, wipIntact, wipNotice } from "./wip-guard.ts";
55
55
 
56
56
  // ---------------------------------------------------------------------------
57
57
  // Public vocabulary
@@ -24,9 +24,9 @@ import { execFileSync } from "node:child_process";
24
24
  import { cpSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
25
25
  import { dirname, join } from "node:path";
26
26
  import { fs, type Output, type RunView, type ScriptContext } from "@juicesharp/rpiv-workflow/registration";
27
- import { gitDirtyEntries, readGoalBaseline } from "../built-ins/goal-baseline.js";
28
- import { captureGoal } from "../built-ins/index.js";
29
- import type { Check } from "./unit-graph.js";
27
+ import { gitDirtyEntries, readGoalBaseline } from "../built-ins/goal-baseline.ts";
28
+ import { captureGoal } from "../built-ins/index.ts";
29
+ import type { Check } from "./unit-graph.ts";
30
30
 
31
31
  interface WipRecord {
32
32
  /** Paths dirty (tracked-modified or untracked) when the run started. */
@@ -10,7 +10,7 @@
10
10
 
11
11
  import { readdirSync } from "node:fs";
12
12
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
13
- import { BUNDLED_AGENTS_DIR } from "./paths.js";
13
+ import { BUNDLED_AGENTS_DIR } from "./paths.ts";
14
14
 
15
15
  /** Bundled-agent names (filenames sans `.md`), sorted. `[]` if the dir is unreadable. */
16
16
  export function bundledAgentNames(): string[] {
@@ -15,8 +15,8 @@
15
15
  */
16
16
 
17
17
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
18
- import { findUnknownModelKeys, type KnownModelKeys, loadModelsConfig } from "./models-config.js";
19
- import { bundledAgentNames, loadWorkflowMap, skillCommandNames } from "./models-config-sources.js";
18
+ import { findUnknownModelKeys, type KnownModelKeys, loadModelsConfig } from "./models-config.ts";
19
+ import { bundledAgentNames, loadWorkflowMap, skillCommandNames } from "./models-config-sources.ts";
20
20
 
21
21
  /** Warn once per process — sub-session spawns re-fire session_start, but the
22
22
  * config is process-cached and the typo set is identical, so repeat warnings
@@ -13,8 +13,8 @@
13
13
  */
14
14
 
15
15
  import type { OutcomeDeriverFn } from "@juicesharp/rpiv-workflow/registration";
16
- import { rpivBucketOutcome } from "./artifact-collector.js";
17
- import { isModuleNotFound } from "./utils.js";
16
+ import { rpivBucketOutcome } from "./artifact-collector.ts";
17
+ import { isModuleNotFound } from "./utils.ts";
18
18
 
19
19
  /**
20
20
  * Canonical mapping from a skill's `produces.meta.artifactKind` to the bucket
@@ -1,32 +1,64 @@
1
1
  /**
2
- * Detect which SIBLINGS are installed by reading the active Pi settings file.
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
- import { SIBLINGS, type SiblingPlugin } from "./siblings.js";
7
- import { readPiAgentSettings } from "./utils.js";
15
+ import { SIBLINGS, type SiblingPlugin } from "./siblings.ts";
16
+ import { readPiAgentSettings } from "./utils.ts";
8
17
 
9
18
  /**
10
- * Return the SIBLINGS not currently installed.
11
- * Reads the active Pi settings file once per call — callers that need both the
12
- * full snapshot and the missing subset should call this once and filter.
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 function findMissingSiblings(): SiblingPlugin[] {
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 [...SIBLINGS];
17
- const installed = result.packages.filter((e): e is string => typeof e === "string");
18
- return SIBLINGS.filter((s) => !installed.some((entry) => s.matches.test(entry)));
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 currently installed — the exact complement of
23
- * findMissingSiblings over the same readPiAgentSettings() read. No settings
24
- * file (or a packages array that isn't one) ⇒ [] — mirroring
25
- * findMissingSiblings' all-missing fallback in the opposite direction.
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 findInstalledSiblings(): SiblingPlugin[] {
28
- const result = readPiAgentSettings();
29
- if (!result) return [];
30
- const installed = result.packages.filter((e): e is string => typeof e === "string");
31
- return SIBLINGS.filter((s) => installed.some((entry) => s.matches.test(entry)));
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
  }
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import { spawn } from "node:child_process";
11
- import { EXIT_TIMEOUT, SIGKILL_GRACE_MS } from "./constants.js";
11
+ import { EXIT_TIMEOUT, SIGKILL_GRACE_MS } from "./constants.ts";
12
12
 
13
13
  export interface PiInstallResult {
14
14
  code: number;
@@ -16,7 +16,7 @@
16
16
  */
17
17
 
18
18
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
19
- import { FLAG_DEBUG, MSG_TYPE_PIPELINE_INDEX } from "./constants.js";
19
+ import { FLAG_DEBUG, MSG_TYPE_PIPELINE_INDEX } from "./constants.ts";
20
20
 
21
21
  /**
22
22
  * Keep this in sync with the `disable-model-invocation: true` skill set under
@@ -22,8 +22,8 @@
22
22
  */
23
23
 
24
24
  import { writeFileSync } from "node:fs";
25
- import { LEGACY_SIBLINGS } from "./siblings.js";
26
- import { getPiAgentSettingsPath, readPiAgentSettings } from "./utils.js";
25
+ import { LEGACY_SIBLINGS } from "./siblings.ts";
26
+ import { getPiAgentSettingsPath, readPiAgentSettings } from "./utils.ts";
27
27
 
28
28
  export interface PruneLegacySiblingsResult {
29
29
  /** settings.json `packages[]` entries that were removed (empty = no-op). */
@@ -18,7 +18,7 @@
18
18
  * other siblings already follow (siblings.ts header).
19
19
  */
20
20
 
21
- import { isModuleNotFound } from "./utils.js";
21
+ import { isModuleNotFound } from "./utils.ts";
22
22
 
23
23
  /**
24
24
  * Register the four built-in workflows (build / polish / vet / ship)
@@ -34,7 +34,7 @@ export async function registerBuiltInWorkflows(): Promise<void> {
34
34
  // ERR_MODULE_NOT_FOUND → no-op (no `/wf` without it).
35
35
  const { registerBuiltInsProvider, registerBuiltIns } = await import("@juicesharp/rpiv-workflow/startup");
36
36
  registerBuiltInsProvider(async () => {
37
- const { builtInWorkflows } = await import("./built-in-workflows.js");
37
+ const { builtInWorkflows } = await import("./built-in-workflows.ts");
38
38
  registerBuiltIns(builtInWorkflows);
39
39
  });
40
40
  } catch (err) {
@@ -21,8 +21,8 @@ import {
21
21
  invalidateModelsConfigCache,
22
22
  type ModelsConfigSchema,
23
23
  type ModelThinkingLevelValue,
24
- } from "../models-config.js";
25
- import { showFilterablePicker } from "../models-picker.js";
24
+ } from "../models-config.ts";
25
+ import { showFilterablePicker } from "../models-picker.ts";
26
26
  import {
27
27
  buildEffortItems,
28
28
  buildModelItems,
@@ -31,7 +31,7 @@ import {
31
31
  RESET_LABEL,
32
32
  RESET_VALUE,
33
33
  scopeItems,
34
- } from "./items.js";
34
+ } from "./items.ts";
35
35
  import {
36
36
  applyOverride,
37
37
  floatChecked,
@@ -47,7 +47,7 @@ import {
47
47
  SCOPE_RESET_ALL,
48
48
  SCOPES,
49
49
  type ScopeDescriptor,
50
- } from "./overrides.js";
50
+ } from "./overrides.ts";
51
51
 
52
52
  export function registerRpivModelsCommand(pi: ExtensionAPI): void {
53
53
  pi.registerCommand("rpiv-models", {
@@ -7,7 +7,7 @@
7
7
  * command — /rpiv-models command registration
8
8
  */
9
9
 
10
- export { registerRpivModelsCommand } from "./command.js";
10
+ export { registerRpivModelsCommand } from "./command.ts";
11
11
  export {
12
12
  buildEffortItems,
13
13
  buildModelItems,
@@ -16,7 +16,7 @@ export {
16
16
  RESET_LABEL,
17
17
  RESET_VALUE,
18
18
  scopeItems,
19
- } from "./items.js";
19
+ } from "./items.ts";
20
20
  export {
21
21
  applyOverride,
22
22
  CHECK,
@@ -39,4 +39,4 @@ export {
39
39
  SCOPES,
40
40
  type ScopeDescriptor,
41
41
  withCheck,
42
- } from "./overrides.js";
42
+ } from "./overrides.ts";
@@ -10,7 +10,7 @@ import type { Api, Model } from "@earendil-works/pi-ai";
10
10
  import { getSupportedThinkingLevels } from "@earendil-works/pi-ai";
11
11
  import type { SelectItem } from "@earendil-works/pi-tui";
12
12
  import { loadJsonConfigWithLegacyFallback, modelKey } from "@juicesharp/rpiv-config";
13
- import { type ModelsConfigSchema, THINKING_LEVEL_VALUES, type ThinkingLevelValue } from "../models-config.js";
13
+ import { type ModelsConfigSchema, THINKING_LEVEL_VALUES, type ThinkingLevelValue } from "../models-config.ts";
14
14
  import {
15
15
  CHECK,
16
16
  SCOPE_AGENTS,
@@ -21,7 +21,7 @@ import {
21
21
  SCOPE_STAGES,
22
22
  SCOPES,
23
23
  withCheck,
24
- } from "./overrides.js";
24
+ } from "./overrides.ts";
25
25
 
26
26
  // ---------------------------------------------------------------------------
27
27
  // Sentinel values
@@ -16,9 +16,9 @@
16
16
 
17
17
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
18
18
  import type { SelectItem } from "@earendil-works/pi-tui";
19
- import type { ModelsConfigSchema, ModelThinkingLevelValue } from "../models-config.js";
20
- import { bundledAgentNames, loadWorkflowMap, skillCommandNames } from "../models-config-sources.js";
21
- import { showFilterablePicker } from "../models-picker.js";
19
+ import type { ModelsConfigSchema, ModelThinkingLevelValue } from "../models-config.ts";
20
+ import { bundledAgentNames, loadWorkflowMap, skillCommandNames } from "../models-config-sources.ts";
21
+ import { showFilterablePicker } from "../models-picker.ts";
22
22
 
23
23
  // ---------------------------------------------------------------------------
24
24
  // Scope constants