// src/backends/opencode/args.ts
function normalizeOpencodeModel(model) {
  if (model.includes("/")) return model;
  if (model.startsWith("claude-")) return `anthropic/${model}`;
  if (model.startsWith("gemini-")) return `google/${model}`;
  if (model.startsWith("gpt-") || model.startsWith("o1-") || model.startsWith("o3-") || model.startsWith("o4-") || model.startsWith("chatgpt-")) return `openai/${model}`;
  return `ollama/${model}`;
}
function buildOpencodeArgs(input) {
  const args = ["run", "--format", "json", "--dangerously-skip-permissions"];
  if (input.backendSessionId) {
    args.push("--session", input.backendSessionId);
  }
  if (input.agent.model) {
    args.push("--model", normalizeOpencodeModel(input.agent.model.id));
  }
  return args;
}
function wrapOpencodePrompt(prompt, systemPrompt) {
  if (!systemPrompt) return prompt;
  return `Instructions: ${systemPrompt}

---

${prompt}`;
}

export {
  buildOpencodeArgs,
  wrapOpencodePrompt
};
