Skip to content

fix(viewer): register GET endpoints dashboard needs (semantic, procedural, relations)#172

Merged
rohitg00 merged 1 commit intomainfrom
fix/viewer-missing-get-endpoints
Apr 20, 2026
Merged

fix(viewer): register GET endpoints dashboard needs (semantic, procedural, relations)#172
rohitg00 merged 1 commit intomainfrom
fix/viewer-missing-get-endpoints

Conversation

@rohitg00
Copy link
Copy Markdown
Owner

@rohitg00 rohitg00 commented Apr 20, 2026

Summary

Dashboard viewer (port 3113) calls three list endpoints that never reached the REST server (3111):

  • GET /agentmemory/semantic — no handler registered → 404
  • GET /agentmemory/procedural — no handler registered → 404
  • GET /agentmemory/relations — only POST registered → 405

Because loadDashboard() fans out with Promise.all, the cards for these sections stayed empty even when memories, sessions, and crystals fetched cleanly. Jay Ferguson hit this while running agentmemory with Hermes — he saw { memories: Array(3) } arriving but cards stuck on 0.

Fix

Added three auth-gated GET handlers next to api::memories in src/triggers/api.ts:

Function Path Returns
api::semantic-list GET /agentmemory/semantic { semantic: SemanticMemory[] }
api::procedural-list GET /agentmemory/procedural { procedural: ProceduralMemory[] }
api::relations-list GET /agentmemory/relations { relations: MemoryRelation[] }

Each handler reads from the same KV.semantic / KV.procedural / KV.relations keys that mesh/export already uses. Shapes match what renderDashboard parses in src/viewer/index.html:

state.dashboard.semantic   = (results[5] && results[5].facts) || (results[5] && results[5].semantic) || [];
state.dashboard.procedural = (results[6] && results[6].procedures) || (results[6] && results[6].procedural) || [];
state.dashboard.relations  = (results[7] && results[7].relations) || [];

The existing POST /agentmemory/relations (create-edge) is untouched; iii's trigger registry routes (path, method) pairs independently — same pattern as /agentmemory/actions POST/GET.

Test plan

  • npm run build — clean
  • npm test — 776 pass (unrelated fs-watcher timing flake)
  • npx tsc --noEmit — no new errors
  • Added 3 integration tests in test/integration.test.ts asserting each endpoint returns 200 with an array
  • Manual verify: start server + viewer, confirm dashboard shows counts for semantic / procedural / relations when populated

Fixes the user-visible issue in https://x.com/fergusonJC/status/... (empty dashboard with Hermes).

Summary by CodeRabbit

  • New Features

    • Added three authenticated API endpoints to retrieve different types of agent memory data: semantic memory, procedural memory, and memory relations. Each endpoint validates authorization and returns formatted list data.
  • Tests

    • Added integration tests to validate that the new memory endpoints correctly authenticate requests and return expected data structures.

…ints

Dashboard viewer called these three list endpoints but only POST
/relations existed and /semantic + /procedural were never registered,
so the frontend received 404/405 and rendered empty dashboard cards
even when data was present.

Adds:
- api::semantic-list    GET /agentmemory/semantic   -> { semantic }
- api::procedural-list  GET /agentmemory/procedural -> { procedural }
- api::relations-list   GET /agentmemory/relations  -> { relations }

Integration tests assert each endpoint returns 200 with an array.

Reported by Jay Ferguson running agentmemory with Hermes.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agentmemory Ready Ready Preview, Comment Apr 20, 2026 4:48pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

📝 Walkthrough

Walkthrough

Three new authenticated HTTP GET list endpoints were added to fetch agent memory data: semantic, procedural, and relations. Each endpoint validates authorization, retrieves the corresponding in-memory KV data, and returns it as a typed JSON response. Integration tests verify all three endpoints return HTTP 200 with expected array fields.

Changes

