@galaxy-blackhole/blackhole-harness 0.1.0 → 0.1.1

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 (433) hide show
  1. package/apps/cli/lib/main.js +539 -257
  2. package/apps/cli/src/mount-gate.ts +492 -0
  3. package/apps/cli/src/mount.ts +30 -7
  4. package/apps/cli/src/prebuilt.ts +4 -1
  5. package/package.json +1 -1
  6. package/packages/client/connection/lib/types/client/api.d.ts +58 -0
  7. package/packages/client/connection/lib/types/client/connection.d.ts +127 -0
  8. package/packages/client/connection/lib/types/client/plugin.d.ts +110 -0
  9. package/packages/client/connection/lib/types/client/rpc.d.ts +26 -0
  10. package/packages/client/connection/lib/types/client/socket.d.ts +32 -0
  11. package/packages/client/connection/lib/types/client.d.ts +17 -0
  12. package/packages/client/connection/lib/types/host/browser-auth.d.ts +122 -0
  13. package/packages/client/connection/lib/types/host/index.d.ts +44 -0
  14. package/packages/client/connection/lib/types/host/loopback.d.ts +16 -0
  15. package/packages/client/connection/lib/types/host/rpc-host.d.ts +310 -0
  16. package/packages/client/connection/lib/types/host/rpc-schema.d.ts +89 -0
  17. package/packages/client/connection/lib/types/host/trust.d.ts +92 -0
  18. package/packages/client/connection/lib/types/ids.d.ts +33 -0
  19. package/packages/client/connection/lib/types/index.d.ts +20 -0
  20. package/packages/client/connection/lib/types/recovery-config.d.ts +29 -0
  21. package/packages/client/connection/lib/types/rpc-id.d.ts +34 -0
  22. package/packages/client/settings-about/lib/types/client.d.ts +14 -0
  23. package/packages/client/settings-about/lib/types/index.d.ts +22 -0
  24. package/packages/client/settings-about/lib/types/locales.d.ts +17 -0
  25. package/packages/client/settings-about/lib/types/zalo-data.d.ts +11 -0
  26. package/packages/client/ui-primitives/lib/types/artwork-dynamic.d.ts +14 -0
  27. package/packages/client/ui-primitives/lib/types/artwork-part-1.d.ts +10 -0
  28. package/packages/client/ui-primitives/lib/types/artwork-part-2.d.ts +10 -0
  29. package/packages/client/ui-primitives/lib/types/artwork-part-3.d.ts +10 -0
  30. package/packages/client/ui-primitives/lib/types/artwork-part-4.d.ts +10 -0
  31. package/packages/client/ui-primitives/lib/types/artwork-registry.d.ts +29 -0
  32. package/packages/client/ui-primitives/lib/types/artwork-render.d.ts +29 -0
  33. package/packages/client/ui-primitives/lib/types/artwork-types.d.ts +76 -0
  34. package/packages/client/ui-primitives/lib/types/brand.d.ts +59 -0
  35. package/packages/client/ui-primitives/lib/types/gbh-icon-specs.d.ts +26 -0
  36. package/packages/client/ui-primitives/lib/types/gbh-icon.d.ts +37 -0
  37. package/packages/client/ui-primitives/lib/types/index.d.ts +42 -0
  38. package/packages/client/ui-schedule/lib/types/client.d.ts +9 -0
  39. package/packages/client/ui-schedule/lib/types/ids.d.ts +74 -0
  40. package/packages/client/ui-schedule/lib/types/index.d.ts +20 -0
  41. package/packages/client/ui-schedule/lib/types/manifest.d.ts +62 -0
  42. package/packages/client/ui-settings-general/lib/types/badge.d.ts +9 -0
  43. package/packages/client/ui-settings-general/lib/types/client.d.ts +9 -0
  44. package/packages/client/ui-settings-general/lib/types/desktop-update.d.ts +93 -0
  45. package/packages/client/ui-settings-general/lib/types/dictionaries.d.ts +16 -0
  46. package/packages/client/ui-settings-general/lib/types/document-store.d.ts +68 -0
  47. package/packages/client/ui-settings-general/lib/types/ids.d.ts +11 -0
  48. package/packages/client/ui-settings-general/lib/types/index.d.ts +101 -0
  49. package/packages/client/ui-settings-general/lib/types/items.d.ts +24 -0
  50. package/packages/client/ui-settings-general/lib/types/locales-vi.d.ts +14 -0
  51. package/packages/client/ui-settings-general/lib/types/overlay.d.ts +30 -0
  52. package/packages/client/ui-settings-general/lib/types/panel.d.ts +9 -0
  53. package/packages/client/ui-settings-general/lib/types/plugin.d.ts +103 -0
  54. package/packages/client/ui-settings-general/lib/types/sections.d.ts +9 -0
  55. package/packages/client/ui-settings-general/lib/types/settings-css.d.ts +41 -0
  56. package/packages/client/ui-settings-general/lib/types/settings-panel.d.ts +22 -0
  57. package/packages/client/ui-settings-general/lib/types/settings-root.d.ts +21 -0
  58. package/packages/client/ui-settings-general/lib/types/settings-store.d.ts +55 -0
  59. package/packages/client/ui-settings-general/lib/types/shell-parts.d.ts +31 -0
  60. package/packages/client/ui-settings-general/lib/types/store.d.ts +29 -0
  61. package/packages/client/ui-settings-general/lib/types/trigger.d.ts +9 -0
  62. package/packages/client/ui-settings-general/lib/types/types.d.ts +137 -0
  63. package/packages/client/ui-settings-session-log/lib/types/client.d.ts +9 -0
  64. package/packages/client/ui-settings-session-log/lib/types/index.d.ts +19 -0
  65. package/packages/client/ui-settings-session-log/lib/types/locales-vi.d.ts +14 -0
  66. package/packages/client/ui-settings-session-log/lib/types/locales.d.ts +23 -0
  67. package/packages/client/ui-sidebar-documentpreview/lib/types/class-names.d.ts +89 -0
  68. package/packages/client/ui-sidebar-documentpreview/lib/types/client.d.ts +9 -0
  69. package/packages/client/ui-sidebar-documentpreview/lib/types/clsx.d.ts +13 -0
  70. package/packages/client/ui-sidebar-documentpreview/lib/types/code/code-body.d.ts +40 -0
  71. package/packages/client/ui-sidebar-documentpreview/lib/types/config.d.ts +46 -0
  72. package/packages/client/ui-sidebar-documentpreview/lib/types/css-inject.d.ts +22 -0
  73. package/packages/client/ui-sidebar-documentpreview/lib/types/css-registry.d.ts +22 -0
  74. package/packages/client/ui-sidebar-documentpreview/lib/types/definition.d.ts +22 -0
  75. package/packages/client/ui-sidebar-documentpreview/lib/types/document/contract.d.ts +13 -0
  76. package/packages/client/ui-sidebar-documentpreview/lib/types/document/lines.d.ts +46 -0
  77. package/packages/client/ui-sidebar-documentpreview/lib/types/document/registry.d.ts +75 -0
  78. package/packages/client/ui-sidebar-documentpreview/lib/types/document/resource-group.d.ts +43 -0
  79. package/packages/client/ui-sidebar-documentpreview/lib/types/document/suffix.d.ts +25 -0
  80. package/packages/client/ui-sidebar-documentpreview/lib/types/document/tab-lifetime.d.ts +15 -0
  81. package/packages/client/ui-sidebar-documentpreview/lib/types/document/unviewable.d.ts +21 -0
  82. package/packages/client/ui-sidebar-documentpreview/lib/types/excel/error.d.ts +18 -0
  83. package/packages/client/ui-sidebar-documentpreview/lib/types/excel/excel-kind.d.ts +34 -0
  84. package/packages/client/ui-sidebar-documentpreview/lib/types/excel/format.d.ts +13 -0
  85. package/packages/client/ui-sidebar-documentpreview/lib/types/excel/lazy-excel-body.d.ts +20 -0
  86. package/packages/client/ui-sidebar-documentpreview/lib/types/face.d.ts +125 -0
  87. package/packages/client/ui-sidebar-documentpreview/lib/types/failure-line.d.ts +37 -0
  88. package/packages/client/ui-sidebar-documentpreview/lib/types/html/basic-document.d.ts +15 -0
  89. package/packages/client/ui-sidebar-documentpreview/lib/types/html/bootstrap.d.ts +30 -0
  90. package/packages/client/ui-sidebar-documentpreview/lib/types/html/bytes.d.ts +21 -0
  91. package/packages/client/ui-sidebar-documentpreview/lib/types/html/html-body.d.ts +49 -0
  92. package/packages/client/ui-sidebar-documentpreview/lib/types/html/pack.d.ts +46 -0
  93. package/packages/client/ui-sidebar-documentpreview/lib/types/html/read-relative.d.ts +18 -0
  94. package/packages/client/ui-sidebar-documentpreview/lib/types/ids.d.ts +110 -0
  95. package/packages/client/ui-sidebar-documentpreview/lib/types/image/image-body.d.ts +80 -0
  96. package/packages/client/ui-sidebar-documentpreview/lib/types/index.d.ts +86 -0
  97. package/packages/client/ui-sidebar-documentpreview/lib/types/kinds.d.ts +90 -0
  98. package/packages/client/ui-sidebar-documentpreview/lib/types/loading-indicator.d.ts +30 -0
  99. package/packages/client/ui-sidebar-documentpreview/lib/types/locales-vi.d.ts +57 -0
  100. package/packages/client/ui-sidebar-documentpreview/lib/types/locales.d.ts +168 -0
  101. package/packages/client/ui-sidebar-documentpreview/lib/types/markdown/frontmatter.d.ts +22 -0
  102. package/packages/client/ui-sidebar-documentpreview/lib/types/markdown/markdown-body.d.ts +43 -0
  103. package/packages/client/ui-sidebar-documentpreview/lib/types/markdown/path-images.d.ts +14 -0
  104. package/packages/client/ui-sidebar-documentpreview/lib/types/office/cache.d.ts +116 -0
  105. package/packages/client/ui-sidebar-documentpreview/lib/types/office/face.d.ts +51 -0
  106. package/packages/client/ui-sidebar-documentpreview/lib/types/office/font-notice.d.ts +36 -0
  107. package/packages/client/ui-sidebar-documentpreview/lib/types/office/office-body.d.ts +71 -0
  108. package/packages/client/ui-sidebar-documentpreview/lib/types/office/office-font-action.d.ts +35 -0
  109. package/packages/client/ui-sidebar-documentpreview/lib/types/office/office-kind.d.ts +49 -0
  110. package/packages/client/ui-sidebar-documentpreview/lib/types/office/store.d.ts +30 -0
  111. package/packages/client/ui-sidebar-documentpreview/lib/types/pdf/lazy-pdf-body.d.ts +20 -0
  112. package/packages/client/ui-sidebar-documentpreview/lib/types/pdf/store.d.ts +21 -0
  113. package/packages/client/ui-sidebar-documentpreview/lib/types/plugin.d.ts +28 -0
  114. package/packages/client/ui-sidebar-documentpreview/lib/types/rpc.d.ts +20 -0
  115. package/packages/client/ui-sidebar-documentpreview/lib/types/store.d.ts +69 -0
  116. package/packages/client/ui-sidebar-documentpreview/lib/types/text-body.d.ts +34 -0
  117. package/packages/client/ui-sidebar-documentpreview/lib/types/text-preview.d.ts +163 -0
  118. package/packages/client/ui-sidebar-documentpreview/lib/types/text-title.d.ts +30 -0
  119. package/packages/client/ui-sidebar-documentpreview/lib/types/types.d.ts +193 -0
  120. package/packages/client/ui-sidebar-documentpreview/lib/types/workspace-path.d.ts +80 -0
  121. package/packages/client/ui-sidebar-documentpreview/lib/types/zoom/controls.d.ts +65 -0
  122. package/packages/client/ui-sidebar-documentpreview/lib/types/zoom/store.d.ts +17 -0
  123. package/packages/client/ui-sidebar-documentpreview/lib/types/zoom/types.d.ts +26 -0
  124. package/packages/client/ui-sidebar-documentpreview/lib/types/zoom/viewport.d.ts +51 -0
  125. package/packages/client/ui-theme/lib/types/boot-theme.d.ts +41 -0
  126. package/packages/client/ui-theme/lib/types/class-names.d.ts +53 -0
  127. package/packages/client/ui-theme/lib/types/client.d.ts +9 -0
  128. package/packages/client/ui-theme/lib/types/clsx.d.ts +15 -0
  129. package/packages/client/ui-theme/lib/types/ids.d.ts +21 -0
  130. package/packages/client/ui-theme/lib/types/index.d.ts +108 -0
  131. package/packages/client/ui-theme/lib/types/locales.d.ts +100 -0
  132. package/packages/client/ui-theme/lib/types/plugin.d.ts +73 -0
  133. package/packages/client/ui-theme/lib/types/rows.d.ts +123 -0
  134. package/packages/client/ui-theme/lib/types/settings-store.d.ts +46 -0
  135. package/packages/client/ui-theme/lib/types/styles.d.ts +42 -0
  136. package/packages/client/ui-theme/lib/types/theme-runtime.d.ts +256 -0
  137. package/packages/client/ui-theme/lib/types/theme-settings.d.ts +112 -0
  138. package/packages/host/agent-instructions/lib/types/config.d.ts +69 -0
  139. package/packages/host/agent-instructions/lib/types/digest.d.ts +14 -0
  140. package/packages/host/agent-instructions/lib/types/files.d.ts +171 -0
  141. package/packages/host/agent-instructions/lib/types/index.d.ts +28 -0
  142. package/packages/host/agent-instructions/lib/types/render.d.ts +150 -0
  143. package/packages/host/agent-instructions/lib/types/service.d.ts +11 -0
  144. package/packages/host/agent-instructions/lib/types/state.d.ts +114 -0
  145. package/packages/host/agent-preset/lib/types/index.d.ts +86 -0
  146. package/packages/host/agent-preset/lib/types/preset-redirect.d.ts +82 -0
  147. package/packages/host/agent-preset-registry/lib/index.js +9 -9
  148. package/packages/host/agent-preset-registry/lib/types/composition-inventory.d.ts +53 -0
  149. package/packages/host/agent-preset-registry/lib/types/definition.d.ts +13 -0
  150. package/packages/host/agent-preset-registry/lib/types/display.d.ts +34 -0
  151. package/packages/host/agent-preset-registry/lib/types/display.js +1 -1
  152. package/packages/host/agent-preset-registry/lib/types/index.d.ts +230 -0
  153. package/packages/host/agent-preset-registry/lib/types/mount.d.ts +73 -0
  154. package/packages/host/agent-preset-registry/lib/types/nested-mount.d.ts +81 -0
  155. package/packages/host/agent-preset-registry/lib/types/session.d.ts +37 -0
  156. package/packages/host/agent-preset-registry/lib/types/types.d.ts +174 -0
  157. package/packages/host/api-workspace-controller/lib/types/client.d.ts +8 -0
  158. package/packages/host/api-workspace-controller/lib/types/commands.d.ts +117 -0
  159. package/packages/host/api-workspace-controller/lib/types/defaults.d.ts +56 -0
  160. package/packages/host/api-workspace-controller/lib/types/directory-picker.d.ts +117 -0
  161. package/packages/host/api-workspace-controller/lib/types/feed.d.ts +102 -0
  162. package/packages/host/api-workspace-controller/lib/types/ids.d.ts +35 -0
  163. package/packages/host/api-workspace-controller/lib/types/index.d.ts +29 -0
  164. package/packages/host/api-workspace-controller/lib/types/service.d.ts +130 -0
  165. package/packages/host/api-workspace-controller/lib/types/types.d.ts +192 -0
  166. package/packages/host/api-workspace-controller/lib/types/workspace-seam.d.ts +50 -0
  167. package/packages/host/authorization/lib/types/errors.d.ts +36 -0
  168. package/packages/host/authorization/lib/types/index.d.ts +19 -0
  169. package/packages/host/authorization/lib/types/service.d.ts +123 -0
  170. package/packages/host/authorization/lib/types/types.d.ts +162 -0
  171. package/packages/host/bundle-labels/lib/types/bundle-experimental-gbh.d.ts +15 -0
  172. package/packages/host/bundle-labels/lib/types/bundle-icons.d.ts +14 -0
  173. package/packages/host/bundle-labels/lib/types/bundle-meta-vi.d.ts +53 -0
  174. package/packages/host/bundle-labels/lib/types/index.d.ts +19 -0
  175. package/packages/host/command-goal/lib/types/index.d.ts +32 -0
  176. package/packages/host/config-editor/lib/types/index.d.ts +17 -0
  177. package/packages/host/config-editor/lib/types/patch.d.ts +49 -0
  178. package/packages/host/config-editor/lib/types/service.d.ts +47 -0
  179. package/packages/host/config-editor/lib/types/types.d.ts +43 -0
  180. package/packages/host/cordis-host-runner/lib/types/guard.d.ts +55 -0
  181. package/packages/host/cordis-host-runner/lib/types/index.d.ts +33 -0
  182. package/packages/host/cordis-host-runner/lib/types/inspect-registry.d.ts +103 -0
  183. package/packages/host/cordis-host-runner/lib/types/lifecycle.d.ts +31 -0
  184. package/packages/host/cordis-host-runner/lib/types/registry.d.ts +272 -0
  185. package/packages/host/cordis-host-runner/lib/types/sandbox.d.ts +51 -0
  186. package/packages/host/cordis-host-runner/lib/types/service-support.d.ts +234 -0
  187. package/packages/host/cordis-host-runner/lib/types/service.d.ts +254 -0
  188. package/packages/host/cordis-host-runner/lib/types/types.d.ts +457 -0
  189. package/packages/host/deepseek-llm-api-extensions/lib/types/index.d.ts +23 -0
  190. package/packages/host/deepseek-llm-api-extensions/lib/types/registry.d.ts +38 -0
  191. package/packages/host/deepseek-llm-api-extensions/lib/types/types.d.ts +56 -0
  192. package/packages/host/experimental-agent-team/lib/types/activity.d.ts +23 -0
  193. package/packages/host/experimental-agent-team/lib/types/error.d.ts +14 -0
  194. package/packages/host/experimental-agent-team/lib/types/index.d.ts +45 -0
  195. package/packages/host/experimental-agent-team/lib/types/journal.d.ts +39 -0
  196. package/packages/host/experimental-agent-team/lib/types/lifecycle.d.ts +44 -0
  197. package/packages/host/experimental-agent-team/lib/types/persisted.d.ts +40 -0
  198. package/packages/host/experimental-agent-team/lib/types/projection.d.ts +123 -0
  199. package/packages/host/experimental-agent-team/lib/types/roster.d.ts +200 -0
  200. package/packages/host/experimental-agent-team/lib/types/service.d.ts +157 -0
  201. package/packages/host/experimental-agent-team/lib/types/session-message.d.ts +18 -0
  202. package/packages/host/experimental-agent-team/lib/types/task-board.d.ts +99 -0
  203. package/packages/host/experimental-agent-team/lib/types/task-graph.d.ts +24 -0
  204. package/packages/host/experimental-agent-team/lib/types/task-view.d.ts +12 -0
  205. package/packages/host/experimental-agent-team/lib/types/team-seams.d.ts +22 -0
  206. package/packages/host/experimental-agent-team/lib/types/types.d.ts +310 -0
  207. package/packages/host/experimental-agent-team/lib/types/validation.d.ts +11 -0
  208. package/packages/host/experimental-api-speech-to-text/lib/types/index.d.ts +102 -0
  209. package/packages/host/experimental-api-speech-to-text/lib/types/typert-host.d.ts +29 -0
  210. package/packages/host/experimental-api-speech-to-text/lib/types/typert-remote-client.d.ts +2 -0
  211. package/packages/host/experimental-api-speech-to-text/lib/types/types.d.ts +39 -0
  212. package/packages/host/experimental-speech-to-text-sensevoice/lib/types/config.d.ts +52 -0
  213. package/packages/host/experimental-speech-to-text-sensevoice/lib/types/download-error.d.ts +34 -0
  214. package/packages/host/experimental-speech-to-text-sensevoice/lib/types/index.d.ts +29 -0
  215. package/packages/host/experimental-speech-to-text-sensevoice/lib/types/input.d.ts +13 -0
  216. package/packages/host/experimental-speech-to-text-sensevoice/lib/types/model-sources.d.ts +8 -0
  217. package/packages/host/experimental-speech-to-text-sensevoice/lib/types/recognizer.d.ts +145 -0
  218. package/packages/host/experimental-speech-to-text-sensevoice/lib/types/runtime.d.ts +84 -0
  219. package/packages/host/experimental-speech-to-text-sensevoice/lib/types/worker.d.ts +1 -0
  220. package/packages/host/experimental-translator/lib/types/deepseek.d.ts +47 -0
  221. package/packages/host/experimental-translator/lib/types/error.d.ts +24 -0
  222. package/packages/host/experimental-translator/lib/types/index.d.ts +25 -0
  223. package/packages/host/experimental-translator/lib/types/plugin.d.ts +128 -0
  224. package/packages/host/experimental-translator/lib/types/provider.d.ts +16 -0
  225. package/packages/host/experimental-translator/lib/types/storage.d.ts +77 -0
  226. package/packages/host/experimental-translator/lib/types/types.d.ts +128 -0
  227. package/packages/host/file-reference-local/lib/types/index.d.ts +71 -0
  228. package/packages/host/file-reference-local/lib/types/search.d.ts +121 -0
  229. package/packages/host/file-reference-local/lib/types/types.d.ts +171 -0
  230. package/packages/host/fs-sandbox/lib/types/containment.d.ts +20 -0
  231. package/packages/host/fs-sandbox/lib/types/index.d.ts +98 -0
  232. package/packages/host/goal-round-driver/lib/types/index.d.ts +31 -0
  233. package/packages/host/goal-round-driver/lib/types/prompt.d.ts +17 -0
  234. package/packages/host/goal-round-driver/lib/types/types.d.ts +88 -0
  235. package/packages/host/hmr/lib/types/config.d.ts +22 -0
  236. package/packages/host/hmr/lib/types/error.d.ts +42 -0
  237. package/packages/host/hmr/lib/types/ignore.d.ts +13 -0
  238. package/packages/host/hmr/lib/types/index.d.ts +28 -0
  239. package/packages/host/hmr/lib/types/loader-cache.d.ts +165 -0
  240. package/packages/host/hmr/lib/types/module-files.d.ts +63 -0
  241. package/packages/host/hmr/lib/types/package-manifests.d.ts +161 -0
  242. package/packages/host/hmr/lib/types/profile-apply.d.ts +41 -0
  243. package/packages/host/hmr/lib/types/service.d.ts +253 -0
  244. package/packages/host/hmr/lib/types/watch-config.d.ts +26 -0
  245. package/packages/host/image-offload/lib/types/freeze.d.ts +15 -0
  246. package/packages/host/image-offload/lib/types/image-offload.d.ts +19 -0
  247. package/packages/host/image-offload/lib/types/index.d.ts +35 -0
  248. package/packages/host/image-offload/lib/types/project-message.d.ts +17 -0
  249. package/packages/host/image-offload/lib/types/projection.d.ts +11 -0
  250. package/packages/host/image-offload/lib/types/types.d.ts +148 -0
  251. package/packages/host/jobs-local/lib/types/events.d.ts +76 -0
  252. package/packages/host/jobs-local/lib/types/index.d.ts +33 -0
  253. package/packages/host/jobs-local/lib/types/pump.d.ts +45 -0
  254. package/packages/host/jobs-local/lib/types/registry.d.ts +305 -0
  255. package/packages/host/jobs-local/lib/types/ring.d.ts +39 -0
  256. package/packages/host/jobs-local/lib/types/types.d.ts +91 -0
  257. package/packages/host/lazy-require/lib/types/index.d.ts +8 -0
  258. package/packages/host/llm/lib/types/adapter-failure.d.ts +22 -0
  259. package/packages/host/llm/lib/types/api-key.d.ts +31 -0
  260. package/packages/host/llm/lib/types/assembler.d.ts +76 -0
  261. package/packages/host/llm/lib/types/assistant-stream.d.ts +168 -0
  262. package/packages/host/llm/lib/types/attribution.d.ts +45 -0
  263. package/packages/host/llm/lib/types/brand.d.ts +54 -0
  264. package/packages/host/llm/lib/types/call-config.d.ts +73 -0
  265. package/packages/host/llm/lib/types/content.d.ts +149 -0
  266. package/packages/host/llm/lib/types/error.d.ts +97 -0
  267. package/packages/host/llm/lib/types/index.d.ts +61 -0
  268. package/packages/host/llm/lib/types/message.d.ts +274 -0
  269. package/packages/host/llm/lib/types/retry-policy.d.ts +81 -0
  270. package/packages/host/llm/lib/types/service.d.ts +321 -0
  271. package/packages/host/llm/lib/types/stream-seam.d.ts +19 -0
  272. package/packages/host/llm/lib/types/typert-host.d.ts +47 -0
  273. package/packages/host/llm/lib/types/typert-remote-client.d.ts +2 -0
  274. package/packages/host/llm/lib/types/types.d.ts +551 -0
  275. package/packages/host/llm-pi-ai/package.json +3 -0
  276. package/packages/host/mcp-resources/lib/types/index.d.ts +62 -0
  277. package/packages/host/mcp-resources/lib/types/render.d.ts +18 -0
  278. package/packages/host/mcp-resources/lib/types/tools.d.ts +23 -0
  279. package/packages/host/mcp-resources/lib/types/types.d.ts +35 -0
  280. package/packages/host/message-feedback/lib/types/index.d.ts +19 -0
  281. package/packages/host/message-feedback/lib/types/schema.d.ts +89 -0
  282. package/packages/host/message-feedback/lib/types/service.d.ts +94 -0
  283. package/packages/host/message-feedback/lib/types/types.d.ts +207 -0
  284. package/packages/host/otel/lib/types/event-log.d.ts +66 -0
  285. package/packages/host/otel/lib/types/event-transport.d.ts +9 -0
  286. package/packages/host/otel/lib/types/index.d.ts +49 -0
  287. package/packages/host/otel/lib/types/session-log.d.ts +144 -0
  288. package/packages/host/otel/lib/types/transport.d.ts +33 -0
  289. package/packages/host/persona/lib/types/index.d.ts +52 -0
  290. package/packages/host/plugin-inventory/lib/types/gateway.d.ts +32 -0
  291. package/packages/host/plugin-inventory/lib/types/index.d.ts +17 -0
  292. package/packages/host/plugin-inventory/lib/types/inventory.d.ts +18 -0
  293. package/packages/host/plugin-inventory/lib/types/types.d.ts +79 -0
  294. package/packages/host/plugin-manager/lib/types/build-approval.d.ts +37 -0
  295. package/packages/host/plugin-manager/lib/types/bundle-rename.d.ts +70 -0
  296. package/packages/host/plugin-manager/lib/types/catalog-thu-nghiem.d.ts +49 -0
  297. package/packages/host/plugin-manager/lib/types/failure.d.ts +32 -0
  298. package/packages/host/plugin-manager/lib/types/github-connection.d.ts +37 -0
  299. package/packages/host/plugin-manager/lib/types/index.d.ts +55 -0
  300. package/packages/host/plugin-manager/lib/types/install-failure.d.ts +28 -0
  301. package/packages/host/plugin-manager/lib/types/install-spec.d.ts +57 -0
  302. package/packages/host/plugin-manager/lib/types/list-bundles.d.ts +26 -0
  303. package/packages/host/plugin-manager/lib/types/manager-support.d.ts +164 -0
  304. package/packages/host/plugin-manager/lib/types/manager.d.ts +217 -0
  305. package/packages/host/plugin-manager/lib/types/meta-bundle.d.ts +22 -0
  306. package/packages/host/plugin-manager/lib/types/official-install-target.d.ts +25 -0
  307. package/packages/host/plugin-manager/lib/types/operations.d.ts +160 -0
  308. package/packages/host/plugin-manager/lib/types/origin.d.ts +45 -0
  309. package/packages/host/plugin-manager/lib/types/patch.d.ts +32 -0
  310. package/packages/host/plugin-manager/lib/types/registry.d.ts +47 -0
  311. package/packages/host/plugin-manager/lib/types/run-tree.d.ts +53 -0
  312. package/packages/host/plugin-manager/lib/types/tools.d.ts +19 -0
  313. package/packages/host/plugin-manager/lib/types/types.d.ts +318 -0
  314. package/packages/host/plugin-market/lib/types/ids.d.ts +17 -0
  315. package/packages/host/plugin-market/lib/types/index-url.d.ts +9 -0
  316. package/packages/host/plugin-market/lib/types/index.d.ts +64 -0
  317. package/packages/host/plugin-market/lib/types/nested-rows.d.ts +32 -0
  318. package/packages/host/plugin-market/lib/types/parse-thread.d.ts +11 -0
  319. package/packages/host/plugin-market/lib/types/parse.d.ts +33 -0
  320. package/packages/host/plugin-market/lib/types/search.d.ts +33 -0
  321. package/packages/host/plugin-market/lib/types/service.d.ts +144 -0
  322. package/packages/host/plugin-market/lib/types/tools.d.ts +10 -0
  323. package/packages/host/plugin-market/lib/types/typert-host.d.ts +41 -0
  324. package/packages/host/plugin-market/lib/types/typert-remote-client.d.ts +2 -0
  325. package/packages/host/plugin-market/lib/types/types.d.ts +155 -0
  326. package/packages/host/plugin-market/lib/types/worker.d.ts +1 -0
  327. package/packages/host/pwsh-sandbox/lib/types/helpers.d.ts +47 -0
  328. package/packages/host/pwsh-sandbox/lib/types/index.d.ts +92 -0
  329. package/packages/host/sandbox-policy/lib/types/index.d.ts +73 -0
  330. package/packages/host/sandbox-policy/lib/types/policy.d.ts +102 -0
  331. package/packages/host/sandbox-policy/lib/types/session-mode.d.ts +30 -0
  332. package/packages/host/sandbox-seam/lib/types/diagnostics.d.ts +37 -0
  333. package/packages/host/sandbox-seam/lib/types/escalation.d.ts +118 -0
  334. package/packages/host/sandbox-seam/lib/types/index.d.ts +79 -0
  335. package/packages/host/sandbox-seam/lib/types/roots.d.ts +27 -0
  336. package/packages/host/sandbox-seam/lib/types/types.d.ts +69 -0
  337. package/packages/host/schedule/lib/types/codec.d.ts +254 -0
  338. package/packages/host/schedule/lib/types/delivery-history.d.ts +30 -0
  339. package/packages/host/schedule/lib/types/framing.d.ts +34 -0
  340. package/packages/host/schedule/lib/types/index.d.ts +37 -0
  341. package/packages/host/schedule/lib/types/occurrence.d.ts +137 -0
  342. package/packages/host/schedule/lib/types/records.d.ts +144 -0
  343. package/packages/host/schedule/lib/types/runtime.d.ts +101 -0
  344. package/packages/host/schedule/lib/types/service.d.ts +162 -0
  345. package/packages/host/schedule/lib/types/storage.d.ts +50 -0
  346. package/packages/host/schedule/lib/types/types.d.ts +550 -0
  347. package/packages/host/schedule/lib/types/update.d.ts +33 -0
  348. package/packages/host/session/lib/index.js +15 -15
  349. package/packages/host/session/lib/types/events.d.ts +206 -0
  350. package/packages/host/session/lib/types/fork.d.ts +27 -0
  351. package/packages/host/session/lib/types/fork.js +3 -3
  352. package/packages/host/session/lib/types/index.d.ts +50 -0
  353. package/packages/host/session/lib/types/known-event-types.d.ts +12 -0
  354. package/packages/host/session/lib/types/preparation.d.ts +34 -0
  355. package/packages/host/session/lib/types/repair.d.ts +93 -0
  356. package/packages/host/session/lib/types/request-header.d.ts +46 -0
  357. package/packages/host/session/lib/types/seq-ranges.d.ts +14 -0
  358. package/packages/host/session/lib/types/session.d.ts +262 -0
  359. package/packages/host/session/lib/types/store.d.ts +186 -0
  360. package/packages/host/session/lib/types/surface.d.ts +184 -0
  361. package/packages/host/session/lib/types/surface.js +3 -3
  362. package/packages/host/session/lib/types/tool-history.d.ts +51 -0
  363. package/packages/host/session/lib/types/types.d.ts +590 -0
  364. package/packages/host/session/lib/types/types.js +1 -1
  365. package/packages/host/session-checkpoint-policy/lib/types/index.d.ts +27 -0
  366. package/packages/host/session-checkpoint-policy/lib/types/result.d.ts +15 -0
  367. package/packages/host/session-checkpoint-policy/lib/types/types.d.ts +118 -0
  368. package/packages/host/session-delete/lib/types/index.d.ts +32 -0
  369. package/packages/host/session-delete/lib/types/service.d.ts +109 -0
  370. package/packages/host/session-delete/lib/types/types.d.ts +51 -0
  371. package/packages/host/session-log/lib/types/acceptance.d.ts +18 -0
  372. package/packages/host/session-log/lib/types/index.d.ts +48 -0
  373. package/packages/host/session-log/lib/types/seams.d.ts +65 -0
  374. package/packages/host/session-log/lib/types/types.d.ts +132 -0
  375. package/packages/host/session-log/lib/types/wire.d.ts +35 -0
  376. package/packages/host/session-log-export/lib/types/archive.d.ts +74 -0
  377. package/packages/host/session-log-export/lib/types/client.d.ts +197 -0
  378. package/packages/host/session-log-export/lib/types/index.d.ts +42 -0
  379. package/packages/host/session-log-export/lib/types/routes.d.ts +12 -0
  380. package/packages/host/session-log-export/lib/types/types.d.ts +99 -0
  381. package/packages/host/session-reference/lib/types/config.d.ts +36 -0
  382. package/packages/host/session-reference/lib/types/index.d.ts +32 -0
  383. package/packages/host/session-reference/lib/types/projection.d.ts +49 -0
  384. package/packages/host/session-reference/lib/types/serialization.d.ts +14 -0
  385. package/packages/host/session-reference/lib/types/service.d.ts +258 -0
  386. package/packages/host/session-reference/lib/types/spill.d.ts +64 -0
  387. package/packages/host/session-reference/lib/types/typert-host.d.ts +38 -0
  388. package/packages/host/session-reference/lib/types/typert-remote-client.d.ts +2 -0
  389. package/packages/host/session-reference/lib/types/types.d.ts +13 -0
  390. package/packages/host/session-reference/lib/types/uri.d.ts +65 -0
  391. package/packages/host/settings/lib/types/index.d.ts +24 -0
  392. package/packages/host/settings/lib/types/paths.d.ts +37 -0
  393. package/packages/host/settings/lib/types/redact.d.ts +15 -0
  394. package/packages/host/settings/lib/types/schema.d.ts +25 -0
  395. package/packages/host/settings/lib/types/service.d.ts +105 -0
  396. package/packages/host/settings/lib/types/types.d.ts +221 -0
  397. package/packages/host/spill-local/lib/types/cleanup.d.ts +53 -0
  398. package/packages/host/spill-local/lib/types/index.d.ts +117 -0
  399. package/packages/host/spill-local/lib/types/store.d.ts +58 -0
  400. package/packages/host/spill-policy/lib/types/index.d.ts +41 -0
  401. package/packages/host/spill-policy/lib/types/notice.d.ts +23 -0
  402. package/packages/host/spill-policy/lib/types/retention.d.ts +33 -0
  403. package/packages/host/spill-policy/lib/types/types.d.ts +201 -0
  404. package/packages/host/subagent-spawn-in-process/lib/types/index.d.ts +35 -0
  405. package/packages/host/subagent-spawn-in-process/lib/types/provider.d.ts +48 -0
  406. package/packages/host/token-meter/lib/types/breakdown-projection.d.ts +143 -0
  407. package/packages/host/token-meter/lib/types/client.d.ts +10 -0
  408. package/packages/host/token-meter/lib/types/estimate.d.ts +51 -0
  409. package/packages/host/token-meter/lib/types/index.d.ts +111 -0
  410. package/packages/host/token-meter/lib/types/route-pricing.d.ts +74 -0
  411. package/packages/host/token-meter/lib/types/session-event-augmentation.d.ts +95 -0
  412. package/packages/host/token-meter/lib/types/surface-fold.d.ts +79 -0
  413. package/packages/host/token-meter/lib/types/surface-projection.d.ts +55 -0
  414. package/packages/host/token-meter/lib/types/turn-usage.d.ts +43 -0
  415. package/packages/host/token-meter/lib/types/types.d.ts +48 -0
  416. package/packages/host/token-meter/lib/types/usage-projection.d.ts +173 -0
  417. package/packages/host/tool-goal/lib/types/authority.d.ts +55 -0
  418. package/packages/host/tool-goal/lib/types/index.d.ts +51 -0
  419. package/packages/host/tool-goal/lib/types/seams.d.ts +62 -0
  420. package/packages/host/tool-goal/lib/types/wrapup.d.ts +17 -0
  421. package/packages/host/tool-skill/lib/types/config.d.ts +39 -0
  422. package/packages/host/tool-skill/lib/types/index.d.ts +202 -0
  423. package/packages/host/tool-working-directory/lib/types/index.d.ts +22 -0
  424. package/packages/host/web-search/lib/types/index.d.ts +194 -0
  425. package/packages/host/workspace/lib/types/entity.d.ts +129 -0
  426. package/packages/host/workspace/lib/types/errors.d.ts +62 -0
  427. package/packages/host/workspace/lib/types/index.d.ts +42 -0
  428. package/packages/host/workspace/lib/types/paths.d.ts +28 -0
  429. package/packages/host/workspace/lib/types/registry.d.ts +318 -0
  430. package/packages/host/workspace/lib/types/seams.d.ts +177 -0
  431. package/packages/host/workspace/lib/types/spec.d.ts +94 -0
  432. package/packages/host/workspace/lib/types/types.d.ts +133 -0
  433. package/profiles/blackhole/app.patch.yml +0 -109
