@humain/humain-code 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/bundle/chunks/{anthropic-messages-UZB5HJE3.js → anthropic-messages-XFCDMGD6.js} +4 -4
- package/dist/bundle/chunks/{azure-openai-responses-J3LCMWPQ.js → azure-openai-responses-F4KQM3NK.js} +3 -3
- package/dist/bundle/chunks/{chunk-7EONJCBE.js → chunk-2JNJJ6SZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-WRYGY5XG.js → chunk-4MKATHT2.js} +1 -1
- package/dist/bundle/chunks/{chunk-ATFZAFMS.js → chunk-65FLSKDA.js} +1 -1
- package/dist/bundle/chunks/{chunk-CET2MXXN.js → chunk-6P6MMQUH.js} +1 -1
- package/dist/bundle/chunks/{chunk-CU6KU7JK.js → chunk-6TTMNQXI.js} +13 -13
- package/dist/bundle/chunks/{chunk-KQXXBQ57.js → chunk-6YVORXTX.js} +155 -125
- package/dist/bundle/chunks/{chunk-SQ7NTRLJ.js → chunk-7X6DNT45.js} +17 -16
- package/dist/bundle/chunks/{chunk-PGVDL4KB.js → chunk-CQ2CE3RB.js} +1 -1
- package/dist/bundle/chunks/{chunk-QRYDGY5I.js → chunk-DJG2WUNM.js} +1 -1
- package/dist/bundle/chunks/{chunk-R3VDXQW2.js → chunk-E7OBH44W.js} +5 -5
- package/dist/bundle/chunks/{chunk-4EV7CK26.js → chunk-F2H47FRF.js} +1 -1
- package/dist/bundle/chunks/chunk-FQ4KS5S4.js +23 -0
- package/dist/bundle/chunks/{chunk-TYN46EVI.js → chunk-GPLWWO5Q.js} +1 -1
- package/dist/bundle/chunks/{chunk-EMBIUIQ2.js → chunk-IMUFBWEK.js} +4 -4
- package/dist/bundle/chunks/{chunk-Z5UFSRO4.js → chunk-KI7CHPWC.js} +1 -1
- package/dist/bundle/chunks/{chunk-VKQNYZUA.js → chunk-KRBELWQH.js} +1 -1
- package/dist/bundle/chunks/{chunk-AI7EHDAX.js → chunk-LSRXA7OS.js} +1 -1
- package/dist/bundle/chunks/{chunk-XVIQYONJ.js → chunk-MIAXMK5F.js} +1 -1
- package/dist/bundle/chunks/{chunk-NNWNIBLG.js → chunk-NICPFMOP.js} +1 -1
- package/dist/bundle/chunks/{chunk-4SFWYKL5.js → chunk-P42E6YY6.js} +441 -415
- package/dist/bundle/chunks/{chunk-WGXMYMPE.js → chunk-PFBAIRCY.js} +2 -2
- package/dist/bundle/chunks/{chunk-OVDMYBIT.js → chunk-PWFM6AQQ.js} +1 -1
- package/dist/bundle/chunks/{chunk-JV7VHOAY.js → chunk-QRRVZYTG.js} +1 -1
- package/dist/bundle/chunks/{chunk-IOLLZXQN.js → chunk-ROFZVEFN.js} +125 -114
- package/dist/bundle/chunks/{chunk-C4DHVDYT.js → chunk-SXOIQWNX.js} +1 -1
- package/dist/bundle/chunks/{chunk-IXQYPQRQ.js → chunk-XZ7FTBXS.js} +1446 -1423
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-ETKC6B2S.js → cloudflare-workers-ai-system-one-JEZVYITT.js} +1 -1
- package/dist/bundle/chunks/{compat-HS4ARZK3.js → compat-SRCNS6OQ.js} +6 -6
- package/dist/bundle/chunks/{curator-server-TC7RVVN2.js → curator-server-QB4GITGS.js} +1 -1
- package/dist/bundle/chunks/{dist-5AQPJ2TI.js → dist-4OMLHRJE.js} +1 -1
- package/dist/bundle/chunks/{dist-NMEXYUP3.js → dist-CBODG4CA.js} +5 -5
- package/dist/bundle/chunks/{dist-DYB3AR7C.js → dist-TRAK7EXI.js} +7 -7
- package/dist/bundle/chunks/{extract-QHZTEVJP.js → extract-L373D6O7.js} +2 -2
- package/dist/bundle/chunks/{flow-implementer-QMN3HKE2.js → flow-implementer-4KO3Q4B5.js} +4 -4
- package/dist/bundle/chunks/github-copilot.js +53 -56
- package/dist/bundle/chunks/{google-generative-ai-ZND73WDQ.js → google-generative-ai-WIASMWS3.js} +2 -2
- package/dist/bundle/chunks/{google-vertex-YAH62YRM.js → google-vertex-WSPHRZIZ.js} +3 -3
- package/dist/bundle/chunks/{host-Q565BCXB.js → host-WOLZCWQQ.js} +1 -1
- package/dist/bundle/chunks/{inprocess-453SLFL5.js → inprocess-TOBRVK4C.js} +5 -5
- package/dist/bundle/chunks/{interactive-mode-MVZOJ5OU.js → interactive-mode-BJJKPBXD.js} +3 -3
- package/dist/bundle/chunks/{llama-cpp-classify-Z4GZY4GC.js → llama-cpp-classify-KYZT532X.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-7I5JURDP.js → mistral-conversations-7JYDDRUT.js} +2 -2
- package/dist/bundle/chunks/{node-IMSYVRPL.js → node-N7TPBUJB.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-LTHOMN37.js → openai-codex-responses-7PAML4NF.js} +3 -3
- package/dist/bundle/chunks/{openai-completions-W2X635EE.js → openai-completions-UJDAIGTK.js} +3 -3
- package/dist/bundle/chunks/{openai-decisions-TN2GNOYI.js → openai-decisions-JMSDGR7K.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-DVY4QXOG.js → openai-responses-2WNCE6AY.js} +3 -3
- package/dist/bundle/chunks/{openrouter-images-SE2JMS44.js → openrouter-images-V3UCCO6X.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-WAS6Z5L5.js → pi-messages-TQ7LJUNQ.js} +2 -2
- package/dist/bundle/chunks/{session-picker-XNVLSJ22.js → session-picker-4JQEGLDD.js} +1 -1
- package/dist/bundle/chunks/{startup-ui-3TCT465D.js → startup-ui-AKTA4NDP.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-AAZH6S3I.js → typesafe-system-one-YP7GGN4C.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-CIVXCEAN.js → virtual-modules-3CT5BMBA.js} +8 -8
- package/dist/bundle/cli-runtime.js +5 -5
- package/dist/bundle/index.js +8 -8
- package/dist/bundle/rpc-entry.js +4 -4
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +16 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +3 -2
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +3 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +11 -2
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/keybindings.d.ts +24 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +3 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +12 -1
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +11 -7
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +11 -2
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +23 -6
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/oauth-account-pool.d.ts +4 -0
- package/dist/core/oauth-account-pool.d.ts.map +1 -1
- package/dist/core/oauth-account-pool.js +104 -20
- package/dist/core/oauth-account-pool.js.map +1 -1
- package/dist/core/sdk.js +2 -2
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/extensions/usage/confirmation.d.ts.map +1 -1
- package/dist/extensions/usage/confirmation.js +1 -1
- package/dist/extensions/usage/confirmation.js.map +1 -1
- package/dist/extensions/usage/index.js +1 -1
- package/dist/extensions/usage/index.js.map +1 -1
- package/dist/extensions/usage/panes.d.ts +5 -0
- package/dist/extensions/usage/panes.d.ts.map +1 -0
- package/dist/extensions/usage/panes.js +10 -0
- package/dist/extensions/usage/panes.js.map +1 -0
- package/dist/extensions/usage/popup.d.ts.map +1 -1
- package/dist/extensions/usage/popup.js +9 -18
- package/dist/extensions/usage/popup.js.map +1 -1
- package/dist/humain/hcode/contracts.d.ts +15 -0
- package/dist/humain/hcode/contracts.d.ts.map +1 -1
- package/dist/humain/hcode/contracts.js +85 -10
- package/dist/humain/hcode/contracts.js.map +1 -1
- package/dist/humain/hcode/environment.d.ts.map +1 -1
- package/dist/humain/hcode/environment.js +4 -2
- package/dist/humain/hcode/environment.js.map +1 -1
- package/dist/humain/hcode/images.d.ts.map +1 -1
- package/dist/humain/hcode/images.js +4 -2
- package/dist/humain/hcode/images.js.map +1 -1
- package/dist/humain/hcode/login-copy.js +1 -1
- package/dist/humain/hcode/login-copy.js.map +1 -1
- package/dist/humain/hcode/notices.d.ts +22 -1
- package/dist/humain/hcode/notices.d.ts.map +1 -1
- package/dist/humain/hcode/notices.js +34 -3
- package/dist/humain/hcode/notices.js.map +1 -1
- package/dist/humain/hcode/provider.d.ts +3 -1
- package/dist/humain/hcode/provider.d.ts.map +1 -1
- package/dist/humain/hcode/provider.js +126 -46
- package/dist/humain/hcode/provider.js.map +1 -1
- package/dist/humain/hcode/run-credential.d.ts +21 -0
- package/dist/humain/hcode/run-credential.d.ts.map +1 -0
- package/dist/humain/hcode/run-credential.js +140 -0
- package/dist/humain/hcode/run-credential.js.map +1 -0
- package/dist/humain/hcode/sandbox.d.ts +6 -0
- package/dist/humain/hcode/sandbox.d.ts.map +1 -0
- package/dist/humain/hcode/sandbox.js +139 -0
- package/dist/humain/hcode/sandbox.js.map +1 -0
- package/dist/humain/hcode/selection.d.ts +7 -2
- package/dist/humain/hcode/selection.d.ts.map +1 -1
- package/dist/humain/hcode/selection.js +29 -5
- package/dist/humain/hcode/selection.js.map +1 -1
- package/dist/humain/hcode/transport.d.ts +3 -2
- package/dist/humain/hcode/transport.d.ts.map +1 -1
- package/dist/humain/hcode/transport.js +22 -7
- package/dist/humain/hcode/transport.js.map +1 -1
- package/dist/humain/remote/broker.d.ts +84 -0
- package/dist/humain/remote/broker.d.ts.map +1 -0
- package/dist/humain/remote/broker.js +427 -0
- package/dist/humain/remote/broker.js.map +1 -0
- package/dist/humain/remote/deny-store.d.ts +12 -0
- package/dist/humain/remote/deny-store.d.ts.map +1 -0
- package/dist/humain/remote/deny-store.js +164 -0
- package/dist/humain/remote/deny-store.js.map +1 -0
- package/dist/humain/remote/enablement.d.ts +5 -0
- package/dist/humain/remote/enablement.d.ts.map +1 -0
- package/dist/humain/remote/enablement.js +8 -0
- package/dist/humain/remote/enablement.js.map +1 -0
- package/dist/humain/remote/environment.d.ts +11 -0
- package/dist/humain/remote/environment.d.ts.map +1 -0
- package/dist/humain/remote/environment.js +19 -0
- package/dist/humain/remote/environment.js.map +1 -0
- package/dist/humain/remote/host-watch.d.ts +21 -0
- package/dist/humain/remote/host-watch.d.ts.map +1 -0
- package/dist/humain/remote/host-watch.js +186 -0
- package/dist/humain/remote/host-watch.js.map +1 -0
- package/dist/humain/remote/ipc-posix.d.ts +5 -0
- package/dist/humain/remote/ipc-posix.d.ts.map +1 -0
- package/dist/humain/remote/ipc-posix.js +29 -0
- package/dist/humain/remote/ipc-posix.js.map +1 -0
- package/dist/humain/remote/ipc-windows.d.ts +3 -0
- package/dist/humain/remote/ipc-windows.d.ts.map +1 -0
- package/dist/humain/remote/ipc-windows.js +5 -0
- package/dist/humain/remote/ipc-windows.js.map +1 -0
- package/dist/humain/remote/ipc.d.ts +10 -0
- package/dist/humain/remote/ipc.d.ts.map +1 -0
- package/dist/humain/remote/ipc.js +19 -0
- package/dist/humain/remote/ipc.js.map +1 -0
- package/dist/humain/remote/protocol.d.ts +43 -0
- package/dist/humain/remote/protocol.d.ts.map +1 -0
- package/dist/humain/remote/protocol.js +76 -0
- package/dist/humain/remote/protocol.js.map +1 -0
- package/dist/humain/remote/relay-socket.d.ts +30 -0
- package/dist/humain/remote/relay-socket.d.ts.map +1 -0
- package/dist/humain/remote/relay-socket.js +137 -0
- package/dist/humain/remote/relay-socket.js.map +1 -0
- package/dist/humain/remote/secure-channel.d.ts +10 -0
- package/dist/humain/remote/secure-channel.d.ts.map +1 -0
- package/dist/humain/remote/secure-channel.js +5 -0
- package/dist/humain/remote/secure-channel.js.map +1 -0
- package/dist/humain/remote/terminal.d.ts +48 -0
- package/dist/humain/remote/terminal.d.ts.map +1 -0
- package/dist/humain/remote/terminal.js +119 -0
- package/dist/humain/remote/terminal.js.map +1 -0
- package/dist/humain/remote/tickets.d.ts +35 -0
- package/dist/humain/remote/tickets.d.ts.map +1 -0
- package/dist/humain/remote/tickets.js +132 -0
- package/dist/humain/remote/tickets.js.map +1 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +13 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/account-picker.d.ts +31 -0
- package/dist/modes/interactive/components/account-picker.d.ts.map +1 -0
- package/dist/modes/interactive/components/account-picker.js +150 -0
- package/dist/modes/interactive/components/account-picker.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +15 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +225 -36
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/oauth-account-format.d.ts +9 -0
- package/dist/modes/interactive/oauth-account-format.d.ts.map +1 -1
- package/dist/modes/interactive/oauth-account-format.js +31 -22
- package/dist/modes/interactive/oauth-account-format.js.map +1 -1
- package/docs/cli.md +1 -1
- package/docs/forge-run-bootstrap.md +46 -0
- package/docs/humain-code.md +2 -2
- package/docs/index.md +2 -1
- package/docs/keybindings.md +10 -0
- package/docs/providers.md +2 -2
- package/docs/quickstart.md +16 -2
- package/docs/slash-commands.md +4 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/schemas/keybindings.schema.json +12 -0
- package/dist/bundle/chunks/chunk-J5TSAJGC.js +0 -22
|
@@ -58,9 +58,12 @@ import { watchHcodeCatalog } from "../../humain/hcode/catalog-watch.js";
|
|
|
58
58
|
import { hcodeDisplayName } from "../../humain/hcode/environment.js";
|
|
59
59
|
import { HCODE_PROVIDER } from "../../humain/hcode/http.js";
|
|
60
60
|
import { HCODE_LOGIN_MISMATCH_DETAILS, hcodeEmptyCatalogNotice, hcodeEmptyCatalogReason, hcodeLoginAvailability, hcodeSignedInElsewhereNotice, } from "../../humain/hcode/login-copy.js";
|
|
61
|
-
import { availableHcodeSelection, HCODE_SELECTION_CHANGED_MESSAGE, HCODE_UNSUPPORTED_THINKING_MESSAGE, } from "../../humain/hcode/selection.js";
|
|
61
|
+
import { availableHcodeSelection, HCODE_SELECTION_CHANGED_MESSAGE, HCODE_UNSUPPORTED_THINKING_MESSAGE, hcodeExcludedSelection, hcodeSelectionUnavailable, } from "../../humain/hcode/selection.js";
|
|
62
62
|
import { ACCOUNT_LOGIN_LABEL, API_KEY_LOGIN_LABEL, HUMAIN_LOGIN_LABEL, HUMAIN_SHIMMER_COLORS, humainLoginProviders, topLevelLoginOptions, } from "../../humain/login-menu.js";
|
|
63
63
|
import { RUNTIME_MODES, readDefaultMode, resolveSessionMode as resolvePonytailSessionMode, } from "../../humain/ponytail/index.js";
|
|
64
|
+
import { isRemoteHostEnabled } from "../../humain/remote/enablement.js";
|
|
65
|
+
import { watchCurrentBranch } from "../../humain/remote/host-watch.js";
|
|
66
|
+
import { bindRemoteTerminalSession, runRemoteCommand, } from "../../humain/remote/terminal.js";
|
|
64
67
|
import { raceWithAbortSignal, timerSignal } from "../../utils/abort.js";
|
|
65
68
|
import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelog } from "../../utils/changelog.js";
|
|
66
69
|
import { copyToClipboard, readClipboardFilePaths, readClipboardText } from "../../utils/clipboard.js";
|
|
@@ -77,6 +80,7 @@ import { checkForNewPiVersion } from "../../utils/version-check.js";
|
|
|
77
80
|
import { waitForSignalShutdown } from "../signal-shutdown.js";
|
|
78
81
|
import { reportBug } from "./bug-report.js";
|
|
79
82
|
import { createChatViewport } from "./chat-viewport.js";
|
|
83
|
+
import { AccountPickerComponent, } from "./components/account-picker.js";
|
|
80
84
|
import { ArminComponent } from "./components/armin.js";
|
|
81
85
|
import { AssistantMessageComponent } from "./components/assistant-message.js";
|
|
82
86
|
import { BashExecutionComponent } from "./components/bash-execution.js";
|
|
@@ -114,7 +118,7 @@ import { UserMessageSelectorComponent } from "./components/user-message-selector
|
|
|
114
118
|
import { editInExternalEditor } from "./external-editor.js";
|
|
115
119
|
import { checkWatchedHcodeCatalog, refreshModelCatalogs, refreshStartupModelCatalogs, retryHcodeCatalog, } from "./model-catalog-refresh.js";
|
|
116
120
|
import { getModelSearchText } from "./model-search.js";
|
|
117
|
-
import { formatOAuthAccountOption, formatOAuthAccountResetTime, formatOAuthAccountUsage, } from "./oauth-account-format.js";
|
|
121
|
+
import { formatOAuthAccountOption, formatOAuthAccountResetTime, formatOAuthAccountUsage, subscriptionAccountUsage, } from "./oauth-account-format.js";
|
|
118
122
|
import { ProgramStatusReporter } from "./program-status-reporter.js";
|
|
119
123
|
import { shareSession } from "./session-share.js";
|
|
120
124
|
import { DEFAULT_THEME_NAME, getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getSelectListTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
|
|
@@ -422,6 +426,9 @@ export class InteractiveMode {
|
|
|
422
426
|
// Custom header from extension (undefined = use built-in header)
|
|
423
427
|
customHeader = undefined;
|
|
424
428
|
options;
|
|
429
|
+
remoteTerminalLifetime;
|
|
430
|
+
remoteTerminalStopped = false;
|
|
431
|
+
remoteTerminal;
|
|
425
432
|
onRightClickPaste = () => {
|
|
426
433
|
void this.handleRightClickPaste();
|
|
427
434
|
};
|
|
@@ -448,6 +455,7 @@ export class InteractiveMode {
|
|
|
448
455
|
this.options = { ...options, tuiMode };
|
|
449
456
|
this.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd;
|
|
450
457
|
this.runtimeHost.setBeforeSessionInvalidate(() => {
|
|
458
|
+
this.remoteTerminal = undefined;
|
|
451
459
|
// The next session may bring a new model runtime; its account starts without the re-check.
|
|
452
460
|
this.hcodeCatalogWatch?.stop();
|
|
453
461
|
this.resetExtensionUI();
|
|
@@ -1136,8 +1144,7 @@ export class InteractiveMode {
|
|
|
1136
1144
|
else {
|
|
1137
1145
|
this.showWarning(this.hcodeCatalogFailed
|
|
1138
1146
|
? "Signed in to HUMAIN Code, but the model list could not be loaded. Use /model to retry."
|
|
1139
|
-
: (
|
|
1140
|
-
"The saved HUMAIN Code model is unavailable. Use /model to choose another."));
|
|
1147
|
+
: hcodeSelectionUnavailable(runtime, [savedId]));
|
|
1141
1148
|
}
|
|
1142
1149
|
}
|
|
1143
1150
|
await this.updateAvailableProviderCount();
|
|
@@ -2425,12 +2432,15 @@ export class InteractiveMode {
|
|
|
2425
2432
|
/**
|
|
2426
2433
|
* Show an extension dialog in the editor slot.
|
|
2427
2434
|
* Dialogs form a stack: a new dialog hides the visible one, and closing the visible dialog shows
|
|
2428
|
-
* the previous one again
|
|
2429
|
-
*
|
|
2435
|
+
* the previous one again, unless it requires uninterrupted local attention (Remote consent).
|
|
2436
|
+
* Dialogs opened from inside another dialog can still return to their parent.
|
|
2430
2437
|
*/
|
|
2431
|
-
pushExtensionDialog(component, blocked, cancel) {
|
|
2438
|
+
pushExtensionDialog(component, blocked, cancel, visibility) {
|
|
2432
2439
|
this.disposeActiveSelector();
|
|
2433
|
-
this.extensionDialogs.
|
|
2440
|
+
const covered = this.extensionDialogs.at(-1);
|
|
2441
|
+
this.extensionDialogs.push({ component, blocked, cancel, dismissOnCover: visibility === "foreground-only" });
|
|
2442
|
+
if (covered?.dismissOnCover)
|
|
2443
|
+
covered.cancel?.();
|
|
2434
2444
|
this.showTopExtensionDialog();
|
|
2435
2445
|
}
|
|
2436
2446
|
/** Close every extension dialog and settle its pending promise, then show the editor. */
|
|
@@ -2492,6 +2502,84 @@ export class InteractiveMode {
|
|
|
2492
2502
|
});
|
|
2493
2503
|
return result === "Yes";
|
|
2494
2504
|
}
|
|
2505
|
+
async handleRemoteCommand(input) {
|
|
2506
|
+
if (this.remoteTerminalStopped)
|
|
2507
|
+
return;
|
|
2508
|
+
const label = hcodeDisplayName(this.session.modelRuntime.hcode.environment.id);
|
|
2509
|
+
const owner = this.runtimeHost.sessionLifetime;
|
|
2510
|
+
let flags = this.options.featureFlags;
|
|
2511
|
+
const lookup = this.options.remoteFlagLookup;
|
|
2512
|
+
if (lookup) {
|
|
2513
|
+
try {
|
|
2514
|
+
flags = await lookup(owner);
|
|
2515
|
+
}
|
|
2516
|
+
catch {
|
|
2517
|
+
// Owner decision: a failed lookup must not block Remote; detail is withheld because it may carry credentials.
|
|
2518
|
+
this.showWarning(`${label}: Remote flag lookup failed; Remote stays available.`);
|
|
2519
|
+
}
|
|
2520
|
+
if (this.remoteTerminalStopped || owner.aborted)
|
|
2521
|
+
return;
|
|
2522
|
+
}
|
|
2523
|
+
// Disabled: no binding, broker, relay or pairing is ever touched.
|
|
2524
|
+
if (!isRemoteHostEnabled(flags)) {
|
|
2525
|
+
this.showWarning(`${label}: Remote is not enabled.`);
|
|
2526
|
+
return;
|
|
2527
|
+
}
|
|
2528
|
+
const binding = this.options.remoteWatch;
|
|
2529
|
+
if (binding)
|
|
2530
|
+
this.remoteTerminalLifetime ??= new AbortController();
|
|
2531
|
+
const terminal = this.remoteTerminalLifetime?.signal;
|
|
2532
|
+
if (owner.aborted || terminal?.aborted)
|
|
2533
|
+
return;
|
|
2534
|
+
const remote = this.remoteTerminal;
|
|
2535
|
+
const lifetime = remote?.owner === owner ? remote.lifetime : terminal ? AbortSignal.any([owner, terminal]) : owner;
|
|
2536
|
+
const ui = {
|
|
2537
|
+
notice: (message) => {
|
|
2538
|
+
if (!lifetime.aborted)
|
|
2539
|
+
this.showWarning(message);
|
|
2540
|
+
},
|
|
2541
|
+
confirm: (title, message, signal) => this.showRemoteConfirm(title, message, signal ? AbortSignal.any([signal, lifetime]) : lifetime),
|
|
2542
|
+
};
|
|
2543
|
+
if (binding && remote?.owner !== owner) {
|
|
2544
|
+
this.remoteTerminal = {
|
|
2545
|
+
owner,
|
|
2546
|
+
lifetime,
|
|
2547
|
+
session: bindRemoteTerminalSession({
|
|
2548
|
+
...binding,
|
|
2549
|
+
environment: this.session.modelRuntime.hcode.environment,
|
|
2550
|
+
lifetime,
|
|
2551
|
+
source: watchCurrentBranch(this.session),
|
|
2552
|
+
ui,
|
|
2553
|
+
}),
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
await runRemoteCommand(input, ui, this.remoteTerminal?.session, this.session.modelRuntime.hcode.environment.id);
|
|
2557
|
+
}
|
|
2558
|
+
/** Remote consent is local UI, not an agent question or a published blocked status. */
|
|
2559
|
+
showRemoteConfirm(title, message, signal) {
|
|
2560
|
+
if (signal?.aborted ||
|
|
2561
|
+
this.extensionDialogs.length ||
|
|
2562
|
+
this.activeSelectorToken ||
|
|
2563
|
+
this.extensionOverlays.size ||
|
|
2564
|
+
this.editorContainer.children[0] !== this.editor) {
|
|
2565
|
+
return Promise.resolve(false);
|
|
2566
|
+
}
|
|
2567
|
+
return new Promise((resolve) => {
|
|
2568
|
+
const finish = (allow) => {
|
|
2569
|
+
const current = this.extensionDialogs.at(-1)?.component === selector &&
|
|
2570
|
+
this.editorContainer.children[0] === selector &&
|
|
2571
|
+
!this.extensionOverlays.size;
|
|
2572
|
+
signal?.removeEventListener("abort", cancel);
|
|
2573
|
+
this.removeExtensionDialog(selector);
|
|
2574
|
+
resolve(allow && current && !signal?.aborted);
|
|
2575
|
+
};
|
|
2576
|
+
const cancel = () => finish(false);
|
|
2577
|
+
const selector = new ExtensionSelectorComponent(`${title}\n${message}`, ["No", "Yes"], (option) => finish(option === "Yes"), cancel);
|
|
2578
|
+
signal?.addEventListener("abort", cancel, { once: true });
|
|
2579
|
+
// Never resume a preselected Remote action after a different dialog takes focus.
|
|
2580
|
+
this.pushExtensionDialog(selector, undefined, cancel, "foreground-only");
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2495
2583
|
async promptForMissingSessionCwd(error) {
|
|
2496
2584
|
const confirmed = await this.showExtensionConfirm("Session cwd not found", formatMissingSessionCwdPrompt(error.issue));
|
|
2497
2585
|
return confirmed ? error.issue.fallbackCwd : undefined;
|
|
@@ -2685,7 +2773,12 @@ export class InteractiveMode {
|
|
|
2685
2773
|
const w = c.width;
|
|
2686
2774
|
return w ? { width: w } : undefined;
|
|
2687
2775
|
};
|
|
2688
|
-
|
|
2776
|
+
const overlayOptions = resolveOptions();
|
|
2777
|
+
const covered = this.extensionDialogs.at(-1);
|
|
2778
|
+
// Dismiss before mounting so dialog cleanup cannot steal the overlay's focus.
|
|
2779
|
+
if (covered?.dismissOnCover)
|
|
2780
|
+
covered.cancel?.();
|
|
2781
|
+
overlayHandle = this.ui.showOverlay(c, overlayOptions);
|
|
2689
2782
|
this.extensionOverlays.set(overlayHandle, removeOverlay);
|
|
2690
2783
|
// Expose handle to caller for visibility control
|
|
2691
2784
|
options?.onHandle?.(overlayHandle);
|
|
@@ -2910,6 +3003,11 @@ export class InteractiveMode {
|
|
|
2910
3003
|
this.editor.setText("");
|
|
2911
3004
|
return;
|
|
2912
3005
|
}
|
|
3006
|
+
if (/^\/remote(?:\s|$)/.test(text)) {
|
|
3007
|
+
this.editor.setText("");
|
|
3008
|
+
await this.handleRemoteCommand(text);
|
|
3009
|
+
return;
|
|
3010
|
+
}
|
|
2913
3011
|
if (text === "/share") {
|
|
2914
3012
|
await this.handleShareCommand();
|
|
2915
3013
|
this.editor.setText("");
|
|
@@ -3914,6 +4012,8 @@ export class InteractiveMode {
|
|
|
3914
4012
|
if (this.isShuttingDown)
|
|
3915
4013
|
return;
|
|
3916
4014
|
this.isShuttingDown = true;
|
|
4015
|
+
this.remoteTerminalStopped = true;
|
|
4016
|
+
this.remoteTerminalLifetime?.abort();
|
|
3917
4017
|
this.releaseFlowAccountsHost();
|
|
3918
4018
|
const termination = killTrackedDetachedChildrenAsync();
|
|
3919
4019
|
// Keep signal handlers registered until terminal cleanup has completed.
|
|
@@ -4867,6 +4967,14 @@ export class InteractiveMode {
|
|
|
4867
4967
|
const model = await this.findExactModelMatch(searchTerm);
|
|
4868
4968
|
if (this.session !== session)
|
|
4869
4969
|
return;
|
|
4970
|
+
// An explicitly managed ID cannot fall through to another provider's literal ID.
|
|
4971
|
+
if (!model || searchTerm.trim().toLowerCase().startsWith(`${HCODE_PROVIDER}/`)) {
|
|
4972
|
+
const excluded = hcodeExcludedSelection(session.modelRuntime, searchTerm);
|
|
4973
|
+
if (excluded) {
|
|
4974
|
+
this.showError(excluded);
|
|
4975
|
+
return;
|
|
4976
|
+
}
|
|
4977
|
+
}
|
|
4870
4978
|
if (model) {
|
|
4871
4979
|
try {
|
|
4872
4980
|
const notice = await this.session.setModelKeepingThinking(model);
|
|
@@ -5752,7 +5860,10 @@ export class InteractiveMode {
|
|
|
5752
5860
|
let unidentified = false;
|
|
5753
5861
|
try {
|
|
5754
5862
|
const options = { signal: AbortSignal.timeout(15_000) };
|
|
5755
|
-
accounts = await runtime.accounts.list(provider.id,
|
|
5863
|
+
accounts = await runtime.accounts.list(provider.id, {
|
|
5864
|
+
...options,
|
|
5865
|
+
...(mode === "manage" ? { distinctForDisplay: true } : {}),
|
|
5866
|
+
});
|
|
5756
5867
|
sources = await runtime.accounts.sources(provider.id, options);
|
|
5757
5868
|
usageAccounts = provider.id === CODEX_USAGE_PROVIDER_ID ? await pool.list(provider.id, options) : [];
|
|
5758
5869
|
unidentified =
|
|
@@ -5767,8 +5878,10 @@ export class InteractiveMode {
|
|
|
5767
5878
|
}
|
|
5768
5879
|
const now = Date.now();
|
|
5769
5880
|
const labelCounts = new Map();
|
|
5770
|
-
for (const account of accounts)
|
|
5771
|
-
|
|
5881
|
+
for (const account of accounts) {
|
|
5882
|
+
const label = account.displayLabel ?? account.label;
|
|
5883
|
+
labelCounts.set(label, (labelCounts.get(label) ?? 0) + 1);
|
|
5884
|
+
}
|
|
5772
5885
|
const isCodex = provider.id === CODEX_USAGE_PROVIDER_ID;
|
|
5773
5886
|
const hasSubscriptionUsage = isCodex || isClaude;
|
|
5774
5887
|
const accountLabel = (account) => {
|
|
@@ -5803,10 +5916,13 @@ export class InteractiveMode {
|
|
|
5803
5916
|
...extraOptions,
|
|
5804
5917
|
];
|
|
5805
5918
|
this.showSelector((done) => {
|
|
5806
|
-
const
|
|
5807
|
-
? `HUMAIN Code / Accounts — Remove which ${provider.name} account?`
|
|
5808
|
-
: `HUMAIN Code / Accounts — ${provider.name}:`, currentOptions, (option) => {
|
|
5919
|
+
const cancel = () => {
|
|
5809
5920
|
done();
|
|
5921
|
+
this.ui.requestRender();
|
|
5922
|
+
};
|
|
5923
|
+
const select = (index, action) => {
|
|
5924
|
+
done();
|
|
5925
|
+
const option = extraOptions[index - accounts.length];
|
|
5810
5926
|
if (option === unidentifiedOption) {
|
|
5811
5927
|
void this.removeUnidentifiedCredential(provider);
|
|
5812
5928
|
return;
|
|
@@ -5819,26 +5935,95 @@ export class InteractiveMode {
|
|
|
5819
5935
|
void this.showAccountPolicy(provider);
|
|
5820
5936
|
return;
|
|
5821
5937
|
}
|
|
5822
|
-
if (sourceOptions.includes(option)) {
|
|
5938
|
+
if (option && sourceOptions.includes(option)) {
|
|
5823
5939
|
void this.showExtensionSelector(`${option}\n${EXTERNAL_SOURCE_NOTICE}`, ["Back"]).then(() => this.showOAuthAccountSelector(provider));
|
|
5824
5940
|
return;
|
|
5825
5941
|
}
|
|
5826
|
-
const index = currentOptions.indexOf(option);
|
|
5827
|
-
if (index < 0 || index >= accounts.length)
|
|
5828
|
-
return;
|
|
5829
5942
|
const account = accounts[index];
|
|
5830
5943
|
if (!account)
|
|
5831
5944
|
return;
|
|
5832
|
-
if (mode === "logout") {
|
|
5945
|
+
if (mode === "logout" || action === "remove") {
|
|
5833
5946
|
void this.removeOAuthAccount(provider, account.key);
|
|
5834
5947
|
}
|
|
5948
|
+
else if (action === "reconnect") {
|
|
5949
|
+
void this.reauthenticateAccount(provider.id, account.type, account.key);
|
|
5950
|
+
}
|
|
5835
5951
|
else {
|
|
5836
|
-
void this.showOAuthAccountActions(provider, account, undefined, claudeActions.get(account.key));
|
|
5952
|
+
void this.showOAuthAccountActions(provider, account, undefined, claudeActions.get(account.key), action === "choose" ? "Use for future requests" : undefined);
|
|
5837
5953
|
}
|
|
5838
|
-
}
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5954
|
+
};
|
|
5955
|
+
const getRows = () => {
|
|
5956
|
+
const occurrences = new Map();
|
|
5957
|
+
const auth = runtime.getProvider(provider.id)?.auth;
|
|
5958
|
+
return [
|
|
5959
|
+
...accounts.map((account, index) => {
|
|
5960
|
+
const state = usageStates[index];
|
|
5961
|
+
const usage = subscriptionAccountUsage(state.kind === "subscription" ? state.result : undefined);
|
|
5962
|
+
const loading = state.kind === "loading";
|
|
5963
|
+
const cooldown = account.exhaustedUntil !== undefined && account.exhaustedUntil > Date.now()
|
|
5964
|
+
? formatOAuthAccountResetTime(account.exhaustedUntil)
|
|
5965
|
+
: undefined;
|
|
5966
|
+
const status = usage.expired
|
|
5967
|
+
? "Sign-in expired"
|
|
5968
|
+
: usage.availability === "blocked" || cooldown
|
|
5969
|
+
? "Blocked"
|
|
5970
|
+
: account.active
|
|
5971
|
+
? "Active"
|
|
5972
|
+
: usage.weeklyLeft !== undefined
|
|
5973
|
+
? "Ready"
|
|
5974
|
+
: "Saved";
|
|
5975
|
+
const subscription = account.type === "oauth" ? auth?.oauth?.isSubscription : auth?.apiKey?.isSubscription;
|
|
5976
|
+
const label = account.displayLabel ?? account.label;
|
|
5977
|
+
const occurrence = (occurrences.get(label) ?? 0) + 1;
|
|
5978
|
+
occurrences.set(label, occurrence);
|
|
5979
|
+
const duplicate = (labelCounts.get(label) ?? 0) > 1;
|
|
5980
|
+
return {
|
|
5981
|
+
kind: "account",
|
|
5982
|
+
label: duplicate ? `${occurrence}. ${label}` : label,
|
|
5983
|
+
status,
|
|
5984
|
+
loading,
|
|
5985
|
+
weeklyLeft: usage.weeklyLeft,
|
|
5986
|
+
details: [
|
|
5987
|
+
label,
|
|
5988
|
+
...(duplicate ? [`Account ID: ${account.key}`] : []),
|
|
5989
|
+
`${account.type === "oauth" ? "OAuth" : "API key"}${subscription ? " subscription" : ""}`,
|
|
5990
|
+
`Status: ${status}${status !== "Active" && account.active ? " · Active" : ""}${account.effective ? " · Effective" : ""}`,
|
|
5991
|
+
`Provider: ${provider.name}${usage.availability ? ` · ${usage.availability === "unknown" ? "Unknown" : usage.availability === "allowed" ? "Allowed" : "Blocked"}` : ""}`,
|
|
5992
|
+
...(cooldown ? [`Cached cooldown until ${cooldown}`] : []),
|
|
5993
|
+
...(state.kind === "subscription" && state.status ? [state.status] : []),
|
|
5994
|
+
...(state.kind === "none"
|
|
5995
|
+
? []
|
|
5996
|
+
: loading
|
|
5997
|
+
? ["Weekly usage: Loading…"]
|
|
5998
|
+
: [
|
|
5999
|
+
`Weekly left: ${usage.weeklyLeft === undefined ? "Unavailable" : `${usage.weeklyLeft}%`}`,
|
|
6000
|
+
...(usage.reset ? [`Next reset: ${usage.reset}`] : []),
|
|
6001
|
+
`Saved resets: ${usage.savedResets}`,
|
|
6002
|
+
`Paid credits: ${usage.paidCredits}`,
|
|
6003
|
+
...(usage.extraUsage ? [`Extra usage: ${usage.extraUsage}`] : []),
|
|
6004
|
+
]),
|
|
6005
|
+
],
|
|
6006
|
+
};
|
|
6007
|
+
}),
|
|
6008
|
+
...extraOptions.map((label) => ({
|
|
6009
|
+
kind: "action",
|
|
6010
|
+
label,
|
|
6011
|
+
details: [
|
|
6012
|
+
label,
|
|
6013
|
+
label === addAccountOption
|
|
6014
|
+
? "Connect another account for this provider."
|
|
6015
|
+
: label === policyOption
|
|
6016
|
+
? "Configure auto-switch and API-key fallback."
|
|
6017
|
+
: EXTERNAL_SOURCE_NOTICE,
|
|
6018
|
+
],
|
|
6019
|
+
})),
|
|
6020
|
+
];
|
|
6021
|
+
};
|
|
6022
|
+
const logoutSelector = mode === "logout"
|
|
6023
|
+
? new ExtensionSelectorComponent(`HUMAIN Code / Accounts — Remove which ${provider.name} account?`, currentOptions, (option) => select(currentOptions.indexOf(option), "choose"), cancel)
|
|
6024
|
+
: undefined;
|
|
6025
|
+
const selector = logoutSelector ??
|
|
6026
|
+
new AccountPickerComponent(`Manage accounts · ${provider.name}`, getRows, () => Math.max(1, (this.ui.terminal?.rows ?? 24) - 5), select, cancel);
|
|
5842
6027
|
const controller = new AbortController();
|
|
5843
6028
|
let closed = false;
|
|
5844
6029
|
if (hasSubscriptionUsage) {
|
|
@@ -5904,7 +6089,7 @@ export class InteractiveMode {
|
|
|
5904
6089
|
...accounts.map((entry, accountIndex) => formatOAuthAccountOption(accountLabel(entry), usageStates[accountIndex])),
|
|
5905
6090
|
...extraOptions,
|
|
5906
6091
|
];
|
|
5907
|
-
|
|
6092
|
+
logoutSelector?.setOptions(currentOptions);
|
|
5908
6093
|
this.ui.requestRender();
|
|
5909
6094
|
}
|
|
5910
6095
|
};
|
|
@@ -5974,20 +6159,21 @@ export class InteractiveMode {
|
|
|
5974
6159
|
this.showError("Login method is no longer available.");
|
|
5975
6160
|
}
|
|
5976
6161
|
/** `flow` runs the actions inside the awaited Flow setup, where Back and Add another account stay in that flow. */
|
|
5977
|
-
async showOAuthAccountActions(provider, account, flow, claudeUsage) {
|
|
6162
|
+
async showOAuthAccountActions(provider, account, flow, claudeUsage, directAction) {
|
|
5978
6163
|
const signal = flow?.signal;
|
|
5979
6164
|
const canRefresh = !flow && provider.id === ANTHROPIC_USAGE_PROVIDER_ID && account.type === "oauth";
|
|
5980
6165
|
const usageText = claudeUsage ? `\n${formatOAuthAccountUsage(claudeUsage.state)}` : "";
|
|
5981
6166
|
const reauthenticate = claudeUsage?.reconnect ? "Reconnect…" : "Reauthenticate…";
|
|
5982
|
-
const action =
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
6167
|
+
const action = directAction ??
|
|
6168
|
+
(await this.showExtensionSelector(`HUMAIN Code / Accounts — ${provider.name}: ${account.label}${usageText}\nSelection is global. OAuth plans may bill extra usage at the provider. OAuth logins without provider identity cannot detect duplicates; reconnect this account to keep the same entry.${flow ? `\n${FLOW_ACCOUNT_PERSISTENCE_NOTICE}` : ""}`, [
|
|
6169
|
+
"Use for future requests",
|
|
6170
|
+
"Rename…",
|
|
6171
|
+
"Add another account…",
|
|
6172
|
+
...(canRefresh ? ["Refresh"] : []),
|
|
6173
|
+
reauthenticate,
|
|
6174
|
+
"Remove from HUMAIN Code…",
|
|
6175
|
+
"Back",
|
|
6176
|
+
], { signal }));
|
|
5991
6177
|
if (action === "Back") {
|
|
5992
6178
|
if (!flow)
|
|
5993
6179
|
await this.showOAuthAccountSelector(provider);
|
|
@@ -7588,6 +7774,9 @@ export class InteractiveMode {
|
|
|
7588
7774
|
}
|
|
7589
7775
|
}
|
|
7590
7776
|
stop(fullscreenExitOutput = this.settingsManager.getFullscreenExitOutput()) {
|
|
7777
|
+
this.remoteTerminalStopped = true;
|
|
7778
|
+
this.remoteTerminalLifetime?.abort();
|
|
7779
|
+
this.remoteTerminal = undefined;
|
|
7591
7780
|
this.disposeActiveSelector();
|
|
7592
7781
|
if (this.settingsManager.getShowTerminalProgress()) {
|
|
7593
7782
|
this.ui.terminal.setProgress(false);
|