@richhardry/codor 0.10.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 (388) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +293 -0
  3. package/bin/codor.mjs +7 -0
  4. package/node_modules/@codor/adapter-antigravity/dist/adapter.d.ts +41 -0
  5. package/node_modules/@codor/adapter-antigravity/dist/adapter.d.ts.map +1 -0
  6. package/node_modules/@codor/adapter-antigravity/dist/adapter.js +275 -0
  7. package/node_modules/@codor/adapter-antigravity/dist/adapter.js.map +1 -0
  8. package/node_modules/@codor/adapter-antigravity/dist/index.d.ts +2 -0
  9. package/node_modules/@codor/adapter-antigravity/dist/index.d.ts.map +1 -0
  10. package/node_modules/@codor/adapter-antigravity/dist/index.js +2 -0
  11. package/node_modules/@codor/adapter-antigravity/dist/index.js.map +1 -0
  12. package/node_modules/@codor/adapter-antigravity/package.json +18 -0
  13. package/node_modules/@codor/adapter-claude-code/dist/adapter.d.ts +94 -0
  14. package/node_modules/@codor/adapter-claude-code/dist/adapter.d.ts.map +1 -0
  15. package/node_modules/@codor/adapter-claude-code/dist/adapter.js +785 -0
  16. package/node_modules/@codor/adapter-claude-code/dist/adapter.js.map +1 -0
  17. package/node_modules/@codor/adapter-claude-code/dist/index.d.ts +8 -0
  18. package/node_modules/@codor/adapter-claude-code/dist/index.d.ts.map +1 -0
  19. package/node_modules/@codor/adapter-claude-code/dist/index.js +5 -0
  20. package/node_modules/@codor/adapter-claude-code/dist/index.js.map +1 -0
  21. package/node_modules/@codor/adapter-claude-code/dist/limits-probe.d.ts +18 -0
  22. package/node_modules/@codor/adapter-claude-code/dist/limits-probe.d.ts.map +1 -0
  23. package/node_modules/@codor/adapter-claude-code/dist/limits-probe.js +67 -0
  24. package/node_modules/@codor/adapter-claude-code/dist/limits-probe.js.map +1 -0
  25. package/node_modules/@codor/adapter-claude-code/dist/peek.d.ts +3 -0
  26. package/node_modules/@codor/adapter-claude-code/dist/peek.d.ts.map +1 -0
  27. package/node_modules/@codor/adapter-claude-code/dist/peek.js +128 -0
  28. package/node_modules/@codor/adapter-claude-code/dist/peek.js.map +1 -0
  29. package/node_modules/@codor/adapter-claude-code/dist/query.d.ts +9 -0
  30. package/node_modules/@codor/adapter-claude-code/dist/query.d.ts.map +1 -0
  31. package/node_modules/@codor/adapter-claude-code/dist/query.js +7 -0
  32. package/node_modules/@codor/adapter-claude-code/dist/query.js.map +1 -0
  33. package/node_modules/@codor/adapter-claude-code/dist/translate.d.ts +40 -0
  34. package/node_modules/@codor/adapter-claude-code/dist/translate.d.ts.map +1 -0
  35. package/node_modules/@codor/adapter-claude-code/dist/translate.js +505 -0
  36. package/node_modules/@codor/adapter-claude-code/dist/translate.js.map +1 -0
  37. package/node_modules/@codor/adapter-claude-code/package.json +18 -0
  38. package/node_modules/@codor/adapter-codex/dist/adapter.d.ts +105 -0
  39. package/node_modules/@codor/adapter-codex/dist/adapter.d.ts.map +1 -0
  40. package/node_modules/@codor/adapter-codex/dist/adapter.js +625 -0
  41. package/node_modules/@codor/adapter-codex/dist/adapter.js.map +1 -0
  42. package/node_modules/@codor/adapter-codex/dist/app-server-transport.d.ts +39 -0
  43. package/node_modules/@codor/adapter-codex/dist/app-server-transport.d.ts.map +1 -0
  44. package/node_modules/@codor/adapter-codex/dist/app-server-transport.js +186 -0
  45. package/node_modules/@codor/adapter-codex/dist/app-server-transport.js.map +1 -0
  46. package/node_modules/@codor/adapter-codex/dist/index.d.ts +8 -0
  47. package/node_modules/@codor/adapter-codex/dist/index.d.ts.map +1 -0
  48. package/node_modules/@codor/adapter-codex/dist/index.js +5 -0
  49. package/node_modules/@codor/adapter-codex/dist/index.js.map +1 -0
  50. package/node_modules/@codor/adapter-codex/dist/limits-probe.d.ts +18 -0
  51. package/node_modules/@codor/adapter-codex/dist/limits-probe.d.ts.map +1 -0
  52. package/node_modules/@codor/adapter-codex/dist/limits-probe.js +87 -0
  53. package/node_modules/@codor/adapter-codex/dist/limits-probe.js.map +1 -0
  54. package/node_modules/@codor/adapter-codex/dist/peek.d.ts +3 -0
  55. package/node_modules/@codor/adapter-codex/dist/peek.d.ts.map +1 -0
  56. package/node_modules/@codor/adapter-codex/dist/peek.js +98 -0
  57. package/node_modules/@codor/adapter-codex/dist/peek.js.map +1 -0
  58. package/node_modules/@codor/adapter-codex/dist/translate.d.ts +17 -0
  59. package/node_modules/@codor/adapter-codex/dist/translate.d.ts.map +1 -0
  60. package/node_modules/@codor/adapter-codex/dist/translate.js +286 -0
  61. package/node_modules/@codor/adapter-codex/dist/translate.js.map +1 -0
  62. package/node_modules/@codor/adapter-codex/package.json +17 -0
  63. package/node_modules/@codor/adapter-copilot/dist/adapter.d.ts +40 -0
  64. package/node_modules/@codor/adapter-copilot/dist/adapter.d.ts.map +1 -0
  65. package/node_modules/@codor/adapter-copilot/dist/adapter.js +190 -0
  66. package/node_modules/@codor/adapter-copilot/dist/adapter.js.map +1 -0
  67. package/node_modules/@codor/adapter-copilot/dist/index.d.ts +4 -0
  68. package/node_modules/@codor/adapter-copilot/dist/index.d.ts.map +1 -0
  69. package/node_modules/@codor/adapter-copilot/dist/index.js +3 -0
  70. package/node_modules/@codor/adapter-copilot/dist/index.js.map +1 -0
  71. package/node_modules/@codor/adapter-copilot/dist/translate.d.ts +11 -0
  72. package/node_modules/@codor/adapter-copilot/dist/translate.d.ts.map +1 -0
  73. package/node_modules/@codor/adapter-copilot/dist/translate.js +184 -0
  74. package/node_modules/@codor/adapter-copilot/dist/translate.js.map +1 -0
  75. package/node_modules/@codor/adapter-copilot/package.json +18 -0
  76. package/node_modules/@codor/adapter-cursor/dist/adapter.d.ts +32 -0
  77. package/node_modules/@codor/adapter-cursor/dist/adapter.d.ts.map +1 -0
  78. package/node_modules/@codor/adapter-cursor/dist/adapter.js +179 -0
  79. package/node_modules/@codor/adapter-cursor/dist/adapter.js.map +1 -0
  80. package/node_modules/@codor/adapter-cursor/dist/index.d.ts +9 -0
  81. package/node_modules/@codor/adapter-cursor/dist/index.d.ts.map +1 -0
  82. package/node_modules/@codor/adapter-cursor/dist/index.js +8 -0
  83. package/node_modules/@codor/adapter-cursor/dist/index.js.map +1 -0
  84. package/node_modules/@codor/adapter-cursor/dist/translate.d.ts +15 -0
  85. package/node_modules/@codor/adapter-cursor/dist/translate.d.ts.map +1 -0
  86. package/node_modules/@codor/adapter-cursor/dist/translate.js +164 -0
  87. package/node_modules/@codor/adapter-cursor/dist/translate.js.map +1 -0
  88. package/node_modules/@codor/adapter-cursor/package.json +17 -0
  89. package/node_modules/@codor/adapter-gemini/dist/adapter.d.ts +36 -0
  90. package/node_modules/@codor/adapter-gemini/dist/adapter.d.ts.map +1 -0
  91. package/node_modules/@codor/adapter-gemini/dist/adapter.js +245 -0
  92. package/node_modules/@codor/adapter-gemini/dist/adapter.js.map +1 -0
  93. package/node_modules/@codor/adapter-gemini/dist/index.d.ts +4 -0
  94. package/node_modules/@codor/adapter-gemini/dist/index.d.ts.map +1 -0
  95. package/node_modules/@codor/adapter-gemini/dist/index.js +3 -0
  96. package/node_modules/@codor/adapter-gemini/dist/index.js.map +1 -0
  97. package/node_modules/@codor/adapter-gemini/dist/translate.d.ts +12 -0
  98. package/node_modules/@codor/adapter-gemini/dist/translate.d.ts.map +1 -0
  99. package/node_modules/@codor/adapter-gemini/dist/translate.js +123 -0
  100. package/node_modules/@codor/adapter-gemini/dist/translate.js.map +1 -0
  101. package/node_modules/@codor/adapter-gemini/package.json +18 -0
  102. package/node_modules/@codor/adapter-opencode/dist/adapter.d.ts +42 -0
  103. package/node_modules/@codor/adapter-opencode/dist/adapter.d.ts.map +1 -0
  104. package/node_modules/@codor/adapter-opencode/dist/adapter.js +240 -0
  105. package/node_modules/@codor/adapter-opencode/dist/adapter.js.map +1 -0
  106. package/node_modules/@codor/adapter-opencode/dist/index.d.ts +4 -0
  107. package/node_modules/@codor/adapter-opencode/dist/index.d.ts.map +1 -0
  108. package/node_modules/@codor/adapter-opencode/dist/index.js +3 -0
  109. package/node_modules/@codor/adapter-opencode/dist/index.js.map +1 -0
  110. package/node_modules/@codor/adapter-opencode/dist/translate.d.ts +12 -0
  111. package/node_modules/@codor/adapter-opencode/dist/translate.d.ts.map +1 -0
  112. package/node_modules/@codor/adapter-opencode/dist/translate.js +144 -0
  113. package/node_modules/@codor/adapter-opencode/dist/translate.js.map +1 -0
  114. package/node_modules/@codor/adapter-opencode/package.json +18 -0
  115. package/node_modules/@codor/cli/dist/artifact.d.ts +33 -0
  116. package/node_modules/@codor/cli/dist/artifact.d.ts.map +1 -0
  117. package/node_modules/@codor/cli/dist/artifact.js +183 -0
  118. package/node_modules/@codor/cli/dist/artifact.js.map +1 -0
  119. package/node_modules/@codor/cli/dist/attach.d.ts +25 -0
  120. package/node_modules/@codor/cli/dist/attach.d.ts.map +1 -0
  121. package/node_modules/@codor/cli/dist/attach.js +133 -0
  122. package/node_modules/@codor/cli/dist/attach.js.map +1 -0
  123. package/node_modules/@codor/cli/dist/connection.d.ts +21 -0
  124. package/node_modules/@codor/cli/dist/connection.d.ts.map +1 -0
  125. package/node_modules/@codor/cli/dist/connection.js +130 -0
  126. package/node_modules/@codor/cli/dist/connection.js.map +1 -0
  127. package/node_modules/@codor/cli/dist/detect.d.ts +14 -0
  128. package/node_modules/@codor/cli/dist/detect.d.ts.map +1 -0
  129. package/node_modules/@codor/cli/dist/detect.js +99 -0
  130. package/node_modules/@codor/cli/dist/detect.js.map +1 -0
  131. package/node_modules/@codor/cli/dist/index.d.ts +17 -0
  132. package/node_modules/@codor/cli/dist/index.d.ts.map +1 -0
  133. package/node_modules/@codor/cli/dist/index.js +24 -0
  134. package/node_modules/@codor/cli/dist/index.js.map +1 -0
  135. package/node_modules/@codor/cli/dist/mirror.d.ts +4 -0
  136. package/node_modules/@codor/cli/dist/mirror.d.ts.map +1 -0
  137. package/node_modules/@codor/cli/dist/mirror.js +93 -0
  138. package/node_modules/@codor/cli/dist/mirror.js.map +1 -0
  139. package/node_modules/@codor/cli/dist/program.d.ts +17 -0
  140. package/node_modules/@codor/cli/dist/program.d.ts.map +1 -0
  141. package/node_modules/@codor/cli/dist/program.js +1068 -0
  142. package/node_modules/@codor/cli/dist/program.js.map +1 -0
  143. package/node_modules/@codor/cli/dist/runtime-install.d.ts +61 -0
  144. package/node_modules/@codor/cli/dist/runtime-install.d.ts.map +1 -0
  145. package/node_modules/@codor/cli/dist/runtime-install.js +122 -0
  146. package/node_modules/@codor/cli/dist/runtime-install.js.map +1 -0
  147. package/node_modules/@codor/cli/dist/runtime-paths.d.ts +24 -0
  148. package/node_modules/@codor/cli/dist/runtime-paths.d.ts.map +1 -0
  149. package/node_modules/@codor/cli/dist/runtime-paths.js +69 -0
  150. package/node_modules/@codor/cli/dist/runtime-paths.js.map +1 -0
  151. package/node_modules/@codor/cli/dist/setup-flow.d.ts +69 -0
  152. package/node_modules/@codor/cli/dist/setup-flow.d.ts.map +1 -0
  153. package/node_modules/@codor/cli/dist/setup-flow.js +110 -0
  154. package/node_modules/@codor/cli/dist/setup-flow.js.map +1 -0
  155. package/node_modules/@codor/cli/dist/setup-session.d.ts +105 -0
  156. package/node_modules/@codor/cli/dist/setup-session.d.ts.map +1 -0
  157. package/node_modules/@codor/cli/dist/setup-session.js +346 -0
  158. package/node_modules/@codor/cli/dist/setup-session.js.map +1 -0
  159. package/node_modules/@codor/cli/dist/setup-ui.d.ts +93 -0
  160. package/node_modules/@codor/cli/dist/setup-ui.d.ts.map +1 -0
  161. package/node_modules/@codor/cli/dist/setup-ui.js +249 -0
  162. package/node_modules/@codor/cli/dist/setup-ui.js.map +1 -0
  163. package/node_modules/@codor/cli/dist/setup.d.ts +108 -0
  164. package/node_modules/@codor/cli/dist/setup.d.ts.map +1 -0
  165. package/node_modules/@codor/cli/dist/setup.js +878 -0
  166. package/node_modules/@codor/cli/dist/setup.js.map +1 -0
  167. package/node_modules/@codor/cli/dist/terminal-keys.d.ts +26 -0
  168. package/node_modules/@codor/cli/dist/terminal-keys.d.ts.map +1 -0
  169. package/node_modules/@codor/cli/dist/terminal-keys.js +70 -0
  170. package/node_modules/@codor/cli/dist/terminal-keys.js.map +1 -0
  171. package/node_modules/@codor/cli/dist/terminal-qr.d.ts +2 -0
  172. package/node_modules/@codor/cli/dist/terminal-qr.d.ts.map +1 -0
  173. package/node_modules/@codor/cli/dist/terminal-qr.js +30 -0
  174. package/node_modules/@codor/cli/dist/terminal-qr.js.map +1 -0
  175. package/node_modules/@codor/cli/dist/up.d.ts +52 -0
  176. package/node_modules/@codor/cli/dist/up.d.ts.map +1 -0
  177. package/node_modules/@codor/cli/dist/up.js +178 -0
  178. package/node_modules/@codor/cli/dist/up.js.map +1 -0
  179. package/node_modules/@codor/cli/package.json +24 -0
  180. package/node_modules/@codor/cli/packaging/systemd/codor.service +21 -0
  181. package/node_modules/@codor/cli/runtime/web/assets/LandingPage-BOmG5kSw.js +31 -0
  182. package/node_modules/@codor/cli/runtime/web/assets/LedgerPage-CecuTS8-.js +1 -0
  183. package/node_modules/@codor/cli/runtime/web/assets/NoChannels-CYiBXGQd.js +11 -0
  184. package/node_modules/@codor/cli/runtime/web/assets/PairingCodeInput-Cr6XDWx-.js +1 -0
  185. package/node_modules/@codor/cli/runtime/web/assets/PairingPage-CQBWNA2L.js +6 -0
  186. package/node_modules/@codor/cli/runtime/web/assets/SettingsPage-DGLbSXE7.js +16 -0
  187. package/node_modules/@codor/cli/runtime/web/assets/StartupUnavailable-DdQBHip_.js +1 -0
  188. package/node_modules/@codor/cli/runtime/web/assets/arrow-left-BOpjMuRi.js +6 -0
  189. package/node_modules/@codor/cli/runtime/web/assets/browser-BWQYNOsD.js +6 -0
  190. package/node_modules/@codor/cli/runtime/web/assets/graph-toBZHlC0.js +1 -0
  191. package/node_modules/@codor/cli/runtime/web/assets/index-Cxi54Xim.js +408 -0
  192. package/node_modules/@codor/cli/runtime/web/assets/index-DjwJakJC.css +1 -0
  193. package/node_modules/@codor/cli/runtime/web/assets/qr-DpynCwP9.js +8 -0
  194. package/node_modules/@codor/cli/runtime/web/assets/react-C8w-UNLI.js +32 -0
  195. package/node_modules/@codor/cli/runtime/web/assets/sodium-DtsvMzX9.js +1 -0
  196. package/node_modules/@codor/cli/runtime/web/codor-192.png +0 -0
  197. package/node_modules/@codor/cli/runtime/web/codor-512.png +0 -0
  198. package/node_modules/@codor/cli/runtime/web/codor-apple-touch-180.png +0 -0
  199. package/node_modules/@codor/cli/runtime/web/codor-favicon.svg +86 -0
  200. package/node_modules/@codor/cli/runtime/web/codor-mark.svg +86 -0
  201. package/node_modules/@codor/cli/runtime/web/codor-maskable-512.png +0 -0
  202. package/node_modules/@codor/cli/runtime/web/codor-og.png +0 -0
  203. package/node_modules/@codor/cli/runtime/web/fonts/BitcountPropSingle-latin.woff2 +0 -0
  204. package/node_modules/@codor/cli/runtime/web/fonts/Geist-Variable.woff2 +0 -0
  205. package/node_modules/@codor/cli/runtime/web/fonts/GeistMono-Variable.woff2 +0 -0
  206. package/node_modules/@codor/cli/runtime/web/fonts/OFL.txt +93 -0
  207. package/node_modules/@codor/cli/runtime/web/index.html +53 -0
  208. package/node_modules/@codor/cli/runtime/web/manifest.webmanifest +1 -0
  209. package/node_modules/@codor/cli/runtime/web/sw.js +2 -0
  210. package/node_modules/@codor/protocol/dist/adapter.d.ts +118 -0
  211. package/node_modules/@codor/protocol/dist/adapter.d.ts.map +1 -0
  212. package/node_modules/@codor/protocol/dist/adapter.js +15 -0
  213. package/node_modules/@codor/protocol/dist/adapter.js.map +1 -0
  214. package/node_modules/@codor/protocol/dist/body.d.ts +14 -0
  215. package/node_modules/@codor/protocol/dist/body.d.ts.map +1 -0
  216. package/node_modules/@codor/protocol/dist/body.js +50 -0
  217. package/node_modules/@codor/protocol/dist/body.js.map +1 -0
  218. package/node_modules/@codor/protocol/dist/changelog.d.ts +30 -0
  219. package/node_modules/@codor/protocol/dist/changelog.d.ts.map +1 -0
  220. package/node_modules/@codor/protocol/dist/changelog.js +19 -0
  221. package/node_modules/@codor/protocol/dist/changelog.js.map +1 -0
  222. package/node_modules/@codor/protocol/dist/default-recipient.d.ts +8 -0
  223. package/node_modules/@codor/protocol/dist/default-recipient.d.ts.map +1 -0
  224. package/node_modules/@codor/protocol/dist/default-recipient.js +19 -0
  225. package/node_modules/@codor/protocol/dist/default-recipient.js.map +1 -0
  226. package/node_modules/@codor/protocol/dist/delivery.d.ts +42 -0
  227. package/node_modules/@codor/protocol/dist/delivery.d.ts.map +1 -0
  228. package/node_modules/@codor/protocol/dist/delivery.js +44 -0
  229. package/node_modules/@codor/protocol/dist/delivery.js.map +1 -0
  230. package/node_modules/@codor/protocol/dist/events.d.ts +284 -0
  231. package/node_modules/@codor/protocol/dist/events.d.ts.map +1 -0
  232. package/node_modules/@codor/protocol/dist/events.js +150 -0
  233. package/node_modules/@codor/protocol/dist/events.js.map +1 -0
  234. package/node_modules/@codor/protocol/dist/ids.d.ts +19 -0
  235. package/node_modules/@codor/protocol/dist/ids.d.ts.map +1 -0
  236. package/node_modules/@codor/protocol/dist/ids.js +27 -0
  237. package/node_modules/@codor/protocol/dist/ids.js.map +1 -0
  238. package/node_modules/@codor/protocol/dist/index.d.ts +14 -0
  239. package/node_modules/@codor/protocol/dist/index.d.ts.map +1 -0
  240. package/node_modules/@codor/protocol/dist/index.js +14 -0
  241. package/node_modules/@codor/protocol/dist/index.js.map +1 -0
  242. package/node_modules/@codor/protocol/dist/interaction.d.ts +45 -0
  243. package/node_modules/@codor/protocol/dist/interaction.d.ts.map +1 -0
  244. package/node_modules/@codor/protocol/dist/interaction.js +33 -0
  245. package/node_modules/@codor/protocol/dist/interaction.js.map +1 -0
  246. package/node_modules/@codor/protocol/dist/member.d.ts +146 -0
  247. package/node_modules/@codor/protocol/dist/member.d.ts.map +1 -0
  248. package/node_modules/@codor/protocol/dist/member.js +169 -0
  249. package/node_modules/@codor/protocol/dist/member.js.map +1 -0
  250. package/node_modules/@codor/protocol/dist/message.d.ts +166 -0
  251. package/node_modules/@codor/protocol/dist/message.d.ts.map +1 -0
  252. package/node_modules/@codor/protocol/dist/message.js +95 -0
  253. package/node_modules/@codor/protocol/dist/message.js.map +1 -0
  254. package/node_modules/@codor/protocol/dist/observability.d.ts +80 -0
  255. package/node_modules/@codor/protocol/dist/observability.d.ts.map +1 -0
  256. package/node_modules/@codor/protocol/dist/observability.js +41 -0
  257. package/node_modules/@codor/protocol/dist/observability.js.map +1 -0
  258. package/node_modules/@codor/protocol/dist/room.d.ts +430 -0
  259. package/node_modules/@codor/protocol/dist/room.d.ts.map +1 -0
  260. package/node_modules/@codor/protocol/dist/room.js +142 -0
  261. package/node_modules/@codor/protocol/dist/room.js.map +1 -0
  262. package/node_modules/@codor/protocol/dist/ws.d.ts +1348 -0
  263. package/node_modules/@codor/protocol/dist/ws.d.ts.map +1 -0
  264. package/node_modules/@codor/protocol/dist/ws.js +282 -0
  265. package/node_modules/@codor/protocol/dist/ws.js.map +1 -0
  266. package/node_modules/@codor/protocol/package.json +17 -0
  267. package/node_modules/@codor/switchboard/dist/adapter-registry.d.ts +14 -0
  268. package/node_modules/@codor/switchboard/dist/adapter-registry.d.ts.map +1 -0
  269. package/node_modules/@codor/switchboard/dist/adapter-registry.js +175 -0
  270. package/node_modules/@codor/switchboard/dist/adapter-registry.js.map +1 -0
  271. package/node_modules/@codor/switchboard/dist/authorization.d.ts +13 -0
  272. package/node_modules/@codor/switchboard/dist/authorization.d.ts.map +1 -0
  273. package/node_modules/@codor/switchboard/dist/authorization.js +96 -0
  274. package/node_modules/@codor/switchboard/dist/authorization.js.map +1 -0
  275. package/node_modules/@codor/switchboard/dist/blobs.d.ts +17 -0
  276. package/node_modules/@codor/switchboard/dist/blobs.d.ts.map +1 -0
  277. package/node_modules/@codor/switchboard/dist/blobs.js +54 -0
  278. package/node_modules/@codor/switchboard/dist/blobs.js.map +1 -0
  279. package/node_modules/@codor/switchboard/dist/collaboration.d.ts +115 -0
  280. package/node_modules/@codor/switchboard/dist/collaboration.d.ts.map +1 -0
  281. package/node_modules/@codor/switchboard/dist/collaboration.js +123 -0
  282. package/node_modules/@codor/switchboard/dist/collaboration.js.map +1 -0
  283. package/node_modules/@codor/switchboard/dist/continuation.d.ts +33 -0
  284. package/node_modules/@codor/switchboard/dist/continuation.d.ts.map +1 -0
  285. package/node_modules/@codor/switchboard/dist/continuation.js +177 -0
  286. package/node_modules/@codor/switchboard/dist/continuation.js.map +1 -0
  287. package/node_modules/@codor/switchboard/dist/crypto/browser-sessions.d.ts +22 -0
  288. package/node_modules/@codor/switchboard/dist/crypto/browser-sessions.d.ts.map +1 -0
  289. package/node_modules/@codor/switchboard/dist/crypto/browser-sessions.js +92 -0
  290. package/node_modules/@codor/switchboard/dist/crypto/browser-sessions.js.map +1 -0
  291. package/node_modules/@codor/switchboard/dist/crypto/challenge.d.ts +37 -0
  292. package/node_modules/@codor/switchboard/dist/crypto/challenge.d.ts.map +1 -0
  293. package/node_modules/@codor/switchboard/dist/crypto/challenge.js +132 -0
  294. package/node_modules/@codor/switchboard/dist/crypto/challenge.js.map +1 -0
  295. package/node_modules/@codor/switchboard/dist/crypto/keys.d.ts +41 -0
  296. package/node_modules/@codor/switchboard/dist/crypto/keys.d.ts.map +1 -0
  297. package/node_modules/@codor/switchboard/dist/crypto/keys.js +145 -0
  298. package/node_modules/@codor/switchboard/dist/crypto/keys.js.map +1 -0
  299. package/node_modules/@codor/switchboard/dist/crypto/pairing.d.ts +53 -0
  300. package/node_modules/@codor/switchboard/dist/crypto/pairing.d.ts.map +1 -0
  301. package/node_modules/@codor/switchboard/dist/crypto/pairing.js +182 -0
  302. package/node_modules/@codor/switchboard/dist/crypto/pairing.js.map +1 -0
  303. package/node_modules/@codor/switchboard/dist/crypto/roomkeys.d.ts +30 -0
  304. package/node_modules/@codor/switchboard/dist/crypto/roomkeys.d.ts.map +1 -0
  305. package/node_modules/@codor/switchboard/dist/crypto/roomkeys.js +101 -0
  306. package/node_modules/@codor/switchboard/dist/crypto/roomkeys.js.map +1 -0
  307. package/node_modules/@codor/switchboard/dist/daemon.d.ts +545 -0
  308. package/node_modules/@codor/switchboard/dist/daemon.d.ts.map +1 -0
  309. package/node_modules/@codor/switchboard/dist/daemon.js +3907 -0
  310. package/node_modules/@codor/switchboard/dist/daemon.js.map +1 -0
  311. package/node_modules/@codor/switchboard/dist/fake-adapter.d.ts +103 -0
  312. package/node_modules/@codor/switchboard/dist/fake-adapter.d.ts.map +1 -0
  313. package/node_modules/@codor/switchboard/dist/fake-adapter.js +228 -0
  314. package/node_modules/@codor/switchboard/dist/fake-adapter.js.map +1 -0
  315. package/node_modules/@codor/switchboard/dist/index.d.ts +44 -0
  316. package/node_modules/@codor/switchboard/dist/index.d.ts.map +1 -0
  317. package/node_modules/@codor/switchboard/dist/index.js +24 -0
  318. package/node_modules/@codor/switchboard/dist/index.js.map +1 -0
  319. package/node_modules/@codor/switchboard/dist/ledger/resolve.d.ts +12 -0
  320. package/node_modules/@codor/switchboard/dist/ledger/resolve.d.ts.map +1 -0
  321. package/node_modules/@codor/switchboard/dist/ledger/resolve.js +17 -0
  322. package/node_modules/@codor/switchboard/dist/ledger/resolve.js.map +1 -0
  323. package/node_modules/@codor/switchboard/dist/ledger/vault.d.ts +47 -0
  324. package/node_modules/@codor/switchboard/dist/ledger/vault.d.ts.map +1 -0
  325. package/node_modules/@codor/switchboard/dist/ledger/vault.js +175 -0
  326. package/node_modules/@codor/switchboard/dist/ledger/vault.js.map +1 -0
  327. package/node_modules/@codor/switchboard/dist/ledger/watch.d.ts +73 -0
  328. package/node_modules/@codor/switchboard/dist/ledger/watch.d.ts.map +1 -0
  329. package/node_modules/@codor/switchboard/dist/ledger/watch.js +232 -0
  330. package/node_modules/@codor/switchboard/dist/ledger/watch.js.map +1 -0
  331. package/node_modules/@codor/switchboard/dist/local-dirs.d.ts +14 -0
  332. package/node_modules/@codor/switchboard/dist/local-dirs.d.ts.map +1 -0
  333. package/node_modules/@codor/switchboard/dist/local-dirs.js +40 -0
  334. package/node_modules/@codor/switchboard/dist/local-dirs.js.map +1 -0
  335. package/node_modules/@codor/switchboard/dist/local-socket.d.ts +3 -0
  336. package/node_modules/@codor/switchboard/dist/local-socket.d.ts.map +1 -0
  337. package/node_modules/@codor/switchboard/dist/local-socket.js +16 -0
  338. package/node_modules/@codor/switchboard/dist/local-socket.js.map +1 -0
  339. package/node_modules/@codor/switchboard/dist/pricing.d.ts +32 -0
  340. package/node_modules/@codor/switchboard/dist/pricing.d.ts.map +1 -0
  341. package/node_modules/@codor/switchboard/dist/pricing.js +64 -0
  342. package/node_modules/@codor/switchboard/dist/pricing.js.map +1 -0
  343. package/node_modules/@codor/switchboard/dist/process-liveness.d.ts +2 -0
  344. package/node_modules/@codor/switchboard/dist/process-liveness.d.ts.map +1 -0
  345. package/node_modules/@codor/switchboard/dist/process-liveness.js +9 -0
  346. package/node_modules/@codor/switchboard/dist/process-liveness.js.map +1 -0
  347. package/node_modules/@codor/switchboard/dist/push/producer.d.ts +54 -0
  348. package/node_modules/@codor/switchboard/dist/push/producer.d.ts.map +1 -0
  349. package/node_modules/@codor/switchboard/dist/push/producer.js +168 -0
  350. package/node_modules/@codor/switchboard/dist/push/producer.js.map +1 -0
  351. package/node_modules/@codor/switchboard/dist/push/subscriptions.d.ts +29 -0
  352. package/node_modules/@codor/switchboard/dist/push/subscriptions.d.ts.map +1 -0
  353. package/node_modules/@codor/switchboard/dist/push/subscriptions.js +83 -0
  354. package/node_modules/@codor/switchboard/dist/push/subscriptions.js.map +1 -0
  355. package/node_modules/@codor/switchboard/dist/redact.d.ts +11 -0
  356. package/node_modules/@codor/switchboard/dist/redact.d.ts.map +1 -0
  357. package/node_modules/@codor/switchboard/dist/redact.js +65 -0
  358. package/node_modules/@codor/switchboard/dist/redact.js.map +1 -0
  359. package/node_modules/@codor/switchboard/dist/residency.d.ts +110 -0
  360. package/node_modules/@codor/switchboard/dist/residency.d.ts.map +1 -0
  361. package/node_modules/@codor/switchboard/dist/residency.js +587 -0
  362. package/node_modules/@codor/switchboard/dist/residency.js.map +1 -0
  363. package/node_modules/@codor/switchboard/dist/router.d.ts +120 -0
  364. package/node_modules/@codor/switchboard/dist/router.d.ts.map +1 -0
  365. package/node_modules/@codor/switchboard/dist/router.js +198 -0
  366. package/node_modules/@codor/switchboard/dist/router.js.map +1 -0
  367. package/node_modules/@codor/switchboard/dist/server.d.ts +50 -0
  368. package/node_modules/@codor/switchboard/dist/server.d.ts.map +1 -0
  369. package/node_modules/@codor/switchboard/dist/server.js +1425 -0
  370. package/node_modules/@codor/switchboard/dist/server.js.map +1 -0
  371. package/node_modules/@codor/switchboard/dist/store.d.ts +534 -0
  372. package/node_modules/@codor/switchboard/dist/store.d.ts.map +1 -0
  373. package/node_modules/@codor/switchboard/dist/store.js +2625 -0
  374. package/node_modules/@codor/switchboard/dist/store.js.map +1 -0
  375. package/node_modules/@codor/switchboard/dist/transport/hyperswarm.d.ts +59 -0
  376. package/node_modules/@codor/switchboard/dist/transport/hyperswarm.d.ts.map +1 -0
  377. package/node_modules/@codor/switchboard/dist/transport/hyperswarm.js +183 -0
  378. package/node_modules/@codor/switchboard/dist/transport/hyperswarm.js.map +1 -0
  379. package/node_modules/@codor/switchboard/dist/transport/peer.d.ts +87 -0
  380. package/node_modules/@codor/switchboard/dist/transport/peer.d.ts.map +1 -0
  381. package/node_modules/@codor/switchboard/dist/transport/peer.js +316 -0
  382. package/node_modules/@codor/switchboard/dist/transport/peer.js.map +1 -0
  383. package/node_modules/@codor/switchboard/dist/working-directory.d.ts +2 -0
  384. package/node_modules/@codor/switchboard/dist/working-directory.d.ts.map +1 -0
  385. package/node_modules/@codor/switchboard/dist/working-directory.js +26 -0
  386. package/node_modules/@codor/switchboard/dist/working-directory.js.map +1 -0
  387. package/node_modules/@codor/switchboard/package.json +33 -0
  388. package/package.json +58 -0
@@ -0,0 +1,625 @@
1
+ import { readdirSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { PolicySchema, ThinkingLevelSchema } from '@codor/protocol';
5
+ import { CodexAppServerClient, spawnCodexAppServer, } from './app-server-transport.js';
6
+ import { probeCodexLimits } from './limits-probe.js';
7
+ import { peekCodexContextUsage } from './peek.js';
8
+ import { agentUsageFromTokenUsage, createTurnTranslator, } from './translate.js';
9
+ const ROLLOUT_RE = /^rollout-.*-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/;
10
+ // harn:assume harness-declares-supported-thinking-levels ref=codex-thinking-level-declaration
11
+ export const CODEX_THINKING_LEVELS = [
12
+ 'low',
13
+ 'medium',
14
+ 'high',
15
+ 'xhigh',
16
+ 'max',
17
+ 'ultra',
18
+ ];
19
+ function codexHome() {
20
+ return process.env.CODEX_HOME ?? join(homedir(), '.codex');
21
+ }
22
+ function invalidPolicy(policy) {
23
+ return new Error(`unknown policy '${policy}'; valid policies: ${PolicySchema.options.join(', ')}`);
24
+ }
25
+ function assertThinkingLevel(thinking) {
26
+ if (thinking === undefined)
27
+ return;
28
+ if (!CODEX_THINKING_LEVELS.includes(thinking)) {
29
+ throw new Error(`adapter 'codex' does not support thinking level '${thinking}'; ` +
30
+ `valid levels: ${CODEX_THINKING_LEVELS.join(', ')}`);
31
+ }
32
+ }
33
+ // harn:assume canonical-spawn-controls-enforced ref=codex-spawn-control-mapping
34
+ export function codexPolicyOptions(policy) {
35
+ const selected = policy ?? 'read-only';
36
+ if (!PolicySchema.safeParse(selected).success)
37
+ throw invalidPolicy(selected);
38
+ if (selected === 'read-only') {
39
+ return { approvalPolicy: 'never', sandbox: 'read-only', sandboxPolicy: { type: 'readOnly' } };
40
+ }
41
+ if (selected === 'workspace-write') {
42
+ return {
43
+ approvalPolicy: 'never',
44
+ sandbox: 'workspace-write',
45
+ sandboxPolicy: { type: 'workspaceWrite', networkAccess: false },
46
+ };
47
+ }
48
+ return {
49
+ approvalPolicy: 'never',
50
+ sandbox: 'danger-full-access',
51
+ sandboxPolicy: { type: 'dangerFullAccess' },
52
+ };
53
+ }
54
+ function validateThinking(thinking) {
55
+ if (thinking === undefined)
56
+ return;
57
+ ThinkingLevelSchema.parse(thinking);
58
+ assertThinkingLevel(thinking);
59
+ }
60
+ /**
61
+ * Manual compaction runs as a STANDALONE native turn that can legitimately take
62
+ * minutes on a long thread; bound it so an engine that accepts the command and
63
+ * then goes quiet surfaces as an error instead of a spinner that never stops.
64
+ */
65
+ const COMPACTION_TIMEOUT_MS = 180_000;
66
+ function sortedEnvironment(env) {
67
+ return JSON.stringify(Object.entries(env)
68
+ .filter((entry) => entry[1] !== undefined)
69
+ .sort(([left], [right]) => left.localeCompare(right)));
70
+ }
71
+ function runtimeIdentity(session) {
72
+ return {
73
+ cwd: session.cwd,
74
+ model: session.model,
75
+ policy: session.policy,
76
+ thinking: session.thinking,
77
+ env: sortedEnvironment({ ...process.env, ...session.env }),
78
+ };
79
+ }
80
+ function sameIdentity(left, right) {
81
+ return left !== undefined &&
82
+ left.cwd === right.cwd &&
83
+ left.model === right.model &&
84
+ left.policy === right.policy &&
85
+ left.thinking === right.thinking &&
86
+ left.env === right.env;
87
+ }
88
+ function record(value) {
89
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
90
+ ? value
91
+ : undefined;
92
+ }
93
+ function responseId(response, key) {
94
+ const container = record(response)?.[key];
95
+ const id = record(container)?.id;
96
+ return typeof id === 'string' && id !== '' ? id : undefined;
97
+ }
98
+ function notificationThreadId(params) {
99
+ const id = record(params)?.threadId;
100
+ return typeof id === 'string' ? id : undefined;
101
+ }
102
+ /**
103
+ * Codex adapter backed by one long-lived 0.144.5 app-server per member.
104
+ * Codor owns the turn boundary and spawn-time sandbox policy; app-server owns
105
+ * the persistent native thread and context compaction.
106
+ */
107
+ export class CodexAdapter {
108
+ id = 'codex';
109
+ capabilities = {
110
+ resume: true,
111
+ discover: true,
112
+ interactiveAttach: true,
113
+ ask: false,
114
+ approvals: 'spawn-time',
115
+ extensions: false,
116
+ thinking: true,
117
+ thinking_levels: CODEX_THINKING_LEVELS,
118
+ // harn:assume live-inbox-capability-is-evidence-backed ref=codex-live-inbox-capability
119
+ live_inbox: false,
120
+ // harn:end live-inbox-capability-is-evidence-backed
121
+ // harn:assume harness-declares-what-a-policy-becomes ref=adapter-policy-declarations
122
+ // Full access uses Codex's no-approval, no-sandbox mode; all three are distinct.
123
+ policies: {
124
+ 'read-only': 'read-only',
125
+ 'workspace-write': 'workspace-write',
126
+ 'full-access': '--yolo',
127
+ },
128
+ // harn:end harness-declares-what-a-policy-becomes
129
+ };
130
+ runtimes = new WeakMap();
131
+ memberRuntimes = new Map();
132
+ command;
133
+ appServerFactory;
134
+ constructor(options = {}) {
135
+ this.command = options.command ?? 'codex';
136
+ this.appServerFactory = options.appServerFactory ?? spawnCodexAppServer;
137
+ }
138
+ spawn(opts) {
139
+ codexPolicyOptions(opts.policy);
140
+ validateThinking(opts.thinking);
141
+ return {
142
+ harness: this.id,
143
+ cwd: opts.cwd,
144
+ model: opts.model,
145
+ policy: opts.policy,
146
+ thinking: opts.thinking,
147
+ };
148
+ }
149
+ // harn:assume adapters-own-their-model-catalog ref=codex-model-catalog
150
+ /** Curated: `codex` has no listing command. Cited in NOTES.md. */
151
+ listModels() {
152
+ return Promise.resolve({
153
+ models: ['gpt-5.6-luna', 'gpt-5.6-terra', 'gpt-5.6-sol', 'gpt-5.5'],
154
+ source: 'curated',
155
+ });
156
+ }
157
+ // harn:end adapters-own-their-model-catalog
158
+ probeLimits() {
159
+ return probeCodexLimits();
160
+ }
161
+ // harn:assume context-peek-reads-session-artifacts ref=codex-context-peek
162
+ peekContextUsage(session_ref) {
163
+ return Promise.resolve(peekCodexContextUsage(session_ref));
164
+ }
165
+ // harn:end context-peek-reads-session-artifacts
166
+ attach(session_ref) {
167
+ return { harness: this.id, session_ref, cwd: process.cwd() };
168
+ }
169
+ // harn:assume codex-app-server-is-the-member-runtime ref=codex-app-server-session-lifecycle
170
+ async *deliver(session, payload, hooks = {}) {
171
+ const runtime = this.runtimeFor(session);
172
+ if (runtime.active !== null)
173
+ throw new Error('a Codex turn is already in flight for this member');
174
+ await this.prepareRuntime(runtime, session);
175
+ const turn = {
176
+ translator: createTurnTranslator(runtime.context),
177
+ hooks,
178
+ queue: [],
179
+ wake: null,
180
+ terminal: false,
181
+ done: false,
182
+ interrupted: false,
183
+ };
184
+ runtime.active = turn;
185
+ try {
186
+ try {
187
+ await this.ensureClient(runtime);
188
+ hooks.onStarted?.({
189
+ pid: runtime.child?.pid,
190
+ });
191
+ await this.ensureThread(runtime, turn);
192
+ const response = await runtime.client.request('turn/start', {
193
+ threadId: runtime.threadId,
194
+ input: [{ type: 'text', text: payload, text_elements: [] }],
195
+ cwd: session.cwd,
196
+ ...this.turnOptions(session),
197
+ });
198
+ turn.turnId ??= responseId(response, 'turn');
199
+ }
200
+ catch (error) {
201
+ if (!turn.terminal) {
202
+ const detail = error instanceof Error ? error.message : String(error);
203
+ this.completeTurn(turn, {
204
+ type: 'run.completed',
205
+ status: turn.interrupted ? 'interrupted' : 'failed',
206
+ ...(turn.interrupted ? {} : { error: detail }),
207
+ });
208
+ }
209
+ this.retireRuntime(runtime);
210
+ }
211
+ while (true) {
212
+ if (turn.queue.length > 0) {
213
+ yield turn.queue.shift();
214
+ continue;
215
+ }
216
+ if (turn.done)
217
+ break;
218
+ await new Promise((resolve) => {
219
+ turn.wake = resolve;
220
+ });
221
+ turn.wake = null;
222
+ }
223
+ }
224
+ finally {
225
+ if (runtime.active === turn)
226
+ runtime.active = null;
227
+ if (!turn.terminal) {
228
+ turn.interrupted = true;
229
+ this.completeTurn(turn, { type: 'run.completed', status: 'interrupted' });
230
+ this.retireRuntime(runtime);
231
+ }
232
+ }
233
+ }
234
+ runtimeFor(session) {
235
+ const direct = this.runtimes.get(session);
236
+ if (direct !== undefined) {
237
+ direct.session = session;
238
+ return direct;
239
+ }
240
+ const memberKey = session.env?.CODOR_MEMBER_ID;
241
+ const existing = memberKey === undefined ? undefined : this.memberRuntimes.get(memberKey);
242
+ const runtime = existing ?? {
243
+ session,
244
+ pendingCompaction: null,
245
+ ...(memberKey !== undefined && { memberKey }),
246
+ client: null,
247
+ child: null,
248
+ connecting: null,
249
+ active: null,
250
+ ...(session.session_ref !== undefined && { threadId: session.session_ref }),
251
+ context: {},
252
+ };
253
+ runtime.session = session;
254
+ if (session.session_ref !== undefined)
255
+ runtime.threadId = session.session_ref;
256
+ this.runtimes.set(session, runtime);
257
+ if (memberKey !== undefined)
258
+ this.memberRuntimes.set(memberKey, runtime);
259
+ return runtime;
260
+ }
261
+ async prepareRuntime(runtime, session) {
262
+ const identity = runtimeIdentity(session);
263
+ if (runtime.client !== null && !sameIdentity(runtime.identity, identity)) {
264
+ this.retireRuntime(runtime);
265
+ }
266
+ runtime.session = session;
267
+ if (session.session_ref !== undefined)
268
+ runtime.threadId = session.session_ref;
269
+ if (runtime.client === null)
270
+ runtime.identity = identity;
271
+ }
272
+ async ensureClient(runtime) {
273
+ if (runtime.client !== null)
274
+ return;
275
+ if (runtime.connecting !== null)
276
+ return await runtime.connecting;
277
+ const connecting = this.connect(runtime);
278
+ runtime.connecting = connecting;
279
+ try {
280
+ await connecting;
281
+ }
282
+ finally {
283
+ if (runtime.connecting === connecting)
284
+ runtime.connecting = null;
285
+ }
286
+ }
287
+ async connect(runtime) {
288
+ const session = runtime.session;
289
+ // harn:assume adapter-children-inherit-session-env ref=codex-child-environment
290
+ const child = await this.appServerFactory({
291
+ command: this.command,
292
+ cwd: session.cwd,
293
+ env: { ...process.env, ...session.env },
294
+ });
295
+ // harn:end adapter-children-inherit-session-env
296
+ let client;
297
+ client = new CodexAppServerClient(child, (error) => this.handleClientClose(runtime, client, error));
298
+ runtime.child = child;
299
+ runtime.client = client;
300
+ runtime.identity = runtimeIdentity(session);
301
+ client.setNotificationHandler((method, params) => this.routeNotification(runtime, client, method, params));
302
+ // Runtime approvals are intentionally unsupported. `never` should prevent
303
+ // these methods, but declining is safer than leaving an unexpected request hung.
304
+ client.setRequestHandler('item/commandExecution/requestApproval', () => ({ decision: 'decline' }));
305
+ client.setRequestHandler('item/fileChange/requestApproval', () => ({ decision: 'decline' }));
306
+ try {
307
+ await client.request('initialize', {
308
+ clientInfo: { name: 'codor', title: 'Codor', version: '0.1.0' },
309
+ });
310
+ client.notify('initialized');
311
+ if (runtime.threadId !== undefined) {
312
+ await client.request('thread/resume', {
313
+ threadId: runtime.threadId,
314
+ ...this.threadOptions(session),
315
+ });
316
+ }
317
+ }
318
+ catch (error) {
319
+ if (runtime.client === client) {
320
+ runtime.client = null;
321
+ runtime.child = null;
322
+ }
323
+ client.dispose();
324
+ throw error;
325
+ }
326
+ }
327
+ async ensureThread(runtime, turn) {
328
+ if (runtime.threadId !== undefined)
329
+ return;
330
+ const response = await runtime.client.request('thread/start', this.threadOptions(runtime.session));
331
+ const threadId = responseId(response, 'thread');
332
+ if (threadId === undefined)
333
+ throw new Error('Codex app-server did not return a thread id');
334
+ runtime.threadId = threadId;
335
+ runtime.session.session_ref = threadId;
336
+ turn.hooks.onSessionRef?.(threadId);
337
+ }
338
+ threadOptions(session) {
339
+ const policy = codexPolicyOptions(session.policy);
340
+ return {
341
+ cwd: session.cwd,
342
+ approvalPolicy: policy.approvalPolicy,
343
+ sandbox: policy.sandbox,
344
+ ...(session.model !== undefined && { model: session.model }),
345
+ };
346
+ }
347
+ turnOptions(session) {
348
+ const policy = codexPolicyOptions(session.policy);
349
+ return {
350
+ approvalPolicy: policy.approvalPolicy,
351
+ sandboxPolicy: policy.sandboxPolicy,
352
+ ...(session.model !== undefined && { model: session.model }),
353
+ ...(session.thinking !== undefined && { effort: session.thinking }),
354
+ };
355
+ }
356
+ routeNotification(runtime, client, method, params) {
357
+ if (runtime.client !== client)
358
+ return;
359
+ const threadId = notificationThreadId(params);
360
+ if (threadId !== undefined && runtime.threadId !== undefined && threadId !== runtime.threadId) {
361
+ return;
362
+ }
363
+ // A manual compaction runs with no turn open, and the branch below drops
364
+ // every notification in that state — so observe its turn before that.
365
+ this.observeCompaction(runtime, method, params);
366
+ const turn = runtime.active;
367
+ if (turn === null || turn.done)
368
+ return;
369
+ const events = turn.translator.push(method, params);
370
+ turn.turnId ??= turn.translator.turnId();
371
+ this.push(turn, events);
372
+ if (events.some((event) => event.type === 'run.completed')) {
373
+ turn.terminal = true;
374
+ turn.done = true;
375
+ turn.wake?.();
376
+ }
377
+ }
378
+ handleClientClose(runtime, client, error) {
379
+ if (runtime.client !== client)
380
+ return;
381
+ this.failCompaction(runtime, error);
382
+ runtime.client = null;
383
+ runtime.child = null;
384
+ const turn = runtime.active;
385
+ if (turn !== null && !turn.terminal) {
386
+ this.completeTurn(turn, turn.interrupted
387
+ ? { type: 'run.completed', status: 'interrupted' }
388
+ : { type: 'run.completed', status: 'failed', error: error.message });
389
+ }
390
+ }
391
+ push(turn, events) {
392
+ if (events.length === 0)
393
+ return;
394
+ turn.queue.push(...events);
395
+ turn.wake?.();
396
+ }
397
+ completeTurn(turn, event) {
398
+ if (turn.terminal)
399
+ return;
400
+ this.push(turn, [event]);
401
+ turn.terminal = true;
402
+ turn.done = true;
403
+ turn.wake?.();
404
+ }
405
+ retireRuntime(runtime, removeRuntime = false) {
406
+ this.failCompaction(runtime, new Error('Codex session retired before compaction completed'));
407
+ const client = runtime.client;
408
+ runtime.client = null;
409
+ runtime.child = null;
410
+ runtime.identity = undefined;
411
+ client?.dispose();
412
+ if (removeRuntime) {
413
+ this.runtimes.delete(runtime.session);
414
+ if (runtime.memberKey !== undefined)
415
+ this.memberRuntimes.delete(runtime.memberKey);
416
+ }
417
+ }
418
+ /**
419
+ * Compact this thread using the app server's own compaction RPC. Only ever
420
+ * called for an idle session: compacting mid-turn races the engine rewriting
421
+ * the same history. The RPC returns {} at once and the work runs as a
422
+ * standalone native turn, so the result comes from observing that turn (see
423
+ * observeCompaction) — resolving with the usage correlated to it, so the ring
424
+ * updates without waiting for a next turn.
425
+ */
426
+ async compactSession(session) {
427
+ const runtime = this.liveRuntime(session);
428
+ if (runtime === undefined)
429
+ throw new Error('no live Codex session to compact');
430
+ if (runtime.active !== null && !runtime.active.terminal) {
431
+ throw new Error('cannot compact while a turn is in flight');
432
+ }
433
+ if (runtime.pendingCompaction !== null)
434
+ throw new Error('a compaction is already in flight');
435
+ await this.ensureClient(runtime);
436
+ const threadId = runtime.threadId;
437
+ if (threadId === undefined)
438
+ throw new Error('no Codex thread to compact');
439
+ const settled = new Promise((resolve, reject) => {
440
+ const timer = setTimeout(() => this.failCompaction(runtime, new Error('Codex compaction timed out')), COMPACTION_TIMEOUT_MS);
441
+ timer.unref?.();
442
+ runtime.pendingCompaction = {
443
+ settle: resolve, fail: reject,
444
+ startedTurnIds: new Set(), itemCompleted: false, timer,
445
+ };
446
+ });
447
+ try {
448
+ await runtime.client.request('thread/compact/start', { threadId });
449
+ }
450
+ catch (error) {
451
+ // The RPC itself failed (a dead client rejects it). Fail the observer's
452
+ // promise too and consume it here: the caller learns about this through
453
+ // the throw below, and an unconsumed rejection would surface as an
454
+ // unhandled rejection instead of an error the operator sees.
455
+ const failure = error instanceof Error ? error : new Error(String(error));
456
+ this.failCompaction(runtime, failure);
457
+ void settled.catch(() => undefined);
458
+ throw failure;
459
+ }
460
+ return await settled;
461
+ }
462
+ /**
463
+ * Watch the standalone turn `thread/compact/start` kicks off. The RPC returns
464
+ * {} immediately and the work happens as a native turn, so the authority on
465
+ * whether compaction happened is that turn's `turn/completed` — not
466
+ * `thread/compacted`, which is exactly {threadId, turnId} and never carries a
467
+ * usage payload.
468
+ *
469
+ * Everything is CORRELATED to the compact turn. A thread can be carrying other
470
+ * traffic, and an uncorrelated observer would happily adopt a stranger's token
471
+ * usage as the re-baseline or settle on a stranger's completion — and turn
472
+ * ORDER proves nothing, so the first turn/started is not it either. Identity
473
+ * comes from the canonical item: bind to whichever started turn opens a
474
+ * contextCompaction item, then accept item and usage notifications only for
475
+ * that turn and settle only on its terminal. A terminal without a completed
476
+ * canonical item did not compact anything, and is reported as a failure
477
+ * rather than a success with nothing behind it.
478
+ */
479
+ observeCompaction(runtime, method, params) {
480
+ const pending = runtime.pendingCompaction;
481
+ if (pending === null)
482
+ return;
483
+ const record = typeof params === 'object' && params !== null
484
+ ? params
485
+ : undefined;
486
+ if (record === undefined)
487
+ return;
488
+ const turnId = (value) => typeof value === 'string' ? value : undefined;
489
+ if (method === 'turn/started') {
490
+ // Merely noted, never adopted: a thread can start turns that have nothing
491
+ // to do with this compaction, and adopting one would let a stranger's
492
+ // usage become the re-baseline and a stranger's terminal settle us.
493
+ const turn = record.turn;
494
+ const started = turnId(turn?.id);
495
+ if (started !== undefined)
496
+ pending.startedTurnIds.add(started);
497
+ return;
498
+ }
499
+ // Identity is established by the canonical item, not by turn order: the
500
+ // compact turn is the started turn that opens a contextCompaction item.
501
+ if (method === 'item/started') {
502
+ const item = record.item;
503
+ if (item?.type !== 'contextCompaction' || pending.turnId !== undefined)
504
+ return;
505
+ const owner = turnId(record.turnId);
506
+ if (owner === undefined || !pending.startedTurnIds.has(owner))
507
+ return;
508
+ pending.turnId = owner;
509
+ pending.itemId = turnId(item.id);
510
+ return;
511
+ }
512
+ // Until bound, nothing on this thread belongs to us. Item and usage
513
+ // notifications name their turn at the top level; turn/completed names it
514
+ // inside `turn`, so read both rather than silently dropping the terminal.
515
+ const owner = turnId(record.turnId)
516
+ ?? turnId(record.turn?.id);
517
+ if (pending.turnId === undefined || owner !== pending.turnId)
518
+ return;
519
+ if (method === 'item/completed') {
520
+ const item = record.item;
521
+ if (item?.type !== 'contextCompaction')
522
+ return;
523
+ const id = turnId(item.id);
524
+ if (id !== undefined && id === pending.itemId)
525
+ pending.itemCompleted = true;
526
+ return;
527
+ }
528
+ if (method === 'thread/tokenUsage/updated') {
529
+ const usage = agentUsageFromTokenUsage(record.tokenUsage);
530
+ if (usage !== undefined)
531
+ pending.usage = usage;
532
+ return;
533
+ }
534
+ if (method !== 'turn/completed')
535
+ return;
536
+ const turn = record.turn;
537
+ const status = turn?.status;
538
+ if (status !== 'completed') {
539
+ const detail = typeof turn?.error?.message === 'string' ? turn.error.message : undefined;
540
+ this.failCompaction(runtime, new Error(`Codex compaction ${status === 'interrupted' ? 'was interrupted' : 'failed'}` +
541
+ `${detail === undefined ? '' : `: ${detail}`}`));
542
+ return;
543
+ }
544
+ if (!pending.itemCompleted) {
545
+ this.failCompaction(runtime, new Error('Codex compaction turn completed without compacting anything'));
546
+ return;
547
+ }
548
+ const usage = pending.usage;
549
+ this.clearCompaction(runtime);
550
+ if (usage !== undefined)
551
+ runtime.context.latestUsage = usage;
552
+ pending.settle(usage);
553
+ }
554
+ /** Every terminal path clears the pending state; none may leak a promise. */
555
+ clearCompaction(runtime) {
556
+ const pending = runtime.pendingCompaction;
557
+ if (pending === null)
558
+ return null;
559
+ clearTimeout(pending.timer);
560
+ runtime.pendingCompaction = null;
561
+ return pending;
562
+ }
563
+ failCompaction(runtime, error) {
564
+ this.clearCompaction(runtime)?.fail(error);
565
+ }
566
+ /** Find-only: the runtime this session already has, never creating one. */
567
+ liveRuntime(session) {
568
+ return this.runtimes.get(session)
569
+ ?? (session.env?.CODOR_MEMBER_ID === undefined
570
+ ? undefined
571
+ : this.memberRuntimes.get(session.env.CODOR_MEMBER_ID));
572
+ }
573
+ interrupt(session) {
574
+ const runtime = this.liveRuntime(session);
575
+ if (runtime === undefined)
576
+ return;
577
+ const turn = runtime.active;
578
+ if (turn === null || turn.terminal) {
579
+ this.retireRuntime(runtime, true);
580
+ return;
581
+ }
582
+ turn.interrupted = true;
583
+ const client = runtime.client;
584
+ if (client === null || runtime.threadId === undefined || turn.turnId === undefined) {
585
+ this.completeTurn(turn, { type: 'run.completed', status: 'interrupted' });
586
+ this.retireRuntime(runtime, true);
587
+ return;
588
+ }
589
+ this.completeTurn(turn, { type: 'run.completed', status: 'interrupted' });
590
+ void client.request('turn/interrupt', {
591
+ threadId: runtime.threadId,
592
+ turnId: turn.turnId,
593
+ }, 5_000).catch(() => undefined).finally(() => this.retireRuntime(runtime, true));
594
+ }
595
+ // harn:end codex-app-server-is-the-member-runtime
596
+ respondInteraction() {
597
+ return Promise.reject(new Error('codex raises no interactions (capabilities.ask=false, approvals=spawn-time)'));
598
+ }
599
+ /** Thread ids from the rollout store (~/.codex/sessions/YYYY/MM/DD/). */
600
+ discoverSessions() {
601
+ const refs = [];
602
+ const root = join(codexHome(), 'sessions');
603
+ const walk = (dir) => {
604
+ let entries;
605
+ try {
606
+ entries = readdirSync(dir, { withFileTypes: true });
607
+ }
608
+ catch {
609
+ return;
610
+ }
611
+ for (const entry of entries) {
612
+ if (entry.isDirectory())
613
+ walk(join(dir, entry.name));
614
+ else {
615
+ const match = ROLLOUT_RE.exec(entry.name);
616
+ if (match)
617
+ refs.push(match[1]);
618
+ }
619
+ }
620
+ };
621
+ walk(root);
622
+ return refs;
623
+ }
624
+ }
625
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAcjC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EACL,oBAAoB,EAEpB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GAErB,MAAM,gBAAgB,CAAC;AAExB,MAAM,UAAU,GAAG,oFAAoF,CAAC;AAExG,8FAA8F;AAC9F,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK;IACL,QAAQ;IACR,MAAM;IACN,OAAO;IACP,KAAK;IACL,OAAO;CACoC,CAAC;AAE9C,SAAS,SAAS;IAChB,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,OA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