@shadowforge0/aquifer-memory 1.8.1 → 1.9.1

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 (57) hide show
  1. package/.env.example +1 -0
  2. package/README.md +82 -26
  3. package/README_CN.md +33 -23
  4. package/README_TW.md +25 -24
  5. package/aquifer.config.example.json +2 -1
  6. package/consumers/cli.js +587 -33
  7. package/consumers/codex-active-checkpoint.js +3 -1
  8. package/consumers/codex-current-memory.js +10 -6
  9. package/consumers/codex.js +6 -3
  10. package/consumers/default/daily-entries.js +2 -2
  11. package/consumers/default/index.js +40 -30
  12. package/consumers/default/prompts/summary.js +2 -2
  13. package/consumers/mcp.js +56 -46
  14. package/consumers/openclaw-ext/index.js +65 -7
  15. package/consumers/openclaw-ext/openclaw.plugin.json +1 -1
  16. package/consumers/openclaw-ext/package.json +1 -1
  17. package/consumers/openclaw-install.js +326 -0
  18. package/consumers/openclaw-plugin.js +105 -24
  19. package/consumers/shared/compat-recall.js +101 -0
  20. package/consumers/shared/config.js +2 -0
  21. package/consumers/shared/openclaw-product-tools.js +130 -0
  22. package/consumers/shared/recall-format.js +2 -2
  23. package/core/aquifer.js +553 -41
  24. package/core/backends/local.js +169 -1
  25. package/core/doctor.js +924 -0
  26. package/core/finalization-inspector.js +164 -0
  27. package/core/finalization-review.js +88 -42
  28. package/core/interface.js +629 -0
  29. package/core/mcp-manifest.js +11 -3
  30. package/core/memory-bootstrap.js +25 -27
  31. package/core/memory-consolidation.js +564 -42
  32. package/core/memory-explain.js +593 -0
  33. package/core/memory-promotion.js +392 -55
  34. package/core/memory-recall.js +75 -71
  35. package/core/memory-records.js +107 -108
  36. package/core/memory-review.js +891 -0
  37. package/core/memory-serving.js +61 -4
  38. package/core/memory-type-policy.js +298 -0
  39. package/core/operator-observability.js +249 -0
  40. package/core/postgres-migrations.js +22 -0
  41. package/core/session-checkpoint-producer.js +3 -1
  42. package/core/session-checkpoints.js +1 -1
  43. package/core/session-finalization.js +78 -3
  44. package/core/storage.js +124 -8
  45. package/docs/getting-started.md +50 -4
  46. package/docs/setup.md +163 -24
  47. package/package.json +5 -4
  48. package/schema/004-completion.sql +4 -4
  49. package/schema/010-v1-finalization-review.sql +72 -0
  50. package/schema/019-v1-memory-review-resolutions.sql +53 -0
  51. package/schema/020-v1-assistant-shaping-memory.sql +30 -0
  52. package/scripts/backfill-canonical-key.js +1 -1
  53. package/scripts/codex-checkpoint-commands.js +28 -0
  54. package/scripts/codex-checkpoint-runtime.js +109 -0
  55. package/scripts/codex-recovery.js +16 -4
  56. package/scripts/diagnose-fts-zh.js +1 -1
  57. package/scripts/extract-insights-from-recent-sessions.js +4 -4
@@ -3,6 +3,7 @@
3
3
  const fs = require('fs/promises');
4
4
  const path = require('path');
5
5
  const { backendCapabilities, unsupportedCapabilityError } = require('./capabilities');
6
+ const { buildBacklogProductStatus, buildReadinessSurface } = require('../interface');
6
7
 
