executor 1.1.7 → 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 +347 -78
- package/bin/postinstall.js +38 -0
- package/package.json +4 -1
- package/resources/web/assets/{highlighted-body-TPN3WLV5-7EpIVxkV.js → highlighted-body-TPN3WLV5-D2YQWXND.js} +1 -1
- package/resources/web/assets/{index-DwCqwpD3.js → index-BnjZoxRo.js} +2 -2
- package/resources/web/assets/{mermaid-O7DHMXV3-vieFHMDb.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 {
|
|
@@ -230694,7 +230856,11 @@ var createExecutorMcpServer = async (config3) => {
|
|
|
230694
230856
|
return buildToolResult(created);
|
|
230695
230857
|
});
|
|
230696
230858
|
const resumeTool = server.registerTool("resume", {
|
|
230697
|
-
description:
|
|
230859
|
+
description: [
|
|
230860
|
+
"Resume a paused executor execution using the resumePayload returned by execute.",
|
|
230861
|
+
"Never call this without getting approval from the user first unless they explicitly state otherwise."
|
|
230862
|
+
].join(`
|
|
230863
|
+
`),
|
|
230698
230864
|
inputSchema: resumeInputSchema
|
|
230699
230865
|
}, async (input) => {
|
|
230700
230866
|
const resumed = await driveExecutionWithoutElicitation({
|
|
@@ -230844,6 +231010,9 @@ var defaultLinuxStateHome = trim4(process.env.XDG_STATE_HOME) ?? join10(home, ".
|
|
|
230844
231010
|
var defaultWindowsHome = join10(trim4(process.env.LOCALAPPDATA) ?? join10(home, "AppData", "Local"), "Executor");
|
|
230845
231011
|
var defaultMacHome = join10(home, "Library", "Application Support", "Executor");
|
|
230846
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");
|
|
230847
231016
|
var DEFAULT_SERVER_PORT = 8788;
|
|
230848
231017
|
var DEFAULT_SERVER_HOST = "127.0.0.1";
|
|
230849
231018
|
var DEFAULT_SERVER_BASE_URL = `http://${DEFAULT_SERVER_HOST}:${DEFAULT_SERVER_PORT}`;
|
|
@@ -230851,6 +231020,11 @@ var DEFAULT_EXECUTOR_HOME = explicitExecutorHome ?? (isWindows ? defaultWindowsH
|
|
|
230851
231020
|
var DEFAULT_EXECUTOR_DATA_DIR = trim4(process.env[EXECUTOR_DATA_DIR_ENV]) ?? join10(DEFAULT_EXECUTOR_HOME, "data");
|
|
230852
231021
|
var DEFAULT_EXECUTOR_RUN_DIR = explicitExecutorHome ? join10(DEFAULT_EXECUTOR_HOME, "run") : isWindows || isMac ? join10(DEFAULT_EXECUTOR_HOME, "run") : join10(defaultLinuxStateHome, "executor", "run");
|
|
230853
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);
|
|
230854
231028
|
var DEFAULT_SERVER_PID_FILE = trim4(process.env[EXECUTOR_SERVER_PID_FILE_ENV]) ?? join10(DEFAULT_EXECUTOR_RUN_DIR, "server.pid");
|
|
230855
231029
|
var DEFAULT_SERVER_LOG_FILE = trim4(process.env[EXECUTOR_SERVER_LOG_FILE_ENV]) ?? join10(DEFAULT_EXECUTOR_RUN_DIR, "server.log");
|
|
230856
231030
|
var SERVER_START_TIMEOUT_MS = 5000;
|
|
@@ -230861,6 +231035,71 @@ var disposeRuntime = (runtime6) => tryPromise2({
|
|
|
230861
231035
|
try: () => runtime6.close(),
|
|
230862
231036
|
catch: (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2 ?? "runtime close failed"))
|
|
230863
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
|
+
});
|
|
230864
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));
|
|
230865
231104
|
var safeFilePath = (assetsDir, pathname) => {
|
|
230866
231105
|
const target = resolve6(assetsDir, `.${pathname}`);
|
|
@@ -230976,23 +231215,21 @@ var isApiRequest = (request) => {
|
|
|
230976
231215
|
return pathname === "/mcp" || pathname === "/v1" || pathname.startsWith("/v1/");
|
|
230977
231216
|
};
|
|
230978
231217
|
var createLocalExecutorRequestHandler = (options10 = {}) => gen2(function* () {
|
|
230979
|
-
const
|
|
230980
|
-
|
|
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:") {
|
|
230981
231221
|
yield* tryPromise2({
|
|
230982
|
-
try: () => mkdir3(dirname5(
|
|
231222
|
+
try: () => mkdir3(dirname5(requestedLocalDataDir), { recursive: true }),
|
|
230983
231223
|
catch: (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2))
|
|
230984
231224
|
});
|
|
230985
231225
|
}
|
|
230986
231226
|
let baseUrlRef;
|
|
230987
|
-
const runtime6 = yield* acquireRelease2(
|
|
230988
|
-
localDataDir,
|
|
230989
|
-
migrationsFolder: options10.migrationsFolder,
|
|
230990
|
-
executionResolver: options10.executionResolver,
|
|
230991
|
-
resolveSecretMaterial: options10.resolveSecretMaterial,
|
|
230992
|
-
getLocalServerBaseUrl: () => baseUrlRef
|
|
230993
|
-
}).pipe(mapError2((cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2)))), disposeRuntime);
|
|
231227
|
+
const runtime6 = yield* acquireRelease2(createRuntimeWithLegacyMigration(requestedLocalDataDir, legacyLocalDataDirs, () => baseUrlRef, options10), disposeRuntime);
|
|
230994
231228
|
const apiHandler = yield* createControlPlaneWebHandler(runtime6);
|
|
230995
|
-
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));
|
|
230996
231233
|
return {
|
|
230997
231234
|
runtime: runtime6,
|
|
230998
231235
|
handleApiRequest: (request) => {
|
|
@@ -231227,7 +231464,7 @@ var seedGithubOpenApiSourceInWorkspace = (input) => gen2(function* () {
|
|
|
231227
231464
|
});
|
|
231228
231465
|
|
|
231229
231466
|
// apps/executor/src/cli/runtime-paths.ts
|
|
231230
|
-
import { existsSync as
|
|
231467
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
231231
231468
|
import { dirname as dirname6, extname as extname3, resolve as resolve7 } from "node:path";
|
|
231232
231469
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
231233
231470
|
var sourceDir = dirname6(fileURLToPath6(import.meta.url));
|
|
@@ -231241,7 +231478,7 @@ var resolveIfExists = (value6) => {
|
|
|
231241
231478
|
return null;
|
|
231242
231479
|
}
|
|
231243
231480
|
const resolved = resolve7(candidate);
|
|
231244
|
-
return
|
|
231481
|
+
return existsSync6(resolved) ? resolved : null;
|
|
231245
231482
|
};
|
|
231246
231483
|
var getSourceEntrypoint = () => {
|
|
231247
231484
|
const candidate = trim5(process.argv[1]);
|
|
@@ -231254,21 +231491,21 @@ var getSourceEntrypoint = () => {
|
|
|
231254
231491
|
};
|
|
231255
231492
|
var resolveBundledNodeLauncher = () => {
|
|
231256
231493
|
const candidate = resolve7(sourceDir, "executor.js");
|
|
231257
|
-
return
|
|
231494
|
+
return existsSync6(candidate) ? candidate : null;
|
|
231258
231495
|
};
|
|
231259
231496
|
var resolveRuntimeResourcesRoot = () => {
|
|
231260
231497
|
const compiledCandidate = resolve7(dirname6(process.execPath), "../resources");
|
|
231261
|
-
if (
|
|
231498
|
+
if (existsSync6(compiledCandidate)) {
|
|
231262
231499
|
return compiledCandidate;
|
|
231263
231500
|
}
|
|
231264
231501
|
const bundledCandidateFromModule = resolve7(sourceDir, "../resources");
|
|
231265
|
-
if (
|
|
231502
|
+
if (existsSync6(bundledCandidateFromModule)) {
|
|
231266
231503
|
return bundledCandidateFromModule;
|
|
231267
231504
|
}
|
|
231268
231505
|
const sourceEntrypoint = getSourceEntrypoint();
|
|
231269
231506
|
if (sourceEntrypoint) {
|
|
231270
231507
|
const bundledCandidate = resolve7(dirname6(sourceEntrypoint), "../resources");
|
|
231271
|
-
if (
|
|
231508
|
+
if (existsSync6(bundledCandidate)) {
|
|
231272
231509
|
return bundledCandidate;
|
|
231273
231510
|
}
|
|
231274
231511
|
}
|
|
@@ -231390,8 +231627,16 @@ var buildPausedExecutionOutput = (input) => {
|
|
|
231390
231627
|
};
|
|
231391
231628
|
};
|
|
231392
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
|
+
|
|
231393
231638
|
// apps/executor/src/cli/main.ts
|
|
231394
|
-
var
|
|
231639
|
+
var toError4 = (cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2));
|
|
231395
231640
|
var sleep5 = (ms8) => promise2(() => new Promise((resolve9) => setTimeout(resolve9, ms8)));
|
|
231396
231641
|
var openUrlInBrowser = (url4) => sync3(() => {
|
|
231397
231642
|
const cmd = process.platform === "darwin" ? ["open", url4] : process.platform === "win32" ? ["cmd", "/c", "start", "", url4] : ["xdg-open", url4];
|
|
@@ -231418,7 +231663,7 @@ var promptLine = (prompt4) => tryPromise2({
|
|
|
231418
231663
|
rl5.close();
|
|
231419
231664
|
}
|
|
231420
231665
|
},
|
|
231421
|
-
catch:
|
|
231666
|
+
catch: toError4
|
|
231422
231667
|
});
|
|
231423
231668
|
var readStdin = () => tryPromise2({
|
|
231424
231669
|
try: async () => {
|
|
@@ -231429,7 +231674,7 @@ var readStdin = () => tryPromise2({
|
|
|
231429
231674
|
}
|
|
231430
231675
|
return contents;
|
|
231431
231676
|
},
|
|
231432
|
-
catch:
|
|
231677
|
+
catch: toError4
|
|
231433
231678
|
});
|
|
231434
231679
|
var readCode = (input) => gen2(function* () {
|
|
231435
231680
|
if (input.code && input.code.trim().length > 0) {
|
|
@@ -231438,7 +231683,7 @@ var readCode = (input) => gen2(function* () {
|
|
|
231438
231683
|
if (input.file && input.file.trim().length > 0) {
|
|
231439
231684
|
const contents = yield* tryPromise2({
|
|
231440
231685
|
try: () => readFile5(input.file, "utf8"),
|
|
231441
|
-
catch:
|
|
231686
|
+
catch: toError4
|
|
231442
231687
|
});
|
|
231443
231688
|
if (contents.trim().length > 0) {
|
|
231444
231689
|
return contents;
|
|
@@ -231455,7 +231700,7 @@ var readCode = (input) => gen2(function* () {
|
|
|
231455
231700
|
});
|
|
231456
231701
|
var getBootstrapClient = (baseUrl2 = DEFAULT_SERVER_BASE_URL) => createControlPlaneClient({ baseUrl: baseUrl2 });
|
|
231457
231702
|
var decodeExecutionId = decodeUnknown2(ExecutionIdSchema);
|
|
231458
|
-
var cliSourceDir = dirname7(
|
|
231703
|
+
var cliSourceDir = dirname7(fileURLToPath7(import.meta.url));
|
|
231459
231704
|
var CLI_NAME = "executor";
|
|
231460
231705
|
var CLI_VERSION = (() => {
|
|
231461
231706
|
const candidatePaths = [
|
|
@@ -231463,7 +231708,7 @@ var CLI_VERSION = (() => {
|
|
|
231463
231708
|
resolve8(cliSourceDir, "../../package.json")
|
|
231464
231709
|
];
|
|
231465
231710
|
for (const candidatePath of candidatePaths) {
|
|
231466
|
-
if (!
|
|
231711
|
+
if (!existsSync7(candidatePath)) {
|
|
231467
231712
|
continue;
|
|
231468
231713
|
}
|
|
231469
231714
|
try {
|
|
@@ -231531,17 +231776,17 @@ var formatCatalogUnavailableMessage = (cause2) => {
|
|
|
231531
231776
|
};
|
|
231532
231777
|
var closeSqlRuntime = (runtime6) => tryPromise2({
|
|
231533
231778
|
try: () => runtime6.close(),
|
|
231534
|
-
catch:
|
|
231779
|
+
catch: toError4
|
|
231535
231780
|
}).pipe(catchAll2(() => _void));
|
|
231536
231781
|
var buildRunWorkflowText = (catalog) => {
|
|
231537
231782
|
if (!catalog) {
|
|
231538
231783
|
return succeed8(DEFAULT_RUN_WORKFLOW);
|
|
231539
231784
|
}
|
|
231540
|
-
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));
|
|
231541
231786
|
};
|
|
231542
231787
|
var loadRunWorkflowText = () => acquireUseRelease2(createSqlControlPlaneRuntime({
|
|
231543
231788
|
localDataDir: DEFAULT_LOCAL_DATA_DIR
|
|
231544
|
-
}).pipe(mapError2(
|
|
231789
|
+
}).pipe(mapError2(toError4)), (runtime6) => gen2(function* () {
|
|
231545
231790
|
const environment2 = yield* gen2(function* () {
|
|
231546
231791
|
const resolveExecutionEnvironment = yield* RuntimeExecutionResolverService;
|
|
231547
231792
|
return yield* resolveExecutionEnvironment({
|
|
@@ -231549,7 +231794,7 @@ var loadRunWorkflowText = () => acquireUseRelease2(createSqlControlPlaneRuntime(
|
|
|
231549
231794
|
accountId: runtime6.localInstallation.accountId,
|
|
231550
231795
|
executionId: ExecutionIdSchema.make("exec_help")
|
|
231551
231796
|
});
|
|
231552
|
-
}).pipe(provide2(runtime6.runtimeLayer), mapError2(
|
|
231797
|
+
}).pipe(provide2(runtime6.runtimeLayer), mapError2(toError4));
|
|
231553
231798
|
return yield* buildRunWorkflowText(environment2.catalog);
|
|
231554
231799
|
}), closeSqlRuntime).pipe(catchAllCause2((cause2) => succeed8([
|
|
231555
231800
|
DEFAULT_RUN_WORKFLOW,
|
|
@@ -231675,7 +231920,7 @@ var startServerInBackground = (port2) => tryPromise2({
|
|
|
231675
231920
|
await logHandle.close();
|
|
231676
231921
|
}
|
|
231677
231922
|
},
|
|
231678
|
-
catch:
|
|
231923
|
+
catch: toError4
|
|
231679
231924
|
});
|
|
231680
231925
|
var readPidRecord = () => tryPromise2({
|
|
231681
231926
|
try: async () => {
|
|
@@ -231728,10 +231973,11 @@ var waitForReachability = (baseUrl2, expected) => gen2(function* () {
|
|
|
231728
231973
|
}
|
|
231729
231974
|
const error51 = yield* tryPromise2({
|
|
231730
231975
|
try: () => buildReachabilityTimeoutError(baseUrl2, expected),
|
|
231731
|
-
catch:
|
|
231976
|
+
catch: toError4
|
|
231732
231977
|
});
|
|
231733
231978
|
return yield* fail8(error51);
|
|
231734
231979
|
});
|
|
231980
|
+
var renderDenoSandboxDetail = (denoVersion) => denoVersion !== null ? `deno ${denoVersion}` : "deno not found (run `executor sandbox` to install)";
|
|
231735
231981
|
var getServerStatus = (baseUrl2) => gen2(function* () {
|
|
231736
231982
|
const pidRecord = yield* readPidRecord();
|
|
231737
231983
|
const reachable = yield* isServerReachable(baseUrl2);
|
|
@@ -231739,6 +231985,7 @@ var getServerStatus = (baseUrl2) => gen2(function* () {
|
|
|
231739
231985
|
const pid = typeof pidRecord?.pid === "number" ? pidRecord.pid : null;
|
|
231740
231986
|
const pidRunning = pid !== null ? isPidRunning(pid) : false;
|
|
231741
231987
|
const logFile = pidRecord?.logFile ?? DEFAULT_SERVER_LOG_FILE;
|
|
231988
|
+
const denoVersion = yield* getDenoVersion();
|
|
231742
231989
|
return {
|
|
231743
231990
|
baseUrl: baseUrl2,
|
|
231744
231991
|
reachable,
|
|
@@ -231749,7 +231996,8 @@ var getServerStatus = (baseUrl2) => gen2(function* () {
|
|
|
231749
231996
|
localDataDir: DEFAULT_LOCAL_DATA_DIR,
|
|
231750
231997
|
webAssetsDir: resolveRuntimeWebAssetsDir(),
|
|
231751
231998
|
migrationsDir: resolveRuntimeMigrationsDir(),
|
|
231752
|
-
installation
|
|
231999
|
+
installation,
|
|
232000
|
+
denoVersion
|
|
231753
232001
|
};
|
|
231754
232002
|
});
|
|
231755
232003
|
var renderStatus = (status2) => [
|
|
@@ -231762,10 +232010,11 @@ var renderStatus = (status2) => [
|
|
|
231762
232010
|
`localDataDir: ${status2.localDataDir}`,
|
|
231763
232011
|
`webAssetsDir: ${status2.webAssetsDir ?? "missing"}`,
|
|
231764
232012
|
`migrationsDir: ${status2.migrationsDir ?? "missing"}`,
|
|
231765
|
-
`workspaceId: ${status2.installation?.workspaceId ?? "unavailable"}
|
|
232013
|
+
`workspaceId: ${status2.installation?.workspaceId ?? "unavailable"}`,
|
|
232014
|
+
`denoSandbox: ${renderDenoSandboxDetail(status2.denoVersion)}`
|
|
231766
232015
|
].join(`
|
|
231767
232016
|
`);
|
|
231768
|
-
var getDoctorReport = (baseUrl2) => getServerStatus(baseUrl2).pipe(
|
|
232017
|
+
var getDoctorReport = (baseUrl2) => getServerStatus(baseUrl2).pipe(map16((status2) => {
|
|
231769
232018
|
const checks4 = {
|
|
231770
232019
|
serverReachable: {
|
|
231771
232020
|
ok: status2.reachable,
|
|
@@ -231796,8 +232045,8 @@ var getDoctorReport = (baseUrl2) => getServerStatus(baseUrl2).pipe(flatMap10((st
|
|
|
231796
232045
|
detail: status2.installation ? `workspace ${status2.installation.workspaceId}` : "local installation unavailable"
|
|
231797
232046
|
},
|
|
231798
232047
|
denoSandbox: {
|
|
231799
|
-
ok: denoVersion !== null,
|
|
231800
|
-
detail: denoVersion
|
|
232048
|
+
ok: status2.denoVersion !== null,
|
|
232049
|
+
detail: renderDenoSandboxDetail(status2.denoVersion)
|
|
231801
232050
|
}
|
|
231802
232051
|
};
|
|
231803
232052
|
return {
|
|
@@ -231805,7 +232054,7 @@ var getDoctorReport = (baseUrl2) => getServerStatus(baseUrl2).pipe(flatMap10((st
|
|
|
231805
232054
|
status: status2,
|
|
231806
232055
|
checks: checks4
|
|
231807
232056
|
};
|
|
231808
|
-
}))
|
|
232057
|
+
}));
|
|
231809
232058
|
var printJson = (value6) => sync3(() => {
|
|
231810
232059
|
console.log(JSON.stringify(value6, null, 2));
|
|
231811
232060
|
});
|
|
@@ -232058,8 +232307,28 @@ var driveExecution = (input) => gen2(function* () {
|
|
|
232058
232307
|
return current;
|
|
232059
232308
|
}
|
|
232060
232309
|
const parsed = parseInteractionPayload2(pending2);
|
|
232061
|
-
const
|
|
232062
|
-
|
|
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
|
+
}
|
|
232063
232332
|
const paused = buildPausedExecutionOutput({
|
|
232064
232333
|
executionId: current.execution.id,
|
|
232065
232334
|
interaction: pending2,
|
|
@@ -232073,19 +232342,19 @@ var driveExecution = (input) => gen2(function* () {
|
|
|
232073
232342
|
});
|
|
232074
232343
|
return current;
|
|
232075
232344
|
}
|
|
232076
|
-
if (
|
|
232077
|
-
|
|
232078
|
-
message: parsed.message,
|
|
232079
|
-
url: parsed.url ?? null,
|
|
232080
|
-
shouldOpen: input.shouldOpenUrls
|
|
232081
|
-
});
|
|
232082
|
-
current = yield* waitForExecutionProgress({
|
|
232083
|
-
client: input.client,
|
|
232084
|
-
workspaceId: input.workspaceId,
|
|
232345
|
+
if (handling === "form_paused") {
|
|
232346
|
+
const paused = buildPausedExecutionOutput({
|
|
232085
232347
|
executionId: current.execution.id,
|
|
232086
|
-
|
|
232348
|
+
interaction: pending2,
|
|
232349
|
+
baseUrl: input.baseUrl,
|
|
232350
|
+
shouldOpenUrls: input.shouldOpenUrls,
|
|
232351
|
+
cliName: CLI_NAME
|
|
232087
232352
|
});
|
|
232088
|
-
|
|
232353
|
+
yield* sync3(() => {
|
|
232354
|
+
console.log(JSON.stringify(paused));
|
|
232355
|
+
process.exitCode = 20;
|
|
232356
|
+
});
|
|
232357
|
+
return current;
|
|
232089
232358
|
}
|
|
232090
232359
|
const responseJson = yield* promptInteraction({
|
|
232091
232360
|
interaction: pending2,
|
|
@@ -232141,7 +232410,7 @@ var doctorCommand = exports_Command.make("doctor", {
|
|
|
232141
232410
|
`))))).pipe(exports_Command.withDescription("Check local executor install and daemon health"));
|
|
232142
232411
|
var getDenoVersion = () => tryPromise2({
|
|
232143
232412
|
try: () => new Promise((resolve9) => {
|
|
232144
|
-
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");
|
|
232145
232414
|
const child = spawn3(denoExecutable, ["--version"], {
|
|
232146
232415
|
stdio: ["ignore", "pipe", "ignore"],
|
|
232147
232416
|
timeout: 5000
|
|
@@ -232220,7 +232489,7 @@ var resumeCommand = exports_Command.make("resume", {
|
|
|
232220
232489
|
}, ({ executionId, baseUrl: baseUrl2, noOpen }) => gen2(function* () {
|
|
232221
232490
|
yield* ensureServer(baseUrl2);
|
|
232222
232491
|
const { installation, client: client2 } = yield* getLocalAuthedClient(baseUrl2);
|
|
232223
|
-
const decodedExecutionId = yield* decodeExecutionId(executionId).pipe(mapError2((cause2) =>
|
|
232492
|
+
const decodedExecutionId = yield* decodeExecutionId(executionId).pipe(mapError2((cause2) => toError4(cause2)));
|
|
232224
232493
|
const execution2 = yield* client2.executions.get({
|
|
232225
232494
|
path: {
|
|
232226
232495
|
workspaceId: installation.workspaceId,
|
|
@@ -232290,7 +232559,7 @@ var hiddenServer = () => {
|
|
|
232290
232559
|
...getDefaultServerOptions(Number.isInteger(port2) && port2 > 0 ? port2 : DEFAULT_SERVER_PORT)
|
|
232291
232560
|
});
|
|
232292
232561
|
};
|
|
232293
|
-
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(() => {
|
|
232294
232563
|
console.error(pretty2(cause2));
|
|
232295
232564
|
process.exitCode = 1;
|
|
232296
232565
|
})));
|