orchajs 0.17.0 → 0.19.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 (281) hide show
  1. package/README.md +70 -9
  2. package/dist/amarsia/metadata.d.ts +0 -1
  3. package/dist/amarsia/metadata.js +0 -1
  4. package/dist/amarsia/sync.d.ts +0 -1
  5. package/dist/amarsia/sync.js +0 -1
  6. package/dist/cli-agents-template.d.ts +0 -1
  7. package/dist/cli-agents-template.js +0 -1
  8. package/dist/cli.d.ts +0 -1
  9. package/dist/cli.js +4 -5
  10. package/dist/compiler/build-project.d.ts +0 -1
  11. package/dist/compiler/build-project.js +2 -3
  12. package/dist/compiler/compile.d.ts +0 -1
  13. package/dist/compiler/compile.js +0 -1
  14. package/dist/env.d.ts +0 -1
  15. package/dist/env.js +5 -3
  16. package/dist/errors.d.ts +0 -1
  17. package/dist/errors.js +0 -1
  18. package/dist/file-content.d.ts +0 -1
  19. package/dist/file-content.js +0 -1
  20. package/dist/index.d.ts +0 -1
  21. package/dist/index.js +0 -1
  22. package/dist/integrations/esbuild.d.ts +0 -1
  23. package/dist/integrations/esbuild.js +0 -1
  24. package/dist/orcha.d.ts +0 -1
  25. package/dist/orcha.js +0 -1
  26. package/dist/playground/public/app.css +0 -1
  27. package/dist/playground/public/app.js +9 -10
  28. package/dist/playground/server.d.ts +0 -1
  29. package/dist/playground/server.js +9 -5
  30. package/dist/playground/source.d.ts +0 -1
  31. package/dist/playground/source.js +0 -1
  32. package/dist/project-loader.d.ts +0 -1
  33. package/dist/project-loader.js +1 -2
  34. package/dist/providers/anthropic.d.ts +0 -1
  35. package/dist/providers/anthropic.js +0 -1
  36. package/dist/providers/bedrock.d.ts +0 -1
  37. package/dist/providers/bedrock.js +0 -1
  38. package/dist/providers/catalog.d.ts +0 -1
  39. package/dist/providers/catalog.js +0 -1
  40. package/dist/providers/deepseek.d.ts +0 -1
  41. package/dist/providers/deepseek.js +0 -1
  42. package/dist/providers/dispatcher.d.ts +0 -1
  43. package/dist/providers/dispatcher.js +0 -1
  44. package/dist/providers/google-gemini.d.ts +67 -5
  45. package/dist/providers/google-gemini.js +13 -3
  46. package/dist/providers/google-genai.d.ts +0 -1
  47. package/dist/providers/google-genai.js +2 -3
  48. package/dist/providers/index.d.ts +0 -1
  49. package/dist/providers/index.js +27 -2
  50. package/dist/providers/openai.d.ts +0 -1
  51. package/dist/providers/openai.js +0 -1
  52. package/dist/providers/sse.d.ts +0 -1
  53. package/dist/providers/sse.js +0 -1
  54. package/dist/providers/types.d.ts +0 -1
  55. package/dist/providers/types.js +0 -1
  56. package/dist/providers/vertex-ai.d.ts +0 -1
  57. package/dist/providers/vertex-ai.js +2 -3
  58. package/dist/runtime/actions/context.d.ts +0 -1
  59. package/dist/runtime/actions/context.js +25 -2
  60. package/dist/runtime/actions/execute.d.ts +0 -1
  61. package/dist/runtime/actions/execute.js +14 -2
  62. package/dist/runtime/actions/native.d.ts +0 -1
  63. package/dist/runtime/actions/native.js +0 -1
  64. package/dist/runtime/actions/sandbox.d.ts +0 -1
  65. package/dist/runtime/actions/sandbox.js +0 -1
  66. package/dist/runtime/agent.d.ts +0 -1
  67. package/dist/runtime/agent.js +0 -1
  68. package/dist/runtime/context.d.ts +0 -1
  69. package/dist/runtime/context.js +0 -1
  70. package/dist/runtime/create-orcha.d.ts +0 -1
  71. package/dist/runtime/create-orcha.js +0 -1
  72. package/dist/runtime/execution.d.ts +0 -1
  73. package/dist/runtime/execution.js +0 -1
  74. package/dist/runtime/session-events.d.ts +0 -1
  75. package/dist/runtime/session-events.js +0 -1
  76. package/dist/runtime/structured-output.d.ts +0 -1
  77. package/dist/runtime/structured-output.js +0 -1
  78. package/dist/storage/browser-indexeddb.d.ts +0 -1
  79. package/dist/storage/browser-indexeddb.js +0 -1
  80. package/dist/storage/create-store.d.ts +0 -1
  81. package/dist/storage/create-store.js +0 -1
  82. package/dist/storage/edge-store.d.ts +0 -1
  83. package/dist/storage/edge-store.js +0 -1
  84. package/dist/storage/migrate.d.ts +0 -1
  85. package/dist/storage/migrate.js +0 -1
  86. package/dist/storage/node-jsonl.d.ts +0 -1
  87. package/dist/storage/node-jsonl.js +0 -1
  88. package/dist/storage/node-sqlite.d.ts +0 -1
  89. package/dist/storage/node-sqlite.js +1 -2
  90. package/dist/storage/react-native-jsonl.d.ts +0 -1
  91. package/dist/storage/react-native-jsonl.js +0 -1
  92. package/dist/testing.d.ts +0 -1
  93. package/dist/testing.js +0 -1
  94. package/dist/types.d.ts +0 -1
  95. package/dist/types.js +0 -1
  96. package/dist-cjs/amarsia/metadata.js +18 -19
  97. package/dist-cjs/amarsia/sync.js +1 -2
  98. package/dist-cjs/cli-agents-template.js +1 -2
  99. package/dist-cjs/compiler/build-project.js +24 -25
  100. package/dist-cjs/compiler/compile.js +31 -32
  101. package/dist-cjs/env.js +10 -8
  102. package/dist-cjs/errors.js +1 -2
  103. package/dist-cjs/file-content.js +6 -7
  104. package/dist-cjs/index.js +1 -2
  105. package/dist-cjs/integrations/esbuild.js +4 -5
  106. package/dist-cjs/orcha.js +4 -5
  107. package/dist-cjs/playground/server.js +34 -31
  108. package/dist-cjs/playground/source.js +11 -12
  109. package/dist-cjs/project-loader.js +11 -12
  110. package/dist-cjs/providers/anthropic.js +1 -2
  111. package/dist-cjs/providers/bedrock.js +8 -9
  112. package/dist-cjs/providers/catalog.js +1 -2
  113. package/dist-cjs/providers/deepseek.js +1 -2
  114. package/dist-cjs/providers/dispatcher.js +1 -2
  115. package/dist-cjs/providers/google-gemini.js +13 -4
  116. package/dist-cjs/providers/google-genai.js +2 -3
  117. package/dist-cjs/providers/index.js +25 -2
  118. package/dist-cjs/providers/openai.js +1 -2
  119. package/dist-cjs/providers/sse.js +1 -2
  120. package/dist-cjs/providers/types.js +1 -2
  121. package/dist-cjs/providers/vertex-ai.js +6 -3
  122. package/dist-cjs/runtime/actions/context.js +26 -3
  123. package/dist-cjs/runtime/actions/execute.js +17 -3
  124. package/dist-cjs/runtime/actions/native.js +3 -4
  125. package/dist-cjs/runtime/actions/sandbox.js +1 -2
  126. package/dist-cjs/runtime/agent.js +3 -4
  127. package/dist-cjs/runtime/context.js +1 -2
  128. package/dist-cjs/runtime/create-orcha.js +3 -4
  129. package/dist-cjs/runtime/execution.js +1 -2
  130. package/dist-cjs/runtime/session-events.js +1 -2
  131. package/dist-cjs/runtime/structured-output.js +1 -2
  132. package/dist-cjs/storage/browser-indexeddb.js +1 -2
  133. package/dist-cjs/storage/create-store.js +1 -2
  134. package/dist-cjs/storage/edge-store.js +1 -2
  135. package/dist-cjs/storage/migrate.js +1 -2
  136. package/dist-cjs/storage/node-jsonl.js +10 -11
  137. package/dist-cjs/storage/node-sqlite.js +8 -9
  138. package/dist-cjs/storage/react-native-jsonl.js +1 -2
  139. package/dist-cjs/testing.js +17 -18
  140. package/dist-cjs/types/google-genai-sdk.d.js +2 -0
  141. package/dist-cjs/types.js +1 -2
  142. package/package.json +40 -12
  143. package/dist/amarsia/metadata.d.ts.map +0 -1
  144. package/dist/amarsia/metadata.js.map +0 -1
  145. package/dist/amarsia/sync.d.ts.map +0 -1
  146. package/dist/amarsia/sync.js.map +0 -1
  147. package/dist/cli-agents-template.d.ts.map +0 -1
  148. package/dist/cli-agents-template.js.map +0 -1
  149. package/dist/cli.d.ts.map +0 -1
  150. package/dist/cli.js.map +0 -1
  151. package/dist/compiler/build-project.d.ts.map +0 -1
  152. package/dist/compiler/build-project.js.map +0 -1
  153. package/dist/compiler/compile.d.ts.map +0 -1
  154. package/dist/compiler/compile.js.map +0 -1
  155. package/dist/env.d.ts.map +0 -1
  156. package/dist/env.js.map +0 -1
  157. package/dist/errors.d.ts.map +0 -1
  158. package/dist/errors.js.map +0 -1
  159. package/dist/file-content.d.ts.map +0 -1
  160. package/dist/file-content.js.map +0 -1
  161. package/dist/index.d.ts.map +0 -1
  162. package/dist/index.js.map +0 -1
  163. package/dist/integrations/esbuild.d.ts.map +0 -1
  164. package/dist/integrations/esbuild.js.map +0 -1
  165. package/dist/orcha.d.ts.map +0 -1
  166. package/dist/orcha.js.map +0 -1
  167. package/dist/playground/public/app.css.map +0 -7
  168. package/dist/playground/public/app.js.map +0 -7
  169. package/dist/playground/server.d.ts.map +0 -1
  170. package/dist/playground/server.js.map +0 -1
  171. package/dist/playground/source.d.ts.map +0 -1
  172. package/dist/playground/source.js.map +0 -1
  173. package/dist/project-loader.d.ts.map +0 -1
  174. package/dist/project-loader.js.map +0 -1
  175. package/dist/providers/anthropic.d.ts.map +0 -1
  176. package/dist/providers/anthropic.js.map +0 -1
  177. package/dist/providers/bedrock.d.ts.map +0 -1
  178. package/dist/providers/bedrock.js.map +0 -1
  179. package/dist/providers/catalog.d.ts.map +0 -1
  180. package/dist/providers/catalog.js.map +0 -1
  181. package/dist/providers/deepseek.d.ts.map +0 -1
  182. package/dist/providers/deepseek.js.map +0 -1
  183. package/dist/providers/dispatcher.d.ts.map +0 -1
  184. package/dist/providers/dispatcher.js.map +0 -1
  185. package/dist/providers/google-gemini.d.ts.map +0 -1
  186. package/dist/providers/google-gemini.js.map +0 -1
  187. package/dist/providers/google-genai.d.ts.map +0 -1
  188. package/dist/providers/google-genai.js.map +0 -1
  189. package/dist/providers/index.d.ts.map +0 -1
  190. package/dist/providers/index.js.map +0 -1
  191. package/dist/providers/openai.d.ts.map +0 -1
  192. package/dist/providers/openai.js.map +0 -1
  193. package/dist/providers/sse.d.ts.map +0 -1
  194. package/dist/providers/sse.js.map +0 -1
  195. package/dist/providers/types.d.ts.map +0 -1
  196. package/dist/providers/types.js.map +0 -1
  197. package/dist/providers/vertex-ai.d.ts.map +0 -1
  198. package/dist/providers/vertex-ai.js.map +0 -1
  199. package/dist/runtime/actions/context.d.ts.map +0 -1
  200. package/dist/runtime/actions/context.js.map +0 -1
  201. package/dist/runtime/actions/execute.d.ts.map +0 -1
  202. package/dist/runtime/actions/execute.js.map +0 -1
  203. package/dist/runtime/actions/native.d.ts.map +0 -1
  204. package/dist/runtime/actions/native.js.map +0 -1
  205. package/dist/runtime/actions/sandbox.d.ts.map +0 -1
  206. package/dist/runtime/actions/sandbox.js.map +0 -1
  207. package/dist/runtime/agent.d.ts.map +0 -1
  208. package/dist/runtime/agent.js.map +0 -1
  209. package/dist/runtime/context.d.ts.map +0 -1
  210. package/dist/runtime/context.js.map +0 -1
  211. package/dist/runtime/create-orcha.d.ts.map +0 -1
  212. package/dist/runtime/create-orcha.js.map +0 -1
  213. package/dist/runtime/execution.d.ts.map +0 -1
  214. package/dist/runtime/execution.js.map +0 -1
  215. package/dist/runtime/session-events.d.ts.map +0 -1
  216. package/dist/runtime/session-events.js.map +0 -1
  217. package/dist/runtime/structured-output.d.ts.map +0 -1
  218. package/dist/runtime/structured-output.js.map +0 -1
  219. package/dist/storage/browser-indexeddb.d.ts.map +0 -1
  220. package/dist/storage/browser-indexeddb.js.map +0 -1
  221. package/dist/storage/create-store.d.ts.map +0 -1
  222. package/dist/storage/create-store.js.map +0 -1
  223. package/dist/storage/edge-store.d.ts.map +0 -1
  224. package/dist/storage/edge-store.js.map +0 -1
  225. package/dist/storage/migrate.d.ts.map +0 -1
  226. package/dist/storage/migrate.js.map +0 -1
  227. package/dist/storage/node-jsonl.d.ts.map +0 -1
  228. package/dist/storage/node-jsonl.js.map +0 -1
  229. package/dist/storage/node-sqlite.d.ts.map +0 -1
  230. package/dist/storage/node-sqlite.js.map +0 -1
  231. package/dist/storage/react-native-jsonl.d.ts.map +0 -1
  232. package/dist/storage/react-native-jsonl.js.map +0 -1
  233. package/dist/testing.d.ts.map +0 -1
  234. package/dist/testing.js.map +0 -1
  235. package/dist/types.d.ts.map +0 -1
  236. package/dist/types.js.map +0 -1
  237. package/dist-cjs/amarsia/metadata.js.map +0 -7
  238. package/dist-cjs/amarsia/sync.js.map +0 -7
  239. package/dist-cjs/cli-agents-template.js.map +0 -7
  240. package/dist-cjs/compiler/build-project.js.map +0 -7
  241. package/dist-cjs/compiler/compile.js.map +0 -7
  242. package/dist-cjs/env.js.map +0 -7
  243. package/dist-cjs/errors.js.map +0 -7
  244. package/dist-cjs/file-content.js.map +0 -7
  245. package/dist-cjs/index.js.map +0 -7
  246. package/dist-cjs/integrations/esbuild.js.map +0 -7
  247. package/dist-cjs/orcha.js.map +0 -7
  248. package/dist-cjs/playground/server.js.map +0 -7
  249. package/dist-cjs/playground/source.js.map +0 -7
  250. package/dist-cjs/project-loader.js.map +0 -7
  251. package/dist-cjs/providers/anthropic.js.map +0 -7
  252. package/dist-cjs/providers/bedrock.js.map +0 -7
  253. package/dist-cjs/providers/catalog.js.map +0 -7
  254. package/dist-cjs/providers/deepseek.js.map +0 -7
  255. package/dist-cjs/providers/dispatcher.js.map +0 -7
  256. package/dist-cjs/providers/google-gemini.js.map +0 -7
  257. package/dist-cjs/providers/google-genai.js.map +0 -7
  258. package/dist-cjs/providers/index.js.map +0 -7
  259. package/dist-cjs/providers/openai.js.map +0 -7
  260. package/dist-cjs/providers/sse.js.map +0 -7
  261. package/dist-cjs/providers/types.js.map +0 -7
  262. package/dist-cjs/providers/vertex-ai.js.map +0 -7
  263. package/dist-cjs/runtime/actions/context.js.map +0 -7
  264. package/dist-cjs/runtime/actions/execute.js.map +0 -7
  265. package/dist-cjs/runtime/actions/native.js.map +0 -7
  266. package/dist-cjs/runtime/actions/sandbox.js.map +0 -7
  267. package/dist-cjs/runtime/agent.js.map +0 -7
  268. package/dist-cjs/runtime/context.js.map +0 -7
  269. package/dist-cjs/runtime/create-orcha.js.map +0 -7
  270. package/dist-cjs/runtime/execution.js.map +0 -7
  271. package/dist-cjs/runtime/session-events.js.map +0 -7
  272. package/dist-cjs/runtime/structured-output.js.map +0 -7
  273. package/dist-cjs/storage/browser-indexeddb.js.map +0 -7
  274. package/dist-cjs/storage/create-store.js.map +0 -7
  275. package/dist-cjs/storage/edge-store.js.map +0 -7
  276. package/dist-cjs/storage/migrate.js.map +0 -7
  277. package/dist-cjs/storage/node-jsonl.js.map +0 -7
  278. package/dist-cjs/storage/node-sqlite.js.map +0 -7
  279. package/dist-cjs/storage/react-native-jsonl.js.map +0 -7
  280. package/dist-cjs/testing.js.map +0 -7
  281. package/dist-cjs/types.js.map +0 -7
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -22,19 +22,20 @@ __export(server_exports, {
22
22
  startPlayground: () => startPlayground
23
23
  });
