plural-agent 0.2.0__tar.gz → 0.2.2__tar.gz

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 (392) hide show
  1. {plural_agent-0.2.0 → plural_agent-0.2.2}/.github/workflows/ci.yml +3 -0
  2. {plural_agent-0.2.0 → plural_agent-0.2.2}/.gitignore +2 -0
  3. {plural_agent-0.2.0 → plural_agent-0.2.2}/PKG-INFO +14 -4
  4. {plural_agent-0.2.0 → plural_agent-0.2.2}/README.md +11 -3
  5. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/package.json +1 -1
  6. plural_agent-0.2.2/client/src/chat.ts +120 -0
  7. {plural_agent-0.2.0/tui → plural_agent-0.2.2/client}/src/feed.ts +68 -13
  8. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/index.ts +4 -0
  9. plural_agent-0.2.2/client/src/presenter.ts +70 -0
  10. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/projection.ts +14 -0
  11. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/protocol/commands.schema.json +300 -1
  12. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/protocol/commands.ts +113 -0
  13. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/protocol/events.schema.json +445 -1
  14. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/protocol/events.ts +149 -0
  15. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/protocol/index.ts +7 -0
  16. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/reduce.ts +34 -0
  17. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/session.ts +4 -1
  18. plural_agent-0.2.2/client/src/slash.ts +143 -0
  19. {plural_agent-0.2.0/tui/src/lib → plural_agent-0.2.2/client/src}/tools.ts +5 -2
  20. plural_agent-0.2.2/client/test/chat.test.ts +92 -0
  21. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/test/fixtures/golden.json +814 -41
  22. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/test/projection.test.ts +15 -0
  23. plural_agent-0.2.2/client/test/relay.test.ts +70 -0
  24. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/test/session.test.ts +53 -0
  25. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/test/support/host.ts +62 -2
  26. plural_agent-0.2.2/deploy/cloud-init.yaml +15 -0
  27. plural_agent-0.2.2/deploy/host-entrypoint.sh +24 -0
  28. plural_agent-0.2.2/deploy/host.Dockerfile +17 -0
  29. plural_agent-0.2.2/deploy/launchd/dev.plural.host.plist +18 -0
  30. plural_agent-0.2.2/deploy/railway/host.json +5 -0
  31. plural_agent-0.2.2/deploy/railway/relay.json +5 -0
  32. plural_agent-0.2.2/deploy/relay.Dockerfile +11 -0
  33. plural_agent-0.2.2/deploy/systemd/plural-host.service +13 -0
  34. {plural_agent-0.2.0 → plural_agent-0.2.2}/docs/adr/0002-own-harness-official-sdk-providers.md +3 -0
  35. plural_agent-0.2.2/docs/configuration.md +79 -0
  36. {plural_agent-0.2.0 → plural_agent-0.2.2}/docs/development.md +4 -1
  37. plural_agent-0.2.2/docs/protocol.md +35 -0
  38. plural_agent-0.2.2/docs/self-hosting.md +131 -0
  39. {plural_agent-0.2.0 → plural_agent-0.2.2}/docs/threat-model.md +5 -0
  40. plural_agent-0.2.2/docs/usage.md +244 -0
  41. {plural_agent-0.2.0 → plural_agent-0.2.2}/install.sh +36 -5
  42. {plural_agent-0.2.0 → plural_agent-0.2.2}/package-lock.json +5 -4
  43. {plural_agent-0.2.0 → plural_agent-0.2.2}/pyproject.toml +3 -1
  44. plural_agent-0.2.2/render.yaml +24 -0
  45. {plural_agent-0.2.0 → plural_agent-0.2.2}/scripts/gen_fixtures.py +15 -0
  46. plural_agent-0.2.2/src/plural/__init__.py +1 -0
  47. plural_agent-0.2.2/src/plural/agent/context.py +81 -0
  48. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/events.py +14 -0
  49. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/loop.py +192 -23
  50. plural_agent-0.2.2/src/plural/agent/mcp.py +485 -0
  51. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/messages.py +3 -2
  52. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/providers/anthropic_api.py +53 -3
  53. plural_agent-0.2.2/src/plural/agent/providers/anthropic_oauth.py +127 -0
  54. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/providers/base.py +31 -2
  55. plural_agent-0.2.2/src/plural/agent/providers/claude_code.py +374 -0
  56. plural_agent-0.2.2/src/plural/agent/providers/codex_cli.py +598 -0
  57. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/providers/openai_compat.py +28 -0
  58. plural_agent-0.2.2/src/plural/agent/providers/web_search.py +154 -0
  59. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/sandbox/local.py +1 -1
  60. plural_agent-0.2.2/src/plural/agent/skills.py +329 -0
  61. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/base.py +19 -0
  62. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/bash.py +3 -2
  63. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/diffs.py +3 -3
  64. plural_agent-0.2.2/src/plural/agent/tools/edit.py +92 -0
  65. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/read.py +3 -1
  66. plural_agent-0.2.2/src/plural/agent/tools/registry.py +72 -0
  67. plural_agent-0.2.2/src/plural/agent/tools/search.py +102 -0
  68. plural_agent-0.2.2/src/plural/agent/tools/skills.py +133 -0
  69. plural_agent-0.2.2/src/plural/agent/tools/web.py +238 -0
  70. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/write.py +11 -4
  71. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/cli/main.py +163 -21
  72. plural_agent-0.2.2/src/plural/core/chat.py +54 -0
  73. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/policy/engine.py +31 -2
  74. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/policy/rules.py +6 -0
  75. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/roles.py +20 -0
  76. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/state.py +25 -0
  77. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/actor.py +252 -16
  78. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/agent_run.py +26 -7
  79. plural_agent-0.2.2/src/plural/host/attachments.py +35 -0
  80. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/bootstrap.py +164 -7
  81. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/config.py +24 -2
  82. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/control.py +23 -5
  83. plural_agent-0.2.2/src/plural/host/history.py +117 -0
  84. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/inbox.py +22 -0
  85. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/policy_gate.py +7 -1
  86. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/publisher.py +8 -3
  87. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/protocol/commands.py +73 -0
  88. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/protocol/events.py +55 -0
  89. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/protocol/models.py +60 -0
  90. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/relay/app.py +10 -2
  91. plural_agent-0.2.2/src/plural/relay/limits.py +93 -0
  92. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/relay/rooms.py +63 -4
  93. plural_agent-0.2.2/src/plural/storage/sessions.py +104 -0
  94. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/storage/sqlite_store.py +13 -0
  95. plural_agent-0.2.2/tests/conftest.py +13 -0
  96. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/support.py +41 -15
  97. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/test_agent_control.py +8 -4
  98. plural_agent-0.2.2/tests/e2e/test_chat.py +175 -0
  99. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/test_compaction.py +40 -2
  100. plural_agent-0.2.2/tests/e2e/test_history.py +55 -0
  101. plural_agent-0.2.2/tests/e2e/test_mcp.py +86 -0
  102. plural_agent-0.2.2/tests/e2e/test_permission_mode.py +42 -0
  103. plural_agent-0.2.2/tests/e2e/test_relay_recovery.py +112 -0
  104. plural_agent-0.2.2/tests/e2e/test_skills.py +95 -0
  105. plural_agent-0.2.2/tests/fixtures/echo_mcp.py +21 -0
  106. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/harness/test_compaction.py +1 -1
  107. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/harness/test_loop.py +107 -1
  108. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/integration/test_host_flow.py +44 -0
  109. plural_agent-0.2.2/tests/integration/test_relay_limits.py +229 -0
  110. plural_agent-0.2.2/tests/unit/test_anthropic_oauth.py +64 -0
  111. plural_agent-0.2.2/tests/unit/test_attachments.py +18 -0
  112. plural_agent-0.2.2/tests/unit/test_chat.py +193 -0
  113. plural_agent-0.2.2/tests/unit/test_claude_code.py +110 -0
  114. plural_agent-0.2.2/tests/unit/test_cli.py +201 -0
  115. plural_agent-0.2.2/tests/unit/test_codex_cli.py +109 -0
  116. plural_agent-0.2.2/tests/unit/test_context.py +30 -0
  117. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_control.py +27 -1
  118. plural_agent-0.2.2/tests/unit/test_history.py +108 -0
  119. plural_agent-0.2.2/tests/unit/test_mcp.py +202 -0
  120. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_policy.py +31 -2
  121. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_policy_gate.py +11 -1
  122. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_providers.py +79 -0
  123. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_roles.py +5 -1
  124. plural_agent-0.2.2/tests/unit/test_sessions.py +215 -0
  125. plural_agent-0.2.2/tests/unit/test_skills.py +235 -0
  126. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_state.py +9 -0
  127. plural_agent-0.2.2/tests/unit/test_tools.py +107 -0
  128. plural_agent-0.2.2/tests/unit/test_web_search.py +333 -0
  129. plural_agent-0.2.2/tests/unit/test_web_tools.py +105 -0
  130. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/package.json +1 -1
  131. plural_agent-0.2.2/tui/src/App.tsx +932 -0
  132. plural_agent-0.2.2/tui/src/agent.ts +62 -0
  133. plural_agent-0.2.2/tui/src/alerts.ts +24 -0
  134. plural_agent-0.2.2/tui/src/anthropicOAuth.ts +138 -0
  135. plural_agent-0.2.2/tui/src/args.ts +12 -0
  136. plural_agent-0.2.2/tui/src/cli.tsx +332 -0
  137. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/commands.ts +36 -7
  138. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/components/Cards.tsx +85 -16
  139. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/components/Composer.tsx +99 -18
  140. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/components/Inbox.tsx +18 -2
  141. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/components/SettingsDialog.tsx +65 -7
  142. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/components/Sidebar.tsx +23 -2
  143. plural_agent-0.2.2/tui/src/components/Splash.tsx +120 -0
  144. plural_agent-0.2.2/tui/src/components/StatusBar.tsx +62 -0
  145. plural_agent-0.2.2/tui/src/components/Toast.tsx +39 -0
  146. plural_agent-0.2.2/tui/src/components/Tray.tsx +301 -0
  147. plural_agent-0.2.2/tui/src/components/Working.tsx +81 -0
  148. plural_agent-0.2.2/tui/src/feed.ts +13 -0
  149. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/host-process.ts +1 -1
  150. plural_agent-0.2.2/tui/src/joined.ts +53 -0
  151. plural_agent-0.2.2/tui/src/lib/clipboard.ts +90 -0
  152. plural_agent-0.2.2/tui/src/lib/diff.ts +1 -0
  153. plural_agent-0.2.2/tui/src/lib/progress.ts +42 -0
  154. plural_agent-0.2.2/tui/src/lib/tools.ts +13 -0
  155. plural_agent-0.2.2/tui/src/logo.ts +119 -0
  156. plural_agent-0.2.2/tui/src/mcpCatalog.ts +120 -0
  157. plural_agent-0.2.2/tui/src/options.ts +254 -0
  158. plural_agent-0.2.2/tui/src/picker.tsx +133 -0
  159. plural_agent-0.2.2/tui/src/presets.ts +335 -0
  160. plural_agent-0.2.2/tui/src/print.ts +134 -0
  161. plural_agent-0.2.2/tui/src/sessions.ts +97 -0
  162. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/settings.ts +36 -10
  163. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/settingsModel.ts +126 -5
  164. plural_agent-0.2.2/tui/src/share.ts +74 -0
  165. plural_agent-0.2.2/tui/src/startup.ts +53 -0
  166. plural_agent-0.2.2/tui/src/trays.ts +73 -0
  167. plural_agent-0.2.2/tui/src/tunnel.ts +150 -0
  168. plural_agent-0.2.2/tui/src/update.ts +97 -0
  169. plural_agent-0.2.2/tui/test/alerts.test.tsx +73 -0
  170. plural_agent-0.2.2/tui/test/anthropic-oauth.test.ts +56 -0
  171. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/test/app.test.tsx +283 -0
  172. plural_agent-0.2.2/tui/test/args.test.ts +23 -0
  173. plural_agent-0.2.2/tui/test/chat.test.tsx +168 -0
  174. plural_agent-0.2.2/tui/test/commands.test.ts +19 -0
  175. plural_agent-0.2.2/tui/test/headless.test.ts +244 -0
  176. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/test/model-tab.test.tsx +88 -12
  177. plural_agent-0.2.2/tui/test/options.test.ts +134 -0
  178. plural_agent-0.2.2/tui/test/paste.test.tsx +82 -0
  179. plural_agent-0.2.2/tui/test/picker.test.tsx +128 -0
  180. plural_agent-0.2.2/tui/test/print-e2e.test.ts +108 -0
  181. plural_agent-0.2.2/tui/test/resume.test.ts +89 -0
  182. plural_agent-0.2.2/tui/test/sessions.test.ts +106 -0
  183. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/test/settings.test.ts +25 -0
  184. plural_agent-0.2.2/tui/test/share.test.ts +80 -0
  185. plural_agent-0.2.2/tui/test/startup.test.tsx +71 -0
  186. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/test/stores.test.ts +42 -1
  187. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/test/support/fake-session.ts +1 -1
  188. plural_agent-0.2.2/tui/test/toast.test.tsx +95 -0
  189. plural_agent-0.2.2/tui/test/tunnel.test.ts +169 -0
  190. plural_agent-0.2.2/tui/test/update.test.ts +138 -0
  191. {plural_agent-0.2.0 → plural_agent-0.2.2}/uv.lock +491 -0
  192. plural_agent-0.2.2/web/index.html +19 -0
  193. {plural_agent-0.2.0 → plural_agent-0.2.2}/web/package.json +6 -3
  194. plural_agent-0.2.2/web/src/App.tsx +38 -0
  195. plural_agent-0.2.2/web/src/components/Composer.module.css +10 -0
  196. plural_agent-0.2.2/web/src/components/Composer.tsx +121 -0
  197. plural_agent-0.2.2/web/src/components/InviteDialog.module.css +9 -0
  198. plural_agent-0.2.2/web/src/components/InviteDialog.tsx +56 -0
  199. plural_agent-0.2.2/web/src/components/Logo.tsx +127 -0
  200. plural_agent-0.2.2/web/src/components/TopBar.module.css +24 -0
  201. plural_agent-0.2.2/web/src/components/TopBar.tsx +57 -0
  202. plural_agent-0.2.2/web/src/components/feed/Feed.module.css +17 -0
  203. plural_agent-0.2.2/web/src/components/feed/Feed.test.tsx +40 -0
  204. plural_agent-0.2.2/web/src/components/feed/Feed.tsx +82 -0
  205. plural_agent-0.2.2/web/src/components/feed/Markdown.module.css +13 -0
  206. plural_agent-0.2.2/web/src/components/feed/Markdown.test.tsx +29 -0
  207. plural_agent-0.2.2/web/src/components/feed/Markdown.tsx +155 -0
  208. plural_agent-0.2.2/web/src/components/feed/ToolLine.module.css +25 -0
  209. plural_agent-0.2.2/web/src/components/feed/ToolLine.tsx +69 -0
  210. plural_agent-0.2.2/web/src/components/inbox/ApprovalCard.tsx +69 -0
  211. plural_agent-0.2.2/web/src/components/inbox/Inbox.module.css +11 -0
  212. plural_agent-0.2.2/web/src/components/inbox/Inbox.tsx +31 -0
  213. plural_agent-0.2.2/web/src/components/inbox/ProposalCard.tsx +37 -0
  214. plural_agent-0.2.2/web/src/components/inbox/items.ts +17 -0
  215. plural_agent-0.2.2/web/src/components/side/AgentStatus.tsx +25 -0
  216. plural_agent-0.2.2/web/src/components/side/People.tsx +84 -0
  217. plural_agent-0.2.2/web/src/components/side/PromptMode.tsx +28 -0
  218. plural_agent-0.2.2/web/src/components/side/Queue.tsx +34 -0
  219. plural_agent-0.2.2/web/src/components/side/Rules.tsx +25 -0
  220. plural_agent-0.2.2/web/src/components/side/Section.tsx +11 -0
  221. plural_agent-0.2.2/web/src/components/side/Sidebar.module.css +39 -0
  222. plural_agent-0.2.2/web/src/components/side/Sidebar.tsx +36 -0
  223. plural_agent-0.2.2/web/src/hooks/useHotkeys.ts +45 -0
  224. plural_agent-0.2.2/web/src/hooks/useNow.ts +13 -0
  225. plural_agent-0.2.2/web/src/hooks/useSession.ts +165 -0
  226. plural_agent-0.2.2/web/src/hooks/useStickToBottom.ts +34 -0
  227. plural_agent-0.2.2/web/src/hooks/useSubmit.ts +130 -0
  228. plural_agent-0.2.2/web/src/hooks/useToast.ts +27 -0
  229. plural_agent-0.2.2/web/src/hooks/useTyping.ts +53 -0
  230. plural_agent-0.2.2/web/src/lib/alert.test.ts +53 -0
  231. plural_agent-0.2.2/web/src/lib/alert.ts +51 -0
  232. plural_agent-0.2.2/web/src/lib/clipboard.ts +17 -0
  233. plural_agent-0.2.2/web/src/lib/colors.ts +9 -0
  234. plural_agent-0.2.2/web/src/lib/commands.test.ts +20 -0
  235. plural_agent-0.2.2/web/src/lib/commands.ts +58 -0
  236. plural_agent-0.2.2/web/src/lib/cx.ts +3 -0
  237. plural_agent-0.2.2/web/src/lib/links.test.ts +29 -0
  238. plural_agent-0.2.2/web/src/lib/links.ts +30 -0
  239. plural_agent-0.2.2/web/src/lib/logo-grid.ts +49 -0
  240. plural_agent-0.2.2/web/src/lib/saved.ts +69 -0
  241. plural_agent-0.2.2/web/src/main.tsx +6 -0
  242. plural_agent-0.2.2/web/src/screens/JoinScreen.module.css +16 -0
  243. plural_agent-0.2.2/web/src/screens/JoinScreen.tsx +139 -0
  244. plural_agent-0.2.2/web/src/screens/RoomScreen.module.css +18 -0
  245. plural_agent-0.2.2/web/src/screens/RoomScreen.tsx +130 -0
  246. plural_agent-0.2.2/web/src/styles/base.css +31 -0
  247. plural_agent-0.2.2/web/src/styles/tokens.css +23 -0
  248. plural_agent-0.2.2/web/src/vite-env.d.ts +1 -0
  249. plural_agent-0.2.2/web/vercel.json +7 -0
  250. plural_agent-0.2.0/client/src/presenter.ts +0 -29
  251. plural_agent-0.2.0/client/src/slash.ts +0 -63
  252. plural_agent-0.2.0/deploy/relay.Dockerfile +0 -8
  253. plural_agent-0.2.0/docs/configuration.md +0 -61
  254. plural_agent-0.2.0/docs/protocol.md +0 -25
  255. plural_agent-0.2.0/docs/usage.md +0 -116
  256. plural_agent-0.2.0/src/plural/__init__.py +0 -1
  257. plural_agent-0.2.0/src/plural/agent/context.py +0 -20
  258. plural_agent-0.2.0/src/plural/agent/tools/edit.py +0 -35
  259. plural_agent-0.2.0/src/plural/agent/tools/registry.py +0 -42
  260. plural_agent-0.2.0/src/plural/host/attachments.py +0 -19
  261. plural_agent-0.2.0/src/plural/relay/limits.py +0 -34
  262. plural_agent-0.2.0/tests/unit/test_cli.py +0 -108
  263. plural_agent-0.2.0/tests/unit/test_tools.py +0 -59
  264. plural_agent-0.2.0/tui/src/App.tsx +0 -507
  265. plural_agent-0.2.0/tui/src/cli.tsx +0 -140
  266. plural_agent-0.2.0/tui/src/components/StatusBar.tsx +0 -29
  267. plural_agent-0.2.0/tui/src/lib/clipboard.ts +0 -26
  268. plural_agent-0.2.0/tui/src/presets.ts +0 -182
  269. plural_agent-0.2.0/web/index.html +0 -12
  270. plural_agent-0.2.0/web/src/components/App.tsx +0 -8
  271. plural_agent-0.2.0/web/src/main.tsx +0 -9
  272. {plural_agent-0.2.0 → plural_agent-0.2.2}/.github/workflows/release.yml +0 -0
  273. {plural_agent-0.2.0 → plural_agent-0.2.2}/CONTRIBUTING.md +0 -0
  274. {plural_agent-0.2.0 → plural_agent-0.2.2}/LICENSE +0 -0
  275. {plural_agent-0.2.0 → plural_agent-0.2.2}/SECURITY.md +0 -0
  276. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/decode.ts +0 -0
  277. {plural_agent-0.2.0/tui/src/lib → plural_agent-0.2.2/client/src}/diff.ts +0 -0
  278. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/link.ts +0 -0
  279. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/src/wire.ts +0 -0
  280. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/test/golden.test.ts +0 -0
  281. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/test/link.test.ts +0 -0
  282. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/test/presenter.test.ts +0 -0
  283. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/test/queue.test.ts +0 -0
  284. {plural_agent-0.2.0 → plural_agent-0.2.2}/client/tsconfig.json +0 -0
  285. {plural_agent-0.2.0 → plural_agent-0.2.2}/deploy/Caddyfile +0 -0
  286. {plural_agent-0.2.0 → plural_agent-0.2.2}/deploy/docker-compose.yml +0 -0
  287. {plural_agent-0.2.0 → plural_agent-0.2.2}/docs/adr/0001-hexagonal-event-sourced-host.md +0 -0
  288. {plural_agent-0.2.0 → plural_agent-0.2.2}/docs/adr/0003-simple-compaction.md +0 -0
  289. {plural_agent-0.2.0 → plural_agent-0.2.2}/docs/adr/0004-prompt-modes.md +0 -0
  290. {plural_agent-0.2.0 → plural_agent-0.2.2}/docs/adr/0005-typescript-client.md +0 -0
  291. {plural_agent-0.2.0 → plural_agent-0.2.2}/docs/adr/0006-fullscreen-opentui.md +0 -0
  292. {plural_agent-0.2.0 → plural_agent-0.2.2}/docs/assets/logo.png +0 -0
  293. {plural_agent-0.2.0 → plural_agent-0.2.2}/package.json +0 -0
  294. {plural_agent-0.2.0 → plural_agent-0.2.2}/scripts/gen_schema.py +0 -0
  295. {plural_agent-0.2.0 → plural_agent-0.2.2}/scripts/install-native-renderer.sh +0 -0
  296. {plural_agent-0.2.0 → plural_agent-0.2.2}/scripts/install.sh +0 -0
  297. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/__init__.py +0 -0
  298. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/compaction.py +0 -0
  299. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/gate.py +0 -0
  300. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/interrupt.py +0 -0
  301. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/providers/__init__.py +0 -0
  302. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/providers/fake.py +0 -0
  303. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/sandbox/__init__.py +0 -0
  304. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/sandbox/base.py +0 -0
  305. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/__init__.py +0 -0
  306. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/glob.py +0 -0
  307. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/grep.py +0 -0
  308. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/ls.py +0 -0
  309. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/streaming.py +0 -0
  310. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/agent/tools/truncation.py +0 -0
  311. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/cli/__init__.py +0 -0
  312. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/client/__init__.py +0 -0
  313. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/client/connection.py +0 -0
  314. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/client/projection.py +0 -0
  315. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/client/reconnect.py +0 -0
  316. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/__init__.py +0 -0
  317. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/approvals.py +0 -0
  318. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/errors.py +0 -0
  319. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/policies.py +0 -0
  320. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/policy/__init__.py +0 -0
  321. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/policy/rejections.py +0 -0
  322. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/ports.py +0 -0
  323. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/proposals.py +0 -0
  324. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/core/provenance.py +0 -0
  325. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/__init__.py +0 -0
  326. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/approval_registry.py +0 -0
  327. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/gateway.py +0 -0
  328. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/invites.py +0 -0
  329. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/system.py +0 -0
  330. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/transport/__init__.py +0 -0
  331. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/transport/base.py +0 -0
  332. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/transport/direct.py +0 -0
  333. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/host/transport/relay_link.py +0 -0
  334. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/protocol/__init__.py +0 -0
  335. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/protocol/capability.py +0 -0
  336. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/protocol/codec.py +0 -0
  337. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/protocol/envelope.py +0 -0
  338. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/protocol/relay.py +0 -0
  339. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/relay/__init__.py +0 -0
  340. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/security/__init__.py +0 -0
  341. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/security/keys.py +0 -0
  342. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/security/secrets.py +0 -0
  343. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/security/tokens.py +0 -0
  344. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/storage/__init__.py +0 -0
  345. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/storage/jsonl_export.py +0 -0
  346. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/storage/migrations/0001_init.sql +0 -0
  347. {plural_agent-0.2.0 → plural_agent-0.2.2}/src/plural/storage/migrations/__init__.py +0 -0
  348. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/__init__.py +0 -0
  349. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/doubles.py +0 -0
  350. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/__init__.py +0 -0
  351. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/conftest.py +0 -0
  352. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/test_abort.py +0 -0
  353. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/test_flow.py +0 -0
  354. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/test_policy.py +0 -0
  355. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/test_prompt_mode.py +0 -0
  356. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/test_queue.py +0 -0
  357. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/test_rejections.py +0 -0
  358. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/test_tool_output.py +0 -0
  359. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/e2e/test_typing.py +0 -0
  360. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/fixtures/protocol/prompt_submit.json +0 -0
  361. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/harness/test_swap.py +0 -0
  362. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/harness/test_tool_streaming.py +0 -0
  363. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/integration/test_host_control.py +0 -0
  364. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/integration/test_host_process.py +0 -0
  365. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/loop_support.py +0 -0
  366. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_bootstrap.py +0 -0
  367. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_line_stream.py +0 -0
  368. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_policies.py +0 -0
  369. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_projection.py +0 -0
  370. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_protocol.py +0 -0
  371. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_rejections.py +0 -0
  372. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_security.py +0 -0
  373. {plural_agent-0.2.0 → plural_agent-0.2.2}/tests/unit/test_sqlite_store.py +0 -0
  374. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/bunfig.toml +0 -0
  375. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/dev/demo.tsx +0 -0
  376. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/code.ts +0 -0
  377. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/components/Spinner.tsx +0 -0
  378. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/components/TopBar.tsx +0 -0
  379. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/control.ts +0 -0
  380. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/credentials.ts +0 -0
  381. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/lib/highlight.ts +0 -0
  382. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/lib/wrap.ts +0 -0
  383. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/syntax.ts +0 -0
  384. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/src/theme.ts +0 -0
  385. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/test/diff.test.ts +0 -0
  386. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/test/e2e.test.tsx +0 -0
  387. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/test/feed.test.ts +0 -0
  388. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/test/highlight.test.ts +0 -0
  389. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/test/setup.ts +0 -0
  390. {plural_agent-0.2.0 → plural_agent-0.2.2}/tui/tsconfig.json +0 -0
  391. {plural_agent-0.2.0 → plural_agent-0.2.2}/web/tsconfig.json +0 -0
  392. {plural_agent-0.2.0 → plural_agent-0.2.2}/web/vite.config.ts +0 -0
