@pouchy_ai/admin-sdk 0.38.0 → 0.39.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/CHANGELOG.md CHANGED
@@ -2,6 +2,35 @@
2
2
 
3
3
  All notable changes to `@pouchy_ai/admin-sdk` are documented here.
4
4
 
5
+ ## 0.39.1 — 2026-09-28
6
+
7
+ Type corrections. The server's responses did not change; three return types
8
+ described fields it never sent (CR-1101).
9
+
10
+ - **`importUsers()`: `invalid` is a number**, the count of ids refused for
11
+ their shape, not `string[]`. Code that called `res.invalid.join()` threw.
12
+ The type also gains `requested` and `env`, which the server always sent.
13
+ - **`promoteAgent()` returns `{ prodRev, stagingRev }`.** It was typed
14
+ `{ prodRev, templateRev }`, so `templateRev` was always `undefined`.
15
+ - **`getRecentTraces()` types `degraded`** (`false | 'index' | 'error'`), plus
16
+ `sinceHours` and `window`. When `degraded` is not `false` the read failed,
17
+ and an empty `traces` does NOT mean "no runs".
18
+
19
+ If your code relied on the old types, the compiler will now point at it. Each
20
+ of those reads was already wrong at runtime.
21
+
22
+ ## 0.39.0 — 2026-09-26
23
+
24
+ - **`getUserWallet()` now types the figures, and a failed read throws.**
25
+ Admin API 1.18.0 returns `balances` (`{ currency, amount }[]`, decimal
26
+ strings) and `totalUsd` beside the prose `balance`, typed here as the new
27
+ exported `UserWallet`. Both fields are optional because an older server does
28
+ not send them. Before 1.18.0, a wallet service that could not be read
29
+ answered 200 `{ hasWallet: true, balance: "Could not fetch the wallet balance
30
+ right now." }`, which looked like a balance. The server now answers 503, so
31
+ the call throws an `AdminApiError` with `status: 503`; retry it.
32
+ `balance` is unchanged, so code that displays it keeps working.
33
+
5
34
  ## 0.38.0 — 2026-09-25
6
35
 
