@snack-kit/porygon 0.6.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 CHANGED
@@ -630,6 +630,19 @@ npm run playground # 启动 Playground
630
630
 
631
631
  ## Changelog
632
632
 
633
+ ### v0.7.0
634
+
635
+ #### 新特性
636
+
637
+ - **`InteractiveSession` 多轮对话封装** — 新增 `InteractiveSession` 类,封装 per-turn spawn + `--resume` 模式,提供透明的多轮对话体验。通过 `porygon.session()` 创建,调用 `session.send(prompt)` 自动管理 sessionId 续接
638
+ - **`EphemeralProcess` 超时错误明确化** — 进程超时终止后抛出明确的 `Process timed out after ${timeoutMs}ms` 错误,替代之前模糊的退出码错误信息
639
+
640
+ #### 改进
641
+
642
+ - `EphemeralProcess` 内部新增 `timedOut` 状态标记,区分正常退出与超时终止场景
643
+
644
+ ---
645
+
633
646
  ### v0.6.0
634
647
 
635
648
  #### 改进
package/dist/index.cjs CHANGED
@@ -295,6 +295,7 @@ var GRACE_PERIOD_MS = 5e3;
295
295
  var EphemeralProcess = class {
296
296
  childProcess = null;
297
297
  aborted = false;
298
+ timedOut = false;
298
299
  /**
299
300
  * 执行命令并收集输出。支持 AbortController 进行取消操作。
300
301
  * @param options 进程启动选项
@@ -363,6 +364,7 @@ var EphemeralProcess = class {
363
364
  throw new Error("Process aborted before start");
364
365
  }
365
366
  this.aborted = false;
367
+ this.timedOut = false;
366
368
  const useStdin = options.stdinData !== void 0;
367
369
  const child = (0, import_cross_spawn.default)(options.command, options.args, {
368
370
  cwd: options.cwd,
@@ -378,6 +380,7 @@ var EphemeralProcess = class {
378
380
  let timeoutTimer;
379
381
  if (options.timeoutMs !== void 0 && options.timeoutMs > 0) {
380
382
  timeoutTimer = setTimeout(() => {
383
+ this.timedOut = true;
381
384
  this.terminate();
382
385
  }, options.timeoutMs);
383
386
  }
@@ -410,6 +413,9 @@ var EphemeralProcess = class {
410
413
  stderr || `Process exited with code ${exitCode}`
411
414
  );
412
415
  }
416
+ if (this.timedOut) {
417
+ throw new Error(`Process timed out after ${options.timeoutMs}ms`);
418
+ }
413
419
  } finally {
414
420
  if (timeoutTimer) clearTimeout(timeoutTimer);
415
421
  abortSignal?.removeEventListener("abort", onAbort);