@averyyy/pi-coding-agent 1.3.0-piclient.5 → 1.4.0-piclient.10

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 (193) hide show
  1. package/CHANGELOG.md +61 -1
  2. package/dist/bundle/chunks/anthropic-messages-3TZAX2CL.js +6 -0
  3. package/dist/bundle/chunks/azure-openai-responses-5OV6AS44.js +2 -0
  4. package/dist/bundle/chunks/bedrock-converse-stream.js +8 -8
  5. package/dist/bundle/chunks/{chunk-27EJF7XV.js → chunk-3EGEEHMN.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-VBIW3SGN.js → chunk-3LTMO2WY.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-PYGXRV27.js → chunk-3V45WARH.js} +1 -1
  8. package/dist/bundle/chunks/{chunk-S3GGRYIO.js → chunk-5AGIVGSV.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-F5ZABL6Z.js → chunk-7CBJINYJ.js} +2 -2
  10. package/dist/bundle/chunks/{chunk-DRQDKNXA.js → chunk-7DDKXS2Q.js} +1 -1
  11. package/dist/bundle/chunks/{chunk-JBOKZR45.js → chunk-BRYV63PL.js} +2 -2
  12. package/dist/bundle/chunks/{chunk-H3QXYIF7.js → chunk-CF5GWZHW.js} +1 -1
  13. package/dist/bundle/chunks/chunk-D3OXAPLU.js +11 -0
  14. package/dist/bundle/chunks/{chunk-WALKIYXG.js → chunk-GA3MDGH3.js} +1 -1
  15. package/dist/bundle/chunks/chunk-H2AI7MFJ.js +9 -0
  16. package/dist/bundle/chunks/{chunk-XDNB4NV2.js → chunk-H2UJDH5M.js} +10 -9
  17. package/dist/bundle/chunks/chunk-H76KZMOI.js +2 -0
  18. package/dist/bundle/chunks/chunk-HZG4C6GI.js +2 -0
  19. package/dist/bundle/chunks/{chunk-WEGEKOLF.js → chunk-J5XSJ6CW.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-4L3WN2XY.js → chunk-JXWJOIH4.js} +1 -1
  21. package/dist/bundle/chunks/{chunk-6CYCI3EJ.js → chunk-LVVZS2NO.js} +1 -1
  22. package/dist/bundle/chunks/{chunk-A5PVA2BG.js → chunk-MKWEYCNF.js} +4 -3
  23. package/dist/bundle/chunks/{chunk-PT5WCDHM.js → chunk-PG7P2LUM.js} +2 -2
  24. package/dist/bundle/chunks/chunk-TLSZ4DWU.js +16 -0
  25. package/dist/bundle/chunks/{chunk-ZBURYEWF.js → chunk-TMTOQ7H7.js} +1 -1
  26. package/dist/bundle/chunks/{chunk-22CYIUS4.js → chunk-UKVNB6C4.js} +1 -1
  27. package/dist/bundle/chunks/{chunk-6AK3I2ZG.js → chunk-UZLVOWHH.js} +44 -40
  28. package/dist/bundle/chunks/chunk-VHUVVKJM.js +2 -0
  29. package/dist/bundle/chunks/{chunk-32OQRHU5.js → chunk-VYYRESZJ.js} +1 -1
  30. package/dist/bundle/chunks/chunk-WVXVPMMO.js +2 -0
  31. package/dist/bundle/chunks/{cli-C7ZYV7NI.js → cli-QUNA6INU.js} +1 -1
  32. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-QIIM6OB4.js +2 -0
  33. package/dist/bundle/chunks/{easter-egg-3d-JPU5ICBY.js → easter-egg-3d-4L2AVJKX.js} +1 -1
  34. package/dist/bundle/chunks/{execute-ZWI524ZI.js → execute-UNST3ORJ.js} +9 -3
  35. package/dist/bundle/chunks/google-antigravity-runtime.js +8 -7
  36. package/dist/bundle/chunks/google-generative-ai-PNRT4EAN.js +2 -0
  37. package/dist/bundle/chunks/google-vertex-ZLSXUSEM.js +2 -0
  38. package/dist/bundle/chunks/{https-proxy-agent-UDEHOBGS.js → https-proxy-agent-LVOO5TPL.js} +1 -1
  39. package/dist/bundle/chunks/{jiti-loader-C3NU2SDH.js → jiti-loader-GL4HJFAD.js} +1 -1
  40. package/dist/bundle/chunks/{jiti-static-loader-E6ANQD5T.js → jiti-static-loader-2RCDI6B4.js} +1 -1
  41. package/dist/bundle/chunks/{lib-TEDK3E5I.js → lib-4AVRLBHM.js} +1 -1
  42. package/dist/bundle/chunks/{llama-cpp-classify-FYN623RH.js → llama-cpp-classify-U4EH6TAM.js} +2 -2
  43. package/dist/bundle/chunks/{mistral-conversations-IDNVOMLP.js → mistral-conversations-OJFHLO4F.js} +1 -1
  44. package/dist/bundle/chunks/{multipart-parser-SQ6GDJL7.js → multipart-parser-FMGQ7342.js} +1 -1
  45. package/dist/bundle/chunks/{node-TWVVAGPO.js → node-AUOGOBCN.js} +1 -1
  46. package/dist/bundle/chunks/{node-N5BSDOA5.js → node-KCMANYC2.js} +1 -1
  47. package/dist/bundle/chunks/openai-codex-responses-UIB63WGM.js +10 -0
  48. package/dist/bundle/chunks/openai-completions-T5JB7LUM.js +7 -0
  49. package/dist/bundle/chunks/{openai-decisions-CWANEVXX.js → openai-decisions-Q46R33J3.js} +1 -1
  50. package/dist/bundle/chunks/openai-responses-FGTD6NDJ.js +4 -0
  51. package/dist/bundle/chunks/openrouter-images-WBAVKHHY.js +2 -0
  52. package/dist/bundle/chunks/pi-messages-S7RKCD5K.js +8 -0
  53. package/dist/bundle/chunks/{runtime-RTNZQVM5.js → runtime-SITSZTHV.js} +1 -1
  54. package/dist/bundle/chunks/{src-UK77SYZE.js → src-QKGKDFSU.js} +1 -1
  55. package/dist/bundle/chunks/typesafe-system-one-DFEHTLK5.js +2 -0
  56. package/dist/bundle/chunks/virtual-modules-G5A4RNVO.js +2 -0
  57. package/dist/bundle/cli-runtime.js +1 -1
  58. package/dist/bundle/index.js +1 -1
  59. package/dist/bundle/rpc-entry.js +1 -1
  60. package/dist/core/agent-session.d.ts +5 -1
  61. package/dist/core/agent-session.d.ts.map +1 -1
  62. package/dist/core/agent-session.js +42 -13
  63. package/dist/core/agent-session.js.map +1 -1
  64. package/dist/core/client-identity.d.ts +8 -0
  65. package/dist/core/client-identity.d.ts.map +1 -0
  66. package/dist/core/client-identity.js +15 -0
  67. package/dist/core/client-identity.js.map +1 -0
  68. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  69. package/dist/core/compaction/branch-summarization.js +2 -3
  70. package/dist/core/compaction/branch-summarization.js.map +1 -1
  71. package/dist/core/compaction/compaction.d.ts +3 -3
  72. package/dist/core/compaction/compaction.d.ts.map +1 -1
  73. package/dist/core/compaction/compaction.js +35 -30
  74. package/dist/core/compaction/compaction.js.map +1 -1
  75. package/dist/core/export-html/index.d.ts.map +1 -1
  76. package/dist/core/export-html/index.js +2 -0
  77. package/dist/core/export-html/index.js.map +1 -1
  78. package/dist/core/export-html/template.html +1 -0
  79. package/dist/core/export-html/template.js +2 -1
  80. package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  81. package/dist/core/export-html/vendor/marked.min.js +30 -29
  82. package/dist/core/extensions/loader.d.ts.map +1 -1
  83. package/dist/core/extensions/loader.js +3 -0
  84. package/dist/core/extensions/loader.js.map +1 -1
  85. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  86. package/dist/core/extensions/virtual-modules.js +3 -0
  87. package/dist/core/extensions/virtual-modules.js.map +1 -1
  88. package/dist/core/model-config.d.ts +915 -0
  89. package/dist/core/model-config.d.ts.map +1 -1
  90. package/dist/core/model-config.js +48 -24
  91. package/dist/core/model-config.js.map +1 -1
  92. package/dist/core/model-resolver.js +2 -2
  93. package/dist/core/model-resolver.js.map +1 -1
  94. package/dist/core/model-runtime.d.ts.map +1 -1
  95. package/dist/core/model-runtime.js +6 -3
  96. package/dist/core/model-runtime.js.map +1 -1
  97. package/dist/core/package-manager.js +2 -2
  98. package/dist/core/package-manager.js.map +1 -1
  99. package/dist/core/pi-server-client.d.ts.map +1 -1
  100. package/dist/core/pi-server-client.js +4 -1
  101. package/dist/core/pi-server-client.js.map +1 -1
  102. package/dist/core/pi-server-observer.d.ts +7 -1
  103. package/dist/core/pi-server-observer.d.ts.map +1 -1
  104. package/dist/core/pi-server-observer.js +43 -4
  105. package/dist/core/pi-server-observer.js.map +1 -1
  106. package/dist/core/pi-server-subagents.d.ts +26 -0
  107. package/dist/core/pi-server-subagents.d.ts.map +1 -0
  108. package/dist/core/pi-server-subagents.js +112 -0
  109. package/dist/core/pi-server-subagents.js.map +1 -0
  110. package/dist/core/provider-composer.d.ts +2 -1
  111. package/dist/core/provider-composer.d.ts.map +1 -1
  112. package/dist/core/provider-composer.js +7 -3
  113. package/dist/core/provider-composer.js.map +1 -1
  114. package/dist/core/resource-loader.d.ts +2 -0
  115. package/dist/core/resource-loader.d.ts.map +1 -1
  116. package/dist/core/resource-loader.js +3 -0
  117. package/dist/core/resource-loader.js.map +1 -1
  118. package/dist/core/sdk.d.ts.map +1 -1
  119. package/dist/core/sdk.js +15 -10
  120. package/dist/core/sdk.js.map +1 -1
  121. package/dist/core/tools/grep.d.ts.map +1 -1
  122. package/dist/core/tools/grep.js +3 -1
  123. package/dist/core/tools/grep.js.map +1 -1
  124. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  125. package/dist/extensions/codemode/execute.js +99 -24
  126. package/dist/extensions/codemode/execute.js.map +1 -1
  127. package/dist/extensions/mcp/config.d.ts.map +1 -1
  128. package/dist/extensions/mcp/config.js +3 -2
  129. package/dist/extensions/mcp/config.js.map +1 -1
  130. package/dist/modes/interactive/interactive-mode.d.ts +11 -15
  131. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  132. package/dist/modes/interactive/interactive-mode.js +73 -115
  133. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  134. package/dist/package-manager-cli.d.ts.map +1 -1
  135. package/dist/package-manager-cli.js +2 -1
  136. package/dist/package-manager-cli.js.map +1 -1
  137. package/dist/utils/clipboard-command.d.ts.map +1 -1
  138. package/dist/utils/clipboard-command.js +3 -0
  139. package/dist/utils/clipboard-command.js.map +1 -1
  140. package/dist/utils/pi-user-agent.d.ts +1 -0
  141. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  142. package/dist/utils/pi-user-agent.js +3 -2
  143. package/dist/utils/pi-user-agent.js.map +1 -1
  144. package/dist/utils/shell.d.ts.map +1 -1
  145. package/dist/utils/shell.js +45 -13
  146. package/dist/utils/shell.js.map +1 -1
  147. package/dist/utils/tools-manager.d.ts.map +1 -1
  148. package/dist/utils/tools-manager.js +4 -3
  149. package/dist/utils/tools-manager.js.map +1 -1
  150. package/docs/codemode.md +2 -2
  151. package/docs/compaction.md +3 -3
  152. package/docs/custom-provider.md +53 -1
  153. package/docs/docs.json +4 -0
  154. package/docs/environment-variables.md +1 -0
  155. package/docs/extensions.md +133 -10
  156. package/docs/models-configuration.md +196 -0
  157. package/docs/models.md +21 -5
  158. package/docs/settings.md +1 -1
  159. package/docs/tui.md +70 -0
  160. package/docs/windows.md +16 -2
  161. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  162. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  163. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  164. package/examples/extensions/gondolin/package-lock.json +2 -2
  165. package/examples/extensions/gondolin/package.json +1 -1
  166. package/examples/extensions/sandbox/package-lock.json +2 -2
  167. package/examples/extensions/sandbox/package.json +1 -1
  168. package/examples/extensions/with-deps/package-lock.json +2 -2
  169. package/examples/extensions/with-deps/package.json +1 -1
  170. package/package.json +7 -6
  171. package/schemas/models.schema.json +83 -29
  172. package/dist/bundle/chunks/anthropic-messages-JKZEYO3X.js +0 -6
  173. package/dist/bundle/chunks/azure-openai-responses-CALHHRO4.js +0 -2
  174. package/dist/bundle/chunks/chunk-2TBKESBE.js +0 -2
  175. package/dist/bundle/chunks/chunk-3IAHLZM6.js +0 -2
  176. package/dist/bundle/chunks/chunk-KO7M2ZFM.js +0 -11
  177. package/dist/bundle/chunks/chunk-NAPMJL5U.js +0 -11
  178. package/dist/bundle/chunks/chunk-VZZDG22Y.js +0 -9
  179. package/dist/bundle/chunks/chunk-XIQJS2WK.js +0 -2
  180. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-W3JVUOXV.js +0 -2
  181. package/dist/bundle/chunks/google-generative-ai-4YEPBKDH.js +0 -2
  182. package/dist/bundle/chunks/google-vertex-5HD3H47T.js +0 -2
  183. package/dist/bundle/chunks/openai-codex-responses-TWAB375R.js +0 -10
  184. package/dist/bundle/chunks/openai-completions-3LCSEI2J.js +0 -7
  185. package/dist/bundle/chunks/openai-responses-JEQACBMR.js +0 -3
  186. package/dist/bundle/chunks/openrouter-images-DUPG5DZO.js +0 -2
  187. package/dist/bundle/chunks/pi-messages-V27DSLVC.js +0 -8
  188. package/dist/bundle/chunks/typesafe-system-one-JJVDHYHL.js +0 -2
  189. package/dist/bundle/chunks/virtual-modules-2YGWEC7J.js +0 -2
  190. package/dist/core/provider-attribution.d.ts +0 -4
  191. package/dist/core/provider-attribution.d.ts.map +0 -1
  192. package/dist/core/provider-attribution.js +0 -72
  193. package/dist/core/provider-attribution.js.map +0 -1
