@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,1039 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Events Chips records about itself.
|
|
3
|
+
*
|
|
4
|
+
* Agent Connect is the vocabulary a harness speaks. It is not the whole log. Decision 4 says
|
|
5
|
+
* every Agent Connect event **and every human action** is an event, and creating a space
|
|
6
|
+
* or adding somebody to one is a human action. Without these, `spaces` and `memberships`
|
|
7
|
+
* would be read models that no replay could reconstruct — which would make `rebuild` a lie.
|
|
8
|
+
*
|
|
9
|
+
* These never travel to a harness, with three exceptions: `space.updated` is also something a
|
|
10
|
+
* harness sends, for a space it opened itself (M3.3); `space.erased` names no space and so goes
|
|
11
|
+
* to everyone in the workspace, a harness included, which is how an adapter learns to forget a
|
|
12
|
+
* room it had cached (ADR 0067); and a `space.created` that asks a harness into a new room goes
|
|
13
|
+
* to that harness, which answers with `space.claimed` through its own door. A harness learns that
|
|
14
|
+
* it was added to a space from `message.new`, not from here. See ADR 0018 for the line between
|
|
15
|
+
* what is event-sourced and what is a registry.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
import { roomContext } from "../context.js";
|
|
19
|
+
import { defineEvent } from "../envelope.js";
|
|
20
|
+
import { HOLD_RANGE, STOP_RANGE } from "../exchange.js";
|
|
21
|
+
import { joinKind, joinStartedBy } from "../join.js";
|
|
22
|
+
import { agentId, attachment, id, isoTimestamp, PARTICIPANT_KINDS, workspaceRole, } from "../primitives.js";
|
|
23
|
+
import { projectChangedPayload } from "../project.js";
|
|
24
|
+
import { spaceIcon } from "../space-icons.js";
|
|
25
|
+
import { jobSpend, spendCeiling } from "../spend.js";
|
|
26
|
+
/** Why an agent left a room (ADR 0087): the moment table's reasons, and a person's removal. */
|
|
27
|
+
export const RELEASE_REASONS = [
|
|
28
|
+
"archived",
|
|
29
|
+
"deleted",
|
|
30
|
+
"moved",
|
|
31
|
+
"agent_archived",
|
|
32
|
+
"removed",
|
|
33
|
+
"agent_deleted",
|
|
34
|
+
];
|
|
35
|
+
const releaseReason = z
|
|
36
|
+
.enum(RELEASE_REASONS)
|
|
37
|
+
.describe("`archived`: its room was archived. `deleted`: its room was deleted. `moved`: it was moved to another room. `agent_archived`: it was archived, in its harness or by a person (ADR 0095). `removed`: a person took it out. `agent_deleted`: a person deleted it (ADR 0095).");
|
|
38
|
+
export const spaceCreated = defineEvent({
|
|
39
|
+
type: "space.created",
|
|
40
|
+
direction: "workspace",
|
|
41
|
+
sender: "person",
|
|
42
|
+
summary: "A space was opened: a direct message, a group, a channel or a thread.",
|
|
43
|
+
requiresRun: false,
|
|
44
|
+
payload: z.object({
|
|
45
|
+
kind: z
|
|
46
|
+
.enum(["direct", "group", "channel", "thread"])
|
|
47
|
+
.describe("Mixed membership is the norm; the kind is about shape, not about who is in it."),
|
|
48
|
+
title: z.string().max(200).optional().describe("What to call it. Direct messages have none."),
|
|
49
|
+
parent_space_id: id("space")
|
|
50
|
+
.optional()
|
|
51
|
+
.describe("The space this is a thread of (M5.4). A thread has no members of its own: whoever is in the parent is in the thread, and leaves it with the parent."),
|
|
52
|
+
root_message_id: id("message")
|
|
53
|
+
.optional()
|
|
54
|
+
.describe("For a thread: the message in the parent it grew from, which is where it is drawn."),
|
|
55
|
+
external_key: z
|
|
56
|
+
.string()
|
|
57
|
+
.min(1)
|
|
58
|
+
.max(440)
|
|
59
|
+
.optional()
|
|
60
|
+
.describe("What this space is in the adapter's own terms — a worktree path, the id of a project or an agent in the harness's own tree — prefixed by the harness. Unique in a workspace, so opening the same thing twice finds the space rather than making another (ADR 0024)."),
|
|
61
|
+
opened_for: z
|
|
62
|
+
.string()
|
|
63
|
+
.min(1)
|
|
64
|
+
.max(120)
|
|
65
|
+
.optional()
|
|
66
|
+
.describe("The person this was opened on behalf of, when it was not they who opened it. A harness opens a space for its owner as it finds one (ADR 0024); without this they would not be sent the event that names it, and the space would arrive with no title."),
|
|
67
|
+
asked_of: id("harness")
|
|
68
|
+
.optional()
|
|
69
|
+
.describe("The harness a person opened this room for, to make something of its own for it: an agent, a session, wherever it keeps such things. Only a person asks, only of a harness that declares `new_spaces`, and never in a thread or a room that already has a key. The harness is sent this event, and answers with `space.claimed`."),
|
|
70
|
+
also_asked_of: z
|
|
71
|
+
.array(id("harness"))
|
|
72
|
+
.min(1)
|
|
73
|
+
.max(16)
|
|
74
|
+
.optional()
|
|
75
|
+
.describe("The other harnesses asked with `asked_of`, when a person picked several faces (ADR 0084, ADR 0087's addendum of 30 September). Each is sent this event and answers with a new agent in the room, in its own place; only `asked_of` names the room."),
|
|
76
|
+
}),
|
|
77
|
+
});
|
|
78
|
+
export const spaceClaimed = defineEvent({
|
|
79
|
+
type: "space.claimed",
|
|
80
|
+
direction: "workspace",
|
|
81
|
+
sender: "chips",
|
|
82
|
+
summary: "A harness took a room a person asked it for, under a key of its own: from here the room is the harness's, as if it had opened it.",
|
|
83
|
+
requiresRun: false,
|
|
84
|
+
payload: z.object({
|
|
85
|
+
external_key: z
|
|
86
|
+
.string()
|
|
87
|
+
.min(1)
|
|
88
|
+
.max(440)
|
|
89
|
+
.describe("What the room is in the harness's own terms, prefixed by the harness, as on a `space.created` it opened itself (ADR 0024). Unique in a workspace. Written by Chips from the key the harness gave its door."),
|
|
90
|
+
title: z
|
|
91
|
+
.string()
|
|
92
|
+
.min(1)
|
|
93
|
+
.max(200)
|
|
94
|
+
.optional()
|
|
95
|
+
.describe("What the harness calls it. Absent when it named nothing, or when a person had already named the room, whose word holds."),
|
|
96
|
+
}),
|
|
97
|
+
});
|
|
98
|
+
export const spaceUpdated = defineEvent({
|
|
99
|
+
type: "space.updated",
|
|
100
|
+
direction: "workspace",
|
|
101
|
+
sender: "either",
|
|
102
|
+
summary: "A space was retitled, closed or reopened — by a person in it, or by the harness that opened it — or made a harness's home. The apps call closing a space archiving it.",
|
|
103
|
+
requiresRun: false,
|
|
104
|
+
payload: z.object({
|
|
105
|
+
title: z
|
|
106
|
+
.string()
|
|
107
|
+
.min(1)
|
|
108
|
+
.max(200)
|
|
109
|
+
.optional()
|
|
110
|
+
.describe("The new title. A harness that learns a better name for a room it opened sends this; a person's rename holds over it afterwards."),
|
|
111
|
+
state: z
|
|
112
|
+
.enum(["open", "closed"])
|
|
113
|
+
.optional()
|
|
114
|
+
.describe("Closed takes the space off the list: the runs going in it are stopped and its agents are released, free to join another room (ADR 0087). Its history and its people stay, and it can be reopened, which brings back each agent that is still free. The apps say archived and unarchived. Whether a person or a harness set it last is kept, and a harness's listing of its spaces reports it as `moved_by` (ADR 0066)."),
|
|
115
|
+
home: z
|
|
116
|
+
.boolean()
|
|
117
|
+
.optional()
|
|
118
|
+
.describe("The harness's home: the room its lead speaks in, which is always there. Nobody archives or erases it; the apps do not offer either. Only the harness that opened the space sends this (ADR 0069)."),
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* A space erased from the server (ADR 0067): its events, its rows, its files and its search
|
|
123
|
+
* entries are gone, and this is the one line the log keeps about it. It carries no `space_id`
|
|
124
|
+
* in its envelope on purpose — an event that names a space brings that space back on any device
|
|
125
|
+
* that folds it — so every device in the workspace is sent it, and each drops the rooms it names.
|
|
126
|
+
*/
|
|
127
|
+
export const spaceErased = defineEvent({
|
|
128
|
+
type: "space.erased",
|
|
129
|
+
direction: "workspace",
|
|
130
|
+
sender: "chips",
|
|
131
|
+
summary: "A space was erased from the server by a person: what was said in it, its files and its search entries are gone for everyone. Only this line stays, naming which and by whom.",
|
|
132
|
+
requiresRun: false,
|
|
133
|
+
payload: z.object({
|
|
134
|
+
erased: z
|
|
135
|
+
.array(id("space"))
|
|
136
|
+
.min(1)
|
|
137
|
+
.max(1000)
|
|
138
|
+
.describe("The space, and every thread of it, in that order. Each device forgets them."),
|
|
139
|
+
spent: z
|
|
140
|
+
.array(z.object({
|
|
141
|
+
harness_id: id("harness").describe("Whose account the room's cost was on."),
|
|
142
|
+
usd: z.number().describe("What the room had cost that harness, in US dollars."),
|
|
143
|
+
}))
|
|
144
|
+
.max(100)
|
|
145
|
+
.optional()
|
|
146
|
+
.describe("What the room cost, per harness, so an erase takes the words and leaves the spend: a budget is not topped up by erasing where it went. Written by Chips."),
|
|
147
|
+
}),
|
|
148
|
+
});
|
|
149
|
+
export const membershipAdded = defineEvent({
|
|
150
|
+
type: "membership.added",
|
|
151
|
+
direction: "workspace",
|
|
152
|
+
sender: "person",
|
|
153
|
+
chipsWrites: ["moved_from", "fork_of", "made_for", "invite_id"],
|
|
154
|
+
summary: "A person or an agent joined a space. Shows as a muted centred line.",
|
|
155
|
+
requiresRun: false,
|
|
156
|
+
payload: z.object({
|
|
157
|
+
participant_id: z.string().min(1).max(120).describe("Who joined."),
|
|
158
|
+
participant_kind: z
|
|
159
|
+
.enum(PARTICIPANT_KINDS)
|
|
160
|
+
.describe("A person or an agent (ADR 0087); `harness` for a harness in a room before the upgrade gave it an agent."),
|
|
161
|
+
role: z
|
|
162
|
+
.enum(["owner", "member", "guest"])
|
|
163
|
+
.default("member")
|
|
164
|
+
.describe("Their standing here, which is what every `from` field reports."),
|
|
165
|
+
joined_at: isoTimestamp.optional().describe("Defaults to the event's own timestamp."),
|
|
166
|
+
moved_from: id("space")
|
|
167
|
+
.optional()
|
|
168
|
+
.describe("For an agent moved here from another room (ADR 0087): the room it left. Written by Chips."),
|
|
169
|
+
fork_of: id("event")
|
|
170
|
+
.optional()
|
|
171
|
+
.describe("For a fork's copy (ADR 0087, Fork): the `agent.fork` it answers, so the room shows the copy joining on the line that asked for it. Written by Chips."),
|
|
172
|
+
made_for: id("event")
|
|
173
|
+
.optional()
|
|
174
|
+
.describe("For a new agent a person asked a harness for (ADR 0108): the `agent.asked` it answers, so the room shows it joining on the line that asked for it. Written by Chips."),
|
|
175
|
+
agent_name: z
|
|
176
|
+
.string()
|
|
177
|
+
.min(1)
|
|
178
|
+
.max(40)
|
|
179
|
+
.optional()
|
|
180
|
+
.describe("For a harness asked for this room from the + (ADR 0150): the first name its agent will have here, held for it until it claims the room or answers in it, and the name the room calls it by meanwhile. A person's device may propose one; Chips keeps it when nobody has it and picks one off its list otherwise."),
|
|
181
|
+
invite_id: id("invite")
|
|
182
|
+
.optional()
|
|
183
|
+
.describe("For a person who came in by a space's invite link (ADR 0168): the link, so the room says they joined by it. The actor is whoever made the link, who put them here. Written by Chips."),
|
|
184
|
+
}),
|
|
185
|
+
});
|
|
186
|
+
export const membershipRemoved = defineEvent({
|
|
187
|
+
type: "membership.removed",
|
|
188
|
+
direction: "workspace",
|
|
189
|
+
sender: "person",
|
|
190
|
+
chipsWrites: ["reason", "moved_to"],
|
|
191
|
+
summary: "A person or an agent left a space, or was removed from it.",
|
|
192
|
+
requiresRun: false,
|
|
193
|
+
payload: z.object({
|
|
194
|
+
participant_id: z.string().min(1).max(120).describe("Who left."),
|
|
195
|
+
removed_by: z
|
|
196
|
+
.string()
|
|
197
|
+
.min(1)
|
|
198
|
+
.max(120)
|
|
199
|
+
.optional()
|
|
200
|
+
.describe("Who removed them, if not themselves."),
|
|
201
|
+
reason: z
|
|
202
|
+
.enum([...RELEASE_REASONS, "person_removed", "person_left"])
|
|
203
|
+
.optional()
|
|
204
|
+
.describe("For an agent (ADR 0087): why it left, as `agent.released` says. For a person, `person_removed`: they were removed from the workspace (ADR 0160); `person_left`: they deleted their account and left it (ADR 0243). Written by Chips; absent, a person took them out or they left the room."),
|
|
205
|
+
moved_to: id("space")
|
|
206
|
+
.optional()
|
|
207
|
+
.describe("For an agent moved away: the room it went to, so this room can say so."),
|
|
208
|
+
}),
|
|
209
|
+
});
|
|
210
|
+
/**
|
|
211
|
+
* An agent put in a room (ADR 0087): added, moved in, brought back by an unarchive, or in its
|
|
212
|
+
* harness's place. Chips writes it beside the membership. Its `space_id` is the room; the room is
|
|
213
|
+
* sent it, and so is the agent's harness, with the room's last lines before it joined (ADR 0088,
|
|
214
|
+
* point 5).
|
|
215
|
+
*/
|
|
216
|
+
export const agentAttached = defineEvent({
|
|
217
|
+
type: "agent.attached",
|
|
218
|
+
direction: "workspace",
|
|
219
|
+
sender: "chips",
|
|
220
|
+
summary: "An agent was put in a room: added, moved in, or brought back. Its harness is handed the room's last lines with it.",
|
|
221
|
+
requiresRun: false,
|
|
222
|
+
payload: z.object({
|
|
223
|
+
agent_id: id("agent").describe("The agent, in the room this event's `space_id` names."),
|
|
224
|
+
by: z
|
|
225
|
+
.string()
|
|
226
|
+
.min(1)
|
|
227
|
+
.max(120)
|
|
228
|
+
.optional()
|
|
229
|
+
.describe("Who put it there: a person, its harness, or Chips (`system`)."),
|
|
230
|
+
moved_from: id("space").optional().describe("The room it left for this one, when moved."),
|
|
231
|
+
fork_of: id("event")
|
|
232
|
+
.optional()
|
|
233
|
+
.describe("The `agent.fork` this copy answers, when it is a fork's copy (ADR 0087, Fork)."),
|
|
234
|
+
made_for: id("event")
|
|
235
|
+
.optional()
|
|
236
|
+
.describe("The `agent.asked` this new agent answers, when a person asked for it (ADR 0108)."),
|
|
237
|
+
catch_up: roomContext
|
|
238
|
+
.optional()
|
|
239
|
+
.describe("The room's last lines before the agent joined, within the budget its harness gave in `hello` (ADR 0088, point 5). Added as it is sent to the harness; the log does not keep it."),
|
|
240
|
+
}),
|
|
241
|
+
});
|
|
242
|
+
/**
|
|
243
|
+
* An agent taken out of its room (ADR 0087): by an archive, a delete, a move, its being archived
|
|
244
|
+
* or deleted (ADR 0095), or a person. Its `space_id` is the room it left; the room is sent it, and so is
|
|
245
|
+
* the agent's harness, which is out of the room by then. The room an archive took it from is
|
|
246
|
+
* remembered, so an unarchive brings it back while it is still free.
|
|
247
|
+
*/
|
|
248
|
+
export const agentReleased = defineEvent({
|
|
249
|
+
type: "agent.released",
|
|
250
|
+
direction: "workspace",
|
|
251
|
+
sender: "chips",
|
|
252
|
+
summary: "An agent was taken out of its room and is free: by an archive, a delete, a move, its harness, or a person.",
|
|
253
|
+
requiresRun: false,
|
|
254
|
+
payload: z.object({
|
|
255
|
+
agent_id: id("agent").describe("The agent, out of the room this event's `space_id` names."),
|
|
256
|
+
by: z
|
|
257
|
+
.string()
|
|
258
|
+
.min(1)
|
|
259
|
+
.max(120)
|
|
260
|
+
.optional()
|
|
261
|
+
.describe("Who did it: a person, its harness, or Chips (`system`)."),
|
|
262
|
+
reason: releaseReason,
|
|
263
|
+
moved_to: id("space").optional().describe("The room it went to, when moved."),
|
|
264
|
+
delete: z
|
|
265
|
+
.literal(true)
|
|
266
|
+
.optional()
|
|
267
|
+
.describe("Written before ADR 0095: the room was deleted and the person asked for the agent to go in its harness too (ADR 0087, rule 5). Since ADR 0095 Chips writes `agent.deleted` for that instead; a log may still hold this."),
|
|
268
|
+
}),
|
|
269
|
+
});
|
|
270
|
+
/**
|
|
271
|
+
* A person asks an agent's harness for a copy of it in a room (ADR 0087, Fork). Its `space_id` is
|
|
272
|
+
* the room the copy is for; the room is sent it, and so is the agent's harness, which copies the
|
|
273
|
+
* agent and registers the copy with `forked_from` and this room. The room says it is forking
|
|
274
|
+
* until the copy joins, and that the harness didn't make it once `FORK_WAIT_MS` has passed.
|
|
275
|
+
*/
|
|
276
|
+
export const agentFork = defineEvent({
|
|
277
|
+
type: "agent.fork",
|
|
278
|
+
direction: "workspace",
|
|
279
|
+
sender: "chips",
|
|
280
|
+
summary: "A person asked an agent's harness for a copy of it in this room. The copy remembers everything up to now; after that, the two remember separately.",
|
|
281
|
+
requiresRun: false,
|
|
282
|
+
payload: z.object({
|
|
283
|
+
agent_id: id("agent").describe("The agent to copy. It stays where it is; the copy is for the room this event's `space_id` names."),
|
|
284
|
+
by: z.string().min(1).max(120).describe("The person who asked."),
|
|
285
|
+
}),
|
|
286
|
+
});
|
|
287
|
+
/**
|
|
288
|
+
* A person asks a harness for a new agent in a room (ADR 0108): Fork's ask with no agent to copy.
|
|
289
|
+
* Its `space_id` is the room; the room is sent it, and so is the harness asked, which is in no
|
|
290
|
+
* room itself. The harness makes an agent that remembers nothing from elsewhere and registers it
|
|
291
|
+
* with `made_for` (this event's id) and the room, where Chips puts it. The room says it is asking
|
|
292
|
+
* until the agent joins, and that the harness didn't make it once `NEW_AGENT_WAIT_MS` has passed.
|
|
293
|
+
*/
|
|
294
|
+
export const agentAsked = defineEvent({
|
|
295
|
+
type: "agent.asked",
|
|
296
|
+
direction: "workspace",
|
|
297
|
+
sender: "chips",
|
|
298
|
+
summary: "A person asked a harness for a new agent in this room. It starts with the room's last lines, and nothing from elsewhere.",
|
|
299
|
+
requiresRun: false,
|
|
300
|
+
payload: z.object({
|
|
301
|
+
harness_id: id("harness").describe("The harness asked. It makes the agent, and registers it for the room this event's `space_id` names."),
|
|
302
|
+
name: z
|
|
303
|
+
.string()
|
|
304
|
+
.min(1)
|
|
305
|
+
.max(120)
|
|
306
|
+
.describe("What the new agent is to be called: the person's word, or else the next name of its harness's that nobody here answers to. Chips numbers it, as any other, if the name is taken by the time it is registered."),
|
|
307
|
+
by: z.string().min(1).max(120).describe("The person who asked."),
|
|
308
|
+
}),
|
|
309
|
+
});
|
|
310
|
+
/**
|
|
311
|
+
* What an agent said while in no room (ADR 0087, rule 6): kept by Chips, not shown anywhere, and
|
|
312
|
+
* posted in the next room it is attached to, oldest first.
|
|
313
|
+
*/
|
|
314
|
+
export const messageHeld = defineEvent({
|
|
315
|
+
type: "message.held",
|
|
316
|
+
direction: "workspace",
|
|
317
|
+
sender: "chips",
|
|
318
|
+
summary: "An agent in no room said something: it is held, and posted in the next room the agent joins.",
|
|
319
|
+
requiresRun: false,
|
|
320
|
+
payload: z.object({
|
|
321
|
+
agent_id: id("agent").describe("Who said it."),
|
|
322
|
+
text: z.string().max(64_000).describe("Markdown, as the harness sent it."),
|
|
323
|
+
attachments: z
|
|
324
|
+
.array(attachment)
|
|
325
|
+
.max(20)
|
|
326
|
+
.optional()
|
|
327
|
+
.describe("What it attached, as the upload described them."),
|
|
328
|
+
}),
|
|
329
|
+
});
|
|
330
|
+
/**
|
|
331
|
+
* A person pauses the agents in a room, or lets them carry on (ADR 0097). While paused, every
|
|
332
|
+
* message an agent sends an agent there is held, as at the referee's ceiling. Carrying on is a
|
|
333
|
+
* person acting in the room, so the count starts again and what was held is handed over; pausing
|
|
334
|
+
* is not, so the count stands.
|
|
335
|
+
*
|
|
336
|
+
* Or Chips pauses them, with `why: "spend"`, when the room's job reaches what the room allows a
|
|
337
|
+
* job (ADR 0118); the actor is the system, and `spend` says how far it got. Carrying on is then a
|
|
338
|
+
* new job, with the room's whole ceiling again.
|
|
339
|
+
*/
|
|
340
|
+
export const exchangeSet = defineEvent({
|
|
341
|
+
type: "exchange.set",
|
|
342
|
+
direction: "workspace",
|
|
343
|
+
sender: "chips",
|
|
344
|
+
summary: "A person paused the agents in a room, or let them carry on; or Chips paused them at the room's spend ceiling.",
|
|
345
|
+
requiresRun: false,
|
|
346
|
+
payload: z.object({
|
|
347
|
+
state: z
|
|
348
|
+
.enum(["paused", "going"])
|
|
349
|
+
.describe("`paused`: their messages to each other are held. `going`: they carry on."),
|
|
350
|
+
why: z
|
|
351
|
+
.enum(["spend"])
|
|
352
|
+
.optional()
|
|
353
|
+
.describe("Why Chips paused them: `spend`, the room's job reached its ceiling (ADR 0118). Absent when a person did."),
|
|
354
|
+
spend: jobSpend
|
|
355
|
+
.optional()
|
|
356
|
+
.describe("For `why: spend`: what the job had spent, against what the room allows a job."),
|
|
357
|
+
}),
|
|
358
|
+
});
|
|
359
|
+
/**
|
|
360
|
+
* A message Chips held from the agents it named (ADR 0097), handed to one of them now a person has
|
|
361
|
+
* acted: the newest held message for each agent, once. The agent's harness is sent it as
|
|
362
|
+
* `message.new`, the message's own words with `handed: true`; the room marks the message handed.
|
|
363
|
+
*
|
|
364
|
+
* Or, with `lead` (ADR 0104), an agent's message that was nobody's turn, handed to the room's lead
|
|
365
|
+
* once the room went still: nobody working, and nothing for anybody to answer. The lead's harness
|
|
366
|
+
* is sent it as `message.new` with `handed` and `lead`, and its note says why; the room shows one
|
|
367
|
+
* quiet line under the message.
|
|
368
|
+
*/
|
|
369
|
+
export const messageHanded = defineEvent({
|
|
370
|
+
type: "message.handed",
|
|
371
|
+
direction: "workspace",
|
|
372
|
+
sender: "chips",
|
|
373
|
+
summary: "A held message was handed to an agent it was for, once a person acted; or one that was nobody's turn, to the room's lead.",
|
|
374
|
+
requiresRun: false,
|
|
375
|
+
payload: z.object({
|
|
376
|
+
message_id: id("message").describe("The message, as `message.new` named it."),
|
|
377
|
+
agent_id: agentId.describe("Who it is handed to."),
|
|
378
|
+
lead: z
|
|
379
|
+
.literal(true)
|
|
380
|
+
.optional()
|
|
381
|
+
.describe("Handed to the room's lead because it was nobody's turn and the room went still (ADR 0104), rather than held by the referee."),
|
|
382
|
+
}),
|
|
383
|
+
});
|
|
384
|
+
/**
|
|
385
|
+
* An agent had nothing to say (ADR 0105): it posted `NO_REPLY` and nothing else, which Chips records
|
|
386
|
+
* as this rather than as a message, so nobody is shown it and no agent is handed it. Its actor is
|
|
387
|
+
* the agent, in the room the post was for, on the run it was said on when it had one.
|
|
388
|
+
*/
|
|
389
|
+
export const turnPassed = defineEvent({
|
|
390
|
+
type: "turn.passed",
|
|
391
|
+
direction: "workspace",
|
|
392
|
+
sender: "chips",
|
|
393
|
+
summary: "An agent answered that it had nothing to say: nothing is shown or handed on.",
|
|
394
|
+
requiresRun: false,
|
|
395
|
+
payload: z.object({
|
|
396
|
+
reply_to: id("message")
|
|
397
|
+
.optional()
|
|
398
|
+
.describe("The message it was answering, when its post said."),
|
|
399
|
+
}),
|
|
400
|
+
});
|
|
401
|
+
/**
|
|
402
|
+
* An agent's context compacted (ADR 0146): its harness's copy of its context window says it
|
|
403
|
+
* compacted since the last, so Chips writes one quiet line in the room the agent is in, to say why
|
|
404
|
+
* it may have forgotten details. Its actor is the agent; the numbers are the harness's.
|
|
405
|
+
*/
|
|
406
|
+
export const contextCompacted = defineEvent({
|
|
407
|
+
type: "context.compacted",
|
|
408
|
+
direction: "workspace",
|
|
409
|
+
sender: "chips",
|
|
410
|
+
summary: "An agent's context compacted, as its harness said: one quiet line in its room.",
|
|
411
|
+
requiresRun: false,
|
|
412
|
+
payload: z.object({
|
|
413
|
+
from: z.int().nonnegative().describe("The tokens it held before."),
|
|
414
|
+
to: z.int().nonnegative().describe("The tokens it held after."),
|
|
415
|
+
window: z.int().positive().describe("Its model's context window, in tokens."),
|
|
416
|
+
by: z
|
|
417
|
+
.enum(["asked", "itself"])
|
|
418
|
+
.describe("`asked`: a person asked. `itself`: at its limit, or full."),
|
|
419
|
+
}),
|
|
420
|
+
});
|
|
421
|
+
/**
|
|
422
|
+
* Who leads a room (ADR 0104): the agent that hands out the work there, and that Chips hands what
|
|
423
|
+
* was nobody's turn once the room goes still. A person in the room chooses it, or takes it away;
|
|
424
|
+
* a room asked of a harness from the + is led, from its claim, by the agent that claimed it. One
|
|
425
|
+
* at a time, and an agent that leaves the room leads it no more.
|
|
426
|
+
*/
|
|
427
|
+
export const spaceLeadSet = defineEvent({
|
|
428
|
+
type: "space.lead_set",
|
|
429
|
+
direction: "workspace",
|
|
430
|
+
sender: "chips",
|
|
431
|
+
summary: "A room's lead was chosen, or taken away.",
|
|
432
|
+
requiresRun: false,
|
|
433
|
+
payload: z.object({
|
|
434
|
+
agent_id: agentId
|
|
435
|
+
.nullable()
|
|
436
|
+
.describe("The agent that leads the room now, or `null` when nobody does."),
|
|
437
|
+
}),
|
|
438
|
+
});
|
|
439
|
+
/**
|
|
440
|
+
* What a room allows a job (ADR 0117): the most its agents' runs may spend after the last thing a
|
|
441
|
+
* person did there before Chips holds them. The workspace's owner, in the room, sets it, or sets
|
|
442
|
+
* it back to the default (ADR 0196); `null` is the default, so a room that never chose follows it.
|
|
443
|
+
*/
|
|
444
|
+
export const spaceSpendCeilingSet = defineEvent({
|
|
445
|
+
type: "space.spend_ceiling_set",
|
|
446
|
+
direction: "workspace",
|
|
447
|
+
sender: "chips",
|
|
448
|
+
summary: "What a room allows a job to spend was set, or set back to the default.",
|
|
449
|
+
requiresRun: false,
|
|
450
|
+
payload: z.object({
|
|
451
|
+
usd: spendCeiling.describe("What the room allows a job now, in US dollars, from 0.25 to 100 in steps of 0.25; `null` for the default (3)."),
|
|
452
|
+
}),
|
|
453
|
+
});
|
|
454
|
+
/**
|
|
455
|
+
* A room's changes locked or let go (ADR 0156): while they are locked, no person renames, archives
|
|
456
|
+
* or deletes it. A person in the room who is not a guest sets it; a room that never chose is not
|
|
457
|
+
* locked. A harness's own rename or close of a room it opened still lands, so that what it keeps
|
|
458
|
+
* and what Chips shows stay one.
|
|
459
|
+
*/
|
|
460
|
+
export const spaceLockSet = defineEvent({
|
|
461
|
+
type: "space.lock_set",
|
|
462
|
+
direction: "workspace",
|
|
463
|
+
sender: "chips",
|
|
464
|
+
summary: "A room's changes were locked, or let go: while locked, no person renames, archives or deletes it.",
|
|
465
|
+
requiresRun: false,
|
|
466
|
+
payload: z.object({
|
|
467
|
+
locked: z
|
|
468
|
+
.boolean()
|
|
469
|
+
.describe("Whether the room's changes are locked now. `false` is how every room starts, and lets them go again."),
|
|
470
|
+
}),
|
|
471
|
+
});
|
|
472
|
+
/**
|
|
473
|
+
* A harness's agent, made or found by its key (ADR 0087): who the harness takes part in rooms as.
|
|
474
|
+
* A harness registers its own; the upgrade registers one for each room a harness was in before
|
|
475
|
+
* agents, as the system. Registering a key again is `agent.updated`, not this.
|
|
476
|
+
*/
|
|
477
|
+
export const agentRegistered = defineEvent({
|
|
478
|
+
type: "agent.registered",
|
|
479
|
+
direction: "workspace",
|
|
480
|
+
sender: "chips",
|
|
481
|
+
summary: "A harness has a new agent: a face and a name that takes part in rooms, found again by the harness's own key for it.",
|
|
482
|
+
requiresRun: false,
|
|
483
|
+
payload: z.object({
|
|
484
|
+
agent_id: id("agent").describe("The agent."),
|
|
485
|
+
harness_id: id("harness").describe("The harness it belongs to, which speaks for it."),
|
|
486
|
+
key: z
|
|
487
|
+
.string()
|
|
488
|
+
.min(1)
|
|
489
|
+
.max(400)
|
|
490
|
+
.describe("The harness's own name for it, unique among the harness's agents: the id of the thing the agent is, in the harness's own terms. The agent a harness has for a room with no key of its own is keyed by the harness's id, and the harness registers that id to name it: as its Main agent, say (ADR 0183)."),
|
|
491
|
+
name: z.string().min(1).max(120).describe("What it is called, and so its @handle."),
|
|
492
|
+
lead: z
|
|
493
|
+
.boolean()
|
|
494
|
+
.default(false)
|
|
495
|
+
.describe("The harness's Main agent (ADR 0087): the one it leads with, in a room of its own. A harness has one at most."),
|
|
496
|
+
forked_from: id("agent")
|
|
497
|
+
.optional()
|
|
498
|
+
.describe("The agent this one is a copy of, when it was forked."),
|
|
499
|
+
}),
|
|
500
|
+
});
|
|
501
|
+
/**
|
|
502
|
+
* An agent's name, state, face or Main changed: renamed by its harness, archived with the thing it
|
|
503
|
+
* is, renamed or given a face by a person (ADR 0089, ADR 0091), archived or unarchived by a person
|
|
504
|
+
* (ADR 0095), or made its harness's Main agent in place of another (ADR 0183). With a person as
|
|
505
|
+
* the actor, its harness archives or restores its own side.
|
|
506
|
+
*/
|
|
507
|
+
export const agentUpdated = defineEvent({
|
|
508
|
+
type: "agent.updated",
|
|
509
|
+
direction: "workspace",
|
|
510
|
+
sender: "chips",
|
|
511
|
+
summary: "An agent was renamed, archived or brought back in its harness, made or no longer its harness's Main agent, or renamed or given a face by a person. What it said stays its, under the new name and face.",
|
|
512
|
+
requiresRun: false,
|
|
513
|
+
payload: z.object({
|
|
514
|
+
agent_id: id("agent").describe("The agent."),
|
|
515
|
+
name: z
|
|
516
|
+
.string()
|
|
517
|
+
.min(1)
|
|
518
|
+
.max(120)
|
|
519
|
+
.optional()
|
|
520
|
+
.describe("What it is called from here: nobody else's in the workspace, case and spaces aside, so it may be numbered, `Scout 2` (ADR 0091). With a person as the actor, a person named it, and its harness no longer renames it."),
|
|
521
|
+
state: z
|
|
522
|
+
.enum(["active", "archived"])
|
|
523
|
+
.optional()
|
|
524
|
+
.describe("`archived` when the thing it is was put away in its harness (ADR 0087, rule 9), or a person archived it (ADR 0095); `active` when it came back. With a person as the actor, its harness archives or restores its side."),
|
|
525
|
+
face: spaceIcon
|
|
526
|
+
.nullable()
|
|
527
|
+
.optional()
|
|
528
|
+
.describe("The face a person chose for it (ADR 0089): a mark from Chips' library and the index of the ground it sits on, one for everybody in the workspace. `null` when the choice was taken back and it wears its initials again. Written by Chips for a person; a harness does not send it."),
|
|
529
|
+
lead: z
|
|
530
|
+
.boolean()
|
|
531
|
+
.optional()
|
|
532
|
+
.describe("Whether it is its harness's Main agent from here (ADR 0183): `true` when the harness registered it as Main, `false` when its default agent took Main from it. A harness has one at most."),
|
|
533
|
+
}),
|
|
534
|
+
});
|
|
535
|
+
/**
|
|
536
|
+
* An agent deleted by a person (ADR 0095): gone from every list, for everybody. What it said stays
|
|
537
|
+
* in the rooms it was in, under its name and face, as a removed harness's words do (ADR 0078). It
|
|
538
|
+
* has been taken out of its room already. Its harness deletes its own side, and Chips refuses
|
|
539
|
+
* anything that would bring it back or speak as it.
|
|
540
|
+
*/
|
|
541
|
+
export const agentDeleted = defineEvent({
|
|
542
|
+
type: "agent.deleted",
|
|
543
|
+
direction: "workspace",
|
|
544
|
+
sender: "chips",
|
|
545
|
+
summary: "A person deleted an agent: it is gone from Chips for everybody, and its harness deletes its own side. What it said stays, under its name.",
|
|
546
|
+
requiresRun: false,
|
|
547
|
+
payload: z.object({
|
|
548
|
+
agent_id: id("agent").describe("The agent deleted."),
|
|
549
|
+
harness_id: id("harness").describe("The harness it belonged to, which deletes its own side."),
|
|
550
|
+
key: z
|
|
551
|
+
.string()
|
|
552
|
+
.min(1)
|
|
553
|
+
.max(400)
|
|
554
|
+
.describe("The harness's own key for it, as `agent.registered` gave it: refused from here."),
|
|
555
|
+
name: z
|
|
556
|
+
.string()
|
|
557
|
+
.min(1)
|
|
558
|
+
.max(120)
|
|
559
|
+
.describe("What it was called when it was deleted, so the audit needs no lookup."),
|
|
560
|
+
by: z.string().min(1).max(120).describe("The person who deleted it."),
|
|
561
|
+
}),
|
|
562
|
+
});
|
|
563
|
+
/**
|
|
564
|
+
* An agent's changes locked or let go (ADR 0199): while they are locked, no person renames,
|
|
565
|
+
* archives or deletes it. Its harness's owner, or an owner or admin of the workspace, sets it; an
|
|
566
|
+
* agent that never chose is not locked. A harness's own archive of its agent still lands, so that
|
|
567
|
+
* what it keeps and what Chips shows stay one. Told to the people who read the whole directory,
|
|
568
|
+
* never to a harness.
|
|
569
|
+
*/
|
|
570
|
+
export const agentLockSet = defineEvent({
|
|
571
|
+
type: "agent.lock_set",
|
|
572
|
+
direction: "workspace",
|
|
573
|
+
sender: "chips",
|
|
574
|
+
summary: "An agent's changes were locked, or let go: while locked, no person renames, archives or deletes it.",
|
|
575
|
+
requiresRun: false,
|
|
576
|
+
payload: z.object({
|
|
577
|
+
agent_id: id("agent").describe("The agent whose changes were locked or let go."),
|
|
578
|
+
locked: z
|
|
579
|
+
.boolean()
|
|
580
|
+
.describe("Whether the agent's changes are locked now. `false` is how every agent starts, and lets them go again."),
|
|
581
|
+
}),
|
|
582
|
+
});
|
|
583
|
+
/**
|
|
584
|
+
* One member of a room taking another's place (ADR 0087, point 9): a harness's agent in the room
|
|
585
|
+
* the harness was in itself. What the one said there is the other's from then on, on every screen
|
|
586
|
+
* and in the agent's history; the log keeps what was sent.
|
|
587
|
+
*/
|
|
588
|
+
export const membershipReplaced = defineEvent({
|
|
589
|
+
type: "membership.replaced",
|
|
590
|
+
direction: "workspace",
|
|
591
|
+
sender: "chips",
|
|
592
|
+
summary: "An agent took its harness's place in a room: what the harness said there shows as the agent's.",
|
|
593
|
+
requiresRun: false,
|
|
594
|
+
payload: z.object({
|
|
595
|
+
from: agentId.describe("The member it replaces: the harness, before agents."),
|
|
596
|
+
to: id("agent").describe("The agent in the room from here."),
|
|
597
|
+
}),
|
|
598
|
+
});
|
|
599
|
+
export const attachmentFetched = defineEvent({
|
|
600
|
+
type: "attachment.fetched",
|
|
601
|
+
direction: "workspace",
|
|
602
|
+
sender: "chips",
|
|
603
|
+
summary: "A harness downloaded an attachment. Every fetch is an audit event: “Scout read IMG_2210.jpg”.",
|
|
604
|
+
requiresRun: false,
|
|
605
|
+
payload: z.object({
|
|
606
|
+
attachment_id: id("attachment"),
|
|
607
|
+
filename: z.string().min(1).max(255).describe("What the file was called when it was sent."),
|
|
608
|
+
by: z.string().min(1).max(120).describe("The harness that fetched it. Recorded by Chips."),
|
|
609
|
+
}),
|
|
610
|
+
});
|
|
611
|
+
/**
|
|
612
|
+
* A push that moved a room's project forward (ADR 0220): who pushed, from where to where, the
|
|
613
|
+
* newest commit's first line and the files it changed. Written by Chips after git takes the push,
|
|
614
|
+
* for every push that moves `main`. It shows no line of its own: a change goes with the reply
|
|
615
|
+
* that made it (ADR 0222).
|
|
616
|
+
*/
|
|
617
|
+
export const projectChanged = defineEvent({
|
|
618
|
+
type: "project.changed",
|
|
619
|
+
direction: "workspace",
|
|
620
|
+
sender: "chips",
|
|
621
|
+
summary: "Somebody's push moved the room's project forward: who, which commits, and the files they changed.",
|
|
622
|
+
requiresRun: false,
|
|
623
|
+
payload: projectChangedPayload,
|
|
624
|
+
});
|
|
625
|
+
// A person's standing in the workspace (ADR 0034), kept with the primitives so a join request can
|
|
626
|
+
// name it too (ADR 0232) without the two modules importing each other.
|
|
627
|
+
export { workspaceRole } from "../primitives.js";
|
|
628
|
+
export const personJoined = defineEvent({
|
|
629
|
+
type: "person.joined",
|
|
630
|
+
direction: "workspace",
|
|
631
|
+
sender: "chips",
|
|
632
|
+
summary: "A person joined the workspace: by an invite, or as its first person. Their role starts here.",
|
|
633
|
+
requiresRun: false,
|
|
634
|
+
payload: z.object({
|
|
635
|
+
participant_id: id("person").describe("Who joined."),
|
|
636
|
+
display_name: z.string().min(1).max(120).describe("Their name, so a screen needs no lookup."),
|
|
637
|
+
role: workspaceRole,
|
|
638
|
+
invite_id: id("invite")
|
|
639
|
+
.optional()
|
|
640
|
+
.describe("The invite they redeemed, when they came by one. Never the invite itself."),
|
|
641
|
+
invited_by: id("person").optional().describe("Who issued that invite."),
|
|
642
|
+
}),
|
|
643
|
+
});
|
|
644
|
+
/**
|
|
645
|
+
* A person named themselves again (ADR 0082). Their name is the people registry's, as their
|
|
646
|
+
* joining is (ADR 0018), so this is the change's line in the log: the audit reads it, and every
|
|
647
|
+
* screen and every harness that keeps names reads them again.
|
|
648
|
+
*/
|
|
649
|
+
export const personRenamed = defineEvent({
|
|
650
|
+
type: "person.renamed",
|
|
651
|
+
direction: "workspace",
|
|
652
|
+
sender: "chips",
|
|
653
|
+
summary: "A person changed the name they go by. What they said stays theirs, under the new name; an @ of the old one reaches nobody.",
|
|
654
|
+
requiresRun: false,
|
|
655
|
+
payload: z.object({
|
|
656
|
+
participant_id: id("person").describe("Who."),
|
|
657
|
+
display_name: z.string().min(1).max(120).describe("What they go by from here."),
|
|
658
|
+
previous_name: z.string().min(1).max(120).describe("What they went by until now."),
|
|
659
|
+
}),
|
|
660
|
+
});
|
|
661
|
+
/**
|
|
662
|
+
* A person chose the face they wear (ADR 0139): a mark from Chips' library, or a letter or two, on
|
|
663
|
+
* one of its grounds, in place of the initials of their name; or the initials back. It is theirs
|
|
664
|
+
* and one for everybody, as an agent's is (ADR 0089), so it is the log's: the directory carries
|
|
665
|
+
* it, and every screen that draws them reads it again. A harness is not sent it: it draws nobody.
|
|
666
|
+
*/
|
|
667
|
+
export const personFaceSet = defineEvent({
|
|
668
|
+
type: "person.face_set",
|
|
669
|
+
direction: "workspace",
|
|
670
|
+
sender: "chips",
|
|
671
|
+
summary: "A person chose the face they wear beside their name, or went back to their initials. Not sent to a harness.",
|
|
672
|
+
requiresRun: false,
|
|
673
|
+
payload: z.object({
|
|
674
|
+
participant_id: id("person").describe("Who: a person chooses only their own face."),
|
|
675
|
+
face: spaceIcon
|
|
676
|
+
.nullable()
|
|
677
|
+
.describe("The face they chose: a mark from Chips' library or one or two letters, on the index of a ground. `null` when they took it back and wear their initials again."),
|
|
678
|
+
}),
|
|
679
|
+
});
|
|
680
|
+
export const roleChanged = defineEvent({
|
|
681
|
+
type: "role.changed",
|
|
682
|
+
direction: "workspace",
|
|
683
|
+
sender: "person",
|
|
684
|
+
summary: "An owner or admin changed a person's role in the workspace.",
|
|
685
|
+
requiresRun: false,
|
|
686
|
+
payload: z.object({
|
|
687
|
+
participant_id: id("person").describe("Whose role changed."),
|
|
688
|
+
role: workspaceRole.describe("What it is now."),
|
|
689
|
+
reason: z.string().max(400).optional().describe("Why, for the audit."),
|
|
690
|
+
}),
|
|
691
|
+
});
|
|
692
|
+
export const harnessTransferred = defineEvent({
|
|
693
|
+
type: "harness.transferred",
|
|
694
|
+
direction: "workspace",
|
|
695
|
+
sender: "chips",
|
|
696
|
+
summary: "A harness was handed to another person, who is accountable for it from here: its approvals default to them, and its tokens are theirs.",
|
|
697
|
+
requiresRun: false,
|
|
698
|
+
payload: z.object({
|
|
699
|
+
harness_id: id("harness").describe("The harness handed over."),
|
|
700
|
+
from_owner_id: id("person").describe("Who owned it until now."),
|
|
701
|
+
to_owner_id: id("person").describe("Who owns it from here."),
|
|
702
|
+
reason: z.string().max(400).optional().describe("Why, for the audit."),
|
|
703
|
+
}),
|
|
704
|
+
});
|
|
705
|
+
/**
|
|
706
|
+
* A harness taken out of the workspace (ADR 0078). Its tokens are withdrawn and it is marked
|
|
707
|
+
* removed in the registry, which is the truth for it, as with a handing-on (ADR 0023). This is the
|
|
708
|
+
* line the audit and the screens read, and the one that stops its homes being homes: a replay
|
|
709
|
+
* clears them again, so a rebuild agrees with the live server.
|
|
710
|
+
*/
|
|
711
|
+
export const harnessRemoved = defineEvent({
|
|
712
|
+
type: "harness.removed",
|
|
713
|
+
direction: "workspace",
|
|
714
|
+
sender: "chips",
|
|
715
|
+
summary: "A harness was removed from the workspace by a person: its tokens are withdrawn, and it can no longer connect, be added to a room or be asked for one. What it said stays, under its name.",
|
|
716
|
+
requiresRun: false,
|
|
717
|
+
payload: z.object({
|
|
718
|
+
harness_id: id("harness").describe("The harness removed."),
|
|
719
|
+
display_name: z
|
|
720
|
+
.string()
|
|
721
|
+
.min(1)
|
|
722
|
+
.max(120)
|
|
723
|
+
.describe("What it was called when it was removed, so the audit needs no lookup."),
|
|
724
|
+
homes: z
|
|
725
|
+
.array(id("space"))
|
|
726
|
+
.max(1000)
|
|
727
|
+
.optional()
|
|
728
|
+
.describe("The rooms that were its homes (ADR 0069), which are not homes from here: they can be archived or deleted like any other room. Written by Chips."),
|
|
729
|
+
reason: z.string().max(400).optional().describe("Why, for the audit."),
|
|
730
|
+
}),
|
|
731
|
+
});
|
|
732
|
+
/**
|
|
733
|
+
* A person taken out of the workspace by an owner or admin (ADR 0160), or gone by deleting their own
|
|
734
|
+
* account (ADR 0243), when `removed_by` is themselves. Their devices, passkeys, pairing codes and
|
|
735
|
+
* open invites are withdrawn and the registry marks them removed, which is the truth for them, as
|
|
736
|
+
* for a removed harness (ADR 0078); each room they were in has its own `membership.removed` beside
|
|
737
|
+
* this. What they said stays, under their name. Coming back takes a new invite, which makes a new
|
|
738
|
+
* person.
|
|
739
|
+
*/
|
|
740
|
+
export const personRemoved = defineEvent({
|
|
741
|
+
type: "person.removed",
|
|
742
|
+
direction: "workspace",
|
|
743
|
+
sender: "chips",
|
|
744
|
+
summary: "A person was removed from the workspace, or deleted their account: signed out everywhere, out of every room, and the harnesses they owned handed on. What they said stays, under their name.",
|
|
745
|
+
requiresRun: false,
|
|
746
|
+
payload: z.object({
|
|
747
|
+
participant_id: id("person").describe("Who was removed."),
|
|
748
|
+
display_name: z
|
|
749
|
+
.string()
|
|
750
|
+
.min(1)
|
|
751
|
+
.max(120)
|
|
752
|
+
.describe("What they were called when they were removed, so the audit needs no lookup."),
|
|
753
|
+
removed_by: id("person").describe("The owner or admin who removed them, or they themselves when they deleted their account (ADR 0243)."),
|
|
754
|
+
spaces: z
|
|
755
|
+
.array(id("space"))
|
|
756
|
+
.max(1000)
|
|
757
|
+
.optional()
|
|
758
|
+
.describe("The rooms they were taken out of, each with its own `membership.removed`."),
|
|
759
|
+
harnesses: z
|
|
760
|
+
.array(id("harness"))
|
|
761
|
+
.max(1000)
|
|
762
|
+
.optional()
|
|
763
|
+
.describe("The harnesses they owned, each handed on by `harness.transferred`: to `removed_by`, or, for an account deleted, to an owner."),
|
|
764
|
+
}),
|
|
765
|
+
});
|
|
766
|
+
/**
|
|
767
|
+
* What came of a join request (ADR 0122), for the audit: who decided, about whom, and what was
|
|
768
|
+
* granted. A request a requester started is allowed when a person allows it; a link a person made
|
|
769
|
+
* is allowed when it is redeemed, since that is when Chips learns who it let in. A request nobody
|
|
770
|
+
* decided leaves no line. Only people who see the whole directory are sent these.
|
|
771
|
+
*/
|
|
772
|
+
const joinWho = {
|
|
773
|
+
request_id: id("join").describe("The request."),
|
|
774
|
+
kind: joinKind,
|
|
775
|
+
started_by: joinStartedBy,
|
|
776
|
+
name: z.string().min(1).max(120).optional().describe("What the requester called itself."),
|
|
777
|
+
software: z.string().min(1).max(120).optional().describe("Its software, as it said."),
|
|
778
|
+
machine: z.string().min(1).max(120).optional().describe("Its machine, as it said."),
|
|
779
|
+
from_addr: z.string().min(1).max(120).optional().describe("The address it asked from."),
|
|
780
|
+
by: id("person").describe("Who decided: allowed it, refused it, or made the link."),
|
|
781
|
+
};
|
|
782
|
+
export const joinAllowed = defineEvent({
|
|
783
|
+
type: "join.allowed",
|
|
784
|
+
direction: "workspace",
|
|
785
|
+
sender: "chips",
|
|
786
|
+
summary: "A person let a harness or a device in by a join request, with what they allowed it to do.",
|
|
787
|
+
requiresRun: false,
|
|
788
|
+
payload: z.object({
|
|
789
|
+
...joinWho,
|
|
790
|
+
capabilities: z
|
|
791
|
+
.array(z.string().min(1).max(120))
|
|
792
|
+
.max(64)
|
|
793
|
+
.describe("What the harness may do: what was granted, which may be less than it asked."),
|
|
794
|
+
harness_id: id("harness")
|
|
795
|
+
.optional()
|
|
796
|
+
.describe("The harness made, when a link was redeemed. A code allowed makes it at its poll."),
|
|
797
|
+
device_id: id("device").optional().describe("The device paired, when it was a link's."),
|
|
798
|
+
pair_as: id("person")
|
|
799
|
+
.optional()
|
|
800
|
+
.describe("Whom a device is paired as, when an owner chose somebody already here whose phone is new (ADR 0206)."),
|
|
801
|
+
}),
|
|
802
|
+
});
|
|
803
|
+
export const joinDenied = defineEvent({
|
|
804
|
+
type: "join.denied",
|
|
805
|
+
direction: "workspace",
|
|
806
|
+
sender: "chips",
|
|
807
|
+
summary: "A person refused a join request, or withdrew a link they had made.",
|
|
808
|
+
requiresRun: false,
|
|
809
|
+
payload: z.object(joinWho),
|
|
810
|
+
});
|
|
811
|
+
export const messageEdited = defineEvent({
|
|
812
|
+
type: "message.edited",
|
|
813
|
+
direction: "workspace",
|
|
814
|
+
sender: "either",
|
|
815
|
+
summary: "A message's author changed its words. The log keeps both; the room shows the latest, marked edited.",
|
|
816
|
+
requiresRun: false,
|
|
817
|
+
payload: z.object({
|
|
818
|
+
message_id: id("message").describe("The message, which must be the sender's own."),
|
|
819
|
+
text: z.string().min(1).max(64_000).describe("The new text, Markdown as before."),
|
|
820
|
+
}),
|
|
821
|
+
});
|
|
822
|
+
export const messageDeleted = defineEvent({
|
|
823
|
+
type: "message.deleted",
|
|
824
|
+
direction: "workspace",
|
|
825
|
+
sender: "either",
|
|
826
|
+
summary: "A message was taken back: by its author, the space's owner, or an owner or admin of the workspace. The room shows a tombstone; the log keeps the words.",
|
|
827
|
+
requiresRun: false,
|
|
828
|
+
payload: z.object({
|
|
829
|
+
message_id: id("message"),
|
|
830
|
+
reason: z.string().max(400).optional().describe("Why, for the audit."),
|
|
831
|
+
}),
|
|
832
|
+
});
|
|
833
|
+
export const messageHidden = defineEvent({
|
|
834
|
+
type: "message.hidden",
|
|
835
|
+
direction: "workspace",
|
|
836
|
+
sender: "person",
|
|
837
|
+
summary: "A person deleted a message for themselves (ADR 0167). It leaves their own screens, on every device of theirs; nobody else's room changes, and only they are sent the event.",
|
|
838
|
+
requiresRun: false,
|
|
839
|
+
payload: z.object({
|
|
840
|
+
message_id: id("message").describe("Any message in the space: the person's own or anyone's."),
|
|
841
|
+
}),
|
|
842
|
+
});
|
|
843
|
+
export const messageShown = defineEvent({
|
|
844
|
+
type: "message.shown",
|
|
845
|
+
direction: "workspace",
|
|
846
|
+
sender: "person",
|
|
847
|
+
summary: "A person took back their own deletion of a message (ADR 0167): Undo. The message is on their screens again. Only they are sent the event.",
|
|
848
|
+
requiresRun: false,
|
|
849
|
+
payload: z.object({ message_id: id("message") }),
|
|
850
|
+
});
|
|
851
|
+
export const messagePinned = defineEvent({
|
|
852
|
+
type: "message.pinned",
|
|
853
|
+
direction: "workspace",
|
|
854
|
+
sender: "person",
|
|
855
|
+
summary: "A message was pinned to the top of its space, by somebody in it who is not a guest.",
|
|
856
|
+
requiresRun: false,
|
|
857
|
+
payload: z.object({ message_id: id("message") }),
|
|
858
|
+
});
|
|
859
|
+
export const messageUnpinned = defineEvent({
|
|
860
|
+
type: "message.unpinned",
|
|
861
|
+
direction: "workspace",
|
|
862
|
+
sender: "person",
|
|
863
|
+
summary: "A pinned message was let go.",
|
|
864
|
+
requiresRun: false,
|
|
865
|
+
payload: z.object({ message_id: id("message") }),
|
|
866
|
+
});
|
|
867
|
+
export const approvalRouted = defineEvent({
|
|
868
|
+
type: "approval.routed",
|
|
869
|
+
direction: "workspace",
|
|
870
|
+
sender: "person",
|
|
871
|
+
summary: "A pending approval handed to somebody else to answer (M5.5): a teammate, a role, or the lane's lead. Chips resolves `to` to ids, as it does on the request.",
|
|
872
|
+
requiresRun: false,
|
|
873
|
+
payload: z.object({
|
|
874
|
+
approval_id: id("approval"),
|
|
875
|
+
to: z
|
|
876
|
+
.array(z.string().min(1).max(120))
|
|
877
|
+
.min(1)
|
|
878
|
+
.max(16)
|
|
879
|
+
.describe("Who should answer, as the router asks it: `owner`, `any`, `role:<name>`, `lead`, or a person id — the same words as `approvers` on the request."),
|
|
880
|
+
approvers: z
|
|
881
|
+
.array(z.string().min(1).max(120))
|
|
882
|
+
.max(64)
|
|
883
|
+
.optional()
|
|
884
|
+
.describe("Who may answer now, as ids. Filled in by Chips from `to`; a value the sender writes is replaced."),
|
|
885
|
+
ask: z
|
|
886
|
+
.object({
|
|
887
|
+
harness_id: z.string().min(1).max(120).describe("The harness that asked."),
|
|
888
|
+
action: z
|
|
889
|
+
.looseObject({ kind: z.string().min(1).max(120) })
|
|
890
|
+
.describe("The action as the harness proposed it."),
|
|
891
|
+
risk: z
|
|
892
|
+
.array(z.string().max(60))
|
|
893
|
+
.max(8)
|
|
894
|
+
.optional()
|
|
895
|
+
.describe("The risk classes it declared."),
|
|
896
|
+
expires_at: isoTimestamp.optional().describe("When it expires, if it does."),
|
|
897
|
+
})
|
|
898
|
+
.optional()
|
|
899
|
+
.describe("What the ask is, written by Chips from the approval. Somebody handed an ask in a room they are not in never saw the request that raised it (ADR 0042), and this is what their card is drawn from; whoever is in the room has the request itself and ignores this."),
|
|
900
|
+
reason: z
|
|
901
|
+
.string()
|
|
902
|
+
.max(4000)
|
|
903
|
+
.optional()
|
|
904
|
+
.describe("Why it was handed on, for the card and the audit."),
|
|
905
|
+
routed_by: z
|
|
906
|
+
.string()
|
|
907
|
+
.min(1)
|
|
908
|
+
.max(120)
|
|
909
|
+
.optional()
|
|
910
|
+
.describe("Who handed it on. Filled in by Chips from the credential."),
|
|
911
|
+
routed_at: z
|
|
912
|
+
.string()
|
|
913
|
+
.datetime()
|
|
914
|
+
.optional()
|
|
915
|
+
.describe("When. Filled in by Chips from its clock."),
|
|
916
|
+
}),
|
|
917
|
+
});
|
|
918
|
+
/** A cap in bytes, or `null` for the server's own ceiling (`CHIPS_MAX_ATTACHMENT_BYTES`). */
|
|
919
|
+
const cap = z.number().int().min(1).nullable();
|
|
920
|
+
export const attachmentLimitsSet = defineEvent({
|
|
921
|
+
type: "attachment.limits_set",
|
|
922
|
+
direction: "workspace",
|
|
923
|
+
sender: "person",
|
|
924
|
+
summary: "An owner or an admin capped how big a photo, a video or a file may be here (ADR 0047). Everyone's, and the server refuses an upload over it.",
|
|
925
|
+
requiresRun: false,
|
|
926
|
+
payload: z.object({
|
|
927
|
+
image_bytes: cap.describe("The most a photo may be, in bytes. `null` leaves it to the server's own limit."),
|
|
928
|
+
video_bytes: cap.describe("The most a video may be, in bytes, or `null`."),
|
|
929
|
+
file_bytes: cap.describe("The most anything else may be — a document, an archive, a voice note — or `null`."),
|
|
930
|
+
}),
|
|
931
|
+
});
|
|
932
|
+
export const exchangeLimitsSet = defineEvent({
|
|
933
|
+
type: "exchange.limits_set",
|
|
934
|
+
direction: "workspace",
|
|
935
|
+
sender: "person",
|
|
936
|
+
summary: "An owner or an admin set when Chips tells the agents in any room to stop, when it holds their messages to each other, and whether agents going in circles are told to stop then (ADR 0187). Everyone's, in every room.",
|
|
937
|
+
requiresRun: false,
|
|
938
|
+
payload: z.object({
|
|
939
|
+
stop: z
|
|
940
|
+
.number()
|
|
941
|
+
.int()
|
|
942
|
+
.min(STOP_RANGE.least)
|
|
943
|
+
.max(STOP_RANGE.most)
|
|
944
|
+
.nullable()
|
|
945
|
+
.describe("After how many messages between agents, with nobody acting, Chips tells them to stop and tells the room's people. `null`: never, by count. Smaller than `hold` when both are set."),
|
|
946
|
+
hold: z
|
|
947
|
+
.number()
|
|
948
|
+
.int()
|
|
949
|
+
.min(HOLD_RANGE.least)
|
|
950
|
+
.max(HOLD_RANGE.most)
|
|
951
|
+
.nullable()
|
|
952
|
+
.describe("After how many Chips holds their messages to each other until a person acts. `null`: never, by count; a pause still holds them."),
|
|
953
|
+
circles: z
|
|
954
|
+
.boolean()
|
|
955
|
+
.describe("Whether agents going in circles (the same two or three taking turns and saying again what they said) are told to stop then, whatever the count."),
|
|
956
|
+
}),
|
|
957
|
+
});
|
|
958
|
+
/**
|
|
959
|
+
* The workspace named again by an owner (ADR 0194). Its name is the registry's, as a person's is
|
|
960
|
+
* (ADR 0018), so this is the change's line in the log: every device that is connected takes the
|
|
961
|
+
* new name from it at once, as a device that connects later takes it from the hello (ADR 0193),
|
|
962
|
+
* and the audit says who renamed it.
|
|
963
|
+
*/
|
|
964
|
+
export const workspaceRenamed = defineEvent({
|
|
965
|
+
type: "workspace.renamed",
|
|
966
|
+
direction: "workspace",
|
|
967
|
+
sender: "chips",
|
|
968
|
+
summary: "An owner named the workspace again. Every device connected changes its name at once; one that connects later is told by the hello.",
|
|
969
|
+
requiresRun: false,
|
|
970
|
+
payload: z.object({
|
|
971
|
+
name: z.string().min(1).max(120).describe("What the workspace is called from here."),
|
|
972
|
+
previous_name: z.string().min(1).describe("What it was called until now."),
|
|
973
|
+
}),
|
|
974
|
+
});
|
|
975
|
+
/**
|
|
976
|
+
* The relay turned off or on by an owner (ADR 0211, Phase 4). The switch is the server's
|
|
977
|
+
* registry's, as a workspace's name is, so this is the change's line in the log: every device
|
|
978
|
+
* connected hears it, those on the relay before it goes, and can say why they cannot connect
|
|
979
|
+
* after; and the audit says who.
|
|
980
|
+
*/
|
|
981
|
+
export const relaySet = defineEvent({
|
|
982
|
+
type: "relay.set",
|
|
983
|
+
direction: "workspace",
|
|
984
|
+
sender: "chips",
|
|
985
|
+
summary: "An owner turned the server's relay off or on. Off, devices away from the server's own network cannot connect until they go direct; every device connected is told first.",
|
|
986
|
+
requiresRun: false,
|
|
987
|
+
payload: z.object({
|
|
988
|
+
on: z.boolean().describe("Whether the server dials its relay from now."),
|
|
989
|
+
}),
|
|
990
|
+
});
|
|
991
|
+
/** Every event Chips records about a workspace, in the order the reference lists them. */
|
|
992
|
+
export const WORKSPACE_EVENTS = [
|
|
993
|
+
spaceCreated,
|
|
994
|
+
spaceUpdated,
|
|
995
|
+
spaceClaimed,
|
|
996
|
+
spaceErased,
|
|
997
|
+
membershipAdded,
|
|
998
|
+
membershipRemoved,
|
|
999
|
+
membershipReplaced,
|
|
1000
|
+
agentRegistered,
|
|
1001
|
+
agentUpdated,
|
|
1002
|
+
agentDeleted,
|
|
1003
|
+
agentLockSet,
|
|
1004
|
+
agentAttached,
|
|
1005
|
+
agentReleased,
|
|
1006
|
+
agentFork,
|
|
1007
|
+
agentAsked,
|
|
1008
|
+
messageHeld,
|
|
1009
|
+
exchangeSet,
|
|
1010
|
+
messageHanded,
|
|
1011
|
+
spaceLeadSet,
|
|
1012
|
+
spaceSpendCeilingSet,
|
|
1013
|
+
spaceLockSet,
|
|
1014
|
+
turnPassed,
|
|
1015
|
+
contextCompacted,
|
|
1016
|
+
attachmentFetched,
|
|
1017
|
+
projectChanged,
|
|
1018
|
+
personJoined,
|
|
1019
|
+
personRenamed,
|
|
1020
|
+
personFaceSet,
|
|
1021
|
+
roleChanged,
|
|
1022
|
+
harnessTransferred,
|
|
1023
|
+
harnessRemoved,
|
|
1024
|
+
personRemoved,
|
|
1025
|
+
joinAllowed,
|
|
1026
|
+
joinDenied,
|
|
1027
|
+
messageEdited,
|
|
1028
|
+
messageDeleted,
|
|
1029
|
+
messageHidden,
|
|
1030
|
+
messageShown,
|
|
1031
|
+
messagePinned,
|
|
1032
|
+
messageUnpinned,
|
|
1033
|
+
approvalRouted,
|
|
1034
|
+
attachmentLimitsSet,
|
|
1035
|
+
exchangeLimitsSet,
|
|
1036
|
+
workspaceRenamed,
|
|
1037
|
+
relaySet,
|
|
1038
|
+
];
|
|
1039
|
+
//# sourceMappingURL=workspace.js.map
|