24
24
  module.exports = __toCommonJS(server_exports);
25
- var import_node_child_process = require("node:child_process");
26
- var import_node_crypto = require("node:crypto");
27
- var import_node_fs = require("node:fs");
28
- var import_promises = require("node:fs/promises");
29
- var import_node_path = require("node:path");
30
- var import_node_url = require("node:url");
31
- var import_node_http = require("node:http");
25
+ var import_child_process = require("child_process");
26
+ var import_crypto = require("crypto");
27
+ var import_fs = require("fs");
28
+ var import_promises = require("fs/promises");
29
+ var import_path = require("path");
30
+ var import_url = require("url");
31
+ var import_http = require("http");
32
+ var import_chokidar = require("chokidar");
32
33
  var import_orcha = require("../orcha.js");
33
34
  var import_project_loader = require("../project-loader.js");
34
35
  var import_testing = require("../testing.js");
35
36
  var import_source = require("./source.js");
36
37
  async function startPlayground(options = {}) {
37
- const projectRoot = (0, import_node_path.resolve)(options.projectRoot ?? process.cwd());
38
+ const projectRoot = (0, import_path.resolve)(options.projectRoot ?? process.cwd());
38
39
  const host = options.host ?? "localhost";
39
40
  const port = options.port ?? 4310;
40
41
  if (host === "0.0.0.0" || host === "::") {
@@ -42,11 +43,11 @@ async function startPlayground(options = {}) {
42
43
  "Use an explicit hostname or IP address instead of a wildcard playground host."
43
44
  );
44
45
  }
45
- const mutationToken = (0, import_node_crypto.randomBytes)(32).toString("base64url");
46
+ const mutationToken = (0, import_crypto.randomBytes)(32).toString("base64url");
46
47
  const allowedHosts = playgroundHosts(host, port);
47
48
  await (0, import_project_loader.loadProject)(projectRoot);
48
49
  const projectClients = /* @__PURE__ */ new Set();
49
- const server = (0, import_node_http.createServer)(async (request, response) => {
50
+ const server = (0, import_http.createServer)(async (request, response) => {
50
51
  try {
51
52
  await routeRequest({
52
53
  request,
@@ -105,22 +106,25 @@ async function startPlayground(options = {}) {
105
106
  }
106
107
  }
107
108
  };
108
- const watcher = (0, import_node_fs.watch)(
109
- (0, import_node_path.resolve)(projectRoot, "orcha"),
110
- { recursive: true },
111
- () => {
112
- clearTimeout(reloadTimer);
113
- reloadTimer = setTimeout(() => void reload(), 100);
114
- }
115
- );
109
+ const watcher = (0, import_chokidar.watch)(
110
+ (0, import_path.resolve)(projectRoot, "orcha"),
111
+ { ignoreInitial: true }
112
+ ).on("all", () => {
113
+ clearTimeout(reloadTimer);
114
+ reloadTimer = setTimeout(() => void reload(), 100);
115
+ });
116
116
  await new Promise((resolveStop) => {
117
117
  const stop = () => {
118
118
  clearTimeout(reloadTimer);
119
- watcher.close();
120
119
  for (const client of projectClients) {
121
120
  client.end();
122
121
  }
123
- server.close(() => resolveStop());
122
+ void Promise.all([
123
+ watcher.close(),
124
+ new Promise((resolveClosed) => {
125
+ server.close(() => resolveClosed());
126
+ })
127
+ ]).then(() => resolveStop());
124
128
  };
125
129
  process.once("SIGINT", stop);
126
130
  process.once("SIGTERM", stop);
@@ -469,16 +473,16 @@ async function readAllEventPages(read) {
469
473
  return pages.flat();
470
474
  }
471
475
  async function serveAsset(response, pathname) {
472
- const publicRoot = (0, import_node_path.resolve)(
473
- (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(__orchaImportMetaUrl)),
476
+ const publicRoot = (0, import_path.resolve)(
477
+ (0, import_path.dirname)((0, import_url.fileURLToPath)(__orchaImportMetaUrl)),
474
478
  "public"
475
479
  );
476
480
  const requested = pathname === "/" ? "index.html" : pathname.slice(1);
477
- const path = (0, import_node_path.resolve)(publicRoot, requested);
478
- const relativePath = (0, import_node_path.relative)(publicRoot, path);
479
- if (relativePath.startsWith("..") || (0, import_node_path.isAbsolute)(relativePath) || !(0, import_node_fs.existsSync)(path)) {
480
- const indexPath = (0, import_node_path.resolve)(publicRoot, "index.html");
481
- if (!(0, import_node_fs.existsSync)(indexPath)) {
481
+ const path = (0, import_path.resolve)(publicRoot, requested);
482
+ const relativePath = (0, import_path.relative)(publicRoot, path);
483
+ if (relativePath.startsWith("..") || (0, import_path.isAbsolute)(relativePath) || !(0, import_fs.existsSync)(path)) {
484
+ const indexPath = (0, import_path.resolve)(publicRoot, "index.html");
485
+ if (!(0, import_fs.existsSync)(indexPath)) {
482
486
  sendJson(response, 503, {
483
487
  error: "Playground assets are missing. Rebuild orchajs."
484
488
  });
@@ -498,7 +502,7 @@ async function serveAsset(response, pathname) {
498
502
  response.end(await (0, import_promises.readFile)(path));
499
503
  }
500
504
  function contentType(path) {
501
- switch ((0, import_node_path.extname)(path)) {
505
+ switch ((0, import_path.extname)(path)) {
502
506
  case ".html":
503
507
  return "text/html; charset=utf-8";
504
508
  case ".js":
@@ -624,7 +628,7 @@ function optionalString(value) {
624
628
  function openBrowser(url) {
625
629
  const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
626
630
  const arguments_ = process.platform === "win32" ? ["/c", "start", "", url] : [url];
627
- const child = (0, import_node_child_process.spawn)(command, arguments_, {
631
+ const child = (0, import_child_process.spawn)(command, arguments_, {
628
632
  detached: true,
629
633
  stdio: "ignore"
630
634
  });
@@ -682,4 +686,3 @@ function validateMutationRequest(request, mutationToken) {
682
686
  0 && (module.exports = {
683
687
  startPlayground
684
688
  });
685
- //# sourceMappingURL=server.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -22,8 +22,8 @@ __export(source_exports, {
22
22
  readPlaygroundAgentSource: () => readPlaygroundAgentSource
23
23
  });
24
24
  module.exports = __toCommonJS(source_exports);
25
- var import_promises = require("node:fs/promises");
26
- var import_node_path = require("node:path");
25
+ var import_promises = require("fs/promises");
26
+ var import_path = require("path");
27
27
  var import_context = require("../runtime/context.js");
28
28
  async function readPlaygroundAgentSource(orcha, agentKey) {
29
29
  const context = (0, import_context.getOrchaRuntimeContext)(orcha);
@@ -37,11 +37,11 @@ async function readPlaygroundAgentSource(orcha, agentKey) {
37
37
  registration
38
38
  );
39
39
  const rawConfiguration = await readRequired(
40
- (0, import_node_path.resolve)(directory, "index.json")
40
+ (0, import_path.resolve)(directory, "index.json")
41
41
  );
42
42
  const configuration = parseObject(rawConfiguration, `${agentKey}/index.json`);
43
43
  const instructions = await readRequired(
44
- (0, import_node_path.resolve)(directory, "instructions.md")
44
+ (0, import_path.resolve)(directory, "instructions.md")
45
45
  );
46
46
  return {
47
47
  key: agentKey,
@@ -83,10 +83,10 @@ async function readPlaygroundAgentSource(orcha, agentKey) {
83
83
  }
84
84
  function registeredAgentDirectory(projectRoot, registration) {
85
85
  const registeredPath = typeof registration === "string" ? registration : registration.path;
86
- return (0, import_node_path.resolve)(projectRoot, "orcha", registeredPath);
86
+ return (0, import_path.resolve)(projectRoot, "orcha", registeredPath);
87
87
  }
88
88
  async function readCollectionItems(agentDirectory, collection, manifests, includeSource) {
89
- const root = (0, import_node_path.resolve)(agentDirectory, collection);
89
+ const root = (0, import_path.resolve)(agentDirectory, collection);
90
90
  let entries;
91
91
  try {
92
92
  entries = await (0, import_promises.readdir)(root, { withFileTypes: true });
@@ -104,17 +104,17 @@ async function readCollectionItems(agentDirectory, collection, manifests, includ
104
104
  );
105
105
  return Promise.all(
106
106
  entries.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).sort((left, right) => left.name.localeCompare(right.name)).map(async (entry) => {
107
- const directory = (0, import_node_path.resolve)(root, entry.name);
107
+ const directory = (0, import_path.resolve)(root, entry.name);
108
108
  const rawConfiguration = await readRequired(
109
- (0, import_node_path.resolve)(directory, "index.json")
109
+ (0, import_path.resolve)(directory, "index.json")
110
110
  );
111
111
  const configuration = parseObject(
112
112
  rawConfiguration,
113
113
  `${collection}/${entry.name}/index.json`
114
114
  );
115
115
  const compiled = byDirectory.get(entry.name);
116
- const instructions = includeSource ? void 0 : await readOptional((0, import_node_path.resolve)(directory, "instructions.md"));
117
- const source = includeSource ? await readOptional((0, import_node_path.resolve)(directory, "index.js")) : void 0;
116
+ const instructions = includeSource ? void 0 : await readOptional((0, import_path.resolve)(directory, "instructions.md"));
117
+ const source = includeSource ? await readOptional((0, import_path.resolve)(directory, "index.js")) : void 0;
118
118
  return {
119
119
  key: compiled?.key ?? entry.name,
120
120
  name: typeof configuration.name === "string" ? configuration.name : entry.name,
@@ -152,4 +152,3 @@ function parseObject(source, label) {
152
152
  0 && (module.exports = {
153
153
  readPlaygroundAgentSource
154
154
  });
155
- //# sourceMappingURL=source.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -22,21 +22,21 @@ __export(project_loader_exports, {
22
22
  loadProject: () => loadProject
23
23
  });
24
24
  module.exports = __toCommonJS(project_loader_exports);
25
- var import_node_fs = require("node:fs");
26
- var import_promises = require("node:fs/promises");
27
- var import_node_path = require("node:path");
28
- var import_node_url = require("node:url");
25
+ var import_fs = require("fs");
26
+ var import_promises = require("fs/promises");
27
+ var import_path = require("path");
28
+ var import_url = require("url");
29
29
  var import_esbuild = require("esbuild");
30
30
  var import_env = require("./env.js");
31
31
  var import_orcha = require("./orcha.js");
32
32
  async function loadProject(projectRoot) {
33
33
  (0, import_env.loadProjectEnvironment)(projectRoot);
34
- const registryPath = (0, import_node_path.resolve)(projectRoot, "orcha/index.ts");
35
- if (!(0, import_node_fs.existsSync)(registryPath)) {
34
+ const registryPath = (0, import_path.resolve)(projectRoot, "orcha/index.ts");
35
+ if (!(0, import_fs.existsSync)(registryPath)) {
36
36
  throw new Error('Missing "orcha/index.ts". Run "orcha init" first.');
37
37
  }
38
- const temporaryDirectory = (0, import_node_path.resolve)(projectRoot, ".orcha/.cli");
39
- const bundlePath = (0, import_node_path.resolve)(
38
+ const temporaryDirectory = (0, import_path.resolve)(projectRoot, ".orcha/.cli");
39
+ const bundlePath = (0, import_path.resolve)(
40
40
  temporaryDirectory,
41
41
  `registry-${process.pid}-${Date.now()}.mjs`
42
42
  );
@@ -49,7 +49,7 @@ async function loadProject(projectRoot) {
49
49
  bundle: true,
50
50
  format: "esm",
51
51
  platform: "node",
52
- target: "node20",
52
+ target: "node18",
53
53
  packages: "external",
54
54
  logLevel: "silent"
55
55
  });
@@ -58,7 +58,7 @@ async function loadProject(projectRoot) {
58
58
  process.env.ORCHA_PROJECT_ROOT = projectRoot;
59
59
  process.env.ORCHA_COMPILING = "1";
60
60
  try {
61
- await import(`${(0, import_node_url.pathToFileURL)(bundlePath).href}?time=${Date.now()}`);
61
+ await import(`${(0, import_url.pathToFileURL)(bundlePath).href}?time=${Date.now()}`);
62
62
  } finally {
63
63
  restoreEnvironment("ORCHA_PROJECT_ROOT", previousRoot);
64
64
  restoreEnvironment("ORCHA_COMPILING", previousCompiling);
@@ -83,4 +83,3 @@ function restoreEnvironment(name, value) {
83
83
  0 && (module.exports = {
84
84
  loadProject
85
85
  });
86
- //# sourceMappingURL=project-loader.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -416,4 +416,3 @@ function getReasoningConfiguration(request) {
416
416
  0 && (module.exports = {
417
417
  anthropicProvider
418
418
  });
419
- //# sourceMappingURL=anthropic.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -24,8 +24,8 @@ __export(bedrock_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(bedrock_exports);
26
26
  var import_client_bedrock_runtime = require("@aws-sdk/client-bedrock-runtime");
27
- var import_node_crypto = require("node:crypto");
28
- var import_node_path = require("node:path");
27
+ var import_crypto = require("crypto");
28
+ var import_path = require("path");
29
29
  var import_errors = require("../errors.js");
30
30
  var import_file_content = require("../file-content.js");
31
31
  var import_structured_output = require("../runtime/structured-output.js");
@@ -207,7 +207,7 @@ function toBedrockBinaryBlock(bytes, mimeType, fileName) {
207
207
  );
208
208
  }
209
209
  function documentFormat(fileName, mimeType) {
210
- const extension = (0, import_node_path.extname)(fileName).slice(1).toLowerCase();
210
+ const extension = (0, import_path.extname)(fileName).slice(1).toLowerCase();
211
211
  if (["csv", "doc", "docx", "html", "md", "pdf", "txt", "xls", "xlsx"].includes(
212
212
  extension
213
213
  )) {
@@ -225,14 +225,14 @@ function documentFormat(fileName, mimeType) {
225
225
  return void 0;
226
226
  }
227
227
  function safeBedrockDocumentName(fileName) {
228
- const name = (0, import_node_path.basename)(fileName, (0, import_node_path.extname)(fileName)).replace(/[^A-Za-z0-9()[\] -]/g, " ").replace(/\s+/g, " ").trim();
228
+ const name = (0, import_path.basename)(fileName, (0, import_path.extname)(fileName)).replace(/[^A-Za-z0-9()[\] -]/g, " ").replace(/\s+/g, " ").trim();
229
229
  return name || "document";
230
230
  }
231
231
  function fileNameFromUri(uri) {
232
232
  try {
233
- return (0, import_node_path.basename)(new URL(uri).pathname) || "document";
233
+ return (0, import_path.basename)(new URL(uri).pathname) || "document";
234
234
  } catch {
235
- return (0, import_node_path.basename)(uri) || "document";
235
+ return (0, import_path.basename)(uri) || "document";
236
236
  }
237
237
  }
238
238
  function imageFormat(mimeType) {
@@ -434,7 +434,7 @@ function invalidToolInputError(options) {
434
434
  const previewLimit = 1e3;
435
435
  const receivedStart = options.input.length > previewLimit ? `${options.input.slice(0, previewLimit)}\u2026` : options.input;
436
436
  const receivedEnd = options.input.length > previewLimit ? `\u2026${options.input.slice(-previewLimit)}` : options.input;
437
- const receivedSha256 = (0, import_node_crypto.createHash)("sha256").update(options.input).digest("hex");
437
+ const receivedSha256 = (0, import_crypto.createHash)("sha256").update(options.input).digest("hex");
438
438
  const requestReference = options.requestId ? ` Bedrock request ID: ${options.requestId}.` : "";
439
439
  return new import_errors.OrchaError(
440
440
  "provider_error",
@@ -575,4 +575,3 @@ function isRecord(value) {
575
575
  bedrockProvider,
576
576
  generateBedrockContent
577
577
  });
578
- //# sourceMappingURL=bedrock.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -57,4 +57,3 @@ function isBuiltInProvider(name) {
57
57
  builtInProviderCatalog,
58
58
  isBuiltInProvider
59
59
  });
60
- //# sourceMappingURL=catalog.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -312,4 +312,3 @@ function isRecord(value) {
312
312
  0 && (module.exports = {
313
313
  deepSeekProvider
314
314
  });
315
- //# sourceMappingURL=deepseek.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -39,4 +39,3 @@ function createProviderResponseGenerator(providers) {
39
39
  0 && (module.exports = {
40
40
  createProviderResponseGenerator
41
41
  });
42
- //# sourceMappingURL=dispatcher.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -19,12 +19,21 @@ var __copyProps = (to, from, except, desc) => {
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var google_gemini_exports = {};
21
21
  __export(google_gemini_exports, {
22
- generateGoogleContent: () => generateGoogleContent
22
+ generateGoogleContent: () => generateGoogleContent,
23
+ toGoogleContentClient: () => toGoogleContentClient
23
24
  });
24
25
  module.exports = __toCommonJS(google_gemini_exports);
25
26
  var import_errors = require("../errors.js");
26
27
  var import_file_content = require("../file-content.js");
27
28
  var import_structured_output = require("../runtime/structured-output.js");
29
+ function toGoogleContentClient(client) {
30
+ if (typeof client !== "object" || client === null || !("models" in client) || typeof client.models !== "object" || client.models === null || !("generateContentStream" in client.models) || typeof client.models.generateContentStream !== "function") {
31
+ throw new Error(
32
+ "The installed @google/genai package does not expose a compatible client."
33
+ );
34
+ }
35
+ return client;
36
+ }
28
37
  async function generateGoogleContent(client, request, provider) {
29
38
  request.signal?.throwIfAborted();
30
39
  if (request.outputType === "image" || request.outputType === "audio") {
@@ -361,6 +370,6 @@ function isRecord(value) {
361
370
  }
362
371
  // Annotate the CommonJS export names for ESM import in node:
363
372
  0 && (module.exports = {
364
- generateGoogleContent
373
+ generateGoogleContent,
374
+ toGoogleContentClient
365
375
  });
366
- //# sourceMappingURL=google-gemini.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -39,7 +39,7 @@ async function generateGoogleGenAI(configuration, request) {
39
39
  ...configuration.baseUrl ? { httpOptions: { baseUrl: configuration.baseUrl } } : {}
40
40
  });
41
41
  return (0, import_google_gemini.generateGoogleContent)(
42
- client,
42
+ (0, import_google_gemini.toGoogleContentClient)(client),
43
43
  request,
44
44
  "googlegenai"
45
45
  );
@@ -48,4 +48,3 @@ async function generateGoogleGenAI(configuration, request) {
48
48
  0 && (module.exports = {
49
49
  googleGenAIProvider
50
50
  });
51
- //# sourceMappingURL=google-genai.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -51,10 +51,34 @@ function loadProvider(name) {
51
51
  );
52
52
  }
53
53
  return provider;
54
+ }).catch((error) => {
55
+ loadedProviders.delete(name);
56
+ const dependency = missingProviderDependency(name, error);
57
+ if (dependency) {
58
+ const nodeRequirement = dependency === "@google/genai" ? " Node.js 20 or newer is also required." : "";
59
+ throw new import_errors.OrchaError(
60
+ "provider_error",
61
+ `Provider "${name}" requires the optional "${dependency}" package.${nodeRequirement} Install it in the application that uses this provider.`,
62
+ { cause: error }
63
+ );
64
+ }
65
+ throw error;
54
66
  });
55
67
  loadedProviders.set(name, loading);
56
68
  return loading;
57
69
  }
70
+ function missingProviderDependency(name, error) {
71
+ if (!(error instanceof Error)) {
72
+ return void 0;
73
+ }
74
+ if (name === "bedrock" && error.message.includes("@aws-sdk/client-bedrock-runtime")) {
75
+ return "@aws-sdk/client-bedrock-runtime";
76
+ }
77
+ if ((name === "googlegenai" || name === "vertexai") && error.message.includes("@google/genai")) {
78
+ return "@google/genai";
79
+ }
80
+ return void 0;
81
+ }
58
82
  function isProviderAdapter(value) {
59
83
  return typeof value === "object" && value !== null && "name" in value && "generate" in value && typeof value.generate === "function";
60
84
  }
@@ -63,4 +87,3 @@ function isProviderAdapter(value) {
63
87
  generateProviderResponse,
64
88
  isBuiltInProvider
65
89
  });
66
- //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -327,4 +327,3 @@ function isRecord(value) {
327
327
  0 && (module.exports = {
328
328
  openAIProvider
329
329
  });
330
- //# sourceMappingURL=openai.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -80,4 +80,3 @@ async function* readServerSentEvents(response) {
80
80
  0 && (module.exports = {
81
81
  readServerSentEvents
82
82
  });
83
- //# sourceMappingURL=sse.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -15,4 +15,3 @@ var __copyProps = (to, from, except, desc) => {
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var types_exports = {};
17
17
  module.exports = __toCommonJS(types_exports);
18
- //# sourceMappingURL=types.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -59,10 +59,13 @@ async function generateVertexAI(configuration, request) {
59
59
  } : {},
60
60
  ...configuration.baseUrl ? { httpOptions: { baseUrl: configuration.baseUrl } } : {}
61
61
  });
62
- return (0, import_google_gemini.generateGoogleContent)(client, request, "vertexai");
62
+ return (0, import_google_gemini.generateGoogleContent)(
63
+ (0, import_google_gemini.toGoogleContentClient)(client),
64
+ request,
65
+ "vertexai"
66
+ );
63
67
  }
64
68
  // Annotate the CommonJS export names for ESM import in node:
65
69
  0 && (module.exports = {
66
70
  vertexAIProvider
67
71
  });
68
- //# sourceMappingURL=vertex-ai.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -52,7 +52,7 @@ function createLocalActionContext(options) {
52
52
  const response = await fetch(url, {
53
53
  ...init,
54
54
  redirect: "manual",
55
- signal: init?.signal ? AbortSignal.any([init.signal, timeoutSignal]) : timeoutSignal
55
+ signal: init?.signal ? combineAbortSignals(init.signal, timeoutSignal) : timeoutSignal
56
56
  });
57
57
  if (response.status >= 300 && response.status < 400) {
58
58
  throw new Error(
@@ -66,6 +66,30 @@ function createLocalActionContext(options) {
66
66
  }
67
67
  });
68
68
  }
69
+ function combineAbortSignals(first, second) {
70
+ const controller = new AbortController();
71
+ const registrations = [];
72
+ const cleanup = () => {
73
+ for (const { signal, listener } of registrations) {
74
+ signal.removeEventListener("abort", listener);
75
+ }
76
+ };
77
+ const register = (signal) => {
78
+ const abort = () => controller.abort(signal.reason);
79
+ if (signal.aborted) {
80
+ abort();
81
+ return;
82
+ }
83
+ signal.addEventListener("abort", abort, { once: true });
84
+ registrations.push({ signal, listener: abort });
85
+ };
86
+ controller.signal.addEventListener("abort", cleanup, { once: true });
87
+ register(first);
88
+ if (!controller.signal.aborted) {
89
+ register(second);
90
+ }
91
+ return controller.signal;
92
+ }
69
93
  function isAllowedHost(hostname, allowedHosts) {
70
94
  return allowedHosts.some((allowed) => {
71
95
  if (allowed.startsWith("*.")) {
@@ -79,4 +103,3 @@ function isAllowedHost(hostname, allowedHosts) {
79
103
  0 && (module.exports = {
80
104
  createLocalActionContext
81
105
  });
82
- //# sourceMappingURL=context.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -40,7 +40,7 @@ async function executeLocalAction(options) {
40
40
  return (0, import_native.executeNativeAction)(options.action, options.parameters, context);
41
41
  }
42
42
  if (process.env.ORCHA_INCLUDE_SANDBOX !== "0") {
43
- const { executeSandboxedAction } = await import("./sandbox.js");
43
+ const { executeSandboxedAction } = await loadSandboxRuntime();
44
44
  return executeSandboxedAction(
45
45
  options.action,
46
46
  options.parameters,
@@ -52,8 +52,22 @@ async function executeLocalAction(options) {
52
52
  "The production bundle was built without the QuickJS sandbox."
53
53
  );
54
54
  }
55
+ async function loadSandboxRuntime() {
56
+ try {
57
+ return await import("./sandbox.js");
58
+ } catch (error) {
59
+ if (error instanceof Error && (error.message.includes("quickjs-emscripten-core") || error.message.includes(
60
+ "@jitl/quickjs-singlefile-cjs-release-sync"
61
+ ))) {
62
+ throw new Error(
63
+ 'Sandboxed actions require the optional "quickjs-emscripten-core" and "@jitl/quickjs-singlefile-cjs-release-sync" packages. Install both in the application that selects the sandbox runtime.',
64
+ { cause: error }
65
+ );
66
+ }
67
+ throw error;
68
+ }
69
+ }
55
70
  // Annotate the CommonJS export names for ESM import in node:
56
71
  0 && (module.exports = {
57
72
  executeLocalAction
58
73
  });
59
- //# sourceMappingURL=execute.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -22,8 +22,8 @@ __export(native_exports, {
22
22
  executeNativeAction: () => executeNativeAction
23
23
  });
24
24
  module.exports = __toCommonJS(native_exports);
25
- var import_node_module = require("node:module");
26
- const require2 = (0, import_node_module.createRequire)(__orchaImportMetaUrl);
25
+ var import_module = require("module");
26
+ const require2 = (0, import_module.createRequire)(__orchaImportMetaUrl);
27
27
  async function executeNativeAction(action, parameters, context) {
28
28
  if (!action.source) {
29
29
  throw new Error(`Action "${action.name}" has no compiled source.`);
@@ -65,4 +65,3 @@ return __orchaActionModule.default;`
65
65
  0 && (module.exports = {
66
66
  executeNativeAction
67
67
  });
68
- //# sourceMappingURL=native.js.map
@@ -1,4 +1,4 @@
1
- "use strict"; const __orchaImportMetaUrl = require("node:url").pathToFileURL(__filename).href;
1
+ "use strict"; const __orchaImportMetaUrl = require("url").pathToFileURL(__filename).href;
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -165,4 +165,3 @@ function createSandboxProgram(action, parameters, context) {
165
165
  0 && (module.exports = {
166
166
  executeSandboxedAction
167
167
  });
168
- //# sourceMappingURL=sandbox.js.map