@@ -102,14 +102,14 @@ function dshManifestPath() {
102
102
  }
103
103
 
104
104
  // apps/cli/src/host.ts
105
- import { spawn, spawnSync as spawnSync3 } from "node:child_process";
106
- import { existsSync as existsSync9, writeFileSync as writeFileSync5 } from "node:fs";
105
+ import { spawn, spawnSync as spawnSync4 } from "node:child_process";
106
+ import { existsSync as existsSync10, writeFileSync as writeFileSync6 } from "node:fs";
107
107
 
108
108
  // apps/cli/src/mount.ts
109
- import { spawnSync } from "node:child_process";
109
+ import { spawnSync as spawnSync2 } from "node:child_process";
110
110
  import { tmpdir } from "node:os";
111
- import { createHash as createHash3 } from "node:crypto";
112
- import { cpSync as cpSync3, existsSync as existsSync6, lstatSync as lstatSync4, mkdirSync as mkdirSync3, mkdtempSync, readFileSync as readFileSync4, readdirSync as readdirSync4, realpathSync as realpathSync2, rmSync as rmSync3, statSync as statSync2, symlinkSync as symlinkSync3, writeFileSync as writeFileSync3 } from "node:fs";
111
+ import { createHash as createHash4 } from "node:crypto";
112
+ import { cpSync as cpSync3, existsSync as existsSync7, lstatSync as lstatSync4, mkdirSync as mkdirSync3, mkdtempSync, readFileSync as readFileSync5, readdirSync as readdirSync5, realpathSync as realpathSync2, rmSync as rmSync3, statSync as statSync3, symlinkSync as symlinkSync3, writeFileSync as writeFileSync4 } from "node:fs";
113
113
 
