fix: clean up lint + guardCancel typing
This commit is contained in:
@@ -52,6 +52,8 @@
|
|||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Models/Onboarding: configure MiniMax (minimax.io) via Anthropic-compatible `/anthropic` endpoint by default (keep `minimax-api` as a legacy alias).
|
- Models/Onboarding: configure MiniMax (minimax.io) via Anthropic-compatible `/anthropic` endpoint by default (keep `minimax-api` as a legacy alias).
|
||||||
|
- Models: normalize Gemini 3 Pro/Flash IDs to preview names for live model lookups. (#769) — thanks @steipete.
|
||||||
|
- CLI: fix guardCancel typing for configure prompts. (#769) — thanks @steipete.
|
||||||
- Gateway/WebChat: include handshake validation details in the WebSocket close reason for easier debugging; preserve close codes.
|
- Gateway/WebChat: include handshake validation details in the WebSocket close reason for easier debugging; preserve close codes.
|
||||||
- Gateway/Auth: send invalid connect responses before closing the handshake; stabilize invalid-connect auth test.
|
- Gateway/Auth: send invalid connect responses before closing the handshake; stabilize invalid-connect auth test.
|
||||||
- Gateway: tighten gateway listener detection.
|
- Gateway: tighten gateway listener detection.
|
||||||
|
|||||||
@@ -166,10 +166,7 @@ describe("models config", () => {
|
|||||||
providers: Record<string, { models: Array<{ id: string }> }>;
|
providers: Record<string, { models: Array<{ id: string }> }>;
|
||||||
};
|
};
|
||||||
const ids = parsed.providers.google?.models?.map((model) => model.id);
|
const ids = parsed.providers.google?.models?.map((model) => model.id);
|
||||||
expect(ids).toEqual([
|
expect(ids).toEqual(["gemini-3-pro-preview", "gemini-3-flash-preview"]);
|
||||||
"gemini-3-pro-preview",
|
|
||||||
"gemini-3-flash-preview",
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -151,9 +151,6 @@ describeLive("live models (profile keys)", () => {
|
|||||||
const authStorage = discoverAuthStorage(agentDir);
|
const authStorage = discoverAuthStorage(agentDir);
|
||||||
const modelRegistry = discoverModels(authStorage, agentDir);
|
const modelRegistry = discoverModels(authStorage, agentDir);
|
||||||
const models = modelRegistry.getAll() as Array<Model<Api>>;
|
const models = modelRegistry.getAll() as Array<Model<Api>>;
|
||||||
const modelByKey = new Map(
|
|
||||||
models.map((model) => [`${model.provider}/${model.id}`, model]),
|
|
||||||
);
|
|
||||||
|
|
||||||
const rawModels = process.env.CLAWDBOT_LIVE_MODELS?.trim();
|
const rawModels = process.env.CLAWDBOT_LIVE_MODELS?.trim();
|
||||||
const useModern = rawModels === "modern" || rawModels === "all";
|
const useModern = rawModels === "modern" || rawModels === "all";
|
||||||
@@ -348,10 +345,15 @@ describeLive("live models (profile keys)", () => {
|
|||||||
isAnthropicRateLimitError(message) &&
|
isAnthropicRateLimitError(message) &&
|
||||||
attempt + 1 < attemptMax
|
attempt + 1 < attemptMax
|
||||||
) {
|
) {
|
||||||
logProgress(`${progressLabel}: rate limit, retrying with next key`);
|
logProgress(
|
||||||
|
`${progressLabel}: rate limit, retrying with next key`,
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (model.provider === "google" && isGoogleModelNotFoundError(err)) {
|
if (
|
||||||
|
model.provider === "google" &&
|
||||||
|
isGoogleModelNotFoundError(err)
|
||||||
|
) {
|
||||||
skipped.push({ model: id, reason: message });
|
skipped.push({ model: id, reason: message });
|
||||||
logProgress(`${progressLabel}: skip (google model not found)`);
|
logProgress(`${progressLabel}: skip (google model not found)`);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
discoverAuthStorage,
|
discoverAuthStorage,
|
||||||
discoverModels,
|
discoverModels,
|
||||||
} from "@mariozechner/pi-coding-agent";
|
} from "@mariozechner/pi-coding-agent";
|
||||||
import { describe, expect, it } from "vitest";
|
import { describe, it } from "vitest";
|
||||||
import { resolveClawdbotAgentDir } from "../agents/agent-paths.js";
|
import { resolveClawdbotAgentDir } from "../agents/agent-paths.js";
|
||||||
import {
|
import {
|
||||||
collectAnthropicApiKeys,
|
collectAnthropicApiKeys,
|
||||||
@@ -34,8 +34,7 @@ const GATEWAY_LIVE = process.env.CLAWDBOT_LIVE_GATEWAY === "1";
|
|||||||
const ZAI_FALLBACK = process.env.CLAWDBOT_LIVE_GATEWAY_ZAI_FALLBACK === "1";
|
const ZAI_FALLBACK = process.env.CLAWDBOT_LIVE_GATEWAY_ZAI_FALLBACK === "1";
|
||||||
const PROVIDERS = parseFilter(process.env.CLAWDBOT_LIVE_GATEWAY_PROVIDERS);
|
const PROVIDERS = parseFilter(process.env.CLAWDBOT_LIVE_GATEWAY_PROVIDERS);
|
||||||
const THINKING_LEVEL = "high";
|
const THINKING_LEVEL = "high";
|
||||||
const THINKING_TAG_RE =
|
const THINKING_TAG_RE = /<\s*\/?\s*(?:think(?:ing)?|thought|antthinking)\s*>/i;
|
||||||
/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking)\s*>/i;
|
|
||||||
const FINAL_TAG_RE = /<\s*\/?\s*final\s*>/i;
|
const FINAL_TAG_RE = /<\s*\/?\s*final\s*>/i;
|
||||||
|
|
||||||
const describeLive = LIVE || GATEWAY_LIVE ? describe : describe.skip;
|
const describeLive = LIVE || GATEWAY_LIVE ? describe : describe.skip;
|
||||||
@@ -286,7 +285,11 @@ function buildMinimaxProviderOverride(params: {
|
|||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
}): ModelProviderConfig | null {
|
}): ModelProviderConfig | null {
|
||||||
const existing = params.cfg.models?.providers?.minimax;
|
const existing = params.cfg.models?.providers?.minimax;
|
||||||
if (!existing || !Array.isArray(existing.models) || existing.models.length === 0)
|
if (
|
||||||
|
!existing ||
|
||||||
|
!Array.isArray(existing.models) ||
|
||||||
|
existing.models.length === 0
|
||||||
|
)
|
||||||
return null;
|
return null;
|
||||||
return {
|
return {
|
||||||
...existing,
|
...existing,
|
||||||
@@ -356,7 +359,9 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) {
|
|||||||
const anthropicKeys = collectAnthropicApiKeys();
|
const anthropicKeys = collectAnthropicApiKeys();
|
||||||
if (anthropicKeys.length > 0) {
|
if (anthropicKeys.length > 0) {
|
||||||
process.env.ANTHROPIC_API_KEY = anthropicKeys[0];
|
process.env.ANTHROPIC_API_KEY = anthropicKeys[0];
|
||||||
logProgress(`[${params.label}] anthropic keys loaded: ${anthropicKeys.length}`);
|
logProgress(
|
||||||
|
`[${params.label}] anthropic keys loaded: ${anthropicKeys.length}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const sessionKey = `agent:dev:${params.label}`;
|
const sessionKey = `agent:dev:${params.label}`;
|
||||||
const failures: Array<{ model: string; error: string }> = [];
|
const failures: Array<{ model: string; error: string }> = [];
|
||||||
@@ -444,7 +449,9 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) {
|
|||||||
{ expectFinal: true },
|
{ expectFinal: true },
|
||||||
);
|
);
|
||||||
if (toolProbe?.status !== "ok") {
|
if (toolProbe?.status !== "ok") {
|
||||||
throw new Error(`tool probe failed: status=${String(toolProbe?.status)}`);
|
throw new Error(
|
||||||
|
`tool probe failed: status=${String(toolProbe?.status)}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const toolText = extractPayloadText(toolProbe?.result);
|
const toolText = extractPayloadText(toolProbe?.result);
|
||||||
assertNoReasoningTags({
|
assertNoReasoningTags({
|
||||||
@@ -572,7 +579,9 @@ async function runGatewayModelSuite(params: GatewayModelSuiteParams) {
|
|||||||
{ expectFinal: true },
|
{ expectFinal: true },
|
||||||
);
|
);
|
||||||
if (first?.status !== "ok") {
|
if (first?.status !== "ok") {
|
||||||
throw new Error(`tool-only turn failed: status=${String(first?.status)}`);
|
throw new Error(
|
||||||
|
`tool-only turn failed: status=${String(first?.status)}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const firstText = extractPayloadText(first?.result);
|
const firstText = extractPayloadText(first?.result);
|
||||||
assertNoReasoningTags({
|
assertNoReasoningTags({
|
||||||
@@ -686,7 +695,6 @@ describeLive("gateway live (dev agent, profile keys)", () => {
|
|||||||
|
|
||||||
const candidates: Array<Model<Api>> = [];
|
const candidates: Array<Model<Api>> = [];
|
||||||
for (const model of wanted) {
|
for (const model of wanted) {
|
||||||
const id = `${model.provider}/${model.id}`;
|
|
||||||
if (PROVIDERS && !PROVIDERS.has(model.provider)) continue;
|
if (PROVIDERS && !PROVIDERS.has(model.provider)) continue;
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
@@ -721,9 +729,13 @@ describeLive("gateway live (dev agent, profile keys)", () => {
|
|||||||
thinkingLevel: THINKING_LEVEL,
|
thinkingLevel: THINKING_LEVEL,
|
||||||
});
|
});
|
||||||
|
|
||||||
const minimaxCandidates = candidates.filter((model) => model.provider === "minimax");
|
const minimaxCandidates = candidates.filter(
|
||||||
|
(model) => model.provider === "minimax",
|
||||||
|
);
|
||||||
if (minimaxCandidates.length === 0) {
|
if (minimaxCandidates.length === 0) {
|
||||||
logProgress("[minimax] no candidates with keys; skipping dual endpoint probes");
|
logProgress(
|
||||||
|
"[minimax] no candidates with keys; skipping dual endpoint probes",
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -743,7 +755,9 @@ describeLive("gateway live (dev agent, profile keys)", () => {
|
|||||||
providerOverrides: { minimax: minimaxOpenAi },
|
providerOverrides: { minimax: minimaxOpenAi },
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
logProgress("[minimax-openai] missing minimax provider config; skipping");
|
logProgress(
|
||||||
|
"[minimax-openai] missing minimax provider config; skipping",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const minimaxAnthropic = buildMinimaxProviderOverride({
|
const minimaxAnthropic = buildMinimaxProviderOverride({
|
||||||
@@ -762,7 +776,9 @@ describeLive("gateway live (dev agent, profile keys)", () => {
|
|||||||
providerOverrides: { minimax: minimaxAnthropic },
|
providerOverrides: { minimax: minimaxAnthropic },
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
logProgress("[minimax-anthropic] missing minimax provider config; skipping");
|
logProgress(
|
||||||
|
"[minimax-anthropic] missing minimax provider config; skipping",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
20 * 60 * 1000,
|
20 * 60 * 1000,
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ function loadProfileEnv(): void {
|
|||||||
try {
|
try {
|
||||||
const output = execFileSync(
|
const output = execFileSync(
|
||||||
"/bin/bash",
|
"/bin/bash",
|
||||||
[
|
["-lc", `set -a; source "${profilePath}" >/dev/null 2>&1; env -0`],
|
||||||
"-lc",
|
|
||||||
`set -a; source \"${profilePath}\" >/dev/null 2>&1; env -0`,
|
|
||||||
],
|
|
||||||
{ encoding: "utf8" },
|
{ encoding: "utf8" },
|
||||||
);
|
);
|
||||||
const entries = output.split("\0");
|
const entries = output.split("\0");
|
||||||
|
|||||||
Reference in New Issue
Block a user