@pouchy_ai/admin-sdk 0.1.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  All notable changes to `@pouchy_ai/admin-sdk` are documented here.
4
4
 
5
+ ## 0.2.0 — 2026-07-11
6
+
7
+ Provisioning-parity release (driven by integrator feedback — programmatic
8
+ per-member agent provisioning with no human in the loop):
9
+
10
+ - **`listVoices({ gender?, locale? })`** — the platform voice catalog on the
11
+ admin key (`GET /v1/admin/voice-catalog`). Rows carry `provider` (which agent
12
+ `voices` slot the `providerVoiceId` goes in), plus `gender` / `locales` tags
13
+ for auto-selection. Gender filter matches explicitly tagged rows; locale
14
+ filter matches rows listing it (no locale list = unrestricted).
15
+ - **`rotateKey(keyId, { graceHours? })`** — secret-key rotation with a grace
16
+ window (default 24 h; the old key keeps verifying while you swap envs).
17
+ - **`testWebhook(webhookId)`** / **`redeliverWebhook(deliveryId)`** — send a
18
+ test event; manually re-send a recorded delivery's original body.
19
+ - **`updateWebhook(webhookId, { url?, events? })`** — edit an endpoint in
20
+ place (keeps the signing secret + delivery history) — and
21
+ **`rotateWebhookSecret(webhookId)`** — roll the signing secret (shown once).
22
+ - **`getRecentTraces({ agentId?, sinceHours?, errorsOnly?, limit? })`** — the
23
+ project-wide failed-run browser.
24
+ - **`importUsers({ externalUserIds, agentId?, env? })`** — batch instance
25
+ import (idempotent per external id; never meters MAU).
26
+ - **`exportUser(instanceId)`** — GDPR data-portability export.
27
+ - **`getUserSessions(instanceId)`** / **`getUserTurns(instanceId, sessionId)`**
28
+ — session list + turn-log transcripts.
29
+ - `AuditRow.actor` — audit-log rows now attribute WHO acted.
30
+
5
31
  ## 0.1.0
6
32
 
7
33
  Initial release. Typed, zero-dependency client for the Pouchy Admin API
