@chipschat/protocol 0.0.0-stage → 1.0.0
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/envelope.d.ts +54 -0
- package/dist/envelope.d.ts.map +1 -0
- package/dist/envelope.js +48 -0
- package/dist/envelope.js.map +1 -0
- package/dist/events/agent-to-chips.d.ts +27 -0
- package/dist/events/agent-to-chips.d.ts.map +1 -0
- package/dist/events/agent-to-chips.js +392 -0
- package/dist/events/agent-to-chips.js.map +1 -0
- package/dist/events/catalogue.d.ts +48 -0
- package/dist/events/catalogue.d.ts.map +1 -0
- package/dist/events/catalogue.js +67 -0
- package/dist/events/catalogue.js.map +1 -0
- package/dist/events/chips-to-agent.d.ts +24 -0
- package/dist/events/chips-to-agent.d.ts.map +1 -0
- package/dist/events/chips-to-agent.js +324 -0
- package/dist/events/chips-to-agent.js.map +1 -0
- package/dist/events/chips-to-harness.d.ts +24 -0
- package/dist/events/chips-to-harness.d.ts.map +1 -0
- package/dist/events/chips-to-harness.js +324 -0
- package/dist/events/chips-to-harness.js.map +1 -0
- package/dist/events/harness-to-chips.d.ts +27 -0
- package/dist/events/harness-to-chips.d.ts.map +1 -0
- package/dist/events/harness-to-chips.js +390 -0
- package/dist/events/harness-to-chips.js.map +1 -0
- package/dist/events/index.d.ts +6 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +5 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/workspace.d.ts +19 -0
- package/dist/events/workspace.d.ts.map +1 -0
- package/dist/events/workspace.js +79 -0
- package/dist/events/workspace.js.map +1 -0
- package/dist/frames.d.ts +175 -0
- package/dist/frames.d.ts.map +1 -0
- package/dist/frames.js +161 -0
- package/dist/frames.js.map +1 -0
- 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/ids/index.d.ts +3 -0
- package/dist/ids/index.d.ts.map +1 -0
- package/dist/ids/index.js +2 -0
- package/dist/ids/index.js.map +1 -0
- package/dist/ids/ulid.d.ts +83 -0
- package/dist/ids/ulid.d.ts.map +1 -0
- package/dist/ids/ulid.js +199 -0
- package/dist/ids/ulid.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/primitives.d.ts +194 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +193 -0
- package/dist/primitives.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 +37 -3
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an agent is told of the room with each turn (ADR 0092): who is in it, how to reach each of
|
|
3
|
+
* them with an @, and what an @ does.
|
|
4
|
+
*
|
|
5
|
+
* Chips knows the room and its rules; a harness knew only what it had heard. So Chips words the
|
|
6
|
+
* note, once, here, and sends it on `message.new` as `room`: the members, each with the handle
|
|
7
|
+
* that reaches them, and the note itself for each who takes the turn. The server that sends it,
|
|
8
|
+
* the conformance fake that plays the server and the SDK that hands it over read the same words.
|
|
9
|
+
* It no longer says when Chips holds the agents (ADR 0187): the referee's warning says that, when
|
|
10
|
+
* it matters, in the workspace's own numbers.
|
|
11
|
+
*
|
|
12
|
+
* Each agent is listed with the harness it runs on (ADR 0101): "ASCII Art (Jacobian agent,
|
|
13
|
+
* @ASCIIArt)". A brief that said "Jacobian is the lead" left two agents asking "@Jacobian" in a room
|
|
14
|
+
* where Jacobian's agent was called ASCII Art.
|
|
15
|
+
*
|
|
16
|
+
* A room may have a lead (ADR 0104): the agent that hands out the work, and that Chips hands what
|
|
17
|
+
* was nobody's turn once the room goes still. The note says who it is, which of the others have a
|
|
18
|
+
* turn going and how long each has been without one, and, to the one taking the turn, what is
|
|
19
|
+
* news to it: that it has just joined, who joined since it last spoke, or, to the lead, that this
|
|
20
|
+
* message is its because it was nobody's. People in a team see all that for themselves; an agent
|
|
21
|
+
* exists only in its turns, so Chips says it at the top of each. And when older lines of what was
|
|
22
|
+
* said since its last turn were left out of the turn, it says that too (ADR 0105).
|
|
23
|
+
*
|
|
24
|
+
* In a room with other agents, every taker is told it may answer `NO_REPLY` when a message asks
|
|
25
|
+
* nothing of it now, and the lead that a step handed from one agent to another needs no word from
|
|
26
|
+
* it (ADR 0109). ASCII Art's OpenClaw agents, named for a step that was theirs later, said "Ready
|
|
27
|
+
* for J2's updated HTML", and J1, copied on each hand-off, said it again to the next agent.
|
|
28
|
+
*/
|
|
29
|
+
import { z } from "zod";
|
|
30
|
+
import { handleMap, isHandle } from "./mentions.js";
|
|
31
|
+
import { NO_REPLY } from "./no-reply.js";
|
|
32
|
+
import { spendWords } from "./spend.js";
|
|
33
|
+
export const roomMember = z.object({
|
|
34
|
+
participant_id: z.string().min(1).max(120),
|
|
35
|
+
kind: z
|
|
36
|
+
.enum(["person", "agent", "harness"])
|
|
37
|
+
.describe("A person, or an agent: one of a harness's, or a harness in the room in its own right, as in a room asked of it it has not claimed. A harness that has not declared `agents` is shown each agent as `harness`, as everywhere else."),
|
|
38
|
+
name: z.string().min(1).max(120),
|
|
39
|
+
harness: z
|
|
40
|
+
.string()
|
|
41
|
+
.min(1)
|
|
42
|
+
.max(120)
|
|
43
|
+
.optional()
|
|
44
|
+
.describe("For an agent, the name of the harness it runs on: `Scout`; for a harness waiting in a room asked of it, listed by the first name the room holds for its agent (ADR 0150), its own name. Absent for a person, any other harness in the room in its own right, and an agent named as its harness is."),
|
|
45
|
+
handle: z
|
|
46
|
+
.string()
|
|
47
|
+
.max(61)
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("What reaches them, with its @: `@Scout2`. Their whole name with its spaces left out, or their first word where only that is a handle. Absent for a name no handle reaches, such as one letter."),
|
|
50
|
+
lead: z
|
|
51
|
+
.literal(true)
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("The room's lead (ADR 0104): it hands out the work, and Chips hands it what was nobody's turn once the room goes still."),
|
|
54
|
+
time_zone: z
|
|
55
|
+
.string()
|
|
56
|
+
.min(1)
|
|
57
|
+
.max(64)
|
|
58
|
+
.optional()
|
|
59
|
+
.describe('For a person, the IANA zone of the phone they registered last (ADR 0157): what "at 10am" means to them, which the note says as their time now. Absent when Chips knows none.'),
|
|
60
|
+
});
|
|
61
|
+
export const roomWork = z.object({
|
|
62
|
+
participant_id: z.string().min(1).max(120),
|
|
63
|
+
minutes: z.int().nonnegative().describe("How long its turn has been going, in whole minutes."),
|
|
64
|
+
step: z
|
|
65
|
+
.string()
|
|
66
|
+
.min(1)
|
|
67
|
+
.max(200)
|
|
68
|
+
.optional()
|
|
69
|
+
.describe("The last step its turn said it was on, when its harness says its steps."),
|
|
70
|
+
});
|
|
71
|
+
export const roomIdle = z.object({
|
|
72
|
+
participant_id: z.string().min(1).max(120),
|
|
73
|
+
minutes: z
|
|
74
|
+
.int()
|
|
75
|
+
.nonnegative()
|
|
76
|
+
.describe("How long since its last turn here ended, in whole minutes."),
|
|
77
|
+
});
|
|
78
|
+
export const roomNote = z.object({
|
|
79
|
+
members: z
|
|
80
|
+
.array(roomMember)
|
|
81
|
+
.max(500)
|
|
82
|
+
.describe("The room's people, then its agents, each by name, anybody removed left out."),
|
|
83
|
+
notes: z
|
|
84
|
+
.record(z.string().max(120), z.string().max(64_000))
|
|
85
|
+
.describe("The note for each who takes the turn (`for`), by their id: who is here, with handles, and that only those @-mentioned act. A harness puts it at the top of the turn."),
|
|
86
|
+
rules: z
|
|
87
|
+
.record(z.string().max(120), z.string().max(4000))
|
|
88
|
+
.optional()
|
|
89
|
+
.describe("How the space works, for each who takes the turn, by their id: the words its note ends with (ADR 0250), that everyone here reads what it writes and, beside other agents, what an @ does and when to answer NO_REPLY. They stay the same while the space's agents do, so a harness whose session keeps its earlier turns may say them once, and the note without them after."),
|
|
90
|
+
working: z
|
|
91
|
+
.array(roomWork)
|
|
92
|
+
.max(500)
|
|
93
|
+
.optional()
|
|
94
|
+
.describe("The room's agents with a turn going as Chips sends this one (ADR 0104), the takers' own included. A turn nothing has been heard from for ten minutes is not counted."),
|
|
95
|
+
idle: z
|
|
96
|
+
.array(roomIdle)
|
|
97
|
+
.max(500)
|
|
98
|
+
.optional()
|
|
99
|
+
.describe("The room's other agents that have had a turn here: how long since the last one ended (ADR 0104)."),
|
|
100
|
+
});
|
|
101
|
+
/**
|
|
102
|
+
* The handle that reaches a member among these, with its @: the whole name without spaces, else
|
|
103
|
+
* the first word, whichever is a handle a text can hold and names them (ADR 0091). Its own case,
|
|
104
|
+
* so `@OpenClaw2` rather than `@openclaw2`.
|
|
105
|
+
*/
|
|
106
|
+
export function noteHandle(member, members) {
|
|
107
|
+
const byHandle = handleMap(members.map((each) => ({ id: each.id, displayName: each.name })));
|
|
108
|
+
const name = member.name.trim();
|
|
109
|
+
const candidates = [name.replace(/\s+/g, ""), name.split(/\s+/)[0] ?? ""];
|
|
110
|
+
const handle = candidates.find((word) => isHandle(word) && byHandle.get(word.toLowerCase()) === member.id);
|
|
111
|
+
return handle === undefined ? undefined : `@${handle}`;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The members as the note lists them, each with its handle: people first, then agents, each by
|
|
115
|
+
* name, numbers in order ("OpenClaw 2" before "OpenClaw 10"). Not the order they joined, which two
|
|
116
|
+
* Chipses can break a tie in differently; this reads the same from both.
|
|
117
|
+
*/
|
|
118
|
+
export function roomMembers(members) {
|
|
119
|
+
const byName = (a, b) => a.name.localeCompare(b.name, "en", { sensitivity: "base", numeric: true });
|
|
120
|
+
const ordered = [
|
|
121
|
+
...members.filter((member) => member.kind === "person").sort(byName),
|
|
122
|
+
...members.filter((member) => member.kind !== "person").sort(byName),
|
|
123
|
+
];
|
|
124
|
+
return ordered.map((member) => {
|
|
125
|
+
const handle = noteHandle(member, members);
|
|
126
|
+
// "OpenClaw (OpenClaw agent)" says nothing its name does not.
|
|
127
|
+
const harness = member.kind === "agent" &&
|
|
128
|
+
member.harness !== undefined &&
|
|
129
|
+
member.harness.trim().toLowerCase() !== member.name.trim().toLowerCase()
|
|
130
|
+
? member.harness
|
|
131
|
+
: undefined;
|
|
132
|
+
return {
|
|
133
|
+
participant_id: member.id,
|
|
134
|
+
kind: member.kind,
|
|
135
|
+
name: member.name,
|
|
136
|
+
...(harness === undefined ? {} : { harness }),
|
|
137
|
+
...(handle === undefined ? {} : { handle }),
|
|
138
|
+
...(member.lead === true ? { lead: true } : {}),
|
|
139
|
+
...(member.kind === "person" && member.timeZone !== undefined
|
|
140
|
+
? { time_zone: member.timeZone }
|
|
141
|
+
: {}),
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The note for one who takes the turn:
|
|
147
|
+
*
|
|
148
|
+
* > In this room: Arjun (person, @Arjun), ASCII Art (Jacobian agent, @ASCIIArt), and you,
|
|
149
|
+
* > OpenClaw 2 (OpenClaw agent, @OpenClaw2). ASCII Art leads here: it hands out the work, and what
|
|
150
|
+
* > is nobody's turn goes to it. Working now: O1, 2 minutes in (last step: Editing
|
|
151
|
+
* > ascii-alphabet.html). Not working: ASCII Art for 3 minutes. This job has spent $1.20 of the
|
|
152
|
+
* > $3.00 this room allows a job; at $3.00 Chips holds the agents until a person acts. Everyone
|
|
153
|
+
* > here reads what you write; only those you @-mention act on it. To hand work to an agent or ask
|
|
154
|
+
* > it something, @-mention it. If a message asks nothing of you now, as when it names a step that
|
|
155
|
+
* > is yours later, answer NO_REPLY and nothing else: the room shows nothing, and nobody needs to
|
|
156
|
+
* > hear that you are ready or waiting.
|
|
157
|
+
*
|
|
158
|
+
* What is news to the taker comes first (ADR 0104): the lead's "Nobody has this turn", "You joined
|
|
159
|
+
* this room", "New since your last turn". What the job has spent comes after who is working, when
|
|
160
|
+
* Chips said (ADR 0117), in a room with other agents or none. The note ends with its rules
|
|
161
|
+
* (`roomRules`, ADR 0250), the same from turn to turn: with no other agent in the room, only
|
|
162
|
+
* "Everyone here reads what you write."
|
|
163
|
+
*
|
|
164
|
+
* Given the instant the turn is sent (`at`), each person's time there follows the room's line
|
|
165
|
+
* (ADR 0157): "Arjun's time now: 9:12 am, Tuesday 13 October 2026 (2026-10-13T09:12-07:00,
|
|
166
|
+
* America/Los_Angeles)." An agent asked for something at 10am, or in 50 minutes, has the date,
|
|
167
|
+
* the clock and the offset to write it with.
|
|
168
|
+
*/
|
|
169
|
+
export function renderRoomNote(members, youId, now, news, spend, at) {
|
|
170
|
+
const you = members.find((member) => member.participant_id === youId);
|
|
171
|
+
const others = members.filter((member) => member.participant_id !== youId);
|
|
172
|
+
const listed = others.map(listing);
|
|
173
|
+
if (you !== undefined) {
|
|
174
|
+
const about = [you.harness === undefined ? undefined : kindOf(you), you.handle].filter(Boolean);
|
|
175
|
+
const said = `${you.name}${about.length === 0 ? "" : ` (${about.join(", ")})`}`;
|
|
176
|
+
listed.push(others.length === 0 ? `just you, ${said}` : `and you, ${said}`);
|
|
177
|
+
}
|
|
178
|
+
const shared = others.some((member) => member.kind === "agent");
|
|
179
|
+
return [
|
|
180
|
+
...newsLines(members, youId, news),
|
|
181
|
+
`In this space: ${listed.join(", ")}.`,
|
|
182
|
+
...clockLines(members, at),
|
|
183
|
+
...(shared ? [...leadLines(members, youId), ...nowLines(members, youId, now)] : []),
|
|
184
|
+
...(spend === undefined ? [] : [spendWords(spend)]),
|
|
185
|
+
roomRules(members, youId),
|
|
186
|
+
].join(" ");
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* How the space works, the words a taker's note ends with (ADR 0250): that everyone here reads what
|
|
190
|
+
* it writes, and beside other agents, what an @ does and when to answer NO_REPLY. They stay the same
|
|
191
|
+
* from turn to turn while the space's agents do. Said with every turn, they were a quarter of what a
|
|
192
|
+
* turn in a busy room carried, and in a session that keeps its turns they piled up, so `message.new`
|
|
193
|
+
* carries them apart too (`room.rules`) for a harness to say once a session.
|
|
194
|
+
*/
|
|
195
|
+
export function roomRules(members, youId) {
|
|
196
|
+
const shared = members.some((member) => member.participant_id !== youId && member.kind === "agent");
|
|
197
|
+
if (!shared)
|
|
198
|
+
return "Everyone here reads what you write.";
|
|
199
|
+
return [
|
|
200
|
+
"Everyone here reads what you write; only those you @-mention act on it.",
|
|
201
|
+
"To hand work to an agent or ask it something, @-mention it.",
|
|
202
|
+
`If a message asks nothing of you now, as when it names a step that is yours later, answer ${NO_REPLY} and nothing else: the space shows nothing, and nobody needs to hear that you are ready or waiting.`,
|
|
203
|
+
].join(" ");
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* A taker's note without the rules it ends with (ADR 0250), for a turn whose session already holds
|
|
207
|
+
* them: the whole note from a Chips that sent no rules, and nothing for a taker with no note.
|
|
208
|
+
*/
|
|
209
|
+
export function noteWithoutRules(room, taker) {
|
|
210
|
+
const note = room?.notes[taker];
|
|
211
|
+
const rules = room?.rules?.[taker];
|
|
212
|
+
if (note === undefined || rules === undefined || !note.endsWith(rules))
|
|
213
|
+
return note;
|
|
214
|
+
return note.slice(0, note.length - rules.length).trimEnd();
|
|
215
|
+
}
|
|
216
|
+
/** A member as the note lists them: "ASCII Art (Jacobian agent, @ASCIIArt)". */
|
|
217
|
+
function listing(member) {
|
|
218
|
+
return `${member.name} (${[kindOf(member), member.handle].filter(Boolean).join(", ")})`;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Each person's time now, where Chips knows their zone (ADR 0157): one person by the possessive,
|
|
222
|
+
* several in one line. A zone the runtime can't read is left out rather than guessed.
|
|
223
|
+
*/
|
|
224
|
+
function clockLines(members, at) {
|
|
225
|
+
if (at === undefined)
|
|
226
|
+
return [];
|
|
227
|
+
const instant = new Date(at);
|
|
228
|
+
if (Number.isNaN(instant.getTime()))
|
|
229
|
+
return [];
|
|
230
|
+
const clocks = members.flatMap((member) => {
|
|
231
|
+
if (member.kind !== "person" || member.time_zone === undefined)
|
|
232
|
+
return [];
|
|
233
|
+
const clock = clockIn(instant, member.time_zone);
|
|
234
|
+
return clock === undefined ? [] : [{ name: member.name, clock }];
|
|
235
|
+
});
|
|
236
|
+
const [one] = clocks;
|
|
237
|
+
if (one === undefined)
|
|
238
|
+
return [];
|
|
239
|
+
if (clocks.length === 1)
|
|
240
|
+
return [`${one.name}'s time now: ${one.clock}.`];
|
|
241
|
+
return [
|
|
242
|
+
`The time now for each person: ${clocks.map((each) => `${each.name}, ${each.clock}`).join("; ")}.`,
|
|
243
|
+
];
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* An instant as a person reads it in their zone, then as an agent writes it:
|
|
247
|
+
* "9:12 am, Tuesday 13 October 2026 (2026-10-13T09:12-07:00, America/Los_Angeles)". The offset is
|
|
248
|
+
* worked out from the wall clock rather than read from the runtime's zone names, which differ
|
|
249
|
+
* between engines.
|
|
250
|
+
*/
|
|
251
|
+
function clockIn(instant, timeZone) {
|
|
252
|
+
let parts;
|
|
253
|
+
try {
|
|
254
|
+
parts = new Intl.DateTimeFormat("en-US", {
|
|
255
|
+
timeZone,
|
|
256
|
+
year: "numeric",
|
|
257
|
+
month: "numeric",
|
|
258
|
+
day: "numeric",
|
|
259
|
+
hour: "numeric",
|
|
260
|
+
minute: "numeric",
|
|
261
|
+
second: "numeric",
|
|
262
|
+
hourCycle: "h23",
|
|
263
|
+
weekday: "long",
|
|
264
|
+
}).formatToParts(instant);
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
return undefined;
|
|
268
|
+
}
|
|
269
|
+
const part = (type) => parts.find((each) => each.type === type)?.value ?? "";
|
|
270
|
+
const [year, month, day] = [Number(part("year")), Number(part("month")), Number(part("day"))];
|
|
271
|
+
const [hour, minute, second] = [
|
|
272
|
+
Number(part("hour")),
|
|
273
|
+
Number(part("minute")),
|
|
274
|
+
Number(part("second")),
|
|
275
|
+
];
|
|
276
|
+
const wall = Date.UTC(year, month - 1, day, hour, minute, second);
|
|
277
|
+
const offset = Math.round((wall - Math.floor(instant.getTime() / 1000) * 1000) / 60_000);
|
|
278
|
+
const two = (value) => String(value).padStart(2, "0");
|
|
279
|
+
const sign = offset < 0 ? "-" : "+";
|
|
280
|
+
const zone = `${sign}${two(Math.floor(Math.abs(offset) / 60))}:${two(Math.abs(offset) % 60)}`;
|
|
281
|
+
const iso = `${year}-${two(month)}-${two(day)}T${two(hour)}:${two(minute)}${zone}`;
|
|
282
|
+
const clock = `${hour % 12 === 0 ? 12 : hour % 12}:${two(minute)} ${hour < 12 ? "am" : "pm"}`;
|
|
283
|
+
return `${clock}, ${part("weekday")} ${day} ${MONTHS[month - 1]} ${year} (${iso}, ${timeZone})`;
|
|
284
|
+
}
|
|
285
|
+
export const MONTHS = [
|
|
286
|
+
"January",
|
|
287
|
+
"February",
|
|
288
|
+
"March",
|
|
289
|
+
"April",
|
|
290
|
+
"May",
|
|
291
|
+
"June",
|
|
292
|
+
"July",
|
|
293
|
+
"August",
|
|
294
|
+
"September",
|
|
295
|
+
"October",
|
|
296
|
+
"November",
|
|
297
|
+
"December",
|
|
298
|
+
];
|
|
299
|
+
/** What is news to the taker, first (ADR 0104); last, that older lines were left out (ADR 0105). */
|
|
300
|
+
function newsLines(members, youId, news) {
|
|
301
|
+
if (news === undefined)
|
|
302
|
+
return [];
|
|
303
|
+
const newcomers = (news.newcomers ?? []).flatMap((newcomer) => {
|
|
304
|
+
const member = members.find((each) => each.participant_id === newcomer.id);
|
|
305
|
+
if (member === undefined || member.participant_id === youId)
|
|
306
|
+
return [];
|
|
307
|
+
return [`${listing(member)}${newcomer.by === undefined ? "" : `, added by ${newcomer.by}`}`];
|
|
308
|
+
});
|
|
309
|
+
// Said only where the note goes on to say that an @ is what makes a turn: beside another agent.
|
|
310
|
+
const shared = members.some((each) => each.participant_id !== youId && each.kind === "agent");
|
|
311
|
+
return [
|
|
312
|
+
...nobodysLines(news.nobodys),
|
|
313
|
+
...(news.yours === undefined || !shared
|
|
314
|
+
? []
|
|
315
|
+
: [`${news.yours.saidBy} sent this message to you without an @: it is yours to answer.`]),
|
|
316
|
+
...(news.toAll === undefined || !shared
|
|
317
|
+
? []
|
|
318
|
+
: [
|
|
319
|
+
`${news.toAll.saidBy} sent this message to every agent here, so each of you has it: answer it yourself, and don't pass it on with an @.`,
|
|
320
|
+
]),
|
|
321
|
+
...joinedLines(news.joined),
|
|
322
|
+
...(newcomers.length === 0 ? [] : [`New since your last turn: ${newcomers.join("; ")}.`]),
|
|
323
|
+
...cutLines(news.cut),
|
|
324
|
+
];
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Whether a message is for this taker though it does not @ it (ADR 0081): its sender chose it in
|
|
328
|
+
* the composer, answered its words, or wrote on to it. Not one for every agent, nor one that
|
|
329
|
+
* @-mentions it. Its note says so beside other agents, where it otherwise reads that only those
|
|
330
|
+
* @-mentioned act, and an agent that was not the lead took a person's choice as nobody's turn
|
|
331
|
+
* (ADR 0104 addendum, 15 October 2026).
|
|
332
|
+
*/
|
|
333
|
+
export function yoursWithoutAt(payload, taker) {
|
|
334
|
+
if (payload["addressed_to_all"] === true)
|
|
335
|
+
return false;
|
|
336
|
+
const addressed = payload["addressed_to"];
|
|
337
|
+
const mentions = payload["mentions"];
|
|
338
|
+
if (!Array.isArray(addressed) || !addressed.includes(taker))
|
|
339
|
+
return false;
|
|
340
|
+
return !(Array.isArray(mentions) && mentions.includes(taker));
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Whether a message went to every agent in the room (ADR 0081's All). Its note says so beside other
|
|
344
|
+
* agents (ADR 0249), where it otherwise reads that only those @-mentioned act: in a room of four
|
|
345
|
+
* agents on 30 October 2026 the lead passed a person's question for all of them on with an @ to the
|
|
346
|
+
* three who already had it, one of them had asked the others the same, and each answered twice.
|
|
347
|
+
*/
|
|
348
|
+
export function toEveryAgent(payload) {
|
|
349
|
+
return payload["addressed_to_all"] === true;
|
|
350
|
+
}
|
|
351
|
+
/** To the lead, that the message is its because it was nobody's turn (ADR 0104). */
|
|
352
|
+
function nobodysLines(nobodys) {
|
|
353
|
+
if (nobodys === undefined)
|
|
354
|
+
return [];
|
|
355
|
+
const tell = nobodys.tell ?? "the people here";
|
|
356
|
+
return [
|
|
357
|
+
`Nobody has this turn: ${nobodys.saidBy} said it with no @, and nobody in the space has worked since.`,
|
|
358
|
+
`It comes to you as the lead: hand the next step on with an @, or, if the work is done or stuck, tell ${tell}.`,
|
|
359
|
+
];
|
|
360
|
+
}
|
|
361
|
+
/** To one that joined a room already talking, when, by whom, and to work from its files. */
|
|
362
|
+
function joinedLines(joined) {
|
|
363
|
+
if (joined === undefined)
|
|
364
|
+
return [];
|
|
365
|
+
const by = joined.by === undefined ? "" : `, added by ${joined.by}`;
|
|
366
|
+
return [
|
|
367
|
+
`You joined this space ${ago(joined.minutes)}${by}.`,
|
|
368
|
+
...(joined.files
|
|
369
|
+
? [
|
|
370
|
+
"The space's files listed with this turn are its current versions: work from them, not from a copy you made in another space.",
|
|
371
|
+
]
|
|
372
|
+
: []),
|
|
373
|
+
];
|
|
374
|
+
}
|
|
375
|
+
/** That older lines of what was said since its last turn were left out of this one (ADR 0105). */
|
|
376
|
+
function cutLines(cut) {
|
|
377
|
+
if (cut === undefined)
|
|
378
|
+
return [];
|
|
379
|
+
const one = cut.shown === 1;
|
|
380
|
+
return [
|
|
381
|
+
`Only the newest ${one ? "line" : `${cut.shown} lines`} of what was said here since your last turn ${one ? "comes" : "come"} with this one: older lines were left out.`,
|
|
382
|
+
];
|
|
383
|
+
}
|
|
384
|
+
/** Who leads, said to the lead as "you" (ADR 0104). Nothing in a room with no lead. */
|
|
385
|
+
function leadLines(members, youId) {
|
|
386
|
+
const lead = members.find((member) => member.lead === true && member.kind === "agent");
|
|
387
|
+
if (lead === undefined)
|
|
388
|
+
return [];
|
|
389
|
+
return lead.participant_id === youId
|
|
390
|
+
? [
|
|
391
|
+
"You lead here: you hand out the work, and what is nobody's turn comes to you.",
|
|
392
|
+
"A step one agent has handed to another needs no word from you until it comes back to you.",
|
|
393
|
+
]
|
|
394
|
+
: [`${lead.name} leads here: it hands out the work, and what is nobody's turn goes to it.`];
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Which of the other agents have a turn going, and how long the rest have been without one
|
|
398
|
+
* (ADR 0104). Nothing when Chips did not say; an agent that has never had a turn here is left out
|
|
399
|
+
* of "Not working".
|
|
400
|
+
*/
|
|
401
|
+
function nowLines(members, youId, now) {
|
|
402
|
+
if (now === undefined)
|
|
403
|
+
return [];
|
|
404
|
+
const nameOf = (id) => id === youId ? undefined : members.find((member) => member.participant_id === id)?.name;
|
|
405
|
+
const working = now.working.flatMap((turn) => {
|
|
406
|
+
const name = nameOf(turn.participant_id);
|
|
407
|
+
if (name === undefined)
|
|
408
|
+
return [];
|
|
409
|
+
const step = turn.step === undefined ? "" : ` (last step: ${turn.step})`;
|
|
410
|
+
return [`${name}, ${duration(turn.minutes)} in${step}`];
|
|
411
|
+
});
|
|
412
|
+
const going = new Set(now.working.map((turn) => turn.participant_id));
|
|
413
|
+
const idle = now.idle.flatMap((rest) => {
|
|
414
|
+
const name = going.has(rest.participant_id) ? undefined : nameOf(rest.participant_id);
|
|
415
|
+
return name === undefined ? [] : [`${name} for ${duration(rest.minutes)}`];
|
|
416
|
+
});
|
|
417
|
+
const lines = [`Working now: ${working.length === 0 ? "nobody else" : working.join("; ")}.`];
|
|
418
|
+
if (idle.length > 0)
|
|
419
|
+
lines.push(`Not working: ${idle.join(", ")}.`);
|
|
420
|
+
return lines;
|
|
421
|
+
}
|
|
422
|
+
/** A stretch of whole minutes in words: "under a minute", "1 minute", "3 hours", "4 days". */
|
|
423
|
+
function duration(minutes) {
|
|
424
|
+
if (minutes < 1)
|
|
425
|
+
return "under a minute";
|
|
426
|
+
if (minutes === 1)
|
|
427
|
+
return "1 minute";
|
|
428
|
+
if (minutes < 90)
|
|
429
|
+
return `${minutes} minutes`;
|
|
430
|
+
if (minutes < 48 * 60)
|
|
431
|
+
return `${Math.round(minutes / 60)} hours`;
|
|
432
|
+
return `${Math.round(minutes / (24 * 60))} days`;
|
|
433
|
+
}
|
|
434
|
+
/** How long ago, in words: "just now", "4 minutes ago". */
|
|
435
|
+
function ago(minutes) {
|
|
436
|
+
return minutes < 1 ? "just now" : `${duration(minutes)} ago`;
|
|
437
|
+
}
|
|
438
|
+
/** What a member is: a person, an agent, or one of a harness's: `Jacobian agent`. */
|
|
439
|
+
function kindOf(member) {
|
|
440
|
+
return member.harness === undefined ? member.kind : `${member.harness} agent`;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* The room as `message.new` carries it: the members, and a note for each who takes the turn; with
|
|
444
|
+
* who has a turn going when Chips said (ADR 0104), what is news to each taker, what the job has
|
|
445
|
+
* spent (ADR 0117), and each person's time at the instant it is sent (`at`, ADR 0157); and the
|
|
446
|
+
* rules each note ends with (ADR 0250).
|
|
447
|
+
*/
|
|
448
|
+
export function roomNoteFor(members, takers, now, news, spend, at) {
|
|
449
|
+
const listed = roomMembers(members);
|
|
450
|
+
return {
|
|
451
|
+
members: listed,
|
|
452
|
+
notes: Object.fromEntries(takers.map((taker) => [taker, renderRoomNote(listed, taker, now, news?.[taker], spend, at)])),
|
|
453
|
+
rules: Object.fromEntries(takers.map((taker) => [taker, roomRules(listed, taker)])),
|
|
454
|
+
...(now === undefined ? {} : { working: [...now.working], idle: [...now.idle] }),
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
//# sourceMappingURL=room-note.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room-note.js","sourceRoot":"","sources":["../../src/room-note.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAiB,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAC1C,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;SACpC,QAAQ,CACP,mOAAmO,CACpO;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAChC,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR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,QAAQ,CAAC;AAChF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,OAA8B,EAC9B,MAAyB,EACzB,GAAa,EACb,IAA0C,EAC1C,KAAgB,EAChB,EAAW;IAEX,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO;QACL,OAAO,EAAE,MAAM;QACf,KAAK,EAAE,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAC7F;QACD,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACnF,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;KACjF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The face a person has chosen for a space: a mark from Chips' own library and the ground it
|
|
3
|
+
* sits on (21 September 2026).
|
|
4
|
+
*
|
|
5
|
+
* It is a person's own setting, not a fact about the room (the alternative — `space.icon_set`
|
|
6
|
+
* on the log, one face for everybody — is a bigger thing and nobody has asked for it). So it
|
|
7
|
+
* lives beside the notification settings from M5.6 rather than in the event log: read and
|
|
8
|
+
* written over `/v1/me/space-icons`, private to the person who chose it, and carried to every
|
|
9
|
+
* device they sign in on. Two people may see one room differently, which is the point.
|
|
10
|
+
*
|
|
11
|
+
* An agent's face is the same pair, a mark and a ground, but it is the agent's and one for
|
|
12
|
+
* everybody: it rides on `agent.updated` and in the directory, not here (ADR 0089). So is a
|
|
13
|
+
* person's own face, on `person.face_set` (ADR 0139).
|
|
14
|
+
*
|
|
15
|
+
* Since 7 October 2026 a face may be letters in place of a mark: one or two of them, or an emoji
|
|
16
|
+
* or two, typed by the person choosing it ("AB", "X", "🦊"). Arjun asked for it on every face at
|
|
17
|
+
* once — a space's, an agent's and a person's own — so it is a third field of the one shape, not
|
|
18
|
+
* a shape of its own (ADR 0139).
|
|
19
|
+
*
|
|
20
|
+
* The ground is an **index**, not a colour. A hex on the wire would freeze the palette into
|
|
21
|
+
* every stored row: the lift of 21 September 2026 moved all eight avatar hues, and an index
|
|
22
|
+
* means everyone's chosen face moved with it instead of stranding them on the old paint.
|
|
23
|
+
*/
|
|
24
|
+
import { z } from "zod";
|
|
25
|
+
/**
|
|
26
|
+
* How many grounds a client offers: the design system's eight avatar hues, and nineteen more
|
|
27
|
+
* that belong to no participant. A client draws index `n` from its own list; the wire only
|
|
28
|
+
* agrees on how many there are.
|
|
29
|
+
*
|
|
30
|
+
* Twelve until 26 September 2026, when Arjun asked for more colours: fifteen were added after
|
|
31
|
+
* them (a red, an orange, an olive, three greys and a deep shade of every hue), so a face chosen
|
|
32
|
+
* on the twelve kept its index and its colour. A client older than that draws an index past its
|
|
33
|
+
* own list on its first ground.
|
|
34
|
+
*/
|
|
35
|
+
export declare const SPACE_ICON_GROUNDS = 27;
|
|
36
|
+
/** As many letters as a face holds: "AB", or one emoji beside another. */
|
|
37
|
+
export declare const MOST_FACE_LETTERS = 2;
|
|
38
|
+
/** The letters of some text, as a reader counts them (`LETTER`). */
|
|
39
|
+
export declare function lettersIn(text: string): string[];
|
|
40
|
+
/**
|
|
41
|
+
* What a face's letters are, from what was typed: no spaces, and no more than two. What a field
|
|
42
|
+
* keeps as somebody types, so a third letter or a space never reaches the face.
|
|
43
|
+
*/
|
|
44
|
+
export declare function faceLetters(typed: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* How large a face's letters are drawn, against the size its initials are (ADR 0139): 1 for
|
|
47
|
+
* letters, which is the initials' own size; larger for one emoji, which fills a face as one
|
|
48
|
+
* capital does; smaller where two emoji, an emoji and a letter, or two wide characters would not
|
|
49
|
+
* fit inside it. Here, beside the letters' own rule, so the phone and the Mac draw them alike.
|
|
50
|
+
*/
|
|
51
|
+
export declare function lettersScale(letters: string): number;
|
|
52
|
+
export declare const spaceIcon: z.ZodObject<{
|
|
53
|
+
icon: z.ZodString;
|
|
54
|
+
ground: z.ZodNumber;
|
|
55
|
+
letters: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export type SpaceIcon = z.infer<typeof spaceIcon>;
|
|
58
|
+
/** What a person chose, by space id. */
|
|
59
|
+
export type SpaceIcons = Readonly<Record<string, SpaceIcon>>;
|
|
60
|
+
/** The face a person sent, or the reason it is not one. */
|
|
61
|
+
export declare function parseSpaceIcon(raw: unknown): {
|
|
62
|
+
ok: true;
|
|
63
|
+
value: SpaceIcon;
|
|
64
|
+
} | {
|
|
65
|
+
ok: false;
|
|
66
|
+
message: string;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=space-icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space-icons.d.ts","sourceRoot":"","sources":["../../src/space-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAgBnC,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAEhD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAmBD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMpD;AAaD,eAAO,MAAM,SAAS;;;;iBAoCpB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,wCAAwC;AACxC,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAE7D,2DAA2D;AAC3D,wBAAgB,cAAc,CAC5B,GAAG,EAAE,OAAO,GACX;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAQjE"}
|