claude-yes 1.44.0 → 1.44.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/cli.js CHANGED
@@ -20729,6 +20729,16 @@ class PidStore {
20729
20729
  updatedAt INTEGER NOT NULL
20730
20730
  )
20731
20731
  `);
20732
+ try {
20733
+ const tableInfo = this.db.query("PRAGMA table_info(pid_records)");
20734
+ const hasCwd = tableInfo.some((col) => col.name === "cwd");
20735
+ if (!hasCwd) {
20736
+ logger.info("[pidStore] Migrating database: adding cwd column");
20737
+ this.db.run("ALTER TABLE pid_records ADD COLUMN cwd TEXT NOT NULL DEFAULT ''");
20738
+ }
20739
+ } catch (error) {
20740
+ logger.warn("[pidStore] Migration check failed:", error);
20741
+ }
20732
20742
  await this.cleanStaleRecords();
20733
20743
  } else {
20734
20744
  logger.warn("[pidStore] Database not ready, running in fallback mode");
@@ -22101,22 +22111,24 @@ ${prompt}` : prefix;
22101
22111
  });
22102
22112
  const pendingExitCode = Promise.withResolvers();
22103
22113
  async function onData(data) {
22114
+ const currentPid = shell.pid;
22104
22115
  await outputWriter.write(data);
22105
- globalAgentRegistry.appendStdout(shell.pid, data);
22116
+ globalAgentRegistry.appendStdout(currentPid, data);
22106
22117
  }
22107
22118
  shell.onData(onData);
