@chipschat/acp 1.0.31 → 1.0.32

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.
@@ -1,6 +1,6 @@
1
1
  # Third-party notices
2
2
 
3
- `dist/main.js` in @chipschat/acp 1.0.31 carries these packages, bundled in. Each one's
3
+ `dist/main.js` in @chipschat/acp 1.0.32 carries these packages, bundled in. Each one's
4
4
  licence follows.
5
5
 
6
6
  ## @chipschat/harness 1.0.10 (Apache-2.0)
package/dist/main.js CHANGED
@@ -5078,7 +5078,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
5078
5078
  var NONE = 0;
5079
5079
  var ASSUMED = 1;
5080
5080
  var PROVEN = 2;
5081
- function isRecursive(inst, stack, resolve5) {
5081
+ function isRecursive(inst, stack, resolve6) {
5082
5082
  const cached2 = recursive.get(inst);
5083
5083
  if (cached2 !== void 0)
5084
5084
  return cached2 ? PROVEN : NONE;
@@ -5088,7 +5088,7 @@ function isRecursive(inst, stack, resolve5) {
5088
5088
  let result = NONE;
5089
5089
  const check2 = (child) => {
5090
5090
  if (result !== PROVEN && child?._zod) {
5091
- const answer = isRecursive(child, stack, resolve5);
5091
+ const answer = isRecursive(child, stack, resolve6);
5092
5092
  if (answer > result)
5093
5093
  result = answer;
5094
5094
  }
@@ -5099,7 +5099,7 @@ function isRecursive(inst, stack, resolve5) {
5099
5099
  const desc = Object.getOwnPropertyDescriptor(sh, key);
5100
5100
  if (spread && !desc.enumerable)
5101
5101
  continue;
5102
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve5) : NONE;
5102
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve6) : NONE;
5103
5103
  if (child > answer)
5104
5104
  answer = child;
5105
5105
  }
@@ -5163,7 +5163,7 @@ function isRecursive(inst, stack, resolve5) {
5163
5163
  break;
5164
5164
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
5165
5165
  case "lazy": {
5166
- const inner = def._cachedInner ?? (resolve5 ? inst._zod.innerType : void 0);
5166
+ const inner = def._cachedInner ?? (resolve6 ? inst._zod.innerType : void 0);
5167
5167
  merge3(inner ? isRecursive(inner, stack, false) : ASSUMED);
5168
5168
  break;
5169
5169
  }
@@ -23220,8 +23220,8 @@ function createOutbox() {
23220
23220
  const waiting = /* @__PURE__ */ new Map();
23221
23221
  return {
23222
23222
  add(key, event) {
23223
- return new Promise((resolve5, reject) => {
23224
- waiting.set(key, { event, resolve: resolve5, reject });
23223
+ return new Promise((resolve6, reject) => {
23224
+ waiting.set(key, { event, resolve: resolve6, reject });
23225
23225
  });
23226
23226
  },
23227
23227
  unanswered: () => [...waiting.values()].map((entry) => entry.event),
@@ -23297,7 +23297,7 @@ async function inPieces(call, path, bytes) {
23297
23297
  async function afterLoss(error62, failures) {
23298
23298
  if (error62 instanceof RefusedError || failures >= PIECE_TRIES)
23299
23299
  throw error62;
23300
- await new Promise((resolve5) => setTimeout(resolve5, 250 * failures));
23300
+ await new Promise((resolve6) => setTimeout(resolve6, 250 * failures));
23301
23301
  }
23302
23302
  function sendPiece(call, path, bytes, offset) {
23303
23303
  const piece = bytes.subarray(offset, Math.min(offset + PIECE_BYTES, bytes.byteLength));
@@ -23381,13 +23381,13 @@ function heldNote(pushed, name) {
23381
23381
  }
23382
23382
  async function checkGit(git2 = "git", path = process.env["PATH"] ?? "/usr/bin:/bin") {
23383
23383
  const [major, minor] = versionIn(PROJECT_GIT_VERSION) ?? [0, 0];
23384
- return new Promise((resolve5) => {
23384
+ return new Promise((resolve6) => {
23385
23385
  execFile(git2, ["--version"], { env: { PATH: path } }, (error62, stdout) => {
23386
23386
  if (error62 !== null)
23387
- return resolve5({ ok: false, why: "git was not found on this machine" });
23387
+ return resolve6({ ok: false, why: "git was not found on this machine" });
23388
23388
  const mine = versionIn(stdout);
23389
23389
  const enough = mine !== void 0 && (mine[0] > major || mine[0] === major && mine[1] >= minor);
23390
- resolve5(enough ? { ok: true, version: mine.join(".") } : { ok: false, why: `${stdout.trim()} is older than ${PROJECT_GIT_VERSION}` });
23390
+ resolve6(enough ? { ok: true, version: mine.join(".") } : { ok: false, why: `${stdout.trim()} is older than ${PROJECT_GIT_VERSION}` });
23391
23391
  });
23392
23392
  });
23393
23393
  }
@@ -23833,8 +23833,8 @@ ${sent.err}`;
23833
23833
  env2[`GIT_CONFIG_KEY_${at}`] = key;
23834
23834
  env2[`GIT_CONFIG_VALUE_${at}`] = value;
23835
23835
  });
23836
- return new Promise((resolve5) => {
23837
- execFile(options.git ?? "git", [...args], { cwd: this.copy, env: env2, maxBuffer: 64 * 1024 * 1024 }, (error62, stdout, stderr) => resolve5({ ok: error62 === null, out: stdout, err: stderr }));
23836
+ return new Promise((resolve6) => {
23837
+ execFile(options.git ?? "git", [...args], { cwd: this.copy, env: env2, maxBuffer: 64 * 1024 * 1024 }, (error62, stdout, stderr) => resolve6({ ok: error62 === null, out: stdout, err: stderr }));
23838
23838
  });
23839
23839
  }
23840
23840
  };
@@ -23859,8 +23859,8 @@ var Lane = class {
23859
23859
  constructor(id2, wire) {
23860
23860
  this.id = id2;
23861
23861
  this.wire = wire;
23862
- this.result = new Promise((resolve5) => {
23863
- this.settle = resolve5;
23862
+ this.result = new Promise((resolve6) => {
23863
+ this.settle = resolve6;
23864
23864
  });
23865
23865
  this.stop = wire.hear(id2, (event) => this.onUpdated(event));
23866
23866
  }
@@ -24004,7 +24004,7 @@ var Run = class {
24004
24004
  /** Resolve once the run is not paused. A stopped run resolves too: check `over` after. */
24005
24005
  async whenRunning() {
24006
24006
  while (this.held && !this.ended) {
24007
- await new Promise((resolve5) => setTimeout(resolve5, 50));
24007
+ await new Promise((resolve6) => setTimeout(resolve6, 50));
24008
24008
  }
24009
24009
  }
24010
24010
  status(input2) {
@@ -24981,8 +24981,8 @@ var Chips = class _Chips {
24981
24981
  /** Resolve with the first event that matches, now or later. */
24982
24982
  waitFor(match) {
24983
24983
  this.listens();
24984
- return new Promise((resolve5) => {
24985
- this.waiters.add({ match, resolve: resolve5 });
24984
+ return new Promise((resolve6) => {
24985
+ this.waiters.add({ match, resolve: resolve6 });
24986
24986
  });
24987
24987
  }
24988
24988
  close() {
@@ -25009,14 +25009,14 @@ var Chips = class _Chips {
25009
25009
  return `${base}/v1/ws?ticket=${encodeURIComponent(String(ticket))}`;
25010
25010
  }
25011
25011
  open(first) {
25012
- return new Promise((resolve5, reject) => {
25012
+ return new Promise((resolve6, reject) => {
25013
25013
  this.setState("connecting");
25014
25014
  const failed = (what, error62) => {
25015
25015
  const why = `${what}: ${describe3(error62)}`;
25016
25016
  if (!first)
25017
25017
  this.scheduleReconnect();
25018
25018
  else if (this.waitsFor(error62))
25019
- this.tryAgain(why, resolve5, reject);
25019
+ this.tryAgain(why, resolve6, reject);
25020
25020
  else
25021
25021
  reject(new ConnectError(why));
25022
25022
  };
@@ -25030,19 +25030,19 @@ var Chips = class _Chips {
25030
25030
  }
25031
25031
  this.socket = socket;
25032
25032
  this.listen(socket, {
25033
- settled: (hello2) => this.settled(socket, hello2, first, resolve5, reject)
25033
+ settled: (hello2) => this.settled(socket, hello2, first, resolve6, reject)
25034
25034
  });
25035
25035
  }, (error62) => failed("could not get a socket ticket", error62));
25036
25036
  });
25037
25037
  }
25038
25038
  /** The handshake's outcome: the hello, a refusal, or the socket gone before either. */
25039
- settled(socket, hello2, first, resolve5, reject) {
25039
+ settled(socket, hello2, first, resolve6, reject) {
25040
25040
  if (hello2 === void 0) {
25041
25041
  const why = "the server closed the socket before saying hello";
25042
25042
  if (!first)
25043
25043
  this.scheduleReconnect();
25044
25044
  else if (this.options.waitForServer === true)
25045
- this.tryAgain(why, resolve5, reject);
25045
+ this.tryAgain(why, resolve6, reject);
25046
25046
  else
25047
25047
  reject(new ConnectError(why));
25048
25048
  return;
@@ -25053,7 +25053,7 @@ var Chips = class _Chips {
25053
25053
  return;
25054
25054
  }
25055
25055
  this.onHello(socket, hello2);
25056
- void this.subscribed(socket).then(resolve5);
25056
+ void this.subscribed(socket).then(resolve6);
25057
25057
  }
25058
25058
  /** The socket's four events. `settled` fires once: with the hello, a refusal, or nothing. */
25059
25059
  listen(socket, on) {
@@ -25150,15 +25150,15 @@ var Chips = class _Chips {
25150
25150
  subscribed(socket) {
25151
25151
  this.pings += 1;
25152
25152
  const ts = Date.now() + this.pings;
25153
- return new Promise((resolve5) => {
25153
+ return new Promise((resolve6) => {
25154
25154
  const timer = setTimeout(() => {
25155
25155
  this.pongs.delete(ts);
25156
- resolve5();
25156
+ resolve6();
25157
25157
  }, 2e3);
25158
25158
  this.pongs.set(ts, () => {
25159
25159
  clearTimeout(timer);
25160
25160
  this.pongs.delete(ts);
25161
- resolve5();
25161
+ resolve6();
25162
25162
  });
25163
25163
  socket.send(JSON.stringify({ frame: "ping", ts }));
25164
25164
  });
@@ -25388,7 +25388,7 @@ var Chips = class _Chips {
25388
25388
  return /^(5\d\d|429)$/.test(error62.code) || UNREACHABLE.has(error62.code);
25389
25389
  }
25390
25390
  /** The first connect again after a wait, as a reconnect waits; `connect` resolves once it is in. */
25391
- tryAgain(why, resolve5, reject) {
25391
+ tryAgain(why, resolve6, reject) {
25392
25392
  if (this.closed) {
25393
25393
  reject(new ConnectError("the connection was closed while waiting for the server"));
25394
25394
  return;
@@ -25398,7 +25398,7 @@ var Chips = class _Chips {
25398
25398
  clearTimeout(this.timer);
25399
25399
  this.timer = setTimeout(() => {
25400
25400
  this.timer = void 0;
25401
- this.open(true).then(resolve5, reject);
25401
+ this.open(true).then(resolve6, reject);
25402
25402
  }, Math.min(500 * this.retry, 5e3));
25403
25403
  }
25404
25404
  scheduleReconnect() {
@@ -25750,8 +25750,8 @@ async function refused(response) {
25750
25750
  const body = await response.json().catch(() => ({}));
25751
25751
  return new JoinError(body.error?.refusal ?? body.error?.code ?? `http_${response.status}`, body.error?.message ?? `Chips answered ${response.status}.`);
25752
25752
  }
25753
- var wait = (ms, signal) => new Promise((resolve5, reject) => {
25754
- const timer = setTimeout(resolve5, ms);
25753
+ var wait = (ms, signal) => new Promise((resolve6, reject) => {
25754
+ const timer = setTimeout(resolve6, ms);
25755
25755
  signal?.addEventListener("abort", () => {
25756
25756
  clearTimeout(timer);
25757
25757
  reject(new JoinError("stopped", "Stopped before a person decided."));
@@ -26616,8 +26616,8 @@ var AcpClient = class {
26616
26616
  call(method, params) {
26617
26617
  if (this.closed) return Promise.reject(new AcpError("the agent is not running", -32e3));
26618
26618
  const id2 = this.next++;
26619
- return new Promise((resolve5, reject) => {
26620
- this.pending.set(id2, { resolve: resolve5, reject });
26619
+ return new Promise((resolve6, reject) => {
26620
+ this.pending.set(id2, { resolve: resolve6, reject });
26621
26621
  this.wire.write(JSON.stringify({ jsonrpc: "2.0", id: id2, method, params }));
26622
26622
  });
26623
26623
  }
@@ -26957,8 +26957,8 @@ async function checkSignIn(kind2, wire, cwd, options = {}) {
26957
26957
  let status;
26958
26958
  let heard = () => {
26959
26959
  };
26960
- const said = new Promise((resolve5) => {
26961
- heard = resolve5;
26960
+ const said = new Promise((resolve6) => {
26961
+ heard = resolve6;
26962
26962
  });
26963
26963
  const client = new AcpClient(wire, {
26964
26964
  update: () => void 0,
@@ -27020,7 +27020,7 @@ function withFetchedAdapter(kind2, env2 = process.env, home = homedir5()) {
27020
27020
  return runnable(fetched) ? { ...kind2, command: [fetched, ...kind2.command.slice(1)] } : kind2;
27021
27021
  }
27022
27022
  function npmInstall(job) {
27023
- return new Promise((resolve5, reject) => {
27023
+ return new Promise((resolve6, reject) => {
27024
27024
  const registry2 = job.env["CHIPS_NPM_REGISTRY"];
27025
27025
  const child = spawn2(
27026
27026
  job.node,
@@ -27050,7 +27050,7 @@ function npmInstall(job) {
27050
27050
  });
27051
27051
  child.on("exit", (code) => {
27052
27052
  clearTimeout(late);
27053
- if (code === 0) resolve5();
27053
+ if (code === 0) resolve6();
27054
27054
  else reject(new Error(said.trim() || `npm stopped with ${code ?? "a signal"}`));
27055
27055
  });
27056
27056
  });
@@ -27834,8 +27834,8 @@ var Bridge = class {
27834
27834
  constructor(options) {
27835
27835
  this.options = options;
27836
27836
  this.log = options.log ?? (() => void 0);
27837
- this.known = new Promise((resolve5) => {
27838
- this.knew = resolve5;
27837
+ this.known = new Promise((resolve6) => {
27838
+ this.knew = resolve6;
27839
27839
  });
27840
27840
  this.env = options.env ?? adapterEnv(options.kind, { ...process.env, ...options.kind.env });
27841
27841
  this.places = placesOf2(this.env, options.home ?? homedir7());
@@ -28287,7 +28287,7 @@ var Bridge = class {
28287
28287
  const client = this.process.client;
28288
28288
  if (client !== void 0 && !client.gone && this.process.info !== void 0) return client;
28289
28289
  if (Date.now() > by) return void 0;
28290
- await new Promise((resolve5) => setTimeout(resolve5, 100));
28290
+ await new Promise((resolve6) => setTimeout(resolve6, 100));
28291
28291
  }
28292
28292
  return void 0;
28293
28293
  }
@@ -29504,8 +29504,8 @@ ${files.join("\n")}`;
29504
29504
  */
29505
29505
  async answerOf(turn, asked) {
29506
29506
  let off = () => void 0;
29507
- const stopped2 = new Promise((resolve5) => {
29508
- off = turn.run.on("cancel", () => resolve5(void 0));
29507
+ const stopped2 = new Promise((resolve6) => {
29508
+ off = turn.run.on("cancel", () => resolve6(void 0));
29509
29509
  });
29510
29510
  turn.asking += 1;
29511
29511
  try {
@@ -29659,15 +29659,30 @@ function forkName(original) {
29659
29659
  }
29660
29660
 
29661
29661
  // src/keep.ts
29662
- import { basename as basename4 } from "node:path";
29662
+ import { realpathSync } from "node:fs";
29663
+ import { basename as basename4, relative as relative3, resolve as resolve4, sep as sep4 } from "node:path";
29663
29664
  import { fileURLToPath as fileURLToPath2 } from "node:url";
29664
29665
  var flags = process.argv.slice(2);
29665
29666
  var words3 = flags.filter((word) => !word.startsWith("--"));
29666
29667
  var handsOver = flags.includes("--keep");
29667
29668
  var stopping = flags.includes("--stop");
29668
29669
  var whole = (word) => configTargetOf(word);
29669
- var here = fileURLToPath2(new URL("..", import.meta.url)).replace(/\/$/, "");
29670
- var self = fileURLToPath2(import.meta.url);
29670
+ function asStarted(root, file3, started2 = process.argv[1]) {
29671
+ if (started2 === void 0 || started2 === "") return { root, file: file3 };
29672
+ const tail = relative3(root, file3);
29673
+ const whole2 = resolve4(started2);
29674
+ if (!whole2.endsWith(`${sep4}${tail}`)) return { root, file: file3 };
29675
+ try {
29676
+ if (realpathSync(whole2) !== realpathSync(file3)) return { root, file: file3 };
29677
+ } catch {
29678
+ return { root, file: file3 };
29679
+ }
29680
+ return { root: whole2.slice(0, -tail.length - 1), file: whole2 };
29681
+ }
29682
+ var { root: here, file: self } = asStarted(
29683
+ fileURLToPath2(new URL("..", import.meta.url)).replace(/\/$/, ""),
29684
+ fileURLToPath2(import.meta.url)
29685
+ );
29671
29686
  var run = self.endsWith(".js") ? [self] : ["--import", "tsx", "src/main.ts"];
29672
29687
  var again = process.env["npm_lifecycle_event"] === "keep" ? "npm run keep --" : basename4(process.argv[1] ?? "chips");
29673
29688
  var stopLine = process.env["CHIPS_STOP_COMMAND"] || [again, ...words3, "--stop"].join(" ");
@@ -29714,7 +29729,7 @@ function keepIfAsked(label2, url2, names, log2, before = () => void 0) {
29714
29729
  // src/move.ts
29715
29730
  import { lstatSync, mkdirSync as mkdirSync5, readdirSync as readdirSync2, readFileSync as readFileSync9, renameSync as renameSync2, rmdirSync, writeFileSync as writeFileSync4 } from "node:fs";
29716
29731
  import { homedir as homedir8 } from "node:os";
29717
- import { basename as basename5, dirname as dirname6, join as join11, resolve as resolve4 } from "node:path";
29732
+ import { basename as basename5, dirname as dirname6, join as join11, resolve as resolve5 } from "node:path";
29718
29733
  var there = (path) => {
29719
29734
  try {
29720
29735
  lstatSync(path);
@@ -29754,7 +29769,7 @@ function removeIfEmpty(path) {
29754
29769
  function claudeStoreOf(folder2, env2, home = homedir8()) {
29755
29770
  const name = folder2.replace(/[^a-zA-Z0-9]/g, "-");
29756
29771
  if (name.length > 200) return void 0;
29757
- return join11(env2["CLAUDE_CONFIG_DIR"] ? resolve4(fromHome(env2["CLAUDE_CONFIG_DIR"], home)) : join11(home, ".claude"), "projects", name);
29772
+ return join11(env2["CLAUDE_CONFIG_DIR"] ? resolve5(fromHome(env2["CLAUDE_CONFIG_DIR"], home)) : join11(home, ".claude"), "projects", name);
29758
29773
  }
29759
29774
  function pairOf(path, places) {
29760
29775
  const old = inside2(places.oldAgents, path);
@@ -29803,7 +29818,7 @@ function moveOld(configPath2, log2, home = homedir8(), env2 = process.env) {
29803
29818
  for (const key of ["folders", "folder"]) {
29804
29819
  const said = config2[key];
29805
29820
  if (typeof said !== "string") continue;
29806
- const path = resolve4(fromHome(said, home));
29821
+ const path = resolve5(fromHome(said, home));
29807
29822
  const moved = nowAt(path, places.oldAgents, places.agents);
29808
29823
  if (moved === path) continue;
29809
29824
  config2[key] = `~/${moved.slice(home.length + 1)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipschat/acp",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": "An agent that speaks the Agent Client Protocol, as a Chips harness of its kind: agents made from Chips, each in a folder of its own, each room a session.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {