@astralyn/pi 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/bundle/chunks/anthropic-messages-HWL6AS7T.js +6 -0
- package/dist/bundle/chunks/azure-openai-responses-4YYPDYV5.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +8 -8
- package/dist/bundle/chunks/chunk-24FY4C5S.js +2 -0
- package/dist/bundle/chunks/chunk-6JS2SOFO.js +11 -0
- package/dist/bundle/chunks/chunk-ANCZPKX7.js +2 -0
- package/dist/bundle/chunks/{chunk-VOAXAPU6.js → chunk-BMTEURL3.js} +101 -86
- package/dist/bundle/chunks/chunk-MMNIHCU7.js +2 -0
- package/dist/bundle/chunks/{chunk-KSCGI7JW.js → chunk-MZJC45TM.js} +2 -2
- package/dist/bundle/chunks/{chunk-J75WV3FL.js → chunk-OV2VMHBX.js} +1 -1
- package/dist/bundle/chunks/{chunk-LXR54CGB.js → chunk-TJIPCBZF.js} +1 -1
- package/dist/bundle/chunks/chunk-TPVFPFJP.js +2 -0
- package/dist/bundle/chunks/chunk-ZAIGBRV5.js +16 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-7BKATOEJ.js +2 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-HTUSU45F.js +2 -0
- package/dist/bundle/chunks/google-vertex-AVQV4P76.js +2 -0
- package/dist/bundle/chunks/{llama-cpp-classify-H3IZDR5O.js → llama-cpp-classify-27QYLJZY.js} +2 -2
- package/dist/bundle/chunks/{mistral-conversations-6E6SS3WF.js → mistral-conversations-V2JJTMJ5.js} +1 -1
- package/dist/bundle/chunks/openai-codex-responses-Q25MHDFX.js +10 -0
- package/dist/bundle/chunks/openai-completions-TXZXILJR.js +7 -0
- package/dist/bundle/chunks/{openai-decisions-TVCDIPZX.js → openai-decisions-3WYFPGSK.js} +1 -1
- package/dist/bundle/chunks/openai-responses-E4BNZIQK.js +4 -0
- package/dist/bundle/chunks/openrouter-images-CBP3OPOD.js +2 -0
- package/dist/bundle/chunks/pi-messages-LBJQ4NGP.js +8 -0
- package/dist/bundle/chunks/typesafe-system-one-BNICP2LS.js +2 -0
- package/dist/bundle/chunks/virtual-modules-3CTTTQQN.js +2 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/agent-session.d.ts +7 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +61 -13
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/client-identity.d.ts +8 -0
- package/dist/core/client-identity.d.ts.map +1 -0
- package/dist/core/client-identity.js +15 -0
- package/dist/core/client-identity.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +2 -2
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +20 -15
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +2 -0
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.html +1 -0
- package/dist/core/export-html/template.js +2 -1
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +30 -29
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +3 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +3 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/model-config.d.ts +915 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +48 -24
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.js +7 -7
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +6 -3
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-composer.d.ts +2 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +7 -3
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +9 -10
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/tasks/presentation.d.ts.map +1 -1
- package/dist/core/tasks/presentation.js +3 -1
- package/dist/core/tasks/presentation.js.map +1 -1
- package/dist/core/tasks/reminder.d.ts +15 -0
- package/dist/core/tasks/reminder.d.ts.map +1 -0
- package/dist/core/tasks/reminder.js +54 -0
- package/dist/core/tasks/reminder.js.map +1 -0
- package/dist/core/tasks/runtime.d.ts +4 -1
- package/dist/core/tasks/runtime.d.ts.map +1 -1
- package/dist/core/tasks/runtime.js +37 -11
- package/dist/core/tasks/runtime.js.map +1 -1
- package/dist/core/tasks/session.d.ts +9 -0
- package/dist/core/tasks/session.d.ts.map +1 -1
- package/dist/core/tasks/session.js +24 -0
- package/dist/core/tasks/session.js.map +1 -1
- package/dist/core/tasks/types.d.ts +6 -1
- package/dist/core/tasks/types.d.ts.map +1 -1
- package/dist/core/tasks/types.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +3 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/shell-tool.js +2 -2
- package/dist/core/tools/shell-tool.js.map +1 -1
- package/dist/core/tools/tasks/actions.d.ts +1 -1
- package/dist/core/tools/tasks/actions.d.ts.map +1 -1
- package/dist/core/tools/tasks/actions.js +98 -5
- package/dist/core/tools/tasks/actions.js.map +1 -1
- package/dist/core/tools/tasks/schema.d.ts +1 -1
- package/dist/core/tools/tasks/schema.d.ts.map +1 -1
- package/dist/core/tools/tasks/schema.js +9 -6
- package/dist/core/tools/tasks/schema.js.map +1 -1
- package/dist/core/tools/tasks/types.d.ts +9 -3
- package/dist/core/tools/tasks/types.d.ts.map +1 -1
- package/dist/core/tools/tasks/types.js.map +1 -1
- package/dist/core/tools/tasks.d.ts +1 -1
- package/dist/core/tools/tasks.d.ts.map +1 -1
- package/dist/core/tools/tasks.js +2 -2
- package/dist/core/tools/tasks.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +99 -24
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +3 -2
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +11 -15
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +68 -109
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/tasks/render.d.ts.map +1 -1
- package/dist/modes/interactive/tasks/render.js +17 -9
- package/dist/modes/interactive/tasks/render.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +2 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts.map +1 -1
- package/dist/utils/clipboard-command.js +3 -0
- package/dist/utils/clipboard-command.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts +1 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -1
- package/dist/utils/pi-user-agent.js +3 -2
- package/dist/utils/pi-user-agent.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +45 -13
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +4 -3
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/bundled/tasks.md +17 -7
- package/docs/codemode.md +2 -2
- package/docs/compaction.md +4 -2
- package/docs/custom-provider.md +53 -1
- package/docs/docs.json +4 -0
- package/docs/environment-variables.md +1 -0
- package/docs/extensions.md +98 -3
- package/docs/models-configuration.md +196 -0
- package/docs/models.md +9 -5
- package/docs/sdk.md +2 -2
- package/docs/session-format.md +2 -2
- package/docs/settings.md +2 -2
- package/docs/tui.md +71 -0
- package/docs/windows.md +28 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +150 -137
- package/package.json +7 -6
- package/schemas/models.schema.json +83 -29
- package/dist/bundle/chunks/anthropic-messages-MSB6JBS2.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-ATZ757I2.js +0 -2
- package/dist/bundle/chunks/chunk-4XZYHGVN.js +0 -11
- package/dist/bundle/chunks/chunk-7UBIBLPN.js +0 -2
- package/dist/bundle/chunks/chunk-LUYFHZ6W.js +0 -11
- package/dist/bundle/chunks/chunk-NM2KGRFS.js +0 -2
- package/dist/bundle/chunks/chunk-QDDSFJ35.js +0 -2
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-HGOVFZDC.js +0 -2
- package/dist/bundle/chunks/google-generative-ai-QRLQ4MCJ.js +0 -2
- package/dist/bundle/chunks/google-vertex-L3T6EGTL.js +0 -2
- package/dist/bundle/chunks/openai-codex-responses-4GUO76XJ.js +0 -10
- package/dist/bundle/chunks/openai-completions-O4TKZCIM.js +0 -7
- package/dist/bundle/chunks/openai-responses-VBQKJFNO.js +0 -3
- package/dist/bundle/chunks/openrouter-images-TDLJV5N4.js +0 -2
- package/dist/bundle/chunks/pi-messages-3POWZ43C.js +0 -8
- package/dist/bundle/chunks/typesafe-system-one-LWPJYTJP.js +0 -2
- package/dist/bundle/chunks/virtual-modules-CKPHR6LX.js +0 -2
- package/dist/core/provider-attribution.d.ts +0 -4
- package/dist/core/provider-attribution.d.ts.map +0 -1
- package/dist/core/provider-attribution.js +0 -72
- package/dist/core/provider-attribution.js.map +0 -1
|
@@ -317,9 +317,9 @@ export class InteractiveMode {
|
|
|
317
317
|
this.bugReportHintShown = false;
|
|
318
318
|
this.installChangeWarningShown = false;
|
|
319
319
|
// Extension UI state
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
this.
|
|
320
|
+
// Extension dialogs shown in the editor slot (select, confirm, input, editor, inline custom).
|
|
321
|
+
// The last entry is visible; see pushExtensionDialog().
|
|
322
|
+
this.extensionDialogs = [];
|
|
323
323
|
this.extensionTerminalInputSubscriptions = new Set();
|
|
324
324
|
// Extension widgets (components rendered above/below the editor)
|
|
325
325
|
this.extensionWidgetsAbove = new Map();
|
|
@@ -1848,14 +1848,12 @@ export class InteractiveMode {
|
|
|
1848
1848
|
}
|
|
1849
1849
|
resetExtensionUI() {
|
|
1850
1850
|
this.editorHost.clear();
|
|
1851
|
-
if (this.
|
|
1852
|
-
this.
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
this.
|
|
1856
|
-
|
|
1857
|
-
if (this.extensionEditor) {
|
|
1858
|
-
this.hideExtensionEditor();
|
|
1851
|
+
if (this.extensionDialogs.length > 0) {
|
|
1852
|
+
for (const dialog of this.extensionDialogs) {
|
|
1853
|
+
dialog.component.dispose?.();
|
|
1854
|
+
}
|
|
1855
|
+
this.extensionDialogs = [];
|
|
1856
|
+
this.showTopExtensionDialog();
|
|
1859
1857
|
}
|
|
1860
1858
|
this.ui.hideOverlay();
|
|
1861
1859
|
this.clearExtensionTerminalInputListeners();
|
|
@@ -2056,6 +2054,35 @@ export class InteractiveMode {
|
|
|
2056
2054
|
setToolsExpanded: (expanded) => this.setToolsExpanded(expanded),
|
|
2057
2055
|
};
|
|
2058
2056
|
}
|
|
2057
|
+
/**
|
|
2058
|
+
* Show an extension dialog in the editor slot.
|
|
2059
|
+
* Dialogs form a stack: a new dialog hides the visible one, and closing the visible dialog shows
|
|
2060
|
+
* the previous one again. Every dialog stays answerable, so no dialog promise is left pending,
|
|
2061
|
+
* and dialogs opened from inside another dialog (for example a confirm from a custom component) work.
|
|
2062
|
+
*/
|
|
2063
|
+
pushExtensionDialog(component, blocked) {
|
|
2064
|
+
this.disposeActiveSelector();
|
|
2065
|
+
this.extensionDialogs.push({ component, blocked });
|
|
2066
|
+
this.showTopExtensionDialog();
|
|
2067
|
+
}
|
|
2068
|
+
/** Remove an extension dialog. If it was visible, show the previous dialog or the editor. */
|
|
2069
|
+
removeExtensionDialog(component) {
|
|
2070
|
+
const index = this.extensionDialogs.findIndex((dialog) => dialog.component === component);
|
|
2071
|
+
if (index === -1)
|
|
2072
|
+
return;
|
|
2073
|
+
this.extensionDialogs.splice(index, 1);
|
|
2074
|
+
if (index === this.extensionDialogs.length)
|
|
2075
|
+
this.showTopExtensionDialog();
|
|
2076
|
+
}
|
|
2077
|
+
showTopExtensionDialog() {
|
|
2078
|
+
const top = this.extensionDialogs.at(-1);
|
|
2079
|
+
const component = top?.component ?? this.editor;
|
|
2080
|
+
this.editorContainer.clear();
|
|
2081
|
+
this.editorContainer.addChild(component);
|
|
2082
|
+
this.ui.setFocus(component);
|
|
2083
|
+
this.programStatus.setBlocked("extension-dialog", top?.blocked);
|
|
2084
|
+
this.ui.requestRender();
|
|
2085
|
+
}
|
|
2059
2086
|
/**
|
|
2060
2087
|
* Show a selector for extensions.
|
|
2061
2088
|
*/
|
|
@@ -2065,46 +2092,23 @@ export class InteractiveMode {
|
|
|
2065
2092
|
resolve(undefined);
|
|
2066
2093
|
return;
|
|
2067
2094
|
}
|
|
2068
|
-
const
|
|
2069
|
-
this.hideExtensionSelector();
|
|
2070
|
-
resolve(undefined);
|
|
2071
|
-
};
|
|
2072
|
-
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
2073
|
-
this.extensionSelector = new ExtensionSelectorComponent(title, options, (option) => {
|
|
2095
|
+
const finish = (option) => {
|
|
2074
2096
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
2075
|
-
|
|
2097
|
+
selector.dispose();
|
|
2098
|
+
this.removeExtensionDialog(selector);
|
|
2076
2099
|
resolve(option);
|
|
2077
|
-
}
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
}, {
|
|
2100
|
+
};
|
|
2101
|
+
const onAbort = () => finish(undefined);
|
|
2102
|
+
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
2103
|
+
const selector = new ExtensionSelectorComponent(title, options, (option) => finish(option), () => finish(undefined), {
|
|
2082
2104
|
tui: this.ui,
|
|
2083
2105
|
timeout: opts?.timeout,
|
|
2084
2106
|
description: opts?.description,
|
|
2085
2107
|
onToggleToolsExpanded: () => this.toggleToolOutputExpansion(),
|
|
2086
2108
|
});
|
|
2087
|
-
this.
|
|
2088
|
-
this.editorContainer.clear();
|
|
2089
|
-
this.editorContainer.addChild(this.extensionSelector);
|
|
2090
|
-
this.ui.setFocus(this.extensionSelector);
|
|
2091
|
-
// Extension dialogs share the editor slot: opening one replaces the status of a displaced one.
|
|
2092
|
-
this.programStatus.setBlocked("extension-dialog", blocked);
|
|
2093
|
-
this.ui.requestRender();
|
|
2109
|
+
this.pushExtensionDialog(selector, blocked);
|
|
2094
2110
|
});
|
|
2095
2111
|
}
|
|
2096
|
-
/**
|
|
2097
|
-
* Hide the extension selector.
|
|
2098
|
-
*/
|
|
2099
|
-
hideExtensionSelector() {
|
|
2100
|
-
this.extensionSelector?.dispose();
|
|
2101
|
-
this.editorContainer.clear();
|
|
2102
|
-
this.editorContainer.addChild(this.editor);
|
|
2103
|
-
this.extensionSelector = undefined;
|
|
2104
|
-
this.programStatus.setBlocked("extension-dialog", undefined);
|
|
2105
|
-
this.ui.setFocus(this.editor);
|
|
2106
|
-
this.ui.requestRender();
|
|
2107
|
-
}
|
|
2108
2112
|
/**
|
|
2109
2113
|
* Show a confirmation dialog for extensions.
|
|
2110
2114
|
*/
|
|
@@ -2127,71 +2131,31 @@ export class InteractiveMode {
|
|
|
2127
2131
|
resolve(undefined);
|
|
2128
2132
|
return;
|
|
2129
2133
|
}
|
|
2130
|
-
const
|
|
2131
|
-
this.hideExtensionInput();
|
|
2132
|
-
resolve(undefined);
|
|
2133
|
-
};
|
|
2134
|
-
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
2135
|
-
this.extensionInput = new ExtensionInputComponent(title, placeholder, (value) => {
|
|
2134
|
+
const finish = (value) => {
|
|
2136
2135
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
2137
|
-
|
|
2136
|
+
input.dispose();
|
|
2137
|
+
this.removeExtensionDialog(input);
|
|
2138
2138
|
resolve(value);
|
|
2139
|
-
}
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
this.disposeActiveSelector();
|
|
2145
|
-
this.editorContainer.clear();
|
|
2146
|
-
this.editorContainer.addChild(this.extensionInput);
|
|
2147
|
-
this.ui.setFocus(this.extensionInput);
|
|
2148
|
-
this.programStatus.setBlocked("extension-dialog", { kind: "question", message: title });
|
|
2149
|
-
this.ui.requestRender();
|
|
2139
|
+
};
|
|
2140
|
+
const onAbort = () => finish(undefined);
|
|
2141
|
+
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
2142
|
+
const input = new ExtensionInputComponent(title, placeholder, (value) => finish(value), () => finish(undefined), { tui: this.ui, timeout: opts?.timeout });
|
|
2143
|
+
this.pushExtensionDialog(input, { kind: "question", message: title });
|
|
2150
2144
|
});
|
|
2151
2145
|
}
|
|
2152
|
-
/**
|
|
2153
|
-
* Hide the extension input.
|
|
2154
|
-
*/
|
|
2155
|
-
hideExtensionInput() {
|
|
2156
|
-
this.extensionInput?.dispose();
|
|
2157
|
-
this.editorContainer.clear();
|
|
2158
|
-
this.editorContainer.addChild(this.editor);
|
|
2159
|
-
this.extensionInput = undefined;
|
|
2160
|
-
this.programStatus.setBlocked("extension-dialog", undefined);
|
|
2161
|
-
this.ui.setFocus(this.editor);
|
|
2162
|
-
this.ui.requestRender();
|
|
2163
|
-
}
|
|
2164
2146
|
/**
|
|
2165
2147
|
* Show a multi-line editor for extensions (with Ctrl+G support).
|
|
2166
2148
|
*/
|
|
2167
2149
|
showExtensionEditor(title, prefill) {
|
|
2168
2150
|
return new Promise((resolve) => {
|
|
2169
|
-
|
|
2170
|
-
this.
|
|
2151
|
+
const finish = (value) => {
|
|
2152
|
+
this.removeExtensionDialog(editor);
|
|
2171
2153
|
resolve(value);
|
|
2172
|
-
}
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
}, undefined, this.settingsManager.getExternalEditorCommand());
|
|
2176
|
-
this.disposeActiveSelector();
|
|
2177
|
-
this.editorContainer.clear();
|
|
2178
|
-
this.editorContainer.addChild(this.extensionEditor);
|
|
2179
|
-
this.ui.setFocus(this.extensionEditor);
|
|
2180
|
-
this.programStatus.setBlocked("extension-dialog", { kind: "question", message: title });
|
|
2181
|
-
this.ui.requestRender();
|
|
2154
|
+
};
|
|
2155
|
+
const editor = new ExtensionEditorComponent(this.ui, this.keybindings, title, prefill, (value) => finish(value), () => finish(undefined), undefined, this.settingsManager.getExternalEditorCommand());
|
|
2156
|
+
this.pushExtensionDialog(editor, { kind: "question", message: title });
|
|
2182
2157
|
});
|
|
2183
2158
|
}
|
|
2184
|
-
/**
|
|
2185
|
-
* Hide the extension editor.
|
|
2186
|
-
*/
|
|
2187
|
-
hideExtensionEditor() {
|
|
2188
|
-
this.editorContainer.clear();
|
|
2189
|
-
this.editorContainer.addChild(this.editor);
|
|
2190
|
-
this.extensionEditor = undefined;
|
|
2191
|
-
this.programStatus.setBlocked("extension-dialog", undefined);
|
|
2192
|
-
this.ui.setFocus(this.editor);
|
|
2193
|
-
this.ui.requestRender();
|
|
2194
|
-
}
|
|
2195
2159
|
/**
|
|
2196
2160
|
* Set a custom editor component from an extension.
|
|
2197
2161
|
* Pass undefined to restore the default editor.
|
|
@@ -2281,17 +2245,16 @@ export class InteractiveMode {
|
|
|
2281
2245
|
async showExtensionCustom(factory, options) {
|
|
2282
2246
|
const savedText = this.editor.getText();
|
|
2283
2247
|
const isOverlay = options?.overlay ?? false;
|
|
2284
|
-
const restoreEditor = () => {
|
|
2285
|
-
this.editorContainer.clear();
|
|
2286
|
-
this.editorContainer.addChild(this.editor);
|
|
2287
|
-
this.editor.setText(savedText);
|
|
2288
|
-
this.ui.setFocus(this.editor);
|
|
2289
|
-
this.ui.requestRender();
|
|
2290
|
-
};
|
|
2291
2248
|
return new Promise((resolve, reject) => {
|
|
2292
2249
|
let component;
|
|
2293
2250
|
let overlayHandle;
|
|
2294
2251
|
let closed = false;
|
|
2252
|
+
const restoreEditor = () => {
|
|
2253
|
+
if (component)
|
|
2254
|
+
this.removeExtensionDialog(component);
|
|
2255
|
+
this.editor.setText(savedText);
|
|
2256
|
+
this.ui.requestRender();
|
|
2257
|
+
};
|
|
2295
2258
|
const close = (result) => {
|
|
2296
2259
|
if (closed)
|
|
2297
2260
|
return;
|
|
@@ -2325,19 +2288,15 @@ export class InteractiveMode {
|
|
|
2325
2288
|
return opts;
|
|
2326
2289
|
}
|
|
2327
2290
|
// Fallback: use component's width property if available
|
|
2328
|
-
const w =
|
|
2291
|
+
const w = c.width;
|
|
2329
2292
|
return w ? { width: w } : undefined;
|
|
2330
2293
|
};
|
|
2331
|
-
overlayHandle = this.ui.showOverlay(
|
|
2294
|
+
overlayHandle = this.ui.showOverlay(c, resolveOptions());
|
|
2332
2295
|
// Expose handle to caller for visibility control
|
|
2333
2296
|
options?.onHandle?.(overlayHandle);
|
|
2334
2297
|
}
|
|
2335
2298
|
else {
|
|
2336
|
-
this.
|
|
2337
|
-
this.editorContainer.clear();
|
|
2338
|
-
this.editorContainer.addChild(component);
|
|
2339
|
-
this.ui.setFocus(component);
|
|
2340
|
-
this.ui.requestRender();
|
|
2299
|
+
this.pushExtensionDialog(c);
|
|
2341
2300
|
}
|
|
2342
2301
|
})
|
|
2343
2302
|
.catch((err) => {
|