Built-in design generation now runs as an agentic MCP tool-loop (reusing the agent-rs BuiltInProvider), gated behind OPENPENCIL_DESIGN_AGENT_LOOP / the Settings experimental toggle; the orchestrator stays the default. - design-agent system prompt + in-process design toolset (parity-locked with the MCP surface) + flag-gated Intent::Design routing - spawn_agents execution as sequential sub-loops + live creation-mode badges (per-agent glow + 'N/M designing...' header) - new MCP tools: get_guidelines, ToolSearch, get_screenshot, get_editor_state, export_nodes, spawn_agents; style-guide local audit - #27 AI panel restyle: rounded tool cards + green check-rings, gray user bubbles, model-pill bottom toolbar, header, empty-state pills, the PARALLEL AGENTS (agent_team_size) 1x-6x chip dropdown - multi-chat tabs: ChatSessions model (Deref-to-active) + tab row UI (switch / close / + / Cmd+T) with each run bound to its tab Large checkpoint commit spanning the working tree (Rust shell crates).
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
/**
|
|
* DeepSeek wrapper. OpenAI-compatible endpoint at api.deepseek.com.
|
|
* Key in `DEEPSEEK_API_KEY`. Latest flagship at time of wiring is
|
|
* `deepseek-v4-pro`; `deepseek-v4-flash` is the lighter variant; the
|
|
* older `deepseek-chat` / `deepseek-reasoner` IDs are deprecated
|
|
* (sunset 2026-07-24) but the harness routes them anyway so corpus
|
|
* comparisons against pre-deprecation runs still work.
|
|
*
|
|
* Docs: https://api-docs.deepseek.com/zh-cn/
|
|
*/
|
|
|
|
import type { ChatCallResult } from './openai-compat';
|
|
import { callOpenAICompat } from './openai-compat';
|
|
|
|
const DEEPSEEK_BASE_URL = process.env.DEEPSEEK_BASE_URL ?? 'https://api.deepseek.com';
|
|
const DEEPSEEK_API_KEY_ENV = 'DEEPSEEK_API_KEY';
|
|
|
|
export interface CallDeepSeekArgs {
|
|
model: string;
|
|
system: string;
|
|
user: string;
|
|
temperature?: number;
|
|
maxTokens?: number;
|
|
}
|
|
|
|
export async function callDeepSeek(args: CallDeepSeekArgs): Promise<ChatCallResult> {
|
|
const apiKey = process.env[DEEPSEEK_API_KEY_ENV];
|
|
if (!apiKey) {
|
|
throw new Error(
|
|
`${DEEPSEEK_API_KEY_ENV} not set — export it before running with --live, or pass --dry-run to use fixtures`,
|
|
);
|
|
}
|
|
return callOpenAICompat({
|
|
baseURL: DEEPSEEK_BASE_URL,
|
|
apiKey,
|
|
model: args.model,
|
|
system: args.system,
|
|
user: args.user,
|
|
temperature: args.temperature,
|
|
maxTokens: args.maxTokens,
|
|
label: 'deepseek',
|
|
// ab-v2 garbage attribution: 6 of 40 deepseek-v4-pro runs returned
|
|
// empty content (server-side flakiness, not model output). retries=1
|
|
// recovered most but ab-v3 still leaked 6 empty-content errors.
|
|
// Bumped to 2 alongside ark to share the exponential backoff window.
|
|
retries: 2,
|
|
});
|
|
}
|