@blackbelt-technology/pi-dashboard-extension 0.6.1 → 0.8.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 (212) hide show
  1. package/.pi/skills/browser/SKILL.md +28 -14
  2. package/.pi/skills/browser/UPSTREAM.md +10 -1
  3. package/.pi/skills/browser/references/electron.agent.md +57 -0
  4. package/.pi/skills/browser/references/own-browser.md +299 -0
  5. package/.pi/skills/browser/references/web.agent.md +323 -0
  6. package/.pi/skills/browser/scripts/check-panerelay.sh +157 -0
  7. package/.pi/skills/doctor/SKILL.md +3 -9
  8. package/.pi/skills/doctor/_lib/checks.ts +14 -68
  9. package/.pi/skills/doctor/_lib/derive-tokens.ts +1 -0
  10. package/.pi/skills/doctor/modules/apple-tools.knowledge.hash +1 -0
  11. package/.pi/skills/doctor/modules/apple-tools.md +51 -0
  12. package/.pi/skills/doctor/modules/oauth-redirect-base.knowledge.hash +1 -0
  13. package/.pi/skills/doctor/modules/oauth-redirect-base.md +71 -0
  14. package/.pi/skills/doctor/modules/pi-resolution.knowledge.hash +1 -1
  15. package/.pi/skills/doctor/modules/pi-resolution.md +21 -1
  16. package/.pi/skills/pi-dashboard/references/api-reference.agent.md +69 -0
  17. package/.pi/skills/project-init/SKILL.md +1 -7
  18. package/.pi/skills/project-init/dox-doctrine.md +42 -0
  19. package/.pi/skills/project-init/profiles/docs/profile.json +1 -1
  20. package/README.md +19 -0
  21. package/agents/DoxTriage.md +80 -0
  22. package/package.json +23 -11
  23. package/src/agent-settled.ts +27 -9
  24. package/src/auto-session-namer.ts +486 -70
  25. package/src/autostart-guard.ts +99 -0
  26. package/src/autostart-lock.ts +258 -0
  27. package/src/bridge-context.ts +107 -5
  28. package/src/bridge-ticket-client.ts +105 -0
  29. package/src/bridge.ts +956 -217
  30. package/src/command-handler.ts +332 -57
  31. package/src/connect-target.ts +130 -0
  32. package/src/connection.ts +371 -7
  33. package/src/endpoint-resolution.ts +221 -0
  34. package/src/flow-event-wiring.ts +125 -3
  35. package/src/followup-buffer.ts +217 -0
  36. package/src/instance-verification.ts +125 -0
  37. package/src/local-token-header.ts +44 -0
  38. package/src/model-refresh.ts +95 -0
  39. package/src/notify-proxy.ts +33 -0
  40. package/src/openspec-cli-shim.ts +173 -0
  41. package/src/pi-env.d.ts +4 -0
  42. package/src/pi-retry-settings.ts +91 -0
  43. package/src/provider-register.ts +257 -29
  44. package/src/remote-registration-gate.ts +102 -0
  45. package/src/retry-tracker.ts +265 -86
  46. package/src/role-manager.ts +20 -0
  47. package/src/role-model-tools.ts +38 -3
  48. package/src/server-auto-start.ts +144 -2
  49. package/src/server-pin-store.ts +92 -0
  50. package/src/session-move.ts +275 -0
  51. package/src/session-sync.ts +33 -9
  52. package/src/subagent-forward-sites.ts +69 -0
  53. package/src/subagent-frame-buffer.ts +24 -3
  54. package/src/subagent-frame-strip.ts +109 -0
  55. package/src/subagent-tick-throttle.ts +250 -0
  56. package/src/transcript-backfill.ts +151 -0
  57. package/src/transcript-request-guard.ts +76 -0
  58. package/src/transport-diagnostics.ts +76 -0
  59. package/src/turn-actionability.ts +20 -0
  60. package/src/ui-stale-guard.ts +58 -0
  61. package/.pi/skills/doctor/AGENTS.md +0 -27
  62. package/src/AGENTS.md +0 -56
  63. package/src/__tests__/abort-latch.test.ts +0 -97
  64. package/src/__tests__/agent-settled.test.ts +0 -82
  65. package/src/__tests__/artifact-roots.test.ts +0 -83
  66. package/src/__tests__/ask-user-attachments.test.ts +0 -106
  67. package/src/__tests__/ask-user-schema-discriminator.test.ts +0 -141
  68. package/src/__tests__/ask-user-tool.test.ts +0 -571
  69. package/src/__tests__/auto-session-namer.test.ts +0 -339
  70. package/src/__tests__/bridge-default-model-apply.test.ts +0 -242
  71. package/src/__tests__/bridge-default-model-gate.test.ts +0 -50
  72. package/src/__tests__/bridge-entry-id-pi-070.test.ts +0 -174
  73. package/src/__tests__/bridge-followup-chat-order.test.ts +0 -215
  74. package/src/__tests__/bridge-followup-multi-entry.test.ts +0 -202
  75. package/src/__tests__/bridge-followup-mutation.test.ts +0 -217
  76. package/src/__tests__/bridge-followup-queue-drain.test.ts +0 -266
  77. package/src/__tests__/bridge-hasui-flip.test.ts +0 -109
  78. package/src/__tests__/bridge-no-queue-mutation.test.ts +0 -112
  79. package/src/__tests__/bridge-plugin-emit-event.test.ts +0 -44
  80. package/src/__tests__/bridge-queue-update-forward.test.ts +0 -77
  81. package/src/__tests__/bridge-shadow-queue-gate.test.ts +0 -299
  82. package/src/__tests__/bridge-shutdown-reset.test.ts +0 -159
  83. package/src/__tests__/bridge-slash-command-routing.test.ts +0 -458
  84. package/src/__tests__/bridge-stop-after-turn.test.ts +0 -72
  85. package/src/__tests__/bridge-system-followup.test.ts +0 -163
  86. package/src/__tests__/bridge-thinking-level-select.test.ts +0 -68
  87. package/src/__tests__/browser-skill-registered.test.ts +0 -84
  88. package/src/__tests__/build-provider-catalogue.test.ts +0 -210
  89. package/src/__tests__/command-handler.test.ts +0 -1180
  90. package/src/__tests__/commit-draft.test.ts +0 -100
  91. package/src/__tests__/connection-dropped-frames.test.ts +0 -78
  92. package/src/__tests__/connection-suppress-auto-start.test.ts +0 -97
  93. package/src/__tests__/connection.test.ts +0 -344
  94. package/src/__tests__/credentials-updated.test.ts +0 -26
  95. package/src/__tests__/custom-provider-apikey-roundtrip.test.ts +0 -128
  96. package/src/__tests__/cwd-missing-probe.test.ts +0 -82
  97. package/src/__tests__/dashboard-commands-shipped.test.ts +0 -53
  98. package/src/__tests__/dashboard-context-injector.test.ts +0 -190
  99. package/src/__tests__/dashboard-default-adapter.test.ts +0 -77
  100. package/src/__tests__/dev-build.test.ts +0 -79
  101. package/src/__tests__/doctor/checks.test.ts +0 -121
  102. package/src/__tests__/doctor/modules.test.ts +0 -64
  103. package/src/__tests__/doctor/provenance-hash.test.ts +0 -94
  104. package/src/__tests__/doctor/router.test.ts +0 -143
  105. package/src/__tests__/empty-actionable-guard-config.test.ts +0 -32
  106. package/src/__tests__/empty-actionable-guard.test.ts +0 -73
  107. package/src/__tests__/enrich-model-metadata.test.ts +0 -222
  108. package/src/__tests__/event-forwarder.test.ts +0 -119
  109. package/src/__tests__/extension-slash-command-detection.test.ts +0 -143
  110. package/src/__tests__/filter-enabled-models.test.ts +0 -151
  111. package/src/__tests__/fixtures/turn-actionability-fixtures.ts +0 -69
  112. package/src/__tests__/fork-entryid-timing.test.ts +0 -88
  113. package/src/__tests__/git-info-status.test.ts +0 -73
  114. package/src/__tests__/git-link-builder.test.ts +0 -102
  115. package/src/__tests__/git-poll.test.ts +0 -69
  116. package/src/__tests__/markdown-image-inliner.test.ts +0 -392
  117. package/src/__tests__/model-resolve.test.ts +0 -379
  118. package/src/__tests__/multiselect-dashboard-routing.test.ts +0 -203
  119. package/src/__tests__/multiselect-list.test.ts +0 -137
  120. package/src/__tests__/multiselect-polyfill.test.ts +0 -92
  121. package/src/__tests__/no-session-replacement-calls.test.ts +0 -99
  122. package/src/__tests__/no-tui-multiselect-arm-regression.test.ts +0 -81
  123. package/src/__tests__/openspec-activity-detector.test.ts +0 -337
  124. package/src/__tests__/openspec-poller.test.ts +0 -124
  125. package/src/__tests__/pi-version-tracker.test.ts +0 -109
  126. package/src/__tests__/process-metrics.test.ts +0 -47
  127. package/src/__tests__/process-scanner-kill.test.ts +0 -61
  128. package/src/__tests__/process-scanner.test.ts +0 -292
  129. package/src/__tests__/project-init-detect-stack.test.ts +0 -61
  130. package/src/__tests__/project-init-dox-kb-config.test.ts +0 -53
  131. package/src/__tests__/project-init-profiles.test.ts +0 -84
  132. package/src/__tests__/project-init-scaffold.test.ts +0 -139
  133. package/src/__tests__/project-init-seed-doctrine.test.ts +0 -100
  134. package/src/__tests__/project-trust.test.ts +0 -92
  135. package/src/__tests__/prompt-bus-wiring.test.ts +0 -791
  136. package/src/__tests__/prompt-bus.test.ts +0 -513
  137. package/src/__tests__/prompt-expander.test.ts +0 -398
  138. package/src/__tests__/provider-register-reload.test.ts +0 -498
  139. package/src/__tests__/provider-register-thinking-levels.test.ts +0 -51
  140. package/src/__tests__/retry-tracker.test.ts +0 -152
  141. package/src/__tests__/role-manager.test.ts +0 -585
  142. package/src/__tests__/role-model-tools-registry-readiness.test.ts +0 -114
  143. package/src/__tests__/role-model-tools.test.ts +0 -229
  144. package/src/__tests__/search-files-completeness.test.ts +0 -111
  145. package/src/__tests__/search-files-ranking.test.ts +0 -168
  146. package/src/__tests__/server-auto-start.test.ts +0 -375
  147. package/src/__tests__/server-launcher-launch.test.ts +0 -96
  148. package/src/__tests__/server-launcher.test.ts +0 -101
  149. package/src/__tests__/server-probe.test.ts +0 -25
  150. package/src/__tests__/session-switch.test.ts +0 -139
  151. package/src/__tests__/session-sync.test.ts +0 -243
  152. package/src/__tests__/source-detector.test.ts +0 -88
  153. package/src/__tests__/stats-extractor.test.ts +0 -92
  154. package/src/__tests__/subagent-frame-buffer.test.ts +0 -239
  155. package/src/__tests__/tool-result-image-inliner.test.ts +0 -206
  156. package/src/__tests__/tui-prompt-adapter.test.ts +0 -213
  157. package/src/__tests__/turn-actionability.test.ts +0 -86
  158. package/src/__tests__/ui-decorators.test.ts +0 -309
  159. package/src/__tests__/ui-modules.test.ts +0 -293
  160. package/src/__tests__/vcs-info.test.ts +0 -265
  161. package/src/__tests__/visibility-intent.test.ts +0 -43
  162. package/src/__tests__/watchdog.test.ts +0 -161
  163. package/src/abort-latch.ts.AGENTS.md +0 -3
  164. package/src/agent-settled.ts.AGENTS.md +0 -3
  165. package/src/artifact-roots.ts.AGENTS.md +0 -3
  166. package/src/ask-user-attachments.ts.AGENTS.md +0 -3
  167. package/src/ask-user-tool.ts.AGENTS.md +0 -3
  168. package/src/auto-session-namer.ts.AGENTS.md +0 -3
  169. package/src/bridge-context.ts.AGENTS.md +0 -3
  170. package/src/bridge-default-model-gate.ts.AGENTS.md +0 -3
  171. package/src/bridge.ts.AGENTS.md +0 -3
  172. package/src/command-handler.ts.AGENTS.md +0 -3
  173. package/src/commit-draft-agent.ts.AGENTS.md +0 -3
  174. package/src/commit-draft.ts.AGENTS.md +0 -3
  175. package/src/connection.ts.AGENTS.md +0 -3
  176. package/src/dashboard-context-injector.ts.AGENTS.md +0 -3
  177. package/src/dashboard-default-adapter.ts.AGENTS.md +0 -3
  178. package/src/dev-build.ts.AGENTS.md +0 -3
  179. package/src/empty-actionable-guard-config.ts.AGENTS.md +0 -3
  180. package/src/empty-actionable-guard.ts.AGENTS.md +0 -3
  181. package/src/event-forwarder.ts.AGENTS.md +0 -3
  182. package/src/flow-event-wiring.ts.AGENTS.md +0 -3
  183. package/src/git-link-builder.ts.AGENTS.md +0 -3
  184. package/src/git-poll.ts.AGENTS.md +0 -3
  185. package/src/hasui-flip.ts.AGENTS.md +0 -3
  186. package/src/markdown-image-inliner.ts.AGENTS.md +0 -3
  187. package/src/model-tracker.ts.AGENTS.md +0 -3
  188. package/src/multiselect-decode.ts.AGENTS.md +0 -3
  189. package/src/multiselect-list.ts.AGENTS.md +0 -3
  190. package/src/multiselect-polyfill.ts.AGENTS.md +0 -3
  191. package/src/process-metrics.ts.AGENTS.md +0 -3
  192. package/src/process-scanner.ts.AGENTS.md +0 -3
  193. package/src/project-init/AGENTS.md +0 -12
  194. package/src/project-trust.ts.AGENTS.md +0 -3
  195. package/src/prompt-bus.ts.AGENTS.md +0 -3
  196. package/src/prompt-expander.ts.AGENTS.md +0 -3
  197. package/src/provider-register.ts.AGENTS.md +0 -3
  198. package/src/retry-tracker.ts.AGENTS.md +0 -3
  199. package/src/role-manager.ts.AGENTS.md +0 -3
  200. package/src/role-model-tools.ts.AGENTS.md +0 -3
  201. package/src/server-auto-start.ts.AGENTS.md +0 -3
  202. package/src/server-launcher.ts.AGENTS.md +0 -3
  203. package/src/session-sync.ts.AGENTS.md +0 -3
  204. package/src/slash-dispatch.ts.AGENTS.md +0 -3
  205. package/src/source-detector.ts.AGENTS.md +0 -3
  206. package/src/subagent-frame-buffer.ts.AGENTS.md +0 -3
  207. package/src/tool-result-image-inliner.ts.AGENTS.md +0 -3
  208. package/src/tui-prompt-adapter.ts.AGENTS.md +0 -3
  209. package/src/turn-actionability.ts.AGENTS.md +0 -3
  210. package/src/ui-modules.ts.AGENTS.md +0 -3
  211. package/src/vcs-info.ts.AGENTS.md +0 -3
  212. package/src/visibility-intent.ts.AGENTS.md +0 -3
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: apple-tools
3
+ scope: iMCP (Apple PIM) provisioning state for the apple-tools plugin.
4
+ symptoms:
5
+ - apple tools not working
6
+ - imcp not provisioned
7
+ - calendar tool fails
8
+ - apple calendar contacts reminders
9
+ - imcp-server not found
10
+ depends-on: [env-node]
11
+ derives-from:
12
+ - packages/apple-tools/src/install.ts (runInstaller check mode — the shared checker)
13
+ - packages/apple-tools/src/doctor.ts (doctorProbe — read-only verdict)
14
+ - packages/apple-tools/src/detect.ts (MIN_MACOS 15.3, candidate paths)
15
+ ---
16
+
17
+ ## SCOPE
18
+ Whether iMCP is provisioned for the `apple-tools` plugin on this host: platform,
19
+ macOS version floor, `imcp-server` discovery, and the two config writes. macOS
20
+ only — a non-macOS host is inert, never a fault.
21
+
22
+ ## KNOWLEDGE
23
+ The verdict derives from the SAME write-suppressed checker the CLI `--check` and
24
+ the settings panel use (`doctorProbe` → `runInstaller(env, { check: true })`), so
25
+ all surfaces report the same nine-member terminal state:
26
+ `UNSUPPORTED_PLATFORM`, `OS_VERSION_UNKNOWN`, `OS_TOO_OLD`, `NO_INSTALL_METHOD`,
27
+ `INSTALL_FAILED`, `CONFIG_UNPARSEABLE`, `CONFIG_WRITE_FAILED`,
28
+ `READY_PENDING_GRANTS`, `READY`.
29
+ - The probe is read-only: 0 config writes, 0 install attempts.
30
+ - Non-macOS reports `UNSUPPORTED_PLATFORM` and is NOT a remediation item.
31
+ - TCC permission grants are menu-bar only and undetectable ahead of a call — a
32
+ granted vs pending distinction cannot be probed.
33
+
34
+ ## CHECKS
35
+ - `doctorProbe(createInstallerEnv(), packagePresent)` from
36
+ `@blackbelt-technology/pi-dashboard-apple-tools` (via its source module).
37
+ - Compare the resulting `state` with `pi-apple-tools-install --check` — they MUST
38
+ match (single implementation).
39
+ - `packagePresent` = is `@blackbelt-technology/pi-dashboard-apple-tools` installed.
40
+
41
+ ## FIX ROUTING
42
+ - `NO_INSTALL_METHOD` / binary absent → run `pi-apple-tools-install` (installs the
43
+ iMCP cask when Homebrew is present, else prints the download link).
44
+ - `OS_TOO_OLD` / `OS_VERSION_UNKNOWN` → upgrade macOS to >= 15.3.
45
+ - `READY_PENDING_GRANTS` → open the iMCP menu-bar app and grant permissions
46
+ (manual, unautomatable).
47
+ - A permission-class failure at call time → menu-bar remediation, NOT re-install.
48
+
49
+ ## DERIVES-FROM
50
+ Source: `packages/apple-tools/src/install.ts`, `packages/apple-tools/src/doctor.ts`,
51
+ `packages/apple-tools/src/detect.ts`. Hash sidecar: `apple-tools.knowledge.hash`.
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: oauth-redirect-base
3
+ scope: Report which OAuth redirect base actually won, and which tier produced it.
4
+ symptoms:
5
+ - redirect_uri_mismatch
6
+ - oauth login loop
7
+ - callback goes to localhost
8
+ - login works locally but not behind the proxy
9
+ - which redirect base is in use
10
+ - oauth broken behind reverse proxy
11
+ depends-on:
12
+ - install-topology
13
+ derives-from:
14
+ - GET /api/auth/diagnostics over loopback (server-enriched)
15
+ - ~/.pi/dashboard/config.json auth.redirectBaseUrl (live)
16
+ - ~/.pi/dashboard/server.log "OAuth redirect base:" line (live)
17
+ ---
18
+
19
+ ## SCOPE
20
+ Which base the dashboard mints OAuth `redirect_uri` from, and which tier of the
21
+ precedence chain produced it. Distinct from "is the value malformed" — that is
22
+ the server's own startup warning.
23
+
24
+ ## KNOWLEDGE
25
+ Precedence, highest first:
26
+ 1. `auth.redirectBaseUrl` — operator-stated scalar, config file / Settings ▸ Security
27
+ 2. `getTunnelUrl()` — the active tunnel
28
+ 3. `http://localhost:<port>` — fallback
29
+
30
+ `publicBaseUrls` is NOT a tier. It is a LIST (every address the dashboard
31
+ answers on); an OAuth `redirect_uri` must be ONE pre-registered origin, so no
32
+ inference rule promotes it. The operator states the scalar.
33
+
34
+ Trailing slashes are stripped from whichever base wins. An empty string counts
35
+ as absent and falls through.
36
+
37
+ Two traps:
38
+ - **The provider must be told too.** Setting the config field alone still fails
39
+ with `redirect_uri_mismatch` until the identical callback URL is registered in
40
+ the GitHub / Google / Keycloak app settings.
41
+ - **Boot with zero resolvable providers** installs no `/auth/*` route and no
42
+ `_reloadAuth`, so an auth config change is inert until a restart. The endpoint
43
+ reports `authActive: false` in that state.
44
+
45
+ ## CHECKS
46
+ - `GET /api/auth/diagnostics` over **loopback** (server-enriched): returns
47
+ `{ redirectBase, source, authActive, providerCount }`. `networkGuard` admits
48
+ loopback with no JWT — which is the point, since a remote operator with broken
49
+ OAuth cannot obtain one.
50
+ - Server down / no HTTP: grep `~/.pi/dashboard/server.log` for
51
+ `OAuth redirect base:` — written at every register and reload.
52
+ - Compare `source` against the deployment: behind a reverse proxy the expected
53
+ source is `auth.redirectBaseUrl`; `tunnel` or `localhost` there means the
54
+ override is absent or empty.
55
+
56
+ ## FIX ROUTING
57
+ - `source: localhost` behind a proxy → set `auth.redirectBaseUrl` (Settings ▸
58
+ Security, or the Gateway "add gateway URL" action with OAuth selected).
59
+ - `source: tunnel` but the browser reached a custom domain → same fix; the
60
+ override outranks the tunnel by design.
61
+ - Base correct but login still fails → register the identical
62
+ `<base>/auth/callback/<provider>` with the provider.
63
+ - `authActive: false` → the server booted with zero resolvable providers;
64
+ restart after configuring one. `PUT /api/config` alone cannot help.
65
+ - Warning in the log about credentials / query / fragment → the value is used as
66
+ written but is almost certainly wrong; strip `user:pass@`, `?…`, `#…`.
67
+
68
+ ## DERIVES-FROM
69
+ Server-enriched: `GET /api/auth/diagnostics`. Live: `config.json`
70
+ `auth.redirectBaseUrl`, `server.log` resolved-base line.
71
+ Hash sidecar: `oauth-redirect-base.knowledge.hash`.
@@ -1 +1 @@
1
- 80194b0764f0c67e
1
+ 7cf1f8402e98e7af
@@ -16,6 +16,7 @@ derives-from:
16
16
  - managed ~/.pi-dashboard node_modules (live)