@@ -42,6 +42,9 @@ jobs:
42
42
  - run: npm test --workspace client
43
43
  - run: npm run typecheck --workspace tui
44
44
  - run: npm test --workspace tui
45
+ - run: npm run typecheck --workspace web
46
+ - run: npm test --workspace web
47
+ - run: npm run build --workspace web
45
48
  - run: sh scripts/install-native-renderer.sh
46
49
  - run: npm run build --workspace tui
47
50
  - name: Start the compiled client in a pseudo terminal
@@ -80,3 +80,5 @@ Thumbs.db
80
80
  # Local agent notes
81
81
  .claude/
82
82
  CLAUDE.local.md
83
+ *.tsbuildinfo
84
+ .vercel
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: plural-agent
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Multiplayer sessions for one AI agent: shared context, host approvals, attribution, isolation.
5
5
  Project-URL: Homepage, https://github.com/Plural-Organization/Plural
6
6
  Project-URL: Issues, https://github.com/Plural-Organization/Plural/issues
@@ -21,7 +21,9 @@ Requires-Python: >=3.12
21
21
  Requires-Dist: aiosqlite>=0.21
22
22
  Requires-Dist: anthropic>=2.3.0
23
23
  Requires-Dist: cryptography>=44
24
+ Requires-Dist: mcp>=1.20
24
25
  Requires-Dist: openai>=3.37.0
