@use-lattice/litmus 0.121.3

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 (199) hide show
  1. package/LICENSE +19 -0
  2. package/dist/src/accounts-Bt1oJb1Z.cjs +219 -0
  3. package/dist/src/accounts-DjOU8Rm3.js +178 -0
  4. package/dist/src/agentic-utils-D03IiXQc.js +153 -0
  5. package/dist/src/agentic-utils-Dh7xaMQM.cjs +180 -0
  6. package/dist/src/agents-C6BIMlZa.js +231 -0
  7. package/dist/src/agents-DvIpNX1L.cjs +666 -0
  8. package/dist/src/agents-ZP0RP9vV.cjs +231 -0
  9. package/dist/src/agents-maJXdjbR.js +665 -0
  10. package/dist/src/aimlapi-BTbQjG2E.cjs +30 -0
  11. package/dist/src/aimlapi-CwMxqfXP.js +30 -0
  12. package/dist/src/audio-BBUdvsde.cjs +97 -0
  13. package/dist/src/audio-D5DPZ7I-.js +97 -0
  14. package/dist/src/base-BEysXrkq.cjs +222 -0
  15. package/dist/src/base-C451JQfq.js +193 -0
  16. package/dist/src/blobs-BY8MDmpo.js +230 -0
  17. package/dist/src/blobs-BgcNn97m.cjs +256 -0
  18. package/dist/src/cache-BBE_lsTA.cjs +4 -0
  19. package/dist/src/cache-BkrqU5Ba.js +237 -0
  20. package/dist/src/cache-DsCxFlsZ.cjs +297 -0
  21. package/dist/src/chat-CPJWDP6a.cjs +289 -0
  22. package/dist/src/chat-CXX3xzkk.cjs +811 -0
  23. package/dist/src/chat-CcDgZFJ4.js +787 -0
  24. package/dist/src/chat-Dz5ZeGO2.js +289 -0
  25. package/dist/src/chatkit-Dw0mKkML.cjs +1158 -0
  26. package/dist/src/chatkit-swAIVuea.js +1157 -0
  27. package/dist/src/chunk-DEq-mXcV.js +15 -0
  28. package/dist/src/claude-agent-sdk-BXZJtOg6.js +379 -0
  29. package/dist/src/claude-agent-sdk-CkfyjDoG.cjs +383 -0
  30. package/dist/src/cloudflare-ai-BzpJcqUH.js +161 -0
  31. package/dist/src/cloudflare-ai-Cmy_R1y2.cjs +161 -0
  32. package/dist/src/cloudflare-gateway-B9tVQKok.cjs +272 -0
  33. package/dist/src/cloudflare-gateway-DrD3ew3H.js +272 -0
  34. package/dist/src/codex-sdk-Dezj9Nwm.js +1056 -0
  35. package/dist/src/codex-sdk-Dl9D4k5B.cjs +1060 -0
  36. package/dist/src/cometapi-C-9YvCHC.js +54 -0
  37. package/dist/src/cometapi-DHgDKoO2.cjs +54 -0
  38. package/dist/src/completion-B8Ctyxpr.js +120 -0
  39. package/dist/src/completion-Cxrt08sj.cjs +131 -0
  40. package/dist/src/createHash-BwgE13yv.cjs +27 -0
  41. package/dist/src/createHash-DmPQkvBh.js +15 -0
  42. package/dist/src/docker-BiqcTwLv.js +80 -0
  43. package/dist/src/docker-C7tEJnP-.cjs +80 -0
  44. package/dist/src/esm-C62Zofr1.cjs +409 -0
  45. package/dist/src/esm-DMVc93eh.js +379 -0
  46. package/dist/src/evalResult-C3NJPQOo.cjs +301 -0
  47. package/dist/src/evalResult-C7JJAPBb.js +295 -0
  48. package/dist/src/evalResult-DoVTZZWI.cjs +2 -0
  49. package/dist/src/extractor-DnMD3fwt.cjs +391 -0
  50. package/dist/src/extractor-DtlL28vL.js +374 -0
  51. package/dist/src/fetch-BTxakTSg.cjs +1133 -0
  52. package/dist/src/fetch-DQckpUFz.js +928 -0
  53. package/dist/src/fileExtensions-DnqA1y9x.js +85 -0
  54. package/dist/src/fileExtensions-bYh77CN8.cjs +114 -0
  55. package/dist/src/genaiTracer-CyZrmaK0.cjs +268 -0
  56. package/dist/src/genaiTracer-D3fD9dNV.js +256 -0
  57. package/dist/src/graders-BNscxFrU.js +13644 -0
  58. package/dist/src/graders-D2oE9Msq.js +2 -0
  59. package/dist/src/graders-c0Ez_w-9.cjs +2 -0
  60. package/dist/src/graders-d0F2M3e9.cjs +14056 -0
  61. package/dist/src/image-0ZhE0VlR.cjs +280 -0
  62. package/dist/src/image-CWE1pdNv.js +257 -0
  63. package/dist/src/image-D9ZK6hwL.js +163 -0
  64. package/dist/src/image-DKZgZITg.cjs +163 -0
  65. package/dist/src/index.cjs +11366 -0
  66. package/dist/src/index.d.cts +19640 -0
  67. package/dist/src/index.d.ts +19641 -0
  68. package/dist/src/index.js +11306 -0
  69. package/dist/src/invariant-Ddh24eXh.js +25 -0
  70. package/dist/src/invariant-kfQ8Bu82.cjs +30 -0
  71. package/dist/src/knowledgeBase-BgPyGFUd.cjs +122 -0
  72. package/dist/src/knowledgeBase-DyHilYaP.js +122 -0
  73. package/dist/src/litellm-CyMeneHS.js +135 -0
  74. package/dist/src/litellm-DWDF73yF.cjs +135 -0
  75. package/dist/src/logger-C40ZGil9.js +717 -0
  76. package/dist/src/logger-DyfK9PBt.cjs +917 -0
  77. package/dist/src/luma-ray-BAU9X_ep.cjs +315 -0
  78. package/dist/src/luma-ray-nwVseBbv.js +313 -0
  79. package/dist/src/messages-B5ADWTTv.js +245 -0
  80. package/dist/src/messages-BCnZfqrS.cjs +257 -0
  81. package/dist/src/meteor-DLZZ3osF.cjs +134 -0
  82. package/dist/src/meteor-DUiCJRC-.js +134 -0
  83. package/dist/src/modelslab-00cveB8L.cjs +163 -0
  84. package/dist/src/modelslab-D9sCU_L7.js +163 -0
  85. package/dist/src/nova-reel-CTapvqYH.js +276 -0
  86. package/dist/src/nova-reel-DlWuuroF.cjs +278 -0
  87. package/dist/src/nova-sonic-5UPWfeMv.cjs +363 -0
  88. package/dist/src/nova-sonic-BhSwQNym.js +363 -0
  89. package/dist/src/openai-BWrJK9d8.cjs +52 -0
  90. package/dist/src/openai-DumO8WQn.js +47 -0
  91. package/dist/src/openclaw-B8brrjC_.cjs +577 -0
  92. package/dist/src/openclaw-Bkayww9q.js +571 -0
  93. package/dist/src/opencode-sdk-7xjoDNiM.cjs +562 -0
  94. package/dist/src/opencode-sdk-SGwAPxht.js +558 -0
  95. package/dist/src/otlpReceiver-CoAHfAN9.cjs +15 -0
  96. package/dist/src/otlpReceiver-oO3EQwI9.js +14 -0
  97. package/dist/src/providerRegistry-4yjhaEM8.js +45 -0
  98. package/dist/src/providerRegistry-DhV4rJIc.cjs +50 -0
  99. package/dist/src/providers-B5RJVG-7.cjs +33609 -0
  100. package/dist/src/providers-BdmZCLzV.js +33262 -0
  101. package/dist/src/providers-CxtRxn8e.js +2 -0
  102. package/dist/src/providers-DnQLNbx1.cjs +3 -0
  103. package/dist/src/pythonUtils-BD0druiM.cjs +275 -0
  104. package/dist/src/pythonUtils-IBhn5YGR.js +249 -0
  105. package/dist/src/quiverai-BDOwZBsM.cjs +213 -0
  106. package/dist/src/quiverai-D3JTF5lD.js +213 -0
  107. package/dist/src/responses-B2LCDCXZ.js +667 -0
  108. package/dist/src/responses-BvNm4Xv9.cjs +685 -0
  109. package/dist/src/rubyUtils-B0NwnfpY.cjs +245 -0
  110. package/dist/src/rubyUtils-BroxzZ7c.cjs +2 -0
  111. package/dist/src/rubyUtils-hqVw5UvJ.js +222 -0
  112. package/dist/src/sagemaker-Cno2V-Sx.js +689 -0
  113. package/dist/src/sagemaker-fV_KUgs5.cjs +691 -0
  114. package/dist/src/server-BOuAXb06.cjs +238 -0
  115. package/dist/src/server-CtI-EWzm.cjs +2 -0
  116. package/dist/src/server-Cy3DZymt.js +189 -0
  117. package/dist/src/slack-CP8xBePa.js +135 -0
  118. package/dist/src/slack-DSQ1yXVb.cjs +135 -0
  119. package/dist/src/store-BwDDaBjb.cjs +246 -0
  120. package/dist/src/store-DcbLC593.cjs +2 -0
  121. package/dist/src/store-IGpqMIkv.js +240 -0
  122. package/dist/src/tables-3Q2cL7So.cjs +373 -0
  123. package/dist/src/tables-Bi2fjr4W.js +288 -0
  124. package/dist/src/telemetry-Bg2WqF79.js +161 -0
  125. package/dist/src/telemetry-D0x6u5kX.cjs +166 -0
  126. package/dist/src/telemetry-DXNimrI0.cjs +2 -0
  127. package/dist/src/text-B_UCRPp2.js +22 -0
  128. package/dist/src/text-CW1cyrwj.cjs +33 -0
  129. package/dist/src/tokenUsageUtils-NYT-WKS6.js +138 -0
  130. package/dist/src/tokenUsageUtils-bVa1ga6f.cjs +173 -0
  131. package/dist/src/transcription-Cl_W16Pr.js +122 -0
  132. package/dist/src/transcription-yt1EecY8.cjs +124 -0
  133. package/dist/src/transform-BCtGrl_W.cjs +228 -0
  134. package/dist/src/transform-Bv6gG2MJ.cjs +1688 -0
  135. package/dist/src/transform-CY1wbpRy.js +1507 -0
  136. package/dist/src/transform-DU8rUL9P.cjs +2 -0
  137. package/dist/src/transform-yWaShiKr.js +216 -0
  138. package/dist/src/transformersAvailability-BGkzavwb.js +35 -0
  139. package/dist/src/transformersAvailability-DKoRtQLy.cjs +35 -0
  140. package/dist/src/types-5aqHpBwE.cjs +3769 -0
  141. package/dist/src/types-Bn6D9c4U.js +3300 -0
  142. package/dist/src/util-BkKlTkI2.js +293 -0
  143. package/dist/src/util-CTh0bfOm.cjs +1119 -0
  144. package/dist/src/util-D17oBwo7.cjs +328 -0
  145. package/dist/src/util-DsS_-v4p.js +613 -0
  146. package/dist/src/util-DuntT1Ga.js +951 -0
  147. package/dist/src/util-aWjdCYMI.cjs +667 -0
  148. package/dist/src/utils-CisQwpjA.js +94 -0
  149. package/dist/src/utils-yWamDvmz.cjs +123 -0
  150. package/dist/tsconfig.tsbuildinfo +1 -0
  151. package/drizzle/0000_lush_hellion.sql +36 -0
  152. package/drizzle/0001_wide_calypso.sql +3 -0
  153. package/drizzle/0002_tidy_juggernaut.sql +1 -0
  154. package/drizzle/0003_lively_naoko.sql +8 -0
  155. package/drizzle/0004_minor_peter_quill.sql +19 -0
  156. package/drizzle/0005_silky_millenium_guard.sql +2 -0
  157. package/drizzle/0006_harsh_caretaker.sql +42 -0
  158. package/drizzle/0007_cloudy_wong.sql +1 -0
  159. package/drizzle/0008_broad_boomer.sql +2 -0
  160. package/drizzle/0009_strong_marten_broadcloak.sql +19 -0
  161. package/drizzle/0010_needy_bishop.sql +11 -0
  162. package/drizzle/0011_moaning_millenium_guard.sql +1 -0
  163. package/drizzle/0012_late_marten_broadcloak.sql +2 -0
  164. package/drizzle/0013_previous_dormammu.sql +9 -0
  165. package/drizzle/0014_lazy_captain_universe.sql +2 -0
  166. package/drizzle/0015_zippy_wallop.sql +29 -0
  167. package/drizzle/0016_jazzy_zemo.sql +2 -0
  168. package/drizzle/0017_reflective_praxagora.sql +4 -0
  169. package/drizzle/0018_fat_vanisher.sql +22 -0
  170. package/drizzle/0019_new_clint_barton.sql +8 -0
  171. package/drizzle/0020_skinny_maverick.sql +1 -0
  172. package/drizzle/0021_mysterious_madelyne_pryor.sql +13 -0
  173. package/drizzle/0022_sleepy_ultimo.sql +25 -0
  174. package/drizzle/0023_wooden_mandrill.sql +2 -0
  175. package/drizzle/AGENTS.md +68 -0
  176. package/drizzle/CLAUDE.md +1 -0
  177. package/drizzle/meta/0000_snapshot.json +221 -0
  178. package/drizzle/meta/0001_snapshot.json +214 -0
  179. package/drizzle/meta/0002_snapshot.json +221 -0
  180. package/drizzle/meta/0005_snapshot.json +369 -0
  181. package/drizzle/meta/0006_snapshot.json +638 -0
  182. package/drizzle/meta/0007_snapshot.json +640 -0
  183. package/drizzle/meta/0008_snapshot.json +649 -0
  184. package/drizzle/meta/0009_snapshot.json +554 -0
  185. package/drizzle/meta/0010_snapshot.json +619 -0
  186. package/drizzle/meta/0011_snapshot.json +627 -0
  187. package/drizzle/meta/0012_snapshot.json +639 -0
  188. package/drizzle/meta/0013_snapshot.json +717 -0
  189. package/drizzle/meta/0014_snapshot.json +717 -0
  190. package/drizzle/meta/0015_snapshot.json +897 -0
  191. package/drizzle/meta/0016_snapshot.json +1031 -0
  192. package/drizzle/meta/0018_snapshot.json +1210 -0
  193. package/drizzle/meta/0019_snapshot.json +1165 -0
  194. package/drizzle/meta/0020_snapshot.json +1232 -0
  195. package/drizzle/meta/0021_snapshot.json +1311 -0
  196. package/drizzle/meta/0022_snapshot.json +1481 -0
  197. package/drizzle/meta/0023_snapshot.json +1496 -0
  198. package/drizzle/meta/_journal.json +174 -0
  199. package/package.json +240 -0
