Move project and host queries into native MCP with host-owned OAuth/context, while retaining memory, skills, actions and publication plugins. Add nearby-model queries and explicit chat/task/learning model defaults. Adopt Responses HTTP/SSE and native steer/queue inbox delivery, preserving scoped session ownership, pending input edits and investigation communication. Disable local-provider discovery: Server /health allowed native vLLM to probe /v1/models on port 8000. A native before/after regression prevents recurrence. Validation: 170 focused Bun tests; service/plugin typechecks; native discovery, provider-discovery and input-inbox smoke checks; no paid model inference.
18 lines
953 B
TypeScript
18 lines
953 B
TypeScript
import type { Plugin } from "@opencode/plugin";
|
|
import { TASK_AGENT, TASK_READER_AGENT } from "../src/runtime/task-agent-policy.js";
|
|
import { queryMcpToolId } from "../src/runtime/product-mcp-tools.js";
|
|
|
|
export const AGENT_MESSAGE_TOOLS = [
|
|
queryMcpToolId("list_investigation_tasks"), queryMcpToolId("get_investigation_task"), "send_task_message", queryMcpToolId("read_agent_messages"), "reply_agent_message",
|
|
] as const;
|
|
|
|
// Catalog filtering complements the static profiles. The authenticated internal
|
|
// bridge is authoritative for purpose, actor, project, run and thread ownership.
|
|
export async function registerAgentMessagePolicy(ctx: Parameters<Plugin.Plugin["setup"]>[0]) {
|
|
await ctx.session.hook("context", async (event) => {
|
|
const denied = event.agent === TASK_READER_AGENT ? AGENT_MESSAGE_TOOLS
|
|
: event.agent === TASK_AGENT ? AGENT_MESSAGE_TOOLS.slice(0, 3) : [];
|
|
for (const name of denied) delete event.tools[name];
|
|
});
|
|
}
|