@agentpress/sdk 0.2.70

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.
@@ -0,0 +1,306 @@
1
+ /** Constructor options for the {@link AgentPress} client. All fields are optional. */
2
+ interface AgentPressOptions {
3
+ /** Svix webhook signing secret for verifying inbound webhooks. Must start with `"whsec_"`. */
4
+ webhookSecret?: string;
5
+ /** API key for authenticated requests. */
6
+ apiKey?: string;
7
+ /** @default "https://api.agent.press" */
8
+ baseUrl?: string;
9
+ /** Request timeout in milliseconds. Must be a positive finite number. @default 30000 */
10
+ timeout?: number;
11
+ /** Organization identifier sent with requests. @default "default-org" */
12
+ org?: string;
13
+ /** Hook called before every outbound HTTP request (useful for logging/tracing). */
14
+ onRequest?: (url: string, init: RequestInit) => void;
15
+ /** Hook called after every HTTP response is received. */
16
+ onResponse?: (url: string, response: Response) => void;
17
+ }
18
+ /** Parameters for {@link WebhooksClient.send}. */
19
+ interface WebhookSendParams {
20
+ /** Webhook action name (matches an action rule on the server). */
21
+ action: string;
22
+ /** Arbitrary payload data forwarded to the webhook handler. */
23
+ payload: Record<string, unknown>;
24
+ }
25
+ /** Parameters for verifying an inbound webhook signature via {@link WebhooksClient.verify} or {@link WebhooksClient.verifyOrThrow}. */
26
+ interface WebhookVerifyParams {
27
+ /** Raw request body (string or Buffer) -- must not be parsed/modified. */
28
+ payload: string | Buffer;
29
+ /** Svix signature headers from the incoming request. */
30
+ headers: {
31
+ "svix-id": string;
32
+ "svix-timestamp": string;
33
+ "svix-signature": string;
34
+ };
35
+ }
36
+ /** Response from webhook send operations. */
37
+ interface WebhookResponse {
38
+ success: boolean;
39
+ /** UUID of the created action (present on successful creation). */
40
+ actionId?: string;
41
+ /** `true` if an action with the same `externalId` already existed (idempotency). */
42
+ alreadyExists?: boolean;
43
+ skipped?: boolean;
44
+ data?: Record<string, unknown>;
45
+ }
46
+ /** Action lifecycle event types emitted by AgentPress. */
47
+ type ActionEventType = "action.pending_approval" | "action.approved" | "action.completed" | "action.failed" | "action.rejected" | "action.expired";
48
+ /** A tool call staged for approval (present when eventType is "action.pending_approval"). */
49
+ interface StagedToolCall {
50
+ toolName: string;
51
+ toolCallId: string;
52
+ arguments: Record<string, unknown>;
53
+ }
54
+ /** Parameters for {@link ActionsClient.approve}. */
55
+ interface ApproveActionParams {
56
+ /** Webhook action identifier (from callback's webhookAction field). */
57
+ action: string;
58
+ /** Optionally modify the tool call arguments before execution. */
59
+ editedToolCall?: {
60
+ toolName: string;
61
+ arguments: Record<string, unknown>;
62
+ };
63
+ }
64
+ /** Parameters for {@link ActionsClient.reject}. */
65
+ interface RejectActionParams {
66
+ /** Webhook action identifier (from callback's webhookAction field). */
67
+ action: string;
68
+ /** Reason for rejection. */
69
+ reason?: string;
70
+ }
71
+ /** Response from action approve/reject operations. */
72
+ interface ActionManageResponse {
73
+ success: boolean;
74
+ actionId: string;
75
+ status: ActionStatus;
76
+ }
77
+ /** Status of an action in the AgentPress system. */
78
+ type ActionStatus = "pending" | "staged" | "approved" | "rejected" | "completed" | "failed" | "expired";
79
+ /** A tool call made by the agent during action processing. */
80
+ interface ToolCallResult {
81
+ toolName: string;
82
+ arguments: Record<string, unknown>;
83
+ result: unknown;
84
+ }
85
+ /** The agent's response after processing an action. */
86
+ interface AgentResponse {
87
+ /** The agent's text response, if any. */
88
+ text: string | null;
89
+ /** Tool calls made by the agent during processing. */
90
+ toolCalls: ToolCallResult[];
91
+ }
92
+ /**
93
+ * Payload received from AgentPress outbound webhooks (post-event callbacks).
94
+ * This is what your server receives when an action completes.
95
+ */
96
+ interface ActionCallbackPayload {
97
+ actionId: string;
98
+ status: ActionStatus;
99
+ actionType: string;
100
+ /** Lifecycle event type (e.g., "action.pending_approval", "action.completed"). */
101
+ eventType: ActionEventType;
102
+ /** Webhook action identifier used to create this action. Needed for approve/reject. */
103
+ webhookAction: string | null;
104
+ /** Tool awaiting approval (present only when eventType is "action.pending_approval"). */
105
+ stagedToolCall: StagedToolCall | null;
106
+ /** ISO 8601 timestamp of when the action completed. */
107
+ completedAt: string;
108
+ /** Original data from the inbound webhook that triggered this action. */
109
+ sourceData: Record<string, unknown>;
110
+ /** External system identifier. */
111
+ externalId: string | null;
112
+ /** AgentPress user ID associated with this action. */
113
+ userId: string | null;
114
+ /** Thread ID if the action created a conversation. */
115
+ threadId: string | null;
116
+ /** The agent's response including text and tool call results. */
117
+ agentResponse: AgentResponse;
118
+ /** Error message if the action failed. */
119
+ errorMessage: string | null;
120
+ /** Reason provided if the action was rejected by a human reviewer. */
121
+ rejectionReason: string | null;
122
+ /** Additional custom fields from post-event configuration. */
123
+ [key: string]: unknown;
124
+ }
125
+ /** @internal Resolved (validated, defaulted) options. Not exported from the public API. */
126
+ interface ResolvedOptions {
127
+ baseUrl: string;
128
+ timeout: number;
129
+ org: string;
130
+ webhookSecret?: string;
131
+ apiKey?: string;
132
+ onRequest?: AgentPressOptions["onRequest"];
133
+ onResponse?: AgentPressOptions["onResponse"];
134
+ }
135
+
136
+ /**
137
+ * Internal shared HTTP client. Not part of the public API -- used by
138
+ * namespace clients (e.g., `WebhooksClient`) to make authenticated requests.
139
+ * @internal
140
+ */
141
+ declare class HttpClient {
142
+ private readonly baseUrl;
143
+ private readonly timeout;
144
+ private readonly onRequest?;
145
+ private readonly onResponse?;
146
+ constructor(options: ResolvedOptions);
147
+ /**
148
+ * Send an HTTP request to the API. Constructs the full URL from `baseUrl` + `path`,
149
+ * applies the configured timeout via `AbortSignal`, fires `onRequest`/`onResponse`
150
+ * hooks, and parses the JSON response.
151
+ *
152
+ * @throws {TimeoutError} If the request exceeds the configured timeout.
153
+ * @throws {HttpError} If the API returns a non-2xx status code.
154
+ * @throws {AgentPressError} On network failures or non-JSON responses.
155
+ */
156
+ request<T>(path: string, init: RequestInit): Promise<T>;
157
+ }
158
+
159
+ /**
160
+ * Client for programmatically approving or rejecting staged actions.
161
+ * Uses HMAC-SHA256 signing (Svix-compatible), identical to {@link WebhooksClient}.
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * const client = new AgentPress({ webhookSecret: "whsec_...", org: "my-org" });
166
+ *
167
+ * // Approve a staged action
168
+ * await client.actions.approve("act_123", {
169
+ * action: "my_webhook_action",
170
+ * });
171
+ *
172
+ * // Reject with a reason
173
+ * await client.actions.reject("act_456", {
174
+ * action: "my_webhook_action",
175
+ * reason: "Insufficient data",
176
+ * });
177
+ * ```
178
+ */
179
+ declare class ActionsClient {
180
+ private readonly options;
181
+ private readonly http;
182
+ constructor(options: ResolvedOptions, http: HttpClient);
183
+ /**
184
+ * Approve a staged action, optionally modifying the tool call.
185
+ *
186
+ * @throws ConfigurationError if webhookSecret is not configured
187
+ * @throws HttpError on non-2xx response
188
+ * @throws TimeoutError if request exceeds timeout
189
+ */
190
+ approve(actionId: string, params: ApproveActionParams): Promise<ActionManageResponse>;
191
+ /**
192
+ * Reject a staged action.
193
+ *
194
+ * @throws ConfigurationError if webhookSecret is not configured
195
+ * @throws HttpError on non-2xx response
196
+ * @throws TimeoutError if request exceeds timeout
197
+ */
198
+ reject(actionId: string, params: RejectActionParams): Promise<ActionManageResponse>;
199
+ private manage;
200
+ }
201
+
202
+ declare class WebhooksClient {
203
+ private readonly options;
204
+ private readonly http;
205
+ constructor(options: ResolvedOptions, http: HttpClient);
206
+ /**
207
+ * Send an arbitrary webhook payload to AgentPress.
208
+ * Signs the payload with HMAC-SHA256 (Svix-compatible).
209
+ *
210
+ * @throws ConfigurationError if webhookSecret is not configured
211
+ * @throws HttpError on non-2xx response
212
+ * @throws TimeoutError if request exceeds timeout
213
+ */
214
+ send(params: WebhookSendParams): Promise<WebhookResponse>;
215
+ /**
216
+ * Verify an inbound Svix webhook signature.
217
+ *
218
+ * @returns true if valid, false if invalid or expired
219
+ * @throws ConfigurationError if webhookSecret is not configured
220
+ */
221
+ verify(params: WebhookVerifyParams): boolean;
222
+ /**
223
+ * Verify an inbound Svix webhook signature, throwing on failure.
224
+ * Useful for middleware patterns where invalid signatures should halt processing.
225
+ *
226
+ * @throws WebhookSignatureError if signature is invalid or expired
227
+ * @throws ConfigurationError if webhookSecret is not configured
228
+ */
229
+ verifyOrThrow(params: WebhookVerifyParams): void;
230
+ /**
231
+ * Verify and parse an inbound webhook from AgentPress.
232
+ * Combines signature verification with JSON parsing and type casting.
233
+ * This is the recommended way to handle incoming webhooks.
234
+ *
235
+ * @throws WebhookSignatureError if signature is invalid or expired
236
+ * @throws ConfigurationError if webhookSecret is not configured
237
+ * @throws AgentPressError if payload is not valid JSON
238
+ */
239
+ constructEvent(params: WebhookVerifyParams): ActionCallbackPayload;
240
+ }
241
+
242
+ /**
243
+ * Main entry point for the AgentPress SDK. Provides namespaced access to API
244
+ * resources (e.g., `client.webhooks.send()`, `client.actions.approve()`).
245
+ * Validates all configuration options at construction time, so invalid config fails fast.
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * const client = new AgentPress({
250
+ * apiKey: "ak_...",
251
+ * webhookSecret: "whsec_...",
252
+ * });
253
+ * await client.webhooks.send({ action: "my_action", payload: { ... } });
254
+ * await client.actions.approve("act_123", { action: "my_action" });
255
+ * ```
256
+ */
257
+ declare class AgentPress {
258
+ /** Webhook operations: send outbound webhooks and verify inbound signatures. */
259
+ readonly webhooks: WebhooksClient;
260
+ /** Action management: approve or reject staged actions. */
261
+ readonly actions: ActionsClient;
262
+ /**
263
+ * @param options - SDK configuration. All fields are optional with sensible defaults.
264
+ * @throws {ConfigurationError} If `timeout` is non-positive or `webhookSecret` has an invalid prefix.
265
+ */
266
+ constructor(options?: AgentPressOptions);
267
+ }
268
+
269
+ /**
270
+ * Base error class for all SDK errors. Catch this to handle any error
271
+ * thrown by the AgentPress SDK regardless of specific type.
272
+ */
273
+ declare class AgentPressError extends Error {
274
+ constructor(message: string);
275
+ }
276
+ /**
277
+ * Thrown at construction time when `AgentPressOptions` contains invalid values
278
+ * (e.g., non-positive timeout, malformed `webhookSecret`).
279
+ */
280
+ declare class ConfigurationError extends AgentPressError {
281
+ constructor(message: string);
282
+ }
283
+ /**
284
+ * Thrown when the API returns a non-2xx HTTP response.
285
+ *
286
+ * Properties:
287
+ * - `statusCode` - HTTP status code (e.g., 401, 404, 500)
288
+ * - `responseBody` - Raw response body text for debugging
289
+ * - `url` - The full request URL that failed
290
+ */
291
+ declare class HttpError extends AgentPressError {
292
+ readonly statusCode: number;
293
+ readonly responseBody: string;
294
+ readonly url: string;
295
+ constructor(statusCode: number, responseBody: string, url: string);
296
+ }
297
+ /** Thrown when a request exceeds the configured `timeout` (default 30s). */
298
+ declare class TimeoutError extends AgentPressError {
299
+ constructor(url: string, timeout: number);
300
+ }
301
+ /** Thrown by {@link WebhooksClient.verifyOrThrow} when an inbound webhook signature is invalid or expired. */
302
+ declare class WebhookSignatureError extends AgentPressError {
303
+ constructor(message: string);
304
+ }
305
+
306
+ export { type ActionCallbackPayload, type ActionEventType, type ActionManageResponse, type ActionStatus, ActionsClient, AgentPress, AgentPressError, type AgentPressOptions, type AgentResponse, type ApproveActionParams, ConfigurationError, HttpError, type RejectActionParams, type StagedToolCall, TimeoutError, type ToolCallResult, type WebhookResponse, type WebhookSendParams, WebhookSignatureError, type WebhookVerifyParams };
@@ -0,0 +1,306 @@
1
+ /** Constructor options for the {@link AgentPress} client. All fields are optional. */
2
+ interface AgentPressOptions {
3
+ /** Svix webhook signing secret for verifying inbound webhooks. Must start with `"whsec_"`. */
4
+ webhookSecret?: string;
5
+ /** API key for authenticated requests. */
6
+ apiKey?: string;
7
+ /** @default "https://api.agent.press" */
8
+ baseUrl?: string;
9
+ /** Request timeout in milliseconds. Must be a positive finite number. @default 30000 */
10
+ timeout?: number;
11
+ /** Organization identifier sent with requests. @default "default-org" */
12
+ org?: string;
13
+ /** Hook called before every outbound HTTP request (useful for logging/tracing). */
14
+ onRequest?: (url: string, init: RequestInit) => void;
15
+ /** Hook called after every HTTP response is received. */
16
+ onResponse?: (url: string, response: Response) => void;
17
+ }
18
+ /** Parameters for {@link WebhooksClient.send}. */
19
+ interface WebhookSendParams {
20
+ /** Webhook action name (matches an action rule on the server). */
21
+ action: string;
22
+ /** Arbitrary payload data forwarded to the webhook handler. */
23
+ payload: Record<string, unknown>;
24
+ }
25
+ /** Parameters for verifying an inbound webhook signature via {@link WebhooksClient.verify} or {@link WebhooksClient.verifyOrThrow}. */
26
+ interface WebhookVerifyParams {
27
+ /** Raw request body (string or Buffer) -- must not be parsed/modified. */
28
+ payload: string | Buffer;
29
+ /** Svix signature headers from the incoming request. */
30
+ headers: {
31
+ "svix-id": string;
32
+ "svix-timestamp": string;
33
+ "svix-signature": string;
34
+ };
35
+ }
36
+ /** Response from webhook send operations. */
37
+ interface WebhookResponse {
38
+ success: boolean;
39
+ /** UUID of the created action (present on successful creation). */
40
+ actionId?: string;
41
+ /** `true` if an action with the same `externalId` already existed (idempotency). */
42
+ alreadyExists?: boolean;
43
+ skipped?: boolean;
44
+ data?: Record<string, unknown>;
45
+ }
46
+ /** Action lifecycle event types emitted by AgentPress. */
47
+ type ActionEventType = "action.pending_approval" | "action.approved" | "action.completed" | "action.failed" | "action.rejected" | "action.expired";
48
+ /** A tool call staged for approval (present when eventType is "action.pending_approval"). */
49
+ interface StagedToolCall {
50
+ toolName: string;
51
+ toolCallId: string;
52
+ arguments: Record<string, unknown>;
53
+ }
54
+ /** Parameters for {@link ActionsClient.approve}. */
55
+ interface ApproveActionParams {
56
+ /** Webhook action identifier (from callback's webhookAction field). */
57
+ action: string;
58
+ /** Optionally modify the tool call arguments before execution. */
59
+ editedToolCall?: {
60
+ toolName: string;
61
+ arguments: Record<string, unknown>;
62
+ };
63
+ }
64
+ /** Parameters for {@link ActionsClient.reject}. */
65
+ interface RejectActionParams {
66
+ /** Webhook action identifier (from callback's webhookAction field). */
67
+ action: string;
68
+ /** Reason for rejection. */
69
+ reason?: string;
70
+ }
71
+ /** Response from action approve/reject operations. */
72
+ interface ActionManageResponse {
73
+ success: boolean;
74
+ actionId: string;
75
+ status: ActionStatus;
76
+ }
77
+ /** Status of an action in the AgentPress system. */
78
+ type ActionStatus = "pending" | "staged" | "approved" | "rejected" | "completed" | "failed" | "expired";
79
+ /** A tool call made by the agent during action processing. */
80
+ interface ToolCallResult {
81
+ toolName: string;
82
+ arguments: Record<string, unknown>;
83
+ result: unknown;
84
+ }
85
+ /** The agent's response after processing an action. */
86
+ interface AgentResponse {
87
+ /** The agent's text response, if any. */
88
+ text: string | null;
89
+ /** Tool calls made by the agent during processing. */
90
+ toolCalls: ToolCallResult[];
91
+ }
92
+ /**
93
+ * Payload received from AgentPress outbound webhooks (post-event callbacks).
94
+ * This is what your server receives when an action completes.
95
+ */
96
+ interface ActionCallbackPayload {
97
+ actionId: string;
98
+ status: ActionStatus;
99
+ actionType: string;
100
+ /** Lifecycle event type (e.g., "action.pending_approval", "action.completed"). */
101
+ eventType: ActionEventType;
102
+ /** Webhook action identifier used to create this action. Needed for approve/reject. */
103
+ webhookAction: string | null;
104
+ /** Tool awaiting approval (present only when eventType is "action.pending_approval"). */
105
+ stagedToolCall: StagedToolCall | null;
106
+ /** ISO 8601 timestamp of when the action completed. */
107
+ completedAt: string;
108
+ /** Original data from the inbound webhook that triggered this action. */
109
+ sourceData: Record<string, unknown>;
110
+ /** External system identifier. */
111
+ externalId: string | null;
112
+ /** AgentPress user ID associated with this action. */
113
+ userId: string | null;
114
+ /** Thread ID if the action created a conversation. */
115
+ threadId: string | null;
116
+ /** The agent's response including text and tool call results. */
117
+ agentResponse: AgentResponse;
118
+ /** Error message if the action failed. */
119
+ errorMessage: string | null;
120
+ /** Reason provided if the action was rejected by a human reviewer. */
121
+ rejectionReason: string | null;
122
+ /** Additional custom fields from post-event configuration. */
123
+ [key: string]: unknown;
124
+ }
125
+ /** @internal Resolved (validated, defaulted) options. Not exported from the public API. */
126
+ interface ResolvedOptions {
127
+ baseUrl: string;
128
+ timeout: number;
129
+ org: string;
130
+ webhookSecret?: string;
131
+ apiKey?: string;
132
+ onRequest?: AgentPressOptions["onRequest"];
133
+ onResponse?: AgentPressOptions["onResponse"];
134
+ }
135
+
136
+ /**
137
+ * Internal shared HTTP client. Not part of the public API -- used by
138
+ * namespace clients (e.g., `WebhooksClient`) to make authenticated requests.
139
+ * @internal
140
+ */
141
+ declare class HttpClient {
142
+ private readonly baseUrl;
143
+ private readonly timeout;
144
+ private readonly onRequest?;
145
+ private readonly onResponse?;
146
+ constructor(options: ResolvedOptions);
147
+ /**
148
+ * Send an HTTP request to the API. Constructs the full URL from `baseUrl` + `path`,
149
+ * applies the configured timeout via `AbortSignal`, fires `onRequest`/`onResponse`
150
+ * hooks, and parses the JSON response.
151
+ *
152
+ * @throws {TimeoutError} If the request exceeds the configured timeout.
153
+ * @throws {HttpError} If the API returns a non-2xx status code.
154
+ * @throws {AgentPressError} On network failures or non-JSON responses.
155
+ */
156
+ request<T>(path: string, init: RequestInit): Promise<T>;
157
+ }
158
+
159
+ /**
160
+ * Client for programmatically approving or rejecting staged actions.
161
+ * Uses HMAC-SHA256 signing (Svix-compatible), identical to {@link WebhooksClient}.
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * const client = new AgentPress({ webhookSecret: "whsec_...", org: "my-org" });
166
+ *
167
+ * // Approve a staged action
168
+ * await client.actions.approve("act_123", {
169
+ * action: "my_webhook_action",
170
+ * });
171
+ *
172
+ * // Reject with a reason
173
+ * await client.actions.reject("act_456", {
174
+ * action: "my_webhook_action",
175
+ * reason: "Insufficient data",
176
+ * });
177
+ * ```
178
+ */
179
+ declare class ActionsClient {
180
+ private readonly options;
181
+ private readonly http;
182
+ constructor(options: ResolvedOptions, http: HttpClient);
183
+ /**
184
+ * Approve a staged action, optionally modifying the tool call.
185
+ *
186
+ * @throws ConfigurationError if webhookSecret is not configured
187
+ * @throws HttpError on non-2xx response
188
+ * @throws TimeoutError if request exceeds timeout
189
+ */
190
+ approve(actionId: string, params: ApproveActionParams): Promise<ActionManageResponse>;
191
+ /**
192
+ * Reject a staged action.
193
+ *
194
+ * @throws ConfigurationError if webhookSecret is not configured
195
+ * @throws HttpError on non-2xx response
196
+ * @throws TimeoutError if request exceeds timeout
197
+ */
198
+ reject(actionId: string, params: RejectActionParams): Promise<ActionManageResponse>;
199
+ private manage;
200
+ }
201
+
202
+ declare class WebhooksClient {
203
+ private readonly options;
204
+ private readonly http;
205
+ constructor(options: ResolvedOptions, http: HttpClient);
206
+ /**
207
+ * Send an arbitrary webhook payload to AgentPress.
208
+ * Signs the payload with HMAC-SHA256 (Svix-compatible).
209
+ *
210
+ * @throws ConfigurationError if webhookSecret is not configured
211
+ * @throws HttpError on non-2xx response
212
+ * @throws TimeoutError if request exceeds timeout
213
+ */
214
+ send(params: WebhookSendParams): Promise<WebhookResponse>;
215
+ /**
216
+ * Verify an inbound Svix webhook signature.
217
+ *
218
+ * @returns true if valid, false if invalid or expired
219
+ * @throws ConfigurationError if webhookSecret is not configured
220
+ */
221
+ verify(params: WebhookVerifyParams): boolean;
222
+ /**
223
+ * Verify an inbound Svix webhook signature, throwing on failure.
224
+ * Useful for middleware patterns where invalid signatures should halt processing.
225
+ *
226
+ * @throws WebhookSignatureError if signature is invalid or expired
227
+ * @throws ConfigurationError if webhookSecret is not configured
228
+ */
229
+ verifyOrThrow(params: WebhookVerifyParams): void;
230
+ /**
231
+ * Verify and parse an inbound webhook from AgentPress.
232
+ * Combines signature verification with JSON parsing and type casting.
233
+ * This is the recommended way to handle incoming webhooks.
234
+ *
235
+ * @throws WebhookSignatureError if signature is invalid or expired
236
+ * @throws ConfigurationError if webhookSecret is not configured
237
+ * @throws AgentPressError if payload is not valid JSON
238
+ */
239
+ constructEvent(params: WebhookVerifyParams): ActionCallbackPayload;
240
+ }
241
+
242
+ /**
243
+ * Main entry point for the AgentPress SDK. Provides namespaced access to API
244
+ * resources (e.g., `client.webhooks.send()`, `client.actions.approve()`).
245
+ * Validates all configuration options at construction time, so invalid config fails fast.
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * const client = new AgentPress({
250
+ * apiKey: "ak_...",
251
+ * webhookSecret: "whsec_...",
252
+ * });
253
+ * await client.webhooks.send({ action: "my_action", payload: { ... } });
254
+ * await client.actions.approve("act_123", { action: "my_action" });
255
+ * ```
256
+ */
257
+ declare class AgentPress {
258
+ /** Webhook operations: send outbound webhooks and verify inbound signatures. */
259
+ readonly webhooks: WebhooksClient;
260
+ /** Action management: approve or reject staged actions. */
261
+ readonly actions: ActionsClient;
262
+ /**
263
+ * @param options - SDK configuration. All fields are optional with sensible defaults.
264
+ * @throws {ConfigurationError} If `timeout` is non-positive or `webhookSecret` has an invalid prefix.
265
+ */
266
+ constructor(options?: AgentPressOptions);
267
+ }
268
+
269
+ /**
270
+ * Base error class for all SDK errors. Catch this to handle any error
271
+ * thrown by the AgentPress SDK regardless of specific type.
272
+ */
273
+ declare class AgentPressError extends Error {
274
+ constructor(message: string);
275
+ }
276
+ /**
277
+ * Thrown at construction time when `AgentPressOptions` contains invalid values
278
+ * (e.g., non-positive timeout, malformed `webhookSecret`).
279
+ */
280
+ declare class ConfigurationError extends AgentPressError {
281
+ constructor(message: string);
282
+ }
283
+ /**
284
+ * Thrown when the API returns a non-2xx HTTP response.
285
+ *
286
+ * Properties:
287
+ * - `statusCode` - HTTP status code (e.g., 401, 404, 500)
288
+ * - `responseBody` - Raw response body text for debugging
289
+ * - `url` - The full request URL that failed
290
+ */
291
+ declare class HttpError extends AgentPressError {
292
+ readonly statusCode: number;
293
+ readonly responseBody: string;
294
+ readonly url: string;
295
+ constructor(statusCode: number, responseBody: string, url: string);
296
+ }
297
+ /** Thrown when a request exceeds the configured `timeout` (default 30s). */
298
+ declare class TimeoutError extends AgentPressError {
299
+ constructor(url: string, timeout: number);
300
+ }
301
+ /** Thrown by {@link WebhooksClient.verifyOrThrow} when an inbound webhook signature is invalid or expired. */
302
+ declare class WebhookSignatureError extends AgentPressError {
303
+ constructor(message: string);
304
+ }
305
+
306
+ export { type ActionCallbackPayload, type ActionEventType, type ActionManageResponse, type ActionStatus, ActionsClient, AgentPress, AgentPressError, type AgentPressOptions, type AgentResponse, type ApproveActionParams, ConfigurationError, HttpError, type RejectActionParams, type StagedToolCall, TimeoutError, type ToolCallResult, type WebhookResponse, type WebhookSendParams, WebhookSignatureError, type WebhookVerifyParams };