@replicer/sdk 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,7 +45,7 @@ Parameters and response fields are **snake_case**, exactly as on the wire.
45
45
  |----------|---------|
46
46
  | `replicer.call` | `createPhoneCall`, `cancel`, `cancelCampaignPending`, `list`, `get` |
47
47
  | `replicer.campaign` | `create`, `get`, `list`, `start` |
48
- | `replicer.phoneNumber` | `list`, `provisionInbound`, `deprovisionInbound` |
48
+ | `replicer.phoneNumber` | `list`, `provisionInbound`, `deprovisionInbound`, `update` |
49
49
  | `replicer.knowledgeBase` | `create`, `retrieve`, `list`, `delete`, `addSources`, `deleteSource`, `update`, `presignFile`, `completeFile`, `failFile`, `reindex`, `updateSource`, `updateChunk`, `getSource`, `presignFileDownload` |
50
50
  | `replicer.contact` | `list`, `create` |
51
51
  | `replicer.agent` | `list` |
@@ -142,7 +142,37 @@ app.post('/replicer/webhooks', express.raw({ type: 'application/json' }), async
142
142
  })
143
143
  ```
144
144
 
145
- `verifyWebhookSignature({ payload, header, secret | secrets, toleranceSeconds = 300 })` returns a boolean instead of throwing. Signatures older (or newer) than `toleranceSeconds` are rejected.
145
+ `constructEvent` also throws `WebhookSignatureError` for a correctly signed body that is not an event (`object` other than `"event"`), so a signed [API tool call](#api-tools) cannot pass as one. `verifyWebhookSignature({ payload, header, secret | secrets, toleranceSeconds = 300 })` returns a boolean instead of throwing. Signatures older (or newer) than `toleranceSeconds` are rejected.
146
+
147
+ ## API tools
148
+
149
+ Give an agent a custom function with `replicer.agentTool` (scopes `agent_tools:read` / `agent_tools:write`). Calls are POSTed to your URL, signed like webhooks with the secret of the webhook endpoint you pick:
150
+
151
+ ```ts
152
+ await replicer.agentTool.create({
153
+ agent_id: 'agent_…',
154
+ name: 'book_table',
155
+ description: 'Books a table for the caller',
156
+ url: 'https://example.com/replicer/tools',
157
+ webhook_endpoint_id: endpoint.id,
158
+ parameters: { type: 'object', properties: { time: { type: 'string' } }, required: ['time'] },
159
+ })
160
+ ```
161
+
162
+ Answer them with the server-only `@replicer/sdk/tools` subpath. `createToolHandler` takes a Fetch-API `Request` (Next.js, Hono, Workers, Bun); `handleToolCall` is the Express / plain Node variant returning `{ status, body }`:
163
+
164
+ ```ts
165
+ import { createToolHandler } from '@replicer/sdk/tools'
166
+
167
+ export const POST = createToolHandler({
168
+ secret: process.env.REPLICER_WEBHOOK_SECRET!, // or secrets: [newSecret, oldSecret] during a rotation
169
+ tools: {
170
+ book_table: async (args: { time: string }, call) => ({ booked: true, id: call.id }),
171
+ },
172
+ })
173
+ ```
174
+
175
+ It answers `{ "result": … }`, 401 for a bad signature, 404 for an unknown tool and a generic 500 when a tool throws. `verifyToolCall({ payload, header, secret })` verifies and parses a call yourself (throws `ToolSignatureError`).
146
176
 
147
177
  ## Route table
148
178
 
@@ -0,0 +1,54 @@
1
+ // src/signature.ts
2
+ import { createHmac, timingSafeEqual } from "crypto";
3
+ var SIGNATURE_HEADER = "Replicer-Signature";
4
+ var DEFAULT_TOLERANCE_SECONDS = 300;
5
+ var HEX_SHA256 = /^[0-9a-f]{64}$/i;
6
+ var UNIX_SECONDS = /^\d{1,12}$/;
7
+ function parseHeader(header) {
8
+ let timestamp = null;
9
+ const signatures = [];
10
+ for (const part of header.split(",")) {
11
+ const eq = part.indexOf("=");
12
+ if (eq <= 0) continue;
13
+ const key = part.slice(0, eq).trim();
14
+ const value = part.slice(eq + 1).trim();
15
+ if (key === "t") {
16
+ if (timestamp !== null || !UNIX_SECONDS.test(value)) return null;
17
+ timestamp = Number(value);
18
+ } else if (key === "v1" && HEX_SHA256.test(value)) {
19
+ signatures.push(Buffer.from(value, "hex"));
20
+ }
21
+ }
22
+ if (timestamp === null || signatures.length === 0) return null;
23
+ return { timestamp, signatures };
24
+ }
25
+ function sign(secret, timestamp, payload) {
26
+ return createHmac("sha256", secret).update(`${timestamp}.`).update(payload).digest();
27
+ }
28
+ function verifySignatureHeader(input) {
29
+ if (!input || typeof input.header !== "string") return false;
30
+ const payload = input.payload;
31
+ if (typeof payload !== "string" && !(payload instanceof Uint8Array)) return false;
32
+ const secrets = [input.secret, ...Array.isArray(input.secrets) ? input.secrets : []].filter((s) => typeof s === "string" && s !== "");
33
+ if (secrets.length === 0) return false;
34
+ const parsed = parseHeader(input.header);
35
+ if (!parsed) return false;
36
+ const tolerance = typeof input.toleranceSeconds === "number" && Number.isFinite(input.toleranceSeconds) && input.toleranceSeconds >= 0 ? input.toleranceSeconds : DEFAULT_TOLERANCE_SECONDS;
37
+ const nowMs = (input.now ?? /* @__PURE__ */ new Date()).getTime();
38
+ if (!Number.isFinite(nowMs)) return false;
39
+ if (Math.abs(nowMs / 1e3 - parsed.timestamp) > tolerance) return false;
40
+ let match = false;
41
+ for (const secret of secrets) {
42
+ const expected = sign(secret, parsed.timestamp, payload);
43
+ for (const received of parsed.signatures) {
44
+ if (timingSafeEqual(expected, received)) match = true;
45
+ }
46
+ }
47
+ return match;
48
+ }
49
+
50
+ export {
51
+ SIGNATURE_HEADER,
52
+ DEFAULT_TOLERANCE_SECONDS,
53
+ verifySignatureHeader
54
+ };
package/dist/index.cjs CHANGED
@@ -64,6 +64,7 @@ var ReplicerError = class extends Error {
64
64
  // src/routes.ts
65
65
  var ROUTES = [
66
66
  { method: "POST", path: "/v1/create-phone-call", sdk: "call.createPhoneCall", request: "CreatePhoneCallInput", response: "EnqueueCallResponse", status: 202, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [422, "idempotency_key_reuse"], [429, "rate_limit_exceeded"], [429, "rate_limited"], [502, "bad_gateway"]] },
67
+ { method: "POST", path: "/v1/simulate-inbound-call", sdk: "call.simulateInbound", request: "SimulateInboundCallInput", response: "SimulateInboundCallResponse", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [404, "not_found"], [409, "conflict"], [422, "idempotency_key_reuse"], [429, "rate_limit_exceeded"], [429, "rate_limited"]] },
67
68
  { method: "POST", path: "/v1/cancel-call", sdk: "call.cancel", request: "CancelCallInput", response: "OkResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"], [502, "bad_gateway"]] },
68
69
  { method: "POST", path: "/v1/cancel-campaign-pending", sdk: "call.cancelCampaignPending", request: "CancelCampaignPendingInput", response: "CancelCampaignPendingResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
69
70
  { method: "GET", path: "/v1/list-calls", sdk: "call.list", request: "ListCallsParams", response: "Page<Call>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
@@ -75,6 +76,8 @@ var ROUTES = [
75
76
  { method: "GET", path: "/v1/list-phone-numbers", sdk: "phoneNumber.list", request: "PageParams", response: "Page<PhoneNumber>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
76
77
  { method: "POST", path: "/v1/phone-numbers/inbound", sdk: "phoneNumber.provisionInbound", request: "ProvisionInboundInput", response: "ProvisionInboundResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"], [502, "bad_gateway"]] },
77
78
  { method: "DELETE", path: "/v1/phone-numbers/inbound/:id", sdk: "phoneNumber.deprovisionInbound", request: "DeprovisionInboundParams", response: "OkResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [404, "not_found"], [429, "rate_limit_exceeded"], [502, "bad_gateway"]] },
79
+ { method: "PATCH", path: "/v1/update-phone-number/:id", sdk: "phoneNumber.update", request: "UpdatePhoneNumberInput", response: "PhoneNumber", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"], [502, "bad_gateway"]] },
80
+ { method: "POST", path: "/v1/import-phone-number", sdk: "phoneNumber.import", request: "ImportPhoneNumberInput", response: "PhoneNumber", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [409, "conflict"], [429, "rate_limit_exceeded"], [502, "bad_gateway"]] },
78
81
  { method: "POST", path: "/v1/create-knowledge-base", sdk: "knowledgeBase.create", request: "KnowledgeBaseCreateInput", response: "KnowledgeBaseSourcesResponse", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "quota_exceeded"], [429, "rate_limit_exceeded"], [503, "internal_error"]] },
79
82
  { method: "GET", path: "/v1/get-knowledge-base/:id", sdk: "knowledgeBase.retrieve", request: "none", response: "KnowledgeBaseResponse", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"], [503, "internal_error"]] },
80
83
  { method: "GET", path: "/v1/list-knowledge-bases", sdk: "knowledgeBase.list", request: "none", response: "KnowledgeBaseListResponse", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"], [503, "internal_error"]] },
@@ -92,8 +95,16 @@ var ROUTES = [
92
95
  { method: "GET", path: "/v1/presign-knowledge-base-file-download/:id/:source_id", sdk: "knowledgeBase.presignFileDownload", request: "none", response: "PresignFileDownloadResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"], [503, "internal_error"]] },
93
96
  { method: "GET", path: "/v1/list-contacts", sdk: "contact.list", request: "ListContactsParams", response: "Page<Contact>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
94
97
  { method: "POST", path: "/v1/create-contact", sdk: "contact.create", request: "CreateContactInput", response: "CreateContactResponse", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
95
- { method: "GET", path: "/v1/list-agents", sdk: "agent.list", request: "PageParams", response: "Page<Agent>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
98
+ { method: "GET", path: "/v1/list-agents", sdk: "agent.list", request: "ListAgentsParams", response: "Page<Agent>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
99
+ { method: "GET", path: "/v1/get-agent/:id", sdk: "agent.get", request: "none", response: "AgentDetail", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
100
+ { method: "POST", path: "/v1/create-agent", sdk: "agent.create", request: "CreateAgentInput", response: "AgentDetail", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "quota_exceeded"], [403, "test_mode_unsupported"], [409, "conflict"], [429, "rate_limit_exceeded"]] },
101
+ { method: "PATCH", path: "/v1/update-agent/:id", sdk: "agent.update", request: "UpdateAgentInput", response: "AgentDetail", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [403, "quota_exceeded"], [403, "test_mode_unsupported"], [404, "not_found"], [409, "agent_tool_name_conflict"], [409, "conflict"], [429, "rate_limit_exceeded"]] },
102
+ { method: "POST", path: "/v1/deactivate-agent/:id", sdk: "agent.deactivate", request: "none", response: "AgentDetail", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [403, "test_mode_unsupported"], [404, "not_found"], [409, "agent_in_use"], [429, "rate_limit_exceeded"]] },
96
103
  { method: "GET", path: "/v1/list-calendars", sdk: "calendar.listCalendars", request: "PageParams", response: "Page<Calendar>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
104
+ { method: "POST", path: "/v1/create-calendar", sdk: "calendar.create", request: "CreateCalendarInput", response: "CalendarDetail", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
105
+ { method: "PATCH", path: "/v1/update-calendar/:id", sdk: "calendar.update", request: "UpdateCalendarInput", response: "CalendarDetail", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
106
+ { method: "POST", path: "/v1/create-event-type", sdk: "calendar.createEventType", request: "CreateEventTypeInput", response: "EventTypeDetail", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
107
+ { method: "PATCH", path: "/v1/update-event-type/:id", sdk: "calendar.updateEventType", request: "UpdateEventTypeInput", response: "EventTypeDetail", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
97
108
  { method: "GET", path: "/v1/list-calendar-events", sdk: "calendar.listEvents", request: "ListCalendarEventsParams", response: "Page<CalendarEvent>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
98
109
  { method: "POST", path: "/v1/create-calendar-event", sdk: "calendar.createEvent", request: "CreateCalendarEventInput", response: "CreateCalendarEventResponse", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [409, "conflict"], [429, "rate_limit_exceeded"]] },
99
110
  { method: "PATCH", path: "/v1/update-calendar-event/:id", sdk: "calendar.updateEvent", request: "UpdateCalendarEventInput", response: "CalendarEvent", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"]] },
@@ -110,12 +121,18 @@ var ROUTES = [
110
121
  { method: "GET", path: "/v1/list-webhook-endpoints", sdk: "webhookEndpoint.list", request: "PageParams", response: "Page<WebhookEndpoint>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
111
122
  { method: "GET", path: "/v1/get-webhook-endpoint/:id", sdk: "webhookEndpoint.get", request: "none", response: "WebhookEndpoint", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
112
123
  { method: "PATCH", path: "/v1/update-webhook-endpoint/:id", sdk: "webhookEndpoint.update", request: "UpdateWebhookEndpointInput", response: "WebhookEndpoint", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "webhook_endpoint_key_revoked"], [409, "webhook_endpoint_admin_disabled"], [429, "rate_limit_exceeded"]] },
113
- { method: "DELETE", path: "/v1/delete-webhook-endpoint/:id", sdk: "webhookEndpoint.delete", request: "none", response: "OkResponse", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
124
+ { method: "DELETE", path: "/v1/delete-webhook-endpoint/:id", sdk: "webhookEndpoint.delete", request: "none", response: "OkResponse", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "webhook_endpoint_in_use"], [429, "rate_limit_exceeded"]] },
114
125
  { method: "POST", path: "/v1/rotate-webhook-endpoint-secret/:id", sdk: "webhookEndpoint.rotateSecret", request: "none", response: "WebhookEndpointWithSecret", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"], [503, "service_unavailable"]] },
115
126
  { method: "POST", path: "/v1/test-webhook-endpoint/:id", sdk: "webhookEndpoint.test", request: "TestWebhookEndpointInput", response: "TestWebhookEndpointResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "conflict"], [429, "rate_limit_exceeded"], [429, "rate_limited"]] },
116
127
  { method: "GET", path: "/v1/list-webhook-deliveries", sdk: "webhookEndpoint.listDeliveries", request: "ListWebhookDeliveriesParams", response: "Page<WebhookDelivery>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
117
128
  { method: "GET", path: "/v1/list-webhook-delivery-attempts", sdk: "webhookEndpoint.listDeliveryAttempts", request: "ListWebhookDeliveryAttemptsParams", response: "Page<WebhookDeliveryAttempt>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
118
129
  { method: "POST", path: "/v1/redeliver-webhook-delivery/:id", sdk: "webhookEndpoint.redeliver", request: "none", response: "WebhookDelivery", status: 201, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "conflict"], [409, "redelivery_limit"], [409, "webhook_endpoint_key_revoked"], [429, "rate_limit_exceeded"]] },
130
+ { method: "POST", path: "/v1/create-agent-tool", sdk: "agentTool.create", request: "CreateAgentToolInput", response: "AgentTool", status: 201, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "agent_tool_limit"], [409, "agent_tool_name_conflict"], [409, "agent_tool_name_taken"], [409, "conflict"], [422, "idempotency_key_reuse"], [422, "validation_error"], [429, "rate_limit_exceeded"]] },
131
+ { method: "GET", path: "/v1/list-agent-tools", sdk: "agentTool.list", request: "ListAgentToolsParams", response: "Page<AgentTool>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
132
+ { method: "GET", path: "/v1/get-agent-tool/:id", sdk: "agentTool.get", request: "none", response: "AgentTool", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
133
+ { method: "PATCH", path: "/v1/update-agent-tool/:id", sdk: "agentTool.update", request: "UpdateAgentToolInput", response: "AgentTool", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [409, "agent_tool_limit"], [409, "agent_tool_name_conflict"], [409, "agent_tool_name_taken"], [422, "validation_error"], [429, "rate_limit_exceeded"]] },
134
+ { method: "DELETE", path: "/v1/delete-agent-tool/:id", sdk: "agentTool.delete", request: "none", response: "OkResponse", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] },
135
+ { method: "POST", path: "/v1/test-agent-tool/:id", sdk: "agentTool.test", request: "TestAgentToolInput", response: "TestAgentToolResponse", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"], [429, "rate_limited"]] },
119
136
  { method: "GET", path: "/v1/list-events", sdk: "event.list", request: "ListEventsParams", response: "Page<WebhookEventEnvelope>", status: 200, errors: [[400, "validation_error"], [401, "unauthorized"], [403, "insufficient_scope"], [429, "rate_limit_exceeded"]] },
120
137
  { method: "GET", path: "/v1/get-event/:id", sdk: "event.get", request: "none", response: "WebhookEventEnvelope", status: 200, errors: [[401, "unauthorized"], [403, "insufficient_scope"], [404, "not_found"], [429, "rate_limit_exceeded"]] }
121
138
  ];
@@ -141,6 +158,8 @@ var Replicer = class {
141
158
  }
142
159
  call = {
143
160
  createPhoneCall: (input) => this.request("call.createPhoneCall", { body: input }),
161
+ /** Test keys only: simulates an inbound call to the agent of one of your numbers; `call.ended` and `call.analyzed` follow with `livemode: false`. */
162
+ simulateInbound: (input) => this.request("call.simulateInbound", { body: input }),
144
163
  cancel: (call_id) => this.request("call.cancel", { body: { call_id } }),
145
164
  cancelCampaignPending: (campaign_id) => this.request("call.cancelCampaignPending", { body: { campaign_id } }),
146
165
  list: (params) => this.request("call.list", { query: params }),
@@ -158,7 +177,11 @@ var Replicer = class {
158
177
  /** Your organization's phone numbers; `id` is the `from_number_id` for `call.createPhoneCall`. */
159
178
  list: (params) => this.request("phoneNumber.list", { query: params }),
160
179
  provisionInbound: (input) => this.request("phoneNumber.provisionInbound", { body: input }),
161
- deprovisionInbound: (id, trunk_id, rule_id) => this.request("phoneNumber.deprovisionInbound", { params: { id }, query: { trunk_id, rule_id } })
180
+ deprovisionInbound: (id, trunk_id, rule_id) => this.request("phoneNumber.deprovisionInbound", { params: { id }, query: { trunk_id, rule_id } }),
181
+ /** Connects a number you own (SIP trunk or forwarding). Live keys only. Not idempotent: a number already connected → `409 conflict`. Search, purchase and release stay in the dashboard. */
182
+ import: (input) => this.request("phoneNumber.import", { body: input }),
183
+ /** Sets (or clears, with `null`) the fallback number (inbound calls over the concurrent-call limit, or that the agent cannot take, are forwarded there) and/or the inbound agent. Live keys only. */
184
+ update: (id, input) => this.request("phoneNumber.update", { params: { id }, body: input })
162
185
  };
163
186
  knowledgeBase = {
164
187
  create: (input) => this.request("knowledgeBase.create", { body: input }),
@@ -201,11 +224,26 @@ var Replicer = class {
201
224
  create: (input) => this.request("contact.create", { body: input })
202
225
  };
203
226
  agent = {
204
- list: (params) => this.request("agent.list", { query: params })
227
+ list: (params) => this.request("agent.list", { query: params }),
228
+ get: (id) => this.request("agent.get", { params: { id } }),
229
+ /** Live keys only. Not idempotent. Basic agents only: workflow agents and AI-written prompts stay in the dashboard. */
230
+ create: (input) => this.request("agent.create", { body: input }),
231
+ /** Live keys only. */
232
+ update: (id, input) => this.request("agent.update", { params: { id }, body: input }),
233
+ /** Live keys only. `409 agent_in_use` while a scheduled, running or paused campaign uses the agent. Reactivate with `update`. */
234
+ deactivate: (id) => this.request("agent.deactivate", { params: { id }, body: {} })
205
235
  };
206
236
  calendar = {
207
237
  /** Active calendars with their active event types: the source of `calendar_id` and `event_type_id`. */
208
238
  listCalendars: (params) => this.request("calendar.listCalendars", { query: params }),
239
+ /** Creates a calendar, optionally with its event types and weekly hours. Not idempotent: a retried create makes a second calendar. */
240
+ create: (input) => this.request("calendar.create", { body: input }),
241
+ /** Edits a calendar. `availability` replaces all weekly hours; `is_active: false` deactivates it (there is no delete). */
242
+ update: (id, input) => this.request("calendar.update", { params: { id }, body: input }),
243
+ /** Adds an event type to a calendar. Not idempotent. */
244
+ createEventType: (input) => this.request("calendar.createEventType", { body: input }),
245
+ /** Edits an event type; `is_active: false` deactivates it (there is no delete). */
246
+ updateEventType: (id, input) => this.request("calendar.updateEventType", { params: { id }, body: input }),
209
247
  listEvents: (params) => this.request("calendar.listEvents", { query: params }),
210
248
  createEvent: (input) => this.request("calendar.createEvent", { body: input }),
211
249
  /** Reschedules a confirmed event (`start_time`) and/or edits customer fields, notes and metadata. */
@@ -243,6 +281,16 @@ var Replicer = class {
243
281
  /** Sends the event of a delivery again (same event id and body) as a new delivery. Events from the last 30 days only. */
244
282
  redeliver: (deliveryId) => this.request("webhookEndpoint.redeliver", { params: { id: deliveryId }, body: {} })
245
283
  };
284
+ agentTool = {
285
+ /** A signed API tool of an agent; requests are signed with the secret of `webhook_endpoint_id`. */
286
+ create: (input) => this.request("agentTool.create", { body: input }),
287
+ list: (params) => this.request("agentTool.list", { query: params }),
288
+ get: (id) => this.request("agentTool.get", { params: { id } }),
289
+ update: (id, input) => this.request("agentTool.update", { params: { id }, body: input }),
290
+ delete: (id) => this.request("agentTool.delete", { params: { id } }),
291
+ /** Sends one signed sample call to the tool URL and reports the outcome. */
292
+ test: (id, input) => this.request("agentTool.test", { params: { id }, body: input ?? {} })
293
+ };
246
294
  event = {
247
295
  /** Events of the last 30 days as delivered (each item is the parsed envelope). */
248
296
  list: (params) => this.request("event.list", { query: params }),
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CreatePhoneCallInput, E as EnqueueCallResponse, O as OkResponse, a as CancelCampaignPendingResponse, L as ListCallsParams, P as Page, b as Call, c as CreateCampaignInput, d as Campaign, G as GetCampaignResponse, e as ListCampaignsParams, S as StartCampaignResponse, f as PageParams, g as PhoneNumber, h as ProvisionInboundInput, i as ProvisionInboundResponse, K as KnowledgeBaseCreateInput, j as KnowledgeBaseSourcesResponse, k as KnowledgeBaseResponse, l as KnowledgeBaseListResponse, m as KnowledgeBaseAddSourcesInput, n as KnowledgeBaseUpdateInput, o as PresignFileInput, p as PresignFileResponse, F as FailFileInput, U as UpdateSourceInput, q as UpdateChunkInput, r as KnowledgeBaseSourceDetail, s as PresignFileDownloadResponse, t as ListContactsParams, u as Contact, v as CreateContactInput, w as CreateContactResponse, A as Agent, x as Calendar, y as ListCalendarEventsParams, z as CalendarEvent, B as CreateCalendarEventInput, D as CreateCalendarEventResponse, H as UpdateCalendarEventInput, I as ListMessagesParams, M as Message, J as SendSmsInput, N as SendMessageResponse, Q as SendWhatsappInput, R as SendEmailInput, T as CreateTtsInput, V as CreateTtsResponse, W as ListTtsParams, X as TtsGeneration, Y as CreateWebhookEndpointInput, Z as WebhookEndpointWithSecret, _ as WebhookEndpoint, $ as UpdateWebhookEndpointInput, a0 as TestWebhookEndpointInput, a1 as TestWebhookEndpointResponse, a2 as ListWebhookDeliveriesParams, a3 as WebhookDelivery, a4 as ListWebhookDeliveryAttemptsParams, a5 as WebhookDeliveryAttempt, a6 as ListEventsParams, a7 as WebhookEvent } from './types-CmxwElVc.cjs';
2
- export { a8 as AgentType, a9 as AnyWebhookEvent, aa as ApiErrorCode, ab as CalendarEventStatus, ac as CalendarType, ad as CallDirection, ae as CallSentiment, af as CallStatus, ag as CampaignListItem, ah as CampaignStatus, ai as CancelCallInput, aj as CancelCampaignPendingInput, ak as ContactIdentityConflict, al as ContactIdentityType, am as Conversation, an as ConversationChannel, ao as ConversationStatus, ap as CreateCampaignResponse, aq as DeleteKnowledgeBaseSourceParams, ar as DeletedResource, as as DeprovisionInboundParams, at as DeprovisionInboundRemaining, au as EventType, av as Int, aw as KnowledgeBaseChunk, ax as KnowledgeBaseRejectedUrl, ay as KnowledgeBaseSourceSummary, az as KnowledgeBaseStatus, aA as KnowledgeBaseTextSource, aB as KnowledgeSourceStatus, aC as KnowledgeSourceType, aD as MessageChannel, aE as MessageDirection, aF as MessageStatus, aG as OptOut, aH as OptOutSource, aI as Pagination, aJ as PhoneNumberType, aK as TtsStatus, aL as WebhookDeliveryErrorClass, aM as WebhookDeliveryStatus, aN as WebhookEndpointCreatedBy, aO as WebhookEndpointDisabledReason, aP as WebhookEventDataMap, aQ as WebhookEventEnvelope, aR as WebhookEventType, aS as WebhookTestData } from './types-CmxwElVc.cjs';
1
+ import { C as CreatePhoneCallInput, E as EnqueueCallResponse, S as SimulateInboundCallInput, a as SimulateInboundCallResponse, O as OkResponse, b as CancelCampaignPendingResponse, L as ListCallsParams, P as Page, c as Call, d as CreateCampaignInput, e as Campaign, G as GetCampaignResponse, f as ListCampaignsParams, g as StartCampaignResponse, h as PageParams, i as PhoneNumber, j as ProvisionInboundInput, k as ProvisionInboundResponse, I as ImportPhoneNumberInput, U as UpdatePhoneNumberInput, K as KnowledgeBaseCreateInput, l as KnowledgeBaseSourcesResponse, m as KnowledgeBaseResponse, n as KnowledgeBaseListResponse, o as KnowledgeBaseAddSourcesInput, p as KnowledgeBaseUpdateInput, q as PresignFileInput, r as PresignFileResponse, F as FailFileInput, s as UpdateSourceInput, t as UpdateChunkInput, u as KnowledgeBaseSourceDetail, v as PresignFileDownloadResponse, w as ListContactsParams, x as Contact, y as CreateContactInput, z as CreateContactResponse, A as ListAgentsParams, B as Agent, D as AgentDetail, H as CreateAgentInput, J as UpdateAgentInput, M as Calendar, N as CreateCalendarInput, Q as CalendarDetail, R as UpdateCalendarInput, T as CreateEventTypeInput, V as EventTypeDetail, W as UpdateEventTypeInput, X as ListCalendarEventsParams, Y as CalendarEvent, Z as CreateCalendarEventInput, _ as CreateCalendarEventResponse, $ as UpdateCalendarEventInput, a0 as ListMessagesParams, a1 as Message, a2 as SendSmsInput, a3 as SendMessageResponse, a4 as SendWhatsappInput, a5 as SendEmailInput, a6 as CreateTtsInput, a7 as CreateTtsResponse, a8 as ListTtsParams, a9 as TtsGeneration, aa as CreateWebhookEndpointInput, ab as WebhookEndpointWithSecret, ac as WebhookEndpoint, ad as UpdateWebhookEndpointInput, ae as TestWebhookEndpointInput, af as TestWebhookEndpointResponse, ag as ListWebhookDeliveriesParams, ah as WebhookDelivery, ai as ListWebhookDeliveryAttemptsParams, aj as WebhookDeliveryAttempt, ak as CreateAgentToolInput, al as AgentTool, am as ListAgentToolsParams, an as UpdateAgentToolInput, ao as TestAgentToolInput, ap as TestAgentToolResponse, aq as ListEventsParams, ar as WebhookEvent } from './types-DXQsrvOU.cjs';
2
+ export { as as AgentTemplate, at as AgentToolConfig, au as AgentType, av as AnyWebhookEvent, aw as ApiErrorCode, ax as CalendarAvailabilitySlot, ay as CalendarEventStatus, az as CalendarType, aA as CallDirection, aB as CallSentiment, aC as CallStatus, aD as CampaignListItem, aE as CampaignStatus, aF as CancelCallInput, aG as CancelCampaignPendingInput, aH as ContactIdentityConflict, aI as ContactIdentityType, aJ as Conversation, aK as ConversationChannel, aL as ConversationStatus, aM as CreateCampaignResponse, aN as DeleteKnowledgeBaseSourceParams, aO as DeletedResource, aP as DeprovisionInboundParams, aQ as DeprovisionInboundRemaining, aR as EventType, aS as EventTypeInput, aT as Int, aU as KnowledgeBaseChunk, aV as KnowledgeBaseRejectedUrl, aW as KnowledgeBaseSourceSummary, aX as KnowledgeBaseStatus, aY as KnowledgeBaseTextSource, aZ as KnowledgeSourceStatus, a_ as KnowledgeSourceType, a$ as MessageChannel, b0 as MessageDirection, b1 as MessageStatus, b2 as OptOut, b3 as OptOutSource, b4 as Pagination, b5 as PhoneNumberType, b6 as ToolCall, b7 as ToolCallResponse, b8 as TtsStatus, b9 as WebhookDeliveryErrorClass, ba as WebhookDeliveryStatus, bb as WebhookEndpointCreatedBy, bc as WebhookEndpointDisabledReason, bd as WebhookEventDataMap, be as WebhookEventEnvelope, bf as WebhookEventType, bg as WebhookTestData } from './types-DXQsrvOU.cjs';
3
3
 
4
4
  declare const DEFAULT_BASE_URL = "https://api.replicer.ai";
5
5
  interface ReplicerOptions {
@@ -17,6 +17,8 @@ declare class Replicer {
17
17
  constructor(options: ReplicerOptions);
18
18
  readonly call: {
19
19
  createPhoneCall: (input: CreatePhoneCallInput) => Promise<EnqueueCallResponse>;
20
+ /** Test keys only: simulates an inbound call to the agent of one of your numbers; `call.ended` and `call.analyzed` follow with `livemode: false`. */
21
+ simulateInbound: (input: SimulateInboundCallInput) => Promise<SimulateInboundCallResponse>;
20
22
  cancel: (call_id: string) => Promise<OkResponse>;
21
23
  cancelCampaignPending: (campaign_id: string) => Promise<CancelCampaignPendingResponse>;
22
24
  list: (params?: ListCallsParams) => Promise<Page<Call>>;
@@ -35,6 +37,10 @@ declare class Replicer {
35
37
  list: (params?: PageParams) => Promise<Page<PhoneNumber>>;
36
38
  provisionInbound: (input: ProvisionInboundInput) => Promise<ProvisionInboundResponse>;
37
39
  deprovisionInbound: (id: string, trunk_id: string, rule_id: string) => Promise<OkResponse>;
40
+ /** Connects a number you own (SIP trunk or forwarding). Live keys only. Not idempotent: a number already connected → `409 conflict`. Search, purchase and release stay in the dashboard. */
41
+ import: (input: ImportPhoneNumberInput) => Promise<PhoneNumber>;
42
+ /** Sets (or clears, with `null`) the fallback number (inbound calls over the concurrent-call limit, or that the agent cannot take, are forwarded there) and/or the inbound agent. Live keys only. */
43
+ update: (id: string, input: UpdatePhoneNumberInput) => Promise<PhoneNumber>;
38
44
  };
39
45
  readonly knowledgeBase: {
40
46
  create: (input: KnowledgeBaseCreateInput) => Promise<KnowledgeBaseSourcesResponse>;
@@ -58,11 +64,26 @@ declare class Replicer {
58
64
  create: (input: CreateContactInput) => Promise<CreateContactResponse>;
59
65
  };
60
66
  readonly agent: {
61
- list: (params?: PageParams) => Promise<Page<Agent>>;
67
+ list: (params?: ListAgentsParams) => Promise<Page<Agent>>;
68
+ get: (id: string) => Promise<AgentDetail>;
69
+ /** Live keys only. Not idempotent. Basic agents only: workflow agents and AI-written prompts stay in the dashboard. */
70
+ create: (input: CreateAgentInput) => Promise<AgentDetail>;
71
+ /** Live keys only. */
72
+ update: (id: string, input: UpdateAgentInput) => Promise<AgentDetail>;
73
+ /** Live keys only. `409 agent_in_use` while a scheduled, running or paused campaign uses the agent. Reactivate with `update`. */
74
+ deactivate: (id: string) => Promise<AgentDetail>;
62
75
  };
63
76
  readonly calendar: {
64
77
  /** Active calendars with their active event types: the source of `calendar_id` and `event_type_id`. */
65
78
  listCalendars: (params?: PageParams) => Promise<Page<Calendar>>;
79
+ /** Creates a calendar, optionally with its event types and weekly hours. Not idempotent: a retried create makes a second calendar. */
80
+ create: (input: CreateCalendarInput) => Promise<CalendarDetail>;
81
+ /** Edits a calendar. `availability` replaces all weekly hours; `is_active: false` deactivates it (there is no delete). */
82
+ update: (id: string, input: UpdateCalendarInput) => Promise<CalendarDetail>;
83
+ /** Adds an event type to a calendar. Not idempotent. */
84
+ createEventType: (input: CreateEventTypeInput) => Promise<EventTypeDetail>;
85
+ /** Edits an event type; `is_active: false` deactivates it (there is no delete). */
86
+ updateEventType: (id: string, input: UpdateEventTypeInput) => Promise<EventTypeDetail>;
66
87
  listEvents: (params?: ListCalendarEventsParams) => Promise<Page<CalendarEvent>>;
67
88
  createEvent: (input: CreateCalendarEventInput) => Promise<CreateCalendarEventResponse>;
68
89
  /** Reschedules a confirmed event (`start_time`) and/or edits customer fields, notes and metadata. */
@@ -100,6 +121,16 @@ declare class Replicer {
100
121
  /** Sends the event of a delivery again (same event id and body) as a new delivery. Events from the last 30 days only. */
101
122
  redeliver: (deliveryId: string) => Promise<WebhookDelivery>;
102
123
  };
124
+ readonly agentTool: {
125
+ /** A signed API tool of an agent; requests are signed with the secret of `webhook_endpoint_id`. */
126
+ create: (input: CreateAgentToolInput) => Promise<AgentTool>;
127
+ list: (params: ListAgentToolsParams) => Promise<Page<AgentTool>>;
128
+ get: (id: string) => Promise<AgentTool>;
129
+ update: (id: string, input: UpdateAgentToolInput) => Promise<AgentTool>;
130
+ delete: (id: string) => Promise<OkResponse>;
131
+ /** Sends one signed sample call to the tool URL and reports the outcome. */
132
+ test: (id: string, input?: TestAgentToolInput) => Promise<TestAgentToolResponse>;
133
+ };
103
134
  readonly event: {
104
135
  /** Events of the last 30 days as delivered (each item is the parsed envelope). */
105
136
  list: (params?: ListEventsParams) => Promise<Page<WebhookEvent<Record<string, unknown>>>>;
@@ -163,6 +194,14 @@ declare const ROUTES: readonly [{
163
194
  readonly response: "EnqueueCallResponse";
164
195
  readonly status: 202;
165
196
  readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [422, "idempotency_key_reuse"], readonly [429, "rate_limit_exceeded"], readonly [429, "rate_limited"], readonly [502, "bad_gateway"]];
197
+ }, {
198
+ readonly method: "POST";
199
+ readonly path: "/v1/simulate-inbound-call";
200
+ readonly sdk: "call.simulateInbound";
201
+ readonly request: "SimulateInboundCallInput";
202
+ readonly response: "SimulateInboundCallResponse";
203
+ readonly status: 201;
204
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "test_mode_unsupported"], readonly [404, "not_found"], readonly [409, "conflict"], readonly [422, "idempotency_key_reuse"], readonly [429, "rate_limit_exceeded"], readonly [429, "rate_limited"]];
166
205
  }, {
167
206
  readonly method: "POST";
168
207
  readonly path: "/v1/cancel-call";
@@ -251,6 +290,22 @@ declare const ROUTES: readonly [{
251
290
  readonly response: "OkResponse";
252
291
  readonly status: 200;
253
292
  readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "test_mode_unsupported"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"], readonly [502, "bad_gateway"]];
293
+ }, {
294
+ readonly method: "PATCH";
295
+ readonly path: "/v1/update-phone-number/:id";
296
+ readonly sdk: "phoneNumber.update";
297
+ readonly request: "UpdatePhoneNumberInput";
298
+ readonly response: "PhoneNumber";
299
+ readonly status: 200;
300
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "test_mode_unsupported"], readonly [404, "not_found"], readonly [409, "conflict"], readonly [429, "rate_limit_exceeded"], readonly [502, "bad_gateway"]];
301
+ }, {
302
+ readonly method: "POST";
303
+ readonly path: "/v1/import-phone-number";
304
+ readonly sdk: "phoneNumber.import";
305
+ readonly request: "ImportPhoneNumberInput";
306
+ readonly response: "PhoneNumber";
307
+ readonly status: 201;
308
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "test_mode_unsupported"], readonly [409, "conflict"], readonly [429, "rate_limit_exceeded"], readonly [502, "bad_gateway"]];
254
309
  }, {
255
310
  readonly method: "POST";
256
311
  readonly path: "/v1/create-knowledge-base";
@@ -391,10 +446,42 @@ declare const ROUTES: readonly [{
391
446
  readonly method: "GET";
392
447
  readonly path: "/v1/list-agents";
393
448
  readonly sdk: "agent.list";
394
- readonly request: "PageParams";
449
+ readonly request: "ListAgentsParams";
395
450
  readonly response: "Page<Agent>";
396
451
  readonly status: 200;
397
452
  readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [429, "rate_limit_exceeded"]];
453
+ }, {
454
+ readonly method: "GET";
455
+ readonly path: "/v1/get-agent/:id";
456
+ readonly sdk: "agent.get";
457
+ readonly request: "none";
458
+ readonly response: "AgentDetail";
459
+ readonly status: 200;
460
+ readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
461
+ }, {
462
+ readonly method: "POST";
463
+ readonly path: "/v1/create-agent";
464
+ readonly sdk: "agent.create";
465
+ readonly request: "CreateAgentInput";
466
+ readonly response: "AgentDetail";
467
+ readonly status: 201;
468
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "quota_exceeded"], readonly [403, "test_mode_unsupported"], readonly [409, "conflict"], readonly [429, "rate_limit_exceeded"]];
469
+ }, {
470
+ readonly method: "PATCH";
471
+ readonly path: "/v1/update-agent/:id";
472
+ readonly sdk: "agent.update";
473
+ readonly request: "UpdateAgentInput";
474
+ readonly response: "AgentDetail";
475
+ readonly status: 200;
476
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "quota_exceeded"], readonly [403, "test_mode_unsupported"], readonly [404, "not_found"], readonly [409, "agent_tool_name_conflict"], readonly [409, "conflict"], readonly [429, "rate_limit_exceeded"]];
477
+ }, {
478
+ readonly method: "POST";
479
+ readonly path: "/v1/deactivate-agent/:id";
480
+ readonly sdk: "agent.deactivate";
481
+ readonly request: "none";
482
+ readonly response: "AgentDetail";
483
+ readonly status: 200;
484
+ readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [403, "test_mode_unsupported"], readonly [404, "not_found"], readonly [409, "agent_in_use"], readonly [429, "rate_limit_exceeded"]];
398
485
  }, {
399
486
  readonly method: "GET";
400
487
  readonly path: "/v1/list-calendars";
@@ -403,6 +490,38 @@ declare const ROUTES: readonly [{
403
490
  readonly response: "Page<Calendar>";
404
491
  readonly status: 200;
405
492
  readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [429, "rate_limit_exceeded"]];
493
+ }, {
494
+ readonly method: "POST";
495
+ readonly path: "/v1/create-calendar";
496
+ readonly sdk: "calendar.create";
497
+ readonly request: "CreateCalendarInput";
498
+ readonly response: "CalendarDetail";
499
+ readonly status: 201;
500
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [429, "rate_limit_exceeded"]];
501
+ }, {
502
+ readonly method: "PATCH";
503
+ readonly path: "/v1/update-calendar/:id";
504
+ readonly sdk: "calendar.update";
505
+ readonly request: "UpdateCalendarInput";
506
+ readonly response: "CalendarDetail";
507
+ readonly status: 200;
508
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
509
+ }, {
510
+ readonly method: "POST";
511
+ readonly path: "/v1/create-event-type";
512
+ readonly sdk: "calendar.createEventType";
513
+ readonly request: "CreateEventTypeInput";
514
+ readonly response: "EventTypeDetail";
515
+ readonly status: 201;
516
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [429, "rate_limit_exceeded"]];
517
+ }, {
518
+ readonly method: "PATCH";
519
+ readonly path: "/v1/update-event-type/:id";
520
+ readonly sdk: "calendar.updateEventType";
521
+ readonly request: "UpdateEventTypeInput";
522
+ readonly response: "EventTypeDetail";
523
+ readonly status: 200;
524
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
406
525
  }, {
407
526
  readonly method: "GET";
408
527
  readonly path: "/v1/list-calendar-events";
@@ -538,7 +657,7 @@ declare const ROUTES: readonly [{
538
657
  readonly request: "none";
539
658
  readonly response: "OkResponse";
540
659
  readonly status: 200;
541
- readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
660
+ readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [409, "webhook_endpoint_in_use"], readonly [429, "rate_limit_exceeded"]];
542
661
  }, {
543
662
  readonly method: "POST";
544
663
  readonly path: "/v1/rotate-webhook-endpoint-secret/:id";
@@ -579,6 +698,54 @@ declare const ROUTES: readonly [{
579
698
  readonly response: "WebhookDelivery";
580
699
  readonly status: 201;
581
700
  readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [409, "conflict"], readonly [409, "redelivery_limit"], readonly [409, "webhook_endpoint_key_revoked"], readonly [429, "rate_limit_exceeded"]];
701
+ }, {
702
+ readonly method: "POST";
703
+ readonly path: "/v1/create-agent-tool";
704
+ readonly sdk: "agentTool.create";
705
+ readonly request: "CreateAgentToolInput";
706
+ readonly response: "AgentTool";
707
+ readonly status: 201;
708
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [409, "agent_tool_limit"], readonly [409, "agent_tool_name_conflict"], readonly [409, "agent_tool_name_taken"], readonly [409, "conflict"], readonly [422, "idempotency_key_reuse"], readonly [422, "validation_error"], readonly [429, "rate_limit_exceeded"]];
709
+ }, {
710
+ readonly method: "GET";
711
+ readonly path: "/v1/list-agent-tools";
712
+ readonly sdk: "agentTool.list";
713
+ readonly request: "ListAgentToolsParams";
714
+ readonly response: "Page<AgentTool>";
715
+ readonly status: 200;
716
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
717
+ }, {
718
+ readonly method: "GET";
719
+ readonly path: "/v1/get-agent-tool/:id";
720
+ readonly sdk: "agentTool.get";
721
+ readonly request: "none";
722
+ readonly response: "AgentTool";
723
+ readonly status: 200;
724
+ readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
725
+ }, {
726
+ readonly method: "PATCH";
727
+ readonly path: "/v1/update-agent-tool/:id";
728
+ readonly sdk: "agentTool.update";
729
+ readonly request: "UpdateAgentToolInput";
730
+ readonly response: "AgentTool";
731
+ readonly status: 200;
732
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [409, "agent_tool_limit"], readonly [409, "agent_tool_name_conflict"], readonly [409, "agent_tool_name_taken"], readonly [422, "validation_error"], readonly [429, "rate_limit_exceeded"]];
733
+ }, {
734
+ readonly method: "DELETE";
735
+ readonly path: "/v1/delete-agent-tool/:id";
736
+ readonly sdk: "agentTool.delete";
737
+ readonly request: "none";
738
+ readonly response: "OkResponse";
739
+ readonly status: 200;
740
+ readonly errors: readonly [readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"]];
741
+ }, {
742
+ readonly method: "POST";
743
+ readonly path: "/v1/test-agent-tool/:id";
744
+ readonly sdk: "agentTool.test";
745
+ readonly request: "TestAgentToolInput";
746
+ readonly response: "TestAgentToolResponse";
747
+ readonly status: 200;
748
+ readonly errors: readonly [readonly [400, "validation_error"], readonly [401, "unauthorized"], readonly [403, "insufficient_scope"], readonly [404, "not_found"], readonly [429, "rate_limit_exceeded"], readonly [429, "rate_limited"]];
582
749
  }, {
583
750
  readonly method: "GET";
584
751
  readonly path: "/v1/list-events";
@@ -599,4 +766,4 @@ declare const ROUTES: readonly [{
599
766
  type RouteDef = (typeof ROUTES)[number];
600
767
  type SdkMethodName = RouteDef['sdk'];
601
768
 
602
- export { Agent, Calendar, CalendarEvent, Call, Campaign, CancelCampaignPendingResponse, Contact, CreateCalendarEventInput, CreateCalendarEventResponse, CreateCampaignInput, CreateContactInput, CreateContactResponse, CreatePhoneCallInput, CreateTtsInput, CreateTtsResponse, CreateWebhookEndpointInput, DEFAULT_BASE_URL, EnqueueCallResponse, FailFileInput, GetCampaignResponse, KnowledgeBaseAddSourcesInput, KnowledgeBaseCreateInput, KnowledgeBaseListResponse, KnowledgeBaseResponse, KnowledgeBaseSourceDetail, KnowledgeBaseSourcesResponse, KnowledgeBaseUpdateInput, ListCalendarEventsParams, ListCallsParams, ListCampaignsParams, ListContactsParams, ListEventsParams, ListMessagesParams, ListTtsParams, ListWebhookDeliveriesParams, ListWebhookDeliveryAttemptsParams, Message, OkResponse, Page, PageParams, PhoneNumber, PresignFileDownloadResponse, PresignFileInput, PresignFileResponse, ProvisionInboundInput, ProvisionInboundResponse, ROUTES, Replicer, ReplicerError, type ReplicerOptions, type RouteDef, type SdkMethodName, SendEmailInput, SendMessageResponse, SendSmsInput, SendWhatsappInput, StartCampaignResponse, TestWebhookEndpointInput, TestWebhookEndpointResponse, TtsGeneration, UpdateCalendarEventInput, UpdateChunkInput, UpdateSourceInput, UpdateWebhookEndpointInput, WebhookDelivery, WebhookDeliveryAttempt, WebhookEndpoint, WebhookEndpointWithSecret, WebhookEvent };
769
+ export { Agent, AgentDetail, AgentTool, Calendar, CalendarDetail, CalendarEvent, Call, Campaign, CancelCampaignPendingResponse, Contact, CreateAgentInput, CreateAgentToolInput, CreateCalendarEventInput, CreateCalendarEventResponse, CreateCalendarInput, CreateCampaignInput, CreateContactInput, CreateContactResponse, CreateEventTypeInput, CreatePhoneCallInput, CreateTtsInput, CreateTtsResponse, CreateWebhookEndpointInput, DEFAULT_BASE_URL, EnqueueCallResponse, EventTypeDetail, FailFileInput, GetCampaignResponse, ImportPhoneNumberInput, KnowledgeBaseAddSourcesInput, KnowledgeBaseCreateInput, KnowledgeBaseListResponse, KnowledgeBaseResponse, KnowledgeBaseSourceDetail, KnowledgeBaseSourcesResponse, KnowledgeBaseUpdateInput, ListAgentToolsParams, ListAgentsParams, ListCalendarEventsParams, ListCallsParams, ListCampaignsParams, ListContactsParams, ListEventsParams, ListMessagesParams, ListTtsParams, ListWebhookDeliveriesParams, ListWebhookDeliveryAttemptsParams, Message, OkResponse, Page, PageParams, PhoneNumber, PresignFileDownloadResponse, PresignFileInput, PresignFileResponse, ProvisionInboundInput, ProvisionInboundResponse, ROUTES, Replicer, ReplicerError, type ReplicerOptions, type RouteDef, type SdkMethodName, SendEmailInput, SendMessageResponse, SendSmsInput, SendWhatsappInput, SimulateInboundCallInput, SimulateInboundCallResponse, StartCampaignResponse, TestAgentToolInput, TestAgentToolResponse, TestWebhookEndpointInput, TestWebhookEndpointResponse, TtsGeneration, UpdateAgentInput, UpdateAgentToolInput, UpdateCalendarEventInput, UpdateCalendarInput, UpdateChunkInput, UpdateEventTypeInput, UpdatePhoneNumberInput, UpdateSourceInput, UpdateWebhookEndpointInput, WebhookDelivery, WebhookDeliveryAttempt, WebhookEndpoint, WebhookEndpointWithSecret, WebhookEvent };