kagura-memory 0.15.0 → 0.17.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
@@ -29,13 +29,13 @@ package also includes `kagura-memory-mcp`, a transparent stdio/HTTP proxy.
29
29
  npm install kagura-memory
30
30
  ```
31
31
 
32
- Requires Node.js >= 20.19.0 (Node 18 support ended with 0.14.x). Zero
32
+ Requires Node.js >= 22.12.0 (this runtime migration drops Node 20). Zero
33
33
  runtime dependencies — 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
37
  Targets memory-cloud **v0.75.0** (`MIN_SERVER_VERSION`) and is checked
38
- against memory-cloud up to **v0.143.0**; the Python SDK 0.44.0, its
38
+ against memory-cloud up to **v0.144.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
@@ -1299,29 +1299,35 @@ kagura-ai/memory-cloud#1686): of two processes presenting the same one, the
1299
1299
  second gets `invalid_grant`. So every refresh — `KaguraOAuth` in a client or
1300
1300
  in `kagura-memory-mcp`, `refresh()`, and the CLI's `auth refresh` and
1301
1301
  `auth token` — takes the lock on `credentials.json` (a sibling
1302
- `credentials.json.lock`), re-reads the profile, and when another process
1302
+ `credentials.json.lock-v1`), re-reads the profile, and when another process
1303
1303
  already rotated it to a token that has not expired, uses that profile and
1304
1304
  sends nothing; otherwise it refreshes from the refresh token on file and
1305
1305
  saves the result before it releases the lock. (Python 0.44.0 also adopts a
1306
1306
  different token that has expired; this SDK refreshes it instead.) The
1307
1307
  device flow a widening `--scope` falls back to runs after the lock is
1308
- released, since it waits on the user. The Python SDK
1309
- locks the same `credentials.json.lock` with an OS lock, which Node does not
1310
- have, so the two SDKs' locks do not exclude each other: between them only
1311
- the re-read applies. This is client-side and works against every server. As
1308
+ released, since it waits on the user. Python 0.44.0 and older TypeScript
1309
+ clients use incompatible locks: do not run them concurrently against the same
1310
+ credentials file. An existing legacy `.lock` is refused, never deleted by this
1311
+ SDK. Lock-v1 is never broken by age. See the
1312
+ [migration and crash-recovery instructions](docs/compatibility.md#credential-concurrency-and-auth-token-112)
1313
+ and [Python counterpart](https://github.com/kagura-ai/kagura-memory-python-sdk/issues/327).
1314
+ Logout records revocation so a queued refresh cannot recreate credentials;
1315
+ `deleteCredentialsFile()` must now be awaited. This is client-side and works
1316
+ against every server. As
1312
1317
  in Python SDK 0.44.0 (kagura-ai/kagura-memory-python-sdk#313):
1313
1318
 
1314
1319
  - `auth refresh` says `✓ Profile 'NAME' was already refreshed by another
1315
1320
  process.` when it found the profile rotated under the lock, and `✓
1316
1321
  Refreshed profile 'NAME'.` after a refresh of its own, each followed by
1317
1322
  the `Scope:` and `Expires:` lines; both exit 0. `auth token` prints the
1318
- token another process refreshed.
1323
+ token another process refreshed. It refreshes within five minutes of expiry
1324
+ and writes an expiry warning to stderr, leaving the token alone on stdout.
1319
1325
  - A `credentials.json` that exists but cannot be read or parsed is refused
1320
1326
  before any refresh request or write, and left as it is: `KaguraAuthError`
1321
1327
  `Cannot update <path>: it is not valid JSON.` (or why else it cannot be
1322
1328
  read), with `Fix the file, or move it aside and run: kagura-memory auth
1323
1329
  login`. This holds for a refresh (checked under the lock), the save at
1324
- the end of `login()`, `updateProfile`, `setDefaultProfile` and
1330
+ the beginning and end of `login()`, `updateProfile`, `setDefaultProfile` and
1325
1331
  `deleteProfile`; `kagura-memory-mcp` refuses it at startup and before any
1326
1332
  login. "Exists" includes a dangling symlink, and a file in a directory
1327
1333
  this process cannot search. A missing file is still "no profile".
@@ -1892,6 +1898,31 @@ them, and `warn: () => {}` silences them.
1892
1898
  Agent Registry and binding methods are covered in
1893
1899
  [Agent control plane](#agent-control-plane-memory-cloud-v0490) below.
1894
1900
 
1901
+ ### Workspace member context access (memory-cloud v0.144.0+)
1902
+
1903
+ Use a workspace owner's API key with `WorkspaceClient`. A workspace-bound key
1904
+ can manage only its own workspace. The server rejects OAuth on these routes.
1905
+
1906
+ ```ts
1907
+ await client.addMember(workspaceId, userId, { role: "viewer", allowedContextIds: [] });
1908
+ const { contexts } = await client.getMemberContextAccess(workspaceId, userId);
1909
+ await client.setMemberContextAccess(workspaceId, userId, [contextId]);
1910
+ ```
1911
+
1912
+ Omitting the list on add uses the server default. Passing `null` to the setter
1913
+ restores role defaults, and `[]` grants a member or viewer no shared contexts.
1914
+ Owners and admins retain access to shared contexts. Creators and their linked
1915
+ accounts retain access to their own private contexts regardless of this list. Each assignable context
1916
+ includes `is_own_private`. The existing positional role argument still works.
1917
+
1918
+ For context roles, create a session client with
1919
+ `new WorkspaceClient({ baseUrl, session: true, fetch: sessionFetch })`.
1920
+ On Node the supplied fetch must carry the signed-in user's session and CSRF
1921
+ credentials. Call `addContextMember(contextId, userId, "editor")` on that client. A context outside the member's list raises
1922
+ `KaguraContextNotInAccessListError` with `details.reason` equal to
1923
+ `context_not_in_access_list`. A workspace owner or admin may explicitly retry
1924
+ with `extendAccessList: true`. The response reports `access_list_extended`.
1925
+
1895
1926
  ### Permission model (memory-cloud v0.126.0+)
1896
1927
 
1897
1928
  The server decides who reaches which context, the same way on every MCP
@@ -2192,7 +2223,7 @@ one of those without the package and you get a `KaguraCryptoError` naming
2192
2223
  the install command, not a module-resolution stack trace.
2193
2224
 
2194
2225
  > **Node version.** `age-encryption`'s `@noble/*` dependencies declare
2195
- > `engines.node: ">= 20.19.0"`, the same floor as this SDK, so the install
2226
+ > `engines.node: ">= 20.19.0"`, below this SDK's 22.12.0 floor, so the install
2196
2227
  > is clean on every supported Node, `engine-strict=true` included.
2197
2228
  > Encryption and keygen take their randomness from the `globalThis.crypto`
2198
2229
  > WebCrypto global, which Node has provided since 19; the SDK no longer
@@ -2237,7 +2268,7 @@ CLI as `kagura-memory`: 23 of the 24 top-level commands of the Python CLI
2237
2268
  differ.
2238
2269
 
2239
2270
  The parity target is the Python SDK and CLI **0.44.0**, checked against
2240
- memory-cloud up to **v0.143.0**.
2271
+ memory-cloud up to **v0.144.0**.
2241
2272
 
2242
2273
  **SDK ↔ memory-cloud compatibility.**
2243
2274
  [`docs/compatibility.md`](docs/compatibility.md) records, for each release