@snack-kit/porygon 0.5.0 → 0.7.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 +26 -0
- package/dist/index.cjs +22 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -236,13 +236,14 @@ var InterceptorManager = class {
|
|
|
236
236
|
};
|
|
237
237
|
|
|
238
238
|
// src/process/process-handle.ts
|
|
239
|
-
import
|
|
239
|
+
import spawn from "cross-spawn";
|
|
240
240
|
import { EventEmitter } from "events";
|
|
241
241
|
import { createInterface } from "readline";
|
|
242
242
|
var GRACE_PERIOD_MS = 5e3;
|
|
243
243
|
var EphemeralProcess = class {
|
|
244
244
|
childProcess = null;
|
|
245
245
|
aborted = false;
|
|
246
|
+
timedOut = false;
|
|
246
247
|
/**
|
|
247
248
|
* 执行命令并收集输出。支持 AbortController 进行取消操作。
|
|
248
249
|
* @param options 进程启动选项
|
|
@@ -311,6 +312,7 @@ var EphemeralProcess = class {
|
|
|
311
312
|
throw new Error("Process aborted before start");
|
|
312
313
|
}
|
|
313
314
|
this.aborted = false;
|
|
315
|
+
this.timedOut = false;
|
|
314
316
|
const useStdin = options.stdinData !== void 0;
|
|
315
317
|
const child = spawn(options.command, options.args, {
|
|
316
318
|
cwd: options.cwd,
|
|
@@ -326,6 +328,7 @@ var EphemeralProcess = class {
|
|
|
326
328
|
let timeoutTimer;
|
|
327
329
|
if (options.timeoutMs !== void 0 && options.timeoutMs > 0) {
|
|
328
330
|
timeoutTimer = setTimeout(() => {
|
|
331
|
+
this.timedOut = true;
|
|
329
332
|
this.terminate();
|
|
330
333
|
}, options.timeoutMs);
|
|
331
334
|
}
|
|
@@ -358,6 +361,9 @@ var EphemeralProcess = class {
|
|
|
358
361
|
stderr || `Process exited with code ${exitCode}`
|
|
359
362
|
);
|
|
360
363
|
}
|
|
364
|
+
if (this.timedOut) {
|
|
365
|
+
throw new Error(`Process timed out after ${options.timeoutMs}ms`);
|
|
366
|
+
}
|
|
361
367
|
} finally {
|
|
362
368
|
if (timeoutTimer) clearTimeout(timeoutTimer);
|
|
363
369
|
abortSignal?.removeEventListener("abort", onAbort);
|
|
@@ -897,8 +903,9 @@ var ClaudeAdapter = class extends AbstractAgentAdapter {
|
|
|
897
903
|
async isAvailable() {
|
|
898
904
|
try {
|
|
899
905
|
const proc = new EphemeralProcess();
|
|
906
|
+
const findCmd = process.platform === "win32" ? "where" : "which";
|
|
900
907
|
const result = await proc.execute({
|
|
901
|
-
command:
|
|
908
|
+
command: findCmd,
|
|
902
909
|
args: [this.cliCommand]
|
|
903
910
|
});
|
|
904
911
|
return result.exitCode === 0;
|