@blackbelt-technology/pi-dashboard-extension 0.7.0 → 0.9.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 (265) hide show
  1. package/.pi/skills/browser/SKILL.md +84 -29
  2. package/.pi/skills/browser/UPSTREAM.md +13 -1
  3. package/.pi/skills/browser/references/challenge.md +183 -0
  4. package/.pi/skills/browser/references/dashboard-relay.md +150 -0
  5. package/.pi/skills/browser/references/electron.agent.md +57 -0
  6. package/.pi/skills/browser/references/own-browser.md +305 -0
  7. package/.pi/skills/browser/references/web.agent.md +323 -0
  8. package/.pi/skills/browser/scripts/check-panerelay.sh +157 -0
  9. package/.pi/skills/doctor/SKILL.md +4 -9
  10. package/.pi/skills/doctor/_lib/checks.ts +133 -54
  11. package/.pi/skills/doctor/_lib/derive-tokens.ts +5 -0
  12. package/.pi/skills/doctor/modules/apple-tools.knowledge.hash +1 -0
  13. package/.pi/skills/doctor/modules/apple-tools.md +52 -0
  14. package/.pi/skills/doctor/modules/mcp-builtin.knowledge.hash +1 -0
  15. package/.pi/skills/doctor/modules/mcp-builtin.md +61 -0
  16. package/.pi/skills/doctor/modules/oauth-redirect-base.knowledge.hash +1 -0
  17. package/.pi/skills/doctor/modules/oauth-redirect-base.md +71 -0
  18. package/.pi/skills/doctor/modules/pi-resolution.knowledge.hash +1 -1
  19. package/.pi/skills/doctor/modules/pi-resolution.md +21 -1
  20. package/.pi/skills/doctor/modules/plugins-bridges.md +14 -1
  21. package/.pi/skills/pi-dashboard/SKILL.md +10 -3
  22. package/.pi/skills/pi-dashboard/references/api-reference.agent.md +69 -0
  23. package/.pi/skills/pi-dashboard/scripts/dashboard-bus.ts +4 -4
  24. package/.pi/skills/project-init/SKILL.md +41 -34
  25. package/.pi/skills/project-init/profiles/coding/AGENTS.md.tmpl +0 -23
  26. package/.pi/skills/project-init/profiles/docs/profile.json +1 -1
  27. package/README.md +19 -0
  28. package/agents/DoxTriage.md +80 -0
  29. package/package.json +30 -16
  30. package/src/ask-user-tool.ts +4 -0
  31. package/src/auto-session-namer.ts +486 -70
  32. package/src/autostart-guard.ts +99 -0
  33. package/src/autostart-lock.ts +258 -0
  34. package/src/bridge-activation.ts +26 -0
  35. package/src/bridge-context.ts +106 -23
  36. package/src/bridge-default-model-gate.ts +38 -0
  37. package/src/bridge-polling.ts +148 -0
  38. package/src/bridge-ticket-client.ts +105 -0
  39. package/src/bridge.ts +1760 -350
  40. package/src/canvas-tool.ts +5 -0
  41. package/src/command-handler.ts +392 -71
  42. package/src/connect-target.ts +130 -0
  43. package/src/connection.ts +846 -17
  44. package/src/custom-entry-forward.ts +92 -0
  45. package/src/endpoint-resolution.ts +253 -0
  46. package/src/event-forwarder.ts +42 -0
  47. package/src/extension-identity.ts +59 -0
  48. package/src/flow-event-wiring.ts +125 -3
  49. package/src/followup-buffer.ts +217 -0
  50. package/src/git-dir-watcher.ts +79 -0
  51. package/src/git-poll.ts +45 -12
  52. package/src/git-probe-scheduler.ts +119 -0
  53. package/src/git-tracker.ts +284 -0
  54. package/src/instance-verification.ts +156 -0
  55. package/src/local-token-header.ts +44 -0
  56. package/src/mcp-token-delivery.ts +147 -0
  57. package/src/message-update-coalescer.ts +340 -0
  58. package/src/model-refresh.ts +95 -0
  59. package/src/model-tracker.ts +118 -35
  60. package/src/notify-proxy.ts +36 -0
  61. package/src/path-gate/decide.ts +149 -0
  62. package/src/path-gate/grant-cache.ts +71 -0
  63. package/src/path-gate/grant-link.ts +108 -0
  64. package/src/path-gate/handler.ts +307 -0
  65. package/src/path-gate/index.ts +155 -0
  66. package/src/path-gate/resolve.ts +126 -0
  67. package/src/path-gate/roots.ts +137 -0
  68. package/src/path-gate/suppression.ts +27 -0
  69. package/src/pending-prompt-emitter.ts +59 -0
  70. package/src/pi-env.d.ts +6 -10
  71. package/src/pi-retry-settings.ts +91 -0
  72. package/src/plugin-request-client.ts +114 -0
  73. package/src/poll-cost.ts +40 -0
  74. package/src/pr-status.ts +338 -0
  75. package/src/process-metrics.ts +77 -1
  76. package/src/process-scan-scheduler.ts +137 -0
  77. package/src/process-scanner.ts +226 -247
  78. package/src/project-init/dox-kb-config.ts +3 -0
  79. package/src/project-init/scaffold.ts +1 -4
  80. package/src/project-init/seed-doctrine.ts +23 -60
  81. package/src/prompt-bus.ts +13 -0
  82. package/src/provider-register.ts +92 -21
  83. package/src/remote-registration-gate.ts +102 -0
  84. package/src/retry-tracker.ts +258 -86
  85. package/src/role-manager.ts +38 -91
  86. package/src/role-model-tools.ts +44 -3
  87. package/src/server-auto-start.ts +331 -20
  88. package/src/server-launcher.ts +70 -34
  89. package/src/server-pin-store.ts +92 -0
  90. package/src/session-move.ts +275 -0
  91. package/src/session-sync.ts +75 -20
  92. package/src/slash-dispatch.ts +66 -81
  93. package/src/subagent-fanout-admission.ts +234 -0
  94. package/src/subagent-forward-sites.ts +69 -0
  95. package/src/subagent-frame-buffer.ts +24 -3
  96. package/src/subagent-frame-strip.ts +109 -0
  97. package/src/subagent-saturation.ts +196 -0
  98. package/src/subagent-tick-throttle.ts +250 -0
  99. package/src/terminal-reload.ts +298 -0
  100. package/src/transcript-backfill.ts +151 -0
  101. package/src/transport-diagnostics.ts +76 -0
  102. package/src/tui-prompt-adapter.ts +13 -1
  103. package/src/turn-actionability.ts +20 -0
  104. package/src/ui-stale-guard.ts +58 -0
  105. package/src/usage-drain.ts +167 -0
  106. package/src/vcs-info.ts +261 -63
  107. package/.pi/skills/doctor/AGENTS.md +0 -27
  108. package/.pi/skills/project-init/dox-doctrine.md +0 -104
  109. package/src/AGENTS.md +0 -57
  110. package/src/__tests__/abort-latch.test.ts +0 -97
  111. package/src/__tests__/agent-settled.test.ts +0 -82
  112. package/src/__tests__/artifact-roots.test.ts +0 -83
  113. package/src/__tests__/ask-user-attachments.test.ts +0 -106
  114. package/src/__tests__/ask-user-schema-discriminator.test.ts +0 -141
  115. package/src/__tests__/ask-user-tool.test.ts +0 -571
  116. package/src/__tests__/auto-session-namer.test.ts +0 -339
  117. package/src/__tests__/bridge-default-model-apply.test.ts +0 -242
  118. package/src/__tests__/bridge-default-model-gate.test.ts +0 -50
  119. package/src/__tests__/bridge-entry-id-pi-070.test.ts +0 -174
  120. package/src/__tests__/bridge-followup-chat-order.test.ts +0 -215
  121. package/src/__tests__/bridge-followup-multi-entry.test.ts +0 -202
  122. package/src/__tests__/bridge-followup-mutation.test.ts +0 -217
  123. package/src/__tests__/bridge-followup-queue-drain.test.ts +0 -266
  124. package/src/__tests__/bridge-hasui-flip.test.ts +0 -109
  125. package/src/__tests__/bridge-no-queue-mutation.test.ts +0 -112
  126. package/src/__tests__/bridge-plugin-emit-event.test.ts +0 -44
  127. package/src/__tests__/bridge-queue-update-forward.test.ts +0 -77
  128. package/src/__tests__/bridge-resume-disconnect.test.ts +0 -333
  129. package/src/__tests__/bridge-shadow-queue-gate.test.ts +0 -299
  130. package/src/__tests__/bridge-shutdown-reset.test.ts +0 -159
  131. package/src/__tests__/bridge-slash-command-routing.test.ts +0 -458
  132. package/src/__tests__/bridge-stop-after-turn.test.ts +0 -72
  133. package/src/__tests__/bridge-system-followup.test.ts +0 -163
  134. package/src/__tests__/bridge-thinking-level-select.test.ts +0 -68
  135. package/src/__tests__/browser-skill-registered.test.ts +0 -84
  136. package/src/__tests__/build-provider-catalogue.test.ts +0 -210
  137. package/src/__tests__/command-handler.test.ts +0 -1180
  138. package/src/__tests__/commit-draft.test.ts +0 -100
  139. package/src/__tests__/connection-dropped-frames.test.ts +0 -78
  140. package/src/__tests__/connection-suppress-auto-start.test.ts +0 -97
  141. package/src/__tests__/connection.test.ts +0 -344
  142. package/src/__tests__/credentials-updated.test.ts +0 -26
  143. package/src/__tests__/custom-provider-apikey-roundtrip.test.ts +0 -128
  144. package/src/__tests__/cwd-missing-probe.test.ts +0 -82
  145. package/src/__tests__/dashboard-commands-shipped.test.ts +0 -53
  146. package/src/__tests__/dashboard-context-injector.test.ts +0 -190
  147. package/src/__tests__/dashboard-default-adapter.test.ts +0 -77
  148. package/src/__tests__/dev-build.test.ts +0 -79
  149. package/src/__tests__/doctor/checks.test.ts +0 -121
  150. package/src/__tests__/doctor/modules.test.ts +0 -64
  151. package/src/__tests__/doctor/provenance-hash.test.ts +0 -94
  152. package/src/__tests__/doctor/router.test.ts +0 -143
  153. package/src/__tests__/empty-actionable-guard-config.test.ts +0 -32
  154. package/src/__tests__/empty-actionable-guard.test.ts +0 -73
  155. package/src/__tests__/enrich-model-metadata.test.ts +0 -222
  156. package/src/__tests__/event-forwarder.test.ts +0 -119
  157. package/src/__tests__/extension-slash-command-detection.test.ts +0 -143
  158. package/src/__tests__/filter-enabled-models.test.ts +0 -151
  159. package/src/__tests__/fixtures/turn-actionability-fixtures.ts +0 -69
  160. package/src/__tests__/fork-entryid-timing.test.ts +0 -88
  161. package/src/__tests__/git-info-status.test.ts +0 -73
  162. package/src/__tests__/git-link-builder.test.ts +0 -102
  163. package/src/__tests__/git-poll.test.ts +0 -69
  164. package/src/__tests__/markdown-image-inliner.test.ts +0 -392
  165. package/src/__tests__/model-resolve.test.ts +0 -379
  166. package/src/__tests__/multiselect-dashboard-routing.test.ts +0 -203
  167. package/src/__tests__/multiselect-list.test.ts +0 -137
  168. package/src/__tests__/multiselect-polyfill.test.ts +0 -92
  169. package/src/__tests__/no-session-replacement-calls.test.ts +0 -99
  170. package/src/__tests__/no-tui-multiselect-arm-regression.test.ts +0 -81
  171. package/src/__tests__/openspec-activity-detector.test.ts +0 -337
  172. package/src/__tests__/openspec-cli-shim.test.ts +0 -145
  173. package/src/__tests__/openspec-poller.test.ts +0 -124
  174. package/src/__tests__/pi-version-tracker.test.ts +0 -109
  175. package/src/__tests__/process-metrics.test.ts +0 -47
  176. package/src/__tests__/process-scanner-kill.test.ts +0 -61
  177. package/src/__tests__/process-scanner.test.ts +0 -292
  178. package/src/__tests__/project-init-detect-stack.test.ts +0 -61
  179. package/src/__tests__/project-init-dox-kb-config.test.ts +0 -53
  180. package/src/__tests__/project-init-profiles.test.ts +0 -84
  181. package/src/__tests__/project-init-scaffold.test.ts +0 -139
  182. package/src/__tests__/project-init-seed-doctrine.test.ts +0 -100
  183. package/src/__tests__/project-trust.test.ts +0 -92
  184. package/src/__tests__/prompt-bus-wiring.test.ts +0 -791
  185. package/src/__tests__/prompt-bus.test.ts +0 -513
  186. package/src/__tests__/prompt-expander.test.ts +0 -398
  187. package/src/__tests__/provider-register-native-models.test.ts +0 -182
  188. package/src/__tests__/provider-register-reload.test.ts +0 -498
  189. package/src/__tests__/provider-register-thinking-levels.test.ts +0 -104
  190. package/src/__tests__/retry-tracker.test.ts +0 -152
  191. package/src/__tests__/role-manager.test.ts +0 -585
  192. package/src/__tests__/role-model-tools-registry-readiness.test.ts +0 -114
  193. package/src/__tests__/role-model-tools.test.ts +0 -229
  194. package/src/__tests__/search-files-completeness.test.ts +0 -111
  195. package/src/__tests__/search-files-ranking.test.ts +0 -168
  196. package/src/__tests__/server-auto-start.test.ts +0 -375
  197. package/src/__tests__/server-launcher-launch.test.ts +0 -96
  198. package/src/__tests__/server-launcher.test.ts +0 -101
  199. package/src/__tests__/server-probe.test.ts +0 -25
  200. package/src/__tests__/session-switch.test.ts +0 -139
  201. package/src/__tests__/session-sync.test.ts +0 -243
  202. package/src/__tests__/single-derivation-guard.test.ts +0 -39
  203. package/src/__tests__/source-detector.test.ts +0 -88
  204. package/src/__tests__/stats-extractor.test.ts +0 -92
  205. package/src/__tests__/subagent-frame-buffer.test.ts +0 -239
  206. package/src/__tests__/tool-result-image-inliner.test.ts +0 -206
  207. package/src/__tests__/tui-prompt-adapter.test.ts +0 -213
  208. package/src/__tests__/turn-actionability.test.ts +0 -86
  209. package/src/__tests__/ui-decorators.test.ts +0 -309
  210. package/src/__tests__/ui-modules.test.ts +0 -293
  211. package/src/__tests__/vcs-info.test.ts +0 -265
  212. package/src/__tests__/visibility-intent.test.ts +0 -43
  213. package/src/__tests__/watchdog.test.ts +0 -161
  214. package/src/abort-latch.ts.AGENTS.md +0 -3
  215. package/src/agent-settled.ts +0 -72
  216. package/src/agent-settled.ts.AGENTS.md +0 -3
  217. package/src/artifact-roots.ts.AGENTS.md +0 -3
  218. package/src/ask-user-attachments.ts.AGENTS.md +0 -3
  219. package/src/ask-user-tool.ts.AGENTS.md +0 -3
  220. package/src/auto-session-namer.ts.AGENTS.md +0 -3
  221. package/src/bridge-context.ts.AGENTS.md +0 -3
  222. package/src/bridge-default-model-gate.ts.AGENTS.md +0 -3
  223. package/src/bridge.ts.AGENTS.md +0 -3
  224. package/src/command-handler.ts.AGENTS.md +0 -3
  225. package/src/commit-draft-agent.ts.AGENTS.md +0 -3
  226. package/src/commit-draft.ts.AGENTS.md +0 -3
  227. package/src/connection.ts.AGENTS.md +0 -3
  228. package/src/dashboard-context-injector.ts.AGENTS.md +0 -3
  229. package/src/dashboard-default-adapter.ts.AGENTS.md +0 -3
  230. package/src/dev-build.ts.AGENTS.md +0 -3
  231. package/src/empty-actionable-guard-config.ts.AGENTS.md +0 -3
  232. package/src/empty-actionable-guard.ts.AGENTS.md +0 -3
  233. package/src/event-forwarder.ts.AGENTS.md +0 -3
  234. package/src/flow-event-wiring.ts.AGENTS.md +0 -3
  235. package/src/git-link-builder.ts.AGENTS.md +0 -3
  236. package/src/git-poll.ts.AGENTS.md +0 -3
  237. package/src/hasui-flip.ts.AGENTS.md +0 -3
  238. package/src/markdown-image-inliner.ts.AGENTS.md +0 -3
  239. package/src/model-tracker.ts.AGENTS.md +0 -3
  240. package/src/multiselect-decode.ts.AGENTS.md +0 -3
  241. package/src/multiselect-list.ts.AGENTS.md +0 -3
  242. package/src/multiselect-polyfill.ts.AGENTS.md +0 -3
  243. package/src/openspec-cli-shim.ts.AGENTS.md +0 -7
  244. package/src/process-metrics.ts.AGENTS.md +0 -3
  245. package/src/process-scanner.ts.AGENTS.md +0 -3
  246. package/src/project-init/AGENTS.md +0 -12
  247. package/src/project-trust.ts.AGENTS.md +0 -3
  248. package/src/prompt-bus.ts.AGENTS.md +0 -3
  249. package/src/prompt-expander.ts.AGENTS.md +0 -3
  250. package/src/provider-register.ts.AGENTS.md +0 -3
  251. package/src/retry-tracker.ts.AGENTS.md +0 -3
  252. package/src/role-manager.ts.AGENTS.md +0 -3
  253. package/src/role-model-tools.ts.AGENTS.md +0 -3
  254. package/src/server-auto-start.ts.AGENTS.md +0 -3
  255. package/src/server-launcher.ts.AGENTS.md +0 -3
  256. package/src/session-sync.ts.AGENTS.md +0 -3
  257. package/src/slash-dispatch.ts.AGENTS.md +0 -3
  258. package/src/source-detector.ts.AGENTS.md +0 -3
  259. package/src/subagent-frame-buffer.ts.AGENTS.md +0 -3
  260. package/src/tool-result-image-inliner.ts.AGENTS.md +0 -3
  261. package/src/tui-prompt-adapter.ts.AGENTS.md +0 -3
  262. package/src/turn-actionability.ts.AGENTS.md +0 -3
  263. package/src/ui-modules.ts.AGENTS.md +0 -3
  264. package/src/vcs-info.ts.AGENTS.md +0 -3
  265. package/src/visibility-intent.ts.AGENTS.md +0 -3
@@ -0,0 +1,157 @@
1
+ #!/usr/bin/env bash
2
+ # Diagnose the Panerelay path — driving the user's OWN logged-in browser.
3
+ #
4
+ # Platform-independent: macOS, Linux, WSL, Git-Bash. Discovers every path
5
+ # through the tools themselves rather than hardcoding OS locations.
6
+ #
7
+ # Usage:
8
+ # bash check-panerelay.sh # fast, no network
9
+ # bash check-panerelay.sh --deep # also runs `@panerelay/setup doctor` (needs npx + network)
10
+ #
11
+ # Output (key=value):
12
+ # AGENT_BROWSER=0.33.2
13
+ # VERSION_OK=yes
14
+ # PLUGIN=registered
15
+ # NATIVE_HOST=/Users/me/.panerelay/bin/panerelay-native-host.cjs
16
+ # EXTENSION=connected
17
+ # TABS=3
18
+ # READY=yes
19
+ #
20
+ # Non-ready runs always emit a NEXT= line with the single next action.
21
+ #
22
+ # NOTE: agent-browser reports plugin failures as a bare
23
+ # "Plugin 'panerelay' returned success=false"
24
+ # and drops the plugin's actual message. On probe failure this script asks the
25
+ # native host directly (step 5b) so the REAL cause is surfaced — most often
26
+ # several registered browsers, not a disconnected extension.
27
+
28
+ set -uo pipefail # NOTE: no -e; probes are expected to fail and are handled
29
+
30
+ DEEP=no
31
+ [ "${1:-}" = "--deep" ] && DEEP=yes
32
+
33
+ # Unique per run. A session daemon STICKS to the browser it first resolved, so a
34
+ # name reused across runs replays the earlier (possibly failed) binding and the
35
+ # probe keeps failing after the real cause is fixed. Do NOT "fix" that with
36
+ # `close --all` — that flag is not session-scoped and kills every session,
37
+ # including unrelated ones the user is driving.
38
+ SESSION="${PANERELAY_CHECK_SESSION:-panerelay-check-$$}"
39
+
40
+ # ── 1. CLI present ─────────────────────────────────────────────────
41
+
42
+ if ! command -v agent-browser >/dev/null 2>&1; then
43
+ echo "AGENT_BROWSER=not-installed"
44
+ echo "READY=no"
45
+ echo "NEXT=install the CLI: pi install npm:pi-agent-browser"
46
+ exit 0
47
+ fi
48
+
49
+ VER=$(agent-browser --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
50
+ echo "AGENT_BROWSER=${VER:-unknown}"
51
+
52
+ # ── 2. Version gate: Panerelay needs the plugin provider (>= 0.33.0) ─
53
+
54
+ MIN="0.33.0"
55
+ if [ -n "$VER" ] && [ "$(printf '%s\n%s\n' "$MIN" "$VER" | sort -t. -k1,1n -k2,2n -k3,3n | head -1)" = "$MIN" ]; then
56
+ echo "VERSION_OK=yes"
57
+ else
58
+ echo "VERSION_OK=no"
59
+ echo "READY=no"
60
+ echo "NEXT=upgrade to >= $MIN (npm install -g agent-browser@latest); --provider needs plugin support"
61
+ exit 0
62
+ fi
63
+
64
+ # ── 3. Provider plugin registered in the agent-browser user config ──
65
+
66
+ CONFIG="$HOME/.agent-browser/config.json"
67
+ if [ -f "$CONFIG" ] && grep -q '"panerelay"' "$CONFIG" 2>/dev/null; then
68
+ echo "PLUGIN=registered"
69
+ else
70
+ echo "PLUGIN=missing"
71
+ echo "READY=no"
72
+ echo "NEXT=run: npx --yes @panerelay/setup --agent-browser (omit --global-default)"
73
+ exit 0
74
+ fi
75
+
76
+ # Warn if Panerelay was made the global default — it should stay opt-in.
77
+ if grep -qE '"(defaultProvider|provider)"[[:space:]]*:[[:space:]]*"panerelay"' "$CONFIG" 2>/dev/null; then
78
+ echo "GLOBAL_DEFAULT=yes"
79
+ else
80
+ echo "GLOBAL_DEFAULT=no"
81
+ fi
82
+
83
+ # ── 4. Native messaging host binary ────────────────────────────────
84
+
85
+ HOST=$(grep -oE '"command"[[:space:]]*:[[:space:]]*"[^"]+"' "$CONFIG" 2>/dev/null \
86
+ | head -1 | sed -E 's/.*"command"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
87
+ if [ -n "${HOST:-}" ] && [ -f "$HOST" ]; then
88
+ echo "NATIVE_HOST=$HOST"
89
+ else
90
+ echo "NATIVE_HOST=missing"
91
+ echo "READY=no"
92
+ echo "NEXT=re-run: npx --yes @panerelay/setup --agent-browser"
93
+ exit 0
94
+ fi
95
+
96
+ # ── 5. Live probe — the only check that proves the browser is reachable
97
+
98
+ PROBE=$(agent-browser --session "$SESSION" --provider panerelay tab list 2>&1)
99
+ PROBE_RC=$?
100
+
101
+ if [ $PROBE_RC -eq 0 ]; then
102
+ echo "EXTENSION=connected"
103
+ echo "TABS=$(printf '%s\n' "$PROBE" | grep -cE '^\s*[→ ]*\[t[0-9]+\]')"
104
+ echo "READY=yes"
105
+ elif printf '%s' "$PROBE" | grep -qi 'all-tabs authorization'; then
106
+ # Extension IS connected; consent is simply narrower than this command needs.
107
+ echo "EXTENSION=connected"
108
+ echo "AUTHORIZATION=per-tab"
109
+ echo "READY=no"
110
+ echo "NEXT=open the Panerelay side panel and authorize all tabs (or drive one authorized tab)"
111
+ else
112
+ # ── 5b. agent-browser hid the reason — ask the native host directly ──
113
+ #
114
+ # A bare `success=false` carries no diagnosis. The plugin protocol does:
115
+ # speak browser.launch to the host and read its `error` field verbatim.
116
+ RAW=$(printf '%s' \
117
+ '{"protocol":"agent-browser.plugin.v1","type":"browser.launch","capability":"browser.provider","request":{"sessionName":"'"$SESSION"'"}}' \
118
+ | node "$HOST" --agent-browser-plugin 2>/dev/null)
119
+
120
+ REASON=$(printf '%s' "$RAW" \
121
+ | sed -n 's/.*"error"[[:space:]]*:[[:space:]]*"\(.*\)".*/\1/p' | head -1)
122
+
123
+ if printf '%s' "$RAW" | grep -q '"success"[[:space:]]*:[[:space:]]*true'; then
124
+ # Host hands out a browser fine; only the CLI hop failed.
125
+ echo "EXTENSION=connected"
126
+ echo "READY=no"
127
+ echo "NEXT=host is healthy but the agent-browser CLI hop failed — usually a session daemon stuck on an earlier binding; re-run with PANERELAY_CHECK_SESSION=<fresh-name>"
128
+ elif printf '%s' "$REASON" | grep -qi 'Multiple Panerelay browsers'; then
129
+ # The common case: several Chrome processes carry the extension, so the
130
+ # plugin refuses to guess which one to drive.
131
+ echo "EXTENSION=connected"
132
+ echo "AMBIGUOUS_BROWSER=yes"
133
+ # Surface every candidate UUID so the caller can pick one.
134
+ printf '%s' "$REASON" | grep -oE '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' \
135
+ | while read -r id; do echo "BROWSER_ID=$id"; done
136
+ echo "READY=no"
137
+ echo "NEXT=re-run with PANERELAY_BROWSER_ID=<one of the BROWSER_ID values above> (try each: the right one lists your real tabs)"
138
+ elif [ -n "$REASON" ]; then
139
+ # Host gave a specific diagnosis — pass it through rather than guess.
140
+ echo "EXTENSION=connected"
141
+ echo "READY=no"
142
+ echo "NEXT=$REASON"
143
+ else
144
+ echo "EXTENSION=disconnected"
145
+ echo "READY=no"
146
+ echo "NEXT=install/reload the Panerelay extension in the target Chrome profile, then open its side panel"
147
+ fi
148
+ echo "DETAIL=$(printf '%s' "$PROBE" | head -1 | cut -c1-160)"
149
+ fi
150
+
151
+ # ── 6. Optional deep check ─────────────────────────────────────────
152
+
153
+ if [ "$DEEP" = "yes" ] && command -v npx >/dev/null 2>&1; then
154
+ echo "--- doctor ---"
155
+ npx --yes @panerelay/setup doctor --agent-browser --lang en </dev/null 2>&1 \
156
+ | grep -E '✅|⚠️|❌' | head -20
157
+ fi
@@ -1,14 +1,6 @@
1
1
  ---
2
2
  name: doctor
3
- description: >-
4
- Diagnose why pi-flows, the Anthropic-messages bridge, model resolution, a pi
5
- install, a peer, a plugin/bridge, or a build/reload is broken in the
6
- pi-agent-dashboard. Derives every fact live (works with the server down),
7
- reports pi across ALL install locations, detects peer name-skew, and routes
8
- each failure to the topology-correct fix. Use on "flow won't show",
9
- "bridge waiting_peers", "pi version mismatch", "I built it but it's still
10
- broken", "which pi is this using", "agent model fails at spawn", "diagnose the
11
- dashboard", "doctor".
3
+ description: 'Diagnose why pi-flows, the Anthropic-messages bridge, model resolution, a pi install, a peer, a plugin/bridge, or a build/reload is broken in the pi-agent-dashboard. Derives every fact live (works with the server down). Use on "flow won''t show", "bridge waiting_peers", "pi version mismatch", "which pi is this using", "diagnose the dashboard", "doctor".'
12
4
  license: MIT
13
5
  ---
14
6
 
@@ -34,6 +26,9 @@ CHECKS · FIX ROUTING · DERIVES-FROM** (+ a `<id>.knowledge.hash` sidecar).
34
26
  | `build-reload` | three-component rebuild/reload gaps |
35
27
  | `install-topology` | npm-global / Electron / Docker / dev + topology fixes |
36
28
  | `model-resolution` | model:resolve handler, roles/preset, @role resolvability |
29
+ | `apple-tools` | iMCP (Apple PIM) provisioning state for the apple-tools plugin |
30
+ | `oauth-redirect-base` | which OAuth redirect base won + its tier (reverse-proxy `redirect_uri_mismatch`) |
31
+ | `mcp-builtin` | pi built-in MCP + per-session `pi-dashboard` registration (adapter installed, shadowing entry, non-strict `mcp.json`) |
37
32
 
38
33
  ## How to route
39
34
 
@@ -8,8 +8,17 @@
8
8
  * See change: add-modular-doctor-skill (design.md D4/D8, spec: Derive-on-run).
9
9
  */
10
10
 
11
- import { existsSync, readFileSync } from "node:fs";
11
+ import { readFileSync } from "node:fs";
12
12
  import { createRequire } from "node:module";
13
+ import os from "node:os";
14
+ import path from "node:path";
15
+ import {
16
+ enumeratePiInstalls,
17
+ type PiInstall,
18
+ piVersionDivergence,
19
+ readPiFloor,
20
+ resolvePiFloor,
21
+ } from "@blackbelt-technology/pi-dashboard-shared/pi-installs/index.js";
13
22
  import {
14
23
  listPiPackages,
15
24
  type ResolvePiPackageOptions,
@@ -22,12 +31,18 @@ import {
22
31
  sourcesMatch,
23
32
  } from "@blackbelt-technology/pi-dashboard-shared/source-matching.js";
24
33
 
25
- export type { ResolvePiPackageOptions, SourceKey };
34
+ export type { PiInstall, ResolvePiPackageOptions, SourceKey };
35
+ // Pi-install enumeration + floor reading live in `shared/pi-installs/` so the
36
+ // doctor and the server cannot drift (change: select-pi-runtime-install, D1).
26
37
  // Re-export the primitives so modules import them from one place (DRY: the
27
38
  // wrappers below are the ONLY doctor-specific additions).
28
39
  export {
40
+ enumeratePiInstalls,
29
41
  listPiPackages,
30
42
  parseSourceKey,
43
+ piVersionDivergence,
44
+ readPiFloor,
45
+ resolvePiFloor,
31
46
  resolvePiPackage,
32
47
  resolvePiPackageEntry,
33
48
  sourcesMatch,
@@ -109,69 +124,133 @@ export function detectNameSkew(
109
124
  return { resolvedName: null, staleNames: stale, tier: null, resolvedPath: null };
110
125
  }
111
126
 
112
- export interface PiInstall {
113
- /** Human label for the consumer/location. */
114
- location: string;
115
- /** Absolute path the install resolves from, or null when not found. */
116
- resolvedPath: string | null;
117
- /** Parsed package.json version, or null. */
118
- version: string | null;
127
+
128
+ // ── pi built-in MCP (change: migrate-mcp-to-pi-builtin) ─────────────────────
129
+
130
+ export interface McpBuiltinFinding {
131
+ id: "adapter-disables-builtin" | "operator-entry-shadows-registration" | "mcp-json-not-strict";
132
+ /** The file the finding is about. */
133
+ path: string;
134
+ message: string;
119
135
  }
120
136
 
121
- function readPkgVersion(pkgJsonPath: string): string | null {
137
+ export interface McpBuiltinCheckOptions {
138
+ /** Defaults to `$PI_CODING_AGENT_DIR` or `~/.pi/agent`. */
139
+ agentDir?: string;
140
+ /** When set, `<cwd>/.pi/settings.json` and `<cwd>/.pi/mcp.json` are checked too. */
141
+ cwd?: string;
142
+ /** Test seam; defaults to `fs.readFileSync` (null when absent). */
143
+ readFile?: (path: string) => string | null;
144
+ }
145
+
146
+ const ADAPTER_SOURCE = "npm:pi-mcp-adapter";
147
+
148
+ function packageSourceOf(entry: unknown): string | null {
149
+ if (typeof entry === "string") return entry;
150
+ if (entry && typeof entry === "object" && typeof (entry as { source?: unknown }).source === "string") {
151
+ return (entry as { source: string }).source;
152
+ }
153
+ return null;
154
+ }
155
+
156
+ function isAdapterSource(source: string): boolean {
122
157
  try {
123
- const raw = JSON.parse(readFileSync(pkgJsonPath, "utf8")) as { version?: string };
124
- return typeof raw.version === "string" ? raw.version : null;
158
+ if (sourcesMatch(source, ADAPTER_SOURCE)) return true;
125
159
  } catch {
126
- return null;
160
+ /* unparseable source → fall through to the path test */
127
161
  }
162
+ return /(^|[\\/])pi-mcp-adapter[\\/]?$/.test(source);
128
163
  }
129
164
 
130
165
  /**
131
- * Enumerate pi installs across candidate locations and read each version from
132
- * its package.json. `locations` maps a human label to a candidate package
133
- * directory (repo node_modules, managed dir, nvm-global, …). The caller
134
- * supplies the candidate dirs; this helper only resolves + reads versions so
135
- * it stays platform-agnostic and testable with fixtures.
166
+ * Three read-only diagnostics for pi's built-in MCP, one finding each:
167
+ * - `pi-mcp-adapter` in a settings `packages[]` registers `/mcp` and so
168
+ * DISABLES the built-in MCP — and with it the dashboard's per-session
169
+ * `pi-dashboard` registration (the bridge cannot see this; pi reports it as
170
+ * an extension error, not a throw).
171
+ * - an operator-authored `pi-dashboard` entry in the global `mcp.json` takes
172
+ * precedence over the registration (the dashboard-provisioned shape is
173
+ * removed at server start and is NOT reported).
174
+ * - an `mcp.json` that is not strict JSON (comments, trailing commas) is
175
+ * skipped WHOLE by pi; the file path is named.
176
+ * Never writes, never throws.
136
177
  */
137
- export function enumeratePiInstalls(
138
- locations: Record<string, string>,
139
- ): PiInstall[] {
140
- const out: PiInstall[] = [];
141
- for (const [location, dir] of Object.entries(locations)) {
142
- const pkgJson = `${dir}/package.json`;
143
- if (existsSync(pkgJson)) {
144
- out.push({ location, resolvedPath: dir, version: readPkgVersion(pkgJson) });
145
- } else {
146
- out.push({ location, resolvedPath: null, version: null });
178
+ export function checkMcpBuiltin(opts: McpBuiltinCheckOptions = {}): McpBuiltinFinding[] {
179
+ const agentDir =
180
+ opts.agentDir ?? (process.env.PI_CODING_AGENT_DIR || path.join(os.homedir(), ".pi", "agent"));
181
+ const read =
182
+ opts.readFile ??
183
+ ((p: string): string | null => {
184
+ try {
185
+ return readFileSync(p, "utf8");
186
+ } catch {
187
+ return null;
188
+ }
189
+ });
190
+ const findings: McpBuiltinFinding[] = [];
191
+
192
+ const settingsFiles = [path.join(agentDir, "settings.json")];
193
+ if (opts.cwd) settingsFiles.push(path.join(opts.cwd, ".pi", "settings.json"));
194
+ for (const file of settingsFiles) {
195
+ const raw = read(file);
196
+ if (raw === null) continue;
197
+ let packages: unknown;
198
+ try {
199
+ packages = (JSON.parse(raw) as { packages?: unknown }).packages;
200
+ } catch {
201
+ continue;
202
+ }
203
+ if (!Array.isArray(packages)) continue;
204
+ if (packages.some((e) => {
205
+ const s = packageSourceOf(e);
206
+ return s !== null && isAdapterSource(s);
207
+ })) {
208
+ findings.push({
209
+ id: "adapter-disables-builtin",
210
+ path: file,
211
+ message:
212
+ `pi-mcp-adapter is listed in ${file} packages[]: it takes over /mcp and DISABLES pi's built-in MCP, ` +
213
+ "so the dashboard's pi-dashboard MCP tools are unavailable in sessions. Fix: remove it from packages[] " +
214
+ "(convert adapter-only `disabled: true` entries to `enabled: false` in the MCP settings first).",
215
+ });
216
+ break;
147
217
  }
148
218
  }
149
- return out;
150
- }
151
219
 
152
- /**
153
- * Given the enumerated installs, return the set of distinct non-null versions.
154
- * More than one distinct version means the consumers diverge.
155
- */
156
- export function piVersionDivergence(installs: PiInstall[]): {
157
- diverged: boolean;
158
- versions: string[];
159
- } {
160
- const versions = [...new Set(installs.map((i) => i.version).filter((v): v is string => !!v))];
161
- return { diverged: versions.length > 1, versions };
162
- }
163
-
164
- /**
165
- * Read the pi compatibility floor from a server package.json on disk
166
- * (`piCompatibility.minimum`). Shell-first: no server call needed.
167
- */
168
- export function readPiFloor(serverPkgJsonPath: string): string | null {
169
- try {
170
- const raw = JSON.parse(readFileSync(serverPkgJsonPath, "utf8")) as {
171
- piCompatibility?: { minimum?: string };
172
- };
173
- return raw.piCompatibility?.minimum ?? null;
174
- } catch {
175
- return null;
220
+ const mcpFiles = [path.join(agentDir, "mcp.json")];
221
+ if (opts.cwd) mcpFiles.push(path.join(opts.cwd, ".pi", "mcp.json"));
222
+ for (const [i, file] of mcpFiles.entries()) {
223
+ const raw = read(file);
224
+ if (raw === null) continue;
225
+ let parsed: unknown;
226
+ try {
227
+ parsed = JSON.parse(raw);
228
+ } catch (e) {
229
+ findings.push({
230
+ id: "mcp-json-not-strict",
231
+ path: file,
232
+ message: `${file} is not strict JSON (${(e as Error).message}); pi skips the whole file. Remove comments and trailing commas.`,
233
+ });
234
+ continue;
235
+ }
236
+ if (i !== 0) continue; // the shadow check concerns the global file only
237
+ const entry = (parsed as { mcpServers?: Record<string, unknown> } | null)?.mcpServers?.["pi-dashboard"];
238
+ if (entry === undefined || entry === null || typeof entry !== "object") continue;
239
+ const rhc = (entry as { requestHeadersCommand?: { command?: unknown; args?: unknown } }).requestHeadersCommand;
240
+ const provisioned =
241
+ rhc?.command === "node" &&
242
+ Array.isArray(rhc.args) &&
243
+ typeof rhc.args[0] === "string" &&
244
+ /(^|[\\/])header-command\.mjs$/.test(rhc.args[0]);
245
+ if (!provisioned) {
246
+ findings.push({
247
+ id: "operator-entry-shadows-registration",
248
+ path: file,
249
+ message:
250
+ `${file} defines its own "pi-dashboard" MCP server; pi prefers it over the dashboard's per-session ` +
251
+ "registration. Remove or rename it unless you intend to override the dashboard endpoint.",
252
+ });
253
+ }
176
254
  }
255
+ return findings;
177
256
  }
@@ -25,6 +25,11 @@ export const MODULE_TOKEN_SOURCES: Record<string, string[]> = {
25
25
  "build-reload": ["packages/extension/package.json"],
26
26
  "install-topology": ["packages/shared/src/dashboard-paths.ts"],
27
27
  "model-resolution": ["packages/extension/src/provider-register.ts"],
28
+ "oauth-redirect-base": ["packages/server/src/auth/auth.ts", "packages/server/src/routes/system-routes.ts"],
29
+ "mcp-builtin": [
30
+ "packages/extension/src/mcp-token-delivery.ts",
31
+ "packages/mcp-server-plugin/src/server/legacy-entry-migration.ts",
32
+ ],
28
33
  };
29
34
 
30
35
  /**
@@ -0,0 +1 @@
1
+ 6730ad0845602303
@@ -0,0 +1,52 @@
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 `mcp.json` write (pi's
20
+ built-in MCP; `settings.json` is never written). macOS
21
+ only — a non-macOS host is inert, never a fault.
22
+
23
+ ## KNOWLEDGE
24
+ The verdict derives from the SAME write-suppressed checker the CLI `--check` and
25
+ the settings panel use (`doctorProbe` → `runInstaller(env, { check: true })`), so
26
+ all surfaces report the same nine-member terminal state:
27
+ `UNSUPPORTED_PLATFORM`, `OS_VERSION_UNKNOWN`, `OS_TOO_OLD`, `NO_INSTALL_METHOD`,
28
+ `INSTALL_FAILED`, `CONFIG_UNPARSEABLE`, `CONFIG_WRITE_FAILED`,
29
+ `READY_PENDING_GRANTS`, `READY`.
30
+ - The probe is read-only: 0 config writes, 0 install attempts.
31
+ - Non-macOS reports `UNSUPPORTED_PLATFORM` and is NOT a remediation item.
32
+ - TCC permission grants are menu-bar only and undetectable ahead of a call — a
33
+ granted vs pending distinction cannot be probed.
34
+
35
+ ## CHECKS
36
+ - `doctorProbe(createInstallerEnv(), packagePresent)` from
37
+ `@blackbelt-technology/pi-dashboard-apple-tools` (via its source module).
38
+ - Compare the resulting `state` with `pi-apple-tools-install --check` — they MUST
39
+ match (single implementation).
40
+ - `packagePresent` = is `@blackbelt-technology/pi-dashboard-apple-tools` installed.
41
+
42
+ ## FIX ROUTING
43
+ - `NO_INSTALL_METHOD` / binary absent → run `pi-apple-tools-install` (installs the
44
+ iMCP cask when Homebrew is present, else prints the download link).
45
+ - `OS_TOO_OLD` / `OS_VERSION_UNKNOWN` → upgrade macOS to >= 15.3.
46
+ - `READY_PENDING_GRANTS` → open the iMCP menu-bar app and grant permissions
47
+ (manual, unautomatable).
48
+ - A permission-class failure at call time → menu-bar remediation, NOT re-install.
49
+
50
+ ## DERIVES-FROM
51
+ Source: `packages/apple-tools/src/install.ts`, `packages/apple-tools/src/doctor.ts`,
52
+ `packages/apple-tools/src/detect.ts`. Hash sidecar: `apple-tools.knowledge.hash`.
@@ -0,0 +1 @@
1
+ d48ae6dceec2cfc5
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: mcp-builtin
3
+ scope: pi's built-in MCP and the dashboard's per-session pi-dashboard registration.
4
+ symptoms:
5
+ - dashboard mcp tools missing
6
+ - pi-dashboard mcp server not connected
7
+ - mcp tools not found in session
8
+ - pi-mcp-adapter installed
9
+ - mcp.json ignored
10
+ - built-in mcp disabled
11
+ depends-on: [pi-resolution]
12
+ derives-from:
13
+ - packages/extension/.pi/skills/doctor/_lib/checks.ts (checkMcpBuiltin)
14
+ - packages/extension/src/mcp-token-delivery.ts (createMcpDashboardRegistrar)
15
+ - packages/mcp-server-plugin/src/server/legacy-entry-migration.ts (isProvisionedDashboardEntry)
16
+ ---
17
+
18
+ ## SCOPE
19
+ Whether a session can reach the dashboard's `/mcp` through pi's BUILT-IN MCP:
20
+ the bridge registers `pi-dashboard` per session with `pi.registerMcpServer()`
21
+ (`url` + `Authorization: Bearer <token>`, `exposure: "deferred"`). Three host
22
+ conditions silently break that; this module names each one.
23
+
24
+ ## KNOWLEDGE
25
+ - An installed `pi-mcp-adapter` registers `/mcp` and DISABLES pi's built-in
26
+ MCP. The registration is then reported by pi as an extension error, not
27
+ thrown, so the bridge cannot see it. The dashboard never removes the package
28
+ (operator's choice).
29
+ - An `mcp.json` entry named `pi-dashboard` takes PRECEDENCE over the bridge
30
+ registration. The dashboard-provisioned shape (`requestHeadersCommand.command
31
+ === "node"`, `args[0]` ending `header-command.mjs`) is removed at server start;
32
+ any other shape is the operator's and is only reported.
33
+ - pi parses `mcp.json` with strict `JSON.parse`; comments or trailing commas make
34
+ pi skip the WHOLE file (every server in it).
35
+ - The bridge's own guard (registration API missing/throwing, delivery without
36
+ `url`) is logged by the server as `mcp.dashboard_registration_unavailable
37
+ session=<id> reason=<reason>` in `~/.pi/dashboard/server.log`.
38
+
39
+ ## CHECKS
40
+ - `checkMcpBuiltin({ agentDir, cwd })` from `_lib/checks.ts` → one finding per
41
+ condition, file path named: `adapter-disables-builtin`,
42
+ `operator-entry-shadows-registration`, `mcp-json-not-strict`. Read-only.
43
+ - `grep mcp.dashboard_registration_unavailable ~/.pi/dashboard/server.log`.
44
+ - `pi mcp list --json` in the session cwd: `pi-dashboard` is NOT listed there
45
+ (registrations are per session); a listed `pi-dashboard` is a file entry.
46
+
47
+ ## FIX ROUTING
48
+ - `adapter-disables-builtin` → remove `pi-mcp-adapter` from `settings.json`
49
+ `packages[]` (convert adapter `disabled: true` entries to `enabled: false` in
50
+ Settings → MCP first, or they become active), then reload sessions.
51
+ - `operator-entry-shadows-registration` → delete/rename that entry unless the
52
+ override is intended.
53
+ - `mcp-json-not-strict` → remove comments / trailing commas from the named file.
54
+ - `registration_unavailable reason=no-url` → dashboard server older than the
55
+ bridge: update/restart the dashboard. `api-missing` → pi older than 1.0.0.
56
+
57
+ ## DERIVES-FROM
58
+ Source: `packages/extension/.pi/skills/doctor/_lib/checks.ts`,
59
+ `packages/extension/src/mcp-token-delivery.ts`,
60
+ `packages/mcp-server-plugin/src/server/legacy-entry-migration.ts`.
61
+ Hash sidecar: `mcp-builtin.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
+ dc91e569d6caa71c