@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.
Files changed (371) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +56 -2
  3. package/dist/generated/types.d.ts +4052 -0
  4. package/dist/generated/types.d.ts.map +1 -0
  5. package/dist/generated/types.js +7 -0
  6. package/dist/generated/types.js.map +1 -0
  7. package/dist/src/address.d.ts +106 -0
  8. package/dist/src/address.d.ts.map +1 -0
  9. package/dist/src/address.js +141 -0
  10. package/dist/src/address.js.map +1 -0
  11. package/dist/src/agent-context-windows.d.ts +235 -0
  12. package/dist/src/agent-context-windows.d.ts.map +1 -0
  13. package/dist/src/agent-context-windows.js +213 -0
  14. package/dist/src/agent-context-windows.js.map +1 -0
  15. package/dist/src/agent-heartbeats.d.ts +106 -0
  16. package/dist/src/agent-heartbeats.d.ts.map +1 -0
  17. package/dist/src/agent-heartbeats.js +111 -0
  18. package/dist/src/agent-heartbeats.js.map +1 -0
  19. package/dist/src/agent-models.d.ts +158 -0
  20. package/dist/src/agent-models.d.ts.map +1 -0
  21. package/dist/src/agent-models.js +171 -0
  22. package/dist/src/agent-models.js.map +1 -0
  23. package/dist/src/agent-place.d.ts +76 -0
  24. package/dist/src/agent-place.d.ts.map +1 -0
  25. package/dist/src/agent-place.js +80 -0
  26. package/dist/src/agent-place.js.map +1 -0
  27. package/dist/src/agents.d.ts +24 -0
  28. package/dist/src/agents.d.ts.map +1 -0
  29. package/dist/src/agents.js +58 -0
  30. package/dist/src/agents.js.map +1 -0
  31. package/dist/src/capabilities.d.ts +121 -0
  32. package/dist/src/capabilities.d.ts.map +1 -0
  33. package/dist/src/capabilities.js +120 -0
  34. package/dist/src/capabilities.js.map +1 -0
  35. package/dist/src/checklist.d.ts +19 -0
  36. package/dist/src/checklist.d.ts.map +1 -0
  37. package/dist/src/checklist.js +22 -0
  38. package/dist/src/checklist.js.map +1 -0
  39. package/dist/src/commands.d.ts +50 -0
  40. package/dist/src/commands.d.ts.map +1 -0
  41. package/dist/src/commands.js +274 -0
  42. package/dist/src/commands.js.map +1 -0
  43. package/dist/src/connectors.d.ts +90 -0
  44. package/dist/src/connectors.d.ts.map +1 -0
  45. package/dist/src/connectors.js +119 -0
  46. package/dist/src/connectors.js.map +1 -0
  47. package/dist/src/context-files.d.ts +304 -0
  48. package/dist/src/context-files.d.ts.map +1 -0
  49. package/dist/src/context-files.js +247 -0
  50. package/dist/src/context-files.js.map +1 -0
  51. package/dist/src/context.d.ts +369 -0
  52. package/dist/src/context.d.ts.map +1 -0
  53. package/dist/src/context.js +526 -0
  54. package/dist/src/context.js.map +1 -0
  55. package/dist/src/direct-asks.d.ts +36 -0
  56. package/dist/src/direct-asks.d.ts.map +1 -0
  57. package/dist/src/direct-asks.js +43 -0
  58. package/dist/src/direct-asks.js.map +1 -0
  59. package/dist/src/envelope.d.ts +70 -0
  60. package/dist/src/envelope.d.ts.map +1 -0
  61. package/dist/src/envelope.js +46 -0
  62. package/dist/src/envelope.js.map +1 -0
  63. package/dist/src/events/catalogue.d.ts +50 -0
  64. package/dist/src/events/catalogue.d.ts.map +1 -0
  65. package/dist/src/events/catalogue.js +70 -0
  66. package/dist/src/events/catalogue.js.map +1 -0
  67. package/dist/src/events/chips-to-harness.d.ts +37 -0
  68. package/dist/src/events/chips-to-harness.d.ts.map +1 -0
  69. package/dist/src/events/chips-to-harness.js +511 -0
  70. package/dist/src/events/chips-to-harness.js.map +1 -0
  71. package/dist/src/events/harness-to-chips.d.ts +38 -0
  72. package/dist/src/events/harness-to-chips.d.ts.map +1 -0
  73. package/dist/src/events/harness-to-chips.js +593 -0
  74. package/dist/src/events/harness-to-chips.js.map +1 -0
  75. package/dist/src/events/index.d.ts +6 -0
  76. package/dist/src/events/index.d.ts.map +1 -0
  77. package/dist/src/events/index.js +5 -0
  78. package/dist/src/events/index.js.map +1 -0
  79. package/dist/src/events/workspace.d.ts +222 -0
  80. package/dist/src/events/workspace.d.ts.map +1 -0
  81. package/dist/src/events/workspace.js +1039 -0
  82. package/dist/src/events/workspace.js.map +1 -0
  83. package/dist/src/exchange.d.ts +262 -0
  84. package/dist/src/exchange.d.ts.map +1 -0
  85. package/dist/src/exchange.js +413 -0
  86. package/dist/src/exchange.js.map +1 -0
  87. package/dist/src/first-names.d.ts +29 -0
  88. package/dist/src/first-names.d.ts.map +1 -0
  89. package/dist/src/first-names.js +80 -0
  90. package/dist/src/first-names.js.map +1 -0
  91. package/dist/src/frames.d.ts +526 -0
  92. package/dist/src/frames.d.ts.map +1 -0
  93. package/dist/src/frames.js +346 -0
  94. package/dist/src/frames.js.map +1 -0
  95. package/dist/src/harness-jobs.d.ts +313 -0
  96. package/dist/src/harness-jobs.d.ts.map +1 -0
  97. package/dist/src/harness-jobs.js +210 -0
  98. package/dist/src/harness-jobs.js.map +1 -0
  99. package/dist/src/ids/index.d.ts +3 -0
  100. package/dist/src/ids/index.d.ts.map +1 -0
  101. package/dist/src/ids/index.js +2 -0
  102. package/dist/src/ids/index.js.map +1 -0
  103. package/dist/src/ids/ulid.d.ts +96 -0
  104. package/dist/src/ids/ulid.d.ts.map +1 -0
  105. package/dist/src/ids/ulid.js +212 -0
  106. package/dist/src/ids/ulid.js.map +1 -0
  107. package/dist/src/index.d.ts +81 -0
  108. package/dist/src/index.d.ts.map +1 -0
  109. package/dist/src/index.js +47 -0
  110. package/dist/src/index.js.map +1 -0
  111. package/dist/src/invite-link.d.ts +64 -0
  112. package/dist/src/invite-link.d.ts.map +1 -0
  113. package/dist/src/invite-link.js +99 -0
  114. package/dist/src/invite-link.js.map +1 -0
  115. package/dist/src/join.d.ts +188 -0
  116. package/dist/src/join.d.ts.map +1 -0
  117. package/dist/src/join.js +190 -0
  118. package/dist/src/join.js.map +1 -0
  119. package/dist/src/limits.d.ts +50 -0
  120. package/dist/src/limits.d.ts.map +1 -0
  121. package/dist/src/limits.js +106 -0
  122. package/dist/src/limits.js.map +1 -0
  123. package/dist/src/matters.d.ts +22 -0
  124. package/dist/src/matters.d.ts.map +1 -0
  125. package/dist/src/matters.js +26 -0
  126. package/dist/src/matters.js.map +1 -0
  127. package/dist/src/mentions.d.ts +63 -0
  128. package/dist/src/mentions.d.ts.map +1 -0
  129. package/dist/src/mentions.js +129 -0
  130. package/dist/src/mentions.js.map +1 -0
  131. package/dist/src/names.d.ts +58 -0
  132. package/dist/src/names.d.ts.map +1 -0
  133. package/dist/src/names.js +192 -0
  134. package/dist/src/names.js.map +1 -0
  135. package/dist/src/no-reply.d.ts +17 -0
  136. package/dist/src/no-reply.d.ts.map +1 -0
  137. package/dist/src/no-reply.js +48 -0
  138. package/dist/src/no-reply.js.map +1 -0
  139. package/dist/src/notifications.d.ts +81 -0
  140. package/dist/src/notifications.d.ts.map +1 -0
  141. package/dist/src/notifications.js +65 -0
  142. package/dist/src/notifications.js.map +1 -0
  143. package/dist/src/pages.d.ts +32 -0
  144. package/dist/src/pages.d.ts.map +1 -0
  145. package/dist/src/pages.js +32 -0
  146. package/dist/src/pages.js.map +1 -0
  147. package/dist/src/pairing.d.ts +99 -0
  148. package/dist/src/pairing.d.ts.map +1 -0
  149. package/dist/src/pairing.js +163 -0
  150. package/dist/src/pairing.js.map +1 -0
  151. package/dist/src/primitives.d.ts +267 -0
  152. package/dist/src/primitives.d.ts.map +1 -0
  153. package/dist/src/primitives.js +279 -0
  154. package/dist/src/primitives.js.map +1 -0
  155. package/dist/src/project.d.ts +335 -0
  156. package/dist/src/project.d.ts.map +1 -0
  157. package/dist/src/project.js +499 -0
  158. package/dist/src/project.js.map +1 -0
  159. package/dist/src/ranges.d.ts +31 -0
  160. package/dist/src/ranges.d.ts.map +1 -0
  161. package/dist/src/ranges.js +51 -0
  162. package/dist/src/ranges.js.map +1 -0
  163. package/dist/src/relay.d.ts +177 -0
  164. package/dist/src/relay.d.ts.map +1 -0
  165. package/dist/src/relay.js +147 -0
  166. package/dist/src/relay.js.map +1 -0
  167. package/dist/src/room-files.d.ts +146 -0
  168. package/dist/src/room-files.d.ts.map +1 -0
  169. package/dist/src/room-files.js +135 -0
  170. package/dist/src/room-files.js.map +1 -0
  171. package/dist/src/room-note.d.ts +213 -0
  172. package/dist/src/room-note.d.ts.map +1 -0
  173. package/dist/src/room-note.js +457 -0
  174. package/dist/src/room-note.js.map +1 -0
  175. package/dist/src/space-icons.d.ts +68 -0
  176. package/dist/src/space-icons.d.ts.map +1 -0
  177. package/dist/src/space-icons.js +142 -0
  178. package/dist/src/space-icons.js.map +1 -0
  179. package/dist/src/spend.d.ts +57 -0
  180. package/dist/src/spend.d.ts.map +1 -0
  181. package/dist/src/spend.js +94 -0
  182. package/dist/src/spend.js.map +1 -0
  183. package/dist/src/visibility.d.ts +170 -0
  184. package/dist/src/visibility.d.ts.map +1 -0
  185. package/dist/src/visibility.js +218 -0
  186. package/dist/src/visibility.js.map +1 -0
  187. package/fixtures/agent.asked.json +15 -0
  188. package/fixtures/agent.attached.json +15 -0
  189. package/fixtures/agent.deleted.json +16 -0
  190. package/fixtures/agent.fork.json +14 -0
  191. package/fixtures/agent.lock_set.json +13 -0
  192. package/fixtures/agent.registered.json +17 -0
  193. package/fixtures/agent.released.json +16 -0
  194. package/fixtures/agent.updated.json +14 -0
  195. package/fixtures/approval.executed.json +16 -0
  196. package/fixtures/approval.request.json +45 -0
  197. package/fixtures/approval.resolved.json +20 -0
  198. package/fixtures/approval.routed.json +20 -0
  199. package/fixtures/artifact.create.json +18 -0
  200. package/fixtures/attachment.fetched.json +15 -0
  201. package/fixtures/attachment.limits_set.json +15 -0
  202. package/fixtures/budget.warning.json +20 -0
  203. package/fixtures/checkpoint.json +16 -0
  204. package/fixtures/context.compacted.json +16 -0
  205. package/fixtures/context.usage.json +17 -0
  206. package/fixtures/exchange.limits_set.json +15 -0
  207. package/fixtures/exchange.set.json +13 -0
  208. package/fixtures/feedback.json +21 -0
  209. package/fixtures/frames/ack.json +6 -0
  210. package/fixtures/frames/context.edit.json +11 -0
  211. package/fixtures/frames/context_window.change.json +9 -0
  212. package/fixtures/frames/context_window.compact.json +8 -0
  213. package/fixtures/frames/error.json +6 -0
  214. package/fixtures/frames/event.json +20 -0
  215. package/fixtures/frames/events.json +39 -0
  216. package/fixtures/frames/folder.open.json +6 -0
  217. package/fixtures/frames/folder.open.page.json +7 -0
  218. package/fixtures/frames/folder.run.json +8 -0
  219. package/fixtures/frames/folder.run_state.json +12 -0
  220. package/fixtures/frames/heartbeat.change.json +10 -0
  221. package/fixtures/frames/hello.json +18 -0
  222. package/fixtures/frames/job.change.json +9 -0
  223. package/fixtures/frames/join.json +19 -0
  224. package/fixtures/frames/model.change.json +10 -0
  225. package/fixtures/frames/ping.json +4 -0
  226. package/fixtures/frames/pong.json +4 -0
  227. package/fixtures/frames/presence.json +12 -0
  228. package/fixtures/frames/receipt.json +5 -0
  229. package/fixtures/frames/restart.json +5 -0
  230. package/fixtures/frames/subscribe.json +6 -0
  231. package/fixtures/handoff.json +20 -0
  232. package/fixtures/harness.removed.json +15 -0
  233. package/fixtures/harness.transferred.json +15 -0
  234. package/fixtures/hello.json +61 -0
  235. package/fixtures/join.allowed.json +20 -0
  236. package/fixtures/join.denied.json +17 -0
  237. package/fixtures/lane.updated.json +17 -0
  238. package/fixtures/membership.added.json +16 -0
  239. package/fixtures/membership.removed.json +14 -0
  240. package/fixtures/membership.replaced.json +15 -0
  241. package/fixtures/message.deleted.json +15 -0
  242. package/fixtures/message.edited.json +15 -0
  243. package/fixtures/message.handed.json +14 -0
  244. package/fixtures/message.heard.json +14 -0
  245. package/fixtures/message.held.json +14 -0
  246. package/fixtures/message.hidden.json +14 -0
  247. package/fixtures/message.new.json +96 -0
  248. package/fixtures/message.overheard.json +22 -0
  249. package/fixtures/message.pinned.json +14 -0
  250. package/fixtures/message.post.json +14 -0
  251. package/fixtures/message.shown.json +14 -0
  252. package/fixtures/message.unpinned.json +14 -0
  253. package/fixtures/person.face_set.json +17 -0
  254. package/fixtures/person.joined.json +16 -0
  255. package/fixtures/person.removed.json +16 -0
  256. package/fixtures/person.renamed.json +14 -0
  257. package/fixtures/policy.updated.json +30 -0
  258. package/fixtures/project.changed.json +21 -0
  259. package/fixtures/question.answered.json +23 -0
  260. package/fixtures/question.ask.json +37 -0
  261. package/fixtures/receipt.json +15 -0
  262. package/fixtures/relay.set.json +12 -0
  263. package/fixtures/role.changed.json +15 -0
  264. package/fixtures/run.cancel.json +15 -0
  265. package/fixtures/run.completed.json +20 -0
  266. package/fixtures/run.failed.json +20 -0
  267. package/fixtures/run.pause.json +15 -0
  268. package/fixtures/run.plan.json +24 -0
  269. package/fixtures/run.requested.json +34 -0
  270. package/fixtures/run.resume.json +15 -0
  271. package/fixtures/run.started.json +33 -0
  272. package/fixtures/run.status.json +17 -0
  273. package/fixtures/run.steer.json +21 -0
  274. package/fixtures/session.ended.json +15 -0
  275. package/fixtures/session.renamed.json +15 -0
  276. package/fixtures/session.started.json +17 -0
  277. package/fixtures/space.claimed.json +15 -0
  278. package/fixtures/space.created.json +14 -0
  279. package/fixtures/space.erased.json +13 -0
  280. package/fixtures/space.lead_set.json +13 -0
  281. package/fixtures/space.lock_set.json +13 -0
  282. package/fixtures/space.spend_ceiling_set.json +13 -0
  283. package/fixtures/space.updated.json +14 -0
  284. package/fixtures/step.log.json +26 -0
  285. package/fixtures/task.json +22 -0
  286. package/fixtures/turn.passed.json +14 -0
  287. package/fixtures/usage.json +21 -0
  288. package/fixtures/workspace.renamed.json +13 -0
  289. package/generated/agent-connect.json +13966 -0
  290. package/generated/schema/agent.asked.json +114 -0
  291. package/generated/schema/agent.attached.json +465 -0
  292. package/generated/schema/agent.deleted.json +127 -0
  293. package/generated/schema/agent.fork.json +107 -0
  294. package/generated/schema/agent.lock_set.json +105 -0
  295. package/generated/schema/agent.registered.json +130 -0
  296. package/generated/schema/agent.released.json +129 -0
  297. package/generated/schema/agent.updated.json +151 -0
  298. package/generated/schema/approval.executed.json +125 -0
  299. package/generated/schema/approval.request.json +279 -0
  300. package/generated/schema/approval.resolved.json +162 -0
  301. package/generated/schema/approval.routed.json +185 -0
  302. package/generated/schema/artifact.create.json +206 -0
  303. package/generated/schema/attachment.fetched.json +114 -0
  304. package/generated/schema/attachment.limits_set.json +136 -0
  305. package/generated/schema/budget.warning.json +152 -0
  306. package/generated/schema/checkpoint.json +111 -0
  307. package/generated/schema/context.compacted.json +124 -0
  308. package/generated/schema/context.usage.json +120 -0
  309. package/generated/schema/exchange.limits_set.json +127 -0
  310. package/generated/schema/exchange.set.json +144 -0
  311. package/generated/schema/feedback.json +173 -0
  312. package/generated/schema/handoff.json +122 -0
  313. package/generated/schema/harness.removed.json +122 -0
  314. package/generated/schema/harness.transferred.json +117 -0
  315. package/generated/schema/hello.json +509 -0
  316. package/generated/schema/join.allowed.json +176 -0
  317. package/generated/schema/join.denied.json +150 -0
  318. package/generated/schema/lane.updated.json +223 -0
  319. package/generated/schema/membership.added.json +153 -0
  320. package/generated/schema/membership.removed.json +126 -0
  321. package/generated/schema/membership.replaced.json +106 -0
  322. package/generated/schema/message.deleted.json +105 -0
  323. package/generated/schema/message.edited.json +107 -0
  324. package/generated/schema/message.handed.json +111 -0
  325. package/generated/schema/message.heard.json +100 -0
  326. package/generated/schema/message.held.json +181 -0
  327. package/generated/schema/message.hidden.json +100 -0
  328. package/generated/schema/message.new.json +1369 -0
  329. package/generated/schema/message.overheard.json +701 -0
  330. package/generated/schema/message.pinned.json +100 -0
  331. package/generated/schema/message.post.json +290 -0
  332. package/generated/schema/message.shown.json +100 -0
  333. package/generated/schema/message.unpinned.json +100 -0
  334. package/generated/schema/person.face_set.json +134 -0
  335. package/generated/schema/person.joined.json +128 -0
  336. package/generated/schema/person.removed.json +133 -0
  337. package/generated/schema/person.renamed.json +114 -0
  338. package/generated/schema/policy.updated.json +277 -0
  339. package/generated/schema/project.changed.json +199 -0
  340. package/generated/schema/question.answered.json +154 -0
  341. package/generated/schema/question.ask.json +194 -0
  342. package/generated/schema/receipt.json +109 -0
  343. package/generated/schema/relay.set.json +99 -0
  344. package/generated/schema/role.changed.json +116 -0
  345. package/generated/schema/run.cancel.json +106 -0
  346. package/generated/schema/run.completed.json +139 -0
  347. package/generated/schema/run.failed.json +135 -0
  348. package/generated/schema/run.pause.json +106 -0
  349. package/generated/schema/run.plan.json +128 -0
  350. package/generated/schema/run.requested.json +309 -0
  351. package/generated/schema/run.resume.json +106 -0
  352. package/generated/schema/run.started.json +142 -0
  353. package/generated/schema/run.status.json +120 -0
  354. package/generated/schema/run.steer.json +163 -0
  355. package/generated/schema/session.ended.json +106 -0
  356. package/generated/schema/session.renamed.json +108 -0
  357. package/generated/schema/session.started.json +116 -0
  358. package/generated/schema/space.claimed.json +107 -0
  359. package/generated/schema/space.created.json +148 -0
  360. package/generated/schema/space.erased.json +129 -0
  361. package/generated/schema/space.lead_set.json +108 -0
  362. package/generated/schema/space.lock_set.json +99 -0
  363. package/generated/schema/space.spend_ceiling_set.json +102 -0
  364. package/generated/schema/space.updated.json +112 -0
  365. package/generated/schema/step.log.json +187 -0
  366. package/generated/schema/task.json +268 -0
  367. package/generated/schema/turn.passed.json +99 -0
  368. package/generated/schema/usage.json +155 -0
  369. package/generated/schema/workspace.renamed.json +107 -0
  370. package/generated/types.ts +4178 -0
  371. package/package.json +38 -3
@@ -0,0 +1,4178 @@
1
+ // Generated by `pnpm gen:protocol`. Do not edit by hand.
2
+ //
3
+ // TypeScript types for every Agent Connect event, with no dependency on zod. Import the
4
+ // schemas from `@chipschat/protocol` when you need to validate; import these when you only
5
+ // need the shape.
6
+
7
+ export const PROTOCOL_VERSION = 1;
8
+
9
+ /** `session.started` — A visit to a space began: a terminal opened, a process attached. The space outlives it. */
10
+ export interface SessionStarted {
11
+ /** Protocol major version. */
12
+ v: 1;
13
+ type: "session.started";
14
+ /** The event's own id. Stable across a retry of the same event. */
15
+ id: string;
16
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
17
+ ts: string;
18
+ /** A workspace identifier: `ws_` followed by a ULID. */
19
+ workspace_id: string;
20
+ /** The space, when the event belongs to one. */
21
+ space_id?: string;
22
+ /** The run, when the event belongs to one. */
23
+ run_id?: string;
24
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
25
+ seq?: number;
26
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
27
+ idempotency_key?: string;
28
+ /** The participant an event is attributed to. */
29
+ actor: {
30
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
31
+ kind: "person" | "harness" | "agent" | "system";
32
+ /** The participant id, or `system` for Chips. */
33
+ id: string;
34
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
35
+ harness_id?: string;
36
+ };
37
+ /** The harness's own name for one visit, prefixed by the kind of harness. */
38
+ session_ref: string;
39
+ /** Why the visit began, in the harness's own word: `startup`, `resume`, `fork`. */
40
+ started_reason?: string;
41
+ /** Where it is running, for a person to read: "mbp · ~/Work/Chips". */
42
+ where?: string;
43
+ /** The harness's own transcript of this visit, so a person can jump to it. */
44
+ transcript_ref?: string;
45
+ }
46
+
47
+ /** `session.ended` — The visit is over. The space, its history and anything still waiting all stay. */
48
+ export interface SessionEnded {
49
+ /** Protocol major version. */
50
+ v: 1;
51
+ type: "session.ended";
52
+ /** The event's own id. Stable across a retry of the same event. */
53
+ id: string;
54
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
55
+ ts: string;
56
+ /** A workspace identifier: `ws_` followed by a ULID. */
57
+ workspace_id: string;
58
+ /** The space, when the event belongs to one. */
59
+ space_id?: string;
60
+ /** The run, when the event belongs to one. */
61
+ run_id?: string;
62
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
63
+ seq?: number;
64
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
65
+ idempotency_key?: string;
66
+ /** The participant an event is attributed to. */
67
+ actor: {
68
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
69
+ kind: "person" | "harness" | "agent" | "system";
70
+ /** The participant id, or `system` for Chips. */
71
+ id: string;
72
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
73
+ harness_id?: string;
74
+ };
75
+ /** The harness's own name for one visit, prefixed by the kind of harness. */
76
+ session_ref: string;
77
+ /** Why it ended, in the harness's own word: `clear`, `logout`, `other`. */
78
+ ended_reason?: string;
79
+ }
80
+
81
+ /** `session.renamed` — What a visit is called, in the harness's own words (ADR 0040). */
82
+ export interface SessionRenamed {
83
+ /** Protocol major version. */
84
+ v: 1;
85
+ type: "session.renamed";
86
+ /** The event's own id. Stable across a retry of the same event. */
87
+ id: string;
88
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
89
+ ts: string;
90
+ /** A workspace identifier: `ws_` followed by a ULID. */
91
+ workspace_id: string;
92
+ /** The space, when the event belongs to one. */
93
+ space_id?: string;
94
+ /** The run, when the event belongs to one. */
95
+ run_id?: string;
96
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
97
+ seq?: number;
98
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
99
+ idempotency_key?: string;
100
+ /** The participant an event is attributed to. */
101
+ actor: {
102
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
103
+ kind: "person" | "harness" | "agent" | "system";
104
+ /** The participant id, or `system` for Chips. */
105
+ id: string;
106
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
107
+ harness_id?: string;
108
+ };
109
+ /** The harness's own name for one visit, prefixed by the kind of harness. */
110
+ session_ref: string;
111
+ /** What to call this visit on screen. A harness that names its sessions sends this when the name changes and not otherwise; a visit with no name is shown by where it is running instead. */
112
+ title: string;
113
+ }
114
+
115
+ /** `run.started` — A harness has begun a unit of work, optionally with the plan it intends to follow. */
116
+ export interface RunStarted {
117
+ /** Protocol major version. */
118
+ v: 1;
119
+ type: "run.started";
120
+ /** The event's own id. Stable across a retry of the same event. */
121
+ id: string;
122
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
123
+ ts: string;
124
+ /** A workspace identifier: `ws_` followed by a ULID. */
125
+ workspace_id: string;
126
+ /** The space, when the event belongs to one. */
127
+ space_id?: string;
128
+ /** The run, when the event belongs to one. */
129
+ run_id?: string;
130
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
131
+ seq?: number;
132
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
133
+ idempotency_key?: string;
134
+ /** The participant an event is attributed to. */
135
+ actor: {
136
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
137
+ kind: "person" | "harness" | "agent" | "system";
138
+ /** The participant id, or `system` for Chips. */
139
+ id: string;
140
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
141
+ harness_id?: string;
142
+ };
143
+ /** What the run is for, in the person's words where possible. */
144
+ goal: string;
145
+ /** The steps the harness expects to take. The run panel draws one hollow dot each. */
146
+ plan?: {
147
+ /** Stable for the life of the run, so updates land on the right row. */
148
+ step_id: string;
149
+ /** What this step will do. */
150
+ title: string;
151
+ }[];
152
+ /** The visit this run belongs to, so two terminals in one space are told apart. */
153
+ session_ref?: string;
154
+ /** Where the goal came from. `harness`: a person asked for it at the harness's own surface — a terminal, a chat the harness already had — so Chips shows it as their message, because otherwise the room holds only the answers. `chips`: it arrived as a message here and is already on screen. Either way the room's header and the run panel leave the goal out, because the room shows it. Omit when the goal was not a person's words at all; the header and the run panel then say it. */
155
+ goal_from?: "harness" | "chips";
156
+ }
157
+
158
+ /** `run.status` — What the harness is doing right now. This is the harness's typing indicator. */
159
+ export interface RunStatus {
160
+ /** Protocol major version. */
161
+ v: 1;
162
+ type: "run.status";
163
+ /** The event's own id. Stable across a retry of the same event. */
164
+ id: string;
165
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
166
+ ts: string;
167
+ /** A workspace identifier: `ws_` followed by a ULID. */
168
+ workspace_id: string;
169
+ /** The space, when the event belongs to one. */
170
+ space_id?: string;
171
+ /** The run, when the event belongs to one. */
172
+ run_id?: string;
173
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
174
+ seq?: number;
175
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
176
+ idempotency_key?: string;
177
+ /** The participant an event is attributed to. */
178
+ actor: {
179
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
180
+ kind: "person" | "harness" | "agent" | "system";
181
+ /** The participant id, or `system` for Chips. */
182
+ id: string;
183
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
184
+ harness_id?: string;
185
+ };
186
+ /** A short machine-ish label, for example `reading`. */
187
+ phase: string;
188
+ /** What to show under the harness's name, for example "Reading PO #4471…". */
189
+ verb_phrase: string;
190
+ /** Fraction complete, when the harness knows. */
191
+ progress?: number;
192
+ /** Seconds remaining, when the harness knows. */
193
+ estimate_seconds?: number;
194
+ }
195
+
196
+ /** `run.plan` — The plan changed. Replaces the steps not yet done; the ones already done or failed keep their place. */
197
+ export interface RunPlan {
198
+ /** Protocol major version. */
199
+ v: 1;
200
+ type: "run.plan";
201
+ /** The event's own id. Stable across a retry of the same event. */
202
+ id: string;
203
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
204
+ ts: string;
205
+ /** A workspace identifier: `ws_` followed by a ULID. */
206
+ workspace_id: string;
207
+ /** The space, when the event belongs to one. */
208
+ space_id?: string;
209
+ /** The run, when the event belongs to one. */
210
+ run_id?: string;
211
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
212
+ seq?: number;
213
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
214
+ idempotency_key?: string;
215
+ /** The participant an event is attributed to. */
216
+ actor: {
217
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
218
+ kind: "person" | "harness" | "agent" | "system";
219
+ /** The participant id, or `system` for Chips. */
220
+ id: string;
221
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
222
+ harness_id?: string;
223
+ };
224
+ /** The steps still to come, in order. Steps already done or failed stay ahead of these; a step still to do that is not here is dropped. */
225
+ plan: {
226
+ /** Stable for the life of the run, so updates land on the right row. */
227
+ step_id: string;
228
+ /** What this step will do. */
229
+ title: string;
230
+ }[];
231
+ /** Why the plan changed, in a sentence: a steer, a surprise, a shortcut. */
232
+ reason?: string;
233
+ }
234
+
235
+ /** `step.log` — One tool call or reasoning step, for the receipt and the run timeline. */
236
+ export interface StepLog {
237
+ /** Protocol major version. */
238
+ v: 1;
239
+ type: "step.log";
240
+ /** The event's own id. Stable across a retry of the same event. */
241
+ id: string;
242
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
243
+ ts: string;
244
+ /** A workspace identifier: `ws_` followed by a ULID. */
245
+ workspace_id: string;
246
+ /** The space, when the event belongs to one. */
247
+ space_id?: string;
248
+ /** The run, when the event belongs to one. */
249
+ run_id?: string;
250
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
251
+ seq?: number;
252
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
253
+ idempotency_key?: string;
254
+ /** The participant an event is attributed to. */
255
+ actor: {
256
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
257
+ kind: "person" | "harness" | "agent" | "system";
258
+ /** The participant id, or `system` for Chips. */
259
+ id: string;
260
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
261
+ harness_id?: string;
262
+ };
263
+ /** Stable across the started and done events for one step. */
264
+ step_id: string;
265
+ /** Where this step got to. */
266
+ status: "started" | "done" | "failed";
267
+ /** What the step is, when it was not in the plan. */
268
+ title?: string;
269
+ /** The tool called, for example `drive.read`. */
270
+ tool?: string;
271
+ /** What kind of call the tool is, when the harness knows: the apps draw a step by it where they do not know the tool by its name. */
272
+ kind?: "search" | "web" | "shell" | "image" | "memory" | "edit" | "file" | "mail" | "handoff" | "other";
273
+ /** One line for the receipt. */
274
+ summary?: string;
275
+ /** Where the information came from. */
276
+ sources?: {
277
+ /** Whether the source is outside the workspace. */
278
+ kind: "external" | "internal";
279
+ /** What to show in the receipt, for example `vendor website`. */
280
+ label: string;
281
+ /** Where to look, when there is somewhere to look. */
282
+ url?: string;
283
+ }[];
284
+ /** How long the step took. */
285
+ duration_ms?: number;
286
+ /** Why it failed, when it did. */
287
+ error?: string;
288
+ }
289
+
290
+ /** `message.post` — A harness says something in a space, with any attachments. */
291
+ export interface MessagePost {
292
+ /** Protocol major version. */
293
+ v: 1;
294
+ type: "message.post";
295
+ /** The event's own id. Stable across a retry of the same event. */
296
+ id: string;
297
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
298
+ ts: string;
299
+ /** A workspace identifier: `ws_` followed by a ULID. */
300
+ workspace_id: string;
301
+ /** The space, when the event belongs to one. */
302
+ space_id?: string;
303
+ /** The run, when the event belongs to one. */
304
+ run_id?: string;
305
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
306
+ seq?: number;
307
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
308
+ idempotency_key?: string;
309
+ /** The participant an event is attributed to. */
310
+ actor: {
311
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
312
+ kind: "person" | "harness" | "agent" | "system";
313
+ /** The participant id, or `system` for Chips. */
314
+ id: string;
315
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
316
+ harness_id?: string;
317
+ };
318
+ /** Markdown, with mentions. */
319
+ text: string;
320
+ /** Photos, video, voice notes, files, as the upload described them. */
321
+ attachments?: {
322
+ /** A attachment identifier: `att_` followed by a ULID. */
323
+ attachment_id: string;
324
+ /** The name to show. Never trusted for its type. */
325
+ filename: string;
326
+ /** Sniffed from the bytes on upload, not taken from the client. */
327
+ mime_type: string;
328
+ /** Size in bytes. */
329
+ byte_size: number;
330
+ /** Lowercase hex digest. The store is content-addressed. */
331
+ sha256: string;
332
+ /** Pixels, for images and video. */
333
+ width?: number;
334
+ /** Pixels, for images and video. */
335
+ height?: number;
336
+ /** Milliseconds, for audio and video. */
337
+ duration_ms?: number;
338
+ /** What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out. */
339
+ transcript?: string;
340
+ /** The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced. */
341
+ replaces?: string;
342
+ }[];
343
+ /** Uploads to attach, by the id `POST /v1/uploads` gave. Chips fills in `attachments` from what it stored. */
344
+ upload_ids?: string[];
345
+ /** Which version of the room's file each file here was made from (ADR 0099): an upload's or attachment's id, to the `attachment_id` of the version it changes, as `context.files` listed it. Each key is one of this post's `upload_ids` or `attachments`. A post made from a version that is no longer current is refused, `stale_file`, saying which file and who changed it; nothing of it is taken. A version of another name, or of another room, is no version of this file: Chips leaves it out. Chips copies each onto its attachment as `replaces`, and does not keep the map. */
346
+ replaces?: {
347
+ };
348
+ /** The commit the turn's push left the room's project at (ADR 0222): the room shows the change with this message. Chips keeps it only when the commit is on the room's `main` and is this agent's own; otherwise the message is kept without it. */
349
+ change?: string;
350
+ /** The message being answered, when it is a reply: one said in the same room, or the post is refused (ADR 0219). A person's reply to an agent's message is for that agent, unless an @ or `to` says otherwise; a harness's reply to an agent's message is for that agent too (ADR 0081), so a harness sets it only when it means to address them. */
351
+ reply_to?: string;
352
+ /** The visit this message is for, when the sender means one of several (ADR 0040). Chips checks it names a session of this space and carries it to the harness; a harness that works by visits delivers there rather than choosing, and one that does not ignores it. */
353
+ session_ref?: string;
354
+ /** The participants the text's @handles name, as ids. Filled in by Chips against the space's members; a value the sender writes is replaced. */
355
+ mentions?: string[];
356
+ /** Who the sender chose, without typing an @: agent ids and people's, or `all` for every agent in the space (ADR 0081, ADR 0087, ADR 0204). A harness's id names its one agent in the space. Chips keeps only the members. People picked are who a person's message is for besides its agents (`addressed_people`); no agent takes a turn for them. An @ in the text decides before it. */
357
+ to?: "all" | string[];
358
+ /** The agent wrote this on its own, on its heartbeat, with nobody asking (ADR 0143): the apps mark it so. Only a harness, or one of its agents, sends it; a check with nothing to say posts nothing. */
359
+ heartbeat?: true;
360
+ /** The agents this message is for, and so the agents that take a turn on it (ADR 0081, ADR 0087). Filled in by Chips from the @s, `to`, the reply and the space; a value the sender writes is replaced. A message logged without it was for every harness in the space. */
361
+ addressed_to?: string[];
362
+ /** Filled in by Chips on a person's message (ADR 0204): the people it is for, those its @s name, or else those the sender picked in `to`. They are pushed as an @ pushes them; no agent takes a turn for them. Absent for none; a value the sender writes is replaced. */
363
+ addressed_people?: string[];
364
+ /** Filled in by Chips when the message is for every harness in the space, whoever is there: `@all`, a `to` of `all`, or a person's default of everyone (ADR 0081). That person's next message that names nobody goes to every harness there is then, one added since included. */
365
+ addressed_to_all?: true;
366
+ /** Filled in by Chips when harnesses have addressed each other four times since a person last spoke there: the message is posted and shown, and addressed to nobody (ADR 0081). */
367
+ held?: true;
368
+ /** Written by Chips for words the agent said while in no room (ADR 0087, rule 6): when it said them. Posted here as it was attached. */
369
+ held_since?: string;
370
+ /** Written by Chips: the `message.held` these words were kept as. */
371
+ from_held?: string;
372
+ }
373
+
374
+ /** `message.heard` — A turn working in a room heard a message said there, as it worked. */
375
+ export interface MessageHeard {
376
+ /** Protocol major version. */
377
+ v: 1;
378
+ type: "message.heard";
379
+ /** The event's own id. Stable across a retry of the same event. */
380
+ id: string;
381
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
382
+ ts: string;
383
+ /** A workspace identifier: `ws_` followed by a ULID. */
384
+ workspace_id: string;
385
+ /** The space, when the event belongs to one. */
386
+ space_id?: string;
387
+ /** The run, when the event belongs to one. */
388
+ run_id?: string;
389
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
390
+ seq?: number;
391
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
392
+ idempotency_key?: string;
393
+ /** The participant an event is attributed to. */
394
+ actor: {
395
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
396
+ kind: "person" | "harness" | "agent" | "system";
397
+ /** The participant id, or `system` for Chips. */
398
+ id: string;
399
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
400
+ harness_id?: string;
401
+ };
402
+ /** The message, as `message.overheard` or `message.new` named it. */
403
+ message_id: string;
404
+ }
405
+
406
+ /** `approval.request` — The thing a group chat cannot do: an action, a preview, a risk class, who may answer, and an audit record. */
407
+ export interface ApprovalRequest {
408
+ /** Protocol major version. */
409
+ v: 1;
410
+ type: "approval.request";
411
+ /** The event's own id. Stable across a retry of the same event. */
412
+ id: string;
413
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
414
+ ts: string;
415
+ /** A workspace identifier: `ws_` followed by a ULID. */
416
+ workspace_id: string;
417
+ /** The space, when the event belongs to one. */
418
+ space_id?: string;
419
+ /** The run, when the event belongs to one. */
420
+ run_id?: string;
421
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
422
+ seq?: number;
423
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
424
+ idempotency_key?: string;
425
+ /** The participant an event is attributed to. */
426
+ actor: {
427
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
428
+ kind: "person" | "harness" | "agent" | "system";
429
+ /** The participant id, or `system` for Chips. */
430
+ id: string;
431
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
432
+ harness_id?: string;
433
+ };
434
+ /** Minted by the harness, so a retry after a reconnect is the same ask. */
435
+ approval_id: string;
436
+ /** The plan step this ask belongs to. */
437
+ step_id?: string;
438
+ /** An action a harness proposes to take. */
439
+ action: {
440
+ /** A dotted verb, for example `email.send` or `payment.transfer`. Policy rules glob on it. */
441
+ kind: string;
442
+ /** The arguments, shaped by the tool being called. */
443
+ input?: unknown;
444
+ /** True when the action leaves the workspace. */
445
+ external?: boolean;
446
+ /** True when the action cannot be undone. */
447
+ irreversible?: boolean;
448
+ /** Amount at stake, in US dollars. */
449
+ money_usd?: number;
450
+ };
451
+ /** The question the person answers yes or no, as one sentence in plain words: `Turn off the Robinhood connector?`. The card leads with it. Without it the card is headed by the preview's title, else the action's kind (ADR 0142). */
452
+ question?: string;
453
+ /** What a yes does, in a sentence or two: `Its 73 tools disappear from every Space.` Drawn under the question. */
454
+ effect?: string;
455
+ /** How long a yes keeps working: `once` for this action alone, `standing` for a grant that holds until it is taken back, such as a folder an agent may keep working in. The card says which. */
456
+ lasts?: "once" | "standing";
457
+ /** What the approver sees. Omit only when the action speaks for itself. */
458
+ preview?: {
459
+ /** How to render the body. */
460
+ format: "markdown" | "plain" | "diff" | "json" | "table";
461
+ /** The rendered preview. */
462
+ body: string;
463
+ /** A heading for the card. */
464
+ title?: string;
465
+ };
466
+ /** Risk classes. The policy engine matches rules against these. */
467
+ risk: "external" | "external_communication" | "irreversible" | "destructive" | "financial" | "credential" | "privacy" | "legal"[];
468
+ /** Where the harness got what it is about to act on. */
469
+ sources?: {
470
+ /** Whether the source is outside the workspace. */
471
+ kind: "external" | "internal";
472
+ /** What to show in the receipt, for example `vendor website`. */
473
+ label: string;
474
+ /** Where to look, when there is somewhere to look. */
475
+ url?: string;
476
+ }[];
477
+ /** Seconds until the approval expires. Every approval has an expiry and a fallback. */
478
+ expires_in: number;
479
+ /** What happens on expiry. Denying is the default, and the safe one. */
480
+ fallback?: "deny" | "allow";
481
+ /** Who may answer, as the harness asks it: `owner`, `any` (the room, but its guests), `role:<name>` (a standing in the space or in the workspace), or a person id. `lead` (the lane's lead, when the run is a lane's) is a policy rule's to name, never a harness's, and never for an ask that matters — money, a deletion, an external action reach a person. Chips resolves them — policy's own list when a rule names one — to ids before the event is stored, and only those may decide it; a person may hand it on with `approval.routed`. */
482
+ approvers?: string[];
483
+ /** Whether the approver may change the input before allowing. */
484
+ editable?: boolean;
485
+ /** Lets a paused command-line run continue hours later. Approvals outlive processes. */
486
+ resume_token?: string;
487
+ }
488
+
489
+ /** `question.ask` — One to four questions with tappable options, a default, and a timeout. */
490
+ export interface QuestionAsk {
491
+ /** Protocol major version. */
492
+ v: 1;
493
+ type: "question.ask";
494
+ /** The event's own id. Stable across a retry of the same event. */
495
+ id: string;
496
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
497
+ ts: string;
498
+ /** A workspace identifier: `ws_` followed by a ULID. */
499
+ workspace_id: string;
500
+ /** The space, when the event belongs to one. */
501
+ space_id?: string;
502
+ /** The run, when the event belongs to one. */
503
+ run_id?: string;
504
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
505
+ seq?: number;
506
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
507
+ idempotency_key?: string;
508
+ /** The participant an event is attributed to. */
509
+ actor: {
510
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
511
+ kind: "person" | "harness" | "agent" | "system";
512
+ /** The participant id, or `system` for Chips. */
513
+ id: string;
514
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
515
+ harness_id?: string;
516
+ };
517
+ /** Minted by the harness, so a retry is the same ask. */
518
+ ask_id: string;
519
+ /** One to four questions. */
520
+ questions: {
521
+ /** Stable, so answers land on the right question. */
522
+ question_id: string;
523
+ /** What is being asked. */
524
+ prompt: string;
525
+ /** Two to four options. */
526
+ options: {
527
+ /** What comes back in `question.answered`. */
528
+ value: string;
529
+ /** What the person taps. */
530
+ label: string;
531
+ /** What choosing it means. */
532
+ description?: string;
533
+ }[];
534
+ /** Whether more than one option may be chosen. */
535
+ multi_select?: boolean;
536
+ /** Whether the person may type instead. */
537
+ allow_free_text?: boolean;
538
+ /** What the harness will take if nobody answers. Its presence lowers the notification tier. */
539
+ default_value?: string;
540
+ }[];
541
+ /** How long to wait for an answer. */
542
+ timeout_seconds?: number;
543
+ /** What the harness will do if the timeout passes. */
544
+ on_no_answer?: "use_default" | "cancel" | "continue";
545
+ }
546
+
547
+ /** `artifact.create` — A file, document, code, image or table the harness produced, with a version. */
548
+ export interface ArtifactCreate {
549
+ /** Protocol major version. */
550
+ v: 1;
551
+ type: "artifact.create";
552
+ /** The event's own id. Stable across a retry of the same event. */
553
+ id: string;
554
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
555
+ ts: string;
556
+ /** A workspace identifier: `ws_` followed by a ULID. */
557
+ workspace_id: string;
558
+ /** The space, when the event belongs to one. */
559
+ space_id?: string;
560
+ /** The run, when the event belongs to one. */
561
+ run_id?: string;
562
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
563
+ seq?: number;
564
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
565
+ idempotency_key?: string;
566
+ /** The participant an event is attributed to. */
567
+ actor: {
568
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
569
+ kind: "person" | "harness" | "agent" | "system";
570
+ /** The participant id, or `system` for Chips. */
571
+ id: string;
572
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
573
+ harness_id?: string;
574
+ };
575
+ /** Content-addressed, like every attachment. */
576
+ artifact_id: string;
577
+ /** How to render it. */
578
+ kind: "file" | "document" | "code" | "image" | "table";
579
+ /** What to call it. */
580
+ title: string;
581
+ /** Bumped when the harness revises it. */
582
+ version?: number;
583
+ /** The bytes, when the artifact is a file. */
584
+ attachment?: {
585
+ /** A attachment identifier: `att_` followed by a ULID. */
586
+ attachment_id: string;
587
+ /** The name to show. Never trusted for its type. */
588
+ filename: string;
589
+ /** Sniffed from the bytes on upload, not taken from the client. */
590
+ mime_type: string;
591
+ /** Size in bytes. */
592
+ byte_size: number;
593
+ /** Lowercase hex digest. The store is content-addressed. */
594
+ sha256: string;
595
+ /** Pixels, for images and video. */
596
+ width?: number;
597
+ /** Pixels, for images and video. */
598
+ height?: number;
599
+ /** Milliseconds, for audio and video. */
600
+ duration_ms?: number;
601
+ /** What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out. */
602
+ transcript?: string;
603
+ /** The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced. */
604
+ replaces?: string;
605
+ };
606
+ /** The content, when the artifact is text. */
607
+ body?: string;
608
+ /** For code, the language to highlight. */
609
+ language?: string;
610
+ }
611
+
612
+ /** `checkpoint` — A milestone reached and what is next. Compaction is a checkpoint. FYI tier. */
613
+ export interface Checkpoint {
614
+ /** Protocol major version. */
615
+ v: 1;
616
+ type: "checkpoint";
617
+ /** The event's own id. Stable across a retry of the same event. */
618
+ id: string;
619
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
620
+ ts: string;
621
+ /** A workspace identifier: `ws_` followed by a ULID. */
622
+ workspace_id: string;
623
+ /** The space, when the event belongs to one. */
624
+ space_id?: string;
625
+ /** The run, when the event belongs to one. */
626
+ run_id?: string;
627
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
628
+ seq?: number;
629
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
630
+ idempotency_key?: string;
631
+ /** The participant an event is attributed to. */
632
+ actor: {
633
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
634
+ kind: "person" | "harness" | "agent" | "system";
635
+ /** The participant id, or `system` for Chips. */
636
+ id: string;
637
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
638
+ harness_id?: string;
639
+ };
640
+ /** The milestone reached. */
641
+ label: string;
642
+ /** What the harness will do next. */
643
+ next?: string;
644
+ /** True when the harness just compacted its context. */
645
+ compacted?: boolean;
646
+ }
647
+
648
+ /** `handoff` — Passing work to a person or another harness, with a context summary and what is still open. */
649
+ export interface Handoff {
650
+ /** Protocol major version. */
651
+ v: 1;
652
+ type: "handoff";
653
+ /** The event's own id. Stable across a retry of the same event. */
654
+ id: string;
655
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
656
+ ts: string;
657
+ /** A workspace identifier: `ws_` followed by a ULID. */
658
+ workspace_id: string;
659
+ /** The space, when the event belongs to one. */
660
+ space_id?: string;
661
+ /** The run, when the event belongs to one. */
662
+ run_id?: string;
663
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
664
+ seq?: number;
665
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
666
+ idempotency_key?: string;
667
+ /** The participant an event is attributed to. */
668
+ actor: {
669
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
670
+ kind: "person" | "harness" | "agent" | "system";
671
+ /** The participant id, or `system` for Chips. */
672
+ id: string;
673
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
674
+ harness_id?: string;
675
+ };
676
+ /** The participant id receiving the work. */
677
+ to: string;
678
+ /** What the recipient needs to know. */
679
+ context_summary: string;
680
+ /** What is still undone. */
681
+ open_items?: string[];
682
+ /** Why the work is moving. */
683
+ reason?: string;
684
+ }
685
+
686
+ /** `task` — Route work to another harness. From a lead this becomes a lane: one object, two views, never a copy. */
687
+ export interface Task {
688
+ /** Protocol major version. */
689
+ v: 1;
690
+ type: "task";
691
+ /** The event's own id. Stable across a retry of the same event. */
692
+ id: string;
693
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
694
+ ts: string;
695
+ /** A workspace identifier: `ws_` followed by a ULID. */
696
+ workspace_id: string;
697
+ /** The space, when the event belongs to one. */
698
+ space_id?: string;
699
+ /** The run, when the event belongs to one. */
700
+ run_id?: string;
701
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
702
+ seq?: number;
703
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
704
+ idempotency_key?: string;
705
+ /** The participant an event is attributed to. */
706
+ actor: {
707
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
708
+ kind: "person" | "harness" | "agent" | "system";
709
+ /** The participant id, or `system` for Chips. */
710
+ id: string;
711
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
712
+ harness_id?: string;
713
+ };
714
+ /** The lane this task opens. */
715
+ task_id: string;
716
+ /** The specialist's participant id; a label for an ephemeral child; or the lead's own id, for a lane between two of its spaces — a specialist of its own in another of its rooms, a subagent in a worktree — which `home` then names. */
717
+ to: string;
718
+ /** Names an ephemeral child, which inherits owner, autonomy and budget from the lead. */
719
+ child?: {
720
+ /** A name for a transient participant Chips will mint. */
721
+ label: string;
722
+ };
723
+ /** The person the work is ultimately for: the lead's own owner, or a person in the space the task is sent from. A task on behalf of anyone else is kept in the lead's run. */
724
+ on_behalf_of: string;
725
+ /** The message that caused this routing. */
726
+ origin?: string;
727
+ /** What the specialist is being asked to do. */
728
+ goal: string;
729
+ /** Bounds on how to do it. */
730
+ constraints?: string[];
731
+ /** When it is needed by. */
732
+ deadline?: string;
733
+ /** The level for this lane. Never above the lead's own. */
734
+ autonomy?: 0 | 1 | 2 | 3;
735
+ /** Anything the specialist needs. */
736
+ attachments?: {
737
+ /** A attachment identifier: `att_` followed by a ULID. */
738
+ attachment_id: string;
739
+ /** The name to show. Never trusted for its type. */
740
+ filename: string;
741
+ /** Sniffed from the bytes on upload, not taken from the client. */
742
+ mime_type: string;
743
+ /** Size in bytes. */
744
+ byte_size: number;
745
+ /** Lowercase hex digest. The store is content-addressed. */
746
+ sha256: string;
747
+ /** Pixels, for images and video. */
748
+ width?: number;
749
+ /** Pixels, for images and video. */
750
+ height?: number;
751
+ /** Milliseconds, for audio and video. */
752
+ duration_ms?: number;
753
+ /** What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out. */
754
+ transcript?: string;
755
+ /** The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced. */
756
+ replaces?: string;
757
+ }[];
758
+ /** A lead space to link the lane into, besides the one the task is sent from: where the route card appears and the lane's news lands. It must be a space the lead is in; one it is not in is ignored. */
759
+ link_to?: string;
760
+ /** Where the lane lives, when the lead already has the room: one of its own spaces, for a lane between two spaces of one harness. The lead and the specialist must both be in it. Absent, the specialist's direct space with the person, opened if it has none. */
761
+ home?: string;
762
+ /** What to call the specialist on this lane when its participant name is not the right one: a Space's name, a subagent's type. Shown on the route card and the task card. */
763
+ label?: string;
764
+ }
765
+
766
+ /** `usage` — Tokens and cost for a step, a run or a lane. Cost rolls up the trail and is always an estimate. */
767
+ export interface Usage {
768
+ /** Protocol major version. */
769
+ v: 1;
770
+ type: "usage";
771
+ /** The event's own id. Stable across a retry of the same event. */
772
+ id: string;
773
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
774
+ ts: string;
775
+ /** A workspace identifier: `ws_` followed by a ULID. */
776
+ workspace_id: string;
777
+ /** The space, when the event belongs to one. */
778
+ space_id?: string;
779
+ /** The run, when the event belongs to one. */
780
+ run_id?: string;
781
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
782
+ seq?: number;
783
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
784
+ idempotency_key?: string;
785
+ /** The participant an event is attributed to. */
786
+ actor: {
787
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
788
+ kind: "person" | "harness" | "agent" | "system";
789
+ /** The participant id, or `system` for Chips. */
790
+ id: string;
791
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
792
+ harness_id?: string;
793
+ };
794
+ /** What the numbers cover. */
795
+ scope: "step" | "run" | "lane";
796
+ /** The model that did the work. */
797
+ model: string;
798
+ /** Tokens in: every token the model read, fresh, read from its prompt cache and written to it. Leave it out when the harness cannot say: the tokens out are still counted, and Chips puts no price on a report it cannot count whole. */
799
+ input_tokens?: number;
800
+ /** Of the tokens in, how many the model read from its prompt cache. Leave it out when the harness cannot say or the model keeps no cache. */
801
+ cache_read_tokens?: number;
802
+ /** Of the tokens in, how many the model wrote to its prompt cache. Leave it out when the harness cannot say or the model keeps no cache. */
803
+ cache_write_tokens?: number;
804
+ /** Tokens out. Leave it out when the harness cannot say, and send the cost: Chips prices only a report whose tokens it has whole. */
805
+ output_tokens?: number;
806
+ /** The estimated cost, when the harness can compute one. */
807
+ cost?: {
808
+ /** An estimate, in US dollars. */
809
+ usd: number;
810
+ /** Always true. Cost is never presented as exact. */
811
+ estimated: true;
812
+ };
813
+ }
814
+
815
+ /** `context.usage` — How full the harness's context is. Drives the context ring; context stays per harness, never rolled up. */
816
+ export interface ContextUsage {
817
+ /** Protocol major version. */
818
+ v: 1;
819
+ type: "context.usage";
820
+ /** The event's own id. Stable across a retry of the same event. */
821
+ id: string;
822
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
823
+ ts: string;
824
+ /** A workspace identifier: `ws_` followed by a ULID. */
825
+ workspace_id: string;
826
+ /** The space, when the event belongs to one. */
827
+ space_id?: string;
828
+ /** The run, when the event belongs to one. */
829
+ run_id?: string;
830
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
831
+ seq?: number;
832
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
833
+ idempotency_key?: string;
834
+ /** The participant an event is attributed to. */
835
+ actor: {
836
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
837
+ kind: "person" | "harness" | "agent" | "system";
838
+ /** The participant id, or `system` for Chips. */
839
+ id: string;
840
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
841
+ harness_id?: string;
842
+ };
843
+ /** Tokens currently held. */
844
+ used_tokens: number;
845
+ /** The window size. */
846
+ limit_tokens: number;
847
+ /** The model whose window this is. */
848
+ model: string;
849
+ /** True when the harness just compacted. */
850
+ compacted?: boolean;
851
+ }
852
+
853
+ /** `approval.executed` — What happened after a yes. The card changes from `approved` to `sent`, or to `failed`. */
854
+ export interface ApprovalExecuted {
855
+ /** Protocol major version. */
856
+ v: 1;
857
+ type: "approval.executed";
858
+ /** The event's own id. Stable across a retry of the same event. */
859
+ id: string;
860
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
861
+ ts: string;
862
+ /** A workspace identifier: `ws_` followed by a ULID. */
863
+ workspace_id: string;
864
+ /** The space, when the event belongs to one. */
865
+ space_id?: string;
866
+ /** The run, when the event belongs to one. */
867
+ run_id?: string;
868
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
869
+ seq?: number;
870
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
871
+ idempotency_key?: string;
872
+ /** The participant an event is attributed to. */
873
+ actor: {
874
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
875
+ kind: "person" | "harness" | "agent" | "system";
876
+ /** The participant id, or `system` for Chips. */
877
+ id: string;
878
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
879
+ harness_id?: string;
880
+ };
881
+ /** A approval identifier: `apr_` followed by a ULID. */
882
+ approval_id: string;
883
+ /** Whether the action actually happened. */
884
+ outcome: "executed" | "failed" | "skipped";
885
+ /** What was sent, or why it failed. */
886
+ detail?: string;
887
+ /** Who could answer it, as ids, as they stood when it was decided. Written by Chips from the approval so that somebody named outside the room sees what came of their decision (ADR 0042); a value the sender writes is replaced. */
888
+ approvers?: string[];
889
+ }
890
+
891
+ /** `run.completed` — The run is done. Posts a summary card and moves the status pill to Done. */
892
+ export interface RunCompleted {
893
+ /** Protocol major version. */
894
+ v: 1;
895
+ type: "run.completed";
896
+ /** The event's own id. Stable across a retry of the same event. */
897
+ id: string;
898
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
899
+ ts: string;
900
+ /** A workspace identifier: `ws_` followed by a ULID. */
901
+ workspace_id: string;
902
+ /** The space, when the event belongs to one. */
903
+ space_id?: string;
904
+ /** The run, when the event belongs to one. */
905
+ run_id?: string;
906
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
907
+ seq?: number;
908
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
909
+ idempotency_key?: string;
910
+ /** The participant an event is attributed to. */
911
+ actor: {
912
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
913
+ kind: "person" | "harness" | "agent" | "system";
914
+ /** The participant id, or `system` for Chips. */
915
+ id: string;
916
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
917
+ harness_id?: string;
918
+ };
919
+ /** The outcome, in the product voice. */
920
+ summary: string;
921
+ /** What changed in the world. */
922
+ changed?: string[];
923
+ /** What is worth doing next. */
924
+ follow_ups?: string[];
925
+ /** The run's estimated cost. */
926
+ cost?: {
927
+ /** An estimate, in US dollars. */
928
+ usd: number;
929
+ /** Always true. Cost is never presented as exact. */
930
+ estimated: true;
931
+ };
932
+ }
933
+
934
+ /** `run.failed` — The run stopped without finishing. Says what was left undone, so a person can pick it up. */
935
+ export interface RunFailed {
936
+ /** Protocol major version. */
937
+ v: 1;
938
+ type: "run.failed";
939
+ /** The event's own id. Stable across a retry of the same event. */
940
+ id: string;
941
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
942
+ ts: string;
943
+ /** A workspace identifier: `ws_` followed by a ULID. */
944
+ workspace_id: string;
945
+ /** The space, when the event belongs to one. */
946
+ space_id?: string;
947
+ /** The run, when the event belongs to one. */
948
+ run_id?: string;
949
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
950
+ seq?: number;
951
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
952
+ idempotency_key?: string;
953
+ /** The participant an event is attributed to. */
954
+ actor: {
955
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
956
+ kind: "person" | "harness" | "agent" | "system";
957
+ /** The participant id, or `system` for Chips. */
958
+ id: string;
959
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
960
+ harness_id?: string;
961
+ };
962
+ /** What went wrong. */
963
+ error: string;
964
+ /** What did not get done. */
965
+ left_undone?: string[];
966
+ /** Whether running it again might work. */
967
+ retryable?: boolean;
968
+ /** What was spent before it failed. */
969
+ cost?: {
970
+ /** An estimate, in US dollars. */
971
+ usd: number;
972
+ /** Always true. Cost is never presented as exact. */
973
+ estimated: true;
974
+ };
975
+ }
976
+
977
+ /** `hello` — The server's half of the handshake: the protocol range it speaks, and who this connection is. */
978
+ export interface Hello {
979
+ /** Protocol major version. */
980
+ v: 1;
981
+ type: "hello";
982
+ /** The event's own id. Stable across a retry of the same event. */
983
+ id: string;
984
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
985
+ ts: string;
986
+ /** A workspace identifier: `ws_` followed by a ULID. */
987
+ workspace_id: string;
988
+ /** The space, when the event belongs to one. */
989
+ space_id?: string;
990
+ /** The run, when the event belongs to one. */
991
+ run_id?: string;
992
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
993
+ seq?: number;
994
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
995
+ idempotency_key?: string;
996
+ /** The participant an event is attributed to. */
997
+ actor: {
998
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
999
+ kind: "person" | "harness" | "agent" | "system";
1000
+ /** The participant id, or `system` for Chips. */
1001
+ id: string;
1002
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
1003
+ harness_id?: string;
1004
+ };
1005
+ /** The negotiated range. A client picks a version inside it or is refused. */
1006
+ protocol: {
1007
+ /** Oldest major version the server accepts. */
1008
+ min: number;
1009
+ /** Newest major version the server speaks. */
1010
+ max: number;
1011
+ };
1012
+ /** Who the client is talking to. */
1013
+ server: {
1014
+ /** Usually `chipsd`. */
1015
+ name: string;
1016
+ /** The server's own version. */
1017
+ version: string;
1018
+ };
1019
+ /** The harness the token belongs to, and only that one. One connection speaks for all of the harness's agents (ADR 0087), which `agents` lists. A harness running inside another is a lane, not a duplicate. */
1020
+ harnesses: {
1021
+ /** A harness identifier: `hrn_` followed by a ULID. */
1022
+ harness_id: string;
1023
+ /** The harness's name in the workspace. */
1024
+ display_name: string;
1025
+ /** The person accountable for this harness. */
1026
+ owner_id: string;
1027
+ /** What the harness can do. */
1028
+ capabilities?: string[];
1029
+ /** True for a transient child minted for one lane, which inherits its lead's settings. */
1030
+ ephemeral?: boolean;
1031
+ }[];
1032
+ /** The harness this connection is: `harnesses[0]`, said once. Read this rather than the list. */
1033
+ harness?: {
1034
+ /** A harness identifier: `hrn_` followed by a ULID. */
1035
+ harness_id: string;
1036
+ /** The harness's name in the workspace. */
1037
+ display_name: string;
1038
+ /** The person accountable for this harness. */
1039
+ owner_id: string;
1040
+ /** What the harness can do. */
1041
+ capabilities?: string[];
1042
+ /** True for a transient child minted for one lane, which inherits its lead's settings. */
1043
+ ephemeral?: boolean;
1044
+ };
1045
+ /** The harness's agents, each with its rooms (ADR 0087). Everything the connection sends names one of them as `actor`; a harness's own id is read as its one agent in the room. Sent only to a harness that declares `agents`. */
1046
+ agents?: {
1047
+ /** A agent identifier: `agt_` followed by a ULID. */
1048
+ agent_id: string;
1049
+ /** The harness's own name for it. */
1050
+ key: string;
1051
+ /** What it is called, and so its @handle. */
1052
+ name: string;
1053
+ /** Whether it is the harness's Main agent. */
1054
+ lead: boolean;
1055
+ /** Archived when its thing was put away. */
1056
+ state: "active" | "archived";
1057
+ /** The rooms it is in. One at most, once one room per agent is the rule. */
1058
+ spaces: string[];
1059
+ /** The open room it is in (ADR 0087: one at a time), or `null` while it is free. What it says while free is held. */
1060
+ room?: string | null;
1061
+ /** How many of its words Chips is holding, said while it was in no room. */
1062
+ held?: number;
1063
+ }[];
1064
+ /** The level in force for this connection. */
1065
+ autonomy: 0 | 1 | 2 | 3;
1066
+ /** The rules that fill in the details. */
1067
+ policy?: {
1068
+ /** 0 observe, 1 ask first, 2 ask when it matters, 3 autonomous and report back. Presets that expand to rules. */
1069
+ autonomy: 0 | 1 | 2 | 3;
1070
+ /** Evaluated in order; the workspace cap always wins. */
1071
+ rules: {
1072
+ /** A glob over action kinds, for example `payment.*`. */
1073
+ match: string;
1074
+ /** Extra conditions on the action's flags, and for a command, how its parts start. */
1075
+ when?: {
1076
+ external?: boolean;
1077
+ irreversible?: boolean;
1078
+ money_usd_over?: number;
1079
+ risk?: "external" | "external_communication" | "irreversible" | "destructive" | "financial" | "credential" | "privacy" | "legal"[];
1080
+ /** For an action that carries a command (ADR 0239): the words a part of it starts with. A command goes ahead on such rules only when every part starts with one that allows it. */
1081
+ starts_with?: string[];
1082
+ };
1083
+ /** What to do when the rule matches. */
1084
+ decision: "allow" | "ask" | "deny";
1085
+ /** Who may answer, when the decision is `ask`. */
1086
+ approvers?: string[];
1087
+ /** Shown to the harness, and recorded in the audit log. */
1088
+ reason?: string;
1089
+ /** Turned off by a person (ADR 0195): kept in the list to turn back on, and skipped by the policy engine until then. */
1090
+ off?: boolean;
1091
+ /** Who made it by answering an ask with Always (ADR 0195). Filled in by Chips. */
1092
+ made_by?: string;
1093
+ /** When a person's answer made it (ADR 0195): Always, or This session. Filled in by Chips. A rule a person's answer made never allows an action that matters. */
1094
+ made_at?: string;
1095
+ }[];
1096
+ };
1097
+ /** The ceiling, and what has been spent. */
1098
+ budget?: {
1099
+ /** The ceiling for this harness. */
1100
+ limit_usd: number;
1101
+ /** Spent so far, estimated. */
1102
+ spent_usd: number;
1103
+ };
1104
+ /** The spaces this credential is a member of as it connects. A client that kept a cache drops what is not here: a membership it lost while away is the one event a replay can never bring it, because it is no longer in the space that event belongs to. */
1105
+ spaces?: string[];
1106
+ /** The workspace as it is called now. A device keeps the name it was told when it paired and takes this one when they differ, so a workspace renamed since is called by its new name without pairing again. Absent when the workspace has no name. */
1107
+ workspace?: {
1108
+ name: string;
1109
+ };
1110
+ }
1111
+
1112
+ /** `message.new` — Someone said something, with any attachments as signed URLs the harness can fetch. */
1113
+ export interface MessageNew {
1114
+ /** Protocol major version. */
1115
+ v: 1;
1116
+ type: "message.new";
1117
+ /** The event's own id. Stable across a retry of the same event. */
1118
+ id: string;
1119
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
1120
+ ts: string;
1121
+ /** A workspace identifier: `ws_` followed by a ULID. */
1122
+ workspace_id: string;
1123
+ /** The space, when the event belongs to one. */
1124
+ space_id?: string;
1125
+ /** The run, when the event belongs to one. */
1126
+ run_id?: string;
1127
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
1128
+ seq?: number;
1129
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
1130
+ idempotency_key?: string;
1131
+ /** The participant an event is attributed to. */
1132
+ actor: {
1133
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
1134
+ kind: "person" | "harness" | "agent" | "system";
1135
+ /** The participant id, or `system` for Chips. */
1136
+ id: string;
1137
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
1138
+ harness_id?: string;
1139
+ };
1140
+ /** A message identifier: `msg_` followed by a ULID. */
1141
+ message_id: string;
1142
+ /** Who sent it, and whether they are the owner, a member or a guest. */
1143
+ from: {
1144
+ /** The stable id of the sender. */
1145
+ participant_id: string;
1146
+ /** Whether the sender is a person or an agent (ADR 0087); `harness` for a harness written before agents, and for any agent as a harness that has not declared `agents` is told it. */
1147
+ kind: "person" | "harness" | "agent";
1148
+ /** The name to show. */
1149
+ display_name: string;
1150
+ /** The sender's standing in this space. Multi-user is Chips' job, not the harness's. */
1151
+ role: "owner" | "member" | "guest";
1152
+ /** A person's standing in the workspace (SEC-15): what a model should weigh the words by, since a guest's read as the owner's otherwise. `promptFor` says it after the name. Absent for an agent or a harness, and from a Chips before it said. */
1153
+ workspace_role?: "owner" | "admin" | "member" | "guest";
1154
+ };
1155
+ /** Markdown, with mentions resolved to participant ids. */
1156
+ text: string;
1157
+ /** URLs expire in ten minutes. */
1158
+ attachments?: {
1159
+ /** A attachment identifier: `att_` followed by a ULID. */
1160
+ attachment_id: string;
1161
+ /** The name to show. Never trusted for its type. */
1162
+ filename: string;
1163
+ /** Sniffed from the bytes on upload, not taken from the client. */
1164
+ mime_type: string;
1165
+ /** Size in bytes. */
1166
+ byte_size: number;
1167
+ /** Lowercase hex digest. The store is content-addressed. */
1168
+ sha256: string;
1169
+ /** Pixels, for images and video. */
1170
+ width?: number;
1171
+ /** Pixels, for images and video. */
1172
+ height?: number;
1173
+ /** Milliseconds, for audio and video. */
1174
+ duration_ms?: number;
1175
+ /** What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out. */
1176
+ transcript?: string;
1177
+ /** The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced. */
1178
+ replaces?: string;
1179
+ /** A signed URL, bound to the requesting token: fetch it with that token as the bearer, since the URL alone is refused. */
1180
+ url: string;
1181
+ /** Ten minutes from issue, by default (decision 10). */
1182
+ url_expires_at: string;
1183
+ }[];
1184
+ /** Participant ids mentioned in the text. */
1185
+ mentions?: string[];
1186
+ /** The message this answers. */
1187
+ reply_to?: string;
1188
+ /** The message `reply_to` names, as the room reads it now (ADR 0219): who said it, when, its words and its files, and with a turn, when it is older than `context`, the lines said just before it. Put it in the turn ahead of the words; the SDK's `promptFor` does. Absent on a message that answers none, or one no longer in the room. */
1189
+ replying_to?: {
1190
+ /** Where in the log it happened. */
1191
+ seq: number;
1192
+ /** When. */
1193
+ at: string;
1194
+ kind: "said";
1195
+ /** Who: the one who said it, came, went or took the new name; for the room's own lines, who retitled, archived or unarchived it. */
1196
+ from: {
1197
+ /** Their participant id, or `system`. */
1198
+ id: string;
1199
+ kind: "person" | "harness" | "agent" | "system";
1200
+ /** What they go by now. */
1201
+ name: string;
1202
+ /** Their standing in this room, when they are in it (SEC-15). */
1203
+ role?: "owner" | "member" | "guest";
1204
+ /** A person's standing in the workspace (SEC-15): the plain form says it after the name, so a guest's line reads as a guest's. Absent for an agent or a harness. */
1205
+ workspace_role?: "owner" | "admin" | "member" | "guest";
1206
+ };
1207
+ /** The message the reply answers: its `reply_to`. */
1208
+ message_id: string;
1209
+ /** On `said`: the words as they read now, so an edited message reads edited; a deleted one is not a line. Cut with an ellipsis when the one line is longer than the whole budget. */
1210
+ text?: string;
1211
+ /** On `said`: what a voice note said, as the server heard it (ADR 0054). */
1212
+ transcript?: string;
1213
+ /** On `said`: the names of the files it carried. */
1214
+ files?: string[];
1215
+ /** On `said`: the agents it was for (ADR 0081, ADR 0087), so a harness can leave out a line one of its agents already took a turn on. Absent on a message from before Chips said so. */
1216
+ addressed_to?: string[];
1217
+ /** On `said`: the guard held it (ADR 0081), so it was for nobody. */
1218
+ held?: true;
1219
+ /** On `renamed`, for a participant: the name they took. */
1220
+ name?: string;
1221
+ /** On `renamed`, for a participant: the name they went by until then. */
1222
+ previous?: string;
1223
+ /** On `renamed`, for the room: its new title. */
1224
+ title?: string;
1225
+ /** Its author changed its words since: `text` is how it reads now. */
1226
+ edited?: true;
1227
+ /** Taken back since it was answered: no words, no files, only who and when. */
1228
+ deleted?: true;
1229
+ /** Up to three lines said just before it, oldest first, so the turn has what it was about. Only with a turn, and only when the message is older than the lines `context` hands over. */
1230
+ before?: {
1231
+ /** Where in the log it happened. */
1232
+ seq: number;
1233
+ /** When. */
1234
+ at: string;
1235
+ /** `said`: a message, addressed to this harness or not. `joined` and `left`: somebody came into the room or went. `renamed`: somebody took a new name, or the room a new title. `archived` and `unarchived`: the room was put away or brought back. */
1236
+ kind: "said" | "joined" | "left" | "renamed" | "archived" | "unarchived";
1237
+ /** Who: the one who said it, came, went or took the new name; for the room's own lines, who retitled, archived or unarchived it. */
1238
+ from: {
1239
+ /** Their participant id, or `system`. */
1240
+ id: string;
1241
+ kind: "person" | "harness" | "agent" | "system";
1242
+ /** What they go by now. */
1243
+ name: string;
1244
+ /** Their standing in this room, when they are in it (SEC-15). */
1245
+ role?: "owner" | "member" | "guest";
1246
+ /** A person's standing in the workspace (SEC-15): the plain form says it after the name, so a guest's line reads as a guest's. Absent for an agent or a harness. */
1247
+ workspace_role?: "owner" | "admin" | "member" | "guest";
1248
+ };
1249
+ /** On `said`: the message. */
1250
+ message_id?: string;
1251
+ /** On `said`: the words as they read now, so an edited message reads edited; a deleted one is not a line. Cut with an ellipsis when the one line is longer than the whole budget. */
1252
+ text?: string;
1253
+ /** On `said`: what a voice note said, as the server heard it (ADR 0054). */
1254
+ transcript?: string;
1255
+ /** On `said`: the names of the files it carried. */
1256
+ files?: string[];
1257
+ /** On `said`: the agents it was for (ADR 0081, ADR 0087), so a harness can leave out a line one of its agents already took a turn on. Absent on a message from before Chips said so. */
1258
+ addressed_to?: string[];
1259
+ /** On `said`: the guard held it (ADR 0081), so it was for nobody. */
1260
+ held?: true;
1261
+ /** On `renamed`, for a participant: the name they took. */
1262
+ name?: string;
1263
+ /** On `renamed`, for a participant: the name they went by until then. */
1264
+ previous?: string;
1265
+ /** On `renamed`, for the room: its new title. */
1266
+ title?: string;
1267
+ }[];
1268
+ /** Its files, as the message's own are sent: URLs expire in ten minutes. */
1269
+ attachments?: {
1270
+ /** A attachment identifier: `att_` followed by a ULID. */
1271
+ attachment_id: string;
1272
+ /** The name to show. Never trusted for its type. */
1273
+ filename: string;
1274
+ /** Sniffed from the bytes on upload, not taken from the client. */
1275
+ mime_type: string;
1276
+ /** Size in bytes. */
1277
+ byte_size: number;
1278
+ /** Lowercase hex digest. The store is content-addressed. */
1279
+ sha256: string;
1280
+ /** Pixels, for images and video. */
1281
+ width?: number;
1282
+ /** Pixels, for images and video. */
1283
+ height?: number;
1284
+ /** Milliseconds, for audio and video. */
1285
+ duration_ms?: number;
1286
+ /** What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out. */
1287
+ transcript?: string;
1288
+ /** The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced. */
1289
+ replaces?: string;
1290
+ /** A signed URL, bound to the requesting token: fetch it with that token as the bearer, since the URL alone is refused. */
1291
+ url: string;
1292
+ /** Ten minutes from issue, by default (decision 10). */
1293
+ url_expires_at: string;
1294
+ }[];
1295
+ };
1296
+ /** The visit the sender meant, when they named one (ADR 0040). A harness that works by visits delivers to it rather than choosing, and says so rather than delivering elsewhere when it cannot. */
1297
+ session_ref?: string;
1298
+ /** The agents the message is for, as Chips decided them (ADR 0081, ADR 0087). Absent on a message from before Chips said so, which was for every agent in the space. */
1299
+ addressed_to?: string[];
1300
+ /** Who of this connection takes a turn: its own among `addressed_to` (ADR 0087). Each is one of its agents, or the harness's own id where the harness itself is the member addressed: a room asked of it from the +, until it claims the room. Never empty on a `message.new`, and always empty on a `message.overheard`. Sent only to a harness that declares `agents`; one that has not is told its agents are itself. */
1301
+ for?: string[];
1302
+ /** This connection's agents with a turn going in the room, other than the one who said it and those it is for (ADR 0106). Hand the words to each of those turns at its next step, as said to somebody else, and start no turn on them; post `message.heard` on the run once a turn has them, and the room shows it heard. A turn that ends first hears nothing, and is handed the words with its agent's next turn (ADR 0105). Absent when there are none. */
1303
+ working_turns?: {
1304
+ /** One of this connection's agents. */
1305
+ agent_id: string;
1306
+ /** Its turn going in the room. */
1307
+ run_id: string;
1308
+ }[];
1309
+ /** What was said in the room since this harness last spoke there, or since it joined when it has not, up to this message and without it (ADR 0088). From when the turn that said its last words began, so what was said while it worked is here, and its own words are not (ADR 0105). Worked out from the log, so a replay hands over the same lines. As many as the budget the harness gave in its `hello`: 40 lines and 16,000 characters when it gave none, and none when it asked for 0. When older lines were left out, the taker's room note says so. */
1310
+ context?: {
1311
+ /** Oldest first, the newest that fit the budget. */
1312
+ lines: {
1313
+ /** Where in the log it happened. */
1314
+ seq: number;
1315
+ /** When. */
1316
+ at: string;
1317
+ /** `said`: a message, addressed to this harness or not. `joined` and `left`: somebody came into the room or went. `renamed`: somebody took a new name, or the room a new title. `archived` and `unarchived`: the room was put away or brought back. */
1318
+ kind: "said" | "joined" | "left" | "renamed" | "archived" | "unarchived";
1319
+ /** Who: the one who said it, came, went or took the new name; for the room's own lines, who retitled, archived or unarchived it. */
1320
+ from: {
1321
+ /** Their participant id, or `system`. */
1322
+ id: string;
1323
+ kind: "person" | "harness" | "agent" | "system";
1324
+ /** What they go by now. */
1325
+ name: string;
1326
+ /** Their standing in this room, when they are in it (SEC-15). */
1327
+ role?: "owner" | "member" | "guest";
1328
+ /** A person's standing in the workspace (SEC-15): the plain form says it after the name, so a guest's line reads as a guest's. Absent for an agent or a harness. */
1329
+ workspace_role?: "owner" | "admin" | "member" | "guest";
1330
+ };
1331
+ /** On `said`: the message. */
1332
+ message_id?: string;
1333
+ /** On `said`: the words as they read now, so an edited message reads edited; a deleted one is not a line. Cut with an ellipsis when the one line is longer than the whole budget. */
1334
+ text?: string;
1335
+ /** On `said`: what a voice note said, as the server heard it (ADR 0054). */
1336
+ transcript?: string;
1337
+ /** On `said`: the names of the files it carried. */
1338
+ files?: string[];
1339
+ /** On `said`: the agents it was for (ADR 0081, ADR 0087), so a harness can leave out a line one of its agents already took a turn on. Absent on a message from before Chips said so. */
1340
+ addressed_to?: string[];
1341
+ /** On `said`: the guard held it (ADR 0081), so it was for nobody. */
1342
+ held?: true;
1343
+ /** On `renamed`, for a participant: the name they took. */
1344
+ name?: string;
1345
+ /** On `renamed`, for a participant: the name they went by until then. */
1346
+ previous?: string;
1347
+ /** On `renamed`, for the room: its new title. */
1348
+ title?: string;
1349
+ }[];
1350
+ /** Where they start: after this `seq`. With a message, where the turn that said the harness's own last message in the room began (ADR 0105), else its joining; from the pull route, 0. */
1351
+ since_seq: number;
1352
+ /** Whether older lines after `since_seq` were left out to fit the budget. */
1353
+ truncated: boolean;
1354
+ /** A cursor: `GET /v1/spaces/:id/context?before=` this reads what came before these lines. */
1355
+ before: number;
1356
+ /** The room's files at their current version, newest first, the 20 newest (ADR 0099): with a message, as of it, its own files included; from the pull route, as of now. Each with a URL for this harness. Absent from a Chips before files, and when the room has none. */
1357
+ files?: {
1358
+ /** The file's name, which its versions share. */
1359
+ name: string;
1360
+ /** Which version this is: 1 for the first, counting each change of its bytes. */
1361
+ version: number;
1362
+ /** The attachment that is this version: what a post names in `replaces` when it changes it. */
1363
+ attachment_id: string;
1364
+ /** Lowercase hex digest of this version's bytes. */
1365
+ sha256: string;
1366
+ /** Size in bytes. */
1367
+ byte_size: number;
1368
+ /** Sniffed from the bytes on upload. */
1369
+ mime_type: string;
1370
+ /** Who posted this version, as a line's `from` says it. */
1371
+ by: {
1372
+ /** Their participant id. */
1373
+ id: string;
1374
+ kind: "person" | "harness" | "agent" | "system";
1375
+ /** What they go by now. */
1376
+ name: string;
1377
+ };
1378
+ /** When this version was posted. */
1379
+ at: string;
1380
+ /** The message that posted this version. */
1381
+ message_id?: string;
1382
+ /** Pixels, for a photo or a video. */
1383
+ width?: number;
1384
+ /** Pixels, for a photo or a video. */
1385
+ height?: number;
1386
+ /** Milliseconds, for a sound or a video. */
1387
+ duration_ms?: number;
1388
+ /** In one name's versions (`?name=`): the version this one was made from, as its post said (`message.post.replaces`). Absent where the post said nothing, or named no version of this file. */
1389
+ replaces?: string;
1390
+ /** For a harness: a signed URL for this version, bound to its token, as a message's attachments are. Absent for a person, who fetches it by id. */
1391
+ url?: string;
1392
+ /** When `url` stops working. */
1393
+ url_expires_at?: string;
1394
+ }[];
1395
+ /** What the room's job has spent, as of the message (for one Chips held, as of its hand-over, when a new job began), against what the room allows a job (ADR 0117). With a message only; the room note says it in words. Absent from a Chips before it. */
1396
+ spend?: {
1397
+ /** What the room allows a job, in US dollars: its own ceiling, or the default (3) when nobody has set one. */
1398
+ ceiling_usd: number;
1399
+ /** What the room's runs reported costing since the job began, in US dollars, every harness's together. */
1400
+ spent_usd: number;
1401
+ /** Where the job began: the `seq` of the last thing a person did in the room, or of the last brief handed into it, whichever is later; 0 when neither has happened. */
1402
+ since_seq: number;
1403
+ /** How many of the job's runs reported no cost, and so count nothing. */
1404
+ uncounted_runs: number;
1405
+ };
1406
+ };
1407
+ /** Who is in the room, with the handle that reaches each, and a note for each who takes the turn saying so and what an @ does (ADR 0092). A harness puts `notes[<taker>]` at the top of that turn. Absent on a message in no room. */
1408
+ room?: {
1409
+ /** The room's people, then its agents, each by name, anybody removed left out. */
1410
+ members: {
1411
+ participant_id: string;
1412
+ /** 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. */
1413
+ kind: "person" | "agent" | "harness";
1414
+ name: string;
1415
+ /** 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. */
1416
+ harness?: string;
1417
+ /** 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. */
1418
+ handle?: string;
1419
+ /** 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. */
1420
+ lead?: true;
1421
+ /** 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. */
1422
+ time_zone?: string;
1423
+ }[];
1424
+ /** 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. */
1425
+ notes: {
1426
+ };
1427
+ /** 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. */
1428
+ rules?: {
1429
+ };
1430
+ /** 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. */
1431
+ working?: {
1432
+ participant_id: string;
1433
+ /** How long its turn has been going, in whole minutes. */
1434
+ minutes: number;
1435
+ /** The last step its turn said it was on, when its harness says its steps. */
1436
+ step?: string;
1437
+ }[];
1438
+ /** The room's other agents that have had a turn here: how long since the last one ended (ADR 0104). */
1439
+ idle?: {
1440
+ participant_id: string;
1441
+ /** How long since its last turn here ended, in whole minutes. */
1442
+ minutes: number;
1443
+ }[];
1444
+ };
1445
+ /** How the agents' talk in the room stands, once it is worth a word (ADR 0097): from eight messages between agents since a person last acted or an agent last made something new. A harness puts `note` at the top of the turn, as Chips's, ahead of the room's note. Absent below that, and worked out from the log, so a replay hands over the same facts. */
1446
+ exchange?: {
1447
+ /** Messages agents have sent agents in the room since the reset, this one included. */
1448
+ count: number;
1449
+ /** The last reset of the count. */
1450
+ since: {
1451
+ /** `person`: somebody did something in the room. `work`: an agent made something new — a file new to the room, a question to a person, an approval request. `start`: nothing since the room began. */
1452
+ kind: "person" | "work" | "start";
1453
+ /** Where the count starts from, after this. */
1454
+ seq: number;
1455
+ /** When. Absent at the start. */
1456
+ at?: string;
1457
+ /** Who: the person, or the agent that made it. */
1458
+ by?: string;
1459
+ /** For `work`: what the agent made. */
1460
+ made?: "file" | "question" | "approval";
1461
+ /** For a file: its name. */
1462
+ file?: string;
1463
+ };
1464
+ /** Since the reset. */
1465
+ minutes: number;
1466
+ /** Whether somebody has the room open: a person not behind it by a message older than a minute. `null` when Chips cannot say. */
1467
+ person_looking: unknown;
1468
+ /** Who to tell what is done and what is blocked: the person who last acted here. */
1469
+ person?: string;
1470
+ /** Which of the messages repeat, newest last. */
1471
+ repeats: {
1472
+ message_id: string;
1473
+ by: string;
1474
+ /** `file`: it carried a file already in the room. `words`: its words are much the same as words its sender already sent since the reset. */
1475
+ kind: "file" | "words";
1476
+ file?: string;
1477
+ }[];
1478
+ /** The same two or three agents taking turns with nothing new: two rounds with a repeat among them. */
1479
+ circling: boolean;
1480
+ /** Who else this message is for, besides whoever it is delivered to. */
1481
+ also_for: string[];
1482
+ /** `quiet` under the nudge; `nudge` from it (half the workspace's stop, or 8); `warning` on a circle or from the stop; `held` at the hold or while a person has paused the agents. The stop, the hold and whether circles count are the workspace's (ADR 0187): 16, 48 and yes unless an owner or an admin changed them. */
1483
+ stage: "quiet" | "nudge" | "warning" | "held";
1484
+ /** After how many messages between agents Chips holds them: the workspace's hold (ADR 0187). Absent when it holds them only on a pause. */
1485
+ allowance?: number;
1486
+ /** A person paused the agents, or Chips did at the room's spend ceiling (ADR 0118), and nobody has acted since. */
1487
+ paused: boolean;
1488
+ /** The facts in plain words, for the top of the turn. */
1489
+ note: string;
1490
+ };
1491
+ /** Chips held this message when it was said and hands it over now a person has acted (ADR 0097): the newest of an agent's held messages, once; or, with `lead`, hands it to the room's lead. Its seq and id are the hand-over's, its `message_id` the message's own. */
1492
+ handed?: true;
1493
+ /** Handed to the agent taking the turn as the room's lead (ADR 0104): the message was nobody's turn, and the room went still. Its note says so at the top, and `handed` is set too. */
1494
+ lead?: true;
1495
+ }
1496
+
1497
+ /** `message.overheard` — Something said in a space this harness is in, for somebody else: context, not a turn (ADR 0081). A harness with a turn going in the space hands it to that turn at its next step (ADR 0105). */
1498
+ export interface MessageOverheard {
1499
+ /** Protocol major version. */
1500
+ v: 1;
1501
+ type: "message.overheard";
1502
+ /** The event's own id. Stable across a retry of the same event. */
1503
+ id: string;
1504
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
1505
+ ts: string;
1506
+ /** A workspace identifier: `ws_` followed by a ULID. */
1507
+ workspace_id: string;
1508
+ /** The space, when the event belongs to one. */
1509
+ space_id?: string;
1510
+ /** The run, when the event belongs to one. */
1511
+ run_id?: string;
1512
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
1513
+ seq?: number;
1514
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
1515
+ idempotency_key?: string;
1516
+ /** The participant an event is attributed to. */
1517
+ actor: {
1518
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
1519
+ kind: "person" | "harness" | "agent" | "system";
1520
+ /** The participant id, or `system` for Chips. */
1521
+ id: string;
1522
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
1523
+ harness_id?: string;
1524
+ };
1525
+ /** A message identifier: `msg_` followed by a ULID. */
1526
+ message_id: string;
1527
+ /** Who sent it, and whether they are the owner, a member or a guest. */
1528
+ from: {
1529
+ /** The stable id of the sender. */
1530
+ participant_id: string;
1531
+ /** Whether the sender is a person or an agent (ADR 0087); `harness` for a harness written before agents, and for any agent as a harness that has not declared `agents` is told it. */
1532
+ kind: "person" | "harness" | "agent";
1533
+ /** The name to show. */
1534
+ display_name: string;
1535
+ /** The sender's standing in this space. Multi-user is Chips' job, not the harness's. */
1536
+ role: "owner" | "member" | "guest";
1537
+ /** A person's standing in the workspace (SEC-15): what a model should weigh the words by, since a guest's read as the owner's otherwise. `promptFor` says it after the name. Absent for an agent or a harness, and from a Chips before it said. */
1538
+ workspace_role?: "owner" | "admin" | "member" | "guest";
1539
+ };
1540
+ /** Markdown, with mentions resolved to participant ids. */
1541
+ text: string;
1542
+ /** URLs expire in ten minutes. */
1543
+ attachments?: {
1544
+ /** A attachment identifier: `att_` followed by a ULID. */
1545
+ attachment_id: string;
1546
+ /** The name to show. Never trusted for its type. */
1547
+ filename: string;
1548
+ /** Sniffed from the bytes on upload, not taken from the client. */
1549
+ mime_type: string;
1550
+ /** Size in bytes. */
1551
+ byte_size: number;
1552
+ /** Lowercase hex digest. The store is content-addressed. */
1553
+ sha256: string;
1554
+ /** Pixels, for images and video. */
1555
+ width?: number;
1556
+ /** Pixels, for images and video. */
1557
+ height?: number;
1558
+ /** Milliseconds, for audio and video. */
1559
+ duration_ms?: number;
1560
+ /** What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out. */
1561
+ transcript?: string;
1562
+ /** The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced. */
1563
+ replaces?: string;
1564
+ /** A signed URL, bound to the requesting token: fetch it with that token as the bearer, since the URL alone is refused. */
1565
+ url: string;
1566
+ /** Ten minutes from issue, by default (decision 10). */
1567
+ url_expires_at: string;
1568
+ }[];
1569
+ /** Participant ids mentioned in the text. */
1570
+ mentions?: string[];
1571
+ /** The message this answers. */
1572
+ reply_to?: string;
1573
+ /** The message `reply_to` names, as the room reads it now (ADR 0219): who said it, when, its words and its files, and with a turn, when it is older than `context`, the lines said just before it. Put it in the turn ahead of the words; the SDK's `promptFor` does. Absent on a message that answers none, or one no longer in the room. */
1574
+ replying_to?: {
1575
+ /** Where in the log it happened. */
1576
+ seq: number;
1577
+ /** When. */
1578
+ at: string;
1579
+ kind: "said";
1580
+ /** Who: the one who said it, came, went or took the new name; for the room's own lines, who retitled, archived or unarchived it. */
1581
+ from: {
1582
+ /** Their participant id, or `system`. */
1583
+ id: string;
1584
+ kind: "person" | "harness" | "agent" | "system";
1585
+ /** What they go by now. */
1586
+ name: string;
1587
+ /** Their standing in this room, when they are in it (SEC-15). */
1588
+ role?: "owner" | "member" | "guest";
1589
+ /** A person's standing in the workspace (SEC-15): the plain form says it after the name, so a guest's line reads as a guest's. Absent for an agent or a harness. */
1590
+ workspace_role?: "owner" | "admin" | "member" | "guest";
1591
+ };
1592
+ /** The message the reply answers: its `reply_to`. */
1593
+ message_id: string;
1594
+ /** On `said`: the words as they read now, so an edited message reads edited; a deleted one is not a line. Cut with an ellipsis when the one line is longer than the whole budget. */
1595
+ text?: string;
1596
+ /** On `said`: what a voice note said, as the server heard it (ADR 0054). */
1597
+ transcript?: string;
1598
+ /** On `said`: the names of the files it carried. */
1599
+ files?: string[];
1600
+ /** On `said`: the agents it was for (ADR 0081, ADR 0087), so a harness can leave out a line one of its agents already took a turn on. Absent on a message from before Chips said so. */
1601
+ addressed_to?: string[];
1602
+ /** On `said`: the guard held it (ADR 0081), so it was for nobody. */
1603
+ held?: true;
1604
+ /** On `renamed`, for a participant: the name they took. */
1605
+ name?: string;
1606
+ /** On `renamed`, for a participant: the name they went by until then. */
1607
+ previous?: string;
1608
+ /** On `renamed`, for the room: its new title. */
1609
+ title?: string;
1610
+ /** Its author changed its words since: `text` is how it reads now. */
1611
+ edited?: true;
1612
+ /** Taken back since it was answered: no words, no files, only who and when. */
1613
+ deleted?: true;
1614
+ /** Up to three lines said just before it, oldest first, so the turn has what it was about. Only with a turn, and only when the message is older than the lines `context` hands over. */
1615
+ before?: {
1616
+ /** Where in the log it happened. */
1617
+ seq: number;
1618
+ /** When. */
1619
+ at: string;
1620
+ /** `said`: a message, addressed to this harness or not. `joined` and `left`: somebody came into the room or went. `renamed`: somebody took a new name, or the room a new title. `archived` and `unarchived`: the room was put away or brought back. */
1621
+ kind: "said" | "joined" | "left" | "renamed" | "archived" | "unarchived";
1622
+ /** Who: the one who said it, came, went or took the new name; for the room's own lines, who retitled, archived or unarchived it. */
1623
+ from: {
1624
+ /** Their participant id, or `system`. */
1625
+ id: string;
1626
+ kind: "person" | "harness" | "agent" | "system";
1627
+ /** What they go by now. */
1628
+ name: string;
1629
+ /** Their standing in this room, when they are in it (SEC-15). */
1630
+ role?: "owner" | "member" | "guest";
1631
+ /** A person's standing in the workspace (SEC-15): the plain form says it after the name, so a guest's line reads as a guest's. Absent for an agent or a harness. */
1632
+ workspace_role?: "owner" | "admin" | "member" | "guest";
1633
+ };
1634
+ /** On `said`: the message. */
1635
+ message_id?: string;
1636
+ /** On `said`: the words as they read now, so an edited message reads edited; a deleted one is not a line. Cut with an ellipsis when the one line is longer than the whole budget. */
1637
+ text?: string;
1638
+ /** On `said`: what a voice note said, as the server heard it (ADR 0054). */
1639
+ transcript?: string;
1640
+ /** On `said`: the names of the files it carried. */
1641
+ files?: string[];
1642
+ /** On `said`: the agents it was for (ADR 0081, ADR 0087), so a harness can leave out a line one of its agents already took a turn on. Absent on a message from before Chips said so. */
1643
+ addressed_to?: string[];
1644
+ /** On `said`: the guard held it (ADR 0081), so it was for nobody. */
1645
+ held?: true;
1646
+ /** On `renamed`, for a participant: the name they took. */
1647
+ name?: string;
1648
+ /** On `renamed`, for a participant: the name they went by until then. */
1649
+ previous?: string;
1650
+ /** On `renamed`, for the room: its new title. */
1651
+ title?: string;
1652
+ }[];
1653
+ /** Its files, as the message's own are sent: URLs expire in ten minutes. */
1654
+ attachments?: {
1655
+ /** A attachment identifier: `att_` followed by a ULID. */
1656
+ attachment_id: string;
1657
+ /** The name to show. Never trusted for its type. */
1658
+ filename: string;
1659
+ /** Sniffed from the bytes on upload, not taken from the client. */
1660
+ mime_type: string;
1661
+ /** Size in bytes. */
1662
+ byte_size: number;
1663
+ /** Lowercase hex digest. The store is content-addressed. */
1664
+ sha256: string;
1665
+ /** Pixels, for images and video. */
1666
+ width?: number;
1667
+ /** Pixels, for images and video. */
1668
+ height?: number;
1669
+ /** Milliseconds, for audio and video. */
1670
+ duration_ms?: number;
1671
+ /** What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out. */
1672
+ transcript?: string;
1673
+ /** The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced. */
1674
+ replaces?: string;
1675
+ /** A signed URL, bound to the requesting token: fetch it with that token as the bearer, since the URL alone is refused. */
1676
+ url: string;
1677
+ /** Ten minutes from issue, by default (decision 10). */
1678
+ url_expires_at: string;
1679
+ }[];
1680
+ };
1681
+ /** The visit the sender meant, when they named one (ADR 0040). A harness that works by visits delivers to it rather than choosing, and says so rather than delivering elsewhere when it cannot. */
1682
+ session_ref?: string;
1683
+ /** The agents the message is for, as Chips decided them (ADR 0081, ADR 0087). Absent on a message from before Chips said so, which was for every agent in the space. */
1684
+ addressed_to?: string[];
1685
+ /** Who of this connection takes a turn: its own among `addressed_to` (ADR 0087). Each is one of its agents, or the harness's own id where the harness itself is the member addressed: a room asked of it from the +, until it claims the room. Never empty on a `message.new`, and always empty on a `message.overheard`. Sent only to a harness that declares `agents`; one that has not is told its agents are itself. */
1686
+ for?: string[];
1687
+ /** This connection's agents with a turn going in the room, other than the one who said it and those it is for (ADR 0106). Hand the words to each of those turns at its next step, as said to somebody else, and start no turn on them; post `message.heard` on the run once a turn has them, and the room shows it heard. A turn that ends first hears nothing, and is handed the words with its agent's next turn (ADR 0105). Absent when there are none. */
1688
+ working_turns?: {
1689
+ /** One of this connection's agents. */
1690
+ agent_id: string;
1691
+ /** Its turn going in the room. */
1692
+ run_id: string;
1693
+ }[];
1694
+ /** The agents had sent each other more messages than Chips lets through without a person, or a person paused them, so Chips held this one from the agents it named (ADR 0097). The newest held message for each agent is handed over when a person acts. */
1695
+ held?: true;
1696
+ }
1697
+
1698
+ /** `run.requested` — A lane arrived from a lead, with the trail that led to it. */
1699
+ export interface RunRequested {
1700
+ /** Protocol major version. */
1701
+ v: 1;
1702
+ type: "run.requested";
1703
+ /** The event's own id. Stable across a retry of the same event. */
1704
+ id: string;
1705
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
1706
+ ts: string;
1707
+ /** A workspace identifier: `ws_` followed by a ULID. */
1708
+ workspace_id: string;
1709
+ /** The space, when the event belongs to one. */
1710
+ space_id?: string;
1711
+ /** The run, when the event belongs to one. */
1712
+ run_id?: string;
1713
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
1714
+ seq?: number;
1715
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
1716
+ idempotency_key?: string;
1717
+ /** The participant an event is attributed to. */
1718
+ actor: {
1719
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
1720
+ kind: "person" | "harness" | "agent" | "system";
1721
+ /** The participant id, or `system` for Chips. */
1722
+ id: string;
1723
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
1724
+ harness_id?: string;
1725
+ };
1726
+ /** A lane identifier: `lane_` followed by a ULID. */
1727
+ lane_id: string;
1728
+ /** What is being asked. */
1729
+ goal: string;
1730
+ /** Bounds on how to do it. */
1731
+ constraints?: string[];
1732
+ /** When it is needed by. */
1733
+ deadline?: string;
1734
+ /** The person the work is ultimately for. */
1735
+ on_behalf_of: string;
1736
+ /** The lead that routed it. */
1737
+ requested_by: string;
1738
+ /** The harness this lane runs on, which the run in the envelope belongs to. A lead may name an ephemeral child, which Chips has minted by the time this arrives. */
1739
+ specialist_id: string;
1740
+ /** The agent of that harness that works the lane (ADR 0087): its one agent in the lane's room, the one the lead named, a lead's hand-off to one of its own, or a child minted for this lane. */
1741
+ agent_id?: string;
1742
+ /** How the work got here. Lanes deeper than three are flattened into steps, not rejected. */
1743
+ trail: {
1744
+ /** Who handled this hop. */
1745
+ participant_id: string;
1746
+ /** The run this hop belongs to. */
1747
+ run_id?: string;
1748
+ /** What was asked at this hop. */
1749
+ goal?: string;
1750
+ }[];
1751
+ /** The level for this lane. */
1752
+ autonomy: 0 | 1 | 2 | 3;
1753
+ /** The lead spaces this lane is linked into, where its route card appears. */
1754
+ link_to?: string[];
1755
+ /** The message that caused the routing, quoted in the specialist's task card. */
1756
+ origin?: string;
1757
+ /** Anything the specialist needs. */
1758
+ attachments?: {
1759
+ /** A attachment identifier: `att_` followed by a ULID. */
1760
+ attachment_id: string;
1761
+ /** The name to show. Never trusted for its type. */
1762
+ filename: string;
1763
+ /** Sniffed from the bytes on upload, not taken from the client. */
1764
+ mime_type: string;
1765
+ /** Size in bytes. */
1766
+ byte_size: number;
1767
+ /** Lowercase hex digest. The store is content-addressed. */
1768
+ sha256: string;
1769
+ /** Pixels, for images and video. */
1770
+ width?: number;
1771
+ /** Pixels, for images and video. */
1772
+ height?: number;
1773
+ /** Milliseconds, for audio and video. */
1774
+ duration_ms?: number;
1775
+ /** What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out. */
1776
+ transcript?: string;
1777
+ /** The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced. */
1778
+ replaces?: string;
1779
+ /** A signed URL, bound to the requesting token: fetch it with that token as the bearer, since the URL alone is refused. */
1780
+ url: string;
1781
+ /** Ten minutes from issue, by default (decision 10). */
1782
+ url_expires_at: string;
1783
+ }[];
1784
+ /** What the lead calls the specialist on this lane, when that is not its participant name: a Space's name, a subagent's type. */
1785
+ label?: string;
1786
+ }
1787
+
1788
+ /** `approval.resolved` — A decision came back. More than yes or no: it carries a scope, optional edited input, and a reason. */
1789
+ export interface ApprovalResolved {
1790
+ /** Protocol major version. */
1791
+ v: 1;
1792
+ type: "approval.resolved";
1793
+ /** The event's own id. Stable across a retry of the same event. */
1794
+ id: string;
1795
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
1796
+ ts: string;
1797
+ /** A workspace identifier: `ws_` followed by a ULID. */
1798
+ workspace_id: string;
1799
+ /** The space, when the event belongs to one. */
1800
+ space_id?: string;
1801
+ /** The run, when the event belongs to one. */
1802
+ run_id?: string;
1803
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
1804
+ seq?: number;
1805
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
1806
+ idempotency_key?: string;
1807
+ /** The participant an event is attributed to. */
1808
+ actor: {
1809
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
1810
+ kind: "person" | "harness" | "agent" | "system";
1811
+ /** The participant id, or `system` for Chips. */
1812
+ id: string;
1813
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
1814
+ harness_id?: string;
1815
+ };
1816
+ /** A approval identifier: `apr_` followed by a ULID. */
1817
+ approval_id: string;
1818
+ /** `expired` means nobody answered and the fallback applied. */
1819
+ decision: "approved" | "edited" | "denied" | "expired";
1820
+ /** How far the answer reaches. `always` becomes a policy rule. */
1821
+ scope?: "once" | "session" | "always";
1822
+ /** With `always`: the rule is the harness's in every space, not only this one (ADR 0239). An owner or an admin only. */
1823
+ everywhere?: boolean;
1824
+ /** The edited action input, when the decision is `edited`. */
1825
+ updated_input?: unknown;
1826
+ /** Why. The harness gets to read this. */
1827
+ reason?: string;
1828
+ /** The participant who answered, or `system` on expiry — a harness when it settles its own ask, answered in its own tools. Filled in by Chips from the credential that sent it; a value the sender writes is replaced. */
1829
+ resolved_by: string;
1830
+ /** When it was answered. Stamped by Chips. */
1831
+ resolved_at: string;
1832
+ /** True on the surfaces that did not answer first. First answer wins. */
1833
+ resolved_elsewhere?: boolean;
1834
+ /** Who could answer it, as ids, as they stood when it was decided. Written by Chips from the approval so that somebody named outside the room is sent the decision as well as the ask (ADR 0042); a value the sender writes is replaced. */
1835
+ approvers?: string[];
1836
+ }
1837
+
1838
+ /** `question.answered` — The chosen options or free text, or a note that the timeout passed. */
1839
+ export interface QuestionAnswered {
1840
+ /** Protocol major version. */
1841
+ v: 1;
1842
+ type: "question.answered";
1843
+ /** The event's own id. Stable across a retry of the same event. */
1844
+ id: string;
1845
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
1846
+ ts: string;
1847
+ /** A workspace identifier: `ws_` followed by a ULID. */
1848
+ workspace_id: string;
1849
+ /** The space, when the event belongs to one. */
1850
+ space_id?: string;
1851
+ /** The run, when the event belongs to one. */
1852
+ run_id?: string;
1853
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
1854
+ seq?: number;
1855
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
1856
+ idempotency_key?: string;
1857
+ /** The participant an event is attributed to. */
1858
+ actor: {
1859
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
1860
+ kind: "person" | "harness" | "agent" | "system";
1861
+ /** The participant id, or `system` for Chips. */
1862
+ id: string;
1863
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
1864
+ harness_id?: string;
1865
+ };
1866
+ /** A question identifier: `qst_` followed by a ULID. */
1867
+ ask_id: string;
1868
+ /** One entry per question that was answered. */
1869
+ answers: {
1870
+ question_id: string;
1871
+ /** The chosen option values. */
1872
+ values: string[];
1873
+ /** What the person typed instead. */
1874
+ free_text?: string;
1875
+ }[];
1876
+ /** Who answered, or `system` on a timeout — a harness when it settles its own question, answered in its own tools. Filled in by Chips from the credential that sent it. */
1877
+ answered_by: string;
1878
+ /** When it was answered. Stamped by Chips. */
1879
+ answered_at: string;
1880
+ /** True when the default was taken rather than a choice. */
1881
+ timed_out?: boolean;
1882
+ }
1883
+
1884
+ /** `run.steer` — A mid-run instruction, with a disposition: steer, follow up, or interrupt. */
1885
+ export interface RunSteer {
1886
+ /** Protocol major version. */
1887
+ v: 1;
1888
+ type: "run.steer";
1889
+ /** The event's own id. Stable across a retry of the same event. */
1890
+ id: string;
1891
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
1892
+ ts: string;
1893
+ /** A workspace identifier: `ws_` followed by a ULID. */
1894
+ workspace_id: string;
1895
+ /** The space, when the event belongs to one. */
1896
+ space_id?: string;
1897
+ /** The run, when the event belongs to one. */
1898
+ run_id?: string;
1899
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
1900
+ seq?: number;
1901
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
1902
+ idempotency_key?: string;
1903
+ /** The participant an event is attributed to. */
1904
+ actor: {
1905
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
1906
+ kind: "person" | "harness" | "agent" | "system";
1907
+ /** The participant id, or `system` for Chips. */
1908
+ id: string;
1909
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
1910
+ harness_id?: string;
1911
+ };
1912
+ /** `steer` redirects, `followup` queues, `interrupt` stops what is happening now. */
1913
+ mode: "steer" | "followup" | "interrupt";
1914
+ /** The instruction. */
1915
+ text: string;
1916
+ /** Who said it. */
1917
+ from: {
1918
+ /** The stable id of the sender. */
1919
+ participant_id: string;
1920
+ /** Whether the sender is a person or an agent (ADR 0087); `harness` for a harness written before agents, and for any agent as a harness that has not declared `agents` is told it. */
1921
+ kind: "person" | "harness" | "agent";
1922
+ /** The name to show. */
1923
+ display_name: string;
1924
+ /** The sender's standing in this space. Multi-user is Chips' job, not the harness's. */
1925
+ role: "owner" | "member" | "guest";
1926
+ /** A person's standing in the workspace (SEC-15): what a model should weigh the words by, since a guest's read as the owner's otherwise. `promptFor` says it after the name. Absent for an agent or a harness, and from a Chips before it said. */
1927
+ workspace_role?: "owner" | "admin" | "member" | "guest";
1928
+ };
1929
+ }
1930
+
1931
+ /** `run.pause` — Stop where you are and hold. Sent by a person, or by Chips at a budget or context ceiling. */
1932
+ export interface RunPause {
1933
+ /** Protocol major version. */
1934
+ v: 1;
1935
+ type: "run.pause";
1936
+ /** The event's own id. Stable across a retry of the same event. */
1937
+ id: string;
1938
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
1939
+ ts: string;
1940
+ /** A workspace identifier: `ws_` followed by a ULID. */
1941
+ workspace_id: string;
1942
+ /** The space, when the event belongs to one. */
1943
+ space_id?: string;
1944
+ /** The run, when the event belongs to one. */
1945
+ run_id?: string;
1946
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
1947
+ seq?: number;
1948
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
1949
+ idempotency_key?: string;
1950
+ /** The participant an event is attributed to. */
1951
+ actor: {
1952
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
1953
+ kind: "person" | "harness" | "agent" | "system";
1954
+ /** The participant id, or `system` for Chips. */
1955
+ id: string;
1956
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
1957
+ harness_id?: string;
1958
+ };
1959
+ /** Why the run is pausing. */
1960
+ reason?: string;
1961
+ /** Who paused it, or `system`. Filled in by Chips from the credential that sent it. */
1962
+ by: string;
1963
+ }
1964
+
1965
+ /** `run.resume` — Carry on from where you paused. */
1966
+ export interface RunResume {
1967
+ /** Protocol major version. */
1968
+ v: 1;
1969
+ type: "run.resume";
1970
+ /** The event's own id. Stable across a retry of the same event. */
1971
+ id: string;
1972
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
1973
+ ts: string;
1974
+ /** A workspace identifier: `ws_` followed by a ULID. */
1975
+ workspace_id: string;
1976
+ /** The space, when the event belongs to one. */
1977
+ space_id?: string;
1978
+ /** The run, when the event belongs to one. */
1979
+ run_id?: string;
1980
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
1981
+ seq?: number;
1982
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
1983
+ idempotency_key?: string;
1984
+ /** The participant an event is attributed to. */
1985
+ actor: {
1986
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
1987
+ kind: "person" | "harness" | "agent" | "system";
1988
+ /** The participant id, or `system` for Chips. */
1989
+ id: string;
1990
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
1991
+ harness_id?: string;
1992
+ };
1993
+ /** Who resumed it. Filled in by Chips from the credential that sent it. */
1994
+ by: string;
1995
+ /** For a run that was paused across processes. */
1996
+ resume_token?: string;
1997
+ }
1998
+
1999
+ /** `run.cancel` — Stop for good. The run ends as cancelled, and the audit log records who ended it. */
2000
+ export interface RunCancel {
2001
+ /** Protocol major version. */
2002
+ v: 1;
2003
+ type: "run.cancel";
2004
+ /** The event's own id. Stable across a retry of the same event. */
2005
+ id: string;
2006
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2007
+ ts: string;
2008
+ /** A workspace identifier: `ws_` followed by a ULID. */
2009
+ workspace_id: string;
2010
+ /** The space, when the event belongs to one. */
2011
+ space_id?: string;
2012
+ /** The run, when the event belongs to one. */
2013
+ run_id?: string;
2014
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2015
+ seq?: number;
2016
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2017
+ idempotency_key?: string;
2018
+ /** The participant an event is attributed to. */
2019
+ actor: {
2020
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2021
+ kind: "person" | "harness" | "agent" | "system";
2022
+ /** The participant id, or `system` for Chips. */
2023
+ id: string;
2024
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2025
+ harness_id?: string;
2026
+ };
2027
+ /** Why. */
2028
+ reason?: string;
2029
+ /** Who cancelled it, or `system`. Filled in by Chips from the credential that sent it. */
2030
+ by: string;
2031
+ }
2032
+
2033
+ /** `policy.updated` — The autonomy level or the rules changed. Takes effect on the next action, not retroactively. */
2034
+ export interface PolicyUpdated {
2035
+ /** Protocol major version. */
2036
+ v: 1;
2037
+ type: "policy.updated";
2038
+ /** The event's own id. Stable across a retry of the same event. */
2039
+ id: string;
2040
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2041
+ ts: string;
2042
+ /** A workspace identifier: `ws_` followed by a ULID. */
2043
+ workspace_id: string;
2044
+ /** The space, when the event belongs to one. */
2045
+ space_id?: string;
2046
+ /** The run, when the event belongs to one. */
2047
+ run_id?: string;
2048
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2049
+ seq?: number;
2050
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2051
+ idempotency_key?: string;
2052
+ /** The participant an event is attributed to. */
2053
+ actor: {
2054
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2055
+ kind: "person" | "harness" | "agent" | "system";
2056
+ /** The participant id, or `system` for Chips. */
2057
+ id: string;
2058
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2059
+ harness_id?: string;
2060
+ };
2061
+ /** A harness identifier: `hrn_` followed by a ULID. */
2062
+ harness_id: string;
2063
+ /** A harness's autonomy level and the rules that fill in the details. */
2064
+ policy: {
2065
+ /** 0 observe, 1 ask first, 2 ask when it matters, 3 autonomous and report back. Presets that expand to rules. */
2066
+ autonomy: 0 | 1 | 2 | 3;
2067
+ /** Evaluated in order; the workspace cap always wins. */
2068
+ rules: {
2069
+ /** A glob over action kinds, for example `payment.*`. */
2070
+ match: string;
2071
+ /** Extra conditions on the action's flags, and for a command, how its parts start. */
2072
+ when?: {
2073
+ external?: boolean;
2074
+ irreversible?: boolean;
2075
+ money_usd_over?: number;
2076
+ risk?: "external" | "external_communication" | "irreversible" | "destructive" | "financial" | "credential" | "privacy" | "legal"[];
2077
+ /** For an action that carries a command (ADR 0239): the words a part of it starts with. A command goes ahead on such rules only when every part starts with one that allows it. */
2078
+ starts_with?: string[];
2079
+ };
2080
+ /** What to do when the rule matches. */
2081
+ decision: "allow" | "ask" | "deny";
2082
+ /** Who may answer, when the decision is `ask`. */
2083
+ approvers?: string[];
2084
+ /** Shown to the harness, and recorded in the audit log. */
2085
+ reason?: string;
2086
+ /** Turned off by a person (ADR 0195): kept in the list to turn back on, and skipped by the policy engine until then. */
2087
+ off?: boolean;
2088
+ /** Who made it by answering an ask with Always (ADR 0195). Filled in by Chips. */
2089
+ made_by?: string;
2090
+ /** When a person's answer made it (ADR 0195): Always, or This session. Filled in by Chips. A rule a person's answer made never allows an action that matters. */
2091
+ made_at?: string;
2092
+ }[];
2093
+ };
2094
+ /** The workspace cap. It always wins. */
2095
+ workspace_max_autonomy: 0 | 1 | 2 | 3;
2096
+ /** The harness's spending ceiling, in US dollars. Absent leaves it as it was; the harness's spend is what `usage` has added up. */
2097
+ budget_usd?: number;
2098
+ /** Who changed it, or `system` for an earned promotion. Filled in by Chips from the credential that sent it. */
2099
+ changed_by: string;
2100
+ /** Why it changed. */
2101
+ reason?: string;
2102
+ }
2103
+
2104
+ /** `budget.warning` — Eighty percent spent. At a hundred the run pauses rather than warning again; for a room's job, the room's agents pause. */
2105
+ export interface BudgetWarning {
2106
+ /** Protocol major version. */
2107
+ v: 1;
2108
+ type: "budget.warning";
2109
+ /** The event's own id. Stable across a retry of the same event. */
2110
+ id: string;
2111
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2112
+ ts: string;
2113
+ /** A workspace identifier: `ws_` followed by a ULID. */
2114
+ workspace_id: string;
2115
+ /** The space, when the event belongs to one. */
2116
+ space_id?: string;
2117
+ /** The run, when the event belongs to one. */
2118
+ run_id?: string;
2119
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2120
+ seq?: number;
2121
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2122
+ idempotency_key?: string;
2123
+ /** The participant an event is attributed to. */
2124
+ actor: {
2125
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2126
+ kind: "person" | "harness" | "agent" | "system";
2127
+ /** The participant id, or `system` for Chips. */
2128
+ id: string;
2129
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2130
+ harness_id?: string;
2131
+ };
2132
+ /** The ceiling and what was spent against it: the harness's budget, or for a job the room's ceiling and the job's spend. */
2133
+ budget: {
2134
+ /** The ceiling for this harness. */
2135
+ limit_usd: number;
2136
+ /** Spent so far, estimated. */
2137
+ spent_usd: number;
2138
+ };
2139
+ /** Which ceiling was crossed, as a percentage. */
2140
+ threshold: 80 | 100;
2141
+ /** `warn` at eighty, `pause` at a hundred. */
2142
+ action: "warn" | "pause";
2143
+ /** Whose ceiling: the harness's own budget (absent says the same), or the job in the room named by `space_id` (ADR 0118). */
2144
+ scope?: "harness" | "job";
2145
+ /** For a job: where it began, as `context.spend.since_seq` says it. A later job in the room is a new allowance. */
2146
+ since_seq?: number;
2147
+ }
2148
+
2149
+ /** `lane.updated` — A lane you opened has news. Finishing and delivering are different states, and delivery travels with the lane. */
2150
+ export interface LaneUpdated {
2151
+ /** Protocol major version. */
2152
+ v: 1;
2153
+ type: "lane.updated";
2154
+ /** The event's own id. Stable across a retry of the same event. */
2155
+ id: string;
2156
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2157
+ ts: string;
2158
+ /** A workspace identifier: `ws_` followed by a ULID. */
2159
+ workspace_id: string;
2160
+ /** The space, when the event belongs to one. */
2161
+ space_id?: string;
2162
+ /** The run, when the event belongs to one. */
2163
+ run_id?: string;
2164
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2165
+ seq?: number;
2166
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2167
+ idempotency_key?: string;
2168
+ /** The participant an event is attributed to. */
2169
+ actor: {
2170
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2171
+ kind: "person" | "harness" | "agent" | "system";
2172
+ /** The participant id, or `system` for Chips. */
2173
+ id: string;
2174
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2175
+ harness_id?: string;
2176
+ };
2177
+ /** A lane identifier: `lane_` followed by a ULID. */
2178
+ lane_id: string;
2179
+ /** Where the specialist got to. */
2180
+ state: "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled";
2181
+ /** A lane completes when the specialist posts; the person is told when the lead delivers. */
2182
+ delivery: "pending" | "direct" | "queued_to_lead" | "delivered" | "failed";
2183
+ /** The specialist's result, when there is one. */
2184
+ summary?: string;
2185
+ /** The lane's estimated cost, so the lead's panel can total the chain. Cost rolls up the trail; context does not. */
2186
+ cost_usd?: number;
2187
+ /** The files the specialist's answer carried, so an answer made of photos is an answer the lead has. Chips reads them off the lane run's own messages; URLs expire in ten minutes. */
2188
+ attachments?: {
2189
+ /** A attachment identifier: `att_` followed by a ULID. */
2190
+ attachment_id: string;
2191
+ /** The name to show. Never trusted for its type. */
2192
+ filename: string;
2193
+ /** Sniffed from the bytes on upload, not taken from the client. */
2194
+ mime_type: string;
2195
+ /** Size in bytes. */
2196
+ byte_size: number;
2197
+ /** Lowercase hex digest. The store is content-addressed. */
2198
+ sha256: string;
2199
+ /** Pixels, for images and video. */
2200
+ width?: number;
2201
+ /** Pixels, for images and video. */
2202
+ height?: number;
2203
+ /** Milliseconds, for audio and video. */
2204
+ duration_ms?: number;
2205
+ /** What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out. */
2206
+ transcript?: string;
2207
+ /** The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced. */
2208
+ replaces?: string;
2209
+ /** A signed URL, bound to the requesting token: fetch it with that token as the bearer, since the URL alone is refused. */
2210
+ url: string;
2211
+ /** Ten minutes from issue, by default (decision 10). */
2212
+ url_expires_at: string;
2213
+ }[];
2214
+ }
2215
+
2216
+ /** `feedback` — A reaction, or a note about what went wrong, on one of the harness's messages. */
2217
+ export interface Feedback {
2218
+ /** Protocol major version. */
2219
+ v: 1;
2220
+ type: "feedback";
2221
+ /** The event's own id. Stable across a retry of the same event. */
2222
+ id: string;
2223
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2224
+ ts: string;
2225
+ /** A workspace identifier: `ws_` followed by a ULID. */
2226
+ workspace_id: string;
2227
+ /** The space, when the event belongs to one. */
2228
+ space_id?: string;
2229
+ /** The run, when the event belongs to one. */
2230
+ run_id?: string;
2231
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2232
+ seq?: number;
2233
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2234
+ idempotency_key?: string;
2235
+ /** The participant an event is attributed to. */
2236
+ actor: {
2237
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2238
+ kind: "person" | "harness" | "agent" | "system";
2239
+ /** The participant id, or `system` for Chips. */
2240
+ id: string;
2241
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2242
+ harness_id?: string;
2243
+ };
2244
+ /** The message it is about: one a harness said, in the space the event names. */
2245
+ message_id: string;
2246
+ /** A light signal, or a written note. */
2247
+ kind: "reaction" | "correction";
2248
+ /** The emoji, when the kind is `reaction`. Required then. */
2249
+ reaction?: string;
2250
+ /** What went wrong, when the kind is `correction`. Required then. */
2251
+ text?: string;
2252
+ /** Who gave it. Filled in by Chips from the credential and the membership; a value the sender writes is replaced. */
2253
+ from: {
2254
+ /** The stable id of the sender. */
2255
+ participant_id: string;
2256
+ /** Whether the sender is a person or an agent (ADR 0087); `harness` for a harness written before agents, and for any agent as a harness that has not declared `agents` is told it. */
2257
+ kind: "person" | "harness" | "agent";
2258
+ /** The name to show. */
2259
+ display_name: string;
2260
+ /** The sender's standing in this space. Multi-user is Chips' job, not the harness's. */
2261
+ role: "owner" | "member" | "guest";
2262
+ /** A person's standing in the workspace (SEC-15): what a model should weigh the words by, since a guest's read as the owner's otherwise. `promptFor` says it after the name. Absent for an agent or a harness, and from a Chips before it said. */
2263
+ workspace_role?: "owner" | "admin" | "member" | "guest";
2264
+ };
2265
+ }
2266
+
2267
+ /** `receipt` — What Chips did with a message sent mid-run: queued it, or steered with it. */
2268
+ export interface Receipt {
2269
+ /** Protocol major version. */
2270
+ v: 1;
2271
+ type: "receipt";
2272
+ /** The event's own id. Stable across a retry of the same event. */
2273
+ id: string;
2274
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2275
+ ts: string;
2276
+ /** A workspace identifier: `ws_` followed by a ULID. */
2277
+ workspace_id: string;
2278
+ /** The space, when the event belongs to one. */
2279
+ space_id?: string;
2280
+ /** The run, when the event belongs to one. */
2281
+ run_id?: string;
2282
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2283
+ seq?: number;
2284
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2285
+ idempotency_key?: string;
2286
+ /** The participant an event is attributed to. */
2287
+ actor: {
2288
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2289
+ kind: "person" | "harness" | "agent" | "system";
2290
+ /** The participant id, or `system` for Chips. */
2291
+ id: string;
2292
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2293
+ harness_id?: string;
2294
+ };
2295
+ /** A message identifier: `msg_` followed by a ULID. */
2296
+ message_id: string;
2297
+ /** Whether the harness will see it now or after the step. */
2298
+ disposition: "queued" | "steered";
2299
+ }
2300
+
2301
+ /** `space.created` — A space was opened: a direct message, a group, a channel or a thread. */
2302
+ export interface SpaceCreated {
2303
+ /** Protocol major version. */
2304
+ v: 1;
2305
+ type: "space.created";
2306
+ /** The event's own id. Stable across a retry of the same event. */
2307
+ id: string;
2308
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2309
+ ts: string;
2310
+ /** A workspace identifier: `ws_` followed by a ULID. */
2311
+ workspace_id: string;
2312
+ /** The space, when the event belongs to one. */
2313
+ space_id?: string;
2314
+ /** The run, when the event belongs to one. */
2315
+ run_id?: string;
2316
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2317
+ seq?: number;
2318
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2319
+ idempotency_key?: string;
2320
+ /** The participant an event is attributed to. */
2321
+ actor: {
2322
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2323
+ kind: "person" | "harness" | "agent" | "system";
2324
+ /** The participant id, or `system` for Chips. */
2325
+ id: string;
2326
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2327
+ harness_id?: string;
2328
+ };
2329
+ /** Mixed membership is the norm; the kind is about shape, not about who is in it. */
2330
+ kind: "direct" | "group" | "channel" | "thread";
2331
+ /** What to call it. Direct messages have none. */
2332
+ title?: string;
2333
+ /** 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. */
2334
+ parent_space_id?: string;
2335
+ /** For a thread: the message in the parent it grew from, which is where it is drawn. */
2336
+ root_message_id?: string;
2337
+ /** 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). */
2338
+ external_key?: string;
2339
+ /** 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. */
2340
+ opened_for?: string;
2341
+ /** 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`. */
2342
+ asked_of?: string;
2343
+ /** 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. */
2344
+ also_asked_of?: string[];
2345
+ }
2346
+
2347
+ /** `space.updated` — 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. */
2348
+ export interface SpaceUpdated {
2349
+ /** Protocol major version. */
2350
+ v: 1;
2351
+ type: "space.updated";
2352
+ /** The event's own id. Stable across a retry of the same event. */
2353
+ id: string;
2354
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2355
+ ts: string;
2356
+ /** A workspace identifier: `ws_` followed by a ULID. */
2357
+ workspace_id: string;
2358
+ /** The space, when the event belongs to one. */
2359
+ space_id?: string;
2360
+ /** The run, when the event belongs to one. */
2361
+ run_id?: string;
2362
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2363
+ seq?: number;
2364
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2365
+ idempotency_key?: string;
2366
+ /** The participant an event is attributed to. */
2367
+ actor: {
2368
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2369
+ kind: "person" | "harness" | "agent" | "system";
2370
+ /** The participant id, or `system` for Chips. */
2371
+ id: string;
2372
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2373
+ harness_id?: string;
2374
+ };
2375
+ /** 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. */
2376
+ title?: string;
2377
+ /** 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). */
2378
+ state?: "open" | "closed";
2379
+ /** 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). */
2380
+ home?: boolean;
2381
+ }
2382
+
2383
+ /** `space.claimed` — 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. */
2384
+ export interface SpaceClaimed {
2385
+ /** Protocol major version. */
2386
+ v: 1;
2387
+ type: "space.claimed";
2388
+ /** The event's own id. Stable across a retry of the same event. */
2389
+ id: string;
2390
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2391
+ ts: string;
2392
+ /** A workspace identifier: `ws_` followed by a ULID. */
2393
+ workspace_id: string;
2394
+ /** The space, when the event belongs to one. */
2395
+ space_id?: string;
2396
+ /** The run, when the event belongs to one. */
2397
+ run_id?: string;
2398
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2399
+ seq?: number;
2400
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2401
+ idempotency_key?: string;
2402
+ /** The participant an event is attributed to. */
2403
+ actor: {
2404
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2405
+ kind: "person" | "harness" | "agent" | "system";
2406
+ /** The participant id, or `system` for Chips. */
2407
+ id: string;
2408
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2409
+ harness_id?: string;
2410
+ };
2411
+ /** 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. */
2412
+ external_key: string;
2413
+ /** What the harness calls it. Absent when it named nothing, or when a person had already named the room, whose word holds. */
2414
+ title?: string;
2415
+ }
2416
+
2417
+ /** `space.erased` — 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. */
2418
+ export interface SpaceErased {
2419
+ /** Protocol major version. */
2420
+ v: 1;
2421
+ type: "space.erased";
2422
+ /** The event's own id. Stable across a retry of the same event. */
2423
+ id: string;
2424
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2425
+ ts: string;
2426
+ /** A workspace identifier: `ws_` followed by a ULID. */
2427
+ workspace_id: string;
2428
+ /** The space, when the event belongs to one. */
2429
+ space_id?: string;
2430
+ /** The run, when the event belongs to one. */
2431
+ run_id?: string;
2432
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2433
+ seq?: number;
2434
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2435
+ idempotency_key?: string;
2436
+ /** The participant an event is attributed to. */
2437
+ actor: {
2438
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2439
+ kind: "person" | "harness" | "agent" | "system";
2440
+ /** The participant id, or `system` for Chips. */
2441
+ id: string;
2442
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2443
+ harness_id?: string;
2444
+ };
2445
+ /** The space, and every thread of it, in that order. Each device forgets them. */
2446
+ erased: string[];
2447
+ /** 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. */
2448
+ spent?: {
2449
+ /** Whose account the room's cost was on. */
2450
+ harness_id: string;
2451
+ /** What the room had cost that harness, in US dollars. */
2452
+ usd: number;
2453
+ }[];
2454
+ }
2455
+
2456
+ /** `membership.added` — A person or an agent joined a space. Shows as a muted centred line. */
2457
+ export interface MembershipAdded {
2458
+ /** Protocol major version. */
2459
+ v: 1;
2460
+ type: "membership.added";
2461
+ /** The event's own id. Stable across a retry of the same event. */
2462
+ id: string;
2463
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2464
+ ts: string;
2465
+ /** A workspace identifier: `ws_` followed by a ULID. */
2466
+ workspace_id: string;
2467
+ /** The space, when the event belongs to one. */
2468
+ space_id?: string;
2469
+ /** The run, when the event belongs to one. */
2470
+ run_id?: string;
2471
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2472
+ seq?: number;
2473
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2474
+ idempotency_key?: string;
2475
+ /** The participant an event is attributed to. */
2476
+ actor: {
2477
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2478
+ kind: "person" | "harness" | "agent" | "system";
2479
+ /** The participant id, or `system` for Chips. */
2480
+ id: string;
2481
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2482
+ harness_id?: string;
2483
+ };
2484
+ /** Who joined. */
2485
+ participant_id: string;
2486
+ /** A person or an agent (ADR 0087); `harness` for a harness in a room before the upgrade gave it an agent. */
2487
+ participant_kind: "person" | "harness" | "agent";
2488
+ /** Their standing here, which is what every `from` field reports. */
2489
+ role?: "owner" | "member" | "guest";
2490
+ /** Defaults to the event's own timestamp. */
2491
+ joined_at?: string;
2492
+ /** For an agent moved here from another room (ADR 0087): the room it left. Written by Chips. */
2493
+ moved_from?: string;
2494
+ /** 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. */
2495
+ fork_of?: string;
2496
+ /** 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. */
2497
+ made_for?: string;
2498
+ /** 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. */
2499
+ agent_name?: string;
2500
+ /** 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. */
2501
+ invite_id?: string;
2502
+ }
2503
+
2504
+ /** `membership.removed` — A person or an agent left a space, or was removed from it. */
2505
+ export interface MembershipRemoved {
2506
+ /** Protocol major version. */
2507
+ v: 1;
2508
+ type: "membership.removed";
2509
+ /** The event's own id. Stable across a retry of the same event. */
2510
+ id: string;
2511
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2512
+ ts: string;
2513
+ /** A workspace identifier: `ws_` followed by a ULID. */
2514
+ workspace_id: string;
2515
+ /** The space, when the event belongs to one. */
2516
+ space_id?: string;
2517
+ /** The run, when the event belongs to one. */
2518
+ run_id?: string;
2519
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2520
+ seq?: number;
2521
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2522
+ idempotency_key?: string;
2523
+ /** The participant an event is attributed to. */
2524
+ actor: {
2525
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2526
+ kind: "person" | "harness" | "agent" | "system";
2527
+ /** The participant id, or `system` for Chips. */
2528
+ id: string;
2529
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2530
+ harness_id?: string;
2531
+ };
2532
+ /** Who left. */
2533
+ participant_id: string;
2534
+ /** Who removed them, if not themselves. */
2535
+ removed_by?: string;
2536
+ /** 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. */
2537
+ reason?: "archived" | "deleted" | "moved" | "agent_archived" | "removed" | "agent_deleted" | "person_removed" | "person_left";
2538
+ /** For an agent moved away: the room it went to, so this room can say so. */
2539
+ moved_to?: string;
2540
+ }
2541
+
2542
+ /** `membership.replaced` — An agent took its harness's place in a room: what the harness said there shows as the agent's. */
2543
+ export interface MembershipReplaced {
2544
+ /** Protocol major version. */
2545
+ v: 1;
2546
+ type: "membership.replaced";
2547
+ /** The event's own id. Stable across a retry of the same event. */
2548
+ id: string;
2549
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2550
+ ts: string;
2551
+ /** A workspace identifier: `ws_` followed by a ULID. */
2552
+ workspace_id: string;
2553
+ /** The space, when the event belongs to one. */
2554
+ space_id?: string;
2555
+ /** The run, when the event belongs to one. */
2556
+ run_id?: string;
2557
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2558
+ seq?: number;
2559
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2560
+ idempotency_key?: string;
2561
+ /** The participant an event is attributed to. */
2562
+ actor: {
2563
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2564
+ kind: "person" | "harness" | "agent" | "system";
2565
+ /** The participant id, or `system` for Chips. */
2566
+ id: string;
2567
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2568
+ harness_id?: string;
2569
+ };
2570
+ /** The member it replaces: the harness, before agents. */
2571
+ from: string;
2572
+ /** The agent in the room from here. */
2573
+ to: string;
2574
+ }
2575
+
2576
+ /** `agent.registered` — 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. */
2577
+ export interface AgentRegistered {
2578
+ /** Protocol major version. */
2579
+ v: 1;
2580
+ type: "agent.registered";
2581
+ /** The event's own id. Stable across a retry of the same event. */
2582
+ id: string;
2583
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2584
+ ts: string;
2585
+ /** A workspace identifier: `ws_` followed by a ULID. */
2586
+ workspace_id: string;
2587
+ /** The space, when the event belongs to one. */
2588
+ space_id?: string;
2589
+ /** The run, when the event belongs to one. */
2590
+ run_id?: string;
2591
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2592
+ seq?: number;
2593
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2594
+ idempotency_key?: string;
2595
+ /** The participant an event is attributed to. */
2596
+ actor: {
2597
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2598
+ kind: "person" | "harness" | "agent" | "system";
2599
+ /** The participant id, or `system` for Chips. */
2600
+ id: string;
2601
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2602
+ harness_id?: string;
2603
+ };
2604
+ /** The agent. */
2605
+ agent_id: string;
2606
+ /** The harness it belongs to, which speaks for it. */
2607
+ harness_id: string;
2608
+ /** 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). */
2609
+ key: string;
2610
+ /** What it is called, and so its @handle. */
2611
+ name: string;
2612
+ /** The harness's Main agent (ADR 0087): the one it leads with, in a room of its own. A harness has one at most. */
2613
+ lead?: boolean;
2614
+ /** The agent this one is a copy of, when it was forked. */
2615
+ forked_from?: string;
2616
+ }
2617
+
2618
+ /** `agent.updated` — 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. */
2619
+ export interface AgentUpdated {
2620
+ /** Protocol major version. */
2621
+ v: 1;
2622
+ type: "agent.updated";
2623
+ /** The event's own id. Stable across a retry of the same event. */
2624
+ id: string;
2625
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2626
+ ts: string;
2627
+ /** A workspace identifier: `ws_` followed by a ULID. */
2628
+ workspace_id: string;
2629
+ /** The space, when the event belongs to one. */
2630
+ space_id?: string;
2631
+ /** The run, when the event belongs to one. */
2632
+ run_id?: string;
2633
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2634
+ seq?: number;
2635
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2636
+ idempotency_key?: string;
2637
+ /** The participant an event is attributed to. */
2638
+ actor: {
2639
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2640
+ kind: "person" | "harness" | "agent" | "system";
2641
+ /** The participant id, or `system` for Chips. */
2642
+ id: string;
2643
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2644
+ harness_id?: string;
2645
+ };
2646
+ /** The agent. */
2647
+ agent_id: string;
2648
+ /** 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. */
2649
+ name?: string;
2650
+ /** `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. */
2651
+ state?: "active" | "archived";
2652
+ /** 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. */
2653
+ face?: {
2654
+ icon: string;
2655
+ ground: number;
2656
+ /** One or two letters, or an emoji or two, the face wears on its ground in place of a mark (ADR 0139); the mark is empty beside them. Absent on a face that is a mark, or only a colour. */
2657
+ letters?: string;
2658
+ } | null;
2659
+ /** 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. */
2660
+ lead?: boolean;
2661
+ }
2662
+
2663
+ /** `agent.deleted` — 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. */
2664
+ export interface AgentDeleted {
2665
+ /** Protocol major version. */
2666
+ v: 1;
2667
+ type: "agent.deleted";
2668
+ /** The event's own id. Stable across a retry of the same event. */
2669
+ id: string;
2670
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2671
+ ts: string;
2672
+ /** A workspace identifier: `ws_` followed by a ULID. */
2673
+ workspace_id: string;
2674
+ /** The space, when the event belongs to one. */
2675
+ space_id?: string;
2676
+ /** The run, when the event belongs to one. */
2677
+ run_id?: string;
2678
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2679
+ seq?: number;
2680
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2681
+ idempotency_key?: string;
2682
+ /** The participant an event is attributed to. */
2683
+ actor: {
2684
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2685
+ kind: "person" | "harness" | "agent" | "system";
2686
+ /** The participant id, or `system` for Chips. */
2687
+ id: string;
2688
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2689
+ harness_id?: string;
2690
+ };
2691
+ /** The agent deleted. */
2692
+ agent_id: string;
2693
+ /** The harness it belonged to, which deletes its own side. */
2694
+ harness_id: string;
2695
+ /** The harness's own key for it, as `agent.registered` gave it: refused from here. */
2696
+ key: string;
2697
+ /** What it was called when it was deleted, so the audit needs no lookup. */
2698
+ name: string;
2699
+ /** The person who deleted it. */
2700
+ by: string;
2701
+ }
2702
+
2703
+ /** `agent.lock_set` — An agent's changes were locked, or let go: while locked, no person renames, archives or deletes it. */
2704
+ export interface AgentLockSet {
2705
+ /** Protocol major version. */
2706
+ v: 1;
2707
+ type: "agent.lock_set";
2708
+ /** The event's own id. Stable across a retry of the same event. */
2709
+ id: string;
2710
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2711
+ ts: string;
2712
+ /** A workspace identifier: `ws_` followed by a ULID. */
2713
+ workspace_id: string;
2714
+ /** The space, when the event belongs to one. */
2715
+ space_id?: string;
2716
+ /** The run, when the event belongs to one. */
2717
+ run_id?: string;
2718
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2719
+ seq?: number;
2720
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2721
+ idempotency_key?: string;
2722
+ /** The participant an event is attributed to. */
2723
+ actor: {
2724
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2725
+ kind: "person" | "harness" | "agent" | "system";
2726
+ /** The participant id, or `system` for Chips. */
2727
+ id: string;
2728
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2729
+ harness_id?: string;
2730
+ };
2731
+ /** The agent whose changes were locked or let go. */
2732
+ agent_id: string;
2733
+ /** Whether the agent's changes are locked now. `false` is how every agent starts, and lets them go again. */
2734
+ locked: boolean;
2735
+ }
2736
+
2737
+ /** `agent.attached` — An agent was put in a room: added, moved in, or brought back. Its harness is handed the room's last lines with it. */
2738
+ export interface AgentAttached {
2739
+ /** Protocol major version. */
2740
+ v: 1;
2741
+ type: "agent.attached";
2742
+ /** The event's own id. Stable across a retry of the same event. */
2743
+ id: string;
2744
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2745
+ ts: string;
2746
+ /** A workspace identifier: `ws_` followed by a ULID. */
2747
+ workspace_id: string;
2748
+ /** The space, when the event belongs to one. */
2749
+ space_id?: string;
2750
+ /** The run, when the event belongs to one. */
2751
+ run_id?: string;
2752
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2753
+ seq?: number;
2754
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2755
+ idempotency_key?: string;
2756
+ /** The participant an event is attributed to. */
2757
+ actor: {
2758
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2759
+ kind: "person" | "harness" | "agent" | "system";
2760
+ /** The participant id, or `system` for Chips. */
2761
+ id: string;
2762
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2763
+ harness_id?: string;
2764
+ };
2765
+ /** The agent, in the room this event's `space_id` names. */
2766
+ agent_id: string;
2767
+ /** Who put it there: a person, its harness, or Chips (`system`). */
2768
+ by?: string;
2769
+ /** The room it left for this one, when moved. */
2770
+ moved_from?: string;
2771
+ /** The `agent.fork` this copy answers, when it is a fork's copy (ADR 0087, Fork). */
2772
+ fork_of?: string;
2773
+ /** The `agent.asked` this new agent answers, when a person asked for it (ADR 0108). */
2774
+ made_for?: string;
2775
+ /** 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. */
2776
+ catch_up?: {
2777
+ /** Oldest first, the newest that fit the budget. */
2778
+ lines: {
2779
+ /** Where in the log it happened. */
2780
+ seq: number;
2781
+ /** When. */
2782
+ at: string;
2783
+ /** `said`: a message, addressed to this harness or not. `joined` and `left`: somebody came into the room or went. `renamed`: somebody took a new name, or the room a new title. `archived` and `unarchived`: the room was put away or brought back. */
2784
+ kind: "said" | "joined" | "left" | "renamed" | "archived" | "unarchived";
2785
+ /** Who: the one who said it, came, went or took the new name; for the room's own lines, who retitled, archived or unarchived it. */
2786
+ from: {
2787
+ /** Their participant id, or `system`. */
2788
+ id: string;
2789
+ kind: "person" | "harness" | "agent" | "system";
2790
+ /** What they go by now. */
2791
+ name: string;
2792
+ /** Their standing in this room, when they are in it (SEC-15). */
2793
+ role?: "owner" | "member" | "guest";
2794
+ /** A person's standing in the workspace (SEC-15): the plain form says it after the name, so a guest's line reads as a guest's. Absent for an agent or a harness. */
2795
+ workspace_role?: "owner" | "admin" | "member" | "guest";
2796
+ };
2797
+ /** On `said`: the message. */
2798
+ message_id?: string;
2799
+ /** On `said`: the words as they read now, so an edited message reads edited; a deleted one is not a line. Cut with an ellipsis when the one line is longer than the whole budget. */
2800
+ text?: string;
2801
+ /** On `said`: what a voice note said, as the server heard it (ADR 0054). */
2802
+ transcript?: string;
2803
+ /** On `said`: the names of the files it carried. */
2804
+ files?: string[];
2805
+ /** On `said`: the agents it was for (ADR 0081, ADR 0087), so a harness can leave out a line one of its agents already took a turn on. Absent on a message from before Chips said so. */
2806
+ addressed_to?: string[];
2807
+ /** On `said`: the guard held it (ADR 0081), so it was for nobody. */
2808
+ held?: true;
2809
+ /** On `renamed`, for a participant: the name they took. */
2810
+ name?: string;
2811
+ /** On `renamed`, for a participant: the name they went by until then. */
2812
+ previous?: string;
2813
+ /** On `renamed`, for the room: its new title. */
2814
+ title?: string;
2815
+ }[];
2816
+ /** Where they start: after this `seq`. With a message, where the turn that said the harness's own last message in the room began (ADR 0105), else its joining; from the pull route, 0. */
2817
+ since_seq: number;
2818
+ /** Whether older lines after `since_seq` were left out to fit the budget. */
2819
+ truncated: boolean;
2820
+ /** A cursor: `GET /v1/spaces/:id/context?before=` this reads what came before these lines. */
2821
+ before: number;
2822
+ /** The room's files at their current version, newest first, the 20 newest (ADR 0099): with a message, as of it, its own files included; from the pull route, as of now. Each with a URL for this harness. Absent from a Chips before files, and when the room has none. */
2823
+ files?: {
2824
+ /** The file's name, which its versions share. */
2825
+ name: string;
2826
+ /** Which version this is: 1 for the first, counting each change of its bytes. */
2827
+ version: number;
2828
+ /** The attachment that is this version: what a post names in `replaces` when it changes it. */
2829
+ attachment_id: string;
2830
+ /** Lowercase hex digest of this version's bytes. */
2831
+ sha256: string;
2832
+ /** Size in bytes. */
2833
+ byte_size: number;
2834
+ /** Sniffed from the bytes on upload. */
2835
+ mime_type: string;
2836
+ /** Who posted this version, as a line's `from` says it. */
2837
+ by: {
2838
+ /** Their participant id. */
2839
+ id: string;
2840
+ kind: "person" | "harness" | "agent" | "system";
2841
+ /** What they go by now. */
2842
+ name: string;
2843
+ };
2844
+ /** When this version was posted. */
2845
+ at: string;
2846
+ /** The message that posted this version. */
2847
+ message_id?: string;
2848
+ /** Pixels, for a photo or a video. */
2849
+ width?: number;
2850
+ /** Pixels, for a photo or a video. */
2851
+ height?: number;
2852
+ /** Milliseconds, for a sound or a video. */
2853
+ duration_ms?: number;
2854
+ /** In one name's versions (`?name=`): the version this one was made from, as its post said (`message.post.replaces`). Absent where the post said nothing, or named no version of this file. */
2855
+ replaces?: string;
2856
+ /** For a harness: a signed URL for this version, bound to its token, as a message's attachments are. Absent for a person, who fetches it by id. */
2857
+ url?: string;
2858
+ /** When `url` stops working. */
2859
+ url_expires_at?: string;
2860
+ }[];
2861
+ /** What the room's job has spent, as of the message (for one Chips held, as of its hand-over, when a new job began), against what the room allows a job (ADR 0117). With a message only; the room note says it in words. Absent from a Chips before it. */
2862
+ spend?: {
2863
+ /** What the room allows a job, in US dollars: its own ceiling, or the default (3) when nobody has set one. */
2864
+ ceiling_usd: number;
2865
+ /** What the room's runs reported costing since the job began, in US dollars, every harness's together. */
2866
+ spent_usd: number;
2867
+ /** Where the job began: the `seq` of the last thing a person did in the room, or of the last brief handed into it, whichever is later; 0 when neither has happened. */
2868
+ since_seq: number;
2869
+ /** How many of the job's runs reported no cost, and so count nothing. */
2870
+ uncounted_runs: number;
2871
+ };
2872
+ };
2873
+ }
2874
+
2875
+ /** `agent.released` — An agent was taken out of its room and is free: by an archive, a delete, a move, its harness, or a person. */
2876
+ export interface AgentReleased {
2877
+ /** Protocol major version. */
2878
+ v: 1;
2879
+ type: "agent.released";
2880
+ /** The event's own id. Stable across a retry of the same event. */
2881
+ id: string;
2882
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2883
+ ts: string;
2884
+ /** A workspace identifier: `ws_` followed by a ULID. */
2885
+ workspace_id: string;
2886
+ /** The space, when the event belongs to one. */
2887
+ space_id?: string;
2888
+ /** The run, when the event belongs to one. */
2889
+ run_id?: string;
2890
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2891
+ seq?: number;
2892
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2893
+ idempotency_key?: string;
2894
+ /** The participant an event is attributed to. */
2895
+ actor: {
2896
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2897
+ kind: "person" | "harness" | "agent" | "system";
2898
+ /** The participant id, or `system` for Chips. */
2899
+ id: string;
2900
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2901
+ harness_id?: string;
2902
+ };
2903
+ /** The agent, out of the room this event's `space_id` names. */
2904
+ agent_id: string;
2905
+ /** Who did it: a person, its harness, or Chips (`system`). */
2906
+ by?: string;
2907
+ /** `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). */
2908
+ reason: "archived" | "deleted" | "moved" | "agent_archived" | "removed" | "agent_deleted";
2909
+ /** The room it went to, when moved. */
2910
+ moved_to?: string;
2911
+ /** 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. */
2912
+ delete?: true;
2913
+ }
2914
+
2915
+ /** `agent.fork` — 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. */
2916
+ export interface AgentFork {
2917
+ /** Protocol major version. */
2918
+ v: 1;
2919
+ type: "agent.fork";
2920
+ /** The event's own id. Stable across a retry of the same event. */
2921
+ id: string;
2922
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2923
+ ts: string;
2924
+ /** A workspace identifier: `ws_` followed by a ULID. */
2925
+ workspace_id: string;
2926
+ /** The space, when the event belongs to one. */
2927
+ space_id?: string;
2928
+ /** The run, when the event belongs to one. */
2929
+ run_id?: string;
2930
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2931
+ seq?: number;
2932
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2933
+ idempotency_key?: string;
2934
+ /** The participant an event is attributed to. */
2935
+ actor: {
2936
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2937
+ kind: "person" | "harness" | "agent" | "system";
2938
+ /** The participant id, or `system` for Chips. */
2939
+ id: string;
2940
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2941
+ harness_id?: string;
2942
+ };
2943
+ /** The agent to copy. It stays where it is; the copy is for the room this event's `space_id` names. */
2944
+ agent_id: string;
2945
+ /** The person who asked. */
2946
+ by: string;
2947
+ }
2948
+
2949
+ /** `agent.asked` — A person asked a harness for a new agent in this room. It starts with the room's last lines, and nothing from elsewhere. */
2950
+ export interface AgentAsked {
2951
+ /** Protocol major version. */
2952
+ v: 1;
2953
+ type: "agent.asked";
2954
+ /** The event's own id. Stable across a retry of the same event. */
2955
+ id: string;
2956
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2957
+ ts: string;
2958
+ /** A workspace identifier: `ws_` followed by a ULID. */
2959
+ workspace_id: string;
2960
+ /** The space, when the event belongs to one. */
2961
+ space_id?: string;
2962
+ /** The run, when the event belongs to one. */
2963
+ run_id?: string;
2964
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
2965
+ seq?: number;
2966
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
2967
+ idempotency_key?: string;
2968
+ /** The participant an event is attributed to. */
2969
+ actor: {
2970
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
2971
+ kind: "person" | "harness" | "agent" | "system";
2972
+ /** The participant id, or `system` for Chips. */
2973
+ id: string;
2974
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
2975
+ harness_id?: string;
2976
+ };
2977
+ /** The harness asked. It makes the agent, and registers it for the room this event's `space_id` names. */
2978
+ harness_id: string;
2979
+ /** 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. */
2980
+ name: string;
2981
+ /** The person who asked. */
2982
+ by: string;
2983
+ }
2984
+
2985
+ /** `message.held` — An agent in no room said something: it is held, and posted in the next room the agent joins. */
2986
+ export interface MessageHeld {
2987
+ /** Protocol major version. */
2988
+ v: 1;
2989
+ type: "message.held";
2990
+ /** The event's own id. Stable across a retry of the same event. */
2991
+ id: string;
2992
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
2993
+ ts: string;
2994
+ /** A workspace identifier: `ws_` followed by a ULID. */
2995
+ workspace_id: string;
2996
+ /** The space, when the event belongs to one. */
2997
+ space_id?: string;
2998
+ /** The run, when the event belongs to one. */
2999
+ run_id?: string;
3000
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3001
+ seq?: number;
3002
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3003
+ idempotency_key?: string;
3004
+ /** The participant an event is attributed to. */
3005
+ actor: {
3006
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3007
+ kind: "person" | "harness" | "agent" | "system";
3008
+ /** The participant id, or `system` for Chips. */
3009
+ id: string;
3010
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3011
+ harness_id?: string;
3012
+ };
3013
+ /** Who said it. */
3014
+ agent_id: string;
3015
+ /** Markdown, as the harness sent it. */
3016
+ text: string;
3017
+ /** What it attached, as the upload described them. */
3018
+ attachments?: {
3019
+ /** A attachment identifier: `att_` followed by a ULID. */
3020
+ attachment_id: string;
3021
+ /** The name to show. Never trusted for its type. */
3022
+ filename: string;
3023
+ /** Sniffed from the bytes on upload, not taken from the client. */
3024
+ mime_type: string;
3025
+ /** Size in bytes. */
3026
+ byte_size: number;
3027
+ /** Lowercase hex digest. The store is content-addressed. */
3028
+ sha256: string;
3029
+ /** Pixels, for images and video. */
3030
+ width?: number;
3031
+ /** Pixels, for images and video. */
3032
+ height?: number;
3033
+ /** Milliseconds, for audio and video. */
3034
+ duration_ms?: number;
3035
+ /** What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out. */
3036
+ transcript?: string;
3037
+ /** The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced. */
3038
+ replaces?: string;
3039
+ }[];
3040
+ }
3041
+
3042
+ /** `exchange.set` — A person paused the agents in a room, or let them carry on; or Chips paused them at the room's spend ceiling. */
3043
+ export interface ExchangeSet {
3044
+ /** Protocol major version. */
3045
+ v: 1;
3046
+ type: "exchange.set";
3047
+ /** The event's own id. Stable across a retry of the same event. */
3048
+ id: string;
3049
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3050
+ ts: string;
3051
+ /** A workspace identifier: `ws_` followed by a ULID. */
3052
+ workspace_id: string;
3053
+ /** The space, when the event belongs to one. */
3054
+ space_id?: string;
3055
+ /** The run, when the event belongs to one. */
3056
+ run_id?: string;
3057
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3058
+ seq?: number;
3059
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3060
+ idempotency_key?: string;
3061
+ /** The participant an event is attributed to. */
3062
+ actor: {
3063
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3064
+ kind: "person" | "harness" | "agent" | "system";
3065
+ /** The participant id, or `system` for Chips. */
3066
+ id: string;
3067
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3068
+ harness_id?: string;
3069
+ };
3070
+ /** `paused`: their messages to each other are held. `going`: they carry on. */
3071
+ state: "paused" | "going";
3072
+ /** Why Chips paused them: `spend`, the room's job reached its ceiling (ADR 0118). Absent when a person did. */
3073
+ why?: "spend";
3074
+ /** For `why: spend`: what the job had spent, against what the room allows a job. */
3075
+ spend?: {
3076
+ /** What the room allows a job, in US dollars: its own ceiling, or the default (3) when nobody has set one. */
3077
+ ceiling_usd: number;
3078
+ /** What the room's runs reported costing since the job began, in US dollars, every harness's together. */
3079
+ spent_usd: number;
3080
+ /** Where the job began: the `seq` of the last thing a person did in the room, or of the last brief handed into it, whichever is later; 0 when neither has happened. */
3081
+ since_seq: number;
3082
+ /** How many of the job's runs reported no cost, and so count nothing. */
3083
+ uncounted_runs: number;
3084
+ };
3085
+ }
3086
+
3087
+ /** `message.handed` — 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. */
3088
+ export interface MessageHanded {
3089
+ /** Protocol major version. */
3090
+ v: 1;
3091
+ type: "message.handed";
3092
+ /** The event's own id. Stable across a retry of the same event. */
3093
+ id: string;
3094
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3095
+ ts: string;
3096
+ /** A workspace identifier: `ws_` followed by a ULID. */
3097
+ workspace_id: string;
3098
+ /** The space, when the event belongs to one. */
3099
+ space_id?: string;
3100
+ /** The run, when the event belongs to one. */
3101
+ run_id?: string;
3102
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3103
+ seq?: number;
3104
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3105
+ idempotency_key?: string;
3106
+ /** The participant an event is attributed to. */
3107
+ actor: {
3108
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3109
+ kind: "person" | "harness" | "agent" | "system";
3110
+ /** The participant id, or `system` for Chips. */
3111
+ id: string;
3112
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3113
+ harness_id?: string;
3114
+ };
3115
+ /** The message, as `message.new` named it. */
3116
+ message_id: string;
3117
+ /** Who it is handed to. */
3118
+ agent_id: string;
3119
+ /** 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. */
3120
+ lead?: true;
3121
+ }
3122
+
3123
+ /** `space.lead_set` — A room's lead was chosen, or taken away. */
3124
+ export interface SpaceLeadSet {
3125
+ /** Protocol major version. */
3126
+ v: 1;
3127
+ type: "space.lead_set";
3128
+ /** The event's own id. Stable across a retry of the same event. */
3129
+ id: string;
3130
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3131
+ ts: string;
3132
+ /** A workspace identifier: `ws_` followed by a ULID. */
3133
+ workspace_id: string;
3134
+ /** The space, when the event belongs to one. */
3135
+ space_id?: string;
3136
+ /** The run, when the event belongs to one. */
3137
+ run_id?: string;
3138
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3139
+ seq?: number;
3140
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3141
+ idempotency_key?: string;
3142
+ /** The participant an event is attributed to. */
3143
+ actor: {
3144
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3145
+ kind: "person" | "harness" | "agent" | "system";
3146
+ /** The participant id, or `system` for Chips. */
3147
+ id: string;
3148
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3149
+ harness_id?: string;
3150
+ };
3151
+ /** The agent that leads the room now, or `null` when nobody does. */
3152
+ agent_id: string | null;
3153
+ }
3154
+
3155
+ /** `space.spend_ceiling_set` — What a room allows a job to spend was set, or set back to the default. */
3156
+ export interface SpaceSpendCeilingSet {
3157
+ /** Protocol major version. */
3158
+ v: 1;
3159
+ type: "space.spend_ceiling_set";
3160
+ /** The event's own id. Stable across a retry of the same event. */
3161
+ id: string;
3162
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3163
+ ts: string;
3164
+ /** A workspace identifier: `ws_` followed by a ULID. */
3165
+ workspace_id: string;
3166
+ /** The space, when the event belongs to one. */
3167
+ space_id?: string;
3168
+ /** The run, when the event belongs to one. */
3169
+ run_id?: string;
3170
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3171
+ seq?: number;
3172
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3173
+ idempotency_key?: string;
3174
+ /** The participant an event is attributed to. */
3175
+ actor: {
3176
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3177
+ kind: "person" | "harness" | "agent" | "system";
3178
+ /** The participant id, or `system` for Chips. */
3179
+ id: string;
3180
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3181
+ harness_id?: string;
3182
+ };
3183
+ /** 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). */
3184
+ usd: unknown;
3185
+ }
3186
+
3187
+ /** `space.lock_set` — A room's changes were locked, or let go: while locked, no person renames, archives or deletes it. */
3188
+ export interface SpaceLockSet {
3189
+ /** Protocol major version. */
3190
+ v: 1;
3191
+ type: "space.lock_set";
3192
+ /** The event's own id. Stable across a retry of the same event. */
3193
+ id: string;
3194
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3195
+ ts: string;
3196
+ /** A workspace identifier: `ws_` followed by a ULID. */
3197
+ workspace_id: string;
3198
+ /** The space, when the event belongs to one. */
3199
+ space_id?: string;
3200
+ /** The run, when the event belongs to one. */
3201
+ run_id?: string;
3202
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3203
+ seq?: number;
3204
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3205
+ idempotency_key?: string;
3206
+ /** The participant an event is attributed to. */
3207
+ actor: {
3208
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3209
+ kind: "person" | "harness" | "agent" | "system";
3210
+ /** The participant id, or `system` for Chips. */
3211
+ id: string;
3212
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3213
+ harness_id?: string;
3214
+ };
3215
+ /** Whether the room's changes are locked now. `false` is how every room starts, and lets them go again. */
3216
+ locked: boolean;
3217
+ }
3218
+
3219
+ /** `turn.passed` — An agent answered that it had nothing to say: nothing is shown or handed on. */
3220
+ export interface TurnPassed {
3221
+ /** Protocol major version. */
3222
+ v: 1;
3223
+ type: "turn.passed";
3224
+ /** The event's own id. Stable across a retry of the same event. */
3225
+ id: string;
3226
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3227
+ ts: string;
3228
+ /** A workspace identifier: `ws_` followed by a ULID. */
3229
+ workspace_id: string;
3230
+ /** The space, when the event belongs to one. */
3231
+ space_id?: string;
3232
+ /** The run, when the event belongs to one. */
3233
+ run_id?: string;
3234
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3235
+ seq?: number;
3236
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3237
+ idempotency_key?: string;
3238
+ /** The participant an event is attributed to. */
3239
+ actor: {
3240
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3241
+ kind: "person" | "harness" | "agent" | "system";
3242
+ /** The participant id, or `system` for Chips. */
3243
+ id: string;
3244
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3245
+ harness_id?: string;
3246
+ };
3247
+ /** The message it was answering, when its post said. */
3248
+ reply_to?: string;
3249
+ }
3250
+
3251
+ /** `context.compacted` — An agent's context compacted, as its harness said: one quiet line in its room. */
3252
+ export interface ContextCompacted {
3253
+ /** Protocol major version. */
3254
+ v: 1;
3255
+ type: "context.compacted";
3256
+ /** The event's own id. Stable across a retry of the same event. */
3257
+ id: string;
3258
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3259
+ ts: string;
3260
+ /** A workspace identifier: `ws_` followed by a ULID. */
3261
+ workspace_id: string;
3262
+ /** The space, when the event belongs to one. */
3263
+ space_id?: string;
3264
+ /** The run, when the event belongs to one. */
3265
+ run_id?: string;
3266
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3267
+ seq?: number;
3268
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3269
+ idempotency_key?: string;
3270
+ /** The participant an event is attributed to. */
3271
+ actor: {
3272
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3273
+ kind: "person" | "harness" | "agent" | "system";
3274
+ /** The participant id, or `system` for Chips. */
3275
+ id: string;
3276
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3277
+ harness_id?: string;
3278
+ };
3279
+ /** The tokens it held before. */
3280
+ from: number;
3281
+ /** The tokens it held after. */
3282
+ to: number;
3283
+ /** Its model's context window, in tokens. */
3284
+ window: number;
3285
+ /** `asked`: a person asked. `itself`: at its limit, or full. */
3286
+ by: "asked" | "itself";
3287
+ }
3288
+
3289
+ /** `attachment.fetched` — A harness downloaded an attachment. Every fetch is an audit event: “Scout read IMG_2210.jpg”. */
3290
+ export interface AttachmentFetched {
3291
+ /** Protocol major version. */
3292
+ v: 1;
3293
+ type: "attachment.fetched";
3294
+ /** The event's own id. Stable across a retry of the same event. */
3295
+ id: string;
3296
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3297
+ ts: string;
3298
+ /** A workspace identifier: `ws_` followed by a ULID. */
3299
+ workspace_id: string;
3300
+ /** The space, when the event belongs to one. */
3301
+ space_id?: string;
3302
+ /** The run, when the event belongs to one. */
3303
+ run_id?: string;
3304
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3305
+ seq?: number;
3306
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3307
+ idempotency_key?: string;
3308
+ /** The participant an event is attributed to. */
3309
+ actor: {
3310
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3311
+ kind: "person" | "harness" | "agent" | "system";
3312
+ /** The participant id, or `system` for Chips. */
3313
+ id: string;
3314
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3315
+ harness_id?: string;
3316
+ };
3317
+ /** A attachment identifier: `att_` followed by a ULID. */
3318
+ attachment_id: string;
3319
+ /** What the file was called when it was sent. */
3320
+ filename: string;
3321
+ /** The harness that fetched it. Recorded by Chips. */
3322
+ by: string;
3323
+ }
3324
+
3325
+ /** `project.changed` — Somebody's push moved the room's project forward: who, which commits, and the files they changed. */
3326
+ export interface ProjectChanged {
3327
+ /** Protocol major version. */
3328
+ v: 1;
3329
+ type: "project.changed";
3330
+ /** The event's own id. Stable across a retry of the same event. */
3331
+ id: string;
3332
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3333
+ ts: string;
3334
+ /** A workspace identifier: `ws_` followed by a ULID. */
3335
+ workspace_id: string;
3336
+ /** The space, when the event belongs to one. */
3337
+ space_id?: string;
3338
+ /** The run, when the event belongs to one. */
3339
+ run_id?: string;
3340
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3341
+ seq?: number;
3342
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3343
+ idempotency_key?: string;
3344
+ /** The participant an event is attributed to. */
3345
+ actor: {
3346
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3347
+ kind: "person" | "harness" | "agent" | "system";
3348
+ /** The participant id, or `system` for Chips. */
3349
+ id: string;
3350
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3351
+ harness_id?: string;
3352
+ };
3353
+ /** Who pushed: the agent a harness named, or the person. Recorded by Chips. */
3354
+ by: string;
3355
+ /** Where `main` was, or `null` for the project's first push. */
3356
+ before: string | null;
3357
+ /** Where `main` is now. */
3358
+ after: string;
3359
+ /** How many commits the push added to `main`. */
3360
+ commits: number;
3361
+ /** The first line of the newest commit's message. */
3362
+ message: string;
3363
+ /** What changed between `before` and `after`, in path order. */
3364
+ files: {
3365
+ /** Its path in the project, with `/` between folders. */
3366
+ path: string;
3367
+ /** Lines added; `null` for a binary file. */
3368
+ added: number | null;
3369
+ /** Lines removed; `null` for a binary file. */
3370
+ removed: number | null;
3371
+ }[];
3372
+ /** How many more files changed than are named. */
3373
+ more_files?: number;
3374
+ /** How many files `main` has now, for the room sheet's Project tile (ADR 0222). */
3375
+ file_count?: number;
3376
+ /** The change this one takes back, when it is a person's Undo, or Put it back's Undo of an Undo (ADR 0222). */
3377
+ undoes?: string;
3378
+ }
3379
+
3380
+ /** `person.joined` — A person joined the workspace: by an invite, or as its first person. Their role starts here. */
3381
+ export interface PersonJoined {
3382
+ /** Protocol major version. */
3383
+ v: 1;
3384
+ type: "person.joined";
3385
+ /** The event's own id. Stable across a retry of the same event. */
3386
+ id: string;
3387
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3388
+ ts: string;
3389
+ /** A workspace identifier: `ws_` followed by a ULID. */
3390
+ workspace_id: string;
3391
+ /** The space, when the event belongs to one. */
3392
+ space_id?: string;
3393
+ /** The run, when the event belongs to one. */
3394
+ run_id?: string;
3395
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3396
+ seq?: number;
3397
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3398
+ idempotency_key?: string;
3399
+ /** The participant an event is attributed to. */
3400
+ actor: {
3401
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3402
+ kind: "person" | "harness" | "agent" | "system";
3403
+ /** The participant id, or `system` for Chips. */
3404
+ id: string;
3405
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3406
+ harness_id?: string;
3407
+ };
3408
+ /** Who joined. */
3409
+ participant_id: string;
3410
+ /** Their name, so a screen needs no lookup. */
3411
+ display_name: string;
3412
+ /** Owner, admin, member or guest of the workspace: what a person may do here. */
3413
+ role: "owner" | "admin" | "member" | "guest";
3414
+ /** The invite they redeemed, when they came by one. Never the invite itself. */
3415
+ invite_id?: string;
3416
+ /** Who issued that invite. */
3417
+ invited_by?: string;
3418
+ }
3419
+
3420
+ /** `person.renamed` — A person changed the name they go by. What they said stays theirs, under the new name; an @ of the old one reaches nobody. */
3421
+ export interface PersonRenamed {
3422
+ /** Protocol major version. */
3423
+ v: 1;
3424
+ type: "person.renamed";
3425
+ /** The event's own id. Stable across a retry of the same event. */
3426
+ id: string;
3427
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3428
+ ts: string;
3429
+ /** A workspace identifier: `ws_` followed by a ULID. */
3430
+ workspace_id: string;
3431
+ /** The space, when the event belongs to one. */
3432
+ space_id?: string;
3433
+ /** The run, when the event belongs to one. */
3434
+ run_id?: string;
3435
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3436
+ seq?: number;
3437
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3438
+ idempotency_key?: string;
3439
+ /** The participant an event is attributed to. */
3440
+ actor: {
3441
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3442
+ kind: "person" | "harness" | "agent" | "system";
3443
+ /** The participant id, or `system` for Chips. */
3444
+ id: string;
3445
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3446
+ harness_id?: string;
3447
+ };
3448
+ /** Who. */
3449
+ participant_id: string;
3450
+ /** What they go by from here. */
3451
+ display_name: string;
3452
+ /** What they went by until now. */
3453
+ previous_name: string;
3454
+ }
3455
+
3456
+ /** `person.face_set` — A person chose the face they wear beside their name, or went back to their initials. Not sent to a harness. */
3457
+ export interface PersonFaceSet {
3458
+ /** Protocol major version. */
3459
+ v: 1;
3460
+ type: "person.face_set";
3461
+ /** The event's own id. Stable across a retry of the same event. */
3462
+ id: string;
3463
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3464
+ ts: string;
3465
+ /** A workspace identifier: `ws_` followed by a ULID. */
3466
+ workspace_id: string;
3467
+ /** The space, when the event belongs to one. */
3468
+ space_id?: string;
3469
+ /** The run, when the event belongs to one. */
3470
+ run_id?: string;
3471
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3472
+ seq?: number;
3473
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3474
+ idempotency_key?: string;
3475
+ /** The participant an event is attributed to. */
3476
+ actor: {
3477
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3478
+ kind: "person" | "harness" | "agent" | "system";
3479
+ /** The participant id, or `system` for Chips. */
3480
+ id: string;
3481
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3482
+ harness_id?: string;
3483
+ };
3484
+ /** Who: a person chooses only their own face. */
3485
+ participant_id: string;
3486
+ /** 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. */
3487
+ face: {
3488
+ icon: string;
3489
+ ground: number;
3490
+ /** One or two letters, or an emoji or two, the face wears on its ground in place of a mark (ADR 0139); the mark is empty beside them. Absent on a face that is a mark, or only a colour. */
3491
+ letters?: string;
3492
+ } | null;
3493
+ }
3494
+
3495
+ /** `role.changed` — An owner or admin changed a person's role in the workspace. */
3496
+ export interface RoleChanged {
3497
+ /** Protocol major version. */
3498
+ v: 1;
3499
+ type: "role.changed";
3500
+ /** The event's own id. Stable across a retry of the same event. */
3501
+ id: string;
3502
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3503
+ ts: string;
3504
+ /** A workspace identifier: `ws_` followed by a ULID. */
3505
+ workspace_id: string;
3506
+ /** The space, when the event belongs to one. */
3507
+ space_id?: string;
3508
+ /** The run, when the event belongs to one. */
3509
+ run_id?: string;
3510
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3511
+ seq?: number;
3512
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3513
+ idempotency_key?: string;
3514
+ /** The participant an event is attributed to. */
3515
+ actor: {
3516
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3517
+ kind: "person" | "harness" | "agent" | "system";
3518
+ /** The participant id, or `system` for Chips. */
3519
+ id: string;
3520
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3521
+ harness_id?: string;
3522
+ };
3523
+ /** Whose role changed. */
3524
+ participant_id: string;
3525
+ /** What it is now. */
3526
+ role: "owner" | "admin" | "member" | "guest";
3527
+ /** Why, for the audit. */
3528
+ reason?: string;
3529
+ }
3530
+
3531
+ /** `harness.transferred` — A harness was handed to another person, who is accountable for it from here: its approvals default to them, and its tokens are theirs. */
3532
+ export interface HarnessTransferred {
3533
+ /** Protocol major version. */
3534
+ v: 1;
3535
+ type: "harness.transferred";
3536
+ /** The event's own id. Stable across a retry of the same event. */
3537
+ id: string;
3538
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3539
+ ts: string;
3540
+ /** A workspace identifier: `ws_` followed by a ULID. */
3541
+ workspace_id: string;
3542
+ /** The space, when the event belongs to one. */
3543
+ space_id?: string;
3544
+ /** The run, when the event belongs to one. */
3545
+ run_id?: string;
3546
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3547
+ seq?: number;
3548
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3549
+ idempotency_key?: string;
3550
+ /** The participant an event is attributed to. */
3551
+ actor: {
3552
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3553
+ kind: "person" | "harness" | "agent" | "system";
3554
+ /** The participant id, or `system` for Chips. */
3555
+ id: string;
3556
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3557
+ harness_id?: string;
3558
+ };
3559
+ /** The harness handed over. */
3560
+ harness_id: string;
3561
+ /** Who owned it until now. */
3562
+ from_owner_id: string;
3563
+ /** Who owns it from here. */
3564
+ to_owner_id: string;
3565
+ /** Why, for the audit. */
3566
+ reason?: string;
3567
+ }
3568
+
3569
+ /** `harness.removed` — 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. */
3570
+ export interface HarnessRemoved {
3571
+ /** Protocol major version. */
3572
+ v: 1;
3573
+ type: "harness.removed";
3574
+ /** The event's own id. Stable across a retry of the same event. */
3575
+ id: string;
3576
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3577
+ ts: string;
3578
+ /** A workspace identifier: `ws_` followed by a ULID. */
3579
+ workspace_id: string;
3580
+ /** The space, when the event belongs to one. */
3581
+ space_id?: string;
3582
+ /** The run, when the event belongs to one. */
3583
+ run_id?: string;
3584
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3585
+ seq?: number;
3586
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3587
+ idempotency_key?: string;
3588
+ /** The participant an event is attributed to. */
3589
+ actor: {
3590
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3591
+ kind: "person" | "harness" | "agent" | "system";
3592
+ /** The participant id, or `system` for Chips. */
3593
+ id: string;
3594
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3595
+ harness_id?: string;
3596
+ };
3597
+ /** The harness removed. */
3598
+ harness_id: string;
3599
+ /** What it was called when it was removed, so the audit needs no lookup. */
3600
+ display_name: string;
3601
+ /** 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. */
3602
+ homes?: string[];
3603
+ /** Why, for the audit. */
3604
+ reason?: string;
3605
+ }
3606
+
3607
+ /** `person.removed` — 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. */
3608
+ export interface PersonRemoved {
3609
+ /** Protocol major version. */
3610
+ v: 1;
3611
+ type: "person.removed";
3612
+ /** The event's own id. Stable across a retry of the same event. */
3613
+ id: string;
3614
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3615
+ ts: string;
3616
+ /** A workspace identifier: `ws_` followed by a ULID. */
3617
+ workspace_id: string;
3618
+ /** The space, when the event belongs to one. */
3619
+ space_id?: string;
3620
+ /** The run, when the event belongs to one. */
3621
+ run_id?: string;
3622
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3623
+ seq?: number;
3624
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3625
+ idempotency_key?: string;
3626
+ /** The participant an event is attributed to. */
3627
+ actor: {
3628
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3629
+ kind: "person" | "harness" | "agent" | "system";
3630
+ /** The participant id, or `system` for Chips. */
3631
+ id: string;
3632
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3633
+ harness_id?: string;
3634
+ };
3635
+ /** Who was removed. */
3636
+ participant_id: string;
3637
+ /** What they were called when they were removed, so the audit needs no lookup. */
3638
+ display_name: string;
3639
+ /** The owner or admin who removed them, or they themselves when they deleted their account (ADR 0243). */
3640
+ removed_by: string;
3641
+ /** The rooms they were taken out of, each with its own `membership.removed`. */
3642
+ spaces?: string[];
3643
+ /** The harnesses they owned, each handed on by `harness.transferred`: to `removed_by`, or, for an account deleted, to an owner. */
3644
+ harnesses?: string[];
3645
+ }
3646
+
3647
+ /** `join.allowed` — A person let a harness or a device in by a join request, with what they allowed it to do. */
3648
+ export interface JoinAllowed {
3649
+ /** Protocol major version. */
3650
+ v: 1;
3651
+ type: "join.allowed";
3652
+ /** The event's own id. Stable across a retry of the same event. */
3653
+ id: string;
3654
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3655
+ ts: string;
3656
+ /** A workspace identifier: `ws_` followed by a ULID. */
3657
+ workspace_id: string;
3658
+ /** The space, when the event belongs to one. */
3659
+ space_id?: string;
3660
+ /** The run, when the event belongs to one. */
3661
+ run_id?: string;
3662
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3663
+ seq?: number;
3664
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3665
+ idempotency_key?: string;
3666
+ /** The participant an event is attributed to. */
3667
+ actor: {
3668
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3669
+ kind: "person" | "harness" | "agent" | "system";
3670
+ /** The participant id, or `system` for Chips. */
3671
+ id: string;
3672
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3673
+ harness_id?: string;
3674
+ };
3675
+ /** The request. */
3676
+ request_id: string;
3677
+ /** A harness asking for a key; a device asking to be paired; a person joining by an invite, or a device pairing by a code, that waits for whoever handed it out (ADR 0232). */
3678
+ kind: "harness" | "device" | "invite" | "pairing";
3679
+ /** Who started it: the requester, with a code to compare, or a person, with a link that is allowed already. */
3680
+ started_by: "requester" | "person";
3681
+ /** What the requester called itself. */
3682
+ name?: string;
3683
+ /** Its software, as it said. */
3684
+ software?: string;
3685
+ /** Its machine, as it said. */
3686
+ machine?: string;
3687
+ /** The address it asked from. */
3688
+ from_addr?: string;
3689
+ /** Who decided: allowed it, refused it, or made the link. */
3690
+ by: string;
3691
+ /** What the harness may do: what was granted, which may be less than it asked. */
3692
+ capabilities: string[];
3693
+ /** The harness made, when a link was redeemed. A code allowed makes it at its poll. */
3694
+ harness_id?: string;
3695
+ /** The device paired, when it was a link's. */
3696
+ device_id?: string;
3697
+ /** Whom a device is paired as, when an owner chose somebody already here whose phone is new (ADR 0206). */
3698
+ pair_as?: string;
3699
+ }
3700
+
3701
+ /** `join.denied` — A person refused a join request, or withdrew a link they had made. */
3702
+ export interface JoinDenied {
3703
+ /** Protocol major version. */
3704
+ v: 1;
3705
+ type: "join.denied";
3706
+ /** The event's own id. Stable across a retry of the same event. */
3707
+ id: string;
3708
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3709
+ ts: string;
3710
+ /** A workspace identifier: `ws_` followed by a ULID. */
3711
+ workspace_id: string;
3712
+ /** The space, when the event belongs to one. */
3713
+ space_id?: string;
3714
+ /** The run, when the event belongs to one. */
3715
+ run_id?: string;
3716
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3717
+ seq?: number;
3718
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3719
+ idempotency_key?: string;
3720
+ /** The participant an event is attributed to. */
3721
+ actor: {
3722
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3723
+ kind: "person" | "harness" | "agent" | "system";
3724
+ /** The participant id, or `system` for Chips. */
3725
+ id: string;
3726
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3727
+ harness_id?: string;
3728
+ };
3729
+ /** The request. */
3730
+ request_id: string;
3731
+ /** A harness asking for a key; a device asking to be paired; a person joining by an invite, or a device pairing by a code, that waits for whoever handed it out (ADR 0232). */
3732
+ kind: "harness" | "device" | "invite" | "pairing";
3733
+ /** Who started it: the requester, with a code to compare, or a person, with a link that is allowed already. */
3734
+ started_by: "requester" | "person";
3735
+ /** What the requester called itself. */
3736
+ name?: string;
3737
+ /** Its software, as it said. */
3738
+ software?: string;
3739
+ /** Its machine, as it said. */
3740
+ machine?: string;
3741
+ /** The address it asked from. */
3742
+ from_addr?: string;
3743
+ /** Who decided: allowed it, refused it, or made the link. */
3744
+ by: string;
3745
+ }
3746
+
3747
+ /** `message.edited` — A message's author changed its words. The log keeps both; the room shows the latest, marked edited. */
3748
+ export interface MessageEdited {
3749
+ /** Protocol major version. */
3750
+ v: 1;
3751
+ type: "message.edited";
3752
+ /** The event's own id. Stable across a retry of the same event. */
3753
+ id: string;
3754
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3755
+ ts: string;
3756
+ /** A workspace identifier: `ws_` followed by a ULID. */
3757
+ workspace_id: string;
3758
+ /** The space, when the event belongs to one. */
3759
+ space_id?: string;
3760
+ /** The run, when the event belongs to one. */
3761
+ run_id?: string;
3762
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3763
+ seq?: number;
3764
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3765
+ idempotency_key?: string;
3766
+ /** The participant an event is attributed to. */
3767
+ actor: {
3768
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3769
+ kind: "person" | "harness" | "agent" | "system";
3770
+ /** The participant id, or `system` for Chips. */
3771
+ id: string;
3772
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3773
+ harness_id?: string;
3774
+ };
3775
+ /** The message, which must be the sender's own. */
3776
+ message_id: string;
3777
+ /** The new text, Markdown as before. */
3778
+ text: string;
3779
+ }
3780
+
3781
+ /** `message.deleted` — 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. */
3782
+ export interface MessageDeleted {
3783
+ /** Protocol major version. */
3784
+ v: 1;
3785
+ type: "message.deleted";
3786
+ /** The event's own id. Stable across a retry of the same event. */
3787
+ id: string;
3788
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3789
+ ts: string;
3790
+ /** A workspace identifier: `ws_` followed by a ULID. */
3791
+ workspace_id: string;
3792
+ /** The space, when the event belongs to one. */
3793
+ space_id?: string;
3794
+ /** The run, when the event belongs to one. */
3795
+ run_id?: string;
3796
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3797
+ seq?: number;
3798
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3799
+ idempotency_key?: string;
3800
+ /** The participant an event is attributed to. */
3801
+ actor: {
3802
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3803
+ kind: "person" | "harness" | "agent" | "system";
3804
+ /** The participant id, or `system` for Chips. */
3805
+ id: string;
3806
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3807
+ harness_id?: string;
3808
+ };
3809
+ /** A message identifier: `msg_` followed by a ULID. */
3810
+ message_id: string;
3811
+ /** Why, for the audit. */
3812
+ reason?: string;
3813
+ }
3814
+
3815
+ /** `message.hidden` — 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. */
3816
+ export interface MessageHidden {
3817
+ /** Protocol major version. */
3818
+ v: 1;
3819
+ type: "message.hidden";
3820
+ /** The event's own id. Stable across a retry of the same event. */
3821
+ id: string;
3822
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3823
+ ts: string;
3824
+ /** A workspace identifier: `ws_` followed by a ULID. */
3825
+ workspace_id: string;
3826
+ /** The space, when the event belongs to one. */
3827
+ space_id?: string;
3828
+ /** The run, when the event belongs to one. */
3829
+ run_id?: string;
3830
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3831
+ seq?: number;
3832
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3833
+ idempotency_key?: string;
3834
+ /** The participant an event is attributed to. */
3835
+ actor: {
3836
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3837
+ kind: "person" | "harness" | "agent" | "system";
3838
+ /** The participant id, or `system` for Chips. */
3839
+ id: string;
3840
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3841
+ harness_id?: string;
3842
+ };
3843
+ /** Any message in the space: the person's own or anyone's. */
3844
+ message_id: string;
3845
+ }
3846
+
3847
+ /** `message.shown` — 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. */
3848
+ export interface MessageShown {
3849
+ /** Protocol major version. */
3850
+ v: 1;
3851
+ type: "message.shown";
3852
+ /** The event's own id. Stable across a retry of the same event. */
3853
+ id: string;
3854
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3855
+ ts: string;
3856
+ /** A workspace identifier: `ws_` followed by a ULID. */
3857
+ workspace_id: string;
3858
+ /** The space, when the event belongs to one. */
3859
+ space_id?: string;
3860
+ /** The run, when the event belongs to one. */
3861
+ run_id?: string;
3862
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3863
+ seq?: number;
3864
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3865
+ idempotency_key?: string;
3866
+ /** The participant an event is attributed to. */
3867
+ actor: {
3868
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3869
+ kind: "person" | "harness" | "agent" | "system";
3870
+ /** The participant id, or `system` for Chips. */
3871
+ id: string;
3872
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3873
+ harness_id?: string;
3874
+ };
3875
+ /** A message identifier: `msg_` followed by a ULID. */
3876
+ message_id: string;
3877
+ }
3878
+
3879
+ /** `message.pinned` — A message was pinned to the top of its space, by somebody in it who is not a guest. */
3880
+ export interface MessagePinned {
3881
+ /** Protocol major version. */
3882
+ v: 1;
3883
+ type: "message.pinned";
3884
+ /** The event's own id. Stable across a retry of the same event. */
3885
+ id: string;
3886
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3887
+ ts: string;
3888
+ /** A workspace identifier: `ws_` followed by a ULID. */
3889
+ workspace_id: string;
3890
+ /** The space, when the event belongs to one. */
3891
+ space_id?: string;
3892
+ /** The run, when the event belongs to one. */
3893
+ run_id?: string;
3894
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3895
+ seq?: number;
3896
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3897
+ idempotency_key?: string;
3898
+ /** The participant an event is attributed to. */
3899
+ actor: {
3900
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3901
+ kind: "person" | "harness" | "agent" | "system";
3902
+ /** The participant id, or `system` for Chips. */
3903
+ id: string;
3904
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3905
+ harness_id?: string;
3906
+ };
3907
+ /** A message identifier: `msg_` followed by a ULID. */
3908
+ message_id: string;
3909
+ }
3910
+
3911
+ /** `message.unpinned` — A pinned message was let go. */
3912
+ export interface MessageUnpinned {
3913
+ /** Protocol major version. */
3914
+ v: 1;
3915
+ type: "message.unpinned";
3916
+ /** The event's own id. Stable across a retry of the same event. */
3917
+ id: string;
3918
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3919
+ ts: string;
3920
+ /** A workspace identifier: `ws_` followed by a ULID. */
3921
+ workspace_id: string;
3922
+ /** The space, when the event belongs to one. */
3923
+ space_id?: string;
3924
+ /** The run, when the event belongs to one. */
3925
+ run_id?: string;
3926
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3927
+ seq?: number;
3928
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3929
+ idempotency_key?: string;
3930
+ /** The participant an event is attributed to. */
3931
+ actor: {
3932
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3933
+ kind: "person" | "harness" | "agent" | "system";
3934
+ /** The participant id, or `system` for Chips. */
3935
+ id: string;
3936
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3937
+ harness_id?: string;
3938
+ };
3939
+ /** A message identifier: `msg_` followed by a ULID. */
3940
+ message_id: string;
3941
+ }
3942
+
3943
+ /** `approval.routed` — 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. */
3944
+ export interface ApprovalRouted {
3945
+ /** Protocol major version. */
3946
+ v: 1;
3947
+ type: "approval.routed";
3948
+ /** The event's own id. Stable across a retry of the same event. */
3949
+ id: string;
3950
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
3951
+ ts: string;
3952
+ /** A workspace identifier: `ws_` followed by a ULID. */
3953
+ workspace_id: string;
3954
+ /** The space, when the event belongs to one. */
3955
+ space_id?: string;
3956
+ /** The run, when the event belongs to one. */
3957
+ run_id?: string;
3958
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
3959
+ seq?: number;
3960
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
3961
+ idempotency_key?: string;
3962
+ /** The participant an event is attributed to. */
3963
+ actor: {
3964
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
3965
+ kind: "person" | "harness" | "agent" | "system";
3966
+ /** The participant id, or `system` for Chips. */
3967
+ id: string;
3968
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
3969
+ harness_id?: string;
3970
+ };
3971
+ /** A approval identifier: `apr_` followed by a ULID. */
3972
+ approval_id: string;
3973
+ /** 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. */
3974
+ to: string[];
3975
+ /** Who may answer now, as ids. Filled in by Chips from `to`; a value the sender writes is replaced. */
3976
+ approvers?: string[];
3977
+ /** 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. */
3978
+ ask?: {
3979
+ /** The harness that asked. */
3980
+ harness_id: string;
3981
+ /** The action as the harness proposed it. */
3982
+ action: {
3983
+ kind: string;
3984
+ };
3985
+ /** The risk classes it declared. */
3986
+ risk?: string[];
3987
+ /** When it expires, if it does. */
3988
+ expires_at?: string;
3989
+ };
3990
+ /** Why it was handed on, for the card and the audit. */
3991
+ reason?: string;
3992
+ /** Who handed it on. Filled in by Chips from the credential. */
3993
+ routed_by?: string;
3994
+ /** When. Filled in by Chips from its clock. */
3995
+ routed_at?: string;
3996
+ }
3997
+
3998
+ /** `attachment.limits_set` — 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. */
3999
+ export interface AttachmentLimitsSet {
4000
+ /** Protocol major version. */
4001
+ v: 1;
4002
+ type: "attachment.limits_set";
4003
+ /** The event's own id. Stable across a retry of the same event. */
4004
+ id: string;
4005
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
4006
+ ts: string;
4007
+ /** A workspace identifier: `ws_` followed by a ULID. */
4008
+ workspace_id: string;
4009
+ /** The space, when the event belongs to one. */
4010
+ space_id?: string;
4011
+ /** The run, when the event belongs to one. */
4012
+ run_id?: string;
4013
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
4014
+ seq?: number;
4015
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
4016
+ idempotency_key?: string;
4017
+ /** The participant an event is attributed to. */
4018
+ actor: {
4019
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
4020
+ kind: "person" | "harness" | "agent" | "system";
4021
+ /** The participant id, or `system` for Chips. */
4022
+ id: string;
4023
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
4024
+ harness_id?: string;
4025
+ };
4026
+ /** The most a photo may be, in bytes. `null` leaves it to the server's own limit. */
4027
+ image_bytes: number | null;
4028
+ /** The most a video may be, in bytes, or `null`. */
4029
+ video_bytes: number | null;
4030
+ /** The most anything else may be — a document, an archive, a voice note — or `null`. */
4031
+ file_bytes: number | null;
4032
+ }
4033
+
4034
+ /** `exchange.limits_set` — 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. */
4035
+ export interface ExchangeLimitsSet {
4036
+ /** Protocol major version. */
4037
+ v: 1;
4038
+ type: "exchange.limits_set";
4039
+ /** The event's own id. Stable across a retry of the same event. */
4040
+ id: string;
4041
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
4042
+ ts: string;
4043
+ /** A workspace identifier: `ws_` followed by a ULID. */
4044
+ workspace_id: string;
4045
+ /** The space, when the event belongs to one. */
4046
+ space_id?: string;
4047
+ /** The run, when the event belongs to one. */
4048
+ run_id?: string;
4049
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
4050
+ seq?: number;
4051
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
4052
+ idempotency_key?: string;
4053
+ /** The participant an event is attributed to. */
4054
+ actor: {
4055
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
4056
+ kind: "person" | "harness" | "agent" | "system";
4057
+ /** The participant id, or `system` for Chips. */
4058
+ id: string;
4059
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
4060
+ harness_id?: string;
4061
+ };
4062
+ /** 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. */
4063
+ stop: number | null;
4064
+ /** After how many Chips holds their messages to each other until a person acts. `null`: never, by count; a pause still holds them. */
4065
+ hold: number | null;
4066
+ /** 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. */
4067
+ circles: boolean;
4068
+ }
4069
+
4070
+ /** `workspace.renamed` — An owner named the workspace again. Every device connected changes its name at once; one that connects later is told by the hello. */
4071
+ export interface WorkspaceRenamed {
4072
+ /** Protocol major version. */
4073
+ v: 1;
4074
+ type: "workspace.renamed";
4075
+ /** The event's own id. Stable across a retry of the same event. */
4076
+ id: string;
4077
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
4078
+ ts: string;
4079
+ /** A workspace identifier: `ws_` followed by a ULID. */
4080
+ workspace_id: string;
4081
+ /** The space, when the event belongs to one. */
4082
+ space_id?: string;
4083
+ /** The run, when the event belongs to one. */
4084
+ run_id?: string;
4085
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
4086
+ seq?: number;
4087
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
4088
+ idempotency_key?: string;
4089
+ /** The participant an event is attributed to. */
4090
+ actor: {
4091
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
4092
+ kind: "person" | "harness" | "agent" | "system";
4093
+ /** The participant id, or `system` for Chips. */
4094
+ id: string;
4095
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
4096
+ harness_id?: string;
4097
+ };
4098
+ /** What the workspace is called from here. */
4099
+ name: string;
4100
+ /** What it was called until now. */
4101
+ previous_name: string;
4102
+ }
4103
+
4104
+ /** `relay.set` — 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. */
4105
+ export interface RelaySet {
4106
+ /** Protocol major version. */
4107
+ v: 1;
4108
+ type: "relay.set";
4109
+ /** The event's own id. Stable across a retry of the same event. */
4110
+ id: string;
4111
+ /** When it happened, by Chips' clock. Stamped on the way in; a value the sender writes is replaced. */
4112
+ ts: string;
4113
+ /** A workspace identifier: `ws_` followed by a ULID. */
4114
+ workspace_id: string;
4115
+ /** The space, when the event belongs to one. */
4116
+ space_id?: string;
4117
+ /** The run, when the event belongs to one. */
4118
+ run_id?: string;
4119
+ /** Assigned by the server on append, monotonic per workspace. Absent on the way in. */
4120
+ seq?: number;
4121
+ /** Required on every client-originated write. Sending the same key twice is a no-op. */
4122
+ idempotency_key?: string;
4123
+ /** The participant an event is attributed to. */
4124
+ actor: {
4125
+ /** Whether a person, a harness, one of a harness's agents or Chips itself acted. */
4126
+ kind: "person" | "harness" | "agent" | "system";
4127
+ /** The participant id, or `system` for Chips. */
4128
+ id: string;
4129
+ /** For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips. */
4130
+ harness_id?: string;
4131
+ };
4132
+ /** Whether the server dials its relay from now. */
4133
+ on: boolean;
4134
+ }
4135
+
4136
+ /** Any event a harness sends to Chips. */
4137
+ export type HarnessToChipsEvent =
4138
+ | SessionStarted
4139
+ | SessionEnded
4140
+ | SessionRenamed
4141
+ | RunStarted
4142
+ | RunStatus
4143
+ | RunPlan
4144
+ | StepLog
4145
+ | MessagePost
4146
+ | MessageHeard
4147
+ | ApprovalRequest
4148
+ | QuestionAsk
4149
+ | ArtifactCreate
4150
+ | Checkpoint
4151
+ | Handoff
4152
+ | Task
4153
+ | Usage
4154
+ | ContextUsage
4155
+ | ApprovalExecuted
4156
+ | RunCompleted
4157
+ | RunFailed;
4158
+
4159
+ /** Any event Chips sends to a harness. */
4160
+ export type ChipsToHarnessEvent =
4161
+ | Hello
4162
+ | MessageNew
4163
+ | MessageOverheard
4164
+ | RunRequested
4165
+ | ApprovalResolved
4166
+ | QuestionAnswered
4167
+ | RunSteer
4168
+ | RunPause
4169
+ | RunResume
4170
+ | RunCancel
4171
+ | PolicyUpdated
4172
+ | BudgetWarning
4173
+ | LaneUpdated
4174
+ | Feedback
4175
+ | Receipt;
4176
+
4177
+ /** Any Agent Connect event. */
4178
+ export type AnyEvent = HarnessToChipsEvent | ChipsToHarnessEvent;