@chipschat/acp 1.0.16 → 1.0.18
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/dist/THIRD-PARTY-NOTICES.md +3 -3
- package/dist/main.js +338 -173
- package/package.json +4 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Third-party notices
|
|
2
2
|
|
|
3
|
-
`dist/main.js` in @chipschat/acp 1.0.
|
|
3
|
+
`dist/main.js` in @chipschat/acp 1.0.18 carries these packages, bundled in. Each one's
|
|
4
4
|
licence follows.
|
|
5
5
|
|
|
6
|
-
## @chipschat/harness 1.0.
|
|
6
|
+
## @chipschat/harness 1.0.4 (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.
|
|
210
|
+
## @chipschat/protocol 1.0.4 (Apache-2.0)
|
|
211
211
|
|
|
212
212
|
Apache License
|
|
213
213
|
Version 2.0, January 2004
|
package/dist/main.js
CHANGED
|
@@ -20270,6 +20270,25 @@ var modelChangeFrame = external_exports.object({
|
|
|
20270
20270
|
asked_at: isoTimestamp
|
|
20271
20271
|
}).describe("A person changed an agent's model or effort (ADR 0140). Sent to a harness's socket that said `models` in its `hello`, now or never: it is not in the log. The harness answers with the agent's copy, `answers` or `refuses` naming `change_id`.");
|
|
20272
20272
|
|
|
20273
|
+
// node_modules/@chipschat/protocol/dist/src/banners.js
|
|
20274
|
+
var CLOSED_BANNERS_MAX = 1e3;
|
|
20275
|
+
var who = external_exports.string().min(1).max(120);
|
|
20276
|
+
var bannerChoices = external_exports.record(who, external_exports.boolean()).describe("Whether this person wants the banner, by agent or harness. An agent with no choice of its own follows its harness, and a harness with none shows it.");
|
|
20277
|
+
var closedBanner = external_exports.object({
|
|
20278
|
+
space_id: id("space"),
|
|
20279
|
+
asker: who.describe("Whose banner: the agent, or a harness without agents."),
|
|
20280
|
+
since: isoTimestamp.describe("When the yes this banner stood for was given. A later yes is a new one, and shows its banner.")
|
|
20281
|
+
});
|
|
20282
|
+
var closedBanners = external_exports.array(closedBanner).max(CLOSED_BANNERS_MAX).describe("The banners this person closed for now.");
|
|
20283
|
+
var bannersView = external_exports.object({ choices: bannerChoices, closed: closedBanners });
|
|
20284
|
+
var bannerChoiceBody = external_exports.object({ shown: external_exports.boolean() });
|
|
20285
|
+
var closedBannerBody = external_exports.object({ since: isoTimestamp });
|
|
20286
|
+
var bannersFrame = external_exports.object({
|
|
20287
|
+
frame: external_exports.literal("banners"),
|
|
20288
|
+
choices: bannerChoices,
|
|
20289
|
+
closed: closedBanners
|
|
20290
|
+
}).describe("A person changed what they want of the banner, on one of their devices (ADR 0286). The whole of it, sent to that person's sockets that said `banners` in their `hello`.");
|
|
20291
|
+
|
|
20273
20292
|
// node_modules/@chipschat/protocol/dist/src/capabilities.js
|
|
20274
20293
|
var HARNESS_CAPABILITIES = {
|
|
20275
20294
|
/**
|
|
@@ -20363,6 +20382,11 @@ var HARNESS_CAPABILITIES = {
|
|
|
20363
20382
|
jobs: "jobs"
|
|
20364
20383
|
};
|
|
20365
20384
|
|
|
20385
|
+
// node_modules/@chipschat/protocol/dist/src/commands.js
|
|
20386
|
+
var ENDS = String.raw`(?=$|[\s;&|])`;
|
|
20387
|
+
var DROPPED_AFTER_DESCRIPTOR = new RegExp(String.raw`^(?:>>?[ \t]*\/dev\/null|>&[12])${ENDS}`);
|
|
20388
|
+
var DROPPED_ANY = new RegExp(String.raw`^(?:&?>>?[ \t]*\/dev\/null|>&[12])${ENDS}`);
|
|
20389
|
+
|
|
20366
20390
|
// node_modules/@chipschat/protocol/dist/src/connectors.js
|
|
20367
20391
|
var words = (most) => external_exports.string().trim().min(1).max(most);
|
|
20368
20392
|
var connectorKind = external_exports.enum(["one-line", "sdk", "http", "guide"]).describe("`one-line`: a command to run where the harness runs; `sdk`: code on @chipschat/harness; `http`: a key and curl lines; `guide`: a page to follow.");
|
|
@@ -20371,11 +20395,14 @@ var connector = external_exports.object({
|
|
|
20371
20395
|
name: words(60).describe("What a person calls it."),
|
|
20372
20396
|
line: words(120).describe("One line under the name: where it runs, what it needs."),
|
|
20373
20397
|
needs: words(120).optional().describe('What has to be on the computer first, said after "You need": its harness installed and running as its bridge needs. Chips for Mac says it under Connect.'),
|
|
20398
|
+
program: external_exports.string().regex(/^[a-z0-9][a-z0-9._-]{0,40}$/).optional().describe("The agent's own command, as a person runs it: Chips for Mac looks for it, to say the agent is on this Mac (ADR 0288)."),
|
|
20399
|
+
whose: words(200).optional().describe("Who makes the agent and where what a person sends it goes, in whole sentences, said beside its way in (ADR 0288)."),
|
|
20400
|
+
terms: external_exports.url({ protocol: /^https?$/ }).optional().describe("Its maker's own terms or licence."),
|
|
20374
20401
|
kind: connectorKind,
|
|
20375
20402
|
command: words(400).optional().describe("What to run where the harness runs, with `{link}` where the link goes."),
|
|
20376
20403
|
sentence: words(600).optional().describe("What to say to the agent so it connects itself, with `{link}` in it."),
|
|
20377
20404
|
package: external_exports.string().regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*@\d{1,4}$/).optional().describe("The npm package its bridge is published as and the major that speaks this server's protocol, `@chipschat/hermes@1`: `chips connect <id>` fetches the newest release of that major (ADR 0218)."),
|
|
20378
|
-
args: external_exports.array(external_exports.string().regex(/^[^-\s][^\s]{0,199}$/)).max(4).optional().describe("What `chips connect <id>` passes its bridge before the link is used, a config's path for one:
|
|
20405
|
+
args: external_exports.array(external_exports.string().regex(/^[^-\s][^\s]{0,199}$/)).max(4).optional().describe("What `chips connect <id>` passes its bridge before the link is used, a config's path for one: `~/Chips/.bridges/acp/codex.json` (ADR 0283)."),
|
|
20379
20406
|
capabilities: external_exports.array(external_exports.string().regex(/^[a-z][a-z_]{0,39}$/)).max(16).optional().describe("What its connector needs to do its job (ADR 0046): a link made from the card starts with these on."),
|
|
20380
20407
|
docs: external_exports.url({ protocol: /^https?$/ }).optional().describe("Its page in the docs."),
|
|
20381
20408
|
published: external_exports.boolean().optional().describe("False while its command can't be run by somebody outside yet.")
|
|
@@ -20428,6 +20455,159 @@ function renderRoomFiles(files) {
|
|
|
20428
20455
|
return [ROOM_FILES_HEADING, ...lines2].join("\n");
|
|
20429
20456
|
}
|
|
20430
20457
|
|
|
20458
|
+
// node_modules/@chipschat/protocol/dist/src/project.js
|
|
20459
|
+
var PROJECT_BRANCH = "main";
|
|
20460
|
+
function projectPath(spaceId) {
|
|
20461
|
+
return `/v1/spaces/${spaceId}/project.git`;
|
|
20462
|
+
}
|
|
20463
|
+
var PROJECT_ACTOR_HEADER = "chips-actor";
|
|
20464
|
+
var PROJECT_GIT_VERSION = "2.31.0";
|
|
20465
|
+
var PROJECT_TOKEN_PREFIX = "chips_pt_";
|
|
20466
|
+
var projectToken = external_exports.object({
|
|
20467
|
+
token: external_exports.string().startsWith(PROJECT_TOKEN_PREFIX).describe("Good for this room's project only, until `expires_at`: as a bearer token, or as the password of git's credential helper."),
|
|
20468
|
+
expires_at: isoTimestamp,
|
|
20469
|
+
path: external_exports.string().describe("The project's path on this server, which the device puts its own address in front of.")
|
|
20470
|
+
});
|
|
20471
|
+
var projectFolderOpenAnswer = external_exports.object({
|
|
20472
|
+
macs: external_exports.int().nonnegative().describe("How many of the person's Macs were asked."),
|
|
20473
|
+
opened_app: external_exports.literal(true).optional().describe("No Chips for Mac of theirs was open, so the server opened the one on its own machine and waited for it (ADR 0227).")
|
|
20474
|
+
});
|
|
20475
|
+
var COMMAND_MOST = 1100;
|
|
20476
|
+
var projectRun = external_exports.object({
|
|
20477
|
+
state: external_exports.enum(["never", "starting", "running", "ended", "failed", "stopped", "opened"]).describe("Never run on that Mac; starting (setup, or waiting for it to answer); running; ended by itself; failed; stopped by the person; or opened, for pages that need no starting."),
|
|
20478
|
+
command: external_exports.string().max(COMMAND_MOST).optional().describe("What ran: `setup`, `run` and `open` with what it opens, a line each; the bar compares it with the recipe's."),
|
|
20479
|
+
commit: external_exports.string().regex(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/).optional().describe("The room's `main` the folder had when it started, so the bar can name who changed the files since (SEC-40)."),
|
|
20480
|
+
since: isoTimestamp.optional(),
|
|
20481
|
+
ended: isoTimestamp.optional(),
|
|
20482
|
+
code: external_exports.int().optional().describe("How it ended, as its shell said."),
|
|
20483
|
+
opened: external_exports.string().max(600).optional().describe("What it opened, once it answered."),
|
|
20484
|
+
lines: external_exports.array(external_exports.string().max(400)).max(20).optional().describe("Its last lines, when it ended, or while it runs and something went wrong."),
|
|
20485
|
+
why: external_exports.string().max(400).optional().describe("Why the Mac didn't run it when it was last asked, in its words: no run file, or a different one."),
|
|
20486
|
+
trouble: external_exports.string().max(400).optional().describe("What went wrong with the run itself, in plain words (ADR 0230): a port in use, a program the Mac doesn't have, nothing answering, the browser refusing its address.")
|
|
20487
|
+
});
|
|
20488
|
+
var heldRun = projectRun.extend({
|
|
20489
|
+
mac: external_exports.string().min(1).max(120).describe("The name of the Mac it runs on."),
|
|
20490
|
+
said_at: isoTimestamp
|
|
20491
|
+
});
|
|
20492
|
+
var projectRunAnswer = external_exports.object({
|
|
20493
|
+
run: heldRun.optional(),
|
|
20494
|
+
macs: external_exports.int().nonnegative()
|
|
20495
|
+
});
|
|
20496
|
+
var commitId = external_exports.string().regex(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/).describe("A commit, by its full git object id.");
|
|
20497
|
+
var PROJECT_CHANGED_FILES = 200;
|
|
20498
|
+
var projectChangedFile = external_exports.object({
|
|
20499
|
+
path: external_exports.string().min(1).max(1024).describe("Its path in the project, with `/` between folders."),
|
|
20500
|
+
added: external_exports.int().nonnegative().nullable().describe("Lines added; `null` for a binary file."),
|
|
20501
|
+
removed: external_exports.int().nonnegative().nullable().describe("Lines removed; `null` for a binary file.")
|
|
20502
|
+
});
|
|
20503
|
+
var projectChangedPayload = external_exports.object({
|
|
20504
|
+
by: external_exports.string().min(1).max(120).describe("Who pushed: the agent a harness named, or the person. Recorded by Chips."),
|
|
20505
|
+
before: commitId.nullable().describe("Where `main` was, or `null` for the project's first push."),
|
|
20506
|
+
after: commitId.describe("Where `main` is now."),
|
|
20507
|
+
commits: external_exports.int().positive().describe("How many commits the push added to `main`."),
|
|
20508
|
+
message: external_exports.string().max(300).describe("The first line of the newest commit's message."),
|
|
20509
|
+
files: external_exports.array(projectChangedFile).max(PROJECT_CHANGED_FILES).describe("What changed between `before` and `after`, in path order."),
|
|
20510
|
+
more_files: external_exports.int().positive().optional().describe("How many more files changed than are named."),
|
|
20511
|
+
file_count: external_exports.int().nonnegative().optional().describe("How many files `main` has now, for the room sheet's Project tile (ADR 0222)."),
|
|
20512
|
+
undoes: commitId.optional().describe("The change this one takes back, when it is a person's Undo, or Put it back's Undo of an Undo (ADR 0222).")
|
|
20513
|
+
});
|
|
20514
|
+
var SECRETS_FILE = {
|
|
20515
|
+
source: "^\\.env(?:\\..+)?$",
|
|
20516
|
+
unless: "^\\.env\\.(?:example|sample|template)$"
|
|
20517
|
+
};
|
|
20518
|
+
var SECRETS_NAME = new RegExp(SECRETS_FILE.source);
|
|
20519
|
+
var EXAMPLE_NAME = new RegExp(SECRETS_FILE.unless);
|
|
20520
|
+
function isSecretsFile(path) {
|
|
20521
|
+
const name = path.split("/").pop() ?? path;
|
|
20522
|
+
return SECRETS_NAME.test(name) && !EXAMPLE_NAME.test(name);
|
|
20523
|
+
}
|
|
20524
|
+
var SECRET_SHAPES = [
|
|
20525
|
+
{ what: "a Chips token", source: "chips_(?:at|inv|j|pt)_[A-Za-z0-9_-]{20,}" },
|
|
20526
|
+
// `sk-` begins a word, so a link's words ("…/elon-musk-terafab-project-…") are never a key.
|
|
20527
|
+
{ what: "an Anthropic key", source: "\\bsk-ant-[A-Za-z0-9_-]{20,}" },
|
|
20528
|
+
{ what: "an OpenAI key", source: "\\bsk-(?:proj-|svcacct-|admin-)?[A-Za-z0-9_-]{40,}" },
|
|
20529
|
+
{ what: "an AWS access key", source: "\\b(?:AKIA|ASIA)[0-9A-Z]{16}\\b" },
|
|
20530
|
+
{
|
|
20531
|
+
what: "a GitHub token",
|
|
20532
|
+
source: "\\b(?:gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{60,})"
|
|
20533
|
+
},
|
|
20534
|
+
{ what: "a private key", source: "-----BEGIN (?:[A-Z]+ )*PRIVATE KEY-----" }
|
|
20535
|
+
];
|
|
20536
|
+
var SHAPES = SECRET_SHAPES.map((shape) => ({
|
|
20537
|
+
what: shape.what,
|
|
20538
|
+
pattern: new RegExp(shape.source)
|
|
20539
|
+
}));
|
|
20540
|
+
function secretIn(text) {
|
|
20541
|
+
return SHAPES.find((shape) => shape.pattern.test(text))?.what;
|
|
20542
|
+
}
|
|
20543
|
+
var PROJECT_LEAVE_OUT = [
|
|
20544
|
+
"node_modules/",
|
|
20545
|
+
".venv/",
|
|
20546
|
+
"__pycache__/",
|
|
20547
|
+
"dist/",
|
|
20548
|
+
"build/",
|
|
20549
|
+
".DS_Store",
|
|
20550
|
+
".env",
|
|
20551
|
+
".env.*",
|
|
20552
|
+
"!.env.example",
|
|
20553
|
+
"!.env.sample",
|
|
20554
|
+
"!.env.template"
|
|
20555
|
+
];
|
|
20556
|
+
function namesInWords(names) {
|
|
20557
|
+
if (names.length <= 1)
|
|
20558
|
+
return names[0] ?? "";
|
|
20559
|
+
if (names.length > 6)
|
|
20560
|
+
return `${names.slice(0, 6).join(", ")} and ${names.length - 6} more`;
|
|
20561
|
+
return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
|
|
20562
|
+
}
|
|
20563
|
+
function renderProjectNote(facts, options) {
|
|
20564
|
+
return `${renderProjectFacts(facts)}
|
|
20565
|
+
${renderProjectAsks(facts, options)}`;
|
|
20566
|
+
}
|
|
20567
|
+
function renderProjectFacts(facts) {
|
|
20568
|
+
const files = `${facts.files} file${facts.files === 1 ? "" : "s"}`;
|
|
20569
|
+
const lines2 = [
|
|
20570
|
+
`The space's project is a git repository. Your copy is ${facts.folder} (${files}), ${facts.trouble === void 0 ? "brought up to date just now" : "not brought up to date"}.`
|
|
20571
|
+
];
|
|
20572
|
+
if (facts.changed.length > 0) {
|
|
20573
|
+
const by = facts.by.length > 0 ? `, by ${namesInWords(facts.by)}` : "";
|
|
20574
|
+
lines2.push(`Changed since your last turn: ${namesInWords(facts.changed)}${by}.`);
|
|
20575
|
+
}
|
|
20576
|
+
if (facts.trouble !== void 0)
|
|
20577
|
+
lines2.push(`It couldn't be: ${facts.trouble}`);
|
|
20578
|
+
if (facts.clashes.length > 0) {
|
|
20579
|
+
const whose = facts.clashedWith.length > 0 ? `${namesInWords(facts.clashedWith)}'s` : "another change";
|
|
20580
|
+
lines2.push(`Your last change to ${namesInWords(facts.clashes)} clashed with ${whose}, which reached the space first. Both sides are in those files now: yours between "<<<<<<< yours" and "=======", theirs from there to the ">>>>>>>" line that names them. Settle each, keeping what both meant, and take the marks out. Nothing of yours is sent until they're gone.`);
|
|
20581
|
+
}
|
|
20582
|
+
for (const key of facts.keys) {
|
|
20583
|
+
lines2.push(`${key.path} holds what looks like ${key.what}, so your last change wasn't sent: take it out and read it from outside the project.`);
|
|
20584
|
+
}
|
|
20585
|
+
return lines2.join("\n");
|
|
20586
|
+
}
|
|
20587
|
+
function renderProjectAsks(facts, options) {
|
|
20588
|
+
const lines2 = [
|
|
20589
|
+
"Work on the project in that folder and leave git to Chips: when your turn ends, what you changed is committed under your name and sent to everyone here. Keep scratch work outside it.",
|
|
20590
|
+
// Sent with the answer too, a project's file became a room file of its own, with versions of
|
|
20591
|
+
// its own, and the agents of a room argued over which copy was current (Phase 8, Run D).
|
|
20592
|
+
"Everyone here sees the project's files, so don't send them with your answer as well."
|
|
20593
|
+
];
|
|
20594
|
+
if (options.othersInRoom) {
|
|
20595
|
+
lines2.push(
|
|
20596
|
+
"Split the work by file where you can. Changes to different parts of a file are merged, and a clash goes back to whoever sent second.",
|
|
20597
|
+
// Agents whose files must agree each renamed theirs to match the other's at once, so the
|
|
20598
|
+
// names crossed back and forth (Phase 8, AP-7): the project's history says who keeps theirs.
|
|
20599
|
+
"When your file and another's use different names for the same thing, the one that reached the project first keeps its names, and the other changes its names to match."
|
|
20600
|
+
);
|
|
20601
|
+
}
|
|
20602
|
+
lines2.push("When what you make is to be read (pages, PDFs, pictures), keep a start page at .chips/index.html that links to the documents worth seeing (its links start ../), with the documents themselves at the top or in folders of their own, and bring it up to date whenever you add, rename or replace one. Chips opens it in the app, where links to the project's files open too and web links open in the browser. One document needs no start page.", `When what you make has to run on the person's Mac (a server, a script, an app), keep .chips/run.json so Run in Chips can start it from the project's folder: {"run": "the one shell command that starts it", "opens": "http://localhost:<port>, to open once it answers", "setup": "a command run first when it changes, like npm install"}. Have it print the address it listens on, like http://localhost:4173, which is what Run opens; "opens" is for a program that prints none. Everything it runs belongs in the project: Run refuses a command that goes anywhere outside the project's folder (a cd elsewhere, a path in a home folder). Start an app by its own program rather than with open, so Stop can close it, and leave starting it to Run rather than starting it yourself. Leave out what it doesn't need, and check it works in your copy before you say it does.`);
|
|
20603
|
+
if (facts.markdown)
|
|
20604
|
+
lines2.push("In Markdown, put each sentence on a line of its own.");
|
|
20605
|
+
if (facts.pages === true) {
|
|
20606
|
+
lines2.push("A page opens in Chips as one document: name every file it needs in its tags and imports (<link>, <script src>, <img src>, import), since it can't fetch files while it runs.");
|
|
20607
|
+
}
|
|
20608
|
+
return lines2.join("\n");
|
|
20609
|
+
}
|
|
20610
|
+
|
|
20431
20611
|
// node_modules/@chipschat/protocol/dist/src/spend.js
|
|
20432
20612
|
var SPEND_CEILING_MIN = 0.25;
|
|
20433
20613
|
var SPEND_CEILING_MAX = 100;
|
|
@@ -20842,7 +21022,8 @@ var hello = defineEvent({
|
|
|
20842
21022
|
}).describe("The negotiated range. A client picks a version inside it or is refused."),
|
|
20843
21023
|
server: external_exports.object({
|
|
20844
21024
|
name: external_exports.string().min(1).max(120).describe("Usually `chipsd`."),
|
|
20845
|
-
version: external_exports.string().min(1).max(60).describe("The server's own version.")
|
|
21025
|
+
version: external_exports.string().min(1).max(60).describe("The server's own version."),
|
|
21026
|
+
takes: external_exports.array(external_exports.string().min(1).max(40)).max(32).optional().describe("What this server keeps of what a person's client may send beyond the base set, by the names in `SERVER_TAKES`. `held_yes` is `for_minutes` and `until_stopped` on `approval.resolved`. A server older than the field says nothing, and drops those fields, so a client offers neither to it (ADR 0281).")
|
|
20846
21027
|
}).describe("Who the client is talking to."),
|
|
20847
21028
|
harnesses: external_exports.array(harnessManifest).min(1).max(64).describe("The harness the token belongs to, and only that one. One connection speaks for all of the harness's agents (ADR 0087), which `agents` lists. A harness running inside another is a lane, not a duplicate."),
|
|
20848
21029
|
harness: harnessManifest.optional().describe("The harness this connection is: `harnesses[0]`, said once. Read this rather than the list."),
|
|
@@ -20931,6 +21112,8 @@ var approvalResolved = defineEvent({
|
|
|
20931
21112
|
decision: external_exports.enum(["approved", "edited", "denied", "expired"]).describe("`expired` means nobody answered and the fallback applied."),
|
|
20932
21113
|
scope: external_exports.enum(["once", "session", "always"]).default("once").describe("How far the answer reaches. `always` becomes a policy rule."),
|
|
20933
21114
|
everywhere: external_exports.boolean().optional().describe("With `always`: the rule is the harness's in every space, not only this one (ADR 0239). An owner or an admin only."),
|
|
21115
|
+
for_minutes: external_exports.number().int().min(5).max(240).optional().describe("With `once` and a yes: for this many minutes, everything the asking agent asks in this space goes ahead without a card (ADR 0239, addendum of 6 November 2026; ADR 0281), commands Chips can't read too. An ask that matters still waits for a person. Chips keeps the rule, so the harness is answered once."),
|
|
21116
|
+
until_stopped: external_exports.literal(true).optional().describe("With `once` and a yes, instead of `for_minutes`: everything the asking agent asks in this space goes ahead without a card until a person stops it (`approval.held_stopped`, ADR 0281). An ask that matters still waits for a person. Chips keeps the rule, so the harness is answered once."),
|
|
20934
21117
|
updated_input: external_exports.unknown().optional().describe("The edited action input, when the decision is `edited`."),
|
|
20935
21118
|
reason: external_exports.string().max(4e3).optional().describe("Why. The harness gets to read this."),
|
|
20936
21119
|
resolved_by: external_exports.string().min(1).max(120).describe("The participant who answered, or `system` on expiry \u2014 a harness when it settles its own ask, answered in its own tools. Filled in by Chips from the credential that sent it; a value the sender writes is replaced."),
|
|
@@ -21089,159 +21272,6 @@ var CHIPS_TO_HARNESS = [
|
|
|
21089
21272
|
receipt
|
|
21090
21273
|
];
|
|
21091
21274
|
|
|
21092
|
-
// node_modules/@chipschat/protocol/dist/src/project.js
|
|
21093
|
-
var PROJECT_BRANCH = "main";
|
|
21094
|
-
function projectPath(spaceId) {
|
|
21095
|
-
return `/v1/spaces/${spaceId}/project.git`;
|
|
21096
|
-
}
|
|
21097
|
-
var PROJECT_ACTOR_HEADER = "chips-actor";
|
|
21098
|
-
var PROJECT_GIT_VERSION = "2.31.0";
|
|
21099
|
-
var PROJECT_TOKEN_PREFIX = "chips_pt_";
|
|
21100
|
-
var projectToken = external_exports.object({
|
|
21101
|
-
token: external_exports.string().startsWith(PROJECT_TOKEN_PREFIX).describe("Good for this room's project only, until `expires_at`: as a bearer token, or as the password of git's credential helper."),
|
|
21102
|
-
expires_at: isoTimestamp,
|
|
21103
|
-
path: external_exports.string().describe("The project's path on this server, which the device puts its own address in front of.")
|
|
21104
|
-
});
|
|
21105
|
-
var projectFolderOpenAnswer = external_exports.object({
|
|
21106
|
-
macs: external_exports.int().nonnegative().describe("How many of the person's Macs were asked."),
|
|
21107
|
-
opened_app: external_exports.literal(true).optional().describe("No Chips for Mac of theirs was open, so the server opened the one on its own machine and waited for it (ADR 0227).")
|
|
21108
|
-
});
|
|
21109
|
-
var COMMAND_MOST = 1100;
|
|
21110
|
-
var projectRun = external_exports.object({
|
|
21111
|
-
state: external_exports.enum(["never", "starting", "running", "ended", "failed", "stopped", "opened"]).describe("Never run on that Mac; starting (setup, or waiting for it to answer); running; ended by itself; failed; stopped by the person; or opened, for pages that need no starting."),
|
|
21112
|
-
command: external_exports.string().max(COMMAND_MOST).optional().describe("What ran: `setup`, `run` and `open` with what it opens, a line each; the bar compares it with the recipe's."),
|
|
21113
|
-
commit: external_exports.string().regex(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/).optional().describe("The room's `main` the folder had when it started, so the bar can name who changed the files since (SEC-40)."),
|
|
21114
|
-
since: isoTimestamp.optional(),
|
|
21115
|
-
ended: isoTimestamp.optional(),
|
|
21116
|
-
code: external_exports.int().optional().describe("How it ended, as its shell said."),
|
|
21117
|
-
opened: external_exports.string().max(600).optional().describe("What it opened, once it answered."),
|
|
21118
|
-
lines: external_exports.array(external_exports.string().max(400)).max(20).optional().describe("Its last lines, when it ended, or while it runs and something went wrong."),
|
|
21119
|
-
why: external_exports.string().max(400).optional().describe("Why the Mac didn't run it when it was last asked, in its words: no run file, or a different one."),
|
|
21120
|
-
trouble: external_exports.string().max(400).optional().describe("What went wrong with the run itself, in plain words (ADR 0230): a port in use, a program the Mac doesn't have, nothing answering, the browser refusing its address.")
|
|
21121
|
-
});
|
|
21122
|
-
var heldRun = projectRun.extend({
|
|
21123
|
-
mac: external_exports.string().min(1).max(120).describe("The name of the Mac it runs on."),
|
|
21124
|
-
said_at: isoTimestamp
|
|
21125
|
-
});
|
|
21126
|
-
var projectRunAnswer = external_exports.object({
|
|
21127
|
-
run: heldRun.optional(),
|
|
21128
|
-
macs: external_exports.int().nonnegative()
|
|
21129
|
-
});
|
|
21130
|
-
var commitId = external_exports.string().regex(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/).describe("A commit, by its full git object id.");
|
|
21131
|
-
var PROJECT_CHANGED_FILES = 200;
|
|
21132
|
-
var projectChangedFile = external_exports.object({
|
|
21133
|
-
path: external_exports.string().min(1).max(1024).describe("Its path in the project, with `/` between folders."),
|
|
21134
|
-
added: external_exports.int().nonnegative().nullable().describe("Lines added; `null` for a binary file."),
|
|
21135
|
-
removed: external_exports.int().nonnegative().nullable().describe("Lines removed; `null` for a binary file.")
|
|
21136
|
-
});
|
|
21137
|
-
var projectChangedPayload = external_exports.object({
|
|
21138
|
-
by: external_exports.string().min(1).max(120).describe("Who pushed: the agent a harness named, or the person. Recorded by Chips."),
|
|
21139
|
-
before: commitId.nullable().describe("Where `main` was, or `null` for the project's first push."),
|
|
21140
|
-
after: commitId.describe("Where `main` is now."),
|
|
21141
|
-
commits: external_exports.int().positive().describe("How many commits the push added to `main`."),
|
|
21142
|
-
message: external_exports.string().max(300).describe("The first line of the newest commit's message."),
|
|
21143
|
-
files: external_exports.array(projectChangedFile).max(PROJECT_CHANGED_FILES).describe("What changed between `before` and `after`, in path order."),
|
|
21144
|
-
more_files: external_exports.int().positive().optional().describe("How many more files changed than are named."),
|
|
21145
|
-
file_count: external_exports.int().nonnegative().optional().describe("How many files `main` has now, for the room sheet's Project tile (ADR 0222)."),
|
|
21146
|
-
undoes: commitId.optional().describe("The change this one takes back, when it is a person's Undo, or Put it back's Undo of an Undo (ADR 0222).")
|
|
21147
|
-
});
|
|
21148
|
-
var SECRETS_FILE = {
|
|
21149
|
-
source: "^\\.env(?:\\..+)?$",
|
|
21150
|
-
unless: "^\\.env\\.(?:example|sample|template)$"
|
|
21151
|
-
};
|
|
21152
|
-
var SECRETS_NAME = new RegExp(SECRETS_FILE.source);
|
|
21153
|
-
var EXAMPLE_NAME = new RegExp(SECRETS_FILE.unless);
|
|
21154
|
-
function isSecretsFile(path) {
|
|
21155
|
-
const name = path.split("/").pop() ?? path;
|
|
21156
|
-
return SECRETS_NAME.test(name) && !EXAMPLE_NAME.test(name);
|
|
21157
|
-
}
|
|
21158
|
-
var SECRET_SHAPES = [
|
|
21159
|
-
{ what: "a Chips token", source: "chips_(?:at|inv|j|pt)_[A-Za-z0-9_-]{20,}" },
|
|
21160
|
-
// `sk-` begins a word, so a link's words ("…/elon-musk-terafab-project-…") are never a key.
|
|
21161
|
-
{ what: "an Anthropic key", source: "\\bsk-ant-[A-Za-z0-9_-]{20,}" },
|
|
21162
|
-
{ what: "an OpenAI key", source: "\\bsk-(?:proj-|svcacct-|admin-)?[A-Za-z0-9_-]{40,}" },
|
|
21163
|
-
{ what: "an AWS access key", source: "\\b(?:AKIA|ASIA)[0-9A-Z]{16}\\b" },
|
|
21164
|
-
{
|
|
21165
|
-
what: "a GitHub token",
|
|
21166
|
-
source: "\\b(?:gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{60,})"
|
|
21167
|
-
},
|
|
21168
|
-
{ what: "a private key", source: "-----BEGIN (?:[A-Z]+ )*PRIVATE KEY-----" }
|
|
21169
|
-
];
|
|
21170
|
-
var SHAPES = SECRET_SHAPES.map((shape) => ({
|
|
21171
|
-
what: shape.what,
|
|
21172
|
-
pattern: new RegExp(shape.source)
|
|
21173
|
-
}));
|
|
21174
|
-
function secretIn(text) {
|
|
21175
|
-
return SHAPES.find((shape) => shape.pattern.test(text))?.what;
|
|
21176
|
-
}
|
|
21177
|
-
var PROJECT_LEAVE_OUT = [
|
|
21178
|
-
"node_modules/",
|
|
21179
|
-
".venv/",
|
|
21180
|
-
"__pycache__/",
|
|
21181
|
-
"dist/",
|
|
21182
|
-
"build/",
|
|
21183
|
-
".DS_Store",
|
|
21184
|
-
".env",
|
|
21185
|
-
".env.*",
|
|
21186
|
-
"!.env.example",
|
|
21187
|
-
"!.env.sample",
|
|
21188
|
-
"!.env.template"
|
|
21189
|
-
];
|
|
21190
|
-
function namesInWords(names) {
|
|
21191
|
-
if (names.length <= 1)
|
|
21192
|
-
return names[0] ?? "";
|
|
21193
|
-
if (names.length > 6)
|
|
21194
|
-
return `${names.slice(0, 6).join(", ")} and ${names.length - 6} more`;
|
|
21195
|
-
return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
|
|
21196
|
-
}
|
|
21197
|
-
function renderProjectNote(facts, options) {
|
|
21198
|
-
return `${renderProjectFacts(facts)}
|
|
21199
|
-
${renderProjectAsks(facts, options)}`;
|
|
21200
|
-
}
|
|
21201
|
-
function renderProjectFacts(facts) {
|
|
21202
|
-
const files = `${facts.files} file${facts.files === 1 ? "" : "s"}`;
|
|
21203
|
-
const lines2 = [
|
|
21204
|
-
`The space's project is a git repository. Your copy is ${facts.folder} (${files}), ${facts.trouble === void 0 ? "brought up to date just now" : "not brought up to date"}.`
|
|
21205
|
-
];
|
|
21206
|
-
if (facts.changed.length > 0) {
|
|
21207
|
-
const by = facts.by.length > 0 ? `, by ${namesInWords(facts.by)}` : "";
|
|
21208
|
-
lines2.push(`Changed since your last turn: ${namesInWords(facts.changed)}${by}.`);
|
|
21209
|
-
}
|
|
21210
|
-
if (facts.trouble !== void 0)
|
|
21211
|
-
lines2.push(`It couldn't be: ${facts.trouble}`);
|
|
21212
|
-
if (facts.clashes.length > 0) {
|
|
21213
|
-
const whose = facts.clashedWith.length > 0 ? `${namesInWords(facts.clashedWith)}'s` : "another change";
|
|
21214
|
-
lines2.push(`Your last change to ${namesInWords(facts.clashes)} clashed with ${whose}, which reached the space first. Both sides are in those files now: yours between "<<<<<<< yours" and "=======", theirs from there to the ">>>>>>>" line that names them. Settle each, keeping what both meant, and take the marks out. Nothing of yours is sent until they're gone.`);
|
|
21215
|
-
}
|
|
21216
|
-
for (const key of facts.keys) {
|
|
21217
|
-
lines2.push(`${key.path} holds what looks like ${key.what}, so your last change wasn't sent: take it out and read it from outside the project.`);
|
|
21218
|
-
}
|
|
21219
|
-
return lines2.join("\n");
|
|
21220
|
-
}
|
|
21221
|
-
function renderProjectAsks(facts, options) {
|
|
21222
|
-
const lines2 = [
|
|
21223
|
-
"Work on the project in that folder and leave git to Chips: when your turn ends, what you changed is committed under your name and sent to everyone here. Keep scratch work outside it.",
|
|
21224
|
-
// Sent with the answer too, a project's file became a room file of its own, with versions of
|
|
21225
|
-
// its own, and the agents of a room argued over which copy was current (Phase 8, Run D).
|
|
21226
|
-
"Everyone here sees the project's files, so don't send them with your answer as well."
|
|
21227
|
-
];
|
|
21228
|
-
if (options.othersInRoom) {
|
|
21229
|
-
lines2.push(
|
|
21230
|
-
"Split the work by file where you can. Changes to different parts of a file are merged, and a clash goes back to whoever sent second.",
|
|
21231
|
-
// Agents whose files must agree each renamed theirs to match the other's at once, so the
|
|
21232
|
-
// names crossed back and forth (Phase 8, AP-7): the project's history says who keeps theirs.
|
|
21233
|
-
"When your file and another's use different names for the same thing, the one that reached the project first keeps its names, and the other changes its names to match."
|
|
21234
|
-
);
|
|
21235
|
-
}
|
|
21236
|
-
lines2.push("When what you make is to be read (pages, PDFs, pictures), keep a start page at .chips/index.html that links to the documents worth seeing (its links start ../), with the documents themselves at the top or in folders of their own, and bring it up to date whenever you add, rename or replace one. Chips opens it in the app, and its links open there too. One document needs no start page.", `When what you make has to run on the person's Mac (a server, a script, an app), keep .chips/run.json so Run in Chips can start it from the project's folder: {"run": "the one shell command that starts it", "opens": "http://localhost:<port>, to open once it answers", "setup": "a command run first when it changes, like npm install"}. Have it print the address it listens on, like http://localhost:4173, which is what Run opens; "opens" is for a program that prints none. Everything it runs belongs in the project: Run refuses a command that goes anywhere outside the project's folder (a cd elsewhere, a path in a home folder). Start an app by its own program rather than with open, so Stop can close it, and leave starting it to Run rather than starting it yourself. Leave out what it doesn't need, and check it works in your copy before you say it does.`);
|
|
21237
|
-
if (facts.markdown)
|
|
21238
|
-
lines2.push("In Markdown, put each sentence on a line of its own.");
|
|
21239
|
-
if (facts.pages === true) {
|
|
21240
|
-
lines2.push("A page opens in Chips as one document: name every file it needs in its tags and imports (<link>, <script src>, <img src>, import), since it can't fetch files while it runs.");
|
|
21241
|
-
}
|
|
21242
|
-
return lines2.join("\n");
|
|
21243
|
-
}
|
|
21244
|
-
|
|
21245
21275
|
// node_modules/@chipschat/protocol/dist/src/events/harness-to-chips.js
|
|
21246
21276
|
var plannedStep = external_exports.object({
|
|
21247
21277
|
step_id: external_exports.string().min(1).max(120).describe("Stable for the life of the run, so updates land on the right row."),
|
|
@@ -22323,6 +22353,28 @@ var approvalRouted = defineEvent({
|
|
|
22323
22353
|
routed_at: external_exports.string().datetime().optional().describe("When. Filled in by Chips from its clock.")
|
|
22324
22354
|
})
|
|
22325
22355
|
});
|
|
22356
|
+
var approvalHeldStopped = defineEvent({
|
|
22357
|
+
type: "approval.held_stopped",
|
|
22358
|
+
direction: "workspace",
|
|
22359
|
+
sender: "person",
|
|
22360
|
+
summary: "A person stopped the yes that let an agent work without asking in a space, for an hour or until stopped. Its next ask comes to a person.",
|
|
22361
|
+
requiresRun: false,
|
|
22362
|
+
payload: external_exports.object({
|
|
22363
|
+
asker: external_exports.string().min(1).max(120).describe("Whose yes stops: the agent, or a harness without agents, as the run that asked is worked by."),
|
|
22364
|
+
stopped_by: external_exports.string().min(1).max(120).optional().describe("Who stopped it. Filled in by Chips from the credential.")
|
|
22365
|
+
})
|
|
22366
|
+
});
|
|
22367
|
+
var approvalHeldStarted = defineEvent({
|
|
22368
|
+
type: "approval.held_started",
|
|
22369
|
+
direction: "workspace",
|
|
22370
|
+
sender: "person",
|
|
22371
|
+
summary: "A person let an agent work without asking in a space until it is stopped, from the agent's page rather than an ask's card.",
|
|
22372
|
+
requiresRun: false,
|
|
22373
|
+
payload: external_exports.object({
|
|
22374
|
+
asker: external_exports.string().min(1).max(120).describe("Whose asks go ahead: the agent, or a harness without agents, in the space."),
|
|
22375
|
+
started_by: external_exports.string().min(1).max(120).optional().describe("Who gave it. Filled in by Chips from the credential.")
|
|
22376
|
+
})
|
|
22377
|
+
});
|
|
22326
22378
|
var cap = external_exports.number().int().min(1).nullable();
|
|
22327
22379
|
var attachmentLimitsSet = defineEvent({
|
|
22328
22380
|
type: "attachment.limits_set",
|
|
@@ -22411,6 +22463,8 @@ var WORKSPACE_EVENTS = [
|
|
|
22411
22463
|
messagePinned,
|
|
22412
22464
|
messageUnpinned,
|
|
22413
22465
|
approvalRouted,
|
|
22466
|
+
approvalHeldStopped,
|
|
22467
|
+
approvalHeldStarted,
|
|
22414
22468
|
attachmentLimitsSet,
|
|
22415
22469
|
exchangeLimitsSet,
|
|
22416
22470
|
workspaceRenamed,
|
|
@@ -22803,6 +22857,7 @@ var serverFrame = external_exports.discriminatedUnion("frame", [
|
|
|
22803
22857
|
folderRunFrame,
|
|
22804
22858
|
folderRunStateFrame,
|
|
22805
22859
|
readFrame,
|
|
22860
|
+
bannersFrame,
|
|
22806
22861
|
contextEditFrame,
|
|
22807
22862
|
modelChangeFrame,
|
|
22808
22863
|
heartbeatChangeFrame,
|
|
@@ -24228,6 +24283,8 @@ function refusalOf(kind2, error62) {
|
|
|
24228
24283
|
}
|
|
24229
24284
|
|
|
24230
24285
|
// node_modules/@chipschat/harness/dist/connect.js
|
|
24286
|
+
var HELD_MOST = 2e4;
|
|
24287
|
+
var OF_THE_CONNECTION = /* @__PURE__ */ new Set(["hello", "state", "receipt"]);
|
|
24231
24288
|
function agentOf(body) {
|
|
24232
24289
|
return {
|
|
24233
24290
|
agentId: String(body["agent_id"]),
|
|
@@ -24257,12 +24314,25 @@ var Chips = class _Chips {
|
|
|
24257
24314
|
/** Makes each ping's `ts` its own, so two in one millisecond are still told apart. */
|
|
24258
24315
|
pings = 0;
|
|
24259
24316
|
/**
|
|
24260
|
-
* Events held back, and why: one hold until the harness
|
|
24261
|
-
*
|
|
24262
|
-
*
|
|
24317
|
+
* Events held back, and why: one hold until the harness is listening, and one for each
|
|
24318
|
+
* catch-up on asked rooms still reading, so that a room's first words heard live and read from
|
|
24319
|
+
* its history are handed over once. Delivered in order when none is left.
|
|
24320
|
+
*
|
|
24321
|
+
* The first hold used to last one tick after `connect` resolved. Three bridges looked for git
|
|
24322
|
+
* and listed their agents before they attached a handler, so what `since` replayed was handed
|
|
24323
|
+
* to nobody, and the place in the log moved past it: a message sent while a bridge was down was
|
|
24324
|
+
* never answered (9 November 2026). An event nothing here could take is not heard. So the hold
|
|
24325
|
+
* lasts until something takes events: a handler, a waiter, a run, or a handler for rooms asked
|
|
24326
|
+
* (ADR 0289).
|
|
24263
24327
|
*/
|
|
24264
24328
|
held = [];
|
|
24265
24329
|
holds = 1;
|
|
24330
|
+
/** The handshake is done: `connect` has resolved. */
|
|
24331
|
+
started = false;
|
|
24332
|
+
/** Something here takes events (`listens`). */
|
|
24333
|
+
listening = false;
|
|
24334
|
+
/** The first hold is on its way out. */
|
|
24335
|
+
letting = false;
|
|
24266
24336
|
askHandlers = new Emitter();
|
|
24267
24337
|
asks = new Asks(() => this.me()?.harness_id, {
|
|
24268
24338
|
listening: () => this.askHandlers.count("asked") > 0,
|
|
@@ -24304,7 +24374,8 @@ var Chips = class _Chips {
|
|
|
24304
24374
|
const chips2 = new _Chips(options);
|
|
24305
24375
|
await chips2.open(true);
|
|
24306
24376
|
chips2.endOrphans();
|
|
24307
|
-
|
|
24377
|
+
chips2.started = true;
|
|
24378
|
+
chips2.letGo();
|
|
24308
24379
|
return chips2;
|
|
24309
24380
|
}
|
|
24310
24381
|
get state() {
|
|
@@ -24402,8 +24473,17 @@ var Chips = class _Chips {
|
|
|
24402
24473
|
get lastSeq() {
|
|
24403
24474
|
return this.since;
|
|
24404
24475
|
}
|
|
24476
|
+
/**
|
|
24477
|
+
* Hear events by name, or all of them as `event`. What `since` replayed, and what was said
|
|
24478
|
+
* since the connection opened, is handed over a tick after the first handler is attached:
|
|
24479
|
+
* attach every handler together, and all of them hear it. `hello`, `state` and `receipt` are
|
|
24480
|
+
* the connection's own, and attaching one of those alone starts nothing.
|
|
24481
|
+
*/
|
|
24405
24482
|
on(name, handler) {
|
|
24406
|
-
|
|
24483
|
+
const off = this.emitter.on(name, handler);
|
|
24484
|
+
if (!OF_THE_CONNECTION.has(name))
|
|
24485
|
+
this.listens();
|
|
24486
|
+
return off;
|
|
24407
24487
|
}
|
|
24408
24488
|
/** Say something in a space. */
|
|
24409
24489
|
post(input2) {
|
|
@@ -24433,6 +24513,7 @@ var Chips = class _Chips {
|
|
|
24433
24513
|
*/
|
|
24434
24514
|
onSpaceAsked(handler) {
|
|
24435
24515
|
const off = this.askHandlers.on("asked", handler);
|
|
24516
|
+
this.listens();
|
|
24436
24517
|
if (this.ready)
|
|
24437
24518
|
void this.catchUp();
|
|
24438
24519
|
return off;
|
|
@@ -24547,6 +24628,7 @@ var Chips = class _Chips {
|
|
|
24547
24628
|
lanes: this.lanes
|
|
24548
24629
|
}, laneId);
|
|
24549
24630
|
this.activeRuns.set(runId, run2);
|
|
24631
|
+
this.listens();
|
|
24550
24632
|
return run2;
|
|
24551
24633
|
}
|
|
24552
24634
|
/**
|
|
@@ -24647,6 +24729,7 @@ var Chips = class _Chips {
|
|
|
24647
24729
|
}
|
|
24648
24730
|
/** Resolve with the first event that matches, now or later. */
|
|
24649
24731
|
waitFor(match) {
|
|
24732
|
+
this.listens();
|
|
24650
24733
|
return new Promise((resolve5) => {
|
|
24651
24734
|
this.waiters.add({ match, resolve: resolve5 });
|
|
24652
24735
|
});
|
|
@@ -24870,6 +24953,21 @@ var Chips = class _Chips {
|
|
|
24870
24953
|
return;
|
|
24871
24954
|
}
|
|
24872
24955
|
}
|
|
24956
|
+
/** Something here takes events from now on, so the first hold can go. */
|
|
24957
|
+
listens() {
|
|
24958
|
+
this.listening = true;
|
|
24959
|
+
this.letGo();
|
|
24960
|
+
}
|
|
24961
|
+
/**
|
|
24962
|
+
* Let the first hold go, once the handshake is done and the harness is listening: on the next
|
|
24963
|
+
* tick, so handlers attached together all hear what was held.
|
|
24964
|
+
*/
|
|
24965
|
+
letGo() {
|
|
24966
|
+
if (!this.started || !this.listening || this.letting)
|
|
24967
|
+
return;
|
|
24968
|
+
this.letting = true;
|
|
24969
|
+
setTimeout(() => this.release(), 0);
|
|
24970
|
+
}
|
|
24873
24971
|
/** Let one hold go; with none left, deliver what was held, in order. */
|
|
24874
24972
|
release() {
|
|
24875
24973
|
this.holds -= 1;
|
|
@@ -24883,6 +24981,8 @@ var Chips = class _Chips {
|
|
|
24883
24981
|
onEvent(event) {
|
|
24884
24982
|
if (this.holds > 0) {
|
|
24885
24983
|
this.held.push(event);
|
|
24984
|
+
if (!this.listening && this.held.length > HELD_MOST)
|
|
24985
|
+
this.held.shift();
|
|
24886
24986
|
return;
|
|
24887
24987
|
}
|
|
24888
24988
|
const seq = event["seq"];
|
|
@@ -25063,7 +25163,7 @@ function connect(options) {
|
|
|
25063
25163
|
// node_modules/@chipschat/harness/dist/join.js
|
|
25064
25164
|
import { createHash } from "node:crypto";
|
|
25065
25165
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
25066
|
-
import { hostname as hostname3 } from "node:os";
|
|
25166
|
+
import { hostname as hostname3, networkInterfaces } from "node:os";
|
|
25067
25167
|
import { join as joinPath } from "node:path";
|
|
25068
25168
|
|
|
25069
25169
|
// node_modules/@chipschat/harness/dist/keep.js
|
|
@@ -25226,13 +25326,53 @@ function serverJsonUrl(env2) {
|
|
|
25226
25326
|
return void 0;
|
|
25227
25327
|
}
|
|
25228
25328
|
}
|
|
25329
|
+
function serverHere(env2) {
|
|
25330
|
+
const url2 = serverJsonUrl(env2);
|
|
25331
|
+
if (url2 === void 0)
|
|
25332
|
+
return void 0;
|
|
25333
|
+
let port;
|
|
25334
|
+
try {
|
|
25335
|
+
const parsed = new URL(url2);
|
|
25336
|
+
if (parsed.protocol !== "http:")
|
|
25337
|
+
return void 0;
|
|
25338
|
+
port = parsed.port;
|
|
25339
|
+
} catch {
|
|
25340
|
+
return void 0;
|
|
25341
|
+
}
|
|
25342
|
+
const hosts = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", hostname3().toLowerCase()]);
|
|
25343
|
+
for (const each of Object.values(networkInterfaces()).flat()) {
|
|
25344
|
+
if (each === void 0)
|
|
25345
|
+
continue;
|
|
25346
|
+
hosts.add(each.family === "IPv6" ? `[${each.address}]` : each.address);
|
|
25347
|
+
}
|
|
25348
|
+
return { url: url2.replace(/\/$/, ""), port, hosts };
|
|
25349
|
+
}
|
|
25350
|
+
function hereInstead(url2, env2) {
|
|
25351
|
+
const here2 = serverHere(env2);
|
|
25352
|
+
if (here2 === void 0)
|
|
25353
|
+
return void 0;
|
|
25354
|
+
try {
|
|
25355
|
+
const parsed = new URL(url2);
|
|
25356
|
+
const same = parsed.protocol === "http:" && parsed.port === here2.port && here2.hosts.has(parsed.hostname.toLowerCase());
|
|
25357
|
+
return same ? here2.url : void 0;
|
|
25358
|
+
} catch {
|
|
25359
|
+
return void 0;
|
|
25360
|
+
}
|
|
25361
|
+
}
|
|
25362
|
+
function accountsHere(url2, name, env2) {
|
|
25363
|
+
const here2 = serverHere(env2);
|
|
25364
|
+
if (here2 === void 0 || here2.url !== url2.replace(/\/$/, ""))
|
|
25365
|
+
return [];
|
|
25366
|
+
return [...here2.hosts].filter((host) => /^\d+\.\d+\.\d+\.\d+$/.test(host) && host !== "127.0.0.1").map((host) => accountOf(`http://${host}${here2.port === "" ? "" : `:${here2.port}`}`, name));
|
|
25367
|
+
}
|
|
25229
25368
|
function findServer(options, env2) {
|
|
25230
25369
|
if (options.link !== void 0) {
|
|
25231
25370
|
const parsed = parseJoinLink(options.link);
|
|
25232
25371
|
if (parsed === void 0) {
|
|
25233
25372
|
throw new JoinError("invalid", "That is not a join link: it looks like <address>/j/<secret>.");
|
|
25234
25373
|
}
|
|
25235
|
-
|
|
25374
|
+
const here2 = hereInstead(parsed.url, env2);
|
|
25375
|
+
return here2 === void 0 ? parsed : { url: here2, secret: parsed.secret };
|
|
25236
25376
|
}
|
|
25237
25377
|
const url2 = options.url ?? env2["CHIPS_URL"] ?? serverJsonUrl(env2);
|
|
25238
25378
|
if (url2 === void 0 || url2 === "") {
|
|
@@ -25255,6 +25395,27 @@ function joinedOf(answer) {
|
|
|
25255
25395
|
function linkHash(secret) {
|
|
25256
25396
|
return createHash("sha256").update(secret).digest("base64url");
|
|
25257
25397
|
}
|
|
25398
|
+
function keptAtAny(store, accounts) {
|
|
25399
|
+
for (const account of accounts) {
|
|
25400
|
+
const kept2 = keptAt(store, account);
|
|
25401
|
+
if (kept2 !== void 0)
|
|
25402
|
+
return { account, kept: kept2 };
|
|
25403
|
+
}
|
|
25404
|
+
return void 0;
|
|
25405
|
+
}
|
|
25406
|
+
function rehomed(store, account, joined2, env2) {
|
|
25407
|
+
const here2 = hereInstead(joined2.url, env2);
|
|
25408
|
+
if (here2 === void 0 || here2 === joined2.url)
|
|
25409
|
+
return joined2;
|
|
25410
|
+
if (store !== false) {
|
|
25411
|
+
try {
|
|
25412
|
+
const record2 = JSON.parse(store.get(account) ?? "{}");
|
|
25413
|
+
store.set(account, JSON.stringify({ ...record2, url: here2 }));
|
|
25414
|
+
} catch {
|
|
25415
|
+
}
|
|
25416
|
+
}
|
|
25417
|
+
return { ...joined2, url: here2 };
|
|
25418
|
+
}
|
|
25258
25419
|
function keptAt(store, account) {
|
|
25259
25420
|
if (store === false)
|
|
25260
25421
|
return void 0;
|
|
@@ -25357,19 +25518,20 @@ async function join3(options) {
|
|
|
25357
25518
|
const server = findServer(options, env2);
|
|
25358
25519
|
const store = options.keep ?? openKeyStore(env2);
|
|
25359
25520
|
const account = accountOf(server.url, options.name);
|
|
25360
|
-
const
|
|
25521
|
+
const found = keptAtAny(store, [account, ...accountsHere(server.url, options.name, env2)]);
|
|
25361
25522
|
const from = server.secret === void 0 ? void 0 : linkHash(server.secret);
|
|
25362
|
-
if (
|
|
25363
|
-
return
|
|
25523
|
+
if (found !== void 0 && (from === void 0 || found.kept.from === from))
|
|
25524
|
+
return rehomed(store, found.account, found.kept.joined, env2);
|
|
25364
25525
|
let answer;
|
|
25365
25526
|
try {
|
|
25366
25527
|
answer = await askOrRedeem(server, options);
|
|
25367
25528
|
} catch (error62) {
|
|
25368
|
-
if (
|
|
25369
|
-
return
|
|
25529
|
+
if (found !== void 0 && usedUp(error62))
|
|
25530
|
+
return rehomed(store, found.account, found.kept.joined, env2);
|
|
25370
25531
|
throw error62;
|
|
25371
25532
|
}
|
|
25372
|
-
const
|
|
25533
|
+
const answered = joinedOf(answer);
|
|
25534
|
+
const joined2 = { ...answered, url: hereInstead(answered.url, env2) ?? answered.url };
|
|
25373
25535
|
if (store !== false)
|
|
25374
25536
|
store.set(account, JSON.stringify({ ...joined2, from, hello: "due" }));
|
|
25375
25537
|
return joined2;
|
|
@@ -25527,9 +25689,9 @@ function promptFor(message, options = {}) {
|
|
|
25527
25689
|
const held = options.rulesHeld === true;
|
|
25528
25690
|
const notes = message.room?.notes ?? {};
|
|
25529
25691
|
const note = taker === void 0 ? void 0 : held ? noteWithoutRules(message.room, taker) : notes[taker];
|
|
25530
|
-
const
|
|
25692
|
+
const who2 = options.sayWho === false ? "" : `${withRole(message.from.display_name, message.from)}: `;
|
|
25531
25693
|
const files = (message.attachments ?? []).map(renderAttachment);
|
|
25532
|
-
const words4 = [`${
|
|
25694
|
+
const words4 = [`${who2}${message.text}`, ...files].join("\n");
|
|
25533
25695
|
const sending = options.sendsFiles === true && !held ? sendingFiles({ project: options.project !== void 0 }) : void 0;
|
|
25534
25696
|
const replying = renderReplyingTo(message.replying_to, {
|
|
25535
25697
|
sender: {
|
|
@@ -28517,12 +28679,12 @@ function goalOf(message, name) {
|
|
|
28517
28679
|
const goal = named ? first.slice(name.length + 1).trim() : first.replace(/^@\S+\s*/, "");
|
|
28518
28680
|
return (goal === "" ? `Answer ${message.from.display_name}` : goal).slice(0, 300);
|
|
28519
28681
|
}
|
|
28520
|
-
function lookAgainPrompt(
|
|
28682
|
+
function lookAgainPrompt(who2, reply, note) {
|
|
28521
28683
|
const quoted2 = reply === void 0 || reply.trim() === "" ? void 0 : `Your reply:
|
|
28522
28684
|
\xAB${cut(reply.trim(), QUOTED)}\xBB`;
|
|
28523
28685
|
const wrong = note === void 0 ? "They didn't say what. Read your reply again and find what was wrong." : `What wasn't right: \xAB${note}\xBB`;
|
|
28524
28686
|
return [
|
|
28525
|
-
`${
|
|
28687
|
+
`${who2} says your reply in this space wasn't right.`,
|
|
28526
28688
|
quoted2,
|
|
28527
28689
|
wrong,
|
|
28528
28690
|
"Look at it again and answer properly in its place. If it is not clear what was wrong, ask them in one short line. Say plainly what you changed."
|
|
@@ -28910,7 +29072,10 @@ await bridge.start();
|
|
|
28910
29072
|
log(`connected as ${chips.harnessId} (${kind.name}), ${Object.keys(state.agents).length} agent(s)`);
|
|
28911
29073
|
await helloOnce(joined, {
|
|
28912
29074
|
name: kind.name,
|
|
28913
|
-
say: (spaceId) =>
|
|
29075
|
+
say: (spaceId) => (
|
|
29076
|
+
// In the shape every bridge's hello has: "Hi, I'm …", then what to do (the onboarding audit, item 39).
|
|
29077
|
+
chips.post({ spaceId, text: `Hi, I'm ${kind.name}. Ask me anything here, or make me an agent from any space.` })
|
|
29078
|
+
)
|
|
28914
29079
|
}).catch((error62) => log(`hello not said: ${String(error62)}`));
|
|
28915
29080
|
var stop = () => {
|
|
28916
29081
|
bridge?.stop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chipschat/acp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
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.
|
|
37
|
-
"@chipschat/harness": "1.0.
|
|
38
|
-
"@chipschat/protocol": "1.0.
|
|
36
|
+
"@chipschat/conformance": "1.0.4",
|
|
37
|
+
"@chipschat/harness": "1.0.4",
|
|
38
|
+
"@chipschat/protocol": "1.0.4",
|
|
39
39
|
"@types/node": "22.19.0",
|
|
40
40
|
"esbuild": "0.27.7",
|
|
41
41
|
"tsx": "4.21.0",
|