@signalwire/sdk 2.0.4 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +785 -0
- package/LICENSE +21 -0
- package/README.md +163 -68
- package/dist/AGENTS.md +13 -0
- package/dist/AgentBase.d.ts +550 -163
- package/dist/AgentBase.js +1640 -514
- package/dist/AgentBase.js.map +1 -1
- package/dist/AgentServer.d.ts +21 -0
- package/dist/AgentServer.js +154 -47
- package/dist/AgentServer.js.map +1 -1
- package/dist/AuthHandler.d.ts +14 -2
- package/dist/AuthHandler.js +7 -2
- package/dist/AuthHandler.js.map +1 -1
- package/dist/ConfigLoader.d.ts +5 -13
- package/dist/ConfigLoader.js +15 -29
- package/dist/ConfigLoader.js.map +1 -1
- package/dist/ContextBuilder.d.ts +202 -9
- package/dist/ContextBuilder.js +219 -36
- package/dist/ContextBuilder.js.map +1 -1
- package/dist/DataMap.d.ts +158 -45
- package/dist/DataMap.js +167 -52
- package/dist/DataMap.js.map +1 -1
- package/dist/FunctionResult.d.ts +277 -83
- package/dist/FunctionResult.js +444 -116
- package/dist/FunctionResult.js.map +1 -1
- package/dist/Logger.d.ts +30 -5
- package/dist/Logger.js +77 -19
- package/dist/Logger.js.map +1 -1
- package/dist/POM/PromptObjectModel.d.ts +163 -0
- package/dist/POM/PromptObjectModel.js +481 -0
- package/dist/POM/PromptObjectModel.js.map +1 -0
- package/dist/ParameterSchema.d.ts +306 -0
- package/dist/ParameterSchema.js +251 -0
- package/dist/ParameterSchema.js.map +1 -0
- package/dist/PlatformContracts.d.ts +21 -0
- package/dist/PlatformContracts.generated.d.ts +109 -0
- package/dist/PlatformContracts.generated.js +8 -0
- package/dist/PlatformContracts.generated.js.map +1 -0
- package/dist/PlatformContracts.js +2 -0
- package/dist/PlatformContracts.js.map +1 -0
- package/dist/PomBuilder.d.ts +28 -0
- package/dist/PomBuilder.js +81 -3
- package/dist/PomBuilder.js.map +1 -1
- package/dist/PostPrompt.d.ts +110 -0
- package/dist/PostPrompt.js +204 -0
- package/dist/PostPrompt.js.map +1 -0
- package/dist/PromptManager.d.ts +29 -1
- package/dist/PromptManager.js +37 -1
- package/dist/PromptManager.js.map +1 -1
- package/dist/PublicFetch.d.ts +132 -0
- package/dist/PublicFetch.js +311 -0
- package/dist/PublicFetch.js.map +1 -0
- package/dist/RobotsTxt.d.ts +41 -0
- package/dist/RobotsTxt.js +152 -0
- package/dist/RobotsTxt.js.map +1 -0
- package/dist/SWMLHandler.js.map +1 -1
- package/dist/SWMLService.d.ts +265 -66
- package/dist/SWMLService.js +652 -112
- package/dist/SWMLService.js.map +1 -1
- package/dist/SchemaUtils.d.ts +115 -2
- package/dist/SchemaUtils.js +444 -12
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/SecurityUtils.d.ts +55 -8
- package/dist/SecurityUtils.js +162 -49
- package/dist/SecurityUtils.js.map +1 -1
- package/dist/ServerlessAdapter.d.ts +156 -7
- package/dist/ServerlessAdapter.js +399 -42
- package/dist/ServerlessAdapter.js.map +1 -1
- package/dist/SessionManager.d.ts +11 -2
- package/dist/SessionManager.js +50 -18
- package/dist/SessionManager.js.map +1 -1
- package/dist/SslConfig.d.ts +2 -1
- package/dist/SslConfig.js +4 -1
- package/dist/SslConfig.js.map +1 -1
- package/dist/SwaigActions.generated.d.ts +23 -0
- package/dist/SwaigActions.generated.js +8 -0
- package/dist/SwaigActions.generated.js.map +1 -0
- package/dist/SwaigContracts.d.ts +15 -0
- package/dist/SwaigContracts.generated.d.ts +264 -0
- package/dist/SwaigContracts.generated.js +12 -0
- package/dist/SwaigContracts.generated.js.map +1 -0
- package/dist/SwaigContracts.js +2 -0
- package/dist/SwaigContracts.js.map +1 -0
- package/dist/SwaigFunction.d.ts +110 -4
- package/dist/SwaigFunction.js +151 -19
- package/dist/SwaigFunction.js.map +1 -1
- package/dist/SwmlBuilder.d.ts +68 -19
- package/dist/SwmlBuilder.js +74 -38
- package/dist/SwmlBuilder.js.map +1 -1
- package/dist/SwmlVerbMethods.generated.d.ts +41 -4
- package/dist/SwmlVerbMethods.generated.js +1 -1
- package/dist/TypeInference.d.ts +39 -3
- package/dist/TypeInference.js +256 -16
- package/dist/TypeInference.js.map +1 -1
- package/dist/WebService.d.ts +79 -11
- package/dist/WebService.js +320 -109
- package/dist/WebService.js.map +1 -1
- package/dist/WebhookMiddleware.d.ts +119 -0
- package/dist/WebhookMiddleware.js +271 -0
- package/dist/WebhookMiddleware.js.map +1 -0
- package/dist/WebhookValidator.d.ts +92 -0
- package/dist/WebhookValidator.js +409 -0
- package/dist/WebhookValidator.js.map +1 -0
- package/dist/agents/BedrockAgent.d.ts +162 -0
- package/dist/agents/BedrockAgent.js +323 -0
- package/dist/agents/BedrockAgent.js.map +1 -0
- package/dist/ai-chat/AIChatClient.d.ts +316 -0
- package/dist/ai-chat/AIChatClient.js +535 -0
- package/dist/ai-chat/AIChatClient.js.map +1 -0
- package/dist/ai-chat/ChatGateway.d.ts +408 -0
- package/dist/ai-chat/ChatGateway.js +747 -0
- package/dist/ai-chat/ChatGateway.js.map +1 -0
- package/dist/ai-chat/HandoffRouter.d.ts +282 -0
- package/dist/ai-chat/HandoffRouter.js +518 -0
- package/dist/ai-chat/HandoffRouter.js.map +1 -0
- package/dist/ai-chat/index.d.ts +12 -0
- package/dist/ai-chat/index.js +10 -0
- package/dist/ai-chat/index.js.map +1 -0
- package/dist/capabilities.d.ts +64 -0
- package/dist/capabilities.js +95 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/cli/agent-loader.d.ts +32 -6
- package/dist/cli/agent-loader.js +95 -34
- package/dist/cli/agent-loader.js.map +1 -1
- package/dist/cli/datamap-exec.d.ts +175 -0
- package/dist/cli/datamap-exec.js +1284 -0
- package/dist/cli/datamap-exec.js.map +1 -0
- package/dist/cli/function-args.d.ts +40 -0
- package/dist/cli/function-args.js +146 -0
- package/dist/cli/function-args.js.map +1 -0
- package/dist/cli/simulation.d.ts +99 -0
- package/dist/cli/simulation.js +490 -0
- package/dist/cli/simulation.js.map +1 -0
- package/dist/cli/swaig-test.d.ts +12 -25
- package/dist/cli/swaig-test.js +935 -367
- package/dist/cli/swaig-test.js.map +1 -1
- package/dist/cli/tsdocs/agentsNote.d.ts +30 -0
- package/dist/cli/tsdocs/agentsNote.js +92 -0
- package/dist/cli/tsdocs/agentsNote.js.map +1 -0
- package/dist/cli/tsdocs/api-index.json +1 -0
- package/dist/cli/tsdocs/api.d.ts +91 -0
- package/dist/cli/tsdocs/api.js +372 -0
- package/dist/cli/tsdocs/api.js.map +1 -0
- package/dist/cli/tsdocs/apiTypes.d.ts +64 -0
- package/dist/cli/tsdocs/apiTypes.js +7 -0
- package/dist/cli/tsdocs/apiTypes.js.map +1 -0
- package/dist/cli/tsdocs/bin.d.ts +6 -0
- package/dist/cli/tsdocs/bin.js +23 -0
- package/dist/cli/tsdocs/bin.js.map +1 -0
- package/dist/cli/tsdocs/files.d.ts +108 -0
- package/dist/cli/tsdocs/files.js +287 -0
- package/dist/cli/tsdocs/files.js.map +1 -0
- package/dist/cli/tsdocs/index.d.ts +28 -0
- package/dist/cli/tsdocs/index.js +307 -0
- package/dist/cli/tsdocs/index.js.map +1 -0
- package/dist/cli/tsdocs/live.d.ts +41 -0
- package/dist/cli/tsdocs/live.js +202 -0
- package/dist/cli/tsdocs/live.js.map +1 -0
- package/dist/cli/tsdocs/locate.d.ts +51 -0
- package/dist/cli/tsdocs/locate.js +75 -0
- package/dist/cli/tsdocs/locate.js.map +1 -0
- package/dist/cli/tsdocs/render.d.ts +75 -0
- package/dist/cli/tsdocs/render.js +323 -0
- package/dist/cli/tsdocs/render.js.map +1 -0
- package/dist/cli/tsdocs/topics.d.ts +43 -0
- package/dist/cli/tsdocs/topics.js +916 -0
- package/dist/cli/tsdocs/topics.js.map +1 -0
- package/dist/index.d.ts +102 -39
- package/dist/index.js +107 -30
- package/dist/index.js.map +1 -1
- package/dist/livewire/index.d.ts +229 -155
- package/dist/livewire/index.js +298 -195
- package/dist/livewire/index.js.map +1 -1
- package/dist/llms.txt +65 -0
- package/dist/prefabs/CallSessionStore.d.ts +52 -0
- package/dist/prefabs/CallSessionStore.js +72 -0
- package/dist/prefabs/CallSessionStore.js.map +1 -0
- package/dist/prefabs/ConciergeAgent.d.ts +13 -1
- package/dist/prefabs/ConciergeAgent.js +36 -31
- package/dist/prefabs/ConciergeAgent.js.map +1 -1
- package/dist/prefabs/FAQBotAgent.d.ts +9 -1
- package/dist/prefabs/FAQBotAgent.js +113 -47
- package/dist/prefabs/FAQBotAgent.js.map +1 -1
- package/dist/prefabs/InfoGathererAgent.d.ts +22 -3
- package/dist/prefabs/InfoGathererAgent.js +67 -58
- package/dist/prefabs/InfoGathererAgent.js.map +1 -1
- package/dist/prefabs/ReceptionistAgent.d.ts +16 -5
- package/dist/prefabs/ReceptionistAgent.js +39 -31
- package/dist/prefabs/ReceptionistAgent.js.map +1 -1
- package/dist/prefabs/SurveyAgent.d.ts +22 -4
- package/dist/prefabs/SurveyAgent.js +84 -68
- package/dist/prefabs/SurveyAgent.js.map +1 -1
- package/dist/relay/Action.d.ts +44 -21
- package/dist/relay/Action.js +75 -17
- package/dist/relay/Action.js.map +1 -1
- package/dist/relay/Call.d.ts +312 -47
- package/dist/relay/Call.js +369 -18
- package/dist/relay/Call.js.map +1 -1
- package/dist/relay/Deferred.js.map +1 -1
- package/dist/relay/Message.d.ts +26 -5
- package/dist/relay/Message.js +36 -6
- package/dist/relay/Message.js.map +1 -1
- package/dist/relay/RelayClient.d.ts +79 -14
- package/dist/relay/RelayClient.js +268 -61
- package/dist/relay/RelayClient.js.map +1 -1
- package/dist/relay/RelayError.d.ts +14 -0
- package/dist/relay/RelayError.js +15 -0
- package/dist/relay/RelayError.js.map +1 -1
- package/dist/relay/RelayEvent.d.ts +96 -65
- package/dist/relay/RelayEvent.js +85 -56
- package/dist/relay/RelayEvent.js.map +1 -1
- package/dist/relay/closedSets.d.ts +111 -0
- package/dist/relay/closedSets.js +83 -0
- package/dist/relay/closedSets.js.map +1 -0
- package/dist/relay/index.d.ts +3 -1
- package/dist/relay/index.js +1 -0
- package/dist/relay/index.js.map +1 -1
- package/dist/relay/normalize.js.map +1 -1
- package/dist/relay/protocol.types.generated.d.ts +1195 -0
- package/dist/relay/protocol.types.generated.js +8 -0
- package/dist/relay/protocol.types.generated.js.map +1 -0
- package/dist/relay/types.d.ts +81 -39
- package/dist/rest/HttpClient.d.ts +36 -8
- package/dist/rest/HttpClient.js +233 -40
- package/dist/rest/HttpClient.js.map +1 -1
- package/dist/rest/RequestOptions.d.ts +110 -0
- package/dist/rest/RequestOptions.js +113 -0
- package/dist/rest/RequestOptions.js.map +1 -0
- package/dist/rest/RestError.d.ts +52 -6
- package/dist/rest/RestError.js +89 -5
- package/dist/rest/RestError.js.map +1 -1
- package/dist/rest/base/CrudResource.d.ts +16 -26
- package/dist/rest/base/CrudResource.js +19 -33
- package/dist/rest/base/CrudResource.js.map +1 -1
- package/dist/rest/base/CrudWithAddresses.d.ts +3 -2
- package/dist/rest/base/CrudWithAddresses.js +2 -2
- package/dist/rest/base/CrudWithAddresses.js.map +1 -1
- package/dist/rest/base/FabricResource.d.ts +15 -0
- package/dist/rest/base/FabricResource.js +16 -0
- package/dist/rest/base/FabricResource.js.map +1 -0
- package/dist/rest/base/ReadResource.d.ts +62 -0
- package/dist/rest/base/ReadResource.js +69 -0
- package/dist/rest/base/ReadResource.js.map +1 -0
- package/dist/rest/callHandler.d.ts +63 -0
- package/dist/rest/callHandler.js +62 -0
- package/dist/rest/callHandler.js.map +1 -0
- package/dist/rest/index.d.ts +19 -76
- package/dist/rest/index.js +49 -120
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/namespaces/_client_tree_generated.d.ts +103 -0
- package/dist/rest/namespaces/_client_tree_generated.js +171 -0
- package/dist/rest/namespaces/_client_tree_generated.js.map +1 -0
- package/dist/rest/namespaces/addresses.d.ts +3 -42
- package/dist/rest/namespaces/addresses.js +3 -50
- package/dist/rest/namespaces/addresses.js.map +1 -1
- package/dist/rest/namespaces/calling.d.ts +6 -378
- package/dist/rest/namespaces/calling.js +6 -473
- package/dist/rest/namespaces/calling.js.map +1 -1
- package/dist/rest/namespaces/calling.resources.generated.d.ts +165 -0
- package/dist/rest/namespaces/calling.resources.generated.js +477 -0
- package/dist/rest/namespaces/calling.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/calling.types.generated.d.ts +2917 -0
- package/dist/rest/namespaces/calling.types.generated.js +8 -0
- package/dist/rest/namespaces/calling.types.generated.js.map +1 -0
- package/dist/rest/namespaces/chat.d.ts +4 -18
- package/dist/rest/namespaces/chat.js +4 -21
- package/dist/rest/namespaces/chat.js.map +1 -1
- package/dist/rest/namespaces/chat.resources.generated.d.ts +12 -0
- package/dist/rest/namespaces/chat.resources.generated.js +29 -0
- package/dist/rest/namespaces/chat.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/chat.types.generated.d.ts +56 -0
- package/dist/rest/namespaces/chat.types.generated.js +8 -0
- package/dist/rest/namespaces/chat.types.generated.js.map +1 -0
- package/dist/rest/namespaces/datasphere.d.ts +6 -62
- package/dist/rest/namespaces/datasphere.js +6 -72
- package/dist/rest/namespaces/datasphere.js.map +1 -1
- package/dist/rest/namespaces/datasphere.resources.generated.d.ts +25 -0
- package/dist/rest/namespaces/datasphere.resources.generated.js +50 -0
- package/dist/rest/namespaces/datasphere.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/datasphere.types.generated.d.ts +180 -0
- package/dist/rest/namespaces/datasphere.types.generated.js +8 -0
- package/dist/rest/namespaces/datasphere.types.generated.js.map +1 -0
- package/dist/rest/namespaces/fabric.d.ts +11 -273
- package/dist/rest/namespaces/fabric.js +14 -363
- package/dist/rest/namespaces/fabric.js.map +1 -1
- package/dist/rest/namespaces/fabric.resources.generated.d.ts +195 -0
- package/dist/rest/namespaces/fabric.resources.generated.js +399 -0
- package/dist/rest/namespaces/fabric.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/fabric.types.generated.d.ts +4557 -0
- package/dist/rest/namespaces/fabric.types.generated.js +8 -0
- package/dist/rest/namespaces/fabric.types.generated.js.map +1 -0
- package/dist/rest/namespaces/fax.resources.generated.d.ts +6 -0
- package/dist/rest/namespaces/fax.resources.generated.js +14 -0
- package/dist/rest/namespaces/fax.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/fax.types.generated.d.ts +131 -0
- package/dist/rest/namespaces/fax.types.generated.js +8 -0
- package/dist/rest/namespaces/fax.types.generated.js.map +1 -0
- package/dist/rest/namespaces/imported-numbers.d.ts +3 -18
- package/dist/rest/namespaces/imported-numbers.js +3 -21
- package/dist/rest/namespaces/imported-numbers.js.map +1 -1
- package/dist/rest/namespaces/logs.d.ts +10 -101
- package/dist/rest/namespaces/logs.js +10 -128
- package/dist/rest/namespaces/logs.js.map +1 -1
- package/dist/rest/namespaces/logs.resources.generated.d.ts +9 -0
- package/dist/rest/namespaces/logs.resources.generated.js +17 -0
- package/dist/rest/namespaces/logs.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/logs.types.generated.d.ts +131 -0
- package/dist/rest/namespaces/logs.types.generated.js +8 -0
- package/dist/rest/namespaces/logs.types.generated.js.map +1 -0
- package/dist/rest/namespaces/lookup.d.ts +3 -25
- package/dist/rest/namespaces/lookup.js +3 -27
- package/dist/rest/namespaces/lookup.js.map +1 -1
- package/dist/rest/namespaces/message.resources.generated.d.ts +6 -0
- package/dist/rest/namespaces/message.resources.generated.js +14 -0
- package/dist/rest/namespaces/message.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/message.types.generated.d.ts +122 -0
- package/dist/rest/namespaces/message.types.generated.js +8 -0
- package/dist/rest/namespaces/message.types.generated.js.map +1 -0
- package/dist/rest/namespaces/messages.resources.generated.d.ts +18 -0
- package/dist/rest/namespaces/messages.resources.generated.js +44 -0
- package/dist/rest/namespaces/messages.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/messages.types.generated.d.ts +99 -0
- package/dist/rest/namespaces/messages.types.generated.js +8 -0
- package/dist/rest/namespaces/messages.types.generated.js.map +1 -0
- package/dist/rest/namespaces/mfa.d.ts +3 -42
- package/dist/rest/namespaces/mfa.js +3 -49
- package/dist/rest/namespaces/mfa.js.map +1 -1
- package/dist/rest/namespaces/number-groups.d.ts +3 -45
- package/dist/rest/namespaces/number-groups.js +3 -53
- package/dist/rest/namespaces/number-groups.js.map +1 -1
- package/dist/rest/namespaces/phone-numbers.d.ts +9 -57
- package/dist/rest/namespaces/phone-numbers.js +9 -63
- package/dist/rest/namespaces/phone-numbers.js.map +1 -1
- package/dist/rest/namespaces/project.d.ts +6 -42
- package/dist/rest/namespaces/project.js +6 -51
- package/dist/rest/namespaces/project.js.map +1 -1
- package/dist/rest/namespaces/project.resources.generated.d.ts +17 -0
- package/dist/rest/namespaces/project.resources.generated.js +44 -0
- package/dist/rest/namespaces/project.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/project.types.generated.d.ts +58 -0
- package/dist/rest/namespaces/project.types.generated.js +8 -0
- package/dist/rest/namespaces/project.types.generated.js.map +1 -0
- package/dist/rest/namespaces/projects.resources.generated.d.ts +12 -0
- package/dist/rest/namespaces/projects.resources.generated.js +25 -0
- package/dist/rest/namespaces/projects.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/projects.types.generated.d.ts +77 -0
- package/dist/rest/namespaces/projects.types.generated.js +8 -0
- package/dist/rest/namespaces/projects.types.generated.js.map +1 -0
- package/dist/rest/namespaces/pubsub.d.ts +4 -18
- package/dist/rest/namespaces/pubsub.js +4 -21
- package/dist/rest/namespaces/pubsub.js.map +1 -1
- package/dist/rest/namespaces/pubsub.resources.generated.d.ts +12 -0
- package/dist/rest/namespaces/pubsub.resources.generated.js +29 -0
- package/dist/rest/namespaces/pubsub.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/pubsub.types.generated.d.ts +60 -0
- package/dist/rest/namespaces/pubsub.types.generated.js +8 -0
- package/dist/rest/namespaces/pubsub.types.generated.js.map +1 -0
- package/dist/rest/namespaces/queues.d.ts +3 -38
- package/dist/rest/namespaces/queues.js +3 -44
- package/dist/rest/namespaces/queues.js.map +1 -1
- package/dist/rest/namespaces/recordings.d.ts +3 -34
- package/dist/rest/namespaces/recordings.js +3 -40
- package/dist/rest/namespaces/recordings.js.map +1 -1
- package/dist/rest/namespaces/registry.d.ts +6 -137
- package/dist/rest/namespaces/registry.js +6 -173
- package/dist/rest/namespaces/registry.js.map +1 -1
- package/dist/rest/namespaces/relay-rest.resources.generated.d.ts +168 -0
- package/dist/rest/namespaces/relay-rest.resources.generated.js +430 -0
- package/dist/rest/namespaces/relay-rest.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/relay-rest.types.generated.d.ts +1906 -0
- package/dist/rest/namespaces/relay-rest.types.generated.js +8 -0
- package/dist/rest/namespaces/relay-rest.types.generated.js.map +1 -0
- package/dist/rest/namespaces/short-codes.d.ts +3 -35
- package/dist/rest/namespaces/short-codes.js +3 -41
- package/dist/rest/namespaces/short-codes.js.map +1 -1
- package/dist/rest/namespaces/sip-profile.d.ts +3 -24
- package/dist/rest/namespaces/sip-profile.js +3 -29
- package/dist/rest/namespaces/sip-profile.js.map +1 -1
- package/dist/rest/namespaces/verified-callers.d.ts +3 -29
- package/dist/rest/namespaces/verified-callers.js +3 -34
- package/dist/rest/namespaces/verified-callers.js.map +1 -1
- package/dist/rest/namespaces/video.d.ts +10 -227
- package/dist/rest/namespaces/video.js +10 -288
- package/dist/rest/namespaces/video.js.map +1 -1
- package/dist/rest/namespaces/video.resources.generated.d.ts +81 -0
- package/dist/rest/namespaces/video.resources.generated.js +171 -0
- package/dist/rest/namespaces/video.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/video.types.generated.d.ts +771 -0
- package/dist/rest/namespaces/video.types.generated.js +8 -0
- package/dist/rest/namespaces/video.types.generated.js.map +1 -0
- package/dist/rest/namespaces/voice.resources.generated.d.ts +9 -0
- package/dist/rest/namespaces/voice.resources.generated.js +17 -0
- package/dist/rest/namespaces/voice.resources.generated.js.map +1 -0
- package/dist/rest/namespaces/voice.types.generated.d.ts +214 -0
- package/dist/rest/namespaces/voice.types.generated.js +8 -0
- package/dist/rest/namespaces/voice.types.generated.js.map +1 -0
- package/dist/rest/pagination.d.ts +5 -1
- package/dist/rest/pagination.js +40 -20
- package/dist/rest/pagination.js.map +1 -1
- package/dist/rest/types.d.ts +21 -3
- package/dist/schema.json +299 -98
- package/dist/skills/SkillBase.d.ts +97 -20
- package/dist/skills/SkillBase.js +100 -17
- package/dist/skills/SkillBase.js.map +1 -1
- package/dist/skills/SkillManager.d.ts +66 -13
- package/dist/skills/SkillManager.js +101 -20
- package/dist/skills/SkillManager.js.map +1 -1
- package/dist/skills/SkillName.d.ts +44 -0
- package/dist/skills/SkillName.js +2 -0
- package/dist/skills/SkillName.js.map +1 -0
- package/dist/skills/SkillRegistry.d.ts +47 -7
- package/dist/skills/SkillRegistry.js +85 -13
- package/dist/skills/SkillRegistry.js.map +1 -1
- package/dist/skills/builtin/api_ninjas_trivia.d.ts +3 -1
- package/dist/skills/builtin/api_ninjas_trivia.js +24 -8
- package/dist/skills/builtin/api_ninjas_trivia.js.map +1 -1
- package/dist/skills/builtin/ask_claude.d.ts +14 -4
- package/dist/skills/builtin/ask_claude.js +36 -14
- package/dist/skills/builtin/ask_claude.js.map +1 -1
- package/dist/skills/builtin/claude_skills.d.ts +3 -1
- package/dist/skills/builtin/claude_skills.js +19 -15
- package/dist/skills/builtin/claude_skills.js.map +1 -1
- package/dist/skills/builtin/custom_skills.d.ts +10 -3
- package/dist/skills/builtin/custom_skills.js +26 -9
- package/dist/skills/builtin/custom_skills.js.map +1 -1
- package/dist/skills/builtin/datasphere.d.ts +5 -3
- package/dist/skills/builtin/datasphere.js +34 -25
- package/dist/skills/builtin/datasphere.js.map +1 -1
- package/dist/skills/builtin/datasphere_serverless.d.ts +12 -1
- package/dist/skills/builtin/datasphere_serverless.js +17 -6
- package/dist/skills/builtin/datasphere_serverless.js.map +1 -1
- package/dist/skills/builtin/datetime.d.ts +3 -1
- package/dist/skills/builtin/datetime.js +11 -7
- package/dist/skills/builtin/datetime.js.map +1 -1
- package/dist/skills/builtin/google_maps.d.ts +29 -14
- package/dist/skills/builtin/google_maps.js +89 -269
- package/dist/skills/builtin/google_maps.js.map +1 -1
- package/dist/skills/builtin/index.d.ts +8 -6
- package/dist/skills/builtin/index.js +8 -6
- package/dist/skills/builtin/index.js.map +1 -1
- package/dist/skills/builtin/info_gatherer.d.ts +4 -2
- package/dist/skills/builtin/info_gatherer.js +20 -12
- package/dist/skills/builtin/info_gatherer.js.map +1 -1
- package/dist/skills/builtin/joke.d.ts +16 -6
- package/dist/skills/builtin/joke.js +54 -37
- package/dist/skills/builtin/joke.js.map +1 -1
- package/dist/skills/builtin/math.d.ts +3 -1
- package/dist/skills/builtin/math.js +14 -9
- package/dist/skills/builtin/math.js.map +1 -1
- package/dist/skills/builtin/mcp_gateway.d.ts +34 -5
- package/dist/skills/builtin/mcp_gateway.js +77 -46
- package/dist/skills/builtin/mcp_gateway.js.map +1 -1
- package/dist/skills/builtin/native_vector_search.d.ts +19 -5
- package/dist/skills/builtin/native_vector_search.js +179 -61
- package/dist/skills/builtin/native_vector_search.js.map +1 -1
- package/dist/skills/builtin/play_background_file.d.ts +21 -15
- package/dist/skills/builtin/play_background_file.js +43 -122
- package/dist/skills/builtin/play_background_file.js.map +1 -1
- package/dist/skills/builtin/spider.d.ts +46 -1
- package/dist/skills/builtin/spider.js +317 -101
- package/dist/skills/builtin/spider.js.map +1 -1
- package/dist/skills/builtin/swml_transfer.d.ts +14 -3
- package/dist/skills/builtin/swml_transfer.js +45 -24
- package/dist/skills/builtin/swml_transfer.js.map +1 -1
- package/dist/skills/builtin/weather_api.d.ts +24 -13
- package/dist/skills/builtin/weather_api.js +57 -31
- package/dist/skills/builtin/weather_api.js.map +1 -1
- package/dist/skills/builtin/web_search.d.ts +48 -10
- package/dist/skills/builtin/web_search.js +301 -84
- package/dist/skills/builtin/web_search.js.map +1 -1
- package/dist/skills/builtin/wikipedia_search.d.ts +4 -2
- package/dist/skills/builtin/wikipedia_search.js +32 -14
- package/dist/skills/builtin/wikipedia_search.js.map +1 -1
- package/dist/skills/index.d.ts +3 -2
- package/dist/skills/index.js +1 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/swml_verbs_generated.d.ts +2824 -0
- package/dist/swml_verbs_generated.js +12 -0
- package/dist/swml_verbs_generated.js.map +1 -0
- package/dist/types.d.ts +65 -6
- package/dist/web.d.ts +27 -0
- package/dist/web.js +20 -0
- package/dist/web.js.map +1 -0
- package/docs/agent-guide.md +1034 -0
- package/docs/ai_chat.md +560 -0
- package/docs/api-reference.md +3534 -0
- package/docs/architecture.md +846 -0
- package/docs/bedrock_agent.md +411 -0
- package/docs/cli-guide.md +403 -0
- package/docs/cloud_functions_guide.md +399 -0
- package/docs/configuration.md +548 -0
- package/docs/contexts-guide.md +884 -0
- package/docs/datamap-guide.md +1160 -0
- package/docs/developer_pain_points.md +548 -0
- package/docs/llm_parameters.md +298 -0
- package/docs/mcp_gateway_reference.md +354 -0
- package/docs/mcp_integration.md +162 -0
- package/docs/pgi_agent_guide.md +1820 -0
- package/docs/prefabs-guide.md +815 -0
- package/docs/programmatically_governed_inference.md +301 -0
- package/docs/sdk_features.md +501 -0
- package/docs/security.md +559 -0
- package/docs/serverless-guide.md +520 -0
- package/docs/skills-guide.md +1223 -0
- package/docs/skills-system.md +405 -0
- package/docs/skills_parameter_schema.md +417 -0
- package/docs/swaig-reference.md +1938 -0
- package/docs/swml_service_guide.md +573 -0
- package/docs/third_party_skills.md +410 -0
- package/docs/web_service.md +666 -0
- package/examples/README.md +202 -0
- package/examples/advanced-datamap.ts +108 -0
- package/examples/advanced-dynamic-config.ts +70 -0
- package/examples/auto-vivified.ts +95 -0
- package/examples/call-flow.ts +65 -0
- package/examples/comprehensive-dynamic.ts +125 -0
- package/examples/contexts-steps.ts +65 -0
- package/examples/custom-path.ts +45 -0
- package/examples/datamap-tools.ts +51 -0
- package/examples/datasphere-multi-instance.ts +66 -0
- package/examples/datasphere-serverless-env.ts +87 -0
- package/examples/datasphere-webhook-env.ts +65 -0
- package/examples/datasphere.ts +56 -0
- package/examples/declarative.ts +100 -0
- package/examples/dynamic-config.ts +54 -0
- package/examples/dynamic-info-gatherer.ts +69 -0
- package/examples/dynamic-swml-service.ts +67 -0
- package/examples/gather-info.ts +95 -0
- package/examples/gather-per-question-functions-demo.ts +139 -0
- package/examples/joke-agent.ts +34 -0
- package/examples/kubernetes-agent.ts +45 -0
- package/examples/llm-params.ts +75 -0
- package/examples/mcp-agent.ts +89 -0
- package/examples/mcp-gateway.ts +81 -0
- package/examples/multi-agent.ts +80 -0
- package/examples/multi-endpoint.ts +79 -0
- package/examples/pgi/case-domain.ts +114 -0
- package/examples/pgi/serve.ts +16 -0
- package/examples/pgi/support-agent.ts +265 -0
- package/examples/pom-prompt.ts +70 -0
- package/examples/prefab-concierge.ts +42 -0
- package/examples/prefab-faq.ts +58 -0
- package/examples/prefab-info-gatherer.ts +33 -0
- package/examples/prefab-receptionist.ts +36 -0
- package/examples/prefab-survey.ts +69 -0
- package/examples/quickstart-agent.ts +29 -0
- package/examples/quickstart-relay.ts +25 -0
- package/examples/quickstart-rest.ts +25 -0
- package/examples/record-call.ts +65 -0
- package/examples/relay-demo.ts +33 -0
- package/examples/room-and-sip.ts +93 -0
- package/examples/serverless-lambda.ts +43 -0
- package/examples/session-state.ts +83 -0
- package/examples/simple-agent.ts +36 -0
- package/examples/simple-static.ts +29 -0
- package/examples/skills-demo.ts +41 -0
- package/examples/step-function-inheritance-demo.ts +124 -0
- package/examples/swaig-features.ts +193 -0
- package/examples/swml-service-routing.ts +66 -0
- package/examples/swml-service.ts +38 -0
- package/examples/swmlservice_ai_sidecar.ts +104 -0
- package/examples/swmlservice_swaig_standalone.ts +79 -0
- package/examples/tap.ts +67 -0
- package/examples/typed-tools.ts +68 -0
- package/examples/verb-methods.ts +45 -0
- package/examples/web-search-multi-instance.ts +75 -0
- package/examples/web-search.ts +38 -0
- package/examples/wikipedia.ts +36 -0
- package/livewire/README.md +164 -0
- package/livewire/docs/migration-guide.md +251 -0
- package/livewire/examples/livewire-basic-agent.ts +74 -0
- package/livewire/examples/livewire-handoff.ts +196 -0
- package/livewire/examples/livewire-multi-tool.ts +121 -0
- package/package.json +88 -13
- package/relay/README.md +101 -0
- package/relay/docs/call-methods.md +622 -0
- package/relay/docs/client-reference.md +281 -0
- package/relay/docs/events.md +193 -0
- package/relay/docs/getting-started.md +221 -0
- package/relay/docs/guide.md +386 -0
- package/relay/docs/messaging.md +246 -0
- package/relay/examples/relay-inbound.ts +66 -0
- package/relay/examples/relay-messaging.ts +74 -0
- package/relay/examples/relay-outbound.ts +76 -0
- package/rest/README.md +141 -0
- package/rest/docs/calling.md +313 -0
- package/rest/docs/client-reference.md +149 -0
- package/rest/docs/fabric.md +192 -0
- package/rest/docs/getting-started.md +138 -0
- package/rest/docs/guide.md +421 -0
- package/rest/docs/namespaces.md +367 -0
- package/rest/docs/phone-binding.md +116 -0
- package/rest/examples/rest-10dlc-registration.ts +177 -0
- package/rest/examples/rest-bind-phone-to-swml-webhook.ts +66 -0
- package/rest/examples/rest-calling-ivr-and-ai.ts +136 -0
- package/rest/examples/rest-calling-play-and-record.ts +98 -0
- package/rest/examples/rest-client.ts +59 -0
- package/rest/examples/rest-datasphere-search.ts +81 -0
- package/rest/examples/rest-fabric-conferences-and-routing.ts +147 -0
- package/rest/examples/rest-fabric-subscribers-and-sip.ts +106 -0
- package/rest/examples/rest-fabric-swml-and-callflows.ts +101 -0
- package/rest/examples/rest-manage-resources.ts +64 -0
- package/rest/examples/rest-phone-number-management.ts +200 -0
- package/rest/examples/rest-queues-mfa-and-recordings.ts +143 -0
- package/rest/examples/rest-video-rooms.ts +186 -0
- package/tutorial/fred/fred.ts +218 -0
- package/tutorial/fred/tutorial/01-introduction.md +141 -0
- package/tutorial/fred/tutorial/02-setup.md +304 -0
- package/tutorial/fred/tutorial/03-basic-agent.md +284 -0
- package/tutorial/fred/tutorial/04-wikipedia-skill.md +298 -0
- package/tutorial/fred/tutorial/05-custom-functions.md +347 -0
- package/tutorial/fred/tutorial/06-running-testing.md +642 -0
- package/tutorial/fred/tutorial/README.md +56 -0
- package/tutorial/fred/tutorial/appendix-complete-code.md +632 -0
- package/tutorial/fred/tutorial/appendix-docker-deployment.md +504 -0
- package/tutorial/full-guardrails-agent/handlers.ts +436 -0
- package/tutorial/full-guardrails-agent/penny.ts +305 -0
- package/tutorial/full-guardrails-agent/reservations.ts +1109 -0
- package/tutorial/full-guardrails-agent/tutorial/01-why-guardrails.md +149 -0
- package/tutorial/full-guardrails-agent/tutorial/02-design-first.md +139 -0
- package/tutorial/full-guardrails-agent/tutorial/03-rules-first.md +422 -0
- package/tutorial/full-guardrails-agent/tutorial/04-the-shell.md +238 -0
- package/tutorial/full-guardrails-agent/tutorial/05-steps-and-scoping.md +247 -0
- package/tutorial/full-guardrails-agent/tutorial/06-tools-that-decide.md +467 -0
- package/tutorial/full-guardrails-agent/tutorial/07-gather-and-projection.md +160 -0
- package/tutorial/full-guardrails-agent/tutorial/08-the-verification-gate.md +333 -0
- package/tutorial/full-guardrails-agent/tutorial/09-people-and-endings.md +313 -0
- package/tutorial/full-guardrails-agent/tutorial/10-testing-and-running.md +387 -0
- package/tutorial/full-guardrails-agent/tutorial/README.md +106 -0
- package/tutorial/full-guardrails-agent/tutorial/appendix-complete-code.md +2207 -0
- package/tutorial/full-guardrails-agent/tutorial/appendix-deployment.md +191 -0
- package/tutorial/full-guardrails-agent/tutorial/appendix-technique-map.md +117 -0
- package/tutorial/full-guardrails-agent/workflow.ts +219 -0
- package/tutorial/multi_agents/README.md +175 -0
- package/tutorial/multi_agents/advanced_agent.ts +395 -0
- package/tutorial/multi_agents/extending_agents.ts +641 -0
- package/tutorial/multi_agents/knowledge.ts +59 -0
- package/tutorial/multi_agents/lesson1_first_agent.md +368 -0
- package/tutorial/multi_agents/lesson2_knowledge_bases.md +404 -0
- package/tutorial/multi_agents/lesson3_multi_agent_systems.md +621 -0
- package/tutorial/multi_agents/lesson4_advanced_features.md +805 -0
- package/tutorial/multi_agents/lesson5_extending_agents.md +856 -0
- package/tutorial/multi_agents/pc_builder.ts +529 -0
- package/tutorial/multi_agents/sales_agent.ts +88 -0
- package/tutorial/multi_agents/sales_agent_with_search.ts +116 -0
- package/tutorial/multi_agents/sales_knowledge.md +139 -0
- package/tutorial/multi_agents/support_knowledge.md +256 -0
- package/dist/cli/mock-data.d.ts +0 -37
- package/dist/cli/mock-data.js +0 -80
- package/dist/cli/mock-data.js.map +0 -1
- package/dist/generateVerbTypes.d.ts +0 -11
- package/dist/generateVerbTypes.js +0 -265
- package/dist/generateVerbTypes.js.map +0 -1
- package/dist/rest/namespaces/compat.d.ts +0 -585
- package/dist/rest/namespaces/compat.js +0 -735
- package/dist/rest/namespaces/compat.js.map +0 -1
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* They define tools, prompt sections, hints, and global data.
|
|
6
6
|
*/
|
|
7
7
|
import type { SwaigHandler } from '../SwaigFunction.js';
|
|
8
|
+
import type { SwaigRequest } from '../SwaigContracts.js';
|
|
8
9
|
import type { FunctionResult } from '../FunctionResult.js';
|
|
9
10
|
import type { AgentBase } from '../AgentBase.js';
|
|
10
11
|
import { type Logger } from '../Logger.js';
|
|
12
|
+
import type { ToolParameters, ToolArgs } from '../ParameterSchema.js';
|
|
11
13
|
/** Configuration key-value pairs passed to a skill at construction time. */
|
|
12
14
|
export interface SkillConfig {
|
|
13
15
|
[key: string]: unknown;
|
|
@@ -40,6 +42,65 @@ export interface SkillToolDefinition {
|
|
|
40
42
|
*/
|
|
41
43
|
isHangupHook?: boolean;
|
|
42
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Build a {@link SkillToolDefinition} whose `handler` args are *inferred* from
|
|
47
|
+
* its `parameters` schema + `required` list — the `getTools()`-level counterpart
|
|
48
|
+
* to {@link ../SWMLService.SWMLService.defineTool}'s typed-tool inference.
|
|
49
|
+
*
|
|
50
|
+
* A skill returns its tools as a plain `SkillToolDefinition[]`, and that
|
|
51
|
+
* interface types `handler` as the loose {@link SwaigHandler} (`args:
|
|
52
|
+
* Record<string, unknown>`) — so a hand-written entry's handler sees untyped
|
|
53
|
+
* args and must reach for `args['query'] as string`. Wrapping the entry in
|
|
54
|
+
* `defineSkillTool` captures `parameters` (`P`) and `required` (`R`) via `const`
|
|
55
|
+
* type parameters and feeds them through {@link ToolArgs}, so the handler's
|
|
56
|
+
* `args` is precise: a `required` string prop is `args.query: string`, an `enum`
|
|
57
|
+
* prop narrows to its literal union, optional props are `?`. It then erases the
|
|
58
|
+
* typed handler back to {@link SwaigHandler} at a single boundary and returns an
|
|
59
|
+
* ordinary `SkillToolDefinition`, so the result drops straight into a
|
|
60
|
+
* `getTools()` array with no other change.
|
|
61
|
+
*
|
|
62
|
+
* The inferred `args` is a **compile-time authoring convenience only** — at
|
|
63
|
+
* runtime `args` is still whatever JSON the model extracted, so a handler that
|
|
64
|
+
* cares (most do, since the model can emit an empty/typeless value even for a
|
|
65
|
+
* `required` param) keeps its defensive `typeof`/`.trim()` narrowing. The wire
|
|
66
|
+
* output is byte-identical to the equivalent hand-written entry (drift/emission
|
|
67
|
+
* unaffected); this is purely an author-side type gain.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { SkillBase, defineSkillTool, FunctionResult, type SkillToolDefinition } from '@signalwire/sdk';
|
|
72
|
+
*
|
|
73
|
+
* class WikiSkill extends SkillBase {
|
|
74
|
+
* static override SKILL_NAME = 'wiki';
|
|
75
|
+
* static override SKILL_DESCRIPTION = 'Search Wikipedia.';
|
|
76
|
+
*
|
|
77
|
+
* override getTools(): SkillToolDefinition[] {
|
|
78
|
+
* return [
|
|
79
|
+
* defineSkillTool({
|
|
80
|
+
* name: 'search_wiki',
|
|
81
|
+
* description: 'Search Wikipedia for a topic',
|
|
82
|
+
* parameters: { query: { type: 'string', description: 'The search term' } },
|
|
83
|
+
* required: ['query'],
|
|
84
|
+
* handler: async (args) => {
|
|
85
|
+
* // args.query is `string` (required) — no cast needed
|
|
86
|
+
* if (!args.query.trim()) return new FunctionResult('Provide a query.');
|
|
87
|
+
* return new FunctionResult(await this.searchWiki(args.query.trim()));
|
|
88
|
+
* },
|
|
89
|
+
* }),
|
|
90
|
+
* ];
|
|
91
|
+
* }
|
|
92
|
+
*
|
|
93
|
+
* private async searchWiki(query: string): Promise<string> {
|
|
94
|
+
* return `results for ${query}`;
|
|
95
|
+
* }
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare function defineSkillTool<const P extends ToolParameters = ToolParameters, const R extends readonly PropertyKey[] = []>(toolDef: Omit<SkillToolDefinition, 'parameters' | 'required' | 'handler'> & {
|
|
100
|
+
parameters?: P;
|
|
101
|
+
required?: R;
|
|
102
|
+
handler: (args: ToolArgs<P, R>, rawData: SwaigRequest, agent?: AgentBase) => FunctionResult | Record<string, unknown> | string | Promise<FunctionResult | Record<string, unknown> | string>;
|
|
103
|
+
}): SkillToolDefinition;
|
|
43
104
|
/** A section of prompt content injected into the agent's system prompt by a skill. */
|
|
44
105
|
export interface SkillPromptSection {
|
|
45
106
|
/** Section heading displayed in the prompt. */
|
|
@@ -63,7 +124,7 @@ export interface ParameterSchemaEntry {
|
|
|
63
124
|
required?: boolean;
|
|
64
125
|
/** Whether the parameter should be hidden from user-facing output (e.g., API keys). */
|
|
65
126
|
hidden?: boolean;
|
|
66
|
-
/** Environment variable
|
|
127
|
+
/** Environment variable a configuration tool can read this value from. A hint only: the SDK doesn't read it, so the skill gets the value from its params. */
|
|
67
128
|
env_var?: string;
|
|
68
129
|
/** Allowed values for the parameter. */
|
|
69
130
|
enum?: unknown[];
|
|
@@ -85,13 +146,14 @@ export interface ParameterSchemaEntry {
|
|
|
85
146
|
* - **Speech hints** via `getHints()`
|
|
86
147
|
* - **Global data** seeded into each call via `getGlobalData()`
|
|
87
148
|
*
|
|
88
|
-
* Skills are added to an agent with `agent.addSkill(
|
|
89
|
-
*
|
|
90
|
-
*
|
|
149
|
+
* Skills are added to an agent with `agent.addSkill(new MySkill(config))`, or
|
|
150
|
+
* by registered name with `agent.addSkillByName('name', config)`. The agent
|
|
151
|
+
* calls `setAgent()`, and the {@link SkillManager} then calls `setup()`,
|
|
152
|
+
* before the skill's tools are registered.
|
|
91
153
|
*
|
|
92
154
|
* @example Custom skill
|
|
93
155
|
* ```ts
|
|
94
|
-
* import { SkillBase, FunctionResult, type SkillToolDefinition } from '@signalwire/sdk';
|
|
156
|
+
* import { AgentBase, SkillBase, FunctionResult, type SkillToolDefinition } from '@signalwire/sdk';
|
|
95
157
|
*
|
|
96
158
|
* export class GreetingSkill extends SkillBase {
|
|
97
159
|
* static override SKILL_NAME = 'greeting';
|
|
@@ -108,7 +170,8 @@ export interface ParameterSchemaEntry {
|
|
|
108
170
|
* }
|
|
109
171
|
*
|
|
110
172
|
* // In your agent:
|
|
111
|
-
* agent
|
|
173
|
+
* const agent = new AgentBase({ name: 'demo', route: '/' });
|
|
174
|
+
* await agent.addSkill(new GreetingSkill({ message: 'Howdy!' }));
|
|
112
175
|
* ```
|
|
113
176
|
*
|
|
114
177
|
* @see {@link SkillManager}
|
|
@@ -119,7 +182,7 @@ export declare abstract class SkillBase {
|
|
|
119
182
|
/**
|
|
120
183
|
* Unique skill name. Subclasses MUST override with a non-empty string.
|
|
121
184
|
*
|
|
122
|
-
* Python
|
|
185
|
+
* Python equivalent:`SKILL_NAME: str = None` at `core/skill_base.py:23`.
|
|
123
186
|
* Python raises `ValueError` in `__init__` when this is left as `None`;
|
|
124
187
|
* TS throws at construction when this is left as the empty default.
|
|
125
188
|
*/
|
|
@@ -127,19 +190,19 @@ export declare abstract class SkillBase {
|
|
|
127
190
|
/**
|
|
128
191
|
* Human-readable description of the skill. Subclasses MUST override.
|
|
129
192
|
*
|
|
130
|
-
* Python
|
|
193
|
+
* Python equivalent:`SKILL_DESCRIPTION: str = None` at `core/skill_base.py:24`.
|
|
131
194
|
*/
|
|
132
195
|
static SKILL_DESCRIPTION: string;
|
|
133
196
|
/**
|
|
134
197
|
* Semantic version string. Subclasses may override; defaults to `"1.0.0"`.
|
|
135
198
|
*
|
|
136
|
-
* Python
|
|
199
|
+
* Python equivalent:`SKILL_VERSION: str = "1.0.0"` at `core/skill_base.py:25`.
|
|
137
200
|
*/
|
|
138
201
|
static SKILL_VERSION: string;
|
|
139
202
|
/**
|
|
140
203
|
* Packages required by the skill, checked at load time by `validatePackages()`.
|
|
141
204
|
*
|
|
142
|
-
* Python
|
|
205
|
+
* Python equivalent:`REQUIRED_PACKAGES: List[str] = []` at `core/skill_base.py:26`.
|
|
143
206
|
* In TS these are npm package names importable via dynamic `import()`.
|
|
144
207
|
*/
|
|
145
208
|
static REQUIRED_PACKAGES: readonly string[];
|
|
@@ -147,13 +210,13 @@ export declare abstract class SkillBase {
|
|
|
147
210
|
* Environment variables required for the skill to function, checked at load
|
|
148
211
|
* time by `validateEnvVars()`.
|
|
149
212
|
*
|
|
150
|
-
* Python
|
|
213
|
+
* Python equivalent:`REQUIRED_ENV_VARS: List[str] = []` at `core/skill_base.py:27`.
|
|
151
214
|
*/
|
|
152
215
|
static REQUIRED_ENV_VARS: readonly string[];
|
|
153
216
|
/**
|
|
154
217
|
* Whether this skill type supports multiple simultaneous instances (e.g., with different tool_name).
|
|
155
218
|
*
|
|
156
|
-
* Python
|
|
219
|
+
* Python equivalent:`SUPPORTS_MULTIPLE_INSTANCES: bool = False` at `core/skill_base.py:30`.
|
|
157
220
|
*/
|
|
158
221
|
static SUPPORTS_MULTIPLE_INSTANCES: boolean;
|
|
159
222
|
/**
|
|
@@ -185,8 +248,12 @@ export declare abstract class SkillBase {
|
|
|
185
248
|
* constructor. In the TypeScript SDK the SkillManager always calls
|
|
186
249
|
* `setAgent()` before `setup()`, so subclasses can rely on `getAgent()` being
|
|
187
250
|
* safe to call inside `setup()` and any method invoked after it.
|
|
251
|
+
*
|
|
252
|
+
* Readable by anyone holding the skill, so a test or an introspection tool can
|
|
253
|
+
* check which agent a skill was bound to. Subclasses that need a guaranteed
|
|
254
|
+
* non-null agent should still prefer the asserting {@link getAgent}.
|
|
188
255
|
*/
|
|
189
|
-
|
|
256
|
+
agent?: AgentBase;
|
|
190
257
|
/**
|
|
191
258
|
* Logger scoped to this skill. Python equivalent: `self.logger = get_logger(...)`
|
|
192
259
|
* set in `SkillBase.__init__` so every subclass can call `self.logger.info(...)`.
|
|
@@ -196,7 +263,7 @@ export declare abstract class SkillBase {
|
|
|
196
263
|
/**
|
|
197
264
|
* Tools registered imperatively via `defineTool()`.
|
|
198
265
|
*
|
|
199
|
-
* Python
|
|
266
|
+
* Python equivalent:Python's `SkillBase.register_tools()` is a `@abstractmethod` that
|
|
200
267
|
* calls `self.agent.define_tool(...)` (or `self.define_tool(...)`) once per tool.
|
|
201
268
|
* In TypeScript the tool pipeline is declarative (pull model): `SkillManager`
|
|
202
269
|
* calls `getTools()` at SWML render time. Skills that want to build their tool
|
|
@@ -218,10 +285,20 @@ export declare abstract class SkillBase {
|
|
|
218
285
|
* attached to an agent by the SkillManager).
|
|
219
286
|
*/
|
|
220
287
|
protected getAgent(): AgentBase;
|
|
288
|
+
/**
|
|
289
|
+
* The configuration this skill was constructed with — the reference's public
|
|
290
|
+
* `self.params` (`core/skill_base.py:40`), read-only.
|
|
291
|
+
*
|
|
292
|
+
* `swaig_fields` is absent: the constructor pops it into {@link swaigFields},
|
|
293
|
+
* mirroring the reference's `self.swaig_fields = self.params.pop(...)`
|
|
294
|
+
* (`core/skill_base.py:44`). Use {@link getConfig} for a single typed key; this
|
|
295
|
+
* returns the whole map, which is what the reference attribute exposes.
|
|
296
|
+
*/
|
|
297
|
+
get params(): Readonly<SkillConfig>;
|
|
221
298
|
/**
|
|
222
299
|
* Create a new skill instance.
|
|
223
300
|
*
|
|
224
|
-
* Python
|
|
301
|
+
* Python equivalent:`core/skill_base.py:32-43`.
|
|
225
302
|
* Python `__init__` raises `ValueError` if `SKILL_NAME` or `SKILL_DESCRIPTION`
|
|
226
303
|
* is left as `None` on the subclass. TS throws the equivalent when the static
|
|
227
304
|
* defaults haven't been overridden.
|
|
@@ -243,7 +320,7 @@ export declare abstract class SkillBase {
|
|
|
243
320
|
* `defineTool()`. Skills using the declarative pattern override this
|
|
244
321
|
* method to return a static array built from their config.
|
|
245
322
|
*
|
|
246
|
-
* Python
|
|
323
|
+
* Python equivalent:replaces the `@abstractmethod register_tools()` contract
|
|
247
324
|
* — Python skills call `self.define_tool(...)` inside `register_tools()`;
|
|
248
325
|
* TypeScript skills either call `this.defineTool(...)` in `setup()` (and
|
|
249
326
|
* let the default `getTools()` return them) or override `getTools()`
|
|
@@ -255,7 +332,7 @@ export declare abstract class SkillBase {
|
|
|
255
332
|
/**
|
|
256
333
|
* Imperatively register a tool with this skill.
|
|
257
334
|
*
|
|
258
|
-
* Python
|
|
335
|
+
* Python equivalent:`core/skill_base.py:58` `def define_tool(self, **kwargs)`.
|
|
259
336
|
* Merges `this.swaigFields` into the tool definition (explicit fields on
|
|
260
337
|
* `toolDef` take precedence), then pushes the result into `_dynamicTools`
|
|
261
338
|
* so the default `getTools()` returns it at SWML render time.
|
|
@@ -328,7 +405,7 @@ export declare abstract class SkillBase {
|
|
|
328
405
|
* @param rawData - The raw request data containing global_data.
|
|
329
406
|
* @returns The skill's stored data, or an empty object if not found.
|
|
330
407
|
*/
|
|
331
|
-
getSkillData(rawData:
|
|
408
|
+
getSkillData(rawData: SwaigRequest): Record<string, unknown>;
|
|
332
409
|
/**
|
|
333
410
|
* Update this skill's namespaced data on a FunctionResult via updateGlobalData.
|
|
334
411
|
* @param result - The FunctionResult to update.
|
|
@@ -344,7 +421,7 @@ export declare abstract class SkillBase {
|
|
|
344
421
|
* Validate that all required environment variables declared on the skill class
|
|
345
422
|
* are set in the current process environment.
|
|
346
423
|
*
|
|
347
|
-
* Python
|
|
424
|
+
* Python equivalent:`core/skill_base.py:103-110` reads `self.REQUIRED_ENV_VARS`
|
|
348
425
|
* directly. TS reads the same static from the class.
|
|
349
426
|
*
|
|
350
427
|
* Returns the list of missing variable names so callers can produce actionable
|
|
@@ -387,7 +464,7 @@ export declare abstract class SkillBase {
|
|
|
387
464
|
/**
|
|
388
465
|
* Validate that all required packages declared on the skill class can be imported.
|
|
389
466
|
*
|
|
390
|
-
* Python
|
|
467
|
+
* Python equivalent:`core/skill_base.py:112-124` reads `self.REQUIRED_PACKAGES`
|
|
391
468
|
* directly and tries `importlib.import_module(pkg)` for each; TS does the
|
|
392
469
|
* equivalent with a dynamic `import()`.
|
|
393
470
|
*
|
package/dist/skills/SkillBase.js
CHANGED
|
@@ -6,6 +6,71 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { randomBytes } from 'node:crypto';
|
|
8
8
|
import { getLogger } from '../Logger.js';
|
|
9
|
+
/**
|
|
10
|
+
* Build a {@link SkillToolDefinition} whose `handler` args are *inferred* from
|
|
11
|
+
* its `parameters` schema + `required` list — the `getTools()`-level counterpart
|
|
12
|
+
* to {@link ../SWMLService.SWMLService.defineTool}'s typed-tool inference.
|
|
13
|
+
*
|
|
14
|
+
* A skill returns its tools as a plain `SkillToolDefinition[]`, and that
|
|
15
|
+
* interface types `handler` as the loose {@link SwaigHandler} (`args:
|
|
16
|
+
* Record<string, unknown>`) — so a hand-written entry's handler sees untyped
|
|
17
|
+
* args and must reach for `args['query'] as string`. Wrapping the entry in
|
|
18
|
+
* `defineSkillTool` captures `parameters` (`P`) and `required` (`R`) via `const`
|
|
19
|
+
* type parameters and feeds them through {@link ToolArgs}, so the handler's
|
|
20
|
+
* `args` is precise: a `required` string prop is `args.query: string`, an `enum`
|
|
21
|
+
* prop narrows to its literal union, optional props are `?`. It then erases the
|
|
22
|
+
* typed handler back to {@link SwaigHandler} at a single boundary and returns an
|
|
23
|
+
* ordinary `SkillToolDefinition`, so the result drops straight into a
|
|
24
|
+
* `getTools()` array with no other change.
|
|
25
|
+
*
|
|
26
|
+
* The inferred `args` is a **compile-time authoring convenience only** — at
|
|
27
|
+
* runtime `args` is still whatever JSON the model extracted, so a handler that
|
|
28
|
+
* cares (most do, since the model can emit an empty/typeless value even for a
|
|
29
|
+
* `required` param) keeps its defensive `typeof`/`.trim()` narrowing. The wire
|
|
30
|
+
* output is byte-identical to the equivalent hand-written entry (drift/emission
|
|
31
|
+
* unaffected); this is purely an author-side type gain.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { SkillBase, defineSkillTool, FunctionResult, type SkillToolDefinition } from '@signalwire/sdk';
|
|
36
|
+
*
|
|
37
|
+
* class WikiSkill extends SkillBase {
|
|
38
|
+
* static override SKILL_NAME = 'wiki';
|
|
39
|
+
* static override SKILL_DESCRIPTION = 'Search Wikipedia.';
|
|
40
|
+
*
|
|
41
|
+
* override getTools(): SkillToolDefinition[] {
|
|
42
|
+
* return [
|
|
43
|
+
* defineSkillTool({
|
|
44
|
+
* name: 'search_wiki',
|
|
45
|
+
* description: 'Search Wikipedia for a topic',
|
|
46
|
+
* parameters: { query: { type: 'string', description: 'The search term' } },
|
|
47
|
+
* required: ['query'],
|
|
48
|
+
* handler: async (args) => {
|
|
49
|
+
* // args.query is `string` (required) — no cast needed
|
|
50
|
+
* if (!args.query.trim()) return new FunctionResult('Provide a query.');
|
|
51
|
+
* return new FunctionResult(await this.searchWiki(args.query.trim()));
|
|
52
|
+
* },
|
|
53
|
+
* }),
|
|
54
|
+
* ];
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* private async searchWiki(query: string): Promise<string> {
|
|
58
|
+
* return `results for ${query}`;
|
|
59
|
+
* }
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function defineSkillTool(toolDef) {
|
|
64
|
+
return {
|
|
65
|
+
...toolDef,
|
|
66
|
+
parameters: toolDef.parameters,
|
|
67
|
+
required: toolDef.required,
|
|
68
|
+
// Single type-erasure boundary: at runtime the handler is the ordinary
|
|
69
|
+
// (args: Record<string,unknown>, rawData) SwaigHandler; the inferred-args
|
|
70
|
+
// view is compile-time only (mirrors SWMLService.defineTool).
|
|
71
|
+
handler: toolDef.handler,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
9
74
|
/**
|
|
10
75
|
* Abstract base class for agent skills.
|
|
11
76
|
*
|
|
@@ -17,13 +82,14 @@ import { getLogger } from '../Logger.js';
|
|
|
17
82
|
* - **Speech hints** via `getHints()`
|
|
18
83
|
* - **Global data** seeded into each call via `getGlobalData()`
|
|
19
84
|
*
|
|
20
|
-
* Skills are added to an agent with `agent.addSkill(
|
|
21
|
-
*
|
|
22
|
-
*
|
|
85
|
+
* Skills are added to an agent with `agent.addSkill(new MySkill(config))`, or
|
|
86
|
+
* by registered name with `agent.addSkillByName('name', config)`. The agent
|
|
87
|
+
* calls `setAgent()`, and the {@link SkillManager} then calls `setup()`,
|
|
88
|
+
* before the skill's tools are registered.
|
|
23
89
|
*
|
|
24
90
|
* @example Custom skill
|
|
25
91
|
* ```ts
|
|
26
|
-
* import { SkillBase, FunctionResult, type SkillToolDefinition } from '@signalwire/sdk';
|
|
92
|
+
* import { AgentBase, SkillBase, FunctionResult, type SkillToolDefinition } from '@signalwire/sdk';
|
|
27
93
|
*
|
|
28
94
|
* export class GreetingSkill extends SkillBase {
|
|
29
95
|
* static override SKILL_NAME = 'greeting';
|
|
@@ -40,7 +106,8 @@ import { getLogger } from '../Logger.js';
|
|
|
40
106
|
* }
|
|
41
107
|
*
|
|
42
108
|
* // In your agent:
|
|
43
|
-
* agent
|
|
109
|
+
* const agent = new AgentBase({ name: 'demo', route: '/' });
|
|
110
|
+
* await agent.addSkill(new GreetingSkill({ message: 'Howdy!' }));
|
|
44
111
|
* ```
|
|
45
112
|
*
|
|
46
113
|
* @see {@link SkillManager}
|
|
@@ -51,7 +118,7 @@ export class SkillBase {
|
|
|
51
118
|
/**
|
|
52
119
|
* Unique skill name. Subclasses MUST override with a non-empty string.
|
|
53
120
|
*
|
|
54
|
-
* Python
|
|
121
|
+
* Python equivalent:`SKILL_NAME: str = None` at `core/skill_base.py:23`.
|
|
55
122
|
* Python raises `ValueError` in `__init__` when this is left as `None`;
|
|
56
123
|
* TS throws at construction when this is left as the empty default.
|
|
57
124
|
*/
|
|
@@ -59,19 +126,19 @@ export class SkillBase {
|
|
|
59
126
|
/**
|
|
60
127
|
* Human-readable description of the skill. Subclasses MUST override.
|
|
61
128
|
*
|
|
62
|
-
* Python
|
|
129
|
+
* Python equivalent:`SKILL_DESCRIPTION: str = None` at `core/skill_base.py:24`.
|
|
63
130
|
*/
|
|
64
131
|
static SKILL_DESCRIPTION = '';
|
|
65
132
|
/**
|
|
66
133
|
* Semantic version string. Subclasses may override; defaults to `"1.0.0"`.
|
|
67
134
|
*
|
|
68
|
-
* Python
|
|
135
|
+
* Python equivalent:`SKILL_VERSION: str = "1.0.0"` at `core/skill_base.py:25`.
|
|
69
136
|
*/
|
|
70
137
|
static SKILL_VERSION = '1.0.0';
|
|
71
138
|
/**
|
|
72
139
|
* Packages required by the skill, checked at load time by `validatePackages()`.
|
|
73
140
|
*
|
|
74
|
-
* Python
|
|
141
|
+
* Python equivalent:`REQUIRED_PACKAGES: List[str] = []` at `core/skill_base.py:26`.
|
|
75
142
|
* In TS these are npm package names importable via dynamic `import()`.
|
|
76
143
|
*/
|
|
77
144
|
static REQUIRED_PACKAGES = [];
|
|
@@ -79,13 +146,13 @@ export class SkillBase {
|
|
|
79
146
|
* Environment variables required for the skill to function, checked at load
|
|
80
147
|
* time by `validateEnvVars()`.
|
|
81
148
|
*
|
|
82
|
-
* Python
|
|
149
|
+
* Python equivalent:`REQUIRED_ENV_VARS: List[str] = []` at `core/skill_base.py:27`.
|
|
83
150
|
*/
|
|
84
151
|
static REQUIRED_ENV_VARS = [];
|
|
85
152
|
/**
|
|
86
153
|
* Whether this skill type supports multiple simultaneous instances (e.g., with different tool_name).
|
|
87
154
|
*
|
|
88
|
-
* Python
|
|
155
|
+
* Python equivalent:`SUPPORTS_MULTIPLE_INSTANCES: bool = False` at `core/skill_base.py:30`.
|
|
89
156
|
*/
|
|
90
157
|
static SUPPORTS_MULTIPLE_INSTANCES = false;
|
|
91
158
|
/**
|
|
@@ -142,6 +209,10 @@ export class SkillBase {
|
|
|
142
209
|
* constructor. In the TypeScript SDK the SkillManager always calls
|
|
143
210
|
* `setAgent()` before `setup()`, so subclasses can rely on `getAgent()` being
|
|
144
211
|
* safe to call inside `setup()` and any method invoked after it.
|
|
212
|
+
*
|
|
213
|
+
* Readable by anyone holding the skill, so a test or an introspection tool can
|
|
214
|
+
* check which agent a skill was bound to. Subclasses that need a guaranteed
|
|
215
|
+
* non-null agent should still prefer the asserting {@link getAgent}.
|
|
145
216
|
*/
|
|
146
217
|
agent;
|
|
147
218
|
/**
|
|
@@ -153,7 +224,7 @@ export class SkillBase {
|
|
|
153
224
|
/**
|
|
154
225
|
* Tools registered imperatively via `defineTool()`.
|
|
155
226
|
*
|
|
156
|
-
* Python
|
|
227
|
+
* Python equivalent:Python's `SkillBase.register_tools()` is a `@abstractmethod` that
|
|
157
228
|
* calls `self.agent.define_tool(...)` (or `self.define_tool(...)`) once per tool.
|
|
158
229
|
* In TypeScript the tool pipeline is declarative (pull model): `SkillManager`
|
|
159
230
|
* calls `getTools()` at SWML render time. Skills that want to build their tool
|
|
@@ -182,10 +253,22 @@ export class SkillBase {
|
|
|
182
253
|
}
|
|
183
254
|
return this.agent;
|
|
184
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* The configuration this skill was constructed with — the reference's public
|
|
258
|
+
* `self.params` (`core/skill_base.py:40`), read-only.
|
|
259
|
+
*
|
|
260
|
+
* `swaig_fields` is absent: the constructor pops it into {@link swaigFields},
|
|
261
|
+
* mirroring the reference's `self.swaig_fields = self.params.pop(...)`
|
|
262
|
+
* (`core/skill_base.py:44`). Use {@link getConfig} for a single typed key; this
|
|
263
|
+
* returns the whole map, which is what the reference attribute exposes.
|
|
264
|
+
*/
|
|
265
|
+
get params() {
|
|
266
|
+
return this.config;
|
|
267
|
+
}
|
|
185
268
|
/**
|
|
186
269
|
* Create a new skill instance.
|
|
187
270
|
*
|
|
188
|
-
* Python
|
|
271
|
+
* Python equivalent:`core/skill_base.py:32-43`.
|
|
189
272
|
* Python `__init__` raises `ValueError` if `SKILL_NAME` or `SKILL_DESCRIPTION`
|
|
190
273
|
* is left as `None` on the subclass. TS throws the equivalent when the static
|
|
191
274
|
* defaults haven't been overridden.
|
|
@@ -226,7 +309,7 @@ export class SkillBase {
|
|
|
226
309
|
* `defineTool()`. Skills using the declarative pattern override this
|
|
227
310
|
* method to return a static array built from their config.
|
|
228
311
|
*
|
|
229
|
-
* Python
|
|
312
|
+
* Python equivalent:replaces the `@abstractmethod register_tools()` contract
|
|
230
313
|
* — Python skills call `self.define_tool(...)` inside `register_tools()`;
|
|
231
314
|
* TypeScript skills either call `this.defineTool(...)` in `setup()` (and
|
|
232
315
|
* let the default `getTools()` return them) or override `getTools()`
|
|
@@ -240,7 +323,7 @@ export class SkillBase {
|
|
|
240
323
|
/**
|
|
241
324
|
* Imperatively register a tool with this skill.
|
|
242
325
|
*
|
|
243
|
-
* Python
|
|
326
|
+
* Python equivalent:`core/skill_base.py:58` `def define_tool(self, **kwargs)`.
|
|
244
327
|
* Merges `this.swaigFields` into the tool definition (explicit fields on
|
|
245
328
|
* `toolDef` take precedence), then pushes the result into `_dynamicTools`
|
|
246
329
|
* so the default `getTools()` returns it at SWML render time.
|
|
@@ -368,7 +451,7 @@ export class SkillBase {
|
|
|
368
451
|
* Validate that all required environment variables declared on the skill class
|
|
369
452
|
* are set in the current process environment.
|
|
370
453
|
*
|
|
371
|
-
* Python
|
|
454
|
+
* Python equivalent:`core/skill_base.py:103-110` reads `self.REQUIRED_ENV_VARS`
|
|
372
455
|
* directly. TS reads the same static from the class.
|
|
373
456
|
*
|
|
374
457
|
* Returns the list of missing variable names so callers can produce actionable
|
|
@@ -436,7 +519,7 @@ export class SkillBase {
|
|
|
436
519
|
/**
|
|
437
520
|
* Validate that all required packages declared on the skill class can be imported.
|
|
438
521
|
*
|
|
439
|
-
* Python
|
|
522
|
+
* Python equivalent:`core/skill_base.py:112-124` reads `self.REQUIRED_PACKAGES`
|
|
440
523
|
* directly and tries `importlib.import_module(pkg)` for each; TS does the
|
|
441
524
|
* equivalent with a dynamic `import()`.
|
|
442
525
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkillBase.js","sourceRoot":"","sources":["../../src/skills/SkillBase.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"SkillBase.js","sourceRoot":"","sources":["../../src/skills/SkillBase.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,EAAE,SAAS,EAAe,MAAM,cAAc,CAAC;AAqCtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,UAAU,eAAe,CAI7B,OAYC;IAED,OAAO;QACL,GAAG,OAAO;QACV,UAAU,EAAE,OAAO,CAAC,UAAiD;QACrE,QAAQ,EAAE,OAAO,CAAC,QAAgC;QAClD,uEAAuE;QACvE,0EAA0E;QAC1E,8DAA8D;QAC9D,OAAO,EAAE,OAAO,CAAC,OAAuB;KACzC,CAAC;AACJ,CAAC;AAsCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,OAAgB,SAAS;IAC7B;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,GAAW,EAAE,CAAC;IAE/B;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,GAAW,EAAE,CAAC;IAEtC;;;;OAIG;IACH,MAAM,CAAC,aAAa,GAAW,OAAO,CAAC;IAEvC;;;;;OAKG;IACH,MAAM,CAAC,iBAA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illBase, type SkillConfig } from './SkillBase.js';
|
|
8
|
+
import type { AgentBase } from '../AgentBase.js';
|
|
8
9
|
/**
|
|
9
10
|
* Manages the lifecycle of skills attached to an agent.
|
|
10
11
|
*
|
|
@@ -12,23 +13,49 @@ import { SkillBase, type SkillConfig } from './SkillBase.js';
|
|
|
12
13
|
* hints, global data, and prompt sections.
|
|
13
14
|
*
|
|
14
15
|
* @remarks
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `
|
|
16
|
+
* `AgentBase` owns a manager (`agent.skillManager`). {@link addSkill} only
|
|
17
|
+
* checks, sets up and records a skill: `AgentBase.addSkill()` calls it, then
|
|
18
|
+
* registers the skill's tools, prompt sections, hints and global data on the
|
|
19
|
+
* agent. {@link loadSkill} and {@link loadSkillByName} on a manager that
|
|
20
|
+
* belongs to an agent go through `AgentBase.addSkill()`, so the skill is
|
|
21
|
+
* registered on the agent as well, as Python's `SkillManager.load_skill()`
|
|
22
|
+
* does (`core/skill_manager.py`). On a standalone manager they only record
|
|
23
|
+
* the skill.
|
|
20
24
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* calls `getAllHints()`, `getMergedGlobalData()`, and `getAllPromptSections()`
|
|
24
|
-
* at render time. Both approaches produce the same observable behavior at the
|
|
25
|
-
* SWML / SWAIG level. The pull model avoids circular-reference issues between
|
|
26
|
-
* `AgentBase` and `SkillManager` and is better suited to TypeScript's
|
|
27
|
-
* import-graph constraints.
|
|
25
|
+
* The owning agent is kept as a public back-reference ({@link agent}), the
|
|
26
|
+
* reference's readable `self.agent` (`core/skill_manager.py:22`).
|
|
28
27
|
*/
|
|
29
28
|
export declare class SkillManager {
|
|
30
29
|
private skills;
|
|
31
30
|
private skillMeta;
|
|
31
|
+
/** Instance keys taken over from another manager by {@link _inheritFrom}. */
|
|
32
|
+
private inherited;
|
|
33
|
+
/**
|
|
34
|
+
* The agent this manager belongs to (the reference's public `self.agent`), or
|
|
35
|
+
* `undefined` when the manager is used standalone (a bare `new SkillManager()`,
|
|
36
|
+
* as in tests and the doc examples).
|
|
37
|
+
*/
|
|
38
|
+
readonly agent?: AgentBase;
|
|
39
|
+
/**
|
|
40
|
+
* @param agent - Optional owning agent, kept as a public back-reference
|
|
41
|
+
* (the reference's `SkillManager(agent)`). Omit for standalone use.
|
|
42
|
+
*/
|
|
43
|
+
constructor(agent?: AgentBase);
|
|
44
|
+
/**
|
|
45
|
+
* Start with the skills another manager has loaded, for a per-request copy
|
|
46
|
+
* of its agent. The skill instances are shared and not set up again: their
|
|
47
|
+
* tools, hints, prompt sections and global data are already in the agent
|
|
48
|
+
* the copy was made from. Removing an inherited skill from this manager
|
|
49
|
+
* drops it here without cleaning up the shared instance.
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
_inheritFrom(other: SkillManager): void;
|
|
53
|
+
/**
|
|
54
|
+
* Whether `skill`'s instance is one {@link _inheritFrom} took over, so
|
|
55
|
+
* adding it again is a no-op.
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
_inherits(skill: SkillBase): boolean;
|
|
32
59
|
/**
|
|
33
60
|
* Public read-only view of all loaded skill instances, keyed by instance key.
|
|
34
61
|
* Python equivalent: `self.loaded_skills` (public `Dict[str, SkillBase]`).
|
|
@@ -38,7 +65,9 @@ export declare class SkillManager {
|
|
|
38
65
|
get loadedSkills(): ReadonlyMap<string, SkillBase>;
|
|
39
66
|
/**
|
|
40
67
|
* Add a skill to the manager, validating env vars and calling setup().
|
|
41
|
-
* Uses the skill's instance key for deduplication.
|
|
68
|
+
* Uses the skill's instance key for deduplication. This records the skill
|
|
69
|
+
* only; it doesn't register the skill's tools on the agent. Use
|
|
70
|
+
* {@link loadSkill}, or `AgentBase.addSkill()`, for that.
|
|
42
71
|
*
|
|
43
72
|
* {@link loadSkill} / {@link loadSkillByName} wrap this and catch to return
|
|
44
73
|
* `[false, msg]`, matching Python `load_skill`'s return contract
|
|
@@ -90,11 +119,21 @@ export declare class SkillManager {
|
|
|
90
119
|
* `skillManager.hasSkillByKey(key)`.
|
|
91
120
|
*/
|
|
92
121
|
hasSkillByKey(instanceKey: string): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Add a skill and, when this manager belongs to an agent, register its
|
|
124
|
+
* tools, prompt sections, hints and global data there, through
|
|
125
|
+
* `AgentBase.addSkill()` (which calls {@link addSkill}).
|
|
126
|
+
*/
|
|
127
|
+
private addAndRegister;
|
|
93
128
|
/**
|
|
94
129
|
* Load a skill by providing the class constructor directly, bypassing the registry.
|
|
95
130
|
* This is the TypeScript equivalent of Python's `load_skill(skill_name, skill_class, params)`
|
|
96
131
|
* path where a caller-provided `skill_class` is used instead of a registry lookup.
|
|
97
132
|
*
|
|
133
|
+
* On a manager that belongs to an agent, the skill's tools, prompt sections,
|
|
134
|
+
* hints and global data are registered on that agent, as with
|
|
135
|
+
* `agent.addSkill()`.
|
|
136
|
+
*
|
|
98
137
|
* @param skillClass - The skill class constructor (a subclass of `SkillBase`).
|
|
99
138
|
* @param config - Optional configuration to pass to the skill constructor.
|
|
100
139
|
* @returns A tuple `[success, errorMessage]` matching Python's `load_skill` return
|
|
@@ -104,6 +143,17 @@ export declare class SkillManager {
|
|
|
104
143
|
*
|
|
105
144
|
* @example
|
|
106
145
|
* ```ts
|
|
146
|
+
* import { SkillManager, SkillBase, type SkillToolDefinition } from '@signalwire/sdk';
|
|
147
|
+
*
|
|
148
|
+
* class MyCustomSkill extends SkillBase {
|
|
149
|
+
* static override SKILL_NAME = 'my_custom';
|
|
150
|
+
* static override SKILL_DESCRIPTION = 'Example custom skill.';
|
|
151
|
+
* override getTools(): SkillToolDefinition[] {
|
|
152
|
+
* return [];
|
|
153
|
+
* }
|
|
154
|
+
* }
|
|
155
|
+
*
|
|
156
|
+
* const manager = new SkillManager();
|
|
107
157
|
* const [ok, err] = await manager.loadSkill(MyCustomSkill, { api_key: 'secret' });
|
|
108
158
|
* if (!ok) console.error(err);
|
|
109
159
|
* ```
|
|
@@ -114,6 +164,9 @@ export declare class SkillManager {
|
|
|
114
164
|
* This is the TypeScript equivalent of Python's `load_skill(skill_name)` path
|
|
115
165
|
* where `skill_class=None` triggers a registry lookup.
|
|
116
166
|
*
|
|
167
|
+
* On a manager that belongs to an agent, the skill is registered on that
|
|
168
|
+
* agent, as with {@link loadSkill}.
|
|
169
|
+
*
|
|
117
170
|
* @param skillName - The registered skill name to look up in the SkillRegistry.
|
|
118
171
|
* @param config - Optional configuration to pass to the skill factory.
|
|
119
172
|
* @returns A tuple `[success, errorMessage]` matching Python's `load_skill` return
|