@agentpress/sdk 0.4.12 → 0.4.14
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/README.md +95 -4
- package/dist/index.cjs +55 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +157 -17
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +157 -17
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +55 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -44,7 +44,7 @@ interface PartnerMcpOptions {
|
|
|
44
44
|
issuer: string;
|
|
45
45
|
/** Exact match for the JWT `aud` claim — your partner MCP's stable URL. */
|
|
46
46
|
audience: string;
|
|
47
|
-
/** Required value for the `ext_provider` claim, e.g. `"
|
|
47
|
+
/** Required value for the `ext_provider` claim, e.g. `"partner_auth"`. */
|
|
48
48
|
expectedExtProvider: string;
|
|
49
49
|
/**
|
|
50
50
|
* Clock skew tolerance for `iat` / `exp` validation. Accepts a jose duration
|
|
@@ -240,6 +240,16 @@ interface ActionCallbackPayload {
|
|
|
240
240
|
agentResponse: AgentResponse;
|
|
241
241
|
/** Error message if the action failed. */
|
|
242
242
|
errorMessage: string | null;
|
|
243
|
+
/**
|
|
244
|
+
* Structured error metadata for clients that need branching/logging without
|
|
245
|
+
* displaying raw provider errors.
|
|
246
|
+
*/
|
|
247
|
+
errorDetails: {
|
|
248
|
+
code: string | null;
|
|
249
|
+
provider: string | null;
|
|
250
|
+
recoverable: boolean;
|
|
251
|
+
userMessage: string | null;
|
|
252
|
+
} | null;
|
|
243
253
|
/** Reason provided if the action was rejected by a human reviewer. */
|
|
244
254
|
rejectionReason: string | null;
|
|
245
255
|
/** Additional custom fields from post-event configuration. */
|
|
@@ -247,6 +257,12 @@ interface ActionCallbackPayload {
|
|
|
247
257
|
}
|
|
248
258
|
/** Mode of a user tool approval rule. */
|
|
249
259
|
type ApprovalMode = "always_allow" | "always_deny";
|
|
260
|
+
/**
|
|
261
|
+
* Mode accepted by settings UIs that sync Allow/Ask choices. `always_allow`
|
|
262
|
+
* persists an allow rule. `ask` means no stored allow rule for that listed
|
|
263
|
+
* tool. `always_deny` is intentionally not accepted by sync.
|
|
264
|
+
*/
|
|
265
|
+
type ApprovalRuleSyncMode = "always_allow" | "ask";
|
|
250
266
|
/**
|
|
251
267
|
* A persisted rule that auto-approves (or auto-denies) a specific
|
|
252
268
|
* `(user, webhook, tool)` triple, bypassing the per-action approval prompt.
|
|
@@ -273,13 +289,15 @@ interface ListUserApprovalsParams {
|
|
|
273
289
|
/**
|
|
274
290
|
* Filter to a single user's approvals. Accepts either an internal AgentPress
|
|
275
291
|
* user UUID, or — when paired with {@link authProvider} — an external user ID
|
|
276
|
-
* from a custom auth provider
|
|
292
|
+
* from a custom auth provider. If omitted, lists every approval for the
|
|
293
|
+
* signed webhook.
|
|
277
294
|
*/
|
|
278
295
|
userId?: string;
|
|
279
296
|
/**
|
|
280
297
|
* Name of the registered external auth provider. When provided, `userId` is
|
|
281
298
|
* treated as the external user ID and resolved to the internal user via
|
|
282
|
-
* `users.external_auth_id`.
|
|
299
|
+
* `users.external_auth_id`. The resolved user must belong to the webhook's
|
|
300
|
+
* AgentPress org.
|
|
283
301
|
*/
|
|
284
302
|
authProvider?: string;
|
|
285
303
|
}
|
|
@@ -287,6 +305,40 @@ interface ListUserApprovalsParams {
|
|
|
287
305
|
interface ListUserApprovalsResponse {
|
|
288
306
|
approvals: UserToolApproval[];
|
|
289
307
|
}
|
|
308
|
+
/** Metadata for one tool that the webhook's default rule stages for approval. */
|
|
309
|
+
interface WebhookApprovalToolMetadata {
|
|
310
|
+
/** Stable tool slug to use in create/sync rules. */
|
|
311
|
+
toolName: string;
|
|
312
|
+
/** Human-readable label matching AgentPress approval UI formatting. */
|
|
313
|
+
label: string;
|
|
314
|
+
/** Tool description, when exposed by the agent/tool catalog. */
|
|
315
|
+
description: string | null;
|
|
316
|
+
/** True/false when known; null when the tool catalog does not expose it. */
|
|
317
|
+
destructiveHint: boolean | null;
|
|
318
|
+
/** True/false when known; null when the tool catalog does not expose it. */
|
|
319
|
+
sensitiveHint: boolean | null;
|
|
320
|
+
}
|
|
321
|
+
/** Webhook metadata plus the ordered approval-tool catalog for partner UIs. */
|
|
322
|
+
interface WebhookApprovalMetadata {
|
|
323
|
+
/** Same value as `actionWebhookId`; included for compatibility. */
|
|
324
|
+
id: string;
|
|
325
|
+
/** UUID of the `action_webhooks` row resolved from `webhookIdentifier`. */
|
|
326
|
+
actionWebhookId: string;
|
|
327
|
+
/** Stable webhook slug used in SDK calls and signed URLs. */
|
|
328
|
+
webhookIdentifier: string;
|
|
329
|
+
/** Human-readable webhook display name. */
|
|
330
|
+
displayName: string;
|
|
331
|
+
/** Alias of `displayName`; included for compatibility with webhook rows. */
|
|
332
|
+
name: string;
|
|
333
|
+
/** Organization that owns this webhook. */
|
|
334
|
+
orgId: string;
|
|
335
|
+
/** Default action rule attached to the webhook, if any. */
|
|
336
|
+
defaultActionRuleId: string | null;
|
|
337
|
+
/** Ordered tools matching the AgentPress approval popup order. */
|
|
338
|
+
availableTools: WebhookApprovalToolMetadata[];
|
|
339
|
+
/** Backwards-compatible ordered projection of `availableTools[].toolName`. */
|
|
340
|
+
toolNames: string[];
|
|
341
|
+
}
|
|
290
342
|
/** Parameters for {@link UserApprovalsClient.create}. */
|
|
291
343
|
interface CreateUserApprovalParams {
|
|
292
344
|
/** Webhook identifier (slug) — required to scope the signing secret. */
|
|
@@ -294,21 +346,26 @@ interface CreateUserApprovalParams {
|
|
|
294
346
|
/**
|
|
295
347
|
* User identifier this rule applies to. Accepts either an internal AgentPress
|
|
296
348
|
* user UUID, or — when paired with {@link authProvider} — an external user ID
|
|
297
|
-
* from a custom auth provider
|
|
349
|
+
* from a custom auth provider.
|
|
298
350
|
*/
|
|
299
351
|
userId: string;
|
|
300
352
|
/**
|
|
301
353
|
* Name of the registered external auth provider. When provided, `userId` is
|
|
302
354
|
* treated as the external user ID and resolved to the internal user via
|
|
303
355
|
* `users.external_auth_id`. The user must have authenticated through the
|
|
304
|
-
* provider at least once
|
|
356
|
+
* provider at least once and belong to the webhook's AgentPress org for
|
|
357
|
+
* resolution to succeed.
|
|
305
358
|
*/
|
|
306
359
|
authProvider?: string;
|
|
307
|
-
/**
|
|
308
|
-
|
|
309
|
-
|
|
360
|
+
/**
|
|
361
|
+
* UUID of the `action_webhooks` row. Optional for SDK callers; when omitted,
|
|
362
|
+
* AgentPress resolves it from `webhookIdentifier`. If supplied, core rejects
|
|
363
|
+
* the request unless it matches the URL-scoped webhook.
|
|
364
|
+
*/
|
|
365
|
+
actionWebhookId?: string;
|
|
366
|
+
/** Tool slug from `WebhookApprovalMetadata.availableTools[].toolName`. */
|
|
310
367
|
toolName: string;
|
|
311
|
-
/**
|
|
368
|
+
/** Stored approval mode. Defaults to `"always_allow"`. */
|
|
312
369
|
mode?: ApprovalMode;
|
|
313
370
|
/** `null` or omitted = never expires. */
|
|
314
371
|
expiresAt?: Date | null;
|
|
@@ -325,6 +382,51 @@ interface DeleteUserApprovalParams {
|
|
|
325
382
|
/** Webhook identifier (slug) the approval belongs to — required for signing. */
|
|
326
383
|
webhookIdentifier: string;
|
|
327
384
|
}
|
|
385
|
+
/** Parameters for {@link UserApprovalsClient.getWebhookMetadata}. */
|
|
386
|
+
interface GetUserApprovalWebhookMetadataParams {
|
|
387
|
+
/** Webhook identifier (slug) — required to scope the signing secret. */
|
|
388
|
+
webhookIdentifier: string;
|
|
389
|
+
}
|
|
390
|
+
interface SyncUserApprovalRule {
|
|
391
|
+
/** Tool slug from `WebhookApprovalMetadata.availableTools[].toolName`. */
|
|
392
|
+
toolName: string;
|
|
393
|
+
/** Desired partner UI state for this listed tool. */
|
|
394
|
+
mode: ApprovalRuleSyncMode;
|
|
395
|
+
}
|
|
396
|
+
/** Parameters for {@link UserApprovalsClient.sync}. */
|
|
397
|
+
interface SyncUserApprovalsParams {
|
|
398
|
+
/** Webhook identifier (slug) — required to scope the signing secret. */
|
|
399
|
+
webhookIdentifier: string;
|
|
400
|
+
/**
|
|
401
|
+
* User identifier this sync applies to. Accepts either an internal AgentPress
|
|
402
|
+
* user UUID, or — when paired with {@link authProvider} — an external user ID.
|
|
403
|
+
*/
|
|
404
|
+
userId: string;
|
|
405
|
+
/**
|
|
406
|
+
* Name of the registered external auth provider. The user must have
|
|
407
|
+
* authenticated through that provider at least once and belong to the
|
|
408
|
+
* webhook's AgentPress org.
|
|
409
|
+
*/
|
|
410
|
+
authProvider?: string;
|
|
411
|
+
/**
|
|
412
|
+
* Complete desired Allow/Ask state for the tools your UI manages. Tools not
|
|
413
|
+
* listed here are left untouched. Existing always_deny rules are preserved.
|
|
414
|
+
*/
|
|
415
|
+
rules: SyncUserApprovalRule[];
|
|
416
|
+
}
|
|
417
|
+
interface SyncUserApprovalsResponse {
|
|
418
|
+
/** Approval rows remaining after sync for this user and webhook. */
|
|
419
|
+
approvals: UserToolApproval[];
|
|
420
|
+
summary: {
|
|
421
|
+
/** Unique tool names requested after duplicate tool names are collapsed. */requested: number; /** Number of allow upserts attempted. */
|
|
422
|
+
upserted: number; /** Number of existing non-deny rows removed for `ask`. */
|
|
423
|
+
removed: number; /** Number of requested rows that already had the desired no-op state. */
|
|
424
|
+
unchanged: number; /** Number of requested tools skipped because an always_deny rule exists. */
|
|
425
|
+
preservedDeny: number;
|
|
426
|
+
};
|
|
427
|
+
/** Tool names whose existing always_deny rows were intentionally preserved. */
|
|
428
|
+
preservedDenyTools: string[];
|
|
429
|
+
}
|
|
328
430
|
/** @internal Resolved (validated, defaulted) options. Not exported from the public API. */
|
|
329
431
|
interface ResolvedOptions {
|
|
330
432
|
baseUrl: string;
|
|
@@ -465,12 +567,16 @@ declare class PartnersClient {
|
|
|
465
567
|
* ```ts
|
|
466
568
|
* const client = new AgentPress({ webhookSecret: "whsec_...", org: "my-org" });
|
|
467
569
|
*
|
|
468
|
-
*
|
|
469
|
-
* await client.userApprovals.create({
|
|
570
|
+
* const metadata = await client.userApprovals.getWebhookMetadata({
|
|
470
571
|
* webhookIdentifier: "reviews",
|
|
572
|
+
* });
|
|
573
|
+
* const selectedTool = getSelectedToolFromYourUi(metadata.availableTools);
|
|
574
|
+
*
|
|
575
|
+
* // Provision consent so future selectedTool triggers skip the approval prompt
|
|
576
|
+
* await client.userApprovals.create({
|
|
577
|
+
* webhookIdentifier: metadata.webhookIdentifier,
|
|
471
578
|
* userId: "user-uuid",
|
|
472
|
-
*
|
|
473
|
-
* toolName: "sendEmail",
|
|
579
|
+
* toolName: selectedTool.toolName,
|
|
474
580
|
* mode: "always_allow",
|
|
475
581
|
* });
|
|
476
582
|
*
|
|
@@ -489,22 +595,56 @@ declare class UserApprovalsClient {
|
|
|
489
595
|
constructor(options: ResolvedOptions, http: HttpClient);
|
|
490
596
|
/**
|
|
491
597
|
* List auto-approval rules for a webhook. Optionally filter by `userId`.
|
|
598
|
+
* When `userId` is omitted, AgentPress returns all approval rules for the
|
|
599
|
+
* signed webhook. Partner user-settings UIs should usually pass `userId` and
|
|
600
|
+
* `authProvider`.
|
|
492
601
|
*
|
|
493
602
|
* @throws ConfigurationError if webhookSecret is not configured
|
|
494
|
-
* @throws HttpError on non-2xx response
|
|
603
|
+
* @throws HttpError on non-2xx response. A 422 with
|
|
604
|
+
* `code: "USER_NOT_PROVISIONED"` means the external user has not
|
|
605
|
+
* authenticated into AgentPress yet or is not a member of the webhook's org.
|
|
495
606
|
* @throws TimeoutError if request exceeds timeout
|
|
496
607
|
*/
|
|
497
608
|
list(params: ListUserApprovalsParams): Promise<ListUserApprovalsResponse>;
|
|
609
|
+
/**
|
|
610
|
+
* Fetch metadata for a webhook plus the ordered tools that its default action
|
|
611
|
+
* rule stages for approval. This is the SDK source of truth for partner
|
|
612
|
+
* settings UIs; `actionWebhookId` in the response can be passed to older
|
|
613
|
+
* AgentPress versions that still require it. Tool order matches the
|
|
614
|
+
* AgentPress approval popup.
|
|
615
|
+
*
|
|
616
|
+
* @throws ConfigurationError if webhookSecret is not configured
|
|
617
|
+
* @throws HttpError on non-2xx response
|
|
618
|
+
* @throws TimeoutError if request exceeds timeout
|
|
619
|
+
*/
|
|
620
|
+
getWebhookMetadata(params: GetUserApprovalWebhookMetadataParams): Promise<WebhookApprovalMetadata>;
|
|
498
621
|
/**
|
|
499
622
|
* Create (or upsert) an auto-approval rule. If a rule with the same
|
|
500
623
|
* `(userId, actionWebhookId, toolName)` triple already exists, it is
|
|
501
|
-
* updated in place.
|
|
624
|
+
* updated in place. `actionWebhookId` is optional for current AgentPress
|
|
625
|
+
* core; the webhook URL scope resolves it from `webhookIdentifier`. Use
|
|
626
|
+
* `toolName` values from `getWebhookMetadata().availableTools`.
|
|
502
627
|
*
|
|
503
628
|
* @throws ConfigurationError if webhookSecret is not configured
|
|
504
|
-
* @throws HttpError on non-2xx response
|
|
629
|
+
* @throws HttpError on non-2xx response. A 422 with
|
|
630
|
+
* `code: "USER_NOT_PROVISIONED"` means the external user has not
|
|
631
|
+
* authenticated into AgentPress yet or is not a member of the webhook's org.
|
|
505
632
|
* @throws TimeoutError if request exceeds timeout
|
|
506
633
|
*/
|
|
507
634
|
create(params: CreateUserApprovalParams): Promise<UserToolApproval>;
|
|
635
|
+
/**
|
|
636
|
+
* Idempotently sync a partner settings UI's Allow/Ask choices for one user
|
|
637
|
+
* and one webhook. `mode: "ask"` removes an existing allow rule for that
|
|
638
|
+
* listed tool. Existing `always_deny` rules and non-listed tool rules are
|
|
639
|
+
* preserved.
|
|
640
|
+
*
|
|
641
|
+
* @throws ConfigurationError if webhookSecret is not configured
|
|
642
|
+
* @throws HttpError on non-2xx response. A 422 with
|
|
643
|
+
* `code: "USER_NOT_PROVISIONED"` means the external user has not
|
|
644
|
+
* authenticated into AgentPress yet or is not a member of the webhook's org.
|
|
645
|
+
* @throws TimeoutError if request exceeds timeout
|
|
646
|
+
*/
|
|
647
|
+
sync(params: SyncUserApprovalsParams): Promise<SyncUserApprovalsResponse>;
|
|
508
648
|
/**
|
|
509
649
|
* Patch an existing auto-approval rule (change mode or expiry).
|
|
510
650
|
*
|
|
@@ -670,5 +810,5 @@ declare class KeyRotationVerifyError extends AgentPressError {
|
|
|
670
810
|
constructor(reason: KeyRotationVerifyErrorReason, message: string);
|
|
671
811
|
}
|
|
672
812
|
//#endregion
|
|
673
|
-
export { ACTION_EVENT_TYPES, type ActionCallbackPayload, type ActionEventType, type ActionManageResponse, type ActionStatus, ActionsClient, AgentPress, AgentPressError, type AgentPressOptions, type AgentResponse, type ApprovalMode, type ApproveActionParams, ConfigurationError, type CreateUserApprovalParams, type DeleteUserApprovalParams, HttpError, type KeyRotationEvent, KeyRotationVerifyError, type KeyRotationVerifyErrorReason, type KeyRotationVerifyParams, type ListUserApprovalsParams, type ListUserApprovalsResponse, type PartnerMcpOptions, type PartnerTokenClaims, PartnerTokenError, type PartnerTokenErrorReason, PartnersClient, type RejectActionParams, type StagedToolCall, type StagedToolCallSummary, TimeoutError, type ToolCallResult, type UpdateUserApprovalParams, UserApprovalsClient, type UserToolApproval, type WebhookResponse, type WebhookSendParams, WebhookSignatureError, type WebhookVerifyParams, WebhooksClient };
|
|
813
|
+
export { ACTION_EVENT_TYPES, type ActionCallbackPayload, type ActionEventType, type ActionManageResponse, type ActionStatus, ActionsClient, AgentPress, AgentPressError, type AgentPressOptions, type AgentResponse, type ApprovalMode, type ApprovalRuleSyncMode, type ApproveActionParams, ConfigurationError, type CreateUserApprovalParams, type DeleteUserApprovalParams, type GetUserApprovalWebhookMetadataParams, HttpError, type KeyRotationEvent, KeyRotationVerifyError, type KeyRotationVerifyErrorReason, type KeyRotationVerifyParams, type ListUserApprovalsParams, type ListUserApprovalsResponse, type PartnerMcpOptions, type PartnerTokenClaims, PartnerTokenError, type PartnerTokenErrorReason, PartnersClient, type RejectActionParams, type StagedToolCall, type StagedToolCallSummary, type SyncUserApprovalRule, type SyncUserApprovalsParams, type SyncUserApprovalsResponse, TimeoutError, type ToolCallResult, type UpdateUserApprovalParams, UserApprovalsClient, type UserToolApproval, type WebhookApprovalMetadata, type WebhookApprovalToolMetadata, type WebhookResponse, type WebhookSendParams, WebhookSignatureError, type WebhookVerifyParams, WebhooksClient };
|
|
674
814
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/http.ts","../src/actions/client.ts","../src/partners/client.ts","../src/userApprovals/client.ts","../src/webhooks/client.ts","../src/client.ts","../src/errors.ts"],"mappings":";;UACiB,iBAAA;EAAiB;EAEhC,aAAA;EAkBa;EAhBb,MAAA;EAoBqC;EAlBrC,OAAA;EAkB6C;EAhB7C,OAAA;EAJA;EAMA,GAAA;EAFA;;;;;;;;;EAYA,UAAA,GAAa,iBAAA;EAIwB;EAFrC,SAAA,IAAa,GAAA,UAAa,IAAA,EAAM,WAAA;EAEa;EAA7C,UAAA,IAAc,GAAA,UAAa,QAAA,EAAU,QAAA;AAAA;;UAItB,iBAAA;EAAiB;;;;;;;EAQhC,OAAA;EAqBiB;AAInB;;;;EAnBE,MAAA;EAuBA;EArBA,QAAA;EAyBA;EAvBA,mBAAA;EA2BA;;;;;EArBA,cAAA;EAiCC
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/http.ts","../src/actions/client.ts","../src/partners/client.ts","../src/userApprovals/client.ts","../src/webhooks/client.ts","../src/client.ts","../src/errors.ts"],"mappings":";;UACiB,iBAAA;EAAiB;EAEhC,aAAA;EAkBa;EAhBb,MAAA;EAoBqC;EAlBrC,OAAA;EAkB6C;EAhB7C,OAAA;EAJA;EAMA,GAAA;EAFA;;;;;;;;;EAYA,UAAA,GAAa,iBAAA;EAIwB;EAFrC,SAAA,IAAa,GAAA,UAAa,IAAA,EAAM,WAAA;EAEa;EAA7C,UAAA,IAAc,GAAA,UAAa,QAAA,EAAU,QAAA;AAAA;;UAItB,iBAAA;EAAiB;;;;;;;EAQh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AAA;AAAA;;;;ANxCvB;;;cOGa,eAAA,SAAwB,KAAK;cAC5B,OAAA;AAAA;;;;;cAWD,kBAAA,SAA2B,eAAe;cACzC,OAAA;AAAA;;;;;;;;;cAeD,SAAA,SAAkB,eAAe;EAAA,SAC5B,UAAA;EAAA,SACA,YAAA;EAAA,SACA,GAAA;cAEJ,UAAA,UAAoB,YAAA,UAAsB,GAAA;AAAA;;cAW3C,YAAA,SAAqB,eAAe;cACnC,GAAA,UAAa,OAAA;AAAA;;cAQd,qBAAA,SAA8B,eAAe;cAC5C,OAAA;AAAA;;KAQF,uBAAA;APJZ;;;;;AAAA,cOqBa,iBAAA,SAA0B,eAAA;EAAA,SACrB,MAAA,EAAQ,uBAAA;cAEZ,MAAA,EAAQ,uBAAA,EAAyB,OAAA;AAAA;;KASnC,4BAAA;;;;;cAYC,sBAAA,SAA+B,eAAA;EAAA,SAC1B,MAAA,EAAQ,4BAAA;cAEZ,MAAA,EAAQ,4BAAA,EAA8B,OAAA;AAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -44,7 +44,7 @@ interface PartnerMcpOptions {
|
|
|
44
44
|
issuer: string;
|
|
45
45
|
/** Exact match for the JWT `aud` claim — your partner MCP's stable URL. */
|
|
46
46
|
audience: string;
|
|
47
|
-
/** Required value for the `ext_provider` claim, e.g. `"
|
|
47
|
+
/** Required value for the `ext_provider` claim, e.g. `"partner_auth"`. */
|
|
48
48
|
expectedExtProvider: string;
|
|
49
49
|
/**
|
|
50
50
|
* Clock skew tolerance for `iat` / `exp` validation. Accepts a jose duration
|
|
@@ -240,6 +240,16 @@ interface ActionCallbackPayload {
|
|
|
240
240
|
agentResponse: AgentResponse;
|
|
241
241
|
/** Error message if the action failed. */
|
|
242
242
|
errorMessage: string | null;
|
|
243
|
+
/**
|
|
244
|
+
* Structured error metadata for clients that need branching/logging without
|
|
245
|
+
* displaying raw provider errors.
|
|
246
|
+
*/
|
|
247
|
+
errorDetails: {
|
|
248
|
+
code: string | null;
|
|
249
|
+
provider: string | null;
|
|
250
|
+
recoverable: boolean;
|
|
251
|
+
userMessage: string | null;
|
|
252
|
+
} | null;
|
|
243
253
|
/** Reason provided if the action was rejected by a human reviewer. */
|
|
244
254
|
rejectionReason: string | null;
|
|
245
255
|
/** Additional custom fields from post-event configuration. */
|
|
@@ -247,6 +257,12 @@ interface ActionCallbackPayload {
|
|
|
247
257
|
}
|
|
248
258
|
/** Mode of a user tool approval rule. */
|
|
249
259
|
type ApprovalMode = "always_allow" | "always_deny";
|
|
260
|
+
/**
|
|
261
|
+
* Mode accepted by settings UIs that sync Allow/Ask choices. `always_allow`
|
|
262
|
+
* persists an allow rule. `ask` means no stored allow rule for that listed
|
|
263
|
+
* tool. `always_deny` is intentionally not accepted by sync.
|
|
264
|
+
*/
|
|
265
|
+
type ApprovalRuleSyncMode = "always_allow" | "ask";
|
|
250
266
|
/**
|
|
251
267
|
* A persisted rule that auto-approves (or auto-denies) a specific
|
|
252
268
|
* `(user, webhook, tool)` triple, bypassing the per-action approval prompt.
|
|
@@ -273,13 +289,15 @@ interface ListUserApprovalsParams {
|
|
|
273
289
|
/**
|
|
274
290
|
* Filter to a single user's approvals. Accepts either an internal AgentPress
|
|
275
291
|
* user UUID, or — when paired with {@link authProvider} — an external user ID
|
|
276
|
-
* from a custom auth provider
|
|
292
|
+
* from a custom auth provider. If omitted, lists every approval for the
|
|
293
|
+
* signed webhook.
|
|
277
294
|
*/
|
|
278
295
|
userId?: string;
|
|
279
296
|
/**
|
|
280
297
|
* Name of the registered external auth provider. When provided, `userId` is
|
|
281
298
|
* treated as the external user ID and resolved to the internal user via
|
|
282
|
-
* `users.external_auth_id`.
|
|
299
|
+
* `users.external_auth_id`. The resolved user must belong to the webhook's
|
|
300
|
+
* AgentPress org.
|
|
283
301
|
*/
|
|
284
302
|
authProvider?: string;
|
|
285
303
|
}
|
|
@@ -287,6 +305,40 @@ interface ListUserApprovalsParams {
|
|
|
287
305
|
interface ListUserApprovalsResponse {
|
|
288
306
|
approvals: UserToolApproval[];
|
|
289
307
|
}
|
|
308
|
+
/** Metadata for one tool that the webhook's default rule stages for approval. */
|
|
309
|
+
interface WebhookApprovalToolMetadata {
|
|
310
|
+
/** Stable tool slug to use in create/sync rules. */
|
|
311
|
+
toolName: string;
|
|
312
|
+
/** Human-readable label matching AgentPress approval UI formatting. */
|
|
313
|
+
label: string;
|
|
314
|
+
/** Tool description, when exposed by the agent/tool catalog. */
|
|
315
|
+
description: string | null;
|
|
316
|
+
/** True/false when known; null when the tool catalog does not expose it. */
|
|
317
|
+
destructiveHint: boolean | null;
|
|
318
|
+
/** True/false when known; null when the tool catalog does not expose it. */
|
|
319
|
+
sensitiveHint: boolean | null;
|
|
320
|
+
}
|
|
321
|
+
/** Webhook metadata plus the ordered approval-tool catalog for partner UIs. */
|
|
322
|
+
interface WebhookApprovalMetadata {
|
|
323
|
+
/** Same value as `actionWebhookId`; included for compatibility. */
|
|
324
|
+
id: string;
|
|
325
|
+
/** UUID of the `action_webhooks` row resolved from `webhookIdentifier`. */
|
|
326
|
+
actionWebhookId: string;
|
|
327
|
+
/** Stable webhook slug used in SDK calls and signed URLs. */
|
|
328
|
+
webhookIdentifier: string;
|
|
329
|
+
/** Human-readable webhook display name. */
|
|
330
|
+
displayName: string;
|
|
331
|
+
/** Alias of `displayName`; included for compatibility with webhook rows. */
|
|
332
|
+
name: string;
|
|
333
|
+
/** Organization that owns this webhook. */
|
|
334
|
+
orgId: string;
|
|
335
|
+
/** Default action rule attached to the webhook, if any. */
|
|
336
|
+
defaultActionRuleId: string | null;
|
|
337
|
+
/** Ordered tools matching the AgentPress approval popup order. */
|
|
338
|
+
availableTools: WebhookApprovalToolMetadata[];
|
|
339
|
+
/** Backwards-compatible ordered projection of `availableTools[].toolName`. */
|
|
340
|
+
toolNames: string[];
|
|
341
|
+
}
|
|
290
342
|
/** Parameters for {@link UserApprovalsClient.create}. */
|
|
291
343
|
interface CreateUserApprovalParams {
|
|
292
344
|
/** Webhook identifier (slug) — required to scope the signing secret. */
|
|
@@ -294,21 +346,26 @@ interface CreateUserApprovalParams {
|
|
|
294
346
|
/**
|
|
295
347
|
* User identifier this rule applies to. Accepts either an internal AgentPress
|
|
296
348
|
* user UUID, or — when paired with {@link authProvider} — an external user ID
|
|
297
|
-
* from a custom auth provider
|
|
349
|
+
* from a custom auth provider.
|
|
298
350
|
*/
|
|
299
351
|
userId: string;
|
|
300
352
|
/**
|
|
301
353
|
* Name of the registered external auth provider. When provided, `userId` is
|
|
302
354
|
* treated as the external user ID and resolved to the internal user via
|
|
303
355
|
* `users.external_auth_id`. The user must have authenticated through the
|
|
304
|
-
* provider at least once
|
|
356
|
+
* provider at least once and belong to the webhook's AgentPress org for
|
|
357
|
+
* resolution to succeed.
|
|
305
358
|
*/
|
|
306
359
|
authProvider?: string;
|
|
307
|
-
/**
|
|
308
|
-
|
|
309
|
-
|
|
360
|
+
/**
|
|
361
|
+
* UUID of the `action_webhooks` row. Optional for SDK callers; when omitted,
|
|
362
|
+
* AgentPress resolves it from `webhookIdentifier`. If supplied, core rejects
|
|
363
|
+
* the request unless it matches the URL-scoped webhook.
|
|
364
|
+
*/
|
|
365
|
+
actionWebhookId?: string;
|
|
366
|
+
/** Tool slug from `WebhookApprovalMetadata.availableTools[].toolName`. */
|
|
310
367
|
toolName: string;
|
|
311
|
-
/**
|
|
368
|
+
/** Stored approval mode. Defaults to `"always_allow"`. */
|
|
312
369
|
mode?: ApprovalMode;
|
|
313
370
|
/** `null` or omitted = never expires. */
|
|
314
371
|
expiresAt?: Date | null;
|
|
@@ -325,6 +382,51 @@ interface DeleteUserApprovalParams {
|
|
|
325
382
|
/** Webhook identifier (slug) the approval belongs to — required for signing. */
|
|
326
383
|
webhookIdentifier: string;
|
|
327
384
|
}
|
|
385
|
+
/** Parameters for {@link UserApprovalsClient.getWebhookMetadata}. */
|
|
386
|
+
interface GetUserApprovalWebhookMetadataParams {
|
|
387
|
+
/** Webhook identifier (slug) — required to scope the signing secret. */
|
|
388
|
+
webhookIdentifier: string;
|
|
389
|
+
}
|
|
390
|
+
interface SyncUserApprovalRule {
|
|
391
|
+
/** Tool slug from `WebhookApprovalMetadata.availableTools[].toolName`. */
|
|
392
|
+
toolName: string;
|
|
393
|
+
/** Desired partner UI state for this listed tool. */
|
|
394
|
+
mode: ApprovalRuleSyncMode;
|
|
395
|
+
}
|
|
396
|
+
/** Parameters for {@link UserApprovalsClient.sync}. */
|
|
397
|
+
interface SyncUserApprovalsParams {
|
|
398
|
+
/** Webhook identifier (slug) — required to scope the signing secret. */
|
|
399
|
+
webhookIdentifier: string;
|
|
400
|
+
/**
|
|
401
|
+
* User identifier this sync applies to. Accepts either an internal AgentPress
|
|
402
|
+
* user UUID, or — when paired with {@link authProvider} — an external user ID.
|
|
403
|
+
*/
|
|
404
|
+
userId: string;
|
|
405
|
+
/**
|
|
406
|
+
* Name of the registered external auth provider. The user must have
|
|
407
|
+
* authenticated through that provider at least once and belong to the
|
|
408
|
+
* webhook's AgentPress org.
|
|
409
|
+
*/
|
|
410
|
+
authProvider?: string;
|
|
411
|
+
/**
|
|
412
|
+
* Complete desired Allow/Ask state for the tools your UI manages. Tools not
|
|
413
|
+
* listed here are left untouched. Existing always_deny rules are preserved.
|
|
414
|
+
*/
|
|
415
|
+
rules: SyncUserApprovalRule[];
|
|
416
|
+
}
|
|
417
|
+
interface SyncUserApprovalsResponse {
|
|
418
|
+
/** Approval rows remaining after sync for this user and webhook. */
|
|
419
|
+
approvals: UserToolApproval[];
|
|
420
|
+
summary: {
|
|
421
|
+
/** Unique tool names requested after duplicate tool names are collapsed. */requested: number; /** Number of allow upserts attempted. */
|
|
422
|
+
upserted: number; /** Number of existing non-deny rows removed for `ask`. */
|
|
423
|
+
removed: number; /** Number of requested rows that already had the desired no-op state. */
|
|
424
|
+
unchanged: number; /** Number of requested tools skipped because an always_deny rule exists. */
|
|
425
|
+
preservedDeny: number;
|
|
426
|
+
};
|
|
427
|
+
/** Tool names whose existing always_deny rows were intentionally preserved. */
|
|
428
|
+
preservedDenyTools: string[];
|
|
429
|
+
}
|
|
328
430
|
/** @internal Resolved (validated, defaulted) options. Not exported from the public API. */
|
|
329
431
|
interface ResolvedOptions {
|
|
330
432
|
baseUrl: string;
|
|
@@ -465,12 +567,16 @@ declare class PartnersClient {
|
|
|
465
567
|
* ```ts
|
|
466
568
|
* const client = new AgentPress({ webhookSecret: "whsec_...", org: "my-org" });
|
|
467
569
|
*
|
|
468
|
-
*
|
|
469
|
-
* await client.userApprovals.create({
|
|
570
|
+
* const metadata = await client.userApprovals.getWebhookMetadata({
|
|
470
571
|
* webhookIdentifier: "reviews",
|
|
572
|
+
* });
|
|
573
|
+
* const selectedTool = getSelectedToolFromYourUi(metadata.availableTools);
|
|
574
|
+
*
|
|
575
|
+
* // Provision consent so future selectedTool triggers skip the approval prompt
|
|
576
|
+
* await client.userApprovals.create({
|
|
577
|
+
* webhookIdentifier: metadata.webhookIdentifier,
|
|
471
578
|
* userId: "user-uuid",
|
|
472
|
-
*
|
|
473
|
-
* toolName: "sendEmail",
|
|
579
|
+
* toolName: selectedTool.toolName,
|
|
474
580
|
* mode: "always_allow",
|
|
475
581
|
* });
|
|
476
582
|
*
|
|
@@ -489,22 +595,56 @@ declare class UserApprovalsClient {
|
|
|
489
595
|
constructor(options: ResolvedOptions, http: HttpClient);
|
|
490
596
|
/**
|
|
491
597
|
* List auto-approval rules for a webhook. Optionally filter by `userId`.
|
|
598
|
+
* When `userId` is omitted, AgentPress returns all approval rules for the
|
|
599
|
+
* signed webhook. Partner user-settings UIs should usually pass `userId` and
|
|
600
|
+
* `authProvider`.
|
|
492
601
|
*
|
|
493
602
|
* @throws ConfigurationError if webhookSecret is not configured
|
|
494
|
-
* @throws HttpError on non-2xx response
|
|
603
|
+
* @throws HttpError on non-2xx response. A 422 with
|
|
604
|
+
* `code: "USER_NOT_PROVISIONED"` means the external user has not
|
|
605
|
+
* authenticated into AgentPress yet or is not a member of the webhook's org.
|
|
495
606
|
* @throws TimeoutError if request exceeds timeout
|
|
496
607
|
*/
|
|
497
608
|
list(params: ListUserApprovalsParams): Promise<ListUserApprovalsResponse>;
|
|
609
|
+
/**
|
|
610
|
+
* Fetch metadata for a webhook plus the ordered tools that its default action
|
|
611
|
+
* rule stages for approval. This is the SDK source of truth for partner
|
|
612
|
+
* settings UIs; `actionWebhookId` in the response can be passed to older
|
|
613
|
+
* AgentPress versions that still require it. Tool order matches the
|
|
614
|
+
* AgentPress approval popup.
|
|
615
|
+
*
|
|
616
|
+
* @throws ConfigurationError if webhookSecret is not configured
|
|
617
|
+
* @throws HttpError on non-2xx response
|
|
618
|
+
* @throws TimeoutError if request exceeds timeout
|
|
619
|
+
*/
|
|
620
|
+
getWebhookMetadata(params: GetUserApprovalWebhookMetadataParams): Promise<WebhookApprovalMetadata>;
|
|
498
621
|
/**
|
|
499
622
|
* Create (or upsert) an auto-approval rule. If a rule with the same
|
|
500
623
|
* `(userId, actionWebhookId, toolName)` triple already exists, it is
|
|
501
|
-
* updated in place.
|
|
624
|
+
* updated in place. `actionWebhookId` is optional for current AgentPress
|
|
625
|
+
* core; the webhook URL scope resolves it from `webhookIdentifier`. Use
|
|
626
|
+
* `toolName` values from `getWebhookMetadata().availableTools`.
|
|
502
627
|
*
|
|
503
628
|
* @throws ConfigurationError if webhookSecret is not configured
|
|
504
|
-
* @throws HttpError on non-2xx response
|
|
629
|
+
* @throws HttpError on non-2xx response. A 422 with
|
|
630
|
+
* `code: "USER_NOT_PROVISIONED"` means the external user has not
|
|
631
|
+
* authenticated into AgentPress yet or is not a member of the webhook's org.
|
|
505
632
|
* @throws TimeoutError if request exceeds timeout
|
|
506
633
|
*/
|
|
507
634
|
create(params: CreateUserApprovalParams): Promise<UserToolApproval>;
|
|
635
|
+
/**
|
|
636
|
+
* Idempotently sync a partner settings UI's Allow/Ask choices for one user
|
|
637
|
+
* and one webhook. `mode: "ask"` removes an existing allow rule for that
|
|
638
|
+
* listed tool. Existing `always_deny` rules and non-listed tool rules are
|
|
639
|
+
* preserved.
|
|
640
|
+
*
|
|
641
|
+
* @throws ConfigurationError if webhookSecret is not configured
|
|
642
|
+
* @throws HttpError on non-2xx response. A 422 with
|
|
643
|
+
* `code: "USER_NOT_PROVISIONED"` means the external user has not
|
|
644
|
+
* authenticated into AgentPress yet or is not a member of the webhook's org.
|
|
645
|
+
* @throws TimeoutError if request exceeds timeout
|
|
646
|
+
*/
|
|
647
|
+
sync(params: SyncUserApprovalsParams): Promise<SyncUserApprovalsResponse>;
|
|
508
648
|
/**
|
|
509
649
|
* Patch an existing auto-approval rule (change mode or expiry).
|
|
510
650
|
*
|
|
@@ -670,5 +810,5 @@ declare class KeyRotationVerifyError extends AgentPressError {
|
|
|
670
810
|
constructor(reason: KeyRotationVerifyErrorReason, message: string);
|
|
671
811
|
}
|
|
672
812
|
//#endregion
|
|
673
|
-
export { ACTION_EVENT_TYPES, type ActionCallbackPayload, type ActionEventType, type ActionManageResponse, type ActionStatus, ActionsClient, AgentPress, AgentPressError, type AgentPressOptions, type AgentResponse, type ApprovalMode, type ApproveActionParams, ConfigurationError, type CreateUserApprovalParams, type DeleteUserApprovalParams, HttpError, type KeyRotationEvent, KeyRotationVerifyError, type KeyRotationVerifyErrorReason, type KeyRotationVerifyParams, type ListUserApprovalsParams, type ListUserApprovalsResponse, type PartnerMcpOptions, type PartnerTokenClaims, PartnerTokenError, type PartnerTokenErrorReason, PartnersClient, type RejectActionParams, type StagedToolCall, type StagedToolCallSummary, TimeoutError, type ToolCallResult, type UpdateUserApprovalParams, UserApprovalsClient, type UserToolApproval, type WebhookResponse, type WebhookSendParams, WebhookSignatureError, type WebhookVerifyParams, WebhooksClient };
|
|
813
|
+
export { ACTION_EVENT_TYPES, type ActionCallbackPayload, type ActionEventType, type ActionManageResponse, type ActionStatus, ActionsClient, AgentPress, AgentPressError, type AgentPressOptions, type AgentResponse, type ApprovalMode, type ApprovalRuleSyncMode, type ApproveActionParams, ConfigurationError, type CreateUserApprovalParams, type DeleteUserApprovalParams, type GetUserApprovalWebhookMetadataParams, HttpError, type KeyRotationEvent, KeyRotationVerifyError, type KeyRotationVerifyErrorReason, type KeyRotationVerifyParams, type ListUserApprovalsParams, type ListUserApprovalsResponse, type PartnerMcpOptions, type PartnerTokenClaims, PartnerTokenError, type PartnerTokenErrorReason, PartnersClient, type RejectActionParams, type StagedToolCall, type StagedToolCallSummary, type SyncUserApprovalRule, type SyncUserApprovalsParams, type SyncUserApprovalsResponse, TimeoutError, type ToolCallResult, type UpdateUserApprovalParams, UserApprovalsClient, type UserToolApproval, type WebhookApprovalMetadata, type WebhookApprovalToolMetadata, type WebhookResponse, type WebhookSendParams, WebhookSignatureError, type WebhookVerifyParams, WebhooksClient };
|
|
674
814
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/http.ts","../src/actions/client.ts","../src/partners/client.ts","../src/userApprovals/client.ts","../src/webhooks/client.ts","../src/client.ts","../src/errors.ts"],"mappings":";;UACiB,iBAAA;EAAiB;EAEhC,aAAA;EAkBa;EAhBb,MAAA;EAoBqC;EAlBrC,OAAA;EAkB6C;EAhB7C,OAAA;EAJA;EAMA,GAAA;EAFA;;;;;;;;;EAYA,UAAA,GAAa,iBAAA;EAIwB;EAFrC,SAAA,IAAa,GAAA,UAAa,IAAA,EAAM,WAAA;EAEa;EAA7C,UAAA,IAAc,GAAA,UAAa,QAAA,EAAU,QAAA;AAAA;;UAItB,iBAAA;EAAiB;;;;;;;EAQhC,OAAA;EAqBiB;AAInB;;;;EAnBE,MAAA;EAuBA;EArBA,QAAA;EAyBA;EAvBA,mBAAA;EA2BA;;;;;EArBA,cAAA;EAiCC
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/http.ts","../src/actions/client.ts","../src/partners/client.ts","../src/userApprovals/client.ts","../src/webhooks/client.ts","../src/client.ts","../src/errors.ts"],"mappings":";;UAC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