@@ -325,9 +325,9 @@ export class InteractiveMode {
325
325
  bugReportHintShown = false;
326
326
  installChangeWarningShown = false;
327
327
  // Extension UI state
328
- extensionSelector = undefined;
329
- extensionInput = undefined;
330
- extensionEditor = undefined;
328
+ // Extension dialogs shown in the editor slot (select, confirm, input, editor, inline custom).
329
+ // The last entry is visible; see pushExtensionDialog().
330
+ extensionDialogs = [];
331
331
  extensionTerminalInputSubscriptions = new Set();
332
332
  // Extension widgets (components rendered above/below the editor)
333
333
  extensionWidgetsAbove = new Map();
@@ -1061,13 +1061,12 @@ export class InteractiveMode {
1061
1061
  // Extension System
1062
1062
  // =========================================================================
1063
1063
  formatDisplayPath(p) {
1064
- const home = os.homedir();
1065
- let result = p;
1066
- // Replace home directory with ~
1067
- if (result.startsWith(home)) {
1068
- result = `~${result.slice(home.length)}`;
1064
+ const home = os.homedir().replace(/\\/g, "/").replace(/\/$/, "");
1065
+ const normalizedPath = p.replace(/\\/g, "/");
1066
+ if (normalizedPath === home || normalizedPath.startsWith(`${home}/`)) {
1067
+ return `~${normalizedPath.slice(home.length)}`;
1069
1068
  }
1070
- return result;
1069
+ return p;
1071
1070
  }
1072
1071
  formatExtensionDisplayPath(path) {
1073
1072
  let result = this.formatDisplayPath(path);
@@ -1981,14 +1980,12 @@ export class InteractiveMode {
1981
1980
  this.renderWidgets();
1982
1981
  }
1983
1982
  resetExtensionUI() {
1984
- if (this.extensionSelector) {
1985
- this.hideExtensionSelector();
1986
- }
1987
- if (this.extensionInput) {
1988
- this.hideExtensionInput();
1989
- }
1990
- if (this.extensionEditor) {
1991
- this.hideExtensionEditor();
1983
+ if (this.extensionDialogs.length > 0) {
1984
+ for (const dialog of this.extensionDialogs) {
1985
+ dialog.component.dispose?.();
1986
+ }
1987
+ this.extensionDialogs = [];
1988
+ this.showTopExtensionDialog();
1992
1989
  }
1993
1990
  this.ui.hideOverlay();
1994
1991
  this.clearExtensionTerminalInputListeners();
@@ -2205,6 +2202,35 @@ export class InteractiveMode {
2205
2202
  setToolsExpanded: (expanded) => this.setToolsExpanded(expanded),
2206
2203
  };
2207
2204
  }
2205
+ /**
2206
+ * Show an extension dialog in the editor slot.
2207
+ * Dialogs form a stack: a new dialog hides the visible one, and closing the visible dialog shows
2208
+ * the previous one again. Every dialog stays answerable, so no dialog promise is left pending,
2209
+ * and dialogs opened from inside another dialog (for example a confirm from a custom component) work.
2210
+ */
2211
+ pushExtensionDialog(component, blocked) {
2212
+ this.disposeActiveSelector();
2213
+ this.extensionDialogs.push({ component, blocked });
2214
+ this.showTopExtensionDialog();
2215
+ }
2216
+ /** Remove an extension dialog. If it was visible, show the previous dialog or the editor. */
2217
+ removeExtensionDialog(component) {
2218
+ const index = this.extensionDialogs.findIndex((dialog) => dialog.component === component);
2219
+ if (index === -1)
2220
+ return;
2221
+ this.extensionDialogs.splice(index, 1);
2222
+ if (index === this.extensionDialogs.length)
2223
+ this.showTopExtensionDialog();
2224
+ }
2225
+ showTopExtensionDialog() {
2226
+ const top = this.extensionDialogs.at(-1);
2227
+ const component = top?.component ?? this.editor;
2228
+ this.editorContainer.clear();
2229
+ this.editorContainer.addChild(component);
2230
+ this.ui.setFocus(component);
2231
+ this.programStatus.setBlocked("extension-dialog", top?.blocked);
2232
+ this.ui.requestRender();
2233
+ }
2208
2234
  /**
2209
2235
  * Show a selector for extensions.
2210
2236
  */
@@ -2214,41 +2240,18 @@ export class InteractiveMode {
2214
2240
  resolve(undefined);
2215
2241
  return;
2216
2242
  }
2217
- const onAbort = () => {
2218
- this.hideExtensionSelector();
2219
- resolve(undefined);
2220
- };
2221
- opts?.signal?.addEventListener("abort", onAbort, { once: true });
2222
- this.extensionSelector = new ExtensionSelectorComponent(title, options, (option) => {
2243
+ const finish = (option) => {
2223
2244
  opts?.signal?.removeEventListener("abort", onAbort);
2224
- this.hideExtensionSelector();
2245
+ selector.dispose();
2246
+ this.removeExtensionDialog(selector);
2225
2247
  resolve(option);
2226
- }, () => {
2227
- opts?.signal?.removeEventListener("abort", onAbort);
2228
- this.hideExtensionSelector();
2229
- resolve(undefined);
2230
- }, { tui: this.ui, timeout: opts?.timeout, onToggleToolsExpanded: () => this.toggleToolOutputExpansion() });
2231
- this.disposeActiveSelector();
2232
- this.editorContainer.clear();
2233
- this.editorContainer.addChild(this.extensionSelector);
2234
- this.ui.setFocus(this.extensionSelector);
2235
- // Extension dialogs share the editor slot: opening one replaces the status of a displaced one.
2236
- this.programStatus.setBlocked("extension-dialog", blocked);
2237
- this.ui.requestRender();
2248
+ };
2249
+ const onAbort = () => finish(undefined);
2250
+ opts?.signal?.addEventListener("abort", onAbort, { once: true });
2251
+ const selector = new ExtensionSelectorComponent(title, options, (option) => finish(option), () => finish(undefined), { tui: this.ui, timeout: opts?.timeout, onToggleToolsExpanded: () => this.toggleToolOutputExpansion() });
2252
+ this.pushExtensionDialog(selector, blocked);
2238
2253
  });
2239
2254
  }
2240
- /**
2241
- * Hide the extension selector.
2242
- */
2243
- hideExtensionSelector() {
2244
- this.extensionSelector?.dispose();
2245
- this.editorContainer.clear();
2246
- this.editorContainer.addChild(this.editor);
2247
- this.extensionSelector = undefined;
2248
- this.programStatus.setBlocked("extension-dialog", undefined);
2249
- this.ui.setFocus(this.editor);
2250
- this.ui.requestRender();
2251
- }
2252
2255
  /**
2253
2256
  * Show a confirmation dialog for extensions.
2254
2257
  */
@@ -2272,71 +2275,31 @@ export class InteractiveMode {
2272
2275
  resolve(undefined);
2273
2276
  return;
2274
2277
  }
2275
- const onAbort = () => {
2276
- this.hideExtensionInput();
2277
- resolve(undefined);
2278
- };
2279
- opts?.signal?.addEventListener("abort", onAbort, { once: true });
2280
- this.extensionInput = new ExtensionInputComponent(title, placeholder, (value) => {
2278
+ const finish = (value) => {
2281
2279
  opts?.signal?.removeEventListener("abort", onAbort);
2282
- this.hideExtensionInput();
2280
+ input.dispose();
2281
+ this.removeExtensionDialog(input);
2283
2282
  resolve(value);
2284
- }, () => {
2285
- opts?.signal?.removeEventListener("abort", onAbort);
2286
- this.hideExtensionInput();
2287
- resolve(undefined);
2288
- }, { tui: this.ui, timeout: opts?.timeout });
2289
- this.disposeActiveSelector();
2290
- this.editorContainer.clear();
2291
- this.editorContainer.addChild(this.extensionInput);
2292
- this.ui.setFocus(this.extensionInput);
2293
- this.programStatus.setBlocked("extension-dialog", { kind: "question", message: title });
2294
- this.ui.requestRender();
2283
+ };
2284
+ const onAbort = () => finish(undefined);
2285
+ opts?.signal?.addEventListener("abort", onAbort, { once: true });
2286
+ const input = new ExtensionInputComponent(title, placeholder, (value) => finish(value), () => finish(undefined), { tui: this.ui, timeout: opts?.timeout });
2287
+ this.pushExtensionDialog(input, { kind: "question", message: title });
2295
2288
  });
