feat(agent): unify MCP tools and adopt Responses delivery

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.
This commit is contained in:
2026-10-19 18:46:58 +08:00
parent f5c3cde2c2
commit 6a49d2209e
164 changed files with 12286 additions and 2368 deletions
+14
View File
@@ -0,0 +1,14 @@
import { mkdirSync, renameSync, writeFileSync } from "node:fs";
import { dirname, join, resolve } from "node:path";
// Only a public loopback endpoint, outside model-writable workspaces. The
// trusted OpenCode process already owns its separate internal-channel token.
export function writeQueryMcpConnection(metadataRoot: string, url: string, executionTimeoutMs = 35_000) {
const path = resolve(join(dirname(metadataRoot), "mcp-query", "connection.json"));
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
const temporary = `${path}.${process.pid}.tmp`;
writeFileSync(temporary, JSON.stringify({ url, executionTimeoutMs }), { mode: 0o600 });
renameSync(temporary, path);
process.env.TJWATER_AGENT_MCP_CONNECTION_PATH = path;
return path;
}