@signalwire/sdk 2.0.0 → 2.0.2

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 (612) hide show
  1. package/dist/AgentBase.d.ts +1045 -0
  2. package/dist/AgentBase.js +2375 -0
  3. package/dist/AgentBase.js.map +1 -0
  4. package/dist/AgentServer.d.ts +146 -0
  5. package/dist/AgentServer.js +388 -0
  6. package/dist/AgentServer.js.map +1 -0
  7. package/dist/AuthHandler.d.ts +127 -0
  8. package/dist/AuthHandler.js +212 -0
  9. package/dist/AuthHandler.js.map +1 -0
  10. package/dist/ConfigLoader.d.ts +170 -0
  11. package/dist/ConfigLoader.js +393 -0
  12. package/dist/ConfigLoader.js.map +1 -0
  13. package/dist/ContextBuilder.d.ts +652 -0
  14. package/dist/ContextBuilder.js +1115 -0
  15. package/dist/ContextBuilder.js.map +1 -0
  16. package/dist/DataMap.d.ts +271 -0
  17. package/dist/DataMap.js +430 -0
  18. package/dist/DataMap.js.map +1 -0
  19. package/dist/FunctionResult.d.ts +481 -0
  20. package/dist/FunctionResult.js +775 -0
  21. package/dist/FunctionResult.js.map +1 -0
  22. package/dist/Logger.d.ts +113 -0
  23. package/dist/Logger.js +320 -0
  24. package/dist/Logger.js.map +1 -0
  25. package/dist/PomBuilder.d.ts +208 -0
  26. package/dist/PomBuilder.js +409 -0
  27. package/dist/PomBuilder.js.map +1 -0
  28. package/dist/PromptManager.d.ts +85 -0
  29. package/dist/PromptManager.js +108 -0
  30. package/dist/PromptManager.js.map +1 -0
  31. package/dist/SWMLHandler.d.ts +159 -0
  32. package/dist/SWMLHandler.js +229 -0
  33. package/dist/SWMLHandler.js.map +1 -0
  34. package/dist/SWMLService.d.ts +326 -0
  35. package/dist/SWMLService.js +610 -0
  36. package/dist/SWMLService.js.map +1 -0
  37. package/dist/SchemaUtils.d.ts +108 -0
  38. package/dist/SchemaUtils.js +317 -0
  39. package/dist/SchemaUtils.js.map +1 -0
  40. package/dist/SecurityUtils.d.ts +60 -0
  41. package/{src/SecurityUtils.ts → dist/SecurityUtils.js} +82 -83
  42. package/dist/SecurityUtils.js.map +1 -0
  43. package/dist/ServerlessAdapter.d.ts +119 -0
  44. package/dist/ServerlessAdapter.js +188 -0
  45. package/dist/ServerlessAdapter.js.map +1 -0
  46. package/dist/SessionManager.d.ts +142 -0
  47. package/dist/SessionManager.js +260 -0
  48. package/dist/SessionManager.js.map +1 -0
  49. package/dist/SslConfig.d.ts +77 -0
  50. package/dist/SslConfig.js +100 -0
  51. package/dist/SslConfig.js.map +1 -0
  52. package/dist/SwaigFunction.d.ts +159 -0
  53. package/dist/SwaigFunction.js +209 -0
  54. package/dist/SwaigFunction.js.map +1 -0
  55. package/dist/SwmlBuilder.d.ts +165 -0
  56. package/dist/SwmlBuilder.js +247 -0
  57. package/dist/SwmlBuilder.js.map +1 -0
  58. package/dist/SwmlVerbMethods.generated.d.ts +254 -0
  59. package/dist/SwmlVerbMethods.generated.js +9 -0
  60. package/dist/SwmlVerbMethods.generated.js.map +1 -0
  61. package/dist/TypeInference.d.ts +71 -0
  62. package/dist/TypeInference.js +164 -0
  63. package/dist/TypeInference.js.map +1 -0
  64. package/dist/WebService.d.ts +148 -0
  65. package/dist/WebService.js +532 -0
  66. package/dist/WebService.js.map +1 -0
  67. package/dist/cli/agent-loader.d.ts +22 -0
  68. package/dist/cli/agent-loader.js +144 -0
  69. package/dist/cli/agent-loader.js.map +1 -0
  70. package/dist/cli/mock-data.d.ts +37 -0
  71. package/dist/cli/mock-data.js +80 -0
  72. package/dist/cli/mock-data.js.map +1 -0
  73. package/dist/cli/swaig-test.d.ts +32 -0
  74. package/dist/cli/swaig-test.js +418 -0
  75. package/dist/cli/swaig-test.js.map +1 -0
  76. package/dist/generateVerbTypes.d.ts +11 -0
  77. package/dist/generateVerbTypes.js +265 -0
  78. package/dist/generateVerbTypes.js.map +1 -0
  79. package/dist/index.d.ts +146 -0
  80. package/dist/index.js +152 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/livewire/index.d.ts +653 -0
  83. package/dist/livewire/index.js +992 -0
  84. package/dist/livewire/index.js.map +1 -0
  85. package/dist/prefabs/ConciergeAgent.d.ts +89 -0
  86. package/dist/prefabs/ConciergeAgent.js +245 -0
  87. package/dist/prefabs/ConciergeAgent.js.map +1 -0
  88. package/dist/prefabs/FAQBotAgent.d.ts +113 -0
  89. package/dist/prefabs/FAQBotAgent.js +329 -0
  90. package/dist/prefabs/FAQBotAgent.js.map +1 -0
  91. package/dist/prefabs/InfoGathererAgent.d.ts +126 -0
  92. package/dist/prefabs/InfoGathererAgent.js +287 -0
  93. package/dist/prefabs/InfoGathererAgent.js.map +1 -0
  94. package/dist/prefabs/ReceptionistAgent.d.ts +104 -0
  95. package/dist/prefabs/ReceptionistAgent.js +303 -0
  96. package/dist/prefabs/ReceptionistAgent.js.map +1 -0
  97. package/dist/prefabs/SurveyAgent.d.ts +148 -0
  98. package/dist/prefabs/SurveyAgent.js +540 -0
  99. package/dist/prefabs/SurveyAgent.js.map +1 -0
  100. package/{src/prefabs/index.ts → dist/prefabs/index.d.ts} +1 -15
  101. package/dist/prefabs/index.js +14 -0
  102. package/dist/prefabs/index.js.map +1 -0
  103. package/dist/relay/Action.d.ts +258 -0
  104. package/dist/relay/Action.js +402 -0
  105. package/dist/relay/Action.js.map +1 -0
  106. package/dist/relay/Call.d.ts +697 -0
  107. package/dist/relay/Call.js +1062 -0
  108. package/dist/relay/Call.js.map +1 -0
  109. package/dist/relay/Deferred.d.ts +44 -0
  110. package/dist/relay/Deferred.js +69 -0
  111. package/dist/relay/Deferred.js.map +1 -0
  112. package/dist/relay/Message.d.ts +103 -0
  113. package/dist/relay/Message.js +169 -0
  114. package/dist/relay/Message.js.map +1 -0
  115. package/dist/relay/RelayClient.d.ts +302 -0
  116. package/dist/relay/RelayClient.js +1019 -0
  117. package/dist/relay/RelayClient.js.map +1 -0
  118. package/dist/relay/RelayError.d.ts +15 -0
  119. package/dist/relay/RelayError.js +20 -0
  120. package/dist/relay/RelayError.js.map +1 -0
  121. package/dist/relay/RelayEvent.d.ts +254 -0
  122. package/dist/relay/RelayEvent.js +509 -0
  123. package/dist/relay/RelayEvent.js.map +1 -0
  124. package/dist/relay/constants.d.ts +90 -0
  125. package/{src/relay/constants.ts → dist/relay/constants.js} +11 -29
  126. package/dist/relay/constants.js.map +1 -0
  127. package/dist/relay/index.d.ts +16 -0
  128. package/dist/relay/index.js +18 -0
  129. package/dist/relay/index.js.map +1 -0
  130. package/dist/relay/types.d.ts +142 -0
  131. package/dist/relay/types.js +5 -0
  132. package/dist/relay/types.js.map +1 -0
  133. package/dist/rest/HttpClient.d.ts +80 -0
  134. package/dist/rest/HttpClient.js +148 -0
  135. package/dist/rest/HttpClient.js.map +1 -0
  136. package/dist/rest/RestError.d.ts +30 -0
  137. package/dist/rest/RestError.js +39 -0
  138. package/dist/rest/RestError.js.map +1 -0
  139. package/dist/rest/base/BaseResource.d.ts +24 -0
  140. package/dist/rest/base/BaseResource.js +29 -0
  141. package/dist/rest/base/BaseResource.js.map +1 -0
  142. package/dist/rest/base/CrudResource.d.ts +68 -0
  143. package/dist/rest/base/CrudResource.js +82 -0
  144. package/dist/rest/base/CrudResource.js.map +1 -0
  145. package/dist/rest/base/CrudWithAddresses.d.ts +22 -0
  146. package/dist/rest/base/CrudWithAddresses.js +25 -0
  147. package/dist/rest/base/CrudWithAddresses.js.map +1 -0
  148. package/{src/rest/index.ts → dist/rest/index.d.ts} +53 -122
  149. package/dist/rest/index.js +195 -0
  150. package/dist/rest/index.js.map +1 -0
  151. package/dist/rest/namespaces/addresses.d.ts +46 -0
  152. package/dist/rest/namespaces/addresses.js +55 -0
  153. package/dist/rest/namespaces/addresses.js.map +1 -0
  154. package/dist/rest/namespaces/calling.d.ts +382 -0
  155. package/dist/rest/namespaces/calling.js +478 -0
  156. package/dist/rest/namespaces/calling.js.map +1 -0
  157. package/dist/rest/namespaces/chat.d.ts +22 -0
  158. package/dist/rest/namespaces/chat.js +26 -0
  159. package/dist/rest/namespaces/chat.js.map +1 -0
  160. package/dist/rest/namespaces/compat.d.ts +585 -0
  161. package/dist/rest/namespaces/compat.js +735 -0
  162. package/dist/rest/namespaces/compat.js.map +1 -0
  163. package/dist/rest/namespaces/datasphere.d.ts +66 -0
  164. package/dist/rest/namespaces/datasphere.js +77 -0
  165. package/dist/rest/namespaces/datasphere.js.map +1 -0
  166. package/dist/rest/namespaces/fabric.d.ts +282 -0
  167. package/dist/rest/namespaces/fabric.js +373 -0
  168. package/dist/rest/namespaces/fabric.js.map +1 -0
  169. package/dist/rest/namespaces/imported-numbers.d.ts +22 -0
  170. package/dist/rest/namespaces/imported-numbers.js +26 -0
  171. package/dist/rest/namespaces/imported-numbers.js.map +1 -0
  172. package/dist/rest/namespaces/logs.d.ts +105 -0
  173. package/dist/rest/namespaces/logs.js +133 -0
  174. package/dist/rest/namespaces/logs.js.map +1 -0
  175. package/dist/rest/namespaces/lookup.d.ts +29 -0
  176. package/dist/rest/namespaces/lookup.js +32 -0
  177. package/dist/rest/namespaces/lookup.js.map +1 -0
  178. package/dist/rest/namespaces/mfa.d.ts +46 -0
  179. package/dist/rest/namespaces/mfa.js +54 -0
  180. package/dist/rest/namespaces/mfa.js.map +1 -0
  181. package/dist/rest/namespaces/number-groups.d.ts +49 -0
  182. package/dist/rest/namespaces/number-groups.js +58 -0
  183. package/dist/rest/namespaces/number-groups.js.map +1 -0
  184. package/dist/rest/namespaces/phone-numbers.d.ts +60 -0
  185. package/dist/rest/namespaces/phone-numbers.js +67 -0
  186. package/dist/rest/namespaces/phone-numbers.js.map +1 -0
  187. package/dist/rest/namespaces/project.d.ts +46 -0
  188. package/dist/rest/namespaces/project.js +56 -0
  189. package/dist/rest/namespaces/project.js.map +1 -0
  190. package/dist/rest/namespaces/pubsub.d.ts +22 -0
  191. package/dist/rest/namespaces/pubsub.js +26 -0
  192. package/dist/rest/namespaces/pubsub.js.map +1 -0
  193. package/dist/rest/namespaces/queues.d.ts +42 -0
  194. package/dist/rest/namespaces/queues.js +49 -0
  195. package/dist/rest/namespaces/queues.js.map +1 -0
  196. package/dist/rest/namespaces/recordings.d.ts +38 -0
  197. package/dist/rest/namespaces/recordings.js +45 -0
  198. package/dist/rest/namespaces/recordings.js.map +1 -0
  199. package/dist/rest/namespaces/registry.d.ts +141 -0
  200. package/dist/rest/namespaces/registry.js +178 -0
  201. package/dist/rest/namespaces/registry.js.map +1 -0
  202. package/dist/rest/namespaces/short-codes.d.ts +39 -0
  203. package/dist/rest/namespaces/short-codes.js +46 -0
  204. package/dist/rest/namespaces/short-codes.js.map +1 -0
  205. package/dist/rest/namespaces/sip-profile.d.ts +28 -0
  206. package/dist/rest/namespaces/sip-profile.js +34 -0
  207. package/dist/rest/namespaces/sip-profile.js.map +1 -0
  208. package/dist/rest/namespaces/verified-callers.d.ts +33 -0
  209. package/dist/rest/namespaces/verified-callers.js +39 -0
  210. package/dist/rest/namespaces/verified-callers.js.map +1 -0
  211. package/dist/rest/namespaces/video.d.ts +235 -0
  212. package/dist/rest/namespaces/video.js +297 -0
  213. package/dist/rest/namespaces/video.js.map +1 -0
  214. package/dist/rest/pagination.d.ts +39 -0
  215. package/dist/rest/pagination.js +78 -0
  216. package/dist/rest/pagination.js.map +1 -0
  217. package/dist/rest/types.d.ts +54 -0
  218. package/dist/rest/types.js +5 -0
  219. package/dist/rest/types.js.map +1 -0
  220. package/dist/skills/SkillBase.d.ts +404 -0
  221. package/dist/skills/SkillBase.js +471 -0
  222. package/dist/skills/SkillBase.js.map +1 -0
  223. package/dist/skills/SkillManager.d.ts +195 -0
  224. package/dist/skills/SkillManager.js +378 -0
  225. package/dist/skills/SkillManager.js.map +1 -0
  226. package/dist/skills/SkillRegistry.d.ts +176 -0
  227. package/dist/skills/SkillRegistry.js +310 -0
  228. package/dist/skills/SkillRegistry.js.map +1 -0
  229. package/dist/skills/builtin/api_ninjas_trivia.d.ts +47 -0
  230. package/dist/skills/builtin/api_ninjas_trivia.js +211 -0
  231. package/dist/skills/builtin/api_ninjas_trivia.js.map +1 -0
  232. package/dist/skills/builtin/ask_claude.d.ts +37 -0
  233. package/dist/skills/builtin/ask_claude.js +162 -0
  234. package/dist/skills/builtin/ask_claude.js.map +1 -0
  235. package/dist/skills/builtin/claude_skills.d.ts +75 -0
  236. package/dist/skills/builtin/claude_skills.js +753 -0
  237. package/dist/skills/builtin/claude_skills.js.map +1 -0
  238. package/dist/skills/builtin/custom_skills.d.ts +79 -0
  239. package/dist/skills/builtin/custom_skills.js +227 -0
  240. package/dist/skills/builtin/custom_skills.js.map +1 -0
  241. package/dist/skills/builtin/datasphere.d.ts +73 -0
  242. package/dist/skills/builtin/datasphere.js +350 -0
  243. package/dist/skills/builtin/datasphere.js.map +1 -0
  244. package/dist/skills/builtin/datasphere_serverless.d.ts +89 -0
  245. package/dist/skills/builtin/datasphere_serverless.js +291 -0
  246. package/dist/skills/builtin/datasphere_serverless.js.map +1 -0
  247. package/dist/skills/builtin/datetime.d.ts +40 -0
  248. package/dist/skills/builtin/datetime.js +118 -0
  249. package/dist/skills/builtin/datetime.js.map +1 -0
  250. package/dist/skills/builtin/google_maps.d.ts +48 -0
  251. package/dist/skills/builtin/google_maps.js +470 -0
  252. package/dist/skills/builtin/google_maps.js.map +1 -0
  253. package/dist/skills/builtin/index.d.ts +31 -0
  254. package/{src/skills/builtin/index.ts → dist/skills/builtin/index.js} +30 -36
  255. package/dist/skills/builtin/index.js.map +1 -0
  256. package/dist/skills/builtin/info_gatherer.d.ts +115 -0
  257. package/dist/skills/builtin/info_gatherer.js +328 -0
  258. package/dist/skills/builtin/info_gatherer.js.map +1 -0
  259. package/dist/skills/builtin/joke.d.ts +41 -0
  260. package/dist/skills/builtin/joke.js +156 -0
  261. package/dist/skills/builtin/joke.js.map +1 -0
  262. package/dist/skills/builtin/math.d.ts +39 -0
  263. package/dist/skills/builtin/math.js +119 -0
  264. package/dist/skills/builtin/math.js.map +1 -0
  265. package/dist/skills/builtin/mcp_gateway.d.ts +82 -0
  266. package/dist/skills/builtin/mcp_gateway.js +574 -0
  267. package/dist/skills/builtin/mcp_gateway.js.map +1 -0
  268. package/dist/skills/builtin/native_vector_search.d.ts +128 -0
  269. package/dist/skills/builtin/native_vector_search.js +752 -0
  270. package/dist/skills/builtin/native_vector_search.js.map +1 -0
  271. package/dist/skills/builtin/play_background_file.d.ts +59 -0
  272. package/dist/skills/builtin/play_background_file.js +274 -0
  273. package/dist/skills/builtin/play_background_file.js.map +1 -0
  274. package/dist/skills/builtin/spider.d.ts +91 -0
  275. package/dist/skills/builtin/spider.js +758 -0
  276. package/dist/skills/builtin/spider.js.map +1 -0
  277. package/dist/skills/builtin/swml_transfer.d.ts +66 -0
  278. package/dist/skills/builtin/swml_transfer.js +475 -0
  279. package/dist/skills/builtin/swml_transfer.js.map +1 -0
  280. package/dist/skills/builtin/weather_api.d.ts +59 -0
  281. package/dist/skills/builtin/weather_api.js +196 -0
  282. package/dist/skills/builtin/weather_api.js.map +1 -0
  283. package/dist/skills/builtin/web_search.d.ts +160 -0
  284. package/dist/skills/builtin/web_search.js +894 -0
  285. package/dist/skills/builtin/web_search.js.map +1 -0
  286. package/dist/skills/builtin/wikipedia_search.d.ts +77 -0
  287. package/dist/skills/builtin/wikipedia_search.js +241 -0
  288. package/dist/skills/builtin/wikipedia_search.js.map +1 -0
  289. package/{src/skills/index.ts → dist/skills/index.d.ts} +0 -1
  290. package/dist/skills/index.js +10 -0
  291. package/dist/skills/index.js.map +1 -0
  292. package/dist/types.d.ts +118 -0
  293. package/dist/types.js +5 -0
  294. package/dist/types.js.map +1 -0
  295. package/package.json +7 -1
  296. package/.github/workflows/publish.yml +0 -27
  297. package/.github/workflows/test.yml +0 -17
  298. package/CLAUDE.md +0 -112
  299. package/docs/MIGRATION-2.0.md +0 -81
  300. package/docs/agent-guide.md +0 -869
  301. package/docs/agent_guide.md +0 -1026
  302. package/docs/api-reference.md +0 -2420
  303. package/docs/api_reference.md +0 -1301
  304. package/docs/architecture.md +0 -843
  305. package/docs/cli-guide.md +0 -579
  306. package/docs/cli_guide.md +0 -448
  307. package/docs/cloud_functions_guide.md +0 -474
  308. package/docs/configuration.md +0 -422
  309. package/docs/contexts-guide.md +0 -787
  310. package/docs/contexts_guide.md +0 -511
  311. package/docs/datamap-guide.md +0 -1141
  312. package/docs/datamap_guide.md +0 -595
  313. package/docs/llm_parameters.md +0 -239
  314. package/docs/mcp_gateway_reference.md +0 -648
  315. package/docs/mcp_integration.md +0 -108
  316. package/docs/prefabs-guide.md +0 -800
  317. package/docs/sdk_features.md +0 -477
  318. package/docs/security.md +0 -436
  319. package/docs/serverless-guide.md +0 -513
  320. package/docs/skills-guide.md +0 -857
  321. package/docs/skills-system.md +0 -301
  322. package/docs/skills_parameter_schema.md +0 -392
  323. package/docs/skills_system.md +0 -467
  324. package/docs/swaig-reference.md +0 -1627
  325. package/docs/swaig_reference.md +0 -910
  326. package/docs/swml_service_guide.md +0 -600
  327. package/docs/third_party_skills.md +0 -533
  328. package/docs/web_service.md +0 -677
  329. package/examples/README.md +0 -131
  330. package/examples/advanced-datamap.ts +0 -100
  331. package/examples/advanced-dynamic-config.ts +0 -70
  332. package/examples/auto-vivified.ts +0 -94
  333. package/examples/call-flow.ts +0 -63
  334. package/examples/comprehensive-dynamic.ts +0 -125
  335. package/examples/contexts-steps.ts +0 -65
  336. package/examples/custom-path.ts +0 -45
  337. package/examples/datamap-tools.ts +0 -55
  338. package/examples/datasphere-multi-instance.ts +0 -63
  339. package/examples/datasphere-serverless-env.ts +0 -68
  340. package/examples/datasphere-webhook-env.ts +0 -66
  341. package/examples/datasphere.ts +0 -37
  342. package/examples/declarative.ts +0 -100
  343. package/examples/dynamic-config.ts +0 -54
  344. package/examples/dynamic-info-gatherer.ts +0 -69
  345. package/examples/dynamic-swml-service.ts +0 -67
  346. package/examples/gather-info.ts +0 -71
  347. package/examples/gather-per-question-functions-demo.ts +0 -140
  348. package/examples/joke-agent.ts +0 -34
  349. package/examples/kubernetes-agent.ts +0 -45
  350. package/examples/llm-params.ts +0 -69
  351. package/examples/mcp-agent.ts +0 -84
  352. package/examples/mcp-gateway.ts +0 -35
  353. package/examples/multi-agent.ts +0 -73
  354. package/examples/multi-endpoint.ts +0 -79
  355. package/examples/pom-prompt.ts +0 -71
  356. package/examples/prefab-concierge.ts +0 -47
  357. package/examples/prefab-faq.ts +0 -54
  358. package/examples/prefab-info-gatherer.ts +0 -33
  359. package/examples/prefab-receptionist.ts +0 -36
  360. package/examples/prefab-survey.ts +0 -68
  361. package/examples/record-call.ts +0 -67
  362. package/examples/relay-demo.ts +0 -33
  363. package/examples/room-and-sip.ts +0 -94
  364. package/examples/serverless-lambda.ts +0 -35
  365. package/examples/session-state.ts +0 -83
  366. package/examples/simple-agent.ts +0 -36
  367. package/examples/simple-static.ts +0 -29
  368. package/examples/skills-demo.ts +0 -38
  369. package/examples/step-function-inheritance-demo.ts +0 -124
  370. package/examples/swaig-features.ts +0 -187
  371. package/examples/swml-service-routing.ts +0 -66
  372. package/examples/swml-service.ts +0 -38
  373. package/examples/tap.ts +0 -68
  374. package/examples/verb-methods.ts +0 -45
  375. package/examples/web-search-multi-instance.ts +0 -72
  376. package/examples/web-search.ts +0 -38
  377. package/examples/wikipedia.ts +0 -36
  378. package/livewire/README.md +0 -140
  379. package/livewire/docs/migration-guide.md +0 -228
  380. package/livewire/examples/livewire-basic-agent.ts +0 -74
  381. package/livewire/examples/livewire-handoff.ts +0 -197
  382. package/livewire/examples/livewire-multi-tool.ts +0 -117
  383. package/relay/README.md +0 -70
  384. package/relay/RELAY_IMPLEMENTATION_GUIDE.md +0 -1257
  385. package/relay/docs/call-methods.md +0 -474
  386. package/relay/docs/client-reference.md +0 -142
  387. package/relay/docs/events.md +0 -134
  388. package/relay/docs/getting-started.md +0 -134
  389. package/relay/docs/guide.md +0 -306
  390. package/relay/docs/messaging.md +0 -182
  391. package/relay/examples/relay-inbound.ts +0 -66
  392. package/relay/examples/relay-messaging.ts +0 -71
  393. package/relay/examples/relay-outbound.ts +0 -76
  394. package/rest/README.md +0 -95
  395. package/rest/docs/calling.md +0 -273
  396. package/rest/docs/client-reference.md +0 -107
  397. package/rest/docs/compat.md +0 -204
  398. package/rest/docs/fabric.md +0 -183
  399. package/rest/docs/getting-started.md +0 -110
  400. package/rest/docs/guide.md +0 -351
  401. package/rest/docs/namespaces.md +0 -285
  402. package/rest/examples/rest-10dlc-registration.ts +0 -161
  403. package/rest/examples/rest-calling-ivr-and-ai.ts +0 -102
  404. package/rest/examples/rest-calling-play-and-record.ts +0 -91
  405. package/rest/examples/rest-client.ts +0 -65
  406. package/rest/examples/rest-compat-laml.ts +0 -210
  407. package/rest/examples/rest-datasphere-search.ts +0 -82
  408. package/rest/examples/rest-fabric-conferences-and-routing.ts +0 -144
  409. package/rest/examples/rest-fabric-subscribers-and-sip.ts +0 -108
  410. package/rest/examples/rest-fabric-swml-and-callflows.ts +0 -99
  411. package/rest/examples/rest-manage-resources.ts +0 -65
  412. package/rest/examples/rest-phone-number-management.ts +0 -197
  413. package/rest/examples/rest-queues-mfa-and-recordings.ts +0 -143
  414. package/rest/examples/rest-video-rooms.ts +0 -186
  415. package/src/AgentBase.ts +0 -2489
  416. package/src/AgentServer.ts +0 -415
  417. package/src/AuthHandler.ts +0 -256
  418. package/src/ConfigLoader.ts +0 -447
  419. package/src/ContextBuilder.ts +0 -1150
  420. package/src/DataMap.ts +0 -449
  421. package/src/FunctionResult.ts +0 -866
  422. package/src/Logger.ts +0 -337
  423. package/src/PomBuilder.ts +0 -439
  424. package/src/PromptManager.ts +0 -133
  425. package/src/SWMLHandler.ts +0 -298
  426. package/src/SWMLService.ts +0 -717
  427. package/src/SchemaUtils.ts +0 -361
  428. package/src/ServerlessAdapter.ts +0 -221
  429. package/src/SessionManager.ts +0 -311
  430. package/src/SslConfig.ts +0 -118
  431. package/src/SwaigFunction.ts +0 -276
  432. package/src/SwmlBuilder.ts +0 -258
  433. package/src/SwmlVerbMethods.generated.ts +0 -234
  434. package/src/TypeInference.ts +0 -181
  435. package/src/WebService.ts +0 -619
  436. package/src/cli/agent-loader.ts +0 -166
  437. package/src/cli/mock-data.ts +0 -111
  438. package/src/cli/swaig-test.ts +0 -452
  439. package/src/generateVerbTypes.ts +0 -322
  440. package/src/index.ts +0 -167
  441. package/src/livewire/index.ts +0 -950
  442. package/src/prefabs/ConciergeAgent.ts +0 -287
  443. package/src/prefabs/FAQBotAgent.ts +0 -384
  444. package/src/prefabs/InfoGathererAgent.ts +0 -339
  445. package/src/prefabs/ReceptionistAgent.ts +0 -366
  446. package/src/prefabs/SurveyAgent.ts +0 -646
  447. package/src/relay/Action.ts +0 -314
  448. package/src/relay/Call.ts +0 -854
  449. package/src/relay/Deferred.ts +0 -71
  450. package/src/relay/Message.ts +0 -148
  451. package/src/relay/RelayClient.ts +0 -1036
  452. package/src/relay/RelayError.ts +0 -14
  453. package/src/relay/RelayEvent.ts +0 -892
  454. package/src/relay/index.ts +0 -123
  455. package/src/relay/types.ts +0 -149
  456. package/src/rest/HttpClient.ts +0 -103
  457. package/src/rest/RestError.ts +0 -31
  458. package/src/rest/base/BaseResource.ts +0 -19
  459. package/src/rest/base/CrudResource.ts +0 -51
  460. package/src/rest/base/CrudWithAddresses.ts +0 -26
  461. package/src/rest/namespaces/addresses.ts +0 -32
  462. package/src/rest/namespaces/calling.ts +0 -187
  463. package/src/rest/namespaces/chat.ts +0 -20
  464. package/src/rest/namespaces/compat.ts +0 -352
  465. package/src/rest/namespaces/datasphere.ts +0 -45
  466. package/src/rest/namespaces/fabric.ts +0 -222
  467. package/src/rest/namespaces/imported-numbers.ts +0 -20
  468. package/src/rest/namespaces/logs.ts +0 -84
  469. package/src/rest/namespaces/lookup.ts +0 -21
  470. package/src/rest/namespaces/mfa.ts +0 -30
  471. package/src/rest/namespaces/number-groups.ts +0 -38
  472. package/src/rest/namespaces/phone-numbers.ts +0 -44
  473. package/src/rest/namespaces/project.ts +0 -36
  474. package/src/rest/namespaces/pubsub.ts +0 -20
  475. package/src/rest/namespaces/queues.ts +0 -33
  476. package/src/rest/namespaces/recordings.ts +0 -28
  477. package/src/rest/namespaces/registry.ts +0 -101
  478. package/src/rest/namespaces/short-codes.ts +0 -28
  479. package/src/rest/namespaces/sip-profile.ts +0 -25
  480. package/src/rest/namespaces/verified-callers.ts +0 -27
  481. package/src/rest/namespaces/video.ts +0 -165
  482. package/src/rest/pagination.ts +0 -84
  483. package/src/rest/types.ts +0 -61
  484. package/src/skills/SkillBase.ts +0 -547
  485. package/src/skills/SkillManager.ts +0 -415
  486. package/src/skills/SkillRegistry.ts +0 -367
  487. package/src/skills/builtin/api_ninjas_trivia.ts +0 -280
  488. package/src/skills/builtin/ask_claude.ts +0 -241
  489. package/src/skills/builtin/claude_skills.ts +0 -978
  490. package/src/skills/builtin/custom_skills.ts +0 -312
  491. package/src/skills/builtin/datasphere.ts +0 -438
  492. package/src/skills/builtin/datasphere_serverless.ts +0 -339
  493. package/src/skills/builtin/datetime.ts +0 -130
  494. package/src/skills/builtin/google_maps.ts +0 -651
  495. package/src/skills/builtin/info_gatherer.ts +0 -405
  496. package/src/skills/builtin/joke.ts +0 -191
  497. package/src/skills/builtin/math.ts +0 -142
  498. package/src/skills/builtin/mcp_gateway.ts +0 -677
  499. package/src/skills/builtin/native_vector_search.ts +0 -901
  500. package/src/skills/builtin/play_background_file.ts +0 -358
  501. package/src/skills/builtin/spider.ts +0 -869
  502. package/src/skills/builtin/swml_transfer.ts +0 -635
  503. package/src/skills/builtin/weather_api.ts +0 -248
  504. package/src/skills/builtin/web_search.ts +0 -1074
  505. package/src/skills/builtin/wikipedia_search.ts +0 -299
  506. package/src/types.ts +0 -132
  507. package/tests/AgentBase.test.ts +0 -1093
  508. package/tests/AgentServer.test.ts +0 -126
  509. package/tests/AuthHandler.test.ts +0 -133
  510. package/tests/ConfigLoader.test.ts +0 -151
  511. package/tests/ContextBuilder.test.ts +0 -108
  512. package/tests/DataMap.test.ts +0 -367
  513. package/tests/EphemeralSkillCopy.test.ts +0 -107
  514. package/tests/FunctionResult.test.ts +0 -298
  515. package/tests/GracefulShutdown.test.ts +0 -46
  516. package/tests/Logger.test.ts +0 -420
  517. package/tests/PomBuilder.test.ts +0 -228
  518. package/tests/ProxyDetection.test.ts +0 -228
  519. package/tests/SWMLService.test.ts +0 -320
  520. package/tests/SWMLVerbHandler.test.ts +0 -523
  521. package/tests/SchemaUtils.test.ts +0 -106
  522. package/tests/SchemaUtils.verb.test.ts +0 -206
  523. package/tests/SecurityUtils.test.ts +0 -192
  524. package/tests/ServerlessAdapter.test.ts +0 -222
  525. package/tests/SessionManager.test.ts +0 -257
  526. package/tests/SkillBaseFeatures.test.ts +0 -130
  527. package/tests/SkillMultiInstance.test.ts +0 -102
  528. package/tests/SkillParameterSchemas.test.ts +0 -134
  529. package/tests/SkillRegistrySchema.test.ts +0 -84
  530. package/tests/SslConfig.test.ts +0 -97
  531. package/tests/SwmlBuilder.test.ts +0 -400
  532. package/tests/TypeInference.test.ts +0 -165
  533. package/tests/VerbHandlerRegistry.test.ts +0 -128
  534. package/tests/cli/mock-data.test.ts +0 -113
  535. package/tests/cli/swaig-test.test.ts +0 -108
  536. package/tests/examples.test.ts +0 -194
  537. package/tests/fixtures/scrape-parity/README.md +0 -53
  538. package/tests/fixtures/scrape-parity/expected/01_simple_article.json +0 -5
  539. package/tests/fixtures/scrape-parity/expected/02_class_based_noise.json +0 -5
  540. package/tests/fixtures/scrape-parity/expected/03_nested_containers.json +0 -5
  541. package/tests/fixtures/scrape-parity/expected/04_bare_body.json +0 -5
  542. package/tests/fixtures/scrape-parity/expected/05_malformed.json +0 -5
  543. package/tests/fixtures/scrape-parity/expected/06_multi_class.json +0 -5
  544. package/tests/fixtures/scrape-parity/expected/07_anchor_pattern.json +0 -5
  545. package/tests/fixtures/scrape-parity/expected/08_inline_script.json +0 -5
  546. package/tests/fixtures/scrape-parity/expected/09_whitespace_nbsp.json +0 -5
  547. package/tests/fixtures/scrape-parity/expected/10_entity_unicode.json +0 -5
  548. package/tests/fixtures/scrape-parity/expected/11_cdata_comments.json +0 -5
  549. package/tests/fixtures/scrape-parity/expected/12_deep_nested_removals.json +0 -5
  550. package/tests/fixtures/scrape-parity/html/01_simple_article.html +0 -18
  551. package/tests/fixtures/scrape-parity/html/02_class_based_noise.html +0 -18
  552. package/tests/fixtures/scrape-parity/html/03_nested_containers.html +0 -13
  553. package/tests/fixtures/scrape-parity/html/04_bare_body.html +0 -9
  554. package/tests/fixtures/scrape-parity/html/05_malformed.html +0 -11
  555. package/tests/fixtures/scrape-parity/html/06_multi_class.html +0 -18
  556. package/tests/fixtures/scrape-parity/html/07_anchor_pattern.html +0 -12
  557. package/tests/fixtures/scrape-parity/html/08_inline_script.html +0 -17
  558. package/tests/fixtures/scrape-parity/html/09_whitespace_nbsp.html +0 -21
  559. package/tests/fixtures/scrape-parity/html/10_entity_unicode.html +0 -10
  560. package/tests/fixtures/scrape-parity/html/11_cdata_comments.html +0 -13
  561. package/tests/fixtures/scrape-parity/html/12_deep_nested_removals.html +0 -24
  562. package/tests/fixtures/scrape-parity/python_extract.py +0 -109
  563. package/tests/livewire/livewire.test.ts +0 -780
  564. package/tests/mcp.test.ts +0 -221
  565. package/tests/prefabs/prefabs.test.ts +0 -1093
  566. package/tests/relay/Action.test.ts +0 -392
  567. package/tests/relay/Call.test.ts +0 -535
  568. package/tests/relay/Deferred.test.ts +0 -71
  569. package/tests/relay/Message.test.ts +0 -164
  570. package/tests/relay/RelayClient.test.ts +0 -779
  571. package/tests/relay/RelayEvent.test.ts +0 -463
  572. package/tests/relay/helpers.ts +0 -79
  573. package/tests/rest/HttpClient.test.ts +0 -274
  574. package/tests/rest/RestError.test.ts +0 -53
  575. package/tests/rest/calling.test.ts +0 -156
  576. package/tests/rest/client.test.ts +0 -197
  577. package/tests/rest/compat.test.ts +0 -335
  578. package/tests/rest/datasphere.test.ts +0 -71
  579. package/tests/rest/fabric.test.ts +0 -186
  580. package/tests/rest/helpers.ts +0 -95
  581. package/tests/rest/logs.test.ts +0 -68
  582. package/tests/rest/pagination.test.ts +0 -133
  583. package/tests/rest/registry.test.ts +0 -94
  584. package/tests/rest/relay-rest.test.ts +0 -290
  585. package/tests/rest/video.test.ts +0 -173
  586. package/tests/setup.ts +0 -6
  587. package/tests/skills/SkillBase.test.ts +0 -108
  588. package/tests/skills/SkillManager.test.ts +0 -268
  589. package/tests/skills/SkillRegistry.test.ts +0 -176
  590. package/tests/skills/builtin.test.ts +0 -1472
  591. package/tests/skills/claude-skills.test.ts +0 -54
  592. package/tests/skills/custom-skills.test.ts +0 -53
  593. package/tests/skills/datasphere-serverless.test.ts +0 -70
  594. package/tests/skills/datasphere.test.ts +0 -107
  595. package/tests/skills/datetime.test.ts +0 -101
  596. package/tests/skills/google-maps.test.ts +0 -78
  597. package/tests/skills/info-gatherer.test.ts +0 -411
  598. package/tests/skills/joke.test.ts +0 -81
  599. package/tests/skills/math.test.ts +0 -68
  600. package/tests/skills/mcp-gateway.test.ts +0 -101
  601. package/tests/skills/play-background.test.ts +0 -54
  602. package/tests/skills/spider.test.ts +0 -108
  603. package/tests/skills/swml-transfer.test.ts +0 -178
  604. package/tests/skills/trivia.test.ts +0 -54
  605. package/tests/skills/vector-search.test.ts +0 -135
  606. package/tests/skills/weather-api.test.ts +0 -77
  607. package/tests/skills/web-search-parity.test.ts +0 -59
  608. package/tests/skills/web-search.test.ts +0 -103
  609. package/tests/skills/wikipedia.test.ts +0 -63
  610. package/tsconfig.json +0 -18
  611. package/vitest.config.ts +0 -9
  612. /package/{src → dist}/schema.json +0 -0
