echonodesync
Version:
Autonomous, pluggable, secure memory bridge for agent/human/ritual ecosystems (DreamWeaver, EchoThreads, etc.)
21 lines (18 loc) • 716 B
JavaScript
// MCP action: getMemory
// Usage: await getMemoryAction({ key })
// Extracted from getMemory.js for agent-accessible invocation
const fetch = require('node-fetch');
const { resolveApiUrl, resolveSecret } = require('./shared');
async function getMemoryAction({ key }) {
if (!key) throw new Error('Missing key');
const BASE_URL = resolveApiUrl();
const SECRET = resolveSecret();
const url = `${BASE_URL}?key=${encodeURIComponent(key)}`;
const headers = {};
if (SECRET) headers['Authorization'] = `Bearer ${SECRET}`;
const res = await fetch(url, { headers });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
return data;
}
module.exports = { getMemoryAction };