kagura-memory 0.12.0 → 0.14.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 +400 -76
- package/dist/cli.js +10268 -8038
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +1510 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -18
- package/dist/index.d.ts +116 -18
- package/dist/index.js +1510 -189
- package/dist/index.js.map +1 -1
- package/dist-mcp/mcp.cjs +512 -42
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,9 @@ the one optional peer dependency, for
|
|
|
34
34
|
[zero-knowledge secrets](#the-crypto-package-is-opt-in), is never installed
|
|
35
35
|
unless you ask for it.
|
|
36
36
|
|
|
37
|
-
Targets memory-cloud **v0.75.0** (`MIN_SERVER_VERSION`)
|
|
37
|
+
Targets memory-cloud **v0.75.0** (`MIN_SERVER_VERSION`) and is checked
|
|
38
|
+
against memory-cloud up to **v0.77.0**, as the Python SDK 0.42.0 is (whose
|
|
39
|
+
own `MIN_SERVER_VERSION` stays at an advisory 0.17.1).
|
|
38
40
|
`checkServerVersion()` warns, and never throws, on an older server, which
|
|
39
41
|
still answers: it ignores options it predates, leaves out fields it
|
|
40
42
|
predates, and reports a tool it predates as not found. A pre-release of
|
|
@@ -99,7 +101,9 @@ Credentials travel over HTTPS only. Every client, `login()`, `auth login
|
|
|
99
101
|
--server` and the URL every `setup` subcommand puts in a harness entry
|
|
100
102
|
(`setup claude`, `setup codex`, `setup hermes` and `setup openclaw`)
|
|
101
103
|
refuse a plain-HTTP URL unless its host is `localhost`, `127.0.0.1` or
|
|
102
|
-
`[::1]
|
|
104
|
+
`[::1]`; `doctor` warns about a resolved MCP URL like that and skips the
|
|
105
|
+
server check, as the Python CLI does, and fails a configured `mcp_url`
|
|
106
|
+
like that which the credential does not use (see `doctor`). The URL is
|
|
103
107
|
read as `fetch` reads it, so the scheme in any case (`HTTP://`), without
|
|
104
108
|
its slashes (`http:host`), or with whitespace or control characters
|
|
105
109
|
around it or a tab or newline inside it is refused all the same, as in
|
|
@@ -127,7 +131,8 @@ negative VALUE), so `secret exec --help --bogus` prints the help; without
|
|
|
127
131
|
`--help`, `secret exec` still refuses an unknown option before the child
|
|
128
132
|
command rather than running it as that command. The one command not
|
|
129
133
|
ported, the few options only this bin has, and the deliberate
|
|
130
|
-
differences are listed below.
|
|
134
|
+
differences are listed below. The parity target is the Python CLI
|
|
135
|
+
**0.42.0**.
|
|
131
136
|
|
|
132
137
|
Values are read as click reads them. A choice matches exactly, as click's
|
|
133
138
|
`Choice` does, except where the Python CLI declares one case-insensitive
|
|
@@ -187,7 +192,59 @@ the server's `setup_resource` has no summary: the context's owner sets it
|
|
|
187
192
|
afterwards with `kagura-memory context update <context_id> --summary …`.
|
|
188
193
|
As in Python, `resource tokens revoke` prints `Token revoked.`, and
|
|
189
194
|
`resource schema` prints `No schema registered for this resource.` when
|
|
190
|
-
there is none.
|
|
195
|
+
there is none (the route's 404).
|
|
196
|
+
|
|
197
|
+
**Records print as the Python CLI prints them.** `resource tokens
|
|
198
|
+
list|create|update`, `resource list|stats|indexer-status|events|schema`,
|
|
199
|
+
`resource ingest|ingest-batch|setup`, `files list` and `files upload`
|
|
200
|
+
print the result as the Python CLI does, `model_dump_json(indent=2)` of
|
|
201
|
+
the Python SDK's model
|
|
202
|
+
([#66](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/66)):
|
|
203
|
+
the model's keys in its order, its default for a key the server left out
|
|
204
|
+
(`null`, `false`, `0`, `[]`, `{}`, `"success"`), and no key it does not
|
|
205
|
+
have. Each value is what the model's type makes of it: `"12"` for an int
|
|
206
|
+
prints `12`, a float prints as one (`1.0`, `1e-6`), a resource event's id
|
|
207
|
+
past 2^53 prints exactly, and a timestamp prints in pydantic's form
|
|
208
|
+
(`2026-06-01T09:00:00.5+00:00` as `2026-06-01T09:00:00.500000Z`), which
|
|
209
|
+
is the form memory-cloud already sends. A record the model refuses (a
|
|
210
|
+
required field missing, a value of the wrong type) exits 1 with the
|
|
211
|
+
Python SDK's `KaguraResponseError` text, e.g. `ResourceClient.list_tokens:
|
|
212
|
+
unexpected server response for PaginatedResourceTokensResponse
|
|
213
|
+
(tokens.0.created_at: Field required). …`, and so does a body that is no
|
|
214
|
+
record at all (`null`). An untyped mapping nested past pydantic's limit
|
|
215
|
+
(256 containers) exits 1 with pydantic's `Error serializing to JSON:
|
|
216
|
+
ValueError: Circular reference detected (depth exceeded)`. The body is
|
|
217
|
+
read as Python's `json.loads` reads it
|
|
218
|
+
([#69](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/69)),
|
|
219
|
+
so an int field sent `9007199254740993` prints exactly, one sent `1e20`
|
|
220
|
+
exits 1 as pydantic refuses it (`Unable to parse input string as an
|
|
221
|
+
integer, exceeded maximum size`), and a float field sent `-0` prints
|
|
222
|
+
`0.0`. Inside an untyped mapping (an event's `payload`, a batch's
|
|
223
|
+
`errors`) the keys print in the server's order (`{"b": 1, "2": 2}` stays
|
|
224
|
+
so) and each number as Python read it (`1.0`, `1e+16`, `-0.0`, an
|
|
225
|
+
integer past 2^53 exactly). `NaN` and `Infinity` are read, and print
|
|
226
|
+
`null` as pydantic writes them; an integer of more than 4,300 digits
|
|
227
|
+
makes the body non-JSON, as Python's `int()` limit does; and a body
|
|
228
|
+
nested deeper than 973 containers exits 1 with Python's `maximum
|
|
229
|
+
recursion depth exceeded while decoding a JSON array from a unicode
|
|
230
|
+
string`. A string value holding a lone surrogate (`"\ud800"`) exits 1
|
|
231
|
+
with pydantic's `Error serializing to JSON: UnicodeEncodeError: 'utf-8'
|
|
232
|
+
codec can't encode character '\ud800' in position 0: surrogates not
|
|
233
|
+
allowed`; a key of the untyped mapping itself holding one prints as
|
|
234
|
+
three U+FFFD, as pydantic converts it, and a key of a mapping nested
|
|
235
|
+
inside it exits 1 like a value. Three differences remain. Python's depth
|
|
236
|
+
is its recursion limit less the stack in use: 973 is what these commands
|
|
237
|
+
reach, and `doctor` given such a `/api/v1/system/info` body reports a
|
|
238
|
+
failed server check where Python stops with a traceback. The body is
|
|
239
|
+
decoded as UTF-8, as `fetch` decodes every body: one that is not valid
|
|
240
|
+
UTF-8 is read with U+FFFD in place of the bad bytes, where Python calls
|
|
241
|
+
it non-JSON, or, for a lone surrogate sent as its three raw bytes
|
|
242
|
+
(`ED A0 80`), reads it and then refuses the dump; and a UTF-16 or UTF-32
|
|
243
|
+
body, with or without a BOM, which Python's `json.loads` detects and
|
|
244
|
+
reads, is non-JSON here (`Server returned a non-JSON body (HTTP 200)
|
|
245
|
+
…`). No memory-cloud server sends either. And only REST bodies are read
|
|
246
|
+
this way: the MCP commands (`recall`, `remember`, …) still print a whole
|
|
247
|
+
float as `1` and list an object's integer keys first.
|
|
191
248
|
|
|
192
249
|
**Files and imports.** The `files` commands take their workspace from the
|
|
193
250
|
credential's own source, as the Python CLI does (its #115): `-c` when
|
|
@@ -196,7 +253,8 @@ given, else the OAuth profile's workspace, else the `context_id` of the
|
|
|
196
253
|
`files delete` prints `Deleted <file_id>` and `files download-url` the bare
|
|
197
254
|
URL. `files upload --remember` writes the memory the Python CLI writes
|
|
198
255
|
(`source_uri` the file's `file://` URI, `details` the file's id, sha256,
|
|
199
|
-
size and type)
|
|
256
|
+
size and type), and prints `{"file": …, "memory": …}`, the file as its
|
|
257
|
+
model reads it. `resource import` detects the format by the file's
|
|
200
258
|
extension, so stdin needs `--format`, and reads CSV and JSON the way
|
|
201
259
|
Python's `csv` and `json` modules read them, with their error messages
|
|
202
260
|
(exit 1). A row keeps its keys in the order read, and a doc_id taken from
|
|
@@ -210,7 +268,16 @@ with a traceback. Two limits of JavaScript numbers remain: a number in the
|
|
|
210
268
|
payload is sent as JavaScript reads it, so an integer past 2^53 loses its
|
|
211
269
|
last digits and `10.0` is sent as `10`, where Python sends them as
|
|
212
270
|
written; and `-V` above 2^53 is refused as too large (exit 2), where
|
|
213
|
-
Python sends it.
|
|
271
|
+
Python sends it. The summary prints as Python's `json.dumps` prints it
|
|
272
|
+
([#69](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/69)):
|
|
273
|
+
`created` and `failed` add up exactly past 2^53, and each error keeps
|
|
274
|
+
the server's key order and numbers (`1.0`, `1e+16`, `NaN`); a lone
|
|
275
|
+
surrogate in an error's string or key prints as `?` (one per code unit,
|
|
276
|
+
`"😀???x"`), as the Python CLI's UTF-8 stdout with `errors="replace"`
|
|
277
|
+
writes what `json.dumps` kept. The counts in
|
|
278
|
+
`--progress json`'s events (`detail.created_so_far`, the success event's
|
|
279
|
+
`detail.created`) are still JavaScript numbers, so past 2^53 they are
|
|
280
|
+
rounded where Python's are exact; `-v` prints no counts.
|
|
214
281
|
|
|
215
282
|
**Progress.** `files upload` and `resource import` take `-v/--verbose`
|
|
216
283
|
(repeatable) and `--progress rich|json|none`. Progress goes to stderr, one
|
|
@@ -220,17 +287,21 @@ line per event, so stdout carries the same result either way.
|
|
|
220
287
|
last event is the operation's single `success` or `error`; `-v`, or
|
|
221
288
|
`--progress rich`, writes the lines the Python CLI shows
|
|
222
289
|
(`→ Reserving upload report.pdf (1234 bytes)`, `✓ Upload complete`,
|
|
223
|
-
`✗ Upload failed: …`); `--progress none` is silent even with `-v`.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
early (`2>&1 | head -1`) does not stop the upload or the
|
|
229
|
-
ends the process without a final event
|
|
290
|
+
`✗ Upload failed: …`); `--progress none` is silent even with `-v`.
|
|
291
|
+
As in the Python CLI (0.41.1+), `files upload --remember` reports success
|
|
292
|
+
only once the linked memory is written (a failed write ends the stream
|
|
293
|
+
with that error), and `resource import` starts its stream only once its
|
|
294
|
+
client is built, so a credential that fails prints the error alone. A
|
|
295
|
+
stderr closed early (`2>&1 | head -1`) does not stop the upload or the
|
|
296
|
+
import. Ctrl-C ends the process without a final event (Node's default
|
|
297
|
+
SIGINT handling exits at once), where the Python CLI catches the
|
|
298
|
+
interrupt and ends the stream with `error`.
|
|
230
299
|
|
|
231
300
|
**Connecting a harness.** Each `setup` subcommand sets up an MCP entry
|
|
232
|
-
named `kagura-memory`: the URL plus a Bearer header
|
|
233
|
-
|
|
301
|
+
named `kagura-memory`: the URL plus a Bearer header, or, with
|
|
302
|
+
`--url-form --oauth` (below), the URL alone, which the harness signs in
|
|
303
|
+
to itself. The key is never printed, and no harness CLI gets it on its
|
|
304
|
+
command line.
|
|
234
305
|
|
|
235
306
|
`setup claude` also writes `.kagura.json` (0600, gitignored). Its key
|
|
236
307
|
comes from `--api-key`, else the `api_key` in the project's own
|
|
@@ -259,9 +330,9 @@ it, a missing credential stops setup (exit 1).
|
|
|
259
330
|
| Subcommand | How the entry is applied | Where the key goes |
|
|
260
331
|
|---|---|---|
|
|
261
332
|
| `setup claude` | `.mcp.json` (`--scope project`, the default), or `claude mcp add-json --scope user …` | `--scope project`: in `.mcp.json`; `--scope user`: `KAGURA_MCP_API_KEY`, exported where Claude Code starts |
|
|
262
|
-
| `setup codex` | `codex mcp add … --bearer-token-env-var KAGURA_API_KEY` | `export KAGURA_API_KEY=…` in the shell profile that starts Codex |
|
|
263
|
-
| `setup hermes` | the `config.yaml` block is printed; `hermes mcp add` is interactive, and this port never prompts | `MCP_KAGURA_MEMORY_API_KEY=…` (`MCP_<NAME>_API_KEY` with `--name`) in the `.env` beside `config.yaml`, added with an editor |
|
|
264
|
-
| `setup openclaw` | `openclaw mcp add … --transport streamable-http --no-probe`, or `openclaw mcp set`
|
|
333
|
+
| `setup codex` | `codex mcp add … --bearer-token-env-var KAGURA_API_KEY` (with `--oauth`: `codex mcp add NAME --url URL`, attached, when there is a terminal and no `-y`) | `export KAGURA_API_KEY=…` in the shell profile that starts Codex |
|
|
334
|
+
| `setup hermes` | the `config.yaml` block is printed; `hermes mcp add` is interactive, and this port never prompts (with `--oauth`: `hermes mcp add … --auth oauth`, attached, when there is a terminal and no `-y`) | `MCP_KAGURA_MEMORY_API_KEY=…` (`MCP_<NAME>_API_KEY` with `--name`) in the `.env` beside `config.yaml`, added with an editor |
|
|
335
|
+
| `setup openclaw` | `openclaw mcp add … --transport streamable-http --no-probe`, or `openclaw mcp set` with `--force` (with `--oauth`: the same two commands with `--auth oauth` and no header) | `KAGURA_API_KEY=…` in `$OPENCLAW_STATE_DIR/.env` (default `~/.openclaw/.env`), added with an editor |
|
|
265
336
|
|
|
266
337
|
`--api-key-env VAR` renames `KAGURA_API_KEY` for Codex and OpenClaw
|
|
267
338
|
(an upper-case letter or `_`, then upper-case letters, digits or `_`).
|
|
@@ -287,6 +358,49 @@ checks, and exits 1 saying to pass `--mcp-url`. `$OPENCLAW_STATE_DIR`,
|
|
|
287
358
|
`$OPENCLAW_CONFIG_PATH` and `$OPENCLAW_WORKSPACE_DIR` are read as OpenClaw
|
|
288
359
|
reads them: stripped, with a leading `~` expanded.
|
|
289
360
|
|
|
361
|
+
**The OAuth URL form** (memory-cloud 0.77.0+). From 0.77.0 memory-cloud's
|
|
362
|
+
dynamic client registration accepts the three harnesses' own OAuth clients
|
|
363
|
+
on a loopback redirect
|
|
364
|
+
([memory-cloud#1657](https://github.com/kagura-ai/memory-cloud/issues/1657)),
|
|
365
|
+
so `--url-form --oauth --mcp-url https://memory.kagura-ai.com/mcp/w/<workspace-id>`
|
|
366
|
+
writes a URL entry with no key, no header and no key variable: the harness
|
|
367
|
+
registers its own client, signs in itself and keeps the token in its own
|
|
368
|
+
store. Setup never sees the token, never runs a harness `login`, and never
|
|
369
|
+
picks this form on its own. Before it detects, runs or writes anything,
|
|
370
|
+
a real run sends one unauthenticated `GET /api/v1/system/info` to the
|
|
371
|
+
`--mcp-url` server and stops (exit 1) unless it reports 0.77.0 or later; a
|
|
372
|
+
version setup cannot read (no answer, not a 200, unparseable) stops it
|
|
373
|
+
too. `--dry-run` sends no request. `--oauth` needs `--url-form` and
|
|
374
|
+
`--mcp-url` and refuses `--api-key-env` (exit 2).
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
npx kagura-memory setup codex --url-form --oauth --mcp-url https://memory.kagura-ai.com/mcp/w/<workspace-id>
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
| | The entry | Written with | Sign in | The harness keeps the token in |
|
|
381
|
+
|---|---|---|---|---|
|
|
382
|
+
| Codex | `url` only (Codex's `auth` defaults to OAuth) | `codex mcp add <name> --url <url>`, which saves the entry and then starts Codex's browser sign-in, so setup runs it attached to your terminal (its output on stderr), only with a terminal on stdin and without `-y`; otherwise it prints the table and edits nothing (`--force`: the same add, which signs in again) | `codex mcp login <name>` (`--no-browser` when the browser cannot reach the callback) | the OS keyring (`Codex MCP Credentials`; on Windows, Codex's encrypted secrets store in `~/.codex`), else `~/.codex/.credentials.json` (`$CODEX_HOME`), keyed on the entry's URL |
|
|
383
|
+
| Hermes Agent | `url` + `auth: oauth` | `hermes mcp add <name> --url <url> --auth oauth --connect-timeout 315`, attached, with a terminal and without `-y`: its probe runs the browser sign-in, which its default 30 s bound would cut short. Setup then reads the entry back with `hermes config get mcp_servers.<name> --json`: an entry Hermes kept, saved without `auth: oauth`, or saved disabled (`enabled: false`, after the sign-in did not finish) stops setup (exit 1) with the command that fixes it, and skips the `AGENTS.md` export | `hermes mcp login <name>` (the browser flow), or on memory-cloud 0.78.0+ `hermes mcp login <name> --flow device` (a code entered at the server's `/device` page; no loopback callback, [memory-cloud#1671](https://github.com/kagura-ai/memory-cloud/issues/1671)) | `~/.hermes/mcp-tokens/<name>.json` (`$HERMES_HOME`, or the active Hermes profile's) |
|
|
384
|
+
| OpenClaw | `url`, `transport: "streamable-http"`, `auth: "oauth"` | `openclaw mcp add <name> --url <url> --transport streamable-http --auth oauth`, which saves an OAuth entry without probing (`--force`: `openclaw mcp set`, even when no entry exists, where Python then uses `mcp add`) | `openclaw mcp login <name>` (`--code <code>` when the browser cannot reach the callback), then `openclaw mcp doctor <name> --probe` | its state database, `~/.openclaw/state/openclaw.sqlite` (`$OPENCLAW_STATE_DIR/state/`) |
|
|
385
|
+
|
|
386
|
+
memory-cloud's consent screen shows the client name the harness sends,
|
|
387
|
+
which nothing verifies: approve only a sign-in you started. For Codex,
|
|
388
|
+
`-c` or `--guardrails` goes on the URL as `?guardrails=`; Codex keys its
|
|
389
|
+
token on the URL, so changing it later means signing in again. With the
|
|
390
|
+
plugin's hooks on, an `--oauth` entry does not get `?guardrails=off` (the
|
|
391
|
+
hooks cannot read it), and setup says so. The `--guardrails` preview runs
|
|
392
|
+
on this CLI's own credential when that is on the `--mcp-url` server;
|
|
393
|
+
otherwise it names the stored profiles there and runs on the first, or,
|
|
394
|
+
when there is none, names the `kagura-memory auth login --server` to run
|
|
395
|
+
first. What Codex receives depends on the account it signed in with.
|
|
396
|
+
|
|
397
|
+
What has been checked (python-sdk#284): on 2026-09-25 each harness signed
|
|
398
|
+
in end to end on a `/mcp/w/<workspace-id>` URL against memory-cloud
|
|
399
|
+
0.78.0, through entries the Python CLI's `setup … --url-form --oauth`
|
|
400
|
+
wrote, and reached `tools/list`: Codex 0.157.0, Hermes Agent v2026.9.24
|
|
401
|
+
(the browser sign-in and `hermes mcp login --flow device`) and OpenClaw
|
|
402
|
+
2026.9.6. This bin writes the same entries with the same harness commands.
|
|
403
|
+
|
|
290
404
|
This package has no TOML, YAML or JSON5 parser, so it never rewrites those
|
|
291
405
|
files. When the harness's CLI is not on `PATH`, the block is printed on
|
|
292
406
|
stderr with the file it belongs in, and stdout stays one JSON document.
|
|
@@ -365,14 +479,21 @@ and splices it into a file the harness loads every session, between its
|
|
|
365
479
|
place, an unchanged set rewrites nothing, and the rest of the file is
|
|
366
480
|
kept, line endings and a symlink included. Without PATH the file is the
|
|
367
481
|
harness's own: `$CODEX_HOME/AGENTS.md` (`AGENTS.override.md` when that
|
|
368
|
-
exists); for Hermes the
|
|
369
|
-
|
|
370
|
-
|
|
482
|
+
exists); for Hermes the file Hermes loads from the current directory, found as
|
|
483
|
+
Hermes finds it: the nearest `.hermes.md` or `HERMES.md` up to the git
|
|
484
|
+
root (an empty one ends that search), else this directory's
|
|
485
|
+
`AGENTS.override.md`, `AGENTS.md` or `agents.md` (a new `AGENTS.md` when
|
|
486
|
+
only a parent directory's loads), else its `CLAUDE.md` or `claude.md`,
|
|
487
|
+
else a new `AGENTS.md`, so your own file keeps loading. With only Cursor
|
|
488
|
+
rules (`.cursorrules`, `.cursor/rules/*.mdc`) there is no default, since a
|
|
489
|
+
new `AGENTS.md` would stop Hermes loading them: `--agents-md` then needs a
|
|
490
|
+
PATH (exit 1, nothing run), and a dry run says the export is not offered;
|
|
491
|
+
for OpenClaw `AGENTS.md` in its workspace,
|
|
371
492
|
`$OPENCLAW_WORKSPACE_DIR`, else `workspace/` in the state directory. A
|
|
372
493
|
leading `~` or `~/` in PATH is expanded to your home directory (a
|
|
373
|
-
`~user` is left as written
|
|
374
|
-
created. The context is `--context-id`, else a
|
|
375
|
-
UUID, never the
|
|
494
|
+
`~user` is left as written, as in the Python CLI), and missing
|
|
495
|
+
directories are created. The context is `--context-id`, else a
|
|
496
|
+
`--guardrails` context UUID, never the
|
|
376
497
|
URL's `?guardrails=` or `.kagura.json`; without one, `--agents-md` is a
|
|
377
498
|
usage error (exit 2). The block is fetched on the usual credential chain
|
|
378
499
|
(`KAGURA_API_KEY`, the OAuth profile, `.kagura.json`), which setup
|
|
@@ -382,13 +503,15 @@ nothing run. The export comes after the entry is applied or printed.
|
|
|
382
503
|
`wrote` lists the file, and the notes carry Python's lines: the refresh
|
|
383
504
|
command (`kagura-memory guardrails digest <ctx> --out <file>`), a warning
|
|
384
505
|
past the 32 KiB Codex reads or the 20,000 characters OpenClaw reads, and
|
|
385
|
-
Hermes's prompt-injection note. An empty digest
|
|
386
|
-
|
|
387
|
-
failed export prints the report, then the error
|
|
506
|
+
Hermes's prompt-injection note. An empty digest removes an earlier block,
|
|
507
|
+
as `guardrails digest --out` does, and otherwise writes nothing, creating
|
|
508
|
+
no file or directory. A failed export prints the report, then the error
|
|
509
|
+
(exit 1). `--dry-run`
|
|
388
510
|
names what the export would do to the file (create it, append the block,
|
|
389
511
|
replace the block, or update a file it cannot read). On Hermes and
|
|
390
512
|
OpenClaw a run without the export ends with Python's "Re-run with
|
|
391
|
-
--agents-md --context-id <id> …" hint
|
|
513
|
+
--agents-md --context-id <id> …" hint, except where Hermes has no default
|
|
514
|
+
file.
|
|
392
515
|
|
|
393
516
|
Claude Code uses the `kagura-memory` entry from the strongest scope
|
|
394
517
|
(local > project > user). It keys local scope by the git repository root
|
|
@@ -435,8 +558,14 @@ the zero-dependency promise; use the Python CLI for it. The Claude Code
|
|
|
435
558
|
extras of `kagura setup claude` are not ported either: its SessionStart
|
|
436
559
|
and PostToolUse hooks and its `/kagura-recall` and `/kagura-remember`
|
|
437
560
|
commands. `setup claude` here writes `.kagura.json` and the MCP entry
|
|
438
|
-
only, and takes their flags as inert (see above).
|
|
439
|
-
|
|
561
|
+
only, and takes their flags as inert (see above).
|
|
562
|
+
|
|
563
|
+
Nor are the skills of the Python CLI's Claude Code plugin, such as the
|
|
564
|
+
`memory` skill of 0.42.0 (python-sdk #248), which walks an agent through
|
|
565
|
+
`remember`, `recall`, `reference`, `update-memory` and `forget` and their
|
|
566
|
+
`--details`/`--location` rules: this package ships no Claude Code plugin.
|
|
567
|
+
|
|
568
|
+
Every other command of the Python CLI is here as of 0.12.0
|
|
440
569
|
([#57](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/57)),
|
|
441
570
|
with the differences in options and output this section lists.
|
|
442
571
|
|
|
@@ -495,40 +624,50 @@ with `--url-form` too.
|
|
|
495
624
|
the Python CLI in these ways, each on purpose:
|
|
496
625
|
|
|
497
626
|
- Every entry here is the URL form, so `--url-form` is accepted and
|
|
498
|
-
changes nothing
|
|
499
|
-
|
|
627
|
+
changes nothing by itself (`--oauth` needs it, as in Python), and
|
|
628
|
+
`--mcp-url` falls back to the configured URL where Python requires it
|
|
629
|
+
(not with `--oauth`). Only that fallback needs the configuration: without
|
|
500
630
|
`--mcp-url`, a `.kagura.json` that cannot be loaded stops setup (exit 1);
|
|
501
631
|
with it, setup goes on with a note, as Python never reads that file.
|
|
502
632
|
- `-c` must be a context UUID with `--url-form --profile` too (exit 2),
|
|
503
633
|
where Python looks a name up through the profile.
|
|
504
|
-
- `setup hermes` never runs `hermes mcp add
|
|
505
|
-
block, as Python does under `-y`.
|
|
634
|
+
- `setup hermes` never runs `hermes mcp add` for the API-key form, which
|
|
635
|
+
prompts for the key; it prints the block, as Python does under `-y`.
|
|
636
|
+
With `--oauth` it runs it attached, as Python does.
|
|
637
|
+
- So nothing is read back with `hermes config get` for that form either:
|
|
638
|
+
the Python CLI 0.41.1's stops after the add (an entry Hermes kept in
|
|
639
|
+
place of the one asked for, an entry saved disabled, which points to
|
|
640
|
+
`hermes mcp test`) and its warning for a URL entry saved without an
|
|
641
|
+
`Authorization` header cannot arise for the printed block.
|
|
506
642
|
- An existing entry is found by scanning the file, and not described by
|
|
507
643
|
kind. A readable but malformed `config.toml` does not stop
|
|
508
644
|
`setup codex`.
|
|
509
645
|
- On Codex, a `?guardrails=` already in the MCP URL (`--mcp-url` or the
|
|
510
646
|
configured `mcp_url`) beats the hooks and `-c` defaults.
|
|
511
|
-
- Nothing prompts
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
647
|
+
- Nothing prompts here (setup only hands the terminal to an `--oauth`
|
|
648
|
+
`codex mcp add` or `hermes mcp add`), so `--agents-md` always needs a
|
|
649
|
+
context, and the export is never offered: a dry run of Hermes or
|
|
650
|
+
OpenClaw says "not offered: this port never prompts" (or "not offered
|
|
651
|
+
with -y").
|
|
652
|
+
- When the export credential is for another server, the message
|
|
517
653
|
says what moves it here, where Python's points at `--profile`: for
|
|
518
654
|
`KAGURA_API_KEY`, which outranks every profile, `KAGURA_MCP_URL` or
|
|
519
655
|
unsetting the key; otherwise `KAGURA_PROFILE`.
|
|
520
|
-
-
|
|
521
|
-
dash, where click reads `--agents-md=-y` as the default file plus `-y`.
|
|
522
|
-
- The Codex size warning counts the bytes on disk, CRLFs included, where
|
|
523
|
-
Python counts the text with its line endings folded.
|
|
524
|
-
- A `~user` in an `OPENCLAW_*` variable or in `--agents-md PATH` is left
|
|
525
|
-
as written (`--agents-md '~root/x.md'` names `~root/x.md` in the
|
|
526
|
-
current directory), where Python looks the user up (`/root/x.md`) and
|
|
527
|
-
fails the whole setup for an unknown one. File errors of the export are
|
|
528
|
-
Node's words, not Python's `[Errno …]`.
|
|
656
|
+
- File errors of the export are Node's words, not Python's `[Errno …]`.
|
|
529
657
|
- Output is one JSON document on stdout, with Python's sentences in
|
|
530
658
|
`notes` and the block on stderr. A non-ASCII URL is written as UTF-8
|
|
531
659
|
where Python writes `\uXXXX` escapes; both are valid.
|
|
660
|
+
- `--oauth`: a harness CLI run attached writes its output to stderr, so
|
|
661
|
+
stdout stays one JSON document. The server-check refusal ends "Use
|
|
662
|
+
--url-form with an API key instead (no --oauth).", where Python also
|
|
663
|
+
offers its stdio entry, which this bin cannot write. The Codex hooks
|
|
664
|
+
warning appears only when the plugin's hooks are on for the entry (this
|
|
665
|
+
bin does not read an existing entry's bearer), and setup does not ask
|
|
666
|
+
"Write the --oauth entry anyway?": it warns and goes on, as Python does
|
|
667
|
+
under `-y`. The `--guardrails` preview never names `--profile`, which is
|
|
668
|
+
inert here, and also names a `.kagura.json` that is JSON but not an
|
|
669
|
+
object, which every command of this bin refuses (Python's loader takes
|
|
670
|
+
one). Sentences Python wraps at 78 columns are one line here.
|
|
532
671
|
|
|
533
672
|
Some small divergences run the other way: this CLI refuses what click
|
|
534
673
|
would accept.
|
|
@@ -539,8 +678,6 @@ would accept.
|
|
|
539
678
|
apart from `--external-id=` in the `update-memory` case below.
|
|
540
679
|
- `context update --lock --unlock` is a usage error (exit 2, "mutually
|
|
541
680
|
exclusive; pick one"), where click takes whichever flag comes last.
|
|
542
|
-
- `setup … --agents-md=' '` (a path of only whitespace) is a usage error
|
|
543
|
-
(exit 2), where Python writes a file named `" "`.
|
|
544
681
|
- `--rerank --no-rerank` is the same usage error, on `recall` and on
|
|
545
682
|
`context search-config`.
|
|
546
683
|
- `auth logout --all --profile NAME` is the same usage error, where click
|
|
@@ -551,8 +688,6 @@ would accept.
|
|
|
551
688
|
CLI refuses that too, as `updateMemory` does.
|
|
552
689
|
- `-k=5` (a short option, `=`, a value) reads `5`, where click reads `=5`
|
|
553
690
|
as the value and then refuses it.
|
|
554
|
-
- A float range such as `files upload --importance` refuses `nan`, which
|
|
555
|
-
click's `FloatRange` lets through (every comparison with NaN is false).
|
|
556
691
|
- An option that takes a value does not take a following argument that
|
|
557
692
|
begins with a dash and is not a number (a lone `-` is still a value):
|
|
558
693
|
`--name-contains -auth` is a missing value here (`Error: Option
|
|
@@ -560,9 +695,47 @@ would accept.
|
|
|
560
695
|
Write `--name-contains=-auth`. A number is anything `float()` reads,
|
|
561
696
|
so `-١` is one. `auth login --invite` is the exception, since an invite
|
|
562
697
|
token may begin with a dash.
|
|
563
|
-
-
|
|
564
|
-
|
|
565
|
-
|
|
698
|
+
- An id the command puts in a URL path, `FILE_ID` (`files delete`, `files
|
|
699
|
+
download-url`), the resource id (`-r/--resource-id` of `resource stats`,
|
|
700
|
+
`indexer-status`, `schema`, `ingest`, `ingest-batch` and `import`, and
|
|
701
|
+
`resource events RESOURCE_ID`) and `USER_ID` / `--user`, is refused when
|
|
702
|
+
it is `.`, `..` or empty (exit 2, `Invalid value for 'FILE_ID': '..' is
|
|
703
|
+
not a valid file id.`), before anything is read or sent. The Python CLI
|
|
704
|
+
sends it, and URL resolution then drops or climbs the segment: `files
|
|
705
|
+
download-url ..` asks for `/api/v1/download-url`. (From 0.41.1 it
|
|
706
|
+
refuses a `USER_ID` as this bin does.) Any other id is sent
|
|
707
|
+
percent-encoded as one segment, so a `/`, `?` or `#` in it stays in the
|
|
708
|
+
id rather than reaching another route or replacing the query
|
|
709
|
+
(`files delete 'x?workspace_id=…'`).
|
|
710
|
+
|
|
711
|
+
**Differences from the Python CLI 0.42.0 in what it added**, each on
|
|
712
|
+
purpose or out of reach:
|
|
713
|
+
|
|
714
|
+
- `update-memory --details` and `remember --details` refuse text that is
|
|
715
|
+
not JSON with JavaScript's parser message after `Invalid JSON for
|
|
716
|
+
--details:`, where Python prints its `json` module's.
|
|
717
|
+
- `update-memory --merge-details` prints the size of a bounded
|
|
718
|
+
`reference` reply when `details_total_chars` is a whole number sent as a
|
|
719
|
+
float (`24000.0`), which Python leaves out: JSON.parse cannot tell it
|
|
720
|
+
from `24000`.
|
|
721
|
+
- `getServerInfo`, `checkServerVersion`, `getEmbeddingStatus`,
|
|
722
|
+
`getMemoryStats`, `findDuplicates` and `listEmbeddingModels` check the
|
|
723
|
+
body against the Python model and return it as the server sent it:
|
|
724
|
+
keys the model does not have stay, and a lax value such as `"3"` for an
|
|
725
|
+
int is not converted, where Python returns the model.
|
|
726
|
+
- `getMemoryStats` accepts rows without `use_count`, which memory-cloud
|
|
727
|
+
v0.34.0 and later never send. The Python SDK 0.42.0's model still
|
|
728
|
+
requires it, so it refuses every non-empty page
|
|
729
|
+
(`memories.0.use_count: Field required`).
|
|
730
|
+
- `listMemories` returns its body unchecked. The Python SDK has read it
|
|
731
|
+
through `MemoryListResponse` since 0.40.0.
|
|
732
|
+
- The kept Hermes OAuth entry of 0.41.3 (python-sdk #287) cannot arise
|
|
733
|
+
here. In Python it arises when the API-key form runs `hermes mcp add`,
|
|
734
|
+
its overwrite prompt is declined, and an `auth: oauth` entry at the
|
|
735
|
+
same URL stays in place. An `--oauth` request already matches that
|
|
736
|
+
entry, so it never stops there. This port's API-key form never runs
|
|
737
|
+
`hermes mcp add`: it prints the entry to put in place of the existing
|
|
738
|
+
one, as Python does under `-y`.
|
|
566
739
|
|
|
567
740
|
**`guardrails load` and `guardrails digest`** (memory-cloud v0.74.0+)
|
|
568
741
|
take the context as an optional argument, else `context_id` from
|
|
@@ -594,6 +767,49 @@ parse; and a failed read or write of the `--out` file reads in Node's
|
|
|
594
767
|
words (`ENOENT: no such file or directory, open '…'`) rather than
|
|
595
768
|
Python's (`[Errno 2] No such file or directory: '…'`).
|
|
596
769
|
|
|
770
|
+
**`doctor`** checks the credentials, the `kagura-memory` entry Claude Code
|
|
771
|
+
uses, the optional `age-encryption` peer and the age identity, then the
|
|
772
|
+
server, whose checks are the Python CLI's: `Server reachable`, then
|
|
773
|
+
`Version: <version>` by the same comparison `checkServerVersion` makes
|
|
774
|
+
([#66](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/66)).
|
|
775
|
+
The version passes at or above `MIN_SERVER_VERSION` (0.75.0), fails below
|
|
776
|
+
it (`Version: 0.74.0 is below minimum 0.75.0`, a pre-release of 0.75.0
|
|
777
|
+
included) and is `info` when it cannot be compared (`main-abc123`, `0.78`).
|
|
778
|
+
An unreachable server fails with `Server unreachable: …`, and an OAuth
|
|
779
|
+
profile the REST route refuses is `info`, in Python's words. The
|
|
780
|
+
`/system/info` body is read through Python's `ServerInfo` model, and one
|
|
781
|
+
it refuses (no `name`, a `version` that is no string) fails as the Python
|
|
782
|
+
CLI 0.42.0 fails it: `Server answered, but the SDK could not read
|
|
783
|
+
/api/v1/system/info: KaguraClient.get_server_info: unexpected server
|
|
784
|
+
response for ServerInfo (…). The server may be newer than this SDK;
|
|
785
|
+
upgrading kagura-memory may help.` Any other error from the probe, such
|
|
786
|
+
as a 429, fails the check with its own message (`Rate limit exceeded (HTTP
|
|
787
|
+
429): …`). A body that is not JSON is still `Server unreachable: Invalid
|
|
788
|
+
response format: …`, in the words of Python's `json` module (`Expecting
|
|
789
|
+
value: line 1 column 1 (char 0)`), since the body is read as `json.loads`
|
|
790
|
+
reads it. A credential
|
|
791
|
+
that does not resolve fails the auth section with Python's
|
|
792
|
+
`Authentication could not be resolved: …` and skips the server check
|
|
793
|
+
(`info`), as in Python. The credential is resolved as a bare client
|
|
794
|
+
resolves it, as in Python: `KAGURA_API_KEY`, then the OAuth profile
|
|
795
|
+
(`--profile NAME`, `KAGURA_PROFILE` or the default; an empty `--profile`
|
|
796
|
+
is the default), then `.kagura.json`. A selected profile that does not
|
|
797
|
+
exist fails the auth section once, with the resolution's message, and
|
|
798
|
+
with `KAGURA_API_KEY` set an expired or missing profile is no failure, as
|
|
799
|
+
in Python, whose warning is that the key shadows the profile. A resolved
|
|
800
|
+
MCP URL that is not HTTPS is a warning and the server is not contacted
|
|
801
|
+
(`Server connectivity check skipped because the MCP URL is insecure`),
|
|
802
|
+
whichever source it came from:
|
|
803
|
+
an OAuth profile's URL, `KAGURA_MCP_URL`, or the `mcp_url` of the
|
|
804
|
+
`.kagura.json` the credential resolved from (exit 0, as in Python). One
|
|
805
|
+
remaining difference: a plain-HTTP `.kagura.json` `mcp_url` that the
|
|
806
|
+
credential does not use, because `KAGURA_API_KEY` or an OAuth profile
|
|
807
|
+
brings its own URL, still fails the `mcp` section here (`mcp_url is not
|
|
808
|
+
HTTPS: …`, exit 1), since `setup claude` would refuse that URL; the
|
|
809
|
+
Python CLI's `doctor` never reads the file's `mcp_url`. `--json`
|
|
810
|
+
prints Python's shape, with `details` on every check (`{}` when there are
|
|
811
|
+
none). Any failed check exits 1.
|
|
812
|
+
|
|
597
813
|
**Sign-in rate limit.** memory-cloud v0.76.0 and later limit device sign-in
|
|
598
814
|
requests per client address. When the server refuses one with HTTP 429,
|
|
599
815
|
`auth login` says so and how many seconds to wait (from the `Retry-After`
|
|
@@ -657,16 +873,19 @@ server left out, and drops any other. A record the model refuses (a
|
|
|
657
873
|
required field missing, a scalar, list or mapping of the wrong type)
|
|
658
874
|
exits 1 with its `KaguraResponseError` text; timestamps are printed as
|
|
659
875
|
the server wrote them. `--role` matches exactly, as
|
|
660
|
-
click's `Choice` does (`Admin` is refused).
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
refused (exit 2) before anything is
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
`invite list` does
|
|
876
|
+
click's `Choice` does (`Admin` is refused). As in the Python CLI (0.41.1+):
|
|
877
|
+
a workspace that is not a UUID is refused before `member remove` or
|
|
878
|
+
`revoke-key` asks, and the question names it in canonical form; each
|
|
879
|
+
`invite create -c` must be a context UUID (exit 2, `Invalid value for
|
|
880
|
+
'--context' / '-c': 'x' is not a valid context UUID.`, before anything
|
|
881
|
+
is read) and is sent in canonical form; a user id of `.`, `..` or
|
|
882
|
+
nothing (`USER_ID` or `--user`) is refused (exit 2) before anything is
|
|
883
|
+
asked or sent; a `context_id` in `.kagura.json` that is not a string
|
|
884
|
+
reads as absent; and an invitation with no email prints `-`, as
|
|
885
|
+
`invite list` does. When more than one of these is wrong, the error
|
|
886
|
+
names them in declaration order (`EMAIL`, `--role`, `-c`,
|
|
887
|
+
`--expires-days`), where click names whichever comes first on the
|
|
888
|
+
command line.
|
|
670
889
|
|
|
671
890
|
**`measure record` and `measure series`** take the context as their
|
|
672
891
|
first argument, never from `.kagura.json`: an observation recorded in the
|
|
@@ -881,11 +1100,19 @@ keyed on the error code and the envelope's fields, never on the message:
|
|
|
881
1100
|
| `KaguraNotFoundError` | missing contexts/memories/reports/agents/bindings (on `updateSearchConfig`, a missing context is a `KaguraPermissionError` instead) | — |
|
|
882
1101
|
| `KaguraFeatureNotAvailableError` | MCP `plan_required` / `feature_not_available`; REST 403 `FEAT-001` — the plan lacks a feature, or it is switched off | `feature`, `requiredPlan`, `requiredPlanDisplay`, `currentPlan`, `gate` |
|
|
883
1102
|
| `KaguraQuotaError` | MCP `quota_exceeded` / `CONNECTOR-001`, and `rate_limit_exceeded`, the daily MCP call cap every non-read-only tool checks (`quotaType` `api_mcp_daily`, `resetsAt` the next UTC midnight); REST `QUOTA-001`, `QUOTA-002` and `CONNECTOR-001` (the resource-token and connector seat caps answer **403**); any other 429 from a REST client but `SecretClient` | `quotaType`, `current`, `limit`, `usedToday`, `resetsAt`, `retryAfter`, and the plan fields above |
|
|
884
|
-
| `KaguraPartialRollbackError` | `rollbackSleepRun` reversed some actions but not all | `reportId`, `summary` |
|
|
885
|
-
| `KaguraResponseError` | a successful response the SDK cannot read, usually because the server is newer than this SDK. 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` |
|
|
1103
|
+
| `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` |
|
|
1104
|
+
| `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` |
|
|
886
1105
|
| `KaguraPermissionError` | MCP `permission_denied` — usually the caller's role is too low. `updateSearchConfig` also sends it for a context that does not exist or that the caller cannot see. Only some tools send a role — `updateSearchConfig`, `updateContext`, `deleteContext`, the file tools and the analysis tools do not — so `requiredRole` is often `null`, and on `updateSearchConfig` it cannot tell a missing context from a role denial | `requiredRole` |
|
|
887
1106
|
| `KaguraError` | any other code | — |
|
|
888
1107
|
|
|
1108
|
+
`ResourceClient`'s readers check each 2xx body against the Python SDK's
|
|
1109
|
+
model, as Python's `_parse` does, and throw `KaguraResponseError` for one
|
|
1110
|
+
it refuses (`ingestEvents` after its `error` progress event). A body the
|
|
1111
|
+
model accepts is returned as it arrived: its extra keys and lax values
|
|
1112
|
+
(`"6"` for an int) are kept, where Python returns the model's coerced
|
|
1113
|
+
copy. `ingestEvents`'s `success` event carries the model's counts, as
|
|
1114
|
+
Python's does (`failed` is `0` when the body has no `failed_count`).
|
|
1115
|
+
|
|
889
1116
|
memory-cloud v0.75.0+ tags every plan and quota refusal with a `gate`
|
|
890
1117
|
(`plan`, `quota`, `allowlist` or `deployment`), and the SDK chooses the
|
|
891
1118
|
class from it first, falling back to the code for older servers. The
|
|
@@ -975,7 +1202,7 @@ the counterpart to `recall`'s probabilistic search.
|
|
|
975
1202
|
|
|
976
1203
|
| Method | What it does |
|
|
977
1204
|
|--------|--------------|
|
|
978
|
-
| `listTags` | Tag vocabulary with counts and recency. `prefix` narrows by spelling; `withTags` is a multi-tag AND drill-down that also excludes those tags from the result — the two compose into server-side faceted browsing with no local index. A drill-down calls the REST tags endpoint, because the MCP tool
|
|
1205
|
+
| `listTags` | Tag vocabulary with counts and recency. `prefix` narrows by spelling; `withTags` is a multi-tag AND drill-down that also excludes those tags from the result — the two compose into server-side faceted browsing with no local index. A drill-down calls the REST tags endpoint on every server, because the MCP tool has `with_tags` only from server v0.77.0 and an older one ignores it; the result has the same shape. Its `context_name` is the one the endpoint sends (server v0.77.0+), else one MCP `list_tags` call names the context, once per client. Its values are trimmed and blank ones dropped, and at most 50 of up to 200 characters each are accepted. |
|
|
979
1206
|
| `explore` | Graph traversal from a seed memory (`depth` 1–5, `minWeight`). |
|
|
980
1207
|
| `listEdges` | Edges touching a memory, incoming and outgoing, deduplicated. |
|
|
981
1208
|
| `createEdge` / `updateEdge` / `deleteEdge` | Manual edge curation. `(sourceId, targetId)` is the identity; self-loops are rejected. |
|
|
@@ -1016,7 +1243,7 @@ Ephemeral, TTL-bounded, and excluded from recall — deliberately not memories.
|
|
|
1016
1243
|
| Method | What it does |
|
|
1017
1244
|
|--------|--------------|
|
|
1018
1245
|
| `getServerInfo` | Version, deployment feature flags, and (v0.69.0+) the reranker defaults new contexts start with, under `search_defaults`. |
|
|
1019
|
-
| `checkServerVersion` | Compare against `MIN_SERVER_VERSION` (0.75.0). Advisory: logs, never throws
|
|
1246
|
+
| `checkServerVersion` | Compare against `MIN_SERVER_VERSION` (0.75.0). Advisory: logs, and never throws on an old version; a body that is not a `ServerInfo` throws `KaguraResponseError`, as in `getServerInfo`. Reads the version as the Python SDK does: `v0.75.0`, `0.75.0+build` and `0.75.0.post1` meet it, a pre-release of it (`0.75.0-rc1`, `0.75.0rc1`, `0.75.0.dev1`) does not, and a version it cannot read (`0.75`, `main-abc123`) is not compared. |
|
|
1020
1247
|
| `getUsage` | Workspace quota and usage: `used` / `limit` for memories, contexts, members and today's MCP calls. |
|
|
1021
1248
|
| `getMemoryStats` | Per-memory usage stats, sortable and paged. |
|
|
1022
1249
|
| `getEmbeddingStatus` / `listEmbeddingModels` | Embedding backend state and the models available for `createContext`. |
|
|
@@ -1197,12 +1424,36 @@ a 409 dedup hit), or an `error` with how far it got,
|
|
|
1197
1424
|
after all, so check before uploading again. A batch reports
|
|
1198
1425
|
`ingest_events`, then `{ created, failed }` or
|
|
1199
1426
|
`{ events_attempted, resource_id }`. A 2xx answer neither call can read (a
|
|
1200
|
-
batch answered with `null
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
`
|
|
1427
|
+
batch answered with `null`; a reserve, a confirm or a 409's existing file
|
|
1428
|
+
that the Python SDK's `FileReserveResponse` / `FileObject` model refuses,
|
|
1429
|
+
such as a confirm with no `created_at`) ends the stream with that `error`
|
|
1430
|
+
and throws a `KaguraResponseError` in the Python SDK's words, a reserve
|
|
1431
|
+
before the PUT; such a confirm is not `confirmed`. A reserve whose
|
|
1432
|
+
`file_id` is `.`, `..` or empty ends it the same way, before the PUT, with
|
|
1433
|
+
this SDK's own message (`file_id must be a file id, got "..": …`); the
|
|
1434
|
+
Python SDK accepts it and confirms at another route. `list` and
|
|
1435
|
+
`downloadUrl` read their body through the Python SDK's model too
|
|
1436
|
+
(`FileObject` for each item of a bare list, else `FileListResponse`;
|
|
1437
|
+
`FileDownloadUrlResponse`), and throw the same error for one it refuses. Every `FilesClient` method refuses a
|
|
1438
|
+
`contextId` that is not a UUID in the Python SDK's words (`context_id must
|
|
1439
|
+
be a UUID; got '…'`), and sends a `{braced}`, `urn:uuid:` or dashless one
|
|
1440
|
+
in its canonical form.
|
|
1441
|
+
|
|
1442
|
+
Every id a client puts in a URL path (a `FilesClient` file id, a
|
|
1443
|
+
`ResourceClient` resource id, `KaguraClient`'s context id for memory
|
|
1444
|
+
stats, duplicates and the tags drill-down, a `WorkspaceClient` user id, a
|
|
1445
|
+
`SecretClient` pubkey id) is percent-encoded as one segment, and an id
|
|
1446
|
+
that is `.`, `..` or empty throws before anything is sent
|
|
1447
|
+
(`fileId must be a file id, got "..": as a URL path segment it would
|
|
1448
|
+
address a different endpoint`): encoding leaves those as they are, and
|
|
1449
|
+
URL resolution would send the request elsewhere. The Python SDK sends
|
|
1450
|
+
them as typed, but for a workspace user id, which it refuses too from
|
|
1451
|
+
0.41.1
|
|
1452
|
+
([#66](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/66)).
|
|
1453
|
+
`createInvitation` refuses an `allowedContextIds` entry that is not a
|
|
1454
|
+
UUID before sending anything (`allowedContextIds must be a UUID, got
|
|
1455
|
+
'ctx-1'`), and sends each in canonical form, as the Python SDK does from
|
|
1456
|
+
0.41.1; it and every workspace id take the spellings `uuid.UUID` takes.
|
|
1206
1457
|
|
|
1207
1458
|
## Zero-knowledge secrets
|
|
1208
1459
|
|
|
@@ -1310,6 +1561,9 @@ CLI as `kagura-memory`: 20 of the 21 top-level commands, counting the
|
|
|
1310
1561
|
`contexts` alias. Only `kagura ingest` is not ported (below);
|
|
1311
1562
|
[Command line](#command-line) lists where the two CLIs still differ.
|
|
1312
1563
|
|
|
1564
|
+
The parity target is the Python SDK and CLI **0.42.0**, checked against
|
|
1565
|
+
memory-cloud up to **v0.77.0**.
|
|
1566
|
+
|
|
1313
1567
|
One thing is deliberately not ported, because it would cost the
|
|
1314
1568
|
zero-dependency promise:
|
|
1315
1569
|
|
|
@@ -1329,6 +1583,76 @@ the two. See
|
|
|
1329
1583
|
[`docs/design/2026-07-05-typescript-port-design.md`](docs/design/2026-07-05-typescript-port-design.md)
|
|
1330
1584
|
for the original scope decisions.
|
|
1331
1585
|
|
|
1586
|
+
**Reading responses.** The SDK reads each field of a response as the
|
|
1587
|
+
Python SDK's pydantic model reads it in lax mode, with pydantic's
|
|
1588
|
+
messages ([#66](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/66),
|
|
1589
|
+
[#69](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/69)):
|
|
1590
|
+
an int field takes `"0-1"` (-1) and `"0__7"` and refuses a digit run past
|
|
1591
|
+
4,300 characters, a float field follows pydantic's `str_as_float` rather
|
|
1592
|
+
than Python's `float()`, and a string holding a lone surrogate is refused
|
|
1593
|
+
in any field but a `str`. Three limits of JavaScript numbers remain. An
|
|
1594
|
+
int field of a typed result (`recallSeries`' `count`, the guardrail caps,
|
|
1595
|
+
a member key's or invitation's `id`) holds a `number`, so a value past
|
|
1596
|
+
2^53 is the nearest double and one of 2^1024 or more (309 digits) is
|
|
1597
|
+
`Infinity`, where Python keeps the exact int; widening those types would
|
|
1598
|
+
break callers. The other two hold only where a body is read with
|
|
1599
|
+
`JSON.parse`, which cannot tell `1e20` from `100000000000000000000` or
|
|
1600
|
+
`9223372036854775807` from 2^63: the text of an MCP tool result
|
|
1601
|
+
(`recallSeries`' `count`, a bucket's `count`,
|
|
1602
|
+
`ResourceClient.setupResource`'s `token_id`). Every REST reader
|
|
1603
|
+
(`ResourceClient`, `FilesClient`, `MemoryClient`, `WorkspaceClient`,
|
|
1604
|
+
`KaguraClient`'s REST methods, so the `resource` and `files` dumps too)
|
|
1605
|
+
keeps the literal and agrees with pydantic. In a tool result, an int
|
|
1606
|
+
field sent a whole float literal of 2^63 or more (`1e20`,
|
|
1607
|
+
`9223372036854775808.0`) reads it as that double, where pydantic refuses
|
|
1608
|
+
it with `Unable to parse input string as an integer, exceeded maximum
|
|
1609
|
+
size` and accepts the int literal exactly. And a bool field sent the JSON number
|
|
1610
|
+
9223372036854775807 or -9223372036854775808 would read it as the double
|
|
1611
|
+
+/-2^63 and say `Input should be a valid boolean`, where pydantic says
|
|
1612
|
+
`…, unable to interpret input`; no MCP tool result has a bool field
|
|
1613
|
+
today, so this is the coercer's limit rather than any field's.
|
|
1614
|
+
|
|
1615
|
+
**The MCP envelope.** A JSON-RPC or tool error is rendered as the Python
|
|
1616
|
+
SDK renders it, with Python's `str()` of whatever the server sent
|
|
1617
|
+
(`MCP error: {'code': -32603}`, `t failed (None): …`), and a `null`
|
|
1618
|
+
JSON-RPC body reads as no result. Three differences remain. A JSON-RPC
|
|
1619
|
+
`error` that is no object (`{"error": "boom"}`, `null`, `[1]`) reads
|
|
1620
|
+
`MCP error: boom` (`None`, `[1]`), where the Python SDK stops with an
|
|
1621
|
+
`AttributeError`; likewise a JSON-RPC body that is no object (`5`, `"x"`,
|
|
1622
|
+
`[1]`, an empty body) and a `result` that is no object read as no result
|
|
1623
|
+
(`{}`), where the Python SDK stops with a `TypeError`, an
|
|
1624
|
+
`AttributeError` or a raw `JSONDecodeError`: Python has no words to port
|
|
1625
|
+
there. A number literal in a code or message is rendered from the
|
|
1626
|
+
JavaScript number (`1.0` reads `1`, `1e2` `100`, `-0.0` `0`, an int past
|
|
1627
|
+
2^53 its nearest double) and an object's integer-like keys print first,
|
|
1628
|
+
where Python prints the literal and keeps the key order: the JSON-RPC
|
|
1629
|
+
body and the tool text are read with `JSON.parse`. And
|
|
1630
|
+
`KaguraPartialRollbackError.summary` is the `rollback_summary` as it
|
|
1631
|
+
arrived, once checked against Python's `RollbackSummary` (an
|
|
1632
|
+
`edges_deleted` of `"6"` stays the string, an unknown key stays), where
|
|
1633
|
+
Python's model holds `6` and drops the key; `rollbackSleepRun`'s success
|
|
1634
|
+
result is returned the same way.
|
|
1635
|
+
|
|
1636
|
+
**Hand-edited credentials.** A profile in `~/.kagura/credentials.json`
|
|
1637
|
+
whose `access_token` is no string, or whose `refresh_token` is `null`, is
|
|
1638
|
+
read as the Python SDK reads it: the token is sent as Python's `str()` of
|
|
1639
|
+
it (`Bearer 123`) and a falsy refresh token means none. The file is read
|
|
1640
|
+
as Python's `json.loads` reads it, so a number literal in a token is
|
|
1641
|
+
rendered as Python renders it (`1.0` sends `Bearer 1.0`, `1e16` `Bearer
|
|
1642
|
+
1e+16`, an int past 2^53 exactly, `NaN` `Bearer nan`, which is also a
|
|
1643
|
+
truthy refresh token) and an object token keeps its key order. When this
|
|
1644
|
+
SDK rewrites the file (a refresh, `auth
|
|
1645
|
+
use`), it writes those two tokens as strings (`"123"`, `""`) where Python
|
|
1646
|
+
writes them back as they were; both SDKs read either form the same way,
|
|
1647
|
+
so after a rewrite of a number token Python sends the rendered string too.
|
|
1648
|
+
Two more differences are on the Python side of such a file: the Python
|
|
1649
|
+
CLI's own `auth status` stops with a `TypeError` on a number token (its
|
|
1650
|
+
`_redact_token` takes the token's `len`), where `kagura-memory auth
|
|
1651
|
+
status` prints the profile; and `auth token` on a profile whose
|
|
1652
|
+
`access_token` is `null` prints an empty line there (`click.echo(None)`)
|
|
1653
|
+
and `None` here, the token being rendered when the file is read, while
|
|
1654
|
+
the header is `Bearer None` in both.
|
|
1655
|
+
|
|
1332
1656
|
## Development
|
|
1333
1657
|
|
|
1334
1658
|
```bash
|