@kabmo-labs/kabmo 0.32.1 → 0.34.0
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.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +805 -637
- package/dist/client/static/js/{CsvGrid-4gx0jevc.js → CsvGrid-vze4m5ag.js} +2 -2
- package/dist/client/static/js/{DocxView-0667nr8h.js → DocxView-jbf21gmh.js} +5 -5
- package/dist/client/static/js/{DrawioView-522v0d0r.js → DrawioView-b52qybx5.js} +2 -2
- package/dist/client/static/js/{ImageView-t8xp60hm.js → ImageView-mdgzj8px.js} +1 -1
- package/dist/client/static/js/LayoutWrapper-3c49dvtt.js +2 -0
- package/dist/client/static/js/Modal-sqp864vd.js +38 -0
- package/dist/client/static/js/{PdfView-3fx172xh.js → PdfView-g06rxqb1.js} +1 -1
- package/dist/client/static/js/{SessionsView-n3agmf5t.js → SessionsView-521adxyr.js} +1 -1
- package/dist/client/static/js/{SheetView-nmrdb1b8.js → SheetView-h8xmsz7q.js} +22 -22
- package/dist/client/static/js/{SvgPreview-0xsc6xam.js → SvgPreview-1j4jvcvz.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-jj31rs62.js → abnfDiagram-O67JEVCF-pasxh4b6.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-fc9kmq1w.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-ay3yr7pf.js → architectureDiagram-NJMV4G6O-ms14g0bm.js} +4 -4
- package/dist/client/static/js/{astro-qgx1r159.js → astro-80bs6hvg.js} +1 -1
- package/dist/client/static/js/bash-b3rwyg5p.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-4x33e16k.js → blockDiagram-BEXU5L5S-ycn78fcq.js} +4 -4
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-dtb81cgz.js → c4Diagram-YGBWAQC7-vn2gpjfm.js} +5 -5
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-vk5a2n9w.js → classDiagram-v2-NBCMYWYE-fyrm1pr5.js} +5 -5
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-6rbjbe19.js → cose-bilkent-JH36ORCC-ea5nwvgq.js} +1 -1
- package/dist/client/static/js/css-6vj0d308.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-a4t8992q.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-vyjksedr.js → cynefinDiagram-VND7K2PF-j6bsjpre.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-7hey38z5.js → dagre-6A5THRUB-4smdkwv8.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-aes06jde.js → diagram-22UHCM2B-9sm4kqwc.js} +19 -19
- package/dist/client/static/js/{diagram-3UASUU5V-3cfkgm3x.js → diagram-3UASUU5V-2h3qxaed.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-z8mfhwpy.js → diagram-ATOU4E4O-1981bc94.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-t4821ctz.js → diagram-CDSNMT55-3vgsxavc.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-23yxbfrx.js → diagram-MLGK6HIB-c9gf2r3f.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-chhtf7v0.js → diagram-MPIPVDR6-gjqeq92d.js} +2 -2
- package/dist/client/static/js/{dockerfile-5b87ghm7.js → dockerfile-8v935dkn.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-9jejcvfr.js → ebnfDiagram-ZINNZB2B-4vbsgh99.js} +1 -1
- package/dist/client/static/js/{elixir-rpa1g4gy.js → elixir-vcbg60wv.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-xhhtkf58.js → elk-276RUBZZ-nca3t891.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-mt2apjjb.js → erDiagram-OPXOYQCR-5kfkev03.js} +6 -6
- package/dist/client/static/js/{erlang-6m6tpt72.js → erlang-qt876zrq.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-18bdrkv5.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-fg0yqx0h.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-8cm7a29w.js → ganttDiagram-FUAMR5RP-mxc73wmq.js} +3 -3
- package/dist/client/static/js/gitGraph-4MIJSDKK-8fa6y40p.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-5s0gbnx2.js → gitGraphDiagram-X574FWY7-7en3ag0e.js} +12 -12
- package/dist/client/static/js/graphql-n43pd5fs.js +1 -0
- package/dist/client/static/js/html-dbrwss36.js +1 -0
- package/dist/client/static/js/{index-ye3sr7db.js → index-0vm41je9.js} +4 -4
- package/dist/client/static/js/{index-5y7c62sm.js → index-1b0t1428.js} +5 -5
- package/dist/client/static/js/{index-9sd0vjmh.js → index-1ksg88qf.js} +2 -2
- package/dist/client/static/js/{index-brj8qwa6.js → index-1y9r4frb.js} +2 -2
- package/dist/client/static/js/index-231241f4.js +12 -0
- package/dist/client/static/js/index-2mx9ej4k.css +1 -0
- package/dist/client/static/js/{index-6q80csr0.js → index-2svnq5gg.js} +1 -1
- package/dist/client/static/js/{index-dt7e1328.js → index-354mqqra.js} +2 -2
- package/dist/client/static/js/{index-532btjmp.js → index-3zc1b0dv.js} +2 -2
- package/dist/client/static/js/{index-h06bcfds.js → index-4g46wbdw.js} +1 -1
- package/dist/client/static/js/{index-p7btwjvj.js → index-4qwzxj81.js} +3 -3
- package/dist/client/static/js/{index-3vhznzgr.js → index-52rqxgya.js} +1 -1
- package/dist/client/static/js/index-6sf2vsp2.js +1 -0
- package/dist/client/static/js/{index-xya34x4v.js → index-76zb4m0n.js} +2 -2
- package/dist/client/static/js/{index-jz9fpznk.js → index-7a64yjrm.js} +6 -6
- package/dist/client/static/js/{index-2xj14800.js → index-7y6rpsrp.js} +2 -2
- package/dist/client/static/js/{index-rg8jpbsw.js → index-8acv5b77.js} +2 -2
- package/dist/client/static/js/{index-ay34b398.js → index-a0fmsv1d.js} +19 -19
- package/dist/client/static/js/{index-2gfc25tq.js → index-ag2rmtas.js} +1 -1
- package/dist/client/static/js/{index-sa9cp6km.js → index-ahv9y42z.js} +2 -2
- package/dist/client/static/js/{index-g33knza2.js → index-b29afsjh.js} +1 -1
- package/dist/client/static/js/{index-629kfbcb.js → index-c3ek61zv.js} +2 -2
- package/dist/client/static/js/{index-360d7j0d.js → index-cd65zqba.js} +1 -1
- package/dist/client/static/js/{index-4s8ttfxj.js → index-cgzrpvzj.js} +211 -211
- package/dist/client/static/js/{index-gbfg0anm.js → index-dbe6afkf.js} +2 -2
- package/dist/client/static/js/{index-z4v1xmh1.js → index-ev3yt353.js} +2 -2
- package/dist/client/static/js/{index-ehcpzk5b.js → index-eyfcm0cy.js} +1 -1
- package/dist/client/static/js/{index-a733k69t.js → index-f7jhhqtk.js} +2 -2
- package/dist/client/static/js/{index-hc2jmzpx.js → index-fta1y9pc.js} +65 -65
- package/dist/client/static/js/{index-vd0e25p0.js → index-fvmfge3p.js} +1 -1
- package/dist/client/static/js/{index-a6k2hqke.js → index-g2dyfze9.js} +1 -1
- package/dist/client/static/js/index-h5bn97p6.js +2 -0
- package/dist/client/static/js/{index-7fdp9c7m.js → index-hf52f59k.js} +2 -2
- package/dist/client/static/js/{index-qkscve6n.js → index-j0r5hj0j.js} +2 -2
- package/dist/client/static/js/{index-ejgd8w3s.js → index-j51d5a5m.js} +28 -28
- package/dist/client/static/js/{index-kpspnztv.js → index-jsyekbx9.js} +2 -2
- package/dist/client/static/js/{index-a0bdavdr.js → index-km2zb6wk.js} +2 -2
- package/dist/client/static/js/{index-59jb53v3.js → index-nccwxv0s.js} +2 -2
- package/dist/client/static/js/{index-dnp07j57.js → index-p0nz38bm.js} +1 -1
- package/dist/client/static/js/{index-c0x6s6f7.js → index-pm6xxwz1.js} +2 -2
- package/dist/client/static/js/{index-5x95n3hx.js → index-ptcrwswj.js} +1 -1
- package/dist/client/static/js/{index-fdbfzshx.js → index-ptcwae2n.js} +2 -2
- package/dist/client/static/js/{index-h7pn9qw6.js → index-qckv9nte.js} +2 -2
- package/dist/client/static/js/{index-wzma5n54.js → index-r014brzs.js} +2 -2
- package/dist/client/static/js/{index-xj9649ac.js → index-ray2czf6.js} +7 -7
- package/dist/client/static/js/{index-qnwqaczk.js → index-rs80cwsv.js} +3 -3
- package/dist/client/static/js/{index-pf5sbesf.js → index-rytaa8ca.js} +2 -2
- package/dist/client/static/js/{index-c93sp4yh.js → index-rzxcj7cg.js} +1 -1
- package/dist/client/static/js/{index-a293pdg7.js → index-s7gkkkyz.js} +2 -2
- package/dist/client/static/js/{index-7n68yx6m.js → index-sd66wv26.js} +2 -2
- package/dist/client/static/js/{index-bbggh3f8.js → index-vhqe0y82.js} +2 -2
- package/dist/client/static/js/{index-dq1kdt03.js → index-vy6termr.js} +1 -1
- package/dist/client/static/js/{index-pf7syd7t.js → index-xx6mqpxm.js} +3 -3
- package/dist/client/static/js/{index-z5s27s26.js → index-ybm2x4vh.js} +1 -1
- package/dist/client/static/js/{index-jppt5mgc.js → index-zvfvqvn9.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-3hk844f7.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-3w1yz32c.js → infoDiagram-VRGFBTTK-sef80132.js} +2 -2
- package/dist/client/static/js/ini-j5dyq6gm.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-ckt471dy.js → ishikawaDiagram-OU5B5YK6-yhvepp1q.js} +6 -6
- package/dist/client/static/js/java-g4dgwbfd.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kfvn4w7e.js → journeyDiagram-ZHPQQLJL-5w77y95w.js} +5 -5
- package/dist/client/static/js/jsx-7t5ecz9s.js +1 -0
- package/dist/client/static/js/{julia-0j0gsjvc.js → julia-d4j6wgvf.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-0q36cm83.js → kanban-definition-PNTS6WVX-02znqtna.js} +6 -6
- package/dist/client/static/js/lua-1g6w30de.js +1 -0
- package/dist/client/static/js/markdown-afx21x8c.js +1 -0
- package/dist/client/static/js/{mermaid.core-b1ssa824.js → mermaid.core-a6e6vck4.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-e2ym5en8.js → mindmap-definition-NLK3R4M7-y4n74q9x.js} +8 -8
- package/dist/client/static/js/one-dark-pro-vwhfpzr8.js +1 -0
- package/dist/client/static/js/one-light-y5t9x6zh.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-4nj2yy10.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-t8bbdyhe.js → pegDiagram-GJSIUBJH-pr7ehgzb.js} +1 -1
- package/dist/client/static/js/{perl-7n7e9ncg.js → perl-srptw5vm.js} +1 -1
- package/dist/client/static/js/{php-32vy69vd.js → php-n89g3fk7.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-k7rde3f9.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-envv4brj.js → pieDiagram-5QR66LMP-39wpsk08.js} +2 -2
- package/dist/client/static/js/properties-thd83wey.js +1 -0
- package/dist/client/static/js/python-264ns4xw.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-72rk137a.js → quadrantDiagram-O4NWA36T-esm913km.js} +4 -4
- package/dist/client/static/js/r-qw82kkv9.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-513dpw4f.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-9bqnst9c.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-7367d5bv.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-b806b1mj.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-5a67rwf8.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-1ej0f5hr.js → railroadDiagram-XR7U4H2S-wy2mgya6.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-rvdaknpd.js → requirementDiagram-PLB6GJNP-6z9xdgbq.js} +4 -4
- package/dist/client/static/js/{ruby-5ty7fys7.js → ruby-r81ytgcm.js} +1 -1
- package/dist/client/static/js/{rust-2geezrcs.js → rust-frn3szvc.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-nxvhtdaw.js → sankeyDiagram-IPEJSGJF-rtmxk3ys.js} +5 -5
- package/dist/client/static/js/{sass-mey5150f.js → sass-9bxped7y.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-n5cn5qrt.js → sequenceDiagram-PO4LG4MO-awzcrafg.js} +18 -18
- package/dist/client/static/js/{sizeCapture-INFHLROL-r074kj7s.js → sizeCapture-INFHLROL-03gy196j.js} +1 -1
- package/dist/client/static/js/sql-0e9mnrda.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-vxghxdb0.js → stateDiagram-v2-GCMORJYK-an8v3q5n.js} +3 -3
- package/dist/client/static/js/{svelte-3ewx0hzx.js → svelte-mwtx07d9.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-qkkv894p.js → swimlanes-2SLR337P-n9yb4wcs.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-nx5nfnf0.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-5tbq4ex2.js → timeline-definition-EJHVYXUP-jceb575g.js} +4 -4
- package/dist/client/static/js/treeView-Q6P3EWNA-kcy40evb.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-fsrvqxf4.js +1 -0
- package/dist/client/static/js/tsx-nm94hed6.js +1 -0
- package/dist/client/static/js/typescript-0s2t05jj.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-6p8hf0b7.js → usecaseDiagram-POWQR4AR-888h3100.js} +39 -39
- package/dist/client/static/js/vennDiagram-UO4OBE2U-wbfz0rzv.js +34 -0
- package/dist/client/static/js/{vue-06rdf4wh.js → vue-c0rtg1wf.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-36dmxww4.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-km2x4er8.js → wardleyDiagram-VNRHLVJA-rn8c5qf9.js} +4 -4
- package/dist/client/static/js/xml-dz51p1m3.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-kr3sgr4m.js → xychartDiagram-PMCCYNJV-8sn1apt6.js} +5 -5
- package/dist/client/static/js/yaml-2cfkd30t.js +1 -0
- package/package.json +4 -1
- package/src/client/components/auth/login-screen/index.tsx +1 -0
- package/src/client/components/common/MarkdownRenderer.tsx +9 -12
- package/src/client/components/common/context-usage-button/McpSection.test.tsx +98 -0
- package/src/client/components/common/context-usage-button/McpSection.tsx +12 -5
- package/src/client/components/common/context-usage-button/SessionStats.tsx +80 -0
- package/src/client/components/common/context-usage-button/index.test.tsx +26 -0
- package/src/client/components/common/context-usage-button/index.tsx +36 -28
- package/src/client/components/common/harness-glyph/brands.ts +8 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +12 -3
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +9 -2
- package/src/client/components/settings/Modal.tsx +14 -84
- package/src/client/components/settings/Sidebar.tsx +3 -1
- package/src/client/components/settings/apply-side-effects.test.ts +11 -0
- package/src/client/components/settings/apply-side-effects.ts +7 -0
- package/src/client/components/settings/categories/ChatSettings.test.tsx +1 -1
- package/src/client/components/settings/categories/ChatSettings.tsx +2 -0
- package/src/client/components/settings/categories/ConnectSettings.tsx +105 -0
- package/src/client/components/settings/categories/NotificationSettings.tsx +1 -1
- package/src/client/components/settings/categories/chat-settings/ChangedFilesSection.tsx +79 -0
- package/src/client/components/settings/categories/chat-settings/groups.ts +4 -3
- package/src/client/components/settings/categories/connect-settings/DeviceTable.tsx +145 -0
- package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +160 -0
- package/src/client/components/settings/categories/connect-settings/QrCode.tsx +73 -0
- package/src/client/components/settings/categories/connect-settings/ServerCard.tsx +94 -0
- package/src/client/components/settings/categories/connect-settings/TunnelRow.tsx +127 -0
- package/src/client/components/settings/category-content.tsx +116 -0
- package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.test.tsx +120 -0
- package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +137 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +33 -1
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +22 -1
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +13 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
- package/src/client/components/workspace/diff-panel/Toolbar.tsx +17 -51
- package/src/client/components/workspace/diff-panel/index.tsx +23 -4
- package/src/client/components/workspace/diff-panel/toolbar-git-actions.tsx +94 -0
- package/src/client/components/workspace/editor/Body.tsx +2 -0
- package/src/client/data/settings/omp-schema.json +73 -3
- package/src/client/hooks/chat/timeline/change-stats.ts +57 -0
- package/src/client/hooks/chat/timeline/changed-files-setting.test.ts +31 -0
- package/src/client/hooks/chat/timeline/changed-files-setting.ts +60 -0
- package/src/client/hooks/chat/timeline/session-changes.ts +51 -0
- package/src/client/hooks/connect/use-connect-status.ts +116 -0
- package/src/client/hooks/connect/use-pairing.ts +100 -0
- package/src/client/hooks/ui/clipboard.ts +26 -0
- package/src/client/hooks/ui/notification-events.test.ts +3 -0
- package/src/client/hooks/ui/notification-events.ts +3 -1
- package/src/client/hooks/ui/notification-sound.ts +13 -6
- package/src/client/hooks/ui/ui-sounds.test.ts +15 -0
- package/src/client/hooks/workspace/diff-file.ts +11 -4
- package/src/client/hooks/workspace/file-tabs.ts +13 -4
- package/src/client/hooks/workspace/journal-diff.ts +97 -0
- package/src/client/lib/notifications/native-banner-sound.test.ts +93 -0
- package/src/client/lib/notifications/native-banner-sound.ts +46 -0
- package/src/client/lib/notifications/os.test.ts +14 -5
- package/src/client/lib/notifications/os.ts +8 -0
- package/src/client/tailwind.css +5 -0
- package/src/server/index.ts +2 -0
- package/src/server/lib/assets/font-css.server.test.ts +19 -0
- package/src/server/lib/auth/client-address.test.ts +58 -0
- package/src/server/lib/auth/client-address.ts +37 -3
- package/src/server/lib/auth/guard.ts +31 -4
- package/src/server/lib/auth/rate-limit.test.ts +25 -8
- package/src/server/lib/auth/rate-limit.ts +8 -5
- package/src/server/lib/connect/cloudflared.lifecycle.test.ts +88 -0
- package/src/server/lib/connect/cloudflared.server.test.ts +65 -0
- package/src/server/lib/connect/cloudflared.server.ts +206 -0
- package/src/server/lib/connect/devices.server.ts +192 -0
- package/src/server/lib/connect/identity.server.ts +81 -0
- package/src/server/lib/connect/pairing.server.test.ts +56 -0
- package/src/server/lib/connect/pairing.server.ts +113 -0
- package/src/server/lib/connect/qr.roundtrip.test.ts +106 -0
- package/src/server/lib/connect/qr.server.ts +36 -0
- package/src/server/lib/connect/run.server.ts +101 -0
- package/src/server/lib/connect/status.server.ts +177 -0
- package/src/server/lib/connect/tailscale.server.test.ts +117 -0
- package/src/server/lib/connect/tailscale.server.ts +172 -0
- package/src/server/lib/db/schema.ts +4 -0
- package/src/server/lib/harness/launch-table.ts +10 -0
- package/src/server/lib/omp/session/changes.test.ts +201 -0
- package/src/server/lib/omp/session/changes.ts +313 -0
- package/src/server/lib/omp/session/session-discovery.test.ts +4 -4
- package/src/server/lib/omp/session/sidebar-activity.server.test.ts +6 -2
- package/src/server/lib/omp/session/subagent-presence-scan.ts +54 -0
- package/src/server/lib/omp/session/subagent-presence-store.test.ts +1 -1
- package/src/server/lib/omp/session/subagent-presence.test.ts +115 -0
- package/src/server/lib/omp/session/subagent-presence.ts +12 -3
- package/src/server/lib/omp/session/telemetry/compute.ts +68 -0
- package/src/server/lib/omp/session/telemetry.test.ts +81 -0
- package/src/server/routes/connect/devices.ts +56 -0
- package/src/server/routes/connect/index.ts +15 -0
- package/src/server/routes/connect/pair-page.ts +177 -0
- package/src/server/routes/connect/pair.ts +158 -0
- package/src/server/routes/connect/status.ts +19 -0
- package/src/server/routes/connect/tunnels.ts +76 -0
- package/src/server/routes/health/probe.ts +5 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/sessions/changes.test.ts +99 -0
- package/src/server/routes/sessions/changes.ts +79 -0
- package/src/server/routes/sessions/index.ts +7 -0
- package/src/shared/lib/chat/duration.ts +34 -0
- package/src/shared/lib/chat/timeline/changed-files.test.ts +121 -0
- package/src/shared/lib/chat/timeline/changed-files.ts +71 -0
- package/src/shared/lib/chat/timeline/fork-anchor.test.ts +3 -0
- package/src/shared/lib/connect/payload.test.ts +144 -0
- package/src/shared/lib/connect/payload.ts +229 -0
- package/src/shared/lib/connect/tier.test.ts +73 -0
- package/src/shared/lib/connect/tier.ts +105 -0
- package/src/shared/lib/connect/types.ts +99 -0
- package/src/shared/lib/format/duration.test.ts +31 -0
- package/src/shared/lib/format/duration.ts +27 -0
- package/src/shared/lib/fs/unified-diff.test.ts +53 -0
- package/src/shared/lib/fs/unified-diff.ts +127 -0
- package/src/shared/lib/harness/brand-color.ts +3 -0
- package/src/shared/lib/harness/catalog.test.ts +13 -0
- package/src/shared/lib/harness/catalog.ts +8 -1
- package/src/shared/lib/harness/fork.ts +4 -2
- package/src/shared/lib/harness/mcp-facts.ts +3 -0
- package/src/shared/lib/harness/provider-facts.ts +14 -0
- package/src/shared/lib/harness/updates.ts +5 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +27 -27
- package/src/shared/lib/markdown/fira-code-fonts.css +65 -6
- package/src/shared/lib/markdown/marked.ts +7 -4
- package/src/shared/lib/markdown/mermaid-actions.test.ts +78 -0
- package/src/shared/lib/markdown/mermaid-actions.ts +45 -0
- package/src/shared/lib/markdown/mermaid.ts +41 -7
- package/src/shared/lib/omp/config/schema.test.ts +4 -2
- package/src/shared/lib/settings/defaults.ts +1 -0
- package/src/shared/lib/settings/sections.ts +6 -1
- package/src/shared/lib/workspace/file-tab-id.ts +9 -0
- package/src/shared/types/context.ts +18 -0
- package/src/shared/types/fs.ts +21 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/omp/session.ts +6 -0
- package/src/shared/types/session-changes.ts +64 -0
- package/src/shared/types/settings/state.ts +10 -0
- package/dist/client/static/js/LayoutWrapper-xjnveecv.js +0 -2
- package/dist/client/static/js/Modal-k2jr9hc4.js +0 -38
- package/dist/client/static/js/architecture-7GRP2DOG-1y9zvsyt.js +0 -1
- package/dist/client/static/js/bash-m0qjsyy0.js +0 -1
- package/dist/client/static/js/css-t4ngafan.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-k2188qcq.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-pdr0qn0n.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-zvz0mxne.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-wmqf046s.js +0 -1
- package/dist/client/static/js/graphql-692h0n2x.js +0 -1
- package/dist/client/static/js/html-pv88ny12.js +0 -1
- package/dist/client/static/js/index-61tm0v57.js +0 -1
- package/dist/client/static/js/index-e94a1en0.css +0 -1
- package/dist/client/static/js/index-kg86e3sy.js +0 -12
- package/dist/client/static/js/index-nmmxb4va.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-zg3twte6.js +0 -1
- package/dist/client/static/js/ini-cg0a5wm3.js +0 -1
- package/dist/client/static/js/java-vcck089n.js +0 -1
- package/dist/client/static/js/jsx-ht9zyzwa.js +0 -1
- package/dist/client/static/js/lua-ke895s2q.js +0 -1
- package/dist/client/static/js/markdown-gwmsh53r.js +0 -1
- package/dist/client/static/js/one-dark-pro-4geyzhjj.js +0 -1
- package/dist/client/static/js/one-light-tqssjm9t.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-3pav51g0.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-wqfh7zdk.js +0 -1
- package/dist/client/static/js/properties-mzvvbqg5.js +0 -1
- package/dist/client/static/js/python-3w64wsyd.js +0 -1
- package/dist/client/static/js/r-32re2zwb.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-w7qjdr2g.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-rhr99kkj.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-c4jeea3m.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-x2ee66ex.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-yw8wjfwg.js +0 -1
- package/dist/client/static/js/sql-g8wcshpc.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-y81h9n27.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-ekz05ccs.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-aq6qymjr.js +0 -1
- package/dist/client/static/js/tsx-0p183w2f.js +0 -1
- package/dist/client/static/js/typescript-t9a5jyvv.js +0 -1
- package/dist/client/static/js/vennDiagram-UO4OBE2U-7k5jsxf9.js +0 -34
- package/dist/client/static/js/wardley-WFR3VGLG-z34tj4y3.js +0 -1
- package/dist/client/static/js/xml-81hxjjt4.js +0 -1
- package/dist/client/static/js/yaml-yssayv8a.js +0 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The QR the server draws, decoded back.
|
|
8
|
+
*
|
|
9
|
+
* This is the one claim the pairing feature cannot afford to be wrong about: a
|
|
10
|
+
* code that renders but does not scan is indistinguishable from a broken camera,
|
|
11
|
+
* and the user's next move — rescan, restart the app — is the wrong one. The
|
|
12
|
+
* round trip is checked with the SAME decoder the login screen uses (`jsQR`), so
|
|
13
|
+
* a change to the encoder, the error-correction level or the payload size that
|
|
14
|
+
* pushes the code past what a phone can read fails here instead of in a hand.
|
|
15
|
+
*
|
|
16
|
+
* The matrix is expanded to RGBA by hand rather than through a PNG: the encoder
|
|
17
|
+
* produces modules, and going through an image format would test the image
|
|
18
|
+
* library instead of the code.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { describe, expect, test } from 'bun:test';
|
|
22
|
+
import jsQR from 'jsqr';
|
|
23
|
+
import { qrMatrix } from '@/server/lib/connect/qr.server';
|
|
24
|
+
import { encodePairingFragment, encodePairingPayload } from '@/shared/lib/connect/payload';
|
|
25
|
+
|
|
26
|
+
/** Modules per side of the quiet zone a scanner needs. */
|
|
27
|
+
const QUIET = 4;
|
|
28
|
+
/** Pixels per module. A phone camera needs a few; 4 is what the dialog draws. */
|
|
29
|
+
const SCALE = 4;
|
|
30
|
+
|
|
31
|
+
/** The matrix as RGBA pixels, black on white, with its quiet zone. */
|
|
32
|
+
function pixelsOf(rows: string[], size: number): { data: Uint8ClampedArray; width: number; height: number } {
|
|
33
|
+
const span = (size + QUIET * 2) * SCALE;
|
|
34
|
+
const data = new Uint8ClampedArray(span * span * 4).fill(255);
|
|
35
|
+
for (let row = 0; row < size; row += 1) {
|
|
36
|
+
const line = rows[row] ?? '';
|
|
37
|
+
for (let column = 0; column < size; column += 1) {
|
|
38
|
+
if (line[column] !== '1') continue;
|
|
39
|
+
for (let dy = 0; dy < SCALE; dy += 1) {
|
|
40
|
+
for (let dx = 0; dx < SCALE; dx += 1) {
|
|
41
|
+
const x = (column + QUIET) * SCALE + dx;
|
|
42
|
+
const y = (row + QUIET) * SCALE + dy;
|
|
43
|
+
const index = (y * span + x) * 4;
|
|
44
|
+
data[index] = 0;
|
|
45
|
+
data[index + 1] = 0;
|
|
46
|
+
data[index + 2] = 0;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return { data, width: span, height: span };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function decode(text: string): string | null {
|
|
55
|
+
const matrix = qrMatrix(text);
|
|
56
|
+
const pixels = pixelsOf(matrix.rows, matrix.size);
|
|
57
|
+
return jsQR(pixels.data, pixels.width, pixels.height)?.data ?? null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
describe('the pairing QR decodes', () => {
|
|
61
|
+
test('a browser link with one candidate', () => {
|
|
62
|
+
const fragment = encodePairingFragment({
|
|
63
|
+
v: 1,
|
|
64
|
+
pairingId: 'pair-1',
|
|
65
|
+
secret: 's'.repeat(43),
|
|
66
|
+
serverId: 'server-1',
|
|
67
|
+
label: 'rajeb-macbook',
|
|
68
|
+
expiresAt: new Date(Date.now() + 120_000).toISOString(),
|
|
69
|
+
candidates: [{ kind: 'tailscale', url: 'https://node.tailnet.ts.net' }],
|
|
70
|
+
});
|
|
71
|
+
const link = `https://node.tailnet.ts.net/pair#${fragment}`;
|
|
72
|
+
expect(decode(link)).toBe(link);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('a browser link with four LAN candidates — the widest payload the page mints', () => {
|
|
76
|
+
const fragment = encodePairingFragment({
|
|
77
|
+
v: 1,
|
|
78
|
+
pairingId: 'c823cb3b-3baf-4913-84bc-d23a927a00a3',
|
|
79
|
+
secret: 'nchQ2h-p_F6e91pYoTH67sHVx6wRFZUHGPKlpgP07yQ',
|
|
80
|
+
serverId: 'AIJ2AIfUYpTIIt4uHx0iQvL7dQ5m5VkXZWy3PmhbVHQ',
|
|
81
|
+
label: 'Wijanarkos-Mac-mini',
|
|
82
|
+
expiresAt: new Date(Date.now() + 120_000).toISOString(),
|
|
83
|
+
candidates: [
|
|
84
|
+
{ kind: 'lan', url: 'http://192.168.18.79:3990' },
|
|
85
|
+
{ kind: 'lan', url: 'http://100.98.171.79:3990' },
|
|
86
|
+
{ kind: 'lan', url: 'http://192.168.139.3:3990' },
|
|
87
|
+
{ kind: 'lan', url: 'http://172.16.102.251:3990' },
|
|
88
|
+
],
|
|
89
|
+
});
|
|
90
|
+
const link = `http://192.168.18.79:3990/pair#${fragment}`;
|
|
91
|
+
expect(decode(link)).toBe(link);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('the deep link a native shell registers', () => {
|
|
95
|
+
const link = encodePairingPayload({
|
|
96
|
+
v: 1,
|
|
97
|
+
pairingId: 'pair-2',
|
|
98
|
+
secret: 'x'.repeat(43),
|
|
99
|
+
serverId: 'server-2',
|
|
100
|
+
label: 'desk',
|
|
101
|
+
expiresAt: new Date(Date.now() + 120_000).toISOString(),
|
|
102
|
+
candidates: [{ kind: 'cloudflare', url: 'https://kabmo.example.com' }],
|
|
103
|
+
});
|
|
104
|
+
expect(decode(link)).toBe(link);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The QR matrix, as rows of `0`/`1`.
|
|
8
|
+
*
|
|
9
|
+
* A matrix rather than an SVG string: the client draws `<rect>`s from it, so the
|
|
10
|
+
* pairing dialog never injects server-produced markup into the page. The payload
|
|
11
|
+
* is a deep link carrying a one-time secret, and `dangerouslySetInnerHTML` on a
|
|
12
|
+
* string built from it is exactly the kind of shortcut that turns a QR renderer
|
|
13
|
+
* into an injection point.
|
|
14
|
+
*
|
|
15
|
+
* Error correction is `M` (~15%): the code is shown on a screen and scanned at
|
|
16
|
+
* arm's length, so a little tolerance is worth the extra modules.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import qrcode from 'qrcode-generator';
|
|
20
|
+
import type { QrMatrix } from '@/shared/lib/connect/types';
|
|
21
|
+
|
|
22
|
+
export function qrMatrix(text: string): QrMatrix {
|
|
23
|
+
const qr = qrcode(0, 'M');
|
|
24
|
+
qr.addData(text);
|
|
25
|
+
qr.make();
|
|
26
|
+
const size = qr.getModuleCount();
|
|
27
|
+
const rows: string[] = [];
|
|
28
|
+
for (let row = 0; row < size; row += 1) {
|
|
29
|
+
let line = '';
|
|
30
|
+
for (let column = 0; column < size; column += 1) {
|
|
31
|
+
line += qr.isDark(row, column) ? '1' : '0';
|
|
32
|
+
}
|
|
33
|
+
rows.push(line);
|
|
34
|
+
}
|
|
35
|
+
return { size, rows };
|
|
36
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One argv spawn for the Connect page's provider CLIs.
|
|
8
|
+
*
|
|
9
|
+
* `tailscale` and `cloudflared` are both invoked as argv, never through a shell:
|
|
10
|
+
* the only variable part is a port number this process chose, and a shell would
|
|
11
|
+
* add an expansion surface for no benefit. The timeout is mandatory at every
|
|
12
|
+
* call site because both CLIs can block on a daemon that is not answering —
|
|
13
|
+
* `tailscale status` against a stopped daemon hangs, and a settings page that
|
|
14
|
+
* waits on it looks like a broken server.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export interface RunResult {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
stdout: string;
|
|
20
|
+
stderr: string;
|
|
21
|
+
code: number | null;
|
|
22
|
+
/** Set when the binary could not be spawned at all. */
|
|
23
|
+
error: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface RunOptions {
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
env?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Run `argv` and collect both streams. Never throws. */
|
|
32
|
+
export async function run(argv: string[], options: RunOptions = {}): Promise<RunResult> {
|
|
33
|
+
const timeoutMs = options.timeoutMs ?? 5_000;
|
|
34
|
+
let proc: Bun.Subprocess<'ignore', 'pipe', 'pipe'>;
|
|
35
|
+
try {
|
|
36
|
+
proc = Bun.spawn({
|
|
37
|
+
cmd: argv,
|
|
38
|
+
stdin: 'ignore',
|
|
39
|
+
stdout: 'pipe',
|
|
40
|
+
stderr: 'pipe',
|
|
41
|
+
env: { ...Bun.env, ...options.env },
|
|
42
|
+
});
|
|
43
|
+
} catch (error) {
|
|
44
|
+
return {
|
|
45
|
+
ok: false,
|
|
46
|
+
stdout: '',
|
|
47
|
+
stderr: '',
|
|
48
|
+
code: null,
|
|
49
|
+
error: error instanceof Error ? error.message : String(error),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const timer = setTimeout(() => {
|
|
54
|
+
try {
|
|
55
|
+
proc.kill('SIGKILL');
|
|
56
|
+
} catch {
|
|
57
|
+
// Already gone: the command finished inside its own timeout.
|
|
58
|
+
}
|
|
59
|
+
}, timeoutMs);
|
|
60
|
+
|
|
61
|
+
// The timeout must SETTLE the call, not merely kill the process. A CLI that
|
|
62
|
+
// spawns a helper holding the pipe open leaves `Response(proc.stdout).text()`
|
|
63
|
+
// pending forever, and the settings page then waits on a request that never
|
|
64
|
+
// answers — measured with `tailscale serve --bg`, which hung the route for the
|
|
65
|
+
// full three minutes the smoke test allowed.
|
|
66
|
+
const deadline = Promise.withResolvers<RunResult>();
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
deadline.resolve({
|
|
69
|
+
ok: false,
|
|
70
|
+
stdout: '',
|
|
71
|
+
stderr: '',
|
|
72
|
+
code: null,
|
|
73
|
+
error: `timed out after ${timeoutMs} ms`,
|
|
74
|
+
});
|
|
75
|
+
}, timeoutMs + 250);
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
return await Promise.race([
|
|
79
|
+
(async (): Promise<RunResult> => {
|
|
80
|
+
const [stdout, stderr] = await Promise.all([
|
|
81
|
+
new Response(proc.stdout).text(),
|
|
82
|
+
new Response(proc.stderr).text(),
|
|
83
|
+
]);
|
|
84
|
+
const code = await proc.exited;
|
|
85
|
+
return { ok: code === 0, stdout, stderr, code, error: null };
|
|
86
|
+
})(),
|
|
87
|
+
deadline.promise,
|
|
88
|
+
]);
|
|
89
|
+
} finally {
|
|
90
|
+
clearTimeout(timer);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** The absolute path of a binary on PATH, or null. */
|
|
95
|
+
export function which(binary: string): string | null {
|
|
96
|
+
try {
|
|
97
|
+
return Bun.which(binary) ?? null;
|
|
98
|
+
} catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Everything the Connect page draws, assembled in one read.
|
|
8
|
+
*
|
|
9
|
+
* The page must never show a row it cannot explain. Every address carries either
|
|
10
|
+
* a URL or a sentence saying why it is not usable, and every tunnel carries a
|
|
11
|
+
* phase plus the reason it is not up — because "greyed out with no text" is the
|
|
12
|
+
* failure mode this module exists to prevent.
|
|
13
|
+
*
|
|
14
|
+
* One fact is deliberately NOT here: which route a device is using right now.
|
|
15
|
+
* The server cannot measure a phone's round trip, so that column is reported by
|
|
16
|
+
* the device (`touchDevice`) and is a report, not an inference.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import os from 'os';
|
|
20
|
+
import pkg from '@/../package.json';
|
|
21
|
+
import { connectIdentity } from '@/server/lib/connect/identity.server';
|
|
22
|
+
import { listPairedDevices } from '@/server/lib/connect/devices.server';
|
|
23
|
+
import {
|
|
24
|
+
findTailscale,
|
|
25
|
+
machineLabel,
|
|
26
|
+
serveIsUp,
|
|
27
|
+
tailscaleNode,
|
|
28
|
+
} from '@/server/lib/connect/tailscale.server';
|
|
29
|
+
import {
|
|
30
|
+
cloudflaredAlive,
|
|
31
|
+
findCloudflared,
|
|
32
|
+
runningTunnelUrl,
|
|
33
|
+
} from '@/server/lib/connect/cloudflared.server';
|
|
34
|
+
import type {
|
|
35
|
+
ConnectAddress,
|
|
36
|
+
ConnectStatus,
|
|
37
|
+
TunnelState,
|
|
38
|
+
} from '@/shared/lib/connect/types';
|
|
39
|
+
|
|
40
|
+
/** The port this process listens on. */
|
|
41
|
+
export function currentPort(): number {
|
|
42
|
+
return Number(Bun.env.PORT) || 3000;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Whether the listener is reachable from another machine at all. */
|
|
46
|
+
function boundBeyondLoopback(): boolean {
|
|
47
|
+
const host = (Bun.env.HOST ?? 'localhost').trim();
|
|
48
|
+
return host === '0.0.0.0' || host === '::' || host === '';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Every non-internal IPv4 address, as origins on this port. */
|
|
52
|
+
function lanOrigins(port: number): string[] {
|
|
53
|
+
const origins: string[] = [];
|
|
54
|
+
try {
|
|
55
|
+
for (const entries of Object.values(os.networkInterfaces())) {
|
|
56
|
+
for (const entry of entries ?? []) {
|
|
57
|
+
if (entry.family !== 'IPv4' || entry.internal) continue;
|
|
58
|
+
origins.push(`http://${entry.address}:${port}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
// A host that cannot enumerate interfaces simply has no LAN address.
|
|
63
|
+
}
|
|
64
|
+
return origins;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function tailscaleState(): Promise<{ tunnel: TunnelState; address: ConnectAddress | null }> {
|
|
68
|
+
const presence = findTailscale();
|
|
69
|
+
if (!presence.binary) {
|
|
70
|
+
return {
|
|
71
|
+
tunnel: { provider: 'tailscale', phase: 'failed', url: null, reason: presence.reason },
|
|
72
|
+
address: { kind: 'tailscale', url: '', unavailable: presence.reason },
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const node = await tailscaleNode(presence.binary);
|
|
77
|
+
if (!node) {
|
|
78
|
+
const reason = 'The Tailscale daemon did not answer. Open Tailscale and sign in.';
|
|
79
|
+
return {
|
|
80
|
+
tunnel: { provider: 'tailscale', phase: 'failed', url: null, reason },
|
|
81
|
+
address: { kind: 'tailscale', url: '', unavailable: reason },
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (node.backendState !== 'Running') {
|
|
85
|
+
const reason = `Tailscale is ${node.backendState.toLowerCase()}. Sign in to the tailnet first.`;
|
|
86
|
+
return {
|
|
87
|
+
tunnel: { provider: 'tailscale', phase: 'failed', url: null, reason },
|
|
88
|
+
address: { kind: 'tailscale', url: '', unavailable: reason },
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (!node.url) {
|
|
92
|
+
const reason = 'This node has no MagicDNS name yet, so there is no HTTPS address to share.';
|
|
93
|
+
return {
|
|
94
|
+
tunnel: { provider: 'tailscale', phase: 'failed', url: null, reason },
|
|
95
|
+
address: { kind: 'tailscale', url: '', unavailable: reason },
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const up = await serveIsUp(presence.binary);
|
|
100
|
+
return {
|
|
101
|
+
tunnel: {
|
|
102
|
+
provider: 'tailscale',
|
|
103
|
+
phase: up ? 'up' : 'off',
|
|
104
|
+
url: up ? node.url : null,
|
|
105
|
+
reason: up ? null : 'Serve is off. Turn it on to reach this server from your tailnet.',
|
|
106
|
+
},
|
|
107
|
+
address: {
|
|
108
|
+
kind: 'tailscale',
|
|
109
|
+
url: node.url,
|
|
110
|
+
unavailable: up ? null : 'Serve is off, so this address does not answer yet.',
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function cloudflareState(port: number): { tunnel: TunnelState; address: ConnectAddress | null } {
|
|
116
|
+
const presence = findCloudflared();
|
|
117
|
+
if (presence.reason || !presence.binary || !presence.configPath) {
|
|
118
|
+
const reason = presence.reason ?? 'cloudflared is not configured.';
|
|
119
|
+
return {
|
|
120
|
+
tunnel: { provider: 'cloudflare', phase: 'failed', url: null, reason },
|
|
121
|
+
address: { kind: 'cloudflare', url: '', unavailable: reason },
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const alive = cloudflaredAlive(port);
|
|
126
|
+
const url = runningTunnelUrl(port);
|
|
127
|
+
if (alive && url) {
|
|
128
|
+
return {
|
|
129
|
+
tunnel: { provider: 'cloudflare', phase: 'up', url, reason: null },
|
|
130
|
+
address: { kind: 'cloudflare', url, unavailable: null },
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
tunnel: {
|
|
135
|
+
provider: 'cloudflare',
|
|
136
|
+
phase: 'off',
|
|
137
|
+
url: null,
|
|
138
|
+
reason: 'The tunnel is not running. Cloudflare terminates TLS and can read the traffic.',
|
|
139
|
+
},
|
|
140
|
+
address: {
|
|
141
|
+
kind: 'cloudflare',
|
|
142
|
+
url: '',
|
|
143
|
+
unavailable: 'The tunnel is not running.',
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** The whole page's payload. */
|
|
149
|
+
export async function connectStatus(): Promise<ConnectStatus> {
|
|
150
|
+
const port = currentPort();
|
|
151
|
+
const [tailscale, devices] = await Promise.all([tailscaleState(), listPairedDevices()]);
|
|
152
|
+
const cloudflare = cloudflareState(port);
|
|
153
|
+
|
|
154
|
+
const lanReachable = boundBeyondLoopback();
|
|
155
|
+
const lan: ConnectAddress[] = lanOrigins(port).map((url) => ({
|
|
156
|
+
kind: 'lan',
|
|
157
|
+
url,
|
|
158
|
+
unavailable: lanReachable
|
|
159
|
+
? null
|
|
160
|
+
: 'This server listens on loopback only. Start it with --lan to answer on this address.',
|
|
161
|
+
}));
|
|
162
|
+
|
|
163
|
+
const addresses: ConnectAddress[] = [
|
|
164
|
+
...(tailscale.address ? [tailscale.address] : []),
|
|
165
|
+
...lan,
|
|
166
|
+
...(cloudflare.address ? [cloudflare.address] : []),
|
|
167
|
+
].filter((address) => address.url !== '' || address.unavailable !== null);
|
|
168
|
+
|
|
169
|
+
return {
|
|
170
|
+
serverId: connectIdentity().serverId,
|
|
171
|
+
label: machineLabel(),
|
|
172
|
+
version: pkg.version,
|
|
173
|
+
addresses,
|
|
174
|
+
tunnels: [tailscale.tunnel, cloudflare.tunnel],
|
|
175
|
+
devices,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Tailscale CLI, driven through a stand-in.
|
|
8
|
+
*
|
|
9
|
+
* The real daemon cannot be scripted: `serve` needs HTTPS enabled for the tailnet
|
|
10
|
+
* and a signed-in node, so the happy path is unreachable on a machine that has
|
|
11
|
+
* neither. A fake binary that answers the same JSON is what makes the parsing,
|
|
12
|
+
* the URL derivation and the stop path testable at all — and those are the parts
|
|
13
|
+
* that break silently, because a wrong field name reads as "not running" rather
|
|
14
|
+
* than as an error.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
18
|
+
import fs from 'fs';
|
|
19
|
+
import os from 'os';
|
|
20
|
+
import path from 'path';
|
|
21
|
+
import { serveIsUp, startServe, stopServe, tailscaleNode } from '@/server/lib/connect/tailscale.server';
|
|
22
|
+
|
|
23
|
+
// The stand-in is a `#!/bin/sh` script, so this suite is POSIX-only: Windows
|
|
24
|
+
// cannot execute it, and every case would then fail on the spawn instead of on
|
|
25
|
+
// the parsing it exists to measure. The Linux gate covers the behaviour.
|
|
26
|
+
const posixOnly = process.platform !== 'win32';
|
|
27
|
+
|
|
28
|
+
const dirs: string[] = [];
|
|
29
|
+
|
|
30
|
+
function fakeTailscale(script: string): string {
|
|
31
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'kabmo-ts-'));
|
|
32
|
+
dirs.push(dir);
|
|
33
|
+
const file = path.join(dir, 'tailscale');
|
|
34
|
+
fs.writeFileSync(file, `#!/bin/sh\n${script}\n`);
|
|
35
|
+
fs.chmodSync(file, 0o755);
|
|
36
|
+
return file;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
for (const dir of dirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true });
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const RUNNING = `cat <<'JSON'
|
|
44
|
+
{"BackendState":"Running","Self":{"DNSName":"node.tailnet.ts.net.","TailscaleIPs":["100.1.2.3","fd7a::1"]}}
|
|
45
|
+
JSON`;
|
|
46
|
+
|
|
47
|
+
describe('tailscaleNode', () => {
|
|
48
|
+
test.skipIf(!posixOnly)('derives the https origin from the MagicDNS name', async () => {
|
|
49
|
+
const binary = fakeTailscale(RUNNING);
|
|
50
|
+
const node = await tailscaleNode(binary);
|
|
51
|
+
expect(node?.url).toBe('https://node.tailnet.ts.net');
|
|
52
|
+
expect(node?.addresses).toEqual(['100.1.2.3', 'fd7a::1']);
|
|
53
|
+
expect(node?.backendState).toBe('Running');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test.skipIf(!posixOnly)('answers null when the daemon does not answer', async () => {
|
|
57
|
+
const binary = fakeTailscale('exit 1');
|
|
58
|
+
expect(await tailscaleNode(binary)).toBeNull();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test.skipIf(!posixOnly)('answers null for output that is not JSON', async () => {
|
|
62
|
+
const binary = fakeTailscale('echo "not json"');
|
|
63
|
+
expect(await tailscaleNode(binary)).toBeNull();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test.skipIf(!posixOnly)('reports a node that is not signed in', async () => {
|
|
67
|
+
const binary = fakeTailscale(`echo '{"BackendState":"NeedsLogin","Self":{}}'`);
|
|
68
|
+
const node = await tailscaleNode(binary);
|
|
69
|
+
expect(node?.backendState).toBe('NeedsLogin');
|
|
70
|
+
expect(node?.url).toBeNull();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('serveIsUp', () => {
|
|
75
|
+
test.skipIf(!posixOnly)('reads a TCP share as up', async () => {
|
|
76
|
+
const binary = fakeTailscale(`echo '{"TCP":{"443":{"HTTPS":true}}}'`);
|
|
77
|
+
expect(await serveIsUp(binary)).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test.skipIf(!posixOnly)('reads an empty config as down', async () => {
|
|
81
|
+
const binary = fakeTailscale(`echo '{}'`);
|
|
82
|
+
expect(await serveIsUp(binary)).toBe(false);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test.skipIf(!posixOnly)('reads a failing command as down', async () => {
|
|
86
|
+
const binary = fakeTailscale('exit 1');
|
|
87
|
+
expect(await serveIsUp(binary)).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('startServe / stopServe', () => {
|
|
92
|
+
test.skipIf(!posixOnly)('a successful share reports no reason', async () => {
|
|
93
|
+
const binary = fakeTailscale('exit 0');
|
|
94
|
+
expect(await startServe(binary, 3000)).toEqual({ ok: true, reason: null });
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test.skipIf(!posixOnly)('a refusal carries the CLI sentence', async () => {
|
|
98
|
+
const binary = fakeTailscale('echo "HTTPS is not enabled for this tailnet" >&2; exit 1');
|
|
99
|
+
const outcome = await startServe(binary, 3000);
|
|
100
|
+
expect(outcome.ok).toBe(false);
|
|
101
|
+
expect(outcome.reason).toContain('HTTPS is not enabled');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test.skipIf(!posixOnly)('a silent timeout names the likely cause instead of the timeout', async () => {
|
|
105
|
+
// The real CLI blocks when HTTPS is off, and "timed out" alone tells the user
|
|
106
|
+
// nothing they can act on.
|
|
107
|
+
const binary = fakeTailscale('sleep 30');
|
|
108
|
+
const outcome = await startServe(binary, 3000);
|
|
109
|
+
expect(outcome.ok).toBe(false);
|
|
110
|
+
expect(outcome.reason).toContain('HTTPS may be disabled');
|
|
111
|
+
}, 30_000);
|
|
112
|
+
|
|
113
|
+
test.skipIf(!posixOnly)('stopping a share that is not there still succeeds', async () => {
|
|
114
|
+
const binary = fakeTailscale('exit 0');
|
|
115
|
+
expect(await stopServe(binary)).toEqual({ ok: true, reason: null });
|
|
116
|
+
});
|
|
117
|
+
});
|