@pouchy_ai/admin-sdk 0.4.4 → 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 CHANGED
@@ -2,6 +2,49 @@
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
+
34
+ ## 0.5.0 — 2026-07-17
35
+
36
+ Additive: end-user listing pagination.
37
+
38
+ - **`listUsers` gains cursor pagination**: pass `limit` (clamped 1..100
39
+ server-side, default 100) and `cursor` (opaque — the previous response's
40
+ `nextCursor`); the response now carries `nextCursor` while more rows exist.
41
+ Previously the unfiltered listing was hard-capped at the 100 most recently
42
+ active instances with no way to reach the tail. The filtered variants
43
+ (`external_user_id` / `external_user_prefix`) are unchanged and don't
44
+ paginate. Requires a server deployment serving Admin API >= 1.2.0; older
45
+ servers ignore the new params and never return `nextCursor` (you just get
46
+ the old first-100 behavior).
47
+
5
48
  ## 0.4.4 — 2026-07-17
6
49
 
7
50
  Transport-error parity with the JS/python/unity siblings (they got this in
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
- | End users | `listUsers` · `setUserSuspended` · `deleteUser` · `getUserWallet` · `getUserTraces` · `importUsers` · `exportUser` · `getUserSessions` · `getUserTurns` |
92
- | Knowledge | `listKnowledge` · `ingestKnowledge` · `deleteKnowledge` |
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` |
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.4.4";
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
  }>;
@@ -159,13 +215,19 @@ export interface AdminClient {
159
215
  graceUntil: string | null;
160
216
  };
161
217
  }>;
162
- /** List end-user instances. Filter by exact external id or by prefix (the
163
- * server ignores any other query param and hard-caps the page at 100). */
218
+ /** List end-user instances. Filter by exact external id or by prefix, or
219
+ * page the full listing: `limit` (clamped 1..100 server-side, default 100)
220
+ * + `cursor` (opaque — pass back the previous response's `nextCursor`).
221
+ * `nextCursor` is present while more rows exist; the filtered variants
222
+ * don't paginate. */
164
223
  listUsers(params?: {
165
224
  external_user_id?: string;
166
225
  external_user_prefix?: string;
226
+ limit?: number;
227
+ cursor?: string;
167
228
  }): Promise<{
168
229
  users: Instance[];
230
+ nextCursor?: string;
169
231
  }>;
170
232
  setUserSuspended(instanceId: string, suspended: boolean): Promise<{
171
233
  suspended: boolean;
@@ -224,6 +286,48 @@ export interface AdminClient {
224
286
  chunks: number;
225
287
  };
226
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
+ }>;
227
331
  deleteKnowledge(docId: string): Promise<{
228
332
  deleted: boolean;
229
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.4.4';
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.4.4",
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",