@pouchy_ai/admin-sdk 0.40.0 → 0.40.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 +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@pouchy_ai/admin-sdk` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.40.1 — 2026-09-30
|
|
6
|
+
|
|
7
|
+
- **A 2xx whose body cannot be read now rejects with `AdminApiError`.** It
|
|
8
|
+
used to resolve as `{}` typed as the method's result: an HTML 200 from a
|
|
9
|
+
proxy or captive portal, a truncated body, or a deadline that fired
|
|
10
|
+
mid-body read as a success with every field `undefined`. For a one-shot
|
|
11
|
+
secret (`createKey`, `rotateKey`, `createWebhook`, `rotateWebhookSecret`)
|
|
12
|
+
the server had already minted it, and the caller lost it silently. The
|
|
13
|
+
error's `status` is the server's 2xx, because the request did land: do not
|
|
14
|
+
blindly retry a mint. A 204 / 205 still resolves `{}`; non-2xx errors are
|
|
15
|
+
unchanged.
|
|
16
|
+
|
|
5
17
|
## 0.40.0 — 2026-09-29
|
|
6
18
|
|
|
7
19
|
- **`recording` on agents.** Turning it on grants `call.record` on the agent's
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ADMIN_SDK_VERSION = "0.40.
|
|
1
|
+
export declare const ADMIN_SDK_VERSION = "0.40.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
|
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.40.
|
|
11
|
+
export const ADMIN_SDK_VERSION = '0.40.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;
|
|
@@ -270,7 +270,25 @@ export function createAdminClient(opts) {
|
|
|
270
270
|
? `${method} ${path} — request timed out after ${timeoutMs}ms`
|
|
271
271
|
: `${method} ${path} — network error: ${e instanceof Error ? e.message : String(e)}`, 0);
|
|
272
272
|
}
|
|
273
|
-
|
|
273
|
+
// 0.40.1: a 2xx whose body cannot be read is an error, not `{}`. It used
|
|
274
|
+
// to resolve as a success with every field undefined — an HTML 200 from a
|
|
275
|
+
// proxy, a truncated body, a deadline that fired mid-body — and a secret
|
|
276
|
+
// the server had already minted (`createKey`, `rotateKey`,
|
|
277
|
+
// `createWebhook`) was lost with no signal. `status` stays the server's
|
|
278
|
+
// 2xx: the request DID land, so a blind retry of a mint is not safe. A
|
|
279
|
+
// 204 / 205 (no body by definition) still resolves `{}`, and the non-2xx
|
|
280
|
+
// arm keeps its fallback. Still `res.json()`, not `text()`: an injected
|
|
281
|
+
// `fetch` may hand back a minimal response that only implements `json`.
|
|
282
|
+
let readError = null;
|
|
283
|
+
const data = (await res.json().catch((e) => {
|
|
284
|
+
readError = e;
|
|
285
|
+
return {};
|
|
286
|
+
}));
|
|
287
|
+
if (res.ok && readError !== null && res.status !== 204 && res.status !== 205) {
|
|
288
|
+
const why = readError instanceof Error ? readError.message : String(readError);
|
|
289
|
+
const msg = `${method} ${path} — unreadable ${res.status} body: ${why}`;
|
|
290
|
+
throw new AdminApiError(msg, res.status, retryAfterFrom(res, null));
|
|
291
|
+
}
|
|
274
292
|
if (!res.ok)
|
|
275
293
|
throw new AdminApiError(
|
|
276
294
|
// The server's own `error` string is passed through UNCHANGED — it is
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pouchy_ai/admin-sdk",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.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",
|