Skip to content
Open
Show file tree
Hide file tree
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
12 changes: 3 additions & 9 deletions plugin/scripts/stop.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,16 @@ async function main() {
}
if (isSdkChildContext(data)) return;
const sessionId = data.session_id || data.sessionId || "unknown";
fetch(`${REST_URL}/agentmemory/summarize`, {
method: "POST",
headers: authHeaders(),
body: JSON.stringify({ sessionId }),
signal: AbortSignal.timeout(12e4)
}).catch(() => {});
fetch(`${REST_URL}/agentmemory/session/end`, {
method: "POST",
headers: authHeaders(),
body: JSON.stringify({ sessionId }),
signal: AbortSignal.timeout(5e3)
}).catch(() => {});
setTimeout(() => process.exit(0), 1500).unref();
setTimeout(() => process.exit(0), 500).unref();
}
Comment on lines 26 to 33
main();

//#endregion
export { };
export {};

//# sourceMappingURL=stop.mjs.map
14 changes: 14 additions & 0 deletions src/functions/input-fingerprint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { createHash } from "node:crypto";
import type { CompressedObservation } from "../types.js";

// Stable fingerprint of an exact observation set, used to skip LLM re-runs
// (summarize, graph extraction) when the input is unchanged. Count alone is
// not enough: evict/auto-forget can delete observations, so the set can
// change while the count returns to a previous value.
export function computeInputFingerprint(
observations: CompressedObservation[],
): string {
const h = createHash("sha256");
for (const o of observations) h.update(`${o.id} ${o.timestamp} `);
return h.digest("hex").slice(0, 32);
}
Loading