@@ -2,7 +2,6 @@
|
2 | 2 | import { existsSync, readFileSync } from "node:fs"; |
3 | 3 | import { z } from "zod"; |
4 | 4 | import { isBlockedObjectKey } from "../infra/prototype-keys.js"; |
5 | | -import type { OpenClawStateDatabaseOptions } from "../state/openclaw-state-db.js"; |
6 | 5 | import { |
7 | 6 | openOpenClawStateDatabase, |
8 | 7 | runOpenClawStateWriteTransaction, |
@@ -15,6 +14,7 @@ import { hashJson } from "./installed-plugin-index-hash.js";
|
15 | 14 | import { resolveCompatRegistryVersion } from "./installed-plugin-index-policy.js"; |
16 | 15 | import { clearLoadInstalledPluginIndexInstallRecordsCache } from "./installed-plugin-index-record-cache.js"; |
17 | 16 | import { |
| 17 | +resolveInstalledPluginIndexStateDatabaseOptions, |
18 | 18 | resolveInstalledPluginIndexStorePath, |
19 | 19 | type InstalledPluginIndexStoreOptions, |
20 | 20 | } from "./installed-plugin-index-store-path.js"; |
@@ -196,26 +196,6 @@ type InstalledPluginIndexSqliteRow = {
|
196 | 196 | diagnostics_json: string; |
197 | 197 | }; |
198 | 198 | |
199 | | -function resolveStateDatabaseOptions( |
200 | | -options: InstalledPluginIndexStoreOptions = {}, |
201 | | -): OpenClawStateDatabaseOptions { |
202 | | -if (options.filePath) { |
203 | | -return { |
204 | | - ...(options.env ? { env: options.env } : {}), |
205 | | -path: options.filePath, |
206 | | -}; |
207 | | -} |
208 | | -if (options.stateDir) { |
209 | | -return { |
210 | | -env: { |
211 | | - ...(options.env ?? process.env), |
212 | | -OPENCLAW_STATE_DIR: options.stateDir, |
213 | | -}, |
214 | | -}; |
215 | | -} |
216 | | -return options.env ? { env: options.env } : {}; |
217 | | -} |
218 | | - |
219 | 199 | function isExplicitLegacyJsonStorePath(options: InstalledPluginIndexStoreOptions): boolean { |
220 | 200 | return Boolean(options.filePath && options.filePath.endsWith(".json")); |
221 | 201 | } |
@@ -309,7 +289,9 @@ function readPersistedInstalledPluginIndexFromSqlite(
|
309 | 289 | return null; |
310 | 290 | } |
311 | 291 | try { |
312 | | -const database = openOpenClawStateDatabase(resolveStateDatabaseOptions(options)); |
| 292 | +const database = openOpenClawStateDatabase( |
| 293 | +resolveInstalledPluginIndexStateDatabaseOptions(options), |
| 294 | +); |
313 | 295 | const row = database.db |
314 | 296 | .prepare( |
315 | 297 | ` |
@@ -379,7 +361,7 @@ function writePersistedInstalledPluginIndexToSqlite(
|
379 | 361 | warning: persisted.warning, |
380 | 362 | updated_at_ms: now, |
381 | 363 | }); |
382 | | -}, resolveStateDatabaseOptions(options)); |
| 364 | +}, resolveInstalledPluginIndexStateDatabaseOptions(options)); |
383 | 365 | } |
384 | 366 | |
385 | 367 | export async function readPersistedInstalledPluginIndex( |
|