@herbertgao/pi-extensions 2026.9.11 → 2026.9.13

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 (192) hide show
  1. package/README.md +4 -4
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/node_modules/@herbertgao/pi-cc-extensions/package.json +1 -1
  4. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +8 -0
  5. package/node_modules/@herbertgao/pi-subagents/package.json +1 -1
  6. package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +5 -4
  7. package/node_modules/@herbertgao/pi-subagents/src/mention-clone.ts +39 -16
  8. package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +2 -2
  9. package/node_modules/@narumitw/pi-btw/README.md +21 -4
  10. package/node_modules/@narumitw/pi-btw/dist/index.ts +1668 -958
  11. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
  12. package/node_modules/@narumitw/pi-btw/docs/workflows.md +10 -2
  13. package/node_modules/@narumitw/pi-btw/package.json +1 -1
  14. package/node_modules/@narumitw/pi-btw/src/btw.ts +17 -79
  15. package/node_modules/@narumitw/pi-btw/src/conversation-context.ts +74 -0
  16. package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +196 -7
  17. package/node_modules/@narumitw/pi-btw/src/main-thread-updates.ts +40 -0
  18. package/node_modules/@narumitw/pi-btw/src/menu.ts +34 -2
  19. package/node_modules/@narumitw/pi-btw/src/settings.ts +49 -0
  20. package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +9 -1
  21. package/node_modules/@narumitw/pi-btw/src/workspace-layout.ts +559 -0
  22. package/node_modules/pi-mcp-adapter/CHANGELOG.md +62 -0
  23. package/node_modules/pi-mcp-adapter/README.md +75 -7
  24. package/node_modules/pi-mcp-adapter/bearer-command-resolver.ts +193 -0
  25. package/node_modules/pi-mcp-adapter/cli.js +56 -5
  26. package/node_modules/pi-mcp-adapter/commands.ts +96 -5
  27. package/node_modules/pi-mcp-adapter/config.ts +73 -6
  28. package/node_modules/pi-mcp-adapter/direct-tool-surface.ts +22 -28
  29. package/node_modules/pi-mcp-adapter/direct-tools.ts +13 -5
  30. package/node_modules/pi-mcp-adapter/dist/abort.d.ts +2 -0
  31. package/node_modules/pi-mcp-adapter/dist/abort.js +36 -0
  32. package/node_modules/pi-mcp-adapter/dist/abort.js.map +1 -0
  33. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.d.ts +6 -0
  34. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js +194 -0
  35. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js.map +1 -0
  36. package/node_modules/pi-mcp-adapter/dist/config.d.ts +5 -0
  37. package/node_modules/pi-mcp-adapter/dist/config.js +75 -6
  38. package/node_modules/pi-mcp-adapter/dist/config.js.map +1 -1
  39. package/node_modules/pi-mcp-adapter/dist/consent-manager.d.ts +18 -0
  40. package/node_modules/pi-mcp-adapter/dist/consent-manager.js +88 -0
  41. package/node_modules/pi-mcp-adapter/dist/consent-manager.js.map +1 -0
  42. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.d.ts +17 -0
  43. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js +316 -0
  44. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js.map +1 -0
  45. package/node_modules/pi-mcp-adapter/dist/errors.d.ts +131 -0
  46. package/node_modules/pi-mcp-adapter/dist/errors.js +278 -0
  47. package/node_modules/pi-mcp-adapter/dist/errors.js.map +1 -0
  48. package/node_modules/pi-mcp-adapter/dist/http-ca.d.ts +8 -0
  49. package/node_modules/pi-mcp-adapter/dist/http-ca.js +88 -0
  50. package/node_modules/pi-mcp-adapter/dist/http-ca.js.map +1 -0
  51. package/node_modules/pi-mcp-adapter/dist/jev-client.d.ts +15 -0
  52. package/node_modules/pi-mcp-adapter/dist/jev-client.js +340 -0
  53. package/node_modules/pi-mcp-adapter/dist/jev-client.js.map +1 -0
  54. package/node_modules/pi-mcp-adapter/dist/jev-contracts.d.ts +77 -0
  55. package/node_modules/pi-mcp-adapter/dist/jev-contracts.js +2 -0
  56. package/node_modules/pi-mcp-adapter/dist/jev-contracts.js.map +1 -0
  57. package/node_modules/pi-mcp-adapter/dist/jev-key-store.d.ts +22 -0
  58. package/node_modules/pi-mcp-adapter/dist/jev-key-store.js +85 -0
  59. package/node_modules/pi-mcp-adapter/dist/jev-key-store.js.map +1 -0
  60. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.d.ts +2 -0
  61. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js +55 -0
  62. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js.map +1 -0
  63. package/node_modules/pi-mcp-adapter/dist/lifecycle.d.ts +56 -0
  64. package/node_modules/pi-mcp-adapter/dist/lifecycle.js +410 -0
  65. package/node_modules/pi-mcp-adapter/dist/lifecycle.js.map +1 -0
  66. package/node_modules/pi-mcp-adapter/dist/logger.d.ts +51 -0
  67. package/node_modules/pi-mcp-adapter/dist/logger.js +131 -0
  68. package/node_modules/pi-mcp-adapter/dist/logger.js.map +1 -0
  69. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.d.ts +26 -0
  70. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js +103 -0
  71. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js.map +1 -0
  72. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.d.ts +118 -0
  73. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js +1098 -0
  74. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js.map +1 -0
  75. package/node_modules/pi-mcp-adapter/dist/mcp-auth.d.ts +168 -0
  76. package/node_modules/pi-mcp-adapter/dist/mcp-auth.js +1117 -0
  77. package/node_modules/pi-mcp-adapter/dist/mcp-auth.js.map +1 -0
  78. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js +7 -140
  79. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js.map +1 -1
  80. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.d.ts +53 -0
  81. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js +441 -0
  82. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js.map +1 -0
  83. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.d.ts +148 -0
  84. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js +689 -0
  85. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js.map +1 -0
  86. package/node_modules/pi-mcp-adapter/dist/mcp-probe.d.ts +6 -0
  87. package/node_modules/pi-mcp-adapter/dist/mcp-probe.js +166 -0
  88. package/node_modules/pi-mcp-adapter/dist/mcp-probe.js.map +1 -0
  89. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.d.ts +102 -0
  90. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js +369 -0
  91. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js.map +1 -0
  92. package/node_modules/pi-mcp-adapter/dist/mcp-trace.d.ts +95 -0
  93. package/node_modules/pi-mcp-adapter/dist/mcp-trace.js +242 -0
  94. package/node_modules/pi-mcp-adapter/dist/mcp-trace.js.map +1 -0
  95. package/node_modules/pi-mcp-adapter/dist/metadata-cache.js +2 -11
  96. package/node_modules/pi-mcp-adapter/dist/metadata-cache.js.map +1 -1
  97. package/node_modules/pi-mcp-adapter/dist/npx-resolver.d.ts +6 -0
  98. package/node_modules/pi-mcp-adapter/dist/npx-resolver.js +505 -0
  99. package/node_modules/pi-mcp-adapter/dist/npx-resolver.js.map +1 -0
  100. package/node_modules/pi-mcp-adapter/dist/request-headers-command.d.ts +10 -0
  101. package/node_modules/pi-mcp-adapter/dist/request-headers-command.js +312 -0
  102. package/node_modules/pi-mcp-adapter/dist/request-headers-command.js.map +1 -0
  103. package/node_modules/pi-mcp-adapter/dist/runtime-owner.d.ts +13 -0
  104. package/node_modules/pi-mcp-adapter/dist/runtime-owner.js +97 -0
  105. package/node_modules/pi-mcp-adapter/dist/runtime-owner.js.map +1 -0
  106. package/node_modules/pi-mcp-adapter/dist/sampling-handler.d.ts +17 -0
  107. package/node_modules/pi-mcp-adapter/dist/sampling-handler.js +203 -0
  108. package/node_modules/pi-mcp-adapter/dist/sampling-handler.js.map +1 -0
  109. package/node_modules/pi-mcp-adapter/dist/secure-keyring.d.ts +11 -0
  110. package/node_modules/pi-mcp-adapter/dist/secure-keyring.js +172 -0
  111. package/node_modules/pi-mcp-adapter/dist/secure-keyring.js.map +1 -0
  112. package/node_modules/pi-mcp-adapter/dist/server-manager.d.ts +157 -0
  113. package/node_modules/pi-mcp-adapter/dist/server-manager.js +1743 -0
  114. package/node_modules/pi-mcp-adapter/dist/server-manager.js.map +1 -0
  115. package/node_modules/pi-mcp-adapter/dist/session-approvals.d.ts +34 -0
  116. package/node_modules/pi-mcp-adapter/dist/session-approvals.js +140 -0
  117. package/node_modules/pi-mcp-adapter/dist/session-approvals.js.map +1 -0
  118. package/node_modules/pi-mcp-adapter/dist/session-recovery.d.ts +26 -0
  119. package/node_modules/pi-mcp-adapter/dist/session-recovery.js +142 -0
  120. package/node_modules/pi-mcp-adapter/dist/session-recovery.js.map +1 -0
  121. package/node_modules/pi-mcp-adapter/dist/state.d.ts +73 -0
  122. package/node_modules/pi-mcp-adapter/dist/state.js +2 -0
  123. package/node_modules/pi-mcp-adapter/dist/state.js.map +1 -0
  124. package/node_modules/pi-mcp-adapter/dist/types.d.ts +36 -0
  125. package/node_modules/pi-mcp-adapter/dist/types.js +18 -0
  126. package/node_modules/pi-mcp-adapter/dist/types.js.map +1 -1
  127. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.d.ts +17 -0
  128. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js +219 -0
  129. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js.map +1 -0
  130. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.d.ts +15 -0
  131. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js +85 -0
  132. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js.map +1 -0
  133. package/node_modules/pi-mcp-adapter/dist/utils.d.ts +1 -0
  134. package/node_modules/pi-mcp-adapter/dist/utils.js +13 -0
  135. package/node_modules/pi-mcp-adapter/dist/utils.js.map +1 -1
  136. package/node_modules/pi-mcp-adapter/elicitation-handler.ts +29 -19
  137. package/node_modules/pi-mcp-adapter/examples/jev-accessibility-loop.mjs +85 -0
  138. package/node_modules/pi-mcp-adapter/examples/jev-semantic-filter.mjs +34 -0
  139. package/node_modules/pi-mcp-adapter/index.ts +129 -6
  140. package/node_modules/pi-mcp-adapter/init.ts +6 -19
  141. package/node_modules/pi-mcp-adapter/jev-client.ts +273 -0
  142. package/node_modules/pi-mcp-adapter/jev-contracts.ts +53 -0
  143. package/node_modules/pi-mcp-adapter/jev-key-store.ts +79 -0
  144. package/node_modules/pi-mcp-adapter/lifecycle.ts +14 -3
  145. package/node_modules/pi-mcp-adapter/mcp-bearer-store.ts +7 -142
  146. package/node_modules/pi-mcp-adapter/mcp-code.ts +119 -11
  147. package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +4 -0
  148. package/node_modules/pi-mcp-adapter/mcp-references.ts +5 -3
  149. package/node_modules/pi-mcp-adapter/mcp-script-worker.mjs +5 -0
  150. package/node_modules/pi-mcp-adapter/mcp-tasks.ts +467 -0
  151. package/node_modules/pi-mcp-adapter/metadata-cache.ts +2 -13
  152. package/node_modules/pi-mcp-adapter/namespace-tools.ts +1 -1
  153. package/node_modules/pi-mcp-adapter/package.json +17 -9
  154. package/node_modules/pi-mcp-adapter/proxy-modes.ts +319 -166
  155. package/node_modules/pi-mcp-adapter/request-headers-command.ts +6 -3
  156. package/node_modules/pi-mcp-adapter/search-ranking.ts +38 -7
  157. package/node_modules/pi-mcp-adapter/secure-keyring.ts +170 -0
  158. package/node_modules/pi-mcp-adapter/semantic-search.ts +186 -0
  159. package/node_modules/pi-mcp-adapter/server-manager.ts +293 -50
  160. package/node_modules/pi-mcp-adapter/session-approvals.ts +14 -0
  161. package/node_modules/pi-mcp-adapter/skills/mcp-scripting/SKILL.md +2 -0
  162. package/node_modules/pi-mcp-adapter/state.ts +3 -1
  163. package/node_modules/pi-mcp-adapter/tool-approval.ts +26 -4
  164. package/node_modules/pi-mcp-adapter/tool-metadata.ts +6 -14
  165. package/node_modules/pi-mcp-adapter/tool-registrar.ts +8 -6
  166. package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +4 -1
  167. package/node_modules/pi-mcp-adapter/types.ts +53 -0
  168. package/node_modules/pi-mcp-adapter/ui-server.ts +17 -9
  169. package/node_modules/pi-mcp-adapter/utils.ts +16 -0
  170. package/node_modules/pi-multi-account/CHANGELOG.md +23 -0
  171. package/node_modules/pi-multi-account/README.md +38 -11
  172. package/node_modules/pi-multi-account/index.ts +371 -96
  173. package/node_modules/pi-multi-account/package.json +5 -4
  174. package/node_modules/pi-multi-account/provider-payload-stream.ts +36 -28
  175. package/node_modules/pi-multi-account/usage.ts +31 -2
  176. package/node_modules/pi-typesafe/README.md +3 -1
  177. package/node_modules/pi-typesafe/dist/auth.d.ts +10 -3
  178. package/node_modules/pi-typesafe/dist/auth.js +13 -7
  179. package/node_modules/pi-typesafe/dist/backends.d.ts +31 -0
  180. package/node_modules/pi-typesafe/dist/backends.js +33 -0
  181. package/node_modules/pi-typesafe/dist/client.d.ts +3 -9
  182. package/node_modules/pi-typesafe/dist/client.js +63 -39
  183. package/node_modules/pi-typesafe/dist/credentials.d.ts +11 -5
  184. package/node_modules/pi-typesafe/dist/credentials.js +15 -8
  185. package/node_modules/pi-typesafe/dist/extension.js +4 -1
  186. package/node_modules/pi-typesafe/dist/index.d.ts +1 -1
  187. package/node_modules/pi-typesafe/dist/index.js +1 -1
  188. package/node_modules/pi-typesafe/dist/login.d.ts +13 -7
  189. package/node_modules/pi-typesafe/dist/login.js +17 -8
  190. package/node_modules/pi-typesafe/dist/schema.js +19 -13
  191. package/node_modules/pi-typesafe/package.json +1 -1
  192. package/package.json +11 -10
