fix: stabilize lobster tool subprocess
This commit is contained in:
10
extensions/lobster/clawdbot.plugin.json
Normal file
10
extensions/lobster/clawdbot.plugin.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "lobster",
|
||||||
|
"name": "Lobster",
|
||||||
|
"description": "Typed workflow tool with resumable approvals.",
|
||||||
|
"configSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,14 +40,17 @@ async function runLobsterSubprocess(params: {
|
|||||||
const timeoutMs = Math.max(200, params.timeoutMs);
|
const timeoutMs = Math.max(200, params.timeoutMs);
|
||||||
const maxStdoutBytes = Math.max(1024, params.maxStdoutBytes);
|
const maxStdoutBytes = Math.max(1024, params.maxStdoutBytes);
|
||||||
|
|
||||||
|
const env = { ...process.env, LOBSTER_MODE: "tool" } as Record<string, string | undefined>;
|
||||||
|
const nodeOptions = env.NODE_OPTIONS ?? "";
|
||||||
|
if (nodeOptions.includes("--inspect")) {
|
||||||
|
delete env.NODE_OPTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
return await new Promise<{ stdout: string }>((resolve, reject) => {
|
return await new Promise<{ stdout: string }>((resolve, reject) => {
|
||||||
const child = spawn(execPath, argv, {
|
const child = spawn(execPath, argv, {
|
||||||
cwd,
|
cwd,
|
||||||
stdio: ["ignore", "pipe", "pipe"],
|
stdio: ["ignore", "pipe", "pipe"],
|
||||||
env: {
|
env,
|
||||||
...process.env,
|
|
||||||
LOBSTER_MODE: "tool",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let stdout = "";
|
let stdout = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user