import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; export default function (pi: ExtensionAPI) { // --- Configuration --- const MODEL_PREFIX_REGEX = /^qwen3/i; const PREPEND_TEXT = `You are Qwen, created by Alibaba Cloud. You are a helpful assistant.`; // --- Extension logic --- pi.on("session_start", async (_event, ctx) => { const modelId = ctx.model?.id; if (modelId && MODEL_PREFIX_REGEX.test(modelId)) { ctx.ui.notify(`Qwen3 prompt: active (model: ${modelId})`, "info"); } }); pi.on("model_select", async (event, ctx) => { const modelId = event.model.id; if (MODEL_PREFIX_REGEX.test(modelId)) { ctx.ui.notify(`Qwen3 prompt: enabled for ${modelId}`, "info"); } }); pi.on("before_agent_start", async (event, ctx) => { const modelId = ctx.model?.id; if (!modelId) return; if (!MODEL_PREFIX_REGEX.test(modelId)) return; return { systemPrompt: PREPEND_TEXT + "\n\n" + event.systemPrompt, }; }); }