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
|
@@ -10,6 +10,20 @@ import { immediateTransaction, openFormattedDatabase, sqliteFormat } from '../..
|
|
|
10
10
|
// No item text, names or summaries are stored: ids, rank,
|
|
11
11
|
// score and confirmation status only. task_key is a SHA-256 hex of the task
|
|
12
12
|
// context token, so the token itself is never stored.
|
|
13
|
+
// task_deliveries (version 2): per task, the client it entered from and which
|
|
14
|
+
// of the person's effective preferences FULI delivered with its entry, as
|
|
15
|
+
// "kind:id" keys, so the compounding statement can count what was carried
|
|
16
|
+
// into tasks. Tasks before version 2 have recall rows only.
|
|
17
|
+
const TASK_DELIVERIES = `
|
|
18
|
+
CREATE TABLE IF NOT EXISTS task_deliveries(
|
|
19
|
+
task_key TEXT PRIMARY KEY,
|
|
20
|
+
personal_space_id TEXT NOT NULL,
|
|
21
|
+
source_application TEXT NOT NULL,
|
|
22
|
+
delivered_at TEXT NOT NULL,
|
|
23
|
+
preference_keys TEXT NOT NULL);
|
|
24
|
+
CREATE INDEX IF NOT EXISTS task_deliveries_at ON task_deliveries(delivered_at);
|
|
25
|
+
CREATE INDEX IF NOT EXISTS recall_impressions_shown_at ON recall_impressions(shown_at);`;
|
|
26
|
+
|
|
13
27
|
export const RECALL_IMPRESSIONS_FORMAT = sqliteFormat({
|
|
14
28
|
store: 'recall-impressions',
|
|
15
29
|
schema: `
|
|
@@ -25,12 +39,23 @@ export const RECALL_IMPRESSIONS_FORMAT = sqliteFormat({
|
|
|
25
39
|
shown_at TEXT NOT NULL,
|
|
26
40
|
use_kind TEXT CHECK(use_kind IN ('cited','applied')),
|
|
27
41
|
used_at TEXT,
|
|
28
|
-
PRIMARY KEY(task_key, item_kind, item_id))
|
|
42
|
+
PRIMARY KEY(task_key, item_kind, item_id));`,
|
|
43
|
+
migrations: [{
|
|
44
|
+
id: 'recall-impressions/2-task-deliveries', to: 2, kind: 'add-table', table: 'task_deliveries',
|
|
45
|
+
summary: 'per task, its client and the preferences its entry delivered, and a time index for the retention cut',
|
|
46
|
+
create: TASK_DELIVERIES
|
|
47
|
+
}]
|
|
29
48
|
});
|
|
30
49
|
|
|
31
50
|
// Rows older than this are deleted on the next write.
|
|
32
51
|
const RETENTION_DAYS = 180;
|
|
33
52
|
const RETENTION_MS = RETENTION_DAYS * 24 * 60 * 60 * 1000;
|
|
53
|
+
// What the statement counts as carried in [from, to): recall rows and task
|
|
54
|
+
// entries of one space; bound with (personalSpaceId, from, to).
|
|
55
|
+
const RECALL_IN_WINDOW = 'FROM recall_impressions WHERE personal_space_id = ? AND shown_at >= ? AND shown_at < ?';
|
|
56
|
+
const ENTRIES_IN_WINDOW = 'FROM task_deliveries WHERE personal_space_id = ? AND delivered_at >= ? AND delivered_at < ?';
|
|
57
|
+
// A task entry's preference list is bounded by the Provider; this caps what one row keeps.
|
|
58
|
+
const MAX_DELIVERED_PREFERENCES = 100;
|
|
34
59
|
|
|
35
60
|
export class RecallImpressionsStore {
|
|
36
61
|
constructor(path = ':memory:', now = () => new Date()) {
|
|
@@ -52,32 +77,70 @@ export class RecallImpressionsStore {
|
|
|
52
77
|
return immediateTransaction(this.db, work);
|
|
53
78
|
}
|
|
54
79
|
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
// the
|
|
59
|
-
|
|
80
|
+
// What a task entry delivered: the recalled facts (relationships) and
|
|
81
|
+
// entities, rank being the 1-based position within each kind, and the
|
|
82
|
+
// effective preferences ({ id, item_kind }). One transaction; a second call
|
|
83
|
+
// for the same task does not duplicate rows. An entry that delivered
|
|
84
|
+
// nothing records nothing and never opens the store.
|
|
85
|
+
recordDelivered({ taskContextToken, personalSpaceId, personalProjectId, sourceApplication, facts, entities, preferences }) {
|
|
60
86
|
const rows = [
|
|
61
87
|
...(facts ?? []).map((item, index) => ({ kind: 'relationship', item, rank: index + 1 })),
|
|
62
88
|
...(entities ?? []).map((item, index) => ({ kind: 'entity', item, rank: index + 1 }))
|
|
63
89
|
];
|
|
64
|
-
|
|
90
|
+
const preferenceKeys = [...new Set((preferences ?? []).filter(item => item?.id)
|
|
91
|
+
.map(item => `${item.item_kind ?? 'entity'}:${item.id}`))].slice(0, MAX_DELIVERED_PREFERENCES);
|
|
92
|
+
if (!rows.length && !preferenceKeys.length) return;
|
|
65
93
|
const taskKey = taskKeyFor(taskContextToken);
|
|
66
94
|
const now = this.now();
|
|
67
|
-
const
|
|
95
|
+
const deliveredAt = now.toISOString();
|
|
68
96
|
const cutoff = new Date(now.getTime() - RETENTION_MS).toISOString();
|
|
69
97
|
this.transaction(() => {
|
|
70
98
|
this.db.prepare('DELETE FROM recall_impressions WHERE shown_at < ?').run(cutoff);
|
|
99
|
+
this.db.prepare('DELETE FROM task_deliveries WHERE delivered_at < ?').run(cutoff);
|
|
71
100
|
const insert = this.db.prepare(`INSERT INTO recall_impressions
|
|
72
101
|
(task_key, personal_space_id, personal_project_id, item_kind, item_id, rank, score, confirmation_status, shown_at)
|
|
73
102
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(task_key, item_kind, item_id) DO NOTHING`);
|
|
74
103
|
for (const { kind, item, rank } of rows) {
|
|
75
104
|
insert.run(taskKey, personalSpaceId, personalProjectId ?? null, kind, item.id, rank,
|
|
76
|
-
item.score ?? null, item.confirmation_status ?? null,
|
|
105
|
+
item.score ?? null, item.confirmation_status ?? null, deliveredAt);
|
|
77
106
|
}
|
|
107
|
+
this.db.prepare(`INSERT INTO task_deliveries(task_key, personal_space_id, source_application, delivered_at, preference_keys)
|
|
108
|
+
VALUES (?, ?, ?, ?, ?) ON CONFLICT(task_key) DO NOTHING`)
|
|
109
|
+
.run(taskKey, personalSpaceId, sourceApplication ?? 'other', deliveredAt, JSON.stringify(preferenceKeys));
|
|
78
110
|
});
|
|
79
111
|
}
|
|
80
112
|
|
|
113
|
+
// What task entries carried in [from, to): distinct tasks that received
|
|
114
|
+
// recalled knowledge or preferences, their distinct clients and the
|
|
115
|
+
// distinct items. A task before version 2 counts by its recall alone and
|
|
116
|
+
// names no client. ISO instants as toISOString() writes them.
|
|
117
|
+
deliveredBetween({ personalSpaceId, from, to }) {
|
|
118
|
+
if (!this.readable) return { tasks: 0, clients: 0, items: 0 };
|
|
119
|
+
const window = [personalSpaceId, from, to];
|
|
120
|
+
const count = sql => this.db.prepare(sql).get(...window, ...window).count;
|
|
121
|
+
return {
|
|
122
|
+
tasks: count(`SELECT COUNT(*) AS count FROM (SELECT task_key ${RECALL_IN_WINDOW} UNION SELECT task_key ${ENTRIES_IN_WINDOW})`),
|
|
123
|
+
clients: this.db.prepare(`SELECT COUNT(DISTINCT source_application) AS count ${ENTRIES_IN_WINDOW}`).get(...window).count,
|
|
124
|
+
items: count(`SELECT COUNT(*) AS count FROM (SELECT item_kind || ':' || item_id ${RECALL_IN_WINDOW}
|
|
125
|
+
UNION SELECT key.value FROM task_deliveries, json_each(task_deliveries.preference_keys) AS key
|
|
126
|
+
WHERE personal_space_id = ? AND delivered_at >= ? AND delivered_at < ?)`)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// deliveredBetween's tasks per local day: the day is the stored UTC instant
|
|
131
|
+
// moved by offsetMinutes (the caller's UTC offset), as YYYY-MM-DD. One
|
|
132
|
+
// grouped read; days without a task are not listed.
|
|
133
|
+
deliveredTasksByDay({ personalSpaceId, from, to, offsetMinutes }) {
|
|
134
|
+
if (!this.readable) return [];
|
|
135
|
+
const shift = `${offsetMinutes >= 0 ? '+' : '-'}${Math.abs(offsetMinutes)} minutes`;
|
|
136
|
+
const window = [personalSpaceId, from, to];
|
|
137
|
+
return this.db.prepare(`SELECT day, COUNT(*) AS tasks FROM (
|
|
138
|
+
SELECT task_key, date(shown_at, ?) AS day ${RECALL_IN_WINDOW}
|
|
139
|
+
UNION SELECT task_key, date(delivered_at, ?) AS day ${ENTRIES_IN_WINDOW})
|
|
140
|
+
GROUP BY day ORDER BY day`).all(shift, ...window, shift, ...window)
|
|
141
|
+
.map(({ day, tasks }) => ({ day, tasks }));
|
|
142
|
+
}
|
|
143
|
+
|
|
81
144
|
// Only updates rows that exist: an item used but never shown is ignored, and a
|
|
82
145
|
// store nothing was ever shown in is not created.
|
|
83
146
|
markUsed({ taskContextToken, items }) {
|
|
@@ -53,6 +53,8 @@ const TOOL_RESULT_LIMIT_BYTES = Object.freeze({
|
|
|
53
53
|
read_agent_messages: 1024 * 1024,
|
|
54
54
|
read_agent_thread: 600 * 1024,
|
|
55
55
|
find_agents: 128 * 1024,
|
|
56
|
+
// A paired device's answer: at most 16 KB of shared knowledge (48 KB on the wire).
|
|
57
|
+
visit_shared_lead: 48 * 1024,
|
|
56
58
|
read_agent_conversation: 600 * 1024,
|
|
57
59
|
list_agent_conversations: 32 * 1024,
|
|
58
60
|
resume_agent_conversation: 24 * 1024,
|
package/src/mcp/session-id.js
CHANGED
|
@@ -7,7 +7,7 @@ const PROJECT_AGENT_SOURCE_TOOLS = new Set([
|
|
|
7
7
|
'search_knowledge_graph',
|
|
8
8
|
// The caller's client decides whether its own turns are recorded.
|
|
9
9
|
'get_capture_policy',
|
|
10
|
-
'find_agents', 'message_agent', 'read_agent_messages', 'reply_agent_message',
|
|
10
|
+
'find_agents', 'message_agent', 'visit_shared_lead', 'read_agent_messages', 'reply_agent_message',
|
|
11
11
|
'agent_chat', 'group_discussion',
|
|
12
12
|
'get_agent_message_status', 'cancel_agent_message',
|
|
13
13
|
'get_agent_quality_gate', 'record_agent_verification',
|
|
@@ -2,6 +2,8 @@ const READ_TOOLS = new Set([
|
|
|
2
2
|
'get_judgment_policy', 'list_judgments', 'get_agent_pins',
|
|
3
3
|
'get_model_usage',
|
|
4
4
|
'find_agents', 'read_agent_messages', 'read_agent_thread', 'get_agent_message_status',
|
|
5
|
+
// Reads a paired device's shared project; that device records the read.
|
|
6
|
+
'visit_shared_lead',
|
|
5
7
|
'get_agent_quality_gate',
|
|
6
8
|
'plan_agent_collaboration', 'list_agent_loans',
|
|
7
9
|
'list_agent_conversations', 'read_agent_conversation', 'get_agent_conversation_policy',
|
|
@@ -11,6 +13,7 @@ const READ_TOOLS = new Set([
|
|
|
11
13
|
'list_work_surfaces',
|
|
12
14
|
'read_diagnostic_events',
|
|
13
15
|
'read_old_data',
|
|
16
|
+
'read_compounding_statement',
|
|
14
17
|
'list_tonborg_questions',
|
|
15
18
|
'list_reply_echoes',
|
|
16
19
|
'read_occupation_kit',
|
|
@@ -172,7 +175,7 @@ export function annotationsFor(name) {
|
|
|
172
175
|
name === 'checkpoint_task_knowledge' ||
|
|
173
176
|
name === 'checkpoint_project_agent_memory' ||
|
|
174
177
|
name === 'register_standing_assignment',
|
|
175
|
-
openWorldHint: name === 'agent_chat' || name === 'group_discussion' || name === 'review_with_tonborg' || name === 'assess_agent_action' || name === 'assess_task_completion' || name === 'capture_session_knowledge' ||
|
|
178
|
+
openWorldHint: name === 'agent_chat' || name === 'group_discussion' || name === 'visit_shared_lead' || name === 'review_with_tonborg' || name === 'assess_agent_action' || name === 'assess_task_completion' || name === 'capture_session_knowledge' ||
|
|
176
179
|
name === 'discover_external_knowledge_sources' ||
|
|
177
180
|
name === 'create_external_knowledge_binding' ||
|
|
178
181
|
name === 'check_external_knowledge_binding' ||
|
|
@@ -124,10 +124,11 @@ async function teamChanges({ app, space, projectName }) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// A console change an FLA made for the person; its undo is described in AI permissions.
|
|
127
|
+
// status is the HTTP status; outcome says whether the change went through.
|
|
127
128
|
function delegatedChanges({ delegation }) {
|
|
128
129
|
const operations = delegation?.read().operations ?? [];
|
|
129
130
|
return operations
|
|
130
|
-
.filter(operation => operation.
|
|
131
|
+
.filter(operation => operation.outcome === 'succeeded')
|
|
131
132
|
.map(operation => notice('delegated_change', operation.id, operation.at, { reason: operation.reason ?? '' }, '/settings'));
|
|
132
133
|
}
|
|
133
134
|
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
// and writes its digest here before publishing (scripts/pin-win-helper.js); a
|
|
4
4
|
// source checkout has no helper and no pin, so Windows Hello is unavailable there.
|
|
5
5
|
// The helper is not Authenticode-signed: this digest is its only integrity check.
|
|
6
|
-
export const WIN_HELPER_SHA256 = '
|
|
6
|
+
export const WIN_HELPER_SHA256 = 'ee0e9e860bbf9f8c0773807722f039fc7392e19109ea838496ce3c5372ef8e9f';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { InvalidInputError } from '../app/application-error.js';
|
|
2
|
+
import { compoundingStatement, currentLocalWeek, statementWindow } from './compounding-statement.js';
|
|
3
|
+
|
|
4
|
+
// read_compounding_statement: the same answer as GET /api/statement, plus one
|
|
5
|
+
// line per number saying who stands behind it. An Agent's report is its own
|
|
6
|
+
// claim; FULI did not see the work.
|
|
7
|
+
const PROVENANCE = Object.freeze({
|
|
8
|
+
total: ['total.confirmed: observed, items FULI holds as confirmed now'],
|
|
9
|
+
series: ['series: observed, confirmed items at each week end'],
|
|
10
|
+
carried: ['carried.tasks, carried.clients, carried.items: observed, what FULI delivered at task entry'],
|
|
11
|
+
used: ['used.times, used.tasks, used.cited, used.applied: reported, Agents\' own claims that knowledge mattered'],
|
|
12
|
+
learned: ['learned.captured, learned.retired: observed, items FULI stored or ended',
|
|
13
|
+
'learned.confirmedByYou, learned.confirmedByTonborg: observed, confirmations FULI recorded',
|
|
14
|
+
'learned.promotedByUse: observed, FULI\'s rule applied to uses Agents reported'],
|
|
15
|
+
decided: ['decided.forYou, decided.undone: observed, Tonborg\'s applied decisions and your undos'],
|
|
16
|
+
changed: ['changed.forYou: observed, console changes FLAs made for you that succeeded'],
|
|
17
|
+
done: ['done.finished, done.failed: reported, the status Agents gave their tasks'],
|
|
18
|
+
answered: ['answered.questions: observed, Agent questions you answered in FULI']
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const STATEMENT_HANDLERS = Object.freeze({
|
|
22
|
+
read_compounding_statement: async (app, { from, to, weeks } = {}) => {
|
|
23
|
+
if ((from === undefined) !== (to === undefined)) throw new InvalidInputError('pass from and to together, or neither for this week');
|
|
24
|
+
const window = from === undefined ? currentLocalWeek() : { from, to };
|
|
25
|
+
const statement = await compoundingStatement(app, statementWindow({ ...window, ...(weeks === undefined ? {} : { weeks }) }));
|
|
26
|
+
return { ...statement,
|
|
27
|
+
provenance: Object.entries(PROVENANCE).filter(([section]) => section in statement).flatMap(([, lines]) => lines) };
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { InvalidInputError } from '../app/application-error.js';
|
|
2
|
+
import { positiveInteger } from '../validation/values.js';
|
|
3
|
+
|
|
4
|
+
// The person's compounding statement (复利账单): for one window, only the
|
|
5
|
+
// numbers FULI really has. Each section comes from one source read once; a
|
|
6
|
+
// source that cannot be read now is named in `unavailable` and its sections
|
|
7
|
+
// are left out, never zeroed or estimated. The graph's part is one Provider
|
|
8
|
+
// call (five aggregate reads); the rest are local SQLite counts. Nothing here
|
|
9
|
+
// runs at task entry.
|
|
10
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
11
|
+
const WEEK_MS = 7 * DAY_MS;
|
|
12
|
+
const MAX_WINDOW_MS = 366 * DAY_MS;
|
|
13
|
+
// The calendar's 53 weeks and a few days to spare; the Provider holds the same cap.
|
|
14
|
+
const MAX_DAYS = 371;
|
|
15
|
+
export const DEFAULT_WEEKS = 8;
|
|
16
|
+
export const MAX_WEEKS = 26;
|
|
17
|
+
const INSTANT = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
18
|
+
|
|
19
|
+
// from/to: ISO instants with a zone (the person's local week bounds, as the
|
|
20
|
+
// caller computed them); weeks: how many week-end points the series has.
|
|
21
|
+
export function statementWindow({ from, to, weeks = DEFAULT_WEEKS }) {
|
|
22
|
+
const start = instant(from, 'from');
|
|
23
|
+
const end = instant(to, 'to');
|
|
24
|
+
if (start >= end) throw new InvalidInputError('from must be before to');
|
|
25
|
+
if (end - start > MAX_WINDOW_MS) throw new InvalidInputError('from and to may be at most 366 days apart');
|
|
26
|
+
return { from: start, to: end, weeks: positiveInteger(weeks, 'weeks', MAX_WEEKS) };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// This machine's current local week, Monday 00:00 to the next Monday.
|
|
30
|
+
export function currentLocalWeek(now = new Date()) {
|
|
31
|
+
const start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - ((now.getDay() + 6) % 7));
|
|
32
|
+
const end = new Date(start.getFullYear(), start.getMonth(), start.getDate() + 7);
|
|
33
|
+
return { from: start.toISOString(), to: end.toISOString() };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function compoundingStatement(app, { from, to, weeks }) {
|
|
37
|
+
const space = app.config.personal.spaceId;
|
|
38
|
+
const window = { from: from.toISOString(), to: to.toISOString() };
|
|
39
|
+
const points = Array.from({ length: weeks }, (_, index) => new Date(to.getTime() - (weeks - 1 - index) * WEEK_MS).toISOString());
|
|
40
|
+
const [graph, carried, decided, changed] = await Promise.all([
|
|
41
|
+
settle(() => app.personal.readKnowledgeStatement({ personal_space_id: space, since: window.from, until: window.to, points })),
|
|
42
|
+
settle(() => app.recallImpressions.deliveredBetween({ personalSpaceId: space, ...window })),
|
|
43
|
+
settle(() => app.judgment.store().executionCounts(space, window.from, window.to)),
|
|
44
|
+
settle(() => app.delegatedOperations.succeededBetween(window.from, window.to))
|
|
45
|
+
]);
|
|
46
|
+
const unavailable = [];
|
|
47
|
+
const section = (names, result, shape) => {
|
|
48
|
+
if (result) return shape(result.value);
|
|
49
|
+
unavailable.push(...names);
|
|
50
|
+
return {};
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
window,
|
|
54
|
+
...section(['total', 'series'], graph, value => ({
|
|
55
|
+
total: { confirmed: value.series.at(-1) },
|
|
56
|
+
series: points.map((point, index) => ({ to: point, confirmed: value.series[index] }))
|
|
57
|
+
})),
|
|
58
|
+
...section(['carried'], carried, value => ({ carried: value })),
|
|
59
|
+
...section(['used', 'learned'], graph, value => ({
|
|
60
|
+
used: value.used,
|
|
61
|
+
learned: { captured: value.learned.captured, confirmedByYou: value.learned.confirmed_by_you,
|
|
62
|
+
confirmedByTonborg: value.learned.confirmed_by_tonborg, promotedByUse: value.learned.promoted_by_use,
|
|
63
|
+
retired: value.learned.retired }
|
|
64
|
+
})),
|
|
65
|
+
...section(['decided'], decided, value => ({ decided: { forYou: value.applied, undone: value.undone } })),
|
|
66
|
+
...section(['changed'], changed, value => ({ changed: { forYou: value } })),
|
|
67
|
+
...section(['done', 'answered'], graph, value => ({
|
|
68
|
+
done: value.done,
|
|
69
|
+
answered: { questions: value.answered }
|
|
70
|
+
})),
|
|
71
|
+
unavailable
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// The statement day by day (the console's calendar): from/to carry the
|
|
76
|
+
// person's UTC offset, one and the same, and a day is a local day of it.
|
|
77
|
+
export function statementDaysWindow({ from, to }) {
|
|
78
|
+
const start = instant(from, 'from');
|
|
79
|
+
const end = instant(to, 'to');
|
|
80
|
+
if (start >= end) throw new InvalidInputError('from must be before to');
|
|
81
|
+
if (end - start > MAX_DAYS * DAY_MS) throw new InvalidInputError(`from and to may be at most ${MAX_DAYS} days apart`);
|
|
82
|
+
const offsetMinutes = offsetOf(from);
|
|
83
|
+
if (offsetMinutes !== offsetOf(to)) throw new InvalidInputError('from and to must carry the same UTC offset');
|
|
84
|
+
return { from, to, start, end, offsetMinutes };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Per local day, the weekly statement's own measures where they are cheap to
|
|
88
|
+
// cut by day: learned (learned.captured), confirmed (learned.confirmedByYou +
|
|
89
|
+
// confirmedByTonborg + promotedByUse), used (used.times) from one Provider
|
|
90
|
+
// call, carried (carried.tasks) from one grouped local read. Days with
|
|
91
|
+
// nothing are left out; a source that cannot be read is named in
|
|
92
|
+
// `unavailable` and its measures are left out of every day.
|
|
93
|
+
export async function statementDays(app, { from, to, start, end, offsetMinutes }) {
|
|
94
|
+
const space = app.config.personal.spaceId;
|
|
95
|
+
const [graph, carried] = await Promise.all([
|
|
96
|
+
settle(() => app.personal.readKnowledgeStatementDays({ personal_space_id: space, since: from, until: to })),
|
|
97
|
+
settle(() => app.recallImpressions.deliveredTasksByDay({ personalSpaceId: space, from: start.toISOString(),
|
|
98
|
+
to: end.toISOString(), offsetMinutes }))
|
|
99
|
+
]);
|
|
100
|
+
const days = new Map();
|
|
101
|
+
const add = (day, counts) => days.set(day, { ...days.get(day), ...counts });
|
|
102
|
+
for (const { day, learned, confirmed, used } of graph?.value.days ?? []) add(day, { learned, confirmed, used });
|
|
103
|
+
for (const { day, tasks } of carried?.value ?? []) add(day, { carried: tasks });
|
|
104
|
+
const blank = { ...(graph ? { learned: 0, confirmed: 0, used: 0 } : {}), ...(carried ? { carried: 0 } : {}) };
|
|
105
|
+
return {
|
|
106
|
+
window: { from: start.toISOString(), to: end.toISOString() },
|
|
107
|
+
days: [...days].sort(([left], [right]) => left.localeCompare(right))
|
|
108
|
+
.map(([day, counts]) => ({ day, ...blank, ...counts }))
|
|
109
|
+
.filter(entry => Object.values(entry).some(value => typeof value === 'number' && value > 0)),
|
|
110
|
+
unavailable: [...(graph ? [] : ['learned', 'confirmed', 'used']), ...(carried ? [] : ['carried'])]
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function offsetOf(value) {
|
|
115
|
+
const zone = value.match(/(Z|[+-]\d{2}:\d{2})$/)[1];
|
|
116
|
+
if (zone === 'Z') return 0;
|
|
117
|
+
const minutes = Number(zone.slice(1, 3)) * 60 + Number(zone.slice(4));
|
|
118
|
+
return zone[0] === '-' ? -minutes : minutes;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function instant(value, label) {
|
|
122
|
+
const parsed = typeof value === 'string' && INSTANT.test(value) ? Date.parse(value) : NaN;
|
|
123
|
+
if (Number.isNaN(parsed)) throw new InvalidInputError(`${label} must be an ISO 8601 instant with a time zone`);
|
|
124
|
+
return new Date(parsed);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// A source that throws, or is not there at all, is unavailable.
|
|
128
|
+
async function settle(read) {
|
|
129
|
+
try {
|
|
130
|
+
return { value: await read() };
|
|
131
|
+
} catch {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Text with every control, format (zero-width, bidirectional override and
|
|
2
|
+
// isolate, tag characters) and lone surrogate character replaced by a space,
|
|
3
|
+
// whitespace runs collapsed and the ends trimmed: what a person can read, with
|
|
4
|
+
// nothing that hides or reorders it.
|
|
5
|
+
const CONTROLS = /[\p{Cc}\p{Cf}\p{Cs}]+/gu;
|
|
6
|
+
|
|
7
|
+
export function withoutControls(value) {
|
|
8
|
+
return String(value ?? '').replace(CONTROLS, ' ').replace(/\s+/gu, ' ').trim();
|
|
9
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// A file-system path of this computer inside text. Text that leaves this
|
|
2
|
+
// computer's own process (a diagnostic event, a visitor's search answer)
|
|
3
|
+
// names no such path; when unsure, more is replaced rather than less.
|
|
4
|
+
//
|
|
5
|
+
// A folder name may hold spaces: a segment followed by another separator is
|
|
6
|
+
// part of the path whatever it contains (C:\Users\First Last\file.txt).
|
|
7
|
+
//
|
|
8
|
+
// mode 'strict' (the default, a visitor's answer) also follows spaces in the
|
|
9
|
+
// last segment, preferring to replace too much:
|
|
10
|
+
// - every absolute POSIX path counts, under any root;
|
|
11
|
+
// - a drive or UNC path runs to the end of its line or quoted string
|
|
12
|
+
// (C:\Users\Alice\Private Repo);
|
|
13
|
+
// - a POSIX, home or relative path takes the following words on its line up
|
|
14
|
+
// to the last one, within eight, that holds a separator or ends in a dot
|
|
15
|
+
// extension (/home/alice/my folder/file.txt); words after it that do neither
|
|
16
|
+
// stay (see /opt/app for details).
|
|
17
|
+
// mode 'keep-routes' (a diagnostic event) treats only home, mount and system
|
|
18
|
+
// roots as POSIX paths and follows no spaces after the path: its operations
|
|
19
|
+
// name the console's own routes (POST /api/tasks) and the prose after them.
|
|
20
|
+
const SEGMENTS = String.raw`(?:[^\\/\r\n"'<>|*?]*[\\/])*[^\s\\/"'<>|*?]*`;
|
|
21
|
+
const WORD = String.raw`[^\s"'<>]`;
|
|
22
|
+
const PATH_WORDS = String.raw`(?:(?:[ \t]${WORD}+){0,7}?[ \t]${WORD}*?(?:[\\/]|\.[A-Za-z0-9]{1,8}(?!\w))${WORD}*)*`;
|
|
23
|
+
const TO_LINE_END = String.raw`[^\r\n"'<>|]*`;
|
|
24
|
+
const FILE_URL = String.raw`\bfile:[^\s"'<>]*`;
|
|
25
|
+
const HOME_OR_RELATIVE = String.raw`(?<![\w.~])(?:~|\.{1,2})[\\/]${SEGMENTS}`;
|
|
26
|
+
const POSIX = String.raw`(?<![\w.:/\\~-])\/`;
|
|
27
|
+
const SYSTEM_ROOTS = '(?:home|Users|mnt|root|tmp|var|private|etc|opt|Volumes|usr|srv|media|run)(?:/|\\b)';
|
|
28
|
+
|
|
29
|
+
const PATTERNS = Object.freeze({
|
|
30
|
+
strict: new RegExp([
|
|
31
|
+
FILE_URL,
|
|
32
|
+
String.raw`\b[A-Za-z]:[\\/]${TO_LINE_END}`,
|
|
33
|
+
String.raw`\\\\${TO_LINE_END}`,
|
|
34
|
+
`${HOME_OR_RELATIVE}${PATH_WORDS}`,
|
|
35
|
+
String.raw`${POSIX}[^\s/"'<>]+[^\s"'<>]*${PATH_WORDS}`
|
|
36
|
+
].join('|'), 'gi'),
|
|
37
|
+
'keep-routes': new RegExp([
|
|
38
|
+
FILE_URL,
|
|
39
|
+
String.raw`\b[A-Za-z]:[\\/]${SEGMENTS}`,
|
|
40
|
+
String.raw`\\\\${SEGMENTS}`,
|
|
41
|
+
HOME_OR_RELATIVE,
|
|
42
|
+
String.raw`${POSIX}${SYSTEM_ROOTS}[^\s"'<>]*`
|
|
43
|
+
].join('|'), 'gi')
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export function withoutLocalPaths(text, { mode = 'strict' } = {}) {
|
|
47
|
+
return text.replace(PATTERNS[mode], '[path]');
|
|
48
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { redactSensitiveContent } from '../security/sensitive-content.js';
|
|
2
|
+
import { withoutLocalPaths } from './local-paths.js';
|
|
3
|
+
|
|
4
|
+
// Text that leaves this computer's own process (a diagnostic event, a
|
|
5
|
+
// visitor's search answer): local paths replaced, URL credentials dropped and
|
|
6
|
+
// query values masked, PEM blocks, known secrets and long opaque values
|
|
7
|
+
// (tokens, signed ids) replaced. When unsure, more is replaced rather than less.
|
|
8
|
+
// Userinfo is everything up to the last @ before the host's path, query or
|
|
9
|
+
// fragment, so a password holding @ or : goes with it.
|
|
10
|
+
const URL_WITH_PARTS = /\b([a-z][a-z0-9+.-]*:\/\/)(?:[^\s/?#]*@)?([^\s?#]*)(\?[^\s#]*)?(#\S*)?/gi;
|
|
11
|
+
// A query pair outside a URL (?token=…, &key=…).
|
|
12
|
+
const QUERY_PAIR = /([?&][A-Za-z_][\w.-]*=)[^\s&#]*/g;
|
|
13
|
+
const PEM_BLOCK = /-----BEGIN [A-Z0-9 ]+-----[\s\S]*?(?:-----END [A-Z0-9 ]+-----|$)/g;
|
|
14
|
+
const OPAQUE_VALUE = /\b[A-Za-z0-9_-]{32,}\b/g;
|
|
15
|
+
|
|
16
|
+
// mode: how far a local path reaches (withoutLocalPaths), 'strict' by default.
|
|
17
|
+
export function shareableText(text, { mode = 'strict' } = {}) {
|
|
18
|
+
const masked = withoutLocalPaths(text.replace(PEM_BLOCK, '[redacted:pem]'), { mode })
|
|
19
|
+
.replace(URL_WITH_PARTS, (_url, scheme, rest, query = '') =>
|
|
20
|
+
`${scheme}${rest}${query && `?${query.slice(1).split('&').map(pair => `${pair.split('=')[0]}=…`).join('&')}`}`)
|
|
21
|
+
.replace(QUERY_PAIR, '$1…');
|
|
22
|
+
return redactSensitiveContent(masked).replace(OPAQUE_VALUE, '[redacted:opaque]');
|
|
23
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { withoutControls } from '../text/control-characters.js';
|
|
2
|
+
import { rateLimitRefusal } from './rate-limit.js';
|
|
3
|
+
import { searchableProject, searchableQueries, searchSharedProject, sharedCard } from './shared-project-search.js';
|
|
4
|
+
import { VisitorAccessStore } from './store.js';
|
|
5
|
+
|
|
6
|
+
// The one port the visiting assistant reaches this computer's shared project
|
|
7
|
+
// knowledge through: a requester from another computer searches one project
|
|
8
|
+
// or looks at who leads it, read-only, rate limited and recorded alike; and the
|
|
9
|
+
// per-requester mode. Every
|
|
10
|
+
// entry answers { ok: true, … } or { ok: false, code } and never throws for
|
|
11
|
+
// what a caller passed; nothing a visitor sends reaches the search but the
|
|
12
|
+
// project id and the queries.
|
|
13
|
+
//
|
|
14
|
+
// requester.key is who is asking, and every limit and record hangs on it. The
|
|
15
|
+
// caller builds it from an authenticated identity only: 'peer:' and the
|
|
16
|
+
// verified TLS fingerprint of the paired device, or 'guest:' and the id of a
|
|
17
|
+
// guest link this computer stored. Never from text the other side sent: the
|
|
18
|
+
// label and agent name are display text and may change freely; they never
|
|
19
|
+
// decide whether a requester is valid (only the key does), so no name can keep
|
|
20
|
+
// an attempt out of the limits and the record.
|
|
21
|
+
//
|
|
22
|
+
// A host that must check something with the Provider (the share's lead, the
|
|
23
|
+
// project's name) passes that check in (confirm, card): it runs only after the
|
|
24
|
+
// attempt is reserved, so a requester past its limits causes no Provider read.
|
|
25
|
+
const MODES = new Set(['ask_only', 'plan', 'auto', 'trusted']);
|
|
26
|
+
const DEFAULT_MODE = 'plan';
|
|
27
|
+
const REQUESTER_KEY = /^(?:peer:[0-9a-f]{64}|guest:[A-Za-z0-9_-]{8,64})$/;
|
|
28
|
+
// Display text is cut to this many UTF-16 units before it is cleaned.
|
|
29
|
+
const MAX_LABEL_UNITS = 1000;
|
|
30
|
+
const LABEL_CHARS = 120;
|
|
31
|
+
const READS_LIMIT = 200;
|
|
32
|
+
|
|
33
|
+
export function createVisitorAccess({ path = ':memory:', application, now = () => new Date(), warn }) {
|
|
34
|
+
const store = new VisitorAccessStore(path, { warn });
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
// confirm(): optional; resolves null to go on, or a refusal code.
|
|
38
|
+
async searchSharedProject({ projectId, requester, queries, confirm = async () => null } = {}) {
|
|
39
|
+
const reservation = reserve({ projectId, requester, action: 'search', asked: () => searchableQueries(queries) });
|
|
40
|
+
if (reservation.code) return refused(reservation.code);
|
|
41
|
+
const refusal = await confirmed(confirm);
|
|
42
|
+
if (refusal) return settle(reservation.id, { outcome: 'refused', code: refusal }, refused(refusal));
|
|
43
|
+
let searched;
|
|
44
|
+
try {
|
|
45
|
+
searched = await searchSharedProject(application, { projectId: reservation.projectId, queries: reservation.queries });
|
|
46
|
+
} catch {
|
|
47
|
+
return settle(reservation.id, { outcome: 'failed', code: 'search_unavailable' }, refused('search_unavailable'));
|
|
48
|
+
}
|
|
49
|
+
return settle(reservation.id, { outcome: 'answered', bytes: searched.bytes,
|
|
50
|
+
resultsCount: searched.answer.results.reduce((count, result) => count + result.items.length, 0) }, searched.answer);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// A look at who answers for a shared project: card() resolves the lead's
|
|
54
|
+
// name and responsibility and the project's name as this computer knows
|
|
55
|
+
// them, or { code } to refuse; recorded and counted like a search, and
|
|
56
|
+
// cleaned like its results.
|
|
57
|
+
async showSharedCard({ projectId, requester, card } = {}) {
|
|
58
|
+
const reservation = reserve({ projectId, requester, action: 'card', asked: () => ({ queries: [] }) });
|
|
59
|
+
if (reservation.code) return refused(reservation.code);
|
|
60
|
+
let shown;
|
|
61
|
+
try {
|
|
62
|
+
const fields = await card();
|
|
63
|
+
if (typeof fields?.code === 'string') {
|
|
64
|
+
const code = plainCode(fields.code);
|
|
65
|
+
return settle(reservation.id, { outcome: 'refused', code }, refused(code));
|
|
66
|
+
}
|
|
67
|
+
shown = sharedCard(fields ?? {});
|
|
68
|
+
} catch {
|
|
69
|
+
return settle(reservation.id, { outcome: 'failed', code: 'card_unavailable' }, refused('card_unavailable'));
|
|
70
|
+
}
|
|
71
|
+
return settle(reservation.id, { outcome: 'answered', bytes: shown.bytes, resultsCount: 1 }, shown.card);
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// A visiting query this computer refused before it reached this port
|
|
75
|
+
// (not shared, a wrong proof, a replay), once the asking device was
|
|
76
|
+
// proven: recorded with its code and counted toward that device's limits.
|
|
77
|
+
// projectId: the share's project when the host knows it, else none.
|
|
78
|
+
recordRefusedVisit({ requester, action, code, projectId = null } = {}) {
|
|
79
|
+
const who = requesterOf(requester);
|
|
80
|
+
if (!who) return refused('requester_invalid');
|
|
81
|
+
if (!ACTIONS.has(action) || typeof code !== 'string' || !PLAIN_CODE.test(code)) return refused('refusal_invalid');
|
|
82
|
+
const project = searchableProject(projectId) ? projectId : '';
|
|
83
|
+
try {
|
|
84
|
+
store.transaction(() => store.recordRefusal({ ...who, projectId: project, action, code, at: now() }));
|
|
85
|
+
return { ok: true };
|
|
86
|
+
} catch {
|
|
87
|
+
return refused(UNAVAILABLE);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
recentReads({ requesterKey = null, projectId = null, limit } = {}) {
|
|
92
|
+
if (requesterKey !== null && !validKey(requesterKey)) return refused('requester_invalid');
|
|
93
|
+
if (projectId !== null && !searchableProject(projectId)) return refused('project_invalid');
|
|
94
|
+
try {
|
|
95
|
+
return { ok: true, reads: store.recentReads({ requesterKey, projectId,
|
|
96
|
+
limit: Number.isSafeInteger(limit) ? Math.min(Math.max(limit, 1), READS_LIMIT) : READS_LIMIT }) };
|
|
97
|
+
} catch {
|
|
98
|
+
return refused(UNAVAILABLE);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
requesterMode(key) {
|
|
103
|
+
if (!validKey(key)) return refused('requester_invalid');
|
|
104
|
+
try { return { ok: true, mode: store.requester(key)?.mode ?? DEFAULT_MODE }; }
|
|
105
|
+
catch { return refused(UNAVAILABLE); }
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
setRequesterMode({ key, kind, label, mode, ownDevice } = {}) {
|
|
109
|
+
const shown = displayText(label);
|
|
110
|
+
if (!validKey(key) || !['peer', 'guest'].includes(kind) || !key.startsWith(`${kind}:`) || !shown) {
|
|
111
|
+
return refused('requester_invalid');
|
|
112
|
+
}
|
|
113
|
+
if (!MODES.has(mode)) return refused('mode_unknown');
|
|
114
|
+
if (mode === 'trusted' && !(kind === 'peer' && ownDevice === true)) return refused('mode_not_allowed');
|
|
115
|
+
try {
|
|
116
|
+
return { ok: true, requester: store.setRequester({ key, kind, label: shown, mode,
|
|
117
|
+
ownDevice: kind === 'peer' && ownDevice === true, at: now().toISOString() }) };
|
|
118
|
+
} catch { return refused(UNAVAILABLE); }
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
close: () => store.close()
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// One attempt, checked and written in one transaction: past the requester's
|
|
125
|
+
// limits, with an invalid project or with what asked() refuses, a 'refused'
|
|
126
|
+
// row with its code; otherwise a 'pending' row the caller settles.
|
|
127
|
+
function reserve({ projectId, requester, action, asked }) {
|
|
128
|
+
const who = requesterOf(requester);
|
|
129
|
+
if (!who) return { code: 'requester_invalid' };
|
|
130
|
+
const at = now();
|
|
131
|
+
const project = searchableProject(projectId) ? projectId : '';
|
|
132
|
+
try {
|
|
133
|
+
return store.transaction(() => {
|
|
134
|
+
const question = asked();
|
|
135
|
+
const code = rateLimitRefusal(store, who.requesterKey, project, at) ?? (project ? null : 'project_invalid')
|
|
136
|
+
?? question.code ?? null;
|
|
137
|
+
if (code) {
|
|
138
|
+
store.recordRefusal({ ...who, projectId: project, action, code, at });
|
|
139
|
+
return { code };
|
|
140
|
+
}
|
|
141
|
+
return { id: store.reserveRead({ ...who, projectId: project, action, queries: question.queries, at }),
|
|
142
|
+
projectId: project, queries: question.queries };
|
|
143
|
+
});
|
|
144
|
+
} catch {
|
|
145
|
+
return { code: UNAVAILABLE };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// A host's check, run after the reservation: a code, or null to go on; a check that throws refuses.
|
|
150
|
+
async function confirmed(confirm) {
|
|
151
|
+
try {
|
|
152
|
+
const code = await confirm();
|
|
153
|
+
return code === null ? null : plainCode(code);
|
|
154
|
+
} catch { return 'confirm_failed'; }
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Finishes a reserved row, then answers; a row that cannot be finished is not
|
|
158
|
+
// answered, so nothing leaves without its record.
|
|
159
|
+
function settle(id, outcome, answer) {
|
|
160
|
+
try {
|
|
161
|
+
store.settleRead(id, outcome);
|
|
162
|
+
return answer;
|
|
163
|
+
} catch {
|
|
164
|
+
return refused(UNAVAILABLE);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const ACTIONS = new Set(['search', 'card']);
|
|
170
|
+
const PLAIN_CODE = /^[a-z][a-z0-9_]{0,39}$/;
|
|
171
|
+
// One word for a store that cannot be used now.
|
|
172
|
+
const UNAVAILABLE = 'visitor_access_unavailable';
|
|
173
|
+
const plainCode = code => (typeof code === 'string' && PLAIN_CODE.test(code) ? code : 'refused');
|
|
174
|
+
|
|
175
|
+
const refused = code => ({ ok: false, code });
|
|
176
|
+
const validKey = key => typeof key === 'string' && REQUESTER_KEY.test(key);
|
|
177
|
+
|
|
178
|
+
// Display text without control or bidirectional characters, cut to
|
|
179
|
+
// MAX_LABEL_UNITS units before cleaning and LABEL_CHARS code points after;
|
|
180
|
+
// null when nothing readable is left.
|
|
181
|
+
function displayText(value) {
|
|
182
|
+
if (typeof value !== 'string') return null;
|
|
183
|
+
return [...withoutControls(value.slice(0, MAX_LABEL_UNITS))].slice(0, LABEL_CHARS).join('').trim() || null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// The requester as recorded, or null only when its key cannot be used. A
|
|
187
|
+
// label with nothing readable becomes the start of the key; an agent name
|
|
188
|
+
// with nothing readable is left out.
|
|
189
|
+
function requesterOf(requester) {
|
|
190
|
+
if (!validKey(requester?.key)) return null;
|
|
191
|
+
return { requesterKey: requester.key, requesterLabel: displayText(requester.label) ?? requester.key.slice(0, LABEL_FALLBACK_CHARS),
|
|
192
|
+
agentName: displayText(requester.agentName) };
|
|
193
|
+
}
|
|
194
|
+
const LABEL_FALLBACK_CHARS = 17;
|