7
36
  - **`ADMIN_ERROR_CODES` gains `subscription_exists`** (409). `POST
package/README.md CHANGED
@@ -465,7 +465,7 @@ Reads (`GET`) are not covered by that bucket. `retryAfter` is available from
465
465
  | Agent versions | `listAgentVersions` · `getAgentVersion` · `diffAgentVersions({ from?, to? })` · `rollbackAgent` · `getAgentPromotion` · `promoteAgent` (staging→prod) |
466
466
  | Voices | `listVoices({ gender?, age?, locale? })` — catalog for programmatic voice selection (each `CatalogVoice` carries `age`) |
467
467
  | Secret keys | `listKeys` · `createKey` · `revokeKey` · `rotateKey` (24 h grace) |
468
- | End users | `listUsers({ limit?, cursor? })` (cursor-paginated — the response's `nextCursor` feeds the next page; filter variants: `external_user_id` / `external_user_prefix`) · `setUserSuspended` · `deleteUser` · `getUserWallet` · `getUserTraces` · `importUsers` · `exportUser` · `getUserSessions` · `getUserTurns` |
468
+ | End users | `listUsers({ limit?, cursor? })` (cursor-paginated — the response's `nextCursor` feeds the next page; filter variants: `external_user_id` / `external_user_prefix`) · `setUserSuspended` · `deleteUser` · `getUserWallet` (`balances` / `totalUsd` for the figures; `balance` is prose) · `getUserTraces` · `importUsers` · `exportUser` · `getUserSessions` · `getUserTurns` |
469
469
  | Knowledge | `listKnowledge` · `ingestKnowledge` · `ingestKnowledgeFile` (PDF/audio/video/image) · `ingestKnowledgeUrl` (web page) · `searchKnowledge` (recall probe) · `deleteKnowledge` |
470
470
  | Skills | `listSkills` · `installSkill` · `updateSkill` · `setSkillRate` · `setSkillDailyCap` · `grantSkill` (free-HTTP) · `setSkillAutoRunTools` (免确认工具 — required to arm an MCP skill on an instance) · `compileSkill` (prose→tools) · `uninstallSkill` · `importAgentPlugin` / `exportAgentPlugin` (Agent Plugins 1.0.0 interop) |
471
471
  | Credentials | `listCredentials` · `putCredentials` · `deleteCredentials` |
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const ADMIN_SDK_VERSION = "0.38.0";
1
+ export declare const ADMIN_SDK_VERSION = "0.39.1";
2
2
  export declare const DEFAULT_BASE_URL = "https://pouchy.ai/v1/admin";
3
3
  /** Deadline for the routes whose server handler declares `maxDuration: 300` —
4
4
  * the server's own ceiling plus headroom, so a client abort can only ever mean
@@ -325,6 +325,22 @@ export interface UsageCreditEnforcement {
325
325
  * running on `standard`; a free-plan ceiling refuses NEW sessions). */
326
326
  effect: string;
327
327
  }
328
+ /** One end user's wallet, as `getUserWallet` returns it. */
329
+ export interface UserWallet {
330
+ hasWallet: boolean;
331
+ /** Human-readable prose, or null when there is no wallet. NOT a number. */
332
+ balance: string | null;
333
+ /** Nonzero per-currency balances; `amount` is a decimal string such as
334
+ * "5.83", never atomic units. Admin API 1.18.0+, present when
335
+ * `hasWallet` is true. */
336
+ balances?: {
337
+ currency: string;
338
+ amount: string;
339
+ }[];
340
+ /** USD total (the allowed stablecoins are USD-pegged 1:1). Admin API
341
+ * 1.18.0+, present when `hasWallet` is true. */
342
+ totalUsd?: number;
343
+ }
328
344
  /** The credit meter with both scopes named (admin API 1.14.0+). Read this, not
329
345
  * `usage.credits / usage.creditLimit`: that divides THIS project's figure by
330
346
  * the ACCOUNT's allowance and understates consumption on any multi-project
@@ -601,10 +617,12 @@ export interface AdminClient {
601
617
  }>;
602
618
  /** Promote the head to production: freezes the head as an archived version and
603
619
  * pins prodRev WITHOUT bumping the rev. Live instances re-resolve on their
604
- * next mint; test instances always run the head. */
620
+ * next mint; test instances always run the head. `stagingRev` equals
621
+ * `prodRev` right after a promote (0.39.1: this was typed `templateRev`,
622
+ * which the server never sent). */
605
623
  promoteAgent(agentId: string): Promise<{
606
624
  prodRev: number;
607
- templateRev: number;
625
+ stagingRev: number;
608
626
  }>;
609
627
  listKeys(): Promise<{
610
628
  keys: SecretKey[];
@@ -655,24 +673,27 @@ export interface AdminClient {
655
673
  }>;
656
674
  /** The instance companion's wallet. `balance` is a human-readable prose
657
675
  * string (e.g. "Wallet balance: … (~$X total)."), or null when the instance
658
- * has no wallet — NOT a number, and there is no address field. */
659
- getUserWallet(instanceId: string): Promise<{
660
- hasWallet: boolean;
661
- balance: string | null;
662
- }>;
676
+ * has no wallet — NOT a number, and there is no address field. Read
677
+ * `balances` / `totalUsd` for the figures (admin API 1.18.0; absent from an
678
+ * older server). A wallet service that cannot be read throws a 503. */
679
+ getUserWallet(instanceId: string): Promise<UserWallet>;
663
680
  getUserTraces(instanceId: string): Promise<{
664
681
  traces: unknown[];
665
682
  }>;
666
683
  /** Batch-import end users from your own id list (idempotent per external id;
667
- * never meters MAU — imported users bill only when they actually mint). */
684
+ * never meters MAU — imported users bill only when they actually mint).
685
+ * `invalid` is a COUNT of ids refused for their shape (0.39.1: it was typed
686
+ * `string[]`, so `res.invalid.join()` threw). */
668
687
  importUsers(input: {
669
688
  externalUserIds: string[] | string;
670
689
  agentId?: string;
671
690
  env?: Env;
672
691
  }): Promise<{
692
+ requested: number;
673
693
  created: number;
674
694
  skipped: number;
675
- invalid: string[];
695
+ env: Env;
696
+ invalid: number;
676
697
  }>;
677
698
  /** GDPR data-portability export: registry, character state, memories, contacts. */
678
699
  exportUser(instanceId: string): Promise<Record<string, unknown>>;
@@ -1426,13 +1447,21 @@ export interface AdminClient {
1426
1447
  agentId: string;
1427
1448
  sinceHours?: number;
1428
1449
  }): Promise<Record<string, unknown>>;
1429
- /** Recent run rows project-wide (the failed-run browser). */
1450
+ /** Recent run rows project-wide (the failed-run browser). `degraded` other
1451
+ * than `false` means the READ failed (`'index'` a missing index, `'error'`
1452
+ * a fault): an empty `traces` is then NOT "no runs" and must not be shown as
1453
+ * one (0.39.1: the field was missing from this type). */
1430
1454
  getRecentTraces(params?: {
1431
1455
  agentId?: string;
1432
1456
  sinceHours?: number;
1433
1457
  errorsOnly?: boolean;
1434
1458
  limit?: number;
1435
1459
  }): Promise<{
1460
+ sinceHours: number;
1461
+ window: {
1462
+ sinceMs: number;
1463
+ };
1464
+ degraded: false | 'index' | 'error';
1436
1465
  traces: RecentTrace[];
1437
1466
  }>;
1438
1467
  /** Enabled platform voices for programmatic provisioning. Filter by gender /
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@
8
8
  // import { createAdminClient } from '@pouchy_ai/admin-sdk';
9
9
  // const admin = createAdminClient({ adminKey: process.env.POUCHY_ADMIN_KEY! });
10
10
  // const { agents } = await admin.listAgents();
11
- export const ADMIN_SDK_VERSION = '0.38.0';
11
+ export const ADMIN_SDK_VERSION = '0.39.1';
12
12
  export const DEFAULT_BASE_URL = 'https://pouchy.ai/v1/admin';
13
13
  /** Default per-request timeout (ms). A hung upstream otherwise never rejects. */
14
14
  const DEFAULT_TIMEOUT_MS = 30_000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pouchy_ai/admin-sdk",
3
- "version": "0.38.0",
3
+ "version": "0.39.1",
4
4
  "description": "Typed TypeScript client for the Pouchy Admin API \u2014 manage agents, keys, end users, knowledge, skills, channels, schedules, webhooks and credentials headlessly, with a project Admin key.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",