26
+ Requires-Dist: pydantic-ai-slim[anthropic,openai]>=2.63.0
25
27
  Requires-Dist: pydantic-settings>=2.8
26
28
  Requires-Dist: pydantic>=2.11
27
29
  Requires-Dist: rich>=13.9
@@ -53,13 +55,13 @@ Description-Content-Type: text/markdown
53
55
 
54
56
  **one agent. one host. everyone in the room.**
55
57
 
56
- - **a shared live session** — the host runs the agent on their machine with their own key. teammates join from a terminal and watch every reply, tool call and diff as it happens.
58
+ - **a shared live session** — the host runs the agent on their machine with their own credentials. teammates join from a terminal and watch every reply, tool call and diff as it happens.
57
59
  - **two ways to prompt** — in `open` mode everyone talks to the agent directly. in `review` mode the host approves each prompt first. switch any time.
58
60
  - **you approve what matters** — write and exec actions always wait for the host, and a run started by a guest can never be waved through by a rule.
59
61
  - **see who is doing what** — participants, who is typing, a prompt queue, and an attribution on every turn.
60
62
  - **tools you can follow** — each call is one line. open it to see the live output of a command or a numbered diff.
61
63
  - **full screen, in your terminal** — a side panel, themes, mouse and keyboard, copy on select. one binary, no runtime to install.