Cohort / File(s) Summary
Memory List Endpoints
src/triggers/api.ts
Added three new authenticated GET list endpoints (api::semantic-list, api::procedural-list, api::relations-list) that fetch and return in-memory KV memory data. Each validates authorization via checkAuth, casts KV data to typed arrays, and returns HTTP 200.
Integration Tests
test/integration.test.ts
Added a new test suite validating the three memory list endpoints with GET requests to /agentmemory/semantic, /agentmemory/procedural, and /agentmemory/relations, asserting HTTP 200 responses and validating JSON response structure.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API as API Handler
    participant Auth as Authorization
    participant KV as In-Memory KV Store
    
    Client->>API: GET /agentmemory/semantic
    API->>Auth: checkAuth(req)
    alt Auth Valid
        Auth-->>API: Authorized
        API->>KV: Fetch KV.semantic
        KV-->>API: Return data
        API->>API: Cast to SemanticMemory[]
        API-->>Client: HTTP 200 { semantic: [...] }
    else Auth Invalid
        Auth-->>API: Unauthorized
        API-->>Client: HTTP 401/403
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Three lists hop into view,
Semantic, procedural, relations too!
With auth checks standing guard so tight,
The agent's memory shines bright ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: registering three missing GET endpoints (semantic, procedural, relations) that the dashboard needs, which directly addresses the core issue of fixing missing API routes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/viewer-missing-get-endpoints

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/triggers/api.ts`:
- Around line 1240-1280: Update the endpoint count badge in README.md from 104
to 107 so it matches the actual documented total (src/index.ts declares 107 REST
endpoints) and the three newly added GET endpoints ("api::semantic-list",
"api::procedural-list", "api::relations-list") registered in
src/triggers/api.ts; ensure the badge number and any other summary counts in
README.md are changed to 107 for consistency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6e9c0e6a-9faa-46f9-9d9e-e3bce3fa1778

📥 Commits

Reviewing files that changed from the base of the PR and between ca578ce and 1dfc0a5.

📒 Files selected for processing (2)
  • src/triggers/api.ts
  • test/integration.test.ts

Comment thread src/triggers/api.ts
Comment on lines +1240 to +1280
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" },
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -nP --type=ts -C2 '\b(agentmemory/(semantic|procedural|relations))\b' index.ts src 2>/dev/null
rg -nP -C2 '\b(endpoints?|routes?)\b.*\d+' README.md | head -40

Repository: rohitg00/agentmemory

Length of output: 1799


🏁 Script executed:

cat -n README.md | grep -E -A2 -B2 "(endpoint|route)" | head -60

Repository: rohitg00/agentmemory

Length of output: 2946


🏁 Script executed:

fd index.ts --type f && cat -n index.ts | grep -i endpoint

Repository: rohitg00/agentmemory

Length of output: 270


🏁 Script executed:

cat -n src/index.ts | grep -i -E "(endpoint|count|register)"

Repository: rohitg00/agentmemory

Length of output: 7732


🏁 Script executed:

cat src/index.ts

Repository: rohitg00/agentmemory

Length of output: 15847


Fix the endpoint count badge in README.md to match the documented total.

The three new GET endpoints are correctly added to src/triggers/api.ts (lines 1251, 1265, 1279), and src/index.ts line 321 already declares 107 REST endpoints. However, the README.md badge on line 137 shows 104 endpoints while line 854 states 107 endpoints. Update the badge to 107 to match the actual endpoint count and the README text.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/triggers/api.ts` around lines 1240 - 1280, Update the endpoint count
badge in README.md from 104 to 107 so it matches the actual documented total
(src/index.ts declares 107 REST endpoints) and the three newly added GET
endpoints ("api::semantic-list", "api::procedural-list", "api::relations-list")
registered in src/triggers/api.ts; ensure the badge number and any other summary
counts in README.md are changed to 107 for consistency.

@rohitg00 rohitg00 merged commit 4f8c4ca into main Apr 20, 2026
5 checks passed
@rohitg00 rohitg00 deleted the fix/viewer-missing-get-endpoints branch April 20, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant