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:
@@ -1,5 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from "bun:test";
|
||||
import { mkdtemp, rm } from "node:fs/promises";
|
||||
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
@@ -157,4 +157,26 @@ describe("SessionMetadataStore", () => {
|
||||
expect((await store.findByTask(context, "50000000-0000-4000-8000-000000000001", "task_collaboration"))?.sessionId).toBe("collaboration");
|
||||
expect((await store.findByRequest(context, "60000000-0000-4000-8000-000000000001"))?.sessionId).toBe("execution");
|
||||
});
|
||||
|
||||
it("updates its scoped index after writes and deletion without rereading unrelated records", async () => {
|
||||
const context = { actorKey: "actor-a", projectKey: "project-a", userId: "user-a" };
|
||||
const { record } = await store.ensure({ ...context, sessionId: "first" });
|
||||
expect((await store.list(context)).map((item) => item.sessionId)).toEqual(["first"]);
|
||||
// A listing already built the index; subsequent calls must not rescan files.
|
||||
await writeFile(join(tempDir, "unrelated.json"), "not valid JSON");
|
||||
await store.touch(record, { title: "updated title" });
|
||||
const listed = await store.list(context);
|
||||
expect(listed[0]?.title).toBe("updated title");
|
||||
listed[0]!.actorKey = "other-actor";
|
||||
expect((await store.list(context))[0]?.actorKey).toBe("actor-a");
|
||||
await store.ensure({ ...context, sessionId: "second" });
|
||||
expect((await store.list(context)).map((item) => item.sessionId).sort()).toEqual(["first", "second"]);
|
||||
await store.remove(record);
|
||||
expect((await store.list(context)).map((item) => item.sessionId)).toEqual(["second"]);
|
||||
expect(await store.get(context, "first")).toBeNull();
|
||||
expect((await store.get(context, "first", { includeDeleted: true }))?.deletedAt).toBeDefined();
|
||||
expect(await store.get({ ...context, userId: "user-b" }, "first", { includeDeleted: true })).toBeNull();
|
||||
await expect(store.touch(record, { title: "revived" })).rejects.toThrow("session not found");
|
||||
await expect(store.ensure({ ...context, sessionId: "first" })).rejects.toThrow("session not found");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user