@pouchy_ai/admin-sdk 0.7.0 → 0.7.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,24 @@
2
2
 
3
3
  All notable changes to `@pouchy_ai/admin-sdk` are documented here.
4
4
 
5
+ ## 0.7.1 — 2026-07-27
6
+
7
+ Fix: `timeoutMs: 0` now disables the deadline instead of aborting every request.
8
+
9
+ - **`timeoutMs: 0` means "no deadline".** It previously meant "abort on the next
10
+ tick": `opts.timeoutMs ?? …` correctly treats `0` as a set value, but that `0`
11
+ was then handed to `AbortSignal.timeout(0)`, which fires immediately — so a
12
+ client constructed with `timeoutMs: 0` failed *every* call with the
13
+ self-contradicting `request timed out after 0ms`. The companion JS SDK has
14
+ documented `requestTimeoutMs: 0` as "disables" since 0.35.0 and implements it
15
+ as an explicit `if (!budget)` branch; a host carrying that idiom to this
16
+ package got the opposite behaviour. The signal is now omitted entirely when
17
+ the resolved deadline is `0`.
18
+ - No other value changes. An unset `timeoutMs` still resolves to the
19
+ route-sized default (30s, or `LONG_WORK_TIMEOUT_MS` for the four
20
+ `maxDuration: 300` handlers), and any positive value still bounds every
21
+ request as before.
22
+
5
23
  ## 0.7.0 — 2026-07-27
6
24
 
7
25
  Adds: a throttled request now tells you how long to wait.
package/README.md CHANGED
@@ -80,6 +80,11 @@ Setting `timeoutMs` explicitly always wins and applies to **every** request, lon
80
80
  or short. `requestDeadlineMs(method, path)` returns the default a given request
81
81
  would use.
82
82
 
83
+ `timeoutMs: 0` **disables** the deadline — the request runs unbounded. This is
84
+ the same contract as the companion JS SDK's `requestTimeoutMs: 0`, so the idiom
85
+ carries between the two packages. (Before 0.7.1 a `0` aborted every request on
86
+ the next tick.)
87
+
83
88
  ## Errors
84
89
 
85
90
  Every method throws `AdminApiError` on failure — a non-2xx response, a network
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const ADMIN_SDK_VERSION = "0.7.0";
1
+ export declare const ADMIN_SDK_VERSION = "0.7.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
@@ -41,7 +41,13 @@ export interface AdminClientOptions {
41
41
  * and the GDPR user delete), which default to
42
42
  * {@link LONG_WORK_TIMEOUT_MS}. Setting this explicitly always wins and
43
43
  * applies to every request, long or short. A request that outlives its
44
- * deadline rejects with an AdminApiError(status 0). */
44
+ * deadline rejects with an AdminApiError(status 0).
45
+ *
46
+ * `0` DISABLES the deadline — the request runs unbounded. This mirrors the
47
+ * companion JS SDK's `requestTimeoutMs`, whose documented contract is the
48
+ * same ("`0` disables"), so the idiom carries between the two packages.
49
+ * Before 0.7.1 a `0` here meant "abort on the next tick", i.e. every call
50
+ * failed with the self-contradicting `request timed out after 0ms`. */
45
51
  timeoutMs?: number;
46
52
  }
47
53
  /** Thrown on any non-2xx response. `status` is the HTTP status; `message` is the
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.7.0';
11
+ export const ADMIN_SDK_VERSION = '0.7.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;
@@ -135,6 +135,8 @@ export function createAdminClient(opts) {
135
135
  // An explicit host `timeoutMs` always wins (JS SDK contract); otherwise
136
136
  // the deadline is sized to the ROUTE, so the four handlers that declare
137
137
  // `maxDuration: 300` are not cut at 30s while they are still working.
138
+ // `??` (not `||`) is deliberate: 0 is a SET value meaning "no deadline",
139
+ // and it must not fall through to the route default.
138
140
  const timeoutMs = opts.timeoutMs ?? requestDeadlineMs(method, path);
139
141
  // Every failure surfaces as an AdminApiError (the doc contract): a
140
142
  // network/DNS error or a timeout would otherwise escape as a raw
@@ -149,7 +151,12 @@ export function createAdminClient(opts) {
149
151
  ...(body !== undefined ? { 'content-type': 'application/json' } : {})
150
152
  },
151
153
  body: body !== undefined ? JSON.stringify(body) : undefined,
152
- signal: AbortSignal.timeout(timeoutMs)
154
+ // timeoutMs === 0 → no signal at all. `AbortSignal.timeout(0)`
155
+ // does NOT mean "no deadline"; it fires on the next tick, so
156
+ // arming it here aborted every request before the response could
157
+ // land. The companion JS SDK spells the same branch
158
+ // (`if (!budget) return this.doFetch(...)`).
159
+ signal: timeoutMs ? AbortSignal.timeout(timeoutMs) : undefined
153
160
  });
154
161
  }
155
162
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pouchy_ai/admin-sdk",
3
- "version": "0.7.0",
3
+ "version": "0.7.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",