This commit is contained in:
Trent Pierce 2026-01-29 11:33:57 -05:00 committed by GitHub
commit 663bd1c36f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 60 additions and 10 deletions

View File

@ -12,6 +12,7 @@ import {
hasBinary,
loadWorkspaceSkillEntries,
resolveSkillsInstallPreferences,
resolveRuntimePlatform,
type SkillEntry,
type SkillInstallSpec,
type SkillsInstallPreferences,
@ -276,6 +277,28 @@ async function installDownloadSpec(params: {
};
}
async function installWithWinget(
packageId: string,
timeoutMs: number,
): Promise<{ code: number | null; stdout: string; stderr: string }> {
if (!hasBinary("winget")) {
return { code: null, stdout: "", stderr: "winget not found" };
}
return await runCommandWithTimeout(
[
"winget",
"install",
"--id",
packageId,
"-e",
"--silent",
"--accept-source-agreements",
"--accept-package-agreements",
],
{ timeoutMs },
);
}
async function resolveBrewBinDir(timeoutMs: number, brewExe?: string): Promise<string | undefined> {
const exe = brewExe ?? (hasBinary("brew") ? "brew" : resolveBrewExecutable());
if (!exe) return undefined;
@ -366,10 +389,21 @@ export async function installSkill(params: SkillInstallRequest): Promise<SkillIn
code: brewResult.code,
};
}
} else if (resolveRuntimePlatform() === "win32" && hasBinary("winget")) {
const result = await installWithWinget("astral-sh.uv", timeoutMs);
if (result.code !== 0) {
return {
ok: false,
message: "Failed to install uv (winget)",
stdout: result.stdout.trim(),
stderr: result.stderr.trim(),
code: result.code,
};
}
} else {
return {
ok: false,
message: "uv not installed (install via brew)",
message: "uv not installed (install via brew or winget)",
stdout: "",
stderr: "",
code: null,
@ -404,10 +438,21 @@ export async function installSkill(params: SkillInstallRequest): Promise<SkillIn
code: brewResult.code,
};
}
} else if (resolveRuntimePlatform() === "win32" && hasBinary("winget")) {
const result = await installWithWinget("GoLang.Go", timeoutMs);
if (result.code !== 0) {
return {
ok: false,
message: "Failed to install go (winget)",
stdout: result.stdout.trim(),
stderr: result.stderr.trim(),
code: result.code,
};
}
} else {
return {
ok: false,
message: "go not installed (install via brew)",
message: "go not installed (install via brew or winget)",
stdout: "",
stderr: "",
code: null,

View File

@ -75,13 +75,17 @@ export function isBundledSkillAllowed(entry: SkillEntry, allowlist?: string[]):
export function hasBinary(bin: string): boolean {
const pathEnv = process.env.PATH ?? "";
const parts = pathEnv.split(path.delimiter).filter(Boolean);
const extensions = process.platform === "win32" ? [".exe", ".cmd", ".bat", ""] : [""];
for (const part of parts) {
const candidate = path.join(part, bin);
try {
fs.accessSync(candidate, fs.constants.X_OK);
return true;
} catch {
// keep scanning
for (const ext of extensions) {
const candidate = path.join(part, bin + ext);
try {
fs.accessSync(candidate, fs.constants.X_OK);
return true;
} catch {
// keep scanning
}
}
}
return false;

View File

@ -20,7 +20,7 @@ const PROVIDER_FILTER_THRESHOLD = 30;
// Models that are internal routing features and should not be shown in selection lists.
// These may be valid as defaults (e.g., set automatically during auth flow) but are not
// directly callable via API and would cause "Unknown model" errors if selected manually.
const HIDDEN_ROUTER_MODELS = new Set(["openrouter/auto"]);
const HIDDEN_ROUTER_MODELS = new Set(["openrouter/auto", "openrouter/openrouter/auto"]);
type PromptDefaultModelParams = {
config: MoltbotConfig;

View File

@ -113,7 +113,7 @@ export async function setVeniceApiKey(key: string, agentDir?: string) {
}
export const ZAI_DEFAULT_MODEL_REF = "zai/glm-4.7";
export const OPENROUTER_DEFAULT_MODEL_REF = "openrouter/auto";
export const OPENROUTER_DEFAULT_MODEL_REF = "openrouter/openrouter/auto";
export const VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF = "vercel-ai-gateway/anthropic/claude-opus-4.5";
export async function setZaiApiKey(key: string, agentDir?: string) {

View File

@ -1,3 +1,4 @@
// formatter fix
import { z } from "zod";
import { parseDurationMs } from "../cli/parse-duration.js";