@tianshu-ai/tianshu 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (917) hide show
  1. package/LICENSE +200 -0
  2. package/README.md +284 -0
  3. package/README.zh-CN.md +136 -0
  4. package/bin/tianshu.mjs +32 -0
  5. package/package.json +60 -0
  6. package/packages/plugin-sdk/dist/agent-loop.d.ts +96 -0
  7. package/packages/plugin-sdk/dist/agent-loop.d.ts.map +1 -0
  8. package/packages/plugin-sdk/dist/agent-loop.js +11 -0
  9. package/packages/plugin-sdk/dist/agent-loop.js.map +1 -0
  10. package/packages/plugin-sdk/dist/capabilities.d.ts +48 -0
  11. package/packages/plugin-sdk/dist/capabilities.d.ts.map +1 -0
  12. package/packages/plugin-sdk/dist/capabilities.js +61 -0
  13. package/packages/plugin-sdk/dist/capabilities.js.map +1 -0
  14. package/packages/plugin-sdk/dist/catalog.d.ts +60 -0
  15. package/packages/plugin-sdk/dist/catalog.d.ts.map +1 -0
  16. package/packages/plugin-sdk/dist/catalog.js +11 -0
  17. package/packages/plugin-sdk/dist/catalog.js.map +1 -0
  18. package/packages/plugin-sdk/dist/client.d.ts +171 -0
  19. package/packages/plugin-sdk/dist/client.d.ts.map +1 -0
  20. package/packages/plugin-sdk/dist/client.js +96 -0
  21. package/packages/plugin-sdk/dist/client.js.map +1 -0
  22. package/packages/plugin-sdk/dist/index.d.ts +9 -0
  23. package/packages/plugin-sdk/dist/index.d.ts.map +1 -0
  24. package/packages/plugin-sdk/dist/index.js +19 -0
  25. package/packages/plugin-sdk/dist/index.js.map +1 -0
  26. package/packages/plugin-sdk/dist/lsp.d.ts +32 -0
  27. package/packages/plugin-sdk/dist/lsp.d.ts.map +1 -0
  28. package/packages/plugin-sdk/dist/lsp.js +19 -0
  29. package/packages/plugin-sdk/dist/lsp.js.map +1 -0
  30. package/packages/plugin-sdk/dist/manifest.d.ts +423 -0
  31. package/packages/plugin-sdk/dist/manifest.d.ts.map +1 -0
  32. package/packages/plugin-sdk/dist/manifest.js +7 -0
  33. package/packages/plugin-sdk/dist/manifest.js.map +1 -0
  34. package/packages/plugin-sdk/dist/mcp-client.d.ts +74 -0
  35. package/packages/plugin-sdk/dist/mcp-client.d.ts.map +1 -0
  36. package/packages/plugin-sdk/dist/mcp-client.js +226 -0
  37. package/packages/plugin-sdk/dist/mcp-client.js.map +1 -0
  38. package/packages/plugin-sdk/dist/mcp-fetch.d.ts +10 -0
  39. package/packages/plugin-sdk/dist/mcp-fetch.d.ts.map +1 -0
  40. package/packages/plugin-sdk/dist/mcp-fetch.js +130 -0
  41. package/packages/plugin-sdk/dist/mcp-fetch.js.map +1 -0
  42. package/packages/plugin-sdk/dist/mcp-toolset.d.ts +128 -0
  43. package/packages/plugin-sdk/dist/mcp-toolset.d.ts.map +1 -0
  44. package/packages/plugin-sdk/dist/mcp-toolset.js +246 -0
  45. package/packages/plugin-sdk/dist/mcp-toolset.js.map +1 -0
  46. package/packages/plugin-sdk/dist/server.d.ts +486 -0
  47. package/packages/plugin-sdk/dist/server.d.ts.map +1 -0
  48. package/packages/plugin-sdk/dist/server.js +10 -0
  49. package/packages/plugin-sdk/dist/server.js.map +1 -0
  50. package/packages/plugin-sdk/dist/session-inbox.d.ts +56 -0
  51. package/packages/plugin-sdk/dist/session-inbox.d.ts.map +1 -0
  52. package/packages/plugin-sdk/dist/session-inbox.js +12 -0
  53. package/packages/plugin-sdk/dist/session-inbox.js.map +1 -0
  54. package/packages/plugin-sdk/package.json +36 -0
  55. package/packages/server/builtinConfig/plugins/README.md +1 -0
  56. package/packages/server/builtinConfig/plugins/files/manifest.json +100 -0
  57. package/packages/server/builtinConfig/plugins/files/skills/files-workspace-layout.md +29 -0
  58. package/packages/server/builtinConfig/plugins/microsandbox/manifest.json +177 -0
  59. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-browser-howto.md +155 -0
  60. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-build-use.md +201 -0
  61. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-config.md +38 -0
  62. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-exec-howto.md +144 -0
  63. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-libreoffice.md +159 -0
  64. package/packages/server/builtinConfig/plugins/microsandbox/skills/microsandbox-main-orchestration.md +75 -0
  65. package/packages/server/builtinConfig/plugins/microsandbox/templates/README.md +26 -0
  66. package/packages/server/builtinConfig/plugins/microsandbox/templates/browser.yaml +105 -0
  67. package/packages/server/builtinConfig/plugins/microsandbox/templates/task-runner-with-browser.yaml +80 -0
  68. package/packages/server/builtinConfig/plugins/microsandbox/templates/task-runner.yaml +80 -0
  69. package/packages/server/builtinConfig/plugins/web-search/manifest.json +65 -0
  70. package/packages/server/builtinConfig/plugins/web-search/skills/web-search-howto.md +69 -0
  71. package/packages/server/builtinConfig/plugins/workboard/agent-seeds/echo-demo/agent.json +7 -0
  72. package/packages/server/builtinConfig/plugins/workboard/agent-seeds/llm-default/SOUL.md +53 -0
  73. package/packages/server/builtinConfig/plugins/workboard/agent-seeds/llm-default/agent.json +7 -0
  74. package/packages/server/builtinConfig/plugins/workboard/manifest.json +180 -0
  75. package/packages/server/builtinConfig/plugins/workboard/skills/large-input-large-output.md +185 -0
  76. package/packages/server/builtinConfig/plugins/workboard/skills/workboard-howto.md +166 -0
  77. package/packages/server/builtinConfig/plugins/workboard/skills/worker-creator.md +267 -0
  78. package/packages/server/builtinConfig/plugins/workboard/skills/worker-fleet.md +431 -0
  79. package/packages/server/dist/catalog.d.ts +52 -0
  80. package/packages/server/dist/catalog.d.ts.map +1 -0
  81. package/packages/server/dist/catalog.js +189 -0
  82. package/packages/server/dist/catalog.js.map +1 -0
  83. package/packages/server/dist/chat/active-harnesses.d.ts +34 -0
  84. package/packages/server/dist/chat/active-harnesses.d.ts.map +1 -0
  85. package/packages/server/dist/chat/active-harnesses.js +118 -0
  86. package/packages/server/dist/chat/active-harnesses.js.map +1 -0
  87. package/packages/server/dist/chat/agent-loop.d.ts +64 -0
  88. package/packages/server/dist/chat/agent-loop.d.ts.map +1 -0
  89. package/packages/server/dist/chat/agent-loop.js +597 -0
  90. package/packages/server/dist/chat/agent-loop.js.map +1 -0
  91. package/packages/server/dist/chat/agent-tool-adapter.d.ts +33 -0
  92. package/packages/server/dist/chat/agent-tool-adapter.d.ts.map +1 -0
  93. package/packages/server/dist/chat/agent-tool-adapter.js +260 -0
  94. package/packages/server/dist/chat/agent-tool-adapter.js.map +1 -0
  95. package/packages/server/dist/chat/compact.d.ts +52 -0
  96. package/packages/server/dist/chat/compact.d.ts.map +1 -0
  97. package/packages/server/dist/chat/compact.js +248 -0
  98. package/packages/server/dist/chat/compact.js.map +1 -0
  99. package/packages/server/dist/chat/dump-system-prompt.d.ts +17 -0
  100. package/packages/server/dist/chat/dump-system-prompt.d.ts.map +1 -0
  101. package/packages/server/dist/chat/dump-system-prompt.js +58 -0
  102. package/packages/server/dist/chat/dump-system-prompt.js.map +1 -0
  103. package/packages/server/dist/chat/handler.d.ts +186 -0
  104. package/packages/server/dist/chat/handler.d.ts.map +1 -0
  105. package/packages/server/dist/chat/handler.js +1248 -0
  106. package/packages/server/dist/chat/handler.js.map +1 -0
  107. package/packages/server/dist/chat/image-fit.d.ts +34 -0
  108. package/packages/server/dist/chat/image-fit.d.ts.map +1 -0
  109. package/packages/server/dist/chat/image-fit.js +157 -0
  110. package/packages/server/dist/chat/image-fit.js.map +1 -0
  111. package/packages/server/dist/chat/messages.d.ts +118 -0
  112. package/packages/server/dist/chat/messages.d.ts.map +1 -0
  113. package/packages/server/dist/chat/messages.js +341 -0
  114. package/packages/server/dist/chat/messages.js.map +1 -0
  115. package/packages/server/dist/chat/session-inbox.d.ts +114 -0
  116. package/packages/server/dist/chat/session-inbox.d.ts.map +1 -0
  117. package/packages/server/dist/chat/session-inbox.js +418 -0
  118. package/packages/server/dist/chat/session-inbox.js.map +1 -0
  119. package/packages/server/dist/chat/sqlite-session-repo.d.ts +26 -0
  120. package/packages/server/dist/chat/sqlite-session-repo.d.ts.map +1 -0
  121. package/packages/server/dist/chat/sqlite-session-repo.js +132 -0
  122. package/packages/server/dist/chat/sqlite-session-repo.js.map +1 -0
  123. package/packages/server/dist/chat/sqlite-session-storage.d.ts +83 -0
  124. package/packages/server/dist/chat/sqlite-session-storage.d.ts.map +1 -0
  125. package/packages/server/dist/chat/sqlite-session-storage.js +418 -0
  126. package/packages/server/dist/chat/sqlite-session-storage.js.map +1 -0
  127. package/packages/server/dist/chat/stub-execution-env.d.ts +3 -0
  128. package/packages/server/dist/chat/stub-execution-env.d.ts.map +1 -0
  129. package/packages/server/dist/chat/stub-execution-env.js +87 -0
  130. package/packages/server/dist/chat/stub-execution-env.js.map +1 -0
  131. package/packages/server/dist/chat/token-estimate.d.ts +11 -0
  132. package/packages/server/dist/chat/token-estimate.d.ts.map +1 -0
  133. package/packages/server/dist/chat/token-estimate.js +67 -0
  134. package/packages/server/dist/chat/token-estimate.js.map +1 -0
  135. package/packages/server/dist/chat/ws-protocol.d.ts +244 -0
  136. package/packages/server/dist/chat/ws-protocol.d.ts.map +1 -0
  137. package/packages/server/dist/chat/ws-protocol.js +193 -0
  138. package/packages/server/dist/chat/ws-protocol.js.map +1 -0
  139. package/packages/server/dist/cli.d.ts +9 -0
  140. package/packages/server/dist/cli.d.ts.map +1 -0
  141. package/packages/server/dist/cli.js +329 -0
  142. package/packages/server/dist/cli.js.map +1 -0
  143. package/packages/server/dist/core/agent-seeds.d.ts +25 -0
  144. package/packages/server/dist/core/agent-seeds.d.ts.map +1 -0
  145. package/packages/server/dist/core/agent-seeds.js +69 -0
  146. package/packages/server/dist/core/agent-seeds.js.map +1 -0
  147. package/packages/server/dist/core/config.d.ts +172 -0
  148. package/packages/server/dist/core/config.d.ts.map +1 -0
  149. package/packages/server/dist/core/config.js +155 -0
  150. package/packages/server/dist/core/config.js.map +1 -0
  151. package/packages/server/dist/core/db-pool.d.ts +32 -0
  152. package/packages/server/dist/core/db-pool.d.ts.map +1 -0
  153. package/packages/server/dist/core/db-pool.js +108 -0
  154. package/packages/server/dist/core/db-pool.js.map +1 -0
  155. package/packages/server/dist/core/dev-mode.d.ts +13 -0
  156. package/packages/server/dist/core/dev-mode.d.ts.map +1 -0
  157. package/packages/server/dist/core/dev-mode.js +51 -0
  158. package/packages/server/dist/core/dev-mode.js.map +1 -0
  159. package/packages/server/dist/core/global-ops.d.ts +54 -0
  160. package/packages/server/dist/core/global-ops.d.ts.map +1 -0
  161. package/packages/server/dist/core/global-ops.js +143 -0
  162. package/packages/server/dist/core/global-ops.js.map +1 -0
  163. package/packages/server/dist/core/identity-resolvers.d.ts +102 -0
  164. package/packages/server/dist/core/identity-resolvers.d.ts.map +1 -0
  165. package/packages/server/dist/core/identity-resolvers.js +176 -0
  166. package/packages/server/dist/core/identity-resolvers.js.map +1 -0
  167. package/packages/server/dist/core/index.d.ts +13 -0
  168. package/packages/server/dist/core/index.d.ts.map +1 -0
  169. package/packages/server/dist/core/index.js +18 -0
  170. package/packages/server/dist/core/index.js.map +1 -0
  171. package/packages/server/dist/core/llm.d.ts +45 -0
  172. package/packages/server/dist/core/llm.d.ts.map +1 -0
  173. package/packages/server/dist/core/llm.js +140 -0
  174. package/packages/server/dist/core/llm.js.map +1 -0
  175. package/packages/server/dist/core/mcp-manager.d.ts +47 -0
  176. package/packages/server/dist/core/mcp-manager.d.ts.map +1 -0
  177. package/packages/server/dist/core/mcp-manager.js +129 -0
  178. package/packages/server/dist/core/mcp-manager.js.map +1 -0
  179. package/packages/server/dist/core/middleware.d.ts +31 -0
  180. package/packages/server/dist/core/middleware.d.ts.map +1 -0
  181. package/packages/server/dist/core/middleware.js +102 -0
  182. package/packages/server/dist/core/middleware.js.map +1 -0
  183. package/packages/server/dist/core/migrations/001-initial.d.ts +4 -0
  184. package/packages/server/dist/core/migrations/001-initial.d.ts.map +1 -0
  185. package/packages/server/dist/core/migrations/001-initial.js +66 -0
  186. package/packages/server/dist/core/migrations/001-initial.js.map +1 -0
  187. package/packages/server/dist/core/migrations/002-task-dependencies.d.ts +4 -0
  188. package/packages/server/dist/core/migrations/002-task-dependencies.d.ts.map +1 -0
  189. package/packages/server/dist/core/migrations/002-task-dependencies.js +20 -0
  190. package/packages/server/dist/core/migrations/002-task-dependencies.js.map +1 -0
  191. package/packages/server/dist/core/migrations/003-session-tree.d.ts +4 -0
  192. package/packages/server/dist/core/migrations/003-session-tree.d.ts.map +1 -0
  193. package/packages/server/dist/core/migrations/003-session-tree.js +96 -0
  194. package/packages/server/dist/core/migrations/003-session-tree.js.map +1 -0
  195. package/packages/server/dist/core/migrations/003-worker-agents.d.ts +4 -0
  196. package/packages/server/dist/core/migrations/003-worker-agents.d.ts.map +1 -0
  197. package/packages/server/dist/core/migrations/003-worker-agents.js +65 -0
  198. package/packages/server/dist/core/migrations/003-worker-agents.js.map +1 -0
  199. package/packages/server/dist/core/migrations/004-rebuild-message-chain.d.ts +4 -0
  200. package/packages/server/dist/core/migrations/004-rebuild-message-chain.d.ts.map +1 -0
  201. package/packages/server/dist/core/migrations/004-rebuild-message-chain.js +52 -0
  202. package/packages/server/dist/core/migrations/004-rebuild-message-chain.js.map +1 -0
  203. package/packages/server/dist/core/migrations/005-task-status-rename.d.ts +4 -0
  204. package/packages/server/dist/core/migrations/005-task-status-rename.d.ts.map +1 -0
  205. package/packages/server/dist/core/migrations/005-task-status-rename.js +64 -0
  206. package/packages/server/dist/core/migrations/005-task-status-rename.js.map +1 -0
  207. package/packages/server/dist/core/migrations/006-task-labels.d.ts +4 -0
  208. package/packages/server/dist/core/migrations/006-task-labels.d.ts.map +1 -0
  209. package/packages/server/dist/core/migrations/006-task-labels.js +43 -0
  210. package/packages/server/dist/core/migrations/006-task-labels.js.map +1 -0
  211. package/packages/server/dist/core/migrations/007-session-inbox.d.ts +4 -0
  212. package/packages/server/dist/core/migrations/007-session-inbox.d.ts.map +1 -0
  213. package/packages/server/dist/core/migrations/007-session-inbox.js +67 -0
  214. package/packages/server/dist/core/migrations/007-session-inbox.js.map +1 -0
  215. package/packages/server/dist/core/migrations/008-task-intervention.d.ts +4 -0
  216. package/packages/server/dist/core/migrations/008-task-intervention.d.ts.map +1 -0
  217. package/packages/server/dist/core/migrations/008-task-intervention.js +60 -0
  218. package/packages/server/dist/core/migrations/008-task-intervention.js.map +1 -0
  219. package/packages/server/dist/core/migrations/index.d.ts +12 -0
  220. package/packages/server/dist/core/migrations/index.d.ts.map +1 -0
  221. package/packages/server/dist/core/migrations/index.js +58 -0
  222. package/packages/server/dist/core/migrations/index.js.map +1 -0
  223. package/packages/server/dist/core/paths.d.ts +53 -0
  224. package/packages/server/dist/core/paths.d.ts.map +1 -0
  225. package/packages/server/dist/core/paths.js +125 -0
  226. package/packages/server/dist/core/paths.js.map +1 -0
  227. package/packages/server/dist/core/plugins/builtin-loader.d.ts +56 -0
  228. package/packages/server/dist/core/plugins/builtin-loader.d.ts.map +1 -0
  229. package/packages/server/dist/core/plugins/builtin-loader.js +153 -0
  230. package/packages/server/dist/core/plugins/builtin-loader.js.map +1 -0
  231. package/packages/server/dist/core/plugins/discovery.d.ts +28 -0
  232. package/packages/server/dist/core/plugins/discovery.d.ts.map +1 -0
  233. package/packages/server/dist/core/plugins/discovery.js +97 -0
  234. package/packages/server/dist/core/plugins/discovery.js.map +1 -0
  235. package/packages/server/dist/core/plugins/index.d.ts +6 -0
  236. package/packages/server/dist/core/plugins/index.d.ts.map +1 -0
  237. package/packages/server/dist/core/plugins/index.js +6 -0
  238. package/packages/server/dist/core/plugins/index.js.map +1 -0
  239. package/packages/server/dist/core/plugins/manifest.d.ts +9 -0
  240. package/packages/server/dist/core/plugins/manifest.d.ts.map +1 -0
  241. package/packages/server/dist/core/plugins/manifest.js +584 -0
  242. package/packages/server/dist/core/plugins/manifest.js.map +1 -0
  243. package/packages/server/dist/core/plugins/registry.d.ts +269 -0
  244. package/packages/server/dist/core/plugins/registry.d.ts.map +1 -0
  245. package/packages/server/dist/core/plugins/registry.js +1003 -0
  246. package/packages/server/dist/core/plugins/registry.js.map +1 -0
  247. package/packages/server/dist/core/plugins/secrets.d.ts +46 -0
  248. package/packages/server/dist/core/plugins/secrets.d.ts.map +1 -0
  249. package/packages/server/dist/core/plugins/secrets.js +174 -0
  250. package/packages/server/dist/core/plugins/secrets.js.map +1 -0
  251. package/packages/server/dist/core/plugins/skills.d.ts +131 -0
  252. package/packages/server/dist/core/plugins/skills.d.ts.map +1 -0
  253. package/packages/server/dist/core/plugins/skills.js +389 -0
  254. package/packages/server/dist/core/plugins/skills.js.map +1 -0
  255. package/packages/server/dist/core/templates.d.ts +28 -0
  256. package/packages/server/dist/core/templates.d.ts.map +1 -0
  257. package/packages/server/dist/core/templates.js +103 -0
  258. package/packages/server/dist/core/templates.js.map +1 -0
  259. package/packages/server/dist/core/tenant-context.d.ts +18 -0
  260. package/packages/server/dist/core/tenant-context.d.ts.map +1 -0
  261. package/packages/server/dist/core/tenant-context.js +42 -0
  262. package/packages/server/dist/core/tenant-context.js.map +1 -0
  263. package/packages/server/dist/core/tenant-id.d.ts +8 -0
  264. package/packages/server/dist/core/tenant-id.d.ts.map +1 -0
  265. package/packages/server/dist/core/tenant-id.js +53 -0
  266. package/packages/server/dist/core/tenant-id.js.map +1 -0
  267. package/packages/server/dist/core/tenant-skills.d.ts +29 -0
  268. package/packages/server/dist/core/tenant-skills.d.ts.map +1 -0
  269. package/packages/server/dist/core/tenant-skills.js +77 -0
  270. package/packages/server/dist/core/tenant-skills.js.map +1 -0
  271. package/packages/server/dist/core/worker-agents-fs.d.ts +44 -0
  272. package/packages/server/dist/core/worker-agents-fs.d.ts.map +1 -0
  273. package/packages/server/dist/core/worker-agents-fs.js +86 -0
  274. package/packages/server/dist/core/worker-agents-fs.js.map +1 -0
  275. package/packages/server/dist/core/worker-agents.d.ts +77 -0
  276. package/packages/server/dist/core/worker-agents.d.ts.map +1 -0
  277. package/packages/server/dist/core/worker-agents.js +191 -0
  278. package/packages/server/dist/core/worker-agents.js.map +1 -0
  279. package/packages/server/dist/index.d.ts +2 -0
  280. package/packages/server/dist/index.d.ts.map +1 -0
  281. package/packages/server/dist/index.js +623 -0
  282. package/packages/server/dist/index.js.map +1 -0
  283. package/packages/server/dist/lsp/client.d.ts +53 -0
  284. package/packages/server/dist/lsp/client.d.ts.map +1 -0
  285. package/packages/server/dist/lsp/client.js +258 -0
  286. package/packages/server/dist/lsp/client.js.map +1 -0
  287. package/packages/server/dist/lsp/format.d.ts +13 -0
  288. package/packages/server/dist/lsp/format.d.ts.map +1 -0
  289. package/packages/server/dist/lsp/format.js +55 -0
  290. package/packages/server/dist/lsp/format.js.map +1 -0
  291. package/packages/server/dist/lsp/index.d.ts +20 -0
  292. package/packages/server/dist/lsp/index.d.ts.map +1 -0
  293. package/packages/server/dist/lsp/index.js +32 -0
  294. package/packages/server/dist/lsp/index.js.map +1 -0
  295. package/packages/server/dist/lsp/language-registry.d.ts +29 -0
  296. package/packages/server/dist/lsp/language-registry.d.ts.map +1 -0
  297. package/packages/server/dist/lsp/language-registry.js +62 -0
  298. package/packages/server/dist/lsp/language-registry.js.map +1 -0
  299. package/packages/server/dist/lsp/manager.d.ts +77 -0
  300. package/packages/server/dist/lsp/manager.d.ts.map +1 -0
  301. package/packages/server/dist/lsp/manager.js +300 -0
  302. package/packages/server/dist/lsp/manager.js.map +1 -0
  303. package/packages/server/dist/plugins-routes.d.ts +96 -0
  304. package/packages/server/dist/plugins-routes.d.ts.map +1 -0
  305. package/packages/server/dist/plugins-routes.js +627 -0
  306. package/packages/server/dist/plugins-routes.js.map +1 -0
  307. package/packages/server/dist/setup/checks/config.d.ts +9 -0
  308. package/packages/server/dist/setup/checks/config.d.ts.map +1 -0
  309. package/packages/server/dist/setup/checks/config.js +66 -0
  310. package/packages/server/dist/setup/checks/config.js.map +1 -0
  311. package/packages/server/dist/setup/checks/db.d.ts +6 -0
  312. package/packages/server/dist/setup/checks/db.d.ts.map +1 -0
  313. package/packages/server/dist/setup/checks/db.js +79 -0
  314. package/packages/server/dist/setup/checks/db.js.map +1 -0
  315. package/packages/server/dist/setup/checks/known-models.d.ts +18 -0
  316. package/packages/server/dist/setup/checks/known-models.d.ts.map +1 -0
  317. package/packages/server/dist/setup/checks/known-models.js +119 -0
  318. package/packages/server/dist/setup/checks/known-models.js.map +1 -0
  319. package/packages/server/dist/setup/checks/network.d.ts +11 -0
  320. package/packages/server/dist/setup/checks/network.d.ts.map +1 -0
  321. package/packages/server/dist/setup/checks/network.js +176 -0
  322. package/packages/server/dist/setup/checks/network.js.map +1 -0
  323. package/packages/server/dist/setup/checks/plugins.d.ts +9 -0
  324. package/packages/server/dist/setup/checks/plugins.d.ts.map +1 -0
  325. package/packages/server/dist/setup/checks/plugins.js +194 -0
  326. package/packages/server/dist/setup/checks/plugins.js.map +1 -0
  327. package/packages/server/dist/setup/checks/providers.d.ts +12 -0
  328. package/packages/server/dist/setup/checks/providers.d.ts.map +1 -0
  329. package/packages/server/dist/setup/checks/providers.js +368 -0
  330. package/packages/server/dist/setup/checks/providers.js.map +1 -0
  331. package/packages/server/dist/setup/checks/runtime.d.ts +3 -0
  332. package/packages/server/dist/setup/checks/runtime.d.ts.map +1 -0
  333. package/packages/server/dist/setup/checks/runtime.js +44 -0
  334. package/packages/server/dist/setup/checks/runtime.js.map +1 -0
  335. package/packages/server/dist/setup/checks/sandbox.d.ts +9 -0
  336. package/packages/server/dist/setup/checks/sandbox.d.ts.map +1 -0
  337. package/packages/server/dist/setup/checks/sandbox.js +110 -0
  338. package/packages/server/dist/setup/checks/sandbox.js.map +1 -0
  339. package/packages/server/dist/setup/checks/tenants.d.ts +9 -0
  340. package/packages/server/dist/setup/checks/tenants.d.ts.map +1 -0
  341. package/packages/server/dist/setup/checks/tenants.js +509 -0
  342. package/packages/server/dist/setup/checks/tenants.js.map +1 -0
  343. package/packages/server/dist/setup/cli-agent.d.ts +39 -0
  344. package/packages/server/dist/setup/cli-agent.d.ts.map +1 -0
  345. package/packages/server/dist/setup/cli-agent.js +1353 -0
  346. package/packages/server/dist/setup/cli-agent.js.map +1 -0
  347. package/packages/server/dist/setup/doctor.d.ts +32 -0
  348. package/packages/server/dist/setup/doctor.d.ts.map +1 -0
  349. package/packages/server/dist/setup/doctor.js +80 -0
  350. package/packages/server/dist/setup/doctor.js.map +1 -0
  351. package/packages/server/dist/setup/launchd.d.ts +107 -0
  352. package/packages/server/dist/setup/launchd.d.ts.map +1 -0
  353. package/packages/server/dist/setup/launchd.js +309 -0
  354. package/packages/server/dist/setup/launchd.js.map +1 -0
  355. package/packages/server/dist/setup/load-env.d.ts +21 -0
  356. package/packages/server/dist/setup/load-env.d.ts.map +1 -0
  357. package/packages/server/dist/setup/load-env.js +88 -0
  358. package/packages/server/dist/setup/load-env.js.map +1 -0
  359. package/packages/server/dist/setup/probe-default-model.d.ts +28 -0
  360. package/packages/server/dist/setup/probe-default-model.d.ts.map +1 -0
  361. package/packages/server/dist/setup/probe-default-model.js +133 -0
  362. package/packages/server/dist/setup/probe-default-model.js.map +1 -0
  363. package/packages/server/dist/setup/render.d.ts +28 -0
  364. package/packages/server/dist/setup/render.d.ts.map +1 -0
  365. package/packages/server/dist/setup/render.js +60 -0
  366. package/packages/server/dist/setup/render.js.map +1 -0
  367. package/packages/server/dist/setup/repo-root.d.ts +3 -0
  368. package/packages/server/dist/setup/repo-root.d.ts.map +1 -0
  369. package/packages/server/dist/setup/repo-root.js +43 -0
  370. package/packages/server/dist/setup/repo-root.js.map +1 -0
  371. package/packages/server/dist/setup/service.d.ts +60 -0
  372. package/packages/server/dist/setup/service.d.ts.map +1 -0
  373. package/packages/server/dist/setup/service.js +345 -0
  374. package/packages/server/dist/setup/service.js.map +1 -0
  375. package/packages/server/dist/setup/start-server.d.ts +23 -0
  376. package/packages/server/dist/setup/start-server.d.ts.map +1 -0
  377. package/packages/server/dist/setup/start-server.js +465 -0
  378. package/packages/server/dist/setup/start-server.js.map +1 -0
  379. package/packages/server/dist/setup/wizard.d.ts +59 -0
  380. package/packages/server/dist/setup/wizard.d.ts.map +1 -0
  381. package/packages/server/dist/setup/wizard.js +556 -0
  382. package/packages/server/dist/setup/wizard.js.map +1 -0
  383. package/packages/server/dist/tools/edit-file.d.ts +13 -0
  384. package/packages/server/dist/tools/edit-file.d.ts.map +1 -0
  385. package/packages/server/dist/tools/edit-file.js +90 -0
  386. package/packages/server/dist/tools/edit-file.js.map +1 -0
  387. package/packages/server/dist/tools/glob.d.ts +12 -0
  388. package/packages/server/dist/tools/glob.d.ts.map +1 -0
  389. package/packages/server/dist/tools/glob.js +82 -0
  390. package/packages/server/dist/tools/glob.js.map +1 -0
  391. package/packages/server/dist/tools/index.d.ts +82 -0
  392. package/packages/server/dist/tools/index.d.ts.map +1 -0
  393. package/packages/server/dist/tools/index.js +72 -0
  394. package/packages/server/dist/tools/index.js.map +1 -0
  395. package/packages/server/dist/tools/list-dir.d.ts +24 -0
  396. package/packages/server/dist/tools/list-dir.d.ts.map +1 -0
  397. package/packages/server/dist/tools/list-dir.js +99 -0
  398. package/packages/server/dist/tools/list-dir.js.map +1 -0
  399. package/packages/server/dist/tools/path-helper.d.ts +15 -0
  400. package/packages/server/dist/tools/path-helper.d.ts.map +1 -0
  401. package/packages/server/dist/tools/path-helper.js +72 -0
  402. package/packages/server/dist/tools/path-helper.js.map +1 -0
  403. package/packages/server/dist/tools/read-file.d.ts +17 -0
  404. package/packages/server/dist/tools/read-file.d.ts.map +1 -0
  405. package/packages/server/dist/tools/read-file.js +94 -0
  406. package/packages/server/dist/tools/read-file.js.map +1 -0
  407. package/packages/server/dist/tools/sandbox.d.ts +57 -0
  408. package/packages/server/dist/tools/sandbox.d.ts.map +1 -0
  409. package/packages/server/dist/tools/sandbox.js +291 -0
  410. package/packages/server/dist/tools/sandbox.js.map +1 -0
  411. package/packages/server/dist/tools/write-file.d.ts +12 -0
  412. package/packages/server/dist/tools/write-file.d.ts.map +1 -0
  413. package/packages/server/dist/tools/write-file.js +67 -0
  414. package/packages/server/dist/tools/write-file.js.map +1 -0
  415. package/packages/server/dist/worker-agents-routes.d.ts +11 -0
  416. package/packages/server/dist/worker-agents-routes.d.ts.map +1 -0
  417. package/packages/server/dist/worker-agents-routes.js +253 -0
  418. package/packages/server/dist/worker-agents-routes.js.map +1 -0
  419. package/packages/server/package.json +41 -0
  420. package/packages/web/dist/assets/index-DH-gJ09_.js +60 -0
  421. package/packages/web/dist/assets/index-xU4lYYqY.css +2 -0
  422. package/packages/web/dist/index.html +14 -0
  423. package/packages/web/package.json +36 -0
  424. package/plugins/README.md +64 -0
  425. package/plugins/files/dist/client.d.ts +5 -0
  426. package/plugins/files/dist/client.d.ts.map +1 -0
  427. package/plugins/files/dist/client.js +354 -0
  428. package/plugins/files/dist/client.js.map +1 -0
  429. package/plugins/files/dist/server.d.ts +32 -0
  430. package/plugins/files/dist/server.d.ts.map +1 -0
  431. package/plugins/files/dist/server.js +514 -0
  432. package/plugins/files/dist/server.js.map +1 -0
  433. package/plugins/files/dist/tools/edit-file.d.ts +29 -0
  434. package/plugins/files/dist/tools/edit-file.d.ts.map +1 -0
  435. package/plugins/files/dist/tools/edit-file.js +230 -0
  436. package/plugins/files/dist/tools/edit-file.js.map +1 -0
  437. package/plugins/files/dist/tools/edit-file.prompt.md +36 -0
  438. package/plugins/files/dist/tools/glob.d.ts +12 -0
  439. package/plugins/files/dist/tools/glob.d.ts.map +1 -0
  440. package/plugins/files/dist/tools/glob.js +84 -0
  441. package/plugins/files/dist/tools/glob.js.map +1 -0
  442. package/plugins/files/dist/tools/index.d.ts +13 -0
  443. package/plugins/files/dist/tools/index.d.ts.map +1 -0
  444. package/plugins/files/dist/tools/index.js +158 -0
  445. package/plugins/files/dist/tools/index.js.map +1 -0
  446. package/plugins/files/dist/tools/list-dir.d.ts +24 -0
  447. package/plugins/files/dist/tools/list-dir.d.ts.map +1 -0
  448. package/plugins/files/dist/tools/list-dir.js +104 -0
  449. package/plugins/files/dist/tools/list-dir.js.map +1 -0
  450. package/plugins/files/dist/tools/load-prompt.d.ts +5 -0
  451. package/plugins/files/dist/tools/load-prompt.d.ts.map +1 -0
  452. package/plugins/files/dist/tools/load-prompt.js +39 -0
  453. package/plugins/files/dist/tools/load-prompt.js.map +1 -0
  454. package/plugins/files/dist/tools/path-helper.d.ts +32 -0
  455. package/plugins/files/dist/tools/path-helper.d.ts.map +1 -0
  456. package/plugins/files/dist/tools/path-helper.js +113 -0
  457. package/plugins/files/dist/tools/path-helper.js.map +1 -0
  458. package/plugins/files/dist/tools/read-file.d.ts +17 -0
  459. package/plugins/files/dist/tools/read-file.d.ts.map +1 -0
  460. package/plugins/files/dist/tools/read-file.js +109 -0
  461. package/plugins/files/dist/tools/read-file.js.map +1 -0
  462. package/plugins/files/dist/tools/read-tracker.d.ts +28 -0
  463. package/plugins/files/dist/tools/read-tracker.d.ts.map +1 -0
  464. package/plugins/files/dist/tools/read-tracker.js +135 -0
  465. package/plugins/files/dist/tools/read-tracker.js.map +1 -0
  466. package/plugins/files/dist/tools/replacers.d.ts +27 -0
  467. package/plugins/files/dist/tools/replacers.d.ts.map +1 -0
  468. package/plugins/files/dist/tools/replacers.js +221 -0
  469. package/plugins/files/dist/tools/replacers.js.map +1 -0
  470. package/plugins/files/dist/tools/tenant-config-delete.d.ts +12 -0
  471. package/plugins/files/dist/tools/tenant-config-delete.d.ts.map +1 -0
  472. package/plugins/files/dist/tools/tenant-config-delete.js +70 -0
  473. package/plugins/files/dist/tools/tenant-config-delete.js.map +1 -0
  474. package/plugins/files/dist/tools/tenant-config-edit.d.ts +25 -0
  475. package/plugins/files/dist/tools/tenant-config-edit.d.ts.map +1 -0
  476. package/plugins/files/dist/tools/tenant-config-edit.js +142 -0
  477. package/plugins/files/dist/tools/tenant-config-edit.js.map +1 -0
  478. package/plugins/files/dist/tools/tenant-config-glob.d.ts +12 -0
  479. package/plugins/files/dist/tools/tenant-config-glob.d.ts.map +1 -0
  480. package/plugins/files/dist/tools/tenant-config-glob.js +64 -0
  481. package/plugins/files/dist/tools/tenant-config-glob.js.map +1 -0
  482. package/plugins/files/dist/tools/tenant-config-helper.d.ts +64 -0
  483. package/plugins/files/dist/tools/tenant-config-helper.d.ts.map +1 -0
  484. package/plugins/files/dist/tools/tenant-config-helper.js +162 -0
  485. package/plugins/files/dist/tools/tenant-config-helper.js.map +1 -0
  486. package/plugins/files/dist/tools/tenant-config-list.d.ts +20 -0
  487. package/plugins/files/dist/tools/tenant-config-list.d.ts.map +1 -0
  488. package/plugins/files/dist/tools/tenant-config-list.js +95 -0
  489. package/plugins/files/dist/tools/tenant-config-list.js.map +1 -0
  490. package/plugins/files/dist/tools/tenant-config-read.d.ts +17 -0
  491. package/plugins/files/dist/tools/tenant-config-read.d.ts.map +1 -0
  492. package/plugins/files/dist/tools/tenant-config-read.js +87 -0
  493. package/plugins/files/dist/tools/tenant-config-read.js.map +1 -0
  494. package/plugins/files/dist/tools/tenant-config-write.d.ts +14 -0
  495. package/plugins/files/dist/tools/tenant-config-write.d.ts.map +1 -0
  496. package/plugins/files/dist/tools/tenant-config-write.js +78 -0
  497. package/plugins/files/dist/tools/tenant-config-write.js.map +1 -0
  498. package/plugins/files/dist/tools/text-shape.d.ts +20 -0
  499. package/plugins/files/dist/tools/text-shape.d.ts.map +1 -0
  500. package/plugins/files/dist/tools/text-shape.js +57 -0
  501. package/plugins/files/dist/tools/text-shape.js.map +1 -0
  502. package/plugins/files/dist/tools/write-file.d.ts +12 -0
  503. package/plugins/files/dist/tools/write-file.d.ts.map +1 -0
  504. package/plugins/files/dist/tools/write-file.js +89 -0
  505. package/plugins/files/dist/tools/write-file.js.map +1 -0
  506. package/plugins/files/dist/tools/write-file.prompt.md +14 -0
  507. package/plugins/files/manifest.json +100 -0
  508. package/plugins/files/package.json +39 -0
  509. package/plugins/files/skills/files-workspace-layout.md +29 -0
  510. package/plugins/microsandbox/dist/admin/browser-routes.d.ts +41 -0
  511. package/plugins/microsandbox/dist/admin/browser-routes.d.ts.map +1 -0
  512. package/plugins/microsandbox/dist/admin/browser-routes.js +208 -0
  513. package/plugins/microsandbox/dist/admin/browser-routes.js.map +1 -0
  514. package/plugins/microsandbox/dist/admin/preview-exec.d.ts +38 -0
  515. package/plugins/microsandbox/dist/admin/preview-exec.d.ts.map +1 -0
  516. package/plugins/microsandbox/dist/admin/preview-exec.js +185 -0
  517. package/plugins/microsandbox/dist/admin/preview-exec.js.map +1 -0
  518. package/plugins/microsandbox/dist/admin/routes.d.ts +35 -0
  519. package/plugins/microsandbox/dist/admin/routes.d.ts.map +1 -0
  520. package/plugins/microsandbox/dist/admin/routes.js +728 -0
  521. package/plugins/microsandbox/dist/admin/routes.js.map +1 -0
  522. package/plugins/microsandbox/dist/admin/sandboxfile-io.d.ts +11 -0
  523. package/plugins/microsandbox/dist/admin/sandboxfile-io.d.ts.map +1 -0
  524. package/plugins/microsandbox/dist/admin/sandboxfile-io.js +72 -0
  525. package/plugins/microsandbox/dist/admin/sandboxfile-io.js.map +1 -0
  526. package/plugins/microsandbox/dist/admin/templates.d.ts +16 -0
  527. package/plugins/microsandbox/dist/admin/templates.d.ts.map +1 -0
  528. package/plugins/microsandbox/dist/admin/templates.js +66 -0
  529. package/plugins/microsandbox/dist/admin/templates.js.map +1 -0
  530. package/plugins/microsandbox/dist/admin.d.ts +5 -0
  531. package/plugins/microsandbox/dist/admin.d.ts.map +1 -0
  532. package/plugins/microsandbox/dist/admin.js +256 -0
  533. package/plugins/microsandbox/dist/admin.js.map +1 -0
  534. package/plugins/microsandbox/dist/build/builder.d.ts +69 -0
  535. package/plugins/microsandbox/dist/build/builder.d.ts.map +1 -0
  536. package/plugins/microsandbox/dist/build/builder.js +257 -0
  537. package/plugins/microsandbox/dist/build/builder.js.map +1 -0
  538. package/plugins/microsandbox/dist/build/metadata.d.ts +27 -0
  539. package/plugins/microsandbox/dist/build/metadata.d.ts.map +1 -0
  540. package/plugins/microsandbox/dist/build/metadata.js +55 -0
  541. package/plugins/microsandbox/dist/build/metadata.js.map +1 -0
  542. package/plugins/microsandbox/dist/build/pointer.d.ts +51 -0
  543. package/plugins/microsandbox/dist/build/pointer.d.ts.map +1 -0
  544. package/plugins/microsandbox/dist/build/pointer.js +130 -0
  545. package/plugins/microsandbox/dist/build/pointer.js.map +1 -0
  546. package/plugins/microsandbox/dist/build/sandboxfile.d.ts +15 -0
  547. package/plugins/microsandbox/dist/build/sandboxfile.d.ts.map +1 -0
  548. package/plugins/microsandbox/dist/build/sandboxfile.js +176 -0
  549. package/plugins/microsandbox/dist/build/sandboxfile.js.map +1 -0
  550. package/plugins/microsandbox/dist/client.d.ts +5 -0
  551. package/plugins/microsandbox/dist/client.d.ts.map +1 -0
  552. package/plugins/microsandbox/dist/client.js +941 -0
  553. package/plugins/microsandbox/dist/client.js.map +1 -0
  554. package/plugins/microsandbox/dist/runner/browser.d.ts +50 -0
  555. package/plugins/microsandbox/dist/runner/browser.d.ts.map +1 -0
  556. package/plugins/microsandbox/dist/runner/browser.js +142 -0
  557. package/plugins/microsandbox/dist/runner/browser.js.map +1 -0
  558. package/plugins/microsandbox/dist/runner/free-port.d.ts +6 -0
  559. package/plugins/microsandbox/dist/runner/free-port.d.ts.map +1 -0
  560. package/plugins/microsandbox/dist/runner/free-port.js +53 -0
  561. package/plugins/microsandbox/dist/runner/free-port.js.map +1 -0
  562. package/plugins/microsandbox/dist/runner/index.d.ts +28 -0
  563. package/plugins/microsandbox/dist/runner/index.d.ts.map +1 -0
  564. package/plugins/microsandbox/dist/runner/index.js +72 -0
  565. package/plugins/microsandbox/dist/runner/index.js.map +1 -0
  566. package/plugins/microsandbox/dist/runner/microsandbox.d.ts +64 -0
  567. package/plugins/microsandbox/dist/runner/microsandbox.d.ts.map +1 -0
  568. package/plugins/microsandbox/dist/runner/microsandbox.js +668 -0
  569. package/plugins/microsandbox/dist/runner/microsandbox.js.map +1 -0
  570. package/plugins/microsandbox/dist/runner/nullable.d.ts +36 -0
  571. package/plugins/microsandbox/dist/runner/nullable.d.ts.map +1 -0
  572. package/plugins/microsandbox/dist/runner/nullable.js +82 -0
  573. package/plugins/microsandbox/dist/runner/nullable.js.map +1 -0
  574. package/plugins/microsandbox/dist/runner/pool.d.ts +97 -0
  575. package/plugins/microsandbox/dist/runner/pool.d.ts.map +1 -0
  576. package/plugins/microsandbox/dist/runner/pool.js +494 -0
  577. package/plugins/microsandbox/dist/runner/pool.js.map +1 -0
  578. package/plugins/microsandbox/dist/runner/types.d.ts +33 -0
  579. package/plugins/microsandbox/dist/runner/types.d.ts.map +1 -0
  580. package/plugins/microsandbox/dist/runner/types.js +79 -0
  581. package/plugins/microsandbox/dist/runner/types.js.map +1 -0
  582. package/plugins/microsandbox/dist/server.d.ts +7 -0
  583. package/plugins/microsandbox/dist/server.d.ts.map +1 -0
  584. package/plugins/microsandbox/dist/server.js +276 -0
  585. package/plugins/microsandbox/dist/server.js.map +1 -0
  586. package/plugins/microsandbox/dist/tools/browser.d.ts +25 -0
  587. package/plugins/microsandbox/dist/tools/browser.d.ts.map +1 -0
  588. package/plugins/microsandbox/dist/tools/browser.js +78 -0
  589. package/plugins/microsandbox/dist/tools/browser.js.map +1 -0
  590. package/plugins/microsandbox/dist/tools/build.d.ts +5 -0
  591. package/plugins/microsandbox/dist/tools/build.d.ts.map +1 -0
  592. package/plugins/microsandbox/dist/tools/build.js +243 -0
  593. package/plugins/microsandbox/dist/tools/build.js.map +1 -0
  594. package/plugins/microsandbox/dist/tools/index.d.ts +9 -0
  595. package/plugins/microsandbox/dist/tools/index.d.ts.map +1 -0
  596. package/plugins/microsandbox/dist/tools/index.js +430 -0
  597. package/plugins/microsandbox/dist/tools/index.js.map +1 -0
  598. package/plugins/microsandbox/dist/tools/mcp-client.d.ts +63 -0
  599. package/plugins/microsandbox/dist/tools/mcp-client.d.ts.map +1 -0
  600. package/plugins/microsandbox/dist/tools/mcp-client.js +226 -0
  601. package/plugins/microsandbox/dist/tools/mcp-client.js.map +1 -0
  602. package/plugins/microsandbox/manifest.json +177 -0
  603. package/plugins/microsandbox/package.json +38 -0
  604. package/plugins/microsandbox/skills/microsandbox-browser-howto.md +155 -0
  605. package/plugins/microsandbox/skills/microsandbox-build-use.md +201 -0
  606. package/plugins/microsandbox/skills/microsandbox-config.md +38 -0
  607. package/plugins/microsandbox/skills/microsandbox-exec-howto.md +144 -0
  608. package/plugins/microsandbox/skills/microsandbox-libreoffice.md +159 -0
  609. package/plugins/microsandbox/templates/README.md +26 -0
  610. package/plugins/web-search/dist/server.d.ts +4 -0
  611. package/plugins/web-search/dist/server.d.ts.map +1 -0
  612. package/plugins/web-search/dist/server.js +73 -0
  613. package/plugins/web-search/dist/server.js.map +1 -0
  614. package/plugins/web-search/dist/tools/health.d.ts +31 -0
  615. package/plugins/web-search/dist/tools/health.d.ts.map +1 -0
  616. package/plugins/web-search/dist/tools/health.js +59 -0
  617. package/plugins/web-search/dist/tools/health.js.map +1 -0
  618. package/plugins/web-search/dist/tools/index.d.ts +3 -0
  619. package/plugins/web-search/dist/tools/index.d.ts.map +1 -0
  620. package/plugins/web-search/dist/tools/index.js +2 -0
  621. package/plugins/web-search/dist/tools/index.js.map +1 -0
  622. package/plugins/web-search/dist/tools/providers.d.ts +43 -0
  623. package/plugins/web-search/dist/tools/providers.d.ts.map +1 -0
  624. package/plugins/web-search/dist/tools/providers.js +140 -0
  625. package/plugins/web-search/dist/tools/providers.js.map +1 -0
  626. package/plugins/web-search/dist/tools/web-search.d.ts +15 -0
  627. package/plugins/web-search/dist/tools/web-search.d.ts.map +1 -0
  628. package/plugins/web-search/dist/tools/web-search.js +244 -0
  629. package/plugins/web-search/dist/tools/web-search.js.map +1 -0
  630. package/plugins/web-search/manifest.json +65 -0
  631. package/plugins/web-search/node_modules/@esbuild/darwin-arm64/README.md +3 -0
  632. package/plugins/web-search/node_modules/@esbuild/darwin-arm64/package.json +20 -0
  633. package/plugins/web-search/node_modules/@vitest/expect/LICENSE +21 -0
  634. package/plugins/web-search/node_modules/@vitest/expect/README.md +21 -0
  635. package/plugins/web-search/node_modules/@vitest/expect/dist/index.d.ts +808 -0
  636. package/plugins/web-search/node_modules/@vitest/expect/dist/index.js +1799 -0
  637. package/plugins/web-search/node_modules/@vitest/expect/package.json +46 -0
  638. package/plugins/web-search/node_modules/@vitest/mocker/LICENSE +21 -0
  639. package/plugins/web-search/node_modules/@vitest/mocker/README.md +5 -0
  640. package/plugins/web-search/node_modules/@vitest/mocker/dist/auto-register.d.ts +2 -0
  641. package/plugins/web-search/node_modules/@vitest/mocker/dist/auto-register.js +9 -0
  642. package/plugins/web-search/node_modules/@vitest/mocker/dist/browser.d.ts +53 -0
  643. package/plugins/web-search/node_modules/@vitest/mocker/dist/browser.js +91 -0
  644. package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-interceptor-native.js +15 -0
  645. package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-mocker.js +1602 -0
  646. package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-pathe.M-eThtNZ.js +174 -0
  647. package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-registry.js +182 -0
  648. package/plugins/web-search/node_modules/@vitest/mocker/dist/chunk-utils.js +16 -0
  649. package/plugins/web-search/node_modules/@vitest/mocker/dist/index.d.ts +21 -0
  650. package/plugins/web-search/node_modules/@vitest/mocker/dist/index.js +174 -0
  651. package/plugins/web-search/node_modules/@vitest/mocker/dist/mocker.d-Ce9_ySj5.d.ts +83 -0
  652. package/plugins/web-search/node_modules/@vitest/mocker/dist/node.d.ts +821 -0
  653. package/plugins/web-search/node_modules/@vitest/mocker/dist/node.js +1306 -0
  654. package/plugins/web-search/node_modules/@vitest/mocker/dist/redirect.d.ts +3 -0
  655. package/plugins/web-search/node_modules/@vitest/mocker/dist/redirect.js +75 -0
  656. package/plugins/web-search/node_modules/@vitest/mocker/dist/register.d.ts +9 -0
  657. package/plugins/web-search/node_modules/@vitest/mocker/dist/register.js +41 -0
  658. package/plugins/web-search/node_modules/@vitest/mocker/dist/registry.d-D765pazg.d.ts +87 -0
  659. package/plugins/web-search/node_modules/@vitest/mocker/dist/types.d-D_aRZRdy.d.ts +8 -0
  660. package/plugins/web-search/node_modules/@vitest/mocker/package.json +82 -0
  661. package/plugins/web-search/node_modules/@vitest/pretty-format/LICENSE +21 -0
  662. package/plugins/web-search/node_modules/@vitest/pretty-format/dist/index.d.ts +119 -0
  663. package/plugins/web-search/node_modules/@vitest/pretty-format/dist/index.js +1387 -0
  664. package/plugins/web-search/node_modules/@vitest/pretty-format/package.json +44 -0
  665. package/plugins/web-search/node_modules/@vitest/runner/LICENSE +21 -0
  666. package/plugins/web-search/node_modules/@vitest/runner/README.md +5 -0
  667. package/plugins/web-search/node_modules/@vitest/runner/dist/chunk-hooks.js +2254 -0
  668. package/plugins/web-search/node_modules/@vitest/runner/dist/index.d.ts +261 -0
  669. package/plugins/web-search/node_modules/@vitest/runner/dist/index.js +6 -0
  670. package/plugins/web-search/node_modules/@vitest/runner/dist/tasks.d-CkscK4of.d.ts +558 -0
  671. package/plugins/web-search/node_modules/@vitest/runner/dist/types.d.ts +163 -0
  672. package/plugins/web-search/node_modules/@vitest/runner/dist/types.js +1 -0
  673. package/plugins/web-search/node_modules/@vitest/runner/dist/utils.d.ts +47 -0
  674. package/plugins/web-search/node_modules/@vitest/runner/dist/utils.js +6 -0
  675. package/plugins/web-search/node_modules/@vitest/runner/package.json +49 -0
  676. package/plugins/web-search/node_modules/@vitest/snapshot/LICENSE +21 -0
  677. package/plugins/web-search/node_modules/@vitest/snapshot/README.md +84 -0
  678. package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.d-DHdQ1Csl.d.ts +22 -0
  679. package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.d.ts +16 -0
  680. package/plugins/web-search/node_modules/@vitest/snapshot/dist/environment.js +40 -0
  681. package/plugins/web-search/node_modules/@vitest/snapshot/dist/index.d.ts +137 -0
  682. package/plugins/web-search/node_modules/@vitest/snapshot/dist/index.js +2305 -0
  683. package/plugins/web-search/node_modules/@vitest/snapshot/dist/manager.d.ts +18 -0
  684. package/plugins/web-search/node_modules/@vitest/snapshot/dist/manager.js +73 -0
  685. package/plugins/web-search/node_modules/@vitest/snapshot/dist/rawSnapshot.d-lFsMJFUd.d.ts +61 -0
  686. package/plugins/web-search/node_modules/@vitest/snapshot/package.json +54 -0
  687. package/plugins/web-search/node_modules/@vitest/spy/LICENSE +21 -0
  688. package/plugins/web-search/node_modules/@vitest/spy/README.md +3 -0
  689. package/plugins/web-search/node_modules/@vitest/spy/dist/index.d.ts +356 -0
  690. package/plugins/web-search/node_modules/@vitest/spy/dist/index.js +191 -0
  691. package/plugins/web-search/node_modules/@vitest/spy/package.json +38 -0
  692. package/plugins/web-search/node_modules/@vitest/utils/LICENSE +21 -0
  693. package/plugins/web-search/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +158 -0
  694. package/plugins/web-search/node_modules/@vitest/utils/dist/diff.d.ts +104 -0
  695. package/plugins/web-search/node_modules/@vitest/utils/dist/diff.js +2185 -0
  696. package/plugins/web-search/node_modules/@vitest/utils/dist/error.d.ts +9 -0
  697. package/plugins/web-search/node_modules/@vitest/utils/dist/error.js +162 -0
  698. package/plugins/web-search/node_modules/@vitest/utils/dist/helpers.d.ts +56 -0
  699. package/plugins/web-search/node_modules/@vitest/utils/dist/helpers.js +251 -0
  700. package/plugins/web-search/node_modules/@vitest/utils/dist/index.d.ts +57 -0
  701. package/plugins/web-search/node_modules/@vitest/utils/dist/index.js +633 -0
  702. package/plugins/web-search/node_modules/@vitest/utils/dist/source-map.d.ts +139 -0
  703. package/plugins/web-search/node_modules/@vitest/utils/dist/source-map.js +996 -0
  704. package/plugins/web-search/node_modules/@vitest/utils/dist/types.d-BCElaP-c.d.ts +53 -0
  705. package/plugins/web-search/node_modules/@vitest/utils/dist/types.d.ts +53 -0
  706. package/plugins/web-search/node_modules/@vitest/utils/dist/types.js +1 -0
  707. package/plugins/web-search/node_modules/@vitest/utils/package.json +77 -0
  708. package/plugins/web-search/node_modules/chai/LICENSE +21 -0
  709. package/plugins/web-search/node_modules/chai/README.md +162 -0
  710. package/plugins/web-search/node_modules/chai/package.json +74 -0
  711. package/plugins/web-search/node_modules/esbuild/README.md +3 -0
  712. package/plugins/web-search/node_modules/esbuild/package.json +49 -0
  713. package/plugins/web-search/node_modules/std-env/README.md +118 -0
  714. package/plugins/web-search/node_modules/std-env/dist/index.cjs +1 -0
  715. package/plugins/web-search/node_modules/std-env/dist/index.d.cts +92 -0
  716. package/plugins/web-search/node_modules/std-env/dist/index.d.mts +92 -0
  717. package/plugins/web-search/node_modules/std-env/dist/index.d.ts +92 -0
  718. package/plugins/web-search/node_modules/std-env/dist/index.mjs +1 -0
  719. package/plugins/web-search/node_modules/std-env/package.json +46 -0
  720. package/plugins/web-search/node_modules/tinyexec/LICENSE +21 -0
  721. package/plugins/web-search/node_modules/tinyexec/README.md +256 -0
  722. package/plugins/web-search/node_modules/tinyexec/dist/main.cjs +575 -0
  723. package/plugins/web-search/node_modules/tinyexec/dist/main.d.cts +70 -0
  724. package/plugins/web-search/node_modules/tinyexec/dist/main.d.ts +70 -0
  725. package/plugins/web-search/node_modules/tinyexec/dist/main.js +578 -0
  726. package/plugins/web-search/node_modules/tinyexec/package.json +66 -0
  727. package/plugins/web-search/node_modules/tinyrainbow/README.md +28 -0
  728. package/plugins/web-search/node_modules/tinyrainbow/dist/browser.d.ts +8 -0
  729. package/plugins/web-search/node_modules/tinyrainbow/dist/browser.js +20 -0
  730. package/plugins/web-search/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +90 -0
  731. package/plugins/web-search/node_modules/tinyrainbow/dist/index-8b61d5bc.d.ts +59 -0
  732. package/plugins/web-search/node_modules/tinyrainbow/dist/node.d.ts +8 -0
  733. package/plugins/web-search/node_modules/tinyrainbow/dist/node.js +22 -0
  734. package/plugins/web-search/node_modules/tinyrainbow/package.json +37 -0
  735. package/plugins/web-search/node_modules/typescript/README.md +50 -0
  736. package/plugins/web-search/node_modules/typescript/package.json +120 -0
  737. package/plugins/web-search/node_modules/vite/README.md +20 -0
  738. package/plugins/web-search/node_modules/vite/dist/client/client.mjs +1106 -0
  739. package/plugins/web-search/node_modules/vite/dist/client/env.mjs +19 -0
  740. package/plugins/web-search/node_modules/vite/dist/node/chunks/build.js +4 -0
  741. package/plugins/web-search/node_modules/vite/dist/node/chunks/build2.js +5538 -0
  742. package/plugins/web-search/node_modules/vite/dist/node/chunks/chunk.js +48 -0
  743. package/plugins/web-search/node_modules/vite/dist/node/chunks/config.js +36065 -0
  744. package/plugins/web-search/node_modules/vite/dist/node/chunks/config2.js +4 -0
  745. package/plugins/web-search/node_modules/vite/dist/node/chunks/dist.js +6758 -0
  746. package/plugins/web-search/node_modules/vite/dist/node/chunks/lib.js +377 -0
  747. package/plugins/web-search/node_modules/vite/dist/node/chunks/logger.js +329 -0
  748. package/plugins/web-search/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts +96 -0
  749. package/plugins/web-search/node_modules/vite/dist/node/chunks/optimizer.js +4 -0
  750. package/plugins/web-search/node_modules/vite/dist/node/chunks/postcss-import.js +479 -0
  751. package/plugins/web-search/node_modules/vite/dist/node/chunks/preview.js +4 -0
  752. package/plugins/web-search/node_modules/vite/dist/node/chunks/server.js +4 -0
  753. package/plugins/web-search/node_modules/vite/dist/node/cli.js +698 -0
  754. package/plugins/web-search/node_modules/vite/dist/node/index.d.ts +3717 -0
  755. package/plugins/web-search/node_modules/vite/dist/node/index.js +30 -0
  756. package/plugins/web-search/node_modules/vite/dist/node/module-runner.d.ts +311 -0
  757. package/plugins/web-search/node_modules/vite/dist/node/module-runner.js +1160 -0
  758. package/plugins/web-search/node_modules/vite/package.json +199 -0
  759. package/plugins/web-search/node_modules/vite/types/package.json +4 -0
  760. package/plugins/web-search/node_modules/vitest/README.md +7 -0
  761. package/plugins/web-search/node_modules/vitest/dist/browser.d.ts +34 -0
  762. package/plugins/web-search/node_modules/vitest/dist/browser.js +8 -0
  763. package/plugins/web-search/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +7 -0
  764. package/plugins/web-search/node_modules/vitest/dist/chunks/base.DfmxU-tU.js +38 -0
  765. package/plugins/web-search/node_modules/vitest/dist/chunks/benchmark.CYdenmiT.js +37 -0
  766. package/plugins/web-search/node_modules/vitest/dist/chunks/benchmark.d.BwvBVTda.d.ts +24 -0
  767. package/plugins/web-search/node_modules/vitest/dist/chunks/cac.0BJqEUeA.js +1469 -0
  768. package/plugins/web-search/node_modules/vitest/dist/chunks/cli-api.DWGBtMmz.js +10660 -0
  769. package/plugins/web-search/node_modules/vitest/dist/chunks/config.d.BKdhh7Zx.d.ts +224 -0
  770. package/plugins/web-search/node_modules/vitest/dist/chunks/console.CtFJOzRO.js +153 -0
  771. package/plugins/web-search/node_modules/vitest/dist/chunks/constants.DnKduX2e.js +44 -0
  772. package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.DVF1vEu8.js +25 -0
  773. package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.DfSpMS-b.js +4350 -0
  774. package/plugins/web-search/node_modules/vitest/dist/chunks/coverage.d.S9RMNXIe.d.ts +35 -0
  775. package/plugins/web-search/node_modules/vitest/dist/chunks/creator.GK6I-cL4.js +640 -0
  776. package/plugins/web-search/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +73 -0
  777. package/plugins/web-search/node_modules/vitest/dist/chunks/defaults.B7q_naMc.js +115 -0
  778. package/plugins/web-search/node_modules/vitest/dist/chunks/env.D4Lgay0q.js +8 -0
  779. package/plugins/web-search/node_modules/vitest/dist/chunks/environment.d.cL3nLXbE.d.ts +119 -0
  780. package/plugins/web-search/node_modules/vitest/dist/chunks/execute.B7h3T_Hc.js +708 -0
  781. package/plugins/web-search/node_modules/vitest/dist/chunks/git.BVQ8w_Sw.js +72 -0
  782. package/plugins/web-search/node_modules/vitest/dist/chunks/global.d.MAmajcmJ.d.ts +136 -0
  783. package/plugins/web-search/node_modules/vitest/dist/chunks/globals.DEHgCU4V.js +26 -0
  784. package/plugins/web-search/node_modules/vitest/dist/chunks/index.B521nVV-.js +157 -0
  785. package/plugins/web-search/node_modules/vitest/dist/chunks/index.BCWujgDG.js +231 -0
  786. package/plugins/web-search/node_modules/vitest/dist/chunks/index.CdQS2e2Q.js +37 -0
  787. package/plugins/web-search/node_modules/vitest/dist/chunks/index.CmSc2RE5.js +587 -0
  788. package/plugins/web-search/node_modules/vitest/dist/chunks/index.CwejwG0H.js +105 -0
  789. package/plugins/web-search/node_modules/vitest/dist/chunks/index.D3XRDfWc.js +213 -0
  790. package/plugins/web-search/node_modules/vitest/dist/chunks/index.VByaPkjc.js +2183 -0
  791. package/plugins/web-search/node_modules/vitest/dist/chunks/index.X0nbfr6-.js +6584 -0
  792. package/plugins/web-search/node_modules/vitest/dist/chunks/inspector.C914Efll.js +57 -0
  793. package/plugins/web-search/node_modules/vitest/dist/chunks/mocker.d.BE_2ls6u.d.ts +17 -0
  794. package/plugins/web-search/node_modules/vitest/dist/chunks/node.fjCdwEIl.js +15 -0
  795. package/plugins/web-search/node_modules/vitest/dist/chunks/reporters.d.BuRON0I0.d.ts +3168 -0
  796. package/plugins/web-search/node_modules/vitest/dist/chunks/rpc.-pEldfrD.js +83 -0
  797. package/plugins/web-search/node_modules/vitest/dist/chunks/runBaseTests.9Ij9_de-.js +129 -0
  798. package/plugins/web-search/node_modules/vitest/dist/chunks/setup-common.Dd054P77.js +60 -0
  799. package/plugins/web-search/node_modules/vitest/dist/chunks/suite.d.FvehnV49.d.ts +10 -0
  800. package/plugins/web-search/node_modules/vitest/dist/chunks/typechecker.DRKU1-1g.js +874 -0
  801. package/plugins/web-search/node_modules/vitest/dist/chunks/utils.CAioKnHs.js +61 -0
  802. package/plugins/web-search/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +65 -0
  803. package/plugins/web-search/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +4015 -0
  804. package/plugins/web-search/node_modules/vitest/dist/chunks/vite.d.BnOPPc46.d.ts +25 -0
  805. package/plugins/web-search/node_modules/vitest/dist/chunks/vm.BThCzidc.js +756 -0
  806. package/plugins/web-search/node_modules/vitest/dist/chunks/worker.d.CUgIPz9V.d.ts +176 -0
  807. package/plugins/web-search/node_modules/vitest/dist/chunks/worker.d.uzWsCv9X.d.ts +8 -0
  808. package/plugins/web-search/node_modules/vitest/dist/cli.js +27 -0
  809. package/plugins/web-search/node_modules/vitest/dist/config.cjs +148 -0
  810. package/plugins/web-search/node_modules/vitest/dist/config.d.ts +100 -0
  811. package/plugins/web-search/node_modules/vitest/dist/config.js +21 -0
  812. package/plugins/web-search/node_modules/vitest/dist/coverage.d.ts +108 -0
  813. package/plugins/web-search/node_modules/vitest/dist/coverage.js +34 -0
  814. package/plugins/web-search/node_modules/vitest/dist/environments.d.ts +26 -0
  815. package/plugins/web-search/node_modules/vitest/dist/environments.js +2 -0
  816. package/plugins/web-search/node_modules/vitest/dist/execute.d.ts +150 -0
  817. package/plugins/web-search/node_modules/vitest/dist/execute.js +13 -0
  818. package/plugins/web-search/node_modules/vitest/dist/index.d.ts +651 -0
  819. package/plugins/web-search/node_modules/vitest/dist/index.js +18 -0
  820. package/plugins/web-search/node_modules/vitest/dist/mocker.d.ts +1 -0
  821. package/plugins/web-search/node_modules/vitest/dist/mocker.js +1 -0
  822. package/plugins/web-search/node_modules/vitest/dist/node.d.ts +158 -0
  823. package/plugins/web-search/node_modules/vitest/dist/node.js +105 -0
  824. package/plugins/web-search/node_modules/vitest/dist/path.js +7 -0
  825. package/plugins/web-search/node_modules/vitest/dist/reporters.d.ts +25 -0
  826. package/plugins/web-search/node_modules/vitest/dist/reporters.js +23 -0
  827. package/plugins/web-search/node_modules/vitest/dist/runners.d.ts +46 -0
  828. package/plugins/web-search/node_modules/vitest/dist/runners.js +235 -0
  829. package/plugins/web-search/node_modules/vitest/dist/snapshot.d.ts +9 -0
  830. package/plugins/web-search/node_modules/vitest/dist/snapshot.js +4 -0
  831. package/plugins/web-search/node_modules/vitest/dist/spy.js +1 -0
  832. package/plugins/web-search/node_modules/vitest/dist/suite.d.ts +5 -0
  833. package/plugins/web-search/node_modules/vitest/dist/suite.js +5 -0
  834. package/plugins/web-search/node_modules/vitest/dist/worker.js +124 -0
  835. package/plugins/web-search/node_modules/vitest/dist/workers/forks.js +43 -0
  836. package/plugins/web-search/node_modules/vitest/dist/workers/runVmTests.js +90 -0
  837. package/plugins/web-search/node_modules/vitest/dist/workers/threads.js +31 -0
  838. package/plugins/web-search/node_modules/vitest/dist/workers/vmForks.js +47 -0
  839. package/plugins/web-search/node_modules/vitest/dist/workers/vmThreads.js +37 -0
  840. package/plugins/web-search/node_modules/vitest/dist/workers.d.ts +40 -0
  841. package/plugins/web-search/node_modules/vitest/dist/workers.js +30 -0
  842. package/plugins/web-search/node_modules/vitest/package.json +207 -0
  843. package/plugins/web-search/package.json +30 -0
  844. package/plugins/web-search/skills/web-search-howto.md +69 -0
  845. package/plugins/workboard/agent-seeds/echo-demo/agent.json +7 -0
  846. package/plugins/workboard/agent-seeds/llm-default/SOUL.md +53 -0
  847. package/plugins/workboard/agent-seeds/llm-default/agent.json +7 -0
  848. package/plugins/workboard/dist/client.d.ts +5 -0
  849. package/plugins/workboard/dist/client.d.ts.map +1 -0
  850. package/plugins/workboard/dist/client.js +895 -0
  851. package/plugins/workboard/dist/client.js.map +1 -0
  852. package/plugins/workboard/dist/db/agents.d.ts +100 -0
  853. package/plugins/workboard/dist/db/agents.d.ts.map +1 -0
  854. package/plugins/workboard/dist/db/agents.js +280 -0
  855. package/plugins/workboard/dist/db/agents.js.map +1 -0
  856. package/plugins/workboard/dist/db/schema.d.ts +3 -0
  857. package/plugins/workboard/dist/db/schema.d.ts.map +1 -0
  858. package/plugins/workboard/dist/db/schema.js +31 -0
  859. package/plugins/workboard/dist/db/schema.js.map +1 -0
  860. package/plugins/workboard/dist/db/session-history.d.ts +28 -0
  861. package/plugins/workboard/dist/db/session-history.d.ts.map +1 -0
  862. package/plugins/workboard/dist/db/session-history.js +224 -0
  863. package/plugins/workboard/dist/db/session-history.js.map +1 -0
  864. package/plugins/workboard/dist/db/tasks.d.ts +260 -0
  865. package/plugins/workboard/dist/db/tasks.d.ts.map +1 -0
  866. package/plugins/workboard/dist/db/tasks.js +451 -0
  867. package/plugins/workboard/dist/db/tasks.js.map +1 -0
  868. package/plugins/workboard/dist/db/worker-agents.d.ts +16 -0
  869. package/plugins/workboard/dist/db/worker-agents.d.ts.map +1 -0
  870. package/plugins/workboard/dist/db/worker-agents.js +62 -0
  871. package/plugins/workboard/dist/db/worker-agents.js.map +1 -0
  872. package/plugins/workboard/dist/effective-skills.d.ts +13 -0
  873. package/plugins/workboard/dist/effective-skills.d.ts.map +1 -0
  874. package/plugins/workboard/dist/effective-skills.js +126 -0
  875. package/plugins/workboard/dist/effective-skills.js.map +1 -0
  876. package/plugins/workboard/dist/fs-worker-agents.d.ts +35 -0
  877. package/plugins/workboard/dist/fs-worker-agents.d.ts.map +1 -0
  878. package/plugins/workboard/dist/fs-worker-agents.js +199 -0
  879. package/plugins/workboard/dist/fs-worker-agents.js.map +1 -0
  880. package/plugins/workboard/dist/migrate-worker-agents.d.ts +11 -0
  881. package/plugins/workboard/dist/migrate-worker-agents.d.ts.map +1 -0
  882. package/plugins/workboard/dist/migrate-worker-agents.js +89 -0
  883. package/plugins/workboard/dist/migrate-worker-agents.js.map +1 -0
  884. package/plugins/workboard/dist/routes/handlers.d.ts +106 -0
  885. package/plugins/workboard/dist/routes/handlers.d.ts.map +1 -0
  886. package/plugins/workboard/dist/routes/handlers.js +668 -0
  887. package/plugins/workboard/dist/routes/handlers.js.map +1 -0
  888. package/plugins/workboard/dist/server.d.ts +6 -0
  889. package/plugins/workboard/dist/server.d.ts.map +1 -0
  890. package/plugins/workboard/dist/server.js +368 -0
  891. package/plugins/workboard/dist/server.js.map +1 -0
  892. package/plugins/workboard/dist/tools/index.d.ts +70 -0
  893. package/plugins/workboard/dist/tools/index.d.ts.map +1 -0
  894. package/plugins/workboard/dist/tools/index.js +963 -0
  895. package/plugins/workboard/dist/tools/index.js.map +1 -0
  896. package/plugins/workboard/dist/types.d.ts +27 -0
  897. package/plugins/workboard/dist/types.d.ts.map +1 -0
  898. package/plugins/workboard/dist/types.js +16 -0
  899. package/plugins/workboard/dist/types.js.map +1 -0
  900. package/plugins/workboard/dist/worker/pool.d.ts +220 -0
  901. package/plugins/workboard/dist/worker/pool.d.ts.map +1 -0
  902. package/plugins/workboard/dist/worker/pool.js +866 -0
  903. package/plugins/workboard/dist/worker/pool.js.map +1 -0
  904. package/plugins/workboard/dist/worker/tool-policy.d.ts +27 -0
  905. package/plugins/workboard/dist/worker/tool-policy.d.ts.map +1 -0
  906. package/plugins/workboard/dist/worker/tool-policy.js +76 -0
  907. package/plugins/workboard/dist/worker/tool-policy.js.map +1 -0
  908. package/plugins/workboard/dist/worker-agents-page.d.ts +4 -0
  909. package/plugins/workboard/dist/worker-agents-page.d.ts.map +1 -0
  910. package/plugins/workboard/dist/worker-agents-page.js +193 -0
  911. package/plugins/workboard/dist/worker-agents-page.js.map +1 -0
  912. package/plugins/workboard/manifest.json +180 -0
  913. package/plugins/workboard/package.json +37 -0
  914. package/plugins/workboard/skills/large-input-large-output.md +185 -0
  915. package/plugins/workboard/skills/workboard-howto.md +166 -0
  916. package/plugins/workboard/skills/worker-creator.md +267 -0
  917. package/plugins/workboard/skills/worker-fleet.md +431 -0
