Skip to content

Commit 973132d

Browse files
Copilotna-trium-144
andcommitted
Fix WorkerAPI interface implementation - align init signatures
- Update jsEval.worker.ts to accept optional interruptBuffer parameter - Update ruby.worker.ts to accept optional interruptBuffer parameter - Update pyodide.worker.ts to handle optional interruptBuffer safely - All workers now properly implement the WorkerAPI interface Co-authored-by: na-trium-144 <100704180+na-trium-144@users.noreply.github.com>
1 parent 010bce0 commit 973132d

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

app/terminal/worker/jsEval.worker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ self.console = {
3030
},
3131
};
3232

33-
async function init(): Promise<{ capabilities: WorkerCapabilities }> {
33+
async function init(
34+
_interruptBuffer?: Uint8Array
35+
): Promise<{ capabilities: WorkerCapabilities }> {
3436
// Initialize the worker and report capabilities
37+
// interruptBuffer is not used for JavaScript (restart-based interruption)
3538
return { capabilities: { interrupt: "restart" } };
3639
}
3740

app/terminal/worker/pyodide.worker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function readAllFiles(): Record<string, string> {
3838
}
3939

4040
async function init(
41-
interruptBuffer: Uint8Array
41+
interruptBuffer?: Uint8Array
4242
): Promise<{ capabilities: WorkerCapabilities }> {
4343
if (!pyodide) {
4444
self.importScripts(`${PYODIDE_CDN}pyodide.js`);
@@ -57,7 +57,9 @@ async function init(
5757
},
5858
});
5959

60-
pyodide.setInterruptBuffer(interruptBuffer);
60+
if (interruptBuffer) {
61+
pyodide.setInterruptBuffer(interruptBuffer);
62+
}
6163
}
6264
return { capabilities: { interrupt: "buffer" } };
6365
}

app/terminal/worker/ruby.worker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ self.stderr = {
2929
},
3030
};
3131

32-
async function init(): Promise<{ capabilities: WorkerCapabilities }> {
32+
async function init(
33+
_interruptBuffer?: Uint8Array
34+
): Promise<{ capabilities: WorkerCapabilities }> {
35+
// interruptBuffer is not used for Ruby (restart-based interruption)
3336
if (!rubyVM) {
3437
try {
3538
// Fetch and compile the Ruby WASM module

0 commit comments

Comments
 (0)