2296
2289
  }
2297
- /**
2298
- * Hide the extension input.
2299
- */
2300
- hideExtensionInput() {
2301
- this.extensionInput?.dispose();
2302
- this.editorContainer.clear();
2303
- this.editorContainer.addChild(this.editor);
2304
- this.extensionInput = undefined;
2305
- this.programStatus.setBlocked("extension-dialog", undefined);
2306
- this.ui.setFocus(this.editor);
2307
- this.ui.requestRender();
2308
- }
2309
2290
  /**
2310
2291
  * Show a multi-line editor for extensions (with Ctrl+G support).
2311
2292
  */
2312
2293
  showExtensionEditor(title, prefill) {
2313
2294
  return new Promise((resolve) => {
2314
- this.extensionEditor = new ExtensionEditorComponent(this.ui, this.keybindings, title, prefill, (value) => {
2315
- this.hideExtensionEditor();
2295
+ const finish = (value) => {
2296
+ this.removeExtensionDialog(editor);
2316
2297
  resolve(value);
2317
- }, () => {
2318
- this.hideExtensionEditor();
2319
- resolve(undefined);
2320
- }, undefined, this.settingsManager.getExternalEditorCommand());
2321
- this.disposeActiveSelector();
2322
- this.editorContainer.clear();
2323
- this.editorContainer.addChild(this.extensionEditor);
2324
- this.ui.setFocus(this.extensionEditor);
2325
- this.programStatus.setBlocked("extension-dialog", { kind: "question", message: title });
2326
- this.ui.requestRender();
2298
+ };
2299
+ const editor = new ExtensionEditorComponent(this.ui, this.keybindings, title, prefill, (value) => finish(value), () => finish(undefined), undefined, this.settingsManager.getExternalEditorCommand());
2300
+ this.pushExtensionDialog(editor, { kind: "question", message: title });
2327
2301
  });
2328
2302
  }
