@vybestack/llxprt-code 0.4.8 → 0.5.0-nightly.251102.f115237d
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/package.json +5 -3
- package/dist/src/auth/__tests__/oauthManager.safety.test.d.ts +6 -0
- package/dist/src/auth/__tests__/oauthManager.safety.test.js +49 -0
- package/dist/src/auth/__tests__/oauthManager.safety.test.js.map +1 -0
- package/dist/src/auth/oauth-manager.d.ts +11 -0
- package/dist/src/auth/oauth-manager.js +62 -29
- package/dist/src/auth/oauth-manager.js.map +1 -1
- package/dist/src/auth/oauth-manager.spec.js +7 -2
- package/dist/src/auth/oauth-manager.spec.js.map +1 -1
- package/dist/src/config/__tests__/nonInteractiveTools.test.d.ts +6 -0
- package/dist/src/config/__tests__/nonInteractiveTools.test.js +13 -0
- package/dist/src/config/__tests__/nonInteractiveTools.test.js.map +1 -0
- package/dist/src/config/__tests__/profileBootstrap.test.d.ts +6 -0
- package/dist/src/config/__tests__/profileBootstrap.test.js +91 -0
- package/dist/src/config/__tests__/profileBootstrap.test.js.map +1 -0
- package/dist/src/config/config.d.ts +6 -2
- package/dist/src/config/config.js +219 -18
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/profileBootstrap.d.ts +64 -0
- package/dist/src/config/profileBootstrap.js +140 -0
- package/dist/src/config/profileBootstrap.js.map +1 -0
- package/dist/src/gemini.js +68 -23
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.js +1 -2
- package/dist/src/gemini.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +1 -1
- package/dist/src/generated/git-commit.js +1 -1
- package/dist/src/integration-tests/base-url-behavior.integration.test.js +110 -450
- package/dist/src/integration-tests/base-url-behavior.integration.test.js.map +1 -1
- package/dist/src/integration-tests/model-params-isolation.integration.test.js +101 -539
- package/dist/src/integration-tests/model-params-isolation.integration.test.js.map +1 -1
- package/dist/src/integration-tests/modelParams.integration.test.js +86 -761
- package/dist/src/integration-tests/modelParams.integration.test.js.map +1 -1
- package/dist/src/integration-tests/provider-multi-runtime.integration.test.d.ts +6 -0
- package/dist/src/integration-tests/provider-multi-runtime.integration.test.js +198 -0
- package/dist/src/integration-tests/provider-multi-runtime.integration.test.js.map +1 -0
- package/dist/src/integration-tests/provider-switching.integration.test.js +97 -151
- package/dist/src/integration-tests/provider-switching.integration.test.js.map +1 -1
- package/dist/src/integration-tests/runtime-isolation.test.d.ts +13 -0
- package/dist/src/integration-tests/runtime-isolation.test.js +170 -0
- package/dist/src/integration-tests/runtime-isolation.test.js.map +1 -0
- package/dist/src/integration-tests/test-utils.js +19 -2
- package/dist/src/integration-tests/test-utils.js.map +1 -1
- package/dist/src/integration-tests/test-utils.test.js +9 -8
- package/dist/src/integration-tests/test-utils.test.js.map +1 -1
- package/dist/src/integration-tests/todo-continuation.integration.test.js +5 -2
- package/dist/src/integration-tests/todo-continuation.integration.test.js.map +1 -1
- package/dist/src/integration-tests/tools-governance.integration.test.d.ts +6 -0
- package/dist/src/integration-tests/tools-governance.integration.test.js +98 -0
- package/dist/src/integration-tests/tools-governance.integration.test.js.map +1 -0
- package/dist/src/nonInteractiveCli.js +36 -11
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/providers/logging/git-stats.test.js +11 -1
- package/dist/src/providers/logging/git-stats.test.js.map +1 -1
- package/dist/src/providers/logging/multi-provider-logging.integration.test.js +1 -2
- package/dist/src/providers/logging/multi-provider-logging.integration.test.js.map +1 -1
- package/dist/src/providers/logging/performance.test.js +1 -1
- package/dist/src/providers/logging/performance.test.js.map +1 -1
- package/dist/src/providers/oauth-provider-registration.d.ts +2 -2
- package/dist/src/providers/oauth-provider-registration.js +25 -9
- package/dist/src/providers/oauth-provider-registration.js.map +1 -1
- package/dist/src/providers/provider-gemini-switching.test.js +67 -89
- package/dist/src/providers/provider-gemini-switching.test.js.map +1 -1
- package/dist/src/providers/provider-switching.integration.test.js +42 -98
- package/dist/src/providers/provider-switching.integration.test.js.map +1 -1
- package/dist/src/providers/providerConfigUtils.d.ts +12 -7
- package/dist/src/providers/providerConfigUtils.js +31 -99
- package/dist/src/providers/providerConfigUtils.js.map +1 -1
- package/dist/src/providers/providerManagerInstance.d.ts +17 -1
- package/dist/src/providers/providerManagerInstance.js +157 -175
- package/dist/src/providers/providerManagerInstance.js.map +1 -1
- package/dist/src/providers/providerManagerInstance.oauthRegistration.test.js +19 -15
- package/dist/src/providers/providerManagerInstance.oauthRegistration.test.js.map +1 -1
- package/dist/src/providers/providerManagerInstance.test.js +2 -5
- package/dist/src/providers/providerManagerInstance.test.js.map +1 -1
- package/dist/src/runtime/__tests__/profileApplication.test.d.ts +5 -0
- package/dist/src/runtime/__tests__/profileApplication.test.js +232 -0
- package/dist/src/runtime/__tests__/profileApplication.test.js.map +1 -0
- package/dist/src/runtime/__tests__/runtimeIsolation.test.d.ts +5 -0
- package/dist/src/runtime/__tests__/runtimeIsolation.test.js +376 -0
- package/dist/src/runtime/__tests__/runtimeIsolation.test.js.map +1 -0
- package/dist/src/runtime/agentRuntimeAdapter.d.ts +249 -0
- package/dist/src/runtime/agentRuntimeAdapter.js +506 -0
- package/dist/src/runtime/agentRuntimeAdapter.js.map +1 -0
- package/dist/src/runtime/agentRuntimeAdapter.spec.d.ts +6 -0
- package/dist/src/runtime/agentRuntimeAdapter.spec.js +866 -0
- package/dist/src/runtime/agentRuntimeAdapter.spec.js.map +1 -0
- package/dist/src/runtime/messages.d.ts +28 -0
- package/dist/src/runtime/messages.js +64 -0
- package/dist/src/runtime/messages.js.map +1 -0
- package/dist/src/runtime/profileApplication.d.ts +33 -0
- package/dist/src/runtime/profileApplication.js +191 -0
- package/dist/src/runtime/profileApplication.js.map +1 -0
- package/dist/src/runtime/providerConfigUtils.test.d.ts +1 -0
- package/dist/src/runtime/providerConfigUtils.test.js +68 -0
- package/dist/src/runtime/providerConfigUtils.test.js.map +1 -0
- package/dist/src/runtime/runtimeContextFactory.d.ts +102 -0
- package/dist/src/runtime/runtimeContextFactory.js +190 -0
- package/dist/src/runtime/runtimeContextFactory.js.map +1 -0
- package/dist/src/runtime/runtimeSettings.d.ts +217 -0
- package/dist/src/runtime/runtimeSettings.js +1094 -0
- package/dist/src/runtime/runtimeSettings.js.map +1 -0
- package/dist/src/runtime/runtimeSettings.test.d.ts +1 -0
- package/dist/src/runtime/runtimeSettings.test.js +320 -0
- package/dist/src/runtime/runtimeSettings.test.js.map +1 -0
- package/dist/src/services/BuiltinCommandLoader.d.ts +13 -4
- package/dist/src/services/BuiltinCommandLoader.js +17 -4
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
- package/dist/src/services/McpPromptLoader.js +34 -13
- package/dist/src/services/McpPromptLoader.js.map +1 -1
- package/dist/src/test-utils/mockCommandContext.js +5 -2
- package/dist/src/test-utils/mockCommandContext.js.map +1 -1
- package/dist/src/ui/App.js +29 -49
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/commands/authCommand.js +7 -9
- package/dist/src/ui/commands/authCommand.js.map +1 -1
- package/dist/src/ui/commands/baseurlCommand.js +8 -44
- package/dist/src/ui/commands/baseurlCommand.js.map +1 -1
- package/dist/src/ui/commands/chatCommand.js +28 -12
- package/dist/src/ui/commands/chatCommand.js.map +1 -1
- package/dist/src/ui/commands/diagnosticsCommand.d.ts +0 -3
- package/dist/src/ui/commands/diagnosticsCommand.js +40 -191
- package/dist/src/ui/commands/diagnosticsCommand.js.map +1 -1
- package/dist/src/ui/commands/keyCommand.js +9 -58
- package/dist/src/ui/commands/keyCommand.js.map +1 -1
- package/dist/src/ui/commands/keyCommand.test.js +48 -102
- package/dist/src/ui/commands/keyCommand.test.js.map +1 -1
- package/dist/src/ui/commands/keyfileCommand.js +42 -93
- package/dist/src/ui/commands/keyfileCommand.js.map +1 -1
- package/dist/src/ui/commands/logoutCommand.js +2 -2
- package/dist/src/ui/commands/logoutCommand.js.map +1 -1
- package/dist/src/ui/commands/mcpCommand.js +29 -7
- package/dist/src/ui/commands/mcpCommand.js.map +1 -1
- package/dist/src/ui/commands/modelCommand.js +8 -59
- package/dist/src/ui/commands/modelCommand.js.map +1 -1
- package/dist/src/ui/commands/profileCommand.js +151 -267
- package/dist/src/ui/commands/profileCommand.js.map +1 -1
- package/dist/src/ui/commands/profileCommand.test.js +88 -344
- package/dist/src/ui/commands/profileCommand.test.js.map +1 -1
- package/dist/src/ui/commands/providerCommand.js +9 -3
- package/dist/src/ui/commands/providerCommand.js.map +1 -1
- package/dist/src/ui/commands/restoreCommand.js +38 -18
- package/dist/src/ui/commands/restoreCommand.js.map +1 -1
- package/dist/src/ui/commands/schema/argumentResolver.test.d.ts +6 -0
- package/dist/src/ui/commands/schema/argumentResolver.test.js +619 -0
- package/dist/src/ui/commands/schema/argumentResolver.test.js.map +1 -0
- package/dist/src/ui/commands/schema/index.d.ts +15 -0
- package/dist/src/ui/commands/schema/index.js +320 -0
- package/dist/src/ui/commands/schema/index.js.map +1 -0
- package/dist/src/ui/commands/schema/types.d.ts +61 -0
- package/dist/src/ui/commands/schema/types.js +12 -0
- package/dist/src/ui/commands/schema/types.js.map +1 -0
- package/dist/src/ui/commands/setCommand.js +641 -325
- package/dist/src/ui/commands/setCommand.js.map +1 -1
- package/dist/src/ui/commands/setCommand.test.js +92 -388
- package/dist/src/ui/commands/setCommand.test.js.map +1 -1
- package/dist/src/ui/commands/statusCommand.js +2 -2
- package/dist/src/ui/commands/statusCommand.js.map +1 -1
- package/dist/src/ui/commands/subagentCommand.d.ts +16 -0
- package/dist/src/ui/commands/subagentCommand.js +656 -0
- package/dist/src/ui/commands/subagentCommand.js.map +1 -0
- package/dist/src/ui/commands/test/setCommand.mutation.test.d.ts +6 -0
- package/dist/src/ui/commands/test/setCommand.mutation.test.js +132 -0
- package/dist/src/ui/commands/test/setCommand.mutation.test.js.map +1 -0
- package/dist/src/ui/commands/test/setCommand.phase09.test.d.ts +6 -0
- package/dist/src/ui/commands/test/setCommand.phase09.test.js +222 -0
- package/dist/src/ui/commands/test/setCommand.phase09.test.js.map +1 -0
- package/dist/src/ui/commands/test/subagentCommand.schema.test.d.ts +6 -0
- package/dist/src/ui/commands/test/subagentCommand.schema.test.js +125 -0
- package/dist/src/ui/commands/test/subagentCommand.schema.test.js.map +1 -0
- package/dist/src/ui/commands/test/subagentCommand.test.d.ts +1 -0
- package/dist/src/ui/commands/test/subagentCommand.test.js +589 -0
- package/dist/src/ui/commands/test/subagentCommand.test.js.map +1 -0
- package/dist/src/ui/commands/toolformatCommand.js +25 -98
- package/dist/src/ui/commands/toolformatCommand.js.map +1 -1
- package/dist/src/ui/commands/toolformatCommand.test.js +56 -102
- package/dist/src/ui/commands/toolformatCommand.test.js.map +1 -1
- package/dist/src/ui/commands/toolsCommand.js +187 -31
- package/dist/src/ui/commands/toolsCommand.js.map +1 -1
- package/dist/src/ui/commands/types.d.ts +11 -2
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/components/AuthDialog.js +16 -55
- package/dist/src/ui/components/AuthDialog.js.map +1 -1
- package/dist/src/ui/components/Footer.js +4 -5
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/HistoryItemDisplay.js +1 -1
- package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.js +1 -1
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/StatsDisplay.js +6 -11
- package/dist/src/ui/components/StatsDisplay.js.map +1 -1
- package/dist/src/ui/components/SuggestionsDisplay.d.ts +13 -1
- package/dist/src/ui/components/SuggestionsDisplay.js +22 -3
- package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +1 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.js +14 -14
- package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js +1 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -1
- package/dist/src/ui/containers/SessionController.js +61 -117
- package/dist/src/ui/containers/SessionController.js.map +1 -1
- package/dist/src/ui/contexts/RuntimeContext.d.ts +61 -0
- package/dist/src/ui/contexts/RuntimeContext.js +118 -0
- package/dist/src/ui/contexts/RuntimeContext.js.map +1 -0
- package/dist/src/ui/contexts/TodoProvider.d.ts +1 -0
- package/dist/src/ui/contexts/TodoProvider.js +10 -8
- package/dist/src/ui/contexts/TodoProvider.js.map +1 -1
- package/dist/src/ui/contexts/ToolCallProvider.d.ts +1 -0
- package/dist/src/ui/contexts/ToolCallProvider.js +10 -9
- package/dist/src/ui/contexts/ToolCallProvider.js.map +1 -1
- package/dist/src/ui/hooks/__tests__/useSlashCompletion.set.phase09.test.d.ts +6 -0
- package/dist/src/ui/hooks/__tests__/useSlashCompletion.set.phase09.test.js +39 -0
- package/dist/src/ui/hooks/__tests__/useSlashCompletion.set.phase09.test.js.map +1 -0
- package/dist/src/ui/hooks/atCommandProcessor.js +11 -3
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.test.js +3 -1
- package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.js +4 -1
- package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.test.js +1 -0
- package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.js +27 -1
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useAuthCommand.js +11 -3
- package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
- package/dist/src/ui/hooks/useCommandCompletion.d.ts +1 -0
- package/dist/src/ui/hooks/useCommandCompletion.js +2 -0
- package/dist/src/ui/hooks/useCommandCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.js +37 -11
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.subagent.spec.d.ts +6 -0
- package/dist/src/ui/hooks/useGeminiStream.subagent.spec.js +232 -0
- package/dist/src/ui/hooks/useGeminiStream.subagent.spec.js.map +1 -0
- package/dist/src/ui/hooks/useLoadProfileDialog.d.ts +1 -1
- package/dist/src/ui/hooks/useLoadProfileDialog.js +18 -57
- package/dist/src/ui/hooks/useLoadProfileDialog.js.map +1 -1
- package/dist/src/ui/hooks/useOpenAIProviderInfo.d.ts +1 -1
- package/dist/src/ui/hooks/useOpenAIProviderInfo.js +12 -7
- package/dist/src/ui/hooks/useOpenAIProviderInfo.js.map +1 -1
- package/dist/src/ui/hooks/useProviderDialog.d.ts +1 -1
- package/dist/src/ui/hooks/useProviderDialog.js +17 -90
- package/dist/src/ui/hooks/useProviderDialog.js.map +1 -1
- package/dist/src/ui/hooks/useProviderModelDialog.d.ts +2 -2
- package/dist/src/ui/hooks/useProviderModelDialog.js +11 -12
- package/dist/src/ui/hooks/useProviderModelDialog.js.map +1 -1
- package/dist/src/ui/hooks/useReactToolScheduler.d.ts +3 -1
- package/dist/src/ui/hooks/useReactToolScheduler.js +144 -34
- package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.d.ts +32 -0
- package/dist/src/ui/hooks/useSlashCompletion.js +154 -77
- package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.test.js +39 -14
- package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useToolScheduler.test.js +108 -79
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
- package/dist/src/ui/types.d.ts +1 -0
- package/dist/src/ui/types.js.map +1 -1
- package/dist/src/validateNonInterActiveAuth.js +4 -2
- package/dist/src/validateNonInterActiveAuth.js.map +1 -1
- package/dist/src/zed-integration/schema.d.ts +30 -30
- package/dist/src/zed-integration/zedIntegration.js +112 -39
- package/dist/src/zed-integration/zedIntegration.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +5 -3
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { CommandKind, } from './types.js';
|
|
7
|
-
import {
|
|
8
|
-
import { AuthType } from '@vybestack/llxprt-code-core';
|
|
7
|
+
import { getRuntimeApi } from '../contexts/RuntimeContext.js';
|
|
9
8
|
export const modelCommand = {
|
|
10
9
|
name: 'model',
|
|
11
10
|
description: 'select or switch model',
|
|
12
11
|
kind: CommandKind.BUILT_IN,
|
|
13
12
|
action: async (context, args) => {
|
|
14
13
|
const modelName = args?.trim();
|
|
15
|
-
const providerManager = getProviderManager();
|
|
16
14
|
// Always use provider model dialog if no model specified
|
|
17
15
|
if (!modelName) {
|
|
18
16
|
return {
|
|
@@ -22,62 +20,13 @@ export const modelCommand = {
|
|
|
22
20
|
}
|
|
23
21
|
// Switch model in provider
|
|
24
22
|
try {
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
: '
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const useSettingsService = settingsService !== null;
|
|
33
|
-
activeProvider.setModel(modelName);
|
|
34
|
-
if (useSettingsService && settingsService && config) {
|
|
35
|
-
// Use SettingsService to update provider settings
|
|
36
|
-
try {
|
|
37
|
-
// Ensure activeProvider is set in SettingsService
|
|
38
|
-
settingsService.set('activeProvider', activeProvider.name);
|
|
39
|
-
await settingsService.updateSettings(activeProvider.name, {
|
|
40
|
-
model: modelName,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
console.error('SettingsService error, using fallback:', error);
|
|
45
|
-
// Keep config model in sync so /about shows correct model
|
|
46
|
-
config.setModel(modelName);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else if (config) {
|
|
50
|
-
// Fallback to direct config update
|
|
51
|
-
config.setModel(modelName);
|
|
52
|
-
}
|
|
53
|
-
// Check if the provider needs authentication after model switch
|
|
54
|
-
// This is important for providers like Anthropic that support OAuth
|
|
55
|
-
if (activeProvider.name === 'anthropic' && config) {
|
|
56
|
-
// Check if provider has isAuthenticated method (BaseProvider does)
|
|
57
|
-
const providerWithAuth = activeProvider;
|
|
58
|
-
if (typeof providerWithAuth.isAuthenticated === 'function') {
|
|
59
|
-
const hasAuth = await providerWithAuth.isAuthenticated();
|
|
60
|
-
if (!hasAuth) {
|
|
61
|
-
// Trigger auth refresh for Anthropic (will prompt for OAuth if no other auth available)
|
|
62
|
-
const currentAuthType = config.getContentGeneratorConfig()?.authType ||
|
|
63
|
-
AuthType.LOGIN_WITH_GOOGLE;
|
|
64
|
-
await config.refreshAuth(currentAuthType);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
type: 'message',
|
|
70
|
-
messageType: 'info',
|
|
71
|
-
content: `Switched from ${currentModel} to ${modelName} in provider '${activeProvider.name}'`,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return {
|
|
76
|
-
type: 'message',
|
|
77
|
-
messageType: 'error',
|
|
78
|
-
content: `Provider '${activeProvider.name}' does not support model switching`,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
23
|
+
const runtime = getRuntimeApi();
|
|
24
|
+
const result = await runtime.setActiveModel(modelName);
|
|
25
|
+
return {
|
|
26
|
+
type: 'message',
|
|
27
|
+
messageType: 'info',
|
|
28
|
+
content: `Switched from ${result.previousModel ?? 'unknown'} to ${result.nextModel} in provider '${result.providerName}'`,
|
|
29
|
+
};
|
|
81
30
|
}
|
|
82
31
|
catch (error) {
|
|
83
32
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modelCommand.js","sourceRoot":"","sources":["../../../../src/ui/commands/modelCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAKL,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"modelCommand.js","sourceRoot":"","sources":["../../../../src/ui/commands/modelCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAKL,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,wBAAwB;IACrC,IAAI,EAAE,WAAW,CAAC,QAAQ;IAC1B,MAAM,EAAE,KAAK,EACX,OAAuB,EACvB,IAAY,EACkD,EAAE;QAChE,MAAM,SAAS,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC;QAE/B,yDAAyD;QACzD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;gBACL,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,eAAe;aACxB,CAAC;QACJ,CAAC;QAED,2BAA2B;QAC3B,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;YAEvD,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,MAAM;gBACnB,OAAO,EAAE,iBAAiB,MAAM,CAAC,aAAa,IAAI,SAAS,OAAO,MAAM,CAAC,SAAS,iBAAiB,MAAM,CAAC,YAAY,GAAG;aAC1H,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,OAAO;gBACpB,OAAO,EAAE,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;aAC7F,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -4,8 +4,88 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { CommandKind, } from './types.js';
|
|
7
|
-
import { ProfileManager, AuthType } from '@vybestack/llxprt-code-core';
|
|
8
7
|
import { SettingScope } from '../../config/settings.js';
|
|
8
|
+
import { getRuntimeApi } from '../contexts/RuntimeContext.js';
|
|
9
|
+
import { DebugLogger } from '@vybestack/llxprt-code-core';
|
|
10
|
+
const profileSuggestionDescription = 'Saved profile';
|
|
11
|
+
const normalizeProfilePartial = (partial) => partial.startsWith('"') ? partial.slice(1) : partial;
|
|
12
|
+
async function listProfiles() {
|
|
13
|
+
return getRuntimeApi().listSavedProfiles();
|
|
14
|
+
}
|
|
15
|
+
function filterProfiles(partialArg, profiles) {
|
|
16
|
+
const normalizedPartial = normalizeProfilePartial(partialArg).toLowerCase();
|
|
17
|
+
return profiles.filter((profile) => normalizedPartial.length === 0
|
|
18
|
+
? true
|
|
19
|
+
: profile.toLowerCase().startsWith(normalizedPartial));
|
|
20
|
+
}
|
|
21
|
+
const profileNameCompleter = async (_ctx, partialArg) => {
|
|
22
|
+
try {
|
|
23
|
+
const profiles = await listProfiles();
|
|
24
|
+
return filterProfiles(partialArg, profiles).map((profile) => ({
|
|
25
|
+
value: profile,
|
|
26
|
+
description: profileSuggestionDescription,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const profileSaveSchema = [
|
|
34
|
+
{
|
|
35
|
+
kind: 'value',
|
|
36
|
+
name: 'profile',
|
|
37
|
+
description: 'Enter profile name to save',
|
|
38
|
+
/**
|
|
39
|
+
* @plan:PLAN-20251013-AUTOCOMPLETE.P11
|
|
40
|
+
* @requirement:REQ-004
|
|
41
|
+
* Schema-driven completion replaces legacy helpers.
|
|
42
|
+
*/
|
|
43
|
+
completer: profileNameCompleter,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
const profileLoadSchema = [
|
|
47
|
+
{
|
|
48
|
+
kind: 'value',
|
|
49
|
+
name: 'profile',
|
|
50
|
+
description: 'Select profile to load',
|
|
51
|
+
completer: profileNameCompleter,
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
const profileDeleteSchema = [
|
|
55
|
+
{
|
|
56
|
+
kind: 'value',
|
|
57
|
+
name: 'profile',
|
|
58
|
+
description: 'Select profile to delete',
|
|
59
|
+
completer: profileNameCompleter,
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
const profileSetDefaultSchema = [
|
|
63
|
+
{
|
|
64
|
+
kind: 'value',
|
|
65
|
+
name: 'profile',
|
|
66
|
+
description: 'Set default profile or choose none',
|
|
67
|
+
completer: async (_ctx, partialArg) => {
|
|
68
|
+
try {
|
|
69
|
+
const profiles = await listProfiles();
|
|
70
|
+
const candidates = ['none', ...profiles];
|
|
71
|
+
const normalizedPartial = normalizeProfilePartial(partialArg).toLowerCase();
|
|
72
|
+
return candidates
|
|
73
|
+
.filter((option) => normalizedPartial.length === 0
|
|
74
|
+
? true
|
|
75
|
+
: option.toLowerCase().startsWith(normalizedPartial))
|
|
76
|
+
.map((option) => ({
|
|
77
|
+
value: option,
|
|
78
|
+
description: option === 'none'
|
|
79
|
+
? 'Clear default profile'
|
|
80
|
+
: profileSuggestionDescription,
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
];
|
|
9
89
|
/**
|
|
10
90
|
* Profile save subcommand
|
|
11
91
|
*/
|
|
@@ -13,19 +93,7 @@ const saveCommand = {
|
|
|
13
93
|
name: 'save',
|
|
14
94
|
description: 'save current configuration to a profile',
|
|
15
95
|
kind: CommandKind.BUILT_IN,
|
|
16
|
-
|
|
17
|
-
const profileManager = new ProfileManager();
|
|
18
|
-
const profiles = await profileManager.listProfiles();
|
|
19
|
-
// Filter profiles based on partial argument
|
|
20
|
-
if (partialArg) {
|
|
21
|
-
// Handle quoted partial arguments
|
|
22
|
-
const unquoted = partialArg.startsWith('"')
|
|
23
|
-
? partialArg.slice(1)
|
|
24
|
-
: partialArg;
|
|
25
|
-
return profiles.filter((profile) => profile.startsWith(unquoted));
|
|
26
|
-
}
|
|
27
|
-
return profiles;
|
|
28
|
-
},
|
|
96
|
+
schema: profileSaveSchema,
|
|
29
97
|
action: async (context, args) => {
|
|
30
98
|
// Parse profile name from args
|
|
31
99
|
const trimmedArgs = args?.trim();
|
|
@@ -56,98 +124,8 @@ const saveCommand = {
|
|
|
56
124
|
};
|
|
57
125
|
}
|
|
58
126
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
type: 'message',
|
|
63
|
-
messageType: 'error',
|
|
64
|
-
content: 'No configuration available',
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
// Get current provider and model
|
|
68
|
-
const providerName = context.services.config.getProvider();
|
|
69
|
-
// Get the provider manager and active provider
|
|
70
|
-
const providerManager = context.services.config.getProviderManager();
|
|
71
|
-
const activeProvider = providerManager?.getActiveProvider();
|
|
72
|
-
// Get the model from the provider first (source of truth), fallback to config
|
|
73
|
-
const providerModel = activeProvider?.getCurrentModel?.();
|
|
74
|
-
const configModel = context.services.config.getModel();
|
|
75
|
-
const modelName = providerModel || configModel;
|
|
76
|
-
// Get model params from provider
|
|
77
|
-
let modelParams = {};
|
|
78
|
-
if (activeProvider &&
|
|
79
|
-
'getModelParams' in activeProvider &&
|
|
80
|
-
activeProvider.getModelParams) {
|
|
81
|
-
modelParams = activeProvider.getModelParams() || {};
|
|
82
|
-
}
|
|
83
|
-
// Get ephemeral settings from config
|
|
84
|
-
const allEphemeralSettings = context.services.config.getEphemeralSettings();
|
|
85
|
-
const ephemeralKeys = [
|
|
86
|
-
'context-limit',
|
|
87
|
-
'compression-threshold',
|
|
88
|
-
'base-url',
|
|
89
|
-
'tool-format',
|
|
90
|
-
'api-version',
|
|
91
|
-
'custom-headers',
|
|
92
|
-
'disabled-tools',
|
|
93
|
-
'tool-output-max-items',
|
|
94
|
-
'tool-output-max-tokens',
|
|
95
|
-
'tool-output-truncate-mode',
|
|
96
|
-
'tool-output-item-size-limit',
|
|
97
|
-
'max-prompt-tokens',
|
|
98
|
-
'shell-replacement',
|
|
99
|
-
'todo-continuation',
|
|
100
|
-
'socket-timeout',
|
|
101
|
-
'socket-keepalive',
|
|
102
|
-
'socket-nodelay',
|
|
103
|
-
'streaming',
|
|
104
|
-
'retries',
|
|
105
|
-
'retrywait',
|
|
106
|
-
'authOnly',
|
|
107
|
-
];
|
|
108
|
-
const ephemeralSettings = {};
|
|
109
|
-
for (const key of ephemeralKeys) {
|
|
110
|
-
const value = allEphemeralSettings[key];
|
|
111
|
-
if (value !== undefined) {
|
|
112
|
-
ephemeralSettings[key] = value;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
// Get auth-keyfile from ephemeral settings (set by /keyfile command)
|
|
116
|
-
const ephemeralKeyfile = allEphemeralSettings['auth-keyfile'];
|
|
117
|
-
if (ephemeralKeyfile) {
|
|
118
|
-
ephemeralSettings['auth-keyfile'] =
|
|
119
|
-
ephemeralKeyfile;
|
|
120
|
-
// Don't save auth-key if using keyfile
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
// Get auth-key from ephemeral settings (set by /key command)
|
|
124
|
-
const ephemeralApiKey = allEphemeralSettings['auth-key'];
|
|
125
|
-
if (ephemeralApiKey) {
|
|
126
|
-
ephemeralSettings['auth-key'] =
|
|
127
|
-
ephemeralApiKey;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
// Fallback: Check persistent settings for base-url if not in ephemeral
|
|
131
|
-
// This handles the case where base-url was set with the old command
|
|
132
|
-
if (!ephemeralSettings['base-url']) {
|
|
133
|
-
const allSettings = context.services.settings.merged || {};
|
|
134
|
-
const providerBaseUrls = allSettings.providerBaseUrls || {};
|
|
135
|
-
if (providerName && providerBaseUrls[providerName]) {
|
|
136
|
-
ephemeralSettings['base-url'] =
|
|
137
|
-
providerBaseUrls[providerName];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
// Create profile object
|
|
141
|
-
const profile = {
|
|
142
|
-
version: 1,
|
|
143
|
-
provider: providerName || '',
|
|
144
|
-
model: modelName || '',
|
|
145
|
-
modelParams,
|
|
146
|
-
ephemeralSettings: ephemeralSettings,
|
|
147
|
-
};
|
|
148
|
-
// Save profile
|
|
149
|
-
const profileManager = new ProfileManager();
|
|
150
|
-
await profileManager.saveProfile(profileName, profile);
|
|
127
|
+
const runtime = getRuntimeApi();
|
|
128
|
+
await runtime.saveProfileSnapshot(profileName);
|
|
151
129
|
return {
|
|
152
130
|
type: 'message',
|
|
153
131
|
messageType: 'info',
|
|
@@ -166,23 +144,12 @@ const saveCommand = {
|
|
|
166
144
|
/**
|
|
167
145
|
* Profile load subcommand
|
|
168
146
|
*/
|
|
147
|
+
const logger = new DebugLogger('llxprt:ui:profile-command');
|
|
169
148
|
const loadCommand = {
|
|
170
149
|
name: 'load',
|
|
171
150
|
description: 'load configuration from a saved profile',
|
|
172
151
|
kind: CommandKind.BUILT_IN,
|
|
173
|
-
|
|
174
|
-
const profileManager = new ProfileManager();
|
|
175
|
-
const profiles = await profileManager.listProfiles();
|
|
176
|
-
// Filter profiles based on partial argument
|
|
177
|
-
if (partialArg) {
|
|
178
|
-
// Handle quoted partial arguments
|
|
179
|
-
const unquoted = partialArg.startsWith('"')
|
|
180
|
-
? partialArg.slice(1)
|
|
181
|
-
: partialArg;
|
|
182
|
-
return profiles.filter((profile) => profile.startsWith(unquoted));
|
|
183
|
-
}
|
|
184
|
-
return profiles;
|
|
185
|
-
},
|
|
152
|
+
schema: profileLoadSchema,
|
|
186
153
|
action: async (context, args) => {
|
|
187
154
|
// Parse profile name from args
|
|
188
155
|
const trimmedArgs = args?.trim();
|
|
@@ -212,133 +179,76 @@ const loadCommand = {
|
|
|
212
179
|
};
|
|
213
180
|
}
|
|
214
181
|
try {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
// Apply settings in the correct order:
|
|
227
|
-
// 1. Set provider first
|
|
228
|
-
const providerManager = context.services.config.getProviderManager();
|
|
229
|
-
if (providerManager) {
|
|
230
|
-
providerManager.setActiveProvider(profile.provider);
|
|
231
|
-
// Ensure provider manager is set on config
|
|
232
|
-
context.services.config.setProviderManager(providerManager);
|
|
233
|
-
// Update the provider in config
|
|
234
|
-
context.services.config.setProvider(profile.provider);
|
|
235
|
-
}
|
|
236
|
-
// 2. Set model second
|
|
237
|
-
context.services.config.setModel(profile.model);
|
|
238
|
-
// Also set model on the provider
|
|
239
|
-
const activeProviderForModel = providerManager?.getActiveProvider();
|
|
240
|
-
if (activeProviderForModel && activeProviderForModel.setModel) {
|
|
241
|
-
activeProviderForModel.setModel(profile.model);
|
|
242
|
-
}
|
|
243
|
-
// 3. Clear existing ephemeral settings first
|
|
244
|
-
const ephemeralKeys = [
|
|
245
|
-
'auth-key',
|
|
246
|
-
'auth-keyfile',
|
|
247
|
-
'context-limit',
|
|
248
|
-
'compression-threshold',
|
|
249
|
-
'base-url',
|
|
250
|
-
'tool-format',
|
|
251
|
-
'api-version',
|
|
252
|
-
'custom-headers',
|
|
253
|
-
'disabled-tools',
|
|
254
|
-
'socket-timeout',
|
|
255
|
-
'socket-keepalive',
|
|
256
|
-
'socket-nodelay',
|
|
257
|
-
'streaming',
|
|
258
|
-
'retries',
|
|
259
|
-
'retrywait',
|
|
260
|
-
'todo-continuation',
|
|
261
|
-
'shell-replacement',
|
|
262
|
-
'tool-output-max-items',
|
|
263
|
-
'tool-output-max-tokens',
|
|
264
|
-
'tool-output-truncate-mode',
|
|
265
|
-
'tool-output-item-size-limit',
|
|
266
|
-
'max-prompt-tokens',
|
|
267
|
-
'authOnly',
|
|
268
|
-
];
|
|
269
|
-
// Clear all known ephemeral settings
|
|
270
|
-
for (const key of ephemeralKeys) {
|
|
271
|
-
context.services.config.setEphemeralSetting(key, undefined);
|
|
272
|
-
}
|
|
273
|
-
// Reset compression ephemeral settings
|
|
274
|
-
context.services.config.setEphemeralSetting('compression-threshold', undefined);
|
|
275
|
-
context.services.config.setEphemeralSetting('context-limit', undefined);
|
|
276
|
-
// Clear model parameters on the provider
|
|
277
|
-
const activeProvider = providerManager?.getActiveProvider();
|
|
278
|
-
if (activeProvider &&
|
|
279
|
-
'setModelParams' in activeProvider &&
|
|
280
|
-
activeProvider.setModelParams) {
|
|
281
|
-
// Clear all existing model params by passing undefined
|
|
282
|
-
activeProvider.setModelParams(undefined);
|
|
182
|
+
const runtime = getRuntimeApi();
|
|
183
|
+
const statusBefore = runtime.getActiveProviderStatus();
|
|
184
|
+
const result = await runtime.loadProfileByName(profileName);
|
|
185
|
+
if (result.providerName) {
|
|
186
|
+
try {
|
|
187
|
+
await runtime.switchActiveProvider(result.providerName);
|
|
188
|
+
logger.debug(() => `[profile] switchActiveProvider invoked for '${result.providerName}'`);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
logger.error(() => `[profile] failed to switch provider via runtime API: ${error instanceof Error ? error.message : String(error)}`);
|
|
192
|
+
}
|
|
283
193
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
194
|
+
const infoMessages = (result.infoMessages ?? [])
|
|
195
|
+
.map((message) => `\n- ${message}`)
|
|
196
|
+
.join('');
|
|
197
|
+
const warningMessages = (result.warnings ?? [])
|
|
198
|
+
.map((warning) => `\n⚠ ${warning}`)
|
|
199
|
+
.join('');
|
|
200
|
+
const configService = context.services.config;
|
|
201
|
+
if (configService) {
|
|
202
|
+
const providerManager = configService.getProviderManager?.();
|
|
203
|
+
if (providerManager && result.providerName) {
|
|
204
|
+
logger.debug(() => `[profile] forcing config provider manager switch to '${result.providerName}'`);
|
|
205
|
+
try {
|
|
206
|
+
providerManager.setActiveProvider(result.providerName);
|
|
207
|
+
logger.debug(() => {
|
|
208
|
+
let activeName = 'unknown';
|
|
209
|
+
try {
|
|
210
|
+
activeName = providerManager.getActiveProvider().name;
|
|
211
|
+
}
|
|
212
|
+
catch (readError) {
|
|
213
|
+
logger.debug(() => `[profile] unable to read active provider: ${readError instanceof Error ? readError.message : String(readError)}`);
|
|
214
|
+
}
|
|
215
|
+
return `[profile] config manager active provider after switch: ${activeName}`;
|
|
216
|
+
});
|
|
294
217
|
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
logger.error(() => `[profile] failed to set provider on config manager: ${error instanceof Error ? error.message : String(error)}`);
|
|
220
|
+
}
|
|
221
|
+
configService.setProvider?.(result.providerName);
|
|
295
222
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const activeProvider = providerManager?.getActiveProvider();
|
|
304
|
-
if (activeProvider && activeProvider.setBaseUrl) {
|
|
305
|
-
// Handle "none" as clearing the base URL
|
|
306
|
-
if (value === 'none') {
|
|
307
|
-
activeProvider.setBaseUrl(undefined);
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
310
|
-
activeProvider.setBaseUrl(value);
|
|
311
|
-
}
|
|
223
|
+
const geminiClient = configService.getGeminiClient?.();
|
|
224
|
+
if (geminiClient && typeof geminiClient.setTools === 'function') {
|
|
225
|
+
try {
|
|
226
|
+
await geminiClient.setTools();
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
logger.warn(() => `[profile] failed to refresh Gemini tool schema after load: ${error instanceof Error ? error.message : String(error)}`);
|
|
312
230
|
}
|
|
313
231
|
}
|
|
314
232
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if (
|
|
324
|
-
|
|
325
|
-
activeProvider.setModelParams) {
|
|
326
|
-
if (profile.modelParams &&
|
|
327
|
-
Object.keys(profile.modelParams).length > 0) {
|
|
328
|
-
activeProvider.setModelParams(profile.modelParams);
|
|
329
|
-
}
|
|
233
|
+
try {
|
|
234
|
+
const status = runtime.getActiveProviderStatus();
|
|
235
|
+
logger.debug(() => `[profile] runtime provider status after load: provider=${status.providerName}, model=${status.modelName}`);
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
logger.error(() => `[profile] failed to read runtime provider status: ${error instanceof Error ? error.message : String(error)}`);
|
|
239
|
+
}
|
|
240
|
+
const extendedContext = context;
|
|
241
|
+
if (extendedContext.checkPaymentModeChange) {
|
|
242
|
+
setTimeout(() => extendedContext.checkPaymentModeChange?.(statusBefore.providerName ?? undefined), 100);
|
|
330
243
|
}
|
|
331
|
-
// 6. Refresh auth to ensure provider is properly initialized
|
|
332
|
-
const currentAuthType = context.services.config.getContentGeneratorConfig()?.authType ||
|
|
333
|
-
AuthType.LOGIN_WITH_GOOGLE;
|
|
334
|
-
await context.services.config.refreshAuth(currentAuthType);
|
|
335
244
|
return {
|
|
336
245
|
type: 'message',
|
|
337
246
|
messageType: 'info',
|
|
338
|
-
content: `Profile '${profileName}' loaded`,
|
|
247
|
+
content: `Profile '${profileName}' loaded${infoMessages}${warningMessages}`,
|
|
339
248
|
};
|
|
340
249
|
}
|
|
341
250
|
catch (error) {
|
|
251
|
+
logger.error(() => `[profile] failed to load '${profileName}': ${error instanceof Error ? (error.stack ?? error.message) : String(error)}`);
|
|
342
252
|
// Handle specific error messages
|
|
343
253
|
if (error instanceof Error) {
|
|
344
254
|
if (error.message.includes('not found')) {
|
|
@@ -383,19 +293,7 @@ const deleteCommand = {
|
|
|
383
293
|
name: 'delete',
|
|
384
294
|
description: 'delete a saved profile',
|
|
385
295
|
kind: CommandKind.BUILT_IN,
|
|
386
|
-
|
|
387
|
-
const profileManager = new ProfileManager();
|
|
388
|
-
const profiles = await profileManager.listProfiles();
|
|
389
|
-
// Filter profiles based on partial argument
|
|
390
|
-
if (partialArg) {
|
|
391
|
-
// Handle quoted partial arguments
|
|
392
|
-
const unquoted = partialArg.startsWith('"')
|
|
393
|
-
? partialArg.slice(1)
|
|
394
|
-
: partialArg;
|
|
395
|
-
return profiles.filter((profile) => profile.startsWith(unquoted));
|
|
396
|
-
}
|
|
397
|
-
return profiles;
|
|
398
|
-
},
|
|
296
|
+
schema: profileDeleteSchema,
|
|
399
297
|
action: async (context, args) => {
|
|
400
298
|
// Parse profile name from args
|
|
401
299
|
const trimmedArgs = args?.trim();
|
|
@@ -426,9 +324,8 @@ const deleteCommand = {
|
|
|
426
324
|
};
|
|
427
325
|
}
|
|
428
326
|
try {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
await profileManager.deleteProfile(profileName);
|
|
327
|
+
const runtime = getRuntimeApi();
|
|
328
|
+
await runtime.deleteProfileByName(profileName);
|
|
432
329
|
return {
|
|
433
330
|
type: 'message',
|
|
434
331
|
messageType: 'info',
|
|
@@ -466,20 +363,7 @@ const setDefaultCommand = {
|
|
|
466
363
|
name: 'set-default',
|
|
467
364
|
description: 'set a profile to load automatically on startup',
|
|
468
365
|
kind: CommandKind.BUILT_IN,
|
|
469
|
-
|
|
470
|
-
const profileManager = new ProfileManager();
|
|
471
|
-
const profiles = await profileManager.listProfiles();
|
|
472
|
-
// Add 'none' option to clear default
|
|
473
|
-
const options = ['none', ...profiles];
|
|
474
|
-
// Filter based on partial argument
|
|
475
|
-
if (partialArg) {
|
|
476
|
-
const unquoted = partialArg.startsWith('"')
|
|
477
|
-
? partialArg.slice(1)
|
|
478
|
-
: partialArg;
|
|
479
|
-
return options.filter((option) => option.startsWith(unquoted));
|
|
480
|
-
}
|
|
481
|
-
return options;
|
|
482
|
-
},
|
|
366
|
+
schema: profileSetDefaultSchema,
|
|
483
367
|
action: async (context, args) => {
|
|
484
368
|
// Parse profile name from args
|
|
485
369
|
const trimmedArgs = args?.trim();
|
|
@@ -511,6 +395,7 @@ const setDefaultCommand = {
|
|
|
511
395
|
}
|
|
512
396
|
if (profileName.toLowerCase() === 'none') {
|
|
513
397
|
// Clear the default profile
|
|
398
|
+
getRuntimeApi().setDefaultProfileName(null);
|
|
514
399
|
context.services.settings.setValue(SettingScope.User, 'defaultProfile', undefined);
|
|
515
400
|
return {
|
|
516
401
|
type: 'message',
|
|
@@ -519,8 +404,7 @@ const setDefaultCommand = {
|
|
|
519
404
|
};
|
|
520
405
|
}
|
|
521
406
|
// Verify profile exists
|
|
522
|
-
const
|
|
523
|
-
const profiles = await profileManager.listProfiles();
|
|
407
|
+
const profiles = await listProfiles();
|
|
524
408
|
if (!profiles.includes(profileName)) {
|
|
525
409
|
return {
|
|
526
410
|
type: 'message',
|
|
@@ -529,6 +413,7 @@ const setDefaultCommand = {
|
|
|
529
413
|
};
|
|
530
414
|
}
|
|
531
415
|
// Set the default profile
|
|
416
|
+
getRuntimeApi().setDefaultProfileName(profileName);
|
|
532
417
|
context.services.settings.setValue(SettingScope.User, 'defaultProfile', profileName);
|
|
533
418
|
return {
|
|
534
419
|
type: 'message',
|
|
@@ -554,8 +439,7 @@ const listCommand = {
|
|
|
554
439
|
kind: CommandKind.BUILT_IN,
|
|
555
440
|
action: async (_context, _args) => {
|
|
556
441
|
try {
|
|
557
|
-
const
|
|
558
|
-
const profiles = await profileManager.listProfiles();
|
|
442
|
+
const profiles = await listProfiles();
|
|
559
443
|
if (profiles.length === 0) {
|
|
560
444
|
return {
|
|
561
445
|
type: 'message',
|