@forwardimpact/libmemory
Advanced tools
| #!/usr/bin/env node | ||
| import { createServiceConfig } from "@forwardimpact/libconfig"; | ||
| import { createClient, createTracer } from "@forwardimpact/librpc"; | ||
| import { createLogger } from "@forwardimpact/libtelemetry"; | ||
| /** | ||
| * Fetches the memory window for a conversation as JSON | ||
| * Usage: fit-window <resource_id> [model] | ||
| * @returns {Promise<void>} | ||
| */ | ||
| async function main() { | ||
| const resourceId = process.argv[2]; | ||
| if (!resourceId) { | ||
| console.error("Usage: fit-window <resource_id> [model]"); | ||
| process.exit(1); | ||
| } | ||
| const agentConfig = await createServiceConfig("agent"); | ||
| const model = process.argv[3] || agentConfig.model; | ||
| const config = await createServiceConfig("memory"); | ||
| const logger = createLogger("cli"); | ||
| const tracer = await createTracer("cli"); | ||
| const client = await createClient("memory", logger, tracer); | ||
| const response = await client.callUnary("GetWindow", { | ||
| resource_id: resourceId, | ||
| model, | ||
| max_tokens: config.max_tokens || 4096, | ||
| }); | ||
| console.log(JSON.stringify(response, null, 2)); | ||
| } | ||
| main().catch((error) => { | ||
| console.error(error.message); | ||
| process.exit(1); | ||
| }); |
+4
-1
| { | ||
| "name": "@forwardimpact/libmemory", | ||
| "version": "0.1.34", | ||
| "version": "0.1.35", | ||
| "description": "Memory management library for Guide", | ||
@@ -13,2 +13,5 @@ "license": "Apache-2.0", | ||
| }, | ||
| "bin": { | ||
| "fit-window": "./bin/fit-window.js" | ||
| }, | ||
| "engines": { | ||
@@ -15,0 +18,0 @@ "node": ">=22.0.0" |
48446
2.47%9
12.5%1030
3.21%