(path: string, body: Record<string, unknown>, timeoutMs = 5000)
| 15 | } |
| 16 | |
| 17 | async function post(path: string, body: Record<string, unknown>, timeoutMs = 5000): Promise<void> { |
| 18 | try { |
| 19 | await fetch(`${API}/agentmemory${path}`, { |
| 20 | method: "POST", |
| 21 | headers: authHeaders(), |
| 22 | body: JSON.stringify(body), |
| 23 | signal: AbortSignal.timeout(timeoutMs), |
| 24 | }); |
| 25 | } catch (e) { |
| 26 | if (DEBUG) console.error(`[agentmemory] POST ${path} failed:`, (e as Error).message); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | async function postJson(path: string, body: Record<string, unknown>): Promise<unknown | null> { |
| 31 | try { |
no test coverage detected