Fix PythonMacroWorkerRuntime build type error, update PYTHON_SCRIPTING.md

Co-authored-by: rfc1437 <774975+rfc1437@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-26 21:54:32 +00:00
parent c9b9d30c7d
commit 2aa23f2dd1
2 changed files with 48 additions and 23 deletions

View File

@@ -182,15 +182,17 @@ export class PythonMacroWorkerRuntime {
this.worker = this.workerFactory(workerPath);
this.workerReady = false;
this.worker.on('message', (message: WorkerResponseMessage) => {
this.handleWorkerMessage(message);
this.worker.on('message', (...args: unknown[]) => {
this.handleWorkerMessage(args[0] as WorkerResponseMessage);
});
this.worker.on('error', (error) => {
this.worker.on('error', (...args: unknown[]) => {
const error = args[0];
this.handleWorkerCrash(error instanceof Error ? error : new Error(String(error)));
});
this.worker.on('exit', (code) => {
this.worker.on('exit', (...args: unknown[]) => {
const code = args[0] as number;
if (code !== 0) {
this.handleWorkerCrash(new Error(`Python macro worker exited with code ${code}`));
}