hippo-memory 1.71.0 → 1.72.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/apply.d.ts +0 -11
- package/dist/agent-memories/apply.js +6 -21
- package/dist/agent-memories/claude-code.js +1 -1
- package/dist/agent-memories/codex.js +1 -1
- package/dist/agent-memories/copilot.d.ts +1 -3
- package/dist/agent-memories/copilot.js +1 -17
- package/dist/agent-memories/project-folds.d.ts +10 -0
- package/dist/agent-memories/project-folds.js +34 -0
- package/dist/agent-memories/sync.js +8 -6
- package/dist/api/assemble.js +1 -1
- package/dist/api/audit.d.ts +29 -1
- package/dist/api/audit.js +44 -5
- package/dist/api/auth.d.ts +7 -4
- package/dist/api/auth.js +12 -8
- package/dist/api/auto-sleep.d.ts +5 -2
- package/dist/api/auto-sleep.js +7 -3
- package/dist/api/availability.js +2 -3
- package/dist/api/cards.d.ts +42 -0
- package/dist/api/cards.js +52 -0
- package/dist/api/conflicts.d.ts +28 -0
- package/dist/api/conflicts.js +61 -0
- package/dist/api/context-render.js +4 -3
- package/dist/api/context-select.js +9 -11
- package/dist/api/context.js +17 -8
- package/dist/api/continuity.d.ts +47 -0
- package/dist/api/continuity.js +66 -0
- package/dist/api/dormant.js +4 -2
- package/dist/api/drill-down.js +1 -1
- package/dist/api/embeddings.d.ts +17 -0
- package/dist/api/embeddings.js +28 -0
- package/dist/api/error-reply.d.ts +8 -0
- package/dist/api/error-reply.js +21 -0
- package/dist/api/forget.d.ts +6 -2
- package/dist/api/forget.js +18 -7
- package/dist/api/goals.d.ts +1 -1
- package/dist/api/goals.js +5 -9
- package/dist/api/index.d.ts +4 -2
- package/dist/api/index.js +4 -2
- package/dist/api/instruction-detect.js +5 -1
- package/dist/api/learn.d.ts +4 -0
- package/dist/api/learn.js +53 -27
- package/dist/api/ledger-db.d.ts +2 -6
- package/dist/api/ledger-db.js +4 -36
- package/dist/api/memories.d.ts +19 -1
- package/dist/api/memories.js +39 -0
- package/dist/api/objects.d.ts +1 -1
- package/dist/api/outcome.js +1 -1
- package/dist/api/pilot-arm.d.ts +1 -11
- package/dist/api/pilot-arm.js +5 -45
- package/dist/api/predictions.d.ts +3 -1
- package/dist/api/predictions.js +6 -0
- package/dist/api/projects.d.ts +21 -0
- package/dist/api/projects.js +24 -0
- package/dist/api/promote.js +1 -1
- package/dist/api/prompt-hook.d.ts +15 -2
- package/dist/api/prompt-hook.js +44 -4
- package/dist/api/recall-cli.d.ts +3 -0
- package/dist/api/recall-cli.js +13 -4
- package/dist/api/recall-core.js +3 -3
- package/dist/api/recall-pipeline.js +6 -7
- package/dist/api/recall-request.js +1 -1
- package/dist/api/recall.d.ts +0 -3
- package/dist/api/recall.js +19 -44
- package/dist/api/remember-local.js +1 -1
- package/dist/api/remember.d.ts +2 -1
- package/dist/api/remember.js +3 -2
- package/dist/api/session-end.d.ts +22 -0
- package/dist/api/session-end.js +101 -0
- package/dist/api/sleep-run.d.ts +1 -1
- package/dist/api/sleep-run.js +13 -9
- package/dist/api/status.d.ts +24 -0
- package/dist/api/status.js +40 -0
- package/dist/api/store-init.d.ts +4 -0
- package/dist/api/store-init.js +9 -0
- package/dist/api/tokens.js +1 -1
- package/dist/api/types.d.ts +2 -0
- package/dist/api/types.js +6 -1
- package/dist/capture/caller-session.d.ts +0 -3
- package/dist/capture/caller-session.js +1 -12
- package/dist/capture/capture-error.d.ts +2 -2
- package/dist/capture/capture-error.js +23 -18
- package/dist/capture/codex-patch.js +3 -1
- package/dist/capture/command.js +36 -95
- package/dist/capture/compact.js +10 -5
- package/dist/capture/compaction-items-caller.js +11 -20
- package/dist/capture/compaction-record.d.ts +7 -93
- package/dist/capture/compaction-record.js +29 -426
- package/dist/capture/compaction-spool.d.ts +4 -2
- package/dist/capture/compaction-spool.js +20 -6
- package/dist/capture/copilot-transcript.d.ts +2 -1
- package/dist/capture/copilot-transcript.js +2 -1
- package/dist/capture/extract.d.ts +5 -2
- package/dist/capture/extract.js +4 -3
- package/dist/capture/failure-caller.d.ts +1 -1
- package/dist/capture/failure-caller.js +21 -16
- package/dist/capture/failure-reading.d.ts +2 -1
- package/dist/capture/failure-reading.js +7 -9
- package/dist/capture/pre-compact-caller.js +5 -4
- package/dist/capture/session-digest.js +4 -3
- package/dist/capture/session-end-caller.js +2 -1
- package/dist/capture/session-worker.js +3 -4
- package/dist/capture/transcript.d.ts +2 -1
- package/dist/capture/transcript.js +6 -3
- package/dist/capture/working-state.d.ts +4 -2
- package/dist/capture/working-state.js +4 -2
- package/dist/cli/audit-prune.d.ts +0 -25
- package/dist/cli/audit-prune.js +1 -27
- package/dist/cli/audit.js +13 -13
- package/dist/cli/auth.d.ts +1 -1
- package/dist/cli/auth.js +12 -13
- package/dist/cli/briefs.d.ts +1 -4
- package/dist/cli/briefs.js +37 -292
- package/dist/cli/card.js +41 -33
- package/dist/cli/client.d.ts +5 -0
- package/dist/cli/client.js +24 -8
- package/dist/cli/compact-resume-payload.js +1 -1
- package/dist/cli/context.d.ts +1 -1
- package/dist/cli/context.js +12 -12
- package/dist/cli/continuity.d.ts +1 -1
- package/dist/cli/continuity.js +36 -39
- package/dist/cli/curate.d.ts +1 -1
- package/dist/cli/curate.js +23 -27
- package/dist/cli/dag.d.ts +1 -1
- package/dist/cli/dag.js +23 -8
- package/dist/cli/decisions.d.ts +0 -2
- package/dist/cli/decisions.js +4 -281
- package/dist/cli/eval.d.ts +1 -1
- package/dist/cli/eval.js +12 -13
- package/dist/cli/explain.d.ts +1 -1
- package/dist/cli/explain.js +21 -25
- package/dist/cli/flag-values.js +16 -6
- package/dist/cli/flags.d.ts +0 -289
- package/dist/cli/flags.js +3 -138
- package/dist/cli/graph.d.ts +3 -0
- package/dist/cli/graph.js +83 -0
- package/dist/cli/hook-runtime.d.ts +3 -5
- package/dist/cli/hook-runtime.js +7 -34
- package/dist/cli/incidents.d.ts +3 -0
- package/dist/cli/incidents.js +112 -0
- package/dist/cli/init.d.ts +1 -1
- package/dist/cli/init.js +28 -19
- package/dist/cli/install-steps.d.ts +2 -1
- package/dist/cli/install-steps.js +11 -3
- package/dist/cli/last-sleep.js +1 -1
- package/dist/cli/lenient-id.d.ts +2 -0
- package/dist/cli/lenient-id.js +13 -0
- package/dist/cli/maintenance.d.ts +3 -3
- package/dist/cli/maintenance.js +29 -30
- package/dist/cli/notes.d.ts +2 -0
- package/dist/cli/notes.js +41 -0
- package/dist/cli/open-browser.d.ts +14 -0
- package/dist/cli/open-browser.js +26 -0
- package/dist/cli/playbooks.d.ts +3 -4
- package/dist/cli/playbooks.js +126 -290
- package/dist/cli/predictions.d.ts +3 -0
- package/dist/cli/predictions.js +175 -0
- package/dist/cli/print.js +2 -1
- package/dist/cli/projects.js +30 -22
- package/dist/cli/quality-repair-once.d.ts +1 -1
- package/dist/cli/quality-repair-once.js +6 -5
- package/dist/cli/recall.js +13 -7
- package/dist/cli/refine-llm.js +17 -17
- package/dist/cli/remember.js +12 -12
- package/dist/cli/scheduler.js +2 -1
- package/dist/cli/serve.js +3 -3
- package/dist/cli/session-hooks.d.ts +1 -1
- package/dist/cli/session-hooks.js +45 -115
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.js +17 -10
- package/dist/cli/shared.d.ts +2 -6
- package/dist/cli/shared.js +9 -29
- package/dist/cli/sleep-render.js +6 -3
- package/dist/cli/sleep.js +6 -37
- package/dist/cli/status.d.ts +3 -3
- package/dist/cli/status.js +32 -35
- package/dist/cli/transfer.d.ts +1 -1
- package/dist/cli/transfer.js +33 -31
- package/dist/cli/usage.d.ts +0 -79
- package/dist/cli/usage.js +1 -695
- package/dist/cli/verb-row.d.ts +32 -0
- package/dist/cli/verb-row.js +6 -0
- package/dist/cli/verbs/health.d.ts +27 -0
- package/dist/cli/verbs/health.js +232 -0
- package/dist/cli/verbs/memory.d.ts +16 -0
- package/dist/cli/verbs/memory.js +244 -0
- package/dist/cli/verbs/objects.d.ts +20 -0
- package/dist/cli/verbs/objects.js +254 -0
- package/dist/cli/verbs/sessions.d.ts +31 -0
- package/dist/cli/verbs/sessions.js +312 -0
- package/dist/cli/verbs.d.ts +81 -0
- package/dist/cli/verbs.js +7 -0
- package/dist/cli/versioned-verbs.d.ts +51 -0
- package/dist/cli/versioned-verbs.js +79 -0
- package/dist/cli.d.ts +1 -272
- package/dist/cli.js +23 -313
- package/dist/connectors/dlq.d.ts +39 -3
- package/dist/connectors/dlq.js +37 -3
- package/dist/connectors/github/backfill.js +12 -3
- package/dist/connectors/github/dlq.js +31 -73
- package/dist/connectors/github/ingest.d.ts +2 -6
- package/dist/connectors/github/ingest.js +3 -28
- package/dist/connectors/github/webhook.d.ts +2 -1
- package/dist/connectors/github/webhook.js +33 -2
- package/dist/connectors/ingest.d.ts +10 -0
- package/dist/connectors/ingest.js +28 -0
- package/dist/connectors/slack/dlq.js +49 -71
- package/dist/connectors/slack/ingest.d.ts +2 -6
- package/dist/connectors/slack/ingest.js +2 -27
- package/dist/connectors/slack/webhook.d.ts +2 -1
- package/dist/connectors/slack/webhook.js +2 -1
- package/dist/consolidate/conflicts.js +1 -1
- package/dist/consolidate/dag.js +15 -9
- package/dist/consolidate/dedupe.d.ts +7 -0
- package/dist/consolidate/dedupe.js +5 -3
- package/dist/consolidate/llm-passes.js +45 -19
- package/dist/consolidate/memory-value.js +2 -1
- package/dist/consolidate/merge.js +2 -2
- package/dist/consolidate/physics-pass.d.ts +6 -1
- package/dist/consolidate/physics-pass.js +26 -6
- package/dist/consolidate/replay.js +11 -4
- package/dist/consolidate/sleep.js +8 -5
- package/dist/consolidate/traces.js +3 -3
- package/dist/core/ablation.d.ts +10 -0
- package/dist/core/ablation.js +12 -0
- package/dist/{sharing/scope.d.ts → core/active-scope.d.ts} +1 -1
- package/dist/{sharing/scope.js → core/active-scope.js} +1 -1
- package/dist/core/ambient.d.ts +4 -0
- package/dist/core/ambient.js +39 -18
- package/dist/core/api-errors.d.ts +16 -0
- package/dist/core/api-errors.js +20 -0
- package/dist/core/card.js +3 -1
- package/dist/core/compaction-timing.d.ts +7 -0
- package/dist/core/compaction-timing.js +9 -0
- package/dist/core/config.d.ts +1 -1
- package/dist/core/config.js +7 -2
- package/dist/core/cosine.d.ts +3 -0
- package/dist/core/cosine.js +19 -0
- package/dist/{store → core}/markdown.d.ts +1 -1
- package/dist/{store → core}/markdown.js +2 -2
- package/dist/core/memory-audit.d.ts +17 -0
- package/dist/core/memory-audit.js +54 -0
- package/dist/core/memory.d.ts +10 -4
- package/dist/core/memory.js +25 -18
- package/dist/{consolidate → core}/merged-row.d.ts +1 -1
- package/dist/{consolidate → core}/merged-row.js +1 -1
- package/dist/core/physics.js +6 -16
- package/dist/core/prediction.d.ts +3 -0
- package/dist/core/prediction.js +6 -0
- package/dist/core/project-identity.d.ts +3 -0
- package/dist/core/project-identity.js +10 -1
- package/dist/{store → core}/recall-scope.d.ts +1 -10
- package/dist/{store → core}/recall-scope.js +2 -19
- package/dist/db/busy.d.ts +2 -7
- package/dist/db/busy.js +21 -26
- package/dist/db/connect.d.ts +0 -1
- package/dist/db/connect.js +5 -6
- package/dist/db/index.d.ts +3 -3
- package/dist/db/index.js +3 -3
- package/dist/db/migrations/index.d.ts +1 -1
- package/dist/db/migrations/index.js +3 -1
- package/dist/db/migrations/v55.d.ts +3 -0
- package/dist/db/migrations/v55.js +17 -0
- package/dist/db/open.d.ts +0 -2
- package/dist/db/open.js +6 -10
- package/dist/db/physics-state.js +3 -3
- package/dist/db/tables.d.ts +2 -0
- package/dist/db/tables.js +6 -2
- package/dist/db/vector-store.js +17 -4
- package/dist/db/wal-checkpointer.js +2 -1
- package/dist/doctor.js +11 -8
- package/dist/embeddings/local.d.ts +62 -0
- package/dist/embeddings/local.js +146 -0
- package/dist/{store/embeddings → embeddings}/provider.d.ts +5 -2
- package/dist/{store/embeddings → embeddings}/provider.js +18 -15
- package/dist/embeddings/transformers.d.ts +26 -0
- package/dist/embeddings/transformers.js +89 -0
- package/dist/entry/session-text.d.ts +1 -1
- package/dist/entry/session-text.js +1 -1
- package/dist/eval/eval-suite.js +17 -11
- package/dist/eval/eval.js +1 -1
- package/dist/eval/judgment.js +11 -4
- package/dist/graph/extract.js +3 -3
- package/dist/graph/recall.js +1 -1
- package/dist/graph/view.js +13 -5
- package/dist/graph/write.d.ts +1 -1
- package/dist/graph/write.js +9 -9
- package/dist/hooks/codex-session.js +3 -2
- package/dist/hooks/codex-wrapper.js +2 -1
- package/dist/hooks/json-hooks.js +4 -2
- package/dist/hooks/opencode.js +8 -5
- package/dist/hooks/shared.d.ts +0 -6
- package/dist/hooks/shared.js +4 -15
- package/dist/importers/core.js +1 -1
- package/dist/importers/sources.js +5 -4
- package/dist/importers/vault.js +7 -5
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/learn/autolearn.d.ts +10 -2
- package/dist/learn/autolearn.js +32 -12
- package/dist/learn/churn-git.js +13 -4
- package/dist/learn/extract.d.ts +3 -2
- package/dist/learn/extract.js +6 -4
- package/dist/learn/forward-claim-detector.js +4 -2
- package/dist/learn/invalidation.js +10 -6
- package/dist/mcp/admin-tools.d.ts +2 -2
- package/dist/mcp/admin-tools.js +27 -48
- package/dist/mcp/format.js +3 -2
- package/dist/mcp/framing.d.ts +1 -0
- package/dist/mcp/framing.js +1 -1
- package/dist/mcp/memory-tools.js +3 -1
- package/dist/mcp/protocol.d.ts +11 -7
- package/dist/mcp/protocol.js +25 -12
- package/dist/mcp/recall-tools.js +12 -9
- package/dist/mcp/request.js +2 -1
- package/dist/mcp/stdio.js +24 -8
- package/dist/mcp/tool-args.js +2 -1
- package/dist/mcp/tools.js +44 -21
- package/dist/objects/customer-notes.d.ts +2 -2
- package/dist/objects/decisions.d.ts +2 -2
- package/dist/objects/descriptor.d.ts +1 -1
- package/dist/objects/incidents.d.ts +2 -2
- package/dist/objects/lifecycle.d.ts +1 -1
- package/dist/objects/lifecycle.js +2 -1
- package/dist/objects/policies.d.ts +2 -2
- package/dist/objects/policies.js +2 -1
- package/dist/objects/processes.d.ts +2 -2
- package/dist/objects/project-briefs.d.ts +2 -2
- package/dist/objects/project-briefs.js +2 -3
- package/dist/objects/skills.d.ts +2 -2
- package/dist/postinstall.js +1 -1
- package/dist/rerankers/clef.js +3 -6
- package/dist/rerankers/cross-encoder.d.ts +31 -2
- package/dist/rerankers/cross-encoder.js +63 -97
- package/dist/rerankers/index.js +5 -4
- package/dist/rerankers/jev.js +2 -4
- package/dist/rerankers/outage-warning.d.ts +3 -1
- package/dist/rerankers/outage-warning.js +5 -3
- package/dist/search/bm25-search.js +1 -1
- package/dist/search/boosts.js +1 -1
- package/dist/search/embed-memories.d.ts +9 -0
- package/dist/search/embed-memories.js +377 -0
- package/dist/search/goal-boost.d.ts +1 -1
- package/dist/search/goal-boost.js +6 -3
- package/dist/search/hybrid.d.ts +9 -2
- package/dist/search/hybrid.js +9 -4
- package/dist/search/physics-search.d.ts +6 -3
- package/dist/search/physics-search.js +22 -15
- package/dist/search/rerank.js +1 -1
- package/dist/search/vector.d.ts +8 -6
- package/dist/search/vector.js +10 -13
- package/dist/server/auth.d.ts +2 -0
- package/dist/server/auth.js +17 -7
- package/dist/server/boot.js +7 -66
- package/dist/server/client-ip.d.ts +0 -2
- package/dist/server/client-ip.js +3 -2
- package/dist/server/deadline.d.ts +0 -2
- package/dist/server/deadline.js +1 -7
- package/dist/server/defaults.d.ts +1 -0
- package/dist/server/defaults.js +1 -0
- package/dist/server/mcp-http.js +16 -11
- package/dist/server/request.js +7 -2
- package/dist/server/route-checks.d.ts +7 -0
- package/dist/server/route-checks.js +42 -0
- package/dist/server/route-table.d.ts +9 -8
- package/dist/server/route-table.js +127 -132
- package/dist/server/routes/admin.d.ts +8 -8
- package/dist/server/routes/admin.js +13 -21
- package/dist/server/routes/customer-notes.d.ts +6 -6
- package/dist/server/routes/customer-notes.js +1 -2
- package/dist/server/routes/decisions.d.ts +6 -6
- package/dist/server/routes/decisions.js +2 -4
- package/dist/server/routes/incidents.d.ts +6 -6
- package/dist/server/routes/incidents.js +2 -5
- package/dist/server/routes/memories.d.ts +9 -9
- package/dist/server/routes/memories.js +15 -38
- package/dist/server/routes/object-routes.d.ts +6 -6
- package/dist/server/routes/object-routes.js +4 -7
- package/dist/server/routes/policies.d.ts +7 -7
- package/dist/server/routes/policies.js +2 -4
- package/dist/server/routes/predictions.d.ts +6 -6
- package/dist/server/routes/predictions.js +9 -13
- package/dist/server/routes/processes.d.ts +6 -6
- package/dist/server/routes/processes.js +1 -2
- package/dist/server/routes/project-briefs.d.ts +7 -7
- package/dist/server/routes/project-briefs.js +2 -4
- package/dist/server/routes/recall.d.ts +5 -5
- package/dist/server/routes/recall.js +6 -10
- package/dist/server/routes/skills.d.ts +7 -7
- package/dist/server/routes/skills.js +2 -4
- package/dist/server/server-detect.d.ts +7 -1
- package/dist/server/server-detect.js +36 -11
- package/dist/server/sleep-child.js +26 -7
- package/dist/server/sleep-offload.d.ts +11 -5
- package/dist/server/sleep-offload.js +17 -11
- package/dist/server/types.d.ts +22 -10
- package/dist/server/validation.d.ts +1 -2
- package/dist/server/validation.js +6 -11
- package/dist/server.d.ts +5 -4
- package/dist/server.js +5 -4
- package/dist/sharing/global-store.js +2 -2
- package/dist/sharing/global-sync.js +38 -45
- package/dist/sharing/project-merge.d.ts +7 -14
- package/dist/sharing/project-merge.js +57 -121
- package/dist/sharing/search-both.js +1 -1
- package/dist/sharing/share.d.ts +2 -0
- package/dist/sharing/share.js +37 -34
- package/dist/store/ambient.js +5 -6
- package/dist/store/audit-event.d.ts +1 -1
- package/dist/store/audit.d.ts +0 -16
- package/dist/store/audit.js +4 -55
- package/dist/store/auth.d.ts +4 -2
- package/dist/store/auth.js +7 -3
- package/dist/store/candidates.d.ts +3 -2
- package/dist/store/candidates.js +42 -23
- package/dist/store/capture-write.d.ts +17 -0
- package/dist/store/capture-write.js +35 -0
- package/dist/store/cards.js +1 -1
- package/dist/store/compaction-caller.d.ts +18 -0
- package/dist/store/compaction-caller.js +29 -0
- package/dist/store/compactions-record.d.ts +115 -0
- package/dist/store/compactions-record.js +417 -0
- package/dist/store/compactions.js +6 -4
- package/dist/store/conflicts.js +7 -4
- package/dist/store/connectors/dlq.d.ts +10 -0
- package/dist/store/connectors/dlq.js +32 -0
- package/dist/store/connectors/github.d.ts +7 -9
- package/dist/store/connectors/github.js +30 -53
- package/dist/store/connectors/slack.d.ts +2 -11
- package/dist/store/connectors/slack.js +18 -47
- package/dist/store/dashboard-reads.js +7 -6
- package/dist/store/delete-and-batch.d.ts +6 -0
- package/dist/store/delete-and-batch.js +36 -3
- package/dist/store/delivery-recorder.d.ts +10 -3
- package/dist/store/delivery-recorder.js +12 -5
- package/dist/store/descendant-page.js +6 -3
- package/dist/store/dormant.d.ts +1 -1
- package/dist/store/dormant.js +3 -1
- package/dist/store/embeddings/index.d.ts +2 -12
- package/dist/store/embeddings/index.js +5 -374
- package/dist/store/entry-reads.d.ts +13 -4
- package/dist/store/entry-reads.js +47 -11
- package/dist/store/entry-writes.d.ts +5 -5
- package/dist/store/entry-writes.js +32 -12
- package/dist/store/failure-log-at.d.ts +8 -0
- package/dist/store/failure-log-at.js +16 -0
- package/dist/store/failure-log.d.ts +2 -2
- package/dist/store/failure-log.js +5 -3
- package/dist/{trust → store}/gated-write.d.ts +3 -1
- package/dist/{trust → store}/gated-write.js +7 -5
- package/dist/store/goals.js +20 -18
- package/dist/store/graph-reads.js +4 -2
- package/dist/store/graph-writes.d.ts +6 -6
- package/dist/store/graph-writes.js +48 -71
- package/dist/store/handoffs.d.ts +1 -1
- package/dist/store/handoffs.js +6 -6
- package/dist/store/index-and-stats.js +2 -2
- package/dist/store/key-writes.js +1 -1
- package/dist/store/ledger-turn.d.ts +9 -0
- package/dist/store/ledger-turn.js +38 -0
- package/dist/store/mirrors.js +10 -6
- package/dist/store/open.d.ts +0 -4
- package/dist/store/open.js +40 -53
- package/dist/store/pilot-arm.d.ts +12 -0
- package/dist/store/pilot-arm.js +42 -0
- package/dist/store/port.d.ts +9 -3
- package/dist/store/port.js +8 -0
- package/dist/store/predictions.d.ts +1 -2
- package/dist/store/predictions.js +3 -6
- package/dist/store/project-tags.d.ts +62 -0
- package/dist/store/project-tags.js +67 -0
- package/dist/store/quarantine.js +2 -1
- package/dist/store/recall-trace.d.ts +2 -0
- package/dist/store/recall-trace.js +18 -2
- package/dist/store/rejected-values.js +2 -1
- package/dist/store/rejection-probe.d.ts +4 -0
- package/dist/store/rejection-probe.js +19 -0
- package/dist/store/rejection.d.ts +0 -17
- package/dist/store/rejection.js +1 -21
- package/dist/store/rule-sql.d.ts +9 -0
- package/dist/store/rule-sql.js +21 -2
- package/dist/store/search-rows.js +9 -4
- package/dist/store/sessions.js +4 -2
- package/dist/store/set-aside.d.ts +14 -0
- package/dist/store/set-aside.js +23 -0
- package/dist/store/sqlite/busy.d.ts +3 -0
- package/dist/store/sqlite/busy.js +8 -0
- package/dist/store/sqlite/connector-events-group.js +4 -7
- package/dist/store/sqlite/connector-writes-group.js +3 -3
- package/dist/store/sqlite/entry-writes-group.js +2 -2
- package/dist/store/sqlite/error-codec.js +4 -3
- package/dist/store/sqlite/executor.js +10 -4
- package/dist/store/sqlite/graph-reads-group.js +1 -1
- package/dist/store/sqlite/held-connection.d.ts +9 -0
- package/dist/store/sqlite/held-connection.js +41 -0
- package/dist/store/sqlite/object-rows.d.ts +1 -1
- package/dist/store/sqlite/objects-group.d.ts +1 -1
- package/dist/store/sqlite/objects-group.js +1 -1
- package/dist/store/sqlite/store.js +14 -12
- package/dist/store/summaries.d.ts +3 -3
- package/dist/store/summaries.js +5 -4
- package/dist/store/token-ledger.d.ts +0 -7
- package/dist/store/token-ledger.js +0 -35
- package/dist/store/vector-index.js +3 -2
- package/dist/support-bundle.js +2 -3
- package/dist/trust/reject-flow.js +2 -2
- package/dist/util/agent-homes.d.ts +15 -0
- package/dist/util/agent-homes.js +34 -0
- package/dist/util/anthropic-messages.d.ts +3 -0
- package/dist/util/anthropic-messages.js +22 -5
- package/dist/util/chunked.d.ts +3 -0
- package/dist/util/chunked.js +10 -0
- package/dist/util/ellipsize.d.ts +3 -0
- package/dist/util/ellipsize.js +5 -0
- package/dist/util/env.d.ts +2 -1
- package/dist/util/env.js +2 -1
- package/dist/util/format.d.ts +3 -0
- package/dist/util/format.js +6 -0
- package/dist/util/hook-payload.d.ts +8 -0
- package/dist/util/hook-payload.js +37 -0
- package/dist/util/http-retry.d.ts +6 -0
- package/dist/util/http-retry.js +43 -5
- package/dist/util/http-util.d.ts +0 -8
- package/dist/util/http-util.js +10 -21
- package/dist/util/limits.d.ts +7 -0
- package/dist/util/limits.js +14 -0
- package/dist/util/log.d.ts +4 -0
- package/dist/util/log.js +9 -0
- package/dist/util/request-scope.d.ts +3 -1
- package/dist/util/request-scope.js +11 -6
- package/dist/util/secret-detect.js +6 -1
- package/dist/util/sqlite-blocked.d.ts +2 -0
- package/dist/util/sqlite-blocked.js +5 -0
- package/dist/util/stream-tee.d.ts +3 -0
- package/dist/util/stream-tee.js +35 -0
- package/dist/util/time.d.ts +4 -0
- package/dist/util/time.js +4 -0
- package/dist/util/version.d.ts +1 -1
- package/dist/util/version.js +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 +2 -2
- package/dist/store/embeddings/local.d.ts +0 -15
- package/dist/store/embeddings/local.js +0 -175
- /package/dist/{cli → api}/correction-latency.d.ts +0 -0
- /package/dist/{cli → api}/correction-latency.js +0 -0
- /package/dist/{cli → api}/provenance-coverage.d.ts +0 -0
- /package/dist/{cli → api}/provenance-coverage.js +0 -0
- /package/dist/{store → core}/object-types.d.ts +0 -0
- /package/dist/{store → core}/object-types.js +0 -0
- /package/dist/{capture → util}/compaction-items.d.ts +0 -0
- /package/dist/{capture → util}/compaction-items.js +0 -0
- /package/dist/{store → util}/yaml.d.ts +0 -0
- /package/dist/{store → util}/yaml.js +0 -0
package/dist/cli/context.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
// The `hippo context` verb, which the per-prompt hook also runs; main() loads it lazily from the command table.
|
|
2
|
-
import { isSubagentPayload } from '../
|
|
2
|
+
import { isSubagentPayload } from '../util/hook-payload.js';
|
|
3
3
|
import { estimateTokens } from '../util/token-text.js';
|
|
4
4
|
import { autoDetectContext } from '../api/context-auto.js';
|
|
5
|
-
import { detectScope } from '../
|
|
5
|
+
import { detectScope } from '../core/active-scope.js';
|
|
6
6
|
import { bookLedgerTurn } from '../api/ledger-db.js';
|
|
7
7
|
import { readHookStdin } from './stdin.js';
|
|
8
8
|
import { isJsonObject, isJsonString } from '../util/json.js';
|
|
9
9
|
import * as api from '../api/index.js';
|
|
10
10
|
import { DEFAULT_CONTEXT_BUDGET } from '../api/context.js';
|
|
11
|
-
import { resolveTenantId } from '../store/tenant.js';
|
|
12
11
|
import { cliApiContext } from './api-context.js';
|
|
13
12
|
import { renderAmbientSummary } from '../core/ambient.js';
|
|
14
13
|
import { contextBlockLines, contextCost, crossProjectLines, settleTokens } from '../api/context-render.js';
|
|
15
|
-
import { additionalContextOutput, flushDeliveryRecorder, hasContextData, sessionStartEnvelope, toRenderItems, } from '../api/prompt-hook.js';
|
|
14
|
+
import { additionalContextOutput, flushDeliveryRecorder, hasContextData, startDeliveryRecorder, sessionStartEnvelope, toRenderItems, } from '../api/prompt-hook.js';
|
|
16
15
|
import { parseLimitFlag, parseCountFlag, parseBudgetFlag, flagIsTrue } from './flag-values.js';
|
|
17
16
|
import { requireInit } from './shared.js';
|
|
18
17
|
import { printActiveTaskSnapshot, printSessionEvents, printHandoff, captureConsole } from './print.js';
|
|
19
|
-
import { hostSessionId, hookStoreRoot, hookRuntime, payloadCwdRoot, runHookWithStores, inPilotHoldout
|
|
20
|
-
async function cmdContext(hippoRoot, args, flags, stdinText) {
|
|
21
|
-
const rec = startDeliveryRecorder(hippoRoot,
|
|
18
|
+
import { hostSessionId, hookStoreRoot, hookRuntime, payloadCwdRoot, runHookWithStores, inPilotHoldout } from './hook-runtime.js';
|
|
19
|
+
async function cmdContext(hippoRoot, tenantId, args, flags, stdinText) {
|
|
20
|
+
const rec = startDeliveryRecorder(cliApiContext(hippoRoot, tenantId), {
|
|
21
|
+
stdinText, runtime: hookRuntime(flags), eventType: flagIsTrue(flags, 'pinned-only') ? undefined : 'context', envSessionId: hostSessionId(),
|
|
22
|
+
});
|
|
22
23
|
// No try/finally: a render throw keeps its own exit code and writes no event.
|
|
23
|
-
await renderContext(hippoRoot, args, flags, stdinText, rec);
|
|
24
|
+
await renderContext(hippoRoot, tenantId, args, flags, stdinText, rec);
|
|
24
25
|
flushDeliveryRecorder(rec);
|
|
25
26
|
}
|
|
26
27
|
/** The hook payload's session id and raw prompt; a malformed or empty payload yields neither. */
|
|
@@ -43,7 +44,7 @@ function readHookPayload(stdinText) {
|
|
|
43
44
|
}
|
|
44
45
|
return { sessionId, prompt };
|
|
45
46
|
}
|
|
46
|
-
async function renderContext(hippoRoot, args, flags, stdinText, rec) {
|
|
47
|
+
async function renderContext(hippoRoot, resolvedTenant, args, flags, stdinText, rec) {
|
|
47
48
|
// --pinned-only fires on every prompt, even where no local .hippo exists, so it skips requireInit
|
|
48
49
|
// and api.getContext falls back to global-only.
|
|
49
50
|
const pinnedOnly = flagIsTrue(flags, 'pinned-only');
|
|
@@ -53,7 +54,6 @@ async function renderContext(hippoRoot, args, flags, stdinText, rec) {
|
|
|
53
54
|
const session = resolveContextSession(stdinText);
|
|
54
55
|
const { currentSessionId, ledgerSessionId, payloadSessionId } = session;
|
|
55
56
|
// The pilot arm is booked at the first hook call whatever the flags, so the holdout sees no budget or content branch.
|
|
56
|
-
const resolvedTenant = resolveTenantId({});
|
|
57
57
|
if (inPilotHoldout(hippoRoot, resolvedTenant, currentSessionId, payloadSessionId !== undefined)) {
|
|
58
58
|
rec?.disabled();
|
|
59
59
|
return;
|
|
@@ -199,10 +199,10 @@ function printCrossProjectSection(items) {
|
|
|
199
199
|
for (const line of crossProjectLines(items))
|
|
200
200
|
console.log(line);
|
|
201
201
|
}
|
|
202
|
-
export async function handleContext({ hippoRoot, args, flags }) {
|
|
202
|
+
export async function handleContext({ hippoRoot, tenantId, args, flags }) {
|
|
203
203
|
// Bounded, not a TTY guard: the hot stdin path and a manual run share this one command.
|
|
204
204
|
const { text: stdinText } = await readHookStdin();
|
|
205
205
|
const root = payloadCwdRoot(hippoRoot, stdinText, hookRuntime(flags));
|
|
206
|
-
await runHookWithStores(() => cmdContext(hookStoreRoot(root), args, flags, stdinText));
|
|
206
|
+
await runHookWithStores(() => cmdContext(hookStoreRoot(root), tenantId, args, flags, stdinText));
|
|
207
207
|
}
|
|
208
208
|
//# sourceMappingURL=context.js.map
|
package/dist/cli/continuity.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export declare function handleSnapshot({ hippoRoot, tenantId, args, flags }: Com
|
|
|
3
3
|
export declare function handleSession({ hippoRoot, tenantId, args, flags }: CommandContext): void;
|
|
4
4
|
export declare function handleHandoff({ hippoRoot, tenantId, args, flags }: CommandContext): void;
|
|
5
5
|
export declare function handleCurrent({ hippoRoot, tenantId, args, flags }: CommandContext): void;
|
|
6
|
-
export declare function handleWm({ hippoRoot, args, flags }: CommandContext): void;
|
|
6
|
+
export declare function handleWm({ hippoRoot, tenantId, args, flags }: CommandContext): void;
|
|
7
7
|
//# sourceMappingURL=continuity.d.ts.map
|
package/dist/cli/continuity.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// Where-you-left-off verbs: snapshot, session, handoff, current and working memory.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { snapshotSave as apiSnapshotSave, snapshotClear as apiSnapshotClear, snapshotLoad, sessionEventAppend, sessionEventList, continuityLatest, handoffStampOutcome, handoffSave, handoffLatest as apiHandoffLatest, handoffById, workingMemoryPush, workingMemoryRead, workingMemoryClear, workingMemoryFlush, } from '../api/continuity.js';
|
|
3
|
+
import { cliApiContext } from './api-context.js';
|
|
4
4
|
import { isHandoffOutcome, formatHandoffEvidenceLine } from '../core/handoff.js';
|
|
5
|
-
import { wmPush, wmRead, wmClear, wmFlush } from '../store/working-memory.js';
|
|
6
5
|
import { collectHandoffEvidence } from '../capture/handoff-evidence.js';
|
|
7
6
|
import { printError } from './output.js';
|
|
8
7
|
import { requireInit } from './shared.js';
|
|
9
8
|
import { printActiveTaskSnapshot, printSessionEvents, printHandoff } from './print.js';
|
|
10
|
-
import { boolFlag, isStringFlag } from './flag-values.js';
|
|
9
|
+
import { boolFlag, isStringFlag, numberFlag } from './flag-values.js';
|
|
11
10
|
import { CliExit } from './exit.js';
|
|
12
11
|
const ISO_DATETIME_CHARS = 19;
|
|
13
12
|
function snapshotSave(hippoRoot, tenantId, flags) {
|
|
@@ -19,7 +18,7 @@ function snapshotSave(hippoRoot, tenantId, flags) {
|
|
|
19
18
|
printError('Usage: hippo snapshot save --task <task> --summary <summary> --next-step <step> [--source <source>] [--session <session-id>]');
|
|
20
19
|
throw new CliExit(1);
|
|
21
20
|
}
|
|
22
|
-
const snapshot =
|
|
21
|
+
const snapshot = apiSnapshotSave(cliApiContext(hippoRoot, tenantId), {
|
|
23
22
|
task,
|
|
24
23
|
summary,
|
|
25
24
|
next_step: nextStep,
|
|
@@ -34,7 +33,7 @@ function snapshotSave(hippoRoot, tenantId, flags) {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
function snapshotClear(hippoRoot, tenantId, flags) {
|
|
37
|
-
const cleared =
|
|
36
|
+
const cleared = apiSnapshotClear(cliApiContext(hippoRoot, tenantId), String(flags['status'] ?? 'cleared'));
|
|
38
37
|
if (!cleared) {
|
|
39
38
|
console.log('No active task snapshot to clear.');
|
|
40
39
|
return;
|
|
@@ -42,7 +41,7 @@ function snapshotClear(hippoRoot, tenantId, flags) {
|
|
|
42
41
|
console.log('Cleared active task snapshot.');
|
|
43
42
|
}
|
|
44
43
|
function snapshotShow(hippoRoot, tenantId, flags) {
|
|
45
|
-
const snapshot =
|
|
44
|
+
const snapshot = snapshotLoad(cliApiContext(hippoRoot, tenantId));
|
|
46
45
|
if (!snapshot) {
|
|
47
46
|
if (flags['json']) {
|
|
48
47
|
console.log(JSON.stringify({ snapshot: null }));
|
|
@@ -77,7 +76,7 @@ function sessionLog(hippoRoot, tenantId, s, flags) {
|
|
|
77
76
|
printError('Usage: hippo session log --id <session-id> --content <text> [--type <type>] [--task <task>] [--source <source>]');
|
|
78
77
|
throw new CliExit(1);
|
|
79
78
|
}
|
|
80
|
-
const event =
|
|
79
|
+
const event = sessionEventAppend(cliApiContext(hippoRoot, tenantId), {
|
|
81
80
|
session_id: s.sessionId,
|
|
82
81
|
task: s.task || null,
|
|
83
82
|
event_type: eventType || 'note',
|
|
@@ -89,7 +88,7 @@ function sessionLog(hippoRoot, tenantId, s, flags) {
|
|
|
89
88
|
console.log(` Type: ${event.event_type}`);
|
|
90
89
|
}
|
|
91
90
|
function sessionShow(hippoRoot, tenantId, s, flags) {
|
|
92
|
-
const events =
|
|
91
|
+
const events = sessionEventList(cliApiContext(hippoRoot, tenantId), {
|
|
93
92
|
session_id: s.sessionId || undefined,
|
|
94
93
|
task: s.task || undefined,
|
|
95
94
|
limit: s.limit,
|
|
@@ -101,9 +100,8 @@ function sessionShow(hippoRoot, tenantId, s, flags) {
|
|
|
101
100
|
printSessionEvents(events);
|
|
102
101
|
}
|
|
103
102
|
function sessionLatest(hippoRoot, tenantId, s, flags) {
|
|
104
|
-
const snapshot =
|
|
105
|
-
|
|
106
|
-
session_id: s.sessionId || snapshot?.session_id || undefined,
|
|
103
|
+
const { snapshot, events } = continuityLatest(cliApiContext(hippoRoot, tenantId), {
|
|
104
|
+
sessionId: s.sessionId,
|
|
107
105
|
limit: s.limit,
|
|
108
106
|
});
|
|
109
107
|
if (flags['json']) {
|
|
@@ -135,7 +133,7 @@ function sessionComplete(hippoRoot, tenantId, s, flags) {
|
|
|
135
133
|
const metadata = { ended_at: new Date().toISOString() };
|
|
136
134
|
if (summary)
|
|
137
135
|
metadata.summary = summary;
|
|
138
|
-
const event =
|
|
136
|
+
const event = sessionEventAppend(cliApiContext(hippoRoot, tenantId), {
|
|
139
137
|
session_id: sessionId,
|
|
140
138
|
task: task || null,
|
|
141
139
|
event_type: 'session_complete',
|
|
@@ -144,7 +142,7 @@ function sessionComplete(hippoRoot, tenantId, s, flags) {
|
|
|
144
142
|
metadata,
|
|
145
143
|
});
|
|
146
144
|
console.log(`Completed session ${event.session_id} with outcome=${outcome} (event #${event.id})`);
|
|
147
|
-
const stamped =
|
|
145
|
+
const stamped = handoffStampOutcome(cliApiContext(hippoRoot, tenantId), sessionId, outcome);
|
|
148
146
|
if (stamped > 0) {
|
|
149
147
|
console.log(`Stamped outcome on handoff for session ${sessionId}`);
|
|
150
148
|
}
|
|
@@ -154,7 +152,7 @@ export function handleSession({ hippoRoot, tenantId, args, flags }) {
|
|
|
154
152
|
const subcommand = args[0] ?? 'show';
|
|
155
153
|
const sessionId = String(flags['id'] ?? flags['session'] ?? '').trim();
|
|
156
154
|
const task = String(flags['task'] ?? '').trim();
|
|
157
|
-
const limit = Math.max(1,
|
|
155
|
+
const limit = Math.max(1, numberFlag(flags, 'limit') || 8);
|
|
158
156
|
const s = { sessionId, task, limit };
|
|
159
157
|
if (subcommand === 'log')
|
|
160
158
|
return sessionLog(hippoRoot, tenantId, s, flags);
|
|
@@ -170,7 +168,7 @@ export function handleSession({ hippoRoot, tenantId, args, flags }) {
|
|
|
170
168
|
throw new CliExit(1);
|
|
171
169
|
}
|
|
172
170
|
function sessionResume(hippoRoot, tenantId, sessionId) {
|
|
173
|
-
const handoff =
|
|
171
|
+
const handoff = apiHandoffLatest(cliApiContext(hippoRoot, tenantId), sessionId || undefined);
|
|
174
172
|
if (!handoff) {
|
|
175
173
|
console.log('No handoff to resume from.');
|
|
176
174
|
return;
|
|
@@ -217,10 +215,13 @@ function sessionResume(hippoRoot, tenantId, sessionId) {
|
|
|
217
215
|
function flagList(value) {
|
|
218
216
|
return Array.isArray(value) ? value : (isStringFlag(value) ? [value] : []);
|
|
219
217
|
}
|
|
218
|
+
const HANDOFF_CREATE_USAGE = 'Usage: hippo handoff create --summary "..." [--next "..."] [--session <id>] [--task <id>] [--artifact <path>...] ' +
|
|
219
|
+
'[--constraint <text>...] [--outcome <success|failure|partial>] [--target-runtime <name>] [--card-id <id>] ' +
|
|
220
|
+
'[--tests <pass|fail|unknown>]';
|
|
220
221
|
function handoffCreate(hippoRoot, tenantId, flags) {
|
|
221
222
|
const summary = String(flags['summary'] ?? '').trim();
|
|
222
223
|
if (!summary) {
|
|
223
|
-
printError(
|
|
224
|
+
printError(HANDOFF_CREATE_USAGE);
|
|
224
225
|
throw new CliExit(1);
|
|
225
226
|
}
|
|
226
227
|
const outcomeRaw = flags['outcome'];
|
|
@@ -244,7 +245,7 @@ function handoffCreate(hippoRoot, tenantId, flags) {
|
|
|
244
245
|
const cardId = String(flags['card-id'] ?? '').trim() || undefined;
|
|
245
246
|
const testStatus = String(flags['tests'] ?? '').trim();
|
|
246
247
|
const evidence = collectHandoffEvidence(process.cwd(), testStatus === 'pass' || testStatus === 'fail' ? testStatus : 'unknown');
|
|
247
|
-
const handoff =
|
|
248
|
+
const handoff = handoffSave(cliApiContext(hippoRoot, tenantId), {
|
|
248
249
|
version: 1,
|
|
249
250
|
sessionId,
|
|
250
251
|
repoRoot: process.cwd(),
|
|
@@ -283,7 +284,7 @@ function printCreatedHandoff(handoff) {
|
|
|
283
284
|
}
|
|
284
285
|
function handoffLatest(hippoRoot, tenantId, flags) {
|
|
285
286
|
const sessionId = String(flags['session'] ?? flags['id'] ?? '').trim() || undefined;
|
|
286
|
-
const handoff =
|
|
287
|
+
const handoff = apiHandoffLatest(cliApiContext(hippoRoot, tenantId), sessionId);
|
|
287
288
|
if (!handoff) {
|
|
288
289
|
if (flags['json']) {
|
|
289
290
|
console.log(JSON.stringify({ handoff: null }));
|
|
@@ -310,7 +311,7 @@ function handoffShow(hippoRoot, tenantId, args, flags) {
|
|
|
310
311
|
printError(`Invalid handoff ID: ${idArg}`);
|
|
311
312
|
throw new CliExit(1);
|
|
312
313
|
}
|
|
313
|
-
const handoff =
|
|
314
|
+
const handoff = handoffById(cliApiContext(hippoRoot, tenantId), handoffId);
|
|
314
315
|
if (!handoff) {
|
|
315
316
|
if (flags['json']) {
|
|
316
317
|
console.log(JSON.stringify({ handoff: null }));
|
|
@@ -363,12 +364,7 @@ function printCurrentState(snapshot, events) {
|
|
|
363
364
|
}
|
|
364
365
|
function currentShow(hippoRoot, tenantId, flags) {
|
|
365
366
|
const asJson = boolFlag(flags, 'json');
|
|
366
|
-
const snapshot =
|
|
367
|
-
const sessionId = snapshot?.session_id ?? undefined;
|
|
368
|
-
const events = listSessionEvents(hippoRoot, tenantId, {
|
|
369
|
-
session_id: sessionId,
|
|
370
|
-
limit: 5,
|
|
371
|
-
});
|
|
367
|
+
const { snapshot, events } = continuityLatest(cliApiContext(hippoRoot, tenantId), { limit: 5 });
|
|
372
368
|
if (asJson) {
|
|
373
369
|
console.log(JSON.stringify({
|
|
374
370
|
snapshot: snapshot ?? null,
|
|
@@ -397,54 +393,55 @@ export function handleCurrent({ hippoRoot, tenantId, args, flags }) {
|
|
|
397
393
|
throw new CliExit(1);
|
|
398
394
|
}
|
|
399
395
|
// Working Memory
|
|
400
|
-
export function handleWm({ hippoRoot, args, flags }) {
|
|
396
|
+
export function handleWm({ hippoRoot, tenantId, args, flags }) {
|
|
401
397
|
requireInit(hippoRoot);
|
|
402
398
|
const subcommand = args[0] ?? '';
|
|
403
399
|
if (subcommand === 'push')
|
|
404
|
-
return wmPushCmd(hippoRoot, flags);
|
|
400
|
+
return wmPushCmd(hippoRoot, tenantId, flags);
|
|
405
401
|
if (subcommand === 'read')
|
|
406
|
-
return wmReadCmd(hippoRoot, flags);
|
|
402
|
+
return wmReadCmd(hippoRoot, tenantId, flags);
|
|
407
403
|
if (subcommand === 'clear') {
|
|
408
404
|
const scope = flags['scope'] ? String(flags['scope']).trim() : undefined;
|
|
409
405
|
const sessionId = flags['session'] ? String(flags['session']).trim() : undefined;
|
|
410
|
-
const count =
|
|
406
|
+
const count = workingMemoryClear(cliApiContext(hippoRoot, tenantId), { scope, sessionId });
|
|
411
407
|
console.log(`Cleared ${count} working memory entries.`);
|
|
412
408
|
return;
|
|
413
409
|
}
|
|
414
410
|
if (subcommand === 'flush') {
|
|
415
411
|
const scope = flags['scope'] ? String(flags['scope']).trim() : undefined;
|
|
416
412
|
const sessionId = flags['session'] ? String(flags['session']).trim() : undefined;
|
|
417
|
-
const count =
|
|
413
|
+
const count = workingMemoryFlush(cliApiContext(hippoRoot, tenantId), { scope, sessionId });
|
|
418
414
|
console.log(`Flushed ${count} working memory entries.`);
|
|
419
415
|
return;
|
|
420
416
|
}
|
|
421
417
|
printError('Usage: hippo wm <push|read|clear|flush>');
|
|
422
418
|
throw new CliExit(1);
|
|
423
419
|
}
|
|
424
|
-
|
|
420
|
+
const WM_DEFAULT_IMPORTANCE = 0.5;
|
|
421
|
+
function wmPushCmd(hippoRoot, tenantId, flags) {
|
|
425
422
|
const scope = String(flags['scope'] ?? 'default').trim();
|
|
426
423
|
const content = String(flags['content'] ?? '').trim();
|
|
427
|
-
const importance =
|
|
424
|
+
const importance = numberFlag(flags, 'importance') ?? WM_DEFAULT_IMPORTANCE;
|
|
428
425
|
const sessionId = flags['session'] ? String(flags['session']).trim() : undefined;
|
|
429
426
|
const taskId = flags['task'] ? String(flags['task']).trim() : undefined;
|
|
430
427
|
if (!content) {
|
|
431
428
|
printError('Usage: hippo wm push --scope <scope> --content "..." [--importance 0.8] [--session <id>] [--task <id>]');
|
|
432
429
|
throw new CliExit(1);
|
|
433
430
|
}
|
|
434
|
-
const id =
|
|
431
|
+
const id = workingMemoryPush(cliApiContext(hippoRoot, tenantId), {
|
|
435
432
|
scope,
|
|
436
433
|
content,
|
|
437
|
-
importance
|
|
434
|
+
importance,
|
|
438
435
|
sessionId,
|
|
439
436
|
taskId,
|
|
440
437
|
});
|
|
441
|
-
console.log(`Pushed working memory #${id} (scope=${scope}, importance=${
|
|
438
|
+
console.log(`Pushed working memory #${id} (scope=${scope}, importance=${importance})`);
|
|
442
439
|
}
|
|
443
|
-
function wmReadCmd(hippoRoot, flags) {
|
|
440
|
+
function wmReadCmd(hippoRoot, tenantId, flags) {
|
|
444
441
|
const scope = flags['scope'] ? String(flags['scope']).trim() : undefined;
|
|
445
442
|
const sessionId = flags['session'] ? String(flags['session']).trim() : undefined;
|
|
446
|
-
const limit =
|
|
447
|
-
const items =
|
|
443
|
+
const limit = numberFlag(flags, 'limit') || 20;
|
|
444
|
+
const items = workingMemoryRead(cliApiContext(hippoRoot, tenantId), { scope, sessionId, limit });
|
|
448
445
|
if (flags['json']) {
|
|
449
446
|
console.log(JSON.stringify({ items }, null, 2));
|
|
450
447
|
return;
|
package/dist/cli/curate.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CommandContext } from './flag-values.js';
|
|
2
2
|
export declare function handleOutcome({ hippoRoot, tenantId, flags }: CommandContext): void;
|
|
3
|
-
export declare function handleConflicts({ hippoRoot, flags }: CommandContext): void;
|
|
3
|
+
export declare function handleConflicts({ hippoRoot, tenantId, flags }: CommandContext): void;
|
|
4
4
|
export declare function handleResolve({ hippoRoot, tenantId, args, flags }: CommandContext): Promise<void>;
|
|
5
5
|
export declare function handleReject({ hippoRoot, tenantId, args, flags }: CommandContext): void;
|
|
6
6
|
export declare function handleRejections({ hippoRoot, tenantId, flags }: CommandContext): void;
|
package/dist/cli/curate.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// Verbs that weaken, suppress or retire memories: outcome, forget, conflicts, reject, dormant, quarantine, invalidate.
|
|
2
|
+
import { truncateWithEllipsis } from '../util/ellipsize.js';
|
|
2
3
|
import * as path from 'path';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { RejectedValueError } from '../store/rejection.js';
|
|
4
|
+
import { unrejectValue, listRejectionsForTenant } from '../trust/reject-flow.js';
|
|
5
|
+
import { RejectedValueError } from '../core/api-errors.js';
|
|
6
6
|
import { loadConfig } from '../core/config.js';
|
|
7
7
|
import { RawAppendOnlyError } from '../core/raw-append-only.js';
|
|
8
8
|
import { isGitRepo } from '../learn/autolearn.js';
|
|
9
|
-
import { invalidateMatching } from '../learn/invalidation.js';
|
|
10
9
|
import * as api from '../api/index.js';
|
|
11
10
|
import { getMemory } from '../api/memories.js';
|
|
12
11
|
import * as client from './client.js';
|
|
@@ -116,12 +115,12 @@ async function previewForget(hippoRoot, tenantId, id, archive) {
|
|
|
116
115
|
printError(`Could not archive ${id}: memory ${id} is not raw (kind=${entry.kind})`);
|
|
117
116
|
throw new CliExit(1);
|
|
118
117
|
}
|
|
119
|
-
const snippet = entry.content
|
|
118
|
+
const snippet = truncateWithEllipsis(entry.content, CONTENT_PREVIEW_CHARS);
|
|
120
119
|
console.log(`Would ${archive ? 'archive' : 'forget'} ${id} (dry run, nothing changed): "${snippet}"`);
|
|
121
120
|
}
|
|
122
|
-
export function handleConflicts({ hippoRoot, flags }) {
|
|
121
|
+
export function handleConflicts({ hippoRoot, tenantId, flags }) {
|
|
123
122
|
requireInit(hippoRoot);
|
|
124
|
-
const conflicts =
|
|
123
|
+
const conflicts = api.listConflicts(cliApiContext(hippoRoot, tenantId), String(flags['status'] ?? 'open'), { everyTenant: true });
|
|
125
124
|
if (flags['json']) {
|
|
126
125
|
console.log(JSON.stringify({ conflicts }, null, 2));
|
|
127
126
|
return;
|
|
@@ -140,7 +139,7 @@ export function handleConflicts({ hippoRoot, flags }) {
|
|
|
140
139
|
}
|
|
141
140
|
/** Shown when --keep is missing, to help the user decide. */
|
|
142
141
|
async function showConflictForResolve(hippoRoot, conflictId, tenantId) {
|
|
143
|
-
const conflicts =
|
|
142
|
+
const conflicts = api.listConflicts(cliApiContext(hippoRoot, tenantId), 'open');
|
|
144
143
|
const conflict = conflicts.find((c) => c.id === conflictId);
|
|
145
144
|
if (!conflict) {
|
|
146
145
|
printError(`Conflict ${conflictId} not found or already resolved.`);
|
|
@@ -155,11 +154,11 @@ async function showConflictForResolve(hippoRoot, conflictId, tenantId) {
|
|
|
155
154
|
const entryB = await getMemory(ctx, conflict.memory_b_id);
|
|
156
155
|
if (entryA) {
|
|
157
156
|
console.log(` [A] ${conflict.memory_a_id}:`);
|
|
158
|
-
console.log(` ${entryA.content
|
|
157
|
+
console.log(` ${truncateWithEllipsis(entryA.content, CONFLICT_PREVIEW_CHARS)}`);
|
|
159
158
|
}
|
|
160
159
|
if (entryB) {
|
|
161
160
|
console.log(` [B] ${conflict.memory_b_id}:`);
|
|
162
|
-
console.log(` ${entryB.content
|
|
161
|
+
console.log(` ${truncateWithEllipsis(entryB.content, CONFLICT_PREVIEW_CHARS)}`);
|
|
163
162
|
}
|
|
164
163
|
console.log('');
|
|
165
164
|
console.log(`Resolve with: hippo resolve ${conflictId} --keep <memory_id> [--forget] [--reject-loser [--reason "<why>"]]`);
|
|
@@ -183,14 +182,12 @@ export async function handleResolve({ hippoRoot, tenantId, args, flags }) {
|
|
|
183
182
|
// --reason is optional here, unlike `hippo reject`: resolve already has the conflict id and keepId.
|
|
184
183
|
const rejectLoser = boolFlag(flags, 'reject-loser');
|
|
185
184
|
const reasonFlag = stringFlag(flags, 'reason');
|
|
186
|
-
const result =
|
|
187
|
-
|
|
185
|
+
const result = api.resolveMemoryConflict(cliApiContext(hippoRoot, tenantId), conflictId, {
|
|
186
|
+
keepId,
|
|
187
|
+
forget: forgetLoser,
|
|
188
|
+
rejectLoser,
|
|
188
189
|
reason: reasonFlag,
|
|
189
190
|
});
|
|
190
|
-
if (!result) {
|
|
191
|
-
printError(`Could not resolve conflict ${conflictId}. Check the ID and --keep value.`);
|
|
192
|
-
throw new CliExit(1);
|
|
193
|
-
}
|
|
194
191
|
const action = rejectLoser
|
|
195
192
|
? 'rejected (tombstoned) and removed'
|
|
196
193
|
: forgetLoser
|
|
@@ -222,10 +219,7 @@ export function handleReject({ hippoRoot, tenantId, args, flags }) {
|
|
|
222
219
|
throw new CliExit(1);
|
|
223
220
|
}
|
|
224
221
|
try {
|
|
225
|
-
const result =
|
|
226
|
-
hippoRoot: root,
|
|
227
|
-
tenantId,
|
|
228
|
-
actor: 'cli',
|
|
222
|
+
const result = api.rejectOnHost(cliApiContext(root, tenantId), {
|
|
229
223
|
reason,
|
|
230
224
|
memoryId: valueFlag === undefined ? memoryId : undefined,
|
|
231
225
|
value: valueFlag,
|
|
@@ -239,7 +233,7 @@ export function handleReject({ hippoRoot, tenantId, args, flags }) {
|
|
|
239
233
|
}
|
|
240
234
|
function printRejected(result, reason) {
|
|
241
235
|
const digestPrefix = result.digest.slice(0, DIGEST_DISPLAY_CHARS);
|
|
242
|
-
const preview = result.content
|
|
236
|
+
const preview = truncateWithEllipsis(result.content, CONTENT_PREVIEW_CHARS);
|
|
243
237
|
console.log(`Rejected [${digestPrefix}...]: "${preview}"`);
|
|
244
238
|
console.log(` Reason: ${reason}`);
|
|
245
239
|
if (result.removedIds.length > 0) {
|
|
@@ -357,10 +351,12 @@ function printDormantRows(rows, hasQuery, root) {
|
|
|
357
351
|
}
|
|
358
352
|
console.log(`${rows.length} dormant memor${rows.length === 1 ? 'y' : 'ies'}${hasQuery ? ' matching' : ''} (newest first):\n`);
|
|
359
353
|
for (const row of rows) {
|
|
360
|
-
const preview = row.content
|
|
354
|
+
const preview = truncateWithEllipsis(row.content, DORMANT_PREVIEW_CHARS);
|
|
361
355
|
console.log(`--- ${row.id}`);
|
|
362
356
|
console.log(` ${preview}`);
|
|
363
|
-
console.log(` Dormant since ${row.dormantAt.slice(0, DATE_PREFIX_CHARS)}
|
|
357
|
+
console.log(` Dormant since ${row.dormantAt.slice(0, DATE_PREFIX_CHARS)} ` +
|
|
358
|
+
`(${row.reason}, strength ${row.strength.toFixed(STRENGTH_DECIMALS)})` +
|
|
359
|
+
`${row.tags.length > 0 ? ` tags: ${row.tags.join(', ')}` : ''}`);
|
|
364
360
|
console.log('');
|
|
365
361
|
}
|
|
366
362
|
console.log('Bring one back: hippo dormant restore <id> Delete for good: hippo dormant forget <id>');
|
|
@@ -459,7 +455,7 @@ export async function handleForget({ hippoRoot, tenantId, args, flags }) {
|
|
|
459
455
|
return;
|
|
460
456
|
cmdForget(hippoRoot, tenantId, id, flags);
|
|
461
457
|
}
|
|
462
|
-
function invalidateChurn(hippoRoot, args, flags) {
|
|
458
|
+
function invalidateChurn(hippoRoot, tenantId, args, flags) {
|
|
463
459
|
if (args[0] || flags['id'] !== undefined) {
|
|
464
460
|
printError('Usage: hippo invalidate --churn [--dry-run]');
|
|
465
461
|
printError('--churn takes no pattern or --id.');
|
|
@@ -471,7 +467,7 @@ function invalidateChurn(hippoRoot, args, flags) {
|
|
|
471
467
|
}
|
|
472
468
|
const churnDryRun = flagIsTrue(flags, 'dry-run');
|
|
473
469
|
let churnFailed = false;
|
|
474
|
-
for (const { root, result } of runChurnStaleForRepo(hippoRoot, churnDryRun)) {
|
|
470
|
+
for (const { root, result } of runChurnStaleForRepo(hippoRoot, tenantId, churnDryRun)) {
|
|
475
471
|
if (result.error) {
|
|
476
472
|
printError(`Churn-staleness check failed for ${root}: ${result.error}`);
|
|
477
473
|
churnFailed = true;
|
|
@@ -497,7 +493,7 @@ function invalidateChurn(hippoRoot, args, flags) {
|
|
|
497
493
|
export function handleInvalidate({ hippoRoot, tenantId, args, flags }) {
|
|
498
494
|
requireInit(hippoRoot);
|
|
499
495
|
if (flagIsTrue(flags, 'churn'))
|
|
500
|
-
return invalidateChurn(hippoRoot, args, flags);
|
|
496
|
+
return invalidateChurn(hippoRoot, tenantId, args, flags);
|
|
501
497
|
const target = args[0];
|
|
502
498
|
if (flagIsTrue(flags, 'id')) {
|
|
503
499
|
// Value-less --id must never silently fall through to pattern mode
|
|
@@ -519,7 +515,7 @@ export function handleInvalidate({ hippoRoot, tenantId, args, flags }) {
|
|
|
519
515
|
to: reason,
|
|
520
516
|
type: 'migration',
|
|
521
517
|
};
|
|
522
|
-
const result =
|
|
518
|
+
const result = api.invalidateMemories(cliApiContext(hippoRoot, tenantId), invTarget, { dryRun, onlyId });
|
|
523
519
|
const label = target ? `"${target}"` : `--id ${onlyId}`;
|
|
524
520
|
if (result.dryRun) {
|
|
525
521
|
if (result.invalidated === 0) {
|
package/dist/cli/dag.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CommandContext } from './flag-values.js';
|
|
2
|
-
export declare function handleDag({ hippoRoot, flags }: CommandContext): void;
|
|
2
|
+
export declare function handleDag({ hippoRoot, tenantId, flags }: CommandContext): void;
|
|
3
3
|
export declare function handleDrill({ hippoRoot, tenantId, args, flags }: CommandContext): Promise<void>;
|
|
4
4
|
export declare function handleAssemble({ hippoRoot, tenantId, args, flags }: CommandContext): Promise<void>;
|
|
5
5
|
//# sourceMappingURL=dag.d.ts.map
|
package/dist/cli/dag.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// DAG summary verbs: `hippo dag`, `hippo assemble` and `hippo drill`.
|
|
2
|
-
import {
|
|
2
|
+
import { truncateWithEllipsis } from '../util/ellipsize.js';
|
|
3
3
|
import * as api from '../api/index.js';
|
|
4
4
|
import { assembleCost, assembleHeading, drillCost, settleTokens } from '../api/context-render.js';
|
|
5
|
+
import { listMemories } from '../api/memories.js';
|
|
6
|
+
import { cliApiContext } from './api-context.js';
|
|
5
7
|
import { printError } from './output.js';
|
|
6
8
|
import { parseBudgetFlag, flagIsTrue, stringFlag, numberFlag } from './flag-values.js';
|
|
7
9
|
import { requireInit } from './shared.js';
|
|
@@ -13,9 +15,9 @@ const TREE_LEAF_PREVIEW_CHARS = 60;
|
|
|
13
15
|
const DAG_HEAD_CHARS = 120;
|
|
14
16
|
const DAG_SUMMARY_PREVIEW_CHARS = 200;
|
|
15
17
|
const DAG_CHILD_PREVIEW_CHARS = 100;
|
|
16
|
-
export function handleDag({ hippoRoot, flags }) {
|
|
18
|
+
export function handleDag({ hippoRoot, tenantId, flags }) {
|
|
17
19
|
requireInit(hippoRoot);
|
|
18
|
-
const entries =
|
|
20
|
+
const entries = listMemories(cliApiContext(hippoRoot, tenantId), { everyTenant: true });
|
|
19
21
|
const isStats = flagIsTrue(flags, 'stats');
|
|
20
22
|
const byLevel = new Map();
|
|
21
23
|
let unlinked = 0;
|
|
@@ -39,6 +41,17 @@ function printDagStats(byLevel, unlinked) {
|
|
|
39
41
|
console.log(` Level 0 (raw memories): ${byLevel.get(0) ?? 0}`);
|
|
40
42
|
console.log(` Unlinked facts: ${unlinked}`);
|
|
41
43
|
}
|
|
44
|
+
function groupByParent(entries) {
|
|
45
|
+
const byParent = new Map();
|
|
46
|
+
for (const e of entries) {
|
|
47
|
+
if (!e.dag_parent_id)
|
|
48
|
+
continue;
|
|
49
|
+
const list = byParent.get(e.dag_parent_id) ?? [];
|
|
50
|
+
list.push(e);
|
|
51
|
+
byParent.set(e.dag_parent_id, list);
|
|
52
|
+
}
|
|
53
|
+
return byParent;
|
|
54
|
+
}
|
|
42
55
|
function printDagTree(entries) {
|
|
43
56
|
// Tree view: L3 entity profiles as roots with L2 children indented, then orphan L2 summaries at top level.
|
|
44
57
|
const profiles = entries.filter((e) => e.dag_level === 3);
|
|
@@ -52,6 +65,7 @@ function printDagTree(entries) {
|
|
|
52
65
|
list.push(l2);
|
|
53
66
|
childL2ByProfile.set(l2.dag_parent_id, list);
|
|
54
67
|
}
|
|
68
|
+
const childrenByParent = groupByParent(entries);
|
|
55
69
|
if (profiles.length === 0 && orphanL2.length === 0) {
|
|
56
70
|
console.log('No DAG summaries yet. Run `hippo sleep` with ANTHROPIC_API_KEY set.');
|
|
57
71
|
return;
|
|
@@ -68,7 +82,7 @@ function printDagTree(entries) {
|
|
|
68
82
|
console.log(` └─ 📌 ${l2.content.slice(0, TREE_CHILD_PREVIEW_CHARS)}`);
|
|
69
83
|
if (l2Tags)
|
|
70
84
|
console.log(` [${l2Tags}]`);
|
|
71
|
-
const facts =
|
|
85
|
+
const facts = childrenByParent.get(l2.id) ?? [];
|
|
72
86
|
for (const f of facts) {
|
|
73
87
|
console.log(` └─ ${f.content.slice(0, TREE_LEAF_PREVIEW_CHARS)}`);
|
|
74
88
|
}
|
|
@@ -80,7 +94,7 @@ function printDagTree(entries) {
|
|
|
80
94
|
console.log(`\n📌 ${summary.content.slice(0, CONTENT_PREVIEW_CHARS)}`);
|
|
81
95
|
if (summaryTags)
|
|
82
96
|
console.log(` [${summaryTags}]`);
|
|
83
|
-
const children =
|
|
97
|
+
const children = childrenByParent.get(summary.id) ?? [];
|
|
84
98
|
for (const child of children) {
|
|
85
99
|
console.log(` └─ ${child.content.slice(0, TREE_CHILD_PREVIEW_CHARS)}`);
|
|
86
100
|
}
|
|
@@ -165,11 +179,12 @@ async function cmdDrillDown(hippoRoot, tenantId, summaryId, flags) {
|
|
|
165
179
|
console.log(JSON.stringify(r, null, 2));
|
|
166
180
|
return;
|
|
167
181
|
}
|
|
168
|
-
console.log(`Summary ${r.summary.id} — ${r.summary.descendantCount} descendants
|
|
169
|
-
|
|
182
|
+
console.log(`Summary ${r.summary.id} — ${r.summary.descendantCount} descendants` +
|
|
183
|
+
`${r.summary.earliestAt ? ` (${r.summary.earliestAt} → ${r.summary.latestAt})` : ''}`);
|
|
184
|
+
console.log(` ${truncateWithEllipsis(r.summary.content, DAG_SUMMARY_PREVIEW_CHARS, '…')}`);
|
|
170
185
|
console.log(`\nChildren (${r.children.length}/${r.totalChildren}${r.truncated ? ', truncated' : ''}):`);
|
|
171
186
|
for (const c of r.children) {
|
|
172
|
-
console.log(` [L${c.dagLevel}] ${c.id} — ${c.content
|
|
187
|
+
console.log(` [L${c.dagLevel}] ${c.id} — ${truncateWithEllipsis(c.content, DAG_CHILD_PREVIEW_CHARS, '…')}`);
|
|
173
188
|
}
|
|
174
189
|
}
|
|
175
190
|
export async function handleDrill({ hippoRoot, tenantId, args, flags }) {
|
package/dist/cli/decisions.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { type CommandContext } from './flag-values.js';
|
|
2
|
-
export declare function handlePredict({ hippoRoot, tenantId, args, flags }: CommandContext): void;
|
|
3
2
|
export declare function handleDecide({ hippoRoot, tenantId, args, flags }: CommandContext): Promise<void>;
|
|
4
|
-
export declare function handleIncident({ hippoRoot, tenantId, args, flags }: CommandContext): void;
|
|
5
3
|
//# sourceMappingURL=decisions.d.ts.map
|