@draht/coding-agent 2026.6.11 → 2026.7.7-1

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 (332) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1 -4
  3. package/dist/bun/register-bedrock.d.ts.map +1 -1
  4. package/dist/bun/register-bedrock.js +1 -1
  5. package/dist/bun/register-bedrock.js.map +1 -1
  6. package/dist/bun/restore-sandbox-env.d.ts +4 -0
  7. package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
  8. package/dist/bun/restore-sandbox-env.js +4 -0
  9. package/dist/bun/restore-sandbox-env.js.map +1 -1
  10. package/dist/cli/args.d.ts.map +1 -1
  11. package/dist/cli/args.js +4 -4
  12. package/dist/cli/args.js.map +1 -1
  13. package/dist/cli/config-selector.d.ts +4 -2
  14. package/dist/cli/config-selector.d.ts.map +1 -1
  15. package/dist/cli/config-selector.js +1 -1
  16. package/dist/cli/config-selector.js.map +1 -1
  17. package/dist/cli/file-processor.d.ts.map +1 -1
  18. package/dist/cli/file-processor.js +13 -25
  19. package/dist/cli/file-processor.js.map +1 -1
  20. package/dist/cli/session-picker.d.ts +2 -1
  21. package/dist/cli/session-picker.d.ts.map +1 -1
  22. package/dist/cli/session-picker.js +5 -4
  23. package/dist/cli/session-picker.js.map +1 -1
  24. package/dist/cli/startup-ui.d.ts +5 -1
  25. package/dist/cli/startup-ui.d.ts.map +1 -1
  26. package/dist/cli/startup-ui.js +94 -22
  27. package/dist/cli/startup-ui.js.map +1 -1
  28. package/dist/config.d.ts +6 -2
  29. package/dist/config.d.ts.map +1 -1
  30. package/dist/config.js +35 -16
  31. package/dist/config.js.map +1 -1
  32. package/dist/core/agent-session.d.ts +10 -4
  33. package/dist/core/agent-session.d.ts.map +1 -1
  34. package/dist/core/agent-session.js +124 -83
  35. package/dist/core/agent-session.js.map +1 -1
  36. package/dist/core/auth-storage.d.ts +11 -12
  37. package/dist/core/auth-storage.d.ts.map +1 -1
  38. package/dist/core/auth-storage.js +25 -26
  39. package/dist/core/auth-storage.js.map +1 -1
  40. package/dist/core/compaction/branch-summarization.d.ts +3 -1
  41. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  42. package/dist/core/compaction/branch-summarization.js +3 -3
  43. package/dist/core/compaction/branch-summarization.js.map +1 -1
  44. package/dist/core/compaction/compaction.d.ts +5 -4
  45. package/dist/core/compaction/compaction.d.ts.map +1 -1
  46. package/dist/core/compaction/compaction.js +23 -20
  47. package/dist/core/compaction/compaction.js.map +1 -1
  48. package/dist/core/export-html/vendor/marked.min.js +75 -3
  49. package/dist/core/extensions/index.d.ts +1 -1
  50. package/dist/core/extensions/index.d.ts.map +1 -1
  51. package/dist/core/extensions/index.js.map +1 -1
  52. package/dist/core/extensions/loader.d.ts +2 -3
  53. package/dist/core/extensions/loader.d.ts.map +1 -1
  54. package/dist/core/extensions/loader.js +77 -14
  55. package/dist/core/extensions/loader.js.map +1 -1
  56. package/dist/core/extensions/runner.d.ts +2 -1
  57. package/dist/core/extensions/runner.d.ts.map +1 -1
  58. package/dist/core/extensions/runner.js +33 -1
  59. package/dist/core/extensions/runner.js.map +1 -1
  60. package/dist/core/extensions/types.d.ts +29 -2
  61. package/dist/core/extensions/types.d.ts.map +1 -1
  62. package/dist/core/extensions/types.js.map +1 -1
  63. package/dist/core/http-dispatcher.d.ts +1 -0
  64. package/dist/core/http-dispatcher.d.ts.map +1 -1
  65. package/dist/core/http-dispatcher.js +45 -2
  66. package/dist/core/http-dispatcher.js.map +1 -1
  67. package/dist/core/index.d.ts +1 -1
  68. package/dist/core/index.d.ts.map +1 -1
  69. package/dist/core/index.js.map +1 -1
  70. package/dist/core/keybindings.d.ts +1 -1
  71. package/dist/core/keybindings.d.ts.map +1 -1
  72. package/dist/core/keybindings.js +3 -6
  73. package/dist/core/keybindings.js.map +1 -1
  74. package/dist/core/model-registry.d.ts +2 -1
  75. package/dist/core/model-registry.d.ts.map +1 -1
  76. package/dist/core/model-registry.js +32 -67
  77. package/dist/core/model-registry.js.map +1 -1
  78. package/dist/core/model-resolver.d.ts +11 -1
  79. package/dist/core/model-resolver.d.ts.map +1 -1
  80. package/dist/core/model-resolver.js +37 -19
  81. package/dist/core/model-resolver.js.map +1 -1
  82. package/dist/core/package-manager.d.ts +5 -2
  83. package/dist/core/package-manager.d.ts.map +1 -1
  84. package/dist/core/package-manager.js +99 -43
  85. package/dist/core/package-manager.js.map +1 -1
  86. package/dist/core/project-trust.d.ts.map +1 -1
  87. package/dist/core/project-trust.js +4 -3
  88. package/dist/core/project-trust.js.map +1 -1
  89. package/dist/core/provider-attribution.d.ts +2 -2
  90. package/dist/core/provider-attribution.d.ts.map +1 -1
  91. package/dist/core/provider-attribution.js.map +1 -1
  92. package/dist/core/provider-display-names.d.ts.map +1 -1
  93. package/dist/core/provider-display-names.js +1 -1
  94. package/dist/core/provider-display-names.js.map +1 -1
  95. package/dist/core/resolve-config-value.d.ts +7 -8
  96. package/dist/core/resolve-config-value.d.ts.map +1 -1
  97. package/dist/core/resolve-config-value.js +24 -26
  98. package/dist/core/resolve-config-value.js.map +1 -1
  99. package/dist/core/resource-loader.d.ts +3 -2
  100. package/dist/core/resource-loader.d.ts.map +1 -1
  101. package/dist/core/resource-loader.js +16 -6
  102. package/dist/core/resource-loader.js.map +1 -1
  103. package/dist/core/sdk.d.ts +9 -9
  104. package/dist/core/sdk.d.ts.map +1 -1
  105. package/dist/core/sdk.js +3 -1
  106. package/dist/core/sdk.js.map +1 -1
  107. package/dist/core/session-manager.d.ts +21 -2
  108. package/dist/core/session-manager.d.ts.map +1 -1
  109. package/dist/core/session-manager.js +121 -77
  110. package/dist/core/session-manager.js.map +1 -1
  111. package/dist/core/settings-manager.d.ts +10 -1
  112. package/dist/core/settings-manager.d.ts.map +1 -1
  113. package/dist/core/settings-manager.js +29 -3
  114. package/dist/core/settings-manager.js.map +1 -1
  115. package/dist/core/system-prompt.d.ts.map +1 -1
  116. package/dist/core/system-prompt.js +7 -7
  117. package/dist/core/system-prompt.js.map +1 -1
  118. package/dist/core/timings.d.ts +4 -2
  119. package/dist/core/timings.d.ts.map +1 -1
  120. package/dist/core/timings.js +24 -14
  121. package/dist/core/timings.js.map +1 -1
  122. package/dist/core/tools/bash.d.ts.map +1 -1
  123. package/dist/core/tools/bash.js +32 -8
  124. package/dist/core/tools/bash.js.map +1 -1
  125. package/dist/core/tools/edit-diff.d.ts +23 -4
  126. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  127. package/dist/core/tools/edit-diff.js +99 -20
  128. package/dist/core/tools/edit-diff.js.map +1 -1
  129. package/dist/core/tools/edit.d.ts.map +1 -1
  130. package/dist/core/tools/edit.js +2 -2
  131. package/dist/core/tools/edit.js.map +1 -1
  132. package/dist/core/tools/find.d.ts.map +1 -1
  133. package/dist/core/tools/find.js +19 -11
  134. package/dist/core/tools/find.js.map +1 -1
  135. package/dist/core/tools/read.d.ts.map +1 -1
  136. package/dist/core/tools/read.js +12 -25
  137. package/dist/core/tools/read.js.map +1 -1
  138. package/dist/core/trust-manager.d.ts +8 -3
  139. package/dist/core/trust-manager.d.ts.map +1 -1
  140. package/dist/core/trust-manager.js +26 -11
  141. package/dist/core/trust-manager.js.map +1 -1
  142. package/dist/index.d.ts +6 -4
  143. package/dist/index.d.ts.map +1 -1
  144. package/dist/index.js +5 -3
  145. package/dist/index.js.map +1 -1
  146. package/dist/main.d.ts +2 -2
  147. package/dist/main.d.ts.map +1 -1
  148. package/dist/main.js +47 -15
  149. package/dist/main.js.map +1 -1
  150. package/dist/migrations.d.ts.map +1 -1
  151. package/dist/migrations.js +1 -123
  152. package/dist/migrations.js.map +1 -1
  153. package/dist/modes/interactive/assets/clankolas.png +0 -0
  154. package/dist/modes/interactive/components/assistant-message.d.ts +3 -1
  155. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  156. package/dist/modes/interactive/components/assistant-message.js +23 -15
  157. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  158. package/dist/modes/interactive/components/config-selector.d.ts +34 -3
  159. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  160. package/dist/modes/interactive/components/config-selector.js +284 -29
  161. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  162. package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
  163. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
  164. package/dist/modes/interactive/components/custom-entry.js +52 -0
  165. package/dist/modes/interactive/components/custom-entry.js.map +1 -0
  166. package/dist/modes/interactive/components/extension-editor.d.ts +3 -1
  167. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  168. package/dist/modes/interactive/components/extension-editor.js +12 -3
  169. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  170. package/dist/modes/interactive/components/footer.d.ts +2 -2
  171. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  172. package/dist/modes/interactive/components/footer.js +4 -0
  173. package/dist/modes/interactive/components/footer.js.map +1 -1
  174. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  175. package/dist/modes/interactive/components/login-dialog.js +0 -1
  176. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  177. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  178. package/dist/modes/interactive/components/model-selector.js +2 -1
  179. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  180. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  181. package/dist/modes/interactive/components/scoped-models-selector.js +4 -1
  182. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  183. package/dist/modes/interactive/components/session-selector.d.ts +0 -1
  184. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  185. package/dist/modes/interactive/components/session-selector.js +14 -8
  186. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  187. package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
  188. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  189. package/dist/modes/interactive/components/settings-selector.js +188 -16
  190. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  191. package/dist/modes/interactive/components/status-indicator.d.ts +28 -0
  192. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
  193. package/dist/modes/interactive/components/status-indicator.js +60 -0
  194. package/dist/modes/interactive/components/status-indicator.js.map +1 -0
  195. package/dist/modes/interactive/components/tree-selector.d.ts +1 -1
  196. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  197. package/dist/modes/interactive/components/tree-selector.js +130 -15
  198. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  199. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
  200. package/dist/modes/interactive/components/trust-selector.js +4 -4
  201. package/dist/modes/interactive/components/trust-selector.js.map +1 -1
  202. package/dist/modes/interactive/components/user-message.d.ts +6 -2
  203. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  204. package/dist/modes/interactive/components/user-message.js +19 -6
  205. package/dist/modes/interactive/components/user-message.js.map +1 -1
  206. package/dist/modes/interactive/interactive-mode.d.ts +13 -11
  207. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  208. package/dist/modes/interactive/interactive-mode.js +252 -233
  209. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  210. package/dist/modes/interactive/model-search.d.ts +12 -0
  211. package/dist/modes/interactive/model-search.d.ts.map +1 -0
  212. package/dist/modes/interactive/model-search.js +15 -0
  213. package/dist/modes/interactive/model-search.js.map +1 -0
  214. package/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
  215. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  216. package/dist/modes/interactive/theme/theme-controller.js +102 -0
  217. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  218. package/dist/modes/interactive/theme/theme-schema.json +2 -1
  219. package/dist/modes/interactive/theme/theme.d.ts +27 -8
  220. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  221. package/dist/modes/interactive/theme/theme.js +64 -42
  222. package/dist/modes/interactive/theme/theme.js.map +1 -1
  223. package/dist/modes/rpc/rpc-client.d.ts +19 -4
  224. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  225. package/dist/modes/rpc/rpc-client.js +14 -0
  226. package/dist/modes/rpc/rpc-client.js.map +1 -1
  227. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  228. package/dist/modes/rpc/rpc-mode.js +17 -1
  229. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  230. package/dist/modes/rpc/rpc-types.d.ts +26 -0
  231. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  232. package/dist/modes/rpc/rpc-types.js.map +1 -1
  233. package/dist/package-manager-cli.d.ts +2 -2
  234. package/dist/package-manager-cli.d.ts.map +1 -1
  235. package/dist/package-manager-cli.js +152 -48
  236. package/dist/package-manager-cli.js.map +1 -1
  237. package/dist/prompts/agents/build.md +38 -0
  238. package/dist/prompts/agents/plan.md +36 -0
  239. package/dist/prompts/agents/verify.md +36 -4
  240. package/dist/prompts/commands/brainstorm.md +162 -0
  241. package/dist/prompts/commands/discuss-phase.md +1 -1
  242. package/dist/prompts/commands/execute-phase.md +4 -1
  243. package/dist/prompts/commands/fix.md +12 -0
  244. package/dist/prompts/commands/init-project.md +1 -0
  245. package/dist/prompts/commands/map-codebase.md +1 -1
  246. package/dist/prompts/commands/new-project.md +1 -0
  247. package/dist/prompts/commands/next-milestone.md +2 -0
  248. package/dist/prompts/commands/orchestrate.md +4 -4
  249. package/dist/prompts/commands/plan-phase.md +5 -0
  250. package/dist/prompts/commands/quick.md +4 -0
  251. package/dist/prompts/commands/review.md +4 -1
  252. package/dist/prompts/commands/verify-work.md +10 -8
  253. package/dist/rpc-entry.d.ts +3 -0
  254. package/dist/rpc-entry.d.ts.map +1 -0
  255. package/dist/rpc-entry.js +10 -0
  256. package/dist/rpc-entry.js.map +1 -0
  257. package/dist/utils/child-process.d.ts +7 -4
  258. package/dist/utils/child-process.d.ts.map +1 -1
  259. package/dist/utils/child-process.js +23 -5
  260. package/dist/utils/child-process.js.map +1 -1
  261. package/dist/utils/image-convert.d.ts +1 -0
  262. package/dist/utils/image-convert.d.ts.map +1 -1
  263. package/dist/utils/image-convert.js +21 -15
  264. package/dist/utils/image-convert.js.map +1 -1
  265. package/dist/utils/image-process.d.ts +18 -0
  266. package/dist/utils/image-process.d.ts.map +1 -0
  267. package/dist/utils/image-process.js +83 -0
  268. package/dist/utils/image-process.js.map +1 -0
  269. package/dist/utils/mime.d.ts.map +1 -1
  270. package/dist/utils/mime.js +41 -0
  271. package/dist/utils/mime.js.map +1 -1
  272. package/dist/utils/shell.d.ts +1 -0
  273. package/dist/utils/shell.d.ts.map +1 -1
  274. package/dist/utils/shell.js +12 -5
  275. package/dist/utils/shell.js.map +1 -1
  276. package/dist/utils/version-check.d.ts.map +1 -1
  277. package/dist/utils/version-check.js +4 -27
  278. package/dist/utils/version-check.js.map +1 -1
  279. package/docs/extensions.md +55 -8
  280. package/docs/keybindings.md +1 -1
  281. package/docs/packages.md +2 -2
  282. package/docs/providers.md +2 -1
  283. package/docs/rpc.md +58 -0
  284. package/docs/sdk.md +50 -0
  285. package/docs/session-format.md +18 -8
  286. package/docs/settings.md +10 -0
  287. package/docs/usage.md +2 -2
  288. package/examples/extensions/README.md +1 -0
  289. package/examples/extensions/custom-compaction.ts +2 -1
  290. package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
  291. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  292. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  293. package/examples/extensions/custom-provider-gitlab-duo/index.ts +9 -5
  294. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  295. package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
  296. package/examples/extensions/entry-renderer.ts +41 -0
  297. package/examples/extensions/gondolin/package-lock.json +2 -2
  298. package/examples/extensions/gondolin/package.json +1 -1
  299. package/examples/extensions/handoff.ts +2 -2
  300. package/examples/extensions/plan-mode/index.ts +87 -37
  301. package/examples/extensions/preset.ts +10 -4
  302. package/examples/extensions/provider-payload.ts +5 -5
  303. package/examples/extensions/qna.ts +2 -2
  304. package/examples/extensions/question.ts +32 -18
  305. package/examples/extensions/questionnaire.ts +41 -28
  306. package/examples/extensions/sandbox/index.ts +2 -2
  307. package/examples/extensions/sandbox/package-lock.json +2 -2
  308. package/examples/extensions/sandbox/package.json +1 -1
  309. package/examples/extensions/subagent/agents.ts +2 -2
  310. package/examples/extensions/subagent/index.ts +9 -3
  311. package/examples/extensions/summarize.ts +2 -1
  312. package/examples/extensions/with-deps/package-lock.json +2 -2
  313. package/examples/extensions/with-deps/package.json +1 -1
  314. package/examples/sdk/02-custom-model.ts +1 -1
  315. package/examples/sdk/12-full-control.ts +2 -2
  316. package/package.json +14 -15
  317. package/prompts/agents/build.md +38 -0
  318. package/prompts/agents/plan.md +36 -0
  319. package/prompts/agents/verify.md +36 -4
  320. package/prompts/commands/brainstorm.md +162 -0
  321. package/prompts/commands/discuss-phase.md +1 -1
  322. package/prompts/commands/execute-phase.md +4 -1
  323. package/prompts/commands/fix.md +12 -0
  324. package/prompts/commands/init-project.md +1 -0
  325. package/prompts/commands/map-codebase.md +1 -1
  326. package/prompts/commands/new-project.md +1 -0
  327. package/prompts/commands/next-milestone.md +2 -0
  328. package/prompts/commands/orchestrate.md +4 -4
  329. package/prompts/commands/plan-phase.md +5 -0
  330. package/prompts/commands/quick.md +4 -0
  331. package/prompts/commands/review.md +4 -1
  332. package/prompts/commands/verify-work.md +10 -8
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Custom entry rendering example.
3
+ *
4
+ * Shows how to render durable extension data inside the chat without sending it
5
+ * to the LLM. Custom entries are stored in the session via pi.appendEntry() and
6
+ * rendered in interactive mode via pi.registerEntryRenderer().
7
+ *
8
+ * Usage: /status-card [message]
9
+ */
10
+
11
+ import type { ExtensionAPI } from "@draht/coding-agent";
12
+ import { Box, Text } from "@draht/tui";
13
+
14
+ interface StatusCardData {
15
+ message: string;
16
+ timestamp: number;
17
+ }
18
+
19
+ export default function (pi: ExtensionAPI) {
20
+ pi.registerEntryRenderer<StatusCardData>("status-card", (entry, { expanded }, theme) => {
21
+ const data = entry.data ?? { message: "No data", timestamp: Date.now() };
22
+ const box = new Box(1, 1, (text) => theme.bg("customMessageBg", text));
23
+ box.addChild(new Text(`${theme.fg("accent", "[status]")} ${data.message}`, 0, 0));
24
+
25
+ if (expanded) {
26
+ box.addChild(new Text(theme.fg("dim", new Date(data.timestamp).toLocaleString()), 0, 0));
27
+ }
28
+
29
+ return box;
30
+ });
31
+
32
+ pi.registerCommand("status-card", {
33
+ description: "Render a durable status card that is not sent to the LLM",
34
+ handler: async (args) => {
35
+ pi.appendEntry<StatusCardData>("status-card", {
36
+ message: args.trim() || "Status card",
37
+ timestamp: Date.now(),
38
+ });
39
+ },
40
+ });
41
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
- "version": "0.79.1",
3
+ "version": "0.80.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-gondolin",
9
- "version": "0.79.1",
9
+ "version": "0.80.3",
10
10
  "dependencies": {
11
11
  "@earendil-works/gondolin": "0.12.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
3
  "private": true,
4
- "version": "0.79.1",
4
+ "version": "0.80.3",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  import type { AgentMessage } from "@draht/agent-core";
16
- import { complete, type Message } from "@draht/ai";
16
+ import { complete, type Message } from "@draht/ai/compat";
17
17
  import type { ExtensionAPI, SessionEntry } from "@draht/coding-agent";
18
18
  import { BorderedLoader, convertToLlm, serializeConversation } from "@draht/coding-agent";
19
19
 
@@ -136,7 +136,7 @@ export default function (pi: ExtensionAPI) {
136
136
  const response = await complete(
137
137
  ctx.model!,
138
138
  { systemPrompt: SYSTEM_PROMPT, messages: [userMessage] },
139
- { apiKey: auth.apiKey, headers: auth.headers, signal: loader.signal },
139
+ { apiKey: auth.apiKey, headers: auth.headers, env: auth.env, signal: loader.signal },
140
140
  );
141
141
 
142
142
  if (response.stopReason === "aborted") {
@@ -2,7 +2,7 @@
2
2
  * Plan Mode Extension
3
3
  *
4
4
  * Read-only exploration mode for safe code analysis.
5
- * When enabled, only read-only tools are available.
5
+ * When enabled, built-in write tools are disabled.
6
6
  *
7
7
  * Features:
8
8
  * - /plan command or Ctrl+Alt+P to toggle
@@ -21,6 +21,15 @@ import { extractTodoItems, isSafeCommand, markCompletedSteps, type TodoItem } fr
21
21
  // Tools
22
22
  const PLAN_MODE_TOOLS = ["read", "bash", "grep", "find", "ls", "questionnaire"];
23
23
  const NORMAL_MODE_TOOLS = ["read", "bash", "edit", "write"];
24
+ const PLAN_MODE_DISABLED_TOOLS = new Set<string>(["edit", "write"]);
25
+ const PLAN_MANAGED_TOOLS = new Set<string>([...PLAN_MODE_TOOLS, ...NORMAL_MODE_TOOLS]);
26
+
27
+ interface PlanModeState {
28
+ enabled: boolean;
29
+ todos?: TodoItem[];
30
+ executing?: boolean;
31
+ toolsBeforePlanMode?: string[];
32
+ }
24
33
 
25
34
  // Type guard for assistant messages
26
35
  function isAssistantMessage(m: AgentMessage): m is AssistantMessage {
@@ -39,6 +48,7 @@ export default function planModeExtension(pi: ExtensionAPI): void {
39
48
  let planModeEnabled = false;
40
49
  let executionMode = false;
41
50
  let todoItems: TodoItem[] = [];
51
+ let toolsBeforePlanMode: string[] | undefined;
42
52
 
43
53
  pi.registerFlag("plan", {
44
54
  description: "Start in plan mode (read-only exploration)",
@@ -73,19 +83,34 @@ export default function planModeExtension(pi: ExtensionAPI): void {
73
83
  }
74
84
  }
75
85
 
76
- function togglePlanMode(ctx: ExtensionContext): void {
77
- planModeEnabled = !planModeEnabled;
78
- executionMode = false;
79
- todoItems = [];
86
+ function uniqueToolNames(toolNames: string[]): string[] {
87
+ return [...new Set(toolNames)];
88
+ }
80
89
 
81
- if (planModeEnabled) {
82
- pi.setActiveTools(PLAN_MODE_TOOLS);
83
- ctx.ui.notify(`Plan mode enabled. Tools: ${PLAN_MODE_TOOLS.join(", ")}`);
84
- } else {
85
- pi.setActiveTools(NORMAL_MODE_TOOLS);
86
- ctx.ui.notify("Plan mode disabled. Full access restored.");
90
+ function getPlanModeTools(activeToolNames: string[]): string[] {
91
+ return uniqueToolNames([
92
+ ...activeToolNames.filter((name) => !PLAN_MODE_DISABLED_TOOLS.has(name)),
93
+ ...PLAN_MODE_TOOLS,
94
+ ]);
95
+ }
96
+
97
+ function getNormalModeTools(activeToolNames: string[]): string[] {
98
+ return uniqueToolNames([
99
+ ...NORMAL_MODE_TOOLS,
100
+ ...activeToolNames.filter((name) => !PLAN_MANAGED_TOOLS.has(name)),
101
+ ]);
102
+ }
103
+
104
+ function enablePlanModeTools(): void {
105
+ if (toolsBeforePlanMode === undefined) {
106
+ toolsBeforePlanMode = pi.getActiveTools();
87
107
  }
88
- updateStatus(ctx);
108
+ pi.setActiveTools(getPlanModeTools(toolsBeforePlanMode));
109
+ }
110
+
111
+ function restoreNormalModeTools(): void {
112
+ pi.setActiveTools(toolsBeforePlanMode ?? getNormalModeTools(pi.getActiveTools()));
113
+ toolsBeforePlanMode = undefined;
89
114
  }
90
115
 
91
116
  function persistState(): void {
@@ -93,9 +118,26 @@ export default function planModeExtension(pi: ExtensionAPI): void {
93
118
  enabled: planModeEnabled,
94
119
  todos: todoItems,
95
120
  executing: executionMode,
121
+ toolsBeforePlanMode,
96
122
  });
97
123
  }
98
124
 
125
+ function togglePlanMode(ctx: ExtensionContext): void {
126
+ planModeEnabled = !planModeEnabled;
127
+ executionMode = false;
128
+ todoItems = [];
129
+
130
+ if (planModeEnabled) {
131
+ enablePlanModeTools();
132
+ ctx.ui.notify("Plan mode enabled. Built-in write tools disabled.");
133
+ } else {
134
+ restoreNormalModeTools();
135
+ ctx.ui.notify("Plan mode disabled. Full access restored.");
136
+ }
137
+ updateStatus(ctx);
138
+ persistState();
139
+ }
140
+
99
141
  pi.registerCommand("plan", {
100
142
  description: "Toggle plan mode (read-only exploration)",
101
143
  handler: async (_args, ctx) => togglePlanMode(ctx),
@@ -165,8 +207,8 @@ export default function planModeExtension(pi: ExtensionAPI): void {
165
207
  You are in plan mode - a read-only exploration mode for safe code analysis.
166
208
 
167
209
  Restrictions:
168
- - You can only use: read, bash, grep, find, ls, questionnaire
169
- - You CANNOT use: edit, write (file modifications are disabled)
210
+ - Built-in edit and write tools are disabled
211
+ - Other currently active tools remain available
170
212
  - Bash is restricted to an allowlist of read-only commands
171
213
 
172
214
  Ask clarifying questions using the questionnaire tool.
@@ -228,7 +270,6 @@ After completing a step, include a [DONE:n] tag in your response.`,
228
270
  );
229
271
  executionMode = false;
230
272
  todoItems = [];
231
- pi.setActiveTools(NORMAL_MODE_TOOLS);
232
273
  updateStatus(ctx);
233
274
  persistState(); // Save cleared state so resume doesn't restore old execution mode
234
275
  }
@@ -246,43 +287,51 @@ After completing a step, include a [DONE:n] tag in your response.`,
246
287
  }
247
288
  }
248
289
 
290
+ if (todoItems.length === 0) return;
291
+ persistState();
292
+
249
293
  // Show plan steps and prompt for next action
250
- if (todoItems.length > 0) {
251
- const todoListText = todoItems.map((t, i) => `${i + 1}. ☐ ${t.text}`).join("\n");
252
- pi.sendMessage(
253
- {
254
- customType: "plan-todo-list",
255
- content: `**Plan Steps (${todoItems.length}):**\n\n${todoListText}`,
256
- display: true,
257
- },
258
- { triggerTurn: false },
259
- );
260
- }
294
+ const todoListText = todoItems.map((t, i) => `${i + 1}. ☐ ${t.text}`).join("\n");
295
+ const planTodoListMessage = {
296
+ customType: "plan-todo-list",
297
+ content: `**Plan Steps (${todoItems.length}):**\n\n${todoListText}`,
298
+ display: true,
299
+ };
261
300
 
262
301
  const choice = await ctx.ui.select("Plan mode - what next?", [
263
- todoItems.length > 0 ? "Execute the plan (track progress)" : "Execute the plan",
302
+ "Execute the plan (track progress)",
264
303
  "Stay in plan mode",
265
304
  "Refine the plan",
266
305
  ]);
267
306
 
268
307
  if (choice?.startsWith("Execute")) {
308
+ const firstTodoItem = todoItems[0];
309
+ if (!firstTodoItem) return;
310
+
269
311
  planModeEnabled = false;
270
- executionMode = todoItems.length > 0;
271
- pi.setActiveTools(NORMAL_MODE_TOOLS);
312
+ executionMode = true;
313
+ restoreNormalModeTools();
272
314
  updateStatus(ctx);
315
+ persistState();
316
+
317
+ const remainingList = todoItems.map((t) => `${t.step}. ${t.text}`).join("\n");
318
+ const execMessage = `Execute the plan.
319
+
320
+ Remaining steps:
321
+ ${remainingList}
273
322
 
274
- const execMessage =
275
- todoItems.length > 0
276
- ? `Execute the plan. Start with: ${todoItems[0].text}`
277
- : "Execute the plan you just created.";
323
+ Start with: ${firstTodoItem.text}
324
+ After completing a step, include a [DONE:n] tag in your response.`;
325
+ pi.sendMessage(planTodoListMessage, { deliverAs: "followUp" });
278
326
  pi.sendMessage(
279
327
  { customType: "plan-mode-execute", content: execMessage, display: true },
280
- { triggerTurn: true },
328
+ { triggerTurn: true, deliverAs: "followUp" },
281
329
  );
282
330
  } else if (choice === "Refine the plan") {
283
331
  const refinement = await ctx.ui.editor("Refine the plan:", "");
284
332
  if (refinement?.trim()) {
285
- pi.sendUserMessage(refinement.trim());
333
+ pi.sendMessage(planTodoListMessage, { deliverAs: "followUp" });
334
+ pi.sendUserMessage(refinement.trim(), { deliverAs: "followUp" });
286
335
  }
287
336
  }
288
337
  });
@@ -298,12 +347,13 @@ After completing a step, include a [DONE:n] tag in your response.`,
298
347
  // Restore persisted state
299
348
  const planModeEntry = entries
300
349
  .filter((e: { type: string; customType?: string }) => e.type === "custom" && e.customType === "plan-mode")
301
- .pop() as { data?: { enabled: boolean; todos?: TodoItem[]; executing?: boolean } } | undefined;
350
+ .pop() as { data?: PlanModeState } | undefined;
302
351
 
303
352
  if (planModeEntry?.data) {
304
353
  planModeEnabled = planModeEntry.data.enabled ?? planModeEnabled;
305
354
  todoItems = planModeEntry.data.todos ?? todoItems;
306
355
  executionMode = planModeEntry.data.executing ?? executionMode;
356
+ toolsBeforePlanMode = planModeEntry.data.toolsBeforePlanMode ?? toolsBeforePlanMode;
307
357
  }
308
358
 
309
359
  // On resume: re-scan messages to rebuild completion state
@@ -333,7 +383,7 @@ After completing a step, include a [DONE:n] tag in your response.`,
333
383
  }
334
384
 
335
385
  if (planModeEnabled) {
336
- pi.setActiveTools(PLAN_MODE_TOOLS);
386
+ enablePlanModeTools();
337
387
  }
338
388
  updateStatus(ctx);
339
389
  });
@@ -42,7 +42,7 @@ import { existsSync, readFileSync } from "node:fs";
42
42
  import { join } from "node:path";
43
43
  import type { Api, Model } from "@draht/ai";
44
44
  import type { ExtensionAPI, ExtensionContext } from "@draht/coding-agent";
45
- import { DynamicBorder, getAgentDir } from "@draht/coding-agent";
45
+ import { CONFIG_DIR_NAME, DynamicBorder, getAgentDir } from "@draht/coding-agent";
46
46
  import { Container, Key, type SelectItem, SelectList, Text } from "@draht/tui";
47
47
 
48
48
  // Preset configuration
@@ -69,7 +69,7 @@ interface PresetsConfig {
69
69
  */
70
70
  function loadPresets(cwd: string): PresetsConfig {
71
71
  const globalPath = join(getAgentDir(), "presets.json");
72
- const projectPath = join(cwd, ".pi", "presets.json");
72
+ const projectPath = join(cwd, CONFIG_DIR_NAME, "presets.json");
73
73
 
74
74
  let globalPresets: PresetsConfig = {};
75
75
  let projectPresets: PresetsConfig = {};
@@ -200,7 +200,10 @@ export default function presetExtension(pi: ExtensionAPI) {
200
200
  const presetNames = Object.keys(presets);
201
201
 
202
202
  if (presetNames.length === 0) {
203
- ctx.ui.notify("No presets defined. Add presets to ~/.pi/agent/presets.json or .pi/presets.json", "warning");
203
+ ctx.ui.notify(
204
+ `No presets defined. Add presets to ${join(getAgentDir(), "presets.json")} or ${join(ctx.cwd, CONFIG_DIR_NAME, "presets.json")}`,
205
+ "warning",
206
+ );
204
207
  return;
205
208
  }
206
209
 
@@ -308,7 +311,10 @@ export default function presetExtension(pi: ExtensionAPI) {
308
311
  async function cyclePreset(ctx: ExtensionContext): Promise<void> {
309
312
  const presetNames = getPresetOrder();
310
313
  if (presetNames.length === 0) {
311
- ctx.ui.notify("No presets defined. Add presets to ~/.pi/agent/presets.json or .pi/presets.json", "warning");
314
+ ctx.ui.notify(
315
+ `No presets defined. Add presets to ${join(getAgentDir(), "presets.json")} or ${join(ctx.cwd, CONFIG_DIR_NAME, "presets.json")}`,
316
+ "warning",
317
+ );
312
318
  return;
313
319
  }
314
320
 
@@ -1,18 +1,18 @@
1
1
  import { appendFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
- import type { ExtensionAPI } from "@draht/coding-agent";
3
+ import { CONFIG_DIR_NAME, type ExtensionAPI } from "@draht/coding-agent";
4
4
 
5
5
  export default function (pi: ExtensionAPI) {
6
- const logFile = join(process.cwd(), ".pi", "provider-payload.log");
7
-
8
- pi.on("before_provider_request", (event) => {
6
+ pi.on("before_provider_request", (event, ctx) => {
7
+ const logFile = join(ctx.cwd, CONFIG_DIR_NAME, "provider-payload.log");
9
8
  appendFileSync(logFile, `${JSON.stringify(event.payload, null, 2)}\n\n`, "utf8");
10
9
 
11
10
  // Optional: replace the payload instead of only logging it.
12
11
  // return { ...event.payload, temperature: 0 };
13
12
  });
14
13
 
15
- pi.on("after_provider_response", (event) => {
14
+ pi.on("after_provider_response", (event, ctx) => {
15
+ const logFile = join(ctx.cwd, CONFIG_DIR_NAME, "provider-payload.log");
16
16
  appendFileSync(logFile, `[${event.status}] ${JSON.stringify(event.headers)}\n\n`, "utf8");
17
17
  });
18
18
  }
@@ -7,7 +7,7 @@
7
7
  * 3. Loads the result into the editor for user to fill in answers
8
8
  */
9
9
 
10
- import { complete, type UserMessage } from "@draht/ai";
10
+ import { complete, type UserMessage } from "@draht/ai/compat";
11
11
  import type { ExtensionAPI } from "@draht/coding-agent";
12
12
  import { BorderedLoader } from "@draht/coding-agent";
13
13
 
@@ -90,7 +90,7 @@ export default function (pi: ExtensionAPI) {
90
90
  const response = await complete(
91
91
  ctx.model!,
92
92
  { systemPrompt: SYSTEM_PROMPT, messages: [userMessage] },
93
- { apiKey: auth.apiKey, headers: auth.headers, signal: loader.signal },
93
+ { apiKey: auth.apiKey, headers: auth.headers, env: auth.env, signal: loader.signal },
94
94
  );
95
95
 
96
96
  if (response.stopReason === "aborted") {
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import type { ExtensionAPI } from "@draht/coding-agent";
8
- import { Editor, type EditorTheme, Key, matchesKey, Text, truncateToWidth } from "@draht/tui";
8
+ import { Editor, type EditorTheme, Key, matchesKey, Text, visibleWidth, wrapTextWithAnsi } from "@draht/tui";
9
9
  import { Type } from "typebox";
10
10
 
11
11
  interface OptionWithDesc {
@@ -39,6 +39,7 @@ export default function question(pi: ExtensionAPI) {
39
39
  label: "Question",
40
40
  description: "Ask the user a question and let them pick from options. Use when you need user input to proceed.",
41
41
  parameters: QuestionParams,
42
+ executionMode: "sequential",
42
43
 
43
44
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
44
45
  if (ctx.mode !== "tui") {
@@ -139,10 +140,27 @@ export default function question(pi: ExtensionAPI) {
139
140
  if (cachedLines) return cachedLines;
140
141
 
141
142
  const lines: string[] = [];
142
- const add = (s: string) => lines.push(truncateToWidth(s, width));
143
+ const renderWidth = Math.max(1, width);
143
144
 
144
- add(theme.fg("accent", "─".repeat(width)));
145
- add(theme.fg("text", ` ${params.question}`));
145
+ function addWrapped(text: string) {
146
+ lines.push(...wrapTextWithAnsi(text, renderWidth));
147
+ }
148
+
149
+ function addWrappedWithPrefix(prefix: string, text: string) {
150
+ const prefixWidth = visibleWidth(prefix);
151
+ if (prefixWidth >= renderWidth) {
152
+ addWrapped(prefix + text);
153
+ return;
154
+ }
155
+ const wrapped = wrapTextWithAnsi(text, renderWidth - prefixWidth);
156
+ const continuationPrefix = " ".repeat(prefixWidth);
157
+ for (let i = 0; i < wrapped.length; i++) {
158
+ lines.push(`${i === 0 ? prefix : continuationPrefix}${wrapped[i]}`);
159
+ }
160
+ }
161
+
162
+ lines.push(theme.fg("accent", "─".repeat(renderWidth)));
163
+ addWrappedWithPrefix(" ", theme.fg("text", params.question));
146
164
  lines.push("");
147
165
 
148
166
  for (let i = 0; i < allOptions.length; i++) {
@@ -150,36 +168,32 @@ export default function question(pi: ExtensionAPI) {
150
168
  const selected = i === optionIndex;
151
169
  const isOther = opt.isOther === true;
152
170
  const prefix = selected ? theme.fg("accent", "> ") : " ";
171
+ const label = `${i + 1}. ${opt.label}${isOther && editMode ? " ✎" : ""}`;
172
+ const color = selected || (isOther && editMode) ? "accent" : "text";
153
173
 
154
- if (isOther && editMode) {
155
- add(prefix + theme.fg("accent", `${i + 1}. ${opt.label} ✎`));
156
- } else if (selected) {
157
- add(prefix + theme.fg("accent", `${i + 1}. ${opt.label}`));
158
- } else {
159
- add(` ${theme.fg("text", `${i + 1}. ${opt.label}`)}`);
160
- }
174
+ addWrappedWithPrefix(prefix, theme.fg(color, label));
161
175
 
162
176
  // Show description if present
163
177
  if (opt.description) {
164
- add(` ${theme.fg("muted", opt.description)}`);
178
+ addWrappedWithPrefix(" ", theme.fg("muted", opt.description));
165
179
  }
166
180
  }
167
181
 
168
182
  if (editMode) {
169
183
  lines.push("");
170
- add(theme.fg("muted", " Your answer:"));
171
- for (const line of editor.render(width - 2)) {
172
- add(` ${line}`);
184
+ addWrappedWithPrefix(" ", theme.fg("muted", "Your answer:"));
185
+ for (const line of editor.render(Math.max(1, renderWidth - 2))) {
186
+ lines.push(` ${line}`);
173
187
  }
174
188
  }
175
189
 
176
190
  lines.push("");
177
191
  if (editMode) {
178
- add(theme.fg("dim", " Enter to submit • Esc to go back"));
192
+ addWrappedWithPrefix(" ", theme.fg("dim", "Enter to submit • Esc to go back"));
179
193
  } else {
180
- add(theme.fg("dim", " ↑↓ navigate • Enter to select • Esc to cancel"));
194
+ addWrappedWithPrefix(" ", theme.fg("dim", "↑↓ navigate • Enter to select • Esc to cancel"));
181
195
  }
182
- add(theme.fg("accent", "─".repeat(width)));
196
+ lines.push(theme.fg("accent", "─".repeat(renderWidth)));
183
197
 
184
198
  cachedLines = lines;
185
199
  return lines;
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { ExtensionAPI } from "@draht/coding-agent";
9
- import { Editor, type EditorTheme, Key, matchesKey, Text, truncateToWidth } from "@draht/tui";
9
+ import { Editor, type EditorTheme, Key, matchesKey, Text, visibleWidth, wrapTextWithAnsi } from "@draht/tui";
10
10
  import { Type } from "typebox";
11
11
 
12
12
  // Types
@@ -259,13 +259,28 @@ export default function questionnaire(pi: ExtensionAPI) {
259
259
  if (cachedLines) return cachedLines;
260
260
 
261
261
  const lines: string[] = [];
262
+ const renderWidth = Math.max(1, width);
262
263
  const q = currentQuestion();
263
264
  const opts = currentOptions();
264
265
 
265
- // Helper to add truncated line
266
- const add = (s: string) => lines.push(truncateToWidth(s, width));
266
+ function addWrapped(text: string) {
267
+ lines.push(...wrapTextWithAnsi(text, renderWidth));
268
+ }
269
+
270
+ function addWrappedWithPrefix(prefix: string, text: string) {
271
+ const prefixWidth = visibleWidth(prefix);
272
+ if (prefixWidth >= renderWidth) {
273
+ addWrapped(prefix + text);
274
+ return;
275
+ }
276
+ const wrapped = wrapTextWithAnsi(text, renderWidth - prefixWidth);
277
+ const continuationPrefix = " ".repeat(prefixWidth);
278
+ for (let i = 0; i < wrapped.length; i++) {
279
+ lines.push(`${i === 0 ? prefix : continuationPrefix}${wrapped[i]}`);
280
+ }
281
+ }
267
282
 
268
- add(theme.fg("accent", "─".repeat(width)));
283
+ lines.push(theme.fg("accent", "─".repeat(renderWidth)));
269
284
 
270
285
  // Tab bar (multi-question only)
271
286
  if (isMulti) {
@@ -287,7 +302,7 @@ export default function questionnaire(pi: ExtensionAPI) {
287
302
  ? theme.bg("selectedBg", theme.fg("text", submitText))
288
303
  : theme.fg(canSubmit ? "success" : "dim", submitText);
289
304
  tabs.push(`${submitStyled} →`);
290
- add(` ${tabs.join("")}`);
305
+ addWrappedWithPrefix(" ", tabs.join(""));
291
306
  lines.push("");
292
307
  }
293
308
 
@@ -298,54 +313,52 @@ export default function questionnaire(pi: ExtensionAPI) {
298
313
  const selected = i === optionIndex;
299
314
  const isOther = opt.isOther === true;
300
315
  const prefix = selected ? theme.fg("accent", "> ") : " ";
301
- const color = selected ? "accent" : "text";
302
- // Mark "Type something" differently when in input mode
303
- if (isOther && inputMode) {
304
- add(prefix + theme.fg("accent", `${i + 1}. ${opt.label} ✎`));
305
- } else {
306
- add(prefix + theme.fg(color, `${i + 1}. ${opt.label}`));
307
- }
316
+ const label = `${i + 1}. ${opt.label}${isOther && inputMode ? " ✎" : ""}`;
317
+ const color = selected || (isOther && inputMode) ? "accent" : "text";
318
+
319
+ addWrappedWithPrefix(prefix, theme.fg(color, label));
308
320
  if (opt.description) {
309
- add(` ${theme.fg("muted", opt.description)}`);
321
+ addWrappedWithPrefix(" ", theme.fg("muted", opt.description));
310
322
  }
311
323
  }
312
324
  }
313
325
 
314
326
  // Content
315
327
  if (inputMode && q) {
316
- add(theme.fg("text", ` ${q.prompt}`));
328
+ addWrappedWithPrefix(" ", theme.fg("text", q.prompt));
317
329
  lines.push("");
318
330
  // Show options for reference
319
331
  renderOptions();
320
332
  lines.push("");
321
- add(theme.fg("muted", " Your answer:"));
322
- for (const line of editor.render(width - 2)) {
323
- add(` ${line}`);
333
+ addWrappedWithPrefix(" ", theme.fg("muted", "Your answer:"));
334
+ for (const line of editor.render(Math.max(1, renderWidth - 2))) {
335
+ lines.push(` ${line}`);
324
336
  }
325
337
  lines.push("");
326
- add(theme.fg("dim", " Enter to submit • Esc to cancel"));
338
+ addWrappedWithPrefix(" ", theme.fg("dim", "Enter to submit • Esc to cancel"));
327
339
  } else if (currentTab === questions.length) {
328
- add(theme.fg("accent", theme.bold(" Ready to submit")));
340
+ addWrappedWithPrefix(" ", theme.fg("accent", theme.bold("Ready to submit")));
329
341
  lines.push("");
330
342
  for (const question of questions) {
331
343
  const answer = answers.get(question.id);
332
344
  if (answer) {
333
345
  const prefix = answer.wasCustom ? "(wrote) " : "";
334
- add(`${theme.fg("muted", ` ${question.label}: `)}${theme.fg("text", prefix + answer.label)}`);
346
+ const summary = `${theme.fg("muted", `${question.label}: `)}${theme.fg("text", prefix + answer.label)}`;
347
+ addWrappedWithPrefix(" ", summary);
335
348
  }
336
349
  }
337
350
  lines.push("");
338
351
  if (allAnswered()) {
339
- add(theme.fg("success", " Press Enter to submit"));
352
+ addWrappedWithPrefix(" ", theme.fg("success", "Press Enter to submit"));
340
353
  } else {
341
354
  const missing = questions
342
355
  .filter((q) => !answers.has(q.id))
343
356
  .map((q) => q.label)
344
357
  .join(", ");
345
- add(theme.fg("warning", ` Unanswered: ${missing}`));
358
+ addWrappedWithPrefix(" ", theme.fg("warning", `Unanswered: ${missing}`));
346
359
  }
347
360
  } else if (q) {
348
- add(theme.fg("text", ` ${q.prompt}`));
361
+ addWrappedWithPrefix(" ", theme.fg("text", q.prompt));
349
362
  lines.push("");
350
363
  renderOptions();
351
364
  }
@@ -353,11 +366,11 @@ export default function questionnaire(pi: ExtensionAPI) {
353
366
  lines.push("");
354
367
  if (!inputMode) {
355
368
  const help = isMulti
356
- ? " Tab/←→ navigate • ↑↓ select • Enter confirm • Esc cancel"
357
- : " ↑↓ navigate • Enter select • Esc cancel";
358
- add(theme.fg("dim", help));
369
+ ? "Tab/←→ navigate • ↑↓ select • Enter confirm • Esc cancel"
370
+ : "↑↓ navigate • Enter select • Esc cancel";
371
+ addWrappedWithPrefix(" ", theme.fg("dim", help));
359
372
  }
360
- add(theme.fg("accent", "─".repeat(width)));
373
+ lines.push(theme.fg("accent", "─".repeat(renderWidth)));
361
374
 
362
375
  cachedLines = lines;
363
376
  return lines;
@@ -400,7 +413,7 @@ export default function questionnaire(pi: ExtensionAPI) {
400
413
  let text = theme.fg("toolTitle", theme.bold("questionnaire "));
401
414
  text += theme.fg("muted", `${count} question${count !== 1 ? "s" : ""}`);
402
415
  if (labels) {
403
- text += theme.fg("dim", ` (${truncateToWidth(labels, 40)})`);
416
+ text += theme.fg("dim", ` (${labels})`);
404
417
  }
405
418
  return new Text(text, 0, 0);
406
419
  },
@@ -46,7 +46,7 @@ import { existsSync, readFileSync } from "node:fs";
46
46
  import { join } from "node:path";
47
47
  import { SandboxManager, type SandboxRuntimeConfig } from "@anthropic-ai/sandbox-runtime";
48
48
  import type { ExtensionAPI } from "@draht/coding-agent";
49
- import { type BashOperations, createBashTool, getAgentDir } from "@draht/coding-agent";
49
+ import { type BashOperations, CONFIG_DIR_NAME, createBashTool, getAgentDir } from "@draht/coding-agent";
50
50
 
51
51
  interface SandboxConfig extends SandboxRuntimeConfig {
52
52
  enabled?: boolean;
@@ -77,7 +77,7 @@ const DEFAULT_CONFIG: SandboxConfig = {
77
77
  };
78
78
 
79
79
  function loadConfig(cwd: string): SandboxConfig {
80
- const projectConfigPath = join(cwd, ".pi", "sandbox.json");
80
+ const projectConfigPath = join(cwd, CONFIG_DIR_NAME, "sandbox.json");
81
81
  const globalConfigPath = join(getAgentDir(), "extensions", "sandbox.json");
82
82
 
83
83
  let globalConfig: Partial<SandboxConfig> = {};
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
- "version": "1.9.1",
3
+ "version": "1.10.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-sandbox",
9
- "version": "1.9.1",
9
+ "version": "1.10.3",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sandbox-runtime": "^0.0.26"
12
12
  }