@signalhousellc/sdk 1.0.67 → 1.0.69

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 (40) hide show
  1. package/README.md +0 -10
  2. package/package.json +11 -3
  3. package/skills/VENDORED.json +8 -8
  4. package/skills/signalhouse-10dlc/SKILL.md +5 -9
  5. package/skills/signalhouse-10dlc/references/tcr-rejection-causes.md +5 -12
  6. package/skills/signalhouse-advisor/SKILL.md +3 -3
  7. package/skills/signalhouse-numbers/SKILL.md +1 -2
  8. package/skills/signalhouse-setup/SKILL.md +41 -11
  9. package/skills/signalhouse-sms/SKILL.md +4 -4
  10. package/skills/signalhouse-webhooks/SKILL.md +76 -56
  11. package/src/SignalHouseSDK.js +26 -13
  12. package/src/domains/Agents.js +204 -55
  13. package/src/domains/Auth.js +30 -24
  14. package/src/domains/Billing.js +32 -26
  15. package/src/domains/Brands.js +45 -34
  16. package/src/domains/Campaigns.js +106 -47
  17. package/src/domains/Dnc.js +168 -0
  18. package/src/domains/Groups.js +53 -16
  19. package/src/domains/Landings.js +36 -30
  20. package/src/domains/Messages.js +110 -65
  21. package/src/domains/Notifications.js +12 -6
  22. package/src/domains/Numbers.js +58 -52
  23. package/src/domains/Onboarding.js +14 -8
  24. package/src/domains/Shortlinks.js +10 -4
  25. package/src/domains/Subgroups.js +16 -10
  26. package/src/domains/Subscriptions.js +22 -16
  27. package/src/domains/Tickets.js +18 -12
  28. package/src/domains/Users.js +32 -22
  29. package/src/domains/Webhooks.js +45 -13
  30. package/src/domains/voice/Analytics.js +8 -2
  31. package/src/domains/voice/CallLogs.js +14 -8
  32. package/src/domains/voice/Calls.js +14 -8
  33. package/src/domains/voice/GlobalVoiceSettings.js +10 -4
  34. package/src/domains/voice/ProgrammableVoiceProfiles.js +22 -16
  35. package/src/domains/voice/SipProfiles.js +24 -18
  36. package/src/domains/voice/SipTrunks.js +26 -20
  37. package/src/domains/voice/Tokens.js +10 -4
  38. package/src/domains/voice/browser/Call.js +2 -0
  39. package/src/domains/voice/browser/Device.js +23 -11
  40. package/src/webhooks/verifySignature.js +66 -0
@@ -1,3 +1,9 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
1
7
  /**
2
8
  * @typedef {Object} CreateAgentProfileData
3
9
  * @property {string} groupId - The parent group id (at least 8 characters, starts with 'G').
@@ -7,10 +13,6 @@
7
13
  * @property {string} [systemPrompt] - Base system prompt composed into every conversation.
8
14
  * @property {string} [greeting] - Opening line the agent leads with.
9
15
  * @property {string} [guardrails] - Freeform guardrail instructions appended to the composed prompt.
10
- * @property {string|null} [voiceId] - ElevenLabs voice id for the voice channel; null until set.
11
- * @property {string} [llmProvider] - LLM backend: "bedrock", "openai", "anthropic", or "groq" (defaults to "bedrock").
12
- * @property {string|null} [llmModel] - Concrete model id for the provider; null = provider default.
13
- * @property {number} [temperature] - Sampling temperature (0-2).
14
16
  */
15
17
 
16
18
  /**
@@ -20,10 +22,33 @@
20
22
  * @property {string} [systemPrompt] - Base system prompt composed into every conversation.
21
23
  * @property {string} [greeting] - Opening line the agent leads with.
22
24
  * @property {string} [guardrails] - Freeform guardrail instructions appended to the composed prompt.
23
- * @property {string|null} [voiceId] - ElevenLabs voice id for the voice channel.
24
- * @property {string} [llmProvider] - LLM backend: "bedrock", "openai", "anthropic", or "groq".
25
+ */
26
+
27
+ /**
28
+ * The per-channel settings for one agent. Model, voice and sampling settings live here rather
29
+ * than on the profile: each channel is served by a different runtime, and the model catalogues
30
+ * do not overlap — so a value that is valid on one channel may be invalid on another.
31
+ * @typedef {Object} AgentChannelSettingData
32
+ * @property {string[]} [allowedTools] - Tools enabled on this channel — built-in keys or custom agentTool ids.
33
+ * @property {boolean} [enabled] - Whether the agent answers on this channel.
34
+ * @property {string} [channelPrompt] - Channel-specific prompt text appended to the agent's system prompt.
35
+ * @property {string|null} [greeting] - Channel-specific greeting override; null = use the agent's greeting.
36
+ * @property {string} [llmProvider] - LLM backend for this channel: "bedrock", "openai", "anthropic", or "groq" (defaults to "bedrock").
25
37
  * @property {string|null} [llmModel] - Concrete model id for the provider; null = provider default.
26
38
  * @property {number} [temperature] - Sampling temperature (0-2).
39
+ * @property {string|null} [voiceId] - Voice identifier for spoken channels; ignored off the voice channel.
40
+ * @property {number|null} [speed] - Speaking rate multiplier (0.7-1.2); null = platform default.
41
+ * @property {number|null} [stability] - Voice consistency (0-1); lower is more expressive and more variable.
42
+ * @property {number|null} [similarityBoost] - How closely synthesis tracks the source voice (0-1).
43
+ * @property {string|null} [speechModel] - Speech synthesis model; separate from `llmModel`, which decides what is said rather than how it is voiced.
44
+ * @property {string|null} [turnEagerness] - How readily the agent decides the caller has finished: "patient", "normal", or "eager".
45
+ * @property {number|null} [turnTimeoutSeconds] - Silence before the agent takes its turn: 1-300, or -1 for no timeout.
46
+ * @property {number|null} [initialWaitSeconds] - Silence before the agent speaks first: 1-300, or -1 for no timeout.
47
+ * @property {number|null} [silenceEndCallSeconds] - Silence before the call is ended outright (10-7200).
48
+ * @property {number|null} [maxCallDurationSeconds] - Hard ceiling on one conversation (60-7200).
49
+ * @property {boolean} [allowGreetingInterruption] - Whether a caller may talk over the greeting.
50
+ * @property {string[]} [keyterms] - Words the transcriber is biased toward — names, jargon, unusual spellings.
51
+ * @property {Object|null} [backgroundSound] - Ambient audio bed as `{ preset, volume }`; null = silence.
27
52
  */
