executor 1.2.1 → 1.2.2

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.
package/bin/executor.mjs CHANGED
@@ -305367,8 +305367,8 @@ var require_client_interceptors = __commonJS((exports) => {
305367
305367
  this.start = start4;
305368
305368
  return this;
305369
305369
  }
305370
- withSendMessage(sendMessage) {
305371
- this.message = sendMessage;
305370
+ withSendMessage(sendMessage2) {
305371
+ this.message = sendMessage2;
305372
305372
  return this;
305373
305373
  }
305374
305374
  withHalfClose(halfClose) {
@@ -320673,8 +320673,8 @@ var require_server_interceptors = __commonJS((exports) => {
320673
320673
  this.metadata = sendMetadata;
320674
320674
  return this;
320675
320675
  }
320676
- withSendMessage(sendMessage) {
320677
- this.message = sendMessage;
320676
+ withSendMessage(sendMessage2) {
320677
+ this.message = sendMessage2;
320678
320678
  return this;
320679
320679
  }
320680
320680
  withSendStatus(sendStatus) {
@@ -334088,12 +334088,12 @@ var require_src18 = __commonJS((exports) => {
334088
334088
  });
334089
334089
 
334090
334090
  // apps/executor/src/cli/main.ts
334091
- import { existsSync as existsSync8, readFileSync as readFileSync3 } from "node:fs";
334091
+ import { existsSync as existsSync9, readFileSync as readFileSync3 } from "node:fs";
334092
334092
  import { mkdir as mkdir5, open as open3, readFile as readFile6, rm as rm5 } from "node:fs/promises";
334093
- import { spawn as spawn2 } from "node:child_process";
334093
+ import { spawn as spawn3 } from "node:child_process";
334094
334094
  import { dirname as dirname10, resolve as resolve11 } from "node:path";
334095
334095
  import { createInterface } from "node:readline/promises";
334096
- import { fileURLToPath as fileURLToPath8 } from "node:url";
334096
+ import { fileURLToPath as fileURLToPath7 } from "node:url";
334097
334097
 
334098
334098
  // node_modules/@effect/cli/dist/esm/Args.js
334099
334099
  var exports_Args = {};
@@ -375146,6 +375146,7 @@ var LocalInstallationSchema = Struct({
375146
375146
  });
375147
375147
  var LocalInstallationUpdateSchema = partial2(LocalInstallationSchema);
375148
375148
  // packages/control-plane/src/schema/models/local-config.ts
375149
+ var LocalExecutorRuntimeSchema = exports_Schema.Literal("quickjs", "ses", "deno");
375149
375150
  var LocalConfigSecretProviderSourceSchema = exports_Schema.Literal("env", "file", "exec", "params");
375150
375151
  var LocalConfigEnvSecretProviderSchema = exports_Schema.Struct({
375151
375152
  source: exports_Schema.Literal("env")
@@ -375241,6 +375242,7 @@ var LocalConfigWorkspaceSchema = exports_Schema.Struct({
375241
375242
  name: exports_Schema.optional(exports_Schema.String)
375242
375243
  });
375243
375244
  var LocalExecutorConfigSchema = exports_Schema.Struct({
375245
+ runtime: exports_Schema.optional(LocalExecutorRuntimeSchema),
375244
375246
  workspace: exports_Schema.optional(LocalConfigWorkspaceSchema),
375245
375247
  sources: exports_Schema.optional(exports_Schema.Record({
375246
375248
  key: exports_Schema.String,
@@ -408418,6 +408420,280 @@ var asOperationErrors = (errors4) => typeof errors4 === "string" ? operationErro
408418
408420
  class ControlPlaneStore extends Tag2("#runtime/ControlPlaneStore")() {
408419
408421
  }
408420
408422
 
408423
+ // packages/runtime-deno-subprocess/src/index.ts
408424
+ import { existsSync } from "node:fs";
408425
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
408426
+
408427
+ // packages/runtime-deno-subprocess/src/deno-worker-process.ts
408428
+ import { spawn } from "node:child_process";
408429
+ var normalizeError = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
408430
+ var buildPermissionArgs = (permissions) => {
408431
+ if (!permissions) {
408432
+ return [
408433
+ "--deny-net",
408434
+ "--deny-read",
408435
+ "--deny-write",
408436
+ "--deny-env",
408437
+ "--deny-run",
408438
+ "--deny-ffi"
408439
+ ];
408440
+ }
408441
+ const args3 = [];
408442
+ const addPermission = (flag, value7) => {
408443
+ if (value7 === true) {
408444
+ args3.push(`--allow-${flag}`);
408445
+ } else if (Array.isArray(value7) && value7.length > 0) {
408446
+ args3.push(`--allow-${flag}=${value7.join(",")}`);
408447
+ } else {
408448
+ args3.push(`--deny-${flag}`);
408449
+ }
408450
+ };
408451
+ addPermission("net", permissions.allowNet);
408452
+ addPermission("read", permissions.allowRead);
408453
+ addPermission("write", permissions.allowWrite);
408454
+ addPermission("env", permissions.allowEnv);
408455
+ addPermission("run", permissions.allowRun);
408456
+ addPermission("ffi", permissions.allowFfi);
408457
+ return args3;
408458
+ };
408459
+ var spawnDenoWorkerProcess = (input, callbacks) => {
408460
+ const permissionArgs = buildPermissionArgs(input.permissions);
408461
+ const child = spawn(input.executable, [
408462
+ "run",
408463
+ "--quiet",
408464
+ "--no-prompt",
408465
+ "--no-check",
408466
+ ...permissionArgs,
408467
+ input.scriptPath
408468
+ ], {
408469
+ stdio: ["pipe", "pipe", "pipe"]
408470
+ });
408471
+ if (!child.stdin || !child.stdout || !child.stderr) {
408472
+ throw new Error("Failed to create piped stdio for Deno worker subprocess");
408473
+ }
408474
+ child.stdout.setEncoding("utf8");
408475
+ child.stderr.setEncoding("utf8");
408476
+ let stdoutBuffer = "";
408477
+ const onStdoutData = (chunk4) => {
408478
+ stdoutBuffer += chunk4;
408479
+ while (true) {
408480
+ const newlineIndex = stdoutBuffer.indexOf(`
408481
+ `);
408482
+ if (newlineIndex === -1) {
408483
+ break;
408484
+ }
408485
+ const line4 = stdoutBuffer.slice(0, newlineIndex);
408486
+ stdoutBuffer = stdoutBuffer.slice(newlineIndex + 1);
408487
+ callbacks.onStdoutLine(line4);
408488
+ }
408489
+ };
408490
+ const onStderrData = (chunk4) => {
408491
+ callbacks.onStderr(chunk4);
408492
+ };
408493
+ const onError4 = (cause2) => {
408494
+ callbacks.onError(normalizeError(cause2));
408495
+ };
408496
+ const onExit4 = (code2, signal) => {
408497
+ callbacks.onExit(code2, signal);
408498
+ };
408499
+ child.stdout.on("data", onStdoutData);
408500
+ child.stderr.on("data", onStderrData);
408501
+ child.on("error", onError4);
408502
+ child.on("exit", onExit4);
408503
+ let disposed = false;
408504
+ const dispose = () => {
408505
+ if (disposed) {
408506
+ return;
408507
+ }
408508
+ disposed = true;
408509
+ child.stdout.removeListener("data", onStdoutData);
408510
+ child.stderr.removeListener("data", onStderrData);
408511
+ child.removeListener("error", onError4);
408512
+ child.removeListener("exit", onExit4);
408513
+ if (!child.killed) {
408514
+ child.kill("SIGKILL");
408515
+ }
408516
+ };
408517
+ return {
408518
+ stdin: child.stdin,
408519
+ dispose
408520
+ };
408521
+ };
408522
+
408523
+ // packages/runtime-deno-subprocess/src/index.ts
408524
+ var IPC_PREFIX = "@@executor-ipc@@";
408525
+ var DEFAULT_TIMEOUT_MS = 5 * 60000;
408526
+ var defaultDenoExecutable = () => {
408527
+ const configured = process.env.DENO_BIN?.trim();
408528
+ if (configured) {
408529
+ return configured;
408530
+ }
408531
+ const home = process.env.HOME?.trim();
408532
+ if (home) {
408533
+ const installedPath = `${home}/.deno/bin/deno`;
408534
+ if (existsSync(installedPath)) {
408535
+ return installedPath;
408536
+ }
408537
+ }
408538
+ return "deno";
408539
+ };
408540
+ var formatDenoSpawnError = (cause2, executable) => {
408541
+ const code2 = typeof cause2 === "object" && cause2 !== null && "code" in cause2 ? String(cause2.code) : null;
408542
+ if (code2 === "ENOENT") {
408543
+ return `Failed to spawn Deno subprocess: Deno executable "${executable}" was not found. Install Deno or set DENO_BIN.`;
408544
+ }
408545
+ return `Failed to spawn Deno subprocess: ${cause2 instanceof Error ? cause2.message : String(cause2)}`;
408546
+ };
408547
+ var resolveWorkerScriptPath = () => {
408548
+ const moduleUrl = String(import.meta.url);
408549
+ if (moduleUrl.startsWith("/")) {
408550
+ return moduleUrl;
408551
+ }
408552
+ try {
408553
+ const workerUrl = new URL("./deno-subprocess-worker.mjs", moduleUrl);
408554
+ if (workerUrl.protocol === "file:") {
408555
+ return fileURLToPath2(workerUrl);
408556
+ }
408557
+ return workerUrl.pathname.length > 0 ? workerUrl.pathname : workerUrl.toString();
408558
+ } catch {
408559
+ return moduleUrl;
408560
+ }
408561
+ };
408562
+ var cachedWorkerScriptPath;
408563
+ var workerScriptPath = () => {
408564
+ if (!cachedWorkerScriptPath) {
408565
+ cachedWorkerScriptPath = resolveWorkerScriptPath();
408566
+ }
408567
+ return cachedWorkerScriptPath;
408568
+ };
408569
+ var writeMessage = (stdin, message) => {
408570
+ stdin.write(`${JSON.stringify(message)}
408571
+ `);
408572
+ };
408573
+ var isWorkerMessage = (value7) => typeof value7 === "object" && value7 !== null && ("type" in value7) && typeof value7.type === "string";
408574
+ var executeInDeno = (code2, toolInvoker, options9) => gen2(function* () {
408575
+ const denoExecutable = options9.denoExecutable ?? defaultDenoExecutable();
408576
+ const timeoutMs = Math.max(100, options9.timeoutMs ?? DEFAULT_TIMEOUT_MS);
408577
+ const result = yield* async((resume2) => {
408578
+ let settled = false;
408579
+ let stderrBuffer = "";
408580
+ let worker = null;
408581
+ const finish = (executeResult) => {
408582
+ if (settled) {
408583
+ return;
408584
+ }
408585
+ settled = true;
408586
+ clearTimeout(timeout3);
408587
+ worker?.dispose();
408588
+ resume2(succeed8(executeResult));
408589
+ };
408590
+ const fail19 = (error51, logs) => {
408591
+ finish({
408592
+ result: null,
408593
+ error: error51,
408594
+ logs
408595
+ });
408596
+ };
408597
+ const timeout3 = setTimeout(() => {
408598
+ fail19(`Deno subprocess execution timed out after ${timeoutMs}ms`);
408599
+ }, timeoutMs);
408600
+ const handleStdoutLine = (rawLine) => {
408601
+ const line4 = rawLine.trim();
408602
+ if (line4.length === 0 || !line4.startsWith(IPC_PREFIX)) {
408603
+ return;
408604
+ }
408605
+ const payload = line4.slice(IPC_PREFIX.length);
408606
+ let message;
408607
+ try {
408608
+ const parsed = JSON.parse(payload);
408609
+ if (!isWorkerMessage(parsed)) {
408610
+ fail19(`Invalid worker message: ${payload}`);
408611
+ return;
408612
+ }
408613
+ message = parsed;
408614
+ } catch (cause2) {
408615
+ fail19(`Failed to decode worker message: ${payload}
408616
+ ${String(cause2)}`);
408617
+ return;
408618
+ }
408619
+ if (message.type === "tool_call") {
408620
+ if (!worker) {
408621
+ fail19("Deno subprocess unavailable while handling worker tool_call");
408622
+ return;
408623
+ }
408624
+ const currentWorker = worker;
408625
+ runPromise(match12(tryPromise2({
408626
+ try: () => runPromise(toolInvoker.invoke({
408627
+ path: message.toolPath,
408628
+ args: message.args
408629
+ })),
408630
+ catch: (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2))
408631
+ }), {
408632
+ onSuccess: (value7) => {
408633
+ writeMessage(currentWorker.stdin, {
408634
+ type: "tool_result",
408635
+ requestId: message.requestId,
408636
+ ok: true,
408637
+ value: value7
408638
+ });
408639
+ },
408640
+ onFailure: (error51) => {
408641
+ writeMessage(currentWorker.stdin, {
408642
+ type: "tool_result",
408643
+ requestId: message.requestId,
408644
+ ok: false,
408645
+ error: error51.message
408646
+ });
408647
+ }
408648
+ })).catch((cause2) => {
408649
+ fail19(`Failed handling worker tool_call: ${String(cause2)}`);
408650
+ });
408651
+ return;
408652
+ }
408653
+ if (message.type === "completed") {
408654
+ finish({
408655
+ result: message.result,
408656
+ logs: message.logs
408657
+ });
408658
+ return;
408659
+ }
408660
+ fail19(message.error, message.logs);
408661
+ };
408662
+ try {
408663
+ worker = spawnDenoWorkerProcess({
408664
+ executable: denoExecutable,
408665
+ scriptPath: workerScriptPath(),
408666
+ permissions: options9.permissions
408667
+ }, {
408668
+ onStdoutLine: handleStdoutLine,
408669
+ onStderr: (chunk4) => {
408670
+ stderrBuffer += chunk4;
408671
+ },
408672
+ onError: (cause2) => {
408673
+ fail19(formatDenoSpawnError(cause2, denoExecutable));
408674
+ },
408675
+ onExit: (exitCode, signal) => {
408676
+ if (settled) {
408677
+ return;
408678
+ }
408679
+ fail19(`Deno subprocess exited before returning terminal message (code=${String(exitCode)} signal=${String(signal)} stderr=${stderrBuffer})`);
408680
+ }
408681
+ });
408682
+ } catch (cause2) {
408683
+ fail19(formatDenoSpawnError(cause2, denoExecutable));
408684
+ return;
408685
+ }
408686
+ writeMessage(worker.stdin, {
408687
+ type: "start",
408688
+ code: code2
408689
+ });
408690
+ });
408691
+ return result;
408692
+ });
408693
+ var makeDenoSubprocessExecutor = (options9 = {}) => ({
408694
+ execute: (code2, toolInvoker) => executeInDeno(code2, toolInvoker, options9)
408695
+ });
408696
+
408421
408697
  // node_modules/quickjs-emscripten-core/dist/index.mjs
408422
408698
  init_dist();
408423
408699
  async function newQuickJSWASMModuleFromVariant(variantOrPromise) {
@@ -408453,7 +408729,7 @@ async function getQuickJS() {
408453
408729
  }
408454
408730
 
408455
408731
  // packages/runtime-quickjs/src/index.ts
408456
- var DEFAULT_TIMEOUT_MS = 5 * 60000;
408732
+ var DEFAULT_TIMEOUT_MS2 = 5 * 60000;
408457
408733
  var EXECUTION_FILENAME = "executor-quickjs-runtime.js";
408458
408734
  var toError2 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
408459
408735
  var toErrorMessage = (cause2) => {
@@ -408628,7 +408904,7 @@ var drainAsync = async (context7, runtime5, pendingDeferreds, deadlineMs, timeou
408628
408904
  drainJobs(context7, runtime5, deadlineMs, timeoutMs);
408629
408905
  };
408630
408906
  var evaluateInQuickJs = async (options9, code2, toolInvoker) => {
408631
- const timeoutMs = Math.max(100, options9.timeoutMs ?? DEFAULT_TIMEOUT_MS);
408907
+ const timeoutMs = Math.max(100, options9.timeoutMs ?? DEFAULT_TIMEOUT_MS2);
408632
408908
  const deadlineMs = Date.now() + timeoutMs;
408633
408909
  const logs = [];
408634
408910
  const pendingDeferreds = new Set;
@@ -408724,6 +409000,151 @@ var makeQuickJsExecutor = (options9 = {}) => ({
408724
409000
  execute: (code2, toolInvoker) => runInQuickJs(options9, code2, toolInvoker)
408725
409001
  });
408726
409002
 
409003
+ // packages/runtime-ses/src/index.ts
409004
+ import { fork as fork3 } from "node:child_process";
409005
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
409006
+ var DEFAULT_TIMEOUT_MS3 = 5 * 60000;
409007
+ var DEFAULT_EVALUATION_ID = "evaluation";
409008
+ var WORKER_PATH = fileURLToPath3(new URL("./sandbox-worker.mjs", import.meta.url));
409009
+ var toError3 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
409010
+ var createSandboxWorker = () => fork3(WORKER_PATH, [], { silent: true });
409011
+ var describeWorkerExit = (code2, signal, stderr) => {
409012
+ const stderrSuffix = stderr.trim().length > 0 ? `
409013
+ ${stderr.trim()}` : "";
409014
+ if (signal) {
409015
+ return new Error(`SES worker exited from signal ${signal}${stderrSuffix}`);
409016
+ }
409017
+ if (typeof code2 === "number") {
409018
+ return new Error(`SES worker exited with code ${code2}${stderrSuffix}`);
409019
+ }
409020
+ return new Error(`SES worker exited before returning a result${stderrSuffix}`);
409021
+ };
409022
+ var sendMessage = (child, message) => {
409023
+ if (typeof child.send !== "function") {
409024
+ throw new Error("SES worker IPC channel is unavailable");
409025
+ }
409026
+ child.send(message);
409027
+ };
409028
+ var evaluateInSandbox = async (options9, code2, toolInvoker) => {
409029
+ const child = createSandboxWorker();
409030
+ const timeoutMs = options9.timeoutMs ?? DEFAULT_TIMEOUT_MS3;
409031
+ const stderrChunks = [];
409032
+ if (child.stderr) {
409033
+ child.stderr.on("data", (chunk4) => {
409034
+ stderrChunks.push(chunk4.toString());
409035
+ });
409036
+ }
409037
+ return new Promise((resolve3, reject) => {
409038
+ let settled = false;
409039
+ let timeoutHandle;
409040
+ const cleanup = () => {
409041
+ if (timeoutHandle) {
409042
+ clearTimeout(timeoutHandle);
409043
+ timeoutHandle = undefined;
409044
+ }
409045
+ child.off("error", onError4);
409046
+ child.off("exit", onExit4);
409047
+ child.off("message", onMessage);
409048
+ if (!child.killed) {
409049
+ child.kill();
409050
+ }
409051
+ };
409052
+ const settle = (effect3) => {
409053
+ if (settled) {
409054
+ return;
409055
+ }
409056
+ settled = true;
409057
+ cleanup();
409058
+ effect3();
409059
+ };
409060
+ const resetTimeout = () => {
409061
+ if (timeoutHandle) {
409062
+ clearTimeout(timeoutHandle);
409063
+ }
409064
+ timeoutHandle = setTimeout(() => {
409065
+ settle(() => {
409066
+ reject(new Error(`Execution timed out after ${timeoutMs}ms`));
409067
+ });
409068
+ }, timeoutMs);
409069
+ };
409070
+ const onError4 = (error51) => {
409071
+ settle(() => {
409072
+ reject(error51);
409073
+ });
409074
+ };
409075
+ const onExit4 = (code3, signal) => {
409076
+ settle(() => {
409077
+ reject(describeWorkerExit(code3, signal, stderrChunks.join("")));
409078
+ });
409079
+ };
409080
+ const onMessage = (message) => {
409081
+ if (message.type === "ready") {
409082
+ resetTimeout();
409083
+ sendMessage(child, {
409084
+ type: "evaluate",
409085
+ id: DEFAULT_EVALUATION_ID,
409086
+ code: code2,
409087
+ allowFetch: options9.allowFetch === true
409088
+ });
409089
+ return;
409090
+ }
409091
+ if (message.type === "tool-call") {
409092
+ resetTimeout();
409093
+ runPromise(toolInvoker.invoke({ path: message.path, args: message.args })).then((value7) => {
409094
+ if (settled) {
409095
+ return;
409096
+ }
409097
+ resetTimeout();
409098
+ sendMessage(child, {
409099
+ type: "tool-response",
409100
+ callId: message.callId,
409101
+ value: value7
409102
+ });
409103
+ }).catch((cause2) => {
409104
+ if (settled) {
409105
+ return;
409106
+ }
409107
+ resetTimeout();
409108
+ const error51 = toError3(cause2);
409109
+ sendMessage(child, {
409110
+ type: "tool-response",
409111
+ callId: message.callId,
409112
+ error: error51.stack ?? error51.message
409113
+ });
409114
+ });
409115
+ return;
409116
+ }
409117
+ if (message.type === "result") {
409118
+ settle(() => {
409119
+ if (message.error) {
409120
+ resolve3({
409121
+ result: null,
409122
+ error: message.error,
409123
+ logs: message.logs ?? []
409124
+ });
409125
+ return;
409126
+ }
409127
+ resolve3({
409128
+ result: message.value,
409129
+ logs: message.logs ?? []
409130
+ });
409131
+ });
409132
+ }
409133
+ };
409134
+ child.on("error", onError4);
409135
+ child.on("exit", onExit4);
409136
+ child.on("message", onMessage);
409137
+ resetTimeout();
409138
+ });
409139
+ };
409140
+ var runInSes = (options9, code2, toolInvoker) => tryPromise2({
409141
+ try: () => evaluateInSandbox(options9, code2, toolInvoker),
409142
+ catch: toError3
409143
+ });
409144
+ var makeSesExecutor = (options9 = {}) => ({
409145
+ execute: (code2, toolInvoker) => runInSes(options9, code2, toolInvoker)
409146
+ });
409147
+
408727
409148
  // packages/control-plane/src/runtime/local-config.ts
408728
409149
  import { homedir } from "node:os";
408729
409150
  import { basename, dirname as dirname2, isAbsolute, join as join5, resolve as resolve3 } from "node:path";
@@ -409721,6 +410142,7 @@ var mergeLocalExecutorConfigs = (base, extra) => {
409721
410142
  return null;
409722
410143
  }
409723
410144
  return decodeLocalExecutorConfig({
410145
+ runtime: extra?.runtime ?? base?.runtime,
409724
410146
  workspace: {
409725
410147
  ...base?.workspace ?? {},
409726
410148
  ...extra?.workspace ?? {}
@@ -411090,7 +411512,7 @@ var createExecutorToolMap = (input) => ({
411090
411512
  });
411091
411513
 
411092
411514
  // packages/control-plane/src/runtime/mcp-oauth.ts
411093
- var toError3 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
411515
+ var toError4 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
411094
411516
  var toJsonObject = (value7) => value7 !== null && value7 !== undefined && typeof value7 === "object" && !Array.isArray(value7) ? value7 : null;
411095
411517
  var createClientMetadata = (redirectUrl) => ({
411096
411518
  redirect_uris: [redirectUrl],
@@ -411140,7 +411562,7 @@ var startMcpOAuthAuthorization = (input) => gen2(function* () {
411140
411562
  try: () => auth2(provider, {
411141
411563
  serverUrl: input.endpoint
411142
411564
  }),
411143
- catch: toError3
411565
+ catch: toError4
411144
411566
  });
411145
411567
  if (result !== "REDIRECT" || !captured.authorizationUrl || !captured.codeVerifier) {
411146
411568
  return yield* fail8(new Error("OAuth flow did not produce an authorization redirect"));
@@ -411199,7 +411621,7 @@ var exchangeMcpOAuthAuthorizationCode = (input) => gen2(function* () {
411199
411621
  serverUrl: input.session.endpoint,
411200
411622
  authorizationCode: input.code
411201
411623
  }),
411202
- catch: toError3
411624
+ catch: toError4
411203
411625
  });
411204
411626
  if (result !== "AUTHORIZED" || !captured.tokens) {
411205
411627
  return yield* fail8(new Error("OAuth redirect did not complete MCP OAuth setup"));
@@ -411216,7 +411638,7 @@ var exchangeMcpOAuthAuthorizationCode = (input) => gen2(function* () {
411216
411638
 
411217
411639
  // packages/control-plane/src/runtime/secret-material-providers.ts
411218
411640
  import { randomUUID } from "node:crypto";
411219
- import { spawn } from "node:child_process";
411641
+ import { spawn as spawn2 } from "node:child_process";
411220
411642
  import { promises as fs2 } from "node:fs";
411221
411643
  import { lstatSync, realpathSync } from "node:fs";
411222
411644
  import { isAbsolute as isAbsolute2 } from "node:path";
@@ -411294,7 +411716,7 @@ var keychainCommandForPlatform = (platform = process.platform) => {
411294
411716
  };
411295
411717
  var runCommand = (input) => tryPromise2({
411296
411718
  try: () => new Promise((resolve4, reject) => {
411297
- const child = spawn(input.command, [...input.args], {
411719
+ const child = spawn2(input.command, [...input.args], {
411298
411720
  stdio: "pipe",
411299
411721
  env: input.env
411300
411722
  });
@@ -411361,7 +411783,7 @@ var commandExists = (command) => tryPromise2({
411361
411783
  return cached5;
411362
411784
  }
411363
411785
  const probe = new Promise((resolve4) => {
411364
- const child = spawn(command, ["--help"], {
411786
+ const child = spawn2(command, ["--help"], {
411365
411787
  stdio: "ignore"
411366
411788
  });
411367
411789
  const timeout3 = setTimeout(() => {
@@ -417885,9 +418307,9 @@ var removePolicy = (input) => gen2(function* () {
417885
418307
 
417886
418308
  // packages/control-plane/src/runtime/local-tools.ts
417887
418309
  import { createHash as createHash5 } from "node:crypto";
417888
- import { existsSync } from "node:fs";
418310
+ import { existsSync as existsSync2 } from "node:fs";
417889
418311
  import { dirname as dirname3, extname, join as join9, relative, resolve as resolve4, sep } from "node:path";
417890
- import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
418312
+ import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "node:url";
417891
418313
  var ts = __toESM(require_typescript(), 1);
417892
418314
  var SUPPORTED_LOCAL_TOOL_EXTENSIONS = new Set([".ts", ".js", ".mjs"]);
417893
418315
  var LOCAL_TOOLS_DIRECTORY = "tools";
@@ -418032,10 +418454,10 @@ var transpileSourceFile = (input) => gen2(function* () {
418032
418454
  return rewriteRelativeImportSpecifiers(transpiled.outputText);
418033
418455
  });
418034
418456
  var resolveExecutorNodeModulesDirectory = () => {
418035
- let current = dirname3(fileURLToPath2(import.meta.url));
418457
+ let current = dirname3(fileURLToPath4(import.meta.url));
418036
418458
  while (true) {
418037
418459
  const candidate = join9(current, "node_modules");
418038
- if (existsSync(candidate)) {
418460
+ if (existsSync2(candidate)) {
418039
418461
  return candidate;
418040
418462
  }
418041
418463
  const parent = dirname3(current);
@@ -418209,6 +418631,19 @@ var LocalToolRuntimeLoaderLive = effect(LocalToolRuntimeLoaderService, gen2(func
418209
418631
 
418210
418632
  // packages/control-plane/src/runtime/workspace-execution-environment.ts
418211
418633
  var asToolPath4 = (value7) => value7;
418634
+ var DEFAULT_EXECUTION_RUNTIME = "quickjs";
418635
+ var resolveConfiguredExecutionRuntime = (config3) => config3?.runtime ?? DEFAULT_EXECUTION_RUNTIME;
418636
+ var createCodeExecutorForRuntime = (runtime5) => {
418637
+ switch (runtime5) {
418638
+ case "deno":
418639
+ return makeDenoSubprocessExecutor();
418640
+ case "ses":
418641
+ return makeSesExecutor();
418642
+ case "quickjs":
418643
+ default:
418644
+ return makeQuickJsExecutor();
418645
+ }
418646
+ };
418212
418647
  var tokenize2 = (value7) => value7.trim().toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
418213
418648
  var LOW_SIGNAL_QUERY_TOKENS = new Set([
418214
418649
  "a",
@@ -418549,6 +418984,7 @@ var createWorkspaceToolInvoker = (input) => {
418549
418984
  };
418550
418985
  var createWorkspaceExecutionEnvironmentResolver = (input) => ({ workspaceId, accountId, onElicitation }) => gen2(function* () {
418551
418986
  const runtimeLocalWorkspace = yield* getRuntimeLocalWorkspaceOption();
418987
+ const loadedConfig = runtimeLocalWorkspace === null ? null : yield* input.workspaceConfigStore.load(runtimeLocalWorkspace.context);
418552
418988
  const localToolRuntime = runtimeLocalWorkspace === null ? {
418553
418989
  tools: {},
418554
418990
  catalog: createToolCatalogFromTools({ tools: {} }),
@@ -418568,7 +419004,7 @@ var createWorkspaceExecutionEnvironmentResolver = (input) => ({ workspaceId, acc
418568
419004
  localToolRuntime,
418569
419005
  onElicitation
418570
419006
  });
418571
- const executor = makeQuickJsExecutor();
419007
+ const executor = createCodeExecutorForRuntime(resolveConfiguredExecutionRuntime(loadedConfig?.config));
418572
419008
  return {
418573
419009
  executor,
418574
419010
  toolInvoker,
@@ -419837,7 +420273,7 @@ import { pathToFileURL as pathToFileURL4 } from "url";
419837
420273
  import assert32 from "assert";
419838
420274
  import { statSync, realpathSync as realpathSync2 } from "fs";
419839
420275
  import process4 from "process";
419840
- import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL3 } from "url";
420276
+ import { fileURLToPath as fileURLToPath42, pathToFileURL as pathToFileURL3 } from "url";
419841
420277
  import path7 from "path";
419842
420278
  import { builtinModules } from "module";
419843
420279
  import { fileURLToPath as fileURLToPath32 } from "url";
@@ -421083,7 +421519,7 @@ var utils = {
421083
421519
  // node_modules/prettier/index.mjs
421084
421520
  import { equal, ok, strictEqual } from "assert";
421085
421521
  import path11 from "path";
421086
- import { fileURLToPath as fileURLToPath5 } from "url";
421522
+ import { fileURLToPath as fileURLToPath52 } from "url";
421087
421523
  import path13 from "path";
421088
421524
  import { pathToFileURL as pathToFileURL5 } from "url";
421089
421525
  import path12 from "path";
@@ -433602,9 +434038,9 @@ function emitInvalidSegmentDeprecation(target, request, match18, packageJsonUrl,
433602
434038
  if (process4.noDeprecation) {
433603
434039
  return;
433604
434040
  }
433605
- const pjsonPath = fileURLToPath4(packageJsonUrl);
434041
+ const pjsonPath = fileURLToPath42(packageJsonUrl);
433606
434042
  const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null;
433607
- process4.emitWarning(`Use of deprecated ${double ? "double slash" : "leading or trailing slash matching"} resolving "${target}" for module request "${request}" ${request === match18 ? "" : `matched to "${match18}" `}in the "${internal ? "imports" : "exports"}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath4(base)}` : ""}.`, "DeprecationWarning", "DEP0166");
434043
+ process4.emitWarning(`Use of deprecated ${double ? "double slash" : "leading or trailing slash matching"} resolving "${target}" for module request "${request}" ${request === match18 ? "" : `matched to "${match18}" `}in the "${internal ? "imports" : "exports"}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath42(base)}` : ""}.`, "DeprecationWarning", "DEP0166");
433608
434044
  }
433609
434045
  function emitLegacyIndexDeprecation(url32, packageJsonUrl, base, main) {
433610
434046
  if (process4.noDeprecation) {
@@ -433613,9 +434049,9 @@ function emitLegacyIndexDeprecation(url32, packageJsonUrl, base, main) {
433613
434049
  const format32 = defaultGetFormatWithoutErrors(url32, { parentURL: base.href });
433614
434050
  if (format32 !== "module")
433615
434051
  return;
433616
- const urlPath = fileURLToPath4(url32.href);
433617
- const packagePath = fileURLToPath4(new URL(".", packageJsonUrl));
433618
- const basePath = fileURLToPath4(base);
434052
+ const urlPath = fileURLToPath42(url32.href);
434053
+ const packagePath = fileURLToPath42(new URL(".", packageJsonUrl));
434054
+ const basePath = fileURLToPath42(base);
433619
434055
  if (!main) {
433620
434056
  process4.emitWarning(`No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(packagePath.length)}", imported from ${basePath}.
433621
434057
  Default "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
@@ -433672,15 +434108,15 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
433672
434108
  emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);
433673
434109
  return guess;
433674
434110
  }
433675
- throw new ERR_MODULE_NOT_FOUND(fileURLToPath4(new URL(".", packageJsonUrl)), fileURLToPath4(base));
434111
+ throw new ERR_MODULE_NOT_FOUND(fileURLToPath42(new URL(".", packageJsonUrl)), fileURLToPath42(base));
433676
434112
  }
433677
434113
  function finalizeResolution(resolved, base, preserveSymlinks) {
433678
434114
  if (encodedSeparatorRegEx.exec(resolved.pathname) !== null) {
433679
- throw new ERR_INVALID_MODULE_SPECIFIER(resolved.pathname, 'must not include encoded "/" or "\\" characters', fileURLToPath4(base));
434115
+ throw new ERR_INVALID_MODULE_SPECIFIER(resolved.pathname, 'must not include encoded "/" or "\\" characters', fileURLToPath42(base));
433680
434116
  }
433681
434117
  let filePath;
433682
434118
  try {
433683
- filePath = fileURLToPath4(resolved);
434119
+ filePath = fileURLToPath42(resolved);
433684
434120
  } catch (error51) {
433685
434121
  const cause2 = error51;
433686
434122
  Object.defineProperty(cause2, "input", { value: String(resolved) });
@@ -433689,12 +434125,12 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
433689
434125
  }
433690
434126
  const stats = tryStatSync(filePath.endsWith("/") ? filePath.slice(-1) : filePath);
433691
434127
  if (stats && stats.isDirectory()) {
433692
- const error51 = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath4(base));
434128
+ const error51 = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath42(base));
433693
434129
  error51.url = String(resolved);
433694
434130
  throw error51;
433695
434131
  }
433696
434132
  if (!stats || !stats.isFile()) {
433697
- const error51 = new ERR_MODULE_NOT_FOUND(filePath || resolved.pathname, base && fileURLToPath4(base), true);
434133
+ const error51 = new ERR_MODULE_NOT_FOUND(filePath || resolved.pathname, base && fileURLToPath42(base), true);
433698
434134
  error51.url = String(resolved);
433699
434135
  throw error51;
433700
434136
  }
@@ -433708,18 +434144,18 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
433708
434144
  return resolved;
433709
434145
  }
433710
434146
  function importNotDefined(specifier, packageJsonUrl, base) {
433711
- return new ERR_PACKAGE_IMPORT_NOT_DEFINED(specifier, packageJsonUrl && fileURLToPath4(new URL(".", packageJsonUrl)), fileURLToPath4(base));
434147
+ return new ERR_PACKAGE_IMPORT_NOT_DEFINED(specifier, packageJsonUrl && fileURLToPath42(new URL(".", packageJsonUrl)), fileURLToPath42(base));
433712
434148
  }
433713
434149
  function exportsNotFound(subpath, packageJsonUrl, base) {
433714
- return new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath4(new URL(".", packageJsonUrl)), subpath, base && fileURLToPath4(base));
434150
+ return new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath42(new URL(".", packageJsonUrl)), subpath, base && fileURLToPath42(base));
433715
434151
  }
433716
434152
  function throwInvalidSubpath(request, match18, packageJsonUrl, internal, base) {
433717
- const reason = `request is not a valid match in pattern "${match18}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath4(packageJsonUrl)}`;
433718
- throw new ERR_INVALID_MODULE_SPECIFIER(request, reason, base && fileURLToPath4(base));
434153
+ const reason = `request is not a valid match in pattern "${match18}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath42(packageJsonUrl)}`;
434154
+ throw new ERR_INVALID_MODULE_SPECIFIER(request, reason, base && fileURLToPath42(base));
433719
434155
  }
433720
434156
  function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) {
433721
434157
  target = typeof target === "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`;
433722
- return new ERR_INVALID_PACKAGE_TARGET(fileURLToPath4(new URL(".", packageJsonUrl)), subpath, target, internal, base && fileURLToPath4(base));
434158
+ return new ERR_INVALID_PACKAGE_TARGET(fileURLToPath42(new URL(".", packageJsonUrl)), subpath, target, internal, base && fileURLToPath42(base));
433723
434159
  }
433724
434160
  function resolvePackageTargetString(target, subpath, match18, packageJsonUrl, base, pattern2, internal, isPathMap, conditions) {
433725
434161
  if (subpath !== "" && !pattern2 && target[target.length - 1] !== "/")
@@ -433819,7 +434255,7 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
433819
434255
  while (++i5 < keys6.length) {
433820
434256
  const key2 = keys6[i5];
433821
434257
  if (isArrayIndex(key2)) {
433822
- throw new ERR_INVALID_PACKAGE_CONFIG2(fileURLToPath4(packageJsonUrl), base, '"exports" cannot contain numeric property keys.');
434258
+ throw new ERR_INVALID_PACKAGE_CONFIG2(fileURLToPath42(packageJsonUrl), base, '"exports" cannot contain numeric property keys.');
433823
434259
  }
433824
434260
  }
433825
434261
  i5 = -1;
@@ -433855,7 +434291,7 @@ function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
433855
434291
  if (i5++ === 0) {
433856
434292
  isConditionalSugar = currentIsConditionalSugar;
433857
434293
  } else if (isConditionalSugar !== currentIsConditionalSugar) {
433858
- throw new ERR_INVALID_PACKAGE_CONFIG2(fileURLToPath4(packageJsonUrl), base, `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`);
434294
+ throw new ERR_INVALID_PACKAGE_CONFIG2(fileURLToPath42(packageJsonUrl), base, `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`);
433859
434295
  }
433860
434296
  }
433861
434297
  return isConditionalSugar;
@@ -433864,11 +434300,11 @@ function emitTrailingSlashPatternDeprecation(match18, pjsonUrl, base) {
433864
434300
  if (process4.noDeprecation) {
433865
434301
  return;
433866
434302
  }
433867
- const pjsonPath = fileURLToPath4(pjsonUrl);
434303
+ const pjsonPath = fileURLToPath42(pjsonUrl);
433868
434304
  if (emittedPackageWarnings.has(pjsonPath + "|" + match18))
433869
434305
  return;
433870
434306
  emittedPackageWarnings.add(pjsonPath + "|" + match18);
433871
- process4.emitWarning(`Use of deprecated trailing slash pattern mapping "${match18}" in the "exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath4(base)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`, "DeprecationWarning", "DEP0155");
434307
+ process4.emitWarning(`Use of deprecated trailing slash pattern mapping "${match18}" in the "exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath42(base)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`, "DeprecationWarning", "DEP0155");
433872
434308
  }
433873
434309
  function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {
433874
434310
  let exports = packageConfig.exports;
@@ -433933,7 +434369,7 @@ function patternKeyCompare(a5, b5) {
433933
434369
  function packageImportsResolve(name2, base, conditions) {
433934
434370
  if (name2 === "#" || name2.startsWith("#/") || name2.endsWith("/")) {
433935
434371
  const reason = "is not a valid internal imports specifier name";
433936
- throw new ERR_INVALID_MODULE_SPECIFIER(name2, reason, fileURLToPath4(base));
434372
+ throw new ERR_INVALID_MODULE_SPECIFIER(name2, reason, fileURLToPath42(base));
433937
434373
  }
433938
434374
  let packageJsonUrl;
433939
434375
  const packageConfig = getPackageScopeConfig(base);
@@ -433991,7 +434427,7 @@ function parsePackageName(specifier, base) {
433991
434427
  validPackageName = false;
433992
434428
  }
433993
434429
  if (!validPackageName) {
433994
- throw new ERR_INVALID_MODULE_SPECIFIER(specifier, "is not a valid package name", fileURLToPath4(base));
434430
+ throw new ERR_INVALID_MODULE_SPECIFIER(specifier, "is not a valid package name", fileURLToPath42(base));
433995
434431
  }
433996
434432
  const packageSubpath = "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex));
433997
434433
  return { packageName, packageSubpath, isScoped };
@@ -434009,14 +434445,14 @@ function packageResolve(specifier, base, conditions) {
434009
434445
  }
434010
434446
  }
434011
434447
  let packageJsonUrl = new URL("./node_modules/" + packageName + "/package.json", base);
434012
- let packageJsonPath = fileURLToPath4(packageJsonUrl);
434448
+ let packageJsonPath = fileURLToPath42(packageJsonUrl);
434013
434449
  let lastPath;
434014
434450
  do {
434015
434451
  const stat22 = tryStatSync(packageJsonPath.slice(0, -13));
434016
434452
  if (!stat22 || !stat22.isDirectory()) {
434017
434453
  lastPath = packageJsonPath;
434018
434454
  packageJsonUrl = new URL((isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", packageJsonUrl);
434019
- packageJsonPath = fileURLToPath4(packageJsonUrl);
434455
+ packageJsonPath = fileURLToPath42(packageJsonUrl);
434020
434456
  continue;
434021
434457
  }
434022
434458
  const packageConfig2 = read22(packageJsonPath, { base, specifier });
@@ -434028,7 +434464,7 @@ function packageResolve(specifier, base, conditions) {
434028
434464
  }
434029
434465
  return new URL(packageSubpath, packageJsonUrl);
434030
434466
  } while (packageJsonPath.length !== lastPath.length);
434031
- throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath4(base), false);
434467
+ throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath42(base), false);
434032
434468
  }
434033
434469
  function isRelativeSpecifier(specifier) {
434034
434470
  if (specifier[0] === ".") {
@@ -435721,7 +436157,7 @@ function getLanguageByIsSupported(languages2, file10) {
435721
436157
  }
435722
436158
  if (isUrl(file10)) {
435723
436159
  try {
435724
- file10 = fileURLToPath5(file10);
436160
+ file10 = fileURLToPath52(file10);
435725
436161
  } catch {
435726
436162
  return;
435727
436163
  }
@@ -440147,7 +440583,7 @@ var ControlPlaneApiLive = exports_HttpApiBuilder.api(ControlPlaneApi).pipe(provi
440147
440583
  var createControlPlaneApiLayer = (runtimeLayer) => ControlPlaneApiLive.pipe(provide3(runtimeLayer));
440148
440584
  // packages/control-plane/src/runtime/local-control-plane-store.ts
440149
440585
  import { randomUUID as randomUUID2 } from "node:crypto";
440150
- import { existsSync as existsSync2 } from "node:fs";
440586
+ import { existsSync as existsSync3 } from "node:fs";
440151
440587
  import { mkdir as mkdir2, readFile as readFile4, rename as rename5, writeFile as writeFile3 } from "node:fs/promises";
440152
440588
  import { dirname as dirname6, join as join12 } from "node:path";
440153
440589
  var LOCAL_CONTROL_PLANE_STATE_VERSION = 1;
@@ -440213,7 +440649,7 @@ var sortByUpdatedAtAndIdDesc = (values4) => [...values4].sort((left3, right3) =>
440213
440649
  var localControlPlaneStatePath = (context7) => join12(context7.homeStateDirectory, "workspaces", deriveLocalInstallation(context7).workspaceId, LOCAL_CONTROL_PLANE_STATE_BASENAME);
440214
440650
  var readStateFromDisk = async (context7) => {
440215
440651
  const path15 = localControlPlaneStatePath(context7);
440216
- if (!existsSync2(path15)) {
440652
+ if (!existsSync3(path15)) {
440217
440653
  return defaultLocalControlPlaneState();
440218
440654
  }
440219
440655
  const content = await readFile4(path15, "utf8");
@@ -440674,7 +441110,7 @@ var createLocalControlPlanePersistence = (context7) => ({
440674
441110
  });
440675
441111
 
440676
441112
  // packages/control-plane/src/runtime/legacy-postgres-migration.ts
440677
- import { existsSync as existsSync4, readFileSync } from "node:fs";
441113
+ import { existsSync as existsSync5, readFileSync } from "node:fs";
440678
441114
  import { mkdir as mkdir3, rename as rename6, unlink } from "node:fs/promises";
440679
441115
  import { join as join14, resolve as resolve7 } from "node:path";
440680
441116
 
@@ -448268,7 +448704,7 @@ var trimOrNull8 = (value7) => {
448268
448704
  const trimmed2 = value7.trim();
448269
448705
  return trimmed2.length > 0 ? trimmed2 : null;
448270
448706
  };
448271
- var toError4 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
448707
+ var toError5 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
448272
448708
  var asRecord7 = (value7) => value7 !== null && typeof value7 === "object" && !Array.isArray(value7) ? value7 : {};
448273
448709
  var asString8 = (value7) => {
448274
448710
  const trimmed2 = trimOrNull8(value7);
@@ -448492,7 +448928,7 @@ var isPostgresUrl = (value7) => {
448492
448928
  };
448493
448929
  var cleanupStalePGliteLock = async (dataDir) => {
448494
448930
  const lockPath = join14(dataDir, "postmaster.pid");
448495
- if (!existsSync4(lockPath)) {
448931
+ if (!existsSync5(lockPath)) {
448496
448932
  return;
448497
448933
  }
448498
448934
  try {
@@ -448512,7 +448948,7 @@ var openLegacyPGliteClient = async (localDataDir) => {
448512
448948
  return null;
448513
448949
  }
448514
448950
  const resolvedDataDir = resolve7(localDataDir);
448515
- if (!existsSync4(resolvedDataDir)) {
448951
+ if (!existsSync5(resolvedDataDir)) {
448516
448952
  return null;
448517
448953
  }
448518
448954
  await mkdir3(resolvedDataDir, { recursive: true });
@@ -448613,7 +449049,7 @@ var backupLegacyPGliteDataDir = async (localDataDir) => {
448613
449049
  return null;
448614
449050
  }
448615
449051
  const resolvedDataDir = resolve7(localDataDir);
448616
- if (!existsSync4(resolvedDataDir)) {
449052
+ if (!existsSync5(resolvedDataDir)) {
448617
449053
  return null;
448618
449054
  }
448619
449055
  const backupPath = `${resolvedDataDir}.migrated-backup-${Date.now()}`;
@@ -448670,7 +449106,7 @@ var tryLoadLegacyWorkspaceSnapshot = async (input) => {
448670
449106
  };
448671
449107
  var targetControlPlaneStatePath = (context7) => join14(context7.homeStateDirectory, "workspaces", deriveLocalInstallation(context7).workspaceId, LOCAL_CONTROL_PLANE_STATE_BASENAME2);
448672
449108
  var targetWorkspaceStatePath = (context7) => join14(context7.stateDirectory, WORKSPACE_STATE_BASENAME2);
448673
- var workspaceAlreadyInitialized = (context7) => existsSync4(context7.projectConfigPath) || existsSync4(targetWorkspaceStatePath(context7)) || existsSync4(targetControlPlaneStatePath(context7));
449109
+ var workspaceAlreadyInitialized = (context7) => existsSync5(context7.projectConfigPath) || existsSync5(targetWorkspaceStatePath(context7)) || existsSync5(targetControlPlaneStatePath(context7));
448674
449110
  var mapLegacySecretRef = (input) => ({
448675
449111
  providerId: input.providerId === LEGACY_POSTGRES_SECRET_PROVIDER_ID ? LOCAL_SECRET_PROVIDER_ID2 : input.providerId,
448676
449112
  handle: input.handle
@@ -449221,7 +449657,7 @@ var migrateLegacyPostgresWorkspaceIfNeeded = (input) => gen2(function* () {
449221
449657
  localDataDir: input.legacyLocalDataDir,
449222
449658
  databaseUrl: input.legacyDatabaseUrl
449223
449659
  }),
449224
- catch: toError4
449660
+ catch: toError5
449225
449661
  });
449226
449662
  if (loadedSnapshot === null) {
449227
449663
  return;
@@ -449231,7 +449667,7 @@ var migrateLegacyPostgresWorkspaceIfNeeded = (input) => gen2(function* () {
449231
449667
  context: input.context,
449232
449668
  snapshot: loadedSnapshot.snapshot
449233
449669
  }),
449234
- catch: toError4
449670
+ catch: toError5
449235
449671
  });
449236
449672
  yield* writeProjectLocalExecutorConfig({
449237
449673
  context: input.context,
@@ -449254,7 +449690,7 @@ var migrateLegacyPostgresWorkspaceIfNeeded = (input) => gen2(function* () {
449254
449690
  const legacyLocalDataDir = loadedSnapshot.source.localDataDir;
449255
449691
  const backupExit = yield* exit2(tryPromise2({
449256
449692
  try: () => backupLegacyPGliteDataDir(legacyLocalDataDir),
449257
- catch: toError4
449693
+ catch: toError5
449258
449694
  }));
449259
449695
  yield* sync3(() => {
449260
449696
  if (backupExit._tag === "Success" && backupExit.value !== null) {
@@ -449359,7 +449795,7 @@ var createControlPlaneClient = (input) => exports_HttpApiClient.make(ControlPlan
449359
449795
  baseUrl: input.baseUrl
449360
449796
  }).pipe(provide2(exports_FetchHttpClient.layer));
449361
449797
  // packages/server/src/index.ts
449362
- import { existsSync as existsSync6 } from "node:fs";
449798
+ import { existsSync as existsSync7 } from "node:fs";
449363
449799
  import { mkdir as mkdir4, readFile as readFile5, rename as rename7, rm as rm4, stat as stat4, writeFile as writeFile4 } from "node:fs/promises";
449364
449800
  import {
449365
449801
  createServer as createNodeServer
@@ -451589,7 +452025,7 @@ import { homedir as homedir2 } from "node:os";
451589
452025
  import { join as join16 } from "node:path";
451590
452026
 
451591
452027
  // packages/server/src/env.ts
451592
- import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
452028
+ import { existsSync as existsSync6, readFileSync as readFileSync2 } from "node:fs";
451593
452029
  import { dirname as dirname7, join as join15, resolve as resolve8 } from "node:path";
451594
452030
  var parseEnvFile = (content) => {
451595
452031
  const values5 = {};
@@ -451621,7 +452057,7 @@ var parseEnvFile = (content) => {
451621
452057
  };
451622
452058
  var isWorkspaceRoot = (directory5) => {
451623
452059
  const packageJsonPath = join15(directory5, "package.json");
451624
- if (!existsSync5(packageJsonPath)) {
452060
+ if (!existsSync6(packageJsonPath)) {
451625
452061
  return false;
451626
452062
  }
451627
452063
  try {
@@ -451658,7 +452094,7 @@ var loadMonorepoRootEnv = (options10 = {}) => {
451658
452094
  const loadedFiles = [];
451659
452095
  for (const fileName of [".env", ".env.local"]) {
451660
452096
  const filePath = join15(rootDir, fileName);
451661
- if (!existsSync5(filePath)) {
452097
+ if (!existsSync6(filePath)) {
451662
452098
  continue;
451663
452099
  }
451664
452100
  const parsed = parseEnvFile(readFileSync2(filePath, "utf8"));
@@ -452320,7 +452756,7 @@ var createRuntime = (localDataDir, getLocalServerBaseUrl, options10) => createCo
452320
452756
  var moveLegacyLocalDataDir = (legacyLocalDataDir, requestedLocalDataDir) => tryPromise2({
452321
452757
  try: async () => {
452322
452758
  await mkdir4(dirname8(requestedLocalDataDir), { recursive: true });
452323
- if (existsSync6(requestedLocalDataDir)) {
452759
+ if (existsSync7(requestedLocalDataDir)) {
452324
452760
  const backupPath = `${requestedLocalDataDir}.backup-${Date.now()}`;
452325
452761
  await rename7(requestedLocalDataDir, backupPath);
452326
452762
  console.warn(`[executor] Backed up unreadable local data dir to: ${backupPath}`);
@@ -452331,7 +452767,7 @@ var moveLegacyLocalDataDir = (legacyLocalDataDir, requestedLocalDataDir) => tryP
452331
452767
  catch: (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2))
452332
452768
  });
452333
452769
  var createRuntimeWithLegacyMigration = (requestedLocalDataDir, legacyLocalDataDirs, getLocalServerBaseUrl, options10) => gen2(function* () {
452334
- if (requestedLocalDataDir !== ":memory:" && !existsSync6(requestedLocalDataDir) && legacyLocalDataDirs.length > 0) {
452770
+ if (requestedLocalDataDir !== ":memory:" && !existsSync7(requestedLocalDataDir) && legacyLocalDataDirs.length > 0) {
452335
452771
  for (const legacyLocalDataDir of legacyLocalDataDirs) {
452336
452772
  const legacyExit = yield* exit2(createRuntime(legacyLocalDataDir, getLocalServerBaseUrl, options10));
452337
452773
  if (isFailure(legacyExit)) {
@@ -452491,7 +452927,7 @@ var isApiRequest = (request) => {
452491
452927
  };
452492
452928
  var createLocalExecutorRequestHandler = (options10 = {}) => gen2(function* () {
452493
452929
  const requestedLocalDataDir = options10.localDataDir ?? DEFAULT_LOCAL_DATA_DIR;
452494
- const legacyLocalDataDirs = options10.localDataDir === undefined ? DEFAULT_LEGACY_LOCAL_DATA_DIRS.filter((candidate) => existsSync6(candidate)) : [];
452930
+ const legacyLocalDataDirs = options10.localDataDir === undefined ? DEFAULT_LEGACY_LOCAL_DATA_DIRS.filter((candidate) => existsSync7(candidate)) : [];
452495
452931
  if (requestedLocalDataDir !== ":memory:") {
452496
452932
  yield* tryPromise2({
452497
452933
  try: () => mkdir4(dirname8(requestedLocalDataDir), { recursive: true }),
@@ -452763,7 +453199,7 @@ var seedGithubOpenApiSourceInWorkspace = (input) => gen2(function* () {
452763
453199
  });
452764
453200
 
452765
453201
  // apps/executor/src/cli/runtime-paths.ts
452766
- import { existsSync as existsSync7 } from "node:fs";
453202
+ import { existsSync as existsSync8 } from "node:fs";
452767
453203
  import { dirname as dirname9, extname as extname4, resolve as resolve10 } from "node:path";
452768
453204
  import { fileURLToPath as fileURLToPath6 } from "node:url";
452769
453205
  var sourceDir = dirname9(fileURLToPath6(import.meta.url));
@@ -452777,7 +453213,7 @@ var resolveIfExists = (value7) => {
452777
453213
  return null;
452778
453214
  }
452779
453215
  const resolved = resolve10(candidate);
452780
- return existsSync7(resolved) ? resolved : null;
453216
+ return existsSync8(resolved) ? resolved : null;
452781
453217
  };
452782
453218
  var getSourceEntrypoint = () => {
452783
453219
  const candidate = trim4(process.argv[1]);
@@ -452790,21 +453226,21 @@ var getSourceEntrypoint = () => {
452790
453226
  };
452791
453227
  var resolveBundledNodeLauncher = () => {
452792
453228
  const candidate = resolve10(sourceDir, "executor.js");
452793
- return existsSync7(candidate) ? candidate : null;
453229
+ return existsSync8(candidate) ? candidate : null;
452794
453230
  };
452795
453231
  var resolveRuntimeResourcesRoot = () => {
452796
453232
  const compiledCandidate = resolve10(dirname9(process.execPath), "../resources");
452797
- if (existsSync7(compiledCandidate)) {
453233
+ if (existsSync8(compiledCandidate)) {
452798
453234
  return compiledCandidate;
452799
453235
  }
452800
453236
  const bundledCandidateFromModule = resolve10(sourceDir, "../resources");
452801
- if (existsSync7(bundledCandidateFromModule)) {
453237
+ if (existsSync8(bundledCandidateFromModule)) {
452802
453238
  return bundledCandidateFromModule;
452803
453239
  }
452804
453240
  const sourceEntrypoint = getSourceEntrypoint();
452805
453241
  if (sourceEntrypoint) {
452806
453242
  const bundledCandidate = resolve10(dirname9(sourceEntrypoint), "../resources");
452807
- if (existsSync7(bundledCandidate)) {
453243
+ if (existsSync8(bundledCandidate)) {
452808
453244
  return bundledCandidate;
452809
453245
  }
452810
453246
  }
@@ -452923,12 +453359,12 @@ var decideInteractionHandling = (input) => {
452923
453359
  };
452924
453360
 
452925
453361
  // apps/executor/src/cli/main.ts
452926
- var toError5 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
453362
+ var toError6 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
452927
453363
  var sleep6 = (ms8) => promise2(() => new Promise((resolve12) => setTimeout(resolve12, ms8)));
452928
453364
  var openUrlInBrowser = (url4) => sync3(() => {
452929
453365
  const cmd = process.platform === "darwin" ? ["open", url4] : process.platform === "win32" ? ["cmd", "/c", "start", "", url4] : ["xdg-open", url4];
452930
453366
  try {
452931
- const child = spawn2(cmd[0], cmd.slice(1), {
453367
+ const child = spawn3(cmd[0], cmd.slice(1), {
452932
453368
  detached: true,
452933
453369
  stdio: "ignore"
452934
453370
  });
@@ -452950,7 +453386,7 @@ var promptLine = (prompt4) => tryPromise2({
452950
453386
  rl5.close();
452951
453387
  }
452952
453388
  },
452953
- catch: toError5
453389
+ catch: toError6
452954
453390
  });
452955
453391
  var readStdin = () => tryPromise2({
452956
453392
  try: async () => {
@@ -452961,7 +453397,7 @@ var readStdin = () => tryPromise2({
452961
453397
  }
452962
453398
  return contents;
452963
453399
  },
452964
- catch: toError5
453400
+ catch: toError6
452965
453401
  });
452966
453402
  var readCode = (input) => gen2(function* () {
452967
453403
  if (input.code && input.code.trim().length > 0) {
@@ -452970,7 +453406,7 @@ var readCode = (input) => gen2(function* () {
452970
453406
  if (input.file && input.file.trim().length > 0) {
452971
453407
  const contents = yield* tryPromise2({
452972
453408
  try: () => readFile6(input.file, "utf8"),
452973
- catch: toError5
453409
+ catch: toError6
452974
453410
  });
452975
453411
  if (contents.trim().length > 0) {
452976
453412
  return contents;
@@ -452987,7 +453423,7 @@ var readCode = (input) => gen2(function* () {
452987
453423
  });
452988
453424
  var getBootstrapClient = (baseUrl2 = DEFAULT_SERVER_BASE_URL) => createControlPlaneClient({ baseUrl: baseUrl2 });
452989
453425
  var decodeExecutionId = decodeUnknown2(ExecutionIdSchema);
452990
- var cliSourceDir = dirname10(fileURLToPath8(import.meta.url));
453426
+ var cliSourceDir = dirname10(fileURLToPath7(import.meta.url));
452991
453427
  var CLI_NAME = "executor";
452992
453428
  var CLI_VERSION = (() => {
452993
453429
  const candidatePaths = [
@@ -452995,7 +453431,7 @@ var CLI_VERSION = (() => {
452995
453431
  resolve11(cliSourceDir, "../../package.json")
452996
453432
  ];
452997
453433
  for (const candidatePath of candidatePaths) {
452998
- if (!existsSync8(candidatePath)) {
453434
+ if (!existsSync9(candidatePath)) {
452999
453435
  continue;
453000
453436
  }
453001
453437
  try {
@@ -453063,17 +453499,17 @@ var formatCatalogUnavailableMessage = (cause2) => {
453063
453499
  };
453064
453500
  var closeRuntime = (runtime6) => tryPromise2({
453065
453501
  try: () => runtime6.close(),
453066
- catch: toError5
453502
+ catch: toError6
453067
453503
  }).pipe(catchAll2(() => _void));
453068
453504
  var buildRunWorkflowText = (catalog2) => {
453069
453505
  if (!catalog2) {
453070
453506
  return succeed8(DEFAULT_RUN_WORKFLOW);
453071
453507
  }
453072
- return catalog2.listNamespaces({ limit: 200 }).pipe(map16((namespaces) => buildWorkflowText(namespaces.length > 0 ? namespaces.map((namespace) => namespace.displayName ?? namespace.namespace) : ["none discovered yet"])), mapError2(toError5));
453508
+ return catalog2.listNamespaces({ limit: 200 }).pipe(map16((namespaces) => buildWorkflowText(namespaces.length > 0 ? namespaces.map((namespace) => namespace.displayName ?? namespace.namespace) : ["none discovered yet"])), mapError2(toError6));
453073
453509
  };
453074
453510
  var loadRunWorkflowText = () => acquireUseRelease2(createControlPlaneRuntime({
453075
453511
  localDataDir: DEFAULT_LOCAL_DATA_DIR
453076
- }).pipe(mapError2(toError5)), (runtime6) => gen2(function* () {
453512
+ }).pipe(mapError2(toError6)), (runtime6) => gen2(function* () {
453077
453513
  const environment2 = yield* gen2(function* () {
453078
453514
  const resolveExecutionEnvironment = yield* RuntimeExecutionResolverService;
453079
453515
  return yield* resolveExecutionEnvironment({
@@ -453081,7 +453517,7 @@ var loadRunWorkflowText = () => acquireUseRelease2(createControlPlaneRuntime({
453081
453517
  accountId: runtime6.localInstallation.accountId,
453082
453518
  executionId: ExecutionIdSchema.make("exec_help")
453083
453519
  });
453084
- }).pipe(provide2(runtime6.runtimeLayer), mapError2(toError5));
453520
+ }).pipe(provide2(runtime6.runtimeLayer), mapError2(toError6));
453085
453521
  return yield* buildRunWorkflowText(environment2.catalog);
453086
453522
  }), closeRuntime).pipe(catchAllCause2((cause2) => succeed8([
453087
453523
  DEFAULT_RUN_WORKFLOW,
@@ -453196,7 +453632,7 @@ var startServerInBackground = (port2) => tryPromise2({
453196
453632
  await mkdir5(dirname10(DEFAULT_SERVER_LOG_FILE), { recursive: true });
453197
453633
  const logHandle = await open3(DEFAULT_SERVER_LOG_FILE, "a");
453198
453634
  try {
453199
- const child = spawn2(command[0], command.slice(1), {
453635
+ const child = spawn3(command[0], command.slice(1), {
453200
453636
  detached: true,
453201
453637
  stdio: ["ignore", logHandle.fd, logHandle.fd]
453202
453638
  });
@@ -453205,7 +453641,7 @@ var startServerInBackground = (port2) => tryPromise2({
453205
453641
  await logHandle.close();
453206
453642
  }
453207
453643
  },
453208
- catch: toError5
453644
+ catch: toError6
453209
453645
  });
453210
453646
  var readPidRecord = () => tryPromise2({
453211
453647
  try: async () => {
@@ -453258,7 +453694,7 @@ var waitForReachability = (baseUrl2, expected) => gen2(function* () {
453258
453694
  }
453259
453695
  const error51 = yield* tryPromise2({
453260
453696
  try: () => buildReachabilityTimeoutError(baseUrl2, expected),
453261
- catch: toError5
453697
+ catch: toError6
453262
453698
  });
453263
453699
  return yield* fail8(error51);
453264
453700
  });
@@ -453691,8 +454127,8 @@ var doctorCommand = exports_Command.make("doctor", {
453691
454127
  `))))).pipe(exports_Command.withDescription("Check local executor install and daemon health"));
453692
454128
  var getDenoVersion = () => tryPromise2({
453693
454129
  try: () => new Promise((resolve12) => {
453694
- const denoExecutable = process.env.DENO_BIN?.trim() || (process.env.HOME && existsSync8(`${process.env.HOME}/.deno/bin/deno`) ? `${process.env.HOME}/.deno/bin/deno` : "deno");
453695
- const child = spawn2(denoExecutable, ["--version"], {
454130
+ const denoExecutable = process.env.DENO_BIN?.trim() || (process.env.HOME && existsSync9(`${process.env.HOME}/.deno/bin/deno`) ? `${process.env.HOME}/.deno/bin/deno` : "deno");
454131
+ const child = spawn3(denoExecutable, ["--version"], {
453696
454132
  stdio: ["ignore", "pipe", "ignore"],
453697
454133
  timeout: 5000
453698
454134
  });
@@ -453771,7 +454207,7 @@ var resumeCommand = exports_Command.make("resume", {
453771
454207
  }, ({ executionId, baseUrl: baseUrl2, noOpen }) => gen2(function* () {
453772
454208
  yield* ensureServer(baseUrl2);
453773
454209
  const { installation, client: client2 } = yield* getLocalAuthedClient(baseUrl2);
453774
- const decodedExecutionId = yield* decodeExecutionId(executionId).pipe(mapError2((cause2) => toError5(cause2)));
454210
+ const decodedExecutionId = yield* decodeExecutionId(executionId).pipe(mapError2((cause2) => toError6(cause2)));
453775
454211
  const execution2 = yield* client2.executions.get({
453776
454212
  path: {
453777
454213
  workspaceId: installation.workspaceId,
@@ -453841,7 +454277,7 @@ var hiddenServer = () => {
453841
454277
  ...getDefaultServerOptions(Number.isInteger(port2) && port2 > 0 ? port2 : DEFAULT_SERVER_PORT)
453842
454278
  });
453843
454279
  };
453844
- var program = (hiddenServer() ?? helpOverride() ?? runCli(toEffectCliArgv(getCliArgs())).pipe(mapError2(toError5))).pipe(provide2(exports_NodeFileSystem.layer)).pipe(provide2(exports_NodePath.layer)).pipe(catchAllCause2((cause2) => sync3(() => {
454280
+ var program = (hiddenServer() ?? helpOverride() ?? runCli(toEffectCliArgv(getCliArgs())).pipe(mapError2(toError6))).pipe(provide2(exports_NodeFileSystem.layer)).pipe(provide2(exports_NodePath.layer)).pipe(catchAllCause2((cause2) => sync3(() => {
453845
454281
  console.error(pretty2(cause2));
453846
454282
  process.exitCode = 1;
453847
454283
  })));