@polos/sdk 0.2.1 → 0.2.2

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/dist/index.d.cts CHANGED
@@ -4795,7 +4795,7 @@ declare function createExecTool(getEnv: () => Promise<ExecutionEnvironment>, con
4795
4795
  */
4796
4796
 
4797
4797
  /**
4798
- * Configuration for path-restricted approval on read-only tools.
4798
+ * Configuration for path-restricted approval on sandbox tools.
4799
4799
  */
4800
4800
  interface PathRestrictionConfig {
4801
4801
  /** Directory to allow without approval. Paths outside require approval. */
package/dist/index.d.ts CHANGED
@@ -4795,7 +4795,7 @@ declare function createExecTool(getEnv: () => Promise<ExecutionEnvironment>, con
4795
4795
  */
4796
4796
 
4797
4797
  /**
4798
- * Configuration for path-restricted approval on read-only tools.
4798
+ * Configuration for path-restricted approval on sandbox tools.
4799
4799
  */
4800
4800
  interface PathRestrictionConfig {
4801
4801
  /** Directory to allow without approval. Paths outside require approval. */
package/dist/index.js CHANGED
@@ -5322,7 +5322,27 @@ function spawnCommand(command, args, options) {
5322
5322
  killed = true;
5323
5323
  proc.kill("SIGKILL");
5324
5324
  }, timeoutMs);
5325
+ let exitGraceTimer = null;
5326
+ let exitCode = null;
5327
+ proc.on("exit", (code) => {
5328
+ exitCode = code;
5329
+ exitGraceTimer = setTimeout(() => {
5330
+ clearTimeout(timer);
5331
+ settle(() => {
5332
+ if (killed) {
5333
+ resolve10({
5334
+ exitCode: 137,
5335
+ stdout,
5336
+ stderr: stderr + "\n[Process killed: timeout exceeded]"
5337
+ });
5338
+ } else {
5339
+ resolve10({ exitCode: exitCode ?? 1, stdout, stderr });
5340
+ }
5341
+ });
5342
+ }, 2e3);
5343
+ });
5325
5344
  proc.on("close", (code) => {
5345
+ if (exitGraceTimer) clearTimeout(exitGraceTimer);
5326
5346
  clearTimeout(timer);
5327
5347
  settle(() => {
5328
5348
  if (killed) {
@@ -5332,11 +5352,12 @@ function spawnCommand(command, args, options) {
5332
5352
  stderr: stderr + "\n[Process killed: timeout exceeded]"
5333
5353
  });
5334
5354
  } else {
5335
- resolve10({ exitCode: code ?? 1, stdout, stderr });
5355
+ resolve10({ exitCode: code ?? exitCode ?? 1, stdout, stderr });
5336
5356
  }
5337
5357
  });
5338
5358
  });
5339
5359
  proc.on("error", (err) => {
5360
+ if (exitGraceTimer) clearTimeout(exitGraceTimer);
5340
5361
  clearTimeout(timer);
5341
5362
  settle(() => {
5342
5363
  reject(err);
@@ -5582,7 +5603,27 @@ function spawnLocal(command, options) {
5582
5603
  killed = true;
5583
5604
  proc.kill("SIGKILL");
5584
5605
  }, timeoutMs);
5606
+ let exitGraceTimer = null;
5607
+ let exitCode = null;
5608
+ proc.on("exit", (code) => {
5609
+ exitCode = code;
5610
+ exitGraceTimer = setTimeout(() => {
5611
+ clearTimeout(timer);
5612
+ settle(() => {
5613
+ if (killed) {
5614
+ resolve10({
5615
+ exitCode: 137,
5616
+ stdout,
5617
+ stderr: stderr + "\n[Process killed: timeout exceeded]"
5618
+ });
5619
+ } else {
5620
+ resolve10({ exitCode: exitCode ?? 1, stdout, stderr });
5621
+ }
5622
+ });
5623
+ }, 2e3);
5624
+ });
5585
5625
  proc.on("close", (code) => {
5626
+ if (exitGraceTimer) clearTimeout(exitGraceTimer);
5586
5627
  clearTimeout(timer);
5587
5628
  settle(() => {
5588
5629
  if (killed) {
@@ -5592,11 +5633,12 @@ function spawnLocal(command, options) {
5592
5633
  stderr: stderr + "\n[Process killed: timeout exceeded]"
5593
5634
  });
5594
5635
  } else {
5595
- resolve10({ exitCode: code ?? 1, stdout, stderr });
5636
+ resolve10({ exitCode: code ?? exitCode ?? 1, stdout, stderr });
5596
5637
  }
5597
5638
  });
5598
5639
  });
5599
5640
  proc.on("error", (err) => {
5641
+ if (exitGraceTimer) clearTimeout(exitGraceTimer);
5600
5642
  clearTimeout(timer);
5601
5643
  settle(() => {
5602
5644
  reject(err);