@orbit-build/cli 0.3.5 → 0.3.6
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/index.js +69 -41
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -262280,14 +262280,14 @@ var WEB_UI_FOUNDATION_STYLES = String.raw`
|
|
|
262280
262280
|
:root {
|
|
262281
262281
|
color-scheme: light;
|
|
262282
262282
|
--canvas: #f4f6f3;
|
|
262283
|
-
--canvas-deep: #
|
|
262284
|
-
--sidebar: #
|
|
262285
|
-
--sidebar-ink: #
|
|
262286
|
-
--sidebar-muted: #
|
|
262287
|
-
--sidebar-faint: #
|
|
262288
|
-
--sidebar-border: rgba(
|
|
262289
|
-
--sidebar-surface: rgba(255, 255, 255, 0.
|
|
262290
|
-
--sidebar-active: rgba(255, 255, 255, 0.
|
|
262283
|
+
--canvas-deep: #e8ebe8;
|
|
262284
|
+
--sidebar: #eef0ed;
|
|
262285
|
+
--sidebar-ink: #202824;
|
|
262286
|
+
--sidebar-muted: #59645f;
|
|
262287
|
+
--sidebar-faint: #76817c;
|
|
262288
|
+
--sidebar-border: rgba(29, 43, 37, 0.11);
|
|
262289
|
+
--sidebar-surface: rgba(255, 255, 255, 0.5);
|
|
262290
|
+
--sidebar-active: rgba(255, 255, 255, 0.78);
|
|
262291
262291
|
--surface: #fafbf9;
|
|
262292
262292
|
--surface-raised: #ffffff;
|
|
262293
262293
|
--surface-subtle: #eef2ef;
|
|
@@ -269329,7 +269329,6 @@ var CommandRouter = class {
|
|
|
269329
269329
|
const isZh = config.language !== "en";
|
|
269330
269330
|
const { port } = parseWebUiArgs(parts.slice(1).join(" "));
|
|
269331
269331
|
try {
|
|
269332
|
-
await this.refreshProviderModels(config.provider.default);
|
|
269333
269332
|
const handle = await startOrbitWebUi({
|
|
269334
269333
|
cwd,
|
|
269335
269334
|
config,
|
|
@@ -269423,6 +269422,9 @@ var CommandRouter = class {
|
|
|
269423
269422
|
eventBus.emitEvent("info", {
|
|
269424
269423
|
message: `${statusText}: ${displayUrl.href}`
|
|
269425
269424
|
});
|
|
269425
|
+
void this.refreshProviderModels(config.provider.default, {
|
|
269426
|
+
timeoutMs: 2500
|
|
269427
|
+
});
|
|
269426
269428
|
} catch (error) {
|
|
269427
269429
|
const message2 = error instanceof Error ? error.message : String(error);
|
|
269428
269430
|
this.printOutput(
|
|
@@ -269690,41 +269692,60 @@ var CommandRouter = class {
|
|
|
269690
269692
|
});
|
|
269691
269693
|
const selectedProvider = await Prompt.askSelect(
|
|
269692
269694
|
isZh ? `\u5F53\u524D\u670D\u52A1\u5546\uFF1A${this.providerInstance.id}\u3002\u8BF7\u9009\u62E9\u6A21\u578B\u670D\u52A1\u5546\uFF1A` : `Current provider: ${this.providerInstance.id}. Select a model provider:`,
|
|
269693
|
-
providerOptions
|
|
269694
|
-
{
|
|
269695
|
-
suppressCloseRenderOnSelect: true,
|
|
269696
|
-
renderOnSelectValues: ["cancel"]
|
|
269697
|
-
}
|
|
269695
|
+
providerOptions
|
|
269698
269696
|
);
|
|
269699
269697
|
if (!selectedProvider || selectedProvider === "cancel") {
|
|
269700
269698
|
return { shouldExit: false, processed: true };
|
|
269701
269699
|
}
|
|
269702
|
-
await this.refreshProviderModels(selectedProvider);
|
|
269703
269700
|
const providerId = selectedProvider;
|
|
269704
269701
|
const providerChanged = providerId !== this.providerInstance.id;
|
|
269705
269702
|
const activeModel2 = loop.getModelOverride() || activeConfig.models.default;
|
|
269706
|
-
const
|
|
269707
|
-
|
|
269708
|
-
value:
|
|
269709
|
-
label:
|
|
269710
|
-
}
|
|
269711
|
-
|
|
269712
|
-
|
|
269713
|
-
|
|
269714
|
-
|
|
269715
|
-
|
|
269716
|
-
|
|
269717
|
-
|
|
269718
|
-
|
|
269719
|
-
|
|
269720
|
-
|
|
269721
|
-
|
|
269722
|
-
|
|
269723
|
-
|
|
269724
|
-
|
|
269703
|
+
const createModelOptions = () => [
|
|
269704
|
+
{
|
|
269705
|
+
value: "auto",
|
|
269706
|
+
label: isZh ? "\u81EA\u52A8\u8DEF\u7531\uFF08Flash / Pro \u6309\u4EFB\u52A1\u9009\u62E9\uFF09" : "Auto routing (Flash / Pro by task)"
|
|
269707
|
+
},
|
|
269708
|
+
...getProviderModelCandidates(activeConfig, providerId).map(
|
|
269709
|
+
(model) => ({
|
|
269710
|
+
value: model,
|
|
269711
|
+
label: formatModelOptionLabel(model)
|
|
269712
|
+
})
|
|
269713
|
+
),
|
|
269714
|
+
{
|
|
269715
|
+
value: "refresh",
|
|
269716
|
+
label: isZh ? "\u5237\u65B0\u6A21\u578B\u5217\u8868\u2026" : "Refresh model catalog\u2026"
|
|
269717
|
+
},
|
|
269718
|
+
{
|
|
269719
|
+
value: "custom",
|
|
269720
|
+
label: isZh ? "\u81EA\u5B9A\u4E49\u6A21\u578B\u540D\u79F0\u2026" : "Custom model name\u2026"
|
|
269721
|
+
},
|
|
269722
|
+
{ value: "cancel", label: isZh ? "\u53D6\u6D88" : "Cancel" }
|
|
269723
|
+
];
|
|
269724
|
+
let selectedModel = await Prompt.askSelect(
|
|
269725
269725
|
isZh ? `\u5F53\u524D\u6A21\u578B\uFF1A${activeModel2}\u3002\u8BF7\u9009\u62E9\u8981\u5207\u6362\u7684\u6A21\u578B\uFF1A` : `Current model: ${activeModel2}. Select a model to switch:`,
|
|
269726
|
-
|
|
269726
|
+
createModelOptions()
|
|
269727
269727
|
);
|
|
269728
|
+
while (selectedModel === "refresh") {
|
|
269729
|
+
this.printOutput(
|
|
269730
|
+
picocolors18.cyan(
|
|
269731
|
+
isZh ? "\u25CF \u6B63\u5728\u5237\u65B0\u6A21\u578B\u5217\u8868\u2026" : "\u25CF Refreshing model catalog\u2026"
|
|
269732
|
+
)
|
|
269733
|
+
);
|
|
269734
|
+
const refreshed = await this.refreshProviderModels(providerId, {
|
|
269735
|
+
timeoutMs: 5e3
|
|
269736
|
+
});
|
|
269737
|
+
this.printOutput(
|
|
269738
|
+
refreshed ? picocolors18.green(
|
|
269739
|
+
isZh ? "\u2714 \u6A21\u578B\u5217\u8868\u5DF2\u5237\u65B0\u3002" : "\u2714 Model catalog refreshed."
|
|
269740
|
+
) : picocolors18.yellow(
|
|
269741
|
+
isZh ? "\u26A0\uFE0F \u65E0\u6CD5\u5237\u65B0\u6A21\u578B\u5217\u8868\uFF0C\u7EE7\u7EED\u4F7F\u7528\u7F13\u5B58\u5217\u8868\u3002" : "\u26A0\uFE0F Model catalog refresh failed; using the cached catalog."
|
|
269742
|
+
)
|
|
269743
|
+
);
|
|
269744
|
+
selectedModel = await Prompt.askSelect(
|
|
269745
|
+
isZh ? `\u5F53\u524D\u6A21\u578B\uFF1A${activeModel2}\u3002\u8BF7\u9009\u62E9\u8981\u5207\u6362\u7684\u6A21\u578B\uFF1A` : `Current model: ${activeModel2}. Select a model to switch:`,
|
|
269746
|
+
createModelOptions()
|
|
269747
|
+
);
|
|
269748
|
+
}
|
|
269728
269749
|
if (!selectedModel || selectedModel === "cancel") {
|
|
269729
269750
|
return { shouldExit: false, processed: true };
|
|
269730
269751
|
}
|
|
@@ -269733,7 +269754,8 @@ var CommandRouter = class {
|
|
|
269733
269754
|
if (providerChanged) {
|
|
269734
269755
|
const switched = await this.switchProvider(
|
|
269735
269756
|
providerId,
|
|
269736
|
-
"__auto__"
|
|
269757
|
+
"__auto__",
|
|
269758
|
+
{ refreshCatalog: false }
|
|
269737
269759
|
);
|
|
269738
269760
|
if (!switched.ok) {
|
|
269739
269761
|
this.printOutput(picocolors18.red(`\u2716 ${switched.message}`));
|
|
@@ -269761,7 +269783,8 @@ var CommandRouter = class {
|
|
|
269761
269783
|
}
|
|
269762
269784
|
if (providerChanged) {
|
|
269763
269785
|
const switched = await this.switchProvider(providerId, finalModel, {
|
|
269764
|
-
allowUnlistedModel: selectedModel === "custom"
|
|
269786
|
+
allowUnlistedModel: selectedModel === "custom",
|
|
269787
|
+
refreshCatalog: false
|
|
269765
269788
|
});
|
|
269766
269789
|
if (!switched.ok) {
|
|
269767
269790
|
this.printOutput(picocolors18.red(`\u2716 ${switched.message}`));
|
|
@@ -270304,16 +270327,17 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
270304
270327
|
}
|
|
270305
270328
|
return { ok: true };
|
|
270306
270329
|
}
|
|
270307
|
-
async refreshProviderModels(providerId) {
|
|
270330
|
+
async refreshProviderModels(providerId, options = {}) {
|
|
270308
270331
|
const provider = this.config.providers[providerId];
|
|
270309
270332
|
if (!provider?.baseUrl || provider.type !== "openai" && provider.type !== "openai-compatible" && provider.type !== "ollama") {
|
|
270310
|
-
return;
|
|
270333
|
+
return false;
|
|
270311
270334
|
}
|
|
270312
270335
|
try {
|
|
270313
270336
|
const discovered = await discoverProviderModels({
|
|
270314
270337
|
baseUrl: provider.baseUrl,
|
|
270315
270338
|
apiKey: provider.apiKey,
|
|
270316
|
-
...provider.type === "ollama" ? { providerType: "ollama" } : {}
|
|
270339
|
+
...provider.type === "ollama" ? { providerType: "ollama" } : {},
|
|
270340
|
+
...options.timeoutMs !== void 0 ? { timeoutMs: options.timeoutMs } : {}
|
|
270317
270341
|
});
|
|
270318
270342
|
provider.baseUrl = discovered.baseUrl;
|
|
270319
270343
|
provider.models = discovered.models;
|
|
@@ -270321,7 +270345,9 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
270321
270345
|
...provider.modelCapabilities || {},
|
|
270322
270346
|
...discovered.modelCapabilities
|
|
270323
270347
|
};
|
|
270348
|
+
return true;
|
|
270324
270349
|
} catch {
|
|
270350
|
+
return false;
|
|
270325
270351
|
}
|
|
270326
270352
|
}
|
|
270327
270353
|
async switchProvider(providerId, preferredModel, options = {}) {
|
|
@@ -270333,7 +270359,9 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
270333
270359
|
if (!this.config.providers[providerId]) {
|
|
270334
270360
|
return { ok: false, message: `Provider not found: ${providerId}` };
|
|
270335
270361
|
}
|
|
270336
|
-
|
|
270362
|
+
if (options.refreshCatalog !== false) {
|
|
270363
|
+
await this.refreshProviderModels(providerId);
|
|
270364
|
+
}
|
|
270337
270365
|
const previousProvider = this.config.provider.default;
|
|
270338
270366
|
this.config.provider.default = providerId;
|
|
270339
270367
|
try {
|