pycodex-ws 0.7.0__tar.gz → 0.7.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 (166) hide show
  1. pycodex_ws-0.7.0/README.md → pycodex_ws-0.7.2/PKG-INFO +33 -6
  2. pycodex_ws-0.7.0/PKG-INFO → pycodex_ws-0.7.2/README.md +21 -17
  3. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_router/client.py +0 -33
  4. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_router/protocol.py +1 -1
  5. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_ws/__init__.py +8 -2
  6. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_ws/feishu_card.py +28 -2
  7. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_ws/feishu_link.py +2 -1
  8. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_ws/feishu_render.py +1 -1
  9. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pyproject.toml +4 -2
  10. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/WORKSPACE_API.md +58 -15
  11. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/agent_access.py +64 -7
  12. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/app.py +68 -134
  13. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/banners.mjs +2 -10
  14. pycodex_ws-0.7.2/workspace_server/content_views.css +1 -0
  15. pycodex_ws-0.7.2/workspace_server/content_views.mjs +43 -0
  16. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/conversation.mjs +122 -17
  17. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/dialogs.mjs +28 -56
  18. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/external_call.py +26 -11
  19. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/content_views.css +20 -3
  20. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/content_views.mjs +58 -50
  21. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/transcript.mjs +3 -7
  22. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/markdown.mjs +14 -2
  23. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/reasoning-display/README.md +3 -2
  24. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/voice-input/source/verify.cjs +1 -2
  25. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/source/verify.cjs +1 -2
  26. pycodex_ws-0.7.2/workspace_server/owned_process.py +188 -0
  27. pycodex_ws-0.7.2/workspace_server/reloader.py +130 -0
  28. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/routes.py +207 -41
  29. pycodex_ws-0.7.2/workspace_server/runtime_info.py +97 -0
  30. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/session_view.py +121 -28
  31. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/sessions.py +107 -32
  32. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/sessions_ui.mjs +13 -8
  33. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/vscode_server.py +191 -8
  34. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/workspace.css +171 -23
  35. pycodex_ws-0.7.2/workspace_server/workspace.html +375 -0
  36. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/workspace.mjs +113 -47
  37. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/workspace.template.html +22 -1
  38. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/workspace_dom.mjs +11 -0
  39. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/workspace_views.py +14 -12
  40. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/workspaces.html +13 -29
  41. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/workspaces.py +37 -11
  42. pycodex_ws-0.7.0/workspace_server/content_views.css +0 -1
  43. pycodex_ws-0.7.0/workspace_server/content_views.mjs +0 -43
  44. pycodex_ws-0.7.0/workspace_server/owned_process.py +0 -57
  45. pycodex_ws-0.7.0/workspace_server/reloader.py +0 -459
  46. pycodex_ws-0.7.0/workspace_server/runtime_info.py +0 -48
  47. pycodex_ws-0.7.0/workspace_server/workspace.html +0 -354
  48. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/.gitignore +0 -0
  49. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/LICENSE +0 -0
  50. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_router/__init__.py +0 -0
  51. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_router/__main__.py +0 -0
  52. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_router/browser.py +0 -0
  53. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_router/index.html +0 -0
  54. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_router/server.py +0 -0
  55. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_ws/feishu_auth.py +0 -0
  56. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_ws/feishu_connection.py +0 -0
  57. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_ws/feishu_oauth.py +0 -0
  58. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_ws/server_support.py +0 -0
  59. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/pycodex_ws/workspace_config.py +0 -0
  60. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/__init__.py +0 -0
  61. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/__main__.py +0 -0
  62. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/content_views.LICENSE.txt +0 -0
  63. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/custom_frontend.mjs +0 -0
  64. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/customization.py +0 -0
  65. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/editor.css +0 -0
  66. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/editor.mjs +0 -0
  67. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/.gitignore +0 -0
  68. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/build.mjs +0 -0
  69. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/composer.mjs +0 -0
  70. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/editor.css +0 -0
  71. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/editor.mjs +0 -0
  72. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/editor_context.mjs +0 -0
  73. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/package-lock.json +0 -0
  74. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/package.json +0 -0
  75. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/prompt_history.mjs +0 -0
  76. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/touch_selection.mjs +0 -0
  77. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/frontend/view_labels.mjs +0 -0
  78. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/CONTRIBUTING.md +0 -0
  79. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/README.md +0 -0
  80. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/clock-ticks/README.md +0 -0
  81. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/clock-ticks/preview-mobile.png +0 -0
  82. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/clock-ticks/preview.html +0 -0
  83. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/clock-ticks/preview.png +0 -0
  84. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/clock-ticks/source/custom.css +0 -0
  85. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/clock-ticks/source/custom.js +0 -0
  86. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/clock-ticks/source/fixture.mjs +0 -0
  87. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/clock-ticks/source/verify.mjs +0 -0
  88. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/consecutive-tool-groups/README.md +0 -0
  89. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/consecutive-tool-groups/preview-mobile.png +0 -0
  90. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/consecutive-tool-groups/preview.html +0 -0
  91. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/consecutive-tool-groups/preview.png +0 -0
  92. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/consecutive-tool-groups/source/fixture.mjs +0 -0
  93. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/consecutive-tool-groups/source/tool-groups.css +0 -0
  94. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/consecutive-tool-groups/source/tool-groups.js +0 -0
  95. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/consecutive-tool-groups/source/verify.mjs +0 -0
  96. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/exec-status/README.md +0 -0
  97. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/exec-status/preview-mobile.png +0 -0
  98. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/exec-status/preview.html +0 -0
  99. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/exec-status/preview.png +0 -0
  100. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/exec-status/source/custom.css +0 -0
  101. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/exec-status/source/custom.js +0 -0
  102. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/exec-status/source/fixture.mjs +0 -0
  103. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/exec-status/source/verify.mjs +0 -0
  104. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/file-attachments/README.md +0 -0
  105. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/file-attachments/source/custom.css +0 -0
  106. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/file-attachments/source/custom.js +0 -0
  107. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/file-attachments/source/upload_browser.py +0 -0
  108. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/file-attachments/source/upload_core.mjs +0 -0
  109. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/file-attachments/source/upload_core.test.mjs +0 -0
  110. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/file-attachments/source/uploads.mjs +0 -0
  111. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/reasoning-display/preview-mobile.png +0 -0
  112. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/reasoning-display/preview.html +0 -0
  113. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/reasoning-display/preview.png +0 -0
  114. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/reasoning-display/source/custom.css +0 -0
  115. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/reasoning-display/source/custom.js +0 -0
  116. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/reasoning-display/source/fixture.mjs +0 -0
  117. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/reasoning-display/source/verify.mjs +0 -0
  118. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-time-sort/README.md +0 -0
  119. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-time-sort/source/custom.css +0 -0
  120. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-time-sort/source/custom.js +0 -0
  121. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-time-sort/source/session-time-sort.mjs +0 -0
  122. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-time-sort/source/verify.mjs +0 -0
  123. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-tips/README.md +0 -0
  124. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-tips/preview-mobile.png +0 -0
  125. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-tips/preview.html +0 -0
  126. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-tips/preview.png +0 -0
  127. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-tips/source/custom.css +0 -0
  128. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-tips/source/custom.js +0 -0
  129. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-tips/source/fixture.mjs +0 -0
  130. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-tips/source/session-tips.js +0 -0
  131. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/session-tips/source/verify.mjs +0 -0
  132. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/skill-completion/README.md +0 -0
  133. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/skill-completion/preview.png +0 -0
  134. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/skill-completion/source/custom.css +0 -0
  135. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/skill-completion/source/custom.js +0 -0
  136. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/skill-completion/source/skill-completion.css +0 -0
  137. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/skill-completion/source/skill-completion.mjs +0 -0
  138. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/skill-completion/source/verify.mjs +0 -0
  139. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/tool-calls/README.md +0 -0
  140. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/tool-calls/preview-mobile.png +0 -0
  141. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/tool-calls/preview.html +0 -0
  142. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/tool-calls/preview.png +0 -0
  143. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/tool-calls/source/custom.css +0 -0
  144. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/tool-calls/source/custom.js +0 -0
  145. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/tool-calls/source/fixture.mjs +0 -0
  146. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/tool-calls/source/verify.mjs +0 -0
  147. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/voice-input/README.md +0 -0
  148. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/voice-input/preview-mobile.png +0 -0
  149. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/voice-input/preview.png +0 -0
  150. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/voice-input/source/custom.css +0 -0
  151. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/voice-input/source/custom.js +0 -0
  152. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/voice-input/source/voice-input.css +0 -0
  153. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/voice-input/source/voice-input.js +0 -0
  154. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/README.md +0 -0
  155. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/preview-mobile.png +0 -0
  156. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/preview.png +0 -0
  157. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/source/notifications.py +0 -0
  158. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/source/runtime_checks.py +0 -0
  159. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/source/summarize.py +0 -0
  160. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/source/test_notifications.py +0 -0
  161. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/source/test_xiaoai.py +0 -0
  162. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/source/workspace.patch +0 -0
  163. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/optional_features/xiaoai-notifications/source/xiaoai.py +0 -0
  164. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/session_api.py +0 -0
  165. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/sharing.py +0 -0
  166. {pycodex_ws-0.7.0 → pycodex_ws-0.7.2}/workspace_server/view_sources.py +0 -0