package/README.md CHANGED
@@ -15,7 +15,7 @@ The package bundles 6 active `@herbertgao/*` child packages—`pi-bark`, `pi-cc-
15
15
  - `pi-antigravity@0.7.2`
16
16
  - `@dietrichgebert/ponytail@4.9.0`
17
17
  - `@juicesharp/rpiv-ask-user-question@2.8.0`
18
- - `@narumitw/pi-btw@0.59.0`
18
+ - `@narumitw/pi-btw@0.61.0`
19
19
 
20
20
  - `@narumitw/pi-caffeinate@0.49.7`
21
21
  - `@pi-plugins/fast-mode@0.1.10`
@@ -27,8 +27,8 @@ The package bundles 6 active `@herbertgao/*` child packages—`pi-bark`, `pi-cc-
27
27
  - `@tifan/pi-recap@0.4.6`
28
28
  - `@tifan/pi-rename@0.6.0`
29
29
  - `pi-mcp-adapter@2.31.0`
30
- - `pi-typesafe@0.5.0`
31
- - `pi-multi-account@1.22.0`
30
+ - `pi-typesafe@0.7.1`
31
+ - `pi-multi-account@1.23.0`
32
32
  - `pi-footer@0.5.1`
33
33
  - `pi-jev-auto-mode@0.4.1`
34
34
  - `pi-lens@4.2.1`
@@ -43,7 +43,7 @@ Pi loads their extensions and skills through `node_modules/` paths inside one pa
43
43
 
44
44
  `@narumitw/pi-caffeinate@0.49.7` uses the host platform's sleep inhibitor during each Pi agent run. On macOS, `/caffeinate sleep` keeps the system awake while allowing the display to sleep; `/caffeinate display` also keeps the display awake. It releases the inhibitor when the run or session ends.
45
45
 
46
- `pi-jev-auto-mode@0.4.1` adds fail-closed Jev safety gates for shell commands and file changes. `pi-typesafe@0.5.0` adds the `/typesafe` command and `typesafe_evaluate` tool for explicit structured decisions; both use the TypeSafe API after login.
46
+ `pi-jev-auto-mode@0.4.1` adds fail-closed Jev safety gates for shell commands and file changes. `pi-typesafe@0.7.1` adds the `/typesafe` command and `typesafe_evaluate` tool for explicit structured decisions; both use the TypeSafe API after login.
47
47
 
48
48
  `@herbertgao/resume-from@0.2.0` keeps Claude Code sessions associated with their original repository when the active transcript later moves into a nested cwd. `@herbertgao/sol-pi@0.1.0` adds opt-in Action Fusion, ObservationPack, Evidence-Preserving Reducer, and Online Context Compact; see its [configuration guide](../sol-pi/docs/configuration.md). `pi-lens@4.2.1` expands language routing and bounds retained diagnostic facts across multi-root sessions. `pi-web-access@0.27.0` adds configurable fetch deadlines and answer models plus isolated GitHub clone runtimes. Preferred Thinking 1.0.1 preserves an explicit subagent `--thinking` choice. Deprecated `@tifan/pi-titlebar-spinner` is no longer bundled; Rename remains the single owner of Herdr tab naming.
49
49
 
@@ -163,7 +163,7 @@ THE SOFTWARE.
163
163
 
164
164
  ## `pi-multi-account`
165
165
 
166
- The aggregate bundles the MIT-licensed [`pi-multi-account`](https://github.com/Sarrius/pi-multi-account) package version 1.22.0 under its original attribution:
166
+ The aggregate bundles the MIT-licensed [`pi-multi-account`](https://github.com/Sarrius/pi-multi-account) package version 1.23.0 under its original attribution:
167
167
 
168
168
  MIT License
169
169
 
@@ -70,7 +70,7 @@
70
70
  "x-upstream": {
71
71
  "package": "pi-cc-extensions",
72
72
  "version": "0.8.71",
73
- "reviewedVersion": "0.9.1",
73
+ "reviewedVersion": "0.9.2",
74
74
  "repository": "https://github.com/minuque/pi-cc-extensions",
75
75
  "commit": "e43e0041b59f5d7f03be9b9d103a5f9e954e4c11"
76
76
  }
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.18.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#227](https://github.com/HerbertGao/pi-extensions/pull/227) [`d052f3f`](https://github.com/HerbertGao/pi-extensions/commit/d052f3f3c81e9b6a74d344e9de0f83b8d28341d3) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Retain completed subagent results until they are consumed, including when cleanup runs after ten minutes.
8
+
9
+ Fix a separate Pi 0.87 compatibility issue in mention clones: restore history through SessionManager and provide the live prompt through the before_agent_start hook instead of writing getter-only agent state.
10
+
3
11
  ## 0.18.1
4
12
 
5
13
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbertgao/pi-subagents",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "Claude Code-style autonomous subagents and workflow orchestration for Pi, with HerbertGao-maintained UI extensions.",
5
5
  "keywords": [
6
6
  "agent",
@@ -440,8 +440,8 @@ export class AgentManager {
440
440
 
441
441
  /**
442
442
  * Evicted agents that can still be reached by name, keyed by handle. Outlives
443
- * the 10-minute record cleanup — that timer exists to bound memory, not to
444
- * expire a conversation the user might still want — and is cleared alongside
443
+ * the 10-minute record cleanup — that timer bounds memory after results are
444
+ * consumed — and is cleared alongside
445
445
  * completed records on session start/switch.
446
446
  */
