@kaitranntt/ccs 7.77.1 → 7.78.0-dev.10

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 (308) hide show
  1. package/README.md +2 -1
  2. package/dist/auth/account-profile-diagnostics.d.ts +21 -0
  3. package/dist/auth/account-profile-diagnostics.d.ts.map +1 -0
  4. package/dist/auth/account-profile-diagnostics.js +130 -0
  5. package/dist/auth/account-profile-diagnostics.js.map +1 -0
  6. package/dist/auth/auth-commands.d.ts +2 -1
  7. package/dist/auth/auth-commands.d.ts.map +1 -1
  8. package/dist/auth/auth-commands.js +30 -12
  9. package/dist/auth/auth-commands.js.map +1 -1
  10. package/dist/auth/commands/backup-command.d.ts.map +1 -1
  11. package/dist/auth/commands/backup-command.js +7 -2
  12. package/dist/auth/commands/backup-command.js.map +1 -1
  13. package/dist/auth/commands/create-command.d.ts.map +1 -1
  14. package/dist/auth/commands/create-command.js +20 -16
  15. package/dist/auth/commands/create-command.js.map +1 -1
  16. package/dist/auth/commands/default-command.d.ts +1 -1
  17. package/dist/auth/commands/default-command.d.ts.map +1 -1
  18. package/dist/auth/commands/default-command.js +10 -2
  19. package/dist/auth/commands/default-command.js.map +1 -1
  20. package/dist/auth/commands/index.d.ts +1 -0
  21. package/dist/auth/commands/index.d.ts.map +1 -1
  22. package/dist/auth/commands/index.js +3 -1
  23. package/dist/auth/commands/index.js.map +1 -1
  24. package/dist/auth/commands/list-command.d.ts.map +1 -1
  25. package/dist/auth/commands/list-command.js +16 -3
  26. package/dist/auth/commands/list-command.js.map +1 -1
  27. package/dist/auth/commands/remove-command.d.ts.map +1 -1
  28. package/dist/auth/commands/remove-command.js +5 -1
  29. package/dist/auth/commands/remove-command.js.map +1 -1
  30. package/dist/auth/commands/resources-command.d.ts +3 -0
  31. package/dist/auth/commands/resources-command.d.ts.map +1 -0
  32. package/dist/auth/commands/resources-command.js +115 -0
  33. package/dist/auth/commands/resources-command.js.map +1 -0
  34. package/dist/auth/commands/show-command.d.ts.map +1 -1
  35. package/dist/auth/commands/show-command.js +54 -3
  36. package/dist/auth/commands/show-command.js.map +1 -1
  37. package/dist/auth/commands/types.d.ts +31 -1
  38. package/dist/auth/commands/types.d.ts.map +1 -1
  39. package/dist/auth/commands/types.js +41 -2
  40. package/dist/auth/commands/types.js.map +1 -1
  41. package/dist/auth/profile-continuity-inheritance.d.ts.map +1 -1
  42. package/dist/auth/profile-continuity-inheritance.js +2 -1
  43. package/dist/auth/profile-continuity-inheritance.js.map +1 -1
  44. package/dist/auth/profile-detector.d.ts.map +1 -1
  45. package/dist/auth/profile-detector.js +1 -0
  46. package/dist/auth/profile-detector.js.map +1 -1
  47. package/dist/auth/profile-registry.d.ts +2 -0
  48. package/dist/auth/profile-registry.d.ts.map +1 -1
  49. package/dist/auth/profile-registry.js +6 -2
  50. package/dist/auth/profile-registry.js.map +1 -1
  51. package/dist/auth/shared-resource-policy.d.ts +20 -0
  52. package/dist/auth/shared-resource-policy.d.ts.map +1 -0
  53. package/dist/auth/shared-resource-policy.js +69 -0
  54. package/dist/auth/shared-resource-policy.js.map +1 -0
  55. package/dist/ccs.js +1 -1
  56. package/dist/ccs.js.map +1 -1
  57. package/dist/cliproxy/ai-providers/codex-plan-compatibility.d.ts.map +1 -1
  58. package/dist/cliproxy/ai-providers/codex-plan-compatibility.js +2 -2
  59. package/dist/cliproxy/ai-providers/codex-plan-compatibility.js.map +1 -1
  60. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts +8 -2
  61. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts.map +1 -1
  62. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js +82 -33
  63. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js.map +1 -1
  64. package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts +1 -1
  65. package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts.map +1 -1
  66. package/dist/cliproxy/ai-providers/model-id-normalizer.js +28 -11
  67. package/dist/cliproxy/ai-providers/model-id-normalizer.js.map +1 -1
  68. package/dist/cliproxy/auth/oauth-handler.d.ts +39 -1
  69. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  70. package/dist/cliproxy/auth/oauth-handler.js +137 -1
  71. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  72. package/dist/cliproxy/auth/oauth-process.d.ts.map +1 -1
  73. package/dist/cliproxy/auth/oauth-process.js +94 -3
  74. package/dist/cliproxy/auth/oauth-process.js.map +1 -1
  75. package/dist/cliproxy/auth/oauth-start-failure-guidance.d.ts +22 -0
  76. package/dist/cliproxy/auth/oauth-start-failure-guidance.d.ts.map +1 -0
  77. package/dist/cliproxy/auth/oauth-start-failure-guidance.js +82 -0
  78. package/dist/cliproxy/auth/oauth-start-failure-guidance.js.map +1 -0
  79. package/dist/cliproxy/auth/oauth-trace/diagnose-failure.d.ts +24 -0
  80. package/dist/cliproxy/auth/oauth-trace/diagnose-failure.d.ts.map +1 -0
  81. package/dist/cliproxy/auth/oauth-trace/diagnose-failure.js +159 -0
  82. package/dist/cliproxy/auth/oauth-trace/diagnose-failure.js.map +1 -0
  83. package/dist/cliproxy/auth/oauth-trace/index.d.ts +4 -0
  84. package/dist/cliproxy/auth/oauth-trace/index.d.ts.map +1 -0
  85. package/dist/cliproxy/auth/oauth-trace/index.js +14 -0
  86. package/dist/cliproxy/auth/oauth-trace/index.js.map +1 -0
  87. package/dist/cliproxy/auth/oauth-trace/redactor.d.ts +22 -0
  88. package/dist/cliproxy/auth/oauth-trace/redactor.d.ts.map +1 -0
  89. package/dist/cliproxy/auth/oauth-trace/redactor.js +112 -0
  90. package/dist/cliproxy/auth/oauth-trace/redactor.js.map +1 -0
  91. package/dist/cliproxy/auth/oauth-trace/sink-file.d.ts +18 -0
  92. package/dist/cliproxy/auth/oauth-trace/sink-file.d.ts.map +1 -0
  93. package/dist/cliproxy/auth/oauth-trace/sink-file.js +90 -0
  94. package/dist/cliproxy/auth/oauth-trace/sink-file.js.map +1 -0
  95. package/dist/cliproxy/auth/oauth-trace/sink-memory.d.ts +13 -0
  96. package/dist/cliproxy/auth/oauth-trace/sink-memory.d.ts.map +1 -0
  97. package/dist/cliproxy/auth/oauth-trace/sink-memory.js +31 -0
  98. package/dist/cliproxy/auth/oauth-trace/sink-memory.js.map +1 -0
  99. package/dist/cliproxy/auth/oauth-trace/sink-verbose-stdout.d.ts +11 -0
  100. package/dist/cliproxy/auth/oauth-trace/sink-verbose-stdout.d.ts.map +1 -0
  101. package/dist/cliproxy/auth/oauth-trace/sink-verbose-stdout.js +47 -0
  102. package/dist/cliproxy/auth/oauth-trace/sink-verbose-stdout.js.map +1 -0
  103. package/dist/cliproxy/auth/oauth-trace/trace-events.d.ts +51 -0
  104. package/dist/cliproxy/auth/oauth-trace/trace-events.d.ts.map +1 -0
  105. package/dist/cliproxy/auth/oauth-trace/trace-events.js +44 -0
  106. package/dist/cliproxy/auth/oauth-trace/trace-events.js.map +1 -0
  107. package/dist/cliproxy/auth/oauth-trace/trace-recorder.d.ts +34 -0
  108. package/dist/cliproxy/auth/oauth-trace/trace-recorder.d.ts.map +1 -0
  109. package/dist/cliproxy/auth/oauth-trace/trace-recorder.js +83 -0
  110. package/dist/cliproxy/auth/oauth-trace/trace-recorder.js.map +1 -0
  111. package/dist/cliproxy/config/thinking-config.d.ts.map +1 -1
  112. package/dist/cliproxy/config/thinking-config.js +9 -8
  113. package/dist/cliproxy/config/thinking-config.js.map +1 -1
  114. package/dist/cliproxy/model-catalog.d.ts +2 -0
  115. package/dist/cliproxy/model-catalog.d.ts.map +1 -1
  116. package/dist/cliproxy/model-catalog.js +2 -0
  117. package/dist/cliproxy/model-catalog.js.map +1 -1
  118. package/dist/cliproxy/provider-capabilities.d.ts +3 -0
  119. package/dist/cliproxy/provider-capabilities.d.ts.map +1 -1
  120. package/dist/cliproxy/provider-capabilities.js +14 -2
  121. package/dist/cliproxy/provider-capabilities.js.map +1 -1
  122. package/dist/cliproxy/services/oauth-usage-log-transformer.d.ts +4 -0
  123. package/dist/cliproxy/services/oauth-usage-log-transformer.d.ts.map +1 -0
  124. package/dist/cliproxy/services/oauth-usage-log-transformer.js +162 -0
  125. package/dist/cliproxy/services/oauth-usage-log-transformer.js.map +1 -0
  126. package/dist/cliproxy/services/stats-fetcher.d.ts +4 -0
  127. package/dist/cliproxy/services/stats-fetcher.d.ts.map +1 -1
  128. package/dist/cliproxy/services/stats-fetcher.js +133 -25
  129. package/dist/cliproxy/services/stats-fetcher.js.map +1 -1
  130. package/dist/cliproxy/services/stats-transformer.d.ts.map +1 -1
  131. package/dist/cliproxy/services/stats-transformer.js +85 -13
  132. package/dist/cliproxy/services/stats-transformer.js.map +1 -1
  133. package/dist/cliproxy/services/usage-compatibility-transformer.d.ts +12 -0
  134. package/dist/cliproxy/services/usage-compatibility-transformer.d.ts.map +1 -0
  135. package/dist/cliproxy/services/usage-compatibility-transformer.js +458 -0
  136. package/dist/cliproxy/services/usage-compatibility-transformer.js.map +1 -0
  137. package/dist/commands/cliproxy/variant-subcommand.d.ts.map +1 -1
  138. package/dist/commands/cliproxy/variant-subcommand.js +44 -12
  139. package/dist/commands/cliproxy/variant-subcommand.js.map +1 -1
  140. package/dist/commands/command-catalog.d.ts +1 -1
  141. package/dist/commands/command-catalog.d.ts.map +1 -1
  142. package/dist/commands/command-catalog.js +3 -2
  143. package/dist/commands/command-catalog.js.map +1 -1
  144. package/dist/commands/completion-backend.d.ts.map +1 -1
  145. package/dist/commands/completion-backend.js +7 -0
  146. package/dist/commands/completion-backend.js.map +1 -1
  147. package/dist/commands/config-command-options.d.ts.map +1 -1
  148. package/dist/commands/config-command-options.js +4 -2
  149. package/dist/commands/config-command-options.js.map +1 -1
  150. package/dist/commands/config-command.js +1 -1
  151. package/dist/commands/config-command.js.map +1 -1
  152. package/dist/commands/config-dashboard-host.d.ts +1 -0
  153. package/dist/commands/config-dashboard-host.d.ts.map +1 -1
  154. package/dist/commands/config-dashboard-host.js +2 -1
  155. package/dist/commands/config-dashboard-host.js.map +1 -1
  156. package/dist/commands/copilot-command.js +3 -1
  157. package/dist/commands/copilot-command.js.map +1 -1
  158. package/dist/commands/help-command.d.ts.map +1 -1
  159. package/dist/commands/help-command.js +2 -1
  160. package/dist/commands/help-command.js.map +1 -1
  161. package/dist/commands/sync-command.d.ts.map +1 -1
  162. package/dist/commands/sync-command.js +3 -2
  163. package/dist/commands/sync-command.js.map +1 -1
  164. package/dist/config/loader/yaml-serializer.d.ts.map +1 -1
  165. package/dist/config/loader/yaml-serializer.js +4 -3
  166. package/dist/config/loader/yaml-serializer.js.map +1 -1
  167. package/dist/config/migration-manager.d.ts.map +1 -1
  168. package/dist/config/migration-manager.js +12 -0
  169. package/dist/config/migration-manager.js.map +1 -1
  170. package/dist/config/schemas/auth.d.ts +2 -0
  171. package/dist/config/schemas/auth.d.ts.map +1 -1
  172. package/dist/config/schemas/auth.js.map +1 -1
  173. package/dist/config/schemas/copilot-cursor.d.ts +2 -2
  174. package/dist/config/schemas/copilot-cursor.js +1 -1
  175. package/dist/config/schemas/unified-config.d.ts +1 -1
  176. package/dist/config/schemas/unified-config.d.ts.map +1 -1
  177. package/dist/delegation/delegation-handler.d.ts.map +1 -1
  178. package/dist/delegation/delegation-handler.js +107 -33
  179. package/dist/delegation/delegation-handler.js.map +1 -1
  180. package/dist/delegation/headless-executor.js +1 -1
  181. package/dist/delegation/headless-executor.js.map +1 -1
  182. package/dist/dispatcher/flows/account-flow.d.ts.map +1 -1
  183. package/dist/dispatcher/flows/account-flow.js +4 -3
  184. package/dist/dispatcher/flows/account-flow.js.map +1 -1
  185. package/dist/dispatcher/flows/settings-flow.js +1 -1
  186. package/dist/dispatcher/flows/settings-flow.js.map +1 -1
  187. package/dist/proxy/upstream-url.d.ts.map +1 -1
  188. package/dist/proxy/upstream-url.js +8 -0
  189. package/dist/proxy/upstream-url.js.map +1 -1
  190. package/dist/shared/claude-extension-setup.d.ts.map +1 -1
  191. package/dist/shared/claude-extension-setup.js +5 -1
  192. package/dist/shared/claude-extension-setup.js.map +1 -1
  193. package/dist/shared/provider-preset-catalog.d.ts +1 -1
  194. package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
  195. package/dist/shared/provider-preset-catalog.js +1 -1
  196. package/dist/shared/provider-preset-catalog.js.map +1 -1
  197. package/dist/types/config.d.ts +2 -0
  198. package/dist/types/config.d.ts.map +1 -1
  199. package/dist/types/config.js.map +1 -1
  200. package/dist/ui/assets/accounts-D_ROBWJW.js +1 -0
  201. package/dist/ui/assets/{alert-dialog-C6npAhT0.js → alert-dialog-CdBSeTf8.js} +1 -1
  202. package/dist/ui/assets/{api-DZosWVkR.js → api-DZp9XoZ3.js} +1 -1
  203. package/dist/ui/assets/{auth-section-D4MZkgcP.js → auth-section-CBHPWh8P.js} +1 -1
  204. package/dist/ui/assets/{backups-section-DvMJrmHH.js → backups-section-BEfeEYNu.js} +1 -1
  205. package/dist/ui/assets/{channels-BVftYfOn.js → channels-yd4p8uGF.js} +1 -1
  206. package/dist/ui/assets/{checkbox-BLRznRTO.js → checkbox-O4MS4m31.js} +1 -1
  207. package/dist/ui/assets/{claude-extension-C6OeBQ73.js → claude-extension-RX6pi5Dq.js} +1 -1
  208. package/dist/ui/assets/cliproxy-CCPBZ2hk.js +4 -0
  209. package/dist/ui/assets/{cliproxy-ai-providers-BAJ78pUc.js → cliproxy-ai-providers-CFaY0exX.js} +1 -1
  210. package/dist/ui/assets/{cliproxy-control-panel-XEvUMVJe.js → cliproxy-control-panel-Co84wmaz.js} +1 -1
  211. package/dist/ui/assets/{codex-CY2vikqX.js → codex-BndwF_Uy.js} +2 -2
  212. package/dist/ui/assets/{confirm-dialog-DjLHh1qX.js → confirm-dialog-CuqXEw3c.js} +1 -1
  213. package/dist/ui/assets/{copilot-afee2lL9.js → copilot-DwVnqcwy.js} +2 -2
  214. package/dist/ui/assets/{cursor-DuWy60wp.js → cursor-DMk7oeR8.js} +1 -1
  215. package/dist/ui/assets/{droid-FlceoQ6k.js → droid-BNzpeb07.js} +1 -1
  216. package/dist/ui/assets/{globalenv-section-DpJ7unxC.js → globalenv-section-BDlzpym6.js} +1 -1
  217. package/dist/ui/assets/{health-BEMgcKD3.js → health-BQ7Tv1rQ.js} +1 -1
  218. package/dist/ui/assets/{icons-DQFHtVq5.js → icons-DzKUh8vG.js} +1 -1
  219. package/dist/ui/assets/{index-Ba4ysocb.js → index-B5Fvdc9D.js} +1 -1
  220. package/dist/ui/assets/{index-0n_43sCZ.js → index-BQO1Car5.js} +1 -1
  221. package/dist/ui/assets/index-C-pkmHvH.css +1 -0
  222. package/dist/ui/assets/{index-Cq9VySs6.js → index-C1oiTZ4n.js} +1 -1
  223. package/dist/ui/assets/index-CHRUhYJD.js +72 -0
  224. package/dist/ui/assets/{index-DOC7_hun.js → index-DTFmb_cl.js} +1 -1
  225. package/dist/ui/assets/{index-Cj7EjEq6.js → index-DgTEmJwC.js} +1 -1
  226. package/dist/ui/assets/{index-0GkznW41.js → index-dIME7UaU.js} +1 -1
  227. package/dist/ui/assets/{logs-Dth4naJl.js → logs-BTE4BziS.js} +1 -1
  228. package/dist/ui/assets/{masked-input-DL6pJ8pE.js → masked-input-FdlUBXx1.js} +1 -1
  229. package/dist/ui/assets/{proxy-status-widget-DW4cPFeD.js → proxy-status-widget-BHCYqiYU.js} +1 -1
  230. package/dist/ui/assets/raw-json-settings-editor-panel-BWEzkHEh.js +1 -0
  231. package/dist/ui/assets/{searchable-select-CWL2D5Ft.js → searchable-select-DuJbJ_tt.js} +1 -1
  232. package/dist/ui/assets/{separator-Do_vqTQD.js → separator-ohkxsfxk.js} +1 -1
  233. package/dist/ui/assets/shared-1ZnvRlC8.js +8 -0
  234. package/dist/ui/assets/{table-BP6nBZzg.js → table-BXnQYMP2.js} +1 -1
  235. package/dist/ui/assets/{updates-BTHJZ7Rk.js → updates-Cp9b84A6.js} +1 -1
  236. package/dist/ui/assets/use-accounts-C88lVWLw.js +1 -0
  237. package/dist/ui/index.html +3 -3
  238. package/dist/utils/shell-executor.d.ts +6 -1
  239. package/dist/utils/shell-executor.d.ts.map +1 -1
  240. package/dist/utils/shell-executor.js +15 -2
  241. package/dist/utils/shell-executor.js.map +1 -1
  242. package/dist/web-server/index.d.ts.map +1 -1
  243. package/dist/web-server/index.js +80 -20
  244. package/dist/web-server/index.js.map +1 -1
  245. package/dist/web-server/middleware/auth-middleware.d.ts +5 -0
  246. package/dist/web-server/middleware/auth-middleware.d.ts.map +1 -1
  247. package/dist/web-server/middleware/auth-middleware.js +73 -1
  248. package/dist/web-server/middleware/auth-middleware.js.map +1 -1
  249. package/dist/web-server/routes/account-route-helpers.d.ts +3 -0
  250. package/dist/web-server/routes/account-route-helpers.d.ts.map +1 -1
  251. package/dist/web-server/routes/account-route-helpers.js.map +1 -1
  252. package/dist/web-server/routes/account-routes.d.ts.map +1 -1
  253. package/dist/web-server/routes/account-routes.js +97 -4
  254. package/dist/web-server/routes/account-routes.js.map +1 -1
  255. package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
  256. package/dist/web-server/routes/cliproxy-auth-routes.js +62 -3
  257. package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
  258. package/dist/web-server/routes/codex-routes.d.ts.map +1 -1
  259. package/dist/web-server/routes/codex-routes.js +7 -0
  260. package/dist/web-server/routes/codex-routes.js.map +1 -1
  261. package/dist/web-server/shared-routes-collections.d.ts +13 -0
  262. package/dist/web-server/shared-routes-collections.d.ts.map +1 -0
  263. package/dist/web-server/shared-routes-collections.js +170 -0
  264. package/dist/web-server/shared-routes-collections.js.map +1 -0
  265. package/dist/web-server/shared-routes-content.d.ts +16 -0
  266. package/dist/web-server/shared-routes-content.d.ts.map +1 -0
  267. package/dist/web-server/shared-routes-content.js +152 -0
  268. package/dist/web-server/shared-routes-content.js.map +1 -0
  269. package/dist/web-server/shared-routes-markdown-walker.d.ts +12 -0
  270. package/dist/web-server/shared-routes-markdown-walker.d.ts.map +1 -0
  271. package/dist/web-server/shared-routes-markdown-walker.js +97 -0
  272. package/dist/web-server/shared-routes-markdown-walker.js.map +1 -0
  273. package/dist/web-server/shared-routes-markdown.d.ts +18 -0
  274. package/dist/web-server/shared-routes-markdown.d.ts.map +1 -0
  275. package/dist/web-server/shared-routes-markdown.js +167 -0
  276. package/dist/web-server/shared-routes-markdown.js.map +1 -0
  277. package/dist/web-server/shared-routes-path-guards.d.ts +16 -0
  278. package/dist/web-server/shared-routes-path-guards.d.ts.map +1 -0
  279. package/dist/web-server/shared-routes-path-guards.js +93 -0
  280. package/dist/web-server/shared-routes-path-guards.js.map +1 -0
  281. package/dist/web-server/shared-routes-plugin-registry-content.d.ts +12 -0
  282. package/dist/web-server/shared-routes-plugin-registry-content.d.ts.map +1 -0
  283. package/dist/web-server/shared-routes-plugin-registry-content.js +93 -0
  284. package/dist/web-server/shared-routes-plugin-registry-content.js.map +1 -0
  285. package/dist/web-server/shared-routes-plugins.d.ts +21 -0
  286. package/dist/web-server/shared-routes-plugins.d.ts.map +1 -0
  287. package/dist/web-server/shared-routes-plugins.js +197 -0
  288. package/dist/web-server/shared-routes-plugins.js.map +1 -0
  289. package/dist/web-server/shared-routes-symlink-status.d.ts +27 -0
  290. package/dist/web-server/shared-routes-symlink-status.d.ts.map +1 -0
  291. package/dist/web-server/shared-routes-symlink-status.js +135 -0
  292. package/dist/web-server/shared-routes-symlink-status.js.map +1 -0
  293. package/dist/web-server/shared-routes-types.d.ts +23 -0
  294. package/dist/web-server/shared-routes-types.d.ts.map +1 -0
  295. package/dist/web-server/shared-routes-types.js +15 -0
  296. package/dist/web-server/shared-routes-types.js.map +1 -0
  297. package/dist/web-server/shared-routes.d.ts +2 -1
  298. package/dist/web-server/shared-routes.d.ts.map +1 -1
  299. package/dist/web-server/shared-routes.js +49 -455
  300. package/dist/web-server/shared-routes.js.map +1 -1
  301. package/lib/mcp/ccs-browser-server.cjs +153 -6
  302. package/package.json +1 -1
  303. package/dist/ui/assets/accounts-CybVGDsm.js +0 -1
  304. package/dist/ui/assets/cliproxy-B3Jyu3r9.js +0 -3
  305. package/dist/ui/assets/index-6xrth3Oz.css +0 -1
  306. package/dist/ui/assets/index-BRtgic66.js +0 -72
  307. package/dist/ui/assets/raw-json-settings-editor-panel-Dcumu3Qi.js +0 -1
  308. package/dist/ui/assets/shared-CwWuZx24.js +0 -8
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ /**
3
+ * Shared Routes — Item content readers
4
+ *
5
+ * Resolves the full markdown content for a given shared item path,
6
+ * routing by collection type and enforcing allowed-root checks.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.getSharedItemContent = exports.getSharedSettingsContent = void 0;
33
+ const fs = __importStar(require("fs"));
34
+ const path = __importStar(require("path"));
35
+ const shared_routes_path_guards_1 = require("./shared-routes-path-guards");
36
+ const shared_routes_markdown_1 = require("./shared-routes-markdown");
37
+ const shared_routes_plugins_1 = require("./shared-routes-plugins");
38
+ const shared_routes_plugin_registry_content_1 = require("./shared-routes-plugin-registry-content");
39
+ // ---------------------------------------------------------------------------
40
+ // Settings
41
+ // ---------------------------------------------------------------------------
42
+ function getSharedSettingsContent(itemPath, allowedRoots) {
43
+ if (path.basename(itemPath) !== 'settings.json') {
44
+ return null;
45
+ }
46
+ const sharedRoot = Array.from(allowedRoots)[0];
47
+ if (!sharedRoot) {
48
+ return null;
49
+ }
50
+ const settingsPath = path.join(sharedRoot, 'settings.json');
51
+ const resolvedSettingsPath = (0, shared_routes_path_guards_1.safeRealPath)(settingsPath);
52
+ if (!resolvedSettingsPath || !(0, shared_routes_path_guards_1.isPathWithinAny)(resolvedSettingsPath, allowedRoots)) {
53
+ return null;
54
+ }
55
+ let stats;
56
+ try {
57
+ stats = fs.statSync(resolvedSettingsPath);
58
+ }
59
+ catch {
60
+ return null;
61
+ }
62
+ if (!stats.isFile() || stats.size > shared_routes_markdown_1.MAX_CONTENT_FILE_BYTES) {
63
+ return null;
64
+ }
65
+ try {
66
+ const rawContent = fs.readFileSync(resolvedSettingsPath, 'utf8');
67
+ const parsed = JSON.parse(rawContent);
68
+ return {
69
+ content: JSON.stringify(parsed, null, 2),
70
+ contentPath: resolvedSettingsPath,
71
+ };
72
+ }
73
+ catch {
74
+ const content = (0, shared_routes_markdown_1.readMarkdownContent)(resolvedSettingsPath, allowedRoots);
75
+ return content ? { content, contentPath: resolvedSettingsPath } : null;
76
+ }
77
+ }
78
+ exports.getSharedSettingsContent = getSharedSettingsContent;
79
+ // ---------------------------------------------------------------------------
80
+ // Generic item content
81
+ // ---------------------------------------------------------------------------
82
+ function getSharedItemContent(type, itemPath, allowedRoots, sharedDir) {
83
+ if (type === 'settings') {
84
+ return getSharedSettingsContent(itemPath, allowedRoots);
85
+ }
86
+ if (type === 'plugins') {
87
+ const pluginRegistryContent = (0, shared_routes_plugin_registry_content_1.getPluginRegistryContent)(itemPath, sharedDir, allowedRoots);
88
+ if (pluginRegistryContent) {
89
+ return pluginRegistryContent;
90
+ }
91
+ }
92
+ const resolvedItemPath = (0, shared_routes_path_guards_1.safeRealPath)(itemPath);
93
+ if (!resolvedItemPath || !(0, shared_routes_path_guards_1.isPathWithinAny)(resolvedItemPath, allowedRoots)) {
94
+ return null;
95
+ }
96
+ let itemStats;
97
+ try {
98
+ itemStats = fs.statSync(resolvedItemPath);
99
+ }
100
+ catch {
101
+ return null;
102
+ }
103
+ let markdownPath = null;
104
+ if (type === 'commands') {
105
+ if (!itemStats.isFile() || !itemPath.toLowerCase().endsWith('.md')) {
106
+ return null;
107
+ }
108
+ markdownPath = resolvedItemPath;
109
+ }
110
+ else if (type === 'skills') {
111
+ if (!itemStats.isDirectory()) {
112
+ return null;
113
+ }
114
+ markdownPath = (0, shared_routes_markdown_1.resolveReadableMarkdownPath)([path.join(resolvedItemPath, 'SKILL.md')], allowedRoots);
115
+ }
116
+ else if (type === 'plugins') {
117
+ if (!itemStats.isDirectory() || (0, shared_routes_plugins_1.isPluginInfrastructurePath)(resolvedItemPath, sharedDir)) {
118
+ return null;
119
+ }
120
+ markdownPath = (0, shared_routes_markdown_1.resolveReadableMarkdownPath)([
121
+ path.join(resolvedItemPath, 'README.md'),
122
+ path.join(resolvedItemPath, 'readme.md'),
123
+ path.join(resolvedItemPath, 'PLUGIN.md'),
124
+ ], allowedRoots);
125
+ if (!markdownPath) {
126
+ return null;
127
+ }
128
+ }
129
+ else {
130
+ // agents
131
+ if (itemStats.isDirectory()) {
132
+ markdownPath = (0, shared_routes_markdown_1.resolveReadableMarkdownPath)([
133
+ path.join(resolvedItemPath, 'prompt.md'),
134
+ path.join(resolvedItemPath, 'AGENT.md'),
135
+ path.join(resolvedItemPath, 'agent.md'),
136
+ ], allowedRoots);
137
+ }
138
+ else if (itemStats.isFile() && itemPath.toLowerCase().endsWith('.md')) {
139
+ markdownPath = resolvedItemPath;
140
+ }
141
+ }
142
+ if (!markdownPath) {
143
+ return null;
144
+ }
145
+ const content = (0, shared_routes_markdown_1.readMarkdownContent)(markdownPath, allowedRoots);
146
+ if (!content) {
147
+ return null;
148
+ }
149
+ return { content, contentPath: markdownPath };
150
+ }
151
+ exports.getSharedItemContent = getSharedItemContent;
152
+ //# sourceMappingURL=shared-routes-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-routes-content.js","sourceRoot":"","sources":["../../src/web-server/shared-routes-content.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAE7B,2EAA4E;AAC5E,qEAIkC;AAClC,mEAAqE;AACrE,mGAAmF;AAGnF,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E,SAAgB,wBAAwB,CACtC,QAAgB,EAChB,YAAyB;IAEzB,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,eAAe,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAC5D,MAAM,oBAAoB,GAAG,IAAA,wCAAY,EAAC,YAAY,CAAC,CAAC;IACxD,IAAI,CAAC,oBAAoB,IAAI,CAAC,IAAA,2CAAe,EAAC,oBAAoB,EAAE,YAAY,CAAC,EAAE,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,KAAe,CAAC;IACpB,IAAI,CAAC;QACH,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,GAAG,+CAAsB,EAAE,CAAC;QAC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;QACT,IAAI,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;YAC5B,YAAY,GAAG,IAAA,oDAA2B,EACxC;gBACE,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC;gBACxC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;gBACvC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;aACxC,EACD,YAAY,CACb,CAAC;QACJ,CAAC;aAAM,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACxE,YAAY,GAAG,gBAAgB,CAAC;QAClC,CAAC;IACH,CAAC;IAED,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,4CAAmB,EAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAChE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;AAChD,CAAC;AArFD,oDAqFC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared Routes — Markdown directory walker
3
+ *
4
+ * Iterative BFS/DFS over a shared directory collecting all .md files
5
+ * within allowed roots and the configured traversal depth limit.
6
+ */
7
+ export interface MarkdownFileEntry {
8
+ displayPath: string;
9
+ resolvedPath: string;
10
+ }
11
+ export declare function collectMarkdownFiles(sharedDir: string, allowedRoots: Set<string>): MarkdownFileEntry[];
12
+ //# sourceMappingURL=shared-routes-markdown-walker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-routes-markdown-walker.d.ts","sourceRoot":"","sources":["../../src/web-server/shared-routes-markdown-walker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,iBAAiB,EAAE,CAmErB"}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ /**
3
+ * Shared Routes — Markdown directory walker
4
+ *
5
+ * Iterative BFS/DFS over a shared directory collecting all .md files
6
+ * within allowed roots and the configured traversal depth limit.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.collectMarkdownFiles = void 0;
33
+ const fs = __importStar(require("fs"));
34
+ const path = __importStar(require("path"));
35
+ const shared_routes_path_guards_1 = require("./shared-routes-path-guards");
36
+ const MAX_DIRECTORY_TRAVERSAL_DEPTH = 10;
37
+ function collectMarkdownFiles(sharedDir, allowedRoots) {
38
+ const directoriesToVisit = [
39
+ { path: sharedDir, depth: 0 },
40
+ ];
41
+ const visitedDirectories = new Set();
42
+ const markdownFiles = [];
43
+ while (directoriesToVisit.length > 0) {
44
+ const current = directoriesToVisit.pop();
45
+ if (!current) {
46
+ continue;
47
+ }
48
+ const currentDir = current.path;
49
+ const resolvedCurrentDir = (0, shared_routes_path_guards_1.safeRealPath)(currentDir);
50
+ if (!resolvedCurrentDir || !(0, shared_routes_path_guards_1.isPathWithinAny)(resolvedCurrentDir, allowedRoots)) {
51
+ continue;
52
+ }
53
+ const normalizedDirPath = process.platform === 'win32'
54
+ ? path.resolve(resolvedCurrentDir).toLowerCase()
55
+ : path.resolve(resolvedCurrentDir);
56
+ if (visitedDirectories.has(normalizedDirPath)) {
57
+ continue;
58
+ }
59
+ visitedDirectories.add(normalizedDirPath);
60
+ let entries = [];
61
+ try {
62
+ entries = fs.readdirSync(currentDir, { withFileTypes: true });
63
+ }
64
+ catch {
65
+ continue;
66
+ }
67
+ for (const entry of entries) {
68
+ const entryPath = path.join(currentDir, entry.name);
69
+ const resolvedEntryPath = (0, shared_routes_path_guards_1.safeRealPath)(entryPath);
70
+ if (!resolvedEntryPath || !(0, shared_routes_path_guards_1.isPathWithinAny)(resolvedEntryPath, allowedRoots)) {
71
+ continue;
72
+ }
73
+ let stats;
74
+ try {
75
+ stats = fs.statSync(resolvedEntryPath);
76
+ }
77
+ catch {
78
+ continue;
79
+ }
80
+ if (stats.isDirectory()) {
81
+ if (current.depth < MAX_DIRECTORY_TRAVERSAL_DEPTH) {
82
+ directoriesToVisit.push({ path: entryPath, depth: current.depth + 1 });
83
+ }
84
+ continue;
85
+ }
86
+ if (stats.isFile() && entry.name.toLowerCase().endsWith('.md')) {
87
+ markdownFiles.push({
88
+ displayPath: entryPath,
89
+ resolvedPath: resolvedEntryPath,
90
+ });
91
+ }
92
+ }
93
+ }
94
+ return markdownFiles;
95
+ }
96
+ exports.collectMarkdownFiles = collectMarkdownFiles;
97
+ //# sourceMappingURL=shared-routes-markdown-walker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-routes-markdown-walker.js","sourceRoot":"","sources":["../../src/web-server/shared-routes-markdown-walker.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAE7B,2EAA4E;AAE5E,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAOzC,SAAgB,oBAAoB,CAClC,SAAiB,EACjB,YAAyB;IAEzB,MAAM,kBAAkB,GAA2C;QACjE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE;KAC9B,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC7C,MAAM,aAAa,GAAwB,EAAE,CAAC;IAE9C,OAAO,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,kBAAkB,CAAC,GAAG,EAAE,CAAC;QACzC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;QAChC,MAAM,kBAAkB,GAAG,IAAA,wCAAY,EAAC,UAAU,CAAC,CAAC;QACpD,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAA,2CAAe,EAAC,kBAAkB,EAAE,YAAY,CAAC,EAAE,CAAC;YAC9E,SAAS;QACX,CAAC;QAED,MAAM,iBAAiB,GACrB,OAAO,CAAC,QAAQ,KAAK,OAAO;YAC1B,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,WAAW,EAAE;YAChD,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAEvC,IAAI,kBAAkB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC9C,SAAS;QACX,CAAC;QACD,kBAAkB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAE1C,IAAI,OAAO,GAAgB,EAAE,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0,0 +1,18 @@
1
+ /**
2
+ * Shared Routes — Markdown file reading and description extraction
3
+ *
4
+ * Handles YAML frontmatter parsing, body-line extraction, and safe
5
+ * bounded reads for both description snippets and full content.
6
+ *
7
+ * Directory walking is in shared-routes-markdown-walker.ts.
8
+ */
9
+ /** Exported for content module which uses a larger limit. */
10
+ export declare const MAX_CONTENT_FILE_BYTES: number;
11
+ export type { MarkdownFileEntry } from './shared-routes-markdown-walker';
12
+ export { collectMarkdownFiles } from './shared-routes-markdown-walker';
13
+ export declare function extractDescription(content: string): string;
14
+ export declare function readMarkdownDescription(markdownPath: string, allowedRoots: Set<string>): string | null;
15
+ export declare function readFirstMarkdownDescription(markdownPaths: string[], allowedRoots: Set<string>): string | null;
16
+ export declare function readMarkdownContent(markdownPath: string, allowedRoots: Set<string>): string | null;
17
+ export declare function resolveReadableMarkdownPath(markdownPaths: string[], allowedRoots: Set<string>): string | null;
18
+ //# sourceMappingURL=shared-routes-markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-routes-markdown.d.ts","sourceRoot":"","sources":["../../src/web-server/shared-routes-markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,QAAkB,CAAC;AAGtD,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AA8CvE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAgB1D;AAMD,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,MAAM,GAAG,IAAI,CAef;AAED,wBAAgB,4BAA4B,CAC1C,aAAa,EAAE,MAAM,EAAE,EACvB,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,MAAM,GAAG,IAAI,CAQf;AAED,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,MAAM,GAAG,IAAI,CAcf;AAED,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,EAAE,EACvB,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,MAAM,GAAG,IAAI,CAiBf"}
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ /**
3
+ * Shared Routes — Markdown file reading and description extraction
4
+ *
5
+ * Handles YAML frontmatter parsing, body-line extraction, and safe
6
+ * bounded reads for both description snippets and full content.
7
+ *
8
+ * Directory walking is in shared-routes-markdown-walker.ts.
9
+ */
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
23
+ }) : function(o, v) {
24
+ o["default"] = v;
25
+ });
26
+ var __importStar = (this && this.__importStar) || function (mod) {
27
+ if (mod && mod.__esModule) return mod;
28
+ var result = {};
29
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
30
+ __setModuleDefault(result, mod);
31
+ return result;
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.resolveReadableMarkdownPath = exports.readMarkdownContent = exports.readFirstMarkdownDescription = exports.readMarkdownDescription = exports.extractDescription = exports.collectMarkdownFiles = exports.MAX_CONTENT_FILE_BYTES = void 0;
35
+ const fs = __importStar(require("fs"));
36
+ const yaml = __importStar(require("js-yaml"));
37
+ const shared_routes_path_guards_1 = require("./shared-routes-path-guards");
38
+ const MAX_DESCRIPTION_LENGTH = 140;
39
+ const MAX_MARKDOWN_FILE_BYTES = 1024 * 1024; // 1 MiB
40
+ /** Exported for content module which uses a larger limit. */
41
+ exports.MAX_CONTENT_FILE_BYTES = 2 * 1024 * 1024; // 2 MiB
42
+ var shared_routes_markdown_walker_1 = require("./shared-routes-markdown-walker");
43
+ Object.defineProperty(exports, "collectMarkdownFiles", { enumerable: true, get: function () { return shared_routes_markdown_walker_1.collectMarkdownFiles; } });
44
+ // ---------------------------------------------------------------------------
45
+ // Description extraction helpers
46
+ // ---------------------------------------------------------------------------
47
+ function isDescriptionBodyLine(line) {
48
+ if (!line) {
49
+ return false;
50
+ }
51
+ if (line === '---' || line === '...') {
52
+ return false;
53
+ }
54
+ return !line.startsWith('#') && !line.startsWith('<!--');
55
+ }
56
+ function extractFrontmatterDescription(content) {
57
+ const frontmatterMatch = content.match(/^---\s*\r?\n([\s\S]*?)\r?\n---(?:\s*\r?\n|$)/);
58
+ if (!frontmatterMatch) {
59
+ return null;
60
+ }
61
+ try {
62
+ const parsed = yaml.load(frontmatterMatch[1]);
63
+ const description = parsed?.description;
64
+ if (typeof description !== 'string') {
65
+ return null;
66
+ }
67
+ const trimmed = description.trim();
68
+ return trimmed.length > 0 ? trimmed : null;
69
+ }
70
+ catch {
71
+ return null;
72
+ }
73
+ }
74
+ function stripFrontmatter(content) {
75
+ return content.replace(/^---\s*\r?\n[\s\S]*?\r?\n---\s*\r?\n?/, '');
76
+ }
77
+ function trimDescription(description) {
78
+ if (description.length <= MAX_DESCRIPTION_LENGTH) {
79
+ return description;
80
+ }
81
+ return `${description.slice(0, MAX_DESCRIPTION_LENGTH - 3).trimEnd()}...`;
82
+ }
83
+ function extractDescription(content) {
84
+ const frontmatterDescription = extractFrontmatterDescription(content);
85
+ if (frontmatterDescription) {
86
+ return trimDescription(frontmatterDescription);
87
+ }
88
+ // Fall back to first non-empty, non-heading body line.
89
+ const lines = stripFrontmatter(content).split('\n');
90
+ for (const line of lines) {
91
+ const trimmed = line.trim();
92
+ if (isDescriptionBodyLine(trimmed)) {
93
+ return trimDescription(trimmed);
94
+ }
95
+ }
96
+ return 'No description';
97
+ }
98
+ exports.extractDescription = extractDescription;
99
+ // ---------------------------------------------------------------------------
100
+ // File readers
101
+ // ---------------------------------------------------------------------------
102
+ function readMarkdownDescription(markdownPath, allowedRoots) {
103
+ try {
104
+ const resolvedMarkdownPath = (0, shared_routes_path_guards_1.safeRealPath)(markdownPath);
105
+ if (!resolvedMarkdownPath || !(0, shared_routes_path_guards_1.isPathWithinAny)(resolvedMarkdownPath, allowedRoots)) {
106
+ return null;
107
+ }
108
+ const stats = fs.statSync(resolvedMarkdownPath);
109
+ if (!stats.isFile() || stats.size > MAX_MARKDOWN_FILE_BYTES) {
110
+ return null;
111
+ }
112
+ const content = fs.readFileSync(resolvedMarkdownPath, 'utf8');
113
+ return extractDescription(content);
114
+ }
115
+ catch {
116
+ return null;
117
+ }
118
+ }
119
+ exports.readMarkdownDescription = readMarkdownDescription;
120
+ function readFirstMarkdownDescription(markdownPaths, allowedRoots) {
121
+ for (const markdownPath of markdownPaths) {
122
+ const description = readMarkdownDescription(markdownPath, allowedRoots);
123
+ if (description) {
124
+ return description;
125
+ }
126
+ }
127
+ return null;
128
+ }
129
+ exports.readFirstMarkdownDescription = readFirstMarkdownDescription;
130
+ function readMarkdownContent(markdownPath, allowedRoots) {
131
+ try {
132
+ const resolvedMarkdownPath = (0, shared_routes_path_guards_1.safeRealPath)(markdownPath);
133
+ if (!resolvedMarkdownPath || !(0, shared_routes_path_guards_1.isPathWithinAny)(resolvedMarkdownPath, allowedRoots)) {
134
+ return null;
135
+ }
136
+ const stats = fs.statSync(resolvedMarkdownPath);
137
+ if (!stats.isFile() || stats.size > exports.MAX_CONTENT_FILE_BYTES) {
138
+ return null;
139
+ }
140
+ return fs.readFileSync(resolvedMarkdownPath, 'utf8');
141
+ }
142
+ catch {
143
+ return null;
144
+ }
145
+ }
146
+ exports.readMarkdownContent = readMarkdownContent;
147
+ function resolveReadableMarkdownPath(markdownPaths, allowedRoots) {
148
+ for (const markdownPath of markdownPaths) {
149
+ const resolvedMarkdownPath = (0, shared_routes_path_guards_1.safeRealPath)(markdownPath);
150
+ if (!resolvedMarkdownPath || !(0, shared_routes_path_guards_1.isPathWithinAny)(resolvedMarkdownPath, allowedRoots)) {
151
+ continue;
152
+ }
153
+ try {
154
+ const stats = fs.statSync(resolvedMarkdownPath);
155
+ if (!stats.isFile() || stats.size > exports.MAX_CONTENT_FILE_BYTES) {
156
+ continue;
157
+ }
158
+ return resolvedMarkdownPath;
159
+ }
160
+ catch {
161
+ continue;
162
+ }
163
+ }
164
+ return null;
165
+ }
166
+ exports.resolveReadableMarkdownPath = resolveReadableMarkdownPath;
167
+ //# sourceMappingURL=shared-routes-markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-routes-markdown.js","sourceRoot":"","sources":["../../src/web-server/shared-routes-markdown.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,8CAAgC;AAEhC,2EAA4E;AAE5E,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,uBAAuB,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AAErD,6DAA6D;AAChD,QAAA,sBAAsB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AAI/D,iFAAuE;AAA9D,qIAAA,oBAAoB,OAAA;AAE7B,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E,SAAS,qBAAqB,CAAC,IAAY;IACzC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACr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,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,GAAG,8BAAsB,EAAE,CAAC;gBAC3D,SAAS;YACX,CAAC;YACD,OAAO,oBAAoB,CAAC;QAC9B,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AApBD,kEAoBC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Shared Routes — Path safety helpers
3
+ *
4
+ * Prevents directory traversal by resolving real paths and checking
5
+ * containment within allowed roots before any file I/O.
6
+ */
7
+ import { getCcsDir } from '../config/config-loader-facade';
8
+ import type { SharedCollectionType } from './shared-routes-types';
9
+ export declare function safeRealPath(targetPath: string): string | null;
10
+ export declare function normalizeForPathComparison(targetPath: string): string;
11
+ export declare function isPathWithin(candidatePath: string, basePath: string): boolean;
12
+ export declare function isPathWithinAny(candidatePath: string, basePaths: Set<string>): boolean;
13
+ export declare function resolveAllowedRoots(type: SharedCollectionType, ccsDir: string, sharedDirRoot: string): Set<string>;
14
+ export declare function resolveSettingsAllowedRoots(ccsDir: string, sharedDirRoot: string): Set<string>;
15
+ export { getCcsDir };
16
+ //# sourceMappingURL=shared-routes-path-guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-routes-path-guards.d.ts","sourceRoot":"","sources":["../../src/web-server/shared-routes-path-guards.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM9D;AAED,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAGrE;AAED,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK7E;AAED,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAOtF;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,oBAAoB,EAC1B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACpB,GAAG,CAAC,MAAM,CAAC,CAeb;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAS9F;AAGD,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ /**
3
+ * Shared Routes — Path safety helpers
4
+ *
5
+ * Prevents directory traversal by resolving real paths and checking
6
+ * containment within allowed roots before any file I/O.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.getCcsDir = exports.resolveSettingsAllowedRoots = exports.resolveAllowedRoots = exports.isPathWithinAny = exports.isPathWithin = exports.normalizeForPathComparison = exports.safeRealPath = void 0;
33
+ const fs = __importStar(require("fs"));
34
+ const path = __importStar(require("path"));
35
+ const claude_config_path_1 = require("../utils/claude-config-path");
36
+ const config_loader_facade_1 = require("../config/config-loader-facade");
37
+ Object.defineProperty(exports, "getCcsDir", { enumerable: true, get: function () { return config_loader_facade_1.getCcsDir; } });
38
+ function safeRealPath(targetPath) {
39
+ try {
40
+ return fs.realpathSync(targetPath);
41
+ }
42
+ catch {
43
+ return null;
44
+ }
45
+ }
46
+ exports.safeRealPath = safeRealPath;
47
+ function normalizeForPathComparison(targetPath) {
48
+ const normalized = path.resolve(targetPath);
49
+ return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
50
+ }
51
+ exports.normalizeForPathComparison = normalizeForPathComparison;
52
+ function isPathWithin(candidatePath, basePath) {
53
+ const normalizedCandidate = normalizeForPathComparison(candidatePath);
54
+ const normalizedBase = normalizeForPathComparison(basePath);
55
+ const relative = path.relative(normalizedBase, normalizedCandidate);
56
+ return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
57
+ }
58
+ exports.isPathWithin = isPathWithin;
59
+ function isPathWithinAny(candidatePath, basePaths) {
60
+ for (const basePath of basePaths) {
61
+ if (isPathWithin(candidatePath, basePath)) {
62
+ return true;
63
+ }
64
+ }
65
+ return false;
66
+ }
67
+ exports.isPathWithinAny = isPathWithinAny;
68
+ function resolveAllowedRoots(type, ccsDir, sharedDirRoot) {
69
+ if (type === 'commands' || type === 'plugins') {
70
+ return new Set([sharedDirRoot]);
71
+ }
72
+ return new Set([
73
+ sharedDirRoot,
74
+ ...[
75
+ path.join((0, claude_config_path_1.getClaudeConfigDir)(), type),
76
+ path.join(ccsDir, '.claude', type),
77
+ path.join(ccsDir, 'shared', type),
78
+ ]
79
+ .map((dirPath) => safeRealPath(dirPath))
80
+ .filter((dirPath) => typeof dirPath === 'string'),
81
+ ]);
82
+ }
83
+ exports.resolveAllowedRoots = resolveAllowedRoots;
84
+ function resolveSettingsAllowedRoots(ccsDir, sharedDirRoot) {
85
+ const claudeConfigDir = (0, claude_config_path_1.getClaudeConfigDir)();
86
+ return new Set([
87
+ sharedDirRoot,
88
+ safeRealPath(path.join(claudeConfigDir, 'settings.json')),
89
+ safeRealPath(path.join(ccsDir, '.claude', 'settings.json')),
90
+ ].filter((dirPath) => typeof dirPath === 'string'));
91
+ }
92
+ exports.resolveSettingsAllowedRoots = resolveSettingsAllowedRoots;
93
+ //# sourceMappingURL=shared-routes-path-guards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-routes-path-guards.js","sourceRoot":"","sources":["../../src/web-server/shared-routes-path-guards.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAE7B,oEAAiE;AACjE,yEAA2D;AAiElD,0FAjEA,gCAAS,OAiEA;AA9DlB,SAAgB,YAAY,CAAC,UAAkB;IAC7C,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAND,oCAMC;AAED,SAAgB,0BAA0B,CAAC,UAAkB;IAC3D,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AAC9E,CAAC;AAHD,gEAGC;AAED,SAAgB,YAAY,CAAC,aAAqB,EAAE,QAAgB;IAClE,MAAM,mBAAmB,GAAG,0BAA0B,CAAC,aAAa,CAAC,CAAC;IACtE,MAAM,cAAc,GAAG,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC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C,OAAO,IAAI,GAAG,CACZ;QACE,aAAa;QACb,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;QACzD,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;KAC5D,CAAC,MAAM,CAAC,CAAC,OAAO,EAAqB,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CACtE,CAAC;AACJ,CAAC;AATD,kEASC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared Routes — Plugin registry content renderer
3
+ *
4
+ * Renders the markdown content for an installed plugin entry,
5
+ * pulling from installed_plugins.json, known_marketplaces.json,
6
+ * and blocklist.json within the allowed roots.
7
+ */
8
+ export declare function getPluginRegistryContent(itemPath: string, sharedDir: string, allowedRoots: Set<string>): {
9
+ content: string;
10
+ contentPath: string;
11
+ } | null;
12
+ //# sourceMappingURL=shared-routes-plugin-registry-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-routes-plugin-registry-content.d.ts","sourceRoot":"","sources":["../../src/web-server/shared-routes-plugin-registry-content.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkCH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA0DjD"}