@pouchy_ai/admin-sdk 0.11.0 → 0.12.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 +18 -0
- package/README.md +9 -4
- package/dist/index.d.ts +125 -2
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@pouchy_ai/admin-sdk` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.12.0 — 2026-08-01
|
|
6
|
+
|
|
7
|
+
- **Typed capability declarations.** `publishCapability` now takes a
|
|
8
|
+
`CapabilityDeclaration` (`ViewDeclaration | ActionDeclaration |
|
|
9
|
+
EventDeclaration`, all exported) — compile-time help for the one call with
|
|
10
|
+
14+ fields and four closed vocabularies (`sensitivity`, `idempotency`,
|
|
11
|
+
`automation`, `signing`). The server stays the one validator; an index
|
|
12
|
+
signature keeps newer server fields publishable from an older SDK.
|
|
13
|
+
- **Typed agent Data flags.** `Agent` gains `data?: AgentData` — the live
|
|
14
|
+
levers (`enabled`, `actions.enabled` / `autoRun` / `autoRunDailyCap`,
|
|
15
|
+
`events.enabled` / `subscriptions`), usable through
|
|
16
|
+
`updateAgent(id, { data: { … } })`.
|
|
17
|
+
- **Observability readers.** `listActionExecutions({ limit? })` and
|
|
18
|
+
`listEventReceipts({ limit? })` over the new `/v1/admin/actions` +
|
|
19
|
+
`/v1/admin/events` mirrors (Admin API 1.5.0) — the durable Action journal
|
|
20
|
+
(typed rows incl. `authorizedBy: 'automation'`) and Event receipts + wake
|
|
21
|
+
trail, closing the headless loop: publish → test → read back what ran.
|
|
22
|
+
|
|
5
23
|
## 0.11.0 — 2026-08-01
|
|
6
24
|
|
|
7
25
|
- **Data capabilities, headless.** Six new methods over the `/v1/admin/capabilities`
|
package/README.md
CHANGED
|
@@ -198,15 +198,20 @@ Reads (`GET`) are not covered by that bucket. `retryAfter` is available from
|
|
|
198
198
|
| Channels | `listChannels` · `createChannel` · `getChannel` · `updateChannel` · `deleteChannel` |
|
|
199
199
|
| Schedules | `listSchedules` · `createSchedule` · `getSchedule` · `updateSchedule` · `deleteSchedule` |
|
|
200
200
|
| Durable runs | `listRuns` · `createRun` · `getRun` · `cancelRun` · `resumeRun` · `signalRun` |
|
|
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
|
+
| Webhooks | `listWebhooks` · `createWebhook` · `updateWebhook` · `rotateWebhookSecret` · `deleteWebhook` · `testWebhook` · `redeliverWebhook` |
|
|
203
|
+
| Reporting | `getUsage` · `getBilling` · `getTracesSummary` · `getRecentTraces` · `getLogs` · `getProject` · `updateProject` |
|
|
204
|
+
| Escape hatch | `request(method, path, body?)` — any endpoint not yet typed |
|
|
201
205
|
|
|
202
206
|
Channel types are checked at compile time: `createChannel` takes a
|
|
203
207
|
`CreatableChannelType` (the platform's 31-transport union minus the adapterless
|
|
204
208
|
`internal-a2a`), and `secret` is a named `ChannelSecretInput`. Per-transport
|
|
205
209
|
`secret.extra` fields are listed in <https://pouchy.ai/docs/channel-setup>.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
+
|
|
211
|
+
Capability **signing-key management is deliberately not mirrored** here: the
|
|
212
|
+
one-time `pcsk_`/`pesk_` plaintext reveal stays a human act on the owner
|
|
213
|
+
plane (dashboard / owner API). `listCapabilities` returns masked key status
|
|
214
|
+
only.
|
|
210
215
|
|
|
211
216
|
### Durable runs
|
|
212
217
|
|
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.12.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
|
|
@@ -99,6 +99,30 @@ export declare class AdminApiError extends Error {
|
|
|
99
99
|
export type Env = 'live' | 'test';
|
|
100
100
|
export type AgentStatus = 'draft' | 'published';
|
|
101
101
|
export type ModelTier = 'standard' | 'pro';
|
|
102
|
+
/** The agent template's Data plane flags — the LIVE half of every Data
|
|
103
|
+
* authorization (the pinned half is the published declaration). All fields
|
|
104
|
+
* are live levers: flipping one off stops that plane on the next turn of
|
|
105
|
+
* sessions already running. */
|
|
106
|
+
export interface AgentData {
|
|
107
|
+
/** Parent gate: instances get `read_data` + the pinned capability menu. */
|
|
108
|
+
enabled?: boolean;
|
|
109
|
+
actions?: {
|
|
110
|
+
/** Exposes the confirm-gated `run_action` gateway (needs `enabled`). */
|
|
111
|
+
enabled?: boolean;
|
|
112
|
+
/** Operator half of event-to-action automation (≤5 action names; the
|
|
113
|
+
* declaration must also say `automation: 'allowed'`). */
|
|
114
|
+
autoRun?: string[];
|
|
115
|
+
/** Automated runs per user per UTC day, 1..50 (default 10). */
|
|
116
|
+
autoRunDailyCap?: number;
|
|
117
|
+
};
|
|
118
|
+
events?: {
|
|
119
|
+
/** Lets your backend POST published events at this agent's instances. */
|
|
120
|
+
enabled?: boolean;
|
|
121
|
+
/** Subscription routing: an event POSTed WITHOUT agentId fans out to
|
|
122
|
+
* every subscribed, events-enabled agent (≤10 capability names). */
|
|
123
|
+
subscriptions?: string[];
|
|
124
|
+
};
|
|
125
|
+
}
|
|
102
126
|
export interface Agent {
|
|
103
127
|
agentId: string;
|
|
104
128
|
name: string;
|
|
@@ -106,10 +130,67 @@ export interface Agent {
|
|
|
106
130
|
systemPrompt: string;
|
|
107
131
|
status?: AgentStatus;
|
|
108
132
|
modelTier?: ModelTier;
|
|
133
|
+
/** Agent Data plane flags (see AgentData). */
|
|
134
|
+
data?: AgentData;
|
|
109
135
|
templateRev: number;
|
|
110
136
|
createdAt: string;
|
|
111
137
|
[k: string]: unknown;
|
|
112
138
|
}
|
|
139
|
+
export type CapabilitySensitivity = 'public' | 'personal' | 'intimate';
|
|
140
|
+
export interface ViewDeclaration {
|
|
141
|
+
kind: 'view';
|
|
142
|
+
/** The agent's business vocabulary (e.g. `Order`), not a table name. */
|
|
143
|
+
name: string;
|
|
144
|
+
description: string;
|
|
145
|
+
sensitivity?: CapabilitySensitivity;
|
|
146
|
+
/** ONE exact lowercase hostname; every endpoint must live on it. */
|
|
147
|
+
audience: string;
|
|
148
|
+
/** HTTPS GET endpoint — declared `filters` arrive as query parameters. */
|
|
149
|
+
endpoint: string;
|
|
150
|
+
/** Output allowlist — extra fields your endpoint returns never reach the agent. */
|
|
151
|
+
fields: string[];
|
|
152
|
+
filters?: string[];
|
|
153
|
+
[k: string]: unknown;
|
|
154
|
+
}
|
|
155
|
+
export interface ActionDeclaration {
|
|
156
|
+
kind: 'action';
|
|
157
|
+
name: string;
|
|
158
|
+
description: string;
|
|
159
|
+
sensitivity?: CapabilitySensitivity;
|
|
160
|
+
audience: string;
|
|
161
|
+
/** HTTPS POST endpoint — receives `{"actionId","action","args"}` signed. */
|
|
162
|
+
endpoint: string;
|
|
163
|
+
args?: string[];
|
|
164
|
+
/** The contract's only Phase-1 mode. */
|
|
165
|
+
idempotency: 'action_id';
|
|
166
|
+
/** Signed read-only `GET ?actionId=` resolver for `unknown` outcomes. */
|
|
167
|
+
reconcile?: {
|
|
168
|
+
endpoint: string;
|
|
169
|
+
};
|
|
170
|
+
/** Declared + validated today, NOT yet dispatched (forward-compat). */
|
|
171
|
+
compensate?: {
|
|
172
|
+
endpoint: string;
|
|
173
|
+
};
|
|
174
|
+
/** Author's pinned safety claim: eligible for event-driven automation
|
|
175
|
+
* (still needs the agent's live `autoRun` grant). */
|
|
176
|
+
automation?: 'allowed';
|
|
177
|
+
[k: string]: unknown;
|
|
178
|
+
}
|
|
179
|
+
export interface EventDeclaration {
|
|
180
|
+
kind: 'event';
|
|
181
|
+
name: string;
|
|
182
|
+
description: string;
|
|
183
|
+
sensitivity?: CapabilitySensitivity;
|
|
184
|
+
/** The declared emitter id — bound at ingress, never payload-decided. */
|
|
185
|
+
source: string;
|
|
186
|
+
schemaVersion: number;
|
|
187
|
+
/** Payload field mined as the subject reference (an EXISTING instance). */
|
|
188
|
+
subjectField: string;
|
|
189
|
+
/** Demand POUCHY-SOURCE-V1 per-source signatures on ingress. */
|
|
190
|
+
signing?: 'required';
|
|
191
|
+
[k: string]: unknown;
|
|
192
|
+
}
|
|
193
|
+
export type CapabilityDeclaration = ViewDeclaration | ActionDeclaration | EventDeclaration;
|
|
113
194
|
export interface SecretKey {
|
|
114
195
|
keyId: string;
|
|
115
196
|
label: string;
|
|
@@ -712,7 +793,7 @@ export interface AdminClient {
|
|
|
712
793
|
* bytes mint version+1 and never rewrite an old one. Publishing is NOT
|
|
713
794
|
* revocation — the per-agent data flags and `setCapabilityDisabled` are
|
|
714
795
|
* the live levers. */
|
|
715
|
-
publishCapability(declaration:
|
|
796
|
+
publishCapability(declaration: CapabilityDeclaration): Promise<{
|
|
716
797
|
revision: {
|
|
717
798
|
capabilityId: string;
|
|
718
799
|
version: number;
|
|
@@ -757,6 +838,48 @@ export interface AdminClient {
|
|
|
757
838
|
args?: Record<string, unknown>;
|
|
758
839
|
externalUserId?: string;
|
|
759
840
|
}): Promise<Record<string, unknown>>;
|
|
841
|
+
/** The durable Action journal, newest first (limit clamped to 1..100,
|
|
842
|
+
* default 50) — every run_action ever dispatched, with pinned revision,
|
|
843
|
+
* canonical intent, outcome status and reconcile trail. `unknown` is
|
|
844
|
+
* shown as unknown, never dressed up; `authorizedBy: 'automation'` marks
|
|
845
|
+
* event-driven runs (absent = a user approved). Same rows as the
|
|
846
|
+
* owner-plane viewer (one server-side shaper, two doors). */
|
|
847
|
+
listActionExecutions(params?: {
|
|
848
|
+
limit?: number;
|
|
849
|
+
}): Promise<{
|
|
850
|
+
executions: Array<{
|
|
851
|
+
actionId: string;
|
|
852
|
+
capabilityId: string;
|
|
853
|
+
version: number;
|
|
854
|
+
revisionHash: string;
|
|
855
|
+
status: 'dispatching' | 'committed' | 'rejected' | 'unknown';
|
|
856
|
+
intent: Record<string, string>;
|
|
857
|
+
intentHash: string;
|
|
858
|
+
subject: {
|
|
859
|
+
kind: string;
|
|
860
|
+
externalUserId?: string;
|
|
861
|
+
} | null;
|
|
862
|
+
confirmId: string;
|
|
863
|
+
authorizedBy?: 'user' | 'automation';
|
|
864
|
+
createdAt: number;
|
|
865
|
+
settledAt?: number;
|
|
866
|
+
remoteStatus?: number;
|
|
867
|
+
receipt?: string;
|
|
868
|
+
reconcileAttempts?: number;
|
|
869
|
+
reconcileLastAt?: number | null;
|
|
870
|
+
reconcileLastResult?: string | null;
|
|
871
|
+
[k: string]: unknown;
|
|
872
|
+
}>;
|
|
873
|
+
}>;
|
|
874
|
+
/** Event receipts + wake trail, newest first (limit clamped to 1..100,
|
|
875
|
+
* default 50). Pure metadata — the payload was mined for the subject and
|
|
876
|
+
* discarded at ingress. The wake trail records acceptance, turn and
|
|
877
|
+
* delivery milestones SEPARATELY: accepted never implies a turn ran. */
|
|
878
|
+
listEventReceipts(params?: {
|
|
879
|
+
limit?: number;
|
|
880
|
+
}): Promise<{
|
|
881
|
+
receipts: Array<Record<string, unknown>>;
|
|
882
|
+
}>;
|
|
760
883
|
listWebhooks(): Promise<{
|
|
761
884
|
webhooks: unknown[];
|
|
762
885
|
}>;
|
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.12.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;
|
|
@@ -291,6 +291,8 @@ export function createAdminClient(opts) {
|
|
|
291
291
|
setCapabilityDisabled: (name, disabled) => request('PATCH', `/capabilities/${encodeURIComponent(name)}`, { disabled }),
|
|
292
292
|
listCapabilityVersions: (name) => request('GET', `/capabilities/${encodeURIComponent(name)}/versions`),
|
|
293
293
|
testReadCapability: (name, input = {}) => request('POST', `/capabilities/${encodeURIComponent(name)}/test-read`, input),
|
|
294
|
+
listActionExecutions: (params = {}) => request('GET', `/actions${qs(params)}`),
|
|
295
|
+
listEventReceipts: (params = {}) => request('GET', `/events${qs(params)}`),
|
|
294
296
|
testActionCapability: (name, input) => request('POST', `/capabilities/${encodeURIComponent(name)}/test-action`, input),
|
|
295
297
|
listWebhooks: () => request('GET', '/webhooks'),
|
|
296
298
|
createWebhook: (input) => request('POST', '/webhooks', input),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pouchy_ai/admin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.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",
|