@chipschat/acp 1.0.30 → 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.
- package/README.md +5 -2
- package/dist/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/main.js +86 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,10 +39,13 @@ need not be there: without them the bridge runs Claude Code or Codex, in the mod
|
|
|
39
39
|
|
|
40
40
|
Before it takes the link up, which works once, it checks:
|
|
41
41
|
- the config is there, or is one of those two;
|
|
42
|
-
- its command is on this machine's PATH (else how to install it)
|
|
42
|
+
- its command is on this machine's PATH (else how to install it). Claude Code and Codex are also
|
|
43
|
+
looked for in `~/.local/bin`, where their makers' installers put them, since the terminal an
|
|
44
|
+
installer ran in doesn't have that folder on its PATH until a new one is opened;
|
|
43
45
|
- the agent starts, makes a session, and is signed in: Codex refuses a session while signed out,
|
|
44
46
|
and Claude Code says it is signed in as nobody (`_auth/status_update`). Signed out, it says how
|
|
45
|
-
to sign in: `codex login
|
|
47
|
+
to sign in: `codex login` (`codex login --device-auth` on a machine with no screen), or
|
|
48
|
+
`claude auth login`.
|
|
46
49
|
|
|
47
50
|
Anything missing stops it with what to do, and the link is still good. Joined, it says hello in its
|
|
48
51
|
room once, which the card waits for; a new link from Chips replaces the key it kept. Without a
|
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,
|
|
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,
|
|
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,
|
|
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 ?? (
|
|
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((
|
|
23224
|
-
waiting.set(key, { event, resolve:
|
|
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((
|
|
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((
|
|
23384
|
+
return new Promise((resolve6) => {
|
|
23385
23385
|
execFile(git2, ["--version"], { env: { PATH: path } }, (error62, stdout) => {
|
|
23386
23386
|
if (error62 !== null)
|
|
23387
|
-
return
|
|
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
|
-
|
|
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((
|
|
23837
|
-
execFile(options.git ?? "git", [...args], { cwd: this.copy, env: env2, maxBuffer: 64 * 1024 * 1024 }, (error62, stdout, 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((
|
|
23863
|
-
this.settle =
|
|
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((
|
|
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((
|
|
24985
|
-
this.waiters.add({ match, resolve:
|
|
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((
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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(
|
|
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((
|
|
25153
|
+
return new Promise((resolve6) => {
|
|
25154
25154
|
const timer = setTimeout(() => {
|
|
25155
25155
|
this.pongs.delete(ts);
|
|
25156
|
-
|
|
25156
|
+
resolve6();
|
|
25157
25157
|
}, 2e3);
|
|
25158
25158
|
this.pongs.set(ts, () => {
|
|
25159
25159
|
clearTimeout(timer);
|
|
25160
25160
|
this.pongs.delete(ts);
|
|
25161
|
-
|
|
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,
|
|
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(
|
|
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((
|
|
25754
|
-
const timer = setTimeout(
|
|
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((
|
|
26620
|
-
this.pending.set(id2, { resolve:
|
|
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
|
}
|
|
@@ -26722,6 +26722,7 @@ var KNOWN2 = [
|
|
|
26722
26722
|
fetches: false,
|
|
26723
26723
|
agent: "claude",
|
|
26724
26724
|
installLine: "curl -fsSL https://claude.ai/install.sh | bash",
|
|
26725
|
+
installedIn: ".local/bin",
|
|
26725
26726
|
mode: "default",
|
|
26726
26727
|
signIn: "run `claude auth login`",
|
|
26727
26728
|
signInLine: "claude auth login",
|
|
@@ -26736,8 +26737,11 @@ var KNOWN2 = [
|
|
|
26736
26737
|
fetches: true,
|
|
26737
26738
|
agent: "codex",
|
|
26738
26739
|
installLine: "curl -fsSL https://chatgpt.com/codex/install.sh | sh",
|
|
26740
|
+
installedIn: ".local/bin",
|
|
26739
26741
|
mode: "workspace-write",
|
|
26740
26742
|
signIn: "run `codex login`",
|
|
26743
|
+
// Over SSH no browser opens, and the address `codex login` prints calls back to that machine.
|
|
26744
|
+
signInNoScreen: "`codex login --device-auth`",
|
|
26741
26745
|
signInLine: "codex login",
|
|
26742
26746
|
signInDoing: SIGN_IN_DOING
|
|
26743
26747
|
}
|
|
@@ -26783,7 +26787,10 @@ function installWords(kind2) {
|
|
|
26783
26787
|
}
|
|
26784
26788
|
function signedOutWords(kind2, info) {
|
|
26785
26789
|
const known = knownBy(kind2);
|
|
26786
|
-
if (known !== void 0)
|
|
26790
|
+
if (known !== void 0) {
|
|
26791
|
+
const noScreen = known.signInNoScreen === void 0 ? "" : `, or ${known.signInNoScreen} on a machine with no screen`;
|
|
26792
|
+
return `${kind2.name} isn't signed in on this machine: ${known.signIn} in a new terminal${noScreen}.`;
|
|
26793
|
+
}
|
|
26787
26794
|
const ways = (info?.authMethods ?? []).map((method) => method.name);
|
|
26788
26795
|
return `${kind2.name} isn't signed in on this machine: sign it in its own way${ways.length > 0 ? ` (${ways.join(", ")})` : ""}.`;
|
|
26789
26796
|
}
|
|
@@ -26950,8 +26957,8 @@ async function checkSignIn(kind2, wire, cwd, options = {}) {
|
|
|
26950
26957
|
let status;
|
|
26951
26958
|
let heard = () => {
|
|
26952
26959
|
};
|
|
26953
|
-
const said = new Promise((
|
|
26954
|
-
heard =
|
|
26960
|
+
const said = new Promise((resolve6) => {
|
|
26961
|
+
heard = resolve6;
|
|
26955
26962
|
});
|
|
26956
26963
|
const client = new AcpClient(wire, {
|
|
26957
26964
|
update: () => void 0,
|
|
@@ -26994,10 +27001,18 @@ async function checkSignIn(kind2, wire, cwd, options = {}) {
|
|
|
26994
27001
|
}
|
|
26995
27002
|
|
|
26996
27003
|
// src/adapter.ts
|
|
27004
|
+
var inNewTerminal = (name) => `If ${name} still isn't found, run that command in a new terminal.`;
|
|
26997
27005
|
var PATIENCE_MS = 20 * 6e4;
|
|
26998
27006
|
var adapterFolder = (id2, home = homedir5()) => join7(placesOf(home).settings, "adapters", id2);
|
|
26999
27007
|
var fetchedAt = (id2, program, home) => join7(adapterFolder(id2, home), "node_modules", ".bin", program);
|
|
27000
27008
|
var pathOf2 = (kind2, env2) => ({ ...env2, ...kind2.env })["PATH"] ?? "";
|
|
27009
|
+
function makersFolder(kind2, env2 = process.env, home = homedir5()) {
|
|
27010
|
+
const known = knownOf(kind2);
|
|
27011
|
+
if (known === void 0 || onPath(known.agent, pathOf2(kind2, env2))) return void 0;
|
|
27012
|
+
const folder2 = join7(home, known.installedIn);
|
|
27013
|
+
return runnable(join7(folder2, known.agent)) ? folder2 : void 0;
|
|
27014
|
+
}
|
|
27015
|
+
var pathWithLast = (path, folder2) => [...(path ?? "").split(delimiter3).filter((each) => each !== ""), folder2].join(delimiter3);
|
|
27001
27016
|
function withFetchedAdapter(kind2, env2 = process.env, home = homedir5()) {
|
|
27002
27017
|
const known = knownOf(kind2);
|
|
27003
27018
|
if (known === void 0 || kind2.command[0] !== known.program || onPath(known.program, pathOf2(kind2, env2))) return kind2;
|
|
@@ -27005,7 +27020,7 @@ function withFetchedAdapter(kind2, env2 = process.env, home = homedir5()) {
|
|
|
27005
27020
|
return runnable(fetched) ? { ...kind2, command: [fetched, ...kind2.command.slice(1)] } : kind2;
|
|
27006
27021
|
}
|
|
27007
27022
|
function npmInstall(job) {
|
|
27008
|
-
return new Promise((
|
|
27023
|
+
return new Promise((resolve6, reject) => {
|
|
27009
27024
|
const registry2 = job.env["CHIPS_NPM_REGISTRY"];
|
|
27010
27025
|
const child = spawn2(
|
|
27011
27026
|
job.node,
|
|
@@ -27035,7 +27050,7 @@ function npmInstall(job) {
|
|
|
27035
27050
|
});
|
|
27036
27051
|
child.on("exit", (code) => {
|
|
27037
27052
|
clearTimeout(late);
|
|
27038
|
-
if (code === 0)
|
|
27053
|
+
if (code === 0) resolve6();
|
|
27039
27054
|
else reject(new Error(said.trim() || `npm stopped with ${code ?? "a signal"}`));
|
|
27040
27055
|
});
|
|
27041
27056
|
});
|
|
@@ -27048,7 +27063,10 @@ async function readyAdapter(kind2, options = {}) {
|
|
|
27048
27063
|
const path = pathOf2(kind2, env2);
|
|
27049
27064
|
if (onPath(known.program, path)) return kind2;
|
|
27050
27065
|
if (!onPath(known.agent, path)) {
|
|
27051
|
-
throw new SetupError(
|
|
27066
|
+
throw new SetupError(
|
|
27067
|
+
`${kind2.name} isn't installed on this machine: run \`${known.installLine}\`. ${STILL_GOOD} ${inNewTerminal(kind2.name)}`,
|
|
27068
|
+
agentMissingStop(known)
|
|
27069
|
+
);
|
|
27052
27070
|
}
|
|
27053
27071
|
const npm = env2["CHIPS_NPM"];
|
|
27054
27072
|
if (!known.fetches || npm === void 0 || npm === "") return kind2;
|
|
@@ -27816,8 +27834,8 @@ var Bridge = class {
|
|
|
27816
27834
|
constructor(options) {
|
|
27817
27835
|
this.options = options;
|
|
27818
27836
|
this.log = options.log ?? (() => void 0);
|
|
27819
|
-
this.known = new Promise((
|
|
27820
|
-
this.knew =
|
|
27837
|
+
this.known = new Promise((resolve6) => {
|
|
27838
|
+
this.knew = resolve6;
|
|
27821
27839
|
});
|
|
27822
27840
|
this.env = options.env ?? adapterEnv(options.kind, { ...process.env, ...options.kind.env });
|
|
27823
27841
|
this.places = placesOf2(this.env, options.home ?? homedir7());
|
|
@@ -28269,7 +28287,7 @@ var Bridge = class {
|
|
|
28269
28287
|
const client = this.process.client;
|
|
28270
28288
|
if (client !== void 0 && !client.gone && this.process.info !== void 0) return client;
|
|
28271
28289
|
if (Date.now() > by) return void 0;
|
|
28272
|
-
await new Promise((
|
|
28290
|
+
await new Promise((resolve6) => setTimeout(resolve6, 100));
|
|
28273
28291
|
}
|
|
28274
28292
|
return void 0;
|
|
28275
28293
|
}
|
|
@@ -29486,8 +29504,8 @@ ${files.join("\n")}`;
|
|
|
29486
29504
|
*/
|
|
29487
29505
|
async answerOf(turn, asked) {
|
|
29488
29506
|
let off = () => void 0;
|
|
29489
|
-
const stopped2 = new Promise((
|
|
29490
|
-
off = turn.run.on("cancel", () =>
|
|
29507
|
+
const stopped2 = new Promise((resolve6) => {
|
|
29508
|
+
off = turn.run.on("cancel", () => resolve6(void 0));
|
|
29491
29509
|
});
|
|
29492
29510
|
turn.asking += 1;
|
|
29493
29511
|
try {
|
|
@@ -29641,15 +29659,30 @@ function forkName(original) {
|
|
|
29641
29659
|
}
|
|
29642
29660
|
|
|
29643
29661
|
// src/keep.ts
|
|
29644
|
-
import {
|
|
29662
|
+
import { realpathSync } from "node:fs";
|
|
29663
|
+
import { basename as basename4, relative as relative3, resolve as resolve4, sep as sep4 } from "node:path";
|
|
29645
29664
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
29646
29665
|
var flags = process.argv.slice(2);
|
|
29647
29666
|
var words3 = flags.filter((word) => !word.startsWith("--"));
|
|
29648
29667
|
var handsOver = flags.includes("--keep");
|
|
29649
29668
|
var stopping = flags.includes("--stop");
|
|
29650
29669
|
var whole = (word) => configTargetOf(word);
|
|
29651
|
-
|
|
29652
|
-
|
|
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
|
+
);
|
|
29653
29686
|
var run = self.endsWith(".js") ? [self] : ["--import", "tsx", "src/main.ts"];
|
|
29654
29687
|
var again = process.env["npm_lifecycle_event"] === "keep" ? "npm run keep --" : basename4(process.argv[1] ?? "chips");
|
|
29655
29688
|
var stopLine = process.env["CHIPS_STOP_COMMAND"] || [again, ...words3, "--stop"].join(" ");
|
|
@@ -29696,7 +29729,7 @@ function keepIfAsked(label2, url2, names, log2, before = () => void 0) {
|
|
|
29696
29729
|
// src/move.ts
|
|
29697
29730
|
import { lstatSync, mkdirSync as mkdirSync5, readdirSync as readdirSync2, readFileSync as readFileSync9, renameSync as renameSync2, rmdirSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
29698
29731
|
import { homedir as homedir8 } from "node:os";
|
|
29699
|
-
import { basename as basename5, dirname as dirname6, join as join11, resolve as
|
|
29732
|
+
import { basename as basename5, dirname as dirname6, join as join11, resolve as resolve5 } from "node:path";
|
|
29700
29733
|
var there = (path) => {
|
|
29701
29734
|
try {
|
|
29702
29735
|
lstatSync(path);
|
|
@@ -29736,7 +29769,7 @@ function removeIfEmpty(path) {
|
|
|
29736
29769
|
function claudeStoreOf(folder2, env2, home = homedir8()) {
|
|
29737
29770
|
const name = folder2.replace(/[^a-zA-Z0-9]/g, "-");
|
|
29738
29771
|
if (name.length > 200) return void 0;
|
|
29739
|
-
return join11(env2["CLAUDE_CONFIG_DIR"] ?
|
|
29772
|
+
return join11(env2["CLAUDE_CONFIG_DIR"] ? resolve5(fromHome(env2["CLAUDE_CONFIG_DIR"], home)) : join11(home, ".claude"), "projects", name);
|
|
29740
29773
|
}
|
|
29741
29774
|
function pairOf(path, places) {
|
|
29742
29775
|
const old = inside2(places.oldAgents, path);
|
|
@@ -29785,7 +29818,7 @@ function moveOld(configPath2, log2, home = homedir8(), env2 = process.env) {
|
|
|
29785
29818
|
for (const key of ["folders", "folder"]) {
|
|
29786
29819
|
const said = config2[key];
|
|
29787
29820
|
if (typeof said !== "string") continue;
|
|
29788
|
-
const path =
|
|
29821
|
+
const path = resolve5(fromHome(said, home));
|
|
29789
29822
|
const moved = nowAt(path, places.oldAgents, places.agents);
|
|
29790
29823
|
if (moved === path) continue;
|
|
29791
29824
|
config2[key] = `~/${moved.slice(home.length + 1)}`;
|
|
@@ -29846,7 +29879,10 @@ if (!handsOver) moveOld(configTargetOf(words3[0]), log);
|
|
|
29846
29879
|
var configPath = configPathOf(words3[0]);
|
|
29847
29880
|
var kind;
|
|
29848
29881
|
try {
|
|
29849
|
-
kind =
|
|
29882
|
+
kind = readConfig(configPath);
|
|
29883
|
+
const makers = link === void 0 ? void 0 : makersFolder(kind);
|
|
29884
|
+
if (makers !== void 0) process.env["PATH"] = pathWithLast(process.env["PATH"], makers);
|
|
29885
|
+
kind = withFetchedAdapter(kind);
|
|
29850
29886
|
mkdirSync6(kind.folder ?? kind.folders, { recursive: true });
|
|
29851
29887
|
if (link !== void 0) {
|
|
29852
29888
|
reportStep("checking", { detail: `Looking for ${kind.name}` });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chipschat/acp",
|
|
3
|
-
"version": "1.0.
|
|
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": {
|