@pouchy_ai/admin-sdk 0.5.0 → 0.6.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 +29 -0
- package/README.md +2 -1
- package/dist/index.d.ts +99 -1
- package/dist/index.js +10 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@pouchy_ai/admin-sdk` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.6.0 — 2026-07-21
|
|
6
|
+
|
|
7
|
+
Additive: knowledge ingestion parity + headless agent version control. Both
|
|
8
|
+
close a documented owner-console-only gap so the whole build-and-serve loop is
|
|
9
|
+
now reachable with a `pchy_admin_…` key.
|
|
10
|
+
|
|
11
|
+
- **Knowledge ingestion beyond raw text.** Three new methods mirror the
|
|
12
|
+
dashboard's knowledge tab, sharing the exact server-side pipelines:
|
|
13
|
+
- **`ingestKnowledgeFile({ dataUrl, name?, kind?, locale?, replaceDocId? })`**
|
|
14
|
+
— ingest a PDF / audio / video / image data URL; the server runs the same
|
|
15
|
+
understanding (OCR / Whisper / vision caption) as the SDK personal-materials
|
|
16
|
+
path, then chunks + embeds into the shared corpus.
|
|
17
|
+
- **`ingestKnowledgeUrl({ url, name?, locale?, replaceDocId? })`** — ingest a
|
|
18
|
+
web page (https only, SSRF-guarded fetch, HTML reduced to text).
|
|
19
|
+
- **`searchKnowledge(query)`** — recall probe: run the SAME retrieval an
|
|
20
|
+
instance turn uses and get the ranked chunks back, without burning an LLM
|
|
21
|
+
turn. `mode` is `semantic` or `lexical`.
|
|
22
|
+
- **Agent version control (headless GitOps of a persona).** Six methods:
|
|
23
|
+
`listAgentVersions`, `getAgentVersion`, `diffAgentVersions`, `rollbackAgent`,
|
|
24
|
+
`getAgentPromotion`, `promoteAgent`. Inspect the rolling revision history,
|
|
25
|
+
diff any two revisions (or against `current`), roll back (git-revert
|
|
26
|
+
semantics), and drive staging→prod promotion — all previously
|
|
27
|
+
owner-session-only.
|
|
28
|
+
|
|
29
|
+
Server: adds `POST /v1/admin/knowledge/{file,url,search}`,
|
|
30
|
+
`GET /v1/admin/agents/{agentId}/versions[/{rev}|/diff]`,
|
|
31
|
+
`POST /v1/admin/agents/{agentId}/versions/rollback`, and
|
|
32
|
+
`GET|POST /v1/admin/agents/{agentId}/promote`. No breaking changes.
|
|
33
|
+
|
|
5
34
|
## 0.5.0 — 2026-07-17
|
|
6
35
|
|
|
7
36
|
Additive: end-user listing pagination.
|
package/README.md
CHANGED
|
@@ -86,10 +86,11 @@ try {
|
|
|
86
86
|
| Area | Methods |
|
|
87
87
|
| --- | --- |
|
|
88
88
|
| Agents | `listAgents` · `createAgent` · `getAgent` · `updateAgent` · `deleteAgent` |
|
|
89
|
+
| Agent versions | `listAgentVersions` · `getAgentVersion` · `diffAgentVersions({ from?, to? })` · `rollbackAgent` · `getAgentPromotion` · `promoteAgent` (staging→prod) |
|
|
89
90
|
| Voices | `listVoices({ gender?, age?, locale? })` — catalog for programmatic voice selection (each `CatalogVoice` carries `age`) |
|
|
90
91
|
| Secret keys | `listKeys` · `createKey` · `revokeKey` · `rotateKey` (24 h grace) |
|
|
91
92
|
| End users | `listUsers({ limit?, cursor? })` (cursor-paginated — the response's `nextCursor` feeds the next page; filter variants: `external_user_id` / `external_user_prefix`) · `setUserSuspended` · `deleteUser` · `getUserWallet` · `getUserTraces` · `importUsers` · `exportUser` · `getUserSessions` · `getUserTurns` |
|
|
92
|
-
| Knowledge | `listKnowledge` · `ingestKnowledge` · `deleteKnowledge` |
|
|
93
|
+
| Knowledge | `listKnowledge` · `ingestKnowledge` · `ingestKnowledgeFile` (PDF/audio/video/image) · `ingestKnowledgeUrl` (web page) · `searchKnowledge` (recall probe) · `deleteKnowledge` |
|
|
93
94
|
| Skills | `listSkills` · `installSkill` · `updateSkill` · `setSkillRate` · `setSkillDailyCap` · `grantSkill` (free-HTTP) · `compileSkill` (prose→tools) · `uninstallSkill` |
|
|
94
95
|
| Credentials | `listCredentials` · `putCredentials` · `deleteCredentials` |
|
|
95
96
|
| Channels | `listChannels` · `createChannel` · `getChannel` · `updateChannel` · `deleteChannel` |
|
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.6.0";
|
|
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. */
|
|
@@ -132,6 +132,62 @@ export interface AdminClient {
|
|
|
132
132
|
deleteAgent(agentId: string): Promise<{
|
|
133
133
|
deleted: boolean;
|
|
134
134
|
}>;
|
|
135
|
+
/** Archived template revisions, newest first. The live/current template is
|
|
136
|
+
* NOT in here — it lives on the agent doc; a snapshot is created only when a
|
|
137
|
+
* persona edit supersedes a rev. */
|
|
138
|
+
listAgentVersions(agentId: string): Promise<{
|
|
139
|
+
versions: Array<{
|
|
140
|
+
version: number;
|
|
141
|
+
templateRev: number;
|
|
142
|
+
archivedAt: string;
|
|
143
|
+
name: string;
|
|
144
|
+
}>;
|
|
145
|
+
}>;
|
|
146
|
+
/** One archived template snapshot — the full frozen agent for that revision. */
|
|
147
|
+
getAgentVersion(agentId: string, rev: number): Promise<{
|
|
148
|
+
version: Agent;
|
|
149
|
+
}>;
|
|
150
|
+
/** Field-level diff between two revisions. `from`/`to` are each an archived
|
|
151
|
+
* version number or `current` (default) = the live template; only changed
|
|
152
|
+
* fields are returned. */
|
|
153
|
+
diffAgentVersions(agentId: string, opts?: {
|
|
154
|
+
from?: number | 'current';
|
|
155
|
+
to?: number | 'current';
|
|
156
|
+
}): Promise<{
|
|
157
|
+
from: string;
|
|
158
|
+
to: string;
|
|
159
|
+
diff: Array<{
|
|
160
|
+
field: string;
|
|
161
|
+
from: unknown;
|
|
162
|
+
to: unknown;
|
|
163
|
+
}>;
|
|
164
|
+
}>;
|
|
165
|
+
/** Roll an agent back to an archived revision. git-revert semantics: the
|
|
166
|
+
* snapshot re-applies as a NEW edit (rev moves forward), the current state is
|
|
167
|
+
* archived first. */
|
|
168
|
+
rollbackAgent(agentId: string, version: number): Promise<{
|
|
169
|
+
agent: Agent;
|
|
170
|
+
}>;
|
|
171
|
+
/** Promotion status: the head (staging) vs the pinned production version, plus
|
|
172
|
+
* the diff a promotion would ship (empty when in sync). `pending` is false
|
|
173
|
+
* when the agent was never promoted (live follows the head). */
|
|
174
|
+
getAgentPromotion(agentId: string): Promise<{
|
|
175
|
+
stagingRev: number;
|
|
176
|
+
prodRev: number | null;
|
|
177
|
+
pending: boolean;
|
|
178
|
+
diff: Array<{
|
|
179
|
+
field: string;
|
|
180
|
+
from: unknown;
|
|
181
|
+
to: unknown;
|
|
182
|
+
}>;
|
|
183
|
+
}>;
|
|
184
|
+
/** Promote the head to production: freezes the head as an archived version and
|
|
185
|
+
* pins prodRev WITHOUT bumping the rev. Live instances re-resolve on their
|
|
186
|
+
* next mint; test instances always run the head. */
|
|
187
|
+
promoteAgent(agentId: string): Promise<{
|
|
188
|
+
prodRev: number;
|
|
189
|
+
templateRev: number;
|
|
190
|
+
}>;
|
|
135
191
|
listKeys(): Promise<{
|
|
136
192
|
keys: SecretKey[];
|
|
137
193
|
}>;
|
|
@@ -230,6 +286,48 @@ export interface AdminClient {
|
|
|
230
286
|
chunks: number;
|
|
231
287
|
};
|
|
232
288
|
}>;
|
|
289
|
+
/** Ingest a RAW file (PDF / audio / video / image data URL) into the shared
|
|
290
|
+
* corpus — same server-side understanding (OCR / Whisper / vision caption)
|
|
291
|
+
* as the SDK personal-materials path, then chunk + embed. `replaceDocId`
|
|
292
|
+
* updates an existing doc in place. */
|
|
293
|
+
ingestKnowledgeFile(input: {
|
|
294
|
+
dataUrl: string;
|
|
295
|
+
name?: string;
|
|
296
|
+
kind?: string;
|
|
297
|
+
locale?: string;
|
|
298
|
+
replaceDocId?: string;
|
|
299
|
+
}): Promise<{
|
|
300
|
+
ok: boolean;
|
|
301
|
+
doc: {
|
|
302
|
+
docId: string;
|
|
303
|
+
chunks: number;
|
|
304
|
+
};
|
|
305
|
+
summary?: string;
|
|
306
|
+
}>;
|
|
307
|
+
/** Ingest a WEB PAGE by URL (https only, SSRF-guarded fetch, HTML reduced to
|
|
308
|
+
* readable text server-side) into the shared corpus. */
|
|
309
|
+
ingestKnowledgeUrl(input: {
|
|
310
|
+
url: string;
|
|
311
|
+
name?: string;
|
|
312
|
+
locale?: string;
|
|
313
|
+
replaceDocId?: string;
|
|
314
|
+
}): Promise<{
|
|
315
|
+
ok: boolean;
|
|
316
|
+
doc: {
|
|
317
|
+
docId: string;
|
|
318
|
+
chunks: number;
|
|
319
|
+
};
|
|
320
|
+
summary?: string;
|
|
321
|
+
sourceUrl: string;
|
|
322
|
+
}>;
|
|
323
|
+
/** Recall probe: run the SAME retrieval an instance turn uses and get the
|
|
324
|
+
* ranked chunks back, WITHOUT burning an LLM turn. `mode` is the recall
|
|
325
|
+
* truth — `semantic` (vector path answered) or `lexical` (fallback). */
|
|
326
|
+
searchKnowledge(query: string): Promise<{
|
|
327
|
+
query: string;
|
|
328
|
+
mode: 'semantic' | 'lexical';
|
|
329
|
+
hits: unknown[];
|
|
330
|
+
}>;
|
|
233
331
|
deleteKnowledge(docId: string): Promise<{
|
|
234
332
|
deleted: boolean;
|
|
235
333
|
}>;
|
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.6.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;
|
|
@@ -70,6 +70,12 @@ export function createAdminClient(opts) {
|
|
|
70
70
|
getAgent: (id) => request('GET', `/agents/${encodeURIComponent(id)}`),
|
|
71
71
|
updateAgent: (id, patch) => request('PATCH', `/agents/${encodeURIComponent(id)}`, patch),
|
|
72
72
|
deleteAgent: (id) => request('DELETE', `/agents/${encodeURIComponent(id)}`),
|
|
73
|
+
listAgentVersions: (id) => request('GET', `/agents/${encodeURIComponent(id)}/versions`),
|
|
74
|
+
getAgentVersion: (id, rev) => request('GET', `/agents/${encodeURIComponent(id)}/versions/${rev}`),
|
|
75
|
+
diffAgentVersions: (id, opts = {}) => request('GET', `/agents/${encodeURIComponent(id)}/versions/diff${qs(opts)}`),
|
|
76
|
+
rollbackAgent: (id, version) => request('POST', `/agents/${encodeURIComponent(id)}/versions/rollback`, { version }),
|
|
77
|
+
getAgentPromotion: (id) => request('GET', `/agents/${encodeURIComponent(id)}/promote`),
|
|
78
|
+
promoteAgent: (id) => request('POST', `/agents/${encodeURIComponent(id)}/promote`, {}),
|
|
73
79
|
listKeys: () => request('GET', '/keys'),
|
|
74
80
|
createKey: (input) => request('POST', '/keys', input),
|
|
75
81
|
revokeKey: (id) => request('DELETE', `/keys/${encodeURIComponent(id)}`),
|
|
@@ -85,6 +91,9 @@ export function createAdminClient(opts) {
|
|
|
85
91
|
getUserTurns: (id, sessionId, params = {}) => request('GET', `/users/${encodeURIComponent(id)}/sessions/${encodeURIComponent(sessionId)}/turns${qs(params)}`),
|
|
86
92
|
listKnowledge: () => request('GET', '/knowledge'),
|
|
87
93
|
ingestKnowledge: (input) => request('POST', '/knowledge', input),
|
|
94
|
+
ingestKnowledgeFile: (input) => request('POST', '/knowledge/file', input),
|
|
95
|
+
ingestKnowledgeUrl: (input) => request('POST', '/knowledge/url', input),
|
|
96
|
+
searchKnowledge: (query) => request('POST', '/knowledge/search', { query }),
|
|
88
97
|
deleteKnowledge: (id) => request('DELETE', `/knowledge/${encodeURIComponent(id)}`),
|
|
89
98
|
listSkills: () => request('GET', '/skills'),
|
|
90
99
|
installSkill: (input) => request('POST', '/skills', input),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pouchy_ai/admin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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",
|