@xrkseek/harness-cli 0.1.3 → 0.1.5

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 (304) hide show
  1. package/README.md +41 -22
  2. package/dist/commands/plugin.js +16 -16
  3. package/dist/commands/plugin.js.map +1 -1
  4. package/dist/commands/serve.d.ts.map +1 -1
  5. package/dist/commands/serve.js +34 -3
  6. package/dist/commands/serve.js.map +1 -1
  7. package/dist/log.d.ts +6 -1
  8. package/dist/log.d.ts.map +1 -1
  9. package/dist/log.js +20 -6
  10. package/dist/log.js.map +1 -1
  11. package/dist/parse-args.js +8 -8
  12. package/dist/plugin/index.js +5 -5
  13. package/dist/plugin/index.js.map +1 -1
  14. package/dist/plugin/remap-inject.d.ts.map +1 -1
  15. package/dist/plugin/remap-inject.js +1 -0
  16. package/dist/plugin/remap-inject.js.map +1 -1
  17. package/node_modules/@xrkseek/preset-server/dist/tsconfig.tsbuildinfo +1 -1
  18. package/node_modules/@xrkseek/server-face/dist/auto-review-slash.d.ts +11 -0
  19. package/node_modules/@xrkseek/server-face/dist/auto-review-slash.d.ts.map +1 -0
  20. package/node_modules/@xrkseek/server-face/dist/auto-review-slash.js +13 -0
  21. package/node_modules/@xrkseek/server-face/dist/auto-review-slash.js.map +1 -0
  22. package/node_modules/@xrkseek/server-face/dist/handlers/cost-meter.d.ts +15 -22
  23. package/node_modules/@xrkseek/server-face/dist/handlers/cost-meter.d.ts.map +1 -1
  24. package/node_modules/@xrkseek/server-face/dist/handlers/cost-meter.js +19 -16
  25. package/node_modules/@xrkseek/server-face/dist/handlers/cost-meter.js.map +1 -1
  26. package/node_modules/@xrkseek/server-face/dist/index.d.ts +2 -1
  27. package/node_modules/@xrkseek/server-face/dist/index.d.ts.map +1 -1
  28. package/node_modules/@xrkseek/server-face/dist/index.js +2 -1
  29. package/node_modules/@xrkseek/server-face/dist/index.js.map +1 -1
  30. package/node_modules/@xrkseek/server-face/dist/projections/registry.d.ts +1 -0
  31. package/node_modules/@xrkseek/server-face/dist/projections/registry.d.ts.map +1 -1
  32. package/node_modules/@xrkseek/server-face/dist/projections/registry.js.map +1 -1
  33. package/node_modules/@xrkseek/server-face/dist/projections/units/auto-review.d.ts.map +1 -1
  34. package/node_modules/@xrkseek/server-face/dist/projections/units/auto-review.js +9 -13
  35. package/node_modules/@xrkseek/server-face/dist/projections/units/auto-review.js.map +1 -1
  36. package/node_modules/@xrkseek/server-face/dist/projections/units/context-headers.d.ts +22 -5
  37. package/node_modules/@xrkseek/server-face/dist/projections/units/context-headers.d.ts.map +1 -1
  38. package/node_modules/@xrkseek/server-face/dist/projections/units/context-headers.js +31 -5
  39. package/node_modules/@xrkseek/server-face/dist/projections/units/context-headers.js.map +1 -1
  40. package/node_modules/@xrkseek/server-face/dist/projections/units/context-timeline.d.ts +42 -7
  41. package/node_modules/@xrkseek/server-face/dist/projections/units/context-timeline.d.ts.map +1 -1
  42. package/node_modules/@xrkseek/server-face/dist/projections/units/context-timeline.js +182 -24
  43. package/node_modules/@xrkseek/server-face/dist/projections/units/context-timeline.js.map +1 -1
  44. package/node_modules/@xrkseek/server-face/dist/projections/units/cost-usage.d.ts.map +1 -1
  45. package/node_modules/@xrkseek/server-face/dist/projections/units/cost-usage.js +26 -8
  46. package/node_modules/@xrkseek/server-face/dist/projections/units/cost-usage.js.map +1 -1
  47. package/node_modules/@xrkseek/server-host/dist/index.d.ts.map +1 -1
  48. package/node_modules/@xrkseek/server-host/dist/index.js +12 -4
  49. package/node_modules/@xrkseek/server-host/dist/index.js.map +1 -1
  50. package/node_modules/@xrkseek/server-host/dist/sidebar-face-bridge.d.ts +10 -0
  51. package/node_modules/@xrkseek/server-host/dist/sidebar-face-bridge.d.ts.map +1 -0
  52. package/node_modules/@xrkseek/server-host/dist/sidebar-face-bridge.js +192 -0
  53. package/node_modules/@xrkseek/server-host/dist/sidebar-face-bridge.js.map +1 -0
  54. package/node_modules/@xrkseek/server-host/dist/wallet-bridge.d.ts.map +1 -1
  55. package/node_modules/@xrkseek/server-host/dist/wallet-bridge.js +29 -1
  56. package/node_modules/@xrkseek/server-host/dist/wallet-bridge.js.map +1 -1
  57. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-providers.d.ts.map +1 -1
  58. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-providers.js +3 -1
  59. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-providers.js.map +1 -1
  60. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-types.d.ts +4 -1
  61. package/node_modules/@xrkseek/server-http/dist/dsh-compat/adapter-types.d.ts.map +1 -1
  62. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-http.d.ts.map +1 -1
  63. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-http.js +9 -10
  64. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-http.js.map +1 -1
  65. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-slash.d.ts +11 -0
  66. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-slash.d.ts.map +1 -0
  67. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-slash.js +13 -0
  68. package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-slash.js.map +1 -0
  69. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import-discovery.d.ts +41 -0
  70. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import-discovery.d.ts.map +1 -0
  71. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import-discovery.js +422 -0
  72. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import-discovery.js.map +1 -0
  73. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import-registry.d.ts +21 -0
  74. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import-registry.d.ts.map +1 -0
  75. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import-registry.js +34 -0
  76. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import-registry.js.map +1 -0
  77. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import.d.ts +1 -1
  78. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import.d.ts.map +1 -1
  79. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import.js +277 -23
  80. package/node_modules/@xrkseek/server-http/dist/dsh-compat/chat-import.js.map +1 -1
  81. package/node_modules/@xrkseek/server-http/dist/dsh-compat/community-root-http.d.ts +1 -1
  82. package/node_modules/@xrkseek/server-http/dist/dsh-compat/community-root-http.js +1 -1
  83. package/node_modules/@xrkseek/server-http/dist/dsh-compat/community-root-http.js.map +1 -1
  84. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-registry.d.ts +1 -1
  85. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-registry.d.ts.map +1 -1
  86. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-registry.js +2 -2
  87. package/node_modules/@xrkseek/server-http/dist/dsh-compat/cordis-registry.js.map +1 -1
  88. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-community-infer.js +1 -1
  89. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-community-infer.js.map +1 -1
  90. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-matrix.d.ts +4 -4
  91. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-matrix.d.ts.map +1 -1
  92. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-matrix.js +52 -27
  93. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-compat-matrix.js.map +1 -1
  94. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-envelope.js +1 -1
  95. package/node_modules/@xrkseek/server-http/dist/dsh-compat/dsh-envelope.js.map +1 -1
  96. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-dsh-http.d.ts +2 -2
  97. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-dsh-http.js +1 -1
  98. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-dsh-http.js.map +1 -1
  99. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-plugin-http.js +3 -3
  100. package/node_modules/@xrkseek/server-http/dist/dsh-compat/generic-plugin-http.js.map +1 -1
  101. package/node_modules/@xrkseek/server-http/dist/dsh-compat/genui.js +1 -1
  102. package/node_modules/@xrkseek/server-http/dist/dsh-compat/genui.js.map +1 -1
  103. package/node_modules/@xrkseek/server-http/dist/dsh-compat/honest-http-catchall.js +3 -3
  104. package/node_modules/@xrkseek/server-http/dist/dsh-compat/honest-http-catchall.js.map +1 -1
  105. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-messaging-bridge.d.ts +2 -0
  106. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-messaging-bridge.d.ts.map +1 -1
  107. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-messaging-bridge.js +53 -1
  108. package/node_modules/@xrkseek/server-http/dist/dsh-compat/im-messaging-bridge.js.map +1 -1
  109. package/node_modules/@xrkseek/server-http/dist/dsh-compat/index.d.ts +21 -18
  110. package/node_modules/@xrkseek/server-http/dist/dsh-compat/index.d.ts.map +1 -1
  111. package/node_modules/@xrkseek/server-http/dist/dsh-compat/index.js +28 -15
  112. package/node_modules/@xrkseek/server-http/dist/dsh-compat/index.js.map +1 -1
  113. package/node_modules/@xrkseek/server-http/dist/dsh-compat/market.js +1 -1
  114. package/node_modules/@xrkseek/server-http/dist/dsh-compat/market.js.map +1 -1
  115. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memento.d.ts +1 -0
  116. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memento.d.ts.map +1 -1
  117. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memento.js +77 -24
  118. package/node_modules/@xrkseek/server-http/dist/dsh-compat/memento.js.map +1 -1
  119. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon.d.ts +24 -0
  120. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon.d.ts.map +1 -1
  121. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon.js +39 -10
  122. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mnemon.js.map +1 -1
  123. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-auth.d.ts +71 -0
  124. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-auth.d.ts.map +1 -0
  125. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-auth.js +349 -0
  126. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-auth.js.map +1 -0
  127. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-cpolar-component.d.ts +53 -0
  128. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-cpolar-component.d.ts.map +1 -0
  129. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-cpolar-component.js +233 -0
  130. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-cpolar-component.js.map +1 -0
  131. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-funnel-sidecar.d.ts +4 -0
  132. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-funnel-sidecar.d.ts.map +1 -0
  133. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-funnel-sidecar.js +86 -0
  134. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-funnel-sidecar.js.map +1 -0
  135. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-gate.d.ts +15 -0
  136. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-gate.d.ts.map +1 -0
  137. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-gate.js +41 -0
  138. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-gate.js.map +1 -0
  139. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-local-gateway.d.ts +22 -0
  140. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-local-gateway.d.ts.map +1 -0
  141. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-local-gateway.js +183 -0
  142. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-local-gateway.js.map +1 -0
  143. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote-controllers.d.ts +68 -0
  144. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote-controllers.d.ts.map +1 -0
  145. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote-controllers.js +511 -0
  146. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote-controllers.js.map +1 -0
  147. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote-runtime.d.ts +34 -0
  148. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote-runtime.d.ts.map +1 -0
  149. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote-runtime.js +179 -0
  150. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote-runtime.js.map +1 -0
  151. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote.d.ts +19 -0
  152. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote.d.ts.map +1 -0
  153. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote.js +102 -0
  154. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access-remote.js.map +1 -0
  155. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access.d.ts +31 -4
  156. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access.d.ts.map +1 -1
  157. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access.js +698 -33
  158. package/node_modules/@xrkseek/server-http/dist/dsh-compat/mobile-access.js.map +1 -1
  159. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modlens.js +1 -1
  160. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modlens.js.map +1 -1
  161. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modsearch.d.ts.map +1 -1
  162. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modsearch.js +4 -1
  163. package/node_modules/@xrkseek/server-http/dist/dsh-compat/modsearch.js.map +1 -1
  164. package/node_modules/@xrkseek/server-http/dist/dsh-compat/noema.js +1 -1
  165. package/node_modules/@xrkseek/server-http/dist/dsh-compat/noema.js.map +1 -1
  166. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket-qrcode.d.ts +3 -0
  167. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket-qrcode.d.ts.map +1 -0
  168. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket-qrcode.js +18 -0
  169. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket-qrcode.js.map +1 -0
  170. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket.d.ts +6 -3
  171. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket.d.ts.map +1 -1
  172. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket.js +204 -54
  173. package/node_modules/@xrkseek/server-http/dist/dsh-compat/pocket.js.map +1 -1
  174. package/node_modules/@xrkseek/server-http/dist/dsh-compat/releases.js +1 -1
  175. package/node_modules/@xrkseek/server-http/dist/dsh-compat/releases.js.map +1 -1
  176. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-adapter.d.ts +3 -0
  177. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-adapter.d.ts.map +1 -1
  178. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-adapter.js +194 -22
  179. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-adapter.js.map +1 -1
  180. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-browser.d.ts +3 -0
  181. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-browser.d.ts.map +1 -0
  182. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-browser.js +82 -0
  183. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-browser.js.map +1 -0
  184. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-face-bridge.d.ts +51 -0
  185. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-face-bridge.d.ts.map +1 -0
  186. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-face-bridge.js +2 -0
  187. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-face-bridge.js.map +1 -0
  188. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-git.d.ts +47 -13
  189. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-git.d.ts.map +1 -1
  190. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-git.js +146 -27
  191. package/node_modules/@xrkseek/server-http/dist/dsh-compat/sidebar-git.js.map +1 -1
  192. package/node_modules/@xrkseek/server-http/dist/dsh-compat/skin-market.js +1 -1
  193. package/node_modules/@xrkseek/server-http/dist/dsh-compat/skin-market.js.map +1 -1
  194. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tokenledger.d.ts.map +1 -1
  195. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tokenledger.js +22 -4
  196. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tokenledger.js.map +1 -1
  197. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow.d.ts.map +1 -1
  198. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow.js +21 -2
  199. package/node_modules/@xrkseek/server-http/dist/dsh-compat/tongflow.js.map +1 -1
  200. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind-workspace.js +1 -1
  201. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind-workspace.js.map +1 -1
  202. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind.d.ts +2 -0
  203. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind.d.ts.map +1 -1
  204. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind.js +42 -3
  205. package/node_modules/@xrkseek/server-http/dist/dsh-compat/turn-rewind.js.map +1 -1
  206. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/contracts/wallet-port.d.ts +25 -7
  207. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/contracts/wallet-port.d.ts.map +1 -1
  208. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/contracts/wallet-port.js +2 -2
  209. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/doc-store.d.ts +2 -2
  210. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/doc-store.js +2 -2
  211. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-json.d.ts +12 -0
  212. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-json.d.ts.map +1 -0
  213. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-json.js +40 -0
  214. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-json.js.map +1 -0
  215. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-kit.d.ts +1 -1
  216. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-kit.js +1 -1
  217. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/http-kit.js.map +1 -1
  218. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/index.d.ts +7 -12
  219. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/index.d.ts.map +1 -1
  220. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/index.js +5 -8
  221. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/index.js.map +1 -1
  222. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/json-store.d.ts +5 -0
  223. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/json-store.d.ts.map +1 -0
  224. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/json-store.js +31 -0
  225. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/json-store.js.map +1 -0
  226. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/mobile-gate-kit.d.ts +37 -0
  227. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/mobile-gate-kit.d.ts.map +1 -0
  228. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/mobile-gate-kit.js +96 -0
  229. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/mobile-gate-kit.js.map +1 -0
  230. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/public-handler.d.ts +6 -0
  231. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/public-handler.d.ts.map +1 -0
  232. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/public-handler.js +2 -0
  233. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/public-handler.js.map +1 -0
  234. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/wallet-service.d.ts.map +1 -1
  235. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/wallet-service.js +66 -4
  236. package/node_modules/@xrkseek/server-http/dist/dsh-compat/underlying/wallet-service.js.map +1 -1
  237. package/node_modules/@xrkseek/server-http/dist/dsh-compat/undo.js +2 -2
  238. package/node_modules/@xrkseek/server-http/dist/dsh-compat/undo.js.map +1 -1
  239. package/node_modules/@xrkseek/server-http/dist/dsh-compat/usage-stats.js +1 -1
  240. package/node_modules/@xrkseek/server-http/dist/dsh-compat/usage-stats.js.map +1 -1
  241. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision.js +1 -1
  242. package/node_modules/@xrkseek/server-http/dist/dsh-compat/vision.js.map +1 -1
  243. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallet.d.ts +2 -2
  244. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallet.d.ts.map +1 -1
  245. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallet.js +2 -2
  246. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallet.js.map +1 -1
  247. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallpaper.js +2 -2
  248. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wallpaper.js.map +1 -1
  249. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/settings-provider.d.ts +1 -1
  250. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/stub-handlers.js +1 -1
  251. package/node_modules/@xrkseek/server-http/dist/dsh-compat/wire/stub-handlers.js.map +1 -1
  252. package/node_modules/@xrkseek/server-http/dist/dsh-compat/xrk-json-store.js +3 -3
  253. package/node_modules/@xrkseek/server-http/dist/dsh-compat/xrk-json-store.js.map +1 -1
  254. package/node_modules/@xrkseek/server-http/dist/index.d.ts +1 -1
  255. package/node_modules/@xrkseek/server-http/dist/index.d.ts.map +1 -1
  256. package/node_modules/@xrkseek/server-http/dist/index.js +1 -1
  257. package/node_modules/@xrkseek/server-http/dist/index.js.map +1 -1
  258. package/node_modules/@xrkseek/server-http/package.json +7 -1
  259. package/node_modules/qrcode-generator/README.md +101 -0
  260. package/node_modules/qrcode-generator/package.json +30 -0
  261. package/node_modules/qrcode-generator/qrcode.d.ts +57 -0
  262. package/node_modules/qrcode-generator/qrcode.js +2297 -0
  263. package/node_modules/qrcode-generator/qrcode_SJIS.js +30 -0
  264. package/node_modules/qrcode-generator/qrcode_UTF8.js +26 -0
  265. package/node_modules/qrcode-generator/sample.html +49 -0
  266. package/node_modules/qrcode-generator/sample.js +49 -0
  267. package/node_modules/qrcode-generator/test/qrcode.js +118 -0
  268. package/package.json +4 -2
  269. package/product-web/assets/index-BNGm-t1O.js +112 -0
  270. package/product-web/assets/index-BNGm-t1O.js.map +1 -0
  271. package/product-web/boot.json +1 -1
  272. package/product-web/index.html +1 -1
  273. package/product-web/plugins/@xrkseek/client-locale/client.js +3 -3
  274. package/product-web/plugins/@xrkseek/client-modules/client.js +7 -6
  275. package/product-web/plugins/@xrkseek/client-runtime/client.js +7 -0
  276. package/product-web/plugins/@xrkseek/client-ui-agent-preset/client.js +38 -38
  277. package/product-web/plugins/@xrkseek/client-ui-attachment/client.js +8 -8
  278. package/product-web/plugins/@xrkseek/client-ui-commands/client.js +7 -7
  279. package/product-web/plugins/@xrkseek/client-ui-conversation/client.js +178 -185
  280. package/product-web/plugins/@xrkseek/client-ui-deliverables/client.js +5 -5
  281. package/product-web/plugins/@xrkseek/client-ui-directory-picker-browse/client.js +26 -26
  282. package/product-web/plugins/@xrkseek/client-ui-goal/client.js +8 -8
  283. package/product-web/plugins/@xrkseek/client-ui-input-trigger/client.js +7 -7
  284. package/product-web/plugins/@xrkseek/client-ui-jobs/client.js +9 -9
  285. package/product-web/plugins/@xrkseek/client-ui-layout/client.js +4 -4
  286. package/product-web/plugins/@xrkseek/client-ui-message-feedback/client.js +5 -5
  287. package/product-web/plugins/@xrkseek/client-ui-model-selection/client.js +18 -18
  288. package/product-web/plugins/@xrkseek/client-ui-permission-presets/client.js +4 -4
  289. package/product-web/plugins/@xrkseek/client-ui-plan/client.js +3 -3
  290. package/product-web/plugins/@xrkseek/client-ui-settings-general/client.js +27 -19
  291. package/product-web/plugins/@xrkseek/client-ui-settings-models/client.js +57 -57
  292. package/product-web/plugins/@xrkseek/client-ui-settings-plugin-inventory/client.js +12 -12
  293. package/product-web/plugins/@xrkseek/client-ui-settings-plugins/client.js +45 -45
  294. package/product-web/plugins/@xrkseek/client-ui-sidebar/client.js +15 -15
  295. package/product-web/plugins/@xrkseek/client-ui-skill/client.js +13 -13
  296. package/product-web/plugins/@xrkseek/client-ui-subagent/client.js +21 -21
  297. package/product-web/plugins/@xrkseek/client-ui-theme/client.js +3 -3
  298. package/product-web/plugins/@xrkseek/client-ui-tool/client.js +38 -38
  299. package/product-web/plugins/@xrkseek/client-ui-trajectory/client.js +142 -142
  300. package/product-web/plugins/@xrkseek/client-ui-user-questions/client.js +27 -27
  301. package/product-web/plugins/@xrkseek/client-ui-workflow-run/client.js +15 -15
  302. package/product-web/plugins/@xrkseek/client-ui-workspace/client.js +55 -55
  303. package/product-web/assets/index-C_NG-17x.js +0 -112
  304. package/product-web/assets/index-C_NG-17x.js.map +0 -1