62
- - **your model, your key** — anthropic, any openai-compatible endpoint, or a local model through ollama. api keys only, never subscription logins.
64
+ - **your model, your login** — anthropic by API key or Claude OAuth, any openai-compatible endpoint, or a local model through ollama.
63
65
  - **event-sourced** — an append-only log is the source of truth. reconnect, replay and audit come for free.
64
66
  - **direct or relayed** — connect over your network, or through a relay that never decides permissions and never stores content.
65
67
 
@@ -82,6 +84,8 @@ cd your-project
82
84
  plural
83
85
  ```
84
86
 
87
+ come back to a session later with `plural -r` (or `plural -c` for the latest one of this folder), and ask once from a script with `plural -p "…"`. see [usage](docs/usage.md).
88
+
85
89
  the first line in the conversation is an invite. send it to a teammate:
86
90
 
87
91
  ```bash
@@ -94,11 +98,17 @@ without a key the host runs a scripted demo agent. for a real model:
94
98
  ANTHROPIC_API_KEY=sk-ant-… plural
95
99
  ```
96
100
 
101
+ or open `F2` → Model → Claude OAuth → Sign in with Claude, then paste the code shown in the browser. Anthropic may bill this third-party usage from usage credits rather than subscription limits. To use your actual Claude Code login, run `claude auth login` in a terminal and select `F2` → Model → Claude Code.
102
+
103
+ To use your Codex sign-in, run `codex login` in a terminal and select `F2` → Model → Codex CLI. Choose a model available to your Codex account. Plural streams replies from one Codex session for the room while its host is running.
104
+
105
+ Claude OAuth defaults to Haiku 4.5. Newer Claude models may reject third-party OAuth requests even when login succeeds; use an Anthropic API key for those models.
106
+
97
107
  `/help` lists the commands, `F2` opens the settings, `ctrl+o` opens the tool details.
98
108
 
99
109
  ## docs
100
110
 
101
- [usage](docs/usage.md) · [configuration](docs/configuration.md) · [relay deployment](deploy/) · [wire protocol](docs/protocol.md) · [threat model](docs/threat-model.md) · [design decisions](docs/adr/) · [development](docs/development.md)
111
+ [usage](docs/usage.md) · [configuration](docs/configuration.md) · [running on a server](docs/self-hosting.md) · [wire protocol](docs/protocol.md) · [threat model](docs/threat-model.md) · [design decisions](docs/adr/) · [development](docs/development.md)
102
112
 
103
113
  ## acknowledgements
104
114
 
@@ -19,13 +19,13 @@
19
19
 
20
20
  **one agent. one host. everyone in the room.**
21
21
 
22
- - **a shared live session** — the host runs the agent on their machine with their own key. teammates join from a terminal and watch every reply, tool call and diff as it happens.
22
+ - **a shared live session** — the host runs the agent on their machine with their own credentials. teammates join from a terminal and watch every reply, tool call and diff as it happens.
23
23
  - **two ways to prompt** — in `open` mode everyone talks to the agent directly. in `review` mode the host approves each prompt first. switch any time.
24
24
  - **you approve what matters** — write and exec actions always wait for the host, and a run started by a guest can never be waved through by a rule.
25
25
  - **see who is doing what** — participants, who is typing, a prompt queue, and an attribution on every turn.
26
26
  - **tools you can follow** — each call is one line. open it to see the live output of a command or a numbered diff.
27
27
  - **full screen, in your terminal** — a side panel, themes, mouse and keyboard, copy on select. one binary, no runtime to install.
28
- - **your model, your key** — anthropic, any openai-compatible endpoint, or a local model through ollama. api keys only, never subscription logins.
28
+ - **your model, your login** — anthropic by API key or Claude OAuth, any openai-compatible endpoint, or a local model through ollama.
29
29
  - **event-sourced** — an append-only log is the source of truth. reconnect, replay and audit come for free.
30
30
  - **direct or relayed** — connect over your network, or through a relay that never decides permissions and never stores content.
31
31
 
@@ -48,6 +48,8 @@ cd your-project
48
48
  plural
49
49
  ```