@@ -1,3 +1,15 @@
1
+ Metadata-Version: 2.1
2
+ Name: pycodex-ws
3
+ Version: 0.7.2
4
+ Summary: Browser workspace and optional Feishu integration for python-codex
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.7
7
+ Requires-Dist: pillow>=9.0.0
8
+ Requires-Dist: pyagy==0.7.2
9
+ Requires-Dist: python-codex==0.7.2
10
+ Requires-Dist: websockets<16,>=11
11
+ Description-Content-Type: text/markdown
12
+
1
13
  # pycodex-ws
2
14
 
3
15
  Browser conversations, a live HTML Canvas, read-only file/diff viewers and
@@ -30,8 +42,14 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
30
42
 
31
43
  Open `http://127.0.0.1:6007`. Use `python3 -m workspace_server` if the command
32
44
  is not on `PATH`. Keep stdin open while the server runs; EOF initiates shutdown.
45
+ On Windows you can leave the console idle. Press Ctrl+Z followed by Enter
46
+ to send EOF, or close the stdin pipe if using a launcher.
33
47
  Model configuration comes from `~/.codex/config.toml`.
34
48
 
49
+ With `pycodex-ws --listen-to KEY@router:6000`, the OS assigns a free local
50
+ loopback port. The CLI prints the local URL and registers that port with the
51
+ router. Add `--listen 127.0.0.1:6007` to use a fixed port.
52
+
35
53
  ## Conversations and views
