@chipschat/acp 1.0.35 → 1.0.36

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 CHANGED
@@ -1,7 +1,8 @@
1
1
  # chips-acp
2
2
 
3
3
  An agent that speaks the [Agent Client Protocol](https://agentclientprotocol.com) (ACP) — Claude
4
- Code, Codex, Goose, Gemini — as a Chips harness, one kind per harness. People make its agents from
4
+ Code, Codex, Cursor, Copilot, Antigravity, Goose, Grok, or any other — as a Chips harness, one kind
5
+ per harness. People make its agents from
5
6
  Chips: a room from the +, a new agent from a room's Add page, a copy with Fork. Each agent works in a
6
7
  folder of its own; each room it is in is one ACP session of it. There is no Main agent. The bridge
7
8
  runs the agent's process, so the bridge is the harness (Chips ADR 0041), built on `@chipschat/harness`.
@@ -20,6 +21,46 @@ joins, and keeps itself running from login. `chips disconnect claude-code` or `c
20
21
  `curl -fsSL https://chipschat.ai/install | CHIPS_JOIN_LINK='<link>' sh -s -- connect claude-code` installs Chips there
21
22
  first. The steps below run the bridge from this checkout instead, to work on it.
22
23
 
24
+ ## The agents it knows by name
25
+
26
+ Each of these needs no config: its card hands the bridge `~/Chips/.bridges/acp/<id>.json`, and
27
+ the file's name picks the kind. Claude Code and Codex speak ACP through an adapter from npm; the
28
+ others speak it themselves, so there is nothing to fetch (Chips ADR 0301). The person installs the
29
+ agent from its maker and signs it in; the bridge asks for each in turn, with the maker's line, and
30
+ also looks where that line puts the agent, since a terminal opened before doesn't know the folder.
31
+
32
+ | Id | Runs | Install | Sign in | Modes Chips may pick |
33
+ |---|---|---|---|---|
34
+ | `claude-code` | `claude-agent-acp` | `curl -fsSL https://claude.ai/install.sh \| bash`, then the adapter | `claude auth login` | Default, Accept edits, Auto, Bypass permissions |
35
+ | `codex` | `codex-acp` (fetched) | `curl -fsSL https://chatgpt.com/codex/install.sh \| sh` | `codex login` | Read-only, Workspace access, Auto review, Full access |
36
+ | `cursor` | `cursor-agent acp` | `curl https://cursor.com/install -fsS \| bash` | `cursor-agent login` | none |
37
+ | `copilot` | `copilot --acp` | `curl -fsSL https://gh.io/copilot-install \| bash` | `copilot login` | none |
38
+ | `antigravity` | `agy acp` | `curl -fsSL https://antigravity.google/cli/install.sh \| bash` | `agy acp --login` | Default, Accept edits, Auto |
39
+ | `goose` | `goose acp` | Goose's `download_cli.sh` | `goose configure` (a model provider and its key) | Approve, Smart approve, Auto |
40
+ | `grok` | `grok --no-auto-update agent stdio` | `curl -fsSL https://x.ai/cli/install.sh \| bash` | `grok login` | none |
41
+
42
+ - **Cursor** and **Copilot** offer modes that are ways of working (Agent, Plan, Ask; Agent, Plan,
43
+ Autopilot), not how much they may do, so Chips puts them in none: each session asks as the agent's
44
+ own settings say (Cursor's `approvalMode`, which never asks about edits in its folder; Copilot's
45
+ Allow all, off unless turned on). Cursor is never asked to sign in over ACP: signed out, that
46
+ opens a browser on the machine each time.
47
+ - **Goose** starts in Auto, which never asks, unless `GOOSE_MODE` says otherwise, so each session
48
+ goes into Approve. With no model provider set up it refuses a session with an internal error
49
+ naming `GOOSE_PROVIDER`, which the bridge says as "Goose has no model provider set up".
50
+ - **Grok** opens no session until it is asked to sign in (`authenticate`), as xAI's own ACP example
51
+ does: by its API key where `XAI_API_KEY` is set, else by what `grok login` saved. Signed out, it
52
+ offers neither, and its session is refused. Its ACP sessions have no mode to be put in.
53
+ - **Antigravity**'s Auto is offered only where Antigravity has it: a personal Google account with
54
+ its terminal sandbox on.
55
+ - None of the five copies a session (`session/fork`), so their cards leave Fork off. Cursor, Copilot,
56
+ Goose and Grok offer their models as a session's `model` option, where they do, and the bridge
57
+ offers them in Chips as it does Claude Code's and Codex's. Their files and own settings aren't
58
+ read: the Permissions page shows the mode a session runs in, where Chips may pick one.
59
+ - What signs one in from the environment is carried to the copy kept running: `CURSOR_API_KEY`,
60
+ `COPILOT_GITHUB_TOKEN` (not `GH_TOKEN` or `GITHUB_TOKEN`, which are the gh command's too and
61
+ would beat Copilot's saved sign-in), `GEMINI_API_KEY`, `XAI_API_KEY`, and Goose's
62
+ `GOOSE_PROVIDER`, `GOOSE_MODEL`, `GOOGLE_API_KEY` and `OPENROUTER_API_KEY`.
63
+
23
64
  ## Run it
24
65
 
25
66
  ```bash
@@ -189,8 +230,8 @@ permissions, and each permission it asks for is an approval card.
189
230
 
190
231
  ### What Chips shows on an agent's page
191
232
 
192
- The bridge says `context` and `models` (Claude Code and Codex) and `context_windows` (every kind)
193
- in its hello, and sends each agent's copies when it starts and as they change. Chips draws them
233
+ The bridge says `context` (Claude Code and Codex), `models` (every kind it knows by name) and
234
+ `context_windows` (every kind) in its hello, and sends each agent's copies when it starts and as they change. Chips draws them
194
235
  where the harness is granted `context_files`, `models` and `context_windows`.
195
236
 
196
237
  | Chips | Claude Code | Codex | Another kind |
@@ -201,7 +242,7 @@ where the harness is granted `context_files`, `models` and `context_windows`.
201
242
  | 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` |
202
243
  | 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 |
203
244
  | Its limit | its own from `autoCompactWindow` in its settings (`modelSettings` per model), about 33,000 tokens short of it; a pick from Chips goes in each session's `_meta.claudeCode.options.settings`, never in a file; `CLAUDE_CODE_AUTO_COMPACT_WINDOW` beats both, and the limit can't be changed then | the bridge's: after a turn that ends at or past it, the bridge compacts that session; off unless picked | as Codex, where it has `compact` |
204
- | Model | the models its adapter offers for a session (the `model` option), each with its levels (`effort`, without its `default`), by the adapter's own names (its `xhigh` is Extra high); Same as "Claude Code's default" is what a new session starts on: `model` in its settings, or its own `default` | the same, with `reasoning_effort`; the default from Codex's config, which may be a model its list leaves out, with no levels | none |
245
+ | Model | the models its adapter offers for a session (the `model` option), each with its levels (`effort`, without its `default`), by the adapter's own names (its `xhigh` is Extra high); Same as "Claude Code's default" is what a new session starts on: `model` in its settings, or its own `default` | the same, with `reasoning_effort`; the default from Codex's config, which may be a model its list leaves out, with no levels | for a kind it knows by name, the same where its agent offers a `model` option (and a `thought_level` one for its levels); none for any other |
205
246
  | Where it learns them | each time the bridge starts the agent, a session opened in the harness's folder and put on each model in turn, then closed, with nothing said to it; a model it won't be put on isn't offered | the same | |
206
247
  | A pick | set on each of the agent's sessions with `session/set_config_option`, now and as each opens after, never in a file; kept with the agent, and a copy from Fork starts with its original's. Same as again puts each back on the default, and its level on Claude Code's `default`, which follows its settings | the same; a session Codex won't put back on a model its list leaves out is let go and loaded again before its next turn | |
207
248
 
@@ -1,6 +1,6 @@
1
1
  # Third-party notices
2
2
 
3
- `dist/main.js` in @chipschat/acp 1.0.35 carries these packages, bundled in. Each one's
3
+ `dist/main.js` in @chipschat/acp 1.0.36 carries these packages, bundled in. Each one's
4
4
  licence follows.
5
5
 
6
6
  ## @chipschat/harness 1.0.11 (Apache-2.0)
package/dist/main.js CHANGED
@@ -27808,6 +27808,13 @@ var AcpClient = class {
27808
27808
  ...typeof info["name"] === "string" ? { name: info["name"] } : {}
27809
27809
  };
27810
27810
  }
27811
+ /**
27812
+ * Sign in by a way the agent offered at `initialize` that needs nobody at a browser: Grok's saved
27813
+ * sign-in or its API key (Chips ADR 0301). Refused, it says why.
27814
+ */
27815
+ async authenticate(methodId) {
27816
+ await this.call("authenticate", { methodId, _meta: { headless: true } });
27817
+ }
27811
27818
  /**
27812
27819
  * A new session in `cwd`. Answers with its id and anything it said it can be set to. `meta` is
27813
27820
  * the agent's own `_meta`: Claude Code's takes its settings there (`claudeCode.options.settings`).
@@ -27979,6 +27986,16 @@ var CODEX_MODES = [
27979
27986
  everything: true
27980
27987
  }
27981
27988
  ];
27989
+ var ANTIGRAVITY_MODES = [
27990
+ { id: "default", name: "Default", words: "Asks before edits and commands its settings don't allow." },
27991
+ { id: "accept-edits", name: "Accept edits", words: "Edits files in its folder without asking. Commands still ask." },
27992
+ { id: "auto", name: "Auto", words: "Edits files and runs safe commands without asking. Asks before anything it can't undo." }
27993
+ ];
27994
+ var GOOSE_MODES = [
27995
+ { id: "approve", name: "Approve", words: "Asks before every tool call its own permission list doesn't settle." },
27996
+ { id: "smart_approve", name: "Smart approve", words: "Reads on its own. Goose judges the rest and asks only about ones it finds risky." },
27997
+ { id: "auto", name: "Auto", words: "Never asks. Whatever it does just happens.", everything: true }
27998
+ ];
27982
27999
  var KNOWN2 = [
27983
28000
  {
27984
28001
  id: "claude-code",
@@ -28013,16 +28030,138 @@ var KNOWN2 = [
28013
28030
  signInNoScreen: "`codex login --device-auth`",
28014
28031
  signInLine: "codex login",
28015
28032
  signInDoing: SIGN_IN_DOING
28033
+ },
28034
+ {
28035
+ id: "cursor",
28036
+ name: "Cursor",
28037
+ // The installer links `agent` too, a name other programs use: the legacy one is Cursor's alone.
28038
+ program: "cursor-agent",
28039
+ args: ["acp"],
28040
+ fetches: false,
28041
+ agent: "cursor-agent",
28042
+ installLine: "curl https://cursor.com/install -fsS | bash",
28043
+ installedIn: ".local/bin",
28044
+ // Agent, Plan and Ask are ways of working, not how much it may do: that is its own
28045
+ // `approvalMode` and permission lists, which edits in its folder never ask past.
28046
+ modes: [],
28047
+ signIn: "run `cursor-agent login`",
28048
+ signInNoScreen: "`NO_OPEN_BROWSER=1 cursor-agent login`, then open the address it prints",
28049
+ signInLine: "cursor-agent login",
28050
+ signInDoing: SIGN_IN_DOING,
28051
+ // Never asked to sign in over ACP: signed out, that opens a browser on this machine each time.
28052
+ keys: ["CURSOR_API_KEY"]
28053
+ },
28054
+ {
28055
+ id: "goose",
28056
+ name: "Goose",
28057
+ program: "goose",
28058
+ args: ["acp"],
28059
+ fetches: false,
28060
+ agent: "goose",
28061
+ installLine: "curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash",
28062
+ installedIn: ".local/bin",
28063
+ mode: "approve",
28064
+ modes: GOOSE_MODES,
28065
+ // Goose has no account: it runs on a model provider a person picks, with that provider's key.
28066
+ signIn: "run `goose configure` and pick a model provider",
28067
+ signInLine: "goose configure",
28068
+ signInDoing: "Run this in Terminal, then try again. It asks which model provider to use, and for its key.",
28069
+ keys: ["GOOSE_PROVIDER", "GOOSE_MODEL", "GOOGLE_API_KEY", "OPENROUTER_API_KEY"],
28070
+ unready: /GOOSE_PROVIDER|resolve provider and model/,
28071
+ lacks: { detail: "No model provider", says: "has no model provider set up" }
28072
+ },
28073
+ {
28074
+ id: "copilot",
28075
+ name: "Copilot",
28076
+ program: "copilot",
28077
+ args: ["--acp"],
28078
+ fetches: false,
28079
+ agent: "copilot",
28080
+ installLine: "curl -fsSL https://gh.io/copilot-install | bash",
28081
+ installedIn: ".local/bin",
28082
+ // Its session modes are Agent, Plan and Autopilot, ways of working rather than how much it may
28083
+ // do: whether it asks is its Allow all option, off unless the person's settings turn it on.
28084
+ // Chips puts it in neither, so each session asks as Copilot's own settings say.
28085
+ modes: [],
28086
+ signIn: "run `copilot login`",
28087
+ signInNoScreen: "`copilot login --device-code`",
28088
+ signInLine: "copilot login",
28089
+ signInDoing: SIGN_IN_DOING,
28090
+ // Only Copilot's own: GH_TOKEN and GITHUB_TOKEN are the gh command's too, and Copilot lets
28091
+ // either beat the sign-in it saved.
28092
+ keys: ["COPILOT_GITHUB_TOKEN"]
28093
+ },
28094
+ {
28095
+ id: "antigravity",
28096
+ name: "Antigravity",
28097
+ program: "agy",
28098
+ args: ["acp"],
28099
+ fetches: false,
28100
+ agent: "agy",
28101
+ installLine: "curl -fsSL https://antigravity.google/cli/install.sh | bash",
28102
+ installedIn: ".local/bin",
28103
+ mode: "default",
28104
+ modes: ANTIGRAVITY_MODES,
28105
+ // Its sign-in for ACP gives a link to open and takes back the code Google shows, so it works
28106
+ // the same on a machine with no screen.
28107
+ signIn: "run `agy acp --login` and paste back the code it asks for",
28108
+ signInLine: "agy acp --login",
28109
+ signInDoing: "Run this in Terminal, then try again. It gives you a Google sign-in link; paste back the code you get.",
28110
+ keys: ["GEMINI_API_KEY"]
28111
+ },
28112
+ {
28113
+ id: "grok",
28114
+ name: "Grok",
28115
+ program: "grok",
28116
+ // Grok updates itself in the background unless told not to, which xAI asks of anything that
28117
+ // runs it as an ACP agent: the person's own `grok` in a terminal still keeps itself current.
28118
+ args: ["--no-auto-update", "agent", "stdio"],
28119
+ fetches: false,
28120
+ agent: "grok",
28121
+ installLine: "curl -fsSL https://x.ai/cli/install.sh | bash",
28122
+ installedIn: ".grok/bin",
28123
+ // Its Ask, Auto and Always-approve aren't modes its ACP sessions offer to be put in: each
28124
+ // session runs in the one Grok's own config gives it, Ask unless the person changed it.
28125
+ modes: [],
28126
+ signIn: "run `grok login`",
28127
+ signInNoScreen: "`grok login --device-auth`",
28128
+ signInLine: "grok login",
28129
+ signInDoing: SIGN_IN_DOING,
28130
+ keys: ["XAI_API_KEY"],
28131
+ // It opens no session until asked to sign in, as xAI's own ACP example does: by its API key
28132
+ // where one is set, else by what `grok login` saved. Signed out, it offers neither.
28133
+ headless: [{ id: "xai.api_key", env: "XAI_API_KEY" }, { id: "cached_token" }]
28016
28134
  }
28017
28135
  ];
28018
28136
  function knownConfig(id2) {
28019
28137
  const known = KNOWN2.find((each) => each.id === id2);
28020
- return known === void 0 ? void 0 : { name: known.name, command: [known.program], mode: known.mode };
28138
+ if (known === void 0) return void 0;
28139
+ return {
28140
+ name: known.name,
28141
+ command: [known.program, ...known.args ?? []],
28142
+ ...known.mode === void 0 ? {} : { mode: known.mode }
28143
+ };
28021
28144
  }
28022
28145
  var knownBy = (kind2) => {
28023
28146
  const program = kind2.command[0]?.split("/").pop();
28024
28147
  return KNOWN2.find((each) => each.program === program);
28025
28148
  };
28149
+ var speaksAcp = (known) => known.adapter === void 0;
28150
+ function signedOutBy(kind2, error62) {
28151
+ if (isAuthRequired(error62)) return true;
28152
+ const unready = knownBy(kind2)?.unready;
28153
+ if (unready === void 0 || !(error62 instanceof AcpError)) return false;
28154
+ const data = typeof error62.data === "string" ? error62.data : JSON.stringify(error62.data ?? "");
28155
+ return unready.test(`${error62.message} ${data}`);
28156
+ }
28157
+ function headlessAuthOf(kind2, offered, env3) {
28158
+ return knownBy(kind2)?.headless?.find(
28159
+ (way) => offered.some((method) => method.id === way.id) && (way.env === void 0 || (env3[way.env] ?? "") !== "")
28160
+ )?.id;
28161
+ }
28162
+ function keptEnvOf(kind2) {
28163
+ return ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "CODEX_HOME", "CLAUDE_CONFIG_DIR", ...knownBy(kind2)?.keys ?? []];
28164
+ }
28026
28165
  function modesOf(kind2) {
28027
28166
  const known = knownBy(kind2);
28028
28167
  if (known === void 0 || kind2.mode !== known.mode) return [];
@@ -28030,7 +28169,8 @@ function modesOf(kind2) {
28030
28169
  }
28031
28170
  var knownOf = (kind2) => knownBy(kind2);
28032
28171
  function knownIdOf(kind2) {
28033
- return knownBy(kind2)?.id;
28172
+ const id2 = knownBy(kind2)?.id;
28173
+ return id2 === "claude-code" || id2 === "codex" ? id2 : void 0;
28034
28174
  }
28035
28175
  var CODEX_DOC_BYTES = 65536;
28036
28176
  function codexConfigOf(env3) {
@@ -28057,13 +28197,14 @@ function codexDocBytes(env3) {
28057
28197
  }
28058
28198
  function installWords(kind2) {
28059
28199
  const known = knownBy(kind2);
28060
- return known === void 0 ? "install the agent's ACP adapter its own way, or name it by its path in the config" : `install it with \`npm install -g ${known.adapter}\``;
28200
+ if (known === void 0) return "install the agent's ACP adapter its own way, or name it by its path in the config";
28201
+ return speaksAcp(known) ? `install it with \`${known.installLine}\`` : `install it with \`npm install -g ${known.adapter}\``;
28061
28202
  }
28062
28203
  function signedOutWords(kind2, info) {
28063
28204
  const known = knownBy(kind2);
28064
28205
  if (known !== void 0) {
28065
28206
  const noScreen = known.signInNoScreen === void 0 ? "" : `, or ${known.signInNoScreen} on a machine with no screen`;
28066
- return `${kind2.name} isn't signed in on this machine: ${known.signIn} in a new terminal${noScreen}.`;
28207
+ return `${kind2.name} ${known.lacks?.says ?? "isn't signed in"} on this machine: ${known.signIn} in a new terminal${noScreen}.`;
28067
28208
  }
28068
28209
  const ways = (info?.authMethods ?? []).map((method) => method.name);
28069
28210
  return `${kind2.name} isn't signed in on this machine: sign it in its own way${ways.length > 0 ? ` (${ways.join(", ")})` : ""}.`;
@@ -28077,6 +28218,7 @@ function notInstalledStop(kind2, program) {
28077
28218
  doing: "Install the agent's ACP adapter its own way, then try again."
28078
28219
  };
28079
28220
  }
28221
+ if (speaksAcp(known)) return agentMissingStop(known);
28080
28222
  return {
28081
28223
  detail: `${kind2.name} can't join Chips yet`,
28082
28224
  says: `${kind2.name} needs one more piece to join Chips.`,
@@ -28102,8 +28244,8 @@ function adapterFailedStop(name) {
28102
28244
  function signedOutStop(kind2) {
28103
28245
  const known = knownBy(kind2);
28104
28246
  return {
28105
- detail: "Not signed in",
28106
- says: `${kind2.name} isn't signed in.`,
28247
+ detail: known?.lacks?.detail ?? "Not signed in",
28248
+ says: `${kind2.name} ${known?.lacks?.says ?? "isn't signed in"}.`,
28107
28249
  ...known === void 0 ? { doing: "Sign it in its own way, then try again." } : { doing: known.signInDoing, copy: known.signInLine }
28108
28250
  };
28109
28251
  }
@@ -28257,11 +28399,19 @@ async function checkSignIn(kind2, wire, cwd, options = {}) {
28257
28399
  ...last === "" ? {} : { doing: `It said: ${last}` }
28258
28400
  });
28259
28401
  }
28402
+ const method = headlessAuthOf(kind2, info.authMethods, { ...process.env, ...kind2.env, ...options.env });
28403
+ if (method !== void 0) {
28404
+ try {
28405
+ await within(client.authenticate(method), MINUTE, "it didn't answer within a minute");
28406
+ } catch (error62) {
28407
+ throw new SetupError(`${signedOutWords(kind2, info)} It said: ${wordsOf2(error62)}. ${STILL_GOOD}`, signedOutStop(kind2));
28408
+ }
28409
+ }
28260
28410
  try {
28261
28411
  const { sessionId } = await within(client.newSession(cwd), MINUTE, "it didn't answer within a minute");
28262
28412
  if (info.closeSession) await client.closeSession(sessionId).catch(() => void 0);
28263
28413
  } catch (error62) {
28264
- if (isAuthRequired(error62)) throw new SetupError(`${signedOutWords(kind2, info)} ${STILL_GOOD}`, signedOutStop(kind2));
28414
+ if (signedOutBy(kind2, error62)) throw new SetupError(`${signedOutWords(kind2, info)} ${STILL_GOOD}`, signedOutStop(kind2));
28265
28415
  throw new SetupError(`${kind2.name} couldn't open a session: ${wordsOf2(error62)}. ${STILL_GOOD}`, {
28266
28416
  detail: "It couldn't open a session",
28267
28417
  says: `${kind2.name} couldn't open a session: ${wordsOf2(error62)}.`
@@ -28289,7 +28439,9 @@ function makersFolder(kind2, env3 = process.env, home = homedir5()) {
28289
28439
  var pathWithLast = (path, folder2) => [...(path ?? "").split(delimiter3).filter((each) => each !== ""), folder2].join(delimiter3);
28290
28440
  function withFetchedAdapter(kind2, env3 = process.env, home = homedir5()) {
28291
28441
  const known = knownOf(kind2);
28292
- if (known === void 0 || kind2.command[0] !== known.program || onPath(known.program, pathOf2(kind2, env3))) return kind2;
28442
+ if (known === void 0 || known.adapter === void 0 || kind2.command[0] !== known.program || onPath(known.program, pathOf2(kind2, env3))) {
28443
+ return kind2;
28444
+ }
28293
28445
  const fetched = fetchedAt(known.id, known.program, home);
28294
28446
  return runnable(fetched) ? { ...kind2, command: [fetched, ...kind2.command.slice(1)] } : kind2;
28295
28447
  }
@@ -28343,7 +28495,8 @@ async function readyAdapter(kind2, options = {}) {
28343
28495
  );
28344
28496
  }
28345
28497
  const npm = env3["CHIPS_NPM"];
28346
- if (!known.fetches || npm === void 0 || npm === "") return kind2;
28498
+ if (!known.fetches || known.adapter === void 0 || npm === void 0 || npm === "") return kind2;
28499
+ const adapter = known.adapter;
28347
28500
  const folder2 = adapterFolder(known.id, home);
28348
28501
  const { CHIPS_JOIN_LINK: _link, ...rest } = env3;
28349
28502
  const node2 = process.execPath;
@@ -28354,7 +28507,7 @@ async function readyAdapter(kind2, options = {}) {
28354
28507
  node: node2,
28355
28508
  npm,
28356
28509
  folder: folder2,
28357
- spec: `${known.adapter}@${known.adapterMajor}`,
28510
+ spec: `${adapter}@${known.adapterMajor ?? 0}`,
28358
28511
  env: { ...rest, PATH: `${dirname4(node2)}${delimiter3}${rest["PATH"] ?? ""}` }
28359
28512
  });
28360
28513
  } catch (error62) {
@@ -28365,7 +28518,7 @@ async function readyAdapter(kind2, options = {}) {
28365
28518
  const ready = withFetchedAdapter(kind2, env3, home);
28366
28519
  if (ready.command[0] === known.program) {
28367
28520
  rmSync3(folder2, { recursive: true, force: true });
28368
- throw new SetupError(`${known.adapter} installed, but it has no ${known.program}. ${STILL_GOOD}`, adapterFailedStop(kind2.name));
28521
+ throw new SetupError(`${adapter} installed, but it has no ${known.program}. ${STILL_GOOD}`, adapterFailedStop(kind2.name));
28369
28522
  }
28370
28523
  return ready;
28371
28524
  }
@@ -28942,6 +29095,11 @@ function codexOwnRules(mode) {
28942
29095
  runs: []
28943
29096
  };
28944
29097
  }
29098
+ function modeOwnRules(name, running, mode) {
29099
+ const read_from = [`the mode Chips starts each ${name} session in`];
29100
+ if (mode === void 0) return { read_from, mode: running, runs: [] };
29101
+ return { read_from, mode: mode.name, ...mode.everything === true ? { everything: true } : {}, note: mode.words, runs: [] };
29102
+ }
28945
29103
  async function sendOwnRules(settings, copy) {
28946
29104
  const send = settings?.ownRules;
28947
29105
  if (typeof send !== "function") return false;
@@ -29573,6 +29731,10 @@ var Bridge = class {
29573
29731
  proc.info = await client.initialize({ name: "chips-acp", version: VERSION });
29574
29732
  proc.failures = 0;
29575
29733
  this.log(`${name} is running${proc.info.name === void 0 ? "" : ` (${proc.info.name})`}`);
29734
+ const method = headlessAuthOf(this.options.kind, proc.info.authMethods, this.env);
29735
+ if (method !== void 0) {
29736
+ await client.authenticate(method).catch((error62) => this.log(`${signedOutWords(this.options.kind, proc.info)} It said: ${messageOf(error62)}`));
29737
+ }
29576
29738
  if (this.options.models === true) void this.look(client);
29577
29739
  } catch (error62) {
29578
29740
  this.log(`${name} didn't say hello: ${String(error62)}`);
@@ -29591,7 +29753,7 @@ var Bridge = class {
29591
29753
  }
29592
29754
  /** What a turn's failure says: how to sign in when that's why, else the agent's own words. */
29593
29755
  failure(record2, error62, what = "") {
29594
- if (isAuthRequired(error62)) return `${signedOutWords(this.options.kind, this.process.info)} Then send this again.`;
29756
+ if (signedOutBy(this.options.kind, error62)) return `${signedOutWords(this.options.kind, this.process.info)} Then send this again.`;
29595
29757
  return `${record2.name}${what}: ${messageOf(error62)}`;
29596
29758
  }
29597
29759
  async stopped(client, why) {
@@ -29861,7 +30023,7 @@ var Bridge = class {
29861
30023
  try {
29862
30024
  turn.sessionId = await this.sessionFor(record2, client, spaceId);
29863
30025
  } catch (error62) {
29864
- if (!run2.over) await run2.fail({ error: this.failure(record2, error62, " couldn't open a session"), retryable: isAuthRequired(error62) });
30026
+ if (!run2.over) await run2.fail({ error: this.failure(record2, error62, " couldn't open a session"), retryable: signedOutBy(this.options.kind, error62) });
29865
30027
  return;
29866
30028
  }
29867
30029
  const { sessionId } = turn;
@@ -30363,6 +30525,12 @@ ${files.join("\n")}`;
30363
30525
  }
30364
30526
  ownRulesNow() {
30365
30527
  if (this.knownKind === "codex") return codexOwnRules(this.runningMode() ?? "workspace-write");
30528
+ if (this.knownKind === void 0) {
30529
+ const { kind: kind2 } = this.options;
30530
+ const running = this.runningMode();
30531
+ if (knownOf(kind2) === void 0 || running === void 0 || modesOf(kind2).length === 0) return void 0;
30532
+ return modeOwnRules(kind2.name, running, modesOf(kind2).find((mode) => mode.id === running));
30533
+ }
30366
30534
  if (this.knownKind !== "claude-code") return void 0;
30367
30535
  const userPath = join10(this.places.claudeHome, "settings.json");
30368
30536
  const folders = [...new Set(this.records().map((record2) => record2.folder))].flatMap(
@@ -30992,10 +31160,8 @@ function settingsFor(kind2, bridge2) {
30992
31160
  return running;
30993
31161
  };
30994
31162
  return {
30995
- ...knownIdOf(kind2) === void 0 ? {} : {
30996
- context: (edit) => active().contextEdited(edit),
30997
- models: (change) => active().modelChange(change)
30998
- },
31163
+ ...knownIdOf(kind2) === void 0 ? {} : { context: (edit) => active().contextEdited(edit) },
31164
+ ...knownOf(kind2) === void 0 ? {} : { models: (change) => active().modelChange(change) },
30999
31165
  contextWindows: {
31000
31166
  compact: (ask2) => active().windowCompact(ask2),
31001
31167
  change: (ask2) => active().windowChange(ask2)
@@ -31383,14 +31549,15 @@ var joined2 = await join3({
31383
31549
  "new_agents",
31384
31550
  "forks",
31385
31551
  "restarts",
31386
- // Each agent's files and its model, for the kinds whose files and models the bridge knows, and
31387
- // every agent's context window.
31388
- ...knownIdOf(kind) === void 0 ? [] : ["context_files", "models"],
31552
+ // Each agent's files, for the kinds whose files the bridge reads; its model, for every kind it
31553
+ // knows by name, of those its agent offers (Chips ADR 0301); and every agent's context window.
31554
+ ...knownIdOf(kind) === void 0 ? [] : ["context_files"],
31555
+ ...knownOf(kind) === void 0 ? [] : ["models"],
31389
31556
  "context_windows"
31390
31557
  ],
31391
31558
  onCode: (code) => log(`Allow this harness in Chips: ${code}`)
31392
31559
  }).catch(refused2);
31393
- keepIfAsked(LABEL, joined2.url, ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "CODEX_HOME", "CLAUDE_CONFIG_DIR"], log);
31560
+ keepIfAsked(LABEL, joined2.url, keptEnvOf(kind), log);
31394
31561
  var kept = existsSync10(statePath) ? JSON.parse(readFileSync10(statePath, "utf8")) : {};
31395
31562
  var state = {
31396
31563
  sessions: kept.sessions ?? {},
@@ -31429,8 +31596,8 @@ bridge = new Bridge({
31429
31596
  chips,
31430
31597
  kind,
31431
31598
  projects: git2.ok,
31432
- // Claude Code's and Codex's adapters offer their models as session options (Chips ADR 0241).
31433
- models: knownIdOf(kind) !== void 0,
31599
+ // The kinds it knows by name offer their models as session options, where they offer any (Chips ADRs 0241, 0301).
31600
+ models: knownOf(kind) !== void 0,
31434
31601
  state,
31435
31602
  saveState: (next) => writeFileSync5(statePath, `${JSON.stringify(next, null, 2)}
31436
31603
  `, { mode: 384 }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipschat/acp",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
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": {