sessionyard 0.7.0__tar.gz → 0.8.0__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 (214) hide show
  1. sessionyard-0.8.0/.release-please-manifest.json +3 -0
  2. {sessionyard-0.7.0 → sessionyard-0.8.0}/AGENTS.md +11 -14
  3. {sessionyard-0.7.0 → sessionyard-0.8.0}/CHANGELOG.md +20 -0
  4. {sessionyard-0.7.0 → sessionyard-0.8.0}/CONTRIBUTING.md +47 -17
  5. {sessionyard-0.7.0 → sessionyard-0.8.0}/PKG-INFO +31 -26
  6. {sessionyard-0.7.0 → sessionyard-0.8.0}/README.md +26 -21
  7. {sessionyard-0.7.0 → sessionyard-0.8.0}/SECURITY.md +5 -3
  8. sessionyard-0.8.0/agent_chat/012_session_model.sql +2 -0
  9. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/admin.py +84 -16
  10. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/api.py +15 -1
  11. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/cli.py +49 -2
  12. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/client.py +24 -2
  13. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/http_boundary.py +4 -1
  14. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/mcp/app.py +16 -5
  15. sessionyard-0.8.0/agent_chat/mcp/auth.py +122 -0
  16. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/mcp/tools.py +42 -6
  17. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/models.py +6 -3
  18. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/openapi.py +35 -1
  19. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/protocol.py +6 -1
  20. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/publication.py +33 -7
  21. sessionyard-0.8.0/agent_chat/rooms.py +296 -0
  22. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/sessions.py +16 -6
  23. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/skills/agent-chat/SKILL.md +7 -2
  24. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/storage.py +1 -1
  25. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/web/chat.css +8 -4
  26. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/web/chat.js +9 -3
  27. sessionyard-0.8.0/deploy/ansible/files/check_release_tree.py +42 -0
  28. sessionyard-0.8.0/deploy/ansible/inventory.example.yml +38 -0
  29. sessionyard-0.8.0/deploy/ansible/playbook.yml +675 -0
  30. sessionyard-0.8.0/deploy/ansible/templates/agent-chat-mcp.service.j2 +49 -0
  31. sessionyard-0.8.0/deploy/ansible/templates/agent-chat-prune.service.j2 +39 -0
  32. sessionyard-0.8.0/deploy/ansible/templates/agent-chat-prune.timer.j2 +11 -0
  33. sessionyard-0.8.0/deploy/ansible/templates/agent-chat.service.j2 +47 -0
  34. sessionyard-0.8.0/deploy/ansible/templates/mcp.json.j2 +7 -0
  35. sessionyard-0.8.0/deploy/ansible/templates/server.json.j2 +8 -0
  36. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/compose.yaml +16 -11
  37. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/podman/agent-chat-migrate.container +3 -0
  38. sessionyard-0.8.0/docs/ansible.md +410 -0
  39. sessionyard-0.8.0/docs/api.md +129 -0
  40. sessionyard-0.8.0/docs/containers.md +311 -0
  41. {sessionyard-0.7.0 → sessionyard-0.8.0}/docs/openapi.json +213 -1
  42. {sessionyard-0.7.0 → sessionyard-0.8.0}/docs/podman.md +77 -51
  43. {sessionyard-0.7.0 → sessionyard-0.8.0}/docs/self-hosting.md +112 -19
  44. sessionyard-0.8.0/integrations/README.md +98 -0
  45. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/README.md +4 -14
  46. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/README.md +8 -8
  47. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/lib/lifecycle.js +54 -13
  48. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/test/lifecycle.test.js +75 -2
  49. sessionyard-0.8.0/openspec/changes/archive/2026-11-18-port-service-specs/.openspec.yaml +2 -0
  50. sessionyard-0.8.0/openspec/changes/archive/2026-11-18-port-service-specs/design.md +135 -0
  51. sessionyard-0.8.0/openspec/changes/archive/2026-11-18-port-service-specs/proposal.md +39 -0
  52. sessionyard-0.8.0/openspec/changes/archive/2026-11-18-port-service-specs/specs/chat-clients/spec.md +416 -0
  53. sessionyard-0.8.0/openspec/changes/archive/2026-11-18-port-service-specs/specs/chat-service/spec.md +549 -0
  54. sessionyard-0.8.0/openspec/changes/archive/2026-11-18-port-service-specs/specs/coordination/spec.md +525 -0
  55. sessionyard-0.8.0/openspec/changes/archive/2026-11-18-port-service-specs/specs/web-ui/spec.md +526 -0
  56. sessionyard-0.8.0/openspec/changes/archive/2026-11-18-port-service-specs/tasks.md +32 -0
  57. {sessionyard-0.7.0 → sessionyard-0.8.0}/openspec/config.yaml +2 -1
  58. sessionyard-0.8.0/openspec/specs/chat-clients/spec.md +415 -0
  59. sessionyard-0.8.0/openspec/specs/chat-service/spec.md +548 -0
  60. sessionyard-0.8.0/openspec/specs/coordination/spec.md +524 -0
  61. sessionyard-0.8.0/openspec/specs/web-ui/spec.md +525 -0
  62. {sessionyard-0.7.0 → sessionyard-0.8.0}/pyproject.toml +10 -10
  63. {sessionyard-0.7.0 → sessionyard-0.8.0}/scripts/pr_policy.py +3 -4
  64. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_admin.py +223 -14
  65. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_api.py +50 -0
  66. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_cli.py +155 -0
  67. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_client_boundary.py +6 -0
  68. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_coordination.py +2 -1
  69. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_direct_threads.py +2 -1
  70. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_harness_admission.py +1 -1
  71. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_http_boundary.py +19 -0
  72. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_instance_client.py +26 -0
  73. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_mcp.py +450 -1
  74. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_pm_mark.py +1 -1
  75. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_quotas.py +2 -1
  76. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_roles.py +1 -1
  77. sessionyard-0.8.0/tests/agent_chat/test_roster_navigation.py +527 -0
  78. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_ui.py +15 -0
  79. sessionyard-0.8.0/tests/test_deploy.py +1559 -0
  80. {sessionyard-0.7.0 → sessionyard-0.8.0}/uv.lock +134 -165
  81. sessionyard-0.7.0/.release-please-manifest.json +0 -3
  82. sessionyard-0.7.0/agent_chat/mcp/auth.py +0 -67
  83. sessionyard-0.7.0/agent_chat/rooms.py +0 -179
  84. sessionyard-0.7.0/docs/api.md +0 -41
  85. sessionyard-0.7.0/docs/containers.md +0 -301
  86. sessionyard-0.7.0/integrations/README.md +0 -59
  87. sessionyard-0.7.0/tests/test_deploy.py +0 -214
  88. {sessionyard-0.7.0 → sessionyard-0.8.0}/.dockerignore +0 -0
  89. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  90. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  91. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  92. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  93. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/dependabot.yml +0 -0
  94. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/workflows/automerge.yml +0 -0
  95. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/workflows/ci.yml +0 -0
  96. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/workflows/publish.yml +0 -0
  97. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/workflows/release-please.yml +0 -0
  98. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/workflows/review-gate.yml +0 -0
  99. {sessionyard-0.7.0 → sessionyard-0.8.0}/.github/workflows/review-signal.yml +0 -0
  100. {sessionyard-0.7.0 → sessionyard-0.8.0}/.gitignore +0 -0
  101. {sessionyard-0.7.0 → sessionyard-0.8.0}/.gitleaks.toml +0 -0
  102. {sessionyard-0.7.0 → sessionyard-0.8.0}/CLAUDE.md +0 -0
  103. {sessionyard-0.7.0 → sessionyard-0.8.0}/CODE_OF_CONDUCT.md +0 -0
  104. {sessionyard-0.7.0 → sessionyard-0.8.0}/Dockerfile +0 -0
  105. {sessionyard-0.7.0 → sessionyard-0.8.0}/LICENSE +0 -0
  106. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/001_core.sql +0 -0
  107. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/002_coordination.sql +0 -0
  108. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/003_harness_admission.sql +0 -0
  109. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/004_session_titles.sql +0 -0
  110. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/005_viewer.sql +0 -0
  111. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/006_quotas.sql +0 -0
  112. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/007_sender_receipts.sql +0 -0
  113. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/008_direct_threads.sql +0 -0
  114. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/009_pm_mark.sql +0 -0
  115. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/010_quota_backfill.sql +0 -0
  116. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/011_roles_and_work.sql +0 -0
  117. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/__init__.py +0 -0
  118. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/adapter.py +0 -0
  119. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/auth.py +0 -0
  120. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/browser.py +0 -0
  121. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/browser_verify.py +0 -0
  122. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/browser_verify_artifacts.py +0 -0
  123. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/browser_verify_checks.py +0 -0
  124. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/browser_verify_run.py +0 -0
  125. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/deliveries.py +0 -0
  126. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/events.py +0 -0
  127. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/feed.py +0 -0
  128. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/instance_client.py +0 -0
  129. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/instance_file.py +0 -0
  130. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/instance_worker.py +0 -0
  131. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/mcp/__init__.py +0 -0
  132. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/mcp/__main__.py +0 -0
  133. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/mcp/config.py +0 -0
  134. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/metrics.py +0 -0
  135. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/producer.py +0 -0
  136. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/receipts.py +0 -0
  137. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/retention.py +0 -0
  138. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/roles.py +0 -0
  139. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/state.py +0 -0
  140. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/threads.py +0 -0
  141. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/web/Manrope-OFL.txt +0 -0
  142. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/web/Manrope-Variable.ttf +0 -0
  143. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/web/i18n.js +0 -0
  144. {sessionyard-0.7.0 → sessionyard-0.8.0}/agent_chat/web/index.html +0 -0
  145. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/.env.example +0 -0
  146. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/config/mcp.example.json +0 -0
  147. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/config/server.example.json +0 -0
  148. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/observability/README.md +0 -0
  149. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/observability/agent-chat-alerts.example.yml +0 -0
  150. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/observability/alloy.example.alloy +0 -0
  151. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/podman/agent-chat-mcp.container +0 -0
  152. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/podman/agent-chat.container +0 -0
  153. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/podman/agent-chat.network +0 -0
  154. {sessionyard-0.7.0 → sessionyard-0.8.0}/deploy/traefik/dynamic.example.yml +0 -0
  155. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/extensions/agent-chat.js +0 -0
  156. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/lib/config.js +0 -0
  157. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/lib/delivery.js +0 -0
  158. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/lib/lifecycle.js +0 -0
  159. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/lib/notice.js +0 -0
  160. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/lib/policy.js +0 -0
  161. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/lib/worker.js +0 -0
  162. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/package.json +0 -0
  163. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/test/config.test.js +0 -0
  164. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/test/delivery.test.js +0 -0
  165. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/test/lifecycle.test.js +0 -0
  166. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/test/notice.test.js +0 -0
  167. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/test/plugin.test.js +0 -0
  168. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/test/policy.test.js +0 -0
  169. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/deepseek/test/worker.test.js +0 -0
  170. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/extensions/agent-chat.js +0 -0
  171. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/lib/config.js +0 -0
  172. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/lib/notice.js +0 -0
  173. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/lib/policy.js +0 -0
  174. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/lib/worker.js +0 -0
  175. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/package.json +0 -0
  176. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/test/config.test.js +0 -0
  177. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/test/policy.test.js +0 -0
  178. {sessionyard-0.7.0 → sessionyard-0.8.0}/integrations/pi/test/worker.test.js +0 -0
  179. {sessionyard-0.7.0 → sessionyard-0.8.0}/release-please-config.json +0 -0
  180. {sessionyard-0.7.0 → sessionyard-0.8.0}/ruff.toml +0 -0
  181. {sessionyard-0.7.0 → sessionyard-0.8.0}/scripts/check_estate_identifiers.py +0 -0
  182. {sessionyard-0.7.0 → sessionyard-0.8.0}/scripts/export_openapi.py +0 -0
  183. {sessionyard-0.7.0 → sessionyard-0.8.0}/scripts/github_pr_automation.py +0 -0
  184. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/conftest.py +0 -0
  185. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/http_server_fixture.py +0 -0
  186. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/postgres_binaries.py +0 -0
  187. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_adapter.py +0 -0
  188. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_browser.py +0 -0
  189. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_browser_verify.py +0 -0
  190. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_browser_verify_integration.py +0 -0
  191. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_cli_coordination.py +0 -0
  192. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_client_deadline.py +0 -0
  193. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_database_teardown.py +0 -0
  194. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_deliveries.py +0 -0
  195. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_feed.py +0 -0
  196. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_instance_client_bodies.py +0 -0
  197. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_instance_file.py +0 -0
  198. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_instance_worker.py +0 -0
  199. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_metrics.py +0 -0
  200. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_postgres_binaries.py +0 -0
  201. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_producer.py +0 -0
  202. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_publication.py +0 -0
  203. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_receipts.py +0 -0
  204. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_retention.py +0 -0
  205. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_sender_receipts.py +0 -0
  206. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_session_titles.py +0 -0
  207. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_state.py +0 -0
  208. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_threads.py +0 -0
  209. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_viewer.py +0 -0
  210. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/agent_chat/test_work.py +0 -0
  211. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/test_estate_identifier_scan.py +0 -0
  212. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/test_openapi.py +0 -0
  213. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/test_pr_policy.py +0 -0
  214. {sessionyard-0.7.0 → sessionyard-0.8.0}/tests/test_workflow_policy.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.8.0"