@@ -0,0 +1,349 @@
1
+ /**
2
+ * dsh-mobile pairing / device session auth (cookie + token digests).
3
+ */
4
+ import { createHash, randomBytes, timingSafeEqual, } from "node:crypto";
5
+ export const DEVICE_COOKIE = "dsh_ma_device";
6
+ export const SESSION_COOKIE = "dsh_ma_session";
7
+ export const CSRF_COOKIE = "dsh_ma_csrf";
8
+ export const CSRF_HEADER = "x-dsh-mobile-csrf";
9
+ export const LAN_PIN_COOKIE = "dsh_ma_lan";
10
+ export const WAN_PIN_COOKIE = "dsh_ma_wan";
11
+ const DEVICE_TTL_MS = 90 * 24 * 60 * 60 * 1000;
12
+ const SESSION_TTL_MS = 12 * 60 * 60 * 1000;
13
+ const MAX_DEVICES = 32;
14
+ function digestHex(value) {
15
+ return createHash("sha256").update(value).digest("hex");
16
+ }
17
+ function opaqueToken() {
18
+ return randomBytes(32).toString("base64url");
19
+ }
20
+ function normalizeLabel(label) {
21
+ const trimmed = (label ?? "Mobile device").trim();
22
+ return trimmed.slice(0, 64) || "Mobile device";
23
+ }
24
+ function cookie(name, value, options) {
25
+ const parts = [
26
+ `${name}=${encodeURIComponent(value)}`,
27
+ `Path=${options.path}`,
28
+ `Max-Age=${String(Math.max(0, Math.floor(options.maxAgeSeconds)))}`,
29
+ "SameSite=Strict",
30
+ ];
31
+ if (options.tls)
32
+ parts.push("Secure");
33
+ if (options.httpOnly)
34
+ parts.push("HttpOnly");
35
+ return parts.join("; ");
36
+ }
37
+ export function mintPairingWindow(ttlMs = 300_000) {
38
+ return {
39
+ token: opaqueToken(),
40
+ expiresAt: Date.now() + ttlMs,
41
+ };
42
+ }
43
+ export function pruneMobileAuth(state, now = Date.now()) {
44
+ return {
45
+ ...state,
46
+ devices: state.devices.filter((d) => !d.revokedAt && d.expiresAt > now),
47
+ sessions: state.sessions.filter((s) => s.expiresAt > now),
48
+ pairingToken: state.pairingExpiresAt > now ? state.pairingToken : "",
49
+ pairingExpiresAt: state.pairingExpiresAt > now ? state.pairingExpiresAt : 0,
50
+ };
51
+ }
52
+ export function pairDevice(state, token, label, now = Date.now()) {
53
+ const pruned = pruneMobileAuth(state, now);
54
+ if (!pruned.pairingToken ||
55
+ pruned.pairingExpiresAt <= now ||
56
+ token !== pruned.pairingToken) {
57
+ throw new Error("authentication_failed");
58
+ }
59
+ if (pruned.devices.length >= MAX_DEVICES) {
60
+ throw new Error("device_limit");
61
+ }
62
+ const deviceToken = opaqueToken();
63
+ const sessionToken = opaqueToken();
64
+ const csrfToken = opaqueToken();
65
+ const deviceId = randomBytes(16).toString("hex");
66
+ const deviceExpiresAt = now + DEVICE_TTL_MS;
67
+ const sessionExpiresAt = now + SESSION_TTL_MS;
68
+ const device = {
69
+ id: deviceId,
70
+ label: normalizeLabel(label),
71
+ tokenDigest: digestHex(deviceToken),
72
+ createdAt: now,
73
+ expiresAt: deviceExpiresAt,
74
+ lastSeenAt: now,
75
+ };
76
+ const session = {
77
+ key: digestHex(sessionToken),
78
+ deviceId,
79
+ csrfDigest: digestHex(csrfToken),
80
+ createdAt: now,
81
+ expiresAt: sessionExpiresAt,
82
+ };
83
+ return {
84
+ state: {
85
+ pairingToken: "",
86
+ pairingExpiresAt: 0,
87
+ devices: [...pruned.devices, device],
88
+ sessions: [...pruned.sessions, session],
89
+ },
90
+ deviceToken,
91
+ sessionToken,
92
+ csrfToken,
93
+ deviceId,
94
+ deviceExpiresAt,
95
+ sessionExpiresAt,
96
+ };
97
+ }
98
+ export function renewSession(state, deviceToken, now = Date.now()) {
99
+ const pruned = pruneMobileAuth(state, now);
100
+ const digest = digestHex(deviceToken);
101
+ const device = pruned.devices.find((d) => {
102
+ try {
103
+ return timingSafeEqual(Buffer.from(d.tokenDigest, "hex"), Buffer.from(digest, "hex"));
104
+ }
105
+ catch {
106
+ return false;
107
+ }
108
+ });
109
+ if (!device)
110
+ throw new Error("authentication_failed");
111
+ const sessionToken = opaqueToken();
112
+ const csrfToken = opaqueToken();
113
+ const sessionExpiresAt = now + SESSION_TTL_MS;
114
+ const session = {
115
+ key: digestHex(sessionToken),
116
+ deviceId: device.id,
117
+ csrfDigest: digestHex(csrfToken),
118
+ createdAt: now,
119
+ expiresAt: sessionExpiresAt,
120
+ };
121
+ const devices = pruned.devices.map((d) => d.id === device.id ? { ...d, lastSeenAt: now } : d);
122
+ return {
123
+ state: {
124
+ ...pruned,
125
+ devices,
126
+ sessions: [
127
+ ...pruned.sessions.filter((s) => s.deviceId !== device.id),
128
+ session,
129
+ ],
130
+ },
131
+ sessionToken,
132
+ csrfToken,
133
+ sessionExpiresAt,
134
+ };
135
+ }
136
+ export function setMobileSessionCookies(res, tokens, tls = false) {
137
+ const now = Date.now();
138
+ res.setHeader("set-cookie", [
139
+ cookie(DEVICE_COOKIE, tokens.deviceToken, {
140
+ path: "/mobile-access/auth/renew",
141
+ maxAgeSeconds: Math.floor((tokens.deviceExpiresAt - now) / 1000),
142
+ httpOnly: true,
143
+ tls,
144
+ }),
145
+ cookie(SESSION_COOKIE, tokens.sessionToken, {
146
+ path: "/",
147
+ maxAgeSeconds: Math.floor((tokens.sessionExpiresAt - now) / 1000),
148
+ httpOnly: true,
149
+ tls,
150
+ }),
151
+ cookie(CSRF_COOKIE, tokens.csrfToken, {
152
+ path: "/",
153
+ maxAgeSeconds: Math.floor((tokens.sessionExpiresAt - now) / 1000),
154
+ httpOnly: true,
155
+ tls,
156
+ }),
157
+ ]);
158
+ }
159
+ export function parseCookieHeader(header, name) {
160
+ if (!header)
161
+ return undefined;
162
+ for (const part of header.split(";")) {
163
+ const [k, ...rest] = part.trim().split("=");
164
+ if (k === name)
165
+ return decodeURIComponent(rest.join("="));
166
+ }
167
+ return undefined;
168
+ }
169
+ const ACCESS_PIN_TTL_MS = 7 * 24 * 60 * 60 * 1000;
170
+ export function accessPinCookieDigest(pin, instanceId) {
171
+ return digestHex(`access-pin:${instanceId}:${pin}`);
172
+ }
173
+ export function verifyAccessPinCookie(cookieValue, pin, instanceId) {
174
+ if (!cookieValue || !pin || !instanceId)
175
+ return false;
176
+ const expected = accessPinCookieDigest(pin, instanceId);
177
+ try {
178
+ return timingSafeEqual(Buffer.from(cookieValue), Buffer.from(expected));
179
+ }
180
+ catch {
181
+ return false;
182
+ }
183
+ }
184
+ export function verifyMobileSession(state, sessionToken, now = Date.now()) {
185
+ if (!sessionToken)
186
+ return false;
187
+ const key = digestHex(sessionToken);
188
+ const pruned = pruneMobileAuth(state, now);
189
+ return pruned.sessions.some((session) => {
190
+ try {
191
+ return timingSafeEqual(Buffer.from(session.key, "hex"), Buffer.from(key, "hex"));
192
+ }
193
+ catch {
194
+ return false;
195
+ }
196
+ });
197
+ }
198
+ export function setAccessPinCookie(res, cookieName, pin, instanceId, tls = false) {
199
+ const value = accessPinCookieDigest(pin, instanceId);
200
+ res.setHeader("set-cookie", [
201
+ cookie(cookieName, value, {
202
+ path: "/",
203
+ maxAgeSeconds: Math.floor(ACCESS_PIN_TTL_MS / 1000),
204
+ httpOnly: true,
205
+ tls,
206
+ }),
207
+ ]);
208
+ }
209
+ export function publicDevice(device) {
210
+ return {
211
+ deviceId: device.id,
212
+ id: device.id,
213
+ label: device.label,
214
+ createdAt: device.createdAt,
215
+ expiresAt: device.expiresAt,
216
+ lastActiveAt: device.lastSeenAt,
217
+ lastSeenAt: device.lastSeenAt,
218
+ };
219
+ }
220
+ export const PAIR_PAGE_HTML = `<!doctype html>
221
+ <html lang="zh-CN">
222
+ <meta charset="utf-8">
223
+ <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
224
+ <title>配对 XRK 移动访问</title>
225
+ <main style="font-family:system-ui,sans-serif;max-width:28rem;margin:2rem auto;padding:0 1rem">
226
+ <h1>配对此设备</h1>
227
+ <p>输入桌面端显示的配对码,或从二维码链接自动填充。</p>
228
+ <form id="pair-form">
229
+ <label style="display:block;margin:.75rem 0">配对码
230
+ <input id="pair-token" autocomplete="one-time-code" required style="width:100%;padding:.5rem">
231
+ </label>
232
+ <label style="display:block;margin:.75rem 0">设备名称
233
+ <input id="device-label" maxlength="64" autocomplete="off" style="width:100%;padding:.5rem">
234
+ </label>
235
+ <button type="submit" style="padding:.5rem 1rem">配对</button>
236
+ <output id="pair-status" style="display:block;margin-top:.75rem"></output>
237
+ </form>
238
+ </main>
239
+ <script src="/mobile-access/pair.js" defer></script>
240
+ </html>`;
241
+ export const PAIR_PAGE_JS = `(() => {
242
+ const params = new URLSearchParams(location.hash.replace(/^#/, ''))
243
+ const tokenInput = document.getElementById('pair-token')
244
+ const labelInput = document.getElementById('device-label')
245
+ const status = document.getElementById('pair-status')
246
+ const form = document.getElementById('pair-form')
247
+ const hashToken = params.get('token')
248
+ if (hashToken && tokenInput) tokenInput.value = hashToken
249
+ form?.addEventListener('submit', async (event) => {
250
+ event.preventDefault()
251
+ status.textContent = '配对中…'
252
+ const response = await fetch('/mobile-access/auth/pair', {
253
+ method: 'POST',
254
+ credentials: 'same-origin',
255
+ headers: { 'content-type': 'application/json' },
256
+ body: JSON.stringify({
257
+ token: tokenInput?.value ?? '',
258
+ label: labelInput?.value || undefined,
259
+ }),
260
+ })
261
+ if (!response.ok) {
262
+ status.textContent = '配对失败(链接可能已过期)'
263
+ return
264
+ }
265
+ location.replace('/')
266
+ })
267
+ })()
268
+ `;
269
+ export const LOGIN_PAGE_HTML = `<!doctype html>
270
+ <html lang="zh-CN">
271
+ <meta charset="utf-8">
272
+ <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
273
+ <title>XRK 移动访问</title>
274
+ <main style="font-family:system-ui,sans-serif;max-width:28rem;margin:2rem auto;padding:0 1rem">
275
+ <h1>正在恢复会话…</h1>
276
+ <p id="login-progress">正在验证设备凭据。</p>
277
+ <p id="login-failed" hidden>无法恢复会话,请重新配对。</p>
278
+ <a href="/mobile-access/pair">打开配对页</a>
279
+ </main>
280
+ <script src="/mobile-access/login.js" defer></script>
281
+ </html>`;
282
+ export const LOGIN_PAGE_JS = `(() => {
283
+ fetch('/mobile-access/auth/renew', {
284
+ method: 'POST',
285
+ credentials: 'same-origin',
286
+ headers: { 'content-type': 'application/json' },
287
+ body: '{}',
288
+ }).then((response) => {
289
+ if (response.ok) {
290
+ const next = new URLSearchParams(location.search).get('return') || '/'
291
+ location.replace(next)
292
+ return
293
+ }
294
+ document.getElementById('login-progress').hidden = true
295
+ document.getElementById('login-failed').hidden = false
296
+ }).catch(() => {
297
+ const el = document.getElementById('login-progress')
298
+ if (el) el.textContent = '无法连接到主机。'
299
+ })
300
+ })()
301
+ `;
302
+ function pinPageHtml(mode, title) {
303
+ return `<!doctype html>
304
+ <html lang="zh-CN">
305
+ <meta charset="utf-8">
306
+ <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
307
+ <title>${title}</title>
308
+ <main style="font-family:system-ui,sans-serif;max-width:28rem;margin:2rem auto;padding:0 1rem">
309
+ <h1>${title}</h1>
310
+ <p>输入桌面端移动访问设置中显示的 ${mode === "wan" ? "远程" : "局域网"} 访问 PIN。</p>
311
+ <form id="pin-form">
312
+ <label style="display:block;margin:.75rem 0">PIN
313
+ <input id="access-pin" inputmode="numeric" autocomplete="one-time-code" required style="width:100%;padding:.5rem">
314
+ </label>
315
+ <button type="submit" style="padding:.5rem 1rem">继续</button>
316
+ <output id="pin-status" style="display:block;margin-top:.75rem"></output>
317
+ </form>
318
+ </main>
319
+ <script src="/mobile-access/${mode}-pin.js" defer></script>
320
+ </html>`;
321
+ }
322
+ function pinPageJs(mode) {
323
+ return `(() => {
324
+ const status = document.getElementById('pin-status')
325
+ const input = document.getElementById('access-pin')
326
+ document.getElementById('pin-form')?.addEventListener('submit', async (event) => {
327
+ event.preventDefault()
328
+ status.textContent = '验证中…'
329
+ const response = await fetch('/mobile-access/auth/${mode}-pin', {
330
+ method: 'POST',
331
+ credentials: 'same-origin',
332
+ headers: { 'content-type': 'application/json' },
333
+ body: JSON.stringify({ pin: input?.value ?? '' }),
334
+ })
335
+ if (!response.ok) {
336
+ status.textContent = 'PIN 不正确'
337
+ return
338
+ }
339
+ const next = new URLSearchParams(location.search).get('return') || '/'
340
+ location.replace(next)
341
+ })
342
+ })()
343
+ `;
344
+ }
345
+ export const LAN_PIN_PAGE_HTML = pinPageHtml("lan", "局域网访问");
346
+ export const WAN_PIN_PAGE_HTML = pinPageHtml("wan", "远程访问");
347
+ export const LAN_PIN_PAGE_JS = pinPageJs("lan");
348
+ export const WAN_PIN_PAGE_JS = pinPageJs("wan");
349
+ //# sourceMappingURL=mobile-access-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-access-auth.js","sourceRoot":"","sources":["../../src/dsh-compat/mobile-access-auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,UAAU,EACV,WAAW,EACX,eAAe,GAChB,MAAM,aAAa,CAAC;AAGrB,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AACzC,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAC3C,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAE3C,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC/C,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC3C,MAAM,WAAW,GAAG,EAAE,CAAC;AA2BvB,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,WAAW;IAClB,OAAO,WAAW,CAAC,EAAE,CAAC,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AAM,iBAAiB,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC5D,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1,53 @@
1
+ /** Official cpolar 3.3.18 win32 x64 release (dsh-mobile CPOLAR_COMPONENT_RELEASE). */
2
+ export declare const CPOLAR_COMPONENT_RELEASE: {
3
+ readonly version: "3.3.18";
4
+ readonly platform: "win32";
5
+ readonly arch: "x64";
6
+ readonly downloadUrl: "https://www.cpolar.com/static/downloads/releases/3.3.18/cpolar-stable-windows-amd64-setup.zip";
7
+ readonly downloadBytes: 7603505;
8
+ readonly downloadSha256: "fb8cf60289058ee26079f995d2eeea0b21768a742d90c93015afe96e83428830";
9
+ readonly executableBytes: 19637680;
10
+ readonly executableSha256: "b2d865ee505e842d22ceca5493a872efa893a79b079a7a8ee2bd3aa5343a5c41";
11
+ readonly downloadPage: "https://www.cpolar.com/download";
12
+ readonly signupUrl: "https://dashboard.cpolar.com/signup";
13
+ readonly dashboardUrl: "https://dashboard.cpolar.com/auth";
14
+ readonly termsUrl: "https://www.cpolar.com/tos";
15
+ };
16
+ export interface CpolarComponentStatus {
17
+ supported: boolean;
18
+ installed: boolean;
19
+ configured: boolean;
20
+ version: string;
21
+ downloadBytes: number;
22
+ installedBytes: number;
23
+ sourceUrl: string;
24
+ downloadPage: string;
25
+ signupUrl: string;
26
+ dashboardUrl: string;
27
+ termsUrl: string;
28
+ storagePath: string;
29
+ errorCode?: string;
30
+ }
31
+ export declare class CpolarComponentManager {
32
+ readonly executable: string;
33
+ readonly configFile: string;
34
+ readonly componentRoot: string;
35
+ private readonly componentStorage;
36
+ private readonly stateRoot;
37
+ private readonly logRoot;
38
+ private readonly stagingRoot;
39
+ private readonly stateDirectory;
40
+ installed: boolean;
41
+ configured: boolean;
42
+ errorCode: string | undefined;
43
+ private queue;
44
+ constructor(xrkHome: string | undefined);
45
+ initialize(): Promise<void>;
46
+ status(): CpolarComponentStatus;
47
+ private enqueue;
48
+ install(): Promise<void>;
49
+ private extractWindowsInstaller;
50
+ configure(authtoken: string): Promise<void>;
51
+ purge(): Promise<void>;
52
+ }
53
+ //# sourceMappingURL=mobile-access-cpolar-component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-access-cpolar-component.d.ts","sourceRoot":"","sources":["../../src/dsh-compat/mobile-access-cpolar-component.ts"],"names":[],"mappings":"AAwBA,sFAAsF;AACtF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;CAgB3B,CAAC;AAgCX,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,sBAAsB;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,SAAS,UAAS;IAClB,UAAU,UAAS;IACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,CAAC,KAAK,CAAoC;gBAErC,OAAO,EAAE,MAAM,GAAG,SAAS;IA6BjC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBjC,MAAM,IAAI,qBAAqB;IAsB/B,OAAO,CAAC,OAAO;IAST,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YA8DhB,uBAAuB;IAgC/B,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+B3C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAa7B"}
@@ -0,0 +1,233 @@
1
+ /**
2
+ * cpolar official component install — mirrors dsh-mobile CpolarComponentManager.
3
+ */
4
+ import { createHash, randomBytes, } from "node:crypto";
5
+ import { copyFile, mkdir, mkdtemp, readFile, readdir, rename, rm, writeFile, } from "node:fs/promises";
6
+ import { execFile } from "node:child_process";
7
+ import { promisify } from "node:util";
8
+ import path from "node:path";
9
+ import { dataPath } from "./underlying/json-store.js";
10
+ const execFileAsync = promisify(execFile);
11
+ /** Official cpolar 3.3.18 win32 x64 release (dsh-mobile CPOLAR_COMPONENT_RELEASE). */
12
+ export const CPOLAR_COMPONENT_RELEASE = {
13
+ version: "3.3.18",
14
+ platform: "win32",
15
+ arch: "x64",
16
+ downloadUrl: "https://www.cpolar.com/static/downloads/releases/3.3.18/cpolar-stable-windows-amd64-setup.zip",
17
+ downloadBytes: 7603505,
18
+ downloadSha256: "fb8cf60289058ee26079f995d2eeea0b21768a742d90c93015afe96e83428830",
19
+ executableBytes: 19637680,
20
+ executableSha256: "b2d865ee505e842d22ceca5493a872efa893a79b079a7a8ee2bd3aa5343a5c41",
21
+ downloadPage: "https://www.cpolar.com/download",
22
+ signupUrl: "https://dashboard.cpolar.com/signup",
23
+ dashboardUrl: "https://dashboard.cpolar.com/auth",
24
+ termsUrl: "https://www.cpolar.com/tos",
25
+ };
26
+ function inside(parent, child) {
27
+ const rel = path.relative(parent, child);
28
+ return rel !== "" && !rel.startsWith("..") && !path.isAbsolute(rel);
29
+ }
30
+ async function sha256File(file) {
31
+ const buf = await readFile(file);
32
+ return createHash("sha256").update(buf).digest("hex");
33
+ }
34
+ async function regularFile(file, expectedBytes) {
35
+ try {
36
+ const { stat } = await import("node:fs/promises");
37
+ const st = await stat(file);
38
+ return (st.isFile() &&
39
+ (expectedBytes === undefined || st.size === expectedBytes));
40
+ }
41
+ catch {
42
+ return false;
43
+ }
44
+ }
45
+ async function runExe(file, args) {
46
+ await execFileAsync(file, args, {
47
+ windowsHide: true,
48
+ timeout: 120_000,
49
+ });
50
+ }
51
+ export class CpolarComponentManager {
52
+ executable;
53
+ configFile;
54
+ componentRoot;
55
+ componentStorage;
56
+ stateRoot;
57
+ logRoot;
58
+ stagingRoot;
59
+ stateDirectory;
60
+ installed = false;
61
+ configured = false;
62
+ errorCode;
63
+ queue = Promise.resolve();
64
+ constructor(xrkHome) {
65
+ this.stateDirectory = dataPath(xrkHome, "mobile-access");
66
+ this.componentRoot = path.join(this.stateDirectory, "components", "cpolar");
67
+ this.componentStorage = path.join(this.componentRoot, CPOLAR_COMPONENT_RELEASE.version);
68
+ this.executable = path.join(this.componentStorage, "cpolar.exe");
69
+ this.stateRoot = path.join(this.stateDirectory, "state", "cpolar");
70
+ this.configFile = path.join(this.stateRoot, "cpolar.yml");
71
+ this.logRoot = path.join(this.stateDirectory, "logs", "cpolar");
72
+ this.stagingRoot = path.join(this.stateDirectory, "staging", "cpolar");
73
+ for (const child of [
74
+ this.componentRoot,
75
+ this.componentStorage,
76
+ this.stateRoot,
77
+ this.logRoot,
78
+ this.stagingRoot,
79
+ ]) {
80
+ if (!inside(this.stateDirectory, child)) {
81
+ throw new Error("cpolar path escaped state directory");
82
+ }
83
+ }
84
+ }
85
+ async initialize() {
86
+ this.installed = await regularFile(this.executable, CPOLAR_COMPONENT_RELEASE.executableBytes);
87
+ if (this.installed &&
88
+ (await sha256File(this.executable)) !==
89
+ CPOLAR_COMPONENT_RELEASE.executableSha256) {
90
+ this.installed = false;
91
+ this.errorCode = "cpolar_component_invalid";
92
+ }
93
+ this.configured = await regularFile(this.configFile);
94
+ }
95
+ status() {
96
+ const platform = process.platform;
97
+ const arch = process.arch;
98
+ return {
99
+ supported: platform === CPOLAR_COMPONENT_RELEASE.platform &&
100
+ arch === CPOLAR_COMPONENT_RELEASE.arch,
101
+ installed: this.installed,
102
+ configured: this.configured,
103
+ version: CPOLAR_COMPONENT_RELEASE.version,
104
+ downloadBytes: CPOLAR_COMPONENT_RELEASE.downloadBytes,
105
+ installedBytes: CPOLAR_COMPONENT_RELEASE.executableBytes,
106
+ sourceUrl: CPOLAR_COMPONENT_RELEASE.downloadUrl,
107
+ downloadPage: CPOLAR_COMPONENT_RELEASE.downloadPage,
108
+ signupUrl: CPOLAR_COMPONENT_RELEASE.signupUrl,
109
+ dashboardUrl: CPOLAR_COMPONENT_RELEASE.dashboardUrl,
110
+ termsUrl: CPOLAR_COMPONENT_RELEASE.termsUrl,
111
+ storagePath: this.componentRoot,
112
+ ...(this.errorCode ? { errorCode: this.errorCode } : {}),
113
+ };
114
+ }
115
+ enqueue(op) {
116
+ const task = this.queue.then(op, op);
117
+ this.queue = task.then(() => undefined, () => undefined);
118
+ return task;
119
+ }
120
+ async install() {
121
+ return this.enqueue(async () => {
122
+ if (process.platform !== CPOLAR_COMPONENT_RELEASE.platform ||
123
+ process.arch !== CPOLAR_COMPONENT_RELEASE.arch) {
124
+ throw new Error("cpolar_component_unsupported");
125
+ }
126
+ await mkdir(this.stagingRoot, { recursive: true, mode: 0o700 });
127
+ const staging = await mkdtemp(path.join(this.stagingRoot, "install-"));
128
+ try {
129
+ const controller = new AbortController();
130
+ const timeout = setTimeout(() => controller.abort(), 120_000);
131
+ timeout.unref();
132
+ const response = await fetch(CPOLAR_COMPONENT_RELEASE.downloadUrl, {
133
+ redirect: "error",
134
+ signal: controller.signal,
135
+ });
136
+ clearTimeout(timeout);
137
+ if (!response.ok) {
138
+ throw new Error(`cpolar_download_http_${response.status}`);
139
+ }
140
+ const bytes = new Uint8Array(await response.arrayBuffer());
141
+ if (bytes.byteLength !== CPOLAR_COMPONENT_RELEASE.downloadBytes) {
142
+ throw new Error("cpolar_download_size_mismatch");
143
+ }
144
+ const hash = createHash("sha256").update(bytes).digest("hex");
145
+ if (hash !== CPOLAR_COMPONENT_RELEASE.downloadSha256) {
146
+ throw new Error("cpolar_download_hash_mismatch");
147
+ }
148
+ const archive = path.join(staging, "cpolar.zip");
149
+ await writeFile(archive, bytes, { mode: 0o600 });
150
+ await this.extractWindowsInstaller(archive, staging);
151
+ const extracted = path.join(staging, "cpolar.exe");
152
+ if (!await regularFile(extracted, CPOLAR_COMPONENT_RELEASE.executableBytes) ||
153
+ (await sha256File(extracted)) !==
154
+ CPOLAR_COMPONENT_RELEASE.executableSha256) {
155
+ throw new Error("cpolar_executable_hash_mismatch");
156
+ }
157
+ const candidate = path.join(this.componentRoot, `.install-${randomBytes(12).toString("hex")}`);
158
+ await mkdir(candidate, { recursive: true, mode: 0o700 });
159
+ await copyFile(extracted, path.join(candidate, "cpolar.exe"));
160
+ await rm(this.componentStorage, { recursive: true, force: true });
161
+ await rename(candidate, this.componentStorage);
162
+ this.installed = true;
163
+ this.errorCode = undefined;
164
+ }
165
+ finally {
166
+ await rm(staging, { recursive: true, force: true });
167
+ }
168
+ });
169
+ }
170
+ async extractWindowsInstaller(archive, destination) {
171
+ const unpacked = path.join(destination, "archive");
172
+ const administrative = path.join(destination, "administrative");
173
+ await mkdir(unpacked, { recursive: true, mode: 0o700 });
174
+ await mkdir(administrative, { recursive: true, mode: 0o700 });
175
+ await runExe("tar.exe", ["-xf", archive, "-C", unpacked]);
176
+ const entries = await readdir(unpacked, { recursive: true });
177
+ const msiRel = entries.find((e) => String(e).toLowerCase().endsWith(".msi"));
178
+ if (!msiRel)
179
+ throw new Error("cpolar_installer_missing");
180
+ const msiPath = path.join(unpacked, String(msiRel));
181
+ await runExe("msiexec.exe", [
182
+ "/a",
183
+ msiPath,
184
+ "/qn",
185
+ `TARGETDIR=${administrative}`,
186
+ ]);
187
+ const adminEntries = await readdir(administrative, { recursive: true });
188
+ const exeRel = adminEntries.find((e) => path.basename(String(e)).toLowerCase() === "cpolar.exe");
189
+ if (!exeRel)
190
+ throw new Error("cpolar_executable_missing");
191
+ await copyFile(path.join(administrative, String(exeRel)), path.join(destination, "cpolar.exe"));
192
+ }
193
+ async configure(authtoken) {
194
+ return this.enqueue(async () => {
195
+ const token = authtoken.trim();
196
+ if (token.length < 20 ||
197
+ token.length > 512 ||
198
+ [...token].some((ch) => {
199
+ const code = ch.codePointAt(0) ?? 0;
200
+ return code <= 0x1f || code === 0x7f || /\s/u.test(ch);
201
+ })) {
202
+ throw new Error("cpolar_authtoken_invalid");
203
+ }
204
+ await mkdir(this.stateRoot, { recursive: true, mode: 0o700 });
205
+ const temporary = path.join(this.stateRoot, `.cpolar.${randomBytes(12).toString("hex")}.tmp`);
206
+ const body = `authtoken: ${JSON.stringify(token)}\nconsole_ui: false\nupdate: false\ninspect_db_size: -1\n`;
207
+ try {
208
+ await writeFile(temporary, body, { encoding: "utf8", mode: 0o600 });
209
+ await rename(temporary, this.configFile);
210
+ }
211
+ catch (err) {
212
+ await rm(temporary, { force: true });
213
+ throw err;
214
+ }
215
+ this.configured = true;
216
+ this.errorCode = undefined;
217
+ });
218
+ }
219
+ async purge() {
220
+ return this.enqueue(async () => {
221
+ await Promise.all([
222
+ rm(this.componentRoot, { recursive: true, force: true }),
223
+ rm(this.stateRoot, { recursive: true, force: true }),
224
+ rm(this.logRoot, { recursive: true, force: true }),
225
+ rm(this.stagingRoot, { recursive: true, force: true }),
226
+ ]);
227
+ this.installed = false;
228
+ this.configured = false;
229
+ this.errorCode = undefined;
230
+ });
231
+ }
232
+ }
233
+ //# sourceMappingURL=mobile-access-cpolar-component.js.map