agent-yes 1.60.4 → 1.60.6

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.
@@ -560,21 +560,25 @@ var JsonlStore = class {
560
560
  * Acquires lock.
561
561
  */
562
562
  async compact() {
563
- await this.withLock(async () => {
564
- const lines = Array.from(this.docs.values()).map((doc) => {
565
- const { _id, $$deleted, ...rest } = doc;
566
- return JSON.stringify({
567
- _id,
568
- ...rest
569
- });
570
- }).join("\n");
571
- const content = lines ? lines + "\n" : "";
572
- await writeFile$1(this.tempPath, content);
573
- const fd = openSync(this.tempPath, "r");
574
- fsyncSync(fd);
575
- closeSync(fd);
576
- await rename(this.tempPath, this.filePath);
577
- });
563
+ const lines = Array.from(this.docs.values()).map((doc) => {
564
+ const { _id, $$deleted, ...rest } = doc;
565
+ return JSON.stringify({
566
+ _id,
567
+ ...rest
568
+ });
569
+ }).join("\n");
570
+ const content = lines ? lines + "\n" : "";
571
+ try {
572
+ await this.withLock(async () => {
573
+ await writeFile$1(this.tempPath, content);
574
+ const fd = openSync(this.tempPath, "r");
575
+ fsyncSync(fd);
576
+ closeSync(fd);
577
+ await rename(this.tempPath, this.filePath);
578
+ });
579
+ } catch {
580
+ await writeFile$1(this.filePath, content);
581
+ }
578
582
  }
579
583
  async withLock(fn) {
580
584
  const dir = path.dirname(this.filePath);
@@ -902,7 +906,7 @@ function tryCatch(catchFn, fn) {
902
906
  //#endregion
903
907
  //#region package.json
904
908
  var name = "agent-yes";
905
- var version = "1.60.4";
909
+ var version = "1.60.6";
906
910
 
907
911
  //#endregion
908
912
  //#region ts/pty-fix.ts
@@ -1949,4 +1953,4 @@ const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
1949
1953
 
1950
1954
  //#endregion
1951
1955
  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 };
1952
- //# sourceMappingURL=SUPPORTED_CLIS-CsIeXGPS.js.map
1956
+ //# sourceMappingURL=SUPPORTED_CLIS--w_SPLyp.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-CsIeXGPS.js";
2
+ import { c as PidStore, o as name, s as version, t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS--w_SPLyp.js";
3
3
  import "./agent-yes.config-B-sre0vp.js";
4
4
  import { t as logger } from "./logger-CY9ormLF.js";
5
5
  import { argv } from "process";
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-CsIeXGPS.js";
1
+ import { a as AgentContext, i as config, l as removeControlCharacters, n as CLIS_CONFIG, r as agentYes } from "./SUPPORTED_CLIS--w_SPLyp.js";
2
2
  import "./logger-CY9ormLF.js";
3
3
 
4
4
  export { AgentContext, CLIS_CONFIG, config, agentYes as default, removeControlCharacters };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.60.4",
3
+ "version": "1.60.6",
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/JsonlStore.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { appendFile, mkdir, readFile, rename, writeFile } from "fs/promises";
1
+ import { appendFile, mkdir, readFile, rename, unlink, writeFile } from "fs/promises";
2
2
  import { existsSync } from "fs";
3
3
  import { fsyncSync, openSync, closeSync } from "fs";
4
4
  import path from "path";
@@ -167,24 +167,29 @@ export class JsonlStore<T extends Record<string, any> = Record<string, any>> {
167
167
  * Acquires lock.
168
168
  */
169
169
  async compact(): Promise<void> {
170
- await this.withLock(async () => {
171
- const lines = Array.from(this.docs.values())
172
- .map((doc) => {
173
- const { _id, $$deleted, ...rest } = doc;
174
- return JSON.stringify({ _id, ...rest });
175
- })
176
- .join("\n");
177
- const content = lines ? lines + "\n" : "";
178
-
179
- // Write to temp file
180
- await writeFile(this.tempPath, content);
181
- // fsync temp file
182
- const fd = openSync(this.tempPath, "r");
183
- fsyncSync(fd);
184
- closeSync(fd);
185
- // Atomic rename
186
- await rename(this.tempPath, this.filePath);
187
- });
170
+ const lines = Array.from(this.docs.values())
171
+ .map((doc) => {
172
+ const { _id, $$deleted, ...rest } = doc;
173
+ return JSON.stringify({ _id, ...rest });
174
+ })
175
+ .join("\n");
176
+ const content = lines ? lines + "\n" : "";
177
+
178
+ try {
179
+ await this.withLock(async () => {
180
+ // Write to temp file
181
+ await writeFile(this.tempPath, content);
182
+ // fsync temp file
183
+ const fd = openSync(this.tempPath, "r");
184
+ fsyncSync(fd);
185
+ closeSync(fd);
186
+ // Atomic rename
187
+ await rename(this.tempPath, this.filePath);
188
+ });
189
+ } catch {
190
+ // Fallback: direct overwrite (e.g. rename fails on Windows, or lock unavailable)
191
+ await writeFile(this.filePath, content);
192
+ }
188
193
  }
189
194
 
190
195
  private async withLock<R>(fn: () => Promise<R>): Promise<R> {
@@ -3,7 +3,10 @@ import { PidStore } from "./pidStore";
3
3
  import { rm, readFile } from "fs/promises";
4
4
  import path from "path";
5
5
 
6
- const TEST_DIR = "/tmp/pidstore-test-" + process.pid;
6
+ const isWindows = process.platform === "win32";
7
+ const TEST_DIR = isWindows
8
+ ? path.join(process.env.TEMP || "C:\\Temp", "pidstore-test-" + process.pid)
9
+ : "/tmp/pidstore-test-" + process.pid;
7
10
 
8
11
  describe("PidStore", () => {
9
12
  let store: PidStore;
@@ -84,7 +87,11 @@ describe("PidStore", () => {
84
87
  });
85
88
 
86
89
  expect(rec.logFile).toContain("42.log");
87
- expect(rec.fifoFile).toContain("42.stdin");
90
+ if (isWindows) {
91
+ expect(rec.fifoFile).toContain("agent-yes-42");
92
+ } else {
93
+ expect(rec.fifoFile).toContain("42.stdin");
94
+ }
88
95
  });
89
96
  });
90
97
 
@@ -158,7 +165,11 @@ describe("PidStore", () => {
158
165
 
159
166
  const fifo = await PidStore.findActiveFifo(fifoTestDir);
160
167
  expect(fifo).toBeTypeOf("string");
161
- expect(fifo!).toContain(`${process.pid}.stdin`);
168
+ if (isWindows) {
169
+ expect(fifo!).toContain(`agent-yes-${process.pid}`);
170
+ } else {
171
+ expect(fifo!).toContain(`${process.pid}.stdin`);
172
+ }
162
173
 
163
174
  await rm(fifoTestDir, { recursive: true, force: true });
164
175
  });
@@ -189,14 +200,18 @@ describe("PidStore", () => {
189
200
 
190
201
  it("getFifoPath should return correct path", () => {
191
202
  const fifo = store.getFifoPath(42);
192
- expect(fifo).toBe(path.resolve(TEST_DIR, ".agent-yes", "fifo", "42.stdin"));
203
+ if (isWindows) {
204
+ expect(fifo).toBe(`\\\\.\\pipe\\agent-yes-42`);
205
+ } else {
206
+ expect(fifo).toBe(path.resolve(TEST_DIR, ".agent-yes", "fifo", "42.stdin"));
207
+ }
193
208
  });
194
209
  });
195
210
 
196
211
  describe("gitignore", () => {
197
212
  it("should create .gitignore in store dir", async () => {
198
213
  const gitignorePath = path.join(TEST_DIR, ".agent-yes", ".gitignore");
199
- const content = await Bun.file(gitignorePath).text();
214
+ const content = await readFile(gitignorePath, "utf-8");
200
215
  expect(content).toContain("*.jsonl");
201
216
  expect(content).toContain("logs/");
202
217
  });