@wingman-ai/gateway 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/dist/agent/backend/filtered-backend.cjs +130 -0
  2. package/dist/agent/backend/filtered-backend.d.ts +10 -0
  3. package/dist/agent/backend/filtered-backend.js +87 -0
  4. package/dist/agent/config/agentConfig.cjs +4 -0
  5. package/dist/agent/config/agentConfig.d.ts +12 -0
  6. package/dist/agent/config/agentConfig.js +4 -0
  7. package/dist/agent/config/toolRegistry.cjs +75 -1
  8. package/dist/agent/config/toolRegistry.d.ts +3 -0
  9. package/dist/agent/config/toolRegistry.js +75 -1
  10. package/dist/agent/middleware/additional-messages.cjs +4 -1
  11. package/dist/agent/middleware/additional-messages.js +4 -1
  12. package/dist/agent/middleware/large-tool-results.cjs +207 -0
  13. package/dist/agent/middleware/large-tool-results.d.ts +16 -0
  14. package/dist/agent/middleware/large-tool-results.js +173 -0
  15. package/dist/agent/tools/browser_control.cjs +9 -1231
  16. package/dist/agent/tools/browser_control.d.ts +126 -234
  17. package/dist/agent/tools/browser_control.js +7 -1226
  18. package/dist/agent/tools/browser_runtime.cjs +1358 -0
  19. package/dist/agent/tools/browser_runtime.d.ts +617 -0
  20. package/dist/agent/tools/browser_runtime.js +1288 -0
  21. package/dist/agent/tools/browser_session.cjs +189 -0
  22. package/dist/agent/tools/browser_session.d.ts +686 -0
  23. package/dist/agent/tools/browser_session.js +146 -0
  24. package/dist/agent/tools/browser_session_manager.cjs +213 -0
  25. package/dist/agent/tools/browser_session_manager.d.ts +70 -0
  26. package/dist/agent/tools/browser_session_manager.js +176 -0
  27. package/dist/cli/commands/init.cjs +80 -98
  28. package/dist/cli/commands/init.js +80 -98
  29. package/dist/cli/config/loader.cjs +0 -5
  30. package/dist/cli/config/loader.js +0 -5
  31. package/dist/cli/config/schema.cjs +3 -7
  32. package/dist/cli/config/schema.d.ts +6 -6
  33. package/dist/cli/config/schema.js +3 -7
  34. package/dist/cli/core/agentInvoker.cjs +88 -22
  35. package/dist/cli/core/agentInvoker.d.ts +10 -3
  36. package/dist/cli/core/agentInvoker.js +88 -25
  37. package/dist/cli/core/outputManager.cjs +7 -2
  38. package/dist/cli/core/outputManager.d.ts +2 -2
  39. package/dist/cli/core/outputManager.js +7 -2
  40. package/dist/cli/core/sessionManager.cjs +208 -41
  41. package/dist/cli/core/sessionManager.d.ts +20 -0
  42. package/dist/cli/core/sessionManager.js +208 -41
  43. package/dist/cli/index.cjs +16 -1
  44. package/dist/cli/index.js +16 -1
  45. package/dist/cli/services/updateCheck.cjs +212 -0
  46. package/dist/cli/services/updateCheck.d.ts +26 -0
  47. package/dist/cli/services/updateCheck.js +166 -0
  48. package/dist/cli/types.d.ts +2 -1
  49. package/dist/gateway/server.cjs +7 -0
  50. package/dist/gateway/server.js +7 -0
  51. package/dist/webui/assets/index-D3x3G75t.css +11 -0
  52. package/dist/webui/assets/index-UpMmcU1f.js +215 -0
  53. package/dist/webui/index.html +2 -2
  54. package/package.json +12 -12
  55. package/templates/agents/README.md +3 -1
  56. package/templates/agents/coding/agent.md +6 -13
  57. package/templates/agents/coding-v2/agent.md +6 -1
  58. package/templates/agents/game-dev/agent.md +9 -2
  59. package/templates/agents/game-dev/game-designer.md +4 -0
  60. package/templates/agents/game-dev/scene-engineer.md +4 -0
  61. package/templates/agents/main/agent.md +7 -2
  62. package/templates/agents/researcher/agent.md +14 -3
  63. package/templates/agents/stock-trader/agent.md +4 -0
  64. package/dist/agent/tests/agentConfig.test.cjs +0 -224
  65. package/dist/agent/tests/agentConfig.test.d.ts +0 -1
  66. package/dist/agent/tests/agentConfig.test.js +0 -218
  67. package/dist/agent/tests/agentLoader.test.cjs +0 -335
  68. package/dist/agent/tests/agentLoader.test.d.ts +0 -1
  69. package/dist/agent/tests/agentLoader.test.js +0 -329
  70. package/dist/agent/tests/backgroundTerminal.test.cjs +0 -70
  71. package/dist/agent/tests/backgroundTerminal.test.d.ts +0 -1
  72. package/dist/agent/tests/backgroundTerminal.test.js +0 -64
  73. package/dist/agent/tests/browserControlHelpers.test.cjs +0 -35
  74. package/dist/agent/tests/browserControlHelpers.test.d.ts +0 -1
  75. package/dist/agent/tests/browserControlHelpers.test.js +0 -29
  76. package/dist/agent/tests/browserControlTool.test.cjs +0 -2117
  77. package/dist/agent/tests/browserControlTool.test.d.ts +0 -1
  78. package/dist/agent/tests/browserControlTool.test.js +0 -2111
  79. package/dist/agent/tests/commandExecuteTool.test.cjs +0 -29
  80. package/dist/agent/tests/commandExecuteTool.test.d.ts +0 -1
  81. package/dist/agent/tests/commandExecuteTool.test.js +0 -23
  82. package/dist/agent/tests/internet_search.test.cjs +0 -107
  83. package/dist/agent/tests/internet_search.test.d.ts +0 -1
  84. package/dist/agent/tests/internet_search.test.js +0 -101
  85. package/dist/agent/tests/mcpClientManager.test.cjs +0 -290
  86. package/dist/agent/tests/mcpClientManager.test.d.ts +0 -1
  87. package/dist/agent/tests/mcpClientManager.test.js +0 -284
  88. package/dist/agent/tests/mcpResourceTools.test.cjs +0 -101
  89. package/dist/agent/tests/mcpResourceTools.test.d.ts +0 -1
  90. package/dist/agent/tests/mcpResourceTools.test.js +0 -95
  91. package/dist/agent/tests/modelFactory.test.cjs +0 -190
  92. package/dist/agent/tests/modelFactory.test.d.ts +0 -1
  93. package/dist/agent/tests/modelFactory.test.js +0 -184
  94. package/dist/agent/tests/terminalSessionManager.test.cjs +0 -121
  95. package/dist/agent/tests/terminalSessionManager.test.d.ts +0 -1
  96. package/dist/agent/tests/terminalSessionManager.test.js +0 -115
  97. package/dist/agent/tests/test-agent-loader.cjs +0 -33
  98. package/dist/agent/tests/test-agent-loader.d.ts +0 -1
  99. package/dist/agent/tests/test-agent-loader.js +0 -27
  100. package/dist/agent/tests/test-subagent-loading.cjs +0 -99
  101. package/dist/agent/tests/test-subagent-loading.d.ts +0 -1
  102. package/dist/agent/tests/test-subagent-loading.js +0 -93
  103. package/dist/agent/tests/toolRegistry.test.cjs +0 -147
  104. package/dist/agent/tests/toolRegistry.test.d.ts +0 -1
  105. package/dist/agent/tests/toolRegistry.test.js +0 -141
  106. package/dist/agent/tests/uiRegistryTools.test.cjs +0 -114
  107. package/dist/agent/tests/uiRegistryTools.test.d.ts +0 -1
  108. package/dist/agent/tests/uiRegistryTools.test.js +0 -105
  109. package/dist/agent/tests/xaiImageModel.test.cjs +0 -194
  110. package/dist/agent/tests/xaiImageModel.test.d.ts +0 -1
  111. package/dist/agent/tests/xaiImageModel.test.js +0 -188
  112. package/dist/tests/additionalMessageMiddleware.test.cjs +0 -216
  113. package/dist/tests/additionalMessageMiddleware.test.d.ts +0 -1
  114. package/dist/tests/additionalMessageMiddleware.test.js +0 -188
  115. package/dist/tests/agent-config-voice.test.cjs +0 -25
  116. package/dist/tests/agent-config-voice.test.d.ts +0 -1
  117. package/dist/tests/agent-config-voice.test.js +0 -19
  118. package/dist/tests/agentInvokerAttachments.test.cjs +0 -190
  119. package/dist/tests/agentInvokerAttachments.test.d.ts +0 -1
  120. package/dist/tests/agentInvokerAttachments.test.js +0 -184
  121. package/dist/tests/agentInvokerSummarization.test.cjs +0 -613
  122. package/dist/tests/agentInvokerSummarization.test.d.ts +0 -1
  123. package/dist/tests/agentInvokerSummarization.test.js +0 -607
  124. package/dist/tests/agentInvokerTokenUsage.test.cjs +0 -124
  125. package/dist/tests/agentInvokerTokenUsage.test.d.ts +0 -1
  126. package/dist/tests/agentInvokerTokenUsage.test.js +0 -118
  127. package/dist/tests/agentInvokerWorkdir.test.cjs +0 -150
  128. package/dist/tests/agentInvokerWorkdir.test.d.ts +0 -1
  129. package/dist/tests/agentInvokerWorkdir.test.js +0 -122
  130. package/dist/tests/agents-api.test.cjs +0 -324
  131. package/dist/tests/agents-api.test.d.ts +0 -1
  132. package/dist/tests/agents-api.test.js +0 -318
  133. package/dist/tests/attachments-utils.test.cjs +0 -46
  134. package/dist/tests/attachments-utils.test.d.ts +0 -1
  135. package/dist/tests/attachments-utils.test.js +0 -40
  136. package/dist/tests/browser-command.test.cjs +0 -264
  137. package/dist/tests/browser-command.test.d.ts +0 -1
  138. package/dist/tests/browser-command.test.js +0 -258
  139. package/dist/tests/browser-relay-server.test.cjs +0 -20
  140. package/dist/tests/browser-relay-server.test.d.ts +0 -1
  141. package/dist/tests/browser-relay-server.test.js +0 -14
  142. package/dist/tests/bunSqliteAdapter.test.cjs +0 -265
  143. package/dist/tests/bunSqliteAdapter.test.d.ts +0 -1
  144. package/dist/tests/bunSqliteAdapter.test.js +0 -259
  145. package/dist/tests/candleRange.test.cjs +0 -48
  146. package/dist/tests/candleRange.test.d.ts +0 -1
  147. package/dist/tests/candleRange.test.js +0 -42
  148. package/dist/tests/cli-config-loader.test.cjs +0 -532
  149. package/dist/tests/cli-config-loader.test.d.ts +0 -1
  150. package/dist/tests/cli-config-loader.test.js +0 -526
  151. package/dist/tests/cli-config-warnings.test.cjs +0 -94
  152. package/dist/tests/cli-config-warnings.test.d.ts +0 -1
  153. package/dist/tests/cli-config-warnings.test.js +0 -88
  154. package/dist/tests/cli-init.test.cjs +0 -225
  155. package/dist/tests/cli-init.test.d.ts +0 -1
  156. package/dist/tests/cli-init.test.js +0 -219
  157. package/dist/tests/cli-workspace-root.test.cjs +0 -114
  158. package/dist/tests/cli-workspace-root.test.d.ts +0 -1
  159. package/dist/tests/cli-workspace-root.test.js +0 -108
  160. package/dist/tests/codex-credentials-precedence.test.cjs +0 -94
  161. package/dist/tests/codex-credentials-precedence.test.d.ts +0 -1
  162. package/dist/tests/codex-credentials-precedence.test.js +0 -88
  163. package/dist/tests/codex-provider.test.cjs +0 -383
  164. package/dist/tests/codex-provider.test.d.ts +0 -1
  165. package/dist/tests/codex-provider.test.js +0 -377
  166. package/dist/tests/config-json-schema.test.cjs +0 -37
  167. package/dist/tests/config-json-schema.test.d.ts +0 -1
  168. package/dist/tests/config-json-schema.test.js +0 -31
  169. package/dist/tests/discord-adapter.test.cjs +0 -89
  170. package/dist/tests/discord-adapter.test.d.ts +0 -1
  171. package/dist/tests/discord-adapter.test.js +0 -83
  172. package/dist/tests/falRuntime.test.cjs +0 -78
  173. package/dist/tests/falRuntime.test.d.ts +0 -1
  174. package/dist/tests/falRuntime.test.js +0 -72
  175. package/dist/tests/falSummary.test.cjs +0 -51
  176. package/dist/tests/falSummary.test.d.ts +0 -1
  177. package/dist/tests/falSummary.test.js +0 -45
  178. package/dist/tests/fs-api.test.cjs +0 -138
  179. package/dist/tests/fs-api.test.d.ts +0 -1
  180. package/dist/tests/fs-api.test.js +0 -132
  181. package/dist/tests/gateway-command-workspace.test.cjs +0 -150
  182. package/dist/tests/gateway-command-workspace.test.d.ts +0 -1
  183. package/dist/tests/gateway-command-workspace.test.js +0 -144
  184. package/dist/tests/gateway-http-security.test.cjs +0 -318
  185. package/dist/tests/gateway-http-security.test.d.ts +0 -1
  186. package/dist/tests/gateway-http-security.test.js +0 -312
  187. package/dist/tests/gateway-node-mode.test.cjs +0 -174
  188. package/dist/tests/gateway-node-mode.test.d.ts +0 -1
  189. package/dist/tests/gateway-node-mode.test.js +0 -168
  190. package/dist/tests/gateway-origin-policy.test.cjs +0 -82
  191. package/dist/tests/gateway-origin-policy.test.d.ts +0 -1
  192. package/dist/tests/gateway-origin-policy.test.js +0 -76
  193. package/dist/tests/gateway-request-execution-overrides.test.cjs +0 -42
  194. package/dist/tests/gateway-request-execution-overrides.test.d.ts +0 -1
  195. package/dist/tests/gateway-request-execution-overrides.test.js +0 -36
  196. package/dist/tests/gateway.test.cjs +0 -700
  197. package/dist/tests/gateway.test.d.ts +0 -1
  198. package/dist/tests/gateway.test.js +0 -694
  199. package/dist/tests/hooks-matcher.test.cjs +0 -309
  200. package/dist/tests/hooks-matcher.test.d.ts +0 -1
  201. package/dist/tests/hooks-matcher.test.js +0 -303
  202. package/dist/tests/hooks-merger.test.cjs +0 -528
  203. package/dist/tests/hooks-merger.test.d.ts +0 -1
  204. package/dist/tests/hooks-merger.test.js +0 -522
  205. package/dist/tests/imagePersistence.test.cjs +0 -169
  206. package/dist/tests/imagePersistence.test.d.ts +0 -1
  207. package/dist/tests/imagePersistence.test.js +0 -163
  208. package/dist/tests/integration/agent-invocation.integration.test.cjs +0 -264
  209. package/dist/tests/integration/agent-invocation.integration.test.d.ts +0 -1
  210. package/dist/tests/integration/agent-invocation.integration.test.js +0 -258
  211. package/dist/tests/integration/finnhub-candles.integration.test.cjs +0 -98
  212. package/dist/tests/integration/finnhub-candles.integration.test.d.ts +0 -1
  213. package/dist/tests/integration/finnhub-candles.integration.test.js +0 -92
  214. package/dist/tests/integration/summarization-e2e.integration.test.cjs +0 -127
  215. package/dist/tests/integration/summarization-e2e.integration.test.d.ts +0 -1
  216. package/dist/tests/integration/summarization-e2e.integration.test.js +0 -121
  217. package/dist/tests/logger.test.cjs +0 -353
  218. package/dist/tests/logger.test.d.ts +0 -1
  219. package/dist/tests/logger.test.js +0 -347
  220. package/dist/tests/mediaCompatibilityMiddleware.test.cjs +0 -106
  221. package/dist/tests/mediaCompatibilityMiddleware.test.d.ts +0 -1
  222. package/dist/tests/mediaCompatibilityMiddleware.test.js +0 -100
  223. package/dist/tests/node-tools.test.cjs +0 -77
  224. package/dist/tests/node-tools.test.d.ts +0 -1
  225. package/dist/tests/node-tools.test.js +0 -71
  226. package/dist/tests/nodes-api.test.cjs +0 -86
  227. package/dist/tests/nodes-api.test.d.ts +0 -1
  228. package/dist/tests/nodes-api.test.js +0 -80
  229. package/dist/tests/outputManagerContextSummarized.test.cjs +0 -43
  230. package/dist/tests/outputManagerContextSummarized.test.d.ts +0 -1
  231. package/dist/tests/outputManagerContextSummarized.test.js +0 -37
  232. package/dist/tests/provider-command-codex.test.cjs +0 -57
  233. package/dist/tests/provider-command-codex.test.d.ts +0 -1
  234. package/dist/tests/provider-command-codex.test.js +0 -51
  235. package/dist/tests/routines-api.test.cjs +0 -107
  236. package/dist/tests/routines-api.test.d.ts +0 -1
  237. package/dist/tests/routines-api.test.js +0 -101
  238. package/dist/tests/run-terminal-bench-official-script.test.cjs +0 -61
  239. package/dist/tests/run-terminal-bench-official-script.test.d.ts +0 -1
  240. package/dist/tests/run-terminal-bench-official-script.test.js +0 -55
  241. package/dist/tests/sessionManager-uionly.test.cjs +0 -50
  242. package/dist/tests/sessionManager-uionly.test.d.ts +0 -1
  243. package/dist/tests/sessionManager-uionly.test.js +0 -44
  244. package/dist/tests/sessionMessageAttachments.test.cjs +0 -197
  245. package/dist/tests/sessionMessageAttachments.test.d.ts +0 -1
  246. package/dist/tests/sessionMessageAttachments.test.js +0 -191
  247. package/dist/tests/sessionMessageRole.test.cjs +0 -44
  248. package/dist/tests/sessionMessageRole.test.d.ts +0 -1
  249. package/dist/tests/sessionMessageRole.test.js +0 -38
  250. package/dist/tests/sessionStateMessages.test.cjs +0 -236
  251. package/dist/tests/sessionStateMessages.test.d.ts +0 -1
  252. package/dist/tests/sessionStateMessages.test.js +0 -230
  253. package/dist/tests/sessions-api.test.cjs +0 -250
  254. package/dist/tests/sessions-api.test.d.ts +0 -1
  255. package/dist/tests/sessions-api.test.js +0 -244
  256. package/dist/tests/skill-activation.test.cjs +0 -86
  257. package/dist/tests/skill-activation.test.d.ts +0 -1
  258. package/dist/tests/skill-activation.test.js +0 -80
  259. package/dist/tests/skill-metadata.test.cjs +0 -119
  260. package/dist/tests/skill-metadata.test.d.ts +0 -1
  261. package/dist/tests/skill-metadata.test.js +0 -113
  262. package/dist/tests/skill-repository.test.cjs +0 -469
  263. package/dist/tests/skill-repository.test.d.ts +0 -1
  264. package/dist/tests/skill-repository.test.js +0 -463
  265. package/dist/tests/skill-security-scanner.test.cjs +0 -126
  266. package/dist/tests/skill-security-scanner.test.d.ts +0 -1
  267. package/dist/tests/skill-security-scanner.test.js +0 -120
  268. package/dist/tests/sms-api.test.cjs +0 -183
  269. package/dist/tests/sms-api.test.d.ts +0 -1
  270. package/dist/tests/sms-api.test.js +0 -177
  271. package/dist/tests/sms-commands.test.cjs +0 -90
  272. package/dist/tests/sms-commands.test.d.ts +0 -1
  273. package/dist/tests/sms-commands.test.js +0 -84
  274. package/dist/tests/sms-policy-store.test.cjs +0 -69
  275. package/dist/tests/sms-policy-store.test.d.ts +0 -1
  276. package/dist/tests/sms-policy-store.test.js +0 -63
  277. package/dist/tests/teams-adapter.test.cjs +0 -58
  278. package/dist/tests/teams-adapter.test.d.ts +0 -1
  279. package/dist/tests/teams-adapter.test.js +0 -52
  280. package/dist/tests/technicalIndicators.test.cjs +0 -82
  281. package/dist/tests/technicalIndicators.test.d.ts +0 -1
  282. package/dist/tests/technicalIndicators.test.js +0 -76
  283. package/dist/tests/terminal-bench-adapters-helpers.test.cjs +0 -64
  284. package/dist/tests/terminal-bench-adapters-helpers.test.d.ts +0 -1
  285. package/dist/tests/terminal-bench-adapters-helpers.test.js +0 -58
  286. package/dist/tests/terminal-bench-cleanup.test.cjs +0 -93
  287. package/dist/tests/terminal-bench-cleanup.test.d.ts +0 -1
  288. package/dist/tests/terminal-bench-cleanup.test.js +0 -87
  289. package/dist/tests/terminal-bench-config.test.cjs +0 -62
  290. package/dist/tests/terminal-bench-config.test.d.ts +0 -1
  291. package/dist/tests/terminal-bench-config.test.js +0 -56
  292. package/dist/tests/terminal-bench-official.test.cjs +0 -194
  293. package/dist/tests/terminal-bench-official.test.d.ts +0 -1
  294. package/dist/tests/terminal-bench-official.test.js +0 -188
  295. package/dist/tests/terminal-bench-runner.test.cjs +0 -82
  296. package/dist/tests/terminal-bench-runner.test.d.ts +0 -1
  297. package/dist/tests/terminal-bench-runner.test.js +0 -76
  298. package/dist/tests/terminal-bench-scoring.test.cjs +0 -128
  299. package/dist/tests/terminal-bench-scoring.test.d.ts +0 -1
  300. package/dist/tests/terminal-bench-scoring.test.js +0 -122
  301. package/dist/tests/terminalProbe.test.cjs +0 -45
  302. package/dist/tests/terminalProbe.test.d.ts +0 -1
  303. package/dist/tests/terminalProbe.test.js +0 -39
  304. package/dist/tests/terminalProbeAuth.test.cjs +0 -85
  305. package/dist/tests/terminalProbeAuth.test.d.ts +0 -1
  306. package/dist/tests/terminalProbeAuth.test.js +0 -79
  307. package/dist/tests/toolDisplayHelpers.test.cjs +0 -46
  308. package/dist/tests/toolDisplayHelpers.test.d.ts +0 -1
  309. package/dist/tests/toolDisplayHelpers.test.js +0 -40
  310. package/dist/tests/uv.test.cjs +0 -47
  311. package/dist/tests/uv.test.d.ts +0 -1
  312. package/dist/tests/uv.test.js +0 -41
  313. package/dist/tests/voice-config.test.cjs +0 -35
  314. package/dist/tests/voice-config.test.d.ts +0 -1
  315. package/dist/tests/voice-config.test.js +0 -29
  316. package/dist/tests/websocket-transport.test.cjs +0 -31
  317. package/dist/tests/websocket-transport.test.d.ts +0 -1
  318. package/dist/tests/websocket-transport.test.js +0 -25
  319. package/dist/tests/yahooCandles.test.cjs +0 -111
  320. package/dist/tests/yahooCandles.test.d.ts +0 -1
  321. package/dist/tests/yahooCandles.test.js +0 -105
  322. package/dist/tools/finance/optionsAnalytics.test.cjs +0 -128
  323. package/dist/tools/finance/optionsAnalytics.test.d.ts +0 -1
  324. package/dist/tools/finance/optionsAnalytics.test.js +0 -122
  325. package/dist/webui/assets/index-BMf95nv5.js +0 -215
  326. package/dist/webui/assets/index-DhJQ8Mbn.css +0 -11
  327. package/dist/webui/assets/wingman_logo-Cogyt3qm.webp +0 -0
