@chorus-aidlc/chorus 0.19.1 → 0.20.0

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 (322) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-build-manifest.json +349 -349
  3. package/.next/standalone/.next/app-path-routes-manifest.json +38 -38
  4. package/.next/standalone/.next/build-manifest.json +5 -5
  5. package/.next/standalone/.next/prerender-manifest.json +18 -18
  6. package/.next/standalone/.next/server/app/(dashboard)/project-groups/[uuid]/page.js +1 -1
  7. package/.next/standalone/.next/server/app/(dashboard)/project-groups/[uuid]/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/(dashboard)/project-groups/[uuid]/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/activity/page.js +1 -1
  10. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/activity/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/dashboard/[ideaUuid]/page.js +1 -1
  12. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/dashboard/[ideaUuid]/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/dashboard/page.js +2 -2
  14. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/dashboard/page.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/dashboard/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/documents/[documentUuid]/page.js +2 -2
  17. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/documents/[documentUuid]/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/documents/page.js +2 -2
  19. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/documents/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/graph/page.js +2 -2
  21. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/graph/page.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/graph/page_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/[proposalUuid]/page.js +2 -2
  24. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/[proposalUuid]/page.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/[proposalUuid]/page_client-reference-manifest.js +1 -1
  26. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/new/page.js +2 -2
  27. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/new/page_client-reference-manifest.js +1 -1
  28. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/page.js +2 -2
  29. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/page_client-reference-manifest.js +1 -1
  30. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/[taskUuid]/page.js +1 -1
  31. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/[taskUuid]/page.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/[taskUuid]/page_client-reference-manifest.js +1 -1
  33. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/page.js +1 -1
  34. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/page.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/(dashboard)/projects/page.js +1 -1
  37. package/.next/standalone/.next/server/app/(dashboard)/projects/page.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/(dashboard)/settings/page.js +2 -2
  40. package/.next/standalone/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  42. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  44. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  45. package/.next/standalone/.next/server/app/admin/companies/[uuid]/page.js +1 -1
  46. package/.next/standalone/.next/server/app/admin/companies/[uuid]/page_client-reference-manifest.js +1 -1
  47. package/.next/standalone/.next/server/app/admin/companies/new/page.js +1 -1
  48. package/.next/standalone/.next/server/app/admin/companies/new/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/admin/companies/new.html +2 -2
  50. package/.next/standalone/.next/server/app/admin/companies/new.rsc +3 -3
  51. package/.next/standalone/.next/server/app/admin/companies/page_client-reference-manifest.js +1 -1
  52. package/.next/standalone/.next/server/app/admin/companies.html +2 -2
  53. package/.next/standalone/.next/server/app/admin/companies.rsc +2 -2
  54. package/.next/standalone/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  55. package/.next/standalone/.next/server/app/admin.html +2 -2
  56. package/.next/standalone/.next/server/app/admin.rsc +2 -2
  57. package/.next/standalone/.next/server/app/api/admin/companies/[uuid]/route_client-reference-manifest.js +1 -1
  58. package/.next/standalone/.next/server/app/api/admin/companies/route_client-reference-manifest.js +1 -1
  59. package/.next/standalone/.next/server/app/api/admin/login/route_client-reference-manifest.js +1 -1
  60. package/.next/standalone/.next/server/app/api/admin/session/route_client-reference-manifest.js +1 -1
  61. package/.next/standalone/.next/server/app/api/agent-connections/route_client-reference-manifest.js +1 -1
  62. package/.next/standalone/.next/server/app/api/agents/[uuid]/route_client-reference-manifest.js +1 -1
  63. package/.next/standalone/.next/server/app/api/agents/[uuid]/sessions/route_client-reference-manifest.js +1 -1
  64. package/.next/standalone/.next/server/app/api/agents/route_client-reference-manifest.js +1 -1
  65. package/.next/standalone/.next/server/app/api/api-keys/[uuid]/route_client-reference-manifest.js +1 -1
  66. package/.next/standalone/.next/server/app/api/api-keys/route_client-reference-manifest.js +1 -1
  67. package/.next/standalone/.next/server/app/api/auth/callback/route_client-reference-manifest.js +1 -1
  68. package/.next/standalone/.next/server/app/api/auth/check-default/route_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/app/api/auth/company-oidc/route_client-reference-manifest.js +1 -1
  70. package/.next/standalone/.next/server/app/api/auth/default-login/route_client-reference-manifest.js +1 -1
  71. package/.next/standalone/.next/server/app/api/auth/identify/route_client-reference-manifest.js +1 -1
  72. package/.next/standalone/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  73. package/.next/standalone/.next/server/app/api/auth/me/route_client-reference-manifest.js +1 -1
  74. package/.next/standalone/.next/server/app/api/auth/sync-token/route_client-reference-manifest.js +1 -1
  75. package/.next/standalone/.next/server/app/api/comments/route_client-reference-manifest.js +1 -1
  76. package/.next/standalone/.next/server/app/api/daemon/connection-heartbeat/route_client-reference-manifest.js +1 -1
  77. package/.next/standalone/.next/server/app/api/daemon/control/route_client-reference-manifest.js +1 -1
  78. package/.next/standalone/.next/server/app/api/daemon/directory-request/report/route_client-reference-manifest.js +1 -1
  79. package/.next/standalone/.next/server/app/api/daemon/execution-state/route_client-reference-manifest.js +1 -1
  80. package/.next/standalone/.next/server/app/api/daemon/executions/route_client-reference-manifest.js +1 -1
  81. package/.next/standalone/.next/server/app/api/daemon/pending-turns/route_client-reference-manifest.js +1 -1
  82. package/.next/standalone/.next/server/app/api/daemon/report-interrupt/route_client-reference-manifest.js +1 -1
  83. package/.next/standalone/.next/server/app/api/daemon/resume/route_client-reference-manifest.js +1 -1
  84. package/.next/standalone/.next/server/app/api/daemon/transcript/route_client-reference-manifest.js +1 -1
  85. package/.next/standalone/.next/server/app/api/daemon/turn-advance/route_client-reference-manifest.js +1 -1
  86. package/.next/standalone/.next/server/app/api/daemon-directory-requests/[uuid]/route_client-reference-manifest.js +1 -1
  87. package/.next/standalone/.next/server/app/api/daemon-directory-requests/route_client-reference-manifest.js +1 -1
  88. package/.next/standalone/.next/server/app/api/daemon-sessions/[sessionUuid]/instruction/route_client-reference-manifest.js +1 -1
  89. package/.next/standalone/.next/server/app/api/daemon-sessions/[sessionUuid]/repoint/route_client-reference-manifest.js +1 -1
  90. package/.next/standalone/.next/server/app/api/daemon-sessions/[sessionUuid]/route_client-reference-manifest.js +1 -1
  91. package/.next/standalone/.next/server/app/api/daemon-sessions/ad-hoc/route_client-reference-manifest.js +1 -1
  92. package/.next/standalone/.next/server/app/api/daemon-sessions/route_client-reference-manifest.js +1 -1
  93. package/.next/standalone/.next/server/app/api/documents/[uuid]/route_client-reference-manifest.js +1 -1
  94. package/.next/standalone/.next/server/app/api/entities/[type]/[uuid]/root-idea/route_client-reference-manifest.js +1 -1
  95. package/.next/standalone/.next/server/app/api/events/notifications/route_client-reference-manifest.js +1 -1
  96. package/.next/standalone/.next/server/app/api/events/route_client-reference-manifest.js +1 -1
  97. package/.next/standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  98. package/.next/standalone/.next/server/app/api/ideas/[uuid]/claim/route_client-reference-manifest.js +1 -1
  99. package/.next/standalone/.next/server/app/api/ideas/[uuid]/move/preview/route_client-reference-manifest.js +1 -1
  100. package/.next/standalone/.next/server/app/api/ideas/[uuid]/move/route_client-reference-manifest.js +1 -1
  101. package/.next/standalone/.next/server/app/api/ideas/[uuid]/parent/route_client-reference-manifest.js +1 -1
  102. package/.next/standalone/.next/server/app/api/ideas/[uuid]/release/route_client-reference-manifest.js +1 -1
  103. package/.next/standalone/.next/server/app/api/ideas/[uuid]/route_client-reference-manifest.js +1 -1
  104. package/.next/standalone/.next/server/app/api/ideas/[uuid]/wake-preview/route_client-reference-manifest.js +1 -1
  105. package/.next/standalone/.next/server/app/api/ideas/conversational/route_client-reference-manifest.js +1 -1
  106. package/.next/standalone/.next/server/app/api/mcp/route_client-reference-manifest.js +1 -1
  107. package/.next/standalone/.next/server/app/api/me/assignments/route_client-reference-manifest.js +1 -1
  108. package/.next/standalone/.next/server/app/api/mentionables/route_client-reference-manifest.js +1 -1
  109. package/.next/standalone/.next/server/app/api/notifications/[uuid]/archive/route_client-reference-manifest.js +1 -1
  110. package/.next/standalone/.next/server/app/api/notifications/[uuid]/read/route_client-reference-manifest.js +1 -1
  111. package/.next/standalone/.next/server/app/api/notifications/preferences/route_client-reference-manifest.js +1 -1
  112. package/.next/standalone/.next/server/app/api/notifications/read-all/route_client-reference-manifest.js +1 -1
  113. package/.next/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
  114. package/.next/standalone/.next/server/app/api/notifications/unread-count/route_client-reference-manifest.js +1 -1
  115. package/.next/standalone/.next/server/app/api/project-groups/[uuid]/dashboard/route_client-reference-manifest.js +1 -1
  116. package/.next/standalone/.next/server/app/api/project-groups/[uuid]/route_client-reference-manifest.js +1 -1
  117. package/.next/standalone/.next/server/app/api/project-groups/route_client-reference-manifest.js +1 -1
  118. package/.next/standalone/.next/server/app/api/project-visits/pin/route_client-reference-manifest.js +1 -1
  119. package/.next/standalone/.next/server/app/api/project-visits/route_client-reference-manifest.js +1 -1
  120. package/.next/standalone/.next/server/app/api/project-visits/visit/route_client-reference-manifest.js +1 -1
  121. package/.next/standalone/.next/server/app/api/projects/[uuid]/activity/route_client-reference-manifest.js +1 -1
  122. package/.next/standalone/.next/server/app/api/projects/[uuid]/agent-cwds/route_client-reference-manifest.js +1 -1
  123. package/.next/standalone/.next/server/app/api/projects/[uuid]/available/route_client-reference-manifest.js +1 -1
  124. package/.next/standalone/.next/server/app/api/projects/[uuid]/documents/route_client-reference-manifest.js +1 -1
  125. package/.next/standalone/.next/server/app/api/projects/[uuid]/group/route_client-reference-manifest.js +1 -1
  126. package/.next/standalone/.next/server/app/api/projects/[uuid]/ideas/route_client-reference-manifest.js +1 -1
  127. package/.next/standalone/.next/server/app/api/projects/[uuid]/ideas/tracker/route_client-reference-manifest.js +1 -1
  128. package/.next/standalone/.next/server/app/api/projects/[uuid]/proposals/[proposalUuid]/validate/route_client-reference-manifest.js +1 -1
  129. package/.next/standalone/.next/server/app/api/projects/[uuid]/proposals/route_client-reference-manifest.js +1 -1
  130. package/.next/standalone/.next/server/app/api/projects/[uuid]/proposals/summary/route_client-reference-manifest.js +1 -1
  131. package/.next/standalone/.next/server/app/api/projects/[uuid]/resource-graph/route_client-reference-manifest.js +1 -1
  132. package/.next/standalone/.next/server/app/api/projects/[uuid]/route_client-reference-manifest.js +1 -1
  133. package/.next/standalone/.next/server/app/api/projects/[uuid]/stats/route_client-reference-manifest.js +1 -1
  134. package/.next/standalone/.next/server/app/api/projects/[uuid]/tasks/dependencies/route_client-reference-manifest.js +1 -1
  135. package/.next/standalone/.next/server/app/api/projects/[uuid]/tasks/route_client-reference-manifest.js +1 -1
  136. package/.next/standalone/.next/server/app/api/projects/agent-cwd-options/route_client-reference-manifest.js +1 -1
  137. package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  138. package/.next/standalone/.next/server/app/api/proposals/[uuid]/approve/route_client-reference-manifest.js +1 -1
  139. package/.next/standalone/.next/server/app/api/proposals/[uuid]/close/route_client-reference-manifest.js +1 -1
  140. package/.next/standalone/.next/server/app/api/proposals/[uuid]/reject/route_client-reference-manifest.js +1 -1
  141. package/.next/standalone/.next/server/app/api/proposals/[uuid]/revoke/route_client-reference-manifest.js +1 -1
  142. package/.next/standalone/.next/server/app/api/proposals/[uuid]/route_client-reference-manifest.js +1 -1
  143. package/.next/standalone/.next/server/app/api/references/[uuid]/route_client-reference-manifest.js +1 -1
  144. package/.next/standalone/.next/server/app/api/references/route_client-reference-manifest.js +1 -1
  145. package/.next/standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  146. package/.next/standalone/.next/server/app/api/session/route_client-reference-manifest.js +1 -1
  147. package/.next/standalone/.next/server/app/api/sessions/[uuid]/route_client-reference-manifest.js +1 -1
  148. package/.next/standalone/.next/server/app/api/tasks/[uuid]/claim/route_client-reference-manifest.js +1 -1
  149. package/.next/standalone/.next/server/app/api/tasks/[uuid]/dependencies/[dependsOnUuid]/route_client-reference-manifest.js +1 -1
  150. package/.next/standalone/.next/server/app/api/tasks/[uuid]/dependencies/route_client-reference-manifest.js +1 -1
  151. package/.next/standalone/.next/server/app/api/tasks/[uuid]/release/route_client-reference-manifest.js +1 -1
  152. package/.next/standalone/.next/server/app/api/tasks/[uuid]/route_client-reference-manifest.js +1 -1
  153. package/.next/standalone/.next/server/app/api/tasks/[uuid]/sessions/route_client-reference-manifest.js +1 -1
  154. package/.next/standalone/.next/server/app/index.html +2 -2
  155. package/.next/standalone/.next/server/app/index.rsc +2 -2
  156. package/.next/standalone/.next/server/app/login/admin/page.js +1 -1
  157. package/.next/standalone/.next/server/app/login/admin/page_client-reference-manifest.js +1 -1
  158. package/.next/standalone/.next/server/app/login/admin.html +2 -2
  159. package/.next/standalone/.next/server/app/login/admin.rsc +3 -3
  160. package/.next/standalone/.next/server/app/login/callback/page_client-reference-manifest.js +1 -1
  161. package/.next/standalone/.next/server/app/login/callback.html +2 -2
  162. package/.next/standalone/.next/server/app/login/callback.rsc +2 -2
  163. package/.next/standalone/.next/server/app/login/page.js +1 -1
  164. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  165. package/.next/standalone/.next/server/app/login/pick-workspace/page_client-reference-manifest.js +1 -1
  166. package/.next/standalone/.next/server/app/login/pick-workspace.html +2 -2
  167. package/.next/standalone/.next/server/app/login/pick-workspace.rsc +2 -2
  168. package/.next/standalone/.next/server/app/login.html +2 -2
  169. package/.next/standalone/.next/server/app/login.rsc +3 -3
  170. package/.next/standalone/.next/server/app/onboarding/page.js +2 -2
  171. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  172. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  173. package/.next/standalone/.next/server/app/onboarding.html +2 -2
  174. package/.next/standalone/.next/server/app/onboarding.rsc +3 -3
  175. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  176. package/.next/standalone/.next/server/app/projects.html +2 -2
  177. package/.next/standalone/.next/server/app/projects.rsc +4 -4
  178. package/.next/standalone/.next/server/app/settings.html +2 -2
  179. package/.next/standalone/.next/server/app/settings.rsc +4 -4
  180. package/.next/standalone/.next/server/app-paths-manifest.json +38 -38
  181. package/.next/standalone/.next/server/chunks/1559.js +2 -2
  182. package/.next/standalone/.next/server/chunks/{657.js → 186.js} +1 -1
  183. package/.next/standalone/.next/server/chunks/2572.js +1 -1
  184. package/.next/standalone/.next/server/chunks/2961.js +1 -1
  185. package/.next/standalone/.next/server/chunks/3371.js +1 -0
  186. package/.next/standalone/.next/server/chunks/4131.js +39 -0
  187. package/.next/standalone/.next/server/chunks/4672.js +2 -2
  188. package/.next/standalone/.next/server/chunks/5245.js +1 -1
  189. package/.next/standalone/.next/server/chunks/5577.js +1 -0
  190. package/.next/standalone/.next/server/chunks/5728.js +1 -0
  191. package/.next/standalone/.next/server/chunks/6113.js +1 -1
  192. package/.next/standalone/.next/server/chunks/6515.js +2 -2
  193. package/.next/standalone/.next/server/chunks/6753.js +4 -4
  194. package/.next/standalone/.next/server/chunks/679.js +1 -1
  195. package/.next/standalone/.next/server/chunks/7368.js +1 -1
  196. package/.next/standalone/.next/server/chunks/7530.js +1 -1
  197. package/.next/standalone/.next/server/chunks/8017.js +1 -1
  198. package/.next/standalone/.next/server/chunks/8177.js +1 -0
  199. package/.next/standalone/.next/server/chunks/920.js +1 -1
  200. package/.next/standalone/.next/server/chunks/9213.js +1 -1
  201. package/.next/standalone/.next/server/chunks/9378.js +1 -1
  202. package/.next/standalone/.next/server/chunks/9931.js +1 -1
  203. package/.next/standalone/.next/server/middleware-build-manifest.js +1 -1
  204. package/.next/standalone/.next/server/middleware-manifest.json +5 -5
  205. package/.next/standalone/.next/server/pages/404.html +2 -2
  206. package/.next/standalone/.next/server/pages/500.html +1 -1
  207. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  208. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  209. package/.next/standalone/.next/static/chunks/{11595.b2b74d1d1d0ae9d9.js → 11595.4cebcf7499ef6a78.js} +1 -1
  210. package/.next/standalone/.next/static/chunks/27370-0d04028ec8a339f0.js +1 -0
  211. package/.next/standalone/.next/static/chunks/27787-3566e3dd0506e241.js +1 -0
  212. package/.next/standalone/.next/static/chunks/{33456.978e5f47d1c8eb93.js → 33456.a5a9acba61ca3665.js} +1 -1
  213. package/.next/standalone/.next/static/chunks/{4860.79d6eefc2861716f.js → 4860.61dfcdf8c4c5c703.js} +1 -1
  214. package/.next/standalone/.next/static/chunks/53504-3a0f6dee12a39d5d.js +1 -0
  215. package/.next/standalone/.next/static/chunks/63819-c52b5bc9ee32ca9b.js +1 -0
  216. package/.next/standalone/.next/static/chunks/76103-5d656aebd9cd5e7f.js +1 -0
  217. package/.next/standalone/.next/static/chunks/78847-9f65efbac984cf70.js +1 -0
  218. package/.next/standalone/.next/static/chunks/79919-32af2c1abfc92a30.js +1 -0
  219. package/.next/standalone/.next/static/chunks/91997-3592827b5a069beb.js +1 -0
  220. package/.next/standalone/.next/static/chunks/{99373.e659954ff5148796.js → 99373.747e181e4c952509.js} +1 -1
  221. package/.next/standalone/.next/static/chunks/app/(dashboard)/layout-6135300353d6c6ad.js +1 -0
  222. package/.next/standalone/.next/static/chunks/app/(dashboard)/project-groups/[uuid]/page-bb9f26c107a6b113.js +1 -0
  223. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/dashboard/page-31dd9042ee36b8e5.js +1 -0
  224. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/documents/[documentUuid]/page-a6bfa3b6b6893bc4.js +1 -0
  225. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/documents/page-01e81333c9beee2d.js +1 -0
  226. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/graph/{page-487d071317ae5e6d.js → page-795b161eb0694092.js} +1 -1
  227. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/[proposalUuid]/page-e20e65b5df817433.js +1 -0
  228. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/new/page-fc2d02d552bbdbf0.js +1 -0
  229. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/page-0cfa38d2de9fa9d9.js +1 -0
  230. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/tasks/[taskUuid]/{page-7cb8a91f6ca34ba8.js → page-529dec4c3bcd5ba9.js} +1 -1
  231. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/tasks/{page-6466141ca355d9a4.js → page-b211c29669eaa3e4.js} +1 -1
  232. package/.next/standalone/.next/static/chunks/app/(dashboard)/settings/page-0606d1497512e155.js +1 -0
  233. package/.next/standalone/.next/static/chunks/app/admin/companies/[uuid]/page-47e49c331996193b.js +1 -0
  234. package/.next/standalone/.next/static/chunks/app/admin/companies/new/page-c1e28205503002de.js +1 -0
  235. package/.next/standalone/.next/static/chunks/app/login/admin/page-b0d0ea2fa4102ff7.js +1 -0
  236. package/.next/standalone/.next/static/chunks/app/login/page-ee63e900cb54148c.js +1 -0
  237. package/.next/standalone/.next/static/chunks/app/onboarding/{page-323e1d93218758c5.js → page-1f3ab167cab58610.js} +1 -1
  238. package/.next/standalone/.next/static/chunks/{webpack-ec441a05567c82b0.js → webpack-6151d196b2fab7e8.js} +1 -1
  239. package/.next/standalone/.next/static/css/09ac5931fe977492.css +1 -0
  240. package/.next/standalone/package.json +1 -1
  241. package/.next/standalone/public/chorus-plugin/.claude-plugin/plugin.json +1 -1
  242. package/.next/standalone/public/chorus-plugin/bin/chorus-api.sh +1 -1
  243. package/.next/standalone/public/chorus-plugin/skills/brainstorm/SKILL.md +1 -1
  244. package/.next/standalone/public/chorus-plugin/skills/chorus/SKILL.md +1 -1
  245. package/.next/standalone/public/chorus-plugin/skills/chorus-cli/SKILL.md +1 -1
  246. package/.next/standalone/public/chorus-plugin/skills/develop/SKILL.md +1 -1
  247. package/.next/standalone/public/chorus-plugin/skills/docs/SKILL.md +1 -1
  248. package/.next/standalone/public/chorus-plugin/skills/idea/SKILL.md +1 -1
  249. package/.next/standalone/public/chorus-plugin/skills/openspec-aware/SKILL.md +1 -1
  250. package/.next/standalone/public/chorus-plugin/skills/orchestrate/SKILL.md +1 -1
  251. package/.next/standalone/public/chorus-plugin/skills/proposal/SKILL.md +1 -1
  252. package/.next/standalone/public/chorus-plugin/skills/quick-dev/SKILL.md +1 -1
  253. package/.next/standalone/public/chorus-plugin/skills/research/SKILL.md +1 -1
  254. package/.next/standalone/public/chorus-plugin/skills/review/SKILL.md +1 -1
  255. package/.next/standalone/public/chorus-plugin/skills/spec-lite/SKILL.md +1 -1
  256. package/.next/standalone/public/chorus-plugin/skills/yolo/SKILL.md +1 -1
  257. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-brainstorm/SKILL.md +1 -1
  258. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-cli/SKILL.md +1 -1
  259. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-develop/SKILL.md +1 -1
  260. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-docs/SKILL.md +1 -1
  261. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-idea/SKILL.md +1 -1
  262. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-openspec-aware/SKILL.md +1 -1
  263. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-orchestrate/SKILL.md +1 -1
  264. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-proposal/SKILL.md +1 -1
  265. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-quick-dev/SKILL.md +1 -1
  266. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-research/SKILL.md +1 -1
  267. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-review/SKILL.md +1 -1
  268. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-spec-lite/SKILL.md +1 -1
  269. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-yolo/SKILL.md +1 -1
  270. package/.next/standalone/public/kiro-plugin/bin/chorus-api.sh +1 -1
  271. package/README.ja.md +3 -1
  272. package/README.ko.md +3 -1
  273. package/README.md +18 -1
  274. package/README.zh.md +18 -1
  275. package/chorus.mjs +7 -1
  276. package/cli/agent-cli-config.mjs +28 -2
  277. package/cli/claude-spawner.mjs +330 -18
  278. package/cli/codex-app-server-client.mjs +402 -0
  279. package/cli/codex-app-server-events.mjs +176 -0
  280. package/cli/codex-session-map.mjs +1 -1
  281. package/cli/codex-spawner.mjs +247 -241
  282. package/cli/init/adapters.mjs +2 -2
  283. package/cli/init/file-template.mjs +11 -4
  284. package/cli/init/install-methods.mjs +3 -1
  285. package/cli/pi-spawner.mjs +472 -78
  286. package/cli/process-killer.mjs +138 -13
  287. package/cli/process-stop-hooks.mjs +13 -0
  288. package/cli/upgrade-plugins.mjs +202 -0
  289. package/cli/upgrade-process.mjs +159 -0
  290. package/cli/upgrade.mjs +125 -0
  291. package/cli/upload-hooks.mjs +2 -2
  292. package/cli/windows-process-tree.mjs +154 -0
  293. package/package.json +1 -1
  294. package/.next/standalone/.next/server/chunks/3420.js +0 -1
  295. package/.next/standalone/.next/server/chunks/38.js +0 -39
  296. package/.next/standalone/.next/server/chunks/5576.js +0 -1
  297. package/.next/standalone/.next/server/chunks/6125.js +0 -1
  298. package/.next/standalone/.next/server/chunks/6509.js +0 -1
  299. package/.next/standalone/.next/static/chunks/17081-63e2cad8c15da2fb.js +0 -1
  300. package/.next/standalone/.next/static/chunks/27370-f998ed24dd4fa975.js +0 -1
  301. package/.next/standalone/.next/static/chunks/46437-88abf056c31c7e4e.js +0 -1
  302. package/.next/standalone/.next/static/chunks/48365-13b8e43016ba16a4.js +0 -1
  303. package/.next/standalone/.next/static/chunks/71522-de2b2a9d8e5059e1.js +0 -1
  304. package/.next/standalone/.next/static/chunks/79919-d423af700ae83862.js +0 -1
  305. package/.next/standalone/.next/static/chunks/91796-d235607f577fbaeb.js +0 -1
  306. package/.next/standalone/.next/static/chunks/99540-99af558190f96511.js +0 -1
  307. package/.next/standalone/.next/static/chunks/app/(dashboard)/layout-adf9dbdf339e9038.js +0 -1
  308. package/.next/standalone/.next/static/chunks/app/(dashboard)/project-groups/[uuid]/page-cf8ff072a8bc7409.js +0 -1
  309. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/dashboard/page-00d18e26961cee2f.js +0 -1
  310. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/documents/[documentUuid]/page-9ed4d7d4f5897de0.js +0 -1
  311. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/documents/page-9d6d86299f2fadd9.js +0 -1
  312. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/[proposalUuid]/page-b18a2aba2c4f4f1c.js +0 -1
  313. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/new/page-32149a823e7abf42.js +0 -1
  314. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/page-0ac33f9146fc53c5.js +0 -1
  315. package/.next/standalone/.next/static/chunks/app/(dashboard)/settings/page-ba19aec7fde5086c.js +0 -1
  316. package/.next/standalone/.next/static/chunks/app/admin/companies/[uuid]/page-56118c51122ad639.js +0 -1
  317. package/.next/standalone/.next/static/chunks/app/admin/companies/new/page-4e20deb41357171c.js +0 -1
  318. package/.next/standalone/.next/static/chunks/app/login/admin/page-c8e40259e5d3d9e0.js +0 -1
  319. package/.next/standalone/.next/static/chunks/app/login/page-0a16a64855b771ef.js +0 -1
  320. package/.next/standalone/.next/static/css/652fcc1f1ab231c8.css +0 -1
  321. /package/.next/standalone/.next/static/{AWk31w7ryFKaxOnUlIeo2 → kDppeym4sfPwXjGFspZG8}/_buildManifest.js +0 -0
  322. /package/.next/standalone/.next/static/{AWk31w7ryFKaxOnUlIeo2 → kDppeym4sfPwXjGFspZG8}/_ssgManifest.js +0 -0
