@copilotkit/aimock 1.12.0 → 1.13.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 (178) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +20 -2
  4. package/dist/_virtual/_rolldown/runtime.cjs +2 -0
  5. package/dist/_virtual/_rolldown/runtime.js +29 -0
  6. package/dist/a2a-types.d.cts.map +1 -1
  7. package/dist/a2a-types.d.ts.map +1 -1
  8. package/dist/aimock-cli.cjs +16 -0
  9. package/dist/aimock-cli.cjs.map +1 -1
  10. package/dist/aimock-cli.d.cts +2 -0
  11. package/dist/aimock-cli.d.cts.map +1 -1
  12. package/dist/aimock-cli.d.ts +2 -0
  13. package/dist/aimock-cli.d.ts.map +1 -1
  14. package/dist/aimock-cli.js +16 -0
  15. package/dist/aimock-cli.js.map +1 -1
  16. package/dist/config-loader.d.cts.map +1 -1
  17. package/dist/convert-mockllm.cjs +232 -0
  18. package/dist/convert-mockllm.cjs.map +1 -0
  19. package/dist/convert-mockllm.js +230 -0
  20. package/dist/convert-mockllm.js.map +1 -0
  21. package/dist/convert-vidaimock.cjs +110 -0
  22. package/dist/convert-vidaimock.cjs.map +1 -0
  23. package/dist/convert-vidaimock.js +108 -0
  24. package/dist/convert-vidaimock.js.map +1 -0
  25. package/dist/convert.cjs +158 -0
  26. package/dist/convert.cjs.map +1 -0
  27. package/dist/convert.d.cts +16 -0
  28. package/dist/convert.d.cts.map +1 -0
  29. package/dist/convert.d.ts +16 -0
  30. package/dist/convert.d.ts.map +1 -0
  31. package/dist/convert.js +157 -0
  32. package/dist/convert.js.map +1 -0
  33. package/dist/jest.cjs +70 -0
  34. package/dist/jest.cjs.map +1 -0
  35. package/dist/jest.d.cts +33 -0
  36. package/dist/jest.d.cts.map +1 -0
  37. package/dist/jest.d.ts +33 -0
  38. package/dist/jest.d.ts.map +1 -0
  39. package/dist/jest.js +67 -0
  40. package/dist/jest.js.map +1 -0
  41. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.cjs +934 -0
  42. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.cjs.map +1 -0
  43. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js +934 -0
  44. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
  45. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.cjs +1051 -0
  46. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.cjs.map +1 -0
  47. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js +1042 -0
  48. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js.map +1 -0
  49. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/index.cjs +1 -0
  50. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/index.js +3 -0
  51. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.cjs +96 -0
  52. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.cjs.map +1 -0
  53. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +93 -0
  54. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +1 -0
  55. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.cjs +49 -0
  56. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.cjs.map +1 -0
  57. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.js +43 -0
  58. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
  59. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.cjs +456 -0
  60. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.cjs.map +1 -0
  61. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.js +456 -0
  62. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.js.map +1 -0
  63. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.cjs +170 -0
  64. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.cjs.map +1 -0
  65. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.js +169 -0
  66. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
  67. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.cjs +388 -0
  68. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.cjs.map +1 -0
  69. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js +385 -0
  70. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js.map +1 -0
  71. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.cjs +12 -0
  72. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.cjs.map +1 -0
  73. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +12 -0
  74. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +1 -0
  75. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.cjs +17 -0
  76. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.cjs.map +1 -0
  77. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +17 -0
  78. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +1 -0
  79. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.cjs +12 -0
  80. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.cjs.map +1 -0
  81. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +12 -0
  82. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +1 -0
  83. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.cjs +16 -0
  84. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.cjs.map +1 -0
  85. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +16 -0
  86. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +1 -0
  87. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.cjs +14 -0
  88. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.cjs.map +1 -0
  89. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +14 -0
  90. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +1 -0
  91. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.cjs +35 -0
  92. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.cjs.map +1 -0
  93. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +35 -0
  94. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +1 -0
  95. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.cjs +13 -0
  96. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.cjs.map +1 -0
  97. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +13 -0
  98. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +1 -0
  99. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.cjs +128 -0
  100. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.cjs.map +1 -0
  101. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +123 -0
  102. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +1 -0
  103. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.cjs +41 -0
  104. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.cjs.map +1 -0
  105. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +40 -0
  106. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +1 -0
  107. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.cjs +100 -0
  108. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.cjs.map +1 -0
  109. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +100 -0
  110. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +1 -0
  111. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.cjs +26 -0
  112. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.cjs.map +1 -0
  113. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +26 -0
  114. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +1 -0
  115. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.cjs +15 -0
  116. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.cjs.map +1 -0
  117. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +15 -0
  118. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +1 -0
  119. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.cjs +22 -0
  120. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.cjs.map +1 -0
  121. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +22 -0
  122. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +1 -0
  123. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.cjs +7 -0
  124. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.cjs.map +1 -0
  125. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +6 -0
  126. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +1 -0
  127. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.cjs +13 -0
  128. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.cjs.map +1 -0
  129. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +13 -0
  130. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +1 -0
  131. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.cjs +19 -0
  132. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.cjs.map +1 -0
  133. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +19 -0
  134. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +1 -0
  135. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.cjs +26 -0
  136. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.cjs.map +1 -0
  137. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +26 -0
  138. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +1 -0
  139. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.cjs +10 -0
  140. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.cjs.map +1 -0
  141. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +9 -0
  142. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +1 -0
  143. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.cjs +31 -0
  144. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.cjs.map +1 -0
  145. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +31 -0
  146. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +1 -0
  147. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.cjs +52 -0
  148. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.cjs.map +1 -0
  149. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.js +52 -0
  150. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.js.map +1 -0
  151. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.cjs +83 -0
  152. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.cjs.map +1 -0
  153. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +82 -0
  154. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +1 -0
  155. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.cjs +10 -0
  156. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.cjs.map +1 -0
  157. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js +10 -0
  158. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js.map +1 -0
  159. package/dist/vitest.cjs +80 -0
  160. package/dist/vitest.cjs.map +1 -0
  161. package/dist/vitest.d.cts +30 -0
  162. package/dist/vitest.d.cts.map +1 -0
  163. package/dist/vitest.d.ts +30 -0
  164. package/dist/vitest.d.ts.map +1 -0
  165. package/dist/vitest.js +77 -0
  166. package/dist/vitest.js.map +1 -0
  167. package/fixtures/examples/a2a/a2a-config.json +42 -0
  168. package/fixtures/examples/agui/agui-text-response.json +35 -0
  169. package/fixtures/examples/chaos/chaos-config.json +10 -0
  170. package/fixtures/examples/full-suite.json +116 -0
  171. package/fixtures/examples/llm/embeddings.json +10 -0
  172. package/fixtures/examples/llm/error-injection.json +15 -0
  173. package/fixtures/examples/llm/sequential-responses.json +20 -0
  174. package/fixtures/examples/llm/streaming-physics.json +15 -0
  175. package/fixtures/examples/mcp/mcp-config.json +26 -0
  176. package/fixtures/examples/record-replay/record-config.json +11 -0
  177. package/fixtures/examples/vector/vector-config.json +34 -0
  178. package/package.json +59 -1
