@chipschat/hermes 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 +6 -4
- package/dist/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/main.js +80 -4
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -218,7 +218,9 @@ the key it kept. The scratch Chips, the link and the run come from Chips's `tool
|
|
|
218
218
|
## Release
|
|
219
219
|
|
|
220
220
|
`npm run release` builds `dist/main.js`, one file with the SDK and everything else bundled in, and
|
|
221
|
-
`dist/THIRD-PARTY-NOTICES.md` beside it; runs the tests; and packs `chipschat-hermes-<version>.tgz`.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
`dist/THIRD-PARTY-NOTICES.md` beside it; runs the tests; and packs `chipschat-hermes-<version>.tgz`. To publish,
|
|
222
|
+
change `version` in package.json (`npm version <x> --no-git-tag-version`), commit, and push to main:
|
|
223
|
+
`.github/workflows/publish.yml` runs the tests and publishes that version from GitHub with npm's
|
|
224
|
+
trusted publishing, and skips a version npm already has. A version's major is the Chips protocol it
|
|
225
|
+
speaks, and Chips's card names that major (Chips ADR 0218): a fix is a minor or a patch, and reaches
|
|
226
|
+
every card of its major the day it is published.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Third-party notices
|
|
2
2
|
|
|
3
|
-
`dist/main.js` in @chipschat/hermes 1.0.
|
|
3
|
+
`dist/main.js` in @chipschat/hermes 1.0.12 carries these packages, bundled in. Each one's
|
|
4
4
|
licence follows.
|
|
5
5
|
|
|
6
6
|
## @chipschat/harness 0.0.0 (Apache-2.0)
|
package/dist/main.js
CHANGED
|
@@ -23807,6 +23807,14 @@ var Run = class {
|
|
|
23807
23807
|
...cost2(input2.costUsd)
|
|
23808
23808
|
});
|
|
23809
23809
|
}
|
|
23810
|
+
/**
|
|
23811
|
+
* That this turn heard a message said in the room while it worked (ADR 0106): one that
|
|
23812
|
+
* `message.overheard` named this run for in `working_turns`, handed to the turn at a step. The
|
|
23813
|
+
* room shows its agent heard it while working. Say it once the turn has the words, never before.
|
|
23814
|
+
*/
|
|
23815
|
+
heard(messageId) {
|
|
23816
|
+
return this.wire.send("message.heard", { message_id: messageId });
|
|
23817
|
+
}
|
|
23810
23818
|
checkpoint(label2, next, compacted) {
|
|
23811
23819
|
return this.wire.send("checkpoint", {
|
|
23812
23820
|
label: label2,
|
|
@@ -24838,6 +24846,25 @@ function connect(options) {
|
|
|
24838
24846
|
return Chips.connect(options);
|
|
24839
24847
|
}
|
|
24840
24848
|
|
|
24849
|
+
// node_modules/@chipschat/harness/dist/heard.js
|
|
24850
|
+
function workingTurnsOf(message) {
|
|
24851
|
+
return (message.working_turns ?? []).map((turn) => ({
|
|
24852
|
+
agentId: turn.agent_id,
|
|
24853
|
+
runId: turn.run_id
|
|
24854
|
+
}));
|
|
24855
|
+
}
|
|
24856
|
+
function overheardLine(message) {
|
|
24857
|
+
const files = message.attachments ?? [];
|
|
24858
|
+
const said2 = files.flatMap((file3) => file3.transcript === void 0 ? [] : [file3.transcript]);
|
|
24859
|
+
const words4 = [
|
|
24860
|
+
message.text.trim(),
|
|
24861
|
+
...said2.map((each) => `(voice note: ${each})`),
|
|
24862
|
+
files.length === 0 ? "" : `(sent ${files.map((file3) => file3.filename).join(", ")})`
|
|
24863
|
+
].filter((part) => part !== "");
|
|
24864
|
+
const who = withRole(message.from.display_name, message.from);
|
|
24865
|
+
return `${who} said in the room, not to you: ${words4.join(" ")}`;
|
|
24866
|
+
}
|
|
24867
|
+
|
|
24841
24868
|
// node_modules/@chipschat/harness/dist/join.js
|
|
24842
24869
|
import { createHash } from "node:crypto";
|
|
24843
24870
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
@@ -27475,6 +27502,8 @@ var Bridge = class {
|
|
|
27475
27502
|
options;
|
|
27476
27503
|
agents = [];
|
|
27477
27504
|
rooms = /* @__PURE__ */ new Map();
|
|
27505
|
+
/** The turns going, by their Chips run, for what is said in their rooms while they work (Chips ADR 0106). */
|
|
27506
|
+
working = /* @__PURE__ */ new Map();
|
|
27478
27507
|
/** Every Chips agent of the harness's, configured here or not. */
|
|
27479
27508
|
ours = /* @__PURE__ */ new Set();
|
|
27480
27509
|
/** The harness's agents' names, by Chips id, for the folders named after them. */
|
|
@@ -27522,6 +27551,7 @@ var Bridge = class {
|
|
|
27522
27551
|
}
|
|
27523
27552
|
this.ours = /* @__PURE__ */ new Set([...known.map((agent) => agent.agentId), ...this.agents.map((agent) => agent.agentId)]);
|
|
27524
27553
|
chips2.on("message.new", (message) => void this.hear(message));
|
|
27554
|
+
chips2.on("message.overheard", (message) => void this.overheard(message));
|
|
27525
27555
|
chips2.on("agent.asked", (asked) => {
|
|
27526
27556
|
this.making = this.making.then(() => this.make(asked)).catch((error62) => this.log(`a new agent went wrong: ${messageOf3(error62)}`));
|
|
27527
27557
|
});
|
|
@@ -28138,8 +28168,20 @@ ${hook.lines}`);
|
|
|
28138
28168
|
counted: 0,
|
|
28139
28169
|
approvals: /* @__PURE__ */ new Map(),
|
|
28140
28170
|
allowed: [],
|
|
28141
|
-
interrupted: false
|
|
28171
|
+
interrupted: false,
|
|
28172
|
+
overheard: []
|
|
28142
28173
|
};
|
|
28174
|
+
this.working.set(run2.id, turn);
|
|
28175
|
+
try {
|
|
28176
|
+
await this.take(turn, room, { message, speakerId, sayWho });
|
|
28177
|
+
} finally {
|
|
28178
|
+
this.working.delete(run2.id);
|
|
28179
|
+
}
|
|
28180
|
+
}
|
|
28181
|
+
/** A turn begun: Hermes's runs of it, from the first words to its end. */
|
|
28182
|
+
async take(turn, room, { message, speakerId, sayWho }) {
|
|
28183
|
+
const { agent } = room;
|
|
28184
|
+
const { run: run2 } = turn;
|
|
28143
28185
|
run2.on("cancel", () => {
|
|
28144
28186
|
turn.cancelled = true;
|
|
28145
28187
|
if (turn.hermesRun !== "") void agent.client.stop(turn.hermesRun).catch(() => void 0);
|
|
@@ -28192,12 +28234,46 @@ ${hook.lines}`);
|
|
|
28192
28234
|
return void 0;
|
|
28193
28235
|
}
|
|
28194
28236
|
if (turn.cancelled) await agent.client.stop(turn.hermesRun).catch(() => void 0);
|
|
28237
|
+
let last;
|
|
28195
28238
|
try {
|
|
28196
|
-
|
|
28197
|
-
return last ?? await this.endOf(turn);
|
|
28239
|
+
last = await agent.client.events(turn.hermesRun, (event) => this.heard(turn, event)) ?? await this.endOf(turn);
|
|
28198
28240
|
} catch (error62) {
|
|
28199
28241
|
this.log(`lost ${agent.config.name}'s run ${turn.hermesRun}: ${messageOf3(error62)}`);
|
|
28200
|
-
|
|
28242
|
+
last = await this.endOf(turn);
|
|
28243
|
+
}
|
|
28244
|
+
await this.toldWhileWorking(turn, last);
|
|
28245
|
+
return last;
|
|
28246
|
+
}
|
|
28247
|
+
/**
|
|
28248
|
+
* Words said in a room, not to the harness, while its agents work there (Chips ADRs 0105, 0106):
|
|
28249
|
+
* each turn Chips names hears them as a steer of its Hermes run, which Hermes gives the model
|
|
28250
|
+
* after the step it is on. A run that won't take a steer is ending, and its agent's next turn is
|
|
28251
|
+
* handed the words.
|
|
28252
|
+
*/
|
|
28253
|
+
async overheard(message) {
|
|
28254
|
+
const line2 = overheardLine(message);
|
|
28255
|
+
for (const { runId } of workingTurnsOf(message)) {
|
|
28256
|
+
const turn = this.working.get(runId);
|
|
28257
|
+
if (turn === void 0 || turn.run.over || turn.hermesRun === "") continue;
|
|
28258
|
+
try {
|
|
28259
|
+
await turn.agent.client.steer(turn.hermesRun, line2);
|
|
28260
|
+
turn.overheard.push({ messageId: message.message_id, line: line2 });
|
|
28261
|
+
} catch {
|
|
28262
|
+
}
|
|
28263
|
+
}
|
|
28264
|
+
}
|
|
28265
|
+
/**
|
|
28266
|
+
* Which of the words steered into a run it heard: those Hermes gave it before it completed, not
|
|
28267
|
+
* those it kept back as `pending_steer`, nor any in a run that failed or was stopped. Chips is
|
|
28268
|
+
* told of each, and the room shows the agent heard it while working (Chips ADR 0106).
|
|
28269
|
+
*/
|
|
28270
|
+
async toldWhileWorking(turn, last) {
|
|
28271
|
+
const told = turn.overheard.splice(0);
|
|
28272
|
+
if (last?.event !== "run.completed") return;
|
|
28273
|
+
const kept = typeof last["pending_steer"] === "string" ? last["pending_steer"] : "";
|
|
28274
|
+
for (const { messageId, line: line2 } of told) {
|
|
28275
|
+
if (kept.includes(line2)) continue;
|
|
28276
|
+
await turn.run.heard(messageId).catch((error62) => this.log(`couldn't say a turn heard ${messageId}: ${messageOf3(error62)}`));
|
|
28201
28277
|
}
|
|
28202
28278
|
}
|
|
28203
28279
|
/** The end of a run whose stream was lost: its state read until it is over, as a terminal event. */
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chipschat/hermes",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Hermes Agent as a Chips harness, on its Runs API: each profile a Chips agent, each room a Hermes session.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/arjungupta99/chips-hermes.git"
|
|
9
|
+
},
|
|
6
10
|
"type": "module",
|
|
7
11
|
"engines": {
|
|
8
12
|
"node": ">=22.19.0"
|