dal-code 0.1.2 → 0.1.7
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/dist/core/agent-session.d.ts +5 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +7 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js +5 -1
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/extensions/types.d.ts +15 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/house-providers.d.ts +81 -0
- package/dist/core/house-providers.d.ts.map +1 -0
- package/dist/core/house-providers.js +128 -0
- package/dist/core/house-providers.js.map +1 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -3
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +11 -0
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +15 -2
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +7 -0
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/dal/builtins.d.ts +15 -0
- package/dist/dal/builtins.d.ts.map +1 -1
- package/dist/dal/builtins.js +22 -0
- package/dist/dal/builtins.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +3 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +3 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +81 -42
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts.map +1 -1
- package/dist/modes/interactive/session-share.js +6 -5
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/src/index.ts +21 -12
- package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-lang/src/index.ts +19 -2
- package/dist/node_modules/@dalcode/dal-lsp/package.json +6 -3
- package/dist/node_modules/@dalcode/dal-lsp/src/client.ts +241 -0
- package/dist/node_modules/@dalcode/dal-lsp/src/config.ts +176 -0
- package/dist/node_modules/@dalcode/dal-lsp/src/format.ts +88 -0
- package/dist/node_modules/@dalcode/dal-lsp/src/index.ts +149 -42
- package/dist/node_modules/@dalcode/dal-lsp/src/types.ts +21 -0
- package/dist/node_modules/@dalcode/dal-mcp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/src/config.ts +25 -3
- package/dist/node_modules/@dalcode/dal-mcp/src/index.ts +6 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.d.ts +8 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.d.ts.map +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +89 -4
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js.map +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.ts +97 -5
- package/dist/node_modules/@dalcode/dal-skills/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-skills/package.json +33 -0
- package/dist/node_modules/@dalcode/dal-skills/src/client.ts +96 -0
- package/dist/node_modules/@dalcode/dal-skills/src/index.ts +156 -0
- package/dist/node_modules/@dalcode/dal-subagent/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-telemetry/src/config.ts +31 -8
- package/dist/node_modules/@dalcode/dal-telemetry/src/index.ts +12 -4
- package/dist/node_modules/@dalcode/dal-telemetry/src/reporter.ts +14 -1
- package/dist/node_modules/@dalcode/deepailab/package.json +2 -2
- package/dist/node_modules/@dalcode/deepailab/src/index.ts +111 -21
- package/dist/node_modules/@dalcode/deepailab/src/model-defaults.ts +109 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +18 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +18 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.js +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-client/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-protocol/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ import { CACHE_TTL_MS, collectCacheMisses, computeCacheWaste, detectCacheMiss, }
|
|
|
17
17
|
import { DEFAULT_THINKING_LEVEL, THINKING_LEVEL_OPTIONS } from "../../core/defaults.js";
|
|
18
18
|
import { extensionPanelLines, resolveExtensionNotify } from "../../core/extensions/index.js";
|
|
19
19
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
20
|
+
import { isLoginProviderOffered } from "../../core/house-providers.js";
|
|
20
21
|
import { configureHttpDispatcher, formatHttpIdleTimeoutMs } from "../../core/http-dispatcher.js";
|
|
21
22
|
import { KeybindingsManager } from "../../core/keybindings.js";
|
|
22
23
|
import { createCompactionSummaryMessage } from "../../core/messages.js";
|
|
@@ -89,6 +90,17 @@ function isWorkingStatusEditor(editor) {
|
|
|
89
90
|
"setWorkingStatusIndicator" in editor &&
|
|
90
91
|
typeof editor.setWorkingStatusIndicator === "function");
|
|
91
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Which providers `/login` may offer. DAL restricts this to its own; upstream pi
|
|
95
|
+
* keeps the full list, so this stays a single branch rather than a fork of the
|
|
96
|
+
* whole selector.
|
|
97
|
+
*/
|
|
98
|
+
export function isLoginProviderAllowed(providerId) {
|
|
99
|
+
// Deliberately the same list the runtime enforces: a provider the runtime
|
|
100
|
+
// will refuse to register must not be offered a login, and one it accepts
|
|
101
|
+
// must not be hidden. Two lists would drift.
|
|
102
|
+
return isLoginProviderOffered(providerId);
|
|
103
|
+
}
|
|
92
104
|
function isExpandable(obj) {
|
|
93
105
|
return typeof obj === "object" && obj !== null && "setExpanded" in obj && typeof obj.setExpanded === "function";
|
|
94
106
|
}
|
|
@@ -1422,7 +1434,7 @@ export class InteractiveMode {
|
|
|
1422
1434
|
const result = await this.runtimeHost.fork(entryId, options);
|
|
1423
1435
|
if (!result.cancelled) {
|
|
1424
1436
|
this.editor.setText(result.selectedText ?? "");
|
|
1425
|
-
this.showStatus("
|
|
1437
|
+
this.showStatus(t("已分叉到新会话"));
|
|
1426
1438
|
}
|
|
1427
1439
|
return { cancelled: result.cancelled };
|
|
1428
1440
|
}
|
|
@@ -1445,7 +1457,7 @@ export class InteractiveMode {
|
|
|
1445
1457
|
if (result.editorText && !this.editor.getText().trim()) {
|
|
1446
1458
|
this.editor.setText(result.editorText);
|
|
1447
1459
|
}
|
|
1448
|
-
this.showStatus("
|
|
1460
|
+
this.showStatus(t("已跳转到所选位置"));
|
|
1449
1461
|
void this.flushCompactionQueue({ willRetry: false });
|
|
1450
1462
|
return { cancelled: false };
|
|
1451
1463
|
},
|
|
@@ -2425,7 +2437,7 @@ export class InteractiveMode {
|
|
|
2425
2437
|
}
|
|
2426
2438
|
handleStartupSubmit(text) {
|
|
2427
2439
|
this.editor.setText(text);
|
|
2428
|
-
this.showStatus("
|
|
2440
|
+
this.showStatus(t("启动仍在进行中"));
|
|
2429
2441
|
}
|
|
2430
2442
|
setupEditorSubmitHandler() {
|
|
2431
2443
|
this.defaultEditor.onSubmit = async (text) => {
|
|
@@ -2583,7 +2595,7 @@ export class InteractiveMode {
|
|
|
2583
2595
|
const command = isExcluded ? text.slice(2).trim() : text.slice(1).trim();
|
|
2584
2596
|
if (command) {
|
|
2585
2597
|
if (this.session.isBashRunning) {
|
|
2586
|
-
this.showWarning("
|
|
2598
|
+
this.showWarning(t("已有 bash 命令在运行,请先按 Esc 取消。"));
|
|
2587
2599
|
this.editor.setText(text);
|
|
2588
2600
|
return;
|
|
2589
2601
|
}
|
|
@@ -2857,10 +2869,10 @@ export class InteractiveMode {
|
|
|
2857
2869
|
this.clearStatusIndicator("compaction");
|
|
2858
2870
|
if (event.aborted) {
|
|
2859
2871
|
if (event.reason === "manual") {
|
|
2860
|
-
this.showError("
|
|
2872
|
+
this.showError(t("已取消压缩"));
|
|
2861
2873
|
}
|
|
2862
2874
|
else {
|
|
2863
|
-
this.showStatus("
|
|
2875
|
+
this.showStatus(t("已取消自动压缩"));
|
|
2864
2876
|
}
|
|
2865
2877
|
}
|
|
2866
2878
|
else if (event.result) {
|
|
@@ -3440,7 +3452,7 @@ export class InteractiveMode {
|
|
|
3440
3452
|
}
|
|
3441
3453
|
handleCtrlZ() {
|
|
3442
3454
|
if (process.platform === "win32") {
|
|
3443
|
-
this.showStatus("
|
|
3455
|
+
this.showStatus(t("Windows 不支持挂起到后台"));
|
|
3444
3456
|
return;
|
|
3445
3457
|
}
|
|
3446
3458
|
// Keep the event loop alive while suspended. Without this, stopping the TUI
|
|
@@ -3504,7 +3516,7 @@ export class InteractiveMode {
|
|
|
3504
3516
|
handleDequeue() {
|
|
3505
3517
|
const restored = this.restoreQueuedMessagesToEditor();
|
|
3506
3518
|
if (restored === 0) {
|
|
3507
|
-
this.showStatus("
|
|
3519
|
+
this.showStatus(t("没有可恢复的排队消息"));
|
|
3508
3520
|
}
|
|
3509
3521
|
else {
|
|
3510
3522
|
this.showStatus(`Restored ${restored} queued message${restored > 1 ? "s" : ""} to editor`);
|
|
@@ -3523,7 +3535,7 @@ export class InteractiveMode {
|
|
|
3523
3535
|
cycleThinkingLevel() {
|
|
3524
3536
|
const newLevel = this.session.cycleThinkingLevel();
|
|
3525
3537
|
if (newLevel === undefined) {
|
|
3526
|
-
this.showStatus("
|
|
3538
|
+
this.showStatus(t("当前模型不支持思考模式"));
|
|
3527
3539
|
}
|
|
3528
3540
|
else {
|
|
3529
3541
|
this.footer.invalidate();
|
|
@@ -3731,7 +3743,7 @@ export class InteractiveMode {
|
|
|
3731
3743
|
this.editor.addToHistory?.(text);
|
|
3732
3744
|
this.editor.setText("");
|
|
3733
3745
|
this.updatePendingMessagesDisplay();
|
|
3734
|
-
this.showStatus("
|
|
3746
|
+
this.showStatus(t("消息已排队,将在压缩完成后发送"));
|
|
3735
3747
|
}
|
|
3736
3748
|
isExtensionCommand(text) {
|
|
3737
3749
|
if (!text.startsWith("/"))
|
|
@@ -4074,7 +4086,7 @@ export class InteractiveMode {
|
|
|
4074
4086
|
onTuiModeChange: (mode) => {
|
|
4075
4087
|
if (!this.switchTuiMode(mode)) {
|
|
4076
4088
|
selector?.getSettingsList().updateValue("tui-mode", this.ui.mode);
|
|
4077
|
-
this.showStatus("
|
|
4089
|
+
this.showStatus(t("切换 TUI 模式前请先关闭浮层"));
|
|
4078
4090
|
return;
|
|
4079
4091
|
}
|
|
4080
4092
|
this.settingsManager.setTuiMode(mode);
|
|
@@ -4172,7 +4184,7 @@ export class InteractiveMode {
|
|
|
4172
4184
|
const cachedMatch = findExactModelReferenceMatch(searchTerm, cachedModels);
|
|
4173
4185
|
if (cachedMatch || this.session.scopedModels.length > 0)
|
|
4174
4186
|
return cachedMatch;
|
|
4175
|
-
this.showStatus("
|
|
4187
|
+
this.showStatus(t("正在刷新模型目录…"));
|
|
4176
4188
|
const controller = new AbortController();
|
|
4177
4189
|
let timedOut = false;
|
|
4178
4190
|
const timeout = setTimeout(() => {
|
|
@@ -4182,7 +4194,7 @@ export class InteractiveMode {
|
|
|
4182
4194
|
try {
|
|
4183
4195
|
const result = await refreshModelCatalogs(this.session.modelRuntime, controller.signal);
|
|
4184
4196
|
if (result.aborted && timedOut) {
|
|
4185
|
-
this.showWarning("
|
|
4197
|
+
this.showWarning(t("模型刷新超时,改为搜索已缓存的模型。"));
|
|
4186
4198
|
}
|
|
4187
4199
|
else if (result.errors.size > 0) {
|
|
4188
4200
|
this.showWarning(`Could not refresh ${[...result.errors.keys()].join(", ")}; searching cached models.`);
|
|
@@ -4286,7 +4298,18 @@ export class InteractiveMode {
|
|
|
4286
4298
|
this.footer.invalidate();
|
|
4287
4299
|
this.updateEditorBorderColor();
|
|
4288
4300
|
done();
|
|
4289
|
-
this.showStatus(persist ?
|
|
4301
|
+
this.showStatus(persist ? `${t("默认模型:")}${model.provider}/${model.id}` : `${t("模型:")}${model.id}`);
|
|
4302
|
+
// Chain straight into the thinking picker, the way Claude Code and
|
|
4303
|
+
// Codex do. Reasoning depth is part of choosing a model, not a
|
|
4304
|
+
// separate errand: the footer showed "thinking off" with no hint
|
|
4305
|
+
// that /thinking existed, and the setting was looked for twice in
|
|
4306
|
+
// the model picker before being found.
|
|
4307
|
+
//
|
|
4308
|
+
// Only when there is a choice to make. A model with one level would
|
|
4309
|
+
// open a picker that can only confirm what is already true.
|
|
4310
|
+
if (this.session.getAvailableThinkingLevels().length > 1) {
|
|
4311
|
+
this.showThinkingSelector();
|
|
4312
|
+
}
|
|
4290
4313
|
void this.maybeWarnAboutAnthropicSubscriptionAuth(model);
|
|
4291
4314
|
this.checkDaxnutsEasterEgg(model);
|
|
4292
4315
|
}
|
|
@@ -4352,7 +4375,7 @@ export class InteractiveMode {
|
|
|
4352
4375
|
const selector = new ScopedModelsSelectorComponent({
|
|
4353
4376
|
allModels: availableModels,
|
|
4354
4377
|
enabledModelIds: currentEnabledIds,
|
|
4355
|
-
refreshStatus: "
|
|
4378
|
+
refreshStatus: t("正在刷新模型目录…"),
|
|
4356
4379
|
}, {
|
|
4357
4380
|
onChange: (enabledIds) => {
|
|
4358
4381
|
selectionChanged = true;
|
|
@@ -4364,7 +4387,7 @@ export class InteractiveMode {
|
|
|
4364
4387
|
enabledIds.every((id) => availableModelIds.has(id));
|
|
4365
4388
|
const newPatterns = enabledIds === null || allEnabled ? undefined : enabledIds;
|
|
4366
4389
|
this.settingsManager.setEnabledModels(newPatterns ? [...newPatterns] : undefined);
|
|
4367
|
-
this.showStatus("
|
|
4390
|
+
this.showStatus(t("模型选择已保存到设置"));
|
|
4368
4391
|
},
|
|
4369
4392
|
onCancel: () => {
|
|
4370
4393
|
done();
|
|
@@ -4393,7 +4416,7 @@ export class InteractiveMode {
|
|
|
4393
4416
|
selector.setRefreshStatus(`Could not refresh ${[...result.errors.keys()].join(", ")}; showing cached models.`, "warning");
|
|
4394
4417
|
}
|
|
4395
4418
|
else {
|
|
4396
|
-
selector.setRefreshStatus("
|
|
4419
|
+
selector.setRefreshStatus(t("模型目录已刷新。"), "success");
|
|
4397
4420
|
}
|
|
4398
4421
|
this.ui.requestRender();
|
|
4399
4422
|
})
|
|
@@ -4420,7 +4443,7 @@ export class InteractiveMode {
|
|
|
4420
4443
|
showUserMessageSelector() {
|
|
4421
4444
|
const userMessages = this.session.getUserMessagesForForking();
|
|
4422
4445
|
if (userMessages.length === 0) {
|
|
4423
|
-
this.showStatus("
|
|
4446
|
+
this.showStatus(t("没有可用于分叉的消息"));
|
|
4424
4447
|
return;
|
|
4425
4448
|
}
|
|
4426
4449
|
const initialSelectedId = userMessages[userMessages.length - 1]?.entryId;
|
|
@@ -4434,7 +4457,7 @@ export class InteractiveMode {
|
|
|
4434
4457
|
return;
|
|
4435
4458
|
}
|
|
4436
4459
|
this.editor.setText(result.selectedText ?? "");
|
|
4437
|
-
this.showStatus("
|
|
4460
|
+
this.showStatus(t("已分叉到新会话"));
|
|
4438
4461
|
}
|
|
4439
4462
|
catch (error) {
|
|
4440
4463
|
this.showError(error instanceof Error ? error.message : String(error));
|
|
@@ -4449,7 +4472,7 @@ export class InteractiveMode {
|
|
|
4449
4472
|
async handleCloneCommand() {
|
|
4450
4473
|
const leafId = this.sessionManager.getLeafId();
|
|
4451
4474
|
if (!leafId) {
|
|
4452
|
-
this.showStatus("
|
|
4475
|
+
this.showStatus(t("还没有可克隆的内容"));
|
|
4453
4476
|
return;
|
|
4454
4477
|
}
|
|
4455
4478
|
try {
|
|
@@ -4459,7 +4482,7 @@ export class InteractiveMode {
|
|
|
4459
4482
|
return;
|
|
4460
4483
|
}
|
|
4461
4484
|
this.editor.setText("");
|
|
4462
|
-
this.showStatus("
|
|
4485
|
+
this.showStatus(t("已克隆到新会话"));
|
|
4463
4486
|
}
|
|
4464
4487
|
catch (error) {
|
|
4465
4488
|
this.showError(error instanceof Error ? error.message : String(error));
|
|
@@ -4470,7 +4493,7 @@ export class InteractiveMode {
|
|
|
4470
4493
|
const realLeafId = this.sessionManager.getLeafId();
|
|
4471
4494
|
const initialFilterMode = this.settingsManager.getTreeFilterMode();
|
|
4472
4495
|
if (tree.length === 0) {
|
|
4473
|
-
this.showStatus("
|
|
4496
|
+
this.showStatus(t("会话中没有条目"));
|
|
4474
4497
|
return;
|
|
4475
4498
|
}
|
|
4476
4499
|
this.showSelector((done) => {
|
|
@@ -4478,7 +4501,7 @@ export class InteractiveMode {
|
|
|
4478
4501
|
// Selecting the current leaf is a no-op (already there)
|
|
4479
4502
|
if (entryId === this.sessionManager.getLeafId()) {
|
|
4480
4503
|
done();
|
|
4481
|
-
this.showStatus("
|
|
4504
|
+
this.showStatus(t("已经在这个位置"));
|
|
4482
4505
|
return;
|
|
4483
4506
|
}
|
|
4484
4507
|
// Ask about summarization
|
|
@@ -4535,12 +4558,12 @@ export class InteractiveMode {
|
|
|
4535
4558
|
});
|
|
4536
4559
|
if (result.aborted) {
|
|
4537
4560
|
// Summarization aborted - re-show tree selector with same selection
|
|
4538
|
-
this.showStatus("
|
|
4561
|
+
this.showStatus(t("已取消分支摘要"));
|
|
4539
4562
|
this.showTreeSelector(entryId);
|
|
4540
4563
|
return;
|
|
4541
4564
|
}
|
|
4542
4565
|
if (result.cancelled) {
|
|
4543
|
-
this.showStatus("
|
|
4566
|
+
this.showStatus(t("已取消跳转"));
|
|
4544
4567
|
return;
|
|
4545
4568
|
}
|
|
4546
4569
|
// Update UI
|
|
@@ -4549,7 +4572,7 @@ export class InteractiveMode {
|
|
|
4549
4572
|
if (result.editorText && !this.editor.getText().trim()) {
|
|
4550
4573
|
this.editor.setText(result.editorText);
|
|
4551
4574
|
}
|
|
4552
|
-
this.showStatus("
|
|
4575
|
+
this.showStatus(t("已跳转到所选位置"));
|
|
4553
4576
|
void this.flushCompactionQueue({ willRetry: false });
|
|
4554
4577
|
}
|
|
4555
4578
|
catch (error) {
|
|
@@ -4570,12 +4593,12 @@ export class InteractiveMode {
|
|
|
4570
4593
|
}, initialSelectedId, initialFilterMode);
|
|
4571
4594
|
selector.onCopy = async (text) => {
|
|
4572
4595
|
if (!text) {
|
|
4573
|
-
this.showError("
|
|
4596
|
+
this.showError(t("所选条目没有可复制的文本"));
|
|
4574
4597
|
return;
|
|
4575
4598
|
}
|
|
4576
4599
|
try {
|
|
4577
4600
|
await copyToClipboard(text);
|
|
4578
|
-
this.showStatus("
|
|
4601
|
+
this.showStatus(t("已复制所选消息到剪贴板"));
|
|
4579
4602
|
}
|
|
4580
4603
|
catch (error) {
|
|
4581
4604
|
this.showError(error instanceof Error ? error.message : String(error));
|
|
@@ -4620,14 +4643,14 @@ export class InteractiveMode {
|
|
|
4620
4643
|
if (result.cancelled) {
|
|
4621
4644
|
return result;
|
|
4622
4645
|
}
|
|
4623
|
-
this.showStatus("
|
|
4646
|
+
this.showStatus(t("已恢复会话"));
|
|
4624
4647
|
return result;
|
|
4625
4648
|
}
|
|
4626
4649
|
catch (error) {
|
|
4627
4650
|
if (error instanceof MissingSessionCwdError) {
|
|
4628
4651
|
const selectedCwd = await this.promptForMissingSessionCwd(error);
|
|
4629
4652
|
if (!selectedCwd) {
|
|
4630
|
-
this.showStatus("
|
|
4653
|
+
this.showStatus(t("已取消恢复"));
|
|
4631
4654
|
return { cancelled: true };
|
|
4632
4655
|
}
|
|
4633
4656
|
const result = await this.runtimeHost.switchSession(sessionPath, {
|
|
@@ -4638,7 +4661,7 @@ export class InteractiveMode {
|
|
|
4638
4661
|
if (result.cancelled) {
|
|
4639
4662
|
return result;
|
|
4640
4663
|
}
|
|
4641
|
-
this.showStatus("
|
|
4664
|
+
this.showStatus(t("已在当前目录恢复会话"));
|
|
4642
4665
|
return result;
|
|
4643
4666
|
}
|
|
4644
4667
|
return this.handleFatalRuntimeError("Failed to resume session", error);
|
|
@@ -4647,6 +4670,13 @@ export class InteractiveMode {
|
|
|
4647
4670
|
getLoginProviderOptions(authType) {
|
|
4648
4671
|
const options = [];
|
|
4649
4672
|
for (const provider of this.session.modelRuntime.getProviders()) {
|
|
4673
|
+
// DAL sells access through its own gateway, and the upstream provider
|
|
4674
|
+
// registry carries 40+ third parties. Offering those in /login would let
|
|
4675
|
+
// a user sign into Anthropic or OpenAI directly and run the product with
|
|
4676
|
+
// the billing path cut out. Providers stay registered — their model
|
|
4677
|
+
// metadata is still needed — they are just not offered as login targets.
|
|
4678
|
+
if (!isLoginProviderAllowed(provider.id))
|
|
4679
|
+
continue;
|
|
4650
4680
|
const authStatus = this.session.modelRuntime.getProviderAuthStatus(provider.id);
|
|
4651
4681
|
const status = authStatus.configured
|
|
4652
4682
|
? {
|
|
@@ -4739,7 +4769,7 @@ export class InteractiveMode {
|
|
|
4739
4769
|
options.push(apiKeyLabel);
|
|
4740
4770
|
}
|
|
4741
4771
|
if (options.length === 0) {
|
|
4742
|
-
this.showStatus("
|
|
4772
|
+
this.showStatus(t("没有可用的登录方式。"));
|
|
4743
4773
|
return;
|
|
4744
4774
|
}
|
|
4745
4775
|
if (providerOptions && options.length === 1) {
|
|
@@ -4851,6 +4881,15 @@ export class InteractiveMode {
|
|
|
4851
4881
|
}
|
|
4852
4882
|
async completeProviderAuthentication(providerId, providerName, authType, previousModel) {
|
|
4853
4883
|
const actionLabel = authType === "oauth" ? `Logged in to ${providerName}` : `Saved API key for ${providerName}`;
|
|
4884
|
+
// Before picking a model: an extension whose catalog needs the credential
|
|
4885
|
+
// (deepailab fetches the gateway's model list) has to see it now, or the
|
|
4886
|
+
// user stays on the seed list until they restart.
|
|
4887
|
+
try {
|
|
4888
|
+
await this.session.emitProviderAuthenticated(providerId, authType);
|
|
4889
|
+
}
|
|
4890
|
+
catch {
|
|
4891
|
+
// A failing extension must not block a completed login.
|
|
4892
|
+
}
|
|
4854
4893
|
let selectedModel;
|
|
4855
4894
|
let selectionError;
|
|
4856
4895
|
if (isPlaceholderModel(previousModel)) {
|
|
@@ -5095,11 +5134,11 @@ export class InteractiveMode {
|
|
|
5095
5134
|
// =========================================================================
|
|
5096
5135
|
async handleReloadCommand() {
|
|
5097
5136
|
if (this.session.isStreaming) {
|
|
5098
|
-
this.showWarning("
|
|
5137
|
+
this.showWarning(t("请等待当前回复完成后再重新加载。"));
|
|
5099
5138
|
return;
|
|
5100
5139
|
}
|
|
5101
5140
|
if (this.session.isCompacting) {
|
|
5102
|
-
this.showWarning("
|
|
5141
|
+
this.showWarning(t("请等待压缩完成后再重新加载。"));
|
|
5103
5142
|
return;
|
|
5104
5143
|
}
|
|
5105
5144
|
this.resetExtensionUI();
|
|
@@ -5215,19 +5254,19 @@ export class InteractiveMode {
|
|
|
5215
5254
|
async handleImportCommand(text) {
|
|
5216
5255
|
const inputPath = this.getPathCommandArgument(text, "/import");
|
|
5217
5256
|
if (!inputPath) {
|
|
5218
|
-
this.showError("
|
|
5257
|
+
this.showError(t("用法:/import <path.jsonl>"));
|
|
5219
5258
|
return;
|
|
5220
5259
|
}
|
|
5221
5260
|
const confirmed = await this.showExtensionConfirm("Import session", `Replace current session with ${inputPath}?`);
|
|
5222
5261
|
if (!confirmed) {
|
|
5223
|
-
this.showStatus("
|
|
5262
|
+
this.showStatus(t("已取消导入"));
|
|
5224
5263
|
return;
|
|
5225
5264
|
}
|
|
5226
5265
|
try {
|
|
5227
5266
|
this.clearStatusIndicator();
|
|
5228
5267
|
const result = await this.runtimeHost.importFromJsonl(inputPath);
|
|
5229
5268
|
if (result.cancelled) {
|
|
5230
|
-
this.showStatus("
|
|
5269
|
+
this.showStatus(t("已取消导入"));
|
|
5231
5270
|
return;
|
|
5232
5271
|
}
|
|
5233
5272
|
this.showStatus(`Session imported from: ${inputPath}`);
|
|
@@ -5236,12 +5275,12 @@ export class InteractiveMode {
|
|
|
5236
5275
|
if (error instanceof MissingSessionCwdError) {
|
|
5237
5276
|
const selectedCwd = await this.promptForMissingSessionCwd(error);
|
|
5238
5277
|
if (!selectedCwd) {
|
|
5239
|
-
this.showStatus("
|
|
5278
|
+
this.showStatus(t("已取消导入"));
|
|
5240
5279
|
return;
|
|
5241
5280
|
}
|
|
5242
5281
|
const result = await this.runtimeHost.importFromJsonl(inputPath, selectedCwd);
|
|
5243
5282
|
if (result.cancelled) {
|
|
5244
|
-
this.showStatus("
|
|
5283
|
+
this.showStatus(t("已取消导入"));
|
|
5245
5284
|
return;
|
|
5246
5285
|
}
|
|
5247
5286
|
this.showStatus(`Session imported from: ${inputPath}`);
|
|
@@ -5274,7 +5313,7 @@ export class InteractiveMode {
|
|
|
5274
5313
|
}
|
|
5275
5314
|
const text = this.session.getLastAssistantText();
|
|
5276
5315
|
if (!text) {
|
|
5277
|
-
this.showError("
|
|
5316
|
+
this.showError(t("还没有可复制的回复。"));
|
|
5278
5317
|
return;
|
|
5279
5318
|
}
|
|
5280
5319
|
try {
|
|
@@ -5283,7 +5322,7 @@ export class InteractiveMode {
|
|
|
5283
5322
|
this.ui.flash("Copied!");
|
|
5284
5323
|
}
|
|
5285
5324
|
else {
|
|
5286
|
-
this.showStatus("
|
|
5325
|
+
this.showStatus(t("已复制最后一条回复到剪贴板"));
|
|
5287
5326
|
}
|
|
5288
5327
|
}
|
|
5289
5328
|
catch (error) {
|
|
@@ -5299,7 +5338,7 @@ export class InteractiveMode {
|
|
|
5299
5338
|
this.chatContainer.addChild(new Text(theme.fg("dim", `Session name: ${currentName}`), 1, 0));
|
|
5300
5339
|
}
|
|
5301
5340
|
else {
|
|
5302
|
-
this.showWarning("
|
|
5341
|
+
this.showWarning(t("用法:/name <名称>"));
|
|
5303
5342
|
}
|
|
5304
5343
|
this.ui.requestRender();
|
|
5305
5344
|
return;
|