osagent 0.1.27 → 0.1.28
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/cli.js +183 -54
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -146180,7 +146180,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
146180
146180
|
};
|
|
146181
146181
|
}
|
|
146182
146182
|
async function createContentGenerator(config, gcConfig, sessionId2, isInitialAuth) {
|
|
146183
|
-
const version2 = "0.1.
|
|
146183
|
+
const version2 = "0.1.28";
|
|
146184
146184
|
const userAgent2 = `OSAgent/${version2} (${process.platform}; ${process.arch})`;
|
|
146185
146185
|
const baseHeaders = {
|
|
146186
146186
|
"User-Agent": userAgent2
|
|
@@ -296088,6 +296088,17 @@ var SETTINGS_SCHEMA = {
|
|
|
296088
296088
|
description: "Saved OpenAI credential profiles for quick switching via /openai-profile.",
|
|
296089
296089
|
showInDialog: false,
|
|
296090
296090
|
mergeStrategy: "shallow_merge" /* SHALLOW_MERGE */
|
|
296091
|
+
},
|
|
296092
|
+
// Provider-specific configurations
|
|
296093
|
+
providers: {
|
|
296094
|
+
type: "object",
|
|
296095
|
+
label: "Provider Configurations",
|
|
296096
|
+
category: "Security",
|
|
296097
|
+
requiresRestart: false,
|
|
296098
|
+
default: {},
|
|
296099
|
+
description: "Provider-specific configuration for each AI provider (GROQ, Ollama, OpenAI, etc.).",
|
|
296100
|
+
showInDialog: false,
|
|
296101
|
+
mergeStrategy: "shallow_merge" /* SHALLOW_MERGE */
|
|
296091
296102
|
}
|
|
296092
296103
|
}
|
|
296093
296104
|
}
|
|
@@ -309779,7 +309790,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
309779
309790
|
// packages/cli/src/utils/version.ts
|
|
309780
309791
|
async function getCliVersion() {
|
|
309781
309792
|
const pkgJson = await getPackageJson();
|
|
309782
|
-
return "0.1.
|
|
309793
|
+
return "0.1.28";
|
|
309783
309794
|
}
|
|
309784
309795
|
__name(getCliVersion, "getCliVersion");
|
|
309785
309796
|
|
|
@@ -313948,8 +313959,8 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
313948
313959
|
|
|
313949
313960
|
// packages/cli/src/generated/git-commit.ts
|
|
313950
313961
|
init_esbuild_shims();
|
|
313951
|
-
var GIT_COMMIT_INFO2 = "
|
|
313952
|
-
var CLI_VERSION2 = "0.1.
|
|
313962
|
+
var GIT_COMMIT_INFO2 = "6f7fcff";
|
|
313963
|
+
var CLI_VERSION2 = "0.1.28";
|
|
313953
313964
|
|
|
313954
313965
|
// packages/cli/src/utils/systemInfo.ts
|
|
313955
313966
|
async function getNpmVersion() {
|
|
@@ -317774,6 +317785,10 @@ function getAvailableModelsForAuthType(authType) {
|
|
|
317774
317785
|
}
|
|
317775
317786
|
}
|
|
317776
317787
|
__name(getAvailableModelsForAuthType, "getAvailableModelsForAuthType");
|
|
317788
|
+
function getAllAvailableModels() {
|
|
317789
|
+
return [...AVAILABLE_MODELS_OSA, ...AVAILABLE_MODELS_GROQ, ...AVAILABLE_MODELS_OLLAMA_LOCAL];
|
|
317790
|
+
}
|
|
317791
|
+
__name(getAllAvailableModels, "getAllAvailableModels");
|
|
317777
317792
|
function getDefaultVisionModel() {
|
|
317778
317793
|
return MAINLINE_VLM;
|
|
317779
317794
|
}
|
|
@@ -317784,6 +317799,19 @@ function isVisionModel(modelId) {
|
|
|
317784
317799
|
);
|
|
317785
317800
|
}
|
|
317786
317801
|
__name(isVisionModel, "isVisionModel");
|
|
317802
|
+
function getModelContextWindow(modelId) {
|
|
317803
|
+
const allModels = getAllAvailableModels();
|
|
317804
|
+
const model = allModels.find((m) => m.id === modelId);
|
|
317805
|
+
return model?.contextWindow ?? 131072;
|
|
317806
|
+
}
|
|
317807
|
+
__name(getModelContextWindow, "getModelContextWindow");
|
|
317808
|
+
function formatContextWindow(tokens) {
|
|
317809
|
+
if (tokens >= 1e6) {
|
|
317810
|
+
return `${Math.round(tokens / 1e6)}M`;
|
|
317811
|
+
}
|
|
317812
|
+
return `${Math.round(tokens / 1024)}K`;
|
|
317813
|
+
}
|
|
317814
|
+
__name(formatContextWindow, "formatContextWindow");
|
|
317787
317815
|
|
|
317788
317816
|
// packages/cli/src/ui/commands/modelCommand.ts
|
|
317789
317817
|
var modelCommand = {
|
|
@@ -317854,6 +317882,56 @@ var permissionsCommand = {
|
|
|
317854
317882
|
|
|
317855
317883
|
// packages/cli/src/ui/commands/providerCommand.ts
|
|
317856
317884
|
init_esbuild_shims();
|
|
317885
|
+
function getProviderApiKey(context2, providerKey, envVar) {
|
|
317886
|
+
const { settings } = context2.services;
|
|
317887
|
+
const providers = settings.merged.security?.auth?.providers;
|
|
317888
|
+
const providerConfig = providers?.[providerKey];
|
|
317889
|
+
if (providerConfig?.apiKey) {
|
|
317890
|
+
return providerConfig.apiKey;
|
|
317891
|
+
}
|
|
317892
|
+
return process.env[envVar];
|
|
317893
|
+
}
|
|
317894
|
+
__name(getProviderApiKey, "getProviderApiKey");
|
|
317895
|
+
async function persistProviderSelection(context2, authType, apiKey, model) {
|
|
317896
|
+
const { settings } = context2.services;
|
|
317897
|
+
settings.setValue("User" /* User */, "security.auth.selectedType", authType);
|
|
317898
|
+
if (apiKey) {
|
|
317899
|
+
const providerKey = authType.replace(/-/g, "_");
|
|
317900
|
+
const currentProviders = settings.merged.security?.auth?.providers || {};
|
|
317901
|
+
const updatedProviders = {
|
|
317902
|
+
...currentProviders,
|
|
317903
|
+
[providerKey]: {
|
|
317904
|
+
...currentProviders[providerKey],
|
|
317905
|
+
apiKey,
|
|
317906
|
+
model
|
|
317907
|
+
}
|
|
317908
|
+
};
|
|
317909
|
+
settings.setValue(
|
|
317910
|
+
"User" /* User */,
|
|
317911
|
+
"security.auth.providers",
|
|
317912
|
+
updatedProviders
|
|
317913
|
+
);
|
|
317914
|
+
}
|
|
317915
|
+
}
|
|
317916
|
+
__name(persistProviderSelection, "persistProviderSelection");
|
|
317917
|
+
function getProviderDisplayName(authType) {
|
|
317918
|
+
if (!authType) return "Unknown";
|
|
317919
|
+
switch (authType) {
|
|
317920
|
+
case AuthType2.USE_GROQ:
|
|
317921
|
+
return "GROQ";
|
|
317922
|
+
case AuthType2.OLLAMA_LOCAL:
|
|
317923
|
+
return "Ollama (Local)";
|
|
317924
|
+
case AuthType2.OLLAMA_CLOUD:
|
|
317925
|
+
return "Ollama (Cloud)";
|
|
317926
|
+
case AuthType2.USE_OPENAI:
|
|
317927
|
+
return "OpenAI Compatible";
|
|
317928
|
+
case AuthType2.OSA_OAUTH:
|
|
317929
|
+
return "OSAgent Cloud";
|
|
317930
|
+
default:
|
|
317931
|
+
return String(authType);
|
|
317932
|
+
}
|
|
317933
|
+
}
|
|
317934
|
+
__name(getProviderDisplayName, "getProviderDisplayName");
|
|
317857
317935
|
var providerCommand = {
|
|
317858
317936
|
name: "provider",
|
|
317859
317937
|
get description() {
|
|
@@ -317876,7 +317954,7 @@ var providerCommand = {
|
|
|
317876
317954
|
content: t2("Configuration not available.")
|
|
317877
317955
|
};
|
|
317878
317956
|
}
|
|
317879
|
-
const apiKey =
|
|
317957
|
+
const apiKey = getProviderApiKey(context2, "groq", "GROQ_API_KEY");
|
|
317880
317958
|
if (!apiKey) {
|
|
317881
317959
|
return {
|
|
317882
317960
|
type: "start_auth",
|
|
@@ -317884,7 +317962,17 @@ var providerCommand = {
|
|
|
317884
317962
|
};
|
|
317885
317963
|
}
|
|
317886
317964
|
try {
|
|
317965
|
+
process.env["GROQ_API_KEY"] = apiKey;
|
|
317887
317966
|
await config.refreshAuth(AuthType2.USE_GROQ);
|
|
317967
|
+
await persistProviderSelection(
|
|
317968
|
+
context2,
|
|
317969
|
+
AuthType2.USE_GROQ,
|
|
317970
|
+
apiKey,
|
|
317971
|
+
"moonshotai/kimi-k2-instruct-0905"
|
|
317972
|
+
);
|
|
317973
|
+
const contextWindow = getModelContextWindow(
|
|
317974
|
+
"moonshotai/kimi-k2-instruct-0905"
|
|
317975
|
+
);
|
|
317888
317976
|
return {
|
|
317889
317977
|
type: "message",
|
|
317890
317978
|
messageType: "info",
|
|
@@ -317892,15 +317980,18 @@ var providerCommand = {
|
|
|
317892
317980
|
|
|
317893
317981
|
Model: moonshotai/kimi-k2-instruct-0905
|
|
317894
317982
|
Speed: ~200 tok/s
|
|
317895
|
-
Context:
|
|
317983
|
+
Context: ${formatContextWindow(contextWindow)} tokens
|
|
317896
317984
|
|
|
317897
|
-
Use /model to change models within GROQ
|
|
317985
|
+
Use /model to change models within GROQ.
|
|
317986
|
+
Provider selection saved to settings.`)
|
|
317898
317987
|
};
|
|
317899
317988
|
} catch (error) {
|
|
317900
317989
|
return {
|
|
317901
317990
|
type: "message",
|
|
317902
317991
|
messageType: "error",
|
|
317903
|
-
content: t2(
|
|
317992
|
+
content: t2(
|
|
317993
|
+
`Failed to switch to GROQ: ${error instanceof Error ? error.message : String(error)}`
|
|
317994
|
+
)
|
|
317904
317995
|
};
|
|
317905
317996
|
}
|
|
317906
317997
|
}, "action")
|
|
@@ -317922,19 +318013,23 @@ Use /model to change models within GROQ.`)
|
|
|
317922
318013
|
}
|
|
317923
318014
|
try {
|
|
317924
318015
|
await config.refreshAuth(AuthType2.OLLAMA_LOCAL);
|
|
318016
|
+
await persistProviderSelection(context2, AuthType2.OLLAMA_LOCAL);
|
|
317925
318017
|
return {
|
|
317926
318018
|
type: "message",
|
|
317927
318019
|
messageType: "info",
|
|
317928
318020
|
content: t2(`Switched to local Ollama provider.
|
|
317929
318021
|
|
|
317930
318022
|
Make sure Ollama is running: ollama serve
|
|
317931
|
-
Use /model to select a local model
|
|
318023
|
+
Use /model to select a local model.
|
|
318024
|
+
Provider selection saved to settings.`)
|
|
317932
318025
|
};
|
|
317933
318026
|
} catch (error) {
|
|
317934
318027
|
return {
|
|
317935
318028
|
type: "message",
|
|
317936
318029
|
messageType: "error",
|
|
317937
|
-
content: t2(
|
|
318030
|
+
content: t2(
|
|
318031
|
+
`Failed to switch to Ollama: ${error instanceof Error ? error.message : String(error)}`
|
|
318032
|
+
)
|
|
317938
318033
|
};
|
|
317939
318034
|
}
|
|
317940
318035
|
}, "action")
|
|
@@ -317954,7 +318049,7 @@ Use /model to select a local model.`)
|
|
|
317954
318049
|
content: t2("Configuration not available.")
|
|
317955
318050
|
};
|
|
317956
318051
|
}
|
|
317957
|
-
const apiKey =
|
|
318052
|
+
const apiKey = getProviderApiKey(context2, "openai", "OPENAI_API_KEY");
|
|
317958
318053
|
if (!apiKey) {
|
|
317959
318054
|
return {
|
|
317960
318055
|
type: "start_auth",
|
|
@@ -317962,20 +318057,64 @@ Use /model to select a local model.`)
|
|
|
317962
318057
|
};
|
|
317963
318058
|
}
|
|
317964
318059
|
try {
|
|
318060
|
+
process.env["OPENAI_API_KEY"] = apiKey;
|
|
317965
318061
|
await config.refreshAuth(AuthType2.USE_OPENAI);
|
|
318062
|
+
await persistProviderSelection(context2, AuthType2.USE_OPENAI, apiKey);
|
|
317966
318063
|
return {
|
|
317967
318064
|
type: "message",
|
|
317968
318065
|
messageType: "info",
|
|
317969
318066
|
content: t2(`Switched to OpenAI provider.
|
|
317970
318067
|
|
|
317971
318068
|
Set OPENAI_BASE_URL for custom endpoints.
|
|
317972
|
-
Use /model to select a model
|
|
318069
|
+
Use /model to select a model.
|
|
318070
|
+
Provider selection saved to settings.`)
|
|
318071
|
+
};
|
|
318072
|
+
} catch (error) {
|
|
318073
|
+
return {
|
|
318074
|
+
type: "message",
|
|
318075
|
+
messageType: "error",
|
|
318076
|
+
content: t2(
|
|
318077
|
+
`Failed to switch to OpenAI: ${error instanceof Error ? error.message : String(error)}`
|
|
318078
|
+
)
|
|
318079
|
+
};
|
|
318080
|
+
}
|
|
318081
|
+
}, "action")
|
|
318082
|
+
},
|
|
318083
|
+
{
|
|
318084
|
+
name: "osa",
|
|
318085
|
+
altNames: ["osagent", "cloud"],
|
|
318086
|
+
get description() {
|
|
318087
|
+
return t2("Switch to OSAgent Cloud (default)");
|
|
318088
|
+
},
|
|
318089
|
+
kind: "built-in" /* BUILT_IN */,
|
|
318090
|
+
action: /* @__PURE__ */ __name(async (context2) => {
|
|
318091
|
+
const { config } = context2.services;
|
|
318092
|
+
if (!config) {
|
|
318093
|
+
return {
|
|
318094
|
+
type: "message",
|
|
318095
|
+
messageType: "error",
|
|
318096
|
+
content: t2("Configuration not available.")
|
|
318097
|
+
};
|
|
318098
|
+
}
|
|
318099
|
+
try {
|
|
318100
|
+
await config.refreshAuth(AuthType2.OSA_OAUTH);
|
|
318101
|
+
await persistProviderSelection(context2, AuthType2.OSA_OAUTH);
|
|
318102
|
+
return {
|
|
318103
|
+
type: "message",
|
|
318104
|
+
messageType: "info",
|
|
318105
|
+
content: t2(`Switched to OSAgent Cloud provider.
|
|
318106
|
+
|
|
318107
|
+
Model: qwen3-coder:480b-cloud
|
|
318108
|
+
Use /model to change models.
|
|
318109
|
+
Provider selection saved to settings.`)
|
|
317973
318110
|
};
|
|
317974
318111
|
} catch (error) {
|
|
317975
318112
|
return {
|
|
317976
318113
|
type: "message",
|
|
317977
318114
|
messageType: "error",
|
|
317978
|
-
content: t2(
|
|
318115
|
+
content: t2(
|
|
318116
|
+
`Failed to switch to OSAgent Cloud: ${error instanceof Error ? error.message : String(error)}`
|
|
318117
|
+
)
|
|
317979
318118
|
};
|
|
317980
318119
|
}
|
|
317981
318120
|
}, "action")
|
|
@@ -317987,7 +318126,7 @@ Use /model to select a model.`)
|
|
|
317987
318126
|
},
|
|
317988
318127
|
kind: "built-in" /* BUILT_IN */,
|
|
317989
318128
|
action: /* @__PURE__ */ __name(async (context2) => {
|
|
317990
|
-
const { config } = context2.services;
|
|
318129
|
+
const { config, settings } = context2.services;
|
|
317991
318130
|
if (!config) {
|
|
317992
318131
|
return {
|
|
317993
318132
|
type: "message",
|
|
@@ -317999,39 +318138,43 @@ Use /model to select a model.`)
|
|
|
317999
318138
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
318000
318139
|
const model = contentGeneratorConfig?.model || "unknown";
|
|
318001
318140
|
const baseUrl = contentGeneratorConfig?.baseUrl || "default";
|
|
318002
|
-
|
|
318003
|
-
|
|
318004
|
-
|
|
318005
|
-
|
|
318006
|
-
|
|
318007
|
-
|
|
318008
|
-
|
|
318009
|
-
|
|
318010
|
-
|
|
318011
|
-
|
|
318012
|
-
|
|
318013
|
-
|
|
318014
|
-
|
|
318015
|
-
|
|
318016
|
-
|
|
318017
|
-
|
|
318018
|
-
|
|
318019
|
-
default:
|
|
318020
|
-
providerName = String(authType);
|
|
318141
|
+
const providerName = getProviderDisplayName(authType);
|
|
318142
|
+
const contextWindow = getModelContextWindow(model);
|
|
318143
|
+
const savedAuthType = settings.merged.security?.auth?.selectedType;
|
|
318144
|
+
const providers = settings.merged.security?.auth?.providers;
|
|
318145
|
+
const providerStatuses = [];
|
|
318146
|
+
const providerList = [
|
|
318147
|
+
{ key: "groq", name: "GROQ", envVar: "GROQ_API_KEY" },
|
|
318148
|
+
{ key: "openai", name: "OpenAI", envVar: "OPENAI_API_KEY" },
|
|
318149
|
+
{ key: "ollama_local", name: "Ollama Local", envVar: null },
|
|
318150
|
+
{ key: "osa_oauth", name: "OSAgent Cloud", envVar: null }
|
|
318151
|
+
];
|
|
318152
|
+
for (const p of providerList) {
|
|
318153
|
+
const hasSettingsKey = !!providers?.[p.key]?.apiKey;
|
|
318154
|
+
const hasEnvKey = p.envVar ? !!process.env[p.envVar] : true;
|
|
318155
|
+
const configured = hasSettingsKey || hasEnvKey;
|
|
318156
|
+
const status = configured ? "\u2713" : "\u25CB";
|
|
318157
|
+
providerStatuses.push(` ${status} ${p.name}`);
|
|
318021
318158
|
}
|
|
318022
318159
|
return {
|
|
318023
318160
|
type: "message",
|
|
318024
318161
|
messageType: "info",
|
|
318025
318162
|
content: t2(`Provider Status
|
|
318026
318163
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
318027
|
-
|
|
318164
|
+
Active: ${providerName}
|
|
318028
318165
|
Model: ${model}
|
|
318166
|
+
Context: ${formatContextWindow(contextWindow)} tokens
|
|
318029
318167
|
Base URL: ${baseUrl}
|
|
318168
|
+
Saved in Settings: ${savedAuthType ? "Yes" : "No"}
|
|
318169
|
+
|
|
318170
|
+
Configured Providers:
|
|
318171
|
+
${providerStatuses.join("\n")}
|
|
318030
318172
|
|
|
318031
318173
|
Commands:
|
|
318032
318174
|
/provider groq - Switch to GROQ (Kimi K2)
|
|
318033
318175
|
/provider ollama - Switch to local Ollama
|
|
318034
318176
|
/provider openai - Switch to OpenAI compatible
|
|
318177
|
+
/provider osa - Switch to OSAgent Cloud
|
|
318035
318178
|
/model - Change model within current provider`)
|
|
318036
318179
|
};
|
|
318037
318180
|
}, "action")
|
|
@@ -318047,26 +318190,7 @@ Commands:
|
|
|
318047
318190
|
};
|
|
318048
318191
|
}
|
|
318049
318192
|
const authType = config.getAuthType();
|
|
318050
|
-
|
|
318051
|
-
switch (authType) {
|
|
318052
|
-
case AuthType2.USE_GROQ:
|
|
318053
|
-
providerName = "GROQ";
|
|
318054
|
-
break;
|
|
318055
|
-
case AuthType2.OLLAMA_LOCAL:
|
|
318056
|
-
providerName = "Ollama (Local)";
|
|
318057
|
-
break;
|
|
318058
|
-
case AuthType2.OLLAMA_CLOUD:
|
|
318059
|
-
providerName = "Ollama (Cloud)";
|
|
318060
|
-
break;
|
|
318061
|
-
case AuthType2.USE_OPENAI:
|
|
318062
|
-
providerName = "OpenAI Compatible";
|
|
318063
|
-
break;
|
|
318064
|
-
case AuthType2.OSA_OAUTH:
|
|
318065
|
-
providerName = "OSAgent Cloud";
|
|
318066
|
-
break;
|
|
318067
|
-
default:
|
|
318068
|
-
providerName = String(authType);
|
|
318069
|
-
}
|
|
318193
|
+
const providerName = getProviderDisplayName(authType);
|
|
318070
318194
|
return {
|
|
318071
318195
|
type: "message",
|
|
318072
318196
|
messageType: "info",
|
|
@@ -318079,8 +318203,13 @@ Available Providers:
|
|
|
318079
318203
|
/provider groq - GROQ (Kimi K2, ~200 tok/s, 256K context)
|
|
318080
318204
|
/provider ollama - Local Ollama (qwen2.5-coder, etc.)
|
|
318081
318205
|
/provider openai - OpenAI compatible APIs
|
|
318206
|
+
/provider osa - OSAgent Cloud (default)
|
|
318082
318207
|
/provider status - Show detailed status
|
|
318083
318208
|
|
|
318209
|
+
Configuration:
|
|
318210
|
+
API keys can be set via environment variables or saved in settings.
|
|
318211
|
+
Use the provider commands to configure and save your preferences.
|
|
318212
|
+
|
|
318084
318213
|
Environment Variables:
|
|
318085
318214
|
GROQ_API_KEY - For GROQ provider
|
|
318086
318215
|
OPENAI_API_KEY - For OpenAI provider
|