@pouchy_ai/admin-sdk 0.14.0 → 0.15.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 +22 -0
- package/README.md +4 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@pouchy_ai/admin-sdk` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.15.0 — 2026-08-03
|
|
6
|
+
|
|
7
|
+
- **`MonthUsage` now types the whole meter, including credits and voice.** The
|
|
8
|
+
interface declared six fields (`month`, `mau`, `mauLimit`, `sessions`,
|
|
9
|
+
`tokensIn`, `tokensOut`) while `GET /usage` returns sixteen. The rest fell
|
|
10
|
+
through the `[k: string]: unknown` index signature, so they were reachable but
|
|
11
|
+
typed `unknown` — `usage.credits > limit` did not compile, and reading the
|
|
12
|
+
product's metered units from the typed client required a cast. Newly declared:
|
|
13
|
+
- `credits`, `creditsByDay`, `creditLimit` — the per-turn credit meter;
|
|
14
|
+
- `creditsVoice`, `voiceMs`, `voiceCalls` — the realtime-voice slice of
|
|
15
|
+
`credits` and the measured minutes behind it. Voice is the most expensive
|
|
16
|
+
metered unit, so this is the split worth alerting on;
|
|
17
|
+
- `mauTest`, `sessionsByDay`, `mauByDay`, `tokensByDay` — the test-key MAU
|
|
18
|
+
count and the per-day chart buckets.
|
|
19
|
+
|
|
20
|
+
Additive and backwards-compatible: the index signature is retained, and every
|
|
21
|
+
new field is optional so the package stays honest against a deployment that
|
|
22
|
+
predates one. No runtime change — this release is types and docs only.
|
|
23
|
+
|
|
24
|
+
A drift gate now pins the interface against the server's usage reader, so the
|
|
25
|
+
next field added server-side cannot silently skip the package again.
|
|
26
|
+
|
|
5
27
|
## 0.14.0 — 2026-08-02
|
|
6
28
|
|
|
7
29
|
- **Channel provider registration is now typed.** The server registers
|
package/README.md
CHANGED
|
@@ -37,9 +37,12 @@ await admin.updateAgent(agent.agentId, { status: 'published' });
|
|
|
37
37
|
const { key } = await admin.createKey({ label: 'prod-backend', env: 'live' });
|
|
38
38
|
console.log(key); // the plaintext token — shown ONCE
|
|
39
39
|
|
|
40
|
-
// Read this month's usage
|
|
40
|
+
// Read this month's usage — MAU, tokens, and the credit meter (all typed)
|
|
41
41
|
const { usage } = await admin.getUsage();
|
|
42
42
|
console.log(usage.mau, '/', usage.mauLimit, 'MAU');
|
|
43
|
+
console.log(usage.credits, '/', usage.creditLimit, 'credits');
|
|
44
|
+
// Voice is the priciest metered unit — watch its slice, not just the total
|
|
45
|
+
console.log(usage.creditsVoice, 'of those credits were', usage.voiceCalls, 'voice calls');
|
|
43
46
|
|
|
44
47
|
// Equip an agent with ANY skill — including a docs-only skill.md that has no
|
|
45
48
|
// `tools:` block — entirely via the API:
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ADMIN_SDK_VERSION = "0.
|
|
1
|
+
export declare const ADMIN_SDK_VERSION = "0.15.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
|
|
@@ -211,13 +211,52 @@ export interface Instance {
|
|
|
211
211
|
lastActiveAt: string;
|
|
212
212
|
suspended?: boolean;
|
|
213
213
|
}
|
|
214
|
+
/** The current month's meter, as `GET /usage` returns it.
|
|
215
|
+
*
|
|
216
|
+
* Every field the server sends is declared. The index signature stays for
|
|
217
|
+
* forward compatibility with a newer server, but it is a fallback, not the
|
|
218
|
+
* contract: reaching a field THROUGH it yields `unknown`, so
|
|
219
|
+
* `usage.credits > limit` does not compile and an integrator has to cast — the
|
|
220
|
+
* same untyped-surface friction the channel-provisioning gap caused. The
|
|
221
|
+
* credit/voice fields below are the ones that bit: they are the product's
|
|
222
|
+
* metered units, and they shipped server-side (and in the OpenAPI) while this
|
|
223
|
+
* interface still described only MAU and tokens.
|
|
224
|
+
*
|
|
225
|
+
* All but `month` are optional so the package stays honest against an OLDER
|
|
226
|
+
* deployment that predates a field — a self-hosted server on a prior release
|
|
227
|
+
* really can omit the voice trio, and typing them as required would be the
|
|
228
|
+
* package asserting something it cannot know. */
|
|
214
229
|
export interface MonthUsage {
|
|
215
230
|
month: string;
|
|
216
231
|
mau: number;
|
|
232
|
+
/** Sessions minted by TEST keys — metered but never gated. */
|
|
233
|
+
mauTest?: number;
|
|
234
|
+
/** The plan's monthly MAU cap. ACCOUNT-scoped (pooled across the owner's
|
|
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. */
|
|
217
239
|
mauLimit: number;
|
|
218
240
|
sessions: number;
|
|
219
241
|
tokensIn: number;
|
|
220
242
|
tokensOut: number;
|
|
243
|
+
/** Per-UTC-day buckets, `{ 'YYYY-MM-DD': n }` — for charts. */
|
|
244
|
+
sessionsByDay?: Record<string, number>;
|
|
245
|
+
mauByDay?: Record<string, number>;
|
|
246
|
+
tokensByDay?: Record<string, number>;
|
|
247
|
+
creditsByDay?: Record<string, number>;
|
|
248
|
+
/** Credits consumed this month: one per completed standard turn, the Pro
|
|
249
|
+
* multiplier per Pro turn, and the per-minute rate for realtime voice. */
|
|
250
|
+
credits?: number;
|
|
251
|
+
/** The VOICE slice of `credits`, and the measured minutes it came from.
|
|
252
|
+
* Project-scoped: the pooled account counter carries no per-source
|
|
253
|
+
* breakdown. Voice is by far the most expensive metered unit, so this is
|
|
254
|
+
* the split to watch before a bill surprises anyone. */
|
|
255
|
+
creditsVoice?: number;
|
|
256
|
+
voiceMs?: number;
|
|
257
|
+
voiceCalls?: number;
|
|
258
|
+
/** The plan's monthly credit allowance (account-level, like `mauLimit`). */
|
|
259
|
+
creditLimit?: number;
|
|
221
260
|
[k: string]: unknown;
|
|
222
261
|
}
|
|
223
262
|
/** One month of the usage-history series. Unlike `MonthUsage` (the current
|
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.
|
|
11
|
+
export const ADMIN_SDK_VERSION = '0.15.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.
|
|
3
|
+
"version": "0.15.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",
|