kagura-memory 0.20.0 → 0.21.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 +19 -3
- package/dist/cli.js +26 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -2
- package/dist/index.d.ts +54 -2
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist-mcp/mcp.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ runtime dependencies — the one optional peer dependency, for
|
|
|
35
35
|
unless you ask for it.
|
|
36
36
|
|
|
37
37
|
Targets memory-cloud **v0.75.0** (`MIN_SERVER_VERSION`) and is checked
|
|
38
|
-
against memory-cloud up to **v0.
|
|
38
|
+
against memory-cloud up to **v0.182.0**; the Python SDK 0.44.0, its
|
|
39
39
|
parity target, is checked up to v0.142.0 (v0.143.0 changes nothing a
|
|
40
40
|
client sees), and its own `MIN_SERVER_VERSION` stays at an advisory
|
|
41
41
|
0.17.1. `checkServerVersion()` warns, and never throws, on an older
|
|
@@ -182,6 +182,7 @@ npx kagura-memory recall "OAuth setup" -c dev -k 10
|
|
|
182
182
|
npx kagura-memory recall "dependency injection" --no-rerank # skip reranking; no flag follows the context config (v0.69.0+)
|
|
183
183
|
npx kagura-memory recall "project context" --verbosity full # uncut summaries + tags; compact is the server default (v0.108.0+)
|
|
184
184
|
npx kagura-memory recall "deploy runbook" --full 1 --max-chars 40000 # content on the top hit only (v0.114.0+); reply budget (v0.82.0+)
|
|
185
|
+
npx kagura-memory recall "which day the team meets" --order date # oldest first, each hit dated (v0.182.0+)
|
|
185
186
|
# A server that refuses one of --verbosity/--full/--max-chars (invalid_argument) gets one
|
|
186
187
|
# retry without the ones it names (every one it sent when it names none), with a note on stderr.
|
|
187
188
|
npx kagura-memory remember -s "FastAPI DI" --content "Use Depends()" --tags "python,fastapi"
|
|
@@ -1625,7 +1626,7 @@ when `undefined`.
|
|
|
1625
1626
|
| Method | What it does |
|
|
1626
1627
|
|--------|--------------|
|
|
1627
1628
|
| `remember` | Store a memory. `details` accepts arbitrary JSON, including `location` (see below) and the reserved `tool_trigger`, which marks a tool guardrail and needs context editor or above on a user (not agent) credential; `supersedes` declares this the newer version of an existing memory, shadowing the old one from default recall without destroying it; `deliveryMode: "always"` pins it. `tags` takes at most 50 tags of at most 100 characters each, the caps memory-cloud v0.82.0+ enforces: more throws before any request, on every server. `toolTrigger` marks the guardrail without writing the key yourself. `observedAt` (v0.127.0+) says when the fact held — a `YYYY-MM-DD` date or an extended ISO 8601 datetime, or a `Date` (sent as its UTC instant), stored as `details.observed_at`; a basic form (`20240307`), a time without seconds, an impossible day or a disagreeing `details.observed_at` throws before any request. `dedupe` (v0.93.0+): `"check"` writes nothing when a near-duplicate exists and returns `{ status: "duplicate_candidate", candidate }` instead of throwing, `"off"` opts the memory out of supersede suggestions for good; `tagsNormalize: true` stores each tag under the context's established spelling; `verbose: true` keeps `persistence.detail`. The reply (`RememberResult`, returned unchecked as Python's dict, so every key is optional) carries `version` (v0.113.0+), `session_id` (v0.113.0+), when a summary over 500 characters was cut, `summary_truncated` / `summary_original_length` (v0.108.0+), and `plan_headroom` (v0.142.0+, read fail-open; see [Plan headroom](#plan-headroom-memory-cloud-v01420)). |
|
|
1628
|
-
| `recall` | Hybrid semantic + keyword search. Takes `filters` (`type`, `scope`, `tags` with `tags_match` and `tags_normalize`, `importance` bounds, created/updated date bounds, `source_uri_prefix`, `source_type`, `trust_tier`, and the `near` / `within` geo filters), `searchMode`, `useRerank`, `includeExploreHints`, `includeSuperseded` (read back what `supersedes` shadowed, annotated with `superseded_by`), and `contextIds` for 2–20-context search. `useRerank` is tri-state (memory-cloud v0.69.0+): omit it to follow the context's search config (the first context's, with `contextIds`), `true` requests reranking where the context allows it, `false` skips it for the call. A tag filter that matches nothing can return `tag_suggestions`. When the semantic half is unavailable, the result is keyword-only and carries `degraded: true` and `degraded_reason` (v0.66.0+) — an empty one then means "search impaired", not "nothing stored". `observedAfter` (inclusive) / `observedBefore` (exclusive) keep the memories whose fact held in that range (`filters.observed_after` / `observed_before`, v0.127.0+; a date is the start of its UTC day, and a memory without `observed_at` never matches); one beside the same key in `filters` throws. `eventAfter` (inclusive) / `eventBefore` (exclusive) do the same for the date of the event a memory describes (`filters.event_after` / `event_before`, v0.152.0+, where the server resolves `details.event_start` / `event_end` from `details.event_phrase`): a memory matches when its event range overlaps the window, a memory without an event date never matches, a datetime `eventAfter` counts as its UTC day and a datetime `eventBefore` past midnight as the day after it; a server before v0.152.0 does not know the keys and filters nothing. Returns a typed `RecallResponse` (`confidence` first: read `confidence.level` before the hits); see [Recall result shape](#recall-result-shape). |
|
|
1629
|
+
| `recall` | Hybrid semantic + keyword search. Takes `filters` (`type`, `scope`, `tags` with `tags_match` and `tags_normalize`, `importance` bounds, created/updated date bounds, `source_uri_prefix`, `source_type`, `trust_tier`, and the `near` / `within` geo filters), `searchMode`, `useRerank`, `includeExploreHints`, `includeSuperseded` (read back what `supersedes` shadowed, annotated with `superseded_by`), `order` (`"date"`: oldest first with a `date` per row, v0.182.0+), and `contextIds` for 2–20-context search. `useRerank` is tri-state (memory-cloud v0.69.0+): omit it to follow the context's search config (the first context's, with `contextIds`), `true` requests reranking where the context allows it, `false` skips it for the call. A tag filter that matches nothing can return `tag_suggestions`. When the semantic half is unavailable, the result is keyword-only and carries `degraded: true` and `degraded_reason` (v0.66.0+) — an empty one then means "search impaired", not "nothing stored". `observedAfter` (inclusive) / `observedBefore` (exclusive) keep the memories whose fact held in that range (`filters.observed_after` / `observed_before`, v0.127.0+; a date is the start of its UTC day, and a memory without `observed_at` never matches); one beside the same key in `filters` throws. `eventAfter` (inclusive) / `eventBefore` (exclusive) do the same for the date of the event a memory describes (`filters.event_after` / `event_before`, v0.152.0+, where the server resolves `details.event_start` / `event_end` from `details.event_phrase`): a memory matches when its event range overlaps the window, a memory without an event date never matches, a datetime `eventAfter` counts as its UTC day and a datetime `eventBefore` past midnight as the day after it; a server before v0.152.0 does not know the keys and filters nothing. Returns a typed `RecallResponse` (`confidence` first: read `confidence.level` before the hits); see [Recall result shape](#recall-result-shape). |
|
|
1629
1630
|
| `reference` | Full detail for one memory, under `result.memory` (`ReferenceResponse`), with its `version` (v0.113.0+) — the `expectedVersion` for `updateMemory` — and `observed_at` (v0.127.0+). Since v0.78.0 the reply is bounded (`maxChars`, 10,000–100,000, default 20,000): cut `content` comes with `content_truncated` / `content_next_offset`, and a `details` / `context` / links field that does not fit is left out with `<field>_omitted` / `<field>_total_chars`. Page the rest with `contentOffset`, `detailsOffset` (`details_json` slices) or `contextOffset` — one per call — and pick fields with `fields` (`content`, `details`, `context`, `links`). `version` (v0.113.0+) reads an earlier version (`historical: true`, `current_version`). A live `supersede_candidate` carries `acceptance` (v0.137.0+; see [Supersede suggestions](#supersede-suggestions)). Every one is checked locally (an integer in range, more than one offset refused first, a known field, an offset's own field listed) before any request. The reply comes back as sent once its `status` (a string) and `memory` (an object) are checked: otherwise `KaguraResponseError` (the CLI's `reference` prints the raw reply, as Python's does). |
|
|
1630
1631
|
| `updateMemory` | Update in place by `memoryId`, or upsert by `externalId`. `details` **replaces** the stored object wholesale — round-trip keys you want to keep; dropping `tool_trigger` turns a guardrail off — and `detailsPatch` (v0.140.0+) merges into it instead: each key replaces the stored one, `null` deletes it, the rest are kept. `tags` replaces the list, with `remember`'s caps; `addTags` / `removeTags` (v0.140.0+) edit it (removals first, each new tag once; `addTags` takes the caps, `removeTags` none). `expectedVersion` (v0.113.0+) applies the edit only while the memory is at that version, else throws `KaguraVersionConflictError` with `currentVersion` and writes nothing. `dismissSupersedeCandidate: true` rejects the server's `supersede_candidate` suggestion; `acceptSupersedeCandidate: true` (v0.126.0+) accepts it — the candidate is shadowed by a `supersedes` edge, named in the reply's `superseded_memory_id`, and a different edge already linking the pair throws `KaguraError` `code` `"edge_exists"`; check the candidate's `acceptance` first ([Supersede suggestions](#supersede-suggestions)). `observedAt`, `toolTrigger` and `verbose` work as on `remember`. The reply (`UpdateMemoryResult`, returned unchecked as Python's dict, so every key is optional) carries `version`, and `plan_headroom` read fail-open as `remember`'s is (v0.142.0+). See [the local rules](#updatememorys-local-rules) below. |
|
|
1631
1632
|
| `forget` | Soft-delete by `memoryId`, by `memoryIds` (1-50 ids in one call, memory-cloud v0.117.0+; returns a `ForgetBatchResult`, see [Session tools](#session-tools-memory-cloud-v0930)) or by `query`. The rows are kept, but not restorable through the API, until the deployment's cleanup window passes (`CLEANUP_DELETED_MEMORIES_RETENTION_DAYS`, default 30 days). For a caller who may write to the workspace, a target it may not delete, or one already gone, is skipped silently — including every guardrail for a caller below context editor or on an agent credential — so `deleted_count` can be 0. A workspace viewer may not delete at all and is refused with `KaguraPermissionError` (`requiredRole: "member"`). |
|
|
@@ -1714,6 +1715,21 @@ opt-in, in place of `explore_hints`. `explore()` itself is unaffected.
|
|
|
1714
1715
|
harness entry, and `kagura-memory-mcp --add-tools explore` sets it on the
|
|
1715
1716
|
proxy's upstream.
|
|
1716
1717
|
|
|
1718
|
+
`order: "date"` (memory-cloud v0.182.0+) answers how something changed over
|
|
1719
|
+
time: the same search, oldest first, each row with `date` (`YYYY-MM-DD`,
|
|
1720
|
+
UTC) and `date_source` (`"event"`, `"observed"` or `"created"`), and
|
|
1721
|
+
`order: "date"` on the reply. Superseded rows are included unless you pass
|
|
1722
|
+
`includeSuperseded: false`. `order` is sent only when set (a server from
|
|
1723
|
+
v0.82.0 that predates it refuses it with `invalid_argument`); without it,
|
|
1724
|
+
or with `"relevance"`, the reply is the one above and has none of these keys.
|
|
1725
|
+
|
|
1726
|
+
```ts
|
|
1727
|
+
const timeline = await client.recall({ contextId, query: "which day the team meets", order: "date", k: 10 });
|
|
1728
|
+
for (const hit of timeline.results) {
|
|
1729
|
+
console.log(hit.date, hit.date_source, hit.summary);
|
|
1730
|
+
}
|
|
1731
|
+
```
|
|
1732
|
+
|
|
1717
1733
|
#### Supersede suggestions
|
|
1718
1734
|
|
|
1719
1735
|
A `supersede_candidate` on a `recall` row or a `reference` memory is a
|
|
@@ -2550,7 +2566,7 @@ CLI as `kagura-memory`: 23 of the 24 top-level commands of the Python CLI
|
|
|
2550
2566
|
differ.
|
|
2551
2567
|
|
|
2552
2568
|
The parity target is the Python SDK and CLI **0.44.0**, checked against
|
|
2553
|
-
memory-cloud up to **v0.
|
|
2569
|
+
memory-cloud up to **v0.182.0**.
|
|
2554
2570
|
|
|
2555
2571
|
**SDK ↔ memory-cloud compatibility.**
|
|
2556
2572
|
[`docs/compatibility.md`](docs/compatibility.md) records, for each release
|
package/dist/cli.js
CHANGED
|
@@ -958,7 +958,7 @@ function isCanonicalUuid(value) {
|
|
|
958
958
|
}
|
|
959
959
|
|
|
960
960
|
// src/version.ts
|
|
961
|
-
var SDK_VERSION = "0.
|
|
961
|
+
var SDK_VERSION = "0.21.0";
|
|
962
962
|
|
|
963
963
|
// src/http.ts
|
|
964
964
|
function baseUrlFromMcp(mcpUrl) {
|
|
@@ -6487,8 +6487,17 @@ var KaguraClient = class _KaguraClient {
|
|
|
6487
6487
|
if (options.includeExploreHints) {
|
|
6488
6488
|
args.include_explore_hints = true;
|
|
6489
6489
|
}
|
|
6490
|
+
const { order } = options;
|
|
6490
6491
|
if (options.includeSuperseded) {
|
|
6491
6492
|
args.include_superseded = true;
|
|
6493
|
+
} else if (options.includeSuperseded === false && isSet(order)) {
|
|
6494
|
+
args.include_superseded = false;
|
|
6495
|
+
}
|
|
6496
|
+
if (isSet(order)) {
|
|
6497
|
+
if (order !== "relevance" && order !== "date") {
|
|
6498
|
+
throw new Error(`order must be 'relevance' or 'date', got ${pyRepr(order)}`);
|
|
6499
|
+
}
|
|
6500
|
+
args.order = order;
|
|
6492
6501
|
}
|
|
6493
6502
|
const { verbosity, full, maxChars } = options;
|
|
6494
6503
|
if (isSet(verbosity)) {
|
|
@@ -14945,6 +14954,13 @@ var VERBOSITY = {
|
|
|
14945
14954
|
metavar: "[compact|full]",
|
|
14946
14955
|
help: "Result detail (server v0.108.0+). compact, the server default: 160-character summaries without tags; full: uncut summaries, tags, context_summary and scope."
|
|
14947
14956
|
};
|
|
14957
|
+
var ORDERS = ["relevance", "date"];
|
|
14958
|
+
var ORDER = {
|
|
14959
|
+
name: "order",
|
|
14960
|
+
type: "value",
|
|
14961
|
+
metavar: "[relevance|date]",
|
|
14962
|
+
help: "relevance (the server default) or date: the same results oldest first, each with date and date_source, superseded rows included (server v0.182.0+)."
|
|
14963
|
+
};
|
|
14948
14964
|
var FULL = {
|
|
14949
14965
|
range: { min: 0, max: RECALL_FULL_MAX, rangeLabel: `0<=x<=${RECALL_FULL_MAX}`, integer: true },
|
|
14950
14966
|
name: "full",
|
|
@@ -15003,14 +15019,15 @@ async function recallWithShapeFallback(writeError, call, shape) {
|
|
|
15003
15019
|
var recall = {
|
|
15004
15020
|
summary: "Search memories directly (without AI analysis).",
|
|
15005
15021
|
args: "QUERY",
|
|
15006
|
-
description: " Without --rerank/--no-rerank the server follows the context's search config\n (memory-cloud v0.69.0+). --rerank applies only when the context enables\n reranking; --no-rerank always skips it.\n\n The reply is printed as JSON, with each hit's content (when the server sends\n it) right after its summary. --verbosity, --full and --max-chars are sent\n only when given. A server from v0.82.0 that predates one of them refuses it\n (invalid_argument); the command then retries once without the ones the\n server lists as refused (all three it sent when the reply does not list\n them) and says so on stderr.\n\n" + examples(
|
|
15022
|
+
description: " Without --rerank/--no-rerank the server follows the context's search config\n (memory-cloud v0.69.0+). --rerank applies only when the context enables\n reranking; --no-rerank always skips it.\n\n The reply is printed as JSON, with each hit's content (when the server sends\n it) right after its summary. --verbosity, --full and --max-chars are sent\n only when given. A server from v0.82.0 that predates one of them refuses it\n (invalid_argument); the command then retries once without the ones the\n server lists as refused (all three it sent when the reply does not list\n them) and says so on stderr. --order is sent only when given and never\n retried without: an older server's refusal is the error.\n\n" + examples(
|
|
15007
15023
|
'recall "FastAPI dependency injection"',
|
|
15008
15024
|
'recall "OAuth2 implementation" -k 10',
|
|
15009
15025
|
'recall -c dev "error handling pattern"',
|
|
15010
15026
|
'recall "latency-sensitive lookup" --no-rerank',
|
|
15011
15027
|
'recall "project context" --trusted-only --verbosity full',
|
|
15012
15028
|
'recall "deploy runbook" --full 1 --max-chars 40000',
|
|
15013
|
-
'recall "release notes" --full 0'
|
|
15029
|
+
'recall "release notes" --full 0',
|
|
15030
|
+
'recall "where the team meets" --order date'
|
|
15014
15031
|
),
|
|
15015
15032
|
spec: {
|
|
15016
15033
|
flags: [
|
|
@@ -15035,7 +15052,8 @@ var recall = {
|
|
|
15035
15052
|
},
|
|
15036
15053
|
VERBOSITY,
|
|
15037
15054
|
FULL,
|
|
15038
|
-
MAX_CHARS2
|
|
15055
|
+
MAX_CHARS2,
|
|
15056
|
+
ORDER
|
|
15039
15057
|
]
|
|
15040
15058
|
},
|
|
15041
15059
|
run: async (deps, args) => {
|
|
@@ -15058,6 +15076,8 @@ var recall = {
|
|
|
15058
15076
|
if (rawMaxChars !== void 0) {
|
|
15059
15077
|
shape.maxChars = parseRanged(MAX_CHARS2, rawMaxChars);
|
|
15060
15078
|
}
|
|
15079
|
+
const rawOrder = args.values.order;
|
|
15080
|
+
const order = rawOrder !== void 0 ? parseChoice(ORDER, rawOrder, ORDERS) : void 0;
|
|
15061
15081
|
return runClientCommand(
|
|
15062
15082
|
deps,
|
|
15063
15083
|
args.values["context-id"],
|
|
@@ -15069,7 +15089,8 @@ var recall = {
|
|
|
15069
15089
|
k,
|
|
15070
15090
|
...useRerank !== void 0 ? { useRerank } : {},
|
|
15071
15091
|
...trustedOnly ? { filters: { trust_tier: "trusted" } } : {},
|
|
15072
|
-
...shapeArgs
|
|
15092
|
+
...shapeArgs,
|
|
15093
|
+
...order !== void 0 ? { order } : {}
|
|
15073
15094
|
}),
|
|
15074
15095
|
shape
|
|
15075
15096
|
)
|