@pouchy_ai/admin-sdk 0.31.0 → 0.31.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 +10 -0
- package/README.md +5 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +18 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@pouchy_ai/admin-sdk` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.31.1 — 2026-09-06
|
|
6
|
+
|
|
7
|
+
- **`AdminApiError.errorId`** — the server's lookup reference (`err_…`) for a
|
|
8
|
+
persisted 5xx, when the envelope carried one. An uncaught console-plane fault
|
|
9
|
+
is sanitized to "An unexpected error occurred." before it leaves the server;
|
|
10
|
+
the `errorId` is the one thing an operator can resolve to the real cause, and
|
|
11
|
+
the client read `error` / `code` / `retryAfter` and dropped it. Additive;
|
|
12
|
+
absent on 4xx and on a 5xx that was not persisted; string-only, like `code`.
|
|
13
|
+
Quote it in a support request.
|
|
14
|
+
|
|
5
15
|
## 0.31.0 — 2026-09-05
|
|
6
16
|
|
|
7
17
|
- **`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.31.
|
|
1
|
+
export declare const ADMIN_SDK_VERSION = "0.31.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
|
|
@@ -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';
|
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.31.
|
|
11
|
+
export const ADMIN_SDK_VERSION = '0.31.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;
|
|
@@ -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.31.
|
|
3
|
+
"version": "0.31.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",
|