@dsh-cove/dsh-web-all 0.0.0-stage → 0.4.3

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 (912) hide show
  1. package/LICENSE +202 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +201 -2
  4. package/README.zh.md +202 -0
  5. package/cordis.patch.yml +59 -0
  6. package/lib/client.js +25413 -0
  7. package/lib/client.js.map +1 -0
  8. package/lib/index.js +20024 -0
  9. package/lib/invariant.js +6 -0
  10. package/lib/types/client/compat.d.ts +29 -0
  11. package/lib/types/client/compat.d.ts.map +1 -0
  12. package/lib/types/client/compat.js +69 -0
  13. package/lib/types/client/conversation/git-branch.d.ts +13 -0
  14. package/lib/types/client/conversation/git-branch.d.ts.map +1 -0
  15. package/lib/types/client/conversation/git-branch.js +121 -0
  16. package/lib/types/client/conversation/git-graph/api.d.ts +42 -0
  17. package/lib/types/client/conversation/git-graph/api.d.ts.map +1 -0
  18. package/lib/types/client/conversation/git-graph/api.js +72 -0
  19. package/lib/types/client/conversation/git-graph/branch-chip.d.ts +47 -0
  20. package/lib/types/client/conversation/git-graph/branch-chip.d.ts.map +1 -0
  21. package/lib/types/client/conversation/git-graph/branch-chip.js +268 -0
  22. package/lib/types/client/conversation/git-graph/branch-popover.d.ts +32 -0
  23. package/lib/types/client/conversation/git-graph/branch-popover.d.ts.map +1 -0
  24. package/lib/types/client/conversation/git-graph/branch-popover.js +108 -0
  25. package/lib/types/client/conversation/git-graph/chip.d.ts +24 -0
  26. package/lib/types/client/conversation/git-graph/chip.d.ts.map +1 -0
  27. package/lib/types/client/conversation/git-graph/chip.js +15 -0
  28. package/lib/types/client/conversation/git-graph/create-branch-dialog.d.ts +30 -0
  29. package/lib/types/client/conversation/git-graph/create-branch-dialog.d.ts.map +1 -0
  30. package/lib/types/client/conversation/git-graph/create-branch-dialog.js +52 -0
  31. package/lib/types/client/conversation/git-graph/error-copy.d.ts +17 -0
  32. package/lib/types/client/conversation/git-graph/error-copy.d.ts.map +1 -0
  33. package/lib/types/client/conversation/git-graph/error-copy.js +44 -0
  34. package/lib/types/client/conversation/git-graph/graph-dialog.d.ts +21 -0
  35. package/lib/types/client/conversation/git-graph/graph-dialog.d.ts.map +1 -0
  36. package/lib/types/client/conversation/git-graph/graph-dialog.js +112 -0
  37. package/lib/types/client/conversation/git-graph/hero-seat.d.ts +53 -0
  38. package/lib/types/client/conversation/git-graph/hero-seat.d.ts.map +1 -0
  39. package/lib/types/client/conversation/git-graph/hero-seat.js +54 -0
  40. package/lib/types/client/conversation/git-graph/locales.d.ts +88 -0
  41. package/lib/types/client/conversation/git-graph/locales.d.ts.map +1 -0
  42. package/lib/types/client/conversation/git-graph/locales.js +85 -0
  43. package/lib/types/client/conversation/git-graph/sse-leader.d.ts +37 -0
  44. package/lib/types/client/conversation/git-graph/sse-leader.d.ts.map +1 -0
  45. package/lib/types/client/conversation/git-graph/sse-leader.js +101 -0
  46. package/lib/types/client/conversation/index.d.ts +43 -0
  47. package/lib/types/client/conversation/index.d.ts.map +1 -0
  48. package/lib/types/client/conversation/index.js +39 -0
  49. package/lib/types/client/conversation/selector-context.d.ts +12 -0
  50. package/lib/types/client/conversation/selector-context.d.ts.map +1 -0
  51. package/lib/types/client/conversation/selector-context.js +11 -0
  52. package/lib/types/client/conversation/session-lane-chip.d.ts +72 -0
  53. package/lib/types/client/conversation/session-lane-chip.d.ts.map +1 -0
  54. package/lib/types/client/conversation/session-lane-chip.js +163 -0
  55. package/lib/types/client/conversation/session-lane-locales.d.ts +22 -0
  56. package/lib/types/client/conversation/session-lane-locales.d.ts.map +1 -0
  57. package/lib/types/client/conversation/session-lane-locales.js +29 -0
  58. package/lib/types/client/conversation/subagent-model-dom.d.ts +16 -0
  59. package/lib/types/client/conversation/subagent-model-dom.d.ts.map +1 -0
  60. package/lib/types/client/conversation/subagent-model-dom.js +138 -0
  61. package/lib/types/client/conversation/subagent-model.d.ts +17 -0
  62. package/lib/types/client/conversation/subagent-model.d.ts.map +1 -0
  63. package/lib/types/client/conversation/subagent-model.js +156 -0
  64. package/lib/types/client/conversation/worktree/api.d.ts +97 -0
  65. package/lib/types/client/conversation/worktree/api.d.ts.map +1 -0
  66. package/lib/types/client/conversation/worktree/api.js +239 -0
  67. package/lib/types/client/conversation/worktree/dialogs/DeleteWorktreeDialog.d.ts +35 -0
  68. package/lib/types/client/conversation/worktree/dialogs/DeleteWorktreeDialog.d.ts.map +1 -0
  69. package/lib/types/client/conversation/worktree/dialogs/DeleteWorktreeDialog.js +55 -0
  70. package/lib/types/client/conversation/worktree/dialogs/PrCreateDialog.d.ts +27 -0
  71. package/lib/types/client/conversation/worktree/dialogs/PrCreateDialog.d.ts.map +1 -0
  72. package/lib/types/client/conversation/worktree/dialogs/PrCreateDialog.js +49 -0
  73. package/lib/types/client/conversation/worktree/lane-binding.d.ts +46 -0
  74. package/lib/types/client/conversation/worktree/lane-binding.d.ts.map +1 -0
  75. package/lib/types/client/conversation/worktree/lane-binding.js +60 -0
  76. package/lib/types/client/conversation/worktree/lane-menu.d.ts +51 -0
  77. package/lib/types/client/conversation/worktree/lane-menu.d.ts.map +1 -0
  78. package/lib/types/client/conversation/worktree/lane-menu.js +140 -0
  79. package/lib/types/client/conversation/worktree/lane-open.d.ts +126 -0
  80. package/lib/types/client/conversation/worktree/lane-open.d.ts.map +1 -0
  81. package/lib/types/client/conversation/worktree/lane-open.js +140 -0
  82. package/lib/types/client/conversation/worktree/lane-workspace-sweeper.d.ts +79 -0
  83. package/lib/types/client/conversation/worktree/lane-workspace-sweeper.d.ts.map +1 -0
  84. package/lib/types/client/conversation/worktree/lane-workspace-sweeper.js +116 -0
  85. package/lib/types/client/conversation/worktree/lifecycle.d.ts +29 -0
  86. package/lib/types/client/conversation/worktree/lifecycle.d.ts.map +1 -0
  87. package/lib/types/client/conversation/worktree/lifecycle.js +67 -0
  88. package/lib/types/client/conversation/worktree/locales.d.ts +58 -0
  89. package/lib/types/client/conversation/worktree/locales.d.ts.map +1 -0
  90. package/lib/types/client/conversation/worktree/locales.js +86 -0
  91. package/lib/types/client/conversation/worktree/semantic.d.ts +11 -0
  92. package/lib/types/client/conversation/worktree/semantic.d.ts.map +1 -0
  93. package/lib/types/client/conversation/worktree/semantic.js +10 -0
  94. package/lib/types/client/index.d.ts +14 -0
  95. package/lib/types/client/index.d.ts.map +1 -0
  96. package/lib/types/client/index.js +45 -0
  97. package/lib/types/client/lark-inbox/i18n.d.ts +63 -0
  98. package/lib/types/client/lark-inbox/i18n.d.ts.map +1 -0
  99. package/lib/types/client/lark-inbox/i18n.js +119 -0
  100. package/lib/types/client/lark-inbox/wizard.d.ts +19 -0
  101. package/lib/types/client/lark-inbox/wizard.d.ts.map +1 -0
  102. package/lib/types/client/lark-inbox/wizard.js +158 -0
  103. package/lib/types/client/notify/i18n.d.ts +47 -0
  104. package/lib/types/client/notify/i18n.d.ts.map +1 -0
  105. package/lib/types/client/notify/i18n.js +87 -0
  106. package/lib/types/client/settings/family-scope.d.ts +23 -0
  107. package/lib/types/client/settings/family-scope.d.ts.map +1 -0
  108. package/lib/types/client/settings/family-scope.js +30 -0
  109. package/lib/types/client/settings/lark-inbox.d.ts +73 -0
  110. package/lib/types/client/settings/lark-inbox.d.ts.map +1 -0
  111. package/lib/types/client/settings/lark-inbox.js +144 -0
  112. package/lib/types/client/settings/notify.d.ts +66 -0
  113. package/lib/types/client/settings/notify.d.ts.map +1 -0
  114. package/lib/types/client/settings/notify.js +139 -0
  115. package/lib/types/client/settings/primitives-0.2.d.ts +137 -0
  116. package/lib/types/client/settings/primitives-0.2.d.ts.map +1 -0
  117. package/lib/types/client/settings/primitives-0.2.js +8 -0
  118. package/lib/types/client/sidebar/RenderBoundary.d.ts +17 -0
  119. package/lib/types/client/sidebar/RenderBoundary.d.ts.map +1 -0
  120. package/lib/types/client/sidebar/RenderBoundary.js +18 -0
  121. package/lib/types/client/sidebar/agent-browser.d.ts +9 -0
  122. package/lib/types/client/sidebar/agent-browser.d.ts.map +1 -0
  123. package/lib/types/client/sidebar/agent-browser.js +102 -0
  124. package/lib/types/client/sidebar/diff-view.d.ts +58 -0
  125. package/lib/types/client/sidebar/diff-view.d.ts.map +1 -0
  126. package/lib/types/client/sidebar/diff-view.js +223 -0
  127. package/lib/types/client/sidebar/git-workbench.d.ts +41 -0
  128. package/lib/types/client/sidebar/git-workbench.d.ts.map +1 -0
  129. package/lib/types/client/sidebar/git-workbench.js +480 -0
  130. package/lib/types/client/sidebar/icons.d.ts +9 -0
  131. package/lib/types/client/sidebar/icons.d.ts.map +1 -0
  132. package/lib/types/client/sidebar/icons.js +6 -0
  133. package/lib/types/client/sidebar/index.d.ts +19 -0
  134. package/lib/types/client/sidebar/index.d.ts.map +1 -0
  135. package/lib/types/client/sidebar/index.js +12 -0
  136. package/lib/types/client/sidebar/native-panels.d.ts +19 -0
  137. package/lib/types/client/sidebar/native-panels.d.ts.map +1 -0
  138. package/lib/types/client/sidebar/native-panels.js +103 -0
  139. package/lib/types/client/sidebar/page-shell.d.ts +52 -0
  140. package/lib/types/client/sidebar/page-shell.d.ts.map +1 -0
  141. package/lib/types/client/sidebar/page-shell.js +18 -0
  142. package/lib/types/client/sidebar/panels/memoir/api.d.ts +258 -0
  143. package/lib/types/client/sidebar/panels/memoir/api.d.ts.map +1 -0
  144. package/lib/types/client/sidebar/panels/memoir/api.js +135 -0
  145. package/lib/types/client/sidebar/panels/memoir/controller.d.ts +22 -0
  146. package/lib/types/client/sidebar/panels/memoir/controller.d.ts.map +1 -0
  147. package/lib/types/client/sidebar/panels/memoir/controller.js +38 -0
  148. package/lib/types/client/sidebar/panels/memoir/cwd.d.ts +80 -0
  149. package/lib/types/client/sidebar/panels/memoir/cwd.d.ts.map +1 -0
  150. package/lib/types/client/sidebar/panels/memoir/cwd.js +96 -0
  151. package/lib/types/client/sidebar/panels/memoir/i18n.d.ts +21 -0
  152. package/lib/types/client/sidebar/panels/memoir/i18n.d.ts.map +1 -0
  153. package/lib/types/client/sidebar/panels/memoir/i18n.js +288 -0
  154. package/lib/types/client/sidebar/panels/memoir/panel-activation.d.ts +11 -0
  155. package/lib/types/client/sidebar/panels/memoir/panel-activation.d.ts.map +1 -0
  156. package/lib/types/client/sidebar/panels/memoir/panel-activation.js +37 -0
  157. package/lib/types/client/sidebar/panels/memoir/panel.d.ts +26 -0
  158. package/lib/types/client/sidebar/panels/memoir/panel.d.ts.map +1 -0
  159. package/lib/types/client/sidebar/panels/memoir/panel.js +423 -0
  160. package/lib/types/client/sidebar/panels/memoir/styles.d.ts +22 -0
  161. package/lib/types/client/sidebar/panels/memoir/styles.d.ts.map +1 -0
  162. package/lib/types/client/sidebar/panels/memoir/styles.js +774 -0
  163. package/lib/types/client/sidebar/panels/memoir/types.d.ts +7 -0
  164. package/lib/types/client/sidebar/panels/memoir/types.d.ts.map +1 -0
  165. package/lib/types/client/sidebar/panels/memoir/types.js +5 -0
  166. package/lib/types/client/sidebar/panels/ssh/ClusterTab.d.ts +8 -0
  167. package/lib/types/client/sidebar/panels/ssh/ClusterTab.d.ts.map +1 -0
  168. package/lib/types/client/sidebar/panels/ssh/ClusterTab.js +53 -0
  169. package/lib/types/client/sidebar/panels/ssh/HostFormDialog.d.ts +13 -0
  170. package/lib/types/client/sidebar/panels/ssh/HostFormDialog.d.ts.map +1 -0
  171. package/lib/types/client/sidebar/panels/ssh/HostFormDialog.js +110 -0
  172. package/lib/types/client/sidebar/panels/ssh/HostsTab.d.ts +26 -0
  173. package/lib/types/client/sidebar/panels/ssh/HostsTab.d.ts.map +1 -0
  174. package/lib/types/client/sidebar/panels/ssh/HostsTab.js +175 -0
  175. package/lib/types/client/sidebar/panels/ssh/SshPanel.d.ts +14 -0
  176. package/lib/types/client/sidebar/panels/ssh/SshPanel.d.ts.map +1 -0
  177. package/lib/types/client/sidebar/panels/ssh/SshPanel.js +34 -0
  178. package/lib/types/client/sidebar/panels/ssh/TerminalTab.d.ts +18 -0
  179. package/lib/types/client/sidebar/panels/ssh/TerminalTab.d.ts.map +1 -0
  180. package/lib/types/client/sidebar/panels/ssh/TerminalTab.js +207 -0
  181. package/lib/types/client/sidebar/panels/ssh/TransferTab.d.ts +8 -0
  182. package/lib/types/client/sidebar/panels/ssh/TransferTab.d.ts.map +1 -0
  183. package/lib/types/client/sidebar/panels/ssh/TransferTab.js +168 -0
  184. package/lib/types/client/sidebar/panels/ssh/TunnelsTab.d.ts +18 -0
  185. package/lib/types/client/sidebar/panels/ssh/TunnelsTab.d.ts.map +1 -0
  186. package/lib/types/client/sidebar/panels/ssh/TunnelsTab.js +161 -0
  187. package/lib/types/client/sidebar/panels/ssh/api.d.ts +80 -0
  188. package/lib/types/client/sidebar/panels/ssh/api.d.ts.map +1 -0
  189. package/lib/types/client/sidebar/panels/ssh/api.js +333 -0
  190. package/lib/types/client/sidebar/panels/ssh/controller.d.ts +23 -0
  191. package/lib/types/client/sidebar/panels/ssh/controller.d.ts.map +1 -0
  192. package/lib/types/client/sidebar/panels/ssh/controller.js +41 -0
  193. package/lib/types/client/sidebar/panels/ssh/helpers.d.ts +44 -0
  194. package/lib/types/client/sidebar/panels/ssh/helpers.d.ts.map +1 -0
  195. package/lib/types/client/sidebar/panels/ssh/helpers.js +53 -0
  196. package/lib/types/client/sidebar/panels/ssh/locales.d.ts +155 -0
  197. package/lib/types/client/sidebar/panels/ssh/locales.d.ts.map +1 -0
  198. package/lib/types/client/sidebar/panels/ssh/locales.js +312 -0
  199. package/lib/types/client/sidebar/panels/ssh/xterm.css.d.ts +3 -0
  200. package/lib/types/client/sidebar/panels/ssh/xterm.css.d.ts.map +1 -0
  201. package/lib/types/client/sidebar/panels/ssh/xterm.css.js +2 -0
  202. package/lib/types/client/sidebar/right-pane-i18n.d.ts +121 -0
  203. package/lib/types/client/sidebar/right-pane-i18n.d.ts.map +1 -0
  204. package/lib/types/client/sidebar/right-pane-i18n.js +239 -0
  205. package/lib/types/client/sidebar/right-pane.d.ts +27 -0
  206. package/lib/types/client/sidebar/right-pane.d.ts.map +1 -0
  207. package/lib/types/client/sidebar/right-pane.js +112 -0
  208. package/lib/types/client/sidebar/scope.d.ts +17 -0
  209. package/lib/types/client/sidebar/scope.d.ts.map +1 -0
  210. package/lib/types/client/sidebar/scope.js +41 -0
  211. package/lib/types/client/trust.d.ts +78 -0
  212. package/lib/types/client/trust.d.ts.map +1 -0
  213. package/lib/types/client/trust.js +130 -0
  214. package/lib/types/client/ui-icons.d.ts +19 -0
  215. package/lib/types/client/ui-icons.d.ts.map +1 -0
  216. package/lib/types/client/ui-icons.js +33 -0
  217. package/lib/types/core/git-graph/commands.d.ts +36 -0
  218. package/lib/types/core/git-graph/commands.d.ts.map +1 -0
  219. package/lib/types/core/git-graph/commands.js +122 -0
  220. package/lib/types/core/git-graph/protocol.d.ts +104 -0
  221. package/lib/types/core/git-graph/protocol.d.ts.map +1 -0
  222. package/lib/types/core/git-graph/protocol.js +142 -0
  223. package/lib/types/core/index.d.ts +3 -0
  224. package/lib/types/core/index.d.ts.map +1 -0
  225. package/lib/types/core/index.js +2 -0
  226. package/lib/types/core/lark-inbox/gating.d.ts +21 -0
  227. package/lib/types/core/lark-inbox/gating.d.ts.map +1 -0
  228. package/lib/types/core/lark-inbox/gating.js +17 -0
  229. package/lib/types/core/lark-inbox/queue.d.ts +27 -0
  230. package/lib/types/core/lark-inbox/queue.d.ts.map +1 -0
  231. package/lib/types/core/lark-inbox/queue.js +78 -0
  232. package/lib/types/core/memoir/protocol.d.ts +42 -0
  233. package/lib/types/core/memoir/protocol.d.ts.map +1 -0
  234. package/lib/types/core/memoir/protocol.js +8 -0
  235. package/lib/types/core/no-browser-auth/contract.d.ts +22 -0
  236. package/lib/types/core/no-browser-auth/contract.d.ts.map +1 -0
  237. package/lib/types/core/no-browser-auth/contract.js +9 -0
  238. package/lib/types/core/notify/contract.d.ts +133 -0
  239. package/lib/types/core/notify/contract.d.ts.map +1 -0
  240. package/lib/types/core/notify/contract.js +186 -0
  241. package/lib/types/core/notify/feed.d.ts +116 -0
  242. package/lib/types/core/notify/feed.d.ts.map +1 -0
  243. package/lib/types/core/notify/feed.js +214 -0
  244. package/lib/types/core/playwright-sessions/contracts.d.ts +98 -0
  245. package/lib/types/core/playwright-sessions/contracts.d.ts.map +1 -0
  246. package/lib/types/core/playwright-sessions/contracts.js +68 -0
  247. package/lib/types/core/playwright-sessions/control.d.ts +19 -0
  248. package/lib/types/core/playwright-sessions/control.d.ts.map +1 -0
  249. package/lib/types/core/playwright-sessions/control.js +9 -0
  250. package/lib/types/core/playwright-sessions/index.d.ts +4 -0
  251. package/lib/types/core/playwright-sessions/index.d.ts.map +1 -0
  252. package/lib/types/core/playwright-sessions/index.js +3 -0
  253. package/lib/types/core/playwright-sessions/names.d.ts +4 -0
  254. package/lib/types/core/playwright-sessions/names.d.ts.map +1 -0
  255. package/lib/types/core/playwright-sessions/names.js +84 -0
  256. package/lib/types/core/playwright-sessions/schema.d.ts +4 -0
  257. package/lib/types/core/playwright-sessions/schema.d.ts.map +1 -0
  258. package/lib/types/core/playwright-sessions/schema.js +90 -0
  259. package/lib/types/core/playwright-sessions/wire.d.ts +78 -0
  260. package/lib/types/core/playwright-sessions/wire.d.ts.map +1 -0
  261. package/lib/types/core/playwright-sessions/wire.js +103 -0
  262. package/lib/types/core/remote-access/paths.d.ts +19 -0
  263. package/lib/types/core/remote-access/paths.d.ts.map +1 -0
  264. package/lib/types/core/remote-access/paths.js +18 -0
  265. package/lib/types/core/remote-web-ui/security.d.ts +35 -0
  266. package/lib/types/core/remote-web-ui/security.d.ts.map +1 -0
  267. package/lib/types/core/remote-web-ui/security.js +146 -0
  268. package/lib/types/core/right-pane/protocol.d.ts +25 -0
  269. package/lib/types/core/right-pane/protocol.d.ts.map +1 -0
  270. package/lib/types/core/right-pane/protocol.js +91 -0
  271. package/lib/types/core/schedule-mode/index.d.ts +7 -0
  272. package/lib/types/core/schedule-mode/index.d.ts.map +1 -0
  273. package/lib/types/core/schedule-mode/index.js +6 -0
  274. package/lib/types/core/schedule-mode/native.d.ts +35 -0
  275. package/lib/types/core/schedule-mode/native.d.ts.map +1 -0
  276. package/lib/types/core/schedule-mode/native.js +82 -0
  277. package/lib/types/core/schedule-mode/types.d.ts +177 -0
  278. package/lib/types/core/schedule-mode/types.d.ts.map +1 -0
  279. package/lib/types/core/schedule-mode/types.js +65 -0
  280. package/lib/types/core/schedule-mode/view.d.ts +62 -0
  281. package/lib/types/core/schedule-mode/view.d.ts.map +1 -0
  282. package/lib/types/core/schedule-mode/view.js +4 -0
  283. package/lib/types/core/ssh/protocol.d.ts +215 -0
  284. package/lib/types/core/ssh/protocol.d.ts.map +1 -0
  285. package/lib/types/core/ssh/protocol.js +23 -0
  286. package/lib/types/core/subagent-model/badges.d.ts +73 -0
  287. package/lib/types/core/subagent-model/badges.d.ts.map +1 -0
  288. package/lib/types/core/subagent-model/badges.js +105 -0
  289. package/lib/types/core/subagent-model/model-resolver.d.ts +25 -0
  290. package/lib/types/core/subagent-model/model-resolver.d.ts.map +1 -0
  291. package/lib/types/core/subagent-model/model-resolver.js +60 -0
  292. package/lib/types/core/worktree/invariant.d.ts +62 -0
  293. package/lib/types/core/worktree/invariant.d.ts.map +1 -0
  294. package/lib/types/core/worktree/invariant.js +72 -0
  295. package/lib/types/core/worktree/manifest.d.ts +71 -0
  296. package/lib/types/core/worktree/manifest.d.ts.map +1 -0
  297. package/lib/types/core/worktree/manifest.js +98 -0
  298. package/lib/types/core/worktree/paths.d.ts +60 -0
  299. package/lib/types/core/worktree/paths.d.ts.map +1 -0
  300. package/lib/types/core/worktree/paths.js +118 -0
  301. package/lib/types/core/worktree/pr-create.d.ts +67 -0
  302. package/lib/types/core/worktree/pr-create.d.ts.map +1 -0
  303. package/lib/types/core/worktree/pr-create.js +118 -0
  304. package/lib/types/core/worktree/protocol.d.ts +7 -0
  305. package/lib/types/core/worktree/protocol.d.ts.map +1 -0
  306. package/lib/types/core/worktree/protocol.js +6 -0
  307. package/lib/types/core/worktree/types.d.ts +292 -0
  308. package/lib/types/core/worktree/types.d.ts.map +1 -0
  309. package/lib/types/core/worktree/types.js +14 -0
  310. package/lib/types/core/worktree/workspace-model.d.ts +56 -0
  311. package/lib/types/core/worktree/workspace-model.d.ts.map +1 -0
  312. package/lib/types/core/worktree/workspace-model.js +14 -0
  313. package/lib/types/host/services/access-trust/index.d.ts +54 -0
  314. package/lib/types/host/services/access-trust/index.d.ts.map +1 -0
  315. package/lib/types/host/services/access-trust/index.js +82 -0
  316. package/lib/types/host/services/access-trust/trust.d.ts +70 -0
  317. package/lib/types/host/services/access-trust/trust.d.ts.map +1 -0
  318. package/lib/types/host/services/access-trust/trust.js +187 -0
  319. package/lib/types/host/services/codex-bridge/bridge.d.ts +106 -0
  320. package/lib/types/host/services/codex-bridge/bridge.d.ts.map +1 -0
  321. package/lib/types/host/services/codex-bridge/bridge.js +321 -0
  322. package/lib/types/host/services/codex-bridge/codex-auth.d.ts +108 -0
  323. package/lib/types/host/services/codex-bridge/codex-auth.d.ts.map +1 -0
  324. package/lib/types/host/services/codex-bridge/codex-auth.js +241 -0
  325. package/lib/types/host/services/codex-bridge/dsh-integration.d.ts +58 -0
  326. package/lib/types/host/services/codex-bridge/dsh-integration.d.ts.map +1 -0
  327. package/lib/types/host/services/codex-bridge/dsh-integration.js +120 -0
  328. package/lib/types/host/services/codex-bridge/http.d.ts +43 -0
  329. package/lib/types/host/services/codex-bridge/http.d.ts.map +1 -0
  330. package/lib/types/host/services/codex-bridge/http.js +92 -0
  331. package/lib/types/host/services/codex-bridge/index.d.ts +63 -0
  332. package/lib/types/host/services/codex-bridge/index.d.ts.map +1 -0
  333. package/lib/types/host/services/codex-bridge/index.js +111 -0
  334. package/lib/types/host/services/codex-bridge/loopback.d.ts +25 -0
  335. package/lib/types/host/services/codex-bridge/loopback.d.ts.map +1 -0
  336. package/lib/types/host/services/codex-bridge/loopback.js +68 -0
  337. package/lib/types/host/services/codex-bridge/routes.d.ts +31 -0
  338. package/lib/types/host/services/codex-bridge/routes.d.ts.map +1 -0
  339. package/lib/types/host/services/codex-bridge/routes.js +126 -0
  340. package/lib/types/host/services/family-config.d.ts +71 -0
  341. package/lib/types/host/services/family-config.d.ts.map +1 -0
  342. package/lib/types/host/services/family-config.js +166 -0
  343. package/lib/types/host/services/family-namespaces.d.ts +24 -0
  344. package/lib/types/host/services/family-namespaces.d.ts.map +1 -0
  345. package/lib/types/host/services/family-namespaces.js +30 -0
  346. package/lib/types/host/services/git-graph/index.d.ts +6 -0
  347. package/lib/types/host/services/git-graph/index.d.ts.map +1 -0
  348. package/lib/types/host/services/git-graph/index.js +7 -0
  349. package/lib/types/host/services/git-graph/routes.d.ts +4 -0
  350. package/lib/types/host/services/git-graph/routes.d.ts.map +1 -0
  351. package/lib/types/host/services/git-graph/routes.js +241 -0
  352. package/lib/types/host/services/git-graph/service.d.ts +52 -0
  353. package/lib/types/host/services/git-graph/service.d.ts.map +1 -0
  354. package/lib/types/host/services/git-graph/service.js +301 -0
  355. package/lib/types/host/services/index.d.ts +23 -0
  356. package/lib/types/host/services/index.d.ts.map +1 -0
  357. package/lib/types/host/services/index.js +80 -0
  358. package/lib/types/host/services/lark-inbox/config.d.ts +24 -0
  359. package/lib/types/host/services/lark-inbox/config.d.ts.map +1 -0
  360. package/lib/types/host/services/lark-inbox/config.js +48 -0
  361. package/lib/types/host/services/lark-inbox/gateway.d.ts +53 -0
  362. package/lib/types/host/services/lark-inbox/gateway.d.ts.map +1 -0
  363. package/lib/types/host/services/lark-inbox/gateway.js +171 -0
  364. package/lib/types/host/services/lark-inbox/host-routes.d.ts +22 -0
  365. package/lib/types/host/services/lark-inbox/host-routes.d.ts.map +1 -0
  366. package/lib/types/host/services/lark-inbox/host-routes.js +146 -0
  367. package/lib/types/host/services/lark-inbox/inbox-store.d.ts +39 -0
  368. package/lib/types/host/services/lark-inbox/inbox-store.d.ts.map +1 -0
  369. package/lib/types/host/services/lark-inbox/inbox-store.js +124 -0
  370. package/lib/types/host/services/lark-inbox/index.d.ts +26 -0
  371. package/lib/types/host/services/lark-inbox/index.d.ts.map +1 -0
  372. package/lib/types/host/services/lark-inbox/index.js +135 -0
  373. package/lib/types/host/services/lark-inbox/tools.d.ts +7 -0
  374. package/lib/types/host/services/lark-inbox/tools.d.ts.map +1 -0
  375. package/lib/types/host/services/lark-inbox/tools.js +119 -0
  376. package/lib/types/host/services/lark-inbox/wizard.d.ts +62 -0
  377. package/lib/types/host/services/lark-inbox/wizard.d.ts.map +1 -0
  378. package/lib/types/host/services/lark-inbox/wizard.js +211 -0
  379. package/lib/types/host/services/lifecycle.d.ts +29 -0
  380. package/lib/types/host/services/lifecycle.d.ts.map +1 -0
  381. package/lib/types/host/services/lifecycle.js +93 -0
  382. package/lib/types/host/services/memoir/index.d.ts +40 -0
  383. package/lib/types/host/services/memoir/index.d.ts.map +1 -0
  384. package/lib/types/host/services/memoir/index.js +52 -0
  385. package/lib/types/host/services/memoir/routes.d.ts +30 -0
  386. package/lib/types/host/services/memoir/routes.d.ts.map +1 -0
  387. package/lib/types/host/services/memoir/routes.js +364 -0
  388. package/lib/types/host/services/memoir/settings.d.ts +27 -0
  389. package/lib/types/host/services/memoir/settings.d.ts.map +1 -0
  390. package/lib/types/host/services/memoir/settings.js +120 -0
  391. package/lib/types/host/services/memoir/store.d.ts +35 -0
  392. package/lib/types/host/services/memoir/store.d.ts.map +1 -0
  393. package/lib/types/host/services/memoir/store.js +124 -0
  394. package/lib/types/host/services/memoir/tools.d.ts +8 -0
  395. package/lib/types/host/services/memoir/tools.d.ts.map +1 -0
  396. package/lib/types/host/services/memoir/tools.js +154 -0
  397. package/lib/types/host/services/no-browser-auth/index.d.ts +25 -0
  398. package/lib/types/host/services/no-browser-auth/index.d.ts.map +1 -0
  399. package/lib/types/host/services/no-browser-auth/index.js +42 -0
  400. package/lib/types/host/services/notify/config.d.ts +105 -0
  401. package/lib/types/host/services/notify/config.d.ts.map +1 -0
  402. package/lib/types/host/services/notify/config.js +123 -0
  403. package/lib/types/host/services/notify/feishu-sender.d.ts +120 -0
  404. package/lib/types/host/services/notify/feishu-sender.d.ts.map +1 -0
  405. package/lib/types/host/services/notify/feishu-sender.js +186 -0
  406. package/lib/types/host/services/notify/host-routes.d.ts +69 -0
  407. package/lib/types/host/services/notify/host-routes.d.ts.map +1 -0
  408. package/lib/types/host/services/notify/host-routes.js +112 -0
  409. package/lib/types/host/services/notify/index.d.ts +80 -0
  410. package/lib/types/host/services/notify/index.d.ts.map +1 -0
  411. package/lib/types/host/services/notify/index.js +263 -0
  412. package/lib/types/host/services/playwright-sessions/child.d.ts +76 -0
  413. package/lib/types/host/services/playwright-sessions/child.d.ts.map +1 -0
  414. package/lib/types/host/services/playwright-sessions/child.js +197 -0
  415. package/lib/types/host/services/playwright-sessions/controller.d.ts +25 -0
  416. package/lib/types/host/services/playwright-sessions/controller.d.ts.map +1 -0
  417. package/lib/types/host/services/playwright-sessions/controller.js +104 -0
  418. package/lib/types/host/services/playwright-sessions/index.d.ts +6 -0
  419. package/lib/types/host/services/playwright-sessions/index.d.ts.map +1 -0
  420. package/lib/types/host/services/playwright-sessions/index.js +161 -0
  421. package/lib/types/host/services/playwright-sessions/live-view.d.ts +32 -0
  422. package/lib/types/host/services/playwright-sessions/live-view.d.ts.map +1 -0
  423. package/lib/types/host/services/playwright-sessions/live-view.js +188 -0
  424. package/lib/types/host/services/playwright-sessions/manager.d.ts +87 -0
  425. package/lib/types/host/services/playwright-sessions/manager.d.ts.map +1 -0
  426. package/lib/types/host/services/playwright-sessions/manager.js +203 -0
  427. package/lib/types/host/services/playwright-sessions/profile-gc.d.ts +39 -0
  428. package/lib/types/host/services/playwright-sessions/profile-gc.d.ts.map +1 -0
  429. package/lib/types/host/services/playwright-sessions/profile-gc.js +72 -0
  430. package/lib/types/host/services/playwright-sessions/routes.d.ts +18 -0
  431. package/lib/types/host/services/playwright-sessions/routes.d.ts.map +1 -0
  432. package/lib/types/host/services/playwright-sessions/routes.js +87 -0
  433. package/lib/types/host/services/remote-access/boot-scripts.d.ts +55 -0
  434. package/lib/types/host/services/remote-access/boot-scripts.d.ts.map +1 -0
  435. package/lib/types/host/services/remote-access/boot-scripts.js +109 -0
  436. package/lib/types/host/services/remote-access/index.d.ts +28 -0
  437. package/lib/types/host/services/remote-access/index.d.ts.map +1 -0
  438. package/lib/types/host/services/remote-access/index.js +47 -0
  439. package/lib/types/host/services/remote-access/routes.d.ts +42 -0
  440. package/lib/types/host/services/remote-access/routes.d.ts.map +1 -0
  441. package/lib/types/host/services/remote-access/routes.js +119 -0
  442. package/lib/types/host/services/remote-web-ui/index.d.ts +21 -0
  443. package/lib/types/host/services/remote-web-ui/index.d.ts.map +1 -0
  444. package/lib/types/host/services/remote-web-ui/index.js +325 -0
  445. package/lib/types/host/services/remote-web-ui/server-mode/accounts.d.ts +115 -0
  446. package/lib/types/host/services/remote-web-ui/server-mode/accounts.d.ts.map +1 -0
  447. package/lib/types/host/services/remote-web-ui/server-mode/accounts.js +396 -0
  448. package/lib/types/host/services/remote-web-ui/server-mode/cookie.d.ts +28 -0
  449. package/lib/types/host/services/remote-web-ui/server-mode/cookie.d.ts.map +1 -0
  450. package/lib/types/host/services/remote-web-ui/server-mode/cookie.js +48 -0
  451. package/lib/types/host/services/remote-web-ui/server-mode/dsh-home.d.ts +17 -0
  452. package/lib/types/host/services/remote-web-ui/server-mode/dsh-home.d.ts.map +1 -0
  453. package/lib/types/host/services/remote-web-ui/server-mode/dsh-home.js +40 -0
  454. package/lib/types/host/services/remote-web-ui/server-mode/external-auth.d.ts +73 -0
  455. package/lib/types/host/services/remote-web-ui/server-mode/external-auth.d.ts.map +1 -0
  456. package/lib/types/host/services/remote-web-ui/server-mode/external-auth.js +242 -0
  457. package/lib/types/host/services/remote-web-ui/server-mode/fence.d.ts +23 -0
  458. package/lib/types/host/services/remote-web-ui/server-mode/fence.d.ts.map +1 -0
  459. package/lib/types/host/services/remote-web-ui/server-mode/fence.js +24 -0
  460. package/lib/types/host/services/remote-web-ui/server-mode/gateway-routes.d.ts +89 -0
  461. package/lib/types/host/services/remote-web-ui/server-mode/gateway-routes.d.ts.map +1 -0
  462. package/lib/types/host/services/remote-web-ui/server-mode/gateway-routes.js +768 -0
  463. package/lib/types/host/services/remote-web-ui/server-mode/gateway.d.ts +99 -0
  464. package/lib/types/host/services/remote-web-ui/server-mode/gateway.d.ts.map +1 -0
  465. package/lib/types/host/services/remote-web-ui/server-mode/gateway.js +679 -0
  466. package/lib/types/host/services/remote-web-ui/server-mode/http.d.ts +43 -0
  467. package/lib/types/host/services/remote-web-ui/server-mode/http.d.ts.map +1 -0
  468. package/lib/types/host/services/remote-web-ui/server-mode/http.js +92 -0
  469. package/lib/types/host/services/remote-web-ui/server-mode/integrated-auth.d.ts +42 -0
  470. package/lib/types/host/services/remote-web-ui/server-mode/integrated-auth.d.ts.map +1 -0
  471. package/lib/types/host/services/remote-web-ui/server-mode/integrated-auth.js +73 -0
  472. package/lib/types/host/services/remote-web-ui/server-mode/lan.d.ts +13 -0
  473. package/lib/types/host/services/remote-web-ui/server-mode/lan.d.ts.map +1 -0
  474. package/lib/types/host/services/remote-web-ui/server-mode/lan.js +17 -0
  475. package/lib/types/host/services/remote-web-ui/server-mode/loopback.d.ts +25 -0
  476. package/lib/types/host/services/remote-web-ui/server-mode/loopback.d.ts.map +1 -0
  477. package/lib/types/host/services/remote-web-ui/server-mode/loopback.js +68 -0
  478. package/lib/types/host/services/remote-web-ui/server-mode/posture.d.ts +75 -0
  479. package/lib/types/host/services/remote-web-ui/server-mode/posture.d.ts.map +1 -0
  480. package/lib/types/host/services/remote-web-ui/server-mode/posture.js +116 -0
  481. package/lib/types/host/services/remote-web-ui/server-mode/roles.d.ts +44 -0
  482. package/lib/types/host/services/remote-web-ui/server-mode/roles.d.ts.map +1 -0
  483. package/lib/types/host/services/remote-web-ui/server-mode/roles.js +47 -0
  484. package/lib/types/host/services/remote-web-ui/server-mode/server-boot.d.ts +21 -0
  485. package/lib/types/host/services/remote-web-ui/server-mode/server-boot.d.ts.map +1 -0
  486. package/lib/types/host/services/remote-web-ui/server-mode/server-boot.js +37 -0
  487. package/lib/types/host/services/remote-web-ui/server-mode/sessions.d.ts +111 -0
  488. package/lib/types/host/services/remote-web-ui/server-mode/sessions.d.ts.map +1 -0
  489. package/lib/types/host/services/remote-web-ui/server-mode/sessions.js +298 -0
  490. package/lib/types/host/services/remote-web-ui/server.d.ts +82 -0
  491. package/lib/types/host/services/remote-web-ui/server.d.ts.map +1 -0
  492. package/lib/types/host/services/remote-web-ui/server.js +492 -0
  493. package/lib/types/host/services/resources.d.ts +9 -0
  494. package/lib/types/host/services/resources.d.ts.map +1 -0
  495. package/lib/types/host/services/resources.js +98 -0
  496. package/lib/types/host/services/right-pane/browser.d.ts +42 -0
  497. package/lib/types/host/services/right-pane/browser.d.ts.map +1 -0
  498. package/lib/types/host/services/right-pane/browser.js +106 -0
  499. package/lib/types/host/services/right-pane/index.d.ts +22 -0
  500. package/lib/types/host/services/right-pane/index.d.ts.map +1 -0
  501. package/lib/types/host/services/right-pane/index.js +114 -0
  502. package/lib/types/host/services/right-pane/wire.d.ts +6 -0
  503. package/lib/types/host/services/right-pane/wire.d.ts.map +1 -0
  504. package/lib/types/host/services/right-pane/wire.js +9 -0
  505. package/lib/types/host/services/schedule-mode/config.d.ts +11 -0
  506. package/lib/types/host/services/schedule-mode/config.d.ts.map +1 -0
  507. package/lib/types/host/services/schedule-mode/config.js +15 -0
  508. package/lib/types/host/services/schedule-mode/engine.d.ts +150 -0
  509. package/lib/types/host/services/schedule-mode/engine.d.ts.map +1 -0
  510. package/lib/types/host/services/schedule-mode/engine.js +672 -0
  511. package/lib/types/host/services/schedule-mode/index.d.ts +33 -0
  512. package/lib/types/host/services/schedule-mode/index.d.ts.map +1 -0
  513. package/lib/types/host/services/schedule-mode/index.js +175 -0
  514. package/lib/types/host/services/schedule-mode/routes.d.ts +31 -0
  515. package/lib/types/host/services/schedule-mode/routes.d.ts.map +1 -0
  516. package/lib/types/host/services/schedule-mode/routes.js +109 -0
  517. package/lib/types/host/services/schedule-mode/session-create.d.ts +27 -0
  518. package/lib/types/host/services/schedule-mode/session-create.d.ts.map +1 -0
  519. package/lib/types/host/services/schedule-mode/session-create.js +21 -0
  520. package/lib/types/host/services/schedule-mode/store.d.ts +36 -0
  521. package/lib/types/host/services/schedule-mode/store.d.ts.map +1 -0
  522. package/lib/types/host/services/schedule-mode/store.js +309 -0
  523. package/lib/types/host/services/schedule-mode/tools.d.ts +13 -0
  524. package/lib/types/host/services/schedule-mode/tools.d.ts.map +1 -0
  525. package/lib/types/host/services/schedule-mode/tools.js +132 -0
  526. package/lib/types/host/services/ssh/engine.d.ts +162 -0
  527. package/lib/types/host/services/ssh/engine.d.ts.map +1 -0
  528. package/lib/types/host/services/ssh/engine.js +699 -0
  529. package/lib/types/host/services/ssh/host-keys.d.ts +10 -0
  530. package/lib/types/host/services/ssh/host-keys.d.ts.map +1 -0
  531. package/lib/types/host/services/ssh/host-keys.js +108 -0
  532. package/lib/types/host/services/ssh/index.d.ts +38 -0
  533. package/lib/types/host/services/ssh/index.d.ts.map +1 -0
  534. package/lib/types/host/services/ssh/index.js +47 -0
  535. package/lib/types/host/services/ssh/routes.d.ts +29 -0
  536. package/lib/types/host/services/ssh/routes.d.ts.map +1 -0
  537. package/lib/types/host/services/ssh/routes.js +465 -0
  538. package/lib/types/host/services/ssh/store.d.ts +40 -0
  539. package/lib/types/host/services/ssh/store.d.ts.map +1 -0
  540. package/lib/types/host/services/ssh/store.js +330 -0
  541. package/lib/types/host/services/ssh/terminal-ws.d.ts +9 -0
  542. package/lib/types/host/services/ssh/terminal-ws.d.ts.map +1 -0
  543. package/lib/types/host/services/ssh/terminal-ws.js +142 -0
  544. package/lib/types/host/services/ssh/tools.d.ts +11 -0
  545. package/lib/types/host/services/ssh/tools.d.ts.map +1 -0
  546. package/lib/types/host/services/ssh/tools.js +270 -0
  547. package/lib/types/host/services/web-render/contracts.d.ts +93 -0
  548. package/lib/types/host/services/web-render/contracts.d.ts.map +1 -0
  549. package/lib/types/host/services/web-render/contracts.js +60 -0
  550. package/lib/types/host/services/web-render/index.d.ts +58 -0
  551. package/lib/types/host/services/web-render/index.d.ts.map +1 -0
  552. package/lib/types/host/services/web-render/index.js +90 -0
  553. package/lib/types/host/services/web-render/provider.d.ts +37 -0
  554. package/lib/types/host/services/web-render/provider.d.ts.map +1 -0
  555. package/lib/types/host/services/web-render/provider.js +274 -0
  556. package/lib/types/host/services/web-search-anthropic/contracts.d.ts +117 -0
  557. package/lib/types/host/services/web-search-anthropic/contracts.d.ts.map +1 -0
  558. package/lib/types/host/services/web-search-anthropic/contracts.js +90 -0
  559. package/lib/types/host/services/web-search-anthropic/index.d.ts +53 -0
  560. package/lib/types/host/services/web-search-anthropic/index.d.ts.map +1 -0
  561. package/lib/types/host/services/web-search-anthropic/index.js +123 -0
  562. package/lib/types/host/services/web-search-anthropic/provider.d.ts +101 -0
  563. package/lib/types/host/services/web-search-anthropic/provider.d.ts.map +1 -0
  564. package/lib/types/host/services/web-search-anthropic/provider.js +237 -0
  565. package/lib/types/host/services/web-search-kaon/contracts.d.ts +114 -0
  566. package/lib/types/host/services/web-search-kaon/contracts.d.ts.map +1 -0
  567. package/lib/types/host/services/web-search-kaon/contracts.js +73 -0
  568. package/lib/types/host/services/web-search-kaon/index.d.ts +50 -0
  569. package/lib/types/host/services/web-search-kaon/index.d.ts.map +1 -0
  570. package/lib/types/host/services/web-search-kaon/index.js +114 -0
  571. package/lib/types/host/services/web-search-kaon/provider.d.ts +111 -0
  572. package/lib/types/host/services/web-search-kaon/provider.d.ts.map +1 -0
  573. package/lib/types/host/services/web-search-kaon/provider.js +244 -0
  574. package/lib/types/host/services/worktree/git-runner.d.ts +82 -0
  575. package/lib/types/host/services/worktree/git-runner.d.ts.map +1 -0
  576. package/lib/types/host/services/worktree/git-runner.js +81 -0
  577. package/lib/types/host/services/worktree/git.d.ts +94 -0
  578. package/lib/types/host/services/worktree/git.d.ts.map +1 -0
  579. package/lib/types/host/services/worktree/git.js +153 -0
  580. package/lib/types/host/services/worktree/http.d.ts +12 -0
  581. package/lib/types/host/services/worktree/http.d.ts.map +1 -0
  582. package/lib/types/host/services/worktree/http.js +34 -0
  583. package/lib/types/host/services/worktree/index.d.ts +38 -0
  584. package/lib/types/host/services/worktree/index.d.ts.map +1 -0
  585. package/lib/types/host/services/worktree/index.js +78 -0
  586. package/lib/types/host/services/worktree/lane-tool.d.ts +22 -0
  587. package/lib/types/host/services/worktree/lane-tool.d.ts.map +1 -0
  588. package/lib/types/host/services/worktree/lane-tool.js +92 -0
  589. package/lib/types/host/services/worktree/manager.d.ts +410 -0
  590. package/lib/types/host/services/worktree/manager.d.ts.map +1 -0
  591. package/lib/types/host/services/worktree/manager.js +1485 -0
  592. package/lib/types/host/services/worktree/model-override.d.ts +20 -0
  593. package/lib/types/host/services/worktree/model-override.d.ts.map +1 -0
  594. package/lib/types/host/services/worktree/model-override.js +35 -0
  595. package/lib/types/host/services/worktree/routes.d.ts +50 -0
  596. package/lib/types/host/services/worktree/routes.d.ts.map +1 -0
  597. package/lib/types/host/services/worktree/routes.js +695 -0
  598. package/lib/types/host/services/worktree/run-command.d.ts +26 -0
  599. package/lib/types/host/services/worktree/run-command.d.ts.map +1 -0
  600. package/lib/types/host/services/worktree/run-command.js +36 -0
  601. package/lib/types/host/services/worktree/session-lane/manager.d.ts +109 -0
  602. package/lib/types/host/services/worktree/session-lane/manager.d.ts.map +1 -0
  603. package/lib/types/host/services/worktree/session-lane/manager.js +172 -0
  604. package/lib/types/host/services/worktree/workspace-model-routes.d.ts +21 -0
  605. package/lib/types/host/services/worktree/workspace-model-routes.d.ts.map +1 -0
  606. package/lib/types/host/services/worktree/workspace-model-routes.js +198 -0
  607. package/lib/types/host/services/worktree/workspace-model.d.ts +48 -0
  608. package/lib/types/host/services/worktree/workspace-model.d.ts.map +1 -0
  609. package/lib/types/host/services/worktree/workspace-model.js +113 -0
  610. package/lib/types/index.d.ts +47 -0
  611. package/lib/types/index.d.ts.map +1 -0
  612. package/lib/types/index.js +52 -0
  613. package/lib/types/invariant.d.ts +4 -0
  614. package/lib/types/invariant.d.ts.map +1 -0
  615. package/lib/types/invariant.js +3 -0
  616. package/package.json +153 -3
  617. package/presets/code-vibe/THIRD_PARTY_NOTICES.md +55 -0
  618. package/presets/code-vibe/skills/UPSTREAM.md +104 -0
  619. package/presets/code-vibe/skills/agent-experience/SKILL.md +15 -0
  620. package/presets/code-vibe/skills/agent-operation/SKILL.md +43 -0
  621. package/presets/code-vibe/skills/code-review/SKILL.md +45 -0
  622. package/presets/code-vibe/skills/dsh-ci-test-reliability/SKILL.md +133 -0
  623. package/presets/code-vibe/skills/dsh-ci-test-reliability/references/ci-flake-diagnosis.md +60 -0
  624. package/presets/code-vibe/skills/dsh-find-simplifications/SKILL.md +69 -0
  625. package/presets/code-vibe/skills/dsh-find-simplifications/references/historical-patterns.md +45 -0
  626. package/presets/code-vibe/skills/dsh-merging-stacked-prs/SKILL.md +129 -0
  627. package/presets/code-vibe/skills/dsh-prose-standard/SKILL.md +83 -0
  628. package/presets/code-vibe/skills/dsh-prose-standard/references/examples.md +169 -0
  629. package/presets/code-vibe/skills/dsh-speed-up-perf/SKILL.md +94 -0
  630. package/presets/code-vibe/skills/dsh-trim-cot-leakage/SKILL.md +47 -0
  631. package/presets/code-vibe/skills/dsh-trim-cot-leakage/references/examples.md +275 -0
  632. package/presets/code-vibe/skills/dsh-trim-cot-leakage/references/recall-batteries.md +52 -0
  633. package/presets/code-vibe/skills/frontend-design/SKILL.md +60 -0
  634. package/presets/code-vibe/skills/frontend-design/references/critique-format.md +35 -0
  635. package/presets/code-vibe/skills/frontend-design/references/design-standards/LOAD-MAP.md +81 -0
  636. package/presets/code-vibe/skills/frontend-design/references/design-standards/README.md +53 -0
  637. package/presets/code-vibe/skills/frontend-design/references/design-standards/anchor.md +51 -0
  638. package/presets/code-vibe/skills/frontend-design/references/design-standards/audit/ai-tells.md +59 -0
  639. package/presets/code-vibe/skills/frontend-design/references/design-standards/audit/web-interface.md +14 -0
  640. package/presets/code-vibe/skills/frontend-design/references/design-standards/change-control.md +62 -0
  641. package/presets/code-vibe/skills/frontend-design/references/design-standards/copy.md +65 -0
  642. package/presets/code-vibe/skills/frontend-design/references/design-standards/craft-knobs.md +61 -0
  643. package/presets/code-vibe/skills/frontend-design/references/design-standards/debug-playbook.md +37 -0
  644. package/presets/code-vibe/skills/frontend-design/references/design-standards/exemplars/README.md +64 -0
  645. package/presets/code-vibe/skills/frontend-design/references/design-standards/plan-architecture.checklist.json +13 -0
  646. package/presets/code-vibe/skills/frontend-design/references/design-standards/product-judgment.md +113 -0
  647. package/presets/code-vibe/skills/frontend-design/references/design-standards/system-architecture.md +108 -0
  648. package/presets/code-vibe/skills/frontend-design/references/design-standards/tokens/README.md +26 -0
  649. package/presets/code-vibe/skills/frontend-design/references/design-standards/tokens/color-roles.md +49 -0
  650. package/presets/code-vibe/skills/frontend-design/references/design-standards/tokens/motion.md +51 -0
  651. package/presets/code-vibe/skills/frontend-design/references/design-standards/tokens/scale.md +89 -0
  652. package/presets/code-vibe/skills/frontend-design/references/design-standards/ui-page-gate.md +61 -0
  653. package/presets/code-vibe/skills/frontend-design/references/design-standards/ui-surface.checklist.json +49 -0
  654. package/presets/code-vibe/skills/frontend-design/references/design-standards/ux.md +76 -0
  655. package/presets/code-vibe/skills/frontend-design/references/design-standards/visual.md +52 -0
  656. package/presets/code-vibe/skills/frontend-design/references/perceptible-path.md +27 -0
  657. package/presets/code-vibe/skills/frontend-design/references/product-package.md +80 -0
  658. package/presets/code-vibe/skills/frontend-design/references/scheme-antipatterns.md +21 -0
  659. package/presets/code-vibe/skills/quality-review/SKILL.md +57 -0
  660. package/presets/code-vibe/skills/quality-review/references/bounded-verify.md +37 -0
  661. package/presets/code-vibe/skills/quality-review/references/browser-verify.md +81 -0
  662. package/presets/code-vibe/skills/quality-review/references/evidence-contract.md +194 -0
  663. package/presets/code-vibe/skills/quality-review/references/falsify-checklist.md +44 -0
  664. package/presets/code-vibe/skills/quality-review/references/human-acceptance-pack.md +68 -0
  665. package/presets/code-vibe/skills/quality-review/references/product-regression.md +51 -0
  666. package/presets/code-vibe/skills/quality-review/references/ux-standards.md +37 -0
  667. package/presets/code-vibe/skills/quality-review/references/ux-walkthrough.md +49 -0
  668. package/presets/code-vibe/skills/quality-review/references/validation-report.md +22 -0
  669. package/presets/code-vibe/skills/quality-review/references/verification-loop.md +95 -0
  670. package/presets/code-vibe/skills/quality-review/references/version-acceptance-matrix.md +131 -0
  671. package/presets/code-vibe/skills/record-browser-gif/SKILL.md +174 -0
  672. package/presets/code-vibe/skills/record-browser-gif/scripts/encode_gif.py +337 -0
  673. package/presets/code-vibe/skills/record-browser-gif/scripts/test_encode_gif.py +103 -0
  674. package/presets/code-vibe/skills/wish-programming/SKILL.md +150 -0
  675. package/presets/code-vibe/skills/wish-programming/references/roles/arch-reviewer.md +26 -0
  676. package/presets/code-vibe/skills/wish-programming/references/roles/design-reviewer.md +32 -0
  677. package/presets/code-vibe/skills/wish-programming/references/roles/pm-reviewer.md +26 -0
  678. package/presets/code-vibe/skills/wish-programming/references/roles/qa-reviewer.md +16 -0
  679. package/presets/code-vibe/skills/wish-programming/references/roles/security-reviewer.md +16 -0
  680. package/presets/code-vibe/skills/wish-programming/references/roles/sre-reviewer.md +16 -0
  681. package/presets/code-vibe/skills/wish-programming/references/roles/ux-adversary.md +16 -0
  682. package/presets/code-vibe/skills/wish-programming/references/templates/arch.md.tpl +51 -0
  683. package/presets/code-vibe/skills/wish-programming/references/templates/brief.md.tpl +36 -0
  684. package/presets/code-vibe/skills/wish-programming/references/templates/confirmation-pack.md +54 -0
  685. package/presets/code-vibe/skills/wish-programming/references/templates/design-spec.md.tpl +49 -0
  686. package/presets/code-vibe/skills/wish-programming/references/templates/module-readme.md +37 -0
  687. package/presets/code-vibe/skills/wish-programming/references/templates/product.md.tpl +74 -0
  688. package/presets/code-vibe/skills/wish-programming/references/templates/requirements.md.tpl +31 -0
  689. package/presets/code-vibe/skills/wish-programming/references/workflow-template.md +122 -0
  690. package/presets/code-vibe/skills/wish-programming/scripts/MANIFEST.sha256 +11 -0
  691. package/presets/code-vibe/skills/wish-programming/scripts/check_spec.py +416 -0
  692. package/presets/code-vibe/skills/wish-programming/scripts/check_whitelist.py +193 -0
  693. package/presets/code-vibe/skills/wish-programming/scripts/coverage_check.py +199 -0
  694. package/presets/code-vibe/skills/wish-programming/scripts/gate-lock.sh +46 -0
  695. package/presets/code-vibe/skills/wish-programming/scripts/journey.sh +281 -0
  696. package/presets/code-vibe/skills/wish-programming/scripts/project.sh +152 -0
  697. package/presets/code-vibe/skills/wish-programming/scripts/replay.sh +65 -0
  698. package/presets/code-vibe/skills/wish-programming/scripts/scan_drift.py +79 -0
  699. package/presets/code-vibe/skills/wish-programming/scripts/verify.sh +169 -0
  700. package/presets/code-vibe/skills/wish-programming/scripts/verify_preset_budgets.py +218 -0
  701. package/presets/code-vibe/skills/wish-programming/scripts/wish.sh +150 -0
  702. package/presets/code-vibe.patch.yml +325 -0
  703. package/presets/hiopen.patch.yml +109 -0
  704. package/src/client/compat.ts +86 -0
  705. package/src/client/conversation/conversation.module.css +264 -0
  706. package/src/client/conversation/git-branch.tsx +152 -0
  707. package/src/client/conversation/git-graph/LICENSE.git-graph +202 -0
  708. package/src/client/conversation/git-graph/api.ts +85 -0
  709. package/src/client/conversation/git-graph/branch-chip.tsx +354 -0
  710. package/src/client/conversation/git-graph/branch-popover.tsx +185 -0
  711. package/src/client/conversation/git-graph/chip.tsx +47 -0
  712. package/src/client/conversation/git-graph/create-branch-dialog.tsx +108 -0
  713. package/src/client/conversation/git-graph/error-copy.ts +50 -0
  714. package/src/client/conversation/git-graph/git-graph.module.css +792 -0
  715. package/src/client/conversation/git-graph/graph-dialog.tsx +196 -0
  716. package/src/client/conversation/git-graph/hero-seat.ts +76 -0
  717. package/src/client/conversation/git-graph/locales.ts +90 -0
  718. package/src/client/conversation/git-graph/sse-leader.ts +124 -0
  719. package/src/client/conversation/index.ts +82 -0
  720. package/src/client/conversation/selector-context.tsx +24 -0
  721. package/src/client/conversation/session-lane-chip.tsx +262 -0
  722. package/src/client/conversation/session-lane-locales.ts +34 -0
  723. package/src/client/conversation/subagent-model-dom.ts +157 -0
  724. package/src/client/conversation/subagent-model.ts +198 -0
  725. package/src/client/conversation/worktree/api.ts +283 -0
  726. package/src/client/conversation/worktree/dialogs/DeleteWorktreeDialog.tsx +111 -0
  727. package/src/client/conversation/worktree/dialogs/PrCreateDialog.tsx +114 -0
  728. package/src/client/conversation/worktree/lane-binding.ts +77 -0
  729. package/src/client/conversation/worktree/lane-menu.tsx +247 -0
  730. package/src/client/conversation/worktree/lane-open.ts +204 -0
  731. package/src/client/conversation/worktree/lane-workspace-sweeper.ts +136 -0
  732. package/src/client/conversation/worktree/lifecycle.ts +75 -0
  733. package/src/client/conversation/worktree/locales.ts +97 -0
  734. package/src/client/conversation/worktree/semantic.ts +10 -0
  735. package/src/client/conversation/worktree/worktree.module.css +70 -0
  736. package/src/client/css-modules.d.ts +8 -0
  737. package/src/client/index.ts +58 -0
  738. package/src/client/lark-inbox/i18n.ts +125 -0
  739. package/src/client/lark-inbox/lark-wizard.module.css +88 -0
  740. package/src/client/lark-inbox/wizard.tsx +211 -0
  741. package/src/client/notify/i18n.ts +93 -0
  742. package/src/client/settings/family-scope.ts +45 -0
  743. package/src/client/settings/lark-inbox.tsx +319 -0
  744. package/src/client/settings/notify.tsx +288 -0
  745. package/src/client/settings/primitives-0.2.ts +148 -0
  746. package/src/client/settings/settings-shell.module.css +56 -0
  747. package/src/client/sidebar/RenderBoundary.tsx +17 -0
  748. package/src/client/sidebar/agent-browser.tsx +114 -0
  749. package/src/client/sidebar/diff-view.tsx +314 -0
  750. package/src/client/sidebar/git-workbench.tsx +700 -0
  751. package/src/client/sidebar/icons.tsx +23 -0
  752. package/src/client/sidebar/index.ts +28 -0
  753. package/src/client/sidebar/native-panels.tsx +149 -0
  754. package/src/client/sidebar/page-shell.module.css +96 -0
  755. package/src/client/sidebar/page-shell.tsx +86 -0
  756. package/src/client/sidebar/panels/memoir/api.ts +300 -0
  757. package/src/client/sidebar/panels/memoir/controller.ts +47 -0
  758. package/src/client/sidebar/panels/memoir/cwd.ts +140 -0
  759. package/src/client/sidebar/panels/memoir/i18n.ts +300 -0
  760. package/src/client/sidebar/panels/memoir/panel-activation.ts +42 -0
  761. package/src/client/sidebar/panels/memoir/panel.tsx +869 -0
  762. package/src/client/sidebar/panels/memoir/styles.ts +776 -0
  763. package/src/client/sidebar/panels/memoir/types.ts +7 -0
  764. package/src/client/sidebar/panels/ssh/ClusterTab.tsx +123 -0
  765. package/src/client/sidebar/panels/ssh/HostFormDialog.tsx +243 -0
  766. package/src/client/sidebar/panels/ssh/HostsTab.tsx +290 -0
  767. package/src/client/sidebar/panels/ssh/SshPanel.tsx +76 -0
  768. package/src/client/sidebar/panels/ssh/TerminalTab.tsx +290 -0
  769. package/src/client/sidebar/panels/ssh/TransferTab.tsx +232 -0
  770. package/src/client/sidebar/panels/ssh/TunnelsTab.tsx +204 -0
  771. package/src/client/sidebar/panels/ssh/api.ts +388 -0
  772. package/src/client/sidebar/panels/ssh/controller.ts +48 -0
  773. package/src/client/sidebar/panels/ssh/helpers.ts +70 -0
  774. package/src/client/sidebar/panels/ssh/locales.ts +318 -0
  775. package/src/client/sidebar/panels/ssh/panel.module.css +801 -0
  776. package/src/client/sidebar/panels/ssh/xterm.css.ts +2 -0
  777. package/src/client/sidebar/right-pane-i18n.ts +243 -0
  778. package/src/client/sidebar/right-pane.tsx +156 -0
  779. package/src/client/sidebar/scope.ts +54 -0
  780. package/src/client/sidebar/sidebar-header.module.css +72 -0
  781. package/src/client/sidebar/sidebar.module.css +619 -0
  782. package/src/client/trust.ts +187 -0
  783. package/src/client/ui-icons.ts +35 -0
  784. package/src/core/git-graph/commands.ts +107 -0
  785. package/src/core/git-graph/protocol.ts +238 -0
  786. package/src/core/index.ts +2 -0
  787. package/src/core/lark-inbox/gating.ts +35 -0
  788. package/src/core/lark-inbox/queue.ts +100 -0
  789. package/src/core/memoir/protocol.ts +46 -0
  790. package/src/core/no-browser-auth/contract.ts +25 -0
  791. package/src/core/notify/contract.ts +236 -0
  792. package/src/core/notify/feed.ts +235 -0
  793. package/src/core/playwright-sessions/contracts.ts +143 -0
  794. package/src/core/playwright-sessions/control.ts +33 -0
  795. package/src/core/playwright-sessions/index.ts +3 -0
  796. package/src/core/playwright-sessions/names.ts +83 -0
  797. package/src/core/playwright-sessions/schema.ts +102 -0
  798. package/src/core/playwright-sessions/wire.ts +142 -0
  799. package/src/core/remote-access/paths.ts +23 -0
  800. package/src/core/remote-web-ui/security.ts +171 -0
  801. package/src/core/right-pane/protocol.ts +94 -0
  802. package/src/core/schedule-mode/index.ts +6 -0
  803. package/src/core/schedule-mode/native.ts +105 -0
  804. package/src/core/schedule-mode/types.ts +182 -0
  805. package/src/core/schedule-mode/view.ts +66 -0
  806. package/src/core/ssh/protocol.ts +212 -0
  807. package/src/core/subagent-model/badges.ts +161 -0
  808. package/src/core/worktree/invariant.ts +101 -0
  809. package/src/core/worktree/manifest.ts +135 -0
  810. package/src/core/worktree/paths.ts +123 -0
  811. package/src/core/worktree/pr-create.ts +157 -0
  812. package/src/core/worktree/protocol.ts +7 -0
  813. package/src/core/worktree/types.ts +317 -0
  814. package/src/core/worktree/workspace-model.ts +61 -0
  815. package/src/host/services/access-trust/index.ts +127 -0
  816. package/src/host/services/access-trust/trust.ts +189 -0
  817. package/src/host/services/codex-bridge/bridge.ts +392 -0
  818. package/src/host/services/codex-bridge/codex-auth.ts +352 -0
  819. package/src/host/services/codex-bridge/dsh-integration.ts +169 -0
  820. package/src/host/services/codex-bridge/http.ts +105 -0
  821. package/src/host/services/codex-bridge/index.ts +154 -0
  822. package/src/host/services/codex-bridge/loopback.ts +63 -0
  823. package/src/host/services/codex-bridge/routes.ts +143 -0
  824. package/src/host/services/family-config.ts +224 -0
  825. package/src/host/services/family-namespaces.ts +39 -0
  826. package/src/host/services/git-graph/index.ts +11 -0
  827. package/src/host/services/git-graph/routes.ts +212 -0
  828. package/src/host/services/git-graph/service.ts +305 -0
  829. package/src/host/services/index.ts +94 -0
  830. package/src/host/services/lark-inbox/config.ts +66 -0
  831. package/src/host/services/lark-inbox/gateway.ts +184 -0
  832. package/src/host/services/lark-inbox/host-routes.ts +113 -0
  833. package/src/host/services/lark-inbox/inbox-store.ts +160 -0
  834. package/src/host/services/lark-inbox/index.ts +141 -0
  835. package/src/host/services/lark-inbox/tools.ts +124 -0
  836. package/src/host/services/lark-inbox/wizard.ts +206 -0
  837. package/src/host/services/lifecycle.ts +107 -0
  838. package/src/host/services/memoir/index.ts +80 -0
  839. package/src/host/services/memoir/routes.ts +346 -0
  840. package/src/host/services/memoir/settings.ts +122 -0
  841. package/src/host/services/memoir/store.ts +132 -0
  842. package/src/host/services/memoir/tools.ts +158 -0
  843. package/src/host/services/no-browser-auth/index.ts +70 -0
  844. package/src/host/services/notify/config.ts +178 -0
  845. package/src/host/services/notify/feishu-sender.ts +220 -0
  846. package/src/host/services/notify/host-routes.ts +133 -0
  847. package/src/host/services/notify/index.ts +305 -0
  848. package/src/host/services/playwright-sessions/child.ts +251 -0
  849. package/src/host/services/playwright-sessions/controller.ts +102 -0
  850. package/src/host/services/playwright-sessions/index.ts +146 -0
  851. package/src/host/services/playwright-sessions/live-view.ts +225 -0
  852. package/src/host/services/playwright-sessions/manager.ts +239 -0
  853. package/src/host/services/playwright-sessions/profile-gc.ts +97 -0
  854. package/src/host/services/playwright-sessions/routes.ts +90 -0
  855. package/src/host/services/remote-access/boot-scripts.ts +118 -0
  856. package/src/host/services/remote-access/index.ts +62 -0
  857. package/src/host/services/remote-access/routes.ts +137 -0
  858. package/src/host/services/remote-web-ui/index.ts +344 -0
  859. package/src/host/services/remote-web-ui/server-mode/accounts.ts +423 -0
  860. package/src/host/services/remote-web-ui/server-mode/cookie.ts +57 -0
  861. package/src/host/services/remote-web-ui/server-mode/dsh-home.ts +42 -0
  862. package/src/host/services/remote-web-ui/server-mode/external-auth.ts +296 -0
  863. package/src/host/services/remote-web-ui/server-mode/fence.ts +27 -0
  864. package/src/host/services/remote-web-ui/server-mode/gateway-routes.ts +797 -0
  865. package/src/host/services/remote-web-ui/server-mode/gateway.ts +684 -0
  866. package/src/host/services/remote-web-ui/server-mode/http.ts +105 -0
  867. package/src/host/services/remote-web-ui/server-mode/integrated-auth.ts +118 -0
  868. package/src/host/services/remote-web-ui/server-mode/lan.ts +19 -0
  869. package/src/host/services/remote-web-ui/server-mode/loopback.ts +63 -0
  870. package/src/host/services/remote-web-ui/server-mode/posture.ts +154 -0
  871. package/src/host/services/remote-web-ui/server-mode/roles.ts +51 -0
  872. package/src/host/services/remote-web-ui/server-mode/server-boot.ts +38 -0
  873. package/src/host/services/remote-web-ui/server-mode/sessions.ts +347 -0
  874. package/src/host/services/remote-web-ui/server.ts +591 -0
  875. package/src/host/services/resources.ts +78 -0
  876. package/src/host/services/right-pane/browser.ts +106 -0
  877. package/src/host/services/right-pane/index.ts +117 -0
  878. package/src/host/services/right-pane/wire.ts +10 -0
  879. package/src/host/services/schedule-mode/config.ts +26 -0
  880. package/src/host/services/schedule-mode/engine.ts +689 -0
  881. package/src/host/services/schedule-mode/index.ts +214 -0
  882. package/src/host/services/schedule-mode/routes.ts +130 -0
  883. package/src/host/services/schedule-mode/session-create.ts +36 -0
  884. package/src/host/services/schedule-mode/store.ts +304 -0
  885. package/src/host/services/schedule-mode/tools.ts +154 -0
  886. package/src/host/services/ssh/engine.ts +675 -0
  887. package/src/host/services/ssh/host-keys.ts +99 -0
  888. package/src/host/services/ssh/index.ts +84 -0
  889. package/src/host/services/ssh/routes.ts +442 -0
  890. package/src/host/services/ssh/store.ts +310 -0
  891. package/src/host/services/ssh/terminal-ws.ts +157 -0
  892. package/src/host/services/ssh/tools.ts +279 -0
  893. package/src/host/services/web-render/contracts.ts +138 -0
  894. package/src/host/services/web-render/index.ts +112 -0
  895. package/src/host/services/web-render/provider.ts +282 -0
  896. package/src/host/services/web-search-anthropic/contracts.ts +163 -0
  897. package/src/host/services/web-search-anthropic/index.ts +152 -0
  898. package/src/host/services/web-search-anthropic/provider.ts +325 -0
  899. package/src/host/services/worktree/git-runner.ts +124 -0
  900. package/src/host/services/worktree/git.ts +183 -0
  901. package/src/host/services/worktree/http.ts +36 -0
  902. package/src/host/services/worktree/index.ts +92 -0
  903. package/src/host/services/worktree/lane-tool.ts +100 -0
  904. package/src/host/services/worktree/manager.ts +1553 -0
  905. package/src/host/services/worktree/model-override.ts +43 -0
  906. package/src/host/services/worktree/routes.ts +570 -0
  907. package/src/host/services/worktree/run-command.ts +66 -0
  908. package/src/host/services/worktree/session-lane/manager.ts +228 -0
  909. package/src/host/services/worktree/workspace-model-routes.ts +156 -0
  910. package/src/host/services/worktree/workspace-model.ts +132 -0
  911. package/src/index.ts +84 -0
  912. package/src/invariant.ts +4 -0
