@agentpress/sdk 0.5.3 → 0.5.5
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 +69 -7
- package/dist/index.cjs +114 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +127 -48
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +127 -48
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +114 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -113,10 +113,15 @@ interface KeyRotationEvent {
|
|
|
113
113
|
}
|
|
114
114
|
/** Parameters for {@link WebhooksClient.send}. */
|
|
115
115
|
interface WebhookSendParams {
|
|
116
|
-
/**
|
|
116
|
+
/** Action webhook identifier (used in `/webhooks/actions/:org/:identifier`). */
|
|
117
117
|
action: string;
|
|
118
118
|
/** Arbitrary payload data forwarded to the webhook handler. */
|
|
119
119
|
payload: Record<string, unknown>;
|
|
120
|
+
/**
|
|
121
|
+
* Verification scheme for the outbound request. Defaults to Svix signing
|
|
122
|
+
* with the client's `webhookSecret`.
|
|
123
|
+
*/
|
|
124
|
+
auth?: WebhookSendAuth;
|
|
120
125
|
}
|
|
121
126
|
/** Parameters for verifying an inbound webhook signature via {@link WebhooksClient.verify} or {@link WebhooksClient.verifyOrThrow}. */
|
|
122
127
|
interface WebhookVerifyParams {
|
|
@@ -136,6 +141,7 @@ interface WebhookResponse {
|
|
|
136
141
|
actionId?: string;
|
|
137
142
|
/** `true` if an action with the same `externalId` already existed (idempotency). */
|
|
138
143
|
alreadyExists?: boolean;
|
|
144
|
+
/** `true` when AgentPress accepted the event but intentionally skipped dispatch. */
|
|
139
145
|
skipped?: boolean;
|
|
140
146
|
/**
|
|
141
147
|
* `true` when AgentPress accepted the event (HTTP 202) but could not create
|
|
@@ -145,15 +151,69 @@ interface WebhookResponse {
|
|
|
145
151
|
* is returned in this case; use {@link eventId} to correlate.
|
|
146
152
|
*/
|
|
147
153
|
buffered?: boolean;
|
|
148
|
-
/** UUID of the
|
|
154
|
+
/** UUID of the persisted `webhook_events` row for buffered or skipped events. */
|
|
149
155
|
eventId?: string;
|
|
150
|
-
/** Machine-readable reason the event was buffered
|
|
156
|
+
/** Machine-readable reason the event was buffered or skipped. */
|
|
151
157
|
reason?: string;
|
|
152
158
|
data?: Record<string, unknown>;
|
|
153
159
|
}
|
|
160
|
+
/** Authentication options for {@link WebhooksClient.send}. */
|
|
161
|
+
type WebhookSendAuth = {
|
|
162
|
+
scheme: "svix"; /** Action webhook secret. Defaults to the client's `webhookSecret`. */
|
|
163
|
+
secret?: string; /** Optional stable message id for deterministic tests/retries. */
|
|
164
|
+
msgId?: string; /** Unix timestamp in seconds. Defaults to now. */
|
|
165
|
+
timestamp?: number;
|
|
166
|
+
} | {
|
|
167
|
+
scheme: "hmac_sha256"; /** Action webhook secret. Defaults to the client's `webhookSecret`. */
|
|
168
|
+
secret?: string; /** Unix timestamp in seconds. Defaults to now. */
|
|
169
|
+
timestamp?: number;
|
|
170
|
+
} | {
|
|
171
|
+
scheme: "shared_token"; /** Action webhook token. Defaults to the client's `webhookSecret`. */
|
|
172
|
+
token?: string;
|
|
173
|
+
} | {
|
|
174
|
+
/** No verification headers. Only use for intentionally public webhooks. */scheme: "none";
|
|
175
|
+
};
|
|
176
|
+
/** Response from sending an event to the legacy Actions listener endpoint. */
|
|
177
|
+
interface WebhookIngestResponse {
|
|
178
|
+
/** UUID of the persisted `webhook_events` row. */
|
|
179
|
+
eventId: string;
|
|
180
|
+
/** True when the event matched an existing source/dedupe key. */
|
|
181
|
+
duplicate: boolean;
|
|
182
|
+
}
|
|
183
|
+
/** Authentication options for {@link WebhooksClient.sendToActionsListener}. */
|
|
184
|
+
type WebhookIngestAuth = {
|
|
185
|
+
scheme: "svix"; /** Listener secret shown once on create/rotation. */
|
|
186
|
+
secret: string; /** Optional stable message id for deterministic tests/retries. */
|
|
187
|
+
msgId?: string; /** Unix timestamp in seconds. Defaults to now. */
|
|
188
|
+
timestamp?: number;
|
|
189
|
+
} | {
|
|
190
|
+
scheme: "hmac_sha256"; /** Listener secret shown once on create/rotation. */
|
|
191
|
+
secret: string; /** Unix timestamp in seconds. Defaults to now. */
|
|
192
|
+
timestamp?: number;
|
|
193
|
+
} | {
|
|
194
|
+
scheme: "shared_token"; /** Listener token shown once on create/rotation. */
|
|
195
|
+
token: string;
|
|
196
|
+
} | {
|
|
197
|
+
/** Secret-URL listener. The endpoint URL itself is the credential. */scheme: "none";
|
|
198
|
+
};
|
|
199
|
+
/** Parameters for sending directly to the legacy Actions listener endpoint. */
|
|
200
|
+
interface WebhookIngestSendParams {
|
|
201
|
+
/** Listener identifier used in `/webhooks/ingest/:org/:identifier`. */
|
|
202
|
+
identifier: string;
|
|
203
|
+
/** Arbitrary JSON payload to buffer and route through the listener. */
|
|
204
|
+
payload: Record<string, unknown>;
|
|
205
|
+
/** Auth scheme matching the listener verification setting. */
|
|
206
|
+
auth: WebhookIngestAuth;
|
|
207
|
+
}
|
|
208
|
+
/** Preferred response name for Actions listener integrations. */
|
|
209
|
+
type ActionsListenerResponse = WebhookIngestResponse;
|
|
210
|
+
/** Preferred auth name for Actions listener integrations. */
|
|
211
|
+
type ActionsListenerAuth = WebhookIngestAuth;
|
|
212
|
+
/** Preferred parameter name for {@link WebhooksClient.sendToActionsListener}. */
|
|
213
|
+
type ActionsListenerSendParams = WebhookIngestSendParams;
|
|
154
214
|
/** Parameters for {@link signHmacWebhookRequest}. */
|
|
155
215
|
interface SignHmacWebhookRequestParams {
|
|
156
|
-
/** The webhook
|
|
216
|
+
/** The action webhook's shared secret. */
|
|
157
217
|
secret: string;
|
|
158
218
|
/**
|
|
159
219
|
* The exact raw request body string that will be sent. The signature is
|
|
@@ -173,71 +233,75 @@ interface SignedHmacWebhookRequest {
|
|
|
173
233
|
};
|
|
174
234
|
}
|
|
175
235
|
/**
|
|
176
|
-
* Verification scheme for an
|
|
177
|
-
* (`POST /webhooks/
|
|
236
|
+
* Verification scheme for an action webhook
|
|
237
|
+
* (`POST /webhooks/actions/:org/:identifier`).
|
|
178
238
|
*
|
|
179
239
|
* - `"svix"` — Svix-style signing (`svix-id` / `svix-timestamp` / `svix-signature`).
|
|
180
240
|
* - `"hmac_sha256"` — `x-webhook-timestamp` + `x-webhook-signature` headers;
|
|
181
241
|
* sign with {@link signHmacWebhookRequest}.
|
|
182
242
|
* - `"shared_token"` — `Authorization: Bearer <token>` or `x-webhook-token`;
|
|
183
243
|
* build with {@link sharedTokenHeaders}.
|
|
184
|
-
* - `"none"` —
|
|
185
|
-
*
|
|
244
|
+
* - `"none"` — no verification headers; intended only for deliberately public
|
|
245
|
+
* or legacy endpoints.
|
|
186
246
|
*/
|
|
187
247
|
type WebhookVerificationScheme = "svix" | "hmac_sha256" | "shared_token" | "none";
|
|
188
|
-
/**
|
|
248
|
+
/** Preferred verification-scheme name for Actions listener integrations. */
|
|
249
|
+
type ActionsListenerVerificationScheme = WebhookVerificationScheme;
|
|
250
|
+
/** Environment label for an action webhook. */
|
|
189
251
|
type WebhookEnvironment = "dev" | "sandbox" | "prod";
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
|
|
252
|
+
/** Preferred environment name for Actions listener integrations. */
|
|
253
|
+
type ActionsListenerEnvironment = WebhookEnvironment;
|
|
254
|
+
/** Per-action-webhook routing configuration. */
|
|
255
|
+
interface IActionWebhookRoutingConfig {
|
|
256
|
+
/** Legacy listener compatibility: event types to log but never dispatch. */
|
|
193
257
|
ignoredEventTypes?: string[];
|
|
194
|
-
/**
|
|
195
|
-
* `"route"` dispatches buffered events to the target agent;
|
|
196
|
-
* `"buffer_only"` accepts + logs events but skips agent dispatch.
|
|
197
|
-
*/
|
|
258
|
+
/** Legacy listener compatibility: buffer events without dispatching. */
|
|
198
259
|
mode?: "route" | "buffer_only";
|
|
199
260
|
/** Retention window in days for processed/skipped events. */
|
|
200
261
|
retentionDays?: number;
|
|
201
|
-
/** Sender IPs allowed to hit the
|
|
262
|
+
/** Sender IPs allowed to hit the webhook endpoint. Empty/omitted = all. */
|
|
202
263
|
ipAllowlist?: string[];
|
|
203
|
-
/**
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
*/
|
|
207
|
-
instructions?: string;
|
|
208
|
-
/** Ingest quota for this listener. Defaults to 100, capped at 1000. */
|
|
264
|
+
/** Browser sender origins allowed to hit the webhook endpoint. Empty/omitted = all. */
|
|
265
|
+
allowedOrigins?: string[];
|
|
266
|
+
/** Request quota for this action webhook. Defaults to 100/minute, capped at 1000. */
|
|
209
267
|
rateLimitPerMinute?: number;
|
|
268
|
+
/** Legacy listener compatibility. New instructions should live on the action rule. */
|
|
269
|
+
instructions?: string;
|
|
210
270
|
}
|
|
211
|
-
/**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
*/
|
|
216
|
-
interface
|
|
271
|
+
/** Compatibility routing-config name for Actions listener integrations. */
|
|
272
|
+
type IWebhookListenerRoutingConfig = IActionWebhookRoutingConfig;
|
|
273
|
+
/** Preferred routing-config name for Actions listener integrations. */
|
|
274
|
+
type IActionsListenerRoutingConfig = IActionWebhookRoutingConfig;
|
|
275
|
+
/** Action webhook configuration as exposed to SDK consumers. */
|
|
276
|
+
interface IActionWebhookConfig {
|
|
217
277
|
/** Human-readable display name. */
|
|
218
278
|
name: string;
|
|
219
|
-
/** Stable slug used in the
|
|
279
|
+
/** Stable slug used in the webhook URL path. */
|
|
220
280
|
identifier: string;
|
|
221
281
|
/** How inbound requests are authenticated. */
|
|
222
282
|
verificationScheme: WebhookVerificationScheme;
|
|
223
|
-
/** Environment label for the
|
|
283
|
+
/** Environment label for the webhook. */
|
|
224
284
|
environment: WebhookEnvironment;
|
|
225
|
-
/** Disabled
|
|
285
|
+
/** Disabled webhooks reject inbound events at the edge. */
|
|
226
286
|
enabled: boolean;
|
|
227
|
-
/** Agent on the
|
|
287
|
+
/** Agent on the default action rule. */
|
|
228
288
|
targetAgentId: string | null;
|
|
229
289
|
/** Fallback user actions run as when the payload does not resolve one. */
|
|
230
290
|
runAsUserId: string | null;
|
|
231
291
|
/** Routing, retention, and rate-limit configuration. */
|
|
232
|
-
routingConfig:
|
|
292
|
+
routingConfig: IActionWebhookRoutingConfig;
|
|
233
293
|
}
|
|
294
|
+
/** Compatibility config name for Actions listener integrations. */
|
|
295
|
+
type IWebhookListenerConfig = IActionWebhookConfig;
|
|
296
|
+
/** Preferred config name for Actions listener integrations. */
|
|
297
|
+
type IActionsListenerConfig = IActionWebhookConfig;
|
|
234
298
|
/**
|
|
235
|
-
* An action rule's
|
|
299
|
+
* An action rule's webhook subscription. Rules that subscribe to an action
|
|
236
300
|
* webhook receive its buffered events in addition to the webhook's default
|
|
237
|
-
* rule, so one
|
|
301
|
+
* rule, so one action webhook can fan out to several rules.
|
|
238
302
|
*/
|
|
239
|
-
interface
|
|
240
|
-
/**
|
|
303
|
+
interface IActionRuleWebhookSubscription {
|
|
304
|
+
/** Action webhook this rule subscribes to; `null` = no subscription. */
|
|
241
305
|
listenWebhookId: string | null;
|
|
242
306
|
/** Event types to receive; empty array = all event types. */
|
|
243
307
|
listenEventTypes: string[];
|
|
@@ -778,7 +842,8 @@ declare class WebhooksClient {
|
|
|
778
842
|
constructor(options: ResolvedOptions, http: HttpClient);
|
|
779
843
|
/**
|
|
780
844
|
* Send an arbitrary webhook payload to AgentPress.
|
|
781
|
-
* Signs the payload with
|
|
845
|
+
* Signs the payload with the verification scheme configured on the action
|
|
846
|
+
* webhook. Defaults to Svix-compatible signing.
|
|
782
847
|
*
|
|
783
848
|
* On the happy path the response is synchronous: `{ success: true,
|
|
784
849
|
* actionId, data }`, or `{ success, actionId, alreadyExists: true, data }`
|
|
@@ -791,11 +856,25 @@ declare class WebhooksClient {
|
|
|
791
856
|
* auto-processes once an operator fixes the configuration, so check
|
|
792
857
|
* {@link WebhookResponse.buffered} before relying on `actionId`.
|
|
793
858
|
*
|
|
794
|
-
* @throws ConfigurationError if
|
|
859
|
+
* @throws ConfigurationError if the selected verification scheme needs a
|
|
860
|
+
* secret/token and none is configured
|
|
795
861
|
* @throws HttpError on non-2xx response
|
|
796
862
|
* @throws TimeoutError if request exceeds timeout
|
|
797
863
|
*/
|
|
798
864
|
send(params: WebhookSendParams): Promise<WebhookResponse>;
|
|
865
|
+
/**
|
|
866
|
+
* Send a payload to the legacy Actions listener ingestion endpoint
|
|
867
|
+
* (`POST /webhooks/ingest/:org/:identifier`).
|
|
868
|
+
*
|
|
869
|
+
* New integrations should prefer {@link send}; this method is kept for
|
|
870
|
+
* existing listener integrations and SDK patch compatibility.
|
|
871
|
+
*/
|
|
872
|
+
sendToActionsListener(params: ActionsListenerSendParams): Promise<ActionsListenerResponse>;
|
|
873
|
+
/**
|
|
874
|
+
* @deprecated Use {@link sendToActionsListener}. Kept as a compatibility
|
|
875
|
+
* alias for integrations created before the Actions listener naming update.
|
|
876
|
+
*/
|
|
877
|
+
sendToListener(params: WebhookIngestSendParams): Promise<WebhookIngestResponse>;
|
|
799
878
|
/**
|
|
800
879
|
* Verify an inbound Svix webhook signature.
|
|
801
880
|
*
|
|
@@ -924,11 +1003,11 @@ declare class KeyRotationVerifyError extends AgentPressError {
|
|
|
924
1003
|
constructor(reason: KeyRotationVerifyErrorReason, message: string);
|
|
925
1004
|
}
|
|
926
1005
|
//#endregion
|
|
927
|
-
//#region src/webhooks/
|
|
1006
|
+
//#region src/webhooks/actionWebhookSigning.d.ts
|
|
928
1007
|
/**
|
|
929
|
-
* Sign an outbound request for an AgentPress
|
|
930
|
-
*
|
|
931
|
-
* (`POST /webhooks/
|
|
1008
|
+
* Sign an outbound request for an AgentPress action webhook that uses the
|
|
1009
|
+
* `hmac_sha256` verification scheme
|
|
1010
|
+
* (`POST /webhooks/actions/:org/:identifier`).
|
|
932
1011
|
*
|
|
933
1012
|
* Produces the two headers AgentPress verifies:
|
|
934
1013
|
*
|
|
@@ -943,7 +1022,7 @@ declare class KeyRotationVerifyError extends AgentPressError {
|
|
|
943
1022
|
* ```ts
|
|
944
1023
|
* const rawBody = JSON.stringify({ eventType: "review.created", data: {...} });
|
|
945
1024
|
* const { headers } = signHmacWebhookRequest({ secret, rawBody });
|
|
946
|
-
* await fetch(
|
|
1025
|
+
* await fetch(actionWebhookUrl, {
|
|
947
1026
|
* method: "POST",
|
|
948
1027
|
* body: rawBody,
|
|
949
1028
|
* headers: { "content-type": "application/json", ...headers },
|
|
@@ -952,8 +1031,8 @@ declare class KeyRotationVerifyError extends AgentPressError {
|
|
|
952
1031
|
*/
|
|
953
1032
|
declare function signHmacWebhookRequest(params: SignHmacWebhookRequestParams): SignedHmacWebhookRequest;
|
|
954
1033
|
/**
|
|
955
|
-
* Build the auth header for an AgentPress
|
|
956
|
-
*
|
|
1034
|
+
* Build the auth header for an AgentPress action webhook that uses the
|
|
1035
|
+
* `shared_token` verification scheme. AgentPress also accepts
|
|
957
1036
|
* `Authorization: Bearer <token>`; this helper uses the dedicated
|
|
958
1037
|
* `x-webhook-token` header so it never collides with other auth middleware.
|
|
959
1038
|
*/
|
|
@@ -961,5 +1040,5 @@ declare function sharedTokenHeaders(token: string): {
|
|
|
961
1040
|
"x-webhook-token": string;
|
|
962
1041
|
};
|
|
963
1042
|
//#endregion
|
|
964
|
-
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
|
|
1043
|
+
export { ACTION_EVENT_TYPES, type ActionCallbackPayload, type ActionEventType, type ActionManageResponse, type ActionStatus, ActionsClient, type ActionsListenerAuth, type ActionsListenerEnvironment, type ActionsListenerResponse, type ActionsListenerSendParams, type ActionsListenerVerificationScheme, AgentPress, AgentPressError, type AgentPressOptions, type AgentResponse, type ApprovalMode, type ApprovalRuleSyncMode, type ApproveActionParams, ConfigurationError, type CreateUserApprovalParams, type DeleteUserApprovalParams, type GetUserApprovalWebhookMetadataParams, HttpError, type IActionRuleWebhookSubscription, type IActionWebhookConfig, type IActionWebhookRoutingConfig, type IActionsListenerConfig, type IActionsListenerRoutingConfig, type IWebhookListenerConfig, type IWebhookListenerRoutingConfig, type KeyRotationEvent, KeyRotationVerifyError, type KeyRotationVerifyErrorReason, type KeyRotationVerifyParams, type ListUserApprovalsParams, type ListUserApprovalsResponse, type PartnerMcpOptions, type PartnerTokenClaims, PartnerTokenError, type PartnerTokenErrorReason, PartnersClient, type RejectActionParams, type SignHmacWebhookRequestParams, type SignedHmacWebhookRequest, type StagedToolCall, type StagedToolCallSummary, type SyncUserApprovalRule, type SyncUserApprovalsParams, type SyncUserApprovalsResponse, TimeoutError, type ToolCallResult, type UpdateUserApprovalParams, UserApprovalsClient, type UserToolApproval, type WebhookApprovalMetadata, type WebhookApprovalToolMetadata, type WebhookEnvironment, type WebhookIngestAuth, type WebhookIngestResponse, type WebhookIngestSendParams, type WebhookResponse, type WebhookSendAuth, type WebhookSendParams, WebhookSignatureError, type WebhookVerificationScheme, type WebhookVerifyParams, WebhooksClient, sharedTokenHeaders, signHmacWebhookRequest };
|
|
965
1044
|
//# 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","../src/webhooks/
|
|
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","../src/webhooks/actionWebhookSigning.ts"],"mappings":";;UACiB,iBAAA;EAAiB;EAEhC,aAAA;EAkBa;EAhBb,MAAA;EAoB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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;;;AP7GpD;;;;;;;;;;;;;;;;;;;;;;;;AAwB+C;AAxB/C,iBQ+BgB,sBAAA,CACd,MAAA,EAAQ,4BAAA,GACP,wBAAwB;;;;;;;iBAqBX,kBAAA,CAAmB,KAAA;EACjC,iBAAiB;AAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -113,10 +113,15 @@ interface KeyRotationEvent {
|
|
|
113
113
|
}
|
|
114
114
|
/** Parameters for {@link WebhooksClient.send}. */
|
|
115
115
|
interface WebhookSendParams {
|
|
116
|
-
/**
|
|
116
|
+
/** Action webhook identifier (used in `/webhooks/actions/:org/:identifier`). */
|
|
117
117
|
action: string;
|
|
118
118
|
/** Arbitrary payload data forwarded to the webhook handler. */
|
|
119
119
|
payload: Record<string, unknown>;
|
|
120
|
+
/**
|
|
121
|
+
* Verification scheme for the outbound request. Defaults to Svix signing
|
|
122
|
+
* with the client's `webhookSecret`.
|
|
123
|
+
*/
|
|
124
|
+
auth?: WebhookSendAuth;
|
|
120
125
|
}
|
|
121
126
|
/** Parameters for verifying an inbound webhook signature via {@link WebhooksClient.verify} or {@link WebhooksClient.verifyOrThrow}. */
|
|
122
127
|
interface WebhookVerifyParams {
|
|
@@ -136,6 +141,7 @@ interface WebhookResponse {
|
|
|
136
141
|
actionId?: string;
|
|
137
142
|
/** `true` if an action with the same `externalId` already existed (idempotency). */
|
|
138
143
|
alreadyExists?: boolean;
|
|
144
|
+
/** `true` when AgentPress accepted the event but intentionally skipped dispatch. */
|
|
139
145
|
skipped?: boolean;
|
|
140
146
|
/**
|
|
141
147
|
* `true` when AgentPress accepted the event (HTTP 202) but could not create
|
|
@@ -145,15 +151,69 @@ interface WebhookResponse {
|
|
|
145
151
|
* is returned in this case; use {@link eventId} to correlate.
|
|
146
152
|
*/
|
|
147
153
|
buffered?: boolean;
|
|
148
|
-
/** UUID of the
|
|
154
|
+
/** UUID of the persisted `webhook_events` row for buffered or skipped events. */
|
|
149
155
|
eventId?: string;
|
|
150
|
-
/** Machine-readable reason the event was buffered
|
|
156
|
+
/** Machine-readable reason the event was buffered or skipped. */
|
|
151
157
|
reason?: string;
|
|
152
158
|
data?: Record<string, unknown>;
|
|
153
159
|
}
|
|
160
|
+
/** Authentication options for {@link WebhooksClient.send}. */
|
|
161
|
+
type WebhookSendAuth = {
|
|
162
|
+
scheme: "svix"; /** Action webhook secret. Defaults to the client's `webhookSecret`. */
|
|
163
|
+
secret?: string; /** Optional stable message id for deterministic tests/retries. */
|
|
164
|
+
msgId?: string; /** Unix timestamp in seconds. Defaults to now. */
|
|
165
|
+
timestamp?: number;
|
|
166
|
+
} | {
|
|
167
|
+
scheme: "hmac_sha256"; /** Action webhook secret. Defaults to the client's `webhookSecret`. */
|
|
168
|
+
secret?: string; /** Unix timestamp in seconds. Defaults to now. */
|
|
169
|
+
timestamp?: number;
|
|
170
|
+
} | {
|
|
171
|
+
scheme: "shared_token"; /** Action webhook token. Defaults to the client's `webhookSecret`. */
|
|
172
|
+
token?: string;
|
|
173
|
+
} | {
|
|
174
|
+
/** No verification headers. Only use for intentionally public webhooks. */scheme: "none";
|
|
175
|
+
};
|
|
176
|
+
/** Response from sending an event to the legacy Actions listener endpoint. */
|
|
177
|
+
interface WebhookIngestResponse {
|
|
178
|
+
/** UUID of the persisted `webhook_events` row. */
|
|
179
|
+
eventId: string;
|
|
180
|
+
/** True when the event matched an existing source/dedupe key. */
|
|
181
|
+
duplicate: boolean;
|
|
182
|
+
}
|
|
183
|
+
/** Authentication options for {@link WebhooksClient.sendToActionsListener}. */
|
|
184
|
+
type WebhookIngestAuth = {
|
|
185
|
+
scheme: "svix"; /** Listener secret shown once on create/rotation. */
|
|
186
|
+
secret: string; /** Optional stable message id for deterministic tests/retries. */
|
|
187
|
+
msgId?: string; /** Unix timestamp in seconds. Defaults to now. */
|
|
188
|
+
timestamp?: number;
|
|
189
|
+
} | {
|
|
190
|
+
scheme: "hmac_sha256"; /** Listener secret shown once on create/rotation. */
|
|
191
|
+
secret: string; /** Unix timestamp in seconds. Defaults to now. */
|
|
192
|
+
timestamp?: number;
|
|
193
|
+
} | {
|
|
194
|
+
scheme: "shared_token"; /** Listener token shown once on create/rotation. */
|
|
195
|
+
token: string;
|
|
196
|
+
} | {
|
|
197
|
+
/** Secret-URL listener. The endpoint URL itself is the credential. */scheme: "none";
|
|
198
|
+
};
|
|
199
|
+
/** Parameters for sending directly to the legacy Actions listener endpoint. */
|
|
200
|
+
interface WebhookIngestSendParams {
|
|
201
|
+
/** Listener identifier used in `/webhooks/ingest/:org/:identifier`. */
|
|
202
|
+
identifier: string;
|
|
203
|
+
/** Arbitrary JSON payload to buffer and route through the listener. */
|
|
204
|
+
payload: Record<string, unknown>;
|
|
205
|
+
/** Auth scheme matching the listener verification setting. */
|
|
206
|
+
auth: WebhookIngestAuth;
|
|
207
|
+
}
|
|
208
|
+
/** Preferred response name for Actions listener integrations. */
|
|
209
|
+
type ActionsListenerResponse = WebhookIngestResponse;
|
|
210
|
+
/** Preferred auth name for Actions listener integrations. */
|
|
211
|
+
type ActionsListenerAuth = WebhookIngestAuth;
|
|
212
|
+
/** Preferred parameter name for {@link WebhooksClient.sendToActionsListener}. */
|
|
213
|
+
type ActionsListenerSendParams = WebhookIngestSendParams;
|
|
154
214
|
/** Parameters for {@link signHmacWebhookRequest}. */
|
|
155
215
|
interface SignHmacWebhookRequestParams {
|
|
156
|
-
/** The webhook
|
|
216
|
+
/** The action webhook's shared secret. */
|
|
157
217
|
secret: string;
|
|
158
218
|
/**
|
|
159
219
|
* The exact raw request body string that will be sent. The signature is
|
|
@@ -173,71 +233,75 @@ interface SignedHmacWebhookRequest {
|
|
|
173
233
|
};
|
|
174
234
|
}
|
|
175
235
|
/**
|
|
176
|
-
* Verification scheme for an
|
|
177
|
-
* (`POST /webhooks/
|
|
236
|
+
* Verification scheme for an action webhook
|
|
237
|
+
* (`POST /webhooks/actions/:org/:identifier`).
|
|
178
238
|
*
|
|
179
239
|
* - `"svix"` — Svix-style signing (`svix-id` / `svix-timestamp` / `svix-signature`).
|
|
180
240
|
* - `"hmac_sha256"` — `x-webhook-timestamp` + `x-webhook-signature` headers;
|
|
181
241
|
* sign with {@link signHmacWebhookRequest}.
|
|
182
242
|
* - `"shared_token"` — `Authorization: Bearer <token>` or `x-webhook-token`;
|
|
183
243
|
* build with {@link sharedTokenHeaders}.
|
|
184
|
-
* - `"none"` —
|
|
185
|
-
*
|
|
244
|
+
* - `"none"` — no verification headers; intended only for deliberately public
|
|
245
|
+
* or legacy endpoints.
|
|
186
246
|
*/
|
|
187
247
|
type WebhookVerificationScheme = "svix" | "hmac_sha256" | "shared_token" | "none";
|
|
188
|
-
/**
|
|
248
|
+
/** Preferred verification-scheme name for Actions listener integrations. */
|
|
249
|
+
type ActionsListenerVerificationScheme = WebhookVerificationScheme;
|
|
250
|
+
/** Environment label for an action webhook. */
|
|
189
251
|
type WebhookEnvironment = "dev" | "sandbox" | "prod";
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
|
|
252
|
+
/** Preferred environment name for Actions listener integrations. */
|
|
253
|
+
type ActionsListenerEnvironment = WebhookEnvironment;
|
|
254
|
+
/** Per-action-webhook routing configuration. */
|
|
255
|
+
interface IActionWebhookRoutingConfig {
|
|
256
|
+
/** Legacy listener compatibility: event types to log but never dispatch. */
|
|
193
257
|
ignoredEventTypes?: string[];
|
|
194
|
-
/**
|
|
195
|
-
* `"route"` dispatches buffered events to the target agent;
|
|
196
|
-
* `"buffer_only"` accepts + logs events but skips agent dispatch.
|
|
197
|
-
*/
|
|
258
|
+
/** Legacy listener compatibility: buffer events without dispatching. */
|
|
198
259
|
mode?: "route" | "buffer_only";
|
|
199
260
|
/** Retention window in days for processed/skipped events. */
|
|
200
261
|
retentionDays?: number;
|
|
201
|
-
/** Sender IPs allowed to hit the
|
|
262
|
+
/** Sender IPs allowed to hit the webhook endpoint. Empty/omitted = all. */
|
|
202
263
|
ipAllowlist?: string[];
|
|
203
|
-
/**
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
*/
|
|
207
|
-
instructions?: string;
|
|
208
|
-
/** Ingest quota for this listener. Defaults to 100, capped at 1000. */
|
|
264
|
+
/** Browser sender origins allowed to hit the webhook endpoint. Empty/omitted = all. */
|
|
265
|
+
allowedOrigins?: string[];
|
|
266
|
+
/** Request quota for this action webhook. Defaults to 100/minute, capped at 1000. */
|
|
209
267
|
rateLimitPerMinute?: number;
|
|
268
|
+
/** Legacy listener compatibility. New instructions should live on the action rule. */
|
|
269
|
+
instructions?: string;
|
|
210
270
|
}
|
|
211
|
-
/**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
*/
|
|
216
|
-
interface
|
|
271
|
+
/** Compatibility routing-config name for Actions listener integrations. */
|
|
272
|
+
type IWebhookListenerRoutingConfig = IActionWebhookRoutingConfig;
|
|
273
|
+
/** Preferred routing-config name for Actions listener integrations. */
|
|
274
|
+
type IActionsListenerRoutingConfig = IActionWebhookRoutingConfig;
|
|
275
|
+
/** Action webhook configuration as exposed to SDK consumers. */
|
|
276
|
+
interface IActionWebhookConfig {
|
|
217
277
|
/** Human-readable display name. */
|
|
218
278
|
name: string;
|
|
219
|
-
/** Stable slug used in the
|
|
279
|
+
/** Stable slug used in the webhook URL path. */
|
|
220
280
|
identifier: string;
|
|
221
281
|
/** How inbound requests are authenticated. */
|
|
222
282
|
verificationScheme: WebhookVerificationScheme;
|
|
223
|
-
/** Environment label for the
|
|
283
|
+
/** Environment label for the webhook. */
|
|
224
284
|
environment: WebhookEnvironment;
|
|
225
|
-
/** Disabled
|
|
285
|
+
/** Disabled webhooks reject inbound events at the edge. */
|
|
226
286
|
enabled: boolean;
|
|
227
|
-
/** Agent on the
|
|
287
|
+
/** Agent on the default action rule. */
|
|
228
288
|
targetAgentId: string | null;
|
|
229
289
|
/** Fallback user actions run as when the payload does not resolve one. */
|
|
230
290
|
runAsUserId: string | null;
|
|
231
291
|
/** Routing, retention, and rate-limit configuration. */
|
|
232
|
-
routingConfig:
|
|
292
|
+
routingConfig: IActionWebhookRoutingConfig;
|
|
233
293
|
}
|
|
294
|
+
/** Compatibility config name for Actions listener integrations. */
|
|
295
|
+
type IWebhookListenerConfig = IActionWebhookConfig;
|
|
296
|
+
/** Preferred config name for Actions listener integrations. */
|
|
297
|
+
type IActionsListenerConfig = IActionWebhookConfig;
|
|
234
298
|
/**
|
|
235
|
-
* An action rule's
|
|
299
|
+
* An action rule's webhook subscription. Rules that subscribe to an action
|
|
236
300
|
* webhook receive its buffered events in addition to the webhook's default
|
|
237
|
-
* rule, so one
|
|
301
|
+
* rule, so one action webhook can fan out to several rules.
|
|
238
302
|
*/
|
|
239
|
-
interface
|
|
240
|
-
/**
|
|
303
|
+
interface IActionRuleWebhookSubscription {
|
|
304
|
+
/** Action webhook this rule subscribes to; `null` = no subscription. */
|
|
241
305
|
listenWebhookId: string | null;
|
|
242
306
|
/** Event types to receive; empty array = all event types. */
|
|
243
307
|
listenEventTypes: string[];
|
|
@@ -778,7 +842,8 @@ declare class WebhooksClient {
|
|
|
778
842
|
constructor(options: ResolvedOptions, http: HttpClient);
|
|
779
843
|
/**
|
|
780
844
|
* Send an arbitrary webhook payload to AgentPress.
|
|
781
|
-
* Signs the payload with
|
|
845
|
+
* Signs the payload with the verification scheme configured on the action
|
|
846
|
+
* webhook. Defaults to Svix-compatible signing.
|
|
782
847
|
*
|
|
783
848
|
* On the happy path the response is synchronous: `{ success: true,
|
|
784
849
|
* actionId, data }`, or `{ success, actionId, alreadyExists: true, data }`
|
|
@@ -791,11 +856,25 @@ declare class WebhooksClient {
|
|
|
791
856
|
* auto-processes once an operator fixes the configuration, so check
|
|
792
857
|
* {@link WebhookResponse.buffered} before relying on `actionId`.
|
|
793
858
|
*
|
|
794
|
-
* @throws ConfigurationError if
|
|
859
|
+
* @throws ConfigurationError if the selected verification scheme needs a
|
|
860
|
+
* secret/token and none is configured
|
|
795
861
|
* @throws HttpError on non-2xx response
|
|
796
862
|
* @throws TimeoutError if request exceeds timeout
|
|
797
863
|
*/
|
|
798
864
|
send(params: WebhookSendParams): Promise<WebhookResponse>;
|
|
865
|
+
/**
|
|
866
|
+
* Send a payload to the legacy Actions listener ingestion endpoint
|
|
867
|
+
* (`POST /webhooks/ingest/:org/:identifier`).
|
|
868
|
+
*
|
|
869
|
+
* New integrations should prefer {@link send}; this method is kept for
|
|
870
|
+
* existing listener integrations and SDK patch compatibility.
|
|
871
|
+
*/
|
|
872
|
+
sendToActionsListener(params: ActionsListenerSendParams): Promise<ActionsListenerResponse>;
|
|
873
|
+
/**
|
|
874
|
+
* @deprecated Use {@link sendToActionsListener}. Kept as a compatibility
|
|
875
|
+
* alias for integrations created before the Actions listener naming update.
|
|
876
|
+
*/
|
|
877
|
+
sendToListener(params: WebhookIngestSendParams): Promise<WebhookIngestResponse>;
|
|
799
878
|
/**
|
|
800
879
|
* Verify an inbound Svix webhook signature.
|
|
801
880
|
*
|
|
@@ -924,11 +1003,11 @@ declare class KeyRotationVerifyError extends AgentPressError {
|
|
|
924
1003
|
constructor(reason: KeyRotationVerifyErrorReason, message: string);
|
|
925
1004
|
}
|
|
926
1005
|
//#endregion
|
|
927
|
-
//#region src/webhooks/
|
|
1006
|
+
//#region src/webhooks/actionWebhookSigning.d.ts
|
|
928
1007
|
/**
|
|
929
|
-
* Sign an outbound request for an AgentPress
|
|
930
|
-
*
|
|
931
|
-
* (`POST /webhooks/
|
|
1008
|
+
* Sign an outbound request for an AgentPress action webhook that uses the
|
|
1009
|
+
* `hmac_sha256` verification scheme
|
|
1010
|
+
* (`POST /webhooks/actions/:org/:identifier`).
|
|
932
1011
|
*
|
|
933
1012
|
* Produces the two headers AgentPress verifies:
|
|
934
1013
|
*
|
|
@@ -943,7 +1022,7 @@ declare class KeyRotationVerifyError extends AgentPressError {
|
|
|
943
1022
|
* ```ts
|
|
944
1023
|
* const rawBody = JSON.stringify({ eventType: "review.created", data: {...} });
|
|
945
1024
|
* const { headers } = signHmacWebhookRequest({ secret, rawBody });
|
|
946
|
-
* await fetch(
|
|
1025
|
+
* await fetch(actionWebhookUrl, {
|
|
947
1026
|
* method: "POST",
|
|
948
1027
|
* body: rawBody,
|
|
949
1028
|
* headers: { "content-type": "application/json", ...headers },
|
|
@@ -952,8 +1031,8 @@ declare class KeyRotationVerifyError extends AgentPressError {
|
|
|
952
1031
|
*/
|
|
953
1032
|
declare function signHmacWebhookRequest(params: SignHmacWebhookRequestParams): SignedHmacWebhookRequest;
|
|
954
1033
|
/**
|
|
955
|
-
* Build the auth header for an AgentPress
|
|
956
|
-
*
|
|
1034
|
+
* Build the auth header for an AgentPress action webhook that uses the
|
|
1035
|
+
* `shared_token` verification scheme. AgentPress also accepts
|
|
957
1036
|
* `Authorization: Bearer <token>`; this helper uses the dedicated
|
|
958
1037
|
* `x-webhook-token` header so it never collides with other auth middleware.
|
|
959
1038
|
*/
|
|
@@ -961,5 +1040,5 @@ declare function sharedTokenHeaders(token: string): {
|
|
|
961
1040
|
"x-webhook-token": string;
|
|
962
1041
|
};
|
|
963
1042
|
//#endregion
|
|
964
|
-
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
|
|
1043
|
+
export { ACTION_EVENT_TYPES, type ActionCallbackPayload, type ActionEventType, type ActionManageResponse, type ActionStatus, ActionsClient, type ActionsListenerAuth, type ActionsListenerEnvironment, type ActionsListenerResponse, type ActionsListenerSendParams, type ActionsListenerVerificationScheme, AgentPress, AgentPressError, type AgentPressOptions, type AgentResponse, type ApprovalMode, type ApprovalRuleSyncMode, type ApproveActionParams, ConfigurationError, type CreateUserApprovalParams, type DeleteUserApprovalParams, type GetUserApprovalWebhookMetadataParams, HttpError, type IActionRuleWebhookSubscription, type IActionWebhookConfig, type IActionWebhookRoutingConfig, type IActionsListenerConfig, type IActionsListenerRoutingConfig, type IWebhookListenerConfig, type IWebhookListenerRoutingConfig, type KeyRotationEvent, KeyRotationVerifyError, type KeyRotationVerifyErrorReason, type KeyRotationVerifyParams, type ListUserApprovalsParams, type ListUserApprovalsResponse, type PartnerMcpOptions, type PartnerTokenClaims, PartnerTokenError, type PartnerTokenErrorReason, PartnersClient, type RejectActionParams, type SignHmacWebhookRequestParams, type SignedHmacWebhookRequest, type StagedToolCall, type StagedToolCallSummary, type SyncUserApprovalRule, type SyncUserApprovalsParams, type SyncUserApprovalsResponse, TimeoutError, type ToolCallResult, type UpdateUserApprovalParams, UserApprovalsClient, type UserToolApproval, type WebhookApprovalMetadata, type WebhookApprovalToolMetadata, type WebhookEnvironment, type WebhookIngestAuth, type WebhookIngestResponse, type WebhookIngestSendParams, type WebhookResponse, type WebhookSendAuth, type WebhookSendParams, WebhookSignatureError, type WebhookVerificationScheme, type WebhookVerifyParams, WebhooksClient, sharedTokenHeaders, signHmacWebhookRequest };
|
|
965
1044
|
//# sourceMappingURL=index.d.mts.map
|