7
8
  function emptyStore() {
8
9
  const now = new Date().toISOString();
@@ -299,6 +300,115 @@ function createLocalAquifer(config = {}) {
299
300
  async memoryBootstrap() {
300
301
  unsupported('memoryBootstrap', 'curatedBootstrap');
301
302
  },
303
+ doctor: {
304
+ async run() {
305
+ return {
306
+ ok: false,
307
+ status: 'warn',
308
+ checks: [
309
+ {
310
+ id: 'backend',
311
+ status: 'warn',
312
+ summary: 'Local starter backend is running with degraded governance coverage.',
313
+ details: {
314
+ backendKind: 'local',
315
+ backendProfile: capabilities.profile,
316
+ backendPath,
317
+ capabilities: capabilities.capabilities,
318
+ },
319
+ nextAction: capabilities.upgradeHint,
320
+ },
321
+ {
322
+ id: 'db',
323
+ status: 'warn',
324
+ summary: 'PostgreSQL governance ledgers are unavailable on the local starter backend.',
325
+ details: {
326
+ configured: false,
327
+ tenantId,
328
+ },
329
+ nextAction: 'Use the PostgreSQL backend for migrations, finalization ledgers, and operator workflows.',
330
+ },
331
+ ],
332
+ };
333
+ },
334
+ },
335
+ finalization: {
336
+ async list() {
337
+ unsupported('finalization list', 'finalizationLedger');
338
+ },
339
+ async inspect() {
340
+ unsupported('finalization inspect', 'finalizationLedger');
341
+ },
342
+ },
343
+ operator: {
344
+ async status() {
345
+ return {
346
+ readOnly: true,
347
+ compaction: {
348
+ available: false,
349
+ latest: [],
350
+ staleClaims: [],
351
+ statusCounts: {},
352
+ error: 'operator compaction ledger is unavailable on the local starter backend',
353
+ },
354
+ checkpoint: {
355
+ available: false,
356
+ latest: [],
357
+ statusCounts: {},
358
+ error: 'operator checkpoint ledger is unavailable on the local starter backend',
359
+ },
360
+ };
361
+ },
362
+ async inspect() {
363
+ unsupported('operator inspect', 'operatorCompaction');
364
+ },
365
+ },
366
+ memory: {
367
+ async explainBootstrap() {
368
+ unsupported('explain bootstrap', 'curatedBootstrap');
369
+ },
370
+ async explainCurrent() {
371
+ unsupported('explain memory', 'curatedRecall');
372
+ },
373
+ async explainMemory() {
374
+ unsupported('explain memory', 'curatedRecall');
375
+ },
376
+ },
377
+ review: {
378
+ async queue() {
379
+ return {
380
+ readOnly: true,
381
+ derived: true,
382
+ available: false,
383
+ items: [],
384
+ reviewQueue: [],
385
+ scope: {
386
+ activeScopeKey: null,
387
+ activeScopePath: [],
388
+ },
389
+ filters: {},
390
+ summary: {
391
+ scanned: 0,
392
+ queued: 0,
393
+ truncated: false,
394
+ severityCounts: {},
395
+ feedbackTypeCounts: {},
396
+ },
397
+ totals: {
398
+ items: 0,
399
+ issueFeedback: 0,
400
+ allFeedback: 0,
401
+ },
402
+ error: 'Memory review queue is unavailable on the local starter backend',
403
+ };
404
+ },
405
+ async inspect() {
406
+ unsupported('review inspect', 'curatedRecall');
407
+ },
408
+ async resolve() {
409
+ unsupported('review resolve', 'curatedRecall');
410
+ },
411
+ },
302
412
  async historicalBootstrap(opts = {}) {
303
413
  return this.bootstrap(opts);
304
414
  },
@@ -311,7 +421,7 @@ function createLocalAquifer(config = {}) {
311
421
  counts[status] = (counts[status] || 0) + 1;
312
422
  }
313
423
  const dates = sessions.map(s => s.startedAt).filter(Boolean).sort();
314
- return {
424
+ const stats = {
315
425
  backendKind: 'local',
316
426
  backendProfile: capabilities.profile,
317
427
  serving: {
@@ -345,6 +455,64 @@ function createLocalAquifer(config = {}) {
345
455
  degraded: true,
346
456
  capabilities: capabilities.capabilities,
347
457
  };
458
+ return {
459
+ ...stats,
460
+ readiness: buildReadinessSurface(stats, {
461
+ checks: [
462
+ {
463
+ key: 'backend',
464
+ status: 'ready',
465
+ label: 'Service',
466
+ message: 'Aquifer is online.',
467
+ },
468
+ {
469
+ key: 'historical_memory',
470
+ status: sessions.length > 0 ? 'ready' : 'empty',
471
+ label: 'Saved content',
472
+ message: sessions.length > 0
473
+ ? 'Saved local content is available.'
474
+ : 'No saved content is available yet.',
475
+ },
476
+ {
477
+ key: 'current_memory',
478
+ status: 'not_supported',
479
+ label: 'Memory',
480
+ message: 'Complete memory requires full storage.',
481
+ },
482
+ ],
483
+ }),
484
+ };
485
+ },
486
+ async getPendingWork(opts = {}) {
487
+ const publicStatus = buildBacklogProductStatus({ statusCounts: {} });
488
+ return {
489
+ available: true,
490
+ generatedAt: new Date().toISOString(),
491
+ terminalFiltering: false,
492
+ filters: {
493
+ source: opts.source || null,
494
+ agentId: opts.agentId || null,
495
+ statuses: opts.status ? [String(opts.status)] : ['pending', 'failed'],
496
+ limit: Math.max(1, Math.min(500, opts.limit || 100)),
497
+ },
498
+ total: 0,
499
+ status: 'clear',
500
+ statusCounts: {},
501
+ summary: 'All saved content is ready.',
502
+ nextStep: 'No action required.',
503
+ publicStatus,
504
+ groups: [],
505
+ samples: [],
506
+ guidance: [],
507
+ plan: {
508
+ action: opts.action || opts.plan || 'inspect',
509
+ dryRunOnly: true,
510
+ allowed: 0,
511
+ blocked: 0,
512
+ changes: [],
513
+ notes: ['Local backend has no asynchronous pending/failed session backlog.'],
514
+ },
515
+ };
348
516
  },
349
517
  async getPendingSessions() {
350
518
  return [];