50
50
 
51
+ come back to a session later with `plural -r` (or `plural -c` for the latest one of this folder), and ask once from a script with `plural -p "…"`. see [usage](docs/usage.md).
52
+
51
53
  the first line in the conversation is an invite. send it to a teammate:
52
54
 
53
55
  ```bash
@@ -60,11 +62,17 @@ without a key the host runs a scripted demo agent. for a real model:
60
62
  ANTHROPIC_API_KEY=sk-ant-… plural
61
63
  ```
62
64
 
65
+ or open `F2` → Model → Claude OAuth → Sign in with Claude, then paste the code shown in the browser. Anthropic may bill this third-party usage from usage credits rather than subscription limits. To use your actual Claude Code login, run `claude auth login` in a terminal and select `F2` → Model → Claude Code.
66
+
67
+ To use your Codex sign-in, run `codex login` in a terminal and select `F2` → Model → Codex CLI. Choose a model available to your Codex account. Plural streams replies from one Codex session for the room while its host is running.
68
+
69
+ Claude OAuth defaults to Haiku 4.5. Newer Claude models may reject third-party OAuth requests even when login succeeds; use an Anthropic API key for those models.
70
+
63
71
  `/help` lists the commands, `F2` opens the settings, `ctrl+o` opens the tool details.
64
72
 
65
73
  ## docs
66
74
 
67
- [usage](docs/usage.md) · [configuration](docs/configuration.md) · [relay deployment](deploy/) · [wire protocol](docs/protocol.md) · [threat model](docs/threat-model.md) · [design decisions](docs/adr/) · [development](docs/development.md)
75
+ [usage](docs/usage.md) · [configuration](docs/configuration.md) · [running on a server](docs/self-hosting.md) · [wire protocol](docs/protocol.md) · [threat model](docs/threat-model.md) · [design decisions](docs/adr/) · [development](docs/development.md)
68
76
 
69
77
  ## acknowledgements
70
78
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plural/client",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -0,0 +1,120 @@
1
+ import { label } from "./presenter";
2
+ import type { CommandOf, Participant, SessionState } from "./protocol";
3
+ import { SlashError } from "./slash";
4
+
5
+ export const CHAT_USAGE = "usage: /team <message> for the room · @name <message> for one person";
6
+ export const TEAM_COMMANDS = ["team", "to-team", "chat"] as const;
7
+
8
+ export interface Mentionable {
9
+ id: string;
10
+ label: string;
11
+ role: Participant["role"];
12
+ connected: boolean;
13
+ }
14
+
15
+ export interface ChatIntent {
16
+ command: CommandOf<"chat.send">;
17
+ to: Mentionable | null;
18
+ }
19
+
20
+ const BOUNDARY = /^[\s,:;.!?)]|^$/;
21
+
22
+ export function mentionable(state: SessionState, meId: string | null): Mentionable[] {
23
+ return Object.values(state.participants)
24
+ .filter((participant) => participant.id !== meId)
25
+ .map((participant) => ({
26
+ id: participant.id,
27
+ label: label(state, participant),
28
+ role: participant.role,
29
+ connected: participant.connected,
30
+ }))
31
+ .sort((a, b) => Number(b.connected) - Number(a.connected) || a.label.localeCompare(b.label));
32
+ }
33
+
34
+ export function matchMention(rest: string, people: Mentionable[]): Mentionable | null {
35
+ const lower = rest.toLowerCase();
36
+ let best: Mentionable | null = null;
37
+ for (const person of people) {
38
+ const name = person.label.toLowerCase();
39
+ if (lower.startsWith(name) && BOUNDARY.test(rest.slice(name.length)) && (best === null || name.length > best.label.length)) {
40
+ best = person;
41
+ }
42
+ }
43
+ return best;
44
+ }
45
+
46
+ export interface MentionCompletion {
47
+ person: Mentionable;
48
+ insert: string;
49
+ }
50
+
51
+ export function mentionCompletions(value: string, people: Mentionable[]): MentionCompletion[] {
52
+ const tail = /(^|\s)@([^\s@]*)$/.exec(value);
53
+ if (tail === null) {
54
+ return [];
55
+ }
56
+ const start = tail.index + (tail[1]?.length ?? 0);
57
+ const query = (tail[2] ?? "").toLowerCase();
58
+ return people
59
+ .filter((person) => person.label.toLowerCase().startsWith(query))
60
+ .map((person) => ({ person, insert: `${value.slice(0, start)}@${person.label} ` }));
61
+ }
62
+
63
+ export function mentionNote(person: Mentionable): string {
64
+ return `${person.role}${person.connected ? "" : " · offline"}${person.role === "viewer" ? " · cannot get private messages" : ""}`;
65
+ }
66
+
67
+ export function mentionsIn(text: string, people: Mentionable[]): string[] {
68
+ const found: string[] = [];
69
+ for (let index = text.indexOf("@"); index !== -1; index = text.indexOf("@", index + 1)) {
70
+ if (index > 0 && !/\s|[(]/.test(text[index - 1]!)) {
71
+ continue;
72
+ }
73
+ const person = matchMention(text.slice(index + 1), people);
74
+ if (person !== null && !found.includes(person.id)) {
75
+ found.push(person.id);
76
+ }
77
+ }
78
+ return found;
79
+ }
80
+
81
+ export function parseChat(text: string, state: SessionState, meId: string | null): ChatIntent | null {
82
+ const people = mentionable(state, meId);
83
+ if (text.startsWith("/")) {
84
+ const space = text.search(/\s/);
85
+ const name = text.slice(1, space === -1 ? undefined : space);
86
+ if (!(TEAM_COMMANDS as readonly string[]).includes(name)) {
87
+ return null;
88
+ }
89
+ const body = space === -1 ? "" : text.slice(space).trim();
90
+ if (body === "") {
91
+ throw new SlashError(CHAT_USAGE);
92
+ }
93
+ return { command: { type: "chat.send", text: body, to: null, mentions: mentionsIn(body, people) }, to: null };
94
+ }
95
+ if (!text.startsWith("@")) {
96
+ return null;
97
+ }
98
+ const person = matchMention(text.slice(1), people);
99
+ if (person === null) {
100
+ return null;
101
+ }
102
+ if (person.role === "viewer") {
103
+ throw new SlashError(`${person.label} watches the session and cannot get private messages`);
104
+ }
105
+ const body = text.slice(1 + person.label.length).replace(/^[,:;]/, "").trim();
106
+ if (body === "") {
107
+ throw new SlashError(`write something after @${person.label}`);
108
+ }
109
+ return { command: { type: "chat.send", text: body, to: person.id, mentions: [] }, to: person };
110
+ }
111
+
112
+ export function mentionsMe(
113
+ entry: { author_id: string; to: string | null; mentions: string[] },
114
+ meId: string | null,
115
+ ): boolean {
116
+ if (meId === null || entry.author_id === meId) {
117
+ return false;
118
+ }
119
+ return entry.to === meId || entry.mentions.includes(meId);
120
+ }
@@ -1,13 +1,8 @@
1
- import {
2
- label,
3
- type Event,
4
- type Participant,
5
- type Projection,
6
- type Role,
7
- type SessionState,
8
- type ToolCallView,
9
- type TranscriptEntry,
10
- } from "@plural/client";
1
+ import { withDefaults } from "./reduce";
2
+ import { mentionsMe } from "./chat";
3
+ import { label, shortTokens } from "./presenter";
4
+ import type { Projection } from "./projection";
5
+ import type { Event, Participant, Role, SessionState, ToolCallView, TranscriptEntry } from "./protocol";
11
6
 
12
7
  export const TOOL_OUTPUT_LIMIT = 20_000;
13
8
  export const LIVE_OUTPUT_LIMIT = 8000;
@@ -18,6 +13,17 @@ export type ToolStatus = "running" | "ok" | "failed";
18
13
  export type FeedItem =
19
14
  | { kind: "banner"; id: string; room: string; version: string; guestLink: string | null }
20
15
  | { kind: "user"; id: string; participantId: string; name: string; role: Role; viaProposal: boolean; text: string }
16
+ | {
17
+ kind: "chat";
18
+ id: string;
19
+ authorId: string;
20
+ name: string;
21
+ text: string;
22
+ to: string | null;
23
+ toName: string | null;
24
+ mine: boolean;
25
+ mentioned: boolean;
26
+ }
21
27
  | { kind: "assistant"; id: string; text: string; streaming: boolean }
22
28
  | { kind: "tool"; id: string; call: ToolCallView; status: ToolStatus; output: string; diff: string | null; live: string }
23
29
  | { kind: "notice"; id: string; tone: Tone; text: string };
@@ -77,7 +83,19 @@ export function absorb(feed: Feed, event: Event, projection: Projection): Feed {
77
83
  )
78
84
  : feed;
79
85
  case "session.snapshot":
80
- return loadHistory(feed, event.state, event.streaming);
86
+ return loadHistory(feed, withDefaults(event.state), event.streaming, projection.meId);
87
+ case "chat.posted":
88
+ return {
89
+ ...feed,
90
+ items: [
91
+ ...feed.items,
92
+ chatItem(
93
+ { id: event.message_id, author_id: event.author_id, text: event.text, to: event.to, mentions: event.mentions },
94
+ state,
95
+ projection.meId,
96
+ ),
97
+ ],
98
+ };
81
99
  case "participant.joined":
82
100
  return event.participant.id === projection.meId
83
101
  ? feed
@@ -95,6 +113,13 @@ export function absorb(feed: Feed, event: Event, projection: Projection): Feed {
95
113
  ? "prompts are open: participants prompt the agent directly"
96
114
  : "prompts are in review: the host approves each participant prompt",
97
115
  );
116
+ case "skills.changed": {
117
+ const parts = [
118
+ event.added.length > 0 ? `added ${event.added.join(", ")}` : "",
119
+ event.removed.length > 0 ? `removed ${event.removed.join(", ")}` : "",
120
+ ].filter(Boolean);
121
+ return parts.length > 0 ? note("accent", `skills: ${parts.join(" · ")}`) : feed;
122
+ }
98
123
  case "prompt.dequeued":
99
124
  return event.reason === "cancelled" ? note("dim", "a queued prompt was cancelled") : feed;
100
125
  case "proposal.created":
@@ -236,7 +261,7 @@ export function absorb(feed: Feed, event: Event, projection: Projection): Feed {
236
261
  case "policy.rule_removed":
237
262
  return note("accent", `policy - ${event.rule_id}`);
238
263
  case "context.compacted":
239
- return note("dim", `context compacted (${event.tokens_before} tokens summarized)`);
264
+ return note("dim", `context compacted: ${shortTokens(event.tokens_before)} tokens summarized`);
240
265
  case "attachment.added":
241
266
  return note("dim", `${nameOf(event.attachment.owner_id)} attached ${event.attachment.name}`);
242
267
  case "invite.created":
@@ -248,7 +273,34 @@ export function absorb(feed: Feed, event: Event, projection: Projection): Feed {
248
273
  }
249
274
  }
250
275
 
251
- function loadHistory(feed: Feed, state: SessionState, streaming: Record<string, string>): Feed {
276
+ function chatItem(
277
+ entry: { id: string; author_id: string; text: string; to: string | null; mentions: string[] },
278
+ state: SessionState,
279
+ meId: string | null,
280
+ ): FeedItem {
281
+ const nameOf = (participantId: string): string => {
282
+ const participant = state.participants[participantId];
283
+ return participant ? label(state, participant) : participantId;
284
+ };
285
+ return {
286
+ kind: "chat",
287
+ id: entry.id,
288
+ authorId: entry.author_id,
289
+ name: nameOf(entry.author_id),
290
+ text: entry.text,
291
+ to: entry.to,
292
+ toName: entry.to === null ? null : nameOf(entry.to),
293
+ mine: entry.author_id === meId,
294
+ mentioned: mentionsMe(entry, meId),
295
+ };
296
+ }
297
+
298
+ function loadHistory(
299
+ feed: Feed,
300
+ state: SessionState,
301
+ streaming: Record<string, string>,
302
+ meId: string | null,
303
+ ): Feed {
252
304
  if (feed.history) {
253
305
  return feed;
254
306
  }
@@ -264,6 +316,9 @@ function loadHistory(feed: Feed, state: SessionState, streaming: Record<string,
264
316
  for (const [messageId, text] of Object.entries(streaming)) {
265
317
  items.push({ kind: "assistant", id: messageId, text, streaming: true });
266
318
  }
319
+ for (const entry of state.chat) {
320
+ items.push(chatItem(entry, state, meId));
321
+ }
267
322
  const approvals = Object.fromEntries(Object.values(state.approvals).map((approval) => [approval.id, approval.call]));
268
323
  return { ...feed, items, counter, approvals, history: true };
269
324
  }
@@ -1,4 +1,7 @@
1
+ export * from "./chat";
1
2
  export * from "./decode";
3
+ export * from "./diff";
4
+ export * from "./feed";
2
5
  export * from "./link";
3
6
  export * from "./presenter";
4
7
  export * from "./projection";
@@ -6,4 +9,5 @@ export * from "./protocol";
6
9
  export * from "./reduce";
7
10
  export * from "./session";
8
11
  export * from "./slash";
12
+ export * from "./tools";
9
13
  export * from "./wire";
@@ -0,0 +1,70 @@
1
+ import type { Projection } from "./projection";
2
+ import type { Participant, PermissionMode, PolicyRuleView, SessionState } from "./protocol";
3
+
4
+ export const PERMISSION_MODES: readonly PermissionMode[] = ["default", "accept_edits", "plan", "auto"];
5
+
6
+ export const PERMISSION_LABELS: Record<PermissionMode, string> = {
7
+ default: "ask before changes",
8
+ accept_edits: "accept edits",
9
+ plan: "plan mode",
10
+ auto: "auto mode",
11
+ };
12
+
13
+ export function nextPermissionMode(mode: PermissionMode): PermissionMode {
14
+ return PERMISSION_MODES[(PERMISSION_MODES.indexOf(mode) + 1) % PERMISSION_MODES.length] ?? "default";
15
+ }
16
+
17
+ export function label(state: SessionState, participant: Participant): string {
18
+ const twins = Object.values(state.participants).filter((other) => other.name === participant.name);
19
+ return twins.length < 2 ? participant.name : `${participant.name} #${participant.id.slice(-4)}`;
20
+ }
21
+
22
+ export function ruleLine(rule: PolicyRuleView): string {
23
+ return `${rule.action.padEnd(5)} ${rule.tool} ${rule.pattern}`;
24
+ }
25
+
26
+ export function status(projection: Projection): string {
27
+ const state = projection.state;
28
+ if (state.run === null) {
29
+ return "";
30
+ }
31
+ if (projection.compacting !== null) {
32
+ return "… compacting the context";
33
+ }
34
+ if (Object.keys(state.approvals).length > 0) {
35
+ return "… waiting for host approval";
36
+ }
37
+ const last = state.transcript.at(-1);
38
+ if (last !== undefined && last.tool !== null && last.ok === null) {
39
+ return `… running ${last.tool.name}`;
40
+ }
41
+ if (projection.reasoning > 0) {
42
+ return `… thinking (${projection.reasoning} chars)`;
43
+ }
44
+ return "… waiting for the model";
45
+ }
46
+
47
+ export interface ContextMeter {
48
+ percent: number;
49
+ tokens: string;
50
+ window: string;
51
+ level: "ok" | "warn" | "danger";
52
+ }
53
+
54
+ export function contextMeter(state: SessionState): ContextMeter | null {
55
+ const context = state.context;
56
+ if (context === null || context.window <= 0) {
57
+ return null;
58
+ }
59
+ const share = context.tokens / context.window;
60
+ return {
61
+ percent: Math.min(100, Math.round(share * 100)),
62
+ tokens: shortTokens(context.tokens),
63
+ window: shortTokens(context.window),
64
+ level: share >= context.compact_at ? "danger" : share >= context.compact_at * 0.75 ? "warn" : "ok",
65
+ };
66
+ }
67
+
68
+ export function shortTokens(count: number): string {
69
+ return count >= 1_000_000 ? `${(count / 1_000_000).toFixed(1)}M` : count >= 1000 ? `${Math.round(count / 1000)}K` : String(count);
70
+ }
@@ -6,11 +6,16 @@ export class Projection {
6
6
  streaming: Record<string, string> = {};
7
7
  reasoning = 0;
8
8
  typing = new Set<string>();
9
+ compacting: { tokens: number; since: number } | null = null;
9
10
  basePolicy: PolicyRuleView[] = [];
10
11
  agent = "";
11
12
  meId: string | null = null;
12
13
  ready = false;
13
14
 
15
+ get agentLabel(): string {
16
+ return this.state.agent || this.agent;
17
+ }
18
+
14
19
  get me(): Participant | undefined {
15
20
  return this.meId === null ? undefined : this.state.participants[this.meId];
16
21
  }
@@ -20,6 +25,7 @@ export class Projection {
20
25
  this.streaming = { ...streaming };
21
26
  this.typing = new Set(typing);
22
27
  this.reasoning = 0;
28
+ this.compacting = null;
23
29
  this.ready = true;
24
30
  }
25
31
 
@@ -40,6 +46,10 @@ export class Projection {
40
46
  case "run.ended":
41
47
  this.streaming = {};
42
48
  this.reasoning = 0;
49
+ this.compacting = null;
50
+ break;
51
+ case "context.compacted":
52
+ this.compacting = null;
43
53
  break;
44
54
  case "participant.revoked":
45
55
  this.typing.delete(event.participant_id);
@@ -51,6 +61,10 @@ export class Projection {
51
61
  }
52
62
 
53
63
  observe(event: Event): void {
64
+ if (event.type === "context.compacting") {
65
+ this.compacting = { tokens: event.tokens_before, since: Date.now() };
66
+ return;
67
+ }
54
68
  if (event.type === "participant.typing") {
55
69
  if (event.typing) {
56
70
  this.typing.add(event.participant_id);