@cortexkit/claustrum-client 0.6.1 → 0.7.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
@@ -23,6 +23,11 @@ credential caching, refresh, account scheduling, and retry policy.
23
23
  as a version older than every real one.
24
24
  • Unknown server error classes are bounded to `transient`; callers must retry them
25
25
  rather than treating a forward-compatible class as permanent.
26
+ • `listScoped` rows always carry `providerIds` (a required field since 0.6.0, so code
27
+ that builds rows by hand, such as test fixtures, must set it). An empty array means
28
+ no provider ids are set. Since 0.6.2 a daemon too old to send the field decodes the
29
+ same way, so a newer client still lists against an older daemon. `authMethod` stays
30
+ optional.
26
31
 
27
32
  The client sends `consumerIdentity: null` for every managed request so inherited
28
33
  `SUBC_MODULE_ID` and `SUBC_LAUNCH_NONCE` cannot impersonate a supervising host.
package/dist/wire.d.ts CHANGED
@@ -206,8 +206,14 @@ export interface ScopedInventoryRow {
206
206
  readonly categories: readonly string[];
207
207
  readonly credentialType: string;
208
208
  readonly serves: readonly string[];
209
- /** Operator-assigned catalog ids, always present, including an empty set. */
209
+ /**
210
+ * Operator-assigned catalog ids; empty when none are set. Always present on this type.
211
+ * A daemon older than the field omits it from the wire, and that decodes as empty,
212
+ * which is also what an unmapped credential reports.
213
+ */
210
214
  readonly providerIds: readonly string[];
215
+ /** Operator assertion, unknown when absent; pricing owns the vocabulary. */
216
+ readonly planTier?: string;
211
217
  readonly authMethod?: 'apikey' | 'chatgpt' | 'antigravity' | 'oauth';
212
218
  /**
213
219
  * Which provider protocol this credential speaks. Absent for static keys.
package/dist/wire.js CHANGED
@@ -401,6 +401,11 @@ export function decodeScopedInventory(response, logUnknownClass) {
401
401
  : undefined;
402
402
  if (createdAtMs === undefined)
403
403
  throw asCredentialError(response, 'invalid_response', logUnknownClass);
404
+ // A negative end assertion refuses trailing newlines too; JavaScript's $ accepts one.
405
+ const planTier = row.plan_tier;
406
+ if (planTier !== undefined && (typeof planTier !== 'string' || !/^[a-z][a-z0-9_]{0,31}(?![\s\S])/.test(planTier))) {
407
+ throw asCredentialError(response, 'invalid_response', logUnknownClass);
408
+ }
404
409
  const authMethod = row.auth_method;
405
410
  if (authMethod !== undefined &&
406
411
  authMethod !== 'apikey' && authMethod !== 'chatgpt' &&
@@ -418,8 +423,13 @@ export function decodeScopedInventory(response, logUnknownClass) {
418
423
  categories: strings(row.categories),
419
424
  credentialType: row.type,
420
425
  serves: strings(row.serves),
421
- providerIds: strings(row.provider_ids),
426
+ // ABSENT DECODES AS EMPTY, PRESENT MUST BE AN ARRAY. Daemons before provider ids
427
+ // existed omit the key, and refusing that would fail the whole listing against a
428
+ // still-supported daemon. Absent and empty mean the same thing to every consumer:
429
+ // no ids set. A present non-array is a malformed reply and still refuses.
430
+ providerIds: row.provider_ids === undefined ? [] : strings(row.provider_ids),
422
431
  authMethod,
432
+ planTier,
423
433
  state: row.state,
424
434
  refreshAdapter: row.refresh_adapter,
425
435
  recordVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/claustrum-client",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",