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:
@@ -54,7 +54,7 @@ export class ChatSessionBridge {
|
||||
let sessionId = existingSessionId;
|
||||
let created = false;
|
||||
if (!sessionId) {
|
||||
const session = await this.runtime.createSession();
|
||||
const session = await this.runtime.createSession(undefined, requestContext);
|
||||
sessionId = session.id;
|
||||
requestContext = {
|
||||
...requestContext,
|
||||
@@ -67,7 +67,7 @@ export class ChatSessionBridge {
|
||||
sessionId,
|
||||
startedAt: Date.now(),
|
||||
};
|
||||
const workspaceDirectory = await this.runtime.ensureSessionWorkspace?.(sessionId);
|
||||
const workspaceDirectory = await this.runtime.ensureSessionWorkspace?.(sessionId, requestContext);
|
||||
setRuntimeSessionContext({
|
||||
workspaceDirectory,
|
||||
actorKey: requestContext.actorKey,
|
||||
@@ -110,7 +110,8 @@ export class ChatSessionBridge {
|
||||
return null;
|
||||
}
|
||||
|
||||
await this.abortActiveRuntime(clientSessionId, sessionId);
|
||||
try { await this.runtime.cancelPendingUserInputs?.(sessionId); }
|
||||
finally { await this.abortActiveRuntime(clientSessionId, sessionId); }
|
||||
return {
|
||||
clientSessionId,
|
||||
sessionId,
|
||||
@@ -121,6 +122,8 @@ export class ChatSessionBridge {
|
||||
async deleteSession(context: {
|
||||
clientSessionId: string;
|
||||
sessionId: string;
|
||||
actorKey: string;
|
||||
projectKey: string;
|
||||
}) {
|
||||
const clientSessionId = context.clientSessionId.trim();
|
||||
const sessionId = context.sessionId.trim();
|
||||
@@ -129,19 +132,8 @@ export class ChatSessionBridge {
|
||||
this.abortControllers.delete(clientSessionId);
|
||||
controller.abort();
|
||||
}
|
||||
await this.runtime.abortSession(sessionId).catch((error) => {
|
||||
logger.warn(
|
||||
{ clientSessionId, sessionId, err: error },
|
||||
"failed to abort runtime session",
|
||||
);
|
||||
});
|
||||
await this.runtime.waitForSessionIdle(sessionId).catch((error) => {
|
||||
logger.warn(
|
||||
{ clientSessionId, sessionId, err: error },
|
||||
"failed while waiting for runtime session to become idle",
|
||||
);
|
||||
});
|
||||
removeRuntimeSessionContext(sessionId);
|
||||
try { await this.runtime.removeSession(sessionId, context); }
|
||||
finally { removeRuntimeSessionContext(sessionId); }
|
||||
}
|
||||
|
||||
private buildRequestContext(context: {
|
||||
|
||||
Reference in New Issue
Block a user