mirror of
https://github.com/clawdbot/clawdbot.git
synced 2026-01-31 11:27:45 +01:00
chore: update deps and pi model discovery
This commit is contained in:
@@ -10,8 +10,8 @@ read_when:
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/openclaw/openclaw/main/docs/assets/openclaw-logo-text-dark.png">
|
||||
<img src="https://raw.githubusercontent.com/openclaw/openclaw/main/docs/assets/openclaw-logo-text.png" alt="OpenClaw" width="500">
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/openclaw/openclaw/main/docs/assets/openclaw-logo-text-dark.png" />
|
||||
<img src="https://raw.githubusercontent.com/openclaw/openclaw/main/docs/assets/openclaw-logo-text.png" alt="OpenClaw" width="500" />
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@matrix-org/matrix-sdk-crypto-nodejs": "^0.4.0",
|
||||
"markdown-it": "14.1.0",
|
||||
"@vector-im/matrix-bot-sdk": "0.8.0-element.3",
|
||||
"music-metadata": "^11.10.6",
|
||||
"markdown-it": "14.1.0",
|
||||
"music-metadata": "^11.11.1",
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dependencies": {
|
||||
"@lancedb/lancedb": "^0.23.0",
|
||||
"@sinclair/typebox": "0.34.47",
|
||||
"openai": "^6.16.0"
|
||||
"openai": "^6.17.0"
|
||||
},
|
||||
"openclaw": {
|
||||
"extensions": [
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/agents-hosting": "^1.2.2",
|
||||
"@microsoft/agents-hosting-express": "^1.2.2",
|
||||
"@microsoft/agents-hosting-extensions-teams": "^1.2.2",
|
||||
"openclaw": "workspace:*",
|
||||
"@microsoft/agents-hosting": "^1.2.3",
|
||||
"@microsoft/agents-hosting-express": "^1.2.3",
|
||||
"@microsoft/agents-hosting-extensions-teams": "^1.2.3",
|
||||
"express": "^5.2.1",
|
||||
"openclaw": "workspace:*",
|
||||
"proper-lockfile": "^4.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"nostr-tools": "^2.22.1",
|
||||
"openclaw": "workspace:*",
|
||||
"nostr-tools": "^2.20.0",
|
||||
"zod": "^4.3.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"@twurple/api": "^8.0.3",
|
||||
"@twurple/auth": "^8.0.3",
|
||||
"@twurple/chat": "^8.0.3",
|
||||
"zod": "^4.3.5"
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"openclaw": "workspace:*"
|
||||
|
||||
@@ -28,6 +28,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"openclaw": "workspace:*",
|
||||
"undici": "7.19.0"
|
||||
"undici": "7.19.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"type": "module",
|
||||
"description": "OpenClaw Zalo Personal Account plugin via zca-cli",
|
||||
"dependencies": {
|
||||
"openclaw": "workspace:*",
|
||||
"@sinclair/typebox": "0.34.47"
|
||||
"@sinclair/typebox": "0.34.47",
|
||||
"openclaw": "workspace:*"
|
||||
},
|
||||
"openclaw": {
|
||||
"extensions": [
|
||||
|
||||
30
package.json
30
package.json
@@ -155,9 +155,9 @@
|
||||
"packageManager": "pnpm@10.23.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "0.13.1",
|
||||
"@aws-sdk/client-bedrock": "^3.975.0",
|
||||
"@aws-sdk/client-bedrock": "^3.980.0",
|
||||
"@buape/carbon": "0.14.0",
|
||||
"@clack/prompts": "^0.11.0",
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@grammyjs/runner": "^2.0.3",
|
||||
"@grammyjs/transformer-throttler": "^1.2.1",
|
||||
"@homebridge/ciao": "^1.3.4",
|
||||
@@ -176,12 +176,12 @@
|
||||
"body-parser": "^2.2.2",
|
||||
"chalk": "^5.6.2",
|
||||
"chokidar": "^5.0.0",
|
||||
"chromium-bidi": "13.0.1",
|
||||
"chromium-bidi": "13.1.0",
|
||||
"cli-highlight": "^2.1.11",
|
||||
"commander": "^14.0.2",
|
||||
"commander": "^14.0.3",
|
||||
"croner": "^9.1.0",
|
||||
"detect-libc": "^2.1.2",
|
||||
"discord-api-types": "^0.38.37",
|
||||
"discord-api-types": "^0.38.38",
|
||||
"dotenv": "^17.2.3",
|
||||
"express": "^5.2.1",
|
||||
"file-type": "^21.3.0",
|
||||
@@ -196,21 +196,21 @@
|
||||
"node-edge-tts": "^1.2.9",
|
||||
"osc-progress": "^0.3.0",
|
||||
"pdfjs-dist": "^5.4.530",
|
||||
"playwright-core": "1.58.0",
|
||||
"playwright-core": "1.58.1",
|
||||
"proper-lockfile": "^4.1.2",
|
||||
"qrcode-terminal": "^0.12.0",
|
||||
"sharp": "^0.34.5",
|
||||
"sqlite-vec": "0.1.7-alpha.2",
|
||||
"tar": "7.5.4",
|
||||
"tslog": "^4.10.2",
|
||||
"undici": "^7.19.0",
|
||||
"undici": "^7.19.2",
|
||||
"ws": "^8.19.0",
|
||||
"yaml": "^2.8.2",
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@napi-rs/canvas": "^0.1.88",
|
||||
"node-llama-cpp": "3.15.0"
|
||||
"@napi-rs/canvas": "^0.1.89",
|
||||
"node-llama-cpp": "3.15.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@grammyjs/types": "^3.23.0",
|
||||
@@ -220,21 +220,21 @@
|
||||
"@types/body-parser": "^1.19.6",
|
||||
"@types/express": "^5.0.6",
|
||||
"@types/markdown-it": "^14.1.2",
|
||||
"@types/node": "^25.0.10",
|
||||
"@types/node": "^25.1.0",
|
||||
"@types/proper-lockfile": "^4.1.4",
|
||||
"@types/qrcode-terminal": "^0.12.2",
|
||||
"@types/ws": "^8.18.1",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260124.1",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260130.1",
|
||||
"@vitest/coverage-v8": "^4.0.18",
|
||||
"docx-preview": "^0.3.7",
|
||||
"lit": "^3.3.2",
|
||||
"lucide": "^0.563.0",
|
||||
"ollama": "^0.6.3",
|
||||
"oxfmt": "0.26.0",
|
||||
"oxlint": "^1.41.0",
|
||||
"oxlint-tsgolint": "^0.11.1",
|
||||
"oxfmt": "0.27.0",
|
||||
"oxlint": "^1.42.0",
|
||||
"oxlint-tsgolint": "^0.11.4",
|
||||
"quicktype-core": "^23.2.6",
|
||||
"rolldown": "1.0.0-rc.1",
|
||||
"rolldown": "1.0.0-rc.2",
|
||||
"signal-utils": "^0.21.1",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "^5.9.3",
|
||||
|
||||
2651
pnpm-lock.yaml
generated
2651
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { type Api, completeSimple, type Model } from "@mariozechner/pi-ai";
|
||||
import { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent";
|
||||
import { discoverAuthStorage, discoverModels } from "./pi-model-discovery.js";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { isTruthyEnvValue } from "../infra/env.js";
|
||||
import {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// Lazy-load pi-coding-agent model metadata so we can infer context windows when
|
||||
// the agent reports a model id. This includes custom models.json entries.
|
||||
|
||||
import { join } from "node:path";
|
||||
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { resolveOpenClawAgentDir } from "./agent-paths.js";
|
||||
import { ensureOpenClawModelsJson } from "./models-config.js";
|
||||
@@ -12,12 +10,12 @@ type ModelEntry = { id: string; contextWindow?: number };
|
||||
const MODEL_CACHE = new Map<string, number>();
|
||||
const loadPromise = (async () => {
|
||||
try {
|
||||
const { AuthStorage, ModelRegistry } = await import("@mariozechner/pi-coding-agent");
|
||||
const { discoverAuthStorage, discoverModels } = await import("./pi-model-discovery.js");
|
||||
const cfg = loadConfig();
|
||||
await ensureOpenClawModelsJson(cfg);
|
||||
const agentDir = resolveOpenClawAgentDir();
|
||||
const authStorage = new AuthStorage(join(agentDir, "auth.json"));
|
||||
const modelRegistry = new ModelRegistry(authStorage, join(agentDir, "models.json"));
|
||||
const authStorage = discoverAuthStorage(agentDir);
|
||||
const modelRegistry = discoverModels(authStorage, agentDir);
|
||||
const models = modelRegistry.getAll() as ModelEntry[];
|
||||
for (const m of models) {
|
||||
if (!m?.id) continue;
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
resetModelCatalogCacheForTest,
|
||||
} from "./model-catalog.js";
|
||||
|
||||
type PiSdkModule = typeof import("@mariozechner/pi-coding-agent");
|
||||
type PiSdkModule = typeof import("./pi-model-discovery.js");
|
||||
|
||||
vi.mock("./models-config.js", () => ({
|
||||
ensureOpenClawModelsJson: vi.fn().mockResolvedValue({ agentDir: "/tmp", wrote: false }),
|
||||
|
||||
@@ -20,11 +20,11 @@ type DiscoveredModel = {
|
||||
input?: Array<"text" | "image">;
|
||||
};
|
||||
|
||||
type PiSdkModule = typeof import("@mariozechner/pi-coding-agent");
|
||||
type PiSdkModule = typeof import("./pi-model-discovery.js");
|
||||
|
||||
let modelCatalogPromise: Promise<ModelCatalogEntry[]> | null = null;
|
||||
let hasLoggedModelCatalogError = false;
|
||||
const defaultImportPiSdk = () => import("@mariozechner/pi-coding-agent");
|
||||
const defaultImportPiSdk = () => import("./pi-model-discovery.js");
|
||||
let importPiSdk = defaultImportPiSdk;
|
||||
|
||||
export function resetModelCatalogCacheForTest() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type Api, completeSimple, type Model } from "@mariozechner/pi-ai";
|
||||
import { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent";
|
||||
import { discoverAuthStorage, discoverModels } from "./pi-model-discovery.js";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
|
||||
@@ -396,6 +396,17 @@ export async function compactEmbeddedPiSessionDirect(
|
||||
await resourceLoader.reload();
|
||||
|
||||
let session: Awaited<ReturnType<typeof createAgentSession>>["session"];
|
||||
const resourceLoader = new DefaultResourceLoader({
|
||||
cwd: resolvedWorkspace,
|
||||
agentDir,
|
||||
settingsManager,
|
||||
additionalExtensionPaths,
|
||||
systemPromptOverride: systemPrompt,
|
||||
skillsOverride: () => ({ skills: [], diagnostics: [] }),
|
||||
agentsFilesOverride: () => ({ agentsFiles: [] }),
|
||||
});
|
||||
await resourceLoader.reload();
|
||||
|
||||
({ session } = await createAgentSession({
|
||||
cwd: resolvedWorkspace,
|
||||
agentDir,
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("@mariozechner/pi-coding-agent", () => ({
|
||||
AuthStorage: class {
|
||||
mocked = true;
|
||||
},
|
||||
ModelRegistry: class {
|
||||
find() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
vi.mock("../pi-model-discovery.js", () => ({
|
||||
discoverAuthStorage: vi.fn(() => ({ mocked: true })),
|
||||
discoverModels: vi.fn(() => ({ find: vi.fn(() => null) })),
|
||||
}));
|
||||
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { join } from "node:path";
|
||||
|
||||
import type { Api, Model } from "@mariozechner/pi-ai";
|
||||
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
import {
|
||||
discoverAuthStorage,
|
||||
discoverModels,
|
||||
type AuthStorage,
|
||||
type ModelRegistry,
|
||||
} from "../pi-model-discovery.js";
|
||||
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { ModelDefinitionConfig } from "../../config/types.js";
|
||||
@@ -59,8 +62,8 @@ export function resolveModel(
|
||||
modelRegistry: ModelRegistry;
|
||||
} {
|
||||
const resolvedAgentDir = agentDir ?? resolveOpenClawAgentDir();
|
||||
const authStorage = new AuthStorage(join(resolvedAgentDir, "auth.json"));
|
||||
const modelRegistry = new ModelRegistry(authStorage, join(resolvedAgentDir, "models.json"));
|
||||
const authStorage = discoverAuthStorage(resolvedAgentDir);
|
||||
const modelRegistry = discoverModels(authStorage, resolvedAgentDir);
|
||||
const model = modelRegistry.find(provider, modelId) as Model<Api> | null;
|
||||
if (!model) {
|
||||
const providers = cfg?.models?.providers ?? {};
|
||||
|
||||
@@ -458,11 +458,10 @@ export async function runEmbeddedAttempt(
|
||||
settingsManager,
|
||||
additionalExtensionPaths,
|
||||
noSkills: true,
|
||||
systemPromptOverride: () => systemPrompt(""),
|
||||
systemPromptOverride: systemPrompt,
|
||||
agentsFilesOverride: () => ({ agentsFiles: [] }),
|
||||
});
|
||||
await resourceLoader.reload();
|
||||
|
||||
({ session } = await createAgentSession({
|
||||
cwd: resolvedWorkspace,
|
||||
agentDir,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { Api, AssistantMessage, ImageContent, Model } from "@mariozechner/pi-ai";
|
||||
import type { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
import type { AuthStorage, ModelRegistry } from "../../pi-model-discovery.js";
|
||||
|
||||
import type { ReasoningLevel, ThinkLevel, VerboseLevel } from "../../../auto-reply/thinking.js";
|
||||
import type { OpenClawConfig } from "../../../config/config.js";
|
||||
|
||||
@@ -75,7 +75,7 @@ export function buildEmbeddedSystemPrompt(params: {
|
||||
|
||||
export function createSystemPromptOverride(
|
||||
systemPrompt: string,
|
||||
): (defaultPrompt: string) => string {
|
||||
): (defaultPrompt?: string) => string {
|
||||
const trimmed = systemPrompt.trim();
|
||||
return () => trimmed;
|
||||
}
|
||||
|
||||
14
src/agents/pi-model-discovery.ts
Normal file
14
src/agents/pi-model-discovery.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import path from "node:path";
|
||||
|
||||
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
// Compatibility helpers for pi-coding-agent 0.50+ (discover* helpers removed).
|
||||
export function discoverAuthStorage(agentDir: string): AuthStorage {
|
||||
return new AuthStorage(path.join(agentDir, "auth.json"));
|
||||
}
|
||||
|
||||
export function discoverModels(authStorage: AuthStorage, agentDir: string): ModelRegistry {
|
||||
return new ModelRegistry(authStorage, path.join(agentDir, "models.json"));
|
||||
}
|
||||
|
||||
export type { AuthStorage, ModelRegistry };
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
complete,
|
||||
type Model,
|
||||
} from "@mariozechner/pi-ai";
|
||||
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
import { discoverAuthStorage, discoverModels } from "../pi-model-discovery.js";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
@@ -233,8 +233,8 @@ async function runImagePrompt(params: {
|
||||
: undefined;
|
||||
|
||||
await ensureOpenClawModelsJson(effectiveCfg, params.agentDir);
|
||||
const authStorage = new AuthStorage(path.join(params.agentDir, "auth.json"));
|
||||
const modelRegistry = new ModelRegistry(authStorage, path.join(params.agentDir, "models.json"));
|
||||
const authStorage = discoverAuthStorage(params.agentDir);
|
||||
const modelRegistry = discoverModels(authStorage, params.agentDir);
|
||||
|
||||
const result = await runWithImageModelFallback({
|
||||
cfg: effectiveCfg,
|
||||
|
||||
@@ -68,8 +68,9 @@ export async function applyAuthChoiceOAuth(
|
||||
});
|
||||
|
||||
spin.stop("Chutes OAuth complete");
|
||||
const email = typeof creds.email === "string" ? creds.email.trim() : "";
|
||||
const profileId = `chutes:${email || "default"}`;
|
||||
const email =
|
||||
typeof creds.email === "string" && creds.email.trim() ? creds.email.trim() : "default";
|
||||
const profileId = `chutes:${email}`;
|
||||
|
||||
await writeOAuthCredentials("chutes", creds, params.agentDir);
|
||||
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||
|
||||
@@ -58,9 +58,9 @@ vi.mock("../agents/model-auth.js", () => ({
|
||||
getCustomProviderApiKey,
|
||||
}));
|
||||
|
||||
vi.mock("@mariozechner/pi-coding-agent", () => ({
|
||||
AuthStorage,
|
||||
ModelRegistry,
|
||||
vi.mock("../agents/pi-model-discovery.js", () => ({
|
||||
discoverAuthStorage,
|
||||
discoverModels,
|
||||
}));
|
||||
|
||||
function makeRuntime() {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { join } from "node:path";
|
||||
|
||||
import type { Api, Model } from "@mariozechner/pi-ai";
|
||||
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
import { discoverAuthStorage, discoverModels } from "../../agents/pi-model-discovery.js";
|
||||
|
||||
import { resolveOpenClawAgentDir } from "../../agents/agent-paths.js";
|
||||
import type { AuthProfileStore } from "../../agents/auth-profiles.js";
|
||||
@@ -43,8 +41,8 @@ const hasAuthForProvider = (provider: string, cfg: OpenClawConfig, authStore: Au
|
||||
export async function loadModelRegistry(cfg: OpenClawConfig) {
|
||||
await ensureOpenClawModelsJson(cfg);
|
||||
const agentDir = resolveOpenClawAgentDir();
|
||||
const authStorage = new AuthStorage(join(agentDir, "auth.json"));
|
||||
const registry = new ModelRegistry(authStorage, join(agentDir, "models.json"));
|
||||
const authStorage = discoverAuthStorage(agentDir);
|
||||
const registry = discoverModels(authStorage, agentDir);
|
||||
const models = registry.getAll() as Model<Api>[];
|
||||
const availableModels = registry.getAvailable() as Model<Api>[];
|
||||
const availableKeys = new Set(availableModels.map((model) => modelKey(model.provider, model.id)));
|
||||
|
||||
@@ -9,10 +9,10 @@ export async function writeOAuthCredentials(
|
||||
creds: OAuthCredentials,
|
||||
agentDir?: string,
|
||||
): Promise<void> {
|
||||
// Write to resolved agent dir so gateway finds credentials on startup.
|
||||
const email = typeof creds.email === "string" ? creds.email.trim() : "";
|
||||
const email =
|
||||
typeof creds.email === "string" && creds.email.trim() ? creds.email.trim() : "default";
|
||||
upsertAuthProfile({
|
||||
profileId: `${provider}:${email || "default"}`,
|
||||
profileId: `${provider}:${email}`,
|
||||
credential: {
|
||||
type: "oauth",
|
||||
provider,
|
||||
|
||||
@@ -5,7 +5,7 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import type { Api, Model } from "@mariozechner/pi-ai";
|
||||
import { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent";
|
||||
import { discoverAuthStorage, discoverModels } from "../agents/pi-model-discovery.js";
|
||||
import { describe, it } from "vitest";
|
||||
import { resolveOpenClawAgentDir } from "../agents/agent-paths.js";
|
||||
import { resolveAgentWorkspaceDir } from "../agents/agent-scope.js";
|
||||
|
||||
@@ -227,9 +227,9 @@ export const testIsNixMode = hoisted.testIsNixMode;
|
||||
export const sessionStoreSaveDelayMs = hoisted.sessionStoreSaveDelayMs;
|
||||
export const embeddedRunMock = hoisted.embeddedRunMock;
|
||||
|
||||
vi.mock("@mariozechner/pi-coding-agent", async () => {
|
||||
const actual = await vi.importActual<typeof import("@mariozechner/pi-coding-agent")>(
|
||||
"@mariozechner/pi-coding-agent",
|
||||
vi.mock("../agents/pi-model-discovery.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("../agents/pi-model-discovery.js")>(
|
||||
"../agents/pi-model-discovery.js",
|
||||
);
|
||||
|
||||
class MockModelRegistry extends actual.ModelRegistry {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { join } from "node:path";
|
||||
|
||||
import type { Api, AssistantMessage, Context, Model } from "@mariozechner/pi-ai";
|
||||
import { complete } from "@mariozechner/pi-ai";
|
||||
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
import { discoverAuthStorage, discoverModels } from "../../agents/pi-model-discovery.js";
|
||||
|
||||
import { getApiKeyForModel, requireApiKey } from "../../agents/model-auth.js";
|
||||
import { ensureOpenClawModelsJson } from "../../agents/models-config.js";
|
||||
@@ -14,8 +12,8 @@ export async function describeImageWithModel(
|
||||
params: ImageDescriptionRequest,
|
||||
): Promise<ImageDescriptionResult> {
|
||||
await ensureOpenClawModelsJson(params.cfg, params.agentDir);
|
||||
const authStorage = new AuthStorage(join(params.agentDir, "auth.json"));
|
||||
const modelRegistry = new ModelRegistry(authStorage, join(params.agentDir, "models.json"));
|
||||
const authStorage = discoverAuthStorage(params.agentDir);
|
||||
const modelRegistry = discoverModels(authStorage, params.agentDir);
|
||||
const model = modelRegistry.find(params.provider, params.model) as Model<Api> | null;
|
||||
if (!model) {
|
||||
throw new Error(`Unknown model: ${params.provider}/${params.model}`);
|
||||
|
||||
@@ -58,15 +58,17 @@ export function createClackPrompter(): WizardPrompter {
|
||||
initialValues: params.initialValues,
|
||||
}),
|
||||
),
|
||||
text: async (params) =>
|
||||
guardCancel(
|
||||
text: async (params) => {
|
||||
const validate = params.validate;
|
||||
return guardCancel(
|
||||
await text({
|
||||
message: stylePromptMessage(params.message),
|
||||
initialValue: params.initialValue,
|
||||
placeholder: params.placeholder,
|
||||
validate: params.validate,
|
||||
validate: validate ? (value) => validate(value ?? "") : undefined,
|
||||
}),
|
||||
),
|
||||
);
|
||||
},
|
||||
confirm: async (params) =>
|
||||
guardCancel(
|
||||
await confirm({
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitest/browser-playwright": "4.0.18",
|
||||
"playwright": "^1.58.0",
|
||||
"playwright": "^1.58.1",
|
||||
"typescript": "^5.9.3",
|
||||
"vitest": "4.0.18"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user