executor 1.1.8 → 1.1.9
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/README.md +27 -7
- package/bin/executor.mjs +342 -77
- package/bin/postinstall.js +38 -0
- package/package.json +4 -1
- package/resources/web/assets/{highlighted-body-TPN3WLV5-Cy1EFOo2.js → highlighted-body-TPN3WLV5-D2YQWXND.js} +1 -1
- package/resources/web/assets/{index-3N-BEhR_.js → index-BnjZoxRo.js} +2 -2
- package/resources/web/assets/{mermaid-O7DHMXV3-2oBmyuDr.js → mermaid-O7DHMXV3-37jaM6li.js} +77 -77
- package/resources/web/index.html +2 -2
package/bin/executor.mjs
CHANGED
|
@@ -27936,9 +27936,9 @@ var require_toError = __commonJS((exports) => {
|
|
|
27936
27936
|
Object.defineProperty(exports, "__esModule", {
|
|
27937
27937
|
value: true
|
|
27938
27938
|
});
|
|
27939
|
-
exports.toError =
|
|
27939
|
+
exports.toError = toError3;
|
|
27940
27940
|
var _inspect = require_inspect();
|
|
27941
|
-
function
|
|
27941
|
+
function toError3(thrownValue) {
|
|
27942
27942
|
return thrownValue instanceof Error ? thrownValue : new NonErrorThrown(thrownValue);
|
|
27943
27943
|
}
|
|
27944
27944
|
|
|
@@ -120561,12 +120561,12 @@ ${Me13.join(`
|
|
|
120561
120561
|
});
|
|
120562
120562
|
|
|
120563
120563
|
// apps/executor/src/cli/main.ts
|
|
120564
|
-
import { existsSync as
|
|
120564
|
+
import { existsSync as existsSync7, readFileSync as readFileSync2 } from "node:fs";
|
|
120565
120565
|
import { mkdir as mkdir4, open as open3, readFile as readFile5, rm as rm5 } from "node:fs/promises";
|
|
120566
120566
|
import { spawn as spawn3 } from "node:child_process";
|
|
120567
120567
|
import { dirname as dirname7, resolve as resolve8 } from "node:path";
|
|
120568
120568
|
import { createInterface } from "node:readline/promises";
|
|
120569
|
-
import { fileURLToPath as
|
|
120569
|
+
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
120570
120570
|
|
|
120571
120571
|
// node_modules/.bun/@effect+cli@0.73.2+48e0a555d17e013f/node_modules/@effect/cli/dist/esm/Args.js
|
|
120572
120572
|
var exports_Args = {};
|
|
@@ -167958,7 +167958,7 @@ var compileOpenApiToolDefinitions = (manifest) => {
|
|
|
167958
167958
|
var unknownInputSchema = {
|
|
167959
167959
|
"~standard": {
|
|
167960
167960
|
version: 1,
|
|
167961
|
-
vendor: "@executor
|
|
167961
|
+
vendor: "@executor/codemode-core",
|
|
167962
167962
|
validate: (value6) => ({
|
|
167963
167963
|
value: value6
|
|
167964
167964
|
})
|
|
@@ -178545,7 +178545,7 @@ var cleanupStalePGliteLock = async (dataDir) => {
|
|
|
178545
178545
|
} catch {}
|
|
178546
178546
|
};
|
|
178547
178547
|
var createPGliteRuntime = async (localDataDir) => {
|
|
178548
|
-
const normalized = trim(localDataDir) ?? ".executor
|
|
178548
|
+
const normalized = trim(localDataDir) ?? ".executor/control-plane-pgdata";
|
|
178549
178549
|
let client;
|
|
178550
178550
|
if (normalized === ":memory:") {
|
|
178551
178551
|
client = new We2;
|
|
@@ -178618,7 +178618,7 @@ var runMigrations = async (runtime5, options9) => {
|
|
|
178618
178618
|
};
|
|
178619
178619
|
var createSqlRuntime = async (options9) => {
|
|
178620
178620
|
const databaseUrl = trim(options9.databaseUrl);
|
|
178621
|
-
const runtime5 = databaseUrl && isPostgresUrl(databaseUrl) ? await createPostgresRuntime(databaseUrl, trim(options9.postgresApplicationName)) : await createPGliteRuntime(options9.localDataDir ?? ".executor
|
|
178621
|
+
const runtime5 = databaseUrl && isPostgresUrl(databaseUrl) ? await createPostgresRuntime(databaseUrl, trim(options9.postgresApplicationName)) : await createPGliteRuntime(options9.localDataDir ?? ".executor/control-plane-pgdata");
|
|
178622
178622
|
return runtime5;
|
|
178623
178623
|
};
|
|
178624
178624
|
|
|
@@ -179014,7 +179014,7 @@ class WorkspacesApi extends exports_HttpApiGroup.make("workspaces").add(exports_
|
|
|
179014
179014
|
|
|
179015
179015
|
// packages/control-plane/src/api/api.ts
|
|
179016
179016
|
class ControlPlaneApi extends exports_HttpApi.make("controlPlane").add(LocalApi).add(OAuthApi).add(OrganizationsApi).add(MembershipsApi).add(WorkspacesApi).add(SourcesApi).add(PoliciesApi).add(ExecutionsApi).annotateContext(exports_OpenApi.annotations({
|
|
179017
|
-
title: "Executor
|
|
179017
|
+
title: "Executor Control Plane API",
|
|
179018
179018
|
description: "CRUD control plane for organizations, workspaces, sources, and policies"
|
|
179019
179019
|
})) {
|
|
179020
179020
|
}
|
|
@@ -202178,7 +202178,7 @@ var createSdkMcpConnector = (input) => {
|
|
|
202178
202178
|
const transport = input.transport ?? "auto";
|
|
202179
202179
|
const requestInit = Object.keys(headers).length > 0 ? { headers } : undefined;
|
|
202180
202180
|
const createClient = () => new Client({
|
|
202181
|
-
name: input.clientName ?? "executor-
|
|
202181
|
+
name: input.clientName ?? "executor-codemode-mcp",
|
|
202182
202182
|
version: input.clientVersion ?? "0.1.0"
|
|
202183
202183
|
}, { capabilities: { elicitation: { form: {}, url: {} } } });
|
|
202184
202184
|
return async () => {
|
|
@@ -202612,6 +202612,7 @@ var discoverMcpToolsFromConnector = (input) => gen2(function* () {
|
|
|
202612
202612
|
};
|
|
202613
202613
|
});
|
|
202614
202614
|
// packages/runtime-deno-subprocess/src/index.ts
|
|
202615
|
+
import { spawnSync } from "node:child_process";
|
|
202615
202616
|
import { existsSync as existsSync4 } from "node:fs";
|
|
202616
202617
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
202617
202618
|
|
|
@@ -202728,6 +202729,13 @@ var defaultDenoExecutable = () => {
|
|
|
202728
202729
|
}
|
|
202729
202730
|
return "deno";
|
|
202730
202731
|
};
|
|
202732
|
+
var formatDenoSpawnError = (cause2, executable) => {
|
|
202733
|
+
const code2 = typeof cause2 === "object" && cause2 !== null && "code" in cause2 ? String(cause2.code) : null;
|
|
202734
|
+
if (code2 === "ENOENT") {
|
|
202735
|
+
return `Failed to spawn Deno subprocess: Deno executable "${executable}" was not found. Install Deno or set DENO_BIN.`;
|
|
202736
|
+
}
|
|
202737
|
+
return `Failed to spawn Deno subprocess: ${cause2 instanceof Error ? cause2.message : String(cause2)}`;
|
|
202738
|
+
};
|
|
202731
202739
|
var resolveWorkerScriptPath = () => {
|
|
202732
202740
|
const moduleUrl = String(import.meta.url);
|
|
202733
202741
|
if (moduleUrl.startsWith("/")) {
|
|
@@ -202854,7 +202862,7 @@ ${String(cause2)}`);
|
|
|
202854
202862
|
stderrBuffer += chunk4;
|
|
202855
202863
|
},
|
|
202856
202864
|
onError: (cause2) => {
|
|
202857
|
-
fail19(
|
|
202865
|
+
fail19(formatDenoSpawnError(cause2, denoExecutable));
|
|
202858
202866
|
},
|
|
202859
202867
|
onExit: (exitCode, signal) => {
|
|
202860
202868
|
if (settled) {
|
|
@@ -202864,7 +202872,7 @@ ${String(cause2)}`);
|
|
|
202864
202872
|
}
|
|
202865
202873
|
});
|
|
202866
202874
|
} catch (cause2) {
|
|
202867
|
-
fail19(
|
|
202875
|
+
fail19(formatDenoSpawnError(cause2, denoExecutable));
|
|
202868
202876
|
return;
|
|
202869
202877
|
}
|
|
202870
202878
|
writeMessage(worker.stdin, {
|
|
@@ -202874,10 +202882,162 @@ ${String(cause2)}`);
|
|
|
202874
202882
|
});
|
|
202875
202883
|
return result;
|
|
202876
202884
|
});
|
|
202885
|
+
var isDenoAvailable = (executable = defaultDenoExecutable()) => {
|
|
202886
|
+
const result = spawnSync(executable, ["--version"], {
|
|
202887
|
+
stdio: "ignore",
|
|
202888
|
+
timeout: 5000
|
|
202889
|
+
});
|
|
202890
|
+
return result.error === undefined && result.status === 0;
|
|
202891
|
+
};
|
|
202877
202892
|
var makeDenoSubprocessExecutor = (options9 = {}) => ({
|
|
202878
202893
|
execute: (code2, toolInvoker) => executeInDeno(code2, toolInvoker, options9)
|
|
202879
202894
|
});
|
|
202880
202895
|
|
|
202896
|
+
// packages/runtime-ses/src/index.ts
|
|
202897
|
+
import { fork as fork3 } from "node:child_process";
|
|
202898
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
202899
|
+
var DEFAULT_TIMEOUT_MS2 = 5 * 60000;
|
|
202900
|
+
var DEFAULT_EVALUATION_ID = "evaluation";
|
|
202901
|
+
var WORKER_PATH = fileURLToPath4(new URL("./sandbox-worker.mjs", import.meta.url));
|
|
202902
|
+
var toError2 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
|
|
202903
|
+
var createSandboxWorker = () => fork3(WORKER_PATH, [], { silent: true });
|
|
202904
|
+
var describeWorkerExit = (code2, signal, stderr) => {
|
|
202905
|
+
const stderrSuffix = stderr.trim().length > 0 ? `
|
|
202906
|
+
${stderr.trim()}` : "";
|
|
202907
|
+
if (signal) {
|
|
202908
|
+
return new Error(`SES worker exited from signal ${signal}${stderrSuffix}`);
|
|
202909
|
+
}
|
|
202910
|
+
if (typeof code2 === "number") {
|
|
202911
|
+
return new Error(`SES worker exited with code ${code2}${stderrSuffix}`);
|
|
202912
|
+
}
|
|
202913
|
+
return new Error(`SES worker exited before returning a result${stderrSuffix}`);
|
|
202914
|
+
};
|
|
202915
|
+
var sendMessage = (child, message) => {
|
|
202916
|
+
if (typeof child.send !== "function") {
|
|
202917
|
+
throw new Error("SES worker IPC channel is unavailable");
|
|
202918
|
+
}
|
|
202919
|
+
child.send(message);
|
|
202920
|
+
};
|
|
202921
|
+
var evaluateInSandbox = async (options9, code2, toolInvoker) => {
|
|
202922
|
+
const child = createSandboxWorker();
|
|
202923
|
+
const timeoutMs = options9.timeoutMs ?? DEFAULT_TIMEOUT_MS2;
|
|
202924
|
+
const stderrChunks = [];
|
|
202925
|
+
if (child.stderr) {
|
|
202926
|
+
child.stderr.on("data", (chunk4) => {
|
|
202927
|
+
stderrChunks.push(chunk4.toString());
|
|
202928
|
+
});
|
|
202929
|
+
}
|
|
202930
|
+
return new Promise((resolve5, reject) => {
|
|
202931
|
+
let settled = false;
|
|
202932
|
+
let timeoutHandle;
|
|
202933
|
+
const cleanup = () => {
|
|
202934
|
+
if (timeoutHandle) {
|
|
202935
|
+
clearTimeout(timeoutHandle);
|
|
202936
|
+
timeoutHandle = undefined;
|
|
202937
|
+
}
|
|
202938
|
+
child.off("error", onError4);
|
|
202939
|
+
child.off("exit", onExit4);
|
|
202940
|
+
child.off("message", onMessage);
|
|
202941
|
+
if (!child.killed) {
|
|
202942
|
+
child.kill();
|
|
202943
|
+
}
|
|
202944
|
+
};
|
|
202945
|
+
const settle = (effect3) => {
|
|
202946
|
+
if (settled) {
|
|
202947
|
+
return;
|
|
202948
|
+
}
|
|
202949
|
+
settled = true;
|
|
202950
|
+
cleanup();
|
|
202951
|
+
effect3();
|
|
202952
|
+
};
|
|
202953
|
+
const resetTimeout = () => {
|
|
202954
|
+
if (timeoutHandle) {
|
|
202955
|
+
clearTimeout(timeoutHandle);
|
|
202956
|
+
}
|
|
202957
|
+
timeoutHandle = setTimeout(() => {
|
|
202958
|
+
settle(() => {
|
|
202959
|
+
reject(new Error(`Execution timed out after ${timeoutMs}ms`));
|
|
202960
|
+
});
|
|
202961
|
+
}, timeoutMs);
|
|
202962
|
+
};
|
|
202963
|
+
const onError4 = (error51) => {
|
|
202964
|
+
settle(() => {
|
|
202965
|
+
reject(error51);
|
|
202966
|
+
});
|
|
202967
|
+
};
|
|
202968
|
+
const onExit4 = (code3, signal) => {
|
|
202969
|
+
settle(() => {
|
|
202970
|
+
reject(describeWorkerExit(code3, signal, stderrChunks.join("")));
|
|
202971
|
+
});
|
|
202972
|
+
};
|
|
202973
|
+
const onMessage = (message) => {
|
|
202974
|
+
if (message.type === "ready") {
|
|
202975
|
+
resetTimeout();
|
|
202976
|
+
sendMessage(child, {
|
|
202977
|
+
type: "evaluate",
|
|
202978
|
+
id: DEFAULT_EVALUATION_ID,
|
|
202979
|
+
code: code2,
|
|
202980
|
+
allowFetch: options9.allowFetch === true
|
|
202981
|
+
});
|
|
202982
|
+
return;
|
|
202983
|
+
}
|
|
202984
|
+
if (message.type === "tool-call") {
|
|
202985
|
+
resetTimeout();
|
|
202986
|
+
runPromise(toolInvoker.invoke({ path: message.path, args: message.args })).then((value6) => {
|
|
202987
|
+
if (settled) {
|
|
202988
|
+
return;
|
|
202989
|
+
}
|
|
202990
|
+
resetTimeout();
|
|
202991
|
+
sendMessage(child, {
|
|
202992
|
+
type: "tool-response",
|
|
202993
|
+
callId: message.callId,
|
|
202994
|
+
value: value6
|
|
202995
|
+
});
|
|
202996
|
+
}).catch((cause2) => {
|
|
202997
|
+
if (settled) {
|
|
202998
|
+
return;
|
|
202999
|
+
}
|
|
203000
|
+
resetTimeout();
|
|
203001
|
+
const error51 = toError2(cause2);
|
|
203002
|
+
sendMessage(child, {
|
|
203003
|
+
type: "tool-response",
|
|
203004
|
+
callId: message.callId,
|
|
203005
|
+
error: error51.stack ?? error51.message
|
|
203006
|
+
});
|
|
203007
|
+
});
|
|
203008
|
+
return;
|
|
203009
|
+
}
|
|
203010
|
+
if (message.type === "result") {
|
|
203011
|
+
settle(() => {
|
|
203012
|
+
if (message.error) {
|
|
203013
|
+
resolve5({
|
|
203014
|
+
result: null,
|
|
203015
|
+
error: message.error,
|
|
203016
|
+
logs: message.logs ?? []
|
|
203017
|
+
});
|
|
203018
|
+
return;
|
|
203019
|
+
}
|
|
203020
|
+
resolve5({
|
|
203021
|
+
result: message.value,
|
|
203022
|
+
logs: message.logs ?? []
|
|
203023
|
+
});
|
|
203024
|
+
});
|
|
203025
|
+
}
|
|
203026
|
+
};
|
|
203027
|
+
child.on("error", onError4);
|
|
203028
|
+
child.on("exit", onExit4);
|
|
203029
|
+
child.on("message", onMessage);
|
|
203030
|
+
resetTimeout();
|
|
203031
|
+
});
|
|
203032
|
+
};
|
|
203033
|
+
var runInSes = (options9, code2, toolInvoker) => tryPromise2({
|
|
203034
|
+
try: () => evaluateInSandbox(options9, code2, toolInvoker),
|
|
203035
|
+
catch: toError2
|
|
203036
|
+
});
|
|
203037
|
+
var makeSesExecutor = (options9 = {}) => ({
|
|
203038
|
+
execute: (code2, toolInvoker) => runInSes(options9, code2, toolInvoker)
|
|
203039
|
+
});
|
|
203040
|
+
|
|
202881
203041
|
// packages/control-plane/src/runtime/schema-type-signature.ts
|
|
202882
203042
|
var asRecord4 = (value6) => typeof value6 === "object" && value6 !== null && !Array.isArray(value6) ? value6 : {};
|
|
202883
203043
|
var asStringArray2 = (value6) => Array.isArray(value6) ? value6.filter((item) => typeof item === "string") : [];
|
|
@@ -204277,7 +204437,7 @@ var ENV_SECRET_PROVIDER_ID = "env";
|
|
|
204277
204437
|
var PARAMS_SECRET_PROVIDER_ID = "params";
|
|
204278
204438
|
var KEYCHAIN_SECRET_PROVIDER_ID = "keychain";
|
|
204279
204439
|
var POSTGRES_SECRET_PROVIDER_ID2 = "postgres";
|
|
204280
|
-
var DEFAULT_KEYCHAIN_SERVICE_NAME = "executor
|
|
204440
|
+
var DEFAULT_KEYCHAIN_SERVICE_NAME = "executor";
|
|
204281
204441
|
var DANGEROUSLY_ALLOW_ENV_SECRETS_ENV = "DANGEROUSLY_ALLOW_ENV_SECRETS";
|
|
204282
204442
|
var SECRET_STORE_PROVIDER_ENV = "EXECUTOR_SECRET_STORE_PROVIDER";
|
|
204283
204443
|
var KEYCHAIN_SERVICE_NAME_ENV = "EXECUTOR_KEYCHAIN_SERVICE_NAME";
|
|
@@ -204744,7 +204904,7 @@ var decodeJson = (input) => {
|
|
|
204744
204904
|
return input.fallback;
|
|
204745
204905
|
}
|
|
204746
204906
|
};
|
|
204747
|
-
var
|
|
204907
|
+
var toError3 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
|
|
204748
204908
|
var createClientMetadata = (redirectUrl) => ({
|
|
204749
204909
|
redirect_uris: [redirectUrl],
|
|
204750
204910
|
grant_types: ["authorization_code", "refresh_token"],
|
|
@@ -204793,7 +204953,7 @@ var startMcpOAuthAuthorization = (input) => gen2(function* () {
|
|
|
204793
204953
|
try: () => auth3(provider, {
|
|
204794
204954
|
serverUrl: input.endpoint
|
|
204795
204955
|
}),
|
|
204796
|
-
catch:
|
|
204956
|
+
catch: toError3
|
|
204797
204957
|
});
|
|
204798
204958
|
if (result !== "REDIRECT" || !captured.authorizationUrl || !captured.codeVerifier) {
|
|
204799
204959
|
return yield* fail8(new Error("OAuth flow did not produce an authorization redirect"));
|
|
@@ -204861,7 +205021,7 @@ var exchangeMcpOAuthAuthorizationCode = (input) => gen2(function* () {
|
|
|
204861
205021
|
serverUrl: input.session.endpoint,
|
|
204862
205022
|
authorizationCode: input.code
|
|
204863
205023
|
}),
|
|
204864
|
-
catch:
|
|
205024
|
+
catch: toError3
|
|
204865
205025
|
});
|
|
204866
205026
|
if (result !== "AUTHORIZED" || !captured.tokens) {
|
|
204867
205027
|
return yield* fail8(new Error("OAuth redirect did not complete MCP OAuth setup"));
|
|
@@ -206794,8 +206954,9 @@ var createWorkspaceExecutionEnvironmentResolver = (input) => {
|
|
|
206794
206954
|
sourceAuthService: input.sourceAuthService,
|
|
206795
206955
|
onElicitation
|
|
206796
206956
|
});
|
|
206957
|
+
const executor = isDenoAvailable() ? makeDenoSubprocessExecutor() : makeSesExecutor();
|
|
206797
206958
|
return {
|
|
206798
|
-
executor
|
|
206959
|
+
executor,
|
|
206799
206960
|
toolInvoker,
|
|
206800
206961
|
catalog
|
|
206801
206962
|
};
|
|
@@ -207622,7 +207783,7 @@ var ControlPlaneMembershipsLive = exports_HttpApiBuilder.group(ControlPlaneApi,
|
|
|
207622
207783
|
})))));
|
|
207623
207784
|
|
|
207624
207785
|
// packages/control-plane/src/api/oauth/http.ts
|
|
207625
|
-
var OAUTH_RESULT_STORAGE_KEY_PREFIX = "executor
|
|
207786
|
+
var OAUTH_RESULT_STORAGE_KEY_PREFIX = "executor:oauth-result:";
|
|
207626
207787
|
var requireWriteSources = (workspaceId) => requirePermission({
|
|
207627
207788
|
permission: "sources:write",
|
|
207628
207789
|
workspaceId
|
|
@@ -207821,7 +207982,7 @@ var ControlPlaneOAuthLive = exports_HttpApiBuilder.group(ControlPlaneApi, "oauth
|
|
|
207821
207982
|
status: "connected",
|
|
207822
207983
|
sessionId: completed.right.sessionId,
|
|
207823
207984
|
payload: {
|
|
207824
|
-
type: "executor
|
|
207985
|
+
type: "executor:oauth-result",
|
|
207825
207986
|
ok: true,
|
|
207826
207987
|
sessionId: completed.right.sessionId,
|
|
207827
207988
|
auth: completed.right.auth
|
|
@@ -207835,7 +207996,7 @@ var ControlPlaneOAuthLive = exports_HttpApiBuilder.group(ControlPlaneApi, "oauth
|
|
|
207835
207996
|
status: "failed",
|
|
207836
207997
|
sessionId: "failed",
|
|
207837
207998
|
payload: {
|
|
207838
|
-
type: "executor
|
|
207999
|
+
type: "executor:oauth-result",
|
|
207839
208000
|
ok: false,
|
|
207840
208001
|
sessionId: null,
|
|
207841
208002
|
error: message
|
|
@@ -209414,7 +209575,7 @@ var utils = {
|
|
|
209414
209575
|
// node_modules/.bun/prettier@3.8.1/node_modules/prettier/index.mjs
|
|
209415
209576
|
import { equal, ok, strictEqual } from "assert";
|
|
209416
209577
|
import path11 from "path";
|
|
209417
|
-
import { fileURLToPath as
|
|
209578
|
+
import { fileURLToPath as fileURLToPath52 } from "url";
|
|
209418
209579
|
import path13 from "path";
|
|
209419
209580
|
import { pathToFileURL as pathToFileURL5 } from "url";
|
|
209420
209581
|
import path12 from "path";
|
|
@@ -224052,7 +224213,7 @@ function getLanguageByIsSupported(languages2, file10) {
|
|
|
224052
224213
|
}
|
|
224053
224214
|
if (isUrl(file10)) {
|
|
224054
224215
|
try {
|
|
224055
|
-
file10 =
|
|
224216
|
+
file10 = fileURLToPath52(file10);
|
|
224056
224217
|
} catch {
|
|
224057
224218
|
return;
|
|
224058
224219
|
}
|
|
@@ -227682,7 +227843,7 @@ var tryDetectMcp = (input) => gen2(function* () {
|
|
|
227682
227843
|
}
|
|
227683
227844
|
const oauthProbe = yield* either3(startMcpOAuthAuthorization({
|
|
227684
227845
|
endpoint: input.normalizedUrl,
|
|
227685
|
-
redirectUrl: "http://127.0.0.1/executor
|
|
227846
|
+
redirectUrl: "http://127.0.0.1/executor/discovery/oauth/callback",
|
|
227686
227847
|
state: "source-discovery"
|
|
227687
227848
|
}));
|
|
227688
227849
|
if (oauthProbe._tag === "Left") {
|
|
@@ -228407,7 +228568,7 @@ var ControlPlaneSourcesLive = exports_HttpApiBuilder.group(ControlPlaneApi, "sou
|
|
|
228407
228568
|
message: `Source connected: ${source3.id}. You can close this window.`,
|
|
228408
228569
|
state: "stored",
|
|
228409
228570
|
payload: {
|
|
228410
|
-
type: "executor
|
|
228571
|
+
type: "executor:source-oauth-result",
|
|
228411
228572
|
ok: true,
|
|
228412
228573
|
sourceId: source3.id
|
|
228413
228574
|
}
|
|
@@ -228416,7 +228577,7 @@ var ControlPlaneSourcesLive = exports_HttpApiBuilder.group(ControlPlaneApi, "sou
|
|
|
228416
228577
|
message: error51 instanceof Error ? error51.message : "Failed completing OAuth",
|
|
228417
228578
|
state: "cancelled",
|
|
228418
228579
|
payload: {
|
|
228419
|
-
type: "executor
|
|
228580
|
+
type: "executor:source-oauth-result",
|
|
228420
228581
|
ok: false,
|
|
228421
228582
|
error: error51 instanceof Error ? error51.message : "Failed completing OAuth"
|
|
228422
228583
|
}
|
|
@@ -228644,12 +228805,13 @@ var createControlPlaneClient = (input) => {
|
|
|
228644
228805
|
}).pipe(provide2(exports_FetchHttpClient.layer));
|
|
228645
228806
|
};
|
|
228646
228807
|
// packages/server/src/index.ts
|
|
228808
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
228809
|
+
import { mkdir as mkdir3, readFile as readFile4, rename as rename5, rm as rm4, stat as stat4, writeFile as writeFile3 } from "node:fs/promises";
|
|
228647
228810
|
import {
|
|
228648
228811
|
createServer as createNodeServer
|
|
228649
228812
|
} from "node:http";
|
|
228650
|
-
import { mkdir as mkdir3, readFile as readFile4, rm as rm4, stat as stat4, writeFile as writeFile3 } from "node:fs/promises";
|
|
228651
|
-
import { Readable } from "node:stream";
|
|
228652
228813
|
import { dirname as dirname5, extname as extname2, resolve as resolve6 } from "node:path";
|
|
228814
|
+
import { Readable } from "node:stream";
|
|
228653
228815
|
|
|
228654
228816
|
// node_modules/.bun/@modelcontextprotocol+sdk@1.27.1/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
228655
228817
|
class ExperimentalServerTasks {
|
|
@@ -230848,6 +231010,9 @@ var defaultLinuxStateHome = trim4(process.env.XDG_STATE_HOME) ?? join10(home, ".
|
|
|
230848
231010
|
var defaultWindowsHome = join10(trim4(process.env.LOCALAPPDATA) ?? join10(home, "AppData", "Local"), "Executor");
|
|
230849
231011
|
var defaultMacHome = join10(home, "Library", "Application Support", "Executor");
|
|
230850
231012
|
var defaultLinuxHome = join10(defaultLinuxDataHome, "executor");
|
|
231013
|
+
var legacyLinuxHome = join10(defaultLinuxDataHome, "executor-v3");
|
|
231014
|
+
var legacyWindowsHome = join10(trim4(process.env.LOCALAPPDATA) ?? join10(home, "AppData", "Local"), "Executor-v3");
|
|
231015
|
+
var legacyMacHome = join10(home, "Library", "Application Support", "Executor-v3");
|
|
230851
231016
|
var DEFAULT_SERVER_PORT = 8788;
|
|
230852
231017
|
var DEFAULT_SERVER_HOST = "127.0.0.1";
|
|
230853
231018
|
var DEFAULT_SERVER_BASE_URL = `http://${DEFAULT_SERVER_HOST}:${DEFAULT_SERVER_PORT}`;
|
|
@@ -230855,6 +231020,11 @@ var DEFAULT_EXECUTOR_HOME = explicitExecutorHome ?? (isWindows ? defaultWindowsH
|
|
|
230855
231020
|
var DEFAULT_EXECUTOR_DATA_DIR = trim4(process.env[EXECUTOR_DATA_DIR_ENV]) ?? join10(DEFAULT_EXECUTOR_HOME, "data");
|
|
230856
231021
|
var DEFAULT_EXECUTOR_RUN_DIR = explicitExecutorHome ? join10(DEFAULT_EXECUTOR_HOME, "run") : isWindows || isMac ? join10(DEFAULT_EXECUTOR_HOME, "run") : join10(defaultLinuxStateHome, "executor", "run");
|
|
230857
231022
|
var DEFAULT_LOCAL_DATA_DIR = trim4(process.env[EXECUTOR_LOCAL_DATA_DIR_ENV]) ?? join10(DEFAULT_EXECUTOR_DATA_DIR, "control-plane");
|
|
231023
|
+
var DEFAULT_LEGACY_LOCAL_DATA_DIRS = explicitExecutorHome ? [] : [
|
|
231024
|
+
isWindows ? join10(legacyWindowsHome, "control-plane") : null,
|
|
231025
|
+
isMac ? join10(legacyMacHome, "control-plane") : null,
|
|
231026
|
+
!isWindows && !isMac ? join10(legacyLinuxHome, "control-plane") : null
|
|
231027
|
+
].filter((value6) => value6 !== null);
|
|
230858
231028
|
var DEFAULT_SERVER_PID_FILE = trim4(process.env[EXECUTOR_SERVER_PID_FILE_ENV]) ?? join10(DEFAULT_EXECUTOR_RUN_DIR, "server.pid");
|
|
230859
231029
|
var DEFAULT_SERVER_LOG_FILE = trim4(process.env[EXECUTOR_SERVER_LOG_FILE_ENV]) ?? join10(DEFAULT_EXECUTOR_RUN_DIR, "server.log");
|
|
230860
231030
|
var SERVER_START_TIMEOUT_MS = 5000;
|
|
@@ -230865,6 +231035,71 @@ var disposeRuntime = (runtime6) => tryPromise2({
|
|
|
230865
231035
|
try: () => runtime6.close(),
|
|
230866
231036
|
catch: (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2 ?? "runtime close failed"))
|
|
230867
231037
|
}).pipe(orDie2);
|
|
231038
|
+
var createRuntime = (localDataDir, getLocalServerBaseUrl, options10) => createSqlControlPlaneRuntime({
|
|
231039
|
+
localDataDir,
|
|
231040
|
+
migrationsFolder: options10.migrationsFolder,
|
|
231041
|
+
executionResolver: options10.executionResolver,
|
|
231042
|
+
resolveSecretMaterial: options10.resolveSecretMaterial,
|
|
231043
|
+
getLocalServerBaseUrl
|
|
231044
|
+
}).pipe(mapError2((cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2))));
|
|
231045
|
+
var moveLegacyLocalDataDir = (legacyLocalDataDir, requestedLocalDataDir) => tryPromise2({
|
|
231046
|
+
try: async () => {
|
|
231047
|
+
await mkdir3(dirname5(requestedLocalDataDir), { recursive: true });
|
|
231048
|
+
if (existsSync5(requestedLocalDataDir)) {
|
|
231049
|
+
const backupPath = `${requestedLocalDataDir}.backup-${Date.now()}`;
|
|
231050
|
+
await rename5(requestedLocalDataDir, backupPath);
|
|
231051
|
+
console.warn(`[executor] Backed up unreadable local data dir to: ${backupPath}`);
|
|
231052
|
+
}
|
|
231053
|
+
await rename5(legacyLocalDataDir, requestedLocalDataDir);
|
|
231054
|
+
console.warn(`[executor] Moved legacy local data dir to: ${requestedLocalDataDir}`);
|
|
231055
|
+
},
|
|
231056
|
+
catch: (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2))
|
|
231057
|
+
});
|
|
231058
|
+
var createRuntimeWithLegacyMigration = (requestedLocalDataDir, legacyLocalDataDirs, getLocalServerBaseUrl, options10) => gen2(function* () {
|
|
231059
|
+
if (requestedLocalDataDir !== ":memory:" && !existsSync5(requestedLocalDataDir) && legacyLocalDataDirs.length > 0) {
|
|
231060
|
+
for (const legacyLocalDataDir of legacyLocalDataDirs) {
|
|
231061
|
+
const legacyExit = yield* exit2(createRuntime(legacyLocalDataDir, getLocalServerBaseUrl, options10));
|
|
231062
|
+
if (isFailure(legacyExit)) {
|
|
231063
|
+
continue;
|
|
231064
|
+
}
|
|
231065
|
+
yield* disposeRuntime(legacyExit.value);
|
|
231066
|
+
const migrationExit = yield* exit2(moveLegacyLocalDataDir(legacyLocalDataDir, requestedLocalDataDir));
|
|
231067
|
+
if (isFailure(migrationExit)) {
|
|
231068
|
+
continue;
|
|
231069
|
+
}
|
|
231070
|
+
const migratedExit = yield* exit2(createRuntime(requestedLocalDataDir, getLocalServerBaseUrl, options10));
|
|
231071
|
+
if (isSuccess(migratedExit)) {
|
|
231072
|
+
return migratedExit.value;
|
|
231073
|
+
}
|
|
231074
|
+
}
|
|
231075
|
+
}
|
|
231076
|
+
const primaryExit = yield* exit2(createRuntime(requestedLocalDataDir, getLocalServerBaseUrl, options10));
|
|
231077
|
+
if (isSuccess(primaryExit)) {
|
|
231078
|
+
return primaryExit.value;
|
|
231079
|
+
}
|
|
231080
|
+
const primaryError = squash(primaryExit.cause);
|
|
231081
|
+
if (legacyLocalDataDirs.length > 0) {
|
|
231082
|
+
yield* sync3(() => {
|
|
231083
|
+
console.warn(`[executor] Failed to open default local data dir: ${requestedLocalDataDir}`, primaryError instanceof Error ? primaryError.message : String(primaryError));
|
|
231084
|
+
});
|
|
231085
|
+
}
|
|
231086
|
+
for (const legacyLocalDataDir of legacyLocalDataDirs) {
|
|
231087
|
+
const legacyExit = yield* exit2(createRuntime(legacyLocalDataDir, getLocalServerBaseUrl, options10));
|
|
231088
|
+
if (isFailure(legacyExit)) {
|
|
231089
|
+
continue;
|
|
231090
|
+
}
|
|
231091
|
+
yield* disposeRuntime(legacyExit.value);
|
|
231092
|
+
const migrationExit = yield* exit2(moveLegacyLocalDataDir(legacyLocalDataDir, requestedLocalDataDir));
|
|
231093
|
+
if (isFailure(migrationExit)) {
|
|
231094
|
+
continue;
|
|
231095
|
+
}
|
|
231096
|
+
const migratedExit = yield* exit2(createRuntime(requestedLocalDataDir, getLocalServerBaseUrl, options10));
|
|
231097
|
+
if (isSuccess(migratedExit)) {
|
|
231098
|
+
return migratedExit.value;
|
|
231099
|
+
}
|
|
231100
|
+
}
|
|
231101
|
+
return yield* fail8(primaryError instanceof Error ? primaryError : new Error(String(primaryError)));
|
|
231102
|
+
});
|
|
230868
231103
|
var createControlPlaneWebHandler = (runtime6) => acquireRelease2(sync3(() => exports_HttpApiBuilder.toWebHandler(merge7(createControlPlaneApiLayer(runtime6.runtimeLayer), exports_HttpServer.layerContext))), (handler2) => tryPromise2({ try: () => handler2.dispose(), catch: (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2 ?? "web handler dispose failed")) }).pipe(orDie2));
|
|
230869
231104
|
var safeFilePath = (assetsDir, pathname) => {
|
|
230870
231105
|
const target = resolve6(assetsDir, `.${pathname}`);
|
|
@@ -230980,23 +231215,21 @@ var isApiRequest = (request) => {
|
|
|
230980
231215
|
return pathname === "/mcp" || pathname === "/v1" || pathname.startsWith("/v1/");
|
|
230981
231216
|
};
|
|
230982
231217
|
var createLocalExecutorRequestHandler = (options10 = {}) => gen2(function* () {
|
|
230983
|
-
const
|
|
230984
|
-
|
|
231218
|
+
const requestedLocalDataDir = options10.localDataDir ?? DEFAULT_LOCAL_DATA_DIR;
|
|
231219
|
+
const legacyLocalDataDirs = options10.localDataDir === undefined ? DEFAULT_LEGACY_LOCAL_DATA_DIRS.filter((candidate) => existsSync5(candidate)) : [];
|
|
231220
|
+
if (requestedLocalDataDir !== ":memory:") {
|
|
230985
231221
|
yield* tryPromise2({
|
|
230986
|
-
try: () => mkdir3(dirname5(
|
|
231222
|
+
try: () => mkdir3(dirname5(requestedLocalDataDir), { recursive: true }),
|
|
230987
231223
|
catch: (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2))
|
|
230988
231224
|
});
|
|
230989
231225
|
}
|
|
230990
231226
|
let baseUrlRef;
|
|
230991
|
-
const runtime6 = yield* acquireRelease2(
|
|
230992
|
-
localDataDir,
|
|
230993
|
-
migrationsFolder: options10.migrationsFolder,
|
|
230994
|
-
executionResolver: options10.executionResolver,
|
|
230995
|
-
resolveSecretMaterial: options10.resolveSecretMaterial,
|
|
230996
|
-
getLocalServerBaseUrl: () => baseUrlRef
|
|
230997
|
-
}).pipe(mapError2((cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2)))), disposeRuntime);
|
|
231227
|
+
const runtime6 = yield* acquireRelease2(createRuntimeWithLegacyMigration(requestedLocalDataDir, legacyLocalDataDirs, () => baseUrlRef, options10), disposeRuntime);
|
|
230998
231228
|
const apiHandler = yield* createControlPlaneWebHandler(runtime6);
|
|
230999
|
-
const mcpHandler = yield* acquireRelease2(sync3(() => createExecutorMcpRequestHandler(runtime6)), (handler2) => tryPromise2({
|
|
231229
|
+
const mcpHandler = yield* acquireRelease2(sync3(() => createExecutorMcpRequestHandler(runtime6)), (handler2) => tryPromise2({
|
|
231230
|
+
try: () => handler2.close(),
|
|
231231
|
+
catch: (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2 ?? "mcp handler close failed"))
|
|
231232
|
+
}).pipe(orDie2));
|
|
231000
231233
|
return {
|
|
231001
231234
|
runtime: runtime6,
|
|
231002
231235
|
handleApiRequest: (request) => {
|
|
@@ -231231,7 +231464,7 @@ var seedGithubOpenApiSourceInWorkspace = (input) => gen2(function* () {
|
|
|
231231
231464
|
});
|
|
231232
231465
|
|
|
231233
231466
|
// apps/executor/src/cli/runtime-paths.ts
|
|
231234
|
-
import { existsSync as
|
|
231467
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
231235
231468
|
import { dirname as dirname6, extname as extname3, resolve as resolve7 } from "node:path";
|
|
231236
231469
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
231237
231470
|
var sourceDir = dirname6(fileURLToPath6(import.meta.url));
|
|
@@ -231245,7 +231478,7 @@ var resolveIfExists = (value6) => {
|
|
|
231245
231478
|
return null;
|
|
231246
231479
|
}
|
|
231247
231480
|
const resolved = resolve7(candidate);
|
|
231248
|
-
return
|
|
231481
|
+
return existsSync6(resolved) ? resolved : null;
|
|
231249
231482
|
};
|
|
231250
231483
|
var getSourceEntrypoint = () => {
|
|
231251
231484
|
const candidate = trim5(process.argv[1]);
|
|
@@ -231258,21 +231491,21 @@ var getSourceEntrypoint = () => {
|
|
|
231258
231491
|
};
|
|
231259
231492
|
var resolveBundledNodeLauncher = () => {
|
|
231260
231493
|
const candidate = resolve7(sourceDir, "executor.js");
|
|
231261
|
-
return
|
|
231494
|
+
return existsSync6(candidate) ? candidate : null;
|
|
231262
231495
|
};
|
|
231263
231496
|
var resolveRuntimeResourcesRoot = () => {
|
|
231264
231497
|
const compiledCandidate = resolve7(dirname6(process.execPath), "../resources");
|
|
231265
|
-
if (
|
|
231498
|
+
if (existsSync6(compiledCandidate)) {
|
|
231266
231499
|
return compiledCandidate;
|
|
231267
231500
|
}
|
|
231268
231501
|
const bundledCandidateFromModule = resolve7(sourceDir, "../resources");
|
|
231269
|
-
if (
|
|
231502
|
+
if (existsSync6(bundledCandidateFromModule)) {
|
|
231270
231503
|
return bundledCandidateFromModule;
|
|
231271
231504
|
}
|
|
231272
231505
|
const sourceEntrypoint = getSourceEntrypoint();
|
|
231273
231506
|
if (sourceEntrypoint) {
|
|
231274
231507
|
const bundledCandidate = resolve7(dirname6(sourceEntrypoint), "../resources");
|
|
231275
|
-
if (
|
|
231508
|
+
if (existsSync6(bundledCandidate)) {
|
|
231276
231509
|
return bundledCandidate;
|
|
231277
231510
|
}
|
|
231278
231511
|
}
|
|
@@ -231394,8 +231627,16 @@ var buildPausedExecutionOutput = (input) => {
|
|
|
231394
231627
|
};
|
|
231395
231628
|
};
|
|
231396
231629
|
|
|
231630
|
+
// apps/executor/src/cli/interaction-handling.ts
|
|
231631
|
+
var decideInteractionHandling = (input) => {
|
|
231632
|
+
if (input.parsed?.mode === "url") {
|
|
231633
|
+
return input.isInteractiveTerminal ? "url_interactive" : "url_paused";
|
|
231634
|
+
}
|
|
231635
|
+
return input.isInteractiveTerminal ? "form_interactive" : "form_paused";
|
|
231636
|
+
};
|
|
231637
|
+
|
|
231397
231638
|
// apps/executor/src/cli/main.ts
|
|
231398
|
-
var
|
|
231639
|
+
var toError4 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
|
|
231399
231640
|
var sleep5 = (ms8) => promise2(() => new Promise((resolve9) => setTimeout(resolve9, ms8)));
|
|
231400
231641
|
var openUrlInBrowser = (url4) => sync3(() => {
|
|
231401
231642
|
const cmd = process.platform === "darwin" ? ["open", url4] : process.platform === "win32" ? ["cmd", "/c", "start", "", url4] : ["xdg-open", url4];
|
|
@@ -231422,7 +231663,7 @@ var promptLine = (prompt4) => tryPromise2({
|
|
|
231422
231663
|
rl5.close();
|
|
231423
231664
|
}
|
|
231424
231665
|
},
|
|
231425
|
-
catch:
|
|
231666
|
+
catch: toError4
|
|
231426
231667
|
});
|
|
231427
231668
|
var readStdin = () => tryPromise2({
|
|
231428
231669
|
try: async () => {
|
|
@@ -231433,7 +231674,7 @@ var readStdin = () => tryPromise2({
|
|
|
231433
231674
|
}
|
|
231434
231675
|
return contents;
|
|
231435
231676
|
},
|
|
231436
|
-
catch:
|
|
231677
|
+
catch: toError4
|
|
231437
231678
|
});
|
|
231438
231679
|
var readCode = (input) => gen2(function* () {
|
|
231439
231680
|
if (input.code && input.code.trim().length > 0) {
|
|
@@ -231442,7 +231683,7 @@ var readCode = (input) => gen2(function* () {
|
|
|
231442
231683
|
if (input.file && input.file.trim().length > 0) {
|
|
231443
231684
|
const contents = yield* tryPromise2({
|
|
231444
231685
|
try: () => readFile5(input.file, "utf8"),
|
|
231445
|
-
catch:
|
|
231686
|
+
catch: toError4
|
|
231446
231687
|
});
|
|
231447
231688
|
if (contents.trim().length > 0) {
|
|
231448
231689
|
return contents;
|
|
@@ -231459,7 +231700,7 @@ var readCode = (input) => gen2(function* () {
|
|
|
231459
231700
|
});
|
|
231460
231701
|
var getBootstrapClient = (baseUrl2 = DEFAULT_SERVER_BASE_URL) => createControlPlaneClient({ baseUrl: baseUrl2 });
|
|
231461
231702
|
var decodeExecutionId = decodeUnknown2(ExecutionIdSchema);
|
|
231462
|
-
var cliSourceDir = dirname7(
|
|
231703
|
+
var cliSourceDir = dirname7(fileURLToPath7(import.meta.url));
|
|
231463
231704
|
var CLI_NAME = "executor";
|
|
231464
231705
|
var CLI_VERSION = (() => {
|
|
231465
231706
|
const candidatePaths = [
|
|
@@ -231467,7 +231708,7 @@ var CLI_VERSION = (() => {
|
|
|
231467
231708
|
resolve8(cliSourceDir, "../../package.json")
|
|
231468
231709
|
];
|
|
231469
231710
|
for (const candidatePath of candidatePaths) {
|
|
231470
|
-
if (!
|
|
231711
|
+
if (!existsSync7(candidatePath)) {
|
|
231471
231712
|
continue;
|
|
231472
231713
|
}
|
|
231473
231714
|
try {
|
|
@@ -231535,17 +231776,17 @@ var formatCatalogUnavailableMessage = (cause2) => {
|
|
|
231535
231776
|
};
|
|
231536
231777
|
var closeSqlRuntime = (runtime6) => tryPromise2({
|
|
231537
231778
|
try: () => runtime6.close(),
|
|
231538
|
-
catch:
|
|
231779
|
+
catch: toError4
|
|
231539
231780
|
}).pipe(catchAll2(() => _void));
|
|
231540
231781
|
var buildRunWorkflowText = (catalog) => {
|
|
231541
231782
|
if (!catalog) {
|
|
231542
231783
|
return succeed8(DEFAULT_RUN_WORKFLOW);
|
|
231543
231784
|
}
|
|
231544
|
-
return catalog.listNamespaces({ limit: 200 }).pipe(map16((namespaces) => buildWorkflowText(namespaces.length > 0 ? namespaces.map((namespace) => namespace.displayName ?? namespace.namespace) : ["none discovered yet"])), mapError2(
|
|
231785
|
+
return catalog.listNamespaces({ limit: 200 }).pipe(map16((namespaces) => buildWorkflowText(namespaces.length > 0 ? namespaces.map((namespace) => namespace.displayName ?? namespace.namespace) : ["none discovered yet"])), mapError2(toError4));
|
|
231545
231786
|
};
|
|
231546
231787
|
var loadRunWorkflowText = () => acquireUseRelease2(createSqlControlPlaneRuntime({
|
|
231547
231788
|
localDataDir: DEFAULT_LOCAL_DATA_DIR
|
|
231548
|
-
}).pipe(mapError2(
|
|
231789
|
+
}).pipe(mapError2(toError4)), (runtime6) => gen2(function* () {
|
|
231549
231790
|
const environment2 = yield* gen2(function* () {
|
|
231550
231791
|
const resolveExecutionEnvironment = yield* RuntimeExecutionResolverService;
|
|
231551
231792
|
return yield* resolveExecutionEnvironment({
|
|
@@ -231553,7 +231794,7 @@ var loadRunWorkflowText = () => acquireUseRelease2(createSqlControlPlaneRuntime(
|
|
|
231553
231794
|
accountId: runtime6.localInstallation.accountId,
|
|
231554
231795
|
executionId: ExecutionIdSchema.make("exec_help")
|
|
231555
231796
|
});
|
|
231556
|
-
}).pipe(provide2(runtime6.runtimeLayer), mapError2(
|
|
231797
|
+
}).pipe(provide2(runtime6.runtimeLayer), mapError2(toError4));
|
|
231557
231798
|
return yield* buildRunWorkflowText(environment2.catalog);
|
|
231558
231799
|
}), closeSqlRuntime).pipe(catchAllCause2((cause2) => succeed8([
|
|
231559
231800
|
DEFAULT_RUN_WORKFLOW,
|
|
@@ -231679,7 +231920,7 @@ var startServerInBackground = (port2) => tryPromise2({
|
|
|
231679
231920
|
await logHandle.close();
|
|
231680
231921
|
}
|
|
231681
231922
|
},
|
|
231682
|
-
catch:
|
|
231923
|
+
catch: toError4
|
|
231683
231924
|
});
|
|
231684
231925
|
var readPidRecord = () => tryPromise2({
|
|
231685
231926
|
try: async () => {
|
|
@@ -231732,10 +231973,11 @@ var waitForReachability = (baseUrl2, expected) => gen2(function* () {
|
|
|
231732
231973
|
}
|
|
231733
231974
|
const error51 = yield* tryPromise2({
|
|
231734
231975
|
try: () => buildReachabilityTimeoutError(baseUrl2, expected),
|
|
231735
|
-
catch:
|
|
231976
|
+
catch: toError4
|
|
231736
231977
|
});
|
|
231737
231978
|
return yield* fail8(error51);
|
|
231738
231979
|
});
|
|
231980
|
+
var renderDenoSandboxDetail = (denoVersion) => denoVersion !== null ? `deno ${denoVersion}` : "deno not found (run `executor sandbox` to install)";
|
|
231739
231981
|
var getServerStatus = (baseUrl2) => gen2(function* () {
|
|
231740
231982
|
const pidRecord = yield* readPidRecord();
|
|
231741
231983
|
const reachable = yield* isServerReachable(baseUrl2);
|
|
@@ -231743,6 +231985,7 @@ var getServerStatus = (baseUrl2) => gen2(function* () {
|
|
|
231743
231985
|
const pid = typeof pidRecord?.pid === "number" ? pidRecord.pid : null;
|
|
231744
231986
|
const pidRunning = pid !== null ? isPidRunning(pid) : false;
|
|
231745
231987
|
const logFile = pidRecord?.logFile ?? DEFAULT_SERVER_LOG_FILE;
|
|
231988
|
+
const denoVersion = yield* getDenoVersion();
|
|
231746
231989
|
return {
|
|
231747
231990
|
baseUrl: baseUrl2,
|
|
231748
231991
|
reachable,
|
|
@@ -231753,7 +231996,8 @@ var getServerStatus = (baseUrl2) => gen2(function* () {
|
|
|
231753
231996
|
localDataDir: DEFAULT_LOCAL_DATA_DIR,
|
|
231754
231997
|
webAssetsDir: resolveRuntimeWebAssetsDir(),
|
|
231755
231998
|
migrationsDir: resolveRuntimeMigrationsDir(),
|
|
231756
|
-
installation
|
|
231999
|
+
installation,
|
|
232000
|
+
denoVersion
|
|
231757
232001
|
};
|
|
231758
232002
|
});
|
|
231759
232003
|
var renderStatus = (status2) => [
|
|
@@ -231766,10 +232010,11 @@ var renderStatus = (status2) => [
|
|
|
231766
232010
|
`localDataDir: ${status2.localDataDir}`,
|
|
231767
232011
|
`webAssetsDir: ${status2.webAssetsDir ?? "missing"}`,
|
|
231768
232012
|
`migrationsDir: ${status2.migrationsDir ?? "missing"}`,
|
|
231769
|
-
`workspaceId: ${status2.installation?.workspaceId ?? "unavailable"}
|
|
232013
|
+
`workspaceId: ${status2.installation?.workspaceId ?? "unavailable"}`,
|
|
232014
|
+
`denoSandbox: ${renderDenoSandboxDetail(status2.denoVersion)}`
|
|
231770
232015
|
].join(`
|
|
231771
232016
|
`);
|
|
231772
|
-
var getDoctorReport = (baseUrl2) => getServerStatus(baseUrl2).pipe(
|
|
232017
|
+
var getDoctorReport = (baseUrl2) => getServerStatus(baseUrl2).pipe(map16((status2) => {
|
|
231773
232018
|
const checks4 = {
|
|
231774
232019
|
serverReachable: {
|
|
231775
232020
|
ok: status2.reachable,
|
|
@@ -231800,8 +232045,8 @@ var getDoctorReport = (baseUrl2) => getServerStatus(baseUrl2).pipe(flatMap10((st
|
|
|
231800
232045
|
detail: status2.installation ? `workspace ${status2.installation.workspaceId}` : "local installation unavailable"
|
|
231801
232046
|
},
|
|
231802
232047
|
denoSandbox: {
|
|
231803
|
-
ok: denoVersion !== null,
|
|
231804
|
-
detail: denoVersion
|
|
232048
|
+
ok: status2.denoVersion !== null,
|
|
232049
|
+
detail: renderDenoSandboxDetail(status2.denoVersion)
|
|
231805
232050
|
}
|
|
231806
232051
|
};
|
|
231807
232052
|
return {
|
|
@@ -231809,7 +232054,7 @@ var getDoctorReport = (baseUrl2) => getServerStatus(baseUrl2).pipe(flatMap10((st
|
|
|
231809
232054
|
status: status2,
|
|
231810
232055
|
checks: checks4
|
|
231811
232056
|
};
|
|
231812
|
-
}))
|
|
232057
|
+
}));
|
|
231813
232058
|
var printJson = (value6) => sync3(() => {
|
|
231814
232059
|
console.log(JSON.stringify(value6, null, 2));
|
|
231815
232060
|
});
|
|
@@ -232062,8 +232307,28 @@ var driveExecution = (input) => gen2(function* () {
|
|
|
232062
232307
|
return current;
|
|
232063
232308
|
}
|
|
232064
232309
|
const parsed = parseInteractionPayload2(pending2);
|
|
232065
|
-
const
|
|
232066
|
-
|
|
232310
|
+
const handling = decideInteractionHandling({
|
|
232311
|
+
parsed,
|
|
232312
|
+
isInteractiveTerminal: process.stdin.isTTY && process.stdout.isTTY
|
|
232313
|
+
});
|
|
232314
|
+
if (handling === "url_interactive" && parsed?.mode === "url") {
|
|
232315
|
+
yield* printUrlInteraction({
|
|
232316
|
+
message: parsed.message,
|
|
232317
|
+
url: parsed.url ?? null,
|
|
232318
|
+
shouldOpen: input.shouldOpenUrls
|
|
232319
|
+
});
|
|
232320
|
+
current = yield* waitForExecutionProgress({
|
|
232321
|
+
client: input.client,
|
|
232322
|
+
workspaceId: input.workspaceId,
|
|
232323
|
+
executionId: current.execution.id,
|
|
232324
|
+
pendingInteractionId: pending2.id
|
|
232325
|
+
});
|
|
232326
|
+
continue;
|
|
232327
|
+
}
|
|
232328
|
+
if (handling === "url_paused") {
|
|
232329
|
+
if (input.shouldOpenUrls && parsed?.mode === "url" && parsed.url) {
|
|
232330
|
+
yield* openUrlInBrowser(parsed.url);
|
|
232331
|
+
}
|
|
232067
232332
|
const paused = buildPausedExecutionOutput({
|
|
232068
232333
|
executionId: current.execution.id,
|
|
232069
232334
|
interaction: pending2,
|
|
@@ -232077,19 +232342,19 @@ var driveExecution = (input) => gen2(function* () {
|
|
|
232077
232342
|
});
|
|
232078
232343
|
return current;
|
|
232079
232344
|
}
|
|
232080
|
-
if (
|
|
232081
|
-
|
|
232082
|
-
message: parsed.message,
|
|
232083
|
-
url: parsed.url ?? null,
|
|
232084
|
-
shouldOpen: input.shouldOpenUrls
|
|
232085
|
-
});
|
|
232086
|
-
current = yield* waitForExecutionProgress({
|
|
232087
|
-
client: input.client,
|
|
232088
|
-
workspaceId: input.workspaceId,
|
|
232345
|
+
if (handling === "form_paused") {
|
|
232346
|
+
const paused = buildPausedExecutionOutput({
|
|
232089
232347
|
executionId: current.execution.id,
|
|
232090
|
-
|
|
232348
|
+
interaction: pending2,
|
|
232349
|
+
baseUrl: input.baseUrl,
|
|
232350
|
+
shouldOpenUrls: input.shouldOpenUrls,
|
|
232351
|
+
cliName: CLI_NAME
|
|
232091
232352
|
});
|
|
232092
|
-
|
|
232353
|
+
yield* sync3(() => {
|
|
232354
|
+
console.log(JSON.stringify(paused));
|
|
232355
|
+
process.exitCode = 20;
|
|
232356
|
+
});
|
|
232357
|
+
return current;
|
|
232093
232358
|
}
|
|
232094
232359
|
const responseJson = yield* promptInteraction({
|
|
232095
232360
|
interaction: pending2,
|
|
@@ -232145,7 +232410,7 @@ var doctorCommand = exports_Command.make("doctor", {
|
|
|
232145
232410
|
`))))).pipe(exports_Command.withDescription("Check local executor install and daemon health"));
|
|
232146
232411
|
var getDenoVersion = () => tryPromise2({
|
|
232147
232412
|
try: () => new Promise((resolve9) => {
|
|
232148
|
-
const denoExecutable = process.env.DENO_BIN?.trim() || (process.env.HOME &&
|
|
232413
|
+
const denoExecutable = process.env.DENO_BIN?.trim() || (process.env.HOME && existsSync7(`${process.env.HOME}/.deno/bin/deno`) ? `${process.env.HOME}/.deno/bin/deno` : "deno");
|
|
232149
232414
|
const child = spawn3(denoExecutable, ["--version"], {
|
|
232150
232415
|
stdio: ["ignore", "pipe", "ignore"],
|
|
232151
232416
|
timeout: 5000
|
|
@@ -232224,7 +232489,7 @@ var resumeCommand = exports_Command.make("resume", {
|
|
|
232224
232489
|
}, ({ executionId, baseUrl: baseUrl2, noOpen }) => gen2(function* () {
|
|
232225
232490
|
yield* ensureServer(baseUrl2);
|
|
232226
232491
|
const { installation, client: client2 } = yield* getLocalAuthedClient(baseUrl2);
|
|
232227
|
-
const decodedExecutionId = yield* decodeExecutionId(executionId).pipe(mapError2((cause2) =>
|
|
232492
|
+
const decodedExecutionId = yield* decodeExecutionId(executionId).pipe(mapError2((cause2) => toError4(cause2)));
|
|
232228
232493
|
const execution2 = yield* client2.executions.get({
|
|
232229
232494
|
path: {
|
|
232230
232495
|
workspaceId: installation.workspaceId,
|
|
@@ -232294,7 +232559,7 @@ var hiddenServer = () => {
|
|
|
232294
232559
|
...getDefaultServerOptions(Number.isInteger(port2) && port2 > 0 ? port2 : DEFAULT_SERVER_PORT)
|
|
232295
232560
|
});
|
|
232296
232561
|
};
|
|
232297
|
-
var program = (hiddenServer() ?? helpOverride() ?? runCli(toEffectCliArgv(getCliArgs())).pipe(mapError2(
|
|
232562
|
+
var program = (hiddenServer() ?? helpOverride() ?? runCli(toEffectCliArgv(getCliArgs())).pipe(mapError2(toError4))).pipe(provide2(exports_NodeFileSystem.layer)).pipe(provide2(exports_NodePath.layer)).pipe(catchAllCause2((cause2) => sync3(() => {
|
|
232298
232563
|
console.error(pretty2(cause2));
|
|
232299
232564
|
process.exitCode = 1;
|
|
232300
232565
|
})));
|