feat: add deepseek-agents extension (auto-injects deepseek model)
This commit is contained in:
31
extensions/deepseek-agents.ts
Normal file
31
extensions/deepseek-agents.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// ABOUTME: DeepSeek Agent Default — auto-injects deepseek-v4-flash model into subagent_create calls
|
||||
// ABOUTME: Intercepts tool_call events and patches the model parameter when not explicitly set
|
||||
|
||||
import type { ExtensionAPI, ExtensionContext, ToolCallEvent, ToolCallEventResult } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
export default function (pi: ExtensionAPI) {
|
||||
pi.on("tool_call", (event: ToolCallEvent, _ctx: ExtensionContext): ToolCallEventResult | void => {
|
||||
// Only intercept subagent_create calls
|
||||
if (event.toolName === "subagent_create") {
|
||||
const input = event.input as Record<string, unknown>;
|
||||
|
||||
// Only inject model if not explicitly set by the user
|
||||
if (!input.model) {
|
||||
input.model = "deepseek-v4-flash";
|
||||
}
|
||||
}
|
||||
|
||||
// Also intercept subagent_create_batch to inject model into each agent
|
||||
if (event.toolName === "subagent_create_batch") {
|
||||
const input = event.input as Record<string, unknown>;
|
||||
const agents = input.agents as Array<Record<string, unknown>> | undefined;
|
||||
if (agents) {
|
||||
for (const agent of agents) {
|
||||
if (!agent.model) {
|
||||
agent.model = "deepseek-v4-flash";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user