36
54
 
37
55
  The session sidebar starts collapsed. Hover to preview it, click to keep it
@@ -39,9 +57,10 @@ open, and click the toggle or empty space again to close it. Expansion narrows
39
57
  the conversation while keeping the board fixed. On phones, use the header
40
58
  buttons to switch between chat and board.
41
59
 
42
- Use the expanded sidebar to create, rename or close sessions. Click × and
43
- confirm to close a session; the last session stays open. Status dots show
44
- running sessions and unread replies. `/cd <directory>` changes the current
60
+ Use the expanded sidebar to create, rename or close sessions. Click ×, then
61
+ choose **Close** in the same row. **Cancel** or Escape dismisses the confirmation.
62
+ The last session stays open. Status dots show running sessions and unread
63
+ replies. `/cd <directory>` changes the current
45
64
  session's working directory while idle; `/model`, `/resume`, `/compact` and
46
65
  other core session commands are also available.
47
66
 
@@ -49,6 +68,15 @@ Use **New session** for the default profile, or its **+** button to choose one.
49
68
  Profiles reload when you open the chooser or create a session, so config changes
50
69
  apply to new sessions without restarting the server. Existing sessions keep their configuration.
51
70
 
71
+ Administrators can use **Settings → Reload PyCodex** and choose **Reboot** or
72
+ **Update & reboot** to restart on updated code without restarting the process.
73
+ Idle sessions close at once and running turns finish first (no new turns start
74
+ meanwhile); background exec processes are terminated, clock periods resume, and
75
+ sessions are restored from disk. Logins and share passwords are cleared; refresh
76
+ the page afterwards. The endpoint `POST api/reload` accepts `{"upgrade": true}`
77
+ or `{"upgrade": "VERSION"}`, which runs `pip install --upgrade pycodex-ws` with
78
+ the server's Python first. The router connection (`--listen-to`) stays up.
79
+
52
80
  Consecutive model reconnection diagnostics share one collapsed `Model retries`
53
81
  row per sequence. The summary shows the number of recorded retries, the latest
54
82
  attempt and its HTTP status when available. Expand it to read the original errors
@@ -58,6 +86,8 @@ refreshing starts collapsed. Other model diagnostics and final errors stay visib
58
86
  Click Markdown links to open files and comparisons, for example
59
87
  `[source](app.py:42)` or `[changes](diff:HEAD:app.py)`. A Markdown link such as
60
88
  `[source](file:///data/project/app.py#L42-L48)` opens the workspace file at line 42.
89
+ In a local Markdown preview, `![Screenshot](preview.png)` displays the image beside the Markdown file.
90
+ Assistant replies can embed a local plot by absolute path, such as `![Plot](/data/results/plot.png)`.
61
91
  In a code or diff view, select text and choose **Insert into chat** to add editable context to the draft.
62
92
  Click a context block to edit or remove it before sending.