114
114
  // tools/p1b/denta-profile.ts
115
115
  import { createHash } from "node:crypto";
@@ -337,7 +337,7 @@ if (false)
337
337
  ;
338
338
 
339
339
  // apps/cli/src/mount.ts
340
- import { dirname as dirname5, join as join6, relative } from "node:path";
340
+ import { dirname as dirname5, join as join7, relative } from "node:path";
341
341
 
342
342
  // apps/cli/src/self-links.ts
343
343
  import { existsSync as existsSync3, lstatSync as lstatSync2, mkdirSync, readFileSync as readFileSync2, readdirSync as readdirSync2, symlinkSync } from "node:fs";
@@ -381,17 +381,288 @@ function linkSelfPackages() {
381
381
  return added;
382
382
  }
383
383
 
384
- // apps/cli/src/mount-copy.ts
384
+ // apps/cli/src/mount-gate.ts
385
+ import { spawnSync } from "node:child_process";
385
386
  import { createHash as createHash2 } from "node:crypto";
386
- import { cpSync, existsSync as existsSync4, lstatSync as lstatSync3, readdirSync as readdirSync3, readFileSync as readFileSync3, rmSync, realpathSync, writeFileSync as writeFileSync2 } from "node:fs";
387
- import { dirname as dirname3, join as join4, sep } from "node:path";
387
+ import { existsSync as existsSync4, readFileSync as readFileSync3, readdirSync as readdirSync3, statSync, writeFileSync as writeFileSync2 } from "node:fs";
388
+ import { homedir as homedir2 } from "node:os";
389
+ import { join as join4 } from "node:path";
390
+ var CACHE_NAME = ".gbh-mount-gate.json";
391
+ var CACHE_VERSION = 1;
392
+ var GATE_SOURCES = [
393
+ "tools/check/rows.ts",
394
+ "tools/check/rows-scan.ts",
395
+ "tools/check/dangling.ts",
396
+ "tools/check/row-ids.ts",
397
+ "tools/check/surface.ts",
398
+ "tools/scaffold/lib.ts",
399
+ "apps/cli/src/paths.ts",
400
+ "apps/cli/src/mount-gate.ts"
401
+ ];
402
+ function isBunProcess() {
403
+ if (typeof globalThis.Bun !== "undefined")
404
+ return true;
405
+ return typeof process.versions.bun === "string";
406
+ }
407
+ function scriptNeedsBun(source) {
408
+ if (!/\bBun\s*\./u.test(source))
409
+ return false;
410
+ return !/typeof\s+Bun\b/u.test(source);
411
+ }
412
+ function readScriptSource(script) {
413
+ try {
414
+ return readFileSync3(script, "utf8");
415
+ } catch {
416
+ return;
417
+ }
418
+ }
419
+ function isFile(path) {
420
+ try {
421
+ return statSync(path).isFile();
422
+ } catch {
423
+ return false;
424
+ }
425
+ }
426
+ function findBun(env = process.env, exists = isFile) {
427
+ const pinned = (env.GBH_BUN ?? "").trim();
428
+ if (pinned !== "" && exists(pinned))
429
+ return pinned;
430
+ const home = env.HOME ?? homedir2();
431
+ const candidates = [join4(home, ".bun", "bin", "bun"), "/opt/homebrew/bin/bun", "/usr/local/bin/bun"];
432
+ for (const candidate of candidates)
433
+ if (exists(candidate))
434
+ return candidate;
435
+ for (const dir of (env.PATH ?? "").split(":")) {
436
+ if (dir === "")
437
+ continue;
438
+ const candidate = join4(dir, "bun");
439
+ if (exists(candidate))
440
+ return candidate;
441
+ }
442
+ return;
443
+ }
444
+ function nodeScriptCommand(script, execPath = process.execPath, extra = []) {
445
+ return { command: execPath, args: ["--experimental-strip-types", script, ...extra], runtime: "node", source: "process.execPath" };
446
+ }
447
+ function bunScriptCommand(bunPath, script, extra = [], source = "bun") {
448
+ return { command: bunPath, args: ["run", script, ...extra], runtime: "bun", source };
449
+ }
450
+ function bunOnlyCommand(script, extra = [], env = process.env) {
451
+ if (isBunProcess())
452
+ return bunScriptCommand(process.execPath, script, extra, "process.execPath (Bun)");
453
+ const bun = findBun(env);
454
+ return bun === undefined ? undefined : bunScriptCommand(bun, script, extra, bun);
455
+ }
456
+ function spawnScript(command, cwd, timeoutMs) {
457
+ const result = spawnSync(command.command, command.args, { cwd, encoding: "utf8", timeout: timeoutMs });
458
+ return {
459
+ output: (result.stdout ?? "") + (result.stderr ?? ""),
460
+ status: result.status,
461
+ ...result.error === undefined ? {} : { error: String(result.error) }
462
+ };
463
+ }
464
+ function hasVerdictTable(output) {
465
+ return /^\| Package \|/mu.test(output);
466
+ }
467
+ function hashFile(hash, path, label) {
468
+ hash.update(label);
469
+ if (!existsSync4(path)) {
470
+ hash.update("missing");
471
+ return;
472
+ }
473
+ hash.update(readFileSync3(path));
474
+ }
475
+ function hashStat(hash, path, label) {
476
+ try {
477
+ const st = statSync(path);
478
+ hash.update(label + ":" + String(st.size) + ":" + String(Math.trunc(st.mtimeMs)));
479
+ } catch {
480
+ hash.update(label + ":missing");
481
+ }
482
+ }
483
+ function hashTree(hash, base, label) {
484
+ let count = 0;
485
+ const walk = (dir) => {
486
+ let names;
487
+ try {
488
+ names = readdirSync3(dir).sort();
489
+ } catch {
490
+ return;
491
+ }
492
+ for (const name of names) {
493
+ if (name === "node_modules" || name.startsWith("."))
494
+ continue;
495
+ const abs = join4(dir, name);
496
+ let st;
497
+ try {
498
+ st = statSync(abs);
499
+ } catch {
500
+ continue;
501
+ }
502
+ if (st.isDirectory())
503
+ walk(abs);
504
+ else {
505
+ hash.update(label + "/" + abs.slice(base.length) + ":" + String(st.size) + ":" + String(Math.trunc(st.mtimeMs)));
506
+ count += 1;
507
+ }
508
+ }
509
+ };
510
+ walk(base);
511
+ return count;
512
+ }
513
+ function rowPackageDirs(repo) {
514
+ const out = [];
515
+ for (const area of ["host", "client"]) {
516
+ const dir = join4(repo, "packages", area);
517
+ let names;
518
+ try {
519
+ names = readdirSync3(dir).sort();
520
+ } catch {
521
+ continue;
522
+ }
523
+ for (const name of names) {
524
+ const pkgDir = join4(dir, name);
525
+ if (!existsSync4(join4(pkgDir, "package.json")))
526
+ continue;
527
+ try {
528
+ const json = JSON.parse(readFileSync3(join4(pkgDir, "package.json"), "utf8"));
529
+ if (json.gbh?.row !== undefined)
530
+ out.push(pkgDir);
531
+ } catch {}
532
+ }
533
+ }
534
+ return out;
535
+ }
536
+ function gateFingerprint(repo, home, mode) {
537
+ const hash = createHash2("sha256");
538
+ hash.update("gbh-mount-gate:" + String(CACHE_VERSION) + ":" + mode + ":node" + process.versions.node);
539
+ hash.update("home:" + home);
540
+ for (const rel of GATE_SOURCES)
541
+ hashFile(hash, join4(repo, rel), rel);
542
+ hashFile(hash, join4(repo, "docs", "PARITY-MATRIX.md"), "docs/PARITY-MATRIX.md");
543
+ hashFile(hash, join4(home, "app.patch.yml"), "app.patch.yml");
544
+ const stock = join4(repo, "apps", "host", "node_modules", "@deepseek-ai");
545
+ let stockNames = [];
546
+ try {
547
+ stockNames = readdirSync3(stock).sort();
548
+ } catch {}
549
+ for (const name of stockNames)
550
+ hashStat(hash, join4(stock, name, "package.json"), "@deepseek-ai/" + name);
551
+ const profileModules = join4(home, "profiles", "node_modules");
552
+ for (const pkgDir of rowPackageDirs(repo)) {
553
+ hash.update("pkg:" + pkgDir.slice(repo.length));
554
+ const manifest = readFileSync3(join4(pkgDir, "package.json"), "utf8");
555
+ hash.update("package.json");
556
+ hash.update(manifest);
557
+ hashStat(hash, join4(pkgDir, "build.ts"), "build.ts");
558
+ hashStat(hash, join4(pkgDir, "lib", "index.js"), "lib/index.js");
559
+ hashStat(hash, join4(pkgDir, "lib", "client.js"), "lib/client.js");
560
+ hashTree(hash, join4(pkgDir, "src"), "src");
561
+ const name = JSON.parse(manifest).name ?? "";
562
+ if (name !== "") {
563
+ hashStat(hash, join4(profileModules, name, "lib", "index.js"), "profile/index.js");
564
+ hashStat(hash, join4(profileModules, name, "lib", "client.js"), "profile/client.js");
565
+ }
566
+ }
567
+ return hash.digest("hex");
568
+ }
569
+ function readGateCache(home, key) {
570
+ try {
571
+ const parsed = JSON.parse(readFileSync3(join4(home, CACHE_NAME), "utf8"));
572
+ if (parsed.version !== CACHE_VERSION || parsed.key !== key || typeof parsed.output !== "string")
573
+ return;
574
+ if (!hasVerdictTable(parsed.output))
575
+ return;
576
+ return { output: parsed.output, runtime: typeof parsed.runtime === "string" ? parsed.runtime : "gate" };
577
+ } catch {
578
+ return;
579
+ }
580
+ }
581
+ function writeGateCache(home, key, output, runtime = "gate") {
582
+ try {
583
+ writeFileSync2(join4(home, CACHE_NAME), JSON.stringify({ version: CACHE_VERSION, key, output, runtime, savedAt: new Date().toISOString() }) + `
584
+ `, "utf8");
585
+ } catch {}
586
+ }
587
+ function runMountGate(options) {
588
+ const started2 = performance.now();
589
+ const env = options.env ?? process.env;
590
+ const refresh = options.refresh === true || (env.GBH_GATE_REFRESH ?? "").trim() === "1";
591
+ const bunProcess = options.bunProcess ?? isBunProcess();
592
+ const execPath = options.execPath ?? process.execPath;
593
+ const run = options.run ?? spawnScript;
594
+ const timeoutMs = options.timeoutMs ?? 120000;
595
+ const mode = bunProcess ? "bun-build" : "node-prebuilt";
596
+ let key;
597
+ try {
598
+ key = gateFingerprint(options.cwd, options.home, mode);
599
+ } catch {
600
+ key = undefined;
601
+ }
602
+ if (!refresh && key !== undefined) {
603
+ const cached = readGateCache(options.home, key);
604
+ if (cached !== undefined) {
605
+ return { output: cached.output, detail: "cache · " + cached.runtime + " (nguon khong doi) · " + (performance.now() - started2).toFixed(0) + " ms", cached: true, ms: performance.now() - started2 };
606
+ }
607
+ }
608
+ const describe = (command, result, extra = "") => {
609
+ const ms2 = performance.now() - started2;
610
+ const detail = command.runtime + " (" + command.source + ") · " + ms2.toFixed(0) + " ms" + extra;
611
+ return { output: result.output, detail, cached: false, ms: ms2 };
612
+ };
613
+ if (bunProcess) {
614
+ const command = bunScriptCommand(execPath, options.script, [], "process.execPath (Bun)");
615
+ const result = run(command, options.cwd, timeoutMs);
616
+ if (hasVerdictTable(result.output)) {
617
+ if (key !== undefined)
618
+ writeGateCache(options.home, key, result.output, command.runtime);
619
+ return describe(command, result);
620
+ }
621
+ return { ...describe(command, result), warning: "cong chan mount loi: " + (result.error ?? (result.output.trim().slice(0, 200) || "khong ro")) };
622
+ }
623
+ const source = options.scriptSource ?? readScriptSource(options.script);
624
+ const requiresBun = source !== undefined && scriptNeedsBun(source);
625
+ const node = nodeScriptCommand(options.script, execPath);
626
+ const nodeResult = requiresBun ? undefined : run(node, options.cwd, timeoutMs);
627
+ if (nodeResult !== undefined && hasVerdictTable(nodeResult.output)) {
628
+ if (key !== undefined)
629
+ writeGateCache(options.home, key, nodeResult.output, node.runtime);
630
+ return describe(node, nodeResult);
631
+ }
632
+ const bunPath = (options.findBunPath ?? (() => findBun(env)))();
633
+ if (bunPath !== undefined) {
634
+ const bun = bunScriptCommand(bunPath, options.script, [], bunPath);
635
+ const bunResult = run(bun, options.cwd, timeoutMs);
636
+ if (hasVerdictTable(bunResult.output)) {
637
+ if (key !== undefined)
638
+ writeGateCache(options.home, key, bunResult.output, bun.runtime);
639
+ return describe(bun, bunResult, requiresBun ? " · script can bun" : " · node loi nen dung bun");
640
+ }
641
+ return { ...describe(bun, bunResult), warning: "cong chan mount loi: " + (bunResult.error ?? (bunResult.output.trim().slice(0, 200) || "khong ro")) };
642
+ }
643
+ const ms = performance.now() - started2;
644
+ const loiNode = nodeResult === undefined ? "" : (nodeResult.error ?? (nodeResult.output.trim().split(String.fromCharCode(10))[0] ?? "")).slice(0, 160);
645
+ const viSao = requiresBun ? "script " + options.script + " dùng API bun (Bun.build) nên Node không chạy được" : "node không chạy được " + options.script + (loiNode === "" ? "" : " (" + loiNode + ")");
646
+ return {
647
+ output: nodeResult?.output ?? "",
648
+ detail: requiresBun ? "bo qua node (script can bun) · " + ms.toFixed(0) + " ms" : "node (" + node.source + ") · " + ms.toFixed(0) + " ms",
649
+ warning: "cổng chặn mount bị bỏ qua: " + viSao + " và máy không có bun — cài bun hoặc đặt GBH_BUN=<đường dẫn bun>",
650
+ cached: false,
651
+ ms
652
+ };
653
+ }
654
+
655
+ // apps/cli/src/mount-copy.ts
656
+ import { createHash as createHash3 } from "node:crypto";
657
+ import { cpSync, existsSync as existsSync5, lstatSync as lstatSync3, readdirSync as readdirSync4, readFileSync as readFileSync4, rmSync, realpathSync, writeFileSync as writeFileSync3 } from "node:fs";
658
+ import { dirname as dirname3, join as join5, sep } from "node:path";
388
659
  function trungNguon(dich, nguon) {
389
660
  const giai = (p) => {
390
661
  try {
391
662
  return realpathSync(p);
392
663
  } catch {
393
664
  try {
394
- return join4(realpathSync(dirname3(p)), p.slice(p.lastIndexOf("/") + 1));
665
+ return join5(realpathSync(dirname3(p)), p.slice(p.lastIndexOf("/") + 1));
395
666
  } catch {
396
667
  return null;
397
668
  }
@@ -404,16 +675,16 @@ function trungNguon(dich, nguon) {
404
675
  return a === b || a.startsWith(b + sep) || b.startsWith(a + sep);
405
676
  }
406
677
  function vanTayCay(goc) {
407
- const hash = createHash2("sha256");
678
+ const hash = createHash3("sha256");
408
679
  const duyet = (thuMuc) => {
409
680
  let muc = [];
410
681
  try {
411
- muc = readdirSync3(thuMuc).sort();
682
+ muc = readdirSync4(thuMuc).sort();
412
683
  } catch {
413
684
  return;
414
685
  }
415
686
  for (const ten of muc) {
416
- const duong = join4(thuMuc, ten);
687
+ const duong = join5(thuMuc, ten);
417
688
  let thongTin;
418
689
  try {
419
690
  thongTin = lstatSync3(duong);
@@ -442,36 +713,36 @@ function vanTayCay(goc) {
442
713
  function chepThuMucCon(dich, nguon, ten) {
443
714
  if (trungNguon(dich, nguon))
444
715
  return false;
445
- const src = join4(nguon, ten);
446
- if (!existsSync4(src))
716
+ const src = join5(nguon, ten);
717
+ if (!existsSync5(src))
447
718
  return false;
448
- const dest = join4(dich, ten);
719
+ const dest = join5(dich, ten);
449
720
  if (trungNguon(dest, src)) {
450
721
  if (process.env.BH_TRACE === "1")
451
722
  console.log("[trace] bo qua chep " + ten + " (dich la symlink ve nguon): " + dest);
452
723
  return false;
453
724
  }
454
- const stampPath = join4(dich, ".gbh-copy-" + ten + ".stamp");
725
+ const stampPath = join5(dich, ".gbh-copy-" + ten + ".stamp");
455
726
  const vanTay = vanTayCay(src);
456
- if (existsSync4(dest)) {
727
+ if (existsSync5(dest)) {
457
728
  try {
458
- if (readFileSync3(stampPath, "utf8").trim() === vanTay)
729
+ if (readFileSync4(stampPath, "utf8").trim() === vanTay)
459
730
  return false;
460
731
  } catch {}
461
732
  }
462
733
  rmSync(dest, { recursive: true, force: true });
463
734
  cpSync(src, dest, { recursive: true });
464
735
  try {
465
- writeFileSync2(stampPath, vanTay + `
736
+ writeFileSync3(stampPath, vanTay + `
466
737
  `);
467
738
  } catch {}
468
739
  return true;
469
740
  }
470
741
  function chiCoKhaiKieu(thuMucGoi) {
471
- const t = join4(thuMucGoi, "lib", "types");
472
- if (!existsSync4(t))
742
+ const t = join5(thuMucGoi, "lib", "types");
743
+ if (!existsSync5(t))
473
744
  return false;
474
- const ds = readdirSync3(t);
745
+ const ds = readdirSync4(t);
475
746
  return ds.length > 0 && ds.every((f) => f.endsWith(".d.ts"));
476
747
  }
477
748
 
@@ -618,10 +889,10 @@ function readPeers(gbh) {
618
889
  }
619
890
 
620
891
  // apps/cli/src/prebuilt.ts
621
- import { cpSync as cpSync2, existsSync as existsSync5, mkdirSync as mkdirSync2, readlinkSync, rmSync as rmSync2, statSync, symlinkSync as symlinkSync2 } from "node:fs";
622
- import { dirname as dirname4, join as join5, resolve as resolve2 } from "node:path";
892
+ import { cpSync as cpSync2, existsSync as existsSync6, mkdirSync as mkdirSync2, readlinkSync, rmSync as rmSync2, statSync as statSync2, symlinkSync as symlinkSync2 } from "node:fs";
893
+ import { dirname as dirname4, join as join6, resolve as resolve2 } from "node:path";
623
894
  function embeddedHost() {
624
- return existsSync5(join5(repoRoot(), ".gbh-embedded"));
895
+ return existsSync6(join6(repoRoot(), ".gbh-embedded"));
625
896
  }
626
897
  function prebuiltLibs(env = process.env, embedded = embeddedHost()) {
627
898
  const flag = (env.GBH_PREBUILT_LIB ?? "").trim();
@@ -632,16 +903,18 @@ function prebuiltLibs(env = process.env, embedded = embeddedHost()) {
632
903
  return embedded;
633
904
  }
634
905
  function buildRuntimeAvailable() {
635
- return typeof globalThis.Bun !== "undefined";
906
+ if (typeof globalThis.Bun !== "undefined")
907
+ return true;
908
+ return typeof process.versions.bun === "string";
636
909
  }
637
910
  function ensureLink(link, target) {
638
911
  try {
639
912
  const current = readlinkSync(link);
640
- if (existsSync5(resolve2(dirname4(link), current)))
913
+ if (existsSync6(resolve2(dirname4(link), current)))
641
914
  return false;
642
915
  rmSync2(link, { force: true });
643
916
  } catch {
644
- if (existsSync5(link))
917
+ if (existsSync6(link))
645
918
  return false;
646
919
  }
647
920
  try {
@@ -653,14 +926,14 @@ function ensureLink(link, target) {
653
926
  }
654
927
  }
655
928
  function installPrebuiltLib(sourceDir, libDir) {
656
- const source = join5(sourceDir, "lib");
657
- const entry = ["index.js", "client.js"].map((name) => join5(source, name)).find((file) => existsSync5(file));
929
+ const source = join6(sourceDir, "lib");
930
+ const entry = ["index.js", "client.js"].map((name) => join6(source, name)).find((file) => existsSync6(file));
658
931
  if (entry === undefined)
659
932
  return false;
660
933
  try {
661
- const c_ = statSync(entry).mtimeMs;
662
- const đ_ch = join5(libDir, entry.slice(source.length + 1));
663
- if (existsSync5(đ_ch) && statSync(đ_ch).mtimeMs >= c_)
934
+ const c_ = statSync2(entry).mtimeMs;
935
+ const đ_ch = join6(libDir, entry.slice(source.length + 1));
936
+ if (existsSync6(đ_ch) && statSync2(đ_ch).mtimeMs >= c_)
664
937
  return false;
665
938
  mkdirSync2(libDir, { recursive: true });
666
939
  cpSync2(source, libDir, { recursive: true, force: true });
@@ -726,28 +999,34 @@ function parseRowVerdicts(output) {
726
999
  }
727
1000
  function blockedPackages() {
728
1001
  const blocked = new Map;
729
- const script = join6(repoRoot(), "tools", "check", "rows.ts");
730
- if (!existsSync6(script))
1002
+ const script = join7(repoRoot(), "tools", "check", "rows.ts");
1003
+ if (!existsSync7(script)) {
1004
+ console.warn("[bh] cổng chặn mount bị bỏ qua vì thiếu " + script + " — bản đóng gói không kèm tools/check; đặt GBH_REPO_ROOT về repo để bật cổng");
731
1005
  return blocked;
732
- const result = spawnSync(process.execPath, ["run", script], { cwd: repoRoot(), encoding: "utf8", timeout: 120000 });
733
- const output = (result.stdout ?? "") + (result.stderr ?? "");
734
- const verdicts = parseRowVerdicts(output);
1006
+ }
1007
+ const gate = timePhase("cong chan mount", () => runMountGate({ script, cwd: repoRoot(), home: appHome() }));
1008
+ console.log("[bh] cổng chặn mount: " + gate.detail);
1009
+ if (gate.warning !== undefined)
1010
+ console.warn("[bh] " + gate.warning);
1011
+ const verdicts = parseRowVerdicts(gate.output);
735
1012
  for (const verdict of verdicts) {
736
1013
  if (verdict.level === "chan")
737
1014
  continue;
738
1015
  console.log("[bh] " + verdict.pkg + ": " + verdict.level + ", van mount — " + verdict.reason);
739
1016
  }
740
1017
  for (const verdict of verdicts) {
741
- if (verdict.level === "chan")
742
- blocked.set(verdict.pkg, verdict.reason);
1018
+ if (verdict.level !== "chan")
1019
+ continue;
1020
+ blocked.set(verdict.pkg, verdict.reason);
1021
+ console.warn("[bh] CHẶN mount " + verdict.pkg + " — " + verdict.reason);
743
1022
  }
744
1023
  return blocked;
745
1024
  }
746
1025
  function rewritePackages() {
747
- const root = join6(repoRoot(), "packages");
1026
+ const root = join7(repoRoot(), "packages");
748
1027
  const found = [];
749
1028
  for (const dir of findPackageDirs(root)) {
750
- const text = readFileSync4(join6(dir, "package.json"), "utf8");
1029
+ const text = readFileSync5(join7(dir, "package.json"), "utf8");
751
1030
  const metadata = parseGbhMetadata(text);
752
1031
  const nested = readNestedDeclaration(text);
753
1032
  if (metadata?.row === undefined && nested === undefined)
@@ -764,7 +1043,7 @@ function rewritePackages() {
764
1043
  specifier,
765
1044
  sourceDir: dir,
766
1045
  peers: [...new Set(["@deepseek-ai/cordis", "@deepseek-ai/schemastery", ...metadata?.peers ?? []])],
767
- reference: join6(relative(repoRoot(), dir), "README.md"),
1046
+ reference: join7(relative(repoRoot(), dir), "README.md"),
768
1047
  ...metadata?.row === undefined ? {} : { row: metadata.row },
769
1048
  ...nested === undefined ? {} : { nested },
770
1049
  ...nested?.hostAliases === undefined ? {} : { hostAliases: nested.hostAliases }
@@ -777,7 +1056,7 @@ function findPackageDirs(root) {
777
1056
  const walk = (dir) => {
778
1057
  let entries;
779
1058
  try {
780
- entries = readdirSync4(dir).sort();
1059
+ entries = readdirSync5(dir).sort();
781
1060
  } catch {
782
1061
  return;
783
1062
  }
@@ -786,9 +1065,9 @@ function findPackageDirs(root) {
786
1065
  for (const entry of entries) {
787
1066
  if (entry === "node_modules" || entry === "lib" || entry === "dist" || entry.startsWith("."))
788
1067
  continue;
789
- const child = join6(dir, entry);
1068
+ const child = join7(dir, entry);
790
1069
  try {
791
- if (statSync2(child).isDirectory())
1070
+ if (statSync3(child).isDirectory())
792
1071
  walk(child);
793
1072
  } catch {}
794
1073
  }
@@ -797,7 +1076,7 @@ function findPackageDirs(root) {
797
1076
  return out;
798
1077
  }
799
1078
  function profileModulesDir() {
800
- return join6(appHome(), "profiles", "node_modules");
1079
+ return join7(appHome(), "profiles", "node_modules");
801
1080
  }
802
1081
  function kernelModulesDir2() {
803
1082
  return kernelModulesDir();
@@ -806,39 +1085,42 @@ function buildIfStale(pkg, libDir) {
806
1085
  if (prebuiltLibs())
807
1086
  return installPrebuiltLib(pkg.sourceDir, libDir);
808
1087
  if (embeddedHost())
809
- return existsSync6(join6(libDir, "index.js"));
810
- if (!buildRuntimeAvailable() && (existsSync6(join6(pkg.sourceDir, "lib", "index.js")) || existsSync6(join6(pkg.sourceDir, "lib", "client.js")))) {
1088
+ return existsSync7(join7(libDir, "index.js"));
1089
+ if (!buildRuntimeAvailable() && (existsSync7(join7(pkg.sourceDir, "lib", "index.js")) || existsSync7(join7(pkg.sourceDir, "lib", "client.js")))) {
811
1090
  return installPrebuiltLib(pkg.sourceDir, libDir);
812
1091
  }
813
- if (process.env.BH_SKIP_BUILD === "1" && existsSync6(join6(libDir, "index.js")))
1092
+ if (process.env.BH_SKIP_BUILD === "1" && existsSync7(join7(libDir, "index.js")))
814
1093
  return false;
815
- const hasClientSource = existsSync6(join6(pkg.sourceDir, "src", "client.ts"));
1094
+ const hasClientSource = existsSync7(join7(pkg.sourceDir, "src", "client.ts"));
816
1095
  const outputs = hasClientSource ? ["index.js", "client.js"] : ["index.js"];
817
- const stampPath = join6(libDir, ".gbh-build-stamp");
1096
+ const stampPath = join7(libDir, ".gbh-build-stamp");
818
1097
  const stamp = sourceStamp(pkg.sourceDir);
819
- const previous2 = existsSync6(stampPath) ? readFileSync4(stampPath, "utf8").trim() : "";
820
- const missingOutput = outputs.some((file) => !existsSync6(join6(libDir, file)));
1098
+ const previous2 = existsSync7(stampPath) ? readFileSync5(stampPath, "utf8").trim() : "";
1099
+ const missingOutput = outputs.some((file) => !existsSync7(join7(libDir, file)));
821
1100
  if (!missingOutput && previous2 === stamp)
822
1101
  return false;
823
- const thuMucTypes = join6(libDir, "types");
1102
+ const thuMucTypes = join7(libDir, "types");
824
1103
  let banSaoTypes;
825
- if (existsSync6(thuMucTypes)) {
1104
+ if (existsSync7(thuMucTypes)) {
826
1105
  try {
827
- banSaoTypes = mkdtempSync(join6(tmpdir(), "gbh-types-"));
828
- cpSync3(thuMucTypes, join6(banSaoTypes, "types"), { recursive: true });
1106
+ banSaoTypes = mkdtempSync(join7(tmpdir(), "gbh-types-"));
1107
+ cpSync3(thuMucTypes, join7(banSaoTypes, "types"), { recursive: true });
829
1108
  } catch (error) {
830
1109
  banSaoTypes = undefined;
831
1110
  console.log("[bh] canh bao: khong snapshot duoc lib/types cua " + pkg.specifier + " (" + String(error).slice(0, 80) + ")");
832
1111
  }
833
1112
  }
834
- const result = spawnSync(process.execPath, ["run", join6(pkg.sourceDir, "build.ts"), libDir], {
1113
+ const build = bunOnlyCommand(join7(pkg.sourceDir, "build.ts"), [libDir]);
1114
+ if (build === undefined)
1115
+ throw new Error("khong build duoc " + pkg.specifier + ": thieu bun — cài bun hoặc đặt GBH_BUN");
1116
+ const result = spawnSync2(build.command, build.args, {
835
1117
  cwd: pkg.sourceDir,
836
1118
  encoding: "utf8",
837
1119
  timeout: 60000
838
1120
  });
839
1121
  if (banSaoTypes !== undefined) {
840
1122
  try {
841
- cpSync3(join6(banSaoTypes, "types"), thuMucTypes, { recursive: true, force: true });
1123
+ cpSync3(join7(banSaoTypes, "types"), thuMucTypes, { recursive: true, force: true });
842
1124
  } catch (error) {
843
1125
  console.log("[bh] canh bao: khong phuc hoi duoc lib/types cua " + pkg.specifier + " (" + String(error).slice(0, 80) + ")");
844
1126
  }
@@ -850,43 +1132,43 @@ function buildIfStale(pkg, libDir) {
850
1132
  throw new Error("khong build duoc " + pkg.specifier + ": " + (result.stderr.trim() || result.stdout.trim() || "loi khong ro"));
851
1133
  }
852
1134
  mkdirSync3(libDir, { recursive: true });
853
- writeFileSync3(stampPath, stamp + `
1135
+ writeFileSync4(stampPath, stamp + `
854
1136
  `, "utf8");
855
1137
  return true;
856
1138
  }
857
1139
  function sourceStamp(sourceDir) {
858
- const hash = createHash3("sha256");
1140
+ const hash = createHash4("sha256");
859
1141
  const files = [];
860
1142
  const walk = (dir) => {
861
- if (!existsSync6(dir))
1143
+ if (!existsSync7(dir))
862
1144
  return;
863
- for (const name of readdirSync4(dir).sort()) {
1145
+ for (const name of readdirSync5(dir).sort()) {
864
1146
  if (name === "node_modules")
865
1147
  continue;
866
- const abs = join6(dir, name);
867
- if (statSync2(abs).isDirectory())
1148
+ const abs = join7(dir, name);
1149
+ if (statSync3(abs).isDirectory())
868
1150
  walk(abs);
869
1151
  else
870
1152
  files.push(abs);
871
1153
  }
872
1154
  };
873
- walk(join6(sourceDir, "src"));
874
- const buildTs = join6(sourceDir, "build.ts");
875
- if (existsSync6(buildTs))
1155
+ walk(join7(sourceDir, "src"));
1156
+ const buildTs = join7(sourceDir, "build.ts");
1157
+ if (existsSync7(buildTs))
876
1158
  files.push(buildTs);
877
1159
  for (const abs of files.sort()) {
878
1160
  hash.update(abs.slice(sourceDir.length));
879
1161
  hash.update("\x00");
880
- hash.update(readFileSync4(abs));
1162
+ hash.update(readFileSync5(abs));
881
1163
  hash.update("\x00");
882
1164
  }
883
1165
  return hash.digest("hex");
884
1166
  }
885
1167
  function mountRewritePackage(pkg) {
886
- const dir = join6(profileModulesDir(), pkg.specifier);
1168
+ const dir = join7(profileModulesDir(), pkg.specifier);
887
1169
  const peers = [];
888
1170
  try {
889
- if (!existsSync6(join6(pkg.sourceDir, "package.json"))) {
1171
+ if (!existsSync7(join7(pkg.sourceDir, "package.json"))) {
890
1172
  return { specifier: pkg.specifier, row: pkg.row, dir, built: false, peers, ok: false, detail: "thieu nguon " + pkg.sourceDir };
891
1173
  }
892
1174
  const trace = process.env.BH_TRACE === "1" ? (step) => {
@@ -896,15 +1178,15 @@ function mountRewritePackage(pkg) {
896
1178
  let built = false;
897
1179
  let buildError = "";
898
1180
  try {
899
- built = buildIfStale(pkg, join6(dir, "lib"));
1181
+ built = buildIfStale(pkg, join7(dir, "lib"));
900
1182
  } catch (error) {
901
1183
  buildError = String(error);
902
1184
  }
903
1185
  if (buildError !== "") {
904
- const repoLib = join6(pkg.sourceDir, "lib");
905
- if (existsSync6(join6(repoLib, "index.js"))) {
906
- mkdirSync3(join6(dir, "lib"), { recursive: true });
907
- cpSync3(repoLib, join6(dir, "lib"), { recursive: true });
1186
+ const repoLib = join7(pkg.sourceDir, "lib");
1187
+ if (existsSync7(join7(repoLib, "index.js"))) {
1188
+ mkdirSync3(join7(dir, "lib"), { recursive: true });
1189
+ cpSync3(repoLib, join7(dir, "lib"), { recursive: true });
908
1190
  if (!embeddedHost())
909
1191
  console.log("[bh] " + pkg.specifier + ": dung artefact co san trong repo (build loi: " + buildError.slice(0, 120) + ")");
910
1192
  } else {
@@ -913,23 +1195,23 @@ function mountRewritePackage(pkg) {
913
1195
  }
914
1196
  trace("build xong built=" + String(built));
915
1197
  mkdirSync3(dir, { recursive: true });
916
- const manifestNguon = readFileSync4(join6(pkg.sourceDir, "package.json"), "utf8");
917
- const manifestDich = join6(dir, "package.json");
918
- if (!existsSync6(manifestDich) || readFileSync4(manifestDich, "utf8") !== manifestNguon)
919
- writeFileSync3(manifestDich, manifestNguon);
1198
+ const manifestNguon = readFileSync5(join7(pkg.sourceDir, "package.json"), "utf8");
1199
+ const manifestDich = join7(dir, "package.json");
1200
+ if (!existsSync7(manifestDich) || readFileSync5(manifestDich, "utf8") !== manifestNguon)
1201
+ writeFileSync4(manifestDich, manifestNguon);
920
1202
  chepThuMucCon(dir, pkg.sourceDir, "locale");
921
1203
  chepThuMucCon(dir, pkg.sourceDir, "assets");
922
1204
  chepThuMucCon(dir, pkg.sourceDir, "runtime");
923
1205
  for (const ten of ["icon.svg", "icon.png"]) {
924
- const nguonIcon = join6(pkg.sourceDir, ten);
925
- if (existsSync6(nguonIcon))
926
- cpSync3(nguonIcon, join6(dir, ten));
1206
+ const nguonIcon = join7(pkg.sourceDir, ten);
1207
+ if (existsSync7(nguonIcon))
1208
+ cpSync3(nguonIcon, join7(dir, ten));
927
1209
  }
928
1210
  trace("chuan bi peer " + String(pkg.peers.length));
929
1211
  for (const peer of pkg.peers) {
930
- const link = join6(profileModulesDir(), peer);
931
- const source = join6(kernelModulesDir2(), peer);
932
- if (!existsSync6(source)) {
1212
+ const link = join7(profileModulesDir(), peer);
1213
+ const source = join7(kernelModulesDir2(), peer);
1214
+ if (!existsSync7(source)) {
933
1215
  if (peer.startsWith("@galaxy-blackhole/"))
934
1216
  continue;
935
1217
  return { specifier: pkg.specifier, row: pkg.row, dir, built, peers, ok: false, detail: "thieu peer trong kernel: " + source };
@@ -949,21 +1231,21 @@ function linkInfrastructurePackages() {
949
1231
  const linked = [];
950
1232
  const modules = profileModulesDir();
951
1233
  for (const ten of ["cordis", "schemastery", "cosmokit"]) {
952
- const nguon = join6(repoRoot(), "packages", "host", ten);
953
- const manifest = join6(nguon, "package.json");
954
- if (!existsSync6(manifest))
1234
+ const nguon = join7(repoRoot(), "packages", "host", ten);
1235
+ const manifest = join7(nguon, "package.json");
1236
+ if (!existsSync7(manifest))
955
1237
  continue;
956
1238
  let specifier;
957
1239
  try {
958
- specifier = JSON.parse(readFileSync4(manifest, "utf8")).name;
1240
+ specifier = JSON.parse(readFileSync5(manifest, "utf8")).name;
959
1241
  } catch {
960
1242
  continue;
961
1243
  }
962
1244
  if (typeof specifier !== "string")
963
1245
  continue;
964
- const link = join6(modules, specifier);
1246
+ const link = join7(modules, specifier);
965
1247
  try {
966
- if (existsSync6(link) || lstatSync4(link).isSymbolicLink())
1248
+ if (existsSync7(link) || lstatSync4(link).isSymbolicLink())
967
1249
  continue;
968
1250
  } catch {}
969
1251
  try {
@@ -981,10 +1263,10 @@ function linkInfrastructurePackages() {
981
1263
  function linkNativeAddonPackages() {
982
1264
  const linked = [];
983
1265
  const nguonModules = kernelModulesDir2();
984
- const thuMucStock = join6(nguonModules, "@deepseek-ai");
1266
+ const thuMucStock = join7(nguonModules, "@deepseek-ai");
985
1267
  let ten = [];
986
1268
  try {
987
- ten = readdirSync4(thuMucStock);
1269
+ ten = readdirSync5(thuMucStock);
988
1270
  } catch {
989
1271
  return linked;
990
1272
  }
@@ -992,10 +1274,10 @@ function linkNativeAddonPackages() {
992
1274
  for (const goi of ten) {
993
1275
  if (!mau.test(goi))
994
1276
  continue;
995
- const nguon = join6(thuMucStock, goi);
996
- const link = join6(profileModulesDir(), "@deepseek-ai", goi);
1277
+ const nguon = join7(thuMucStock, goi);
1278
+ const link = join7(profileModulesDir(), "@deepseek-ai", goi);
997
1279
  try {
998
- if (existsSync6(link))
1280
+ if (existsSync7(link))
999
1281
  continue;
1000
1282
  } catch {}
1001
1283
  try {
@@ -1013,10 +1295,10 @@ function linkNativeAddonPackages() {
1013
1295
  function ensureRewriteMounts() {
1014
1296
  linkSelfPackages();
1015
1297
  const disabled = (process.env.GBH_DISABLE_REWRITES ?? "").trim() !== "";
1016
- const blocked = blockedPackages();
1298
+ const blocked = disabled ? new Map : blockedPackages();
1017
1299
  const results = rewritePackages().map((pkg) => disabled ? {
1018
1300
  specifier: pkg.specifier,
1019
- dir: join6(profileModulesDir(), pkg.specifier),
1301
+ dir: join7(profileModulesDir(), pkg.specifier),
1020
1302
  built: false,
1021
1303
  peers: [],
1022
1304
  ok: false,
@@ -1024,7 +1306,7 @@ function ensureRewriteMounts() {
1024
1306
  } : blocked.has(pkg.specifier) ? {
1025
1307
  specifier: pkg.specifier,
1026
1308
  row: pkg.row,
1027
- dir: join6(profileModulesDir(), pkg.specifier),
1309
+ dir: join7(profileModulesDir(), pkg.specifier),
1028
1310
  built: false,
1029
1311
  peers: [],
1030
1312
  ok: false,
@@ -1047,30 +1329,30 @@ function chepIconVaoProfile() {
1047
1329
  let soIcon = 0;
1048
1330
  const gocProfile = profileModulesDir();
1049
1331
  for (const nhom of ["host", "client", "tools"]) {
1050
- const thuMuc = join6(repoRoot(), "packages", nhom);
1332
+ const thuMuc = join7(repoRoot(), "packages", nhom);
1051
1333
  let ten = [];
1052
1334
  try {
1053
- ten = readdirSync4(thuMuc);
1335
+ ten = readdirSync5(thuMuc);
1054
1336
  } catch {
1055
1337
  continue;
1056
1338
  }
1057
1339
  for (const goi of ten) {
1058
- const nguonDir = join6(thuMuc, goi);
1340
+ const nguonDir = join7(thuMuc, goi);
1059
1341
  let tenGoi;
1060
1342
  try {
1061
- tenGoi = JSON.parse(readFileSync4(join6(nguonDir, "package.json"), "utf8")).name;
1343
+ tenGoi = JSON.parse(readFileSync5(join7(nguonDir, "package.json"), "utf8")).name;
1062
1344
  } catch {
1063
1345
  continue;
1064
1346
  }
1065
1347
  if (typeof tenGoi !== "string")
1066
1348
  continue;
1067
- const dichDir = join6(gocProfile, tenGoi);
1349
+ const dichDir = join7(gocProfile, tenGoi);
1068
1350
  for (const f of ["icon.svg", "icon.png"]) {
1069
- const nguon = join6(nguonDir, f);
1070
- if (!existsSync6(nguon))
1351
+ const nguon = join7(nguonDir, f);
1352
+ if (!existsSync7(nguon))
1071
1353
  continue;
1072
1354
  try {
1073
- cpSync3(nguon, join6(dichDir, f));
1355
+ cpSync3(nguon, join7(dichDir, f));
1074
1356
  soIcon += 1;
1075
1357
  } catch {
1076
1358
  continue;
@@ -1083,18 +1365,18 @@ function chepIconVaoProfile() {
1083
1365
  return soIcon;
1084
1366
  }
1085
1367
  function vaMatApiLlmDeepSeek() {
1086
- const stock = join6(kernelModulesDir2(), "@deepseek-ai", "dsh-llm-deepseek", "lib", "index.js");
1087
- if (!existsSync6(stock))
1368
+ const stock = join7(kernelModulesDir2(), "@deepseek-ai", "dsh-llm-deepseek", "lib", "index.js");
1369
+ if (!existsSync7(stock))
1088
1370
  return 0;
1089
1371
  let soTep = 0;
1090
- const gocProfile = join6(profileModulesDir(), "@galaxy-blackhole");
1372
+ const gocProfile = join7(profileModulesDir(), "@galaxy-blackhole");
1091
1373
  for (const goi of ["gbh-llm-deepseek-account", "gbh-llm-deepseek-api-key"]) {
1092
- const tep = join6(gocProfile, goi, "lib", "index.js");
1093
- if (!existsSync6(tep))
1374
+ const tep = join7(gocProfile, goi, "lib", "index.js");
1375
+ if (!existsSync7(tep))
1094
1376
  continue;
1095
1377
  let text = "";
1096
1378
  try {
1097
- text = readFileSync4(tep, "utf8");
1379
+ text = readFileSync5(tep, "utf8");
1098
1380
  } catch {
1099
1381
  continue;
1100
1382
  }
@@ -1102,7 +1384,7 @@ function vaMatApiLlmDeepSeek() {
1102
1384
  if (sau === text)
1103
1385
  continue;
1104
1386
  try {
1105
- writeFileSync3(tep, sau);
1387
+ writeFileSync4(tep, sau);
1106
1388
  soTep += 1;
1107
1389
  } catch {
1108
1390
  continue;
@@ -1113,7 +1395,7 @@ function vaMatApiLlmDeepSeek() {
1113
1395
  return soTep;
1114
1396
  }
1115
1397
  function suaIdTrongProfile() {
1116
- const thuMuc = join6(profileModulesDir(), "@galaxy-blackhole");
1398
+ const thuMuc = join7(profileModulesDir(), "@galaxy-blackhole");
1117
1399
  try {
1118
1400
  const force = (process.env.GBH_FORCE_REWRITE ?? "").trim() === "1";
1119
1401
  const kq = suaIdProfile(thuMuc, repoRoot(), { force });
@@ -1125,37 +1407,37 @@ function suaIdTrongProfile() {
1125
1407
  }
1126
1408
  }
1127
1409
  function mountLocalBundles() {
1128
- const root = join6(repoRoot(), "packages", "host");
1129
- if (!existsSync6(root))
1410
+ const root = join7(repoRoot(), "packages", "host");
1411
+ if (!existsSync7(root))
1130
1412
  return [];
1131
1413
  const copied = [];
1132
- for (const entry of readdirSync4(root, { withFileTypes: true })) {
1414
+ for (const entry of readdirSync5(root, { withFileTypes: true })) {
1133
1415
  if (!entry.isDirectory() || !entry.name.startsWith("bundle-"))
1134
1416
  continue;
1135
- const source = join6(root, entry.name);
1136
- const manifestPath = join6(source, "package.json");
1137
- if (!existsSync6(manifestPath))
1417
+ const source = join7(root, entry.name);
1418
+ const manifestPath = join7(source, "package.json");
1419
+ if (!existsSync7(manifestPath))
1138
1420
  continue;
1139
1421
  let specifier;
1140
1422
  try {
1141
- const manifest = JSON.parse(readFileSync4(manifestPath, "utf8"));
1423
+ const manifest = JSON.parse(readFileSync5(manifestPath, "utf8"));
1142
1424
  if (typeof manifest.name !== "string")
1143
1425
  continue;
1144
1426
  specifier = manifest.name;
1145
1427
  } catch {
1146
1428
  continue;
1147
1429
  }
1148
- const dir = join6(profileModulesDir(), specifier);
1430
+ const dir = join7(profileModulesDir(), specifier);
1149
1431
  mkdirSync3(dir, { recursive: true });
1150
1432
  for (const file of ["package.json", "cordis.patch.yml"]) {
1151
- const from = join6(source, file);
1152
- if (!existsSync6(from))
1433
+ const from = join7(source, file);
1434
+ if (!existsSync7(from))
1153
1435
  continue;
1154
- const to = join6(dir, file);
1155
- const text = readFileSync4(from, "utf8");
1156
- if (existsSync6(to) && readFileSync4(to, "utf8") === text)
1436
+ const to = join7(dir, file);
1437
+ const text = readFileSync5(from, "utf8");
1438
+ if (existsSync7(to) && readFileSync5(to, "utf8") === text)
1157
1439
  continue;
1158
- writeFileSync3(to, text);
1440
+ writeFileSync4(to, text);
1159
1441
  }
1160
1442
  copied.push(specifier);
1161
1443
  }
@@ -1168,7 +1450,7 @@ function applyHostAliases(results) {
1168
1450
  continue;
1169
1451
  const aliases = [...result.row?.hostAliases ?? [], ...result.hostAliases ?? []];
1170
1452
  for (const alias of aliases) {
1171
- const link = join6(profileModulesDir(), alias);
1453
+ const link = join7(profileModulesDir(), alias);
1172
1454
  try {
1173
1455
  mkdirSync3(dirname5(link), { recursive: true });
1174
1456
  rmSync3(link, { recursive: true, force: true });
@@ -1187,21 +1469,21 @@ function linkMoiGoiGbh() {
1187
1469
  let tao = 0;
1188
1470
  const modules = profileModulesDir();
1189
1471
  for (const tang of ["host", "client", "tools"]) {
1190
- const goc = join6(repoRoot(), "packages", tang);
1191
- if (!existsSync6(goc))
1472
+ const goc = join7(repoRoot(), "packages", tang);
1473
+ if (!existsSync7(goc))
1192
1474
  continue;
1193
- for (const ten of readdirSync4(goc)) {
1194
- const pj = join6(goc, ten, "package.json");
1195
- if (!existsSync6(pj))
1475
+ for (const ten of readdirSync5(goc)) {
1476
+ const pj = join7(goc, ten, "package.json");
1477
+ if (!existsSync7(pj))
1196
1478
  continue;
1197
1479
  try {
1198
- const meta = JSON.parse(readFileSync4(pj, "utf8"));
1480
+ const meta = JSON.parse(readFileSync5(pj, "utf8"));
1199
1481
  const tenGoi = meta.name ?? "";
1200
1482
  if (!tenGoi.startsWith("@galaxy-blackhole/"))
1201
1483
  continue;
1202
1484
  const ngan = tenGoi.slice("@galaxy-blackhole/".length);
1203
- const link = join6(modules, "@galaxy-blackhole", ngan);
1204
- if (!ensureLink(link, join6(goc, ten)))
1485
+ const link = join7(modules, "@galaxy-blackhole", ngan);
1486
+ if (!ensureLink(link, join7(goc, ten)))
1205
1487
  continue;
1206
1488
  tao += 1;
1207
1489
  } catch {
@@ -1227,13 +1509,13 @@ function applyProvenanceAliases() {
1227
1509
  "@deepseek-ai/node-addon-system"
1228
1510
  ]);
1229
1511
  for (const tier of ["host", "client"]) {
1230
- const goc = join6(REPO_ROOT, "packages", tier);
1231
- if (!existsSync6(goc))
1512
+ const goc = join7(REPO_ROOT, "packages", tier);
1513
+ if (!existsSync7(goc))
1232
1514
  continue;
1233
- for (const ten of readdirSync4(goc)) {
1234
- const dir = join6(goc, ten);
1515
+ for (const ten of readdirSync5(goc)) {
1516
+ const dir = join7(goc, ten);
1235
1517
  try {
1236
- const manifest = JSON.parse(readFileSync4(join6(dir, "package.json"), "utf8"));
1518
+ const manifest = JSON.parse(readFileSync5(join7(dir, "package.json"), "utf8"));
1237
1519
  const ours = typeof manifest.name === "string" ? manifest.name : "";
1238
1520
  if (!ours.startsWith("@galaxy-blackhole/"))
1239
1521
  continue;
@@ -1250,23 +1532,23 @@ function applyProvenanceAliases() {
1250
1532
  }
1251
1533
  const tenNgan = ours.replace("@galaxy-blackhole/", "").replace(/^gbh-/, "").replace(/^host-/, "");
1252
1534
  for (const ung of ["@deepseek-ai/dsh-" + tenNgan, "@deepseek-ai/dsh-host-" + tenNgan]) {
1253
- const thuMucKernel = join6(kernelModulesDir2(), ung);
1254
- if (existsSync6(thuMucKernel))
1535
+ const thuMucKernel = join7(kernelModulesDir2(), ung);
1536
+ if (existsSync7(thuMucKernel))
1255
1537
  stocks.push(ung);
1256
1538
  }
1257
- const dichProfile = join6(modules, ours);
1258
- if (!existsSync6(dichProfile) && !existsSync6(join6(dir, "lib")))
1539
+ const dichProfile = join7(modules, ours);
1540
+ if (!existsSync7(dichProfile) && !existsSync7(join7(dir, "lib")))
1259
1541
  continue;
1260
- const dich = existsSync6(dichProfile) ? dichProfile : dir;
1542
+ const dich = existsSync7(dichProfile) ? dichProfile : dir;
1261
1543
  for (const stock of stocks) {
1262
1544
  if (!stock.startsWith("@deepseek-ai/") || CAM.has(stock))
1263
1545
  continue;
1264
- const link = join6(modules, stock);
1546
+ const link = join7(modules, stock);
1265
1547
  try {
1266
- const thuMucKernelTruoc = join6(kernelModulesDir2(), stock);
1267
- const nguonTruoc = chiCoKhaiKieu(dir) && existsSync6(thuMucKernelTruoc) ? thuMucKernelTruoc : dich;
1548
+ const thuMucKernelTruoc = join7(kernelModulesDir2(), stock);
1549
+ const nguonTruoc = chiCoKhaiKieu(dir) && existsSync7(thuMucKernelTruoc) ? thuMucKernelTruoc : dich;
1268
1550
  const dichThat = realpathSync2(nguonTruoc);
1269
- if (existsSync6(link)) {
1551
+ if (existsSync7(link)) {
1270
1552
  const hienTai = lstatSync4(link).isSymbolicLink() ? realpathSync2(link) : undefined;
1271
1553
  if (hienTai !== undefined && hienTai === dichThat)
1272
1554
  continue;
@@ -1279,8 +1561,8 @@ function applyProvenanceAliases() {
1279
1561
  }
1280
1562
  mkdirSync3(dirname5(link), { recursive: true });
1281
1563
  rmSync3(link, { recursive: true, force: true });
1282
- const thuMucKernel = join6(kernelModulesDir2(), stock);
1283
- const nguonAlias = chiCoKhaiKieu(dir) && existsSync6(thuMucKernel) ? thuMucKernel : dich;
1564
+ const thuMucKernel = join7(kernelModulesDir2(), stock);
1565
+ const nguonAlias = chiCoKhaiKieu(dir) && existsSync7(thuMucKernel) ? thuMucKernel : dich;
1284
1566
  symlinkSync3(realpathSync2(nguonAlias), link, "dir");
1285
1567
  applied.push(stock + " -> " + ours);
1286
1568
  } catch {
@@ -1298,10 +1580,10 @@ function applyProvenanceAliases() {
1298
1580
  }
1299
1581
 
1300
1582
  // apps/cli/src/profile.ts
1301
- import { createHash as createHash4 } from "node:crypto";
1302
- import { existsSync as existsSync7, mkdirSync as mkdirSync4, readdirSync as readdirSync5, readFileSync as readFileSync5, renameSync, writeFileSync as writeFileSync4 } from "node:fs";
1303
- import { homedir as homedir2 } from "node:os";
1304
- import { dirname as dirname6, join as join7 } from "node:path";
1583
+ import { createHash as createHash5 } from "node:crypto";
1584
+ import { existsSync as existsSync8, mkdirSync as mkdirSync4, readdirSync as readdirSync6, readFileSync as readFileSync6, renameSync, writeFileSync as writeFileSync5 } from "node:fs";
1585
+ import { homedir as homedir3 } from "node:os";
1586
+ import { dirname as dirname6, join as join8 } from "node:path";
1305
1587
  var DEFAULT_FEATURE_BUNDLES = [
1306
1588
  "@galaxy-blackhole/gbh-plugin-market-bundle",
1307
1589
  "@galaxy-blackhole/gbh-terminal-bundle",
@@ -1327,12 +1609,12 @@ autoInstallPeers: false
1327
1609
  function expandTildeInScalars(text, home) {
1328
1610
  return text.replace(/(["'])(~[^"']*)\1/gu, (_match, quote, scalar) => {
1329
1611
  const suffix = scalar.startsWith("~/") ? scalar.slice(2) : "";
1330
- return `${quote}${suffix === "" ? home : join7(home, suffix)}${quote}`;
1612
+ return `${quote}${suffix === "" ? home : join8(home, suffix)}${quote}`;
1331
1613
  });
1332
1614
  }
1333
1615
  function readTemplate(file) {
1334
1616
  try {
1335
- return readFileSync5(join7(profileTemplateDir(), file), "utf8");
1617
+ return readFileSync6(join8(profileTemplateDir(), file), "utf8");
1336
1618
  } catch {
1337
1619
  return;
1338
1620
  }
@@ -1343,28 +1625,28 @@ function ensureProfile(name = DEFAULT_PROFILE) {
1343
1625
  const created = [];
1344
1626
  const updated = [];
1345
1627
  const reused = [];
1346
- const cordisPath = join7(dir, "cordis.yml");
1347
- if (!existsSync7(cordisPath)) {
1348
- writeFileSync4(cordisPath, readTemplate("cordis.yml") ?? `# dsh profile root — an empty entry list.
1628
+ const cordisPath = join8(dir, "cordis.yml");
1629
+ if (!existsSync8(cordisPath)) {
1630
+ writeFileSync5(cordisPath, readTemplate("cordis.yml") ?? `# dsh profile root — an empty entry list.
1349
1631
  []
1350
1632
  `);
1351
1633
  created.push("cordis.yml");
1352
1634
  } else {
1353
1635
  reused.push("cordis.yml");
1354
1636
  }
1355
- const patchPath = join7(dir, "cordis.patch.yml");
1356
- if (!existsSync7(patchPath)) {
1637
+ const patchPath = join8(dir, "cordis.patch.yml");
1638
+ if (!existsSync8(patchPath)) {
1357
1639
  const template = readTemplate("cordis.patch.yml");
1358
- writeFileSync4(patchPath, template === undefined ? `[]
1359
- ` : expandTildeInScalars(template, homedir2()));
1640
+ writeFileSync5(patchPath, template === undefined ? `[]
1641
+ ` : expandTildeInScalars(template, homedir3()));
1360
1642
  created.push("cordis.patch.yml");
1361
1643
  } else {
1362
1644
  reused.push("cordis.patch.yml");
1363
1645
  }
1364
- const manifestPath = join7(dir, "package.json");
1646
+ const manifestPath = join8(dir, "package.json");
1365
1647
  const manifest = (() => {
1366
1648
  try {
1367
- return JSON.parse(readFileSync5(manifestPath, "utf8"));
1649
+ return JSON.parse(readFileSync6(manifestPath, "utf8"));
1368
1650
  } catch {
1369
1651
  return {};
1370
1652
  }
@@ -1373,7 +1655,7 @@ function ensureProfile(name = DEFAULT_PROFILE) {
1373
1655
  const current = Array.isArray(declared) ? declared.map(String) : [];
1374
1656
  const extra = (() => {
1375
1657
  try {
1376
- const raw = readFileSync5(join7(dir, "extra-bundles.json"), "utf8");
1658
+ const raw = readFileSync6(join8(dir, "extra-bundles.json"), "utf8");
1377
1659
  const parsed = JSON.parse(raw);
1378
1660
  return Array.isArray(parsed) ? parsed.map(String) : [];
1379
1661
  } catch {
@@ -1386,23 +1668,23 @@ function ensureProfile(name = DEFAULT_PROFILE) {
1386
1668
  "@deepseek-ai/dsh-subagent-codex"
1387
1669
  ]);
1388
1670
  const giuLai = dungBundleTa ? current.filter((ten) => !ten.startsWith("@deepseek-ai/dsh-") || BUNDLE_STOCK_CON_GIU.has(ten)) : current;
1389
- const bundles = existsSync7(manifestPath) ? [...new Set([...APP_PROFILE_BUNDLES, ...giuLai, ...extra])] : [...new Set([...APP_PROFILE_BUNDLES, ...DEFAULT_FEATURE_BUNDLES, ...extra])];
1390
- if (!existsSync7(manifestPath)) {
1391
- writeFileSync4(manifestPath, JSON.stringify(manifestOf(name, manifest, bundles), null, 2) + `
1671
+ const bundles = existsSync8(manifestPath) ? [...new Set([...APP_PROFILE_BUNDLES, ...giuLai, ...extra])] : [...new Set([...APP_PROFILE_BUNDLES, ...DEFAULT_FEATURE_BUNDLES, ...extra])];
1672
+ if (!existsSync8(manifestPath)) {
1673
+ writeFileSync5(manifestPath, JSON.stringify(manifestOf(name, manifest, bundles), null, 2) + `
1392
1674
  `);
1393
1675
  created.push("package.json");
1394
1676
  } else if (current.join(`
1395
1677
  `) !== bundles.join(`
1396
1678
  `)) {
1397
- writeFileSync4(manifestPath, JSON.stringify(manifestOf(name, manifest, bundles), null, 2) + `
1679
+ writeFileSync5(manifestPath, JSON.stringify(manifestOf(name, manifest, bundles), null, 2) + `
1398
1680
  `);
1399
1681
  updated.push("package.json");
1400
1682
  } else {
1401
1683
  reused.push("package.json");
1402
1684
  }
1403
- const workspacePath = join7(dir, "pnpm-workspace.yaml");
1404
- if (!existsSync7(workspacePath)) {
1405
- writeFileSync4(workspacePath, PNPM_WORKSPACE);
1685
+ const workspacePath = join8(dir, "pnpm-workspace.yaml");
1686
+ if (!existsSync8(workspacePath)) {
1687
+ writeFileSync5(workspacePath, PNPM_WORKSPACE);
1406
1688
  created.push("pnpm-workspace.yaml");
1407
1689
  } else {
1408
1690
  reused.push("pnpm-workspace.yaml");
@@ -1422,28 +1704,28 @@ function manifestOf(name, manifest, bundles) {
1422
1704
  var BRAND_BLOCK = "brand-galaxy";
1423
1705
  function readKernelBundlePatches() {
1424
1706
  const out = [];
1425
- const kernel = join7(kernelModulesDir(), "@deepseek-ai");
1426
- if (!existsSync7(kernel))
1707
+ const kernel = join8(kernelModulesDir(), "@deepseek-ai");
1708
+ if (!existsSync8(kernel))
1427
1709
  return out;
1428
1710
  let entries;
1429
1711
  try {
1430
- entries = readdirSync5(kernel).sort();
1712
+ entries = readdirSync6(kernel).sort();
1431
1713
  } catch {
1432
1714
  return out;
1433
1715
  }
1434
1716
  for (const name of entries) {
1435
- const manifestPath = join7(kernel, name, "package.json");
1436
- if (!existsSync7(manifestPath))
1717
+ const manifestPath = join8(kernel, name, "package.json");
1718
+ if (!existsSync8(manifestPath))
1437
1719
  continue;
1438
1720
  try {
1439
- const manifest = JSON.parse(readFileSync5(manifestPath, "utf8"));
1721
+ const manifest = JSON.parse(readFileSync6(manifestPath, "utf8"));
1440
1722
  const patch = manifest.dsh?.bundle?.patch;
1441
1723
  if (typeof patch !== "string" || patch.trim() === "")
1442
1724
  continue;
1443
- const patchPath = join7(kernel, name, patch);
1444
- if (!existsSync7(patchPath))
1725
+ const patchPath = join8(kernel, name, patch);
1726
+ if (!existsSync8(patchPath))
1445
1727
  continue;
1446
- out.push(readFileSync5(patchPath, "utf8"));
1728
+ out.push(readFileSync6(patchPath, "utf8"));
1447
1729
  } catch {
1448
1730
  continue;
1449
1731
  }
@@ -1452,14 +1734,14 @@ function readKernelBundlePatches() {
1452
1734
  }
1453
1735
  function readParityTemplate() {
1454
1736
  try {
1455
- return readFileSync5(parityTemplatePath(), "utf8");
1737
+ return readFileSync6(parityTemplatePath(), "utf8");
1456
1738
  } catch {
1457
1739
  return "";
1458
1740
  }
1459
1741
  }
1460
1742
  function readPresetRedirectPatch() {
1461
1743
  try {
1462
- const text = readFileSync5(join7(profileTemplateDir(), "preset-redirect.patch.yml"), "utf8");
1744
+ const text = readFileSync6(join8(profileTemplateDir(), "preset-redirect.patch.yml"), "utf8");
1463
1745
  return text.split(`
1464
1746
  `).filter((line) => !line.startsWith("#")).join(`
1465
1747
  `).trim();
@@ -1616,19 +1898,19 @@ function renderGroupRewriteBlocksSingle(text, nested) {
1616
1898
  }
1617
1899
  function bundleDefinedNames() {
1618
1900
  const ten = new Set;
1619
- const goc = join7(repoRoot(), "packages", "host", "bundle");
1620
- if (!existsSync7(goc))
1901
+ const goc = join8(repoRoot(), "packages", "host", "bundle");
1902
+ if (!existsSync8(goc))
1621
1903
  return ten;
1622
1904
  const duyet = (dir) => {
1623
- for (const entry of readdirSync5(dir, { withFileTypes: true })) {
1624
- const duong = join7(dir, entry.name);
1905
+ for (const entry of readdirSync6(dir, { withFileTypes: true })) {
1906
+ const duong = join8(dir, entry.name);
1625
1907
  if (entry.isDirectory()) {
1626
1908
  duyet(duong);
1627
1909
  continue;
1628
1910
  }
1629
1911
  if (!entry.name.endsWith(".yml"))
1630
1912
  continue;
1631
- for (const m of readFileSync5(duong, "utf8").matchAll(new RegExp("name: '([^']+)'", "gu")))
1913
+ for (const m of readFileSync6(duong, "utf8").matchAll(new RegExp("name: '([^']+)'", "gu")))
1632
1914
  ten.add(String(m[1]));
1633
1915
  }
1634
1916
  };
@@ -1649,7 +1931,7 @@ function writeAppPatch(options = {}) {
1649
1931
  });
1650
1932
  const nested = (options.rewrites ?? []).filter((mount) => mount.ok).filter((mount) => !trongBundle.has(mount.specifier)).filter((mount) => !trongBundle.has(mount.specifier)).flatMap((mount) => {
1651
1933
  try {
1652
- const manifest = JSON.parse(readFileSync5(join7(mount.dir, "package.json"), "utf8"));
1934
+ const manifest = JSON.parse(readFileSync6(join8(mount.dir, "package.json"), "utf8"));
1653
1935
  const stockId = manifest.gbh?.nested?.stockId;
1654
1936
  if (typeof stockId !== "string" || stockId === "")
1655
1937
  return [];
@@ -1692,38 +1974,38 @@ function writeAppPatch(options = {}) {
1692
1974
  `);
1693
1975
  const overridden = (process.env.GBH_HOME ?? "").trim() !== "";
1694
1976
  const dich = overridden ? [appPatchPath()] : [appPatchPath(), repoAppPatchPath()];
1695
- const stamp = createHash4("sha256").update(text).digest("hex");
1977
+ const stamp = createHash5("sha256").update(text).digest("hex");
1696
1978
  const stampPath = appPatchStampPath();
1697
- const stampCu = existsSync7(stampPath) ? readFileSync5(stampPath, "utf8").trim() : "";
1698
- if (stampCu === stamp && dich.every((file) => existsSync7(file)))
1979
+ const stampCu = existsSync8(stampPath) ? readFileSync6(stampPath, "utf8").trim() : "";
1980
+ if (stampCu === stamp && dich.every((file) => existsSync8(file)))
1699
1981
  return appPatchPath();
1700
1982
  for (const file of dich) {
1701
1983
  try {
1702
1984
  mkdirSync4(dirname6(file), { recursive: true });
1703
1985
  const tam = `${file}.tmp-${process.pid}`;
1704
- writeFileSync4(tam, text);
1986
+ writeFileSync5(tam, text);
1705
1987
  renameSync(tam, file);
1706
1988
  } catch (error) {
1707
1989
  console.warn(`[bh] khong ghi duoc ${file}: ${String(error)}`);
1708
1990
  }
1709
1991
  }
1710
1992
  try {
1711
- writeFileSync4(stampPath, stamp + `
1993
+ writeFileSync5(stampPath, stamp + `
1712
1994
  `);
1713
1995
  } catch {}
1714
1996
  return appPatchPath();
1715
1997
  }
1716
1998
 
1717
1999
  // apps/cli/src/runtime.ts
1718
- import { spawnSync as spawnSync2 } from "node:child_process";
1719
- import { existsSync as existsSync8, readdirSync as readdirSync6, readFileSync as readFileSync6 } from "node:fs";
1720
- import { homedir as homedir3 } from "node:os";
1721
- import { join as join8 } from "node:path";
2000
+ import { spawnSync as spawnSync3 } from "node:child_process";
2001
+ import { existsSync as existsSync9, readdirSync as readdirSync7, readFileSync as readFileSync7 } from "node:fs";
2002
+ import { homedir as homedir4 } from "node:os";
2003
+ import { join as join9 } from "node:path";
1722
2004
  var cached;
1723
2005
  var rejected = [];
1724
2006
  function readManifestVersion(manifestPath) {
1725
2007
  try {
1726
- const parsed = JSON.parse(readFileSync6(manifestPath, "utf8"));
2008
+ const parsed = JSON.parse(readFileSync7(manifestPath, "utf8"));
1727
2009
  const version = parsed.version;
1728
2010
  return typeof version === "string" ? version : undefined;
1729
2011
  } catch {
@@ -1734,10 +2016,10 @@ function harnessVersion() {
1734
2016
  return readManifestVersion(dshManifestPath());
1735
2017
  }
1736
2018
  function harnessInstalled() {
1737
- return existsSync8(dshBinPath());
2019
+ return existsSync9(dshBinPath());
1738
2020
  }
1739
2021
  function probeNodeVersion(bin) {
1740
- const probe = spawnSync2(bin, ["--version"], { encoding: "utf8", timeout: 8000 });
2022
+ const probe = spawnSync3(bin, ["--version"], { encoding: "utf8", timeout: 8000 });
1741
2023
  if (probe.error !== undefined || probe.status !== 0)
1742
2024
  return;
1743
2025
  const match = /v?(\d+)\.\d+\.\d+/.exec(`${probe.stdout ?? ""}${probe.stderr ?? ""}`);
@@ -1750,15 +2032,15 @@ function nodeCandidates() {
1750
2032
  const explicit = process.env.GBH_NODE?.trim();
1751
2033
  if (explicit !== undefined && explicit !== "")
1752
2034
  candidates.push({ bin: explicit, source: "GBH_NODE" });
1753
- const nvmRoot = join8(homedir3(), ".nvm", "versions", "node");
2035
+ const nvmRoot = join9(homedir4(), ".nvm", "versions", "node");
1754
2036
  try {
1755
- const versions = readdirSync6(nvmRoot).filter((name) => /^v\d+\.\d+\.\d+$/.test(name)).sort((left, right) => {
2037
+ const versions = readdirSync7(nvmRoot).filter((name) => /^v\d+\.\d+\.\d+$/.test(name)).sort((left, right) => {
1756
2038
  const [leftMajor, leftMinor] = left.slice(1).split(".").map(Number);
1757
2039
  const [rightMajor, rightMinor] = right.slice(1).split(".").map(Number);
1758
2040
  return (rightMajor ?? 0) - (leftMajor ?? 0) || (rightMinor ?? 0) - (leftMinor ?? 0);
1759
2041
  });
1760
2042
  for (const version of versions)
1761
- candidates.push({ bin: join8(nvmRoot, version, "bin", "node"), source: `nvm ${version}` });
2043
+ candidates.push({ bin: join9(nvmRoot, version, "bin", "node"), source: `nvm ${version}` });
1762
2044
  } catch {}
1763
2045
  candidates.push({ bin: "node", source: "PATH" });
1764
2046
  candidates.push({ bin: "/usr/local/bin/node", source: "system" });
@@ -1770,7 +2052,7 @@ function resolveNodeRuntime() {
1770
2052
  return cached;
1771
2053
  rejected = [];
1772
2054
  for (const candidate of nodeCandidates()) {
1773
- if (candidate.bin !== "node" && !existsSync8(candidate.bin)) {
2055
+ if (candidate.bin !== "node" && !existsSync9(candidate.bin)) {
1774
2056
  rejected.push({ bin: candidate.bin, reason: "not found" });
1775
2057
  continue;
1776
2058
  }
@@ -1821,7 +2103,7 @@ function describeLaunch(launch) {
1821
2103
  }
1822
2104
  function resolveLaunch(options, mode = "boot") {
1823
2105
  const bin = dshBinPath();
1824
- if (!existsSync9(bin)) {
2106
+ if (!existsSync10(bin)) {
1825
2107
  throw new Error(`harness runtime not found at ${bin} — run: bun install --cwd apps/host`);
1826
2108
  }
1827
2109
  const node = resolveNodeRuntime();
@@ -1895,7 +2177,7 @@ function spawnHost(options) {
1895
2177
  `);
1896
2178
  const name = options.port === DEFAULT_PORT ? "ready-url.txt" : `ready-url-${options.port}.txt`;
1897
2179
  try {
1898
- writeFileSync5(launch.home + "/" + name, url);
2180
+ writeFileSync6(launch.home + "/" + name, url);
1899
2181
  } catch {}
1900
2182
  resolve3(url);
1901
2183
  });
@@ -1920,7 +2202,7 @@ function spawnHost(options) {
1920
2202
  }
1921
2203
  function runDumpConfig(options = {}) {
1922
2204
  const launch = resolveLaunch(defaultHostOptions({ profile: options.profile, extraPatches: options.extraPatches }), "dump");
1923
- const result = spawnSync3(launch.node, launch.args, {
2205
+ const result = spawnSync4(launch.node, launch.args, {
1924
2206
  cwd: repoRoot(),
1925
2207
  env: hostChildEnv(launch.home),
1926
2208
  stdio: "inherit"
@@ -1929,15 +2211,15 @@ function runDumpConfig(options = {}) {
1929
2211
  }
1930
2212
 
1931
2213
  // apps/cli/src/doctor.ts
1932
- import { existsSync as existsSync10, readFileSync as readFileSync7, statSync as statSync3 } from "node:fs";
1933
- import { join as join10 } from "node:path";
2214
+ import { existsSync as existsSync11, readFileSync as readFileSync8, statSync as statSync4 } from "node:fs";
2215
+ import { join as join11 } from "node:path";
1934
2216
 
1935
2217
  // apps/cli/src/oracle.ts
1936
- import { spawnSync as spawnSync4 } from "node:child_process";
2218
+ import { spawnSync as spawnSync5 } from "node:child_process";
1937
2219
  import { resolve as resolve3 } from "node:path";
1938
2220
  function run(command, args) {
1939
2221
  try {
1940
- const probe = spawnSync4(command, args, { encoding: "utf8", timeout: 5000 });
2222
+ const probe = spawnSync5(command, args, { encoding: "utf8", timeout: 5000 });
1941
2223
  return probe.status === 0 ? probe.stdout ?? "" : undefined;
1942
2224
  } catch {
1943
2225
  return;
@@ -1967,7 +2249,7 @@ function findOracle(port = ORACLE_PORT) {
1967
2249
  }
1968
2250
 
1969
2251
  // apps/cli/src/port.ts
1970
- import { spawnSync as spawnSync5 } from "node:child_process";
2252
+ import { spawnSync as spawnSync6 } from "node:child_process";
1971
2253
  import { createServer } from "node:net";
1972
2254
  function isPortAvailable(port, host = LOOPBACK_HOST) {
1973
2255
  if (port === 0)
@@ -1985,7 +2267,7 @@ function isPortAvailable(port, host = LOOPBACK_HOST) {
1985
2267
  });
1986
2268
  }
1987
2269
  function portOwnerHint(port) {
1988
- const probe = spawnSync5("lsof", ["-nP", `-iTCP:${port}`, "-sTCP:LISTEN"], { encoding: "utf8", timeout: 5000 });
2270
+ const probe = spawnSync6("lsof", ["-nP", `-iTCP:${port}`, "-sTCP:LISTEN"], { encoding: "utf8", timeout: 5000 });
1989
2271
  const row = (probe.stdout ?? "").split(`
1990
2272
  `).find((line, index) => index > 0 && line.trim() !== "");
1991
2273
  if (probe.status !== 0 || row === undefined)
@@ -1995,9 +2277,9 @@ function portOwnerHint(port) {
1995
2277
  }
1996
2278
 
1997
2279
  // apps/cli/src/home-guard.ts
1998
- import { createHash as createHash5 } from "node:crypto";
1999
- import { lstatSync as lstatSync5, readdirSync as readdirSync7, readlinkSync as readlinkSync2 } from "node:fs";
2000
- import { join as join9 } from "node:path";
2280
+ import { createHash as createHash6 } from "node:crypto";
2281
+ import { lstatSync as lstatSync5, readdirSync as readdirSync8, readlinkSync as readlinkSync2 } from "node:fs";
2282
+ import { join as join10 } from "node:path";
2001
2283
  function linkTarget(path) {
2002
2284
  try {
2003
2285
  return readlinkSync2(path);
@@ -2008,13 +2290,13 @@ function linkTarget(path) {
2008
2290
  function walk(root, dir, lines, totals) {
2009
2291
  let entries;
2010
2292
  try {
2011
- entries = readdirSync7(dir, { withFileTypes: true });
2293
+ entries = readdirSync8(dir, { withFileTypes: true });
2012
2294
  } catch (error) {
2013
2295
  lines.push(`${dir}|${-1}|unreadable|${String(error)}`);
2014
2296
  return;
2015
2297
  }
2016
2298
  for (const entry of entries.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0)) {
2017
- const path = join9(dir, entry.name);
2299
+ const path = join10(dir, entry.name);
2018
2300
  const relative2 = path.slice(root.length + 1);
2019
2301
  let stat;
2020
2302
  try {
@@ -2044,7 +2326,7 @@ function snapshotTree(root) {
2044
2326
  entries: totals.entries,
2045
2327
  bytes: totals.bytes,
2046
2328
  newestMtimeMs: totals.newestMtimeMs,
2047
- hash: createHash5("sha256").update(sorted.join(`
2329
+ hash: createHash6("sha256").update(sorted.join(`
2048
2330
  `)).digest("hex"),
2049
2331
  lines: sorted
2050
2332
  };
@@ -2053,7 +2335,7 @@ function snapshotTree(root) {
2053
2335
  // apps/cli/src/doctor.ts
2054
2336
  function profileRootIsEmpty(file) {
2055
2337
  try {
2056
- const body = readFileSync7(file, "utf8").split(`
2338
+ const body = readFileSync8(file, "utf8").split(`
2057
2339
  `).filter((line) => !line.trim().startsWith("#")).join(`
2058
2340
  `).trim();
2059
2341
  return body === "[]";
@@ -2063,7 +2345,7 @@ function profileRootIsEmpty(file) {
2063
2345
  }
2064
2346
  function pinnedCredentialsPath(patchPath) {
2065
2347
  try {
2066
- return /path:\s*"([^"]+)"/u.exec(readFileSync7(patchPath, "utf8"))?.[1];
2348
+ return /path:\s*"([^"]+)"/u.exec(readFileSync8(patchPath, "utf8"))?.[1];
2067
2349
  } catch {
2068
2350
  return;
2069
2351
  }
@@ -2078,7 +2360,7 @@ async function buildDoctorReport(port = DEFAULT_PORT) {
2078
2360
  }
2079
2361
  const declaredPin = (() => {
2080
2362
  try {
2081
- const manifest = JSON.parse(readFileSync7(join10(repoRoot(), "apps", "host", "package.json"), "utf8"));
2363
+ const manifest = JSON.parse(readFileSync8(join11(repoRoot(), "apps", "host", "package.json"), "utf8"));
2082
2364
  return manifest.dependencies?.["@deepseek-ai/dsh"];
2083
2365
  } catch {
2084
2366
  return;
@@ -2110,19 +2392,19 @@ async function buildDoctorReport(port = DEFAULT_PORT) {
2110
2392
  lines.push({ status: "OK", label: `oracle :${oracle.port}`, detail: `pid ${oracle.pid} version ${oracle.version ?? "?"} ${oracle.home ?? ""}`.trim() });
2111
2393
  }
2112
2394
  const home = appHome();
2113
- lines.push(existsSync10(home) ? { status: "OK", label: "app home", detail: `${home} (DSH_HOME, KHONG dung ${join10(galaxyRoot(), "gbh")})` } : { status: "MISS", label: "app home", detail: `${home} — se tao khi boot` });
2395
+ lines.push(existsSync11(home) ? { status: "OK", label: "app home", detail: `${home} (DSH_HOME, KHONG dung ${join11(galaxyRoot(), "gbh")})` } : { status: "MISS", label: "app home", detail: `${home} — se tao khi boot` });
2114
2396
  const seeded = ensureProfile();
2115
2397
  lines.push({
2116
- status: profileRootIsEmpty(join10(seeded.dir, "cordis.yml")) ? "OK" : "WARN",
2398
+ status: profileRootIsEmpty(join11(seeded.dir, "cordis.yml")) ? "OK" : "WARN",
2117
2399
  label: "profile",
2118
- detail: `${join10(seeded.dir, "cordis.yml")} = [] · ${seeded.bundles.length} bundle`
2400
+ detail: `${join11(seeded.dir, "cordis.yml")} = [] · ${seeded.bundles.length} bundle`
2119
2401
  });
2120
2402
  const credentials = credentialsPath();
2121
- lines.push(existsSync10(credentials) ? { status: "OK", label: "shared credentials", detail: `${credentials} · ${statSync3(credentials).size} bytes (noi dung khong in)` } : { status: "MISS", label: "shared credentials", detail: `${credentials} chua co (nguoi dung tao khi dang nhap)` });
2403
+ lines.push(existsSync11(credentials) ? { status: "OK", label: "shared credentials", detail: `${credentials} · ${statSync4(credentials).size} bytes (noi dung khong in)` } : { status: "MISS", label: "shared credentials", detail: `${credentials} chua co (nguoi dung tao khi dang nhap)` });
2122
2404
  const pinned = pinnedCredentialsPath(appPatchPath());
2123
2405
  lines.push(pinned === credentials ? { status: "OK", label: "app patch", detail: `credentials.config.path -> ${pinned}` } : { status: "WARN", label: "app patch", detail: `${appPatchPath()} -> ${pinned ?? "(chua sinh)"} (mong doi ${credentials})` });
2124
- const gbh = join10(galaxyRoot(), "gbh");
2125
- if (existsSync10(gbh)) {
2406
+ const gbh = join11(galaxyRoot(), "gbh");
2407
+ if (existsSync11(gbh)) {
2126
2408
  const snapshot = snapshotTree(gbh);
2127
2409
  lines.push({ status: "OK", label: "home isolation", detail: `${gbh} chi doc · ${snapshot.entries} entry · hash ${snapshot.hash.slice(0, 12)}` });
2128
2410
  } else {
@@ -2145,24 +2427,24 @@ ket qua: DO — ${failed.map((line) => line.label).join(", ")}`);
2145
2427
  }
2146
2428
 
2147
2429
  // apps/cli/src/auto-migrate.ts
2148
- import { existsSync as existsSync12, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "node:fs";
2149
- import { join as join12 } from "node:path";
2430
+ import { existsSync as existsSync13, readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "node:fs";
2431
+ import { join as join13 } from "node:path";
2150
2432
 
2151
2433
  // apps/cli/src/migrate.ts
2152
- import { copyFileSync, existsSync as existsSync11, mkdirSync as mkdirSync5, readdirSync as readdirSync8, statSync as statSync4 } from "node:fs";
2153
- import { homedir as homedir4 } from "node:os";
2154
- import { dirname as dirname7, join as join11, relative as relative2 } from "node:path";
2434
+ import { copyFileSync, existsSync as existsSync12, mkdirSync as mkdirSync5, readdirSync as readdirSync9, statSync as statSync5 } from "node:fs";
2435
+ import { homedir as homedir5 } from "node:os";
2436
+ import { dirname as dirname7, join as join12, relative as relative2 } from "node:path";
2155
2437
  var MIGRATE_AREAS = ["sessions", "storages", "attachments"];
2156
2438
  var BO_QUA = new Set(["session.lock", ".DS_Store"]);
2157
2439
  function lietKeTep(goc) {
2158
- if (!existsSync11(goc))
2440
+ if (!existsSync12(goc))
2159
2441
  return [];
2160
2442
  const ketQua = [];
2161
2443
  const duyet = (thuMuc) => {
2162
- for (const muc of readdirSync8(thuMuc, { withFileTypes: true })) {
2444
+ for (const muc of readdirSync9(thuMuc, { withFileTypes: true })) {
2163
2445
  if (BO_QUA.has(muc.name))
2164
2446
  continue;
2165
- const duong = join11(thuMuc, muc.name);
2447
+ const duong = join12(thuMuc, muc.name);
2166
2448
  if (muc.isDirectory())
2167
2449
  duyet(duong);
2168
2450
  else if (muc.isFile())
@@ -2179,25 +2461,25 @@ function migrateHome(options) {
2179
2461
  const baoCao = [];
2180
2462
  const missing = [];
2181
2463
  for (const area of areas) {
2182
- const nguon = join11(options.from, area);
2183
- if (!existsSync11(nguon)) {
2464
+ const nguon = join12(options.from, area);
2465
+ if (!existsSync12(nguon)) {
2184
2466
  missing.push(area);
2185
2467
  continue;
2186
2468
  }
2187
2469
  const muc = { area, copied: 0, skipped: 0, bytes: 0 };
2188
2470
  for (const tep of lietKeTep(nguon)) {
2189
- const dich = join11(options.to, area, tep);
2190
- if (existsSync11(dich)) {
2471
+ const dich = join12(options.to, area, tep);
2472
+ if (existsSync12(dich)) {
2191
2473
  muc.skipped += 1;
2192
2474
  continue;
2193
2475
  }
2194
- const co = statSync4(join11(nguon, tep)).size;
2476
+ const co = statSync5(join12(nguon, tep)).size;
2195
2477
  muc.copied += 1;
2196
2478
  muc.bytes += co;
2197
2479
  if (dryRun)
2198
2480
  continue;
2199
2481
  mkdirSync5(dirname7(dich), { recursive: true });
2200
- copyFileSync(join11(nguon, tep), dich);
2482
+ copyFileSync(join12(nguon, tep), dich);
2201
2483
  }
2202
2484
  baoCao.push(muc);
2203
2485
  }
@@ -2205,11 +2487,11 @@ function migrateHome(options) {
2205
2487
  return { from: options.from, to: options.to, dryRun, areas: baoCao, missing, ...tong };
2206
2488
  }
2207
2489
  function defaultOldHome() {
2208
- return join11(homedir4(), ".galaxy", "gbh");
2490
+ return join12(homedir5(), ".galaxy", "gbh");
2209
2491
  }
2210
2492
  function defaultNewHome() {
2211
2493
  const tuBien = process.env["GBH_HOME"];
2212
- return tuBien === undefined || tuBien.trim() === "" ? join11(homedir4(), ".galaxy", "blackhole") : tuBien;
2494
+ return tuBien === undefined || tuBien.trim() === "" ? join12(homedir5(), ".galaxy", "blackhole") : tuBien;
2213
2495
  }
2214
2496
 
2215
2497
  // apps/cli/src/auto-migrate.ts
@@ -2231,19 +2513,19 @@ function ghiCoDiTru(noiDung) {
2231
2513
  `;
2232
2514
  }
2233
2515
  function autoMigrate(options) {
2234
- const credentialsPath2 = join12(options.galaxyRoot, CREDENTIALS_FILE);
2235
- const noiDung = existsSync12(credentialsPath2) ? readFileSync8(credentialsPath2, "utf8") : "";
2516
+ const credentialsPath2 = join13(options.galaxyRoot, CREDENTIALS_FILE);
2517
+ const noiDung = existsSync13(credentialsPath2) ? readFileSync9(credentialsPath2, "utf8") : "";
2236
2518
  const daTung = daDiTru(noiDung);
2237
2519
  const cu = options.from ?? defaultOldHome();
2238
2520
  const moi = options.to ?? defaultNewHome();
2239
- if (!existsSync12(join12(cu, "sessions"))) {
2521
+ if (!existsSync13(join13(cu, "sessions"))) {
2240
2522
  return { ran: false, reason: "home cũ không có sessions", credentialsPath: credentialsPath2 };
2241
2523
  }
2242
2524
  if (cu === moi)
2243
2525
  return { ran: false, reason: "home cũ trùng home mới", credentialsPath: credentialsPath2 };
2244
2526
  const report = migrateHome({ from: cu, to: moi, dryRun: options.dryRun === true });
2245
2527
  if (options.dryRun !== true && (report.copied > 0 || !daTung)) {
2246
- writeFileSync6(credentialsPath2, ghiCoDiTru(noiDung));
2528
+ writeFileSync7(credentialsPath2, ghiCoDiTru(noiDung));
2247
2529
  }
2248
2530
  return { ran: true, report, credentialsPath: credentialsPath2 };
2249
2531
  }