@@ -0,0 +1,52 @@
1
+ const require_runtime = require('../../../../../../_virtual/_rolldown/runtime.cjs');
2
+ const require_index = require('../../../../js-tokens@9.0.1/node_modules/js-tokens/index.cjs');
3
+
4
+ //#region node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.mjs
5
+ var import_js_tokens = /* @__PURE__ */ require_runtime.__toESM(require_index.default, 1);
6
+ const FILL_COMMENT = " ";
7
+ function stripLiteralFromToken(token, fillChar, filter) {
8
+ if (token.type === "SingleLineComment") return FILL_COMMENT.repeat(token.value.length);
9
+ if (token.type === "MultiLineComment") return token.value.replace(/[^\n]/g, FILL_COMMENT);
10
+ if (token.type === "StringLiteral") {
11
+ if (!token.closed) return token.value;
12
+ const body = token.value.slice(1, -1);
13
+ if (filter(body)) return token.value[0] + fillChar.repeat(body.length) + token.value[token.value.length - 1];
14
+ }
15
+ if (token.type === "NoSubstitutionTemplate") {
16
+ const body = token.value.slice(1, -1);
17
+ if (filter(body)) return `\`${body.replace(/[^\n]/g, fillChar)}\``;
18
+ }
19
+ if (token.type === "RegularExpressionLiteral") {
20
+ const body = token.value;
21
+ if (filter(body)) return body.replace(/\/(.*)\/(\w?)$/g, (_, $1, $2) => `/${fillChar.repeat($1.length)}/${$2}`);
22
+ }
23
+ if (token.type === "TemplateHead") {
24
+ const body = token.value.slice(1, -2);
25
+ if (filter(body)) return `\`${body.replace(/[^\n]/g, fillChar)}\${`;
26
+ }
27
+ if (token.type === "TemplateTail") {
28
+ const body = token.value.slice(0, -2);
29
+ if (filter(body)) return `}${body.replace(/[^\n]/g, fillChar)}\``;
30
+ }
31
+ if (token.type === "TemplateMiddle") {
32
+ const body = token.value.slice(1, -2);
33
+ if (filter(body)) return `}${body.replace(/[^\n]/g, fillChar)}\${`;
34
+ }
35
+ return token.value;
36
+ }
37
+ function optionsWithDefaults(options) {
38
+ return {
39
+ fillChar: options?.fillChar ?? " ",
40
+ filter: options?.filter ?? (() => true)
41
+ };
42
+ }
43
+ function stripLiteral(code, options) {
44
+ let result = "";
45
+ const _options = optionsWithDefaults(options);
46
+ for (const token of (0, import_js_tokens.default)(code, { jsx: false })) result += stripLiteralFromToken(token, _options.fillChar, _options.filter);
47
+ return result;
48
+ }
49
+
50
+ //#endregion
51
+ exports.stripLiteral = stripLiteral;
52
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../../../../../../node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.mjs"],"sourcesContent":["import jsTokens from 'js-tokens';\n\nconst FILL_COMMENT = \" \";\nfunction stripLiteralFromToken(token, fillChar, filter) {\n if (token.type === \"SingleLineComment\") {\n return FILL_COMMENT.repeat(token.value.length);\n }\n if (token.type === \"MultiLineComment\") {\n return token.value.replace(/[^\\n]/g, FILL_COMMENT);\n }\n if (token.type === \"StringLiteral\") {\n if (!token.closed) {\n return token.value;\n }\n const body = token.value.slice(1, -1);\n if (filter(body)) {\n return token.value[0] + fillChar.repeat(body.length) + token.value[token.value.length - 1];\n }\n }\n if (token.type === \"NoSubstitutionTemplate\") {\n const body = token.value.slice(1, -1);\n if (filter(body)) {\n return `\\`${body.replace(/[^\\n]/g, fillChar)}\\``;\n }\n }\n if (token.type === \"RegularExpressionLiteral\") {\n const body = token.value;\n if (filter(body)) {\n return body.replace(/\\/(.*)\\/(\\w?)$/g, (_, $1, $2) => `/${fillChar.repeat($1.length)}/${$2}`);\n }\n }\n if (token.type === \"TemplateHead\") {\n const body = token.value.slice(1, -2);\n if (filter(body)) {\n return `\\`${body.replace(/[^\\n]/g, fillChar)}\\${`;\n }\n }\n if (token.type === \"TemplateTail\") {\n const body = token.value.slice(0, -2);\n if (filter(body)) {\n return `}${body.replace(/[^\\n]/g, fillChar)}\\``;\n }\n }\n if (token.type === \"TemplateMiddle\") {\n const body = token.value.slice(1, -2);\n if (filter(body)) {\n return `}${body.replace(/[^\\n]/g, fillChar)}\\${`;\n }\n }\n return token.value;\n}\nfunction optionsWithDefaults(options) {\n return {\n fillChar: options?.fillChar ?? \" \",\n filter: options?.filter ?? (() => true)\n };\n}\nfunction stripLiteral(code, options) {\n let result = \"\";\n const _options = optionsWithDefaults(options);\n for (const token of jsTokens(code, { jsx: false })) {\n result += stripLiteralFromToken(token, _options.fillChar, _options.filter);\n }\n return result;\n}\nfunction stripLiteralDetailed(code, options) {\n let result = \"\";\n const tokens = [];\n const _options = optionsWithDefaults(options);\n for (const token of jsTokens(code, { jsx: false })) {\n tokens.push(token);\n result += stripLiteralFromToken(token, _options.fillChar, _options.filter);\n }\n return {\n result,\n tokens\n };\n}\n\nexport { stripLiteral, stripLiteralDetailed, stripLiteralDetailed as stripLiteralJsTokens };\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAEA,MAAM,eAAe;AACrB,SAAS,sBAAsB,OAAO,UAAU,QAAQ;AACtD,KAAI,MAAM,SAAS,oBACjB,QAAO,aAAa,OAAO,MAAM,MAAM,OAAO;AAEhD,KAAI,MAAM,SAAS,mBACjB,QAAO,MAAM,MAAM,QAAQ,UAAU,aAAa;AAEpD,KAAI,MAAM,SAAS,iBAAiB;AAClC,MAAI,CAAC,MAAM,OACT,QAAO,MAAM;EAEf,MAAM,OAAO,MAAM,MAAM,MAAM,GAAG,GAAG;AACrC,MAAI,OAAO,KAAK,CACd,QAAO,MAAM,MAAM,KAAK,SAAS,OAAO,KAAK,OAAO,GAAG,MAAM,MAAM,MAAM,MAAM,SAAS;;AAG5F,KAAI,MAAM,SAAS,0BAA0B;EAC3C,MAAM,OAAO,MAAM,MAAM,MAAM,GAAG,GAAG;AACrC,MAAI,OAAO,KAAK,CACd,QAAO,KAAK,KAAK,QAAQ,UAAU,SAAS,CAAC;;AAGjD,KAAI,MAAM,SAAS,4BAA4B;EAC7C,MAAM,OAAO,MAAM;AACnB,MAAI,OAAO,KAAK,CACd,QAAO,KAAK,QAAQ,oBAAoB,GAAG,IAAI,OAAO,IAAI,SAAS,OAAO,GAAG,OAAO,CAAC,GAAG,KAAK;;AAGjG,KAAI,MAAM,SAAS,gBAAgB;EACjC,MAAM,OAAO,MAAM,MAAM,MAAM,GAAG,GAAG;AACrC,MAAI,OAAO,KAAK,CACd,QAAO,KAAK,KAAK,QAAQ,UAAU,SAAS,CAAC;;AAGjD,KAAI,MAAM,SAAS,gBAAgB;EACjC,MAAM,OAAO,MAAM,MAAM,MAAM,GAAG,GAAG;AACrC,MAAI,OAAO,KAAK,CACd,QAAO,IAAI,KAAK,QAAQ,UAAU,SAAS,CAAC;;AAGhD,KAAI,MAAM,SAAS,kBAAkB;EACnC,MAAM,OAAO,MAAM,MAAM,MAAM,GAAG,GAAG;AACrC,MAAI,OAAO,KAAK,CACd,QAAO,IAAI,KAAK,QAAQ,UAAU,SAAS,CAAC;;AAGhD,QAAO,MAAM;;AAEf,SAAS,oBAAoB,SAAS;AACpC,QAAO;EACL,UAAU,SAAS,YAAY;EAC/B,QAAQ,SAAS,iBAAiB;EACnC;;AAEH,SAAS,aAAa,MAAM,SAAS;CACnC,IAAI,SAAS;CACb,MAAM,WAAW,oBAAoB,QAAQ;AAC7C,MAAK,MAAM,uCAAkB,MAAM,EAAE,KAAK,OAAO,CAAC,CAChD,WAAU,sBAAsB,OAAO,SAAS,UAAU,SAAS,OAAO;AAE5E,QAAO"}
@@ -0,0 +1,52 @@
1
+ import { __toESM } from "../../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_js_tokens } from "../../../../js-tokens@9.0.1/node_modules/js-tokens/index.js";
3
+
4
+ //#region node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.mjs
5
+ var import_js_tokens = /* @__PURE__ */ __toESM(require_js_tokens(), 1);
6
+ const FILL_COMMENT = " ";
7
+ function stripLiteralFromToken(token, fillChar, filter) {
8
+ if (token.type === "SingleLineComment") return FILL_COMMENT.repeat(token.value.length);
9
+ if (token.type === "MultiLineComment") return token.value.replace(/[^\n]/g, FILL_COMMENT);
10
+ if (token.type === "StringLiteral") {
11
+ if (!token.closed) return token.value;
12
+ const body = token.value.slice(1, -1);
13
+ if (filter(body)) return token.value[0] + fillChar.repeat(body.length) + token.value[token.value.length - 1];
14
+ }
15
+ if (token.type === "NoSubstitutionTemplate") {
16
+ const body = token.value.slice(1, -1);
17
+ if (filter(body)) return `\`${body.replace(/[^\n]/g, fillChar)}\``;
18
+ }
19
+ if (token.type === "RegularExpressionLiteral") {
20
+ const body = token.value;
21
+ if (filter(body)) return body.replace(/\/(.*)\/(\w?)$/g, (_, $1, $2) => `/${fillChar.repeat($1.length)}/${$2}`);
22
+ }
23
+ if (token.type === "TemplateHead") {
24
+ const body = token.value.slice(1, -2);
25
+ if (filter(body)) return `\`${body.replace(/[^\n]/g, fillChar)}\${`;
26
+ }
27
+ if (token.type === "TemplateTail") {
28
+ const body = token.value.slice(0, -2);
29
+ if (filter(body)) return `}${body.replace(/[^\n]/g, fillChar)}\``;
30
+ }
31
+ if (token.type === "TemplateMiddle") {
32
+ const body = token.value.slice(1, -2);
33
+ if (filter(body)) return `}${body.replace(/[^\n]/g, fillChar)}\${`;
34
+ }
35
+ return token.value;
36
+ }
37
+ function optionsWithDefaults(options) {
38
+ return {
39
+ fillChar: options?.fillChar ?? " ",
40
+ filter: options?.filter ?? (() => true)
41
+ };
42
+ }
43
+ function stripLiteral(code, options) {
44
+ let result = "";
45
+ const _options = optionsWithDefaults(options);
46
+ for (const token of (0, import_js_tokens.default)(code, { jsx: false })) result += stripLiteralFromToken(token, _options.fillChar, _options.filter);
47
+ return result;
48
+ }
49
+
50
+ //#endregion
51
+ export { stripLiteral };
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../../node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.mjs"],"sourcesContent":["import jsTokens from 'js-tokens';\n\nconst FILL_COMMENT = \" \";\nfunction stripLiteralFromToken(token, fillChar, filter) {\n if (token.type === \"SingleLineComment\") {\n return FILL_COMMENT.repeat(token.value.length);\n }\n if (token.type === \"MultiLineComment\") {\n return token.value.replace(/[^\\n]/g, FILL_COMMENT);\n }\n if (token.type === \"StringLiteral\") {\n if (!token.closed) {\n return token.value;\n }\n const body = token.value.slice(1, -1);\n if (filter(body)) {\n return token.value[0] + fillChar.repeat(body.length) + token.value[token.value.length - 1];\n }\n }\n if (token.type === \"NoSubstitutionTemplate\") {\n const body = token.value.slice(1, -1);\n if (filter(body)) {\n return `\\`${body.replace(/[^\\n]/g, fillChar)}\\``;\n }\n }\n if (token.type === \"RegularExpressionLiteral\") {\n const body = token.value;\n if (filter(body)) {\n return body.replace(/\\/(.*)\\/(\\w?)$/g, (_, $1, $2) => `/${fillChar.repeat($1.length)}/${$2}`);\n }\n }\n if (token.type === \"TemplateHead\") {\n const body = token.value.slice(1, -2);\n if (filter(body)) {\n return `\\`${body.replace(/[^\\n]/g, fillChar)}\\${`;\n }\n }\n if (token.type === \"TemplateTail\") {\n const body = token.value.slice(0, -2);\n if (filter(body)) {\n return `}${body.replace(/[^\\n]/g, fillChar)}\\``;\n }\n }\n if (token.type === \"TemplateMiddle\") {\n const body = token.value.slice(1, -2);\n if (filter(body)) {\n return `}${body.replace(/[^\\n]/g, fillChar)}\\${`;\n }\n }\n return token.value;\n}\nfunction optionsWithDefaults(options) {\n return {\n fillChar: options?.fillChar ?? \" \",\n filter: options?.filter ?? (() => true)\n };\n}\nfunction stripLiteral(code, options) {\n let result = \"\";\n const _options = optionsWithDefaults(options);\n for (const token of jsTokens(code, { jsx: false })) {\n result += stripLiteralFromToken(token, _options.fillChar, _options.filter);\n }\n return result;\n}\nfunction stripLiteralDetailed(code, options) {\n let result = \"\";\n const tokens = [];\n const _options = optionsWithDefaults(options);\n for (const token of jsTokens(code, { jsx: false })) {\n tokens.push(token);\n result += stripLiteralFromToken(token, _options.fillChar, _options.filter);\n }\n return {\n result,\n tokens\n };\n}\n\nexport { stripLiteral, stripLiteralDetailed, stripLiteralDetailed as stripLiteralJsTokens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,IAAI,KAAK,QAAQ,UAAU,SAAS,CAAC;;AAGhD,QAAO,MAAM;;AAEf,SAAS,oBAAoB,SAAS;AACpC,QAAO;EACL,UAAU,SAAS,YAAY;EAC/B,QAAQ,SAAS,iBAAiB;EACnC;;AAEH,SAAS,aAAa,MAAM,SAAS;CACnC,IAAI,SAAS;CACb,MAAM,WAAW,oBAAoB,QAAQ;AAC7C,MAAK,MAAM,uCAAkB,MAAM,EAAE,KAAK,OAAO,CAAC,CAChD,WAAU,sBAAsB,OAAO,SAAS,UAAU,SAAS,OAAO;AAE5E,QAAO"}
@@ -0,0 +1,83 @@
1
+
2
+ //#region node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js
3
+ var h = Object.entries({
4
+ reset: [0, 0],
5
+ bold: [
6
+ 1,
7
+ 22,
8
+ "\x1B[22m\x1B[1m"
9
+ ],
10
+ dim: [
11
+ 2,
12
+ 22,
13
+ "\x1B[22m\x1B[2m"
14
+ ],
15
+ italic: [3, 23],
16
+ underline: [4, 24],
17
+ inverse: [7, 27],
18
+ hidden: [8, 28],
19
+ strikethrough: [9, 29],
20
+ black: [30, 39],
21
+ red: [31, 39],
22
+ green: [32, 39],
23
+ yellow: [33, 39],
24
+ blue: [34, 39],
25
+ magenta: [35, 39],
26
+ cyan: [36, 39],
27
+ white: [37, 39],
28
+ gray: [90, 39],
29
+ bgBlack: [40, 49],
30
+ bgRed: [41, 49],
31
+ bgGreen: [42, 49],
32
+ bgYellow: [43, 49],
33
+ bgBlue: [44, 49],
34
+ bgMagenta: [45, 49],
35
+ bgCyan: [46, 49],
36
+ bgWhite: [47, 49],
37
+ blackBright: [90, 39],
38
+ redBright: [91, 39],
39
+ greenBright: [92, 39],
40
+ yellowBright: [93, 39],
41
+ blueBright: [94, 39],
42
+ magentaBright: [95, 39],
43
+ cyanBright: [96, 39],
44
+ whiteBright: [97, 39],
45
+ bgBlackBright: [100, 49],
46
+ bgRedBright: [101, 49],
47
+ bgGreenBright: [102, 49],
48
+ bgYellowBright: [103, 49],
49
+ bgBlueBright: [104, 49],
50
+ bgMagentaBright: [105, 49],
51
+ bgCyanBright: [106, 49],
52
+ bgWhiteBright: [107, 49]
53
+ });
54
+ function a(n) {
55
+ return String(n);
56
+ }
57
+ a.open = "";
58
+ a.close = "";
59
+ function C(n = !1) {
60
+ let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
61
+ 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;
62
+ }
63
+ function p(n = !1) {
64
+ let e = C(n), i = (r, t, c, o) => {
65
+ let l = "", s = 0;
66
+ do
67
+ l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);
68
+ while (~o);
69
+ return l + r.substring(s);
70
+ }, g = (r, t, c = r) => {
71
+ let o = (l) => {
72
+ let s = String(l), b = s.indexOf(t, r.length);
73
+ return ~b ? r + i(s, t, c, b) + t : r + s + t;
74
+ };
75
+ return o.open = r, o.close = t, o;
76
+ }, u = { isColorSupported: e }, d = (r) => `\x1B[${r}m`;
77
+ for (let [r, t] of h) u[r] = e ? g(d(t[0]), d(t[1]), t[2]) : a;
78
+ return u;
79
+ }
80
+
81
+ //#endregion
82
+ exports.p = p;
83
+ //# sourceMappingURL=chunk-BVHSVHOK.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-BVHSVHOK.cjs","names":[],"sources":["../../../../../../../node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js"],"sourcesContent":["// src/index.ts\nvar f = {\n reset: [0, 0],\n bold: [1, 22, \"\\x1B[22m\\x1B[1m\"],\n dim: [2, 22, \"\\x1B[22m\\x1B[2m\"],\n italic: [3, 23],\n underline: [4, 24],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n gray: [90, 39],\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49],\n blackBright: [90, 39],\n redBright: [91, 39],\n greenBright: [92, 39],\n yellowBright: [93, 39],\n blueBright: [94, 39],\n magentaBright: [95, 39],\n cyanBright: [96, 39],\n whiteBright: [97, 39],\n bgBlackBright: [100, 49],\n bgRedBright: [101, 49],\n bgGreenBright: [102, 49],\n bgYellowBright: [103, 49],\n bgBlueBright: [104, 49],\n bgMagentaBright: [105, 49],\n bgCyanBright: [106, 49],\n bgWhiteBright: [107, 49]\n}, h = Object.entries(f);\nfunction a(n) {\n return String(n);\n}\na.open = \"\";\na.close = \"\";\nvar B = /* @__PURE__ */ h.reduce(\n (n, [e]) => (n[e] = a, n),\n { isColorSupported: !1 }\n);\nfunction m() {\n return { ...B };\n}\nfunction C(n = !1) {\n let e = typeof process != \"undefined\" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];\n 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;\n}\nfunction p(n = !1) {\n let e = C(n), i = (r, t, c, o) => {\n let l = \"\", s = 0;\n do\n l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);\n while (~o);\n return l + r.substring(s);\n }, g = (r, t, c = r) => {\n let o = (l) => {\n let s = String(l), b = s.indexOf(t, r.length);\n return ~b ? r + i(s, t, c, b) + t : r + s + t;\n };\n return o.open = r, o.close = t, o;\n }, u = {\n isColorSupported: e\n }, d = (r) => `\\x1B[${r}m`;\n for (let [r, t] of h)\n u[r] = e ? g(\n d(t[0]),\n d(t[1]),\n t[2]\n ) : a;\n return u;\n}\n\nexport {\n m as a,\n C as b,\n p as c\n};\n"],"x_google_ignoreList":[0],"mappings":";;AACA,IA0CG,IAAI,OAAO,QA1CN;CACN,OAAO,CAAC,GAAG,EAAE;CACb,MAAM;EAAC;EAAG;EAAI;EAAkB;CAChC,KAAK;EAAC;EAAG;EAAI;EAAkB;CAC/B,QAAQ,CAAC,GAAG,GAAG;CACf,WAAW,CAAC,GAAG,GAAG;CAClB,SAAS,CAAC,GAAG,GAAG;CAChB,QAAQ,CAAC,GAAG,GAAG;CACf,eAAe,CAAC,GAAG,GAAG;CACtB,OAAO,CAAC,IAAI,GAAG;CACf,KAAK,CAAC,IAAI,GAAG;CACb,OAAO,CAAC,IAAI,GAAG;CACf,QAAQ,CAAC,IAAI,GAAG;CAChB,MAAM,CAAC,IAAI,GAAG;CACd,SAAS,CAAC,IAAI,GAAG;CACjB,MAAM,CAAC,IAAI,GAAG;CACd,OAAO,CAAC,IAAI,GAAG;CACf,MAAM,CAAC,IAAI,GAAG;CACd,SAAS,CAAC,IAAI,GAAG;CACjB,OAAO,CAAC,IAAI,GAAG;CACf,SAAS,CAAC,IAAI,GAAG;CACjB,UAAU,CAAC,IAAI,GAAG;CAClB,QAAQ,CAAC,IAAI,GAAG;CAChB,WAAW,CAAC,IAAI,GAAG;CACnB,QAAQ,CAAC,IAAI,GAAG;CAChB,SAAS,CAAC,IAAI,GAAG;CACjB,aAAa,CAAC,IAAI,GAAG;CACrB,WAAW,CAAC,IAAI,GAAG;CACnB,aAAa,CAAC,IAAI,GAAG;CACrB,cAAc,CAAC,IAAI,GAAG;CACtB,YAAY,CAAC,IAAI,GAAG;CACpB,eAAe,CAAC,IAAI,GAAG;CACvB,YAAY,CAAC,IAAI,GAAG;CACpB,aAAa,CAAC,IAAI,GAAG;C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GAAG,IAAI,IAAI,IAAI;;AAE9C,SAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG;IAC/B,IAAI,EACL,kBAAkB,GACnB,EAAE,KAAK,MAAM,QAAQ,EAAE;AACxB,MAAK,IAAI,CAAC,GAAG,MAAM,EACjB,GAAE,KAAK,IAAI,EACT,EAAE,EAAE,GAAG,EACP,EAAE,EAAE,GAAG,EACP,EAAE,GACH,GAAG;AACN,QAAO"}
@@ -0,0 +1,82 @@
1
+ //#region node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js
2
+ var h = Object.entries({
3
+ reset: [0, 0],
4
+ bold: [
5
+ 1,
6
+ 22,
7
+ "\x1B[22m\x1B[1m"
8
+ ],
9
+ dim: [
10
+ 2,
11
+ 22,
12
+ "\x1B[22m\x1B[2m"
13
+ ],
14
+ italic: [3, 23],
15
+ underline: [4, 24],
16
+ inverse: [7, 27],
17
+ hidden: [8, 28],
18
+ strikethrough: [9, 29],
19
+ black: [30, 39],
20
+ red: [31, 39],
21
+ green: [32, 39],
22
+ yellow: [33, 39],
23
+ blue: [34, 39],
24
+ magenta: [35, 39],
25
+ cyan: [36, 39],
26
+ white: [37, 39],
27
+ gray: [90, 39],
28
+ bgBlack: [40, 49],
29
+ bgRed: [41, 49],
30
+ bgGreen: [42, 49],
31
+ bgYellow: [43, 49],
32
+ bgBlue: [44, 49],
33
+ bgMagenta: [45, 49],
34
+ bgCyan: [46, 49],
35
+ bgWhite: [47, 49],
36
+ blackBright: [90, 39],
37
+ redBright: [91, 39],
38
+ greenBright: [92, 39],
39
+ yellowBright: [93, 39],
40
+ blueBright: [94, 39],
41
+ magentaBright: [95, 39],
42
+ cyanBright: [96, 39],
43
+ whiteBright: [97, 39],
44
+ bgBlackBright: [100, 49],
45
+ bgRedBright: [101, 49],
46
+ bgGreenBright: [102, 49],
47
+ bgYellowBright: [103, 49],
48
+ bgBlueBright: [104, 49],
49
+ bgMagentaBright: [105, 49],
50
+ bgCyanBright: [106, 49],
51
+ bgWhiteBright: [107, 49]
52
+ });
53
+ function a(n) {
54
+ return String(n);
55
+ }
56
+ a.open = "";
57
+ a.close = "";
58
+ function C(n = !1) {
59
+ let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
60
+ 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;
61
+ }
62
+ function p(n = !1) {
63
+ let e = C(n), i = (r, t, c, o) => {
64
+ let l = "", s = 0;
65
+ do
66
+ l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);
67
+ while (~o);
68
+ return l + r.substring(s);
69
+ }, g = (r, t, c = r) => {
70
+ let o = (l) => {
71
+ let s = String(l), b = s.indexOf(t, r.length);
72
+ return ~b ? r + i(s, t, c, b) + t : r + s + t;
73
+ };
74
+ return o.open = r, o.close = t, o;
75
+ }, u = { isColorSupported: e }, d = (r) => `\x1B[${r}m`;
76
+ for (let [r, t] of h) u[r] = e ? g(d(t[0]), d(t[1]), t[2]) : a;
77
+ return u;
78
+ }
79
+
80
+ //#endregion
81
+ export { p };
82
+ //# sourceMappingURL=chunk-BVHSVHOK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-BVHSVHOK.js","names":[],"sources":["../../../../../../../node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js"],"sourcesContent":["// src/index.ts\nvar f = {\n reset: [0, 0],\n bold: [1, 22, \"\\x1B[22m\\x1B[1m\"],\n dim: [2, 22, \"\\x1B[22m\\x1B[2m\"],\n italic: [3, 23],\n underline: [4, 24],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n gray: [90, 39],\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49],\n blackBright: [90, 39],\n redBright: [91, 39],\n greenBright: [92, 39],\n yellowBright: [93, 39],\n blueBright: [94, 39],\n magentaBright: [95, 39],\n cyanBright: [96, 39],\n whiteBright: [97, 39],\n bgBlackBright: [100, 49],\n bgRedBright: [101, 49],\n bgGreenBright: [102, 49],\n bgYellowBright: [103, 49],\n bgBlueBright: [104, 49],\n bgMagentaBright: [105, 49],\n bgCyanBright: [106, 49],\n bgWhiteBright: [107, 49]\n}, h = Object.entries(f);\nfunction a(n) {\n return String(n);\n}\na.open = \"\";\na.close = \"\";\nvar B = /* @__PURE__ */ h.reduce(\n (n, [e]) => (n[e] = a, n),\n { isColorSupported: !1 }\n);\nfunction m() {\n return { ...B };\n}\nfunction C(n = !1) {\n let e = typeof process != \"undefined\" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];\n 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;\n}\nfunction p(n = !1) {\n let e = C(n), i = (r, t, c, o) => {\n let l = \"\", s = 0;\n do\n l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);\n while (~o);\n return l + r.substring(s);\n }, g = (r, t, c = r) => {\n let o = (l) => {\n let s = String(l), b = s.indexOf(t, r.length);\n return ~b ? r + i(s, t, c, b) + t : r + s + t;\n };\n return o.open = r, o.close = t, o;\n }, u = {\n isColorSupported: e\n }, d = (r) => `\\x1B[${r}m`;\n for (let [r, t] of h)\n u[r] = e ? g(\n d(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AAkB,GACnB,EAAE,KAAK,MAAM,QAAQ,EAAE;AACxB,MAAK,IAAI,CAAC,GAAG,MAAM,EACjB,GAAE,KAAK,IAAI,EACT,EAAE,EAAE,GAAG,EACP,EAAE,EAAE,GAAG,EACP,EAAE,GACH,GAAG;AACN,QAAO"}
@@ -0,0 +1,10 @@
1
+ const require_runtime = require('../../../../../../_virtual/_rolldown/runtime.cjs');
2
+ const require_chunk_BVHSVHOK = require('./chunk-BVHSVHOK.cjs');
3
+ let tty = require("tty");
4
+
5
+ //#region node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js
6
+ var r = process.env.FORCE_TTY !== void 0 || (0, tty.isatty)(1);
7
+ var u = require_chunk_BVHSVHOK.p(r);
8
+
9
+ //#endregion
10
+ //# sourceMappingURL=node.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.cjs","names":["o"],"sources":["../../../../../../../node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js"],"sourcesContent":["import {\n a as e,\n b as t,\n c as o\n} from \"./chunk-BVHSVHOK.js\";\n\n// src/node.ts\nimport { isatty as s } from \"tty\";\nvar r = process.env.FORCE_TTY !== void 0 || s(1);\nfunction n() {\n return t(r);\n}\nfunction a() {\n return o(r);\n}\nvar u = o(r);\nexport {\n a as createColors,\n u as default,\n e as getDefaultColors,\n n as isSupported\n};\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAQA,IAAI,IAAI,QAAQ,IAAI,cAAc,KAAK,qBAAO,EAAE;AAOhD,IAAI,IAAIA,yBAAE,EAAE"}
@@ -0,0 +1,10 @@
1
+ import { p } from "./chunk-BVHSVHOK.js";
2
+ import { isatty } from "tty";
3
+
4
+ //#region node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js
5
+ var r = process.env.FORCE_TTY !== void 0 || isatty(1);
6
+ var u = p(r);
7
+
8
+ //#endregion
9
+ export { };
10
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","names":["s","o"],"sources":["../../../../../../../node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js"],"sourcesContent":["import {\n a as e,\n b as t,\n c as o\n} from \"./chunk-BVHSVHOK.js\";\n\n// src/node.ts\nimport { isatty as s } from \"tty\";\nvar r = process.env.FORCE_TTY !== void 0 || s(1);\nfunction n() {\n return t(r);\n}\nfunction a() {\n return o(r);\n}\nvar u = o(r);\nexport {\n a as createColors,\n u as default,\n e as getDefaultColors,\n n as isSupported\n};\n"],"x_google_ignoreList":[0],"mappings":";;;;AAQA,IAAI,IAAI,QAAQ,IAAI,cAAc,KAAK,KAAKA,OAAE,EAAE;AAOhD,IAAI,IAAIC,EAAE,EAAE"}
@@ -0,0 +1,80 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_fixture_loader = require('./fixture-loader.cjs');
4
+ const require_llmock = require('./llmock.cjs');
5
+ const require_chunk_hooks = require('./node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.cjs');
6
+ let node_path = require("node:path");
7
+ let node_fs = require("node:fs");
8
+
9
+ //#region src/vitest.ts
10
+ /**
11
+ * Vitest integration for aimock.
12
+ *
13
+ * Usage:
14
+ * import { useAimock } from "@copilotkit/aimock/vitest";
15
+ *
16
+ * const mock = useAimock({ fixtures: "./fixtures" });
17
+ *
18
+ * it("responds", async () => {
19
+ * const res = await fetch(`${mock().url}/v1/chat/completions`, { ... });
20
+ * });
21
+ */
22
+ /**
23
+ * Start an aimock server for the duration of the test suite.
24
+ *
25
+ * - `beforeAll`: starts the server and optionally loads fixtures
26
+ * - `beforeEach`: resets fixture match counts (not fixtures themselves)
27
+ * - `afterAll`: stops the server
28
+ *
29
+ * Returns a getter function — call it inside tests to access the handle.
30
+ */
31
+ function useAimock(options = {}) {
32
+ let handle = null;
33
+ require_chunk_hooks.beforeAll(async () => {
34
+ const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;
35
+ const llm = new require_llmock.LLMock(serverOpts);
36
+ if (fixturePath) {
37
+ const loadedFixtures = loadFixtures((0, node_path.resolve)(fixturePath));
38
+ for (const f of loadedFixtures) llm.addFixture(f);
39
+ }
40
+ const url = await llm.start();
41
+ if (patchEnv !== false) {
42
+ process.env.OPENAI_BASE_URL = `${url}/v1`;
43
+ process.env.ANTHROPIC_BASE_URL = `${url}/v1`;
44
+ }
45
+ handle = {
46
+ llm,
47
+ url
48
+ };
49
+ });
50
+ require_chunk_hooks.beforeEach(() => {
51
+ if (handle) handle.llm.resetMatchCounts();
52
+ });
53
+ require_chunk_hooks.afterAll(async () => {
54
+ if (handle) {
55
+ if (options.patchEnv !== false) {
56
+ delete process.env.OPENAI_BASE_URL;
57
+ delete process.env.ANTHROPIC_BASE_URL;
58
+ }
59
+ await handle.llm.stop();
60
+ handle = null;
61
+ }
62
+ });
63
+ return () => {
64
+ if (!handle) throw new Error("useAimock(): server not started — are you calling this inside a test?");
65
+ return handle;
66
+ };
67
+ }
68
+ function loadFixtures(fixturePath) {
69
+ try {
70
+ if ((0, node_fs.statSync)(fixturePath).isDirectory()) return require_fixture_loader.loadFixturesFromDir(fixturePath);
71
+ return require_fixture_loader.loadFixtureFile(fixturePath);
72
+ } catch {
73
+ return [];
74
+ }
75
+ }
76
+
77
+ //#endregion
78
+ exports.LLMock = require_llmock.LLMock;
79
+ exports.useAimock = useAimock;
80
+ //# sourceMappingURL=vitest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.cjs","names":["LLMock","loadFixturesFromDir","loadFixtureFile"],"sources":["../src/vitest.ts"],"sourcesContent":["/**\n * Vitest integration for aimock.\n *\n * Usage:\n * import { useAimock } from \"@copilotkit/aimock/vitest\";\n *\n * const mock = useAimock({ fixtures: \"./fixtures\" });\n *\n * it(\"responds\", async () => {\n * const res = await fetch(`${mock().url}/v1/chat/completions`, { ... });\n * });\n */\n\nimport { beforeAll, afterAll, beforeEach } from \"vitest\";\nimport { LLMock } from \"./llmock.js\";\nimport { loadFixtureFile, loadFixturesFromDir } from \"./fixture-loader.js\";\nimport type { Fixture, MockServerOptions } from \"./types.js\";\nimport { statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nexport interface UseAimockOptions extends MockServerOptions {\n /** Path to fixture file or directory. Loaded automatically on start. */\n fixtures?: string;\n /** If true, sets process.env.OPENAI_BASE_URL to the mock URL + /v1. */\n patchEnv?: boolean;\n}\n\nexport interface AimockHandle {\n /** The LLMock instance. */\n readonly llm: LLMock;\n /** The server URL (e.g., http://127.0.0.1:4010). */\n readonly url: string;\n}\n\n/**\n * Start an aimock server for the duration of the test suite.\n *\n * - `beforeAll`: starts the server and optionally loads fixtures\n * - `beforeEach`: resets fixture match counts (not fixtures themselves)\n * - `afterAll`: stops the server\n *\n * Returns a getter function — call it inside tests to access the handle.\n */\nexport function useAimock(options: UseAimockOptions = {}): () => AimockHandle {\n let handle: AimockHandle | null = null;\n\n beforeAll(async () => {\n const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;\n const llm = new LLMock(serverOpts);\n\n if (fixturePath) {\n const resolved = resolve(fixturePath);\n const loadedFixtures = loadFixtures(resolved);\n for (const f of loadedFixtures) {\n llm.addFixture(f);\n }\n }\n\n const url = await llm.start();\n\n if (patchEnv !== false) {\n process.env.OPENAI_BASE_URL = `${url}/v1`;\n process.env.ANTHROPIC_BASE_URL = `${url}/v1`;\n }\n\n handle = { llm, url };\n });\n\n beforeEach(() => {\n if (handle) {\n handle.llm.resetMatchCounts();\n }\n });\n\n afterAll(async () => {\n if (handle) {\n if (options.patchEnv !== false) {\n delete process.env.OPENAI_BASE_URL;\n delete process.env.ANTHROPIC_BASE_URL;\n }\n await handle.llm.stop();\n handle = null;\n }\n });\n\n return () => {\n if (!handle) {\n throw new Error(\"useAimock(): server not started — are you calling this inside a test?\");\n }\n return handle;\n };\n}\n\nfunction loadFixtures(fixturePath: string): Fixture[] {\n try {\n const stat = statSync(fixturePath);\n if (stat.isDirectory()) {\n return loadFixturesFromDir(fixturePath);\n }\n return loadFixtureFile(fixturePath);\n } catch {\n return [];\n }\n}\n\nexport { LLMock } from \"./llmock.js\";\nexport type { MockServerOptions, Fixture } from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,UAAU,UAA4B,EAAE,EAAsB;CAC5E,IAAI,SAA8B;AAElC,+BAAU,YAAY;EACpB,MAAM,EAAE,UAAU,aAAa,UAAU,GAAG,eAAe;EAC3D,MAAM,MAAM,IAAIA,sBAAO,WAAW;AAElC,MAAI,aAAa;GAEf,MAAM,iBAAiB,oCADE,YAAY,CACQ;AAC7C,QAAK,MAAM,KAAK,eACd,KAAI,WAAW,EAAE;;EAIrB,MAAM,MAAM,MAAM,IAAI,OAAO;AAE7B,MAAI,aAAa,OAAO;AACtB,WAAQ,IAAI,kBAAkB,GAAG,IAAI;AACrC,WAAQ,IAAI,qBAAqB,GAAG,IAAI;;AAG1C,WAAS;GAAE;GAAK;GAAK;GACrB;AAEF,sCAAiB;AACf,MAAI,OACF,QAAO,IAAI,kBAAkB;GAE/B;AAEF,8BAAS,YAAY;AACnB,MAAI,QAAQ;AACV,OAAI,QAAQ,aAAa,OAAO;AAC9B,WAAO,QAAQ,IAAI;AACnB,WAAO,QAAQ,IAAI;;AAErB,SAAM,OAAO,IAAI,MAAM;AACvB,YAAS;;GAEX;AAEF,cAAa;AACX,MAAI,CAAC,OACH,OAAM,IAAI,MAAM,wEAAwE;AAE1F,SAAO;;;AAIX,SAAS,aAAa,aAAgC;AACpD,KAAI;AAEF,4BADsB,YAAY,CACzB,aAAa,CACpB,QAAOC,2CAAoB,YAAY;AAEzC,SAAOC,uCAAgB,YAAY;SAC7B;AACN,SAAO,EAAE"}
@@ -0,0 +1,30 @@
1
+ import { Fixture, MockServerOptions } from "./types.cjs";
2
+ import { LLMock } from "./llmock.cjs";
3
+
4
+ //#region src/vitest.d.ts
5
+
6
+ interface UseAimockOptions extends MockServerOptions {
7
+ /** Path to fixture file or directory. Loaded automatically on start. */
8
+ fixtures?: string;
9
+ /** If true, sets process.env.OPENAI_BASE_URL to the mock URL + /v1. */
10
+ patchEnv?: boolean;
11
+ }
12
+ interface AimockHandle {
13
+ /** The LLMock instance. */
14
+ readonly llm: LLMock;
15
+ /** The server URL (e.g., http://127.0.0.1:4010). */
16
+ readonly url: string;
17
+ }
18
+ /**
19
+ * Start an aimock server for the duration of the test suite.
20
+ *
21
+ * - `beforeAll`: starts the server and optionally loads fixtures
22
+ * - `beforeEach`: resets fixture match counts (not fixtures themselves)
23
+ * - `afterAll`: stops the server
24
+ *
25
+ * Returns a getter function — call it inside tests to access the handle.
26
+ */
27
+ declare function useAimock(options?: UseAimockOptions): () => AimockHandle;
28
+ //#endregion
29
+ export { AimockHandle, type Fixture, LLMock, type MockServerOptions, UseAimockOptions, useAimock };
30
+ //# sourceMappingURL=vitest.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.d.cts","names":[],"sources":["../src/vitest.ts"],"sourcesContent":[],"mappings":";;;;;UAoBiB,gBAAA,SAAyB;;;;;;UAOzB,YAAA;;gBAED;;;;;;;;;;;;;iBAcA,SAAA,WAAmB,yBAA8B"}
@@ -0,0 +1,30 @@
1
+ import { Fixture, MockServerOptions } from "./types.js";
2
+ import { LLMock } from "./llmock.js";
3
+
4
+ //#region src/vitest.d.ts
5
+
6
+ interface UseAimockOptions extends MockServerOptions {
7
+ /** Path to fixture file or directory. Loaded automatically on start. */
8
+ fixtures?: string;
9
+ /** If true, sets process.env.OPENAI_BASE_URL to the mock URL + /v1. */
10
+ patchEnv?: boolean;
11
+ }
12
+ interface AimockHandle {
13
+ /** The LLMock instance. */
14
+ readonly llm: LLMock;
15
+ /** The server URL (e.g., http://127.0.0.1:4010). */
16
+ readonly url: string;
17
+ }
18
+ /**
19
+ * Start an aimock server for the duration of the test suite.
20
+ *
21
+ * - `beforeAll`: starts the server and optionally loads fixtures
22
+ * - `beforeEach`: resets fixture match counts (not fixtures themselves)
23
+ * - `afterAll`: stops the server
24
+ *
25
+ * Returns a getter function — call it inside tests to access the handle.
26
+ */
27
+ declare function useAimock(options?: UseAimockOptions): () => AimockHandle;
28
+ //#endregion
29
+ export { AimockHandle, type Fixture, LLMock, type MockServerOptions, UseAimockOptions, useAimock };
30
+ //# sourceMappingURL=vitest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.d.ts","names":[],"sources":["../src/vitest.ts"],"sourcesContent":[],"mappings":";;;;;UAoBiB,gBAAA,SAAyB;;;;;;UAOzB,YAAA;;gBAED;;;;;;;;;;;;;iBAcA,SAAA,WAAmB,yBAA8B"}
package/dist/vitest.js ADDED
@@ -0,0 +1,77 @@
1
+ import { loadFixtureFile, loadFixturesFromDir } from "./fixture-loader.js";
2
+ import { LLMock } from "./llmock.js";
3
+ import { afterAll, beforeAll, beforeEach } from "./node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js";
4
+ import { resolve } from "node:path";
5
+ import { statSync } from "node:fs";
6
+
7
+ //#region src/vitest.ts
8
+ /**
9
+ * Vitest integration for aimock.
10
+ *
11
+ * Usage:
12
+ * import { useAimock } from "@copilotkit/aimock/vitest";
13
+ *
14
+ * const mock = useAimock({ fixtures: "./fixtures" });
15
+ *
16
+ * it("responds", async () => {
17
+ * const res = await fetch(`${mock().url}/v1/chat/completions`, { ... });
18
+ * });
19
+ */
20
+ /**
21
+ * Start an aimock server for the duration of the test suite.
22
+ *
23
+ * - `beforeAll`: starts the server and optionally loads fixtures
24
+ * - `beforeEach`: resets fixture match counts (not fixtures themselves)
25
+ * - `afterAll`: stops the server
26
+ *
27
+ * Returns a getter function — call it inside tests to access the handle.
28
+ */
29
+ function useAimock(options = {}) {
30
+ let handle = null;
31
+ beforeAll(async () => {
32
+ const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;
33
+ const llm = new LLMock(serverOpts);
34
+ if (fixturePath) {
35
+ const loadedFixtures = loadFixtures(resolve(fixturePath));
36
+ for (const f of loadedFixtures) llm.addFixture(f);
37
+ }
38
+ const url = await llm.start();
39
+ if (patchEnv !== false) {
40
+ process.env.OPENAI_BASE_URL = `${url}/v1`;
41
+ process.env.ANTHROPIC_BASE_URL = `${url}/v1`;
42
+ }
43
+ handle = {
44
+ llm,
45
+ url
46
+ };
47
+ });
48
+ beforeEach(() => {
49
+ if (handle) handle.llm.resetMatchCounts();
50
+ });
51
+ afterAll(async () => {
52
+ if (handle) {
53
+ if (options.patchEnv !== false) {
54
+ delete process.env.OPENAI_BASE_URL;
55
+ delete process.env.ANTHROPIC_BASE_URL;
56
+ }
57
+ await handle.llm.stop();
58
+ handle = null;
59
+ }
60
+ });
61
+ return () => {
62
+ if (!handle) throw new Error("useAimock(): server not started — are you calling this inside a test?");
63
+ return handle;
64
+ };
65
+ }
66
+ function loadFixtures(fixturePath) {
67
+ try {
68
+ if (statSync(fixturePath).isDirectory()) return loadFixturesFromDir(fixturePath);
69
+ return loadFixtureFile(fixturePath);
70
+ } catch {
71
+ return [];
72
+ }
73
+ }
74
+
75
+ //#endregion
76
+ export { LLMock, useAimock };
77
+ //# sourceMappingURL=vitest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.js","names":[],"sources":["../src/vitest.ts"],"sourcesContent":["/**\n * Vitest integration for aimock.\n *\n * Usage:\n * import { useAimock } from \"@copilotkit/aimock/vitest\";\n *\n * const mock = useAimock({ fixtures: \"./fixtures\" });\n *\n * it(\"responds\", async () => {\n * const res = await fetch(`${mock().url}/v1/chat/completions`, { ... });\n * });\n */\n\nimport { beforeAll, afterAll, beforeEach } from \"vitest\";\nimport { LLMock } from \"./llmock.js\";\nimport { loadFixtureFile, loadFixturesFromDir } from \"./fixture-loader.js\";\nimport type { Fixture, MockServerOptions } from \"./types.js\";\nimport { statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nexport interface UseAimockOptions extends MockServerOptions {\n /** Path to fixture file or directory. Loaded automatically on start. */\n fixtures?: string;\n /** If true, sets process.env.OPENAI_BASE_URL to the mock URL + /v1. */\n patchEnv?: boolean;\n}\n\nexport interface AimockHandle {\n /** The LLMock instance. */\n readonly llm: LLMock;\n /** The server URL (e.g., http://127.0.0.1:4010). */\n readonly url: string;\n}\n\n/**\n * Start an aimock server for the duration of the test suite.\n *\n * - `beforeAll`: starts the server and optionally loads fixtures\n * - `beforeEach`: resets fixture match counts (not fixtures themselves)\n * - `afterAll`: stops the server\n *\n * Returns a getter function — call it inside tests to access the handle.\n */\nexport function useAimock(options: UseAimockOptions = {}): () => AimockHandle {\n let handle: AimockHandle | null = null;\n\n beforeAll(async () => {\n const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;\n const llm = new LLMock(serverOpts);\n\n if (fixturePath) {\n const resolved = resolve(fixturePath);\n const loadedFixtures = loadFixtures(resolved);\n for (const f of loadedFixtures) {\n llm.addFixture(f);\n }\n }\n\n const url = await llm.start();\n\n if (patchEnv !== false) {\n process.env.OPENAI_BASE_URL = `${url}/v1`;\n process.env.ANTHROPIC_BASE_URL = `${url}/v1`;\n }\n\n handle = { llm, url };\n });\n\n beforeEach(() => {\n if (handle) {\n handle.llm.resetMatchCounts();\n }\n });\n\n afterAll(async () => {\n if (handle) {\n if (options.patchEnv !== false) {\n delete process.env.OPENAI_BASE_URL;\n delete process.env.ANTHROPIC_BASE_URL;\n }\n await handle.llm.stop();\n handle = null;\n }\n });\n\n return () => {\n if (!handle) {\n throw new Error(\"useAimock(): server not started — are you calling this inside a test?\");\n }\n return handle;\n };\n}\n\nfunction loadFixtures(fixturePath: string): Fixture[] {\n try {\n const stat = statSync(fixturePath);\n if (stat.isDirectory()) {\n return loadFixturesFromDir(fixturePath);\n }\n return loadFixtureFile(fixturePath);\n } catch {\n return [];\n }\n}\n\nexport { LLMock } from \"./llmock.js\";\nexport type { MockServerOptions, Fixture } from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,UAAU,UAA4B,EAAE,EAAsB;CAC5E,IAAI,SAA8B;AAElC,WAAU,YAAY;EACpB,MAAM,EAAE,UAAU,aAAa,UAAU,GAAG,eAAe;EAC3D,MAAM,MAAM,IAAI,OAAO,WAAW;AAElC,MAAI,aAAa;GAEf,MAAM,iBAAiB,aADN,QAAQ,YAAY,CACQ;AAC7C,QAAK,MAAM,KAAK,eACd,KAAI,WAAW,EAAE;;EAIrB,MAAM,MAAM,MAAM,IAAI,OAAO;AAE7B,MAAI,aAAa,OAAO;AACtB,WAAQ,IAAI,kBAAkB,GAAG,IAAI;AACrC,WAAQ,IAAI,qBAAqB,GAAG,IAAI;;AAG1C,WAAS;GAAE;GAAK;GAAK;GACrB;AAEF,kBAAiB;AACf,MAAI,OACF,QAAO,IAAI,kBAAkB;GAE/B;AAEF,UAAS,YAAY;AACnB,MAAI,QAAQ;AACV,OAAI,QAAQ,aAAa,OAAO;AAC9B,WAAO,QAAQ,IAAI;AACnB,WAAO,QAAQ,IAAI;;AAErB,SAAM,OAAO,IAAI,MAAM;AACvB,YAAS;;GAEX;AAEF,cAAa;AACX,MAAI,CAAC,OACH,OAAM,IAAI,MAAM,wEAAwE;AAE1F,SAAO;;;AAIX,SAAS,aAAa,aAAgC;AACpD,KAAI;AAEF,MADa,SAAS,YAAY,CACzB,aAAa,CACpB,QAAO,oBAAoB,YAAY;AAEzC,SAAO,gBAAgB,YAAY;SAC7B;AACN,SAAO,EAAE"}
@@ -0,0 +1,42 @@
1
+ {
2
+ "a2a": {
3
+ "agents": [
4
+ {
5
+ "name": "research-agent",
6
+ "description": "An agent that researches topics and returns summaries",
7
+ "version": "1.0.0",
8
+ "skills": [
9
+ {
10
+ "id": "web-research",
11
+ "name": "Web Research",
12
+ "description": "Search the web and summarize findings",
13
+ "tags": ["research", "search"]
14
+ }
15
+ ],
16
+ "capabilities": { "streaming": true },
17
+ "messages": [
18
+ {
19
+ "pattern": "research",
20
+ "parts": [{ "text": "Here is a summary of my research findings on the topic." }]
21
+ }
22
+ ],
23
+ "streamingTasks": [
24
+ {
25
+ "pattern": "deep-research",
26
+ "events": [
27
+ { "type": "status", "state": "TASK_STATE_WORKING" },
28
+ {
29
+ "type": "artifact",
30
+ "name": "research-report",
31
+ "parts": [{ "text": "## Research Report\n\nFindings from deep research..." }],
32
+ "lastChunk": true
33
+ },
34
+ { "type": "status", "state": "TASK_STATE_COMPLETED" }
35
+ ],
36
+ "delayMs": 100
37
+ }
38
+ ]
39
+ }
40
+ ]
41
+ }
42
+ }