63
93
  See [view links and supported formats](../../docs/RUNTIME.md#workspace-content-views).
@@ -80,9 +110,6 @@ identifying the source of a user message. The history API returns it, and
80
110
  recorded sessions preserve it across resume. It is metadata only: the model request and frontend display do
81
111
  not include it. See the [message API contract](workspace_server/WORKSPACE_API.md#commands-and-results).
82
112
 
83
- The [VS Code extension](extensions/vscode/README.md) uses this backend and is
84
- distributed separately as a VSIX.
85
-
86
113
  ## Customize the interface
87
114
 
88
115
  Choose **Settings → Customize Agent** from the conversation header to open a
@@ -1,14 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: pycodex-ws
3
- Version: 0.7.0
4
- Summary: Browser workspace and optional Feishu integration for python-codex
5
- License-File: LICENSE
6
- Requires-Python: >=3.7
7
- Requires-Dist: pillow>=9.0.0
8
- Requires-Dist: python-codex==0.7.0
9
- Requires-Dist: websockets<16,>=11
10
- Description-Content-Type: text/markdown
11
-
12
1
  # pycodex-ws
13
2
 
14
3
  Browser conversations, a live HTML Canvas, read-only file/diff viewers and
@@ -41,8 +30,14 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
41
30
 
42
31
  Open `http://127.0.0.1:6007`. Use `python3 -m workspace_server` if the command
43
32
  is not on `PATH`. Keep stdin open while the server runs; EOF initiates shutdown.
33
+ On Windows you can leave the console idle. Press Ctrl+Z followed by Enter
34
+ to send EOF, or close the stdin pipe if using a launcher.
44
35
  Model configuration comes from `~/.codex/config.toml`.
45
36
 
37
+ With `pycodex-ws --listen-to KEY@router:6000`, the OS assigns a free local
38
+ loopback port. The CLI prints the local URL and registers that port with the
39
+ router. Add `--listen 127.0.0.1:6007` to use a fixed port.
40
+
46
41
  ## Conversations and views
47
42
 
48
43
  The session sidebar starts collapsed. Hover to preview it, click to keep it
@@ -50,9 +45,10 @@ open, and click the toggle or empty space again to close it. Expansion narrows
50
45
  the conversation while keeping the board fixed. On phones, use the header
51
46
  buttons to switch between chat and board.
52
47
 
53
- Use the expanded sidebar to create, rename or close sessions. Click × and
54
- confirm to close a session; the last session stays open. Status dots show
55
- running sessions and unread replies. `/cd <directory>` changes the current
48
+ Use the expanded sidebar to create, rename or close sessions. Click ×, then
49
+ choose **Close** in the same row. **Cancel** or Escape dismisses the confirmation.
50
+ The last session stays open. Status dots show running sessions and unread
51
+ replies. `/cd <directory>` changes the current
56
52
  session's working directory while idle; `/model`, `/resume`, `/compact` and
57
53
  other core session commands are also available.
58
54
 
@@ -60,6 +56,15 @@ Use **New session** for the default profile, or its **+** button to choose one.
60
56
  Profiles reload when you open the chooser or create a session, so config changes
61
57
  apply to new sessions without restarting the server. Existing sessions keep their configuration.
62
58
 
59
+ Administrators can use **Settings → Reload PyCodex** and choose **Reboot** or
60
+ **Update & reboot** to restart on updated code without restarting the process.
61
+ Idle sessions close at once and running turns finish first (no new turns start
62
+ meanwhile); background exec processes are terminated, clock periods resume, and
63
+ sessions are restored from disk. Logins and share passwords are cleared; refresh
64
+ the page afterwards. The endpoint `POST api/reload` accepts `{"upgrade": true}`
65
+ or `{"upgrade": "VERSION"}`, which runs `pip install --upgrade pycodex-ws` with
66
+ the server's Python first. The router connection (`--listen-to`) stays up.
67
+
63
68
  Consecutive model reconnection diagnostics share one collapsed `Model retries`
64
69
  row per sequence. The summary shows the number of recorded retries, the latest
65
70
  attempt and its HTTP status when available. Expand it to read the original errors
@@ -69,6 +74,8 @@ refreshing starts collapsed. Other model diagnostics and final errors stay visib
69
74
  Click Markdown links to open files and comparisons, for example
70
75
  `[source](app.py:42)` or `[changes](diff:HEAD:app.py)`. A Markdown link such as
71
76
  `[source](file:///data/project/app.py#L42-L48)` opens the workspace file at line 42.
77
+ In a local Markdown preview, `![Screenshot](preview.png)` displays the image beside the Markdown file.
78
+ Assistant replies can embed a local plot by absolute path, such as `![Plot](/data/results/plot.png)`.
72
79
  In a code or diff view, select text and choose **Insert into chat** to add editable context to the draft.
73
80
  Click a context block to edit or remove it before sending.
74
81
  See [view links and supported formats](../../docs/RUNTIME.md#workspace-content-views).
@@ -91,9 +98,6 @@ identifying the source of a user message. The history API returns it, and
91
98
  recorded sessions preserve it across resume. It is metadata only: the model request and frontend display do
92
99
  not include it. See the [message API contract](workspace_server/WORKSPACE_API.md#commands-and-results).
93
100
 
94
- The [VS Code extension](extensions/vscode/README.md) uses this backend and is
95
- distributed separately as a VSIX.
96
-
97
101
  ## Customize the interface
98
102
 
99
103
  Choose **Settings → Customize Agent** from the conversation header to open a
@@ -1,8 +1,6 @@
1
1
  import asyncio
2
2
  import logging
3
3
  import secrets
4
- import socket
5
- from contextlib import asynccontextmanager
6
4
 
7
5
  from websockets.exceptions import ConnectionClosed, InvalidHandshake, InvalidStatusCode
8
6
  from websockets.legacy.client import connect
@@ -230,34 +228,3 @@ class RouterClient:
230
228
  self._logger.warning("Router request disconnected (%s)", type(exc).__name__)
231
229
  except Exception as exc:
232
230
  self._logger.error("Router request failed (%s)", type(exc).__name__)
233
-
234
-
235
- def attach_router(app, registry, target, port):
236
- def inventory():
237
- return [
238
- {
239
- "id": workspace["id"],
240
- "work_dir": workspace["work_dir"],
241
- "state_path": workspace["state_path"],
242
- "enable_board": workspace["enable_board"],
243
- "session_count": len(workspace["sessions"]),
244
- "running": any(session["running"] for session in workspace["sessions"]),
245
- "unread": any(session["unread"] for session in workspace["sessions"]),
246
- }
247
- for workspace in registry.list_workspaces()
248
- ]
249
-
250
- client = RouterClient(app, target, socket.gethostname(), port, inventory)
251
- original_lifespan = app.router.lifespan_context
252
-
253
- @asynccontextmanager
254
- async def lifespan(application):
255
- async with original_lifespan(application) as state:
256
- await client.start()
257
- try:
258
- yield state
259
- finally:
260
- await client.close()
261
-
262
- app.router.lifespan_context = lifespan
263
- app.state.router_client = client
@@ -51,7 +51,7 @@ def agent_api_request(scope):
51
51
  if scope["type"] != "http":
52
52
  return False
53
53
  match = re.fullmatch(
54
- r"(?:/n/[a-z2-7]{5}(?:[a-z2-7]{47})?)?(?:/w/[^/]+)?/api/(workspaces|sessions|session|session/message)",
54
+ r"(?:/n/[a-z2-7]{5}(?:[a-z2-7]{47})?)?(?:/w/[^/]+)?/api/(workspaces|sessions|session|session/message|help)",
55
55
  route_path(scope),
56
56
  )
57
57
  return match is not None and scope["method"] == (
@@ -3,7 +3,11 @@
3
3
  from importlib import import_module
4
4
 
5
5
 
6
- def register_feishu_commands(runtime):
6
+ def active_preview(active):
7
+ return active["reasoning"] or active["assistant_text"]
8
+
9
+
10
+ def register_feishu_commands(runtime, preview_reasoning=False):
7
11
  """Attach Feishu commands and connection cleanup to an existing runtime."""
8
12
  link = None
9
13
 
@@ -30,9 +34,11 @@ def register_feishu_commands(runtime):
30
34
  raise ValueError("Usage: /link <feishu-email|open_id|chat_id>")
31
35
  if link is not None:
32
36
  raise RuntimeError("A Feishu card is already linked. Use /unlink first.")
37
+ from .feishu_card import PycodexCard
33
38
  from .feishu_link import PycodexRuntimeLink
34
39
 
35
- link = await PycodexRuntimeLink(runtime, target).start_async()
40
+ card = PycodexCard.from_env(preview_reasoning=preview_reasoning)
41
+ link = await PycodexRuntimeLink(runtime, target, card=card).start_async()
36
42
  return {
37
43
  "kind": "connection",
38
44
  "lines": [
@@ -7,6 +7,7 @@ import requests
7
7
 
8
8
  from pycodex.events import (
9
9
  DEFAULT_MAIN_PROMPT,
10
+ AssistantDeltaEvent,
10
11
  CommandCompletedEvent,
11
12
  CommandFailedEvent,
12
13
  Event,
@@ -14,15 +15,18 @@ from pycodex.events import (
14
15
  InputQueuedEvent,
15
16
  InputRequestedEvent,
16
17
  MessagesAddedEvent,
18
+ ReasoningEvent,
17
19
  SessionStateEvent,
18
20
  StreamErrorEvent,
19
21
  TurnCompletedEvent,
20
22
  TurnFailedEvent,
23
+ TurnInterruptedEvent,
21
24
  TurnStartedEvent,
22
25
  )
23
26
  from pycodex.protocol import AssistantMessage
24
27
  from pycodex.utils.history import conversation_history_to_turns
25
28
 
29
+ from . import active_preview
26
30
  from .feishu_auth import (
27
31
  FEISHU_API_BASE,
28
32
  FEISHU_DOMAIN,
@@ -42,6 +46,9 @@ CARD_CONTENT_ERROR_MARKER = "Failed to create card content"
42
46
 
43
47
 
44
48
  class PycodexCard:
49
+ preview_reasoning = False
50
+ _preview = ""
51
+
45
52
  def __init__(
46
53
  self,
47
54
  app_id: "typing.Union[str, None]" = None,
@@ -51,7 +58,9 @@ class PycodexCard:
51
58
  verification_token: "typing.Union[str, None]" = None,
52
59
  encrypt_key: "typing.Union[str, None]" = None,
53
60
  session: "typing.Union[requests.Session, None]" = None,
61
+ preview_reasoning: bool = False,
54
62
  ) -> None:
63
+ self.preview_reasoning = preview_reasoning
55
64
  self.app_id = app_id
56
65
  self.app_secret = app_secret
57
66
  self.api_base = api_base
@@ -83,9 +92,10 @@ class PycodexCard:
83
92
  self._tenant_token_expires_at = 0.0
84
93
 
85
94
  @classmethod
86
- def from_env(cls) -> "PycodexCard":
95
+ def from_env(cls, preview_reasoning: bool = False) -> "PycodexCard":
87
96
  api_base = os.environ.get("FEISHU_API_BASE", FEISHU_API_BASE)
88
97
  return cls(
98
+ preview_reasoning=preview_reasoning,
89
99
  app_id=_env("FEISHU_APP_ID", "LARK_APP_ID"),
90
100
  app_secret=_env("FEISHU_APP_SECRET", "LARK_APP_SECRET"),
91
101
  api_base=api_base,
@@ -175,7 +185,11 @@ class PycodexCard:
175
185
  def detach(self) -> None:
176
186
  self.detached = True
177
187
 
178
- def apply_event(self, event: "Event") -> None:
188
+ @property
189
+ def preview_output(self):
190
+ return self._preview or self.working_output
191
+
192
+ def apply_event(self, event: "Event", active_turn=None) -> None:
179
193
  if isinstance(event, SessionStateEvent):
180
194
  state = event.state
181
195
  self.model_name = state["model"]
@@ -190,6 +204,8 @@ class PycodexCard:
190
204
  self.history_index = None
191
205
  active = state["active_turn"]
192
206
  self.working_output = active["assistant_text"] if active is not None else ""
207
+ active_turn = active
208
+ self._preview = ""
193
209
  self._active_turn_id = active["turn_id"] if active is not None else None
194
210
  if active is not None:
195
211
  current = self._append_messages(active["messages"], active["turn_id"])
@@ -219,6 +235,16 @@ class PycodexCard:
219
235
  elif any(isinstance(message, AssistantMessage) for message in event.messages):
220
236
  self.display.stream_buffer = ""
221
237
  self.working_output = turn["response"] if turn else ""
238
+ if self.preview_reasoning:
239
+ if active_turn is not None:
240
+ self._preview = active_preview(active_turn)
241
+ elif isinstance(event, ReasoningEvent):
242
+ self._preview = event.text
243
+ elif isinstance(event, (
244
+ AssistantDeltaEvent, MessagesAddedEvent, StreamErrorEvent, TurnStartedEvent,
245
+ TurnCompletedEvent, TurnInterruptedEvent, TurnFailedEvent,
246
+ )):
247
+ self._preview = ""
222
248
  event.render(self.display)
223
249
  if self.display.stream_buffer:
224
250
  self.working_output = self.display.stream_buffer
@@ -85,7 +85,8 @@ class PycodexRuntimeLink:
85
85
  def _handle_runtime_event(self, event) -> None:
86
86
  if self._detached:
87
87
  return
88
- self.card.apply_event(event)
88
+ active = self.runtime.active_turn_snapshot() if self.card.preview_reasoning else None
89
+ self.card.apply_event(event, active)
89
90
  self._update_card()
90
91
 
91
92
  async def _submit(
@@ -13,7 +13,7 @@ def render_card(
13
13
  status = "Closed" if state.display.closed else state.status
14
14
  input_disabled = not state.accepts_input or state.detached or state.display.closed
15
15
  output = _truncate(state.output_text, CARD_OUTPUT_LIMIT) or "Ready."
16
- working_output = _truncate(state.working_output, CARD_OUTPUT_LIMIT)
16
+ working_output = _truncate(state.preview_output, CARD_OUTPUT_LIMIT)
17
17
  color = _status_color("Detached" if state.detached else status or "Idle")
18
18
  body_elements = [
19
19
  _output_box(
@@ -4,12 +4,13 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pycodex-ws"
7
- version = "0.7.0"
7
+ version = "0.7.2"
8
8
  description = "Browser workspace and optional Feishu integration for python-codex"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
11
11
  dependencies = [
12
- "python-codex==0.7.0",
12
+ "python-codex==0.7.2",
13
+ "pyagy==0.7.2",
13
14
  "pillow>=9.0.0",
14
15
  "websockets>=11,<16",
15
16
  ]
@@ -20,6 +21,7 @@ pycodex-router = "pycodex_router.server:main"
20
21
 
21
22
  [tool.uv.sources]
22
23
  python-codex = { workspace = true }
24
+ pyagy = { workspace = true }
23
25
 
24
26
  [tool.hatch.build.targets.wheel]
25
27
  packages = ["workspace_server", "pycodex_ws", "pycodex_router"]
@@ -48,6 +48,9 @@ ordinary, missing or closed session it returns `binding: null`. Browser administ
48
48
  `GET api/session` responses also include `external_call: binding` when the selected
49
49
  session is an open external session; ordinary sessions, visitors and
50
50
  `pycodex.agent_access` requests omit `external_call` and cannot read or create bindings.
51
+ `GET api/session?workspace=true` additionally returns `views` (the `GET api/views`
52
+ list, or a `views_error` string) and `board` (the `GET api/board` status, or `null`
53
+ when Canvas is disabled); the built-in page uses it as its only polling request.
51
54
 
52
55
  Send tasks through the normal Web message or WebSocket interface. `exec_command`
53
56
  and the other configured host tools operate in the workspace. `client_exec_command`
@@ -116,6 +119,15 @@ even when the launch default changed. Older tabs without a profile use the
116
119
  launch default. A missing saved profile fails restoration. Existing sessions
117
120
  keep their configuration; this API does not switch profiles in a running tab.
118
121
 
122
+ ## Markdown images
123
+
124
+ `GET/HEAD api/views/{id}/images/{path}` serves an image relative to an open
125
+ local Markdown file. The resolved path must stay within the document's directory.
126
+ The image loads inline in the existing tab and works with Canvas disabled.
127
+ `GET/HEAD api/images?path=...` serves an absolute local PNG, JPEG, GIF or WebP
128
+ through the workspace's authenticated routes, with the image viewer's 10 MiB
129
+ and 20 megapixel limits. Loading an image leaves the view list untouched.
130
+
119
131
  ## PDF previews
120
132
 
121
133
  `POST api/views/open` with `{"href": "report.pdf"}` opens a local PDF using the
@@ -150,8 +162,12 @@ State includes:
150
162
  - `model: {name, reasoning_effort}`, `title`, and `cwd`;
151
163
  - `busy`, `running`, `closed`, and `accepts_input`;
152
164
  - `active_turn`: IDs, complete `messages` passed to the current execution,
153
- accumulated assistant text and model errors,
165
+ accumulated `assistant_text`, current `reasoning` (raw `reasoning_text` when
166
+ present, otherwise the latest `summary_text`), and `model_errors`,
154
167
  or `null`; completed history is excluded;
168
+ - `last_reasoning`: after a successful turn or resume, the latest readable
169
+ reasoning since the last visible message, if any. During a turn the live
170
+ value is in `active_turn.reasoning`;
155
171
  - `queued_inputs`: `submission_id`, `turn_id`, `queue` (`steer` or `enqueue`)
156
172
  and visible input `messages`, in execution order; merged steer inputs share one
157
173
  submission ID while each message retains its own ID, author and creation time;
@@ -172,8 +188,12 @@ The response's `root` is the selected Agent and `agents` is its flattened
172
188
  descendant tree. Each row includes `agent_id`, `parent_agent_id`, canonical
173
189
  `agent_path`, `status`, `elapsed_seconds` and `last_message`. Status is `pending_init`, `running`,
174
190
  `interrupted`, `shutdown`, `{completed: text}` or `{errored: text}`.
175
- `last_message` is the latest assistant text, including accumulated stream deltas;
176
- tool progress and errors do not replace it. Polling does not start turns,
191
+ `last_message` and the session list's `last_assistant` show the latest assistant
192
+ text, including streamed text. When creating views for `harness = "pyagy"`,
193
+ the workspace enables `preview_reasoning` for the root and its subagents.
194
+ Their previews temporarily show the full current reasoning text or summary with
195
+ its original paragraph breaks. The next assistant delta restores the accumulated
196
+ reply. Completed replies contain assistant text. Polling does not start turns,
177
197
  change history or grant interactive permissions to descendants.
178
198
  `elapsed_seconds` measures the current or most recent turn with the Runtime's
179
199
  monotonic clock. It starts at turn start, freezes on completion, failure or
@@ -205,6 +225,10 @@ arguments, environment and process output. Entries disappear when the exec
205
225
  manager releases them; this is an inventory, not an execution archive.
206
226
  Clock records include `enabled`, `period_m`, `status` (`disabled`, `paused`,
207
227
  or `armed`) and timezone-aware `next_fire_at` (`null` when not armed).
228
+ In `pyagy` profiles, `schedule` records include `session_id`, `task_id`,
229
+ `summary`, `start_time`, `is_daemon` and `status` (`running`, omitting raw
230
+ prompts), and `subagent` records include `conversation_id`, `role`,
231
+ `type_name` and `status` (`running`).
208
232
 
209
233
  ## Commands and results
210
234
 
@@ -236,11 +260,21 @@ Operations retain their idle/admission requirements. Runtime owns serialization
236
260
  and draining. HTTP request completion or disconnect does not cancel an accepted
237
261
  command. This adds no turn cancellation, queue editing or arbitrary tool execution.
238
262
 
239
- `GET api/session?session_id=<id>&runtime_info=true` includes a cross-Agent
240
- communication example that posts plain text to `api/session/message` by default.
241
- Plain text uses steer; `/queue <message>` schedules an independent follow-up turn.
242
- The same behavior applies through the router. These requests reuse the frontend
243
- input contract, so plain text answers a pending input request when one exists.
263
+ `GET api/session?session_id=<id>&runtime_info=true` returns a two-line pointer
264
+ with the `GET api/help?session_id=<id>` command and the installed `pycodex` /
265
+ `workspace_server` package directories. `GET api/help` (with optional
266
+ `session_id`, and also mounted at root `GET /api/help` on multi-workspace
267
+ servers) returns the plain-text session identity and cross-Agent communication
268
+ guide (`api/workspaces`, `api/sessions`, `api/session/message`, `api/session`
269
+ and `/router` bridge). It recommends posting plain text to `api/session/message`
270
+ by default (steer), reserving `/queue <message>` for an independent follow-up
271
+ turn. The same behavior applies through the router. These requests reuse the
272
+ frontend input contract, so plain text answers a pending input request when one
273
+ exists.
274
+ When launched by `pycodex-ws`, same-user local Agent access uses a temporary
275
+ owner-only header file (`api.header` containing `X-Pycodex-Agent-Token` for
276
+ direct local HTTP), keeping passwords, cookies and router keys out of
277
+ `runtime_info`, `api/help` and rollouts.
244
278
 
245
279
  `POST api/session/message` accepts optional `name` and `trigger` fields alongside
246
280
  `session_id`, `prompt` and `sender`, for example:
@@ -270,14 +304,20 @@ checkpoints. Unrecorded sessions keep it in memory. Model request serialization
270
304
  after resume and during compaction.
271
305
 
272
306
  The display snapshot at `GET api/session` exposes `turns[].messages` as an ordered
273
- array of `{message_id, text, name, created_at}`. Each input appears separately
274
- with its author and time, including inputs with identical text. `prompt` is
275
- derived by joining those texts, and `prompt_at` is the first input's creation
307
+ array of `{message_id, text, name, visible, created_at}`. `visible` is `true` for
308
+ ordinary inputs or a non-empty tag label string (such as `"Wake-up"`) for
309
+ automatic wake-ups and system notifications, which the built-in page renders as
310
+ compact expandable dividers instead of user bubbles (`false` entries are omitted
311
+ from display turns). Each ordinary input appears separately
312
+ with a header showing its time and, when `name` is non-empty and not `"user"`,
313
+ its author, including inputs with identical text. `prompt` is
314
+ derived by joining `visible === true` texts, and `prompt_at` is the first input's creation
276
315
  time. `response_at` is the committed assistant message's creation time. These
277
316
  timestamps survive queueing, steer and resume; unknown legacy times stay `null`.
278
317
  `response_phase` carries the latest committed assistant message's phase. While
279
- the turn is running, non-final replies retain the temporary-reply animation,
280
- including after commentary is committed and tools are executing.
318
+ the turn is running, the built-in page displays `thinking` or, when empty, the
319
+ committed `response` in one animated Markdown block. A final-phase response
320
+ takes precedence immediately and uses the same block.
281
321
  Temporary replies omit the displayed timestamp and duration; their stored
282
322
  creation time remains available in the snapshot and rollout.
283
323
  Local message IDs are distinct from provider response-item `id` values and are
@@ -312,8 +352,11 @@ stop at `next_cursor: null`. Cursors are opaque.
312
352
  Items contain `index`, `type`, and `payload`. A `response_item` carries the
313
353
  serialized conversation item, including tool calls/results and available
314
354
  reasoning records. This does not decrypt reasoning or reconstruct unrecorded
315
- output. There is currently no dedicated live reasoning-delta event; the display
316
- snapshot's `thinking` field contains assistant text and is not a reasoning API.
355
+ output. Both harnesses forward live `reasoning` events with raw `reasoning_text`
356
+ when available and otherwise the latest `summary_text`. In native pycodex,
357
+ the display snapshot's `thinking` field contains streamed assistant text.
358
+ Pyagy also displays readable reasoning there and in Feishu's working output.
359
+ Conversation history and final replies retain their original item types.
317
360
  A `compacted` item contains its summary in `payload.message`; it does
318
361
  not duplicate the checkpoint's replacement history.
319
362
 
@@ -1,5 +1,7 @@
1
1
  """Same-user HTTP access to existing local and registered-device APIs."""
2
2
 
3
+ import ipaddress
4
+ import secrets
3
5
  from urllib.parse import unquote, urlsplit, urlunsplit
4
6
 
5
7
  import requests
@@ -9,21 +11,76 @@ from starlette.responses import JSONResponse, Response
9
11
 
10
12
  from pycodex_router.protocol import agent_api_request
11
13
 
14
+ AGENT_TOKEN_HEADER = "X-Pycodex-Agent-Token"
15
+ _AGENT_TOKEN_HEADER_BYTES = b"x-pycodex-agent-token"
16
+ _DISALLOWED_TOKEN_HEADERS = frozenset({
17
+ b"origin",
18
+ b"sec-fetch-site",
19
+ b"forwarded",
20
+ b"x-forwarded-for",
21
+ b"x-real-ip",
22
+ })
23
+
24
+
25
+ def _normalize_ip(value):
26
+ try:
27
+ address = ipaddress.ip_address(value)
28
+ except ValueError:
29
+ return None
30
+ mapped = getattr(address, "ipv4_mapped", None)
31
+ return mapped if mapped is not None else address
32
+
33
+
34
+ def _is_local_agent_client(scope, state):
35
+ client = scope.get("client")
36
+ if not client or not client[0]:
37
+ return False
38
+ address = _normalize_ip(client[0])
39
+ if address is None:
40
+ return False
41
+ if address.is_loopback:
42
+ return True
43
+ allowed = getattr(state, "agent_local_hosts", ()) or ()
44
+ return any(address == _normalize_ip(host) for host in allowed)
45
+
46
+
47
+ def _match_agent_access(scope, state):
48
+ if scope["type"] != "http":
49
+ return False, None
50
+ token = getattr(state, "agent_auth_token", None)
51
+ if not token or not _is_local_agent_client(scope, state):
52
+ return False, None
53
+ supplied = []
54
+ cleaned = []
55
+ for name, value in scope.get("headers") or ():
56
+ lower = name.lower()
57
+ if lower in _DISALLOWED_TOKEN_HEADERS:
58
+ return False, None
59
+ if lower == _AGENT_TOKEN_HEADER_BYTES:
60
+ supplied.append(value)
61
+ else:
62
+ cleaned.append((name, value))
63
+ if len(supplied) != 1:
64
+ return False, None
65
+ try:
66
+ candidate = supplied[0].decode("ascii").strip()
67
+ except UnicodeDecodeError:
68
+ return False, None
69
+ if not secrets.compare_digest(candidate, token):
70
+ return False, None
71
+ return True, cleaned
72
+
12
73
 
13
74
  class AgentSocketAccess:
14
75
  def __init__(self, app):
15
76
  self.app = app
16
77
 
17
78
  async def __call__(self, scope, receive, send):
18
- socket_path = getattr(self.app.state, "agent_socket_path", None)
19
- # Uvicorn gets this address from the socket, independently of HTTP headers.
20
- if (
21
- scope["type"] != "http" or socket_path is None
22
- or scope["server"] not in (None, (socket_path, None))
23
- ):
79
+ matched, cleaned_headers = _match_agent_access(scope, self.app.state)
80
+ if not matched:
24
81
  await self.app(scope, receive, send)
25
82
  return
26
- scope = dict(scope)
83
+ scope = dict(scope, headers=cleaned_headers)
27
84
  scope["pycodex.agent_access"] = True
28
85
  if not scope["path"].startswith("/router/"):
29
86
  await self.app(scope, receive, send)