@chipschat/acp 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  # Third-party notices
2
2
 
3
- `dist/main.js` in @chipschat/acp 1.0.11 carries these packages, bundled in. Each one's
3
+ `dist/main.js` in @chipschat/acp 1.0.12 carries these packages, bundled in. Each one's
4
4
  licence follows.
5
5
 
6
- ## @chipschat/harness 1.0.1 (Apache-2.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.1 (Apache-2.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
@@ -20526,7 +20526,7 @@ var contextLine = external_exports.object({
20526
20526
  }).describe("One line of a room: something said, or something that happened to who is in it.");
20527
20527
  var roomContext = external_exports.object({
20528
20528
  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 turn that said the harness's own last message in the room began (ADR 0105), else its joining; from the pull route, 0."),
20529
+ 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
20530
  truncated: external_exports.boolean().describe("Whether older lines after `since_seq` were left out to fit the budget."),
20531
20531
  before: external_exports.int().positive().describe("A cursor: `GET /v1/spaces/:id/context?before=` this reads what came before these lines."),
20532
20532
  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 +21674,7 @@ var pairingPayload = external_exports.object({
21674
21674
  var JOIN_POLL_SECONDS = 3;
21675
21675
  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
21676
  var keyCode = external_exports.string().regex(/^[0-9]{6}$/, "six digits");
21677
+ var joinNonce = external_exports.string().regex(/^[A-Za-z0-9_-]{43}$/, "32 bytes, base64url");
21677
21678
  var requestCode = external_exports.union([pairingCode, keyCode]);
21678
21679
  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
21680
  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 +21710,15 @@ var joinAsk = external_exports.object({
21709
21710
  software: words2(120).optional(),
21710
21711
  machine: words2(120).optional(),
21711
21712
  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.")
21713
+ 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."),
21714
+ 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
21715
  }).describe("A request to join.");
21714
21716
  var joinAsked = external_exports.object({
21715
21717
  request_id: id("join"),
21716
21718
  secret: external_exports.string().min(16).max(200).describe("The requester's alone: it polls with it."),
21717
- code: requestCode,
21719
+ code: requestCode.optional().describe("The code to show. Absent for a device that sent `commit`: it works its own out."),
21720
+ 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)."),
21721
+ nonce: joinNonce.optional().describe("For a device that sent `commit`: the server's nonce, for the code (ADR 0278)."),
21718
21722
  expires_in: external_exports.int().positive().describe("Seconds until it expires."),
21719
21723
  interval: external_exports.int().positive().describe("Seconds between polls.")
21720
21724
  });
@@ -22646,6 +22650,17 @@ var jobChangeFrame = external_exports.object({
22646
22650
  asked_at: isoTimestamp
22647
22651
  }).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
22652
 
22653
+ // node_modules/@chipschat/protocol/dist/src/read-marks.js
22654
+ var READ_MARKS_MAX = 1e3;
22655
+ 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, {
22656
+ message: `at most ${READ_MARKS_MAX} rooms`
22657
+ }).describe("How far each room is read, by room id.");
22658
+ var readMarksBody = external_exports.object({ spaces: readMarks });
22659
+ var readFrame = external_exports.object({
22660
+ frame: external_exports.literal("read"),
22661
+ spaces: readMarks.describe("The rooms whose marks moved, and where to.")
22662
+ }).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.");
22663
+
22649
22664
  // node_modules/@chipschat/protocol/dist/src/frames.js
22650
22665
  var clientHelloFrame = external_exports.object({
22651
22666
  frame: external_exports.literal("hello"),
@@ -22662,7 +22677,7 @@ var clientHelloFrame = external_exports.object({
22662
22677
  autonomy: autonomyLevel.optional().describe("The level the harness believes it has.")
22663
22678
  })).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
22679
  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."),
22680
+ 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
22681
  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
22682
  }).describe("The first frame a client sends.");
22668
22683
  var subscribeFrame = external_exports.object({
@@ -22788,6 +22803,7 @@ var serverFrame = external_exports.discriminatedUnion("frame", [
22788
22803
  folderOpenFrame,
22789
22804
  folderRunFrame,
22790
22805
  folderRunStateFrame,
22806
+ readFrame,
22791
22807
  contextEditFrame,
22792
22808
  modelChangeFrame,
22793
22809
  heartbeatChangeFrame,
@@ -22839,9 +22855,37 @@ var HTML_POLICY = "default-src 'none'; img-src data: blob:; font-src data:; medi
22839
22855
  var PAGE_SANDBOX = "allow-scripts allow-popups allow-popups-to-escape-sandbox";
22840
22856
  var PAGE_HEADER_POLICY = `${HTML_POLICY}; sandbox ${PAGE_SANDBOX}`;
22841
22857
 
22842
- // node_modules/@chipschat/harness/dist/connect.js
22843
- import { readFile as readFile2 } from "node:fs/promises";
22844
- import { basename } from "node:path";
22858
+ // node_modules/@chipschat/protocol/dist/src/push.js
22859
+ var PUSH_WORDS = {
22860
+ /** An ask of an agent's that waits on a person (ADR 0045). */
22861
+ decision: {
22862
+ title: "A decision is waiting",
22863
+ body: "Approve or deny from here.",
22864
+ categoryId: "decision"
22865
+ },
22866
+ /** A message that @s the person, or was sent to them (ADR 0158). */
22867
+ messageForYou: { title: "A message for you", body: "Open Chips to read it." },
22868
+ /** A message in a room they hear (ADR 0158). */
22869
+ message: { title: "A new message", body: "Open Chips to read it." },
22870
+ /** A join request for its maker or an owner (ADR 0122). */
22871
+ join: { title: "Something asks to join", body: "Check its code, then allow it or not." },
22872
+ /** The referee paused agents talking among themselves (ADR 0097). */
22873
+ held: { title: "Chips paused the agents", body: "Open the space to let them carry on." },
22874
+ warning: { title: "The agents need a look", body: "They have been talking among themselves." },
22875
+ /** A guest's ask to go direct, and its answers (ADR 0211). */
22876
+ directAsked: {
22877
+ title: "A guest wants to connect directly",
22878
+ body: "Share your server with them in Tailscale."
22879
+ },
22880
+ directShared: { title: "Your server is shared with you", body: "Open Chips to go direct." },
22881
+ directDone: {
22882
+ title: "Connected directly",
22883
+ body: "A guest you shared your server with is direct now."
22884
+ },
22885
+ /** An owner is turning the relay off (ADR 0211, Phase 4). */
22886
+ relayOff: { title: "The relay is going off", body: "Go direct to keep reaching the server." }
22887
+ };
22888
+ var KNOWN = new Set(Object.values(PUSH_WORDS).map((words4) => JSON.stringify([words4.title, words4.body, "categoryId" in words4 ? words4.categoryId : null])));
22845
22889
 
22846
22890
  // node_modules/@chipschat/harness/dist/asks.js
22847
22891
  var Asks = class {
@@ -22876,10 +22920,7 @@ var Asks = class {
22876
22920
  const from = event["from"];
22877
22921
  if (!this.listener.listening() || from?.kind !== "person")
22878
22922
  return false;
22879
- this.hand(spaceId, room, {
22880
- messageId: String(event["message_id"]),
22881
- text: String(event["text"] ?? "")
22882
- });
22923
+ this.hand(spaceId, room, { messageId: String(event["message_id"]), text: String(event["text"] ?? "") }, event);
22883
22924
  return true;
22884
22925
  }
22885
22926
  /**
@@ -22915,11 +22956,42 @@ var Asks = class {
22915
22956
  this.rooms.set(spaceId, room);
22916
22957
  return room;
22917
22958
  }
22918
- hand(spaceId, room, first) {
22959
+ hand(spaceId, room, first, message) {
22919
22960
  room.first = first.messageId;
22920
- this.listener.hand({ spaceId, askedBy: room.askedBy, firstMessage: first });
22961
+ this.listener.hand({
22962
+ spaceId,
22963
+ askedBy: room.askedBy,
22964
+ firstMessage: first,
22965
+ ...message === void 0 ? {} : { message }
22966
+ });
22921
22967
  }
22922
22968
  };
22969
+ function firstTurnOf(asked, agentId2) {
22970
+ const { message } = asked;
22971
+ if (message === void 0)
22972
+ return void 0;
22973
+ const room = message.room;
22974
+ const notes = room?.notes ?? {};
22975
+ const [place, ...more] = Object.keys(notes);
22976
+ if (room === void 0 || place === void 0 || more.length > 0) {
22977
+ return { ...message, for: [agentId2] };
22978
+ }
22979
+ const placed = (each) => each.participant_id === place ? { ...each, participant_id: agentId2 } : each;
22980
+ const note = notes[place];
22981
+ const rules = room.rules?.[place];
22982
+ return {
22983
+ ...message,
22984
+ for: [agentId2],
22985
+ room: {
22986
+ ...room,
22987
+ members: room.members.map(placed),
22988
+ notes: note === void 0 ? {} : { [agentId2]: note },
22989
+ ...room.rules === void 0 ? {} : { rules: rules === void 0 ? {} : { [agentId2]: rules } },
22990
+ ...room.working === void 0 ? {} : { working: room.working.map(placed) },
22991
+ ...room.idle === void 0 ? {} : { idle: room.idle.map(placed) }
22992
+ }
22993
+ };
22994
+ }
22923
22995
  function firstWords(history) {
22924
22996
  for (const event of history) {
22925
22997
  const actor2 = event["actor"];
@@ -22930,6 +23002,10 @@ function firstWords(history) {
22930
23002
  return void 0;
22931
23003
  }
22932
23004
 
23005
+ // node_modules/@chipschat/harness/dist/connect.js
23006
+ import { readFile as readFile2 } from "node:fs/promises";
23007
+ import { basename } from "node:path";
23008
+
22933
23009
  // node_modules/@chipschat/harness/dist/events.js
22934
23010
  var Emitter = class {
22935
23011
  handlers = /* @__PURE__ */ new Map();
@@ -26379,7 +26455,7 @@ var ContextFiles = class {
26379
26455
  };
26380
26456
 
26381
26457
  // src/kinds.ts
26382
- var KNOWN = [
26458
+ var KNOWN2 = [
26383
26459
  {
26384
26460
  id: "claude-code",
26385
26461
  name: "Claude Code",
@@ -26402,12 +26478,12 @@ var KNOWN = [
26402
26478
  }
26403
26479
  ];
26404
26480
  function knownConfig(id2) {
26405
- const known = KNOWN.find((each) => each.id === id2);
26481
+ const known = KNOWN2.find((each) => each.id === id2);
26406
26482
  return known === void 0 ? void 0 : { name: known.name, command: [known.program], mode: known.mode };
26407
26483
  }
26408
26484
  var knownBy = (kind2) => {
26409
26485
  const program = kind2.command[0]?.split("/").pop();
26410
- return KNOWN.find((each) => each.program === program);
26486
+ return KNOWN2.find((each) => each.program === program);
26411
26487
  };
26412
26488
  function knownIdOf(kind2) {
26413
26489
  return knownBy(kind2)?.id;
@@ -26954,7 +27030,7 @@ var Bridge = class {
26954
27030
  return made;
26955
27031
  });
26956
27032
  this.log(`${agent.name} claimed ${spaceId}, in ${record2.folder}`);
26957
- const message = {
27033
+ const message = firstTurnOf(asked, agent.agentId) ?? {
26958
27034
  type: "message.new",
26959
27035
  space_id: spaceId,
26960
27036
  message_id: firstMessage.messageId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipschat/acp",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
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.1",
37
- "@chipschat/harness": "1.0.1",
38
- "@chipschat/protocol": "1.0.1",
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",