@jini-ai/sandbox 0.4.1 → 0.4.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/dist/cjs/node-worker.d.ts +2 -0
- package/dist/cjs/node-worker.js +11 -2
- package/dist/node-worker.d.ts +2 -0
- package/dist/node-worker.js +11 -2
- package/package.json +1 -1
|
@@ -105,6 +105,8 @@ export interface NodeWorkerFactoryOptions {
|
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Native Node worker factory. TypeScript bootstrap configuration is explicit and host-owned.
|
|
108
|
+
* Worker stdin is disabled and output is drained without forwarding to parent stdio;
|
|
109
|
+
* results and controlled failures travel over the message/error ports instead.
|
|
108
110
|
* @param required Environment copied to each worker; nothing reads the parent environment.
|
|
109
111
|
* @param options Optional native creation port and TypeScript registration module; its eval entry suppresses V8 coverage.
|
|
110
112
|
* @returns WorkerFactory for caller-owned JS/TS entry paths, with no package-relative lookup.
|
package/dist/cjs/node-worker.js
CHANGED
|
@@ -101,6 +101,8 @@ function renderInWorkerSandbox(required, options = {}) {
|
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* Native Node worker factory. TypeScript bootstrap configuration is explicit and host-owned.
|
|
104
|
+
* Worker stdin is disabled and output is drained without forwarding to parent stdio;
|
|
105
|
+
* results and controlled failures travel over the message/error ports instead.
|
|
104
106
|
* @param required Environment copied to each worker; nothing reads the parent environment.
|
|
105
107
|
* @param options Optional native creation port and TypeScript registration module; its eval entry suppresses V8 coverage.
|
|
106
108
|
* @returns WorkerFactory for caller-owned JS/TS entry paths, with no package-relative lookup.
|
|
@@ -110,6 +112,10 @@ function createNodeWorkerFactory({ env }, options = {}) {
|
|
|
110
112
|
return {
|
|
111
113
|
spawn({ workerEntry, payload, resourceLimits }) {
|
|
112
114
|
const workerEnv = { ...env };
|
|
115
|
+
const workerOptions = {
|
|
116
|
+
workerData: payload, resourceLimits, env: workerEnv, execArgv: [],
|
|
117
|
+
stdin: false, stdout: true, stderr: true,
|
|
118
|
+
};
|
|
113
119
|
let worker;
|
|
114
120
|
// A CommonJS-typed TS entry bypasses --import loader hooks for its first file and
|
|
115
121
|
// can fail with "Cannot use import statement outside a module" despite the flag.
|
|
@@ -126,13 +132,16 @@ function createNodeWorkerFactory({ env }, options = {}) {
|
|
|
126
132
|
// directory is created merely to leave cleanup behind.
|
|
127
133
|
delete workerEnv.NODE_V8_COVERAGE;
|
|
128
134
|
const bootstrap = `require(${JSON.stringify(options.typescriptBootstrap.registerModulePath)}).register();\nrequire(${JSON.stringify(workerEntry)});\n`;
|
|
129
|
-
|
|
135
|
+
workerOptions.eval = true;
|
|
130
136
|
worker = options.createWorker ? options.createWorker({ entry: bootstrap, options: workerOptions }, {}) : new node_worker_threads_1.Worker(bootstrap, workerOptions);
|
|
131
137
|
}
|
|
132
138
|
else {
|
|
133
|
-
const workerOptions = { workerData: payload, resourceLimits, env: workerEnv, execArgv: [] };
|
|
134
139
|
worker = options.createWorker ? options.createWorker({ entry: workerEntry, options: workerOptions }, {}) : new node_worker_threads_1.Worker(workerEntry, workerOptions);
|
|
135
140
|
}
|
|
141
|
+
// Explicit output streams avoid Node's automatic forwarding to detached parent
|
|
142
|
+
// streams. Drain them so worker logging cannot block a render or grow a buffer.
|
|
143
|
+
worker.stdout.resume();
|
|
144
|
+
worker.stderr.resume();
|
|
136
145
|
return {
|
|
137
146
|
once(input) {
|
|
138
147
|
if (input.event === "message")
|
package/dist/node-worker.d.ts
CHANGED
|
@@ -105,6 +105,8 @@ export interface NodeWorkerFactoryOptions {
|
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Native Node worker factory. TypeScript bootstrap configuration is explicit and host-owned.
|
|
108
|
+
* Worker stdin is disabled and output is drained without forwarding to parent stdio;
|
|
109
|
+
* results and controlled failures travel over the message/error ports instead.
|
|
108
110
|
* @param required Environment copied to each worker; nothing reads the parent environment.
|
|
109
111
|
* @param options Optional native creation port and TypeScript registration module; its eval entry suppresses V8 coverage.
|
|
110
112
|
* @returns WorkerFactory for caller-owned JS/TS entry paths, with no package-relative lookup.
|
package/dist/node-worker.js
CHANGED
|
@@ -94,6 +94,8 @@ export function renderInWorkerSandbox(required, options = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Native Node worker factory. TypeScript bootstrap configuration is explicit and host-owned.
|
|
97
|
+
* Worker stdin is disabled and output is drained without forwarding to parent stdio;
|
|
98
|
+
* results and controlled failures travel over the message/error ports instead.
|
|
97
99
|
* @param required Environment copied to each worker; nothing reads the parent environment.
|
|
98
100
|
* @param options Optional native creation port and TypeScript registration module; its eval entry suppresses V8 coverage.
|
|
99
101
|
* @returns WorkerFactory for caller-owned JS/TS entry paths, with no package-relative lookup.
|
|
@@ -103,6 +105,10 @@ export function createNodeWorkerFactory({ env }, options = {}) {
|
|
|
103
105
|
return {
|
|
104
106
|
spawn({ workerEntry, payload, resourceLimits }) {
|
|
105
107
|
const workerEnv = { ...env };
|
|
108
|
+
const workerOptions = {
|
|
109
|
+
workerData: payload, resourceLimits, env: workerEnv, execArgv: [],
|
|
110
|
+
stdin: false, stdout: true, stderr: true,
|
|
111
|
+
};
|
|
106
112
|
let worker;
|
|
107
113
|
// A CommonJS-typed TS entry bypasses --import loader hooks for its first file and
|
|
108
114
|
// can fail with "Cannot use import statement outside a module" despite the flag.
|
|
@@ -119,13 +125,16 @@ export function createNodeWorkerFactory({ env }, options = {}) {
|
|
|
119
125
|
// directory is created merely to leave cleanup behind.
|
|
120
126
|
delete workerEnv.NODE_V8_COVERAGE;
|
|
121
127
|
const bootstrap = `require(${JSON.stringify(options.typescriptBootstrap.registerModulePath)}).register();\nrequire(${JSON.stringify(workerEntry)});\n`;
|
|
122
|
-
|
|
128
|
+
workerOptions.eval = true;
|
|
123
129
|
worker = options.createWorker ? options.createWorker({ entry: bootstrap, options: workerOptions }, {}) : new Worker(bootstrap, workerOptions);
|
|
124
130
|
}
|
|
125
131
|
else {
|
|
126
|
-
const workerOptions = { workerData: payload, resourceLimits, env: workerEnv, execArgv: [] };
|
|
127
132
|
worker = options.createWorker ? options.createWorker({ entry: workerEntry, options: workerOptions }, {}) : new Worker(workerEntry, workerOptions);
|
|
128
133
|
}
|
|
134
|
+
// Explicit output streams avoid Node's automatic forwarding to detached parent
|
|
135
|
+
// streams. Drain them so worker logging cannot block a render or grow a buffer.
|
|
136
|
+
worker.stdout.resume();
|
|
137
|
+
worker.stderr.resume();
|
|
129
138
|
return {
|
|
130
139
|
once(input) {
|
|
131
140
|
if (input.event === "message")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/sandbox",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Execution/sandbox sibling to @jini-ai/vibecoding's edit loop: boot an environment, mount files, install deps, run commands, preview, and tear down — behind one interface with a driver-neutral core. Import `./core` with no adapter installed; add `./e2b` for the E2B (Firecracker microVM) backend.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|