17
17
  - createRequire(sessionCwd) resolution (live)
18
18
  - packages/server/package.json#piCompatibility.minimum (floor)
19
+ - packages/shared/src/pi-installs/ (enumeration + floor reader, shared)
19
20
  ---
20
21
 
21
22
  ## SCOPE
@@ -35,9 +36,22 @@ versions. Never assume "pi is one thing":
35
36
  - Per-session-cwd `createRequire(cwd+'/_').resolve(...)` — what a launched
36
37
  session actually loads.
37
38
 
39
+ TWO divergence questions. Never conflate them:
40
+ - **Consumer divergence** — the `pi` (session spawn) and `pi-coding-agent`
41
+ (server import) tools resolve to DIFFERENT installs. Predicate: realpath'd
42
+ package-directory inequality, NOT version inequality. Two different installs
43
+ at the same version ARE diverged.
44
+ - **Install-set divergence** — >1 distinct version anywhere on the box. One
45
+ unused old install triggers this and NOT consumer divergence.
46
+ `/api/health.piRuntime` reports both under distinct fields
47
+ (`consumerDiverged` + `installSetDiverged`); the Settings runtime picker
48
+ reports consumer divergence only.
49
+
38
50
  Failure modes:
39
51
  - Dashboard `/api/health` `piVersion` ≠ the version resolved at the session cwd
