@chipschat/acp 1.0.11 → 1.0.13
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 +18 -7
- package/dist/THIRD-PARTY-NOTICES.md +3 -3
- package/dist/main.js +308 -59
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ bundles them into `dist/main.js`.
|
|
|
16
16
|
The card's line is `CHIPS_JOIN_LINK='<link>' chips connect claude-code` or `CHIPS_JOIN_LINK='<link>' chips connect codex` (Chips ADR 0218). It downloads this bridge as the npm package
|
|
17
17
|
`@chipschat/acp`, the newest 1.x, checks it against the registry's checksum, and runs it on the Node
|
|
18
18
|
that Chips carries, so the machine needs no Node or npm of its own. The bridge checks the agent's ACP adapter and its sign-in,
|
|
19
|
-
joins, and keeps itself running from login. `chips disconnect claude-code` or `chips disconnect codex` stops it. Claude Code and Codex share this one package: their cards hand it
|
|
19
|
+
joins, and keeps itself running from login. `chips disconnect claude-code` or `chips disconnect codex` stops it. Claude Code and Codex share this one package: their cards hand it `~/Chips/.bridges/acp/claude-code.json` or `codex.json`, and the file's name picks the kind. On another computer,
|
|
20
20
|
`curl -fsSL https://chipschat.ai/install | CHIPS_JOIN_LINK='<link>' sh -s -- connect claude-code` installs Chips there
|
|
21
21
|
first. The steps below run the bridge from this checkout instead, to work on it.
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ first. The steps below run the bridge from this checkout instead, to work on it.
|
|
|
25
25
|
```bash
|
|
26
26
|
npm install -g @agentclientprotocol/claude-agent-acp # or @agentclientprotocol/codex-acp
|
|
27
27
|
npm install
|
|
28
|
-
CHIPS_JOIN_LINK='<a join link made in Chips>' npm run keep
|
|
28
|
+
CHIPS_JOIN_LINK='<a join link made in Chips>' npm run keep ~/Chips/.bridges/acp/claude-code.json
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
`npm run keep` joins, then keeps the bridge running from login ("Keep it running", below);
|
|
@@ -35,7 +35,7 @@ The link comes from Chips's gallery (Agents → Connect a harness → Claude Cod
|
|
|
35
35
|
line with the link in it (`codex.json` for Codex) and starts the link with what it needs on:
|
|
36
36
|
`agents`, `new_spaces`, `new_agents`, `forks` and `restarts`. `claude-code.json` and `codex.json`
|
|
37
37
|
need not be there: without them the bridge runs Claude Code or Codex, in the mode that asks (see
|
|
38
|
-
"Asking a person"), with each agent's folder under `~/
|
|
38
|
+
"Asking a person"), with each agent's folder under `~/Chips/Agents/claude-code` or `~/Chips/Agents/codex`.
|
|
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;
|
|
@@ -49,25 +49,36 @@ room once, which the card waits for; a new link from Chips replaces the key it k
|
|
|
49
49
|
link, set `CHIPS_URL` and allow the code it prints from Chips. Its key is kept as `join()` keeps
|
|
50
50
|
one (the keychain, under the kind's name); its cursor, unanswered events, unended runs, its agents
|
|
51
51
|
and which session each of their rooms is are kept in a folder beside the config, named after it
|
|
52
|
-
(
|
|
52
|
+
(`~/Chips/.bridges/acp/claude-code/`), so a restart picks up where it was. Each start logs whether the
|
|
53
53
|
agent says it is signed in, and a turn it refuses for that says how to sign in.
|
|
54
54
|
|
|
55
55
|
The config names one kind:
|
|
56
56
|
|
|
57
57
|
```json
|
|
58
|
-
{ "name": "Claude Code", "command": ["claude-agent-acp"], "mode": "default", "folders": "~/
|
|
58
|
+
{ "name": "Claude Code", "command": ["claude-agent-acp"], "mode": "default", "folders": "~/Chips/Agents/claude-code" }
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
- `name` is the harness's name in Chips, and its own agent's.
|
|
62
62
|
- `command` is how the agent speaks ACP over stdio: `["claude-agent-acp"]`, `["codex-acp"]`,
|
|
63
63
|
`["goose", "acp"]`, `["gemini", "--acp"]`, `["opencode", "acp"]`.
|
|
64
|
-
- `folders` is where each agent gets a folder of its own, named after it (`~/
|
|
64
|
+
- `folders` is where each agent gets a folder of its own, named after it (`~/Chips/Agents/claude-code/nova`),
|
|
65
65
|
made empty. A copy from Fork works on in its original's folder, with the files the conversation it
|
|
66
66
|
remembers expects. A deleted agent's folder stays.
|
|
67
67
|
- `folder`, in its place, puts every agent in one folder: a repository they work on together.
|
|
68
68
|
- `mode` is the mode its sessions are put in, of those the agent offers (see below). `env` adds to
|
|
69
69
|
its environment.
|
|
70
70
|
|
|
71
|
+
Everything it keeps is under `~/Chips` (Chips ADR 0283): the configs and what each kind keeps in
|
|
72
|
+
`~/Chips/.bridges/acp`, the agents' folders in `~/Chips/Agents`. Until 1.0.13 they were
|
|
73
|
+
`~/.chips-acp` and `~/chips-acp`. A kind moves what it had there the first time 1.0.13 starts: its
|
|
74
|
+
config and what it keeps, its agents' folders (where its config named the old place, or nothing),
|
|
75
|
+
the folder paths it saved, and Claude Code's own store for each folder that moved
|
|
76
|
+
(`~/.claude/projects/<the folder's path, dashed>`), which holds the folder's conversations and memory.
|
|
77
|
+
It renames and never copies; where something is at the new place already it moves in what isn't
|
|
78
|
+
there yet and says in its log what it left. A config path in the old place, from an older Chips's
|
|
79
|
+
card or a login item kept before, is read in the new one, and the login item is kept with the new
|
|
80
|
+
path.
|
|
81
|
+
|
|
71
82
|
Installing any other agent and signing it in to a model is done the agent's own way, before it is
|
|
72
83
|
named here. A second kind is a second config, and a second bridge beside the first.
|
|
73
84
|
|
|
@@ -167,7 +178,7 @@ where the harness is granted `context_files`, `models` and `context_windows`.
|
|
|
167
178
|
| Chips | Claude Code | Codex | Another kind |
|
|
168
179
|
|---|---|---|---|
|
|
169
180
|
| Context: its own files | its folder's `CLAUDE.md`, and `CLAUDE.local.md`, `.claude/CLAUDE.md` and `.claude/rules/*.md` where they are; its memory, `~/.claude/projects/<its folder>/memory/MEMORY.md`, which Claude Code writes too. A person may change each, and one not there yet shows empty | its folder's `AGENTS.override.md`, else its `AGENTS.md`; a person may change it | none |
|
|
170
|
-
| Context: shared | `~/
|
|
181
|
+
| Context: shared | `~/Chips/Agents/claude-code/CLAUDE.md`, read by every agent, changed on the harness's page; files above the agents' folders and `~/.claude/CLAUDE.md`, shown and not changed, since they aren't only these agents' | `~/.codex/AGENTS.override.md`, else `~/.codex/AGENTS.md`, shown and not changed | none |
|
|
171
182
|
| When it reads them | when a session starts; an edit closes the agent's sessions before its next turn and loads them again, so it applies from the next message | the same | |
|
|
172
183
|
| Context window | `usage_update` of the agent's session that said last; the window from the update that ends a turn (it carries the cost), as one before may be a default | `usage_update` | `usage_update` |
|
|
173
184
|
| Compact now | `/compact` said to that session as a turn of its own, after any turn going there; its words go nowhere; from and to from its tool call's `rawOutput` | the same; to from the `usage_update` it sends as it finishes | where it lists `compact` among its commands |
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Third-party notices
|
|
2
2
|
|
|
3
|
-
`dist/main.js` in @chipschat/acp 1.0.
|
|
3
|
+
`dist/main.js` in @chipschat/acp 1.0.13 carries these packages, bundled in. Each one's
|
|
4
4
|
licence follows.
|
|
5
5
|
|
|
6
|
-
## @chipschat/harness 1.0.
|
|
6
|
+
## @chipschat/harness 1.0.2 (Apache-2.0)
|
|
7
7
|
|
|
8
8
|
Apache License
|
|
9
9
|
Version 2.0, January 2004
|
|
@@ -207,7 +207,7 @@ Apache License
|
|
|
207
207
|
See the License for the specific language governing permissions and
|
|
208
208
|
limitations under the License.
|
|
209
209
|
|
|
210
|
-
## @chipschat/protocol 1.0.
|
|
210
|
+
## @chipschat/protocol 1.0.2 (Apache-2.0)
|
|
211
211
|
|
|
212
212
|
Apache License
|
|
213
213
|
Version 2.0, January 2004
|
package/dist/main.js
CHANGED
|
@@ -8,9 +8,8 @@ var __export = (target, all) => {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
// src/main.ts
|
|
11
|
-
import { existsSync as
|
|
12
|
-
import {
|
|
13
|
-
import { basename as basename5, dirname as dirname5, join as join10, resolve as resolve4 } from "node:path";
|
|
11
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync5, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "node:fs";
|
|
12
|
+
import { basename as basename6, dirname as dirname6, join as join11 } from "node:path";
|
|
14
13
|
|
|
15
14
|
// node_modules/zod/v4/classic/external.js
|
|
16
15
|
var external_exports = {};
|
|
@@ -5106,7 +5105,7 @@ function isRecursive(inst, stack, resolve5) {
|
|
|
5106
5105
|
}
|
|
5107
5106
|
return answer;
|
|
5108
5107
|
};
|
|
5109
|
-
const
|
|
5108
|
+
const merge3 = (answer) => {
|
|
5110
5109
|
if (answer > result)
|
|
5111
5110
|
result = answer;
|
|
5112
5111
|
};
|
|
@@ -5115,7 +5114,7 @@ function isRecursive(inst, stack, resolve5) {
|
|
|
5115
5114
|
switch (kind2) {
|
|
5116
5115
|
case "object": {
|
|
5117
5116
|
const raw = rawShape(def);
|
|
5118
|
-
|
|
5117
|
+
merge3(raw ? shape(raw, true) : ASSUMED);
|
|
5119
5118
|
check2(def.catchall);
|
|
5120
5119
|
break;
|
|
5121
5120
|
}
|
|
@@ -5165,7 +5164,7 @@ function isRecursive(inst, stack, resolve5) {
|
|
|
5165
5164
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
5166
5165
|
case "lazy": {
|
|
5167
5166
|
const inner = def._cachedInner ?? (resolve5 ? inst._zod.innerType : void 0);
|
|
5168
|
-
|
|
5167
|
+
merge3(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
5169
5168
|
break;
|
|
5170
5169
|
}
|
|
5171
5170
|
// a leaf by choice: `parts` are regex fragments, not data positions
|
|
@@ -20526,7 +20525,7 @@ var contextLine = external_exports.object({
|
|
|
20526
20525
|
}).describe("One line of a room: something said, or something that happened to who is in it.");
|
|
20527
20526
|
var roomContext = external_exports.object({
|
|
20528
20527
|
lines: external_exports.array(contextLine).max(CONTEXT_CEILING.lines).describe("Oldest first, the newest that fit the budget."),
|
|
20529
|
-
since_seq: external_exports.int().nonnegative().describe("Where they start: after this `seq`. With a message, where the
|
|
20528
|
+
since_seq: external_exports.int().nonnegative().describe("Where they start: after this `seq`. With a message, where the harness's own last turn in the room began, one that said something or passed with NO_REPLY (ADR 0105), else its joining; from the pull route, 0."),
|
|
20530
20529
|
truncated: external_exports.boolean().describe("Whether older lines after `since_seq` were left out to fit the budget."),
|
|
20531
20530
|
before: external_exports.int().positive().describe("A cursor: `GET /v1/spaces/:id/context?before=` this reads what came before these lines."),
|
|
20532
20531
|
files: roomFiles.max(ROOM_FILES_IN_CONTEXT).optional().describe("The room's files at their current version, newest first, the 20 newest (ADR 0099): with a message, as of it, its own files included; from the pull route, as of now. Each with a URL for this harness. Absent from a Chips before files, and when the room has none."),
|
|
@@ -21674,6 +21673,7 @@ var pairingPayload = external_exports.object({
|
|
|
21674
21673
|
var JOIN_POLL_SECONDS = 3;
|
|
21675
21674
|
var joinKind = external_exports.enum(["harness", "device", "invite", "pairing"]).describe("A harness asking for a key; a device asking to be paired; a person joining by an invite, or a device pairing by a code, that waits for whoever handed it out (ADR 0232).");
|
|
21676
21675
|
var keyCode = external_exports.string().regex(/^[0-9]{6}$/, "six digits");
|
|
21676
|
+
var joinNonce = external_exports.string().regex(/^[A-Za-z0-9_-]{43}$/, "32 bytes, base64url");
|
|
21677
21677
|
var requestCode = external_exports.union([pairingCode, keyCode]);
|
|
21678
21678
|
var joinState = external_exports.enum(["waiting", "allowed", "denied", "expired", "redeemed"]).describe("`waiting` for a person; `allowed`, and not yet collected; `denied` by a person, or withdrawn; `expired` before it was collected; `redeemed`, which spends it.");
|
|
21679
21679
|
var joinStartedBy = external_exports.enum(["requester", "person"]).describe("Who started it: the requester, with a code to compare, or a person, with a link that is allowed already.");
|
|
@@ -21709,12 +21709,15 @@ var joinAsk = external_exports.object({
|
|
|
21709
21709
|
software: words2(120).optional(),
|
|
21710
21710
|
machine: words2(120).optional(),
|
|
21711
21711
|
wants: capabilities.optional().describe("For a harness: what it asks to be allowed."),
|
|
21712
|
-
public_key: external_exports.string().regex(/^[A-Za-z0-9+/]{40,64}={0,2}$/).optional().describe("For a device: the public half of its Ed25519 key, SPKI DER, base64.")
|
|
21712
|
+
public_key: external_exports.string().regex(/^[A-Za-z0-9+/]{40,64}={0,2}$/).optional().describe("For a device: the public half of its Ed25519 key, SPKI DER, base64."),
|
|
21713
|
+
commit: joinNonce.optional().describe("For a device (S-1, ADR 0278): the SHA-256 of `joinCommitText` of a nonce it keeps, base64url. It sends the nonce with its first poll, once it holds the server's, and both ends work the code out.")
|
|
21713
21714
|
}).describe("A request to join.");
|
|
21714
21715
|
var joinAsked = external_exports.object({
|
|
21715
21716
|
request_id: id("join"),
|
|
21716
21717
|
secret: external_exports.string().min(16).max(200).describe("The requester's alone: it polls with it."),
|
|
21717
|
-
code: requestCode,
|
|
21718
|
+
code: requestCode.optional().describe("The code to show. Absent for a device that sent `commit`: it works its own out."),
|
|
21719
|
+
server_key: external_exports.string().min(1).max(128).optional().describe("For a device that sent `commit`: the server's tunnel key, which the code is worked out from and the device pins once it is allowed (ADR 0191, 0278)."),
|
|
21720
|
+
nonce: joinNonce.optional().describe("For a device that sent `commit`: the server's nonce, for the code (ADR 0278)."),
|
|
21718
21721
|
expires_in: external_exports.int().positive().describe("Seconds until it expires."),
|
|
21719
21722
|
interval: external_exports.int().positive().describe("Seconds between polls.")
|
|
21720
21723
|
});
|
|
@@ -22646,6 +22649,17 @@ var jobChangeFrame = external_exports.object({
|
|
|
22646
22649
|
asked_at: isoTimestamp
|
|
22647
22650
|
}).describe("A person switched one of a harness's own jobs, or changed how often it runs (ADR 0252). Sent to a harness's socket that said `jobs` in its `hello`, now or never: it is not in the log. The harness answers with its copy of all its jobs, `answers` or `refuses` naming `change_id`.");
|
|
22648
22651
|
|
|
22652
|
+
// node_modules/@chipschat/protocol/dist/src/read-marks.js
|
|
22653
|
+
var READ_MARKS_MAX = 1e3;
|
|
22654
|
+
var readMarks = external_exports.record(id("space"), external_exports.int().nonnegative().describe("The `seq` the room is read up to.")).refine((marks) => Object.keys(marks).length <= READ_MARKS_MAX, {
|
|
22655
|
+
message: `at most ${READ_MARKS_MAX} rooms`
|
|
22656
|
+
}).describe("How far each room is read, by room id.");
|
|
22657
|
+
var readMarksBody = external_exports.object({ spaces: readMarks });
|
|
22658
|
+
var readFrame = external_exports.object({
|
|
22659
|
+
frame: external_exports.literal("read"),
|
|
22660
|
+
spaces: readMarks.describe("The rooms whose marks moved, and where to.")
|
|
22661
|
+
}).describe("A person read further in some rooms, on one of their devices (ADR 0262). Sent to that person's sockets that said `reads` in their `hello`, never to anyone else's, now or never: `GET /v1/me/read` reads them again.");
|
|
22662
|
+
|
|
22649
22663
|
// node_modules/@chipschat/protocol/dist/src/frames.js
|
|
22650
22664
|
var clientHelloFrame = external_exports.object({
|
|
22651
22665
|
frame: external_exports.literal("hello"),
|
|
@@ -22662,7 +22676,7 @@ var clientHelloFrame = external_exports.object({
|
|
|
22662
22676
|
autonomy: autonomyLevel.optional().describe("The level the harness believes it has.")
|
|
22663
22677
|
})).max(64).optional().describe("Not read by Chips: a connection is its token's, and the server's `hello` names the token's harness and its agents (ADR 0087). Absent for a person's client."),
|
|
22664
22678
|
since: external_exports.int().nonnegative().optional().describe("Not read by Chips: a stream resumes from `subscribe`'s `since`."),
|
|
22665
|
-
accepts: external_exports.array(external_exports.string().min(1).max(40)).max(32).optional().describe("Server frames beyond the base set this client understands, by the names in `SERVER_EXTENSIONS`. A name the server does not know is ignored rather than refused, so a client may name a frame a newer server sends and still be answered by an older one (ADR 0211, Phase 3). A client that says `events` is sent its replay in pages rather than one frame per event; one that says `presence` is sent an agent's state as it changes (ADR 0083); a harness's socket that says `restart` is sent `restart` when a person asks it to restart (ADR 0094); an owner's or admin's that says `join` is sent each join request as it changes (ADR 0122); a harness's that says `context` is sent `context.edit` when a person changes one of its context files (ADR 0134); a harness's that says `models` is sent `model.change` when a person changes an agent's model or effort (ADR 0140); a harness's that says `heartbeats` is sent `heartbeat.change` when a person switches an agent's heartbeat or changes how often it beats (ADR 0143); a harness's that says `context_windows` is sent `context_window.compact` and `context_window.change` when a person asks an agent to compact now or changes the limit it compacts itself at (ADR 0146); a harness's that says `jobs` is sent `job.change` when a person switches one of the jobs it runs on its own (ADR 0252); a person's that says `folders` is sent `folder.open` when they ask, from another of their devices, for a room's folder to be opened in Finder (ADR 0225), and `folder.run` when they ask for its project to be run or stopped there (ADR 0226); a person's that says `folder_runs` is sent `folder.run_state` when their Mac says how a run of theirs stands (ADR 0226); one that says nothing is sent what it was always sent, since an unknown frame is dropped in silence."),
|
|
22679
|
+
accepts: external_exports.array(external_exports.string().min(1).max(40)).max(32).optional().describe("Server frames beyond the base set this client understands, by the names in `SERVER_EXTENSIONS`. A name the server does not know is ignored rather than refused, so a client may name a frame a newer server sends and still be answered by an older one (ADR 0211, Phase 3). A client that says `events` is sent its replay in pages rather than one frame per event; one that says `presence` is sent an agent's state as it changes (ADR 0083); a harness's socket that says `restart` is sent `restart` when a person asks it to restart (ADR 0094); an owner's or admin's that says `join` is sent each join request as it changes (ADR 0122); a harness's that says `context` is sent `context.edit` when a person changes one of its context files (ADR 0134); a harness's that says `models` is sent `model.change` when a person changes an agent's model or effort (ADR 0140); a harness's that says `heartbeats` is sent `heartbeat.change` when a person switches an agent's heartbeat or changes how often it beats (ADR 0143); a harness's that says `context_windows` is sent `context_window.compact` and `context_window.change` when a person asks an agent to compact now or changes the limit it compacts itself at (ADR 0146); a harness's that says `jobs` is sent `job.change` when a person switches one of the jobs it runs on its own (ADR 0252); a person's that says `folders` is sent `folder.open` when they ask, from another of their devices, for a room's folder to be opened in Finder (ADR 0225), and `folder.run` when they ask for its project to be run or stopped there (ADR 0226); a person's that says `folder_runs` is sent `folder.run_state` when their Mac says how a run of theirs stands (ADR 0226); a person's that says `reads` is sent `read` when they read further on another of their devices (ADR 0262); one that says nothing is sent what it was always sent, since an unknown frame is dropped in silence."),
|
|
22666
22680
|
context: contextBudget.optional().describe("How much of a room a harness is handed with each message for it (ADR 0088): 40 lines and 16,000 characters when absent, 200 and 32,000 at most. For this connection. A person's client is handed none.")
|
|
22667
22681
|
}).describe("The first frame a client sends.");
|
|
22668
22682
|
var subscribeFrame = external_exports.object({
|
|
@@ -22788,6 +22802,7 @@ var serverFrame = external_exports.discriminatedUnion("frame", [
|
|
|
22788
22802
|
folderOpenFrame,
|
|
22789
22803
|
folderRunFrame,
|
|
22790
22804
|
folderRunStateFrame,
|
|
22805
|
+
readFrame,
|
|
22791
22806
|
contextEditFrame,
|
|
22792
22807
|
modelChangeFrame,
|
|
22793
22808
|
heartbeatChangeFrame,
|
|
@@ -22839,9 +22854,37 @@ var HTML_POLICY = "default-src 'none'; img-src data: blob:; font-src data:; medi
|
|
|
22839
22854
|
var PAGE_SANDBOX = "allow-scripts allow-popups allow-popups-to-escape-sandbox";
|
|
22840
22855
|
var PAGE_HEADER_POLICY = `${HTML_POLICY}; sandbox ${PAGE_SANDBOX}`;
|
|
22841
22856
|
|
|
22842
|
-
// node_modules/@chipschat/
|
|
22843
|
-
|
|
22844
|
-
|
|
22857
|
+
// node_modules/@chipschat/protocol/dist/src/push.js
|
|
22858
|
+
var PUSH_WORDS = {
|
|
22859
|
+
/** An ask of an agent's that waits on a person (ADR 0045). */
|
|
22860
|
+
decision: {
|
|
22861
|
+
title: "A decision is waiting",
|
|
22862
|
+
body: "Approve or deny from here.",
|
|
22863
|
+
categoryId: "decision"
|
|
22864
|
+
},
|
|
22865
|
+
/** A message that @s the person, or was sent to them (ADR 0158). */
|
|
22866
|
+
messageForYou: { title: "A message for you", body: "Open Chips to read it." },
|
|
22867
|
+
/** A message in a room they hear (ADR 0158). */
|
|
22868
|
+
message: { title: "A new message", body: "Open Chips to read it." },
|
|
22869
|
+
/** A join request for its maker or an owner (ADR 0122). */
|
|
22870
|
+
join: { title: "Something asks to join", body: "Check its code, then allow it or not." },
|
|
22871
|
+
/** The referee paused agents talking among themselves (ADR 0097). */
|
|
22872
|
+
held: { title: "Chips paused the agents", body: "Open the space to let them carry on." },
|
|
22873
|
+
warning: { title: "The agents need a look", body: "They have been talking among themselves." },
|
|
22874
|
+
/** A guest's ask to go direct, and its answers (ADR 0211). */
|
|
22875
|
+
directAsked: {
|
|
22876
|
+
title: "A guest wants to connect directly",
|
|
22877
|
+
body: "Share your server with them in Tailscale."
|
|
22878
|
+
},
|
|
22879
|
+
directShared: { title: "Your server is shared with you", body: "Open Chips to go direct." },
|
|
22880
|
+
directDone: {
|
|
22881
|
+
title: "Connected directly",
|
|
22882
|
+
body: "A guest you shared your server with is direct now."
|
|
22883
|
+
},
|
|
22884
|
+
/** An owner is turning the relay off (ADR 0211, Phase 4). */
|
|
22885
|
+
relayOff: { title: "The relay is going off", body: "Go direct to keep reaching the server." }
|
|
22886
|
+
};
|
|
22887
|
+
var KNOWN = new Set(Object.values(PUSH_WORDS).map((words4) => JSON.stringify([words4.title, words4.body, "categoryId" in words4 ? words4.categoryId : null])));
|
|
22845
22888
|
|
|
22846
22889
|
// node_modules/@chipschat/harness/dist/asks.js
|
|
22847
22890
|
var Asks = class {
|
|
@@ -22876,10 +22919,7 @@ var Asks = class {
|
|
|
22876
22919
|
const from = event["from"];
|
|
22877
22920
|
if (!this.listener.listening() || from?.kind !== "person")
|
|
22878
22921
|
return false;
|
|
22879
|
-
this.hand(spaceId, room, {
|
|
22880
|
-
messageId: String(event["message_id"]),
|
|
22881
|
-
text: String(event["text"] ?? "")
|
|
22882
|
-
});
|
|
22922
|
+
this.hand(spaceId, room, { messageId: String(event["message_id"]), text: String(event["text"] ?? "") }, event);
|
|
22883
22923
|
return true;
|
|
22884
22924
|
}
|
|
22885
22925
|
/**
|
|
@@ -22915,11 +22955,42 @@ var Asks = class {
|
|
|
22915
22955
|
this.rooms.set(spaceId, room);
|
|
22916
22956
|
return room;
|
|
22917
22957
|
}
|
|
22918
|
-
hand(spaceId, room, first) {
|
|
22958
|
+
hand(spaceId, room, first, message) {
|
|
22919
22959
|
room.first = first.messageId;
|
|
22920
|
-
this.listener.hand({
|
|
22960
|
+
this.listener.hand({
|
|
22961
|
+
spaceId,
|
|
22962
|
+
askedBy: room.askedBy,
|
|
22963
|
+
firstMessage: first,
|
|
22964
|
+
...message === void 0 ? {} : { message }
|
|
22965
|
+
});
|
|
22921
22966
|
}
|
|
22922
22967
|
};
|
|
22968
|
+
function firstTurnOf(asked, agentId2) {
|
|
22969
|
+
const { message } = asked;
|
|
22970
|
+
if (message === void 0)
|
|
22971
|
+
return void 0;
|
|
22972
|
+
const room = message.room;
|
|
22973
|
+
const notes = room?.notes ?? {};
|
|
22974
|
+
const [place, ...more] = Object.keys(notes);
|
|
22975
|
+
if (room === void 0 || place === void 0 || more.length > 0) {
|
|
22976
|
+
return { ...message, for: [agentId2] };
|
|
22977
|
+
}
|
|
22978
|
+
const placed = (each) => each.participant_id === place ? { ...each, participant_id: agentId2 } : each;
|
|
22979
|
+
const note = notes[place];
|
|
22980
|
+
const rules = room.rules?.[place];
|
|
22981
|
+
return {
|
|
22982
|
+
...message,
|
|
22983
|
+
for: [agentId2],
|
|
22984
|
+
room: {
|
|
22985
|
+
...room,
|
|
22986
|
+
members: room.members.map(placed),
|
|
22987
|
+
notes: note === void 0 ? {} : { [agentId2]: note },
|
|
22988
|
+
...room.rules === void 0 ? {} : { rules: rules === void 0 ? {} : { [agentId2]: rules } },
|
|
22989
|
+
...room.working === void 0 ? {} : { working: room.working.map(placed) },
|
|
22990
|
+
...room.idle === void 0 ? {} : { idle: room.idle.map(placed) }
|
|
22991
|
+
}
|
|
22992
|
+
};
|
|
22993
|
+
}
|
|
22923
22994
|
function firstWords(history) {
|
|
22924
22995
|
for (const event of history) {
|
|
22925
22996
|
const actor2 = event["actor"];
|
|
@@ -22930,6 +23001,10 @@ function firstWords(history) {
|
|
|
22930
23001
|
return void 0;
|
|
22931
23002
|
}
|
|
22932
23003
|
|
|
23004
|
+
// node_modules/@chipschat/harness/dist/connect.js
|
|
23005
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
23006
|
+
import { basename } from "node:path";
|
|
23007
|
+
|
|
22933
23008
|
// node_modules/@chipschat/harness/dist/events.js
|
|
22934
23009
|
var Emitter = class {
|
|
22935
23010
|
handlers = /* @__PURE__ */ new Map();
|
|
@@ -23321,8 +23396,8 @@ var Project = class {
|
|
|
23321
23396
|
const end2 = all.findIndex((line, at) => at > start && line.startsWith(">>>>>>> "));
|
|
23322
23397
|
if (start < 0 || end2 < 0)
|
|
23323
23398
|
return void 0;
|
|
23324
|
-
const
|
|
23325
|
-
return
|
|
23399
|
+
const shown2 = all.slice(Math.max(0, start - 1), end2 + 2);
|
|
23400
|
+
return shown2.length <= MARKED_LINES ? shown2.join("\n") : [...shown2.slice(0, MARKED_LINES - 1), "\u2026"].join("\n");
|
|
23326
23401
|
} catch {
|
|
23327
23402
|
return void 0;
|
|
23328
23403
|
}
|
|
@@ -25227,7 +25302,7 @@ async function ask(url2, options, send, machine) {
|
|
|
25227
25302
|
if (asked.status !== 201)
|
|
25228
25303
|
throw await refused(asked);
|
|
25229
25304
|
const { request_id, secret, code, interval } = await asked.json();
|
|
25230
|
-
const show = options.onCode ?? ((
|
|
25305
|
+
const show = options.onCode ?? ((shown2, where) => process.stderr.write(`Allow ${options.name} in Chips at ${where}. Its code is ${shown2}.
|
|
25231
25306
|
`));
|
|
25232
25307
|
show(code, url2);
|
|
25233
25308
|
for (; ; ) {
|
|
@@ -26086,11 +26161,11 @@ import { createHash as createHash2 } from "node:crypto";
|
|
|
26086
26161
|
import { readdirSync, readFileSync as readFileSync6, statSync } from "node:fs";
|
|
26087
26162
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
26088
26163
|
import { dirname as dirname4, join as join6, parse as parse3, relative, sep as sep2 } from "node:path";
|
|
26089
|
-
function placesOf(env2,
|
|
26164
|
+
function placesOf(env2, home) {
|
|
26090
26165
|
return {
|
|
26091
|
-
home
|
|
26092
|
-
claudeHome: env2["CLAUDE_CONFIG_DIR"] || join6(
|
|
26093
|
-
codexHome: env2["CODEX_HOME"] || join6(
|
|
26166
|
+
home,
|
|
26167
|
+
claudeHome: env2["CLAUDE_CONFIG_DIR"] || join6(home, ".claude"),
|
|
26168
|
+
codexHome: env2["CODEX_HOME"] || join6(home, ".codex")
|
|
26094
26169
|
};
|
|
26095
26170
|
}
|
|
26096
26171
|
function hashOf(text) {
|
|
@@ -26152,15 +26227,15 @@ var ContextFiles = class {
|
|
|
26152
26227
|
kind;
|
|
26153
26228
|
places;
|
|
26154
26229
|
docBytes;
|
|
26155
|
-
/** `~/
|
|
26230
|
+
/** `~/Chips/Agents/claude-code/CLAUDE.md`, or the whole path where it isn't in the home. */
|
|
26156
26231
|
tilde(path) {
|
|
26157
|
-
const { home
|
|
26158
|
-
return within(path,
|
|
26232
|
+
const { home } = this.places;
|
|
26233
|
+
return within(path, home) ? `~${path.slice(home.length)}` : path;
|
|
26159
26234
|
}
|
|
26160
26235
|
/** A shared file's name: where it is, a step at a time (`~ › .codex › AGENTS.md`), with no slash. */
|
|
26161
26236
|
crumbs(path) {
|
|
26162
|
-
const { home
|
|
26163
|
-
const steps = within(path,
|
|
26237
|
+
const { home } = this.places;
|
|
26238
|
+
const steps = within(path, home) ? ["~", ...relative(home, path).split(sep2)] : ["/", ...path.split(sep2)];
|
|
26164
26239
|
return steps.filter((step) => step !== "").join(" \u203A ").slice(0, 255);
|
|
26165
26240
|
}
|
|
26166
26241
|
/** The harness's own set: what every agent, or every agent below a folder, reads beside its own. */
|
|
@@ -26379,7 +26454,7 @@ var ContextFiles = class {
|
|
|
26379
26454
|
};
|
|
26380
26455
|
|
|
26381
26456
|
// src/kinds.ts
|
|
26382
|
-
var
|
|
26457
|
+
var KNOWN2 = [
|
|
26383
26458
|
{
|
|
26384
26459
|
id: "claude-code",
|
|
26385
26460
|
name: "Claude Code",
|
|
@@ -26402,12 +26477,12 @@ var KNOWN = [
|
|
|
26402
26477
|
}
|
|
26403
26478
|
];
|
|
26404
26479
|
function knownConfig(id2) {
|
|
26405
|
-
const known =
|
|
26480
|
+
const known = KNOWN2.find((each) => each.id === id2);
|
|
26406
26481
|
return known === void 0 ? void 0 : { name: known.name, command: [known.program], mode: known.mode };
|
|
26407
26482
|
}
|
|
26408
26483
|
var knownBy = (kind2) => {
|
|
26409
26484
|
const program = kind2.command[0]?.split("/").pop();
|
|
26410
|
-
return
|
|
26485
|
+
return KNOWN2.find((each) => each.program === program);
|
|
26411
26486
|
};
|
|
26412
26487
|
function knownIdOf(kind2) {
|
|
26413
26488
|
return knownBy(kind2)?.id;
|
|
@@ -26954,7 +27029,7 @@ var Bridge = class {
|
|
|
26954
27029
|
return made;
|
|
26955
27030
|
});
|
|
26956
27031
|
this.log(`${agent.name} claimed ${spaceId}, in ${record2.folder}`);
|
|
26957
|
-
const message = {
|
|
27032
|
+
const message = firstTurnOf(asked, agent.agentId) ?? {
|
|
26958
27033
|
type: "message.new",
|
|
26959
27034
|
space_id: spaceId,
|
|
26960
27035
|
message_id: firstMessage.messageId,
|
|
@@ -28264,12 +28339,54 @@ function forkName(original) {
|
|
|
28264
28339
|
}
|
|
28265
28340
|
|
|
28266
28341
|
// src/keep.ts
|
|
28267
|
-
import {
|
|
28268
|
-
import { basename as basename3, join as join8, resolve as resolve2 } from "node:path";
|
|
28342
|
+
import { basename as basename3 } from "node:path";
|
|
28269
28343
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
28344
|
+
|
|
28345
|
+
// src/places.ts
|
|
28346
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
28347
|
+
import { homedir as homedir5 } from "node:os";
|
|
28348
|
+
import { isAbsolute as isAbsolute2, join as join8, relative as relative2, resolve as resolve2, sep as sep3 } from "node:path";
|
|
28349
|
+
function placesOf2(home = homedir5()) {
|
|
28350
|
+
return {
|
|
28351
|
+
settings: join8(home, "Chips", ".bridges", "acp"),
|
|
28352
|
+
agents: join8(home, "Chips", "Agents"),
|
|
28353
|
+
oldSettings: join8(home, ".chips-acp"),
|
|
28354
|
+
oldAgents: join8(home, "chips-acp")
|
|
28355
|
+
};
|
|
28356
|
+
}
|
|
28357
|
+
var fromHome = (path, home = homedir5()) => path === "~" ? home : path.startsWith("~/") ? join8(home, path.slice(2)) : path;
|
|
28358
|
+
function inside2(root, path) {
|
|
28359
|
+
const under = relative2(root, path);
|
|
28360
|
+
return under === "" || under === ".." || under.startsWith(`..${sep3}`) || isAbsolute2(under) ? void 0 : under;
|
|
28361
|
+
}
|
|
28362
|
+
function nowAt(path, before, after) {
|
|
28363
|
+
const under = inside2(before, path);
|
|
28364
|
+
if (under === void 0) return path;
|
|
28365
|
+
const moved = join8(after, under);
|
|
28366
|
+
return existsSync7(path) && !existsSync7(moved) ? path : moved;
|
|
28367
|
+
}
|
|
28368
|
+
function configTargetOf(word, home = homedir5()) {
|
|
28369
|
+
const places = placesOf2(home);
|
|
28370
|
+
const path = resolve2(fromHome(word ?? join8(places.settings, "config.json"), home));
|
|
28371
|
+
const under = inside2(places.oldSettings, path);
|
|
28372
|
+
return under === void 0 ? path : join8(places.settings, under);
|
|
28373
|
+
}
|
|
28374
|
+
function configPathOf(word, home = homedir5()) {
|
|
28375
|
+
const places = placesOf2(home);
|
|
28376
|
+
const target = configTargetOf(word, home);
|
|
28377
|
+
const under = inside2(places.settings, target);
|
|
28378
|
+
const old = under === void 0 ? void 0 : join8(places.oldSettings, under);
|
|
28379
|
+
return old !== void 0 && existsSync7(old) && !existsSync7(target) ? old : target;
|
|
28380
|
+
}
|
|
28381
|
+
function foldersPathOf(path, home = homedir5()) {
|
|
28382
|
+
const places = placesOf2(home);
|
|
28383
|
+
return nowAt(resolve2(fromHome(path, home)), places.oldAgents, places.agents);
|
|
28384
|
+
}
|
|
28385
|
+
|
|
28386
|
+
// src/keep.ts
|
|
28270
28387
|
var flags = process.argv.slice(2);
|
|
28271
28388
|
var words3 = flags.filter((word) => !word.startsWith("--"));
|
|
28272
|
-
var whole = (word) =>
|
|
28389
|
+
var whole = (word) => configPathOf(word);
|
|
28273
28390
|
var here = fileURLToPath2(new URL("..", import.meta.url)).replace(/\/$/, "");
|
|
28274
28391
|
var self = fileURLToPath2(import.meta.url);
|
|
28275
28392
|
var run = self.endsWith(".js") ? [self] : ["--import", "tsx", "src/main.ts"];
|
|
@@ -28314,10 +28431,14 @@ function keepIfAsked(label2, url2, names, log2, before = () => void 0) {
|
|
|
28314
28431
|
);
|
|
28315
28432
|
}
|
|
28316
28433
|
|
|
28317
|
-
// src/
|
|
28318
|
-
import {
|
|
28434
|
+
// src/move.ts
|
|
28435
|
+
import { lstatSync, mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as readFileSync9, renameSync as renameSync2, rmdirSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
28319
28436
|
import { homedir as homedir6 } from "node:os";
|
|
28320
|
-
import { basename as
|
|
28437
|
+
import { basename as basename5, dirname as dirname5, join as join10, resolve as resolve4 } from "node:path";
|
|
28438
|
+
|
|
28439
|
+
// src/setup.ts
|
|
28440
|
+
import { accessSync as accessSync2, constants as constants2, existsSync as existsSync8, readFileSync as readFileSync8 } from "node:fs";
|
|
28441
|
+
import { basename as basename4, delimiter as delimiter2, isAbsolute as isAbsolute3, join as join9, resolve as resolve3 } from "node:path";
|
|
28321
28442
|
var SetupError = class extends Error {
|
|
28322
28443
|
constructor(message, words4 = {}) {
|
|
28323
28444
|
super(message);
|
|
@@ -28327,16 +28448,15 @@ var SetupError = class extends Error {
|
|
|
28327
28448
|
name = "SetupError";
|
|
28328
28449
|
};
|
|
28329
28450
|
var STILL_GOOD = "The link is still good: run the same command again once that's done.";
|
|
28330
|
-
var EXAMPLE = '{ "name": "Claude Code", "command": ["claude-agent-acp"], "folders": "~/
|
|
28331
|
-
var home = (path) => path.startsWith("~/") ? join9(homedir6(), path.slice(2)) : path;
|
|
28451
|
+
var EXAMPLE = '{ "name": "Claude Code", "command": ["claude-agent-acp"], "folders": "~/Chips/Agents/claude-code" }';
|
|
28332
28452
|
function readConfig(path) {
|
|
28333
28453
|
const known = knownConfig(basename4(path, ".json"));
|
|
28334
|
-
if (!
|
|
28454
|
+
if (!existsSync8(path) && known === void 0) {
|
|
28335
28455
|
throw new SetupError(
|
|
28336
28456
|
`There is no config at ${path}. Write ${EXAMPLE} there, or name claude-code.json or codex.json, which need none. ${STILL_GOOD}`
|
|
28337
28457
|
);
|
|
28338
28458
|
}
|
|
28339
|
-
const raw =
|
|
28459
|
+
const raw = existsSync8(path) ? JSON.parse(readFileSync8(path, "utf8")) : known;
|
|
28340
28460
|
const name = raw["name"];
|
|
28341
28461
|
const command = raw["command"];
|
|
28342
28462
|
if (typeof name !== "string" || name.trim() === "" || !Array.isArray(command) || command.length === 0) {
|
|
@@ -28346,8 +28466,8 @@ function readConfig(path) {
|
|
|
28346
28466
|
return {
|
|
28347
28467
|
name,
|
|
28348
28468
|
command: command.map(String),
|
|
28349
|
-
folders:
|
|
28350
|
-
...typeof raw["folder"] === "string" ? { folder:
|
|
28469
|
+
folders: foldersPathOf(typeof raw["folders"] === "string" ? raw["folders"] : `~/Chips/Agents/${slug}`),
|
|
28470
|
+
...typeof raw["folder"] === "string" ? { folder: foldersPathOf(raw["folder"]) } : {},
|
|
28351
28471
|
...typeof raw["mode"] === "string" ? { mode: raw["mode"] } : {},
|
|
28352
28472
|
...typeof raw["env"] === "object" && raw["env"] !== null ? { env: raw["env"] } : {}
|
|
28353
28473
|
};
|
|
@@ -28364,7 +28484,7 @@ function checkCommand(kind2, env2 = process.env) {
|
|
|
28364
28484
|
const [program] = kind2.command;
|
|
28365
28485
|
if (program === void 0) throw new SetupError(`${kind2.name} has no command to run. ${STILL_GOOD}`);
|
|
28366
28486
|
const path = { ...env2, ...kind2.env }["PATH"] ?? "";
|
|
28367
|
-
const found = program.includes("/") ? runnable(
|
|
28487
|
+
const found = program.includes("/") ? runnable(isAbsolute3(program) ? program : resolve3(fromHome(program))) : path.split(delimiter2).some((dir) => dir !== "" && runnable(join9(dir, program)));
|
|
28368
28488
|
if (!found) {
|
|
28369
28489
|
throw new SetupError(
|
|
28370
28490
|
`${kind2.name}'s command, ${program}, isn't on this machine's PATH: ${installWords(kind2)}. ${STILL_GOOD}`,
|
|
@@ -28428,18 +28548,147 @@ async function checkSignIn(kind2, wire, cwd, options = {}) {
|
|
|
28428
28548
|
}
|
|
28429
28549
|
}
|
|
28430
28550
|
|
|
28551
|
+
// src/move.ts
|
|
28552
|
+
var there = (path) => {
|
|
28553
|
+
try {
|
|
28554
|
+
lstatSync(path);
|
|
28555
|
+
return true;
|
|
28556
|
+
} catch {
|
|
28557
|
+
return false;
|
|
28558
|
+
}
|
|
28559
|
+
};
|
|
28560
|
+
var isFolder = (path) => lstatSync(path).isDirectory();
|
|
28561
|
+
var shown = (path, home) => path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path;
|
|
28562
|
+
function merge2(from, to, log2, home = homedir6(), quiet = false) {
|
|
28563
|
+
if (!there(from)) return;
|
|
28564
|
+
try {
|
|
28565
|
+
if (!there(to)) {
|
|
28566
|
+
mkdirSync4(dirname5(to), { recursive: true });
|
|
28567
|
+
renameSync2(from, to);
|
|
28568
|
+
if (!quiet) log2(`moved ${shown(from, home)} to ${shown(to, home)}`);
|
|
28569
|
+
return;
|
|
28570
|
+
}
|
|
28571
|
+
if (!isFolder(from) || !isFolder(to)) {
|
|
28572
|
+
log2(`${shown(from, home)} was left where it is: ${shown(to, home)} is there already`);
|
|
28573
|
+
return;
|
|
28574
|
+
}
|
|
28575
|
+
for (const entry of readdirSync2(from)) merge2(join10(from, entry), join10(to, entry), log2, home, true);
|
|
28576
|
+
if (readdirSync2(from).length === 0) rmdirSync(from);
|
|
28577
|
+
if (!quiet) log2(`moved what was in ${shown(from, home)} into ${shown(to, home)}`);
|
|
28578
|
+
} catch (error62) {
|
|
28579
|
+
log2(`${shown(from, home)} couldn't be moved to ${shown(to, home)}, so it is used where it is: ${error62.message}`);
|
|
28580
|
+
}
|
|
28581
|
+
}
|
|
28582
|
+
function removeIfEmpty(path) {
|
|
28583
|
+
try {
|
|
28584
|
+
if (readdirSync2(path).length === 0) rmdirSync(path);
|
|
28585
|
+
} catch {
|
|
28586
|
+
}
|
|
28587
|
+
}
|
|
28588
|
+
function claudeStoreOf(folder2, env2, home = homedir6()) {
|
|
28589
|
+
const name = folder2.replace(/[^a-zA-Z0-9]/g, "-");
|
|
28590
|
+
if (name.length > 200) return void 0;
|
|
28591
|
+
return join10(env2["CLAUDE_CONFIG_DIR"] ? resolve4(fromHome(env2["CLAUDE_CONFIG_DIR"], home)) : join10(home, ".claude"), "projects", name);
|
|
28592
|
+
}
|
|
28593
|
+
function pairOf(path, places) {
|
|
28594
|
+
const old = inside2(places.oldAgents, path);
|
|
28595
|
+
if (old !== void 0) return { old: path, now: join10(places.agents, old) };
|
|
28596
|
+
const now = inside2(places.agents, path);
|
|
28597
|
+
return now === void 0 ? void 0 : { old: join10(places.oldAgents, now), now: path };
|
|
28598
|
+
}
|
|
28599
|
+
function writeJson(path, value) {
|
|
28600
|
+
const next = `${path}.next`;
|
|
28601
|
+
writeFileSync4(next, `${JSON.stringify(value, null, 2)}
|
|
28602
|
+
`, { mode: 384 });
|
|
28603
|
+
renameSync2(next, path);
|
|
28604
|
+
}
|
|
28605
|
+
var readJson = (path) => {
|
|
28606
|
+
try {
|
|
28607
|
+
const read = JSON.parse(readFileSync9(path, "utf8"));
|
|
28608
|
+
return typeof read === "object" && read !== null ? read : void 0;
|
|
28609
|
+
} catch {
|
|
28610
|
+
return void 0;
|
|
28611
|
+
}
|
|
28612
|
+
};
|
|
28613
|
+
function moveOld(configPath2, log2, home = homedir6(), env2 = process.env) {
|
|
28614
|
+
const places = placesOf2(home);
|
|
28615
|
+
const keptIn = join10(dirname5(configPath2), basename5(configPath2, ".json"));
|
|
28616
|
+
const name = inside2(places.settings, configPath2);
|
|
28617
|
+
if (name !== void 0) {
|
|
28618
|
+
mkdirSync4(dirname5(dirname5(places.settings)), { recursive: true });
|
|
28619
|
+
mkdirSync4(places.settings, { recursive: true, mode: 448 });
|
|
28620
|
+
merge2(join10(places.oldSettings, name), configPath2, log2, home);
|
|
28621
|
+
merge2(join10(places.oldSettings, name.replace(/\.json$/, "")), keptIn, log2, home);
|
|
28622
|
+
}
|
|
28623
|
+
let roots;
|
|
28624
|
+
let kindEnv;
|
|
28625
|
+
try {
|
|
28626
|
+
const kind2 = readConfig(configPath2);
|
|
28627
|
+
roots = [kind2.folders, kind2.folder].filter((root) => root !== void 0);
|
|
28628
|
+
kindEnv = kind2.env;
|
|
28629
|
+
} catch {
|
|
28630
|
+
return;
|
|
28631
|
+
}
|
|
28632
|
+
const pairs = roots.map((root) => pairOf(root, places)).filter((pair) => pair !== void 0);
|
|
28633
|
+
for (const { old, now } of pairs) merge2(old, now, log2, home);
|
|
28634
|
+
const config2 = readJson(configPath2);
|
|
28635
|
+
if (config2 !== void 0) {
|
|
28636
|
+
let changed = false;
|
|
28637
|
+
for (const key of ["folders", "folder"]) {
|
|
28638
|
+
const said = config2[key];
|
|
28639
|
+
if (typeof said !== "string") continue;
|
|
28640
|
+
const path = resolve4(fromHome(said, home));
|
|
28641
|
+
const moved = nowAt(path, places.oldAgents, places.agents);
|
|
28642
|
+
if (moved === path) continue;
|
|
28643
|
+
config2[key] = `~/${moved.slice(home.length + 1)}`;
|
|
28644
|
+
changed = true;
|
|
28645
|
+
}
|
|
28646
|
+
if (changed) writeJson(configPath2, config2);
|
|
28647
|
+
}
|
|
28648
|
+
const statePath2 = join10(keptIn, "state.json");
|
|
28649
|
+
const state2 = readJson(statePath2);
|
|
28650
|
+
const agents = state2?.["agents"];
|
|
28651
|
+
if (state2 !== void 0 && typeof agents === "object" && agents !== null) {
|
|
28652
|
+
let changed = false;
|
|
28653
|
+
for (const record2 of Object.values(agents)) {
|
|
28654
|
+
const folder2 = record2["folder"];
|
|
28655
|
+
if (typeof folder2 !== "string") continue;
|
|
28656
|
+
const moved = nowAt(folder2, places.oldAgents, places.agents);
|
|
28657
|
+
if (moved === folder2) continue;
|
|
28658
|
+
record2["folder"] = moved;
|
|
28659
|
+
changed = true;
|
|
28660
|
+
}
|
|
28661
|
+
if (changed) writeJson(statePath2, state2);
|
|
28662
|
+
}
|
|
28663
|
+
const storeEnv = { ...env2, ...kindEnv };
|
|
28664
|
+
for (const { old, now } of pairs) {
|
|
28665
|
+
if (there(old) || !there(now)) continue;
|
|
28666
|
+
const folders = [{ old, now }];
|
|
28667
|
+
for (const entry of readdirSync2(now)) {
|
|
28668
|
+
if (isFolder(join10(now, entry))) folders.push({ old: join10(old, entry), now: join10(now, entry) });
|
|
28669
|
+
}
|
|
28670
|
+
for (const folder2 of folders) {
|
|
28671
|
+
const from = claudeStoreOf(folder2.old, storeEnv, home);
|
|
28672
|
+
const to = claudeStoreOf(folder2.now, storeEnv, home);
|
|
28673
|
+
if (from !== void 0 && to !== void 0 && !there(folder2.old)) merge2(from, to, log2, home);
|
|
28674
|
+
}
|
|
28675
|
+
}
|
|
28676
|
+
removeIfEmpty(places.oldSettings);
|
|
28677
|
+
removeIfEmpty(places.oldAgents);
|
|
28678
|
+
}
|
|
28679
|
+
|
|
28431
28680
|
// src/main.ts
|
|
28432
|
-
var home2 = (path) => path.startsWith("~/") ? join10(homedir7(), path.slice(2)) : path;
|
|
28433
28681
|
var link = process.env["CHIPS_JOIN_LINK"] || void 0;
|
|
28434
|
-
var
|
|
28435
|
-
var LABEL = `chat.chips.acp.${basename5(configPath, ".json")}`;
|
|
28682
|
+
var LABEL = `chat.chips.acp.${basename6(configTargetOf(words3[0]), ".json")}`;
|
|
28436
28683
|
stopIfAsked(LABEL);
|
|
28437
|
-
var kind;
|
|
28438
28684
|
var log = (line) => process.stdout.write(`${(/* @__PURE__ */ new Date()).toISOString()} ${line}
|
|
28439
28685
|
`);
|
|
28686
|
+
moveOld(configTargetOf(words3[0]), log);
|
|
28687
|
+
var configPath = configPathOf(words3[0]);
|
|
28688
|
+
var kind;
|
|
28440
28689
|
try {
|
|
28441
28690
|
kind = readConfig(configPath);
|
|
28442
|
-
|
|
28691
|
+
mkdirSync5(kind.folder ?? kind.folders, { recursive: true });
|
|
28443
28692
|
if (link !== void 0) {
|
|
28444
28693
|
reportStep("checking", { detail: `Starting ${kind.name}'s ACP adapter` });
|
|
28445
28694
|
checkCommand(kind);
|
|
@@ -28457,9 +28706,9 @@ try {
|
|
|
28457
28706
|
`);
|
|
28458
28707
|
process.exit(1);
|
|
28459
28708
|
}
|
|
28460
|
-
var folder =
|
|
28461
|
-
var statePath =
|
|
28462
|
-
|
|
28709
|
+
var folder = join11(dirname6(configPath), basename6(configPath, ".json"));
|
|
28710
|
+
var statePath = join11(folder, "state.json");
|
|
28711
|
+
mkdirSync5(folder, { recursive: true, mode: 448 });
|
|
28463
28712
|
var refused2 = (error62) => {
|
|
28464
28713
|
if (!(error62 instanceof JoinError)) throw error62;
|
|
28465
28714
|
process.stderr.write(`${error62.message}
|
|
@@ -28485,7 +28734,7 @@ var joined = await join3({
|
|
|
28485
28734
|
onCode: (code) => log(`Allow this harness in Chips: ${code}`)
|
|
28486
28735
|
}).catch(refused2);
|
|
28487
28736
|
keepIfAsked(LABEL, joined.url, ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "CODEX_HOME", "CLAUDE_CONFIG_DIR"], log);
|
|
28488
|
-
var kept =
|
|
28737
|
+
var kept = existsSync10(statePath) ? JSON.parse(readFileSync10(statePath, "utf8")) : {};
|
|
28489
28738
|
var state = {
|
|
28490
28739
|
sessions: kept.sessions ?? {},
|
|
28491
28740
|
agents: kept.agents ?? {},
|
|
@@ -28498,7 +28747,7 @@ var chips = await connect({
|
|
|
28498
28747
|
url: joined.url,
|
|
28499
28748
|
token: joined.token,
|
|
28500
28749
|
client: { name: "chips-acp", version: VERSION },
|
|
28501
|
-
store: fileStore(
|
|
28750
|
+
store: fileStore(join11(folder, "chips-state.json")),
|
|
28502
28751
|
onRestart: async () => {
|
|
28503
28752
|
log("a person asked for a restart");
|
|
28504
28753
|
await bridge?.restart();
|
|
@@ -28515,7 +28764,7 @@ bridge = new Bridge({
|
|
|
28515
28764
|
// Claude Code's and Codex's adapters offer their models as session options (Chips ADR 0241).
|
|
28516
28765
|
models: knownIdOf(kind) !== void 0,
|
|
28517
28766
|
state,
|
|
28518
|
-
saveState: (next) =>
|
|
28767
|
+
saveState: (next) => writeFileSync5(statePath, `${JSON.stringify(next, null, 2)}
|
|
28519
28768
|
`, { mode: 384 }),
|
|
28520
28769
|
wire: () => processWire(kind.command, kind.folder ?? kind.folders, env, (line) => log(`${kind.name}: ${line}`)),
|
|
28521
28770
|
env,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chipschat/acp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
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": {
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"release": "npm run build && npm test && npm pack"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@chipschat/conformance": "1.0.
|
|
37
|
-
"@chipschat/harness": "1.0.
|
|
38
|
-
"@chipschat/protocol": "1.0.
|
|
36
|
+
"@chipschat/conformance": "1.0.2",
|
|
37
|
+
"@chipschat/harness": "1.0.2",
|
|
38
|
+
"@chipschat/protocol": "1.0.2",
|
|
39
39
|
"@types/node": "22.19.0",
|
|
40
40
|
"esbuild": "0.27.7",
|
|
41
41
|
"tsx": "4.21.0",
|