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
+5 -4
View File
@@ -28,9 +28,10 @@ await mkdir(dataRoot, { recursive: true });
const sharedEnvironment = {
...process.env,
AGENT_INTERNAL_TOKEN: bridgeToken,
CONVERSATION_WORKSPACE_ROOT: join(dataRoot, "conversation-workspaces"),
TJWATER_AGENT_WORKSPACE_ROOT: join(dataRoot, "conversation-workspaces"),
CONVERSATION_WORKSPACE_ROOT: join(dataRoot, "session-workspaces"),
TJWATER_AGENT_WORKSPACE_ROOT: join(dataRoot, "session-workspaces"),
TJWATER_AGENT_INTERNAL_BASE_URL: agentBaseUrl,
TJWATER_AGENT_MCP_CONNECTION_PATH: join(dataRoot, "mcp-query", "connection.json"),
// Retained for tools loaded by an older compatible OpenCode process.
TJWATER_AGENT_INTERNAL_TOKEN: bridgeToken,
};
@@ -40,11 +41,12 @@ const opencode = await startOpencode2({
hostname: "127.0.0.1",
port: opencodePort,
timeout: 30_000,
config: serviceOpencodeConfig(JSON.parse(await readFile(join(projectRoot, "opencode.json"), "utf8"))),
config: serviceOpencodeConfig(JSON.parse(await readFile(join(projectRoot, "opencode.json"), "utf8")), undefined, sharedEnvironment.CONVERSATION_WORKSPACE_ROOT),
env: {
...sharedEnvironment,
XDG_CACHE_HOME: join(dataRoot, "xdg-cache"),
XDG_DATA_HOME: join(dataRoot, "xdg-data"),
OPENCODE_DB: join(dataRoot, "xdg-data", "opencode", "opencode.db"),
XDG_STATE_HOME: join(dataRoot, "xdg-state"),
},
});
@@ -81,7 +83,6 @@ try {
MEMORY_STORAGE_DIR: join(dataRoot, "memory"),
OPENCODE_SKILLS_ROOT_DIR: join(dataRoot, "skills"),
PERSISTENCE_BACKUP_DIR: join(dataRoot, "backup"),
RESULT_REF_STORAGE_DIR: join(dataRoot, "result-refs"),
SESSION_LEARNING_STATE_STORAGE_DIR: join(dataRoot, "session-learning-state"),
SESSION_METADATA_STORAGE_DIR: join(dataRoot, "session-metadata"),
SESSION_TRANSCRIPT_STORAGE_DIR: join(dataRoot, "session-transcripts"),