Files
paseo/plugin-examples/agent-configuration/index.server.ts
T
Mohamed Boudra 8214ebceaf feat(plugins): append agent instructions on session open
Recompute plugin instructions for each launch so changes apply on reopen without changing saved agent configuration.
2026-11-15 14:58:54 +01:00

46 lines
1.1 KiB
TypeScript

import type { PluginServerContext } from "@getpaseo/plugin/server";
export default function contribute(server: PluginServerContext) {
server.addHook("agent.create.before", async ({ request }) => {
if (request.config.provider !== "codex") {
return request;
}
return {
...request,
config: {
...request.config,
providerOptions: {
...request.config.providerOptions,
sandbox_mode: "workspace-write",
approval_policy: "on-request",
},
},
};
});
server.addHook("agent.open.before", async ({ request }) => {
// Background agents are short-lived helpers; keep the company tools for the agents users open.
if (request.provider !== "codex" || request.background) {
return;
}
return {
...request,
appendSystemPrompt: [
...(request.appendSystemPrompt ?? []),
"Follow the team engineering guide.",
],
mcpServers: {
...request.mcpServers,
company: {
type: "http",
url: "https://tools.example.com/mcp",
},
},
};
});
return () => {};
}