hippo-memory 1.70.0 → 1.71.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 +1 -1
- package/dist/agent-memories/claude-code.d.ts +4 -2
- package/dist/agent-memories/claude-code.js +14 -5
- package/dist/agent-memories/files.js +23 -12
- package/dist/agent-memories/markdown.d.ts +1 -3
- package/dist/agent-memories/markdown.js +1 -3
- package/dist/agent-memories/report.js +2 -1
- package/dist/agent-memories/sync.d.ts +4 -2
- package/dist/agent-memories/sync.js +10 -5
- package/dist/api/assemble.d.ts +7 -44
- package/dist/api/assemble.js +2 -22
- package/dist/api/audit.d.ts +5 -1
- package/dist/api/audit.js +9 -1
- package/dist/api/auth.d.ts +13 -22
- package/dist/api/auth.js +34 -24
- package/dist/api/auto-sleep.js +2 -2
- package/dist/api/availability.d.ts +2 -15
- package/dist/api/availability.js +2 -15
- package/dist/api/context-select.js +3 -4
- package/dist/api/context-types.d.ts +10 -35
- package/dist/api/context.d.ts +5 -22
- package/dist/api/context.js +21 -38
- package/dist/api/dormant.d.ts +5 -21
- package/dist/api/dormant.js +7 -26
- package/dist/api/drill-down.d.ts +7 -46
- package/dist/api/drill-down.js +5 -26
- package/dist/api/forget.d.ts +5 -24
- package/dist/api/forget.js +5 -28
- package/dist/api/graph.d.ts +8 -0
- package/dist/api/graph.js +7 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/instruction-detect.js +16 -5
- package/dist/api/ledger-db.d.ts +2 -1
- package/dist/api/ledger-db.js +5 -3
- package/dist/api/memories.d.ts +5 -0
- package/dist/api/memories.js +7 -0
- package/dist/api/objects.d.ts +9 -0
- package/dist/api/objects.js +11 -0
- package/dist/api/on-store.js +5 -3
- package/dist/api/predictions.d.ts +9 -0
- package/dist/api/predictions.js +18 -0
- package/dist/api/promote.d.ts +13 -17
- package/dist/api/promote.js +11 -19
- package/dist/api/prompt-hook.d.ts +4 -4
- package/dist/api/prompt-hook.js +10 -9
- package/dist/api/recall-cli.d.ts +55 -0
- package/dist/api/recall-cli.js +94 -0
- package/dist/api/recall-core.js +14 -6
- package/dist/api/recall-finish.d.ts +53 -0
- package/dist/api/recall-finish.js +30 -0
- package/dist/api/recall-history.d.ts +17 -84
- package/dist/api/recall-history.js +15 -88
- package/dist/api/recall-pipeline.d.ts +2 -3
- package/dist/api/recall-pipeline.js +16 -9
- package/dist/api/recall-types.d.ts +64 -304
- package/dist/api/recall.d.ts +5 -33
- package/dist/api/recall.js +59 -60
- package/dist/api/refine.d.ts +7 -0
- package/dist/api/refine.js +10 -0
- package/dist/api/remember-local.d.ts +57 -0
- package/dist/api/remember-local.js +90 -0
- package/dist/api/remember.d.ts +18 -1
- package/dist/api/remember.js +13 -1
- package/dist/api/sleep-run.d.ts +1 -3
- package/dist/api/sleep-run.js +17 -21
- package/dist/api/sleep.d.ts +9 -28
- package/dist/api/tokens.d.ts +3 -10
- package/dist/api/tokens.js +3 -10
- package/dist/api/types.d.ts +6 -29
- package/dist/api/types.js +4 -22
- package/dist/capture/command.d.ts +4 -12
- package/dist/capture/command.js +6 -22
- package/dist/capture/compact.d.ts +4 -15
- package/dist/capture/compact.js +16 -25
- package/dist/capture/compaction-record.js +101 -69
- package/dist/capture/compaction-spool.d.ts +1 -1
- package/dist/capture/compaction-spool.js +1 -1
- package/dist/capture/session-digest.d.ts +1 -1
- package/dist/capture/session-digest.js +13 -7
- package/dist/capture/transcript.d.ts +2 -10
- package/dist/capture/transcript.js +4 -18
- package/dist/cli/api-context.d.ts +3 -0
- package/dist/cli/api-context.js +6 -0
- package/dist/cli/audit-prune.d.ts +6 -39
- package/dist/cli/audit-prune.js +6 -39
- package/dist/cli/audit.d.ts +1 -1
- package/dist/cli/audit.js +33 -34
- package/dist/cli/auth.d.ts +2 -2
- package/dist/cli/auth.js +57 -39
- package/dist/cli/briefs.d.ts +4 -4
- package/dist/cli/briefs.js +18 -22
- package/dist/cli/card.d.ts +2 -2
- package/dist/cli/card.js +31 -32
- package/dist/cli/client.d.ts +7 -27
- package/dist/cli/client.js +24 -43
- package/dist/cli/compact-resume-payload.js +3 -2
- package/dist/cli/context.d.ts +1 -2
- package/dist/cli/context.js +12 -8
- package/dist/cli/continuity.d.ts +6 -6
- package/dist/cli/continuity.js +62 -64
- package/dist/cli/correction-latency.d.ts +2 -14
- package/dist/cli/correction-latency.js +2 -14
- package/dist/cli/curate.d.ts +13 -17
- package/dist/cli/curate.js +68 -92
- package/dist/cli/dag.d.ts +4 -4
- package/dist/cli/dag.js +33 -27
- package/dist/cli/decisions.d.ts +4 -4
- package/dist/cli/decisions.js +33 -47
- package/dist/cli/eval.js +15 -13
- package/dist/cli/exit.d.ts +6 -0
- package/dist/cli/exit.js +11 -0
- package/dist/cli/explain.d.ts +1 -2
- package/dist/cli/explain.js +6 -4
- package/dist/cli/flag-values.d.ts +6 -1
- package/dist/cli/flag-values.js +27 -10
- package/dist/cli/flags.d.ts +1 -0
- package/dist/cli/flags.js +1 -1
- package/dist/cli/github.d.ts +14 -0
- package/dist/{connectors/github/cli-impl.js → cli/github.js} +43 -71
- package/dist/cli/goals.d.ts +2 -2
- package/dist/cli/goals.js +46 -50
- package/dist/cli/hook-runtime.d.ts +9 -27
- package/dist/cli/hook-runtime.js +15 -31
- package/dist/cli/init.d.ts +2 -2
- package/dist/cli/init.js +6 -12
- package/dist/cli/install-steps.js +3 -12
- package/dist/cli/last-sleep.d.ts +2 -1
- package/dist/cli/last-sleep.js +3 -0
- package/dist/cli/maintenance.d.ts +4 -4
- package/dist/cli/maintenance.js +14 -19
- package/dist/cli/object-verbs.js +4 -3
- package/dist/cli/owner-validation.d.ts +5 -28
- package/dist/cli/owner-validation.js +5 -28
- package/dist/cli/playbooks.d.ts +4 -4
- package/dist/cli/playbooks.js +23 -28
- package/dist/cli/print.d.ts +2 -5
- package/dist/cli/print.js +1 -4
- package/dist/cli/projects.d.ts +2 -2
- package/dist/cli/projects.js +1 -3
- package/dist/cli/provenance-coverage.d.ts +2 -6
- package/dist/cli/provenance-coverage.js +2 -6
- package/dist/cli/quality-repair-once.js +2 -2
- package/dist/cli/recall.d.ts +2 -4
- package/dist/cli/recall.js +55 -131
- package/dist/cli/refine-llm.d.ts +5 -31
- package/dist/cli/refine-llm.js +9 -36
- package/dist/cli/remember.d.ts +3 -3
- package/dist/cli/remember.js +122 -180
- package/dist/cli/scheduler.d.ts +2 -17
- package/dist/cli/scheduler.js +12 -18
- package/dist/cli/serve.js +21 -12
- package/dist/cli/session-hooks.d.ts +10 -18
- package/dist/cli/session-hooks.js +112 -113
- package/dist/cli/setup.d.ts +4 -4
- package/dist/cli/setup.js +19 -21
- package/dist/cli/shared.d.ts +9 -23
- package/dist/cli/shared.js +9 -32
- package/dist/cli/slack.d.ts +2 -2
- package/dist/cli/slack.js +19 -23
- package/dist/cli/sleep.d.ts +3 -2
- package/dist/cli/sleep.js +15 -16
- package/dist/cli/status.d.ts +9 -12
- package/dist/cli/status.js +55 -98
- package/dist/cli/stdin.d.ts +4 -6
- package/dist/cli/stdin.js +2 -3
- package/dist/cli/transfer.d.ts +9 -9
- package/dist/cli/transfer.js +66 -89
- package/dist/cli/usage.js +11 -5
- package/dist/cli.d.ts +66 -448
- package/dist/cli.js +87 -263
- package/dist/connectors/github/backfill.d.ts +5 -25
- package/dist/connectors/github/backfill.js +14 -49
- package/dist/connectors/github/deletion.d.ts +4 -18
- package/dist/connectors/github/deletion.js +2 -15
- package/dist/connectors/github/dlq.d.ts +8 -33
- package/dist/connectors/github/dlq.js +12 -29
- package/dist/connectors/github/ingest.d.ts +2 -6
- package/dist/connectors/github/ingest.js +4 -10
- package/dist/connectors/github/octokit-client.d.ts +4 -16
- package/dist/connectors/github/octokit-client.js +27 -24
- package/dist/connectors/github/ratelimit.d.ts +3 -14
- package/dist/connectors/github/ratelimit.js +3 -14
- package/dist/connectors/github/scope.d.ts +3 -5
- package/dist/connectors/github/scope.js +3 -5
- package/dist/connectors/github/signature.d.ts +4 -26
- package/dist/connectors/github/signature.js +4 -26
- package/dist/connectors/github/tenant-routing.d.ts +2 -24
- package/dist/connectors/github/tenant-routing.js +4 -26
- package/dist/connectors/github/transform.js +2 -16
- package/dist/connectors/github/types.d.ts +3 -15
- package/dist/connectors/github/types.js +2 -9
- package/dist/connectors/github/webhook.d.ts +2 -16
- package/dist/connectors/github/webhook.js +6 -22
- package/dist/connectors/slack/backfill.d.ts +4 -17
- package/dist/connectors/slack/backfill.js +4 -13
- package/dist/connectors/slack/dlq.d.ts +2 -19
- package/dist/connectors/slack/dlq.js +2 -19
- package/dist/connectors/slack/ingest.d.ts +2 -3
- package/dist/connectors/slack/ingest.js +2 -3
- package/dist/connectors/slack/scope.d.ts +2 -8
- package/dist/connectors/slack/scope.js +2 -8
- package/dist/connectors/slack/signature.d.ts +1 -6
- package/dist/connectors/slack/tenant-routing.d.ts +2 -19
- package/dist/connectors/slack/tenant-routing.js +2 -21
- package/dist/connectors/slack/transform.d.ts +2 -18
- package/dist/connectors/slack/transform.js +2 -18
- package/dist/connectors/slack/types.d.ts +3 -9
- package/dist/connectors/slack/types.js +2 -4
- package/dist/connectors/slack/web-client.js +33 -27
- package/dist/connectors/slack/webhook.d.ts +2 -19
- package/dist/connectors/slack/webhook.js +5 -26
- package/dist/connectors/slack/workspaces.d.ts +4 -24
- package/dist/connectors/slack/workspaces.js +4 -24
- package/dist/consolidate/conflicts.js +6 -14
- package/dist/consolidate/dag-summary.d.ts +8 -0
- package/dist/consolidate/dag-summary.js +41 -0
- package/dist/consolidate/dag.d.ts +5 -28
- package/dist/consolidate/dag.js +14 -75
- package/dist/consolidate/decay.js +7 -19
- package/dist/consolidate/dedupe.d.ts +6 -52
- package/dist/consolidate/dedupe.js +13 -71
- package/dist/consolidate/flush-units.d.ts +3 -4
- package/dist/consolidate/flush-units.js +3 -3
- package/dist/consolidate/half-life-migration.d.ts +3 -26
- package/dist/consolidate/half-life-migration.js +11 -28
- package/dist/consolidate/llm-passes.js +4 -21
- package/dist/consolidate/memory-value-weights.d.ts +2 -13
- package/dist/consolidate/memory-value-weights.js +2 -13
- package/dist/consolidate/memory-value.d.ts +11 -84
- package/dist/consolidate/memory-value.js +16 -104
- package/dist/consolidate/merge.js +10 -31
- package/dist/consolidate/merged-row.js +2 -1
- package/dist/consolidate/physics-pass.js +1 -3
- package/dist/consolidate/replay.d.ts +6 -38
- package/dist/consolidate/replay.js +14 -52
- package/dist/consolidate/run.js +1 -1
- package/dist/consolidate/sleep.d.ts +1 -8
- package/dist/consolidate/sleep.js +5 -17
- package/dist/consolidate/trace.d.ts +3 -18
- package/dist/consolidate/trace.js +3 -18
- package/dist/consolidate/traces.js +6 -22
- package/dist/core/ablation.d.ts +4 -91
- package/dist/core/ablation.js +4 -91
- package/dist/core/ambient.d.ts +1 -8
- package/dist/core/ambient.js +1 -8
- package/dist/core/capture-contract.d.ts +4 -2
- package/dist/core/capture-contract.js +4 -2
- package/dist/core/card.d.ts +4 -1
- package/dist/core/card.js +8 -0
- package/dist/core/compare.d.ts +11 -67
- package/dist/core/compare.js +9 -63
- package/dist/core/config.d.ts +10 -24
- package/dist/core/config.js +13 -14
- package/dist/core/handoff.d.ts +1 -7
- package/dist/core/handoff.js +1 -7
- package/dist/core/memory-quality.js +1 -1
- package/dist/core/memory.d.ts +41 -164
- package/dist/core/memory.js +51 -221
- package/dist/core/package-root.d.ts +3 -0
- package/dist/core/package-root.js +5 -0
- package/dist/core/physics-config.d.ts +1 -4
- package/dist/core/physics-config.js +3 -8
- package/dist/core/physics.d.ts +15 -61
- package/dist/core/physics.js +59 -122
- package/dist/core/project-identity.d.ts +17 -58
- package/dist/core/project-identity.js +17 -38
- package/dist/core/project-remote.js +13 -2
- package/dist/core/raw-append-only.d.ts +5 -0
- package/dist/core/raw-append-only.js +7 -0
- package/dist/core/salience.d.ts +1 -7
- package/dist/core/salience.js +1 -7
- package/dist/dashboard/dashboard-actions.js +2 -2
- package/dist/dashboard/dashboard-snapshot.d.ts +2 -1
- package/dist/dashboard/dashboard-snapshot.js +11 -2
- package/dist/dashboard/dashboard-types.d.ts +2 -1
- package/dist/dashboard/dashboard.d.ts +1 -0
- package/dist/dashboard/dashboard.js +50 -4
- package/dist/db/busy.d.ts +1 -1
- package/dist/db/busy.js +17 -8
- package/dist/db/connect.d.ts +1 -0
- package/dist/db/connect.js +3 -3
- package/dist/db/migrate.js +3 -3
- package/dist/db/migrations/types.d.ts +2 -5
- package/dist/db/migrations/v14.js +2 -3
- package/dist/db/migrations/v15.js +2 -8
- package/dist/db/migrations/v16.js +2 -3
- package/dist/db/migrations/v17.js +2 -3
- package/dist/db/migrations/v19.js +2 -5
- package/dist/db/migrations/v20.js +2 -7
- package/dist/db/migrations/v22.js +4 -17
- package/dist/db/migrations/v23.js +3 -14
- package/dist/db/migrations/v24.js +2 -4
- package/dist/db/migrations/v25.js +3 -8
- package/dist/db/migrations/v26.js +2 -13
- package/dist/db/migrations/v27.js +3 -11
- package/dist/db/migrations/v28.js +2 -14
- package/dist/db/migrations/v29.js +4 -18
- package/dist/db/migrations/v30.js +4 -16
- package/dist/db/migrations/v31.js +2 -15
- package/dist/db/migrations/v32.js +4 -22
- package/dist/db/migrations/v33.js +2 -15
- package/dist/db/migrations/v34.js +2 -11
- package/dist/db/migrations/v35.js +2 -11
- package/dist/db/migrations/v36.js +2 -11
- package/dist/db/migrations/v37.js +8 -33
- package/dist/db/migrations/v38.js +5 -38
- package/dist/db/migrations/v39.js +9 -20
- package/dist/db/migrations/v40.js +2 -9
- package/dist/db/migrations/v41.js +2 -24
- package/dist/db/migrations/v43.js +1 -1
- package/dist/db/migrations/v44.js +2 -8
- package/dist/db/migrations/v45.js +2 -7
- package/dist/db/migrations/v47.js +2 -3
- package/dist/db/migrations/v51.js +1 -1
- package/dist/db/open.d.ts +2 -0
- package/dist/db/open.js +17 -1
- package/dist/db/physics-state.d.ts +6 -22
- package/dist/db/physics-state.js +25 -36
- package/dist/db/raw-archive-mirror-cleanup.d.ts +2 -17
- package/dist/db/raw-archive-mirror-cleanup.js +2 -17
- package/dist/db/vector-store.d.ts +2 -0
- package/dist/db/vector-store.js +8 -1
- package/dist/doctor.js +74 -19
- package/dist/entry/session-text.js +2 -1
- package/dist/eval/eval-stats.d.ts +15 -53
- package/dist/eval/eval-stats.js +12 -42
- package/dist/eval/eval-suite.d.ts +2 -13
- package/dist/eval/eval-suite.js +74 -34
- package/dist/eval/eval.d.ts +6 -24
- package/dist/eval/eval.js +7 -34
- package/dist/eval/judgment.d.ts +0 -3
- package/dist/eval/judgment.js +19 -11
- package/dist/extensions/openclaw-plugin/index.js +1 -1
- package/dist/graph/extract.d.ts +5 -27
- package/dist/graph/extract.js +7 -33
- package/dist/graph/recall.d.ts +7 -20
- package/dist/graph/recall.js +14 -76
- package/dist/graph/stream.d.ts +7 -39
- package/dist/graph/stream.js +11 -34
- package/dist/graph/view.d.ts +9 -35
- package/dist/graph/view.js +11 -39
- package/dist/hooks/codex-wrapper.js +2 -2
- package/dist/hooks/copilot.js +2 -1
- package/dist/hooks/hook-blocks.d.ts +6 -2
- package/dist/hooks/hook-blocks.js +37 -124
- package/dist/hooks/json-hooks.d.ts +4 -36
- package/dist/hooks/json-hooks.js +18 -57
- package/dist/hooks/opencode.d.ts +0 -38
- package/dist/hooks/opencode.js +9 -76
- package/dist/hooks/shared.d.ts +8 -17
- package/dist/hooks/shared.js +29 -20
- package/dist/importers/core.d.ts +12 -37
- package/dist/importers/core.js +9 -27
- package/dist/importers/markdown-parse.d.ts +8 -22
- package/dist/importers/markdown-parse.js +8 -25
- package/dist/importers/markdown.js +3 -12
- package/dist/importers/sources.js +7 -35
- package/dist/importers/vault.d.ts +2 -8
- package/dist/importers/vault.js +25 -81
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/dist/learn/autolearn.d.ts +14 -41
- package/dist/learn/autolearn.js +14 -41
- package/dist/learn/extract.js +2 -4
- package/dist/learn/forward-claim-detector.d.ts +6 -30
- package/dist/learn/forward-claim-detector.js +14 -66
- package/dist/learn/invalidation.d.ts +6 -18
- package/dist/learn/invalidation.js +9 -26
- package/dist/mcp/admin-tools.js +3 -5
- package/dist/mcp/memory-tools.js +4 -9
- package/dist/mcp/protocol.d.ts +8 -26
- package/dist/mcp/protocol.js +3 -6
- package/dist/mcp/recall-tools.js +3 -3
- package/dist/mcp/request.d.ts +3 -11
- package/dist/mcp/request.js +10 -26
- package/dist/mcp/server.d.ts +3 -9
- package/dist/mcp/server.js +5 -16
- package/dist/mcp/session-state.d.ts +1 -1
- package/dist/mcp/session-state.js +5 -11
- package/dist/mcp/stdio.d.ts +2 -6
- package/dist/mcp/stdio.js +48 -12
- package/dist/mcp/tools.js +5 -3
- package/dist/objects/customer-notes.d.ts +7 -42
- package/dist/objects/customer-notes.js +7 -48
- package/dist/objects/decisions.d.ts +12 -50
- package/dist/objects/decisions.js +15 -53
- package/dist/objects/incidents.d.ts +7 -38
- package/dist/objects/incidents.js +7 -41
- package/dist/objects/policies.d.ts +11 -89
- package/dist/objects/policies.js +11 -98
- package/dist/objects/processes.d.ts +7 -52
- package/dist/objects/processes.js +7 -61
- package/dist/objects/project-briefs.d.ts +11 -55
- package/dist/objects/project-briefs.js +14 -75
- package/dist/objects/skills.d.ts +7 -42
- package/dist/objects/skills.js +8 -54
- package/dist/postinstall.js +6 -19
- package/dist/predictions/planning-fallacy.d.ts +11 -34
- package/dist/rerankers/clef.js +3 -31
- package/dist/rerankers/cross-encoder.js +4 -6
- package/dist/rerankers/jev.js +9 -6
- package/dist/rerankers/llm.d.ts +2 -11
- package/dist/rerankers/llm.js +14 -14
- package/dist/rerankers/outage-warning.d.ts +2 -1
- package/dist/rerankers/outage-warning.js +2 -1
- package/dist/rerankers/remote.d.ts +1 -0
- package/dist/rerankers/remote.js +2 -0
- package/dist/rerankers/types.d.ts +2 -14
- package/dist/search/boosts.d.ts +0 -2
- package/dist/search/boosts.js +2 -2
- package/dist/search/goal-boost.d.ts +23 -0
- package/dist/search/goal-boost.js +90 -0
- package/dist/search/hybrid.d.ts +2 -0
- package/dist/search/multihop.js +2 -3
- package/dist/search/path-context.d.ts +5 -18
- package/dist/search/path-context.js +5 -18
- package/dist/search/physics-search.js +11 -8
- package/dist/search/rrf.d.ts +7 -35
- package/dist/search/rrf.js +5 -30
- package/dist/search/vector.d.ts +7 -0
- package/dist/search/vector.js +35 -5
- package/dist/server/auth.d.ts +9 -28
- package/dist/server/auth.js +32 -25
- package/dist/server/boot.d.ts +2 -21
- package/dist/server/boot.js +63 -96
- package/dist/server/client-ip.d.ts +3 -19
- package/dist/server/client-ip.js +5 -28
- package/dist/server/defaults.d.ts +3 -0
- package/dist/server/defaults.js +4 -0
- package/dist/server/key-check-bounds.d.ts +2 -1
- package/dist/server/lifecycle.d.ts +5 -4
- package/dist/server/lifecycle.js +19 -4
- package/dist/server/mcp-http.js +10 -44
- package/dist/server/rate-limit.d.ts +5 -18
- package/dist/server/rate-limit.js +4 -13
- package/dist/server/request.d.ts +4 -8
- package/dist/server/request.js +9 -17
- package/dist/server/route-table.js +42 -49
- package/dist/server/routes/admin.js +22 -28
- package/dist/server/routes/customer-notes.js +7 -12
- package/dist/server/routes/decisions.js +10 -17
- package/dist/server/routes/incidents.js +12 -20
- package/dist/server/routes/memories.js +12 -32
- package/dist/server/routes/object-routes.d.ts +0 -5
- package/dist/server/routes/object-routes.js +7 -15
- package/dist/server/routes/policies.js +10 -18
- package/dist/server/routes/predictions.js +13 -25
- package/dist/server/routes/processes.js +16 -26
- package/dist/server/routes/project-briefs.js +9 -16
- package/dist/server/routes/recall.js +10 -35
- package/dist/server/routes/skills.js +8 -18
- package/dist/server/server-detect.d.ts +9 -53
- package/dist/server/server-detect.js +24 -90
- package/dist/server/sleep-offload.js +4 -1
- package/dist/server/types.d.ts +12 -10
- package/dist/server/validation.d.ts +3 -1
- package/dist/server/validation.js +10 -23
- package/dist/server.d.ts +2 -2
- package/dist/server.js +3 -2
- package/dist/sharing/global-store.d.ts +19 -0
- package/dist/sharing/global-store.js +75 -0
- package/dist/sharing/global-sync.d.ts +6 -0
- package/dist/sharing/global-sync.js +80 -0
- package/dist/sharing/project-merge.d.ts +4 -5
- package/dist/sharing/project-merge.js +9 -7
- package/dist/sharing/scope.d.ts +4 -11
- package/dist/sharing/scope.js +4 -11
- package/dist/sharing/search-both.d.ts +60 -0
- package/dist/sharing/search-both.js +138 -0
- package/dist/sharing/share.d.ts +38 -0
- package/dist/sharing/share.js +226 -0
- package/dist/store/ambient.js +4 -9
- package/dist/store/audit-event.d.ts +4 -12
- package/dist/store/audit-event.js +4 -12
- package/dist/store/audit.d.ts +2 -5
- package/dist/store/audit.js +4 -12
- package/dist/store/auth.d.ts +6 -6
- package/dist/store/auth.js +10 -9
- package/dist/store/candidates.d.ts +20 -3
- package/dist/store/candidates.js +77 -48
- package/dist/store/card-detail.d.ts +2 -1
- package/dist/store/card-detail.js +2 -1
- package/dist/store/cards.d.ts +14 -9
- package/dist/store/cards.js +72 -126
- package/dist/store/conflicts.d.ts +4 -21
- package/dist/store/conflicts.js +71 -150
- package/dist/store/connectors/github.d.ts +10 -10
- package/dist/store/connectors/github.js +10 -10
- package/dist/store/dashboard-reads.js +4 -8
- package/dist/store/delete-and-batch.d.ts +11 -31
- package/dist/store/delete-and-batch.js +48 -64
- package/dist/store/delivery-recorder.d.ts +8 -4
- package/dist/store/delivery-recorder.js +25 -15
- package/dist/store/diagnostics.js +6 -13
- package/dist/store/dormant.d.ts +7 -29
- package/dist/store/dormant.js +15 -56
- package/dist/store/embeddings/index.d.ts +11 -80
- package/dist/store/embeddings/index.js +71 -207
- package/dist/store/embeddings/local.js +15 -32
- package/dist/store/embeddings/provider.d.ts +16 -53
- package/dist/store/embeddings/provider.js +41 -69
- package/dist/store/entry-reads.d.ts +21 -57
- package/dist/store/entry-reads.js +65 -126
- package/dist/store/entry-row.d.ts +6 -35
- package/dist/store/entry-row.js +9 -37
- package/dist/store/entry-writes.d.ts +10 -16
- package/dist/store/entry-writes.js +17 -35
- package/dist/store/goals.d.ts +3 -40
- package/dist/store/goals.js +21 -160
- package/dist/store/graph-queue.d.ts +6 -22
- package/dist/store/graph-queue.js +14 -45
- package/dist/store/graph-reads.d.ts +11 -35
- package/dist/store/graph-reads.js +20 -58
- package/dist/store/graph-rows.d.ts +3 -6
- package/dist/store/graph-rows.js +6 -9
- package/dist/store/graph-view-rows.d.ts +2 -1
- package/dist/store/graph-view-rows.js +2 -1
- package/dist/store/graph-writes.d.ts +6 -31
- package/dist/store/graph-writes.js +13 -37
- package/dist/store/half-life.d.ts +2 -1
- package/dist/store/half-life.js +14 -16
- package/dist/store/handoffs.d.ts +5 -11
- package/dist/store/handoffs.js +16 -34
- package/dist/store/index-and-stats.d.ts +6 -19
- package/dist/store/index-and-stats.js +34 -82
- package/dist/store/markdown.d.ts +2 -6
- package/dist/store/markdown.js +21 -20
- package/dist/store/mirrors.d.ts +2 -6
- package/dist/store/mirrors.js +14 -23
- package/dist/store/open.js +6 -13
- package/dist/store/planning-fallacy-evidence.d.ts +2 -30
- package/dist/store/planning-fallacy-evidence.js +8 -37
- package/dist/store/port.d.ts +82 -79
- package/dist/store/predictions.d.ts +11 -51
- package/dist/store/predictions.js +38 -119
- package/dist/{cli → store}/quality-repair.js +15 -31
- package/dist/store/raw-archive.d.ts +4 -16
- package/dist/store/raw-archive.js +14 -29
- package/dist/store/recall-scope.d.ts +19 -79
- package/dist/store/recall-scope.js +21 -82
- package/dist/store/recall-trace.d.ts +10 -77
- package/dist/store/recall-trace.js +19 -95
- package/dist/store/rejected-values.js +7 -19
- package/dist/store/rejection.d.ts +12 -58
- package/dist/store/rejection.js +13 -65
- package/dist/store/report-reads.d.ts +6 -0
- package/dist/store/report-reads.js +29 -0
- package/dist/store/rows.d.ts +9 -19
- package/dist/store/rows.js +36 -34
- package/dist/store/rule-sql.d.ts +5 -0
- package/dist/store/rule-sql.js +37 -0
- package/dist/store/search-rows.d.ts +7 -38
- package/dist/store/search-rows.js +14 -50
- package/dist/store/sessions.d.ts +10 -47
- package/dist/store/sessions.js +17 -73
- package/dist/store/sqlite/connector-events-group.js +2 -2
- package/dist/store/sqlite/entry-writes-group.js +2 -2
- package/dist/store/sqlite/error-codec.js +4 -2
- package/dist/store/sqlite/executor.d.ts +2 -1
- package/dist/store/sqlite/executor.js +2 -1
- package/dist/store/sqlite/local.d.ts +3 -3
- package/dist/store/sqlite/local.js +1 -0
- package/dist/store/sqlite/object-rows.js +6 -3
- package/dist/store/sqlite/objects-group.js +4 -2
- package/dist/store/sqlite/quarantine-group.js +2 -2
- package/dist/store/sqlite/store.d.ts +1 -4
- package/dist/store/sqlite/store.js +2 -3
- package/dist/store/sqlite/vector-reads-group.js +2 -2
- package/dist/store/sqlite/worker-jobs.js +1 -1
- package/dist/store/sqlite/worker-ops.d.ts +13 -2
- package/dist/store/sqlite/worker-ops.js +13 -2
- package/dist/store/sqlite/worker-store.js +5 -2
- package/dist/store/summaries.d.ts +10 -62
- package/dist/store/summaries.js +34 -146
- package/dist/store/summary-dirty.js +1 -1
- package/dist/store/tenant-lookup.d.ts +6 -1
- package/dist/store/tenant-lookup.js +7 -0
- package/dist/store/tenant.d.ts +2 -16
- package/dist/store/tenant.js +4 -19
- package/dist/store/token-ledger.d.ts +13 -43
- package/dist/store/token-ledger.js +19 -50
- package/dist/store/usage-reports.js +5 -13
- package/dist/store/vector-index.d.ts +46 -0
- package/dist/store/vector-index.js +170 -0
- package/dist/store/working-memory.d.ts +6 -25
- package/dist/store/working-memory.js +18 -52
- package/dist/store/yaml.d.ts +1 -5
- package/dist/store/yaml.js +2 -6
- package/dist/support-bundle.js +7 -5
- package/dist/trust/reject-flow.js +1 -3
- package/dist/util/anthropic-messages.js +14 -2
- package/dist/util/atomic-write.d.ts +2 -1
- package/dist/util/atomic-write.js +35 -4
- package/dist/util/capped-json.d.ts +6 -0
- package/dist/util/capped-json.js +46 -0
- package/dist/util/crash-handlers.d.ts +8 -1
- package/dist/util/crash-handlers.js +52 -10
- package/dist/util/env.d.ts +13 -6
- package/dist/util/env.js +14 -7
- package/dist/util/home-path.d.ts +2 -1
- package/dist/util/home-path.js +4 -2
- package/dist/util/http-retry.d.ts +3 -1
- package/dist/util/http-retry.js +26 -5
- package/dist/util/log.d.ts +3 -2
- package/dist/util/log.js +25 -9
- package/dist/util/request-scope.d.ts +2 -1
- package/dist/util/request-scope.js +2 -1
- package/dist/util/secret-detect.d.ts +5 -30
- package/dist/util/secret-detect.js +13 -39
- package/dist/util/stored-json.d.ts +1 -1
- package/dist/util/stored-json.js +1 -1
- package/dist/util/token-text.d.ts +1 -4
- package/dist/util/token-text.js +1 -4
- package/dist/util/transcript-tail.d.ts +2 -0
- package/dist/util/transcript-tail.js +24 -23
- package/dist/util/version.d.ts +5 -20
- package/dist/util/version.js +5 -20
- package/extensions/openclaw-plugin/index.ts +1 -1
- package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
- package/extensions/openclaw-plugin/package.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/dist/connectors/github/cli-impl.d.ts +0 -25
- package/dist/sharing/shared.d.ts +0 -187
- package/dist/sharing/shared.js +0 -563
- package/dist/store/vector-writes.d.ts +0 -13
- package/dist/store/vector-writes.js +0 -89
- /package/dist/{cli → store}/quality-repair.d.ts +0 -0
package/dist/db/physics-state.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Physics state persistence for Hippo.
|
|
3
|
-
* Stores and loads particle state (position, velocity, mass, charge, temperature)
|
|
4
|
-
* in SQLite using BLOB columns for 384-dim vectors.
|
|
5
|
-
*/
|
|
1
|
+
/** Physics state persistence: particle state (position, velocity, mass, charge, temperature) in SQLite, with BLOB columns for 384-dim vectors. */
|
|
6
2
|
import { evalNow } from '../core/ablation.js';
|
|
7
3
|
import { withWriteScope } from './busy.js';
|
|
8
4
|
import { computeMass, computeCharge, computeTemperature, vecZero } from '../core/physics.js';
|
|
9
5
|
import { calculateStrength } from '../core/memory.js';
|
|
10
6
|
import { DAY_MS } from '../util/time.js';
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
7
|
// Float32Array <-> Buffer serialization
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
8
|
export function float32ToBuffer(arr) {
|
|
15
9
|
const f32 = new Float32Array(arr);
|
|
16
10
|
return Buffer.from(f32.buffer);
|
|
@@ -24,13 +18,8 @@ export function bufferToFloat32(buf) {
|
|
|
24
18
|
new Uint8Array(aligned).set(bytes);
|
|
25
19
|
return Array.from(new Float32Array(aligned));
|
|
26
20
|
}
|
|
27
|
-
// ---------------------------------------------------------------------------
|
|
28
21
|
// Schema migration
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Create the memory_physics table (migration v8).
|
|
32
|
-
* Call this from db.ts MIGRATIONS array.
|
|
33
|
-
*/
|
|
22
|
+
/** Create the memory_physics table (migration v8). */
|
|
34
23
|
export function createPhysicsTable(db) {
|
|
35
24
|
db.exec(`
|
|
36
25
|
CREATE TABLE IF NOT EXISTS memory_physics (
|
|
@@ -108,10 +97,7 @@ export function savePhysicsState(db, particles) {
|
|
|
108
97
|
}
|
|
109
98
|
});
|
|
110
99
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Initialize physics state for a memory from its embedding vector.
|
|
113
|
-
* Returns the new particle (does not persist — caller must save).
|
|
114
|
-
*/
|
|
100
|
+
/** Initialize physics state for a memory from its embedding vector; returns the new particle without persisting (the caller must save). */
|
|
115
101
|
export function initializeParticle(entry, embedding, now = evalNow()) {
|
|
116
102
|
const strength = calculateStrength(entry, now);
|
|
117
103
|
const ageDays = (now.getTime() - new Date(entry.created).getTime()) / DAY_MS;
|
|
@@ -125,28 +111,31 @@ export function initializeParticle(entry, embedding, now = evalNow()) {
|
|
|
125
111
|
lastSimulation: now.toISOString(),
|
|
126
112
|
};
|
|
127
113
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
* Drops existing physics data and re-initializes from the embedding index.
|
|
131
|
-
*/
|
|
114
|
+
const RESET_BATCH = 64;
|
|
115
|
+
/** Drops every particle, then seeds one per entry that has an embedding; `entries` may be read lazily, as each batch is written before the next is read. */
|
|
132
116
|
export function resetAllPhysicsState(db, entries, embeddingIndex, now = evalNow()) {
|
|
133
117
|
db.exec('DELETE FROM memory_physics');
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
118
|
+
// One transaction for every batch, so a failure part way leaves no particles rather than some.
|
|
119
|
+
return withWriteScope(db, 'reset_particles', () => {
|
|
120
|
+
let count = 0;
|
|
121
|
+
let batch = [];
|
|
122
|
+
const flush = () => {
|
|
123
|
+
savePhysicsState(db, batch);
|
|
124
|
+
count += batch.length;
|
|
125
|
+
batch = [];
|
|
126
|
+
};
|
|
127
|
+
for (const entry of entries) {
|
|
128
|
+
const embedding = embeddingIndex[entry.id];
|
|
129
|
+
if (!embedding || embedding.length === 0)
|
|
130
|
+
continue;
|
|
131
|
+
if (batch.push(initializeParticle(entry, embedding, now)) === RESET_BATCH)
|
|
132
|
+
flush();
|
|
133
|
+
}
|
|
134
|
+
flush();
|
|
135
|
+
return count;
|
|
136
|
+
});
|
|
145
137
|
}
|
|
146
|
-
/**
|
|
147
|
-
* Refresh mass, charge, and temperature for existing particles
|
|
148
|
-
* based on current memory attributes (called during consolidation).
|
|
149
|
-
*/
|
|
138
|
+
/** Refresh mass, charge and temperature for existing particles from current memory attributes (called during consolidation). */
|
|
150
139
|
export function refreshParticleProperties(particles, entries, now = evalNow()) {
|
|
151
140
|
for (const p of particles) {
|
|
152
141
|
const entry = entries.get(p.memoryId);
|
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
import type { DatabaseSyncLike } from './index.js';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* commit 70180b5 left their markdown mirrors at <hippoRoot>/<layer>/<id>.md
|
|
5
|
-
* with original content intact. The DB is already redacted via migration v20;
|
|
6
|
-
* this function deletes those filesystem mirrors so RTBF holds for historical
|
|
7
|
-
* archives too.
|
|
8
|
-
*
|
|
9
|
-
* Per-row tracking via raw_archive.mirror_cleaned_at (added in v21):
|
|
10
|
-
* - SELECT only rows WHERE mirror_cleaned_at IS NULL.
|
|
11
|
-
* - On success (every layer either deleted or didn't exist), UPDATE the row
|
|
12
|
-
* with the cleanup timestamp.
|
|
13
|
-
* - On any unlink failure, leave mirror_cleaned_at NULL so the next
|
|
14
|
-
* connection retries. Warn (capped at MAX_WARN_LOGS rows per call).
|
|
15
|
-
*
|
|
16
|
-
* Returns whether every pending row was cleaned; the SELECT has no index to
|
|
17
|
-
* use, so a connection runs it only when the archive has changed since.
|
|
18
|
-
*/
|
|
2
|
+
/** Path A backfill cleanup: delete markdown mirrors (<hippoRoot>/<layer>/<id>.md) of rows archived before redaction, so RTBF holds for historical archives.
|
|
3
|
+
* Tracked by raw_archive.mirror_cleaned_at: set only on success, so a failed unlink retries next connection. Returns whether all pending rows were cleaned. */
|
|
19
4
|
export declare function cleanupArchivedMirrors(hippoRoot: string, db: DatabaseSyncLike): boolean;
|
|
20
5
|
//# sourceMappingURL=raw-archive-mirror-cleanup.d.ts.map
|
|
@@ -3,23 +3,8 @@ import * as path from 'path';
|
|
|
3
3
|
import { errorMessage, log } from '../util/log.js';
|
|
4
4
|
const LAYERS = ['episodic', 'buffer', 'semantic'];
|
|
5
5
|
const MAX_WARN_LOGS = 5;
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* commit 70180b5 left their markdown mirrors at <hippoRoot>/<layer>/<id>.md
|
|
9
|
-
* with original content intact. The DB is already redacted via migration v20;
|
|
10
|
-
* this function deletes those filesystem mirrors so RTBF holds for historical
|
|
11
|
-
* archives too.
|
|
12
|
-
*
|
|
13
|
-
* Per-row tracking via raw_archive.mirror_cleaned_at (added in v21):
|
|
14
|
-
* - SELECT only rows WHERE mirror_cleaned_at IS NULL.
|
|
15
|
-
* - On success (every layer either deleted or didn't exist), UPDATE the row
|
|
16
|
-
* with the cleanup timestamp.
|
|
17
|
-
* - On any unlink failure, leave mirror_cleaned_at NULL so the next
|
|
18
|
-
* connection retries. Warn (capped at MAX_WARN_LOGS rows per call).
|
|
19
|
-
*
|
|
20
|
-
* Returns whether every pending row was cleaned; the SELECT has no index to
|
|
21
|
-
* use, so a connection runs it only when the archive has changed since.
|
|
22
|
-
*/
|
|
6
|
+
/** Path A backfill cleanup: delete markdown mirrors (<hippoRoot>/<layer>/<id>.md) of rows archived before redaction, so RTBF holds for historical archives.
|
|
7
|
+
* Tracked by raw_archive.mirror_cleaned_at: set only on success, so a failed unlink retries next connection. Returns whether all pending rows were cleaned. */
|
|
23
8
|
export function cleanupArchivedMirrors(hippoRoot, db) {
|
|
24
9
|
// SAFETY: the SELECT above names exactly one column, memory_id (raw_archive.memory_id
|
|
25
10
|
// is NOT NULL TEXT), so the row shape matches this assertion.
|
|
@@ -15,6 +15,8 @@ export declare function loadVectors(db: DatabaseSyncLike, ids?: readonly string[
|
|
|
15
15
|
/** `loadVectors` for `ids` with no copy: each value views the bytes the store returned for that row. */
|
|
16
16
|
export declare function loadVectorViews(db: DatabaseSyncLike, ids: readonly string[]): Map<string, Float32Array>;
|
|
17
17
|
export declare function storedVectorIds(db: DatabaseSyncLike): Set<string>;
|
|
18
|
+
/** Float count of the first stored row, from its blob length; the vector is never read. */
|
|
19
|
+
export declare function storedVectorDims(db: DatabaseSyncLike): number | undefined;
|
|
18
20
|
export declare function hasStoredVectors(db: DatabaseSyncLike): boolean;
|
|
19
21
|
export interface VectorMatch {
|
|
20
22
|
id: string;
|
package/dist/db/vector-store.js
CHANGED
|
@@ -85,6 +85,12 @@ export function storedVectorIds(db) {
|
|
|
85
85
|
// SAFETY: the SELECT names exactly the one column read.
|
|
86
86
|
return new Set(db.prepare('SELECT memory_id FROM memory_vectors').all().map((r) => r.memory_id));
|
|
87
87
|
}
|
|
88
|
+
/** Float count of the first stored row, from its blob length; the vector is never read. */
|
|
89
|
+
export function storedVectorDims(db) {
|
|
90
|
+
// SAFETY: the SELECT names exactly the one column read.
|
|
91
|
+
const row = db.prepare('SELECT length(vector) AS bytes FROM memory_vectors LIMIT 1').get();
|
|
92
|
+
return row === undefined ? undefined : Math.floor(row.bytes / 4);
|
|
93
|
+
}
|
|
88
94
|
export function hasStoredVectors(db) {
|
|
89
95
|
return db.prepare('SELECT 1 FROM memory_vectors LIMIT 1').get() !== undefined;
|
|
90
96
|
}
|
|
@@ -141,7 +147,8 @@ export async function topVectorMatches(db, query, k, where, params) {
|
|
|
141
147
|
const best = bestMatches(query, k);
|
|
142
148
|
if (!best)
|
|
143
149
|
return [];
|
|
144
|
-
// SHORTCUT: brute-force cosine over every admitted vector, a chunk per event-loop turn; latency
|
|
150
|
+
// SHORTCUT: brute-force cosine over every admitted vector, a chunk per event-loop turn; latency
|
|
151
|
+
// still grows with rows, fine to ~100k, and an ANN index (sqlite-vec, HNSW) is the upgrade.
|
|
145
152
|
// SAFETY: the SELECT names exactly these two columns; node:sqlite returns BLOBs as Uint8Array.
|
|
146
153
|
const rows = db.prepare(`
|
|
147
154
|
SELECT v.memory_id AS id, v.vector AS vector
|
package/dist/doctor.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* hippo, or when something seems off. Read-only: it never creates a store,
|
|
4
|
-
* installs a hook or migrates a database. Every non-passing check names the
|
|
5
|
-
* command that fixes it, so an agent can act on the `--json` output.
|
|
6
|
-
*/
|
|
1
|
+
/** `hippo doctor`: a read-only health check (never creates a store, installs a hook or migrates a database).
|
|
2
|
+
* Every non-passing check names the command that fixes it, so an agent can act on the `--json` output. */
|
|
7
3
|
import * as fs from 'node:fs';
|
|
8
4
|
import * as os from 'node:os';
|
|
9
5
|
import * as path from 'node:path';
|
|
10
6
|
import { findHippoStoreDir } from './core/project-identity.js';
|
|
11
|
-
import { getGlobalRoot } from './sharing/
|
|
7
|
+
import { getGlobalRoot } from './sharing/global-store.js';
|
|
12
8
|
import { isInitialized } from './store/open.js';
|
|
13
9
|
import { readStoreHealth } from './store/diagnostics.js';
|
|
14
10
|
import { loadConfig } from './core/config.js';
|
|
@@ -50,7 +46,12 @@ function codexCheck(home) {
|
|
|
50
46
|
const parsed = readJson(file);
|
|
51
47
|
// Codex drops every hook in a hooks.json it cannot parse, hippo's included.
|
|
52
48
|
if (fs.existsSync(file) && !isJsonObjectLiteral(parsed)) {
|
|
53
|
-
return {
|
|
49
|
+
return {
|
|
50
|
+
id: 'codex',
|
|
51
|
+
status: 'warn',
|
|
52
|
+
detail: "Codex's hooks.json is not a JSON object, so Codex runs no hook from it",
|
|
53
|
+
fix: 'repair hooks.json, then run: hippo hook install codex'
|
|
54
|
+
};
|
|
54
55
|
}
|
|
55
56
|
const text = JSON.stringify(parsed ?? '');
|
|
56
57
|
const codexHooks = [
|
|
@@ -63,7 +64,9 @@ function codexCheck(home) {
|
|
|
63
64
|
return {
|
|
64
65
|
id: 'codex',
|
|
65
66
|
status: 'warn',
|
|
66
|
-
detail: missing.length === codexHooks.length
|
|
67
|
+
detail: missing.length === codexHooks.length
|
|
68
|
+
? "Codex found, but hippo's memory hooks are not installed"
|
|
69
|
+
: `Codex: hippo hooks missing for ${missing.join(', ')}`,
|
|
67
70
|
fix: 'hippo hook install codex (then trust the hooks once in /hooks)',
|
|
68
71
|
};
|
|
69
72
|
}
|
|
@@ -88,7 +91,12 @@ function sleepCheck(lastSleep, now) {
|
|
|
88
91
|
const last = lastSleep.value;
|
|
89
92
|
const when = last !== undefined ? Date.parse(last) : Number.NaN;
|
|
90
93
|
if (Number.isNaN(when)) {
|
|
91
|
-
return {
|
|
94
|
+
return {
|
|
95
|
+
id: 'sleep',
|
|
96
|
+
status: 'warn',
|
|
97
|
+
detail: 'hippo has never slept (consolidated) in this store',
|
|
98
|
+
fix: 'hippo sleep (the session-end hook runs it automatically)'
|
|
99
|
+
};
|
|
92
100
|
}
|
|
93
101
|
const days = Math.floor((now.getTime() - when) / DAY_MS);
|
|
94
102
|
return days > 7
|
|
@@ -137,12 +145,19 @@ function projectsCheck(globalRoot) {
|
|
|
137
145
|
const found = [
|
|
138
146
|
r.copies.length > 0 ? `${r.copies.length} imported notes copied under the wrong project` : '',
|
|
139
147
|
r.folds.length > 0 ? `old project names that now resolve to another project: ${r.folds.map((f) => `${f.from} -> ${f.into}`).join(', ')}` : '',
|
|
140
|
-
r.collisions.length > 0
|
|
148
|
+
r.collisions.length > 0
|
|
149
|
+
? `old project names shared by several projects, folded by hand only: ${r.collisions.map((c) => `${c.name} (${c.ids.join(', ')})`).join('; ')}`
|
|
150
|
+
: '',
|
|
141
151
|
r.toProject.length + r.setAside.length > 0 ? `${r.toProject.length + r.setAside.length} merged memories tagged user-global` : '',
|
|
142
152
|
].filter((s) => s !== '');
|
|
143
153
|
return found.length === 0
|
|
144
154
|
? { id: 'projects', status: 'pass', detail: 'no duplicate or out-of-date project tags in the global store' }
|
|
145
|
-
: {
|
|
155
|
+
: {
|
|
156
|
+
id: 'projects',
|
|
157
|
+
status: 'warn',
|
|
158
|
+
detail: `global store: ${found.join('; ')}`,
|
|
159
|
+
fix: 'hippo projects repair --global (dry run; add --apply to write)'
|
|
160
|
+
};
|
|
146
161
|
}
|
|
147
162
|
catch (err) {
|
|
148
163
|
return { id: 'projects', status: 'info', detail: `project tags not checked (${errorMessage(err)})` };
|
|
@@ -160,16 +175,43 @@ function nodeCheck(node) {
|
|
|
160
175
|
/** The store the checks run against (project first, then global), and the check that says which. */
|
|
161
176
|
function storeCheck(local, globalRoot, hasGlobal) {
|
|
162
177
|
if (local !== null && isInitialized(local)) {
|
|
163
|
-
return {
|
|
178
|
+
return {
|
|
179
|
+
store: local,
|
|
180
|
+
check: { id: 'store', status: 'pass', detail: `project store at ${local}${hasGlobal ? ` (global store at ${globalRoot} too)` : ''}` }
|
|
181
|
+
};
|
|
164
182
|
}
|
|
165
183
|
if (local !== null) {
|
|
166
184
|
// The walk stops at the first .hippo it finds, so a bare one (no hippo.db) blocks a parent or global store too.
|
|
167
|
-
return {
|
|
185
|
+
return {
|
|
186
|
+
store: null,
|
|
187
|
+
check: {
|
|
188
|
+
id: 'store',
|
|
189
|
+
status: 'fail',
|
|
190
|
+
detail: `${local} has no hippo.db, so hippo commands run here stop at it`,
|
|
191
|
+
fix: `run hippo init in ${path.dirname(local)}, or remove that .hippo folder`
|
|
192
|
+
}
|
|
193
|
+
};
|
|
168
194
|
}
|
|
169
195
|
if (hasGlobal) {
|
|
170
|
-
return {
|
|
196
|
+
return {
|
|
197
|
+
store: globalRoot,
|
|
198
|
+
check: {
|
|
199
|
+
id: 'store',
|
|
200
|
+
status: 'warn',
|
|
201
|
+
detail: `no project store here; using the global store at ${globalRoot}`,
|
|
202
|
+
fix: 'hippo init (in the project root)'
|
|
203
|
+
}
|
|
204
|
+
};
|
|
171
205
|
}
|
|
172
|
-
return {
|
|
206
|
+
return {
|
|
207
|
+
store: null,
|
|
208
|
+
check: {
|
|
209
|
+
id: 'store',
|
|
210
|
+
status: 'fail',
|
|
211
|
+
detail: 'no hippo store found (project or global)',
|
|
212
|
+
fix: 'hippo init (in the project root), or hippo init --global'
|
|
213
|
+
}
|
|
214
|
+
};
|
|
173
215
|
}
|
|
174
216
|
function schemaCheck(have, want) {
|
|
175
217
|
return have === want
|
|
@@ -269,7 +311,12 @@ function claudeCodeCheck(home) {
|
|
|
269
311
|
if (missing.length === CLAUDE_CODE_HOOKS.length) {
|
|
270
312
|
return { id: 'claude-code', status: 'warn', detail: 'Claude Code found, but no hippo hooks are installed', fix: 'hippo hook install claude-code' };
|
|
271
313
|
}
|
|
272
|
-
return {
|
|
314
|
+
return {
|
|
315
|
+
id: 'claude-code',
|
|
316
|
+
status: 'warn',
|
|
317
|
+
detail: `Claude Code: hippo hooks missing for ${missing.join(', ')}`,
|
|
318
|
+
fix: 'hippo hook install claude-code (adds only what is missing)'
|
|
319
|
+
};
|
|
273
320
|
}
|
|
274
321
|
/** Run every check. Never throws for a broken install; broken parts become failed checks. */
|
|
275
322
|
export function runDoctor(opts) {
|
|
@@ -287,14 +334,22 @@ export function runDoctor(opts) {
|
|
|
287
334
|
checks.push(...databaseChecks(store, now));
|
|
288
335
|
const holdoutRateBp = store === null ? 0 : loadConfig(store).pilot.holdoutRateBp;
|
|
289
336
|
if (holdoutRateBp > 0) {
|
|
290
|
-
checks.push({
|
|
337
|
+
checks.push({
|
|
338
|
+
id: 'pilot',
|
|
339
|
+
status: 'info',
|
|
340
|
+
detail: `pilot holdout on: about ${holdoutRateBp / 100}% of sessions get no memories pushed by hippo (pilot.holdoutRateBp=${holdoutRateBp})`
|
|
341
|
+
});
|
|
291
342
|
}
|
|
292
343
|
if (hasGlobal)
|
|
293
344
|
checks.push(projectsCheck(globalRoot));
|
|
294
345
|
checks.push(claudeCodeCheck(home));
|
|
295
346
|
if (isCodexPresent(home))
|
|
296
347
|
checks.push(codexCheck(home));
|
|
297
|
-
checks.push({
|
|
348
|
+
checks.push({
|
|
349
|
+
id: 'embeddings',
|
|
350
|
+
status: 'info',
|
|
351
|
+
detail: isEmbeddingAvailable() ? 'local embeddings available (hybrid search)' : 'embeddings not installed; recall uses BM25 (optional: hippo embed --help)'
|
|
352
|
+
});
|
|
298
353
|
return { ok: !checks.some((c) => c.status === 'fail'), version: opts.version, store, checks };
|
|
299
354
|
}
|
|
300
355
|
/** Human-readable rendering of a {@link DoctorReport}. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// The hippo-memory/session-text subpath: what a hook reads from a session (turns, working state, failures,
|
|
1
|
+
// The hippo-memory/session-text subpath: what a hook reads from a session (turns, working state, failures,
|
|
2
|
+
// git state, compaction items) and the sharing scrub, with no store, database or server in its imports.
|
|
2
3
|
export { collectSessionTurns, sessionTail } from '../capture/transcript.js';
|
|
3
4
|
export { scrubForSharing } from '../capture/share-scrub.js';
|
|
4
5
|
export { transcriptWorkingState, WORKING_STATE_CAPS } from '../capture/working-state.js';
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* - Cost: price provider usage over four buckets (uncached input, cache
|
|
5
|
-
* write, cache read, output). Raw token counts overstate savings when most
|
|
6
|
-
* input is already cache reads, so every dollar claim goes through here.
|
|
7
|
-
* - Uncertainty: paired bootstrap over tasks, cluster bootstrap (tasks that
|
|
8
|
-
* share a repository are not independent), and a paired ratio bootstrap for
|
|
9
|
-
* dollars per resolved task.
|
|
10
|
-
*
|
|
11
|
-
* Deterministic: every resampling function takes a seed, so a published
|
|
12
|
-
* result can be reproduced exactly.
|
|
13
|
-
*/
|
|
1
|
+
/** Statistics and cost accounting for the token-efficiency evals: cost is priced over four buckets (uncached input, cache write, cache read, output).
|
|
2
|
+
* Uncertainty uses paired, cluster (same-repository tasks are not independent) and paired-ratio bootstraps; every resampler takes a seed. */
|
|
14
3
|
/** Token usage for one model call or one whole task, split by how it is billed. */
|
|
15
4
|
export interface Usage {
|
|
16
5
|
/** Input tokens billed at the base input price (not read from or written to a cache). */
|
|
@@ -22,11 +11,7 @@ export interface Usage {
|
|
|
22
11
|
/** Output tokens, including any reasoning tokens the provider bills as output. */
|
|
23
12
|
outputTokens: number;
|
|
24
13
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Prices in dollars per million tokens. Take them from the provider's
|
|
27
|
-
* current price page for the exact model; this module has no built-in
|
|
28
|
-
* prices because they change.
|
|
29
|
-
*/
|
|
14
|
+
/** Prices in dollars per million tokens, taken from the provider's current price page for the exact model; this module has no built-in prices. */
|
|
30
15
|
export interface Prices {
|
|
31
16
|
inputPerMTok: number;
|
|
32
17
|
cacheWritePerMTok: number;
|
|
@@ -37,12 +22,8 @@ export interface Prices {
|
|
|
37
22
|
export declare function addUsage(...usages: Usage[]): Usage;
|
|
38
23
|
/** Dollar cost of `usage` at `prices`. */
|
|
39
24
|
export declare function priceUsage(usage: Usage, prices: Prices): number;
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* cost in "uncached-equivalent tokens" when no dollar prices are given.
|
|
43
|
-
* Defaults follow Anthropic's published ratios (5-minute cache write 1.25x,
|
|
44
|
-
* cache read 0.1x); pass the ratios for another provider when needed.
|
|
45
|
-
*/
|
|
25
|
+
/** Relative cache-bucket prices against the base input price, for cost in "uncached-equivalent tokens" when no dollar prices are given.
|
|
26
|
+
* Defaults follow Anthropic's ratios (5-minute cache write 1.25x, cache read 0.1x); pass another provider's ratios when needed. */
|
|
46
27
|
export interface CacheRatios {
|
|
47
28
|
write: number;
|
|
48
29
|
read: number;
|
|
@@ -51,10 +32,8 @@ export interface CacheRatios {
|
|
|
51
32
|
export declare const DEFAULT_CACHE_RATIOS: Readonly<CacheRatios>;
|
|
52
33
|
/** Input cost of `usage` in uncached-equivalent tokens (output excluded). */
|
|
53
34
|
export declare function uncachedEquivalentInput(usage: Usage, ratios?: CacheRatios): number;
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* same stream, on every platform.
|
|
57
|
-
*/
|
|
35
|
+
/** Mulberry32: a small seeded PRNG returning floats in [0, 1). Same seed,
|
|
36
|
+
* same stream, on every platform. */
|
|
58
37
|
export declare function seededRandom(seed: number): () => number;
|
|
59
38
|
/** A point estimate with a percentile bootstrap confidence interval. */
|
|
60
39
|
export interface Estimate {
|
|
@@ -73,17 +52,9 @@ export interface BootstrapOpts {
|
|
|
73
52
|
/** PRNG seed. Default 1. */
|
|
74
53
|
seed?: number;
|
|
75
54
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Paired bootstrap for the mean of per-task differences (treatment minus
|
|
78
|
-
* control on the same task). An interval that excludes zero is the bar for
|
|
79
|
-
* calling a difference real.
|
|
80
|
-
*/
|
|
55
|
+
/** Paired bootstrap for the mean of per-task differences (treatment minus control, same task); an interval excluding zero is the bar for a real difference. */
|
|
81
56
|
export declare function pairedBootstrap(diffs: number[], opts?: BootstrapOpts): Estimate;
|
|
82
|
-
/**
|
|
83
|
-
* Cluster bootstrap for the mean of per-task differences: resamples whole
|
|
84
|
-
* clusters (for example all tasks from one repository), because tasks in a
|
|
85
|
-
* cluster share causes and are not independent draws.
|
|
86
|
-
*/
|
|
57
|
+
/** Cluster bootstrap for the mean of per-task differences: resamples whole clusters (e.g. one repository), because tasks in a cluster are not independent. */
|
|
87
58
|
export declare function clusteredPairedBootstrap(diffsByCluster: ReadonlyMap<string, number[]>, opts?: BootstrapOpts): Estimate;
|
|
88
59
|
/** One task's outcome in one arm, for {@link costPerResolvedDelta}. */
|
|
89
60
|
export interface ArmOutcome {
|
|
@@ -101,23 +72,14 @@ export interface CostPerResolvedDelta {
|
|
|
101
72
|
/** (treatment minus control) / control, with its interval. Negative is a saving. */
|
|
102
73
|
relative: Estimate;
|
|
103
74
|
}
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
* bootstrap over tasks (a task is resampled with both of its arm outcomes).
|
|
107
|
-
* `control[i]` and `treatment[i]` must be the same task. Resamples in which
|
|
108
|
-
* an arm resolves nothing are dropped; `iterations` reports how many were
|
|
109
|
-
* kept.
|
|
110
|
-
*/
|
|
75
|
+
/** Cost per resolved task in two arms on the same tasks, with a paired bootstrap (`control[i]` and `treatment[i]` must be the same task).
|
|
76
|
+
* Resamples in which an arm resolves nothing are dropped; `iterations` reports how many were kept. */
|
|
111
77
|
export declare function costPerResolvedDelta(control: ArmOutcome[], treatment: ArmOutcome[], opts?: BootstrapOpts): CostPerResolvedDelta;
|
|
112
|
-
/**
|
|
113
|
-
*
|
|
114
|
-
* NaN when no task has k runs (not measured, which is not the same as 0).
|
|
115
|
-
*/
|
|
78
|
+
/** pass@k: share of tasks with at least one success in their first k runs.
|
|
79
|
+
* NaN when no task has k runs (not measured, which is not the same as 0). */
|
|
116
80
|
export declare function passAtK(runsByTask: boolean[][], k: number): number;
|
|
117
|
-
/**
|
|
118
|
-
*
|
|
119
|
-
* NaN when no task has k runs.
|
|
120
|
-
*/
|
|
81
|
+
/** pass^k: share of tasks whose first k runs all succeed (consistency).
|
|
82
|
+
* NaN when no task has k runs. */
|
|
121
83
|
export declare function passHatK(runsByTask: boolean[][], k: number): number;
|
|
122
84
|
/** All units of one family (tasks by seeds), resampled as one block so seeds stay together. */
|
|
123
85
|
export type Family<T> = readonly T[];
|
package/dist/eval/eval-stats.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* - Cost: price provider usage over four buckets (uncached input, cache
|
|
5
|
-
* write, cache read, output). Raw token counts overstate savings when most
|
|
6
|
-
* input is already cache reads, so every dollar claim goes through here.
|
|
7
|
-
* - Uncertainty: paired bootstrap over tasks, cluster bootstrap (tasks that
|
|
8
|
-
* share a repository are not independent), and a paired ratio bootstrap for
|
|
9
|
-
* dollars per resolved task.
|
|
10
|
-
*
|
|
11
|
-
* Deterministic: every resampling function takes a seed, so a published
|
|
12
|
-
* result can be reproduced exactly.
|
|
13
|
-
*/
|
|
1
|
+
/** Statistics and cost accounting for the token-efficiency evals: cost is priced over four buckets (uncached input, cache write, cache read, output).
|
|
2
|
+
* Uncertainty uses paired, cluster (same-repository tasks are not independent) and paired-ratio bootstraps; every resampler takes a seed. */
|
|
14
3
|
const DEFAULT_ITERATIONS = 5000;
|
|
15
4
|
const DEFAULT_TWO_LEVEL_ITERATIONS = 10_000;
|
|
16
5
|
const DEFAULT_ALPHA = 0.05;
|
|
@@ -38,10 +27,8 @@ export const DEFAULT_CACHE_RATIOS = { write: 1.25, read: 0.1 };
|
|
|
38
27
|
export function uncachedEquivalentInput(usage, ratios = DEFAULT_CACHE_RATIOS) {
|
|
39
28
|
return usage.inputTokens + usage.cacheWriteTokens * ratios.write + usage.cacheReadTokens * ratios.read;
|
|
40
29
|
}
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* same stream, on every platform.
|
|
44
|
-
*/
|
|
30
|
+
/** Mulberry32: a small seeded PRNG returning floats in [0, 1). Same seed,
|
|
31
|
+
* same stream, on every platform. */
|
|
45
32
|
export function seededRandom(seed) {
|
|
46
33
|
let a = seed >>> 0;
|
|
47
34
|
return () => {
|
|
@@ -61,11 +48,7 @@ function percentileInterval(samples, alpha) {
|
|
|
61
48
|
function mean(xs) {
|
|
62
49
|
return xs.length === 0 ? 0 : xs.reduce((s, x) => s + x, 0) / xs.length;
|
|
63
50
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Paired bootstrap for the mean of per-task differences (treatment minus
|
|
66
|
-
* control on the same task). An interval that excludes zero is the bar for
|
|
67
|
-
* calling a difference real.
|
|
68
|
-
*/
|
|
51
|
+
/** Paired bootstrap for the mean of per-task differences (treatment minus control, same task); an interval excluding zero is the bar for a real difference. */
|
|
69
52
|
export function pairedBootstrap(diffs, opts = {}) {
|
|
70
53
|
const iterations = opts.iterations ?? DEFAULT_ITERATIONS;
|
|
71
54
|
const alpha = opts.alpha ?? DEFAULT_ALPHA;
|
|
@@ -82,11 +65,7 @@ export function pairedBootstrap(diffs, opts = {}) {
|
|
|
82
65
|
}
|
|
83
66
|
return { estimate: mean(diffs), ...percentileInterval(samples, alpha), iterations };
|
|
84
67
|
}
|
|
85
|
-
/**
|
|
86
|
-
* Cluster bootstrap for the mean of per-task differences: resamples whole
|
|
87
|
-
* clusters (for example all tasks from one repository), because tasks in a
|
|
88
|
-
* cluster share causes and are not independent draws.
|
|
89
|
-
*/
|
|
68
|
+
/** Cluster bootstrap for the mean of per-task differences: resamples whole clusters (e.g. one repository), because tasks in a cluster are not independent. */
|
|
90
69
|
export function clusteredPairedBootstrap(diffsByCluster, opts = {}) {
|
|
91
70
|
const iterations = opts.iterations ?? DEFAULT_ITERATIONS;
|
|
92
71
|
const alpha = opts.alpha ?? DEFAULT_ALPHA;
|
|
@@ -115,13 +94,8 @@ function costPerResolved(outcomes) {
|
|
|
115
94
|
const cost = outcomes.reduce((s, o) => s + o.cost, 0);
|
|
116
95
|
return resolved === 0 ? Number.POSITIVE_INFINITY : cost / resolved;
|
|
117
96
|
}
|
|
118
|
-
/**
|
|
119
|
-
*
|
|
120
|
-
* bootstrap over tasks (a task is resampled with both of its arm outcomes).
|
|
121
|
-
* `control[i]` and `treatment[i]` must be the same task. Resamples in which
|
|
122
|
-
* an arm resolves nothing are dropped; `iterations` reports how many were
|
|
123
|
-
* kept.
|
|
124
|
-
*/
|
|
97
|
+
/** Cost per resolved task in two arms on the same tasks, with a paired bootstrap (`control[i]` and `treatment[i]` must be the same task).
|
|
98
|
+
* Resamples in which an arm resolves nothing are dropped; `iterations` reports how many were kept. */
|
|
125
99
|
export function costPerResolvedDelta(control, treatment, opts = {}) {
|
|
126
100
|
if (control.length !== treatment.length) {
|
|
127
101
|
throw new Error('control and treatment must list the same tasks in the same order');
|
|
@@ -166,20 +140,16 @@ export function costPerResolvedDelta(control, treatment, opts = {}) {
|
|
|
166
140
|
},
|
|
167
141
|
};
|
|
168
142
|
}
|
|
169
|
-
/**
|
|
170
|
-
*
|
|
171
|
-
* NaN when no task has k runs (not measured, which is not the same as 0).
|
|
172
|
-
*/
|
|
143
|
+
/** pass@k: share of tasks with at least one success in their first k runs.
|
|
144
|
+
* NaN when no task has k runs (not measured, which is not the same as 0). */
|
|
173
145
|
export function passAtK(runsByTask, k) {
|
|
174
146
|
const eligible = runsByTask.filter((r) => r.length >= k);
|
|
175
147
|
if (eligible.length === 0)
|
|
176
148
|
return Number.NaN;
|
|
177
149
|
return eligible.filter((r) => r.slice(0, k).some(Boolean)).length / eligible.length;
|
|
178
150
|
}
|
|
179
|
-
/**
|
|
180
|
-
*
|
|
181
|
-
* NaN when no task has k runs.
|
|
182
|
-
*/
|
|
151
|
+
/** pass^k: share of tasks whose first k runs all succeed (consistency).
|
|
152
|
+
* NaN when no task has k runs. */
|
|
183
153
|
export function passHatK(runsByTask, k) {
|
|
184
154
|
const eligible = runsByTask.filter((r) => r.length >= k);
|
|
185
155
|
if (eligible.length === 0)
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Creates a synthetic memory corpus with known ground truth, runs searches
|
|
5
|
-
* per feature category, and reports per-feature metrics with regression
|
|
6
|
-
* detection against a saved baseline.
|
|
7
|
-
*
|
|
8
|
-
* Design goals:
|
|
9
|
-
* - Zero API calls (no LLM judge, no embeddings)
|
|
10
|
-
* - Deterministic (fixed timestamps, content, IDs)
|
|
11
|
-
* - Fast (<60s for full suite)
|
|
12
|
-
* - Per-feature breakdown so you see exactly what a change helped/hurt
|
|
13
|
-
*/
|
|
1
|
+
/** Self-contained feature eval suite: a synthetic corpus with known ground truth, per-feature metrics and regression detection against a saved baseline.
|
|
2
|
+
* Zero API calls (no LLM judge, no embeddings), deterministic (fixed timestamps, content, IDs) and fast. */
|
|
14
3
|
import { type MemoryEntry } from '../core/memory.js';
|
|
15
4
|
export type FeatureCategory = 'direct-recall' | 'extraction-preference' | 'dag-drilldown' | 'temporal' | 'noise-resistance' | 'multi-hop';
|
|
16
5
|
export interface FeatureTestCase {
|