@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,81 @@
1
+ /**
2
+ * `@chipschat/protocol` is Agent Connect. The Zod schemas here are canonical (decision 7): the
3
+ * JSON Schema in `generated/`, the TypeScript types, the documentation reference and the
4
+ * fixtures every layer's tests read are all produced from them by `pnpm gen:protocol`.
5
+ *
6
+ * It depends on `zod` and nothing else, so an SDK built on it stays light.
7
+ */
8
+ export type * from "../generated/types.js";
9
+ export type { Address, AddressInput } from "./address.js";
10
+ export { isAgentKind, resolveAddress, takersOf } from "./address.js";
11
+ export type { AgentContextWindowCopy, AgentContextWindowPut, AgentContextWindowView, CompactionState, CompactionView, LastCompaction, LongTurn, WindowChangeFrame, WindowChangeState, WindowChangeView, WindowCompactFrame, WindowLimit, WindowLimitAsk, } from "./agent-context-windows.js";
12
+ export { agentContextWindowPut, agentContextWindowView, COMPACTED_BY, COMPACTION_STATES, compactionState, compactionView, LONG_TURN_FOLDS_MAX, lastCompaction, longTurn, WINDOW_ASK_WAIT_MS, WINDOW_CHANGE_STATES, WINDOW_LIMIT_CHOICES_MAX, windowChangeFrame, windowChangeState, windowChangeView, windowCompactFrame, windowLimit, windowLimitAsk, } from "./agent-context-windows.js";
13
+ export type { AgentHeartbeatCopy, AgentHeartbeatPut, AgentHeartbeatView, HeartbeatChangeAsk, HeartbeatChangeFrame, HeartbeatChangeState, HeartbeatChangeView, } from "./agent-heartbeats.js";
14
+ export { agentHeartbeatPut, agentHeartbeatView, HEARTBEAT_CHANGE_STATES, HEARTBEAT_CHANGE_WAIT_MS, HEARTBEAT_CHOICES_MAX, HEARTBEAT_EVERY_MAX, heartbeatChangeAsk, heartbeatChangeFrame, heartbeatChangeState, heartbeatChangeView, } from "./agent-heartbeats.js";
15
+ export type { AgentModelCopy, AgentModelPut, AgentModelView, EffortLevel, ModelChangeAsk, ModelChangeFrame, ModelChangeState, ModelChangeView, ModelChoice, ModelDefault, } from "./agent-models.js";
16
+ export { agentModelPut, agentModelView, EFFORT_LEVELS_MAX, effortFits, effortLevel, MODEL_CHANGE_STATES, MODEL_CHANGE_WAIT_MS, MODEL_CHOICES_MAX, modelChangeAsk, modelChangeFrame, modelChangeState, modelChangeView, modelChoice, modelDefault, } from "./agent-models.js";
17
+ export type { AgentPlacement, PlaceRefusal, PlaceRoom } from "./agent-place.js";
18
+ export { ONE_ROOM_REFUSALS, refuseAgentInto, STOPPED_BECAUSE } from "./agent-place.js";
19
+ export type { LegacyView } from "./agents.js";
20
+ export { AGENT_EVENTS, inLegacyView } from "./agents.js";
21
+ export type { HarnessCapability } from "./capabilities.js";
22
+ export { FORK_WAIT_MS, HARNESS_CAPABILITIES, NEW_AGENT_WAIT_MS, RESTART_WAIT_MS, } from "./capabilities.js";
23
+ export type { ChecklistRow } from "./checklist.js";
24
+ export { CONNECTION_CHECKLIST } from "./checklist.js";
25
+ export type { CommandParts, StandingOffer } from "./commands.js";
26
+ export { askedCommand, commandParts, commandStarts, NEVER_STANDING, neverStanding, standingOffer, startOf, startsWith, } from "./commands.js";
27
+ export type { Connector, ConnectorKind, ConnectorsAnswer, ServerFacts } from "./connectors.js";
28
+ export { CONNECTORS_MAX, connector, connectorKind, connectorsAnswer, fillLink, LINK_SLOT, readConnectors, serverFacts, } from "./connectors.js";
29
+ export type { ContextBudget, ContextEvent, ContextLine, ReplyingTo, ReplyReading, RoomContext, Who, } from "./context.js";
30
+ export { budgetOf, CONTEXT_BUDGET, CONTEXT_CEILING, CONTEXT_HEADING, contextBudget, contextLine, contextLines, linesOf, quoteOf, quotesBefore, REPLY_BEFORE_HEADING, REPLY_BEFORE_LINES, REPLY_QUOTE_CHARS, renderAttachment, renderContext, renderLine, renderReplyingTo, replyingTo, roomContext, withRole, } from "./context.js";
31
+ export type { AgentContextPut, AgentContextView, ContextEditAsk, ContextEditFrame, ContextEditState, ContextEditView, ContextFile, ContextRole, HarnessContextPut, HarnessContextView, NotShownFile, SharedContextFile, } from "./context-files.js";
32
+ export { agentContextPut, agentContextView, CONTEXT_EDIT_STATES, CONTEXT_EDIT_WAIT_MS, CONTEXT_FILE_BYTES, CONTEXT_FILES_SHOWN, CONTEXT_NOT_SHOWN_MAX, CONTEXT_ROLES, contextBytes, contextEditAsk, contextEditFrame, contextEditState, contextEditView, contextFile, contextRole, harnessContextPut, harnessContextView, notShownFile, STALE_CONTEXT, sharedContextFile, } from "./context-files.js";
33
+ export { type DirectAskView, directAskState, directAskView, SHARE_LINK_MAX, shareLinkOf, } from "./direct-asks.js";
34
+ export type { Direction, Envelope, EventDefinition, EventSender } from "./envelope.js";
35
+ export { defineEvent, envelope, eventSchema, PROTOCOL_VERSION } from "./envelope.js";
36
+ export * from "./events/index.js";
37
+ export type { DeliveredExchange, ExchangeFacts, ExchangeLimits, ExchangeMessage, ExchangeRepeat, ExchangeReset, ExchangeStage, ExchangeStretch, } from "./exchange.js";
38
+ export { CEILING, circleIn, DEFAULT_EXCHANGE_LIMITS, deliveredExchange, exchangeFacts, exchangeFactsOf, exchangeLimitsOf, exchangeReset, exchangeStage, HOLD_CHOICES, HOLD_RANGE, holds, limitsProblem, NUDGE_AT, nudgeAt, PERSON_ACTS, renderExchangeNote, repeatOf, resetsTheCount, STOP_CHOICES, STOP_RANGE, stageOf, WARN_AT, WORK_ACTS, wordsFor, } from "./exchange.js";
39
+ export { AGENT_FIRST_NAMES, mayHoldName, pickAgentName } from "./first-names.js";
40
+ export type { AgentState, ClientFrame, ErrorCode, FolderOpenFrame, FolderRunFrame, FolderRunStateFrame, ServerExtension, ServerFrame, } from "./frames.js";
41
+ export { ackFrame, agentState, clientFrame, clientHelloFrame, errorCode, errorFrame, eventFrame, eventsFrame, FRAME_NAMES, folderOpenFrame, folderRunFrame, folderRunStateFrame, joinFrame, negotiateProtocol, pingFrame, pongFrame, presenceFrame, receiptFrame, restartFrame, SERVER_EXTENSIONS, serverFrame, subscribeFrame, } from "./frames.js";
42
+ export type { HarnessJob, HarnessJobsCopy, HarnessJobsPut, HarnessJobsView, HarnessJobView, JobChangeAsk, JobChangeFrame, JobChangeState, JobChangeView, JobKind, JobRun, JobRunOutcome, JobRunsPost, JobRunsView, } from "./harness-jobs.js";
43
+ export { HARNESS_JOBS_MAX, harnessJob, harnessJobsPut, harnessJobsView, harnessJobView, JOB_CHANGE_STATES, JOB_CHANGE_WAIT_MS, JOB_CHOICES_MAX, JOB_EVERY_MAX, JOB_KINDS, JOB_RUN_OUTCOMES, JOB_RUNS_KEPT_DAYS, JOB_RUNS_POST_MAX, JOB_RUNS_READ_MAX, jobChangeAsk, jobChangeFrame, jobChangeState, jobChangeView, jobId, jobKind, jobRun, jobRunOutcome, jobRunsPost, jobRunsView, } from "./harness-jobs.js";
44
+ export type { Id, IdGenerator, IdGeneratorOptions, IdKind, IdPrefix } from "./ids/index.js";
45
+ export { createIdGenerator, defaultIdGenerator, eventIdOfMessage, ID_PREFIXES, InvalidIdError, isId, messageIdOf, newId, parseId, timestampOf, } from "./ids/index.js";
46
+ export type { InviteLink, InviteReach } from "./invite-link.js";
47
+ export { inviteAppUrl, inviteFromLink, inviteRelayUrl, inviteUrl, RELAY_INVITE_PATH, } from "./invite-link.js";
48
+ export type { JoinAsk, JoinAsked, JoinedDevice, JoinedHarness, JoinKind, JoinRequestView, JoinStartedBy, JoinState, LinkWaiting, } from "./join.js";
49
+ export { GRANTABLE, isLinkKind, JOIN_ASKS_PER_MINUTE, JOIN_CODE_SECONDS, JOIN_LINK_SECONDS, JOIN_POLL_SECONDS, JOIN_WAITING_MAX, joinAsk, joinAsked, joinedDevice, joinedHarness, joinKind, joinLink, joinPending, joinRequestView, joinStartedBy, joinState, keyCode, keyCodeShown, LINK_KINDS, linkWaiting, parseJoinLink, } from "./join.js";
50
+ export type { AttachmentCaps, CapKind } from "./limits.js";
51
+ export { attachmentCap, CAP_KINDS, CAP_WORDS, capKind, capsOverCeiling, formatLimit, kindFromName, LONGEST_VOICE_NOTE_MS, NO_CAPS, sizeRefusal, } from "./limits.js";
52
+ export type { ActionFlags } from "./matters.js";
53
+ export { actionMatters, HOT_RISK } from "./matters.js";
54
+ export type { Mentionable } from "./mentions.js";
55
+ export { EVERYONE_HANDLE, handleMap, handlesIn, handlesOf, isHandle, mentionPattern, mentionsEveryone, resolveMentions, } from "./mentions.js";
56
+ export { clashKey, FIRST_PERSON_NAME, freeAgentName, HIDDEN_CHARACTER_WORDS, isFormOf, MAX_NAME, MIXED_LETTERS_WORDS, NOT_AN_AGENT_WORDS, nameProblem, notAnAgentName, withoutHidden, } from "./names.js";
57
+ export { isNoReply, NO_REPLY, passIfNothingSaid } from "./no-reply.js";
58
+ export type { HarnessNotifications, NotificationSettings, QuietHours, SpaceNotifications, } from "./notifications.js";
59
+ export { DEFAULT_NOTIFICATION_SETTINGS, harnessNotifications, notificationSettings, parseNotificationSettings, quietHours, spaceNotifications, timeOfDay, } from "./notifications.js";
60
+ export { HTML_POLICY, PAGE_HEADER_POLICY, PAGE_SANDBOX } from "./pages.js";
61
+ export type { PairingOffer, PairingPayload } from "./pairing.js";
62
+ export { appPairingUrl, PAIRING_VERSION, pairingCode, pairingCodeTyped, pairingFromLink, pairingFromUrl, pairingPayload, pairingUrl, pairRelayUrl, RELAY_PAIR_PATH, serverKey, } from "./pairing.js";
63
+ export type { Action, Actor, Attachment, AutonomyLevel, Budget, Cost, ParticipantKind, ParticipantRef, Policy, PolicyRule, Preview, RiskClass, SignedAttachment, Source, StepKind, TrailEntry, } from "./primitives.js";
64
+ export { action, actor, agentId, approverRef, attachment, autonomyLevel, budget, cost, id, isoTimestamp, MAX_TRANSCRIPT_LENGTH, memberId, PARTICIPANT_KINDS, participantRef, policy, policyRule, preview, riskClass, signedAttachment, source, stepKind, trailEntry, } from "./primitives.js";
65
+ export type { HeldRun, ProjectChangeAnswer, ProjectFacts, ProjectFilesAnswer, ProjectFolderOpenAnswer, ProjectHistoryAnswer, ProjectRun, ProjectRunAnswer, ProjectToken, ProjectUndoAnswer, RunRecipe, } from "./project.js";
66
+ export { CHIPS_FOLDER, commandOf, commitId, committerId, FILE_LINK, heldRun, isSecretsFile, namesInWords, opensAProgram, opensShown, PROJECT_ACTOR_HEADER, PROJECT_BRANCH, PROJECT_CHANGED_FILES, PROJECT_GIT_VERSION, PROJECT_LEAVE_OUT, PROJECT_TOKEN_PREFIX, PROJECT_TOKEN_TTL_SECONDS, projectChangedFile, projectChangedPayload, projectFileType, projectFolderOpenAnswer, projectPath, projectRequest, projectRun, projectRunAnswer, projectToken, RUN_FILE, RUN_FILE_BEFORE, renderProjectAsks, renderProjectFacts, renderProjectNote, runRecipe, SECRET_SHAPES, SECRETS_FILE, START_PAGE, secretIn, } from "./project.js";
67
+ export type { RangeAnswer } from "./ranges.js";
68
+ export { byteRange, contentRange } from "./ranges.js";
69
+ export type { CandidateAddress, RelayErrorCode, RelayFrame, RelayFrameName } from "./relay.js";
70
+ export { candidateAddress, candidateAddresses, parseRelayFrame, RELAY_ERROR_CODES, RELAY_SESSION_ID_BYTES, RELAY_VERSION, relayChallengeFrame, relayCloseFrame, relayConnectedFrame, relayConnectFrame, relayErrorFrame, relayFrame, relayOpenFrame, relayServeFrame, relayServingFrame, relaySessionId, TUNNEL_DOOR_PATH, } from "./relay.js";
71
+ export type { FileVersion, MadeFrom, PostedFile, RoomFile, StaleRefusal, } from "./room-files.js";
72
+ export { currentFiles, ROOM_FILES_CEILING, ROOM_FILES_HEADING, ROOM_FILES_IN_CONTEXT, renderRoomFiles, roomFile, roomFiles, STALE_FILE, staleRefusal, staleVersion, staleWords, versionsNamed, versionsOf, } from "./room-files.js";
73
+ export type { NoteMember, RoomIdle, RoomMember, RoomNote, RoomNow, RoomWork, TakerNews, } from "./room-note.js";
74
+ export { noteHandle, noteWithoutRules, renderRoomNote, roomIdle, roomMember, roomMembers, roomNote, roomNoteFor, roomRules, roomWork, toEveryAgent, yoursWithoutAt, } from "./room-note.js";
75
+ export type { SpaceIcon, SpaceIcons } from "./space-icons.js";
76
+ export { faceLetters, lettersIn, lettersScale, MOST_FACE_LETTERS, parseSpaceIcon, SPACE_ICON_GROUNDS, spaceIcon, } from "./space-icons.js";
77
+ export type { JobSpend, SpendStage } from "./spend.js";
78
+ export { DEFAULT_SPEND_CEILING_USD, dollars, isSpendCeiling, jobSpend, SPEND_CEILING_MAX, SPEND_CEILING_MIN, SPEND_CEILING_STEP, SPEND_WARN_AT, spendCeiling, spendStage, spendWords, } from "./spend.js";
79
+ export type { SeenEvent, Viewer } from "./visibility.js";
80
+ export { APPROVER_EVENTS, ASK_EVENTS, canSee, DIRECTORY_EVENTS, FACE_EVENTS, FORK_EVENTS, HELD_EVENTS, JOIN_EVENTS, LOCK_EVENTS, MEMBERSHIP_EVENTS, namesApprover, namesViewer, opensFor, opensThreadIn, SELF_EVENTS, WHEREABOUTS_EVENTS, } from "./visibility.js";
81
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mBAAmB,uBAAuB,CAAC;AAC3C,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrE,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,cAAc,EACd,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,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AAW,EACX,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,QAAQ,EACR,aAAa,EACb,WAAW,EACX,kBAAkB,GACnB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * `@chipschat/protocol` is Agent Connect. The Zod schemas here are canonical (decision 7): the
3
+ * JSON Schema in `generated/`, the TypeScript types, the documentation reference and the
4
+ * fixtures every layer's tests read are all produced from them by `pnpm gen:protocol`.
5
+ *
6
+ * It depends on `zod` and nothing else, so an SDK built on it stays light.
7
+ */
8
+ export { isAgentKind, resolveAddress, takersOf } from "./address.js";
9
+ export { agentContextWindowPut, agentContextWindowView, COMPACTED_BY, COMPACTION_STATES, compactionState, compactionView, LONG_TURN_FOLDS_MAX, lastCompaction, longTurn, WINDOW_ASK_WAIT_MS, WINDOW_CHANGE_STATES, WINDOW_LIMIT_CHOICES_MAX, windowChangeFrame, windowChangeState, windowChangeView, windowCompactFrame, windowLimit, windowLimitAsk, } from "./agent-context-windows.js";
10
+ export { agentHeartbeatPut, agentHeartbeatView, HEARTBEAT_CHANGE_STATES, HEARTBEAT_CHANGE_WAIT_MS, HEARTBEAT_CHOICES_MAX, HEARTBEAT_EVERY_MAX, heartbeatChangeAsk, heartbeatChangeFrame, heartbeatChangeState, heartbeatChangeView, } from "./agent-heartbeats.js";
11
+ export { agentModelPut, agentModelView, EFFORT_LEVELS_MAX, effortFits, effortLevel, MODEL_CHANGE_STATES, MODEL_CHANGE_WAIT_MS, MODEL_CHOICES_MAX, modelChangeAsk, modelChangeFrame, modelChangeState, modelChangeView, modelChoice, modelDefault, } from "./agent-models.js";
12
+ export { ONE_ROOM_REFUSALS, refuseAgentInto, STOPPED_BECAUSE } from "./agent-place.js";
13
+ export { AGENT_EVENTS, inLegacyView } from "./agents.js";
14
+ export { FORK_WAIT_MS, HARNESS_CAPABILITIES, NEW_AGENT_WAIT_MS, RESTART_WAIT_MS, } from "./capabilities.js";
15
+ export { CONNECTION_CHECKLIST } from "./checklist.js";
16
+ export { askedCommand, commandParts, commandStarts, NEVER_STANDING, neverStanding, standingOffer, startOf, startsWith, } from "./commands.js";
17
+ export { CONNECTORS_MAX, connector, connectorKind, connectorsAnswer, fillLink, LINK_SLOT, readConnectors, serverFacts, } from "./connectors.js";
18
+ export { budgetOf, CONTEXT_BUDGET, CONTEXT_CEILING, CONTEXT_HEADING, contextBudget, contextLine, contextLines, linesOf, quoteOf, quotesBefore, REPLY_BEFORE_HEADING, REPLY_BEFORE_LINES, REPLY_QUOTE_CHARS, renderAttachment, renderContext, renderLine, renderReplyingTo, replyingTo, roomContext, withRole, } from "./context.js";
19
+ export { agentContextPut, agentContextView, CONTEXT_EDIT_STATES, CONTEXT_EDIT_WAIT_MS, CONTEXT_FILE_BYTES, CONTEXT_FILES_SHOWN, CONTEXT_NOT_SHOWN_MAX, CONTEXT_ROLES, contextBytes, contextEditAsk, contextEditFrame, contextEditState, contextEditView, contextFile, contextRole, harnessContextPut, harnessContextView, notShownFile, STALE_CONTEXT, sharedContextFile, } from "./context-files.js";
20
+ export { directAskState, directAskView, SHARE_LINK_MAX, shareLinkOf, } from "./direct-asks.js";
21
+ export { defineEvent, envelope, eventSchema, PROTOCOL_VERSION } from "./envelope.js";
22
+ export * from "./events/index.js";
23
+ export { CEILING, circleIn, DEFAULT_EXCHANGE_LIMITS, deliveredExchange, exchangeFacts, exchangeFactsOf, exchangeLimitsOf, exchangeReset, exchangeStage, HOLD_CHOICES, HOLD_RANGE, holds, limitsProblem, NUDGE_AT, nudgeAt, PERSON_ACTS, renderExchangeNote, repeatOf, resetsTheCount, STOP_CHOICES, STOP_RANGE, stageOf, WARN_AT, WORK_ACTS, wordsFor, } from "./exchange.js";
24
+ export { AGENT_FIRST_NAMES, mayHoldName, pickAgentName } from "./first-names.js";
25
+ export { ackFrame, agentState, clientFrame, clientHelloFrame, errorCode, errorFrame, eventFrame, eventsFrame, FRAME_NAMES, folderOpenFrame, folderRunFrame, folderRunStateFrame, joinFrame, negotiateProtocol, pingFrame, pongFrame, presenceFrame, receiptFrame, restartFrame, SERVER_EXTENSIONS, serverFrame, subscribeFrame, } from "./frames.js";
26
+ export { HARNESS_JOBS_MAX, harnessJob, harnessJobsPut, harnessJobsView, harnessJobView, JOB_CHANGE_STATES, JOB_CHANGE_WAIT_MS, JOB_CHOICES_MAX, JOB_EVERY_MAX, JOB_KINDS, JOB_RUN_OUTCOMES, JOB_RUNS_KEPT_DAYS, JOB_RUNS_POST_MAX, JOB_RUNS_READ_MAX, jobChangeAsk, jobChangeFrame, jobChangeState, jobChangeView, jobId, jobKind, jobRun, jobRunOutcome, jobRunsPost, jobRunsView, } from "./harness-jobs.js";
27
+ export { createIdGenerator, defaultIdGenerator, eventIdOfMessage, ID_PREFIXES, InvalidIdError, isId, messageIdOf, newId, parseId, timestampOf, } from "./ids/index.js";
28
+ export { inviteAppUrl, inviteFromLink, inviteRelayUrl, inviteUrl, RELAY_INVITE_PATH, } from "./invite-link.js";
29
+ export { GRANTABLE, isLinkKind, JOIN_ASKS_PER_MINUTE, JOIN_CODE_SECONDS, JOIN_LINK_SECONDS, JOIN_POLL_SECONDS, JOIN_WAITING_MAX, joinAsk, joinAsked, joinedDevice, joinedHarness, joinKind, joinLink, joinPending, joinRequestView, joinStartedBy, joinState, keyCode, keyCodeShown, LINK_KINDS, linkWaiting, parseJoinLink, } from "./join.js";
30
+ export { attachmentCap, CAP_KINDS, CAP_WORDS, capKind, capsOverCeiling, formatLimit, kindFromName, LONGEST_VOICE_NOTE_MS, NO_CAPS, sizeRefusal, } from "./limits.js";
31
+ export { actionMatters, HOT_RISK } from "./matters.js";
32
+ export { EVERYONE_HANDLE, handleMap, handlesIn, handlesOf, isHandle, mentionPattern, mentionsEveryone, resolveMentions, } from "./mentions.js";
33
+ export { clashKey, FIRST_PERSON_NAME, freeAgentName, HIDDEN_CHARACTER_WORDS, isFormOf, MAX_NAME, MIXED_LETTERS_WORDS, NOT_AN_AGENT_WORDS, nameProblem, notAnAgentName, withoutHidden, } from "./names.js";
34
+ export { isNoReply, NO_REPLY, passIfNothingSaid } from "./no-reply.js";
35
+ export { DEFAULT_NOTIFICATION_SETTINGS, harnessNotifications, notificationSettings, parseNotificationSettings, quietHours, spaceNotifications, timeOfDay, } from "./notifications.js";
36
+ export { HTML_POLICY, PAGE_HEADER_POLICY, PAGE_SANDBOX } from "./pages.js";
37
+ export { appPairingUrl, PAIRING_VERSION, pairingCode, pairingCodeTyped, pairingFromLink, pairingFromUrl, pairingPayload, pairingUrl, pairRelayUrl, RELAY_PAIR_PATH, serverKey, } from "./pairing.js";
38
+ export { action, actor, agentId, approverRef, attachment, autonomyLevel, budget, cost, id, isoTimestamp, MAX_TRANSCRIPT_LENGTH, memberId, PARTICIPANT_KINDS, participantRef, policy, policyRule, preview, riskClass, signedAttachment, source, stepKind, trailEntry, } from "./primitives.js";
39
+ export { CHIPS_FOLDER, commandOf, commitId, committerId, FILE_LINK, heldRun, isSecretsFile, namesInWords, opensAProgram, opensShown, PROJECT_ACTOR_HEADER, PROJECT_BRANCH, PROJECT_CHANGED_FILES, PROJECT_GIT_VERSION, PROJECT_LEAVE_OUT, PROJECT_TOKEN_PREFIX, PROJECT_TOKEN_TTL_SECONDS, projectChangedFile, projectChangedPayload, projectFileType, projectFolderOpenAnswer, projectPath, projectRequest, projectRun, projectRunAnswer, projectToken, RUN_FILE, RUN_FILE_BEFORE, renderProjectAsks, renderProjectFacts, renderProjectNote, runRecipe, SECRET_SHAPES, SECRETS_FILE, START_PAGE, secretIn, } from "./project.js";
40
+ export { byteRange, contentRange } from "./ranges.js";
41
+ export { candidateAddress, candidateAddresses, parseRelayFrame, RELAY_ERROR_CODES, RELAY_SESSION_ID_BYTES, RELAY_VERSION, relayChallengeFrame, relayCloseFrame, relayConnectedFrame, relayConnectFrame, relayErrorFrame, relayFrame, relayOpenFrame, relayServeFrame, relayServingFrame, relaySessionId, TUNNEL_DOOR_PATH, } from "./relay.js";
42
+ export { currentFiles, ROOM_FILES_CEILING, ROOM_FILES_HEADING, ROOM_FILES_IN_CONTEXT, renderRoomFiles, roomFile, roomFiles, STALE_FILE, staleRefusal, staleVersion, staleWords, versionsNamed, versionsOf, } from "./room-files.js";
43
+ export { noteHandle, noteWithoutRules, renderRoomNote, roomIdle, roomMember, roomMembers, roomNote, roomNoteFor, roomRules, roomWork, toEveryAgent, yoursWithoutAt, } from "./room-note.js";
44
+ export { faceLetters, lettersIn, lettersScale, MOST_FACE_LETTERS, parseSpaceIcon, SPACE_ICON_GROUNDS, spaceIcon, } from "./space-icons.js";
45
+ export { DEFAULT_SPEND_CEILING_USD, dollars, isSpendCeiling, jobSpend, SPEND_CEILING_MAX, SPEND_CEILING_MIN, SPEND_CEILING_STEP, SPEND_WARN_AT, spendCeiling, spendStage, spendWords, } from "./spend.js";
46
+ export { APPROVER_EVENTS, ASK_EVENTS, canSee, DIRECTORY_EVENTS, FACE_EVENTS, FORK_EVENTS, HELD_EVENTS, JOIN_EVENTS, LOCK_EVENTS, MEMBERSHIP_EVENTS, namesApprover, namesViewer, opensFor, opensThreadIn, SELF_EVENTS, WHEREABOUTS_EVENTS, } from "./visibility.js";
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAgBrE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,4BAA4B,CAAC;AAUpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,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AAM,iBAAiB,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * An invite as a link carries it (ADR 0164): the token, and beside it what an app needs to reach
3
+ * the server, as a pairing code's QR carries them (ADR 0038): the server's tunnel key, which the
4
+ * tunnel door on its network answers to (ADR 0191), and the relay the server dials out to when it
5
+ * has one, for an app that is not on that network. Two shapes:
6
+ *
7
+ * https://host/#invite=chips_inv_…&relay=wss://…&key=… the server's page, which a browser opens
8
+ * chips://join?invite=chips_inv_…&lan=https://host&key=… the apps' own, from "Open in Chips"
9
+ *
10
+ * And a third, the one sent when the server has a relay (ADR 0207): the relay's page, `/join`,
11
+ * which opens from anywhere and opens the iPhone app.
12
+ *
13
+ * The page's link names its server by its origin; the apps' link and the relay's have another
14
+ * origin or none, so the server travels as `lan`. In the fragment rather than the query, as a pairing code's is: a
15
+ * fragment never reaches a server's log, and the token is a key to the workspace.
16
+ *
17
+ * Read with a plain split rather than `new URL`: React Native's `URL` stops a hash at its first
18
+ * `/`, and a relay's address in the fragment has several (`apps/mobile/src/pairing/scanned.ts`).
19
+ */
20
+ /** An invite in a link: the token, and where its server is when the link says. */
21
+ export interface InviteLink {
22
+ readonly token: string;
23
+ /** The server on its network: the page's origin, or `lan` in the apps' link. */
24
+ readonly lan?: string | undefined;
25
+ /** The server's tunnel key (ADR 0191): what the tunnel door and the relay both answer to. */
26
+ readonly key?: string | undefined;
27
+ /** The relay the server dials out to, when it has one. Never without the key to ask for there. */
28
+ readonly relay?: string | undefined;
29
+ }
30
+ /** What a link carries beside the token. */
31
+ export interface InviteReach {
32
+ readonly relay?: string | undefined;
33
+ readonly key?: string | undefined;
34
+ }
35
+ /** The link a person is sent: the server's page, with the invite in its fragment. */
36
+ export declare function inviteUrl(base: string, token: string, invite?: InviteReach): string;
37
+ /** Where an invite opens at a relay (ADR 0207): its page, and the path the iPhone app claims. */
38
+ export declare const RELAY_INVITE_PATH = "/join";
39
+ /**
40
+ * The link a person is sent when the server has a relay (ADR 0207): the relay's own page, with the
41
+ * invite in its fragment and the server beside it as `lan`, as the apps' link carries it. The
42
+ * relay is on the open internet where the server may not be, so the link opens for everybody, and
43
+ * on an iPhone with Chips it opens the app. The fragment never reaches the relay. `lan` is the
44
+ * server's origin, as the server's own page link named it. `until` is when the link runs out, in
45
+ * seconds, so the page can say so, as the pairing page does (ADR 0210).
46
+ *
47
+ * https://relay.chipschat.ai/join#invite=chips_inv_…&lan=https://host&relay=wss://…&key=…&until=…
48
+ */
49
+ export declare function inviteRelayUrl(relay: string, token: string, invite: {
50
+ readonly lan: string;
51
+ readonly key: string;
52
+ readonly until?: number | undefined;
53
+ }): string;
54
+ /** The same invite as a link the installed app opens: `chips://join?invite=…&lan=…`. */
55
+ export declare function inviteAppUrl(invite: InviteLink & {
56
+ readonly lan: string;
57
+ }): string;
58
+ /**
59
+ * The invite in a link somebody pasted, scanned or opened: either shape, or the page's with the
60
+ * invite moved to the query by something that rewrote it. Nothing when it carries no invite, which
61
+ * is most of what a camera sees.
62
+ */
63
+ export declare function inviteFromLink(text: string): InviteLink | undefined;
64
+ //# sourceMappingURL=invite-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invite-link.d.ts","sourceRoot":"","sources":["../../src/invite-link.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,kFAAkF;AAClF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gFAAgF;IAChF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,6FAA6F;IAC7F,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,kGAAkG;IAClG,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAaD,qFAAqF;AACrF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,WAAgB,GAAG,MAAM,CAIvF;AAED,iGAAiG;AACjG,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAEzC;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC1F,MAAM,CAQR;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAIlF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAyBnE"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * An invite as a link carries it (ADR 0164): the token, and beside it what an app needs to reach
3
+ * the server, as a pairing code's QR carries them (ADR 0038): the server's tunnel key, which the
4
+ * tunnel door on its network answers to (ADR 0191), and the relay the server dials out to when it
5
+ * has one, for an app that is not on that network. Two shapes:
6
+ *
7
+ * https://host/#invite=chips_inv_…&relay=wss://…&key=… the server's page, which a browser opens
8
+ * chips://join?invite=chips_inv_…&lan=https://host&key=… the apps' own, from "Open in Chips"
9
+ *
10
+ * And a third, the one sent when the server has a relay (ADR 0207): the relay's page, `/join`,
11
+ * which opens from anywhere and opens the iPhone app.
12
+ *
13
+ * The page's link names its server by its origin; the apps' link and the relay's have another
14
+ * origin or none, so the server travels as `lan`. In the fragment rather than the query, as a pairing code's is: a
15
+ * fragment never reaches a server's log, and the token is a key to the workspace.
16
+ *
17
+ * Read with a plain split rather than `new URL`: React Native's `URL` stops a hash at its first
18
+ * `/`, and a relay's address in the fragment has several (`apps/mobile/src/pairing/scanned.ts`).
19
+ */
20
+ /**
21
+ * What a link carries beside the token. A key alone is carried: the tunnel door on the server's
22
+ * network needs nothing else (ADR 0191). A relay rides only with a key, since a relay without the
23
+ * key to ask for there reaches nothing.
24
+ */
25
+ function reach(fields, invite) {
26
+ if (invite.key === undefined || invite.key === "")
27
+ return;
28
+ if (invite.relay !== undefined && invite.relay !== "")
29
+ fields.set("relay", invite.relay);
30
+ fields.set("key", invite.key);
31
+ }
32
+ /** The link a person is sent: the server's page, with the invite in its fragment. */
33
+ export function inviteUrl(base, token, invite = {}) {
34
+ const fields = new URLSearchParams({ invite: token });
35
+ reach(fields, invite);
36
+ return `${base.replace(/\/$/, "")}/#${fields.toString()}`;
37
+ }
38
+ /** Where an invite opens at a relay (ADR 0207): its page, and the path the iPhone app claims. */
39
+ export const RELAY_INVITE_PATH = "/join";
40
+ /**
41
+ * The link a person is sent when the server has a relay (ADR 0207): the relay's own page, with the
42
+ * invite in its fragment and the server beside it as `lan`, as the apps' link carries it. The
43
+ * relay is on the open internet where the server may not be, so the link opens for everybody, and
44
+ * on an iPhone with Chips it opens the app. The fragment never reaches the relay. `lan` is the
45
+ * server's origin, as the server's own page link named it. `until` is when the link runs out, in
46
+ * seconds, so the page can say so, as the pairing page does (ADR 0210).
47
+ *
48
+ * https://relay.chipschat.ai/join#invite=chips_inv_…&lan=https://host&relay=wss://…&key=…&until=…
49
+ */
50
+ export function inviteRelayUrl(relay, token, invite) {
51
+ const page = /^https?:\/\/[^/?#]+/i.exec(relay.replace(/^ws(s?):\/\//i, "http$1://"))?.[0];
52
+ if (page === undefined)
53
+ throw new Error(`not a relay's address: ${relay}`);
54
+ const lan = /^https?:\/\/[^/?#]+/i.exec(invite.lan)?.[0] ?? invite.lan.replace(/\/$/, "");
55
+ const fields = new URLSearchParams({ invite: token, lan });
56
+ reach(fields, { relay, key: invite.key });
57
+ if (invite.until !== undefined)
58
+ fields.set("until", String(Math.floor(invite.until)));
59
+ return `${page}${RELAY_INVITE_PATH}#${fields.toString()}`;
60
+ }
61
+ /** The same invite as a link the installed app opens: `chips://join?invite=…&lan=…`. */
62
+ export function inviteAppUrl(invite) {
63
+ const fields = new URLSearchParams({ invite: invite.token, lan: invite.lan.replace(/\/$/, "") });
64
+ reach(fields, invite);
65
+ return `chips://join?${fields.toString()}`;
66
+ }
67
+ /**
68
+ * The invite in a link somebody pasted, scanned or opened: either shape, or the page's with the
69
+ * invite moved to the query by something that rewrote it. Nothing when it carries no invite, which
70
+ * is most of what a camera sees.
71
+ */
72
+ export function inviteFromLink(text) {
73
+ // A link copied out of a message may come with the message: the word that holds the invite.
74
+ const trimmed = text.split(/\s+/).find((word) => word.includes("invite=")) ?? "";
75
+ const hashAt = trimmed.indexOf("#");
76
+ const head = hashAt === -1 ? trimmed : trimmed.slice(0, hashAt);
77
+ const queryAt = head.indexOf("?");
78
+ const fragment = new URLSearchParams(hashAt === -1 ? "" : trimmed.slice(hashAt + 1));
79
+ const query = new URLSearchParams(queryAt === -1 ? "" : head.slice(queryAt + 1));
80
+ const field = (name) => {
81
+ const found = query.get(name) ?? fragment.get(name);
82
+ return found === null || found.trim() === "" ? undefined : found.trim();
83
+ };
84
+ const token = field("invite");
85
+ if (token === undefined)
86
+ return undefined;
87
+ const origin = /^https?:\/\/[^/?#]+/.exec(head)?.[0];
88
+ const app = /^chips:/i.test(head);
89
+ const lan = field("lan") ?? (app ? undefined : origin);
90
+ const relay = field("relay");
91
+ const key = field("key");
92
+ return {
93
+ token,
94
+ ...(lan === undefined ? {} : { lan: lan.replace(/\/$/, "") }),
95
+ ...(key === undefined ? {} : { key }),
96
+ ...(relay === undefined || key === undefined ? {} : { relay }),
97
+ };
98
+ }
99
+ //# sourceMappingURL=invite-link.js.map
@@ -0,0 +1 @@
1
+ {"version":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C,CAAC,CAAC,MAAM,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO;QACL,KAAK;QACL,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC;QAC7D,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;QACrC,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;KAC/D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Join requests (ADR 0122): something asks to join Chips, and a person allows it. A harness asks
3
+ * for a key and the room it starts in; a device asks to be paired. No token is copied by hand.
4
+ *
5
+ * Two ways in, one request:
6
+ *
7
+ * - **The requester starts.** It sends `POST /v1/join` with no credential and is answered with a
8
+ * secret, which only it holds, and a short code, which it shows. An owner or admin compares the
9
+ * code, says which of what it asks for it may have, and allows it or not. The requester polls
10
+ * `POST /v1/join/:id/redeem` with the secret and is handed its credential once.
11
+ * - **A person starts.** An owner or admin makes a link, choosing first what the harness may do.
12
+ * The link is `<address>/j/<secret>`, good once, for fifteen minutes; whoever holds it redeems
13
+ * it at `POST /v1/join/redeem`, already allowed.
14
+ *
15
+ * The code is for comparing, not a secret: the 128-bit secret is the credential. Every rule a
16
+ * client draws from — how long each lasts, how many may wait — is named here once, so the server,
17
+ * the apps and the SDK cannot disagree.
18
+ */
19
+ import { z } from "zod";
20
+ /** How long a request a requester started waits for a person: ten minutes. */
21
+ export declare const JOIN_CODE_SECONDS = 600;
22
+ /** How long a link a person made waits for its harness: fifteen minutes. */
23
+ export declare const JOIN_LINK_SECONDS = 900;
24
+ /** Requests waiting for a person at once, on one server. The sixth is refused. */
25
+ export declare const JOIN_WAITING_MAX = 5;
26
+ /** Requests one address may start in a minute. */
27
+ export declare const JOIN_ASKS_PER_MINUTE = 10;
28
+ /**
29
+ * How often a requester asks whether it was allowed, in seconds: twenty a minute, under the thirty
30
+ * a relay lets through a tunnel without a credential.
31
+ */
32
+ export declare const JOIN_POLL_SECONDS = 3;
33
+ export declare const joinKind: z.ZodEnum<{
34
+ harness: "harness";
35
+ device: "device";
36
+ invite: "invite";
37
+ pairing: "pairing";
38
+ }>;
39
+ export type JoinKind = z.infer<typeof joinKind>;
40
+ /** The kinds a link makes, which wait for the one person who handed it out (ADR 0232). */
41
+ export declare const LINK_KINDS: readonly JoinKind[];
42
+ /** Whether a request is a link's, asked of one person: an invite's, or a pairing code's. */
43
+ export declare function isLinkKind(kind: JoinKind): boolean;
44
+ /**
45
+ * The code a link's request shows (ADR 0232): six digits made from the joining device's key, the
46
+ * same on the device and on the Allow sheet, for a person to compare.
47
+ */
48
+ export declare const keyCode: z.ZodString;
49
+ /** Six digits as people read them: two groups of three. */
50
+ export declare function keyCodeShown(code: string): string;
51
+ export declare const joinState: z.ZodEnum<{
52
+ waiting: "waiting";
53
+ allowed: "allowed";
54
+ denied: "denied";
55
+ expired: "expired";
56
+ redeemed: "redeemed";
57
+ }>;
58
+ export type JoinState = z.infer<typeof joinState>;
59
+ export declare const joinStartedBy: z.ZodEnum<{
60
+ person: "person";
61
+ requester: "requester";
62
+ }>;
63
+ export type JoinStartedBy = z.infer<typeof joinStartedBy>;
64
+ /** What a person may grant a harness: every capability a harness may take (ADR 0046). */
65
+ export declare const GRANTABLE: readonly string[];
66
+ /** A request as an owner's or admin's client sees it: never the secret. */
67
+ export declare const joinRequestView: z.ZodObject<{
68
+ request_id: z.ZodString;
69
+ kind: z.ZodEnum<{
70
+ harness: "harness";
71
+ device: "device";
72
+ invite: "invite";
73
+ pairing: "pairing";
74
+ }>;
75
+ state: z.ZodEnum<{
76
+ waiting: "waiting";
77
+ allowed: "allowed";
78
+ denied: "denied";
79
+ expired: "expired";
80
+ redeemed: "redeemed";
81
+ }>;
82
+ started_by: z.ZodEnum<{
83
+ person: "person";
84
+ requester: "requester";
85
+ }>;
86
+ code: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
87
+ name: z.ZodOptional<z.ZodString>;
88
+ software: z.ZodOptional<z.ZodString>;
89
+ machine: z.ZodOptional<z.ZodString>;
90
+ from_addr: z.ZodOptional<z.ZodString>;
91
+ wants: z.ZodArray<z.ZodString>;
92
+ capabilities: z.ZodArray<z.ZodString>;
93
+ url: z.ZodURL;
94
+ decided_by: z.ZodOptional<z.ZodString>;
95
+ decided_at: z.ZodOptional<z.ZodISODateTime>;
96
+ created_at: z.ZodISODateTime;
97
+ expires_at: z.ZodISODateTime;
98
+ harness_id: z.ZodOptional<z.ZodString>;
99
+ space_id: z.ZodOptional<z.ZodString>;
100
+ device_id: z.ZodOptional<z.ZodString>;
101
+ pair_as: z.ZodOptional<z.ZodString>;
102
+ role: z.ZodOptional<z.ZodEnum<{
103
+ owner: "owner";
104
+ member: "member";
105
+ guest: "guest";
106
+ admin: "admin";
107
+ }>>;
108
+ }, z.core.$strip>;
109
+ export type JoinRequestView = z.infer<typeof joinRequestView>;
110
+ /** `POST /v1/join`: what a requester sends. */
111
+ export declare const joinAsk: z.ZodObject<{
112
+ kind: z.ZodDefault<z.ZodEnum<{
113
+ harness: "harness";
114
+ device: "device";
115
+ invite: "invite";
116
+ pairing: "pairing";
117
+ }>>;
118
+ name: z.ZodString;
119
+ software: z.ZodOptional<z.ZodString>;
120
+ machine: z.ZodOptional<z.ZodString>;
121
+ wants: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
+ public_key: z.ZodOptional<z.ZodString>;
123
+ }, z.core.$strip>;
124
+ export type JoinAsk = z.input<typeof joinAsk>;
125
+ /** The answer to `POST /v1/join`. */
126
+ export declare const joinAsked: z.ZodObject<{
127
+ request_id: z.ZodString;
128
+ secret: z.ZodString;
129
+ code: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
130
+ expires_in: z.ZodInt;
131
+ interval: z.ZodInt;
132
+ }, z.core.$strip>;
133
+ export type JoinAsked = z.infer<typeof joinAsked>;
134
+ /**
135
+ * What `POST /v1/invites/redeem` and `POST /v1/pair` answer, `202`, for a link that asks (ADR
136
+ * 0232): a request that waits for the person who handed the link out, polled as a device's is.
137
+ */
138
+ export declare const linkWaiting: z.ZodObject<{
139
+ request_id: z.ZodString;
140
+ secret: z.ZodString;
141
+ expires_in: z.ZodInt;
142
+ interval: z.ZodInt;
143
+ state: z.ZodLiteral<"waiting">;
144
+ code: z.ZodString;
145
+ }, z.core.$strip>;
146
+ export type LinkWaiting = z.infer<typeof linkWaiting>;
147
+ /** What a harness is handed once, when its request is redeemed. */
148
+ export declare const joinedHarness: z.ZodObject<{
149
+ kind: z.ZodLiteral<"harness">;
150
+ url: z.ZodURL;
151
+ harness_id: z.ZodString;
152
+ token: z.ZodString;
153
+ space_id: z.ZodOptional<z.ZodString>;
154
+ capabilities: z.ZodArray<z.ZodString>;
155
+ }, z.core.$strip>;
156
+ export type JoinedHarness = z.infer<typeof joinedHarness>;
157
+ /** What a device is handed once, when its request is redeemed. */
158
+ export declare const joinedDevice: z.ZodObject<{
159
+ kind: z.ZodLiteral<"device">;
160
+ url: z.ZodURL;
161
+ device_id: z.ZodString;
162
+ participant_id: z.ZodString;
163
+ workspace_id: z.ZodString;
164
+ display_name: z.ZodString;
165
+ workspace_name: z.ZodOptional<z.ZodString>;
166
+ server_key: z.ZodOptional<z.ZodString>;
167
+ role: z.ZodOptional<z.ZodEnum<{
168
+ owner: "owner";
169
+ member: "member";
170
+ guest: "guest";
171
+ admin: "admin";
172
+ }>>;
173
+ space_id: z.ZodOptional<z.ZodString>;
174
+ }, z.core.$strip>;
175
+ export type JoinedDevice = z.infer<typeof joinedDevice>;
176
+ /** A poll's answer while the request still waits for a person: ask again in `interval`. */
177
+ export declare const joinPending: z.ZodObject<{
178
+ state: z.ZodLiteral<"waiting">;
179
+ interval: z.ZodInt;
180
+ }, z.core.$strip>;
181
+ /** A link a person hands a harness: the server's address, then `/j/`, then the secret. */
182
+ export declare function joinLink(base: string, secret: string): string;
183
+ /** A link taken apart: where Chips is, and the secret. Nothing when it is not a join link. */
184
+ export declare function parseJoinLink(link: string): {
185
+ url: string;
186
+ secret: string;
187
+ } | undefined;
188
+ //# sourceMappingURL=join.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"join.d.ts","sourceRoot":"","sources":["../../src/join.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,kDAAkD;AAClD,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,eAAO,MAAM,QAAQ;;;;;EAIlB,CAAC;AACJ,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,0FAA0F;AAC1F,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAA0B,CAAC;AAErE,4FAA4F;AAC5F,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAElD;AAED;;;GAGG;AACH,eAAO,MAAM,OAAO,aAA+C,CAAC;AAEpE,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAKD,eAAO,MAAM,SAAS;;;;;;EAInB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