fuli-context 0.25.2 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -3
- package/README.zh-CN.md +19 -4
- package/dist/web/assets/{AboutPage-Dx07_Z8u.js → AboutPage-BKyNoI0v.js} +1 -1
- package/dist/web/assets/{AboutSectionHeading-BdhpM609.js → AboutSectionHeading-DwvCvoqO.js} +1 -1
- package/dist/web/assets/AgentAppsPage-Cp2-sZXi.js +1 -0
- package/dist/web/assets/{AgentAvatar-DlAQP7gm.js → AgentAvatar-CDhU4m0T.js} +1 -1
- package/dist/web/assets/{AgentHand-FPFg9-Y1.js → AgentHand-BfRjs1He.js} +1 -1
- package/dist/web/assets/{AgentManagement-CLFw9oV9.css → AgentManagement-Cc00RLSO.css} +1 -1
- package/dist/web/assets/{AgentManagement-UTe4I3WA.js → AgentManagement-qCpr876m.js} +2 -2
- package/dist/web/assets/{AgentMentionCopy-C5ExlutT.js → AgentMentionCopy-_pr-D8vX.js} +1 -1
- package/dist/web/assets/{AgentName-C8mYbtKs.js → AgentName-CUuWNrzE.js} +1 -1
- package/dist/web/assets/{AgentProfilePage-DumsVHP1.css → AgentProfilePage-Ce25JSzZ.css} +1 -1
- package/dist/web/assets/AgentProfilePage-DcOBhuHG.js +5 -0
- package/dist/web/assets/AgentServicesPage-CAL-JT1J.js +1 -0
- package/dist/web/assets/{AppViewerPage-BR8ttEGa.js → AppViewerPage-Ct46NPXP.js} +1 -1
- package/dist/web/assets/{BackToTop-5_AQRMZl.js → BackToTop-DOlt-xjQ.js} +1 -1
- package/dist/web/assets/{BoardCardFieldsMenu-Bb_Z9a4Q.js → BoardCardFieldsMenu-RFcx_CAs.js} +1 -1
- package/dist/web/assets/{BoardMoveMenu-B-f8O6cC.js → BoardMoveMenu-GJ8lpuZY.js} +1 -1
- package/dist/web/assets/Breadcrumb-DTo6Zvtb.js +1 -0
- package/dist/web/assets/CaptureChangePage-DRgWyCRo.js +1 -0
- package/dist/web/assets/{CopyFixPrompt-CVFYWDSt.js → CopyFixPrompt-1UXH_ItZ.js} +1 -1
- package/dist/web/assets/DataFormatPage-CgFXfOW_.js +2 -0
- package/dist/web/assets/DebugTurnPage-B8YhpTPm.js +1 -0
- package/dist/web/assets/DebugTurnsPage-BGKSH3n0.js +1 -0
- package/dist/web/assets/{DialogTitle-BQXOe8EK.js → DialogTitle-CIVSlKqQ.js} +1 -1
- package/dist/web/assets/{EmployeeRedirectPage-BjWpXDSM.js → EmployeeRedirectPage-8qPpnbyP.js} +1 -1
- package/dist/web/assets/EmployeeScopeDialog-BZymZidB.js +1 -0
- package/dist/web/assets/EmployeeWorkbench-BnxEZCSS.js +4 -0
- package/dist/web/assets/FieldRoot-D6HtUgDA.js +1 -0
- package/dist/web/assets/{FlaGrowth-OQtTLTng.js → FlaGrowth-CaFdmezv.js} +1 -1
- package/dist/web/assets/{FlaOccupationKit-C-x4VrKk.js → FlaOccupationKit-CFoBUWGF.js} +1 -1
- package/dist/web/assets/{FlaTaskSheets-CoaF5CbQ.js → FlaTaskSheets-BShmW9R5.js} +1 -1
- package/dist/web/assets/FlasPage-DtkW-_9f.js +1 -0
- package/dist/web/assets/{GrowthLoading-VuVo2vLf.js → GrowthLoading-CVBn4r4q.js} +1 -1
- package/dist/web/assets/{HowtoPage-CZ3mOdLc.js → HowtoPage-B8f5J_An.js} +1 -1
- package/dist/web/assets/InboxPage-Bv8XUdl8.css +1 -0
- package/dist/web/assets/InboxPage-D9VIDrsL.js +6 -0
- package/dist/web/assets/{KnowledgeDeleteButton-BlUnSG3b.js → KnowledgeDeleteButton-C01O4FSO.js} +1 -1
- package/dist/web/assets/{KnowledgeHardDeleteSection-CznXBtHY.js → KnowledgeHardDeleteSection-jqad3dJN.js} +1 -1
- package/dist/web/assets/KnowledgeItemEditPage-DV8TVpvf.js +1 -0
- package/dist/web/assets/{KnowledgeItemSummaryCard-Co5JKBHl.js → KnowledgeItemSummaryCard-XbkYp7Dy.js} +1 -1
- package/dist/web/assets/KnowledgeOrganizerPage-C4G6JCmG.js +1 -0
- package/dist/web/assets/KnowledgePage-Afiw2Kxy.js +1 -0
- package/dist/web/assets/{KnowledgePeek-CwZVuSkf.css → KnowledgePeek-D6SeISIM.css} +1 -1
- package/dist/web/assets/KnowledgePeek-DIcPS9WU.js +1 -0
- package/dist/web/assets/{KnowledgeTurnReceiptPage-Csyjimeg.js → KnowledgeTurnReceiptPage-7ncXkxKd.js} +1 -1
- package/dist/web/assets/KnowledgeWorkspace-Be2gUul5.css +1 -0
- package/dist/web/assets/KnowledgeWorkspace-CmzU6Vuh.js +4 -0
- package/dist/web/assets/{MeAvatar-aY_q8cKs.js → MeAvatar-D_LFqHrR.js} +1 -1
- package/dist/web/assets/{MeLink-B0pNwVLa.js → MeLink-CeIxjFrm.js} +1 -1
- package/dist/web/assets/{MenuSeparator-BR-uLovR.js → MenuSeparator-yD3wld9s.js} +1 -1
- package/dist/web/assets/ModelSettingsPage-BZcyT7Vy.css +1 -0
- package/dist/web/assets/ModelSettingsPage-BqClsFmC.js +1 -0
- package/dist/web/assets/NewSessionPanel-BKrOFEMO.js +1 -0
- package/dist/web/assets/NewSessionPanel-CTdd7xpN.css +1 -0
- package/dist/web/assets/{NotFoundPage-Cr1MaPuk.js → NotFoundPage-CdOCRj3P.js} +1 -1
- package/dist/web/assets/NoticeRow-CQShZQtw.js +1 -0
- package/dist/web/assets/OccupationsPage-BrBus-nh.js +1 -0
- package/dist/web/assets/OverviewPage-Cq89Klha.js +1 -0
- package/dist/web/assets/{OverviewPage-Dr4jrXW4.css → OverviewPage-KVt4LcE-.css} +1 -1
- package/dist/web/assets/{PageColumns-DvehZlYm.js → PageColumns-CgIXTt4J.js} +1 -1
- package/dist/web/assets/PageOutline-D5h1GuKt.css +1 -0
- package/dist/web/assets/PageOutline-VtLLW4kh.js +1 -0
- package/dist/web/assets/{PersonalProfilePage-DnjNX2xK.css → PersonalProfilePage-BE5q2bqc.css} +1 -1
- package/dist/web/assets/PersonalProfilePage-C_dmUEuW.js +1 -0
- package/dist/web/assets/PersonalProjectsPage-CiCFHVt_.js +1 -0
- package/dist/web/assets/{PinIcon-BTQsnxRY.js → PinIcon-DD3Un-hh.js} +1 -1
- package/dist/web/assets/{PopperContent-DtMksk76.js → PopperContent-CCmt2yHl.js} +1 -1
- package/dist/web/assets/{Presence-B0zMpCF4.js → Presence-DqPb-1P1.js} +1 -1
- package/dist/web/assets/{ProfileAuthorChip-BqT9Vv65.js → ProfileAuthorChip-Dm5GjcAt.js} +1 -1
- package/dist/web/assets/ProjectAgentsPage-B5r0DKWL.js +5 -0
- package/dist/web/assets/ProjectJudgmentPolicy-BHyiqKLV.css +1 -0
- package/dist/web/assets/ProjectJudgmentPolicy-DVFV5Cai.js +2 -0
- package/dist/web/assets/{RecentNotices-vJobVOcm.js → RecentNotices-DYXEBfYm.js} +1 -1
- package/dist/web/assets/{RoundtablesPage-C3dYekQ5.js → RoundtablesPage-DlAXApKi.js} +2 -2
- package/dist/web/assets/{RovingFocusGroup-CUqyjFSs.js → RovingFocusGroup-CI4aZr1z.js} +1 -1
- package/dist/web/assets/{RovingFocusItem-CyyuWXjE.js → RovingFocusItem-C_N843Nb.js} +1 -1
- package/dist/web/assets/{SessionMigrationPage-DukDM0TP.js → SessionMigrationPage-CVKkTACn.js} +1 -1
- package/dist/web/assets/{SessionRecordsPage-DZ5ZBiuS.js → SessionRecordsPage-Dy203sP2.js} +1 -1
- package/dist/web/assets/SettingsPage-BcrAdXX7.js +1 -0
- package/dist/web/assets/SettingsPage-BlhCcwPn.css +1 -0
- package/dist/web/assets/SharedJefaReportPage-CASkC5pc.js +1 -0
- package/dist/web/assets/{TagVocabularyPage-BKLFJiSu.js → TagVocabularyPage-Bd57YcUL.js} +1 -1
- package/dist/web/assets/TaskBlockerClear-DGaXP2ak.js +1 -0
- package/dist/web/assets/TaskBlockerNotice-8nogmPA-.js +1 -0
- package/dist/web/assets/{TaskReason-D5j7L8tl.js → TaskReason-BxYwBDoB.js} +1 -1
- package/dist/web/assets/{TeamCard-CDunbIrP.js → TeamCard-cWYC5z07.js} +1 -1
- package/dist/web/assets/{TeamCardsWidget-CUW-fPn7.js → TeamCardsWidget-BOf6oHOp.js} +1 -1
- package/dist/web/assets/{TeamIsland-CmpDmIX2.js → TeamIsland-BD5s-zFZ.js} +1 -1
- package/dist/web/assets/{Teleport-Dzdr8umQ.js → Teleport-DhMmMHjy.js} +1 -1
- package/dist/web/assets/{TextField-BPhEpEv9.js → TextField-XakqTnVl.js} +1 -1
- package/dist/web/assets/TonborgDelegationSwitch-B59PUZBz.js +1 -0
- package/dist/web/assets/TonborgDelegationSwitch-BFb1JkWe.css +1 -0
- package/dist/web/assets/{UiChip-BEQ067LV.js → UiChip-BFdfq8Jm.js} +1 -1
- package/dist/web/assets/{UiChip-DulygSq8.css → UiChip-BiUmvjdz.css} +1 -1
- package/dist/web/assets/{UiDisclosure-L6GEJHSw.js → UiDisclosure-G3MiGB7F.js} +1 -1
- package/dist/web/assets/UiIcon--qI1_q89.js +1 -0
- package/dist/web/assets/UiSegmented-CRJ06vHP.js +1 -0
- package/dist/web/assets/{UiWeight-D-2iZ_Kc.js → UiWeight-BRA-6EY_.js} +1 -1
- package/dist/web/assets/{VirtualDirectoryList-BV8KsA-Z.js → VirtualDirectoryList-Dm07NMxq.js} +1 -1
- package/dist/web/assets/{VisuallyHidden-BxKxuXRF.js → VisuallyHidden-DIg8c_z2.js} +1 -1
- package/dist/web/assets/{VisuallyHiddenInput-DD4vhlqT.js → VisuallyHiddenInput-rcWqHewS.js} +1 -1
- package/dist/web/assets/WidgetSlot-C5h--noP.js +2 -0
- package/dist/web/assets/{WorkbenchListHead-B0TjHsTO.js → WorkbenchListHead-D40-J4GT.js} +1 -1
- package/dist/web/assets/WorkbenchListPage-CJUvq4Ac.js +1 -0
- package/dist/web/assets/_plugin-vue_export-helper-D9CtLGVz.js +9 -0
- package/dist/web/assets/{agent-apps-B1Je-mpY.js → agent-apps-Svxh5tiY.js} +1 -1
- package/dist/web/assets/agent-occupation-Dhoz7LjT.js +1 -0
- package/dist/web/assets/{agent-pins-DxHlJ96z.js → agent-pins-CvATgFji.js} +1 -1
- package/dist/web/assets/agent-profile-TuRobv9N.css +1 -0
- package/dist/web/assets/agent-roster-records-CsYjmaNn.js +1 -0
- package/dist/web/assets/{agent-work-summary-o_9-QWBL.js → agent-work-summary-BOeJ4JXc.js} +1 -1
- package/dist/web/assets/{agent-workflows-DgdbJqpg.js → agent-workflows-BS4KlKFj.js} +1 -1
- package/dist/web/assets/{attach-closest-edge-DUc_VUVO.js → attach-closest-edge-DFoBNGBU.js} +1 -1
- package/dist/web/assets/{attention-store-Bod20yM3.js → attention-store-CHxXJTuF.js} +1 -1
- package/dist/web/assets/{badge-tMy2Qr94.js → badge-DqHf-RNw.js} +1 -1
- package/dist/web/assets/{button-DnKFsImW.js → button-CdYobu4m.js} +1 -1
- package/dist/web/assets/{card-Ccu7HCNb.js → card-8xZot-73.js} +1 -1
- package/dist/web/assets/{catalog-CJUV8OJ6.js → catalog-h6KbvKdB.js} +1 -1
- package/dist/web/assets/{checkbox-D1R6kTUB.js → checkbox-DZ6CDZ8r.js} +1 -1
- package/dist/web/assets/{client-D-G2i5VU.js → client-DRnUmjCk.js} +1 -1
- package/dist/web/assets/{client-links-store-UgmraFBZ.js → client-links-store-DQY0A5PC.js} +1 -1
- package/dist/web/assets/{combobox-C7QLYGzs.js → combobox-DE0HzdKP.js} +1 -1
- package/dist/web/assets/console-BF8ZU9dG.js +1 -0
- package/dist/web/assets/conversation-launcher-settings-D4vYOpHN.js +1 -0
- package/dist/web/assets/{copy-mention-C0EJhDPy.js → copy-mention-Crs0NIJB.js} +1 -1
- package/dist/web/assets/{dialog-Bbq93W68.js → dialog-Bg5NVU4Y.js} +1 -1
- package/dist/web/assets/{dist-PpsW5ZE3.js → dist--2DWcoU9.js} +1 -1
- package/dist/web/assets/{dist-Dd8yFhv6.js → dist-INkzWhVF.js} +1 -1
- package/dist/web/assets/{dropdown-menu-1fGUL0V3.js → dropdown-menu-C5Kf9x2y.js} +1 -1
- package/dist/web/assets/{field-DjVv_wIS.js → field-7G2bSNl5.js} +1 -1
- package/dist/web/assets/{format-bytes-BKq_E0Hs.js → format-bytes-Jj3-0UhP.js} +1 -1
- package/dist/web/assets/{hover-card-BO-929hq.js → hover-card-llxR7wrX.js} +1 -1
- package/dist/web/assets/index-C2o_v2mq.js +24 -0
- package/dist/web/assets/index-HRZACEmh.css +1 -0
- package/dist/web/assets/{input-DmwRmYO2.js → input-z5o2wIZC.js} +1 -1
- package/dist/web/assets/{label-BvwPUTS4.js → label-BtTrlS8e.js} +1 -1
- package/dist/web/assets/label-table-CuTFbFd3.js +1 -0
- package/dist/web/assets/{model-0TZRbkN2.js → model-BD6AfoOR.js} +1 -1
- package/dist/web/assets/model-BKg9fdsn.js +3 -0
- package/dist/web/assets/{model-BF_ZMPLi.js → model-BMd98Yux.js} +1 -1
- package/dist/web/assets/{model-CaR7VPg7.js → model-Bb0VtRJH.js} +1 -1
- package/dist/web/assets/{model-Tmn6HvL-.js → model-Bhyqm3my.js} +1 -1
- package/dist/web/assets/model-Big7Ppeu.js +1 -0
- package/dist/web/assets/{model-Dfe81jZT.js → model-CCaA3vRN.js} +1 -1
- package/dist/web/assets/{model-y7OUvtKz.js → model-CGfhtR6w.js} +1 -1
- package/dist/web/assets/{model-DpkZUZUL.js → model-Ejc2vysd.js} +1 -1
- package/dist/web/assets/{motion-C1fZrqmI.js → motion-Cw_hptY4.js} +1 -1
- package/dist/web/assets/{motion-mAmbRj_M.js → motion-pePEUhOt.js} +1 -1
- package/dist/web/assets/{motion-preference-Dz9S1bZa.js → motion-preference-DTwjqiJ8.js} +1 -1
- package/dist/web/assets/{occupation-catalog-_SnxxRbK.js → occupation-catalog-ByjQk0EY.js} +1 -1
- package/dist/web/assets/{occupation-kits-DFC6Auuc.js → occupation-kits-Dg6UZqc1.js} +1 -1
- package/dist/web/assets/{option-DC8frdbr.js → option-BIjYeAh2.js} +1 -1
- package/dist/web/assets/{orchestration-filters-UeiAHJqn.js → orchestration-filters-3AfjDoHQ.js} +1 -1
- package/dist/web/assets/overview-data-BIeNATEJ.js +1 -0
- package/dist/web/assets/{page-refresh-DdRJaxMv.js → page-refresh-BTqRX45n.js} +1 -1
- package/dist/web/assets/{page-title-Cm9u_qw1.js → page-title-B5RyNTPD.js} +1 -1
- package/dist/web/assets/{person-profile-BH2AzOfw.js → person-profile-BzPwdtix.js} +1 -1
- package/dist/web/assets/{popover-DW__YCSE.js → popover-BsWyCEy5.js} +1 -1
- package/dist/web/assets/popup-host-DWJ1gygp.js +1 -0
- package/dist/web/assets/{profile-model-DtISOJ-X.js → profile-model-TAsyybji.js} +1 -1
- package/dist/web/assets/{project-board-layout-CTM8kAgq.js → project-board-layout-BwyHItDc.js} +1 -1
- package/dist/web/assets/{project-capture-B3pNhpFF.js → project-capture-I8-7JwsK.js} +1 -1
- package/dist/web/assets/{project-origin-BO8Ngccf.js → project-origin-B_Ku288r.js} +1 -1
- package/dist/web/assets/{quick-edit-api-B169r5Qb.js → quick-edit-api-Cm-W3ZVP.js} +1 -1
- package/dist/web/assets/{radio-group-DqA46cXQ.js → radio-group-DJ5np5d_.js} +1 -1
- package/dist/web/assets/review-api-Gwr5nP1B.js +1 -0
- package/dist/web/assets/{review-list-BbV-Mle7.js → review-list-CNeXKjBw.js} +1 -1
- package/dist/web/assets/review-store-BaMwO51r.js +1 -0
- package/dist/web/assets/{role-names-By0xdfTn.js → role-names-C-F0XIE1.js} +1 -1
- package/dist/web/assets/{roundtable-live-u9qUU6aA.js → roundtable-live-CM4Cqw2v.js} +1 -1
- package/dist/web/assets/{runtime-dom.esm-bundler-DhFy4Djs.js → runtime-dom.esm-bundler-tA5o2TEo.js} +1 -1
- package/dist/web/assets/{select-TqPBladU.js → select-DJ7iyJ-X.js} +1 -1
- package/dist/web/assets/{session-launch-offers-CtQeY4Qk.js → session-launch-offers-CEdCRTz9.js} +1 -1
- package/dist/web/assets/{settings-autosave-C7vW3_SP.js → settings-autosave-D3wBf_zN.js} +1 -1
- package/dist/web/assets/settings-tabs-B9pCaEFP.js +1 -0
- package/dist/web/assets/{npm-copies-GRyMAduA.css → settings-tabs-C9VDs91j.css} +1 -1
- package/dist/web/assets/shared-report-KyuP8oQk.js +3 -0
- package/dist/web/assets/source-adapters-BR-AAGhD.js +1 -0
- package/dist/web/assets/{switch-D7w_0h3m.js → switch-BoOtTu6O.js} +1 -1
- package/dist/web/assets/{tabs-DR8k0PN9.js → tabs-D0TAS18R.js} +1 -1
- package/dist/web/assets/{task-card-fields-X1ZYCm_j.js → task-card-fields-BWlLtcKE.js} +1 -1
- package/dist/web/assets/task-evidence-DydhKn9x.js +1 -0
- package/dist/web/assets/{task-labels-LuXoQhF9.js → task-labels-BrNKooHK.js} +1 -1
- package/dist/web/assets/{task-reason-ChpbGtyx.js → task-reason-CvmaNQWE.js} +1 -1
- package/dist/web/assets/{team-sheets-DYCQqa8I.js → team-sheets-DkAuebg6.js} +1 -1
- package/dist/web/assets/{textarea-D53VYanK.js → textarea-BQnuJ0v3.js} +1 -1
- package/dist/web/assets/ui-CJiEsCpv.js +1 -0
- package/dist/web/assets/ui-CgwSWg1F.css +1 -0
- package/dist/web/assets/{useAgentRecords-Hy9nqMs7.js → useAgentRecords-PysQYF4V.js} +1 -1
- package/dist/web/assets/{useAgentWorkSummary-mloD4p12.js → useAgentWorkSummary-DaNyOo2z.js} +1 -1
- package/dist/web/assets/{useApi-CROJJdhE-DnUGUb8O.js → useApi-CROJJdhE-CgPyy2pi.js} +1 -1
- package/dist/web/assets/{useClipboardCopy-BTuQMeWI.js → useClipboardCopy-Cf3GZrHC.js} +1 -1
- package/dist/web/assets/{useFocusReturn-4hUmSzj9.js → useFocusReturn-uY18_eDg.js} +1 -1
- package/dist/web/assets/{useForwardExpose-BDmW7q7u.js → useForwardExpose-Ci_aBJDg.js} +1 -1
- package/dist/web/assets/{useForwardPropsEmits-BzT2luD4.js → useForwardPropsEmits-mGaDeNMp.js} +1 -1
- package/dist/web/assets/useForwardScopeId-DYW8CZTp.js +1 -0
- package/dist/web/assets/{useKnowledgeConfirm-L8wnJCuX.js → useKnowledgeConfirm-PcqqgwNU.js} +1 -1
- package/dist/web/assets/{useKnowledgeItemPeek-C_huXt6E.js → useKnowledgeItemPeek-yjyrSFtf.js} +1 -1
- package/dist/web/assets/{useMinimumLoadingDisplay-Dkl8NQru.js → useMinimumLoadingDisplay-Bu6xyHby.js} +1 -1
- package/dist/web/assets/{usePageTools-CbDOdIrg.js → usePageTools-DYi9x7HJ.js} +1 -1
- package/dist/web/assets/usePrimitiveElement-DdC34jzt.js +1 -0
- package/dist/web/assets/{useProjectAgentRoster-BBmRvcgr.js → useProjectAgentRoster-KPwWl2jE.js} +1 -1
- package/dist/web/assets/{useRoutePeek-CRbCDqsm.js → useRoutePeek-BiHDBRKc.js} +1 -1
- package/dist/web/assets/useTeamPeople-Od3dDz6d.js +1 -0
- package/dist/web/assets/{useTeamWork-CXEQwF4n.js → useTeamWork-CDKVZwYe.js} +1 -1
- package/dist/web/assets/{useTypeahead-CVYuxPOD.js → useTypeahead-D_Z5P9Xm.js} +1 -1
- package/dist/web/assets/{utils-BsGjKHV8.js → utils-CAAvfQSj.js} +1 -1
- package/dist/web/assets/{utils-BnrWDlfm.js → utils-D6RjkXrh.js} +1 -1
- package/dist/web/assets/{verification-DbCo_dnY.js → verification-DoN2EFaZ.js} +1 -1
- package/dist/web/assets/version-DbJq2Cfv.js +1 -0
- package/dist/web/assets/{vue-router-D4_ms6om.js → vue-router-BwoPnYha.js} +1 -1
- package/dist/web/index.html +80 -87
- package/docs/agent-conversations-and-collaboration.md +6 -0
- package/docs/agent-interface-architecture.md +4 -1
- package/docs/agent-roundtable.md +45 -3
- package/docs/client-connections.md +29 -5
- package/docs/employee-agents.md +1 -1
- package/docs/external-knowledge-architecture.md +8 -3
- package/docs/judgment-and-autonomy.md +8 -4
- package/docs/project-agent-memory.md +12 -1
- package/graph-provider/fuli_graph/app.py +14 -234
- package/graph-provider/fuli_graph/auth.py +10 -0
- package/graph-provider/fuli_graph/builtin_embedding.py +388 -0
- package/graph-provider/fuli_graph/builtin_embedding_routes.py +53 -0
- package/graph-provider/fuli_graph/client_coverage.py +2 -2
- package/graph-provider/fuli_graph/config.py +3 -0
- package/graph-provider/fuli_graph/knowledge_duplicates.py +27 -15
- package/graph-provider/fuli_graph/knowledge_index_scan.py +13 -6
- package/graph-provider/fuli_graph/knowledge_search.py +142 -77
- package/graph-provider/fuli_graph/knowledge_semantic.py +47 -11
- package/graph-provider/fuli_graph/knowledge_semantic_index.py +5 -3
- package/graph-provider/fuli_graph/knowledge_tags.py +5 -10
- package/graph-provider/fuli_graph/models.py +16 -81
- package/graph-provider/fuli_graph/personal_global_preference_models.py +0 -23
- package/graph-provider/fuli_graph/personal_global_preferences.py +5 -630
- package/graph-provider/fuli_graph/preference_conflicts.py +3 -1
- package/graph-provider/fuli_graph/preference_organizing.py +162 -0
- package/graph-provider/fuli_graph/project_agent_delegations.py +6 -1
- package/graph-provider/fuli_graph/project_agent_executor_models.py +0 -26
- package/graph-provider/fuli_graph/project_agent_models.py +1 -0
- package/graph-provider/fuli_graph/project_agent_routes.py +22 -27
- package/graph-provider/fuli_graph/project_agent_task_models.py +26 -20
- package/graph-provider/fuli_graph/project_agent_work_log.py +4 -2
- package/graph-provider/fuli_graph/project_knowledge.py +2 -1
- package/graph-provider/fuli_graph/retired_graph_labels.py +30 -0
- package/graph-provider/fuli_graph/store_identity.py +4 -16
- package/graph-provider/fuli_graph/store_project_agent_executor_learning.py +0 -7
- package/graph-provider/fuli_graph/store_project_agent_executor_routing.py +0 -2
- package/graph-provider/fuli_graph/store_project_agent_executors.py +0 -8
- package/graph-provider/fuli_graph/store_project_agent_task_activity.py +51 -11
- package/graph-provider/fuli_graph/store_project_agent_task_blockers.py +13 -6
- package/graph-provider/fuli_graph/store_project_agent_task_person_close.py +82 -0
- package/graph-provider/fuli_graph/store_project_agent_task_recruitment.py +1 -61
- package/graph-provider/fuli_graph/store_project_agent_tasks.py +18 -1
- package/graph-provider/fuli_graph/store_project_agents.py +1 -1
- package/graph-provider/fuli_graph/store_projects.py +0 -151
- package/graph-provider/fuli_graph/store_publication.py +1 -160
- package/graph-provider/fuli_graph/store_records.py +0 -43
- package/graph-provider/fuli_graph/store_task_contexts.py +10 -0
- package/graph-provider/fuli_graph/task_blocker.py +10 -0
- package/graph-provider/fuli_graph/task_checkpoint_amendment.py +77 -0
- package/graph-provider/fuli_graph/task_context_auto_close.py +1 -1
- package/graph-provider/fuli_graph/task_context_models.py +19 -0
- package/graph-provider/fuli_graph/task_context_routes.py +5 -1
- package/graph-provider/fuli_graph/workflow_candidate_models.py +1 -61
- package/graph-provider/fuli_graph/workflow_candidates.py +7 -446
- package/graph-provider/fuli_graph/workflow_observation_models.py +1 -1
- package/graph-provider/pyproject.toml +1 -1
- package/native/win32/fuli-win-helper.exe +0 -0
- package/npm-shrinkwrap.json +57 -9
- package/package.json +4 -4
- package/packages/roundtable/package.json +1 -0
- package/packages/roundtable/src/agents/claude-code/wake.js +4 -2
- package/packages/roundtable/src/agents/codex/wake.js +26 -2
- package/packages/roundtable/src/agents/session-log.js +29 -7
- package/packages/roundtable/src/host.js +7 -1
- package/packages/roundtable/src/peer/control-cli.js +75 -2
- package/packages/roundtable/src/peer/control.js +15 -1
- package/packages/roundtable/src/peer/coordinator-http.js +23 -2
- package/packages/roundtable/src/peer/coordinator-service.js +81 -9
- package/packages/roundtable/src/peer/coordinator-store.js +2 -1
- package/packages/roundtable/src/peer/lan-addresses.js +28 -0
- package/packages/roundtable/src/peer/nearby-attempts.js +73 -0
- package/packages/roundtable/src/peer/nearby-discovery.js +71 -0
- package/packages/roundtable/src/peer/nearby-pairing.js +422 -0
- package/packages/roundtable/src/peer/nearby-presence.js +93 -0
- package/packages/roundtable/src/peer/node-store.js +10 -0
- package/packages/roundtable/src/peer/peer-runtime.js +528 -70
- package/packages/roundtable/src/peer/peer-transport.js +58 -3
- package/packages/roundtable/src/peer/protocol.js +24 -1
- package/packages/roundtable/src/roundtable/chat-service.js +14 -3
- package/packages/roundtable/src/roundtable/chat.js +1 -0
- package/packages/roundtable/src/roundtable/delivery-state.js +2 -1
- package/packages/roundtable/src/roundtable/group-discussion-store.js +130 -5
- package/packages/roundtable/src/roundtable/group-discussion.js +596 -111
- package/packages/roundtable/src/roundtable/near-names.js +27 -0
- package/packages/roundtable/src/roundtable/reply-inbox.js +6 -2
- package/packages/roundtable/src/roundtable/service.js +191 -49
- package/packages/roundtable/src/roundtable/stand-in.js +64 -0
- package/packages/roundtable/src/roundtable/store.js +19 -7
- package/packages/roundtable/src/roundtable/wake-ladder.js +63 -0
- package/packages/roundtable/src/roundtable/wake.js +10 -1
- package/packages/roundtable/src/standalone/cli.js +1 -1
- package/packages/roundtable/src/standalone/mcp.js +0 -5
- package/packages/roundtable/src/standalone/serve.js +13 -0
- package/registry/embedding-models.json +208 -0
- package/skills/capturing-session-knowledge/SKILL.md +2 -2
- package/skills/capturing-session-knowledge/references/capture.md +15 -34
- package/skills/capturing-session-knowledge/references/coordination.md +67 -4
- package/skills/capturing-session-knowledge/references/retrieval.md +9 -13
- package/skills/grilling-project/SKILL.md +8 -53
- package/skills/grilling-project/agents/openai.yaml +2 -2
- package/skills/grilling-project/references/project-profile.md +18 -27
- package/skills/operating-fuli/SKILL.md +56 -11
- package/skills/operating-fuli/references/workflow-recipes.md +8 -4
- package/src/agent-apps/host-tools/catalog.js +2 -25
- package/src/agent-delegation/port.js +1 -1
- package/src/agent-delegation/refusals.js +12 -4
- package/src/agent-kits/client-detection.js +14 -4
- package/src/agent-kits/installer-manifest.js +16 -5
- package/src/agent-kits/pack-manifest.js +7 -2
- package/src/agent-kits/pins.js +6 -6
- package/src/agent-kits/session-clients.js +1 -0
- package/src/agent-kits/vendor/agent-installer/README.md +1 -1
- package/src/agent-roundtable/task-context.js +1 -1
- package/src/agent-roundtable/tools.js +7 -4
- package/src/agent-roundtable/turn-receipt.js +65 -0
- package/src/agent-tools/graph-definitions.js +4 -2
- package/src/agent-tools/graph-handlers.js +9 -46
- package/src/agent-tools/interface-catalog.js +20 -15
- package/src/agent-tools/interface-definitions.js +3 -9
- package/src/agent-tools/judgment-definitions.js +1 -1
- package/src/agent-tools/knowledge-curation-definitions.js +1 -63
- package/src/agent-tools/knowledge-definitions.js +11 -124
- package/src/agent-tools/project-agent-definitions.js +2 -2
- package/src/agent-tools/project-agent-tool-definitions.js +0 -16
- package/src/agent-tools/project-organizing-definitions.js +34 -0
- package/src/agent-tools/project-space-definitions.js +6 -83
- package/src/agent-tools/retired-tools.js +37 -0
- package/src/agent-tools/session-fuli-gate.js +6 -1
- package/src/agent-tools/task-entry-definitions.js +4 -3
- package/src/agent-tools/tonborg-question-definitions.js +3 -3
- package/src/agent-tools.js +5 -1
- package/src/agents/choice-answers.js +2 -1
- package/src/agents/claude-code/choice-answers.js +2 -24
- package/src/agents/claude-desktop/app-control.js +23 -0
- package/src/agents/client-apps.js +8 -0
- package/src/agents/codex/choice-answers.js +61 -0
- package/src/agents/codex/lifecycle-hook.js +6 -12
- package/src/agents/dsh/bundle.js +50 -0
- package/src/agents/dsh/lifecycle-hook.js +18 -0
- package/src/agents/dsh/plugin.js +111 -0
- package/src/agents/identity-receipt.js +22 -5
- package/src/agents/jsonl-tail.js +35 -0
- package/src/agents/native-session-env.js +7 -0
- package/src/agents/opencode/lifecycle-hook.js +9 -174
- package/src/agents/opencode/plugin-file.js +7 -29
- package/src/agents/opencode/plugin.js +3 -76
- package/src/agents/plugin-hook-process.js +87 -0
- package/src/agents/plugin-lifecycle-hook.js +174 -0
- package/src/agents/plugin-module-source.js +26 -0
- package/src/agents/source-applications.js +3 -3
- package/src/agents/token-usage-resolver.js +0 -6
- package/src/cli/clients-command.js +3 -3
- package/src/cli/command-registry.js +1 -2
- package/src/cli/connect-command.js +1 -1
- package/src/cli/mcp-command.js +1 -1
- package/src/cli/setup-command.js +3 -2
- package/src/cli.js +0 -5
- package/src/conversations/entry-budget.js +4 -3
- package/src/conversations/entry-inline-budget.js +40 -10
- package/src/conversations/person-words.js +0 -5
- package/src/conversations/preference-lifecycle.js +3 -3
- package/src/conversations/turn-findings.js +9 -2
- package/src/data-format/local-stores.js +6 -0
- package/src/debug-turns/model-request.js +2 -27
- package/src/desktop/npm-copy-data.js +20 -6
- package/src/embedding-models/manifest.js +147 -0
- package/src/embedding-models/port.js +117 -0
- package/src/embedding-models/registry.js +24 -0
- package/src/embedding-models/store.js +208 -0
- package/src/external-knowledge/connectors/custom.js +4 -0
- package/src/external-knowledge/connectors/mcp.js +13 -1
- package/src/external-knowledge/connectors/response-values.js +8 -0
- package/src/external-knowledge/connectors/retrieval-api.js +5 -1
- package/src/external-knowledge/service.js +22 -5
- package/src/graphiti/agent-conversations.js +3 -2
- package/src/graphiti/agent-knowledge-workflows.js +1 -6
- package/src/graphiti/agent-project-resolution.js +18 -0
- package/src/graphiti/capture-change-confirmation.js +1 -1
- package/src/graphiti/checkpoint-amendment.js +50 -0
- package/src/graphiti/checkpoint-capture.js +7 -3
- package/src/graphiti/checkpoint-save-status.js +71 -0
- package/src/graphiti/collaboration-preference-entry.js +5 -2
- package/src/graphiti/current-project-knowledge-search.js +3 -3
- package/src/graphiti/federated-application.js +11 -132
- package/src/graphiti/first-run-guide.js +25 -4
- package/src/graphiti/fla-mention.js +48 -9
- package/src/graphiti/fuli-markup.js +1 -1
- package/src/graphiti/human-review-channel.js +4 -2
- package/src/graphiti/knowledge-curation.js +12 -24
- package/src/graphiti/knowledge-provider-mapping.js +0 -21
- package/src/graphiti/knowledge-reader.js +0 -7
- package/src/graphiti/knowledge-spaces.js +36 -0
- package/src/graphiti/local-runtimes.js +9 -1
- package/src/graphiti/personal-global-preference-candidates.js +0 -44
- package/src/graphiti/project-agent-control-plane.js +5 -12
- package/src/graphiti/project-agent-mapping.js +0 -13
- package/src/graphiti/project-agent-task-summaries.js +82 -0
- package/src/graphiti/project-agent-workflows.js +8 -21
- package/src/graphiti/project-path-context.js +23 -9
- package/src/graphiti/provider-client.js +41 -168
- package/src/graphiti/reply-echo-group.js +7 -6
- package/src/graphiti/repository-remote.js +34 -8
- package/src/graphiti/roundtable-host.js +14 -1
- package/src/graphiti/session-knowledge-capture.js +5 -31
- package/src/graphiti/task-context-entry.js +4 -1
- package/src/graphiti/task-entry-group-discussion.js +111 -25
- package/src/graphiti/task-entry-owner-change.js +86 -0
- package/src/graphiti/task-entry-preferences.js +23 -6
- package/src/graphiti/task-entry-project-scope.js +24 -1
- package/src/graphiti/task-knowledge-checkpoint.js +30 -14
- package/src/graphiti/task-preference-pages.js +3 -3
- package/src/graphiti/task-preference-reader.js +44 -9
- package/src/graphiti/topic-proposals.js +31 -8
- package/src/graphiti/topic-team-handoff.js +121 -0
- package/src/graphiti/worker-task-context.js +1 -1
- package/src/graphiti/workflow-learning.js +0 -25
- package/src/graphiti/workspace-provider-client.js +4 -50
- package/src/http/api-router.js +18 -0
- package/src/http/capture-onboarding-api-router.js +13 -4
- package/src/http/embedding-models-api-router.js +36 -0
- package/src/http/graph-api-router.js +3 -125
- package/src/http/project-organizing-api-router.js +27 -0
- package/src/http/reply-echo-api-router.js +2 -2
- package/src/http/request-policy.js +0 -4
- package/src/http/task-blocker-api-router.js +11 -1
- package/src/http/task-close-api-router.js +59 -0
- package/src/judgment/acceptance.js +2 -2
- package/src/judgment/agent-view.js +8 -8
- package/src/judgment/conversation.js +75 -69
- package/src/judgment/engine.js +39 -37
- package/src/judgment/explain-method.js +8 -7
- package/src/judgment/http.js +5 -3
- package/src/judgment/question-options.js +117 -74
- package/src/judgment/question-tools.js +54 -34
- package/src/judgment/review-delegation.js +32 -7
- package/src/judgment/review-egress.js +25 -0
- package/src/judgment/review-prompt.js +29 -33
- package/src/judgment/routing.js +4 -3
- package/src/judgment/service.js +51 -9
- package/src/judgment/verdict-schema.js +2 -7
- package/src/knowledge-hard-delete/console-port.js +1 -7
- package/src/knowledge-hard-delete/forget-references.js +1 -1
- package/src/knowledge-owner-reads/console-port.js +8 -19
- package/src/mcp/chat-listing.js +1 -1
- package/src/mcp/create-mcp-server.js +13 -33
- package/src/mcp/direct-call.js +3 -4
- package/src/mcp/preference-delivery.js +65 -5
- package/src/mcp/provider-task-context-registry.js +14 -0
- package/src/mcp/session-id.js +13 -37
- package/src/mcp/tool-annotations.js +3 -44
- package/src/mcp/tool-result.js +8 -6
- package/src/model-backends/adapters/builtin-embeddings.js +44 -0
- package/src/model-backends/adapters/registry.js +3 -1
- package/src/model-backends/config.js +24 -4
- package/src/model-backends/egress.js +8 -0
- package/src/model-backends/failures.js +8 -0
- package/src/model-backends/port.js +46 -17
- package/src/model-backends/role-trust.js +3 -9
- package/src/model-backends/runtime.js +6 -13
- package/src/model-backends/secret-store.js +2 -20
- package/src/model-backends/usage-ledger.js +20 -9
- package/src/native-runtime/runtime.js +13 -2
- package/src/presence/windows-helper-pin.js +1 -1
- package/src/project-organizing/agent-tool.js +92 -0
- package/src/project-organizing/model-tiers.js +31 -0
- package/src/project-organizing/port.js +130 -0
- package/src/server.js +29 -13
- package/src/setup/agents/claude-code/descriptor.json +1 -5
- package/src/setup/agents/codex/descriptor.json +1 -5
- package/src/setup/agents/cursor/descriptor.json +1 -5
- package/src/setup/agents/descriptor-schema.js +4 -1
- package/src/setup/agents/opencode/descriptor.json +1 -5
- package/src/setup/paths.js +1 -0
- package/src/system/client-connection-install.js +12 -2
- package/src/system/client-connection-status.js +90 -20
- package/src/system/client-restart.js +72 -0
- package/src/system/configured-install.js +103 -0
- package/src/system/doctor-repair.js +3 -1
- package/src/system/doctor.js +3 -1
- package/src/system/system-service.js +14 -2
- package/src/task-blockers/agent-resume.js +73 -0
- package/src/task-blockers/console-port.js +5 -2
- package/src/task-blockers/resume-status.js +2 -0
- package/src/task-closing/console-port.js +26 -0
- package/src/whats-new/lines/0.27.0.json +13 -0
- package/src/whats-new/lines/0.27.1.json +13 -0
- package/dist/web/assets/AgentAppsPage-5VW0uCTz.js +0 -1
- package/dist/web/assets/AgentProfilePage-BLeyT3By.js +0 -5
- package/dist/web/assets/AgentServicesPage-BXi152Xc.js +0 -1
- package/dist/web/assets/Breadcrumb-DtM5lZy5.js +0 -1
- package/dist/web/assets/CaptureChangePage-BzwcfacI.js +0 -1
- package/dist/web/assets/ConnectionsPage-C_vgqwF2.js +0 -1
- package/dist/web/assets/ConnectionsPage-DS2PEG6K.css +0 -1
- package/dist/web/assets/DataFormatPage-DwL4Ofc9.js +0 -2
- package/dist/web/assets/DebugTurnPage-UpK_3ZWY.js +0 -1
- package/dist/web/assets/DebugTurnsPage-C0aZg5-3.js +0 -1
- package/dist/web/assets/EmployeeScopeDialog-Bt3ZlDyZ.js +0 -1
- package/dist/web/assets/EmployeeWorkbench-GtJIUD5G.js +0 -4
- package/dist/web/assets/FieldRoot-DRf4wM5x.js +0 -1
- package/dist/web/assets/FlasPage-CgIVOGFM.js +0 -1
- package/dist/web/assets/InboxPage-1ue8vA7H.css +0 -1
- package/dist/web/assets/InboxPage-zNUnnYeJ.js +0 -6
- package/dist/web/assets/KnowledgeItemEditPage-DGRNkAYd.js +0 -1
- package/dist/web/assets/KnowledgeOrganizerPage-BWvF1GEu.js +0 -1
- package/dist/web/assets/KnowledgePage--Z4_kAhq.js +0 -1
- package/dist/web/assets/KnowledgePeek-BgzQA9SI.js +0 -1
- package/dist/web/assets/KnowledgeWorkspace-0yOpWtEB.js +0 -4
- package/dist/web/assets/KnowledgeWorkspace-BgWo6lBj.css +0 -1
- package/dist/web/assets/ModelSettingsPage-B9PS1Kay.css +0 -1
- package/dist/web/assets/ModelSettingsPage-BL6MsF7C.js +0 -1
- package/dist/web/assets/NoticeRow-BXZWn4EZ.js +0 -1
- package/dist/web/assets/OccupationsPage-CkVqZ2pz.js +0 -1
- package/dist/web/assets/OverviewPage-_9e2idJR.js +0 -1
- package/dist/web/assets/PageOutline-CFGtHmOK.js +0 -1
- package/dist/web/assets/PageOutline-DG5ZYtA8.css +0 -1
- package/dist/web/assets/PersonalProfilePage-TxsNr44t.js +0 -1
- package/dist/web/assets/PersonalProjectsPage-AhgP6CL8.js +0 -1
- package/dist/web/assets/ProjectAgentsPage-O-cMavcz.js +0 -5
- package/dist/web/assets/ProjectJudgmentPolicy-CyHAu0nm.js +0 -2
- package/dist/web/assets/ProjectJudgmentPolicy-DnjMniaz.css +0 -1
- package/dist/web/assets/PublicProjectsPage-Ck1QSR0R.js +0 -1
- package/dist/web/assets/PublicProjectsPage-CskSzffL.css +0 -1
- package/dist/web/assets/SettingsPage-Cj3pEWcd.css +0 -1
- package/dist/web/assets/SettingsPage-bLssMIz6.js +0 -1
- package/dist/web/assets/SharedJefaReportPage-DUY03VLS.js +0 -1
- package/dist/web/assets/TaskBlockerClear-BxOiiuK8.js +0 -1
- package/dist/web/assets/TaskBlockerNotice-iUiD3BuZ.js +0 -1
- package/dist/web/assets/TonborgDelegationSwitch-C1nkJqkJ.js +0 -1
- package/dist/web/assets/TonborgDelegationSwitch-DeqERWoo.css +0 -1
- package/dist/web/assets/UiDialog-JjqzOA0z.js +0 -1
- package/dist/web/assets/UiIcon-vgD4v8q8.js +0 -1
- package/dist/web/assets/UiIconButton-BzyMc14P.js +0 -1
- package/dist/web/assets/UiIconButton-ZCBdABdM.css +0 -1
- package/dist/web/assets/UiSegmented-CIIm3KoV.js +0 -1
- package/dist/web/assets/WidgetSlot-Dw5nWlb7.js +0 -2
- package/dist/web/assets/WorkbenchListPage-D0xX-YNl.js +0 -1
- package/dist/web/assets/_plugin-vue_export-helper-B4pFJCwG.js +0 -9
- package/dist/web/assets/agent-occupation-CjfQqSzd.js +0 -1
- package/dist/web/assets/agent-profile-BNPLhDog.css +0 -1
- package/dist/web/assets/agent-roster-records-Bi5HWDif.js +0 -1
- package/dist/web/assets/console-DgRc8Itw.js +0 -1
- package/dist/web/assets/conversation-launcher-settings-CZAfuu8B.js +0 -1
- package/dist/web/assets/identity-DIG-uOiU.js +0 -1
- package/dist/web/assets/index-C2VDC1uO.js +0 -24
- package/dist/web/assets/index-DF0TcfPY.css +0 -1
- package/dist/web/assets/label-table-CDzYRZpc.js +0 -1
- package/dist/web/assets/model-BjUERpoQ.js +0 -3
- package/dist/web/assets/npm-copies-BLRc0FXW.js +0 -1
- package/dist/web/assets/overview-data-Cq1gefY5.js +0 -1
- package/dist/web/assets/popup-host-ctKYu9Ze.js +0 -1
- package/dist/web/assets/review-api-CJaNgPMA.js +0 -1
- package/dist/web/assets/review-store-DSQpb5P8.js +0 -1
- package/dist/web/assets/shared-report-DQBSigHB.js +0 -3
- package/dist/web/assets/source-adapters-DPJzumzC.js +0 -1
- package/dist/web/assets/task-evidence-DIbw2U42.js +0 -1
- package/dist/web/assets/ui-D4nAhcmu.css +0 -1
- package/dist/web/assets/ui-DmNbL8MW.js +0 -1
- package/dist/web/assets/useForwardScopeId-DZCnSswO.js +0 -1
- package/dist/web/assets/usePrimitiveElement-tPQM7XJs.js +0 -1
- package/dist/web/assets/useTeamPeople-D_5cxxf1.js +0 -1
- package/dist/web/assets/version-lXtOG8uf.js +0 -1
- package/docs/public-personal-architecture.md +0 -73
- package/graph-provider/fuli_graph/common_knowledge.py +0 -459
- package/graph-provider/fuli_graph/common_knowledge_models.py +0 -54
- package/graph-provider/fuli_graph/project_management.py +0 -251
- package/skills/flreview/SKILL.md +0 -101
- package/skills/flreview/agents/openai.yaml +0 -6
- package/src/agent-tools/project-relation-definitions.js +0 -36
- package/src/agents/codex/acp-process.js +0 -244
- package/src/agents/codex/acp-session.js +0 -190
- package/src/agents/codex/acp-worker.js +0 -54
- package/src/agents/codex/review-command.js +0 -29
- package/src/cli/worker-command.js +0 -80
- package/src/graphiti/checkpoint-provider-outage.js +0 -23
- package/src/graphiti/common-knowledge-candidates.js +0 -222
- package/src/graphiti/public-project-relations.js +0 -28
- package/src/graphiti/public-projects.js +0 -125
- package/src/graphiti/public-submission-reconciliation.js +0 -37
- package/src/graphiti/public-submission.js +0 -77
- package/src/graphiti/publication-draft-capture.js +0 -28
- package/src/graphiti/publication-draft-input.js +0 -11
- package/src/graphiti/publication-review-queues.js +0 -50
- package/src/graphiti/worker-plan-host.js +0 -92
- package/src/graphiti/worker-run-host.js +0 -287
- package/src/graphiti/workflow-observation.js +0 -72
- package/src/mcp/common-knowledge-preview-tokens.js +0 -67
- package/src/server/worker-plan-runtime.js +0 -56
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createHmac } from 'node:crypto';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
1
3
|
import { networkInterfaces } from 'node:os';
|
|
2
4
|
import { join as joinPath } from 'node:path';
|
|
3
5
|
|
|
@@ -5,18 +7,37 @@ import { startCoordinatorServer } from './coordinator-http.js';
|
|
|
5
7
|
import { cleanName, createCoordinatorService } from './coordinator-service.js';
|
|
6
8
|
import { createCoordinatorStore } from './coordinator-store.js';
|
|
7
9
|
import { loadDeviceIdentity } from './device-identity.js';
|
|
8
|
-
import {
|
|
10
|
+
import { announcedAddresses, lanAddresses, virtualAddresses } from './lan-addresses.js';
|
|
11
|
+
import { createAttemptLedger } from './nearby-attempts.js';
|
|
12
|
+
import { createBonjourDiscovery } from './nearby-discovery.js';
|
|
13
|
+
import { createNearbyPairing } from './nearby-pairing.js';
|
|
14
|
+
import { createNearbyPresence } from './nearby-presence.js';
|
|
15
|
+
import { answersAs, connectNearby, createPeerClient, pairWithCoordinator } from './peer-transport.js';
|
|
9
16
|
import { coordinatorUrl, decodeInvitation, PeerError, shortFingerprint } from './protocol.js';
|
|
10
17
|
import { createPeerRunner } from './runner.js';
|
|
11
18
|
|
|
12
19
|
const PUBLISH_MS = 60_000;
|
|
20
|
+
const DIRECTORY_READ_MS = 3_000;
|
|
13
21
|
const WAKE_CLIENTS = new Set(['codex', 'claude_code']);
|
|
22
|
+
// While nearby pairing is on, its listener answers on every IPv4 interface:
|
|
23
|
+
// the address another computer reaches comes from discovery, not from the
|
|
24
|
+
// person. Afterwards it narrows to the address its paired devices use.
|
|
25
|
+
const NEARBY_LISTEN_HOST = '0.0.0.0';
|
|
26
|
+
// Nearby pairing turns itself off this long after the person turned it on,
|
|
27
|
+
// and shortly after a pairing finished (the other computer may still ask once).
|
|
28
|
+
const NEARBY_SESSION_MS = 30 * 60_000;
|
|
29
|
+
const PAIRED_GRACE_MS = 5_000;
|
|
30
|
+
// A device this computer trusted through nearby pairing that never connects
|
|
31
|
+
// within this time did not finish its side: the trust is taken back.
|
|
32
|
+
const TRUST_USE_MS = 60_000;
|
|
33
|
+
const LOOPBACK = /^(127\.|::1$)/;
|
|
14
34
|
const teamPeople = team => team?.people ?? [];
|
|
15
35
|
|
|
16
36
|
// The local owner's LAN roundtable controls, run only by the console process.
|
|
17
37
|
// Nothing here starts unless the owner turned it on; console LAN access does not.
|
|
18
38
|
export function createPeerRuntime({ host, roundtable, port, interfaces = networkInterfaces, allowLoopback = false,
|
|
19
|
-
claimWaitMs,
|
|
39
|
+
claimWaitMs, createDiscovery = createBonjourDiscovery, startServer = startCoordinatorServer, nearbyListenHost = NEARBY_LISTEN_HOST, clock = Date.now,
|
|
40
|
+
nearbySessionMs = NEARBY_SESSION_MS, pairedGraceMs = PAIRED_GRACE_MS, trustUseMs = TRUST_USE_MS, onError = () => {} }) {
|
|
20
41
|
const store = () => port.nodeStore();
|
|
21
42
|
let coordinator = null;
|
|
22
43
|
let runner = null;
|
|
@@ -25,53 +46,99 @@ export function createPeerRuntime({ host, roundtable, port, interfaces = network
|
|
|
25
46
|
let leaveRetry = null;
|
|
26
47
|
let leaveWork = null;
|
|
27
48
|
let leaveAbort = null;
|
|
49
|
+
let lastPublish = null;
|
|
50
|
+
let repositoryKey = null;
|
|
51
|
+
let nearbyNotice = null;
|
|
52
|
+
let nearbyTimer = null;
|
|
53
|
+
let listenFailure = null;
|
|
54
|
+
const trustChecks = new Set();
|
|
28
55
|
const spaceId = () => host.spaceId();
|
|
56
|
+
const identity = () => loadDeviceIdentity(port.directory);
|
|
57
|
+
const discovery = createDiscovery({ onFailure: (error) => endNearby({ kind: 'discovery_failed', reason: failureCode(error) })
|
|
58
|
+
.catch(onError) });
|
|
59
|
+
const presence = createNearbyPresence({ discovery, clock });
|
|
60
|
+
const attempts = createAttemptLedger({ clock, read: () => (port.configured() ? store().setting('nearbyAttempts') : null),
|
|
61
|
+
update: (change) => store().updateSetting('nearbyAttempts', change) });
|
|
62
|
+
const pairing = createNearbyPairing({ attempts, local: {
|
|
63
|
+
identity, authority: () => port.localAuthority(),
|
|
64
|
+
answersOn: (address) => !virtualAddresses(interfaces).includes(address),
|
|
65
|
+
leaveCoordinator: async (peer) => {
|
|
66
|
+
if (store().setting('membership')?.coordinator?.fingerprint === peer.fingerprint) await disable();
|
|
67
|
+
},
|
|
68
|
+
name: () => store().setting('nearby')?.name ?? 'FULI',
|
|
69
|
+
role: nearbyRole,
|
|
70
|
+
trusted: (fingerprint) => trustedFingerprints().includes(fingerprint),
|
|
71
|
+
trustDevice: (peer) => {
|
|
72
|
+
if (!coordinator) throw new PeerError('not_coordinator', 'This computer stopped coordinating', 409);
|
|
73
|
+
coordinator.service.trustNearbyDevice(peer);
|
|
74
|
+
watchTrustUse(peer);
|
|
75
|
+
},
|
|
76
|
+
untrustDevice: async (fingerprint) => { withdrawTrust(fingerprint); },
|
|
77
|
+
joinCoordinator: async (peer) => adoptCoordinator({ url: coordinatorUrl(peer.address, peer.port), certPem: peer.certPem,
|
|
78
|
+
fingerprint: peer.fingerprint, name: peer.name, authority: peer.authority }),
|
|
79
|
+
reachable: async (peer) => answersAs({ identity: await identity(), address: peer.address, port: peer.port, fingerprint: peer.fingerprint }),
|
|
80
|
+
}, connect: async (target) => connectNearby({ identity: await identity(), target }), clock,
|
|
81
|
+
onPaired: (peer) => afterPairing(peer), onError });
|
|
29
82
|
|
|
30
|
-
|
|
31
|
-
return Object.values(interfaces()).flat().filter((entry) => entry && !entry.internal
|
|
32
|
-
&& (entry.family === 'IPv4' || entry.family === 4)).map((entry) => entry.address);
|
|
33
|
-
}
|
|
83
|
+
const localAddresses = () => lanAddresses(interfaces);
|
|
34
84
|
|
|
35
85
|
async function resume() {
|
|
36
86
|
if (!port.configured()) return;
|
|
37
87
|
await finishLeaving();
|
|
38
88
|
const settings = store().setting('coordinator');
|
|
39
|
-
|
|
40
|
-
if (
|
|
89
|
+
// An address that is gone (a new network, DHCP) is said, not replaced: nothing listens until the person acts.
|
|
90
|
+
if (settings) await startCoordinator(settings).catch((error) => { onError(error); });
|
|
91
|
+
if (store().setting('membership') && (coordinator || !settings)) await startRunner();
|
|
92
|
+
checkPendingTrust();
|
|
93
|
+
const nearby = store().setting('nearby');
|
|
94
|
+
if (!nearby) return;
|
|
95
|
+
if (!(nearby.until > clock())) await endNearby({ kind: 'timeout' });
|
|
96
|
+
else if (settings && !coordinator) await endNearby(null);
|
|
97
|
+
else await startNearby();
|
|
41
98
|
}
|
|
42
99
|
|
|
43
100
|
async function startCoordinator({ host: address, port: listenPort, name }) {
|
|
44
|
-
const
|
|
101
|
+
const device = await identity();
|
|
45
102
|
const authority = await port.localAuthority();
|
|
46
103
|
const coordinatorStore = createCoordinatorStore(joinPath(port.directory, 'coordinator.sqlite'));
|
|
47
104
|
let server = null;
|
|
48
|
-
const service = createCoordinatorService({ store: coordinatorStore, identity, authority, name,
|
|
49
|
-
onTrustChange: () => server?.refreshTrust()
|
|
105
|
+
const service = createCoordinatorService({ store: coordinatorStore, identity: device, authority, name,
|
|
106
|
+
onTrustChange: () => server?.refreshTrust(),
|
|
107
|
+
repositoryChanges: { read: () => store().setting('repositoryChanges'), write: (value) => store().setSetting('repositoryChanges', value) } });
|
|
50
108
|
try {
|
|
51
|
-
server = await
|
|
109
|
+
server = await startServer({ service, identity: device, host: address, port: listenPort, claimWaitMs,
|
|
110
|
+
nearby: { listening: (address) => nearbyRole().listening && !virtualAddresses(interfaces).includes(address),
|
|
111
|
+
handle: (...args) => pairing.handle(...args) },
|
|
112
|
+
onReached: rememberReached });
|
|
52
113
|
} catch (error) {
|
|
53
114
|
coordinatorStore.close();
|
|
54
|
-
|
|
115
|
+
listenFailure = { address, port: listenPort, code: failureCode(error), at: new Date(clock()).toISOString() };
|
|
116
|
+
throw new PeerError('listen_failed', `Could not listen on ${address}:${listenPort}: ${failureCode(error)}`, 409);
|
|
55
117
|
}
|
|
118
|
+
listenFailure = null;
|
|
56
119
|
coordinator = { service, server, store: coordinatorStore, host: address, name };
|
|
57
|
-
|
|
120
|
+
// A wildcard listener answers this computer on loopback.
|
|
121
|
+
const url = coordinatorUrl(address === NEARBY_LISTEN_HOST ? '127.0.0.1' : address, server.address.port);
|
|
58
122
|
store().setSetting('coordinator', { host: address, port: server.address.port, name });
|
|
59
|
-
store().setSetting('membership', { role: 'coordinator', coordinator: { url, certPem:
|
|
60
|
-
fingerprint:
|
|
61
|
-
store().forgetAuthority(
|
|
62
|
-
store().bindAuthority(
|
|
123
|
+
store().setSetting('membership', { role: 'coordinator', coordinator: { url, certPem: device.certPem,
|
|
124
|
+
fingerprint: device.fingerprint, name } });
|
|
125
|
+
store().forgetAuthority(device.fingerprint);
|
|
126
|
+
store().bindAuthority(device.fingerprint, authority, 'self');
|
|
63
127
|
}
|
|
64
128
|
|
|
65
129
|
async function startRunner() {
|
|
66
130
|
if (runner) return;
|
|
67
131
|
const membership = store().setting('membership');
|
|
68
|
-
const
|
|
69
|
-
runnerClient = createPeerClient({ identity, coordinator: membership.coordinator });
|
|
132
|
+
const device = await identity();
|
|
133
|
+
runnerClient = createPeerClient({ identity: device, coordinator: membership.coordinator });
|
|
70
134
|
runner = createPeerRunner({ store: store(), client: runnerClient, roundtable, host,
|
|
71
|
-
nodeId:
|
|
135
|
+
nodeId: device.fingerprint, spaceId, onError });
|
|
72
136
|
runner.start().catch(onError);
|
|
73
137
|
await publish().catch(onError);
|
|
74
|
-
publisher = setInterval(() =>
|
|
138
|
+
publisher = setInterval(() => {
|
|
139
|
+
publish().catch(onError);
|
|
140
|
+
narrowListener().catch(onError);
|
|
141
|
+
}, PUBLISH_MS);
|
|
75
142
|
publisher.unref();
|
|
76
143
|
}
|
|
77
144
|
|
|
@@ -82,81 +149,148 @@ export function createPeerRuntime({ host, roundtable, port, interfaces = network
|
|
|
82
149
|
await leaveWork?.catch(onError);
|
|
83
150
|
clearInterval(publisher);
|
|
84
151
|
publisher = null;
|
|
85
|
-
|
|
152
|
+
// Taken before awaiting, so two stops at once (a discovery failure during
|
|
153
|
+
// another change) never close the same listener twice.
|
|
154
|
+
const [stoppingRunner, stoppingClient, stoppingCoordinator] = [runner, runnerClient, coordinator];
|
|
86
155
|
runner = null;
|
|
87
|
-
runnerClient?.close();
|
|
88
156
|
runnerClient = null;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
157
|
+
coordinator = null;
|
|
158
|
+
repositoryKey = null;
|
|
159
|
+
await stoppingRunner?.stop();
|
|
160
|
+
stoppingClient?.close();
|
|
161
|
+
if (stoppingCoordinator) {
|
|
162
|
+
await stoppingCoordinator.server.close();
|
|
163
|
+
stoppingCoordinator.store.close();
|
|
93
164
|
}
|
|
94
165
|
}
|
|
95
166
|
|
|
96
167
|
// Each share names the lead it was made for; after a handoff the old share
|
|
97
|
-
// is withheld until the owner shares the project's new lead.
|
|
168
|
+
// is withheld until the owner shares the project's new lead. A team that
|
|
169
|
+
// cannot be read right now is no handoff: its share stays as last published.
|
|
98
170
|
async function shareStates() {
|
|
99
171
|
const projects = await host.listProjects().catch(() => []);
|
|
100
172
|
const names = new Map(projects.map((project) => [project.projectId, project.name]));
|
|
101
173
|
return Promise.all(store().shares().filter((share) => share.spaceId === spaceId()).map(async (share) => {
|
|
102
|
-
const
|
|
174
|
+
const projectName = names.get(share.projectId) ?? share.projectId;
|
|
175
|
+
let team;
|
|
176
|
+
try { team = await host.projectTeam(share.projectId); }
|
|
177
|
+
catch (error) { return { ...share, projectName, lead: null, state: 'team_unreadable', reason: error.code ?? 'team_unreadable' }; }
|
|
103
178
|
const person = share.communicationOnly ? teamPeople(team).find(a => a.agentId === share.agentId) : team?.lead;
|
|
104
179
|
const current = person?.agentId === share.agentId;
|
|
105
|
-
return { ...share, projectName
|
|
180
|
+
return { ...share, projectName, lead: person ?? null,
|
|
106
181
|
state: current ? 'shared' : team?.lead ? 'lead_changed' : 'lead_unavailable' };
|
|
107
182
|
}));
|
|
108
183
|
}
|
|
109
184
|
|
|
185
|
+
const published = new Map();
|
|
186
|
+
|
|
187
|
+
// What this device offers, sent to the coordinator now and every minute.
|
|
188
|
+
// The outcome is kept for status, so a list the coordinator never got is
|
|
189
|
+
// visible on the card and in `fuli peer status` instead of only in a log.
|
|
110
190
|
async function publish() {
|
|
111
191
|
if (!runnerClient) return;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
192
|
+
try {
|
|
193
|
+
const profiles = await host.listAgents();
|
|
194
|
+
const agents = (await shareStates()).flatMap((share) => {
|
|
195
|
+
if (share.state === 'team_unreadable') return published.has(share.bindingId) ? [published.get(share.bindingId)] : [];
|
|
196
|
+
if (share.state !== 'shared') return [];
|
|
197
|
+
const profile = profiles.find(a => a.agentId === share.agentId);
|
|
198
|
+
return [{ bindingId: share.bindingId, agentId: share.agentId, name: share.lead.name, employeeNumber: share.lead.employeeNumber,
|
|
199
|
+
responsibility: share.lead.responsibility, projectName: share.projectName, projectId: share.projectId,
|
|
200
|
+
occupation: profile?.occupation?.role ?? null, capabilities: profile?.profile.capabilities ?? [],
|
|
201
|
+
...(share.communicationOnly ? { communicationOnly: true } : {}), clients: share.clients }];
|
|
202
|
+
});
|
|
203
|
+
await runner?.reconcileShares(new Set(agents.map((agent) => agent.bindingId)));
|
|
204
|
+
const sent = repositoryKey;
|
|
205
|
+
const answer = await runnerClient.post('/peer/1/directory/publish', { agents,
|
|
206
|
+
...(sent ? { repositories: { keyId: sent.id, digests: await repositoryDigests(sent) } } : {}) });
|
|
207
|
+
published.clear();
|
|
208
|
+
for (const agent of agents) published.set(agent.bindingId, agent);
|
|
209
|
+
lastPublish = { at: new Date().toISOString(), agents: agents.length, error: null };
|
|
210
|
+
// The group's repository key comes with the answer; a new one means sending the digests again.
|
|
211
|
+
if (validKey(answer.repositoryKey) && answer.repositoryKey.id !== sent?.id) {
|
|
212
|
+
repositoryKey = answer.repositoryKey;
|
|
213
|
+
await runnerClient.post('/peer/1/directory/publish', { agents,
|
|
214
|
+
repositories: { keyId: repositoryKey.id, digests: await repositoryDigests(repositoryKey) } });
|
|
215
|
+
}
|
|
216
|
+
} catch (error) {
|
|
217
|
+
// Only a known word reaches the card and CLI: the coordinator's own text never does.
|
|
218
|
+
lastPublish = { at: new Date().toISOString(), agents: null, error: failureCode(error) };
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// This device's own repository addresses, keyed with the paired group's
|
|
224
|
+
// secret (from the coordinator, only after pairing): the coordinator matches
|
|
225
|
+
// them between devices, and no device sees another device's digests.
|
|
226
|
+
async function repositoryDigests(key) {
|
|
227
|
+
const projects = await host.listProjects().catch(() => []);
|
|
228
|
+
return [...new Set(projects.filter((project) => !project.temporary).flatMap((project) => projectDigests(project, key)))];
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async function pairedDirectory() {
|
|
232
|
+
if (!runnerClient) return [];
|
|
233
|
+
try {
|
|
234
|
+
const { devices } = await runnerClient.post('/peer/1/directory', {}, { timeoutMs: DIRECTORY_READ_MS });
|
|
235
|
+
return (Array.isArray(devices) ? devices : []).map((entry) => ({ ...entry, name: cleanName(entry?.name) || 'FULI' }));
|
|
236
|
+
}
|
|
237
|
+
catch { return []; }
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Projects the owner may share: each with its current lead, the clients that
|
|
241
|
+
// lead may use and, for a project a paired device registered with the same
|
|
242
|
+
// own repository, that device. A folder is offered only when this computer
|
|
243
|
+
// knows one whose Git remote is that repository.
|
|
124
244
|
async function shareable() {
|
|
125
245
|
const list = (await host.listProjects().catch(() => [])).filter((project) => !project.temporary).slice(0, 50);
|
|
126
246
|
const agents = await host.listAgents().catch(() => []);
|
|
247
|
+
const paired = repositoryKey ? await pairedDirectory() : [];
|
|
127
248
|
return Promise.all(list.map(async (project) => {
|
|
128
249
|
const projectId = project.projectId;
|
|
129
250
|
const team = await host.projectTeam(projectId).catch(() => null);
|
|
130
251
|
const allowed = (agents.find((agent) => agent.agentId === team?.lead?.agentId)?.profile.allowedClients ?? [])
|
|
131
252
|
.filter((client) => WAKE_CLIENTS.has(client));
|
|
253
|
+
const digests = new Set(repositoryKey ? projectDigests(project, repositoryKey) : []);
|
|
254
|
+
const sameProjectOn = paired.filter((device) => (device.sameRepositories ?? []).some((digest) => digests.has(digest)))
|
|
255
|
+
.map(({ nodeId, name }) => ({ nodeId, name }));
|
|
132
256
|
return { projectId, projectName: project.name ?? projectId,
|
|
133
257
|
lead: team?.lead ? { agentId: team.lead.agentId, name: team.lead.name } : null, clients: allowed,
|
|
134
258
|
communicationAgents: teamPeople(team).map(person => ({ agentId: person.agentId, name: person.name,
|
|
135
|
-
occupation: agents.find(a => a.agentId === person.agentId)?.occupation?.role ?? null }))
|
|
259
|
+
occupation: agents.find(a => a.agentId === person.agentId)?.occupation?.role ?? null })),
|
|
260
|
+
sameProjectOn, knownFolder: sameProjectOn.length && team?.lead ? await repositoryFolder(project, team.lead.agentId) : null };
|
|
136
261
|
}));
|
|
137
262
|
}
|
|
138
263
|
|
|
264
|
+
async function repositoryFolder(project, agentId) {
|
|
265
|
+
const folder = await roundtable.knownProjectFolder({ agentId, projectId: project.projectId }).catch(() => null);
|
|
266
|
+
if (!folder || !host.folderRepository) return null;
|
|
267
|
+
const remote = await Promise.resolve().then(() => host.folderRepository(folder)).catch(() => null);
|
|
268
|
+
return remote && (project.repositories ?? []).includes(remote) ? folder : null;
|
|
269
|
+
}
|
|
270
|
+
|
|
139
271
|
async function status() {
|
|
140
272
|
if (!port.configured()) {
|
|
141
273
|
return { beta: true, role: null, device: null, coordinator: null, addresses: localAddresses(), devices: [],
|
|
142
|
-
openInvitations: 0, shares: [], shareable: [] };
|
|
274
|
+
openInvitations: 0, shares: [], shareable: [], lastPublish: null, nearby: await nearbyView() };
|
|
143
275
|
}
|
|
144
276
|
const membership = store().setting('membership');
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
if (coordinator) devices = coordinator.service.devices();
|
|
277
|
+
const device = membership ? await identity() : null;
|
|
278
|
+
const devices = membership?.role === 'coordinator' ? storedDevices() : [];
|
|
148
279
|
return {
|
|
149
280
|
beta: true,
|
|
150
281
|
remoteRemovalPending: Boolean(store().setting('pendingLeave')),
|
|
151
282
|
role: membership?.role ?? null,
|
|
152
|
-
device:
|
|
283
|
+
device: device ? { fingerprint: device.fingerprint, shortFingerprint: shortFingerprint(device.fingerprint) } : null,
|
|
153
284
|
coordinator: membership ? { name: membership.coordinator.name, url: membership.coordinator.url,
|
|
154
|
-
shortFingerprint: shortFingerprint(membership.coordinator.fingerprint), listening: Boolean(coordinator)
|
|
285
|
+
shortFingerprint: shortFingerprint(membership.coordinator.fingerprint), listening: Boolean(coordinator),
|
|
286
|
+
listenFailure: membership.role === 'coordinator' && !coordinator ? listenFailure : null } : null,
|
|
155
287
|
addresses: localAddresses(),
|
|
156
|
-
devices: devices.map((
|
|
288
|
+
devices: devices.map((entry) => ({ ...entry, shortFingerprint: shortFingerprint(entry.nodeId) })),
|
|
157
289
|
openInvitations: coordinator ? coordinator.service.openInvitations() : 0,
|
|
158
290
|
shares: membership ? (await shareStates()).map(({ lead: _lead, ...share }) => share) : [],
|
|
159
291
|
shareable: membership ? await shareable() : [],
|
|
292
|
+
lastPublish: membership ? lastPublish : null,
|
|
293
|
+
nearby: await nearbyView(),
|
|
160
294
|
};
|
|
161
295
|
}
|
|
162
296
|
|
|
@@ -169,13 +303,20 @@ export function createPeerRuntime({ host, roundtable, port, interfaces = network
|
|
|
169
303
|
if (!Number.isSafeInteger(listenPort) || listenPort < 0 || listenPort > 65535) throw new PeerError('invalid_address', 'Invalid port', 422);
|
|
170
304
|
await startCoordinator({ host: address, port: listenPort, name: cleanName(name) || 'FULI coordinator' });
|
|
171
305
|
await startRunner();
|
|
306
|
+
await startNearby();
|
|
172
307
|
return status();
|
|
173
308
|
}
|
|
174
309
|
|
|
310
|
+
// A wildcard listener invites on the address paired devices already reach,
|
|
311
|
+
// else the first physical LAN address, never a VPN or virtual adapter first.
|
|
175
312
|
function createInvitation() {
|
|
176
313
|
if (!coordinator) throw new PeerError('not_coordinator', 'Only the coordinator device creates invitations', 409);
|
|
177
314
|
const settings = store().setting('coordinator');
|
|
178
|
-
|
|
315
|
+
const known = store().setting('reachedAddresses') ?? {};
|
|
316
|
+
const reached = trustedFingerprints().map((nodeId) => known[nodeId]).find((address) => address && !LOOPBACK.test(address));
|
|
317
|
+
const address = settings.host === NEARBY_LISTEN_HOST ? reached ?? localAddresses()[0] : settings.host;
|
|
318
|
+
if (!address) throw new PeerError('invalid_address', 'This computer has no LAN address to invite from', 409);
|
|
319
|
+
return coordinator.service.createInvitation({ url: coordinatorUrl(address, settings.port) });
|
|
179
320
|
}
|
|
180
321
|
|
|
181
322
|
function previewInvitation(text) {
|
|
@@ -185,25 +326,46 @@ export function createPeerRuntime({ host, roundtable, port, interfaces = network
|
|
|
185
326
|
}
|
|
186
327
|
|
|
187
328
|
async function join({ invitation: text, name }) {
|
|
188
|
-
|
|
329
|
+
const membership = store().setting('membership');
|
|
330
|
+
// A listener nearby pairing opened, with nobody paired through it, gives way to the invitation.
|
|
331
|
+
if (membership && !(membership.role === 'coordinator' && store().setting('nearby')?.openedListener && !coordinatesOthers())) {
|
|
332
|
+
throw new PeerError('already_paired', 'This device is already paired', 409);
|
|
333
|
+
}
|
|
189
334
|
await finishLeaving();
|
|
190
335
|
if (store().setting('pendingLeave')) throw new PeerError('leave_pending', 'The previous coordinator is offline. Retry after it is available, or revoke this device there.', 409);
|
|
191
336
|
const invitation = decodeInvitation(text);
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
const result = await pairWithCoordinator({ identity, authority, invitation, name: cleanName(name) || 'FULI device' });
|
|
337
|
+
const result = await pairWithCoordinator({ identity: await identity(), authority: await port.localAuthority(), invitation,
|
|
338
|
+
name: cleanName(name) || store().setting('nearby')?.name || 'FULI device' });
|
|
195
339
|
if (result.coordinatorNodeId !== invitation.fingerprint) throw new PeerError('invalid_pairing', 'The coordinator answered with another identity', 502);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
store().setSetting('membership', { role: 'member', coordinator: { url: invitation.url, certPem: invitation.certificatePem,
|
|
199
|
-
fingerprint: invitation.fingerprint, name: invitation.name || 'FULI coordinator' } });
|
|
200
|
-
await startRunner();
|
|
340
|
+
await adoptCoordinator({ url: invitation.url, certPem: invitation.certificatePem, fingerprint: invitation.fingerprint,
|
|
341
|
+
name: invitation.name, authority: invitation.authority });
|
|
201
342
|
return status();
|
|
202
343
|
}
|
|
203
344
|
|
|
345
|
+
// Joins a coordinator: an invitation's, or the computer nearby pairing chose.
|
|
346
|
+
// A listener without other paired devices closes first, so this computer
|
|
347
|
+
// stops advertising itself as a place to pair.
|
|
348
|
+
async function adoptCoordinator({ url, certPem, fingerprint, name, authority }) {
|
|
349
|
+
const membership = store().setting('membership');
|
|
350
|
+
if (membership?.role === 'member') throw new PeerError('already_paired', 'This device is already paired', 409);
|
|
351
|
+
if (membership?.role === 'coordinator') {
|
|
352
|
+
if (coordinatesOthers()) throw new PeerError('already_coordinating', 'This computer coordinates other devices', 409);
|
|
353
|
+
await stopAll();
|
|
354
|
+
store().setSetting('coordinator', null);
|
|
355
|
+
const nearby = store().setting('nearby');
|
|
356
|
+
if (nearby) store().setSetting('nearby', { ...nearby, openedListener: false });
|
|
357
|
+
}
|
|
358
|
+
store().forgetAuthority(fingerprint);
|
|
359
|
+
store().bindAuthority(fingerprint, authority, 'pairing');
|
|
360
|
+
store().setSetting('membership', { role: 'member', coordinator: { url, certPem, fingerprint, name: name || 'FULI coordinator' } });
|
|
361
|
+
await startRunner();
|
|
362
|
+
await startNearby();
|
|
363
|
+
}
|
|
364
|
+
|
|
204
365
|
// The owner picks each project, the clients it may be woken in and,
|
|
205
366
|
// optionally, its folder; each share is bound to that project's current lead.
|
|
206
367
|
async function setShares({ shares: wanted }) {
|
|
368
|
+
if (!store().setting('membership')) throw new PeerError('peer_not_paired', 'Pair this computer before sharing a project', 409);
|
|
207
369
|
if (!Array.isArray(wanted) || wanted.length > 50) throw new PeerError('invalid_shares', 'Choose up to 50 projects', 422);
|
|
208
370
|
const agents = await host.listAgents();
|
|
209
371
|
const shares = [];
|
|
@@ -228,7 +390,11 @@ export function createPeerRuntime({ host, roundtable, port, interfaces = network
|
|
|
228
390
|
}
|
|
229
391
|
store().replaceShares(shares, port.idFactory);
|
|
230
392
|
await runner?.reconcileShares();
|
|
231
|
-
|
|
393
|
+
// A list the coordinator did not get is said here, not only in the log.
|
|
394
|
+
try { await publish(); }
|
|
395
|
+
catch (error) {
|
|
396
|
+
throw new PeerError('share_not_published', `Saved here, but the coordinator did not get the list (${failureCode(error)}); FULI retries every minute`, 502);
|
|
397
|
+
}
|
|
232
398
|
return status();
|
|
233
399
|
}
|
|
234
400
|
|
|
@@ -250,23 +416,282 @@ export function createPeerRuntime({ host, roundtable, port, interfaces = network
|
|
|
250
416
|
return status();
|
|
251
417
|
}
|
|
252
418
|
|
|
253
|
-
// Leaves the LAN roundtable. History stays; trust, sharing and
|
|
419
|
+
// Leaves the LAN roundtable. History stays; trust, sharing, listening and nearby discovery end.
|
|
254
420
|
async function disable() {
|
|
421
|
+
stopNearby();
|
|
255
422
|
const membership = store().setting('membership');
|
|
256
|
-
// A coordinator turned on again later must not silently trust old devices
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
423
|
+
// A coordinator turned on again later must not silently trust old devices,
|
|
424
|
+
// even when its listener could not start: the store itself is revoked.
|
|
425
|
+
for (const device of storedDevices()) if (!device.self && device.status === 'active') revokeStored(device.nodeId);
|
|
260
426
|
await stopAll();
|
|
261
427
|
store().replaceShares([], port.idFactory);
|
|
262
428
|
store().forgetAuthorities();
|
|
263
429
|
store().setSetting('membership', null);
|
|
264
430
|
store().setSetting('coordinator', null);
|
|
431
|
+
store().setSetting('reachedAddresses', null);
|
|
432
|
+
store().setSetting('pendingTrust', null);
|
|
433
|
+
listenFailure = null;
|
|
265
434
|
if (membership?.role === 'member') store().setSetting('pendingLeave', membership.coordinator);
|
|
266
435
|
await finishLeaving();
|
|
267
436
|
return status();
|
|
268
437
|
}
|
|
269
438
|
|
|
439
|
+
// ---- Coordinator trust, also while its listener is not running ----
|
|
440
|
+
|
|
441
|
+
// The devices this computer's coordinator store trusts, read from the running
|
|
442
|
+
// service or, when its listener could not start, from the store file itself.
|
|
443
|
+
function storedDevices() {
|
|
444
|
+
if (coordinator) return coordinator.service.devices();
|
|
445
|
+
const path = joinPath(port.directory, 'coordinator.sqlite');
|
|
446
|
+
if (!port.configured() || !existsSync(path) || store().setting('membership')?.role !== 'coordinator') return [];
|
|
447
|
+
const selfId = store().setting('membership').coordinator.fingerprint;
|
|
448
|
+
const coordinatorStore = createCoordinatorStore(path);
|
|
449
|
+
try {
|
|
450
|
+
return coordinatorStore.nodes().map((node) => ({ nodeId: node.id, name: node.name, status: node.status, self: node.id === selfId,
|
|
451
|
+
pairedAt: node.paired_at, revokedAt: node.revoked_at, lastSeenAt: node.last_seen_at ?? null, online: false,
|
|
452
|
+
sharedAgents: JSON.parse(node.directory_json).length }));
|
|
453
|
+
} finally { coordinatorStore.close(); }
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function revokeStored(nodeId) {
|
|
457
|
+
if (coordinator) coordinator.service.revoke(nodeId);
|
|
458
|
+
else {
|
|
459
|
+
const coordinatorStore = createCoordinatorStore(joinPath(port.directory, 'coordinator.sqlite'));
|
|
460
|
+
try { coordinatorStore.revokeNode(nodeId, new Date(clock()).toISOString()); } finally { coordinatorStore.close(); }
|
|
461
|
+
}
|
|
462
|
+
store().forgetAuthority(nodeId);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// ---- Nearby pairing (rec issue 127) ----
|
|
466
|
+
|
|
467
|
+
const coordinatesOthers = () => storedDevices().some((device) => !device.self && device.status === 'active');
|
|
468
|
+
|
|
469
|
+
function trustedFingerprints() {
|
|
470
|
+
if (store().setting('membership')?.role === 'coordinator') {
|
|
471
|
+
return storedDevices().filter((device) => !device.self && device.status === 'active').map((device) => device.nodeId);
|
|
472
|
+
}
|
|
473
|
+
const membership = store().setting('membership');
|
|
474
|
+
return membership?.role === 'member' ? [membership.coordinator.fingerprint] : [];
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function nearbyRole() {
|
|
478
|
+
const settings = port.configured() ? store().setting('nearby') : null;
|
|
479
|
+
if (!settings) return { listening: false, reason: 'Turn nearby pairing on first' };
|
|
480
|
+
const membership = store().setting('membership');
|
|
481
|
+
if (membership?.role === 'member') {
|
|
482
|
+
return { listening: false, reason: `This computer is paired through ${membership.coordinator.name}; pair other computers there` };
|
|
483
|
+
}
|
|
484
|
+
if (!coordinator) return { listening: false, reason: 'This computer is not listening for nearby pairing' };
|
|
485
|
+
return { listening: true, coordinatesOthers: coordinatesOthers(), listenPort: coordinator.server.address.port };
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
async function nearbyView() {
|
|
489
|
+
const settings = port.configured() ? store().setting('nearby') : null;
|
|
490
|
+
const trusted = settings ? trustedFingerprints() : [];
|
|
491
|
+
const role = nearbyRole();
|
|
492
|
+
const budget = attempts.summary();
|
|
493
|
+
return { on: Boolean(settings), name: settings?.name ?? null,
|
|
494
|
+
suggestedName: port.configured() ? defaultName(await identity()) : null,
|
|
495
|
+
canPair: role.listening && !budget.limited, reason: settings && !role.listening ? role.reason : null,
|
|
496
|
+
until: settings?.until ? new Date(settings.until).toISOString() : null,
|
|
497
|
+
attempts: budget, limited: budget.limited,
|
|
498
|
+
devices: settings ? presence.list().map((entry) => ({ ...entry,
|
|
499
|
+
paired: trusted.some((fingerprint) => fingerprint.startsWith(entry.fingerprint)) })) : [],
|
|
500
|
+
...honestOutcome(pairing.view(), nearbyNotice) };
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// Paired means the other computer used the trust this one wrote: until its
|
|
504
|
+
// first connection the card says waiting, and after a withdrawal it says so.
|
|
505
|
+
function honestOutcome(view, notice) {
|
|
506
|
+
if (!port.configured()) return { pairing: view, ended: notice };
|
|
507
|
+
const pending = new Set((store().setting('pendingTrust') ?? []).map((entry) => entry.fingerprint));
|
|
508
|
+
const devices = store().setting('membership')?.role === 'coordinator' ? storedDevices() : [];
|
|
509
|
+
const outcome = (fingerprint) => {
|
|
510
|
+
const device = devices.find((entry) => entry.nodeId === fingerprint);
|
|
511
|
+
if (device?.status === 'revoked') return 'trust_withdrawn';
|
|
512
|
+
const used = device?.lastSeenAt && Date.parse(device.lastSeenAt) >= Date.parse(device.pairedAt);
|
|
513
|
+
return pending.has(fingerprint) && device?.status === 'active' && !used ? 'waiting' : null;
|
|
514
|
+
};
|
|
515
|
+
const viewOutcome = view?.state === 'paired' && view.device.fingerprint ? outcome(view.device.fingerprint) : null;
|
|
516
|
+
const noticeOutcome = notice?.kind === 'paired' && notice.fingerprint ? outcome(notice.fingerprint) : null;
|
|
517
|
+
return { pairing: viewOutcome ? { ...view, state: viewOutcome } : view,
|
|
518
|
+
ended: noticeOutcome === 'waiting' ? { ...notice, kind: 'waiting' } : notice };
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
async function startNearby() {
|
|
522
|
+
const settings = store().setting('nearby');
|
|
523
|
+
if (!settings) return;
|
|
524
|
+
const device = await identity();
|
|
525
|
+
presence.browse(device.fingerprint);
|
|
526
|
+
if (coordinator) {
|
|
527
|
+
presence.advertise({ name: settings.name, port: coordinator.server.address.port, fingerprint: device.fingerprint,
|
|
528
|
+
addresses: coordinator.host === NEARBY_LISTEN_HOST ? announcedAddresses(interfaces) : [coordinator.host] });
|
|
529
|
+
} else presence.stopAdvertising();
|
|
530
|
+
clearTimeout(nearbyTimer);
|
|
531
|
+
nearbyTimer = setTimeout(() => endNearby({ kind: 'timeout' }).catch(onError), Math.max(0, settings.until - clock()));
|
|
532
|
+
nearbyTimer.unref?.();
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
function stopNearby() {
|
|
536
|
+
clearTimeout(nearbyTimer);
|
|
537
|
+
nearbyTimer = null;
|
|
538
|
+
pairing.close();
|
|
539
|
+
presence.stop();
|
|
540
|
+
if (port.configured()) store().setSetting('nearby', null);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// Turns nearby pairing on: advertise, list the others, and listen for a
|
|
544
|
+
// pairing request. A computer not yet paired opens its own listener for it;
|
|
545
|
+
// one that listens on an address the person chose listens everywhere for now
|
|
546
|
+
// and returns to that address when nearby pairing turns off. Turning it on
|
|
547
|
+
// again while on keeps its end time.
|
|
548
|
+
async function nearbyOn({ name } = {}) {
|
|
549
|
+
const previous = store().setting('nearby');
|
|
550
|
+
const chosen = cleanName(name) || previous?.name || defaultName(await identity());
|
|
551
|
+
const opened = !store().setting('membership');
|
|
552
|
+
let previousHost = previous?.previousHost ?? null;
|
|
553
|
+
if (opened) {
|
|
554
|
+
if (store().setting('pendingLeave')) throw new PeerError('leave_pending', 'The previous coordinator is offline. Retry after it is available, or revoke this device there.', 409);
|
|
555
|
+
await startCoordinator({ host: nearbyListenHost, port: 0, name: chosen });
|
|
556
|
+
} else if (!previous && coordinator && coordinator.host !== NEARBY_LISTEN_HOST && coordinator.host !== nearbyListenHost) {
|
|
557
|
+
previousHost = coordinator.host;
|
|
558
|
+
await rebindCoordinator(nearbyListenHost);
|
|
559
|
+
} else if (!previous && !coordinator && store().setting('membership')?.role === 'coordinator') {
|
|
560
|
+
throw new PeerError('listen_failed', 'The LAN roundtable is not listening; turn it off and on again first', 409);
|
|
561
|
+
}
|
|
562
|
+
nearbyNotice = null;
|
|
563
|
+
store().setSetting('nearby', { name: chosen, openedListener: opened || Boolean(previous?.openedListener), previousHost,
|
|
564
|
+
until: previous?.until > clock() ? previous.until : clock() + nearbySessionMs });
|
|
565
|
+
if (opened) await startRunner();
|
|
566
|
+
await startNearby();
|
|
567
|
+
return status();
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
async function nearbyOff() {
|
|
571
|
+
await endNearby(null);
|
|
572
|
+
return status();
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// Stops advertising and listing. A listener nearby pairing opened, with no
|
|
576
|
+
// device paired through it, closes too, so nothing listens while off; one
|
|
577
|
+
// that had an address the person chose returns to it; otherwise it narrows
|
|
578
|
+
// to the address its paired devices use.
|
|
579
|
+
async function endNearby(notice) {
|
|
580
|
+
const settings = port.configured() ? store().setting('nearby') : null;
|
|
581
|
+
stopNearby();
|
|
582
|
+
if (notice) nearbyNotice = { ...notice, at: new Date(clock()).toISOString() };
|
|
583
|
+
if (settings?.openedListener && store().setting('membership')?.role === 'coordinator' && !coordinatesOthers()) await disable();
|
|
584
|
+
else if (settings?.previousHost && coordinator?.host !== settings.previousHost) await rebindCoordinator(settings.previousHost);
|
|
585
|
+
else await narrowListener();
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function afterPairing(peer) {
|
|
589
|
+
nearbyNotice = { kind: 'paired', name: peer.name, fingerprint: peer.fingerprint, at: new Date(clock()).toISOString() };
|
|
590
|
+
const timer = setTimeout(() => endNearby({ kind: 'paired', name: peer.name, fingerprint: peer.fingerprint }).catch(onError), pairedGraceMs);
|
|
591
|
+
timer.unref?.();
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// Where each paired device last reached this listener, kept across restarts.
|
|
595
|
+
function rememberReached(nodeId, address) {
|
|
596
|
+
store().setSetting('reachedAddresses', { ...(store().setting('reachedAddresses') ?? {}), [nodeId]: address });
|
|
597
|
+
if (!store().setting('nearby')) narrowListener().catch(onError);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// While nearby pairing is off, a wildcard listener moves to the one address
|
|
601
|
+
// its paired devices reached it on, or, when none has connected yet, to this
|
|
602
|
+
// computer's first physical LAN address; devices on several addresses keep it everywhere.
|
|
603
|
+
async function narrowListener() {
|
|
604
|
+
if (!coordinator || coordinator.host !== NEARBY_LISTEN_HOST || store().setting('nearby')) return;
|
|
605
|
+
const reached = store().setting('reachedAddresses') ?? {};
|
|
606
|
+
const addresses = new Set(trustedFingerprints().map((nodeId) => reached[nodeId]).filter((address) => address && !LOOPBACK.test(address)));
|
|
607
|
+
const address = addresses.size === 1 ? [...addresses][0] : addresses.size === 0 ? localAddresses()[0] : null;
|
|
608
|
+
if (address) await rebindCoordinator(address);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
// Moves the listener to another address on the same port. When that fails it
|
|
612
|
+
// tries the address it had; when that fails too nothing listens and the
|
|
613
|
+
// card and `fuli peer status` say why. Trust never changes here.
|
|
614
|
+
async function rebindCoordinator(address) {
|
|
615
|
+
const settings = store().setting('coordinator');
|
|
616
|
+
await stopAll();
|
|
617
|
+
try { await startCoordinator({ host: address, port: settings.port, name: settings.name }); }
|
|
618
|
+
catch (error) {
|
|
619
|
+
onError(error);
|
|
620
|
+
const failure = listenFailure;
|
|
621
|
+
try { await startCoordinator({ host: settings.host, port: settings.port, name: settings.name }); }
|
|
622
|
+
catch (again) { onError(again); return; }
|
|
623
|
+
listenFailure = failure;
|
|
624
|
+
}
|
|
625
|
+
await startRunner();
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// Trust written for a nearby pairing is kept only once the other computer
|
|
629
|
+
// used it; a side that never finished leaves nothing trusted here. The
|
|
630
|
+
// deadline is stored, so a restart inside it still checks.
|
|
631
|
+
function watchTrustUse(peer) {
|
|
632
|
+
const pending = (store().setting('pendingTrust') ?? []).filter((entry) => entry.fingerprint !== peer.fingerprint);
|
|
633
|
+
store().setSetting('pendingTrust', [...pending, { fingerprint: peer.fingerprint, name: peer.name, deadline: clock() + trustUseMs }]);
|
|
634
|
+
scheduleTrustCheck(trustUseMs);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
function scheduleTrustCheck(delayMs) {
|
|
638
|
+
const timer = setTimeout(() => { trustChecks.delete(timer); checkPendingTrust(); }, delayMs);
|
|
639
|
+
timer.unref?.();
|
|
640
|
+
trustChecks.add(timer);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function checkPendingTrust() {
|
|
644
|
+
if (!port.configured()) return;
|
|
645
|
+
const pending = store().setting('pendingTrust') ?? [];
|
|
646
|
+
if (!pending.length) return;
|
|
647
|
+
const now = clock();
|
|
648
|
+
const devices = storedDevices();
|
|
649
|
+
const waiting = [];
|
|
650
|
+
for (const entry of pending) {
|
|
651
|
+
const device = devices.find((candidate) => candidate.nodeId === entry.fingerprint && candidate.status === 'active');
|
|
652
|
+
const used = device?.lastSeenAt && Date.parse(device.lastSeenAt) >= Date.parse(device.pairedAt);
|
|
653
|
+
if (!device || used) continue;
|
|
654
|
+
if (entry.deadline > now) { waiting.push(entry); continue; }
|
|
655
|
+
revokeStored(entry.fingerprint);
|
|
656
|
+
nearbyNotice = { kind: 'trust_withdrawn', name: entry.name, at: new Date(now).toISOString() };
|
|
657
|
+
}
|
|
658
|
+
store().setSetting('pendingTrust', waiting.length ? waiting : null);
|
|
659
|
+
if (waiting.length) scheduleTrustCheck(Math.max(0, Math.min(...waiting.map((entry) => entry.deadline)) - now));
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
function withdrawTrust(fingerprint) {
|
|
663
|
+
if (!storedDevices().some((entry) => entry.nodeId === fingerprint && entry.status === 'active')) return;
|
|
664
|
+
revokeStored(fingerprint);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
async function pairNearby({ fingerprint }) {
|
|
668
|
+
const prefix = String(fingerprint ?? '').replace(/\s+/g, '').toLowerCase();
|
|
669
|
+
if (!/^[0-9a-f]{4,64}$/.test(prefix)) {
|
|
670
|
+
throw new PeerError('invalid_fingerprint', 'Pass at least the first 4 characters of a fingerprint from the nearby list', 422);
|
|
671
|
+
}
|
|
672
|
+
const matches = presence.list().filter((entry) => prefix.startsWith(entry.fingerprint) || entry.fingerprint.startsWith(prefix));
|
|
673
|
+
if (!matches.length) throw new PeerError('nearby_not_found', 'No nearby FULI has that fingerprint; list them again', 404);
|
|
674
|
+
if (matches.length > 1) throw new PeerError('nearby_ambiguous', 'Several nearby FULI start with that fingerprint; pass more of it', 409);
|
|
675
|
+
await pairing.start(matches[0]);
|
|
676
|
+
return status();
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
async function confirmPairing({ requestId, code }) {
|
|
680
|
+
pairing.confirm({ requestId, code });
|
|
681
|
+
return status();
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
async function cancelPairing() {
|
|
685
|
+
pairing.cancel();
|
|
686
|
+
return status();
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// The person on this computer clears the pairing attempts (local only, never an Agent).
|
|
690
|
+
async function clearPairingAttempts() {
|
|
691
|
+
if (port.configured()) attempts.clear();
|
|
692
|
+
return status();
|
|
693
|
+
}
|
|
694
|
+
|
|
270
695
|
// Local execution stops even if the coordinator is offline. Keep only the
|
|
271
696
|
// unpairing request until it can be delivered, without resuming any shares.
|
|
272
697
|
function finishLeaving() {
|
|
@@ -281,8 +706,7 @@ export function createPeerRuntime({ host, roundtable, port, interfaces = network
|
|
|
281
706
|
const previous = store().setting('pendingLeave');
|
|
282
707
|
if (!previous) return;
|
|
283
708
|
leaveAbort = new AbortController();
|
|
284
|
-
const
|
|
285
|
-
const client = createPeerClient({ identity, coordinator: previous });
|
|
709
|
+
const client = createPeerClient({ identity: await identity(), coordinator: previous });
|
|
286
710
|
try {
|
|
287
711
|
await client.post('/peer/1/leave', {}, { timeoutMs: 2_000, signal: leaveAbort.signal });
|
|
288
712
|
store().setSetting('pendingLeave', null);
|
|
@@ -297,6 +721,40 @@ export function createPeerRuntime({ host, roundtable, port, interfaces = network
|
|
|
297
721
|
} finally { client.close(); }
|
|
298
722
|
}
|
|
299
723
|
|
|
724
|
+
async function close() {
|
|
725
|
+
clearTimeout(nearbyTimer);
|
|
726
|
+
for (const timer of trustChecks) clearTimeout(timer);
|
|
727
|
+
trustChecks.clear();
|
|
728
|
+
pairing.close();
|
|
729
|
+
presence.stop();
|
|
730
|
+
await stopAll();
|
|
731
|
+
}
|
|
732
|
+
|
|
300
733
|
return { resume, status, enableCoordinator, createInvitation, previewInvitation, join, setShares, revokeDevice, disable,
|
|
301
|
-
publish, close
|
|
734
|
+
nearbyOn, nearbyOff, pairNearby, confirmPairing, cancelPairing, clearPairingAttempts, publish, close, runnerActive: () => Boolean(runner) };
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
// The name another computer sees until the person types one: never this computer's own name.
|
|
738
|
+
function defaultName(device) {
|
|
739
|
+
return `FULI ${device.fingerprint.slice(12, 16).toUpperCase()}`;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// A failure's code as shown to the person: a known word, never free text.
|
|
743
|
+
// Codes the coordinator answers with that this computer knows; any other word it sends reads as coordinator_error.
|
|
744
|
+
const COORDINATOR_CODES = new Set(['invalid_directory', 'device_not_trusted', 'payload_too_large', 'invalid_json',
|
|
745
|
+
'unsupported_media_type', 'certificate_required', 'not_found', 'internal_error', 'queue_full']);
|
|
746
|
+
function failureCode(error) {
|
|
747
|
+
const code = typeof error?.code === 'string' ? error.code : 'error';
|
|
748
|
+
if (error?.remote) return COORDINATOR_CODES.has(code) ? code : 'coordinator_error';
|
|
749
|
+
return /^[A-Za-z0-9_]{1,40}$/.test(code) ? code : 'error';
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
function validKey(value) {
|
|
753
|
+
return typeof value?.id === 'string' && typeof value?.key === 'string' && value.key.length >= 32;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
// One project's own repository addresses (host Project.repositories) keyed
|
|
757
|
+
// with the paired group's secret; the same address gives the same digest.
|
|
758
|
+
function projectDigests(project, key) {
|
|
759
|
+
return (project.repositories ?? []).map((address) => createHmac('sha256', key.key).update(`fuli-repository:${address}`).digest('hex').slice(0, 32));
|
|
302
760
|
}
|