40
52
  → dashboard and sessions run different pi.
53
+ - Consumer divergence → the runtime is split in half: sessions spawn one pi,
54
+ the server imports another.
41
55
  - Any location below `piCompatibility.minimum` → that consumer fails.
42
56
 
43
57
  ## CHECKS
@@ -45,7 +59,13 @@ Failure modes:
45
59
  - Read version from repo `node_modules/@earendil-works/pi-coding-agent/package.json`.
46
60
  - `node -e "console.log(require('module').createRequire(process.cwd()+'/_').resolve('@earendil-works/pi-coding-agent'))"` — session cwd resolution.
47
61
  - Use `enumeratePiInstalls({ label: dir })` + `piVersionDivergence()` from
48
- `_lib/checks.ts`; compare each to `readPiFloor(serverPkgJsonPath)`.
62
+ `_lib/checks.ts` (re-exports `shared/src/pi-installs/` — ONE implementation,
63
+ shared with the server); compare each to `readPiFloor(serverPkgJsonPath)`.
64
+ `piVersionDivergence` answers INSTALL-SET divergence only.
65
+ - `enumeratePiCandidates()` (same module) derives the candidate set the picker
66
+ offers; `GET /api/pi/installs` returns it with per-consumer `usedBy`.
67
+ - `curl -s localhost:8000/api/health | jq .piRuntime` — both divergence labels
68
+ plus the two consumer versions, with the server up.
49
69
  - Multiple versions are OK **only** if every one ≥ floor.
