@pouchy_ai/admin-sdk 0.24.1 → 0.25.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,37 @@
2
2
 
3
3
  All notable changes to `@pouchy_ai/admin-sdk` are documented here.
4
4
 
5
+ ## 0.25.0 — 2026-08-09
6
+
7
+ - **`ADMIN_ERROR_CODES` gains the two schedule-PATCH refusals** (additive;
8
+ nothing renamed or removed): `one_shot_spent` (409 — this one-shot schedule
9
+ already fired; create a new one instead of re-enabling it) and `ghost_row`
10
+ (409 — a legacy incomplete row that can never fire; delete it and create a
11
+ new schedule). Both have been emitted by `updateSchedule` refusals on the
12
+ server (`one_shot_spent` for a long time, `ghost_row` since the ghost-row
13
+ guard landed) but were absent from every published vocabulary — an
14
+ integrator switching on `AdminApiError.code` per this package's own advice
15
+ fell through on codes no doc named. `updateSchedule`'s docstring now lists
16
+ all three 409 codes. Existing `code` handling is unaffected — the type was
17
+ already open (`string & {}`), so this widens autocomplete/docs, not the
18
+ wire.
19
+
20
+ ## 0.24.2 — 2026-08-08
21
+
22
+ - **Docs-only: `extractJson` failure vocabulary gains `request_invalid`**
23
+ (server-side change; no SDK code moved — the code rides the open
24
+ `AdminErrorCode` string arm). The provider rejecting the REQUEST itself —
25
+ an unknown `model` (provider 404), or a parameter outside the provider's
26
+ validation (422) — now surfaces as `code: 'request_invalid'` with HTTP 400
27
+ and the provider's own message, instead of `unavailable`, whose documented
28
+ recovery ("back off and retry") sent integrators into an infinite backoff
29
+ loop for a request that can never succeed (e.g. a typo'd model name).
30
+ `schema_invalid` still covers provider-rejected schemas; `unavailable` is
31
+ now reliably transient. Also: `schemaName` is validated locally against the
32
+ provider's identifier grammar (letters/digits/underscores/dashes), so a bad
33
+ name is an immediate 400 naming `schemaName` rather than a provider 400
34
+ mislabelled `schema_invalid`.
35
+
5
36
  ## 0.24.1 — 2026-08-08
6
37
 
7
38
  - **Docs-only correction for `synthesizeSpeech`** (no code change): the rate
package/README.md CHANGED
@@ -148,6 +148,8 @@ const { data } = await admin.extractJson<{ items: { kind: string; summary: strin
148
148
 
149
149
  Failures are typed rather than prose, so the recoveries are distinguishable:
150
150
  `schema_invalid` (400 — fix the schema; retrying verbatim cannot help),
151
+ `request_invalid` (400 — the provider rejected the request itself: an unknown
152
+ `model`, or a parameter outside the provider's validation; fix the request),
151
153
  `unavailable` (5xx — transient, back off), and `invalid_json` (502 — a
152
154
  completion arrived but did not parse or satisfy the schema; the error carries
153
155
  `raw`, the text actually returned). Tokens roll into the project's month usage
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const ADMIN_SDK_VERSION = "0.24.1";
1
+ export declare const ADMIN_SDK_VERSION = "0.25.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
@@ -59,7 +59,7 @@ export interface AdminClientOptions {
59
59
  * published: on this plane the status line never disambiguates, so two of the
60
60
  * durable-run routes answer 409 for two entirely different reasons each, with
61
61
  * different recoveries. `code` is the only thing that tells them apart. */
62
- export declare const ADMIN_ERROR_CODES: readonly ["schedule_limit_reached", "channel_limit_reached", "webhook_limit_reached", "run_limit_reached", "reembed_required", "run_terminal", "run_not_parked", "stale_token", "run_not_waiting", "event_mismatch"];
62
+ export declare const ADMIN_ERROR_CODES: readonly ["schedule_limit_reached", "one_shot_spent", "ghost_row", "channel_limit_reached", "webhook_limit_reached", "run_limit_reached", "reembed_required", "run_terminal", "run_not_parked", "stale_token", "run_not_waiting", "event_mismatch"];
63
63
  /** `AdminApiError.code` values. The `(string & {})` arm keeps the type open for
64
64
  * codes newer than this SDK build while preserving autocomplete — same
65
65
  * doctrine as the companion SDK's `CompanionErrorCodeValue`. */
@@ -69,7 +69,7 @@ export type AdminErrorCode = (typeof ADMIN_ERROR_CODES)[number] | (string & {});
69
69
  * backoff in SECONDS on a 429 (undefined on every other failure); `code` is the
70
70
  * server's machine tag when it named one (undefined otherwise).
71
71
  *
72
- * Why `code` exists: the Admin API's ten machine-readable failures are ALL on
72
+ * Why `code` exists: the Admin API's machine-readable failures are ALL on
73
73
  * 409, so `status` cannot separate them and this package used to discard the
74
74
  * one field that can. Two routes are the point — `resumeRun` answers 409 for
75
75
  * `run_not_parked` (someone already decided; re-read, do not retry) or
@@ -679,9 +679,12 @@ export interface AdminClient {
679
679
  *
680
680
  * Failures are typed rather than prose, which is the point:
681
681
  * `schema_invalid` (400 — fix the schema, retrying verbatim cannot help),
682
- * `unavailable` (5xxtransient, back off), `invalid_json` (502 — a
683
- * completion arrived but did not parse or did not satisfy the schema; the
684
- * error carries `raw`, the text actually returned).
682
+ * `request_invalid` (400the provider rejected the request itself:
683
+ * an unknown `model`, or a parameter outside the provider's validation;
684
+ * fix the request, retrying verbatim cannot help), `unavailable` (5xx —
685
+ * transient, back off), `invalid_json` (502 — a completion arrived but
686
+ * did not parse or did not satisfy the schema; the error carries `raw`,
687
+ * the text actually returned).
685
688
  *
686
689
  * `reasoningEffort` is the thinking budget, default `'low'`. It matters more
687
690
  * than it sounds for extraction: the shared one-shot floor is `'minimal'`,
@@ -922,6 +925,11 @@ export interface AdminClient {
922
925
  getSchedule(scheduleId: string): Promise<{
923
926
  schedule: unknown;
924
927
  }>;
928
+ /** PATCH a schedule. Re-enabling can refuse with 409 — switch on
929
+ * `AdminApiError.code`: `one_shot_spent` (this one-shot already fired;
930
+ * create a new schedule), `ghost_row` (a legacy incomplete row that can
931
+ * never fire; delete it), or `schedule_limit_reached` (the enabled-count
932
+ * ceiling). */
925
933
  updateSchedule(scheduleId: string, patch: Record<string, unknown>): Promise<{
926
934
  schedule: unknown;
927
935
  }>;
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.24.1';
11
+ export const ADMIN_SDK_VERSION = '0.25.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;
@@ -71,6 +71,8 @@ export function requestDeadlineMs(method, path) {
71
71
  * different recoveries. `code` is the only thing that tells them apart. */
72
72
  export const ADMIN_ERROR_CODES = [
73
73
  'schedule_limit_reached',
74
+ 'one_shot_spent',
75
+ 'ghost_row',
74
76
  'channel_limit_reached',
75
77
  'webhook_limit_reached',
76
78
  'run_limit_reached',
@@ -86,7 +88,7 @@ export const ADMIN_ERROR_CODES = [
86
88
  * backoff in SECONDS on a 429 (undefined on every other failure); `code` is the
87
89
  * server's machine tag when it named one (undefined otherwise).
88
90
  *
89
- * Why `code` exists: the Admin API's ten machine-readable failures are ALL on
91
+ * Why `code` exists: the Admin API's machine-readable failures are ALL on
90
92
  * 409, so `status` cannot separate them and this package used to discard the
91
93
  * one field that can. Two routes are the point — `resumeRun` answers 409 for
92
94
  * `run_not_parked` (someone already decided; re-read, do not retry) or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pouchy_ai/admin-sdk",
3
- "version": "0.24.1",
3
+ "version": "0.25.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",