@pouchy_ai/admin-sdk 0.12.0 → 0.13.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,17 @@
2
2
 
3
3
  All notable changes to `@pouchy_ai/admin-sdk` are documented here.
4
4
 
5
+ ## 0.13.0 — 2026-08-02
6
+
7
+ - **`getUsageHistory({ months? })`** over `GET /v1/admin/usage/history` —
8
+ month-over-month `{ months: MonthUsageHistoryEntry[], scope }`, oldest
9
+ first, quiet months zero-filled. The route shipped with the 1.4.x history
10
+ work; this closes the package's own "new mirror ⇒ new method" convention
11
+ gap (a headless operator could read this month but not the history).
12
+ `scope: 'account'` is the pooled series the plan cap compares;
13
+ `'project'` is the fallback when the account can't be resolved.
14
+ `MonthUsageHistoryEntry` is exported.
15
+
5
16
  ## 0.12.0 — 2026-08-01
6
17
 
7
18
  - **Typed capability declarations.** `publishCapability` now takes a
package/README.md CHANGED
@@ -200,7 +200,7 @@ Reads (`GET`) are not covered by that bucket. `retryAfter` is available from
200
200
  | Durable runs | `listRuns` · `createRun` · `getRun` · `cancelRun` · `resumeRun` · `signalRun` |
201
201
  | Data capabilities | `listCapabilities` (heads + MASKED signing status) · `publishCapability` (TYPED `CapabilityDeclaration`; immutable next version, idempotent on content) · `setCapabilityDisabled` (per-capability live revoke) · `listCapabilityVersions` (history; rollback = republish an old declaration) · `testReadCapability` · `testActionCapability({ confirmDuplicates: true, … })` (REAL deliveries incl. intentional duplicates — 428 without consent) · `listActionExecutions` (the durable Action journal, incl. `authorizedBy: 'automation'`) · `listEventReceipts` (receipts + wake trail) |
202
202
  | Webhooks | `listWebhooks` · `createWebhook` · `updateWebhook` · `rotateWebhookSecret` · `deleteWebhook` · `testWebhook` · `redeliverWebhook` |
203
- | Reporting | `getUsage` · `getBilling` · `getTracesSummary` · `getRecentTraces` · `getLogs` · `getProject` · `updateProject` |
203
+ | Reporting | `getUsage` · `getUsageHistory` · `getBilling` · `getTracesSummary` · `getRecentTraces` · `getLogs` · `getProject` · `updateProject` |
204
204
  | Escape hatch | `request(method, path, body?)` — any endpoint not yet typed |
205
205
 
206
206
  Channel types are checked at compile time: `createChannel` takes a
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const ADMIN_SDK_VERSION = "0.12.0";
1
+ export declare const ADMIN_SDK_VERSION = "0.13.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
@@ -220,6 +220,16 @@ export interface MonthUsage {
220
220
  tokensOut: number;
221
221
  [k: string]: unknown;
222
222
  }
223
+ /** One month of the usage-history series. Unlike `MonthUsage` (the current
224
+ * month's full meter incl. day buckets and the cap), history rows are the
225
+ * compact per-month rollup the server keeps for every past month. */
226
+ export interface MonthUsageHistoryEntry {
227
+ month: string;
228
+ mau: number;
229
+ mauTest: number;
230
+ sessions: number;
231
+ [k: string]: unknown;
232
+ }
223
233
  export interface AuditRow {
224
234
  at: string;
225
235
  type: string;
@@ -670,8 +680,10 @@ export interface AdminClient {
670
680
  /** Create a schedule. `externalUserId` and `prompt` are required alongside
671
681
  * `agentId`; the schedule fires by `intervalMinutes` (recurring, >=5) or
672
682
  * `runAt` (one-shot **epoch milliseconds** — an ISO string is silently
673
- * ignored by the server) there is NO cron field. Returns the stored
674
- * record, whose id lives on `.id`. */
683
+ * ignored by the server; must be in the future a past `runAt` is a 400,
684
+ * with a 60s clock-skew grace) there is NO cron field. A storage outage
685
+ * answers 503, not a validation 400. Returns the stored record, whose id
686
+ * lives on `.id`. */
675
687
  createSchedule(input: {
676
688
  agentId: string;
677
689
  externalUserId: string;
@@ -918,6 +930,18 @@ export interface AdminClient {
918
930
  getUsage(): Promise<{
919
931
  usage: MonthUsage;
920
932
  }>;
933
+ /** Month-over-month usage series, oldest first; quiet months zero-fill
934
+ * rather than drop. `scope: 'account'` means the pooled account series —
935
+ * the figure the plan cap actually compares (a multi-project account's
936
+ * pooled number differs from any one project's slice); `'project'` is the
937
+ * fallback when the account can't be resolved. */
938
+ getUsageHistory(params?: {
939
+ /** Window size in months, clamped server-side to 1..24 (default 12). */
940
+ months?: number;
941
+ }): Promise<{
942
+ months: MonthUsageHistoryEntry[];
943
+ scope: 'account' | 'project';
944
+ }>;
921
945
  getBilling(): Promise<{
922
946
  billing: {
923
947
  plan: string;
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.12.0';
11
+ export const ADMIN_SDK_VERSION = '0.13.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;
@@ -302,6 +302,7 @@ export function createAdminClient(opts) {
302
302
  testWebhook: (id) => request('POST', `/webhooks/${encodeURIComponent(id)}/test`),
303
303
  redeliverWebhook: (id) => request('POST', `/webhooks/deliveries/${encodeURIComponent(id)}/redeliver`),
304
304
  getUsage: () => request('GET', '/usage'),
305
+ getUsageHistory: (params = {}) => request('GET', `/usage/history${qs(params)}`),
305
306
  getBilling: () => request('GET', '/billing'),
306
307
  getTracesSummary: (params) => request('GET', `/traces/summary${qs(params)}`),
307
308
  getRecentTraces: (params = {}) => request('GET', `/traces/recent${qs({ ...params, errorsOnly: params.errorsOnly ? '1' : undefined })}`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pouchy_ai/admin-sdk",
3
- "version": "0.12.0",
3
+ "version": "0.13.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",