@bastani/atomic 0.9.26-alpha.1 → 0.9.26-alpha.3
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 +28 -0
- package/dist/builtin/intercom/broker/spawn.ts +2 -0
- package/dist/builtin/intercom/index.bundle.mjs +1 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/native-client-licenses/NOTICE +2 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/core/extensions/api-types.d.ts +2 -1
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +7 -0
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +2 -0
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +1 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-runtime-streaming.d.ts +2 -1
- package/dist/core/model-runtime-streaming.d.ts.map +1 -1
- package/dist/core/model-runtime-streaming.js +4 -1
- package/dist/core/model-runtime-streaming.js.map +1 -1
- package/dist/core/model-runtime.d.ts +2 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +69 -5
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/oauth-provider-metadata.d.ts.map +1 -1
- package/dist/core/oauth-provider-metadata.js +4 -17
- package/dist/core/oauth-provider-metadata.js.map +1 -1
- package/dist/core/provider-alias.d.ts +8 -0
- package/dist/core/provider-alias.d.ts.map +1 -0
- package/dist/core/provider-alias.js +119 -0
- package/dist/core/provider-alias.js.map +1 -0
- package/dist/core/provider-composer-internal.d.ts +1 -0
- package/dist/core/provider-composer-internal.d.ts.map +1 -1
- package/dist/core/provider-composer-internal.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +9 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/sdk.js +2 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts.map +1 -1
- package/dist/extensions/mcp/cli.js +4 -1
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/client/oauth/callback.d.ts +4 -2
- package/dist/extensions/mcp/client/oauth/callback.d.ts.map +1 -1
- package/dist/extensions/mcp/client/oauth/callback.js +12 -7
- package/dist/extensions/mcp/client/oauth/callback.js.map +1 -1
- package/dist/extensions/mcp/client/oauth/flow.d.ts +7 -1
- package/dist/extensions/mcp/client/oauth/flow.d.ts.map +1 -1
- package/dist/extensions/mcp/client/oauth/flow.js +20 -21
- package/dist/extensions/mcp/client/oauth/flow.js.map +1 -1
- package/dist/extensions/mcp/client/oauth/index.d.ts +1 -1
- package/dist/extensions/mcp/client/oauth/index.d.ts.map +1 -1
- package/dist/extensions/mcp/client/oauth/index.js.map +1 -1
- package/dist/extensions/mcp/client/oauth/provider.d.ts +5 -2
- package/dist/extensions/mcp/client/oauth/provider.d.ts.map +1 -1
- package/dist/extensions/mcp/client/oauth/provider.js +2 -0
- package/dist/extensions/mcp/client/oauth/provider.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts +16 -4
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +50 -11
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts +4 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +80 -46
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/oauth.d.ts.map +1 -1
- package/dist/extensions/mcp/oauth.js +9 -5
- package/dist/extensions/mcp/oauth.js.map +1 -1
- package/dist/extensions/mcp/ui.d.ts.map +1 -1
- package/dist/extensions/mcp/ui.js +8 -4
- package/dist/extensions/mcp/ui.js.map +1 -1
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/chat-input-actions.js.map +1 -1
- package/dist/modes/interactive/components/auth-url.d.ts +10 -0
- package/dist/modes/interactive/components/auth-url.d.ts.map +1 -0
- package/dist/modes/interactive/components/auth-url.js +37 -0
- package/dist/modes/interactive/components/auth-url.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +0 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +0 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +10 -5
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.js +0 -1
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
- package/dist/modes/interactive/interactive-hotkeys-debug.js +1 -11
- package/dist/modes/interactive/interactive-hotkeys-debug.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -2
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +0 -1
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +0 -5
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +0 -2
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +38 -2
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +10 -0
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +10 -0
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts +2 -1
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +23 -1
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/docs/custom-provider/oauth.md +2 -0
- package/docs/custom-provider/registration.md +32 -0
- package/docs/custom-provider.md +1 -0
- package/docs/keybindings.md +3 -0
- package/docs/mcp-servers.md +13 -1
- package/docs/providers.md +2 -0
- package/examples/extensions/provider-accounts.ts +11 -0
- package/npm-shrinkwrap.json +55 -33
- package/package.json +4 -3
- package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
- package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
- package/dist/modes/interactive/components/daxnuts.js +0 -140
- package/dist/modes/interactive/components/daxnuts.js.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Container, type TUI } from "@earendil-works/pi-tui";
|
|
2
|
+
export declare class AuthUrlComponent extends Container {
|
|
3
|
+
readonly url: string;
|
|
4
|
+
private readonly tui;
|
|
5
|
+
private readonly hint;
|
|
6
|
+
constructor(tui: TUI, url: string);
|
|
7
|
+
private setHint;
|
|
8
|
+
copy(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=auth-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-url.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/auth-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,KAAK,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAK9E,qBAAa,gBAAiB,SAAQ,SAAS;IAC9C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAO;IAE5B,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAQhC;IAED,OAAO,CAAC,OAAO;IAMT,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAa1B;CACD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Container, hyperlink, Text } from "@earendil-works/pi-tui";
|
|
2
|
+
import { copyToClipboard } from "../../../utils/clipboard.js";
|
|
3
|
+
import { theme } from "../theme/theme.js";
|
|
4
|
+
import { keyHint } from "./keybinding-hints.js";
|
|
5
|
+
export class AuthUrlComponent extends Container {
|
|
6
|
+
url;
|
|
7
|
+
tui;
|
|
8
|
+
hint;
|
|
9
|
+
constructor(tui, url) {
|
|
10
|
+
super();
|
|
11
|
+
this.tui = tui;
|
|
12
|
+
this.url = url;
|
|
13
|
+
this.addChild(new Text(theme.fg("accent", hyperlink(url, url)), 1, 0));
|
|
14
|
+
this.hint = new Text("", 1, 0);
|
|
15
|
+
this.addChild(this.hint);
|
|
16
|
+
this.setHint(keyHint("app.auth.copyUrl", "to copy"));
|
|
17
|
+
}
|
|
18
|
+
setHint(suffix) {
|
|
19
|
+
const clickHint = process.platform === "darwin" ? "Cmd+click to open" : "Ctrl+click to open";
|
|
20
|
+
this.hint.setText(`${theme.fg("dim", hyperlink(clickHint, this.url))} ${theme.fg("dim", "•")} ${suffix}`);
|
|
21
|
+
this.tui.requestRender();
|
|
22
|
+
}
|
|
23
|
+
async copy() {
|
|
24
|
+
try {
|
|
25
|
+
const remoteCopy = this.tui.terminal?.copyTextToHost;
|
|
26
|
+
if (remoteCopy)
|
|
27
|
+
await remoteCopy.call(this.tui.terminal, this.url);
|
|
28
|
+
else
|
|
29
|
+
await copyToClipboard(this.url);
|
|
30
|
+
this.setHint(theme.fg("success", "Copied URL to clipboard"));
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
this.setHint(theme.fg("error", error instanceof Error ? error.message : String(error)));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=auth-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-url.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/auth-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAY,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IACrC,GAAG,CAAS;IACJ,GAAG,CAAM;IACT,IAAI,CAAO;IAE5B,YAAY,GAAQ,EAAE,GAAW;QAChC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,G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AAC,CAAC,CAAC,CAAC;QACzF,CAAC;IACF,CAAC;CACD","sourcesContent":["import { Container, hyperlink, Text, type TUI } from \"@earendil-works/pi-tui\";\nimport { copyToClipboard } from \"../../../utils/clipboard.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { keyHint } from \"./keybinding-hints.js\";\n\nexport class AuthUrlComponent extends Container {\n\treadonly url: string;\n\tprivate readonly tui: TUI;\n\tprivate readonly hint: Text;\n\n\tconstructor(tui: TUI, url: string) {\n\t\tsuper();\n\t\tthis.tui = tui;\n\t\tthis.url = url;\n\t\tthis.addChild(new Text(theme.fg(\"accent\", hyperlink(url, url)), 1, 0));\n\t\tthis.hint = new Text(\"\", 1, 0);\n\t\tthis.addChild(this.hint);\n\t\tthis.setHint(keyHint(\"app.auth.copyUrl\", \"to copy\"));\n\t}\n\n\tprivate setHint(suffix: string): void {\n\t\tconst clickHint = process.platform === \"darwin\" ? \"Cmd+click to open\" : \"Ctrl+click to open\";\n\t\tthis.hint.setText(`${theme.fg(\"dim\", hyperlink(clickHint, this.url))} ${theme.fg(\"dim\", \"•\")} ${suffix}`);\n\t\tthis.tui.requestRender();\n\t}\n\n\tasync copy(): Promise<void> {\n\t\ttry {\n\t\t\tconst remoteCopy = (\n\t\t\t\tthis.tui.terminal as\n\t\t\t\t\t| (typeof this.tui.terminal & { copyTextToHost?: (text: string) => Promise<void> })\n\t\t\t\t\t| undefined\n\t\t\t)?.copyTextToHost;\n\t\t\tif (remoteCopy) await remoteCopy.call(this.tui.terminal, this.url);\n\t\t\telse await copyToClipboard(this.url);\n\t\t\tthis.setHint(theme.fg(\"success\", \"Copied URL to clipboard\"));\n\t\t} catch (error) {\n\t\t\tthis.setHint(theme.fg(\"error\", error instanceof Error ? error.message : String(error)));\n\t\t}\n\t}\n}\n"]}
|
|
@@ -11,7 +11,6 @@ export { CompactionBoundaryMessageComponent } from "./compaction-boundary-messag
|
|
|
11
11
|
export { CustomEditor, type CustomEditorOptions } from "./custom-editor.ts";
|
|
12
12
|
export { CustomEntryComponent } from "./custom-entry.ts";
|
|
13
13
|
export { CustomMessageComponent } from "./custom-message.ts";
|
|
14
|
-
export { DaxnutsComponent } from "./daxnuts.ts";
|
|
15
14
|
export { type RenderDiffOptions, renderDiff } from "./diff.ts";
|
|
16
15
|
export { DynamicBorder } from "./dynamic-border.ts";
|
|
17
16
|
export { ExtensionEditorComponent } from "./extension-editor.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,4BAA4B,EAC5B,yBAAyB,EACzB,sBAAsB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,eAAe,EACf,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,GAC1B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EACN,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,iCAAiC,EACjC,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AACt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OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AACzG,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,KAAK,6BAA6B,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -11,7 +11,6 @@ export { CompactionBoundaryMessageComponent } from "./compaction-boundary-messag
|
|
|
11
11
|
export { CustomEditor } from "./custom-editor.js";
|
|
12
12
|
export { CustomEntryComponent } from "./custom-entry.js";
|
|
13
13
|
export { CustomMessageComponent } from "./custom-message.js";
|
|
14
|
-
export { DaxnutsComponent } from "./daxnuts.js";
|
|
15
14
|
export { renderDiff } from "./diff.js";
|
|
16
15
|
export { DynamicBorder } from "./dynamic-border.js";
|
|
17
16
|
export { ExtensionEditorComponent } from "./extension-editor.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,E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,kCAAkC,CAAC;AACzG,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAA6B,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAsC,MAAM,qBAAqB,CAAC","sourcesContent":["// UI Components for extensions\nexport { ArminComponent } from \"./armin.ts\";\nexport { AssistantMessageComponent } from \"./assistant-message.ts\";\nexport { BashExecutionComponent } from \"./bash-execution.ts\";\nexport { BorderedLoader } from \"./bordered-loader.ts\";\nexport { BranchSummaryMessageComponent } from \"./branch-summary-message.ts\";\nexport {\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tchatEntriesFromAgentMessages,\n\tLiveChatEntriesController,\n\trenderChatMessageEntry,\n} from \"./chat-message-renderer.ts\";\nexport {\n\tChatSessionHost,\n\ttype ChatSessionHostBashRequest,\n\ttype ChatSessionHostCommands,\n\ttype ChatSessionHostEntry,\n\ttype ChatSessionHostOpts,\n\ttype ChatSessionHostStyle,\n\ttype ChatSessionSubmitMode,\n} from \"./chat-session-host.ts\";\nexport type { CompactionReason } from \"./chat-session-host-events.ts\";\nexport {\n\taddChatTranscriptEntry,\n\ttype ChatTranscriptCacheKey,\n\tChatTranscriptComponent,\n\ttype ChatTranscriptEntryLike,\n\ttype ChatTranscriptRenderer,\n\ttype ChatTranscriptRole,\n\ttype RowWindowSegment,\n\tScrollableChatTranscriptComponent,\n\tScrollableComponentViewport,\n} from \"./chat-transcript.js\";\nexport { CompactionBoundaryMessageComponent } from \"./compaction-boundary-message.ts\";\nexport { CustomEditor, type CustomEditorOptions } from \"./custom-editor.ts\";\nexport { CustomEntryComponent } from \"./custom-entry.ts\";\nexport { CustomMessageComponent } from \"./custom-message.ts\";\nexport { type RenderDiffOptions, renderDiff } from \"./diff.ts\";\nexport { DynamicBorder } from \"./dynamic-border.ts\";\nexport { ExtensionEditorComponent } from \"./extension-editor.ts\";\nexport { ExtensionInputComponent } from \"./extension-input.ts\";\nexport { ExtensionSelectorComponent } from \"./extension-selector.ts\";\nexport { FirstTimeSetupComponent, type FirstTimeSetupOptions, type FirstTimeSetupResult } from \"./first-time-setup.ts\";\nexport { FooterComponent, UsageMeterComponent } from \"./footer.ts\";\nexport { IdleStatus } from \"./idle-status.ts\";\nexport { keyHint, keyHintIfBound, keyText, rawKeyHint } from \"./keybinding-hints.js\";\nexport { LoginDialogComponent } from \"./login-dialog.ts\";\nexport { ModelSelectorComponent } from \"./model-selector.ts\";\nexport { OAuthSelectorComponent } from \"./oauth-selector.ts\";\nexport { type ModelsCallbacks, type ModelsConfig, ScopedModelsSelectorComponent } from \"./scoped-models-selector.ts\";\nexport { SessionSelectorComponent } from \"./session-selector.ts\";\nexport { type SettingsCallbacks, type SettingsConfig, SettingsSelectorComponent } from \"./settings-selector.ts\";\nexport { ShowImagesSelectorComponent } from \"./show-images-selector.ts\";\nexport { SkillInvocationMessageComponent } from \"./skill-invocation-message.ts\";\nexport { ThemeSelectorComponent } from \"./theme-selector.ts\";\nexport { ThinkingSelectorComponent } from \"./thinking-selector.ts\";\nexport { ToolExecutionComponent, type ToolExecutionOptions } from \"./tool-execution.ts\";\nexport { TRANSCRIPT_JUMP_TO_END_URL, TranscriptFollowIndicator } from \"./transcript-follow-indicator.ts\";\nexport { TreeSelectorComponent } from \"./tree-selector.ts\";\nexport { TrustSelectorComponent } from \"./trust-selector.ts\";\nexport { UserMessageComponent } from \"./user-message.ts\";\nexport { UserMessageSelectorComponent } from \"./user-message-selector.ts\";\nexport { truncateToVisualLines, type VisualTruncateResult } from \"./visual-truncate.ts\";\nexport { WorkingStatusComponent, type WorkingStatusComponentOptions } from \"./working-status.ts\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-dialog.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/login-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAuC,KAAK,GAAG,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"login-dialog.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/login-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAuC,KAAK,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAOlH;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAU,YAAW,SAAS;IACvE,OAAO,CAAC,gBAAgB,CAAY;IACpC,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,OAAO,CAAC,CAAmB;IACnC,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,aAAa,CAAC,CAA0B;IAChD,OAAO,CAAC,aAAa,CAAC,CAAyB;IAC/C,OAAO,CAAC,cAAc,CAAC,CAAO;IAG9B,OAAO,CAAC,QAAQ,CAAS;IACzB,IAAI,OAAO,IAAI,OAAO,CAErB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAGzB;IAED,QAAgB,UAAU,CAA+C;IAEzE,YACC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,EACxD,oBAAoB,CAAC,EAAE,MAAM,EAC7B,aAAa,CAAC,EAAE,MAAM,EAoCtB;IAED,IAAI,MAAM,IAAI,WAAW,CAExB;IAED,OAAO,CAAC,MAAM;IAUd;;OAEG;IACH,QAAQ,CACP,GAAG,EAAE,MAAM,EACX,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,GAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAC;QAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAO,GACnE,IAAI,CAqBN;IAED;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAgB9C;IAED,OAAO,CAAC,6BAA6B;IAMrC,OAAO,CAAC,oBAAoB;IAM5B;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAa/C;IAED,wFAAwF;IACxF,mBAAmB,IAAI,IAAI,CAI1B;IAED;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBjE;IAED,0DAA0D;IAC1D,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CASjC;IAED,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,SAAS,YAAY,EAAO,GAAG,IAAI,CASnE;IAED;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAMjC;IAED;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAGlC;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAejC;CACD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Container, getKeybindings, Input, Spacer, Text } from "@earendil-works/pi-tui";
|
|
2
2
|
import { openBrowser } from "../../../utils/open-browser.js";
|
|
3
3
|
import { theme } from "../theme/theme.js";
|
|
4
|
+
import { AuthUrlComponent } from "./auth-url.js";
|
|
4
5
|
import { DynamicBorder } from "./dynamic-border.js";
|
|
5
6
|
import { keyHint } from "./keybinding-hints.js";
|
|
6
7
|
/**
|
|
@@ -10,6 +11,7 @@ export class LoginDialogComponent extends Container {
|
|
|
10
11
|
contentContainer;
|
|
11
12
|
input;
|
|
12
13
|
tui;
|
|
14
|
+
authUrl;
|
|
13
15
|
abortController = new AbortController();
|
|
14
16
|
inputResolver;
|
|
15
17
|
inputRejecter;
|
|
@@ -72,11 +74,8 @@ export class LoginDialogComponent extends Container {
|
|
|
72
74
|
this.contentContainer.clear();
|
|
73
75
|
this.authCancelHint = undefined;
|
|
74
76
|
this.contentContainer.addChild(new Spacer(1));
|
|
75
|
-
|
|
76
|
-
this.contentContainer.addChild(
|
|
77
|
-
const clickHint = process.platform === "darwin" ? "cmd+click open" : "ctrl+click open";
|
|
78
|
-
const hyperlink = `\x1b]8;;${url}\x07${clickHint}\x1b]8;;\x07`;
|
|
79
|
-
this.contentContainer.addChild(new Text(theme.fg("dim", hyperlink), 1, 0));
|
|
77
|
+
this.authUrl = new AuthUrlComponent(this.tui, url);
|
|
78
|
+
this.contentContainer.addChild(this.authUrl);
|
|
80
79
|
if (instructions) {
|
|
81
80
|
this.contentContainer.addChild(new Spacer(1));
|
|
82
81
|
this.contentContainer.addChild(new Text(theme.fg("warning", instructions), 1, 0));
|
|
@@ -94,6 +93,7 @@ export class LoginDialogComponent extends Container {
|
|
|
94
93
|
* Called by onDeviceCode callback - show URL and user code.
|
|
95
94
|
*/
|
|
96
95
|
showDeviceCode(info) {
|
|
96
|
+
this.authUrl = undefined;
|
|
97
97
|
this.contentContainer.clear();
|
|
98
98
|
this.authCancelHint = undefined;
|
|
99
99
|
this.contentContainer.addChild(new Spacer(1));
|
|
@@ -160,6 +160,7 @@ export class LoginDialogComponent extends Container {
|
|
|
160
160
|
}
|
|
161
161
|
/** Show static informational details and a close hint. */
|
|
162
162
|
showDetails(lines) {
|
|
163
|
+
this.authUrl = undefined;
|
|
163
164
|
this.contentContainer.clear();
|
|
164
165
|
this.authCancelHint = undefined;
|
|
165
166
|
this.contentContainer.addChild(new Spacer(1));
|
|
@@ -203,6 +204,10 @@ export class LoginDialogComponent extends Container {
|
|
|
203
204
|
this.cancel();
|
|
204
205
|
return true;
|
|
205
206
|
}
|
|
207
|
+
if (this.authUrl && kb.matches(data, "app.auth.copyUrl")) {
|
|
208
|
+
void this.authUrl.copy();
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
206
211
|
// Pass to input
|
|
207
212
|
this.input.handleInput(data);
|
|
208
213
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-dialog.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/login-dialog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkB,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAY,MAAM,wBAAwB,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAC1C,gBAAgB,CAAY;IAC5B,KAAK,CAAQ;IACb,GAAG,CAAM;IACT,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IACxC,aAAa,CAA2B;IACxC,aAAa,CAA0B;IACvC,cAAc,CAAQ;IAE9B,2EAA2E;IACnE,QAAQ,GAAG,KAAK,CAAC;IACzB,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IACD,IAAI,OAAO,CAAC,KAAc;QACzB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;IAC5B,CAAC;IAID,YACC,GAAQ,EACR,UAAkB,EAClB,UAAwD,EACxD,oBAA6B,EAC7B,aAAsB;QAE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Text, type TUI } from \"@earendil-works/pi-tui\";\nimport { openBrowser } from \"../../../utils/open-browser.ts\";\nimport { theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { keyHint } from \"./keybinding-hints.js\";\n\n/**\n * Login dialog component - replaces editor during OAuth login flow\n */\nexport class LoginDialogComponent extends Container implements Focusable {\n\tprivate contentContainer: Container;\n\tprivate input: Input;\n\tprivate tui: TUI;\n\tprivate abortController = new AbortController();\n\tprivate inputResolver?: (value: string) => void;\n\tprivate inputRejecter?: (error: Error) => void;\n\tprivate authCancelHint?: Text;\n\n\t// Focusable implementation - propagate to input for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.input.focused = value;\n\t}\n\n\tprivate declare onComplete: (success: boolean, message?: string) => void;\n\n\tconstructor(\n\t\ttui: TUI,\n\t\tproviderId: string,\n\t\tonComplete: (success: boolean, message?: string) => void,\n\t\tproviderNameOverride?: string,\n\t\ttitleOverride?: string,\n\t) {\n\t\tsuper();\n\t\tthis.onComplete = onComplete;\n\t\tthis.tui = tui;\n\n\t\tconst providerName = providerNameOverride || providerId;\n\t\tconst title = titleOverride ?? `Login to ${providerName}`;\n\n\t\t// Top border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Title\n\t\tthis.addChild(new Text(theme.fg(\"accent\", theme.bold(title)), 1, 0));\n\n\t\t// Dynamic content area\n\t\tthis.contentContainer = new Container();\n\t\tthis.addChild(this.contentContainer);\n\n\t\t// Input (always present, used when needed)\n\t\tthis.input = new Input();\n\t\tthis.input.onSubmit = () => {\n\t\t\tif (this.inputResolver) {\n\t\t\t\tconst value = this.input.getValue();\n\t\t\t\tthis.replaceInputWithSubmittedText(value);\n\t\t\t\tthis.inputResolver(value);\n\t\t\t\tthis.inputResolver = undefined;\n\t\t\t\tthis.inputRejecter = undefined;\n\t\t\t}\n\t\t};\n\t\tthis.input.onEscape = () => {\n\t\t\tthis.cancel();\n\t\t};\n\n\t\t// Bottom border\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tget signal(): AbortSignal {\n\t\treturn this.abortController.signal;\n\t}\n\n\tprivate cancel(): void {\n\t\tthis.abortController.abort();\n\t\tif (this.inputRejecter) {\n\t\t\tthis.inputRejecter(new Error(\"Login cancelled\"));\n\t\t\tthis.inputResolver = undefined;\n\t\t\tthis.inputRejecter = undefined;\n\t\t}\n\t\tthis.onComplete(false, \"Login cancelled\");\n\t}\n\n\t/**\n\t * Called by onAuth callback - show URL and optional instructions\n\t */\n\tshowAuth(\n\t\turl: string,\n\t\tinstructions?: string,\n\t\toptions: { autoOpenBrowser?: boolean; showCancelHint?: boolean } = {},\n\t): void {\n\t\tthis.contentContainer.clear();\n\t\tthis.authCancelHint = undefined;\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tconst linkedUrl = `\\x1b]8;;${url}\\x07${url}\\x1b]8;;\\x07`;\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"accent\", linkedUrl), 1, 0));\n\n\t\tconst clickHint = process.platform === \"darwin\" ? \"cmd+click open\" : \"ctrl+click open\";\n\t\tconst hyperlink = `\\x1b]8;;${url}\\x07${clickHint}\\x1b]8;;\\x07`;\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", hyperlink), 1, 0));\n\n\t\tif (instructions) {\n\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"warning\", instructions), 1, 0));\n\t\t}\n\n\t\tif (options.showCancelHint) {\n\t\t\tthis.authCancelHint = new Text(`(${keyHint(\"tui.select.cancel\", \"Cancel\")})`, 1, 0);\n\t\t\tthis.contentContainer.addChild(this.authCancelHint);\n\t\t}\n\n\t\tif (options.autoOpenBrowser ?? true) {\n\t\t\topenBrowser(url);\n\t\t}\n\t\tthis.tui.requestRender();\n\t}\n\n\t/**\n\t * Called by onDeviceCode callback - show URL and user code.\n\t */\n\tshowDeviceCode(info: OAuthDeviceCodeInfo): void {\n\t\tthis.contentContainer.clear();\n\t\tthis.authCancelHint = undefined;\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tconst linkedUrl = `\\x1b]8;;${info.verificationUri}\\x07${info.verificationUri}\\x1b]8;;\\x07`;\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"accent\", linkedUrl), 1, 0));\n\n\t\tconst clickHint = process.platform === \"darwin\" ? \"Cmd+click to open\" : \"Ctrl+click to open\";\n\t\tconst hyperlink = `\\x1b]8;;${info.verificationUri}\\x07${clickHint}\\x1b]8;;\\x07`;\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", hyperlink), 1, 0));\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"warning\", `Enter code: ${info.userCode}`), 1, 0));\n\n\t\topenBrowser(info.verificationUri);\n\t\tthis.tui.requestRender();\n\t}\n\n\tprivate replaceInputWithSubmittedText(value: string): void {\n\t\tthis.contentContainer.children = this.contentContainer.children.map((child) =>\n\t\t\tchild === this.input ? new Text(`> ${value}`, 0, 0) : child,\n\t\t);\n\t}\n\n\tprivate removeAuthCancelHint(): void {\n\t\tif (!this.authCancelHint) return;\n\t\tthis.contentContainer.children = this.contentContainer.children.filter((child) => child !== this.authCancelHint);\n\t\tthis.authCancelHint = undefined;\n\t}\n\n\t/**\n\t * Show input for manual code/URL entry (for callback server providers)\n\t */\n\tshowManualInput(prompt: string): Promise<string> {\n\t\tthis.removeAuthCancelHint();\n\t\tthis.input.setValue(\"\");\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", prompt), 1, 0));\n\t\tthis.contentContainer.addChild(this.input);\n\t\tthis.contentContainer.addChild(new Text(`(${keyHint(\"tui.select.cancel\", \"Cancel\")})`, 1, 0));\n\t\tthis.tui.requestRender();\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.inputResolver = resolve;\n\t\t\tthis.inputRejecter = reject;\n\t\t});\n\t}\n\n\t/** Resolve and release a manual input prompt after an out-of-band callback succeeds. */\n\tdismissPendingInput(): void {\n\t\tthis.inputResolver?.(\"\");\n\t\tthis.inputResolver = undefined;\n\t\tthis.inputRejecter = undefined;\n\t}\n\n\t/**\n\t * Called by onPrompt callback - show prompt and wait for input\n\t * Note: Does NOT clear content, appends to existing (preserves URL from showAuth)\n\t */\n\tshowPrompt(message: string, placeholder?: string): Promise<string> {\n\t\tthis.removeAuthCancelHint();\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"text\", message), 1, 0));\n\t\tif (placeholder) {\n\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", `e.g., ${placeholder}`), 1, 0));\n\t\t}\n\t\tthis.contentContainer.addChild(this.input);\n\t\tthis.contentContainer.addChild(\n\t\t\tnew Text(`(${keyHint(\"tui.select.cancel\", \"Cancel,\")} ${keyHint(\"tui.select.confirm\", \"Submit\")})`, 1, 0),\n\t\t);\n\n\t\tthis.input.setValue(\"\");\n\t\tthis.tui.requestRender();\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.inputResolver = resolve;\n\t\t\tthis.inputRejecter = reject;\n\t\t});\n\t}\n\n\t/** Show static informational details and a close hint. */\n\tshowDetails(lines: string[]): void {\n\t\tthis.contentContainer.clear();\n\t\tthis.authCancelHint = undefined;\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tfor (const line of lines) this.contentContainer.addChild(new Text(line, 1, 0));\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(`(${keyHint(\"tui.select.cancel\", \"Close\")})`, 1, 0));\n\t\tthis.tui.requestRender();\n\t}\n\n\t/** Show provider-owned information and terminal hyperlinks. */\n\tshowInfo(message: string, links: readonly AuthInfoLink[] = []): void {\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"text\", message), 1, 0));\n\t\tfor (const link of links) {\n\t\t\tconst text = link.label ? `${link.label}: ${link.url}` : link.url;\n\t\t\tconst hyperlink = `\\x1b]8;;${link.url}\\x07${text}\\x1b]8;;\\x07`;\n\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"accent\", hyperlink), 1, 0));\n\t\t}\n\t\tthis.tui.requestRender();\n\t}\n\n\t/**\n\t * Show waiting message (for polling flows like GitHub Copilot)\n\t */\n\tshowWaiting(message: string): void {\n\t\tthis.removeAuthCancelHint();\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", message), 1, 0));\n\t\tthis.contentContainer.addChild(new Text(`(${keyHint(\"tui.select.cancel\", \"Cancel\")})`, 1, 0));\n\t\tthis.tui.requestRender();\n\t}\n\n\t/**\n\t * Called by onProgress callback\n\t */\n\tshowProgress(message: string): void {\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", message), 1, 0));\n\t\tthis.tui.requestRender();\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tconst kb = getKeybindings();\n\n\t\tif (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.cancel();\n\t\t\treturn true;\n\t\t}\n\n\t\t// Pass to input\n\t\tthis.input.handleInput(data);\n\t\treturn true;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"login-dialog.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/login-dialog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkB,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAY,MAAM,wBAAwB,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE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AAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,OAAO,IAAI,CAAC;QACb,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,kBAAkB,CAAC,EAAE,CAAC;YAC1D,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,gBAAgB;QAChB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import type { AuthInfoLink, OAuthDeviceCodeInfo } from \"@bastani/pi-ai\";\nimport { Container, type Focusable, getKeybindings, Input, Spacer, Text, type TUI } from \"@earendil-works/pi-tui\";\nimport { openBrowser } from \"../../../utils/open-browser.ts\";\nimport { theme } from \"../theme/theme.js\";\nimport { AuthUrlComponent } from \"./auth-url.js\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { keyHint } from \"./keybinding-hints.js\";\n\n/**\n * Login dialog component - replaces editor during OAuth login flow\n */\nexport class LoginDialogComponent extends Container implements Focusable {\n\tprivate contentContainer: Container;\n\tprivate input: Input;\n\tprivate tui: TUI;\n\tprivate authUrl?: AuthUrlComponent;\n\tprivate abortController = new AbortController();\n\tprivate inputResolver?: (value: string) => void;\n\tprivate inputRejecter?: (error: Error) => void;\n\tprivate authCancelHint?: Text;\n\n\t// Focusable implementation - propagate to input for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.input.focused = value;\n\t}\n\n\tprivate declare onComplete: (success: boolean, message?: string) => void;\n\n\tconstructor(\n\t\ttui: TUI,\n\t\tproviderId: string,\n\t\tonComplete: (success: boolean, message?: string) => void,\n\t\tproviderNameOverride?: string,\n\t\ttitleOverride?: string,\n\t) {\n\t\tsuper();\n\t\tthis.onComplete = onComplete;\n\t\tthis.tui = tui;\n\n\t\tconst providerName = providerNameOverride || providerId;\n\t\tconst title = titleOverride ?? `Login to ${providerName}`;\n\n\t\t// Top border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Title\n\t\tthis.addChild(new Text(theme.fg(\"accent\", theme.bold(title)), 1, 0));\n\n\t\t// Dynamic content area\n\t\tthis.contentContainer = new Container();\n\t\tthis.addChild(this.contentContainer);\n\n\t\t// Input (always present, used when needed)\n\t\tthis.input = new Input();\n\t\tthis.input.onSubmit = () => {\n\t\t\tif (this.inputResolver) {\n\t\t\t\tconst value = this.input.getValue();\n\t\t\t\tthis.replaceInputWithSubmittedText(value);\n\t\t\t\tthis.inputResolver(value);\n\t\t\t\tthis.inputResolver = undefined;\n\t\t\t\tthis.inputRejecter = undefined;\n\t\t\t}\n\t\t};\n\t\tthis.input.onEscape = () => {\n\t\t\tthis.cancel();\n\t\t};\n\n\t\t// Bottom border\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tget signal(): AbortSignal {\n\t\treturn this.abortController.signal;\n\t}\n\n\tprivate cancel(): void {\n\t\tthis.abortController.abort();\n\t\tif (this.inputRejecter) {\n\t\t\tthis.inputRejecter(new Error(\"Login cancelled\"));\n\t\t\tthis.inputResolver = undefined;\n\t\t\tthis.inputRejecter = undefined;\n\t\t}\n\t\tthis.onComplete(false, \"Login cancelled\");\n\t}\n\n\t/**\n\t * Called by onAuth callback - show URL and optional instructions\n\t */\n\tshowAuth(\n\t\turl: string,\n\t\tinstructions?: string,\n\t\toptions: { autoOpenBrowser?: boolean; showCancelHint?: boolean } = {},\n\t): void {\n\t\tthis.contentContainer.clear();\n\t\tthis.authCancelHint = undefined;\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.authUrl = new AuthUrlComponent(this.tui, url);\n\t\tthis.contentContainer.addChild(this.authUrl);\n\n\t\tif (instructions) {\n\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"warning\", instructions), 1, 0));\n\t\t}\n\n\t\tif (options.showCancelHint) {\n\t\t\tthis.authCancelHint = new Text(`(${keyHint(\"tui.select.cancel\", \"Cancel\")})`, 1, 0);\n\t\t\tthis.contentContainer.addChild(this.authCancelHint);\n\t\t}\n\n\t\tif (options.autoOpenBrowser ?? true) {\n\t\t\topenBrowser(url);\n\t\t}\n\t\tthis.tui.requestRender();\n\t}\n\n\t/**\n\t * Called by onDeviceCode callback - show URL and user code.\n\t */\n\tshowDeviceCode(info: OAuthDeviceCodeInfo): void {\n\t\tthis.authUrl = undefined;\n\t\tthis.contentContainer.clear();\n\t\tthis.authCancelHint = undefined;\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tconst linkedUrl = `\\x1b]8;;${info.verificationUri}\\x07${info.verificationUri}\\x1b]8;;\\x07`;\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"accent\", linkedUrl), 1, 0));\n\n\t\tconst clickHint = process.platform === \"darwin\" ? \"Cmd+click to open\" : \"Ctrl+click to open\";\n\t\tconst hyperlink = `\\x1b]8;;${info.verificationUri}\\x07${clickHint}\\x1b]8;;\\x07`;\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", hyperlink), 1, 0));\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"warning\", `Enter code: ${info.userCode}`), 1, 0));\n\n\t\topenBrowser(info.verificationUri);\n\t\tthis.tui.requestRender();\n\t}\n\n\tprivate replaceInputWithSubmittedText(value: string): void {\n\t\tthis.contentContainer.children = this.contentContainer.children.map((child) =>\n\t\t\tchild === this.input ? new Text(`> ${value}`, 0, 0) : child,\n\t\t);\n\t}\n\n\tprivate removeAuthCancelHint(): void {\n\t\tif (!this.authCancelHint) return;\n\t\tthis.contentContainer.children = this.contentContainer.children.filter((child) => child !== this.authCancelHint);\n\t\tthis.authCancelHint = undefined;\n\t}\n\n\t/**\n\t * Show input for manual code/URL entry (for callback server providers)\n\t */\n\tshowManualInput(prompt: string): Promise<string> {\n\t\tthis.removeAuthCancelHint();\n\t\tthis.input.setValue(\"\");\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", prompt), 1, 0));\n\t\tthis.contentContainer.addChild(this.input);\n\t\tthis.contentContainer.addChild(new Text(`(${keyHint(\"tui.select.cancel\", \"Cancel\")})`, 1, 0));\n\t\tthis.tui.requestRender();\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.inputResolver = resolve;\n\t\t\tthis.inputRejecter = reject;\n\t\t});\n\t}\n\n\t/** Resolve and release a manual input prompt after an out-of-band callback succeeds. */\n\tdismissPendingInput(): void {\n\t\tthis.inputResolver?.(\"\");\n\t\tthis.inputResolver = undefined;\n\t\tthis.inputRejecter = undefined;\n\t}\n\n\t/**\n\t * Called by onPrompt callback - show prompt and wait for input\n\t * Note: Does NOT clear content, appends to existing (preserves URL from showAuth)\n\t */\n\tshowPrompt(message: string, placeholder?: string): Promise<string> {\n\t\tthis.removeAuthCancelHint();\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"text\", message), 1, 0));\n\t\tif (placeholder) {\n\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", `e.g., ${placeholder}`), 1, 0));\n\t\t}\n\t\tthis.contentContainer.addChild(this.input);\n\t\tthis.contentContainer.addChild(\n\t\t\tnew Text(`(${keyHint(\"tui.select.cancel\", \"Cancel,\")} ${keyHint(\"tui.select.confirm\", \"Submit\")})`, 1, 0),\n\t\t);\n\n\t\tthis.input.setValue(\"\");\n\t\tthis.tui.requestRender();\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.inputResolver = resolve;\n\t\t\tthis.inputRejecter = reject;\n\t\t});\n\t}\n\n\t/** Show static informational details and a close hint. */\n\tshowDetails(lines: string[]): void {\n\t\tthis.authUrl = undefined;\n\t\tthis.contentContainer.clear();\n\t\tthis.authCancelHint = undefined;\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tfor (const line of lines) this.contentContainer.addChild(new Text(line, 1, 0));\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(`(${keyHint(\"tui.select.cancel\", \"Close\")})`, 1, 0));\n\t\tthis.tui.requestRender();\n\t}\n\n\t/** Show provider-owned information and terminal hyperlinks. */\n\tshowInfo(message: string, links: readonly AuthInfoLink[] = []): void {\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"text\", message), 1, 0));\n\t\tfor (const link of links) {\n\t\t\tconst text = link.label ? `${link.label}: ${link.url}` : link.url;\n\t\t\tconst hyperlink = `\\x1b]8;;${link.url}\\x07${text}\\x1b]8;;\\x07`;\n\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"accent\", hyperlink), 1, 0));\n\t\t}\n\t\tthis.tui.requestRender();\n\t}\n\n\t/**\n\t * Show waiting message (for polling flows like GitHub Copilot)\n\t */\n\tshowWaiting(message: string): void {\n\t\tthis.removeAuthCancelHint();\n\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", message), 1, 0));\n\t\tthis.contentContainer.addChild(new Text(`(${keyHint(\"tui.select.cancel\", \"Cancel\")})`, 1, 0));\n\t\tthis.tui.requestRender();\n\t}\n\n\t/**\n\t * Called by onProgress callback\n\t */\n\tshowProgress(message: string): void {\n\t\tthis.contentContainer.addChild(new Text(theme.fg(\"dim\", message), 1, 0));\n\t\tthis.tui.requestRender();\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tconst kb = getKeybindings();\n\n\t\tif (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.cancel();\n\t\t\treturn true;\n\t\t}\n\t\tif (this.authUrl && kb.matches(data, \"app.auth.copyUrl\")) {\n\t\t\tvoid this.authUrl.copy();\n\t\t\treturn true;\n\t\t}\n\n\t\t// Pass to input\n\t\tthis.input.handleInput(data);\n\t\treturn true;\n\t}\n}\n"]}
|
|
@@ -56,7 +56,6 @@ InteractiveModeBase.prototype.completeProviderAuthentication = async function (p
|
|
|
56
56
|
if (selectedModel) {
|
|
57
57
|
this.showStatus(`${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`);
|
|
58
58
|
void this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);
|
|
59
|
-
this.checkDaxnutsEasterEgg(selectedModel);
|
|
60
59
|
}
|
|
61
60
|
else {
|
|
62
61
|
this.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-auth-login.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,oBAAoB,EAGpB,IAAI,EACJ,KAAK,GACL,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAExF,MAAM,UAAU,yBAAyB,CAAC,WAAmB,EAAE,gBAAwB;IACtF,OAAO,gBAAgB,KAAK,CAAC;QAC5B,CAAC,CAAC,GAAG,WAAW,yFAAyF;QACzG,CAAC,CAAC,GAAG,WAAW,8EAA8E,CAAC;AACjG,CAAC;AAED,mBAAmB,CAAC,SAAS,CAAC,8BAA8B,GAAG,KAAK,WAEnE,UAAkB,EAClB,YAAoB,EACpB,QAA6B,EAC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B,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;YAElF,iBAAiB,EAAE,GAAG,EAAE,CAAC,iBAAiB;YAE1C,kBAAkB,EAAE,GAAG,EAAE;gBACxB,MAAM,CAAC,mBAAmB,EAAE,CAAC;gBAC7B,iBAAiB,EAAE,CAAC,EAAE,CAAC,CAAC;gBACxB,iBAAiB,GAAG,SAAS,CAAC;gBAC9B,gBAAgB,GAAG,SAAS,CAAC;YAC9B,CAAC;YAED,MAAM,EAAE,MAAM,CAAC,MAAM;SACrB,CAAC,CAAC;QACH,cAAc,GAAG,IAAI,CAAC;QAEtB,UAAU;QACV,aAAa,EAAE,CAAC;QAChB,MAAM,IAAI,CAAC,8BAA8B,CAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;IAC1G,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACzB,aAAa,EAAE,CAAC;QAChB,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,KAAK,YAAY,8BAA8B,EAAE,CAAC;YACrD,IAAI,CAAC,SAAS,CAAC,gBAAgB,YAAY,sDAAsD,QAAQ,EAAE,CAAC,CAAC;QAC9G,CAAC;aAAM,IAAI,cAAc,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACP,MAAM,EAAE,EAAE,CAAC;QACZ,CAAC;IACF,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { CredentialSynchronizationError } from \"../../core/model-runtime.js\";\nimport { isOAuthLoginCancelled } from \"../../core/oauth-login.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Api,\n\tdefaultModelPerProvider,\n\tExtensionSelectorComponent,\n\tgetAuthPath,\n\tgetDocsPath,\n\tLoginDialogComponent,\n\ttype Model,\n\ttype OAuthSelectPrompt,\n\tpath,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport { hasDefaultModelProvider, isUnknownModel } from \"./interactive-mode-helpers.ts\";\n\nexport function llamaCppPostLoginGuidance(actionLabel: string, loadedModelCount: number): string {\n\treturn loadedModelCount === 0\n\t\t? `${actionLabel}. No llama.cpp models are loaded. Use /llama to load a model, then /model to select it.`\n\t\t: `${actionLabel}. Use /model to select a loaded llama.cpp model, or /llama to manage models.`;\n}\n\nInteractiveModeBase.prototype.completeProviderAuthentication = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tauthType: \"oauth\" | \"api_key\",\n\tpreviousModel: Model<Api> | undefined,\n\toptions: { modelsRefreshed?: boolean } = {},\n): Promise<void> {\n\tif (!options.modelsRefreshed) {\n\t\t// Match pi: after authentication persists the credential, a thrown catalog\n\t\t// refresh failure remains visible to the caller without rolling it back.\n\t\tawait this.session.modelRuntime.refresh();\n\t}\n\n\tconst actionLabel = authType === \"oauth\" ? `Logged in to ${providerName}` : `Saved API key for ${providerName}`;\n\n\tlet selectedModel: Model<Api> | undefined;\n\tlet selectionError: string | undefined;\n\tif (providerId !== \"typesafe\" && isUnknownModel(previousModel)) {\n\t\tconst availableModels = this.session.modelRuntime.getAvailableSnapshot();\n\t\tconst providerModels = availableModels.filter((model) => model.provider === providerId);\n\t\tif (providerId === \"llama.cpp\") {\n\t\t\tselectionError = llamaCppPostLoginGuidance(actionLabel, providerModels.length);\n\t\t} else if (!hasDefaultModelProvider(providerId)) {\n\t\t\tselectionError = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n\t\t} else if (providerModels.length === 0) {\n\t\t\tselectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\n\t\t} else {\n\t\t\tconst defaultModelId = defaultModelPerProvider[providerId];\n\t\t\tselectedModel =\n\t\t\t\tproviderModels.find((model) => model.id === defaultModelId) ??\n\t\t\t\t(providerId === \"radius\" ? providerModels[0] : undefined);\n\t\t\tif (!selectedModel) {\n\t\t\t\tselectionError = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.session.setModel(selectedModel);\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tselectedModel = undefined;\n\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tselectionError = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tawait this.updateAvailableProviderCount();\n\tthis.setupAutocompleteProvider();\n\tthis.footer.invalidate();\n\tthis.updateEditorBorderColor();\n\tif (selectedModel) {\n\t\tthis.showStatus(`${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`);\n\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n\t\tthis.checkDaxnutsEasterEgg(selectedModel);\n\t} else {\n\t\tthis.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);\n\t\tif (selectionError) {\n\t\t\tthis.showError(selectionError);\n\t\t} else {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth();\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showBedrockSetupDialog = function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tonBack?: () => void,\n): void {\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t() => {\n\t\t\trestoreEditor();\n\t\t\tonBack?.();\n\t\t},\n\t\tproviderName,\n\t\t\"Amazon Bedrock setup\",\n\t);\n\tdialog.showDetails([\n\t\ttheme.fg(\"text\", \"Amazon Bedrock uses AWS credentials instead of a single API key.\"),\n\t\ttheme.fg(\"text\", \"Configure an AWS profile, IAM keys, bearer token, or role-based credentials.\"),\n\t\ttheme.fg(\"muted\", \"See:\"),\n\t\ttheme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n\t]);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.showApiKeyLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tonBack?: () => void,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\ttry {\n\t\tconst loginResult = await this.runtimeHost.loginApiKeyProvider(providerId, {\n\t\t\tsignal: dialog.signal,\n\t\t\tprompt: (prompt) =>\n\t\t\t\tdialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined),\n\t\t\tnotify: (event) => {\n\t\t\t\tif (event.type === \"info\") dialog.showInfo(event.message, event.links);\n\t\t\t\telse if (event.type === \"progress\") dialog.showProgress(event.message);\n\t\t\t},\n\t\t});\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"api_key\", previousModel, loginResult);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(\n\t\t\t\t`Saved API key for ${providerName}, but local model state could not be synchronized: ${errorMsg}`,\n\t\t\t);\n\t\t} else if (isOAuthLoginCancelled(error)) {\n\t\t\tonBack?.();\n\t\t} else {\n\t\t\tthis.showError(`Failed to save API key for ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showOAuthLoginSelect = function (\n\tthis: InteractiveModeBase,\n\tdialog: LoginDialogComponent,\n\tprompt: OAuthSelectPrompt,\n): Promise<string | undefined> {\n\treturn new Promise((resolve) => {\n\t\tconst restoreDialog = () => {\n\t\t\tthis.editorContainer.clear();\n\t\t\tthis.editorContainer.addChild(dialog);\n\t\t\tthis.ui.setFocus(dialog);\n\t\t\tthis.ui.requestRender();\n\t\t};\n\t\tconst labels = prompt.options.map((option) => option.label);\n\t\tconst selector = new ExtensionSelectorComponent(\n\t\t\tprompt.message,\n\t\t\tlabels,\n\t\t\t(optionLabel) => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(prompt.options.find((option) => option.label === optionLabel)?.id);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(undefined);\n\t\t\t},\n\t\t);\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(selector);\n\t\tthis.ui.setFocus(selector);\n\t\tthis.ui.requestRender();\n\t});\n};\n\nInteractiveModeBase.prototype.showLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tonBack?: () => void,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\tconst metadata = this.session.modelRuntime?.getOAuthProviderMetadata().find(({ id }) => id === providerId);\n\tconst usesCallbackServer = metadata?.usesCallbackServer === true;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t\tmetadata?.loginLabel,\n\t);\n\n\t// Show dialog in editor container\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\t// Promise for manual code input (racing with callback server)\n\tlet manualCodeResolve: ((code: string) => void) | undefined;\n\tlet manualCodeReject: ((err: Error) => void) | undefined;\n\tconst manualCodePromise = new Promise<string>((resolve, reject) => {\n\t\tmanualCodeResolve = resolve;\n\t\tmanualCodeReject = reject;\n\t});\n\n\t// Restore editor helper\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tlet loginSucceeded = false;\n\ttry {\n\t\tconst loginResult = await this.runtimeHost.loginOAuthProvider(providerId, {\n\t\t\tonAuth: (info: { url: string; instructions?: string }) => {\n\t\t\t\tdialog.showAuth(info.url, info.instructions, {\n\t\t\t\t\tshowCancelHint: !usesCallbackServer,\n\t\t\t\t});\n\n\t\t\t\tif (usesCallbackServer) {\n\t\t\t\t\t// Show input for manual paste, racing with callback\n\t\t\t\t\tdialog\n\t\t\t\t\t\t.showManualInput(\"Paste redirect URL below, or complete login in browser:\")\n\t\t\t\t\t\t.then((value) => {\n\t\t\t\t\t\t\tif (value && manualCodeResolve) {\n\t\t\t\t\t\t\t\tmanualCodeResolve(value);\n\t\t\t\t\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(() => {\n\t\t\t\t\t\t\tif (manualCodeReject) {\n\t\t\t\t\t\t\t\tmanualCodeReject(new Error(\"Login cancelled\"));\n\t\t\t\t\t\t\t\tmanualCodeReject = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// For Anthropic: onPrompt is called immediately after\n\t\t\t},\n\n\t\t\tonDeviceCode: (info) => {\n\t\t\t\tdialog.showDeviceCode(info);\n\t\t\t\tdialog.showWaiting(\"Waiting for authentication...\");\n\t\t\t},\n\n\t\t\tonPrompt: async (prompt: { message: string; placeholder?: string }) => {\n\t\t\t\treturn dialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined);\n\t\t\t},\n\n\t\t\tonProgress: (message: string) => {\n\t\t\t\tdialog.showProgress(message);\n\t\t\t},\n\n\t\t\tonInfo: (message, links) => {\n\t\t\t\tdialog.showInfo(message, links);\n\t\t\t},\n\n\t\t\tonSelect: (prompt: OAuthSelectPrompt) => this.showOAuthLoginSelect(dialog, prompt),\n\n\t\t\tonManualCodeInput: () => manualCodePromise,\n\n\t\t\tonManualCodeCancel: () => {\n\t\t\t\tdialog.dismissPendingInput();\n\t\t\t\tmanualCodeResolve?.(\"\");\n\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\tmanualCodeReject = undefined;\n\t\t\t},\n\n\t\t\tsignal: dialog.signal,\n\t\t});\n\t\tloginSucceeded = true;\n\n\t\t// Success\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"oauth\", previousModel, loginResult);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(`Logged in to ${providerName}, but local model state could not be synchronized: ${errorMsg}`);\n\t\t} else if (loginSucceeded || !isOAuthLoginCancelled(error)) {\n\t\t\tthis.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t} else {\n\t\t\tonBack?.();\n\t\t}\n\t}\n};\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-auth-login.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;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AC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,KAAK,YAAY,8BAA8B,EAAE,CAAC;YACrD,IAAI,CAAC,SAAS,CAAC,gBAAgB,YAAY,sDAAsD,QAAQ,EAAE,CAAC,CAAC;QAC9G,CAAC;aAAM,IAAI,cAAc,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACP,MAAM,EAAE,EAAE,CAAC;QACZ,CAAC;IACF,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { CredentialSynchronizationError } from \"../../core/model-runtime.js\";\nimport { isOAuthLoginCancelled } from \"../../core/oauth-login.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Api,\n\tdefaultModelPerProvider,\n\tExtensionSelectorComponent,\n\tgetAuthPath,\n\tgetDocsPath,\n\tLoginDialogComponent,\n\ttype Model,\n\ttype OAuthSelectPrompt,\n\tpath,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport { hasDefaultModelProvider, isUnknownModel } from \"./interactive-mode-helpers.ts\";\n\nexport function llamaCppPostLoginGuidance(actionLabel: string, loadedModelCount: number): string {\n\treturn loadedModelCount === 0\n\t\t? `${actionLabel}. No llama.cpp models are loaded. Use /llama to load a model, then /model to select it.`\n\t\t: `${actionLabel}. Use /model to select a loaded llama.cpp model, or /llama to manage models.`;\n}\n\nInteractiveModeBase.prototype.completeProviderAuthentication = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tauthType: \"oauth\" | \"api_key\",\n\tpreviousModel: Model<Api> | undefined,\n\toptions: { modelsRefreshed?: boolean } = {},\n): Promise<void> {\n\tif (!options.modelsRefreshed) {\n\t\t// Match pi: after authentication persists the credential, a thrown catalog\n\t\t// refresh failure remains visible to the caller without rolling it back.\n\t\tawait this.session.modelRuntime.refresh();\n\t}\n\n\tconst actionLabel = authType === \"oauth\" ? `Logged in to ${providerName}` : `Saved API key for ${providerName}`;\n\n\tlet selectedModel: Model<Api> | undefined;\n\tlet selectionError: string | undefined;\n\tif (providerId !== \"typesafe\" && isUnknownModel(previousModel)) {\n\t\tconst availableModels = this.session.modelRuntime.getAvailableSnapshot();\n\t\tconst providerModels = availableModels.filter((model) => model.provider === providerId);\n\t\tif (providerId === \"llama.cpp\") {\n\t\t\tselectionError = llamaCppPostLoginGuidance(actionLabel, providerModels.length);\n\t\t} else if (!hasDefaultModelProvider(providerId)) {\n\t\t\tselectionError = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n\t\t} else if (providerModels.length === 0) {\n\t\t\tselectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\n\t\t} else {\n\t\t\tconst defaultModelId = defaultModelPerProvider[providerId];\n\t\t\tselectedModel =\n\t\t\t\tproviderModels.find((model) => model.id === defaultModelId) ??\n\t\t\t\t(providerId === \"radius\" ? providerModels[0] : undefined);\n\t\t\tif (!selectedModel) {\n\t\t\t\tselectionError = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.session.setModel(selectedModel);\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tselectedModel = undefined;\n\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tselectionError = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tawait this.updateAvailableProviderCount();\n\tthis.setupAutocompleteProvider();\n\tthis.footer.invalidate();\n\tthis.updateEditorBorderColor();\n\tif (selectedModel) {\n\t\tthis.showStatus(`${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`);\n\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n\t} else {\n\t\tthis.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);\n\t\tif (selectionError) {\n\t\t\tthis.showError(selectionError);\n\t\t} else {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth();\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showBedrockSetupDialog = function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tonBack?: () => void,\n): void {\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t() => {\n\t\t\trestoreEditor();\n\t\t\tonBack?.();\n\t\t},\n\t\tproviderName,\n\t\t\"Amazon Bedrock setup\",\n\t);\n\tdialog.showDetails([\n\t\ttheme.fg(\"text\", \"Amazon Bedrock uses AWS credentials instead of a single API key.\"),\n\t\ttheme.fg(\"text\", \"Configure an AWS profile, IAM keys, bearer token, or role-based credentials.\"),\n\t\ttheme.fg(\"muted\", \"See:\"),\n\t\ttheme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n\t]);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.showApiKeyLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tonBack?: () => void,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\ttry {\n\t\tconst loginResult = await this.runtimeHost.loginApiKeyProvider(providerId, {\n\t\t\tsignal: dialog.signal,\n\t\t\tprompt: (prompt) =>\n\t\t\t\tdialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined),\n\t\t\tnotify: (event) => {\n\t\t\t\tif (event.type === \"info\") dialog.showInfo(event.message, event.links);\n\t\t\t\telse if (event.type === \"progress\") dialog.showProgress(event.message);\n\t\t\t},\n\t\t});\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"api_key\", previousModel, loginResult);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(\n\t\t\t\t`Saved API key for ${providerName}, but local model state could not be synchronized: ${errorMsg}`,\n\t\t\t);\n\t\t} else if (isOAuthLoginCancelled(error)) {\n\t\t\tonBack?.();\n\t\t} else {\n\t\t\tthis.showError(`Failed to save API key for ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showOAuthLoginSelect = function (\n\tthis: InteractiveModeBase,\n\tdialog: LoginDialogComponent,\n\tprompt: OAuthSelectPrompt,\n): Promise<string | undefined> {\n\treturn new Promise((resolve) => {\n\t\tconst restoreDialog = () => {\n\t\t\tthis.editorContainer.clear();\n\t\t\tthis.editorContainer.addChild(dialog);\n\t\t\tthis.ui.setFocus(dialog);\n\t\t\tthis.ui.requestRender();\n\t\t};\n\t\tconst labels = prompt.options.map((option) => option.label);\n\t\tconst selector = new ExtensionSelectorComponent(\n\t\t\tprompt.message,\n\t\t\tlabels,\n\t\t\t(optionLabel) => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(prompt.options.find((option) => option.label === optionLabel)?.id);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(undefined);\n\t\t\t},\n\t\t);\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(selector);\n\t\tthis.ui.setFocus(selector);\n\t\tthis.ui.requestRender();\n\t});\n};\n\nInteractiveModeBase.prototype.showLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tonBack?: () => void,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\tconst metadata = this.session.modelRuntime?.getOAuthProviderMetadata().find(({ id }) => id === providerId);\n\tconst usesCallbackServer = metadata?.usesCallbackServer === true;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t\tmetadata?.loginLabel,\n\t);\n\n\t// Show dialog in editor container\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\t// Promise for manual code input (racing with callback server)\n\tlet manualCodeResolve: ((code: string) => void) | undefined;\n\tlet manualCodeReject: ((err: Error) => void) | undefined;\n\tconst manualCodePromise = new Promise<string>((resolve, reject) => {\n\t\tmanualCodeResolve = resolve;\n\t\tmanualCodeReject = reject;\n\t});\n\n\t// Restore editor helper\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tlet loginSucceeded = false;\n\ttry {\n\t\tconst loginResult = await this.runtimeHost.loginOAuthProvider(providerId, {\n\t\t\tonAuth: (info: { url: string; instructions?: string }) => {\n\t\t\t\tdialog.showAuth(info.url, info.instructions, {\n\t\t\t\t\tshowCancelHint: !usesCallbackServer,\n\t\t\t\t});\n\n\t\t\t\tif (usesCallbackServer) {\n\t\t\t\t\t// Show input for manual paste, racing with callback\n\t\t\t\t\tdialog\n\t\t\t\t\t\t.showManualInput(\"Paste redirect URL below, or complete login in browser:\")\n\t\t\t\t\t\t.then((value) => {\n\t\t\t\t\t\t\tif (value && manualCodeResolve) {\n\t\t\t\t\t\t\t\tmanualCodeResolve(value);\n\t\t\t\t\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(() => {\n\t\t\t\t\t\t\tif (manualCodeReject) {\n\t\t\t\t\t\t\t\tmanualCodeReject(new Error(\"Login cancelled\"));\n\t\t\t\t\t\t\t\tmanualCodeReject = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// For Anthropic: onPrompt is called immediately after\n\t\t\t},\n\n\t\t\tonDeviceCode: (info) => {\n\t\t\t\tdialog.showDeviceCode(info);\n\t\t\t\tdialog.showWaiting(\"Waiting for authentication...\");\n\t\t\t},\n\n\t\t\tonPrompt: async (prompt: { message: string; placeholder?: string }) => {\n\t\t\t\treturn dialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined);\n\t\t\t},\n\n\t\t\tonProgress: (message: string) => {\n\t\t\t\tdialog.showProgress(message);\n\t\t\t},\n\n\t\t\tonInfo: (message, links) => {\n\t\t\t\tdialog.showInfo(message, links);\n\t\t\t},\n\n\t\t\tonSelect: (prompt: OAuthSelectPrompt) => this.showOAuthLoginSelect(dialog, prompt),\n\n\t\t\tonManualCodeInput: () => manualCodePromise,\n\n\t\t\tonManualCodeCancel: () => {\n\t\t\t\tdialog.dismissPendingInput();\n\t\t\t\tmanualCodeResolve?.(\"\");\n\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\tmanualCodeReject = undefined;\n\t\t\t},\n\n\t\t\tsignal: dialog.signal,\n\t\t});\n\t\tloginSucceeded = true;\n\n\t\t// Success\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"oauth\", previousModel, loginResult);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(`Logged in to ${providerName}, but local model state could not be synchronized: ${errorMsg}`);\n\t\t} else if (loginSucceeded || !isOAuthLoginCancelled(error)) {\n\t\t\tthis.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t} else {\n\t\t\tonBack?.();\n\t\t}\n\t}\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InteractiveModeBase } from "./interactive-mode-base.js";
|
|
2
|
-
import { ArminComponent,
|
|
2
|
+
import { ArminComponent, DynamicBorder, EarendilAnnouncementComponent, formatKeyText, fs, getDebugLogPath, keyDisplayText, Markdown, path, Spacer, Text, theme, visibleWidth, } from "./interactive-mode-deps.js";
|
|
3
3
|
InteractiveModeBase.prototype.getAppKeyDisplay = function (action) {
|
|
4
4
|
return keyDisplayText(action);
|
|
5
5
|
};
|
|
@@ -172,14 +172,4 @@ InteractiveModeBase.prototype.handleDementedDelves = function () {
|
|
|
172
172
|
this.chatContainer.addChild(new EarendilAnnouncementComponent());
|
|
173
173
|
this.ui.requestRender();
|
|
174
174
|
};
|
|
175
|
-
InteractiveModeBase.prototype.handleDaxnuts = function () {
|
|
176
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
177
|
-
this.chatContainer.addChild(new DaxnutsComponent(this.ui));
|
|
178
|
-
this.ui.requestRender();
|
|
179
|
-
};
|
|
180
|
-
InteractiveModeBase.prototype.checkDaxnutsEasterEgg = function (model) {
|
|
181
|
-
if (model.provider === "opencode" && model.id.toLowerCase().includes("kimi-k2.5")) {
|
|
182
|
-
this.handleDaxnuts();
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
175
|
//# sourceMappingURL=interactive-hotkeys-debug.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACnF,IAAI,CAAC,aAAa,EAAE,CAAC;IACtB,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AppKeybinding,\n\tArminComponent,\n\tDaxnutsComponent,\n\tDynamicBorder,\n\tEarendilAnnouncementComponent,\n\tformatKeyText,\n\tfs,\n\tgetDebugLogPath,\n\ttype Keybinding,\n\tkeyDisplayText,\n\tMarkdown,\n\tpath,\n\tSpacer,\n\tText,\n\ttheme,\n\tvisibleWidth,\n} from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.getAppKeyDisplay = function (this: InteractiveModeBase, action: AppKeybinding): string {\n\treturn keyDisplayText(action);\n};\n\nInteractiveModeBase.prototype.getEditorKeyDisplay = function (this: InteractiveModeBase, action: Keybinding): string {\n\treturn keyDisplayText(action);\n};\n\nInteractiveModeBase.prototype.handleHotkeysCommand = function (this: InteractiveModeBase): void {\n\t// Navigation keybindings\n\tconst cursorUp = this.getEditorKeyDisplay(\"tui.editor.cursorUp\");\n\tconst cursorDown = this.getEditorKeyDisplay(\"tui.editor.cursorDown\");\n\tconst cursorLeft = this.getEditorKeyDisplay(\"tui.editor.cursorLeft\");\n\tconst cursorRight = this.getEditorKeyDisplay(\"tui.editor.cursorRight\");\n\tconst cursorWordLeft = this.getEditorKeyDisplay(\"tui.editor.cursorWordLeft\");\n\tconst cursorWordRight = this.getEditorKeyDisplay(\"tui.editor.cursorWordRight\");\n\tconst cursorLineStart = this.getEditorKeyDisplay(\"tui.editor.cursorLineStart\");\n\tconst cursorLineEnd = this.getEditorKeyDisplay(\"tui.editor.cursorLineEnd\");\n\tconst jumpForward = this.getEditorKeyDisplay(\"tui.editor.jumpForward\");\n\tconst jumpBackward = this.getEditorKeyDisplay(\"tui.editor.jumpBackward\");\n\tconst pageUp = this.getEditorKeyDisplay(\"tui.editor.pageUp\");\n\tconst pageDown = this.getEditorKeyDisplay(\"tui.editor.pageDown\");\n\n\t// Editing keybindings\n\tconst submit = this.getEditorKeyDisplay(\"tui.input.submit\");\n\tconst newLine = this.getEditorKeyDisplay(\"tui.input.newLine\");\n\tconst deleteWordBackward = this.getEditorKeyDisplay(\"tui.editor.deleteWordBackward\");\n\tconst deleteWordForward = this.getEditorKeyDisplay(\"tui.editor.deleteWordForward\");\n\tconst deleteToLineStart = this.getEditorKeyDisplay(\"tui.editor.deleteToLineStart\");\n\tconst deleteToLineEnd = this.getEditorKeyDisplay(\"tui.editor.deleteToLineEnd\");\n\tconst yank = this.getEditorKeyDisplay(\"tui.editor.yank\");\n\tconst yankPop = this.getEditorKeyDisplay(\"tui.editor.yankPop\");\n\tconst undo = this.getEditorKeyDisplay(\"tui.editor.undo\");\n\tconst tab = this.getEditorKeyDisplay(\"tui.input.tab\");\n\n\t// App keybindings\n\tconst interrupt = this.getAppKeyDisplay(\"app.interrupt\");\n\tconst clear = this.getAppKeyDisplay(\"app.clear\");\n\tconst exit = this.getAppKeyDisplay(\"app.exit\");\n\tconst suspend = this.getAppKeyDisplay(\"app.suspend\");\n\tconst cycleThinkingLevel = this.getAppKeyDisplay(\"app.thinking.cycle\");\n\tconst cycleModelForward = this.getAppKeyDisplay(\"app.model.cycleForward\");\n\tconst selectModel = this.getAppKeyDisplay(\"app.model.select\");\n\tconst expandTools = this.getAppKeyDisplay(\"app.tools.expand\");\n\tconst toggleThinking = this.getAppKeyDisplay(\"app.thinking.toggle\");\n\tconst externalEditor = this.getAppKeyDisplay(\"app.editor.external\");\n\tconst cycleModelBackward = this.getAppKeyDisplay(\"app.model.cycleBackward\");\n\tconst followUp = this.getAppKeyDisplay(\"app.message.followUp\");\n\tconst dequeue = this.getAppKeyDisplay(\"app.message.dequeue\");\n\tconst pasteImage = this.getAppKeyDisplay(\"app.clipboard.pasteImage\");\n\n\tlet hotkeys = `\n**Navigation**\n| Key | Action |\n|-----|--------|\n| \\`${cursorUp}\\` / \\`${cursorDown}\\` / \\`${cursorLeft}\\` / \\`${cursorRight}\\` | Move cursor / browse history (Up when empty) |\n| \\`${cursorWordLeft}\\` / \\`${cursorWordRight}\\` | Move by word |\n| \\`${cursorLineStart}\\` | Start of line |\n| \\`${cursorLineEnd}\\` | End of line |\n| \\`${jumpForward}\\` | Jump forward to character |\n| \\`${jumpBackward}\\` | Jump backward to character |\n| \\`${pageUp}\\` / \\`${pageDown}\\` | Scroll by page |\n\n**Editing**\n| Key | Action |\n|-----|--------|\n| \\`${submit}\\` | Send message |\n| \\`${newLine}\\` | New line${process.platform === \"win32\" ? \" (ctrl+enter on Windows Terminal)\" : \"\"} |\n| \\`${deleteWordBackward}\\` | Delete word backwards |\n| \\`${deleteWordForward}\\` | Delete word forwards |\n| \\`${deleteToLineStart}\\` | Delete to start of line |\n| \\`${deleteToLineEnd}\\` | Delete to end of line |\n| \\`${yank}\\` | Paste the most-recently-deleted text |\n| \\`${yankPop}\\` | Cycle through the deleted text after pasting |\n| \\`${undo}\\` | Undo |\n\n**Other**\n| Key | Action |\n|-----|--------|\n| \\`${tab}\\` | Path completion / accept autocomplete |\n| \\`${interrupt}\\` | Cancel autocomplete / abort streaming |\n| \\`${clear}\\` | Clear editor (first) / exit (second) |\n| \\`${exit}\\` | Exit (when editor is empty) |\n| \\`${suspend}\\` | Suspend to background |\n| \\`${cycleThinkingLevel}\\` | Cycle thinking level |\n| \\`${cycleModelForward}\\` / \\`${cycleModelBackward}\\` | Cycle models |\n| \\`${selectModel}\\` | Open model selector |\n| \\`${expandTools}\\` | Toggle tool output expansion |\n| \\`${toggleThinking}\\` | Toggle thinking block visibility |\n| \\`${externalEditor}\\` | Edit message in external editor |\n| \\`${followUp}\\` | Queue follow-up message |\n| \\`${dequeue}\\` | Restore queued messages |\n| \\`${pasteImage}\\` | Paste files on macOS, images, or text from clipboard |\n| \\`/\\` | Slash commands |\n| \\`!\\` | Run bash command |\n| \\`!!\\` | Run bash command (excluded from context) |\n`;\n\n\t// Add extension-registered shortcuts\n\tconst extensionRunner = this.session.extensionRunner;\n\tconst shortcuts = extensionRunner.getShortcuts(this.keybindings.getEffectiveConfig());\n\tif (shortcuts.size > 0) {\n\t\thotkeys += `\n**Extensions**\n| Key | Action |\n|-----|--------|\n`;\n\t\tfor (const [key, shortcut] of shortcuts) {\n\t\t\tconst description = shortcut.description ?? shortcut.extensionPath;\n\t\t\tconst keyDisplay = formatKeyText(key, { capitalize: true });\n\t\t\thotkeys += `| \\`${keyDisplay}\\` | ${description} |\\n`;\n\t\t}\n\t}\n\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new DynamicBorder());\n\tthis.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Keyboard Shortcuts\")), 1, 0));\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 1, this.getMarkdownThemeWithSettings()));\n\tthis.chatContainer.addChild(new DynamicBorder());\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleClearCommand = async function (this: InteractiveModeBase): Promise<void> {\n\tawait this.ensureDeferredStartupComplete();\n\tInteractiveModeBase.prototype.clearWorkingLoader.call(this);\n\ttry {\n\t\tconst result = await this.runtimeHost.newSession();\n\t\tif (result.cancelled) {\n\t\t\treturn;\n\t\t}\n\t\tthis.renderCurrentSessionState();\n\t\tif (this.firstRunNoticeVisible) {\n\t\t\tthis.clearFirstRunOnboardingUi();\n\t\t}\n\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\tthis.chatContainer.addChild(new Text(`${theme.fg(\"accent\", \"✓ New session started\")}`, 1, 1));\n\t\tthis.ui.requestRender();\n\t} catch (error: unknown) {\n\t\tawait this.handleFatalRuntimeError(\"Failed to create session\", error);\n\t}\n};\n\nInteractiveModeBase.prototype.handleDebugCommand = function (this: InteractiveModeBase): void {\n\tconst width = this.ui.terminal.columns;\n\tconst height = this.ui.terminal.rows;\n\tconst allLines = this.ui.render(width);\n\n\tconst debugLogPath = getDebugLogPath();\n\tconst debugData = [\n\t\t`Debug output at ${new Date().toISOString()}`,\n\t\t`Terminal: ${width}x${height}`,\n\t\t`Total lines: ${allLines.length}`,\n\t\t\"\",\n\t\t\"=== All rendered lines with visible widths ===\",\n\t\t...allLines.map((line, idx) => {\n\t\t\tconst vw = visibleWidth(line);\n\t\t\tconst escaped = JSON.stringify(line);\n\t\t\treturn `[${idx}] (w=${vw}) ${escaped}`;\n\t\t}),\n\t\t\"\",\n\t\t\"=== Agent messages (JSONL) ===\",\n\t\t...this.session.messages.map((msg) => JSON.stringify(msg)),\n\t\t\"\",\n\t].join(\"\\n\");\n\n\tfs.mkdirSync(path.dirname(debugLogPath), { recursive: true });\n\tfs.writeFileSync(debugLogPath, debugData);\n\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(`${theme.fg(\"accent\", \"✓ Debug log written\")}\\n${theme.fg(\"muted\", debugLogPath)}`, 1, 1),\n\t);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleArminSaysHi = function (this: InteractiveModeBase): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new ArminComponent(this.ui));\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleDementedDelves = function (this: InteractiveModeBase): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new EarendilAnnouncementComponent());\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleDaxnuts = function (this: InteractiveModeBase): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new DaxnutsComponent(this.ui));\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.checkDaxnutsEasterEgg = function (\n\tthis: InteractiveModeBase,\n\tmodel: { provider: string; id: string },\n): void {\n\tif (model.provider === \"opencode\" && model.id.toLowerCase().includes(\"kimi-k2.5\")) {\n\t\tthis.handleDaxnuts();\n\t}\n};\n"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KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAClG,CAAC;IACF,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;AACzB,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,iBAAiB,GAAG;IACjD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;AACzB,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,oBAAoB,GAAG;IACpD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,6BAA6B,EAAE,CAAC,CAAC;IACjE,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;AACzB,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AppKeybinding,\n\tArminComponent,\n\tDynamicBorder,\n\tEarendilAnnouncementComponent,\n\tformatKeyText,\n\tfs,\n\tgetDebugLogPath,\n\ttype Keybinding,\n\tkeyDisplayText,\n\tMarkdown,\n\tpath,\n\tSpacer,\n\tText,\n\ttheme,\n\tvisibleWidth,\n} from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.getAppKeyDisplay = function (this: InteractiveModeBase, action: AppKeybinding): string {\n\treturn keyDisplayText(action);\n};\n\nInteractiveModeBase.prototype.getEditorKeyDisplay = function (this: InteractiveModeBase, action: Keybinding): string {\n\treturn keyDisplayText(action);\n};\n\nInteractiveModeBase.prototype.handleHotkeysCommand = function (this: InteractiveModeBase): void {\n\t// Navigation keybindings\n\tconst cursorUp = this.getEditorKeyDisplay(\"tui.editor.cursorUp\");\n\tconst cursorDown = this.getEditorKeyDisplay(\"tui.editor.cursorDown\");\n\tconst cursorLeft = this.getEditorKeyDisplay(\"tui.editor.cursorLeft\");\n\tconst cursorRight = this.getEditorKeyDisplay(\"tui.editor.cursorRight\");\n\tconst cursorWordLeft = this.getEditorKeyDisplay(\"tui.editor.cursorWordLeft\");\n\tconst cursorWordRight = this.getEditorKeyDisplay(\"tui.editor.cursorWordRight\");\n\tconst cursorLineStart = this.getEditorKeyDisplay(\"tui.editor.cursorLineStart\");\n\tconst cursorLineEnd = this.getEditorKeyDisplay(\"tui.editor.cursorLineEnd\");\n\tconst jumpForward = this.getEditorKeyDisplay(\"tui.editor.jumpForward\");\n\tconst jumpBackward = this.getEditorKeyDisplay(\"tui.editor.jumpBackward\");\n\tconst pageUp = this.getEditorKeyDisplay(\"tui.editor.pageUp\");\n\tconst pageDown = this.getEditorKeyDisplay(\"tui.editor.pageDown\");\n\n\t// Editing keybindings\n\tconst submit = this.getEditorKeyDisplay(\"tui.input.submit\");\n\tconst newLine = this.getEditorKeyDisplay(\"tui.input.newLine\");\n\tconst deleteWordBackward = this.getEditorKeyDisplay(\"tui.editor.deleteWordBackward\");\n\tconst deleteWordForward = this.getEditorKeyDisplay(\"tui.editor.deleteWordForward\");\n\tconst deleteToLineStart = this.getEditorKeyDisplay(\"tui.editor.deleteToLineStart\");\n\tconst deleteToLineEnd = this.getEditorKeyDisplay(\"tui.editor.deleteToLineEnd\");\n\tconst yank = this.getEditorKeyDisplay(\"tui.editor.yank\");\n\tconst yankPop = this.getEditorKeyDisplay(\"tui.editor.yankPop\");\n\tconst undo = this.getEditorKeyDisplay(\"tui.editor.undo\");\n\tconst tab = this.getEditorKeyDisplay(\"tui.input.tab\");\n\n\t// App keybindings\n\tconst interrupt = this.getAppKeyDisplay(\"app.interrupt\");\n\tconst clear = this.getAppKeyDisplay(\"app.clear\");\n\tconst exit = this.getAppKeyDisplay(\"app.exit\");\n\tconst suspend = this.getAppKeyDisplay(\"app.suspend\");\n\tconst cycleThinkingLevel = this.getAppKeyDisplay(\"app.thinking.cycle\");\n\tconst cycleModelForward = this.getAppKeyDisplay(\"app.model.cycleForward\");\n\tconst selectModel = this.getAppKeyDisplay(\"app.model.select\");\n\tconst expandTools = this.getAppKeyDisplay(\"app.tools.expand\");\n\tconst toggleThinking = this.getAppKeyDisplay(\"app.thinking.toggle\");\n\tconst externalEditor = this.getAppKeyDisplay(\"app.editor.external\");\n\tconst cycleModelBackward = this.getAppKeyDisplay(\"app.model.cycleBackward\");\n\tconst followUp = this.getAppKeyDisplay(\"app.message.followUp\");\n\tconst dequeue = this.getAppKeyDisplay(\"app.message.dequeue\");\n\tconst pasteImage = this.getAppKeyDisplay(\"app.clipboard.pasteImage\");\n\n\tlet hotkeys = `\n**Navigation**\n| Key | Action |\n|-----|--------|\n| \\`${cursorUp}\\` / \\`${cursorDown}\\` / \\`${cursorLeft}\\` / \\`${cursorRight}\\` | Move cursor / browse history (Up when empty) |\n| \\`${cursorWordLeft}\\` / \\`${cursorWordRight}\\` | Move by word |\n| \\`${cursorLineStart}\\` | Start of line |\n| \\`${cursorLineEnd}\\` | End of line |\n| \\`${jumpForward}\\` | Jump forward to character |\n| \\`${jumpBackward}\\` | Jump backward to character |\n| \\`${pageUp}\\` / \\`${pageDown}\\` | Scroll by page |\n\n**Editing**\n| Key | Action |\n|-----|--------|\n| \\`${submit}\\` | Send message |\n| \\`${newLine}\\` | New line${process.platform === \"win32\" ? \" (ctrl+enter on Windows Terminal)\" : \"\"} |\n| \\`${deleteWordBackward}\\` | Delete word backwards |\n| \\`${deleteWordForward}\\` | Delete word forwards |\n| \\`${deleteToLineStart}\\` | Delete to start of line |\n| \\`${deleteToLineEnd}\\` | Delete to end of line |\n| \\`${yank}\\` | Paste the most-recently-deleted text |\n| \\`${yankPop}\\` | Cycle through the deleted text after pasting |\n| \\`${undo}\\` | Undo |\n\n**Other**\n| Key | Action |\n|-----|--------|\n| \\`${tab}\\` | Path completion / accept autocomplete |\n| \\`${interrupt}\\` | Cancel autocomplete / abort streaming |\n| \\`${clear}\\` | Clear editor (first) / exit (second) |\n| \\`${exit}\\` | Exit (when editor is empty) |\n| \\`${suspend}\\` | Suspend to background |\n| \\`${cycleThinkingLevel}\\` | Cycle thinking level |\n| \\`${cycleModelForward}\\` / \\`${cycleModelBackward}\\` | Cycle models |\n| \\`${selectModel}\\` | Open model selector |\n| \\`${expandTools}\\` | Toggle tool output expansion |\n| \\`${toggleThinking}\\` | Toggle thinking block visibility |\n| \\`${externalEditor}\\` | Edit message in external editor |\n| \\`${followUp}\\` | Queue follow-up message |\n| \\`${dequeue}\\` | Restore queued messages |\n| \\`${pasteImage}\\` | Paste files on macOS, images, or text from clipboard |\n| \\`/\\` | Slash commands |\n| \\`!\\` | Run bash command |\n| \\`!!\\` | Run bash command (excluded from context) |\n`;\n\n\t// Add extension-registered shortcuts\n\tconst extensionRunner = this.session.extensionRunner;\n\tconst shortcuts = extensionRunner.getShortcuts(this.keybindings.getEffectiveConfig());\n\tif (shortcuts.size > 0) {\n\t\thotkeys += `\n**Extensions**\n| Key | Action |\n|-----|--------|\n`;\n\t\tfor (const [key, shortcut] of shortcuts) {\n\t\t\tconst description = shortcut.description ?? shortcut.extensionPath;\n\t\t\tconst keyDisplay = formatKeyText(key, { capitalize: true });\n\t\t\thotkeys += `| \\`${keyDisplay}\\` | ${description} |\\n`;\n\t\t}\n\t}\n\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new DynamicBorder());\n\tthis.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Keyboard Shortcuts\")), 1, 0));\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 1, this.getMarkdownThemeWithSettings()));\n\tthis.chatContainer.addChild(new DynamicBorder());\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleClearCommand = async function (this: InteractiveModeBase): Promise<void> {\n\tawait this.ensureDeferredStartupComplete();\n\tInteractiveModeBase.prototype.clearWorkingLoader.call(this);\n\ttry {\n\t\tconst result = await this.runtimeHost.newSession();\n\t\tif (result.cancelled) {\n\t\t\treturn;\n\t\t}\n\t\tthis.renderCurrentSessionState();\n\t\tif (this.firstRunNoticeVisible) {\n\t\t\tthis.clearFirstRunOnboardingUi();\n\t\t}\n\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\tthis.chatContainer.addChild(new Text(`${theme.fg(\"accent\", \"✓ New session started\")}`, 1, 1));\n\t\tthis.ui.requestRender();\n\t} catch (error: unknown) {\n\t\tawait this.handleFatalRuntimeError(\"Failed to create session\", error);\n\t}\n};\n\nInteractiveModeBase.prototype.handleDebugCommand = function (this: InteractiveModeBase): void {\n\tconst width = this.ui.terminal.columns;\n\tconst height = this.ui.terminal.rows;\n\tconst allLines = this.ui.render(width);\n\n\tconst debugLogPath = getDebugLogPath();\n\tconst debugData = [\n\t\t`Debug output at ${new Date().toISOString()}`,\n\t\t`Terminal: ${width}x${height}`,\n\t\t`Total lines: ${allLines.length}`,\n\t\t\"\",\n\t\t\"=== All rendered lines with visible widths ===\",\n\t\t...allLines.map((line, idx) => {\n\t\t\tconst vw = visibleWidth(line);\n\t\t\tconst escaped = JSON.stringify(line);\n\t\t\treturn `[${idx}] (w=${vw}) ${escaped}`;\n\t\t}),\n\t\t\"\",\n\t\t\"=== Agent messages (JSONL) ===\",\n\t\t...this.session.messages.map((msg) => JSON.stringify(msg)),\n\t\t\"\",\n\t].join(\"\\n\");\n\n\tfs.mkdirSync(path.dirname(debugLogPath), { recursive: true });\n\tfs.writeFileSync(debugLogPath, debugData);\n\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(`${theme.fg(\"accent\", \"✓ Debug log written\")}\\n${theme.fg(\"muted\", debugLogPath)}`, 1, 1),\n\t);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleArminSaysHi = function (this: InteractiveModeBase): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new ArminComponent(this.ui));\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleDementedDelves = function (this: InteractiveModeBase): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(new EarendilAnnouncementComponent());\n\tthis.ui.requestRender();\n};\n"]}
|