50
70
 
51
71
  ## FIX ROUTING
@@ -0,0 +1,69 @@
1
+ # api-reference.md — index
2
+
3
+ Pull-only condensed map. Source: packages/extension/.pi/skills/pi-dashboard/references/api-reference.md. Endpoint → method+path, body, response. Base URL `http://localhost:{port}` (default 8000; config `~/.pi/dashboard/config.json`). JSON responses; mutations need `Content-Type: application/json`.
4
+
5
+ ## WebSocket bus verbs
6
+ - Session/flow COMMAND verbs — prefer WS bus over REST; client `@blackbelt-technology/pi-dashboard-bus-client` (`scripts/dashboard-bus.ts`). Verbs = `BrowserToServerMessage` union; `plugin_config_write` excluded → stays REST. `spawn`/`resume` replies exact-correlated; other waits structural (session-id + status).
7
+
8
+ ## Health & Status
9
+ - `GET /api/health` — liveness `{ ok, pid, uptime }`. `GET /auth/status` — `{ authenticated, authEnabled }`.
10
+
11
+ ## Sessions
12
+ - `GET /api/sessions` — list all. Fields: `id, cwd, name?, source (tui|zed|tmux|dashboard|terminal|unknown), status (active|idle|streaming|ended), model?, thinkingLevel?, startedAt, endedAt?, tokensIn?, tokensOut?, cost?, currentTool?, gitBranch?, attachedProposal?, hidden?, activeFlowName?, flowStatus? (running|success|error|aborted), sessionFile?`.
13
+
14
+ ## Session Control
15
+ - `POST /api/session/:id/prompt` — `{ text (required), images? [{ type:"image", data, mimeType }] }`. 400 no text, 404, 502 no bridge.
16
+ - `POST /api/session/:id/abort` — 200 / 404. `POST /api/session/:id/shutdown` — terminates pi process, not server.
17
+ - `POST /api/session/:id/rename` — `{ name }`. 400 missing name, 404.
18
+ - `POST /api/session/:id/hide` / `unhide` — 200 / 404.
19
+ - `POST /api/session/spawn` — `{ cwd }`. 400 missing cwd, 500. `POST /api/session/:id/resume` — `{ mode: "continue"|"fork" }`. 400, 404, 409 active/already resuming, 500.
20
+
21
+ ## Flow Control
22
+ - `POST /api/session/:id/flow-control` — `{ action: "abort"|"toggle_autonomous" }`. 400, 404.
23
+
24
+ ## Model Configuration
25
+ - `GET /api/models` — reachable model catalogue. `annotated=1` → +`excludedReason` (`no-credential`|`oauth-incompatible`). `{ object:"list", data:[{ id:"provider/modelId", provider, reasoning?, input?, contextWindow?, maxTokens?, cost?, excludedReason? }] }`. 503 pi-ai down. Do NOT parse `~/.pi/agent/providers.json` / `models.json`.
26
+ - `POST /api/session/:id/model` — `{ provider, modelId }`. 400, 404.
27
+ - `POST /api/session/:id/thinking-level` — `{ level }`. 400, 404.
28
+
29
+ ## OpenSpec
30
+ - `POST /api/session/:id/attach-proposal` — `{ changeName }`; auto-names unnamed session. 400, 404.
31
+ - `POST /api/session/:id/detach-proposal` — 200 / 404.
32
+ - `GET /api/openspec-archive?cwd=CWD` — `data: [{ name, date, path }]`.
33
+
34
+ ## Git Operations
35
+ - All git endpoints — localhost-only.
36
+ - `GET /api/git/branches?cwd=CWD` — `{ current, detached, branches:[{ name, isRemote, isCurrent }] }`.
37
+ - `POST /api/git/checkout` — `{ cwd, branch, stash? }`. 409 dirty → `{ success:false, dirty:true, files:[...] }`.
38
+ - `POST /api/git/init` — `{ cwd }`. `POST /api/git/stash-pop` — `{ cwd }` → `{ conflicts }`.
39
+
40
+ ## Files & Browse
41
+ - All localhost-only.
42
+ - `GET /api/file?cwd=CWD&path=RELPATH` — file `{ type:"file", content }` | dir `{ type:"directory", entries }`.
43
+ - `GET /api/browse?path=PATH` — `{ current, parent, entries:[{ name, path, isGit, isPi }] }`.
44
+ - `GET /api/readme?cwd=CWD` — README.md content.
45
+
46
+ ## Events
47
+ - `GET /api/events/:sessionId/:seq` — `{ eventType, timestamp, data }`.
48
+ - `GET /api/session-diff?sessionId=ID` — localhost-only. `{ isGitRepo, files:[{ path, changes:[{ type, timestamp, message }], gitDiff }] }`.
49
+
50
+ ## Configuration
51
+ - `GET /api/config` — redacted secrets; localhost-only.
52
+ - `PUT /api/config` — partial merge; localhost-only. Any subset: `port, autoShutdown, shutdownIdleSeconds, spawnStrategy, tunnel`.
53
+
54
+ ## Tunnel
55
+ - `GET /api/tunnel-status` — `{ status: active|inactive|unavailable, url, serverOs }`.
56
+ - `POST /api/tunnel-connect` — create connection.
57
+ - `POST /api/tunnel-disconnect` — `{ forget?: true }`. forget=true → releases reserved URL (`zrok2 delete name`) + clears `tunnel.zrok.reservedName`; forget=false/absent → URL stable next connect.
58
+
59
+ ## Server Lifecycle
60
+ - `POST /api/shutdown` — localhost-only; flushes persistence; `{ ok:true }`.
61
+
62
+ ## Pi Resources
63
+ - All localhost-only.
64
+ - `GET /api/pi-resources?cwd=CWD` — discovered extensions, skills, prompts.
65
+ - `GET /api/pi-resource-file?path=FILEPATH` — restricted to allowed locations.
66
+ - `GET /api/editors?path=CWD` — available editors. `POST /api/open-editor` — `{ path, editor, file?, line? }`.
67
+
68
+ ## Pinned Directories
69
+ - `GET /api/pinned-dirs` — `{ success, data: ["/path"] }`.
@@ -1,12 +1,6 @@
1
1
  ---