@@ -0,0 +1,2 @@
1
+ const require_transform = require("./transform-BCtGrl_W.cjs");
2
+ exports.TransformInputType = require_transform.TransformInputType;
@@ -0,0 +1,216 @@
1
+ import { n as __require, t as __exportAll } from "./chunk-DEq-mXcV.js";
2
+ import { T as state, r as logger } from "./logger-C40ZGil9.js";
3
+ import { a as safeJoin, r as importModule } from "./esm-DMVc93eh.js";
4
+ import { r as runPython } from "./pythonUtils-IBhn5YGR.js";
5
+ import { i as isJavascriptFile } from "./fileExtensions-DnqA1y9x.js";
6
+ //#region src/util/processShim.ts
7
+ /**
8
+ * Browser-safe process shim module.
9
+ *
10
+ * This module provides a shimmed process object that works in both Node.js and browser
11
+ * environments. In Node.js, it provides full functionality including process.mainModule.require.
12
+ * In browsers, it returns a minimal shim that throws helpful errors when Node.js-specific
13
+ * features are accessed.
14
+ *
15
+ * This separation is necessary because:
16
+ * 1. The promptfoo webui imports httpTransforms.ts which needs getProcessShim()
17
+ * 2. httpTransforms.ts is designed to be frontend-importable for testing transforms in the UI
18
+ * 3. The Node.js implementation uses createRequire from 'node:module' which doesn't exist in browsers
19
+ *
20
+ * By using runtime environment detection and dynamic imports, we can:
21
+ * - Avoid top-level imports of Node.js-only modules that would break browser bundling
22
+ * - Provide appropriate functionality for each environment
23
+ */
24
+ /**
25
+ * Detects if the current environment is a browser or web worker.
26
+ * Handles test environments (jsdom/happy-dom) that define window in Node.js.
27
+ */
28
+ function isBrowserEnvironment() {
29
+ if (typeof process !== "undefined" && typeof process.versions?.node === "string") return false;
30
+ return typeof window !== "undefined" || typeof self !== "undefined" && typeof self.importScripts === "function";
31
+ }
32
+ /**
33
+ * Creates a minimal process shim for browser environments.
34
+ * This shim provides helpful error messages when Node.js-specific features are accessed.
35
+ */
36
+ function createBrowserProcessShim() {
37
+ return {
38
+ env: {},
39
+ mainModule: {
40
+ require: () => {
41
+ throw new Error("require() is not available in browser transforms. Use standard JavaScript instead.");
42
+ },
43
+ exports: {},
44
+ id: ".",
45
+ filename: "",
46
+ loaded: true,
47
+ children: [],
48
+ paths: []
49
+ }
50
+ };
51
+ }
52
+ let cachedNodeProcessShim = null;
53
+ /**
54
+ * Returns a shimmed process object that works in both Node.js and browser environments.
55
+ *
56
+ * In Node.js:
57
+ * - Returns a proxy with process.mainModule.require shimmed for ESM compatibility
58
+ * - Allows inline transforms to use require() even in ESM context
59
+ *
60
+ * In browsers:
61
+ * - Returns a minimal shim with helpful error messages
62
+ * - Allows simple transforms that don't use require() to work
63
+ *
64
+ * @example
65
+ * // In Node.js - can use require
66
+ * const fn = new Function('data', 'process', `return process.mainModule.require('fs')`);
67
+ * fn(data, getProcessShim());
68
+ *
69
+ * @example
70
+ * // In browser - simple transforms work
71
+ * const fn = new Function('data', 'process', `return data.toUpperCase()`);
72
+ * fn(data, getProcessShim());
73
+ */
74
+ function getProcessShim() {
75
+ if (isBrowserEnvironment()) return createBrowserProcessShim();
76
+ if (!cachedNodeProcessShim) try {
77
+ const esmRequire = __require("node:module").createRequire(import.meta.url);
78
+ cachedNodeProcessShim = new Proxy(process, { get(target, prop) {
79
+ if (prop === "mainModule") return {
80
+ require: esmRequire,
81
+ exports: {},
82
+ id: ".",
83
+ filename: "",
84
+ loaded: true,
85
+ children: [],
86
+ paths: []
87
+ };
88
+ return Reflect.get(target, prop);
89
+ } });
90
+ } catch {
91
+ return createBrowserProcessShim();
92
+ }
93
+ return cachedNodeProcessShim;
94
+ }
95
+ //#endregion
96
+ //#region src/util/transform.ts
97
+ var transform_exports = /* @__PURE__ */ __exportAll({
98
+ TransformInputType: () => TransformInputType,
99
+ transform: () => transform
100
+ });
101
+ const TransformInputType = {
102
+ OUTPUT: "output",
103
+ VARS: "vars"
104
+ };
105
+ /**
106
+ * Parses a file path string to extract the file path and function name.
107
+ * Handles Windows drive letters (e.g., C:\path\to\file.js:functionName).
108
+ * @param filePath - The file path string, potentially including a function name.
109
+ * @returns A tuple containing the file path and function name (if present).
110
+ */
111
+ function parseFilePathAndFunctionName(filePath) {
112
+ const lastColonIndex = filePath.lastIndexOf(":");
113
+ if (lastColonIndex > 1) return [filePath.slice(0, lastColonIndex), filePath.slice(lastColonIndex + 1)];
114
+ return [filePath, void 0];
115
+ }
116
+ /**
117
+ * Retrieves a JavaScript transform function from a file.
118
+ * @param filePath - The path to the JavaScript file.
119
+ * @param functionName - Optional name of the function to retrieve.
120
+ * @returns A Promise resolving to the requested function.
121
+ * @throws Error if the file doesn't export a valid function.
122
+ */
123
+ async function getJavascriptTransformFunction(filePath, functionName) {
124
+ const requiredModule = await importModule(filePath);
125
+ if (functionName && Object.prototype.hasOwnProperty.call(requiredModule, functionName) && typeof requiredModule[functionName] === "function") return requiredModule[functionName];
126
+ else if (typeof requiredModule === "function") return requiredModule;
127
+ else if (requiredModule.default && typeof requiredModule.default === "function") return requiredModule.default;
128
+ throw new Error(`Transform ${filePath} must export a function, have a default export as a function, or export the specified function "${functionName}"`);
129
+ }
130
+ /**
131
+ * Creates a function that runs a Python transform function.
132
+ * @param filePath - The path to the Python file.
133
+ * @param functionName - The name of the function to run (defaults to 'get_transform').
134
+ * @returns A function that executes the Python transform.
135
+ */
136
+ function getPythonTransformFunction(filePath, functionName = "get_transform") {
137
+ return async (output, context) => {
138
+ return runPython(filePath, functionName, [output, context]);
139
+ };
140
+ }
141
+ /**
142
+ * Retrieves a transform function from a file, supporting both JavaScript and Python.
143
+ * @param filePath - The path to the file, including the 'file://' prefix.
144
+ * @returns A Promise resolving to the requested function.
145
+ * @throws Error if the file format is unsupported.
146
+ */
147
+ async function getFileTransformFunction(filePath) {
148
+ const [actualFilePath, functionName] = parseFilePathAndFunctionName(filePath.slice(7));
149
+ const fullPath = safeJoin(state.basePath || "", actualFilePath);
150
+ if (isJavascriptFile(fullPath)) return getJavascriptTransformFunction(fullPath, functionName);
151
+ else if (fullPath.endsWith(".py")) return getPythonTransformFunction(fullPath, functionName);
152
+ throw new Error(`Unsupported transform file format: file://${actualFilePath}`);
153
+ }
154
+ /**
155
+ * Creates a function from inline JavaScript code.
156
+ * @param code - The JavaScript code to convert into a function.
157
+ * @returns A Function created from the provided code.
158
+ *
159
+ * The function receives three parameters:
160
+ * - The input (output or vars depending on inputType)
161
+ * - A context object
162
+ * - A process object with mainModule.require shimmed for backwards compatibility
163
+ *
164
+ * To use require in inline transforms, use: process.mainModule.require('module-name')
165
+ * Or assign it to a variable: const require = process.mainModule.require;
166
+ */
167
+ function getInlineTransformFunction(code, inputType) {
168
+ return new Function(inputType, "context", "process", code.includes("\n") ? code : `return ${code}`);
169
+ }
170
+ /**
171
+ * Determines and retrieves the appropriate transform function based on the input.
172
+ * @param codeOrFilepath - Either inline code or a file path starting with 'file://'.
173
+ * @returns A Promise resolving to the appropriate transform function.
174
+ */
175
+ async function getTransformFunction(codeOrFilepath, inputType) {
176
+ let transformFn = null;
177
+ if (codeOrFilepath.startsWith("file://")) try {
178
+ transformFn = await getFileTransformFunction(codeOrFilepath);
179
+ } catch (error) {
180
+ logger.error(`Error loading transform function from file: ${error instanceof Error ? error.message : String(error)}`);
181
+ throw error;
182
+ }
183
+ else try {
184
+ transformFn = getInlineTransformFunction(codeOrFilepath, inputType);
185
+ } catch (error) {
186
+ logger.error(`Error creating inline transform function: ${error instanceof Error ? error.message : String(error)}`);
187
+ throw error;
188
+ }
189
+ return transformFn;
190
+ }
191
+ /**
192
+ * Transforms the output using a specified function or file.
193
+ *
194
+ * @param codeOrFilepath - The transformation function code or file path.
195
+ * If it starts with 'file://', it's treated as a file path. The file path can
196
+ * optionally include a function name (e.g., 'file://transform.js:myFunction').
197
+ * If no function name is provided for Python files, it defaults to 'get_transform'.
198
+ * For inline code, it's treated as JavaScript.
199
+ * @param transformInput - The output to be transformed. Can be a string or an object.
200
+ * @param context - A context object that will be passed to the transform function.
201
+ * @param validateReturn - Optional. If true, throws an error if the transform function doesn't return a value.
202
+ * @returns A promise that resolves to the transformed output.
203
+ * @throws Error if the file format is unsupported or if the transform function
204
+ * doesn't return a value (unless validateReturn is false).
205
+ */
206
+ async function transform(codeOrFilepath, transformInput, context, validateReturn = true, inputType = TransformInputType.OUTPUT) {
207
+ const postprocessFn = await getTransformFunction(codeOrFilepath, inputType);
208
+ if (!postprocessFn) throw new Error(`Invalid transform function for ${codeOrFilepath}`);
209
+ const ret = await Promise.resolve(postprocessFn(transformInput, context, getProcessShim()));
210
+ if (validateReturn && (ret === null || ret === void 0)) throw new Error(`Transform function did not return a value\n\n${codeOrFilepath}`);
211
+ return ret;
212
+ }
213
+ //#endregion
214
+ export { getProcessShim as i, transform as n, transform_exports as r, TransformInputType as t };
215
+
216
+ //# sourceMappingURL=transform-yWaShiKr.js.map
@@ -0,0 +1,35 @@
1
+ //#region src/providers/transformersAvailability.ts
2
+ /**
3
+ * Utility for checking @huggingface/transformers availability.
4
+ *
5
+ * This module provides lazy checking of the optional @huggingface/transformers dependency
6
+ * with caching to avoid repeated import attempts.
7
+ */
8
+ let transformersAvailableCache = null;
9
+ /**
10
+ * Checks if the @huggingface/transformers library is available.
11
+ * Result is cached after first call for efficiency.
12
+ */
13
+ async function isTransformersAvailable() {
14
+ if (transformersAvailableCache !== null) return transformersAvailableCache;
15
+ try {
16
+ await import("@huggingface/transformers");
17
+ transformersAvailableCache = true;
18
+ } catch {
19
+ transformersAvailableCache = false;
20
+ }
21
+ return transformersAvailableCache;
22
+ }
23
+ /**
24
+ * Validates that the @huggingface/transformers library is installed.
25
+ * Throws an error with installation instructions if not available.
26
+ *
27
+ * Call this early (before pipeline creation) to fail fast with a helpful message.
28
+ */
29
+ async function validateTransformersDependency(checkTransformers = isTransformersAvailable) {
30
+ if (!await checkTransformers()) throw new Error("@huggingface/transformers is required for local embedding and text generation providers.\nInstall it with: npm install @huggingface/transformers");
31
+ }
32
+ //#endregion
33
+ export { validateTransformersDependency };
34
+
35
+ //# sourceMappingURL=transformersAvailability-BGkzavwb.js.map
@@ -0,0 +1,35 @@
1
+ //#region src/providers/transformersAvailability.ts
2
+ /**
3
+ * Utility for checking @huggingface/transformers availability.
4
+ *
5
+ * This module provides lazy checking of the optional @huggingface/transformers dependency
6
+ * with caching to avoid repeated import attempts.
7
+ */
8
+ let transformersAvailableCache = null;
9
+ /**
10
+ * Checks if the @huggingface/transformers library is available.
11
+ * Result is cached after first call for efficiency.
12
+ */
13
+ async function isTransformersAvailable() {
14
+ if (transformersAvailableCache !== null) return transformersAvailableCache;
15
+ try {
16
+ await import("@huggingface/transformers");
17
+ transformersAvailableCache = true;
18
+ } catch {
19
+ transformersAvailableCache = false;
20
+ }
21
+ return transformersAvailableCache;
22
+ }
23
+ /**
24
+ * Validates that the @huggingface/transformers library is installed.
25
+ * Throws an error with installation instructions if not available.
26
+ *
27
+ * Call this early (before pipeline creation) to fail fast with a helpful message.
28
+ */
29
+ async function validateTransformersDependency(checkTransformers = isTransformersAvailable) {
30
+ if (!await checkTransformers()) throw new Error("@huggingface/transformers is required for local embedding and text generation providers.\nInstall it with: npm install @huggingface/transformers");
31
+ }
32
+ //#endregion
33
+ exports.validateTransformersDependency = validateTransformersDependency;
34
+
35
+ //# sourceMappingURL=transformersAvailability-DKoRtQLy.cjs.map