@pouchy_ai/admin-sdk 0.3.0 → 0.4.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 +43 -0
- package/README.md +3 -3
- package/dist/index.d.ts +71 -31
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@pouchy_ai/admin-sdk` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.4.1 — 2026-07-16
|
|
6
|
+
|
|
7
|
+
Type-shape corrections — several method signatures had drifted from the live
|
|
8
|
+
`/v1/admin` routes, so a caller trusting the types built request bodies the
|
|
9
|
+
server rejects or read response fields that don't exist. No runtime code
|
|
10
|
+
changed (the client is a generic proxy); these are type + doc fixes.
|
|
11
|
+
|
|
12
|
+
- **`createSchedule`** now requires `externalUserId` + `prompt` alongside
|
|
13
|
+
`agentId` and schedules by `intervalMinutes`/`runAt` — the old `{ agentId,
|
|
14
|
+
cron, prompt? }` was unusable (there is no `cron` field; the server 400s
|
|
15
|
+
without `externalUserId`). Return is `{ schedule: { id } }` (was
|
|
16
|
+
`scheduleId`).
|
|
17
|
+
- **`ingestKnowledge`** input is `{ text, name?, kind?, locale? }` — the old
|
|
18
|
+
`title`/`url` fields were silently ignored by the server.
|
|
19
|
+
- **`getUserWallet`** returns `{ hasWallet, balance: string | null }` (a prose
|
|
20
|
+
balance string), not `{ balance: number, address }`.
|
|
21
|
+
- **`createKey`** returns `{ key: string, record }` (plaintext token in `key`);
|
|
22
|
+
the README example logged the nonexistent `key.token`.
|
|
23
|
+
- **`getUsage`** returns `{ usage }` and **`getBilling`** returns `{ billing,
|
|
24
|
+
ledger }` (both were typed flat); the README `usage.mau` example is fixed.
|
|
25
|
+
- **Channels** methods return `connector`/`connectors` (was `channel`), and
|
|
26
|
+
`deleteChannel`/`deleteSchedule` return `{ ok }` (was `{ deleted }`).
|
|
27
|
+
- **`listUsers`** params are `{ external_user_id?, external_user_prefix? }`
|
|
28
|
+
(the old `{ q, limit }` were no-ops; the server hard-caps at 100).
|
|
29
|
+
- **`updateSkill`** generic return is `Record<string, unknown>` (it echoes only
|
|
30
|
+
the changed knob) — prefer the typed `setSkillRate`/`setSkillDailyCap`/
|
|
31
|
+
`grantSkill` conveniences, which were already correct.
|
|
32
|
+
|
|
33
|
+
## 0.4.0 — 2026-07-13
|
|
34
|
+
|
|
35
|
+
Full skill-lifecycle parity — the two knobs the dashboard grew (a runaway
|
|
36
|
+
guard + the prose→tools upgrade) are now typed on the client:
|
|
37
|
+
|
|
38
|
+
- **`setSkillDailyCap(slug, maxCallsPerDay)`** — the opt-in daily call ceiling
|
|
39
|
+
(`PATCH /v1/admin/skills/{slug}` with `{ maxCallsPerDay }`, 1..20000, null to
|
|
40
|
+
clear): max HTTP calls per rolling 24h for a skill, a runaway guard for
|
|
41
|
+
autonomous outbound the per-minute cap doesn't cover. Returns `reprovisioned`.
|
|
42
|
+
- **`compileSkill(slug)`** — compile a docs-only skill's prose into declared
|
|
43
|
+
`http` tools (`POST /v1/admin/skills/{slug}/compile`): a one-shot LLM proposes
|
|
44
|
+
tools bound to the skill's allowlist, re-installed (reversible via rollback).
|
|
45
|
+
Returns `{ skill, toolNames, warnings }`.
|
|
46
|
+
- (Also fixes the `ADMIN_SDK_VERSION` constant, which had drifted to `0.2.0`.)
|
|
47
|
+
|
|
5
48
|
## 0.3.0 — 2026-07-13
|
|
6
49
|
|
|
7
50
|
Skill-config parity — a docs-only skill (no `tools:` block) can now be
|
package/README.md
CHANGED
|
@@ -35,10 +35,10 @@ await admin.updateAgent(agent.agentId, { status: 'published' });
|
|
|
35
35
|
|
|
36
36
|
// Mint a secret key for your backend to open end-user sessions with
|
|
37
37
|
const { key } = await admin.createKey({ label: 'prod-backend', env: 'live' });
|
|
38
|
-
console.log(key
|
|
38
|
+
console.log(key); // the plaintext token — shown ONCE
|
|
39
39
|
|
|
40
40
|
// Read this month's usage
|
|
41
|
-
const usage = await admin.getUsage();
|
|
41
|
+
const { usage } = await admin.getUsage();
|
|
42
42
|
console.log(usage.mau, '/', usage.mauLimit, 'MAU');
|
|
43
43
|
|
|
44
44
|
// Equip an agent with ANY skill — including a docs-only skill.md that has no
|
|
@@ -87,7 +87,7 @@ try {
|
|
|
87
87
|
| Secret keys | `listKeys` · `createKey` · `revokeKey` · `rotateKey` (24 h grace) |
|
|
88
88
|
| End users | `listUsers` · `setUserSuspended` · `deleteUser` · `getUserWallet` · `getUserTraces` · `importUsers` · `exportUser` · `getUserSessions` · `getUserTurns` |
|
|
89
89
|
| Knowledge | `listKnowledge` · `ingestKnowledge` · `deleteKnowledge` |
|
|
90
|
-
| Skills | `listSkills` · `installSkill` · `updateSkill` · `setSkillRate` · `grantSkill` (free-HTTP) · `uninstallSkill` |
|
|
90
|
+
| Skills | `listSkills` · `installSkill` · `updateSkill` · `setSkillRate` · `setSkillDailyCap` · `grantSkill` (free-HTTP) · `compileSkill` (prose→tools) · `uninstallSkill` |
|
|
91
91
|
| Credentials | `listCredentials` · `putCredentials` · `deleteCredentials` |
|
|
92
92
|
| Channels | `listChannels` · `createChannel` · `getChannel` · `updateChannel` · `deleteChannel` |
|
|
93
93
|
| Schedules | `listSchedules` · `createSchedule` · `getSchedule` · `updateSchedule` · `deleteSchedule` |
|
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.4.1";
|
|
2
2
|
export declare const DEFAULT_BASE_URL = "https://pouchy.ai/v1/admin";
|
|
3
3
|
export interface AdminClientOptions {
|
|
4
4
|
/** A project Admin key (`pchy_admin_…`) from the dashboard Admin Keys page. */
|
|
@@ -127,15 +127,14 @@ export interface AdminClient {
|
|
|
127
127
|
listKeys(): Promise<{
|
|
128
128
|
keys: SecretKey[];
|
|
129
129
|
}>;
|
|
130
|
+
/** Mint a secret key. `key` is the plaintext token, returned ONCE; `record`
|
|
131
|
+
* is the stored metadata (no plaintext). */
|
|
130
132
|
createKey(input: {
|
|
131
133
|
label?: string;
|
|
132
134
|
env?: Env;
|
|
133
135
|
}): Promise<{
|
|
134
|
-
key:
|
|
135
|
-
|
|
136
|
-
token: string;
|
|
137
|
-
env: Env;
|
|
138
|
-
};
|
|
136
|
+
key: string;
|
|
137
|
+
record: SecretKey;
|
|
139
138
|
}>;
|
|
140
139
|
revokeKey(keyId: string): Promise<{
|
|
141
140
|
revoked: boolean;
|
|
@@ -152,9 +151,11 @@ export interface AdminClient {
|
|
|
152
151
|
graceUntil: string | null;
|
|
153
152
|
};
|
|
154
153
|
}>;
|
|
154
|
+
/** List end-user instances. Filter by exact external id or by prefix (the
|
|
155
|
+
* server ignores any other query param and hard-caps the page at 100). */
|
|
155
156
|
listUsers(params?: {
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
external_user_id?: string;
|
|
158
|
+
external_user_prefix?: string;
|
|
158
159
|
}): Promise<{
|
|
159
160
|
users: Instance[];
|
|
160
161
|
}>;
|
|
@@ -164,9 +165,12 @@ export interface AdminClient {
|
|
|
164
165
|
deleteUser(instanceId: string): Promise<{
|
|
165
166
|
deleted: boolean;
|
|
166
167
|
}>;
|
|
168
|
+
/** The instance companion's wallet. `balance` is a human-readable prose
|
|
169
|
+
* string (e.g. "Wallet balance: … (~$X total)."), or null when the instance
|
|
170
|
+
* has no wallet — NOT a number, and there is no address field. */
|
|
167
171
|
getUserWallet(instanceId: string): Promise<{
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
hasWallet: boolean;
|
|
173
|
+
balance: string | null;
|
|
170
174
|
}>;
|
|
171
175
|
getUserTraces(instanceId: string): Promise<{
|
|
172
176
|
traces: unknown[];
|
|
@@ -199,10 +203,13 @@ export interface AdminClient {
|
|
|
199
203
|
listKnowledge(): Promise<{
|
|
200
204
|
docs: unknown[];
|
|
201
205
|
}>;
|
|
206
|
+
/** Ingest a knowledge doc. `text` is required; `name`/`kind`/`locale` are the
|
|
207
|
+
* server's fields (an earlier `title`/`url` shape was silently ignored). */
|
|
202
208
|
ingestKnowledge(input: {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
209
|
+
text: string;
|
|
210
|
+
name?: string;
|
|
211
|
+
kind?: string;
|
|
212
|
+
locale?: string;
|
|
206
213
|
}): Promise<{
|
|
207
214
|
doc: {
|
|
208
215
|
docId: string;
|
|
@@ -228,15 +235,35 @@ export interface AdminClient {
|
|
|
228
235
|
version: number;
|
|
229
236
|
};
|
|
230
237
|
}>;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
/** Generic PATCH of a skill's knobs. The response echoes only the knob(s)
|
|
239
|
+
* you changed (e.g. `{ ratePerMin }`, `{ maxCallsPerDay, reprovisioned }`,
|
|
240
|
+
* `{ freeHttp, grantedDomains, reprovisioned }`) — prefer the typed
|
|
241
|
+
* conveniences (setSkillRate / setSkillDailyCap / grantSkill) for a precise
|
|
242
|
+
* return type. */
|
|
243
|
+
updateSkill(slug: string, patch: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
236
244
|
/** Set a skill's per-minute call budget (1..120; null restores the default). */
|
|
237
245
|
setSkillRate(slug: string, ratePerMin: number | null): Promise<{
|
|
238
246
|
ratePerMin: number | null;
|
|
239
247
|
}>;
|
|
248
|
+
/** Set a skill's opt-in daily call ceiling — max HTTP calls per rolling 24h
|
|
249
|
+
* (1..20000; null clears it, leaving only the per-minute cap). A runaway
|
|
250
|
+
* guard for autonomous outbound. Re-pushes the def to running instances. */
|
|
251
|
+
setSkillDailyCap(slug: string, maxCallsPerDay: number | null): Promise<{
|
|
252
|
+
maxCallsPerDay: number | null;
|
|
253
|
+
reprovisioned: number;
|
|
254
|
+
}>;
|
|
255
|
+
/** Compile a docs-only skill's prose (curl snippets / endpoint tables) into
|
|
256
|
+
* declared `http` tools via a one-shot LLM, then re-install the result
|
|
257
|
+
* (safety gate + version archive → reversible via rollback). Each tool is
|
|
258
|
+
* bound to the skill's allowlist; `warnings` lists any dropped by a bad host
|
|
259
|
+
* or shape. Turns a free-HTTP skill into structured `run_skill` tools. */
|
|
260
|
+
compileSkill(slug: string): Promise<{
|
|
261
|
+
skill: {
|
|
262
|
+
slug: string;
|
|
263
|
+
};
|
|
264
|
+
toolNames: string[];
|
|
265
|
+
warnings: string[];
|
|
266
|
+
}>;
|
|
240
267
|
/** Free-HTTP grant (universal import): let the agent drive this skill's API
|
|
241
268
|
* from its prose body via `http_request`, bounded to the manifest's
|
|
242
269
|
* `allowed_domains` ∪ `grantedDomains`. This is how a docs-only skill
|
|
@@ -267,37 +294,44 @@ export interface AdminClient {
|
|
|
267
294
|
deleted: boolean;
|
|
268
295
|
}>;
|
|
269
296
|
listChannels(): Promise<{
|
|
270
|
-
|
|
297
|
+
connectors: unknown[];
|
|
271
298
|
}>;
|
|
272
299
|
createChannel(input: {
|
|
273
300
|
type: string;
|
|
274
301
|
agentId: string;
|
|
275
302
|
config?: Record<string, unknown>;
|
|
276
303
|
}): Promise<{
|
|
277
|
-
|
|
304
|
+
connector: {
|
|
278
305
|
id: string;
|
|
279
306
|
};
|
|
280
307
|
inboundUrl: string;
|
|
281
308
|
}>;
|
|
282
309
|
getChannel(channelId: string): Promise<{
|
|
283
|
-
|
|
310
|
+
connector: unknown;
|
|
284
311
|
}>;
|
|
285
312
|
updateChannel(channelId: string, patch: Record<string, unknown>): Promise<{
|
|
286
|
-
|
|
313
|
+
connector: unknown;
|
|
287
314
|
}>;
|
|
288
315
|
deleteChannel(channelId: string): Promise<{
|
|
289
|
-
|
|
316
|
+
ok: boolean;
|
|
290
317
|
}>;
|
|
291
318
|
listSchedules(): Promise<{
|
|
292
319
|
schedules: unknown[];
|
|
293
320
|
}>;
|
|
321
|
+
/** Create a schedule. `externalUserId` and `prompt` are required alongside
|
|
322
|
+
* `agentId`; the schedule fires by `intervalMinutes` (recurring) or `runAt`
|
|
323
|
+
* (one-shot ISO time) — there is NO cron field. Returns the stored record,
|
|
324
|
+
* whose id lives on `.id`. */
|
|
294
325
|
createSchedule(input: {
|
|
295
326
|
agentId: string;
|
|
296
|
-
|
|
297
|
-
prompt
|
|
327
|
+
externalUserId: string;
|
|
328
|
+
prompt: string;
|
|
329
|
+
intervalMinutes?: number;
|
|
330
|
+
runAt?: string;
|
|
331
|
+
deliverTo?: unknown;
|
|
298
332
|
}): Promise<{
|
|
299
333
|
schedule: {
|
|
300
|
-
|
|
334
|
+
id: string;
|
|
301
335
|
};
|
|
302
336
|
}>;
|
|
303
337
|
getSchedule(scheduleId: string): Promise<{
|
|
@@ -307,7 +341,7 @@ export interface AdminClient {
|
|
|
307
341
|
schedule: unknown;
|
|
308
342
|
}>;
|
|
309
343
|
deleteSchedule(scheduleId: string): Promise<{
|
|
310
|
-
|
|
344
|
+
ok: boolean;
|
|
311
345
|
}>;
|
|
312
346
|
listWebhooks(): Promise<{
|
|
313
347
|
webhooks: unknown[];
|
|
@@ -344,11 +378,17 @@ export interface AdminClient {
|
|
|
344
378
|
testWebhook(webhookId: string): Promise<DeliveryOutcome>;
|
|
345
379
|
/** Manually re-send a recorded delivery's original body, re-signed. */
|
|
346
380
|
redeliverWebhook(deliveryId: string): Promise<DeliveryOutcome>;
|
|
347
|
-
getUsage(): Promise<
|
|
381
|
+
getUsage(): Promise<{
|
|
382
|
+
usage: MonthUsage;
|
|
383
|
+
}>;
|
|
348
384
|
getBilling(): Promise<{
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
385
|
+
billing: {
|
|
386
|
+
plan: string;
|
|
387
|
+
effectivePlan: string;
|
|
388
|
+
mauLimit: number;
|
|
389
|
+
periodEnd?: string;
|
|
390
|
+
};
|
|
391
|
+
ledger: unknown;
|
|
352
392
|
}>;
|
|
353
393
|
getTracesSummary(params?: {
|
|
354
394
|
agentId?: 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.
|
|
11
|
+
export const ADMIN_SDK_VERSION = '0.4.1';
|
|
12
12
|
export const DEFAULT_BASE_URL = 'https://pouchy.ai/v1/admin';
|
|
13
13
|
/** Thrown on any non-2xx response. `status` is the HTTP status; `message` is the
|
|
14
14
|
* server's `error` string when present. */
|
|
@@ -75,6 +75,8 @@ export function createAdminClient(opts) {
|
|
|
75
75
|
installSkill: (input) => request('POST', '/skills', input),
|
|
76
76
|
updateSkill: (slug, patch) => request('PATCH', `/skills/${encodeURIComponent(slug)}`, patch),
|
|
77
77
|
setSkillRate: (slug, ratePerMin) => request('PATCH', `/skills/${encodeURIComponent(slug)}`, { ratePerMin }),
|
|
78
|
+
setSkillDailyCap: (slug, maxCallsPerDay) => request('PATCH', `/skills/${encodeURIComponent(slug)}`, { maxCallsPerDay }),
|
|
79
|
+
compileSkill: (slug) => request('POST', `/skills/${encodeURIComponent(slug)}/compile`, {}),
|
|
78
80
|
grantSkill: (slug, grant) => request('PATCH', `/skills/${encodeURIComponent(slug)}`, {
|
|
79
81
|
freeHttp: grant.freeHttp,
|
|
80
82
|
grantedDomains: grant.grantedDomains ?? []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pouchy_ai/admin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Typed TypeScript client for the Pouchy Admin API — 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",
|