Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/triggers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ export function registerApiTriggers(
config: { api_path: "/agentmemory/snapshot/restore", http_method: "POST" },
});

sdk.registerFunction("api::memories",
sdk.registerFunction("api::memories",
async (req: ApiRequest): Promise<Response> => {
const authErr = checkAuth(req, secret);
if (authErr) return authErr;
Expand All @@ -1339,6 +1339,27 @@ export function registerApiTriggers(
config: { api_path: "/agentmemory/memories", http_method: "GET" },
});

sdk.registerFunction("api::memory-by-id",
async (req: ApiRequest): Promise<Response> => {
const authErr = checkAuth(req, secret);
if (authErr) return authErr;
const id = req.path_params?.["id"];
if (!id || typeof id !== "string") {
return { status_code: 400, body: { error: "id path parameter is required" } };
}
const memory = await kv.get<import("../types.js").Memory>(KV.memories, id);
if (!memory) {
return { status_code: 404, body: { error: `memory not found: ${id}` } };
}
return { status_code: 200, body: { memory } };
},
);
sdk.registerTrigger({
type: "http",
function_id: "api::memory-by-id",
config: { api_path: "/agentmemory/memories/:id", http_method: "GET" },
});
Comment on lines +1342 to +1361
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 | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify README and index.ts mention the new endpoint and any endpoint counts are updated.
fd -t f 'README.md' --max-depth 2
rg -nP '/agentmemory/memories(/:id|/\{id\})?' -C2
rg -nP 'memory-by-id|memories/:id' -C2
rg -nPi 'endpoints?\s*[:\-]?\s*\d+|\d+\s+endpoints?' README.md 2>/dev/null

Repository: rohitg00/agentmemory

Length of output: 1562


🏁 Script executed:

#!/bin/bash
# Check index.ts for endpoint count references
find . -name 'index.ts' -type f | head -10

# Count actual endpoints registered in src/triggers/api.ts
echo "=== Total registerTrigger calls in api.ts ==="
rg -c 'registerTrigger' src/triggers/api.ts

echo "=== List all endpoints in api.ts ==="
rg -oP 'api_path:\s*"([^"]+)"' src/triggers/api.ts | sort | uniq -c | sort -rn

# Check if index.ts exists at repo root or src root
echo "=== Checking for index.ts ==="
cat src/index.ts 2>/dev/null | grep -i 'endpoint' -C 2 || echo "No endpoint references in src/index.ts"

Repository: rohitg00/agentmemory

Length of output: 5848


Update endpoint counts in README.md and src/index.ts — they show 107 but should be 104.

The handler implementation itself is correct — it's registered in api.ts (lines 1342–1361) and uses proper auth/validation patterns consistent with other endpoints. However, the endpoint counts in your documentation are stale:

  • README.md text states "107 endpoints" (should be 104 — matches the badge already)
  • src/index.ts logs "Endpoints: 107 REST" (should be 104)

Both need to be corrected to 104 to match the actual unique endpoint count in the codebase.

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

In `@src/triggers/api.ts` around lines 1342 - 1361, Update the stale endpoint
count from 107 to 104: change the README text that currently says "107
endpoints" to "104 endpoints" and update the runtime log string that prints
"Endpoints: 107 REST" to "Endpoints: 104 REST" (look for the exact literal
"Endpoints: 107 REST" in the index logging code, e.g., where the app prints
endpoint counts via console.log or a logger).


sdk.registerFunction("api::semantic-list",
async (req: ApiRequest): Promise<Response> => {
const authErr = checkAuth(req, secret);
Expand Down
Loading