@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,105 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import { type SetupAccessOption, type SetupSummary } from './setup-ui.js';
3
+ export interface SetupSessionStreams {
4
+ input: NodeJS.ReadStream;
5
+ output: NodeJS.WriteStream;
6
+ }
7
+ interface SetupSignalTarget extends EventEmitter {
8
+ once(event: NodeJS.Signals, listener: () => void): this;
9
+ off(event: NodeJS.Signals, listener: () => void): this;
10
+ }
11
+ export interface SetupSessionOptions {
12
+ version: string;
13
+ byline?: string;
14
+ streams?: SetupSessionStreams;
15
+ signalTarget?: SetupSignalTarget;
16
+ raiseSignal?: (signal: NodeJS.Signals) => void;
17
+ }
18
+ export declare function isInteractiveSetup(streams?: Partial<SetupSessionStreams>): boolean;
19
+ export declare class SetupCancelled extends Error {
20
+ constructor();
21
+ }
22
+ /** A step's outcome: a one-line summary when its work ran, or a skip decision.
23
+ * `skipFollowing` cascades the skip to every later step (declining Start also
24
+ * skips pairing) so the wizard can finish honestly without mutating. */
25
+ export type SetupStepOutcome = string | {
26
+ skip: true;
27
+ summary?: string;
28
+ skipFollowing?: boolean;
29
+ };
30
+ /** What a wizard step does when the flow enters it. `run` performs the step's
31
+ * effectful work and returns a summary; throwing marks the step failed and
32
+ * keeps the operator inside it with Retry. A `menu` makes the step a vertical
33
+ * choice whose selected option id is passed to `run` as `context.choice`; a
34
+ * consent step returns a skip outcome when the operator declines, and no
35
+ * mutation happens because the effectful work is never called. */
36
+ export interface SetupStepContext {
37
+ log(message: string): void;
38
+ choice?: string;
39
+ /** Present a vertical choice while the step is running and resolve to the
40
+ * selected option id. Cancel (q / Ctrl-C) aborts setup. */
41
+ choose(menu: {
42
+ message: string;
43
+ options: SetupAccessOption[];
44
+ }): Promise<string>;
45
+ /** Replace the step's question in-frame with a pre-rendered result block (the
46
+ * pairing card), so it is visible before Finish. */
47
+ presentResult(block: string): void;
48
+ }
49
+ export interface SetupStepDefinition {
50
+ title: string;
51
+ /** Short muted line shown under the heading while the step is active. */
52
+ description?: string;
53
+ menu?: {
54
+ message: string;
55
+ options: SetupAccessOption[];
56
+ };
57
+ run(context: SetupStepContext): Promise<SetupStepOutcome>;
58
+ }
59
+ export declare class SetupSession {
60
+ private flow;
61
+ private readonly summaries;
62
+ private readonly input;
63
+ private readonly output;
64
+ private readonly signalTarget;
65
+ private readonly raiseSignal;
66
+ private readonly version;
67
+ private readonly byline;
68
+ private readonly detachers;
69
+ private spinner;
70
+ private frame;
71
+ private summary;
72
+ private context;
73
+ private card;
74
+ private cardStep;
75
+ private menu;
76
+ private awaitingNav;
77
+ private priorRawMode;
78
+ private started;
79
+ constructor(options: SetupSessionOptions);
80
+ start(): void;
81
+ stop(): void;
82
+ finish(summary?: SetupSummary): void;
83
+ render(): void;
84
+ /**
85
+ * Drive the wizard over the given steps. Automatic steps run and advance
86
+ * without asking for Next; a choice step waits at its vertical menu; a consent
87
+ * decline skips honestly (cascading to later steps when asked) without
88
+ * mutating; a failure stays inside its step with Retry; Back only moves the
89
+ * cursor and never re-runs committed work; the completed final step waits for
90
+ * Finish. A recoverable failure is never rethrown out of the session.
91
+ */
92
+ run(steps: readonly SetupStepDefinition[]): Promise<void>;
93
+ /** Await a settled step's navigation. Left is Back, r retries a failed step,
94
+ * Enter/Right retries a failed step, finishes the completed last step, or
95
+ * moves forward over a reviewed step. */
96
+ private awaitSettledAction;
97
+ /** A vertical single-select menu. Up/Down move focus, Enter selects the
98
+ * focused option when it is available, Left goes Back, q cancels. */
99
+ private selectFromMenu;
100
+ /** Shared raw-input reader. `handle` returns a settle() call to resolve, or
101
+ * false to keep listening. Registers its teardown so stop() detaches it. */
102
+ private readKeys;
103
+ }
104
+ export {};
105
+ //# sourceMappingURL=setup-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-session.d.ts","sourceRoot":"","sources":["../src/setup-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAIL,KAAK,iBAAiB,EAGtB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAMvB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;CAC5B;AAED,UAAU,iB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AAkB;IAiB1B;0EACsE;IACtE,OAAO,CAAC,cAAc;IAyBtB;iFAC6E;IAC7E,OAAO,CAAC,QAAQ;CA6BjB"}
@@ -0,0 +1,346 @@
1
+ import { SetupFlow } from './setup-flow.js';
2
+ import { SETUP_CURSOR_HIDE, SETUP_CURSOR_SHOW, renderSetupFrame, } from './setup-ui.js';
3
+ import { TerminalKeyDecoder } from './terminal-keys.js';
4
+ const ESCAPE_FLUSH_MS = 40;
5
+ const SPINNER_INTERVAL_MS = 90;
6
+ export function isInteractiveSetup(streams) {
7
+ const input = streams?.input ?? process.stdin;
8
+ const output = streams?.output ?? process.stdout;
9
+ return Boolean(input.isTTY) && Boolean(output.isTTY);
10
+ }
11
+ export class SetupCancelled extends Error {
12
+ constructor() {
13
+ super('Setup cancelled.');
14
+ this.name = 'SetupCancelled';
15
+ }
16
+ }
17
+ // harn:assume setup-restores-terminal-on-every-exit ref=setup-terminal-session
18
+ export class SetupSession {
19
+ flow;
20
+ summaries = [];
21
+ input;
22
+ output;
23
+ signalTarget;
24
+ raiseSignal;
25
+ version;
26
+ byline;
27
+ detachers = [];
28
+ spinner;
29
+ frame = 0;
30
+ summary;
31
+ context;
32
+ card;
33
+ cardStep;
34
+ menu;
35
+ awaitingNav = false;
36
+ priorRawMode = false;
37
+ started = false;
38
+ constructor(options) {
39
+ this.input = options.streams?.input ?? process.stdin;
40
+ this.output = options.streams?.output ?? process.stdout;
41
+ this.signalTarget = options.signalTarget ?? process;
42
+ this.raiseSignal = options.raiseSignal ?? ((signal) => process.kill(process.pid, signal));
43
+ this.version = options.version;
44
+ this.byline = options.byline ?? 'created by richhardry';
45
+ }
46
+ start() {
47
+ if (this.started)
48
+ return;
49
+ this.started = true;
50
+ this.priorRawMode = this.input.isRaw === true;
51
+ if (this.input.isTTY)
52
+ this.input.setRawMode(true);
53
+ this.input.resume();
54
+ this.output.write(SETUP_CURSOR_HIDE);
55
+ const onResize = () => this.render();
56
+ this.output.on('resize', onResize);
57
+ this.detachers.push(() => this.output.off('resize', onResize));
58
+ for (const signal of ['SIGINT', 'SIGTERM']) {
59
+ const onSignal = () => {
60
+ this.stop();
61
+ this.raiseSignal(signal);
62
+ };
63
+ this.signalTarget.once(signal, onSignal);
64
+ this.detachers.push(() => this.signalTarget.off(signal, onSignal));
65
+ }
66
+ this.spinner = setInterval(() => {
67
+ this.frame += 1;
68
+ this.render();
69
+ }, SPINNER_INTERVAL_MS);
70
+ this.render();
71
+ }
72
+ stop() {
73
+ if (!this.started)
74
+ return;
75
+ this.started = false;
76
+ if (this.spinner !== undefined)
77
+ clearInterval(this.spinner);
78
+ this.spinner = undefined;
79
+ while (this.detachers.length > 0)
80
+ this.detachers.pop()?.();
81
+ if (this.input.isTTY)
82
+ this.input.setRawMode(this.priorRawMode);
83
+ this.input.pause();
84
+ this.output.write(SETUP_CURSOR_SHOW);
85
+ }
86
+ finish(summary) {
87
+ // A pairing result already shown in-frame is kept as the final frame; a
88
+ // paused/running finish renders its summary instead.
89
+ this.summary = summary;
90
+ this.stop();
91
+ this.render();
92
+ }
93
+ render() {
94
+ const flow = this.flow;
95
+ if (flow === undefined)
96
+ return;
97
+ const steps = flow.steps.map((step, index) => ({
98
+ title: step.title,
99
+ state: step.state,
100
+ logs: step.logs,
101
+ summary: this.summaries[index],
102
+ error: step.error,
103
+ description: step.description,
104
+ }));
105
+ // Controls are supplied only while awaiting a settled action; a live menu
106
+ // renders its own navigation hint. Forward appears when a later step can be
107
+ // reviewed, Finish only on the completed final step.
108
+ const controls = this.awaitingNav
109
+ ? { back: flow.canBack, forward: flow.canNext, retry: flow.canRetry, finish: flow.complete }
110
+ : undefined;
111
+ this.output.write(renderSetupFrame({
112
+ version: this.version,
113
+ byline: this.byline,
114
+ steps,
115
+ cursor: flow.cursor,
116
+ spinnerFrame: this.frame,
117
+ viewport: { rows: this.output.rows ?? 24, columns: this.output.columns ?? 80 },
118
+ menu: this.menu,
119
+ controls,
120
+ summary: this.summary,
121
+ progress: { current: flow.cursor + 1, total: flow.steps.length },
122
+ context: this.context,
123
+ // Scope the result card to the step that presented it, so Back never shows
124
+ // it on another step.
125
+ card: flow.cursor === this.cardStep ? this.card : undefined,
126
+ }));
127
+ }
128
+ // harn:assume setup-auto-advances-and-gates-mutation-on-consent ref=setup-consent-navigation
129
+ /**
130
+ * Drive the wizard over the given steps. Automatic steps run and advance
131
+ * without asking for Next; a choice step waits at its vertical menu; a consent
132
+ * decline skips honestly (cascading to later steps when asked) without
133
+ * mutating; a failure stays inside its step with Retry; Back only moves the
134
+ * cursor and never re-runs committed work; the completed final step waits for
135
+ * Finish. A recoverable failure is never rethrown out of the session.
136
+ */
137
+ async run(steps) {
138
+ const flow = new SetupFlow(steps.map((step) => ({
139
+ title: step.title,
140
+ kind: step.menu !== undefined ? 'choice' : 'auto',
141
+ description: step.description,
142
+ })));
143
+ this.flow = flow;
144
+ this.summaries.length = 0;
145
+ this.start();
146
+ // Forward momentum: a step that just settled advances automatically; landing
147
+ // on a step via Back clears it so the reviewed step pauses for navigation.
148
+ let advance = true;
149
+ for (;;) {
150
+ const index = flow.cursor;
151
+ const definition = steps[index];
152
+ if (flow.activeNeedsRun) {
153
+ let choice;
154
+ if (definition.menu !== undefined) {
155
+ const decision = await this.selectFromMenu(definition.menu, flow.canBack);
156
+ if (decision.type === 'cancel') {
157
+ this.stop();
158
+ throw new SetupCancelled();
159
+ }
160
+ if (decision.type === 'back') {
161
+ flow.back();
162
+ advance = false;
163
+ continue;
164
+ }
165
+ choice = decision.id;
166
+ }
167
+ flow.markRunning(index);
168
+ this.render();
169
+ // A running step may ask further vertical choices (e.g. remote access
170
+ // consent) through choose(); cancel aborts the whole session.
171
+ const choose = async (menu) => {
172
+ const decision = await this.selectFromMenu(menu, false);
173
+ if (decision.type !== 'select') {
174
+ this.stop();
175
+ throw new SetupCancelled();
176
+ }
177
+ return decision.id;
178
+ };
179
+ const presentResult = (block) => { this.card = block; this.cardStep = index; this.render(); };
180
+ try {
181
+ const outcome = await definition.run({ log: (message) => { flow.log(index, message); this.render(); }, choice, choose, presentResult });
182
+ if (typeof outcome === 'object') {
183
+ this.summaries[index] = outcome.summary;
184
+ flow.markSkipped(index);
185
+ if (outcome.skipFollowing === true) {
186
+ for (let later = index + 1; later < steps.length; later += 1) {
187
+ this.summaries[later] = undefined;
188
+ flow.markSkipped(later);
189
+ }
190
+ }
191
+ }
192
+ else {
193
+ this.summaries[index] = outcome;
194
+ flow.markDone(index, { choice, summary: outcome });
195
+ }
196
+ }
197
+ catch (error) {
198
+ // The failure renders once inside the step. It is not rethrown.
199
+ flow.markFailed(index, error instanceof Error ? error.message : String(error));
200
+ }
201
+ // Carry the first (read-only Check) step's results forward as context.
202
+ if (index === 0 && flow.steps[0].state !== 'pending')
203
+ this.context = [...flow.steps[0].logs];
204
+ this.render();
205
+ advance = true;
206
+ }
207
+ if (flow.active.state === 'failed') {
208
+ const action = await this.awaitSettledAction();
209
+ if (action === 'cancel') {
210
+ this.stop();
211
+ throw new SetupCancelled();
212
+ }
213
+ if (action === 'retry') {
214
+ flow.retry();
215
+ advance = true;
216
+ continue;
217
+ }
218
+ if (action === 'back') {
219
+ flow.back();
220
+ advance = false;
221
+ continue;
222
+ }
223
+ continue;
224
+ }
225
+ // A step that just settled advances automatically; automatic steps never
226
+ // wait for Next. Only a genuine stop — the completed final step or a step
227
+ // reviewed via Back — pauses for a navigation action.
228
+ if (advance && flow.canNext) {
229
+ flow.next();
230
+ continue;
231
+ }
232
+ const action = await this.awaitSettledAction();
233
+ if (action === 'cancel') {
234
+ this.stop();
235
+ throw new SetupCancelled();
236
+ }
237
+ if (action === 'back') {
238
+ flow.back();
239
+ advance = false;
240
+ continue;
241
+ }
242
+ if (action === 'forward' && flow.canNext) {
243
+ flow.next();
244
+ advance = false;
245
+ continue;
246
+ }
247
+ if (action === 'finish' && flow.complete)
248
+ return;
249
+ }
250
+ }
251
+ // harn:end setup-auto-advances-and-gates-mutation-on-consent
252
+ /** Await a settled step's navigation. Left is Back, r retries a failed step,
253
+ * Enter/Right retries a failed step, finishes the completed last step, or
254
+ * moves forward over a reviewed step. */
255
+ awaitSettledAction() {
256
+ this.awaitingNav = true;
257
+ this.render();
258
+ return this.readKeys((key, settle) => {
259
+ const flow = this.flow;
260
+ if (key.type === 'cancel')
261
+ return settle('cancel');
262
+ if (key.type === 'left' && flow.canBack)
263
+ return settle('back');
264
+ if (key.type === 'char' && key.value.toLowerCase() === 'r' && flow.canRetry)
265
+ return settle('retry');
266
+ if (key.type === 'enter' || key.type === 'right') {
267
+ if (flow.canRetry)
268
+ return settle('retry');
269
+ if (flow.complete)
270
+ return settle('finish');
271
+ if (flow.canNext)
272
+ return settle('forward');
273
+ }
274
+ return false;
275
+ }).finally(() => { this.awaitingNav = false; });
276
+ }
277
+ /** A vertical single-select menu. Up/Down move focus, Enter selects the
278
+ * focused option when it is available, Left goes Back, q cancels. */
279
+ selectFromMenu(menu, canBack) {
280
+ const firstAvailable = menu.options.findIndex((option) => option.available);
281
+ let focused = firstAvailable < 0 ? 0 : firstAvailable;
282
+ this.menu = { message: menu.message, options: menu.options, focused, canBack };
283
+ this.render();
284
+ return this.readKeys((key, settle) => {
285
+ if (key.type === 'cancel') {
286
+ this.menu = undefined;
287
+ return settle({ type: 'cancel' });
288
+ }
289
+ if (key.type === 'left' && canBack) {
290
+ this.menu = undefined;
291
+ return settle({ type: 'back' });
292
+ }
293
+ if (key.type === 'up')
294
+ focused = (focused - 1 + menu.options.length) % menu.options.length;
295
+ if (key.type === 'down')
296
+ focused = (focused + 1) % menu.options.length;
297
+ if (key.type === 'enter' || key.type === 'right') {
298
+ const option = menu.options[focused];
299
+ if (option?.available === true) {
300
+ this.menu = undefined;
301
+ return settle({ type: 'select', id: option.id });
302
+ }
303
+ }
304
+ this.menu = { message: menu.message, options: menu.options, focused, canBack };
305
+ this.render();
306
+ return false;
307
+ });
308
+ }
309
+ /** Shared raw-input reader. `handle` returns a settle() call to resolve, or
310
+ * false to keep listening. Registers its teardown so stop() detaches it. */
311
+ readKeys(handle) {
312
+ return new Promise((resolve) => {
313
+ const decoder = new TerminalKeyDecoder();
314
+ let flushTimer;
315
+ const detach = () => {
316
+ this.input.off('data', onData);
317
+ if (flushTimer !== undefined)
318
+ clearTimeout(flushTimer);
319
+ flushTimer = undefined;
320
+ };
321
+ this.detachers.push(detach);
322
+ const settle = (value) => { detach(); resolve(value); return true; };
323
+ const apply = (key) => handle(key, settle) === true;
324
+ const onData = (chunk) => {
325
+ if (flushTimer !== undefined)
326
+ clearTimeout(flushTimer);
327
+ flushTimer = undefined;
328
+ for (const key of decoder.decode(chunk.toString('utf8'))) {
329
+ if (apply(key))
330
+ return;
331
+ }
332
+ if (decoder.hasPending) {
333
+ flushTimer = setTimeout(() => {
334
+ for (const key of decoder.flush()) {
335
+ if (apply(key))
336
+ return;
337
+ }
338
+ }, ESCAPE_FLUSH_MS);
339
+ }
340
+ };
341
+ this.input.on('data', onData);
342
+ });
343
+ }
344
+ }
345
+ // harn:end setup-restores-terminal-on-every-exit
346
+ //# sourceMappingURL=setup-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-session.js","sourceRoot":"","sources":["../src/setup-session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GAKjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAiB,MAAM,oBAAoB,CAAC;AAEvE,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAoB/B,MAAM,UAAU,kBAAkB,CAAC,OAAsC;IACvE,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;IAC9C,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IACjD,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,O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AAO;gBACzB,CAAC;gBACD,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;oBACvB,UAAU,GAAG,UAAU,CAAC,GAAG,EAAE;wBAC3B,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;4BAClC,IAAI,KAAK,CAAC,GAAG,CAAC;gCAAE,OAAO;wBACzB,CAAC;oBACH,CAAC,EAAE,eAAe,CAAC,CAAC;gBACtB,CAAC;YACH,CAAC,CAAC;YACF,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AACD,iDAAiD"}
@@ -0,0 +1,93 @@
1
+ export type SetupStageState = 'pending' | 'running' | 'done' | 'skipped' | 'failed';
2
+ export declare const SETUP_STAGE_TITLES: readonly ["Check this computer", "Install Codor", "Where you will use Codor", "Start Codor", "Create pairing code"];
3
+ export declare const SETUP_SPINNER_FRAMES: readonly ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
4
+ export declare const MAX_SETUP_STAGE_LOGS = 6;
5
+ export declare const SETUP_CLEAR_SCREEN = "\u001B[H\u001B[J";
6
+ export declare const SETUP_CURSOR_HIDE = "\u001B[?25l";
7
+ export declare const SETUP_CURSOR_SHOW = "\u001B[?25h";
8
+ export declare const CODOR_WORD_ART: string;
9
+ export interface SetupStage {
10
+ title: string;
11
+ state: SetupStageState;
12
+ logs: string[];
13
+ /** Short muted line shown under the heading while the step is active. */
14
+ description?: string;
15
+ /** Optional note shown after a skipped step's title. */
16
+ summary?: string;
17
+ /** Failure text shown inside the active step when it has failed. */
18
+ error?: string;
19
+ }
20
+ export interface SetupAccessOption {
21
+ id: string;
22
+ label: string;
23
+ description: string;
24
+ available: boolean;
25
+ }
26
+ /** A vertical single-select choice. Enter selects the focused option directly;
27
+ * there is no separate select-then-confirm step. `canBack` drives the menu's
28
+ * own Back hint, since a live menu supplies its own navigation footer. */
29
+ export interface SetupMenu {
30
+ message: string;
31
+ options: SetupAccessOption[];
32
+ focused: number;
33
+ canBack: boolean;
34
+ }
35
+ export interface SetupSummary {
36
+ /** Headline line — "Codor is ready.", or a paused/running-only variant. */
37
+ headline: string;
38
+ /** The browser endpoint, shown only when the service is actually running. */
39
+ endpoint?: string;
40
+ harnesses: string[];
41
+ nextAction: string;
42
+ }
43
+ /** Which non-menu navigation actions the active step currently offers. A menu
44
+ * renders its own navigation hint, so controls are supplied only when the step
45
+ * is settled: a failure, a reviewed step reached by Back, or the finish. */
46
+ export interface SetupControls {
47
+ back: boolean;
48
+ forward: boolean;
49
+ retry: boolean;
50
+ finish: boolean;
51
+ }
52
+ export interface SetupFrameState {
53
+ version: string;
54
+ byline: string;
55
+ steps: SetupStage[];
56
+ /** Index of the expanded active step. */
57
+ cursor: number;
58
+ spinnerFrame: number;
59
+ viewport: {
60
+ rows: number;
61
+ columns: number;
62
+ };
63
+ menu?: SetupMenu;
64
+ controls?: SetupControls;
65
+ summary?: SetupSummary;
66
+ /** Muted "Step N of M" progress label. */
67
+ progress?: {
68
+ current: number;
69
+ total: number;
70
+ };
71
+ /** Read-only Check results carried forward as muted context. */
72
+ context?: string[];
73
+ /** A pre-rendered result block (the pairing card) shown in place of the
74
+ * active step's question. */
75
+ card?: string;
76
+ }
77
+ export declare function createSetupStages(): SetupStage[];
78
+ export declare function renderSetupFrame(state: SetupFrameState): string;
79
+ export interface PairingCardData {
80
+ code: string;
81
+ url: string;
82
+ expires: string;
83
+ qr: string;
84
+ instruction: string;
85
+ }
86
+ /** The final pairing result: a width- and height-aware bordered card. The URL
87
+ * and instruction wrap inside the border, every rendered line stays within the
88
+ * terminal width, and the QR is shown with padding only when it fits the width
89
+ * AND the available rows — otherwise it is omitted while the code, wrapped URL,
90
+ * expiry, and instruction remain. Built only from the offer, so the raw
91
+ * authority token can never be shown. */
92
+ export declare function renderPairingCard(card: PairingCardData, columns?: number, maxRows?: number): string;
93
+ //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