@@ -0,0 +1,321 @@
1
+ /**
2
+ * dsh-api-proxy process management for the codex-bridge service domain.
3
+ *
4
+ * Spawns (or adopts) the standalone dsh-api-proxy node service, keeps its
5
+ * generated config.yaml in the proxy directory, and exposes health / models /
6
+ * accounts / verification probes. The client api key is minted once and
7
+ * persisted next to the config (0600), so it stays stable across restarts.
8
+ * All HTTP calls target 127.0.0.1 only.
9
+ *
10
+ * Ported verbatim from the pre-merge @dsh-cove/dsh-codex-bridge package
11
+ * (src/bridge.ts) into the dsh-web-all host services.
12
+ */
13
+ import { spawn } from 'node:child_process';
14
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
15
+ import { join } from 'node:path';
16
+ import { randomBytes } from 'node:crypto';
17
+ import { exchangeDeviceCode, idTokenIdentity, pollDeviceCode, requestDeviceCode, writeCodexAuthFile, } from "./codex-auth.js";
18
+ /** Where the proxy stores its runtime state; under $DSH_HOME by default. */
19
+ function runtimeAuthDir() {
20
+ return join(process.env.DSH_HOME ?? join(process.env.HOME ?? '/root', '.dsh'), 'dsh-api-proxy');
21
+ }
22
+ export class ApiProxyBridge {
23
+ port;
24
+ host;
25
+ authFile;
26
+ baseURL;
27
+ proxyDir;
28
+ configuredKey;
29
+ child;
30
+ adopted = false;
31
+ lastError;
32
+ loginState = { phase: 'idle' };
33
+ loginAbort;
34
+ constructor(options) {
35
+ this.proxyDir = options.proxyDir;
36
+ this.host = options.host ?? '127.0.0.1';
37
+ this.port = options.port ?? 8317;
38
+ this.authFile = options.authFile ?? '~/.codex/auth.json';
39
+ this.configuredKey = options.apiKey;
40
+ this.baseURL = `http://${this.host}:${this.port}`;
41
+ }
42
+ keyFilePath() {
43
+ return join(this.proxyDir, '.api-key');
44
+ }
45
+ /**
46
+ * Stable client api key, resolved in order: configured value, the key an
47
+ * existing (adopted) service's config.yaml carries, the persisted key file,
48
+ * or a fresh mint.
49
+ */
50
+ apiKey() {
51
+ if (this.configuredKey)
52
+ return this.configuredKey;
53
+ const fromConfig = this.readKeyFromProxyConfig();
54
+ if (fromConfig)
55
+ return fromConfig;
56
+ const keyFile = this.keyFilePath();
57
+ if (existsSync(keyFile)) {
58
+ try {
59
+ const existing = readFileSync(keyFile, 'utf8').trim();
60
+ if (existing)
61
+ return existing;
62
+ }
63
+ catch {
64
+ /* fall through to mint */
65
+ }
66
+ }
67
+ const key = `sk-${randomBytes(24).toString('hex')}`;
68
+ mkdirSync(this.proxyDir, { recursive: true });
69
+ writeFileSync(keyFile, `${key}\n`, { mode: 0o600 });
70
+ return key;
71
+ }
72
+ /** Extract the first api key from an existing dsh-api-proxy config.yaml. */
73
+ readKeyFromProxyConfig() {
74
+ const configPath = this.proxyConfigPath();
75
+ if (!existsSync(configPath))
76
+ return undefined;
77
+ try {
78
+ const text = readFileSync(configPath, 'utf8');
79
+ const match = text.match(/^\s*-\s+"(sk-[^"]+)"\s*$/m);
80
+ return match?.[1];
81
+ }
82
+ catch {
83
+ return undefined;
84
+ }
85
+ }
86
+ proxyConfigPath() {
87
+ return join(this.proxyDir, 'config.yaml');
88
+ }
89
+ /** Ensure the proxy config.yaml exists with our endpoint, the codex auth
90
+ * file, and the stable api key. */
91
+ ensureConfig() {
92
+ mkdirSync(this.proxyDir, { recursive: true });
93
+ const key = this.apiKey();
94
+ const config = {
95
+ host: this.host,
96
+ port: this.port,
97
+ 'auth-dir': runtimeAuthDir(),
98
+ 'codex-auth-file': this.authFile,
99
+ 'api-keys': [key],
100
+ 'body-limit': '200mb',
101
+ timeouts: {
102
+ 'messages-ms': 120000,
103
+ 'stream-messages-ms': 600000,
104
+ 'count-tokens-ms': 30000,
105
+ },
106
+ stats: { enabled: true },
107
+ debug: 'errors',
108
+ };
109
+ writeFileSync(this.proxyConfigPath(), toYaml(config), { mode: 0o600 });
110
+ return { key, configPath: this.proxyConfigPath() };
111
+ }
112
+ /** True when a service already answers on our endpoint (adopt mode). */
113
+ async detectExisting(signal) {
114
+ try {
115
+ const resp = await fetch(`${this.baseURL}/health`, { signal, headers: { Accept: 'application/json' } });
116
+ return resp.ok;
117
+ }
118
+ catch {
119
+ return false;
120
+ }
121
+ }
122
+ /** Spawn the proxy service and wait for /health; adopt an existing one. */
123
+ async start() {
124
+ if (this.child)
125
+ return;
126
+ if (await this.detectExisting()) {
127
+ this.adopted = true;
128
+ return;
129
+ }
130
+ const { configPath } = this.ensureConfig();
131
+ const entry = join(this.proxyDir, 'dist', 'index.js');
132
+ if (!existsSync(entry)) {
133
+ throw new Error(`dsh-api-proxy build not found at ${entry}; run npm ci && npm run build in ${this.proxyDir}`);
134
+ }
135
+ this.adopted = false;
136
+ this.lastError = undefined;
137
+ this.child = spawn(process.execPath, [entry, `--config=${configPath}`], {
138
+ cwd: this.proxyDir,
139
+ stdio: ['ignore', 'pipe', 'pipe'],
140
+ });
141
+ this.child.stdout?.on('data', () => { });
142
+ this.child.stderr?.on('data', (chunk) => {
143
+ const text = chunk.toString().trim();
144
+ if (text)
145
+ this.lastError = text;
146
+ });
147
+ this.child.on('exit', (code) => {
148
+ if (this.child) {
149
+ this.lastError = `proxy exited with code ${code}`;
150
+ this.child = undefined;
151
+ }
152
+ });
153
+ await this.waitForHealth(15_000);
154
+ }
155
+ async waitForHealth(timeoutMs) {
156
+ const startedAt = Date.now();
157
+ for (;;) {
158
+ if (await this.detectExisting())
159
+ return;
160
+ if (Date.now() - startedAt >= timeoutMs) {
161
+ throw new Error(this.lastError ?? 'proxy did not become healthy in time');
162
+ }
163
+ await new Promise((resolve) => setTimeout(resolve, 500));
164
+ }
165
+ }
166
+ /** Stop a child we spawned (adopted services are left alone). */
167
+ stop() {
168
+ if (!this.child)
169
+ return;
170
+ const child = this.child;
171
+ this.child = undefined;
172
+ child.kill('SIGTERM');
173
+ }
174
+ async restart() {
175
+ this.stop();
176
+ await new Promise((resolve) => setTimeout(resolve, 300));
177
+ await this.start();
178
+ }
179
+ /** Current device-login state. */
180
+ deviceLoginState() {
181
+ return this.loginState;
182
+ }
183
+ /**
184
+ * Start a device-code login: request the one-time code, surface it, then
185
+ * poll in the background, exchange and persist tokens on success. The
186
+ * returned grant is what the UI shows the user.
187
+ */
188
+ async startDeviceLogin(fetchImpl = fetch) {
189
+ if (this.loginState.phase === 'waiting') {
190
+ throw new Error('a device login is already in progress');
191
+ }
192
+ const grant = await requestDeviceCode(fetchImpl);
193
+ this.loginAbort = new AbortController();
194
+ this.loginState = { phase: 'waiting', grant };
195
+ void this.runDevicePoll(grant, this.loginAbort.signal, fetchImpl);
196
+ return grant;
197
+ }
198
+ async runDevicePoll(grant, signal, fetchImpl) {
199
+ try {
200
+ const success = await pollDeviceCode(grant.deviceAuthId, grant.userCode, grant.intervalSec, fetchImpl, undefined, signal);
201
+ if (!success) {
202
+ this.loginState = { ...this.loginState, phase: 'timeout' };
203
+ return;
204
+ }
205
+ const tokens = await exchangeDeviceCode(success.authorizationCode, success.codeVerifier, fetchImpl);
206
+ writeCodexAuthFile(this.authFile, tokens);
207
+ const identity = idTokenIdentity(tokens.idToken);
208
+ this.loginState = {
209
+ phase: 'success',
210
+ grant,
211
+ email: identity.email,
212
+ };
213
+ // Token file changed: force the proxy to reload (or start it).
214
+ await this.restart();
215
+ }
216
+ catch (error) {
217
+ const message = error instanceof Error ? error.message : String(error);
218
+ this.loginState = {
219
+ ...this.loginState,
220
+ phase: error instanceof DOMException && error.name === 'AbortError' ? 'cancelled' : 'failed',
221
+ error: message,
222
+ };
223
+ }
224
+ }
225
+ cancelDeviceLogin() {
226
+ this.loginAbort?.abort();
227
+ this.loginState = { ...this.loginState, phase: 'cancelled' };
228
+ }
229
+ async authedFetch(path, init) {
230
+ return fetch(`${this.baseURL}${path}`, {
231
+ ...init,
232
+ headers: { Authorization: `Bearer ${this.apiKey()}`, ...(init?.headers ?? {}) },
233
+ });
234
+ }
235
+ async listModels() {
236
+ try {
237
+ const resp = await this.authedFetch('/v1/models');
238
+ if (!resp.ok)
239
+ return [];
240
+ const data = (await resp.json());
241
+ return (data.data ?? []).map((m) => m.id).filter((id) => id !== 'gpt-reserve');
242
+ }
243
+ catch {
244
+ return [];
245
+ }
246
+ }
247
+ async accounts() {
248
+ try {
249
+ const resp = await this.authedFetch('/admin/accounts');
250
+ if (!resp.ok)
251
+ return undefined;
252
+ const data = (await resp.json());
253
+ const account = data.providers?.codex?.accounts?.[0];
254
+ return account ? { email: account.email, planType: account.planType } : undefined;
255
+ }
256
+ catch {
257
+ return undefined;
258
+ }
259
+ }
260
+ /**
261
+ * Verify the whole chain end to end: models endpoint plus one minimal
262
+ * chat completion through the codex backend.
263
+ */
264
+ async verify(model) {
265
+ const models = await this.listModels();
266
+ if (models.length === 0)
267
+ return { ok: false, error: 'no models advertised' };
268
+ const target = model ?? models[0];
269
+ const resp = await this.authedFetch('/v1/chat/completions', {
270
+ method: 'POST',
271
+ headers: { 'Content-Type': 'application/json' },
272
+ body: JSON.stringify({
273
+ model: target,
274
+ messages: [{ role: 'user', content: 'Reply with exactly: OK' }],
275
+ max_tokens: 16,
276
+ }),
277
+ });
278
+ if (!resp.ok) {
279
+ return { ok: false, model: target, error: `upstream ${resp.status}: ${(await resp.text()).slice(0, 200)}` };
280
+ }
281
+ const data = (await resp.json());
282
+ const reply = data.choices?.[0]?.message?.content;
283
+ return { ok: Boolean(reply), model: target, reply };
284
+ }
285
+ async status(auth) {
286
+ const running = Boolean(this.child) || (await this.detectExisting().catch(() => false));
287
+ const models = running ? await this.listModels() : [];
288
+ const account = running ? await this.accounts() : undefined;
289
+ return {
290
+ proxy: running ? 'running' : this.lastError ? 'failed' : 'stopped',
291
+ port: this.port,
292
+ baseURL: this.baseURL,
293
+ apiKeyConfigured: Boolean(this.apiKey()),
294
+ auth,
295
+ models,
296
+ accountEmail: account?.email,
297
+ accountPlan: account?.planType,
298
+ lastError: this.lastError,
299
+ adopted: this.adopted,
300
+ };
301
+ }
302
+ }
303
+ function toYaml(config) {
304
+ const lines = [];
305
+ lines.push(`host: "${config.host}"`);
306
+ lines.push(`port: ${config.port}`);
307
+ lines.push(`auth-dir: "${config['auth-dir']}"`);
308
+ if (config['codex-auth-file'])
309
+ lines.push(`codex-auth-file: "${config['codex-auth-file']}"`);
310
+ lines.push('api-keys:');
311
+ for (const key of config['api-keys'])
312
+ lines.push(` - "${key}"`);
313
+ lines.push(`body-limit: "${config['body-limit']}"`);
314
+ lines.push('timeouts:');
315
+ for (const [k, v] of Object.entries(config.timeouts))
316
+ lines.push(` ${k}: ${v}`);
317
+ lines.push('stats:');
318
+ lines.push(` enabled: ${config.stats.enabled}`);
319
+ lines.push(`debug: "${config.debug}"`);
320
+ return `${lines.join('\n')}\n`;
321
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Codex CLI auth primitives for the codex-bridge service domain.
3
+ *
4
+ * Pure logic, no cordis/DSH coupling: reading and checking the Codex CLI
5
+ * auth file (`~/.codex/auth.json`), the ChatGPT device-code login flow
6
+ * (usercode request, polling, PKCE token exchange), and atomic writes back
7
+ * into the auth file shape the official Codex CLI owns.
8
+ *
9
+ * Endpoints verified against openai/codex (codex-rs/login/src/device_code_auth.rs
10
+ * and server.rs): the device auth routes live under
11
+ * `{issuer}/api/accounts/deviceauth/*`, the token exchange is the standard
12
+ * `{issuer}/oauth/token` authorization-code grant with the device callback
13
+ * redirect URI.
14
+ *
15
+ * Ported verbatim from the pre-merge @dsh-cove/dsh-codex-bridge package
16
+ * (src/codex-auth.ts) into the dsh-web-all host services.
17
+ */
18
+ export declare const CODEX_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
19
+ /** Browser page where the user confirms the one-time code. */
20
+ export declare const DEVICE_VERIFICATION_URL = "https://auth.openai.com/codex/device";
21
+ /** Overall device login budget (matches the Codex CLI's 15 minutes). */
22
+ export declare const DEVICE_POLL_TIMEOUT_MS: number;
23
+ /** Shape of the Codex CLI auth file (`~/.codex/auth.json`). */
24
+ export interface CodexAuthFile {
25
+ auth_mode?: string;
26
+ OPENAI_API_KEY?: string | null;
27
+ tokens?: {
28
+ id_token?: string;
29
+ access_token?: string;
30
+ refresh_token?: string;
31
+ account_id?: string;
32
+ };
33
+ last_refresh?: string;
34
+ }
35
+ /** Result of a structural auth-file check. */
36
+ export interface CodexAuthStatus {
37
+ /** auth.json exists and parses. */
38
+ present: boolean;
39
+ /** ChatGPT-mode tokens (access + refresh) are present. */
40
+ valid: boolean;
41
+ /** Whether the access token JWT is still within its `exp` window. */
42
+ expired?: boolean;
43
+ email?: string;
44
+ planType?: string;
45
+ accountId?: string;
46
+ reason?: string;
47
+ }
48
+ /** One step of the device-code login. */
49
+ export interface DeviceCodeGrant {
50
+ deviceAuthId: string;
51
+ userCode: string;
52
+ intervalSec: number;
53
+ verificationUrl: string;
54
+ }
55
+ /** Poll result of the device-auth token endpoint. */
56
+ export interface DeviceCodeSuccess {
57
+ authorizationCode: string;
58
+ codeChallenge: string;
59
+ codeVerifier: string;
60
+ }
61
+ /** Tokens returned by the authorization-code exchange. */
62
+ export interface CodexTokens {
63
+ idToken: string;
64
+ accessToken: string;
65
+ refreshToken: string;
66
+ expiresInSec?: number;
67
+ }
68
+ /** Base64url-decode a JWT payload without verifying the signature. */
69
+ export declare function decodeJwtPayload(token: string): Record<string, unknown>;
70
+ /** Identity claims (email / plan / account id) extracted from a ChatGPT id_token. */
71
+ export declare function idTokenIdentity(idToken: string | undefined): {
72
+ email?: string;
73
+ planType?: string;
74
+ accountId?: string;
75
+ };
76
+ /** Read and structurally validate the Codex CLI auth file. */
77
+ export declare function readCodexAuthFile(filePath: string): CodexAuthFile | null;
78
+ /** Structural + expiry check of the auth file (no network). */
79
+ export declare function checkCodexAuth(filePath: string): CodexAuthStatus;
80
+ /** Request a one-time device code and the polling interval. */
81
+ export declare function requestDeviceCode(fetchImpl?: typeof fetch, clientId?: string, issuer?: string): Promise<DeviceCodeGrant>;
82
+ /**
83
+ * Poll the device-auth token endpoint until the user authorizes or the
84
+ * budget expires. Resolves to null on timeout.
85
+ */
86
+ export declare function pollDeviceCode(deviceAuthId: string, userCode: string, intervalSec: number, fetchImpl?: typeof fetch, issuer?: string, signal?: AbortSignal, timeoutMs?: number): Promise<DeviceCodeSuccess | null>;
87
+ /** Exchange the device authorization code for tokens (PKCE, form-urlencoded). */
88
+ export declare function exchangeDeviceCode(code: string, codeVerifier: string, fetchImpl?: typeof fetch, clientId?: string, issuer?: string): Promise<CodexTokens>;
89
+ /**
90
+ * Persist tokens into the Codex CLI auth.json shape, preserving unrelated
91
+ * fields and writing atomically (concurrent Codex CLI readers never see a
92
+ * partial file).
93
+ */
94
+ export declare function writeCodexAuthFile(filePath: string, tokens: CodexTokens): void;
95
+ /**
96
+ * Run the whole device-code login: request code, surface it, poll, exchange,
97
+ * persist. Returns null when the user never authorized within the budget.
98
+ */
99
+ export declare function runDeviceCodeLogin(options: {
100
+ onCode: (grant: DeviceCodeGrant) => void;
101
+ authFile: string;
102
+ signal?: AbortSignal;
103
+ fetchImpl?: typeof fetch;
104
+ }): Promise<{
105
+ tokens: CodexTokens;
106
+ email?: string;
107
+ } | null>;
108
+ //# sourceMappingURL=codex-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-auth.d.ts","sourceRoot":"","sources":["../../../../../src/host/services/codex-bridge/codex-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,eAAO,MAAM,eAAe,iCAAiC,CAAA;AAC7D,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,yCAA2B,CAAA;AAC/D,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,QAAiB,CAAA;AAKpD,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,8CAA8C;AAC9C,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,0DAA0D;IAC1D,KAAK,EAAE,OAAO,CAAA;IACd,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,MAAM,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AASD,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWvE;AAED,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAmBA;AAED,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CASxE;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAwBhE;AAED,+DAA+D;AAC/D,wBAAsB,iBAAiB,CACrC,SAAS,GAAE,OAAO,KAAa,EAC/B,QAAQ,SAAkB,EAC1B,MAAM,SAAS,GACd,OAAO,CAAC,eAAe,CAAC,CAyB1B;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,OAAO,KAAa,EAC/B,MAAM,SAAS,EACf,MAAM,CAAC,EAAE,WAAW,EACpB,SAAS,SAAyB,GACjC,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAgCnC;AAED,iFAAiF;AACjF,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,OAAO,KAAa,EAC/B,QAAQ,SAAkB,EAC1B,MAAM,SAAS,GACd,OAAO,CAAC,WAAW,CAAC,CA+BtB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,WAAW,GAClB,IAAI,CA2BN;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE;IACP,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IACxC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;CACzB,GACA,OAAO,CAAC;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAoBzD"}
@@ -0,0 +1,241 @@
1
+ /**
2
+ * Codex CLI auth primitives for the codex-bridge service domain.
3
+ *
4
+ * Pure logic, no cordis/DSH coupling: reading and checking the Codex CLI
5
+ * auth file (`~/.codex/auth.json`), the ChatGPT device-code login flow
6
+ * (usercode request, polling, PKCE token exchange), and atomic writes back
7
+ * into the auth file shape the official Codex CLI owns.
8
+ *
9
+ * Endpoints verified against openai/codex (codex-rs/login/src/device_code_auth.rs
10
+ * and server.rs): the device auth routes live under
11
+ * `{issuer}/api/accounts/deviceauth/*`, the token exchange is the standard
12
+ * `{issuer}/oauth/token` authorization-code grant with the device callback
13
+ * redirect URI.
14
+ *
15
+ * Ported verbatim from the pre-merge @dsh-cove/dsh-codex-bridge package
16
+ * (src/codex-auth.ts) into the dsh-web-all host services.
17
+ */
18
+ const ISSUER = 'https://auth.openai.com';
19
+ const TOKEN_URL = `${ISSUER}/oauth/token`;
20
+ export const CODEX_CLIENT_ID = 'app_EMoamEEZ73f0CkXaXp7hrann';
21
+ /** Browser page where the user confirms the one-time code. */
22
+ export const DEVICE_VERIFICATION_URL = `${ISSUER}/codex/device`;
23
+ /** Overall device login budget (matches the Codex CLI's 15 minutes). */
24
+ export const DEVICE_POLL_TIMEOUT_MS = 15 * 60 * 1000;
25
+ import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
26
+ import { dirname } from 'node:path';
27
+ function expandHome(p) {
28
+ if (p.startsWith('~')) {
29
+ return `${process.env.HOME ?? '/root'}${p.slice(1)}`;
30
+ }
31
+ return p;
32
+ }
33
+ /** Base64url-decode a JWT payload without verifying the signature. */
34
+ export function decodeJwtPayload(token) {
35
+ const part = token.split('.')[1];
36
+ if (!part)
37
+ return {};
38
+ const normalized = part.replace(/-/g, '+').replace(/_/g, '/');
39
+ const padded = normalized.padEnd(Math.ceil(normalized.length / 4) * 4, '=');
40
+ const raw = Buffer.from(padded, 'base64').toString('utf8');
41
+ try {
42
+ return JSON.parse(raw);
43
+ }
44
+ catch {
45
+ return {};
46
+ }
47
+ }
48
+ /** Identity claims (email / plan / account id) extracted from a ChatGPT id_token. */
49
+ export function idTokenIdentity(idToken) {
50
+ if (!idToken)
51
+ return {};
52
+ const claims = decodeJwtPayload(idToken);
53
+ const auth = (claims['https://api.openai.com/auth'] ?? {});
54
+ return {
55
+ email: typeof claims.email === 'string' ? claims.email : undefined,
56
+ planType: typeof auth.chatgpt_plan_type === 'string'
57
+ ? auth.chatgpt_plan_type
58
+ : typeof claims.chatgpt_plan_type === 'string'
59
+ ? claims.chatgpt_plan_type
60
+ : undefined,
61
+ accountId: typeof auth.chatgpt_account_id === 'string'
62
+ ? auth.chatgpt_account_id
63
+ : typeof claims.chatgpt_account_id === 'string'
64
+ ? claims.chatgpt_account_id
65
+ : undefined,
66
+ };
67
+ }
68
+ /** Read and structurally validate the Codex CLI auth file. */
69
+ export function readCodexAuthFile(filePath) {
70
+ const resolved = expandHome(filePath);
71
+ if (!existsSync(resolved))
72
+ return null;
73
+ try {
74
+ const raw = JSON.parse(readFileSync(resolved, 'utf8'));
75
+ return raw;
76
+ }
77
+ catch {
78
+ return null;
79
+ }
80
+ }
81
+ /** Structural + expiry check of the auth file (no network). */
82
+ export function checkCodexAuth(filePath) {
83
+ const raw = readCodexAuthFile(filePath);
84
+ if (!raw)
85
+ return { present: false, valid: false, reason: 'missing' };
86
+ const tokens = raw.tokens;
87
+ if (!tokens?.access_token || !tokens?.refresh_token) {
88
+ return { present: true, valid: false, reason: 'incomplete-tokens' };
89
+ }
90
+ if (raw.auth_mode && raw.auth_mode !== 'chatgpt') {
91
+ return { present: true, valid: false, reason: `auth-mode:${raw.auth_mode}` };
92
+ }
93
+ const identity = idTokenIdentity(tokens.id_token);
94
+ let expired;
95
+ const claims = decodeJwtPayload(tokens.access_token);
96
+ if (typeof claims.exp === 'number') {
97
+ expired = claims.exp * 1000 <= Date.now();
98
+ }
99
+ return {
100
+ present: true,
101
+ valid: !expired,
102
+ expired,
103
+ email: identity.email,
104
+ planType: identity.planType,
105
+ accountId: identity.accountId,
106
+ };
107
+ }
108
+ /** Request a one-time device code and the polling interval. */
109
+ export async function requestDeviceCode(fetchImpl = fetch, clientId = CODEX_CLIENT_ID, issuer = ISSUER) {
110
+ const resp = await fetchImpl(`${issuer}/api/accounts/deviceauth/usercode`, {
111
+ method: 'POST',
112
+ headers: { 'Content-Type': 'application/json' },
113
+ body: JSON.stringify({ client_id: clientId }),
114
+ });
115
+ if (!resp.ok) {
116
+ throw new Error(`device code request failed (${resp.status}): ${await resp.text()}`);
117
+ }
118
+ const data = (await resp.json());
119
+ if (!data.device_auth_id || !data.user_code) {
120
+ throw new Error('device code response missing device_auth_id or user_code');
121
+ }
122
+ const interval = Number(data.interval ?? 5);
123
+ return {
124
+ deviceAuthId: data.device_auth_id,
125
+ userCode: data.user_code,
126
+ intervalSec: Number.isFinite(interval) && interval > 0 ? interval : 5,
127
+ verificationUrl: `${issuer}/codex/device`,
128
+ };
129
+ }
130
+ /**
131
+ * Poll the device-auth token endpoint until the user authorizes or the
132
+ * budget expires. Resolves to null on timeout.
133
+ */
134
+ export async function pollDeviceCode(deviceAuthId, userCode, intervalSec, fetchImpl = fetch, issuer = ISSUER, signal, timeoutMs = DEVICE_POLL_TIMEOUT_MS) {
135
+ const startedAt = Date.now();
136
+ for (;;) {
137
+ if (signal?.aborted)
138
+ throw new Error('device login cancelled');
139
+ const resp = await fetchImpl(`${issuer}/api/accounts/deviceauth/token`, {
140
+ method: 'POST',
141
+ headers: { 'Content-Type': 'application/json' },
142
+ body: JSON.stringify({ device_auth_id: deviceAuthId, user_code: userCode }),
143
+ signal,
144
+ });
145
+ if (resp.ok) {
146
+ const data = (await resp.json());
147
+ if (!data.authorization_code || !data.code_challenge || !data.code_verifier) {
148
+ throw new Error('device token response missing authorization fields');
149
+ }
150
+ return {
151
+ authorizationCode: data.authorization_code,
152
+ codeChallenge: data.code_challenge,
153
+ codeVerifier: data.code_verifier,
154
+ };
155
+ }
156
+ if (resp.status !== 403 && resp.status !== 404) {
157
+ throw new Error(`device auth failed (${resp.status}): ${await resp.text()}`);
158
+ }
159
+ if (Date.now() - startedAt >= timeoutMs)
160
+ return null;
161
+ const wait = Math.min(intervalSec * 1000, timeoutMs - (Date.now() - startedAt));
162
+ await new Promise((resolve) => setTimeout(resolve, wait));
163
+ }
164
+ }
165
+ /** Exchange the device authorization code for tokens (PKCE, form-urlencoded). */
166
+ export async function exchangeDeviceCode(code, codeVerifier, fetchImpl = fetch, clientId = CODEX_CLIENT_ID, issuer = ISSUER) {
167
+ const body = new URLSearchParams({
168
+ grant_type: 'authorization_code',
169
+ code,
170
+ redirect_uri: `${issuer}/deviceauth/callback`,
171
+ client_id: clientId,
172
+ code_verifier: codeVerifier,
173
+ });
174
+ const resp = await fetchImpl(`${issuer}/oauth/token`, {
175
+ method: 'POST',
176
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
177
+ body: body.toString(),
178
+ });
179
+ if (!resp.ok) {
180
+ throw new Error(`device token exchange failed (${resp.status}): ${await resp.text()}`);
181
+ }
182
+ const data = (await resp.json());
183
+ if (!data.id_token || !data.access_token || !data.refresh_token) {
184
+ throw new Error('device token exchange response missing tokens');
185
+ }
186
+ return {
187
+ idToken: data.id_token,
188
+ accessToken: data.access_token,
189
+ refreshToken: data.refresh_token,
190
+ expiresInSec: data.expires_in,
191
+ };
192
+ }
193
+ /**
194
+ * Persist tokens into the Codex CLI auth.json shape, preserving unrelated
195
+ * fields and writing atomically (concurrent Codex CLI readers never see a
196
+ * partial file).
197
+ */
198
+ export function writeCodexAuthFile(filePath, tokens) {
199
+ const resolved = expandHome(filePath);
200
+ let existing = {};
201
+ if (existsSync(resolved)) {
202
+ try {
203
+ existing = JSON.parse(readFileSync(resolved, 'utf8'));
204
+ }
205
+ catch {
206
+ existing = {};
207
+ }
208
+ }
209
+ const identity = idTokenIdentity(tokens.idToken);
210
+ const next = {
211
+ ...existing,
212
+ auth_mode: existing.auth_mode || 'chatgpt',
213
+ tokens: {
214
+ ...(existing.tokens ?? {}),
215
+ id_token: tokens.idToken,
216
+ access_token: tokens.accessToken,
217
+ refresh_token: tokens.refreshToken,
218
+ account_id: identity.accountId ?? existing.tokens?.account_id,
219
+ },
220
+ last_refresh: new Date().toISOString(),
221
+ };
222
+ mkdirSync(dirname(resolved), { recursive: true, mode: 0o700 });
223
+ const tmp = `${resolved}.dsh-codex-bridge.tmp`;
224
+ writeFileSync(tmp, `${JSON.stringify(next, null, 2)}\n`, { mode: 0o600 });
225
+ renameSync(tmp, resolved);
226
+ }
227
+ /**
228
+ * Run the whole device-code login: request code, surface it, poll, exchange,
229
+ * persist. Returns null when the user never authorized within the budget.
230
+ */
231
+ export async function runDeviceCodeLogin(options) {
232
+ const grant = await requestDeviceCode(options.fetchImpl);
233
+ options.onCode(grant);
234
+ const success = await pollDeviceCode(grant.deviceAuthId, grant.userCode, grant.intervalSec, options.fetchImpl, ISSUER, options.signal);
235
+ if (!success)
236
+ return null;
237
+ const tokens = await exchangeDeviceCode(success.authorizationCode, success.codeVerifier, options.fetchImpl);
238
+ writeCodexAuthFile(options.authFile, tokens);
239
+ const identity = idTokenIdentity(tokens.idToken);
240
+ return { tokens, email: identity.email };
241
+ }