@chipschat/acp 1.0.27 → 1.0.29

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.27 carries these packages, bundled in. Each one's
3
+ `dist/main.js` in @chipschat/acp 1.0.29 carries these packages, bundled in. Each one's
4
4
  licence follows.
5
5
 
6
- ## @chipschat/harness 1.0.7 (Apache-2.0)
6
+ ## @chipschat/harness 1.0.9 (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.7 (Apache-2.0)
210
+ ## @chipschat/protocol 1.0.9 (Apache-2.0)
211
211
 
212
212
  Apache License
213
213
  Version 2.0, January 2004
package/dist/main.js CHANGED
@@ -20442,39 +20442,6 @@ var serverFacts = external_exports.object({
20442
20442
  })
20443
20443
  }).describe("`GET /v1/server`: the server, as the people paired to it see it (ADR 0170).");
20444
20444
 
20445
- // node_modules/@chipschat/protocol/dist/src/room-files.js
20446
- var ROOM_FILES_IN_CONTEXT = 20;
20447
- var ROOM_FILES_CEILING = 200;
20448
- var ROOM_FILES_HEADING = "Files in this space:";
20449
- var roomFile = external_exports.object({
20450
- name: external_exports.string().min(1).max(255).describe("The file's name, which its versions share."),
20451
- version: external_exports.int().positive().describe("Which version this is: 1 for the first, counting each change of its bytes."),
20452
- attachment_id: id("attachment").describe("The attachment that is this version: what a post names in `replaces` when it changes it."),
20453
- sha256: external_exports.string().regex(/^[a-f0-9]{64}$/).describe("Lowercase hex digest of this version's bytes."),
20454
- byte_size: external_exports.int().nonnegative().describe("Size in bytes."),
20455
- mime_type: external_exports.string().min(1).max(255).describe("Sniffed from the bytes on upload."),
20456
- by: external_exports.object({
20457
- id: external_exports.string().min(1).max(120).describe("Their participant id."),
20458
- kind: external_exports.enum(["person", "harness", "agent", "system"]),
20459
- name: external_exports.string().min(1).max(120).describe("What they go by now.")
20460
- }).describe("Who posted this version, as a line's `from` says it."),
20461
- at: isoTimestamp.describe("When this version was posted."),
20462
- message_id: id("message").optional().describe("The message that posted this version."),
20463
- width: external_exports.int().positive().optional().describe("Pixels, for a photo or a video."),
20464
- height: external_exports.int().positive().optional().describe("Pixels, for a photo or a video."),
20465
- duration_ms: external_exports.int().nonnegative().optional().describe("Milliseconds, for a sound or a video."),
20466
- replaces: id("attachment").optional().describe("In one name's versions (`?name=`): the version this one was made from, as its post said (`message.post.replaces`). Absent where the post said nothing, or named no version of this file."),
20467
- url: external_exports.url().optional().describe("For a harness: a signed URL for this version, bound to its token, as a message's attachments are. Absent for a person, who fetches it by id."),
20468
- url_expires_at: isoTimestamp.optional().describe("When `url` stops working.")
20469
- }).describe("One of a room's files at one of its versions: the current one, in the room's list (ADR 0099).");
20470
- var roomFiles = external_exports.array(roomFile).max(ROOM_FILES_CEILING).describe("The current version of each of the room's files, newest first (ADR 0099); or, asked for one name (`?name=`), that name's versions, newest first (ADR 0100).");
20471
- function renderRoomFiles(files) {
20472
- if (files === void 0 || files.length === 0)
20473
- return "";
20474
- const lines2 = files.map((file3) => [file3.name, `v${file3.version}`, `by ${file3.by.name}`, file3.at, file3.url].filter((part) => part !== void 0).join(" \xB7 "));
20475
- return [ROOM_FILES_HEADING, ...lines2].join("\n");
20476
- }
20477
-
20478
20445
  // node_modules/@chipschat/protocol/dist/src/project.js
20479
20446
  var PROJECT_BRANCH = "main";
