kagura-memory 0.18.0 → 0.19.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 +175 -21
- package/dist/cli.js +287 -43
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +281 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +295 -27
- package/dist/index.d.ts +295 -27
- package/dist/index.js +279 -41
- package/dist/index.js.map +1 -1
- package/dist-mcp/mcp.cjs +7 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ This SDK connects your TypeScript/JavaScript code to [Kagura Memory Cloud](https
|
|
|
10
10
|
|--------|----------|----------|
|
|
11
11
|
| **`KaguraClient`** | MCP (JSON-RPC) | Direct memory ops — remember, recall, explore, reference, forget |
|
|
12
12
|
| **`ResourceClient`** | REST API | External data ingestion — push data from Slack, CI/CD, CRM into Kagura |
|
|
13
|
-
| **`FilesClient`** | REST + presigned PUT | File uploads with sha256 integrity binding
|
|
13
|
+
| **`FilesClient`** | REST + presigned PUT | File uploads with sha256 integrity binding |
|
|
14
14
|
| **`WorkspaceClient`** | REST API | Workspace member, invitation, and API key management; operation history (web session) |
|
|
15
15
|
| **`SecretClient`** | REST API | [Zero-knowledge secrets](#zero-knowledge-secrets) — age-encrypted on your machine, opaque to the server |
|
|
16
16
|
| **`AgentsClient`** | REST API | Agent bootstrap for API-key-only callers (no MCP session) |
|
|
@@ -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.161.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
|
|
@@ -570,14 +570,24 @@ compare decoded, as the server reads them (`guard%72ails` is
|
|
|
570
570
|
|
|
571
571
|
**What `tools/list` shows** (the entry's tool view). Since memory-cloud
|
|
572
572
|
0.93.0 a bare MCP URL lists the `core` profile, the memory loop (21 tools
|
|
573
|
-
on 0.141.0), and `?profile=full` every tool (72).
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
573
|
+
on 0.141.0), and `?profile=full` every tool (72). From memory-cloud
|
|
574
|
+
0.158.0, `?profile=google` and its alias `?profile=microsoft` list `core`
|
|
575
|
+
without `describe_tools` and `guide` (`?add_tools=` cannot bring them back),
|
|
576
|
+
with tool descriptions that name no other tool and instructions that carry
|
|
577
|
+
no guardrail digest. Otherwise `tools/call` is unaffected: a profile is a
|
|
578
|
+
view, not an authorization boundary, so an unlisted tool stays callable and
|
|
579
|
+
every `KaguraClient` method works on any URL — except that on a `google` /
|
|
580
|
+
`microsoft` URL (without a `?tools=` allowlist, which wins over the
|
|
581
|
+
profile) `describe_tools` and `guide` are refused at `tools/call` too, so
|
|
582
|
+
`describeTools()` and `guide()` throw `KaguraError` with `code`
|
|
583
|
+
`unknown_tool` there. That view also trims replies: the server drops the
|
|
584
|
+
sentences of its own `help`, `hint` and `message` text that point at another
|
|
585
|
+
tool, and `recall` makes no learning writes. `--tool-profile NAME` (every harness; memory-cloud
|
|
586
|
+
v0.73.0+) sets `profile`; the server knows `core`, `full`, `google` and
|
|
587
|
+
`microsoft` (case-sensitive; the last two need v0.158.0+) and fails
|
|
588
|
+
`tools/list` for any other name, which leaves the harness with no Kagura
|
|
589
|
+
tools. Setup leaves that check to the server and refuses only a blank name
|
|
590
|
+
or one starting with `-` (exit 2), as Python does.
|
|
581
591
|
`--add-tools NAME[,NAME…]` (every harness; v0.129.0+; may
|
|
582
592
|
repeat) lists more tools on top of the profile: trimmed, de-duplicated,
|
|
583
593
|
at most 100, unknown names ignored by the server. `recall`'s
|
|
@@ -902,6 +912,24 @@ added**, each on purpose or out of reach:
|
|
|
902
912
|
entry, so it never stops there. This port's API-key form never runs
|
|
903
913
|
`hermes mcp add`: it prints the entry to put in place of the existing
|
|
904
914
|
one, as Python does under `-y`.
|
|
915
|
+
- `sleep rollback` prints one line the Python CLI 0.44.0 does not:
|
|
916
|
+
`related_indexes_reverted` in the summary, after `points_requeued` (0
|
|
917
|
+
when the server sends no key). It is the counter memory-cloud v0.153.0
|
|
918
|
+
added for its opt-in Sleep related index, printed here as the Python CLI
|
|
919
|
+
prints it from 0.46.0; the rest of the output is 0.44.0's.
|
|
920
|
+
- `files list` and `files upload` print a file's `scan_status`, after
|
|
921
|
+
`context_id`, when the server sends it (memory-cloud v0.160.0+), which the
|
|
922
|
+
Python CLI 0.44.0 drops; a reply without it prints as 0.44.0 prints it,
|
|
923
|
+
with no such key. `files download-url` on a file the malware scan holds
|
|
924
|
+
or blocked prints one line more under the error: how long to wait and to
|
|
925
|
+
run the command again, or that the file cannot be downloaded (the
|
|
926
|
+
wording of the Python SDK's
|
|
927
|
+
[#337](https://github.com/kagura-ai/kagura-memory-python-sdk/issues/337)).
|
|
928
|
+
- `bootstrap` prints the `notices` block (memory-cloud v0.161.0+) right
|
|
929
|
+
after `status` when the server sends it, which the Python CLI 0.44.0
|
|
930
|
+
drops (memory-cloud has then already counted the notices as delivered); a
|
|
931
|
+
reply without it prints as 0.44.0 prints it, with no such key, and an
|
|
932
|
+
unreadable block prints `null`.
|
|
905
933
|
|
|
906
934
|
**`guardrails load` and `guardrails digest`** (memory-cloud v0.74.0+)
|
|
907
935
|
take the context as an optional argument, else `context_id` from
|
|
@@ -920,7 +948,9 @@ block, or with `--target instructions` the MCP server instructions this
|
|
|
920
948
|
credential would receive, where `--profile`, `--tools` and `--add-tools`
|
|
921
949
|
(memory-cloud v0.129.0+; comma-separated, may repeat) repeat an MCP URL's
|
|
922
950
|
`?profile=`, `?tools=` and `?add_tools=`; without them, memory-cloud 0.93.0+
|
|
923
|
-
previews the `core` view a bare URL lists.
|
|
951
|
+
previews the `core` view a bare URL lists. `--profile` takes `full`, `core`,
|
|
952
|
+
`google` or `microsoft`; for the last two (v0.158.0+) the preview is that
|
|
953
|
+
view's base text, with no digest. A context with no tool guardrails prints
|
|
924
954
|
nothing, and says so on stderr. With `--out FILE`, it splices the block
|
|
925
955
|
into FILE between its marker lines: an earlier block is replaced in place,
|
|
926
956
|
an unchanged set rewrites nothing, and an empty set removes an earlier
|
|
@@ -1443,6 +1473,8 @@ keyed on the error code and the envelope's fields, never on the message:
|
|
|
1443
1473
|
| `KaguraCapacityLockedError` | memory-cloud v0.99.0+: a Free workspace over its capacity — MCP `capacity_locked`, REST 403 `CAPACITY-001` (`details.gate` `"capacity"`). Search and saving are refused until it is cleaned up or re-subscribed; listing, deleting, export and `getUsage` keep working. Neither a quota nor a plan gate, so it extends neither class. A caller outside the locked workspace (a public context) gets every figure `null` | `cleanupUrl`, `memoryCount`, `memoryLimit`, `overMemories`, `usedBytes`, `storageLimitBytes`, `overBytes`, `gate` (`"capacity"`) |
|
|
1444
1474
|
| `KaguraAuthError` | HTTP 401; and from memory-cloud v0.79.0 an OAuth token that lacks the scope a call needs (HTTP 403 `insufficient_scope`): `memory:read` for the read-only tools, `recall` and `getAgentBootstrap`, `memory:write` for every other tool, so a `kagura-memory auth login --read-only` profile gets it on every write. The message names the scope and the re-login | `code` `"insufficient_scope"`, `details.required_scope` |
|
|
1445
1475
|
| `KaguraServiceUnavailableError` | any HTTP 503 from `/mcp` or a REST route (the OAuth endpoints keep their own errors): `/mcp`'s `temporarily_unavailable` (the credential could not be verified, v0.82.0+) and its JSON-RPC transport failures (a dependency down or timed out), REST `DB-002` (the database unavailable). A `KaguraConnectionError`, so existing handlers keep catching it | `retryAfter` (the `Retry-After` header, else `data.retry_after_seconds`; `null` on a write whose outcome is unknown), `reason` (REST `details.reason`, else the MCP `cause`, else the code) |
|
|
1476
|
+
| `KaguraFileScanPendingError` | memory-cloud v0.160.0+: `FilesClient.downloadUrl` for a file whose malware scan has not finished — REST 409 `SCAN-001`, with `Retry-After: 30`. The same call succeeds once the scan says clean; the SDK does not retry. A `KaguraConnectionError`, the class this 409 had before, so existing handlers keep catching it; `retryable` is `true` | `retryAfter` (the `Retry-After` header; `null` when absent or not a number of seconds), `fileId`, `scanStatus` (`"pending"`), read from `details` |
|
|
1477
|
+
| `KaguraFileBlockedError` | memory-cloud v0.160.0+: `FilesClient.downloadUrl` for a file the malware scan blocked — REST 409 `SCAN-002`. Waiting does not help (`retryable` is `false`). A `KaguraConnectionError`, as the 409 was before | `fileId`, `scanStatus` (`"infected"`, `"error"` or another value the server does not allow), read from `details` |
|
|
1446
1478
|
| `KaguraPartialRollbackError` | `rollbackSleepRun` reversed some actions but not all. A `rollback_summary` the SDK cannot read adds ` (rollback_summary could not be read)` to the message, as Python's does, with `summary` `{}` (Python: `None`) and the `KaguraResponseError` as `cause` | `reportId`, `summary` |
|
|
1447
1479
|
| `KaguraPartialSessionRollbackError` | `rollbackSession` (memory-cloud v0.113.0+) failed some items of a real run (`partial_rollback`); every other item was handled and saved, and a call with the same arguments retries the failed ones. A field the SDK cannot read is `null` rather than a second error | `sessionSummary` (with `errors`), `totals`, `rollbackId`, `remaining` |
|
|
1448
1480
|
| `KaguraResponseError` | a successful response the SDK cannot read, usually because the server is newer than this SDK. That includes `getServerInfo`, `checkServerVersion` (as `KaguraClient.get_server_info`), `getEmbeddingStatus`, `getMemoryStats`, `findDuplicates` and `listEmbeddingModels`, which check the body against the Python model and return it as sent. The message reads as the Python SDK's: the call, then the failing fields, never their values (`<operation>: unexpected server response for <Model> (<field>: Field required). …`), then a suggestion to upgrade. It is not a `KaguraConnectionError`: a retry fails the same way | `operation` |
|
|
@@ -1465,13 +1497,18 @@ The codes the SDK types, by surface:
|
|
|
1465
1497
|
| `timeout`, `service_unavailable` (JSON-RPC `data.error`) | MCP 503 | `KaguraServiceUnavailableError` | v0.82.0+ |
|
|
1466
1498
|
| `DB-002` (`details.reason`: `pool_exhausted`, `connection_refused`, `database_error`, `deadlock`) | REST 503 | `KaguraServiceUnavailableError` | v0.104.0+ (`deadlock` v0.105.0) |
|
|
1467
1499
|
| `payload_too_large` (`limit`, `actual`) | MCP | `KaguraError` | v0.108.0+ |
|
|
1500
|
+
| `SCAN-001` (`Retry-After`; `details.file_id`, `details.scan_status`) | REST 409 | `KaguraFileScanPendingError` | v0.160.0+ |
|
|
1501
|
+
| `SCAN-002` (`details.file_id`, `details.scan_status`) | REST 409 | `KaguraFileBlockedError` | v0.160.0+ |
|
|
1468
1502
|
| `invalid_request`, `invalid_client`, `invalid_scope` (`device/authorize`) | OAuth | `KaguraAuthError`, `error_description` in the message and `details` | v0.78.0+ |
|
|
1469
1503
|
|
|
1470
1504
|
A gate is read before the code, so a v0.75.0+ server's `gate` decides the
|
|
1471
1505
|
class whatever the code. `kagura-memory` commands print, under the error
|
|
1472
1506
|
message, the reset time, the required plan, the capacity lock's cleanup
|
|
1473
|
-
page (unless `help` already names it), a 503's retry window
|
|
1474
|
-
|
|
1507
|
+
page (unless `help` already names it), a 503's retry window, how long to
|
|
1508
|
+
wait for a file the malware scan holds (`The malware scan of file … has
|
|
1509
|
+
not finished: wait 30 s and run the command again.`) or that a blocked one
|
|
1510
|
+
cannot be downloaded, and the server's `help` and correlation id, as the
|
|
1511
|
+
Python CLI does.
|
|
1475
1512
|
|
|
1476
1513
|
`authorizeDevice` turns an RFC 6749 refusal from `device/authorize`
|
|
1477
1514
|
(memory-cloud v0.78.0+) into a `KaguraAuthError` whose `code` is the OAuth
|
|
@@ -1723,7 +1760,9 @@ pinned rows first (`context_summary_omitted`). `guardrails` is absent
|
|
|
1723
1760
|
with `?guardrails=off` and `null` when the server's read failed or the
|
|
1724
1761
|
block cannot be read; `plan_headroom` (v0.142.0+) lists the plan
|
|
1725
1762
|
dimensions at 80 % or more of their limit, on every call — see
|
|
1726
|
-
[Plan headroom](#plan-headroom-memory-cloud-v01420)
|
|
1763
|
+
[Plan headroom](#plan-headroom-memory-cloud-v01420); `notices` (v0.161.0+)
|
|
1764
|
+
carries service notices for the user — see
|
|
1765
|
+
[Service notices](#service-notices-memory-cloud-v01610). The session-start
|
|
1727
1766
|
skill calls
|
|
1728
1767
|
`bootstrap({ contextId, since: "7d", format: "index", maxChars: 5000 })`.
|
|
1729
1768
|
|
|
@@ -1745,11 +1784,29 @@ resend. A batch that wrote nothing throws: `KaguraError` with `code`
|
|
|
1745
1784
|
`batch_failed` (every item failed) or `batch_refused` (an atomic batch
|
|
1746
1785
|
with an invalid item), the rows in `details.results`, or `timeout` (an
|
|
1747
1786
|
atomic batch rolled back, no rows); an atomic batch over the daily quota
|
|
1748
|
-
is `KaguraQuotaError`. Items are checked first: 1-50 objects, no
|
|
1749
|
-
`
|
|
1750
|
-
`context_id`, `remember`'s tag caps. A batch near a plan limit carries
|
|
1787
|
+
is `KaguraQuotaError`. Items are checked first: 1-50 objects, no other
|
|
1788
|
+
context's `context_id`, `remember`'s tag caps. A batch near a plan limit carries
|
|
1751
1789
|
`plan_headroom` (v0.142.0+; see [Plan headroom](#plan-headroom-memory-cloud-v01420)).
|
|
1752
1790
|
|
|
1791
|
+
**`rememberBatch`'s batch-level keys.** `dedupe`, `tags_normalize` and
|
|
1792
|
+
`verbose` belong on the batch. An item that carries one is sent as given, and
|
|
1793
|
+
the server decides (memory-cloud v0.156.0+), comparing JSON type and value
|
|
1794
|
+
after `remember`'s string coercion (`"true"` equals `true`, `1` does not): an
|
|
1795
|
+
item that repeats the batch's value is accepted; one whose value differs is
|
|
1796
|
+
refused (`invalid_argument`, that item only). When the batch does not set the
|
|
1797
|
+
key and every otherwise accepted item that carries it agrees on one valid
|
|
1798
|
+
value, the server applies it to the whole batch and the reply's top-level
|
|
1799
|
+
`lint` gets a `batch_level_argument` entry (`{code, hint, subject}`, the key as
|
|
1800
|
+
`subject`; read fail-open, so a drifted entry never fails a batch whose items
|
|
1801
|
+
are written); when they disagree, or agree on an invalid value, every item
|
|
1802
|
+
that carries the key is refused, those that agree included. With `atomic:
|
|
1803
|
+
true` a refused item refuses the batch (`batch_refused`). Older servers
|
|
1804
|
+
differ: 0.96.0 – 0.155.x refuse every item that carries one of the three
|
|
1805
|
+
(`invalid_argument` per item; a non-atomic batch writes the others, an atomic
|
|
1806
|
+
one is refused whole), and 0.93.0 – 0.95.x ignore the item's key and write the
|
|
1807
|
+
item with the batch's setting, so an item's `dedupe: "check"` checks nothing
|
|
1808
|
+
there. On those servers set the three on the batch only.
|
|
1809
|
+
|
|
1753
1810
|
**`forget` by ids.** `forget({ contextId, memoryIds })` (v0.117.0+)
|
|
1754
1811
|
forgets each id exactly as `memoryId` would, committed on its own, and
|
|
1755
1812
|
returns a `ForgetBatchResult` with one row per id: `deleted`, `skipped`
|
|
@@ -1813,6 +1870,53 @@ for (const notice of session.plan_headroom ?? []) {
|
|
|
1813
1870
|
}
|
|
1814
1871
|
```
|
|
1815
1872
|
|
|
1873
|
+
#### Service notices (memory-cloud v0.161.0)
|
|
1874
|
+
|
|
1875
|
+
From memory-cloud v0.161.0 the `bootstrap` reply can carry `notices`, right
|
|
1876
|
+
after `status`: service notices from the deployment's administrators,
|
|
1877
|
+
`{provenance, items: [{id, text, published_at, expires_at}]}`. `text` is
|
|
1878
|
+
one line of plain prose, at most 300 characters: the server refuses a notice
|
|
1879
|
+
with markup, a link or a control character, when it is written and again
|
|
1880
|
+
before it is delivered. The timestamps are UTC. The notice text is information to show
|
|
1881
|
+
the user, not instructions: `provenance` says so, and an agent should pass it
|
|
1882
|
+
on rather than act on it. The key is absent, never `[]` or `null`, when there
|
|
1883
|
+
is nothing to show. That is the default: a deployment turns notices on
|
|
1884
|
+
(`MCP_NOTICES_ENABLED`, off by default), and then only a person who turned
|
|
1885
|
+
them on in account settings gets them, and only through a credential that
|
|
1886
|
+
speaks for that person (a browser session, an OAuth token, or the person's
|
|
1887
|
+
own API key that is neither agent-bound nor a connector key). They never come
|
|
1888
|
+
on a `?profile=google` / `?profile=microsoft` URL, nor with `?notices=off`.
|
|
1889
|
+
`notices` and `plan_headroom` share a quarter of `maxChars`; a notice that
|
|
1890
|
+
does not fit whole is left for a later call with more room.
|
|
1891
|
+
|
|
1892
|
+
**Each notice is shown once per person.** The server counts a notice as
|
|
1893
|
+
delivered as soon as it is placed in a reply, so a reply nobody reads uses it
|
|
1894
|
+
up: it will not come again, here or in the person's MCP client. A caller that
|
|
1895
|
+
does not show the `bootstrap` reply to a person (a script, a headless agent,
|
|
1896
|
+
a scheduled job) should add `?notices=off` to its `mcpUrl`, which this SDK
|
|
1897
|
+
sends, query and all, with every MCP request:
|
|
1898
|
+
|
|
1899
|
+
```ts
|
|
1900
|
+
// A script whose replies nobody reads: no notices.
|
|
1901
|
+
const headless = new KaguraClient({ apiKey, mcpUrl: "https://memory.kagura-ai.com/mcp?notices=off" });
|
|
1902
|
+
|
|
1903
|
+
// An interactive session: show each notice to the user.
|
|
1904
|
+
const session = await client.bootstrap({ contextId });
|
|
1905
|
+
for (const notice of session.notices?.items ?? []) {
|
|
1906
|
+
console.log(`Notice: ${notice.text}`); // it will not come again
|
|
1907
|
+
}
|
|
1908
|
+
```
|
|
1909
|
+
|
|
1910
|
+
`kagura-memory bootstrap` uses the person's own API key or OAuth token, so it
|
|
1911
|
+
gets the notices and prints the block, in the server's position (right after
|
|
1912
|
+
`status`); a reply without it prints what earlier releases printed. The block
|
|
1913
|
+
is read fail-open, as `plan_headroom` is: a notice without a readable `text`
|
|
1914
|
+
is dropped from `items`; an `id`, `published_at` or `expires_at` that is
|
|
1915
|
+
absent or unreadable is `null` and the notice is kept, since the server has
|
|
1916
|
+
already counted it delivered; and a block that is not an object, or keeps no
|
|
1917
|
+
notice, is `null`, in the returned reply and in the CLI's output. The call
|
|
1918
|
+
never fails over it.
|
|
1919
|
+
|
|
1816
1920
|
### Deterministic lanes
|
|
1817
1921
|
|
|
1818
1922
|
These bypass ranking entirely — same inputs, same rows, every call. They are
|
|
@@ -1865,7 +1969,7 @@ Ephemeral, TTL-bounded, and excluded from recall — deliberately not memories.
|
|
|
1865
1969
|
|--------|--------------|
|
|
1866
1970
|
| `getSleepHistory` | Recent runs, newest first. Since v0.138.0 the server lists Sleep runs only unless `source` says otherwise (`"analysis"` for the rows Memory Analysis writes for its LLM spend, `"all"` for both), and each row carries `source`; older servers have no filter. |
|
|
1867
1971
|
| `getSleepReport` | One run in detail, including the per-action audit log. `contextId` is not sent: the server finds the run by `reportId`. From v0.82.0 the log comes a page at a time (`actionsLimit`, default 50, at most 200; `maxChars` 10,000–100,000): while `actions_has_more` is true, pass `actions_next_cursor` as `actionsCursor`. An action too large for its page has `details_omitted` and `details_total_chars` instead of `details`; an analysis report carries a `note` (v0.140.0+). |
|
|
1868
|
-
| `rollbackSleepRun` | Reverse a completed or degraded run. The server commits per step, so a partial rollback is possible: it throws `KaguraPartialRollbackError` instead of returning, and the steps it did reverse stay reversed. There is no retry: the report is now `failed`, and the server will not roll back a `failed` report again. `err.summary` has the same counts a clean run returns, and the actions in `err.summary.errors` were not reversed and need handling some other way. `chunks_requeued` / `points_requeued` (v0.112.0+) count restored memories queued for the embedding sweep to rebuild — not errors. |
|
|
1972
|
+
| `rollbackSleepRun` | Reverse a completed or degraded run. The server commits per step, so a partial rollback is possible: it throws `KaguraPartialRollbackError` instead of returning, and the steps it did reverse stay reversed. There is no retry: the report is now `failed`, and the server will not roll back a `failed` report again. `err.summary` has the same counts a clean run returns, and the actions in `err.summary.errors` were not reversed and need handling some other way. `chunks_requeued` / `points_requeued` (v0.112.0+) count restored memories queued for the embedding sweep to rebuild — not errors. `related_indexes_reverted` (v0.153.0+) counts the undone entries of the server's opt-in Sleep related index; the server sends it only when at least one was undone, and `kagura-memory sleep rollback` prints 0 otherwise. |
|
|
1869
1973
|
|
|
1870
1974
|
`getSleepReport` and `rollbackSleepRun`, and `kagura-memory sleep
|
|
1871
1975
|
report|rollback`, send `report_id` only. Their `contextId` is ignored and
|
|
@@ -1898,7 +2002,7 @@ v0.140.0 `rollbackSleepRun` refuses a Memory Analysis report (`source:
|
|
|
1898
2002
|
| `getUsage` | Workspace quota and usage: `used` / `limit` for memories, contexts, members and today's MCP calls. `capacity_lock` is `null` unless the workspace is over its Free capacity (memory-cloud v0.99.0+; absent before): then the same figures `KaguraCapacityLockedError` carries, with `cleanup_url` and `help`. A `capacity_lock` the Python SDK's `CapacityLock` model refuses throws `KaguraResponseError`. |
|
|
1899
2003
|
| `getMemoryStats` | Per-memory usage stats, sortable and paged. |
|
|
1900
2004
|
| `getEmbeddingStatus` / `listEmbeddingModels` | Embedding backend state and the models available for `createContext`. A failed row's `embedding_attempted_at` (v0.95.0+) is when its embedding last failed. |
|
|
1901
|
-
| `getToolDefinitions` | Raw MCP `tools/list` output, including tools this SDK does not wrap yet: the view `mcpUrl`'s query selects, not every tool. A bare URL lists the `core` profile on memory-cloud 0.93.0+ (21 tools on 0.141.0), `?profile=full` all of them (72), `?add_tools=a,b` (v0.129.0+) adds names to the profile,
|
|
2005
|
+
| `getToolDefinitions` | Raw MCP `tools/list` output, including tools this SDK does not wrap yet: the view `mcpUrl`'s query selects, not every tool. A bare URL lists the `core` profile on memory-cloud 0.93.0+ (21 tools on 0.141.0), `?profile=full` all of them (72), `?add_tools=a,b` (v0.129.0+) adds names to the profile, `?tools=a,b` is an allowlist, and `?profile=google` / `?profile=microsoft` (v0.158.0+) list `core` without `describe_tools` and `guide`. `tools/call` does not read the view, so every method of this client works on any URL — except on a `google` / `microsoft` URL without `?tools=`, where `describeTools()` and `guide()` throw `KaguraError` `unknown_tool`; only `recall`'s `explore_hints` need `explore` listed. The result is read as the Python SDK's `ToolListResponse`: each definition passes through unread, a result without `tools` lists none, and one that is not an object or whose `tools` is not a list of objects throws `KaguraResponseError` (`operation` `KaguraClient.get_tool_definitions`) rather than reading as an empty list. |
|
|
1902
2006
|
| `callRawTool` | Call any MCP tool by name — the escape hatch for tools with no typed wrapper. Args pass through verbatim (wire form: `context_id`, not `contextId`) and the result is untyped. Prefer a wrapper where one exists; use this so a missing one is a detour, not a dead end. |
|
|
1903
2007
|
| `close` | Drop the MCP session. The next call re-initializes automatically. |
|
|
1904
2008
|
|
|
@@ -2078,7 +2182,7 @@ an API key, an agent-bound key included, with no MCP session:
|
|
|
2078
2182
|
|
|
2079
2183
|
| Method | What it does |
|
|
2080
2184
|
|--------|--------------|
|
|
2081
|
-
| `getGuardrailDigest` | The rendered tool-triggered set for clients without tool hooks (`GET /api/v1/memory/guardrails/digest`). `target: "export"` (the default) returns the `AGENTS.md` block, between its marker lines, or `""` when the context has none; `"instructions"` returns the exact MCP server instructions this credential would receive, and `profile` / `tools` / `addTools` repeat the MCP URL's `?profile=` / `?tools=` / `?add_tools=` (`addTools`, memory-cloud v0.129.0+, is validated and joined as the server reads the names, sent only when it names a tool, and refused before any request for more than 100 names or one starting with `-`). `tool_triggered_version` is the response header, `null` when absent. The text is returned as is. |
|
|
2185
|
+
| `getGuardrailDigest` | The rendered tool-triggered set for clients without tool hooks (`GET /api/v1/memory/guardrails/digest`). `target: "export"` (the default) returns the `AGENTS.md` block, between its marker lines, or `""` when the context has none; `"instructions"` returns the exact MCP server instructions this credential would receive, and `profile` / `tools` / `addTools` repeat the MCP URL's `?profile=` / `?tools=` / `?add_tools=` (`profile` `google` / `microsoft`, v0.158.0+, previews that view's base text with no digest; `addTools`, memory-cloud v0.129.0+, is validated and joined as the server reads the names, sent only when it names a tool, and refused before any request for more than 100 names or one starting with `-`). `tool_triggered_version` is the response header, `null` when absent. The text is returned as is. |
|
|
2082
2186
|
| `loadGuardrails` | The REST twin of `KaguraClient.loadGuardrails` (`POST /api/v1/memory/guardrails`): the same two lanes and truncation flags, without the context block (`context_id` and `context_name` are `null`). The set is read as the Python SDK's `GuardrailSet` model reads it, by the same reader `guardrails load` prints with: the model's fields only, in its order, `null` for an optional one left out (so `GuardrailItem`'s optional fields and `ToolTrigger.match` are typed nullable), and a `tool_trigger` that is no trigger `null`. A set missing a required field, a truncation flag included, or holding one of the wrong type (`pinned.0.type: Input should be a valid string`) raises `KaguraResponseError` (`operation` `MemoryClient.load_guardrails`) rather than read as complete. |
|
|
2083
2187
|
|
|
2084
2188
|
Both refuse a `contextId` that is not a UUID before any request, in the
|
|
@@ -2243,6 +2347,56 @@ const shared = await files.list({ contextId: "workspace-uuid", scope: "workspace
|
|
|
2243
2347
|
const bound = await files.list({ contextId: "workspace-uuid", bindingContextId: "context-uuid" });
|
|
2244
2348
|
```
|
|
2245
2349
|
|
|
2350
|
+
**Malware scanning (memory-cloud v0.160.0+).** A deployment can scan
|
|
2351
|
+
uploads for malware (off by default). Every file object then carries
|
|
2352
|
+
`scan_status`, a plain string: `unscanned` (uploaded while scanning was
|
|
2353
|
+
off; downloadable), `pending`, `clean`, `infected` or `error`; it is
|
|
2354
|
+
absent on an older server. `kagura-memory files list` and `files upload`
|
|
2355
|
+
print it when the server sends it, and print what they printed before when
|
|
2356
|
+
it does not. With scanning off, the default, `scan_status` is the only
|
|
2357
|
+
change, and only an `infected` file (one scanned while scanning was on) is
|
|
2358
|
+
refused. With scanning on, `downloadUrl` answers two 409s, after the access
|
|
2359
|
+
checks (a file the caller cannot read is still `KaguraNotFoundError`):
|
|
2360
|
+
|
|
2361
|
+
- `SCAN-001`, `KaguraFileScanPendingError`: the scan has not finished. Wait
|
|
2362
|
+
`retryAfter` seconds (the server's `Retry-After`, 30) and call again; the
|
|
2363
|
+
SDK does not retry. A file that was downloadable before can answer this
|
|
2364
|
+
again: when its stored object no longer matches the scanned version, the
|
|
2365
|
+
server sets it back to `pending` and scans it again.
|
|
2366
|
+
- `SCAN-002`, `KaguraFileBlockedError`: the scan blocked the file
|
|
2367
|
+
(`scanStatus` `infected`, or `error` when the scanner could not check
|
|
2368
|
+
it); it cannot be downloaded. The server's gate is an allow-list, so any
|
|
2369
|
+
other state but `clean`, `unscanned` and `pending` is refused this way.
|
|
2370
|
+
|
|
2371
|
+
Both extend `KaguraConnectionError`, the class these 409s had before, and
|
|
2372
|
+
keep the server's `code` and `details` (`{file_id, scan_status}`).
|
|
2373
|
+
`kagura-memory files download-url` prints how long to wait, or that the file
|
|
2374
|
+
is blocked, under the error. `upload` can return a file whose `scan_status`
|
|
2375
|
+
is `pending`, a reserve dedup hit included (the duplicate is returned while
|
|
2376
|
+
its scan runs); a duplicate the scan blocked is never returned, and that 409
|
|
2377
|
+
is thrown as before (`KaguraConnectionError`, its message ending "an earlier
|
|
2378
|
+
upload of this file was blocked by the malware scan"). With scanning on,
|
|
2379
|
+
the largest file a reserve accepts is the scanner's stream limit when that
|
|
2380
|
+
limit is below the server's per-file cap (both default to 100 MiB, so by
|
|
2381
|
+
default nothing changes); a larger one gets the server's usual 422
|
|
2382
|
+
`VAL-001`, its message ending "(the largest file the malware scan checks)".
|
|
2383
|
+
|
|
2384
|
+
```ts
|
|
2385
|
+
import { KaguraFileBlockedError, KaguraFileScanPendingError } from "kagura-memory";
|
|
2386
|
+
|
|
2387
|
+
try {
|
|
2388
|
+
const url = await files.downloadUrl(fileId, { contextId: "workspace-uuid" });
|
|
2389
|
+
} catch (e) {
|
|
2390
|
+
if (e instanceof KaguraFileScanPendingError) {
|
|
2391
|
+
console.log(`still scanning; retry in ${e.retryAfter ?? 30} s`);
|
|
2392
|
+
} else if (e instanceof KaguraFileBlockedError) {
|
|
2393
|
+
console.log(`blocked by the malware scan (${e.scanStatus})`);
|
|
2394
|
+
} else {
|
|
2395
|
+
throw e;
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
```
|
|
2399
|
+
|
|
2246
2400
|
Every id a client puts in a URL path (a `FilesClient` file id, a
|
|
2247
2401
|
`ResourceClient` resource id, `KaguraClient`'s context id for memory
|
|
2248
2402
|
stats, duplicates and the tags drill-down, a `WorkspaceClient` user id, a
|
|
@@ -2366,7 +2520,7 @@ CLI as `kagura-memory`: 23 of the 24 top-level commands of the Python CLI
|
|
|
2366
2520
|
differ.
|
|
2367
2521
|
|
|
2368
2522
|
The parity target is the Python SDK and CLI **0.44.0**, checked against
|
|
2369
|
-
memory-cloud up to **v0.
|
|
2523
|
+
memory-cloud up to **v0.161.0**.
|
|
2370
2524
|
|
|
2371
2525
|
**SDK ↔ memory-cloud compatibility.**
|
|
2372
2526
|
[`docs/compatibility.md`](docs/compatibility.md) records, for each release
|