28
53
 
29
54
  export class Agents {
@@ -32,21 +57,37 @@ export class Agents {
32
57
  this.enableAdmin = enableAdmin;
33
58
  }
34
59
 
60
+ /**
61
+ * List the voices an agent can be configured to speak with.
62
+ *
63
+ * The catalog is platform-wide, not per-account, so this takes no scope. `voiceId` is the
64
+ * value to set on a spoken channel's setting.
65
+ * @async
66
+ * @roles api, admin, developer, billing, user
67
+ * @param {Object} [params] - The parameters for the request.
68
+ * @param {RequestOptions} [params.options] - Additional options for the request.
69
+ * @returns {Promise<SdkResponse<any>>} - The available voices, each as `{ voiceId, name, description, previewUrl, gender, accent, age, useCase, language }`.
70
+ */
71
+ async getAgentVoices({ options = {} } = {}) {
72
+ return this.client("/agent/voices", { method: "GET", ...options });
73
+ }
74
+
35
75
  /**
36
76
  * List the agent profiles under a group.
37
77
  * @async
38
78
  * @roles api, admin, developer, billing, user
39
79
  * @param {Object} params - The parameters for listing agent profiles.
40
80
  * @param {string} params.groupId - The group whose profiles to list (required).
81
+ * @param {string} [params.subgroupId] - Narrow to the agents this subgroup can use — its own, plus the group-level agents shared with every subgroup.
41
82
  * @param {number} [params.page] - The page number for pagination.
42
83
  * @param {number} [params.limit] - The number of items per page for pagination.
43
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
84
+ * @param {RequestOptions} [params.options] - Additional options for the request.
44
85
  * @throws {Error} Throws an error if the groupId parameter is missing.
45
- * @returns {Promise<Object>} - The list of agent profiles returned from the server.
86
+ * @returns {Promise<SdkResponse<any>>} - The list of agent profiles returned from the server.
46
87
  */
47
- async getAgentProfiles({ groupId, page, limit, options = {} }) {
88
+ async getAgentProfiles({ groupId, subgroupId, page, limit, options = {} }) {
48
89
  this.client._require({ groupId });
49
- const queryString = this.client._getQueryString({ groupId, page, limit });
90
+ const queryString = this.client._getQueryString({ groupId, subgroupId, page, limit });
50
91
  return this.client(`/agent/profiles${queryString}`, { method: "GET", ...options });
51
92
  }
52
93
 
@@ -56,9 +97,9 @@ export class Agents {
56
97
  * @roles api, admin, developer, billing, user
57
98
  * @param {Object} params - The parameters for getting an agent profile.
58
99
  * @param {string} params.agentProfileId - The id of the agent profile to fetch.
59
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
100
+ * @param {RequestOptions} [params.options] - Additional options for the request.
60
101
  * @throws {Error} Throws an error if the agentProfileId parameter is missing.
61
- * @returns {Promise<Object>} - The agent profile returned from the server.
102
+ * @returns {Promise<SdkResponse<any>>} - The agent profile returned from the server.
62
103
  */
63
104
  async getAgentProfile({ agentProfileId, options = {} }) {
64
105
  this.client._require({ agentProfileId });
@@ -72,9 +113,9 @@ export class Agents {
72
113
  * @roles api, admin, developer
73
114
  * @param {Object} params - The parameters for creating an agent profile (see CreateAgentProfileData typedef).
74
115
  * @param {CreateAgentProfileData} params.profileData - The data for the agent profile to create, including required fields groupId and name.
75
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
116
+ * @param {RequestOptions} [params.options] - Additional options for the request.
76
117
  * @throws {Error} Throws an error if the profileData parameter is missing.
77
- * @returns {Promise<Object>} - The created agent profile returned from the server.
118
+ * @returns {Promise<SdkResponse<any>>} - The created agent profile returned from the server.
78
119
  */
79
120
  async createAgentProfile({ profileData, options = {} }) {
80
121
  this.client._require({ profileData });
@@ -88,9 +129,9 @@ export class Agents {
88
129
  * @param {Object} params - The parameters for updating an agent profile (see UpdateAgentProfileData typedef).
89
130
  * @param {string} params.id - The id of the agent profile to update.
90
131
  * @param {UpdateAgentProfileData} params.updateData - The data for the agent profile to update.
91
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
132
+ * @param {RequestOptions} [params.options] - Additional options for the request.
92
133
  * @throws {Error} Throws an error if the id or updateData parameter is missing.
93
- * @returns {Promise<Object>} - The updated agent profile returned from the server.
134
+ * @returns {Promise<SdkResponse<any>>} - The updated agent profile returned from the server.
94
135
  */
95
136
  async updateAgentProfile({ id, updateData, options = {} }) {
96
137
  this.client._require({ id, updateData });
@@ -104,9 +145,9 @@ export class Agents {
104
145
  * @roles api, admin, developer
105
146
  * @param {Object} params - The parameters for deleting an agent profile.
106
147
  * @param {string} params.id - The id of the agent profile to delete.
107
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
148
+ * @param {RequestOptions} [params.options] - Additional options for the request.
108
149
  * @throws {Error} Throws an error if the id parameter is missing.
109
- * @returns {Promise<Object>} - The inactivated agent profile returned from the server.
150
+ * @returns {Promise<SdkResponse<any>>} - The inactivated agent profile returned from the server.
110
151
  */
111
152
  async deleteAgentProfile({ id, options = {} }) {
112
153
  this.client._require({ id });
@@ -127,9 +168,9 @@ export class Agents {
127
168
  * @param {string} params.message - The user's message (required).
128
169
  * @param {string} [params.conversationId] - Continue this conversation; omit to start a new one.
129
170
  * @param {string} [params.contactIdentifier] - The far-end identifier (webchat visitor id, sender number).
130
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
171
+ * @param {RequestOptions} [params.options] - Additional options for the request.
131
172
  * @throws {Error} Throws an error if agentProfileId, channel, or message is missing.
132
- * @returns {Promise<Object>} - `{ conversationId, conversationSessionId, reply, toolInvocations, ok }` from the server.
173
+ * @returns {Promise<SdkResponse<any>>} - `{ conversationId, conversationSessionId, reply, toolInvocations, ok }` from the server.
133
174
  */
134
175
  async sendAgentMessage({ agentProfileId, channel, message, conversationId, contactIdentifier, options = {} }) {
135
176
  this.client._require({ agentProfileId, channel, message });
@@ -139,6 +180,114 @@ export class Agents {
139
180
  return this.client(`/agent/messages`, { method: "POST", body, ...options });
140
181
  }
141
182
 
183
+ /**
184
+ * Start a conversation without sending a message.
185
+ *
186
+ * The counterpart to `sendAgentMessage` for callers that run the model themselves —
187
+ * a voice runtime, or your own LLM. Those record what was said; `sendAgentMessage`
188
+ * decides it. Both write the same conversation records.
189
+ * @async
190
+ * @roles api, admin, developer, billing, user
191
+ * @param {Object} params - The parameters for starting a conversation.
192
+ * @param {string} params.agentProfileId - The agent this conversation belongs to (required).
193
+ * @param {string} params.channel - The channel: "webchat", "sms", or "voice" (required).
194
+ * @param {string} [params.contactIdentifier] - The far-end identifier (visitor id, caller number).
195
+ * @param {string} [params.callId] - Telephony call id, for the voice channel.
196
+ * @param {Object} [params.metadata] - Arbitrary metadata stored with the conversation.
197
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
198
+ * @throws {Error} Throws an error if agentProfileId or channel is missing.
199
+ * @returns {Promise<Object>} - The created conversation, including `conversationId` and `conversationSessionId`.
200
+ */
201
+ async startConversation({ agentProfileId, channel, contactIdentifier, callId, metadata, options = {} }) {
202
+ this.client._require({ agentProfileId, channel });
203
+ const body = { agentProfileId, channel };
204
+ if (contactIdentifier !== undefined && contactIdentifier !== null) body.contactIdentifier = contactIdentifier;
205
+ if (callId !== undefined && callId !== null) body.callId = callId;
206
+ if (metadata !== undefined && metadata !== null) body.metadata = metadata;
207
+ return this.client(`/agent/conversations`, { method: "POST", body, ...options });
208
+ }
209
+
210
+ /**
211
+ * Read one conversation with a page of its messages, in order.
212
+ *
213
+ * Paged rather than whole: a transcript has no natural ceiling. Omitting `limit` gives 100
214
+ * messages, not all of them.
215
+ * @async
216
+ * @roles api, admin, developer, billing, user
217
+ * @param {Object} params - The parameters for reading a conversation.
218
+ * @param {string} params.conversationId - The conversation to read (required).
219
+ * @param {number} [params.page] - Page number; defaults to 1.
220
+ * @param {number} [params.limit] - Messages per page; defaults to 100, capped at 500.
221
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
222
+ * @throws {Error} Throws an error if the conversationId parameter is missing.
223
+ * @returns {Promise<Object>} - A one-element array with the conversation and its `messages`.
224
+ */
225
+ async getConversation({ conversationId, page, limit, options = {} }) {
226
+ this.client._require({ conversationId });
227
+ const safeId = encodeURIComponent(conversationId);
228
+ const queryString = this.client._getQueryString({ page, limit });
229
+ return this.client(`/agent/conversations/${safeId}${queryString}`, { method: "GET", ...options });
230
+ }
231
+
232
+ /**
233
+ * Append one message to a conversation.
234
+ *
235
+ * Records a turn rather than generating one, so `role` is explicit — an assistant turn
236
+ * your own runtime produced is the normal case here. `content` is optional so a
237
+ * tool-only turn needs no prose.
238
+ * @async
239
+ * @roles api, admin, developer, billing, user
240
+ * @param {Object} params - The parameters for appending a message.
241
+ * @param {string} params.conversationId - The conversation to append to (required).
242
+ * @param {string} params.role - "user", "assistant", "system", or "tool" (required).
243
+ * @param {string} [params.content] - What was said.
244
+ * @param {Array<Object>} [params.toolCalls] - Tools invoked on this turn.
245
+ * @param {Array<Object>} [params.toolResults] - Their results.
246
+ * @param {number} [params.ttfbMs] - Time to first byte/audio, in milliseconds.
247
+ * @param {number} [params.latencyMs] - Total turn latency, in milliseconds.
248
+ * @param {boolean} [params.bargeInOccurred] - Whether the far end talked over this turn.
249
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
250
+ * @throws {Error} Throws an error if conversationId or role is missing.
251
+ * @returns {Promise<Object>} - The persisted message.
252
+ */
253
+ async appendConversationMessage({ conversationId, role, content, toolCalls, toolResults, ttfbMs, latencyMs, bargeInOccurred, options = {} }) {
254
+ this.client._require({ conversationId, role });
255
+ const safeId = encodeURIComponent(conversationId);
256
+ const body = { role };
257
+ if (content !== undefined && content !== null) body.content = content;
258
+ if (toolCalls !== undefined && toolCalls !== null) body.toolCalls = toolCalls;
259
+ if (toolResults !== undefined && toolResults !== null) body.toolResults = toolResults;
260
+ if (ttfbMs !== undefined && ttfbMs !== null) body.ttfbMs = ttfbMs;
261
+ if (latencyMs !== undefined && latencyMs !== null) body.latencyMs = latencyMs;
262
+ if (bargeInOccurred !== undefined && bargeInOccurred !== null) body.bargeInOccurred = bargeInOccurred;
263
+ return this.client(`/agent/conversations/${safeId}/messages`, { method: "POST", body, ...options });
264
+ }
265
+
266
+ /**
267
+ * End a conversation, closing its open session.
268
+ *
269
+ * `status` records HOW it ended and cannot be recovered afterwards, so pass the one that
270
+ * actually happened. Ending an already-ended conversation is a no-op, so a retry after a
271
+ * dropped connection cannot overwrite it.
272
+ * @async
273
+ * @roles api, admin, developer, billing, user
274
+ * @param {Object} params - The parameters for ending a conversation.
275
+ * @param {string} params.conversationId - The conversation to end (required).
276
+ * @param {string} [params.status] - "completed", "escalated", or "abandoned" (defaults to "completed").
277
+ * @param {Object} [params.metadata] - Metadata merged onto the conversation.
278
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
279
+ * @throws {Error} Throws an error if the conversationId parameter is missing.
280
+ * @returns {Promise<Object>} - The ended conversation.
281
+ */
282
+ async endConversation({ conversationId, status, metadata, options = {} }) {
283
+ this.client._require({ conversationId });
284
+ const safeId = encodeURIComponent(conversationId);
285
+ const body = {};
286
+ if (status !== undefined && status !== null) body.status = status;
287
+ if (metadata !== undefined && metadata !== null) body.metadata = metadata;
288
+ return this.client(`/agent/conversations/${safeId}`, { method: "PUT", body, ...options });
289
+ }
290
+
142
291
  /**
143
292
  * List an agent's per-channel settings (the tools enabled per channel, whether the
144
293
  * channel is on, and any channel-specific prompt/greeting).
@@ -146,9 +295,9 @@ export class Agents {
146
295
  * @roles api, admin, developer, billing, user
147
296
  * @param {Object} params - The parameters for listing channel settings.
148
297
  * @param {string} params.agentProfileId - The agent whose channel settings to list.
149
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
298
+ * @param {RequestOptions} [params.options] - Additional options for the request.
150
299
  * @throws {Error} Throws an error if the agentProfileId parameter is missing.
151
- * @returns {Promise<Object>} - The agent's channel settings returned from the server.
300
+ * @returns {Promise<SdkResponse<any>>} - The agent's channel settings returned from the server.
152
301
  */
153
302
  async getAgentChannelSettings({ agentProfileId, options = {} }) {
154
303
  this.client._require({ agentProfileId });
@@ -163,9 +312,9 @@ export class Agents {
163
312
  * @param {Object} params - The parameters for getting a channel setting.
164
313
  * @param {string} params.agentProfileId - The agent the setting belongs to.
165
314
  * @param {string} params.channel - The channel: "webchat", "sms", or "voice".
166
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
315
+ * @param {RequestOptions} [params.options] - Additional options for the request.
167
316
  * @throws {Error} Throws an error if agentProfileId or channel is missing.
168
- * @returns {Promise<Object>} - The channel setting returned from the server.
317
+ * @returns {Promise<SdkResponse<any>>} - The channel setting returned from the server.
169
318
  */
170
319
  async getAgentChannelSetting({ agentProfileId, channel, options = {} }) {
171
320
  this.client._require({ agentProfileId, channel });
@@ -182,10 +331,10 @@ export class Agents {
182
331
  * @param {Object} params - The parameters for the upsert.
183
332
  * @param {string} params.agentProfileId - The agent the setting belongs to.
184
333
  * @param {string} params.channel - The channel: "webchat", "sms", or "voice".
185
- * @param {Object} [params.settingData] - The fields to set: allowedTools (string[]), enabled (boolean), channelPrompt (string), greeting (string|null).
186
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
334
+ * @param {AgentChannelSettingData} [params.settingData] - The fields to set.
335
+ * @param {RequestOptions} [params.options] - Additional options for the request.
187
336
  * @throws {Error} Throws an error if agentProfileId or channel is missing.
188
- * @returns {Promise<Object>} - The created or updated channel setting returned from the server.
337
+ * @returns {Promise<SdkResponse<any>>} - The created or updated channel setting returned from the server.
189
338
  */
190
339
  async upsertAgentChannelSetting({ agentProfileId, channel, settingData = {}, options = {} }) {
191
340
  this.client._require({ agentProfileId, channel });
@@ -201,9 +350,9 @@ export class Agents {
201
350
  * @param {Object} params - The parameters for the delete.
202
351
  * @param {string} params.agentProfileId - The agent the setting belongs to.
203
352
  * @param {string} params.channel - The channel: "webchat", "sms", or "voice".
204
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
353
+ * @param {RequestOptions} [params.options] - Additional options for the request.
205
354
  * @throws {Error} Throws an error if agentProfileId or channel is missing.
206
- * @returns {Promise<Object>} - The delete confirmation returned from the server.
355
+ * @returns {Promise<SdkResponse<any>>} - The delete confirmation returned from the server.
207
356
  */
208
357
  async deleteAgentChannelSetting({ agentProfileId, channel, options = {} }) {
209
358
  this.client._require({ agentProfileId, channel });
@@ -221,9 +370,9 @@ export class Agents {
221
370
  * @param {Object} params - The parameters for reading tenant settings.
222
371
  * @param {string} params.groupId - The group (required).
223
372
  * @param {string} [params.subgroupId] - The subgroup; omit for the group-level settings.
224
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
373
+ * @param {RequestOptions} [params.options] - Additional options for the request.
225
374
  * @throws {Error} Throws an error if the groupId parameter is missing.
226
- * @returns {Promise<Object>} - The tenant settings returned from the server.
375
+ * @returns {Promise<SdkResponse<any>>} - The tenant settings returned from the server.
227
376
  */
228
377
  async getTenantAiSettings({ groupId, subgroupId, options = {} }) {
229
378
  this.client._require({ groupId });
@@ -240,9 +389,9 @@ export class Agents {
240
389
  * @param {string} params.groupId - The group (required).
241
390
  * @param {string} [params.subgroupId] - The subgroup; omit for the group-level settings.
242
391
  * @param {Object} [params.settingsData] - Fields to set: brandName (string), tone (string), timezone (IANA string), businessHours (array of {day, closed, open, close}), afterHoursMessage (string).
243
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
392
+ * @param {RequestOptions} [params.options] - Additional options for the request.
244
393
  * @throws {Error} Throws an error if the groupId parameter is missing.
245
- * @returns {Promise<Object>} - The created or updated tenant settings returned from the server.
394
+ * @returns {Promise<SdkResponse<any>>} - The created or updated tenant settings returned from the server.
246
395
  */
247
396
  async upsertTenantAiSettings({ groupId, subgroupId, settingsData = {}, options = {} }) {
248
397
  this.client._require({ groupId });
@@ -257,9 +406,9 @@ export class Agents {
257
406
  * @param {Object} params - The parameters for the delete.
258
407
  * @param {string} params.groupId - The group (required).
259
408
  * @param {string} [params.subgroupId] - The subgroup; omit for the group-level settings.
260
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
409
+ * @param {RequestOptions} [params.options] - Additional options for the request.
261
410
  * @throws {Error} Throws an error if the groupId parameter is missing.
262
- * @returns {Promise<Object>} - The delete confirmation returned from the server.
411
+ * @returns {Promise<SdkResponse<any>>} - The delete confirmation returned from the server.
263
412
  */
264
413
  async deleteTenantAiSettings({ groupId, subgroupId, options = {} }) {
265
414
  this.client._require({ groupId });
@@ -278,9 +427,9 @@ export class Agents {
278
427
  * @param {string} [params.agentProfileId] - Narrow to one agent.
279
428
  * @param {number} [params.page] - Page number (1-based) for pagination.
280
429
  * @param {number} [params.limit] - Items per page (max 100; server default 25).
281
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
430
+ * @param {RequestOptions} [params.options] - Additional options for the request.
282
431
  * @throws {Error} Throws an error if the groupId parameter is missing.
283
- * @returns {Promise<Object>} - The knowledge items returned from the server.
432
+ * @returns {Promise<SdkResponse<any>>} - The knowledge items returned from the server.
284
433
  */
285
434
  async getKnowledgeItems({ groupId, subgroupId, agentProfileId, page, limit, options = {} }) {
286
435
  this.client._require({ groupId });
@@ -294,9 +443,9 @@ export class Agents {
294
443
  * @roles api, admin, developer, billing, user
295
444
  * @param {Object} params - The parameters for getting a knowledge item.
296
445
  * @param {string} params.knowledgeItemId - The id of the knowledge item to fetch.
297
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
446
+ * @param {RequestOptions} [params.options] - Additional options for the request.
298
447
  * @throws {Error} Throws an error if the knowledgeItemId parameter is missing.
299
- * @returns {Promise<Object>} - The knowledge item returned from the server.
448
+ * @returns {Promise<SdkResponse<any>>} - The knowledge item returned from the server.
300
449
  */
301
450
  async getKnowledgeItem({ knowledgeItemId, options = {} }) {
302
451
  this.client._require({ knowledgeItemId });
@@ -314,9 +463,9 @@ export class Agents {
314
463
  * Optional: subgroupId (starts with 'S', nullable), agentProfileId
315
464
  * (nullable = shared across the tenant's agents), title, source
316
465
  * ("manual" | "url" | "document" | "import"), enabled (boolean), metadata (object|null).
317
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
466
+ * @param {RequestOptions} [params.options] - Additional options for the request.
318
467
  * @throws {Error} Throws an error if the itemData parameter is missing.
319
- * @returns {Promise<Object>} - The created knowledge item returned from the server.
468
+ * @returns {Promise<SdkResponse<any>>} - The created knowledge item returned from the server.
320
469
  */
321
470
  async createKnowledgeItem({ itemData, options = {} }) {
322
471
  this.client._require({ itemData });
@@ -331,9 +480,9 @@ export class Agents {
331
480
  * @param {Object} params - The parameters for updating a knowledge item.
332
481
  * @param {string} params.id - The id of the knowledge item to update.
333
482
  * @param {Object} params.updateData - The fields to update: title, text, source, enabled, metadata.
334
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
483
+ * @param {RequestOptions} [params.options] - Additional options for the request.
335
484
  * @throws {Error} Throws an error if the id or updateData parameter is missing.
336
- * @returns {Promise<Object>} - The updated knowledge item returned from the server.
485
+ * @returns {Promise<SdkResponse<any>>} - The updated knowledge item returned from the server.
337
486
  */
338
487
  async updateKnowledgeItem({ id, updateData, options = {} }) {
339
488
  this.client._require({ id, updateData });
@@ -347,9 +496,9 @@ export class Agents {
347
496
  * @roles api, admin, developer
348
497
  * @param {Object} params - The parameters for deleting a knowledge item.
349
498
  * @param {string} params.id - The id of the knowledge item to delete.
350
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
499
+ * @param {RequestOptions} [params.options] - Additional options for the request.
351
500
  * @throws {Error} Throws an error if the id parameter is missing.
352
- * @returns {Promise<Object>} - The delete confirmation returned from the server.
501
+ * @returns {Promise<SdkResponse<any>>} - The delete confirmation returned from the server.
353
502
  */
354
503
  async deleteKnowledgeItem({ id, options = {} }) {
355
504
  this.client._require({ id });
@@ -369,9 +518,9 @@ export class Agents {
369
518
  * @param {string} [params.type] - Narrow to a tool type: "builtin", "webhook", or "mcp".
370
519
  * @param {number} [params.page] - Page number (1-based) for pagination.
371
520
  * @param {number} [params.limit] - Items per page (max 100; server default 25).
372
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
521
+ * @param {RequestOptions} [params.options] - Additional options for the request.
373
522
  * @throws {Error} Throws an error if the groupId parameter is missing.
374
- * @returns {Promise<Object>} - The tools returned from the server (secrets redacted).
523
+ * @returns {Promise<SdkResponse<any>>} - The tools returned from the server (secrets redacted).
375
524
  */
376
525
  async getAgentTools({ groupId, subgroupId, agentProfileId, type, page, limit, options = {} }) {
377
526
  this.client._require({ groupId });
@@ -385,9 +534,9 @@ export class Agents {
385
534
  * @roles api, admin, developer, billing, user
386
535
  * @param {Object} params - The parameters for getting a tool.
387
536
  * @param {string} params.agentToolId - The id of the tool to fetch.
388
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
537
+ * @param {RequestOptions} [params.options] - Additional options for the request.
389
538
  * @throws {Error} Throws an error if the agentToolId parameter is missing.
390
- * @returns {Promise<Object>} - The tool returned from the server (secrets redacted).
539
+ * @returns {Promise<SdkResponse<any>>} - The tool returned from the server (secrets redacted).
391
540
  */
392
541
  async getAgentTool({ agentToolId, options = {} }) {
393
542
  this.client._require({ agentToolId });
@@ -411,9 +560,9 @@ export class Agents {
411
560
  * call (reserved/framing and `x-signalhouse-*` names are rejected); `signingSecret` makes us
412
561
  * send `X-SignalHouse-Signature: sha256=HMAC-SHA256(`${X-SignalHouse-Timestamp}.${rawBody}`)`
413
562
  * so you can verify the call and reject replays. Stored, never returned.
414
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
563
+ * @param {RequestOptions} [params.options] - Additional options for the request.
415
564
  * @throws {Error} Throws an error if the toolData parameter is missing.
416
- * @returns {Promise<Object>} - The created tool returned from the server (secrets redacted).
565
+ * @returns {Promise<SdkResponse<any>>} - The created tool returned from the server (secrets redacted).
417
566
  */
418
567
  async createAgentTool({ toolData, options = {} }) {
419
568
  this.client._require({ toolData });
@@ -428,9 +577,9 @@ export class Agents {
428
577
  * @param {Object} params - The parameters for updating a tool.
429
578
  * @param {string} params.id - The id of the tool to update.
430
579
  * @param {Object} params.updateData - The fields to update: name, description, type, builtinKey, parametersSchema, config, webhookUrl, webhookAuth, mcpServerUrl, channels, enabled.
431
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
580
+ * @param {RequestOptions} [params.options] - Additional options for the request.
432
581
  * @throws {Error} Throws an error if the id or updateData parameter is missing.
433
- * @returns {Promise<Object>} - The updated tool returned from the server (secrets redacted).
582
+ * @returns {Promise<SdkResponse<any>>} - The updated tool returned from the server (secrets redacted).
434
583
  */
435
584
  async updateAgentTool({ id, updateData, options = {} }) {
436
585
  this.client._require({ id, updateData });
@@ -444,9 +593,9 @@ export class Agents {
444
593
  * @roles api, admin, developer
445
594
  * @param {Object} params - The parameters for deleting a tool.
446
595
  * @param {string} params.id - The id of the tool to delete.
447
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
596
+ * @param {RequestOptions} [params.options] - Additional options for the request.
448
597
  * @throws {Error} Throws an error if the id parameter is missing.
449
- * @returns {Promise<Object>} - The delete confirmation returned from the server.
598
+ * @returns {Promise<SdkResponse<any>>} - The delete confirmation returned from the server.
450
599
  */
451
600
  async deleteAgentTool({ id, options = {} }) {
452
601
  this.client._require({ id });
@@ -1,3 +1,9 @@
1
+ /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
+ /**
3
+ * @template T
4
+ * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
+ */
6
+
1
7
  export class Auth {
2
8
  constructor(client, enableAdmin) {
3
9
  this.client = client;
@@ -13,9 +19,9 @@ export class Auth {
13
19
  * @roles signalhouse
14
20
  * @param {Object} params - The parameters for forcing a group logout
15
21
  * @param {string} params.groupId - The ID of the group whose users should be force-logged-out
16
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
22
+ * @param {RequestOptions} [params.options] - Additional options for the request
17
23
  * @throws {Error} Throws an error if the groupId parameter is missing
18
- * @returns {Promise<Object>} - The response containing loggedOutCount
24
+ * @returns {Promise<SdkResponse<any>>} - The response containing loggedOutCount
19
25
  */
20
26
  forceLogoutGroupUsers: async ({ groupId, options = {} }) => {
21
27
  this.client._require({ groupId });
@@ -33,8 +39,8 @@ export class Auth {
33
39
  * @param {Object} params
34
40
  * @param {string} params.email - The user's email address
35
41
  * @param {string} params.password - The user's password
36
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
37
- * @returns {Promise<Object>} The response from the server
42
+ * @param {RequestOptions} [params.options] - Additional options for the request
43
+ * @returns {Promise<SdkResponse<any>>} The response from the server
38
44
  */
39
45
  async login({ email, password, options = {} }) {
40
46
  return this.client(`/auth`, { method: "POST", body: { email, password }, ...options });
@@ -57,8 +63,8 @@ export class Auth {
57
63
  * @param {boolean} [params.acceptedTermsOfService] - Whether the user accepted the Terms of Service
58
64
  * @param {string} [params.psXid] - PartnerStack click id (ps_xid) captured from a referral link
59
65
  * @param {string} [params.psPartnerKey] - PartnerStack partner key (ps_partner_key) captured from a referral link
60
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
61
- * @returns {Promise<Object>} The response from the server (contains the JWT token)
66
+ * @param {RequestOptions} [params.options] - Additional options for the request
67
+ * @returns {Promise<SdkResponse<any>>} The response from the server (contains the JWT token)
62
68
  */
63
69
  async register({ businessName, fullName, email, password, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, options = {} }) {
64
70
  return this.client(`/auth/register`, {
@@ -83,8 +89,8 @@ export class Auth {
83
89
  * @roles public
84
90
  * @param {Object} params
85
91
  * @param {string} params.token - The verification token from the email link
86
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
87
- * @returns {Promise<Object>} The response from the server ({ verified: true, token?: string })
92
+ * @param {RequestOptions} [params.options] - Additional options for the request
93
+ * @returns {Promise<SdkResponse<any>>} The response from the server ({ verified: true, token?: string })
88
94
  */
89
95
  async verifyEmail({ token, options = {} }) {
90
96
  this.client._require({ token });
@@ -99,8 +105,8 @@ export class Auth {
99
105
  * @roles public
100
106
  * @param {Object} params
101
107
  * @param {string} params.email - The email address to send a reset link to
102
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
103
- * @returns {Promise<Object>} The response from the server ({ success: true })
108
+ * @param {RequestOptions} [params.options] - Additional options for the request
109
+ * @returns {Promise<SdkResponse<any>>} The response from the server ({ success: true })
104
110
  */
105
111
  async forgotPassword({ email, options = {} }) {
106
112
  this.client._require({ email });
@@ -114,8 +120,8 @@ export class Auth {
114
120
  * @param {Object} params
115
121
  * @param {string} params.token - The single-use reset token from the email link
116
122
  * @param {string} params.password - The new password to set (min 8 characters)
117
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
118
- * @returns {Promise<Object>} The response from the server ({ success: true })
123
+ * @param {RequestOptions} [params.options] - Additional options for the request
124
+ * @returns {Promise<SdkResponse<any>>} The response from the server ({ success: true })
119
125
  */
120
126
  async resetPasswordWithToken({ token, password, options = {} }) {
121
127
  this.client._require({ token, password });
@@ -129,8 +135,8 @@ export class Auth {
129
135
  * @async
130
136
  * @roles admin, developer, billing, user
131
137
  * @param {Object} [params]
132
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
133
- * @returns {Promise<Object>} The response from the server ({ sent: true })
138
+ * @param {RequestOptions} [params.options] - Additional options for the request
139
+ * @returns {Promise<SdkResponse<any>>} The response from the server ({ sent: true })
134
140
  */
135
141
  async sendVerificationEmail({ options = {} } = {}) {
136
142
  return this.client(`/auth/send-verification-email`, { method: "POST", ...options });
@@ -143,8 +149,8 @@ export class Auth {
143
149
  * @param {Object} params
144
150
  * @param {string} params.userId - The id of the user
145
151
  * @param {string} params.newPassword - The new password to set for the user
146
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
147
- * @returns {Promise<Object>} The response from the server
152
+ * @param {RequestOptions} [params.options] - Additional options for the request
153
+ * @returns {Promise<SdkResponse<any>>} The response from the server
148
154
  */
149
155
  async resetPassword({ userId, newPassword, options = {} }) {
150
156
  this.client._require({ userId, newPassword });
@@ -161,8 +167,8 @@ export class Auth {
161
167
  * @param {string} [params.userId] - Returns history for a specific user (one of groupId/userId required)
162
168
  * @param {number} [params.page] - Page number (min 1, default 1)
163
169
  * @param {number} [params.limit] - Results per page (min 1, max 100, default 20)
164
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
165
- * @returns {Promise<Object>} The response from the server
170
+ * @param {RequestOptions} [params.options] - Additional options for the request
171
+ * @returns {Promise<SdkResponse<any>>} The response from the server
166
172
  */
167
173
  async getAuthHistory({ groupId, userId, page, limit, options = {} }) {
168
174
  this.client._require({ "groupId or userId": groupId ?? userId });
@@ -175,8 +181,8 @@ export class Auth {
175
181
  * @async
176
182
  * @roles admin
177
183
  * @param {Object} [params]
178
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
179
- * @returns {Promise<Object>} The response containing loggedOutCount
184
+ * @param {RequestOptions} [params.options] - Additional options for the request
185
+ * @returns {Promise<SdkResponse<any>>} The response containing loggedOutCount
180
186
  */
181
187
  async logoutAll({ options = {} } = {}) {
182
188
  return this.client(`/auth/logout-all`, { method: "POST", ...options });
@@ -188,8 +194,8 @@ export class Auth {
188
194
  * @async
189
195
  * @roles admin, developer, billing, user, api
190
196
  * @param {Object} [params]
191
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
192
- * @returns {Promise<Object>} The response containing { groupId }
197
+ * @param {RequestOptions} [params.options] - Additional options for the request
198
+ * @returns {Promise<SdkResponse<any>>} The response containing { groupId }
193
199
  */
194
200
  async getGroupId({ options = {} } = {}) {
195
201
  return this.client(`/auth/group-id`, { method: "GET", ...options });
@@ -202,8 +208,8 @@ export class Auth {
202
208
  * @roles admin, developer, billing, user
203
209
  * @param {Object} params
204
210
  * @param {string} params.product - The external system to link to ("ghl" or "shopify")
205
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
206
- * @returns {Promise<Object>} The response from the server ({ token })
211
+ * @param {RequestOptions} [params.options] - Additional options for the request
212
+ * @returns {Promise<SdkResponse<any>>} The response from the server ({ token })
207
213
  */
208
214
  async requestExternalLinkToken({ product, options = {} }) {
209
215
  this.client._require({ product });