kagura-memory 0.19.0 → 0.19.1

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
@@ -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.161.0**; the Python SDK 0.44.0, its
38
+ against memory-cloud up to **v0.170.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
@@ -1548,7 +1548,10 @@ is non-null. With no `gate`, a `null` `requiredPlan` means the plan is
1548
1548
  unknown, not that no plan lifts it. That covers an older server, and
1549
1549
  `createContext`'s own context-limit check, which reads a one-row
1550
1550
  `listContexts({ limit: 1 })` page and so fills in only `quotaType`,
1551
- `current` and `limit`.
1551
+ `current` and `limit`. When the workspace is full but `count` is below
1552
+ `limit`, `current` is `null`. From memory-cloud v0.170.0 a numeric `current`
1553
+ from the pre-check can be a lower bound because `count` includes only visible
1554
+ contexts.
1552
1555
 
1553
1556
  `retryAfter` is the `Retry-After` header, else the retry hint in the body
1554
1557
  (REST `details.retry_after`, MCP `retry_after_seconds`, which is all the
@@ -1946,8 +1949,8 @@ the counterpart to `recall`'s probabilistic search.
1946
1949
 
1947
1950
  | Method | What it does |
1948
1951
  |--------|--------------|
1949
- | `listContexts` | The contexts you can see, most recently used first, as a slim name→id directory (`id`, `name`, `is_private`, `is_locked`, `last_used_at`; server v0.73.0+). `nameContains` filters (server v0.73.0+; older servers ignore it and return every context); `includeSummary` (capped at 300 chars), `includeDetails` (full `summary` + `embedding_model`) and `includeStats` (`memory_count`) add fields. `count` is quota usage and `total` the number returned; `can_create` is the quota flag, and `hint` appears when you can see no context. From v0.82.0 the directory is paged — 100 contexts a page, 20 with `includeDetails` and no `nameContains` — with `has_more` / `next_cursor`: pass `next_cursor` back as `cursor` for the next page, with the same `nameContains`. `limit` sets the page size, 1-200; more than 20 with `includeDetails` and no non-blank `nameContains` throws before any request, as the server would refuse it. Servers before v0.82.0 ignore `limit` and `cursor` and return every context. `nameContains` is sent trimmed, and not at all when blank. There is no `maxChars`: the page's 20,000-character budget is fixed, and a v0.82.0+ server refuses an argument `list_contexts` does not declare. The envelope's `limit` is the plan's context maximum, not the page size. |
1950
- | `createContext` | New context. Throws `KaguraQuotaError` when the workspace limit is reached: the SDK checks a one-row `listContexts({ limit: 1 })` page first, so that error carries `quotaType`, `current` and `limit` but no `gate` or plan fields (`requiredPlan` `null` means unknown). Also throws `KaguraFeatureNotAvailableError` for a shared one (`isPrivate: false`) on a plan without shared contexts (server v0.75.0+). `embeddingModel` cannot be changed through the API afterwards (an operator can migrate it server-side, v0.66.0+). `resourceId` is deprecated and no longer sent, since the server ignores it: set it with `updateContext`, or use `setupResource`. |
1952
+ | `listContexts` | The contexts you can see, most recently used first, as a slim name→id directory (`id`, `name`, `is_private`, `is_locked`, `last_used_at`; server v0.73.0+). `nameContains` filters (server v0.73.0+; older servers ignore it and return every context); `includeSummary` (capped at 300 chars), `includeDetails` (full `summary` + `embedding_model`) and `includeStats` (`memory_count`) add fields. From v0.169.0 the connection selects the workspace by scoped API key, MCP URL, then current workspace. From v0.170.0 `count` is the visible count before filtering, and older servers report quota usage. `total` is the page size. `can_create` and the response `limit` describe workspace-wide capacity. `hint` can explain an empty directory or a full workspace with hidden contexts. From v0.82.0 the directory is paged — 100 contexts a page, 20 with `includeDetails` and no `nameContains` — with `has_more` / `next_cursor`: pass `next_cursor` back as `cursor` for the next page, with the same `nameContains`. `limit` sets the page size, 1-200; more than 20 with `includeDetails` and no non-blank `nameContains` throws before any request, as the server would refuse it. Servers before v0.82.0 ignore `limit` and `cursor` and return every context. `nameContains` is sent trimmed, and not at all when blank. There is no `maxChars`: the page's 20,000-character budget is fixed, and a v0.82.0+ server refuses an argument `list_contexts` does not declare. The envelope's `limit` is the plan's context maximum, not the page size. |
1953
+ | `createContext` | New context. Throws `KaguraQuotaError` when the workspace limit is reached. The SDK checks `can_create` from a one-row `listContexts({ limit: 1 })` page first. When `count` is below the workspace limit, the pre-check error reports the limit and sets `current` to `null`. Its `gate` and plan fields are `null`. Also throws `KaguraFeatureNotAvailableError` for a shared one (`isPrivate: false`) on a plan without shared contexts (server v0.75.0+). `embeddingModel` cannot be changed through the API afterwards (an operator can migrate it server-side, v0.66.0+). `resourceId` is deprecated and no longer sent, since the server ignores it: set it with `updateContext`, or use `setupResource`. |
1951
1954
  | `getContextInfo` | Metadata plus, by default, a memory-count breakdown. On server v0.74.0+ also a trimmed `guardrails` block: absent when the MCP URL carries `?guardrails=off`, `null` when the server's read failed; its `provenance` (v0.79.0+) labels the items as notes context editors stored, not operator instructions. `search_config` carries `llm_selector_enabled` / `llm_selector_effective` (v0.115.0+). |
1952
1955
  | `updateContext` | Change display name, summary, usage guide, visibility, lock. `isPublic: true` is plan-gated and throws `KaguraFeatureNotAvailableError` on a plan without public contexts. |
1953
1956
  | `deleteContext` | Delete by id. Locked contexts are refused. |
@@ -2520,7 +2523,7 @@ CLI as `kagura-memory`: 23 of the 24 top-level commands of the Python CLI
2520
2523
  differ.
2521
2524
 
2522
2525
  The parity target is the Python SDK and CLI **0.44.0**, checked against
2523
- memory-cloud up to **v0.161.0**.
2526
+ memory-cloud up to **v0.170.0**.
2524
2527
 
2525
2528
  **SDK ↔ memory-cloud compatibility.**
2526
2529
  [`docs/compatibility.md`](docs/compatibility.md) records, for each release
package/dist/cli.js CHANGED
@@ -958,7 +958,7 @@ function isCanonicalUuid(value) {
958
958
  }
959
959
 
960
960
  // src/version.ts
961
- var SDK_VERSION = "0.19.0";
961
+ var SDK_VERSION = "0.19.1";
962
962
 
963
963
  // src/http.ts
964
964
  function baseUrlFromMcp(mcpUrl) {
@@ -7089,9 +7089,13 @@ var KaguraClient = class _KaguraClient {
7089
7089
  * workspace with `listContexts({ nameContains, includeDetails: true })`,
7090
7090
  * or read one context in full with {@link getContextInfo}.
7091
7091
  *
7092
- * `count` is workspace quota usage, not the number returned — that is
7093
- * `total`. When the caller can see no context at all, `hint` says how
7094
- * to create one or get access.
7092
+ * From memory-cloud v0.169.0 the workspace comes from the workspace-scoped
7093
+ * API key, the workspace in the MCP URL, or the user's current workspace,
7094
+ * in that order. `count` is the number of visible contexts before filtering
7095
+ * from v0.170.0 onward, and workspace quota usage on earlier servers.
7096
+ * `total` is this page's size. `can_create` and the response `limit` are
7097
+ * workspace-wide. `hint` can explain an empty directory or a full workspace
7098
+ * with fewer visible contexts than its limit.
7095
7099
  *
7096
7100
  * Since server v0.82.0 (memory-cloud#1743) the directory is paged: 100
7097
7101
  * contexts a page by default (20 with `includeDetails` and no
@@ -7542,18 +7546,19 @@ var KaguraClient = class _KaguraClient {
7542
7546
  return this.callToolChecked("forget", args);
7543
7547
  }
7544
7548
  /**
7545
- * Create a new context in the current workspace.
7549
+ * Create a new context in the workspace selected by the MCP connection.
7546
7550
  *
7547
7551
  * Checks the workspace's context limit first, with a one-row
7548
7552
  * {@link listContexts} page, and throws without calling `create_context`
7549
7553
  * when `can_create` is false — unless `limit` is 0, which is how the server reports that it could
7550
7554
  * not read the quota; `create_context` then decides.
7551
- * That error comes from the SDK, not the server: it carries
7552
- * `quotaType: "contexts"` with `current` / `limit`, but `gate` and the
7553
- * plan fields stay `null` because `list_contexts` does not send them. A
7554
- * `null` `requiredPlan` there means the plan is unknown, not that no plan
7555
- * lifts the cap. The server's own refusal, which names the plan that
7556
- * lifts it, only arrives when a concurrent create gets past the check.
7555
+ * The SDK pre-check error carries `quotaType: "contexts"` with
7556
+ * `current` / `limit`. When `can_create` is
7557
+ * false and `count` is below `limit`, `current` is `null`. On v0.170.0+
7558
+ * a reported `current` can be a lower bound because `count` is visibility-based.
7559
+ * `gate` and the plan fields stay `null` because `list_contexts` omits
7560
+ * them. A concurrent create can still exhaust the quota after the
7561
+ * pre-check, in which case the server may identify the plan that lifts it.
7557
7562
  *
7558
7563
  * @throws KaguraQuotaError when the workspace context limit is reached.
7559
7564
  * @throws KaguraFeatureNotAvailableError for a shared context (`isPrivate: false`) on a
@@ -7565,12 +7570,14 @@ var KaguraClient = class _KaguraClient {
7565
7570
  if (!canCreate && contexts.limit !== 0) {
7566
7571
  const count = contexts.count ?? null;
7567
7572
  const limit = contexts.limit ?? null;
7573
+ const usageUnknown = typeof count === "number" && typeof limit === "number" && count < limit;
7574
+ const message = usageUnknown ? `Context limit of ${limit} reached. Contexts you cannot see count toward this limit.` : `Context limit reached (${count === null ? "?" : String(count)}/${limit === null ? "?" : String(limit)}).`;
7568
7575
  throw new KaguraQuotaError(
7569
- `Context limit reached (${count === null ? "?" : String(count)}/${limit === null ? "?" : String(limit)}). Delete unused contexts or upgrade your plan.`,
7576
+ `${message} Delete unused contexts or upgrade your plan.`,
7570
7577
  null,
7571
7578
  {
7572
7579
  quotaType: "contexts",
7573
- current: typeof count === "number" ? count : null,
7580
+ current: typeof count === "number" && !usageUnknown ? count : null,
7574
7581
  limit: typeof limit === "number" ? limit : null
7575
7582
  }
7576
7583
  );