@zavudev/sdk 0.52.0 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +1 -1
  3. package/resources/broadcasts/broadcasts.d.mts +20 -4
  4. package/resources/broadcasts/broadcasts.d.mts.map +1 -1
  5. package/resources/broadcasts/broadcasts.d.ts +20 -4
  6. package/resources/broadcasts/broadcasts.d.ts.map +1 -1
  7. package/resources/broadcasts/broadcasts.js +20 -4
  8. package/resources/broadcasts/broadcasts.js.map +1 -1
  9. package/resources/broadcasts/broadcasts.mjs +20 -4
  10. package/resources/broadcasts/broadcasts.mjs.map +1 -1
  11. package/resources/functions/functions.d.mts +94 -3
  12. package/resources/functions/functions.d.mts.map +1 -1
  13. package/resources/functions/functions.d.ts +94 -3
  14. package/resources/functions/functions.d.ts.map +1 -1
  15. package/resources/functions/functions.js.map +1 -1
  16. package/resources/functions/functions.mjs.map +1 -1
  17. package/resources/phone-numbers.d.mts +9 -3
  18. package/resources/phone-numbers.d.mts.map +1 -1
  19. package/resources/phone-numbers.d.ts +9 -3
  20. package/resources/phone-numbers.d.ts.map +1 -1
  21. package/resources/phone-numbers.js +6 -2
  22. package/resources/phone-numbers.js.map +1 -1
  23. package/resources/phone-numbers.mjs +6 -2
  24. package/resources/phone-numbers.mjs.map +1 -1
  25. package/resources/senders/agent/agent.d.mts +7 -0
  26. package/resources/senders/agent/agent.d.mts.map +1 -1
  27. package/resources/senders/agent/agent.d.ts +7 -0
  28. package/resources/senders/agent/agent.d.ts.map +1 -1
  29. package/resources/senders/agent/agent.js.map +1 -1
  30. package/resources/senders/agent/agent.mjs.map +1 -1
  31. package/resources/senders/agent/tools.d.mts +64 -3
  32. package/resources/senders/agent/tools.d.mts.map +1 -1
  33. package/resources/senders/agent/tools.d.ts +64 -3
  34. package/resources/senders/agent/tools.d.ts.map +1 -1
  35. package/resources/senders/agent/tools.js +10 -1
  36. package/resources/senders/agent/tools.js.map +1 -1
  37. package/resources/senders/agent/tools.mjs +10 -1
  38. package/resources/senders/agent/tools.mjs.map +1 -1
  39. package/resources/senders/senders.d.mts +58 -0
  40. package/resources/senders/senders.d.mts.map +1 -1
  41. package/resources/senders/senders.d.ts +58 -0
  42. package/resources/senders/senders.d.ts.map +1 -1
  43. package/resources/senders/senders.js.map +1 -1
  44. package/resources/senders/senders.mjs.map +1 -1
  45. package/src/resources/broadcasts/broadcasts.ts +20 -4
  46. package/src/resources/functions/functions.ts +96 -3
  47. package/src/resources/phone-numbers.ts +9 -3
  48. package/src/resources/senders/agent/agent.ts +8 -0
  49. package/src/resources/senders/agent/tools.ts +72 -3
  50. package/src/resources/senders/senders.ts +63 -0
  51. package/src/version.ts +1 -1
  52. package/version.d.mts +1 -1
  53. package/version.d.ts +1 -1
  54. package/version.js +1 -1
  55. package/version.mjs +1 -1
@@ -118,7 +118,16 @@ export class Tools extends APIResource {
118
118
  }
119
119
 
120
120
  /**
121
- * Test a tool by triggering its webhook with test parameters.
121
+ * Run a tool with the parameters you supply and return what it answered.
122
+ *
123
+ * The call is synchronous: the response carries the tool's status, body, and
124
+ * duration, so a green result is evidence the tool ran rather than evidence it was
125
+ * accepted. Each run is also recorded and readable afterwards via
126
+ * `GET /v1/senders/{senderId}/agent/tools/{toolId}/test-runs`.
127
+ *
128
+ * A tool that answers with an error is reported as a run with `success: false` —
129
+ * the endpoint itself still returns 200. This fires the tool's real webhook, so a
130
+ * test has whatever side effects the tool has.
122
131
  *
123
132
  * @example
124
133
  * ```ts
@@ -163,6 +172,17 @@ export interface AgentTool {
163
172
  * HTTPS URL to call when the tool is executed.
164
173
  */
