shieldcortex 3.4.9 → 3.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
  2. package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +2 -2
  3. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
  4. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
  5. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  6. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  8. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  9. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
  12. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +2 -2
  13. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  14. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  15. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  16. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  17. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  18. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  19. package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
  20. package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +3 -3
  21. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  22. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +3 -3
  23. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
  24. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +2 -2
  25. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  26. package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  27. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_3051539d._.js +1 -1
  28. package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
  29. package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
  30. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{ea7194de06066f6f.css → 85bef03426f93c44.css} +1 -1
  31. package/dashboard/.next/standalone/dashboard/.next/static/chunks/961e337de05e4fa9.js +9 -0
  32. package/dist/database/init.d.ts +2 -0
  33. package/dist/database/init.js +43 -12
  34. package/package.json +1 -1
  35. package/dashboard/.next/standalone/dashboard/.next/static/chunks/e86549b752173fe7.js +0 -9
  36. /package/dashboard/.next/standalone/dashboard/.next/static/{HDy9Pw-7FWlXTY5tmiApk → ByqPA_rsfCTRwfchpFGjR}/_buildManifest.js +0 -0
  37. /package/dashboard/.next/standalone/dashboard/.next/static/{HDy9Pw-7FWlXTY5tmiApk → ByqPA_rsfCTRwfchpFGjR}/_clientMiddlewareManifest.json +0 -0
  38. /package/dashboard/.next/standalone/dashboard/.next/static/{HDy9Pw-7FWlXTY5tmiApk → ByqPA_rsfCTRwfchpFGjR}/_ssgManifest.js +0 -0
@@ -4,9 +4,11 @@
4
4
  import Database from 'better-sqlite3';
5
5
  declare function isLikelyFtsIntegrityIssue(integrityResult: string): boolean;
6
6
  declare function attemptFtsRecovery(database: Database.Database): boolean;
7
+ declare function verifyOnDiskIntegrity(dbPath: string): string;
7
8
  export declare const __databaseTestUtils: {
8
9
  isLikelyFtsIntegrityIssue: typeof isLikelyFtsIntegrityIssue;
9
10
  attemptFtsRecovery: typeof attemptFtsRecovery;
11
+ verifyOnDiskIntegrity: typeof verifyOnDiskIntegrity;
10
12
  };
11
13
  /**
12
14
  * Initialize the database connection
@@ -163,9 +163,31 @@ function attemptFtsRecovery(database) {
163
163
  return false;
164
164
  }
165
165
  }
166
+ function verifyOnDiskIntegrity(dbPath) {
167
+ let verificationDb = null;
168
+ try {
169
+ verificationDb = new Database(dbPath, {
170
+ readonly: true,
171
+ fileMustExist: true,
172
+ });
173
+ return runIntegrityCheck(verificationDb);
174
+ }
175
+ catch (error) {
176
+ return `fresh integrity check threw: ${error}`;
177
+ }
178
+ finally {
179
+ try {
180
+ verificationDb?.close();
181
+ }
182
+ catch {
183
+ // Best-effort close for verification handles.
184
+ }
185
+ }
186
+ }
166
187
  export const __databaseTestUtils = {
167
188
  isLikelyFtsIntegrityIssue,
168
189
  attemptFtsRecovery,
190
+ verifyOnDiskIntegrity,
169
191
  };
170
192
  /**
171
193
  * Initialize the database connection
@@ -206,21 +228,30 @@ export function initDatabase(dbPath) {
206
228
  console.warn('[database] Preserved memory rows by repairing the FTS index in place.');
207
229
  }
208
230
  else {
209
- // Close the corrupt connection before attempting recovery
210
- database.close();
211
- // Attempt dump/reimport recovery
212
- const recovered = attemptDumpRecovery(expandedPath);
213
- if (recovered) {
214
- database = recovered;
231
+ const freshIntegrityResult = verifyOnDiskIntegrity(expandedPath);
232
+ if (freshIntegrityResult === 'ok') {
233
+ console.warn('[database] Integrity failure was transient. Reopening the on-disk database without destructive recovery.');
234
+ database.close();
235
+ database = new Database(expandedPath);
215
236
  }
216
237
  else {
217
- // Recovery failed backup and create fresh
218
- if (existsSync(expandedPath)) {
219
- const backupPath = backupCorruptDatabase(expandedPath);
220
- console.error(`[database] Recovery failed. Backed up corrupt file to: ${backupPath}`);
238
+ console.warn(`[database] Fresh integrity check also failed: ${freshIntegrityResult}`);
239
+ // Close the corrupt connection before attempting recovery
240
+ database.close();
241
+ // Attempt dump/reimport recovery
242
+ const recovered = attemptDumpRecovery(expandedPath);
243
+ if (recovered) {
244
+ database = recovered;
245
+ }
246
+ else {
247
+ // Recovery failed — backup and create fresh
248
+ if (existsSync(expandedPath)) {
249
+ const backupPath = backupCorruptDatabase(expandedPath);
250
+ console.error(`[database] Recovery failed. Backed up corrupt file to: ${backupPath}`);
251
+ }
252
+ console.error('[database] Creating fresh database...');
253
+ database = new Database(expandedPath);
221
254
  }
222
- console.error('[database] Creating fresh database...');
223
- database = new Database(expandedPath);
224
255
  }
225
256
  }
226
257
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shieldcortex",
3
- "version": "3.4.9",
3
+ "version": "3.4.11",
4
4
  "description": "Trustworthy memory and security for AI agents. Recall debugging, review queue, OpenClaw session capture, and memory poisoning defence for Claude Code, Codex, OpenClaw, LangChain, and MCP agents.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",