20480
20447
  function projectPath(spaceId) {
@@ -20628,6 +20595,39 @@ function renderProjectAsks(facts, options) {
20628
20595
  return lines2.join("\n");
20629
20596
  }
20630
20597
 
20598
+ // node_modules/@chipschat/protocol/dist/src/room-files.js
20599
+ var ROOM_FILES_IN_CONTEXT = 20;
20600
+ var ROOM_FILES_CEILING = 200;
20601
+ var ROOM_FILES_HEADING = "Files in this space:";
20602
+ var roomFile = external_exports.object({
20603
+ name: external_exports.string().min(1).max(255).describe("The file's name, which its versions share."),
20604
+ version: external_exports.int().positive().describe("Which version this is: 1 for the first, counting each change of its bytes."),
20605
+ attachment_id: id("attachment").describe("The attachment that is this version: what a post names in `replaces` when it changes it."),
20606
+ sha256: external_exports.string().regex(/^[a-f0-9]{64}$/).describe("Lowercase hex digest of this version's bytes."),
20607
+ byte_size: external_exports.int().nonnegative().describe("Size in bytes."),
20608
+ mime_type: external_exports.string().min(1).max(255).describe("Sniffed from the bytes on upload."),
20609
+ by: external_exports.object({
20610
+ id: external_exports.string().min(1).max(120).describe("Their participant id."),
20611
+ kind: external_exports.enum(["person", "harness", "agent", "system"]),
20612
+ name: external_exports.string().min(1).max(120).describe("What they go by now.")
20613
+ }).describe("Who posted this version, as a line's `from` says it."),
20614
+ at: isoTimestamp.describe("When this version was posted."),
20615
+ message_id: id("message").optional().describe("The message that posted this version."),
20616
+ width: external_exports.int().positive().optional().describe("Pixels, for a photo or a video."),
20617
+ height: external_exports.int().positive().optional().describe("Pixels, for a photo or a video."),
20618
+ duration_ms: external_exports.int().nonnegative().optional().describe("Milliseconds, for a sound or a video."),
20619
+ replaces: id("attachment").optional().describe("In one name's versions (`?name=`): the version this one was made from, as its post said (`message.post.replaces`). Absent where the post said nothing, or named no version of this file."),
20620
+ url: external_exports.url().optional().describe("For a harness: a signed URL for this version, bound to its token, as a message's attachments are. Absent for a person, who fetches it by id."),
20621
+ url_expires_at: isoTimestamp.optional().describe("When `url` stops working.")
20622
+ }).describe("One of a room's files at one of its versions: the current one, in the room's list (ADR 0099).");
20623
+ var roomFiles = external_exports.array(roomFile).max(ROOM_FILES_CEILING).describe("The current version of each of the room's files, newest first (ADR 0099); or, asked for one name (`?name=`), that name's versions, newest first (ADR 0100).");
20624
+ function renderRoomFiles(files) {
20625
+ if (files === void 0 || files.length === 0)
20626
+ return "";
20627
+ const lines2 = files.map((file3) => [file3.name, `v${file3.version}`, `by ${file3.by.name}`, file3.at, file3.url].filter((part) => part !== void 0).join(" \xB7 "));
20628
+ return [ROOM_FILES_HEADING, ...lines2].join("\n");
20629
+ }
20630
+
20631
20631
  // node_modules/@chipschat/protocol/dist/src/spend.js
20632
20632
  var SPEND_CEILING_MIN = 0.25;
20633
20633
  var SPEND_CEILING_MAX = 1e3;
@@ -20676,6 +20676,7 @@ var roomNote = external_exports.object({
20676
20676
  members: external_exports.array(roomMember).max(500).describe("The room's people, then its agents, each by name, anybody removed left out."),
20677
20677
  notes: external_exports.record(external_exports.string().max(120), external_exports.string().max(64e3)).describe("The note for each who takes the turn (`for`), by their id: who is here, with handles, and that only those @-mentioned act. A harness puts it at the top of the turn."),
20678
20678
  rules: external_exports.record(external_exports.string().max(120), external_exports.string().max(4e3)).optional().describe("How the space works, for each who takes the turn, by their id: the words its note ends with (ADR 0250), that everyone here reads what it writes and, beside other agents, what an @ does and when to answer NO_REPLY. They stay the same while the space's agents do, so a harness whose session keeps its earlier turns may say them once, and the note without them after."),
20679
+ about_message: external_exports.record(external_exports.string().max(120), external_exports.string().max(4e3)).optional().describe("What Chips says of this message to each who takes the turn, by their id: the words their note opens with when it has any. They say that the message is theirs though nothing @-mentions them, that it went to several agents or to all, that it comes to the lead as nobody's turn, that the agent it was for has not picked it up, or that it arrives late. A harness may say them beside the message and the note without them (`noteAndAbout`), as the SDK's `promptFor` does: on a session's first turn the note is far above the message. Absent when no taker's note says anything of the message."),
20679
20680
  working: external_exports.array(roomWork).max(500).optional().describe("The room's agents with a turn going as Chips sends this one (ADR 0104), the takers' own included. A turn nothing has been heard from for ten minutes is not counted."),
20680
20681
  idle: external_exports.array(roomIdle).max(500).optional().describe("The room's other agents that have had a turn here: how long since the last one ended (ADR 0104)."),
20681
20682
  away: external_exports.array(roomAway).max(500).optional().describe("The room's agents that can't answer as Chips sends this turn (ADR 0291): offline, or their harness says something is wrong. Work handed to one of them waits.")
@@ -20687,6 +20688,13 @@ function noteWithoutRules(room, taker) {
20687
20688
  return note;
20688
20689
  return note.slice(0, note.length - rules.length).trimEnd();
20689
20690
  }
20691
+ function noteAndAbout(note, room, taker) {
20692
+ const about = room?.about_message?.[taker];
20693
+ if (note === void 0 || about === void 0 || about === "" || !note.startsWith(about)) {
20694
+ return { note, about: void 0 };
20695
+ }
20696
+ return { note: note.slice(about.length).trimStart(), about };
20697
+ }
20690
20698
  var MONTHS = [
20691
20699
  "January",
20692
20700
  "February",
@@ -20726,6 +20734,10 @@ var contextLine = external_exports.object({
20726
20734
  transcript: external_exports.string().max(MAX_TRANSCRIPT_LENGTH).optional().describe("On `said`: what a voice note said, as the server heard it (ADR 0054)."),
20727
20735
  files: external_exports.array(external_exports.string().min(1).max(255)).max(20).optional().describe("On `said`: the names of the files it carried."),
20728
20736
  addressed_to: external_exports.array(agentId).max(64).optional().describe("On `said`: the agents it was for (ADR 0081, ADR 0087), so a harness can leave out a line one of its agents already took a turn on. Absent on a message from before Chips said so."),
20737
+ to: external_exports.array(external_exports.object({
20738
+ id: agentId.describe("One of `addressed_to`."),
20739
+ name: external_exports.string().min(1).max(120).describe("What it goes by now.")
20740
+ })).max(64).optional().describe("On `said`: the agents it was for, each by what it goes by now, in `addressed_to`'s order. The plain form says them when the line was for an agent other than the one reading it, `Arjun, to Scout: \u2026`: a person's pick in the field leaves no @ in the words. Absent when it was for no agent, and from a Chips before it."),
20729
20741
  held: external_exports.literal(true).optional().describe("On `said`: the guard held it (ADR 0081), so it was for nobody."),
20730
20742
  name: external_exports.string().min(1).max(120).optional().describe("On `renamed`, for a participant: the name they took."),
20731
20743
  previous: external_exports.string().min(1).max(120).optional().describe("On `renamed`, for a participant: the name they went by until then."),
@@ -20767,11 +20779,18 @@ function wordsOf(line) {
20767
20779
  parts.push("(held by Chips until a person acts)");
20768
20780
  return parts.filter((part) => part !== "").join(" ");
20769
20781
  }
20770
- function renderLine(line) {
20782
+ function toWords(line, taker) {
20783
+ const to = line.to ?? [];
20784
+ const others = to.filter((each) => each.id !== taker).map((each) => each.name);
20785
+ if (others.length === 0)
20786
+ return "";
20787
+ return `, to ${namesInWords(others.length === to.length ? others : ["you", ...others])}`;
20788
+ }
20789
+ function renderLine(line, reading) {
20771
20790
  const name = line.from.name;
20772
20791
  switch (line.kind) {
20773
20792
  case "said":
20774
- return `${withRole(name, line.from)}: ${wordsOf(line)}`;
20793
+ return `${withRole(name, line.from)}${toWords(line, reading?.taker)}: ${wordsOf(line)}`;
20775
20794
  case "joined":
20776
20795
  return `(${name} joined the space)`;
20777
20796
  case "left":
@@ -20786,10 +20805,10 @@ function renderLine(line) {
20786
20805
  return `(${name} unarchived the space)`;
20787
20806
  }
20788
20807
  }
20789
- function renderContext(context) {
20808
+ function renderContext(context, reading) {
20790
20809
  if (context === void 0)
20791
20810
  return "";
20792
- const said = context.lines.length === 0 ? "" : [CONTEXT_HEADING, ...context.lines.map(renderLine)].join("\n");
20811
+ const said = context.lines.length === 0 ? "" : [CONTEXT_HEADING, ...context.lines.map((line) => renderLine(line, reading))].join("\n");
20793
20812
  return [said, renderRoomFiles(context.files)].filter((part) => part !== "").join("\n\n");
20794
20813
  }
20795
20814
  function renderAttachment(file3) {
@@ -20808,7 +20827,8 @@ function renderReplyingTo(replying, reading) {
20808
20827
  `${replier} is replying to ${whose} from ${saidWhen(replying.at, reading)}${gone}.`
20809
20828
  ];
20810
20829
  if (replying.before !== void 0 && replying.before.length > 0) {
20811
- said.push(REPLY_BEFORE_HEADING, ...replying.before.map(renderLine));
20830
+ const reader = { taker: reading.taker };
20831
+ said.push(REPLY_BEFORE_HEADING, ...replying.before.map((line) => renderLine(line, reader)));
20812
20832
  }
20813
20833
  if (replying.deleted === true)
20814
20834
  return said.join("\n");
@@ -25958,19 +25978,32 @@ function heldWords(answer, released = false) {
25958
25978
  return `Your last message in this space was held, so the agents it named do not have it yet: messages between the agents here are held${since} until a person acts. Until then, tell the person what is done and what is blocked, rather than asking the agents again.`;
25959
25979
  }
25960
25980
  var BEFORE_HEADING = "Said in this space before you joined:";
25961
- function beforeOf(message, options) {
25981
+ function beforeOf(message, options, taker) {
25962
25982
  const said = /* @__PURE__ */ new Set([
25963
25983
  message.message_id,
25964
25984
  ...(options.earlier ?? []).map((each) => each.message_id)
25965
25985
  ]);
25966
25986
  const lines2 = (options.before?.lines ?? []).filter((line) => line.message_id === void 0 || !said.has(line.message_id));
25967
- return lines2.length === 0 ? void 0 : [BEFORE_HEADING, ...lines2.map(renderLine)].join("\n");
25987
+ return lines2.length === 0 ? void 0 : [BEFORE_HEADING, ...lines2.map((line) => renderLine(line, { taker }))].join("\n");
25968
25988
  }
25969
25989
  function waitedWords(count) {
25970
25990
  return `${count} messages for you waited while you were working or away. They follow, oldest first. Answer them together in one reply, and where a later one changes or settles an earlier one, go by the later.`;
25971
25991
  }
25992
+ function forWords(message, taker) {
25993
+ if (taker === void 0 || !othersBeside(message, taker))
25994
+ return "";
25995
+ const members2 = message.room?.members ?? [];
25996
+ const to = (message.addressed_to ?? []).flatMap((id2) => {
25997
+ const member = members2.find((each) => each.participant_id === id2);
25998
+ return member === void 0 ? [] : [{ id: id2, name: member.name }];
25999
+ });
26000
+ if (to.length === 0)
26001
+ return "";
26002
+ const others = to.filter((each) => each.id !== taker).map((each) => each.name);
26003
+ return `, to ${namesInWords(others.length === to.length ? others : ["you", ...others])}`;
26004
+ }
25972
26005
  function saidOf(message, options, taker) {
25973
- const who2 = options.sayWho === false ? "" : `${withRole(message.from.display_name, message.from)}: `;
26006
+ const who2 = options.sayWho === false ? "" : `${withRole(message.from.display_name, message.from)}${forWords(message, taker)}: `;
25974
26007
  const files = (message.attachments ?? []).map(renderAttachment);
25975
26008
  const replying = renderReplyingTo(message.replying_to, {
25976
26009
  sender: {
@@ -26003,7 +26036,8 @@ function promptFor(message, options = {}) {
26003
26036
  const held = options.rulesHeld === true;
26004
26037
  const earlier = options.earlier ?? [];
26005
26038
  const notes = message.room?.notes ?? {};
26006
- const note = taker === void 0 ? void 0 : held ? noteWithoutRules(message.room, taker) : notes[taker];
26039
+ const whole2 = taker === void 0 ? void 0 : held ? noteWithoutRules(message.room, taker) : notes[taker];
26040
+ const { note, about } = taker === void 0 ? { note: whole2, about: void 0 } : noteAndAbout(whole2, message.room, taker);
26007
26041
  const sending = options.sendsFiles === true && !held ? sendingFiles({ project: options.project !== void 0 }) : void 0;
26008
26042
  const project = options.project === void 0 ? void 0 : held ? renderProjectFacts(options.project) : renderProjectNote(options.project, { othersInRoom: othersBeside(message, taker) });
26009
26043
  return [
@@ -26013,10 +26047,12 @@ function promptFor(message, options = {}) {
26013
26047
  note,
26014
26048
  project,
26015
26049
  sending,
26016
- beforeOf(message, options),
26017
- renderContext(contextOf(message, options)),
26050
+ beforeOf(message, options, taker),
26051
+ // A line for another agent says whom it was for; one for the taker alone does not.
26052
+ renderContext(contextOf(message, options), { taker }),
26018
26053
  earlier.length === 0 ? void 0 : waitedWords(earlier.length + 1),
26019
26054
  ...earlier.flatMap((each) => saidOf(each, options, taker)),
26055
+ about,
26020
26056
  ...saidOf(message, options, taker),
26021
26057
  sinceOf(options)
26022
26058
  ].filter((part) => part !== void 0 && part !== "").join("\n\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipschat/acp",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
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.7",
37
- "@chipschat/harness": "1.0.7",
38
- "@chipschat/protocol": "1.0.7",
36
+ "@chipschat/conformance": "1.0.9",
37
+ "@chipschat/harness": "1.0.9",
38
+ "@chipschat/protocol": "1.0.9",
39
39
  "@types/node": "22.19.0",
40
40
  "esbuild": "0.27.7",
41
41
  "tsx": "4.21.0",