22108
22119
  shell.onExit(async function onExit2({ exitCode: exitCode2 }) {
22109
- globalAgentRegistry.unregister(shell.pid);
22120
+ const exitedPid = shell.pid;
22121
+ globalAgentRegistry.unregister(exitedPid);
22110
22122
  ctx.stdinReady.unready();
22111
22123
  const agentCrashed = exitCode2 !== 0;
22112
22124
  if (ctx.shouldRestartWithoutContinue) {
22113
22125
  try {
22114
- await pidStore.updateStatus(shell.pid, "exited", {
22126
+ await pidStore.updateStatus(exitedPid, "exited", {
22115
22127
  exitReason: "restarted",
22116
22128
  exitCode: exitCode2 ?? undefined
22117
22129
  });
22118
22130
  } catch (error) {
22119
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
22131
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
22120
22132
  }
22121
22133
  ctx.shouldRestartWithoutContinue = false;
22122
22134
  ctx.isFatal = false;
@@ -22163,22 +22175,22 @@ ${prompt}` : prefix;
22163
22175
  }
22164
22176
  if (ctx.isFatal) {
22165
22177
  try {
22166
- await pidStore.updateStatus(shell.pid, "exited", {
22178
+ await pidStore.updateStatus(exitedPid, "exited", {
22167
22179
  exitReason: "fatal",
22168
22180
  exitCode: exitCode2 ?? undefined
22169
22181
  });
22170
22182
  } catch (error) {
22171
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
22183
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
22172
22184
  }
22173
22185
  return pendingExitCode.resolve(exitCode2);
22174
22186
  }
22175
22187
  try {
22176
- await pidStore.updateStatus(shell.pid, "exited", {
22188
+ await pidStore.updateStatus(exitedPid, "exited", {
22177
22189
  exitReason: "restarted",
22178
22190
  exitCode: exitCode2 ?? undefined
22179
22191
  });
22180
22192
  } catch (error) {
22181
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
22193
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
22182
22194
  }
22183
22195
  logger.info(`${cli} crashed, restarting...`);
22184
22196
  let restoreArgs = conf.restoreArgs;
@@ -22223,12 +22235,12 @@ ${prompt}` : prefix;
22223
22235
  }
22224
22236
  const exitReason = agentCrashed ? "crash" : "normal";
22225
22237
  try {
22226
- await pidStore.updateStatus(shell.pid, "exited", {
22238
+ await pidStore.updateStatus(exitedPid, "exited", {
22227
22239
  exitReason,
22228
22240
  exitCode: exitCode2 ?? undefined
22229
22241
  });
22230
22242
  } catch (error) {
22231
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
22243
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
22232
22244
  }
22233
22245
  return pendingExitCode.resolve(exitCode2);
22234
22246
  });
@@ -22306,16 +22318,27 @@ ${prompt}` : prefix;
22306
22318
  const stdinStream = new ReadableStream({
22307
22319
  start(controller) {
22308
22320
  process.stdin.resume();
22321
+ let closed = false;
22309
22322
  const dataHandler = (chunk) => {
22310
22323
  try {
22311
22324
  controller.enqueue(chunk);
22312
22325
  } catch (err) {}
22313
22326
  };
22314
22327
  const endHandler = () => {
22315
- controller.close();
22328
+ if (closed)
22329
+ return;
22330
+ closed = true;
22331
+ try {
22332
+ controller.close();
22333
+ } catch (err) {}
22316
22334
  };
22317
22335
  const errorHandler = (err) => {
22318
- controller.error(err);
22336
+ if (closed)
22337
+ return;
22338
+ closed = true;
22339
+ try {
22340
+ controller.error(err);
22341
+ } catch (err2) {}
22319
22342
  };
22320
22343
  process.stdin.on("data", dataHandler);
22321
22344
  process.stdin.on("end", endHandler);
@@ -22720,22 +22743,24 @@ ${prompt}` : prefix;
22720
22743
  });
22721
22744
  const pendingExitCode = Promise.withResolvers();
22722
22745
  async function onData(data) {
22746
+ const currentPid = shell.pid;
22723
22747
  await outputWriter.write(data);
22724
- globalAgentRegistry.appendStdout(shell.pid, data);
22748
+ globalAgentRegistry.appendStdout(currentPid, data);
22725
22749
  }
22726
22750
  shell.onData(onData);
22727
22751
  shell.onExit(async function onExit2({ exitCode: exitCode2 }) {
22728
- globalAgentRegistry.unregister(shell.pid);
22752
+ const exitedPid = shell.pid;
22753
+ globalAgentRegistry.unregister(exitedPid);
22729
22754
  ctx.stdinReady.unready();
22730
22755
  const agentCrashed = exitCode2 !== 0;
22731
22756
  if (ctx.shouldRestartWithoutContinue) {
22732
22757
  try {
22733
- await pidStore.updateStatus(shell.pid, "exited", {
22758
+ await pidStore.updateStatus(exitedPid, "exited", {
22734
22759
  exitReason: "restarted",
22735
22760
  exitCode: exitCode2 ?? undefined
22736
22761
  });
22737
22762
  } catch (error) {
22738
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
22763
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
22739
22764
  }
22740
22765
  ctx.shouldRestartWithoutContinue = false;
22741
22766
  ctx.isFatal = false;
@@ -22782,22 +22807,22 @@ ${prompt}` : prefix;
22782
22807
  }
22783
22808
  if (ctx.isFatal) {
22784
22809
  try {
22785
- await pidStore.updateStatus(shell.pid, "exited", {
22810
+ await pidStore.updateStatus(exitedPid, "exited", {
22786
22811
  exitReason: "fatal",
22787
22812
  exitCode: exitCode2 ?? undefined
22788
22813
  });
22789
22814
  } catch (error) {
22790
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
22815
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
22791
22816
  }
22792
22817
  return pendingExitCode.resolve(exitCode2);
22793
22818
  }
22794
22819
  try {
22795
- await pidStore.updateStatus(shell.pid, "exited", {
22820
+ await pidStore.updateStatus(exitedPid, "exited", {
22796
22821
  exitReason: "restarted",
22797
22822
  exitCode: exitCode2 ?? undefined
22798
22823
  });
22799
22824
  } catch (error) {
22800
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
22825
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
22801
22826
  }
22802
22827
  logger.info(`${cli} crashed, restarting...`);
22803
22828
  let restoreArgs = conf.restoreArgs;
@@ -22842,12 +22867,12 @@ ${prompt}` : prefix;
22842
22867
  }
22843
22868
  const exitReason = agentCrashed ? "crash" : "normal";
22844
22869
  try {
22845
- await pidStore.updateStatus(shell.pid, "exited", {
22870
+ await pidStore.updateStatus(exitedPid, "exited", {
22846
22871
  exitReason,
22847
22872
  exitCode: exitCode2 ?? undefined
22848
22873
  });
22849
22874
  } catch (error) {
22850
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
22875
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
22851
22876
  }
22852
22877
  return pendingExitCode.resolve(exitCode2);
22853
22878
  });
@@ -22925,16 +22950,27 @@ ${prompt}` : prefix;
22925
22950
  const stdinStream = new ReadableStream({
22926
22951
  start(controller) {
22927
22952
  process.stdin.resume();
22953
+ let closed = false;
22928
22954
  const dataHandler = (chunk) => {
22929
22955
  try {
22930
22956
  controller.enqueue(chunk);
22931
22957
  } catch (err) {}
22932
22958
  };
22933
22959
  const endHandler = () => {
22934
- controller.close();
22960
+ if (closed)
22961
+ return;
22962
+ closed = true;
22963
+ try {
22964
+ controller.close();
22965
+ } catch (err) {}
22935
22966
  };
22936
22967
  const errorHandler = (err) => {
22937
- controller.error(err);
22968
+ if (closed)
22969
+ return;
22970
+ closed = true;
22971
+ try {
22972
+ controller.error(err);
22973
+ } catch (err2) {}
22938
22974
  };
22939
22975
  process.stdin.on("data", dataHandler);
22940
22976
  process.stdin.on("end", endHandler);
@@ -28701,6 +28737,16 @@ class PidStore2 {
28701
28737
  updatedAt INTEGER NOT NULL
28702
28738
  )
28703
28739
  `);
28740
+ try {
28741
+ const tableInfo = this.db.query("PRAGMA table_info(pid_records)");
28742
+ const hasCwd = tableInfo.some((col) => col.name === "cwd");
28743
+ if (!hasCwd) {
28744
+ logger.info("[pidStore] Migrating database: adding cwd column");
28745
+ this.db.run("ALTER TABLE pid_records ADD COLUMN cwd TEXT NOT NULL DEFAULT ''");
28746
+ }
28747
+ } catch (error) {
28748
+ logger.warn("[pidStore] Migration check failed:", error);
28749
+ }
28704
28750
  await this.cleanStaleRecords();
28705
28751
  } else {
28706
28752
  logger.warn("[pidStore] Database not ready, running in fallback mode");
@@ -28898,5 +28944,5 @@ var { exitCode } = await cliYes(config3);
28898
28944
  console.log("exiting process");
28899
28945
  process.exit(exitCode ?? 1);
28900
28946
 
28901
- //# debugId=138DDE1799AB280064756E2164756E21
28947
+ //# debugId=38DB360761C1F8AB64756E2164756E21
28902
28948
  //# sourceMappingURL=cli.js.map
package/dist/index.js CHANGED
@@ -20727,6 +20727,16 @@ class PidStore {
20727
20727
  updatedAt INTEGER NOT NULL
20728
20728
  )
20729
20729
  `);
20730
+ try {
20731
+ const tableInfo = this.db.query("PRAGMA table_info(pid_records)");
20732
+ const hasCwd = tableInfo.some((col) => col.name === "cwd");
20733
+ if (!hasCwd) {
20734
+ logger.info("[pidStore] Migrating database: adding cwd column");
20735
+ this.db.run("ALTER TABLE pid_records ADD COLUMN cwd TEXT NOT NULL DEFAULT ''");
20736
+ }
20737
+ } catch (error) {
20738
+ logger.warn("[pidStore] Migration check failed:", error);
20739
+ }
20730
20740
  await this.cleanStaleRecords();
20731
20741
  } else {
20732
20742
  logger.warn("[pidStore] Database not ready, running in fallback mode");
@@ -21713,22 +21723,24 @@ ${prompt}` : prefix;
21713
21723
  });
21714
21724
  const pendingExitCode = Promise.withResolvers();
21715
21725
  async function onData(data) {
21726
+ const currentPid = shell.pid;
21716
21727
  await outputWriter.write(data);
21717
- globalAgentRegistry.appendStdout(shell.pid, data);
21728
+ globalAgentRegistry.appendStdout(currentPid, data);
21718
21729
  }
21719
21730
  shell.onData(onData);
21720
21731
  shell.onExit(async function onExit2({ exitCode: exitCode2 }) {
21721
- globalAgentRegistry.unregister(shell.pid);
21732
+ const exitedPid = shell.pid;
21733
+ globalAgentRegistry.unregister(exitedPid);
21722
21734
  ctx.stdinReady.unready();
21723
21735
  const agentCrashed = exitCode2 !== 0;
21724
21736
  if (ctx.shouldRestartWithoutContinue) {
21725
21737
  try {
21726
- await pidStore.updateStatus(shell.pid, "exited", {
21738
+ await pidStore.updateStatus(exitedPid, "exited", {
21727
21739
  exitReason: "restarted",
21728
21740
  exitCode: exitCode2 ?? undefined
21729
21741
  });
21730
21742
  } catch (error) {
21731
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
21743
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
21732
21744
  }
21733
21745
  ctx.shouldRestartWithoutContinue = false;
21734
21746
  ctx.isFatal = false;
@@ -21775,22 +21787,22 @@ ${prompt}` : prefix;
21775
21787
  }
21776
21788
  if (ctx.isFatal) {
21777
21789
  try {
21778
- await pidStore.updateStatus(shell.pid, "exited", {
21790
+ await pidStore.updateStatus(exitedPid, "exited", {
21779
21791
  exitReason: "fatal",
21780
21792
  exitCode: exitCode2 ?? undefined
21781
21793
  });
21782
21794
  } catch (error) {
21783
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
21795
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
21784
21796
  }
21785
21797
  return pendingExitCode.resolve(exitCode2);
21786
21798
  }
21787
21799
  try {
21788
- await pidStore.updateStatus(shell.pid, "exited", {
21800
+ await pidStore.updateStatus(exitedPid, "exited", {
21789
21801
  exitReason: "restarted",
21790
21802
  exitCode: exitCode2 ?? undefined
21791
21803
  });
21792
21804
  } catch (error) {
21793
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
21805
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
21794
21806
  }
21795
21807
  logger.info(`${cli} crashed, restarting...`);
21796
21808
  let restoreArgs = conf.restoreArgs;
@@ -21835,12 +21847,12 @@ ${prompt}` : prefix;
21835
21847
  }
21836
21848
  const exitReason = agentCrashed ? "crash" : "normal";
21837
21849
  try {
21838
- await pidStore.updateStatus(shell.pid, "exited", {
21850
+ await pidStore.updateStatus(exitedPid, "exited", {
21839
21851
  exitReason,
21840
21852
  exitCode: exitCode2 ?? undefined
21841
21853
  });
21842
21854
  } catch (error) {
21843
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
21855
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
21844
21856
  }
21845
21857
  return pendingExitCode.resolve(exitCode2);
21846
21858
  });
@@ -21918,16 +21930,27 @@ ${prompt}` : prefix;
21918
21930
  const stdinStream = new ReadableStream({
21919
21931
  start(controller) {
21920
21932
  process.stdin.resume();
21933
+ let closed = false;
21921
21934
  const dataHandler = (chunk) => {
21922
21935
  try {
21923
21936
  controller.enqueue(chunk);
21924
21937
  } catch (err) {}
21925
21938
  };
21926
21939
  const endHandler = () => {
21927
- controller.close();
21940
+ if (closed)
21941
+ return;
21942
+ closed = true;
21943
+ try {
21944
+ controller.close();
21945
+ } catch (err) {}
21928
21946
  };
21929
21947
  const errorHandler = (err) => {
21930
- controller.error(err);
21948
+ if (closed)
21949
+ return;
21950
+ closed = true;
21951
+ try {
21952
+ controller.error(err);
21953
+ } catch (err2) {}
21931
21954
  };
21932
21955
  process.stdin.on("data", dataHandler);
21933
21956
  process.stdin.on("end", endHandler);
@@ -22080,5 +22103,5 @@ export {
22080
22103
  AgentContext
22081
22104
  };
22082
22105
 
22083
- //# debugId=BCFFC531D8AFC75764756E2164756E21
22106
+ //# debugId=7D2DEB4034BE0DEE64756E2164756E21
22084
22107
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-yes",
3
- "version": "1.44.0",
3
+ "version": "1.44.2",
4
4
  "description": "A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses.",
5
5
  "keywords": [
6
6
  "ai",
package/ts/index.ts CHANGED
@@ -379,16 +379,18 @@ export default async function agentYes({
379
379
  const pendingExitCode = Promise.withResolvers<number | null>();
380
380
 
381
381
  async function onData(data: string) {
382
+ const currentPid = shell.pid; // Capture PID before any potential shell reassignment
382
383
  // append data to the buffer, so we can process it later
383
384
  await outputWriter.write(data);
384
385
  // append to agent registry for MCP server
385
- globalAgentRegistry.appendStdout(shell.pid, data);
386
+ globalAgentRegistry.appendStdout(currentPid, data);
386
387
  }
387
388
 
388
389
  shell.onData(onData);
389
390
  shell.onExit(async function onExit({ exitCode }) {
391
+ const exitedPid = shell.pid; // Capture PID immediately before any shell reassignment
390
392
  // Unregister from agent registry
391
- globalAgentRegistry.unregister(shell.pid);
393
+ globalAgentRegistry.unregister(exitedPid);
392
394
  ctx.stdinReady.unready(); // start buffer stdin
393
395
  const agentCrashed = exitCode !== 0;
394
396
 
@@ -397,12 +399,12 @@ export default async function agentYes({
397
399
  if (ctx.shouldRestartWithoutContinue) {
398
400
  // Update status (non-blocking)
399
401
  try {
400
- await pidStore.updateStatus(shell.pid, "exited", {
402
+ await pidStore.updateStatus(exitedPid, "exited", {
401
403
  exitReason: "restarted",
402
404
  exitCode: exitCode ?? undefined,
403
405
  });
404
406
  } catch (error) {
405
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
407
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
406
408
  }
407
409
  ctx.shouldRestartWithoutContinue = false; // reset flag
408
410
  ctx.isFatal = false; // reset fatal flag to allow restart
@@ -462,24 +464,24 @@ export default async function agentYes({
462
464
  if (ctx.isFatal) {
463
465
  // Update status (non-blocking)
464
466
  try {
465
- await pidStore.updateStatus(shell.pid, "exited", {
467
+ await pidStore.updateStatus(exitedPid, "exited", {
466
468
  exitReason: "fatal",
467
469
  exitCode: exitCode ?? undefined,
468
470
  });
469
471
  } catch (error) {
470
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
472
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
471
473
  }
472
474
  return pendingExitCode.resolve(exitCode);
473
475
  }
474
476
 
475
477
  // Update status (non-blocking)
476
478
  try {
477
- await pidStore.updateStatus(shell.pid, "exited", {
479
+ await pidStore.updateStatus(exitedPid, "exited", {
478
480
  exitReason: "restarted",
479
481
  exitCode: exitCode ?? undefined,
480
482
  });
481
483
  } catch (error) {
482
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
484
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
483
485
  }
484
486
  logger.info(`${cli} crashed, restarting...`);
485
487
 
@@ -532,12 +534,12 @@ export default async function agentYes({
532
534
  const exitReason = agentCrashed ? "crash" : "normal";
533
535
  // Update status (non-blocking)
534
536
  try {
535
- await pidStore.updateStatus(shell.pid, "exited", {
537
+ await pidStore.updateStatus(exitedPid, "exited", {
536
538
  exitReason,
537
539
  exitCode: exitCode ?? undefined,
538
540
  });
539
541
  } catch (error) {
540
- logger.warn(`[pidStore] Failed to update status for PID ${shell.pid}:`, error);
542
+ logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
541
543
  }
542
544
  return pendingExitCode.resolve(exitCode);
543
545
  });
@@ -657,6 +659,8 @@ export default async function agentYes({
657
659
  // Set up stdin in flowing mode so 'data' events fire
658
660
  process.stdin.resume();
659
661
 
662
+ let closed = false;
663
+
660
664
  // Handle data events
661
665
  const dataHandler = (chunk: Buffer) => {
662
666
  try {
@@ -666,13 +670,25 @@ export default async function agentYes({
666
670
  }
667
671
  };
668
672
 
669
- // Handle end/close
673
+ // Handle end/close - both events can fire, so track state
670
674
  const endHandler = () => {
671
- controller.close();
675
+ if (closed) return;
676
+ closed = true;
677
+ try {
678
+ controller.close();
679
+ } catch (err) {
680
+ // Ignore close errors (already closed)
681
+ }
672
682
  };
673
683
 
674
684
  const errorHandler = (err: Error) => {
675
- controller.error(err);
685
+ if (closed) return;
686
+ closed = true;
687
+ try {
688
+ controller.error(err);
689
+ } catch (err) {
690
+ // Ignore error after close
691
+ }
676
692
  };
677
693
 
678
694
  process.stdin.on('data', dataHandler);
package/ts/pidStore.ts CHANGED
@@ -63,6 +63,18 @@ export class PidStore {
63
63
  )
64
64
  `);
65
65
 
66
+ // Migrate: Add cwd column if it doesn't exist
67
+ try {
68
+ const tableInfo = this.db.query("PRAGMA table_info(pid_records)");
69
+ const hasCwd = tableInfo.some((col: any) => col.name === 'cwd');
70
+ if (!hasCwd) {
71
+ logger.info("[pidStore] Migrating database: adding cwd column");
72
+ this.db.run("ALTER TABLE pid_records ADD COLUMN cwd TEXT NOT NULL DEFAULT ''");
73
+ }
74
+ } catch (error) {
75
+ logger.warn("[pidStore] Migration check failed:", error);
76
+ }
77
+
66
78
  await this.cleanStaleRecords();
67
79
  } else {
68
80
  logger.warn("[pidStore] Database not ready, running in fallback mode");