@cleocode/cleo 2026.5.4 → 2026.5.5
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.
- package/dist/cli/index.js +61 -87
- package/dist/cli/index.js.map +3 -3
- package/package.json +9 -9
- package/dist/backfill/audit-columns.d.ts +0 -105
- package/dist/backfill/audit-columns.d.ts.map +0 -1
- package/dist/backfill/audit-columns.js +0 -258
- package/dist/backfill/audit-columns.js.map +0 -1
- package/dist/cli/commands/adapter.d.ts +0 -28
- package/dist/cli/commands/adapter.d.ts.map +0 -1
- package/dist/cli/commands/adapter.js +0 -119
- package/dist/cli/commands/adapter.js.map +0 -1
- package/dist/cli/commands/add-batch.d.ts +0 -33
- package/dist/cli/commands/add-batch.d.ts.map +0 -1
- package/dist/cli/commands/add-batch.js +0 -148
- package/dist/cli/commands/add-batch.js.map +0 -1
- package/dist/cli/commands/add.d.ts +0 -162
- package/dist/cli/commands/add.d.ts.map +0 -1
- package/dist/cli/commands/add.js +0 -279
- package/dist/cli/commands/add.js.map +0 -1
- package/dist/cli/commands/admin.d.ts +0 -24
- package/dist/cli/commands/admin.d.ts.map +0 -1
- package/dist/cli/commands/admin.js +0 -283
- package/dist/cli/commands/admin.js.map +0 -1
- package/dist/cli/commands/adr.d.ts +0 -33
- package/dist/cli/commands/adr.d.ts.map +0 -1
- package/dist/cli/commands/adr.js +0 -147
- package/dist/cli/commands/adr.js.map +0 -1
- package/dist/cli/commands/agent-profile-status.d.ts +0 -98
- package/dist/cli/commands/agent-profile-status.d.ts.map +0 -1
- package/dist/cli/commands/agent-profile-status.js +0 -71
- package/dist/cli/commands/agent-profile-status.js.map +0 -1
- package/dist/cli/commands/agent.d.ts +0 -47
- package/dist/cli/commands/agent.d.ts.map +0 -1
- package/dist/cli/commands/agent.js +0 -2976
- package/dist/cli/commands/agent.js.map +0 -1
- package/dist/cli/commands/analyze.d.ts +0 -21
- package/dist/cli/commands/analyze.d.ts.map +0 -1
- package/dist/cli/commands/analyze.js +0 -32
- package/dist/cli/commands/analyze.js.map +0 -1
- package/dist/cli/commands/archive-stats.d.ts +0 -66
- package/dist/cli/commands/archive-stats.d.ts.map +0 -1
- package/dist/cli/commands/archive-stats.js +0 -93
- package/dist/cli/commands/archive-stats.js.map +0 -1
- package/dist/cli/commands/archive.d.ts +0 -42
- package/dist/cli/commands/archive.d.ts.map +0 -1
- package/dist/cli/commands/archive.js +0 -59
- package/dist/cli/commands/archive.js.map +0 -1
- package/dist/cli/commands/audit.d.ts +0 -22
- package/dist/cli/commands/audit.d.ts.map +0 -1
- package/dist/cli/commands/audit.js +0 -137
- package/dist/cli/commands/audit.js.map +0 -1
- package/dist/cli/commands/backfill.d.ts +0 -56
- package/dist/cli/commands/backfill.d.ts.map +0 -1
- package/dist/cli/commands/backfill.js +0 -161
- package/dist/cli/commands/backfill.js.map +0 -1
- package/dist/cli/commands/backup-inspect.d.ts +0 -33
- package/dist/cli/commands/backup-inspect.d.ts.map +0 -1
- package/dist/cli/commands/backup-inspect.js +0 -430
- package/dist/cli/commands/backup-inspect.js.map +0 -1
- package/dist/cli/commands/backup.d.ts +0 -23
- package/dist/cli/commands/backup.d.ts.map +0 -1
- package/dist/cli/commands/backup.js +0 -564
- package/dist/cli/commands/backup.js.map +0 -1
- package/dist/cli/commands/blockers.d.ts +0 -20
- package/dist/cli/commands/blockers.d.ts.map +0 -1
- package/dist/cli/commands/blockers.js +0 -31
- package/dist/cli/commands/blockers.js.map +0 -1
- package/dist/cli/commands/brain.d.ts +0 -37
- package/dist/cli/commands/brain.d.ts.map +0 -1
- package/dist/cli/commands/brain.js +0 -445
- package/dist/cli/commands/brain.js.map +0 -1
- package/dist/cli/commands/briefing.d.ts +0 -52
- package/dist/cli/commands/briefing.d.ts.map +0 -1
- package/dist/cli/commands/briefing.js +0 -69
- package/dist/cli/commands/briefing.js.map +0 -1
- package/dist/cli/commands/bug.d.ts +0 -61
- package/dist/cli/commands/bug.d.ts.map +0 -1
- package/dist/cli/commands/bug.js +0 -198
- package/dist/cli/commands/bug.js.map +0 -1
- package/dist/cli/commands/cancel.d.ts +0 -26
- package/dist/cli/commands/cancel.d.ts.map +0 -1
- package/dist/cli/commands/cancel.js +0 -40
- package/dist/cli/commands/cancel.js.map +0 -1
- package/dist/cli/commands/cant.d.ts +0 -13
- package/dist/cli/commands/cant.d.ts.map +0 -1
- package/dist/cli/commands/cant.js +0 -245
- package/dist/cli/commands/cant.js.map +0 -1
- package/dist/cli/commands/chain.d.ts +0 -24
- package/dist/cli/commands/chain.d.ts.map +0 -1
- package/dist/cli/commands/chain.js +0 -116
- package/dist/cli/commands/chain.js.map +0 -1
- package/dist/cli/commands/check.d.ts +0 -18
- package/dist/cli/commands/check.d.ts.map +0 -1
- package/dist/cli/commands/check.js +0 -280
- package/dist/cli/commands/check.js.map +0 -1
- package/dist/cli/commands/checkpoint.d.ts +0 -27
- package/dist/cli/commands/checkpoint.d.ts.map +0 -1
- package/dist/cli/commands/checkpoint.js +0 -105
- package/dist/cli/commands/checkpoint.js.map +0 -1
- package/dist/cli/commands/claim.d.ts +0 -35
- package/dist/cli/commands/claim.d.ts.map +0 -1
- package/dist/cli/commands/claim.js +0 -35
- package/dist/cli/commands/claim.js.map +0 -1
- package/dist/cli/commands/code.d.ts +0 -22
- package/dist/cli/commands/code.d.ts.map +0 -1
- package/dist/cli/commands/code.js +0 -161
- package/dist/cli/commands/code.js.map +0 -1
- package/dist/cli/commands/complete.d.ts +0 -58
- package/dist/cli/commands/complete.d.ts.map +0 -1
- package/dist/cli/commands/complete.js +0 -83
- package/dist/cli/commands/complete.js.map +0 -1
- package/dist/cli/commands/complexity.d.ts +0 -13
- package/dist/cli/commands/complexity.d.ts.map +0 -1
- package/dist/cli/commands/complexity.js +0 -32
- package/dist/cli/commands/complexity.js.map +0 -1
- package/dist/cli/commands/compliance.d.ts +0 -27
- package/dist/cli/commands/compliance.d.ts.map +0 -1
- package/dist/cli/commands/compliance.js +0 -233
- package/dist/cli/commands/compliance.js.map +0 -1
- package/dist/cli/commands/conduit.d.ts +0 -28
- package/dist/cli/commands/conduit.d.ts.map +0 -1
- package/dist/cli/commands/conduit.js +0 -279
- package/dist/cli/commands/conduit.js.map +0 -1
- package/dist/cli/commands/config.d.ts +0 -25
- package/dist/cli/commands/config.d.ts.map +0 -1
- package/dist/cli/commands/config.js +0 -132
- package/dist/cli/commands/config.js.map +0 -1
- package/dist/cli/commands/consensus.d.ts +0 -21
- package/dist/cli/commands/consensus.d.ts.map +0 -1
- package/dist/cli/commands/consensus.js +0 -100
- package/dist/cli/commands/consensus.js.map +0 -1
- package/dist/cli/commands/context.d.ts +0 -19
- package/dist/cli/commands/context.d.ts.map +0 -1
- package/dist/cli/commands/context.js +0 -111
- package/dist/cli/commands/context.js.map +0 -1
- package/dist/cli/commands/contribution.d.ts +0 -21
- package/dist/cli/commands/contribution.d.ts.map +0 -1
- package/dist/cli/commands/contribution.js +0 -90
- package/dist/cli/commands/contribution.js.map +0 -1
- package/dist/cli/commands/current.d.ts +0 -18
- package/dist/cli/commands/current.d.ts.map +0 -1
- package/dist/cli/commands/current.js +0 -28
- package/dist/cli/commands/current.js.map +0 -1
- package/dist/cli/commands/daemon.d.ts +0 -36
- package/dist/cli/commands/daemon.d.ts.map +0 -1
- package/dist/cli/commands/daemon.js +0 -223
- package/dist/cli/commands/daemon.js.map +0 -1
- package/dist/cli/commands/dash.d.ts +0 -23
- package/dist/cli/commands/dash.d.ts.map +0 -1
- package/dist/cli/commands/dash.js +0 -38
- package/dist/cli/commands/dash.js.map +0 -1
- package/dist/cli/commands/decomposition.d.ts +0 -13
- package/dist/cli/commands/decomposition.d.ts.map +0 -1
- package/dist/cli/commands/decomposition.js +0 -92
- package/dist/cli/commands/decomposition.js.map +0 -1
- package/dist/cli/commands/delete.d.ts +0 -29
- package/dist/cli/commands/delete.d.ts.map +0 -1
- package/dist/cli/commands/delete.js +0 -55
- package/dist/cli/commands/delete.js.map +0 -1
- package/dist/cli/commands/deps.d.ts +0 -45
- package/dist/cli/commands/deps.d.ts.map +0 -1
- package/dist/cli/commands/deps.js +0 -170
- package/dist/cli/commands/deps.js.map +0 -1
- package/dist/cli/commands/detect-drift.d.ts +0 -23
- package/dist/cli/commands/detect-drift.d.ts.map +0 -1
- package/dist/cli/commands/detect-drift.js +0 -440
- package/dist/cli/commands/detect-drift.js.map +0 -1
- package/dist/cli/commands/detect.d.ts +0 -3
- package/dist/cli/commands/detect.d.ts.map +0 -1
- package/dist/cli/commands/detect.js +0 -14
- package/dist/cli/commands/detect.js.map +0 -1
- package/dist/cli/commands/diagnostics.d.ts +0 -19
- package/dist/cli/commands/diagnostics.d.ts.map +0 -1
- package/dist/cli/commands/diagnostics.js +0 -109
- package/dist/cli/commands/diagnostics.js.map +0 -1
- package/dist/cli/commands/docs.d.ts +0 -25
- package/dist/cli/commands/docs.d.ts.map +0 -1
- package/dist/cli/commands/docs.js +0 -798
- package/dist/cli/commands/docs.js.map +0 -1
- package/dist/cli/commands/doctor-projects.d.ts +0 -101
- package/dist/cli/commands/doctor-projects.d.ts.map +0 -1
- package/dist/cli/commands/doctor-projects.js +0 -188
- package/dist/cli/commands/doctor-projects.js.map +0 -1
- package/dist/cli/commands/doctor.d.ts +0 -66
- package/dist/cli/commands/doctor.d.ts.map +0 -1
- package/dist/cli/commands/doctor.js +0 -178
- package/dist/cli/commands/doctor.js.map +0 -1
- package/dist/cli/commands/dynamic.d.ts +0 -15
- package/dist/cli/commands/dynamic.d.ts.map +0 -1
- package/dist/cli/commands/dynamic.js +0 -21
- package/dist/cli/commands/dynamic.js.map +0 -1
- package/dist/cli/commands/exists.d.ts +0 -13
- package/dist/cli/commands/exists.d.ts.map +0 -1
- package/dist/cli/commands/exists.js +0 -40
- package/dist/cli/commands/exists.js.map +0 -1
- package/dist/cli/commands/export-tasks.d.ts +0 -46
- package/dist/cli/commands/export-tasks.d.ts.map +0 -1
- package/dist/cli/commands/export-tasks.js +0 -81
- package/dist/cli/commands/export-tasks.js.map +0 -1
- package/dist/cli/commands/export.d.ts +0 -35
- package/dist/cli/commands/export.d.ts.map +0 -1
- package/dist/cli/commands/export.js +0 -68
- package/dist/cli/commands/export.js.map +0 -1
- package/dist/cli/commands/find.d.ts +0 -54
- package/dist/cli/commands/find.d.ts.map +0 -1
- package/dist/cli/commands/find.js +0 -92
- package/dist/cli/commands/find.js.map +0 -1
- package/dist/cli/commands/gc.d.ts +0 -25
- package/dist/cli/commands/gc.d.ts.map +0 -1
- package/dist/cli/commands/gc.js +0 -165
- package/dist/cli/commands/gc.js.map +0 -1
- package/dist/cli/commands/generate-changelog.d.ts +0 -30
- package/dist/cli/commands/generate-changelog.d.ts.map +0 -1
- package/dist/cli/commands/generate-changelog.js +0 -270
- package/dist/cli/commands/generate-changelog.js.map +0 -1
- package/dist/cli/commands/grade.d.ts +0 -13
- package/dist/cli/commands/grade.d.ts.map +0 -1
- package/dist/cli/commands/grade.js +0 -27
- package/dist/cli/commands/grade.js.map +0 -1
- package/dist/cli/commands/history.d.ts +0 -13
- package/dist/cli/commands/history.d.ts.map +0 -1
- package/dist/cli/commands/history.js +0 -65
- package/dist/cli/commands/history.js.map +0 -1
- package/dist/cli/commands/import-tasks.d.ts +0 -60
- package/dist/cli/commands/import-tasks.d.ts.map +0 -1
- package/dist/cli/commands/import-tasks.js +0 -83
- package/dist/cli/commands/import-tasks.js.map +0 -1
- package/dist/cli/commands/import.d.ts +0 -42
- package/dist/cli/commands/import.d.ts.map +0 -1
- package/dist/cli/commands/import.js +0 -64
- package/dist/cli/commands/import.js.map +0 -1
- package/dist/cli/commands/init.d.ts +0 -65
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js +0 -122
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/inject.d.ts +0 -41
- package/dist/cli/commands/inject.d.ts.map +0 -1
- package/dist/cli/commands/inject.js +0 -56
- package/dist/cli/commands/inject.js.map +0 -1
- package/dist/cli/commands/install-global.d.ts +0 -48
- package/dist/cli/commands/install-global.d.ts.map +0 -1
- package/dist/cli/commands/install-global.js +0 -104
- package/dist/cli/commands/install-global.js.map +0 -1
- package/dist/cli/commands/intelligence.d.ts +0 -21
- package/dist/cli/commands/intelligence.d.ts.map +0 -1
- package/dist/cli/commands/intelligence.js +0 -145
- package/dist/cli/commands/intelligence.js.map +0 -1
- package/dist/cli/commands/issue.d.ts +0 -23
- package/dist/cli/commands/issue.d.ts.map +0 -1
- package/dist/cli/commands/issue.js +0 -152
- package/dist/cli/commands/issue.js.map +0 -1
- package/dist/cli/commands/labels.d.ts +0 -21
- package/dist/cli/commands/labels.d.ts.map +0 -1
- package/dist/cli/commands/labels.js +0 -65
- package/dist/cli/commands/labels.js.map +0 -1
- package/dist/cli/commands/lifecycle.d.ts +0 -25
- package/dist/cli/commands/lifecycle.d.ts.map +0 -1
- package/dist/cli/commands/lifecycle.js +0 -221
- package/dist/cli/commands/lifecycle.js.map +0 -1
- package/dist/cli/commands/list.d.ts +0 -28
- package/dist/cli/commands/list.d.ts.map +0 -1
- package/dist/cli/commands/list.js +0 -81
- package/dist/cli/commands/list.js.map +0 -1
- package/dist/cli/commands/log.d.ts +0 -36
- package/dist/cli/commands/log.d.ts.map +0 -1
- package/dist/cli/commands/log.js +0 -50
- package/dist/cli/commands/log.js.map +0 -1
- package/dist/cli/commands/manifest.d.ts +0 -15
- package/dist/cli/commands/manifest.d.ts.map +0 -1
- package/dist/cli/commands/manifest.js +0 -334
- package/dist/cli/commands/manifest.js.map +0 -1
- package/dist/cli/commands/map.d.ts +0 -25
- package/dist/cli/commands/map.d.ts.map +0 -1
- package/dist/cli/commands/map.js +0 -37
- package/dist/cli/commands/map.js.map +0 -1
- package/dist/cli/commands/memory.d.ts +0 -48
- package/dist/cli/commands/memory.d.ts.map +0 -1
- package/dist/cli/commands/memory.js +0 -2439
- package/dist/cli/commands/memory.js.map +0 -1
- package/dist/cli/commands/migrate-claude-mem.d.ts +0 -23
- package/dist/cli/commands/migrate-claude-mem.d.ts.map +0 -1
- package/dist/cli/commands/migrate-claude-mem.js +0 -181
- package/dist/cli/commands/migrate-claude-mem.js.map +0 -1
- package/dist/cli/commands/next.d.ts +0 -27
- package/dist/cli/commands/next.d.ts.map +0 -1
- package/dist/cli/commands/next.js +0 -40
- package/dist/cli/commands/next.js.map +0 -1
- package/dist/cli/commands/nexus.d.ts +0 -15
- package/dist/cli/commands/nexus.d.ts.map +0 -1
- package/dist/cli/commands/nexus.js +0 -3377
- package/dist/cli/commands/nexus.js.map +0 -1
- package/dist/cli/commands/ops.d.ts +0 -23
- package/dist/cli/commands/ops.d.ts.map +0 -1
- package/dist/cli/commands/ops.js +0 -35
- package/dist/cli/commands/ops.js.map +0 -1
- package/dist/cli/commands/orchestrate.d.ts +0 -48
- package/dist/cli/commands/orchestrate.d.ts.map +0 -1
- package/dist/cli/commands/orchestrate.js +0 -774
- package/dist/cli/commands/orchestrate.js.map +0 -1
- package/dist/cli/commands/otel.d.ts +0 -30
- package/dist/cli/commands/otel.d.ts.map +0 -1
- package/dist/cli/commands/otel.js +0 -193
- package/dist/cli/commands/otel.js.map +0 -1
- package/dist/cli/commands/phase.d.ts +0 -29
- package/dist/cli/commands/phase.d.ts.map +0 -1
- package/dist/cli/commands/phase.js +0 -189
- package/dist/cli/commands/phase.js.map +0 -1
- package/dist/cli/commands/pivot.d.ts +0 -34
- package/dist/cli/commands/pivot.d.ts.map +0 -1
- package/dist/cli/commands/pivot.js +0 -50
- package/dist/cli/commands/pivot.js.map +0 -1
- package/dist/cli/commands/plan.d.ts +0 -17
- package/dist/cli/commands/plan.d.ts.map +0 -1
- package/dist/cli/commands/plan.js +0 -27
- package/dist/cli/commands/plan.js.map +0 -1
- package/dist/cli/commands/playbook.d.ts +0 -26
- package/dist/cli/commands/playbook.d.ts.map +0 -1
- package/dist/cli/commands/playbook.js +0 -220
- package/dist/cli/commands/playbook.js.map +0 -1
- package/dist/cli/commands/promote.d.ts +0 -19
- package/dist/cli/commands/promote.d.ts.map +0 -1
- package/dist/cli/commands/promote.js +0 -27
- package/dist/cli/commands/promote.js.map +0 -1
- package/dist/cli/commands/provider.d.ts +0 -23
- package/dist/cli/commands/provider.d.ts.map +0 -1
- package/dist/cli/commands/provider.js +0 -168
- package/dist/cli/commands/provider.js.map +0 -1
- package/dist/cli/commands/reason.d.ts +0 -18
- package/dist/cli/commands/reason.d.ts.map +0 -1
- package/dist/cli/commands/reason.js +0 -102
- package/dist/cli/commands/reason.js.map +0 -1
- package/dist/cli/commands/reconcile.d.ts +0 -35
- package/dist/cli/commands/reconcile.d.ts.map +0 -1
- package/dist/cli/commands/reconcile.js +0 -102
- package/dist/cli/commands/reconcile.js.map +0 -1
- package/dist/cli/commands/refresh-memory.d.ts +0 -16
- package/dist/cli/commands/refresh-memory.d.ts.map +0 -1
- package/dist/cli/commands/refresh-memory.js +0 -34
- package/dist/cli/commands/refresh-memory.js.map +0 -1
- package/dist/cli/commands/relates.d.ts +0 -19
- package/dist/cli/commands/relates.d.ts.map +0 -1
- package/dist/cli/commands/relates.js +0 -129
- package/dist/cli/commands/relates.js.map +0 -1
- package/dist/cli/commands/release.d.ts +0 -27
- package/dist/cli/commands/release.d.ts.map +0 -1
- package/dist/cli/commands/release.js +0 -300
- package/dist/cli/commands/release.js.map +0 -1
- package/dist/cli/commands/remote.d.ts +0 -49
- package/dist/cli/commands/remote.d.ts.map +0 -1
- package/dist/cli/commands/remote.js +0 -265
- package/dist/cli/commands/remote.js.map +0 -1
- package/dist/cli/commands/reorder.d.ts +0 -31
- package/dist/cli/commands/reorder.d.ts.map +0 -1
- package/dist/cli/commands/reorder.js +0 -57
- package/dist/cli/commands/reorder.js.map +0 -1
- package/dist/cli/commands/reparent.d.ts +0 -27
- package/dist/cli/commands/reparent.d.ts.map +0 -1
- package/dist/cli/commands/reparent.js +0 -36
- package/dist/cli/commands/reparent.js.map +0 -1
- package/dist/cli/commands/req.d.ts +0 -37
- package/dist/cli/commands/req.d.ts.map +0 -1
- package/dist/cli/commands/req.js +0 -121
- package/dist/cli/commands/req.js.map +0 -1
- package/dist/cli/commands/research.d.ts +0 -25
- package/dist/cli/commands/research.d.ts.map +0 -1
- package/dist/cli/commands/research.js +0 -327
- package/dist/cli/commands/research.js.map +0 -1
- package/dist/cli/commands/restore.d.ts +0 -64
- package/dist/cli/commands/restore.d.ts.map +0 -1
- package/dist/cli/commands/restore.js +0 -539
- package/dist/cli/commands/restore.js.map +0 -1
- package/dist/cli/commands/revert.d.ts +0 -79
- package/dist/cli/commands/revert.d.ts.map +0 -1
- package/dist/cli/commands/revert.js +0 -300
- package/dist/cli/commands/revert.js.map +0 -1
- package/dist/cli/commands/roadmap.d.ts +0 -29
- package/dist/cli/commands/roadmap.d.ts.map +0 -1
- package/dist/cli/commands/roadmap.js +0 -43
- package/dist/cli/commands/roadmap.js.map +0 -1
- package/dist/cli/commands/safestop.d.ts +0 -41
- package/dist/cli/commands/safestop.d.ts.map +0 -1
- package/dist/cli/commands/safestop.js +0 -62
- package/dist/cli/commands/safestop.js.map +0 -1
- package/dist/cli/commands/schema.d.ts +0 -44
- package/dist/cli/commands/schema.d.ts.map +0 -1
- package/dist/cli/commands/schema.js +0 -177
- package/dist/cli/commands/schema.js.map +0 -1
- package/dist/cli/commands/self-update.d.ts +0 -81
- package/dist/cli/commands/self-update.d.ts.map +0 -1
- package/dist/cli/commands/self-update.js +0 -483
- package/dist/cli/commands/self-update.js.map +0 -1
- package/dist/cli/commands/sentient.d.ts +0 -44
- package/dist/cli/commands/sentient.d.ts.map +0 -1
- package/dist/cli/commands/sentient.js +0 -687
- package/dist/cli/commands/sentient.js.map +0 -1
- package/dist/cli/commands/sequence.d.ts +0 -15
- package/dist/cli/commands/sequence.d.ts.map +0 -1
- package/dist/cli/commands/sequence.js +0 -68
- package/dist/cli/commands/sequence.js.map +0 -1
- package/dist/cli/commands/session.d.ts +0 -32
- package/dist/cli/commands/session.d.ts.map +0 -1
- package/dist/cli/commands/session.js +0 -583
- package/dist/cli/commands/session.js.map +0 -1
- package/dist/cli/commands/show.d.ts +0 -21
- package/dist/cli/commands/show.d.ts.map +0 -1
- package/dist/cli/commands/show.js +0 -37
- package/dist/cli/commands/show.js.map +0 -1
- package/dist/cli/commands/skills.d.ts +0 -31
- package/dist/cli/commands/skills.d.ts.map +0 -1
- package/dist/cli/commands/skills.js +0 -303
- package/dist/cli/commands/skills.js.map +0 -1
- package/dist/cli/commands/snapshot.d.ts +0 -17
- package/dist/cli/commands/snapshot.d.ts.map +0 -1
- package/dist/cli/commands/snapshot.js +0 -95
- package/dist/cli/commands/snapshot.js.map +0 -1
- package/dist/cli/commands/start.d.ts +0 -21
- package/dist/cli/commands/start.d.ts.map +0 -1
- package/dist/cli/commands/start.js +0 -32
- package/dist/cli/commands/start.js.map +0 -1
- package/dist/cli/commands/stats.d.ts +0 -30
- package/dist/cli/commands/stats.d.ts.map +0 -1
- package/dist/cli/commands/stats.js +0 -71
- package/dist/cli/commands/stats.js.map +0 -1
- package/dist/cli/commands/sticky.d.ts +0 -23
- package/dist/cli/commands/sticky.d.ts.map +0 -1
- package/dist/cli/commands/sticky.js +0 -315
- package/dist/cli/commands/sticky.js.map +0 -1
- package/dist/cli/commands/stop.d.ts +0 -15
- package/dist/cli/commands/stop.d.ts.map +0 -1
- package/dist/cli/commands/stop.js +0 -25
- package/dist/cli/commands/stop.js.map +0 -1
- package/dist/cli/commands/sync.d.ts +0 -25
- package/dist/cli/commands/sync.d.ts.map +0 -1
- package/dist/cli/commands/sync.js +0 -125
- package/dist/cli/commands/sync.js.map +0 -1
- package/dist/cli/commands/testing.d.ts +0 -22
- package/dist/cli/commands/testing.d.ts.map +0 -1
- package/dist/cli/commands/testing.js +0 -111
- package/dist/cli/commands/testing.js.map +0 -1
- package/dist/cli/commands/token.d.ts +0 -22
- package/dist/cli/commands/token.d.ts.map +0 -1
- package/dist/cli/commands/token.js +0 -197
- package/dist/cli/commands/token.js.map +0 -1
- package/dist/cli/commands/transcript.d.ts +0 -32
- package/dist/cli/commands/transcript.d.ts.map +0 -1
- package/dist/cli/commands/transcript.js +0 -526
- package/dist/cli/commands/transcript.js.map +0 -1
- package/dist/cli/commands/update.d.ts +0 -164
- package/dist/cli/commands/update.d.ts.map +0 -1
- package/dist/cli/commands/update.js +0 -234
- package/dist/cli/commands/update.js.map +0 -1
- package/dist/cli/commands/upgrade.d.ts +0 -76
- package/dist/cli/commands/upgrade.d.ts.map +0 -1
- package/dist/cli/commands/upgrade.js +0 -154
- package/dist/cli/commands/upgrade.js.map +0 -1
- package/dist/cli/commands/verify.d.ts +0 -83
- package/dist/cli/commands/verify.d.ts.map +0 -1
- package/dist/cli/commands/verify.js +0 -108
- package/dist/cli/commands/verify.js.map +0 -1
- package/dist/cli/commands/web.d.ts +0 -27
- package/dist/cli/commands/web.d.ts.map +0 -1
- package/dist/cli/commands/web.js +0 -414
- package/dist/cli/commands/web.js.map +0 -1
- package/dist/cli/field-context.d.ts +0 -32
- package/dist/cli/field-context.d.ts.map +0 -1
- package/dist/cli/field-context.js +0 -47
- package/dist/cli/field-context.js.map +0 -1
- package/dist/cli/format-context.d.ts +0 -32
- package/dist/cli/format-context.d.ts.map +0 -1
- package/dist/cli/format-context.js +0 -50
- package/dist/cli/format-context.js.map +0 -1
- package/dist/cli/help-renderer.d.ts +0 -40
- package/dist/cli/help-renderer.d.ts.map +0 -1
- package/dist/cli/help-renderer.js +0 -325
- package/dist/cli/help-renderer.js.map +0 -1
- package/dist/cli/index.d.ts +0 -14
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/infer-files-via-gitnexus.d.ts +0 -12
- package/dist/cli/infer-files-via-gitnexus.d.ts.map +0 -1
- package/dist/cli/infer-files-via-gitnexus.js +0 -12
- package/dist/cli/infer-files-via-gitnexus.js.map +0 -1
- package/dist/cli/lib/did-you-mean.d.ts +0 -30
- package/dist/cli/lib/did-you-mean.d.ts.map +0 -1
- package/dist/cli/lib/did-you-mean.js +0 -63
- package/dist/cli/lib/did-you-mean.js.map +0 -1
- package/dist/cli/lib/registry-args.d.ts +0 -36
- package/dist/cli/lib/registry-args.d.ts.map +0 -1
- package/dist/cli/lib/registry-args.js +0 -37
- package/dist/cli/lib/registry-args.js.map +0 -1
- package/dist/cli/lib/subcommand-guard.d.ts +0 -45
- package/dist/cli/lib/subcommand-guard.d.ts.map +0 -1
- package/dist/cli/lib/subcommand-guard.js +0 -55
- package/dist/cli/lib/subcommand-guard.js.map +0 -1
- package/dist/cli/logger-bootstrap.d.ts +0 -6
- package/dist/cli/logger-bootstrap.d.ts.map +0 -1
- package/dist/cli/logger-bootstrap.js +0 -10
- package/dist/cli/logger-bootstrap.js.map +0 -1
- package/dist/cli/middleware/output-format.d.ts +0 -30
- package/dist/cli/middleware/output-format.d.ts.map +0 -1
- package/dist/cli/middleware/output-format.js +0 -35
- package/dist/cli/middleware/output-format.js.map +0 -1
- package/dist/cli/paths.d.ts +0 -85
- package/dist/cli/paths.d.ts.map +0 -1
- package/dist/cli/paths.js +0 -108
- package/dist/cli/paths.js.map +0 -1
- package/dist/cli/progress.d.ts +0 -89
- package/dist/cli/progress.d.ts.map +0 -1
- package/dist/cli/progress.js +0 -185
- package/dist/cli/progress.js.map +0 -1
- package/dist/cli/renderers/colors.d.ts +0 -32
- package/dist/cli/renderers/colors.d.ts.map +0 -1
- package/dist/cli/renderers/colors.js +0 -141
- package/dist/cli/renderers/colors.js.map +0 -1
- package/dist/cli/renderers/error.d.ts +0 -13
- package/dist/cli/renderers/error.d.ts.map +0 -1
- package/dist/cli/renderers/error.js +0 -42
- package/dist/cli/renderers/error.js.map +0 -1
- package/dist/cli/renderers/index.d.ts +0 -90
- package/dist/cli/renderers/index.d.ts.map +0 -1
- package/dist/cli/renderers/index.js +0 -268
- package/dist/cli/renderers/index.js.map +0 -1
- package/dist/cli/renderers/lafs-validator.d.ts +0 -91
- package/dist/cli/renderers/lafs-validator.d.ts.map +0 -1
- package/dist/cli/renderers/lafs-validator.js +0 -176
- package/dist/cli/renderers/lafs-validator.js.map +0 -1
- package/dist/cli/renderers/normalizer.d.ts +0 -21
- package/dist/cli/renderers/normalizer.d.ts.map +0 -1
- package/dist/cli/renderers/normalizer.js +0 -106
- package/dist/cli/renderers/normalizer.js.map +0 -1
- package/dist/cli/renderers/system.d.ts +0 -110
- package/dist/cli/renderers/system.d.ts.map +0 -1
- package/dist/cli/renderers/system.js +0 -662
- package/dist/cli/renderers/system.js.map +0 -1
- package/dist/cli/renderers/tasks.d.ts +0 -28
- package/dist/cli/renderers/tasks.d.ts.map +0 -1
- package/dist/cli/renderers/tasks.js +0 -306
- package/dist/cli/renderers/tasks.js.map +0 -1
- package/dist/cli/tree-context.d.ts +0 -53
- package/dist/cli/tree-context.d.ts.map +0 -1
- package/dist/cli/tree-context.js +0 -43
- package/dist/cli/tree-context.js.map +0 -1
- package/dist/dispatch/adapters/cli.d.ts +0 -67
- package/dist/dispatch/adapters/cli.d.ts.map +0 -1
- package/dist/dispatch/adapters/cli.js +0 -331
- package/dist/dispatch/adapters/cli.js.map +0 -1
- package/dist/dispatch/adapters/typed.d.ts +0 -362
- package/dist/dispatch/adapters/typed.d.ts.map +0 -1
- package/dist/dispatch/adapters/typed.js +0 -278
- package/dist/dispatch/adapters/typed.js.map +0 -1
- package/dist/dispatch/context/session-context.d.ts +0 -108
- package/dist/dispatch/context/session-context.d.ts.map +0 -1
- package/dist/dispatch/context/session-context.js +0 -111
- package/dist/dispatch/context/session-context.js.map +0 -1
- package/dist/dispatch/dispatcher.d.ts +0 -37
- package/dist/dispatch/dispatcher.d.ts.map +0 -1
- package/dist/dispatch/dispatcher.js +0 -172
- package/dist/dispatch/dispatcher.js.map +0 -1
- package/dist/dispatch/domains/_base.d.ts +0 -104
- package/dist/dispatch/domains/_base.d.ts.map +0 -1
- package/dist/dispatch/domains/_base.js +0 -147
- package/dist/dispatch/domains/_base.js.map +0 -1
- package/dist/dispatch/domains/_meta.d.ts +0 -23
- package/dist/dispatch/domains/_meta.d.ts.map +0 -1
- package/dist/dispatch/domains/_meta.js +0 -25
- package/dist/dispatch/domains/_meta.js.map +0 -1
- package/dist/dispatch/domains/_routing.d.ts +0 -8
- package/dist/dispatch/domains/_routing.d.ts.map +0 -1
- package/dist/dispatch/domains/_routing.js +0 -20
- package/dist/dispatch/domains/_routing.js.map +0 -1
- package/dist/dispatch/domains/admin/smoke-provider.d.ts +0 -54
- package/dist/dispatch/domains/admin/smoke-provider.d.ts.map +0 -1
- package/dist/dispatch/domains/admin/smoke-provider.js +0 -309
- package/dist/dispatch/domains/admin/smoke-provider.js.map +0 -1
- package/dist/dispatch/domains/admin.d.ts +0 -51
- package/dist/dispatch/domains/admin.d.ts.map +0 -1
- package/dist/dispatch/domains/admin.js +0 -1163
- package/dist/dispatch/domains/admin.js.map +0 -1
- package/dist/dispatch/domains/check/canon.d.ts +0 -65
- package/dist/dispatch/domains/check/canon.d.ts.map +0 -1
- package/dist/dispatch/domains/check/canon.js +0 -193
- package/dist/dispatch/domains/check/canon.js.map +0 -1
- package/dist/dispatch/domains/check.d.ts +0 -37
- package/dist/dispatch/domains/check.d.ts.map +0 -1
- package/dist/dispatch/domains/check.js +0 -562
- package/dist/dispatch/domains/check.js.map +0 -1
- package/dist/dispatch/domains/conduit.d.ts +0 -61
- package/dist/dispatch/domains/conduit.d.ts.map +0 -1
- package/dist/dispatch/domains/conduit.js +0 -609
- package/dist/dispatch/domains/conduit.js.map +0 -1
- package/dist/dispatch/domains/diagnostics.d.ts +0 -25
- package/dist/dispatch/domains/diagnostics.d.ts.map +0 -1
- package/dist/dispatch/domains/diagnostics.js +0 -82
- package/dist/dispatch/domains/diagnostics.js.map +0 -1
- package/dist/dispatch/domains/docs.d.ts +0 -63
- package/dist/dispatch/domains/docs.d.ts.map +0 -1
- package/dist/dispatch/domains/docs.js +0 -539
- package/dist/dispatch/domains/docs.js.map +0 -1
- package/dist/dispatch/domains/index.d.ts +0 -33
- package/dist/dispatch/domains/index.d.ts.map +0 -1
- package/dist/dispatch/domains/index.js +0 -58
- package/dist/dispatch/domains/index.js.map +0 -1
- package/dist/dispatch/domains/intelligence.d.ts +0 -26
- package/dist/dispatch/domains/intelligence.d.ts.map +0 -1
- package/dist/dispatch/domains/intelligence.js +0 -154
- package/dist/dispatch/domains/intelligence.js.map +0 -1
- package/dist/dispatch/domains/ivtr.d.ts +0 -182
- package/dist/dispatch/domains/ivtr.d.ts.map +0 -1
- package/dist/dispatch/domains/ivtr.js +0 -430
- package/dist/dispatch/domains/ivtr.js.map +0 -1
- package/dist/dispatch/domains/memory.d.ts +0 -22
- package/dist/dispatch/domains/memory.d.ts.map +0 -1
- package/dist/dispatch/domains/memory.js +0 -1281
- package/dist/dispatch/domains/memory.js.map +0 -1
- package/dist/dispatch/domains/nexus.d.ts +0 -78
- package/dist/dispatch/domains/nexus.d.ts.map +0 -1
- package/dist/dispatch/domains/nexus.js +0 -938
- package/dist/dispatch/domains/nexus.js.map +0 -1
- package/dist/dispatch/domains/orchestrate.d.ts +0 -307
- package/dist/dispatch/domains/orchestrate.d.ts.map +0 -1
- package/dist/dispatch/domains/orchestrate.js +0 -986
- package/dist/dispatch/domains/orchestrate.js.map +0 -1
- package/dist/dispatch/domains/pipeline.d.ts +0 -276
- package/dist/dispatch/domains/pipeline.d.ts.map +0 -1
- package/dist/dispatch/domains/pipeline.js +0 -689
- package/dist/dispatch/domains/pipeline.js.map +0 -1
- package/dist/dispatch/domains/playbook.d.ts +0 -131
- package/dist/dispatch/domains/playbook.d.ts.map +0 -1
- package/dist/dispatch/domains/playbook.js +0 -633
- package/dist/dispatch/domains/playbook.js.map +0 -1
- package/dist/dispatch/domains/release.d.ts +0 -97
- package/dist/dispatch/domains/release.d.ts.map +0 -1
- package/dist/dispatch/domains/release.js +0 -177
- package/dist/dispatch/domains/release.js.map +0 -1
- package/dist/dispatch/domains/sentient.d.ts +0 -60
- package/dist/dispatch/domains/sentient.d.ts.map +0 -1
- package/dist/dispatch/domains/sentient.js +0 -270
- package/dist/dispatch/domains/sentient.js.map +0 -1
- package/dist/dispatch/domains/session.d.ts +0 -49
- package/dist/dispatch/domains/session.d.ts.map +0 -1
- package/dist/dispatch/domains/session.js +0 -459
- package/dist/dispatch/domains/session.js.map +0 -1
- package/dist/dispatch/domains/sticky.d.ts +0 -82
- package/dist/dispatch/domains/sticky.d.ts.map +0 -1
- package/dist/dispatch/domains/sticky.js +0 -287
- package/dist/dispatch/domains/sticky.js.map +0 -1
- package/dist/dispatch/domains/tasks.d.ts +0 -58
- package/dist/dispatch/domains/tasks.d.ts.map +0 -1
- package/dist/dispatch/domains/tasks.js +0 -497
- package/dist/dispatch/domains/tasks.js.map +0 -1
- package/dist/dispatch/domains/tools.d.ts +0 -37
- package/dist/dispatch/domains/tools.d.ts.map +0 -1
- package/dist/dispatch/domains/tools.js +0 -481
- package/dist/dispatch/domains/tools.js.map +0 -1
- package/dist/dispatch/engines/_error.d.ts +0 -114
- package/dist/dispatch/engines/_error.d.ts.map +0 -1
- package/dist/dispatch/engines/_error.js +0 -290
- package/dist/dispatch/engines/_error.js.map +0 -1
- package/dist/dispatch/engines/admin-engine.d.ts +0 -386
- package/dist/dispatch/engines/admin-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/admin-engine.js +0 -270
- package/dist/dispatch/engines/admin-engine.js.map +0 -1
- package/dist/dispatch/engines/code-engine.d.ts +0 -14
- package/dist/dispatch/engines/code-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/code-engine.js +0 -14
- package/dist/dispatch/engines/code-engine.js.map +0 -1
- package/dist/dispatch/engines/codebase-map-engine.d.ts +0 -31
- package/dist/dispatch/engines/codebase-map-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/codebase-map-engine.js +0 -43
- package/dist/dispatch/engines/codebase-map-engine.js.map +0 -1
- package/dist/dispatch/engines/config-engine.d.ts +0 -14
- package/dist/dispatch/engines/config-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/config-engine.js +0 -14
- package/dist/dispatch/engines/config-engine.js.map +0 -1
- package/dist/dispatch/engines/diagnostics-engine.d.ts +0 -13
- package/dist/dispatch/engines/diagnostics-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/diagnostics-engine.js +0 -12
- package/dist/dispatch/engines/diagnostics-engine.js.map +0 -1
- package/dist/dispatch/engines/hooks-engine.d.ts +0 -13
- package/dist/dispatch/engines/hooks-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/hooks-engine.js +0 -12
- package/dist/dispatch/engines/hooks-engine.js.map +0 -1
- package/dist/dispatch/engines/init-engine.d.ts +0 -14
- package/dist/dispatch/engines/init-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/init-engine.js +0 -14
- package/dist/dispatch/engines/init-engine.js.map +0 -1
- package/dist/dispatch/engines/lifecycle-engine.d.ts +0 -13
- package/dist/dispatch/engines/lifecycle-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/lifecycle-engine.js +0 -12
- package/dist/dispatch/engines/lifecycle-engine.js.map +0 -1
- package/dist/dispatch/engines/memory-engine.d.ts +0 -10
- package/dist/dispatch/engines/memory-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/memory-engine.js +0 -10
- package/dist/dispatch/engines/memory-engine.js.map +0 -1
- package/dist/dispatch/engines/nexus-engine.d.ts +0 -603
- package/dist/dispatch/engines/nexus-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/nexus-engine.js +0 -1438
- package/dist/dispatch/engines/nexus-engine.js.map +0 -1
- package/dist/dispatch/engines/orchestrate-engine.d.ts +0 -252
- package/dist/dispatch/engines/orchestrate-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/orchestrate-engine.js +0 -1526
- package/dist/dispatch/engines/orchestrate-engine.js.map +0 -1
- package/dist/dispatch/engines/pipeline-engine.d.ts +0 -13
- package/dist/dispatch/engines/pipeline-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/pipeline-engine.js +0 -12
- package/dist/dispatch/engines/pipeline-engine.js.map +0 -1
- package/dist/dispatch/engines/release-engine.d.ts +0 -13
- package/dist/dispatch/engines/release-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/release-engine.js +0 -13
- package/dist/dispatch/engines/release-engine.js.map +0 -1
- package/dist/dispatch/engines/session-engine.d.ts +0 -15
- package/dist/dispatch/engines/session-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/session-engine.js +0 -12
- package/dist/dispatch/engines/session-engine.js.map +0 -1
- package/dist/dispatch/engines/sticky-engine.d.ts +0 -13
- package/dist/dispatch/engines/sticky-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/sticky-engine.js +0 -12
- package/dist/dispatch/engines/sticky-engine.js.map +0 -1
- package/dist/dispatch/engines/system-engine.d.ts +0 -543
- package/dist/dispatch/engines/system-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/system-engine.js +0 -1278
- package/dist/dispatch/engines/system-engine.js.map +0 -1
- package/dist/dispatch/engines/task-engine.d.ts +0 -1161
- package/dist/dispatch/engines/task-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/task-engine.js +0 -1599
- package/dist/dispatch/engines/task-engine.js.map +0 -1
- package/dist/dispatch/engines/template-parser.d.ts +0 -85
- package/dist/dispatch/engines/template-parser.d.ts.map +0 -1
- package/dist/dispatch/engines/template-parser.js +0 -114
- package/dist/dispatch/engines/template-parser.js.map +0 -1
- package/dist/dispatch/engines/tools-engine.d.ts +0 -13
- package/dist/dispatch/engines/tools-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/tools-engine.js +0 -12
- package/dist/dispatch/engines/tools-engine.js.map +0 -1
- package/dist/dispatch/engines/validate-engine.d.ts +0 -13
- package/dist/dispatch/engines/validate-engine.d.ts.map +0 -1
- package/dist/dispatch/engines/validate-engine.js +0 -13
- package/dist/dispatch/engines/validate-engine.js.map +0 -1
- package/dist/dispatch/index.d.ts +0 -20
- package/dist/dispatch/index.d.ts.map +0 -1
- package/dist/dispatch/index.js +0 -19
- package/dist/dispatch/index.js.map +0 -1
- package/dist/dispatch/lib/background-jobs.d.ts +0 -162
- package/dist/dispatch/lib/background-jobs.d.ts.map +0 -1
- package/dist/dispatch/lib/background-jobs.js +0 -360
- package/dist/dispatch/lib/background-jobs.js.map +0 -1
- package/dist/dispatch/lib/budget.d.ts +0 -36
- package/dist/dispatch/lib/budget.d.ts.map +0 -1
- package/dist/dispatch/lib/budget.js +0 -109
- package/dist/dispatch/lib/budget.js.map +0 -1
- package/dist/dispatch/lib/capability-matrix.d.ts +0 -11
- package/dist/dispatch/lib/capability-matrix.d.ts.map +0 -1
- package/dist/dispatch/lib/capability-matrix.js +0 -10
- package/dist/dispatch/lib/capability-matrix.js.map +0 -1
- package/dist/dispatch/lib/config-loader.d.ts +0 -42
- package/dist/dispatch/lib/config-loader.d.ts.map +0 -1
- package/dist/dispatch/lib/config-loader.js +0 -218
- package/dist/dispatch/lib/config-loader.js.map +0 -1
- package/dist/dispatch/lib/config.d.ts +0 -11
- package/dist/dispatch/lib/config.d.ts.map +0 -1
- package/dist/dispatch/lib/config.js +0 -10
- package/dist/dispatch/lib/config.js.map +0 -1
- package/dist/dispatch/lib/defaults.d.ts +0 -115
- package/dist/dispatch/lib/defaults.d.ts.map +0 -1
- package/dist/dispatch/lib/defaults.js +0 -61
- package/dist/dispatch/lib/defaults.js.map +0 -1
- package/dist/dispatch/lib/engine.d.ts +0 -17
- package/dist/dispatch/lib/engine.d.ts.map +0 -1
- package/dist/dispatch/lib/engine.js +0 -36
- package/dist/dispatch/lib/engine.js.map +0 -1
- package/dist/dispatch/lib/exit-codes.d.ts +0 -35
- package/dist/dispatch/lib/exit-codes.d.ts.map +0 -1
- package/dist/dispatch/lib/exit-codes.js +0 -60
- package/dist/dispatch/lib/exit-codes.js.map +0 -1
- package/dist/dispatch/lib/gateway-meta.d.ts +0 -37
- package/dist/dispatch/lib/gateway-meta.d.ts.map +0 -1
- package/dist/dispatch/lib/gateway-meta.js +0 -50
- package/dist/dispatch/lib/gateway-meta.js.map +0 -1
- package/dist/dispatch/lib/job-manager-accessor.d.ts +0 -9
- package/dist/dispatch/lib/job-manager-accessor.d.ts.map +0 -1
- package/dist/dispatch/lib/job-manager-accessor.js +0 -13
- package/dist/dispatch/lib/job-manager-accessor.js.map +0 -1
- package/dist/dispatch/lib/meta.d.ts +0 -26
- package/dist/dispatch/lib/meta.d.ts.map +0 -1
- package/dist/dispatch/lib/meta.js +0 -37
- package/dist/dispatch/lib/meta.js.map +0 -1
- package/dist/dispatch/lib/param-utils.d.ts +0 -11
- package/dist/dispatch/lib/param-utils.d.ts.map +0 -1
- package/dist/dispatch/lib/param-utils.js +0 -10
- package/dist/dispatch/lib/param-utils.js.map +0 -1
- package/dist/dispatch/lib/projections.d.ts +0 -56
- package/dist/dispatch/lib/projections.d.ts.map +0 -1
- package/dist/dispatch/lib/projections.js +0 -65
- package/dist/dispatch/lib/projections.js.map +0 -1
- package/dist/dispatch/lib/proto-envelope.d.ts +0 -56
- package/dist/dispatch/lib/proto-envelope.d.ts.map +0 -1
- package/dist/dispatch/lib/proto-envelope.js +0 -17
- package/dist/dispatch/lib/proto-envelope.js.map +0 -1
- package/dist/dispatch/lib/schema-utils.d.ts +0 -39
- package/dist/dispatch/lib/schema-utils.d.ts.map +0 -1
- package/dist/dispatch/lib/schema-utils.js +0 -88
- package/dist/dispatch/lib/schema-utils.js.map +0 -1
- package/dist/dispatch/lib/security.d.ts +0 -11
- package/dist/dispatch/lib/security.d.ts.map +0 -1
- package/dist/dispatch/lib/security.js +0 -10
- package/dist/dispatch/lib/security.js.map +0 -1
- package/dist/dispatch/middleware/audit.d.ts +0 -23
- package/dist/dispatch/middleware/audit.d.ts.map +0 -1
- package/dist/dispatch/middleware/audit.js +0 -169
- package/dist/dispatch/middleware/audit.js.map +0 -1
- package/dist/dispatch/middleware/field-filter.d.ts +0 -25
- package/dist/dispatch/middleware/field-filter.d.ts.map +0 -1
- package/dist/dispatch/middleware/field-filter.js +0 -70
- package/dist/dispatch/middleware/field-filter.js.map +0 -1
- package/dist/dispatch/middleware/pipeline.d.ts +0 -33
- package/dist/dispatch/middleware/pipeline.d.ts.map +0 -1
- package/dist/dispatch/middleware/pipeline.js +0 -60
- package/dist/dispatch/middleware/pipeline.js.map +0 -1
- package/dist/dispatch/middleware/projection.d.ts +0 -35
- package/dist/dispatch/middleware/projection.d.ts.map +0 -1
- package/dist/dispatch/middleware/projection.js +0 -146
- package/dist/dispatch/middleware/projection.js.map +0 -1
- package/dist/dispatch/middleware/protocol-enforcement.d.ts +0 -30
- package/dist/dispatch/middleware/protocol-enforcement.d.ts.map +0 -1
- package/dist/dispatch/middleware/protocol-enforcement.js +0 -56
- package/dist/dispatch/middleware/protocol-enforcement.js.map +0 -1
- package/dist/dispatch/middleware/rate-limiter.d.ts +0 -72
- package/dist/dispatch/middleware/rate-limiter.d.ts.map +0 -1
- package/dist/dispatch/middleware/rate-limiter.js +0 -127
- package/dist/dispatch/middleware/rate-limiter.js.map +0 -1
- package/dist/dispatch/middleware/sanitizer.d.ts +0 -24
- package/dist/dispatch/middleware/sanitizer.d.ts.map +0 -1
- package/dist/dispatch/middleware/sanitizer.js +0 -56
- package/dist/dispatch/middleware/sanitizer.js.map +0 -1
- package/dist/dispatch/middleware/session-resolver.d.ts +0 -26
- package/dist/dispatch/middleware/session-resolver.d.ts.map +0 -1
- package/dist/dispatch/middleware/session-resolver.js +0 -65
- package/dist/dispatch/middleware/session-resolver.js.map +0 -1
- package/dist/dispatch/middleware/telemetry.d.ts +0 -21
- package/dist/dispatch/middleware/telemetry.d.ts.map +0 -1
- package/dist/dispatch/middleware/telemetry.js +0 -50
- package/dist/dispatch/middleware/telemetry.js.map +0 -1
- package/dist/dispatch/middleware/verification-gates.d.ts +0 -22
- package/dist/dispatch/middleware/verification-gates.d.ts.map +0 -1
- package/dist/dispatch/middleware/verification-gates.js +0 -59
- package/dist/dispatch/middleware/verification-gates.js.map +0 -1
- package/dist/dispatch/registry.d.ts +0 -91
- package/dist/dispatch/registry.d.ts.map +0 -1
- package/dist/dispatch/registry.js +0 -6430
- package/dist/dispatch/registry.js.map +0 -1
- package/dist/dispatch/types.d.ts +0 -150
- package/dist/dispatch/types.d.ts.map +0 -1
- package/dist/dispatch/types.js +0 -38
- package/dist/dispatch/types.js.map +0 -1
- package/dist/migrations/2026-04-25-t991-parent-link-repair.d.ts +0 -88
- package/dist/migrations/2026-04-25-t991-parent-link-repair.d.ts.map +0 -1
- package/dist/migrations/2026-04-25-t991-parent-link-repair.js +0 -76
- package/dist/migrations/2026-04-25-t991-parent-link-repair.js.map +0 -1
|
@@ -1,1281 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory Domain Handler (Dispatch Layer) — Brain.db Cognitive Memory
|
|
3
|
-
*
|
|
4
|
-
* Handles brain.db-backed cognitive memory operations: observations, decisions,
|
|
5
|
-
* patterns, learnings, and the 3-layer retrieval protocol (find/timeline/fetch).
|
|
6
|
-
*
|
|
7
|
-
* Manifest/pipeline operations have been moved to the pipeline domain.
|
|
8
|
-
* Context injection has been moved to sessions/context-inject.ts.
|
|
9
|
-
*
|
|
10
|
-
* @task T5241
|
|
11
|
-
* @epic T5149
|
|
12
|
-
*/
|
|
13
|
-
import { getLogger, getProjectRoot } from '@cleocode/core';
|
|
14
|
-
import { generateMemoryBridgeContent, getBrainDb, getBrainNativeDb, resolveAnthropicApiKey, resolveAnthropicApiKeySource, typedAll, } from '@cleocode/core/internal';
|
|
15
|
-
import { approveBackfillRun, listBackfillRuns, rollbackBackfillRun, stagedBackfillRun, } from '@cleocode/core/memory/brain-backfill.js';
|
|
16
|
-
import { precompactFlush } from '@cleocode/core/memory/precompact-flush.js';
|
|
17
|
-
import { memoryDecisionFind, memoryDecisionStore, memoryFetch,
|
|
18
|
-
// Brain.db cognitive memory operations
|
|
19
|
-
memoryFind,
|
|
20
|
-
// PageIndex graph operations (T5385)
|
|
21
|
-
memoryGraphAdd, memoryGraphContext, memoryGraphNeighbors, memoryGraphRelated, memoryGraphRemove, memoryGraphShow, memoryGraphStatsFull, memoryGraphTrace,
|
|
22
|
-
// Learning operations
|
|
23
|
-
memoryLearningFind, memoryLearningStore,
|
|
24
|
-
// Brain memory linking
|
|
25
|
-
memoryLink, memoryObserve,
|
|
26
|
-
// Pattern operations
|
|
27
|
-
memoryPatternFind, memoryPatternStore, memoryQualityReport, memoryReasonSimilar,
|
|
28
|
-
// Reasoning & hybrid search (T5388-T5393)
|
|
29
|
-
memoryReasonWhy, memorySearchHybrid, memoryTimeline, } from '../lib/engine.js';
|
|
30
|
-
import { errorResult, handleErrorResult, paramBool, paramNumber, paramString, paramStringArray, paramStringRequired, unsupportedOp, wrapResult, } from './_base.js';
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
// Memory Handler Class
|
|
33
|
-
// ---------------------------------------------------------------------------
|
|
34
|
-
// MemoryHandler
|
|
35
|
-
// ---------------------------------------------------------------------------
|
|
36
|
-
export class MemoryHandler {
|
|
37
|
-
// -----------------------------------------------------------------------
|
|
38
|
-
// Query
|
|
39
|
-
// -----------------------------------------------------------------------
|
|
40
|
-
async query(operation, params) {
|
|
41
|
-
const projectRoot = getProjectRoot();
|
|
42
|
-
const startTime = Date.now();
|
|
43
|
-
try {
|
|
44
|
-
switch (operation) {
|
|
45
|
-
case 'find': {
|
|
46
|
-
const query = paramStringRequired(params, 'query');
|
|
47
|
-
if (!query)
|
|
48
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'query is required', startTime);
|
|
49
|
-
// T418: optional agent filter for per-agent mental model retrieval
|
|
50
|
-
return wrapResult(await memoryFind({
|
|
51
|
-
query,
|
|
52
|
-
limit: paramNumber(params, 'limit'),
|
|
53
|
-
tables: paramStringArray(params, 'tables'),
|
|
54
|
-
dateStart: paramString(params, 'dateStart'),
|
|
55
|
-
dateEnd: paramString(params, 'dateEnd'),
|
|
56
|
-
agent: paramString(params, 'agent'),
|
|
57
|
-
}, projectRoot), 'query', 'memory', operation, startTime);
|
|
58
|
-
}
|
|
59
|
-
case 'timeline': {
|
|
60
|
-
const anchor = paramStringRequired(params, 'anchor');
|
|
61
|
-
if (!anchor)
|
|
62
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'anchor is required', startTime);
|
|
63
|
-
return wrapResult(await memoryTimeline({
|
|
64
|
-
anchor,
|
|
65
|
-
depthBefore: paramNumber(params, 'depthBefore'),
|
|
66
|
-
depthAfter: paramNumber(params, 'depthAfter'),
|
|
67
|
-
}, projectRoot), 'query', 'memory', operation, startTime);
|
|
68
|
-
}
|
|
69
|
-
case 'fetch': {
|
|
70
|
-
const ids = paramStringArray(params, 'ids');
|
|
71
|
-
if (!ids || ids.length === 0)
|
|
72
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'ids is required (non-empty array)', startTime);
|
|
73
|
-
return wrapResult(await memoryFetch({ ids }, projectRoot), 'query', 'memory', operation, startTime);
|
|
74
|
-
}
|
|
75
|
-
case 'decision.find': {
|
|
76
|
-
const result = await memoryDecisionFind({
|
|
77
|
-
query: paramString(params, 'query'),
|
|
78
|
-
taskId: paramString(params, 'taskId'),
|
|
79
|
-
limit: paramNumber(params, 'limit'),
|
|
80
|
-
}, projectRoot);
|
|
81
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
82
|
-
}
|
|
83
|
-
case 'pattern.find': {
|
|
84
|
-
const patternType = paramString(params, 'type');
|
|
85
|
-
const patternImpact = paramString(params, 'impact');
|
|
86
|
-
const result = await memoryPatternFind({
|
|
87
|
-
type: patternType,
|
|
88
|
-
impact: patternImpact,
|
|
89
|
-
query: paramString(params, 'query'),
|
|
90
|
-
minFrequency: paramNumber(params, 'minFrequency'),
|
|
91
|
-
limit: paramNumber(params, 'limit'),
|
|
92
|
-
}, projectRoot);
|
|
93
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
94
|
-
}
|
|
95
|
-
case 'learning.find': {
|
|
96
|
-
const result = await memoryLearningFind({
|
|
97
|
-
query: paramString(params, 'query'),
|
|
98
|
-
minConfidence: paramNumber(params, 'minConfidence'),
|
|
99
|
-
actionableOnly: paramBool(params, 'actionableOnly'),
|
|
100
|
-
applicableType: paramString(params, 'applicableType'),
|
|
101
|
-
limit: paramNumber(params, 'limit'),
|
|
102
|
-
}, projectRoot);
|
|
103
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
104
|
-
}
|
|
105
|
-
case 'graph.show': {
|
|
106
|
-
const nodeId = paramStringRequired(params, 'nodeId');
|
|
107
|
-
if (!nodeId) {
|
|
108
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'nodeId is required', startTime);
|
|
109
|
-
}
|
|
110
|
-
const result = await memoryGraphShow({ nodeId }, projectRoot);
|
|
111
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
112
|
-
}
|
|
113
|
-
case 'graph.neighbors': {
|
|
114
|
-
const nodeId = paramStringRequired(params, 'nodeId');
|
|
115
|
-
if (!nodeId) {
|
|
116
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'nodeId is required', startTime);
|
|
117
|
-
}
|
|
118
|
-
const result = await memoryGraphNeighbors({ nodeId, edgeType: paramString(params, 'edgeType') }, projectRoot);
|
|
119
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
120
|
-
}
|
|
121
|
-
case 'graph.trace': {
|
|
122
|
-
const nodeId = paramStringRequired(params, 'nodeId');
|
|
123
|
-
if (!nodeId) {
|
|
124
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'nodeId is required', startTime);
|
|
125
|
-
}
|
|
126
|
-
const result = await memoryGraphTrace({ nodeId, maxDepth: paramNumber(params, 'maxDepth') }, projectRoot);
|
|
127
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
128
|
-
}
|
|
129
|
-
case 'graph.related': {
|
|
130
|
-
const nodeId = paramStringRequired(params, 'nodeId');
|
|
131
|
-
if (!nodeId) {
|
|
132
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'nodeId is required', startTime);
|
|
133
|
-
}
|
|
134
|
-
const result = await memoryGraphRelated({ nodeId, edgeType: paramString(params, 'edgeType') }, projectRoot);
|
|
135
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
136
|
-
}
|
|
137
|
-
case 'graph.context': {
|
|
138
|
-
const nodeId = paramStringRequired(params, 'nodeId');
|
|
139
|
-
if (!nodeId) {
|
|
140
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'nodeId is required', startTime);
|
|
141
|
-
}
|
|
142
|
-
const result = await memoryGraphContext({ nodeId }, projectRoot);
|
|
143
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
144
|
-
}
|
|
145
|
-
case 'graph.stats': {
|
|
146
|
-
const result = await memoryGraphStatsFull(projectRoot);
|
|
147
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
148
|
-
}
|
|
149
|
-
case 'reason.why': {
|
|
150
|
-
const taskId = paramStringRequired(params, 'taskId');
|
|
151
|
-
if (!taskId) {
|
|
152
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'taskId is required', startTime);
|
|
153
|
-
}
|
|
154
|
-
const result = await memoryReasonWhy({ taskId }, projectRoot);
|
|
155
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
156
|
-
}
|
|
157
|
-
case 'reason.similar': {
|
|
158
|
-
const entryId = paramStringRequired(params, 'entryId');
|
|
159
|
-
if (!entryId) {
|
|
160
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'entryId is required', startTime);
|
|
161
|
-
}
|
|
162
|
-
const result = await memoryReasonSimilar({ entryId, limit: paramNumber(params, 'limit') }, projectRoot);
|
|
163
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
164
|
-
}
|
|
165
|
-
case 'search.hybrid': {
|
|
166
|
-
const query = paramStringRequired(params, 'query');
|
|
167
|
-
if (!query) {
|
|
168
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'query is required', startTime);
|
|
169
|
-
}
|
|
170
|
-
const result = await memorySearchHybrid({
|
|
171
|
-
query,
|
|
172
|
-
ftsWeight: paramNumber(params, 'ftsWeight'),
|
|
173
|
-
vecWeight: paramNumber(params, 'vecWeight'),
|
|
174
|
-
graphWeight: paramNumber(params, 'graphWeight'),
|
|
175
|
-
limit: paramNumber(params, 'limit'),
|
|
176
|
-
}, projectRoot);
|
|
177
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
178
|
-
}
|
|
179
|
-
case 'quality': {
|
|
180
|
-
const result = await memoryQualityReport(projectRoot);
|
|
181
|
-
return wrapResult(result, 'query', 'memory', operation, startTime);
|
|
182
|
-
}
|
|
183
|
-
case 'code.links': {
|
|
184
|
-
const { listCodeLinks } = await import('@cleocode/core/internal');
|
|
185
|
-
const links = await listCodeLinks(projectRoot);
|
|
186
|
-
return wrapResult({ success: true, data: links }, 'query', 'memory', operation, startTime);
|
|
187
|
-
}
|
|
188
|
-
case 'code.memories-for-code': {
|
|
189
|
-
const symbol = paramStringRequired(params, 'symbol');
|
|
190
|
-
if (!symbol) {
|
|
191
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'symbol is required', startTime);
|
|
192
|
-
}
|
|
193
|
-
const { queryMemoriesForCode } = await import('@cleocode/core/internal');
|
|
194
|
-
const result = await queryMemoriesForCode(projectRoot, symbol);
|
|
195
|
-
return wrapResult({ success: true, data: result }, 'query', 'memory', operation, startTime);
|
|
196
|
-
}
|
|
197
|
-
case 'code.for-memory': {
|
|
198
|
-
const memoryId = paramStringRequired(params, 'memoryId');
|
|
199
|
-
if (!memoryId) {
|
|
200
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'memoryId is required', startTime);
|
|
201
|
-
}
|
|
202
|
-
const { queryCodeForMemory } = await import('@cleocode/core/internal');
|
|
203
|
-
const result = await queryCodeForMemory(projectRoot, memoryId);
|
|
204
|
-
return wrapResult({ success: true, data: result }, 'query', 'memory', operation, startTime);
|
|
205
|
-
}
|
|
206
|
-
// T1262 — brain noise detector (read-only, E1-parallel per council verdict)
|
|
207
|
-
case 'doctor': {
|
|
208
|
-
const { scanBrainNoise } = await import('@cleocode/core/memory/brain-doctor.js');
|
|
209
|
-
const result = await scanBrainNoise(projectRoot);
|
|
210
|
-
const assertClean = paramBool(params, 'assert-clean');
|
|
211
|
-
if (assertClean) {
|
|
212
|
-
// T1147 W7: also check for pending brain_observations_staging rows (staged sweep not approved).
|
|
213
|
-
// Legacy-DB compatibility: falls back to 'brain_v2_candidate' if the pre-T1402 name is still live.
|
|
214
|
-
let pendingCandidates = 0;
|
|
215
|
-
try {
|
|
216
|
-
const { getBrainNativeDb: _getDoctorNativeDb } = await import('@cleocode/core/store/memory-sqlite.js');
|
|
217
|
-
const doctorNativeDb = _getDoctorNativeDb();
|
|
218
|
-
if (doctorNativeDb) {
|
|
219
|
-
// Resolve staging-table name: prefer canonical, fall back to legacy.
|
|
220
|
-
const stagingTableRow = doctorNativeDb
|
|
221
|
-
.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name IN ('brain_observations_staging', 'brain_v2_candidate') ORDER BY CASE name WHEN 'brain_observations_staging' THEN 0 ELSE 1 END LIMIT 1`)
|
|
222
|
-
.get();
|
|
223
|
-
if (stagingTableRow?.name) {
|
|
224
|
-
const countRow = doctorNativeDb
|
|
225
|
-
.prepare(`SELECT COUNT(*) AS cnt FROM ${stagingTableRow.name} WHERE validation_status = 'pending'`)
|
|
226
|
-
.get();
|
|
227
|
-
pendingCandidates = countRow?.cnt ?? 0;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
catch {
|
|
232
|
-
/* non-fatal */
|
|
233
|
-
}
|
|
234
|
-
if (!result.isClean) {
|
|
235
|
-
return errorResult('query', 'memory', operation, 'E_BRAIN_NOISE_DETECTED', `Brain noise detected: ${result.findings.length} pattern(s) across ${result.totalScanned} entries. ` +
|
|
236
|
-
result.findings.map((f) => `${f.pattern}(${f.count})`).join(', ') +
|
|
237
|
-
'. Run `cleo memory doctor` for details. Fix noise before enabling Sentient v1 (M7 gate).', startTime);
|
|
238
|
-
}
|
|
239
|
-
if (pendingCandidates > 0) {
|
|
240
|
-
return errorResult('query', 'memory', operation, 'E_SWEEP_PENDING', `Staged sweep has ${pendingCandidates} pending brain_observations_staging rows. ` +
|
|
241
|
-
'Run `cleo memory sweep --status` to review, then `cleo memory sweep --approve <runId>` to apply.', startTime);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
else if (!result.isClean) {
|
|
245
|
-
// Non-assert mode: still surface noise findings without failing.
|
|
246
|
-
}
|
|
247
|
-
return wrapResult({ success: true, data: { ...result, pendingCandidates: 0 } }, 'query', 'memory', operation, startTime);
|
|
248
|
-
}
|
|
249
|
-
// T1147 W7 — BRAIN noise sweep (shadow-write envelope, self-healing gate)
|
|
250
|
-
case 'sweep': {
|
|
251
|
-
const dryRun = params?.['dry-run'] === true || params?.dryRun === true;
|
|
252
|
-
const approveRunId = paramString(params, 'approve');
|
|
253
|
-
const statusQuery = params?.status === true;
|
|
254
|
-
const rollbackRunId = paramString(params, 'rollback');
|
|
255
|
-
if (statusQuery) {
|
|
256
|
-
// List all noise-sweep-2440 runs in brain_backfill_runs
|
|
257
|
-
const { getBrainDb: _getBrainDb2, getBrainNativeDb: _getNativeDb2 } = await import('@cleocode/core/store/memory-sqlite.js');
|
|
258
|
-
const sweepDb = await _getBrainDb2(projectRoot);
|
|
259
|
-
const nativeDb2 = _getNativeDb2();
|
|
260
|
-
if (!nativeDb2) {
|
|
261
|
-
return errorResult('query', 'memory', operation, 'E_DB_UNAVAILABLE', 'brain.db not available', startTime);
|
|
262
|
-
}
|
|
263
|
-
const rows = nativeDb2
|
|
264
|
-
.prepare(`SELECT id, status, rows_affected, created_at, approved_at, approved_by
|
|
265
|
-
FROM brain_backfill_runs
|
|
266
|
-
WHERE kind = 'noise-sweep-2440'
|
|
267
|
-
ORDER BY created_at DESC
|
|
268
|
-
LIMIT 20`)
|
|
269
|
-
.all();
|
|
270
|
-
void sweepDb;
|
|
271
|
-
return wrapResult({ success: true, data: { runs: rows } }, 'query', 'memory', operation, startTime);
|
|
272
|
-
}
|
|
273
|
-
if (approveRunId) {
|
|
274
|
-
// Apply sweep
|
|
275
|
-
const { executeSweep } = await import('@cleocode/core/memory/brain-sweep-executor.js');
|
|
276
|
-
const result = await executeSweep({
|
|
277
|
-
projectRoot,
|
|
278
|
-
runId: approveRunId,
|
|
279
|
-
approvedBy: 'cleo-cli',
|
|
280
|
-
});
|
|
281
|
-
if (!result.success) {
|
|
282
|
-
return errorResult('mutate', 'memory', operation, 'E_SWEEP_FAILED', result.errorMessage ?? 'Sweep failed', startTime);
|
|
283
|
-
}
|
|
284
|
-
return wrapResult({ success: true, data: result }, 'mutate', 'memory', operation, startTime);
|
|
285
|
-
}
|
|
286
|
-
if (rollbackRunId) {
|
|
287
|
-
const { rollbackSweep } = await import('@cleocode/core/memory/brain-sweep-executor.js');
|
|
288
|
-
const rolled = await rollbackSweep(projectRoot, rollbackRunId);
|
|
289
|
-
if (!rolled) {
|
|
290
|
-
return errorResult('mutate', 'memory', operation, 'E_SWEEP_ROLLBACK_FAILED', `Run '${rollbackRunId}' not found or not in staged status`, startTime);
|
|
291
|
-
}
|
|
292
|
-
return wrapResult({ success: true, data: { rolledBack: rollbackRunId } }, 'mutate', 'memory', operation, startTime);
|
|
293
|
-
}
|
|
294
|
-
// Default: dry-run or full detect
|
|
295
|
-
const { detectNoiseCandidates } = await import('@cleocode/core/memory/brain-noise-detector.js');
|
|
296
|
-
const detectResult = await detectNoiseCandidates(projectRoot, { dryRun });
|
|
297
|
-
return wrapResult({ success: true, data: detectResult }, dryRun ? 'query' : 'mutate', 'memory', operation, startTime);
|
|
298
|
-
}
|
|
299
|
-
// T791 — LLM extraction backend status
|
|
300
|
-
case 'llm-status': {
|
|
301
|
-
const resolvedSource = resolveAnthropicApiKeySource();
|
|
302
|
-
const extractionEnabled = resolveAnthropicApiKey() !== null;
|
|
303
|
-
// Query brain.db for the most recent extraction event
|
|
304
|
-
let lastExtractionRun = null;
|
|
305
|
-
try {
|
|
306
|
-
await getBrainDb(projectRoot);
|
|
307
|
-
const nativeDb = getBrainNativeDb();
|
|
308
|
-
if (nativeDb) {
|
|
309
|
-
const row = nativeDb
|
|
310
|
-
.prepare(`SELECT created_at FROM brain_observations
|
|
311
|
-
WHERE source_type IN ('observer', 'reflector', 'transcript')
|
|
312
|
-
ORDER BY created_at DESC LIMIT 1`)
|
|
313
|
-
.get();
|
|
314
|
-
if (row?.created_at) {
|
|
315
|
-
lastExtractionRun = row.created_at.replace(' ', 'T');
|
|
316
|
-
if (!lastExtractionRun.includes('Z'))
|
|
317
|
-
lastExtractionRun += 'Z';
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
catch {
|
|
322
|
-
// brain.db unavailable — non-fatal
|
|
323
|
-
}
|
|
324
|
-
return wrapResult({
|
|
325
|
-
success: true,
|
|
326
|
-
data: {
|
|
327
|
-
resolvedSource,
|
|
328
|
-
extractionEnabled,
|
|
329
|
-
lastExtractionRun,
|
|
330
|
-
testCommand: 'cleo memory reflect --json',
|
|
331
|
-
},
|
|
332
|
-
}, 'query', 'memory', operation, startTime);
|
|
333
|
-
}
|
|
334
|
-
// T792 — surface unverified-but-highly-cited entries as verification queue
|
|
335
|
-
case 'pending-verify': {
|
|
336
|
-
const minCitations = paramNumber(params, 'minCitations') ?? 5;
|
|
337
|
-
const limitVal = paramNumber(params, 'limit') ?? 50;
|
|
338
|
-
try {
|
|
339
|
-
await getBrainDb(projectRoot);
|
|
340
|
-
const nativeDb = getBrainNativeDb();
|
|
341
|
-
if (!nativeDb) {
|
|
342
|
-
return errorResult('query', 'memory', operation, 'E_DB_UNAVAILABLE', 'brain.db is unavailable', startTime);
|
|
343
|
-
}
|
|
344
|
-
const tables = [
|
|
345
|
-
{ name: 'brain_observations', labelCol: 'title' },
|
|
346
|
-
{ name: 'brain_decisions', labelCol: 'decision' },
|
|
347
|
-
{ name: 'brain_patterns', labelCol: 'pattern' },
|
|
348
|
-
{ name: 'brain_learnings', labelCol: 'insight' },
|
|
349
|
-
];
|
|
350
|
-
const allPending = [];
|
|
351
|
-
for (const t of tables) {
|
|
352
|
-
try {
|
|
353
|
-
const rawRows = nativeDb
|
|
354
|
-
.prepare(`SELECT id,
|
|
355
|
-
COALESCE(${t.labelCol}, id) AS title,
|
|
356
|
-
source_confidence,
|
|
357
|
-
citation_count,
|
|
358
|
-
memory_tier,
|
|
359
|
-
created_at
|
|
360
|
-
FROM ${t.name}
|
|
361
|
-
WHERE verified = 0
|
|
362
|
-
AND citation_count >= ?
|
|
363
|
-
AND invalid_at IS NULL
|
|
364
|
-
ORDER BY citation_count DESC
|
|
365
|
-
LIMIT ?`)
|
|
366
|
-
.all(minCitations, limitVal);
|
|
367
|
-
const rows = rawRows.map((raw) => {
|
|
368
|
-
const r = raw;
|
|
369
|
-
return {
|
|
370
|
-
id: String(r['id'] ?? ''),
|
|
371
|
-
title: r['title'] != null ? String(r['title']) : null,
|
|
372
|
-
source_confidence: r['source_confidence'] != null ? String(r['source_confidence']) : null,
|
|
373
|
-
citation_count: Number(r['citation_count'] ?? 0),
|
|
374
|
-
memory_tier: r['memory_tier'] != null ? String(r['memory_tier']) : null,
|
|
375
|
-
created_at: String(r['created_at'] ?? ''),
|
|
376
|
-
};
|
|
377
|
-
});
|
|
378
|
-
for (const row of rows) {
|
|
379
|
-
allPending.push({ ...row, table: t.name.replace('brain_', '') });
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
catch {
|
|
383
|
-
// Table may not have the column — skip
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
// Sort globally by citation_count DESC and apply overall limit
|
|
387
|
-
allPending.sort((a, b) => b.citation_count - a.citation_count);
|
|
388
|
-
const items = allPending.slice(0, limitVal);
|
|
389
|
-
return wrapResult({
|
|
390
|
-
success: true,
|
|
391
|
-
data: {
|
|
392
|
-
count: items.length,
|
|
393
|
-
minCitations,
|
|
394
|
-
items,
|
|
395
|
-
hint: `Run 'cleo memory verify <id>' to promote an entry to verified=true`,
|
|
396
|
-
},
|
|
397
|
-
}, 'query', 'memory', operation, startTime);
|
|
398
|
-
}
|
|
399
|
-
catch (dbErr) {
|
|
400
|
-
return handleErrorResult('query', 'memory', operation, dbErr, startTime);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
// T1006 — summarized top-N observations as session briefing digest
|
|
404
|
-
case 'digest': {
|
|
405
|
-
const limitVal = paramNumber(params, 'limit') ?? 10;
|
|
406
|
-
try {
|
|
407
|
-
await getBrainDb(projectRoot);
|
|
408
|
-
const nativeDb = getBrainNativeDb();
|
|
409
|
-
if (!nativeDb) {
|
|
410
|
-
return errorResult('query', 'memory', operation, 'E_DB_UNAVAILABLE', 'brain.db is unavailable', startTime);
|
|
411
|
-
}
|
|
412
|
-
let rows = [];
|
|
413
|
-
try {
|
|
414
|
-
const rawRows = nativeDb
|
|
415
|
-
.prepare(`SELECT id,
|
|
416
|
-
title,
|
|
417
|
-
text,
|
|
418
|
-
citation_count,
|
|
419
|
-
quality_score,
|
|
420
|
-
memory_tier,
|
|
421
|
-
created_at
|
|
422
|
-
FROM brain_observations
|
|
423
|
-
WHERE invalid_at IS NULL
|
|
424
|
-
ORDER BY citation_count DESC, quality_score DESC
|
|
425
|
-
LIMIT ?`)
|
|
426
|
-
.all(limitVal);
|
|
427
|
-
rows = rawRows.map((raw) => {
|
|
428
|
-
const r = raw;
|
|
429
|
-
return {
|
|
430
|
-
id: String(r['id'] ?? ''),
|
|
431
|
-
title: r['title'] != null ? String(r['title']) : null,
|
|
432
|
-
text: String(r['text'] ?? ''),
|
|
433
|
-
citation_count: Number(r['citation_count'] ?? 0),
|
|
434
|
-
quality_score: r['quality_score'] != null ? Number(r['quality_score']) : null,
|
|
435
|
-
memory_tier: r['memory_tier'] != null ? String(r['memory_tier']) : null,
|
|
436
|
-
created_at: String(r['created_at'] ?? ''),
|
|
437
|
-
};
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
catch {
|
|
441
|
-
// brain_observations may not exist yet — return empty digest
|
|
442
|
-
}
|
|
443
|
-
// Build a brief text summary from the top entries
|
|
444
|
-
const summaryLines = rows.map((r, i) => {
|
|
445
|
-
const label = r.title ?? r.id;
|
|
446
|
-
const snippet = r.text.slice(0, 80).replace(/\n/g, ' ');
|
|
447
|
-
return `${i + 1}. [${r.id}] ${label} — ${snippet}${r.text.length > 80 ? '…' : ''}`;
|
|
448
|
-
});
|
|
449
|
-
return wrapResult({
|
|
450
|
-
success: true,
|
|
451
|
-
data: {
|
|
452
|
-
count: rows.length,
|
|
453
|
-
limit: limitVal,
|
|
454
|
-
summary: summaryLines.join('\n'),
|
|
455
|
-
observations: rows,
|
|
456
|
-
},
|
|
457
|
-
}, 'query', 'memory', operation, startTime);
|
|
458
|
-
}
|
|
459
|
-
catch (dbErr) {
|
|
460
|
-
return handleErrorResult('query', 'memory', operation, dbErr, startTime);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
// T1006 — tail recent observations with optional filters
|
|
464
|
-
case 'recent': {
|
|
465
|
-
const limitVal = paramNumber(params, 'limit') ?? 20;
|
|
466
|
-
const sinceParam = paramString(params, 'since');
|
|
467
|
-
const typeFilter = paramString(params, 'type');
|
|
468
|
-
const sessionFilter = paramString(params, 'session');
|
|
469
|
-
const tierFilter = paramString(params, 'tier');
|
|
470
|
-
try {
|
|
471
|
-
await getBrainDb(projectRoot);
|
|
472
|
-
const nativeDb = getBrainNativeDb();
|
|
473
|
-
if (!nativeDb) {
|
|
474
|
-
return errorResult('query', 'memory', operation, 'E_DB_UNAVAILABLE', 'brain.db is unavailable', startTime);
|
|
475
|
-
}
|
|
476
|
-
// Parse `since` as an ISO duration (e.g. "24h", "7d", "30m") or ISO timestamp
|
|
477
|
-
let sinceIso;
|
|
478
|
-
if (sinceParam) {
|
|
479
|
-
const durationMatch = /^(\d+)(m|h|d|w)$/i.exec(sinceParam);
|
|
480
|
-
if (durationMatch) {
|
|
481
|
-
const amount = Number(durationMatch[1]);
|
|
482
|
-
const unit = durationMatch[2].toLowerCase();
|
|
483
|
-
const ms = unit === 'm'
|
|
484
|
-
? amount * 60_000
|
|
485
|
-
: unit === 'h'
|
|
486
|
-
? amount * 3_600_000
|
|
487
|
-
: unit === 'd'
|
|
488
|
-
? amount * 86_400_000
|
|
489
|
-
: amount * 7 * 86_400_000;
|
|
490
|
-
sinceIso = new Date(Date.now() - ms).toISOString().replace('T', ' ').slice(0, 19);
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
// Assume it's an ISO timestamp or SQLite datetime string
|
|
494
|
-
sinceIso = sinceParam;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
const clauses = ['invalid_at IS NULL'];
|
|
498
|
-
const bindArgs = [];
|
|
499
|
-
if (sinceIso) {
|
|
500
|
-
clauses.push('created_at >= ?');
|
|
501
|
-
bindArgs.push(sinceIso);
|
|
502
|
-
}
|
|
503
|
-
if (typeFilter) {
|
|
504
|
-
clauses.push('type = ?');
|
|
505
|
-
bindArgs.push(typeFilter);
|
|
506
|
-
}
|
|
507
|
-
if (sessionFilter) {
|
|
508
|
-
clauses.push('source_session_id = ?');
|
|
509
|
-
bindArgs.push(sessionFilter);
|
|
510
|
-
}
|
|
511
|
-
if (tierFilter) {
|
|
512
|
-
clauses.push('memory_tier = ?');
|
|
513
|
-
bindArgs.push(tierFilter);
|
|
514
|
-
}
|
|
515
|
-
bindArgs.push(limitVal);
|
|
516
|
-
const whereClause = clauses.join(' AND ');
|
|
517
|
-
let rows = [];
|
|
518
|
-
try {
|
|
519
|
-
const rawRows = nativeDb
|
|
520
|
-
.prepare(`SELECT id, title, text, type, source_session_id, memory_tier, created_at
|
|
521
|
-
FROM brain_observations
|
|
522
|
-
WHERE ${whereClause}
|
|
523
|
-
ORDER BY created_at DESC
|
|
524
|
-
LIMIT ?`)
|
|
525
|
-
.all(...bindArgs);
|
|
526
|
-
rows = rawRows.map((raw) => {
|
|
527
|
-
const r = raw;
|
|
528
|
-
return {
|
|
529
|
-
id: String(r['id'] ?? ''),
|
|
530
|
-
title: r['title'] != null ? String(r['title']) : null,
|
|
531
|
-
text: String(r['text'] ?? ''),
|
|
532
|
-
type: r['type'] != null ? String(r['type']) : null,
|
|
533
|
-
source_session_id: r['source_session_id'] != null ? String(r['source_session_id']) : null,
|
|
534
|
-
memory_tier: r['memory_tier'] != null ? String(r['memory_tier']) : null,
|
|
535
|
-
created_at: String(r['created_at'] ?? ''),
|
|
536
|
-
};
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
catch {
|
|
540
|
-
// brain_observations may not have all columns — return empty
|
|
541
|
-
}
|
|
542
|
-
return wrapResult({
|
|
543
|
-
success: true,
|
|
544
|
-
data: {
|
|
545
|
-
count: rows.length,
|
|
546
|
-
limit: limitVal,
|
|
547
|
-
since: sinceIso ?? null,
|
|
548
|
-
observations: rows,
|
|
549
|
-
},
|
|
550
|
-
}, 'query', 'memory', operation, startTime);
|
|
551
|
-
}
|
|
552
|
-
catch (dbErr) {
|
|
553
|
-
return handleErrorResult('query', 'memory', operation, dbErr, startTime);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
// T1006 — read diary-typed observations
|
|
557
|
-
case 'diary': {
|
|
558
|
-
const limitVal = paramNumber(params, 'limit') ?? 20;
|
|
559
|
-
try {
|
|
560
|
-
await getBrainDb(projectRoot);
|
|
561
|
-
const nativeDb = getBrainNativeDb();
|
|
562
|
-
if (!nativeDb) {
|
|
563
|
-
return errorResult('query', 'memory', operation, 'E_DB_UNAVAILABLE', 'brain.db is unavailable', startTime);
|
|
564
|
-
}
|
|
565
|
-
let rows = [];
|
|
566
|
-
try {
|
|
567
|
-
const rawRows = nativeDb
|
|
568
|
-
.prepare(`SELECT id, title, text, source_session_id, memory_tier, created_at
|
|
569
|
-
FROM brain_observations
|
|
570
|
-
WHERE type = 'diary'
|
|
571
|
-
AND invalid_at IS NULL
|
|
572
|
-
ORDER BY created_at DESC
|
|
573
|
-
LIMIT ?`)
|
|
574
|
-
.all(limitVal);
|
|
575
|
-
rows = rawRows.map((raw) => {
|
|
576
|
-
const r = raw;
|
|
577
|
-
return {
|
|
578
|
-
id: String(r['id'] ?? ''),
|
|
579
|
-
title: r['title'] != null ? String(r['title']) : null,
|
|
580
|
-
text: String(r['text'] ?? ''),
|
|
581
|
-
source_session_id: r['source_session_id'] != null ? String(r['source_session_id']) : null,
|
|
582
|
-
memory_tier: r['memory_tier'] != null ? String(r['memory_tier']) : null,
|
|
583
|
-
created_at: String(r['created_at'] ?? ''),
|
|
584
|
-
};
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
catch {
|
|
588
|
-
// brain_observations may not have type column — return empty
|
|
589
|
-
}
|
|
590
|
-
return wrapResult({
|
|
591
|
-
success: true,
|
|
592
|
-
data: {
|
|
593
|
-
count: rows.length,
|
|
594
|
-
limit: limitVal,
|
|
595
|
-
type: 'diary',
|
|
596
|
-
entries: rows,
|
|
597
|
-
},
|
|
598
|
-
}, 'query', 'memory', operation, startTime);
|
|
599
|
-
}
|
|
600
|
-
catch (dbErr) {
|
|
601
|
-
return handleErrorResult('query', 'memory', operation, dbErr, startTime);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
// T1006 — long-poll stream of recent brain writes (SSE-style polling stub)
|
|
605
|
-
// Returns the latest N observations created after an optional cursor.
|
|
606
|
-
// Clients call this in a loop, advancing the cursor with the returned `nextCursor`.
|
|
607
|
-
case 'watch': {
|
|
608
|
-
const cursorParam = paramString(params, 'cursor');
|
|
609
|
-
const limitVal = paramNumber(params, 'limit') ?? 10;
|
|
610
|
-
try {
|
|
611
|
-
await getBrainDb(projectRoot);
|
|
612
|
-
const nativeDb = getBrainNativeDb();
|
|
613
|
-
if (!nativeDb) {
|
|
614
|
-
return errorResult('query', 'memory', operation, 'E_DB_UNAVAILABLE', 'brain.db is unavailable', startTime);
|
|
615
|
-
}
|
|
616
|
-
const clauses = ['invalid_at IS NULL'];
|
|
617
|
-
const bindArgs = [];
|
|
618
|
-
if (cursorParam) {
|
|
619
|
-
clauses.push('created_at > ?');
|
|
620
|
-
bindArgs.push(cursorParam);
|
|
621
|
-
}
|
|
622
|
-
bindArgs.push(limitVal);
|
|
623
|
-
let rows = [];
|
|
624
|
-
try {
|
|
625
|
-
const rawRows = nativeDb
|
|
626
|
-
.prepare(`SELECT id, title, text, type, memory_tier, created_at
|
|
627
|
-
FROM brain_observations
|
|
628
|
-
WHERE ${clauses.join(' AND ')}
|
|
629
|
-
ORDER BY created_at ASC
|
|
630
|
-
LIMIT ?`)
|
|
631
|
-
.all(...bindArgs);
|
|
632
|
-
rows = rawRows.map((raw) => {
|
|
633
|
-
const r = raw;
|
|
634
|
-
return {
|
|
635
|
-
id: String(r['id'] ?? ''),
|
|
636
|
-
title: r['title'] != null ? String(r['title']) : null,
|
|
637
|
-
text: String(r['text'] ?? ''),
|
|
638
|
-
type: r['type'] != null ? String(r['type']) : null,
|
|
639
|
-
memory_tier: r['memory_tier'] != null ? String(r['memory_tier']) : null,
|
|
640
|
-
created_at: String(r['created_at'] ?? ''),
|
|
641
|
-
};
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
catch {
|
|
645
|
-
// brain_observations may not exist yet
|
|
646
|
-
}
|
|
647
|
-
const nextCursor = rows.length > 0 ? rows[rows.length - 1].created_at : (cursorParam ?? null);
|
|
648
|
-
return wrapResult({
|
|
649
|
-
success: true,
|
|
650
|
-
data: {
|
|
651
|
-
count: rows.length,
|
|
652
|
-
cursor: cursorParam ?? null,
|
|
653
|
-
nextCursor,
|
|
654
|
-
events: rows,
|
|
655
|
-
hint: 'Poll again with cursor=nextCursor to stream new writes',
|
|
656
|
-
},
|
|
657
|
-
}, 'query', 'memory', operation, startTime);
|
|
658
|
-
}
|
|
659
|
-
catch (dbErr) {
|
|
660
|
-
return handleErrorResult('query', 'memory', operation, dbErr, startTime);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
// T1003 — list staged backfill runs (pending/approved/rolled-back)
|
|
664
|
-
case 'backfill.list': {
|
|
665
|
-
try {
|
|
666
|
-
const status = paramString(params, 'status');
|
|
667
|
-
const limit = paramNumber(params, 'limit');
|
|
668
|
-
const runs = await listBackfillRuns(projectRoot, { status, limit });
|
|
669
|
-
return wrapResult({
|
|
670
|
-
success: true,
|
|
671
|
-
data: {
|
|
672
|
-
count: runs.length,
|
|
673
|
-
runs,
|
|
674
|
-
hint: `Use 'cleo memory backfill.approve <runId>' or 'cleo memory backfill.rollback <runId>'`,
|
|
675
|
-
},
|
|
676
|
-
}, 'query', 'memory', operation, startTime);
|
|
677
|
-
}
|
|
678
|
-
catch (listErr) {
|
|
679
|
-
return handleErrorResult('query', 'memory', operation, listErr, startTime);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
// T999 — stream brain.db memory-bridge content directly (cli mode default)
|
|
683
|
-
case 'bridge': {
|
|
684
|
-
const content = await generateMemoryBridgeContent(projectRoot);
|
|
685
|
-
return wrapResult({ success: true, data: { content } }, 'query', 'memory', operation, startTime);
|
|
686
|
-
}
|
|
687
|
-
// T997 — read-only view over STDP weights + retrieval log + citation data
|
|
688
|
-
case 'promote-explain': {
|
|
689
|
-
const entryId = paramStringRequired(params, 'id');
|
|
690
|
-
if (!entryId) {
|
|
691
|
-
return errorResult('query', 'memory', operation, 'E_INVALID_INPUT', 'id is required', startTime);
|
|
692
|
-
}
|
|
693
|
-
try {
|
|
694
|
-
await getBrainDb(projectRoot);
|
|
695
|
-
const nativeDb = getBrainNativeDb();
|
|
696
|
-
if (!nativeDb) {
|
|
697
|
-
return errorResult('query', 'memory', operation, 'E_DB_UNAVAILABLE', 'brain.db is unavailable', startTime);
|
|
698
|
-
}
|
|
699
|
-
// 1. Locate entry in typed tables
|
|
700
|
-
const typedTables = [
|
|
701
|
-
{ name: 'brain_observations', labelCol: 'title' },
|
|
702
|
-
{ name: 'brain_decisions', labelCol: 'decision' },
|
|
703
|
-
{ name: 'brain_patterns', labelCol: 'pattern' },
|
|
704
|
-
{ name: 'brain_learnings', labelCol: 'insight' },
|
|
705
|
-
];
|
|
706
|
-
let foundTable = '';
|
|
707
|
-
let typedRow;
|
|
708
|
-
for (const t of typedTables) {
|
|
709
|
-
try {
|
|
710
|
-
const row = nativeDb
|
|
711
|
-
.prepare(`SELECT id, citation_count, quality_score, memory_tier, tier_promoted_at, verified
|
|
712
|
-
FROM ${t.name}
|
|
713
|
-
WHERE id = ? AND invalid_at IS NULL
|
|
714
|
-
LIMIT 1`)
|
|
715
|
-
.get(entryId);
|
|
716
|
-
if (row) {
|
|
717
|
-
typedRow = row;
|
|
718
|
-
foundTable = t.name.replace('brain_', '');
|
|
719
|
-
break;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
catch {
|
|
723
|
-
// Table may not have all columns yet — try next
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
if (!typedRow) {
|
|
727
|
-
return errorResult('query', 'memory', operation, 'E_NOT_FOUND', `Entry '${entryId}' not found in any brain table (or is invalidated)`, startTime);
|
|
728
|
-
}
|
|
729
|
-
// 2. Query prune_candidate (column may not exist on older DBs)
|
|
730
|
-
let pruneCandidate = false;
|
|
731
|
-
try {
|
|
732
|
-
const pruneRow = nativeDb
|
|
733
|
-
.prepare(`SELECT prune_candidate FROM brain_${foundTable} WHERE id = ? LIMIT 1`)
|
|
734
|
-
.get(entryId);
|
|
735
|
-
pruneCandidate = (pruneRow?.prune_candidate ?? 0) === 1;
|
|
736
|
-
}
|
|
737
|
-
catch {
|
|
738
|
-
// prune_candidate column not yet present — degrade gracefully
|
|
739
|
-
}
|
|
740
|
-
let stdpWeights = [];
|
|
741
|
-
try {
|
|
742
|
-
// T1434: use centralized `typedAll<T>` helper (packages/core
|
|
743
|
-
// store/typed-query.ts) so the `unknown` step required by
|
|
744
|
-
// node:sqlite's untyped `.all()` return is captured in one
|
|
745
|
-
// place rather than scattered across dispatch code.
|
|
746
|
-
const stmt = nativeDb.prepare(`SELECT from_id, to_id, edge_type, weight,
|
|
747
|
-
COALESCE(reinforcement_count, 0) AS reinforcement_count,
|
|
748
|
-
last_reinforced_at
|
|
749
|
-
FROM brain_page_edges
|
|
750
|
-
WHERE (from_id = ? OR to_id = ?)
|
|
751
|
-
AND plasticity_class IN ('hebbian', 'stdp')
|
|
752
|
-
ORDER BY weight DESC
|
|
753
|
-
LIMIT 20`);
|
|
754
|
-
stdpWeights = typedAll(stmt, entryId, entryId);
|
|
755
|
-
}
|
|
756
|
-
catch {
|
|
757
|
-
// plasticity_class column may not exist — fall back to unfiltered weight query
|
|
758
|
-
try {
|
|
759
|
-
const stmt = nativeDb.prepare(`SELECT from_id, to_id, edge_type, weight,
|
|
760
|
-
COALESCE(reinforcement_count, 0) AS reinforcement_count,
|
|
761
|
-
last_reinforced_at
|
|
762
|
-
FROM brain_page_edges
|
|
763
|
-
WHERE from_id = ? OR to_id = ?
|
|
764
|
-
ORDER BY weight DESC
|
|
765
|
-
LIMIT 20`);
|
|
766
|
-
stdpWeights = typedAll(stmt, entryId, entryId);
|
|
767
|
-
}
|
|
768
|
-
catch {
|
|
769
|
-
// brain_page_edges unavailable — degrade gracefully
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
// 4. Query brain_retrieval_log for retrieval count and last access
|
|
773
|
-
let retrievalCount = 0;
|
|
774
|
-
let lastAccessedAt = null;
|
|
775
|
-
try {
|
|
776
|
-
const logRow = nativeDb
|
|
777
|
-
.prepare(`SELECT COUNT(*) AS retrieval_count,
|
|
778
|
-
MAX(created_at) AS last_accessed_at
|
|
779
|
-
FROM brain_retrieval_log
|
|
780
|
-
WHERE entry_ids LIKE ?`)
|
|
781
|
-
.get(`%${entryId}%`);
|
|
782
|
-
retrievalCount = logRow?.retrieval_count ?? 0;
|
|
783
|
-
lastAccessedAt = logRow?.last_accessed_at ?? null;
|
|
784
|
-
if (lastAccessedAt && !lastAccessedAt.includes('T')) {
|
|
785
|
-
lastAccessedAt = lastAccessedAt.replace(' ', 'T');
|
|
786
|
-
if (!lastAccessedAt.endsWith('Z'))
|
|
787
|
-
lastAccessedAt += 'Z';
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
catch {
|
|
791
|
-
// retrieval log unavailable — degrade gracefully
|
|
792
|
-
}
|
|
793
|
-
// 5. Determine promotion tier and explanation
|
|
794
|
-
const citationCount = typedRow.citation_count ?? 0;
|
|
795
|
-
const qualityScore = typedRow.quality_score ?? null;
|
|
796
|
-
const memoryTier = typedRow.memory_tier ?? null;
|
|
797
|
-
const promotedAt = typedRow.tier_promoted_at ?? null;
|
|
798
|
-
const verified = typedRow.verified === 1;
|
|
799
|
-
const stdpWeightMax = stdpWeights.length > 0 ? Math.max(...stdpWeights.map((e) => e.weight)) : 0;
|
|
800
|
-
let tier;
|
|
801
|
-
let explanation;
|
|
802
|
-
if (pruneCandidate) {
|
|
803
|
-
tier = 'rejected';
|
|
804
|
-
explanation =
|
|
805
|
-
`Entry flagged as prune candidate. ` +
|
|
806
|
-
`quality_score=${qualityScore ?? 'null'}, citation_count=${citationCount}, ` +
|
|
807
|
-
`retrieval_count=${retrievalCount}. ` +
|
|
808
|
-
`Meets pruning criteria: low quality and/or zero citations over time.`;
|
|
809
|
-
}
|
|
810
|
-
else if (memoryTier === 'long' ||
|
|
811
|
-
memoryTier === 'medium' ||
|
|
812
|
-
verified ||
|
|
813
|
-
promotedAt !== null) {
|
|
814
|
-
tier = 'promoted';
|
|
815
|
-
explanation =
|
|
816
|
-
`Entry promoted to memory tier '${memoryTier ?? 'promoted'}'. ` +
|
|
817
|
-
`citation_count=${citationCount}, retrieval_count=${retrievalCount}, ` +
|
|
818
|
-
`stdp_weight_max=${stdpWeightMax.toFixed(3)}, verified=${verified}. ` +
|
|
819
|
-
(promotedAt ? `Tier promotion recorded at ${promotedAt}.` : 'Verified by owner.');
|
|
820
|
-
}
|
|
821
|
-
else {
|
|
822
|
-
tier = 'pending';
|
|
823
|
-
explanation =
|
|
824
|
-
`Entry has not yet been promoted or flagged for pruning. ` +
|
|
825
|
-
`memory_tier='${memoryTier ?? 'short'}', citation_count=${citationCount}, ` +
|
|
826
|
-
`retrieval_count=${retrievalCount}, stdp_weight_max=${stdpWeightMax.toFixed(3)}. ` +
|
|
827
|
-
`Increase retrieval frequency or citation count to qualify for promotion.`;
|
|
828
|
-
}
|
|
829
|
-
const scoreBreakdown = {
|
|
830
|
-
stdpWeightMax,
|
|
831
|
-
retrievalCount,
|
|
832
|
-
lastAccessedAt,
|
|
833
|
-
citationCount,
|
|
834
|
-
qualityScore,
|
|
835
|
-
pruneCandidate,
|
|
836
|
-
verified,
|
|
837
|
-
};
|
|
838
|
-
const weights = stdpWeights.map((e) => ({
|
|
839
|
-
fromId: e.from_id,
|
|
840
|
-
toId: e.to_id,
|
|
841
|
-
edgeType: e.edge_type,
|
|
842
|
-
weight: e.weight,
|
|
843
|
-
reinforcementCount: e.reinforcement_count,
|
|
844
|
-
lastReinforcedAt: e.last_reinforced_at,
|
|
845
|
-
}));
|
|
846
|
-
return wrapResult({
|
|
847
|
-
success: true,
|
|
848
|
-
data: {
|
|
849
|
-
id: entryId,
|
|
850
|
-
table: foundTable,
|
|
851
|
-
tier,
|
|
852
|
-
explanation,
|
|
853
|
-
promotedAt: promotedAt ?? null,
|
|
854
|
-
stdpWeights: weights,
|
|
855
|
-
scoreBreakdown,
|
|
856
|
-
},
|
|
857
|
-
}, 'query', 'memory', operation, startTime);
|
|
858
|
-
}
|
|
859
|
-
catch (dbErr) {
|
|
860
|
-
return handleErrorResult('query', 'memory', operation, dbErr, startTime);
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
default:
|
|
864
|
-
return unsupportedOp('query', 'memory', operation, startTime);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
catch (error) {
|
|
868
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
869
|
-
getLogger('domain:memory').error({ gateway: 'query', domain: 'memory', operation, err: error }, message);
|
|
870
|
-
return handleErrorResult('query', 'memory', operation, error, startTime);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
// -----------------------------------------------------------------------
|
|
874
|
-
// Mutate
|
|
875
|
-
// -----------------------------------------------------------------------
|
|
876
|
-
async mutate(operation, params) {
|
|
877
|
-
const projectRoot = getProjectRoot();
|
|
878
|
-
const startTime = Date.now();
|
|
879
|
-
try {
|
|
880
|
-
switch (operation) {
|
|
881
|
-
case 'observe': {
|
|
882
|
-
const text = paramStringRequired(params, 'text');
|
|
883
|
-
if (!text) {
|
|
884
|
-
return errorResult('mutate', 'memory', operation, 'E_INVALID_INPUT', 'text is required', startTime);
|
|
885
|
-
}
|
|
886
|
-
// T799: parse optional attachment refs (comma-separated sha256 list or JSON array)
|
|
887
|
-
let attachmentRefs;
|
|
888
|
-
const attachArr = paramStringArray(params, 'attach');
|
|
889
|
-
const attachStr = paramString(params, 'attach');
|
|
890
|
-
if (attachArr !== undefined) {
|
|
891
|
-
attachmentRefs = attachArr.filter((r) => r.length > 0);
|
|
892
|
-
}
|
|
893
|
-
else if (attachStr?.trim()) {
|
|
894
|
-
attachmentRefs = attachStr
|
|
895
|
-
.split(',')
|
|
896
|
-
.map((r) => r.trim())
|
|
897
|
-
.filter(Boolean);
|
|
898
|
-
}
|
|
899
|
-
const result = await memoryObserve({
|
|
900
|
-
text,
|
|
901
|
-
title: paramString(params, 'title'),
|
|
902
|
-
type: paramString(params, 'type'),
|
|
903
|
-
project: paramString(params, 'project'),
|
|
904
|
-
sourceSessionId: paramString(params, 'sourceSessionId'),
|
|
905
|
-
sourceType: paramString(params, 'sourceType'),
|
|
906
|
-
// T417: optional agent provenance for mental model observations
|
|
907
|
-
agent: paramString(params, 'agent'),
|
|
908
|
-
// T799: optional attachment refs
|
|
909
|
-
attachmentRefs,
|
|
910
|
-
}, projectRoot);
|
|
911
|
-
return wrapResult(result, 'mutate', 'memory', operation, startTime);
|
|
912
|
-
}
|
|
913
|
-
case 'decision.store': {
|
|
914
|
-
const decision = paramStringRequired(params, 'decision');
|
|
915
|
-
const rationale = paramStringRequired(params, 'rationale');
|
|
916
|
-
if (!decision || !rationale) {
|
|
917
|
-
return errorResult('mutate', 'memory', operation, 'E_INVALID_INPUT', 'decision and rationale are required', startTime);
|
|
918
|
-
}
|
|
919
|
-
const result = await memoryDecisionStore({
|
|
920
|
-
decision,
|
|
921
|
-
rationale,
|
|
922
|
-
alternatives: paramStringArray(params, 'alternatives'),
|
|
923
|
-
taskId: paramString(params, 'taskId'),
|
|
924
|
-
sessionId: paramString(params, 'sessionId'),
|
|
925
|
-
}, projectRoot);
|
|
926
|
-
return wrapResult(result, 'mutate', 'memory', operation, startTime);
|
|
927
|
-
}
|
|
928
|
-
case 'pattern.store': {
|
|
929
|
-
const patternText = paramStringRequired(params, 'pattern');
|
|
930
|
-
const context = paramStringRequired(params, 'context');
|
|
931
|
-
if (!patternText || !context) {
|
|
932
|
-
return errorResult('mutate', 'memory', operation, 'E_INVALID_INPUT', 'pattern and context are required', startTime);
|
|
933
|
-
}
|
|
934
|
-
const storePatternType = paramString(params, 'type');
|
|
935
|
-
const storePatternImpact = paramString(params, 'impact');
|
|
936
|
-
const result = await memoryPatternStore({
|
|
937
|
-
type: storePatternType || 'workflow',
|
|
938
|
-
pattern: patternText,
|
|
939
|
-
context,
|
|
940
|
-
impact: storePatternImpact,
|
|
941
|
-
antiPattern: paramString(params, 'antiPattern'),
|
|
942
|
-
mitigation: paramString(params, 'mitigation'),
|
|
943
|
-
examples: paramStringArray(params, 'examples'),
|
|
944
|
-
successRate: paramNumber(params, 'successRate'),
|
|
945
|
-
}, projectRoot);
|
|
946
|
-
return wrapResult(result, 'mutate', 'memory', operation, startTime);
|
|
947
|
-
}
|
|
948
|
-
case 'learning.store': {
|
|
949
|
-
const insight = paramStringRequired(params, 'insight');
|
|
950
|
-
const source = paramStringRequired(params, 'source');
|
|
951
|
-
if (!insight || !source) {
|
|
952
|
-
return errorResult('mutate', 'memory', operation, 'E_INVALID_INPUT', 'insight and source are required', startTime);
|
|
953
|
-
}
|
|
954
|
-
const result = await memoryLearningStore({
|
|
955
|
-
insight,
|
|
956
|
-
source,
|
|
957
|
-
confidence: paramNumber(params, 'confidence') ?? 0.5,
|
|
958
|
-
actionable: paramBool(params, 'actionable'),
|
|
959
|
-
application: paramString(params, 'application'),
|
|
960
|
-
applicableTypes: paramStringArray(params, 'applicableTypes'),
|
|
961
|
-
}, projectRoot);
|
|
962
|
-
return wrapResult(result, 'mutate', 'memory', operation, startTime);
|
|
963
|
-
}
|
|
964
|
-
case 'link': {
|
|
965
|
-
const taskId = paramStringRequired(params, 'taskId');
|
|
966
|
-
const entryId = paramStringRequired(params, 'entryId');
|
|
967
|
-
if (!taskId || !entryId) {
|
|
968
|
-
return errorResult('mutate', 'memory', operation, 'E_INVALID_INPUT', 'taskId and entryId are required', startTime);
|
|
969
|
-
}
|
|
970
|
-
const result = await memoryLink({ taskId, entryId }, projectRoot);
|
|
971
|
-
return wrapResult(result, 'mutate', 'memory', operation, startTime);
|
|
972
|
-
}
|
|
973
|
-
case 'graph.add': {
|
|
974
|
-
const result = await memoryGraphAdd({
|
|
975
|
-
nodeId: paramString(params, 'nodeId'),
|
|
976
|
-
nodeType: paramString(params, 'nodeType'),
|
|
977
|
-
label: paramString(params, 'label'),
|
|
978
|
-
metadataJson: paramString(params, 'metadataJson'),
|
|
979
|
-
fromId: paramString(params, 'fromId'),
|
|
980
|
-
toId: paramString(params, 'toId'),
|
|
981
|
-
edgeType: paramString(params, 'edgeType'),
|
|
982
|
-
weight: paramNumber(params, 'weight'),
|
|
983
|
-
}, projectRoot);
|
|
984
|
-
return wrapResult(result, 'mutate', 'memory', operation, startTime);
|
|
985
|
-
}
|
|
986
|
-
case 'graph.remove': {
|
|
987
|
-
const result = await memoryGraphRemove({
|
|
988
|
-
nodeId: paramString(params, 'nodeId'),
|
|
989
|
-
fromId: paramString(params, 'fromId'),
|
|
990
|
-
toId: paramString(params, 'toId'),
|
|
991
|
-
edgeType: paramString(params, 'edgeType'),
|
|
992
|
-
}, projectRoot);
|
|
993
|
-
return wrapResult(result, 'mutate', 'memory', operation, startTime);
|
|
994
|
-
}
|
|
995
|
-
case 'code.link': {
|
|
996
|
-
const memoryId = paramStringRequired(params, 'memoryId');
|
|
997
|
-
const codeSymbol = paramStringRequired(params, 'codeSymbol');
|
|
998
|
-
if (!memoryId || !codeSymbol) {
|
|
999
|
-
return errorResult('mutate', 'memory', operation, 'E_INVALID_INPUT', 'memoryId and codeSymbol are required', startTime);
|
|
1000
|
-
}
|
|
1001
|
-
const { linkMemoryToCode } = await import('@cleocode/core/internal');
|
|
1002
|
-
const linked = await linkMemoryToCode(projectRoot, memoryId, codeSymbol);
|
|
1003
|
-
return wrapResult({ success: true, data: { linked } }, 'mutate', 'memory', operation, startTime);
|
|
1004
|
-
}
|
|
1005
|
-
case 'code.auto-link': {
|
|
1006
|
-
const { autoLinkMemories } = await import('@cleocode/core/internal');
|
|
1007
|
-
const result = await autoLinkMemories(projectRoot);
|
|
1008
|
-
return wrapResult({ success: true, data: result }, 'mutate', 'memory', operation, startTime);
|
|
1009
|
-
}
|
|
1010
|
-
// T792 — promote an agent observation to verified=true (owner/cleo-prime only)
|
|
1011
|
-
case 'verify': {
|
|
1012
|
-
const entryId = paramStringRequired(params, 'id');
|
|
1013
|
-
if (!entryId) {
|
|
1014
|
-
return errorResult('mutate', 'memory', operation, 'E_INVALID_INPUT', 'id is required (the observation/decision/pattern/learning ID to verify)', startTime);
|
|
1015
|
-
}
|
|
1016
|
-
// Caller identity: no agent param = terminal invocation (owner). Agents must
|
|
1017
|
-
// pass --agent <name>; only canonical orchestrator identities and 'owner' are
|
|
1018
|
-
// permitted to promote entries to verified=true.
|
|
1019
|
-
//
|
|
1020
|
-
// Live-data migration shim (T1258 E1): 'cleo-prime' is accepted alongside
|
|
1021
|
-
// 'project-orchestrator' for backward compatibility with persisted agent
|
|
1022
|
-
// session records that pre-date the ADR-055 D032 canonical naming refactor.
|
|
1023
|
-
// New agents MUST use 'project-orchestrator'. 'cleo-prime' acceptance may be
|
|
1024
|
-
// removed in a future clean-forward pass once all persisted sessions are expired.
|
|
1025
|
-
const VERIFY_PERMITTED_IDENTITIES = new Set([
|
|
1026
|
-
'owner',
|
|
1027
|
-
'project-orchestrator',
|
|
1028
|
-
'cleo-prime', // legacy alias — see migration shim note above
|
|
1029
|
-
]);
|
|
1030
|
-
const callerAgent = paramString(params, 'agent');
|
|
1031
|
-
if (callerAgent && !VERIFY_PERMITTED_IDENTITIES.has(callerAgent)) {
|
|
1032
|
-
return errorResult('mutate', 'memory', operation, 'E_FORBIDDEN', `verify requires agent identity 'project-orchestrator' or 'owner'; got '${callerAgent}'`, startTime);
|
|
1033
|
-
}
|
|
1034
|
-
try {
|
|
1035
|
-
await getBrainDb(projectRoot);
|
|
1036
|
-
const nativeDb = getBrainNativeDb();
|
|
1037
|
-
if (!nativeDb) {
|
|
1038
|
-
return errorResult('mutate', 'memory', operation, 'E_DB_UNAVAILABLE', 'brain.db is unavailable', startTime);
|
|
1039
|
-
}
|
|
1040
|
-
const tables = [
|
|
1041
|
-
'brain_observations',
|
|
1042
|
-
'brain_decisions',
|
|
1043
|
-
'brain_patterns',
|
|
1044
|
-
'brain_learnings',
|
|
1045
|
-
];
|
|
1046
|
-
const now = new Date().toISOString().replace('T', ' ').slice(0, 19);
|
|
1047
|
-
let found = false;
|
|
1048
|
-
let foundTable = '';
|
|
1049
|
-
let alreadyVerified = false;
|
|
1050
|
-
for (const tbl of tables) {
|
|
1051
|
-
try {
|
|
1052
|
-
const row = nativeDb
|
|
1053
|
-
.prepare(`SELECT id, verified FROM ${tbl} WHERE id = ? AND invalid_at IS NULL LIMIT 1`)
|
|
1054
|
-
.get(entryId);
|
|
1055
|
-
if (row) {
|
|
1056
|
-
found = true;
|
|
1057
|
-
foundTable = tbl;
|
|
1058
|
-
alreadyVerified = row.verified === 1;
|
|
1059
|
-
if (!alreadyVerified) {
|
|
1060
|
-
nativeDb
|
|
1061
|
-
.prepare(`UPDATE ${tbl} SET verified = 1, updated_at = ? WHERE id = ?`)
|
|
1062
|
-
.run(now, entryId);
|
|
1063
|
-
}
|
|
1064
|
-
break;
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
catch {
|
|
1068
|
-
// Try next table
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
if (!found) {
|
|
1072
|
-
return errorResult('mutate', 'memory', operation, 'E_NOT_FOUND', `Entry '${entryId}' not found in any brain table (or is invalidated)`, startTime);
|
|
1073
|
-
}
|
|
1074
|
-
return wrapResult({
|
|
1075
|
-
success: true,
|
|
1076
|
-
data: {
|
|
1077
|
-
id: entryId,
|
|
1078
|
-
table: foundTable.replace('brain_', ''),
|
|
1079
|
-
verified: true,
|
|
1080
|
-
alreadyVerified,
|
|
1081
|
-
verifiedAt: alreadyVerified ? null : now,
|
|
1082
|
-
},
|
|
1083
|
-
}, 'mutate', 'memory', operation, startTime);
|
|
1084
|
-
}
|
|
1085
|
-
catch (dbErr) {
|
|
1086
|
-
return handleErrorResult('mutate', 'memory', operation, dbErr, startTime);
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
// T1006 — write a diary-typed observation (thin wrapper over observe)
|
|
1090
|
-
case 'diary.write': {
|
|
1091
|
-
const text = paramStringRequired(params, 'text');
|
|
1092
|
-
if (!text) {
|
|
1093
|
-
return errorResult('mutate', 'memory', operation, 'E_INVALID_INPUT', 'text is required', startTime);
|
|
1094
|
-
}
|
|
1095
|
-
const result = await memoryObserve({
|
|
1096
|
-
text,
|
|
1097
|
-
title: paramString(params, 'title'),
|
|
1098
|
-
type: 'diary',
|
|
1099
|
-
sourceSessionId: paramString(params, 'sourceSessionId'),
|
|
1100
|
-
agent: paramString(params, 'agent'),
|
|
1101
|
-
}, projectRoot);
|
|
1102
|
-
return wrapResult(result, 'mutate', 'memory', operation, startTime);
|
|
1103
|
-
}
|
|
1104
|
-
// T1004 — flush in-flight observations + WAL checkpoint before context compaction
|
|
1105
|
-
case 'precompact-flush': {
|
|
1106
|
-
try {
|
|
1107
|
-
const flushResult = await precompactFlush(projectRoot);
|
|
1108
|
-
return wrapResult({
|
|
1109
|
-
success: true,
|
|
1110
|
-
data: flushResult,
|
|
1111
|
-
}, 'mutate', 'memory', operation, startTime);
|
|
1112
|
-
}
|
|
1113
|
-
catch (flushErr) {
|
|
1114
|
-
return handleErrorResult('mutate', 'memory', operation, flushErr, startTime);
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
// T1003 — stage a new graph backfill run (rows held pending approval)
|
|
1118
|
-
case 'backfill.run': {
|
|
1119
|
-
try {
|
|
1120
|
-
const source = paramString(params, 'source');
|
|
1121
|
-
const kind = paramString(params, 'kind');
|
|
1122
|
-
const targetTable = paramString(params, 'targetTable');
|
|
1123
|
-
const result = await stagedBackfillRun(projectRoot, { source, kind, targetTable });
|
|
1124
|
-
return wrapResult({
|
|
1125
|
-
success: true,
|
|
1126
|
-
data: {
|
|
1127
|
-
runId: result.run.id,
|
|
1128
|
-
run: result.run,
|
|
1129
|
-
empty: result.empty,
|
|
1130
|
-
hint: result.empty
|
|
1131
|
-
? 'All candidate nodes already present — nothing to backfill'
|
|
1132
|
-
: `Run staged with ${result.run.rowsAffected} rows. Approve with 'cleo memory backfill.approve ${result.run.id}'`,
|
|
1133
|
-
},
|
|
1134
|
-
}, 'mutate', 'memory', operation, startTime);
|
|
1135
|
-
}
|
|
1136
|
-
catch (runErr) {
|
|
1137
|
-
return handleErrorResult('mutate', 'memory', operation, runErr, startTime);
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
// T1003 — approve a staged backfill run (commits rows to live tables)
|
|
1141
|
-
case 'backfill.approve': {
|
|
1142
|
-
const runId = paramString(params, 'runId');
|
|
1143
|
-
if (!runId) {
|
|
1144
|
-
return errorResult('mutate', 'memory', operation, 'E_INVALID_INPUT', 'runId is required', startTime);
|
|
1145
|
-
}
|
|
1146
|
-
try {
|
|
1147
|
-
const approvedBy = paramString(params, 'approvedBy');
|
|
1148
|
-
const result = await approveBackfillRun(projectRoot, runId, approvedBy);
|
|
1149
|
-
return wrapResult({
|
|
1150
|
-
success: true,
|
|
1151
|
-
data: {
|
|
1152
|
-
runId: result.run.id,
|
|
1153
|
-
run: result.run,
|
|
1154
|
-
alreadySettled: result.alreadySettled,
|
|
1155
|
-
backfillResult: result.backfillResult ?? null,
|
|
1156
|
-
hint: result.alreadySettled
|
|
1157
|
-
? `Run '${runId}' was already settled (status: ${result.run.status})`
|
|
1158
|
-
: `Backfill committed: ${result.backfillResult?.nodesInserted ?? 0} nodes inserted`,
|
|
1159
|
-
},
|
|
1160
|
-
}, 'mutate', 'memory', operation, startTime);
|
|
1161
|
-
}
|
|
1162
|
-
catch (approveErr) {
|
|
1163
|
-
return handleErrorResult('mutate', 'memory', operation, approveErr, startTime);
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
// T1003 — rollback a backfill run (removes staged/committed rows)
|
|
1167
|
-
case 'backfill.rollback': {
|
|
1168
|
-
const runId = paramString(params, 'runId');
|
|
1169
|
-
if (!runId) {
|
|
1170
|
-
return errorResult('mutate', 'memory', operation, 'E_INVALID_INPUT', 'runId is required', startTime);
|
|
1171
|
-
}
|
|
1172
|
-
try {
|
|
1173
|
-
const result = await rollbackBackfillRun(projectRoot, runId);
|
|
1174
|
-
return wrapResult({
|
|
1175
|
-
success: true,
|
|
1176
|
-
data: {
|
|
1177
|
-
runId: result.run.id,
|
|
1178
|
-
run: result.run,
|
|
1179
|
-
alreadySettled: result.alreadySettled,
|
|
1180
|
-
deletedRows: result.deletedRows,
|
|
1181
|
-
hint: result.alreadySettled
|
|
1182
|
-
? `Run '${runId}' was already rolled back`
|
|
1183
|
-
: result.deletedRows > 0
|
|
1184
|
-
? `Rolled back: deleted ${result.deletedRows} committed rows`
|
|
1185
|
-
: 'Run was still staged — no committed rows to delete',
|
|
1186
|
-
},
|
|
1187
|
-
}, 'mutate', 'memory', operation, startTime);
|
|
1188
|
-
}
|
|
1189
|
-
catch (rollbackErr) {
|
|
1190
|
-
return handleErrorResult('mutate', 'memory', operation, rollbackErr, startTime);
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
// T1147 W7 — sweep mutate operations (approve, rollback) delegate to query handler
|
|
1194
|
-
// which already handles all sweep sub-commands via a unified case block.
|
|
1195
|
-
case 'sweep':
|
|
1196
|
-
return this.query(operation, params);
|
|
1197
|
-
default:
|
|
1198
|
-
return unsupportedOp('mutate', 'memory', operation, startTime);
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
catch (error) {
|
|
1202
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
1203
|
-
getLogger('domain:memory').error({ gateway: 'mutate', domain: 'memory', operation, err: error }, message);
|
|
1204
|
-
return handleErrorResult('mutate', 'memory', operation, error, startTime);
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
// -----------------------------------------------------------------------
|
|
1208
|
-
// Supported operations
|
|
1209
|
-
// -----------------------------------------------------------------------
|
|
1210
|
-
getSupportedOperations() {
|
|
1211
|
-
return {
|
|
1212
|
-
query: [
|
|
1213
|
-
'find',
|
|
1214
|
-
'timeline',
|
|
1215
|
-
'fetch',
|
|
1216
|
-
'decision.find',
|
|
1217
|
-
'pattern.find',
|
|
1218
|
-
'learning.find',
|
|
1219
|
-
'graph.show',
|
|
1220
|
-
'graph.neighbors',
|
|
1221
|
-
'graph.trace',
|
|
1222
|
-
'graph.related',
|
|
1223
|
-
'graph.context',
|
|
1224
|
-
'graph.stats',
|
|
1225
|
-
'reason.why',
|
|
1226
|
-
'reason.similar',
|
|
1227
|
-
'search.hybrid',
|
|
1228
|
-
'quality',
|
|
1229
|
-
'code.links',
|
|
1230
|
-
'code.memories-for-code',
|
|
1231
|
-
'code.for-memory',
|
|
1232
|
-
// T1262 — brain noise detector (E1-parallel, read-only) + assert-clean gate
|
|
1233
|
-
'doctor',
|
|
1234
|
-
// T1147 W7 — sweep status query (dry-run mode)
|
|
1235
|
-
'sweep',
|
|
1236
|
-
// T791 — LLM extraction backend status
|
|
1237
|
-
'llm-status',
|
|
1238
|
-
// T792 — pending verification queue
|
|
1239
|
-
'pending-verify',
|
|
1240
|
-
// T999 — live memory-bridge content from brain.db (cli mode)
|
|
1241
|
-
'bridge',
|
|
1242
|
-
// T997 — read-only explainability view for promotion decisions
|
|
1243
|
-
'promote-explain',
|
|
1244
|
-
// T1006 — summarized top-N observations as session briefing digest
|
|
1245
|
-
'digest',
|
|
1246
|
-
// T1006 — tail recent observations with optional filters
|
|
1247
|
-
'recent',
|
|
1248
|
-
// T1006 — diary-typed observations (requires diary enum from T1005)
|
|
1249
|
-
'diary',
|
|
1250
|
-
// T1006 — long-poll stream of recent brain writes (SSE-style polling stub)
|
|
1251
|
-
'watch',
|
|
1252
|
-
// T1003 — list staged backfill runs
|
|
1253
|
-
'backfill.list',
|
|
1254
|
-
],
|
|
1255
|
-
mutate: [
|
|
1256
|
-
'observe',
|
|
1257
|
-
'decision.store',
|
|
1258
|
-
'pattern.store',
|
|
1259
|
-
'learning.store',
|
|
1260
|
-
'link',
|
|
1261
|
-
'graph.add',
|
|
1262
|
-
'graph.remove',
|
|
1263
|
-
'code.link',
|
|
1264
|
-
'code.auto-link',
|
|
1265
|
-
// T792 — promote entry to verified=true
|
|
1266
|
-
'verify',
|
|
1267
|
-
// T1004 — flush in-flight observations + WAL checkpoint before context compaction
|
|
1268
|
-
'precompact-flush',
|
|
1269
|
-
// T1006 — write a diary-typed observation
|
|
1270
|
-
'diary.write',
|
|
1271
|
-
// T1147 W7 — sweep mutate operations (approve, rollback)
|
|
1272
|
-
'sweep',
|
|
1273
|
-
// T1003 — staged backfill operations
|
|
1274
|
-
'backfill.run',
|
|
1275
|
-
'backfill.approve',
|
|
1276
|
-
'backfill.rollback',
|
|
1277
|
-
],
|
|
1278
|
-
};
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
//# sourceMappingURL=memory.js.map
|