@@ -1,1301 +0,0 @@
1
- # SignalWire AI Agents TypeScript SDK -- Complete API Reference
2
-
3
- This document provides a comprehensive reference for all public APIs in the SignalWire AI Agents TypeScript SDK.
4
-
5
- ---
6
-
7
- ## Table of Contents
8
-
9
- 1. [AgentBase Class](#agentbase-class)
10
- 2. [AgentServer Class](#agentserver-class)
11
- 3. [FunctionResult Class](#functionresult-class)
12
- 4. [SwaigFunction Class](#swaigfunction-class)
13
- 5. [DataMap Class](#datamap-class)
14
- 6. [Context System](#context-system)
15
- 7. [PomBuilder Class](#pombuilder-class)
16
- 8. [SessionManager Class](#sessionmanager-class)
17
- 9. [Skills System](#skills-system)
18
- 10. [Prefab Agents](#prefab-agents)
19
- 11. [Utility Classes](#utility-classes)
20
- 12. [Types and Interfaces](#types-and-interfaces)
21
-
22
- ---
23
-
24
- ## AgentBase Class
25
-
26
- ```typescript
27
- import { AgentBase } from '@signalwire/sdk';
28
- ```
29
-
30
- Core agent class that composes an HTTP server, prompt management, session handling, SWAIG tool registry, and 5-phase SWML rendering into a single deployable unit.
31
-
32
- ### Constructor
33
-
34
- ```typescript
35
- constructor(opts: AgentOptions)
36
- ```
37
-
38
- Creates a new agent. See [AgentOptions](#agentoptions) for the full options table.
39
-
40
- **Example:**
41
-
42
- ```typescript
43
- const agent = new AgentBase({ name: 'MyAgent', route: '/agent' });
44
- ```
45
-
46
- ### Static Properties
47
-
48
- #### `PROMPT_SECTIONS`
49
-
50
- ```typescript
51
- static PROMPT_SECTIONS?: { title: string; body?: string; bullets?: string[]; numbered?: boolean }[]
52
- ```
53
-
54
- Declarative prompt sections applied automatically by the constructor via `promptAddSection()`. Subclasses override this to define default prompt structure.
55
-
56
- ### Public Properties
57
-
58
- | Property | Type | Description |
59
- |----------|------|-------------|
60
- | `name` | `string` | Display name of this agent |
61
- | `route` | `string` | HTTP route path this agent listens on |
62
- | `host` | `string` | Hostname the HTTP server binds to |
63
- | `port` | `number` | Port number the HTTP server listens on |
64
- | `agentId` | `string` | Unique identifier for this agent instance |
65
-
66
- ### Prompt Methods
67
-
68
- #### `setPromptText(text)`
69
-
70
- ```typescript
71
- setPromptText(text: string): this
72
- ```
73
-
74
- Set the main system prompt text. Bypasses POM rendering when set.
75
-
76
- #### `setPostPrompt(text)`
77
-
78
- ```typescript
79
- setPostPrompt(text: string): this
80
- ```
81
-
82
- Set the post-prompt text evaluated after the call ends.
83
-
84
- #### `promptAddSection(title, opts?)`
85
-
86
- ```typescript
87
- promptAddSection(title: string, opts?: {
88
- body?: string;
89
- bullets?: string[];
90
- numbered?: boolean;
91
- numberedBullets?: boolean;
92
- subsections?: { title: string; body?: string; bullets?: string[] }[];
93
- }): this
94
- ```
95
-
96
- Add a new section to the POM prompt.
97
-
98
- #### `promptAddToSection(title, opts?)`
99
-
100
- ```typescript
101
- promptAddToSection(title: string, opts?: {
102
- body?: string;
103
- bullet?: string;
104
- bullets?: string[];
105
- }): this
106
- ```
107
-
108
- Append content to an existing prompt section.
109
-
110
- #### `promptAddSubsection(parentTitle, title, opts?)`
111
-
112
- ```typescript
113
- promptAddSubsection(parentTitle: string, title: string, opts?: {
114
- body?: string;
115
- bullets?: string[];
116
- }): this
117
- ```
118
-
119
- Add a subsection under an existing prompt section.
120
-
121
- #### `promptHasSection(title)`
122
-
123
- ```typescript
124
- promptHasSection(title: string): boolean
125
- ```
126
-
127
- Check whether a prompt section with the given title exists.
128
-
129
- #### `getPrompt()`
130
-
131
- ```typescript
132
- getPrompt(): string
133
- ```
134
-
135
- Get the fully rendered main prompt text.
136
-
137
- #### `getPostPrompt()`
138
-
139
- ```typescript
140
- getPostPrompt(): string | null
141
- ```
142
-
143
- Get the post-prompt text, or `null` if not configured.
144
-
145
- ### Tool Methods
146
-
147
- #### `defineTool(opts)`
148
-
149
- ```typescript
150
- defineTool(opts: {
151
- name: string;
152
- description: string;
153
- parameters?: Record<string, unknown>;
154
- handler: SwaigHandler;
155
- secure?: boolean;
156
- fillers?: Record<string, string[]>;
157
- waitFile?: string;
158
- waitFileLoops?: number;
159
- required?: string[];
160
- }): this
161
- ```
162
-
163
- Register a SWAIG tool the AI can invoke during a call.
164
-
165
- **Example:**
166
-
167
- ```typescript
168
- agent.defineTool({
169
- name: 'get_weather',
170
- description: 'Get current weather for a city',
171
- parameters: { city: { type: 'string', description: 'City name' } },
172
- handler: async (args) => new FunctionResult(`Weather in ${args.city}: sunny`),
173
- });
174
- ```
175
-
176
- #### `getRegisteredTools()`
177
-
178
- ```typescript
179
- getRegisteredTools(): { name: string; description: string; parameters: Record<string, unknown> }[]
180
- ```
181
-
182
- Get a summary of all registered tools.
183
-
184
- #### `getTool(name)`
185
-
186
- ```typescript
187
- getTool(name: string): SwaigFunction | undefined
188
- ```
189
-
190
- Look up a registered SwaigFunction by name.
191
-
192
- #### `registerSwaigFunction(fn)`
193
-
194
- ```typescript
195
- registerSwaigFunction(fn: SwaigFunction | Record<string, unknown>): this
196
- ```
197
-
198
- Register a pre-built SwaigFunction instance or a raw function descriptor (e.g., from DataMap).
199
-
200
- ### Speech and Language Methods
201
-
202
- #### `addHint(hint)`
203
-
204
- ```typescript
205
- addHint(hint: string): this
206
- ```
207
-
208
- Add a single speech recognition hint.
209
-
210
- #### `addHints(hints)`
211
-
212
- ```typescript
213
- addHints(hints: string[]): this
214
- ```
215
-
216
- Add multiple speech recognition hints.
217
-
218
- #### `addPatternHint(pattern)`
219
-
220
- ```typescript
221
- addPatternHint(pattern: { pattern: string; replace: string; ignoreCase?: boolean }): this
222
- ```
223
-
224
- Add a pattern-based hint for ASR post-processing.
225
-
226
- #### `addLanguage(config)`
227
-
228
- ```typescript
229
- addLanguage(config: LanguageConfig): this
230
- ```
231
-
232
- Add a supported language. See [LanguageConfig](#languageconfig).
233
-
234
- #### `setLanguages(configs)`
235
-
236
- ```typescript
237
- setLanguages(configs: LanguageConfig[]): this
238
- ```
239
-
240
- Replace all configured languages.
241
-
242
- #### `addPronunciation(rule)`
243
-
244
- ```typescript
245
- addPronunciation(rule: PronunciationRule): this
246
- ```
247
-
248
- Add a TTS pronunciation override rule.
249
-
250
- ### AI Configuration Methods
251
-
252
- #### `setParam(key, value)`
253
-
254
- ```typescript
255
- setParam(key: string, value: unknown): this
256
- ```
257
-
258
- Set a single AI parameter (e.g., `temperature`, `top_p`).
259
-
260
- #### `setParams(params)`
261
-
262
- ```typescript
263
- setParams(params: Record<string, unknown>): this
264
- ```
265
-
266
- Set multiple AI parameters at once.
267
-
268
- #### `setGlobalData(data)`
269
-
270
- ```typescript
271
- setGlobalData(data: Record<string, unknown>): this
272
- ```
273
-
274
- Replace the entire global data object.
275
-
276
- #### `updateGlobalData(data)`
277
-
278
- ```typescript
279
- updateGlobalData(data: Record<string, unknown>): this
280
- ```
281
-
282
- Merge entries into the existing global data.
283
-
284
- #### `addFunctionInclude(include)`
285
-
286
- ```typescript
287
- addFunctionInclude(include: FunctionInclude): this
288
- ```
289
-
290
- Add a remote SWAIG function include reference.
291
-
292
- #### `setNativeFunctions(functions)`
293
-
294
- ```typescript
295
- setNativeFunctions(functions: string[]): this
296
- ```
297
-
298
- Set the list of native function names.
299
-
300
- #### `setPromptLlmParams(params)`
301
-
302
- ```typescript
303
- setPromptLlmParams(params: Record<string, unknown>): this
304
- ```
305
-
306
- Set LLM parameters specific to the main prompt.
307
-
308
- #### `setPostPromptLlmParams(params)`
309
-
310
- ```typescript
311
- setPostPromptLlmParams(params: Record<string, unknown>): this
312
- ```
313
-
314
- Set LLM parameters specific to the post-prompt.
315
-
316
- #### `addFillers(fillers)`
317
-
318
- ```typescript
319
- addFillers(fillers: Record<string, string[]>): this
320
- ```
321
-
322
- Add internal filler phrases keyed by language code.
323
-
324
- #### `enableDebugEvents(level?)`
325
-
326
- ```typescript
327
- enableDebugEvents(level?: number): this
328
- ```
329
-
330
- Enable debug event webhooks. Level ranges from 1-3 (default: 1).
331
-
332
- ### Call Flow Methods
333
-
334
- #### `addPreAnswerVerb(verb, config)`
335
-
336
- ```typescript
337
- addPreAnswerVerb(verb: string, config: Record<string, unknown>): this
338
- ```
339
-
340
- Add a verb to Phase 1 (before answering).
341
-
342
- #### `addAnswerVerb(config?)`
343
-
344
- ```typescript
345
- addAnswerVerb(config?: Record<string, unknown>): this
346
- ```
347
-
348
- Set the answer verb configuration for Phase 2.
349
-
350
- #### `addPostAnswerVerb(verb, config)`
351
-
352
- ```typescript
353
- addPostAnswerVerb(verb: string, config: Record<string, unknown>): this
354
- ```
355
-
356
- Add a verb to Phase 3 (after answering, before AI).
357
-
358
- #### `addPostAiVerb(verb, config)`
359
-
360
- ```typescript
361
- addPostAiVerb(verb: string, config: Record<string, unknown>): this
362
- ```
363
-
364
- Add a verb to Phase 5 (after the AI session).
365
-
366
- #### `clearPreAnswerVerbs()`
367
-
368
- ```typescript
369
- clearPreAnswerVerbs(): this
370
- ```
371
-
372
- Remove all Phase 1 verbs.
373
-
374
- #### `clearPostAnswerVerbs()`
375
-
376
- ```typescript
377
- clearPostAnswerVerbs(): this
378
- ```
379
-
380
- Remove all Phase 3 verbs.
381
-
382
- #### `clearPostAiVerbs()`
383
-
384
- ```typescript
385
- clearPostAiVerbs(): this
386
- ```
387
-
388
- Remove all Phase 5 verbs.
389
-
390
- ### Context Methods
391
-
392
- #### `defineContexts(contexts?)`
393
-
394
- ```typescript
395
- defineContexts(contexts?: ContextBuilder | Record<string, unknown>): ContextBuilder
396
- ```
397
-
398
- Define or replace the contexts configuration. Returns the active `ContextBuilder`.
399
-
400
- ### Skill Methods
401
-
402
- #### `addSkill(skill)`
403
-
404
- ```typescript
405
- addSkill(skill: SkillBase): Promise<this>
406
- ```
407
-
408
- Add a skill to the agent. Validates environment variables, calls `setup()`, and registers all skill tools, hints, prompt sections, and global data.
409
-
410
- #### `removeSkill(name)`
411
-
412
- ```typescript
413
- removeSkill(name: string): this
414
- ```
415
-
416
- Remove a loaded skill by name.
417
-
418
- #### `listSkills()`
419
-
420
- ```typescript
421
- listSkills(): Array<{ name: string; version: string; description: string }>
422
- ```
423
-
424
- List metadata for all loaded skills.
425
-
426
- #### `hasSkill(name)`
427
-
428
- ```typescript
429
- hasSkill(name: string): boolean
430
- ```
431
-
432
- Check whether a skill is currently loaded.
433
-
434
- ### Dynamic Configuration Methods
435
-
436
- #### `setDynamicConfigCallback(callback)`
437
-
438
- ```typescript
439
- setDynamicConfigCallback(callback: DynamicConfigCallback): this
440
- ```
441
-
442
- Set a callback invoked on each SWML request with an ephemeral agent copy.
443
-
444
- #### `addSwaigQueryParams(params)`
445
-
446
- ```typescript
447
- addSwaigQueryParams(params: Record<string, string>): this
448
- ```
449
-
450
- Append custom query parameters to all SWAIG webhook URLs.
451
-
452
- ### URL and Proxy Methods
453
-
454
- #### `setWebHookUrl(url)`
455
-
456
- ```typescript
457
- setWebHookUrl(url: string): this
458
- ```
459
-
460
- Override the auto-generated SWAIG webhook URL.
461
-
462
- #### `setPostPromptUrl(url)`
463
-
464
- ```typescript
465
- setPostPromptUrl(url: string): this
466
- ```
467
-
468
- Override the auto-generated post-prompt webhook URL.
469
-
470
- #### `manualSetProxyUrl(url)`
471
-
472
- ```typescript
473
- manualSetProxyUrl(url: string): this
474
- ```
475
-
476
- Manually set the external proxy URL for webhook generation.
477
-
478
- #### `getFullUrl(includeAuth?)`
479
-
480
- ```typescript
481
- getFullUrl(includeAuth?: boolean): string
482
- ```
483
-
484
- Get the full URL including route, optionally with embedded auth credentials.
485
-
486
- ### Server Methods
487
-
488
- #### `serve(host?, port?)`
489
-
490
- ```typescript
491
- serve(host?: string, port?: number): Promise<void>
492
- ```
493
-
494
- Start the HTTP server. Alias: `run()`.
495
-
496
- #### `run(host?, port?)`
497
-
498
- ```typescript
499
- run(host?: string, port?: number): Promise<void>
500
- ```
501
-
502
- Start the HTTP server. Same as `serve()`.
503
-
504
- #### `getApp()`
505
-
506
- ```typescript
507
- getApp(): Hono
508
- ```
509
-
510
- Get the underlying Hono application instance. Useful for testing or custom middleware.
511
-
512
- ### Utility Methods
513
-
514
- #### `getBasicAuthCredentials(includeSource?)`
515
-
516
- ```typescript
517
- getBasicAuthCredentials(includeSource?: boolean):
518
- [string, string] | [string, string, 'provided' | 'environment' | 'generated']
519
- ```
520
-
521
- Get the current basic auth credentials and optionally the credential source.
522
-
523
- #### `renderSwml(callId?)`
524
-
525
- ```typescript
526
- renderSwml(callId?: string): string
527
- ```
528
-
529
- Render the complete SWML document as a JSON string.
530
-
531
- ### Protected Hooks
532
-
533
- These methods can be overridden in subclasses.
534
-
535
- #### `defineTools()`
536
-
537
- ```typescript
538
- protected defineTools(): void
539
- ```
540
-
541
- Called explicitly by the subclass constructor to register tools.
542
-
543
- #### `onSummary(summary, rawData)`
544
-
545
- ```typescript
546
- protected onSummary(
547
- summary: Record<string, unknown> | null,
548
- rawData: Record<string, unknown>,
549
- ): void | Promise<void>
550
- ```
551
-
552
- Called when a post-prompt summary is received.
553
-
554
- #### `onFunctionCall(name, args, rawData)`
555
-
556
- ```typescript
557
- protected onFunctionCall(
558
- name: string,
559
- args: Record<string, unknown>,
560
- rawData: Record<string, unknown>,
561
- ): void | Promise<void>
562
- ```
563
-
564
- Called before each SWAIG function handler executes.
565
-
566
- #### `onSwmlRequest(rawData)`
567
-
568
- ```typescript
569
- protected onSwmlRequest(
570
- rawData: Record<string, unknown>,
571
- ): void | Promise<void>
572
- ```
573
-
574
- Called on every SWML request before rendering.
575
-
576
- #### `onDebugEvent(event)`
577
-
578
- ```typescript
579
- protected onDebugEvent(
580
- event: Record<string, unknown>,
581
- ): void | Promise<void>
582
- ```
583
-
584
- Called when a debug event webhook is received.
585
-
586
- #### `validateBasicAuth(username, password)`
587
-
588
- ```typescript
589
- protected validateBasicAuth(
590
- username: string,
591
- password: string,
592
- ): boolean | Promise<boolean>
593
- ```
594
-
595
- Override to add custom auth validation logic.
596
-
597
- ---
598
-
599
- ## AgentServer Class
600
-
601
- ```typescript
602
- import { AgentServer } from '@signalwire/sdk';
603
- ```
604
-
605
- Hosts multiple `AgentBase` instances on a single HTTP server.
606
-
607
- ### Constructor
608
-
609
- ```typescript
610
- constructor(opts?: { host?: string; port?: number })
611
- ```
612
-
613
- ### Methods
614
-
615
- | Method | Signature | Description |
616
- |--------|-----------|-------------|
617
- | `register` | `register(agent: AgentBase, route?: string): void` | Mount an agent at a route. Throws if route is in use. |
618
- | `unregister` | `unregister(route: string): void` | Remove an agent by route. |
619
- | `getAgents` | `getAgents(): Map<string, AgentBase>` | All registered agents. |
620
- | `getAgent` | `getAgent(route: string): AgentBase \| undefined` | Look up agent by route. |
621
- | `getApp` | `getApp(): Hono` | The underlying Hono application. |
622
- | `run` | `run(host?: string, port?: number): Promise<void>` | Start the server. |
623
- | `registerSipUsername` | `registerSipUsername(username: string, route: string): void` | Map a SIP username to an agent route. |
624
-
625
- ---
626
-
627
- ## FunctionResult Class
628
-
629
- ```typescript
630
- import { FunctionResult } from '@signalwire/sdk';
631
- ```
632
-
633
- Fluent builder for SWAIG function responses.
634
-
635
- ### Constructor
636
-
637
- ```typescript
638
- constructor(response?: string, postProcess?: boolean)
639
- ```
640
-
641
- ### Core Methods
642
-
643
- | Method | Signature | Description |
644
- |--------|-----------|-------------|
645
- | `setResponse` | `(text: string): this` | Set response text. |
646
- | `setPostProcess` | `(val: boolean): this` | Enable/disable post-processing. |
647
- | `addAction` | `(name: string, data: unknown): this` | Append a named action. |
648
- | `addActions` | `(actions: Record<string, unknown>[]): this` | Append multiple actions. |
649
- | `toDict` | `(): Record<string, unknown>` | Serialize to wire format. |
650
-
651
- ### Call Control Actions
652
-
653
- | Method | Signature | Description |
654
- |--------|-----------|-------------|
655
- | `connect` | `(dest: string, final?: boolean, from?: string): this` | Transfer the call. |
656
- | `swmlTransfer` | `(swml: unknown): this` | Transfer via SWML document. |
657
- | `hangup` | `(): this` | Hang up the call. |
658
- | `hold` | `(timeout?: number): this` | Place call on hold (0-900s). |
659
- | `waitForUser` | `(opts?: Record<string, unknown>): this` | Wait for user input. |
660
- | `stop` | `(): this` | Stop the AI session. |
661
-
662
- ### Audio Actions
663
-
664
- | Method | Signature | Description |
665
- |--------|-----------|-------------|
666
- | `say` | `(text: string): this` | Speak text via TTS. |
667
- | `playBackgroundFile` | `(url: string, wait?: boolean): this` | Play background audio. |
668
- | `stopBackgroundFile` | `(): this` | Stop background audio. |
669
-
670
- ### Speech Actions
671
-
672
- | Method | Signature | Description |
673
- |--------|-----------|-------------|
674
- | `addDynamicHints` | `(hints: string[]): this` | Add runtime ASR hints. |
675
- | `clearDynamicHints` | `(): this` | Remove all dynamic hints. |
676
- | `setEndOfSpeechTimeout` | `(ms: number): this` | Set end-of-speech timeout. |
677
- | `setSpeechEventTimeout` | `(ms: number): this` | Set speech event timeout. |
678
-
679
- ### Data Actions
680
-
681
- | Method | Signature | Description |
682
- |--------|-----------|-------------|
683
- | `updateGlobalData` | `(data: Record<string, unknown>): this` | Merge into global data. |
684
- | `removeGlobalData` | `(keys: string[]): this` | Remove keys from global data. |
685
- | `setMetadata` | `(data: Record<string, unknown>): this` | Set call metadata. |
686
- | `removeMetadata` | `(keys: string[]): this` | Remove metadata keys. |
687
-
688
- ### SWML Actions
689
-
690
- | Method | Signature | Description |
691
- |--------|-----------|-------------|
692
- | `executeSwml` | `(swml: unknown, transfer?: boolean): this` | Execute SWML content. |
693
- | `switchContext` | `(opts: Record<string, unknown>): this` | Switch AI context. |
694
- | `swmlChangeStep` | `(step: string): this` | Navigate to a step. |
695
- | `swmlChangeContext` | `(context: string, step?: string): this` | Navigate to a context. |
696
- | `swmlUserEvent` | `(event: Record<string, unknown>): this` | Fire a user event. |
697
-
698
- ### Function Control Actions
699
-
700
- | Method | Signature | Description |
701
- |--------|-----------|-------------|
702
- | `toggleFunctions` | `(toggles: Record<string, boolean>): this` | Enable/disable functions. |
703
- | `enableFunctionsOnTimeout` | `(fns: string[], timeout: number): this` | Re-enable functions after timeout. |
704
- | `updateSettings` | `(settings: Record<string, unknown>): this` | Update AI settings. |
705
-
706
- ### Communication Actions
707
-
708
- | Method | Signature | Description |
709
- |--------|-----------|-------------|
710
- | `sendSms` | `(opts: Record<string, unknown>): this` | Send SMS/MMS. |
711
- | `recordCall` | `(opts?: Record<string, unknown>): this` | Start recording. |
712
- | `stopRecordCall` | `(): this` | Stop recording. |
713
- | `tap` | `(opts: Record<string, unknown>): this` | Start call tapping. |
714
- | `stopTap` | `(): this` | Stop call tapping. |
715
- | `sipRefer` | `(to: string): this` | SIP REFER transfer. |
716
-
717
- ### Room and Conference Actions
718
-
719
- | Method | Signature | Description |
720
- |--------|-----------|-------------|
721
- | `joinRoom` | `(opts: Record<string, unknown>): this` | Join a video room. |
722
- | `joinConference` | `(opts: Record<string, unknown>): this` | Join a conference. |
723
-
724
- ### RPC Actions
725
-
726
- | Method | Signature | Description |
727
- |--------|-----------|-------------|
728
- | `executeRpc` | `(method: string, params?: Record<string, unknown>): this` | Execute a JSON-RPC call. |
729
- | `rpcDial` | `(opts: Record<string, unknown>): this` | RPC-based dialing. |
730
- | `rpcAiMessage` | `(message: string): this` | Inject an AI message. |
731
- | `rpcAiUnhold` | `(): this` | Unhold via RPC. |
732
-
733
- ### Payment Actions
734
-
735
- | Method | Signature | Description |
736
- |--------|-----------|-------------|
737
- | `pay` | `(opts: Record<string, unknown>): this` | Initiate payment flow. |
738
-
739
- ### Static Helpers
740
-
741
- ```typescript
742
- static createPaymentPrompt(opts: PaymentPrompt): string
743
- static createPaymentAction(opts: PaymentAction): Record<string, unknown>
744
- static createPaymentParameter(opts: PaymentParameter): Record<string, unknown>
745
- ```
746
-
747
- ---
748
-
749
- ## SwaigFunction Class
750
-
751
- ```typescript
752
- import { SwaigFunction } from '@signalwire/sdk';
753
- ```
754
-
755
- Wraps a tool handler with metadata for SWAIG registration.
756
-
757
- ### Constructor
758
-
759
- ```typescript
760
- constructor(opts: SwaigFunctionOptions)
761
- ```
762
-
763
- ### Properties
764
-
765
- | Property | Type | Description |
766
- |----------|------|-------------|
767
- | `name` | `string` | Tool name. |
768
- | `handler` | `SwaigHandler` | The callback function. |
769
- | `description` | `string` | Description shown to the AI. |
770
- | `parameters` | `Record<string, unknown>` | JSON Schema for arguments. |
771
- | `secure` | `boolean` | Whether HMAC token is required. |
772
- | `fillers` | `Record<string, string[]>` | Per-language filler phrases. |
773
- | `waitFile` | `string` | Audio file URL to play while executing. |
774
- | `waitFileLoops` | `number` | Loop count for wait file. |
775
- | `required` | `string[]` | Required parameter names. |
776
-
777
- ### Methods
778
-
779
- | Method | Signature | Description |
780
- |--------|-----------|-------------|
781
- | `execute` | `(args: Record<string, unknown>, rawData: Record<string, unknown>): Promise<Record<string, unknown>>` | Invoke the handler and normalize the result. |
782
- | `toSwaig` | `(baseUrl: string, token?: string, callId?: string): Record<string, unknown>` | Serialize to SWAIG wire format for SWML. |
783
-
784
- ---
785
-
786
- ## DataMap Class
787
-
788
- ```typescript
789
- import { DataMap } from '@signalwire/sdk';
790
- ```
791
-
792
- Fluent builder for server-side SWAIG tools that execute on SignalWire without webhook callbacks.
793
-
794
- ### Constructor
795
-
796
- ```typescript
797
- constructor(functionName: string)
798
- ```
799
-
800
- ### Configuration Methods
801
-
802
- | Method | Signature | Description |
803
- |--------|-----------|-------------|
804
- | `purpose` | `(desc: string): this` | Set the tool description. |
805
- | `description` | `(desc: string): this` | Alias for `purpose()`. |
806
- | `parameter` | `(name: string, type: string, desc: string, opts?: { required?: boolean; enum?: string[] }): this` | Add a parameter. |
807
-
808
- ### Webhook Methods
809
-
810
- | Method | Signature | Description |
811
- |--------|-----------|-------------|
812
- | `webhook` | `(method: string, url: string, opts?: { headers?: Record<string, string> }): this` | Configure an HTTP webhook call. |
813
- | `body` | `(body: Record<string, unknown>): this` | Set the webhook request body. |
814
- | `params` | `(params: Record<string, string>): this` | Set webhook query parameters. |
815
- | `webhookExpressions` | `(expressions: Array<{ pattern: string; output: FunctionResult }>): this` | Add response-matching expressions. |
816
- | `foreach` | `(arrayPath: string, template: string): this` | Iterate over an array in the response. |
817
-
818
- ### Output Methods
819
-
820
- | Method | Signature | Description |
821
- |--------|-----------|-------------|
822
- | `output` | `(result: FunctionResult): this` | Set the success output template. |
823
- | `fallbackOutput` | `(result: FunctionResult): this` | Set the fallback output when webhooks fail. |
824
- | `errorKeys` | `(keys: string[]): this` | Keys that indicate an error in the response. |
825
- | `globalErrorKeys` | `(keys: string[]): this` | Global error indicator keys. |
826
-
827
- ### Expression Methods
828
-
829
- | Method | Signature | Description |
830
- |--------|-----------|-------------|
831
- | `expression` | `(testValue: string, pattern: string, output: FunctionResult): this` | Add a pattern-matching expression. |
832
-
833
- ### Environment and Registration
834
-
835
- | Method | Signature | Description |
836
- |--------|-----------|-------------|
837
- | `enableEnvExpansion` | `(): this` | Allow `${ENV.VAR}` expansion in templates. |
838
- | `registerWithAgent` | `(agent: AgentBase): void` | Register this DataMap tool with an agent. |
839
- | `toSwaigFunction` | `(): Record<string, unknown>` | Serialize to SWAIG wire format. |
840
-
841
- ### Factory Functions
842
-
843
- ```typescript
844
- import { createSimpleApiTool, createExpressionTool } from '@signalwire/sdk';
845
-
846
- const apiTool = createSimpleApiTool({
847
- name: 'get_joke',
848
- url: 'https://api.example.com/joke',
849
- responseTemplate: 'Here is a joke: ${joke}',
850
- });
851
-
852
- const exprTool = createExpressionTool({
853
- name: 'classify_input',
854
- testValue: '${args.input}',
855
- expressions: [
856
- { pattern: 'urgent|emergency', output: new FunctionResult('High priority') },
857
- { pattern: '.*', output: new FunctionResult('Normal priority') },
858
- ],
859
- });
860
- ```
861
-
862
- ---
863
-
864
- ## Context System
865
-
866
- ```typescript
867
- import { ContextBuilder, Context, Step, GatherInfo, GatherQuestion, createSimpleContext } from '@signalwire/sdk';
868
- ```
869
-
870
- ### ContextBuilder
871
-
872
- | Method | Signature | Description |
873
- |--------|-----------|-------------|
874
- | `addContext` | `(name: string): Context` | Create and return a new context. |
875
- | `getContext` | `(name: string): Context \| undefined` | Look up a context by name. |
876
- | `validate` | `(): void` | Validate all cross-references and rules. |
877
- | `toDict` | `(): Record<string, unknown>[]` | Serialize all contexts to SWML format. |
878
-
879
- ### Context
880
-
881
- | Method | Signature | Description |
882
- |--------|-----------|-------------|
883
- | `addStep` | `(name: string): Step` | Add a new step to this context. |
884
- | `getStep` | `(name: string): Step \| undefined` | Look up a step by name. |
885
- | `removeStep` | `(name: string): void` | Remove a step. |
886
- | `moveStep` | `(name: string, newIndex: number): void` | Reorder a step. |
887
- | `setPrompt` | `(text: string): this` | Set the context-level prompt. |
888
- | `setSystemPrompt` | `(text: string): this` | Set the system prompt for this context. |
889
- | `setFillers` | `(fillers: Record<string, string[]>): this` | Set filler phrases. |
890
- | `toDict` | `(): Record<string, unknown>` | Serialize to SWML format. |
891
-
892
- ### Step
893
-
894
- | Method | Signature | Description |
895
- |--------|-----------|-------------|
896
- | `setText` | `(text: string): this` | Set step prompt text. |
897
- | `addSection` | `(title: string, opts?: { body?: string; bullets?: string[] }): this` | Add a POM section. |
898
- | `setCriteria` | `(criteria: string): this` | Set completion criteria. |
899
- | `setFunctions` | `(fns: string[]): this` | Restrict available functions. |
900
- | `setValidSteps` | `(steps: string[]): this` | Set allowed next steps. |
901
- | `setValidContexts` | `(contexts: string[]): this` | Set allowed next contexts. |
902
- | `setEnd` | `(end: boolean): this` | Mark as an end state. |
903
- | `setGatherInfo` | `(info: GatherInfo): this` | Attach structured data collection. |
904
- | `setResetOnEntry` | `(reset: boolean): this` | Reset step state on re-entry. |
905
- | `setFillers` | `(fillers: Record<string, string[]>): this` | Set step-level fillers. |
906
- | `toDict` | `(): Record<string, unknown>` | Serialize to SWML format. |
907
-
908
- ### GatherInfo / GatherQuestion
909
-
910
- ```typescript
911
- const gather = new GatherInfo()
912
- .addQuestion(
913
- new GatherQuestion('name')
914
- .setQuestion('What is your name?')
915
- .setDescription('Customer full name')
916
- )
917
- .addQuestion(
918
- new GatherQuestion('email')
919
- .setQuestion('What is your email address?')
920
- .setDescription('Customer email')
921
- .setValidation('^[^@]+@[^@]+$')
922
- );
923
-
924
- step.setGatherInfo(gather);
925
- ```
926
-
927
- ### createSimpleContext
928
-
929
- ```typescript
930
- const cb = createSimpleContext({
931
- name: 'default',
932
- steps: [
933
- { name: 'greeting', text: 'Welcome! How can I help?' },
934
- { name: 'resolve', text: 'I will resolve your issue.', end: true },
935
- ],
936
- });
937
- ```
938
-
939
- ---
940
-
941
- ## PomBuilder Class
942
-
943
- ```typescript
944
- import { PomBuilder, PomSection } from '@signalwire/sdk';
945
- ```
946
-
947
- Builds structured Markdown prompts from titled sections.
948
-
949
- ### PomBuilder Methods
950
-
951
- | Method | Signature | Description |
952
- |--------|-----------|-------------|
953
- | `addSection` | `(title: string, opts?: PomSectionData): void` | Add a top-level section. |
954
- | `addToSection` | `(title: string, opts?: { body?: string; bullet?: string; bullets?: string[] }): void` | Append to a section. |
955
- | `addSubsection` | `(parentTitle: string, title: string, opts?: { body?: string; bullets?: string[] }): void` | Add a nested subsection. |
956
- | `hasSection` | `(title: string): boolean` | Check for a section. |
957
- | `renderMarkdown` | `(): string` | Render all sections as Markdown. |
958
-
959
- ---
960
-
961
- ## SessionManager Class
962
-
963
- ```typescript
964
- import { SessionManager } from '@signalwire/sdk';
965
- ```
966
-
967
- Stateless HMAC-SHA256 token manager for secure tool invocations.
968
-
969
- ### Constructor
970
-
971
- ```typescript
972
- constructor(tokenExpirySecs?: number)
973
- ```
974
-
975
- ### Methods
976
-
977
- | Method | Signature | Description |
978
- |--------|-----------|-------------|
979
- | `generateToken` | `(functionName: string, callId: string): string` | Generate a base64url-encoded HMAC token. |
980
- | `validateToken` | `(callId: string, functionName: string, token: string): boolean` | Validate a token's signature, expiry, and bindings. |
981
- | `debugToken` | `(token: string): Record<string, unknown>` | Decode a token without validation (for debugging). |
982
- | `setSessionMetadata` | `(sessionId: string, metadata: Record<string, unknown>): void` | Store per-session metadata. |
983
- | `getSessionMetadata` | `(sessionId: string): Record<string, unknown> \| undefined` | Retrieve session metadata. |
984
- | `deleteSessionMetadata` | `(sessionId: string): boolean` | Remove session metadata. |
985
-
986
- ---
987
-
988
- ## Skills System
989
-
990
- ```typescript
991
- import { SkillBase, SkillManager, SkillRegistry } from '@signalwire/sdk';
992
- ```
993
-
994
- ### SkillBase
995
-
996
- Abstract base class for skills. Key methods:
997
-
998
- | Method | Returns | Description |
999
- |--------|---------|-------------|
1000
- | `registerTools()` | `SkillToolRegistration[]` | Define the tools this skill provides. |
1001
- | `getHints()` | `string[]` | Speech recognition hints. |
1002
- | `getPromptSections()` | Section array | Prompt sections for the agent. |
1003
- | `getGlobalData()` | `Record<string, unknown>` | Global data to merge. |
1004
- | `setup()` | `Promise<void>` | Async initialization. |
1005
- | `teardown()` | `Promise<void>` | Cleanup on shutdown. |
1006
-
1007
- ### SkillRegistry
1008
-
1009
- | Method | Signature | Description |
1010
- |--------|-----------|-------------|
1011
- | `register` | `(name: string, factory: SkillFactory): void` | Register a skill factory. |
1012
- | `listSkills` | `(): SkillSchemaInfo[]` | List all registered skills. |
1013
- | `getParameterSchema` | `(name: string): Record<string, ParameterSchemaEntry>` | Get a skill's config schema. |
1014
-
1015
- ### Built-in Skills
1016
-
1017
- | Skill | Tool(s) | Required Env Vars |
1018
- |-------|---------|-------------------|
1019
- | `DateTimeSkill` | `get_current_time`, `get_current_date` | -- |
1020
- | `MathSkill` | `calculate` | -- |
1021
- | `JokeSkill` | `tell_joke` | -- |
1022
- | `WeatherApiSkill` | `get_weather` | `WEATHER_API_KEY` |
1023
- | `WebSearchSkill` | `web_search` | `GOOGLE_SEARCH_API_KEY`, `GOOGLE_SEARCH_ENGINE_ID` |
1024
- | `WikipediaSearchSkill` | `search_wiki` | -- |
1025
- | `GoogleMapsSkill` | `lookup_address`, `compute_route` | `GOOGLE_MAPS_API_KEY` |
1026
- | `SpiderSkill` | `scrape_url` | -- |
1027
- | `DataSphereSkill` | `search_datasphere` | `SIGNALWIRE_PROJECT_ID`, `SIGNALWIRE_TOKEN` |
1028
- | `DataSphereServerlessSkill` | `search_datasphere` | `SIGNALWIRE_PROJECT_ID`, `SIGNALWIRE_TOKEN` |
1029
- | `SwmlTransferSkill` | `transfer_call` | -- |
1030
- | `PlayBackgroundFileSkill` | `play_background_file`, `stop_background_file` | -- |
1031
- | `ApiNinjasTriviaSkill` | `get_trivia` | `API_NINJAS_KEY` |
1032
- | `NativeVectorSearchSkill` | `search_knowledge` | -- |
1033
- | `InfoGathererSkill` | `start_questions`, `submit_answer` | -- |
1034
- | `ClaudeSkillsSkill` | *(from SKILL.md)* | -- |
1035
- | `McpGatewaySkill` | *(MCP bridge)* | -- |
1036
- | `CustomSkillsSkill` | *(from config)* | -- |
1037
-
1038
- ---
1039
-
1040
- ## Prefab Agents
1041
-
1042
- ```typescript
1043
- import {
1044
- InfoGathererAgent, SurveyAgent, FAQBotAgent,
1045
- ConciergeAgent, ReceptionistAgent,
1046
- } from '@signalwire/sdk';
1047
- ```
1048
-
1049
- ### InfoGathererAgent
1050
-
1051
- ```typescript
1052
- const agent = new InfoGathererAgent({
1053
- name: 'info-gatherer',
1054
- questions: [
1055
- { key_name: 'name', question_text: 'What is your name?' },
1056
- { key_name: 'email', question_text: 'What is your email?', confirm: true },
1057
- ],
1058
- });
1059
- ```
1060
-
1061
- ### SurveyAgent
1062
-
1063
- ```typescript
1064
- const agent = new SurveyAgent({
1065
- name: 'survey',
1066
- questions: [
1067
- { text: 'Rate our service 1-10', field: 'rating', type: 'number', min: 1, max: 10 },
1068
- ],
1069
- });
1070
- ```
1071
-
1072
- ### FAQBotAgent
1073
-
1074
- ```typescript
1075
- const agent = new FAQBotAgent({
1076
- name: 'faq',
1077
- faqs: [
1078
- { question: 'What are your hours?', answer: 'We are open 9am-5pm EST.' },
1079
- { question: 'How do I return an item?', answer: 'Visit our returns page.' },
1080
- ],
1081
- });
1082
- ```
1083
-
1084
- ### ConciergeAgent
1085
-
1086
- ```typescript
1087
- const agent = new ConciergeAgent({
1088
- name: 'concierge',
1089
- venueName: 'Grand Hotel',
1090
- services: ['room service', 'spa', 'restaurant reservations'],
1091
- amenities: {
1092
- pool: { hours: '7 AM - 10 PM', location: '2nd Floor' },
1093
- gym: { hours: '24 hours', location: '3rd Floor' },
1094
- },
1095
- });
1096
- ```
1097
-
1098
- ### ReceptionistAgent
1099
-
1100
- ```typescript
1101
- const agent = new ReceptionistAgent({
1102
- name: 'receptionist',
1103
- departments: [
1104
- { name: 'Sales', number: '+15551001000' },
1105
- { name: 'Support', number: '+15551002000' },
1106
- ],
1107
- });
1108
- ```
1109
-
1110
- ---
1111
-
1112
- ## Utility Classes
1113
-
1114
- ### AuthHandler
1115
-
1116
- ```typescript
1117
- import { AuthHandler } from '@signalwire/sdk';
1118
-
1119
- const auth = new AuthHandler({
1120
- bearerToken: 'my-token',
1121
- apiKey: 'my-api-key',
1122
- basicAuth: ['admin', 'password'],
1123
- customValidator: async (req) => req.headers['x-internal'] === 'trusted',
1124
- });
1125
- ```
1126
-
1127
- ### ConfigLoader
1128
-
1129
- ```typescript
1130
- import { ConfigLoader } from '@signalwire/sdk';
1131
-
1132
- const config = ConfigLoader.load('agent-config.json');
1133
- ```
1134
-
1135
- ### Logger
1136
-
1137
- ```typescript
1138
- import { getLogger, setGlobalLogLevel } from '@signalwire/sdk';
1139
-
1140
- setGlobalLogLevel('debug');
1141
- const log = getLogger('MyComponent');
1142
- log.info('Hello');
1143
- log.debug('Debug info');
1144
- log.warn('Warning');
1145
- log.error('Error occurred');
1146
- ```
1147
-
1148
- ### SslConfig
1149
-
1150
- ```typescript
1151
- import { SslConfig } from '@signalwire/sdk';
1152
-
1153
- const ssl = new SslConfig({
1154
- enabled: true,
1155
- certPath: '/etc/ssl/certs/agent.pem',
1156
- keyPath: '/etc/ssl/private/agent-key.pem',
1157
- domain: 'agent.example.com',
1158
- });
1159
- ```
1160
-
1161
- ### ServerlessAdapter
1162
-
1163
- ```typescript
1164
- import { ServerlessAdapter } from '@signalwire/sdk';
1165
-
1166
- const adapter = new ServerlessAdapter(agent);
1167
- // AWS Lambda
1168
- export const handler = adapter.toLambdaHandler();
1169
- // Google Cloud Functions
1170
- export const handler = adapter.toGcfHandler();
1171
- ```
1172
-
1173
- ---
1174
-
1175
- ## Types and Interfaces
1176
-
1177
- ### AgentOptions
1178
-
1179
- ```typescript
1180
- interface AgentOptions {
1181
- name: string;
1182
- route?: string; // default: "/"
1183
- host?: string; // default: "0.0.0.0"
1184
- port?: number; // default: env PORT or 3000
1185
- basicAuth?: [string, string];
1186
- usePom?: boolean; // default: true
1187
- tokenExpirySecs?: number; // default: 3600
1188
- autoAnswer?: boolean; // default: true
1189
- recordCall?: boolean; // default: false
1190
- recordFormat?: string; // default: "mp4"
1191
- recordStereo?: boolean; // default: true
1192
- defaultWebhookUrl?: string;
1193
- nativeFunctions?: string[];
1194
- agentId?: string;
1195
- suppressLogs?: boolean; // default: false
1196
- }
1197
- ```
1198
-
1199
- ### LanguageConfig
1200
-
1201
- ```typescript
1202
- interface LanguageConfig {
1203
- name: string;
1204
- code: string;
1205
- voice?: string;
1206
- engine?: string;
1207
- fillers?: Record<string, string[]>;
1208
- speechModel?: string;
1209
- functionFillers?: Record<string, Record<string, string[]>>;
1210
- }
1211
- ```
1212
-
1213
- ### PronunciationRule
1214
-
1215
- ```typescript
1216
- interface PronunciationRule {
1217
- replace: string;
1218
- with: string;
1219
- ignoreCase?: boolean;
1220
- }
1221
- ```
1222
-
1223
- ### FunctionInclude
1224
-
1225
- ```typescript
1226
- interface FunctionInclude {
1227
- url: string;
1228
- functions: string[];
1229
- meta_data?: Record<string, unknown>;
1230
- }
1231
- ```
1232
-
1233
- ### DynamicConfigCallback
1234
-
1235
- ```typescript
1236
- type DynamicConfigCallback = (
1237
- queryParams: Record<string, string>,
1238
- bodyParams: Record<string, unknown>,
1239
- headers: Record<string, string>,
1240
- agent: unknown,
1241
- ) => void | Promise<void>;
1242
- ```
1243
-
1244
- ### SummaryCallback
1245
-
1246
- ```typescript
1247
- type SummaryCallback = (
1248
- summary: Record<string, unknown> | null,
1249
- rawData: Record<string, unknown>,
1250
- ) => void | Promise<void>;
1251
- ```
1252
-
1253
- ### SwaigHandler
1254
-
1255
- ```typescript
1256
- type SwaigHandler = (
1257
- args: Record<string, unknown>,
1258
- rawData: Record<string, unknown>,
1259
- ) => FunctionResult | Record<string, unknown> | string
1260
- | Promise<FunctionResult | Record<string, unknown> | string>;
1261
- ```
1262
-
1263
- ### SwaigFunctionOptions
1264
-
1265
- ```typescript
1266
- interface SwaigFunctionOptions {
1267
- name: string;
1268
- description: string;
1269
- handler: SwaigHandler;
1270
- parameters?: Record<string, unknown>;
1271
- secure?: boolean;
1272
- fillers?: Record<string, string[]>;
1273
- waitFile?: string;
1274
- waitFileLoops?: number;
1275
- required?: string[];
1276
- }
1277
- ```
1278
-
1279
- ### AuthConfig
1280
-
1281
- ```typescript
1282
- interface AuthConfig {
1283
- bearerToken?: string;
1284
- apiKey?: string;
1285
- basicAuth?: [string, string];
1286
- customValidator?: (req: unknown) => boolean | Promise<boolean>;
1287
- }
1288
- ```
1289
-
1290
- ### SslOptions
1291
-
1292
- ```typescript
1293
- interface SslOptions {
1294
- enabled?: boolean;
1295
- certPath?: string;
1296
- keyPath?: string;
1297
- domain?: string;
1298
- hsts?: boolean; // default: true
1299
- hstsMaxAge?: number; // default: 31536000
1300
- }
1301
- ```