2329
- /**
2330
- * Hide the extension editor.
2331
- */
2332
- hideExtensionEditor() {
2333
- this.editorContainer.clear();
2334
- this.editorContainer.addChild(this.editor);
2335
- this.extensionEditor = undefined;
2336
- this.programStatus.setBlocked("extension-dialog", undefined);
2337
- this.ui.setFocus(this.editor);
2338
- this.ui.requestRender();
2339
- }
2340
2303
  /**
2341
2304
  * Set a custom editor component from an extension.
2342
2305
  * Pass undefined to restore the default editor.
@@ -2426,17 +2389,16 @@ export class InteractiveMode {
2426
2389
  async showExtensionCustom(factory, options) {
2427
2390
  const savedText = this.editor.getText();
2428
2391
  const isOverlay = options?.overlay ?? false;
2429
- const restoreEditor = () => {
2430
- this.editorContainer.clear();
2431
- this.editorContainer.addChild(this.editor);
2432
- this.editor.setText(savedText);
2433
- this.ui.setFocus(this.editor);
2434
- this.ui.requestRender();
2435
- };
2436
2392
  return new Promise((resolve, reject) => {
2437
2393
  let component;
2438
2394
  let overlayHandle;
2439
2395
  let closed = false;
2396
+ const restoreEditor = () => {
2397
+ if (component)
2398
+ this.removeExtensionDialog(component);
2399
+ this.editor.setText(savedText);
2400
+ this.ui.requestRender();
2401
+ };
2440
2402
  const close = (result) => {
2441
2403
  if (closed)
2442
2404
  return;
@@ -2470,19 +2432,15 @@ export class InteractiveMode {
2470
2432
  return opts;
2471
2433
  }
2472
2434
  // Fallback: use component's width property if available
2473
- const w = component.width;
2435
+ const w = c.width;
2474
2436
  return w ? { width: w } : undefined;
2475
2437
  };
2476
- overlayHandle = this.ui.showOverlay(component, resolveOptions());
2438
+ overlayHandle = this.ui.showOverlay(c, resolveOptions());
2477
2439
  // Expose handle to caller for visibility control
2478
2440
  options?.onHandle?.(overlayHandle);
2479
2441
  }
2480
2442
  else {
2481
- this.disposeActiveSelector();
2482
- this.editorContainer.clear();
2483
- this.editorContainer.addChild(component);
2484
- this.ui.setFocus(component);
2485
- this.ui.requestRender();
2443
+ this.pushExtensionDialog(c);
2486
2444
  }
2487
2445
  })
2488
2446
  .catch((err) => {