3
+ }
@@ -1,22 +1,18 @@
1
1
  # agent-chat agent instructions
2
2
 
3
3
  agent-chat is a self-hosted coordination service for AI coding-agent sessions
4
- on one host or a small fleet. This repository is the product source only: the
5
- HTTP service, the web UI, the CLI, the adapter lifecycle client and the
6
- database migrations. Licence: AGPL-3.0-only. GitHub is the only writable
7
- source and pull-request surface; the target branch is `main`.
8
- Non-goals: a hosted service, deployment configuration.
4
+ on one host or a small fleet. This repository is the product source: the
5
+ HTTP service, the web UI, the CLI, the adapter lifecycle client, the
6
+ database migrations and the deployment examples in `deploy/` (Compose, Podman
7
+ Quadlet and Ansible), which are the supported install paths for one host.
8
+ Licence: AGPL-3.0-only. GitHub is the only writable source and pull-request
9
+ surface; the target branch is `main`.
10
+ Non-goals: a hosted service, and the deployer's own infrastructure (secret
11
+ managers, reverse proxies, DNS, backups, fleet management).
9
12
 
10
13
  ## Checks
11
14
 
12
- ```sh
13
- uv sync --frozen
14
- uv lock --check
15
- uv run ruff check .
16
- uv run ty check
17
- uv run python -m pytest -q
18
- python3 scripts/check_estate_identifiers.py
19
- ```
15
+ Run the [local checks in CONTRIBUTING.md](CONTRIBUTING.md#local-checks).
20
16
 
21
17
  - Prerequisites: Linux, Python 3.11 or newer, uv, PostgreSQL server binaries
22
18
  (`PG_TEST_BIN_DIR` can name their directory) and the pinned Playwright
@@ -42,7 +38,8 @@ python3 scripts/check_estate_identifiers.py
42
38
  new migration. `agent_chat/storage.py` refuses a changed file with
43
39
  `SCHEMA_MISMATCH`.
44
40
  - A message body travels in the request body, never in a process argument.
45
- - Configuration and deployment stay outside the product source.
41
+ - The deployment examples in `deploy/` are in scope. A deployer's own
42
+ configuration and infrastructure stay outside the product source.
46
43
 
47
44
  ## Working contract
48
45
 
@@ -5,6 +5,26 @@ All notable changes to this project are documented in this file.
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.8.0](https://github.com/mikomiel/agent-chat/compare/v0.7.0...v0.8.0) (2026-11-18)
9
+
10
+
11
+ ### Features
12
+
13
+ * **chat:** report recipient delivery hints on publication ([#112](https://github.com/mikomiel/agent-chat/issues/112)) ([7464b13](https://github.com/mikomiel/agent-chat/commit/7464b134921d23f95a7bf9d8562857fe9fd676cc))
14
+ * **deploy:** add an Ansible playbook for a native systemd install ([#88](https://github.com/mikomiel/agent-chat/issues/88)) ([9adc7eb](https://github.com/mikomiel/agent-chat/commit/9adc7ebd84d6691c73e461562e13fc63f7c37b22))
15
+ * **mcp:** read the newest history page and navigate the roster ([#99](https://github.com/mikomiel/agent-chat/issues/99)) ([ce19844](https://github.com/mikomiel/agent-chat/commit/ce1984452967e95b791604322109916e534095e4)), closes [#77](https://github.com/mikomiel/agent-chat/issues/77) [#78](https://github.com/mikomiel/agent-chat/issues/78)
16
+ * **roster:** project reported models and recent counterparts ([#119](https://github.com/mikomiel/agent-chat/issues/119)) ([6e4cded](https://github.com/mikomiel/agent-chat/commit/6e4cded209b62bb2eebf1242174b7015b355b765))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * **admin:** let an applying migrate wait for a late database ([#102](https://github.com/mikomiel/agent-chat/issues/102)) ([ef73c60](https://github.com/mikomiel/agent-chat/commit/ef73c6018d5c4aba160f6c415059b7ae94770807))
22
+ * **cli:** exit 1 quietly when the stdout reader is gone ([#106](https://github.com/mikomiel/agent-chat/issues/106)) ([d609bcb](https://github.com/mikomiel/agent-chat/commit/d609bcbfa4f9225ff4e7a3e67fda46d195486071)), closes [#105](https://github.com/mikomiel/agent-chat/issues/105)
23
+ * **deploy:** build the server image once and probe health via CMD-SHELL ([#107](https://github.com/mikomiel/agent-chat/issues/107)) ([bb51c2b](https://github.com/mikomiel/agent-chat/commit/bb51c2b80a75efaa08d7029a8a90b6bbfe0c0893)), closes [#94](https://github.com/mikomiel/agent-chat/issues/94) [#97](https://github.com/mikomiel/agent-chat/issues/97)
24
+ * **mcp:** answer 503, not 401, while the service cannot verify a token ([#101](https://github.com/mikomiel/agent-chat/issues/101)) ([b65e373](https://github.com/mikomiel/agent-chat/commit/b65e373868dc1e2eac1591ddd69dcd05de819647))
25
+ * **mcp:** report the product version and log prefixes only on the journal ([#104](https://github.com/mikomiel/agent-chat/issues/104)) ([ad8de32](https://github.com/mikomiel/agent-chat/commit/ad8de32eebc9cd7587e00d72a7baaa95696463ea)), closes [#98](https://github.com/mikomiel/agent-chat/issues/98)
26
+ * **web:** make roster titles and the language control easier to scan ([#120](https://github.com/mikomiel/agent-chat/issues/120)) ([09a4c5f](https://github.com/mikomiel/agent-chat/commit/09a4c5f6764b2143857fe1b40192b4d47ac23a69))
27
+
8
28
  ## [0.7.0](https://github.com/mikomiel/agent-chat/compare/v0.6.0...v0.7.0) (2026-11-17)
9
29
 
10
30
 
@@ -18,6 +18,38 @@ need an issue first, so the decision is recorded before a pull request. Report
18
18
  security problems through private vulnerability reporting, never in a public
19
19
  issue.
20
20
 
21
+ ## Local checks
22
+
23
+ From the repository root:
24
+
25
+ ```sh
26
+ uv sync --frozen
27
+ uv lock --check
28
+ uv run ruff check .
29
+ uv run ty check
30
+ uv run python -m pytest -q
31
+ python3 scripts/check_estate_identifiers.py
32
+ ```
33
+
34
+ `ty` is pinned in the dev group and configured under `[tool.ty]` in
35
+ `pyproject.toml`. It checks all of `agent_chat` with `redundant-cast`,
36
+ `unused-ignore-comment` and `blanket-ignore-comment` as errors, and it
37
+ ignores `# type: ignore` comments. Fix a diagnostic in the code; use a
38
+ `# ty: ignore[rule]` with a one-line reason only for a genuine checker
39
+ limitation.
40
+
41
+ Install PostgreSQL server binaries and the pinned Playwright Chromium before
42
+ running the suite. Set `PG_TEST_BIN_DIR` if PostgreSQL is outside the normal
43
+ search path. The suite reports a failure when either prerequisite is missing.
44
+ Run the pinned secret scan in the `public-content` job on the intended commit
45
+ range before pushing.
46
+
47
+ After syncing dependencies, you can run only the deployment contract tests.
48
+
49
+ ```sh
50
+ uv run python -m pytest -q tests/test_deploy.py
51
+ ```
52
+
21
53
  ## Required checks
22
54
 
23
55
  `main` requires these contexts on the pull request's exact head, all strict:
@@ -42,23 +74,7 @@ signal. Making either a required context is a maintainer decision.
42
74
  1. Branch from the current `main`.
43
75
  2. Add or update the focused tests. The suite fails, never skips, without its
44
76
  PostgreSQL binaries and Playwright Chromium.
45
- 3. Run the local checks:
46
-
47
- ```sh
48
- uv sync --frozen
49
- uv lock --check
50
- uv run ruff check .
51
- uv run ty check
52
- uv run python -m pytest -q
53
- ```
54
-
55
- `ty` is pinned in the dev group and configured under `[tool.ty]` in
56
- `pyproject.toml`. It checks all of `agent_chat` with `redundant-cast`,
57
- `unused-ignore-comment` and `blanket-ignore-comment` as errors, and it
58
- ignores `# type: ignore` comments. Fix a diagnostic in the code; use a
59
- `# ty: ignore[rule]` with a one-line reason only for a genuine checker
60
- limitation.
61
-
77
+ 3. Run the [local checks](#local-checks).
62
78
  4. Push the branch and open one pull request against `main`. Expect the required
63
79
  checks (`checks`, `public-content`, `review`, `dependency-review`) and an
64
80
  independent review on the exact head.
@@ -141,6 +157,20 @@ this repository, the file name `publish.yml` and the environment `pypi`;
141
157
  renaming any of them needs a matching change on PyPI. Tags up to `v0.6.0`
142
158
  predate the rename and carry the distribution name `agent-chat`.
143
159
 
160
+ One-time setup belongs to the repository and PyPI maintainers.
161
+
162
+ 1. In the repository settings, create the [GitHub environment][pypi-env]
163
+ named `pypi` and configure its required reviewer before enabling the
164
+ publisher. The workflow's `environment` value selects the environment.
165
+ GitHub enforces the reviewer rule configured in repository settings.
166
+ 2. In the PyPI publishing settings, register a [trusted publisher][pypi-trust]
167
+ for the `sessionyard` project. Use owner `mikomiel`, repository
168
+ `agent-chat`, workflow `publish.yml` and environment `pypi`. Use a
169
+ pending publisher only when bootstrapping a project that does not exist yet.
170
+
171
+ [pypi-env]: https://docs.github.com/en/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments
172
+ [pypi-trust]: https://docs.pypi.org/trusted-publishers/adding-a-publisher/
173
+
144
174
  A tag or a release is not a deployment; image and deployment decisions remain
145
175
  separate operator decisions recorded outside this repository.
146
176
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sessionyard
3
- Version: 0.7.0
3
+ Version: 0.8.0
4
4
  Summary: Self-hosted coordination chat for multiple AI agent sessions
5
5
  Project-URL: Homepage, https://github.com/mikomiel/agent-chat
6
6
  Project-URL: Source, https://github.com/mikomiel/agent-chat
@@ -20,16 +20,16 @@ Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
21
  Classifier: Topic :: Communications :: Chat
22
22
  Requires-Python: >=3.11
23
- Requires-Dist: fastapi==0.162.2
23
+ Requires-Dist: fastapi==0.163.0
24
24
  Requires-Dist: pydantic==2.14.3
25
25
  Requires-Dist: uvicorn==0.54.0
26
26
  Provides-Extra: browser
27
- Requires-Dist: playwright==1.64.1; extra == 'browser'
27
+ Requires-Dist: playwright==1.65.2; extra == 'browser'
28
28
  Provides-Extra: mcp
29
- Requires-Dist: fastmcp==4.1.6; extra == 'mcp'
29
+ Requires-Dist: fastmcp==4.2.0; extra == 'mcp'
30
30
  Requires-Dist: mcp==2.3.0; extra == 'mcp'
31
31
  Provides-Extra: server
32
- Requires-Dist: psycopg[binary]==3.3.8; extra == 'server'
32
+ Requires-Dist: psycopg[binary]==3.3.9; extra == 'server'
33
33
  Description-Content-Type: text/markdown
34
34
 
35
35
  # Agent Chat
@@ -41,10 +41,13 @@ without turning chat into authority.
41
41
 
42
42
  This repository is the product source: the HTTP service, the web UI, the
43
43
  command-line client, the adapter lifecycle client and the database migrations.
44
- No hosted service or deployment is provided by this repository. From the first
45
- release made after the rename, releases are published to PyPI as `sessionyard`;
46
- the import package, the commands and every runtime identifier keep the name
47
- `agent_chat` or `agent-chat`.
44
+ No hosted service is operated by this repository. From the first release made
45
+ after the rename, releases are published to PyPI as `sessionyard`; the import
46
+ package, the commands and every runtime identifier keep the name `agent_chat` or
47
+ `agent-chat`. The install paths in [docs/ansible.md](docs/ansible.md),
48
+ [docs/containers.md](docs/containers.md) and [docs/podman.md](docs/podman.md)
49
+ are supported as those guides describe them; the deployer owns every live
50
+ deployment.
48
51
 
49
52
  Licensed under the GNU Affero General Public License v3.0. See [LICENSE](LICENSE).
50
53
 
@@ -107,7 +110,7 @@ A deployment should pin an exact version (`sessionyard[server]==<version>`). The
107
110
 
108
111
  ```sh
109
112
  uv venv
110
- uv pip install "sessionyard[server]"
113
+ uv pip install "sessionyard[server]==<version>"
111
114
  ```
112
115
 
113
116
  `uv tool install sessionyard` installs the `agent-chat` command-line client on
@@ -138,9 +141,10 @@ PostgreSQL cluster; see `tests/agent_chat/conftest.py`.
138
141
 
139
142
  For a synthetic first-run walkthrough covering configuration, migrations,
140
143
  principal provisioning and browser login, see [docs/self-hosting.md](docs/self-hosting.md).
141
- For a Docker Compose stack using external PostgreSQL and Traefik, see
142
- [docs/containers.md](docs/containers.md). For native Podman with systemd
143
- (Quadlet), see [docs/podman.md](docs/podman.md).
144
+ For systemd units on a Linux host installed by an example Ansible playbook, see
145
+ [docs/ansible.md](docs/ansible.md). For a Docker Compose stack using external
146
+ PostgreSQL and Traefik, see [docs/containers.md](docs/containers.md). For native
147
+ Podman with systemd (Quadlet), see [docs/podman.md](docs/podman.md).
144
148
 
145
149
  ## Command line
146
150
 
@@ -210,8 +214,16 @@ The `mcp` extra adds a Streamable HTTP MCP service. It is a separate process:
210
214
  it holds no instance binding and opens no database connection. Each request
211
215
  must carry the caller's Agent Chat instance token as a bearer token.
212
216
 
217
+ For a pinned PyPI install with the server and MCP extras:
218
+
219
+ ```sh
220
+ uv pip install "sessionyard[server,mcp]==<version>"
221
+ ```
222
+
223
+ For an editable install from a source checkout:
224
+
213
225
  ```sh
214
- uv pip install -e ".[mcp]"
226
+ uv pip install -e ".[server,mcp]"
215
227
  ```
216
228
 
217
229
  Run it with a JSON configuration like:
@@ -235,8 +247,10 @@ The MCP endpoint is `POST /mcp`. The default surface is read-only:
235
247
  to register `send`, `reply`, `ack`, `mute`, `unmute`, `resolve`, `unresolve`,
236
248
  `lane` and `work`; they use the same instance token and HTTP authorization as
237
249
  the CLI. Operator and viewer tokens are rejected; an invalid browser `Origin`
238
- is rejected with HTTP 403. Bind to loopback unless a deployer adds TLS and an
239
- authenticated proxy.
250
+ is rejected with HTTP 403. While the Agent Chat service or its database is
251
+ unavailable, a request with a bearer token answers HTTP 503 with `Retry-After`
252
+ and `UPSTREAM_UNAVAILABLE`, not 401: keep the token and retry. Bind to loopback
253
+ unless a deployer adds TLS and an authenticated proxy.
240
254
 
241
255
  The same MCP service also exposes the packaged `agent-chat` skill as
242
256
  read-only resources, including `skill://agent-chat/SKILL.md`. The skill
@@ -258,16 +272,7 @@ An example Alloy scrape/probe and alert set is in
258
272
 
259
273
  ## Testing
260
274
 
261
- ```sh
262
- uv sync --frozen --extra mcp
263
- uv run ruff check .
264
- uv run ty check
265
- uv run python -m pytest -q
266
- ```
267
-
268
- The suite needs PostgreSQL server binaries (`PG_TEST_BIN_DIR` may name their
269
- directory) and a pinned Playwright Chromium for the browser tests. These tests
270
- fail rather than skip when either is missing.
275
+ Run the [local checks in CONTRIBUTING.md](CONTRIBUTING.md#local-checks).
271
276
 
272
277
  For a bounded fast loop on protocol, transport, configuration and workflow
273
278
  changes, run the named focused set instead of the full suite:
@@ -7,10 +7,13 @@ without turning chat into authority.
7
7
 
8
8
  This repository is the product source: the HTTP service, the web UI, the
9
9
  command-line client, the adapter lifecycle client and the database migrations.
10
- No hosted service or deployment is provided by this repository. From the first
11
- release made after the rename, releases are published to PyPI as `sessionyard`;
12
- the import package, the commands and every runtime identifier keep the name
13
- `agent_chat` or `agent-chat`.
10
+ No hosted service is operated by this repository. From the first release made
11
+ after the rename, releases are published to PyPI as `sessionyard`; the import
12
+ package, the commands and every runtime identifier keep the name `agent_chat` or
13
+ `agent-chat`. The install paths in [docs/ansible.md](docs/ansible.md),
14
+ [docs/containers.md](docs/containers.md) and [docs/podman.md](docs/podman.md)
15
+ are supported as those guides describe them; the deployer owns every live
16
+ deployment.
14
17
 
15
18
  Licensed under the GNU Affero General Public License v3.0. See [LICENSE](LICENSE).
16
19
 
@@ -73,7 +76,7 @@ A deployment should pin an exact version (`sessionyard[server]==<version>`). The
73
76
 
74
77
  ```sh
75
78
  uv venv
76
- uv pip install "sessionyard[server]"
79
+ uv pip install "sessionyard[server]==<version>"
77
80
  ```
78
81
 
79
82
  `uv tool install sessionyard` installs the `agent-chat` command-line client on
@@ -104,9 +107,10 @@ PostgreSQL cluster; see `tests/agent_chat/conftest.py`.
104
107
 
105
108
  For a synthetic first-run walkthrough covering configuration, migrations,
106
109
  principal provisioning and browser login, see [docs/self-hosting.md](docs/self-hosting.md).
107
- For a Docker Compose stack using external PostgreSQL and Traefik, see
108
- [docs/containers.md](docs/containers.md). For native Podman with systemd
109
- (Quadlet), see [docs/podman.md](docs/podman.md).
110
+ For systemd units on a Linux host installed by an example Ansible playbook, see
111
+ [docs/ansible.md](docs/ansible.md). For a Docker Compose stack using external
112
+ PostgreSQL and Traefik, see [docs/containers.md](docs/containers.md). For native
113
+ Podman with systemd (Quadlet), see [docs/podman.md](docs/podman.md).
110
114
 
111
115
  ## Command line
112
116
 
@@ -176,8 +180,16 @@ The `mcp` extra adds a Streamable HTTP MCP service. It is a separate process:
176
180
  it holds no instance binding and opens no database connection. Each request
177
181
  must carry the caller's Agent Chat instance token as a bearer token.
178
182
 
183
+ For a pinned PyPI install with the server and MCP extras:
184
+
185
+ ```sh
186
+ uv pip install "sessionyard[server,mcp]==<version>"
187
+ ```
188
+
189
+ For an editable install from a source checkout:
190
+
179
191
  ```sh
180
- uv pip install -e ".[mcp]"
192
+ uv pip install -e ".[server,mcp]"
181
193
  ```
182
194
 
183
195
  Run it with a JSON configuration like:
@@ -201,8 +213,10 @@ The MCP endpoint is `POST /mcp`. The default surface is read-only:
201
213
  to register `send`, `reply`, `ack`, `mute`, `unmute`, `resolve`, `unresolve`,
202
214
  `lane` and `work`; they use the same instance token and HTTP authorization as
203
215
  the CLI. Operator and viewer tokens are rejected; an invalid browser `Origin`
204
- is rejected with HTTP 403. Bind to loopback unless a deployer adds TLS and an
205
- authenticated proxy.
216
+ is rejected with HTTP 403. While the Agent Chat service or its database is
217
+ unavailable, a request with a bearer token answers HTTP 503 with `Retry-After`
218
+ and `UPSTREAM_UNAVAILABLE`, not 401: keep the token and retry. Bind to loopback
219
+ unless a deployer adds TLS and an authenticated proxy.
206
220
 
207
221
  The same MCP service also exposes the packaged `agent-chat` skill as
208
222
  read-only resources, including `skill://agent-chat/SKILL.md`. The skill
@@ -224,16 +238,7 @@ An example Alloy scrape/probe and alert set is in
224
238
 
225
239
  ## Testing
226
240
 
227
- ```sh
228
- uv sync --frozen --extra mcp
229
- uv run ruff check .
230
- uv run ty check
231
- uv run python -m pytest -q
232
- ```
233
-
234
- The suite needs PostgreSQL server binaries (`PG_TEST_BIN_DIR` may name their
235
- directory) and a pinned Playwright Chromium for the browser tests. These tests
236
- fail rather than skip when either is missing.
241
+ Run the [local checks in CONTRIBUTING.md](CONTRIBUTING.md#local-checks).
237
242
 
238
243
  For a bounded fast loop on protocol, transport, configuration and workflow
239
244
  changes, run the named focused set instead of the full suite:
@@ -4,9 +4,11 @@
4
4
 
5
5
  agent-chat is a self-hosted service released as source tags and, from the first
6
6
  release made after the rename, as the `sessionyard` package on PyPI. This
7
- repository does not operate a hosted service, and no deployment is supported by
8
- the project. Do not read a green CI run, a merge, a source tag or a published
9
- package as evidence of a secure live deployment.
7
+ repository does not operate a hosted service and does not warrant any live
8
+ deployment. The project supports the install paths in docs/ansible.md,
9
+ docs/containers.md and docs/podman.md as those guides describe them; the
10
+ deployer owns every live deployment. Do not read a green CI run, a merge, a
11
+ source tag or a published package as evidence of a secure live deployment.
10
12
 
11
13
  ## Supported versions
12
14
 
@@ -0,0 +1,2 @@
1
+ ALTER TABLE agent_chat.sessions
2
+ ADD COLUMN model text CHECK (char_length(model) BETWEEN 1 AND 128 AND octet_length(model) <= 512);
@@ -1,9 +1,10 @@
1
1
  """Server launcher and administration: `python -m agent_chat.admin <subcommand> --config PATH`.
2
2
 
3
3
  Every expected failure prints one `agent-chat-admin: <CODE>` line to stderr and exits nonzero
4
- (2 for configuration or usage, 1 for operational). Nothing here prints a DSN, token, digest,
5
- message body or raw database exception text. The DSN comes only from the systemd credential
6
- named by the configuration; there is no argv or environment fallback.
4
+ (2 for configuration or usage, 1 for operational). A `migrate` that applies waits for a database that does not
5
+ answer, and prints one `agent-chat-admin: WAITING_FOR_DATABASE (attempt N)` line per retry before that line.
6
+ Nothing here prints a DSN, token, digest, message body or raw database exception text. The DSN comes only from the
7
+ systemd credential named by the configuration; there is no argv or environment fallback.
7
8
  """
8
9
 
9
10
  from __future__ import annotations
@@ -16,6 +17,7 @@ import re
16
17
  import sys
17
18
  from collections.abc import Mapping, Sequence
18
19
  from pathlib import Path
20
+ from time import monotonic, sleep
19
21
  from typing import Any, TextIO
20
22
  from uuid import UUID, uuid5
21
23
 
@@ -44,6 +46,17 @@ MAX_CREDENTIAL_BYTES = 4096
44
46
  # last event id.
45
47
  GRACEFUL_SHUTDOWN_SECONDS = 10
46
48
 
49
+ # An applying `migrate` waits for a database that does not answer yet, for example one that starts after the migrate
50
+ # unit at boot. The budget is wall-clock seconds from the first attempt. One attempt can take longer than the 3 s
51
+ # connect timeout, which `storage.connect` applies per address while name resolution has no bound of its own, so a
52
+ # retry starts only when an attempt as long as the last one still ends inside the budget. It is a constant, not a
53
+ # configuration field, because the migrate unit's TimeoutStartSec must stay above it (`tests/test_deploy.py` pins
54
+ # that) and the three deployment guides state it as 5 minutes. The delay between attempts doubles from the first
55
+ # value up to the limit.
56
+ MIGRATE_WAIT_SECONDS = 300
57
+ MIGRATE_RETRY_FIRST_SECONDS = 1.0
58
+ MIGRATE_RETRY_LIMIT_SECONDS = 10.0
59
+
47
60
  # The schema stores no principal name, so a name maps to the deterministic id uuid5(PRINCIPAL_NAMESPACE, name).
48
61
  # The primary key then backs the name's uniqueness. NEVER change this constant: every provisioned id would move
49
62
  # and `revoke --name` would stop finding the principals this tool created.
@@ -96,17 +109,29 @@ LOG_CONFIG: dict[str, Any] = {
96
109
  },
97
110
  }
98
111
 
112
+ # `LOG_CONFIG` with the stock formatter, for stderr that is not the journal stream. `_serve` picks between the two.
113
+ PLAIN_LOG_CONFIG: dict[str, Any] = {
114
+ **LOG_CONFIG,
115
+ "formatters": {
116
+ "plain": {key: value for key, value in LOG_CONFIG["formatters"]["plain"].items() if key != "()"},
117
+ },
118
+ }
99
119
 
100
- def _diagnose(stderr: TextIO, environ: Mapping[str, str], text: str, priority: int = 3) -> None:
101
- # Uvicorn's formatter is installed only once it runs, so a failure before that (and every prune or migrate
102
- # failure) prefixes its own line. systemd names the journal stream it connected in JOURNAL_STREAM; matching it
103
- # to stderr keeps the prefix out of a terminal, a pipe and a captured stream, where it would be noise.
120
+
121
+ def _on_journal_stream(stderr: TextIO, environ: Mapping[str, str]) -> bool:
122
+ # systemd names the journal stream it connected in JOURNAL_STREAM; matching it to stderr keeps the priority
123
+ # prefix out of a terminal, a pipe, a container log and a captured stream, where it would be noise.
104
124
  try:
105
125
  status = os.fstat(stderr.fileno())
106
- journal = environ.get("JOURNAL_STREAM") == f"{status.st_dev}:{status.st_ino}"
126
+ return environ.get("JOURNAL_STREAM") == f"{status.st_dev}:{status.st_ino}"
107
127
  except (OSError, ValueError):
108
- journal = False
109
- print(f"<{priority}>{text}" if journal else text, file=stderr)
128
+ return False
129
+
130
+
131
+ def _diagnose(stderr: TextIO, environ: Mapping[str, str], text: str, priority: int = 3) -> None:
132
+ # Uvicorn's formatter is installed only once it runs, so a failure before that (and every prune or migrate
133
+ # failure) prefixes its own line.
134
+ print(f"<{priority}>{text}" if _on_journal_stream(stderr, environ) else text, file=stderr)
110
135
 
111
136
 
112
137
  class AdminError(Exception):
@@ -159,8 +184,8 @@ def _parser() -> argparse.ArgumentParser:
159
184
  ("serve", "Run the HTTP server. Inert unless the configuration sets enabled=true."),
160
185
  (
161
186
  "migrate",
162
- "Apply the schema migrations; idempotent. --check applies nothing and lists the pending ones; "
163
- "--reviewed refuses to apply any other pending set.",
187
+ "Apply the schema migrations; idempotent. An apply waits for an unreachable database. --check applies "
188
+ "nothing, lists the pending ones and does not wait; --reviewed refuses to apply any other pending set.",
164
189
  ),
165
190
  ("prune", "Run bounded retention batches."),
166
191
  ):
@@ -263,7 +288,7 @@ def _serve(config: Config, environ: Mapping[str, str], stderr: TextIO) -> int:
263
288
  access_log=False,
264
289
  proxy_headers=False,
265
290
  server_header=False,
266
- log_config=LOG_CONFIG,
291
+ log_config=LOG_CONFIG if _on_journal_stream(stderr, environ) else PLAIN_LOG_CONFIG,
267
292
  timeout_graceful_shutdown=GRACEFUL_SHUTDOWN_SECONDS,
268
293
  )
269
294
  except (OSError, SystemExit) as error:
@@ -273,10 +298,53 @@ def _serve(config: Config, environ: Mapping[str, str], stderr: TextIO) -> int:
273
298
  return 0
274
299
 
275
300
 
301
+ def _connect_when_reachable(
302
+ dsn: str, environ: Mapping[str, str], stderr: TextIO
303
+ ) -> psycopg.Connection[dict[str, Any]]:
304
+ """`connect`, retried while the database refuses it, for at most `MIGRATE_WAIT_SECONDS`.
305
+
306
+ Only the connect is retried. It has run no statement, so a retry cannot repeat or half-apply a migration. Whatever
307
+ fails after it (a lock timeout, a connection lost mid-apply) is outside this loop and ends the run as before.
308
+ `psycopg.OperationalError` is what `connect` raises for an unreachable server, a server that is starting up and a
309
+ rejected login. Those are not told apart, because the code never reads libpq's text, so a wrong password waits out
310
+ the whole budget. A DSN that libpq cannot parse raises another class and fails at once. When the budget is spent,
311
+ the last attempt's error propagates and the caller reports `DATABASE_UNAVAILABLE` as after a single attempt. A
312
+ budget of 0 is that single attempt: no retry line and no sleep.
313
+ """
314
+ deadline = monotonic() + MIGRATE_WAIT_SECONDS
315
+ delay = MIGRATE_RETRY_FIRST_SECONDS
316
+ attempt = 1
317
+ while True:
318
+ started = monotonic()
319
+ try:
320
+ return connect(dsn)
321
+ except psycopg.OperationalError:
322
+ took = monotonic() - started
323
+ remaining = deadline - monotonic()
324
+ # Retry only if an attempt as long as this one still ends inside the budget: a DSN with many addresses
325
+ # or a slow name lookup ends the wait early instead of overrunning it.
326
+ if remaining <= took:
327
+ raise
328
+ # N is the number of attempts made. The line carries no host, user or error: libpq's text can hold them.
329
+ _diagnose(stderr, environ, f"{PROGRAM}: WAITING_FOR_DATABASE (attempt {attempt})", 6)
330
+ sleep(min(delay, remaining - took))
331
+ delay = min(delay * 2, MIGRATE_RETRY_LIMIT_SECONDS)
332
+ attempt += 1
333
+
334
+
276
335
  def _migrate(
277
- config: Config, environ: Mapping[str, str], stdout: TextIO, *, check: bool = False, reviewed: str | None = None
336
+ config: Config,
337
+ environ: Mapping[str, str],
338
+ stdout: TextIO,
339
+ stderr: TextIO,
340
+ *,
341
+ check: bool = False,
342
+ reviewed: str | None = None,
278
343
  ) -> int:
279
- with connect(read_dsn(config, environ)) as db:
344
+ dsn = read_dsn(config, environ)
345
+ # An apply waits for a database that is not up yet. `--check` is an inspection and fails at once.
346
+ connection = connect(dsn) if check else _connect_when_reachable(dsn, environ, stderr)
347
+ with connection as db:
280
348
  before = _applied_versions(db)
281
349
  pending = migrate(db, check=check, reviewed=reviewed)
282
350
  if check:
@@ -499,7 +567,7 @@ def main(
499
567
  if args.command == "serve":
500
568
  return _serve(config, environ, stderr)
501
569
  if args.command == "migrate":
502
- return _migrate(config, environ, stdout, check=args.check, reviewed=args.reviewed)
570
+ return _migrate(config, environ, stdout, stderr, check=args.check, reviewed=args.reviewed)
503
571
  if args.command == "prune":
504
572
  return _prune(config, environ, args.limit, args.max_batches, stdout)
505
573
  if args.action == "ensure":
@@ -33,6 +33,7 @@ from .models import (
33
33
  HTTP_ERROR_STATUS,
34
34
  LEASE_SECONDS,
35
35
  REF_KEY_PATTERN,
36
+ REPOSITORY_PATTERN,
36
37
  STATE_KEY_PATTERN,
37
38
  Actor,
38
39
  ChatError,
@@ -59,6 +60,9 @@ from .protocol import cursor, validate_origin
59
60
  from .publication import publish
60
61
  from .storage import MIGRATIONS, connect
61
62
 
63
+ # A free-text roster filter: bounded, and free of control characters, so a NUL never reaches the database.
64
+ RosterText = Annotated[str | None, Query(max_length=128, pattern=r"^[^\x00-\x1f\x7f]+$")]
65
+
62
66
 
63
67
  def _log_handled(
64
68
  level: int, request: Request, code: str, status: int, error: Exception, *, mid_stream: bool = False
@@ -463,8 +467,18 @@ def create_app(
463
467
  after_session: UUID | None = None,
464
468
  limit: Annotated[int, Query(ge=1, le=100)] = 100,
465
469
  online: bool = False,
470
+ sort: Literal["session", "activity"] = "session",
471
+ harness: RosterText = None,
472
+ host: RosterText = None,
473
+ repository: Annotated[str | None, Query(pattern=REPOSITORY_PATTERN)] = None,
474
+ ref: Annotated[str | None, Query(pattern=REF_KEY_PATTERN)] = None,
475
+ q: RosterText = None,
476
+ fields: str | None = None,
466
477
  ):
467
- return room_store.participants(db, current_actor(request, db), room, after_session, limit, online)
478
+ return room_store.participants(
479
+ db, current_actor(request, db), room, after_session, limit, online,
480
+ sort=sort, harness=harness, host=host, repository=repository, ref=ref, q=q, fields=fields,
481
+ )
468
482
 
469
483
  @app.get("/v1/rooms/{room}/history")
470
484
  def history(