fuli-context 0.27.1 → 0.27.3
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/web/assets/{AboutPage-BKyNoI0v.js → AboutPage-C-fJv2EQ.js} +1 -1
- package/dist/web/assets/AboutSectionHeading-CaZhhuuu.css +1 -0
- package/dist/web/assets/AboutSectionHeading-DLjnjHfb.js +1 -0
- package/dist/web/assets/AgentAppsPage-CBcUlh8U.js +1 -0
- package/dist/web/assets/AgentAvatar-Cu_TwSqc.js +1 -0
- package/dist/web/assets/AgentAvatar-VUEAsIqM.css +1 -0
- package/dist/web/assets/{AgentHand-BfRjs1He.js → AgentHand-1yBhYv72.js} +1 -1
- package/dist/web/assets/{AgentManagement-qCpr876m.js → AgentManagement-D8jHUEWK.js} +2 -2
- package/dist/web/assets/{AgentMentionCopy-_pr-D8vX.js → AgentMentionCopy-BRxaxi6r.js} +1 -1
- package/dist/web/assets/{AgentName-CUuWNrzE.js → AgentName-CL8xix6s.js} +1 -1
- package/dist/web/assets/AgentProfilePage-BosYAypt.js +5 -0
- package/dist/web/assets/AgentServicesPage-BQHw7Cyx.js +1 -0
- package/dist/web/assets/{AppViewerPage-Ct46NPXP.js → AppViewerPage-CO5-dW38.js} +1 -1
- package/dist/web/assets/{BackToTop-DOlt-xjQ.js → BackToTop-dl4Y4CgO.js} +1 -1
- package/dist/web/assets/{BoardCardFieldsMenu-RFcx_CAs.js → BoardCardFieldsMenu-BBqsgCq8.js} +1 -1
- package/dist/web/assets/{BoardMoveMenu-GJ8lpuZY.js → BoardMoveMenu-Rys8yvXz.js} +1 -1
- package/dist/web/assets/{Breadcrumb-DTo6Zvtb.js → Breadcrumb-DXXN0moP.js} +1 -1
- package/dist/web/assets/{CaptureChangePage-DRgWyCRo.js → CaptureChangePage-lNiPS4XI.js} +1 -1
- package/dist/web/assets/{CopyFixPrompt-1UXH_ItZ.js → CopyFixPrompt-Cpve4rdS.js} +1 -1
- package/dist/web/assets/{DataFormatPage-CgFXfOW_.js → DataFormatPage-DpBIwY-n.js} +1 -1
- package/dist/web/assets/DebugTurnPage-DzJ07GMF.js +1 -0
- package/dist/web/assets/{DebugTurnsPage-BGKSH3n0.js → DebugTurnsPage-CNAeNt5i.js} +1 -1
- package/dist/web/assets/{DialogTitle-CIVSlKqQ.js → DialogTitle-D0EVi01-.js} +1 -1
- package/dist/web/assets/{EmployeeRedirectPage-8qPpnbyP.js → EmployeeRedirectPage-qlH0SVZY.js} +1 -1
- package/dist/web/assets/EmployeeScopeDialog-C4B724Jj.js +1 -0
- package/dist/web/assets/EmployeeWorkbench-BgpxZ_1F.js +4 -0
- package/dist/web/assets/{EmployeeWorkbench-Bp9pUkfS.css → EmployeeWorkbench-rhY970vW.css} +1 -1
- package/dist/web/assets/FieldRoot-oxmAMICi.js +1 -0
- package/dist/web/assets/FlaBlockedTasks-CWa5T5nU.css +1 -0
- package/dist/web/assets/FlaBlockedTasks-DGw9I-j7.js +1 -0
- package/dist/web/assets/{FlaGrowth-CaFdmezv.js → FlaGrowth-Ct4GbCJZ.js} +1 -1
- package/dist/web/assets/{FlaOccupationKit-CFoBUWGF.js → FlaOccupationKit-Cbx058JA.js} +1 -1
- package/dist/web/assets/{FlaTaskSheets-BShmW9R5.js → FlaTaskSheets-CoWj7Gw3.js} +1 -1
- package/dist/web/assets/FlasPage-BGrz_P1x.js +1 -0
- package/dist/web/assets/{FlasPage-H99IZ9M6.css → FlasPage-D3CcJcvN.css} +1 -1
- package/dist/web/assets/{GrowthLoading-CVBn4r4q.js → GrowthLoading-BHxVzIoM.js} +1 -1
- package/dist/web/assets/HowtoPage-DfHVIb8E.css +1 -0
- package/dist/web/assets/HowtoPage-Dx7xGKQi.js +1 -0
- package/dist/web/assets/{InboxPage-D9VIDrsL.js → InboxPage-ByZQpihN.js} +1 -1
- package/dist/web/assets/{KnowledgeDeleteButton-C01O4FSO.js → KnowledgeDeleteButton-dvslN7EO.js} +1 -1
- package/dist/web/assets/{KnowledgeHardDeleteSection-jqad3dJN.js → KnowledgeHardDeleteSection-DMARNrze.js} +1 -1
- package/dist/web/assets/KnowledgeItemEditPage-D7X3K-Fu.js +1 -0
- package/dist/web/assets/{KnowledgeItemSummaryCard-XbkYp7Dy.js → KnowledgeItemSummaryCard-Carpboje.js} +1 -1
- package/dist/web/assets/KnowledgeOrganizerPage-CdFva4xO.js +1 -0
- package/dist/web/assets/KnowledgePage-CwrWmdLl.js +1 -0
- package/dist/web/assets/KnowledgePeek-C4QSXTOF.js +1 -0
- package/dist/web/assets/KnowledgeTurnReceiptPage-CY85DtmF.js +1 -0
- package/dist/web/assets/{KnowledgeWorkspace-CmzU6Vuh.js → KnowledgeWorkspace-D8Q8usZc.js} +3 -3
- package/dist/web/assets/{MeAvatar-D_LFqHrR.js → MeAvatar-WSCaLEJ1.js} +1 -1
- package/dist/web/assets/{MeLink-CeIxjFrm.js → MeLink-rP0IiTaj.js} +1 -1
- package/dist/web/assets/MenuSeparator-C_h65gsb.js +1 -0
- package/dist/web/assets/ModelSettingsPage-B_Udk6b7.js +1 -0
- package/dist/web/assets/{NewSessionPanel-BKrOFEMO.js → NewSessionPanel-DNYTQ0Lw.js} +1 -1
- package/dist/web/assets/{NotFoundPage-CdOCRj3P.js → NotFoundPage-BbnR0KYy.js} +1 -1
- package/dist/web/assets/NoticeRow-CcQ1J4wZ.js +1 -0
- package/dist/web/assets/{workbench-card-Dt0820yW.css → NoticeRow-DD-J76Yo.css} +1 -1
- package/dist/web/assets/OccupationsPage-DQGGceta.js +1 -0
- package/dist/web/assets/{PageOutline-VtLLW4kh.js → PageOutline-nKD_AvCJ.js} +1 -1
- package/dist/web/assets/PageStack-BMzrkyV4.css +1 -0
- package/dist/web/assets/PageStack-BVHOFq7x.js +1 -0
- package/dist/web/assets/PersonalProfilePage-Cm1NxyU0.js +1 -0
- package/dist/web/assets/PersonalProjectsPage-CgqC4u77.js +1 -0
- package/dist/web/assets/{PinIcon-DD3Un-hh.js → PinIcon-DxjWqB7x.js} +1 -1
- package/dist/web/assets/PopperContent-BkTZlJWP.js +1 -0
- package/dist/web/assets/{Presence-DqPb-1P1.js → Presence-DrSz_UA1.js} +1 -1
- package/dist/web/assets/{ProfileAuthorChip-Dm5GjcAt.js → ProfileAuthorChip-CN1ZYzKN.js} +1 -1
- package/dist/web/assets/ProjectAgentsPage-DMnRnXDT.js +5 -0
- package/dist/web/assets/{ProjectJudgmentPolicy-DVFV5Cai.js → ProjectJudgmentPolicy-DBszt68M.js} +1 -1
- package/dist/web/assets/{RoundtablesPage-DL-IOngN.css → RoundtablesPage-Cdbl7Tbx.css} +1 -1
- package/dist/web/assets/RoundtablesPage-QtNyNaDg.js +13 -0
- package/dist/web/assets/RovingFocusGroup-Dvddk8pN.js +1 -0
- package/dist/web/assets/{RovingFocusItem-C_N843Nb.js → RovingFocusItem-Ck-FCX8l.js} +1 -1
- package/dist/web/assets/SessionMigrationPage-Chm5L6p4.js +1 -0
- package/dist/web/assets/{SessionRecordsPage-Dy203sP2.js → SessionRecordsPage-BHPaCRH-.js} +1 -1
- package/dist/web/assets/SettingsPage-C80ljt40.js +1 -0
- package/dist/web/assets/SettingsPage-CnqtNPWd.css +1 -0
- package/dist/web/assets/{SharedJefaReportPage-CASkC5pc.js → SharedJefaReportPage-DHD4As4b.js} +1 -1
- package/dist/web/assets/StatementCalendarPage-lkq1OrUT.js +1 -0
- package/dist/web/assets/StatementCalendarPage-t8pJI4G6.css +1 -0
- package/dist/web/assets/StatementRows-DS-_XbkC.js +1 -0
- package/dist/web/assets/StatementRows-TQ2i_uXU.css +1 -0
- package/dist/web/assets/{TagVocabularyPage-Bd57YcUL.js → TagVocabularyPage-ap97B1fd.js} +1 -1
- package/dist/web/assets/TaskBlockerClear-xmjIgmON.js +1 -0
- package/dist/web/assets/TaskBlockerNotice-D3awZbiX.js +1 -0
- package/dist/web/assets/{TaskReason-BxYwBDoB.js → TaskReason-Y_gLRUR4.js} +1 -1
- package/dist/web/assets/{TeamCard-cWYC5z07.js → TeamCard-C5BOBfgK.js} +1 -1
- package/dist/web/assets/TeamCardsWidget-jLieh7GV.js +1 -0
- package/dist/web/assets/{TeamIsland-BD5s-zFZ.js → TeamIsland-C2U6j6W0.js} +1 -1
- package/dist/web/assets/{Teleport-DhMmMHjy.js → Teleport-RJS88HRO.js} +1 -1
- package/dist/web/assets/{TextField-XakqTnVl.js → TextField-CwecNrfC.js} +1 -1
- package/dist/web/assets/TodayPage-EJ8SWFE0.css +1 -0
- package/dist/web/assets/TodayPage-wkVzpeI1.js +1 -0
- package/dist/web/assets/{TonborgDelegationSwitch-B59PUZBz.js → TonborgDelegationSwitch-C9jrfVCw.js} +1 -1
- package/dist/web/assets/{UiChip-BFdfq8Jm.js → UiChip-DLTDKZh9.js} +1 -1
- package/dist/web/assets/UiDialog-u4ZkP4DG.js +1 -0
- package/dist/web/assets/{UiDisclosure-G3MiGB7F.js → UiDisclosure-CKVkr79z.js} +1 -1
- package/dist/web/assets/{UiIcon--qI1_q89.js → UiIcon-D2DJw7hg.js} +1 -1
- package/dist/web/assets/UiSegmented-D6pLjXXW.js +1 -0
- package/dist/web/assets/{UiWeight-BRA-6EY_.js → UiWeight-BOEi9suT.js} +1 -1
- package/dist/web/assets/{VirtualDirectoryList-Dm07NMxq.js → VirtualDirectoryList-BX3eeyRo.js} +1 -1
- package/dist/web/assets/{VisuallyHidden-DIg8c_z2.js → VisuallyHidden-DjqI8CEj.js} +1 -1
- package/dist/web/assets/{VisuallyHiddenInput-rcWqHewS.js → VisuallyHiddenInput-Cc2Qp6aL.js} +1 -1
- package/dist/web/assets/WidgetSlot-7bCPwUl2.js +2 -0
- package/dist/web/assets/WorkbenchListPage-BKT03RRO.css +1 -0
- package/dist/web/assets/WorkbenchListPage-DlE6S2WC.js +1 -0
- package/dist/web/assets/_plugin-vue_export-helper-BXUcxlz4.js +9 -0
- package/dist/web/assets/{agent-apps-Svxh5tiY.js → agent-apps-CFWQ-pVX.js} +1 -1
- package/dist/web/assets/agent-occupation-BQG-rvnx.js +1 -0
- package/dist/web/assets/{agent-pins-CvATgFji.js → agent-pins-XtAvsJ8S.js} +1 -1
- package/dist/web/assets/{agent-roster-records-CsYjmaNn.js → agent-roster-records-DiZKG26q.js} +1 -1
- package/dist/web/assets/{agent-work-summary-BOeJ4JXc.js → agent-work-summary-CvHRy3NR.js} +1 -1
- package/dist/web/assets/{attach-closest-edge-DFoBNGBU.js → attach-closest-edge-De5463t-.js} +1 -1
- package/dist/web/assets/{attention-store-CHxXJTuF.js → attention-store-CWRvv8xT.js} +1 -1
- package/dist/web/assets/{badge-DqHf-RNw.js → badge-CyUHAZlb.js} +1 -1
- package/dist/web/assets/{button-CdYobu4m.js → button-DgFpUg62.js} +1 -1
- package/dist/web/assets/{card-8xZot-73.js → card-BG73LSt9.js} +1 -1
- package/dist/web/assets/{catalog-h6KbvKdB.js → catalog-KaWiF7K5.js} +1 -1
- package/dist/web/assets/{checkbox-DZ6CDZ8r.js → checkbox-DNX0E3Ym.js} +1 -1
- package/dist/web/assets/{client-DRnUmjCk.js → client-eeoB__-w.js} +1 -1
- package/dist/web/assets/{client-links-store-DQY0A5PC.js → client-links-store-C1T7b2HQ.js} +1 -1
- package/dist/web/assets/combobox-BG6YUVkp.js +1 -0
- package/dist/web/assets/{console-BF8ZU9dG.js → console-KA3Jxkr4.js} +1 -1
- package/dist/web/assets/conversation-launcher-settings-QWrAaAPe.js +1 -0
- package/dist/web/assets/copy-mention-BwT-8AqP.js +1 -0
- package/dist/web/assets/{dialog-Bg5NVU4Y.js → dialog-CPHmFum7.js} +1 -1
- package/dist/web/assets/{dist--2DWcoU9.js → dist-CTCo5IXd.js} +1 -1
- package/dist/web/assets/{dist-INkzWhVF.js → dist-e1tihV1g.js} +1 -1
- package/dist/web/assets/dropdown-menu-BScsuHhH.js +1 -0
- package/dist/web/assets/{field-7G2bSNl5.js → field-8F_Pt8vb.js} +1 -1
- package/dist/web/assets/{format-bytes-Jj3-0UhP.js → format-bytes-DkVJGLsS.js} +1 -1
- package/dist/web/assets/{hover-card-llxR7wrX.js → hover-card-Db-Mrxk6.js} +1 -1
- package/dist/web/assets/identity-wfQfyysH.js +1 -0
- package/dist/web/assets/{index-HRZACEmh.css → index-CHDkJLQR.css} +1 -1
- package/dist/web/assets/index-CRSH-FaE.js +24 -0
- package/dist/web/assets/{input-z5o2wIZC.js → input-DFTIPfkE.js} +1 -1
- package/dist/web/assets/{label-BtTrlS8e.js → label-BDet7nvg.js} +1 -1
- package/dist/web/assets/label-table-BVh638Sy.js +1 -0
- package/dist/web/assets/{model-CGfhtR6w.js → model-BwEuimI0.js} +1 -1
- package/dist/web/assets/{model-CCaA3vRN.js → model-Bzgg7OTO.js} +1 -1
- package/dist/web/assets/model-C7J0jC4U.js +1 -0
- package/dist/web/assets/{model-BD6AfoOR.js → model-D3j-Q4br.js} +1 -1
- package/dist/web/assets/{model-BMd98Yux.js → model-DFuUc43Z.js} +1 -1
- package/dist/web/assets/{model-BKg9fdsn.js → model-DGpMX2GY.js} +1 -1
- package/dist/web/assets/{model-Ejc2vysd.js → model-LXhsHZ_S.js} +1 -1
- package/dist/web/assets/{model-Bhyqm3my.js → model-WhGp0XZv.js} +1 -1
- package/dist/web/assets/motion-0KGuL0P9.js +1 -0
- package/dist/web/assets/{motion-pePEUhOt.js → motion-BhDwEDuX.js} +1 -1
- package/dist/web/assets/{motion-preference-DTwjqiJ8.js → motion-preference--VYomm-z.js} +1 -1
- package/dist/web/assets/{occupation-catalog-ByjQk0EY.js → occupation-catalog-D5SQWfUI.js} +1 -1
- package/dist/web/assets/{occupation-kits-Dg6UZqc1.js → occupation-kits-CrqixyUx.js} +1 -1
- package/dist/web/assets/{option-BIjYeAh2.js → option-C9CkqCvy.js} +1 -1
- package/dist/web/assets/{orchestration-filters-3AfjDoHQ.js → orchestration-filters-DTnWbCEm.js} +1 -1
- package/dist/web/assets/overview-data-BvW9uhT4.js +1 -0
- package/dist/web/assets/{page-refresh-BTqRX45n.js → page-refresh-GRJ3nMpT.js} +1 -1
- package/dist/web/assets/{page-title-B5RyNTPD.js → page-title-B9HNL7K4.js} +1 -1
- package/dist/web/assets/{person-profile-BzPwdtix.js → person-profile-Cng7edLa.js} +1 -1
- package/dist/web/assets/{popover-BsWyCEy5.js → popover-BgaSR8Zf.js} +1 -1
- package/dist/web/assets/popup-host-CFQVWMSj.js +1 -0
- package/dist/web/assets/preference-conflicts-WphCdbo6.js +1 -0
- package/dist/web/assets/{profile-model-TAsyybji.js → profile-model-B9K6ylO1.js} +1 -1
- package/dist/web/assets/{project-board-layout-BwyHItDc.js → project-board-layout-GxgeqkX4.js} +1 -1
- package/dist/web/assets/{project-capture-I8-7JwsK.js → project-capture-C6NQkcJw.js} +1 -1
- package/dist/web/assets/{project-origin-B_Ku288r.js → project-origin-DuSzjbhd.js} +1 -1
- package/dist/web/assets/{quick-edit-api-Cm-W3ZVP.js → quick-edit-api-BDFnInRp.js} +1 -1
- package/dist/web/assets/radio-group-D6RUfdDr.js +1 -0
- package/dist/web/assets/{review-api-Gwr5nP1B.js → review-api-D31JYGWJ.js} +1 -1
- package/dist/web/assets/{review-list-CNeXKjBw.js → review-list-Cvacm108.js} +1 -1
- package/dist/web/assets/{review-store-BaMwO51r.js → review-store-D7_Vfhh7.js} +1 -1
- package/dist/web/assets/{role-names-C-F0XIE1.js → role-names-DebBvCND.js} +1 -1
- package/dist/web/assets/{roundtable-live-CM4Cqw2v.js → roundtable-live-DfN7Sw9Q.js} +1 -1
- package/dist/web/assets/{runtime-dom.esm-bundler-tA5o2TEo.js → runtime-dom.esm-bundler-DBdCxLeu.js} +1 -1
- package/dist/web/assets/select-C0ecw2Gn.js +1 -0
- package/dist/web/assets/{session-launch-offers-CEdCRTz9.js → session-launch-offers-BO40dDPk.js} +1 -1
- package/dist/web/assets/{settings-autosave-D3wBf_zN.js → settings-autosave-q7Wr9G3O.js} +1 -1
- package/dist/web/assets/settings-tabs-D7-3akvW.js +1 -0
- package/dist/web/assets/shared-report-j27wViAk.js +3 -0
- package/dist/web/assets/{source-adapters-BR-AAGhD.js → source-adapters-D3VpWZ6y.js} +1 -1
- package/dist/web/assets/{switch-BoOtTu6O.js → switch-ClI3aPV3.js} +1 -1
- package/dist/web/assets/tabs-BYpn35nj.js +1 -0
- package/dist/web/assets/{task-card-fields-BWlLtcKE.js → task-card-fields-CR_cHUml.js} +1 -1
- package/dist/web/assets/{task-evidence-DydhKn9x.js → task-evidence-D0XkNnb8.js} +1 -1
- package/dist/web/assets/{task-labels-BrNKooHK.js → task-labels-C6FR9pf_.js} +1 -1
- package/dist/web/assets/{task-reason-CvmaNQWE.js → task-reason-C2NjR8__.js} +1 -1
- package/dist/web/assets/{team-sheets-DkAuebg6.js → team-sheets-5rb7d8An.js} +1 -1
- package/dist/web/assets/{textarea-BQnuJ0v3.js → textarea-BW51g0FT.js} +1 -1
- package/dist/web/assets/ui-rJlFkhnh.js +1 -0
- package/dist/web/assets/{useAgentRecords-PysQYF4V.js → useAgentRecords-BDEGuChX.js} +1 -1
- package/dist/web/assets/{useAgentWorkSummary-DaNyOo2z.js → useAgentWorkSummary-B7fcYNAf.js} +1 -1
- package/dist/web/assets/{useApi-CROJJdhE-CgPyy2pi.js → useApi-CROJJdhE-CXkEmQ40.js} +1 -1
- package/dist/web/assets/{useClipboardCopy-Cf3GZrHC.js → useClipboardCopy-CLyPUkax.js} +1 -1
- package/dist/web/assets/useDirection-hD2Ki6e_.js +1 -0
- package/dist/web/assets/{useFocusReturn-uY18_eDg.js → useFocusReturn-BzZRnzjC.js} +1 -1
- package/dist/web/assets/{useForwardExpose-Ci_aBJDg.js → useForwardExpose-BFvXozfQ.js} +1 -1
- package/dist/web/assets/{useForwardPropsEmits-mGaDeNMp.js → useForwardPropsEmits-BQIBYWrX.js} +1 -1
- package/dist/web/assets/useForwardScopeId-DJpBz5AW.js +1 -0
- package/dist/web/assets/{useKnowledgeConfirm-PcqqgwNU.js → useKnowledgeConfirm-B7ljY3BE.js} +1 -1
- package/dist/web/assets/{useKnowledgeItemPeek-yjyrSFtf.js → useKnowledgeItemPeek-W54o0cXF.js} +1 -1
- package/dist/web/assets/{useMinimumLoadingDisplay-Bu6xyHby.js → useMinimumLoadingDisplay-i0As_nIh.js} +1 -1
- package/dist/web/assets/useNow-w9sbWus7.js +1 -0
- package/dist/web/assets/{usePageTools-DYi9x7HJ.js → usePageTools-ChjnsxqE.js} +1 -1
- package/dist/web/assets/usePrimitiveElement-tPtHrVAh.js +1 -0
- package/dist/web/assets/{useProjectAgentRoster-KPwWl2jE.js → useProjectAgentRoster-Cv-2h61l.js} +1 -1
- package/dist/web/assets/{useRoutePeek-BiHDBRKc.js → useRoutePeek-6T3XqFw1.js} +1 -1
- package/dist/web/assets/useTeamWork-rjEihEaF.js +1 -0
- package/dist/web/assets/{useTypeahead-D_Z5P9Xm.js → useTypeahead-BBlzBvAi.js} +1 -1
- package/dist/web/assets/{utils-CAAvfQSj.js → utils-Bhge2HAf.js} +1 -1
- package/dist/web/assets/{utils-D6RjkXrh.js → utils-DVo87S8o.js} +1 -1
- package/dist/web/assets/{verification-DoN2EFaZ.js → verification-BKmnZihv.js} +1 -1
- package/dist/web/assets/{version-DbJq2Cfv.js → version-BYqyCHiB.js} +1 -1
- package/dist/web/assets/{vue-router-BwoPnYha.js → vue-router-BJZE7CCr.js} +1 -1
- package/dist/web/index.html +77 -76
- package/docs/agent-roundtable.md +5 -3
- package/graph-provider/fuli_graph/app.py +4 -0
- package/graph-provider/fuli_graph/graph_field_contract.py +2 -0
- package/graph-provider/fuli_graph/graph_format_migrations.py +5 -0
- package/graph-provider/fuli_graph/knowledge_search.py +84 -7
- package/graph-provider/fuli_graph/knowledge_sensitivity.py +105 -0
- package/graph-provider/fuli_graph/knowledge_source_delete_copies.py +36 -0
- package/graph-provider/fuli_graph/knowledge_statement.py +230 -0
- package/graph-provider/fuli_graph/knowledge_statement_days.py +109 -0
- package/graph-provider/fuli_graph/models.py +25 -0
- package/graph-provider/fuli_graph/project_agent_remote_origins.py +27 -13
- package/graph-provider/pyproject.toml +1 -1
- package/native/win32/fuli-win-helper.exe +0 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/packages/roundtable/src/agents/claude-code/wake.js +13 -8
- package/packages/roundtable/src/host.js +21 -0
- package/packages/roundtable/src/peer/control-cli.js +35 -3
- package/packages/roundtable/src/peer/control.js +24 -5
- package/packages/roundtable/src/peer/coordinator-service.js +44 -21
- package/packages/roundtable/src/peer/coordinator-store.js +11 -4
- package/packages/roundtable/src/peer/lan-addresses.js +16 -1
- package/packages/roundtable/src/peer/nearby-discovery.js +105 -44
- package/packages/roundtable/src/peer/nearby-pairing.js +13 -1
- package/packages/roundtable/src/peer/origin-proof.js +17 -2
- package/packages/roundtable/src/peer/pairing-share.js +139 -0
- package/packages/roundtable/src/peer/peer-port.js +45 -7
- package/packages/roundtable/src/peer/peer-runtime.js +199 -46
- package/packages/roundtable/src/peer/protocol.js +68 -2
- package/packages/roundtable/src/peer/query-answer.js +78 -0
- package/packages/roundtable/src/peer/runner.js +107 -13
- package/packages/roundtable/src/roundtable/service.js +73 -14
- package/packages/roundtable/src/roundtable/store.js +8 -0
- package/packages/roundtable/src/roundtable/wake-attempt-store.js +26 -0
- package/packages/roundtable/src/roundtable/wake-failure.js +77 -0
- package/packages/roundtable/src/roundtable/wake-ladder.js +5 -0
- package/packages/roundtable/src/roundtable/wake.js +39 -15
- package/packages/roundtable/src/standalone/host.js +5 -2
- package/skills/capturing-session-knowledge/references/coordination.md +11 -0
- package/skills/operating-fuli/SKILL.md +13 -3
- package/skills/operating-fuli/references/workflow-recipes.md +4 -3
- package/src/agent-apps/host-tools/catalog.js +3 -0
- package/src/agent-delegation/operation-log.js +15 -1
- package/src/agent-delegation/port.js +1 -2
- package/src/agent-peer/http.js +15 -1
- package/src/agent-roundtable/tools.js +8 -0
- package/src/agent-tools/graph-definitions.js +2 -0
- package/src/agent-tools/graph-handlers.js +2 -0
- package/src/agent-tools/interface-catalog.js +6 -4
- package/src/agent-tools/statement-definitions.js +18 -0
- package/src/data-format/local-stores.js +3 -0
- package/src/desktop/windows-controller.js +17 -4
- package/src/desktop/windows-installation-context.js +26 -1
- package/src/diagnostics/failure-records.js +16 -0
- package/src/diagnostics/query.js +2 -2
- package/src/diagnostics/safe-event.js +4 -12
- package/src/external-knowledge/safe-diagnostic.js +2 -5
- package/src/graphiti/local-runtimes.js +9 -0
- package/src/graphiti/project-agent-task-sessions.js +49 -0
- package/src/graphiti/provider-client.js +8 -0
- package/src/graphiti/roundtable-host.js +53 -0
- package/src/graphiti/task-context-entry.js +10 -6
- package/src/http/api-router.js +4 -0
- package/src/http/graph-api-router.js +5 -2
- package/src/http/statement-api-router.js +27 -0
- package/src/http/visitor-access-api-router.js +37 -0
- package/src/judgment/store.js +9 -0
- package/src/knowledge-impressions/store.js +72 -9
- package/src/mcp/create-mcp-server.js +2 -0
- package/src/mcp/session-id.js +1 -1
- package/src/mcp/tool-annotations.js +4 -1
- package/src/notices/recent-notices.js +2 -1
- package/src/presence/windows-helper-pin.js +1 -1
- package/src/statement/agent-tool.js +29 -0
- package/src/statement/compounding-statement.js +134 -0
- package/src/text/control-characters.js +9 -0
- package/src/text/local-paths.js +48 -0
- package/src/text/shareable-text.js +23 -0
- package/src/visitor-access/port.js +194 -0
- package/src/visitor-access/rate-limit.js +26 -0
- package/src/visitor-access/shared-project-search.js +129 -0
- package/src/visitor-access/store.js +192 -0
- package/src/whats-new/lines/0.27.2.json +13 -0
- package/src/whats-new/lines/0.27.3.json +13 -0
- package/dist/web/assets/AboutSectionHeading-DjXpIV27.css +0 -1
- package/dist/web/assets/AboutSectionHeading-DwvCvoqO.js +0 -1
- package/dist/web/assets/AgentAppsPage-Cp2-sZXi.js +0 -1
- package/dist/web/assets/AgentAvatar-CDhU4m0T.js +0 -1
- package/dist/web/assets/AgentAvatar-DbsG1_BY.css +0 -1
- package/dist/web/assets/AgentProfilePage-DcOBhuHG.js +0 -5
- package/dist/web/assets/AgentServicesPage-CAL-JT1J.js +0 -1
- package/dist/web/assets/DebugTurnPage-B8YhpTPm.js +0 -1
- package/dist/web/assets/EmployeeScopeDialog-BZymZidB.js +0 -1
- package/dist/web/assets/EmployeeWorkbench-BnxEZCSS.js +0 -4
- package/dist/web/assets/FieldRoot-D6HtUgDA.js +0 -1
- package/dist/web/assets/FlasPage-DtkW-_9f.js +0 -1
- package/dist/web/assets/HowtoPage-B8f5J_An.js +0 -1
- package/dist/web/assets/HowtoPage-CrvMmT6K.css +0 -1
- package/dist/web/assets/KnowledgeItemEditPage-DV8TVpvf.js +0 -1
- package/dist/web/assets/KnowledgeOrganizerPage-C4G6JCmG.js +0 -1
- package/dist/web/assets/KnowledgePage-Afiw2Kxy.js +0 -1
- package/dist/web/assets/KnowledgePeek-DIcPS9WU.js +0 -1
- package/dist/web/assets/KnowledgeTurnReceiptPage-7ncXkxKd.js +0 -1
- package/dist/web/assets/MenuSeparator-yD3wld9s.js +0 -1
- package/dist/web/assets/ModelSettingsPage-BqClsFmC.js +0 -1
- package/dist/web/assets/NoticeRow-CQShZQtw.js +0 -1
- package/dist/web/assets/NoticeRow-ktVO_9Es.css +0 -1
- package/dist/web/assets/OccupationsPage-BrBus-nh.js +0 -1
- package/dist/web/assets/OverviewPage-Cq89Klha.js +0 -1
- package/dist/web/assets/OverviewPage-KVt4LcE-.css +0 -1
- package/dist/web/assets/PageColumns-CgIXTt4J.js +0 -1
- package/dist/web/assets/PageColumns-DEideeB7.css +0 -1
- package/dist/web/assets/PersonalProfilePage-C_dmUEuW.js +0 -1
- package/dist/web/assets/PersonalProjectsPage-CiCFHVt_.js +0 -1
- package/dist/web/assets/PopperContent-CCmt2yHl.js +0 -1
- package/dist/web/assets/ProjectAgentsPage-B5r0DKWL.js +0 -5
- package/dist/web/assets/RecentNotices-DYXEBfYm.js +0 -1
- package/dist/web/assets/RoundtablesPage-DlAXApKi.js +0 -13
- package/dist/web/assets/RovingFocusGroup-CI4aZr1z.js +0 -1
- package/dist/web/assets/SessionMigrationPage-CVKkTACn.js +0 -1
- package/dist/web/assets/SettingsPage-BcrAdXX7.js +0 -1
- package/dist/web/assets/SettingsPage-BlhCcwPn.css +0 -1
- package/dist/web/assets/TaskBlockerClear-DGaXP2ak.js +0 -1
- package/dist/web/assets/TaskBlockerNotice-8nogmPA-.js +0 -1
- package/dist/web/assets/TeamCardsWidget-BOf6oHOp.js +0 -1
- package/dist/web/assets/UiSegmented-CRJ06vHP.js +0 -1
- package/dist/web/assets/WidgetSlot-C5h--noP.js +0 -2
- package/dist/web/assets/WorkbenchListHead-D40-J4GT.js +0 -1
- package/dist/web/assets/WorkbenchListPage-BX6Z9gkB.css +0 -1
- package/dist/web/assets/WorkbenchListPage-CJUvq4Ac.js +0 -1
- package/dist/web/assets/_plugin-vue_export-helper-D9CtLGVz.js +0 -9
- package/dist/web/assets/agent-occupation-Dhoz7LjT.js +0 -1
- package/dist/web/assets/agent-workflows-BS4KlKFj.js +0 -1
- package/dist/web/assets/combobox-DE0HzdKP.js +0 -1
- package/dist/web/assets/conversation-launcher-settings-D4vYOpHN.js +0 -1
- package/dist/web/assets/copy-mention-Crs0NIJB.js +0 -1
- package/dist/web/assets/dropdown-menu-C5Kf9x2y.js +0 -1
- package/dist/web/assets/index-C2o_v2mq.js +0 -24
- package/dist/web/assets/label-table-CuTFbFd3.js +0 -1
- package/dist/web/assets/model-Bb0VtRJH.js +0 -1
- package/dist/web/assets/motion-Cw_hptY4.js +0 -1
- package/dist/web/assets/overview-data-BIeNATEJ.js +0 -1
- package/dist/web/assets/popup-host-DWJ1gygp.js +0 -1
- package/dist/web/assets/radio-group-DJ5np5d_.js +0 -1
- package/dist/web/assets/select-DJ7iyJ-X.js +0 -1
- package/dist/web/assets/settings-tabs-B9pCaEFP.js +0 -1
- package/dist/web/assets/shared-report-KyuP8oQk.js +0 -3
- package/dist/web/assets/tabs-D0TAS18R.js +0 -1
- package/dist/web/assets/ui-CJiEsCpv.js +0 -1
- package/dist/web/assets/useForwardScopeId-DYW8CZTp.js +0 -1
- package/dist/web/assets/usePrimitiveElement-DdC34jzt.js +0 -1
- package/dist/web/assets/useTeamPeople-Od3dDz6d.js +0 -1
- package/dist/web/assets/useTeamWork-CDKVZwYe.js +0 -1
|
@@ -3,8 +3,13 @@ import { join } from 'node:path';
|
|
|
3
3
|
|
|
4
4
|
import { firstField, listDirectory } from '../session-log.js';
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
|
|
6
|
+
// A read-only wake has only the built-in tools that read. Whatever edits a file, runs a command
|
|
7
|
+
// (Bash, PowerShell), fetches from the web or starts another agent is not there; the edit and
|
|
8
|
+
// shell tools are denied as well, since a deny rule wins over any allow rule the person keeps.
|
|
9
|
+
// Tools of MCP servers the person configured are not built in: they still follow that person's
|
|
10
|
+
// own allow rules (docs/agent-roundtable.md).
|
|
11
|
+
const READ_ONLY_TOOLS = Object.freeze(['Read', 'Grep', 'Glob']);
|
|
12
|
+
const READ_ONLY_DENIED_TOOLS = Object.freeze(['Edit', 'Write', 'NotebookEdit', 'MultiEdit', 'Bash', 'PowerShell']);
|
|
8
13
|
|
|
9
14
|
// Wakes Claude Code headlessly. Resuming forks the session, so an open window is
|
|
10
15
|
// never written concurrently while the answer still has that conversation's context.
|
|
@@ -19,14 +24,14 @@ export const claudeCodeWake = Object.freeze({
|
|
|
19
24
|
// delegated wake names the (forked) session up front and binds it first.
|
|
20
25
|
plansSession: true,
|
|
21
26
|
|
|
22
|
-
// readOnly (a group discussion turn) keeps the
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
+
// readOnly (a group discussion turn, an ask from another computer) keeps the
|
|
28
|
+
// same non-interactive mode with the reading tools only, so the woken session
|
|
29
|
+
// can read and answer but not change files or run commands. (Plan mode is
|
|
30
|
+
// avoided: headless it may end with a plan or an empty answer instead of the
|
|
31
|
+
// member's view.)
|
|
27
32
|
args({ sessionId, plannedSessionId = null, readOnly = false }) {
|
|
28
33
|
return ['-p', '--output-format', 'stream-json', '--verbose', '--permission-mode', 'dontAsk',
|
|
29
|
-
...(readOnly ? ['--disallowedTools', READ_ONLY_DENIED_TOOLS.join(',')] : []),
|
|
34
|
+
...(readOnly ? ['--tools', READ_ONLY_TOOLS.join(','), '--disallowedTools', READ_ONLY_DENIED_TOOLS.join(',')] : []),
|
|
30
35
|
...(sessionId ? ['--resume', sessionId, '--fork-session'] : []),
|
|
31
36
|
...(plannedSessionId ? ['--session-id', plannedSessionId] : [])];
|
|
32
37
|
},
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
// { agent_id, proof }: signed origin for a cross-device ask or chat
|
|
37
37
|
// remoteOriginAuthority() public keys that verify those origins
|
|
38
38
|
// recordMemoryUsage(input) optional: { recorded, reason? }
|
|
39
|
+
// agentLooks() optional: the faces the person changed, [{ agentId, kind, seed? }];
|
|
40
|
+
// a 'generated' seed is shared with paired devices
|
|
41
|
+
// (LAN directory `look`), nothing else is
|
|
39
42
|
// projectFolder(projectId) optional: the project's known folder for fresh sessions
|
|
40
43
|
// folderRepository(path) optional: the normalised origin address of the Git
|
|
41
44
|
// repository holding path, or null (LAN share folder check)
|
|
@@ -47,6 +50,24 @@
|
|
|
47
50
|
// standInScope({ agentId, name, occupation, projectId, text, client, sessionId })
|
|
48
51
|
// optional: the Agent's shareable index for a session that
|
|
49
52
|
// stands in for it (stand-in.js); never its private memory
|
|
53
|
+
// searchSharedProject({ projectId, agentId, requester: { node, name, agentName }, query: { action: 'card' | 'search', queries? } })
|
|
54
|
+
// optional: a paired device's read-only look at one shared project
|
|
55
|
+
// (projectId and agentId from this device's share, never from the
|
|
56
|
+
// asker; node the asking device's verified fingerprint, name and
|
|
57
|
+
// agentName display text), every card and search rate limited and
|
|
58
|
+
// recorded by the host: card { ok: true, name, responsibility,
|
|
59
|
+
// projectName }, search { ok: true, results, truncated }, or
|
|
60
|
+
// { ok: false, code }; without it this device refuses every
|
|
61
|
+
// visitor query (query_unsupported)
|
|
62
|
+
// refuseSharedQuery({ requester: { node, name, agentName }, action, code })
|
|
63
|
+
// optional: records a visitor query this device refused before
|
|
64
|
+
// searchSharedProject (not shared, a wrong proof, a replay) once
|
|
65
|
+
// the asking device was proven, counted toward its limits
|
|
66
|
+
// redactDiagnostic(text) optional, sync: a failed wake's captured client output as it
|
|
67
|
+
// may be kept (paths, credentials, secrets removed); without
|
|
68
|
+
// it the output is dropped and only codes are kept
|
|
69
|
+
// recordWakeFailure({ client, sessionMode, code, detail, exitCode, signal, durationMs, remote })
|
|
70
|
+
// optional, sync, never throws: the host's diagnostics of a failed wake
|
|
50
71
|
// requestSignal() optional, sync: the current request's AbortSignal
|
|
51
72
|
// inRestrictedWorker() optional, sync: true inside a sealed worker run
|
|
52
73
|
export const ROUNDTABLE_HOST_METHODS = Object.freeze([
|
|
@@ -7,11 +7,13 @@ export function peerUsage(command) {
|
|
|
7
7
|
status
|
|
8
8
|
nearby [on [--name NAME] | off | clear-attempts] list nearby FULI; on: be seen and listen for pairing
|
|
9
9
|
pair FINGERPRINT pair with a nearby FULI (first 4+ characters from the list)
|
|
10
|
-
confirm CODE the 6 digits the person reads on the OTHER computer
|
|
10
|
+
confirm CODE the 6 digits the person reads on the OTHER computer;
|
|
11
|
+
pairing shares the leads of up to 8 projects both computers have (a group of two only)
|
|
11
12
|
cancel cancel the pairing waiting here
|
|
12
13
|
host --address IP [--port PORT] [--name NAME] turn this computer into the coordinator
|
|
13
14
|
invite print a one-use pairing invitation (10 minutes)
|
|
14
15
|
join (--invitation TEXT | --invitation-file FILE) [--name NAME]
|
|
16
|
+
also shares the leads of up to 8 projects both computers have (a group of two only)
|
|
15
17
|
share --project ID --clients codex[,claude_code] [--folder DIR] (repeat --project for more; replaces the list)
|
|
16
18
|
revoke --device FINGERPRINT coordinator only
|
|
17
19
|
off leave: stop listening, sharing and trusting devices`;
|
|
@@ -54,6 +56,7 @@ export async function runPeerControlCommand(args, { baseUrl, command, notRunning
|
|
|
54
56
|
if (!/^\d{6}$/.test(code)) throw new Error('Pass the 6-digit code shown on the other computer.');
|
|
55
57
|
const pairing = (await call('GET', '/api/peer')).nearby?.pairing;
|
|
56
58
|
if (!pairing?.requestId || pairing.state !== 'confirm') throw new Error('No pairing is waiting for confirmation here.');
|
|
59
|
+
if (pairing.coordinator === 'other') write(MEMBER_TRUST);
|
|
57
60
|
return printNearby(await call('POST', '/api/peer/nearby/confirm', { requestId: pairing.requestId, code }), write, command);
|
|
58
61
|
}
|
|
59
62
|
case 'cancel': return printNearby(await call('POST', '/api/peer/nearby/cancel', {}), write, command);
|
|
@@ -74,6 +77,9 @@ export async function runPeerControlCommand(args, { baseUrl, command, notRunning
|
|
|
74
77
|
const file = option(rest, '--invitation-file');
|
|
75
78
|
const invitation = option(rest, '--invitation') ?? (file ? readFileSync(file, 'utf8').trim() : null);
|
|
76
79
|
if (!invitation) throw new Error('Pass --invitation or --invitation-file.');
|
|
80
|
+
// Joining is the consent to share the common projects' leads: said first, as the console does.
|
|
81
|
+
write(SHARE_ON_PAIRING);
|
|
82
|
+
write(MEMBER_TRUST);
|
|
77
83
|
return printStatus(await call('POST', '/api/peer/join', { invitation, name: option(rest, '--name') }), write);
|
|
78
84
|
}
|
|
79
85
|
case 'share': {
|
|
@@ -115,14 +121,35 @@ function printStatus(status, write) {
|
|
|
115
121
|
for (const project of status.shareable.filter((entry) => entry.sameProjectOn?.length)) {
|
|
116
122
|
write(` same project on ${project.sameProjectOn.map((device) => device.name).join(', ')}: ${project.projectName} (${project.projectId})${project.knownFolder ? '' : ' · no known folder here, pass --folder'}`);
|
|
117
123
|
}
|
|
124
|
+
printAutoShared(status, write);
|
|
118
125
|
if (status.lastPublish?.error) write(`The coordinator did not get this device's shared list: ${status.lastPublish.error}.`);
|
|
119
126
|
else if (status.lastPublish) write(`Shared list sent to the coordinator: ${status.lastPublish.agents} Agent(s) at ${status.lastPublish.at}`);
|
|
120
127
|
}
|
|
121
128
|
|
|
129
|
+
// What pairing shared without a separate tick (the leads of the projects the other computer reports too), or why nothing.
|
|
130
|
+
const NOT_AUTO_SHARED = {
|
|
131
|
+
group: (record) => `Not shared after pairing: ${record.matched} same project(s), but other computers in this group could ask them too. Share them yourself if you want.`,
|
|
132
|
+
too_many: (record) => `Not shared after pairing: ${record.matched} same projects is more than 8. Share the ones you want yourself.`,
|
|
133
|
+
unanswered: () => 'Not shared after pairing: the coordinator did not answer which projects both computers have.',
|
|
134
|
+
};
|
|
135
|
+
function printAutoShared(status, write) {
|
|
136
|
+
for (const record of status.autoShared ?? []) {
|
|
137
|
+
if (record.skipped) write(NOT_AUTO_SHARED[record.skipped]?.(record) ?? `Not shared after pairing (${record.skipped}).`);
|
|
138
|
+
else write(record.projects.length
|
|
139
|
+
? `Shared after pairing (projects the other computer has too): ${record.projects.map((project) => project.projectName).join(', ')}`
|
|
140
|
+
: 'Shared after pairing: none (no project both computers have that could be shared).');
|
|
141
|
+
}
|
|
142
|
+
// A member cannot check the group itself: the coordinating computer says who else is in it.
|
|
143
|
+
if (status.role === 'member' && (status.autoShared ?? []).some((record) => record.projects.length)) {
|
|
144
|
+
write('The other computer decides who else is in the group; untick any you are unsure of.');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
122
148
|
function printNearby(status, write, command) {
|
|
123
149
|
const { nearby } = status;
|
|
124
150
|
const ended = NEARBY_ENDED[nearby.ended?.kind];
|
|
125
151
|
if (ended) write(ended(nearby.ended));
|
|
152
|
+
printAutoShared(status, write);
|
|
126
153
|
if (!nearby.on) {
|
|
127
154
|
write(`Nearby pairing: off. \`${command} peer nearby on [--name NAME]\` lets computers on this network see that this one runs FULI (for 30 minutes).`);
|
|
128
155
|
return;
|
|
@@ -141,11 +168,16 @@ function printNearby(status, write, command) {
|
|
|
141
168
|
} else if (pairing.state === 'confirm' || pairing.state === 'finishing') {
|
|
142
169
|
write(`Pairing with ${device}: code ${pairing.code}. ${pairing.coordinator === 'this' ? 'This computer' : 'The other computer'} will coordinate.`);
|
|
143
170
|
write(pairing.confirmedHere
|
|
144
|
-
? `Confirmed here; waiting for the person on the other computer${pairing.confirmedThere ? ' (confirmed there too, finishing)' : ''}.`
|
|
145
|
-
: `Compare it with the code on the other computer; if they match, run \`${command} peer confirm <the code shown there>\` before ${pairing.expiresAt}
|
|
171
|
+
? `Confirmed here; waiting for the person on the other computer${pairing.confirmedThere ? ' (confirmed there too, finishing)' : ''}. \`${command} peer status\` then lists what was shared.`
|
|
172
|
+
: `Compare it with the code on the other computer; if they match, run \`${command} peer confirm <the code shown there>\` before ${pairing.expiresAt}.\n${SHARE_ON_PAIRING}${pairing.coordinator === 'other' ? `\n${MEMBER_TRUST}` : ''}`);
|
|
146
173
|
} else write(`Pairing with ${device}: ${pairing.state}${pairing.reason ? ` (${pairing.reason})` : ''}`);
|
|
147
174
|
}
|
|
148
175
|
|
|
176
|
+
// Said before the person confirms a pairing or joins with an invitation.
|
|
177
|
+
const SHARE_ON_PAIRING = 'Once confirmed, leads of up to 8 projects the other computer says it has too can talk. Nothing else.';
|
|
178
|
+
// Said to the side that will join another computer's group, when it consents.
|
|
179
|
+
const MEMBER_TRUST = 'The other computer relays messages and decides who else is in the group. Pair only if you trust it.';
|
|
180
|
+
|
|
149
181
|
// Why nearby pairing turned itself off, or what it last did.
|
|
150
182
|
const NEARBY_ENDED = {
|
|
151
183
|
paired: (ended) => `Paired with ${ended.name}; nearby pairing turned itself off.`,
|
|
@@ -8,13 +8,12 @@ const LOOPBACK = new Set(['127.0.0.1', '::1', '::ffff:127.0.0.1']);
|
|
|
8
8
|
export async function handlePeerControlRequest({ request, response, url, peer, readJson, sendJson, unavailableMessage }) {
|
|
9
9
|
if (!url.pathname.startsWith('/api/peer')) return false;
|
|
10
10
|
if (!peer) { sendJson(response, 404, { error: 'peer_unavailable', message: unavailableMessage }); return true; }
|
|
11
|
-
|
|
12
|
-
if (!LOOPBACK.has(request.socket?.remoteAddress) || !/^(127\.0\.0\.1|\[::1\])(:\d+)?$/.test(host)) {
|
|
11
|
+
if (!isLocalOwnerRequest(request)) {
|
|
13
12
|
sendJson(response, 403, { error: 'local_owner_only', message: 'LAN roundtable settings can only be changed on this computer' });
|
|
14
13
|
return true;
|
|
15
14
|
}
|
|
16
15
|
try {
|
|
17
|
-
const result = await route(request, url
|
|
16
|
+
const result = await route(request, url, peer, readJson);
|
|
18
17
|
if (result === undefined) return false;
|
|
19
18
|
sendJson(response, 200, result);
|
|
20
19
|
} catch (error) {
|
|
@@ -26,9 +25,23 @@ export async function handlePeerControlRequest({ request, response, url, peer, r
|
|
|
26
25
|
return true;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
// A request from this computer's own loopback address naming a loopback Host:
|
|
29
|
+
// what every owner-only LAN roundtable page answers, including who visited it.
|
|
30
|
+
export function isLocalOwnerRequest(request) {
|
|
31
|
+
return LOOPBACK.has(request.socket?.remoteAddress)
|
|
32
|
+
&& /^(127\.0\.0\.1|\[::1\])(:\d+)?$/.test(String(request.headers?.host ?? ''));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function route(request, url, peer, readJson) {
|
|
30
36
|
const { method } = request;
|
|
37
|
+
const { pathname } = url;
|
|
31
38
|
if (pathname === '/api/peer' && method === 'GET') return peer.status();
|
|
39
|
+
if (pathname === '/api/peer/shareable' && method === 'GET') {
|
|
40
|
+
const limit = url.searchParams.get('limit');
|
|
41
|
+
return peer.searchShareable({ query: url.searchParams.get('query') ?? '', ...(limit ? { limit: Number(limit) } : {}) });
|
|
42
|
+
}
|
|
43
|
+
const shareable = /^\/api\/peer\/shareable\/([^/]+)$/.exec(pathname);
|
|
44
|
+
if (shareable && method === 'GET') return peer.shareableProject(projectIdOf(shareable[1]));
|
|
32
45
|
if (pathname === '/api/peer/coordinator' && method === 'POST') {
|
|
33
46
|
const body = await readJson(request);
|
|
34
47
|
return peer.enableCoordinator({ host: body.host, port: body.port ?? 0, name: body.name });
|
|
@@ -53,9 +66,15 @@ async function route(request, pathname, peer, readJson) {
|
|
|
53
66
|
if (pathname === '/api/peer/nearby/pair' && method === 'POST') return peer.pairNearby({ fingerprint: (await readJson(request)).fingerprint });
|
|
54
67
|
if (pathname === '/api/peer/nearby/confirm' && method === 'POST') {
|
|
55
68
|
const body = await readJson(request);
|
|
56
|
-
return peer.confirmPairing({ requestId: body.requestId, code: body.code
|
|
69
|
+
return peer.confirmPairing({ requestId: body.requestId, code: body.code,
|
|
70
|
+
...(body.fingerprint === undefined ? {} : { fingerprint: body.fingerprint }) });
|
|
57
71
|
}
|
|
58
72
|
if (pathname === '/api/peer/nearby/cancel' && method === 'POST') { await readJson(request); return peer.cancelPairing(); }
|
|
59
73
|
if (pathname === '/api/peer/nearby/attempts/clear' && method === 'POST') { await readJson(request); return peer.clearPairingAttempts(); }
|
|
60
74
|
return undefined;
|
|
61
75
|
}
|
|
76
|
+
|
|
77
|
+
function projectIdOf(segment) {
|
|
78
|
+
try { return decodeURIComponent(segment); }
|
|
79
|
+
catch { throw new PeerError('project_not_found', 'No project of this computer can be shared under that id', 404); }
|
|
80
|
+
}
|
|
@@ -4,10 +4,21 @@ import { certificateFingerprint, verifyDeviceSignature } from './device-identity
|
|
|
4
4
|
import { isAuthorityKey } from './origin-proof.js';
|
|
5
5
|
import { createCoordinatorChat } from './chat-coordinator.js';
|
|
6
6
|
import {
|
|
7
|
-
canonicalJson, encodeInvitation, PEER_LIMITS, PeerError, peerCleanup, pemToDer, publicDirectoryEntry,
|
|
8
|
-
graphemePrefix, RESULT_OUTCOMES, sha256Hex, TERMINAL_STATUSES, validateAssertion, withoutControls,
|
|
7
|
+
canonicalJson, encodeInvitation, PEER_LIMITS, PEER_QUERY_PROTOCOL, PeerError, peerCleanup, peerMessageKey, pemToDer, publicDirectoryEntry,
|
|
8
|
+
graphemePrefix, RESULT_OUTCOMES, sha256Hex, TERMINAL_STATUSES, validateAssertion, validateQuery, withoutControls,
|
|
9
9
|
} from './protocol.js';
|
|
10
10
|
|
|
11
|
+
// What the queue holds: messages that may wake a lead, and visitors' read-only
|
|
12
|
+
// queries, each with its own validation, per-device queue cap and answer size.
|
|
13
|
+
const KINDS = Object.freeze({
|
|
14
|
+
message: { validate: validateAssertion, queueCap: PEER_LIMITS.queuePerNode, replyBytes: Infinity },
|
|
15
|
+
query: { validate: validateQuery, queueCap: PEER_LIMITS.queryQueuePerNode, senderCap: PEER_LIMITS.queryQueuePerSender,
|
|
16
|
+
replyBytes: PEER_LIMITS.queryReplyBytes },
|
|
17
|
+
});
|
|
18
|
+
// Queries claimed in a row while a message waits, at most; then a message goes.
|
|
19
|
+
const QUERY_STREAK = 3;
|
|
20
|
+
const kindOf = (message) => (JSON.parse(message.assertion_json).protocol === PEER_QUERY_PROTOCOL ? KINDS.query : KINDS.message);
|
|
21
|
+
|
|
11
22
|
const ONLINE_MS = 90_000;
|
|
12
23
|
// last_seen_at only feeds the "online" flag of directory() and devices(); no trust,
|
|
13
24
|
// revocation or claim decision reads it. A connected device re-authenticates on every
|
|
@@ -29,10 +40,12 @@ const DAY_MS = 24 * 60 * 60_000;
|
|
|
29
40
|
// Routes messages between paired devices. It never executes anything: each
|
|
30
41
|
// receiving device re-checks its own shares and identity authority.
|
|
31
42
|
export function createCoordinatorService({ store, identity, authority, name, clock = Date.now,
|
|
32
|
-
randomCode = () => randomBytes(32).toString('base64url'), idFactory = randomUUID, onTrustChange = () => {},
|
|
43
|
+
randomCode = () => randomBytes(32).toString('base64url'), idFactory = randomUUID, onTrustChange = () => {}, onRevoked = () => {},
|
|
33
44
|
repositoryChanges = memoryRecord() }) {
|
|
34
45
|
const iso = (offsetMs = 0) => new Date(clock() + offsetMs).toISOString();
|
|
35
46
|
const pairingFailures = [];
|
|
47
|
+
// Per receiving device: how many queries were claimed in a row (claim order only, kept in memory).
|
|
48
|
+
const queryStreaks = new Map();
|
|
36
49
|
const repositories = new Map();
|
|
37
50
|
let repositoryKey = null;
|
|
38
51
|
rotateRepositoryKey();
|
|
@@ -111,16 +124,20 @@ export function createCoordinatorService({ store, identity, authority, name, clo
|
|
|
111
124
|
}
|
|
112
125
|
|
|
113
126
|
// Another device's digests never leave the coordinator: each device learns
|
|
114
|
-
// only which of its own digests another paired device also has
|
|
127
|
+
// only which of its own digests another paired device also has, and whether
|
|
128
|
+
// the coordinator holds a set under its current key (for itself and each other
|
|
129
|
+
// device), so an empty match can be told from digests not sent yet.
|
|
115
130
|
function directory(nodeId) {
|
|
116
131
|
const now = clock();
|
|
117
132
|
const mine = new Set(repositories.get(nodeId) ?? []);
|
|
118
|
-
return {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
return { ownRepositoriesKnown: repositories.has(nodeId),
|
|
134
|
+
devices: store.nodes().filter((node) => node.status === 'active' && node.id !== nodeId).map((node) => ({
|
|
135
|
+
nodeId: node.id, name: node.name,
|
|
136
|
+
online: seenWithin(node, now, ONLINE_MS),
|
|
137
|
+
agents: JSON.parse(node.directory_json),
|
|
138
|
+
sameRepositories: (repositories.get(node.id) ?? []).filter((digest) => mine.has(digest)),
|
|
139
|
+
repositoriesKnown: repositories.has(node.id),
|
|
140
|
+
})) };
|
|
124
141
|
}
|
|
125
142
|
|
|
126
143
|
// The same set again is free; a new set counts, and past the daily limit the earlier set stays.
|
|
@@ -147,7 +164,8 @@ export function createCoordinatorService({ store, identity, authority, name, clo
|
|
|
147
164
|
}
|
|
148
165
|
|
|
149
166
|
function submit(nodeId, { assertion, signature }) {
|
|
150
|
-
|
|
167
|
+
const kind = assertion?.protocol === PEER_QUERY_PROTOCOL ? KINDS.query : KINDS.message;
|
|
168
|
+
kind.validate(assertion, { now: clock() });
|
|
151
169
|
if (assertion.from.node !== nodeId) throw new PeerError('sender_mismatch', 'The message sender is not this device', 403);
|
|
152
170
|
const sender = store.node(nodeId);
|
|
153
171
|
if (!verifyDeviceSignature(sender.cert_pem, assertion, signature)) throw new PeerError('invalid_signature', 'The message signature is invalid', 403);
|
|
@@ -158,7 +176,7 @@ export function createCoordinatorService({ store, identity, authority, name, clo
|
|
|
158
176
|
if (!shared) throw new PeerError('agent_not_shared', 'That Agent is not shared by the receiving device', 404);
|
|
159
177
|
const assertionJson = canonicalJson(assertion);
|
|
160
178
|
return store.transaction(() => {
|
|
161
|
-
const key =
|
|
179
|
+
const key = peerMessageKey(nodeId, assertion.messageId);
|
|
162
180
|
const existing = store.message(key);
|
|
163
181
|
if (existing) {
|
|
164
182
|
if (existing.assertion_json !== assertionJson) {
|
|
@@ -167,7 +185,10 @@ export function createCoordinatorService({ store, identity, authority, name, clo
|
|
|
167
185
|
return statusView(existing);
|
|
168
186
|
}
|
|
169
187
|
chat.validateWake(assertion);
|
|
170
|
-
if (store.queuedCount(target.id) >=
|
|
188
|
+
if (store.queuedCount(target.id, assertion.protocol) >= kind.queueCap
|
|
189
|
+
|| (kind.senderCap && store.queuedCount(target.id, assertion.protocol, nodeId) >= kind.senderCap)) {
|
|
190
|
+
throw new PeerError('queue_full', 'The receiving device has too many waiting messages', 429);
|
|
191
|
+
}
|
|
171
192
|
store.insertMessage({ id: key, senderNode: nodeId, targetNode: target.id,
|
|
172
193
|
bindingId: assertion.to.bindingId, assertionJson, signature, expiresAt: assertion.expiresAt, at: iso() });
|
|
173
194
|
return statusView(store.message(key));
|
|
@@ -176,8 +197,10 @@ export function createCoordinatorService({ store, identity, authority, name, clo
|
|
|
176
197
|
|
|
177
198
|
function claim(nodeId) {
|
|
178
199
|
return store.transaction(() => {
|
|
179
|
-
|
|
200
|
+
// Queries first, but never more than QUERY_STREAK in a row while a message waits.
|
|
201
|
+
const next = store.nextQueued(nodeId, iso(), (queryStreaks.get(nodeId) ?? 0) >= QUERY_STREAK ? 'message' : 'query');
|
|
180
202
|
if (!next) return null;
|
|
203
|
+
queryStreaks.set(nodeId, kindOf(next) === KINDS.query ? (queryStreaks.get(nodeId) ?? 0) + 1 : 0);
|
|
181
204
|
try { chat.validateWake(JSON.parse(next.assertion_json)); }
|
|
182
205
|
catch (error) {
|
|
183
206
|
store.updateMessage(next.id, { status: 'failed', error: error.code ?? 'chat_wake_rejected' }, iso(), 'failed');
|
|
@@ -228,6 +251,9 @@ export function createCoordinatorService({ store, identity, authority, name, clo
|
|
|
228
251
|
}
|
|
229
252
|
return store.transaction(() => {
|
|
230
253
|
const message = currentAttempt(nodeId, messageId, attemptId);
|
|
254
|
+
if (outcome === 'answered' && Buffer.byteLength(reply) > kindOf(message).replyBytes) {
|
|
255
|
+
throw new PeerError('invalid_result', 'The answer is larger than this kind of ask allows');
|
|
256
|
+
}
|
|
231
257
|
if (TERMINAL_STATUSES.has(message.status) && message.status !== 'unknown') return statusView(message);
|
|
232
258
|
const detail = typeof error === 'string' ? error.slice(0, 120) : null;
|
|
233
259
|
if (outcome === 'never_started') {
|
|
@@ -256,7 +282,7 @@ export function createCoordinatorService({ store, identity, authority, name, clo
|
|
|
256
282
|
|
|
257
283
|
function addressed(nodeId, messageId) {
|
|
258
284
|
if (typeof messageId !== 'string' || messageId.length > 128) return null;
|
|
259
|
-
const sent = store.message(
|
|
285
|
+
const sent = store.message(peerMessageKey(nodeId, messageId));
|
|
260
286
|
if (sent) return sent;
|
|
261
287
|
const received = store.message(messageId);
|
|
262
288
|
return received?.target_node === nodeId ? received : null;
|
|
@@ -272,7 +298,7 @@ export function createCoordinatorService({ store, identity, authority, name, clo
|
|
|
272
298
|
|
|
273
299
|
function cancel(nodeId, { messageId }) {
|
|
274
300
|
return store.transaction(() => {
|
|
275
|
-
const message = typeof messageId === 'string' ? store.message(
|
|
301
|
+
const message = typeof messageId === 'string' ? store.message(peerMessageKey(nodeId, messageId)) : null;
|
|
276
302
|
if (!message) throw new PeerError('message_not_found', 'No such message sent by this device', 404);
|
|
277
303
|
if (message.status === 'queued') store.updateMessage(message.id, { status: 'cancelled', error: 'cancelled' }, iso(), 'cancelled');
|
|
278
304
|
else if (['claimed', 'running'].includes(message.status)) store.updateMessage(message.id, { cancel_requested: 1 }, iso(), 'cancel_requested');
|
|
@@ -291,6 +317,8 @@ export function createCoordinatorService({ store, identity, authority, name, clo
|
|
|
291
317
|
});
|
|
292
318
|
rotateRepositoryKey();
|
|
293
319
|
onTrustChange();
|
|
320
|
+
// Also when the device itself left (POST /peer/1/leave): the host ends what it kept for that device.
|
|
321
|
+
onRevoked(nodeId);
|
|
294
322
|
return { revoked: true };
|
|
295
323
|
}
|
|
296
324
|
|
|
@@ -337,11 +365,6 @@ function seenWithin(node, now, windowMs) {
|
|
|
337
365
|
return age >= 0 && age < windowMs;
|
|
338
366
|
}
|
|
339
367
|
|
|
340
|
-
// Message IDs are chosen by senders, so the coordinator keys them per sending device.
|
|
341
|
-
function messageKey(senderNode, messageId) {
|
|
342
|
-
return sha256Hex(`${senderNode}:${messageId}`);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
368
|
function statusView(message) {
|
|
346
369
|
return { messageId: JSON.parse(message.assertion_json).messageId, status: message.status, reply: message.reply ?? null, error: message.error ?? null,
|
|
347
370
|
via: message.via ?? null, verified: message.verified === 1, updatedAt: message.updated_at,
|
|
@@ -91,13 +91,20 @@ export function createCoordinatorStore(path = ':memory:') {
|
|
|
91
91
|
event(row.at, { messageId: row.id, nodeId: row.senderNode, kind: 'queued' });
|
|
92
92
|
},
|
|
93
93
|
message: (id) => database.prepare('SELECT * FROM messages WHERE id = ?').get(id) ?? null,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
// Open messages of one protocol for one device, optionally from one sender:
|
|
95
|
+
// messages and queries have separate caps, and queries one per sender too.
|
|
96
|
+
queuedCount: (targetNode, protocol, senderNode = null) => database.prepare(
|
|
97
|
+
`SELECT count(*) AS count FROM messages WHERE target_node = ? AND status IN ('queued','claimed','running')
|
|
98
|
+
AND json_extract(assertion_json, '$.protocol') = ? AND (? IS NULL OR sender_node = ?)`)
|
|
99
|
+
.get(targetNode, protocol, senderNode, senderNode).count,
|
|
100
|
+
// The oldest waiting entry, of the kind first (query or message) when one of
|
|
101
|
+
// that kind waits; the coordinator decides which kind goes first.
|
|
102
|
+
nextQueued: (targetNode, at, first) => database.prepare(`SELECT q.* FROM messages q WHERE q.target_node = ? AND q.status = 'queued'
|
|
97
103
|
AND q.expires_at > ? AND q.cancel_requested = 0 AND (json_type(q.assertion_json,'$.chatWake') IS NULL OR NOT EXISTS (SELECT 1 FROM messages a
|
|
98
104
|
WHERE a.target_node=q.target_node AND json_extract(a.assertion_json,'$.to.agentId')=json_extract(q.assertion_json,'$.to.agentId')
|
|
99
105
|
AND (a.status IN ('claimed','running','unknown') OR a.cleanup_status='unconfirmed')))
|
|
100
|
-
ORDER BY q.
|
|
106
|
+
ORDER BY (json_extract(q.assertion_json, '$.protocol') = 'peer-query/1') = ? DESC, q.created_at LIMIT 1`)
|
|
107
|
+
.get(targetNode, at, first === 'query' ? 1 : 0) ?? null,
|
|
101
108
|
updateMessage(id, changes, at, kind, detail = null) {
|
|
102
109
|
const columns = Object.keys(changes);
|
|
103
110
|
database.prepare(`UPDATE messages SET ${columns.map((column) => `${column} = ?`).join(', ')}, updated_at = ? WHERE id = ?`)
|
|
@@ -16,6 +16,17 @@ export function announcedAddresses(interfaces) {
|
|
|
16
16
|
return (physical.length ? physical : all).map((entry) => entry.address);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// One address per physical adapter, where nearby discovery sends and listens:
|
|
20
|
+
// an adapter joins the multicast group once however many addresses it has.
|
|
21
|
+
export function discoveryAdapters(interfaces) {
|
|
22
|
+
return Object.entries(interfaces()).flatMap(([name, list]) => {
|
|
23
|
+
if (VIRTUAL_ADAPTER.test(name)) return [];
|
|
24
|
+
// 169.254/16 is what an adapter gives itself when it has no network.
|
|
25
|
+
const first = (list ?? []).find((entry) => lanIPv4(entry) && !entry.address.startsWith('169.254.'));
|
|
26
|
+
return first ? [first.address] : [];
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
19
30
|
// Addresses of virtual and VPN adapters, where nearby pairing does not answer.
|
|
20
31
|
export function virtualAddresses(interfaces) {
|
|
21
32
|
return classified(interfaces).filter((entry) => entry.virtual).map((entry) => entry.address);
|
|
@@ -23,6 +34,10 @@ export function virtualAddresses(interfaces) {
|
|
|
23
34
|
|
|
24
35
|
function classified(interfaces) {
|
|
25
36
|
return Object.entries(interfaces()).flatMap(([name, list]) => (list ?? [])
|
|
26
|
-
.filter(
|
|
37
|
+
.filter(lanIPv4)
|
|
27
38
|
.map((entry) => ({ address: entry.address, virtual: VIRTUAL_ADAPTER.test(name) })));
|
|
28
39
|
}
|
|
40
|
+
|
|
41
|
+
function lanIPv4(entry) {
|
|
42
|
+
return Boolean(entry) && !entry.internal && (entry.family === 'IPv4' || entry.family === 4);
|
|
43
|
+
}
|
|
@@ -6,62 +6,123 @@ export const NEARBY_SERVICE_TYPE = 'fuli-peer';
|
|
|
6
6
|
// JavaScript). Nothing binds the multicast socket until something is
|
|
7
7
|
// advertised or browsed, so a FULI with nearby pairing off sends nothing.
|
|
8
8
|
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
// One mDNS endpoint per physical LAN adapter (`adapters()`): left to itself the
|
|
10
|
+
// library sends from whichever adapter the system prefers, and a VPN or a
|
|
11
|
+
// virtual-machine adapter with a better metric then takes every query and
|
|
12
|
+
// announcement while the real LAN hears nothing. Each endpoint joins and sends
|
|
13
|
+
// on its adapter but binds every address: macOS and Linux deliver multicast
|
|
14
|
+
// only to a socket bound that way. With no physical adapter there is one
|
|
15
|
+
// endpoint on the system's default. The adapters are read again at each
|
|
16
|
+
// refresh, so a computer that changed network is found again.
|
|
17
|
+
//
|
|
18
|
+
// A multicast socket that fails (UDP 5353 taken or not allowed) is an 'error'
|
|
19
|
+
// event that would end the process. That endpoint is dropped; when none is
|
|
20
|
+
// left the error goes to onFailure and the caller turns nearby pairing off.
|
|
21
|
+
// Sending into a network that went away (an interface down, sleep and wake) is
|
|
22
|
+
// only a warning; mDNS retries itself.
|
|
23
|
+
export function createBonjourDiscovery({ onFailure = () => {}, options = undefined, adapters = () => [],
|
|
24
|
+
create = (target) => new Bonjour(target, () => {}) } = {}) {
|
|
25
|
+
let endpoints = null;
|
|
26
|
+
let opened = '';
|
|
27
|
+
let advert = null;
|
|
28
|
+
let watch = null;
|
|
29
|
+
|
|
30
|
+
const targets = () => (options ? [options] : adapters().map((address) => ({ interface: address, bind: '0.0.0.0' })));
|
|
31
|
+
const open = () => {
|
|
32
|
+
if (endpoints) return endpoints;
|
|
33
|
+
const wanted = targets();
|
|
34
|
+
const created = (wanted.length ? wanted : [undefined]).map((target) => ({ bonjour: create(target), service: null, browser: null }));
|
|
35
|
+
for (const endpoint of created) {
|
|
36
|
+
const mdns = endpoint.bonjour.server?.mdns;
|
|
37
|
+
mdns?.on('error', (error) => {
|
|
38
|
+
if (endpoints !== created || !created.includes(endpoint)) return;
|
|
39
|
+
created.splice(created.indexOf(endpoint), 1);
|
|
40
|
+
quietly(() => endpoint.bonjour.destroy());
|
|
41
|
+
if (created.length) return;
|
|
42
|
+
endpoints = null;
|
|
43
|
+
onFailure(error);
|
|
44
|
+
});
|
|
45
|
+
mdns?.on('warning', () => {});
|
|
46
|
+
}
|
|
47
|
+
endpoints = created;
|
|
48
|
+
opened = JSON.stringify(wanted);
|
|
26
49
|
return created;
|
|
27
50
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
51
|
+
const shut = () => {
|
|
52
|
+
const current = endpoints ?? [];
|
|
53
|
+
endpoints = null;
|
|
54
|
+
for (const endpoint of current) quietly(() => endpoint.bonjour.destroy());
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// The address filter is installed right after publish: the library first
|
|
58
|
+
// asks the network whether the name is taken and only then reads the records.
|
|
59
|
+
// Every endpoint has its own instance name, so two adapters on one LAN (wired
|
|
60
|
+
// and Wi-Fi) never take each other for a name already in use.
|
|
61
|
+
const publish = () => {
|
|
62
|
+
if (!advert) return;
|
|
63
|
+
open().forEach((endpoint, index) => {
|
|
64
|
+
const suffix = index ? `-${index + 1}` : '';
|
|
65
|
+
const service = endpoint.bonjour.publish({ name: `${advert.name}${suffix}`, host: advert.host.replace(/(\.local)?$/, `${suffix}$1`),
|
|
66
|
+
port: advert.port, txt: advert.txt, type: NEARBY_SERVICE_TYPE, disableIPv6: true });
|
|
67
|
+
if (advert.addresses) {
|
|
68
|
+
const allowed = new Set(advert.addresses);
|
|
35
69
|
const records = service.records.bind(service);
|
|
36
70
|
service.records = () => records().filter((record) => record.type !== 'A' || allowed.has(record.data));
|
|
37
71
|
}
|
|
38
72
|
service.on?.('error', () => {});
|
|
39
|
-
|
|
73
|
+
endpoint.service = service;
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const unpublish = () => {
|
|
77
|
+
for (const endpoint of endpoints ?? []) { const { service } = endpoint; endpoint.service = null; quietly(() => service?.stop?.()); }
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// The addresses the computer announces (its physical LAN ones) come before
|
|
81
|
+
// the one its packet arrived from, which may be a virtual adapter.
|
|
82
|
+
const view = (service) => ({ name: service.name, port: service.port, txt: service.txt ?? {},
|
|
83
|
+
addresses: [...(service.addresses ?? []), service.referer?.address].filter(Boolean) });
|
|
84
|
+
const look = () => {
|
|
85
|
+
if (!watch) return;
|
|
86
|
+
for (const endpoint of open()) {
|
|
87
|
+
const browser = endpoint.bonjour.find({ type: NEARBY_SERVICE_TYPE });
|
|
88
|
+
browser.on('up', (service) => watch.onUp(view(service)));
|
|
89
|
+
browser.on('txt-update', (service) => watch.onUp(view(service)));
|
|
90
|
+
browser.on('srv-update', (service) => watch.onUp(view(service)));
|
|
91
|
+
browser.on('down', (service) => watch.onDown(view(service)));
|
|
92
|
+
endpoint.browser = browser;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const unlook = () => {
|
|
96
|
+
for (const endpoint of endpoints ?? []) { const { browser } = endpoint; endpoint.browser = null; quietly(() => browser?.stop()); }
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
// addresses: the only IPv4 addresses announced for this computer (others
|
|
101
|
+
// such as virtual adapters are left out); null announces every one.
|
|
102
|
+
advertise({ name, host, port, txt, addresses = null }) {
|
|
103
|
+
unpublish();
|
|
104
|
+
advert = { name, host, port, txt, addresses };
|
|
105
|
+
publish();
|
|
106
|
+
return { stop: () => { advert = null; unpublish(); } };
|
|
40
107
|
},
|
|
41
108
|
browse({ onUp, onDown }) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// before the one its packet arrived from, which may be a virtual adapter.
|
|
45
|
-
const view = (service) => ({ name: service.name, port: service.port, txt: service.txt ?? {},
|
|
46
|
-
addresses: [...(service.addresses ?? []), service.referer?.address].filter(Boolean) });
|
|
47
|
-
const start = () => {
|
|
48
|
-
browser = instance().find({ type: NEARBY_SERVICE_TYPE });
|
|
49
|
-
browser.on('up', (service) => onUp(view(service)));
|
|
50
|
-
browser.on('txt-update', (service) => onUp(view(service)));
|
|
51
|
-
browser.on('srv-update', (service) => onUp(view(service)));
|
|
52
|
-
browser.on('down', (service) => onDown(view(service)));
|
|
53
|
-
};
|
|
54
|
-
start();
|
|
109
|
+
watch = { onUp, onDown };
|
|
110
|
+
look();
|
|
55
111
|
return {
|
|
56
|
-
stop: () =>
|
|
57
|
-
//
|
|
58
|
-
|
|
112
|
+
stop: () => { watch = null; unlook(); },
|
|
113
|
+
// Fresh browsers ask again, so every computer still there answers
|
|
114
|
+
// anew; on adapters that changed, everything starts over.
|
|
115
|
+
refresh: () => quietly(() => {
|
|
116
|
+
if (endpoints && JSON.stringify(targets()) !== opened) { shut(); publish(); }
|
|
117
|
+
else unlook();
|
|
118
|
+
look();
|
|
119
|
+
}),
|
|
59
120
|
};
|
|
60
121
|
},
|
|
61
122
|
close() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
123
|
+
advert = null;
|
|
124
|
+
watch = null;
|
|
125
|
+
shut();
|
|
65
126
|
},
|
|
66
127
|
};
|
|
67
128
|
}
|