claude-yes 1.72.2 → 1.72.3

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.
@@ -815,7 +815,7 @@ function tryCatch(catchFn, fn) {
815
815
  //#endregion
816
816
  //#region package.json
817
817
  var name = "agent-yes";
818
- var version = "1.72.2";
818
+ var version = "1.72.3";
819
819
 
820
820
  //#endregion
821
821
  //#region ts/pty-fix.ts
@@ -1895,4 +1895,4 @@ const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
1895
1895
 
1896
1896
  //#endregion
1897
1897
  export { AgentContext as a, PidStore as c, config as i, removeControlCharacters as l, CLIS_CONFIG as n, name as o, agentYes as r, version as s, SUPPORTED_CLIS as t };
1898
- //# sourceMappingURL=SUPPORTED_CLIS-D9eEHdvo.js.map
1898
+ //# sourceMappingURL=SUPPORTED_CLIS-C-KnmE0Y.js.map
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- import { c as PidStore, o as name, s as version, t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-D9eEHdvo.js";
2
+ import { c as PidStore, o as name, s as version, t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C-KnmE0Y.js";
3
3
  import { t as logger } from "./logger-CX77vJDA.js";
4
4
  import { argv } from "process";
5
5
  import { spawn } from "child_process";
@@ -481,12 +481,12 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
481
481
  const updateCheckPromise = checkAndAutoUpdate();
482
482
  const config = parseCliArgs(process.argv);
483
483
  if (config.tray) {
484
- const { startTray } = await import("./tray-CPpdxTV-.js");
484
+ const { startTray } = await import("./tray-BQkynk6r.js");
485
485
  await startTray();
486
486
  await new Promise(() => {});
487
487
  }
488
488
  {
489
- const { ensureTray } = await import("./tray-CPpdxTV-.js");
489
+ const { ensureTray } = await import("./tray-BQkynk6r.js");
490
490
  ensureTray();
491
491
  }
492
492
  if (config.useRust) {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as AgentContext, i as config, l as removeControlCharacters, n as CLIS_CONFIG, r as agentYes } from "./SUPPORTED_CLIS-D9eEHdvo.js";
1
+ import { a as AgentContext, i as config, l as removeControlCharacters, n as CLIS_CONFIG, r as agentYes } from "./SUPPORTED_CLIS-C-KnmE0Y.js";
2
2
  import "./logger-CX77vJDA.js";
3
3
 
4
4
  export { AgentContext, CLIS_CONFIG, config, agentYes as default, removeControlCharacters };
@@ -6,6 +6,7 @@ import { existsSync } from "fs";
6
6
 
7
7
  //#region ts/tray.ts
8
8
  const POLL_INTERVAL = 2e3;
9
+ const IDLE_EXIT_POLLS = 15;
9
10
  const getTrayDir = () => path.join(process.env.CLAUDE_YES_HOME || homedir(), ".claude-yes");
10
11
  const getTrayPidFile = () => path.join(getTrayDir(), "tray.pid");
11
12
  const ICON_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAjklEQVQ4T2NkoBAwUqifgWoGMDIyNjAyMv5nYGBYQMgVjMgCQM0LGBkZHYDYAY8BDUBxByB2wGcAyAUOQOwAxPYMDAyOeCzAbwBIMyMjowNQsz0ely8ACjng8wJeA0CaGRgY7IHYAZ8hQHEHfF7AawBYMwODPZABRHsBpwEgzUDN9kDsgM8lQHEHfC4gJhwAAM3hMBGq3cNNAAAAAElFTkSuQmCC";
@@ -152,9 +153,17 @@ async function startTray() {
152
153
  if (action.item.title === "Quit Tray") cleanup();
153
154
  });
154
155
  let lastCount = count;
156
+ let idlePolls = count === 0 ? 1 : 0;
155
157
  intervalId = setInterval(async () => {
156
158
  try {
157
159
  const { count: newCount, tasks: newTasks } = await getRunningAgentCount();
160
+ if (newCount === 0) {
161
+ idlePolls++;
162
+ if (idlePolls >= IDLE_EXIT_POLLS) {
163
+ cleanup();
164
+ return;
165
+ }
166
+ } else idlePolls = 0;
158
167
  if (newCount !== lastCount) {
159
168
  lastCount = newCount;
160
169
  systray.sendAction({
@@ -175,4 +184,4 @@ async function startTray() {
175
184
 
176
185
  //#endregion
177
186
  export { ensureTray, startTray };
178
- //# sourceMappingURL=tray-CPpdxTV-.js.map
187
+ //# sourceMappingURL=tray-BQkynk6r.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-yes",
3
- "version": "1.72.2",
3
+ "version": "1.72.3",
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",
@@ -2,21 +2,30 @@ import { describe, expect, it, beforeEach, afterEach } from "vitest";
2
2
  import { JsonlStore } from "./JsonlStore";
3
3
  import { rm, readFile, writeFile, mkdir } from "fs/promises";
4
4
  import path from "path";
5
+ import os from "os";
5
6
 
6
- const TEST_DIR = "/tmp/jsonlstore-test-" + process.pid;
7
+ const TEST_DIR = path.join(os.tmpdir(), "jsonlstore-test-" + process.pid);
7
8
  const TEST_FILE = path.join(TEST_DIR, "test.jsonl");
8
9
 
9
10
  describe("JsonlStore", () => {
10
11
  let store: JsonlStore;
11
12
 
12
13
  beforeEach(async () => {
13
- await rm(TEST_DIR, { recursive: true, force: true });
14
+ try {
15
+ await rm(TEST_DIR, { recursive: true, force: true });
16
+ } catch {
17
+ // ignore cleanup failures (e.g. Windows lock files from previous test)
18
+ }
14
19
  await mkdir(TEST_DIR, { recursive: true });
15
20
  store = new JsonlStore(TEST_FILE);
16
21
  });
17
22
 
18
23
  afterEach(async () => {
19
- await rm(TEST_DIR, { recursive: true, force: true });
24
+ try {
25
+ await rm(TEST_DIR, { recursive: true, force: true });
26
+ } catch {
27
+ // ignore cleanup failures
28
+ }
20
29
  });
21
30
 
22
31
  describe("load", () => {
@@ -12,14 +12,22 @@ describe("PidStore", () => {
12
12
  let store: PidStore;
13
13
 
14
14
  beforeEach(async () => {
15
- await rm(TEST_DIR, { recursive: true, force: true });
15
+ try {
16
+ await rm(TEST_DIR, { recursive: true, force: true });
17
+ } catch {
18
+ // ignore cleanup failures (e.g. Windows lock files from previous test)
19
+ }
16
20
  store = new PidStore(TEST_DIR);
17
21
  await store.init();
18
22
  });
19
23
 
20
24
  afterEach(async () => {
21
25
  await store.close();
22
- await rm(TEST_DIR, { recursive: true, force: true });
26
+ try {
27
+ await rm(TEST_DIR, { recursive: true, force: true });
28
+ } catch {
29
+ // ignore cleanup failures
30
+ }
23
31
  });
24
32
 
25
33
  describe("registerProcess", () => {
@@ -170,7 +178,11 @@ describe("PidStore", () => {
170
178
 
171
179
  it("should return fifo of most recent non-exited process", async () => {
172
180
  const fifoTestDir = TEST_DIR + "-fifo";
173
- await rm(fifoTestDir, { recursive: true, force: true });
181
+ try {
182
+ await rm(fifoTestDir, { recursive: true, force: true });
183
+ } catch {
184
+ // ignore cleanup failures (e.g. Windows lock files)
185
+ }
174
186
 
175
187
  const fifoStore = new PidStore(fifoTestDir);
176
188
  await fifoStore.init();
@@ -185,7 +197,11 @@ describe("PidStore", () => {
185
197
  expect(fifo!).toContain(`${process.pid}.stdin`);
186
198
  }
187
199
 
188
- await rm(fifoTestDir, { recursive: true, force: true });
200
+ try {
201
+ await rm(fifoTestDir, { recursive: true, force: true });
202
+ } catch {
203
+ // ignore cleanup failures
204
+ }
189
205
  });
190
206
  });
191
207
 
package/ts/tray.spec.ts CHANGED
@@ -215,6 +215,62 @@ describe("tray", () => {
215
215
  Object.defineProperty(process, "platform", { value: originalPlatform });
216
216
  });
217
217
 
218
+ it("should auto-exit after ~30s with 0 agents", async () => {
219
+ const originalPlatform = process.platform;
220
+ Object.defineProperty(process, "platform", { value: "darwin" });
221
+ vi.useFakeTimers();
222
+ const mockExit = vi.spyOn(process, "exit").mockImplementation(() => undefined as never);
223
+
224
+ const { startTray } = await import("./tray.ts");
225
+ await startTray();
226
+
227
+ // Keep returning 0 agents for 15 polls (IDLE_EXIT_POLLS)
228
+ mockGetRunningAgentCount.mockResolvedValue({ count: 0, tasks: [] });
229
+
230
+ // Advance 15 * 2s = 30s
231
+ await vi.advanceTimersByTimeAsync(15 * 2100);
232
+
233
+ expect(mockSysTray.instance.kill).toHaveBeenCalledWith(false);
234
+ await vi.waitFor(() => expect(mockExit).toHaveBeenCalledWith(0));
235
+
236
+ mockExit.mockRestore();
237
+ vi.useRealTimers();
238
+ Object.defineProperty(process, "platform", { value: originalPlatform });
239
+ });
240
+
241
+ it("should reset idle counter when agents appear", async () => {
242
+ const originalPlatform = process.platform;
243
+ Object.defineProperty(process, "platform", { value: "darwin" });
244
+ vi.useFakeTimers();
245
+ const mockExit = vi.spyOn(process, "exit").mockImplementation(() => undefined as never);
246
+
247
+ const { startTray } = await import("./tray.ts");
248
+ await startTray();
249
+
250
+ // 10 polls at 0 agents
251
+ mockGetRunningAgentCount.mockResolvedValue({ count: 0, tasks: [] });
252
+ await vi.advanceTimersByTimeAsync(10 * 2100);
253
+
254
+ // Then an agent appears — resets idle counter
255
+ mockGetRunningAgentCount.mockResolvedValue({
256
+ count: 1,
257
+ tasks: [
258
+ { pid: 1, cwd: "/a", task: "t", status: "running" as const, startedAt: 0, lockedAt: 0 },
259
+ ],
260
+ });
261
+ await vi.advanceTimersByTimeAsync(2100);
262
+
263
+ // Then 10 more polls at 0 — should NOT exit yet (need 15 consecutive)
264
+ mockGetRunningAgentCount.mockResolvedValue({ count: 0, tasks: [] });
265
+ await vi.advanceTimersByTimeAsync(10 * 2100);
266
+
267
+ expect(mockExit).not.toHaveBeenCalled();
268
+
269
+ mockExit.mockRestore();
270
+ vi.useRealTimers();
271
+ Object.defineProperty(process, "platform", { value: originalPlatform });
272
+ });
273
+
218
274
  it("should work on Windows", async () => {
219
275
  const originalPlatform = process.platform;
220
276
  Object.defineProperty(process, "platform", { value: "win32" });
package/ts/tray.ts CHANGED
@@ -5,6 +5,7 @@ import path from "path";
5
5
  import { getRunningAgentCount, type Task } from "./runningLock.ts";
6
6
 
7
7
  const POLL_INTERVAL = 2000;
8
+ const IDLE_EXIT_POLLS = 15; // Exit after 15 polls (~30s) with 0 agents
8
9
 
9
10
  const getTrayDir = () => path.join(process.env.CLAUDE_YES_HOME || homedir(), ".claude-yes");
10
11
  const getTrayPidFile = () => path.join(getTrayDir(), "tray.pid");
@@ -176,10 +177,21 @@ export async function startTray(): Promise<void> {
176
177
 
177
178
  // Poll and update, auto-exit after ~30s idle (0 agents)
178
179
  let lastCount = count;
180
+ let idlePolls = count === 0 ? 1 : 0;
179
181
  intervalId = setInterval(async () => {
180
182
  try {
181
183
  const { count: newCount, tasks: newTasks } = await getRunningAgentCount();
182
184
 
185
+ if (newCount === 0) {
186
+ idlePolls++;
187
+ if (idlePolls >= IDLE_EXIT_POLLS) {
188
+ cleanup();
189
+ return;
190
+ }
191
+ } else {
192
+ idlePolls = 0;
193
+ }
194
+
183
195
  if (newCount !== lastCount) {
184
196
  lastCount = newCount;
185
197