package/README.md CHANGED
@@ -70,15 +70,16 @@ try {
70
70
  | Area | Methods |
71
71
  | --- | --- |
72
72
  | Agents | `listAgents` · `createAgent` · `getAgent` · `updateAgent` · `deleteAgent` |
73
- | Secret keys | `listKeys` · `createKey` · `revokeKey` |
74
- | End users | `listUsers` · `setUserSuspended` · `deleteUser` · `getUserWallet` · `getUserTraces` |
73
+ | Voices | `listVoices({ gender?, locale? })` catalog for programmatic voice selection |
74
+ | Secret keys | `listKeys` · `createKey` · `revokeKey` · `rotateKey` (24 h grace) |
75
+ | End users | `listUsers` · `setUserSuspended` · `deleteUser` · `getUserWallet` · `getUserTraces` · `importUsers` · `exportUser` · `getUserSessions` · `getUserTurns` |
75
76
  | Knowledge | `listKnowledge` · `ingestKnowledge` · `deleteKnowledge` |
76
77
  | Skills | `listSkills` · `installSkill` · `updateSkill` · `uninstallSkill` |
77
78
  | Credentials | `listCredentials` · `putCredentials` · `deleteCredentials` |
78
79
  | Channels | `listChannels` · `createChannel` · `getChannel` · `updateChannel` · `deleteChannel` |
79
80
  | Schedules | `listSchedules` · `createSchedule` · `getSchedule` · `updateSchedule` · `deleteSchedule` |
80
- | Webhooks | `listWebhooks` · `createWebhook` · `deleteWebhook` |
81
- | Reporting | `getUsage` · `getBilling` · `getTracesSummary` · `getLogs` · `getProject` · `updateProject` |
81
+ | Webhooks | `listWebhooks` · `createWebhook` · `updateWebhook` · `rotateWebhookSecret` · `deleteWebhook` · `testWebhook` · `redeliverWebhook` |
82
+ | Reporting | `getUsage` · `getBilling` · `getTracesSummary` · `getRecentTraces` · `getLogs` · `getProject` · `updateProject` |
82
83
  | Escape hatch | `request(method, path, body?)` — any endpoint not yet typed |
83
84
 
84
85
  ## OpenAPI
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const ADMIN_SDK_VERSION = "0.1.0";
1
+ export declare const ADMIN_SDK_VERSION = "0.2.0";
2
2
  export declare const DEFAULT_BASE_URL = "https://pouchy.ai/v1/admin";
3
3
  export interface AdminClientOptions {
4
4
  /** A project Admin key (`pchy_admin_…`) from the dashboard Admin Keys page. */
@@ -58,6 +58,49 @@ export interface AuditRow {
58
58
  at: string;
59
59
  type: string;
60
60
  detail: Record<string, unknown>;
61
+ /** Who performed the action (member email/uid or `admin_key:{keyId}`);
62
+ * absent on system-originated entries. */
63
+ actor?: string;
64
+ }
65
+ export interface CatalogVoice {
66
+ /** Catalog id (std_… / hd_…) — display/reference only. */
67
+ id: string;
68
+ name: string;
69
+ desc: string;
70
+ tier: 'standard' | 'premium';
71
+ /** Which agent `voices` slot the providerVoiceId goes in. */
72
+ provider: 'openAI' | 'elevenLabs';
73
+ /** The value to write into that slot. */
74
+ providerVoiceId: string;
75
+ previewUrl?: string;
76
+ /** Present on tagged rows; filter with listVoices({ gender }). */
77
+ gender?: 'female' | 'male' | 'neutral';
78
+ /** Locales this voice suits; ABSENT = unrestricted. */
79
+ locales?: string[];
80
+ }
81
+ export interface RecentTrace {
82
+ traceId: string;
83
+ sessionId: string;
84
+ agentId?: string;
85
+ instanceId?: string;
86
+ trigger: string;
87
+ startedAt: number;
88
+ durationMs: number;
89
+ tokensIn: number;
90
+ tokensOut: number;
91
+ tokensCached: number;
92
+ toolCount: number;
93
+ ok: boolean;
94
+ spans: {
95
+ name: string;
96
+ kind: string;
97
+ ms: number;
98
+ }[];
99
+ }
100
+ export interface DeliveryOutcome {
101
+ ok: boolean;
102
+ status?: number;
103
+ error?: string;
61
104
  }
62
105
  /** The Admin API client. Every method returns the parsed JSON body; failures
63
106
  * throw AdminApiError. */
@@ -97,6 +140,18 @@ export interface AdminClient {
97
140
  revokeKey(keyId: string): Promise<{
98
141
  revoked: boolean;
99
142
  }>;
143
+ /** Rotate a secret key: mints the replacement (plaintext returned ONCE);
144
+ * the old key keeps verifying for the grace window (default 24 h). */
145
+ rotateKey(keyId: string, opts?: {
146
+ graceHours?: number;
147
+ }): Promise<{
148
+ key: string;
149
+ record: SecretKey;
150
+ old: {
151
+ keyId: string;
152
+ graceUntil: string | null;
153
+ };
154
+ }>;
100
155
  listUsers(params?: {
101
156
  q?: string;
102
157
  limit?: number;
@@ -116,6 +171,31 @@ export interface AdminClient {
116
171
  getUserTraces(instanceId: string): Promise<{
117
172
  traces: unknown[];
118
173
  }>;
174
+ /** Batch-import end users from your own id list (idempotent per external id;
175
+ * never meters MAU — imported users bill only when they actually mint). */
176
+ importUsers(input: {
177
+ externalUserIds: string[] | string;
178
+ agentId?: string;
179
+ env?: Env;
180
+ }): Promise<{
181
+ created: number;
182
+ skipped: number;
183
+ invalid: string[];
184
+ }>;
185
+ /** GDPR data-portability export: registry, character state, memories, contacts. */
186
+ exportUser(instanceId: string): Promise<Record<string, unknown>>;
187
+ /** The instance's companion sessions, most recently active first. */
188
+ getUserSessions(instanceId: string, params?: {
189
+ limit?: number;
190
+ }): Promise<{
191
+ sessions: unknown[];
192
+ }>;
193
+ /** A session's turn log (oldest first, with per-turn trace meta). */
194
+ getUserTurns(instanceId: string, sessionId: string, params?: {
195
+ limit?: number;
196
+ }): Promise<{
197
+ turns: unknown[];
198
+ }>;
119
199
  listKnowledge(): Promise<{
120
200
  docs: unknown[];
121
201
  }>;
@@ -226,6 +306,26 @@ export interface AdminClient {
226
306
  deleteWebhook(webhookId: string): Promise<{
227
307
  deleted: boolean;
228
308
  }>;
309
+ /** Edit url/events in place (keeps the signing secret + delivery history). */
310
+ updateWebhook(webhookId: string, patch: {
311
+ url?: string;
312
+ events?: string[];
313
+ }): Promise<{
314
+ webhook: {
315
+ webhookId: string;
316
+ };
317
+ }>;
318
+ /** Roll the signing secret (returned ONCE; no dual-secret grace). */
319
+ rotateWebhookSecret(webhookId: string): Promise<{
320
+ webhook: {
321
+ webhookId: string;
322
+ secret: string;
323
+ };
324
+ }>;
325
+ /** Send a clearly-marked test event to this endpoint (ignores subscriptions). */
326
+ testWebhook(webhookId: string): Promise<DeliveryOutcome>;
327
+ /** Manually re-send a recorded delivery's original body, re-signed. */
328
+ redeliverWebhook(deliveryId: string): Promise<DeliveryOutcome>;
229
329
  getUsage(): Promise<MonthUsage>;
230
330
  getBilling(): Promise<{
231
331
  plan: string;
@@ -236,6 +336,24 @@ export interface AdminClient {
236
336
  agentId?: string;
237
337
  sinceHours?: number;
238
338
  }): Promise<Record<string, unknown>>;
339
+ /** Recent run rows project-wide (the failed-run browser). */
340
+ getRecentTraces(params?: {
341
+ agentId?: string;
342
+ sinceHours?: number;
343
+ errorsOnly?: boolean;
344
+ limit?: number;
345
+ }): Promise<{
346
+ traces: RecentTrace[];
347
+ }>;
348
+ /** Enabled platform voices for programmatic provisioning. Filter by gender
349
+ * (explicitly tagged rows only) and/or locale (rows listing it, or with no
350
+ * locale list = unrestricted). */
351
+ listVoices(params?: {
352
+ gender?: 'female' | 'male' | 'neutral';
353
+ locale?: string;
354
+ }): Promise<{
355
+ voices: CatalogVoice[];
356
+ }>;
239
357
  getLogs(params?: {
240
358
  limit?: number;
241
359
  }): Promise<{
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.1.0';
11
+ export const ADMIN_SDK_VERSION = '0.2.0';
12
12
  export const DEFAULT_BASE_URL = 'https://pouchy.ai/v1/admin';
13
13
  /** Thrown on any non-2xx response. `status` is the HTTP status; `message` is the
14
14
  * server's `error` string when present. */
@@ -58,11 +58,16 @@ export function createAdminClient(opts) {
58
58
  listKeys: () => request('GET', '/keys'),
59
59
  createKey: (input) => request('POST', '/keys', input),
60
60
  revokeKey: (id) => request('DELETE', `/keys/${encodeURIComponent(id)}`),
61
+ rotateKey: (id, opts = {}) => request('POST', `/keys/${encodeURIComponent(id)}/rotate`, opts),
61
62
  listUsers: (params = {}) => request('GET', `/users${qs(params)}`),
62
63
  setUserSuspended: (id, suspended) => request('PATCH', `/users/${encodeURIComponent(id)}`, { suspended }),
63
64
  deleteUser: (id) => request('DELETE', `/users/${encodeURIComponent(id)}`),
64
65
  getUserWallet: (id) => request('GET', `/users/${encodeURIComponent(id)}/wallet`),
65
66
  getUserTraces: (id) => request('GET', `/users/${encodeURIComponent(id)}/traces`),
67
+ importUsers: (input) => request('POST', '/users/import', input),
68
+ exportUser: (id) => request('GET', `/users/${encodeURIComponent(id)}/export`),
69
+ getUserSessions: (id, params = {}) => request('GET', `/users/${encodeURIComponent(id)}/sessions${qs(params)}`),
70
+ getUserTurns: (id, sessionId, params = {}) => request('GET', `/users/${encodeURIComponent(id)}/sessions/${encodeURIComponent(sessionId)}/turns${qs(params)}`),
66
71
  listKnowledge: () => request('GET', '/knowledge'),
67
72
  ingestKnowledge: (input) => request('POST', '/knowledge', input),
68
73
  deleteKnowledge: (id) => request('DELETE', `/knowledge/${encodeURIComponent(id)}`),
@@ -86,9 +91,15 @@ export function createAdminClient(opts) {
86
91
  listWebhooks: () => request('GET', '/webhooks'),
87
92
  createWebhook: (input) => request('POST', '/webhooks', input),
88
93
  deleteWebhook: (id) => request('DELETE', `/webhooks/${encodeURIComponent(id)}`),
94
+ updateWebhook: (id, patch) => request('PATCH', `/webhooks/${encodeURIComponent(id)}`, patch),
95
+ rotateWebhookSecret: (id) => request('POST', `/webhooks/${encodeURIComponent(id)}/rotate-secret`),
96
+ testWebhook: (id) => request('POST', `/webhooks/${encodeURIComponent(id)}/test`),
97
+ redeliverWebhook: (id) => request('POST', `/webhooks/deliveries/${encodeURIComponent(id)}/redeliver`),
89
98
  getUsage: () => request('GET', '/usage'),
90
99
  getBilling: () => request('GET', '/billing'),
91
100
  getTracesSummary: (params = {}) => request('GET', `/traces/summary${qs(params)}`),
101
+ getRecentTraces: (params = {}) => request('GET', `/traces/recent${qs({ ...params, errorsOnly: params.errorsOnly ? '1' : undefined })}`),
102
+ listVoices: (params = {}) => request('GET', `/voice-catalog${qs(params)}`),
92
103
  getLogs: (params = {}) => request('GET', `/logs${qs(params)}`),
93
104
  getProject: () => request('GET', '/project'),
94
105
  updateProject: (patch) => request('PATCH', '/project', patch),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pouchy_ai/admin-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Typed TypeScript client for the Pouchy Admin API — 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",