dexterm-cli 0.0.0-stage → 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 (349) hide show
  1. package/LICENSE +661 -0
  2. package/dist/packages/agents/src/audit.js +122 -0
  3. package/dist/packages/agents/src/bus.js +379 -0
  4. package/dist/packages/agents/src/executor.js +177 -0
  5. package/dist/packages/agents/src/gate.js +176 -0
  6. package/dist/packages/agents/src/identity.js +179 -0
  7. package/dist/packages/agents/src/index.js +15 -0
  8. package/dist/packages/agents/src/proposals.js +153 -0
  9. package/dist/packages/agents/src/schema.js +87 -0
  10. package/dist/packages/agents/src/sdk.js +140 -0
  11. package/dist/packages/agents/src/tiers.js +114 -0
  12. package/dist/packages/agents/src/tools.js +69 -0
  13. package/dist/packages/agents/src/ws.js +158 -0
  14. package/dist/packages/cli/assets/claude/analyst-system.md +76 -0
  15. package/dist/packages/cli/assets/claude/plugin/.claude-plugin/plugin.json +5 -0
  16. package/dist/packages/cli/assets/claude/plugin/skills/REGISTRY.json +16 -0
  17. package/dist/packages/cli/assets/claude/plugin/skills/larp-check/SKILL.md +67 -0
  18. package/dist/packages/cli/assets/claude/plugin/skills/rug-check/SKILL.md +64 -0
  19. package/dist/packages/cli/assets/claude/plugin/skills/token-dossier/SKILL.md +63 -0
  20. package/dist/packages/cli/assets/claude/plugin/skills/trench-scan/SKILL.md +44 -0
  21. package/dist/packages/cli/assets/claude/schemas/larp.schema.json +117 -0
  22. package/dist/packages/cli/assets/claude/schemas/trench-scan.schema.json +71 -0
  23. package/dist/packages/cli/assets/claude/schemas/verdict.schema.json +115 -0
  24. package/dist/packages/cli/bin/dexterm.mjs +11 -0
  25. package/dist/packages/cli/src/agent-cmd.js +303 -0
  26. package/dist/packages/cli/src/agent-roster.js +26 -0
  27. package/dist/packages/cli/src/analyst/backend.js +526 -0
  28. package/dist/packages/cli/src/analyst/results.js +38 -0
  29. package/dist/packages/cli/src/analyst/session.js +319 -0
  30. package/dist/packages/cli/src/audit.js +51 -0
  31. package/dist/packages/cli/src/backtest-cmd.js +149 -0
  32. package/dist/packages/cli/src/boot-state.js +62 -0
  33. package/dist/packages/cli/src/custom.js +261 -0
  34. package/dist/packages/cli/src/display.js +191 -0
  35. package/dist/packages/cli/src/doctor.js +361 -0
  36. package/dist/packages/cli/src/feed.js +634 -0
  37. package/dist/packages/cli/src/fixtures.js +275 -0
  38. package/dist/packages/cli/src/follow-cmd.js +221 -0
  39. package/dist/packages/cli/src/images-config.js +59 -0
  40. package/dist/packages/cli/src/index.js +31 -0
  41. package/dist/packages/cli/src/kb-skill-cmd.js +240 -0
  42. package/dist/packages/cli/src/larp-record.js +21 -0
  43. package/dist/packages/cli/src/live/copy.js +80 -0
  44. package/dist/packages/cli/src/live/flow.js +233 -0
  45. package/dist/packages/cli/src/live/index.js +509 -0
  46. package/dist/packages/cli/src/live/intel.js +227 -0
  47. package/dist/packages/cli/src/live/newpairs.js +334 -0
  48. package/dist/packages/cli/src/live/screens/newpairs-live.js +219 -0
  49. package/dist/packages/cli/src/live/screens/token-live.js +459 -0
  50. package/dist/packages/cli/src/live/screens/watchlist-live.js +149 -0
  51. package/dist/packages/cli/src/live/token.js +585 -0
  52. package/dist/packages/cli/src/live/trade.js +929 -0
  53. package/dist/packages/cli/src/live/watchlist.js +178 -0
  54. package/dist/packages/cli/src/main.js +5583 -0
  55. package/dist/packages/cli/src/narrative-cmd.js +76 -0
  56. package/dist/packages/cli/src/pack-cmd.js +323 -0
  57. package/dist/packages/cli/src/plan-cmd.js +278 -0
  58. package/dist/packages/cli/src/popup.js +810 -0
  59. package/dist/packages/cli/src/rules-cmd.js +131 -0
  60. package/dist/packages/cli/src/rules.js +339 -0
  61. package/dist/packages/cli/src/scan/command.js +57 -0
  62. package/dist/packages/cli/src/scan/engine.js +419 -0
  63. package/dist/packages/cli/src/scan/observe.js +64 -0
  64. package/dist/packages/cli/src/scan/ui.js +98 -0
  65. package/dist/packages/cli/src/screener/filter.js +241 -0
  66. package/dist/packages/cli/src/screener/presets.js +80 -0
  67. package/dist/packages/cli/src/screener/rows.js +146 -0
  68. package/dist/packages/cli/src/screener/rug.js +50 -0
  69. package/dist/packages/cli/src/screener/sort.js +52 -0
  70. package/dist/packages/cli/src/screener/view.js +183 -0
  71. package/dist/packages/cli/src/screens/analyst-session.js +343 -0
  72. package/dist/packages/cli/src/screens/analyst.js +326 -0
  73. package/dist/packages/cli/src/screens/boot.js +74 -0
  74. package/dist/packages/cli/src/screens/bubbles.js +255 -0
  75. package/dist/packages/cli/src/screens/coin.js +33 -0
  76. package/dist/packages/cli/src/screens/follows.js +201 -0
  77. package/dist/packages/cli/src/screens/kol.js +90 -0
  78. package/dist/packages/cli/src/screens/narrative.js +90 -0
  79. package/dist/packages/cli/src/screens/newpairs.js +150 -0
  80. package/dist/packages/cli/src/screens/overlay.js +257 -0
  81. package/dist/packages/cli/src/screens/plans.js +126 -0
  82. package/dist/packages/cli/src/screens/positions.js +176 -0
  83. package/dist/packages/cli/src/screens/rules.js +170 -0
  84. package/dist/packages/cli/src/screens/screener.js +459 -0
  85. package/dist/packages/cli/src/screens/social-panel.js +107 -0
  86. package/dist/packages/cli/src/screens/ticket.js +342 -0
  87. package/dist/packages/cli/src/screens/token.js +312 -0
  88. package/dist/packages/cli/src/screens/trending.js +181 -0
  89. package/dist/packages/cli/src/screens/watchlist.js +104 -0
  90. package/dist/packages/cli/src/social/demo.js +96 -0
  91. package/dist/packages/cli/src/social/view.js +250 -0
  92. package/dist/packages/cli/src/state.js +463 -0
  93. package/dist/packages/cli/src/theme-cmd.js +126 -0
  94. package/dist/packages/cli/src/trade.js +319 -0
  95. package/dist/packages/cli/src/voice-hud.js +42 -0
  96. package/dist/packages/cli/src/wallet-cmd.js +440 -0
  97. package/dist/packages/cli/src/wallet-command.js +31 -0
  98. package/dist/packages/cli/src/widgets.js +208 -0
  99. package/dist/packages/cli/src/workspace-cmd.js +68 -0
  100. package/dist/packages/cli/src/x-cmd.js +154 -0
  101. package/dist/packages/custom/src/config.js +213 -0
  102. package/dist/packages/custom/src/index.js +10 -0
  103. package/dist/packages/custom/src/keymap.js +107 -0
  104. package/dist/packages/custom/src/layout.js +235 -0
  105. package/dist/packages/custom/src/packs.js +633 -0
  106. package/dist/packages/custom/src/rules.js +704 -0
  107. package/dist/packages/custom/src/schema.js +515 -0
  108. package/dist/packages/custom/src/themes.js +176 -0
  109. package/dist/packages/custom/src/widget-html.js +222 -0
  110. package/dist/packages/custom/src/workspace.js +141 -0
  111. package/dist/packages/data/src/analyst-actions.js +133 -0
  112. package/dist/packages/data/src/budget.js +88 -0
  113. package/dist/packages/data/src/cache.js +142 -0
  114. package/dist/packages/data/src/candles.js +168 -0
  115. package/dist/packages/data/src/clock.js +64 -0
  116. package/dist/packages/data/src/credits.js +137 -0
  117. package/dist/packages/data/src/detail.js +97 -0
  118. package/dist/packages/data/src/fast-lane.js +321 -0
  119. package/dist/packages/data/src/fixtures.js +135 -0
  120. package/dist/packages/data/src/health.js +245 -0
  121. package/dist/packages/data/src/http.js +277 -0
  122. package/dist/packages/data/src/images/cache.js +141 -0
  123. package/dist/packages/data/src/images/decode-worker.js +28 -0
  124. package/dist/packages/data/src/images/decode.js +81 -0
  125. package/dist/packages/data/src/images/fetch.js +162 -0
  126. package/dist/packages/data/src/images/gif.js +214 -0
  127. package/dist/packages/data/src/images/index.js +10 -0
  128. package/dist/packages/data/src/images/jpeg.js +544 -0
  129. package/dist/packages/data/src/images/png.js +310 -0
  130. package/dist/packages/data/src/images/service.js +334 -0
  131. package/dist/packages/data/src/images/types.js +27 -0
  132. package/dist/packages/data/src/index.js +208 -0
  133. package/dist/packages/data/src/intel/helius-history.js +59 -0
  134. package/dist/packages/data/src/intel/holder-class.js +125 -0
  135. package/dist/packages/data/src/intel/rules.js +421 -0
  136. package/dist/packages/data/src/intel/scan.js +170 -0
  137. package/dist/packages/data/src/larp/evidence.js +288 -0
  138. package/dist/packages/data/src/larp/links.js +137 -0
  139. package/dist/packages/data/src/larp/robots.js +90 -0
  140. package/dist/packages/data/src/larp/safe-fetch.js +389 -0
  141. package/dist/packages/data/src/limiter.js +341 -0
  142. package/dist/packages/data/src/model.js +12 -0
  143. package/dist/packages/data/src/paper.js +331 -0
  144. package/dist/packages/data/src/rpc-config.js +126 -0
  145. package/dist/packages/data/src/rpc-pool.js +166 -0
  146. package/dist/packages/data/src/social/chain.js +83 -0
  147. package/dist/packages/data/src/social/dedupe.js +205 -0
  148. package/dist/packages/data/src/social/feed.js +462 -0
  149. package/dist/packages/data/src/social/firewall.js +110 -0
  150. package/dist/packages/data/src/social/index.js +11 -0
  151. package/dist/packages/data/src/social/kol.js +269 -0
  152. package/dist/packages/data/src/social/model.js +11 -0
  153. package/dist/packages/data/src/social/rank.js +184 -0
  154. package/dist/packages/data/src/social/rss.js +113 -0
  155. package/dist/packages/data/src/social/summary.js +104 -0
  156. package/dist/packages/data/src/social/venues.js +186 -0
  157. package/dist/packages/data/src/sources/dexscreener.js +170 -0
  158. package/dist/packages/data/src/sources/geckoterminal.js +133 -0
  159. package/dist/packages/data/src/sources/goplus.js +161 -0
  160. package/dist/packages/data/src/sources/jupiter-swap.js +236 -0
  161. package/dist/packages/data/src/sources/jupiter.js +198 -0
  162. package/dist/packages/data/src/sources/pda.js +113 -0
  163. package/dist/packages/data/src/sources/pump-curve.js +58 -0
  164. package/dist/packages/data/src/sources/pumpportal.js +247 -0
  165. package/dist/packages/data/src/sources/rugcheck.js +71 -0
  166. package/dist/packages/data/src/sources/solana-rpc.js +299 -0
  167. package/dist/packages/data/src/sources/solana-ws.js +287 -0
  168. package/dist/packages/data/src/store.js +289 -0
  169. package/dist/packages/data/src/trade/bridge.js +464 -0
  170. package/dist/packages/data/src/trade/caps.js +323 -0
  171. package/dist/packages/data/src/trade/copy/auto.js +385 -0
  172. package/dist/packages/data/src/trade/copy/follows.js +103 -0
  173. package/dist/packages/data/src/trade/copy/index.js +9 -0
  174. package/dist/packages/data/src/trade/copy/mirror.js +91 -0
  175. package/dist/packages/data/src/trade/copy/stats.js +120 -0
  176. package/dist/packages/data/src/trade/copy/tracker.js +158 -0
  177. package/dist/packages/data/src/trade/copy/trades.js +87 -0
  178. package/dist/packages/data/src/trade/copy/types.js +6 -0
  179. package/dist/packages/data/src/trade/executor.js +933 -0
  180. package/dist/packages/data/src/trade/kill-switch.js +47 -0
  181. package/dist/packages/data/src/trade/link-store.js +52 -0
  182. package/dist/packages/data/src/trade/plans/confirm.js +157 -0
  183. package/dist/packages/data/src/trade/plans/engine.js +784 -0
  184. package/dist/packages/data/src/trade/plans/executor-live.js +220 -0
  185. package/dist/packages/data/src/trade/plans/executor-paper.js +44 -0
  186. package/dist/packages/data/src/trade/plans/executor.js +11 -0
  187. package/dist/packages/data/src/trade/plans/index.js +12 -0
  188. package/dist/packages/data/src/trade/plans/journal.js +77 -0
  189. package/dist/packages/data/src/trade/plans/mandate.js +129 -0
  190. package/dist/packages/data/src/trade/plans/plan.js +179 -0
  191. package/dist/packages/data/src/trade/plans/service.js +168 -0
  192. package/dist/packages/data/src/trade/plans/types.js +6 -0
  193. package/dist/packages/data/src/trade/rpc-exec.js +229 -0
  194. package/dist/packages/data/src/trade/signer/client.js +197 -0
  195. package/dist/packages/data/src/trade/signer/fast-wallet.js +154 -0
  196. package/dist/packages/data/src/trade/signer/host.js +97 -0
  197. package/dist/packages/data/src/trade/signer/main.js +121 -0
  198. package/dist/packages/data/src/trade/signer/probe-builder.js +85 -0
  199. package/dist/packages/data/src/trade/signer/protocol.js +92 -0
  200. package/dist/packages/data/src/trade/signer/service.js +400 -0
  201. package/dist/packages/data/src/trade/signer/sol-usd-feed.js +98 -0
  202. package/dist/packages/data/src/trade/sol-usd.js +86 -0
  203. package/dist/packages/data/src/trade/swap-build.js +108 -0
  204. package/dist/packages/data/src/trade/token-delta.js +201 -0
  205. package/dist/packages/data/src/trade/tx-decode.js +632 -0
  206. package/dist/packages/data/src/util.js +24 -0
  207. package/dist/packages/data/src/watchlist.js +176 -0
  208. package/dist/packages/data/src/x/api.js +256 -0
  209. package/dist/packages/data/src/x/budget.js +66 -0
  210. package/dist/packages/data/src/x/config.js +49 -0
  211. package/dist/packages/data/src/x/index.js +10 -0
  212. package/dist/packages/data/src/x/mock-server.js +217 -0
  213. package/dist/packages/data/src/x/oauth.js +242 -0
  214. package/dist/packages/data/src/x/pkce.js +21 -0
  215. package/dist/packages/data/src/x/source.js +285 -0
  216. package/dist/packages/data/src/x/token-store.js +134 -0
  217. package/dist/packages/data/src/x/transport.js +71 -0
  218. package/dist/packages/data/vendor/solana-web3/LICENSE +20 -0
  219. package/dist/packages/data/vendor/solana-web3/NOTICE.md +13 -0
  220. package/dist/packages/data/vendor/solana-web3/index.iife.min.js +20 -0
  221. package/dist/packages/mcp/assets/cases.json +1194 -0
  222. package/dist/packages/mcp/assets/kb/entries/cabal-and-coordinated-launches.md +28 -0
  223. package/dist/packages/mcp/assets/kb/entries/common-rug-patterns.md +40 -0
  224. package/dist/packages/mcp/assets/kb/entries/dbc-mechanics.md +30 -0
  225. package/dist/packages/mcp/assets/kb/entries/dev-wallet-behaviour.md +33 -0
  226. package/dist/packages/mcp/assets/kb/entries/glossary.md +35 -0
  227. package/dist/packages/mcp/assets/kb/entries/holder-concentration.md +30 -0
  228. package/dist/packages/mcp/assets/kb/entries/jito-bundles.md +29 -0
  229. package/dist/packages/mcp/assets/kb/entries/launchlab-curve.md +31 -0
  230. package/dist/packages/mcp/assets/kb/entries/lp-burn-vs-lock.md +31 -0
  231. package/dist/packages/mcp/assets/kb/entries/metadata-and-copycats.md +29 -0
  232. package/dist/packages/mcp/assets/kb/entries/mint-freeze-authority.md +31 -0
  233. package/dist/packages/mcp/assets/kb/entries/narrative-lifecycle.md +32 -0
  234. package/dist/packages/mcp/assets/kb/entries/pump-bonding-curve.md +33 -0
  235. package/dist/packages/mcp/assets/kb/entries/pumpswap-migration.md +29 -0
  236. package/dist/packages/mcp/assets/kb/entries/sniping-and-snipers.md +29 -0
  237. package/dist/packages/mcp/assets/kb/entries/token2022-extensions-risk.md +32 -0
  238. package/dist/packages/mcp/assets/kb/entries/wash-trading-fake-volume.md +33 -0
  239. package/dist/packages/mcp/assets/skills/rug-check.md +52 -0
  240. package/dist/packages/mcp/assets/skills/token-dossier.md +57 -0
  241. package/dist/packages/mcp/assets/skills/trench-scan.md +40 -0
  242. package/dist/packages/mcp/bin/dexterm-mcp.mjs +16 -0
  243. package/dist/packages/mcp/src/dossier.js +78 -0
  244. package/dist/packages/mcp/src/firewall.js +21 -0
  245. package/dist/packages/mcp/src/index.js +22 -0
  246. package/dist/packages/mcp/src/server.js +849 -0
  247. package/dist/packages/mcp/src/user-content.js +434 -0
  248. package/dist/packages/packs/src/backtest.js +183 -0
  249. package/dist/packages/packs/src/digest.js +95 -0
  250. package/dist/packages/packs/src/firewall.js +57 -0
  251. package/dist/packages/packs/src/index.js +19 -0
  252. package/dist/packages/packs/src/larp-eval.js +100 -0
  253. package/dist/packages/packs/src/narrative.js +309 -0
  254. package/dist/packages/packs/src/reason.js +135 -0
  255. package/dist/packages/packs/src/rug-model.js +137 -0
  256. package/dist/packages/packs/src/schema.js +54 -0
  257. package/dist/packages/packs/src/token-dossier.js +174 -0
  258. package/dist/packages/packs/src/verdicts.js +17 -0
  259. package/dist/packages/packs/src/wallet-dossier.js +105 -0
  260. package/dist/packages/popup/src/config.js +71 -0
  261. package/dist/packages/popup/src/dock.js +271 -0
  262. package/dist/packages/popup/src/host.js +210 -0
  263. package/dist/packages/popup/src/index.js +12 -0
  264. package/dist/packages/popup/src/loopback.js +53 -0
  265. package/dist/packages/popup/src/open.js +183 -0
  266. package/dist/packages/popup/src/pages/bubbles-lib.js +160 -0
  267. package/dist/packages/popup/src/pages/bubbles.css +23 -0
  268. package/dist/packages/popup/src/pages/bubbles.html +36 -0
  269. package/dist/packages/popup/src/pages/bubbles.js +214 -0
  270. package/dist/packages/popup/src/pages/chart-lib.js +262 -0
  271. package/dist/packages/popup/src/pages/chart.css +50 -0
  272. package/dist/packages/popup/src/pages/chart.html +56 -0
  273. package/dist/packages/popup/src/pages/chart.js +554 -0
  274. package/dist/packages/popup/src/pages/common.css +34 -0
  275. package/dist/packages/popup/src/pages/common.js +187 -0
  276. package/dist/packages/popup/src/pages/feeds.html +20 -0
  277. package/dist/packages/popup/src/pages/feeds.js +77 -0
  278. package/dist/packages/popup/src/pages/narrative.html +20 -0
  279. package/dist/packages/popup/src/pages/narrative.js +61 -0
  280. package/dist/packages/popup/src/pages/plans.css +30 -0
  281. package/dist/packages/popup/src/pages/plans.html +26 -0
  282. package/dist/packages/popup/src/pages/plans.js +82 -0
  283. package/dist/packages/popup/src/pages/roster.css +41 -0
  284. package/dist/packages/popup/src/pages/roster.html +25 -0
  285. package/dist/packages/popup/src/pages/roster.js +75 -0
  286. package/dist/packages/popup/src/pages/token.html +20 -0
  287. package/dist/packages/popup/src/pages/token.js +112 -0
  288. package/dist/packages/popup/src/pages/widget-sdk.js +224 -0
  289. package/dist/packages/popup/src/pages/widget.css +5 -0
  290. package/dist/packages/popup/src/pages/widget.html +21 -0
  291. package/dist/packages/popup/src/pages/widget.js +85 -0
  292. package/dist/packages/popup/src/protocol.js +31 -0
  293. package/dist/packages/popup/src/selftest.js +156 -0
  294. package/dist/packages/popup/src/server.js +582 -0
  295. package/dist/packages/popup/src/sinkproxy.js +167 -0
  296. package/dist/packages/popup/src/widget-html.js +231 -0
  297. package/dist/packages/popup/vendor/lightweight-charts/LICENSE +201 -0
  298. package/dist/packages/popup/vendor/lightweight-charts/NOTICE +2 -0
  299. package/dist/packages/popup/vendor/lightweight-charts/README.md +30 -0
  300. package/dist/packages/popup/vendor/lightweight-charts/VERSION +1 -0
  301. package/dist/packages/popup/vendor/lightweight-charts/lightweight-charts.standalone.production.js +7 -0
  302. package/dist/packages/recorder/bin/dexterm-recorder.mjs +11 -0
  303. package/dist/packages/recorder/src/cli.js +113 -0
  304. package/dist/packages/recorder/src/export.js +71 -0
  305. package/dist/packages/recorder/src/index.js +20 -0
  306. package/dist/packages/recorder/src/labels.js +151 -0
  307. package/dist/packages/recorder/src/open.js +29 -0
  308. package/dist/packages/recorder/src/recorder.js +553 -0
  309. package/dist/packages/recorder/src/schedule.js +43 -0
  310. package/dist/packages/recorder/src/schema.js +135 -0
  311. package/dist/packages/recorder/src/snapshot.js +191 -0
  312. package/dist/packages/recorder/src/sweep.js +52 -0
  313. package/dist/packages/recorder/src/verdicts.js +52 -0
  314. package/dist/packages/tui/src/bubbles.js +415 -0
  315. package/dist/packages/tui/src/canvas.js +370 -0
  316. package/dist/packages/tui/src/chrome.js +85 -0
  317. package/dist/packages/tui/src/color.js +133 -0
  318. package/dist/packages/tui/src/flush.js +62 -0
  319. package/dist/packages/tui/src/fmt.js +188 -0
  320. package/dist/packages/tui/src/fx-trade.js +278 -0
  321. package/dist/packages/tui/src/fx.js +527 -0
  322. package/dist/packages/tui/src/images/blocks.js +141 -0
  323. package/dist/packages/tui/src/images/coin.js +22 -0
  324. package/dist/packages/tui/src/images/detect.js +140 -0
  325. package/dist/packages/tui/src/images/index.js +7 -0
  326. package/dist/packages/tui/src/images/layer.js +146 -0
  327. package/dist/packages/tui/src/images/pixels.js +157 -0
  328. package/dist/packages/tui/src/images/protocols.js +87 -0
  329. package/dist/packages/tui/src/index.js +15 -0
  330. package/dist/packages/tui/src/keymap.js +355 -0
  331. package/dist/packages/tui/src/layout.js +11 -0
  332. package/dist/packages/tui/src/sound.js +177 -0
  333. package/dist/packages/tui/src/theme.js +182 -0
  334. package/dist/packages/tui/src/widgets.js +598 -0
  335. package/dist/packages/voice/src/controller.js +395 -0
  336. package/dist/packages/voice/src/doctor.js +63 -0
  337. package/dist/packages/voice/src/engines.js +44 -0
  338. package/dist/packages/voice/src/index.js +16 -0
  339. package/dist/packages/voice/src/router.js +502 -0
  340. package/dist/packages/voice/src/stt/apple-helper.swift.js +103 -0
  341. package/dist/packages/voice/src/stt/apple.js +179 -0
  342. package/dist/packages/voice/src/stt/fake.js +34 -0
  343. package/dist/packages/voice/src/stt/whisper.js +102 -0
  344. package/dist/packages/voice/src/summary.js +44 -0
  345. package/dist/packages/voice/src/tts/fake.js +30 -0
  346. package/dist/packages/voice/src/tts/say.js +96 -0
  347. package/dist/packages/voice/src/types.js +3 -0
  348. package/package.json +42 -4
  349. package/README.md +0 -3