@@ -1,120 +0,0 @@
1
- import { EventEmitter } from "node:events";
2
- import { beforeEach, describe, expect, it, vi } from "vitest";
3
- import { scanSkillDirectory } from "../cli/services/skillSecurityScanner.js";
4
- const { mockSpawn, mockEnsureUvAvailableForFeature } = vi.hoisted(()=>({
5
- mockSpawn: vi.fn(),
6
- mockEnsureUvAvailableForFeature: vi.fn()
7
- }));
8
- vi.mock("node:child_process", ()=>({
9
- spawn: mockSpawn
10
- }));
11
- vi.mock("@/utils/uv.js", ()=>({
12
- ensureUvAvailableForFeature: mockEnsureUvAvailableForFeature
13
- }));
14
- const createMockChildProcess = (input)=>{
15
- const child = new EventEmitter();
16
- child.stdout = new EventEmitter();
17
- child.stderr = new EventEmitter();
18
- queueMicrotask(()=>{
19
- if (input.stdout) child.stdout.emit("data", Buffer.from(input.stdout));
20
- if (input.stderr) child.stderr.emit("data", Buffer.from(input.stderr));
21
- child.emit("close", input.exitCode);
22
- });
23
- return child;
24
- };
25
- const createLogger = ()=>({
26
- debug: vi.fn(),
27
- info: vi.fn(),
28
- warn: vi.fn(),
29
- error: vi.fn()
30
- });
31
- describe("skill security scanner", ()=>{
32
- beforeEach(()=>{
33
- mockSpawn.mockReset();
34
- mockEnsureUvAvailableForFeature.mockReset();
35
- });
36
- it("skips execution when scanOnInstall is disabled", async ()=>{
37
- const logger = createLogger();
38
- await scanSkillDirectory("/tmp/skill", logger, {
39
- scanOnInstall: false
40
- });
41
- expect(mockEnsureUvAvailableForFeature).not.toHaveBeenCalled();
42
- expect(mockSpawn).not.toHaveBeenCalled();
43
- });
44
- it("blocks installation when blocking issue codes are reported", async ()=>{
45
- const logger = createLogger();
46
- mockSpawn.mockReturnValue(createMockChildProcess({
47
- exitCode: 0,
48
- stdout: JSON.stringify({
49
- "/tmp/skill": {
50
- issues: [
51
- {
52
- code: "MCP501",
53
- message: "dangerous behavior"
54
- }
55
- ]
56
- }
57
- })
58
- }));
59
- await expect(scanSkillDirectory("/tmp/skill", logger, {
60
- scannerCommand: "uvx",
61
- scannerArgs: [
62
- "scan",
63
- "--json"
64
- ],
65
- blockIssueCodes: [
66
- "MCP501"
67
- ]
68
- })).rejects.toThrow(/MCP501/);
69
- expect(mockEnsureUvAvailableForFeature).toHaveBeenCalledWith("uvx", "skills.security.scanOnInstall");
70
- expect(mockSpawn).toHaveBeenCalledWith("uvx", [
71
- "scan",
72
- "--json",
73
- "/tmp/skill"
74
- ], expect.objectContaining({
75
- stdio: [
76
- "ignore",
77
- "pipe",
78
- "pipe"
79
- ]
80
- }));
81
- });
82
- it("logs non-blocking issues and continues", async ()=>{
83
- const logger = createLogger();
84
- mockSpawn.mockReturnValue(createMockChildProcess({
85
- exitCode: 0,
86
- stdout: JSON.stringify({
87
- "/tmp/skill": {
88
- issues: [
89
- {
90
- code: "MCP999",
91
- message: "informational"
92
- }
93
- ]
94
- }
95
- })
96
- }));
97
- await expect(scanSkillDirectory("/tmp/skill", logger, {
98
- blockIssueCodes: [
99
- "MCP501"
100
- ]
101
- })).resolves.toBeUndefined();
102
- expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining("MCP999"));
103
- });
104
- it("parses JSON output when scanner emits extra log lines", async ()=>{
105
- const logger = createLogger();
106
- mockSpawn.mockReturnValue(createMockChildProcess({
107
- exitCode: 0,
108
- stdout: "scanner starting\n{\"/tmp/skill\":{\"issues\":[]}}\nscanner complete"
109
- }));
110
- await expect(scanSkillDirectory("/tmp/skill", logger)).resolves.toBeUndefined();
111
- });
112
- it("fails when the scanner command exits non-zero", async ()=>{
113
- const logger = createLogger();
114
- mockSpawn.mockReturnValue(createMockChildProcess({
115
- exitCode: 2,
116
- stderr: "scan failed"
117
- }));
118
- await expect(scanSkillDirectory("/tmp/skill", logger)).rejects.toThrow(/exit code 2: scan failed/);
119
- });
120
- });
@@ -1,183 +0,0 @@
1
- "use strict";
2
- var __webpack_exports__ = {};
3
- const external_node_fs_namespaceObject = require("node:fs");
4
- const external_node_os_namespaceObject = require("node:os");
5
- const external_node_path_namespaceObject = require("node:path");
6
- const external_vitest_namespaceObject = require("vitest");
7
- const sms_cjs_namespaceObject = require("../gateway/http/sms.cjs");
8
- const requireTempDir = (value)=>{
9
- if (!value) throw new Error("temp dir not initialized");
10
- return value;
11
- };
12
- (0, external_vitest_namespaceObject.describe)("sms policy api", ()=>{
13
- let tempDir = null;
14
- (0, external_vitest_namespaceObject.afterEach)(()=>{
15
- if (!tempDir) return;
16
- (0, external_node_fs_namespaceObject.rmSync)(tempDir, {
17
- recursive: true,
18
- force: true
19
- });
20
- tempDir = null;
21
- });
22
- (0, external_vitest_namespaceObject.it)("updates, fetches, and resets policy records", async ()=>{
23
- tempDir = (0, external_node_fs_namespaceObject.mkdtempSync)((0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), "wingman-sms-api-"));
24
- const store = (0, sms_cjs_namespaceObject.createSmsPolicyStateStore)(()=>requireTempDir(tempDir));
25
- const target = encodeURIComponent("sms-macos:+15555550000");
26
- const ctx = {};
27
- const updateReq = new Request(`http://localhost/api/sms/policies/${target}`, {
28
- method: "PUT",
29
- headers: {
30
- "Content-Type": "application/json"
31
- },
32
- body: JSON.stringify({
33
- stopEnabled: true,
34
- pauseForMs: 120000,
35
- alertMode: "all"
36
- })
37
- });
38
- const updateRes = await (0, sms_cjs_namespaceObject.handleSmsApi)(ctx, store, updateReq, new URL(updateReq.url));
39
- (0, external_vitest_namespaceObject.expect)(updateRes?.status).toBe(200);
40
- const updated = await updateRes?.json();
41
- (0, external_vitest_namespaceObject.expect)(updated.paused).toBe(true);
42
- (0, external_vitest_namespaceObject.expect)(updated.pausedUntil).toBeTypeOf("number");
43
- (0, external_vitest_namespaceObject.expect)(updated.stopEnabled).toBe(true);
44
- (0, external_vitest_namespaceObject.expect)(updated.alertMode).toBe("all");
45
- const getRes = await (0, sms_cjs_namespaceObject.handleSmsApi)(ctx, store, new Request(`http://localhost/api/sms/policies/${target}`, {
46
- method: "GET"
47
- }), new URL(`http://localhost/api/sms/policies/${target}`));
48
- (0, external_vitest_namespaceObject.expect)(getRes?.status).toBe(200);
49
- const listRes = await (0, sms_cjs_namespaceObject.handleSmsApi)(ctx, store, new Request("http://localhost/api/sms/policies", {
50
- method: "GET"
51
- }), new URL("http://localhost/api/sms/policies"));
52
- (0, external_vitest_namespaceObject.expect)(listRes?.status).toBe(200);
53
- const listPayload = await listRes?.json();
54
- (0, external_vitest_namespaceObject.expect)(listPayload.policies).toHaveLength(1);
55
- const deleteRes = await (0, sms_cjs_namespaceObject.handleSmsApi)(ctx, store, new Request(`http://localhost/api/sms/policies/${target}`, {
56
- method: "DELETE"
57
- }), new URL(`http://localhost/api/sms/policies/${target}`));
58
- (0, external_vitest_namespaceObject.expect)(deleteRes?.status).toBe(200);
59
- const reset = await deleteRes?.json();
60
- (0, external_vitest_namespaceObject.expect)(reset.paused).toBe(false);
61
- (0, external_vitest_namespaceObject.expect)(reset.stopEnabled).toBe(false);
62
- });
63
- (0, external_vitest_namespaceObject.it)("applies control commands and leaves non-commands as pass-through text", async ()=>{
64
- tempDir = (0, external_node_fs_namespaceObject.mkdtempSync)((0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), "wingman-sms-api-"));
65
- const store = (0, sms_cjs_namespaceObject.createSmsPolicyStateStore)(()=>requireTempDir(tempDir));
66
- const target = encodeURIComponent("sms-macos:+15555550000");
67
- const ctx = {
68
- router: {
69
- selectAgent: ()=>"main",
70
- buildSessionKey: ()=>"agent:main:sms-macos:dm:+15555550000"
71
- }
72
- };
73
- const pauseReq = new Request(`http://localhost/api/sms/policies/${target}/command`, {
74
- method: "POST",
75
- headers: {
76
- "Content-Type": "application/json"
77
- },
78
- body: JSON.stringify({
79
- text: "PAUSE 2h",
80
- nowMs: 10000
81
- })
82
- });
83
- const pauseRes = await (0, sms_cjs_namespaceObject.handleSmsApi)(ctx, store, pauseReq, new URL(pauseReq.url));
84
- (0, external_vitest_namespaceObject.expect)(pauseRes?.status).toBe(200);
85
- const pausedPayload = await pauseRes?.json();
86
- (0, external_vitest_namespaceObject.expect)(pausedPayload.handled).toBe(true);
87
- (0, external_vitest_namespaceObject.expect)(pausedPayload.command?.name).toBe("pause");
88
- (0, external_vitest_namespaceObject.expect)(pausedPayload.policy.paused).toBe(true);
89
- const textReq = new Request(`http://localhost/api/sms/policies/${target}/command`, {
90
- method: "POST",
91
- headers: {
92
- "Content-Type": "application/json"
93
- },
94
- body: JSON.stringify({
95
- text: "deploy this now"
96
- })
97
- });
98
- const textRes = await (0, sms_cjs_namespaceObject.handleSmsApi)(ctx, store, textReq, new URL(textReq.url));
99
- (0, external_vitest_namespaceObject.expect)(textRes?.status).toBe(200);
100
- const textPayload = await textRes?.json();
101
- (0, external_vitest_namespaceObject.expect)(textPayload.handled).toBe(false);
102
- (0, external_vitest_namespaceObject.expect)(textPayload.passThroughText).toBe("deploy this now");
103
- });
104
- (0, external_vitest_namespaceObject.it)("normalizes inbound messages into command, stopped, or agent results", async ()=>{
105
- tempDir = (0, external_node_fs_namespaceObject.mkdtempSync)((0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), "wingman-sms-api-"));
106
- const store = (0, sms_cjs_namespaceObject.createSmsPolicyStateStore)(()=>requireTempDir(tempDir));
107
- const ctx = {
108
- router: {
109
- selectAgent: ()=>"main",
110
- buildSessionKey: ()=>"agent:main:sms-macos:dm:+15555550000"
111
- }
112
- };
113
- const commandReq = new Request("http://localhost/api/sms/messages", {
114
- method: "POST",
115
- headers: {
116
- "Content-Type": "application/json"
117
- },
118
- body: JSON.stringify({
119
- target: "sms-macos:+15555550000",
120
- text: "HELP"
121
- })
122
- });
123
- const commandRes = await (0, sms_cjs_namespaceObject.handleSmsApi)(ctx, store, commandReq, new URL(commandReq.url));
124
- (0, external_vitest_namespaceObject.expect)(commandRes?.status).toBe(200);
125
- const commandPayload = await commandRes?.json();
126
- (0, external_vitest_namespaceObject.expect)(commandPayload.kind).toBe("command");
127
- (0, external_vitest_namespaceObject.expect)(commandPayload.handled).toBe(true);
128
- const stopReq = new Request("http://localhost/api/sms/messages", {
129
- method: "POST",
130
- headers: {
131
- "Content-Type": "application/json"
132
- },
133
- body: JSON.stringify({
134
- target: "sms-macos:+15555550000",
135
- text: "STOP"
136
- })
137
- });
138
- const stopRes = await (0, sms_cjs_namespaceObject.handleSmsApi)(ctx, store, stopReq, new URL(stopReq.url));
139
- (0, external_vitest_namespaceObject.expect)(stopRes?.status).toBe(200);
140
- const blockedReq = new Request("http://localhost/api/sms/messages", {
141
- method: "POST",
142
- headers: {
143
- "Content-Type": "application/json"
144
- },
145
- body: JSON.stringify({
146
- target: "sms-macos:+15555550000",
147
- text: "summarize my build failures"
148
- })
149
- });
150
- const blockedRes = await (0, sms_cjs_namespaceObject.handleSmsApi)(ctx, store, blockedReq, new URL(blockedReq.url));
151
- (0, external_vitest_namespaceObject.expect)(blockedRes?.status).toBe(200);
152
- const blockedPayload = await blockedRes?.json();
153
- (0, external_vitest_namespaceObject.expect)(blockedPayload.kind).toBe("stopped");
154
- (0, external_vitest_namespaceObject.expect)(blockedPayload.responseText).toContain("stopped");
155
- store.upsert("sms-macos:+15555550000", {
156
- stopEnabled: false
157
- });
158
- const agentReq = new Request("http://localhost/api/sms/messages", {
159
- method: "POST",
160
- headers: {
161
- "Content-Type": "application/json"
162
- },
163
- body: JSON.stringify({
164
- target: "sms-macos:+15555550000",
165
- text: "summarize my build failures",
166
- queueIfBusy: true
167
- })
168
- });
169
- const agentRes = await (0, sms_cjs_namespaceObject.handleSmsApi)(ctx, store, agentReq, new URL(agentReq.url));
170
- (0, external_vitest_namespaceObject.expect)(agentRes?.status).toBe(200);
171
- const agentPayload = await agentRes?.json();
172
- (0, external_vitest_namespaceObject.expect)(agentPayload.kind).toBe("agent");
173
- (0, external_vitest_namespaceObject.expect)(agentPayload.request.agentId).toBe("main");
174
- (0, external_vitest_namespaceObject.expect)(agentPayload.request.content).toBe("summarize my build failures");
175
- (0, external_vitest_namespaceObject.expect)(agentPayload.request.sessionKey).toBe("agent:main:sms-macos:dm:+15555550000");
176
- (0, external_vitest_namespaceObject.expect)(agentPayload.request.routing?.channel).toBe("sms-macos");
177
- (0, external_vitest_namespaceObject.expect)(agentPayload.request.queueIfBusy).toBe(true);
178
- });
179
- });
180
- for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
181
- Object.defineProperty(exports, '__esModule', {
182
- value: true
183
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,177 +0,0 @@
1
- import { mkdtempSync, rmSync } from "node:fs";
2
- import { tmpdir } from "node:os";
3
- import { join } from "node:path";
4
- import { afterEach, describe, expect, it } from "vitest";
5
- import { createSmsPolicyStateStore, handleSmsApi } from "../gateway/http/sms.js";
6
- const requireTempDir = (value)=>{
7
- if (!value) throw new Error("temp dir not initialized");
8
- return value;
9
- };
10
- describe("sms policy api", ()=>{
11
- let tempDir = null;
12
- afterEach(()=>{
13
- if (!tempDir) return;
14
- rmSync(tempDir, {
15
- recursive: true,
16
- force: true
17
- });
18
- tempDir = null;
19
- });
20
- it("updates, fetches, and resets policy records", async ()=>{
21
- tempDir = mkdtempSync(join(tmpdir(), "wingman-sms-api-"));
22
- const store = createSmsPolicyStateStore(()=>requireTempDir(tempDir));
23
- const target = encodeURIComponent("sms-macos:+15555550000");
24
- const ctx = {};
25
- const updateReq = new Request(`http://localhost/api/sms/policies/${target}`, {
26
- method: "PUT",
27
- headers: {
28
- "Content-Type": "application/json"
29
- },
30
- body: JSON.stringify({
31
- stopEnabled: true,
32
- pauseForMs: 120000,
33
- alertMode: "all"
34
- })
35
- });
36
- const updateRes = await handleSmsApi(ctx, store, updateReq, new URL(updateReq.url));
37
- expect(updateRes?.status).toBe(200);
38
- const updated = await updateRes?.json();
39
- expect(updated.paused).toBe(true);
40
- expect(updated.pausedUntil).toBeTypeOf("number");
41
- expect(updated.stopEnabled).toBe(true);
42
- expect(updated.alertMode).toBe("all");
43
- const getRes = await handleSmsApi(ctx, store, new Request(`http://localhost/api/sms/policies/${target}`, {
44
- method: "GET"
45
- }), new URL(`http://localhost/api/sms/policies/${target}`));
46
- expect(getRes?.status).toBe(200);
47
- const listRes = await handleSmsApi(ctx, store, new Request("http://localhost/api/sms/policies", {
48
- method: "GET"
49
- }), new URL("http://localhost/api/sms/policies"));
50
- expect(listRes?.status).toBe(200);
51
- const listPayload = await listRes?.json();
52
- expect(listPayload.policies).toHaveLength(1);
53
- const deleteRes = await handleSmsApi(ctx, store, new Request(`http://localhost/api/sms/policies/${target}`, {
54
- method: "DELETE"
55
- }), new URL(`http://localhost/api/sms/policies/${target}`));
56
- expect(deleteRes?.status).toBe(200);
57
- const reset = await deleteRes?.json();
58
- expect(reset.paused).toBe(false);
59
- expect(reset.stopEnabled).toBe(false);
60
- });
61
- it("applies control commands and leaves non-commands as pass-through text", async ()=>{
62
- tempDir = mkdtempSync(join(tmpdir(), "wingman-sms-api-"));
63
- const store = createSmsPolicyStateStore(()=>requireTempDir(tempDir));
64
- const target = encodeURIComponent("sms-macos:+15555550000");
65
- const ctx = {
66
- router: {
67
- selectAgent: ()=>"main",
68
- buildSessionKey: ()=>"agent:main:sms-macos:dm:+15555550000"
69
- }
70
- };
71
- const pauseReq = new Request(`http://localhost/api/sms/policies/${target}/command`, {
72
- method: "POST",
73
- headers: {
74
- "Content-Type": "application/json"
75
- },
76
- body: JSON.stringify({
77
- text: "PAUSE 2h",
78
- nowMs: 10000
79
- })
80
- });
81
- const pauseRes = await handleSmsApi(ctx, store, pauseReq, new URL(pauseReq.url));
82
- expect(pauseRes?.status).toBe(200);
83
- const pausedPayload = await pauseRes?.json();
84
- expect(pausedPayload.handled).toBe(true);
85
- expect(pausedPayload.command?.name).toBe("pause");
86
- expect(pausedPayload.policy.paused).toBe(true);
87
- const textReq = new Request(`http://localhost/api/sms/policies/${target}/command`, {
88
- method: "POST",
89
- headers: {
90
- "Content-Type": "application/json"
91
- },
92
- body: JSON.stringify({
93
- text: "deploy this now"
94
- })
95
- });
96
- const textRes = await handleSmsApi(ctx, store, textReq, new URL(textReq.url));
97
- expect(textRes?.status).toBe(200);
98
- const textPayload = await textRes?.json();
99
- expect(textPayload.handled).toBe(false);
100
- expect(textPayload.passThroughText).toBe("deploy this now");
101
- });
102
- it("normalizes inbound messages into command, stopped, or agent results", async ()=>{
103
- tempDir = mkdtempSync(join(tmpdir(), "wingman-sms-api-"));
104
- const store = createSmsPolicyStateStore(()=>requireTempDir(tempDir));
105
- const ctx = {
106
- router: {
107
- selectAgent: ()=>"main",
108
- buildSessionKey: ()=>"agent:main:sms-macos:dm:+15555550000"
109
- }
110
- };
111
- const commandReq = new Request("http://localhost/api/sms/messages", {
112
- method: "POST",
113
- headers: {
114
- "Content-Type": "application/json"
115
- },
116
- body: JSON.stringify({
117
- target: "sms-macos:+15555550000",
118
- text: "HELP"
119
- })
120
- });
121
- const commandRes = await handleSmsApi(ctx, store, commandReq, new URL(commandReq.url));
122
- expect(commandRes?.status).toBe(200);
123
- const commandPayload = await commandRes?.json();
124
- expect(commandPayload.kind).toBe("command");
125
- expect(commandPayload.handled).toBe(true);
126
- const stopReq = new Request("http://localhost/api/sms/messages", {
127
- method: "POST",
128
- headers: {
129
- "Content-Type": "application/json"
130
- },
131
- body: JSON.stringify({
132
- target: "sms-macos:+15555550000",
133
- text: "STOP"
134
- })
135
- });
136
- const stopRes = await handleSmsApi(ctx, store, stopReq, new URL(stopReq.url));
137
- expect(stopRes?.status).toBe(200);
138
- const blockedReq = new Request("http://localhost/api/sms/messages", {
139
- method: "POST",
140
- headers: {
141
- "Content-Type": "application/json"
142
- },
143
- body: JSON.stringify({
144
- target: "sms-macos:+15555550000",
145
- text: "summarize my build failures"
146
- })
147
- });
148
- const blockedRes = await handleSmsApi(ctx, store, blockedReq, new URL(blockedReq.url));
149
- expect(blockedRes?.status).toBe(200);
150
- const blockedPayload = await blockedRes?.json();
151
- expect(blockedPayload.kind).toBe("stopped");
152
- expect(blockedPayload.responseText).toContain("stopped");
153
- store.upsert("sms-macos:+15555550000", {
154
- stopEnabled: false
155
- });
156
- const agentReq = new Request("http://localhost/api/sms/messages", {
157
- method: "POST",
158
- headers: {
159
- "Content-Type": "application/json"
160
- },
161
- body: JSON.stringify({
162
- target: "sms-macos:+15555550000",
163
- text: "summarize my build failures",
164
- queueIfBusy: true
165
- })
166
- });
167
- const agentRes = await handleSmsApi(ctx, store, agentReq, new URL(agentReq.url));
168
- expect(agentRes?.status).toBe(200);
169
- const agentPayload = await agentRes?.json();
170
- expect(agentPayload.kind).toBe("agent");
171
- expect(agentPayload.request.agentId).toBe("main");
172
- expect(agentPayload.request.content).toBe("summarize my build failures");
173
- expect(agentPayload.request.sessionKey).toBe("agent:main:sms-macos:dm:+15555550000");
174
- expect(agentPayload.request.routing?.channel).toBe("sms-macos");
175
- expect(agentPayload.request.queueIfBusy).toBe(true);
176
- });
177
- });
@@ -1,90 +0,0 @@
1
- "use strict";
2
- var __webpack_exports__ = {};
3
- const external_vitest_namespaceObject = require("vitest");
4
- const commands_cjs_namespaceObject = require("../gateway/sms/commands.cjs");
5
- (0, external_vitest_namespaceObject.describe)("sms commands", ()=>{
6
- (0, external_vitest_namespaceObject.it)("parses reserved commands as control commands", ()=>{
7
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("help")).toEqual({
8
- type: "command",
9
- command: {
10
- name: "help"
11
- }
12
- });
13
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("STATUS")).toEqual({
14
- type: "command",
15
- command: {
16
- name: "status"
17
- }
18
- });
19
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("resume")).toEqual({
20
- type: "command",
21
- command: {
22
- name: "resume"
23
- }
24
- });
25
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("STOP")).toEqual({
26
- type: "command",
27
- command: {
28
- name: "stop"
29
- }
30
- });
31
- });
32
- (0, external_vitest_namespaceObject.it)("parses pause commands with optional durations", ()=>{
33
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("pause")).toEqual({
34
- type: "command",
35
- command: {
36
- name: "pause",
37
- durationMs: null
38
- }
39
- });
40
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("pause 15m")).toEqual({
41
- type: "command",
42
- command: {
43
- name: "pause",
44
- durationMs: 900000
45
- }
46
- });
47
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("PAUSE 2 H")).toEqual({
48
- type: "command",
49
- command: {
50
- name: "pause",
51
- durationMs: 7200000
52
- }
53
- });
54
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("pause 1d")).toEqual({
55
- type: "command",
56
- command: {
57
- name: "pause",
58
- durationMs: 86400000
59
- }
60
- });
61
- });
62
- (0, external_vitest_namespaceObject.it)("treats invalid command forms as plain text", ()=>{
63
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("pause tomorrow")).toEqual({
64
- type: "text",
65
- content: "pause tomorrow"
66
- });
67
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("pause 0m")).toEqual({
68
- type: "text",
69
- content: "pause 0m"
70
- });
71
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("help me with deploy")).toEqual({
72
- type: "text",
73
- content: "help me with deploy"
74
- });
75
- });
76
- (0, external_vitest_namespaceObject.it)("supports escaping reserved command words", ()=>{
77
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("\\pause")).toEqual({
78
- type: "text",
79
- content: "pause"
80
- });
81
- (0, external_vitest_namespaceObject.expect)((0, commands_cjs_namespaceObject.interpretSmsInboundMessage)("\\STATUS")).toEqual({
82
- type: "text",
83
- content: "STATUS"
84
- });
85
- });
86
- });
87
- for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
88
- Object.defineProperty(exports, '__esModule', {
89
- value: true
90
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,84 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { interpretSmsInboundMessage } from "../gateway/sms/commands.js";
3
- describe("sms commands", ()=>{
4
- it("parses reserved commands as control commands", ()=>{
5
- expect(interpretSmsInboundMessage("help")).toEqual({
6
- type: "command",
7
- command: {
8
- name: "help"
9
- }
10
- });
11
- expect(interpretSmsInboundMessage("STATUS")).toEqual({
12
- type: "command",
13
- command: {
14
- name: "status"
15
- }
16
- });
17
- expect(interpretSmsInboundMessage("resume")).toEqual({
18
- type: "command",
19
- command: {
20
- name: "resume"
21
- }
22
- });
23
- expect(interpretSmsInboundMessage("STOP")).toEqual({
24
- type: "command",
25
- command: {
26
- name: "stop"
27
- }
28
- });
29
- });
30
- it("parses pause commands with optional durations", ()=>{
31
- expect(interpretSmsInboundMessage("pause")).toEqual({
32
- type: "command",
33
- command: {
34
- name: "pause",
35
- durationMs: null
36
- }
37
- });
38
- expect(interpretSmsInboundMessage("pause 15m")).toEqual({
39
- type: "command",
40
- command: {
41
- name: "pause",
42
- durationMs: 900000
43
- }
44
- });
45
- expect(interpretSmsInboundMessage("PAUSE 2 H")).toEqual({
46
- type: "command",
47
- command: {
48
- name: "pause",
49
- durationMs: 7200000
50
- }
51
- });
52
- expect(interpretSmsInboundMessage("pause 1d")).toEqual({
53
- type: "command",
54
- command: {
55
- name: "pause",
56
- durationMs: 86400000
57
- }
58
- });
59
- });
60
- it("treats invalid command forms as plain text", ()=>{
61
- expect(interpretSmsInboundMessage("pause tomorrow")).toEqual({
62
- type: "text",
63
- content: "pause tomorrow"
64
- });
65
- expect(interpretSmsInboundMessage("pause 0m")).toEqual({
66
- type: "text",
67
- content: "pause 0m"
68
- });
69
- expect(interpretSmsInboundMessage("help me with deploy")).toEqual({
70
- type: "text",
71
- content: "help me with deploy"
72
- });
73
- });
74
- it("supports escaping reserved command words", ()=>{
75
- expect(interpretSmsInboundMessage("\\pause")).toEqual({
76
- type: "text",
77
- content: "pause"
78
- });
79
- expect(interpretSmsInboundMessage("\\STATUS")).toEqual({
80
- type: "text",
81
- content: "STATUS"
82
- });
83
- });
84
- });