@pouchy_ai/admin-sdk 0.15.0 → 0.16.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,54 @@
2
2
 
3
3
  All notable changes to `@pouchy_ai/admin-sdk` are documented here.
4
4
 
5
+ ## 0.16.0 — 2026-08-06
6
+
7
+ - **Catches the package up to a server change that already shipped.**
8
+ `PATCH /skills/{slug}` with `{ ratePerMin }` used to be the only skill knob
9
+ that did not push the updated def to the project's running instances — and the
10
+ per-minute budget is read off each instance's provisioned def, not the record
11
+ the PATCH writes, so a rate you set persisted, echoed back on read, and reached
12
+ **no running agent** until an unrelated persona edit bumped the agent's
13
+ `templateRev`. That was fixed server-side, and every knob now also returns
14
+ `truncated`. This package still typed the old shapes — `setSkillRate` as
15
+ `Promise<{ ratePerMin }>`, the other two without `truncated` — so the typed
16
+ client was asserting a contract the server had already stopped honouring.
17
+
18
+ - **New `SkillKnobResult<T>` — every skill knob returns `reprovisioned` and
19
+ `truncated`.** `setSkillRate`, `setSkillDailyCap` and `grantSkill` now share
20
+ one result shape. `truncated: true` means the re-push swept its cap (100
21
+ agents / 200 instances) and the remainder were NOT refreshed — and they do not
22
+ catch up on their next session, they keep the OLD def until a persona edit
23
+ bumps `templateRev`. **A revoking call that returns `truncated: true` is a
24
+ PARTIAL revocation**; re-issue it or make a persona edit before treating it as
25
+ complete.
26
+
27
+ Additive and backward compatible: the previously-returned fields are all still
28
+ present with the same names and types, so existing destructuring keeps
29
+ compiling. Only widen your own annotations if you had hand-written the old
30
+ return types.
31
+
32
+ ## 0.15.1 — 2026-08-03
33
+
34
+ - **Docs fix: `MonthUsage.mauLimit` prescribed a call that does not compile.**
35
+ 0.15.0 documented the account-scope workaround as
36
+ `getUsageHistory({ scope: 'account' })`. `scope` is a **response**
37
+ discriminant the server decides — `GET /usage/history` reads only `months` —
38
+ so the literal fails excess-property checking against the method's own
39
+ declared `{ months?: number }`, and casting past it just appends a query
40
+ parameter nothing reads. The advice is now the call that works: invoke
41
+ `getUsageHistory()` and read the returned `scope`, which is `'account'`
42
+ whenever the server can resolve one and `'project'` when it cannot. Note the
43
+ consequence the old wording hid — there is no way to *force* account scope, so
44
+ a `'project'` series on a multi-project account carries the same
45
+ understatement as `mau` itself.
46
+
47
+ No type or runtime change; every 0.15.0 signature is unchanged.
48
+
49
+ A drift gate now checks every documented `method({ key … })` example in the
50
+ source and the README against the keys that method actually declares, so the
51
+ next piece of prose that outruns the surface fails a merge.
52
+
5
53
  ## 0.15.0 — 2026-08-03
6
54
 
7
55
  - **`MonthUsage` now types the whole meter, including credits and voice.** The
package/README.md CHANGED
@@ -58,6 +58,14 @@ console.log(`armed — ${armed.reprovisioned} running instance(s) updated`);
58
58
  // The agent can now drive the API from the skill's prose via http_request.
59
59
  ```
60
60
 
61
+ Every skill knob (`setSkillRate`, `setSkillDailyCap`, `grantSkill`) returns
62
+ `SkillKnobResult<T>` — the knob you set plus `reprovisioned` (instances the new
63
+ def reached) and `truncated`. A knob only binds a running agent once the def
64
+ reaches its instance, so `truncated: true` means the sweep hit its cap (100
65
+ agents / 200 instances) and the remainder still hold the **old** def; they do
66
+ not catch up on their next session. Treat a *revoking* call that returns
67
+ `truncated: true` as a partial revocation and re-issue it.
68
+
61
69
  ## Options
62
70
 
63
71
  ```ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const ADMIN_SDK_VERSION = "0.15.0";
