Skip to content

#1 Persistent memory for AI coding agents based on real-world benchmarks

fix(viewer): add missing GET /semantic, /procedural, /relations endpoints

Rohit Ghumare1dfc0a50998f
diff --git a/src/triggers/api.ts b/src/triggers/api.ts
index 5dc4b897..689a8f10 100644
--- a/src/triggers/api.ts
+++ b/src/triggers/api.ts
@@ -1237,7 +1237,49 @@ export function registerApiTriggers(
config: { api_path: "/agentmemory/memories", http_method: "GET" },
});
- sdk.registerFunction("api::action-create",
+ sdk.registerFunction("api::semantic-list",
+ async (req: ApiRequest): Promise<Response> => {
+ const authErr = checkAuth(req, secret);
+ if (authErr) return authErr;
+ const semantic = await kv.list<import("../types.js").SemanticMemory>(KV.semantic);
+ return { status_code: 200, body: { semantic } };
+ },
+ );
+ sdk.registerTrigger({
+ type: "http",
+ function_id: "api::semantic-list",
+ config: { api_path: "/agentmemory/semantic", http_method: "GET" },
+ });
+
+ sdk.registerFunction("api::procedural-list",
+ async (req: ApiRequest): Promise<Response> => {
+ const authErr = checkAuth(req, secret);
+ if (authErr) return authErr;
+ const procedural = await kv.list<import("../types.js").ProceduralMemory>(KV.procedural);
+ return { status_code: 200, body: { procedural } };
+ },
+ );
+ sdk.registerTrigger({
+ type: "http",
+ function_id: "api::procedural-list",
+ config: { api_path: "/agentmemory/procedural", http_method: "GET" },
+ });
+
+ sdk.registerFunction("api::relations-list",
+ async (req: ApiRequest): Promise<Response> => {
+ const authErr = checkAuth(req, secret);
+ if (authErr) return authErr;
+ const relations = await kv.list<import("../types.js").MemoryRelation>(KV.relations);
+ return { status_code: 200, body: { relations } };
+ },
+ );
+ sdk.registerTrigger({
+ type: "http",
+ function_id: "api::relations-list",
+ config: { api_path: "/agentmemory/relations", http_method: "GET" },
+ });
+
+ sdk.registerFunction("api::action-create",
async (
req: ApiRequest<{
title: string;
diff --git a/test/integration.test.ts b/test/integration.test.ts
index f224c4a2..6bb96dd4 100644
--- a/test/integration.test.ts
+++ b/test/integration.test.ts
@@ -235,6 +235,35 @@ describe("agentmemory integration", () => {
});
});
+ describe("dashboard list endpoints", () => {
+ it("GET /semantic returns { semantic: [...] }", async () => {
+ const res = await fetch(url("/agentmemory/semantic"), {
+ headers: SECRET ? authHeaders() : undefined,
+ });
+ expect(res.status).toBe(200);
+ const body = (await json(res)) as { semantic: unknown[] };
+ expect(Array.isArray(body.semantic)).toBe(true);
+ });
+
+ it("GET /procedural returns { procedural: [...] }", async () => {
+ const res = await fetch(url("/agentmemory/procedural"), {
+ headers: SECRET ? authHeaders() : undefined,
+ });
+ expect(res.status).toBe(200);
+ const body = (await json(res)) as { procedural: unknown[] };
+ expect(Array.isArray(body.procedural)).toBe(true);
+ });
+
+ it("GET /relations returns { relations: [...] }", async () => {
+ const res = await fetch(url("/agentmemory/relations"), {
+ headers: SECRET ? authHeaders() : undefined,
+ });
+ expect(res.status).toBe(200);
+ const body = (await json(res)) as { relations: unknown[] };
+ expect(Array.isArray(body.relations)).toBe(true);
+ });
+ });
+
describe("auth", () => {
it("health endpoint is always public", async () => {
const res = await fetch(url("/agentmemory/health"));