447
447
  private tombstones = new Map<string, AgentTombstone>()
@@ -483,7 +483,7 @@ export class AgentManager {
483
483
  this.onCompact = onCompact
484
484
  this.onUsage = onUsage
485
485
  this.maxConcurrent = maxConcurrent
486
- // Cleanup completed agents after 10 minutes (but keep sessions for resume)
486
+ // Cleanup consumed completed agents after 10 minutes
487
487
  this.cleanupInterval = setInterval(() => this.cleanup(), 60_000)
488
488
  this.cleanupInterval.unref()
489
489
  }
@@ -1640,6 +1640,7 @@ export class AgentManager {
1640
1640
  for (const [id, record] of this.agents) {
1641
1641
  if (record.status === "running" || record.status === "queued") continue
1642
1642
  if ((record.completedAt ?? 0) >= cutoff) continue
1643
+ if (!record.resultConsumed) continue
1643
1644
  this.removeRecord(id, record)
1644
1645
  }
1645
1646
  }
@@ -1648,7 +1649,7 @@ export class AgentManager {
1648
1649
  * Remove all completed/stopped/errored records immediately.
1649
1650
  * Called on session start/switch so tasks from a prior session don't persist.
1650
1651
  * Pass skipUnconsumed=true to preserve records the LLM hasn't read yet
1651
- * (resultConsumed=false) — they will be evicted by the 10-minute cleanup timer instead.
1652
+ * (resultConsumed=false). The cleanup timer only evicts consumed results.
1652
1653
  */
1653
1654
  clearCompleted(skipUnconsumed = false): void {
1654
1655
  for (const [id, record] of this.agents) {
@@ -64,8 +64,11 @@
64
64
  import type { Model } from "@earendil-works/pi-ai"
65
65
  import {
66
66
  buildSessionContext,
67
+ convertToLlm,
67
68
  createAgentSession,
69
+ DefaultResourceLoader,
68
70
  type ExtensionContext,
71
+ getAgentDir,
69
72
  SessionManager,
70
73
  type ToolDefinition,
71
74
  } from "@earendil-works/pi-coding-agent"
@@ -163,12 +166,43 @@ export async function runMentionClone(
163
166
  // `/think` is on anyway. Same shim shape as `modelRuntime` below.
164
167
  const thinkingLevel = (ctx as { thinkingLevel?: ThinkingLevel })
165
168
  .thinkingLevel
166
- const created = await runInChildSessionContext(() =>
167
- createAgentSession({
169
+ const sessionManager = SessionManager.inMemory(ctx.cwd)
170
+ for (const entry of conversation.messages) {
171
+ // The live prompt is copied below. Do not replay the parent's system
172
+ // messages: newer Pi also stores its tool declarations there.
173
+ if ((entry.role as string) === "system") continue
174
+ // Summary messages are projections, not appendable session entries.
175
+ // Preserve exactly the user message Pi would send for each summary.
176
+ if (
177
+ entry.role === "compactionSummary" ||
178
+ entry.role === "branchSummary"
179
+ ) {
180
+ for (const message of convertToLlm([entry]))
181
+ sessionManager.appendMessage(message)
182
+ } else {
183
+ sessionManager.appendMessage(entry)
184
+ }
185
+ }
186
+ const systemPrompt = ctx.getSystemPrompt?.()
187
+ const created = await runInChildSessionContext(async () => {
188
+ const resourceLoader = new DefaultResourceLoader({
189
+ cwd: ctx.cwd,
190
+ agentDir: getAgentDir(),
191
+ extensionFactories: [
192
+ (pi) => {
193
+ pi.on("before_agent_start", () =>
194
+ systemPrompt ? { systemPrompt } : undefined,
195
+ )
196
+ },
197
+ ],
198
+ })
199
+ await resourceLoader.reload()
200
+ return createAgentSession({
168
201
  cwd: ctx.cwd,
169
202
  // Nothing about the copy is worth persisting, and an in-memory manager
170
203
  // is also what keeps the real session untouched.
171
- sessionManager: SessionManager.inMemory(ctx.cwd),
204
+ sessionManager,
205
+ resourceLoader,
172
206
  model: ctx.model as Model<never> | undefined,
173
207
  ...(thinkingLevel && { thinkingLevel }),
174
208
  modelRegistry: ctx.modelRegistry,
@@ -185,21 +219,10 @@ export async function runMentionClone(
185
219
  // agent-runner's `tools: sessionTools` beside its nested `customTools`.
186
220
  tools: [cloneAgentTool.name],
187
221
  customTools: [cloneAgentTool],
188
- } as Parameters<typeof createAgentSession>[0]),
189
- )
222
+ } as Parameters<typeof createAgentSession>[0])
223
+ })
190
224
  session = created.session
191
225
 
192
- // The clone rebuilds a system prompt from cwd and agentDir, which is close
193
- // but not the live one — extensions contribute to it per turn. Copy the
194
- // real thing, so the copy reasons under the instructions the user's model
195
- // is actually working under.
196
- const systemPrompt = ctx.getSystemPrompt?.()
197
- if (systemPrompt) session.agent.state.systemPrompt = systemPrompt
198
-
199
- // The conversation itself. Pushed rather than assigned so the array the
200
- // session was built around stays the one it goes on using.
201
- session.agent.state.messages.push(...conversation.messages)
202
-
203
226
  // User text first, reminder after — the order Claude Code's attachment
204
227
  // renderer produces, where the reminder trails the message it is about.
205
228
  await session.prompt(`${message}\n\n${agentMentionReminder(type)}`)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juicesharp/rpiv-ask-user-question",
3
- "version": "2.10.1",
3
+ "version": "2.11.0",
4
4
  "description": "Pi extension. A structured questionnaire the model can put to you when it would otherwise guess, with typed options instead of free-form replies.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -95,7 +95,7 @@
95
95
  }
96
96
  },
97
97
  "dependencies": {
98
- "@juicesharp/rpiv-config": "^2.10.1",
98
+ "@juicesharp/rpiv-config": "^2.11.0",
99
99
  "typebox": "^1.1.24"
100
100
  }
101
101
  }
@@ -10,6 +10,7 @@ Only context you explicitly bring back is loaded into the main editor.
10
10
  - Starts a side thread immediately with `/btw <question>` or opens the manager with `/btw`.
11
11
  - Uses any persisted main-session branch as context without switching branches.
12
12
  - Supports scrollable answers, transcript search, a clickable jump-to-latest control, follow-up questions, queued steering, and in-memory resume.
13
+ - Offers fullscreen, side-thread-left, and side-thread-right workspaces with Pi's live main-thread view, click-to-focus input, and a draggable remembered divider.
13
14
  - Renders supported Mermaid fences as width-safe, themed Unicode diagrams without a browser or network request.
14
15
  - Keeps side questions and answers out of the main conversation by default.
15
16
  - Brings back the latest answer, a question suffix, an exact range, or the complete thread only when requested.
@@ -77,7 +78,9 @@ The normal location is `~/.pi/agent/pi-btw.json`.
77
78
  "model": "anthropic/claude-sonnet-4-5",
78
79
  "thinkingLevel": "low",
79
80
  "rememberThinkingLevelChanges": true,
80
- "fullscreenCopyOnSelect": true
81
+ "fullscreenCopyOnSelect": true,
82
+ "layout": "left-pane",
83
+ "sidePaneRatio": 0.5
81
84
  }
82
85
  ```
83
86
 
@@ -106,10 +109,23 @@ When **Same as main thread** is selected, shortcut changes stay local even when
106
109
  If a shortcut write fails, the local change remains active and pi-btw warns that it was not remembered.
107
110
  A failed Settings-screen save instead restores the previous displayed value.
108
111
 
109
- `fullscreenCopyOnSelect` controls only pi-btw's dedicated fullscreen view and defaults to `true` when omitted.
112
+ `fullscreenCopyOnSelect` controls only pi-btw's dedicated workspace and defaults to `true` when omitted.
110
113
  Turn **Copy selection automatically** off to retain highlighted selections and copy them with Pi's effective `app.message.copy` binding.
111
114
  Pi-btw does not inherit Pi core's setting of the same name because Pi's public extension API does not expose its effective value.
112
115
 
116
+ `layout` controls the dedicated workspace and defaults to `fullscreen` when omitted.
117
+ Accepted values are `fullscreen`, `left-pane`, and `right-pane`.
118
+ The pane names identify the side thread's position; the other pane reuses Pi's native main-thread rendering at pane width and stays current while BTW is open.
119
+ A single muted divider separates the panes; click either pane to move keyboard focus to it.
120
+ Drag the divider with the primary mouse button to resize both panes.
121
+ The side-thread share is limited to 20–80% and saved as `sidePaneRatio` when the button is released, independent of whether the side thread is on the left or right.
122
+ If the save fails, the workspace restores the last saved ratio and reports the error.
123
+ Pi's search and keyboard viewport controls apply to the active pane.
124
+ The mouse wheel scrolls the pane under the pointer without moving keyboard focus, and both panes continue redrawing while either pane is active.
125
+ If you selected context from the main-thread tree, the main pane still shows the active main thread while the side model receives the selected branch.
126
+ Pane layouts collapse to the side thread alone below 80 terminal columns and return keyboard focus to it.
127
+ Choose **Side-thread layout** in Settings; changes apply the next time a new or resumed BTW workspace opens.
128
+
113
129
  ### Keybindings
114
130
 
115
131
  Open `/btw` → **Settings**, select a shortcut row, then choose **Edit key combination…** or **Restore default**.
@@ -149,9 +165,9 @@ An explicitly unbound Pi thinking action stays unbound. Remove an override field
149
165
  ### Persistence
150
166
 
151
167
  Reading a missing settings file has no side effects.
152
- Pi-btw creates it only after a Settings change or a remembered shortcut change.
168
+ Pi-btw creates it only after a Settings change, a remembered shortcut change, or a divider drag.
153
169
  Within one Pi process, saves run in order and publish atomically through a same-directory temporary file and rename.
154
- Saves preserve `model` and unknown fields.
170
+ Saves preserve other recognized settings and unknown fields.
155
171
  Malformed or invalid files block saves and remain unchanged.
156
172
  Files must be valid UTF-8 and no larger than 64 KiB.
157
173
  Separate Pi processes and external editors are outside the in-process ordering boundary.
@@ -160,6 +176,7 @@ The file is read for every `/btw` invocation, so edits apply without `/reload`.
160
176
  ## 🚧 Limitations
161
177
 
162
178
  - `/btw` supports TUI mode only.
179
+ - Only the clicked pane receives keyboard input; hovering or scrolling over the other pane does not move focus.
163
180
  - Resume state is memory-only and lasts only for the current extension instance.
164
181
  - A side thread retains the latest 40,000 characters of main-conversation context and adds a truncation notice when earlier content is omitted.
165
182
  - Clipboard access depends on Pi's host helper, the operating system, and the terminal.