@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
18 lines • 793 B
JavaScript
import { createHash } from "node:crypto";
import { canonicalJson, toStoreValue } from "@earendil-works/pi-agent-core";
/**
* The 32-byte SHA-256 digest (hex) of one tool's schema, in the executor's canonical JSON form (the form the model
* and a hand receive). A call names the digest it was built against, so a change to this tool makes that call
* stale while a change to any other tool does not.
*/
export function toolSchemaDigest(tool) {
const value = canonicalJson(toStoreValue({
name: tool.name,
description: tool.description,
parameters: tool.parameters,
outputSchema: tool.outputSchema,
executionMode: tool.executionMode,
}));
return createHash("sha256").update(value).digest("hex");
}
//# sourceMappingURL=catalog-digest.js.map