@pouchy_ai/admin-sdk 0.31.0 → 0.32.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 +24 -0
- package/README.md +5 -0
- package/dist/index.d.ts +19 -7
- package/dist/index.js +18 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@pouchy_ai/admin-sdk` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.32.0 — 2026-09-06
|
|
6
|
+
|
|
7
|
+
- **Diff entries are `{ field, before, after }`** — `diffAgentVersions` and
|
|
8
|
+
`getAgentPromotion` were typed `{ field, from, to }` since they were added,
|
|
9
|
+
and the server has always sent `before` / `after` (`diffAgentTemplates`).
|
|
10
|
+
Reading `d.from` / `d.to` gave `undefined` for every changed field. The
|
|
11
|
+
types (and the published OpenAPI spec) now say what the wire says; no
|
|
12
|
+
runtime change. If you read the keys by name, rename them.
|
|
13
|
+
- **`getAgentPromotion().pinnedSnapshotMissing?`** — true when the production
|
|
14
|
+
pin names an archived snapshot that no longer exists, in which case live
|
|
15
|
+
instances run the staging head until a re-promote re-pins. Additive;
|
|
16
|
+
older servers omit it. The diff is empty in that state, so read this before
|
|
17
|
+
reading an empty diff as "in sync".
|
|
18
|
+
|
|
19
|
+
## 0.31.1 — 2026-09-06
|
|
20
|
+
|
|
21
|
+
- **`AdminApiError.errorId`** — the server's lookup reference (`err_…`) for a
|
|
22
|
+
persisted 5xx, when the envelope carried one. An uncaught console-plane fault
|
|
23
|
+
is sanitized to "An unexpected error occurred." before it leaves the server;
|
|
24
|
+
the `errorId` is the one thing an operator can resolve to the real cause, and
|
|
25
|
+
the client read `error` / `code` / `retryAfter` and dropped it. Additive;
|
|
26
|
+
absent on 4xx and on a 5xx that was not persisted; string-only, like `code`.
|
|
27
|
+
Quote it in a support request.
|
|
28
|
+
|
|
5
29
|
## 0.31.0 — 2026-09-05
|
|
6
30
|
|
|
7
31
|
- **`Agent.spawnSubtasks?`** and **`Agent.replyCues?`** (`ReplyCues`
|
package/README.md
CHANGED
|
@@ -346,6 +346,11 @@ try {
|
|
|
346
346
|
}
|
|
347
347
|
```
|
|
348
348
|
|
|
349
|
+
On a persisted 5xx the message is sanitized server-side ("An unexpected error
|
|
350
|
+
occurred.") and `AdminApiError.errorId` carries the server's `err_…` lookup
|
|
351
|
+
reference (0.31.1) — quote it in a support request; it is what resolves to the
|
|
352
|
+
real cause.
|
|
353
|
+
|
|
349
354
|
### Failure codes (409)
|
|
350
355
|
|
|
351
356
|
**Every machine-readable failure on this API is a 409**, so `status` separates
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ADMIN_SDK_VERSION = "0.
|
|
1
|
+
export declare const ADMIN_SDK_VERSION = "0.32.0";
|
|
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
|
|
@@ -95,7 +95,14 @@ export declare class AdminApiError extends Error {
|
|
|
95
95
|
status: number;
|
|
96
96
|
readonly retryAfter?: number;
|
|
97
97
|
readonly code?: AdminErrorCode;
|
|
98
|
-
|
|
98
|
+
/** The server's lookup reference for a persisted 5xx (`err_…`), when the
|
|
99
|
+
* envelope carried one. An uncaught console-plane fault is sanitized to
|
|
100
|
+
* "An unexpected error occurred." before it leaves the server, so this is
|
|
101
|
+
* the ONE greppable thing the operator can resolve to the real cause —
|
|
102
|
+
* quote it in a support request. Absent on 4xx and on a 5xx that was not
|
|
103
|
+
* persisted (0.31.1; until then the client dropped the field). */
|
|
104
|
+
readonly errorId?: string;
|
|
105
|
+
constructor(message: string, status: number, retryAfter?: number, code?: string, errorId?: string);
|
|
99
106
|
}
|
|
100
107
|
export type Env = 'live' | 'test';
|
|
101
108
|
export type AgentStatus = 'draft' | 'published';
|
|
@@ -510,8 +517,8 @@ export interface AdminClient {
|
|
|
510
517
|
to: string;
|
|
511
518
|
diff: Array<{
|
|
512
519
|
field: string;
|
|
513
|
-
|
|
514
|
-
|
|
520
|
+
before: unknown;
|
|
521
|
+
after: unknown;
|
|
515
522
|
}>;
|
|
516
523
|
}>;
|
|
517
524
|
/** Roll an agent back to an archived revision. git-revert semantics: the
|
|
@@ -522,16 +529,21 @@ export interface AdminClient {
|
|
|
522
529
|
}>;
|
|
523
530
|
/** Promotion status: the head (staging) vs the pinned production version, plus
|
|
524
531
|
* the diff a promotion would ship (empty when in sync). `pending` is false
|
|
525
|
-
* when the agent was never promoted (live follows the head).
|
|
532
|
+
* when the agent was never promoted (live follows the head).
|
|
533
|
+
* `pinnedSnapshotMissing` (0.32.0) is true when the pin names a snapshot
|
|
534
|
+
* that no longer exists — live instances are then running the staging head
|
|
535
|
+
* and a re-promote re-pins; the diff is empty in that state for the OTHER
|
|
536
|
+
* reason, so read this field before reading an empty diff as "in sync". */
|
|
526
537
|
getAgentPromotion(agentId: string): Promise<{
|
|
527
538
|
stagingRev: number;
|
|
528
539
|
prodRev: number | null;
|
|
529
540
|
pending: boolean;
|
|
530
541
|
diff: Array<{
|
|
531
542
|
field: string;
|
|
532
|
-
|
|
533
|
-
|
|
543
|
+
before: unknown;
|
|
544
|
+
after: unknown;
|
|
534
545
|
}>;
|
|
546
|
+
pinnedSnapshotMissing?: boolean;
|
|
535
547
|
}>;
|
|
536
548
|
/** Promote the head to production: freezes the head as an archived version and
|
|
537
549
|
* pins prodRev WITHOUT bumping the rev. Live instances re-resolve on their
|
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.
|
|
11
|
+
export const ADMIN_SDK_VERSION = '0.32.0';
|
|
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;
|
|
@@ -124,7 +124,14 @@ export class AdminApiError extends Error {
|
|
|
124
124
|
status;
|
|
125
125
|
retryAfter;
|
|
126
126
|
code;
|
|
127
|
-
|
|
127
|
+
/** The server's lookup reference for a persisted 5xx (`err_…`), when the
|
|
128
|
+
* envelope carried one. An uncaught console-plane fault is sanitized to
|
|
129
|
+
* "An unexpected error occurred." before it leaves the server, so this is
|
|
130
|
+
* the ONE greppable thing the operator can resolve to the real cause —
|
|
131
|
+
* quote it in a support request. Absent on 4xx and on a 5xx that was not
|
|
132
|
+
* persisted (0.31.1; until then the client dropped the field). */
|
|
133
|
+
errorId;
|
|
134
|
+
constructor(message, status, retryAfter, code, errorId) {
|
|
128
135
|
super(message);
|
|
129
136
|
this.name = 'AdminApiError';
|
|
130
137
|
this.status = status;
|
|
@@ -135,6 +142,8 @@ export class AdminApiError extends Error {
|
|
|
135
142
|
// a `switch (e.code)` would fall through on in a way the caller can't see.
|
|
136
143
|
if (typeof code === 'string' && code)
|
|
137
144
|
this.code = code;
|
|
145
|
+
if (typeof errorId === 'string' && errorId)
|
|
146
|
+
this.errorId = errorId;
|
|
138
147
|
}
|
|
139
148
|
}
|
|
140
149
|
/** The `code` a non-2xx body named, or undefined. Kept beside `retryAfterFrom`
|
|
@@ -144,6 +153,12 @@ function codeFrom(body) {
|
|
|
144
153
|
const v = body?.code;
|
|
145
154
|
return typeof v === 'string' && v ? v : undefined;
|
|
146
155
|
}
|
|
156
|
+
/** The `errorId` a persisted 5xx envelope named, or undefined — same
|
|
157
|
+
* string-only rule as `codeFrom`. */
|
|
158
|
+
function errorIdFrom(body) {
|
|
159
|
+
const v = body?.errorId;
|
|
160
|
+
return typeof v === 'string' && v ? v : undefined;
|
|
161
|
+
}
|
|
147
162
|
/** Seconds to wait before retrying a throttled response, or undefined when the
|
|
148
163
|
* server named neither a body field nor a header.
|
|
149
164
|
*
|
|
@@ -228,7 +243,7 @@ export function createAdminClient(opts) {
|
|
|
228
243
|
}
|
|
229
244
|
const data = (await res.json().catch(() => ({})));
|
|
230
245
|
if (!res.ok)
|
|
231
|
-
throw new AdminApiError(data?.error ?? `HTTP ${res.status}`, res.status, retryAfterFrom(res, data), codeFrom(data));
|
|
246
|
+
throw new AdminApiError(data?.error ?? `HTTP ${res.status}`, res.status, retryAfterFrom(res, data), codeFrom(data), errorIdFrom(data));
|
|
232
247
|
return data;
|
|
233
248
|
}
|
|
234
249
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pouchy_ai/admin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
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",
|