2
2
  name: project-init
3
- description: >
4
- Scaffold an unconfigured directory into a configured pi project. Interactive,
5
- profile-driven: lists project profiles (coding, docs, plus user profiles),
6
- asks which to use, previews the planned writes, and on confirmation writes
7
- AGENTS.md, .pi/settings.json (with a worktreeInit hook + toolset), and prompt
8
- files. Use when a bare directory needs turning into a working pi project, or
9
- when the dashboard's "Initialize" button spawns this session.
3
+ description: 'Scaffold an unconfigured directory into a configured pi project. Interactive, profile-driven: previews the planned writes, then writes AGENTS.md, .pi/settings.json and prompt files — optionally also a knowledge base, an openspec/ scaffold, and user-global ~/.pi/agent/settings.json. Use on a bare directory, or when the dashboard''s "Initialize" button spawns this session.'
10
4
  license: MIT
11
5
  metadata:
12
6
  author: pi-dashboard
@@ -9,6 +9,11 @@ lacks the `<!-- dox-doctrine -->` marker: the WRITE discipline plus one READ
9
9
  variant (kb-wired or manual). The sections below are delimited so the seeder
10
10
  can compose the right block.
11
11
 
12
+ The MAINTAIN section at the end sits deliberately **outside** those markers: it is
13
+ reference for whoever repairs a drifted tree, not a per-turn rule, so it is never
14
+ seeded into a root `AGENTS.md` and costs nothing per turn. Reach it on demand via
15
+ `kb_search "dox maintenance"`.
16
+
12
17
  <!-- dox:write:start -->
