clawvault 3.1.0 → 3.2.0
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/README.md +422 -141
- package/bin/clawvault.js +10 -2
- package/bin/command-registration.test.js +3 -1
- package/bin/command-runtime.js +9 -1
- package/bin/register-core-commands.js +23 -28
- package/bin/register-maintenance-commands.js +39 -3
- package/bin/register-query-commands.js +58 -29
- package/bin/register-tailscale-commands.js +106 -0
- package/bin/register-task-commands.js +18 -1
- package/bin/register-task-commands.test.js +16 -0
- package/bin/register-vault-operations-commands.js +29 -1
- package/bin/register-workgraph-commands.js +1368 -0
- package/dashboard/lib/graph-diff.js +104 -0
- package/dashboard/lib/graph-diff.test.js +75 -0
- package/dashboard/lib/vault-parser.js +556 -0
- package/dashboard/lib/vault-parser.test.js +254 -0
- package/dashboard/public/app.js +796 -0
- package/dashboard/public/index.html +52 -0
- package/dashboard/public/styles.css +221 -0
- package/dashboard/server.js +374 -0
- package/dist/{chunk-F2JEUD4J.js → chunk-23YDQ3QU.js} +6 -8
- package/dist/{chunk-C7OK5WKP.js → chunk-2JQ3O2YL.js} +4 -4
- package/dist/{chunk-VR5NE7PZ.js → chunk-2RAZ4ZFE.js} +1 -1
- package/dist/chunk-2ZDO52B4.js +52 -0
- package/dist/{chunk-ZZA73MFY.js → chunk-33DOSHTA.js} +176 -36
- package/dist/chunk-33VSQP4J.js +37 -0
- package/dist/chunk-4BQTQMJP.js +93 -0
- package/dist/{chunk-GUKMRGM7.js → chunk-4OXMU5S2.js} +1 -1
- package/dist/{chunk-62YTUT6J.js → chunk-4PY655YM.js} +15 -3
- package/dist/chunk-6FH3IULF.js +352 -0
- package/dist/{chunk-3NSBOUT3.js → chunk-77Q5CSPJ.js} +404 -80
- package/dist/{chunk-4VQTUVH7.js → chunk-7YZWHM36.js} +52 -26
- package/dist/chunk-BSJ6RIT7.js +447 -0
- package/dist/chunk-BUEW6IIK.js +364 -0
- package/dist/{chunk-LI4O6NVK.js → chunk-CLJTREDS.js} +74 -14
- package/dist/chunk-EK6S23ZB.js +469 -0
- package/dist/{chunk-LNJA2UGL.js → chunk-ESFLMDRB.js} +9 -86
- package/dist/{chunk-H34S76MB.js → chunk-ESVS6K2B.js} +6 -6
- package/dist/{chunk-WAZ3NLWL.js → chunk-F55HGNU4.js} +0 -47
- package/dist/{chunk-QK3UCXWL.js → chunk-FHFUXL6G.js} +2 -2
- package/dist/{chunk-H62BP7RI.js → chunk-GAOWA7GR.js} +212 -46
- package/dist/chunk-GGA32J2R.js +784 -0
- package/dist/chunk-GNJL4YGR.js +79 -0
- package/dist/chunk-IVRIKYFE.js +520 -0
- package/dist/chunk-MDIH26GC.js +183 -0
- package/dist/{chunk-LYHGEHXG.js → chunk-MFAWT5O5.js} +0 -1
- package/dist/chunk-MM6QGW3P.js +207 -0
- package/dist/{chunk-P5EPF6MB.js → chunk-MW5C6ZQA.js} +110 -13
- package/dist/chunk-NCKFNBHJ.js +257 -0
- package/dist/{chunk-QBLMXKF2.js → chunk-OIWVQYQF.js} +1 -1
- package/dist/{chunk-42MXU7A6.js → chunk-P62WHA27.js} +58 -47
- package/dist/chunk-PBACDKKP.js +66 -0
- package/dist/{chunk-VGLOTGAS.js → chunk-QSHD36LH.js} +2 -2
- package/dist/{chunk-OZ7RIXTO.js → chunk-QSRRMEYM.js} +2 -2
- package/dist/chunk-QVEERJSP.js +152 -0
- package/dist/{chunk-N2AXRYLC.js → chunk-QWQ3TIKS.js} +1 -1
- package/dist/{chunk-3DHXQHYG.js → chunk-R2MIW5G7.js} +1 -1
- package/dist/{chunk-SJSFRIYS.js → chunk-SLXOR3CC.js} +2 -2
- package/dist/chunk-SS4B7P7V.js +99 -0
- package/dist/{chunk-JY6FYXIT.js → chunk-STCQGCEQ.js} +6 -11
- package/dist/chunk-TIGW564L.js +628 -0
- package/dist/chunk-U4O6C46S.js +154 -0
- package/dist/{chunk-ITPEXLHA.js → chunk-URXDAUVH.js} +24 -5
- package/dist/chunk-VSL7KY3M.js +189 -0
- package/dist/{chunk-U55BGUAU.js → chunk-W4SPAEE7.js} +6 -6
- package/dist/chunk-WMGIIABP.js +15 -0
- package/dist/{chunk-33UGEQRT.js → chunk-X3SPPUFG.js} +151 -64
- package/dist/chunk-Y6VJKXGL.js +373 -0
- package/dist/{chunk-3WRJEKN4.js → chunk-ZN54U2OZ.js} +123 -10
- package/dist/cli/index.js +34 -24
- package/dist/commands/archive.js +3 -3
- package/dist/commands/backlog.js +3 -3
- package/dist/commands/blocked.js +3 -3
- package/dist/commands/canvas.d.ts +15 -0
- package/dist/commands/canvas.js +200 -0
- package/dist/commands/checkpoint.js +2 -2
- package/dist/commands/compat.js +2 -2
- package/dist/commands/context.js +8 -6
- package/dist/commands/doctor.d.ts +11 -7
- package/dist/commands/doctor.js +18 -16
- package/dist/commands/embed.js +5 -6
- package/dist/commands/entities.js +2 -2
- package/dist/commands/graph.js +4 -4
- package/dist/commands/inject.d.ts +1 -1
- package/dist/commands/inject.js +5 -6
- package/dist/commands/kanban.js +4 -4
- package/dist/commands/link.js +5 -5
- package/dist/commands/migrate-observations.js +4 -4
- package/dist/commands/observe.d.ts +0 -1
- package/dist/commands/observe.js +14 -13
- package/dist/commands/project.js +5 -5
- package/dist/commands/rebuild-embeddings.d.ts +21 -0
- package/dist/commands/rebuild-embeddings.js +91 -0
- package/dist/commands/rebuild.js +12 -11
- package/dist/commands/recover.js +3 -3
- package/dist/commands/reflect.js +6 -7
- package/dist/commands/repair-session.js +1 -1
- package/dist/commands/replay.js +14 -14
- package/dist/commands/session-recap.js +1 -1
- package/dist/commands/setup.d.ts +2 -89
- package/dist/commands/setup.js +3 -21
- package/dist/commands/shell-init.js +1 -1
- package/dist/commands/sleep.d.ts +1 -1
- package/dist/commands/sleep.js +20 -19
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +57 -35
- package/dist/commands/sync-bd.d.ts +10 -0
- package/dist/commands/sync-bd.js +10 -0
- package/dist/commands/tailscale.d.ts +52 -0
- package/dist/commands/tailscale.js +26 -0
- package/dist/commands/task.js +4 -4
- package/dist/commands/template.js +2 -2
- package/dist/commands/wake.d.ts +1 -1
- package/dist/commands/wake.js +11 -10
- package/dist/commands/workgraph.d.ts +124 -0
- package/dist/commands/workgraph.js +38 -0
- package/dist/index.d.ts +341 -191
- package/dist/index.js +446 -116
- package/dist/{inject-Bzi5E-By.d.ts → inject-DYUrDqQO.d.ts} +3 -3
- package/dist/ledger-B7g7jhqG.d.ts +44 -0
- package/dist/lib/auto-linker.js +2 -2
- package/dist/lib/canvas-layout.d.ts +115 -0
- package/dist/lib/canvas-layout.js +35 -0
- package/dist/lib/config.d.ts +27 -3
- package/dist/lib/config.js +4 -2
- package/dist/lib/entity-index.js +1 -1
- package/dist/lib/project-utils.js +4 -4
- package/dist/lib/session-repair.js +1 -1
- package/dist/lib/session-utils.js +1 -1
- package/dist/lib/tailscale.d.ts +225 -0
- package/dist/lib/tailscale.js +50 -0
- package/dist/lib/task-utils.js +3 -3
- package/dist/lib/template-engine.js +1 -1
- package/dist/lib/webdav.d.ts +109 -0
- package/dist/lib/webdav.js +35 -0
- package/dist/onnxruntime_binding-5QEF3SUC.node +0 -0
- package/dist/onnxruntime_binding-BKPKNEGC.node +0 -0
- package/dist/onnxruntime_binding-FMOXGIUT.node +0 -0
- package/dist/onnxruntime_binding-OI2KMXC5.node +0 -0
- package/dist/onnxruntime_binding-UX44MLAZ.node +0 -0
- package/dist/onnxruntime_binding-Y2W7N7WY.node +0 -0
- package/dist/openclaw-plugin.d.ts +8 -0
- package/dist/openclaw-plugin.js +14 -0
- package/dist/registry-BR4326o0.d.ts +30 -0
- package/dist/store-CA-6sKCJ.d.ts +34 -0
- package/dist/thread-B9LhXNU0.d.ts +41 -0
- package/dist/transformers.node-A2ZRORSQ.js +46775 -0
- package/dist/{types-Y2_Um2Ls.d.ts → types-BbWJoC1c.d.ts} +1 -44
- package/dist/workgraph/index.d.ts +5 -0
- package/dist/workgraph/index.js +23 -0
- package/dist/workgraph/ledger.d.ts +2 -0
- package/dist/workgraph/ledger.js +25 -0
- package/dist/workgraph/registry.d.ts +2 -0
- package/dist/workgraph/registry.js +19 -0
- package/dist/workgraph/store.d.ts +2 -0
- package/dist/workgraph/store.js +25 -0
- package/dist/workgraph/thread.d.ts +2 -0
- package/dist/workgraph/thread.js +25 -0
- package/dist/workgraph/types.d.ts +54 -0
- package/dist/workgraph/types.js +7 -0
- package/hooks/clawvault/HOOK.md +113 -0
- package/hooks/clawvault/handler.js +1561 -0
- package/hooks/clawvault/handler.test.js +510 -0
- package/hooks/clawvault/openclaw.plugin.json +72 -0
- package/openclaw.plugin.json +65 -38
- package/package.json +25 -22
- package/dist/chunk-3RG5ZIWI.js +0 -10
- package/dist/chunk-3ZIH425O.js +0 -871
- package/dist/chunk-6U6MK36V.js +0 -205
- package/dist/chunk-CMB7UL7C.js +0 -327
- package/dist/chunk-D2H45LON.js +0 -1074
- package/dist/chunk-E7MFQB6D.js +0 -163
- package/dist/chunk-GQSLDZTS.js +0 -560
- package/dist/chunk-MFM6K7PU.js +0 -374
- package/dist/chunk-MXSSG3QU.js +0 -42
- package/dist/chunk-OCGVIN3L.js +0 -88
- package/dist/chunk-PAH27GSN.js +0 -108
- package/dist/chunk-YCUNCH2I.js +0 -78
- package/dist/cli/index.cjs +0 -8584
- package/dist/cli/index.d.cts +0 -5
- package/dist/commands/archive.cjs +0 -287
- package/dist/commands/archive.d.cts +0 -11
- package/dist/commands/backlog.cjs +0 -721
- package/dist/commands/backlog.d.cts +0 -53
- package/dist/commands/blocked.cjs +0 -204
- package/dist/commands/blocked.d.cts +0 -26
- package/dist/commands/checkpoint.cjs +0 -244
- package/dist/commands/checkpoint.d.cts +0 -41
- package/dist/commands/compat.cjs +0 -294
- package/dist/commands/compat.d.cts +0 -28
- package/dist/commands/context.cjs +0 -2990
- package/dist/commands/context.d.cts +0 -2
- package/dist/commands/doctor.cjs +0 -2986
- package/dist/commands/doctor.d.cts +0 -21
- package/dist/commands/embed.cjs +0 -232
- package/dist/commands/embed.d.cts +0 -17
- package/dist/commands/entities.cjs +0 -141
- package/dist/commands/entities.d.cts +0 -7
- package/dist/commands/graph.cjs +0 -501
- package/dist/commands/graph.d.cts +0 -21
- package/dist/commands/inject.cjs +0 -1636
- package/dist/commands/inject.d.cts +0 -2
- package/dist/commands/kanban.cjs +0 -884
- package/dist/commands/kanban.d.cts +0 -63
- package/dist/commands/link.cjs +0 -965
- package/dist/commands/link.d.cts +0 -11
- package/dist/commands/migrate-observations.cjs +0 -362
- package/dist/commands/migrate-observations.d.cts +0 -19
- package/dist/commands/observe.cjs +0 -4099
- package/dist/commands/observe.d.cts +0 -23
- package/dist/commands/project.cjs +0 -1341
- package/dist/commands/project.d.cts +0 -85
- package/dist/commands/rebuild.cjs +0 -3136
- package/dist/commands/rebuild.d.cts +0 -11
- package/dist/commands/recover.cjs +0 -361
- package/dist/commands/recover.d.cts +0 -38
- package/dist/commands/reflect.cjs +0 -1008
- package/dist/commands/reflect.d.cts +0 -11
- package/dist/commands/repair-session.cjs +0 -457
- package/dist/commands/repair-session.d.cts +0 -38
- package/dist/commands/replay.cjs +0 -4103
- package/dist/commands/replay.d.cts +0 -16
- package/dist/commands/session-recap.cjs +0 -353
- package/dist/commands/session-recap.d.cts +0 -27
- package/dist/commands/setup.cjs +0 -1278
- package/dist/commands/setup.d.cts +0 -99
- package/dist/commands/shell-init.cjs +0 -75
- package/dist/commands/shell-init.d.cts +0 -7
- package/dist/commands/sleep.cjs +0 -6029
- package/dist/commands/sleep.d.cts +0 -36
- package/dist/commands/status.cjs +0 -2737
- package/dist/commands/status.d.cts +0 -52
- package/dist/commands/task.cjs +0 -1236
- package/dist/commands/task.d.cts +0 -97
- package/dist/commands/template.cjs +0 -457
- package/dist/commands/template.d.cts +0 -36
- package/dist/commands/wake.cjs +0 -2627
- package/dist/commands/wake.d.cts +0 -22
- package/dist/context-BUGaWpyL.d.cts +0 -46
- package/dist/index.cjs +0 -12373
- package/dist/index.d.cts +0 -854
- package/dist/inject-Bzi5E-By.d.cts +0 -137
- package/dist/lib/auto-linker.cjs +0 -176
- package/dist/lib/auto-linker.d.cts +0 -26
- package/dist/lib/config.cjs +0 -78
- package/dist/lib/config.d.cts +0 -11
- package/dist/lib/entity-index.cjs +0 -84
- package/dist/lib/entity-index.d.cts +0 -26
- package/dist/lib/project-utils.cjs +0 -864
- package/dist/lib/project-utils.d.cts +0 -97
- package/dist/lib/session-repair.cjs +0 -239
- package/dist/lib/session-repair.d.cts +0 -110
- package/dist/lib/session-utils.cjs +0 -209
- package/dist/lib/session-utils.d.cts +0 -63
- package/dist/lib/task-utils.cjs +0 -1137
- package/dist/lib/task-utils.d.cts +0 -208
- package/dist/lib/template-engine.cjs +0 -47
- package/dist/lib/template-engine.d.cts +0 -11
- package/dist/plugin/index.cjs +0 -1907
- package/dist/plugin/index.d.cts +0 -36
- package/dist/plugin/index.d.ts +0 -36
- package/dist/plugin/index.js +0 -572
- package/dist/plugin/inject.cjs +0 -356
- package/dist/plugin/inject.d.cts +0 -54
- package/dist/plugin/inject.d.ts +0 -54
- package/dist/plugin/inject.js +0 -17
- package/dist/plugin/observe.cjs +0 -631
- package/dist/plugin/observe.d.cts +0 -39
- package/dist/plugin/observe.d.ts +0 -39
- package/dist/plugin/observe.js +0 -18
- package/dist/plugin/templates.cjs +0 -593
- package/dist/plugin/templates.d.cts +0 -52
- package/dist/plugin/templates.d.ts +0 -52
- package/dist/plugin/templates.js +0 -25
- package/dist/plugin/types.cjs +0 -18
- package/dist/plugin/types.d.cts +0 -209
- package/dist/plugin/types.d.ts +0 -209
- package/dist/plugin/types.js +0 -0
- package/dist/plugin/vault.cjs +0 -927
- package/dist/plugin/vault.d.cts +0 -68
- package/dist/plugin/vault.d.ts +0 -68
- package/dist/plugin/vault.js +0 -22
- package/dist/types-Y2_Um2Ls.d.cts +0 -205
- package/templates/memory-event.md +0 -67
- package/templates/party.md +0 -63
- package/templates/primitive-registry.yaml +0 -551
- package/templates/run.md +0 -68
- package/templates/trigger.md +0 -68
- package/templates/workspace.md +0 -50
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { V as VaultConfig,
|
|
3
|
-
export {
|
|
2
|
+
import { V as VaultConfig, a as StoreOptions, D as Document, b as SearchOptions, c as SearchResult, d as SyncOptions, e as SyncResult, C as Category, M as MemoryType, H as HandoffDocument, S as SessionRecap } from './types-BbWJoC1c.js';
|
|
3
|
+
export { f as DEFAULT_CATEGORIES, g as DEFAULT_CONFIG, h as MEMORY_TYPES, T as TYPE_TO_CATEGORY, i as VaultMeta } from './types-BbWJoC1c.js';
|
|
4
4
|
export { setupCommand } from './commands/setup.js';
|
|
5
5
|
export { CompatCheck, CompatCommandOptions, CompatReport, CompatStatus, checkOpenClawCompatibility, compatCommand, compatibilityExitCode } from './commands/compat.js';
|
|
6
6
|
export { GraphSummary, graphCommand, graphSummary } from './commands/graph.js';
|
|
7
7
|
export { KanbanGroupBy, KanbanImportChange, KanbanImportOptions, KanbanImportResult, KanbanLane, KanbanSyncOptions, KanbanSyncResult, ParsedKanbanBoard, ParsedKanbanLane, buildKanbanLanes, extractCardSlug, formatKanbanCard, generateKanbanMarkdown, importKanbanBoard, kanbanCommand, parseKanbanMarkdown, syncKanbanBoard } from './commands/kanban.js';
|
|
8
8
|
export { C as ContextEntry, a as ContextFormat, b as ContextOptions, c as ContextProfile, d as ContextProfileInput, e as ContextProfileOption, f as ContextResult, R as ResolvedContextProfile, g as buildContext, h as contextCommand, i as formatContextMarkdown, j as inferContextProfile, n as normalizeContextProfileInput, r as registerContextCommand, k as resolveContextProfile } from './context-BUGaWpyL.js';
|
|
9
|
-
|
|
9
|
+
import { L as LlmProvider } from './inject-DYUrDqQO.js';
|
|
10
|
+
export { I as InjectCommandOptions, a as InjectFormat, b as InjectMatch, c as InjectMatchReason, d as InjectMatchSource, e as InjectResult, f as InjectRuntimeOptions, g as InjectSourceCategory, h as InjectableItem, i as LlmCompletionOptions, M as MEMORY_GRAPH_SCHEMA_VERSION, j as MemoryGraph, k as MemoryGraphEdge, l as MemoryGraphEdgeType, m as MemoryGraphIndex, n as MemoryGraphNode, o as MemoryGraphNodeType, p as MemoryGraphStats, q as buildInjectionResult, r as buildOrUpdateMemoryGraphIndex, s as deterministicInjectMatches, t as getMemoryGraph, u as indexInjectableItems, v as injectCommand, w as loadMemoryGraphIndex, x as registerInjectCommand, y as requestLlmCompletion, z as resolveLlmProvider, A as runPromptInjection } from './inject-DYUrDqQO.js';
|
|
10
11
|
export { ObserveCommandOptions, observeCommand, registerObserveCommand } from './commands/observe.js';
|
|
11
12
|
export { ReflectCommandOptions, reflectCommand, registerReflectCommand } from './commands/reflect.js';
|
|
12
13
|
export { ArchiveCommandOptions, archiveCommand, registerArchiveCommand } from './commands/archive.js';
|
|
13
14
|
export { RebuildCommandOptions, rebuildCommand, registerRebuildCommand } from './commands/rebuild.js';
|
|
14
|
-
|
|
15
|
+
import { MigrationIssueType } from './commands/doctor.js';
|
|
16
|
+
export { DoctorCheck, DoctorReport, DoctorStatus, MigrationIssue, doctor } from './commands/doctor.js';
|
|
15
17
|
export { EmbedCommandOptions, EmbedCommandResult, embedCommand, registerEmbedCommand } from './commands/embed.js';
|
|
16
18
|
export { ReplayCommandOptions, registerReplayCommand, replayCommand } from './commands/replay.js';
|
|
17
19
|
export { MigrateObservationsOptions, MigrateObservationsResult, migrateObservations, migrateObservationsCommand, registerMigrateObservationsCommand } from './commands/migrate-observations.js';
|
|
20
|
+
export { SyncBdCommandOptions, registerSyncBdCommand, syncBdCommand } from './commands/sync-bd.js';
|
|
18
21
|
export { SessionRecapFormat, SessionRecapOptions, SessionRecapResult, SessionTurn, buildSessionRecap, formatSessionRecapMarkdown, sessionRecapCommand } from './commands/session-recap.js';
|
|
19
22
|
export { findNearestVaultPath, getVaultPath, resolveVaultPath } from './lib/config.js';
|
|
20
23
|
export { registerCliCommands } from './cli/index.js';
|
|
21
24
|
import { TaskStatus } from './lib/task-utils.js';
|
|
22
25
|
export { completeTask, listDependentTasks, listSubtasks, updateTask } from './lib/task-utils.js';
|
|
26
|
+
export { CLAWVAULT_SERVE_PATH, DEFAULT_SERVE_PORT, ServeInstance, TailscalePeer, TailscaleServeConfig, TailscaleStatus, TailscaleSyncOptions, TailscaleSyncResult, VaultFileEntry, VaultManifest, checkPeerClawVault, compareManifests, configureTailscaleServe, discoverClawVaultPeers, fetchRemoteFile, fetchRemoteManifest, findPeer, generateVaultManifest, getOnlinePeers, getTailscaleStatus, getTailscaleVersion, hasTailscale, pushFileToRemote, resolvePeerIP, serveVault, stopTailscaleServe, syncWithPeer } from './lib/tailscale.js';
|
|
27
|
+
export { TailscaleDiscoverCommandOptions, TailscaleServeCommandOptions, TailscaleStatusCommandOptions, TailscaleSyncCommandOptions, registerTailscaleCommands, registerTailscaleDiscoverCommand, registerTailscaleServeCommand, registerTailscaleStatusCommand, registerTailscaleSyncCommand, tailscaleDiscoverCommand, tailscaleServeCommand, tailscaleStatusCommand, tailscaleSyncCommand } from './commands/tailscale.js';
|
|
23
28
|
export { TemplateVariables, buildTemplateVariables, renderTemplate } from './lib/template-engine.js';
|
|
24
29
|
export { Project, ProjectFrontmatter, ProjectStatus, archiveProject, createProject, getProjectActivity, getProjectTasks, listProjects, readProject, updateProject } from './lib/project-utils.js';
|
|
30
|
+
import 'child_process';
|
|
31
|
+
import 'http';
|
|
25
32
|
|
|
26
33
|
/**
|
|
27
34
|
* ClawVault - The elephant's memory
|
|
@@ -152,6 +159,16 @@ declare class ClawVault {
|
|
|
152
159
|
* Parse a handoff document back into structured form
|
|
153
160
|
*/
|
|
154
161
|
private parseHandoff;
|
|
162
|
+
/**
|
|
163
|
+
* Safely convert a date value to ISO string format.
|
|
164
|
+
* Handles Date objects, strings, and undefined values.
|
|
165
|
+
*/
|
|
166
|
+
private toDateString;
|
|
167
|
+
/**
|
|
168
|
+
* Extract the date portion (YYYY-MM-DD) from an ISO date string or Date object.
|
|
169
|
+
* Provides safe handling for various date formats.
|
|
170
|
+
*/
|
|
171
|
+
private extractDatePart;
|
|
155
172
|
private applyQmdConfig;
|
|
156
173
|
private slugify;
|
|
157
174
|
private saveIndex;
|
|
@@ -174,137 +191,52 @@ declare function createVault(vaultPath: string, options?: Partial<VaultConfig>,
|
|
|
174
191
|
skipGraph?: boolean;
|
|
175
192
|
}): Promise<ClawVault>;
|
|
176
193
|
|
|
177
|
-
interface
|
|
194
|
+
interface MigrateCommandOptions {
|
|
178
195
|
vaultPath?: string;
|
|
179
|
-
since?: string;
|
|
180
196
|
dryRun?: boolean;
|
|
181
|
-
|
|
197
|
+
force?: boolean;
|
|
198
|
+
json?: boolean;
|
|
182
199
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
type LegacyObservationPriority = '🔴' | '🟡' | '🟢';
|
|
189
|
-
type ObservationLineKind = 'scored' | 'emoji';
|
|
190
|
-
interface ParsedObservationRecord {
|
|
191
|
-
date: string;
|
|
192
|
-
type: ObservationType;
|
|
193
|
-
confidence: number;
|
|
194
|
-
importance: number;
|
|
195
|
-
content: string;
|
|
196
|
-
format: ObservationLineKind;
|
|
197
|
-
priority?: LegacyObservationPriority;
|
|
198
|
-
time?: string;
|
|
199
|
-
rawLine: string;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Reweave — Backward memory consolidation for ClawVault
|
|
204
|
-
*
|
|
205
|
-
* When new observations are written, reweave performs a backward pass over
|
|
206
|
-
* existing observations to detect knowledge updates (same entity, new value).
|
|
207
|
-
* Older observations are marked as superseded so search always returns the
|
|
208
|
-
* latest version of a fact.
|
|
209
|
-
*
|
|
210
|
-
* Design inspired by Ars Contexta's "notes are hypotheses" philosophy —
|
|
211
|
-
* every observation is a claim that can be superseded by newer evidence.
|
|
212
|
-
*/
|
|
213
|
-
|
|
214
|
-
interface SupersessionRecord {
|
|
215
|
-
/** The older observation that was superseded */
|
|
216
|
-
oldObservation: ParsedObservationRecord;
|
|
217
|
-
/** The newer observation that supersedes it */
|
|
218
|
-
newObservation: ParsedObservationRecord;
|
|
219
|
-
/** File path of the older observation */
|
|
220
|
-
oldFile: string;
|
|
221
|
-
/** File path of the newer observation */
|
|
222
|
-
newFile: string;
|
|
223
|
-
/** Reason for supersession */
|
|
224
|
-
reason: string;
|
|
225
|
-
/** Timestamp of detection */
|
|
226
|
-
detectedAt: string;
|
|
227
|
-
}
|
|
228
|
-
interface ReweaveResult {
|
|
229
|
-
/** Number of observation files scanned */
|
|
230
|
-
filesScanned: number;
|
|
231
|
-
/** Number of individual observations checked */
|
|
232
|
-
observationsChecked: number;
|
|
233
|
-
/** Supersession records found/applied */
|
|
234
|
-
supersessions: SupersessionRecord[];
|
|
235
|
-
/** Whether this was a dry run */
|
|
236
|
-
dryRun: boolean;
|
|
200
|
+
interface MigrationAction {
|
|
201
|
+
type: MigrationIssueType;
|
|
202
|
+
description: string;
|
|
203
|
+
success: boolean;
|
|
204
|
+
error?: string;
|
|
237
205
|
}
|
|
238
|
-
interface
|
|
206
|
+
interface MigrateResult {
|
|
239
207
|
vaultPath: string;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
dryRun
|
|
244
|
-
/** Similarity threshold for entity matching (0-1). Default 0.6 */
|
|
245
|
-
similarityThreshold?: number;
|
|
208
|
+
issuesFound: number;
|
|
209
|
+
issuesFixed: number;
|
|
210
|
+
actions: MigrationAction[];
|
|
211
|
+
dryRun: boolean;
|
|
246
212
|
}
|
|
247
|
-
declare function
|
|
248
|
-
declare function
|
|
249
|
-
|
|
250
|
-
detectedAt: string;
|
|
251
|
-
} | null;
|
|
252
|
-
/**
|
|
253
|
-
* Extract key entities/subjects from an observation for matching.
|
|
254
|
-
* Returns normalized tokens that represent the "what" of the observation.
|
|
255
|
-
*/
|
|
256
|
-
declare function extractEntities(content: string): string[];
|
|
257
|
-
/**
|
|
258
|
-
* Compute similarity between two observations based on entity overlap.
|
|
259
|
-
* Returns 0-1 where 1 = identical entities.
|
|
260
|
-
*/
|
|
261
|
-
declare function entitySimilarity(a: string[], b: string[]): number;
|
|
262
|
-
/**
|
|
263
|
-
* Check if two observations represent a knowledge update.
|
|
264
|
-
* Both must be about the same entity/subject but with different values.
|
|
265
|
-
*
|
|
266
|
-
* Heuristic: high entity overlap + different observation content = update.
|
|
267
|
-
* Same content = duplicate, not update.
|
|
268
|
-
*/
|
|
269
|
-
declare function isKnowledgeUpdate(older: ParsedObservationRecord, newer: ParsedObservationRecord, threshold?: number): {
|
|
270
|
-
isUpdate: boolean;
|
|
271
|
-
reason: string;
|
|
272
|
-
};
|
|
273
|
-
/**
|
|
274
|
-
* Run backward consolidation across observations.
|
|
275
|
-
*
|
|
276
|
-
* For each newer observation, check all older observations for knowledge updates.
|
|
277
|
-
* When found, mark the older one as superseded.
|
|
278
|
-
*/
|
|
279
|
-
declare function reweave(options: ReweaveOptions): ReweaveResult;
|
|
280
|
-
/**
|
|
281
|
-
* Filter search results to prefer latest versions of superseded observations.
|
|
282
|
-
* When multiple observations cover the same entity, only keep the newest.
|
|
283
|
-
*
|
|
284
|
-
* This is called from the search pipeline to boost knowledge update accuracy.
|
|
285
|
-
*/
|
|
286
|
-
declare function filterSuperseded(lines: string[]): string[];
|
|
287
|
-
/**
|
|
288
|
-
* Given observation markdown content, return only non-superseded lines.
|
|
289
|
-
* Preserves date headings and structure.
|
|
290
|
-
*/
|
|
291
|
-
declare function stripSupersededObservations(markdown: string): string;
|
|
213
|
+
declare function migrate(options?: MigrateCommandOptions): Promise<MigrateResult>;
|
|
214
|
+
declare function migrateCommand(options?: MigrateCommandOptions): Promise<MigrateResult>;
|
|
215
|
+
declare function registerMigrateCommand(program: Command): void;
|
|
292
216
|
|
|
293
217
|
/**
|
|
294
218
|
* ClawVault Search Engine - qmd Backend
|
|
295
219
|
* Uses qmd CLI for BM25 and vector search
|
|
296
|
-
*
|
|
297
|
-
* v2.7.0 enhancements:
|
|
298
|
-
* 1. Chunk-level BM25 pre-filtering (from eval v4 adapter)
|
|
299
|
-
* 2. Exhaustive threshold-based retrieval (from eval v6 adapter)
|
|
300
|
-
* 3. Preference extraction pipeline (from eval v3 adapter)
|
|
301
|
-
* 4. Temporal date indexing at ingest time (from eval v8 design)
|
|
302
220
|
*/
|
|
303
221
|
|
|
304
222
|
declare const QMD_INSTALL_URL = "https://github.com/tobi/qmd";
|
|
305
223
|
declare const QMD_INSTALL_COMMAND = "bun install -g github:tobi/qmd";
|
|
224
|
+
type QmdErrorCode = 'NOT_INSTALLED' | 'NOT_CONFIGURED' | 'COLLECTION_NOT_FOUND' | 'EXECUTION_FAILED';
|
|
225
|
+
interface QmdErrorDetails {
|
|
226
|
+
code: QmdErrorCode;
|
|
227
|
+
message: string;
|
|
228
|
+
hint: string;
|
|
229
|
+
}
|
|
306
230
|
declare class QmdUnavailableError extends Error {
|
|
307
|
-
|
|
231
|
+
readonly code: QmdErrorCode;
|
|
232
|
+
readonly hint: string;
|
|
233
|
+
constructor(code?: QmdErrorCode, additionalContext?: string);
|
|
234
|
+
toUserMessage(): string;
|
|
235
|
+
}
|
|
236
|
+
declare function getQmdErrorDetails(code: QmdErrorCode): QmdErrorDetails;
|
|
237
|
+
declare class QmdConfigurationError extends Error {
|
|
238
|
+
readonly hint?: string | undefined;
|
|
239
|
+
constructor(message: string, hint?: string | undefined);
|
|
308
240
|
}
|
|
309
241
|
/**
|
|
310
242
|
* Check if qmd is available
|
|
@@ -318,31 +250,6 @@ declare function qmdUpdate(collection?: string, indexName?: string): void;
|
|
|
318
250
|
* Trigger qmd embed (create/update vector embeddings)
|
|
319
251
|
*/
|
|
320
252
|
declare function qmdEmbed(collection?: string, indexName?: string): void;
|
|
321
|
-
/**
|
|
322
|
-
* Split text into ~maxChars sentence-aligned chunks with overlap.
|
|
323
|
-
*/
|
|
324
|
-
declare function sentenceChunk(text: string, maxChars?: number, overlapSentences?: number): string[];
|
|
325
|
-
/**
|
|
326
|
-
* BM25-rank chunks within a document by keyword overlap.
|
|
327
|
-
* Returns the top `max` chunks sorted by relevance, always including the
|
|
328
|
-
* first chunk (session context) when available.
|
|
329
|
-
*/
|
|
330
|
-
declare function bm25RankChunks(chunks: string[], terms: string[], max?: number): {
|
|
331
|
-
text: string;
|
|
332
|
-
score: number;
|
|
333
|
-
}[];
|
|
334
|
-
/**
|
|
335
|
-
* Extract all date references from text content. Designed to run at ingest
|
|
336
|
-
* time so temporal queries can use structured dates + JS arithmetic instead
|
|
337
|
-
* of relying on LLM date math at query time.
|
|
338
|
-
*/
|
|
339
|
-
declare function extractDates(text: string, sessionDateStr?: string): ExtractedDate[];
|
|
340
|
-
/**
|
|
341
|
-
* Extract user preferences from conversation text. Runs at ingest time to
|
|
342
|
-
* build a structured preference index for personalised recommendations.
|
|
343
|
-
*/
|
|
344
|
-
declare function extractPreferences(text: string, documentId?: string): ExtractedPreference[];
|
|
345
|
-
declare function classifyQuestion(q: string): 'preference' | 'temporal' | 'aggregation' | 'default';
|
|
346
253
|
/**
|
|
347
254
|
* QMD Search Engine - wraps qmd CLI
|
|
348
255
|
*/
|
|
@@ -352,16 +259,14 @@ declare class SearchEngine {
|
|
|
352
259
|
private vaultPath;
|
|
353
260
|
private collectionRoot;
|
|
354
261
|
private qmdIndexName?;
|
|
355
|
-
/** v2.7 — Per-document date index built at ingest time */
|
|
356
|
-
private dateIndex;
|
|
357
|
-
/** v2.7 — Per-document preference index built at ingest time */
|
|
358
|
-
private preferenceIndex;
|
|
359
|
-
/** v2.7 — Per-document chunk cache for BM25 pre-filtering */
|
|
360
|
-
private chunkCache;
|
|
361
262
|
/**
|
|
362
263
|
* Set the collection name (usually vault name)
|
|
363
264
|
*/
|
|
364
265
|
setCollection(name: string): void;
|
|
266
|
+
/**
|
|
267
|
+
* Get the current collection name
|
|
268
|
+
*/
|
|
269
|
+
getCollection(): string;
|
|
365
270
|
/**
|
|
366
271
|
* Set the vault path for file resolution
|
|
367
272
|
*/
|
|
@@ -375,8 +280,7 @@ declare class SearchEngine {
|
|
|
375
280
|
*/
|
|
376
281
|
setIndexName(indexName?: string): void;
|
|
377
282
|
/**
|
|
378
|
-
* Add or update a document in the local cache
|
|
379
|
-
* v2.7: also extracts dates, preferences, and chunks at ingest time.
|
|
283
|
+
* Add or update a document in the local cache
|
|
380
284
|
* Note: qmd indexing happens via qmd update command
|
|
381
285
|
*/
|
|
382
286
|
addDocument(doc: Document): void;
|
|
@@ -401,32 +305,6 @@ declare class SearchEngine {
|
|
|
401
305
|
*/
|
|
402
306
|
query(query: string, options?: SearchOptions): SearchResult[];
|
|
403
307
|
private runQmdQuery;
|
|
404
|
-
/**
|
|
405
|
-
* v2.7 — Chunk-level BM25 pre-filtered search. Ranks chunks within each
|
|
406
|
-
* document by keyword relevance before semantic ranking, so relevant
|
|
407
|
-
* content deep in long documents isn't missed.
|
|
408
|
-
*
|
|
409
|
-
* Returns results with snippets from the best-matching chunks.
|
|
410
|
-
*/
|
|
411
|
-
chunkPrefilterSearch(query: string, options?: SearchOptions): SearchResult[];
|
|
412
|
-
/**
|
|
413
|
-
* v2.7 — Exhaustive threshold-based search for aggregation queries.
|
|
414
|
-
* Keeps pulling results until relevance drops below threshold.
|
|
415
|
-
*/
|
|
416
|
-
exhaustiveSearch(query: string, threshold?: number, maxResults?: number): SearchResult[];
|
|
417
|
-
/**
|
|
418
|
-
* v2.7 — Get all extracted dates, optionally filtered by document ids.
|
|
419
|
-
*/
|
|
420
|
-
getDates(documentIds?: string[]): ExtractedDate[];
|
|
421
|
-
/**
|
|
422
|
-
* v2.7 — Get all extracted preferences, optionally filtered by document ids.
|
|
423
|
-
*/
|
|
424
|
-
getPreferences(documentIds?: string[]): ExtractedPreference[];
|
|
425
|
-
/**
|
|
426
|
-
* v2.7 — Search with automatic strategy selection based on question type.
|
|
427
|
-
* Classifies the query and routes to the appropriate pipeline.
|
|
428
|
-
*/
|
|
429
|
-
smartQuery(query: string, options?: SearchOptions): SearchResult[];
|
|
430
308
|
/**
|
|
431
309
|
* Convert qmd results to ClawVault SearchResult format
|
|
432
310
|
*/
|
|
@@ -437,11 +315,6 @@ declare class SearchEngine {
|
|
|
437
315
|
* Convert qmd:// URI to file path
|
|
438
316
|
*/
|
|
439
317
|
private qmdUriToPath;
|
|
440
|
-
/**
|
|
441
|
-
* v2.8 — Filter superseded observation lines from snippet text.
|
|
442
|
-
* Ensures search results prefer the latest version of knowledge.
|
|
443
|
-
*/
|
|
444
|
-
private stripSupersededFromSnippet;
|
|
445
318
|
/**
|
|
446
319
|
* Clean up qmd snippet format
|
|
447
320
|
*/
|
|
@@ -455,7 +328,7 @@ declare class SearchEngine {
|
|
|
455
328
|
*/
|
|
456
329
|
get size(): number;
|
|
457
330
|
/**
|
|
458
|
-
* Clear the local document cache
|
|
331
|
+
* Clear the local document cache
|
|
459
332
|
*/
|
|
460
333
|
clear(): void;
|
|
461
334
|
/**
|
|
@@ -480,15 +353,93 @@ declare function extractWikiLinks(content: string): string[];
|
|
|
480
353
|
*/
|
|
481
354
|
declare function extractTags(content: string): string[];
|
|
482
355
|
|
|
483
|
-
|
|
484
|
-
|
|
356
|
+
/**
|
|
357
|
+
* ClawVault Hybrid Search — BM25 + Semantic Embeddings + RRF
|
|
358
|
+
*
|
|
359
|
+
* Proven in LongMemEval benchmarks:
|
|
360
|
+
* - v28 pipeline: 57.0% overall (up from 52.6% with BM25-only)
|
|
361
|
+
* - Multi-session: 45.9% (up from 28.6%)
|
|
362
|
+
* - Single-session-user: 85.7% (up from 72.9%)
|
|
363
|
+
*
|
|
364
|
+
* Architecture:
|
|
365
|
+
* 1. BM25 via existing qmd search
|
|
366
|
+
* 2. Semantic via @huggingface/transformers (all-MiniLM-L6-v2)
|
|
367
|
+
* 3. Reciprocal Rank Fusion (k=60)
|
|
368
|
+
*/
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Compute embedding for a text string
|
|
372
|
+
*/
|
|
373
|
+
declare function embed(text: string): Promise<Float32Array>;
|
|
374
|
+
/**
|
|
375
|
+
* Compute embeddings for multiple texts
|
|
376
|
+
*/
|
|
377
|
+
declare function embedBatch(texts: string[]): Promise<Float32Array[]>;
|
|
378
|
+
/**
|
|
379
|
+
* Cosine similarity between two normalized vectors
|
|
380
|
+
*/
|
|
381
|
+
declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
|
|
382
|
+
/**
|
|
383
|
+
* Embedding cache — stores embeddings on disk alongside vault files
|
|
384
|
+
*/
|
|
385
|
+
declare class EmbeddingCache {
|
|
386
|
+
private cachePath;
|
|
387
|
+
private cache;
|
|
388
|
+
private dirty;
|
|
389
|
+
constructor(vaultPath: string);
|
|
390
|
+
/**
|
|
391
|
+
* Load cache from disk
|
|
392
|
+
*/
|
|
393
|
+
load(): void;
|
|
394
|
+
/**
|
|
395
|
+
* Save cache to disk
|
|
396
|
+
*/
|
|
397
|
+
save(): void;
|
|
398
|
+
get(key: string): Float32Array | undefined;
|
|
399
|
+
set(key: string, embedding: Float32Array): void;
|
|
400
|
+
has(key: string): boolean;
|
|
401
|
+
entries(): IterableIterator<[string, Float32Array]>;
|
|
402
|
+
get size(): number;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Reciprocal Rank Fusion of two ranked lists
|
|
406
|
+
*/
|
|
407
|
+
declare function reciprocalRankFusion(list1: {
|
|
408
|
+
id: string;
|
|
409
|
+
score: number;
|
|
410
|
+
}[], list2: {
|
|
411
|
+
id: string;
|
|
412
|
+
score: number;
|
|
413
|
+
}[], k?: number): {
|
|
414
|
+
id: string;
|
|
415
|
+
score: number;
|
|
416
|
+
}[];
|
|
417
|
+
/**
|
|
418
|
+
* Semantic search against embedding cache
|
|
419
|
+
*/
|
|
420
|
+
declare function semanticSearch(query: string, cache: EmbeddingCache, topK?: number): Promise<{
|
|
421
|
+
id: string;
|
|
422
|
+
score: number;
|
|
423
|
+
}[]>;
|
|
424
|
+
/**
|
|
425
|
+
* Hybrid search: combines BM25 results with semantic results via RRF
|
|
426
|
+
*/
|
|
427
|
+
declare function hybridSearch(query: string, bm25Results: SearchResult[], cache: EmbeddingCache, options?: {
|
|
428
|
+
topK?: number;
|
|
429
|
+
rrfK?: number;
|
|
430
|
+
}): Promise<SearchResult[]>;
|
|
431
|
+
|
|
432
|
+
declare const OBSERVE_PROVIDERS: readonly ["anthropic", "openai", "gemini", "xai", "openclaw"];
|
|
433
|
+
declare const OBSERVER_COMPRESSION_PROVIDERS: readonly ["anthropic", "openai", "gemini", "xai", "openai-compatible", "ollama", "openclaw", "minimax", "zai"];
|
|
485
434
|
declare const THEMES: readonly ["neural", "minimal", "none"];
|
|
486
435
|
declare const CONTEXT_PROFILES: readonly ["default", "planning", "incident", "handoff", "auto"];
|
|
436
|
+
declare const FACT_EXTRACTION_MODES: readonly ["off", "rule", "llm", "hybrid"];
|
|
487
437
|
type ObserveProvider = (typeof OBSERVE_PROVIDERS)[number];
|
|
488
438
|
type ObserverCompressionProvider = (typeof OBSERVER_COMPRESSION_PROVIDERS)[number];
|
|
489
439
|
type Theme = (typeof THEMES)[number];
|
|
490
440
|
type ContextProfile = (typeof CONTEXT_PROFILES)[number];
|
|
491
|
-
type
|
|
441
|
+
type FactExtractionMode$1 = (typeof FACT_EXTRACTION_MODES)[number];
|
|
442
|
+
type ManagedConfigKey = 'name' | 'categories' | 'theme' | 'observe.model' | 'observe.provider' | 'observer.compression.provider' | 'observer.compression.model' | 'observer.compression.baseUrl' | 'observer.compression.apiKey' | 'observer.factExtractionMode' | 'context.maxResults' | 'context.defaultProfile' | 'graph.maxHops' | 'inject.maxResults' | 'inject.useLlm' | 'inject.scope';
|
|
492
443
|
interface RouteRule {
|
|
493
444
|
pattern: string;
|
|
494
445
|
target: string;
|
|
@@ -509,6 +460,198 @@ declare function removeRouteRule(vaultPath: string, pattern: string): boolean;
|
|
|
509
460
|
declare function matchRouteRule(text: string, routes: RouteRule[]): RouteRule | null;
|
|
510
461
|
declare function testRouteRule(vaultPath: string, text: string): RouteRule | null;
|
|
511
462
|
|
|
463
|
+
/**
|
|
464
|
+
* LLM Adapter for fact extraction.
|
|
465
|
+
*
|
|
466
|
+
* Provides a unified interface for calling LLMs to extract facts from text.
|
|
467
|
+
* Currently supports Gemini Flash as the primary adapter, with fallback to
|
|
468
|
+
* the existing LLM provider infrastructure.
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
type FactExtractionMode = 'off' | 'rule' | 'llm' | 'hybrid';
|
|
472
|
+
interface LlmAdapterOptions {
|
|
473
|
+
provider?: LlmProvider | null;
|
|
474
|
+
model?: string;
|
|
475
|
+
temperature?: number;
|
|
476
|
+
maxTokens?: number;
|
|
477
|
+
fetchImpl?: typeof fetch;
|
|
478
|
+
}
|
|
479
|
+
interface LlmAdapter {
|
|
480
|
+
/**
|
|
481
|
+
* Call the LLM with a prompt and return the response text.
|
|
482
|
+
*/
|
|
483
|
+
call(prompt: string): Promise<string>;
|
|
484
|
+
/**
|
|
485
|
+
* Check if the adapter is available (has valid credentials).
|
|
486
|
+
*/
|
|
487
|
+
isAvailable(): boolean;
|
|
488
|
+
/**
|
|
489
|
+
* Get the provider name for this adapter.
|
|
490
|
+
*/
|
|
491
|
+
getProvider(): LlmProvider | null;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Create a Gemini Flash adapter for fact extraction.
|
|
495
|
+
* Uses the Gemini API with the flash model optimized for speed.
|
|
496
|
+
*/
|
|
497
|
+
declare function createGeminiFlashAdapter(options?: LlmAdapterOptions): LlmAdapter;
|
|
498
|
+
/**
|
|
499
|
+
* Create an LLM adapter using the default provider resolution.
|
|
500
|
+
* Falls back through providers: openclaw -> anthropic -> openai -> gemini -> xai
|
|
501
|
+
*/
|
|
502
|
+
declare function createDefaultAdapter(options?: LlmAdapterOptions): LlmAdapter;
|
|
503
|
+
/**
|
|
504
|
+
* Create an LLM adapter for fact extraction based on configuration.
|
|
505
|
+
*
|
|
506
|
+
* Priority:
|
|
507
|
+
* 1. If provider is explicitly specified, use that
|
|
508
|
+
* 2. If Gemini API key is available, prefer Gemini Flash for speed
|
|
509
|
+
* 3. If Ollama is running locally, use Ollama (free, always available)
|
|
510
|
+
* 4. Fall back to default provider resolution
|
|
511
|
+
*/
|
|
512
|
+
declare function createFactExtractionAdapter(options?: LlmAdapterOptions): LlmAdapter;
|
|
513
|
+
/**
|
|
514
|
+
* Create an LLM function compatible with extractFactsLlm.
|
|
515
|
+
* This wraps the adapter into the function signature expected by fact-extractor.ts.
|
|
516
|
+
*/
|
|
517
|
+
declare function createLlmFunction(adapter: LlmAdapter): ((prompt: string) => Promise<string>) | undefined;
|
|
518
|
+
/**
|
|
519
|
+
* Resolve the effective fact extraction mode based on configuration and availability.
|
|
520
|
+
*
|
|
521
|
+
* - 'off': Never extract facts
|
|
522
|
+
* - 'rule': Only use rule-based extraction (no LLM)
|
|
523
|
+
* - 'llm': Prefer LLM extraction, fall back to rules if LLM unavailable
|
|
524
|
+
* - 'hybrid': Use both LLM and rules, merge results (future enhancement)
|
|
525
|
+
*/
|
|
526
|
+
declare function resolveFactExtractionMode(configuredMode: FactExtractionMode | undefined, adapter?: LlmAdapter): {
|
|
527
|
+
mode: FactExtractionMode;
|
|
528
|
+
useLlm: boolean;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Write-time fact extraction for ClawVault v3.
|
|
533
|
+
*
|
|
534
|
+
* When a memory is stored, this module extracts structured facts:
|
|
535
|
+
* (entity, relation, value, timestamp, confidence)
|
|
536
|
+
*
|
|
537
|
+
* Two modes:
|
|
538
|
+
* 1. LLM extraction (accurate but requires API key)
|
|
539
|
+
* 2. Rule-based extraction (fast, no deps, lower quality)
|
|
540
|
+
*
|
|
541
|
+
* Extracted facts are stored alongside raw markdown in .clawvault/facts.jsonl
|
|
542
|
+
* and used to build the entity-relationship graph.
|
|
543
|
+
*/
|
|
544
|
+
interface ExtractedFact {
|
|
545
|
+
/** Unique ID for this fact */
|
|
546
|
+
id: string;
|
|
547
|
+
/** The entity this fact is about (person, place, thing) */
|
|
548
|
+
entity: string;
|
|
549
|
+
/** Normalized entity name for dedup */
|
|
550
|
+
entityNorm: string;
|
|
551
|
+
/** Relationship type (e.g., "prefers", "works_at", "lives_in", "bought") */
|
|
552
|
+
relation: string;
|
|
553
|
+
/** The value/object of the relation */
|
|
554
|
+
value: string;
|
|
555
|
+
/** When this fact was established */
|
|
556
|
+
validFrom: string;
|
|
557
|
+
/** When this fact was superseded (null = still current) */
|
|
558
|
+
validUntil: string | null;
|
|
559
|
+
/** Confidence 0-1 */
|
|
560
|
+
confidence: number;
|
|
561
|
+
/** Category: preference, fact, decision, entity, event */
|
|
562
|
+
category: 'preference' | 'fact' | 'decision' | 'entity' | 'event' | 'other';
|
|
563
|
+
/** Source file path (relative to vault) */
|
|
564
|
+
source: string;
|
|
565
|
+
/** Raw text this was extracted from */
|
|
566
|
+
rawText: string;
|
|
567
|
+
}
|
|
568
|
+
interface ExtractionResult {
|
|
569
|
+
facts: ExtractedFact[];
|
|
570
|
+
/** Number of conflicts resolved (existing facts updated) */
|
|
571
|
+
conflictsResolved: number;
|
|
572
|
+
/** Processing time in ms */
|
|
573
|
+
durationMs: number;
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Normalize an entity name for dedup matching.
|
|
577
|
+
* "Pedro Sobral" -> "pedro sobral"
|
|
578
|
+
* "pedro" -> "pedro"
|
|
579
|
+
* "Dr. Smith" -> "dr smith"
|
|
580
|
+
*/
|
|
581
|
+
declare function normalizeEntity(name: string): string;
|
|
582
|
+
/**
|
|
583
|
+
* Generate a deterministic fact ID from entity + relation + value.
|
|
584
|
+
*/
|
|
585
|
+
declare function factId(entity: string, relation: string, value: string): string;
|
|
586
|
+
/**
|
|
587
|
+
* Extract facts from raw text using rule-based patterns.
|
|
588
|
+
* Fast, no LLM needed, but lower quality.
|
|
589
|
+
*/
|
|
590
|
+
declare function extractFactsRuleBased(text: string, source: string, timestamp?: string): ExtractedFact[];
|
|
591
|
+
/**
|
|
592
|
+
* Extract facts using an LLM. Higher quality but requires API key.
|
|
593
|
+
* Falls back to rule-based if LLM unavailable.
|
|
594
|
+
*/
|
|
595
|
+
declare function extractFactsLlm(text: string, source: string, timestamp?: string, llmFn?: (prompt: string) => Promise<string>): Promise<ExtractedFact[]>;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Fact Store — persistent storage + conflict resolution for extracted facts.
|
|
599
|
+
*
|
|
600
|
+
* Facts are stored in .clawvault/facts.jsonl (append-only log).
|
|
601
|
+
* An in-memory index enables fast lookup by entity, relation, category.
|
|
602
|
+
* Conflict resolution: when a new fact matches an existing one by entity+relation,
|
|
603
|
+
* the old fact gets validUntil set and the new fact replaces it.
|
|
604
|
+
*/
|
|
605
|
+
|
|
606
|
+
interface FactStoreStats {
|
|
607
|
+
totalFacts: number;
|
|
608
|
+
activeFacts: number;
|
|
609
|
+
supersededFacts: number;
|
|
610
|
+
entities: number;
|
|
611
|
+
relations: number;
|
|
612
|
+
}
|
|
613
|
+
declare class FactStore {
|
|
614
|
+
private facts;
|
|
615
|
+
private byEntity;
|
|
616
|
+
private byRelation;
|
|
617
|
+
private byCategory;
|
|
618
|
+
private factsPath;
|
|
619
|
+
private dirty;
|
|
620
|
+
constructor(vaultPath: string);
|
|
621
|
+
/** Load facts from disk */
|
|
622
|
+
load(): void;
|
|
623
|
+
/** Add facts with conflict resolution. Returns number of conflicts resolved. */
|
|
624
|
+
addFacts(newFacts: ExtractedFact[]): number;
|
|
625
|
+
/** Find an existing fact that conflicts with the new one */
|
|
626
|
+
private findConflict;
|
|
627
|
+
/** Check if two values are similar enough to be considered the same fact */
|
|
628
|
+
private isSimilarValue;
|
|
629
|
+
/** Relations where only one value can be active at a time */
|
|
630
|
+
private isExclusiveRelation;
|
|
631
|
+
/** Index a fact in all lookup maps */
|
|
632
|
+
private indexFact;
|
|
633
|
+
/** Save facts to disk (full rewrite for consistency) */
|
|
634
|
+
save(): void;
|
|
635
|
+
/** Append new facts to disk (faster than full rewrite) */
|
|
636
|
+
append(facts: ExtractedFact[]): void;
|
|
637
|
+
/** Get all active facts for an entity */
|
|
638
|
+
getEntityFacts(entity: string): ExtractedFact[];
|
|
639
|
+
/** Get all active facts for a relation */
|
|
640
|
+
getRelationFacts(relation: string): ExtractedFact[];
|
|
641
|
+
/** Get all active facts in a category */
|
|
642
|
+
getCategoryFacts(category: string): ExtractedFact[];
|
|
643
|
+
/** Get all active preferences */
|
|
644
|
+
getPreferences(): ExtractedFact[];
|
|
645
|
+
/** Search facts by text query (simple keyword match) */
|
|
646
|
+
searchFacts(query: string): ExtractedFact[];
|
|
647
|
+
/** Get facts valid at a specific time */
|
|
648
|
+
getFactsAt(timestamp: string): ExtractedFact[];
|
|
649
|
+
/** Get stats */
|
|
650
|
+
stats(): FactStoreStats;
|
|
651
|
+
/** Get all facts (for testing/debugging) */
|
|
652
|
+
getAllFacts(): ExtractedFact[];
|
|
653
|
+
}
|
|
654
|
+
|
|
512
655
|
/**
|
|
513
656
|
* Transition Ledger for ClawVault
|
|
514
657
|
* Logs task status transitions to JSONL files and supports querying.
|
|
@@ -565,7 +708,7 @@ interface CompressorOptions {
|
|
|
565
708
|
now?: () => Date;
|
|
566
709
|
fetchImpl?: typeof fetch;
|
|
567
710
|
}
|
|
568
|
-
type CompressionProvider = 'anthropic' | 'openai' | 'gemini' | 'openai-compatible' | 'ollama';
|
|
711
|
+
type CompressionProvider = 'anthropic' | 'openai' | 'gemini' | 'xai' | 'openai-compatible' | 'ollama' | 'minimax' | 'zai';
|
|
569
712
|
declare class Compressor {
|
|
570
713
|
private readonly provider?;
|
|
571
714
|
private readonly model?;
|
|
@@ -575,6 +718,13 @@ declare class Compressor {
|
|
|
575
718
|
private readonly fetchImpl;
|
|
576
719
|
constructor(options?: CompressorOptions);
|
|
577
720
|
compress(messages: string[], existingObservations: string): Promise<string>;
|
|
721
|
+
private sanitizeIncomingMessages;
|
|
722
|
+
private sanitizeIncomingMessage;
|
|
723
|
+
private normalizeMessageRole;
|
|
724
|
+
private isConversationRolePrefix;
|
|
725
|
+
private shouldDropMessageRole;
|
|
726
|
+
private stripNoisyData;
|
|
727
|
+
private isLikelyStructuredNoise;
|
|
578
728
|
private resolveProvider;
|
|
579
729
|
private resolveConfiguredProvider;
|
|
580
730
|
private resolveProviderFromEnv;
|
|
@@ -588,6 +738,7 @@ declare class Compressor {
|
|
|
588
738
|
private extractOpenAIContent;
|
|
589
739
|
private callAnthropic;
|
|
590
740
|
private callOpenAI;
|
|
741
|
+
private callXAI;
|
|
591
742
|
private callOpenAICompatible;
|
|
592
743
|
private callGemini;
|
|
593
744
|
private normalizeLlmOutput;
|
|
@@ -696,7 +847,6 @@ interface ActiveObserveOptions {
|
|
|
696
847
|
reflectThreshold?: number;
|
|
697
848
|
model?: string;
|
|
698
849
|
extractTasks?: boolean;
|
|
699
|
-
maxSessions?: number;
|
|
700
850
|
}
|
|
701
851
|
interface ActiveObservationCandidate {
|
|
702
852
|
sessionId: string;
|
|
@@ -851,4 +1001,4 @@ declare function runReflection(options: ReflectOptions): Promise<ReflectResult>;
|
|
|
851
1001
|
declare const VERSION: string;
|
|
852
1002
|
declare function registerCommanderCommands(program: Command): Command;
|
|
853
1003
|
|
|
854
|
-
export { type ActiveObservationCandidate, type ActiveObservationFailure, type ActiveObserveOptions, type ActiveObserveResult, type ArchiveObservationsOptions, type ArchiveObservationsResult, Category, ClawVault, type CompressionProvider, Compressor, type CompressorOptions, type ContextProfile as ConfigDefaultProfile, Document,
|
|
1004
|
+
export { type ActiveObservationCandidate, type ActiveObservationFailure, type ActiveObserveOptions, type ActiveObserveResult, type ArchiveObservationsOptions, type ArchiveObservationsResult, Category, ClawVault, type CompressionProvider, Compressor, type CompressorOptions, type ContextProfile as ConfigDefaultProfile, Document, EmbeddingCache, type ExtractedFact, type ExtractionResult, type FactExtractionMode$1 as FactExtractionMode, FactStore, type FactStoreStats, HandoffDocument, type LlmAdapter, type LlmAdapterOptions, LlmProvider, type ManagedConfigKey, MemoryType, type MigrateCommandOptions, type MigrateResult, type MigrationAction, MigrationIssueType, type ObserveCursorEntry, type ObserveCursorStore, type ObserveProvider, Observer, type ObserverCompressionProvider, type ObserverCompressor, type ObserverOptions, type ObserverReflector, type ObserverStalenessResult, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdConfigurationError, type QmdErrorCode, type QmdErrorDetails, QmdUnavailableError, type ReflectOptions, type ReflectResult, Reflector, type ReflectorOptions, type RouteRule, SUPPORTED_CONFIG_KEYS, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, SyncOptions, SyncResult, type Theme, type TransitionEvent, VERSION, VaultConfig, addRouteRule, appendTransition, archiveObservations, buildTransitionEvent, cosineSimilarity, countBlockedTransitions, createDefaultAdapter, createFactExtractionAdapter, createGeminiFlashAdapter, createLlmFunction, createVault, embed, embedBatch, extractFactsLlm, extractFactsRuleBased, extractTags, extractWikiLinks, factId, findVault, formatTransitionsTable, getConfig, getConfigValue, getObserverStaleness, getQmdErrorDetails, getScaledObservationThresholdBytes, hasQmd, hybridSearch, isRegression, listConfig, listRouteRules, matchRouteRule, migrate, migrateCommand, normalizeEntity, observeActiveSessions, parseSessionFile, parseSessionSourceLabel, qmdEmbed, qmdUpdate, queryTransitions, readAllTransitions, reciprocalRankFusion, registerCommanderCommands, registerMigrateCommand, removeRouteRule, resetConfig, resolveFactExtractionMode, runReflection, semanticSearch, setConfigValue, testRouteRule };
|