@@ -0,0 +1,402 @@
1
+ // Versioned wire contract and integration responsibilities:
2
+ // docs/verification/codex-app-server-protocol.md
3
+ import { TextDecoder } from "node:util";
4
+
5
+ export const APP_SERVER_DEFAULTS = Object.freeze({
6
+ initializeTimeoutMs: 30_000,
7
+ threadSetupTimeoutMs: 60_000,
8
+ turnStartTimeoutMs: 60_000,
9
+ requestTimeoutMs: 60_000,
10
+ writeTimeoutMs: 60_000,
11
+ maxFrameBytes: 32 * 1024 * 1024,
12
+ maxQueuedBytes: 32 * 1024 * 1024,
13
+ maxPendingRequests: 1024,
14
+ stderrTailBytes: 8192,
15
+ });
16
+
17
+ export class CodexAppServerError extends Error {
18
+ constructor(code, message, details = {}) {
19
+ super(message);
20
+ this.name = "CodexAppServerError";
21
+ this.code = code;
22
+ Object.assign(this, details);
23
+ }
24
+ }
25
+
26
+ const fault = (code) => new CodexAppServerError(code, `Codex App Server: ${code}`);
27
+ const object = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
28
+ const has = (value, key) => Object.hasOwn(value, key);
29
+ const validId = (id) => typeof id === "string" || Number.isSafeInteger(id);
30
+ const positive = (value) => Number.isSafeInteger(value) && value > 0;
31
+
32
+ /** Deliberately narrower than "invalid request" or generic "not found". */
33
+ export function isHistoryUnavailableError(error, threadId) {
34
+ return error instanceof CodexAppServerError
35
+ && error.code === "RPC_ERROR"
36
+ && error.method === "thread/resume"
37
+ && error.rpcCode === -32600
38
+ && typeof threadId === "string" && threadId.length > 0
39
+ && error.rpcMessage === `no rollout found for thread id ${threadId}`;
40
+ }
41
+
42
+ /** No user answers or positive approvals are ever synthesized. */
43
+ export function headlessResponseFor(method) {
44
+ switch (method) {
45
+ case "item/commandExecution/requestApproval":
46
+ case "item/fileChange/requestApproval":
47
+ return { result: { decision: "cancel" } };
48
+ case "item/permissions/requestApproval":
49
+ return { result: { permissions: {}, scope: "turn" } };
50
+ case "mcpServer/elicitation/request":
51
+ return { result: { action: "cancel", content: null } };
52
+ case "execCommandApproval":
53
+ case "applyPatchApproval":
54
+ return { result: { decision: "abort" } };
55
+ case "item/tool/call":
56
+ return { result: { contentItems: [], success: false } };
57
+ case "item/tool/requestUserInput":
58
+ case "account/chatgptAuthTokens/refresh":
59
+ case "attestation/generate":
60
+ return { error: { code: -32603, message: "Unavailable in headless mode" }, fatal: true };
61
+ default:
62
+ return { error: { code: -32601, message: "Method not supported" }, fatal: true };
63
+ }
64
+ }
65
+
66
+ // A write callback can schedule a later error event, even after client teardown.
67
+ // Keep only this payload-blind guard until the actual stream/process closes.
68
+ function guardLateErrors(emitter) {
69
+ const ignore = () => {};
70
+ emitter.on("error", ignore);
71
+ emitter.once("close", () => emitter.removeListener("error", ignore));
72
+ }
73
+
74
+ /**
75
+ * Execution-scoped, bounded stdio RPC transport. Does not spawn, kill, retry,
76
+ * interpret turn success, or call Chorus. Subscribe before sending requests.
77
+ */
78
+ export class CodexAppServerClient {
79
+ #child;
80
+ #limits;
81
+ #diagnostic;
82
+ #error = null;
83
+ #pending = new Map();
84
+ #subscribers = new Set();
85
+ #listeners = [];
86
+ #closedEmitters = new WeakSet();
87
+ #nextId = 1n;
88
+ #frame = Buffer.alloc(0);
89
+ #frameLength = 0;
90
+ #stderr = Buffer.alloc(0);
91
+ #queue = [];
92
+ #queuedBytes = 0;
93
+ #writing = false;
94
+ #fatalReply = false;
95
+ #resolveFailure;
96
+
97
+ constructor(child, { limits = {}, onDiagnostic = () => {} } = {}) {
98
+ this.#limits = { ...APP_SERVER_DEFAULTS, ...limits };
99
+ if (Object.values(this.#limits).some((value) => !positive(value))
100
+ || !child?.stdin?.write || !child?.stdout?.on || !child?.stderr?.on) {
101
+ throw fault("INVALID_OPTIONS");
102
+ }
103
+ this.#child = child;
104
+ this.#diagnostic = onDiagnostic;
105
+ this.failure = new Promise((resolve) => { this.#resolveFailure = resolve; });
106
+ for (const emitter of [child, child.stdin, child.stdout, child.stderr]) {
107
+ this.#listen(emitter, "close", () => this.#closedEmitters.add(emitter));
108
+ }
109
+ this.#listen(child.stdout, "data", (chunk) => this.#read(chunk));
110
+ this.#listen(child.stderr, "data", (chunk) => {
111
+ const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
112
+ const limit = this.#limits.stderrTailBytes;
113
+ // Copy so a tiny tail does not retain a huge input backing buffer.
114
+ this.#stderr = bytes.length >= limit
115
+ ? Buffer.from(bytes.subarray(bytes.length - limit))
116
+ : Buffer.from(Buffer.concat([this.#stderr, bytes]).subarray(-limit));
117
+ });
118
+ this.#listen(child.stdout, "end", () => this.#stop(fault(
119
+ this.#frameLength ? "TRUNCATED_FRAME" : "EOF",
120
+ )));
121
+ this.#listen(child.stdout, "close", () => this.#stop(fault("EOF")));
122
+ this.#listen(child.stdin, "close", () => this.#stop(fault("IO_CLOSED")));
123
+ this.#listen(child, "close", () => this.#stop(fault("PROCESS_CLOSED")));
124
+ // Do not settle on exit: the shared spawner settlement drains trailing IO.
125
+ for (const emitter of [child, child.stdin, child.stdout, child.stderr]) {
126
+ this.#listen(emitter, "error", () => this.#stop(fault("IO_ERROR")));
127
+ }
128
+ }
129
+
130
+ get error() { return this.#error; }
131
+ get closed() { return this.#error !== null; }
132
+ get pendingCount() { return this.#pending.size; }
133
+ get stderrBytes() { return this.#stderr.length; }
134
+
135
+ subscribe(listener) {
136
+ if (typeof listener !== "function") throw fault("INVALID_SUBSCRIBER");
137
+ if (!this.closed) this.#subscribers.add(listener);
138
+ return () => this.#subscribers.delete(listener);
139
+ }
140
+
141
+ request(method, params, { timeoutMs = this.#timeout(method), signal } = {}) {
142
+ if (this.closed) return Promise.reject(this.#error);
143
+ if (this.#fatalReply) return Promise.reject(fault("HEADLESS_REQUEST_UNSUPPORTED"));
144
+ if (!positive(timeoutMs) || typeof method !== "string" || !method
145
+ || (signal && (typeof signal.addEventListener !== "function"
146
+ || typeof signal.removeEventListener !== "function"))) {
147
+ return Promise.reject(fault("INVALID_REQUEST"));
148
+ }
149
+ if (signal?.aborted) {
150
+ this.#stop(fault("CANCELLED"));
151
+ return Promise.reject(this.#error);
152
+ }
153
+ if (this.#pending.size >= this.#limits.maxPendingRequests) {
154
+ this.#stop(fault("PENDING_LIMIT"));
155
+ return Promise.reject(this.#error);
156
+ }
157
+ // String IDs avoid collisions/precision loss and preserve numeric server IDs.
158
+ const id = `chorus-${this.#nextId++}`;
159
+ return new Promise((resolve, reject) => {
160
+ const abort = () => this.#stop(fault("CANCELLED"));
161
+ const timer = setTimeout(() => this.#stop(fault("RESPONSE_TIMEOUT")), timeoutMs);
162
+ const cleanup = () => {
163
+ clearTimeout(timer);
164
+ signal?.removeEventListener("abort", abort);
165
+ };
166
+ this.#pending.set(id, { resolve, reject, cleanup, method });
167
+ signal?.addEventListener("abort", abort, { once: true });
168
+ this.#send({ id, method, ...(params === undefined ? {} : { params }) })
169
+ .catch((error) => {
170
+ // A fatal reverse request discards unsent application frames before
171
+ // flushing its negative response. Do not close that response early.
172
+ if (!(this.#fatalReply && error.code === "HEADLESS_REQUEST_UNSUPPORTED")) this.#stop(error);
173
+ });
174
+ });
175
+ }
176
+
177
+ notify(method, params) {
178
+ if (typeof method !== "string" || !method) return Promise.reject(fault("INVALID_REQUEST"));
179
+ return this.#send({ method, ...(params === undefined ? {} : { params }) });
180
+ }
181
+
182
+ respond(id, response) {
183
+ if (!validId(id) || !object(response) || has(response, "result") === has(response, "error")
184
+ || (has(response, "result") && response.result === undefined)
185
+ || (has(response, "error") && !this.#validRpcError(response.error))) {
186
+ return Promise.reject(fault("INVALID_RESPONSE"));
187
+ }
188
+ return this.#send({ id, ...(has(response, "error")
189
+ ? { error: response.error } : { result: response.result }) });
190
+ }
191
+
192
+ close() { this.#stop(fault("CLOSED")); }
193
+
194
+ #timeout(method) {
195
+ if (method === "initialize") return this.#limits.initializeTimeoutMs;
196
+ if (method === "thread/start" || method === "thread/resume") return this.#limits.threadSetupTimeoutMs;
197
+ if (method === "turn/start") return this.#limits.turnStartTimeoutMs;
198
+ return this.#limits.requestTimeoutMs;
199
+ }
200
+
201
+ #listen(emitter, name, fn) {
202
+ emitter.on(name, fn);
203
+ this.#listeners.push(() => emitter.removeListener(name, fn));
204
+ }
205
+
206
+ #send(message) {
207
+ if (this.closed) return Promise.reject(this.#error);
208
+ if (this.#fatalReply && has(message, "method")) return Promise.reject(fault("HEADLESS_REQUEST_UNSUPPORTED"));
209
+ let bytes;
210
+ try {
211
+ bytes = Buffer.from(`${JSON.stringify(message)}\n`);
212
+ } catch {
213
+ this.#stop(fault("INVALID_OUTBOUND_FRAME"));
214
+ return Promise.reject(this.#error);
215
+ }
216
+ if (bytes.length - 1 > this.#limits.maxFrameBytes
217
+ || this.#queuedBytes + bytes.length > this.#limits.maxQueuedBytes) {
218
+ this.#stop(fault("WRITE_BUFFER_LIMIT"));
219
+ return Promise.reject(this.#error);
220
+ }
221
+ return new Promise((resolve, reject) => {
222
+ const entry = { bytes, resolve, reject, cleanup: () => {} };
223
+ // Covers time spent queued as well as the actual backpressured write.
224
+ const timer = setTimeout(() => this.#stop(fault("WRITE_TIMEOUT")), this.#limits.writeTimeoutMs);
225
+ entry.cleanup = () => clearTimeout(timer);
226
+ this.#queue.push(entry);
227
+ this.#queuedBytes += bytes.length;
228
+ this.#pump();
229
+ });
230
+ }
231
+
232
+ #pump() {
233
+ if (this.closed || this.#writing || !this.#queue.length) return;
234
+ this.#writing = true;
235
+ const entry = this.#queue[0];
236
+ const stdin = this.#child.stdin;
237
+ let returned = false;
238
+ let callbackDone = false;
239
+ let drained = false;
240
+ let needsDrain = false;
241
+ const done = () => {
242
+ if (this.closed || !returned || !callbackDone || (needsDrain && !drained)) return;
243
+ entry.cleanup();
244
+ this.#queue.shift();
245
+ this.#queuedBytes -= entry.bytes.length;
246
+ this.#writing = false;
247
+ entry.resolve();
248
+ this.#pump();
249
+ };
250
+ const onDrain = () => { drained = true; done(); };
251
+ const clearTimer = entry.cleanup;
252
+ entry.cleanup = () => { clearTimer(); stdin.removeListener("drain", onDrain); };
253
+ stdin.on("drain", onDrain);
254
+ try {
255
+ needsDrain = stdin.write(entry.bytes, (error) => {
256
+ if (error) { this.#stop(fault("IO_ERROR")); return; }
257
+ callbackDone = true;
258
+ done();
259
+ }) === false;
260
+ returned = true;
261
+ done();
262
+ } catch {
263
+ this.#stop(fault("IO_ERROR"));
264
+ }
265
+ }
266
+
267
+ #read(chunk) {
268
+ if (this.closed) return;
269
+ const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
270
+ let offset = 0;
271
+ while (offset < bytes.length && !this.closed) {
272
+ const newline = bytes.indexOf(10, offset);
273
+ const end = newline < 0 ? bytes.length : newline;
274
+ const length = end - offset;
275
+ if (this.#frameLength + length > this.#limits.maxFrameBytes) {
276
+ this.#stop(fault("FRAME_LIMIT"));
277
+ return;
278
+ }
279
+ const required = this.#frameLength + length;
280
+ if (required > this.#frame.length) {
281
+ const capacity = Math.min(this.#limits.maxFrameBytes, Math.max(required, 1024, this.#frame.length * 2));
282
+ const next = Buffer.allocUnsafe(capacity);
283
+ this.#frame.copy(next, 0, 0, this.#frameLength);
284
+ this.#frame = next;
285
+ }
286
+ bytes.copy(this.#frame, this.#frameLength, offset, end);
287
+ this.#frameLength = required;
288
+ if (newline < 0) return;
289
+ const frame = this.#frame.subarray(0, this.#frameLength);
290
+ this.#frameLength = 0;
291
+ try {
292
+ // Fatal decoding detects malformed UTF-8; buffering preserves split code points.
293
+ this.#message(JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(frame)));
294
+ } catch {
295
+ this.#stop(fault("MALFORMED_FRAME"));
296
+ }
297
+ offset = end + 1;
298
+ }
299
+ }
300
+
301
+ #validRpcError(error) {
302
+ return object(error) && Number.isSafeInteger(error.code) && typeof error.message === "string";
303
+ }
304
+
305
+ #message(message) {
306
+ if (this.#fatalReply) return; // Only the bounded negative-response write remains.
307
+ if (!object(message) || (has(message, "jsonrpc") && message.jsonrpc !== "2.0")) {
308
+ throw fault("MALFORMED_FRAME");
309
+ }
310
+ if (has(message, "method")) {
311
+ if (typeof message.method !== "string" || !message.method
312
+ || has(message, "result") || has(message, "error")
313
+ || (has(message, "id") && !validId(message.id))) throw fault("MALFORMED_FRAME");
314
+ if (has(message, "id")) {
315
+ const { fatal, ...response } = headlessResponseFor(message.method);
316
+ this.#diagnose(fatal ? "HEADLESS_REQUEST_UNSUPPORTED" : "HEADLESS_REQUEST_DENIED");
317
+ if (fatal) {
318
+ this.#fatalReply = true;
319
+ const error = fault("HEADLESS_REQUEST_UNSUPPORTED");
320
+ for (const pending of this.#pending.values()) {
321
+ pending.cleanup();
322
+ pending.reject(error);
323
+ }
324
+ this.#pending.clear();
325
+ // The active write has already reached stdin and cannot be recalled.
326
+ // Keep its callback/drain and deadline, but remove everything unsent.
327
+ const unsent = this.#queue.splice(this.#writing ? 1 : 0);
328
+ for (const entry of unsent) {
329
+ entry.cleanup();
330
+ this.#queuedBytes -= entry.bytes.length;
331
+ entry.reject(error);
332
+ }
333
+ }
334
+ this.respond(message.id, response).then(() => {
335
+ if (fatal) this.#stop(fault("HEADLESS_REQUEST_UNSUPPORTED"));
336
+ }).catch((error) => this.#stop(error));
337
+ }
338
+ } else {
339
+ if (!has(message, "id") || !validId(message.id)
340
+ || has(message, "result") === has(message, "error")
341
+ || (has(message, "error") && !this.#validRpcError(message.error))) throw fault("MALFORMED_FRAME");
342
+ const pending = this.#pending.get(message.id);
343
+ if (pending) {
344
+ this.#pending.delete(message.id);
345
+ pending.cleanup();
346
+ if (has(message, "error")) {
347
+ const error = new CodexAppServerError("RPC_ERROR", "Codex App Server RPC request failed", {
348
+ method: pending.method, rpcCode: message.error.code,
349
+ });
350
+ // Needed for the exact verified fallback; excluded from serialization/logging.
351
+ Object.defineProperty(error, "rpcMessage", { value: message.error.message });
352
+ pending.reject(error);
353
+ } else pending.resolve(message.result);
354
+ }
355
+ }
356
+ for (const listener of this.#subscribers) {
357
+ try {
358
+ const result = listener(message);
359
+ // Do not allow an accidental async subscriber rejection to escape.
360
+ if (result?.then) Promise.resolve(result).catch(() => this.#stop(fault("SUBSCRIBER_ERROR")));
361
+ } catch {
362
+ this.#stop(fault("SUBSCRIBER_ERROR"));
363
+ return;
364
+ }
365
+ }
366
+ }
367
+
368
+ #diagnose(code) {
369
+ try {
370
+ const result = this.#diagnostic(`Codex App Server: ${code}`);
371
+ if (result?.then) Promise.resolve(result).catch(() => {});
372
+ } catch { /* Diagnostic callbacks cannot strand transport cleanup. */ }
373
+ }
374
+
375
+ #stop(error) {
376
+ if (this.closed) return;
377
+ this.#error = error instanceof CodexAppServerError ? error : fault("IO_ERROR");
378
+ for (const remove of this.#listeners.splice(0)) remove();
379
+ for (const emitter of [this.#child, this.#child.stdin, this.#child.stdout, this.#child.stderr]) {
380
+ if (!emitter.closed && !emitter.destroyed && !this.#closedEmitters.has(emitter)) guardLateErrors(emitter);
381
+ }
382
+ for (const pending of this.#pending.values()) {
383
+ pending.cleanup();
384
+ pending.reject(this.#error);
385
+ }
386
+ this.#pending.clear();
387
+ for (const entry of this.#queue) {
388
+ entry.cleanup();
389
+ entry.reject(this.#error);
390
+ }
391
+ this.#queue = [];
392
+ this.#queuedBytes = 0;
393
+ this.#writing = false;
394
+ this.#frame = Buffer.alloc(0);
395
+ this.#frameLength = 0;
396
+ this.#stderr = Buffer.alloc(0);
397
+ this.#subscribers.clear();
398
+ this.#resolveFailure(this.#error);
399
+ this.#diagnose(this.#error.code);
400
+ try { this.#child.stdin.end(); } catch { /* Tree cleanup belongs to spawner. */ }
401
+ }
402
+ }
@@ -0,0 +1,176 @@
1
+ // App Server notifications -> existing Chorus transcript/usage envelopes.
2
+ // Transport, process lifecycle and persistence belong to the spawner.
3
+ import { CodexAppServerError } from "./codex-app-server-client.mjs";
4
+ import { normalizeCodexUsageEvent } from "./codex-usage-map.mjs";
5
+
6
+ const COUNTERS = {
7
+ inputTokens: "input_tokens",
8
+ cachedInputTokens: "cached_input_tokens",
9
+ cacheWriteInputTokens: "cache_write_input_tokens",
10
+ outputTokens: "output_tokens",
11
+ reasoningOutputTokens: "reasoning_output_tokens",
12
+ };
13
+ const validCount = (v) => Number.isSafeInteger(v) && v >= 0;
14
+ const nonempty = (v) => typeof v === "string" && v.trim().length > 0;
15
+ const fail = (code) => new CodexAppServerError(code, `Codex App Server: ${code}`);
16
+ const ZERO = Object.fromEntries(Object.values(COUNTERS).map((k) => [k, 0]));
17
+
18
+ export class CodexAppServerEvents {
19
+ #threadId;
20
+ #turnId = null;
21
+ #observedTurnId = null;
22
+ #baseline;
23
+ #isNew;
24
+ #onMessage;
25
+ #onUsageSnapshot;
26
+ #buffer = [];
27
+ #bufferBytes = 0;
28
+ #maxBufferedBytes;
29
+ #maxItems;
30
+ #seen = new Set();
31
+ #snapshot = null;
32
+ #lastObserved = {};
33
+ #tainted = new Set();
34
+ #outcome = null;
35
+ #finished = false;
36
+ #noticeSent = false;
37
+ #resolveCompletion;
38
+
39
+ constructor({
40
+ threadId, isNew = false, previousUsage = null,
41
+ onMessage = () => {}, onUsageSnapshot = () => {},
42
+ maxBufferedBytes = 32 * 1024 * 1024, maxItems = 100_000,
43
+ }) {
44
+ if (!nonempty(threadId) || !Number.isSafeInteger(maxBufferedBytes) || maxBufferedBytes <= 0
45
+ || !Number.isSafeInteger(maxItems) || maxItems <= 0) throw fail("INVALID_EVENT_OPTIONS");
46
+ this.#threadId = threadId;
47
+ this.#isNew = isNew;
48
+ this.#baseline = previousUsage ? { ...previousUsage } : null;
49
+ this.#lastObserved = isNew ? {} : { ...this.#baseline };
50
+ this.#onMessage = onMessage;
51
+ this.#onUsageSnapshot = onUsageSnapshot;
52
+ this.#maxBufferedBytes = maxBufferedBytes;
53
+ this.#maxItems = maxItems;
54
+ this.completion = new Promise((resolve) => { this.#resolveCompletion = resolve; });
55
+ }
56
+
57
+ get turnId() { return this.#turnId; }
58
+ get observedTurnId() { return this.#observedTurnId; }
59
+ get outcome() { return this.#outcome; }
60
+ get usageSnapshot() { return this.#snapshot ? { ...this.#snapshot } : null; }
61
+
62
+ /** Authoritative turn/start response; buffered events cannot settle before it. */
63
+ confirmTurn(turnId) {
64
+ if (!nonempty(turnId) || (this.#turnId && this.#turnId !== turnId)) throw fail("INVALID_TURN_ID");
65
+ if (this.#finished) throw fail("EVENT_ADAPTER_CLOSED");
66
+ this.#turnId = turnId;
67
+ const buffered = this.#buffer;
68
+ this.#buffer = [];
69
+ this.#bufferBytes = 0;
70
+ for (const message of buffered) this.accept(message);
71
+ }
72
+
73
+ /** Returns whether the frame is relevant semantic progress for this wake. */
74
+ accept(message) {
75
+ if (this.#finished || !message || Object.hasOwn(message, "id")) return false;
76
+ const { method, params } = message;
77
+ if (typeof method !== "string" || !params || params.threadId !== this.#threadId) return false;
78
+ const turnId = method === "turn/started" || method === "turn/completed"
79
+ ? params.turn?.id : params.turnId;
80
+ if (!nonempty(turnId)) return false;
81
+ if (!(method.startsWith("item/") || method === "turn/started"
82
+ || method === "turn/completed" || method === "thread/tokenUsage/updated")) return false;
83
+ if (!this.#turnId) {
84
+ if (method === "turn/started") this.#observedTurnId = turnId;
85
+ // Only completed snapshots and totals are needed after confirmation.
86
+ if (method !== "turn/started" && method !== "turn/completed"
87
+ && method !== "item/completed" && method !== "thread/tokenUsage/updated") return true;
88
+ const bytes = Buffer.byteLength(JSON.stringify(message));
89
+ if (this.#bufferBytes + bytes > this.#maxBufferedBytes || this.#buffer.length >= this.#maxItems) {
90
+ throw fail("EVENT_BUFFER_LIMIT");
91
+ }
92
+ this.#buffer.push(message);
93
+ this.#bufferBytes += bytes;
94
+ return true;
95
+ }
96
+ if (turnId !== this.#turnId) return false;
97
+ if (method === "item/completed") this.#item(params.item);
98
+ if (method === "thread/tokenUsage/updated") this.#usage(params.tokenUsage?.total);
99
+ if (method === "turn/completed") {
100
+ if (!["completed", "failed", "interrupted"].includes(params.turn?.status)) throw fail("INVALID_TURN_OUTCOME");
101
+ // Some transports deliver the terminal snapshot without every item event.
102
+ for (const item of Array.isArray(params.turn.items) ? params.turn.items : []) this.#item(item);
103
+ this.#outcome = { status: params.turn.status, turnId: this.#turnId };
104
+ this.finish();
105
+ this.#resolveCompletion(this.#outcome);
106
+ }
107
+ return true;
108
+ }
109
+
110
+ #item(item) {
111
+ if (item?.type !== "agentMessage" || !nonempty(item.id) || !nonempty(item.text) || this.#seen.has(item.id)) return;
112
+ if (this.#seen.size >= this.#maxItems) throw fail("ITEM_LIMIT");
113
+ this.#seen.add(item.id);
114
+ this.#onMessage({
115
+ type: "item.completed",
116
+ item: { id: item.id, type: "agent_message", text: item.text, phase: item.phase ?? null },
117
+ });
118
+ }
119
+
120
+ #usage(total) {
121
+ if (!total || typeof total !== "object" || Array.isArray(total)) return;
122
+ const snapshot = {};
123
+ for (const [from, to] of Object.entries(COUNTERS)) {
124
+ if (!validCount(total[from])) continue;
125
+ snapshot[to] = total[from];
126
+ // Never turn a counter reset into a historical charge, including resets
127
+ // between two notifications inside this wake.
128
+ const before = this.#lastObserved[to];
129
+ if (validCount(before) && snapshot[to] < before) this.#tainted.add(to);
130
+ this.#lastObserved[to] = snapshot[to];
131
+ }
132
+ if (!Object.keys(snapshot).length) return;
133
+ if (this.#tainted.has("cached_input_tokens") || this.#tainted.has("cache_write_input_tokens")) {
134
+ this.#tainted.add("input_tokens"); // Exclusive input depends on both cache deltas.
135
+ }
136
+ if (JSON.stringify(snapshot) === JSON.stringify(this.#snapshot)) return;
137
+ this.#snapshot = snapshot;
138
+ this.#onUsageSnapshot({ ...snapshot });
139
+ }
140
+
141
+ /** One notice per fallback, through the same transcript consumer as replies. */
142
+ notice(text) {
143
+ if (this.#finished || this.#noticeSent || !nonempty(text)) return;
144
+ this.#noticeSent = true;
145
+ this.#onMessage({
146
+ type: "item.completed",
147
+ item: { id: `chorus-continuity-${this.#threadId}`, type: "agent_message", text },
148
+ });
149
+ }
150
+
151
+ /**
152
+ * Flush at most one usage frame, including partial valid totals on crash.
153
+ * The spawner owns persistence; snapshot callbacks also seed interrupted turns.
154
+ */
155
+ finish() {
156
+ if (this.#finished) return this.usageSnapshot;
157
+ this.#finished = true;
158
+ this.#buffer = [];
159
+ this.#bufferBytes = 0;
160
+ let usage = null;
161
+ if (this.#snapshot && (this.#isNew || this.#baseline)) {
162
+ const delta = {};
163
+ for (const key of Object.values(COUNTERS)) {
164
+ const now = this.#snapshot[key];
165
+ const before = this.#isNew ? 0 : this.#baseline?.[key];
166
+ delta[key] = validCount(now) && validCount(before) && now >= before && !this.#tainted.has(key)
167
+ ? now - before : null;
168
+ }
169
+ // Shared normalization excludes cache reads/writes from input exactly once.
170
+ usage = normalizeCodexUsageEvent({ type: "turn.completed", usage: delta }, ZERO).usage;
171
+ }
172
+ this.#onMessage({ type: "turn.completed", usage });
173
+ this.#seen.clear();
174
+ return this.usageSnapshot;
175
+ }
176
+ }
@@ -3,7 +3,7 @@
3
3
  // its own thread id (unlike Claude, which accepts a client-supplied --session-id),
4
4
  // so to make a wake resumable across daemon restarts we record the generated id
5
5
  // keyed by the Chorus session anchor (direct idea uuid, or the entity uuid for an
6
- // ad-hoc session) and `codex exec resume <thread_id>` on the next wake.
6
+ // ad-hoc session) and call App Server `thread/resume` on the next wake.
7
7
  //
8
8
  // Thin wrapper over the generic `createSessionMap` factory (shared with the Kiro
9
9
  // backend); the store is ~/.chorus/codex-sessions.json. The public API