@chipschat/protocol 0.0.0-stage → 1.0.1
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/LICENSE +201 -0
- package/README.md +56 -2
- package/dist/generated/types.d.ts +4052 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +7 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/src/address.d.ts +106 -0
- package/dist/src/address.d.ts.map +1 -0
- package/dist/src/address.js +141 -0
- package/dist/src/address.js.map +1 -0
- package/dist/src/agent-context-windows.d.ts +235 -0
- package/dist/src/agent-context-windows.d.ts.map +1 -0
- package/dist/src/agent-context-windows.js +213 -0
- package/dist/src/agent-context-windows.js.map +1 -0
- package/dist/src/agent-heartbeats.d.ts +106 -0
- package/dist/src/agent-heartbeats.d.ts.map +1 -0
- package/dist/src/agent-heartbeats.js +111 -0
- package/dist/src/agent-heartbeats.js.map +1 -0
- package/dist/src/agent-models.d.ts +158 -0
- package/dist/src/agent-models.d.ts.map +1 -0
- package/dist/src/agent-models.js +171 -0
- package/dist/src/agent-models.js.map +1 -0
- package/dist/src/agent-place.d.ts +76 -0
- package/dist/src/agent-place.d.ts.map +1 -0
- package/dist/src/agent-place.js +80 -0
- package/dist/src/agent-place.js.map +1 -0
- package/dist/src/agents.d.ts +24 -0
- package/dist/src/agents.d.ts.map +1 -0
- package/dist/src/agents.js +58 -0
- package/dist/src/agents.js.map +1 -0
- package/dist/src/capabilities.d.ts +121 -0
- package/dist/src/capabilities.d.ts.map +1 -0
- package/dist/src/capabilities.js +120 -0
- package/dist/src/capabilities.js.map +1 -0
- package/dist/src/checklist.d.ts +19 -0
- package/dist/src/checklist.d.ts.map +1 -0
- package/dist/src/checklist.js +22 -0
- package/dist/src/checklist.js.map +1 -0
- package/dist/src/commands.d.ts +50 -0
- package/dist/src/commands.d.ts.map +1 -0
- package/dist/src/commands.js +274 -0
- package/dist/src/commands.js.map +1 -0
- package/dist/src/connectors.d.ts +90 -0
- package/dist/src/connectors.d.ts.map +1 -0
- package/dist/src/connectors.js +119 -0
- package/dist/src/connectors.js.map +1 -0
- package/dist/src/context-files.d.ts +304 -0
- package/dist/src/context-files.d.ts.map +1 -0
- package/dist/src/context-files.js +247 -0
- package/dist/src/context-files.js.map +1 -0
- package/dist/src/context.d.ts +369 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +526 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/direct-asks.d.ts +36 -0
- package/dist/src/direct-asks.d.ts.map +1 -0
- package/dist/src/direct-asks.js +43 -0
- package/dist/src/direct-asks.js.map +1 -0
- package/dist/src/envelope.d.ts +70 -0
- package/dist/src/envelope.d.ts.map +1 -0
- package/dist/src/envelope.js +46 -0
- package/dist/src/envelope.js.map +1 -0
- package/dist/src/events/catalogue.d.ts +50 -0
- package/dist/src/events/catalogue.d.ts.map +1 -0
- package/dist/src/events/catalogue.js +70 -0
- package/dist/src/events/catalogue.js.map +1 -0
- package/dist/src/events/chips-to-harness.d.ts +37 -0
- package/dist/src/events/chips-to-harness.d.ts.map +1 -0
- package/dist/src/events/chips-to-harness.js +511 -0
- package/dist/src/events/chips-to-harness.js.map +1 -0
- package/dist/src/events/harness-to-chips.d.ts +38 -0
- package/dist/src/events/harness-to-chips.d.ts.map +1 -0
- package/dist/src/events/harness-to-chips.js +593 -0
- package/dist/src/events/harness-to-chips.js.map +1 -0
- package/dist/src/events/index.d.ts +6 -0
- package/dist/src/events/index.d.ts.map +1 -0
- package/dist/src/events/index.js +5 -0
- package/dist/src/events/index.js.map +1 -0
- package/dist/src/events/workspace.d.ts +222 -0
- package/dist/src/events/workspace.d.ts.map +1 -0
- package/dist/src/events/workspace.js +1039 -0
- package/dist/src/events/workspace.js.map +1 -0
- package/dist/src/exchange.d.ts +262 -0
- package/dist/src/exchange.d.ts.map +1 -0
- package/dist/src/exchange.js +413 -0
- package/dist/src/exchange.js.map +1 -0
- package/dist/src/first-names.d.ts +29 -0
- package/dist/src/first-names.d.ts.map +1 -0
- package/dist/src/first-names.js +80 -0
- package/dist/src/first-names.js.map +1 -0
- package/dist/src/frames.d.ts +526 -0
- package/dist/src/frames.d.ts.map +1 -0
- package/dist/src/frames.js +346 -0
- package/dist/src/frames.js.map +1 -0
- package/dist/src/harness-jobs.d.ts +313 -0
- package/dist/src/harness-jobs.d.ts.map +1 -0
- package/dist/src/harness-jobs.js +210 -0
- package/dist/src/harness-jobs.js.map +1 -0
- package/dist/src/ids/index.d.ts +3 -0
- package/dist/src/ids/index.d.ts.map +1 -0
- package/dist/src/ids/index.js +2 -0
- package/dist/src/ids/index.js.map +1 -0
- package/dist/src/ids/ulid.d.ts +96 -0
- package/dist/src/ids/ulid.d.ts.map +1 -0
- package/dist/src/ids/ulid.js +212 -0
- package/dist/src/ids/ulid.js.map +1 -0
- package/dist/src/index.d.ts +81 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +47 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/invite-link.d.ts +64 -0
- package/dist/src/invite-link.d.ts.map +1 -0
- package/dist/src/invite-link.js +99 -0
- package/dist/src/invite-link.js.map +1 -0
- package/dist/src/join.d.ts +188 -0
- package/dist/src/join.d.ts.map +1 -0
- package/dist/src/join.js +190 -0
- package/dist/src/join.js.map +1 -0
- package/dist/src/limits.d.ts +50 -0
- package/dist/src/limits.d.ts.map +1 -0
- package/dist/src/limits.js +106 -0
- package/dist/src/limits.js.map +1 -0
- package/dist/src/matters.d.ts +22 -0
- package/dist/src/matters.d.ts.map +1 -0
- package/dist/src/matters.js +26 -0
- package/dist/src/matters.js.map +1 -0
- package/dist/src/mentions.d.ts +63 -0
- package/dist/src/mentions.d.ts.map +1 -0
- package/dist/src/mentions.js +129 -0
- package/dist/src/mentions.js.map +1 -0
- package/dist/src/names.d.ts +58 -0
- package/dist/src/names.d.ts.map +1 -0
- package/dist/src/names.js +192 -0
- package/dist/src/names.js.map +1 -0
- package/dist/src/no-reply.d.ts +17 -0
- package/dist/src/no-reply.d.ts.map +1 -0
- package/dist/src/no-reply.js +48 -0
- package/dist/src/no-reply.js.map +1 -0
- package/dist/src/notifications.d.ts +81 -0
- package/dist/src/notifications.d.ts.map +1 -0
- package/dist/src/notifications.js +65 -0
- package/dist/src/notifications.js.map +1 -0
- package/dist/src/pages.d.ts +32 -0
- package/dist/src/pages.d.ts.map +1 -0
- package/dist/src/pages.js +32 -0
- package/dist/src/pages.js.map +1 -0
- package/dist/src/pairing.d.ts +99 -0
- package/dist/src/pairing.d.ts.map +1 -0
- package/dist/src/pairing.js +163 -0
- package/dist/src/pairing.js.map +1 -0
- package/dist/src/primitives.d.ts +267 -0
- package/dist/src/primitives.d.ts.map +1 -0
- package/dist/src/primitives.js +279 -0
- package/dist/src/primitives.js.map +1 -0
- package/dist/src/project.d.ts +335 -0
- package/dist/src/project.d.ts.map +1 -0
- package/dist/src/project.js +499 -0
- package/dist/src/project.js.map +1 -0
- package/dist/src/ranges.d.ts +31 -0
- package/dist/src/ranges.d.ts.map +1 -0
- package/dist/src/ranges.js +51 -0
- package/dist/src/ranges.js.map +1 -0
- package/dist/src/relay.d.ts +177 -0
- package/dist/src/relay.d.ts.map +1 -0
- package/dist/src/relay.js +147 -0
- package/dist/src/relay.js.map +1 -0
- package/dist/src/room-files.d.ts +146 -0
- package/dist/src/room-files.d.ts.map +1 -0
- package/dist/src/room-files.js +135 -0
- package/dist/src/room-files.js.map +1 -0
- package/dist/src/room-note.d.ts +213 -0
- package/dist/src/room-note.d.ts.map +1 -0
- package/dist/src/room-note.js +457 -0
- package/dist/src/room-note.js.map +1 -0
- package/dist/src/space-icons.d.ts +68 -0
- package/dist/src/space-icons.d.ts.map +1 -0
- package/dist/src/space-icons.js +142 -0
- package/dist/src/space-icons.js.map +1 -0
- package/dist/src/spend.d.ts +57 -0
- package/dist/src/spend.d.ts.map +1 -0
- package/dist/src/spend.js +94 -0
- package/dist/src/spend.js.map +1 -0
- package/dist/src/visibility.d.ts +170 -0
- package/dist/src/visibility.d.ts.map +1 -0
- package/dist/src/visibility.js +218 -0
- package/dist/src/visibility.js.map +1 -0
- package/fixtures/agent.asked.json +15 -0
- package/fixtures/agent.attached.json +15 -0
- package/fixtures/agent.deleted.json +16 -0
- package/fixtures/agent.fork.json +14 -0
- package/fixtures/agent.lock_set.json +13 -0
- package/fixtures/agent.registered.json +17 -0
- package/fixtures/agent.released.json +16 -0
- package/fixtures/agent.updated.json +14 -0
- package/fixtures/approval.executed.json +16 -0
- package/fixtures/approval.request.json +45 -0
- package/fixtures/approval.resolved.json +20 -0
- package/fixtures/approval.routed.json +20 -0
- package/fixtures/artifact.create.json +18 -0
- package/fixtures/attachment.fetched.json +15 -0
- package/fixtures/attachment.limits_set.json +15 -0
- package/fixtures/budget.warning.json +20 -0
- package/fixtures/checkpoint.json +16 -0
- package/fixtures/context.compacted.json +16 -0
- package/fixtures/context.usage.json +17 -0
- package/fixtures/exchange.limits_set.json +15 -0
- package/fixtures/exchange.set.json +13 -0
- package/fixtures/feedback.json +21 -0
- package/fixtures/frames/ack.json +6 -0
- package/fixtures/frames/context.edit.json +11 -0
- package/fixtures/frames/context_window.change.json +9 -0
- package/fixtures/frames/context_window.compact.json +8 -0
- package/fixtures/frames/error.json +6 -0
- package/fixtures/frames/event.json +20 -0
- package/fixtures/frames/events.json +39 -0
- package/fixtures/frames/folder.open.json +6 -0
- package/fixtures/frames/folder.open.page.json +7 -0
- package/fixtures/frames/folder.run.json +8 -0
- package/fixtures/frames/folder.run_state.json +12 -0
- package/fixtures/frames/heartbeat.change.json +10 -0
- package/fixtures/frames/hello.json +18 -0
- package/fixtures/frames/job.change.json +9 -0
- package/fixtures/frames/join.json +19 -0
- package/fixtures/frames/model.change.json +10 -0
- package/fixtures/frames/ping.json +4 -0
- package/fixtures/frames/pong.json +4 -0
- package/fixtures/frames/presence.json +12 -0
- package/fixtures/frames/receipt.json +5 -0
- package/fixtures/frames/restart.json +5 -0
- package/fixtures/frames/subscribe.json +6 -0
- package/fixtures/handoff.json +20 -0
- package/fixtures/harness.removed.json +15 -0
- package/fixtures/harness.transferred.json +15 -0
- package/fixtures/hello.json +61 -0
- package/fixtures/join.allowed.json +20 -0
- package/fixtures/join.denied.json +17 -0
- package/fixtures/lane.updated.json +17 -0
- package/fixtures/membership.added.json +16 -0
- package/fixtures/membership.removed.json +14 -0
- package/fixtures/membership.replaced.json +15 -0
- package/fixtures/message.deleted.json +15 -0
- package/fixtures/message.edited.json +15 -0
- package/fixtures/message.handed.json +14 -0
- package/fixtures/message.heard.json +14 -0
- package/fixtures/message.held.json +14 -0
- package/fixtures/message.hidden.json +14 -0
- package/fixtures/message.new.json +96 -0
- package/fixtures/message.overheard.json +22 -0
- package/fixtures/message.pinned.json +14 -0
- package/fixtures/message.post.json +14 -0
- package/fixtures/message.shown.json +14 -0
- package/fixtures/message.unpinned.json +14 -0
- package/fixtures/person.face_set.json +17 -0
- package/fixtures/person.joined.json +16 -0
- package/fixtures/person.removed.json +16 -0
- package/fixtures/person.renamed.json +14 -0
- package/fixtures/policy.updated.json +30 -0
- package/fixtures/project.changed.json +21 -0
- package/fixtures/question.answered.json +23 -0
- package/fixtures/question.ask.json +37 -0
- package/fixtures/receipt.json +15 -0
- package/fixtures/relay.set.json +12 -0
- package/fixtures/role.changed.json +15 -0
- package/fixtures/run.cancel.json +15 -0
- package/fixtures/run.completed.json +20 -0
- package/fixtures/run.failed.json +20 -0
- package/fixtures/run.pause.json +15 -0
- package/fixtures/run.plan.json +24 -0
- package/fixtures/run.requested.json +34 -0
- package/fixtures/run.resume.json +15 -0
- package/fixtures/run.started.json +33 -0
- package/fixtures/run.status.json +17 -0
- package/fixtures/run.steer.json +21 -0
- package/fixtures/session.ended.json +15 -0
- package/fixtures/session.renamed.json +15 -0
- package/fixtures/session.started.json +17 -0
- package/fixtures/space.claimed.json +15 -0
- package/fixtures/space.created.json +14 -0
- package/fixtures/space.erased.json +13 -0
- package/fixtures/space.lead_set.json +13 -0
- package/fixtures/space.lock_set.json +13 -0
- package/fixtures/space.spend_ceiling_set.json +13 -0
- package/fixtures/space.updated.json +14 -0
- package/fixtures/step.log.json +26 -0
- package/fixtures/task.json +22 -0
- package/fixtures/turn.passed.json +14 -0
- package/fixtures/usage.json +21 -0
- package/fixtures/workspace.renamed.json +13 -0
- package/generated/agent-connect.json +13966 -0
- package/generated/schema/agent.asked.json +114 -0
- package/generated/schema/agent.attached.json +465 -0
- package/generated/schema/agent.deleted.json +127 -0
- package/generated/schema/agent.fork.json +107 -0
- package/generated/schema/agent.lock_set.json +105 -0
- package/generated/schema/agent.registered.json +130 -0
- package/generated/schema/agent.released.json +129 -0
- package/generated/schema/agent.updated.json +151 -0
- package/generated/schema/approval.executed.json +125 -0
- package/generated/schema/approval.request.json +279 -0
- package/generated/schema/approval.resolved.json +162 -0
- package/generated/schema/approval.routed.json +185 -0
- package/generated/schema/artifact.create.json +206 -0
- package/generated/schema/attachment.fetched.json +114 -0
- package/generated/schema/attachment.limits_set.json +136 -0
- package/generated/schema/budget.warning.json +152 -0
- package/generated/schema/checkpoint.json +111 -0
- package/generated/schema/context.compacted.json +124 -0
- package/generated/schema/context.usage.json +120 -0
- package/generated/schema/exchange.limits_set.json +127 -0
- package/generated/schema/exchange.set.json +144 -0
- package/generated/schema/feedback.json +173 -0
- package/generated/schema/handoff.json +122 -0
- package/generated/schema/harness.removed.json +122 -0
- package/generated/schema/harness.transferred.json +117 -0
- package/generated/schema/hello.json +509 -0
- package/generated/schema/join.allowed.json +176 -0
- package/generated/schema/join.denied.json +150 -0
- package/generated/schema/lane.updated.json +223 -0
- package/generated/schema/membership.added.json +153 -0
- package/generated/schema/membership.removed.json +126 -0
- package/generated/schema/membership.replaced.json +106 -0
- package/generated/schema/message.deleted.json +105 -0
- package/generated/schema/message.edited.json +107 -0
- package/generated/schema/message.handed.json +111 -0
- package/generated/schema/message.heard.json +100 -0
- package/generated/schema/message.held.json +181 -0
- package/generated/schema/message.hidden.json +100 -0
- package/generated/schema/message.new.json +1369 -0
- package/generated/schema/message.overheard.json +701 -0
- package/generated/schema/message.pinned.json +100 -0
- package/generated/schema/message.post.json +290 -0
- package/generated/schema/message.shown.json +100 -0
- package/generated/schema/message.unpinned.json +100 -0
- package/generated/schema/person.face_set.json +134 -0
- package/generated/schema/person.joined.json +128 -0
- package/generated/schema/person.removed.json +133 -0
- package/generated/schema/person.renamed.json +114 -0
- package/generated/schema/policy.updated.json +277 -0
- package/generated/schema/project.changed.json +199 -0
- package/generated/schema/question.answered.json +154 -0
- package/generated/schema/question.ask.json +194 -0
- package/generated/schema/receipt.json +109 -0
- package/generated/schema/relay.set.json +99 -0
- package/generated/schema/role.changed.json +116 -0
- package/generated/schema/run.cancel.json +106 -0
- package/generated/schema/run.completed.json +139 -0
- package/generated/schema/run.failed.json +135 -0
- package/generated/schema/run.pause.json +106 -0
- package/generated/schema/run.plan.json +128 -0
- package/generated/schema/run.requested.json +309 -0
- package/generated/schema/run.resume.json +106 -0
- package/generated/schema/run.started.json +142 -0
- package/generated/schema/run.status.json +120 -0
- package/generated/schema/run.steer.json +163 -0
- package/generated/schema/session.ended.json +106 -0
- package/generated/schema/session.renamed.json +108 -0
- package/generated/schema/session.started.json +116 -0
- package/generated/schema/space.claimed.json +107 -0
- package/generated/schema/space.created.json +148 -0
- package/generated/schema/space.erased.json +129 -0
- package/generated/schema/space.lead_set.json +108 -0
- package/generated/schema/space.lock_set.json +99 -0
- package/generated/schema/space.spend_ceiling_set.json +102 -0
- package/generated/schema/space.updated.json +112 -0
- package/generated/schema/step.log.json +187 -0
- package/generated/schema/task.json +268 -0
- package/generated/schema/turn.passed.json +99 -0
- package/generated/schema/usage.json +155 -0
- package/generated/schema/workspace.renamed.json +107 -0
- package/generated/types.ts +4178 -0
- package/package.json +38 -3
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The referee (ADR 0097): Chips talks before it stops.
|
|
3
|
+
*
|
|
4
|
+
* Agents in a room hand work to each other by @. ADR 0081 held the fifth message agents sent each
|
|
5
|
+
* other without a person, which stopped three agents sharing out an alphabet before the first
|
|
6
|
+
* letter was written (the ASCII Art room, 2 October 2026). So Chips counts the talk between
|
|
7
|
+
* agents since the last reset — anything a person does in the room, or anything new an agent
|
|
8
|
+
* makes — and says what it sees. From `NUDGE_AT` the facts ride each agent's next turn; on a
|
|
9
|
+
* circle, or from `WARN_AT`, the way out rides with them and the people are told; only at
|
|
10
|
+
* `CEILING`, or when a person pauses them, are messages between agents held, and loudly. Those
|
|
11
|
+
* three are the defaults: a workspace sets its own stop and hold, either of them never, and
|
|
12
|
+
* whether circles count (`ExchangeLimits`, ADR 0187).
|
|
13
|
+
*
|
|
14
|
+
* The server that counts, the conformance fake that plays the server and the clients that draw
|
|
15
|
+
* the room read the same rules and the same words, so they live here.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
import { agentId, isoTimestamp } from "./primitives.js";
|
|
19
|
+
/** From this many messages between agents since the last reset, the facts ride their turns. */
|
|
20
|
+
export const NUDGE_AT = 8;
|
|
21
|
+
/** From this many, or on a circle, the note names the way out and the people are told. */
|
|
22
|
+
export const WARN_AT = 16;
|
|
23
|
+
/** After this many, messages between agents are held until a person acts. */
|
|
24
|
+
export const CEILING = 48;
|
|
25
|
+
export const DEFAULT_EXCHANGE_LIMITS = {
|
|
26
|
+
stop: WARN_AT,
|
|
27
|
+
hold: CEILING,
|
|
28
|
+
circles: true,
|
|
29
|
+
};
|
|
30
|
+
/** What a stop may be, and a hold, in messages: the event refuses anything else. */
|
|
31
|
+
export const STOP_RANGE = { least: 4, most: 500 };
|
|
32
|
+
export const HOLD_RANGE = { least: 10, most: 1000 };
|
|
33
|
+
/** The stops and the holds You offers, beside Other and Never. */
|
|
34
|
+
export const STOP_CHOICES = [8, 16, 32, 64];
|
|
35
|
+
export const HOLD_CHOICES = [24, 48, 100, 200];
|
|
36
|
+
/** From how many messages the facts ride the agents' turns: half the stop, or `NUDGE_AT`. */
|
|
37
|
+
export function nudgeAt(limits) {
|
|
38
|
+
return limits.stop === null ? NUDGE_AT : Math.max(2, Math.round(limits.stop / 2));
|
|
39
|
+
}
|
|
40
|
+
const within = (n, range) => Number.isInteger(n) && n >= range.least && n <= range.most;
|
|
41
|
+
/**
|
|
42
|
+
* Why these cannot be a workspace's limits, in the words a person reads, or nothing: each a whole
|
|
43
|
+
* number in its range, and the stop before the hold, or Chips would hold the agents before it
|
|
44
|
+
* told them to stop.
|
|
45
|
+
*/
|
|
46
|
+
export function limitsProblem(limits) {
|
|
47
|
+
if (limits.stop !== null && !within(limits.stop, STOP_RANGE)) {
|
|
48
|
+
return "Chips tells agents to stop after a whole number of messages, from 4 to 500.";
|
|
49
|
+
}
|
|
50
|
+
if (limits.hold !== null && !within(limits.hold, HOLD_RANGE)) {
|
|
51
|
+
return "Chips holds agents after a whole number of messages, from 10 to 1,000.";
|
|
52
|
+
}
|
|
53
|
+
if (limits.stop !== null && limits.hold !== null && limits.stop >= limits.hold) {
|
|
54
|
+
return "Chips would hold the agents before telling them to stop. Make the stop smaller than the hold.";
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
/** The limits an `exchange.limits_set` carries; what it leaves out is the default's. */
|
|
59
|
+
export function exchangeLimitsOf(payload) {
|
|
60
|
+
const count = (name) => {
|
|
61
|
+
const value = payload[name];
|
|
62
|
+
if (value === null)
|
|
63
|
+
return null;
|
|
64
|
+
return typeof value === "number" ? value : DEFAULT_EXCHANGE_LIMITS[name];
|
|
65
|
+
};
|
|
66
|
+
const circles = payload["circles"];
|
|
67
|
+
return {
|
|
68
|
+
stop: count("stop"),
|
|
69
|
+
hold: count("hold"),
|
|
70
|
+
circles: typeof circles === "boolean" ? circles : DEFAULT_EXCHANGE_LIMITS.circles,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* What a person does in a room that starts the count again, and hands over what was held:
|
|
75
|
+
* writing, answering a question, deciding or handing on an approval, adding or taking somebody
|
|
76
|
+
* out, steering or stopping a run, a thumb on what was said — and letting the agents carry on
|
|
77
|
+
* (`exchange.set` with `going`, which is asked of its state). Pausing them is not among them.
|
|
78
|
+
*/
|
|
79
|
+
export const PERSON_ACTS = new Set([
|
|
80
|
+
"message.post",
|
|
81
|
+
"question.answered",
|
|
82
|
+
"approval.resolved",
|
|
83
|
+
"approval.routed",
|
|
84
|
+
"membership.added",
|
|
85
|
+
"membership.removed",
|
|
86
|
+
"run.steer",
|
|
87
|
+
"run.cancel",
|
|
88
|
+
"run.pause",
|
|
89
|
+
"run.resume",
|
|
90
|
+
"feedback",
|
|
91
|
+
]);
|
|
92
|
+
/** Whether this event, by a person, starts the count again (`PERSON_ACTS`, or carrying on). */
|
|
93
|
+
export function resetsTheCount(type, payload) {
|
|
94
|
+
return PERSON_ACTS.has(type) || (type === "exchange.set" && payload["state"] === "going");
|
|
95
|
+
}
|
|
96
|
+
/** What an agent makes that starts the count again, besides a file new to the room. */
|
|
97
|
+
export const WORK_ACTS = new Set(["question.ask", "approval.request"]);
|
|
98
|
+
export const exchangeStage = z
|
|
99
|
+
.enum(["quiet", "nudge", "warning", "held"])
|
|
100
|
+
.describe("`quiet` under the nudge; `nudge` from it (half the workspace's stop, or 8); `warning` on a circle or from the stop; `held` at the hold or while a person has paused the agents. The stop, the hold and whether circles count are the workspace's (ADR 0187): 16, 48 and yes unless an owner or an admin changed them.");
|
|
101
|
+
export const exchangeReset = z
|
|
102
|
+
.object({
|
|
103
|
+
kind: z
|
|
104
|
+
.enum(["person", "work", "start"])
|
|
105
|
+
.describe("`person`: somebody did something in the room. `work`: an agent made something new — a file new to the room, a question to a person, an approval request. `start`: nothing since the room began."),
|
|
106
|
+
seq: z.int().nonnegative().describe("Where the count starts from, after this."),
|
|
107
|
+
at: isoTimestamp.optional().describe("When. Absent at the start."),
|
|
108
|
+
by: z
|
|
109
|
+
.string()
|
|
110
|
+
.min(1)
|
|
111
|
+
.max(120)
|
|
112
|
+
.optional()
|
|
113
|
+
.describe("Who: the person, or the agent that made it."),
|
|
114
|
+
made: z
|
|
115
|
+
.enum(["file", "question", "approval"])
|
|
116
|
+
.optional()
|
|
117
|
+
.describe("For `work`: what the agent made."),
|
|
118
|
+
file: z.string().min(1).max(255).optional().describe("For a file: its name."),
|
|
119
|
+
})
|
|
120
|
+
.describe("The last reset of the count.");
|
|
121
|
+
export const exchangeRepeat = z.object({
|
|
122
|
+
message_id: z.string().min(1).max(120),
|
|
123
|
+
by: z.string().min(1).max(120),
|
|
124
|
+
kind: z
|
|
125
|
+
.enum(["file", "words"])
|
|
126
|
+
.describe("`file`: it carried a file already in the room. `words`: its words are much the same as words its sender already sent since the reset."),
|
|
127
|
+
file: z.string().min(1).max(255).optional(),
|
|
128
|
+
});
|
|
129
|
+
export const exchangeFacts = z
|
|
130
|
+
.object({
|
|
131
|
+
count: z
|
|
132
|
+
.int()
|
|
133
|
+
.nonnegative()
|
|
134
|
+
.describe("Messages agents have sent agents in the room since the reset, this one included."),
|
|
135
|
+
since: exchangeReset,
|
|
136
|
+
minutes: z.int().nonnegative().describe("Since the reset."),
|
|
137
|
+
person_looking: z
|
|
138
|
+
.boolean()
|
|
139
|
+
.nullable()
|
|
140
|
+
.describe("Whether somebody has the room open: a person not behind it by a message older than a minute. `null` when Chips cannot say."),
|
|
141
|
+
person: z
|
|
142
|
+
.string()
|
|
143
|
+
.min(1)
|
|
144
|
+
.max(120)
|
|
145
|
+
.optional()
|
|
146
|
+
.describe("Who to tell what is done and what is blocked: the person who last acted here."),
|
|
147
|
+
repeats: z
|
|
148
|
+
.array(exchangeRepeat)
|
|
149
|
+
.max(CEILING)
|
|
150
|
+
.describe("Which of the messages repeat, newest last."),
|
|
151
|
+
circling: z
|
|
152
|
+
.boolean()
|
|
153
|
+
.describe("The same two or three agents taking turns with nothing new: two rounds with a repeat among them."),
|
|
154
|
+
also_for: z
|
|
155
|
+
.array(agentId)
|
|
156
|
+
.max(64)
|
|
157
|
+
.describe("Who else this message is for, besides whoever it is delivered to."),
|
|
158
|
+
stage: exchangeStage,
|
|
159
|
+
allowance: z
|
|
160
|
+
.int()
|
|
161
|
+
.positive()
|
|
162
|
+
.optional()
|
|
163
|
+
.describe("After how many messages between agents Chips holds them: the workspace's hold (ADR 0187). Absent when it holds them only on a pause."),
|
|
164
|
+
paused: z
|
|
165
|
+
.boolean()
|
|
166
|
+
.describe("A person paused the agents, or Chips did at the room's spend ceiling (ADR 0118), and nobody has acted since."),
|
|
167
|
+
})
|
|
168
|
+
.describe("How the agents' talk in the room stands (ADR 0097).");
|
|
169
|
+
/** The facts as a turn is handed them, with the words a harness puts at the top of the turn. */
|
|
170
|
+
export const deliveredExchange = exchangeFacts.extend({
|
|
171
|
+
note: z.string().min(1).max(4000).describe("The facts in plain words, for the top of the turn."),
|
|
172
|
+
});
|
|
173
|
+
/**
|
|
174
|
+
* Where the talk is: held at the hold or on a pause, then a warning at the stop or on a circle,
|
|
175
|
+
* a nudge, or nothing. `circling` is a circle the workspace watches for (`circles`).
|
|
176
|
+
*/
|
|
177
|
+
export function stageOf(count, circling, paused, limits = DEFAULT_EXCHANGE_LIMITS) {
|
|
178
|
+
if (paused || (limits.hold !== null && count >= limits.hold))
|
|
179
|
+
return "held";
|
|
180
|
+
if (circling || (limits.stop !== null && count >= limits.stop))
|
|
181
|
+
return "warning";
|
|
182
|
+
return count >= nudgeAt(limits) ? "nudge" : "quiet";
|
|
183
|
+
}
|
|
184
|
+
/** Whether an agent's next message to an agent is held: after the hold, or on a pause. */
|
|
185
|
+
export function holds(exchange) {
|
|
186
|
+
const hold = (exchange.limits ?? DEFAULT_EXCHANGE_LIMITS).hold;
|
|
187
|
+
return exchange.paused || (hold !== null && exchange.count >= hold);
|
|
188
|
+
}
|
|
189
|
+
/** Whether the last `p × rounds` speakers are the same `p` agents taking turns, in order. */
|
|
190
|
+
function roundsOf(speakers, p, rounds) {
|
|
191
|
+
const tail = speakers.slice(-p * rounds);
|
|
192
|
+
if (tail.length < p * rounds)
|
|
193
|
+
return false;
|
|
194
|
+
const round = tail.slice(0, p);
|
|
195
|
+
if (new Set(round).size !== p)
|
|
196
|
+
return false;
|
|
197
|
+
return tail.every((speaker, index) => speaker === round[index % p]);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Whether the talk is going round: the same two or three agents taking turns (A B A B, A B C A B
|
|
201
|
+
* C) for two rounds, with a repeat among them. `repeated` says, for each speaker, whether that
|
|
202
|
+
* message repeated. Nothing new was made by them, or the count would have started again.
|
|
203
|
+
*
|
|
204
|
+
* Taking turns alone is not going round (ADR 0097's addendum of 17 October 2026). ADR 0097 also
|
|
205
|
+
* called three rounds with no repeat a circle, which told two agents working a problem through to
|
|
206
|
+
* stop at their sixth message, and three at their ninth, whatever they were saying.
|
|
207
|
+
*/
|
|
208
|
+
export function circleIn(speakers, repeated) {
|
|
209
|
+
return [2, 3].some((p) => roundsOf(speakers, p, 2) && repeated.slice(-2 * p).some(Boolean));
|
|
210
|
+
}
|
|
211
|
+
/** Fewer words than this are never a repeat: "Thanks!" twice is manners. */
|
|
212
|
+
const MIN_WORDS = 6;
|
|
213
|
+
/** How alike two messages' word trigrams must be to be the same words again. */
|
|
214
|
+
const LIKENESS = 0.6;
|
|
215
|
+
/** A message's words as a repeat compares them: lower case, no @names, links or punctuation. */
|
|
216
|
+
export function wordsFor(text) {
|
|
217
|
+
return (text
|
|
218
|
+
.toLowerCase()
|
|
219
|
+
.replace(/https?:\/\/\S+/g, " ")
|
|
220
|
+
.replace(/@[\p{L}\p{N}_.-]+/gu, " ")
|
|
221
|
+
// "Bank's" is one word, so a lone letter is only ever a letter ("F to J").
|
|
222
|
+
.replace(/['’ʼ]/gu, "")
|
|
223
|
+
.replace(/[^\p{L}\p{N}\s]/gu, " ")
|
|
224
|
+
.split(/\s+/)
|
|
225
|
+
.filter((word) => word !== ""));
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* The particulars among a message's words: anything with a digit in it (a section, a batch, a
|
|
229
|
+
* commit, a total) and lone letters but "a" and "i" (a range of letters, a column). Work handed
|
|
230
|
+
* on in the same words each time differs in these, and only in these.
|
|
231
|
+
*/
|
|
232
|
+
function particularsOf(words) {
|
|
233
|
+
return [
|
|
234
|
+
...new Set(words.filter((word) => /\p{N}/u.test(word) || (word.length === 1 && !/[ai]/.test(word)))),
|
|
235
|
+
]
|
|
236
|
+
.sort()
|
|
237
|
+
.join(" ");
|
|
238
|
+
}
|
|
239
|
+
function trigrams(words) {
|
|
240
|
+
const grams = new Set();
|
|
241
|
+
for (let i = 0; i + 2 < words.length; i += 1)
|
|
242
|
+
grams.add(`${words[i]} ${words[i + 1]} ${words[i + 2]}`);
|
|
243
|
+
return grams;
|
|
244
|
+
}
|
|
245
|
+
function likeness(a, b) {
|
|
246
|
+
let shared = 0;
|
|
247
|
+
for (const gram of a)
|
|
248
|
+
if (b.has(gram))
|
|
249
|
+
shared += 1;
|
|
250
|
+
const either = a.size + b.size - shared;
|
|
251
|
+
return either === 0 ? 0 : shared / either;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Whether these words are much the same as one of the earlier ones (ADR 0097): their word
|
|
255
|
+
* trigrams at least 60% alike, with @names, links and punctuation left out, so the same words to
|
|
256
|
+
* another agent are the same words, and about the same particulars. Under six words is never a
|
|
257
|
+
* repeat.
|
|
258
|
+
*
|
|
259
|
+
* "Done with section 3 … over to you for section 4" after "Done with section 2 … over to you for
|
|
260
|
+
* section 3" is work handed on in the same words, not the same words again: the particulars
|
|
261
|
+
* differ (ADR 0097's addendum of 17 October 2026).
|
|
262
|
+
*/
|
|
263
|
+
export function repeatOf(text, earlier) {
|
|
264
|
+
const words = wordsFor(text);
|
|
265
|
+
if (words.length < MIN_WORDS)
|
|
266
|
+
return false;
|
|
267
|
+
const mine = trigrams(words);
|
|
268
|
+
const particulars = particularsOf(words);
|
|
269
|
+
return earlier.some((other) => {
|
|
270
|
+
const theirs = wordsFor(other);
|
|
271
|
+
return (theirs.length >= MIN_WORDS &&
|
|
272
|
+
particularsOf(theirs) === particulars &&
|
|
273
|
+
likeness(mine, trigrams(theirs)) >= LIKENESS);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The repeats in a stretch, and for each message whether it repeated, as a circle reads it: its
|
|
278
|
+
* words again, or a file already in the room posted again with nothing new said beside it. A
|
|
279
|
+
* reviewer posting the file it is commenting on, with new comments, is at work; the file is still
|
|
280
|
+
* among the repeats, so its next turn is told that posting it again reaches nobody new.
|
|
281
|
+
*/
|
|
282
|
+
function repeatsIn(messages) {
|
|
283
|
+
const repeats = [];
|
|
284
|
+
const repeated = messages.map((message, index) => {
|
|
285
|
+
const file = message.filesSeen[0];
|
|
286
|
+
const earlier = messages
|
|
287
|
+
.slice(0, index)
|
|
288
|
+
.filter((each) => each.by === message.by)
|
|
289
|
+
.map((each) => each.text);
|
|
290
|
+
const again = repeatOf(message.text, earlier);
|
|
291
|
+
const kind = file !== undefined ? "file" : again ? "words" : undefined;
|
|
292
|
+
if (kind === undefined)
|
|
293
|
+
return false;
|
|
294
|
+
repeats.push({
|
|
295
|
+
message_id: message.message_id,
|
|
296
|
+
by: message.by,
|
|
297
|
+
kind,
|
|
298
|
+
...(kind === "file" && file !== undefined ? { file } : {}),
|
|
299
|
+
});
|
|
300
|
+
return again || wordsFor(message.text).length < MIN_WORDS;
|
|
301
|
+
});
|
|
302
|
+
return { repeats, repeated };
|
|
303
|
+
}
|
|
304
|
+
/** The facts of a stretch of talk, as of `nowMs`, for a message also for `alsoFor`. */
|
|
305
|
+
export function exchangeFactsOf(stretch, options) {
|
|
306
|
+
const limits = stretch.limits ?? DEFAULT_EXCHANGE_LIMITS;
|
|
307
|
+
const { repeats, repeated } = repeatsIn(stretch.messages);
|
|
308
|
+
// A workspace that switched circles off is never told of one (ADR 0187).
|
|
309
|
+
const circling = limits.circles &&
|
|
310
|
+
circleIn(stretch.messages.map((message) => message.by), repeated);
|
|
311
|
+
const at = stretch.since.at === undefined ? Number.NaN : Date.parse(stretch.since.at);
|
|
312
|
+
return {
|
|
313
|
+
count: stretch.count,
|
|
314
|
+
since: stretch.since,
|
|
315
|
+
minutes: Number.isNaN(at) ? 0 : Math.max(0, Math.floor((options.nowMs - at) / 60_000)),
|
|
316
|
+
person_looking: stretch.personLooking,
|
|
317
|
+
...(stretch.person === undefined ? {} : { person: stretch.person }),
|
|
318
|
+
// As many as the schema keeps, whatever the hold.
|
|
319
|
+
repeats: repeats.slice(-CEILING),
|
|
320
|
+
circling,
|
|
321
|
+
also_for: [...(options.alsoFor ?? [])],
|
|
322
|
+
stage: stageOf(stretch.count, circling, stretch.paused, limits),
|
|
323
|
+
...(limits.hold === null ? {} : { allowance: limits.hold }),
|
|
324
|
+
paused: stretch.paused,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/** "A", "A and B", "A, B and C". */
|
|
328
|
+
function listed(names) {
|
|
329
|
+
if (names.length <= 1)
|
|
330
|
+
return names[0] ?? "";
|
|
331
|
+
return `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
|
|
332
|
+
}
|
|
333
|
+
function plural(n, one, many) {
|
|
334
|
+
return `${n} ${n === 1 ? one : many}`;
|
|
335
|
+
}
|
|
336
|
+
/** What the count runs from, in words: "Arjun last acted", "ASCII Art posted a.html". */
|
|
337
|
+
function sinceWords(since, nameOf) {
|
|
338
|
+
const who = since.by === undefined ? undefined : nameOf(since.by);
|
|
339
|
+
if (since.kind === "start")
|
|
340
|
+
return "this space began";
|
|
341
|
+
if (since.kind === "person")
|
|
342
|
+
return `${who ?? "a person"} last acted here`;
|
|
343
|
+
if (since.made === "file")
|
|
344
|
+
return `${who ?? "an agent"} posted ${since.file ?? "a new file"}`;
|
|
345
|
+
if (since.made === "question")
|
|
346
|
+
return `${who ?? "an agent"} asked a person a question`;
|
|
347
|
+
return `${who ?? "an agent"} asked for an approval`;
|
|
348
|
+
}
|
|
349
|
+
function agoWords(facts) {
|
|
350
|
+
if (facts.since.at === undefined)
|
|
351
|
+
return "";
|
|
352
|
+
return facts.minutes === 0
|
|
353
|
+
? ", under a minute ago"
|
|
354
|
+
: `, ${plural(facts.minutes, "minute", "minutes")} ago`;
|
|
355
|
+
}
|
|
356
|
+
function lookingWords(looking) {
|
|
357
|
+
if (looking === null)
|
|
358
|
+
return undefined;
|
|
359
|
+
return looking ? "A person has this space open now." : "No person has this space open now.";
|
|
360
|
+
}
|
|
361
|
+
function repeatWords(repeats, nameOf) {
|
|
362
|
+
const files = [
|
|
363
|
+
...new Set(repeats.flatMap((each) => (each.file === undefined ? [] : [each.file]))),
|
|
364
|
+
];
|
|
365
|
+
const sayers = [
|
|
366
|
+
...new Set(repeats.filter((each) => each.kind === "words").map((each) => each.by)),
|
|
367
|
+
];
|
|
368
|
+
const words = [];
|
|
369
|
+
if (files.length > 0) {
|
|
370
|
+
const them = files.length === 1 ? "it" : "them";
|
|
371
|
+
words.push(`${listed(files)} ${files.length === 1 ? "was" : "were"} posted here before; posting ${them} again reaches nobody new.`);
|
|
372
|
+
}
|
|
373
|
+
if (sayers.length > 0) {
|
|
374
|
+
words.push(`${listed(sayers.map(nameOf))} ${sayers.length === 1 ? "has" : "have"} said much the same before.`);
|
|
375
|
+
}
|
|
376
|
+
return words;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* The facts in plain words, as a turn is handed them (ADR 0097). A nudge says what Chips sees; a
|
|
380
|
+
* warning, or a hold, says the way out too:
|
|
381
|
+
*
|
|
382
|
+
* > The agents in this room have sent each other 16 messages since Arjun last acted here, 21
|
|
383
|
+
* > minutes ago. No person has this room open now. ascii-alphabet.html was posted here before;
|
|
384
|
+
* > posting it again reaches nobody new. Stop, and tell Arjun what is done and what is blocked.
|
|
385
|
+
* > Messages between the agents are held after 48.
|
|
386
|
+
*/
|
|
387
|
+
export function renderExchangeNote(facts, nameOf) {
|
|
388
|
+
const parts = [
|
|
389
|
+
`The agents in this space have sent each other ${plural(facts.count, "message", "messages")} since ${sinceWords(facts.since, nameOf)}${agoWords(facts)}.`,
|
|
390
|
+
];
|
|
391
|
+
const looking = lookingWords(facts.person_looking);
|
|
392
|
+
if (looking !== undefined)
|
|
393
|
+
parts.push(looking);
|
|
394
|
+
parts.push(...repeatWords(facts.repeats.slice(-5), nameOf));
|
|
395
|
+
if (facts.also_for.length > 0) {
|
|
396
|
+
parts.push(`This message is also for ${listed(facts.also_for.map(nameOf))}, who may answer it too.`);
|
|
397
|
+
}
|
|
398
|
+
if (facts.stage === "quiet" || facts.stage === "nudge")
|
|
399
|
+
return parts.join(" ");
|
|
400
|
+
if (facts.circling) {
|
|
401
|
+
parts.push("This looks like a circle: the same agents taking turns, and nothing new made since.");
|
|
402
|
+
}
|
|
403
|
+
const person = facts.person === undefined ? "the person" : nameOf(facts.person);
|
|
404
|
+
parts.push(`Stop, and tell ${person} what is done and what is blocked.`);
|
|
405
|
+
if (facts.stage === "held") {
|
|
406
|
+
parts.push("Messages between the agents are held until a person acts.");
|
|
407
|
+
}
|
|
408
|
+
else if (facts.allowance !== undefined) {
|
|
409
|
+
parts.push(`Messages between the agents are held after ${facts.allowance}.`);
|
|
410
|
+
}
|
|
411
|
+
return parts.join(" ");
|
|
412
|
+
}
|
|
413
|
+
//# sourceMappingURL=exchange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange.js","sourceRoot":"","sources":["../../src/exchange.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAExD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAC1B,0FAA0F;AAC1F,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC;AAC1B,6EAA6E;AAC7E,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC;AAe1B,MAAM,CAAC,MAAM,uBAAuB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,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChF,KAAK,CAAC,IAAI,CAAC,kBAAkB,MAAM,oCAAoC,CAAC,CAAC;IACzE,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC1E,CAAC;SAAM,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACzC,KAAK,CAAC,IAAI,CAAC,8CAA8C,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first name a new agent gets in a room asked of its harness from the + (ADR 0150): picked as
|
|
3
|
+
* the room is made, held for the harness while it waits for the first message, and taken by the
|
|
4
|
+
* agent the harness makes on it, so the room says "Milo and Theo are here" and they stay Milo and
|
|
5
|
+
* Theo. The server picks it and keeps one a person's device proposed when it is free; the devices
|
|
6
|
+
* propose one so the room is drawn with it at once.
|
|
7
|
+
*
|
|
8
|
+
* Men's first names, on Arjun's word, three to six letters, easy to say and to type after an @.
|
|
9
|
+
* Left out: the names of AI products (Claude, Jules, Leo, Devin, Jarvis, Watson, Hal, Grok), names
|
|
10
|
+
* that are everyday words (Will, Rich, Mark, Bill, Frank, Grant, Drew, Art, Dean, Pat, Rob), and the
|
|
11
|
+
* harnesses' own (Jacobian, OpenClaw, Scout, Hermes, Goose). A name somebody in the workspace has is
|
|
12
|
+
* taken like any other.
|
|
13
|
+
*/
|
|
14
|
+
export declare const AGENT_FIRST_NAMES: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* A first name for a new agent, off the list: one nobody has (`taken`, as clash keys: the
|
|
17
|
+
* workspace's people, its active agents and the names other rooms hold), and, while there is
|
|
18
|
+
* one, whose first letter nobody in the room has (`beside`, the names there), picked at random
|
|
19
|
+
* among those so the names are not handed out in order. With every name taken, a numbered one,
|
|
20
|
+
* "Milo 2", as Chips numbers any clash (ADR 0091). `random` is `Math.random` but in a test.
|
|
21
|
+
*/
|
|
22
|
+
export declare function pickAgentName(taken: ReadonlySet<string>, beside?: readonly string[], random?: () => number): string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether a name a person's device proposed may be held: a name at all, one line, nothing
|
|
25
|
+
* `nameProblem` refuses, never Main or You (SEC-33), and nobody's (`taken`). Chips picks another
|
|
26
|
+
* when it is not.
|
|
27
|
+
*/
|
|
28
|
+
export declare function mayHoldName(name: unknown, taken: ReadonlySet<string>): name is string;
|
|
29
|
+
//# sourceMappingURL=first-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-names.d.ts","sourceRoot":"","sources":["../../src/first-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EA2BX,CAAC;AAOrC;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,MAAM,GAAE,SAAS,MAAM,EAAO,EAC9B,MAAM,GAAE,MAAM,MAAoB,GACjC,MAAM,CAQR;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,MAAM,CAWrF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first name a new agent gets in a room asked of its harness from the + (ADR 0150): picked as
|
|
3
|
+
* the room is made, held for the harness while it waits for the first message, and taken by the
|
|
4
|
+
* agent the harness makes on it, so the room says "Milo and Theo are here" and they stay Milo and
|
|
5
|
+
* Theo. The server picks it and keeps one a person's device proposed when it is free; the devices
|
|
6
|
+
* propose one so the room is drawn with it at once.
|
|
7
|
+
*
|
|
8
|
+
* Men's first names, on Arjun's word, three to six letters, easy to say and to type after an @.
|
|
9
|
+
* Left out: the names of AI products (Claude, Jules, Leo, Devin, Jarvis, Watson, Hal, Grok), names
|
|
10
|
+
* that are everyday words (Will, Rich, Mark, Bill, Frank, Grant, Drew, Art, Dean, Pat, Rob), and the
|
|
11
|
+
* harnesses' own (Jacobian, OpenClaw, Scout, Hermes, Goose). A name somebody in the workspace has is
|
|
12
|
+
* taken like any other.
|
|
13
|
+
*/
|
|
14
|
+
import { clashKey, freeAgentName, nameProblem, notAnAgentName } from "./names.js";
|
|
15
|
+
export const AGENT_FIRST_NAMES = [
|
|
16
|
+
"Abel Aldo Amir Amos Anders Ansel Anton Ari Arlo Arne Aron Arvid Asher Avi Axel Aziz",
|
|
17
|
+
"Basil Beau Benji Benno Bilal Bjorn Blaise Boaz Bodhi Boris Bram Bruno Byron",
|
|
18
|
+
"Cai Caleb Calum Caspar Cato Cedric Cian Ciro Clyde Colm Conor Cosmo Cyrus",
|
|
19
|
+
"Dag Dante Dario Darius Dax Declan Diego Dima Dmitri Dorian Dov Duncan",
|
|
20
|
+
"Edgar Elan Eli Elias Elio Emil Emmet Ennio Enzo Erik Evren Ewan Ezra",
|
|
21
|
+
"Fabio Fausto Felix Fenn Ferris Finn Fitz Florin Floyd Franz",
|
|
22
|
+
"Gael Galen Gareth Gideon Gil Gino Goran Grady Guido Gunnar Gus",
|
|
23
|
+
"Hamish Hamza Hank Hans Harvey Hassan Hector Henrik Hiro Hollis Hugo Huxley",
|
|
24
|
+
"Ian Idris Igor Ike Ilan Imre Ingo Ira Isaac Ivan Ivar Ivo",
|
|
25
|
+
"Jago Jamal Jasper Javier Jem Jens Jiro Joel Jonah Jorge Joss Jude",
|
|
26
|
+
"Kai Kamal Karim Kasper Kenji Kian Kieran Klaus Knox Koa Kofi Kurt",
|
|
27
|
+
"Laszlo Lars Leif Leon Lev Lionel Lior Louis Lucca Lucien Luis Lyle",
|
|
28
|
+
"Mads Magnus Malik Marco Marlo Mateo Mattis Mauro Milo Miro Moses Musa",
|
|
29
|
+
"Nadir Nash Naveen Ned Nelson Nestor Niall Nico Nigel Nils Noah Nuri",
|
|
30
|
+
"Odin Olaf Oliver Omar Oren Orson Osman Oscar Otis Otto Owen Ozzie",
|
|
31
|
+
"Pablo Paolo Pascal Pavel Pedro Percy Perrin Philo Pierre Piet",
|
|
32
|
+
"Qadir Quincy Quinn",
|
|
33
|
+
"Rafa Ramon Raul Ravi Remy Reza Rhys Rio Rocco Rowan Ruben Rudy Rumi",
|
|
34
|
+
"Sami Sanjay Santo Saul Sergio Seth Silas Simon Soren Stefan Sven",
|
|
35
|
+
"Taj Tariq Tate Teddy Theo Thor Tiago Tobias Toby Tomas Tycho",
|
|
36
|
+
"Ugo Ulf Ulric Umar Uri",
|
|
37
|
+
"Valo Vance Vasco Vaughn Victor Vidal Viggo Vik Vinny Vito Vlad",
|
|
38
|
+
"Waldo Walt Warren Wendel Wes Wilder Willem Wim Wyatt Wynn",
|
|
39
|
+
"Xander Xavi Xavier",
|
|
40
|
+
"Yann Yaro Yosef Yuri Yusuf Yves",
|
|
41
|
+
"Zaid Zane Zeke Zeno Zev Ziggy",
|
|
42
|
+
].flatMap((line) => line.split(" "));
|
|
43
|
+
/** A name's first letter, as two names in one room are told apart by their faces. */
|
|
44
|
+
function initialOf(name) {
|
|
45
|
+
return clashKey(name).charAt(0);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A first name for a new agent, off the list: one nobody has (`taken`, as clash keys: the
|
|
49
|
+
* workspace's people, its active agents and the names other rooms hold), and, while there is
|
|
50
|
+
* one, whose first letter nobody in the room has (`beside`, the names there), picked at random
|
|
51
|
+
* among those so the names are not handed out in order. With every name taken, a numbered one,
|
|
52
|
+
* "Milo 2", as Chips numbers any clash (ADR 0091). `random` is `Math.random` but in a test.
|
|
53
|
+
*/
|
|
54
|
+
export function pickAgentName(taken, beside = [], random = Math.random) {
|
|
55
|
+
const letters = new Set(beside.map(initialOf));
|
|
56
|
+
const free = AGENT_FIRST_NAMES.filter((name) => !taken.has(clashKey(name)));
|
|
57
|
+
const apart = free.filter((name) => !letters.has(initialOf(name)));
|
|
58
|
+
const from = apart.length > 0 ? apart : free;
|
|
59
|
+
const at = (list) => list[Math.floor(random() * list.length)];
|
|
60
|
+
if (from.length > 0)
|
|
61
|
+
return at(from);
|
|
62
|
+
return freeAgentName(at(AGENT_FIRST_NAMES), taken);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Whether a name a person's device proposed may be held: a name at all, one line, nothing
|
|
66
|
+
* `nameProblem` refuses, never Main or You (SEC-33), and nobody's (`taken`). Chips picks another
|
|
67
|
+
* when it is not.
|
|
68
|
+
*/
|
|
69
|
+
export function mayHoldName(name, taken) {
|
|
70
|
+
if (typeof name !== "string")
|
|
71
|
+
return false;
|
|
72
|
+
const trimmed = name.trim();
|
|
73
|
+
return (trimmed !== "" &&
|
|
74
|
+
trimmed.length <= 40 &&
|
|
75
|
+
!/\n/.test(trimmed) &&
|
|
76
|
+
nameProblem(trimmed) === undefined &&
|
|
77
|
+
!notAnAgentName(trimmed) &&
|
|
78
|
+
!taken.has(clashKey(trimmed)));
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=first-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-names.js","sourceRoot":"","sources":["../../src/first-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAElF,MAAM,CAAC,MAAM,iBAAiB,GAAsB;IAClD,qFAAqF;IACrF,6EAA6E;IAC7E,2EAA2E;IAC3E,uEAAuE;IACvE,sEAAsE;IACtE,6DAA6D;IAC7D,gEAAgE;IAChE,4EAA4E;IAC5E,2DAA2D;IAC3D,mEAAmE;IACnE,m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