@@ -0,0 +1,2305 @@
1
+ import { resolve as resolve$2 } from 'pathe';
2
+ import { plugins, format } from '@vitest/pretty-format';
3
+
4
+ const comma = ','.charCodeAt(0);
5
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
6
+ const intToChar = new Uint8Array(64); // 64 possible chars.
7
+ const charToInt = new Uint8Array(128); // z is 122 in ASCII
8
+ for (let i = 0; i < chars.length; i++) {
9
+ const c = chars.charCodeAt(i);
10
+ intToChar[i] = c;
11
+ charToInt[c] = i;
12
+ }
13
+ function decodeInteger(reader, relative) {
14
+ let value = 0;
15
+ let shift = 0;
16
+ let integer = 0;
17
+ do {
18
+ const c = reader.next();
19
+ integer = charToInt[c];
20
+ value |= (integer & 31) << shift;
21
+ shift += 5;
22
+ } while (integer & 32);
23
+ const shouldNegate = value & 1;
24
+ value >>>= 1;
25
+ if (shouldNegate) {
26
+ value = -2147483648 | -value;
27
+ }
28
+ return relative + value;
29
+ }
30
+ function hasMoreVlq(reader, max) {
31
+ if (reader.pos >= max)
32
+ return false;
33
+ return reader.peek() !== comma;
34
+ }
35
+ class StringReader {
36
+ constructor(buffer) {
37
+ this.pos = 0;
38
+ this.buffer = buffer;
39
+ }
40
+ next() {
41
+ return this.buffer.charCodeAt(this.pos++);
42
+ }
43
+ peek() {
44
+ return this.buffer.charCodeAt(this.pos);
45
+ }
46
+ indexOf(char) {
47
+ const { buffer, pos } = this;
48
+ const idx = buffer.indexOf(char, pos);
49
+ return idx === -1 ? buffer.length : idx;
50
+ }
51
+ }
52
+
53
+ function decode(mappings) {
54
+ const { length } = mappings;
55
+ const reader = new StringReader(mappings);
56
+ const decoded = [];
57
+ let genColumn = 0;
58
+ let sourcesIndex = 0;
59
+ let sourceLine = 0;
60
+ let sourceColumn = 0;
61
+ let namesIndex = 0;
62
+ do {
63
+ const semi = reader.indexOf(';');
64
+ const line = [];
65
+ let sorted = true;
66
+ let lastCol = 0;
67
+ genColumn = 0;
68
+ while (reader.pos < semi) {
69
+ let seg;
70
+ genColumn = decodeInteger(reader, genColumn);
71
+ if (genColumn < lastCol)
72
+ sorted = false;
73
+ lastCol = genColumn;
74
+ if (hasMoreVlq(reader, semi)) {
75
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
76
+ sourceLine = decodeInteger(reader, sourceLine);
77
+ sourceColumn = decodeInteger(reader, sourceColumn);
78
+ if (hasMoreVlq(reader, semi)) {
79
+ namesIndex = decodeInteger(reader, namesIndex);
80
+ seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
81
+ }
82
+ else {
83
+ seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
84
+ }
85
+ }
86
+ else {
87
+ seg = [genColumn];
88
+ }
89
+ line.push(seg);
90
+ reader.pos++;
91
+ }
92
+ if (!sorted)
93
+ sort(line);
94
+ decoded.push(line);
95
+ reader.pos = semi + 1;
96
+ } while (reader.pos <= length);
97
+ return decoded;
98
+ }
99
+ function sort(line) {
100
+ line.sort(sortComparator$1);
101
+ }
102
+ function sortComparator$1(a, b) {
103
+ return a[0] - b[0];
104
+ }
105
+
106
+ // Matches the scheme of a URL, eg "http://"
107
+ const schemeRegex = /^[\w+.-]+:\/\//;
108
+ /**
109
+ * Matches the parts of a URL:
110
+ * 1. Scheme, including ":", guaranteed.
111
+ * 2. User/password, including "@", optional.
112
+ * 3. Host, guaranteed.
113
+ * 4. Port, including ":", optional.
114
+ * 5. Path, including "/", optional.
115
+ * 6. Query, including "?", optional.
116
+ * 7. Hash, including "#", optional.
117
+ */
118
+ const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
119
+ /**
120
+ * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
121
+ * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
122
+ *
123
+ * 1. Host, optional.
124
+ * 2. Path, which may include "/", guaranteed.
125
+ * 3. Query, including "?", optional.
126
+ * 4. Hash, including "#", optional.
127
+ */
128
+ const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
129
+ var UrlType;
130
+ (function (UrlType) {
131
+ UrlType[UrlType["Empty"] = 1] = "Empty";
132
+ UrlType[UrlType["Hash"] = 2] = "Hash";
133
+ UrlType[UrlType["Query"] = 3] = "Query";
134
+ UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
135
+ UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
136
+ UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
137
+ UrlType[UrlType["Absolute"] = 7] = "Absolute";
138
+ })(UrlType || (UrlType = {}));
139
+ function isAbsoluteUrl(input) {
140
+ return schemeRegex.test(input);
141
+ }
142
+ function isSchemeRelativeUrl(input) {
143
+ return input.startsWith('//');
144
+ }
145
+ function isAbsolutePath(input) {
146
+ return input.startsWith('/');
147
+ }
148
+ function isFileUrl(input) {
149
+ return input.startsWith('file:');
150
+ }
151
+ function isRelative(input) {
152
+ return /^[.?#]/.test(input);
153
+ }
154
+ function parseAbsoluteUrl(input) {
155
+ const match = urlRegex.exec(input);
156
+ return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
157
+ }
158
+ function parseFileUrl(input) {
159
+ const match = fileRegex.exec(input);
160
+ const path = match[2];
161
+ return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
162
+ }
163
+ function makeUrl(scheme, user, host, port, path, query, hash) {
164
+ return {
165
+ scheme,
166
+ user,
167
+ host,
168
+ port,
169
+ path,
170
+ query,
171
+ hash,
172
+ type: UrlType.Absolute,
173
+ };
174
+ }
175
+ function parseUrl(input) {
176
+ if (isSchemeRelativeUrl(input)) {
177
+ const url = parseAbsoluteUrl('http:' + input);
178
+ url.scheme = '';
179
+ url.type = UrlType.SchemeRelative;
180
+ return url;
181
+ }
182
+ if (isAbsolutePath(input)) {
183
+ const url = parseAbsoluteUrl('http://foo.com' + input);
184
+ url.scheme = '';
185
+ url.host = '';
186
+ url.type = UrlType.AbsolutePath;
187
+ return url;
188
+ }
189
+ if (isFileUrl(input))
190
+ return parseFileUrl(input);
191
+ if (isAbsoluteUrl(input))
192
+ return parseAbsoluteUrl(input);
193
+ const url = parseAbsoluteUrl('http://foo.com/' + input);
194
+ url.scheme = '';
195
+ url.host = '';
196
+ url.type = input
197
+ ? input.startsWith('?')
198
+ ? UrlType.Query
199
+ : input.startsWith('#')
200
+ ? UrlType.Hash
201
+ : UrlType.RelativePath
202
+ : UrlType.Empty;
203
+ return url;
204
+ }
205
+ function stripPathFilename(path) {
206
+ // If a path ends with a parent directory "..", then it's a relative path with excess parent
207
+ // paths. It's not a file, so we can't strip it.
208
+ if (path.endsWith('/..'))
209
+ return path;
210
+ const index = path.lastIndexOf('/');
211
+ return path.slice(0, index + 1);
212
+ }
213
+ function mergePaths(url, base) {
214
+ normalizePath(base, base.type);
215
+ // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
216
+ // path).
217
+ if (url.path === '/') {
218
+ url.path = base.path;
219
+ }
220
+ else {
221
+ // Resolution happens relative to the base path's directory, not the file.
222
+ url.path = stripPathFilename(base.path) + url.path;
223
+ }
224
+ }
225
+ /**
226
+ * The path can have empty directories "//", unneeded parents "foo/..", or current directory
227
+ * "foo/.". We need to normalize to a standard representation.
228
+ */
229
+ function normalizePath(url, type) {
230
+ const rel = type <= UrlType.RelativePath;
231
+ const pieces = url.path.split('/');
232
+ // We need to preserve the first piece always, so that we output a leading slash. The item at
233
+ // pieces[0] is an empty string.
234
+ let pointer = 1;
235
+ // Positive is the number of real directories we've output, used for popping a parent directory.
236
+ // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
237
+ let positive = 0;
238
+ // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
239
+ // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
240
+ // real directory, we won't need to append, unless the other conditions happen again.
241
+ let addTrailingSlash = false;
242
+ for (let i = 1; i < pieces.length; i++) {
243
+ const piece = pieces[i];
244
+ // An empty directory, could be a trailing slash, or just a double "//" in the path.
245
+ if (!piece) {
246
+ addTrailingSlash = true;
247
+ continue;
248
+ }
249
+ // If we encounter a real directory, then we don't need to append anymore.
250
+ addTrailingSlash = false;
251
+ // A current directory, which we can always drop.
252
+ if (piece === '.')
253
+ continue;
254
+ // A parent directory, we need to see if there are any real directories we can pop. Else, we
255
+ // have an excess of parents, and we'll need to keep the "..".
256
+ if (piece === '..') {
257
+ if (positive) {
258
+ addTrailingSlash = true;
259
+ positive--;
260
+ pointer--;
261
+ }
262
+ else if (rel) {
263
+ // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
264
+ // URL, protocol relative URL, or an absolute path, we don't need to keep excess.
265
+ pieces[pointer++] = piece;
266
+ }
267
+ continue;
268
+ }
269
+ // We've encountered a real directory. Move it to the next insertion pointer, which accounts for
270
+ // any popped or dropped directories.
271
+ pieces[pointer++] = piece;
272
+ positive++;
273
+ }
274
+ let path = '';
275
+ for (let i = 1; i < pointer; i++) {
276
+ path += '/' + pieces[i];
277
+ }
278
+ if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
279
+ path += '/';
280
+ }
281
+ url.path = path;
282
+ }
283
+ /**
284
+ * Attempts to resolve `input` URL/path relative to `base`.
285
+ */
286
+ function resolve$1(input, base) {
287
+ if (!input && !base)
288
+ return '';
289
+ const url = parseUrl(input);
290
+ let inputType = url.type;
291
+ if (base && inputType !== UrlType.Absolute) {
292
+ const baseUrl = parseUrl(base);
293
+ const baseType = baseUrl.type;
294
+ switch (inputType) {
295
+ case UrlType.Empty:
296
+ url.hash = baseUrl.hash;
297
+ // fall through
298
+ case UrlType.Hash:
299
+ url.query = baseUrl.query;
300
+ // fall through
301
+ case UrlType.Query:
302
+ case UrlType.RelativePath:
303
+ mergePaths(url, baseUrl);
304
+ // fall through
305
+ case UrlType.AbsolutePath:
306
+ // The host, user, and port are joined, you can't copy one without the others.
307
+ url.user = baseUrl.user;
308
+ url.host = baseUrl.host;
309
+ url.port = baseUrl.port;
310
+ // fall through
311
+ case UrlType.SchemeRelative:
312
+ // The input doesn't have a schema at least, so we need to copy at least that over.
313
+ url.scheme = baseUrl.scheme;
314
+ }
315
+ if (baseType > inputType)
316
+ inputType = baseType;
317
+ }
318
+ normalizePath(url, inputType);
319
+ const queryHash = url.query + url.hash;
320
+ switch (inputType) {
321
+ // This is impossible, because of the empty checks at the start of the function.
322
+ // case UrlType.Empty:
323
+ case UrlType.Hash:
324
+ case UrlType.Query:
325
+ return queryHash;
326
+ case UrlType.RelativePath: {
327
+ // The first char is always a "/", and we need it to be relative.
328
+ const path = url.path.slice(1);
329
+ if (!path)
330
+ return queryHash || '.';
331
+ if (isRelative(base || input) && !isRelative(path)) {
332
+ // If base started with a leading ".", or there is no base and input started with a ".",
333
+ // then we need to ensure that the relative path starts with a ".". We don't know if
334
+ // relative starts with a "..", though, so check before prepending.
335
+ return './' + path + queryHash;
336
+ }
337
+ return path + queryHash;
338
+ }
339
+ case UrlType.AbsolutePath:
340
+ return url.path + queryHash;
341
+ default:
342
+ return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
343
+ }
344
+ }
345
+
346
+ function resolve(input, base) {
347
+ // The base is always treated as a directory, if it's not empty.
348
+ // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
349
+ // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
350
+ if (base && !base.endsWith('/'))
351
+ base += '/';
352
+ return resolve$1(input, base);
353
+ }
354
+
355
+ /**
356
+ * Removes everything after the last "/", but leaves the slash.
357
+ */
358
+ function stripFilename(path) {
359
+ if (!path)
360
+ return '';
361
+ const index = path.lastIndexOf('/');
362
+ return path.slice(0, index + 1);
363
+ }
364
+
365
+ const COLUMN = 0;
366
+ const SOURCES_INDEX = 1;
367
+ const SOURCE_LINE = 2;
368
+ const SOURCE_COLUMN = 3;
369
+ const NAMES_INDEX = 4;
370
+
371
+ function maybeSort(mappings, owned) {
372
+ const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
373
+ if (unsortedIndex === mappings.length)
374
+ return mappings;
375
+ // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If
376
+ // not, we do not want to modify the consumer's input array.
377
+ if (!owned)
378
+ mappings = mappings.slice();
379
+ for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
380
+ mappings[i] = sortSegments(mappings[i], owned);
381
+ }
382
+ return mappings;
383
+ }
384
+ function nextUnsortedSegmentLine(mappings, start) {
385
+ for (let i = start; i < mappings.length; i++) {
386
+ if (!isSorted(mappings[i]))
387
+ return i;
388
+ }
389
+ return mappings.length;
390
+ }
391
+ function isSorted(line) {
392
+ for (let j = 1; j < line.length; j++) {
393
+ if (line[j][COLUMN] < line[j - 1][COLUMN]) {
394
+ return false;
395
+ }
396
+ }
397
+ return true;
398
+ }
399
+ function sortSegments(line, owned) {
400
+ if (!owned)
401
+ line = line.slice();
402
+ return line.sort(sortComparator);
403
+ }
404
+ function sortComparator(a, b) {
405
+ return a[COLUMN] - b[COLUMN];
406
+ }
407
+
408
+ let found = false;
409
+ /**
410
+ * A binary search implementation that returns the index if a match is found.
411
+ * If no match is found, then the left-index (the index associated with the item that comes just
412
+ * before the desired index) is returned. To maintain proper sort order, a splice would happen at
413
+ * the next index:
414
+ *
415
+ * ```js
416
+ * const array = [1, 3];
417
+ * const needle = 2;
418
+ * const index = binarySearch(array, needle, (item, needle) => item - needle);
419
+ *
420
+ * assert.equal(index, 0);
421
+ * array.splice(index + 1, 0, needle);
422
+ * assert.deepEqual(array, [1, 2, 3]);
423
+ * ```
424
+ */
425
+ function binarySearch(haystack, needle, low, high) {
426
+ while (low <= high) {
427
+ const mid = low + ((high - low) >> 1);
428
+ const cmp = haystack[mid][COLUMN] - needle;
429
+ if (cmp === 0) {
430
+ found = true;
431
+ return mid;
432
+ }
433
+ if (cmp < 0) {
434
+ low = mid + 1;
435
+ }
436
+ else {
437
+ high = mid - 1;
438
+ }
439
+ }
440
+ found = false;
441
+ return low - 1;
442
+ }
443
+ function upperBound(haystack, needle, index) {
444
+ for (let i = index + 1; i < haystack.length; index = i++) {
445
+ if (haystack[i][COLUMN] !== needle)
446
+ break;
447
+ }
448
+ return index;
449
+ }
450
+ function lowerBound(haystack, needle, index) {
451
+ for (let i = index - 1; i >= 0; index = i--) {
452
+ if (haystack[i][COLUMN] !== needle)
453
+ break;
454
+ }
455
+ return index;
456
+ }
457
+ function memoizedState() {
458
+ return {
459
+ lastKey: -1,
460
+ lastNeedle: -1,
461
+ lastIndex: -1,
462
+ };
463
+ }
464
+ /**
465
+ * This overly complicated beast is just to record the last tested line/column and the resulting
466
+ * index, allowing us to skip a few tests if mappings are monotonically increasing.
467
+ */
468
+ function memoizedBinarySearch(haystack, needle, state, key) {
469
+ const { lastKey, lastNeedle, lastIndex } = state;
470
+ let low = 0;
471
+ let high = haystack.length - 1;
472
+ if (key === lastKey) {
473
+ if (needle === lastNeedle) {
474
+ found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
475
+ return lastIndex;
476
+ }
477
+ if (needle >= lastNeedle) {
478
+ // lastIndex may be -1 if the previous needle was not found.
479
+ low = lastIndex === -1 ? 0 : lastIndex;
480
+ }
481
+ else {
482
+ high = lastIndex;
483
+ }
484
+ }
485
+ state.lastKey = key;
486
+ state.lastNeedle = needle;
487
+ return (state.lastIndex = binarySearch(haystack, needle, low, high));
488
+ }
489
+
490
+ const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';
491
+ const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';
492
+ const LEAST_UPPER_BOUND = -1;
493
+ const GREATEST_LOWER_BOUND = 1;
494
+ class TraceMap {
495
+ constructor(map, mapUrl) {
496
+ const isString = typeof map === 'string';
497
+ if (!isString && map._decodedMemo)
498
+ return map;
499
+ const parsed = (isString ? JSON.parse(map) : map);
500
+ const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
501
+ this.version = version;
502
+ this.file = file;
503
+ this.names = names || [];
504
+ this.sourceRoot = sourceRoot;
505
+ this.sources = sources;
506
+ this.sourcesContent = sourcesContent;
507
+ this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || undefined;
508
+ const from = resolve(sourceRoot || '', stripFilename(mapUrl));
509
+ this.resolvedSources = sources.map((s) => resolve(s || '', from));
510
+ const { mappings } = parsed;
511
+ if (typeof mappings === 'string') {
512
+ this._encoded = mappings;
513
+ this._decoded = undefined;
514
+ }
515
+ else {
516
+ this._encoded = undefined;
517
+ this._decoded = maybeSort(mappings, isString);
518
+ }
519
+ this._decodedMemo = memoizedState();
520
+ this._bySources = undefined;
521
+ this._bySourceMemos = undefined;
522
+ }
523
+ }
524
+ /**
525
+ * Typescript doesn't allow friend access to private fields, so this just casts the map into a type
526
+ * with public access modifiers.
527
+ */
528
+ function cast(map) {
529
+ return map;
530
+ }
531
+ /**
532
+ * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
533
+ */
534
+ function decodedMappings(map) {
535
+ var _a;
536
+ return ((_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded)));
537
+ }
538
+ /**
539
+ * A higher-level API to find the source/line/column associated with a generated line/column
540
+ * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
541
+ * `source-map` library.
542
+ */
543
+ function originalPositionFor(map, needle) {
544
+ let { line, column, bias } = needle;
545
+ line--;
546
+ if (line < 0)
547
+ throw new Error(LINE_GTR_ZERO);
548
+ if (column < 0)
549
+ throw new Error(COL_GTR_EQ_ZERO);
550
+ const decoded = decodedMappings(map);
551
+ // It's common for parent source maps to have pointers to lines that have no
552
+ // mapping (like a "//# sourceMappingURL=") at the end of the child file.
553
+ if (line >= decoded.length)
554
+ return OMapping(null, null, null, null);
555
+ const segments = decoded[line];
556
+ const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
557
+ if (index === -1)
558
+ return OMapping(null, null, null, null);
559
+ const segment = segments[index];
560
+ if (segment.length === 1)
561
+ return OMapping(null, null, null, null);
562
+ const { names, resolvedSources } = map;
563
+ return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
564
+ }
565
+ function OMapping(source, line, column, name) {
566
+ return { source, line, column, name };
567
+ }
568
+ function traceSegmentInternal(segments, memo, line, column, bias) {
569
+ let index = memoizedBinarySearch(segments, column, memo, line);
570
+ if (found) {
571
+ index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
572
+ }
573
+ else if (bias === LEAST_UPPER_BOUND)
574
+ index++;
575
+ if (index === -1 || index === segments.length)
576
+ return -1;
577
+ return index;
578
+ }
579
+
580
+ /**
581
+ * Get original stacktrace without source map support the most performant way.
582
+ * - Create only 1 stack frame.
583
+ * - Rewrite prepareStackTrace to bypass "support-stack-trace" (usually takes ~250ms).
584
+ */
585
+ function notNullish(v) {
586
+ return v != null;
587
+ }
588
+ function isPrimitive(value) {
589
+ return value === null || typeof value !== "function" && typeof value !== "object";
590
+ }
591
+ function isObject(item) {
592
+ return item != null && typeof item === "object" && !Array.isArray(item);
593
+ }
594
+ /**
595
+ * If code starts with a function call, will return its last index, respecting arguments.
596
+ * This will return 25 - last ending character of toMatch ")"
597
+ * Also works with callbacks
598
+ * ```
599
+ * toMatch({ test: '123' });
600
+ * toBeAliased('123')
601
+ * ```
602
+ */
603
+ function getCallLastIndex(code) {
604
+ let charIndex = -1;
605
+ let inString = null;
606
+ let startedBracers = 0;
607
+ let endedBracers = 0;
608
+ let beforeChar = null;
609
+ while (charIndex <= code.length) {
610
+ beforeChar = code[charIndex];
611
+ charIndex++;
612
+ const char = code[charIndex];
613
+ const isCharString = char === "\"" || char === "'" || char === "`";
614
+ if (isCharString && beforeChar !== "\\") {
615
+ if (inString === char) {
616
+ inString = null;
617
+ } else if (!inString) {
618
+ inString = char;
619
+ }
620
+ }
621
+ if (!inString) {
622
+ if (char === "(") {
623
+ startedBracers++;
624
+ }
625
+ if (char === ")") {
626
+ endedBracers++;
627
+ }
628
+ }
629
+ if (startedBracers && endedBracers && startedBracers === endedBracers) {
630
+ return charIndex;
631
+ }
632
+ }
633
+ return null;
634
+ }
635
+
636
+ const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m;
637
+ const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/;
638
+ const stackIgnorePatterns = [
639
+ "node:internal",
640
+ /\/packages\/\w+\/dist\//,
641
+ /\/@vitest\/\w+\/dist\//,
642
+ "/vitest/dist/",
643
+ "/vitest/src/",
644
+ "/vite-node/dist/",
645
+ "/vite-node/src/",
646
+ "/node_modules/chai/",
647
+ "/node_modules/tinypool/",
648
+ "/node_modules/tinyspy/",
649
+ "/deps/chunk-",
650
+ "/deps/@vitest",
651
+ "/deps/loupe",
652
+ "/deps/chai",
653
+ /node:\w+/,
654
+ /__vitest_test__/,
655
+ /__vitest_browser__/,
656
+ /\/deps\/vitest_/
657
+ ];
658
+ function extractLocation(urlLike) {
659
+ // Fail-fast but return locations like "(native)"
660
+ if (!urlLike.includes(":")) {
661
+ return [urlLike];
662
+ }
663
+ const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
664
+ const parts = regExp.exec(urlLike.replace(/^\(|\)$/g, ""));
665
+ if (!parts) {
666
+ return [urlLike];
667
+ }
668
+ let url = parts[1];
669
+ if (url.startsWith("async ")) {
670
+ url = url.slice(6);
671
+ }
672
+ if (url.startsWith("http:") || url.startsWith("https:")) {
673
+ const urlObj = new URL(url);
674
+ urlObj.searchParams.delete("import");
675
+ urlObj.searchParams.delete("browserv");
676
+ url = urlObj.pathname + urlObj.hash + urlObj.search;
677
+ }
678
+ if (url.startsWith("/@fs/")) {
679
+ const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
680
+ url = url.slice(isWindows ? 5 : 4);
681
+ }
682
+ return [
683
+ url,
684
+ parts[2] || undefined,
685
+ parts[3] || undefined
686
+ ];
687
+ }
688
+ function parseSingleFFOrSafariStack(raw) {
689
+ let line = raw.trim();
690
+ if (SAFARI_NATIVE_CODE_REGEXP.test(line)) {
691
+ return null;
692
+ }
693
+ if (line.includes(" > eval")) {
694
+ line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
695
+ }
696
+ if (!line.includes("@") && !line.includes(":")) {
697
+ return null;
698
+ }
699
+ // eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/optimal-quantifier-concatenation
700
+ const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(@)/;
701
+ const matches = line.match(functionNameRegex);
702
+ const functionName = matches && matches[1] ? matches[1] : undefined;
703
+ const [url, lineNumber, columnNumber] = extractLocation(line.replace(functionNameRegex, ""));
704
+ if (!url || !lineNumber || !columnNumber) {
705
+ return null;
706
+ }
707
+ return {
708
+ file: url,
709
+ method: functionName || "",
710
+ line: Number.parseInt(lineNumber),
711
+ column: Number.parseInt(columnNumber)
712
+ };
713
+ }
714
+ // Based on https://github.com/stacktracejs/error-stack-parser
715
+ // Credit to stacktracejs
716
+ function parseSingleV8Stack(raw) {
717
+ let line = raw.trim();
718
+ if (!CHROME_IE_STACK_REGEXP.test(line)) {
719
+ return null;
720
+ }
721
+ if (line.includes("(eval ")) {
722
+ line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
723
+ }
724
+ let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
725
+ // capture and preserve the parenthesized location "(/foo/my bar.js:12:87)" in
726
+ // case it has spaces in it, as the string is split on \s+ later on
727
+ const location = sanitizedLine.match(/ (\(.+\)$)/);
728
+ // remove the parenthesized location from the line, if it was matched
729
+ sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
730
+ // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine
731
+ // because this line doesn't have function name
732
+ const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine);
733
+ let method = location && sanitizedLine || "";
734
+ let file = url && ["eval", "<anonymous>"].includes(url) ? undefined : url;
735
+ if (!file || !lineNumber || !columnNumber) {
736
+ return null;
737
+ }
738
+ if (method.startsWith("async ")) {
739
+ method = method.slice(6);
740
+ }
741
+ if (file.startsWith("file://")) {
742
+ file = file.slice(7);
743
+ }
744
+ // normalize Windows path (\ -> /)
745
+ file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve$2(file);
746
+ if (method) {
747
+ method = method.replace(/__vite_ssr_import_\d+__\./g, "");
748
+ }
749
+ return {
750
+ method,
751
+ file,
752
+ line: Number.parseInt(lineNumber),
753
+ column: Number.parseInt(columnNumber)
754
+ };
755
+ }
756
+ function parseStacktrace(stack, options = {}) {
757
+ const { ignoreStackEntries = stackIgnorePatterns } = options;
758
+ const stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
759
+ return stacks.map((stack) => {
760
+ var _options$getSourceMap;
761
+ if (options.getUrlId) {
762
+ stack.file = options.getUrlId(stack.file);
763
+ }
764
+ const map = (_options$getSourceMap = options.getSourceMap) === null || _options$getSourceMap === void 0 ? void 0 : _options$getSourceMap.call(options, stack.file);
765
+ if (!map || typeof map !== "object" || !map.version) {
766
+ return shouldFilter(ignoreStackEntries, stack.file) ? null : stack;
767
+ }
768
+ const traceMap = new TraceMap(map);
769
+ const { line, column, source, name } = originalPositionFor(traceMap, stack);
770
+ let file = stack.file;
771
+ if (source) {
772
+ const fileUrl = stack.file.startsWith("file://") ? stack.file : `file://${stack.file}`;
773
+ const sourceRootUrl = map.sourceRoot ? new URL(map.sourceRoot, fileUrl) : fileUrl;
774
+ file = new URL(source, sourceRootUrl).pathname;
775
+ // if the file path is on windows, we need to remove the leading slash
776
+ if (file.match(/\/\w:\//)) {
777
+ file = file.slice(1);
778
+ }
779
+ }
780
+ if (shouldFilter(ignoreStackEntries, file)) {
781
+ return null;
782
+ }
783
+ if (line != null && column != null) {
784
+ return {
785
+ line,
786
+ column,
787
+ file,
788
+ method: name || stack.method
789
+ };
790
+ }
791
+ return stack;
792
+ }).filter((s) => s != null);
793
+ }
794
+ function shouldFilter(ignoreStackEntries, file) {
795
+ return ignoreStackEntries.some((p) => file.match(p));
796
+ }
797
+ function parseFFOrSafariStackTrace(stack) {
798
+ return stack.split("\n").map((line) => parseSingleFFOrSafariStack(line)).filter(notNullish);
799
+ }
800
+ function parseV8Stacktrace(stack) {
801
+ return stack.split("\n").map((line) => parseSingleV8Stack(line)).filter(notNullish);
802
+ }
803
+ function parseErrorStacktrace(e, options = {}) {
804
+ if (!e || isPrimitive(e)) {
805
+ return [];
806
+ }
807
+ if (e.stacks) {
808
+ return e.stacks;
809
+ }
810
+ const stackStr = e.stack || "";
811
+ // if "stack" property was overwritten at runtime to be something else,
812
+ // ignore the value because we don't know how to process it
813
+ let stackFrames = typeof stackStr === "string" ? parseStacktrace(stackStr, options) : [];
814
+ if (!stackFrames.length) {
815
+ const e_ = e;
816
+ if (e_.fileName != null && e_.lineNumber != null && e_.columnNumber != null) {
817
+ stackFrames = parseStacktrace(`${e_.fileName}:${e_.lineNumber}:${e_.columnNumber}`, options);
818
+ }
819
+ if (e_.sourceURL != null && e_.line != null && e_._column != null) {
820
+ stackFrames = parseStacktrace(`${e_.sourceURL}:${e_.line}:${e_.column}`, options);
821
+ }
822
+ }
823
+ if (options.frameFilter) {
824
+ stackFrames = stackFrames.filter((f) => options.frameFilter(e, f) !== false);
825
+ }
826
+ e.stacks = stackFrames;
827
+ return stackFrames;
828
+ }
829
+
830
+ let getPromiseValue = () => 'Promise{…}';
831
+ try {
832
+ // @ts-ignore
833
+ const { getPromiseDetails, kPending, kRejected } = process.binding('util');
834
+ if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
835
+ getPromiseValue = (value, options) => {
836
+ const [state, innerValue] = getPromiseDetails(value);
837
+ if (state === kPending) {
838
+ return 'Promise{<pending>}';
839
+ }
840
+ return `Promise${state === kRejected ? '!' : ''}{${options.inspect(innerValue, options)}}`;
841
+ };
842
+ }
843
+ }
844
+ catch (notNode) {
845
+ /* ignore */
846
+ }
847
+
848
+ const { AsymmetricMatcher: AsymmetricMatcher$1, DOMCollection: DOMCollection$1, DOMElement: DOMElement$1, Immutable: Immutable$1, ReactElement: ReactElement$1, ReactTestComponent: ReactTestComponent$1 } = plugins;
849
+
850
+ function getDefaultExportFromCjs (x) {
851
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
852
+ }
853
+
854
+ var jsTokens_1;
855
+ var hasRequiredJsTokens;
856
+
857
+ function requireJsTokens () {
858
+ if (hasRequiredJsTokens) return jsTokens_1;
859
+ hasRequiredJsTokens = 1;
860
+ // Copyright 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Simon Lydell
861
+ // License: MIT.
862
+ var Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace;
863
+ RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\\]).|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu;
864
+ Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
865
+ Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu;
866
+ StringLiteral = /(['"])(?:(?!\1)[^\\\n\r]|\\(?:\r\n|[^]))*(\1)?/y;
867
+ NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y;
868
+ Template = /[`}](?:[^`\\$]|\\[^]|\$(?!\{))*(`|\$\{)?/y;
869
+ WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/yu;
870
+ LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
871
+ MultiLineComment = /\/\*(?:[^*]|\*(?!\/))*(\*\/)?/y;
872
+ SingleLineComment = /\/\/.*/y;
873
+ JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
874
+ JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu;
875
+ JSXString = /(['"])(?:(?!\1)[^])*(\1)?/y;
876
+ JSXText = /[^<>{}]+/y;
877
+ TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
878
+ TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
879
+ KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
880
+ KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
881
+ Newline = RegExp(LineTerminatorSequence.source);
882
+ jsTokens_1 = function*(input, {jsx = false} = {}) {
883
+ var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
884
+ ({length} = input);
885
+ lastIndex = 0;
886
+ lastSignificantToken = "";
887
+ stack = [
888
+ {tag: "JS"}
889
+ ];
890
+ braces = [];
891
+ parenNesting = 0;
892
+ postfixIncDec = false;
893
+ while (lastIndex < length) {
894
+ mode = stack[stack.length - 1];
895
+ switch (mode.tag) {
896
+ case "JS":
897
+ case "JSNonExpressionParen":
898
+ case "InterpolationInTemplate":
899
+ case "InterpolationInJSX":
900
+ if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
901
+ RegularExpressionLiteral.lastIndex = lastIndex;
902
+ if (match = RegularExpressionLiteral.exec(input)) {
903
+ lastIndex = RegularExpressionLiteral.lastIndex;
904
+ lastSignificantToken = match[0];
905
+ postfixIncDec = true;
906
+ yield ({
907
+ type: "RegularExpressionLiteral",
908
+ value: match[0],
909
+ closed: match[1] !== void 0 && match[1] !== "\\"
910
+ });
911
+ continue;
912
+ }
913
+ }
914
+ Punctuator.lastIndex = lastIndex;
915
+ if (match = Punctuator.exec(input)) {
916
+ punctuator = match[0];
917
+ nextLastIndex = Punctuator.lastIndex;
918
+ nextLastSignificantToken = punctuator;
919
+ switch (punctuator) {
920
+ case "(":
921
+ if (lastSignificantToken === "?NonExpressionParenKeyword") {
922
+ stack.push({
923
+ tag: "JSNonExpressionParen",
924
+ nesting: parenNesting
925
+ });
926
+ }
927
+ parenNesting++;
928
+ postfixIncDec = false;
929
+ break;
930
+ case ")":
931
+ parenNesting--;
932
+ postfixIncDec = true;
933
+ if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
934
+ stack.pop();
935
+ nextLastSignificantToken = "?NonExpressionParenEnd";
936
+ postfixIncDec = false;
937
+ }
938
+ break;
939
+ case "{":
940
+ Punctuator.lastIndex = 0;
941
+ isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
942
+ braces.push(isExpression);
943
+ postfixIncDec = false;
944
+ break;
945
+ case "}":
946
+ switch (mode.tag) {
947
+ case "InterpolationInTemplate":
948
+ if (braces.length === mode.nesting) {
949
+ Template.lastIndex = lastIndex;
950
+ match = Template.exec(input);
951
+ lastIndex = Template.lastIndex;
952
+ lastSignificantToken = match[0];
953
+ if (match[1] === "${") {
954
+ lastSignificantToken = "?InterpolationInTemplate";
955
+ postfixIncDec = false;
956
+ yield ({
957
+ type: "TemplateMiddle",
958
+ value: match[0]
959
+ });
960
+ } else {
961
+ stack.pop();
962
+ postfixIncDec = true;
963
+ yield ({
964
+ type: "TemplateTail",
965
+ value: match[0],
966
+ closed: match[1] === "`"
967
+ });
968
+ }
969
+ continue;
970
+ }
971
+ break;
972
+ case "InterpolationInJSX":
973
+ if (braces.length === mode.nesting) {
974
+ stack.pop();
975
+ lastIndex += 1;
976
+ lastSignificantToken = "}";
977
+ yield ({
978
+ type: "JSXPunctuator",
979
+ value: "}"
980
+ });
981
+ continue;
982
+ }
983
+ }
984
+ postfixIncDec = braces.pop();
985
+ nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
986
+ break;
987
+ case "]":
988
+ postfixIncDec = true;
989
+ break;
990
+ case "++":
991
+ case "--":
992
+ nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
993
+ break;
994
+ case "<":
995
+ if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
996
+ stack.push({tag: "JSXTag"});
997
+ lastIndex += 1;
998
+ lastSignificantToken = "<";
999
+ yield ({
1000
+ type: "JSXPunctuator",
1001
+ value: punctuator
1002
+ });
1003
+ continue;
1004
+ }
1005
+ postfixIncDec = false;
1006
+ break;
1007
+ default:
1008
+ postfixIncDec = false;
1009
+ }
1010
+ lastIndex = nextLastIndex;
1011
+ lastSignificantToken = nextLastSignificantToken;
1012
+ yield ({
1013
+ type: "Punctuator",
1014
+ value: punctuator
1015
+ });
1016
+ continue;
1017
+ }
1018
+ Identifier.lastIndex = lastIndex;
1019
+ if (match = Identifier.exec(input)) {
1020
+ lastIndex = Identifier.lastIndex;
1021
+ nextLastSignificantToken = match[0];
1022
+ switch (match[0]) {
1023
+ case "for":
1024
+ case "if":
1025
+ case "while":
1026
+ case "with":
1027
+ if (lastSignificantToken !== "." && lastSignificantToken !== "?.") {
1028
+ nextLastSignificantToken = "?NonExpressionParenKeyword";
1029
+ }
1030
+ }
1031
+ lastSignificantToken = nextLastSignificantToken;
1032
+ postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
1033
+ yield ({
1034
+ type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
1035
+ value: match[0]
1036
+ });
1037
+ continue;
1038
+ }
1039
+ StringLiteral.lastIndex = lastIndex;
1040
+ if (match = StringLiteral.exec(input)) {
1041
+ lastIndex = StringLiteral.lastIndex;
1042
+ lastSignificantToken = match[0];
1043
+ postfixIncDec = true;
1044
+ yield ({
1045
+ type: "StringLiteral",
1046
+ value: match[0],
1047
+ closed: match[2] !== void 0
1048
+ });
1049
+ continue;
1050
+ }
1051
+ NumericLiteral.lastIndex = lastIndex;
1052
+ if (match = NumericLiteral.exec(input)) {
1053
+ lastIndex = NumericLiteral.lastIndex;
1054
+ lastSignificantToken = match[0];
1055
+ postfixIncDec = true;
1056
+ yield ({
1057
+ type: "NumericLiteral",
1058
+ value: match[0]
1059
+ });
1060
+ continue;
1061
+ }
1062
+ Template.lastIndex = lastIndex;
1063
+ if (match = Template.exec(input)) {
1064
+ lastIndex = Template.lastIndex;
1065
+ lastSignificantToken = match[0];
1066
+ if (match[1] === "${") {
1067
+ lastSignificantToken = "?InterpolationInTemplate";
1068
+ stack.push({
1069
+ tag: "InterpolationInTemplate",
1070
+ nesting: braces.length
1071
+ });
1072
+ postfixIncDec = false;
1073
+ yield ({
1074
+ type: "TemplateHead",
1075
+ value: match[0]
1076
+ });
1077
+ } else {
1078
+ postfixIncDec = true;
1079
+ yield ({
1080
+ type: "NoSubstitutionTemplate",
1081
+ value: match[0],
1082
+ closed: match[1] === "`"
1083
+ });
1084
+ }
1085
+ continue;
1086
+ }
1087
+ break;
1088
+ case "JSXTag":
1089
+ case "JSXTagEnd":
1090
+ JSXPunctuator.lastIndex = lastIndex;
1091
+ if (match = JSXPunctuator.exec(input)) {
1092
+ lastIndex = JSXPunctuator.lastIndex;
1093
+ nextLastSignificantToken = match[0];
1094
+ switch (match[0]) {
1095
+ case "<":
1096
+ stack.push({tag: "JSXTag"});
1097
+ break;
1098
+ case ">":
1099
+ stack.pop();
1100
+ if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
1101
+ nextLastSignificantToken = "?JSX";
1102
+ postfixIncDec = true;
1103
+ } else {
1104
+ stack.push({tag: "JSXChildren"});
1105
+ }
1106
+ break;
1107
+ case "{":
1108
+ stack.push({
1109
+ tag: "InterpolationInJSX",
1110
+ nesting: braces.length
1111
+ });
1112
+ nextLastSignificantToken = "?InterpolationInJSX";
1113
+ postfixIncDec = false;
1114
+ break;
1115
+ case "/":
1116
+ if (lastSignificantToken === "<") {
1117
+ stack.pop();
1118
+ if (stack[stack.length - 1].tag === "JSXChildren") {
1119
+ stack.pop();
1120
+ }
1121
+ stack.push({tag: "JSXTagEnd"});
1122
+ }
1123
+ }
1124
+ lastSignificantToken = nextLastSignificantToken;
1125
+ yield ({
1126
+ type: "JSXPunctuator",
1127
+ value: match[0]
1128
+ });
1129
+ continue;
1130
+ }
1131
+ JSXIdentifier.lastIndex = lastIndex;
1132
+ if (match = JSXIdentifier.exec(input)) {
1133
+ lastIndex = JSXIdentifier.lastIndex;
1134
+ lastSignificantToken = match[0];
1135
+ yield ({
1136
+ type: "JSXIdentifier",
1137
+ value: match[0]
1138
+ });
1139
+ continue;
1140
+ }
1141
+ JSXString.lastIndex = lastIndex;
1142
+ if (match = JSXString.exec(input)) {
1143
+ lastIndex = JSXString.lastIndex;
1144
+ lastSignificantToken = match[0];
1145
+ yield ({
1146
+ type: "JSXString",
1147
+ value: match[0],
1148
+ closed: match[2] !== void 0
1149
+ });
1150
+ continue;
1151
+ }
1152
+ break;
1153
+ case "JSXChildren":
1154
+ JSXText.lastIndex = lastIndex;
1155
+ if (match = JSXText.exec(input)) {
1156
+ lastIndex = JSXText.lastIndex;
1157
+ lastSignificantToken = match[0];
1158
+ yield ({
1159
+ type: "JSXText",
1160
+ value: match[0]
1161
+ });
1162
+ continue;
1163
+ }
1164
+ switch (input[lastIndex]) {
1165
+ case "<":
1166
+ stack.push({tag: "JSXTag"});
1167
+ lastIndex++;
1168
+ lastSignificantToken = "<";
1169
+ yield ({
1170
+ type: "JSXPunctuator",
1171
+ value: "<"
1172
+ });
1173
+ continue;
1174
+ case "{":
1175
+ stack.push({
1176
+ tag: "InterpolationInJSX",
1177
+ nesting: braces.length
1178
+ });
1179
+ lastIndex++;
1180
+ lastSignificantToken = "?InterpolationInJSX";
1181
+ postfixIncDec = false;
1182
+ yield ({
1183
+ type: "JSXPunctuator",
1184
+ value: "{"
1185
+ });
1186
+ continue;
1187
+ }
1188
+ }
1189
+ WhiteSpace.lastIndex = lastIndex;
1190
+ if (match = WhiteSpace.exec(input)) {
1191
+ lastIndex = WhiteSpace.lastIndex;
1192
+ yield ({
1193
+ type: "WhiteSpace",
1194
+ value: match[0]
1195
+ });
1196
+ continue;
1197
+ }
1198
+ LineTerminatorSequence.lastIndex = lastIndex;
1199
+ if (match = LineTerminatorSequence.exec(input)) {
1200
+ lastIndex = LineTerminatorSequence.lastIndex;
1201
+ postfixIncDec = false;
1202
+ if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
1203
+ lastSignificantToken = "?NoLineTerminatorHere";
1204
+ }
1205
+ yield ({
1206
+ type: "LineTerminatorSequence",
1207
+ value: match[0]
1208
+ });
1209
+ continue;
1210
+ }
1211
+ MultiLineComment.lastIndex = lastIndex;
1212
+ if (match = MultiLineComment.exec(input)) {
1213
+ lastIndex = MultiLineComment.lastIndex;
1214
+ if (Newline.test(match[0])) {
1215
+ postfixIncDec = false;
1216
+ if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
1217
+ lastSignificantToken = "?NoLineTerminatorHere";
1218
+ }
1219
+ }
1220
+ yield ({
1221
+ type: "MultiLineComment",
1222
+ value: match[0],
1223
+ closed: match[1] !== void 0
1224
+ });
1225
+ continue;
1226
+ }
1227
+ SingleLineComment.lastIndex = lastIndex;
1228
+ if (match = SingleLineComment.exec(input)) {
1229
+ lastIndex = SingleLineComment.lastIndex;
1230
+ postfixIncDec = false;
1231
+ yield ({
1232
+ type: "SingleLineComment",
1233
+ value: match[0]
1234
+ });
1235
+ continue;
1236
+ }
1237
+ firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
1238
+ lastIndex += firstCodePoint.length;
1239
+ lastSignificantToken = firstCodePoint;
1240
+ postfixIncDec = false;
1241
+ yield ({
1242
+ type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
1243
+ value: firstCodePoint
1244
+ });
1245
+ }
1246
+ return void 0;
1247
+ };
1248
+ return jsTokens_1;
1249
+ }
1250
+
1251
+ requireJsTokens();
1252
+
1253
+ // src/index.ts
1254
+ var reservedWords = {
1255
+ keyword: [
1256
+ "break",
1257
+ "case",
1258
+ "catch",
1259
+ "continue",
1260
+ "debugger",
1261
+ "default",
1262
+ "do",
1263
+ "else",
1264
+ "finally",
1265
+ "for",
1266
+ "function",
1267
+ "if",
1268
+ "return",
1269
+ "switch",
1270
+ "throw",
1271
+ "try",
1272
+ "var",
1273
+ "const",
1274
+ "while",
1275
+ "with",
1276
+ "new",
1277
+ "this",
1278
+ "super",
1279
+ "class",
1280
+ "extends",
1281
+ "export",
1282
+ "import",
1283
+ "null",
1284
+ "true",
1285
+ "false",
1286
+ "in",
1287
+ "instanceof",
1288
+ "typeof",
1289
+ "void",
1290
+ "delete"
1291
+ ],
1292
+ strict: [
1293
+ "implements",
1294
+ "interface",
1295
+ "let",
1296
+ "package",
1297
+ "private",
1298
+ "protected",
1299
+ "public",
1300
+ "static",
1301
+ "yield"
1302
+ ]
1303
+ }; new Set(reservedWords.keyword); new Set(reservedWords.strict);
1304
+
1305
+ // src/index.ts
1306
+ var f = {
1307
+ reset: [0, 0],
1308
+ bold: [1, 22, "\x1B[22m\x1B[1m"],
1309
+ dim: [2, 22, "\x1B[22m\x1B[2m"],
1310
+ italic: [3, 23],
1311
+ underline: [4, 24],
1312
+ inverse: [7, 27],
1313
+ hidden: [8, 28],
1314
+ strikethrough: [9, 29],
1315
+ black: [30, 39],
1316
+ red: [31, 39],
1317
+ green: [32, 39],
1318
+ yellow: [33, 39],
1319
+ blue: [34, 39],
1320
+ magenta: [35, 39],
1321
+ cyan: [36, 39],
1322
+ white: [37, 39],
1323
+ gray: [90, 39],
1324
+ bgBlack: [40, 49],
1325
+ bgRed: [41, 49],
1326
+ bgGreen: [42, 49],
1327
+ bgYellow: [43, 49],
1328
+ bgBlue: [44, 49],
1329
+ bgMagenta: [45, 49],
1330
+ bgCyan: [46, 49],
1331
+ bgWhite: [47, 49],
1332
+ blackBright: [90, 39],
1333
+ redBright: [91, 39],
1334
+ greenBright: [92, 39],
1335
+ yellowBright: [93, 39],
1336
+ blueBright: [94, 39],
1337
+ magentaBright: [95, 39],
1338
+ cyanBright: [96, 39],
1339
+ whiteBright: [97, 39],
1340
+ bgBlackBright: [100, 49],
1341
+ bgRedBright: [101, 49],
1342
+ bgGreenBright: [102, 49],
1343
+ bgYellowBright: [103, 49],
1344
+ bgBlueBright: [104, 49],
1345
+ bgMagentaBright: [105, 49],
1346
+ bgCyanBright: [106, 49],
1347
+ bgWhiteBright: [107, 49]
1348
+ }, h = Object.entries(f);
1349
+ function a(n) {
1350
+ return String(n);
1351
+ }
1352
+ a.open = "";
1353
+ a.close = "";
1354
+ function C(n = false) {
1355
+ let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
1356
+ return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome;
1357
+ }
1358
+ function p(n = false) {
1359
+ let e = C(n), i = (r, t, c, o) => {
1360
+ let l = "", s = 0;
1361
+ do
1362
+ l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);
1363
+ while (~o);
1364
+ return l + r.substring(s);
1365
+ }, g = (r, t, c = r) => {
1366
+ let o = (l) => {
1367
+ let s = String(l), b = s.indexOf(t, r.length);
1368
+ return ~b ? r + i(s, t, c, b) + t : r + s + t;
1369
+ };
1370
+ return o.open = r, o.close = t, o;
1371
+ }, u = {
1372
+ isColorSupported: e
1373
+ }, d = (r) => `\x1B[${r}m`;
1374
+ for (let [r, t] of h)
1375
+ u[r] = e ? g(
1376
+ d(t[0]),
1377
+ d(t[1]),
1378
+ t[2]
1379
+ ) : a;
1380
+ return u;
1381
+ }
1382
+
1383
+ p();
1384
+
1385
+ const lineSplitRE = /\r?\n/;
1386
+ function positionToOffset(source, lineNumber, columnNumber) {
1387
+ const lines = source.split(lineSplitRE);
1388
+ const nl = /\r\n/.test(source) ? 2 : 1;
1389
+ let start = 0;
1390
+ if (lineNumber > lines.length) {
1391
+ return source.length;
1392
+ }
1393
+ for (let i = 0; i < lineNumber - 1; i++) {
1394
+ start += lines[i].length + nl;
1395
+ }
1396
+ return start + columnNumber;
1397
+ }
1398
+ function offsetToLineNumber(source, offset) {
1399
+ if (offset > source.length) {
1400
+ throw new Error(`offset is longer than source length! offset ${offset} > length ${source.length}`);
1401
+ }
1402
+ const lines = source.split(lineSplitRE);
1403
+ const nl = /\r\n/.test(source) ? 2 : 1;
1404
+ let counted = 0;
1405
+ let line = 0;
1406
+ for (; line < lines.length; line++) {
1407
+ const lineLength = lines[line].length + nl;
1408
+ if (counted + lineLength >= offset) {
1409
+ break;
1410
+ }
1411
+ counted += lineLength;
1412
+ }
1413
+ return line + 1;
1414
+ }
1415
+
1416
+ async function saveInlineSnapshots(environment, snapshots) {
1417
+ const MagicString = (await import('magic-string')).default;
1418
+ const files = new Set(snapshots.map((i) => i.file));
1419
+ await Promise.all(Array.from(files).map(async (file) => {
1420
+ const snaps = snapshots.filter((i) => i.file === file);
1421
+ const code = await environment.readSnapshotFile(file);
1422
+ const s = new MagicString(code);
1423
+ for (const snap of snaps) {
1424
+ const index = positionToOffset(code, snap.line, snap.column);
1425
+ replaceInlineSnap(code, s, index, snap.snapshot);
1426
+ }
1427
+ const transformed = s.toString();
1428
+ if (transformed !== code) {
1429
+ await environment.saveSnapshotFile(file, transformed);
1430
+ }
1431
+ }));
1432
+ }
1433
+ const startObjectRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*(?:\/\*[\s\S]*\*\/\s*|\/\/.*(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))*\{/;
1434
+ function replaceObjectSnap(code, s, index, newSnap) {
1435
+ let _code = code.slice(index);
1436
+ const startMatch = startObjectRegex.exec(_code);
1437
+ if (!startMatch) {
1438
+ return false;
1439
+ }
1440
+ _code = _code.slice(startMatch.index);
1441
+ let callEnd = getCallLastIndex(_code);
1442
+ if (callEnd === null) {
1443
+ return false;
1444
+ }
1445
+ callEnd += index + startMatch.index;
1446
+ const shapeStart = index + startMatch.index + startMatch[0].length;
1447
+ const shapeEnd = getObjectShapeEndIndex(code, shapeStart);
1448
+ const snap = `, ${prepareSnapString(newSnap, code, index)}`;
1449
+ if (shapeEnd === callEnd) {
1450
+ // toMatchInlineSnapshot({ foo: expect.any(String) })
1451
+ s.appendLeft(callEnd, snap);
1452
+ } else {
1453
+ // toMatchInlineSnapshot({ foo: expect.any(String) }, ``)
1454
+ s.overwrite(shapeEnd, callEnd, snap);
1455
+ }
1456
+ return true;
1457
+ }
1458
+ function getObjectShapeEndIndex(code, index) {
1459
+ let startBraces = 1;
1460
+ let endBraces = 0;
1461
+ while (startBraces !== endBraces && index < code.length) {
1462
+ const s = code[index++];
1463
+ if (s === "{") {
1464
+ startBraces++;
1465
+ } else if (s === "}") {
1466
+ endBraces++;
1467
+ }
1468
+ }
1469
+ return index;
1470
+ }
1471
+ function prepareSnapString(snap, source, index) {
1472
+ const lineNumber = offsetToLineNumber(source, index);
1473
+ const line = source.split(lineSplitRE)[lineNumber - 1];
1474
+ const indent = line.match(/^\s*/)[0] || "";
1475
+ const indentNext = indent.includes(" ") ? `${indent}\t` : `${indent} `;
1476
+ const lines = snap.trim().replace(/\\/g, "\\\\").split(/\n/g);
1477
+ const isOneline = lines.length <= 1;
1478
+ const quote = "`";
1479
+ if (isOneline) {
1480
+ return `${quote}${lines.join("\n").replace(/`/g, "\\`").replace(/\$\{/g, "\\${")}${quote}`;
1481
+ }
1482
+ return `${quote}\n${lines.map((i) => i ? indentNext + i : "").join("\n").replace(/`/g, "\\`").replace(/\$\{/g, "\\${")}\n${indent}${quote}`;
1483
+ }
1484
+ const toMatchInlineName = "toMatchInlineSnapshot";
1485
+ const toThrowErrorMatchingInlineName = "toThrowErrorMatchingInlineSnapshot";
1486
+ // on webkit, the line number is at the end of the method, not at the start
1487
+ function getCodeStartingAtIndex(code, index) {
1488
+ const indexInline = index - toMatchInlineName.length;
1489
+ if (code.slice(indexInline, index) === toMatchInlineName) {
1490
+ return {
1491
+ code: code.slice(indexInline),
1492
+ index: indexInline
1493
+ };
1494
+ }
1495
+ const indexThrowInline = index - toThrowErrorMatchingInlineName.length;
1496
+ if (code.slice(index - indexThrowInline, index) === toThrowErrorMatchingInlineName) {
1497
+ return {
1498
+ code: code.slice(index - indexThrowInline),
1499
+ index: index - indexThrowInline
1500
+ };
1501
+ }
1502
+ return {
1503
+ code: code.slice(index),
1504
+ index
1505
+ };
1506
+ }
1507
+ const startRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*(?:\/\*[\s\S]*\*\/\s*|\/\/.*(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))*[\w$]*(['"`)])/;
1508
+ function replaceInlineSnap(code, s, currentIndex, newSnap) {
1509
+ const { code: codeStartingAtIndex, index } = getCodeStartingAtIndex(code, currentIndex);
1510
+ const startMatch = startRegex.exec(codeStartingAtIndex);
1511
+ const firstKeywordMatch = /toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot/.exec(codeStartingAtIndex);
1512
+ if (!startMatch || startMatch.index !== (firstKeywordMatch === null || firstKeywordMatch === void 0 ? void 0 : firstKeywordMatch.index)) {
1513
+ return replaceObjectSnap(code, s, index, newSnap);
1514
+ }
1515
+ const quote = startMatch[1];
1516
+ const startIndex = index + startMatch.index + startMatch[0].length;
1517
+ const snapString = prepareSnapString(newSnap, code, index);
1518
+ if (quote === ")") {
1519
+ s.appendRight(startIndex - 1, snapString);
1520
+ return true;
1521
+ }
1522
+ const quoteEndRE = new RegExp(`(?:^|[^\\\\])${quote}`);
1523
+ const endMatch = quoteEndRE.exec(code.slice(startIndex));
1524
+ if (!endMatch) {
1525
+ return false;
1526
+ }
1527
+ const endIndex = startIndex + endMatch.index + endMatch[0].length;
1528
+ s.overwrite(startIndex - 1, endIndex, snapString);
1529
+ return true;
1530
+ }
1531
+ const INDENTATION_REGEX = /^([^\S\n]*)\S/m;
1532
+ function stripSnapshotIndentation(inlineSnapshot) {
1533
+ // Find indentation if exists.
1534
+ const match = inlineSnapshot.match(INDENTATION_REGEX);
1535
+ if (!match || !match[1]) {
1536
+ // No indentation.
1537
+ return inlineSnapshot;
1538
+ }
1539
+ const indentation = match[1];
1540
+ const lines = inlineSnapshot.split(/\n/g);
1541
+ if (lines.length <= 2) {
1542
+ // Must be at least 3 lines.
1543
+ return inlineSnapshot;
1544
+ }
1545
+ if (lines[0].trim() !== "" || lines[lines.length - 1].trim() !== "") {
1546
+ // If not blank first and last lines, abort.
1547
+ return inlineSnapshot;
1548
+ }
1549
+ for (let i = 1; i < lines.length - 1; i++) {
1550
+ if (lines[i] !== "") {
1551
+ if (lines[i].indexOf(indentation) !== 0) {
1552
+ // All lines except first and last should either be blank or have the same
1553
+ // indent as the first line (or more). If this isn't the case we don't
1554
+ // want to touch the snapshot at all.
1555
+ return inlineSnapshot;
1556
+ }
1557
+ lines[i] = lines[i].substring(indentation.length);
1558
+ }
1559
+ }
1560
+ // Last line is a special case because it won't have the same indent as others
1561
+ // but may still have been given some indent to line up.
1562
+ lines[lines.length - 1] = "";
1563
+ // Return inline snapshot, now at indent 0.
1564
+ inlineSnapshot = lines.join("\n");
1565
+ return inlineSnapshot;
1566
+ }
1567
+
1568
+ async function saveRawSnapshots(environment, snapshots) {
1569
+ await Promise.all(snapshots.map(async (snap) => {
1570
+ if (!snap.readonly) {
1571
+ await environment.saveSnapshotFile(snap.file, snap.snapshot);
1572
+ }
1573
+ }));
1574
+ }
1575
+
1576
+ var naturalCompare$1 = {exports: {}};
1577
+
1578
+ var hasRequiredNaturalCompare;
1579
+
1580
+ function requireNaturalCompare () {
1581
+ if (hasRequiredNaturalCompare) return naturalCompare$1.exports;
1582
+ hasRequiredNaturalCompare = 1;
1583
+ /*
1584
+ * @version 1.4.0
1585
+ * @date 2015-10-26
1586
+ * @stability 3 - Stable
1587
+ * @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
1588
+ * @license MIT License
1589
+ */
1590
+
1591
+
1592
+ var naturalCompare = function(a, b) {
1593
+ var i, codeA
1594
+ , codeB = 1
1595
+ , posA = 0
1596
+ , posB = 0
1597
+ , alphabet = String.alphabet;
1598
+
1599
+ function getCode(str, pos, code) {
1600
+ if (code) {
1601
+ for (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i;
1602
+ return +str.slice(pos - 1, i)
1603
+ }
1604
+ code = alphabet && alphabet.indexOf(str.charAt(pos));
1605
+ return code > -1 ? code + 76 : ((code = str.charCodeAt(pos) || 0), code < 45 || code > 127) ? code
1606
+ : code < 46 ? 65 // -
1607
+ : code < 48 ? code - 1
1608
+ : code < 58 ? code + 18 // 0-9
1609
+ : code < 65 ? code - 11
1610
+ : code < 91 ? code + 11 // A-Z
1611
+ : code < 97 ? code - 37
1612
+ : code < 123 ? code + 5 // a-z
1613
+ : code - 63
1614
+ }
1615
+
1616
+
1617
+ if ((a+="") != (b+="")) for (;codeB;) {
1618
+ codeA = getCode(a, posA++);
1619
+ codeB = getCode(b, posB++);
1620
+
1621
+ if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
1622
+ codeA = getCode(a, posA, posA);
1623
+ codeB = getCode(b, posB, posA = i);
1624
+ posB = i;
1625
+ }
1626
+
1627
+ if (codeA != codeB) return (codeA < codeB) ? -1 : 1
1628
+ }
1629
+ return 0
1630
+ };
1631
+
1632
+ try {
1633
+ naturalCompare$1.exports = naturalCompare;
1634
+ } catch (e) {
1635
+ String.naturalCompare = naturalCompare;
1636
+ }
1637
+ return naturalCompare$1.exports;
1638
+ }
1639
+
1640
+ var naturalCompareExports = requireNaturalCompare();
1641
+ var naturalCompare = /*@__PURE__*/getDefaultExportFromCjs(naturalCompareExports);
1642
+
1643
+ const serialize$1 = (val, config, indentation, depth, refs, printer) => {
1644
+ // Serialize a non-default name, even if config.printFunctionName is false.
1645
+ const name = val.getMockName();
1646
+ const nameString = name === "vi.fn()" ? "" : ` ${name}`;
1647
+ let callsString = "";
1648
+ if (val.mock.calls.length !== 0) {
1649
+ const indentationNext = indentation + config.indent;
1650
+ callsString = ` {${config.spacingOuter}${indentationNext}"calls": ${printer(val.mock.calls, config, indentationNext, depth, refs)}${config.min ? ", " : ","}${config.spacingOuter}${indentationNext}"results": ${printer(val.mock.results, config, indentationNext, depth, refs)}${config.min ? "" : ","}${config.spacingOuter}${indentation}}`;
1651
+ }
1652
+ return `[MockFunction${nameString}]${callsString}`;
1653
+ };
1654
+ const test = (val) => val && !!val._isMockFunction;
1655
+ const plugin = {
1656
+ serialize: serialize$1,
1657
+ test
1658
+ };
1659
+
1660
+ const { DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent, AsymmetricMatcher } = plugins;
1661
+ let PLUGINS = [
1662
+ ReactTestComponent,
1663
+ ReactElement,
1664
+ DOMElement,
1665
+ DOMCollection,
1666
+ Immutable,
1667
+ AsymmetricMatcher,
1668
+ plugin
1669
+ ];
1670
+ function addSerializer(plugin) {
1671
+ PLUGINS = [plugin].concat(PLUGINS);
1672
+ }
1673
+ function getSerializers() {
1674
+ return PLUGINS;
1675
+ }
1676
+
1677
+ // TODO: rewrite and clean up
1678
+ function testNameToKey(testName, count) {
1679
+ return `${testName} ${count}`;
1680
+ }
1681
+ function keyToTestName(key) {
1682
+ if (!/ \d+$/.test(key)) {
1683
+ throw new Error("Snapshot keys must end with a number.");
1684
+ }
1685
+ return key.replace(/ \d+$/, "");
1686
+ }
1687
+ function getSnapshotData(content, options) {
1688
+ const update = options.updateSnapshot;
1689
+ const data = Object.create(null);
1690
+ let snapshotContents = "";
1691
+ let dirty = false;
1692
+ if (content != null) {
1693
+ try {
1694
+ snapshotContents = content;
1695
+ // eslint-disable-next-line no-new-func
1696
+ const populate = new Function("exports", snapshotContents);
1697
+ populate(data);
1698
+ } catch {}
1699
+ }
1700
+ // const validationResult = validateSnapshotVersion(snapshotContents)
1701
+ const isInvalid = snapshotContents;
1702
+ // if (update === 'none' && isInvalid)
1703
+ // throw validationResult
1704
+ if ((update === "all" || update === "new") && isInvalid) {
1705
+ dirty = true;
1706
+ }
1707
+ return {
1708
+ data,
1709
+ dirty
1710
+ };
1711
+ }
1712
+ // Add extra line breaks at beginning and end of multiline snapshot
1713
+ // to make the content easier to read.
1714
+ function addExtraLineBreaks(string) {
1715
+ return string.includes("\n") ? `\n${string}\n` : string;
1716
+ }
1717
+ // Remove extra line breaks at beginning and end of multiline snapshot.
1718
+ // Instead of trim, which can remove additional newlines or spaces
1719
+ // at beginning or end of the content from a custom serializer.
1720
+ function removeExtraLineBreaks(string) {
1721
+ return string.length > 2 && string.startsWith("\n") && string.endsWith("\n") ? string.slice(1, -1) : string;
1722
+ }
1723
+ // export const removeLinesBeforeExternalMatcherTrap = (stack: string): string => {
1724
+ // const lines = stack.split('\n')
1725
+ // for (let i = 0; i < lines.length; i += 1) {
1726
+ // // It's a function name specified in `packages/expect/src/index.ts`
1727
+ // // for external custom matchers.
1728
+ // if (lines[i].includes('__EXTERNAL_MATCHER_TRAP__'))
1729
+ // return lines.slice(i + 1).join('\n')
1730
+ // }
1731
+ // return stack
1732
+ // }
1733
+ const escapeRegex = true;
1734
+ const printFunctionName = false;
1735
+ function serialize(val, indent = 2, formatOverrides = {}) {
1736
+ return normalizeNewlines(format(val, {
1737
+ escapeRegex,
1738
+ indent,
1739
+ plugins: getSerializers(),
1740
+ printFunctionName,
1741
+ ...formatOverrides
1742
+ }));
1743
+ }
1744
+ function escapeBacktickString(str) {
1745
+ return str.replace(/`|\\|\$\{/g, "\\$&");
1746
+ }
1747
+ function printBacktickString(str) {
1748
+ return `\`${escapeBacktickString(str)}\``;
1749
+ }
1750
+ function normalizeNewlines(string) {
1751
+ return string.replace(/\r\n|\r/g, "\n");
1752
+ }
1753
+ async function saveSnapshotFile(environment, snapshotData, snapshotPath) {
1754
+ const snapshots = Object.keys(snapshotData).sort(naturalCompare).map((key) => `exports[${printBacktickString(key)}] = ${printBacktickString(normalizeNewlines(snapshotData[key]))};`);
1755
+ const content = `${environment.getHeader()}\n\n${snapshots.join("\n\n")}\n`;
1756
+ const oldContent = await environment.readSnapshotFile(snapshotPath);
1757
+ const skipWriting = oldContent != null && oldContent === content;
1758
+ if (skipWriting) {
1759
+ return;
1760
+ }
1761
+ await environment.saveSnapshotFile(snapshotPath, content);
1762
+ }
1763
+ function deepMergeArray(target = [], source = []) {
1764
+ const mergedOutput = Array.from(target);
1765
+ source.forEach((sourceElement, index) => {
1766
+ const targetElement = mergedOutput[index];
1767
+ if (Array.isArray(target[index])) {
1768
+ mergedOutput[index] = deepMergeArray(target[index], sourceElement);
1769
+ } else if (isObject(targetElement)) {
1770
+ mergedOutput[index] = deepMergeSnapshot(target[index], sourceElement);
1771
+ } else {
1772
+ // Source does not exist in target or target is primitive and cannot be deep merged
1773
+ mergedOutput[index] = sourceElement;
1774
+ }
1775
+ });
1776
+ return mergedOutput;
1777
+ }
1778
+ /**
1779
+ * Deep merge, but considers asymmetric matchers. Unlike base util's deep merge,
1780
+ * will merge any object-like instance.
1781
+ * Compatible with Jest's snapshot matcher. Should not be used outside of snapshot.
1782
+ *
1783
+ * @example
1784
+ * ```ts
1785
+ * toMatchSnapshot({
1786
+ * name: expect.stringContaining('text')
1787
+ * })
1788
+ * ```
1789
+ */
1790
+ function deepMergeSnapshot(target, source) {
1791
+ if (isObject(target) && isObject(source)) {
1792
+ const mergedOutput = { ...target };
1793
+ Object.keys(source).forEach((key) => {
1794
+ if (isObject(source[key]) && !source[key].$$typeof) {
1795
+ if (!(key in target)) {
1796
+ Object.assign(mergedOutput, { [key]: source[key] });
1797
+ } else {
1798
+ mergedOutput[key] = deepMergeSnapshot(target[key], source[key]);
1799
+ }
1800
+ } else if (Array.isArray(source[key])) {
1801
+ mergedOutput[key] = deepMergeArray(target[key], source[key]);
1802
+ } else {
1803
+ Object.assign(mergedOutput, { [key]: source[key] });
1804
+ }
1805
+ });
1806
+ return mergedOutput;
1807
+ } else if (Array.isArray(target) && Array.isArray(source)) {
1808
+ return deepMergeArray(target, source);
1809
+ }
1810
+ return target;
1811
+ }
1812
+ class DefaultMap extends Map {
1813
+ constructor(defaultFn, entries) {
1814
+ super(entries);
1815
+ this.defaultFn = defaultFn;
1816
+ }
1817
+ get(key) {
1818
+ if (!this.has(key)) {
1819
+ this.set(key, this.defaultFn(key));
1820
+ }
1821
+ return super.get(key);
1822
+ }
1823
+ }
1824
+ class CounterMap extends DefaultMap {
1825
+ constructor() {
1826
+ super(() => 0);
1827
+ }
1828
+ // compat for jest-image-snapshot https://github.com/vitest-dev/vitest/issues/7322
1829
+ // `valueOf` and `Snapshot.added` setter allows
1830
+ // snapshotState.added = snapshotState.added + 1
1831
+ // to function as
1832
+ // snapshotState.added.total_ = snapshotState.added.total() + 1
1833
+ _total;
1834
+ valueOf() {
1835
+ return this._total = this.total();
1836
+ }
1837
+ increment(key) {
1838
+ if (typeof this._total !== "undefined") {
1839
+ this._total++;
1840
+ }
1841
+ this.set(key, this.get(key) + 1);
1842
+ }
1843
+ total() {
1844
+ if (typeof this._total !== "undefined") {
1845
+ return this._total;
1846
+ }
1847
+ let total = 0;
1848
+ for (const x of this.values()) {
1849
+ total += x;
1850
+ }
1851
+ return total;
1852
+ }
1853
+ }
1854
+
1855
+ function isSameStackPosition(x, y) {
1856
+ return x.file === y.file && x.column === y.column && x.line === y.line;
1857
+ }
1858
+ class SnapshotState {
1859
+ _counters = new CounterMap();
1860
+ _dirty;
1861
+ _updateSnapshot;
1862
+ _snapshotData;
1863
+ _initialData;
1864
+ _inlineSnapshots;
1865
+ _inlineSnapshotStacks;
1866
+ _testIdToKeys = new DefaultMap(() => []);
1867
+ _rawSnapshots;
1868
+ _uncheckedKeys;
1869
+ _snapshotFormat;
1870
+ _environment;
1871
+ _fileExists;
1872
+ expand;
1873
+ // getter/setter for jest-image-snapshot compat
1874
+ // https://github.com/vitest-dev/vitest/issues/7322
1875
+ _added = new CounterMap();
1876
+ _matched = new CounterMap();
1877
+ _unmatched = new CounterMap();
1878
+ _updated = new CounterMap();
1879
+ get added() {
1880
+ return this._added;
1881
+ }
1882
+ set added(value) {
1883
+ this._added._total = value;
1884
+ }
1885
+ get matched() {
1886
+ return this._matched;
1887
+ }
1888
+ set matched(value) {
1889
+ this._matched._total = value;
1890
+ }
1891
+ get unmatched() {
1892
+ return this._unmatched;
1893
+ }
1894
+ set unmatched(value) {
1895
+ this._unmatched._total = value;
1896
+ }
1897
+ get updated() {
1898
+ return this._updated;
1899
+ }
1900
+ set updated(value) {
1901
+ this._updated._total = value;
1902
+ }
1903
+ constructor(testFilePath, snapshotPath, snapshotContent, options) {
1904
+ this.testFilePath = testFilePath;
1905
+ this.snapshotPath = snapshotPath;
1906
+ const { data, dirty } = getSnapshotData(snapshotContent, options);
1907
+ this._fileExists = snapshotContent != null;
1908
+ this._initialData = { ...data };
1909
+ this._snapshotData = { ...data };
1910
+ this._dirty = dirty;
1911
+ this._inlineSnapshots = [];
1912
+ this._inlineSnapshotStacks = [];
1913
+ this._rawSnapshots = [];
1914
+ this._uncheckedKeys = new Set(Object.keys(this._snapshotData));
1915
+ this.expand = options.expand || false;
1916
+ this._updateSnapshot = options.updateSnapshot;
1917
+ this._snapshotFormat = {
1918
+ printBasicPrototype: false,
1919
+ escapeString: false,
1920
+ ...options.snapshotFormat
1921
+ };
1922
+ this._environment = options.snapshotEnvironment;
1923
+ }
1924
+ static async create(testFilePath, options) {
1925
+ const snapshotPath = await options.snapshotEnvironment.resolvePath(testFilePath);
1926
+ const content = await options.snapshotEnvironment.readSnapshotFile(snapshotPath);
1927
+ return new SnapshotState(testFilePath, snapshotPath, content, options);
1928
+ }
1929
+ get environment() {
1930
+ return this._environment;
1931
+ }
1932
+ markSnapshotsAsCheckedForTest(testName) {
1933
+ this._uncheckedKeys.forEach((uncheckedKey) => {
1934
+ // skip snapshots with following keys
1935
+ // testName n
1936
+ // testName > xxx n (this is for toMatchSnapshot("xxx") API)
1937
+ if (/ \d+$| > /.test(uncheckedKey.slice(testName.length))) {
1938
+ this._uncheckedKeys.delete(uncheckedKey);
1939
+ }
1940
+ });
1941
+ }
1942
+ clearTest(testId) {
1943
+ // clear inline
1944
+ this._inlineSnapshots = this._inlineSnapshots.filter((s) => s.testId !== testId);
1945
+ this._inlineSnapshotStacks = this._inlineSnapshotStacks.filter((s) => s.testId !== testId);
1946
+ // clear file
1947
+ for (const key of this._testIdToKeys.get(testId)) {
1948
+ const name = keyToTestName(key);
1949
+ const count = this._counters.get(name);
1950
+ if (count > 0) {
1951
+ if (key in this._snapshotData || key in this._initialData) {
1952
+ this._snapshotData[key] = this._initialData[key];
1953
+ }
1954
+ this._counters.set(name, count - 1);
1955
+ }
1956
+ }
1957
+ this._testIdToKeys.delete(testId);
1958
+ // clear stats
1959
+ this.added.delete(testId);
1960
+ this.updated.delete(testId);
1961
+ this.matched.delete(testId);
1962
+ this.unmatched.delete(testId);
1963
+ }
1964
+ _inferInlineSnapshotStack(stacks) {
1965
+ // if called inside resolves/rejects, stacktrace is different
1966
+ const promiseIndex = stacks.findIndex((i) => i.method.match(/__VITEST_(RESOLVES|REJECTS)__/));
1967
+ if (promiseIndex !== -1) {
1968
+ return stacks[promiseIndex + 3];
1969
+ }
1970
+ // inline snapshot function is called __INLINE_SNAPSHOT__
1971
+ // in integrations/snapshot/chai.ts
1972
+ const stackIndex = stacks.findIndex((i) => i.method.includes("__INLINE_SNAPSHOT__"));
1973
+ return stackIndex !== -1 ? stacks[stackIndex + 2] : null;
1974
+ }
1975
+ _addSnapshot(key, receivedSerialized, options) {
1976
+ this._dirty = true;
1977
+ if (options.stack) {
1978
+ this._inlineSnapshots.push({
1979
+ snapshot: receivedSerialized,
1980
+ testId: options.testId,
1981
+ ...options.stack
1982
+ });
1983
+ } else if (options.rawSnapshot) {
1984
+ this._rawSnapshots.push({
1985
+ ...options.rawSnapshot,
1986
+ snapshot: receivedSerialized
1987
+ });
1988
+ } else {
1989
+ this._snapshotData[key] = receivedSerialized;
1990
+ }
1991
+ }
1992
+ async save() {
1993
+ const hasExternalSnapshots = Object.keys(this._snapshotData).length;
1994
+ const hasInlineSnapshots = this._inlineSnapshots.length;
1995
+ const hasRawSnapshots = this._rawSnapshots.length;
1996
+ const isEmpty = !hasExternalSnapshots && !hasInlineSnapshots && !hasRawSnapshots;
1997
+ const status = {
1998
+ deleted: false,
1999
+ saved: false
2000
+ };
2001
+ if ((this._dirty || this._uncheckedKeys.size) && !isEmpty) {
2002
+ if (hasExternalSnapshots) {
2003
+ await saveSnapshotFile(this._environment, this._snapshotData, this.snapshotPath);
2004
+ this._fileExists = true;
2005
+ }
2006
+ if (hasInlineSnapshots) {
2007
+ await saveInlineSnapshots(this._environment, this._inlineSnapshots);
2008
+ }
2009
+ if (hasRawSnapshots) {
2010
+ await saveRawSnapshots(this._environment, this._rawSnapshots);
2011
+ }
2012
+ status.saved = true;
2013
+ } else if (!hasExternalSnapshots && this._fileExists) {
2014
+ if (this._updateSnapshot === "all") {
2015
+ await this._environment.removeSnapshotFile(this.snapshotPath);
2016
+ this._fileExists = false;
2017
+ }
2018
+ status.deleted = true;
2019
+ }
2020
+ return status;
2021
+ }
2022
+ getUncheckedCount() {
2023
+ return this._uncheckedKeys.size || 0;
2024
+ }
2025
+ getUncheckedKeys() {
2026
+ return Array.from(this._uncheckedKeys);
2027
+ }
2028
+ removeUncheckedKeys() {
2029
+ if (this._updateSnapshot === "all" && this._uncheckedKeys.size) {
2030
+ this._dirty = true;
2031
+ this._uncheckedKeys.forEach((key) => delete this._snapshotData[key]);
2032
+ this._uncheckedKeys.clear();
2033
+ }
2034
+ }
2035
+ match({ testId, testName, received, key, inlineSnapshot, isInline, error, rawSnapshot }) {
2036
+ // this also increments counter for inline snapshots. maybe we shouldn't?
2037
+ this._counters.increment(testName);
2038
+ const count = this._counters.get(testName);
2039
+ if (!key) {
2040
+ key = testNameToKey(testName, count);
2041
+ }
2042
+ this._testIdToKeys.get(testId).push(key);
2043
+ // Do not mark the snapshot as "checked" if the snapshot is inline and
2044
+ // there's an external snapshot. This way the external snapshot can be
2045
+ // removed with `--updateSnapshot`.
2046
+ if (!(isInline && this._snapshotData[key] !== undefined)) {
2047
+ this._uncheckedKeys.delete(key);
2048
+ }
2049
+ let receivedSerialized = rawSnapshot && typeof received === "string" ? received : serialize(received, undefined, this._snapshotFormat);
2050
+ if (!rawSnapshot) {
2051
+ receivedSerialized = addExtraLineBreaks(receivedSerialized);
2052
+ }
2053
+ if (rawSnapshot) {
2054
+ // normalize EOL when snapshot contains CRLF but received is LF
2055
+ if (rawSnapshot.content && rawSnapshot.content.match(/\r\n/) && !receivedSerialized.match(/\r\n/)) {
2056
+ rawSnapshot.content = normalizeNewlines(rawSnapshot.content);
2057
+ }
2058
+ }
2059
+ const expected = isInline ? inlineSnapshot : rawSnapshot ? rawSnapshot.content : this._snapshotData[key];
2060
+ const expectedTrimmed = rawSnapshot ? expected : expected === null || expected === void 0 ? void 0 : expected.trim();
2061
+ const pass = expectedTrimmed === (rawSnapshot ? receivedSerialized : receivedSerialized.trim());
2062
+ const hasSnapshot = expected !== undefined;
2063
+ const snapshotIsPersisted = isInline || this._fileExists || rawSnapshot && rawSnapshot.content != null;
2064
+ if (pass && !isInline && !rawSnapshot) {
2065
+ // Executing a snapshot file as JavaScript and writing the strings back
2066
+ // when other snapshots have changed loses the proper escaping for some
2067
+ // characters. Since we check every snapshot in every test, use the newly
2068
+ // generated formatted string.
2069
+ // Note that this is only relevant when a snapshot is added and the dirty
2070
+ // flag is set.
2071
+ this._snapshotData[key] = receivedSerialized;
2072
+ }
2073
+ // find call site of toMatchInlineSnapshot
2074
+ let stack;
2075
+ if (isInline) {
2076
+ var _this$environment$pro, _this$environment;
2077
+ const stacks = parseErrorStacktrace(error || new Error("snapshot"), { ignoreStackEntries: [] });
2078
+ const _stack = this._inferInlineSnapshotStack(stacks);
2079
+ if (!_stack) {
2080
+ throw new Error(`@vitest/snapshot: Couldn't infer stack frame for inline snapshot.\n${JSON.stringify(stacks)}`);
2081
+ }
2082
+ stack = ((_this$environment$pro = (_this$environment = this.environment).processStackTrace) === null || _this$environment$pro === void 0 ? void 0 : _this$environment$pro.call(_this$environment, _stack)) || _stack;
2083
+ // removing 1 column, because source map points to the wrong
2084
+ // location for js files, but `column-1` points to the same in both js/ts
2085
+ // https://github.com/vitejs/vite/issues/8657
2086
+ stack.column--;
2087
+ // reject multiple inline snapshots at the same location if snapshot is different
2088
+ const snapshotsWithSameStack = this._inlineSnapshotStacks.filter((s) => isSameStackPosition(s, stack));
2089
+ if (snapshotsWithSameStack.length > 0) {
2090
+ // ensure only one snapshot will be written at the same location
2091
+ this._inlineSnapshots = this._inlineSnapshots.filter((s) => !isSameStackPosition(s, stack));
2092
+ const differentSnapshot = snapshotsWithSameStack.find((s) => s.snapshot !== receivedSerialized);
2093
+ if (differentSnapshot) {
2094
+ throw Object.assign(new Error("toMatchInlineSnapshot with different snapshots cannot be called at the same location"), {
2095
+ actual: receivedSerialized,
2096
+ expected: differentSnapshot.snapshot
2097
+ });
2098
+ }
2099
+ }
2100
+ this._inlineSnapshotStacks.push({
2101
+ ...stack,
2102
+ testId,
2103
+ snapshot: receivedSerialized
2104
+ });
2105
+ }
2106
+ // These are the conditions on when to write snapshots:
2107
+ // * There's no snapshot file in a non-CI environment.
2108
+ // * There is a snapshot file and we decided to update the snapshot.
2109
+ // * There is a snapshot file, but it doesn't have this snapshot.
2110
+ // These are the conditions on when not to write snapshots:
2111
+ // * The update flag is set to 'none'.
2112
+ // * There's no snapshot file or a file without this snapshot on a CI environment.
2113
+ if (hasSnapshot && this._updateSnapshot === "all" || (!hasSnapshot || !snapshotIsPersisted) && (this._updateSnapshot === "new" || this._updateSnapshot === "all")) {
2114
+ if (this._updateSnapshot === "all") {
2115
+ if (!pass) {
2116
+ if (hasSnapshot) {
2117
+ this.updated.increment(testId);
2118
+ } else {
2119
+ this.added.increment(testId);
2120
+ }
2121
+ this._addSnapshot(key, receivedSerialized, {
2122
+ stack,
2123
+ testId,
2124
+ rawSnapshot
2125
+ });
2126
+ } else {
2127
+ this.matched.increment(testId);
2128
+ }
2129
+ } else {
2130
+ this._addSnapshot(key, receivedSerialized, {
2131
+ stack,
2132
+ testId,
2133
+ rawSnapshot
2134
+ });
2135
+ this.added.increment(testId);
2136
+ }
2137
+ return {
2138
+ actual: "",
2139
+ count,
2140
+ expected: "",
2141
+ key,
2142
+ pass: true
2143
+ };
2144
+ } else {
2145
+ if (!pass) {
2146
+ this.unmatched.increment(testId);
2147
+ return {
2148
+ actual: rawSnapshot ? receivedSerialized : removeExtraLineBreaks(receivedSerialized),
2149
+ count,
2150
+ expected: expectedTrimmed !== undefined ? rawSnapshot ? expectedTrimmed : removeExtraLineBreaks(expectedTrimmed) : undefined,
2151
+ key,
2152
+ pass: false
2153
+ };
2154
+ } else {
2155
+ this.matched.increment(testId);
2156
+ return {
2157
+ actual: "",
2158
+ count,
2159
+ expected: "",
2160
+ key,
2161
+ pass: true
2162
+ };
2163
+ }
2164
+ }
2165
+ }
2166
+ async pack() {
2167
+ const snapshot = {
2168
+ filepath: this.testFilePath,
2169
+ added: 0,
2170
+ fileDeleted: false,
2171
+ matched: 0,
2172
+ unchecked: 0,
2173
+ uncheckedKeys: [],
2174
+ unmatched: 0,
2175
+ updated: 0
2176
+ };
2177
+ const uncheckedCount = this.getUncheckedCount();
2178
+ const uncheckedKeys = this.getUncheckedKeys();
2179
+ if (uncheckedCount) {
2180
+ this.removeUncheckedKeys();
2181
+ }
2182
+ const status = await this.save();
2183
+ snapshot.fileDeleted = status.deleted;
2184
+ snapshot.added = this.added.total();
2185
+ snapshot.matched = this.matched.total();
2186
+ snapshot.unmatched = this.unmatched.total();
2187
+ snapshot.updated = this.updated.total();
2188
+ snapshot.unchecked = !status.deleted ? uncheckedCount : 0;
2189
+ snapshot.uncheckedKeys = Array.from(uncheckedKeys);
2190
+ return snapshot;
2191
+ }
2192
+ }
2193
+
2194
+ function createMismatchError(message, expand, actual, expected) {
2195
+ const error = new Error(message);
2196
+ Object.defineProperty(error, "actual", {
2197
+ value: actual,
2198
+ enumerable: true,
2199
+ configurable: true,
2200
+ writable: true
2201
+ });
2202
+ Object.defineProperty(error, "expected", {
2203
+ value: expected,
2204
+ enumerable: true,
2205
+ configurable: true,
2206
+ writable: true
2207
+ });
2208
+ Object.defineProperty(error, "diffOptions", { value: { expand } });
2209
+ return error;
2210
+ }
2211
+ class SnapshotClient {
2212
+ snapshotStateMap = new Map();
2213
+ constructor(options = {}) {
2214
+ this.options = options;
2215
+ }
2216
+ async setup(filepath, options) {
2217
+ if (this.snapshotStateMap.has(filepath)) {
2218
+ return;
2219
+ }
2220
+ this.snapshotStateMap.set(filepath, await SnapshotState.create(filepath, options));
2221
+ }
2222
+ async finish(filepath) {
2223
+ const state = this.getSnapshotState(filepath);
2224
+ const result = await state.pack();
2225
+ this.snapshotStateMap.delete(filepath);
2226
+ return result;
2227
+ }
2228
+ skipTest(filepath, testName) {
2229
+ const state = this.getSnapshotState(filepath);
2230
+ state.markSnapshotsAsCheckedForTest(testName);
2231
+ }
2232
+ clearTest(filepath, testId) {
2233
+ const state = this.getSnapshotState(filepath);
2234
+ state.clearTest(testId);
2235
+ }
2236
+ getSnapshotState(filepath) {
2237
+ const state = this.snapshotStateMap.get(filepath);
2238
+ if (!state) {
2239
+ throw new Error(`The snapshot state for '${filepath}' is not found. Did you call 'SnapshotClient.setup()'?`);
2240
+ }
2241
+ return state;
2242
+ }
2243
+ assert(options) {
2244
+ const { filepath, name, testId = name, message, isInline = false, properties, inlineSnapshot, error, errorMessage, rawSnapshot } = options;
2245
+ let { received } = options;
2246
+ if (!filepath) {
2247
+ throw new Error("Snapshot cannot be used outside of test");
2248
+ }
2249
+ const snapshotState = this.getSnapshotState(filepath);
2250
+ if (typeof properties === "object") {
2251
+ if (typeof received !== "object" || !received) {
2252
+ throw new Error("Received value must be an object when the matcher has properties");
2253
+ }
2254
+ try {
2255
+ var _this$options$isEqual, _this$options;
2256
+ const pass = ((_this$options$isEqual = (_this$options = this.options).isEqual) === null || _this$options$isEqual === void 0 ? void 0 : _this$options$isEqual.call(_this$options, received, properties)) ?? false;
2257
+ // const pass = equals(received, properties, [iterableEquality, subsetEquality])
2258
+ if (!pass) {
2259
+ throw createMismatchError("Snapshot properties mismatched", snapshotState.expand, received, properties);
2260
+ } else {
2261
+ received = deepMergeSnapshot(received, properties);
2262
+ }
2263
+ } catch (err) {
2264
+ err.message = errorMessage || "Snapshot mismatched";
2265
+ throw err;
2266
+ }
2267
+ }
2268
+ const testName = [name, ...message ? [message] : []].join(" > ");
2269
+ const { actual, expected, key, pass } = snapshotState.match({
2270
+ testId,
2271
+ testName,
2272
+ received,
2273
+ isInline,
2274
+ error,
2275
+ inlineSnapshot,
2276
+ rawSnapshot
2277
+ });
2278
+ if (!pass) {
2279
+ throw createMismatchError(`Snapshot \`${key || "unknown"}\` mismatched`, snapshotState.expand, rawSnapshot ? actual : actual === null || actual === void 0 ? void 0 : actual.trim(), rawSnapshot ? expected : expected === null || expected === void 0 ? void 0 : expected.trim());
2280
+ }
2281
+ }
2282
+ async assertRaw(options) {
2283
+ if (!options.rawSnapshot) {
2284
+ throw new Error("Raw snapshot is required");
2285
+ }
2286
+ const { filepath, rawSnapshot } = options;
2287
+ if (rawSnapshot.content == null) {
2288
+ if (!filepath) {
2289
+ throw new Error("Snapshot cannot be used outside of test");
2290
+ }
2291
+ const snapshotState = this.getSnapshotState(filepath);
2292
+ // save the filepath, so it don't lose even if the await make it out-of-context
2293
+ options.filepath || (options.filepath = filepath);
2294
+ // resolve and read the raw snapshot file
2295
+ rawSnapshot.file = await snapshotState.environment.resolveRawPath(filepath, rawSnapshot.file);
2296
+ rawSnapshot.content = await snapshotState.environment.readSnapshotFile(rawSnapshot.file) ?? undefined;
2297
+ }
2298
+ return this.assert(options);
2299
+ }
2300
+ clear() {
2301
+ this.snapshotStateMap.clear();
2302
+ }
2303
+ }
2304
+
2305
+ export { SnapshotClient, SnapshotState, addSerializer, getSerializers, stripSnapshotIndentation };