@@ -13,7 +13,11 @@ import {
|
13 | 13 | setMemorySearchManagerImpl, |
14 | 14 | } from "./memory-tool-manager.test-mocks.js"; |
15 | 15 | import { createMemorySearchTool, testing as memoryToolsTesting } from "./tools.js"; |
16 | | -import { MemoryGetSchema, MemorySearchSchema } from "./tools.shared.js"; |
| 16 | +import { |
| 17 | +buildMemorySearchUnavailableResult, |
| 18 | +MemoryGetSchema, |
| 19 | +MemorySearchSchema, |
| 20 | +} from "./tools.shared.js"; |
17 | 21 | import { |
18 | 22 | asOpenClawConfig, |
19 | 23 | createMemorySearchToolOrThrow, |
@@ -120,6 +124,37 @@ describe("memory_search unavailable payloads", () => {
|
120 | 124 | }); |
121 | 125 | }); |
122 | 126 | |
| 127 | +it("returns explicit unavailable metadata for missing node:sqlite failures", async () => { |
| 128 | +const error = |
| 129 | +"SQLite support is unavailable in this Node runtime (missing node:sqlite). No such built-in module: node:sqlite"; |
| 130 | +setMemorySearchImpl(async () => { |
| 131 | +throw new Error(error); |
| 132 | +}); |
| 133 | + |
| 134 | +const tool = createMemorySearchToolOrThrow(); |
| 135 | +const result = await tool.execute("missing-node-sqlite", { query: "hello" }); |
| 136 | +expectUnavailableMemorySearchDetails(result.details, { |
| 137 | + error, |
| 138 | +warning: |
| 139 | +"Memory search is unavailable because this OpenClaw Node runtime does not provide SQLite support.", |
| 140 | +action: |
| 141 | +"Run OpenClaw with a Node runtime that includes node:sqlite, then retry memory_search.", |
| 142 | +}); |
| 143 | +}); |
| 144 | + |
| 145 | +it("keeps explicit unavailable metadata overrides for missing node:sqlite reasons", () => { |
| 146 | +const result = buildMemorySearchUnavailableResult("missing node:sqlite", { |
| 147 | +warning: "custom warning", |
| 148 | +action: "custom action", |
| 149 | +}); |
| 150 | + |
| 151 | +expectUnavailableMemorySearchDetails(result, { |
| 152 | +error: "missing node:sqlite", |
| 153 | +warning: "custom warning", |
| 154 | +action: "custom action", |
| 155 | +}); |
| 156 | +}); |
| 157 | + |
123 | 158 | it("returns explicit unavailable metadata for non-quota failures", async () => { |
124 | 159 | setMemorySearchImpl(async () => { |
125 | 160 | throw new Error("embedding provider timeout"); |
|