13
18
  ## Documentation Update Protocol (WRITE discipline)
14
19
 
@@ -102,3 +107,40 @@ When your reflex is the left column, do the right column instead:
102
107
  then add the missing directory `AGENTS.md` row per the WRITE discipline. The tree
103
108
  goes first.
104
109
  <!-- dox:read:manual:end -->
110
+
111
+ ## Maintaining a drifted tree (NOT seeded — reference only)
112
+
113
+ Three failure modes account for most rot. None is caught by a naive "does the row
114
+ exist" check, and two are invisible to tooling that only hashes files.
115
+
116
+ **1. Moving a file rots OTHER rows' prose.** A lint hashes the file behind each
117
+ row; it does not validate paths written *inside* a row's purpose text. So a
118
+ directory reorg leaves cross-references pointing at paths that no longer exist,
119
+ and the tree still lints clean. Observed cost: a subagent routing rule cited two
120
+ deleted directories for weeks, so the trigger could never fire and the agent was
121
+ never spawned. **After any move, grep the whole tree for the old path.**
122
+ `kb dox lint` reports this as `broken-ref`.
123
+
124
+ **2. An orphan row is usually a RELOCATION, not garbage.** When a row's file no
125
+ longer exists, the file has typically moved rather than died. Deleting the row
126
+ throws away a written purpose; the fix is to move it to the node that now owns
127
+ the file, creating that node if absent. Never let rows bubble up to the root
128
+ `AGENTS.md` because an intermediate directory lacks its own — the root must stay
129
+ a per-file-index-free doctrine file.
130
+
131
+ **3. `stale` means bytes changed, NOT that the row is wrong.** Staleness is a
132
+ content hash against a last-acknowledged value. A row is a one-line purpose
133
+ summary, not an export manifest: it may legitimately omit everything a diff
134
+ added. Two tempting responses are both wrong — bulk re-acknowledging launders
135
+ real drift, and a "does the row still name symbols present in the file"
136
+ heuristic produces false positives (it will flag a row that correctly documents
137
+ a symbol as *removed*). Judge each row against the actual diff since its
138
+ acknowledged state: `kb dox triage` recovers that diff by finding the commit
139
+ whose blob matches the acked hash, and can hand it to a cheap model.
140
+
141
+ **Corollary — before trusting any cleanup pass:** a scan tuned only for recall
142
+ drowns in false positives. Ranking one repo's candidate path references produced
143
+ 548 raw hits for roughly 4 real defects; the discriminator that mattered was
144
+ requiring the first path segment to be a real top-level entry of *this* repo,
145
+ which rejects URL routes, MIME types, npm specifiers and descriptions of other
146
+ projects' layouts.
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "description": "Documentation repo — writing structure + style. OpenSpec disabled; no build step.",
3
- "dox": false
3
+ "dox": true
4
4
  }
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # Pi Dashboard Bridge Extension
2
+
3
+ The pi extension that connects a running `pi` session to a Pi Dashboard server.
4
+
5
+ Loaded into every pi session, it forwards session events over a WebSocket to the
6
+ dashboard and accepts remote commands (prompt, abort, steer) coming back.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ pi package add @blackbelt-technology/pi-dashboard-extension
12
+ ```
13
+
14
+ Also ships the `pi-dashboard`, `browser`, `project-init` and `doctor` skills, plus
15
+ bundled subagent definitions under `agents/`.
16
+
17
+ ## License
18
+
19
+ MIT — part of [pi-agent-dashboard](https://github.com/BlackBeltTechnology/pi-agent-dashboard).
@@ -0,0 +1,80 @@
1
+ ---
2
+ description: Judge whether a DOX AGENTS.md row is still accurate after its source file changed. Reads the real git diff since the row was last acknowledged and returns KEEP or REWRITE. Cheap, isolated, batched — never edits files itself.
3
+ model: "@fast"
4
+ inherit_context: false
5
+ tools: [read, bash, kb_search, kb_get]
6
+ ---
7
+
8
+ You are the DoxTriage subagent — a fast, isolated judge for one question:
9
+
10
+ **Given a DOX row and the diff its source file has accrued since that row was
11
+ last acknowledged, is the row's purpose text still ACCURATE?**
12
+
13
+ You do NOT edit files. You return a verdict per item. The parent applies them.
14
+
15
+ ═══════════════════════════════════════════════════════════════════════
16
+ INPUT — the parent gives you a JSON array of work items
17
+ ═══════════════════════════════════════════════════════════════════════
18
+ Each item:
19
+ ```
20
+ { "agentsFile": "packages/x/src/AGENTS.md", // which tree node owns the row
21
+ "row": "thing.ts", // row path, as written in the table
22
+ "target": "packages/x/src/thing.ts", // repo-relative real file
23
+ "purpose": "<current row text>",
24
+ "diff": "<git diff since the acked commit, possibly truncated>" }
25
+ ```
26
+
27
+ ═══════════════════════════════════════════════════════════════════════
28
+ THE ONLY QUESTION THAT MATTERS
29
+ ═══════════════════════════════════════════════════════════════════════
30
+ "Bytes changed" is NOT drift. A row is a ONE-LINE PURPOSE SUMMARY, not an export
31
+ manifest. It is allowed to omit exports, params and internals.
32
+
33
+ Return **REWRITE** only when the diff makes the row text *factually wrong*:
34
+ • it names a function/const/type/env/flag/path that the diff DELETED or RENAMED
35
+ • it states a behaviour, default, port, or contract the diff CHANGED
36
+ • the file's core responsibility changed and the row now describes the old one
37
+ • it points at a path the diff moved
38
+
39
+ Return **KEEP** when:
40
+ • the diff only ADDS things the row never claimed (new exports, new branches)
41
+ • changes are internal refactors, formatting, comments, tests, type-only edits
42
+ • the row is vaguer than the diff but still true
43
+ • the diff is empty, unavailable, or you cannot tell → KEEP and say why in `note`
44
+
45
+ Bias to KEEP. A false REWRITE corrupts good documentation; a false KEEP leaves a
46
+ row no worse than it already was. When genuinely torn, KEEP with a note.
47
+
48
+ ═══════════════════════════════════════════════════════════════════════
49
+ IF YOU REWRITE — house "caveman" style, verbatim rule
50
+ ═══════════════════════════════════════════════════════════════════════
51
+ Short declarative fragments. Drop articles/copulas. Subject→verb→object. One fact
52
+ per line. Concrete tokens (paths/fns/env/ports) over prose. Symbols verbatim.
53
+
54
+ • PRESERVE every `See change: <name>` marker, unchanged, at the end.
55
+ • PRESERVE any `→ see \`X.AGENTS.md\`` sidecar pointer.
56
+ • Change the MINIMUM: correct the wrong clause, keep the rest verbatim.
57
+ • Never exceed ~200 chars unless the original already did.
58
+ • Output the purpose CELL ONLY — no leading `|`, no backticked path, no trailing `|`.
59
+
60
+ ═══════════════════════════════════════════════════════════════════════
61
+ TOOLS
62
+ ═══════════════════════════════════════════════════════════════════════
63
+ The diff is usually enough. Only `read` the target file when the diff is
64
+ truncated or ambiguous. Do NOT read whole directories; do NOT grep the repo.
65
+ Budget: at most a couple of reads across the whole batch — you exist to be cheap.
66
+
67
+ ═══════════════════════════════════════════════════════════════════════
68
+ OUTPUT — a fenced ```json block, nothing else after it
69
+ ═══════════════════════════════════════════════════════════════════════
70
+ ```json
71
+ [
72
+ { "agentsFile": "...", "row": "...", "verdict": "KEEP",
73
+ "note": "diff only adds putConfig; row never enumerated exports" },
74
+ { "agentsFile": "...", "row": "...", "verdict": "REWRITE",
75
+ "purpose": "<corrected cell, See change preserved>",
76
+ "note": "row named startTunnel(); diff renamed it to connectTunnel()" }
77
+ ]
78
+ ```
79
+ One object per input item, same order. `purpose` present ONLY for REWRITE.
80
+ `note` is one short clause — the evidence for your verdict.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@blackbelt-technology/pi-dashboard-extension",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
4
4
  "description": "Pi bridge extension for pi-dashboard",
5
+ "license": "MIT",
5
6
  "type": "module",
6
7
  "repository": {
7
8
  "type": "git",
@@ -27,20 +28,28 @@
27
28
  ".pi/skills/pi-dashboard/",
28
29
  ".pi/skills/browser/",
29
30
  ".pi/skills/project-init/",
30
- ".pi/skills/doctor/"
31
+ ".pi/skills/doctor/",
32
+ "agents/",
33
+ "!**/AGENTS.md",
34
+ "!**/*.AGENTS.md",
35
+ "!**/__tests__",
36
+ "!**/*.test.ts",
37
+ "!**/*.test.tsx"
31
38
  ],
32
39
  "dependencies": {
33
- "@blackbelt-technology/pi-dashboard-bus-client": "^0.6.1",
34
- "@blackbelt-technology/pi-dashboard-shared": "^0.6.1",
40
+ "@blackbelt-technology/pi-dashboard-bus-client": "^0.8.0",
41
+ "@blackbelt-technology/pi-dashboard-shared": "^0.8.0",
42
+ "@fission-ai/openspec": "^1.6.0",
35
43
  "minimatch": "^10.0.0",
36
44
  "ws": "^8.18.0"
37
45
  },
38
46
  "peerDependencies": {
39
- "@earendil-works/pi-coding-agent": "*",
40
- "@earendil-works/pi-tui": "*",
41
- "@mariozechner/pi-coding-agent": "*",
42
- "@mariozechner/pi-tui": "*",
43
- "typebox": "*"
47
+ "@earendil-works/pi-ai": ">=0.75.5",
48
+ "@earendil-works/pi-coding-agent": ">=0.80.10",
49
+ "@earendil-works/pi-tui": ">=0.80.10",
50
+ "@mariozechner/pi-coding-agent": ">=0.73.1",
51
+ "@mariozechner/pi-tui": ">=0.73.1",
52
+ "typebox": ">=1.3.6"
44
53
  },
45
54
  "peerDependenciesMeta": {
46
55
  "@earendil-works/pi-coding-agent": {
@@ -54,11 +63,14 @@
54
63
  },
55
64
  "@mariozechner/pi-tui": {
56
65
  "optional": true
66
+ },
67
+ "@earendil-works/pi-ai": {
68
+ "optional": true
57
69
  }
58
70
  },
59
71
  "devDependencies": {
60
- "@earendil-works/pi-tui": "*",
72
+ "@earendil-works/pi-tui": ">=0.80.10",
61
73
  "@types/ws": "^8.18.1",
62
- "typebox": "^1.1.33"
74
+ "typebox": "^1.3.7"
63
75
  }
64
76
  }
@@ -3,14 +3,11 @@
3
3
  *
4
4
  * pi ≥ 0.80.4 emits `agent_settled` exactly once per run (in the `finally` of
5
5
  * `_runAgentPrompt`, AFTER the retry/compact/continue loop drains). Floor pi
6
- * (0.78.0–0.80.3) never emits it. The bridge guarantees the dashboard receives
7
- * exactly ONE terminal `agent_settled` per run on every supported pi:
8
- *
9
- * • native present (≥ 0.80.4): forward pi's real `agent_settled`, no synth.
10
- * • native absent (< 0.80.4): synthesize one `agent_settled` synchronously
11
- * immediately after each forwarded `agent_end`.
12
- *
13
- * The reducer then keys `status:"idle"` off ONE signal with no version branch.
6
+ * (0.78.0–0.80.3) never emits it. Native pi forwards its real terminal settle.
7
+ * Floor pi emits a compatibility settle after each `agent_end`; the bridge marks
8
+ * per-attempt settles `retryPending:true` and later sends an unmarked terminal
9
+ * settle when no matching retry start arrives or the retry budget is exhausted.
10
+ * The reducer therefore distinguishes compatibility from terminal convergence.
14
11
  *
15
12
  * Pure decision logic lives here so it is unit-testable without instantiating
16
13
  * the bridge. See change: adopt-pi-074-080-features.
@@ -18,6 +15,17 @@
18
15
 
19
16
  /** pi version at/above which `agent_settled` is emitted natively. */
20
17
  export const NATIVE_AGENT_SETTLED_FLOOR = "0.80.4";
18
+ export const FLOOR_RETRY_UNKNOWN_DELAY_MS = 2000;
19
+ export const FLOOR_RETRY_GRACE_MS = 1000;
20
+
21
+ /** Delay before a floor-pi waiting attempt is reconciled as terminal when no
22
+ * matching agent_start arrives. */
23
+ export function floorRetryReconcileDelay(delayMs: number): number {
24
+ const observedDelay = Number.isFinite(delayMs) && delayMs > 0
25
+ ? delayMs
26
+ : FLOOR_RETRY_UNKNOWN_DELAY_MS;
27
+ return observedDelay + FLOOR_RETRY_GRACE_MS;
28
+ }
21
29
 
22
30
  /** Parse a semver-ish string to `[major, minor, patch]`, ignoring any
23
31
  * pre-release / build suffix. Missing / non-numeric parts read as 0. */
@@ -48,11 +56,21 @@ export interface SettleEvent {
48
56
  data: Record<string, unknown>;
49
57
  }
50
58
 
51
- /** Build a synthetic `agent_settled` (floor pi, emitted after `agent_end`). */
59
+ /** Build a synthetic terminal `agent_settled` for floor pi. */
52
60
  export function synthesizeAgentSettledEvent(timestamp: number): SettleEvent {
53
61
  return { eventType: "agent_settled", timestamp, data: {} };
54
62
  }
55
63
 
64
+ /** Mark a floor-pi settle as per-attempt compatibility rather than terminal.
65
+ * The reducer preserves retry/cancellation state for this shape. */
66
+ export function markFloorSettle(
67
+ event: SettleEvent,
68
+ terminal: boolean,
69
+ ): SettleEvent {
70
+ if (terminal) return event;
71
+ return { ...event, data: { ...event.data, retryPending: true } };
72
+ }
73
+
56
74
  /**
57
75
  * After the bridge forwards `eventType`, return the synthetic `agent_settled`
58
76
  * it must ALSO forward, or `null`. Only an `agent_end` on floor pi