165
174
  webhookUrl: string;
175
+
176
+ /**
177
+ * Signing secret for this tool's webhook. **Returned only when the tool is
178
+ * created**, never on a later read.
179
+ *
180
+ * Zavu generates one if you do not supply it, and signs every call to this tool
181
+ * with it: `X-Zavu-Signature: <hex>`, the HMAC-SHA256 of the request body. Verify
182
+ * it before trusting the call. Lost it? Rotate with
183
+ * `POST /v1/senders/{senderId}/agent/tools/{toolId}/webhook/secret`.
184
+ */
185
+ webhookSecret?: string;
166
186
  }
167
187
 
168
188
  export interface ToolParameters {
@@ -194,7 +214,54 @@ export interface ToolUpdateResponse {
194
214
  }
195
215
 
196
216
  export interface ToolTestResponse {
197
- scheduled: boolean;
217
+ /**
218
+ * One run of a tool triggered from the test endpoint. Recorded so a test is
219
+ * verifiable after the fact rather than only visible in the response.
220
+ */
221
+ run: ToolTestResponse.Run;
222
+ }
223
+
224
+ export namespace ToolTestResponse {
225
+ /**
226
+ * One run of a tool triggered from the test endpoint. Recorded so a test is
227
+ * verifiable after the fact rather than only visible in the response.
228
+ */
229
+ export interface Run {
230
+ id: string;
231
+
232
+ createdAt: string;
233
+
234
+ durationMs: number;
235
+
236
+ /**
237
+ * Whether the tool returned without error. A tool that answered with a non-2xx
238
+ * status is a failed run, not an error of this endpoint.
239
+ */
240
+ success: boolean;
241
+
242
+ toolId: string;
243
+
244
+ /**
245
+ * Why the run failed, when it did.
246
+ */
247
+ error?: string | null;
248
+
249
+ /**
250
+ * The parameters the tool was called with.
251
+ */
252
+ params?: { [key: string]: unknown };
253
+
254
+ /**
255
+ * The tool's response body, truncated.
256
+ */
257
+ response?: string | null;
258
+
259
+ /**
260
+ * HTTP status the tool's webhook returned. Absent for tools that do not go over
261
+ * HTTP.
262
+ */
263
+ statusCode?: number | null;
264
+ }
198
265
  }
199
266
 
200
267
  export interface ToolCreateParams {
@@ -212,7 +279,9 @@ export interface ToolCreateParams {
212
279
  enabled?: boolean;
213
280
 
214
281
  /**
215
- * Optional secret for webhook signature verification.
282
+ * Signing secret for the webhook. Optional: Zavu generates one when omitted and
283
+ * returns it on this response only. Supply your own if you already have a secret
284
+ * you want reused.
216
285
  */
217
286
  webhookSecret?: string;
218
287
  }
@@ -300,6 +300,22 @@ export interface SenderWebhook {
300
300
  */
301
301
  events: Array<WebhookEvent>;
302
302
 
303
+ /**
304
+ * Which `X-Zavu-Signature` scheme this receiver is sent.
305
+ *
306
+ * - `v1`: `v1=HMAC_SHA256(secret, body)`. The scheme used before this was
307
+ * configurable. Existing webhooks stay on it until you move them.
308
+ * - `v2`: `v2=HMAC_SHA256(secret, "{t}.{body}")`. The current scheme, and the
309
+ * default for new senders. It signs the timestamp together with the body.
310
+ * - `v1+v2`: both signatures, sharing one `t`. The migration setting: a receiver
311
+ * reading either one works, so you can deploy and confirm your new verifier
312
+ * before switching over.
313
+ *
314
+ * Moving from `v1` straight to `v2` returns `400`. Set `v1+v2` first. See
315
+ * https://docs.zavu.dev/guides/receiving-messages/signature-migration
316
+ */
317
+ signatureVersion: 'v1' | 'v1+v2' | 'v2';
318
+
303
319
  /**
304
320
  * HTTPS URL that will receive webhook events.
305
321
  */
@@ -539,6 +555,14 @@ export interface SenderCreateParams {
539
555
  */
540
556
  emailReceivingEnabled?: boolean;
541
557
 
558
+ /**
559
+ * Enable the one-way SMS channel (`sms_oneway`). Needs nothing else — no phone
560
+ * number, no credential — so it is the fastest way to get a sender that can send.
561
+ * Recipients cannot reply. Confirm with `sms_oneway` in the `channels` array on
562
+ * the response.
563
+ */
564
+ enableSmsOneway?: boolean;
565
+
542
566
  /**
543
567
  * Let this sender place and answer phone calls. Requires `phoneNumber`; enabling
544
568
  * it without one returns 400. Check the `channels` array on the response to
@@ -562,6 +586,22 @@ export interface SenderCreateParams {
562
586
  */
563
587
  webhookEvents?: Array<WebhookEvent>;
564
588
 
589
+ /**
590
+ * Which `X-Zavu-Signature` scheme this receiver is sent.
591
+ *
592
+ * - `v1`: `v1=HMAC_SHA256(secret, body)`. The scheme used before this was
593
+ * configurable. Existing webhooks stay on it until you move them.
594
+ * - `v2`: `v2=HMAC_SHA256(secret, "{t}.{body}")`. The current scheme, and the
595
+ * default for new senders. It signs the timestamp together with the body.
596
+ * - `v1+v2`: both signatures, sharing one `t`. The migration setting: a receiver
597
+ * reading either one works, so you can deploy and confirm your new verifier
598
+ * before switching over.
599
+ *
600
+ * Moving from `v1` straight to `v2` returns `400`. Set `v1+v2` first. See
601
+ * https://docs.zavu.dev/guides/receiving-messages/signature-migration
602
+ */
603
+ webhookSignatureVersion?: 'v1' | 'v1+v2' | 'v2';
604
+
565
605
  /**
566
606
  * HTTPS URL for webhook events.
567
607
  */
@@ -598,6 +638,13 @@ export interface SenderUpdateParams {
598
638
  */
599
639
  emailReceivingEnabled?: boolean;
600
640
 
641
+ /**
642
+ * Turn the one-way SMS channel on or off. Enabling needs nothing else and takes
643
+ * effect immediately; disabling removes the channel from the sender. Confirm with
644
+ * the `channels` array on the response.
645
+ */
646
+ enableSmsOneway?: boolean;
647
+
601
648
  /**
602
649
  * Turn the voice channel on or off. The sender must already have a phone number
603
650
  * provisioned for calls; enabling it otherwise returns 400 instead of storing a
@@ -619,6 +666,22 @@ export interface SenderUpdateParams {
619
666
  */
620
667
  webhookEvents?: Array<WebhookEvent>;
621
668
 
669
+ /**
670
+ * Which `X-Zavu-Signature` scheme this receiver is sent.
671
+ *
672
+ * - `v1`: `v1=HMAC_SHA256(secret, body)`. The scheme used before this was
673
+ * configurable. Existing webhooks stay on it until you move them.
674
+ * - `v2`: `v2=HMAC_SHA256(secret, "{t}.{body}")`. The current scheme, and the
675
+ * default for new senders. It signs the timestamp together with the body.
676
+ * - `v1+v2`: both signatures, sharing one `t`. The migration setting: a receiver
677
+ * reading either one works, so you can deploy and confirm your new verifier
678
+ * before switching over.
679
+ *
680
+ * Moving from `v1` straight to `v2` returns `400`. Set `v1+v2` first. See
681
+ * https://docs.zavu.dev/guides/receiving-messages/signature-migration
682
+ */
683
+ webhookSignatureVersion?: 'v1' | 'v1+v2' | 'v2';
684
+
622
685
  /**
623
686
  * HTTPS URL for webhook events. Set to null to remove webhook.
624
687
  */
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.52.0'; // x-release-please-version
1
+ export const VERSION = '0.54.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.52.0";
1
+ export declare const VERSION = "0.54.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.52.0";
1
+ export declare const VERSION = "0.54.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.52.0'; // x-release-please-version
4
+ exports.VERSION = '0.54.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.52.0'; // x-release-please-version
1
+ export const VERSION = '0.54.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map