executor 1.3.0-beta.5 → 1.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/executor +53 -0
- package/package.json +6 -20
- package/postinstall.cjs +102 -0
- package/README.md +0 -395
- package/bin/deno-subprocess-worker.mjs +0 -205
- package/bin/emscripten-module.wasm +0 -0
- package/bin/executor.js +0 -42
- package/bin/executor.mjs +0 -367200
- package/bin/keyring.linux-x64-gnu-62qs1shy.node +0 -0
- package/bin/keyring.linux-x64-musl-n4e0vcy6.node +0 -0
- package/bin/sandbox-worker.mjs +0 -5850
- package/node_modules/@1password/sdk/README.md +0 -146
- package/node_modules/@1password/sdk/dist/client.d.ts +0 -14
- package/node_modules/@1password/sdk/dist/client.js +0 -19
- package/node_modules/@1password/sdk/dist/client_builder.d.ts +0 -8
- package/node_modules/@1password/sdk/dist/client_builder.js +0 -36
- package/node_modules/@1password/sdk/dist/configuration.d.ts +0 -23
- package/node_modules/@1password/sdk/dist/configuration.js +0 -58
- package/node_modules/@1password/sdk/dist/core.d.ts +0 -92
- package/node_modules/@1password/sdk/dist/core.js +0 -119
- package/node_modules/@1password/sdk/dist/environments.d.ts +0 -19
- package/node_modules/@1password/sdk/dist/environments.js +0 -53
- package/node_modules/@1password/sdk/dist/errors.d.ts +0 -9
- package/node_modules/@1password/sdk/dist/errors.js +0 -36
- package/node_modules/@1password/sdk/dist/groups.d.ts +0 -19
- package/node_modules/@1password/sdk/dist/groups.js +0 -54
- package/node_modules/@1password/sdk/dist/items.d.ts +0 -89
- package/node_modules/@1password/sdk/dist/items.js +0 -216
- package/node_modules/@1password/sdk/dist/items_files.d.ts +0 -40
- package/node_modules/@1password/sdk/dist/items_files.js +0 -116
- package/node_modules/@1password/sdk/dist/items_shares.d.ts +0 -32
- package/node_modules/@1password/sdk/dist/items_shares.js +0 -95
- package/node_modules/@1password/sdk/dist/sdk.d.ts +0 -14
- package/node_modules/@1password/sdk/dist/sdk.js +0 -45
- package/node_modules/@1password/sdk/dist/secrets.d.ts +0 -36
- package/node_modules/@1password/sdk/dist/secrets.js +0 -107
- package/node_modules/@1password/sdk/dist/shared_lib_core.d.ts +0 -16
- package/node_modules/@1password/sdk/dist/shared_lib_core.js +0 -177
- package/node_modules/@1password/sdk/dist/types.d.ts +0 -769
- package/node_modules/@1password/sdk/dist/types.js +0 -260
- package/node_modules/@1password/sdk/dist/vaults.d.ts +0 -83
- package/node_modules/@1password/sdk/dist/vaults.js +0 -209
- package/node_modules/@1password/sdk/dist/version.d.ts +0 -2
- package/node_modules/@1password/sdk/dist/version.js +0 -6
- package/node_modules/@1password/sdk/package.json +0 -47
- package/node_modules/@1password/sdk-core/nodejs/core.d.ts +0 -18
- package/node_modules/@1password/sdk-core/nodejs/core.js +0 -798
- package/node_modules/@1password/sdk-core/nodejs/core_bg.wasm +0 -0
- package/node_modules/@1password/sdk-core/nodejs/core_bg.wasm.d.ts +0 -20
- package/node_modules/@1password/sdk-core/package.json +0 -16
- package/resources/web/assets/c-BIGW1oBm.js +0 -1
- package/resources/web/assets/cpp-BRuaLJcg.js +0 -1
- package/resources/web/assets/csharp-COcwbKMJ.js +0 -1
- package/resources/web/assets/css-DPfMkruS.js +0 -1
- package/resources/web/assets/diff-D97Zzqfu.js +0 -1
- package/resources/web/assets/dockerfile-BcOcwvcX.js +0 -1
- package/resources/web/assets/go-CxLEBnE3.js +0 -1
- package/resources/web/assets/graphql-ChdNCCLP.js +0 -1
- package/resources/web/assets/highlighted-body-TPN3WLV5-46YyTVIj.js +0 -1
- package/resources/web/assets/html-GMplVEZG.js +0 -1
- package/resources/web/assets/http-jrhK8wxY.js +0 -1
- package/resources/web/assets/index-CRuElBS1.js +0 -1
- package/resources/web/assets/index-vE9OfFSV.js +0 -10
- package/resources/web/assets/java-CylS5w8V.js +0 -1
- package/resources/web/assets/javascript-wDzz0qaB.js +0 -1
- package/resources/web/assets/json-Cp-IABpG.js +0 -1
- package/resources/web/assets/jsonc-Des-eS-w.js +0 -1
- package/resources/web/assets/jsx-g9-lgVsj.js +0 -1
- package/resources/web/assets/kotlin-BdnUsdx6.js +0 -1
- package/resources/web/assets/log-2UxHyX5q.js +0 -1
- package/resources/web/assets/markdown-Cvjx9yec.js +0 -1
- package/resources/web/assets/mermaid-O7DHMXV3-C705YdCO.js +0 -394
- package/resources/web/assets/mermaid-O7DHMXV3-CQK1gbuD.css +0 -1
- package/resources/web/assets/php-Dhbhpdrm.js +0 -1
- package/resources/web/assets/proto-C7zT0LnQ.js +0 -1
- package/resources/web/assets/python-B6aJPvgy.js +0 -1
- package/resources/web/assets/ruby-xesJ3fNi.js +0 -1
- package/resources/web/assets/rust-B1yitclQ.js +0 -1
- package/resources/web/assets/shellscript-Yzrsuije.js +0 -1
- package/resources/web/assets/sql-BLtJtn59.js +0 -1
- package/resources/web/assets/swift-D82vCrfD.js +0 -1
- package/resources/web/assets/toml-vGWfd6FD.js +0 -1
- package/resources/web/assets/tsx-COt5Ahok.js +0 -1
- package/resources/web/assets/typescript-BPQ3VLAy.js +0 -1
- package/resources/web/assets/vitesse-dark-D0r3Knsf.js +0 -1
- package/resources/web/assets/xml-sdJ4AIDG.js +0 -1
- package/resources/web/assets/yaml-Buea-lGh.js +0 -1
- package/resources/web/index.html +0 -24
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// This script runs inside the Deno subprocess.
|
|
3
|
-
// It communicates with the host process via line-delimited JSON over stdin/stdout.
|
|
4
|
-
// All IPC messages are prefixed with @@executor-ipc@@ to distinguish from user output.
|
|
5
|
-
|
|
6
|
-
const encoder = new TextEncoder();
|
|
7
|
-
const IPC_PREFIX = "@@executor-ipc@@";
|
|
8
|
-
|
|
9
|
-
const pendingToolCalls = new Map();
|
|
10
|
-
let started = false;
|
|
11
|
-
|
|
12
|
-
/** @type {string[]} */
|
|
13
|
-
const logs = [];
|
|
14
|
-
|
|
15
|
-
const writeIpcMessage = (message) => {
|
|
16
|
-
const payload = `${IPC_PREFIX}${JSON.stringify(message)}\n`;
|
|
17
|
-
Deno.stdout.writeSync(encoder.encode(payload));
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const toErrorMessage = (error) => {
|
|
21
|
-
if (error instanceof Error) {
|
|
22
|
-
return error.stack ?? error.message;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return String(error);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const createToolCaller = (toolPath) => (args) =>
|
|
29
|
-
new Promise((resolve, reject) => {
|
|
30
|
-
const requestId = crypto.randomUUID();
|
|
31
|
-
pendingToolCalls.set(requestId, { resolve, reject });
|
|
32
|
-
|
|
33
|
-
writeIpcMessage({
|
|
34
|
-
type: "tool_call",
|
|
35
|
-
requestId,
|
|
36
|
-
toolPath,
|
|
37
|
-
args: args === undefined ? {} : args,
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const createToolsProxy = (path = []) => {
|
|
42
|
-
const callable = () => undefined;
|
|
43
|
-
|
|
44
|
-
return new Proxy(callable, {
|
|
45
|
-
get(_target, prop) {
|
|
46
|
-
if (prop === "then") return undefined;
|
|
47
|
-
if (typeof prop !== "string") return undefined;
|
|
48
|
-
return createToolsProxy([...path, prop]);
|
|
49
|
-
},
|
|
50
|
-
apply(_target, _thisArg, args) {
|
|
51
|
-
const toolPath = path.join(".");
|
|
52
|
-
if (!toolPath) {
|
|
53
|
-
throw new Error("Tool path missing in invocation");
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return createToolCaller(toolPath)(args.length > 0 ? args[0] : undefined);
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const formatLogArg = (value) => {
|
|
62
|
-
if (typeof value === "string") {
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
return JSON.stringify(value);
|
|
68
|
-
} catch {
|
|
69
|
-
return String(value);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const formatLogLine = (args) => args.map(formatLogArg).join(" ");
|
|
74
|
-
|
|
75
|
-
const sandboxConsole = {
|
|
76
|
-
log: (...args) => {
|
|
77
|
-
logs.push(`[log] ${formatLogLine(args)}`);
|
|
78
|
-
},
|
|
79
|
-
warn: (...args) => {
|
|
80
|
-
logs.push(`[warn] ${formatLogLine(args)}`);
|
|
81
|
-
},
|
|
82
|
-
error: (...args) => {
|
|
83
|
-
logs.push(`[error] ${formatLogLine(args)}`);
|
|
84
|
-
},
|
|
85
|
-
info: (...args) => {
|
|
86
|
-
logs.push(`[info] ${formatLogLine(args)}`);
|
|
87
|
-
},
|
|
88
|
-
debug: (...args) => {
|
|
89
|
-
logs.push(`[debug] ${formatLogLine(args)}`);
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const runUserCode = async (code) => {
|
|
94
|
-
const tools = createToolsProxy();
|
|
95
|
-
|
|
96
|
-
const execute = new Function(
|
|
97
|
-
"tools",
|
|
98
|
-
"console",
|
|
99
|
-
`"use strict"; return (async () => {\n${code}\n})();`,
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
return await execute(tools, sandboxConsole);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const handleStart = (message) => {
|
|
106
|
-
if (started) {
|
|
107
|
-
writeIpcMessage({
|
|
108
|
-
type: "failed",
|
|
109
|
-
error: "start message already received",
|
|
110
|
-
logs,
|
|
111
|
-
});
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
started = true;
|
|
116
|
-
|
|
117
|
-
runUserCode(message.code)
|
|
118
|
-
.then((result) => {
|
|
119
|
-
writeIpcMessage({
|
|
120
|
-
type: "completed",
|
|
121
|
-
result,
|
|
122
|
-
logs,
|
|
123
|
-
});
|
|
124
|
-
})
|
|
125
|
-
.catch((error) => {
|
|
126
|
-
writeIpcMessage({
|
|
127
|
-
type: "failed",
|
|
128
|
-
error: toErrorMessage(error),
|
|
129
|
-
logs,
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const handleToolResult = (message) => {
|
|
135
|
-
const pending = pendingToolCalls.get(message.requestId);
|
|
136
|
-
if (!pending) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
pendingToolCalls.delete(message.requestId);
|
|
141
|
-
|
|
142
|
-
if (message.ok) {
|
|
143
|
-
pending.resolve(message.value);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
pending.reject(new Error(message.error));
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const handleHostMessage = (message) => {
|
|
151
|
-
if (!message || typeof message !== "object") {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (message.type === "start") {
|
|
156
|
-
handleStart(message);
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (message.type === "tool_result") {
|
|
161
|
-
handleToolResult(message);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const decodeLines = async () => {
|
|
166
|
-
const reader = Deno.stdin.readable.getReader();
|
|
167
|
-
const decoder = new TextDecoder();
|
|
168
|
-
let buffer = "";
|
|
169
|
-
|
|
170
|
-
while (true) {
|
|
171
|
-
const { value, done } = await reader.read();
|
|
172
|
-
if (done) {
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
buffer += decoder.decode(value, { stream: true });
|
|
177
|
-
|
|
178
|
-
while (true) {
|
|
179
|
-
const lineEnd = buffer.indexOf("\n");
|
|
180
|
-
if (lineEnd === -1) {
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const line = buffer.slice(0, lineEnd).trim();
|
|
185
|
-
buffer = buffer.slice(lineEnd + 1);
|
|
186
|
-
|
|
187
|
-
if (line.length === 0) {
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
try {
|
|
192
|
-
const message = JSON.parse(line);
|
|
193
|
-
handleHostMessage(message);
|
|
194
|
-
} catch (error) {
|
|
195
|
-
writeIpcMessage({
|
|
196
|
-
type: "failed",
|
|
197
|
-
error: `invalid host message: ${toErrorMessage(error)}`,
|
|
198
|
-
logs,
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
await decodeLines();
|
|
Binary file
|
package/bin/executor.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { readFileSync, readdirSync } from "node:fs";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
|
|
6
|
-
const isMusl = () => {
|
|
7
|
-
try {
|
|
8
|
-
return readFileSync("/usr/bin/ldd", "utf8").includes("musl");
|
|
9
|
-
} catch {}
|
|
10
|
-
|
|
11
|
-
if (typeof process.report?.getReport === "function") {
|
|
12
|
-
const report = process.report.getReport();
|
|
13
|
-
if (report?.header?.glibcVersionRuntime) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(report?.sharedObjects)) {
|
|
17
|
-
return report.sharedObjects.some((file) => file.includes("libc.musl-") || file.includes("ld-musl-"));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return false;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const resolveBundledKeyringNativeLibraryPath = () => {
|
|
25
|
-
if (process.platform !== "linux" || process.arch !== "x64") {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const binDir = dirname(fileURLToPath(import.meta.url));
|
|
30
|
-
const pattern = isMusl()
|
|
31
|
-
? /^keyring\.linux-x64-musl-.*\.node$/
|
|
32
|
-
: /^keyring\.linux-x64-gnu-.*\.node$/;
|
|
33
|
-
const match = readdirSync(binDir).find((entry) => pattern.test(entry));
|
|
34
|
-
return match ? join(binDir, match) : null;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const bundledKeyringNativeLibraryPath = resolveBundledKeyringNativeLibraryPath();
|
|
38
|
-
if (bundledKeyringNativeLibraryPath && !process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
39
|
-
process.env.NAPI_RS_NATIVE_LIBRARY_PATH = bundledKeyringNativeLibraryPath;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
await import("./executor.mjs");
|