1
+ export declare const ADMIN_SDK_VERSION = "0.16.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
@@ -233,9 +233,16 @@ export interface MonthUsage {
233
233
  mauTest?: number;
234
234
  /** The plan's monthly MAU cap. ACCOUNT-scoped (pooled across the owner's
235
235
  * projects) while `mau` above is this project's slice, so `mau / mauLimit`
236
- * understates consumption on a multi-project account — compare against the
237
- * pooled figure from `getUsageHistory({ scope: 'account' })` when you need
238
- * the number the mint gate actually enforces. */
236
+ * understates consumption on a multi-project account.
237
+ *
238
+ * For the number the mint gate actually enforces, call `getUsageHistory()`
239
+ * and READ its `scope`: the server pools across the account whenever it can
240
+ * resolve one and answers `scope: 'account'`, falling back to this project's
241
+ * own slice (`'project'`) when it cannot. `scope` is a response
242
+ * discriminant, not a request option — there is no parameter that forces
243
+ * account scope, so a series that comes back `'project'` on a multi-project
244
+ * account means the account could not be resolved, and comparing it against
245
+ * `mauLimit` has the same understatement as `mau` does. */
239
246
  mauLimit: number;
240
247
  sessions: number;
241
248
  tokensIn: number;
@@ -414,6 +421,21 @@ export interface AdminRun {
414
421
  createdAt: string;
415
422
  updatedAt: string;
416
423
  }
424
+ /** What every skill-knob PATCH reports about the re-push, on top of the knob it
425
+ * echoes. A knob only takes effect on a running agent once the def reaches its
426
+ * instance, so these two fields are the outcome, not decoration.
427
+ *
428
+ * `reprovisioned` — instances refreshed by this call.
429
+ * `truncated` — the sweep hit a cap (100 agents / 200 instances) and the
430
+ * remainder were NOT refreshed. They do not catch up on their next session:
431
+ * they keep the OLD def until a persona edit bumps the agent's templateRev. So
432
+ * a revoking call (e.g. clearing a grant) that returns `truncated: true` is a
433
+ * PARTIAL revocation — re-issue it, or make a persona edit, before treating it
434
+ * as complete. */
435
+ export type SkillKnobResult<T> = T & {
436
+ reprovisioned: number;
437
+ truncated: boolean;
438
+ };
417
439
  export interface AdminClient {
418
440
  listAgents(): Promise<{
419
441
  agents: Agent[];
@@ -649,23 +671,26 @@ export interface AdminClient {
649
671
  version: number;
650
672
  };
651
673
  }>;
652
- /** Generic PATCH of a skill's knobs. The response echoes only the knob(s)
653
- * you changed (e.g. `{ ratePerMin }`, `{ maxCallsPerDay, reprovisioned }`,
654
- * `{ freeHttp, grantedDomains, reprovisioned }`) — prefer the typed
655
- * conveniences (setSkillRate / setSkillDailyCap / grantSkill) for a precise
656
- * return type. */
674
+ /** Generic PATCH of a skill's knobs. The response echoes the knob(s) you
675
+ * changed plus the re-push outcome every knob now carries
676
+ * (`reprovisioned`, `truncated`) — prefer the typed conveniences
677
+ * (setSkillRate / setSkillDailyCap / grantSkill) for a precise return
678
+ * type. */
657
679
  updateSkill(slug: string, patch: Record<string, unknown>): Promise<Record<string, unknown>>;
658
- /** Set a skill's per-minute call budget (1..120; null restores the default). */
659
- setSkillRate(slug: string, ratePerMin: number | null): Promise<{
680
+ /** Set a skill's per-minute call budget (1..120; null restores the default).
681
+ * Re-pushes the def to running instances — the limiter reads the budget off
682
+ * each instance's provisioned def, so a saved rate that was not re-pushed
683
+ * reached no running agent (server-side fix; this signature now carries the
684
+ * outcome the other knobs already returned). */
685
+ setSkillRate(slug: string, ratePerMin: number | null): Promise<SkillKnobResult<{
660
686
  ratePerMin: number | null;
661
- }>;
687
+ }>>;
662
688
  /** Set a skill's opt-in daily call ceiling — max HTTP calls per rolling 24h
663
689
  * (1..20000; null clears it, leaving only the per-minute cap). A runaway
664
690
  * guard for autonomous outbound. Re-pushes the def to running instances. */
665
- setSkillDailyCap(slug: string, maxCallsPerDay: number | null): Promise<{
691
+ setSkillDailyCap(slug: string, maxCallsPerDay: number | null): Promise<SkillKnobResult<{
666
692
  maxCallsPerDay: number | null;
667
- reprovisioned: number;
668
- }>;
693
+ }>>;
669
694
  /** Compile a docs-only skill's prose (curl snippets / endpoint tables) into
670
695
  * declared `http` tools via a one-shot LLM, then re-install the result
671
696
  * (safety gate + version archive → reversible via rollback). Each tool is
@@ -687,11 +712,10 @@ export interface AdminClient {
687
712
  grantSkill(slug: string, grant: {
688
713
  freeHttp: boolean;
689
714
  grantedDomains?: string[];
690
- }): Promise<{
715
+ }): Promise<SkillKnobResult<{
691
716
  freeHttp: boolean;
692
717
  grantedDomains: string[];
693
- reprovisioned: number;
694
- }>;
718
+ }>>;
695
719
  uninstallSkill(slug: string): Promise<{
696
720
  deleted: boolean;
697
721
  }>;
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.15.0';
11
+ export const ADMIN_SDK_VERSION = '0.16.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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pouchy_ai/admin-sdk",
3
- "version": "0.15.0",
3
+ "version": "0.16.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",