kagura-memory 0.12.0 → 0.13.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 CHANGED
@@ -187,7 +187,31 @@ the server's `setup_resource` has no summary: the context's owner sets it
187
187
  afterwards with `kagura-memory context update <context_id> --summary …`.
188
188
  As in Python, `resource tokens revoke` prints `Token revoked.`, and
189
189
  `resource schema` prints `No schema registered for this resource.` when
190
- there is none.
190
+ there is none (the route's 404).
191
+
192
+ **Records print as the Python CLI prints them.** `resource tokens
193
+ list|create|update`, `resource list|stats|indexer-status|events|schema`,
194
+ `resource ingest|ingest-batch|setup`, `files list` and `files upload`
195
+ print the result as the Python CLI does, `model_dump_json(indent=2)` of
196
+ the Python SDK's model
197
+ ([#66](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/66)):
198
+ the model's keys in its order, its default for a key the server left out
199
+ (`null`, `false`, `0`, `[]`, `{}`, `"success"`), and no key it does not
200
+ have. Each value is what the model's type makes of it: `"12"` for an int
201
+ prints `12`, a float prints as one (`1.0`, `1e-6`), a resource event's id
202
+ past 2^53 prints exactly, and a timestamp prints in pydantic's form
203
+ (`2026-06-01T09:00:00.5+00:00` as `2026-06-01T09:00:00.500000Z`), which
204
+ is the form memory-cloud already sends. A record the model refuses (a
205
+ required field missing, a value of the wrong type) exits 1 with the
206
+ Python SDK's `KaguraResponseError` text, e.g. `ResourceClient.list_tokens:
207
+ unexpected server response for PaginatedResourceTokensResponse
208
+ (tokens.0.created_at: Field required). …`, and so does a body that is no
209
+ record at all (`null`). An untyped mapping nested past pydantic's limit
210
+ (256 containers) exits 1 with pydantic's `Error serializing to JSON:
211
+ ValueError: Circular reference detected (depth exceeded)`. One limit
212
+ remains: inside an untyped mapping (an event's `payload`, a batch's
213
+ `errors`) a number is read as JavaScript reads it, so `1.0` prints `1`
214
+ and an integer past 2^53 loses its last digits.
191
215
 
192
216
  **Files and imports.** The `files` commands take their workspace from the
193
217
  credential's own source, as the Python CLI does (its #115): `-c` when
@@ -196,7 +220,8 @@ given, else the OAuth profile's workspace, else the `context_id` of the
196
220
  `files delete` prints `Deleted <file_id>` and `files download-url` the bare
197
221
  URL. `files upload --remember` writes the memory the Python CLI writes
198
222
  (`source_uri` the file's `file://` URI, `details` the file's id, sha256,
199
- size and type). `resource import` detects the format by the file's
223
+ size and type), and prints `{"file": …, "memory": …}`, the file as its
224
+ model reads it. `resource import` detects the format by the file's
200
225
  extension, so stdin needs `--format`, and reads CSV and JSON the way
201
226
  Python's `csv` and `json` modules read them, with their error messages
202
227
  (exit 1). A row keeps its keys in the order read, and a doc_id taken from
@@ -563,6 +588,18 @@ would accept.
563
588
  - `guardrails digest --out ''` is a usage error (exit 2). Click takes the
564
589
  empty path as the current directory, and the Python CLI then fails to
565
590
  write to it (exit 1).
591
+ - An id the command puts in a URL path, `FILE_ID` (`files delete`, `files
592
+ download-url`), the resource id (`-r/--resource-id` of `resource stats`,
593
+ `indexer-status`, `schema`, `ingest`, `ingest-batch` and `import`, and
594
+ `resource events RESOURCE_ID`) and `USER_ID` / `--user`, is refused when
595
+ it is `.`, `..` or empty (exit 2, `Invalid value for 'FILE_ID': '..' is
596
+ not a valid file id.`), before anything is read or sent. The Python CLI
597
+ sends it, and URL resolution then drops or climbs the segment: `files
598
+ download-url ..` asks for `/api/v1/download-url`. (From 0.41.1 it
599
+ refuses a `USER_ID` as this bin does.) Any other id is sent
600
+ percent-encoded as one segment, so a `/`, `?` or `#` in it stays in the
601
+ id rather than reaching another route or replacing the query
602
+ (`files delete 'x?workspace_id=…'`).
566
603
 
567
604
  **`guardrails load` and `guardrails digest`** (memory-cloud v0.74.0+)
568
605
  take the context as an optional argument, else `context_id` from
@@ -594,6 +631,28 @@ parse; and a failed read or write of the `--out` file reads in Node's
594
631
  words (`ENOENT: no such file or directory, open '…'`) rather than
595
632
  Python's (`[Errno 2] No such file or directory: '…'`).
596
633
 
634
+ **`doctor`** checks the credentials, the `kagura-memory` entry Claude Code
635
+ uses, the optional `age-encryption` peer and the age identity, then the
636
+ server, whose checks are the Python CLI's: `Server reachable`, then
637
+ `Version: <version>` by the same comparison `checkServerVersion` makes
638
+ ([#66](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/66)).
639
+ The version passes at or above `MIN_SERVER_VERSION` (0.75.0), fails below
640
+ it (`Version: 0.74.0 is below minimum 0.75.0`, a pre-release of 0.75.0
641
+ included) and is `info` when it cannot be compared (`main-abc123`, `0.78`).
642
+ An unreachable server fails with `Server unreachable: …`, and an OAuth
643
+ profile the REST route refuses is `info`, in Python's words. The
644
+ `/system/info` body is read through Python's `ServerInfo` model, and one
645
+ it refuses (no `name`, a `version` that is no string) fails as
646
+ unreachable: `Server unreachable: Invalid response format: …`, naming the
647
+ problem in the SDK's words where Python prints pydantic's. A credential
648
+ that does not resolve fails the auth section with Python's
649
+ `Authentication could not be resolved: …` and skips the server check
650
+ (`info`), as in Python. With
651
+ `--profile NAME` the server is checked with that profile, as in Python
652
+ (`KAGURA_API_KEY` still comes first), not with the default. `--json`
653
+ prints Python's shape, with `details` on every check (`{}` when there are
654
+ none). Any failed check exits 1.
655
+
597
656
  **Sign-in rate limit.** memory-cloud v0.76.0 and later limit device sign-in
598
657
  requests per client address. When the server refuses one with HTTP 429,
599
658
  `auth login` says so and how many seconds to wait (from the `Retry-After`
@@ -662,10 +721,10 @@ Python CLI, each on purpose: a workspace that is not a UUID is refused
662
721
  before `member remove` or `revoke-key` asks, where Python asks first;
663
722
  each `invite create -c` must be a context UUID (exit 1, `context_id must
664
723
  be a UUID, got '…'`), where Python sends it as typed and the server
665
- answers `HTTP 500`; a user id of `.` or `..` (`USER_ID` or `--user`) is
666
- refused (exit 2) before anything is asked or sent, where Python sends it
667
- and URL resolution turns `member remove ..` into a `DELETE` of the
668
- workspace's own URL; and an invitation with no email prints `-`, as
724
+ answers `HTTP 500`; a user id of `.`, `..` or nothing (`USER_ID` or
725
+ `--user`) is refused (exit 2) before anything is asked or sent, where
726
+ Python sends it and URL resolution turns `member remove ..` into a
727
+ `DELETE` of the workspace's own URL; and an invitation with no email prints `-`, as
669
728
  `invite list` does, where Python prints `None`.
670
729
 
671
730
  **`measure record` and `measure series`** take the context as their
@@ -1197,12 +1256,32 @@ a 409 dedup hit), or an `error` with how far it got,
1197
1256
  after all, so check before uploading again. A batch reports
1198
1257
  `ingest_events`, then `{ created, failed }` or
1199
1258
  `{ events_attempted, resource_id }`. A 2xx answer neither call can read (a
1200
- batch answered with `null`, a confirm with no file `id`) ends the stream
1201
- with that `error` and throws a `KaguraResponseError` in the Python SDK's
1202
- words; such a confirm is not `confirmed`. Every `FilesClient` method
1203
- refuses a `contextId` that is not a UUID in the Python SDK's words
1204
- (`context_id must be a UUID; got '…'`), and sends a `{braced}`,
1205
- `urn:uuid:` or dashless one in its canonical form.
1259
+ batch answered with `null`; a reserve, a confirm or a 409's existing file
1260
+ that the Python SDK's `FileReserveResponse` / `FileObject` model refuses,
1261
+ such as a confirm with no `created_at`) ends the stream with that `error`
1262
+ and throws a `KaguraResponseError` in the Python SDK's words, a reserve
1263
+ before the PUT; such a confirm is not `confirmed`. A reserve whose
1264
+ `file_id` is `.`, `..` or empty ends it the same way, before the PUT, with
1265
+ this SDK's own message (`file_id must be a file id, got "..": …`); the
1266
+ Python SDK accepts it and confirms at another route. `list` and
1267
+ `downloadUrl` read their body through the Python SDK's model too
1268
+ (`FileObject` for each item of a bare list, else `FileListResponse`;
1269
+ `FileDownloadUrlResponse`), and throw the same error for one it refuses. Every `FilesClient` method refuses a
1270
+ `contextId` that is not a UUID in the Python SDK's words (`context_id must
1271
+ be a UUID; got '…'`), and sends a `{braced}`, `urn:uuid:` or dashless one
1272
+ in its canonical form.
1273
+
1274
+ Every id a client puts in a URL path (a `FilesClient` file id, a
1275
+ `ResourceClient` resource id, `KaguraClient`'s context id for memory
1276
+ stats, duplicates and the tags drill-down, a `WorkspaceClient` user id, a
1277
+ `SecretClient` pubkey id) is percent-encoded as one segment, and an id
1278
+ that is `.`, `..` or empty throws before anything is sent
1279
+ (`fileId must be a file id, got "..": as a URL path segment it would
1280
+ address a different endpoint`): encoding leaves those as they are, and
1281
+ URL resolution would send the request elsewhere. The Python SDK sends
1282
+ them as typed, but for a workspace user id, which it refuses too from
1283
+ 0.41.1
1284
+ ([#66](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/66)).
1206
1285
 
1207
1286
  ## Zero-knowledge secrets
1208
1287