just-bash 2.13.1 → 2.15.0-executor.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/AGENTS.md +2 -0
- package/dist/Bash.d.ts +86 -0
- package/dist/bin/chunks/{chunk-OQV5J23L.js → chunk-7G3MC56B.js} +1 -1
- package/dist/bin/chunks/{chunk-YX7OOTPO.js → chunk-AZ3RUDR2.js} +1 -1
- package/dist/bin/chunks/{chunk-UPUMZYZE.js → chunk-CM4532DS.js} +18 -18
- package/dist/bin/{shell/chunks/chunk-R2LDP472.js → chunks/chunk-EPPBDXOG.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-LGF54XJQ.js → chunks/chunk-L2JBII6Z.js} +1 -1
- package/dist/bin/chunks/chunk-MNMRGJJM.js +11 -0
- package/dist/bin/{shell/chunks/chunk-SYL34GE7.js → chunks/chunk-NAX7MTAR.js} +1 -1
- package/dist/bin/chunks/{chunk-EZS766DD.js → chunk-NLBRLRWD.js} +1 -1
- package/dist/bin/chunks/chunk-RLNOQILG.js +2 -0
- package/dist/bin/chunks/{chunk-VVFGRIJZ.js → chunk-RMQC3GS7.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-GR23MPTT.js → chunks/chunk-VHUYNUT7.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-FBJJY4ZV.js → chunks/chunk-WXMBDX4P.js} +1 -1
- package/dist/bin/chunks/expr-4CJYC4LY.js +2 -0
- package/dist/bin/{shell/chunks/flag-coverage-A4G6STMS.js → chunks/flag-coverage-LBMWMYOO.js} +1 -1
- package/dist/bin/{shell/chunks/jq-V7FYGIKO.js → chunks/jq-FIV5Q5T4.js} +1 -1
- package/dist/bin/chunks/{js-exec-JORCTVUT.js → js-exec-6UJKEL4G.js} +9 -9
- package/dist/bin/chunks/js-exec-worker.js +233 -1
- package/dist/bin/chunks/{ln-VAOSD4HK.js → ln-EGC4HRXZ.js} +1 -1
- package/dist/bin/{shell/chunks/mkdir-CH7JGW4N.js → chunks/mkdir-Z47OISSR.js} +1 -1
- package/dist/bin/chunks/python3-QOJU2POC.js +12 -0
- package/dist/bin/chunks/{rm-GWYJO4W7.js → rm-L3NZOLLG.js} +1 -1
- package/dist/bin/chunks/{sed-3C6IBX5L.js → sed-HALRQZKY.js} +1 -1
- package/dist/bin/chunks/{sqlite3-TZEE4O7U.js → sqlite3-CVNFMP3Z.js} +1 -1
- package/dist/bin/chunks/time-5R4QWCYF.js +2 -0
- package/dist/bin/{shell/chunks/tr-LZF57GYP.js → chunks/tr-4FPGAEVB.js} +1 -1
- package/dist/bin/chunks/worker.js +34 -8
- package/dist/bin/chunks/{yq-JJLSDDST.js → yq-Q47JUWL6.js} +1 -1
- package/dist/bin/just-bash.js +245 -245
- package/dist/bin/shell/chunks/{chunk-OQV5J23L.js → chunk-7G3MC56B.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-YX7OOTPO.js → chunk-AZ3RUDR2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-UPUMZYZE.js → chunk-CM4532DS.js} +18 -18
- package/dist/bin/{chunks/chunk-R2LDP472.js → shell/chunks/chunk-EPPBDXOG.js} +1 -1
- package/dist/bin/{chunks/chunk-LGF54XJQ.js → shell/chunks/chunk-L2JBII6Z.js} +1 -1
- package/dist/bin/shell/chunks/chunk-MNMRGJJM.js +11 -0
- package/dist/bin/{chunks/chunk-SYL34GE7.js → shell/chunks/chunk-NAX7MTAR.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-EZS766DD.js → chunk-NLBRLRWD.js} +1 -1
- package/dist/bin/shell/chunks/chunk-RLNOQILG.js +2 -0
- package/dist/bin/shell/chunks/{chunk-VVFGRIJZ.js → chunk-RMQC3GS7.js} +1 -1
- package/dist/bin/{chunks/chunk-GR23MPTT.js → shell/chunks/chunk-VHUYNUT7.js} +1 -1
- package/dist/bin/{chunks/chunk-FBJJY4ZV.js → shell/chunks/chunk-WXMBDX4P.js} +1 -1
- package/dist/bin/shell/chunks/expr-4CJYC4LY.js +2 -0
- package/dist/bin/{chunks/flag-coverage-A4G6STMS.js → shell/chunks/flag-coverage-LBMWMYOO.js} +1 -1
- package/dist/bin/{chunks/jq-V7FYGIKO.js → shell/chunks/jq-FIV5Q5T4.js} +1 -1
- package/dist/bin/shell/chunks/{js-exec-B6QNYHUL.js → js-exec-H26D5H6V.js} +9 -9
- package/dist/bin/shell/chunks/{ln-VAOSD4HK.js → ln-EGC4HRXZ.js} +1 -1
- package/dist/bin/{chunks/mkdir-CH7JGW4N.js → shell/chunks/mkdir-Z47OISSR.js} +1 -1
- package/dist/bin/shell/chunks/python3-O4VTP6TD.js +12 -0
- package/dist/bin/shell/chunks/{rm-GWYJO4W7.js → rm-L3NZOLLG.js} +1 -1
- package/dist/bin/shell/chunks/{sed-3C6IBX5L.js → sed-HALRQZKY.js} +1 -1
- package/dist/bin/shell/chunks/{sqlite3-TZEE4O7U.js → sqlite3-CVNFMP3Z.js} +1 -1
- package/dist/bin/shell/chunks/time-5R4QWCYF.js +2 -0
- package/dist/bin/{chunks/tr-LZF57GYP.js → shell/chunks/tr-4FPGAEVB.js} +1 -1
- package/dist/bin/shell/chunks/{yq-JJLSDDST.js → yq-Q47JUWL6.js} +1 -1
- package/dist/bin/shell/shell.js +127 -127
- package/dist/bundle/browser.js +250 -250
- package/dist/bundle/chunks/chunk-3THT3N7L.js +1 -0
- package/dist/bundle/chunks/{chunk-XXZ46GOX.js → chunk-62RKD26F.js} +1 -1
- package/dist/bundle/chunks/chunk-B6O2PIY4.js +10 -0
- package/dist/bundle/chunks/{chunk-IUWCBQII.js → chunk-HWBSOZZR.js} +18 -18
- package/dist/bundle/chunks/{chunk-64CW2LGZ.js → chunk-MDDMCKUK.js} +1 -1
- package/dist/bundle/chunks/{chunk-IP7G3BNA.js → chunk-MIZPJHVH.js} +1 -1
- package/dist/bundle/chunks/{chunk-V3IEYMEA.js → chunk-OL3S66CO.js} +1 -1
- package/dist/bundle/chunks/{chunk-FGALERPA.js → chunk-PBXLG62G.js} +1 -1
- package/dist/bundle/chunks/{chunk-O2DBFL6Z.js → chunk-XORM457F.js} +1 -1
- package/dist/bundle/chunks/{chunk-RUF7WQ7U.js → chunk-YCFVLTST.js} +1 -1
- package/dist/bundle/chunks/{chunk-RVT3MU3A.js → chunk-YFG2CMIF.js} +1 -1
- package/dist/bundle/chunks/{chunk-F5CMUULS.js → chunk-Z6LRHWXI.js} +1 -1
- package/dist/bundle/chunks/expr-5T3UU5KE.js +1 -0
- package/dist/bundle/chunks/{flag-coverage-G2R7PMYU.js → flag-coverage-LMTH7T5F.js} +1 -1
- package/dist/bundle/chunks/{jq-DIRZBOTX.js → jq-ODXZBPLY.js} +1 -1
- package/dist/bundle/chunks/{js-exec-YJSMH5AG.js → js-exec-OOPTBRNB.js} +9 -9
- package/dist/bundle/chunks/js-exec-worker.js +233 -1
- package/dist/bundle/chunks/{ln-UJ6YJVBK.js → ln-4TRFBYAT.js} +1 -1
- package/dist/bundle/chunks/{mkdir-F6XHPXZC.js → mkdir-TDEMSB6C.js} +1 -1
- package/dist/bundle/chunks/python3-5F2XPEW4.js +11 -0
- package/dist/bundle/chunks/{rm-FYNVTQIU.js → rm-RTZG23RL.js} +1 -1
- package/dist/bundle/chunks/{sed-DISNI47D.js → sed-VFTTATXJ.js} +1 -1
- package/dist/bundle/chunks/{sqlite3-7F22DOIP.js → sqlite3-56UMWEY3.js} +1 -1
- package/dist/bundle/chunks/time-DEUO3QV2.js +1 -0
- package/dist/bundle/chunks/{tr-GVTWMRZB.js → tr-2HXZRDSW.js} +1 -1
- package/dist/bundle/chunks/worker.js +34 -8
- package/dist/bundle/chunks/{yq-XMVSIL6Z.js → yq-MJMAR36V.js} +1 -1
- package/dist/bundle/index.cjs +745 -745
- package/dist/bundle/index.js +159 -159
- package/dist/commands/js-exec/executor-adapter.d.ts +66 -0
- package/dist/commands/js-exec/js-exec.d.ts +19 -1
- package/dist/commands/js-exec/worker.d.ts +8 -0
- package/dist/commands/worker-bridge/bridge-handler.d.ts +3 -1
- package/dist/commands/worker-bridge/protocol.d.ts +1 -0
- package/dist/commands/worker-bridge/sync-backend.d.ts +5 -0
- package/dist/executor-init.d.ts +10 -0
- package/dist/fs/sanitize-error.d.ts +9 -6
- package/dist/interpreter/interpreter.d.ts +2 -0
- package/dist/interpreter/types.d.ts +5 -0
- package/dist/network/allow-list.d.ts +3 -2
- package/dist/network/types.d.ts +3 -0
- package/dist/types.d.ts +6 -0
- package/package.json +37 -34
- package/vendor/cpython-emscripten/python.wasm +0 -0
- package/vendor/executor/executor-sdk-bundle.d.mts +18 -0
- package/vendor/executor/executor-sdk-bundle.mjs +972 -0
- package/dist/bin/chunks/chunk-SYG3IW7P.js +0 -2
- package/dist/bin/chunks/chunk-TKTKRRAL.js +0 -11
- package/dist/bin/chunks/expr-VEFRBJT4.js +0 -2
- package/dist/bin/chunks/python3-PF7AHNQM.js +0 -12
- package/dist/bin/chunks/time-DDS6JJ23.js +0 -2
- package/dist/bin/shell/chunks/chunk-SYG3IW7P.js +0 -2
- package/dist/bin/shell/chunks/chunk-TKTKRRAL.js +0 -11
- package/dist/bin/shell/chunks/expr-VEFRBJT4.js +0 -2
- package/dist/bin/shell/chunks/python3-J7DP4JBQ.js +0 -12
- package/dist/bin/shell/chunks/time-DDS6JJ23.js +0 -2
- package/dist/bundle/chunks/chunk-CCNMISUL.js +0 -1
- package/dist/bundle/chunks/chunk-H2WXJGD7.js +0 -10
- package/dist/bundle/chunks/expr-74QHYJL5.js +0 -1
- package/dist/bundle/chunks/python3-6HF56IYI.js +0 -11
- package/dist/bundle/chunks/time-YG5BMRIQ.js +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter for using js-exec as a CodeExecutor runtime for @executor/sdk.
|
|
3
|
+
*
|
|
4
|
+
* This module exports a Promise-based executor that can be wrapped with
|
|
5
|
+
* Effect.tryPromise() to satisfy the CodeExecutor interface.
|
|
6
|
+
*
|
|
7
|
+
* Usage with @executor/sdk:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { createJustBashCodeExecutor } from 'just-bash/executor';
|
|
11
|
+
* import { createExecutor } from '@executor/sdk';
|
|
12
|
+
* import type { CodeExecutor } from '@executor/sdk';
|
|
13
|
+
* import * as Effect from 'effect/Effect';
|
|
14
|
+
*
|
|
15
|
+
* const jb = createJustBashCodeExecutor();
|
|
16
|
+
*
|
|
17
|
+
* const codeExecutor: CodeExecutor = {
|
|
18
|
+
* execute: (code, toolInvoker) =>
|
|
19
|
+
* Effect.tryPromise(() =>
|
|
20
|
+
* jb.execute(code, (path, args) =>
|
|
21
|
+
* Effect.runPromise(toolInvoker.invoke({ path, args }))
|
|
22
|
+
* )
|
|
23
|
+
* ),
|
|
24
|
+
* };
|
|
25
|
+
*
|
|
26
|
+
* const executor = await createExecutor({
|
|
27
|
+
* runtime: codeExecutor,
|
|
28
|
+
* tools: { ... },
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import type { IFileSystem } from "../../fs/interface.js";
|
|
33
|
+
import type { SecureFetch } from "../../network/index.js";
|
|
34
|
+
import { type ExecutorResult } from "./js-exec.js";
|
|
35
|
+
export interface JustBashExecutorOptions {
|
|
36
|
+
/** Virtual filesystem for code to access. Defaults to an empty InMemoryFs. */
|
|
37
|
+
fs?: IFileSystem;
|
|
38
|
+
/** Working directory inside the sandbox. Defaults to /home/user. */
|
|
39
|
+
cwd?: string;
|
|
40
|
+
/** Environment variables available to code. Defaults to empty. */
|
|
41
|
+
env?: Record<string, string>;
|
|
42
|
+
/** Network fetch function. Defaults to undefined (no network). */
|
|
43
|
+
fetch?: SecureFetch;
|
|
44
|
+
}
|
|
45
|
+
export interface JustBashCodeExecutor {
|
|
46
|
+
/**
|
|
47
|
+
* Execute code with tool invocation support.
|
|
48
|
+
*
|
|
49
|
+
* @param code - JavaScript code to execute. Can use `await` and `return`.
|
|
50
|
+
* Tools are available as `tools.namespace.method(args)`.
|
|
51
|
+
* @param invokeTool - Callback to handle tool invocations.
|
|
52
|
+
* Receives (path, args) and should return the tool result.
|
|
53
|
+
* @returns ExecutorResult with result, error, and captured logs.
|
|
54
|
+
*/
|
|
55
|
+
execute(code: string, invokeTool: (path: string, args: unknown) => Promise<unknown>): Promise<ExecutorResult>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create a js-exec based code executor for use with @executor/sdk.
|
|
59
|
+
*
|
|
60
|
+
* The executor runs JavaScript code in a QuickJS sandbox with:
|
|
61
|
+
* - A `tools` proxy for invoking registered tools
|
|
62
|
+
* - Console output captured to `logs` array
|
|
63
|
+
* - Return value captured in `result`
|
|
64
|
+
* - Full Node.js-compatible module system (fs, path, etc.)
|
|
65
|
+
*/
|
|
66
|
+
export declare function createJustBashCodeExecutor(options?: JustBashExecutorOptions): JustBashCodeExecutor;
|
|
@@ -6,6 +6,24 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This command is Node.js only (uses worker_threads).
|
|
8
8
|
*/
|
|
9
|
-
import type { Command } from "../../types.js";
|
|
9
|
+
import type { Command, CommandContext } from "../../types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Result from executing code in executor mode.
|
|
12
|
+
* Compatible with @executor/sdk's ExecuteResult shape.
|
|
13
|
+
*/
|
|
14
|
+
export interface ExecutorResult {
|
|
15
|
+
result: unknown;
|
|
16
|
+
error?: string;
|
|
17
|
+
logs?: string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Execute JavaScript code in executor mode with tool invocation support.
|
|
21
|
+
* Used as the runtime for @executor/sdk's CodeExecutor interface.
|
|
22
|
+
*
|
|
23
|
+
* - Console output is captured to `logs` instead of stdout/stderr
|
|
24
|
+
* - Tool calls via `tools.x.y(args)` are routed through `invokeTool`
|
|
25
|
+
* - The return value of the code is captured in `result`
|
|
26
|
+
*/
|
|
27
|
+
export declare function executeForExecutor(code: string, ctx: CommandContext, invokeTool: (path: string, argsJson: string) => Promise<string>): Promise<ExecutorResult>;
|
|
10
28
|
export declare const jsExecCommand: Command;
|
|
11
29
|
export declare const nodeStubCommand: Command;
|
|
@@ -21,10 +21,18 @@ export interface JsExecWorkerInput {
|
|
|
21
21
|
isModule?: boolean;
|
|
22
22
|
stripTypes?: boolean;
|
|
23
23
|
timeoutMs?: number;
|
|
24
|
+
/** When true, tools proxy is available (console still goes to stdout/stderr) */
|
|
25
|
+
hasExecutorTools?: boolean;
|
|
26
|
+
/** When true, runs in full executor mode: tools proxy, log capture, result capture */
|
|
27
|
+
executorMode?: boolean;
|
|
24
28
|
}
|
|
25
29
|
export interface JsExecWorkerOutput {
|
|
26
30
|
protocolToken?: string;
|
|
27
31
|
success: boolean;
|
|
28
32
|
error?: string;
|
|
29
33
|
defenseStats?: WorkerDefenseStats;
|
|
34
|
+
/** JSON-serialized return value (executor mode only) */
|
|
35
|
+
executorResult?: string;
|
|
36
|
+
/** Captured console logs (executor mode only) */
|
|
37
|
+
executorLogs?: string[];
|
|
30
38
|
}
|
|
@@ -22,13 +22,14 @@ export declare class BridgeHandler {
|
|
|
22
22
|
private secureFetch;
|
|
23
23
|
private maxOutputSize;
|
|
24
24
|
private exec;
|
|
25
|
+
private invokeTool;
|
|
25
26
|
private protocol;
|
|
26
27
|
private running;
|
|
27
28
|
private output;
|
|
28
29
|
private outputLimitExceeded;
|
|
29
30
|
private startTime;
|
|
30
31
|
private timeoutMs;
|
|
31
|
-
constructor(sharedBuffer: SharedArrayBuffer, fs: IFileSystem, cwd: string, commandName: string, secureFetch?: SecureFetch | undefined, maxOutputSize?: number, exec?: ((command: string, options: CommandExecOptions) => Promise<ExecResult>) | undefined);
|
|
32
|
+
constructor(sharedBuffer: SharedArrayBuffer, fs: IFileSystem, cwd: string, commandName: string, secureFetch?: SecureFetch | undefined, maxOutputSize?: number, exec?: ((command: string, options: CommandExecOptions) => Promise<ExecResult>) | undefined, invokeTool?: ((path: string, argsJson: string) => Promise<string>) | undefined);
|
|
32
33
|
/**
|
|
33
34
|
* Returns remaining milliseconds before the overall execution deadline.
|
|
34
35
|
*/
|
|
@@ -67,5 +68,6 @@ export declare class BridgeHandler {
|
|
|
67
68
|
private appendOutputLimitError;
|
|
68
69
|
private handleHttpRequest;
|
|
69
70
|
private handleExecCommand;
|
|
71
|
+
private handleInvokeTool;
|
|
70
72
|
private setErrorFromException;
|
|
71
73
|
}
|
|
@@ -77,4 +77,9 @@ export declare class SyncBackend {
|
|
|
77
77
|
stderr: string;
|
|
78
78
|
exitCode: number;
|
|
79
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Invoke a tool through the main thread's tool invoker (executor mode).
|
|
82
|
+
* Returns the JSON-serialized result.
|
|
83
|
+
*/
|
|
84
|
+
invokeTool(path: string, argsJson: string): string;
|
|
80
85
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executor SDK lazy initialization.
|
|
3
|
+
* Separated from Bash.ts so the browser bundle never sees these imports.
|
|
4
|
+
* Only loaded at runtime behind a __BROWSER__ guard.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExecutorConfig, ExecutorSDKHandle } from "./Bash.js";
|
|
7
|
+
export declare function initExecutorSDK(setup: (sdk: ExecutorSDKHandle) => Promise<void>, approval: ExecutorConfig["onToolApproval"] | undefined, fs: import("./fs/interface.js").IFileSystem, getCwd: () => string, getEnv: () => Map<string, string>, getLimits: () => import("./limits.js").ExecutionLimits | undefined): Promise<{
|
|
8
|
+
sdk: ExecutorSDKHandle;
|
|
9
|
+
invokeTool: (path: string, argsJson: string) => Promise<string>;
|
|
10
|
+
}>;
|
|
@@ -5,12 +5,15 @@
|
|
|
5
5
|
* safely be imported in browser bundles.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* Sanitize an error message to strip real OS
|
|
8
|
+
* Sanitize an error message to strip common real OS paths and stack traces.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* - Strips stack trace lines (`\n at ...`).
|
|
13
|
-
* - Preserves error codes (ENOENT, EACCES, etc.) and virtual paths that don't
|
|
14
|
-
* match known OS prefixes.
|
|
10
|
+
* Preserves virtual paths that don't match the common host prefixes used by
|
|
11
|
+
* the default runtime.
|
|
15
12
|
*/
|
|
16
13
|
export declare function sanitizeErrorMessage(message: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Aggressive sanitizer for host-originated errors such as worker/bootstrap
|
|
16
|
+
* failures. This also scrubs file:// URLs and additional runtime roots that
|
|
17
|
+
* are common in hosted environments.
|
|
18
|
+
*/
|
|
19
|
+
export declare function sanitizeHostErrorMessage(message: string): string;
|
|
@@ -41,6 +41,8 @@ export interface InterpreterOptions {
|
|
|
41
41
|
requireDefenseContext?: boolean;
|
|
42
42
|
/** Bootstrap JavaScript code for js-exec */
|
|
43
43
|
jsBootstrapCode?: string;
|
|
44
|
+
/** Tool invoker for executor mode (js-exec) */
|
|
45
|
+
executorInvokeTool?: (path: string, argsJson: string) => Promise<string>;
|
|
44
46
|
}
|
|
45
47
|
export declare class Interpreter {
|
|
46
48
|
private ctx;
|
|
@@ -341,4 +341,9 @@ export interface InterpreterContext {
|
|
|
341
341
|
* Threaded through the context chain instead of shell env.
|
|
342
342
|
*/
|
|
343
343
|
jsBootstrapCode?: string;
|
|
344
|
+
/**
|
|
345
|
+
* Tool invoker for executor mode (js-exec).
|
|
346
|
+
* When present, js-exec sets up a `tools` proxy.
|
|
347
|
+
*/
|
|
348
|
+
executorInvokeTool?: (path: string, argsJson: string) => Promise<string>;
|
|
344
349
|
}
|
|
@@ -28,8 +28,9 @@ export declare function normalizeAllowListEntry(entry: string): {
|
|
|
28
28
|
*
|
|
29
29
|
* The matching rules are:
|
|
30
30
|
* 1. Origins must match exactly (case-sensitive for scheme and host)
|
|
31
|
-
* 2.
|
|
32
|
-
* 3.
|
|
31
|
+
* 2. Path-scoped entries match on path segment boundaries, not raw string prefix
|
|
32
|
+
* 3. Ambiguous encoded separators (%2f, %5c) are rejected for path-scoped entries
|
|
33
|
+
* 4. If the allow-list entry has no path (or just "/"), all paths are allowed
|
|
33
34
|
*
|
|
34
35
|
* @param url The URL to check (as a string)
|
|
35
36
|
* @param allowedEntry The allow-list entry to match against
|
package/dist/network/types.d.ts
CHANGED
|
@@ -62,8 +62,11 @@ export interface NetworkConfig {
|
|
|
62
62
|
* - https://api.example.com/v1/users/123
|
|
63
63
|
*
|
|
64
64
|
* But NOT:
|
|
65
|
+
* - https://api.example.com/v10
|
|
66
|
+
* - https://api.example.com/v1-admin
|
|
65
67
|
* - https://api.example.com/v2/users
|
|
66
68
|
* - https://api.example.org/v1/users (different origin)
|
|
69
|
+
* - URLs that rely on ambiguous encoded separators like %2f or %5c
|
|
67
70
|
*
|
|
68
71
|
* Invalid entries (missing scheme, missing host, relative paths) will throw an error.
|
|
69
72
|
*/
|
package/dist/types.d.ts
CHANGED
|
@@ -182,6 +182,12 @@ export interface CommandContext {
|
|
|
182
182
|
* user access/injection via environment variables.
|
|
183
183
|
*/
|
|
184
184
|
jsBootstrapCode?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Tool invoker for executor mode (js-exec).
|
|
187
|
+
* When present, js-exec sets up a `tools` proxy that routes calls through this.
|
|
188
|
+
* The function receives (path, argsJson) and returns a JSON result string.
|
|
189
|
+
*/
|
|
190
|
+
executorInvokeTool?: (path: string, argsJson: string) => Promise<string>;
|
|
185
191
|
}
|
|
186
192
|
export interface Command {
|
|
187
193
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "just-bash",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0-executor.0",
|
|
4
4
|
"description": "A simulated bash environment with virtual filesystem",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"dist/sandbox/*.d.ts",
|
|
45
45
|
"dist/utils/*.d.ts",
|
|
46
46
|
"vendor/cpython-emscripten/",
|
|
47
|
+
"vendor/executor/",
|
|
47
48
|
"README.md",
|
|
48
49
|
"dist/AGENTS.md"
|
|
49
50
|
],
|
|
@@ -54,6 +55,38 @@
|
|
|
54
55
|
"publishConfig": {
|
|
55
56
|
"access": "public"
|
|
56
57
|
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "rm -rf dist && tsc && pnpm build:lib && pnpm build:lib:cjs && pnpm build:browser && pnpm build:cli && pnpm build:shell && pnpm build:worker && pnpm build:clean && cp dist/index.d.ts dist/index.d.cts && sed '1,/^-->/d' AGENTS.npm.md > dist/AGENTS.md",
|
|
60
|
+
"build:clean": "find dist -name '*.test.js' -delete && find dist -name '*.test.d.ts' -delete",
|
|
61
|
+
"build:worker": "esbuild src/commands/python3/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/python3/worker.js --external:../../../vendor/cpython-emscripten/* && cp src/commands/python3/worker.js dist/commands/python3/worker.js && mkdir -p dist/bin/chunks && cp src/commands/python3/worker.js dist/bin/chunks/worker.js && mkdir -p dist/bundle/chunks && cp src/commands/python3/worker.js dist/bundle/chunks/worker.js && esbuild src/commands/js-exec/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/js-exec/worker.js --external:quickjs-emscripten && cp src/commands/js-exec/worker.js dist/commands/js-exec/worker.js && cp src/commands/js-exec/worker.js dist/bin/chunks/js-exec-worker.js && cp src/commands/js-exec/worker.js dist/bundle/chunks/js-exec-worker.js",
|
|
62
|
+
"build:lib": "esbuild dist/index.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs --external:effect --external:@effect/platform --external:@effect/platform-node --external:../vendor/executor/*",
|
|
63
|
+
"build:lib:cjs": "esbuild dist/index.js --bundle --platform=node --format=cjs --minify --outfile=dist/bundle/index.cjs --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs --external:effect --external:@effect/platform --external:@effect/platform-node --external:../vendor/executor/*",
|
|
64
|
+
"build:browser": "esbuild dist/browser.js --bundle --platform=browser --format=esm --minify --outfile=dist/bundle/browser.js --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:node:zlib --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs --define:__BROWSER__=true --alias:node:dns=./src/shims/browser-unsupported.js",
|
|
65
|
+
"build:cli": "esbuild dist/cli/just-bash.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs --external:effect --external:@effect/platform --external:@effect/platform-node --external:../vendor/executor/*",
|
|
66
|
+
"build:shell": "esbuild dist/cli/shell.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin/shell --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
|
|
67
|
+
"prepublishOnly": "pnpm validate",
|
|
68
|
+
"validate": "pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm check:worker-sync && pnpm test:run && pnpm test:wasm && pnpm test:dist && pnpm test:examples",
|
|
69
|
+
"test:examples": "cd examples/cjs-consumer && pnpm install --no-frozen-lockfile && npx tsc --noEmit",
|
|
70
|
+
"typecheck": "tsc --noEmit",
|
|
71
|
+
"lint": "biome check . && pnpm lint:banned",
|
|
72
|
+
"check:worker-sync": "node scripts/check-worker-sync.js",
|
|
73
|
+
"lint:banned": "node scripts/check-banned-patterns.js",
|
|
74
|
+
"lint:fix": "biome check --write .",
|
|
75
|
+
"knip": "knip",
|
|
76
|
+
"test": "vitest",
|
|
77
|
+
"test:run": "vitest run --exclude src/security/fuzzing/ --exclude src/commands/python3/ --exclude src/commands/sqlite3/ --exclude src/commands/js-exec/ --exclude src/agent-examples/python-scripting.test.ts",
|
|
78
|
+
"test:dist": "vitest run src/cli/just-bash.bundle.test.ts",
|
|
79
|
+
"test:unit": "vitest run --config vitest.unit.config.ts",
|
|
80
|
+
"test:wasm": "vitest run --config vitest.wasm.config.ts",
|
|
81
|
+
"test:comparison": "vitest run --config vitest.comparison.config.ts",
|
|
82
|
+
"test:comparison:record": "RECORD_FIXTURES=1 vitest run --config vitest.comparison.config.ts",
|
|
83
|
+
"test:coverage": "vitest run --coverage",
|
|
84
|
+
"test:coverage:unit": "vitest run --config vitest.unit.config.ts --coverage",
|
|
85
|
+
"test:fuzz": "vitest run src/security/fuzzing/",
|
|
86
|
+
"test:fuzz:long": "FUZZ_RUNS=10000 vitest run src/security/fuzzing/",
|
|
87
|
+
"shell": "npx tsx src/cli/shell.ts",
|
|
88
|
+
"dev:exec": "npx tsx src/cli/exec.ts"
|
|
89
|
+
},
|
|
57
90
|
"keywords": [],
|
|
58
91
|
"author": "Malte and Claude",
|
|
59
92
|
"license": "Apache-2.0",
|
|
@@ -75,6 +108,7 @@
|
|
|
75
108
|
"dependencies": {
|
|
76
109
|
"compressjs": "^1.0.3",
|
|
77
110
|
"diff": "^8.0.2",
|
|
111
|
+
"effect": "^3.21.0",
|
|
78
112
|
"fast-xml-parser": "^5.3.3",
|
|
79
113
|
"file-type": "^21.2.0",
|
|
80
114
|
"ini": "^6.0.0",
|
|
@@ -93,36 +127,5 @@
|
|
|
93
127
|
"@mongodb-js/zstd": "^7.0.0",
|
|
94
128
|
"node-liblzma": "^2.0.3"
|
|
95
129
|
},
|
|
96
|
-
"packageManager": "pnpm@8.15.9+sha512.499434c9d8fdd1a2794ebf4552b3b25c0a633abcee5bb15e7b5de90f32f47b513aca98cd5cfd001c31f0db454bc3804edccd578501e4ca293a6816166bbd9f81"
|
|
97
|
-
|
|
98
|
-
"build": "rm -rf dist && tsc && pnpm build:lib && pnpm build:lib:cjs && pnpm build:browser && pnpm build:cli && pnpm build:shell && pnpm build:worker && pnpm build:clean && cp dist/index.d.ts dist/index.d.cts && sed '1,/^-->/d' AGENTS.npm.md > dist/AGENTS.md",
|
|
99
|
-
"build:clean": "find dist -name '*.test.js' -delete && find dist -name '*.test.d.ts' -delete",
|
|
100
|
-
"build:worker": "esbuild src/commands/python3/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/python3/worker.js --external:../../../vendor/cpython-emscripten/* && cp src/commands/python3/worker.js dist/commands/python3/worker.js && mkdir -p dist/bin/chunks && cp src/commands/python3/worker.js dist/bin/chunks/worker.js && mkdir -p dist/bundle/chunks && cp src/commands/python3/worker.js dist/bundle/chunks/worker.js && esbuild src/commands/js-exec/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/js-exec/worker.js --external:quickjs-emscripten && cp src/commands/js-exec/worker.js dist/commands/js-exec/worker.js && cp src/commands/js-exec/worker.js dist/bin/chunks/js-exec-worker.js && cp src/commands/js-exec/worker.js dist/bundle/chunks/js-exec-worker.js",
|
|
101
|
-
"build:lib": "esbuild dist/index.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
|
|
102
|
-
"build:lib:cjs": "esbuild dist/index.js --bundle --platform=node --format=cjs --minify --outfile=dist/bundle/index.cjs --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
|
|
103
|
-
"build:browser": "esbuild dist/browser.js --bundle --platform=browser --format=esm --minify --outfile=dist/bundle/browser.js --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:node:zlib --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs --define:__BROWSER__=true --alias:node:dns=./src/shims/browser-unsupported.js",
|
|
104
|
-
"build:cli": "esbuild dist/cli/just-bash.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
|
|
105
|
-
"build:shell": "esbuild dist/cli/shell.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin/shell --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
|
|
106
|
-
"validate": "pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm check:worker-sync && pnpm test:run && pnpm test:wasm && pnpm test:dist && pnpm test:examples",
|
|
107
|
-
"test:examples": "cd examples/cjs-consumer && pnpm install --no-frozen-lockfile && npx tsc --noEmit",
|
|
108
|
-
"typecheck": "tsc --noEmit",
|
|
109
|
-
"lint": "biome check . && pnpm lint:banned",
|
|
110
|
-
"check:worker-sync": "node scripts/check-worker-sync.js",
|
|
111
|
-
"lint:banned": "node scripts/check-banned-patterns.js",
|
|
112
|
-
"lint:fix": "biome check --write .",
|
|
113
|
-
"knip": "knip",
|
|
114
|
-
"test": "vitest",
|
|
115
|
-
"test:run": "vitest run --exclude src/security/fuzzing/ --exclude src/commands/python3/ --exclude src/commands/sqlite3/ --exclude src/commands/js-exec/ --exclude src/agent-examples/python-scripting.test.ts",
|
|
116
|
-
"test:dist": "vitest run src/cli/just-bash.bundle.test.ts",
|
|
117
|
-
"test:unit": "vitest run --config vitest.unit.config.ts",
|
|
118
|
-
"test:wasm": "vitest run --config vitest.wasm.config.ts",
|
|
119
|
-
"test:comparison": "vitest run --config vitest.comparison.config.ts",
|
|
120
|
-
"test:comparison:record": "RECORD_FIXTURES=1 vitest run --config vitest.comparison.config.ts",
|
|
121
|
-
"test:coverage": "vitest run --coverage",
|
|
122
|
-
"test:coverage:unit": "vitest run --config vitest.unit.config.ts --coverage",
|
|
123
|
-
"test:fuzz": "vitest run src/security/fuzzing/",
|
|
124
|
-
"test:fuzz:long": "FUZZ_RUNS=10000 vitest run src/security/fuzzing/",
|
|
125
|
-
"shell": "npx tsx src/cli/shell.ts",
|
|
126
|
-
"dev:exec": "npx tsx src/cli/exec.ts"
|
|
127
|
-
}
|
|
128
|
-
}
|
|
130
|
+
"packageManager": "pnpm@8.15.9+sha512.499434c9d8fdd1a2794ebf4552b3b25c0a633abcee5bb15e7b5de90f32f47b513aca98cd5cfd001c31f0db454bc3804edccd578501e4ca293a6816166bbd9f81"
|
|
131
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Vendored @executor/sdk bundle — re-exports createExecutor and types */
|
|
2
|
+
export declare function createExecutor(options: {
|
|
3
|
+
runtime?: unknown;
|
|
4
|
+
storage?: unknown;
|
|
5
|
+
tools?: Record<string, { description?: string; execute: (...args: unknown[]) => unknown }>;
|
|
6
|
+
onToolApproval?: unknown;
|
|
7
|
+
onInteraction?: unknown;
|
|
8
|
+
resolveSecret?: unknown;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
execute: (code: string) => Promise<{ result: unknown; error?: string; logs?: string[] }>;
|
|
11
|
+
sources: {
|
|
12
|
+
add: (input: Record<string, unknown>, options?: Record<string, unknown>) => Promise<unknown>;
|
|
13
|
+
list: () => Promise<unknown[]>;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
close: () => Promise<void>;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}>;
|