@chipschat/acp 1.0.10 → 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.
package/README.md CHANGED
@@ -8,8 +8,8 @@ runs the agent's process, so the bridge is the harness (Chips ADR 0041), built o
8
8
  Phase 4 of Chips's `docs/proposals/open-source-harnesses-plan.md`, and Chips's
9
9
  `docs/proposals/acp-agents-made-from-chips-plan.md`.
10
10
 
11
- Local only: no remote, nothing published. The `@chipschat/*` packages come from `vendor/`, packed from
12
- the Chips repo with `pnpm release:sdk`.
11
+ The `@chipschat/*` SDK packages come from npm, at the version `package.json` pins, and the build
12
+ bundles them into `dist/main.js`.
13
13
 
14
14
  ## From Chips's gallery
15
15
 
@@ -1,9 +1,9 @@
1
1
  # Third-party notices
2
2
 
3
- `dist/main.js` in @chipschat/acp 1.0.10 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 0.0.0 (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 0.0.0 (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
@@ -20354,7 +20354,14 @@ var HARNESS_CAPABILITIES = {
20354
20354
  * and `context_window.change`, does them in its own way, and answers with its copy. What makes
20355
20355
  * an agent's Context window group worth drawing.
20356
20356
  */
20357
- contextWindows: "context_windows"
20357
+ contextWindows: "context_windows",
20358
+ /**
20359
+ * The harness sends Chips a copy of the jobs it runs on its own, outside any space, and posts
20360
+ * each run with what it cost, and takes a person's switch (ADR 0252): a socket of it says `jobs`
20361
+ * in its `hello`, hears `job.change`, switches the job in its own way, and answers with its
20362
+ * copy. What makes the harness page's "Its own jobs" group worth drawing.
20363
+ */
20364
+ jobs: "jobs"
20358
20365
  };
20359
20366
 
20360
20367
  // node_modules/@chipschat/protocol/dist/src/connectors.js
@@ -20519,7 +20526,7 @@ var contextLine = external_exports.object({
20519
20526
  }).describe("One line of a room: something said, or something that happened to who is in it.");
20520
20527
  var roomContext = external_exports.object({
20521
20528
  lines: external_exports.array(contextLine).max(CONTEXT_CEILING.lines).describe("Oldest first, the newest that fit the budget."),
20522
- 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."),
20523
20530
  truncated: external_exports.boolean().describe("Whether older lines after `since_seq` were left out to fit the budget."),
20524
20531
  before: external_exports.int().positive().describe("A cursor: `GET /v1/spaces/:id/context?before=` this reads what came before these lines."),
20525
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."),
@@ -21667,6 +21674,7 @@ var pairingPayload = external_exports.object({
21667
21674
  var JOIN_POLL_SECONDS = 3;
21668
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).");
21669
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");
21670
21678
  var requestCode = external_exports.union([pairingCode, keyCode]);
21671
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.");
21672
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.");
@@ -21702,12 +21710,15 @@ var joinAsk = external_exports.object({
21702
21710
  software: words2(120).optional(),
21703
21711
  machine: words2(120).optional(),
21704
21712
  wants: capabilities.optional().describe("For a harness: what it asks to be allowed."),
21705
- 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.")
21706
21715
  }).describe("A request to join.");
21707
21716
  var joinAsked = external_exports.object({
21708
21717
  request_id: id("join"),
21709
21718
  secret: external_exports.string().min(16).max(200).describe("The requester's alone: it polls with it."),
21710
- 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)."),
21711
21722
  expires_in: external_exports.int().positive().describe("Seconds until it expires."),
21712
21723
  interval: external_exports.int().positive().describe("Seconds between polls.")
21713
21724
  });
@@ -22530,6 +22541,126 @@ var AGENT_FIRST_NAMES = [
22530
22541
  "Zaid Zane Zeke Zeno Zev Ziggy"
22531
22542
  ].flatMap((line) => line.split(" "));
22532
22543
 
22544
+ // node_modules/@chipschat/protocol/dist/src/harness-jobs.js
22545
+ var HARNESS_JOBS_MAX = 24;
22546
+ var JOB_CHOICES_MAX = 12;
22547
+ var JOB_EVERY_MAX = 525600;
22548
+ var JOB_RUNS_POST_MAX = 200;
22549
+ var JOB_KINDS = ["heartbeat", "memory", "skills", "other"];
22550
+ var jobKind = external_exports.enum(JOB_KINDS);
22551
+ var JOB_RUN_OUTCOMES = ["done", "failed", "stopped"];
22552
+ var jobRunOutcome = external_exports.enum(JOB_RUN_OUTCOMES);
22553
+ var jobId = external_exports.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$/, "expected a job id").describe("The harness's own id for a job: stable, up to 80 letters, digits, `.`, `_`, `:` or `-`.");
22554
+ var minutes2 = external_exports.int().min(1).max(JOB_EVERY_MAX);
22555
+ var ascending3 = (choices) => choices.every((each, at) => at === 0 || each > (choices[at - 1] ?? 0));
22556
+ var jobFields = {
22557
+ job_id: jobId,
22558
+ name: external_exports.string().min(1).max(40).describe('What the harness calls it: "Dreaming".'),
22559
+ about: external_exports.string().min(1).max(240).describe("What it does, in a sentence, for its page."),
22560
+ kind: jobKind.describe("What it does, for its mark: `other` for anything else."),
22561
+ every: minutes2.optional().describe("How often it runs, in minutes. Chips says it in words, with `next_at` for the time of day."),
22562
+ when: external_exports.string().min(1).max(60).optional().describe("How often, in the harness's words, for a schedule that is not an interval."),
22563
+ next_at: isoTimestamp.optional().describe("When it runs next, while it is on."),
22564
+ for_agents: external_exports.array(id("agent")).max(200).optional().describe("The harness's agents it runs for, if it runs for some rather than the harness."),
22565
+ on: external_exports.boolean().describe("Whether it runs now."),
22566
+ editable: external_exports.boolean().describe("Whether a person may switch it from Chips."),
22567
+ why_read_only: external_exports.string().min(1).max(120).optional().describe("Why not, in the harness's words, only when it is not `editable`."),
22568
+ choices: external_exports.array(minutes2).min(1).max(JOB_CHOICES_MAX).refine(ascending3, { message: "The intervals go up, each named once." }).optional().describe("The intervals a person may pick, in minutes, shortest first, `every` among them.")
22569
+ };
22570
+ var harnessJob = external_exports.object(jobFields).refine((job) => job.every !== void 0 || job.when !== void 0, {
22571
+ path: ["every"],
22572
+ message: "Say how often it runs: `every` in minutes, or `when` in words."
22573
+ }).refine((job) => job.choices === void 0 || job.choices.includes(job.every ?? -1), {
22574
+ path: ["choices"],
22575
+ message: "`every` is one of `choices`."
22576
+ }).refine((job) => job.why_read_only === void 0 || !job.editable, {
22577
+ path: ["why_read_only"],
22578
+ message: "Say why only for a job that can't be switched."
22579
+ });
22580
+ var uniqueJobs = (jobs) => new Set(jobs.map((job) => job.job_id)).size === jobs.length;
22581
+ var harnessJobsPut = external_exports.object({
22582
+ jobs: external_exports.array(harnessJob).max(HARNESS_JOBS_MAX).refine(uniqueJobs, { message: "Each job is named once." }).describe("Every job the harness runs on its own, whole: one left out is gone, runs and all."),
22583
+ answers: id("change").optional().describe("The change this copy answers: made, and these are the jobs as they are now."),
22584
+ refuses: external_exports.object({
22585
+ change_id: id("change"),
22586
+ message: external_exports.string().min(1).max(300).optional().describe("Why not, for the person.")
22587
+ }).optional().describe("A change not made. The copy beside it is the jobs as they are now.")
22588
+ }).describe("`PUT /v1/harnesses/:id/jobs`: a harness's copy of the jobs it runs on its own.");
22589
+ var jobRun = external_exports.object({
22590
+ job_id: jobId,
22591
+ run_id: external_exports.string().min(1).max(160).describe("The harness's own id for the run."),
22592
+ started_at: isoTimestamp,
22593
+ ended_at: isoTimestamp,
22594
+ outcome: jobRunOutcome.describe("`done`, `failed`, or `stopped` when something else ended it, such as a restart."),
22595
+ quiet: external_exports.boolean().optional().describe("It did its work and had nothing to say: a heartbeat with nothing for anyone."),
22596
+ waited: external_exports.boolean().optional().describe("It waited for an approval that nobody gave."),
22597
+ error: external_exports.string().min(1).max(200).optional().describe("What went wrong, in the harness's words, for a run that failed or was stopped."),
22598
+ agent_id: id("agent").optional().describe("The agent it ran for, when it runs for some."),
22599
+ cost_usd: external_exports.number().min(0).max(1e4).optional().describe("What it cost, as the harness priced it: absent when the harness doesn't know."),
22600
+ tokens: external_exports.int().min(0).optional().describe("Its tokens, in and out."),
22601
+ model: external_exports.string().min(1).max(80).optional().describe("The model it ran on, in its words.")
22602
+ }).refine((run2) => Date.parse(run2.ended_at) >= Date.parse(run2.started_at), {
22603
+ path: ["ended_at"],
22604
+ message: "A run ends after it starts."
22605
+ }).describe("One run of a job, once it ended.");
22606
+ var jobRunsPost = external_exports.object({ runs: external_exports.array(jobRun).min(1).max(JOB_RUNS_POST_MAX) }).describe("`POST /v1/harnesses/:id/jobs/runs`: runs the harness finished. A run posted again says what it says over what was posted before, and what it leaves out stays: so a run may be posted once more with its cost, and never loses one.");
22607
+ var jobChangeAsk = external_exports.object({
22608
+ on: external_exports.boolean(),
22609
+ every: minutes2.optional().describe("One of the job's choices; its own when left out.")
22610
+ }).describe("`POST /v1/harnesses/:id/jobs/:job/changes`: on or off, and how often.");
22611
+ var JOB_CHANGE_STATES = ["waiting", "saved", "failed", "missed"];
22612
+ var jobChangeState = external_exports.enum(JOB_CHANGE_STATES);
22613
+ var jobChangeView = external_exports.object({
22614
+ change_id: id("change"),
22615
+ state: jobChangeState.describe("`missed` once `JOB_CHANGE_WAIT_MS` has passed with no answer; read, never stored."),
22616
+ on: external_exports.boolean(),
22617
+ every: minutes2.optional(),
22618
+ asked_at: isoTimestamp,
22619
+ answered_at: isoTimestamp.optional(),
22620
+ message: external_exports.string().max(300).optional().describe("The harness's words, for a refusal.")
22621
+ }).describe("The last change a person asked of a job, and what became of it (ADR 0252).");
22622
+ var harnessJobView = external_exports.object({
22623
+ ...jobFields,
22624
+ week_usd: external_exports.number().min(0).optional().describe("What its runs of the last seven days cost: absent when none of them had a cost."),
22625
+ week_runs: external_exports.int().min(0).describe("How many runs it made in the last seven days."),
22626
+ runs_total: external_exports.int().min(0).describe("How many of its runs Chips holds."),
22627
+ last_run: jobRun.optional(),
22628
+ change: jobChangeView.optional()
22629
+ }).describe("One job as a person reads it: the harness's copy, what Chips counted, its change.");
22630
+ var harnessJobsView = external_exports.object({
22631
+ harness_id: id("harness"),
22632
+ jobs: external_exports.array(harnessJobView),
22633
+ read_at: isoTimestamp.describe("When the harness last sent its copy."),
22634
+ away: external_exports.boolean().describe("No socket of the harness hears changes now: read, not switched.")
22635
+ }).describe("`GET /v1/harnesses/:id/jobs`, for the harness's owner or an admin.");
22636
+ var jobRunsView = external_exports.object({
22637
+ harness_id: id("harness"),
22638
+ job_id: jobId,
22639
+ runs: external_exports.array(jobRun).describe("Newest first."),
22640
+ more: external_exports.boolean().describe("Whether older runs are left, for `before` the last one's start.")
22641
+ }).describe("`GET /v1/harnesses/:id/jobs/:job/runs?since=&before=&limit=`.");
22642
+ var jobChangeFrame = external_exports.object({
22643
+ frame: external_exports.literal("job.change"),
22644
+ change_id: id("change"),
22645
+ harness_id: id("harness"),
22646
+ job_id: jobId,
22647
+ on: external_exports.boolean(),
22648
+ every: minutes2.optional().describe("For a job with choices: one of them, the copy's own when the person named none."),
22649
+ asked_by: id("person"),
22650
+ asked_at: isoTimestamp
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`.");
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
+
22533
22664
  // node_modules/@chipschat/protocol/dist/src/frames.js
22534
22665
  var clientHelloFrame = external_exports.object({
22535
22666
  frame: external_exports.literal("hello"),
@@ -22546,7 +22677,7 @@ var clientHelloFrame = external_exports.object({
22546
22677
  autonomy: autonomyLevel.optional().describe("The level the harness believes it has.")
22547
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."),
22548
22679
  since: external_exports.int().nonnegative().optional().describe("Not read by Chips: a stream resumes from `subscribe`'s `since`."),
22549
- 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 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."),
22550
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.")
22551
22682
  }).describe("The first frame a client sends.");
22552
22683
  var subscribeFrame = external_exports.object({
@@ -22672,11 +22803,13 @@ var serverFrame = external_exports.discriminatedUnion("frame", [
22672
22803
  folderOpenFrame,
22673
22804
  folderRunFrame,
22674
22805
  folderRunStateFrame,
22806
+ readFrame,
22675
22807
  contextEditFrame,
22676
22808
  modelChangeFrame,
22677
22809
  heartbeatChangeFrame,
22678
22810
  windowCompactFrame,
22679
22811
  windowChangeFrame,
22812
+ jobChangeFrame,
22680
22813
  pingFrame,
22681
22814
  pongFrame,
22682
22815
  errorFrame
@@ -22722,9 +22855,37 @@ var HTML_POLICY = "default-src 'none'; img-src data: blob:; font-src data:; medi
22722
22855
  var PAGE_SANDBOX = "allow-scripts allow-popups allow-popups-to-escape-sandbox";
22723
22856
  var PAGE_HEADER_POLICY = `${HTML_POLICY}; sandbox ${PAGE_SANDBOX}`;
22724
22857
 
22725
- // node_modules/@chipschat/harness/dist/connect.js
22726
- import { readFile as readFile2 } from "node:fs/promises";
22727
- 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])));
22728
22889
 
22729
22890
  // node_modules/@chipschat/harness/dist/asks.js
22730
22891
  var Asks = class {
@@ -22759,10 +22920,7 @@ var Asks = class {
22759
22920
  const from = event["from"];
22760
22921
  if (!this.listener.listening() || from?.kind !== "person")
22761
22922
  return false;
22762
- this.hand(spaceId, room, {
22763
- messageId: String(event["message_id"]),
22764
- text: String(event["text"] ?? "")
22765
- });
22923
+ this.hand(spaceId, room, { messageId: String(event["message_id"]), text: String(event["text"] ?? "") }, event);
22766
22924
  return true;
22767
22925
  }
22768
22926
  /**
@@ -22798,11 +22956,42 @@ var Asks = class {
22798
22956
  this.rooms.set(spaceId, room);
22799
22957
  return room;
22800
22958
  }
22801
- hand(spaceId, room, first) {
22959
+ hand(spaceId, room, first, message) {
22802
22960
  room.first = first.messageId;
22803
- 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
+ });
22804
22967
  }
22805
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
+ }
22806
22995
  function firstWords(history) {
22807
22996
  for (const event of history) {
22808
22997
  const actor2 = event["actor"];
@@ -22813,6 +23002,10 @@ function firstWords(history) {
22813
23002
  return void 0;
22814
23003
  }
22815
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
+
22816
23009
  // node_modules/@chipschat/harness/dist/events.js
22817
23010
  var Emitter = class {
22818
23011
  handlers = /* @__PURE__ */ new Map();
@@ -23804,6 +23997,14 @@ var Run = class {
23804
23997
  ...cost2(input2.costUsd)
23805
23998
  });
23806
23999
  }
24000
+ /**
24001
+ * That this turn heard a message said in the room while it worked (ADR 0106): one that
24002
+ * `message.overheard` named this run for in `working_turns`, handed to the turn at a step. The
24003
+ * room shows its agent heard it while working. Say it once the turn has the words, never before.
24004
+ */
24005
+ heard(messageId) {
24006
+ return this.wire.send("message.heard", { message_id: messageId });
24007
+ }
23807
24008
  checkpoint(label2, next, compacted) {
23808
24009
  return this.wire.send("checkpoint", {
23809
24010
  label: label2,
@@ -23853,7 +24054,8 @@ function acceptsFor(handlers) {
23853
24054
  ...handlers.context === void 0 ? [] : ["context"],
23854
24055
  ...handlers.models === void 0 ? [] : ["models"],
23855
24056
  ...handlers.heartbeats === void 0 ? [] : ["heartbeats"],
23856
- ...handlers.contextWindows === void 0 ? [] : ["context_windows"]
24057
+ ...handlers.contextWindows === void 0 ? [] : ["context_windows"],
24058
+ ...handlers.jobs === void 0 ? [] : ["jobs"]
23857
24059
  ];
23858
24060
  }
23859
24061
  var PATHS = {
@@ -23861,28 +24063,32 @@ var PATHS = {
23861
24063
  "harness-context": (id2) => `/v1/harnesses/${encodeURIComponent(id2)}/context`,
23862
24064
  model: (id2) => `/v1/agents/${encodeURIComponent(id2)}/model`,
23863
24065
  heartbeat: (id2) => `/v1/agents/${encodeURIComponent(id2)}/heartbeat`,
23864
- "context-window": (id2) => `/v1/agents/${encodeURIComponent(id2)}/context-window`
24066
+ "context-window": (id2) => `/v1/agents/${encodeURIComponent(id2)}/context-window`,
24067
+ jobs: (id2) => `/v1/harnesses/${encodeURIComponent(id2)}/jobs`
23865
24068
  };
23866
24069
  var FRAMES = {
23867
24070
  "context.edit": contextEditFrame,
23868
24071
  "model.change": modelChangeFrame,
23869
24072
  "heartbeat.change": heartbeatChangeFrame,
23870
24073
  "context_window.compact": windowCompactFrame,
23871
- "context_window.change": windowChangeFrame
24074
+ "context_window.change": windowChangeFrame,
24075
+ "job.change": jobChangeFrame
23872
24076
  };
23873
24077
  var Settings = class {
23874
24078
  put;
23875
24079
  harnessId;
23876
24080
  handlers;
24081
+ post;
23877
24082
  /** The copy last given for each `kind:id`, for a refusal to carry. */
23878
24083
  sent = /* @__PURE__ */ new Map();
23879
24084
  /** The copy Chips last took for each `kind:id`, as JSON. */
23880
24085
  landed = /* @__PURE__ */ new Map();
23881
24086
  chains = /* @__PURE__ */ new Map();
23882
- constructor(put, harnessId, handlers) {
24087
+ constructor(put, harnessId, handlers, post) {
23883
24088
  this.put = put;
23884
24089
  this.harnessId = harnessId;
23885
24090
  this.handlers = handlers;
24091
+ this.post = post;
23886
24092
  }
23887
24093
  /** An agent's context files (`context_files`). */
23888
24094
  context(agentId2, copy) {
@@ -23904,6 +24110,24 @@ var Settings = class {
23904
24110
  contextWindow(agentId2, copy) {
23905
24111
  return this.send("context-window", agentId2, copy, {});
23906
24112
  }
24113
+ /** The jobs the harness runs on its own, all of them (`jobs`). */
24114
+ jobs(copy) {
24115
+ return this.send("jobs", this.harnessId(), copy, {});
24116
+ }
24117
+ /**
24118
+ * Runs of its jobs the harness finished (`jobs`), two hundred to a post. A run sent again says
24119
+ * what it says over the one before, and what it leaves out stays, so send it once more when its
24120
+ * cost is known, and again without one does no harm. Send the copy first:
24121
+ * Chips refuses runs of a job its copy doesn't list.
24122
+ */
24123
+ async jobRuns(runs) {
24124
+ if (this.post === void 0)
24125
+ throw new Error("This connection can't post a job's runs.");
24126
+ const path = `${PATHS.jobs(this.harnessId())}/runs`;
24127
+ for (let at = 0; at < runs.length; at += JOB_RUNS_POST_MAX) {
24128
+ await this.post(path, { runs: runs.slice(at, at + JOB_RUNS_POST_MAX) });
24129
+ }
24130
+ }
23907
24131
  /** An agent deleted: nothing is remembered of it, so a copy for an agent made again is sent. */
23908
24132
  forget(agentId2) {
23909
24133
  for (const kind2 of Object.keys(PATHS)) {
@@ -23951,6 +24175,8 @@ var Settings = class {
23951
24175
  return this.answer("model", frame.agent_id, frame.change_id, "change_id", () => handlers?.models?.(frame));
23952
24176
  case "heartbeat.change":
23953
24177
  return this.answer("heartbeat", frame.agent_id, frame.change_id, "change_id", () => handlers?.heartbeats?.(frame));
24178
+ case "job.change":
24179
+ return this.answer("jobs", this.harnessId(), frame.change_id, "change_id", () => handlers?.jobs?.(frame));
23954
24180
  case "context_window.compact":
23955
24181
  return this.answer("context-window", frame.agent_id, frame.change_id, "change_id", () => handlers?.contextWindows?.compact(frame));
23956
24182
  default:
@@ -24066,7 +24292,7 @@ var Chips = class _Chips {
24066
24292
  this.outbox.add(String(event["idempotency_key"]), event).catch(() => void 0);
24067
24293
  }
24068
24294
  this.orphans = [...kept2?.runs ?? []];
24069
- this.settings = new Settings((path, body) => this.request("PUT", path, body), () => this.harnessId, options.settings);
24295
+ this.settings = new Settings((path, body) => this.request("PUT", path, body), () => this.harnessId, options.settings, (path, body) => this.request("POST", path, body));
24070
24296
  }
24071
24297
  /**
24072
24298
  * The harness's copies of what a person changes from an agent's page (ADRs 0134, 0140, 0143,
@@ -26229,7 +26455,7 @@ var ContextFiles = class {
26229
26455
  };
26230
26456
 
26231
26457
  // src/kinds.ts
26232
- var KNOWN = [
26458
+ var KNOWN2 = [
26233
26459
  {
26234
26460
  id: "claude-code",
26235
26461
  name: "Claude Code",
@@ -26252,12 +26478,12 @@ var KNOWN = [
26252
26478
  }
26253
26479
  ];
26254
26480
  function knownConfig(id2) {
26255
- const known = KNOWN.find((each) => each.id === id2);
26481
+ const known = KNOWN2.find((each) => each.id === id2);
26256
26482
  return known === void 0 ? void 0 : { name: known.name, command: [known.program], mode: known.mode };
26257
26483
  }
26258
26484
  var knownBy = (kind2) => {
26259
26485
  const program = kind2.command[0]?.split("/").pop();
26260
- return KNOWN.find((each) => each.program === program);
26486
+ return KNOWN2.find((each) => each.program === program);
26261
26487
  };
26262
26488
  function knownIdOf(kind2) {
26263
26489
  return knownBy(kind2)?.id;
@@ -26410,7 +26636,7 @@ var HEADROOM = 33e3;
26410
26636
  var LEAST_WINDOW = 1e5;
26411
26637
  var COMPACT_TITLE = "Compact conversation";
26412
26638
  var CODEX_COMPACTED = "*Context compacted to fit the model's context window.*";
26413
- var ascending3 = (values) => [...new Set(values)].sort((a, b) => a - b);
26639
+ var ascending4 = (values) => [...new Set(values)].sort((a, b) => a - b);
26414
26640
  function percentOf(tokens2, window) {
26415
26641
  const at = Math.round((Math.min(tokens2, window) - HEADROOM) / window * 100);
26416
26642
  return Math.min(99, Math.max(1, at));
@@ -26437,7 +26663,7 @@ function claudeLimit(kept2, own2) {
26437
26663
  };
26438
26664
  }
26439
26665
  const at = kept2.limit !== void 0 ? kept2.limit : own2.at;
26440
- const choices = ascending3([
26666
+ const choices = ascending4([
26441
26667
  ...LIMITS.filter((each) => reachable(each, kept2.window)),
26442
26668
  ...own2.at === null ? [] : [own2.at],
26443
26669
  ...typeof at === "number" ? [at] : []
@@ -26448,7 +26674,7 @@ function claudeLimit(kept2, own2) {
26448
26674
  function bridgeLimit(kept2) {
26449
26675
  const at = kept2.limit ?? null;
26450
26676
  return {
26451
- limit: { at, choices: ascending3([...LIMITS, ...typeof at === "number" ? [at] : []]), default: null, may_turn_off: true },
26677
+ limit: { at, choices: ascending4([...LIMITS, ...typeof at === "number" ? [at] : []]), default: null, may_turn_off: true },
26452
26678
  editable: true
26453
26679
  };
26454
26680
  }
@@ -26804,7 +27030,7 @@ var Bridge = class {
26804
27030
  return made;
26805
27031
  });
26806
27032
  this.log(`${agent.name} claimed ${spaceId}, in ${record2.folder}`);
26807
- const message = {
27033
+ const message = firstTurnOf(asked, agent.agentId) ?? {
26808
27034
  type: "message.new",
26809
27035
  space_id: spaceId,
26810
27036
  message_id: firstMessage.messageId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipschat/acp",
3
- "version": "1.0.10",
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": "file:vendor/chipschat-conformance-0.0.0.tgz",
37
- "@chipschat/harness": "file:vendor/chipschat-harness-0.0.0.tgz",
38
- "@chipschat/protocol": "file:vendor/chipschat-protocol-0.0.0.tgz",
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",