@@ -0,0 +1,167 @@
1
+ // dexterm popup host — the loopback SINK PROXY (task-1358 r4). The native shell's WebViews send EVERY connection they
2
+ // make through this proxy (wry `with_proxy_config`; on macOS that is WKWebsiteDataStore.proxyConfigurations, 14+), and
3
+ // it tunnels to exactly one place: the popup server's own origin, http://127.0.0.1:<targetPort>. Anything else — any
4
+ // other host, any other port — is answered 403 and dropped, and the attempt is reported.
5
+ //
6
+ // Why: the r3 verifier showed that WebKit opens a TCP connection for a RUNTIME `<link rel=preconnect>` to a page-chosen
7
+ // host:port. No CSP directive covers preconnect (nothing is fetched), Trusted Types do not see it, and the text audit
8
+ // cannot (the element is built at run time). A proxy is below all of that: the WebView never resolves a name or opens
9
+ // a socket itself; the connection reaches this process, which refuses it. The hostname is the only thing that ever
10
+ // leaves the page, and it goes no further than the log line below.
11
+ //
12
+ // What the proxy understands is exactly what a WebView needs to reach our server, and nothing more:
13
+ // * `CONNECT 127.0.0.1:<targetPort>` → a raw tunnel (how CFNetwork carries ws:// and wss://, and any https — there
14
+ // is none here);
15
+ // * absolute-form requests `GET http://127.0.0.1:<targetPort>/path` → rewritten to origin-form and forwarded, one
16
+ // request head at a time (our server takes GET without a body: a request with a body is refused); an `Upgrade`
17
+ // request switches the connection to a raw tunnel after its head;
18
+ // * everything else (another host or port, a body, an origin-form request, junk) → 403, closed, counted, reported.
19
+ // Zero dependencies beyond node:net.
20
+ import net from 'node:net';
21
+ const LOOPBACK = new Set(['127.0.0.1', '::ffff:127.0.0.1', '::1']);
22
+ const MAX_HEAD = 8192;
23
+ const HEAD_TIMEOUT_MS = 5000;
24
+ const sanitize = (s, n = 80) => s.replace(/[^\x21-\x7e]/g, '?').slice(0, n);
25
+ /** Start the sink proxy on a random loopback port. */
26
+ export async function createSinkProxy(opts) {
27
+ const target = opts.targetPort;
28
+ const authority = `127.0.0.1:${target}`;
29
+ const authorityRe = new RegExp(`^http://127\\.0\\.0\\.1:${target}(/|$)`, 'i');
30
+ let refused = 0, forwarded = 0, accepted = 0;
31
+ const sockets = new Set();
32
+ const refuse = (sock, method, targetStr) => {
33
+ refused++;
34
+ try {
35
+ opts.onRefused?.({ method: sanitize(method, 16), target: sanitize(targetStr), remote: `${sock.remoteAddress}:${sock.remotePort}` });
36
+ }
37
+ catch { /* reporter failed; still refuse */ }
38
+ try {
39
+ sock.end('HTTP/1.1 403 Forbidden\r\nconnection: close\r\ncontent-length: 0\r\n\r\n');
40
+ }
41
+ catch { /* gone */ }
42
+ sock.destroy();
43
+ };
44
+ const tunnel = (client, firstBytes, reply) => {
45
+ const up = net.connect(target, '127.0.0.1');
46
+ sockets.add(up);
47
+ up.on('connect', () => {
48
+ forwarded++;
49
+ if (reply)
50
+ client.write('HTTP/1.1 200 Connection Established\r\n\r\n');
51
+ if (firstBytes.length)
52
+ up.write(firstBytes);
53
+ client.pipe(up);
54
+ up.pipe(client);
55
+ });
56
+ const drop = () => { client.destroy(); up.destroy(); sockets.delete(up); };
57
+ up.on('error', drop);
58
+ up.on('close', drop);
59
+ client.on('close', () => { up.destroy(); sockets.delete(up); });
60
+ };
61
+ const server = net.createServer((client) => {
62
+ accepted++;
63
+ sockets.add(client);
64
+ client.on('close', () => sockets.delete(client));
65
+ client.on('error', () => client.destroy());
66
+ if (!LOOPBACK.has(client.remoteAddress ?? '')) {
67
+ client.destroy();
68
+ return;
69
+ }
70
+ let buf = Buffer.alloc(0);
71
+ let mode = 'head';
72
+ let upstream = null; // absolute-form mode: one upstream per client connection
73
+ const timer = setTimeout(() => { if (mode === 'head')
74
+ client.destroy(); }, HEAD_TIMEOUT_MS);
75
+ client.on('data', (d) => {
76
+ if (mode === 'done')
77
+ return; // piped
78
+ buf = Buffer.concat([buf, d]);
79
+ for (;;) {
80
+ const end = buf.indexOf('\r\n\r\n');
81
+ if (end < 0) {
82
+ if (buf.length > MAX_HEAD) {
83
+ clearTimeout(timer);
84
+ refuse(client, '?', 'head too large');
85
+ }
86
+ return;
87
+ }
88
+ const head = buf.subarray(0, end).toString('latin1');
89
+ const rest = buf.subarray(end + 4);
90
+ const lines = head.split('\r\n');
91
+ const m = /^([A-Z]+) (\S+) HTTP\/1\.[01]$/.exec(lines[0] ?? '');
92
+ if (!m) {
93
+ clearTimeout(timer);
94
+ refuse(client, '?', lines[0] ?? '');
95
+ return;
96
+ }
97
+ const [, method, targetStr] = m;
98
+ const headers = new Map();
99
+ for (const l of lines.slice(1)) {
100
+ const i = l.indexOf(':');
101
+ if (i > 0)
102
+ headers.set(l.slice(0, i).trim().toLowerCase(), l.slice(i + 1).trim());
103
+ }
104
+ if (method === 'CONNECT') {
105
+ clearTimeout(timer);
106
+ if (targetStr.toLowerCase() !== authority) {
107
+ refuse(client, method, targetStr);
108
+ return;
109
+ }
110
+ mode = 'done';
111
+ client.removeAllListeners('data');
112
+ tunnel(client, rest, true);
113
+ return;
114
+ }
115
+ if (!authorityRe.test(targetStr)) {
116
+ clearTimeout(timer);
117
+ refuse(client, method, targetStr);
118
+ return;
119
+ }
120
+ if ((headers.get('content-length') ?? '0') !== '0' || headers.has('transfer-encoding')) {
121
+ clearTimeout(timer);
122
+ refuse(client, method, `${targetStr} (body)`);
123
+ return;
124
+ }
125
+ // rewrite to origin-form; drop the proxy-only header
126
+ const path = targetStr.slice(targetStr.indexOf('/', 'http://'.length));
127
+ const outLines = [`${method} ${path || '/'} HTTP/1.1`, ...lines.slice(1).filter((l) => !/^proxy-connection\s*:/i.test(l))];
128
+ const outHead = Buffer.from(outLines.join('\r\n') + '\r\n\r\n', 'latin1');
129
+ buf = Buffer.from(rest);
130
+ if (!upstream) {
131
+ upstream = net.connect(target, '127.0.0.1');
132
+ sockets.add(upstream);
133
+ const u = upstream;
134
+ u.on('connect', () => { forwarded++; });
135
+ u.pipe(client);
136
+ const drop = () => { client.destroy(); u.destroy(); sockets.delete(u); };
137
+ u.on('error', drop);
138
+ u.on('close', drop);
139
+ client.on('close', () => { u.destroy(); sockets.delete(u); });
140
+ }
141
+ upstream.write(outHead);
142
+ if (/upgrade/i.test(headers.get('connection') ?? '') || headers.has('upgrade')) {
143
+ // the WebSocket: from here on the bytes are frames, both ways — hand the connection over
144
+ clearTimeout(timer);
145
+ mode = 'done';
146
+ if (buf.length)
147
+ upstream.write(buf);
148
+ client.removeAllListeners('data');
149
+ client.pipe(upstream);
150
+ return;
151
+ }
152
+ // next request on the same connection (keep-alive)
153
+ }
154
+ });
155
+ });
156
+ await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
157
+ const port = server.address().port;
158
+ return {
159
+ port,
160
+ address: `127.0.0.1:${port}`,
161
+ get refused() { return refused; },
162
+ get forwarded() { return forwarded; },
163
+ get accepted() { return accepted; },
164
+ close() { for (const s of sockets)
165
+ s.destroy(); sockets.clear(); return new Promise((r) => server.close(() => r())); },
166
+ };
167
+ }
@@ -0,0 +1,231 @@
1
+ // dexterm popup — PACK WIDGET HTML (task-1358 r2). The two pure functions the host applies to a pack's widget page:
2
+ //
3
+ // auditWidgetHtml(html) the LOADERS a page may not contain, refused by name (at install in @dexterm/custom, at open in
4
+ // the cli, at ticket issue here): the `__NONCE__` token, a <script> with src/href, any <link>,
5
+ // frames / embeds / <base>, <meta http-equiv>, `@import`, more than WIDGET_INLINE_MAX blocks.
6
+ // inlineHashes(html) the sha256 CSP sources of every inline <script> and <style> block, exactly as the browser
7
+ // hashes them (the element's text, CR LF → LF, UTF-8).
8
+ //
9
+ // Why hashes and never a nonce (the r2 defect): a nonce is one secret per page, and CSP checks only that a tag carries it,
10
+ // not where the tag loads from — a pack page that borrowed it (`nonce="__NONCE__"` on a remote <script src>) ran code the
11
+ // user never reviewed. A hash allow-lists one exact inline text; it cannot be borrowed, there is nothing to steal from the
12
+ // DOM (`script.nonce` is readable by same-document scripts), and an external script can never match it. The pack html is
13
+ // served byte-verbatim: nothing is ever substituted into it.
14
+ //
15
+ // MIRRORED in @dexterm/custom/src/widget-html.ts (the two zero-dependency packages do not import each other, like
16
+ // WIDGET_TOPICS); packages/cli/test/widget-1358.test.ts asserts the two files agree. Edit both.
17
+ import { createHash } from 'node:crypto';
18
+ /** Most inline <script> + <style> blocks one widget page may carry (the CSP header lists one hash per block). */
19
+ export const WIDGET_INLINE_MAX = 64;
20
+ /** CR LF and lone CR become LF, as the HTML parser's input-stream preprocessor does before it hashes an element's text. */
21
+ export function normalizeWidgetHtml(html) { return html.replace(/\r\n?/g, '\n'); }
22
+ /** The CSP hash-source for one inline block's exact text. */
23
+ export function cspHash(text) { return `'sha256-${createHash('sha256').update(text, 'utf8').digest('base64')}'`; }
24
+ /** Elements whose whole purpose is loading another document or resource: a widget page has no use for them. */
25
+ const LOADER_TAGS = new Set(['link', 'iframe', 'frame', 'frameset', 'embed', 'object', 'applet', 'base', 'portal', 'fencedframe']);
26
+ const SCRIPT_SRC_ATTRS = new Set(['src', 'href', 'xlink:href']);
27
+ /**
28
+ * Read one start tag at `i` (which points at `<`): tag name + attributes, honouring quoted values (a `>` inside quotes
29
+ * does not end the tag). Returns null when `<` does not open a tag. Mirrors the tokenizer closely enough for the audit:
30
+ * any disagreement makes the browser see an element we did not hash, which the CSP then refuses — never the reverse.
31
+ */
32
+ function readTag(html, i) {
33
+ const m = /^<([a-zA-Z][a-zA-Z0-9:-]*)/.exec(html.slice(i, i + 64));
34
+ if (!m)
35
+ return null;
36
+ const name = m[1].toLowerCase();
37
+ let p = i + m[0].length;
38
+ const attrs = new Map();
39
+ let selfClosing = false;
40
+ for (;;) {
41
+ while (p < html.length && /\s/.test(html[p]))
42
+ p++;
43
+ if (p >= html.length)
44
+ return null;
45
+ if (html[p] === '>') {
46
+ p++;
47
+ break;
48
+ }
49
+ if (html[p] === '/') {
50
+ selfClosing = true;
51
+ p++;
52
+ continue;
53
+ }
54
+ const a = /^([^\s"'>\/=]+)/.exec(html.slice(p, p + 256));
55
+ if (!a) {
56
+ p++;
57
+ continue;
58
+ } // a stray quote or `=`: the tokenizer skips it too
59
+ const key = a[1].toLowerCase();
60
+ p += a[0].length;
61
+ while (p < html.length && /\s/.test(html[p]))
62
+ p++;
63
+ let value = '';
64
+ if (html[p] === '=') {
65
+ p++;
66
+ while (p < html.length && /\s/.test(html[p]))
67
+ p++;
68
+ const q = html[p];
69
+ if (q === '"' || q === "'") {
70
+ const j = html.indexOf(q, p + 1);
71
+ if (j < 0)
72
+ return null;
73
+ value = html.slice(p + 1, j);
74
+ p = j + 1;
75
+ }
76
+ else {
77
+ const v = /^[^\s>]*/.exec(html.slice(p));
78
+ value = v[0];
79
+ p += v[0].length;
80
+ }
81
+ }
82
+ if (!attrs.has(key))
83
+ attrs.set(key, value);
84
+ }
85
+ return { name, attrs, end: p, selfClosing };
86
+ }
87
+ /** Index of the `</name` that closes a raw-text element (script/style), case-insensitive, or -1. */
88
+ function rawTextEnd(html, name, from) {
89
+ const re = new RegExp(`</${name}[\\s/>]`, 'ig');
90
+ re.lastIndex = from;
91
+ const m = re.exec(html);
92
+ return m ? m.index : -1;
93
+ }
94
+ /**
95
+ * The document without its HTML comments — what the parsers actually see. Only top-level `<!-- -->` is a comment: inside
96
+ * <script>/<style> the same characters are raw text (the CSS parser would still honour an `@import` written there).
97
+ */
98
+ function withoutComments(html) {
99
+ let out = '', i = 0;
100
+ while (i < html.length) {
101
+ const lt = html.indexOf('<', i);
102
+ if (lt < 0) {
103
+ out += html.slice(i);
104
+ break;
105
+ }
106
+ out += html.slice(i, lt);
107
+ if (html.startsWith('<!--', lt)) {
108
+ const e = html.indexOf('-->', lt + 4);
109
+ i = e < 0 ? html.length : e + 3;
110
+ continue;
111
+ }
112
+ const tag = readTag(html, lt);
113
+ if (!tag) {
114
+ out += '<';
115
+ i = lt + 1;
116
+ continue;
117
+ }
118
+ if ((tag.name === 'script' || tag.name === 'style') && !tag.selfClosing) {
119
+ const e = rawTextEnd(html, tag.name, tag.end);
120
+ const end = e < 0 ? html.length : e;
121
+ out += html.slice(lt, end);
122
+ i = end;
123
+ continue;
124
+ }
125
+ out += html.slice(lt, tag.end);
126
+ i = tag.end;
127
+ }
128
+ return out;
129
+ }
130
+ /** Every start tag in the document, with the raw text of script/style elements (comments are skipped). */
131
+ function* walk(html) {
132
+ let i = 0;
133
+ while (i < html.length) {
134
+ const lt = html.indexOf('<', i);
135
+ if (lt < 0)
136
+ return;
137
+ if (html.startsWith('<!--', lt)) {
138
+ const e = html.indexOf('-->', lt + 4);
139
+ i = e < 0 ? html.length : e + 3;
140
+ continue;
141
+ }
142
+ const tag = readTag(html, lt);
143
+ if (!tag) {
144
+ i = lt + 1;
145
+ continue;
146
+ }
147
+ if ((tag.name === 'script' || tag.name === 'style') && !tag.selfClosing) {
148
+ const e = rawTextEnd(html, tag.name, tag.end);
149
+ const raw = html.slice(tag.end, e < 0 ? html.length : e);
150
+ yield { tag, raw };
151
+ i = e < 0 ? html.length : e + 1;
152
+ }
153
+ else {
154
+ yield { tag };
155
+ i = tag.end;
156
+ }
157
+ }
158
+ }
159
+ /**
160
+ * The reasons a widget page is refused (empty = acceptable). Pure over the text; the CSP header is still the enforcement
161
+ * for everything this does not model (inline handlers, remote images, forms, runtime injection) — this names the things
162
+ * whose only purpose is loading code or documents from elsewhere, so a pack that tries is refused before it lands.
163
+ */
164
+ export function auditWidgetHtml(html) {
165
+ const out = [];
166
+ const text = withoutComments(html); // an author may write about these in a comment; a parser never sees one
167
+ if (text.includes('__NONCE__'))
168
+ out.push('"__NONCE__" is not substituted into a pack page (write plain <script>/<style>: each block is allow-listed by its hash)');
169
+ let blocks = 0;
170
+ const seen = new Set();
171
+ const push = (s) => { if (!seen.has(s)) {
172
+ seen.add(s);
173
+ out.push(s);
174
+ } };
175
+ // r4: `@import` is a CSS construct — it is refused where CSS is parsed (a <style> block, a style="" attribute), not in
176
+ // a script string or prose (the verifier's probe pages tripped on the literal in JS text). A runtime-built <style> has
177
+ // no hash and an @import inserted through CSSOM is a stylesheet fetch with no style-src source: the header holds there.
178
+ const css = (s, where) => {
179
+ if (/@import\b/i.test(s))
180
+ push(`@import in ${where} (a stylesheet from elsewhere) is refused`);
181
+ if (/@\\/.test(s))
182
+ push(`an escaped CSS at-rule name (@\\…) in ${where} is refused`);
183
+ };
184
+ for (const { tag, raw } of walk(html)) {
185
+ if (tag.name === 'script') {
186
+ for (const a of SCRIPT_SRC_ATTRS)
187
+ if (tag.attrs.has(a))
188
+ push(`<script ${a}=…> (a script from elsewhere) is refused: every script is inline`);
189
+ if (raw !== undefined && raw.length)
190
+ blocks++;
191
+ }
192
+ else if (tag.name === 'style') {
193
+ if (raw !== undefined && raw.length) {
194
+ blocks++;
195
+ css(raw, 'a <style> block');
196
+ }
197
+ }
198
+ else if (LOADER_TAGS.has(tag.name))
199
+ push(`<${tag.name}> is refused (it loads another document or resource)`);
200
+ else if (tag.name === 'meta' && tag.attrs.has('http-equiv'))
201
+ push('<meta http-equiv> is refused (headers are the host\'s)');
202
+ if (tag.attrs.has('style'))
203
+ css(tag.attrs.get('style') ?? '', 'a style attribute');
204
+ }
205
+ if (blocks > WIDGET_INLINE_MAX)
206
+ out.push(`${blocks} inline script/style blocks (max ${WIDGET_INLINE_MAX})`);
207
+ return out;
208
+ }
209
+ /**
210
+ * The CSP hash-sources for the page's inline blocks, deduplicated, in document order. Call it on the EXACT text that is
211
+ * served (after normalizeWidgetHtml); a block the browser sees differently simply does not run.
212
+ */
213
+ export function inlineHashes(html) {
214
+ const scripts = [], styles = [];
215
+ for (const { tag, raw } of walk(html)) {
216
+ if (raw === undefined || !raw.length)
217
+ continue;
218
+ // a <script src> ignores its text in the browser (and the audit refused it anyway): nothing to hash
219
+ if (tag.name === 'script' && !tag.attrs.has('src')) {
220
+ const h = cspHash(raw);
221
+ if (!scripts.includes(h))
222
+ scripts.push(h);
223
+ }
224
+ else if (tag.name === 'style') {
225
+ const h = cspHash(raw);
226
+ if (!styles.includes(h))
227
+ styles.push(h);
228
+ }
229
+ }
230
+ return { scripts, styles };
231
+ }
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2023 TradingView, Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,2 @@
1
+ TradingView Lightweight Charts™
2
+ Copyright (с) 2025 TradingView, Inc. https://www.tradingview.com/
@@ -0,0 +1,30 @@
1
+ # Vendored: TradingView Lightweight Charts™ 5.2.1 (Apache-2.0)
2
+
3
+ The chart popup (task-1325) renders with TradingView's open-source charting library, **self-hosted**: the
4
+ file below is served by the popup's own loopback server as one exact same-origin route
5
+ (`/vendor/lightweight-charts.standalone.production.js`). It is never loaded from a CDN, and it makes no
6
+ network requests of its own (the bundle contains no `fetch`/XHR/WebSocket/Worker calls).
7
+
8
+ | file | what |
9
+ |---|---|
10
+ | `lightweight-charts.standalone.production.js` | `dist/` file from the npm tarball, byte-for-byte (sha256 `e21cc5caa0226ef30bd8549c50b9ef926615f2a4ee6b4e486353477a55f598cf`) |
11
+ | `LICENSE` | Apache License 2.0, from the same tarball (identical to the `v5.2.1` git tag) |
12
+ | `NOTICE` | the attribution notice from the `v5.2.1` git tag (the npm tarball does not ship it); kept verbatim |
13
+ | `VERSION` | `5.2.1` |
14
+
15
+ Provenance: `npm view lightweight-charts@5.2.1 dist.tarball` →
16
+ `lightweight-charts-5.2.1.tgz`, sha1 `5a27ead719573607d4d3483ad2728c055ccea8fd` (matches the registry's
17
+ `dist.shasum`), integrity `sha512-IVwoK1RLFiLPubaKIjNbtjWLnpPMqiABSrTay6whmNa8L1+19292VtHJ+BWyPUuLCwF0tcQlhEWd1CLB2a1nsQ==`.
18
+ NOTICE: `https://raw.githubusercontent.com/tradingview/lightweight-charts/v5.2.1/NOTICE`.
19
+
20
+ ## Attribution (required by the license, upstream README §License)
21
+
22
+ The chart page shows **both**: the library's `layout.attributionLogo` (a link to https://www.tradingview.com/
23
+ drawn on the chart) and a footer line carrying the NOTICE text verbatim plus the https://www.tradingview.com/
24
+ link. The logo's own `<style>` element is allowed by an exact CSP `sha256` hash computed from this file at
25
+ server start (no `'unsafe-inline'`). Do not remove either.
26
+
27
+ ## Updating
28
+
29
+ Replace the four files from the new tarball / tag, update the hashes above and `VERSION`. The server test
30
+ (`test/server.test.ts`) pins that the route serves exactly this file and nothing else.